{ "version": 3, "sources": ["../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/adapters.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/logger.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/connection_monitor.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/internal.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/connection.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/subscription.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/subscription_guarantor.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/subscriptions.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/consumer.js", "../../../node_modules/@hotwired/turbo-rails/node_modules/@rails/actioncable/src/index.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/Event.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/es6-promise.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/String.trim.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/NodeList.forEach.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/Array.findIndex.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/Array.includes.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/Array.some.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/String.includes.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/Object.assign.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/Element.matches.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/Element.closest.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/AutoUrlDetect.js", "../../../node_modules/@yaireo/tagify/dist/src/polyfills/Element.classList.js", "../../../node_modules/cropperjs/dist/cropper.js", "../../../node_modules/flatpickr/dist/l10n/pt.js", "../../../node_modules/tiff.js/tiff.min.js", "../../../node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js", "../../../node_modules/@popperjs/core/lib/index.js", "../../../node_modules/@popperjs/core/lib/enums.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js", "../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js", "../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js", "../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js", "../../../node_modules/@popperjs/core/lib/utils/math.js", "../../../node_modules/@popperjs/core/lib/utils/userAgent.js", "../../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/contains.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js", "../../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js", "../../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js", "../../../node_modules/@popperjs/core/lib/utils/within.js", "../../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js", "../../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js", "../../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js", "../../../node_modules/@popperjs/core/lib/modifiers/arrow.js", "../../../node_modules/@popperjs/core/lib/utils/getVariation.js", "../../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js", "../../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js", "../../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js", "../../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js", "../../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js", "../../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js", "../../../node_modules/@popperjs/core/lib/utils/computeOffsets.js", "../../../node_modules/@popperjs/core/lib/utils/detectOverflow.js", "../../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js", "../../../node_modules/@popperjs/core/lib/modifiers/flip.js", "../../../node_modules/@popperjs/core/lib/modifiers/hide.js", "../../../node_modules/@popperjs/core/lib/modifiers/offset.js", "../../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js", "../../../node_modules/@popperjs/core/lib/utils/getAltAxis.js", "../../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js", "../../../node_modules/@popperjs/core/lib/utils/orderModifiers.js", "../../../node_modules/@popperjs/core/lib/utils/debounce.js", "../../../node_modules/@popperjs/core/lib/utils/mergeByName.js", "../../../node_modules/@popperjs/core/lib/createPopper.js", "../../../node_modules/@popperjs/core/lib/popper-lite.js", "../../../node_modules/@popperjs/core/lib/popper.js", "../../../node_modules/bootstrap/js/src/dom/data.js", "../../../node_modules/bootstrap/js/src/util/index.js", "../../../node_modules/bootstrap/js/src/dom/event-handler.js", "../../../node_modules/bootstrap/js/src/dom/manipulator.js", "../../../node_modules/bootstrap/js/src/util/config.js", "../../../node_modules/bootstrap/js/src/base-component.js", "../../../node_modules/bootstrap/js/src/dom/selector-engine.js", "../../../node_modules/bootstrap/js/src/util/component-functions.js", "../../../node_modules/bootstrap/js/src/alert.js", "../../../node_modules/bootstrap/js/src/button.js", "../../../node_modules/bootstrap/js/src/util/swipe.js", "../../../node_modules/bootstrap/js/src/carousel.js", "../../../node_modules/bootstrap/js/src/collapse.js", "../../../node_modules/bootstrap/js/src/dropdown.js", "../../../node_modules/bootstrap/js/src/util/backdrop.js", "../../../node_modules/bootstrap/js/src/util/focustrap.js", "../../../node_modules/bootstrap/js/src/util/scrollbar.js", "../../../node_modules/bootstrap/js/src/modal.js", "../../../node_modules/bootstrap/js/src/offcanvas.js", "../../../node_modules/bootstrap/js/src/util/sanitizer.js", "../../../node_modules/bootstrap/js/src/util/template-factory.js", "../../../node_modules/bootstrap/js/src/tooltip.js", "../../../node_modules/bootstrap/js/src/popover.js", "../../../node_modules/bootstrap/js/src/scrollspy.js", "../../../node_modules/bootstrap/js/src/tab.js", "../../../node_modules/bootstrap/js/src/toast.js", "../../../node_modules/trix/src/trix/config/attachments.js", "../../../node_modules/trix/src/trix/config/block_attributes.js", "../../../node_modules/trix/src/trix/config/browser.js", "../../../node_modules/trix/src/trix/config/dompurify.js", "../../../node_modules/trix/src/trix/config/lang.js", "../../../node_modules/trix/src/trix/config/file_size_formatting.js", "../../../node_modules/trix/src/trix/constants.js", "../../../node_modules/trix/src/trix/core/helpers/extend.js", "../../../node_modules/trix/src/trix/core/helpers/dom.js", "../../../node_modules/trix/src/trix/config/input.js", "../../../node_modules/trix/src/trix/config/key_names.js", "../../../node_modules/trix/src/trix/config/parser.js", "../../../node_modules/trix/src/trix/config/text_attributes.js", "../../../node_modules/trix/src/trix/config/toolbar.js", "../../../node_modules/trix/src/trix/config/undo.js", "../../../node_modules/trix/src/trix/config/css.js", "../../../node_modules/trix/src/trix/core/basic_object.js", "../../../node_modules/trix/src/trix/core/utilities/utf16_string.js", "../../../node_modules/trix/src/trix/core/object.js", "../../../node_modules/trix/src/trix/core/helpers/arrays.js", "../../../node_modules/trix/src/trix/core/helpers/bidi.js", "../../../node_modules/trix/src/trix/core/helpers/config.js", "../../../node_modules/trix/src/trix/core/helpers/custom_elements.js", "../../../node_modules/trix/src/trix/core/helpers/events.js", "../../../node_modules/trix/src/trix/core/helpers/functions.js", "../../../node_modules/trix/src/trix/core/helpers/objects.js", "../../../node_modules/trix/src/trix/core/helpers/ranges.js", "../../../node_modules/trix/src/trix/observers/selection_change_observer.js", "../../../node_modules/trix/src/trix/core/helpers/strings.js", "../../../node_modules/trix/src/trix/core/collections/hash.js", "../../../node_modules/trix/src/trix/core/collections/object_group.js", "../../../node_modules/trix/src/trix/core/collections/object_map.js", "../../../node_modules/trix/src/trix/core/collections/element_store.js", "../../../node_modules/trix/src/trix/core/utilities/operation.js", "../../../node_modules/trix/src/trix/views/object_view.js", "../../../node_modules/trix/node_modules/dompurify/dist/purify.es.mjs", "../../../node_modules/trix/src/trix/models/html_sanitizer.js", "../../../node_modules/trix/src/trix/views/attachment_view.js", "../../../node_modules/trix/src/trix/views/previewable_attachment_view.js", "../../../node_modules/trix/src/trix/views/piece_view.js", "../../../node_modules/trix/src/trix/views/text_view.js", "../../../node_modules/trix/src/trix/views/block_view.js", "../../../node_modules/trix/src/trix/views/document_view.js", "../../../node_modules/trix/src/trix/models/piece.js", "../../../node_modules/trix/src/trix/operations/image_preload_operation.js", "../../../node_modules/trix/src/trix/models/attachment.js", "../../../node_modules/trix/src/trix/models/attachment_piece.js", "../../../node_modules/trix/src/trix/models/string_piece.js", "../../../node_modules/trix/src/trix/models/splittable_list.js", "../../../node_modules/trix/src/trix/models/text.js", "../../../node_modules/trix/src/trix/models/block.js", "../../../node_modules/trix/src/trix/models/document.js", "../../../node_modules/trix/src/trix/models/html_parser.js", "../../../node_modules/trix/src/trix/core/serialization.js", "../../../node_modules/trix/src/trix/models/managed_attachment.js", "../../../node_modules/trix/src/trix/models/attachment_manager.js", "../../../node_modules/trix/src/trix/models/line_break_insertion.js", "../../../node_modules/trix/src/trix/models/composition.js", "../../../node_modules/trix/src/trix/models/undo_manager.js", "../../../node_modules/trix/src/trix/filters/filter.js", "../../../node_modules/trix/src/trix/filters/attachment_gallery_filter.js", "../../../node_modules/trix/src/trix/models/editor.js", "../../../node_modules/trix/src/trix/models/location_mapper.js", "../../../node_modules/trix/src/trix/models/point_mapper.js", "../../../node_modules/trix/src/trix/models/selection_manager.js", "../../../node_modules/trix/src/trix/controllers/attachment_editor_controller.js", "../../../node_modules/trix/src/trix/controllers/composition_controller.js", "../../../node_modules/trix/src/trix/controllers/controller.js", "../../../node_modules/trix/src/trix/observers/mutation_observer.js", "../../../node_modules/trix/src/trix/operations/file_verification_operation.js", "../../../node_modules/trix/src/trix/models/flaky_android_keyboard_detector.js", "../../../node_modules/trix/src/trix/controllers/input_controller.js", "../../../node_modules/trix/src/trix/controllers/level_0_input_controller.js", "../../../node_modules/trix/src/trix/controllers/level_2_input_controller.js", "../../../node_modules/trix/src/trix/controllers/toolbar_controller.js", "../../../node_modules/trix/src/trix/controllers/editor_controller.js", "../../../node_modules/trix/src/trix/elements/trix_toolbar_element.js", "../../../node_modules/trix/src/trix/elements/trix_editor_element.js", "../../../node_modules/trix/src/trix/trix.js", "../../../node_modules/@rails/actiontext/app/assets/javascripts/actiontext.esm.js", "../../../node_modules/@rails/activestorage/app/assets/javascripts/activestorage.esm.js", "../../javascript/application.js", "../../../node_modules/@hotwired/stimulus/dist/stimulus.js", "../../javascript/controllers/application.js", "../../javascript/controllers/binded_select_controller.js", "../../javascript/services/cookies.js", "../../javascript/controllers/camera_controller.js", "../../javascript/controllers/clear_input_controller.js", "../../javascript/services/freeze_scroll_turbo_render.js", "../../javascript/controllers/click_controller.js", "../../javascript/controllers/clipboard_controller.js", "../../javascript/controllers/cookie_permission_controller.js", "../../javascript/services/addClass.js", "../../javascript/services/modal.js", "../../javascript/controllers/cropper_controller.js", "../../../node_modules/stimulus-use/dist/index.js", "../../javascript/controllers/decimal_controller.js", "../../javascript/controllers/dialog_controller.js", "../../javascript/controllers/disable_enter_key_controller.js", "../../javascript/controllers/dropzone_controller.js", "../../javascript/controllers/dynamic_visibility_controller.js", "../../../node_modules/@editorjs/editorjs/dist/editorjs.mjs", "../../../node_modules/@editorjs/paragraph/dist/paragraph.mjs", "../../../node_modules/@editorjs/table/dist/table.mjs", "../../../node_modules/@editorjs/header/dist/header.mjs", "../../../node_modules/@editorjs/list/dist/editorjs-list.mjs", "../../javascript/controllers/editor_js_controller.js", "../../javascript/controllers/element_handler_controller.js", "../../javascript/controllers/event_dispatcher_controller.js", "../../javascript/controllers/file_uploader_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/controllers/flatpickr_controller.js", "../../javascript/controllers/focus_controller.js", "../../javascript/controllers/font_preview_controller.js", "../../javascript/services/currencyMask.js", "../../javascript/controllers/format_controller.js", "../../javascript/controllers/hidden_checkbox_controller.js", "../../javascript/controllers/hide_element_controller.js", "../../javascript/controllers/icon_toggler_controller.js", "../../javascript/controllers/jivo_chat_controller.js", "../../javascript/controllers/modal_controller.js", "../../javascript/controllers/modal_search_controller.js", "../../javascript/controllers/nav_tab_cookie_loader_controller.js", "../../javascript/services/orderable.js", "../../javascript/controllers/orderable_controller.js", "../../javascript/controllers/password_visibility_controller.js", "../../javascript/services/pje_connection.js", "../../javascript/services/redirect_to.js", "../../javascript/services/signature_redirector.js", "../../javascript/controllers/pje_controller.js", "../../javascript/controllers/popover_controller.js", "../../javascript/controllers/recaptcha_controller.js", "../../javascript/controllers/refresh_controller.js", "../../javascript/controllers/remote_certificate_controller.js", "../../javascript/locales/pt-BR.json", "../../javascript/controllers/simple_spinner_controller.js", "../../../node_modules/sortablejs/modular/sortable.esm.js", "../../javascript/controllers/sortable_controller.js", "../../javascript/services/date_validator.js", "../../javascript/services/hour_validator.js", "../../javascript/services/age_validator.js", "../../javascript/controllers/stimulus_validation_controller.js", "../../javascript/controllers/sum_controller.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/constants.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/helpers.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/defaults.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/dropdown.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/suggestions.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/persist.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/texts.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/templates.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/events.js", "../../../node_modules/@yaireo/tagify/dist/src/tagify.js", "../../../node_modules/@yaireo/tagify/dist/src/parts/EventDispatcher.js", "../../javascript/controllers/tagify_controller.js", "../../javascript/controllers/ticket_call_controller.js", "../../javascript/controllers/ticket_panel_controller.js", "../../javascript/controllers/tiff_viewer_controller.js", "../../../node_modules/date-fns/toDate.mjs", "../../../node_modules/date-fns/constants.mjs", "../../../node_modules/date-fns/startOfDay.mjs", "../../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs", "../../../node_modules/date-fns/differenceInCalendarDays.mjs", "../../../node_modules/date-fns/compareAsc.mjs", "../../../node_modules/date-fns/differenceInCalendarMonths.mjs", "../../../node_modules/date-fns/differenceInCalendarYears.mjs", "../../../node_modules/date-fns/differenceInDays.mjs", "../../../node_modules/date-fns/endOfDay.mjs", "../../../node_modules/date-fns/endOfMonth.mjs", "../../../node_modules/date-fns/isLastDayOfMonth.mjs", "../../../node_modules/date-fns/differenceInMonths.mjs", "../../../node_modules/date-fns/differenceInYears.mjs", "../../javascript/controllers/time_span_controller.js", "../../javascript/controllers/title_toggler_controller.js", "../../javascript/controllers/turbo_spinner_controller.js", "../../javascript/controllers/url_query_controller.js", "../../javascript/services/doc_cpf_validate.js", "../../javascript/services/doc_cnpj_validate.js", "../../javascript/controllers/validator_cpf_cnpj_controller.js", "../../javascript/controllers/value_copier_controller.js", "../../javascript/controllers/virtual_field_controller.js", "../../javascript/controllers/index.js", "../../javascript/services/reload_turbo.js", "../../javascript/services/changeTurboFrameErrorContent.js", "../../javascript/services/movidesk.js", "../../javascript/services/limit_maxlength.js", "../../../node_modules/@rails/actioncable/app/assets/javascripts/actioncable.esm.js", "../../javascript/channels/consumer.js", "../../javascript/channels/notifications_channel.js", "../../javascript/channels/panel_channel.js", "../../javascript/stream_actions/redirect.js"], "sourcesContent": ["export default {\n logger: typeof console !== \"undefined\" ? console : undefined,\n WebSocket: typeof WebSocket !== \"undefined\" ? WebSocket : undefined,\n}\n", "import adapters from \"./adapters\"\n\n// The logger is disabled by default. You can enable it with:\n//\n// ActionCable.logger.enabled = true\n//\n// Example:\n//\n// import * as ActionCable from '@rails/actioncable'\n//\n// ActionCable.logger.enabled = true\n// ActionCable.logger.log('Connection Established.')\n//\n\nexport default {\n log(...messages) {\n if (this.enabled) {\n messages.push(Date.now())\n adapters.logger.log(\"[ActionCable]\", ...messages)\n }\n },\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting\n// revival reconnections if things go astray. Internal class, not intended for direct user manipulation.\n\nconst now = () => new Date().getTime()\n\nconst secondsSince = time => (now() - time) / 1000\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this)\n this.connection = connection\n this.reconnectAttempts = 0\n }\n\n start() {\n if (!this.isRunning()) {\n this.startedAt = now()\n delete this.stoppedAt\n this.startPolling()\n addEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`)\n }\n }\n\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now()\n this.stopPolling()\n removeEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(\"ConnectionMonitor stopped\")\n }\n }\n\n isRunning() {\n return this.startedAt && !this.stoppedAt\n }\n\n recordMessage() {\n this.pingedAt = now()\n }\n\n recordConnect() {\n this.reconnectAttempts = 0\n delete this.disconnectedAt\n logger.log(\"ConnectionMonitor recorded connect\")\n }\n\n recordDisconnect() {\n this.disconnectedAt = now()\n logger.log(\"ConnectionMonitor recorded disconnect\")\n }\n\n // Private\n\n startPolling() {\n this.stopPolling()\n this.poll()\n }\n\n stopPolling() {\n clearTimeout(this.pollTimeout)\n }\n\n poll() {\n this.pollTimeout = setTimeout(() => {\n this.reconnectIfStale()\n this.poll()\n }\n , this.getPollInterval())\n }\n\n getPollInterval() {\n const { staleThreshold, reconnectionBackoffRate } = this.constructor\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10))\n const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate\n const jitter = jitterMax * Math.random()\n return staleThreshold * 1000 * backoff * (1 + jitter)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`)\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`)\n } else {\n logger.log(\"ConnectionMonitor reopening\")\n this.connection.reopen()\n }\n }\n }\n\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt\n }\n\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return this.disconnectedAt && (secondsSince(this.disconnectedAt) < this.constructor.staleThreshold)\n }\n\n visibilityDidChange() {\n if (document.visibilityState === \"visible\") {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`)\n this.connection.reopen()\n }\n }\n , 200)\n }\n }\n\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\nConnectionMonitor.reconnectionBackoffRate = 0.15\n\nexport default ConnectionMonitor\n", "export default {\n \"message_types\": {\n \"welcome\": \"welcome\",\n \"disconnect\": \"disconnect\",\n \"ping\": \"ping\",\n \"confirmation\": \"confirm_subscription\",\n \"rejection\": \"reject_subscription\"\n },\n \"disconnect_reasons\": {\n \"unauthorized\": \"unauthorized\",\n \"invalid_request\": \"invalid_request\",\n \"server_restart\": \"server_restart\",\n \"remote\": \"remote\"\n },\n \"default_mount_path\": \"/cable\",\n \"protocols\": [\n \"actioncable-v1-json\",\n \"actioncable-unsupported\"\n ]\n}\n", "import adapters from \"./adapters\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport INTERNAL from \"./internal\"\nimport logger from \"./logger\"\n\n// Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.\n\nconst {message_types, protocols} = INTERNAL\nconst supportedProtocols = protocols.slice(0, protocols.length - 1)\n\nconst indexOf = [].indexOf\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this)\n this.consumer = consumer\n this.subscriptions = this.consumer.subscriptions\n this.monitor = new ConnectionMonitor(this)\n this.disconnected = true\n }\n\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data))\n return true\n } else {\n return false\n }\n }\n\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`)\n return false\n } else {\n const socketProtocols = [...protocols, ...this.consumer.subprotocols || []]\n logger.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${socketProtocols}`)\n if (this.webSocket) { this.uninstallEventHandlers() }\n this.webSocket = new adapters.WebSocket(this.consumer.url, socketProtocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({allowReconnect} = {allowReconnect: true}) {\n if (!allowReconnect) { this.monitor.stop() }\n // Avoid closing websockets in a \"connecting\" state due to Safari 15.1+ bug. See: https://github.com/rails/rails/issues/43835#issuecomment-1002288478\n if (this.isOpen()) {\n return this.webSocket.close()\n }\n }\n\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`)\n if (this.isActive()) {\n try {\n return this.close()\n } catch (error) {\n logger.log(\"Failed to reopen WebSocket\", error)\n }\n finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`)\n setTimeout(this.open, this.constructor.reopenDelay)\n }\n } else {\n return this.open()\n }\n }\n\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol\n }\n }\n\n isOpen() {\n return this.isState(\"open\")\n }\n\n isActive() {\n return this.isState(\"open\", \"connecting\")\n }\n\n triedToReconnect() {\n return this.monitor.reconnectAttempts > 0\n }\n\n // Private\n\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0\n }\n\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0\n }\n\n getState() {\n if (this.webSocket) {\n for (let state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase()\n }\n }\n }\n return null\n }\n\n installEventHandlers() {\n for (let eventName in this.events) {\n const handler = this.events[eventName].bind(this)\n this.webSocket[`on${eventName}`] = handler\n }\n }\n\n uninstallEventHandlers() {\n for (let eventName in this.events) {\n this.webSocket[`on${eventName}`] = function() {}\n }\n }\n\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) { return }\n const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)\n this.monitor.recordMessage()\n switch (type) {\n case message_types.welcome:\n if (this.triedToReconnect()) {\n this.reconnectAttempted = true\n }\n this.monitor.recordConnect()\n return this.subscriptions.reload()\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`)\n return this.close({allowReconnect: reconnect})\n case message_types.ping:\n return null\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier)\n if (this.reconnectAttempted) {\n this.reconnectAttempted = false\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: true})\n } else {\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: false})\n }\n case message_types.rejection:\n return this.subscriptions.reject(identifier)\n default:\n return this.subscriptions.notify(identifier, \"received\", message)\n }\n },\n\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`)\n this.disconnected = false\n if (!this.isProtocolSupported()) {\n logger.log(\"Protocol is unsupported. Stopping monitor and disconnecting.\")\n return this.close({allowReconnect: false})\n }\n },\n\n close(event) {\n logger.log(\"WebSocket onclose event\")\n if (this.disconnected) { return }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll(\"disconnected\", {willAttemptReconnect: this.monitor.isRunning()})\n },\n\n error() {\n logger.log(\"WebSocket onerror event\")\n }\n}\n\nexport default Connection\n", "// A new subscription is created through the ActionCable.Subscriptions instance available on the consumer.\n// It provides a number of callbacks and a method for calling remote procedure calls on the corresponding\n// Channel instance on the server side.\n//\n// An example demonstrates the basic functionality:\n//\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\", {\n// connected() {\n// // Called once the subscription has been successfully completed\n// },\n//\n// disconnected({ willAttemptReconnect: boolean }) {\n// // Called when the client has disconnected with the server.\n// // The object will have an `willAttemptReconnect` property which\n// // says whether the client has the intention of attempting\n// // to reconnect.\n// },\n//\n// appear() {\n// this.perform('appear', {appearing_on: this.appearingOn()})\n// },\n//\n// away() {\n// this.perform('away')\n// },\n//\n// appearingOn() {\n// $('main').data('appearing-on')\n// }\n// })\n//\n// The methods #appear and #away forward their intent to the remote AppearanceChannel instance on the server\n// by calling the `perform` method with the first parameter being the action (which maps to AppearanceChannel#appear/away).\n// The second parameter is a hash that'll get JSON encoded and made available on the server in the data parameter.\n//\n// This is how the server component would look:\n//\n// class AppearanceChannel < ApplicationActionCable::Channel\n// def subscribed\n// current_user.appear\n// end\n//\n// def unsubscribed\n// current_user.disappear\n// end\n//\n// def appear(data)\n// current_user.appear on: data['appearing_on']\n// end\n//\n// def away\n// current_user.away\n// end\n// end\n//\n// The \"AppearanceChannel\" name is automatically mapped between the client-side subscription creation and the server-side Ruby class name.\n// The AppearanceChannel#appear/away public methods are exposed automatically to client-side invocation through the perform method.\n\nconst extend = function(object, properties) {\n if (properties != null) {\n for (let key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport default class Subscription {\n constructor(consumer, params = {}, mixin) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action, data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data) {\n return this.consumer.send({command: \"message\", identifier: this.identifier, data: JSON.stringify(data)})\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring channel subscribe command is confirmed, retrying until confirmation is received.\n// Internal class, not intended for direct user manipulation.\n\nclass SubscriptionGuarantor {\n constructor(subscriptions) {\n this.subscriptions = subscriptions\n this.pendingSubscriptions = []\n }\n\n guarantee(subscription) {\n if(this.pendingSubscriptions.indexOf(subscription) == -1){ \n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`)\n this.pendingSubscriptions.push(subscription) \n }\n else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`)\n }\n this.startGuaranteeing()\n }\n\n forget(subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`)\n this.pendingSubscriptions = (this.pendingSubscriptions.filter((s) => s !== subscription))\n }\n\n startGuaranteeing() {\n this.stopGuaranteeing()\n this.retrySubscribing()\n }\n \n stopGuaranteeing() {\n clearTimeout(this.retryTimeout)\n }\n\n retrySubscribing() {\n this.retryTimeout = setTimeout(() => {\n if (this.subscriptions && typeof(this.subscriptions.subscribe) === \"function\") {\n this.pendingSubscriptions.map((subscription) => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`)\n this.subscriptions.subscribe(subscription)\n })\n }\n }\n , 500)\n }\n}\n\nexport default SubscriptionGuarantor", "import Subscription from \"./subscription\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport logger from \"./logger\"\n\n// Collection class for creating (and internally managing) channel subscriptions.\n// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,\n// and it should be called through the consumer like so:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n\nexport default class Subscriptions {\n constructor(consumer) {\n this.consumer = consumer\n this.guarantor = new SubscriptionGuarantor(this)\n this.subscriptions = []\n }\n\n create(channelName, mixin) {\n const channel = channelName\n const params = typeof channel === \"object\" ? channel : {channel}\n const subscription = new Subscription(this.consumer, params, mixin)\n return this.add(subscription)\n }\n\n // Private\n\n add(subscription) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, \"initialized\")\n this.subscribe(subscription)\n return subscription\n }\n\n remove(subscription) {\n this.forget(subscription)\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, \"unsubscribe\")\n }\n return subscription\n }\n\n reject(identifier) {\n return this.findAll(identifier).map((subscription) => {\n this.forget(subscription)\n this.notify(subscription, \"rejected\")\n return subscription\n })\n }\n\n forget(subscription) {\n this.guarantor.forget(subscription)\n this.subscriptions = (this.subscriptions.filter((s) => s !== subscription))\n return subscription\n }\n\n findAll(identifier) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) =>\n this.subscribe(subscription))\n }\n\n notifyAll(callbackName, ...args) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args))\n }\n\n notify(subscription, callbackName, ...args) {\n let subscriptions\n if (typeof subscription === \"string\") {\n subscriptions = this.findAll(subscription)\n } else {\n subscriptions = [subscription]\n }\n\n return subscriptions.map((subscription) =>\n (typeof subscription[callbackName] === \"function\" ? subscription[callbackName](...args) : undefined))\n }\n\n subscribe(subscription) {\n if (this.sendCommand(subscription, \"subscribe\")) {\n this.guarantor.guarantee(subscription)\n }\n }\n\n confirmSubscription(identifier) {\n logger.log(`Subscription confirmed ${identifier}`)\n this.findAll(identifier).map((subscription) =>\n this.guarantor.forget(subscription))\n }\n\n sendCommand(subscription, command) {\n const {identifier} = subscription\n return this.consumer.send({command, identifier})\n }\n}\n", "import Connection from \"./connection\"\nimport Subscriptions from \"./subscriptions\"\n\n// The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established,\n// the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates.\n// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription\n// method.\n//\n// The following example shows how this can be set up:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n//\n// When a consumer is created, it automatically connects with the server.\n//\n// To disconnect from the server, call\n//\n// App.cable.disconnect()\n//\n// and to restart the connection:\n//\n// App.cable.connect()\n//\n// Any channel subscriptions which existed prior to disconnecting will\n// automatically resubscribe.\n\nexport default class Consumer {\n constructor(url) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n this.subprotocols = []\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data) {\n return this.connection.send(data)\n }\n\n connect() {\n return this.connection.open()\n }\n\n disconnect() {\n return this.connection.close({allowReconnect: false})\n }\n\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open()\n }\n }\n\n addSubProtocol(subprotocol) {\n this.subprotocols = [...this.subprotocols, subprotocol]\n }\n}\n\nexport function createWebSocketURL(url) {\n if (typeof url === \"function\") {\n url = url()\n }\n\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement(\"a\")\n a.href = url\n // Fix populating Location properties in IE. Otherwise, protocol will be blank.\n a.href = a.href // eslint-disable-line\n a.protocol = a.protocol.replace(\"http\", \"ws\")\n return a.href\n } else {\n return url\n }\n}\n", "import Connection from \"./connection\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport Consumer, { createWebSocketURL } from \"./consumer\"\nimport INTERNAL from \"./internal\"\nimport Subscription from \"./subscription\"\nimport Subscriptions from \"./subscriptions\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport adapters from \"./adapters\"\nimport logger from \"./logger\"\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\n SubscriptionGuarantor,\n adapters,\n createWebSocketURL,\n logger,\n}\n\nexport function createConsumer(url = getConfig(\"url\") || INTERNAL.default_mount_path) {\n return new Consumer(url)\n}\n\nexport function getConfig(name) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n", "// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill\r\nfunction CustomEventPolyfill ( event, params ) {\r\n params = params || { bubbles: false, cancelable: false, detail: undefined };\r\n var evt = document.createEvent( 'CustomEvent' );\r\n evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );\r\n return evt;\r\n}\r\n\r\nCustomEventPolyfill.prototype = window.Event.prototype;\r\n\r\nif ( typeof window.CustomEvent !== \"function\" ){\r\n window.CustomEvent = CustomEventPolyfill;\r\n}", "// https://github.com/taylorhakes/promise-polyfill\r\n\r\n(function (global, factory) {\r\n typeof exports === 'object' && typeof module !== 'undefined' ? factory() :\r\n typeof define === 'function' && define.amd ? define(factory) :\r\n (factory());\r\n}(globalThis, (function () { 'use strict';\r\n\r\n /**\r\n * @this {Promise}\r\n */\r\n function finallyConstructor(callback) {\r\n var constructor = this.constructor;\r\n return this.then(\r\n function(value) {\r\n // @ts-ignore\r\n return constructor.resolve(callback()).then(function() {\r\n return value;\r\n });\r\n },\r\n function(reason) {\r\n // @ts-ignore\r\n return constructor.resolve(callback()).then(function() {\r\n // @ts-ignore\r\n return constructor.reject(reason);\r\n });\r\n }\r\n );\r\n }\r\n\r\n function allSettled(arr) {\r\n var P = this;\r\n return new P(function(resolve, reject) {\r\n if (!(arr && typeof arr.length !== 'undefined')) {\r\n return reject(\r\n new TypeError(\r\n typeof arr +\r\n ' ' +\r\n arr +\r\n ' is not iterable(cannot read property Symbol(Symbol.iterator))'\r\n )\r\n );\r\n }\r\n var args = Array.prototype.slice.call(arr);\r\n if (args.length === 0) return resolve([]);\r\n var remaining = args.length;\r\n\r\n function res(i, val) {\r\n if (val && (typeof val === 'object' || typeof val === 'function')) {\r\n var then = val.then;\r\n if (typeof then === 'function') {\r\n then.call(\r\n val,\r\n function(val) {\r\n res(i, val);\r\n },\r\n function(e) {\r\n args[i] = { status: 'rejected', reason: e };\r\n if (--remaining === 0) {\r\n resolve(args);\r\n }\r\n }\r\n );\r\n return;\r\n }\r\n }\r\n args[i] = { status: 'fulfilled', value: val };\r\n if (--remaining === 0) {\r\n resolve(args);\r\n }\r\n }\r\n\r\n for (var i = 0; i < args.length; i++) {\r\n res(i, args[i]);\r\n }\r\n });\r\n }\r\n\r\n // Store setTimeout reference so promise-polyfill will be unaffected by\r\n // other code modifying setTimeout (like sinon.useFakeTimers())\r\n var setTimeoutFunc = setTimeout;\r\n\r\n function isArray(x) {\r\n return Boolean(x && typeof x.length !== 'undefined');\r\n }\r\n\r\n function noop() {}\r\n\r\n // Polyfill for Function.prototype.bind\r\n function bind(fn, thisArg) {\r\n return function() {\r\n fn.apply(thisArg, arguments);\r\n };\r\n }\r\n\r\n /**\r\n * @constructor\r\n * @param {Function} fn\r\n */\r\n function Promise(fn) {\r\n if (!(this instanceof Promise))\r\n throw new TypeError('Promises must be constructed via new');\r\n if (typeof fn !== 'function') throw new TypeError('not a function');\r\n /** @type {!number} */\r\n this._state = 0;\r\n /** @type {!boolean} */\r\n this._handled = false;\r\n /** @type {Promise|undefined} */\r\n this._value = undefined;\r\n /** @type {!Array} */\r\n this._deferreds = [];\r\n\r\n doResolve(fn, this);\r\n }\r\n\r\n function handle(self, deferred) {\r\n while (self._state === 3) {\r\n self = self._value;\r\n }\r\n if (self._state === 0) {\r\n self._deferreds.push(deferred);\r\n return;\r\n }\r\n self._handled = true;\r\n Promise._immediateFn(function() {\r\n var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\r\n if (cb === null) {\r\n (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\r\n return;\r\n }\r\n var ret;\r\n try {\r\n ret = cb(self._value);\r\n } catch (e) {\r\n reject(deferred.promise, e);\r\n return;\r\n }\r\n resolve(deferred.promise, ret);\r\n });\r\n }\r\n\r\n function resolve(self, newValue) {\r\n try {\r\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\r\n if (newValue === self)\r\n throw new TypeError('A promise cannot be resolved with itself.');\r\n if (\r\n newValue &&\r\n (typeof newValue === 'object' || typeof newValue === 'function')\r\n ) {\r\n var then = newValue.then;\r\n if (newValue instanceof Promise) {\r\n self._state = 3;\r\n self._value = newValue;\r\n finale(self);\r\n return;\r\n } else if (typeof then === 'function') {\r\n doResolve(bind(then, newValue), self);\r\n return;\r\n }\r\n }\r\n self._state = 1;\r\n self._value = newValue;\r\n finale(self);\r\n } catch (e) {\r\n reject(self, e);\r\n }\r\n }\r\n\r\n function reject(self, newValue) {\r\n self._state = 2;\r\n self._value = newValue;\r\n finale(self);\r\n }\r\n\r\n function finale(self) {\r\n if (self._state === 2 && self._deferreds.length === 0) {\r\n Promise._immediateFn(function() {\r\n if (!self._handled) {\r\n Promise._unhandledRejectionFn(self._value);\r\n }\r\n });\r\n }\r\n\r\n for (var i = 0, len = self._deferreds.length; i < len; i++) {\r\n handle(self, self._deferreds[i]);\r\n }\r\n self._deferreds = null;\r\n }\r\n\r\n /**\r\n * @constructor\r\n */\r\n function Handler(onFulfilled, onRejected, promise) {\r\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\r\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\r\n this.promise = promise;\r\n }\r\n\r\n /**\r\n * Take a potentially misbehaving resolver function and make sure\r\n * onFulfilled and onRejected are only called once.\r\n *\r\n * Makes no guarantees about asynchrony.\r\n */\r\n function doResolve(fn, self) {\r\n var done = false;\r\n try {\r\n fn(\r\n function(value) {\r\n if (done) return;\r\n done = true;\r\n resolve(self, value);\r\n },\r\n function(reason) {\r\n if (done) return;\r\n done = true;\r\n reject(self, reason);\r\n }\r\n );\r\n } catch (ex) {\r\n if (done) return;\r\n done = true;\r\n reject(self, ex);\r\n }\r\n }\r\n\r\n Promise.prototype['catch'] = function(onRejected) {\r\n return this.then(null, onRejected);\r\n };\r\n\r\n Promise.prototype.then = function(onFulfilled, onRejected) {\r\n // @ts-ignore\r\n var prom = new this.constructor(noop);\r\n\r\n handle(this, new Handler(onFulfilled, onRejected, prom));\r\n return prom;\r\n };\r\n\r\n Promise.prototype['finally'] = finallyConstructor;\r\n\r\n Promise.all = function(arr) {\r\n return new Promise(function(resolve, reject) {\r\n if (!isArray(arr)) {\r\n return reject(new TypeError('Promise.all accepts an array'));\r\n }\r\n\r\n var args = Array.prototype.slice.call(arr);\r\n if (args.length === 0) return resolve([]);\r\n var remaining = args.length;\r\n\r\n function res(i, val) {\r\n try {\r\n if (val && (typeof val === 'object' || typeof val === 'function')) {\r\n var then = val.then;\r\n if (typeof then === 'function') {\r\n then.call(\r\n val,\r\n function(val) {\r\n res(i, val);\r\n },\r\n reject\r\n );\r\n return;\r\n }\r\n }\r\n args[i] = val;\r\n if (--remaining === 0) {\r\n resolve(args);\r\n }\r\n } catch (ex) {\r\n reject(ex);\r\n }\r\n }\r\n\r\n for (var i = 0; i < args.length; i++) {\r\n res(i, args[i]);\r\n }\r\n });\r\n };\r\n\r\n Promise.allSettled = allSettled;\r\n\r\n Promise.resolve = function(value) {\r\n if (value && typeof value === 'object' && value.constructor === Promise) {\r\n return value;\r\n }\r\n\r\n return new Promise(function(resolve) {\r\n resolve(value);\r\n });\r\n };\r\n\r\n Promise.reject = function(value) {\r\n return new Promise(function(resolve, reject) {\r\n reject(value);\r\n });\r\n };\r\n\r\n Promise.race = function(arr) {\r\n return new Promise(function(resolve, reject) {\r\n if (!isArray(arr)) {\r\n return reject(new TypeError('Promise.race accepts an array'));\r\n }\r\n\r\n for (var i = 0, len = arr.length; i < len; i++) {\r\n Promise.resolve(arr[i]).then(resolve, reject);\r\n }\r\n });\r\n };\r\n\r\n // Use polyfill for setImmediate for performance gains\r\n Promise._immediateFn =\r\n // @ts-ignore\r\n (typeof setImmediate === 'function' &&\r\n function(fn) {\r\n // @ts-ignore\r\n setImmediate(fn);\r\n }) ||\r\n function(fn) {\r\n setTimeoutFunc(fn, 0);\r\n };\r\n\r\n Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\r\n if (typeof console !== 'undefined' && console) {\r\n console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console\r\n }\r\n };\r\n\r\n /** @suppress {undefinedVars} */\r\n var globalNS = (function() {\r\n // the only reliable means to get the global object is\r\n // `Function('return this')()`\r\n // However, this causes CSP violations in Chrome apps.\r\n if (typeof self !== 'undefined') {\r\n return self;\r\n }\r\n if (typeof window !== 'undefined') {\r\n return window;\r\n }\r\n if (typeof global !== 'undefined') {\r\n return global;\r\n }\r\n throw new Error('unable to locate global object');\r\n })();\r\n\r\n // Expose the polyfill if Promise is undefined or set to a\r\n // non-function value. The latter can be due to a named HTMLElement\r\n // being exposed by browsers for legacy reasons.\r\n // https://github.com/taylorhakes/promise-polyfill/issues/114\r\n if (typeof globalNS['Promise'] !== 'function') {\r\n globalNS['Promise'] = Promise;\r\n } else if (!globalNS.Promise.prototype['finally']) {\r\n globalNS.Promise.prototype['finally'] = finallyConstructor;\r\n } else if (!globalNS.Promise.allSettled) {\r\n globalNS.Promise.allSettled = allSettled;\r\n }\r\n\r\n})));", "// 1. String.prototype.trim polyfill\r\nif (!\"\".trim) String.prototype.trim = function(){ return this.replace(/^[\\s]+|[\\s]+$/g, ''); };", "if( window.NodeList && !NodeList.prototype.forEach ){\r\n NodeList.prototype.forEach = Array.prototype.forEach;\r\n}", "if (!Array.prototype.findIndex) {\r\n Object.defineProperty(Array.prototype, 'findIndex', {\r\n value: function(predicate) {\r\n if (this == null)\r\n throw new TypeError('\"this\" is null or not defined');\r\n\r\n var o = Object(this), len = o.length >>> 0;\r\n\r\n if (typeof predicate !== 'function') {\r\n throw new TypeError('predicate must be a function');\r\n }\r\n\r\n var thisArg = arguments[1], k = 0;\r\n\r\n while (k < len) {\r\n var kValue = o[k];\r\n if (predicate.call(thisArg, kValue, k, o)) {\r\n return k;\r\n }\r\n k++;\r\n }\r\n\r\n return -1;\r\n },\r\n configurable: true,\r\n writable: true\r\n })\r\n}", "if (!Array.prototype.includes) {\r\n Array.prototype.includes = function(search){\r\n return !!~this.indexOf(search)\r\n }\r\n}", "// Production steps of ECMA-262, Edition 5, 15.4.4.17\r\n// Reference: http://es5.github.io/#x15.4.4.17\r\nif (!Array.prototype.some) {\r\n Array.prototype.some = function(fun, thisArg) {\r\n 'use strict';\r\n\r\n if (this == null) {\r\n throw new TypeError('Array.prototype.some called on null or undefined');\r\n }\r\n\r\n if (typeof fun !== 'function') {\r\n throw new TypeError();\r\n }\r\n\r\n var t = Object(this);\r\n var len = t.length >>> 0;\r\n\r\n for (var i = 0; i < len; i++) {\r\n if (i in t && fun.call(thisArg, t[i], i, t)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n}", " if( !String.prototype.includes ){\r\n String.prototype.includes = function(search, start) {\r\n if (typeof start !== 'number')\r\n start = 0;\r\n\r\n if (start + search.length > this.length)\r\n return false;\r\n\r\n else\r\n return this.indexOf(search, start) !== -1;\r\n };\r\n}", "// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill\r\n//\r\nif (typeof Object.assign != 'function') {\r\n // Must be writable: true, enumerable: false, configurable: true\r\n Object.defineProperty(Object, \"assign\", {\r\n value: function assign(target, varArgs) { // .length of function is 2\r\n if (target == null) { // TypeError if undefined or null\r\n throw new TypeError('Cannot convert undefined or null to object');\r\n }\r\n\r\n var to = Object(target);\r\n\r\n for (var index = 1; index < arguments.length; index++) {\r\n var nextSource = arguments[index];\r\n\r\n if (nextSource != null) { // Skip over if undefined or null\r\n for (var nextKey in nextSource) {\r\n // Avoid bugs when hasOwnProperty is shadowed\r\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\r\n to[nextKey] = nextSource[nextKey];\r\n }\r\n }\r\n }\r\n }\r\n return to;\r\n },\r\n writable: true,\r\n configurable: true\r\n });\r\n}", " // https://developer.mozilla.org/en-US/docs/Web/API/Element/closest\r\n if (!Element.prototype.matches)\r\n Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;", "if (!Element.prototype.closest) {\r\n Element.prototype.closest = function(s) {\r\n var el = this;\r\n if (!document.documentElement.contains(el)) return null;\r\n do {\r\n if (el.matches(s)) return el;\r\n el = el.parentElement || el.parentNode;\r\n } while (el !== null && el.nodeType === 1);\r\n return null;\r\n };\r\n}", "// Avoid transformation text to link ie contentEditable mode\r\n// https://stackoverflow.com/q/7556007/104380\r\ndocument.execCommand(\"AutoUrlDetect\", false, false);", "/*\r\n * classList.js: Cross-browser full element.classList implementation.\r\n * 1.2.20171210\r\n *\r\n * By Eli Grey, http://eligrey.com\r\n * License: Dedicated to the public domain.\r\n * See https://github.com/eligrey/classList.js/blob/master/LICENSE.md\r\n */\r\n\r\n/*global self, document, DOMException */\r\n\r\n/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js */\r\n\r\nif (\"document\" in self) {\r\n\r\n// Full polyfill for browsers with no classList support\r\n// Including IE < Edge missing SVGElement.classList\r\nif (\r\n\t !(\"classList\" in document.createElement(\"_\"))\r\n\t|| document.createElementNS\r\n\t&& !(\"classList\" in document.createElementNS(\"http://www.w3.org/2000/svg\",\"g\"))\r\n) {\r\n\r\n(function (view) {\r\n\r\n\"use strict\";\r\n\r\nif (!('Element' in view)) return;\r\n\r\nvar\r\n\t classListProp = \"classList\"\r\n\t, protoProp = \"prototype\"\r\n\t, elemCtrProto = view.Element[protoProp]\r\n\t, objCtr = Object\r\n\t, strTrim = String[protoProp].trim || function () {\r\n\t\treturn this.replace(/^\\s+|\\s+$/g, \"\");\r\n\t}\r\n\t, arrIndexOf = Array[protoProp].indexOf || function (item) {\r\n\t\tvar\r\n\t\t\t i = 0\r\n\t\t\t, len = this.length\r\n\t\t;\r\n\t\tfor (; i < len; i++) {\r\n\t\t\tif (i in this && this[i] === item) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t}\r\n\t// Vendors: please allow content code to instantiate DOMExceptions\r\n\t, DOMEx = function (type, message) {\r\n\t\tthis.name = type;\r\n\t\tthis.code = DOMException[type];\r\n\t\tthis.message = message;\r\n\t}\r\n\t, checkTokenAndGetIndex = function (classList, token) {\r\n\t\tif (token === \"\") {\r\n\t\t\tthrow new DOMEx(\r\n\t\t\t\t \"SYNTAX_ERR\"\r\n\t\t\t\t, \"The token must not be empty.\"\r\n\t\t\t);\r\n\t\t}\r\n\t\tif (/\\s/.test(token)) {\r\n\t\t\tthrow new DOMEx(\r\n\t\t\t\t \"INVALID_CHARACTER_ERR\"\r\n\t\t\t\t, \"The token must not contain space characters.\"\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn arrIndexOf.call(classList, token);\r\n\t}\r\n\t, ClassList = function (elem) {\r\n\t\tvar\r\n\t\t\t trimmedClasses = strTrim.call(elem.getAttribute(\"class\") || \"\")\r\n\t\t\t, classes = trimmedClasses ? trimmedClasses.split(/\\s+/) : []\r\n\t\t\t, i = 0\r\n\t\t\t, len = classes.length\r\n\t\t;\r\n\t\tfor (; i < len; i++) {\r\n\t\t\tthis.push(classes[i]);\r\n\t\t}\r\n\t\tthis._updateClassName = function () {\r\n\t\t\telem.setAttribute(\"class\", this.toString());\r\n\t\t};\r\n\t}\r\n\t, classListProto = ClassList[protoProp] = []\r\n\t, classListGetter = function () {\r\n\t\treturn new ClassList(this);\r\n\t}\r\n;\r\n// Most DOMException implementations don't allow calling DOMException's toString()\r\n// on non-DOMExceptions. Error's toString() is sufficient here.\r\nDOMEx[protoProp] = Error[protoProp];\r\nclassListProto.item = function (i) {\r\n\treturn this[i] || null;\r\n};\r\nclassListProto.contains = function (token) {\r\n\treturn ~checkTokenAndGetIndex(this, token + \"\");\r\n};\r\nclassListProto.add = function () {\r\n\tvar\r\n\t\t tokens = arguments\r\n\t\t, i = 0\r\n\t\t, l = tokens.length\r\n\t\t, token\r\n\t\t, updated = false\r\n\t;\r\n\tdo {\r\n\t\ttoken = tokens[i] + \"\";\r\n\t\tif (!~checkTokenAndGetIndex(this, token)) {\r\n\t\t\tthis.push(token);\r\n\t\t\tupdated = true;\r\n\t\t}\r\n\t}\r\n\twhile (++i < l);\r\n\r\n\tif (updated) {\r\n\t\tthis._updateClassName();\r\n\t}\r\n};\r\nclassListProto.remove = function () {\r\n\tvar\r\n\t\t tokens = arguments\r\n\t\t, i = 0\r\n\t\t, l = tokens.length\r\n\t\t, token\r\n\t\t, updated = false\r\n\t\t, index\r\n\t;\r\n\tdo {\r\n\t\ttoken = tokens[i] + \"\";\r\n\t\tindex = checkTokenAndGetIndex(this, token);\r\n\t\twhile (~index) {\r\n\t\t\tthis.splice(index, 1);\r\n\t\t\tupdated = true;\r\n\t\t\tindex = checkTokenAndGetIndex(this, token);\r\n\t\t}\r\n\t}\r\n\twhile (++i < l);\r\n\r\n\tif (updated) {\r\n\t\tthis._updateClassName();\r\n\t}\r\n};\r\nclassListProto.toggle = function (token, force) {\r\n\tvar\r\n\t\t result = this.contains(token)\r\n\t\t, method = result ?\r\n\t\t\tforce !== true && \"remove\"\r\n\t\t:\r\n\t\t\tforce !== false && \"add\"\r\n\t;\r\n\r\n\tif (method) {\r\n\t\tthis[method](token);\r\n\t}\r\n\r\n\tif (force === true || force === false) {\r\n\t\treturn force;\r\n\t} else {\r\n\t\treturn !result;\r\n\t}\r\n};\r\nclassListProto.replace = function (token, replacement_token) {\r\n\tvar index = checkTokenAndGetIndex(token + \"\");\r\n\tif (~index) {\r\n\t\tthis.splice(index, 1, replacement_token);\r\n\t\tthis._updateClassName();\r\n\t}\r\n}\r\nclassListProto.toString = function () {\r\n\treturn this.join(\" \");\r\n};\r\n\r\nif (objCtr.defineProperty) {\r\n\tvar classListPropDesc = {\r\n\t\t get: classListGetter\r\n\t\t, enumerable: true\r\n\t\t, configurable: true\r\n\t};\r\n\ttry {\r\n\t\tobjCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);\r\n\t} catch (ex) { // IE 8 doesn't support enumerable:true\r\n\t\t// adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36\r\n\t\t// modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected\r\n\t\tif (ex.number === undefined || ex.number === -0x7FF5EC54) {\r\n\t\t\tclassListPropDesc.enumerable = false;\r\n\t\t\tobjCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);\r\n\t\t}\r\n\t}\r\n} else if (objCtr[protoProp].__defineGetter__) {\r\n\telemCtrProto.__defineGetter__(classListProp, classListGetter);\r\n}\r\n\r\n}(self));\r\n\r\n}\r\n\r\n// There is full or partial native classList support, so just check if we need\r\n// to normalize the add/remove and toggle APIs.\r\n\r\n(function () {\r\n\t\"use strict\";\r\n\r\n\tvar testElement = document.createElement(\"_\");\r\n\r\n\ttestElement.classList.add(\"c1\", \"c2\");\r\n\r\n\t// Polyfill for IE 10/11 and Firefox <26, where classList.add and\r\n\t// classList.remove exist but support only one argument at a time.\r\n\tif (!testElement.classList.contains(\"c2\")) {\r\n\t\tvar createMethod = function(method) {\r\n\t\t\tvar original = DOMTokenList.prototype[method];\r\n\r\n\t\t\tDOMTokenList.prototype[method] = function(token) {\r\n\t\t\t\tvar i, len = arguments.length;\r\n\r\n\t\t\t\tfor (i = 0; i < len; i++) {\r\n\t\t\t\t\ttoken = arguments[i];\r\n\t\t\t\t\toriginal.call(this, token);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t};\r\n\t\tcreateMethod('add');\r\n\t\tcreateMethod('remove');\r\n\t}\r\n\r\n\ttestElement.classList.toggle(\"c3\", false);\r\n\r\n\t// Polyfill for IE 10 and Firefox <24, where classList.toggle does not\r\n\t// support the second argument.\r\n\tif (testElement.classList.contains(\"c3\")) {\r\n\t\tvar _toggle = DOMTokenList.prototype.toggle;\r\n\r\n\t\tDOMTokenList.prototype.toggle = function(token, force) {\r\n\t\t\tif (1 in arguments && !this.contains(token) === !force) {\r\n\t\t\t\treturn force;\r\n\t\t\t} else {\r\n\t\t\t\treturn _toggle.call(this, token);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t}\r\n\r\n\t// replace() polyfill\r\n\tif (!(\"replace\" in document.createElement(\"_\").classList)) {\r\n\t\tDOMTokenList.prototype.replace = function (token, replacement_token) {\r\n\t\t\tvar\r\n\t\t\t\t tokens = this.toString().split(\" \")\r\n\t\t\t\t, index = tokens.indexOf(token + \"\")\r\n\t\t\t;\r\n\t\t\tif (~index) {\r\n\t\t\t\ttokens = tokens.slice(index);\r\n\t\t\t\tthis.remove.apply(this, tokens);\r\n\t\t\t\tthis.add(replacement_token);\r\n\t\t\t\tthis.add.apply(this, tokens.slice(1));\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\ttestElement = null;\r\n}());\r\n\r\n}", "/*!\n * Cropper.js v1.6.2\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2024-04-21T07:43:05.335Z\n */\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.Cropper = factory());\n})(this, (function () { 'use strict';\n\n function ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n }\n function _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n }\n function _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n }\n function _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n }\n function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n }\n function _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n }\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n }\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n }\n function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n }\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n }\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n var WINDOW = IS_BROWSER ? window : {};\n var IS_TOUCH_DEVICE = IS_BROWSER && WINDOW.document.documentElement ? 'ontouchstart' in WINDOW.document.documentElement : false;\n var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false;\n var NAMESPACE = 'cropper';\n\n // Actions\n var ACTION_ALL = 'all';\n var ACTION_CROP = 'crop';\n var ACTION_MOVE = 'move';\n var ACTION_ZOOM = 'zoom';\n var ACTION_EAST = 'e';\n var ACTION_WEST = 'w';\n var ACTION_SOUTH = 's';\n var ACTION_NORTH = 'n';\n var ACTION_NORTH_EAST = 'ne';\n var ACTION_NORTH_WEST = 'nw';\n var ACTION_SOUTH_EAST = 'se';\n var ACTION_SOUTH_WEST = 'sw';\n\n // Classes\n var CLASS_CROP = \"\".concat(NAMESPACE, \"-crop\");\n var CLASS_DISABLED = \"\".concat(NAMESPACE, \"-disabled\");\n var CLASS_HIDDEN = \"\".concat(NAMESPACE, \"-hidden\");\n var CLASS_HIDE = \"\".concat(NAMESPACE, \"-hide\");\n var CLASS_INVISIBLE = \"\".concat(NAMESPACE, \"-invisible\");\n var CLASS_MODAL = \"\".concat(NAMESPACE, \"-modal\");\n var CLASS_MOVE = \"\".concat(NAMESPACE, \"-move\");\n\n // Data keys\n var DATA_ACTION = \"\".concat(NAMESPACE, \"Action\");\n var DATA_PREVIEW = \"\".concat(NAMESPACE, \"Preview\");\n\n // Drag modes\n var DRAG_MODE_CROP = 'crop';\n var DRAG_MODE_MOVE = 'move';\n var DRAG_MODE_NONE = 'none';\n\n // Events\n var EVENT_CROP = 'crop';\n var EVENT_CROP_END = 'cropend';\n var EVENT_CROP_MOVE = 'cropmove';\n var EVENT_CROP_START = 'cropstart';\n var EVENT_DBLCLICK = 'dblclick';\n var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown';\n var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove';\n var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup';\n var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START;\n var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE;\n var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END;\n var EVENT_READY = 'ready';\n var EVENT_RESIZE = 'resize';\n var EVENT_WHEEL = 'wheel';\n var EVENT_ZOOM = 'zoom';\n\n // Mime types\n var MIME_TYPE_JPEG = 'image/jpeg';\n\n // RegExps\n var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;\n var REGEXP_DATA_URL = /^data:/;\n var REGEXP_DATA_URL_JPEG = /^data:image\\/jpeg;base64,/;\n var REGEXP_TAG_NAME = /^img|canvas$/i;\n\n // Misc\n // Inspired by the default width and height of a canvas element.\n var MIN_CONTAINER_WIDTH = 200;\n var MIN_CONTAINER_HEIGHT = 100;\n\n var DEFAULTS = {\n // Define the view mode of the cropper\n viewMode: 0,\n // 0, 1, 2, 3\n\n // Define the dragging mode of the cropper\n dragMode: DRAG_MODE_CROP,\n // 'crop', 'move' or 'none'\n\n // Define the initial aspect ratio of the crop box\n initialAspectRatio: NaN,\n // Define the aspect ratio of the crop box\n aspectRatio: NaN,\n // An object with the previous cropping result data\n data: null,\n // A selector for adding extra containers to preview\n preview: '',\n // Re-render the cropper when resize the window\n responsive: true,\n // Restore the cropped area after resize the window\n restore: true,\n // Check if the current image is a cross-origin image\n checkCrossOrigin: true,\n // Check the current image's Exif Orientation information\n checkOrientation: true,\n // Show the black modal\n modal: true,\n // Show the dashed lines for guiding\n guides: true,\n // Show the center indicator for guiding\n center: true,\n // Show the white modal to highlight the crop box\n highlight: true,\n // Show the grid background\n background: true,\n // Enable to crop the image automatically when initialize\n autoCrop: true,\n // Define the percentage of automatic cropping area when initializes\n autoCropArea: 0.8,\n // Enable to move the image\n movable: true,\n // Enable to rotate the image\n rotatable: true,\n // Enable to scale the image\n scalable: true,\n // Enable to zoom the image\n zoomable: true,\n // Enable to zoom the image by dragging touch\n zoomOnTouch: true,\n // Enable to zoom the image by wheeling mouse\n zoomOnWheel: true,\n // Define zoom ratio when zoom the image by wheeling mouse\n wheelZoomRatio: 0.1,\n // Enable to move the crop box\n cropBoxMovable: true,\n // Enable to resize the crop box\n cropBoxResizable: true,\n // Toggle drag mode between \"crop\" and \"move\" when click twice on the cropper\n toggleDragModeOnDblclick: true,\n // Size limitation\n minCanvasWidth: 0,\n minCanvasHeight: 0,\n minCropBoxWidth: 0,\n minCropBoxHeight: 0,\n minContainerWidth: MIN_CONTAINER_WIDTH,\n minContainerHeight: MIN_CONTAINER_HEIGHT,\n // Shortcuts of events\n ready: null,\n cropstart: null,\n cropmove: null,\n cropend: null,\n crop: null,\n zoom: null\n };\n\n var TEMPLATE = '