{
"version": 3,
"sources": ["../../../node_modules/markerwithlabel/index.js", "../../../node_modules/flatpickr/dist/plugins/rangePlugin.js", "../../../node_modules/@hotwired/stimulus/dist/stimulus.js", "../../javascript/controllers/announcement_banner_controller.js", "../../javascript/controllers/city_list_controller.js", "../../javascript/controllers/dismiss_controller.js", "../../../node_modules/cleave.js/dist/cleave-esm.js", "../../../node_modules/cleave.js/dist/addons/cleave-phone.us.js", "../../javascript/controllers/format_phone_number_controller.js", "../../javascript/controllers/dropdown_controller.js", "../../javascript/controllers/explore_facilities_controller.js", "../../javascript/controllers/explore_tracking_controller.js", "../../javascript/libraries/map_utility.js", "../../javascript/controllers/explore_map_controller.js", "../../javascript/controllers/modal_controller.js", "../../javascript/controllers/places_controller.js", "../../javascript/controllers/toggle_controller.js", "../../../node_modules/flatpickr/dist/esm/types/options.js", "../../../node_modules/flatpickr/dist/esm/l10n/default.js", "../../../node_modules/flatpickr/dist/esm/utils/index.js", "../../../node_modules/flatpickr/dist/esm/utils/dom.js", "../../../node_modules/flatpickr/dist/esm/utils/formatting.js", "../../../node_modules/flatpickr/dist/esm/utils/dates.js", "../../../node_modules/flatpickr/dist/esm/utils/polyfills.js", "../../../node_modules/flatpickr/dist/esm/index.js", "../../javascript/libraries/datepicker/stimulus-datepicker.js", "../../javascript/libraries/datepicker/utils.js", "../../javascript/libraries/datepicker/config_options.js", "../../javascript/libraries/datepicker/events.js", "../../javascript/libraries/datepicker/elements.js", "../../javascript/libraries/datepicker/strftime_mapping.js", "../../javascript/controllers/freeze_body_controller.js", "../../javascript/explore.js"],
"sourcesContent": ["/**\n * @name MarkerWithLabel for V3\n * @version 1.1.9 [June 30, 2013]\n * @author Gary Little (inspired by code from Marc Ridey of Google).\n * @copyright Copyright 2012 Gary Little [gary at luxcentral.com]\n * @fileoverview MarkerWithLabel extends the Google Maps JavaScript API V3\n * google.maps.Marker
class.\n *
\n * MarkerWithLabel allows you to define markers with associated labels. As you would expect,\n * if the marker is draggable, so too will be the label. In addition, a marker with a label\n * responds to all mouse events in the same manner as a regular marker. It also fires mouse\n * events and \"property changed\" events just as a regular marker would. Version 1.1 adds\n * support for the raiseOnDrag feature introduced in API V3.3.\n *
\n * If you drag a marker by its label, you can cancel the drag and return the marker to its\n * original position by pressing the Esc
key. This doesn't work if you drag the marker\n * itself because this feature is not (yet) supported in the google.maps.Marker
class.\n */\n\n/*!\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*jslint browser:true */\n/*global document,google */\n\n/**\n * @param {Function} childCtor Child class.\n * @param {Function} parentCtor Parent class.\n */\nfunction inherits(childCtor, parentCtor) {\n /** @constructor */\n function tempCtor() {};\n tempCtor.prototype = parentCtor.prototype;\n childCtor.superClass_ = parentCtor.prototype;\n childCtor.prototype = new tempCtor();\n /** @override */\n childCtor.prototype.constructor = childCtor;\n}\n\n/**\n * @param {Object} gMapsApi The Google Maps API instance (usually `google.maps`)\n * @return {Function} The instantiable MarkerWithLabel class\n */\nmodule.exports = function(gMapsApi) {\n\n /**\n * This constructor creates a label and associates it with a marker.\n * It is for the private use of the MarkerWithLabel class.\n * @constructor\n * @param {Marker} marker The marker with which the label is to be associated.\n * @param {string} crossURL The URL of the cross image =.\n * @param {string} handCursor The URL of the hand cursor.\n * @private\n */\n function MarkerLabel_(marker, crossURL, handCursorURL) {\n this.marker_ = marker;\n this.handCursorURL_ = marker.handCursorURL;\n\n this.labelDiv_ = document.createElement(\"div\");\n this.labelDiv_.style.cssText = \"position: absolute; overflow: hidden;\";\n\n // Set up the DIV for handling mouse events in the label. This DIV forms a transparent veil\n // in the \"overlayMouseTarget\" pane, a veil that covers just the label. This is done so that\n // events can be captured even if the label is in the shadow of a google.maps.InfoWindow.\n // Code is included here to ensure the veil is always exactly the same size as the label.\n this.eventDiv_ = document.createElement(\"div\");\n this.eventDiv_.style.cssText = this.labelDiv_.style.cssText;\n\n // This is needed for proper behavior on MSIE:\n this.eventDiv_.addEventListener('selectstart', function() { return false; });\n this.eventDiv_.addEventListener('dragstart', function() { return false; });\n\n // Get the DIV for the \"X\" to be displayed when the marker is raised.\n this.crossDiv_ = MarkerLabel_.getSharedCross(crossURL);\n }\n inherits(MarkerLabel_, gMapsApi.OverlayView);\n\n /**\n * Returns the DIV for the cross used when dragging a marker when the\n * raiseOnDrag parameter set to true. One cross is shared with all markers.\n * @param {string} crossURL The URL of the cross image =.\n * @private\n */\n MarkerLabel_.getSharedCross = function (crossURL) {\n var div;\n if (typeof MarkerLabel_.getSharedCross.crossDiv === \"undefined\") {\n div = document.createElement(\"img\");\n div.style.cssText = \"position: absolute; z-index: 1000002; display: none;\";\n // Hopefully Google never changes the standard \"X\" attributes:\n div.style.marginLeft = \"-8px\";\n div.style.marginTop = \"-9px\";\n div.src = crossURL;\n MarkerLabel_.getSharedCross.crossDiv = div;\n }\n return MarkerLabel_.getSharedCross.crossDiv;\n };\n\n /**\n * Adds the DIV representing the label to the DOM. This method is called\n * automatically when the marker's setMap
method is called.\n * @private\n */\n MarkerLabel_.prototype.onAdd = function () {\n var me = this;\n var cMouseIsDown = false;\n var cDraggingLabel = false;\n var cSavedZIndex;\n var cLatOffset, cLngOffset;\n var cIgnoreClick;\n var cRaiseEnabled;\n var cStartPosition;\n var cStartCenter;\n // Constants:\n var cRaiseOffset = 20;\n var cDraggingCursor = \"url(\" + this.handCursorURL_ + \")\";\n\n // Stops all processing of an event.\n //\n var cAbortEvent = function (e) {\n if (e.preventDefault) {\n e.preventDefault();\n }\n e.cancelBubble = true;\n if (e.stopPropagation) {\n e.stopPropagation();\n }\n };\n\n var cStopBounce = function () {\n me.marker_.setAnimation(null);\n };\n\n this.getPanes().markerLayer.appendChild(this.labelDiv_);\n this.getPanes().overlayMouseTarget.appendChild(this.eventDiv_);\n // One cross is shared with all markers, so only add it once:\n if (typeof MarkerLabel_.getSharedCross.processed === \"undefined\") {\n this.getPanes().markerLayer.appendChild(this.crossDiv_);\n MarkerLabel_.getSharedCross.processed = true;\n }\n\n this.listeners_ = [\n gMapsApi.event.addDomListener(this.eventDiv_, \"mouseover\", function (e) {\n if (me.marker_.getDraggable() || me.marker_.getClickable()) {\n this.style.cursor = \"pointer\";\n gMapsApi.event.trigger(me.marker_, \"mouseover\", e);\n }\n }),\n gMapsApi.event.addDomListener(this.eventDiv_, \"mouseout\", function (e) {\n if ((me.marker_.getDraggable() || me.marker_.getClickable()) && !cDraggingLabel) {\n this.style.cursor = me.marker_.getCursor();\n gMapsApi.event.trigger(me.marker_, \"mouseout\", e);\n }\n }),\n gMapsApi.event.addDomListener(this.eventDiv_, \"mousedown\", function (e) {\n cDraggingLabel = false;\n if (me.marker_.getDraggable()) {\n cMouseIsDown = true;\n this.style.cursor = cDraggingCursor;\n }\n if (me.marker_.getDraggable() || me.marker_.getClickable()) {\n gMapsApi.event.trigger(me.marker_, \"mousedown\", e);\n cAbortEvent(e); // Prevent map pan when starting a drag on a label\n }\n }),\n gMapsApi.event.addDomListener(document, \"mouseup\", function (mEvent) {\n var position;\n if (cMouseIsDown) {\n cMouseIsDown = false;\n me.eventDiv_.style.cursor = \"pointer\";\n gMapsApi.event.trigger(me.marker_, \"mouseup\", mEvent);\n }\n if (cDraggingLabel) {\n if (cRaiseEnabled) { // Lower the marker & label\n position = me.getProjection().fromLatLngToDivPixel(me.marker_.getPosition());\n position.y += cRaiseOffset;\n me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position));\n // This is not the same bouncing style as when the marker portion is dragged,\n // but it will have to do:\n try { // Will fail if running Google Maps API earlier than V3.3\n me.marker_.setAnimation(gMapsApi.Animation.BOUNCE);\n setTimeout(cStopBounce, 1406);\n } catch (e) {}\n }\n me.crossDiv_.style.display = \"none\";\n me.marker_.setZIndex(cSavedZIndex);\n cIgnoreClick = true; // Set flag to ignore the click event reported after a label drag\n cDraggingLabel = false;\n mEvent.latLng = me.marker_.getPosition();\n gMapsApi.event.trigger(me.marker_, \"dragend\", mEvent);\n }\n }),\n gMapsApi.event.addListener(me.marker_.getMap(), \"mousemove\", function (mEvent) {\n var position;\n if (cMouseIsDown) {\n if (cDraggingLabel) {\n // Change the reported location from the mouse position to the marker position:\n mEvent.latLng = new gMapsApi.LatLng(mEvent.latLng.lat() - cLatOffset, mEvent.latLng.lng() - cLngOffset);\n position = me.getProjection().fromLatLngToDivPixel(mEvent.latLng);\n if (cRaiseEnabled) {\n me.crossDiv_.style.left = position.x + \"px\";\n me.crossDiv_.style.top = position.y + \"px\";\n me.crossDiv_.style.display = \"\";\n position.y -= cRaiseOffset;\n }\n me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position));\n if (cRaiseEnabled) { // Don't raise the veil; this hack needed to make MSIE act properly\n me.eventDiv_.style.top = (position.y + cRaiseOffset) + \"px\";\n }\n gMapsApi.event.trigger(me.marker_, \"drag\", mEvent);\n } else {\n // Calculate offsets from the click point to the marker position:\n cLatOffset = mEvent.latLng.lat() - me.marker_.getPosition().lat();\n cLngOffset = mEvent.latLng.lng() - me.marker_.getPosition().lng();\n cSavedZIndex = me.marker_.getZIndex();\n cStartPosition = me.marker_.getPosition();\n cStartCenter = me.marker_.getMap().getCenter();\n cRaiseEnabled = me.marker_.get(\"raiseOnDrag\");\n cDraggingLabel = true;\n me.marker_.setZIndex(1000000); // Moves the marker & label to the foreground during a drag\n mEvent.latLng = me.marker_.getPosition();\n gMapsApi.event.trigger(me.marker_, \"dragstart\", mEvent);\n }\n }\n }),\n gMapsApi.event.addDomListener(document, \"keydown\", function (e) {\n if (cDraggingLabel) {\n if (e.keyCode === 27) { // Esc key\n cRaiseEnabled = false;\n me.marker_.setPosition(cStartPosition);\n me.marker_.getMap().setCenter(cStartCenter);\n gMapsApi.event.trigger(document, \"mouseup\", e);\n }\n }\n }),\n gMapsApi.event.addDomListener(this.eventDiv_, \"click\", function (e) {\n if (me.marker_.getDraggable() || me.marker_.getClickable()) {\n if (cIgnoreClick) { // Ignore the click reported when a label drag ends\n cIgnoreClick = false;\n } else {\n gMapsApi.event.trigger(me.marker_, \"click\", e);\n cAbortEvent(e); // Prevent click from being passed on to map\n }\n }\n }),\n gMapsApi.event.addDomListener(this.eventDiv_, \"dblclick\", function (e) {\n if (me.marker_.getDraggable() || me.marker_.getClickable()) {\n gMapsApi.event.trigger(me.marker_, \"dblclick\", e);\n cAbortEvent(e); // Prevent map zoom when double-clicking on a label\n }\n }),\n gMapsApi.event.addListener(this.marker_, \"dragstart\", function (mEvent) {\n if (!cDraggingLabel) {\n cRaiseEnabled = this.get(\"raiseOnDrag\");\n }\n }),\n gMapsApi.event.addListener(this.marker_, \"drag\", function (mEvent) {\n if (!cDraggingLabel) {\n if (cRaiseEnabled) {\n me.setPosition(cRaiseOffset);\n // During a drag, the marker's z-index is temporarily set to 1000000 to\n // ensure it appears above all other markers. Also set the label's z-index\n // to 1000000 (plus or minus 1 depending on whether the label is supposed\n // to be above or below the marker).\n me.labelDiv_.style.zIndex = 1000000 + (this.get(\"labelInBackground\") ? -1 : +1);\n }\n }\n }),\n gMapsApi.event.addListener(this.marker_, \"dragend\", function (mEvent) {\n if (!cDraggingLabel) {\n if (cRaiseEnabled) {\n me.setPosition(0); // Also restores z-index of label\n }\n }\n }),\n gMapsApi.event.addListener(this.marker_, \"position_changed\", function () {\n me.setPosition();\n }),\n gMapsApi.event.addListener(this.marker_, \"zindex_changed\", function () {\n me.setZIndex();\n }),\n gMapsApi.event.addListener(this.marker_, \"visible_changed\", function () {\n me.setVisible();\n }),\n gMapsApi.event.addListener(this.marker_, \"labelvisible_changed\", function () {\n me.setVisible();\n }),\n gMapsApi.event.addListener(this.marker_, \"title_changed\", function () {\n me.setTitle();\n }),\n gMapsApi.event.addListener(this.marker_, \"labelcontent_changed\", function () {\n me.setContent();\n }),\n gMapsApi.event.addListener(this.marker_, \"labelanchor_changed\", function () {\n me.setAnchor();\n }),\n gMapsApi.event.addListener(this.marker_, \"labelclass_changed\", function () {\n me.setStyles();\n }),\n gMapsApi.event.addListener(this.marker_, \"labelstyle_changed\", function () {\n me.setStyles();\n })\n ];\n };\n\n /**\n * Removes the DIV for the label from the DOM. It also removes all event handlers.\n * This method is called automatically when the marker's setMap(null)
\n * method is called.\n * @private\n */\n MarkerLabel_.prototype.onRemove = function () {\n var i;\n if (this.labelDiv_.parentNode) {\n this.labelDiv_.parentNode.removeChild(this.labelDiv_);\n this.eventDiv_.parentNode.removeChild(this.eventDiv_);\n }\n \n // Remove event listeners:\n if (this.listeners_) {\n for (i = 0; i < this.listeners_.length; i++) {\n gMapsApi.event.removeListener(this.listeners_[i]);\n }\n }\n };\n\n /**\n * Draws the label on the map.\n * @private\n */\n MarkerLabel_.prototype.draw = function () {\n this.setContent();\n this.setTitle();\n this.setStyles();\n };\n\n /**\n * Sets the content of the label.\n * The content can be plain text or an HTML DOM node.\n * @private\n */\n MarkerLabel_.prototype.setContent = function () {\n var content = this.marker_.get(\"labelContent\");\n if (typeof content.nodeType === \"undefined\") {\n this.labelDiv_.innerHTML = content;\n this.eventDiv_.innerHTML = this.labelDiv_.innerHTML;\n } else {\n // Remove current content\n while (this.labelDiv_.lastChild) {\n this.labelDiv_.removeChild(this.labelDiv_.lastChild);\n }\n\n while (this.eventDiv_.lastChild) {\n this.eventDiv_.removeChild(this.eventDiv_.lastChild);\n }\n\n this.labelDiv_.appendChild(content);\n content = content.cloneNode(true);\n this.eventDiv_.appendChild(content);\n }\n };\n\n /**\n * Sets the content of the tool tip for the label. It is\n * always set to be the same as for the marker itself.\n * @private\n */\n MarkerLabel_.prototype.setTitle = function () {\n this.eventDiv_.title = this.marker_.getTitle() || \"\";\n };\n\n /**\n * Sets the style of the label by setting the style sheet and applying\n * other specific styles requested.\n * @private\n */\n MarkerLabel_.prototype.setStyles = function () {\n var i, labelStyle;\n\n // Apply style values from the style sheet defined in the labelClass parameter:\n this.labelDiv_.className = this.marker_.get(\"labelClass\");\n this.eventDiv_.className = this.labelDiv_.className;\n\n // Clear existing inline style values:\n this.labelDiv_.style.cssText = \"\";\n this.eventDiv_.style.cssText = \"\";\n // Apply style values defined in the labelStyle parameter:\n labelStyle = this.marker_.get(\"labelStyle\");\n for (i in labelStyle) {\n if (labelStyle.hasOwnProperty(i)) {\n this.labelDiv_.style[i] = labelStyle[i];\n this.eventDiv_.style[i] = labelStyle[i];\n }\n }\n this.setMandatoryStyles();\n };\n\n /**\n * Sets the mandatory styles to the DIV representing the label as well as to the\n * associated event DIV. This includes setting the DIV position, z-index, and visibility.\n * @private\n */\n MarkerLabel_.prototype.setMandatoryStyles = function () {\n this.labelDiv_.style.position = \"absolute\";\n this.labelDiv_.style.overflow = \"hidden\";\n // Make sure the opacity setting causes the desired effect on MSIE:\n if (typeof this.labelDiv_.style.opacity !== \"undefined\" && this.labelDiv_.style.opacity !== \"\") {\n this.labelDiv_.style.MsFilter = \"\\\"progid:DXImageTransform.Microsoft.Alpha(opacity=\" + (this.labelDiv_.style.opacity * 100) + \")\\\"\";\n this.labelDiv_.style.filter = \"alpha(opacity=\" + (this.labelDiv_.style.opacity * 100) + \")\";\n }\n\n this.eventDiv_.style.position = this.labelDiv_.style.position;\n this.eventDiv_.style.overflow = this.labelDiv_.style.overflow;\n this.eventDiv_.style.opacity = 0.01; // Don't use 0; DIV won't be clickable on MSIE\n this.eventDiv_.style.MsFilter = \"\\\"progid:DXImageTransform.Microsoft.Alpha(opacity=1)\\\"\";\n this.eventDiv_.style.filter = \"alpha(opacity=1)\"; // For MSIE\n\n this.setAnchor();\n this.setPosition(); // This also updates z-index, if necessary.\n this.setVisible();\n };\n\n /**\n * Sets the anchor point of the label.\n * @private\n */\n MarkerLabel_.prototype.setAnchor = function () {\n var anchor = this.marker_.get(\"labelAnchor\");\n this.labelDiv_.style.marginLeft = -anchor.x + \"px\";\n this.labelDiv_.style.marginTop = -anchor.y + \"px\";\n this.eventDiv_.style.marginLeft = -anchor.x + \"px\";\n this.eventDiv_.style.marginTop = -anchor.y + \"px\";\n };\n\n /**\n * Sets the position of the label. The z-index is also updated, if necessary.\n * @private\n */\n MarkerLabel_.prototype.setPosition = function (yOffset) {\n var position = this.getProjection().fromLatLngToDivPixel(this.marker_.getPosition());\n if (typeof yOffset === \"undefined\") {\n yOffset = 0;\n }\n this.labelDiv_.style.left = Math.round(position.x) + \"px\";\n this.labelDiv_.style.top = Math.round(position.y - yOffset) + \"px\";\n this.eventDiv_.style.left = this.labelDiv_.style.left;\n this.eventDiv_.style.top = this.labelDiv_.style.top;\n\n this.setZIndex();\n };\n\n /**\n * Sets the z-index of the label. If the marker's z-index property has not been defined, the z-index\n * of the label is set to the vertical coordinate of the label. This is in keeping with the default\n * stacking order for Google Maps: markers to the south are in front of markers to the north.\n * @private\n */\n MarkerLabel_.prototype.setZIndex = function () {\n var zAdjust = (this.marker_.get(\"labelInBackground\") ? -1 : +1);\n if (typeof this.marker_.getZIndex() === \"undefined\") {\n this.labelDiv_.style.zIndex = parseInt(this.labelDiv_.style.top, 10) + zAdjust;\n this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex;\n } else {\n this.labelDiv_.style.zIndex = this.marker_.getZIndex() + zAdjust;\n this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex;\n }\n };\n\n /**\n * Sets the visibility of the label. The label is visible only if the marker itself is\n * visible (i.e., its visible property is true) and the labelVisible property is true.\n * @private\n */\n MarkerLabel_.prototype.setVisible = function () {\n if (this.marker_.get(\"labelVisible\")) {\n this.labelDiv_.style.display = this.marker_.getVisible() ? \"block\" : \"none\";\n } else {\n this.labelDiv_.style.display = \"none\";\n }\n this.eventDiv_.style.display = this.labelDiv_.style.display;\n };\n\n /**\n * @name MarkerWithLabelOptions\n * @class This class represents the optional parameter passed to the {@link MarkerWithLabel} constructor.\n * The properties available are the same as for google.maps.Marker
with the addition\n * of the properties listed below. To change any of these additional properties after the labeled\n * marker has been created, call google.maps.Marker.set(propertyName, propertyValue)
.\n *
\n * When any of these properties changes, a property changed event is fired. The names of these\n * events are derived from the name of the property and are of the form propertyname_changed
.\n * For example, if the content of the label changes, a labelcontent_changed
event\n * is fired.\n *
\n * @property {string|Node} [labelContent] The content of the label (plain text or an HTML DOM node).\n * @property {Point} [labelAnchor] By default, a label is drawn with its anchor point at (0,0) so\n * that its top left corner is positioned at the anchor point of the associated marker. Use this\n * property to change the anchor point of the label. For example, to center a 50px-wide label\n * beneath a marker, specify a This is an example modal dialog box.labelAnchor
of google.maps.Point(25, 0)
.\n * (Note: x-values increase to the right and y-values increase to the top.)\n * @property {string} [labelClass] The name of the CSS class defining the styles for the label.\n * Note that style values for position
, overflow
, top
,\n * left
, zIndex
, display
, marginLeft
, and\n * marginTop
are ignored; these styles are for internal use only.\n * @property {Object} [labelStyle] An object literal whose properties define specific CSS\n * style values to be applied to the label. Style values defined here override those that may\n * be defined in the labelClass
style sheet. If this property is changed after the\n * label has been created, all previously set styles (except those defined in the style sheet)\n * are removed from the label before the new style values are applied.\n * Note that style values for position
, overflow
, top
,\n * left
, zIndex
, display
, marginLeft
, and\n * marginTop
are ignored; these styles are for internal use only.\n * @property {boolean} [labelInBackground] A flag indicating whether a label that overlaps its\n * associated marker should appear in the background (i.e., in a plane below the marker).\n * The default is false
, which causes the label to appear in the foreground.\n * @property {boolean} [labelVisible] A flag indicating whether the label is to be visible.\n * The default is true
. Note that even if labelVisible
is\n * true
, the label will not be visible unless the associated marker is also\n * visible (i.e., unless the marker's visible
property is true
).\n * @property {boolean} [raiseOnDrag] A flag indicating whether the label and marker are to be\n * raised when the marker is dragged. The default is true
. If a draggable marker is\n * being created and a version of Google Maps API earlier than V3.3 is being used, this property\n * must be set to false
.\n * @property {boolean} [optimized] A flag indicating whether rendering is to be optimized for the\n * marker. Important: The optimized rendering technique is not supported by MarkerWithLabel,\n * so the value of this parameter is always forced to false
.\n * @property {string} [crossImage=\"http://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png\"]\n * The URL of the cross image to be displayed while dragging a marker.\n * @property {string} [handCursor=\"http://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur\"]\n * The URL of the cursor to be displayed while dragging a marker.\n */\n /**\n * Creates a MarkerWithLabel with the options specified in {@link MarkerWithLabelOptions}.\n * @constructor\n * @param {MarkerWithLabelOptions} [opt_options] The optional parameters.\n */\n function MarkerWithLabel(opt_options) {\n opt_options = opt_options || {};\n opt_options.labelContent = opt_options.labelContent || \"\";\n opt_options.labelAnchor = opt_options.labelAnchor || new gMapsApi.Point(0, 0);\n opt_options.labelClass = opt_options.labelClass || \"markerLabels\";\n opt_options.labelStyle = opt_options.labelStyle || {};\n opt_options.labelInBackground = opt_options.labelInBackground || false;\n if (typeof opt_options.labelVisible === \"undefined\") {\n opt_options.labelVisible = true;\n }\n if (typeof opt_options.raiseOnDrag === \"undefined\") {\n opt_options.raiseOnDrag = true;\n }\n if (typeof opt_options.clickable === \"undefined\") {\n opt_options.clickable = true;\n }\n if (typeof opt_options.draggable === \"undefined\") {\n opt_options.draggable = false;\n }\n if (typeof opt_options.optimized === \"undefined\") {\n opt_options.optimized = false;\n }\n opt_options.crossImage = opt_options.crossImage || \"http\" + (document.location.protocol === \"https:\" ? \"s\" : \"\") + \"://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png\";\n opt_options.handCursor = opt_options.handCursor || \"http\" + (document.location.protocol === \"https:\" ? \"s\" : \"\") + \"://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur\";\n opt_options.optimized = false; // Optimized rendering is not supported\n\n this.label = new MarkerLabel_(this, opt_options.crossImage, opt_options.handCursor); // Bind the label to the marker\n\n // Call the parent constructor. It calls Marker.setValues to initialize, so all\n // the new parameters are conveniently saved and can be accessed with get/set.\n // Marker.set triggers a property changed event (called \"propertyname_changed\")\n // that the marker label listens for in order to react to state changes.\n gMapsApi.Marker.apply(this, arguments);\n }\n inherits(MarkerWithLabel, gMapsApi.Marker);\n\n /**\n * Overrides the standard Marker setMap function.\n * @param {Map} theMap The map to which the marker is to be added.\n * @private\n */\n MarkerWithLabel.prototype.setMap = function (theMap) {\n\n // Call the inherited function...\n gMapsApi.Marker.prototype.setMap.apply(this, arguments);\n\n // ... then deal with the label:\n this.label.setMap(theMap);\n };\n\n return MarkerWithLabel;\n}\n", "(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.rangePlugin = factory());\n}(this, (function () { 'use strict';\n\n /*! *****************************************************************************\r\n Copyright (c) Microsoft Corporation.\r\n\r\n Permission to use, copy, modify, and/or distribute this software for any\r\n purpose with or without fee is hereby granted.\r\n\r\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\n PERFORMANCE OF THIS SOFTWARE.\r\n ***************************************************************************** */\r\n\r\n function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n }\n\n function rangePlugin(config) {\n if (config === void 0) { config = {}; }\n return function (fp) {\n var dateFormat = \"\", secondInput, _secondInputFocused, _prevDates;\n var createSecondInput = function () {\n if (config.input) {\n secondInput =\n config.input instanceof Element\n ? config.input\n : window.document.querySelector(config.input);\n if (!secondInput) {\n fp.config.errorHandler(new Error(\"Invalid input element specified\"));\n return;\n }\n if (fp.config.wrap) {\n secondInput = secondInput.querySelector(\"[data-input]\");\n }\n }\n else {\n secondInput = fp._input.cloneNode();\n secondInput.removeAttribute(\"id\");\n secondInput._flatpickr = undefined;\n }\n if (secondInput.value) {\n var parsedDate = fp.parseDate(secondInput.value);\n if (parsedDate)\n fp.selectedDates.push(parsedDate);\n }\n secondInput.setAttribute(\"data-fp-omit\", \"\");\n if (fp.config.clickOpens) {\n fp._bind(secondInput, [\"focus\", \"click\"], function () {\n if (fp.selectedDates[1]) {\n fp.latestSelectedDateObj = fp.selectedDates[1];\n fp._setHoursFromDate(fp.selectedDates[1]);\n fp.jumpToDate(fp.selectedDates[1]);\n }\n _secondInputFocused = true;\n fp.isOpen = false;\n fp.open(undefined, config.position === \"left\" ? fp._input : secondInput);\n });\n fp._bind(fp._input, [\"focus\", \"click\"], function (e) {\n e.preventDefault();\n fp.isOpen = false;\n fp.open();\n });\n }\n if (fp.config.allowInput)\n fp._bind(secondInput, \"keydown\", function (e) {\n if (e.key === \"Enter\") {\n fp.setDate([fp.selectedDates[0], secondInput.value], true, dateFormat);\n secondInput.click();\n }\n });\n if (!config.input)\n fp._input.parentNode &&\n fp._input.parentNode.insertBefore(secondInput, fp._input.nextSibling);\n };\n var plugin = {\n onParseConfig: function () {\n fp.config.mode = \"range\";\n dateFormat = fp.config.altInput\n ? fp.config.altFormat\n : fp.config.dateFormat;\n },\n onReady: function () {\n createSecondInput();\n fp.config.ignoredFocusElements.push(secondInput);\n if (fp.config.allowInput) {\n fp._input.removeAttribute(\"readonly\");\n secondInput.removeAttribute(\"readonly\");\n }\n else {\n secondInput.setAttribute(\"readonly\", \"readonly\");\n }\n fp._bind(fp._input, \"focus\", function () {\n fp.latestSelectedDateObj = fp.selectedDates[0];\n fp._setHoursFromDate(fp.selectedDates[0]);\n _secondInputFocused = false;\n fp.jumpToDate(fp.selectedDates[0]);\n });\n if (fp.config.allowInput)\n fp._bind(fp._input, \"keydown\", function (e) {\n if (e.key === \"Enter\")\n fp.setDate([fp._input.value, fp.selectedDates[1]], true, dateFormat);\n });\n fp.setDate(fp.selectedDates, false);\n plugin.onValueUpdate(fp.selectedDates);\n fp.loadedPlugins.push(\"range\");\n },\n onPreCalendarPosition: function () {\n if (_secondInputFocused) {\n fp._positionElement = secondInput;\n setTimeout(function () {\n fp._positionElement = fp._input;\n }, 0);\n }\n },\n onChange: function () {\n if (!fp.selectedDates.length) {\n setTimeout(function () {\n if (fp.selectedDates.length)\n return;\n secondInput.value = \"\";\n _prevDates = [];\n }, 10);\n }\n if (_secondInputFocused) {\n setTimeout(function () {\n secondInput.focus();\n }, 0);\n }\n },\n onDestroy: function () {\n if (!config.input)\n secondInput.parentNode &&\n secondInput.parentNode.removeChild(secondInput);\n },\n onValueUpdate: function (selDates) {\n var _a, _b, _c;\n if (!secondInput)\n return;\n _prevDates =\n !_prevDates || selDates.length >= _prevDates.length\n ? __spreadArrays(selDates) : _prevDates;\n if (_prevDates.length > selDates.length) {\n var newSelectedDate = selDates[0];\n var newDates = _secondInputFocused\n ? [_prevDates[0], newSelectedDate]\n : [newSelectedDate, _prevDates[1]];\n if (newDates[0].getTime() > newDates[1].getTime()) {\n if (_secondInputFocused) {\n newDates[0] = newDates[1];\n }\n else {\n newDates[1] = newDates[0];\n }\n }\n fp.setDate(newDates, false);\n _prevDates = __spreadArrays(newDates);\n }\n _a = fp.selectedDates.map(function (d) { return fp.formatDate(d, dateFormat); }), _b = _a[0], fp._input.value = _b === void 0 ? \"\" : _b, _c = _a[1], secondInput.value = _c === void 0 ? \"\" : _c;\n },\n };\n return plugin;\n };\n }\n\n return rangePlugin;\n\n})));\n", "/*\nStimulus 3.1.0\nCopyright \u00A9 2022 Basecamp, LLC\n */\nclass EventListener {\n constructor(eventTarget, eventName, eventOptions) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.eventOptions = eventOptions;\n this.unorderedBindings = new Set();\n }\n connect() {\n this.eventTarget.addEventListener(this.eventName, this, this.eventOptions);\n }\n disconnect() {\n this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions);\n }\n bindingConnected(binding) {\n this.unorderedBindings.add(binding);\n }\n bindingDisconnected(binding) {\n this.unorderedBindings.delete(binding);\n }\n handleEvent(event) {\n const extendedEvent = extendEvent(event);\n for (const binding of this.bindings) {\n if (extendedEvent.immediatePropagationStopped) {\n break;\n }\n else {\n binding.handleEvent(extendedEvent);\n }\n }\n }\n get bindings() {\n return Array.from(this.unorderedBindings).sort((left, right) => {\n const leftIndex = left.index, rightIndex = right.index;\n return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;\n });\n }\n}\nfunction extendEvent(event) {\n if (\"immediatePropagationStopped\" in event) {\n return event;\n }\n else {\n const { stopImmediatePropagation } = event;\n return Object.assign(event, {\n immediatePropagationStopped: false,\n stopImmediatePropagation() {\n this.immediatePropagationStopped = true;\n stopImmediatePropagation.call(this);\n }\n });\n }\n}\n\nclass Dispatcher {\n constructor(application) {\n this.application = application;\n this.eventListenerMaps = new Map;\n this.started = false;\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.eventListeners.forEach(eventListener => eventListener.connect());\n }\n }\n stop() {\n if (this.started) {\n this.started = false;\n this.eventListeners.forEach(eventListener => eventListener.disconnect());\n }\n }\n get eventListeners() {\n return Array.from(this.eventListenerMaps.values())\n .reduce((listeners, map) => listeners.concat(Array.from(map.values())), []);\n }\n bindingConnected(binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n }\n bindingDisconnected(binding) {\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n }\n handleError(error, message, detail = {}) {\n this.application.handleError(error, `Error ${message}`, detail);\n }\n fetchEventListenerForBinding(binding) {\n const { eventTarget, eventName, eventOptions } = binding;\n return this.fetchEventListener(eventTarget, eventName, eventOptions);\n }\n fetchEventListener(eventTarget, eventName, eventOptions) {\n const eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n const cacheKey = this.cacheKey(eventName, eventOptions);\n let eventListener = eventListenerMap.get(cacheKey);\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName, eventOptions);\n eventListenerMap.set(cacheKey, eventListener);\n }\n return eventListener;\n }\n createEventListener(eventTarget, eventName, eventOptions) {\n const eventListener = new EventListener(eventTarget, eventName, eventOptions);\n if (this.started) {\n eventListener.connect();\n }\n return eventListener;\n }\n fetchEventListenerMapForEventTarget(eventTarget) {\n let eventListenerMap = this.eventListenerMaps.get(eventTarget);\n if (!eventListenerMap) {\n eventListenerMap = new Map;\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n return eventListenerMap;\n }\n cacheKey(eventName, eventOptions) {\n const parts = [eventName];\n Object.keys(eventOptions).sort().forEach(key => {\n parts.push(`${eventOptions[key] ? \"\" : \"!\"}${key}`);\n });\n return parts.join(\":\");\n }\n}\n\nconst descriptorPattern = /^((.+?)(@(window|document))?->)?(.+?)(#([^:]+?))(:(.+))?$/;\nfunction parseActionDescriptorString(descriptorString) {\n const source = descriptorString.trim();\n const matches = source.match(descriptorPattern) || [];\n return {\n eventTarget: parseEventTarget(matches[4]),\n eventName: matches[2],\n eventOptions: matches[9] ? parseEventOptions(matches[9]) : {},\n identifier: matches[5],\n methodName: matches[7]\n };\n}\nfunction parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n }\n else if (eventTargetName == \"document\") {\n return document;\n }\n}\nfunction parseEventOptions(eventOptions) {\n return eventOptions.split(\":\").reduce((options, token) => Object.assign(options, { [token.replace(/^!/, \"\")]: !/^!/.test(token) }), {});\n}\nfunction stringifyEventTarget(eventTarget) {\n if (eventTarget == window) {\n return \"window\";\n }\n else if (eventTarget == document) {\n return \"document\";\n }\n}\n\nfunction camelize(value) {\n return value.replace(/(?:[_-])([a-z0-9])/g, (_, char) => char.toUpperCase());\n}\nfunction capitalize(value) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\nfunction dasherize(value) {\n return value.replace(/([A-Z])/g, (_, char) => `-${char.toLowerCase()}`);\n}\nfunction tokenize(value) {\n return value.match(/[^\\s]+/g) || [];\n}\n\nclass Action {\n constructor(element, index, descriptor) {\n this.element = element;\n this.index = index;\n this.eventTarget = descriptor.eventTarget || element;\n this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error(\"missing event name\");\n this.eventOptions = descriptor.eventOptions || {};\n this.identifier = descriptor.identifier || error(\"missing identifier\");\n this.methodName = descriptor.methodName || error(\"missing method name\");\n }\n static forToken(token) {\n return new this(token.element, token.index, parseActionDescriptorString(token.content));\n }\n toString() {\n const eventNameSuffix = this.eventTargetName ? `@${this.eventTargetName}` : \"\";\n return `${this.eventName}${eventNameSuffix}->${this.identifier}#${this.methodName}`;\n }\n get params() {\n const params = {};\n const pattern = new RegExp(`^data-${this.identifier}-(.+)-param$`);\n for (const { name, value } of Array.from(this.element.attributes)) {\n const match = name.match(pattern);\n const key = match && match[1];\n if (key) {\n params[camelize(key)] = typecast(value);\n }\n }\n return params;\n }\n get eventTargetName() {\n return stringifyEventTarget(this.eventTarget);\n }\n}\nconst defaultEventNames = {\n \"a\": e => \"click\",\n \"button\": e => \"click\",\n \"form\": e => \"submit\",\n \"details\": e => \"toggle\",\n \"input\": e => e.getAttribute(\"type\") == \"submit\" ? \"click\" : \"input\",\n \"select\": e => \"change\",\n \"textarea\": e => \"input\"\n};\nfunction getDefaultEventNameForElement(element) {\n const tagName = element.tagName.toLowerCase();\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n}\nfunction error(message) {\n throw new Error(message);\n}\nfunction typecast(value) {\n try {\n return JSON.parse(value);\n }\n catch (o_O) {\n return value;\n }\n}\n\nclass Binding {\n constructor(context, action) {\n this.context = context;\n this.action = action;\n }\n get index() {\n return this.action.index;\n }\n get eventTarget() {\n return this.action.eventTarget;\n }\n get eventOptions() {\n return this.action.eventOptions;\n }\n get identifier() {\n return this.context.identifier;\n }\n handleEvent(event) {\n if (this.willBeInvokedByEvent(event) && this.shouldBeInvokedPerSelf(event)) {\n this.processStopPropagation(event);\n this.processPreventDefault(event);\n this.invokeWithEvent(event);\n }\n }\n get eventName() {\n return this.action.eventName;\n }\n get method() {\n const method = this.controller[this.methodName];\n if (typeof method == \"function\") {\n return method;\n }\n throw new Error(`Action \"${this.action}\" references undefined method \"${this.methodName}\"`);\n }\n processStopPropagation(event) {\n if (this.eventOptions.stop) {\n event.stopPropagation();\n }\n }\n processPreventDefault(event) {\n if (this.eventOptions.prevent) {\n event.preventDefault();\n }\n }\n invokeWithEvent(event) {\n const { target, currentTarget } = event;\n try {\n const { params } = this.action;\n const actionEvent = Object.assign(event, { params });\n this.method.call(this.controller, actionEvent);\n this.context.logDebugActivity(this.methodName, { event, target, currentTarget, action: this.methodName });\n }\n catch (error) {\n const { identifier, controller, element, index } = this;\n const detail = { identifier, controller, element, index, event };\n this.context.handleError(error, `invoking action \"${this.action}\"`, detail);\n }\n }\n shouldBeInvokedPerSelf(event) {\n if (this.action.eventOptions.self === true) {\n return this.action.element === event.target;\n }\n else {\n return true;\n }\n }\n willBeInvokedByEvent(event) {\n const eventTarget = event.target;\n if (this.element === eventTarget) {\n return true;\n }\n else if (eventTarget instanceof Element && this.element.contains(eventTarget)) {\n return this.scope.containsElement(eventTarget);\n }\n else {\n return this.scope.containsElement(this.action.element);\n }\n }\n get controller() {\n return this.context.controller;\n }\n get methodName() {\n return this.action.methodName;\n }\n get element() {\n return this.scope.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\n\nclass ElementObserver {\n constructor(element, delegate) {\n this.mutationObserverInit = { attributes: true, childList: true, subtree: true };\n this.element = element;\n this.started = false;\n this.delegate = delegate;\n this.elements = new Set;\n this.mutationObserver = new MutationObserver((mutations) => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.refresh();\n }\n }\n pause(callback) {\n if (this.started) {\n this.mutationObserver.disconnect();\n this.started = false;\n }\n callback();\n if (!this.started) {\n this.mutationObserver.observe(this.element, this.mutationObserverInit);\n this.started = true;\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n const matches = new Set(this.matchElementsInTree());\n for (const element of Array.from(this.elements)) {\n if (!matches.has(element)) {\n this.removeElement(element);\n }\n }\n for (const element of Array.from(matches)) {\n this.addElement(element);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n if (mutation.type == \"attributes\") {\n this.processAttributeChange(mutation.target, mutation.attributeName);\n }\n else if (mutation.type == \"childList\") {\n this.processRemovedNodes(mutation.removedNodes);\n this.processAddedNodes(mutation.addedNodes);\n }\n }\n processAttributeChange(node, attributeName) {\n const element = node;\n if (this.elements.has(element)) {\n if (this.delegate.elementAttributeChanged && this.matchElement(element)) {\n this.delegate.elementAttributeChanged(element, attributeName);\n }\n else {\n this.removeElement(element);\n }\n }\n else if (this.matchElement(element)) {\n this.addElement(element);\n }\n }\n processRemovedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element) {\n this.processTree(element, this.removeElement);\n }\n }\n }\n processAddedNodes(nodes) {\n for (const node of Array.from(nodes)) {\n const element = this.elementFromNode(node);\n if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n }\n matchElement(element) {\n return this.delegate.matchElement(element);\n }\n matchElementsInTree(tree = this.element) {\n return this.delegate.matchElementsInTree(tree);\n }\n processTree(tree, processor) {\n for (const element of this.matchElementsInTree(tree)) {\n processor.call(this, element);\n }\n }\n elementFromNode(node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\n }\n }\n elementIsActive(element) {\n if (element.isConnected != this.element.isConnected) {\n return false;\n }\n else {\n return this.element.contains(element);\n }\n }\n addElement(element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n }\n removeElement(element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n }\n}\n\nclass AttributeObserver {\n constructor(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n get element() {\n return this.elementObserver.element;\n }\n get selector() {\n return `[${this.attributeName}]`;\n }\n start() {\n this.elementObserver.start();\n }\n pause(callback) {\n this.elementObserver.pause(callback);\n }\n stop() {\n this.elementObserver.stop();\n }\n refresh() {\n this.elementObserver.refresh();\n }\n get started() {\n return this.elementObserver.started;\n }\n matchElement(element) {\n return element.hasAttribute(this.attributeName);\n }\n matchElementsInTree(tree) {\n const match = this.matchElement(tree) ? [tree] : [];\n const matches = Array.from(tree.querySelectorAll(this.selector));\n return match.concat(matches);\n }\n elementMatched(element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n }\n elementUnmatched(element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\n }\n }\n elementAttributeChanged(element, attributeName) {\n if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {\n this.delegate.elementAttributeValueChanged(element, attributeName);\n }\n }\n}\n\nclass StringMapObserver {\n constructor(element, delegate) {\n this.element = element;\n this.delegate = delegate;\n this.started = false;\n this.stringMap = new Map;\n this.mutationObserver = new MutationObserver(mutations => this.processMutations(mutations));\n }\n start() {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, { attributes: true, attributeOldValue: true });\n this.refresh();\n }\n }\n stop() {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n }\n refresh() {\n if (this.started) {\n for (const attributeName of this.knownAttributeNames) {\n this.refreshAttribute(attributeName, null);\n }\n }\n }\n processMutations(mutations) {\n if (this.started) {\n for (const mutation of mutations) {\n this.processMutation(mutation);\n }\n }\n }\n processMutation(mutation) {\n const attributeName = mutation.attributeName;\n if (attributeName) {\n this.refreshAttribute(attributeName, mutation.oldValue);\n }\n }\n refreshAttribute(attributeName, oldValue) {\n const key = this.delegate.getStringMapKeyForAttribute(attributeName);\n if (key != null) {\n if (!this.stringMap.has(attributeName)) {\n this.stringMapKeyAdded(key, attributeName);\n }\n const value = this.element.getAttribute(attributeName);\n if (this.stringMap.get(attributeName) != value) {\n this.stringMapValueChanged(value, key, oldValue);\n }\n if (value == null) {\n const oldValue = this.stringMap.get(attributeName);\n this.stringMap.delete(attributeName);\n if (oldValue)\n this.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n else {\n this.stringMap.set(attributeName, value);\n }\n }\n }\n stringMapKeyAdded(key, attributeName) {\n if (this.delegate.stringMapKeyAdded) {\n this.delegate.stringMapKeyAdded(key, attributeName);\n }\n }\n stringMapValueChanged(value, key, oldValue) {\n if (this.delegate.stringMapValueChanged) {\n this.delegate.stringMapValueChanged(value, key, oldValue);\n }\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n if (this.delegate.stringMapKeyRemoved) {\n this.delegate.stringMapKeyRemoved(key, attributeName, oldValue);\n }\n }\n get knownAttributeNames() {\n return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)));\n }\n get currentAttributeNames() {\n return Array.from(this.element.attributes).map(attribute => attribute.name);\n }\n get recordedAttributeNames() {\n return Array.from(this.stringMap.keys());\n }\n}\n\nfunction add(map, key, value) {\n fetch(map, key).add(value);\n}\nfunction del(map, key, value) {\n fetch(map, key).delete(value);\n prune(map, key);\n}\nfunction fetch(map, key) {\n let values = map.get(key);\n if (!values) {\n values = new Set();\n map.set(key, values);\n }\n return values;\n}\nfunction prune(map, key) {\n const values = map.get(key);\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n}\n\nclass Multimap {\n constructor() {\n this.valuesByKey = new Map();\n }\n get keys() {\n return Array.from(this.valuesByKey.keys());\n }\n get values() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((values, set) => values.concat(Array.from(set)), []);\n }\n get size() {\n const sets = Array.from(this.valuesByKey.values());\n return sets.reduce((size, set) => size + set.size, 0);\n }\n add(key, value) {\n add(this.valuesByKey, key, value);\n }\n delete(key, value) {\n del(this.valuesByKey, key, value);\n }\n has(key, value) {\n const values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n }\n hasKey(key) {\n return this.valuesByKey.has(key);\n }\n hasValue(value) {\n const sets = Array.from(this.valuesByKey.values());\n return sets.some(set => set.has(value));\n }\n getValuesForKey(key) {\n const values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\n }\n getKeysForValue(value) {\n return Array.from(this.valuesByKey)\n .filter(([key, values]) => values.has(value))\n .map(([key, values]) => key);\n }\n}\n\nclass IndexedMultimap extends Multimap {\n constructor() {\n super();\n this.keysByValue = new Map;\n }\n get values() {\n return Array.from(this.keysByValue.keys());\n }\n add(key, value) {\n super.add(key, value);\n add(this.keysByValue, value, key);\n }\n delete(key, value) {\n super.delete(key, value);\n del(this.keysByValue, value, key);\n }\n hasValue(value) {\n return this.keysByValue.has(value);\n }\n getKeysForValue(value) {\n const set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n }\n}\n\nclass TokenListObserver {\n constructor(element, attributeName, delegate) {\n this.attributeObserver = new AttributeObserver(element, attributeName, this);\n this.delegate = delegate;\n this.tokensByElement = new Multimap;\n }\n get started() {\n return this.attributeObserver.started;\n }\n start() {\n this.attributeObserver.start();\n }\n pause(callback) {\n this.attributeObserver.pause(callback);\n }\n stop() {\n this.attributeObserver.stop();\n }\n refresh() {\n this.attributeObserver.refresh();\n }\n get element() {\n return this.attributeObserver.element;\n }\n get attributeName() {\n return this.attributeObserver.attributeName;\n }\n elementMatchedAttribute(element) {\n this.tokensMatched(this.readTokensForElement(element));\n }\n elementAttributeValueChanged(element) {\n const [unmatchedTokens, matchedTokens] = this.refreshTokensForElement(element);\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n }\n elementUnmatchedAttribute(element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n }\n tokensMatched(tokens) {\n tokens.forEach(token => this.tokenMatched(token));\n }\n tokensUnmatched(tokens) {\n tokens.forEach(token => this.tokenUnmatched(token));\n }\n tokenMatched(token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n }\n tokenUnmatched(token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\n }\n refreshTokensForElement(element) {\n const previousTokens = this.tokensByElement.getValuesForKey(element);\n const currentTokens = this.readTokensForElement(element);\n const firstDifferingIndex = zip(previousTokens, currentTokens)\n .findIndex(([previousToken, currentToken]) => !tokensAreEqual(previousToken, currentToken));\n if (firstDifferingIndex == -1) {\n return [[], []];\n }\n else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\n }\n }\n readTokensForElement(element) {\n const attributeName = this.attributeName;\n const tokenString = element.getAttribute(attributeName) || \"\";\n return parseTokenString(tokenString, element, attributeName);\n }\n}\nfunction parseTokenString(tokenString, element, attributeName) {\n return tokenString.trim().split(/\\s+/).filter(content => content.length)\n .map((content, index) => ({ element, attributeName, content, index }));\n}\nfunction zip(left, right) {\n const length = Math.max(left.length, right.length);\n return Array.from({ length }, (_, index) => [left[index], right[index]]);\n}\nfunction tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n}\n\nclass ValueListObserver {\n constructor(element, attributeName, delegate) {\n this.tokenListObserver = new TokenListObserver(element, attributeName, this);\n this.delegate = delegate;\n this.parseResultsByToken = new WeakMap;\n this.valuesByTokenByElement = new WeakMap;\n }\n get started() {\n return this.tokenListObserver.started;\n }\n start() {\n this.tokenListObserver.start();\n }\n stop() {\n this.tokenListObserver.stop();\n }\n refresh() {\n this.tokenListObserver.refresh();\n }\n get element() {\n return this.tokenListObserver.element;\n }\n get attributeName() {\n return this.tokenListObserver.attributeName;\n }\n tokenMatched(token) {\n const { element } = token;\n const { value } = this.fetchParseResultForToken(token);\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n }\n tokenUnmatched(token) {\n const { element } = token;\n const { value } = this.fetchParseResultForToken(token);\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n }\n fetchParseResultForToken(token) {\n let parseResult = this.parseResultsByToken.get(token);\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n return parseResult;\n }\n fetchValuesByTokenForElement(element) {\n let valuesByToken = this.valuesByTokenByElement.get(element);\n if (!valuesByToken) {\n valuesByToken = new Map;\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n return valuesByToken;\n }\n parseToken(token) {\n try {\n const value = this.delegate.parseValueForToken(token);\n return { value };\n }\n catch (error) {\n return { error };\n }\n }\n}\n\nclass BindingObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map;\n }\n start() {\n if (!this.valueListObserver) {\n this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this);\n this.valueListObserver.start();\n }\n }\n stop() {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n }\n get element() {\n return this.context.element;\n }\n get identifier() {\n return this.context.identifier;\n }\n get actionAttribute() {\n return this.schema.actionAttribute;\n }\n get schema() {\n return this.context.schema;\n }\n get bindings() {\n return Array.from(this.bindingsByAction.values());\n }\n connectAction(action) {\n const binding = new Binding(this.context, action);\n this.bindingsByAction.set(action, binding);\n this.delegate.bindingConnected(binding);\n }\n disconnectAction(action) {\n const binding = this.bindingsByAction.get(action);\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n }\n disconnectAllActions() {\n this.bindings.forEach(binding => this.delegate.bindingDisconnected(binding));\n this.bindingsByAction.clear();\n }\n parseValueForToken(token) {\n const action = Action.forToken(token);\n if (action.identifier == this.identifier) {\n return action;\n }\n }\n elementMatchedValue(element, action) {\n this.connectAction(action);\n }\n elementUnmatchedValue(element, action) {\n this.disconnectAction(action);\n }\n}\n\nclass ValueObserver {\n constructor(context, receiver) {\n this.context = context;\n this.receiver = receiver;\n this.stringMapObserver = new StringMapObserver(this.element, this);\n this.valueDescriptorMap = this.controller.valueDescriptorMap;\n }\n start() {\n this.stringMapObserver.start();\n this.invokeChangedCallbacksForDefaultValues();\n }\n stop() {\n this.stringMapObserver.stop();\n }\n get element() {\n return this.context.element;\n }\n get controller() {\n return this.context.controller;\n }\n getStringMapKeyForAttribute(attributeName) {\n if (attributeName in this.valueDescriptorMap) {\n return this.valueDescriptorMap[attributeName].name;\n }\n }\n stringMapKeyAdded(key, attributeName) {\n const descriptor = this.valueDescriptorMap[attributeName];\n if (!this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), descriptor.writer(descriptor.defaultValue));\n }\n }\n stringMapValueChanged(value, name, oldValue) {\n const descriptor = this.valueDescriptorNameMap[name];\n if (value === null)\n return;\n if (oldValue === null) {\n oldValue = descriptor.writer(descriptor.defaultValue);\n }\n this.invokeChangedCallback(name, value, oldValue);\n }\n stringMapKeyRemoved(key, attributeName, oldValue) {\n const descriptor = this.valueDescriptorNameMap[key];\n if (this.hasValue(key)) {\n this.invokeChangedCallback(key, descriptor.writer(this.receiver[key]), oldValue);\n }\n else {\n this.invokeChangedCallback(key, descriptor.writer(descriptor.defaultValue), oldValue);\n }\n }\n invokeChangedCallbacksForDefaultValues() {\n for (const { key, name, defaultValue, writer } of this.valueDescriptors) {\n if (defaultValue != undefined && !this.controller.data.has(key)) {\n this.invokeChangedCallback(name, writer(defaultValue), undefined);\n }\n }\n }\n invokeChangedCallback(name, rawValue, rawOldValue) {\n const changedMethodName = `${name}Changed`;\n const changedMethod = this.receiver[changedMethodName];\n if (typeof changedMethod == \"function\") {\n const descriptor = this.valueDescriptorNameMap[name];\n try {\n const value = descriptor.reader(rawValue);\n let oldValue = rawOldValue;\n if (rawOldValue) {\n oldValue = descriptor.reader(rawOldValue);\n }\n changedMethod.call(this.receiver, value, oldValue);\n }\n catch (error) {\n if (!(error instanceof TypeError))\n throw error;\n throw new TypeError(`Stimulus Value \"${this.context.identifier}.${descriptor.name}\" - ${error.message}`);\n }\n }\n }\n get valueDescriptors() {\n const { valueDescriptorMap } = this;\n return Object.keys(valueDescriptorMap).map(key => valueDescriptorMap[key]);\n }\n get valueDescriptorNameMap() {\n const descriptors = {};\n Object.keys(this.valueDescriptorMap).forEach(key => {\n const descriptor = this.valueDescriptorMap[key];\n descriptors[descriptor.name] = descriptor;\n });\n return descriptors;\n }\n hasValue(attributeName) {\n const descriptor = this.valueDescriptorNameMap[attributeName];\n const hasMethodName = `has${capitalize(descriptor.name)}`;\n return this.receiver[hasMethodName];\n }\n}\n\nclass TargetObserver {\n constructor(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.targetsByName = new Multimap;\n }\n start() {\n if (!this.tokenListObserver) {\n this.tokenListObserver = new TokenListObserver(this.element, this.attributeName, this);\n this.tokenListObserver.start();\n }\n }\n stop() {\n if (this.tokenListObserver) {\n this.disconnectAllTargets();\n this.tokenListObserver.stop();\n delete this.tokenListObserver;\n }\n }\n tokenMatched({ element, content: name }) {\n if (this.scope.containsElement(element)) {\n this.connectTarget(element, name);\n }\n }\n tokenUnmatched({ element, content: name }) {\n this.disconnectTarget(element, name);\n }\n connectTarget(element, name) {\n var _a;\n if (!this.targetsByName.has(name, element)) {\n this.targetsByName.add(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetConnected(element, name));\n }\n }\n disconnectTarget(element, name) {\n var _a;\n if (this.targetsByName.has(name, element)) {\n this.targetsByName.delete(name, element);\n (_a = this.tokenListObserver) === null || _a === void 0 ? void 0 : _a.pause(() => this.delegate.targetDisconnected(element, name));\n }\n }\n disconnectAllTargets() {\n for (const name of this.targetsByName.keys) {\n for (const element of this.targetsByName.getValuesForKey(name)) {\n this.disconnectTarget(element, name);\n }\n }\n }\n get attributeName() {\n return `data-${this.context.identifier}-target`;\n }\n get element() {\n return this.context.element;\n }\n get scope() {\n return this.context.scope;\n }\n}\n\nclass Context {\n constructor(module, scope) {\n this.logDebugActivity = (functionName, detail = {}) => {\n const { identifier, controller, element } = this;\n detail = Object.assign({ identifier, controller, element }, detail);\n this.application.logDebugActivity(this.identifier, functionName, detail);\n };\n this.module = module;\n this.scope = scope;\n this.controller = new module.controllerConstructor(this);\n this.bindingObserver = new BindingObserver(this, this.dispatcher);\n this.valueObserver = new ValueObserver(this, this.controller);\n this.targetObserver = new TargetObserver(this, this);\n try {\n this.controller.initialize();\n this.logDebugActivity(\"initialize\");\n }\n catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n connect() {\n this.bindingObserver.start();\n this.valueObserver.start();\n this.targetObserver.start();\n try {\n this.controller.connect();\n this.logDebugActivity(\"connect\");\n }\n catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n }\n disconnect() {\n try {\n this.controller.disconnect();\n this.logDebugActivity(\"disconnect\");\n }\n catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n this.targetObserver.stop();\n this.valueObserver.stop();\n this.bindingObserver.stop();\n }\n get application() {\n return this.module.application;\n }\n get identifier() {\n return this.module.identifier;\n }\n get schema() {\n return this.application.schema;\n }\n get dispatcher() {\n return this.application.dispatcher;\n }\n get element() {\n return this.scope.element;\n }\n get parentElement() {\n return this.element.parentElement;\n }\n handleError(error, message, detail = {}) {\n const { identifier, controller, element } = this;\n detail = Object.assign({ identifier, controller, element }, detail);\n this.application.handleError(error, `Error ${message}`, detail);\n }\n targetConnected(element, name) {\n this.invokeControllerMethod(`${name}TargetConnected`, element);\n }\n targetDisconnected(element, name) {\n this.invokeControllerMethod(`${name}TargetDisconnected`, element);\n }\n invokeControllerMethod(methodName, ...args) {\n const controller = this.controller;\n if (typeof controller[methodName] == \"function\") {\n controller[methodName](...args);\n }\n }\n}\n\nfunction readInheritableStaticArrayValues(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce((values, constructor) => {\n getOwnStaticArrayValues(constructor, propertyName).forEach(name => values.add(name));\n return values;\n }, new Set));\n}\nfunction readInheritableStaticObjectPairs(constructor, propertyName) {\n const ancestors = getAncestorsForConstructor(constructor);\n return ancestors.reduce((pairs, constructor) => {\n pairs.push(...getOwnStaticObjectPairs(constructor, propertyName));\n return pairs;\n }, []);\n}\nfunction getAncestorsForConstructor(constructor) {\n const ancestors = [];\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n return ancestors.reverse();\n}\nfunction getOwnStaticArrayValues(constructor, propertyName) {\n const definition = constructor[propertyName];\n return Array.isArray(definition) ? definition : [];\n}\nfunction getOwnStaticObjectPairs(constructor, propertyName) {\n const definition = constructor[propertyName];\n return definition ? Object.keys(definition).map(key => [key, definition[key]]) : [];\n}\n\nfunction bless(constructor) {\n return shadow(constructor, getBlessedProperties(constructor));\n}\nfunction shadow(constructor, properties) {\n const shadowConstructor = extend(constructor);\n const shadowProperties = getShadowProperties(constructor.prototype, properties);\n Object.defineProperties(shadowConstructor.prototype, shadowProperties);\n return shadowConstructor;\n}\nfunction getBlessedProperties(constructor) {\n const blessings = readInheritableStaticArrayValues(constructor, \"blessings\");\n return blessings.reduce((blessedProperties, blessing) => {\n const properties = blessing(constructor);\n for (const key in properties) {\n const descriptor = blessedProperties[key] || {};\n blessedProperties[key] = Object.assign(descriptor, properties[key]);\n }\n return blessedProperties;\n }, {});\n}\nfunction getShadowProperties(prototype, properties) {\n return getOwnKeys(properties).reduce((shadowProperties, key) => {\n const descriptor = getShadowedDescriptor(prototype, properties, key);\n if (descriptor) {\n Object.assign(shadowProperties, { [key]: descriptor });\n }\n return shadowProperties;\n }, {});\n}\nfunction getShadowedDescriptor(prototype, properties, key) {\n const shadowingDescriptor = Object.getOwnPropertyDescriptor(prototype, key);\n const shadowedByValue = shadowingDescriptor && \"value\" in shadowingDescriptor;\n if (!shadowedByValue) {\n const descriptor = Object.getOwnPropertyDescriptor(properties, key).value;\n if (shadowingDescriptor) {\n descriptor.get = shadowingDescriptor.get || descriptor.get;\n descriptor.set = shadowingDescriptor.set || descriptor.set;\n }\n return descriptor;\n }\n}\nconst getOwnKeys = (() => {\n if (typeof Object.getOwnPropertySymbols == \"function\") {\n return (object) => [\n ...Object.getOwnPropertyNames(object),\n ...Object.getOwnPropertySymbols(object)\n ];\n }\n else {\n return Object.getOwnPropertyNames;\n }\n})();\nconst extend = (() => {\n function extendWithReflect(constructor) {\n function extended() {\n return Reflect.construct(constructor, arguments, new.target);\n }\n extended.prototype = Object.create(constructor.prototype, {\n constructor: { value: extended }\n });\n Reflect.setPrototypeOf(extended, constructor);\n return extended;\n }\n function testReflectExtension() {\n const a = function () { this.a.call(this); };\n const b = extendWithReflect(a);\n b.prototype.a = function () { };\n return new b;\n }\n try {\n testReflectExtension();\n return extendWithReflect;\n }\n catch (error) {\n return (constructor) => class extended extends constructor {\n };\n }\n})();\n\nfunction blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: bless(definition.controllerConstructor)\n };\n}\n\nclass Module {\n constructor(application, definition) {\n this.application = application;\n this.definition = blessDefinition(definition);\n this.contextsByScope = new WeakMap;\n this.connectedContexts = new Set;\n }\n get identifier() {\n return this.definition.identifier;\n }\n get controllerConstructor() {\n return this.definition.controllerConstructor;\n }\n get contexts() {\n return Array.from(this.connectedContexts);\n }\n connectContextForScope(scope) {\n const context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n }\n disconnectContextForScope(scope) {\n const context = this.contextsByScope.get(scope);\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n }\n fetchContextForScope(scope) {\n let context = this.contextsByScope.get(scope);\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n return context;\n }\n}\n\nclass ClassMap {\n constructor(scope) {\n this.scope = scope;\n }\n has(name) {\n return this.data.has(this.getDataKey(name));\n }\n get(name) {\n return this.getAll(name)[0];\n }\n getAll(name) {\n const tokenString = this.data.get(this.getDataKey(name)) || \"\";\n return tokenize(tokenString);\n }\n getAttributeName(name) {\n return this.data.getAttributeNameForKey(this.getDataKey(name));\n }\n getDataKey(name) {\n return `${name}-class`;\n }\n get data() {\n return this.scope.data;\n }\n}\n\nclass DataMap {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.getAttribute(name);\n }\n set(key, value) {\n const name = this.getAttributeNameForKey(key);\n this.element.setAttribute(name, value);\n return this.get(key);\n }\n has(key) {\n const name = this.getAttributeNameForKey(key);\n return this.element.hasAttribute(name);\n }\n delete(key) {\n if (this.has(key)) {\n const name = this.getAttributeNameForKey(key);\n this.element.removeAttribute(name);\n return true;\n }\n else {\n return false;\n }\n }\n getAttributeNameForKey(key) {\n return `data-${this.identifier}-${dasherize(key)}`;\n }\n}\n\nclass Guide {\n constructor(logger) {\n this.warnedKeysByObject = new WeakMap;\n this.logger = logger;\n }\n warn(object, key, message) {\n let warnedKeys = this.warnedKeysByObject.get(object);\n if (!warnedKeys) {\n warnedKeys = new Set;\n this.warnedKeysByObject.set(object, warnedKeys);\n }\n if (!warnedKeys.has(key)) {\n warnedKeys.add(key);\n this.logger.warn(message, object);\n }\n }\n}\n\nfunction attributeValueContainsToken(attributeName, token) {\n return `[${attributeName}~=\"${token}\"]`;\n}\n\nclass TargetSet {\n constructor(scope) {\n this.scope = scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get schema() {\n return this.scope.schema;\n }\n has(targetName) {\n return this.find(targetName) != null;\n }\n find(...targetNames) {\n return targetNames.reduce((target, targetName) => target\n || this.findTarget(targetName)\n || this.findLegacyTarget(targetName), undefined);\n }\n findAll(...targetNames) {\n return targetNames.reduce((targets, targetName) => [\n ...targets,\n ...this.findAllTargets(targetName),\n ...this.findAllLegacyTargets(targetName)\n ], []);\n }\n findTarget(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findElement(selector);\n }\n findAllTargets(targetName) {\n const selector = this.getSelectorForTargetName(targetName);\n return this.scope.findAllElements(selector);\n }\n getSelectorForTargetName(targetName) {\n const attributeName = this.schema.targetAttributeForScope(this.identifier);\n return attributeValueContainsToken(attributeName, targetName);\n }\n findLegacyTarget(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.deprecate(this.scope.findElement(selector), targetName);\n }\n findAllLegacyTargets(targetName) {\n const selector = this.getLegacySelectorForTargetName(targetName);\n return this.scope.findAllElements(selector).map(element => this.deprecate(element, targetName));\n }\n getLegacySelectorForTargetName(targetName) {\n const targetDescriptor = `${this.identifier}.${targetName}`;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n }\n deprecate(element, targetName) {\n if (element) {\n const { identifier } = this;\n const attributeName = this.schema.targetAttribute;\n const revisedAttributeName = this.schema.targetAttributeForScope(identifier);\n this.guide.warn(element, `target:${targetName}`, `Please replace ${attributeName}=\"${identifier}.${targetName}\" with ${revisedAttributeName}=\"${targetName}\". ` +\n `The ${attributeName} attribute is deprecated and will be removed in a future version of Stimulus.`);\n }\n return element;\n }\n get guide() {\n return this.scope.guide;\n }\n}\n\nclass Scope {\n constructor(schema, element, identifier, logger) {\n this.targets = new TargetSet(this);\n this.classes = new ClassMap(this);\n this.data = new DataMap(this);\n this.containsElement = (element) => {\n return element.closest(this.controllerSelector) === this.element;\n };\n this.schema = schema;\n this.element = element;\n this.identifier = identifier;\n this.guide = new Guide(logger);\n }\n findElement(selector) {\n return this.element.matches(selector)\n ? this.element\n : this.queryElements(selector).find(this.containsElement);\n }\n findAllElements(selector) {\n return [\n ...this.element.matches(selector) ? [this.element] : [],\n ...this.queryElements(selector).filter(this.containsElement)\n ];\n }\n queryElements(selector) {\n return Array.from(this.element.querySelectorAll(selector));\n }\n get controllerSelector() {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n }\n}\n\nclass ScopeObserver {\n constructor(element, schema, delegate) {\n this.element = element;\n this.schema = schema;\n this.delegate = delegate;\n this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this);\n this.scopesByIdentifierByElement = new WeakMap;\n this.scopeReferenceCounts = new WeakMap;\n }\n start() {\n this.valueListObserver.start();\n }\n stop() {\n this.valueListObserver.stop();\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n parseValueForToken(token) {\n const { element, content: identifier } = token;\n const scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);\n let scope = scopesByIdentifier.get(identifier);\n if (!scope) {\n scope = this.delegate.createScopeForElementAndIdentifier(element, identifier);\n scopesByIdentifier.set(identifier, scope);\n }\n return scope;\n }\n elementMatchedValue(element, value) {\n const referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n }\n elementUnmatchedValue(element, value) {\n const referenceCount = this.scopeReferenceCounts.get(value);\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n }\n fetchScopesByIdentifierForElement(element) {\n let scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map;\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n return scopesByIdentifier;\n }\n}\n\nclass Router {\n constructor(application) {\n this.application = application;\n this.scopeObserver = new ScopeObserver(this.element, this.schema, this);\n this.scopesByIdentifier = new Multimap;\n this.modulesByIdentifier = new Map;\n }\n get element() {\n return this.application.element;\n }\n get schema() {\n return this.application.schema;\n }\n get logger() {\n return this.application.logger;\n }\n get controllerAttribute() {\n return this.schema.controllerAttribute;\n }\n get modules() {\n return Array.from(this.modulesByIdentifier.values());\n }\n get contexts() {\n return this.modules.reduce((contexts, module) => contexts.concat(module.contexts), []);\n }\n start() {\n this.scopeObserver.start();\n }\n stop() {\n this.scopeObserver.stop();\n }\n loadDefinition(definition) {\n this.unloadIdentifier(definition.identifier);\n const module = new Module(this.application, definition);\n this.connectModule(module);\n }\n unloadIdentifier(identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n this.disconnectModule(module);\n }\n }\n getContextForElementAndIdentifier(element, identifier) {\n const module = this.modulesByIdentifier.get(identifier);\n if (module) {\n return module.contexts.find(context => context.element == element);\n }\n }\n handleError(error, message, detail) {\n this.application.handleError(error, message, detail);\n }\n createScopeForElementAndIdentifier(element, identifier) {\n return new Scope(this.schema, element, identifier, this.logger);\n }\n scopeConnected(scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.connectContextForScope(scope);\n }\n }\n scopeDisconnected(scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n const module = this.modulesByIdentifier.get(scope.identifier);\n if (module) {\n module.disconnectContextForScope(scope);\n }\n }\n connectModule(module) {\n this.modulesByIdentifier.set(module.identifier, module);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(scope => module.connectContextForScope(scope));\n }\n disconnectModule(module) {\n this.modulesByIdentifier.delete(module.identifier);\n const scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(scope => module.disconnectContextForScope(scope));\n }\n}\n\nconst defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\",\n targetAttributeForScope: identifier => `data-${identifier}-target`\n};\n\nclass Application {\n constructor(element = document.documentElement, schema = defaultSchema) {\n this.logger = console;\n this.debug = false;\n this.logDebugActivity = (identifier, functionName, detail = {}) => {\n if (this.debug) {\n this.logFormattedMessage(identifier, functionName, detail);\n }\n };\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n }\n static start(element, schema) {\n const application = new Application(element, schema);\n application.start();\n return application;\n }\n async start() {\n await domReady();\n this.logDebugActivity(\"application\", \"starting\");\n this.dispatcher.start();\n this.router.start();\n this.logDebugActivity(\"application\", \"start\");\n }\n stop() {\n this.logDebugActivity(\"application\", \"stopping\");\n this.dispatcher.stop();\n this.router.stop();\n this.logDebugActivity(\"application\", \"stop\");\n }\n register(identifier, controllerConstructor) {\n this.load({ identifier, controllerConstructor });\n }\n load(head, ...rest) {\n const definitions = Array.isArray(head) ? head : [head, ...rest];\n definitions.forEach(definition => {\n if (definition.controllerConstructor.shouldLoad) {\n this.router.loadDefinition(definition);\n }\n });\n }\n unload(head, ...rest) {\n const identifiers = Array.isArray(head) ? head : [head, ...rest];\n identifiers.forEach(identifier => this.router.unloadIdentifier(identifier));\n }\n get controllers() {\n return this.router.contexts.map(context => context.controller);\n }\n getControllerForElementAndIdentifier(element, identifier) {\n const context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n }\n handleError(error, message, detail) {\n var _a;\n this.logger.error(`%s\\n\\n%o\\n\\n%o`, message, error, detail);\n (_a = window.onerror) === null || _a === void 0 ? void 0 : _a.call(window, message, \"\", 0, 0, error);\n }\n logFormattedMessage(identifier, functionName, detail = {}) {\n detail = Object.assign({ application: this }, detail);\n this.logger.groupCollapsed(`${identifier} #${functionName}`);\n this.logger.log(\"details:\", Object.assign({}, detail));\n this.logger.groupEnd();\n }\n}\nfunction domReady() {\n return new Promise(resolve => {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", () => resolve());\n }\n else {\n resolve();\n }\n });\n}\n\nfunction ClassPropertiesBlessing(constructor) {\n const classes = readInheritableStaticArrayValues(constructor, \"classes\");\n return classes.reduce((properties, classDefinition) => {\n return Object.assign(properties, propertiesForClassDefinition(classDefinition));\n }, {});\n}\nfunction propertiesForClassDefinition(key) {\n return {\n [`${key}Class`]: {\n get() {\n const { classes } = this;\n if (classes.has(key)) {\n return classes.get(key);\n }\n else {\n const attribute = classes.getAttributeName(key);\n throw new Error(`Missing attribute \"${attribute}\"`);\n }\n }\n },\n [`${key}Classes`]: {\n get() {\n return this.classes.getAll(key);\n }\n },\n [`has${capitalize(key)}Class`]: {\n get() {\n return this.classes.has(key);\n }\n }\n };\n}\n\nfunction TargetPropertiesBlessing(constructor) {\n const targets = readInheritableStaticArrayValues(constructor, \"targets\");\n return targets.reduce((properties, targetDefinition) => {\n return Object.assign(properties, propertiesForTargetDefinition(targetDefinition));\n }, {});\n}\nfunction propertiesForTargetDefinition(name) {\n return {\n [`${name}Target`]: {\n get() {\n const target = this.targets.find(name);\n if (target) {\n return target;\n }\n else {\n throw new Error(`Missing target element \"${name}\" for \"${this.identifier}\" controller`);\n }\n }\n },\n [`${name}Targets`]: {\n get() {\n return this.targets.findAll(name);\n }\n },\n [`has${capitalize(name)}Target`]: {\n get() {\n return this.targets.has(name);\n }\n }\n };\n}\n\nfunction ValuePropertiesBlessing(constructor) {\n const valueDefinitionPairs = readInheritableStaticObjectPairs(constructor, \"values\");\n const propertyDescriptorMap = {\n valueDescriptorMap: {\n get() {\n return valueDefinitionPairs.reduce((result, valueDefinitionPair) => {\n const valueDescriptor = parseValueDefinitionPair(valueDefinitionPair, this.identifier);\n const attributeName = this.data.getAttributeNameForKey(valueDescriptor.key);\n return Object.assign(result, { [attributeName]: valueDescriptor });\n }, {});\n }\n }\n };\n return valueDefinitionPairs.reduce((properties, valueDefinitionPair) => {\n return Object.assign(properties, propertiesForValueDefinitionPair(valueDefinitionPair));\n }, propertyDescriptorMap);\n}\nfunction propertiesForValueDefinitionPair(valueDefinitionPair, controller) {\n const definition = parseValueDefinitionPair(valueDefinitionPair, controller);\n const { key, name, reader: read, writer: write } = definition;\n return {\n [name]: {\n get() {\n const value = this.data.get(key);\n if (value !== null) {\n return read(value);\n }\n else {\n return definition.defaultValue;\n }\n },\n set(value) {\n if (value === undefined) {\n this.data.delete(key);\n }\n else {\n this.data.set(key, write(value));\n }\n }\n },\n [`has${capitalize(name)}`]: {\n get() {\n return this.data.has(key) || definition.hasCustomDefaultValue;\n }\n }\n };\n}\nfunction parseValueDefinitionPair([token, typeDefinition], controller) {\n return valueDescriptorForTokenAndTypeDefinition({\n controller,\n token,\n typeDefinition,\n });\n}\nfunction parseValueTypeConstant(constant) {\n switch (constant) {\n case Array: return \"array\";\n case Boolean: return \"boolean\";\n case Number: return \"number\";\n case Object: return \"object\";\n case String: return \"string\";\n }\n}\nfunction parseValueTypeDefault(defaultValue) {\n switch (typeof defaultValue) {\n case \"boolean\": return \"boolean\";\n case \"number\": return \"number\";\n case \"string\": return \"string\";\n }\n if (Array.isArray(defaultValue))\n return \"array\";\n if (Object.prototype.toString.call(defaultValue) === \"[object Object]\")\n return \"object\";\n}\nfunction parseValueTypeObject(payload) {\n const typeFromObject = parseValueTypeConstant(payload.typeObject.type);\n if (!typeFromObject)\n return;\n const defaultValueType = parseValueTypeDefault(payload.typeObject.default);\n if (typeFromObject !== defaultValueType) {\n const propertyPath = payload.controller ? `${payload.controller}.${payload.token}` : payload.token;\n throw new Error(`The specified default value for the Stimulus Value \"${propertyPath}\" must match the defined type \"${typeFromObject}\". The provided default value of \"${payload.typeObject.default}\" is of type \"${defaultValueType}\".`);\n }\n return typeFromObject;\n}\nfunction parseValueTypeDefinition(payload) {\n const typeFromObject = parseValueTypeObject({\n controller: payload.controller,\n token: payload.token,\n typeObject: payload.typeDefinition\n });\n const typeFromDefaultValue = parseValueTypeDefault(payload.typeDefinition);\n const typeFromConstant = parseValueTypeConstant(payload.typeDefinition);\n const type = typeFromObject || typeFromDefaultValue || typeFromConstant;\n if (type)\n return type;\n const propertyPath = payload.controller ? `${payload.controller}.${payload.typeDefinition}` : payload.token;\n throw new Error(`Unknown value type \"${propertyPath}\" for \"${payload.token}\" value`);\n}\nfunction defaultValueForDefinition(typeDefinition) {\n const constant = parseValueTypeConstant(typeDefinition);\n if (constant)\n return defaultValuesByType[constant];\n const defaultValue = typeDefinition.default;\n if (defaultValue !== undefined)\n return defaultValue;\n return typeDefinition;\n}\nfunction valueDescriptorForTokenAndTypeDefinition(payload) {\n const key = `${dasherize(payload.token)}-value`;\n const type = parseValueTypeDefinition(payload);\n return {\n type,\n key,\n name: camelize(key),\n get defaultValue() { return defaultValueForDefinition(payload.typeDefinition); },\n get hasCustomDefaultValue() { return parseValueTypeDefault(payload.typeDefinition) !== undefined; },\n reader: readers[type],\n writer: writers[type] || writers.default\n };\n}\nconst defaultValuesByType = {\n get array() { return []; },\n boolean: false,\n number: 0,\n get object() { return {}; },\n string: \"\"\n};\nconst readers = {\n array(value) {\n const array = JSON.parse(value);\n if (!Array.isArray(array)) {\n throw new TypeError(`expected value of type \"array\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(array)}\"`);\n }\n return array;\n },\n boolean(value) {\n return !(value == \"0\" || String(value).toLowerCase() == \"false\");\n },\n number(value) {\n return Number(value);\n },\n object(value) {\n const object = JSON.parse(value);\n if (object === null || typeof object != \"object\" || Array.isArray(object)) {\n throw new TypeError(`expected value of type \"object\" but instead got value \"${value}\" of type \"${parseValueTypeDefault(object)}\"`);\n }\n return object;\n },\n string(value) {\n return value;\n }\n};\nconst writers = {\n default: writeString,\n array: writeJSON,\n object: writeJSON\n};\nfunction writeJSON(value) {\n return JSON.stringify(value);\n}\nfunction writeString(value) {\n return `${value}`;\n}\n\nclass Controller {\n constructor(context) {\n this.context = context;\n }\n static get shouldLoad() {\n return true;\n }\n get application() {\n return this.context.application;\n }\n get scope() {\n return this.context.scope;\n }\n get element() {\n return this.scope.element;\n }\n get identifier() {\n return this.scope.identifier;\n }\n get targets() {\n return this.scope.targets;\n }\n get classes() {\n return this.scope.classes;\n }\n get data() {\n return this.scope.data;\n }\n initialize() {\n }\n connect() {\n }\n disconnect() {\n }\n dispatch(eventName, { target = this.element, detail = {}, prefix = this.identifier, bubbles = true, cancelable = true } = {}) {\n const type = prefix ? `${prefix}:${eventName}` : eventName;\n const event = new CustomEvent(type, { detail, bubbles, cancelable });\n target.dispatchEvent(event);\n return event;\n }\n}\nController.blessings = [ClassPropertiesBlessing, TargetPropertiesBlessing, ValuePropertiesBlessing];\nController.targets = [];\nController.values = {};\n\nexport { Application, AttributeObserver, Context, Controller, ElementObserver, IndexedMultimap, Multimap, StringMapObserver, TokenListObserver, ValueListObserver, add, defaultSchema, del, fetch, prune };\n", "import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n static classes = [\"show\"]\n\n connect() {\n if (JSON.parse(localStorage.getItem('hideBanner')) == true) {\n this.element.classList.add(this.showClass)\n }\n }\n\n close() {\n this.element.classList.add(this.showClass)\n localStorage.setItem('hideBanner', 'true');\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\";\n\nexport default class extends Controller {\n static targets = [\"menu\"];\n\n connect() {\n this.toggleClass = this.data.get(\"class\") || \"hidden\";\n\n // The HTML for the background element\n this.backgroundHtml =\n this.data.get(\"backgroundHtml\") || this._backgroundHTML();\n\n // The ID of the background to hide/remove\n this.backgroundId = this.data.get(\"backgroundId\") || \"modal-background\";\n }\n\n toggle(e) {\n e.preventDefault();\n e.target.blur();\n\n this.menuTarget.classList.toggle(this.toggleClass);\n\n // Insert the background\n if (!this.menuTarget.classList.contains(this.toggleClass)) {\n document.body.insertAdjacentHTML(\"beforeend\", this.backgroundHtml);\n this.background = document.querySelector(`#${this.backgroundId}`);\n } else {\n // Remove the background\n if (this.background) {\n this.background.remove();\n }\n }\n }\n\n hide(event) {\n if (\n this.element.contains(event.target) === false &&\n !this.menuTarget.classList.contains(this.toggleClass)\n ) {\n this.menuTarget.classList.add(this.toggleClass);\n // Remove the background\n if (this.background) {\n this.background.remove();\n }\n }\n }\n\n _backgroundHTML() {\n return '';\n }\n}\n", "import { Controller } from \"@hotwired/stimulus\"\n\nexport default class extends Controller {\n connect() {\n this.hiddenClass = this.data.get('class') || 'hidden'\n }\n\n close() {\n this.element.classList.add(this.hiddenClass)\n }\n}\n", "var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nvar NumeralFormatter = function (numeralDecimalMark,\n numeralIntegerScale,\n numeralDecimalScale,\n numeralThousandsGroupStyle,\n numeralPositiveOnly,\n stripLeadingZeroes,\n prefix,\n signBeforePrefix,\n tailPrefix,\n delimiter) {\n var owner = this;\n\n owner.numeralDecimalMark = numeralDecimalMark || '.';\n owner.numeralIntegerScale = numeralIntegerScale > 0 ? numeralIntegerScale : 0;\n owner.numeralDecimalScale = numeralDecimalScale >= 0 ? numeralDecimalScale : 2;\n owner.numeralThousandsGroupStyle = numeralThousandsGroupStyle || NumeralFormatter.groupStyle.thousand;\n owner.numeralPositiveOnly = !!numeralPositiveOnly;\n owner.stripLeadingZeroes = stripLeadingZeroes !== false;\n owner.prefix = (prefix || prefix === '') ? prefix : '';\n owner.signBeforePrefix = !!signBeforePrefix;\n owner.tailPrefix = !!tailPrefix;\n owner.delimiter = (delimiter || delimiter === '') ? delimiter : ',';\n owner.delimiterRE = delimiter ? new RegExp('\\\\' + delimiter, 'g') : '';\n};\n\nNumeralFormatter.groupStyle = {\n thousand: 'thousand',\n lakh: 'lakh',\n wan: 'wan',\n none: 'none' \n};\n\nNumeralFormatter.prototype = {\n getRawValue: function (value) {\n return value.replace(this.delimiterRE, '').replace(this.numeralDecimalMark, '.');\n },\n\n format: function (value) {\n var owner = this, parts, partSign, partSignAndPrefix, partInteger, partDecimal = '';\n\n // strip alphabet letters\n value = value.replace(/[A-Za-z]/g, '')\n // replace the first decimal mark with reserved placeholder\n .replace(owner.numeralDecimalMark, 'M')\n\n // strip non numeric letters except minus and \"M\"\n // this is to ensure prefix has been stripped\n .replace(/[^\\dM-]/g, '')\n\n // replace the leading minus with reserved placeholder\n .replace(/^\\-/, 'N')\n\n // strip the other minus sign (if present)\n .replace(/\\-/g, '')\n\n // replace the minus sign (if present)\n .replace('N', owner.numeralPositiveOnly ? '' : '-')\n\n // replace decimal mark\n .replace('M', owner.numeralDecimalMark);\n\n // strip any leading zeros\n if (owner.stripLeadingZeroes) {\n value = value.replace(/^(-)?0+(?=\\d)/, '$1');\n }\n\n partSign = value.slice(0, 1) === '-' ? '-' : '';\n if (typeof owner.prefix != 'undefined') {\n if (owner.signBeforePrefix) {\n partSignAndPrefix = partSign + owner.prefix;\n } else {\n partSignAndPrefix = owner.prefix + partSign;\n }\n } else {\n partSignAndPrefix = partSign;\n }\n \n partInteger = value;\n\n if (value.indexOf(owner.numeralDecimalMark) >= 0) {\n parts = value.split(owner.numeralDecimalMark);\n partInteger = parts[0];\n partDecimal = owner.numeralDecimalMark + parts[1].slice(0, owner.numeralDecimalScale);\n }\n\n if(partSign === '-') {\n partInteger = partInteger.slice(1);\n }\n\n if (owner.numeralIntegerScale > 0) {\n partInteger = partInteger.slice(0, owner.numeralIntegerScale);\n }\n\n switch (owner.numeralThousandsGroupStyle) {\n case NumeralFormatter.groupStyle.lakh:\n partInteger = partInteger.replace(/(\\d)(?=(\\d\\d)+\\d$)/g, '$1' + owner.delimiter);\n\n break;\n\n case NumeralFormatter.groupStyle.wan:\n partInteger = partInteger.replace(/(\\d)(?=(\\d{4})+$)/g, '$1' + owner.delimiter);\n\n break;\n\n case NumeralFormatter.groupStyle.thousand:\n partInteger = partInteger.replace(/(\\d)(?=(\\d{3})+$)/g, '$1' + owner.delimiter);\n\n break;\n }\n\n if (owner.tailPrefix) {\n return partSign + partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : '') + owner.prefix;\n }\n\n return partSignAndPrefix + partInteger.toString() + (owner.numeralDecimalScale > 0 ? partDecimal.toString() : '');\n }\n};\n\nvar NumeralFormatter_1 = NumeralFormatter;\n\nvar DateFormatter = function (datePattern, dateMin, dateMax) {\n var owner = this;\n\n owner.date = [];\n owner.blocks = [];\n owner.datePattern = datePattern;\n owner.dateMin = dateMin\n .split('-')\n .reverse()\n .map(function(x) {\n return parseInt(x, 10);\n });\n if (owner.dateMin.length === 2) owner.dateMin.unshift(0);\n\n owner.dateMax = dateMax\n .split('-')\n .reverse()\n .map(function(x) {\n return parseInt(x, 10);\n });\n if (owner.dateMax.length === 2) owner.dateMax.unshift(0);\n \n owner.initBlocks();\n};\n\nDateFormatter.prototype = {\n initBlocks: function () {\n var owner = this;\n owner.datePattern.forEach(function (value) {\n if (value === 'Y') {\n owner.blocks.push(4);\n } else {\n owner.blocks.push(2);\n }\n });\n },\n\n getISOFormatDate: function () {\n var owner = this,\n date = owner.date;\n\n return date[2] ? (\n date[2] + '-' + owner.addLeadingZero(date[1]) + '-' + owner.addLeadingZero(date[0])\n ) : '';\n },\n\n getBlocks: function () {\n return this.blocks;\n },\n\n getValidatedDate: function (value) {\n var owner = this, result = '';\n\n value = value.replace(/[^\\d]/g, '');\n\n owner.blocks.forEach(function (length, index) {\n if (value.length > 0) {\n var sub = value.slice(0, length),\n sub0 = sub.slice(0, 1),\n rest = value.slice(length);\n\n switch (owner.datePattern[index]) {\n case 'd':\n if (sub === '00') {\n sub = '01';\n } else if (parseInt(sub0, 10) > 3) {\n sub = '0' + sub0;\n } else if (parseInt(sub, 10) > 31) {\n sub = '31';\n }\n\n break;\n\n case 'm':\n if (sub === '00') {\n sub = '01';\n } else if (parseInt(sub0, 10) > 1) {\n sub = '0' + sub0;\n } else if (parseInt(sub, 10) > 12) {\n sub = '12';\n }\n\n break;\n }\n\n result += sub;\n\n // update remaining string\n value = rest;\n }\n });\n\n return this.getFixedDateString(result);\n },\n\n getFixedDateString: function (value) {\n var owner = this, datePattern = owner.datePattern, date = [],\n dayIndex = 0, monthIndex = 0, yearIndex = 0,\n dayStartIndex = 0, monthStartIndex = 0, yearStartIndex = 0,\n day, month, year, fullYearDone = false;\n\n // mm-dd || dd-mm\n if (value.length === 4 && datePattern[0].toLowerCase() !== 'y' && datePattern[1].toLowerCase() !== 'y') {\n dayStartIndex = datePattern[0] === 'd' ? 0 : 2;\n monthStartIndex = 2 - dayStartIndex;\n day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);\n month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);\n\n date = this.getFixedDate(day, month, 0);\n }\n\n // yyyy-mm-dd || yyyy-dd-mm || mm-dd-yyyy || dd-mm-yyyy || dd-yyyy-mm || mm-yyyy-dd\n if (value.length === 8) {\n datePattern.forEach(function (type, index) {\n switch (type) {\n case 'd':\n dayIndex = index;\n break;\n case 'm':\n monthIndex = index;\n break;\n default:\n yearIndex = index;\n break;\n }\n });\n\n yearStartIndex = yearIndex * 2;\n dayStartIndex = (dayIndex <= yearIndex) ? dayIndex * 2 : (dayIndex * 2 + 2);\n monthStartIndex = (monthIndex <= yearIndex) ? monthIndex * 2 : (monthIndex * 2 + 2);\n\n day = parseInt(value.slice(dayStartIndex, dayStartIndex + 2), 10);\n month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);\n year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10);\n\n fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4;\n\n date = this.getFixedDate(day, month, year);\n }\n\n // mm-yy || yy-mm\n if (value.length === 4 && (datePattern[0] === 'y' || datePattern[1] === 'y')) {\n monthStartIndex = datePattern[0] === 'm' ? 0 : 2;\n yearStartIndex = 2 - monthStartIndex;\n month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);\n year = parseInt(value.slice(yearStartIndex, yearStartIndex + 2), 10);\n\n fullYearDone = value.slice(yearStartIndex, yearStartIndex + 2).length === 2;\n\n date = [0, month, year];\n }\n\n // mm-yyyy || yyyy-mm\n if (value.length === 6 && (datePattern[0] === 'Y' || datePattern[1] === 'Y')) {\n monthStartIndex = datePattern[0] === 'm' ? 0 : 4;\n yearStartIndex = 2 - 0.5 * monthStartIndex;\n month = parseInt(value.slice(monthStartIndex, monthStartIndex + 2), 10);\n year = parseInt(value.slice(yearStartIndex, yearStartIndex + 4), 10);\n\n fullYearDone = value.slice(yearStartIndex, yearStartIndex + 4).length === 4;\n\n date = [0, month, year];\n }\n\n date = owner.getRangeFixedDate(date);\n owner.date = date;\n\n var result = date.length === 0 ? value : datePattern.reduce(function (previous, current) {\n switch (current) {\n case 'd':\n return previous + (date[0] === 0 ? '' : owner.addLeadingZero(date[0]));\n case 'm':\n return previous + (date[1] === 0 ? '' : owner.addLeadingZero(date[1]));\n case 'y':\n return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2], false) : '');\n case 'Y':\n return previous + (fullYearDone ? owner.addLeadingZeroForYear(date[2], true) : '');\n }\n }, '');\n\n return result;\n },\n\n getRangeFixedDate: function (date) {\n var owner = this,\n datePattern = owner.datePattern,\n dateMin = owner.dateMin || [],\n dateMax = owner.dateMax || [];\n\n if (!date.length || (dateMin.length < 3 && dateMax.length < 3)) return date;\n\n if (\n datePattern.find(function(x) {\n return x.toLowerCase() === 'y';\n }) &&\n date[2] === 0\n ) return date;\n\n if (dateMax.length && (dateMax[2] < date[2] || (\n dateMax[2] === date[2] && (dateMax[1] < date[1] || (\n dateMax[1] === date[1] && dateMax[0] < date[0]\n ))\n ))) return dateMax;\n\n if (dateMin.length && (dateMin[2] > date[2] || (\n dateMin[2] === date[2] && (dateMin[1] > date[1] || (\n dateMin[1] === date[1] && dateMin[0] > date[0]\n ))\n ))) return dateMin;\n\n return date;\n },\n\n getFixedDate: function (day, month, year) {\n day = Math.min(day, 31);\n month = Math.min(month, 12);\n year = parseInt((year || 0), 10);\n\n if ((month < 7 && month % 2 === 0) || (month > 8 && month % 2 === 1)) {\n day = Math.min(day, month === 2 ? (this.isLeapYear(year) ? 29 : 28) : 30);\n }\n\n return [day, month, year];\n },\n\n isLeapYear: function (year) {\n return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);\n },\n\n addLeadingZero: function (number) {\n return (number < 10 ? '0' : '') + number;\n },\n\n addLeadingZeroForYear: function (number, fullYearMode) {\n if (fullYearMode) {\n return (number < 10 ? '000' : (number < 100 ? '00' : (number < 1000 ? '0' : ''))) + number;\n }\n\n return (number < 10 ? '0' : '') + number;\n }\n};\n\nvar DateFormatter_1 = DateFormatter;\n\nvar TimeFormatter = function (timePattern, timeFormat) {\n var owner = this;\n\n owner.time = [];\n owner.blocks = [];\n owner.timePattern = timePattern;\n owner.timeFormat = timeFormat;\n owner.initBlocks();\n};\n\nTimeFormatter.prototype = {\n initBlocks: function () {\n var owner = this;\n owner.timePattern.forEach(function () {\n owner.blocks.push(2);\n });\n },\n\n getISOFormatTime: function () {\n var owner = this,\n time = owner.time;\n\n return time[2] ? (\n owner.addLeadingZero(time[0]) + ':' + owner.addLeadingZero(time[1]) + ':' + owner.addLeadingZero(time[2])\n ) : '';\n },\n\n getBlocks: function () {\n return this.blocks;\n },\n\n getTimeFormatOptions: function () {\n var owner = this;\n if (String(owner.timeFormat) === '12') {\n return {\n maxHourFirstDigit: 1,\n maxHours: 12,\n maxMinutesFirstDigit: 5,\n maxMinutes: 60\n };\n }\n\n return {\n maxHourFirstDigit: 2,\n maxHours: 23,\n maxMinutesFirstDigit: 5,\n maxMinutes: 60\n };\n },\n\n getValidatedTime: function (value) {\n var owner = this, result = '';\n\n value = value.replace(/[^\\d]/g, '');\n\n var timeFormatOptions = owner.getTimeFormatOptions();\n\n owner.blocks.forEach(function (length, index) {\n if (value.length > 0) {\n var sub = value.slice(0, length),\n sub0 = sub.slice(0, 1),\n rest = value.slice(length);\n\n switch (owner.timePattern[index]) {\n\n case 'h':\n if (parseInt(sub0, 10) > timeFormatOptions.maxHourFirstDigit) {\n sub = '0' + sub0;\n } else if (parseInt(sub, 10) > timeFormatOptions.maxHours) {\n sub = timeFormatOptions.maxHours + '';\n }\n\n break;\n\n case 'm':\n case 's':\n if (parseInt(sub0, 10) > timeFormatOptions.maxMinutesFirstDigit) {\n sub = '0' + sub0;\n } else if (parseInt(sub, 10) > timeFormatOptions.maxMinutes) {\n sub = timeFormatOptions.maxMinutes + '';\n }\n break;\n }\n\n result += sub;\n\n // update remaining string\n value = rest;\n }\n });\n\n return this.getFixedTimeString(result);\n },\n\n getFixedTimeString: function (value) {\n var owner = this, timePattern = owner.timePattern, time = [],\n secondIndex = 0, minuteIndex = 0, hourIndex = 0,\n secondStartIndex = 0, minuteStartIndex = 0, hourStartIndex = 0,\n second, minute, hour;\n\n if (value.length === 6) {\n timePattern.forEach(function (type, index) {\n switch (type) {\n case 's':\n secondIndex = index * 2;\n break;\n case 'm':\n minuteIndex = index * 2;\n break;\n case 'h':\n hourIndex = index * 2;\n break;\n }\n });\n\n hourStartIndex = hourIndex;\n minuteStartIndex = minuteIndex;\n secondStartIndex = secondIndex;\n\n second = parseInt(value.slice(secondStartIndex, secondStartIndex + 2), 10);\n minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10);\n hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10);\n\n time = this.getFixedTime(hour, minute, second);\n }\n\n if (value.length === 4 && owner.timePattern.indexOf('s') < 0) {\n timePattern.forEach(function (type, index) {\n switch (type) {\n case 'm':\n minuteIndex = index * 2;\n break;\n case 'h':\n hourIndex = index * 2;\n break;\n }\n });\n\n hourStartIndex = hourIndex;\n minuteStartIndex = minuteIndex;\n\n second = 0;\n minute = parseInt(value.slice(minuteStartIndex, minuteStartIndex + 2), 10);\n hour = parseInt(value.slice(hourStartIndex, hourStartIndex + 2), 10);\n\n time = this.getFixedTime(hour, minute, second);\n }\n\n owner.time = time;\n\n return time.length === 0 ? value : timePattern.reduce(function (previous, current) {\n switch (current) {\n case 's':\n return previous + owner.addLeadingZero(time[2]);\n case 'm':\n return previous + owner.addLeadingZero(time[1]);\n case 'h':\n return previous + owner.addLeadingZero(time[0]);\n }\n }, '');\n },\n\n getFixedTime: function (hour, minute, second) {\n second = Math.min(parseInt(second || 0, 10), 60);\n minute = Math.min(minute, 60);\n hour = Math.min(hour, 60);\n\n return [hour, minute, second];\n },\n\n addLeadingZero: function (number) {\n return (number < 10 ? '0' : '') + number;\n }\n};\n\nvar TimeFormatter_1 = TimeFormatter;\n\nvar PhoneFormatter = function (formatter, delimiter) {\n var owner = this;\n\n owner.delimiter = (delimiter || delimiter === '') ? delimiter : ' ';\n owner.delimiterRE = delimiter ? new RegExp('\\\\' + delimiter, 'g') : '';\n\n owner.formatter = formatter;\n};\n\nPhoneFormatter.prototype = {\n setFormatter: function (formatter) {\n this.formatter = formatter;\n },\n\n format: function (phoneNumber) {\n var owner = this;\n\n owner.formatter.clear();\n\n // only keep number and +\n phoneNumber = phoneNumber.replace(/[^\\d+]/g, '');\n\n // strip non-leading +\n phoneNumber = phoneNumber.replace(/^\\+/, 'B').replace(/\\+/g, '').replace('B', '+');\n\n // strip delimiter\n phoneNumber = phoneNumber.replace(owner.delimiterRE, '');\n\n var result = '', current, validated = false;\n\n for (var i = 0, iMax = phoneNumber.length; i < iMax; i++) {\n current = owner.formatter.inputDigit(phoneNumber.charAt(i));\n\n // has ()- or space inside\n if (/[\\s()-]/g.test(current)) {\n result = current;\n\n validated = true;\n } else {\n if (!validated) {\n result = current;\n }\n // else: over length input\n // it turns to invalid number again\n }\n }\n\n // strip ()\n // e.g. US: 7161234567 returns (716) 123-4567\n result = result.replace(/[()]/g, '');\n // replace library delimiter with user customized delimiter\n result = result.replace(/[\\s-]/g, owner.delimiter);\n\n return result;\n }\n};\n\nvar PhoneFormatter_1 = PhoneFormatter;\n\nvar CreditCardDetector = {\n blocks: {\n uatp: [4, 5, 6],\n amex: [4, 6, 5],\n diners: [4, 6, 4],\n discover: [4, 4, 4, 4],\n mastercard: [4, 4, 4, 4],\n dankort: [4, 4, 4, 4],\n instapayment: [4, 4, 4, 4],\n jcb15: [4, 6, 5],\n jcb: [4, 4, 4, 4],\n maestro: [4, 4, 4, 4],\n visa: [4, 4, 4, 4],\n mir: [4, 4, 4, 4],\n unionPay: [4, 4, 4, 4],\n general: [4, 4, 4, 4]\n },\n\n re: {\n // starts with 1; 15 digits, not starts with 1800 (jcb card)\n uatp: /^(?!1800)1\\d{0,14}/,\n\n // starts with 34/37; 15 digits\n amex: /^3[47]\\d{0,13}/,\n\n // starts with 6011/65/644-649; 16 digits\n discover: /^(?:6011|65\\d{0,2}|64[4-9]\\d?)\\d{0,12}/,\n\n // starts with 300-305/309 or 36/38/39; 14 digits\n diners: /^3(?:0([0-5]|9)|[689]\\d?)\\d{0,11}/,\n\n // starts with 51-55/2221\u20132720; 16 digits\n mastercard: /^(5[1-5]\\d{0,2}|22[2-9]\\d{0,1}|2[3-7]\\d{0,2})\\d{0,12}/,\n\n // starts with 5019/4175/4571; 16 digits\n dankort: /^(5019|4175|4571)\\d{0,12}/,\n\n // starts with 637-639; 16 digits\n instapayment: /^63[7-9]\\d{0,13}/,\n\n // starts with 2131/1800; 15 digits\n jcb15: /^(?:2131|1800)\\d{0,11}/,\n\n // starts with 2131/1800/35; 16 digits\n jcb: /^(?:35\\d{0,2})\\d{0,12}/,\n\n // starts with 50/56-58/6304/67; 16 digits\n maestro: /^(?:5[0678]\\d{0,2}|6304|67\\d{0,2})\\d{0,12}/,\n\n // starts with 22; 16 digits\n mir: /^220[0-4]\\d{0,12}/,\n\n // starts with 4; 16 digits\n visa: /^4\\d{0,15}/,\n\n // starts with 62/81; 16 digits\n unionPay: /^(62|81)\\d{0,14}/\n },\n\n getStrictBlocks: function (block) {\n var total = block.reduce(function (prev, current) {\n return prev + current;\n }, 0);\n\n return block.concat(19 - total);\n },\n\n getInfo: function (value, strictMode) {\n var blocks = CreditCardDetector.blocks,\n re = CreditCardDetector.re;\n\n // Some credit card can have up to 19 digits number.\n // Set strictMode to true will remove the 16 max-length restrain,\n // however, I never found any website validate card number like\n // this, hence probably you don't want to enable this option.\n strictMode = !!strictMode;\n\n for (var key in re) {\n if (re[key].test(value)) {\n var matchedBlocks = blocks[key];\n return {\n type: key,\n blocks: strictMode ? this.getStrictBlocks(matchedBlocks) : matchedBlocks\n };\n }\n }\n\n return {\n type: 'unknown',\n blocks: strictMode ? this.getStrictBlocks(blocks.general) : blocks.general\n };\n }\n};\n\nvar CreditCardDetector_1 = CreditCardDetector;\n\nvar Util = {\n noop: function () {\n },\n\n strip: function (value, re) {\n return value.replace(re, '');\n },\n\n getPostDelimiter: function (value, delimiter, delimiters) {\n // single delimiter\n if (delimiters.length === 0) {\n return value.slice(-delimiter.length) === delimiter ? delimiter : '';\n }\n\n // multiple delimiters\n var matchedDelimiter = '';\n delimiters.forEach(function (current) {\n if (value.slice(-current.length) === current) {\n matchedDelimiter = current;\n }\n });\n\n return matchedDelimiter;\n },\n\n getDelimiterREByDelimiter: function (delimiter) {\n return new RegExp(delimiter.replace(/([.?*+^$[\\]\\\\(){}|-])/g, '\\\\$1'), 'g');\n },\n\n getNextCursorPosition: function (prevPos, oldValue, newValue, delimiter, delimiters) {\n // If cursor was at the end of value, just place it back.\n // Because new value could contain additional chars.\n if (oldValue.length === prevPos) {\n return newValue.length;\n }\n\n return prevPos + this.getPositionOffset(prevPos, oldValue, newValue, delimiter ,delimiters);\n },\n\n getPositionOffset: function (prevPos, oldValue, newValue, delimiter, delimiters) {\n var oldRawValue, newRawValue, lengthOffset;\n\n oldRawValue = this.stripDelimiters(oldValue.slice(0, prevPos), delimiter, delimiters);\n newRawValue = this.stripDelimiters(newValue.slice(0, prevPos), delimiter, delimiters);\n lengthOffset = oldRawValue.length - newRawValue.length;\n\n return (lengthOffset !== 0) ? (lengthOffset / Math.abs(lengthOffset)) : 0;\n },\n\n stripDelimiters: function (value, delimiter, delimiters) {\n var owner = this;\n\n // single delimiter\n if (delimiters.length === 0) {\n var delimiterRE = delimiter ? owner.getDelimiterREByDelimiter(delimiter) : '';\n\n return value.replace(delimiterRE, '');\n }\n\n // multiple delimiters\n delimiters.forEach(function (current) {\n current.split('').forEach(function (letter) {\n value = value.replace(owner.getDelimiterREByDelimiter(letter), '');\n });\n });\n\n return value;\n },\n\n headStr: function (str, length) {\n return str.slice(0, length);\n },\n\n getMaxLength: function (blocks) {\n return blocks.reduce(function (previous, current) {\n return previous + current;\n }, 0);\n },\n\n // strip prefix\n // Before type | After type | Return value\n // PEFIX-... | PEFIX-... | ''\n // PREFIX-123 | PEFIX-123 | 123\n // PREFIX-123 | PREFIX-23 | 23\n // PREFIX-123 | PREFIX-1234 | 1234\n getPrefixStrippedValue: function (value, prefix, prefixLength, prevResult, delimiter, delimiters, noImmediatePrefix, tailPrefix, signBeforePrefix) {\n // No prefix\n if (prefixLength === 0) {\n return value;\n }\n\n // Value is prefix\n if (value === prefix && value !== '') {\n return '';\n }\n\n if (signBeforePrefix && (value.slice(0, 1) == '-')) {\n var prev = (prevResult.slice(0, 1) == '-') ? prevResult.slice(1) : prevResult;\n return '-' + this.getPrefixStrippedValue(value.slice(1), prefix, prefixLength, prev, delimiter, delimiters, noImmediatePrefix, tailPrefix, signBeforePrefix);\n }\n\n // Pre result prefix string does not match pre-defined prefix\n if (prevResult.slice(0, prefixLength) !== prefix && !tailPrefix) {\n // Check if the first time user entered something\n if (noImmediatePrefix && !prevResult && value) return value;\n return '';\n } else if (prevResult.slice(-prefixLength) !== prefix && tailPrefix) {\n // Check if the first time user entered something\n if (noImmediatePrefix && !prevResult && value) return value;\n return '';\n }\n\n var prevValue = this.stripDelimiters(prevResult, delimiter, delimiters);\n\n // New value has issue, someone typed in between prefix letters\n // Revert to pre value\n if (value.slice(0, prefixLength) !== prefix && !tailPrefix) {\n return prevValue.slice(prefixLength);\n } else if (value.slice(-prefixLength) !== prefix && tailPrefix) {\n return prevValue.slice(0, -prefixLength - 1);\n }\n\n // No issue, strip prefix for new value\n return tailPrefix ? value.slice(0, -prefixLength) : value.slice(prefixLength);\n },\n\n getFirstDiffIndex: function (prev, current) {\n var index = 0;\n\n while (prev.charAt(index) === current.charAt(index)) {\n if (prev.charAt(index++) === '') {\n return -1;\n }\n }\n\n return index;\n },\n\n getFormattedValue: function (value, blocks, blocksLength, delimiter, delimiters, delimiterLazyShow) {\n var result = '',\n multipleDelimiters = delimiters.length > 0,\n currentDelimiter = '';\n\n // no options, normal input\n if (blocksLength === 0) {\n return value;\n }\n\n blocks.forEach(function (length, index) {\n if (value.length > 0) {\n var sub = value.slice(0, length),\n rest = value.slice(length);\n\n if (multipleDelimiters) {\n currentDelimiter = delimiters[delimiterLazyShow ? (index - 1) : index] || currentDelimiter;\n } else {\n currentDelimiter = delimiter;\n }\n\n if (delimiterLazyShow) {\n if (index > 0) {\n result += currentDelimiter;\n }\n\n result += sub;\n } else {\n result += sub;\n\n if (sub.length === length && index < blocksLength - 1) {\n result += currentDelimiter;\n }\n }\n\n // update remaining string\n value = rest;\n }\n });\n\n return result;\n },\n\n // move cursor to the end\n // the first time user focuses on an input with prefix\n fixPrefixCursor: function (el, prefix, delimiter, delimiters) {\n if (!el) {\n return;\n }\n\n var val = el.value,\n appendix = delimiter || (delimiters[0] || ' ');\n\n if (!el.setSelectionRange || !prefix || (prefix.length + appendix.length) <= val.length) {\n return;\n }\n\n var len = val.length * 2;\n\n // set timeout to avoid blink\n setTimeout(function () {\n el.setSelectionRange(len, len);\n }, 1);\n },\n\n // Check if input field is fully selected\n checkFullSelection: function(value) {\n try {\n var selection = window.getSelection() || document.getSelection() || {};\n return selection.toString().length === value.length;\n } catch (ex) {\n // Ignore\n }\n\n return false;\n },\n\n setSelection: function (element, position, doc) {\n if (element !== this.getActiveElement(doc)) {\n return;\n }\n\n // cursor is already in the end\n if (element && element.value.length <= position) {\n return;\n }\n\n if (element.createTextRange) {\n var range = element.createTextRange();\n\n range.move('character', position);\n range.select();\n } else {\n try {\n element.setSelectionRange(position, position);\n } catch (e) {\n // eslint-disable-next-line\n console.warn('The input element type does not support selection');\n }\n }\n },\n\n getActiveElement: function(parent) {\n var activeElement = parent.activeElement;\n if (activeElement && activeElement.shadowRoot) {\n return this.getActiveElement(activeElement.shadowRoot);\n }\n return activeElement;\n },\n\n isAndroid: function () {\n return navigator && /android/i.test(navigator.userAgent);\n },\n\n // On Android chrome, the keyup and keydown events\n // always return key code 229 as a composition that\n // buffers the user\u2019s keystrokes\n // see https://github.com/nosir/cleave.js/issues/147\n isAndroidBackspaceKeydown: function (lastInputValue, currentInputValue) {\n if (!this.isAndroid() || !lastInputValue || !currentInputValue) {\n return false;\n }\n\n return currentInputValue === lastInputValue.slice(0, -1);\n }\n};\n\nvar Util_1 = Util;\n\n/**\n * Props Assignment\n *\n * Separate this, so react module can share the usage\n */\nvar DefaultProperties = {\n // Maybe change to object-assign\n // for now just keep it as simple\n assign: function (target, opts) {\n target = target || {};\n opts = opts || {};\n\n // credit card\n target.creditCard = !!opts.creditCard;\n target.creditCardStrictMode = !!opts.creditCardStrictMode;\n target.creditCardType = '';\n target.onCreditCardTypeChanged = opts.onCreditCardTypeChanged || (function () {});\n\n // phone\n target.phone = !!opts.phone;\n target.phoneRegionCode = opts.phoneRegionCode || 'AU';\n target.phoneFormatter = {};\n\n // time\n target.time = !!opts.time;\n target.timePattern = opts.timePattern || ['h', 'm', 's'];\n target.timeFormat = opts.timeFormat || '24';\n target.timeFormatter = {};\n\n // date\n target.date = !!opts.date;\n target.datePattern = opts.datePattern || ['d', 'm', 'Y'];\n target.dateMin = opts.dateMin || '';\n target.dateMax = opts.dateMax || '';\n target.dateFormatter = {};\n\n // numeral\n target.numeral = !!opts.numeral;\n target.numeralIntegerScale = opts.numeralIntegerScale > 0 ? opts.numeralIntegerScale : 0;\n target.numeralDecimalScale = opts.numeralDecimalScale >= 0 ? opts.numeralDecimalScale : 2;\n target.numeralDecimalMark = opts.numeralDecimalMark || '.';\n target.numeralThousandsGroupStyle = opts.numeralThousandsGroupStyle || 'thousand';\n target.numeralPositiveOnly = !!opts.numeralPositiveOnly;\n target.stripLeadingZeroes = opts.stripLeadingZeroes !== false;\n target.signBeforePrefix = !!opts.signBeforePrefix;\n target.tailPrefix = !!opts.tailPrefix;\n\n // others\n target.swapHiddenInput = !!opts.swapHiddenInput;\n \n target.numericOnly = target.creditCard || target.date || !!opts.numericOnly;\n\n target.uppercase = !!opts.uppercase;\n target.lowercase = !!opts.lowercase;\n\n target.prefix = (target.creditCard || target.date) ? '' : (opts.prefix || '');\n target.noImmediatePrefix = !!opts.noImmediatePrefix;\n target.prefixLength = target.prefix.length;\n target.rawValueTrimPrefix = !!opts.rawValueTrimPrefix;\n target.copyDelimiter = !!opts.copyDelimiter;\n\n target.initValue = (opts.initValue !== undefined && opts.initValue !== null) ? opts.initValue.toString() : '';\n\n target.delimiter =\n (opts.delimiter || opts.delimiter === '') ? opts.delimiter :\n (opts.date ? '/' :\n (opts.time ? ':' :\n (opts.numeral ? ',' :\n (opts.phone ? ' ' :\n ' '))));\n target.delimiterLength = target.delimiter.length;\n target.delimiterLazyShow = !!opts.delimiterLazyShow;\n target.delimiters = opts.delimiters || [];\n\n target.blocks = opts.blocks || [];\n target.blocksLength = target.blocks.length;\n\n target.root = (typeof commonjsGlobal === 'object' && commonjsGlobal) ? commonjsGlobal : window;\n target.document = opts.document || target.root.document;\n\n target.maxLength = 0;\n\n target.backspace = false;\n target.result = '';\n\n target.onValueChanged = opts.onValueChanged || (function () {});\n\n return target;\n }\n};\n\nvar DefaultProperties_1 = DefaultProperties;\n\n/**\n * Construct a new Cleave instance by passing the configuration object\n *\n * @param {String | HTMLElement} element\n * @param {Object} opts\n */\nvar Cleave = function (element, opts) {\n var owner = this;\n var hasMultipleElements = false;\n\n if (typeof element === 'string') {\n owner.element = document.querySelector(element);\n hasMultipleElements = document.querySelectorAll(element).length > 1;\n } else {\n if (typeof element.length !== 'undefined' && element.length > 0) {\n owner.element = element[0];\n hasMultipleElements = element.length > 1;\n } else {\n owner.element = element;\n }\n }\n\n if (!owner.element) {\n throw new Error('[cleave.js] Please check the element');\n }\n\n if (hasMultipleElements) {\n try {\n // eslint-disable-next-line\n console.warn('[cleave.js] Multiple input fields matched, cleave.js will only take the first one.');\n } catch (e) {\n // Old IE\n }\n }\n\n opts.initValue = owner.element.value;\n\n owner.properties = Cleave.DefaultProperties.assign({}, opts);\n\n owner.init();\n};\n\nCleave.prototype = {\n init: function () {\n var owner = this, pps = owner.properties;\n\n // no need to use this lib\n if (!pps.numeral && !pps.phone && !pps.creditCard && !pps.time && !pps.date && (pps.blocksLength === 0 && !pps.prefix)) {\n owner.onInput(pps.initValue);\n\n return;\n }\n\n pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);\n\n owner.isAndroid = Cleave.Util.isAndroid();\n owner.lastInputValue = '';\n owner.isBackward = '';\n\n owner.onChangeListener = owner.onChange.bind(owner);\n owner.onKeyDownListener = owner.onKeyDown.bind(owner);\n owner.onFocusListener = owner.onFocus.bind(owner);\n owner.onCutListener = owner.onCut.bind(owner);\n owner.onCopyListener = owner.onCopy.bind(owner);\n\n owner.initSwapHiddenInput();\n\n owner.element.addEventListener('input', owner.onChangeListener);\n owner.element.addEventListener('keydown', owner.onKeyDownListener);\n owner.element.addEventListener('focus', owner.onFocusListener);\n owner.element.addEventListener('cut', owner.onCutListener);\n owner.element.addEventListener('copy', owner.onCopyListener);\n\n\n owner.initPhoneFormatter();\n owner.initDateFormatter();\n owner.initTimeFormatter();\n owner.initNumeralFormatter();\n\n // avoid touch input field if value is null\n // otherwise Firefox will add red box-shadow for \n if (pps.initValue || (pps.prefix && !pps.noImmediatePrefix)) {\n owner.onInput(pps.initValue);\n }\n },\n\n initSwapHiddenInput: function () {\n var owner = this, pps = owner.properties;\n if (!pps.swapHiddenInput) return;\n\n var inputFormatter = owner.element.cloneNode(true);\n owner.element.parentNode.insertBefore(inputFormatter, owner.element);\n\n owner.elementSwapHidden = owner.element;\n owner.elementSwapHidden.type = 'hidden';\n\n owner.element = inputFormatter;\n owner.element.id = '';\n },\n\n initNumeralFormatter: function () {\n var owner = this, pps = owner.properties;\n\n if (!pps.numeral) {\n return;\n }\n\n pps.numeralFormatter = new Cleave.NumeralFormatter(\n pps.numeralDecimalMark,\n pps.numeralIntegerScale,\n pps.numeralDecimalScale,\n pps.numeralThousandsGroupStyle,\n pps.numeralPositiveOnly,\n pps.stripLeadingZeroes,\n pps.prefix,\n pps.signBeforePrefix,\n pps.tailPrefix,\n pps.delimiter\n );\n },\n\n initTimeFormatter: function() {\n var owner = this, pps = owner.properties;\n\n if (!pps.time) {\n return;\n }\n\n pps.timeFormatter = new Cleave.TimeFormatter(pps.timePattern, pps.timeFormat);\n pps.blocks = pps.timeFormatter.getBlocks();\n pps.blocksLength = pps.blocks.length;\n pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);\n },\n\n initDateFormatter: function () {\n var owner = this, pps = owner.properties;\n\n if (!pps.date) {\n return;\n }\n\n pps.dateFormatter = new Cleave.DateFormatter(pps.datePattern, pps.dateMin, pps.dateMax);\n pps.blocks = pps.dateFormatter.getBlocks();\n pps.blocksLength = pps.blocks.length;\n pps.maxLength = Cleave.Util.getMaxLength(pps.blocks);\n },\n\n initPhoneFormatter: function () {\n var owner = this, pps = owner.properties;\n\n if (!pps.phone) {\n return;\n }\n\n // Cleave.AsYouTypeFormatter should be provided by\n // external google closure lib\n try {\n pps.phoneFormatter = new Cleave.PhoneFormatter(\n new pps.root.Cleave.AsYouTypeFormatter(pps.phoneRegionCode),\n pps.delimiter\n );\n } catch (ex) {\n throw new Error('[cleave.js] Please include phone-type-formatter.{country}.js lib');\n }\n },\n\n onKeyDown: function (event) {\n var owner = this,\n charCode = event.which || event.keyCode;\n\n owner.lastInputValue = owner.element.value;\n owner.isBackward = charCode === 8;\n },\n\n onChange: function (event) {\n var owner = this, pps = owner.properties,\n Util = Cleave.Util;\n\n owner.isBackward = owner.isBackward || event.inputType === 'deleteContentBackward';\n\n var postDelimiter = Util.getPostDelimiter(owner.lastInputValue, pps.delimiter, pps.delimiters);\n\n if (owner.isBackward && postDelimiter) {\n pps.postDelimiterBackspace = postDelimiter;\n } else {\n pps.postDelimiterBackspace = false;\n }\n\n this.onInput(this.element.value);\n },\n\n onFocus: function () {\n var owner = this,\n pps = owner.properties;\n owner.lastInputValue = owner.element.value;\n\n if (pps.prefix && pps.noImmediatePrefix && !owner.element.value) {\n this.onInput(pps.prefix);\n }\n\n Cleave.Util.fixPrefixCursor(owner.element, pps.prefix, pps.delimiter, pps.delimiters);\n },\n\n onCut: function (e) {\n if (!Cleave.Util.checkFullSelection(this.element.value)) return;\n this.copyClipboardData(e);\n this.onInput('');\n },\n\n onCopy: function (e) {\n if (!Cleave.Util.checkFullSelection(this.element.value)) return;\n this.copyClipboardData(e);\n },\n\n copyClipboardData: function (e) {\n var owner = this,\n pps = owner.properties,\n Util = Cleave.Util,\n inputValue = owner.element.value,\n textToCopy = '';\n\n if (!pps.copyDelimiter) {\n textToCopy = Util.stripDelimiters(inputValue, pps.delimiter, pps.delimiters);\n } else {\n textToCopy = inputValue;\n }\n\n try {\n if (e.clipboardData) {\n e.clipboardData.setData('Text', textToCopy);\n } else {\n window.clipboardData.setData('Text', textToCopy);\n }\n\n e.preventDefault();\n } catch (ex) {\n // empty\n }\n },\n\n onInput: function (value) {\n var owner = this, pps = owner.properties,\n Util = Cleave.Util;\n\n // case 1: delete one more character \"4\"\n // 1234*| -> hit backspace -> 123|\n // case 2: last character is not delimiter which is:\n // 12|34* -> hit backspace -> 1|34*\n // note: no need to apply this for numeral mode\n var postDelimiterAfter = Util.getPostDelimiter(value, pps.delimiter, pps.delimiters);\n if (!pps.numeral && pps.postDelimiterBackspace && !postDelimiterAfter) {\n value = Util.headStr(value, value.length - pps.postDelimiterBackspace.length);\n }\n\n // phone formatter\n if (pps.phone) {\n if (pps.prefix && (!pps.noImmediatePrefix || value.length)) {\n pps.result = pps.prefix + pps.phoneFormatter.format(value).slice(pps.prefix.length);\n } else {\n pps.result = pps.phoneFormatter.format(value);\n }\n owner.updateValueState();\n\n return;\n }\n\n // numeral formatter\n if (pps.numeral) {\n // Do not show prefix when noImmediatePrefix is specified\n // This mostly because we need to show user the native input placeholder\n if (pps.prefix && pps.noImmediatePrefix && value.length === 0) {\n pps.result = '';\n } else {\n pps.result = pps.numeralFormatter.format(value);\n }\n owner.updateValueState();\n\n return;\n }\n\n // date\n if (pps.date) {\n value = pps.dateFormatter.getValidatedDate(value);\n }\n\n // time\n if (pps.time) {\n value = pps.timeFormatter.getValidatedTime(value);\n }\n\n // strip delimiters\n value = Util.stripDelimiters(value, pps.delimiter, pps.delimiters);\n\n // strip prefix\n value = Util.getPrefixStrippedValue(value, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters, pps.noImmediatePrefix, pps.tailPrefix, pps.signBeforePrefix);\n\n // strip non-numeric characters\n value = pps.numericOnly ? Util.strip(value, /[^\\d]/g) : value;\n\n // convert case\n value = pps.uppercase ? value.toUpperCase() : value;\n value = pps.lowercase ? value.toLowerCase() : value;\n\n // prevent from showing prefix when no immediate option enabled with empty input value\n if (pps.prefix) {\n if (pps.tailPrefix) {\n value = value + pps.prefix;\n } else {\n value = pps.prefix + value;\n }\n\n\n // no blocks specified, no need to do formatting\n if (pps.blocksLength === 0) {\n pps.result = value;\n owner.updateValueState();\n\n return;\n }\n }\n\n // update credit card props\n if (pps.creditCard) {\n owner.updateCreditCardPropsByValue(value);\n }\n\n // strip over length characters\n value = Util.headStr(value, pps.maxLength);\n\n // apply blocks\n pps.result = Util.getFormattedValue(\n value,\n pps.blocks, pps.blocksLength,\n pps.delimiter, pps.delimiters, pps.delimiterLazyShow\n );\n\n owner.updateValueState();\n },\n\n updateCreditCardPropsByValue: function (value) {\n var owner = this, pps = owner.properties,\n Util = Cleave.Util,\n creditCardInfo;\n\n // At least one of the first 4 characters has changed\n if (Util.headStr(pps.result, 4) === Util.headStr(value, 4)) {\n return;\n }\n\n creditCardInfo = Cleave.CreditCardDetector.getInfo(value, pps.creditCardStrictMode);\n\n pps.blocks = creditCardInfo.blocks;\n pps.blocksLength = pps.blocks.length;\n pps.maxLength = Util.getMaxLength(pps.blocks);\n\n // credit card type changed\n if (pps.creditCardType !== creditCardInfo.type) {\n pps.creditCardType = creditCardInfo.type;\n\n pps.onCreditCardTypeChanged.call(owner, pps.creditCardType);\n }\n },\n\n updateValueState: function () {\n var owner = this,\n Util = Cleave.Util,\n pps = owner.properties;\n\n if (!owner.element) {\n return;\n }\n\n var endPos = owner.element.selectionEnd;\n var oldValue = owner.element.value;\n var newValue = pps.result;\n\n endPos = Util.getNextCursorPosition(endPos, oldValue, newValue, pps.delimiter, pps.delimiters);\n\n // fix Android browser type=\"text\" input field\n // cursor not jumping issue\n if (owner.isAndroid) {\n window.setTimeout(function () {\n owner.element.value = newValue;\n Util.setSelection(owner.element, endPos, pps.document, false);\n owner.callOnValueChanged();\n }, 1);\n\n return;\n }\n\n owner.element.value = newValue;\n if (pps.swapHiddenInput) owner.elementSwapHidden.value = owner.getRawValue();\n\n Util.setSelection(owner.element, endPos, pps.document, false);\n owner.callOnValueChanged();\n },\n\n callOnValueChanged: function () {\n var owner = this,\n pps = owner.properties;\n\n pps.onValueChanged.call(owner, {\n target: {\n name: owner.element.name,\n value: pps.result,\n rawValue: owner.getRawValue()\n }\n });\n },\n\n setPhoneRegionCode: function (phoneRegionCode) {\n var owner = this, pps = owner.properties;\n\n pps.phoneRegionCode = phoneRegionCode;\n owner.initPhoneFormatter();\n owner.onChange();\n },\n\n setRawValue: function (value) {\n var owner = this, pps = owner.properties;\n\n value = value !== undefined && value !== null ? value.toString() : '';\n\n if (pps.numeral) {\n value = value.replace('.', pps.numeralDecimalMark);\n }\n\n pps.postDelimiterBackspace = false;\n\n owner.element.value = value;\n owner.onInput(value);\n },\n\n getRawValue: function () {\n var owner = this,\n pps = owner.properties,\n Util = Cleave.Util,\n rawValue = owner.element.value;\n\n if (pps.rawValueTrimPrefix) {\n rawValue = Util.getPrefixStrippedValue(rawValue, pps.prefix, pps.prefixLength, pps.result, pps.delimiter, pps.delimiters, pps.noImmediatePrefix, pps.tailPrefix, pps.signBeforePrefix);\n }\n\n if (pps.numeral) {\n rawValue = pps.numeralFormatter.getRawValue(rawValue);\n } else {\n rawValue = Util.stripDelimiters(rawValue, pps.delimiter, pps.delimiters);\n }\n\n return rawValue;\n },\n\n getISOFormatDate: function () {\n var owner = this,\n pps = owner.properties;\n\n return pps.date ? pps.dateFormatter.getISOFormatDate() : '';\n },\n\n getISOFormatTime: function () {\n var owner = this,\n pps = owner.properties;\n\n return pps.time ? pps.timeFormatter.getISOFormatTime() : '';\n },\n\n getFormattedValue: function () {\n return this.element.value;\n },\n\n destroy: function () {\n var owner = this;\n\n owner.element.removeEventListener('input', owner.onChangeListener);\n owner.element.removeEventListener('keydown', owner.onKeyDownListener);\n owner.element.removeEventListener('focus', owner.onFocusListener);\n owner.element.removeEventListener('cut', owner.onCutListener);\n owner.element.removeEventListener('copy', owner.onCopyListener);\n },\n\n toString: function () {\n return '[Cleave Object]';\n }\n};\n\nCleave.NumeralFormatter = NumeralFormatter_1;\nCleave.DateFormatter = DateFormatter_1;\nCleave.TimeFormatter = TimeFormatter_1;\nCleave.PhoneFormatter = PhoneFormatter_1;\nCleave.CreditCardDetector = CreditCardDetector_1;\nCleave.Util = Util_1;\nCleave.DefaultProperties = DefaultProperties_1;\n\n// for angular directive\n((typeof commonjsGlobal === 'object' && commonjsGlobal) ? commonjsGlobal : window)['Cleave'] = Cleave;\n\n// CommonJS\nvar Cleave_1 = Cleave;\n\nexport default Cleave_1;\n", "!function(){function l(l,n){var u=l.split(\".\"),t=Y;u[0]in t||!t.execScript||t.execScript(\"var \"+u[0]);for(var e;u.length&&(e=u.shift());)u.length||void 0===n?t=t[e]?t[e]:t[e]={}:t[e]=n}function n(l,n){function u(){}u.prototype=n.prototype,l.M=n.prototype,l.prototype=new u,l.prototype.constructor=l,l.N=function(l,u,t){for(var e=Array(arguments.length-2),r=2;rLarge Modal Content
\n//