diff --git a/App.js b/App.js index 492a5bdc..d06f07fe 100644 --- a/App.js +++ b/App.js @@ -1 +1 @@ -!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.Papyros=n():e.Papyros=n()}(self,(()=>(()=>{var __webpack_modules__={"./node_modules/@dodona/trace-component/dist/HeapLayout.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HeapLayout: () => (/* binding */ HeapLayout)\n/* harmony export */ });\n/* harmony import */ var _LinkedList__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LinkedList */ \"./node_modules/@dodona/trace-component/dist/LinkedList.js\");\n\n// We use a 2d layout array design\n// The goal is to put linked list structures in the same row\n// Other objects get their own row\n// a linked list is defined as a list of objects where each object has a reference to the next object in the list\n// and all objects are structurally equivalent\nclass HeapLayout {\n constructor(frame, previous) {\n if (frame.event === 'uncaught_exception') {\n return; // don't render anything\n }\n this.heap = frame.heap;\n this.seen = new Set();\n this.layout = [];\n this.nodeById = new Map();\n // start from the previous layout\n // this avoids re-rendering the entire heap on every step\n // and it leads to a more stable visualization\n if (previous) {\n // deep clone the previous layout with references intact\n previous.layout.forEach(node => {\n const arr = node.toArray();\n let prev = arr[0];\n this.insertNode(prev);\n for (let i = 1; i < arr.length; i++) {\n this.insertAfterParent(arr[i], prev);\n prev = arr[i];\n }\n });\n }\n // recurse all references from the globals and stack\n // this will add any new nodes to the layout\n frame.ordered_globals.forEach(name => {\n this.recurseSubEl(frame.globals[name]);\n });\n frame.stack_to_render.forEach(stackEl => {\n stackEl.ordered_varnames.forEach(name => {\n this.recurseSubEl(stackEl.encoded_locals[name]);\n });\n });\n // remove any nodes that are no longer referenced from the stack or globals\n this.nodeById.forEach((node, id) => {\n if (!this.seen.has(id)) {\n this.nodeById.delete(id);\n node.remove();\n }\n });\n // remove empty start nodes\n this.layout = this.layout.map(node => {\n if (node.value === undefined) {\n return node.next;\n }\n return node;\n }).filter(node => node !== null);\n }\n insertBeforeChild(childId, parentId) {\n const node = this.nodeById.get(childId).insertBefore(parentId);\n this.nodeById.set(parentId, node);\n }\n insertAfterParent(childId, parentId) {\n const node = this.nodeById.get(parentId).insertAfter(childId);\n this.nodeById.set(childId, node);\n }\n insertNode(id) {\n const node = new _LinkedList__WEBPACK_IMPORTED_MODULE_0__.LinkedListNode(id);\n this.layout.push(node);\n this.nodeById.set(id, node);\n }\n recurseSubEl(childEl, parentId = undefined) {\n if (isReference(childEl)) {\n const childId = childEl[1];\n const child = this.heap[childId];\n if (parentId && isStructurallyEquivalent(child, this.heap[parentId])) {\n // we have detected a linked list like structure\n // we want to put all the elements in the same row\n // if the parent is in the layout, and child isn't, insert the child after the parent\n if (!this.nodeById.has(childId) && this.nodeById.has(parentId)) {\n this.insertAfterParent(childId, parentId);\n }\n this.recurseHeapEl(childId);\n // we know that the child is in the layout now\n // if the parent isn't in the layout, insert the parent before the child\n if (!this.nodeById.has(parentId) && this.nodeById.has(childId)) {\n this.insertBeforeChild(childId, parentId);\n }\n }\n else if (!shouldNest(child) || !parentId) {\n this.recurseHeapEl(childId);\n }\n }\n }\n recurseHeapEl(id) {\n if (this.seen.has(id)) {\n return; // already recursed\n }\n this.seen.add(id);\n const heapEl = this.heap[id];\n if (heapEl[0] == 'LIST' || heapEl[0] == 'TUPLE' || heapEl[0] == 'SET') {\n heapEl.slice(1).forEach(el => this.recurseSubEl(el, id));\n }\n else if (heapEl[0] == 'DICT') {\n heapEl.slice(1).forEach(el => {\n const key = el[0];\n const val = el[1];\n if (isReference(key)) {\n const childId = key[1];\n if (!shouldNest(this.heap[childId])) {\n this.recurseHeapEl(childId);\n }\n }\n this.recurseSubEl(val, id);\n });\n }\n else if (heapEl[0] == 'INSTANCE' || heapEl[0] == 'INSTANCE_PPRINT' || heapEl[0] == 'CLASS') {\n const headerLength = heapEl[0] == 'INSTANCE' ? 2 : 3;\n heapEl.slice(headerLength).forEach(el => this.recurseSubEl(el[1], id));\n }\n else if (heapEl[0] == 'FUNCTION' && heapEl.length == 4) {\n heapEl[3].forEach(el => this.recurseSubEl(el[1], id));\n }\n if (!this.nodeById.has(id)) {\n this.insertNode(id);\n }\n }\n}\n// always nest values of these types within objects to make the\n// visualization look cleaner:\n// - functions should be nested within heap objects since that's a more\n// intuitive rendering for methods (i.e., functions within objects)\n// - lots of special cases for function/property-like python types that we should inline\nconst NESTED_TYPES = new Set(['FUNCTION',\n 'property', 'classmethod', 'staticmethod', 'builtin_function_or_method',\n 'member_descriptor', 'getset_descriptor', 'method_descriptor', 'wrapper_descriptor']);\nfunction shouldNest(heapEl) {\n if (NESTED_TYPES.has(heapEl[0])) {\n return true;\n }\n else if (heapEl[0] === 'INSTANCE' || heapEl[0] === 'INSTANCE_PPRINT') {\n // Specific instances that we want to nest\n return NESTED_TYPES.has(heapEl[1]);\n }\n return false;\n}\n// Returns true for: lists and tuples of the same length\n// Dicts, instances, and instance_pprints with the same fields\nfunction isStructurallyEquivalent(a, b) {\n if (a[0] !== b[0]) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n if (a[0] === \"LIST\" || a[0] === \"TUPLE\") {\n return true;\n }\n let startingInd = -1;\n if (a[0] == 'DICT') {\n startingInd = 1;\n }\n else if (a[0] == 'INSTANCE') {\n startingInd = 2;\n }\n else if (a[0] == 'INSTANCE_PPRINT') {\n startingInd = 3;\n }\n else {\n return false; // we don't care about all other types\n }\n // build a set of all the fields in a\n const fields = new Set();\n for (let i = startingInd; i < a.length; i++) {\n fields.add(JSON.stringify(a[i][0]));\n }\n // check that all fields in b are in a\n for (let i = startingInd; i < b.length; i++) {\n if (!fields.has(JSON.stringify(b[i][0]))) {\n return false;\n }\n }\n return true;\n}\nfunction isReference(el) {\n return el instanceof Array && el[0] === \"REF\";\n}\n//# sourceMappingURL=HeapLayout.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/HeapLayout.js?")},"./node_modules/@dodona/trace-component/dist/LinkedList.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LinkedListNode: () => (/* binding */ LinkedListNode)\n/* harmony export */ });\nclass LinkedListNode {\n constructor(value) {\n this.value = value;\n this.prev = null;\n this.next = null;\n }\n insertAfter(value) {\n const node = new LinkedListNode(value);\n node.prev = this;\n node.next = this.next;\n if (this.next) {\n this.next.prev = node;\n }\n this.next = node;\n return node;\n }\n insertBefore(value) {\n const node = new LinkedListNode(value);\n node.prev = this.prev;\n node.next = this;\n if (this.prev) {\n this.prev.next = node;\n }\n this.prev = node;\n return node;\n }\n remove() {\n if (this.prev) {\n this.prev.next = this.next;\n }\n if (this.next) {\n this.next.prev = this.prev;\n }\n this.value = undefined;\n }\n get start() {\n let node = this;\n while (node.prev) {\n node = node.prev;\n }\n return node;\n }\n toArray() {\n const result = [];\n let node = this.start;\n while (node) {\n result.push(node.value);\n node = node.next;\n }\n return result;\n }\n}\n//# sourceMappingURL=LinkedList.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/LinkedList.js?")},"./node_modules/@dodona/trace-component/dist/components/AttributeMap.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AttributeMap: () => (/* binding */ AttributeMap)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _SubElementComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SubElementComponent */ "./node_modules/@dodona/trace-component/dist/components/SubElementComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\nlet AttributeMap = class AttributeMap extends lit__WEBPACK_IMPORTED_MODULE_0__.LitElement {\n render() {\n return this.attributeEls.map(([key, value]) => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n ${key}\n \n \n \n \n `);\n }\n};\nAttributeMap.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.keyValueTable, (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n :host {\n display: contents;\n }\n `];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], AttributeMap.prototype, "attributeEls", void 0);\nAttributeMap = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-attribute-map\')\n], AttributeMap);\n\n//# sourceMappingURL=AttributeMap.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/AttributeMap.js?')},"./node_modules/@dodona/trace-component/dist/components/ExceptionCard.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ExceptionFrameComponent: () => (/* binding */ ExceptionFrameComponent)\n/* harmony export */ });\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\nlet ExceptionFrameComponent = class ExceptionFrameComponent extends lit__WEBPACK_IMPORTED_MODULE_1__.LitElement {\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_1__.html) `\n

\n \n

\n

\n \n

\n `;\n }\n};\nExceptionFrameComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_2__.defaults, (0,lit__WEBPACK_IMPORTED_MODULE_1__.css) `\n :host {\n display: block;\n padding: 20px;\n border-radius: 10px;\n background-color: ${_style__WEBPACK_IMPORTED_MODULE_2__.secondarySurfaceContainerColor};\n color: ${_style__WEBPACK_IMPORTED_MODULE_2__.secondaryOnSurfaceColor};\n font-size: 14px;\n width: 400px;\n }\n\n h3{\n margin-top: 0;\n }\n \n `];\nExceptionFrameComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.customElement)(\'tc-exception-card\')\n], ExceptionFrameComponent);\n\n//# sourceMappingURL=ExceptionCard.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/ExceptionCard.js?')},"./node_modules/@dodona/trace-component/dist/components/FrameComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FrameComponent: () => (/* binding */ FrameComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _StackComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./StackComponent */ "./node_modules/@dodona/trace-component/dist/components/StackComponent.js");\n/* harmony import */ var _HeapComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./HeapComponent */ "./node_modules/@dodona/trace-component/dist/components/HeapComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var lit_directives_ref_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lit/directives/ref.js */ "./node_modules/lit/directives/ref.js");\n/* harmony import */ var _jsplumb_browser_ui__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @jsplumb/browser-ui */ "./node_modules/@jsplumb/browser-ui/js/jsplumb.browser-ui.es.js");\n/* harmony import */ var _mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../mixins/DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\n\n\n\nlet FrameComponent = class FrameComponent extends (0,_mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_7__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n update(changedProperties) {\n super.update(changedProperties);\n if (changedProperties.has("frame")) {\n this.heap.clearMargins();\n }\n }\n get jsplumb() {\n if (this.jsplumbInstance === undefined && this.canvas !== undefined) {\n this.jsplumbInstance = (0,_jsplumb_browser_ui__WEBPACK_IMPORTED_MODULE_6__.newInstance)({\n container: this.canvas,\n });\n }\n return this.jsplumbInstance;\n }\n async addConnection(from, to, highlight = true) {\n const removeConnection = (e) => {\n this.removeConnection(e.detail.from, e.detail.to);\n e.detail.from.removeEventListener("remove-reference", removeConnection);\n };\n from.addEventListener("remove-reference", removeConnection);\n await this.updateComplete;\n const target = this.heap.endpointMap[to];\n if (target === undefined) {\n // the target is not rendered on the heap, so it should be rendered inlined in the reference\n (0,lit__WEBPACK_IMPORTED_MODULE_0__.render)((0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``, from);\n return;\n }\n else {\n this.heap.addReference(to);\n }\n this.jsplumb.connect({\n source: from,\n target: this.heap.endpointMap[to],\n anchors: ["Center", "Left"],\n endpoints: [{ type: "Dot", options: { radius: 3, cssClass: highlight ? "highlight" : "" } }, "Blank"],\n overlays: [{ type: "Arrow", options: { location: 1, width: 10, length: 10 } }],\n connector: { type: _jsplumb_browser_ui__WEBPACK_IMPORTED_MODULE_6__.BezierConnector.type, options: { curviness: 50 } },\n cssClass: highlight ? "highlight" : "",\n });\n }\n removeConnection(from, to) {\n this.jsplumb.select({ source: from }).deleteAll();\n this.heap.removeReference(to);\n }\n updated(_changedProperties) {\n super.updated(_changedProperties);\n this.scheduleRedraw();\n }\n async scheduleRedraw() {\n await this.deepUpdateComplete;\n this.jsplumb.setSuspendDrawing(false, true);\n this.jsplumb.repaintEverything();\n }\n get updateComplete() {\n return Promise.all([this.heap.updateComplete, this.stack.updateComplete])\n .then(() => super.updateComplete);\n }\n render() {\n this.jsplumb?.setSuspendDrawing(true);\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n ${this.frame.event == "exception" ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n ${this.frame.exception_msg}\n \n ` : (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``}\n
this.canvas = e)}>\n this.stack = e)}\n @add-reference="${(e) => this.addConnection(e.detail.from, e.detail.to, e.detail.highlight)}"\n >\n this.heap = e)}\n @add-reference="${(e) => this.addConnection(e.detail.from, e.detail.to)}"\n @deep-update="${() => this.scheduleRedraw()}"\n >\n
\n `;\n }\n};\nFrameComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_4__.defaults, (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n .canvas {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: row;\n }\n tc-stack {\n margin-right: 64px;\n }\n \n svg path {\n stroke: ${_style__WEBPACK_IMPORTED_MODULE_4__.outlineVariantColor};\n stroke-width: 1px;\n }\n \n .jtk-overlay {\n fill: ${_style__WEBPACK_IMPORTED_MODULE_4__.outlineVariantColor};\n stroke-width: 1px;\n }\n \n svg circle {\n fill: ${_style__WEBPACK_IMPORTED_MODULE_4__.outlineVariantColor};\n stroke-width: 59;\n stroke-linecap: round;\n }\n \n svg.highlight path {\n stroke: ${_style__WEBPACK_IMPORTED_MODULE_4__.outlineColor};\n }\n \n svg.highlight circle {\n fill: ${_style__WEBPACK_IMPORTED_MODULE_4__.outlineColor};\n }\n \n .highlight .jtk-overlay {\n fill: ${_style__WEBPACK_IMPORTED_MODULE_4__.outlineColor};\n } \n \n tc-exception-card {\n margin-bottom: 20px;\n }\n `];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Object })\n], FrameComponent.prototype, "frame", void 0);\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Object })\n], FrameComponent.prototype, "layout", void 0);\nFrameComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-frame\')\n], FrameComponent);\n\n//# sourceMappingURL=FrameComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/FrameComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/FramePicker.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FramePickerComponent: () => (/* binding */ FramePickerComponent)\n/* harmony export */ });\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\nlet FramePickerComponent = class FramePickerComponent extends lit__WEBPACK_IMPORTED_MODULE_1__.LitElement {\n constructor() {\n super(...arguments);\n this.current = 0;\n }\n static get styles() {\n return [_style__WEBPACK_IMPORTED_MODULE_2__.defaults,\n (0,lit__WEBPACK_IMPORTED_MODULE_1__.css) `\n :host {\n width: 400px;\n display: block;\n }\n\n input {\n --c: ${_style__WEBPACK_IMPORTED_MODULE_2__.primaryColor}; /* active color */\n --g: 1px; /* the gap */\n --l: 4px; /* line thickness*/\n --s: 20px; /* thumb size*/\n\n width: 400px;\n height: var(--s); /* needed for Firefox*/\n --_c: color-mix(in srgb, var(--c), #000 var(--p,0%));\n -webkit-appearance :none;\n -moz-appearance :none;\n appearance :none;\n background: none;\n cursor: pointer;\n overflow: hidden;\n }\n input:focus-visible,\n input:hover{\n --p: 15%;\n }\n input:active,\n input:focus-visible{\n --_b: var(--s)\n }\n /* chromium */\n input[type="range" i]::-webkit-slider-thumb{\n height: var(--s);\n aspect-ratio: 1;\n border-radius: 50%;\n box-shadow: 0 0 0 var(--s) inset var(--_c);\n border-image: linear-gradient(90deg,var(--_c) 50%, ${_style__WEBPACK_IMPORTED_MODULE_2__.outlineVariantColor} 0) 1/0 100vw/0 calc(100vw + var(--g));\n clip-path:\n polygon(\n 0 calc(50% + var(--l)/2),\n -100vw calc(50% + var(--l)/2),\n -100vw calc(50% - var(--l)/2),\n 0 calc(50% - var(--l)/2),\n 0 0,100% 0,\n 100% calc(50% - var(--l)/2),\n 100vw calc(50% - var(--l)/2),\n 100vw calc(50% + var(--l)/2),\n 100% calc(50% + var(--l)/2),\n 100% 100%,0 100%);\n -webkit-appearance: none;\n appearance: none;\n }\n /* Firefox */\n input[type="range"]::-moz-range-thumb {\n height: var(--s);\n width: var(--s);\n background: none;\n border-radius: 50%;\n box-shadow: 0 0 0 var(--s) inset var(--_c);\n border-image: linear-gradient(90deg,var(--_c) 50%, ${_style__WEBPACK_IMPORTED_MODULE_2__.outlineVariantColor} 0) 1/0 100vw/0 calc(100vw + var(--g));\n clip-path:\n polygon(\n 0 calc(50% + var(--l)/2),\n -100vw calc(50% + var(--l)/2),\n -100vw calc(50% - var(--l)/2),\n 0 calc(50% - var(--l)/2),\n 0 0,100% 0,\n 100% calc(50% - var(--l)/2),\n 100vw calc(50% - var(--l)/2),\n 100vw calc(50% + var(--l)/2),\n 100% calc(50% + var(--l)/2),\n 100% 100%,0 100%);\n -moz-appearance: none;\n appearance: none;\n }\n \n .btn-group {\n position: relative;\n display: flex;\n vertical-align: middle;\n border-radius: 20px;\n background-color: ${_style__WEBPACK_IMPORTED_MODULE_2__.primaryColor};\n margin: 0 auto 12px auto;\n width: fit-content;\n }\n \n button {\n padding: 6px 12px;\n border: 1px solid ${_style__WEBPACK_IMPORTED_MODULE_2__.outlineVariantColor};\n border-right: 0;\n position: relative;\n flex: 1 1 auto;\n color: ${_style__WEBPACK_IMPORTED_MODULE_2__.primaryColor};\n cursor: pointer;\n background-color: ${_style__WEBPACK_IMPORTED_MODULE_2__.surfaceColor};\n }\n \n button:hover, button:active {\n opacity: 0.9;\n }\n \n button:disabled {\n opacity: 1;\n cursor: initial;\n color: ${_style__WEBPACK_IMPORTED_MODULE_2__.onSurfaceColor};\n }\n\n .btn-group > button:last-of-type {\n border-right: 1px solid ${_style__WEBPACK_IMPORTED_MODULE_2__.outlineVariantColor};\n border-top-right-radius: 20px;\n border-bottom-right-radius: 20px;\n }\n \n .btn-group > button:first-of-type {\n border-top-left-radius: 20px;\n border-bottom-left-radius: 20px;\n }\n `\n ];\n }\n updated(changedProperties) {\n if (changedProperties.has("value")) {\n this.current = this.value;\n }\n }\n get displayedCurrent() {\n return this.current + 1;\n }\n get max() {\n return this.length - 1;\n }\n handleFrameChange(frame) {\n this.current = frame;\n this.dispatchEvent(new CustomEvent("frame-change", {\n detail: {\n frame: frame\n },\n bubbles: true,\n composed: true\n }));\n }\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_1__.html) `\n \n
\n \n \n \n \n \n
\n `;\n }\n};\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.property)({ type: Number })\n], FramePickerComponent.prototype, "length", void 0);\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.property)({ type: Number })\n], FramePickerComponent.prototype, "value", void 0);\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.property)({ type: Number, state: true })\n], FramePickerComponent.prototype, "current", void 0);\nFramePickerComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.customElement)(\'tc-frame-picker\')\n], FramePickerComponent);\n\n//# sourceMappingURL=FramePicker.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/FramePicker.js?')},"./node_modules/@dodona/trace-component/dist/components/HeapComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HeapComponent: () => (/* binding */ HeapComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var lit_directives_ref_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lit/directives/ref.js */ "./node_modules/lit/directives/ref.js");\n/* harmony import */ var _HeapElementComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./HeapElementComponent */ "./node_modules/@dodona/trace-component/dist/components/HeapElementComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _ReferenceComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ReferenceComponent */ "./node_modules/@dodona/trace-component/dist/components/ReferenceComponent.js");\n/* harmony import */ var _mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../mixins/DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\n\n\nlet HeapComponent = class HeapComponent extends (0,_mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_6__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n constructor() {\n super(...arguments);\n this.leftMargins = new Map();\n this.leftMarginUpdates = new Map();\n this.heapConnections = new Map();\n this.handledByRecursion = new Map();\n this.endpointMap = {};\n this.referenceCount = new Map();\n }\n /**\n * Apply all margin updates to the heap elements\n * this recalculates the left margin for each element based on the connections between them\n */\n applyMarginUpdates() {\n this.heapConnections.forEach((values, key) => {\n values.forEach(value => {\n const source = this.endpointMap[key];\n const dest = this.endpointMap[value];\n if (source && dest) {\n this.fixArrowDirection(source, value);\n }\n });\n });\n this.leftMargins.clear();\n for (const [key, value] of this.leftMarginUpdates.entries()) {\n this.leftMargins.set(key, value);\n }\n // this.handledByRecursion.clear();\n }\n /**\n * Reset all margin updates when a new frame is loaded\n */\n clearMargins() {\n this.leftMargins.clear();\n this.leftMarginUpdates.clear();\n this.heapConnections.clear();\n this.handledByRecursion.clear();\n }\n /**\n * Move heap elements to the right if they are to the left of the source element\n */\n fixArrowDirection(from, destId, prev = []) {\n const dest = this.endpointMap[destId];\n if (dest === undefined) {\n return;\n }\n // calculate the difference in position between the source and destination\n const sourceOffset = from.getBoundingClientRect().left + from.getBoundingClientRect().width;\n const destOffset = dest.getBoundingClientRect().left;\n let diff = sourceOffset - destOffset;\n // add current margin to the diff\n const destMargin = this.leftMargins.get(destId) || 0;\n let newMargin = destMargin + diff;\n // if the reference el was within a heap element, use that as the source\n // we need this because heap elements margin might have changed in this update cycle\n const source = from instanceof _ReferenceComponent__WEBPACK_IMPORTED_MODULE_5__.ReferenceComponent ? from.closest("tc-heap-element") : from;\n const sourceId = source ? parseInt(source.getAttribute("key") || "") : undefined;\n // // If the source location has already been updated, include that change in the diff\n if (sourceId && this.leftMarginUpdates.has(sourceId)) {\n const sourceMargin = this.leftMargins.get(sourceId) || 0;\n const sourceUpdate = this.leftMarginUpdates.get(sourceId) || 0;\n const sourceChange = sourceUpdate - sourceMargin;\n newMargin += sourceChange;\n }\n // if this element has been updated already, use the rightmost update\n const currentUpdate = this.leftMarginUpdates.get(destId) || 0;\n const newUpdate = Math.max(currentUpdate, newMargin);\n this.leftMarginUpdates.set(destId, Math.max(newUpdate, 0));\n // if the destination has any connections, update them too\n if (this.heapConnections.has(destId)) {\n // to prevent infinite loops, we keep track of which elements have been handled in previous calls\n const previous = [...prev, destId];\n this.heapConnections.get(destId)\n // only update elements that have not been handled by recursion\n .filter(id => !this.handledByRecursion.has(id) || !previous.some(x => this.handledByRecursion.get(id)?.has(x)))\n .forEach(id => {\n // keep track of which elements have been handled by recursion\n previous.forEach(r => {\n if (!this.handledByRecursion.has(r)) {\n this.handledByRecursion.set(r, new Set());\n }\n this.handledByRecursion.get(r).add(id);\n });\n this.fixArrowDirection(dest, id, previous);\n });\n }\n // margin updates require a re-render\n this.requestUpdate();\n }\n addEndpoint(id, ref) {\n // Avoid writing to the map if the reference is undefined\n // This can happen if two calls happen in quick succession\n if (ref === undefined) {\n return;\n }\n this.endpointMap[id] = ref;\n }\n get updateComplete() {\n return Promise.all(Object.values(this.endpointMap)\n .map(el => el.updateComplete))\n .then(() => super.updateComplete);\n }\n addConnection(from, to, ref) {\n const existing = this.heapConnections.get(from) || [];\n this.heapConnections.set(from, [...existing, to]);\n const removeConnection = (e) => {\n this.removeConnection(from, e.detail.to);\n e.detail.from.removeEventListener("remove-reference", removeConnection);\n };\n ref.addEventListener("remove-reference", removeConnection);\n }\n removeConnection(from, to) {\n const existing = this.heapConnections.get(from) || [];\n this.heapConnections.set(from, existing.filter(x => x !== to));\n }\n addReference(id) {\n const count = this.referenceCount.get(id) || 0;\n this.referenceCount.set(id, count + 1);\n if (count === 0) {\n this.scheduleRedraw();\n }\n }\n removeReference(id) {\n const count = this.referenceCount.get(id) || 0;\n this.referenceCount.set(id, Math.max(0, count - 1));\n if (count === 1) {\n this.scheduleRedraw();\n }\n }\n /**\n * Schedule a redraw of the heap elements\n * This is necessary because the margin updates require a re-render\n */\n async scheduleRedraw() {\n await this.deepUpdateComplete;\n this.requestUpdate();\n }\n render() {\n this.applyMarginUpdates();\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n ${this.layout.layout.map(node => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n
\n ${node.toArray().map(key => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n this.addEndpoint(key, r))}\n @add-reference="${(e) => this.addConnection(key, e.detail.to, e.detail.from)}"\n @deep-update="${() => this.scheduleRedraw()}"\n \n `)}\n
\n `)}\n `;\n }\n};\nHeapComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_4__.defaults, (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n .row {\n display: flex;\n flex-direction: row;\n min-height: 0;\n }\n \n tc-heap-element {\n margin: 0.5rem 1rem;\n }\n \n tc-heap-element.hidden {\n opacity: 0;\n width: 0;\n height: 0;\n margin: 0;\n }\n `];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Object })\n], HeapComponent.prototype, "layout", void 0);\nHeapComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-heap\')\n], HeapComponent);\n\n//# sourceMappingURL=HeapComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/HeapComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/HeapElementComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HeapElementComponent: () => (/* binding */ HeapElementComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _heapElements_ListComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./heapElements/ListComponent */ "./node_modules/@dodona/trace-component/dist/components/heapElements/ListComponent.js");\n/* harmony import */ var _heapElements_TupleComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./heapElements/TupleComponent */ "./node_modules/@dodona/trace-component/dist/components/heapElements/TupleComponent.js");\n/* harmony import */ var _heapElements_SetComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./heapElements/SetComponent */ "./node_modules/@dodona/trace-component/dist/components/heapElements/SetComponent.js");\n/* harmony import */ var _heapElements_DictComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./heapElements/DictComponent */ "./node_modules/@dodona/trace-component/dist/components/heapElements/DictComponent.js");\n/* harmony import */ var _heapElements_InstanceComponent__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./heapElements/InstanceComponent */ "./node_modules/@dodona/trace-component/dist/components/heapElements/InstanceComponent.js");\n/* harmony import */ var _heapElements_ClassComponent__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./heapElements/ClassComponent */ "./node_modules/@dodona/trace-component/dist/components/heapElements/ClassComponent.js");\n/* harmony import */ var _heapElements_FunctionComponent__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./heapElements/FunctionComponent */ "./node_modules/@dodona/trace-component/dist/components/heapElements/FunctionComponent.js");\n/* harmony import */ var _heapElements_HeapPrimitiveComponent__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./heapElements/HeapPrimitiveComponent */ "./node_modules/@dodona/trace-component/dist/components/heapElements/HeapPrimitiveComponent.js");\n/* harmony import */ var _heapElements_OtherComponent__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./heapElements/OtherComponent */ "./node_modules/@dodona/trace-component/dist/components/heapElements/OtherComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../mixins/DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\n\n\n\n\n\n\n\n\nlet HeapElementComponent = class HeapElementComponent extends (0,_mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_12__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n render() {\n if (this.el === undefined)\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n switch (this.el[0]) {\n case "LIST":\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n case "TUPLE":\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n case "SET":\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n case "DICT":\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n case "INSTANCE":\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n case "INSTANCE_PPRINT":\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n case "CLASS":\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n case "FUNCTION":\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n case "HEAP_PRIMITIVE":\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n default:\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n }\n }\n};\nHeapElementComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_11__.defaults];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], HeapElementComponent.prototype, "el", void 0);\nHeapElementComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-heap-element\')\n], HeapElementComponent);\n\n//# sourceMappingURL=HeapElementComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/HeapElementComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/HelpCard.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HelpCard: () => (/* binding */ HelpCard),\n/* harmony export */ helpCardTranslations: () => (/* binding */ helpCardTranslations)\n/* harmony export */ });\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var lit_directives_unsafe_html_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lit/directives/unsafe-html.js */ "./node_modules/lit/directives/unsafe-html.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\nconst helpCardTranslations = {\n "title": "Drag the slider to walk through your code.",\n "text_1": "This window shows how your program works step by step. Explore to see how your program builds and stores information.",\n "text_2": "You can also use the %{previous} and %{next} buttons to go to the previous or next step. The %{first} and %{last} buttons can be used to directly jump to the first or last step respectively."\n};\nfunction fillTemplate(template, params) {\n for (let param in params) {\n template = template.replace(`%{${param}}`, params[param]);\n }\n return template;\n}\nlet HelpCard = class HelpCard extends lit__WEBPACK_IMPORTED_MODULE_1__.LitElement {\n constructor() {\n super(...arguments);\n this.translations = helpCardTranslations;\n }\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_1__.html) `\n

\n \n ${this.translations.title}\n

\n

\n ${this.translations.text_1}\n

\n

\n ${(0,lit_directives_unsafe_html_js__WEBPACK_IMPORTED_MODULE_3__.unsafeHTML)(fillTemplate(this.translations.text_2, {\n next: "\\>",\n previous: "\\<",\n last: ">>",\n first: "<\\<"\n }))}\n

\n `;\n }\n};\nHelpCard.styles = [_style__WEBPACK_IMPORTED_MODULE_2__.defaults, (0,lit__WEBPACK_IMPORTED_MODULE_1__.css) `\n :host {\n width: 360px;\n border-radius: 10px;\n padding: 20px;\n display: block;\n background-color: ${_style__WEBPACK_IMPORTED_MODULE_2__.surfaceContainerColor};\n font-size: 14px;\n }\n \n .button {\n display: inline-block;\n width: 25px;\n text-align: center;\n color: ${_style__WEBPACK_IMPORTED_MODULE_2__.primaryColor};\n font-size: 16px;\n }\n h3{\n display: flex;\n align-items: center;\n margin-top: 0;\n }\n \n svg {\n margin-right: 10px;\n fill: ${_style__WEBPACK_IMPORTED_MODULE_2__.onSurfaceColor};\n }\n `];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.property)({ type: Object })\n], HelpCard.prototype, "translations", void 0);\nHelpCard = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.customElement)(\'tc-help-card\')\n], HelpCard);\n\n//# sourceMappingURL=HelpCard.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/HelpCard.js?')},"./node_modules/@dodona/trace-component/dist/components/ImportedFauxPrimitive.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ImportedFauxPrimitive: () => (/* binding */ ImportedFauxPrimitive)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\nlet ImportedFauxPrimitive = class ImportedFauxPrimitive extends lit__WEBPACK_IMPORTED_MODULE_0__.LitElement {\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n
${this.el[2]}
\n `;\n }\n};\nImportedFauxPrimitive.styles = [_style__WEBPACK_IMPORTED_MODULE_2__.defaults, _style__WEBPACK_IMPORTED_MODULE_2__.heapDefaults];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], ImportedFauxPrimitive.prototype, "el", void 0);\nImportedFauxPrimitive = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-imported-faux-primitive\')\n], ImportedFauxPrimitive);\n\n//# sourceMappingURL=ImportedFauxPrimitive.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/ImportedFauxPrimitive.js?')},"./node_modules/@dodona/trace-component/dist/components/PrimitiveComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PrimitiveComponent: () => (/* binding */ PrimitiveComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _ImportedFauxPrimitive__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ImportedFauxPrimitive */ "./node_modules/@dodona/trace-component/dist/components/ImportedFauxPrimitive.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n/**\n * Todo: Different styling for different types of primitives\n */\nlet PrimitiveComponent = class PrimitiveComponent extends lit__WEBPACK_IMPORTED_MODULE_0__.LitElement {\n render() {\n if (typeof this.el === "string") {\n return `"${this.el}"`;\n }\n else if (typeof this.el === "number") {\n return this.el.toString();\n }\n else if (typeof this.el === "boolean") {\n return this.el.toString();\n }\n else if (this.el === null || this.el === undefined) {\n return "None";\n }\n else if (this.el[0] === "SPECIAL_FLOAT") {\n return this.el[1];\n }\n else if (this.el[0] === "IMPORTED_FAUX_PRIMITIVE") {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n }\n else {\n // Should never happen\n return "?";\n }\n }\n};\nPrimitiveComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_2__.defaults, (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n :host {\n font-family: ${_style__WEBPACK_IMPORTED_MODULE_2__.monospace};\n }\n `];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)()\n], PrimitiveComponent.prototype, "el", void 0);\nPrimitiveComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-primitive\')\n], PrimitiveComponent);\n\n//# sourceMappingURL=PrimitiveComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/PrimitiveComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/ReferenceComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ReferenceComponent: () => (/* binding */ ReferenceComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\nlet ReferenceComponent = class ReferenceComponent extends lit__WEBPACK_IMPORTED_MODULE_0__.LitElement {\n update(changedProperties) {\n if (changedProperties.has("el")) {\n const oldVal = changedProperties.get("el");\n if (oldVal !== undefined) {\n this.notifyHeap(oldVal[1], "remove");\n }\n this.notifyHeap(this.el[1], "add");\n }\n super.update(changedProperties);\n }\n notifyHeap(target, type) {\n this.dispatchEvent(new CustomEvent(`${type}-reference`, {\n detail: {\n from: this,\n to: target\n },\n bubbles: true,\n composed: true\n }));\n }\n disconnectedCallback() {\n this.notifyHeap(this.el[1], "remove");\n }\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n }\n};\nReferenceComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_2__.defaults, (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n :host {\n display: block;\n width: 100%;\n height: 100%;\n min-width: 12px;\n min-height: 14px;\n }\n `];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], ReferenceComponent.prototype, "el", void 0);\nReferenceComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-reference\')\n], ReferenceComponent);\n\n//# sourceMappingURL=ReferenceComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/ReferenceComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/StackComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ StackComponent: () => (/* binding */ StackComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _StackElementComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./StackElementComponent */ "./node_modules/@dodona/trace-component/dist/components/StackElementComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\nlet StackComponent = class StackComponent extends lit__WEBPACK_IMPORTED_MODULE_0__.LitElement {\n get highlightGlobals() {\n return this.frame.stack_to_render.every(stackElement => !stackElement.is_highlighted);\n }\n get updateComplete() {\n return Promise.all(Array.from(this.shadowRoot.querySelectorAll(`tc-stack-element`))\n .map(el => el.updateComplete)).then(() => super.updateComplete);\n }\n addHighlightInfoToEvent(event, highlight) {\n event.detail.highlight = highlight;\n }\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n this.addHighlightInfoToEvent(event, this.highlightGlobals)}\n >\n ${this.frame.stack_to_render.map(stackElement => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n this.addHighlightInfoToEvent(event, stackElement.is_highlighted)}\n >\n `)}\n `;\n }\n};\nStackComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n .highlight {\n background-color: ${_style__WEBPACK_IMPORTED_MODULE_3__.surfaceContainerColor};\n --tc-surface-color: ${_style__WEBPACK_IMPORTED_MODULE_3__.surfaceContainerColor};\n }\n \n .mute {\n opacity: 0.5;\n }\n `];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Object })\n], StackComponent.prototype, "frame", void 0);\nStackComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-stack\')\n], StackComponent);\n\n//# sourceMappingURL=StackComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/StackComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/StackElementComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ StackElementComponent: () => (/* binding */ StackElementComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _SubElementComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SubElementComponent */ "./node_modules/@dodona/trace-component/dist/components/SubElementComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\nlet StackElementComponent = class StackElementComponent extends lit__WEBPACK_IMPORTED_MODULE_0__.LitElement {\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n ${this.ordered_locals.map((varname) => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n \n \n `)}\n
\n ${varname}\n \n \n
\n `;\n }\n};\nStackElementComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n :host {\n display: block;\n padding: 8px;\n margin-bottom: 16px;\n background-color: ${_style__WEBPACK_IMPORTED_MODULE_3__.surfaceColor};\n border-radius: 5px;\n }\n table {\n margin-left: auto;\n }\n .key {\n text-align: right;\n }\n .value {\n border-left: 1px solid ${_style__WEBPACK_IMPORTED_MODULE_3__.outlineVariantColor};\n border-bottom: 1px solid ${_style__WEBPACK_IMPORTED_MODULE_3__.outlineVariantColor};\n }\n label {\n font-size: 14px;\n margin-bottom: 4px;\n }\n `];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], StackElementComponent.prototype, "ordered_locals", void 0);\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Object })\n], StackElementComponent.prototype, "locals", void 0);\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: String })\n], StackElementComponent.prototype, "label", void 0);\nStackElementComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-stack-element\')\n], StackElementComponent);\n\n//# sourceMappingURL=StackElementComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/StackElementComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/SubElementComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SubElementComponent: () => (/* binding */ SubElementComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _PrimitiveComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PrimitiveComponent */ "./node_modules/@dodona/trace-component/dist/components/PrimitiveComponent.js");\n/* harmony import */ var _ReferenceComponent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ReferenceComponent */ "./node_modules/@dodona/trace-component/dist/components/ReferenceComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../style */ "./node_modules/@dodona/trace-component/dist/style.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\nlet SubElementComponent = class SubElementComponent extends lit__WEBPACK_IMPORTED_MODULE_0__.LitElement {\n render() {\n if (this.el instanceof Array && this.el[0] === "REF") {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n }\n else {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``;\n }\n }\n};\nSubElementComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_4__.defaults];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], SubElementComponent.prototype, "el", void 0);\nSubElementComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-sub-element\')\n], SubElementComponent);\n\n//# sourceMappingURL=SubElementComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/SubElementComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/TraceComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TraceComponent: () => (/* binding */ TraceComponent)\n/* harmony export */ });\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var _FrameComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FrameComponent */ "./node_modules/@dodona/trace-component/dist/components/FrameComponent.js");\n/* harmony import */ var _FramePicker__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./FramePicker */ "./node_modules/@dodona/trace-component/dist/components/FramePicker.js");\n/* harmony import */ var _HelpCard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./HelpCard */ "./node_modules/@dodona/trace-component/dist/components/HelpCard.js");\n/* harmony import */ var _HeapLayout__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../HeapLayout */ "./node_modules/@dodona/trace-component/dist/HeapLayout.js");\n/* harmony import */ var _ExceptionCard__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ExceptionCard */ "./node_modules/@dodona/trace-component/dist/components/ExceptionCard.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\n\n\n\nlet TraceComponent = class TraceComponent extends lit__WEBPACK_IMPORTED_MODULE_1__.LitElement {\n reComputeLayouts() {\n this.layouts = [];\n if (!this._trace || this._trace.length === 0) {\n return;\n }\n let prev = null;\n for (let i = 0; i < this._trace.length; i++) {\n const frame = this._trace[i];\n prev = new _HeapLayout__WEBPACK_IMPORTED_MODULE_5__.HeapLayout(frame, prev);\n this.layouts.push(prev);\n }\n }\n constructor() {\n super();\n this.translations = _HelpCard__WEBPACK_IMPORTED_MODULE_4__.helpCardTranslations;\n this.selectedFrame = 0;\n this.layouts = [];\n this._trace = [];\n this.reComputeLayouts();\n }\n update(changedProperties) {\n if (changedProperties.has("trace")) {\n this._trace = this.trace || [];\n this.reComputeLayouts();\n this.selectedFrame = Math.max(0, this._trace.length - 1);\n }\n super.update(changedProperties);\n }\n handleFrameChange(frame) {\n this.selectedFrame = frame;\n }\n addFrame(frame) {\n this._trace.push(frame);\n const lastLayout = this.layouts[this.layouts.length - 1];\n this.layouts.push(new _HeapLayout__WEBPACK_IMPORTED_MODULE_5__.HeapLayout(frame, lastLayout));\n this.requestUpdate();\n }\n render() {\n if (!this._trace || this._trace.length === 0 || !this.layouts || this.layouts.length === 0 || !this.layouts[this.selectedFrame]) {\n return (0,lit__WEBPACK_IMPORTED_MODULE_1__.html) ``;\n }\n return (0,lit__WEBPACK_IMPORTED_MODULE_1__.html) `\n \n ${this.selectedFrame > 0 ?\n this._trace[this.selectedFrame].event == \'uncaught_exception\' ? (0,lit__WEBPACK_IMPORTED_MODULE_1__.html) `\n \n The debugger crashed\n ${this._trace[this.selectedFrame].exception_msg}\n \n ` : (0,lit__WEBPACK_IMPORTED_MODULE_1__.html) `\n \n ` : (0,lit__WEBPACK_IMPORTED_MODULE_1__.html) `\n \n `}\n `;\n }\n};\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.property)({ type: Array })\n], TraceComponent.prototype, "trace", void 0);\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.property)({ type: Object })\n], TraceComponent.prototype, "translations", void 0);\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.property)({ state: true })\n], TraceComponent.prototype, "selectedFrame", void 0);\nTraceComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_0__.customElement)(\'tc-trace\')\n], TraceComponent);\n\n//# sourceMappingURL=TraceComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/TraceComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/heapElements/ClassComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ClassComponent: () => (/* binding */ ClassComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _AttributeMap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../AttributeMap */ "./node_modules/@dodona/trace-component/dist/components/AttributeMap.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mixins/DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\n// TODO: implement hide attributes\nlet ClassComponent = class ClassComponent extends (0,_mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n get classAttributes() {\n return this.el.slice(3);\n }\n get superclassStr() {\n if (this.el[2].length > 0) {\n return `[extends ${this.el[2].join(\', \')}]`;\n }\n else {\n return "";\n }\n }\n get name() {\n return this.el[1];\n }\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n ${ // Hacky fix: webcomponents are not allowed inside table, but templates are\n (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``}\n
\n `;\n }\n};\nClassComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.heapDefaults, _style__WEBPACK_IMPORTED_MODULE_3__.keyValueTable, _style__WEBPACK_IMPORTED_MODULE_3__.immutable];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], ClassComponent.prototype, "el", void 0);\nClassComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-class\')\n], ClassComponent);\n\n//# sourceMappingURL=ClassComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/heapElements/ClassComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/heapElements/DictComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DictComponent: () => (/* binding */ DictComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _SubElementComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../SubElementComponent */ "./node_modules/@dodona/trace-component/dist/components/SubElementComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_FoldableComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mixins/FoldableComponent */ "./node_modules/@dodona/trace-component/dist/mixins/FoldableComponent.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\nlet DictComponent = class DictComponent extends _mixins_FoldableComponent__WEBPACK_IMPORTED_MODULE_4__.FoldableComponent {\n get values() {\n return this.el.slice(1);\n }\n render() {\n return this.renderedComponent("dict", (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n ${this.renderedValues(([key, value]) => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n \n \n `, (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``)}\n
\n \n \n \n
...
\n `);\n }\n};\nDictComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.heapDefaults, _style__WEBPACK_IMPORTED_MODULE_3__.keyValueTable, _style__WEBPACK_IMPORTED_MODULE_3__.mutable, _mixins_FoldableComponent__WEBPACK_IMPORTED_MODULE_4__.FoldableComponent.styles];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], DictComponent.prototype, "el", void 0);\nDictComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-dict\')\n], DictComponent);\n\n//# sourceMappingURL=DictComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/heapElements/DictComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/heapElements/FunctionComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FunctionComponent: () => (/* binding */ FunctionComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _AttributeMap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../AttributeMap */ "./node_modules/@dodona/trace-component/dist/components/AttributeMap.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mixins/DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\n// TODO figure out when parentframes are used\nlet FunctionComponent = class FunctionComponent extends (0,_mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n get functionAttributes() {\n if (this.el.length < 4) {\n return undefined;\n }\n return this.el[3];\n }\n get funcName() {\n return this.el[1];\n }\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n
${this.funcName}
\n ${this.functionAttributes ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n ${ // Hacky fix: webcomponents are not allowed inside table, but templates are\n (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``}\n
\n ` : (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``}\n `;\n }\n};\nFunctionComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.heapDefaults, _style__WEBPACK_IMPORTED_MODULE_3__.immutable];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], FunctionComponent.prototype, "el", void 0);\nFunctionComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-function\')\n], FunctionComponent);\n\n//# sourceMappingURL=FunctionComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/heapElements/FunctionComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/heapElements/HeapPrimitiveComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ HeapPrimitiveComponent: () => (/* binding */ HeapPrimitiveComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _PrimitiveComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../PrimitiveComponent */ "./node_modules/@dodona/trace-component/dist/components/PrimitiveComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mixins/DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\nlet HeapPrimitiveComponent = class HeapPrimitiveComponent extends (0,_mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n `;\n }\n};\nHeapPrimitiveComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.heapDefaults, _style__WEBPACK_IMPORTED_MODULE_3__.mutable];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], HeapPrimitiveComponent.prototype, "el", void 0);\nHeapPrimitiveComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-heap-primitive\')\n], HeapPrimitiveComponent);\n\n//# sourceMappingURL=HeapPrimitiveComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/heapElements/HeapPrimitiveComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/heapElements/InstanceComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InstanceComponent: () => (/* binding */ InstanceComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _AttributeMap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../AttributeMap */ "./node_modules/@dodona/trace-component/dist/components/AttributeMap.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mixins/DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\nlet InstanceComponent = class InstanceComponent extends (0,_mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n get instanceAttributes() {\n const headerLength = this.isPPrint ? 3 : 2;\n return this.el.slice(headerLength);\n }\n get name() {\n return this.el[1];\n }\n get isPPrint() {\n return this.el[0] === "INSTANCE_PPRINT";\n }\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n ${this.isPPrint ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `` : (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``}\n ${ // Hacky fix: webcomponents are not allowed inside table, but templates are\n (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``}\n
${this.el[2]}
\n `;\n }\n};\nInstanceComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.heapDefaults, _style__WEBPACK_IMPORTED_MODULE_3__.mutable, (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n td {\n border-bottom: 1px solid ${_style__WEBPACK_IMPORTED_MODULE_3__.outlineColor};\n }\n .pprint {\n font-family: ${_style__WEBPACK_IMPORTED_MODULE_3__.monospace};\n white-space: pre;\n }\n `];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], InstanceComponent.prototype, "el", void 0);\nInstanceComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-instance\')\n], InstanceComponent);\n\n//# sourceMappingURL=InstanceComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/heapElements/InstanceComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/heapElements/ListComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ListComponent: () => (/* binding */ ListComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _SubElementComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../SubElementComponent */ "./node_modules/@dodona/trace-component/dist/components/SubElementComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_FoldableComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mixins/FoldableComponent */ "./node_modules/@dodona/trace-component/dist/mixins/FoldableComponent.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\nlet ListComponent = class ListComponent extends _mixins_FoldableComponent__WEBPACK_IMPORTED_MODULE_4__.FoldableComponent {\n get values() {\n return this.el.slice(1);\n }\n render() {\n return this.renderedComponent("list", (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n \n ${this.renderedValues((_, i) => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``, (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``)}\n \n \n \n \n ${this.renderedValues(el => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n `, (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``)}\n \n \n
${i}
\n \n ...
\n `);\n }\n};\nListComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.heapDefaults, _style__WEBPACK_IMPORTED_MODULE_3__.indexedTable, _style__WEBPACK_IMPORTED_MODULE_3__.mutable, _mixins_FoldableComponent__WEBPACK_IMPORTED_MODULE_4__.FoldableComponent.styles];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], ListComponent.prototype, "el", void 0);\nListComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-list\')\n], ListComponent);\n\n//# sourceMappingURL=ListComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/heapElements/ListComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/heapElements/OtherComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OtherComponent: () => (/* binding */ OtherComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _PrimitiveComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../PrimitiveComponent */ "./node_modules/@dodona/trace-component/dist/components/PrimitiveComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mixins/DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\nlet OtherComponent = class OtherComponent extends (0,_mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n get typeName() {\n return this.el[0];\n }\n get value() {\n return this.el[1];\n }\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n \n
${this.value}
\n `;\n }\n};\nOtherComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.heapDefaults];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], OtherComponent.prototype, "el", void 0);\nOtherComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-other\')\n], OtherComponent);\n\n//# sourceMappingURL=OtherComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/heapElements/OtherComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/heapElements/SetComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SetComponent: () => (/* binding */ SetComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _SubElementComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../SubElementComponent */ "./node_modules/@dodona/trace-component/dist/components/SubElementComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mixins/DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\nlet SetComponent = class SetComponent extends (0,_mixins_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_4__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n get subElements() {\n return this.el.slice(1);\n }\n // gives roughly a 3x5 rectangular ratio, square is too, err,\n // \'square\' and boring\n get numRows() {\n let numRows = Math.round(Math.sqrt(this.subElements.length));\n if (numRows > 3) {\n numRows -= 1;\n }\n return numRows;\n }\n get numCols() {\n return Math.ceil(this.subElements.length / this.numRows);\n }\n exists(i, j) {\n return i * this.numCols + j < this.subElements.length;\n }\n render() {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n ${Array(this.numRows).fill(0).map((_, i) => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n ${Array(this.numCols).fill(0).map((_, j) => this.exists(i, j) ? (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n ` : (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``)}\n \n `)}\n
\n \n \n
\n `;\n }\n};\nSetComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.heapDefaults, _style__WEBPACK_IMPORTED_MODULE_3__.mutable];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], SetComponent.prototype, "el", void 0);\nSetComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-set\')\n], SetComponent);\n\n//# sourceMappingURL=SetComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/heapElements/SetComponent.js?')},"./node_modules/@dodona/trace-component/dist/components/heapElements/TupleComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TupleComponent: () => (/* binding */ TupleComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _SubElementComponent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../SubElementComponent */ "./node_modules/@dodona/trace-component/dist/components/SubElementComponent.js");\n/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../style */ "./node_modules/@dodona/trace-component/dist/style.js");\n/* harmony import */ var _mixins_FoldableComponent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../mixins/FoldableComponent */ "./node_modules/@dodona/trace-component/dist/mixins/FoldableComponent.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\n\n\nlet TupleComponent = class TupleComponent extends _mixins_FoldableComponent__WEBPACK_IMPORTED_MODULE_4__.FoldableComponent {\n get values() {\n return this.el.slice(1);\n }\n render() {\n return this.renderedComponent("tuple", (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n \n \n ${this.renderedValues((_, i) => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``, (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``)}\n \n \n \n \n ${this.renderedValues(el => (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n `, (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) ``)}\n \n \n
${i}
\n \n ...
\n `);\n }\n};\nTupleComponent.styles = [_style__WEBPACK_IMPORTED_MODULE_3__.defaults, _style__WEBPACK_IMPORTED_MODULE_3__.heapDefaults, _style__WEBPACK_IMPORTED_MODULE_3__.indexedTable, _style__WEBPACK_IMPORTED_MODULE_3__.immutable, _mixins_FoldableComponent__WEBPACK_IMPORTED_MODULE_4__.FoldableComponent.styles];\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ type: Array })\n], TupleComponent.prototype, "el", void 0);\nTupleComponent = __decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.customElement)(\'tc-tuple\')\n], TupleComponent);\n\n//# sourceMappingURL=TupleComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/components/heapElements/TupleComponent.js?')},"./node_modules/@dodona/trace-component/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TraceComponent: () => (/* reexport safe */ _components_TraceComponent__WEBPACK_IMPORTED_MODULE_0__.TraceComponent)\n/* harmony export */ });\n/* harmony import */ var _components_TraceComponent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/TraceComponent */ "./node_modules/@dodona/trace-component/dist/components/TraceComponent.js");\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/index.js?')},"./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ deepAwaitMixin: () => (/* binding */ deepAwaitMixin)\n/* harmony export */ });\nfunction deepAwaitMixin(superClass) {\n class DeepAwaitClass extends superClass {\n get childrenToAwait() {\n const children = this.shadowRoot.querySelectorAll('*');\n return Array.from(children).filter((c) => c instanceof DeepAwaitClass);\n }\n get deepUpdateComplete() {\n return Promise.all(this.childrenToAwait.map((c) => c.deepUpdateComplete)).then(() => this.updateComplete);\n }\n updated(_changedProperties) {\n super.updated(_changedProperties);\n this.dispatchEvent(new CustomEvent(\"deep-update\"));\n }\n }\n // Cast return type to the superClass type passed in\n return DeepAwaitClass;\n}\n//# sourceMappingURL=DeepAwaitMixin.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js?")},"./node_modules/@dodona/trace-component/dist/mixins/FoldableComponent.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FoldableComponent: () => (/* binding */ FoldableComponent)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n/* harmony import */ var lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit/decorators.js */ "./node_modules/lit/decorators.js");\n/* harmony import */ var _DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./DeepAwaitMixin */ "./node_modules/@dodona/trace-component/dist/mixins/DeepAwaitMixin.js");\nvar __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\n\n\n\nclass FoldableComponent extends (0,_DeepAwaitMixin__WEBPACK_IMPORTED_MODULE_2__.deepAwaitMixin)(lit__WEBPACK_IMPORTED_MODULE_0__.LitElement) {\n constructor() {\n super(...arguments);\n this.expanded = false;\n }\n get firstValues() {\n return this.values.slice(0, 2);\n }\n get lastValues() {\n return this.values.slice(-2);\n }\n get hiddenValues() {\n return this.values.slice(2, -2);\n }\n renderedValues(renderedValue, renderedBreak) {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n ${this.firstValues.map(renderedValue)}\n ${this.values.length < 10 || this.expanded ?\n this.hiddenValues.map((value, i) => renderedValue(value, this.firstValues.length + i)) :\n renderedBreak}\n ${this.lastValues.map((value, i) => renderedValue(value, this.values.length - 2 + i))}\n `;\n }\n renderedComponent(label, content) {\n if (this.values.length <= 10) {\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n \n ${content}\n `;\n }\n return (0,lit__WEBPACK_IMPORTED_MODULE_0__.html) `\n this.expanded = !this.expanded}>\n \n ${content}\n \n `;\n }\n}\nFoldableComponent.styles = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n .clickable:hover {\n cursor: pointer;\n opacity: 0.8;\n }\n `;\n__decorate([\n (0,lit_decorators_js__WEBPACK_IMPORTED_MODULE_1__.property)({ state: true })\n], FoldableComponent.prototype, "expanded", void 0);\n//# sourceMappingURL=FoldableComponent.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/mixins/FoldableComponent.js?')},"./node_modules/@dodona/trace-component/dist/style.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ defaults: () => (/* binding */ defaults),\n/* harmony export */ heapDefaults: () => (/* binding */ heapDefaults),\n/* harmony export */ immutable: () => (/* binding */ immutable),\n/* harmony export */ indexedTable: () => (/* binding */ indexedTable),\n/* harmony export */ keyValueTable: () => (/* binding */ keyValueTable),\n/* harmony export */ monospace: () => (/* binding */ monospace),\n/* harmony export */ mutable: () => (/* binding */ mutable),\n/* harmony export */ onSurfaceColor: () => (/* binding */ onSurfaceColor),\n/* harmony export */ outlineColor: () => (/* binding */ outlineColor),\n/* harmony export */ outlineVariantColor: () => (/* binding */ outlineVariantColor),\n/* harmony export */ primaryColor: () => (/* binding */ primaryColor),\n/* harmony export */ secondaryColor: () => (/* binding */ secondaryColor),\n/* harmony export */ secondaryOnSurfaceColor: () => (/* binding */ secondaryOnSurfaceColor),\n/* harmony export */ secondaryOutlineColor: () => (/* binding */ secondaryOutlineColor),\n/* harmony export */ secondarySurfaceColor: () => (/* binding */ secondarySurfaceColor),\n/* harmony export */ secondarySurfaceContainerColor: () => (/* binding */ secondarySurfaceContainerColor),\n/* harmony export */ surfaceColor: () => (/* binding */ surfaceColor),\n/* harmony export */ surfaceContainerColor: () => (/* binding */ surfaceContainerColor),\n/* harmony export */ tertiaryColor: () => (/* binding */ tertiaryColor),\n/* harmony export */ tertiaryOnSurfaceColor: () => (/* binding */ tertiaryOnSurfaceColor),\n/* harmony export */ tertiaryOutlineColor: () => (/* binding */ tertiaryOutlineColor),\n/* harmony export */ tertiarySurfaceColor: () => (/* binding */ tertiarySurfaceColor),\n/* harmony export */ tertiarySurfaceContainerColor: () => (/* binding */ tertiarySurfaceContainerColor)\n/* harmony export */ });\n/* harmony import */ var lit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lit */ "./node_modules/lit/index.js");\n\n// Main colors to be defined by the theme\nconst surfaceColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-surface-color, #F6FAFC)`; // 98\nconst onSurfaceColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-on-surface-color, #001D32)`; // 10\nconst surfaceContainerColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-surface-container-color, #E5EFF6)`; // 94\nconst outlineColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-outline-color, #2C7CB5)`; // 50\nconst outlineVariantColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-outline-variant-color, #ABCBE2)`; // 80\nconst primaryColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-primary-color, #0061a6)`; // 40\nconst secondarySurfaceColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-secondary-surface-color, #FDF8FA)`; // 98\nconst secondaryOnSurfaceColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-secondary-on-surface-color, #3F0018)`; // 10\nconst secondarySurfaceContainerColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-secondary-surface-container-color, #F9EAF0)`; // 94\nconst secondaryOutlineColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-secondary-outline-color, #CE4379)`; // 50\nconst secondaryColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-secondary-color, #BC0049)`; // 40\nconst tertiarySurfaceColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-tertiary-surface-color, #FAF9F6)`; // 98\nconst tertiaryOnSurfaceColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-tertiary-on-surface-color, #241A00)`; // 10\nconst tertiarySurfaceContainerColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-tertiary-surface-container-color, #F2EDE4)`; // 94\nconst tertiaryOutlineColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-tertiary-outline-color, #98702C)`; // 50\nconst tertiaryColor = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-tertiary-color, #795900)`; // 40\nconst monospace = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `var(--tc-font-monospace, sfmono-regular, menlo, monaco, consolas, "Liberation Mono", "Courier New", monospace)`;\nconst immutable = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n :host, :host * {\n --tc-surface-color: ${secondarySurfaceColor};\n --tc-on-surface-color: ${secondaryOnSurfaceColor};\n --tc-surface-container-color: ${secondarySurfaceContainerColor};\n --tc-outline-color: ${secondaryOutlineColor};\n --tc-primary-color: ${secondaryColor};\n }\n`;\nconst mutable = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n :host, :host * {\n --tc-surface-color: ${tertiarySurfaceColor};\n --tc-on-surface-color: ${tertiaryOnSurfaceColor};\n --tc-surface-container-color: ${tertiarySurfaceContainerColor};\n --tc-outline-color: ${tertiaryOutlineColor};\n --tc-primary-color: ${tertiaryColor};\n }\n`;\nconst defaults = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n :host {\n font-family: var(--tc-font-family, roboto, "Helvetica Neue", helvetica, arial, sans-serif);\n font-size: var(--tc-font-size, 13px);\n color: ${onSurfaceColor};\n }\n \n td {\n padding: 6px;\n background-color: ${surfaceColor};\n }\n`;\nconst heapDefaults = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n label {\n color: var(--tc-heap-label-color, ${primaryColor});\n font-size: var(--tc-heap-label-font-size, 10px);\n margin-bottom: 2px;\n display: block;\n }\n\n table {\n border-collapse: collapse; \n border-radius: 5px; \n overflow: hidden;\n border-style: hidden;\n }\n \n td {\n padding: 8px;\n }\n`;\nconst keyValueTable = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) ` \n td.key {\n background-color: ${surfaceContainerColor};\n text-align: right;\n vertical-align: middle;\n }\n td {\n border-bottom: 1px solid ${outlineColor};\n font-size: 12px;\n }\n`;\nconst indexedTable = (0,lit__WEBPACK_IMPORTED_MODULE_0__.css) `\n td {\n border-left: 1px solid ${outlineColor};\n }\n tbody td {\n padding-top: 2px;\n background-color: ${surfaceContainerColor};\n }\n thead td{\n background-color: ${surfaceContainerColor};\n color: ${outlineColor};\n font-size: 10px;\n padding-bottom: 2px;\n }\n`;\n//# sourceMappingURL=style.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@dodona/trace-component/dist/style.js?')},"./node_modules/@jsplumb/browser-ui/js/jsplumb.browser-ui.es.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ABSOLUTE: () => (/* binding */ ABSOLUTE),\n/* harmony export */ ADD_CLASS_ACTION: () => (/* binding */ ADD_CLASS_ACTION),\n/* harmony export */ ATTRIBUTE_CONTAINER: () => (/* binding */ ATTRIBUTE_CONTAINER),\n/* harmony export */ ATTRIBUTE_GROUP: () => (/* binding */ ATTRIBUTE_GROUP),\n/* harmony export */ ATTRIBUTE_GROUP_CONTENT: () => (/* binding */ ATTRIBUTE_GROUP_CONTENT),\n/* harmony export */ ATTRIBUTE_JTK_ENABLED: () => (/* binding */ ATTRIBUTE_JTK_ENABLED),\n/* harmony export */ ATTRIBUTE_JTK_SCOPE: () => (/* binding */ ATTRIBUTE_JTK_SCOPE),\n/* harmony export */ ATTRIBUTE_MANAGED: () => (/* binding */ ATTRIBUTE_MANAGED),\n/* harmony export */ ATTRIBUTE_NOT_DRAGGABLE: () => (/* binding */ ATTRIBUTE_NOT_DRAGGABLE),\n/* harmony export */ ATTRIBUTE_SCOPE: () => (/* binding */ ATTRIBUTE_SCOPE),\n/* harmony export */ ATTRIBUTE_SCOPE_PREFIX: () => (/* binding */ ATTRIBUTE_SCOPE_PREFIX),\n/* harmony export */ ATTRIBUTE_TABINDEX: () => (/* binding */ ATTRIBUTE_TABINDEX),\n/* harmony export */ ATTR_SCROLLABLE_LIST: () => (/* binding */ ATTR_SCROLLABLE_LIST),\n/* harmony export */ AbstractBezierConnector: () => (/* binding */ AbstractBezierConnector),\n/* harmony export */ AbstractConnector: () => (/* binding */ AbstractConnector),\n/* harmony export */ AbstractSegment: () => (/* binding */ AbstractSegment),\n/* harmony export */ AnchorLocations: () => (/* binding */ AnchorLocations),\n/* harmony export */ ArcSegment: () => (/* binding */ ArcSegment),\n/* harmony export */ ArrowOverlay: () => (/* binding */ ArrowOverlay),\n/* harmony export */ BLOCK: () => (/* binding */ BLOCK),\n/* harmony export */ BOTTOM: () => (/* binding */ BOTTOM),\n/* harmony export */ BezierConnector: () => (/* binding */ BezierConnector),\n/* harmony export */ BezierSegment: () => (/* binding */ BezierSegment),\n/* harmony export */ BlankEndpoint: () => (/* binding */ BlankEndpoint),\n/* harmony export */ BlankEndpointHandler: () => (/* binding */ BlankEndpointHandler),\n/* harmony export */ BrowserJsPlumbInstance: () => (/* binding */ BrowserJsPlumbInstance),\n/* harmony export */ BrowserUITestSupport: () => (/* binding */ BrowserUITestSupport),\n/* harmony export */ CHECK_CONDITION: () => (/* binding */ CHECK_CONDITION),\n/* harmony export */ CHECK_DROP_ALLOWED: () => (/* binding */ CHECK_DROP_ALLOWED),\n/* harmony export */ CLASS_CONNECTED: () => (/* binding */ CLASS_CONNECTED),\n/* harmony export */ CLASS_CONNECTOR: () => (/* binding */ CLASS_CONNECTOR),\n/* harmony export */ CLASS_CONNECTOR_OUTLINE: () => (/* binding */ CLASS_CONNECTOR_OUTLINE),\n/* harmony export */ CLASS_DELEGATED_DRAGGABLE: () => (/* binding */ CLASS_DELEGATED_DRAGGABLE),\n/* harmony export */ CLASS_DRAGGABLE: () => (/* binding */ CLASS_DRAGGABLE),\n/* harmony export */ CLASS_DRAGGED: () => (/* binding */ CLASS_DRAGGED),\n/* harmony export */ CLASS_DRAG_ACTIVE: () => (/* binding */ CLASS_DRAG_ACTIVE),\n/* harmony export */ CLASS_DRAG_CONTAINER: () => (/* binding */ CLASS_DRAG_CONTAINER),\n/* harmony export */ CLASS_DRAG_HOVER: () => (/* binding */ CLASS_DRAG_HOVER),\n/* harmony export */ CLASS_ENDPOINT: () => (/* binding */ CLASS_ENDPOINT),\n/* harmony export */ CLASS_ENDPOINT_ANCHOR_PREFIX: () => (/* binding */ CLASS_ENDPOINT_ANCHOR_PREFIX),\n/* harmony export */ CLASS_ENDPOINT_CONNECTED: () => (/* binding */ CLASS_ENDPOINT_CONNECTED),\n/* harmony export */ CLASS_ENDPOINT_DROP_ALLOWED: () => (/* binding */ CLASS_ENDPOINT_DROP_ALLOWED),\n/* harmony export */ CLASS_ENDPOINT_DROP_FORBIDDEN: () => (/* binding */ CLASS_ENDPOINT_DROP_FORBIDDEN),\n/* harmony export */ CLASS_ENDPOINT_FLOATING: () => (/* binding */ CLASS_ENDPOINT_FLOATING),\n/* harmony export */ CLASS_ENDPOINT_FULL: () => (/* binding */ CLASS_ENDPOINT_FULL),\n/* harmony export */ CLASS_GHOST_PROXY: () => (/* binding */ CLASS_GHOST_PROXY),\n/* harmony export */ CLASS_GROUP_COLLAPSED: () => (/* binding */ CLASS_GROUP_COLLAPSED),\n/* harmony export */ CLASS_GROUP_EXPANDED: () => (/* binding */ CLASS_GROUP_EXPANDED),\n/* harmony export */ CLASS_OVERLAY: () => (/* binding */ CLASS_OVERLAY),\n/* harmony export */ CONNECTION: () => (/* binding */ CONNECTION),\n/* harmony export */ Collicat: () => (/* binding */ Collicat),\n/* harmony export */ Component: () => (/* binding */ Component),\n/* harmony export */ Connection: () => (/* binding */ Connection),\n/* harmony export */ ConnectionDragSelector: () => (/* binding */ ConnectionDragSelector),\n/* harmony export */ ConnectionSelection: () => (/* binding */ ConnectionSelection),\n/* harmony export */ Connectors: () => (/* binding */ Connectors),\n/* harmony export */ ContainmentType: () => (/* binding */ ContainmentType),\n/* harmony export */ CustomOverlay: () => (/* binding */ CustomOverlay),\n/* harmony export */ DEFAULT: () => (/* binding */ DEFAULT),\n/* harmony export */ DEFAULT_KEY_ALLOW_NESTED_GROUPS: () => (/* binding */ DEFAULT_KEY_ALLOW_NESTED_GROUPS),\n/* harmony export */ DEFAULT_KEY_ANCHOR: () => (/* binding */ DEFAULT_KEY_ANCHOR),\n/* harmony export */ DEFAULT_KEY_ANCHORS: () => (/* binding */ DEFAULT_KEY_ANCHORS),\n/* harmony export */ DEFAULT_KEY_CONNECTIONS_DETACHABLE: () => (/* binding */ DEFAULT_KEY_CONNECTIONS_DETACHABLE),\n/* harmony export */ DEFAULT_KEY_CONNECTION_OVERLAYS: () => (/* binding */ DEFAULT_KEY_CONNECTION_OVERLAYS),\n/* harmony export */ DEFAULT_KEY_CONNECTOR: () => (/* binding */ DEFAULT_KEY_CONNECTOR),\n/* harmony export */ DEFAULT_KEY_CONTAINER: () => (/* binding */ DEFAULT_KEY_CONTAINER),\n/* harmony export */ DEFAULT_KEY_ENDPOINT: () => (/* binding */ DEFAULT_KEY_ENDPOINT),\n/* harmony export */ DEFAULT_KEY_ENDPOINTS: () => (/* binding */ DEFAULT_KEY_ENDPOINTS),\n/* harmony export */ DEFAULT_KEY_ENDPOINT_HOVER_STYLE: () => (/* binding */ DEFAULT_KEY_ENDPOINT_HOVER_STYLE),\n/* harmony export */ DEFAULT_KEY_ENDPOINT_HOVER_STYLES: () => (/* binding */ DEFAULT_KEY_ENDPOINT_HOVER_STYLES),\n/* harmony export */ DEFAULT_KEY_ENDPOINT_OVERLAYS: () => (/* binding */ DEFAULT_KEY_ENDPOINT_OVERLAYS),\n/* harmony export */ DEFAULT_KEY_ENDPOINT_STYLE: () => (/* binding */ DEFAULT_KEY_ENDPOINT_STYLE),\n/* harmony export */ DEFAULT_KEY_ENDPOINT_STYLES: () => (/* binding */ DEFAULT_KEY_ENDPOINT_STYLES),\n/* harmony export */ DEFAULT_KEY_HOVER_CLASS: () => (/* binding */ DEFAULT_KEY_HOVER_CLASS),\n/* harmony export */ DEFAULT_KEY_HOVER_PAINT_STYLE: () => (/* binding */ DEFAULT_KEY_HOVER_PAINT_STYLE),\n/* harmony export */ DEFAULT_KEY_LIST_STYLE: () => (/* binding */ DEFAULT_KEY_LIST_STYLE),\n/* harmony export */ DEFAULT_KEY_MAX_CONNECTIONS: () => (/* binding */ DEFAULT_KEY_MAX_CONNECTIONS),\n/* harmony export */ DEFAULT_KEY_PAINT_STYLE: () => (/* binding */ DEFAULT_KEY_PAINT_STYLE),\n/* harmony export */ DEFAULT_KEY_REATTACH_CONNECTIONS: () => (/* binding */ DEFAULT_KEY_REATTACH_CONNECTIONS),\n/* harmony export */ DEFAULT_KEY_SCOPE: () => (/* binding */ DEFAULT_KEY_SCOPE),\n/* harmony export */ DEFAULT_LIST_OPTIONS: () => (/* binding */ DEFAULT_LIST_OPTIONS),\n/* harmony export */ DiamondOverlay: () => (/* binding */ DiamondOverlay),\n/* harmony export */ DotEndpoint: () => (/* binding */ DotEndpoint),\n/* harmony export */ DotEndpointHandler: () => (/* binding */ DotEndpointHandler),\n/* harmony export */ Drag: () => (/* binding */ Drag),\n/* harmony export */ DragManager: () => (/* binding */ DragManager),\n/* harmony export */ ELEMENT: () => (/* binding */ ELEMENT),\n/* harmony export */ ELEMENT_DIV: () => (/* binding */ ELEMENT_DIV),\n/* harmony export */ EMPTY_BOUNDS: () => (/* binding */ EMPTY_BOUNDS),\n/* harmony export */ ENDPOINT: () => (/* binding */ ENDPOINT),\n/* harmony export */ ERROR_SOURCE_DOES_NOT_EXIST: () => (/* binding */ ERROR_SOURCE_DOES_NOT_EXIST),\n/* harmony export */ ERROR_SOURCE_ENDPOINT_FULL: () => (/* binding */ ERROR_SOURCE_ENDPOINT_FULL),\n/* harmony export */ ERROR_TARGET_DOES_NOT_EXIST: () => (/* binding */ ERROR_TARGET_DOES_NOT_EXIST),\n/* harmony export */ ERROR_TARGET_ENDPOINT_FULL: () => (/* binding */ ERROR_TARGET_ENDPOINT_FULL),\n/* harmony export */ EVENT_ANCHOR_CHANGED: () => (/* binding */ EVENT_ANCHOR_CHANGED),\n/* harmony export */ EVENT_BEFORE_START: () => (/* binding */ EVENT_BEFORE_START),\n/* harmony export */ EVENT_CLICK: () => (/* binding */ EVENT_CLICK),\n/* harmony export */ EVENT_CONNECTION: () => (/* binding */ EVENT_CONNECTION),\n/* harmony export */ EVENT_CONNECTION_ABORT: () => (/* binding */ EVENT_CONNECTION_ABORT),\n/* harmony export */ EVENT_CONNECTION_CLICK: () => (/* binding */ EVENT_CONNECTION_CLICK),\n/* harmony export */ EVENT_CONNECTION_CONTEXTMENU: () => (/* binding */ EVENT_CONNECTION_CONTEXTMENU),\n/* harmony export */ EVENT_CONNECTION_DBL_CLICK: () => (/* binding */ EVENT_CONNECTION_DBL_CLICK),\n/* harmony export */ EVENT_CONNECTION_DBL_TAP: () => (/* binding */ EVENT_CONNECTION_DBL_TAP),\n/* harmony export */ EVENT_CONNECTION_DETACHED: () => (/* binding */ EVENT_CONNECTION_DETACHED),\n/* harmony export */ EVENT_CONNECTION_DRAG: () => (/* binding */ EVENT_CONNECTION_DRAG),\n/* harmony export */ EVENT_CONNECTION_MOUSEDOWN: () => (/* binding */ EVENT_CONNECTION_MOUSEDOWN),\n/* harmony export */ EVENT_CONNECTION_MOUSEOUT: () => (/* binding */ EVENT_CONNECTION_MOUSEOUT),\n/* harmony export */ EVENT_CONNECTION_MOUSEOVER: () => (/* binding */ EVENT_CONNECTION_MOUSEOVER),\n/* harmony export */ EVENT_CONNECTION_MOUSEUP: () => (/* binding */ EVENT_CONNECTION_MOUSEUP),\n/* harmony export */ EVENT_CONNECTION_MOVED: () => (/* binding */ EVENT_CONNECTION_MOVED),\n/* harmony export */ EVENT_CONNECTION_TAP: () => (/* binding */ EVENT_CONNECTION_TAP),\n/* harmony export */ EVENT_CONTAINER_CHANGE: () => (/* binding */ EVENT_CONTAINER_CHANGE),\n/* harmony export */ EVENT_CONTEXTMENU: () => (/* binding */ EVENT_CONTEXTMENU),\n/* harmony export */ EVENT_DBL_CLICK: () => (/* binding */ EVENT_DBL_CLICK),\n/* harmony export */ EVENT_DBL_TAP: () => (/* binding */ EVENT_DBL_TAP),\n/* harmony export */ EVENT_DRAG: () => (/* binding */ EVENT_DRAG),\n/* harmony export */ EVENT_DRAG_MOVE: () => (/* binding */ EVENT_DRAG_MOVE),\n/* harmony export */ EVENT_DRAG_START: () => (/* binding */ EVENT_DRAG_START),\n/* harmony export */ EVENT_DRAG_STOP: () => (/* binding */ EVENT_DRAG_STOP),\n/* harmony export */ EVENT_DROP: () => (/* binding */ EVENT_DROP),\n/* harmony export */ EVENT_ELEMENT_CLICK: () => (/* binding */ EVENT_ELEMENT_CLICK),\n/* harmony export */ EVENT_ELEMENT_CONTEXTMENU: () => (/* binding */ EVENT_ELEMENT_CONTEXTMENU),\n/* harmony export */ EVENT_ELEMENT_DBL_CLICK: () => (/* binding */ EVENT_ELEMENT_DBL_CLICK),\n/* harmony export */ EVENT_ELEMENT_DBL_TAP: () => (/* binding */ EVENT_ELEMENT_DBL_TAP),\n/* harmony export */ EVENT_ELEMENT_MOUSE_DOWN: () => (/* binding */ EVENT_ELEMENT_MOUSE_DOWN),\n/* harmony export */ EVENT_ELEMENT_MOUSE_MOVE: () => (/* binding */ EVENT_ELEMENT_MOUSE_MOVE),\n/* harmony export */ EVENT_ELEMENT_MOUSE_OUT: () => (/* binding */ EVENT_ELEMENT_MOUSE_OUT),\n/* harmony export */ EVENT_ELEMENT_MOUSE_OVER: () => (/* binding */ EVENT_ELEMENT_MOUSE_OVER),\n/* harmony export */ EVENT_ELEMENT_MOUSE_UP: () => (/* binding */ EVENT_ELEMENT_MOUSE_UP),\n/* harmony export */ EVENT_ELEMENT_TAP: () => (/* binding */ EVENT_ELEMENT_TAP),\n/* harmony export */ EVENT_ENDPOINT_CLICK: () => (/* binding */ EVENT_ENDPOINT_CLICK),\n/* harmony export */ EVENT_ENDPOINT_DBL_CLICK: () => (/* binding */ EVENT_ENDPOINT_DBL_CLICK),\n/* harmony export */ EVENT_ENDPOINT_DBL_TAP: () => (/* binding */ EVENT_ENDPOINT_DBL_TAP),\n/* harmony export */ EVENT_ENDPOINT_MOUSEDOWN: () => (/* binding */ EVENT_ENDPOINT_MOUSEDOWN),\n/* harmony export */ EVENT_ENDPOINT_MOUSEOUT: () => (/* binding */ EVENT_ENDPOINT_MOUSEOUT),\n/* harmony export */ EVENT_ENDPOINT_MOUSEOVER: () => (/* binding */ EVENT_ENDPOINT_MOUSEOVER),\n/* harmony export */ EVENT_ENDPOINT_MOUSEUP: () => (/* binding */ EVENT_ENDPOINT_MOUSEUP),\n/* harmony export */ EVENT_ENDPOINT_REPLACED: () => (/* binding */ EVENT_ENDPOINT_REPLACED),\n/* harmony export */ EVENT_ENDPOINT_TAP: () => (/* binding */ EVENT_ENDPOINT_TAP),\n/* harmony export */ EVENT_FOCUS: () => (/* binding */ EVENT_FOCUS),\n/* harmony export */ EVENT_GROUP_ADDED: () => (/* binding */ EVENT_GROUP_ADDED),\n/* harmony export */ EVENT_GROUP_COLLAPSE: () => (/* binding */ EVENT_GROUP_COLLAPSE),\n/* harmony export */ EVENT_GROUP_EXPAND: () => (/* binding */ EVENT_GROUP_EXPAND),\n/* harmony export */ EVENT_GROUP_MEMBER_ADDED: () => (/* binding */ EVENT_GROUP_MEMBER_ADDED),\n/* harmony export */ EVENT_GROUP_MEMBER_REMOVED: () => (/* binding */ EVENT_GROUP_MEMBER_REMOVED),\n/* harmony export */ EVENT_GROUP_REMOVED: () => (/* binding */ EVENT_GROUP_REMOVED),\n/* harmony export */ EVENT_INTERNAL_CONNECTION: () => (/* binding */ EVENT_INTERNAL_CONNECTION),\n/* harmony export */ EVENT_INTERNAL_CONNECTION_DETACHED: () => (/* binding */ EVENT_INTERNAL_CONNECTION_DETACHED),\n/* harmony export */ EVENT_INTERNAL_ENDPOINT_UNREGISTERED: () => (/* binding */ EVENT_INTERNAL_ENDPOINT_UNREGISTERED),\n/* harmony export */ EVENT_MANAGE_ELEMENT: () => (/* binding */ EVENT_MANAGE_ELEMENT),\n/* harmony export */ EVENT_MAX_CONNECTIONS: () => (/* binding */ EVENT_MAX_CONNECTIONS),\n/* harmony export */ EVENT_MOUSEDOWN: () => (/* binding */ EVENT_MOUSEDOWN),\n/* harmony export */ EVENT_MOUSEENTER: () => (/* binding */ EVENT_MOUSEENTER),\n/* harmony export */ EVENT_MOUSEEXIT: () => (/* binding */ EVENT_MOUSEEXIT),\n/* harmony export */ EVENT_MOUSEMOVE: () => (/* binding */ EVENT_MOUSEMOVE),\n/* harmony export */ EVENT_MOUSEOUT: () => (/* binding */ EVENT_MOUSEOUT),\n/* harmony export */ EVENT_MOUSEOVER: () => (/* binding */ EVENT_MOUSEOVER),\n/* harmony export */ EVENT_MOUSEUP: () => (/* binding */ EVENT_MOUSEUP),\n/* harmony export */ EVENT_NESTED_GROUP_ADDED: () => (/* binding */ EVENT_NESTED_GROUP_ADDED),\n/* harmony export */ EVENT_NESTED_GROUP_REMOVED: () => (/* binding */ EVENT_NESTED_GROUP_REMOVED),\n/* harmony export */ EVENT_OUT: () => (/* binding */ EVENT_OUT),\n/* harmony export */ EVENT_OVER: () => (/* binding */ EVENT_OVER),\n/* harmony export */ EVENT_REVERT: () => (/* binding */ EVENT_REVERT),\n/* harmony export */ EVENT_SCROLL: () => (/* binding */ EVENT_SCROLL),\n/* harmony export */ EVENT_START: () => (/* binding */ EVENT_START),\n/* harmony export */ EVENT_STOP: () => (/* binding */ EVENT_STOP),\n/* harmony export */ EVENT_TAP: () => (/* binding */ EVENT_TAP),\n/* harmony export */ EVENT_TOUCHEND: () => (/* binding */ EVENT_TOUCHEND),\n/* harmony export */ EVENT_TOUCHMOVE: () => (/* binding */ EVENT_TOUCHMOVE),\n/* harmony export */ EVENT_TOUCHSTART: () => (/* binding */ EVENT_TOUCHSTART),\n/* harmony export */ EVENT_UNMANAGE_ELEMENT: () => (/* binding */ EVENT_UNMANAGE_ELEMENT),\n/* harmony export */ EVENT_ZOOM: () => (/* binding */ EVENT_ZOOM),\n/* harmony export */ ElementDragHandler: () => (/* binding */ ElementDragHandler),\n/* harmony export */ ElementTypes: () => (/* binding */ ElementTypes),\n/* harmony export */ Endpoint: () => (/* binding */ Endpoint),\n/* harmony export */ EndpointFactory: () => (/* binding */ EndpointFactory),\n/* harmony export */ EndpointRepresentation: () => (/* binding */ EndpointRepresentation),\n/* harmony export */ EndpointSelection: () => (/* binding */ EndpointSelection),\n/* harmony export */ EventGenerator: () => (/* binding */ EventGenerator),\n/* harmony export */ EventManager: () => (/* binding */ EventManager),\n/* harmony export */ FALSE: () => (/* binding */ FALSE$1),\n/* harmony export */ FIXED: () => (/* binding */ FIXED),\n/* harmony export */ FlowchartConnector: () => (/* binding */ FlowchartConnector),\n/* harmony export */ GroupManager: () => (/* binding */ GroupManager),\n/* harmony export */ INTERCEPT_BEFORE_DETACH: () => (/* binding */ INTERCEPT_BEFORE_DETACH),\n/* harmony export */ INTERCEPT_BEFORE_DRAG: () => (/* binding */ INTERCEPT_BEFORE_DRAG),\n/* harmony export */ INTERCEPT_BEFORE_DROP: () => (/* binding */ INTERCEPT_BEFORE_DROP),\n/* harmony export */ INTERCEPT_BEFORE_START_DETACH: () => (/* binding */ INTERCEPT_BEFORE_START_DETACH),\n/* harmony export */ IS_DETACH_ALLOWED: () => (/* binding */ IS_DETACH_ALLOWED),\n/* harmony export */ JsPlumbInstance: () => (/* binding */ JsPlumbInstance),\n/* harmony export */ JsPlumbList: () => (/* binding */ JsPlumbList),\n/* harmony export */ JsPlumbListManager: () => (/* binding */ JsPlumbListManager),\n/* harmony export */ KEY_CONNECTION_OVERLAYS: () => (/* binding */ KEY_CONNECTION_OVERLAYS),\n/* harmony export */ LEFT: () => (/* binding */ LEFT),\n/* harmony export */ LabelOverlay: () => (/* binding */ LabelOverlay),\n/* harmony export */ LightweightFloatingAnchor: () => (/* binding */ LightweightFloatingAnchor),\n/* harmony export */ LightweightRouter: () => (/* binding */ LightweightRouter),\n/* harmony export */ NONE: () => (/* binding */ NONE),\n/* harmony export */ OptimisticEventGenerator: () => (/* binding */ OptimisticEventGenerator),\n/* harmony export */ Overlay: () => (/* binding */ Overlay),\n/* harmony export */ OverlayFactory: () => (/* binding */ OverlayFactory),\n/* harmony export */ PROPERTY_POSITION: () => (/* binding */ PROPERTY_POSITION),\n/* harmony export */ PerimeterAnchorShapes: () => (/* binding */ PerimeterAnchorShapes),\n/* harmony export */ PlainArrowOverlay: () => (/* binding */ PlainArrowOverlay),\n/* harmony export */ PositioningStrategies: () => (/* binding */ PositioningStrategies),\n/* harmony export */ REDROP_POLICY_ANY: () => (/* binding */ REDROP_POLICY_ANY),\n/* harmony export */ REDROP_POLICY_ANY_SOURCE: () => (/* binding */ REDROP_POLICY_ANY_SOURCE),\n/* harmony export */ REDROP_POLICY_ANY_SOURCE_OR_TARGET: () => (/* binding */ REDROP_POLICY_ANY_SOURCE_OR_TARGET),\n/* harmony export */ REDROP_POLICY_ANY_TARGET: () => (/* binding */ REDROP_POLICY_ANY_TARGET),\n/* harmony export */ REDROP_POLICY_STRICT: () => (/* binding */ REDROP_POLICY_STRICT),\n/* harmony export */ REMOVE_CLASS_ACTION: () => (/* binding */ REMOVE_CLASS_ACTION),\n/* harmony export */ RIGHT: () => (/* binding */ RIGHT),\n/* harmony export */ RectangleEndpoint: () => (/* binding */ RectangleEndpoint),\n/* harmony export */ RectangleEndpointHandler: () => (/* binding */ RectangleEndpointHandler),\n/* harmony export */ SELECTOR_CONNECTOR: () => (/* binding */ SELECTOR_CONNECTOR),\n/* harmony export */ SELECTOR_ENDPOINT: () => (/* binding */ SELECTOR_ENDPOINT),\n/* harmony export */ SELECTOR_GROUP: () => (/* binding */ SELECTOR_GROUP),\n/* harmony export */ SELECTOR_GROUP_CONTAINER: () => (/* binding */ SELECTOR_GROUP_CONTAINER),\n/* harmony export */ SELECTOR_MANAGED_ELEMENT: () => (/* binding */ SELECTOR_MANAGED_ELEMENT),\n/* harmony export */ SELECTOR_OVERLAY: () => (/* binding */ SELECTOR_OVERLAY),\n/* harmony export */ SELECTOR_SCROLLABLE_LIST: () => (/* binding */ SELECTOR_SCROLLABLE_LIST),\n/* harmony export */ SOURCE: () => (/* binding */ SOURCE),\n/* harmony export */ SOURCE_INDEX: () => (/* binding */ SOURCE_INDEX),\n/* harmony export */ STATIC: () => (/* binding */ STATIC),\n/* harmony export */ StateMachineConnector: () => (/* binding */ StateMachineConnector),\n/* harmony export */ StraightConnector: () => (/* binding */ StraightConnector),\n/* harmony export */ StraightSegment: () => (/* binding */ StraightSegment),\n/* harmony export */ SupportedEdge: () => (/* binding */ SupportedEdge),\n/* harmony export */ TARGET: () => (/* binding */ TARGET),\n/* harmony export */ TARGET_INDEX: () => (/* binding */ TARGET_INDEX),\n/* harmony export */ TOP: () => (/* binding */ TOP),\n/* harmony export */ TRUE: () => (/* binding */ TRUE$1),\n/* harmony export */ TWO_PI: () => (/* binding */ TWO_PI),\n/* harmony export */ UIGroup: () => (/* binding */ UIGroup),\n/* harmony export */ UINode: () => (/* binding */ UINode),\n/* harmony export */ UNDEFINED: () => (/* binding */ UNDEFINED),\n/* harmony export */ Viewport: () => (/* binding */ Viewport),\n/* harmony export */ WILDCARD: () => (/* binding */ WILDCARD),\n/* harmony export */ X_AXIS_FACES: () => (/* binding */ X_AXIS_FACES),\n/* harmony export */ Y_AXIS_FACES: () => (/* binding */ Y_AXIS_FACES),\n/* harmony export */ _createPerimeterAnchor: () => (/* binding */ _createPerimeterAnchor),\n/* harmony export */ _removeTypeCssHelper: () => (/* binding */ _removeTypeCssHelper),\n/* harmony export */ _updateHoverStyle: () => (/* binding */ _updateHoverStyle),\n/* harmony export */ add: () => (/* binding */ add),\n/* harmony export */ addClass: () => (/* binding */ addClass),\n/* harmony export */ addToDictionary: () => (/* binding */ addToDictionary),\n/* harmony export */ addToList: () => (/* binding */ addToList),\n/* harmony export */ addWithFunction: () => (/* binding */ addWithFunction),\n/* harmony export */ arraysEqual: () => (/* binding */ arraysEqual),\n/* harmony export */ att: () => (/* binding */ att),\n/* harmony export */ bezierLineIntersection: () => (/* binding */ bezierLineIntersection),\n/* harmony export */ boundingBoxIntersection: () => (/* binding */ boundingBoxIntersection),\n/* harmony export */ boxIntersection: () => (/* binding */ boxIntersection),\n/* harmony export */ classList: () => (/* binding */ classList),\n/* harmony export */ clone: () => (/* binding */ clone),\n/* harmony export */ cls: () => (/* binding */ cls),\n/* harmony export */ compoundEvent: () => (/* binding */ compoundEvent),\n/* harmony export */ computeBezierLength: () => (/* binding */ computeBezierLength),\n/* harmony export */ consume: () => (/* binding */ consume),\n/* harmony export */ convertToFullOverlaySpec: () => (/* binding */ convertToFullOverlaySpec),\n/* harmony export */ createElement: () => (/* binding */ createElement),\n/* harmony export */ createElementNS: () => (/* binding */ createElementNS),\n/* harmony export */ createFloatingAnchor: () => (/* binding */ createFloatingAnchor),\n/* harmony export */ createTestSupportInstance: () => (/* binding */ createTestSupportInstance),\n/* harmony export */ createTestSupportInstanceQUnit: () => (/* binding */ createTestSupportInstanceQUnit),\n/* harmony export */ dist: () => (/* binding */ dist),\n/* harmony export */ distanceFromCurve: () => (/* binding */ distanceFromCurve),\n/* harmony export */ each: () => (/* binding */ each),\n/* harmony export */ encloses: () => (/* binding */ encloses),\n/* harmony export */ extend: () => (/* binding */ extend),\n/* harmony export */ fastTrim: () => (/* binding */ fastTrim),\n/* harmony export */ filterList: () => (/* binding */ filterList),\n/* harmony export */ filterNull: () => (/* binding */ filterNull),\n/* harmony export */ findAllWithFunction: () => (/* binding */ findAllWithFunction),\n/* harmony export */ findParent: () => (/* binding */ findParent),\n/* harmony export */ findWithFunction: () => (/* binding */ findWithFunction),\n/* harmony export */ fixPrecision: () => (/* binding */ fixPrecision),\n/* harmony export */ forEach: () => (/* binding */ forEach),\n/* harmony export */ fromArray: () => (/* binding */ fromArray),\n/* harmony export */ functionChain: () => (/* binding */ functionChain),\n/* harmony export */ getAllWithFunction: () => (/* binding */ getAllWithFunction),\n/* harmony export */ getClass: () => (/* binding */ getClass),\n/* harmony export */ getDefaultFace: () => (/* binding */ getDefaultFace),\n/* harmony export */ getElementPosition: () => (/* binding */ getElementPosition),\n/* harmony export */ getElementSize: () => (/* binding */ getElementSize),\n/* harmony export */ getElementType: () => (/* binding */ getElementType),\n/* harmony export */ getEventSource: () => (/* binding */ getEventSource),\n/* harmony export */ getFromSetWithFunction: () => (/* binding */ getFromSetWithFunction),\n/* harmony export */ getPageLocation: () => (/* binding */ getPageLocation),\n/* harmony export */ getPositionOnElement: () => (/* binding */ getPositionOnElement),\n/* harmony export */ getTouch: () => (/* binding */ getTouch),\n/* harmony export */ getWithFunction: () => (/* binding */ getWithFunction),\n/* harmony export */ getsert: () => (/* binding */ getsert),\n/* harmony export */ gradient: () => (/* binding */ gradient),\n/* harmony export */ gradientAtPoint: () => (/* binding */ gradientAtPoint),\n/* harmony export */ gradientAtPointAlongPathFrom: () => (/* binding */ gradientAtPointAlongPathFrom),\n/* harmony export */ groupDragConstrain: () => (/* binding */ groupDragConstrain),\n/* harmony export */ hasClass: () => (/* binding */ hasClass),\n/* harmony export */ insertSorted: () => (/* binding */ insertSorted),\n/* harmony export */ intersects: () => (/* binding */ intersects),\n/* harmony export */ isArrayLike: () => (/* binding */ isArrayLike),\n/* harmony export */ isArrowOverlay: () => (/* binding */ isArrowOverlay),\n/* harmony export */ isAssignableFrom: () => (/* binding */ isAssignableFrom),\n/* harmony export */ isBoolean: () => (/* binding */ isBoolean),\n/* harmony export */ isContinuous: () => (/* binding */ isContinuous),\n/* harmony export */ isCustomOverlay: () => (/* binding */ isCustomOverlay),\n/* harmony export */ isDate: () => (/* binding */ isDate),\n/* harmony export */ isDiamondOverlay: () => (/* binding */ isDiamondOverlay),\n/* harmony export */ isDynamic: () => (/* binding */ isDynamic),\n/* harmony export */ isEdgeSupported: () => (/* binding */ isEdgeSupported),\n/* harmony export */ isEmpty: () => (/* binding */ isEmpty),\n/* harmony export */ isFloating: () => (/* binding */ _isFloating),\n/* harmony export */ isFullOverlaySpec: () => (/* binding */ isFullOverlaySpec),\n/* harmony export */ isFunction: () => (/* binding */ isFunction),\n/* harmony export */ isInsideParent: () => (/* binding */ isInsideParent),\n/* harmony export */ isLabelOverlay: () => (/* binding */ isLabelOverlay),\n/* harmony export */ isMouseDevice: () => (/* binding */ isMouseDevice),\n/* harmony export */ isNamedFunction: () => (/* binding */ isNamedFunction),\n/* harmony export */ isNodeList: () => (/* binding */ isNodeList),\n/* harmony export */ isNumber: () => (/* binding */ isNumber),\n/* harmony export */ isObject: () => (/* binding */ isObject),\n/* harmony export */ isPlainArrowOverlay: () => (/* binding */ isPlainArrowOverlay),\n/* harmony export */ isPoint: () => (/* binding */ isPoint),\n/* harmony export */ isSVGElement: () => (/* binding */ isSVGElement),\n/* harmony export */ isString: () => (/* binding */ isString),\n/* harmony export */ isTouchDevice: () => (/* binding */ isTouchDevice),\n/* harmony export */ lineIntersection: () => (/* binding */ lineIntersection),\n/* harmony export */ lineLength: () => (/* binding */ lineLength),\n/* harmony export */ lineRectangleIntersection: () => (/* binding */ lineRectangleIntersection),\n/* harmony export */ locationAlongCurveFrom: () => (/* binding */ locationAlongCurveFrom),\n/* harmony export */ log: () => (/* binding */ log),\n/* harmony export */ logEnabled: () => (/* binding */ logEnabled),\n/* harmony export */ makeLightweightAnchorFromSpec: () => (/* binding */ makeLightweightAnchorFromSpec),\n/* harmony export */ map: () => (/* binding */ map),\n/* harmony export */ matchesSelector: () => (/* binding */ matchesSelector$1),\n/* harmony export */ merge: () => (/* binding */ merge),\n/* harmony export */ nearestPointOnCurve: () => (/* binding */ nearestPointOnCurve),\n/* harmony export */ newInstance: () => (/* binding */ newInstance),\n/* harmony export */ normal: () => (/* binding */ normal),\n/* harmony export */ objectsEqual: () => (/* binding */ objectsEqual),\n/* harmony export */ offsetRelativeToRoot: () => (/* binding */ offsetRelativeToRoot),\n/* harmony export */ offsetSize: () => (/* binding */ offsetSize),\n/* harmony export */ onDocumentReady: () => (/* binding */ onDocumentReady),\n/* harmony export */ pageLocation: () => (/* binding */ pageLocation),\n/* harmony export */ perpendicularLineTo: () => (/* binding */ perpendicularLineTo),\n/* harmony export */ perpendicularToPathAt: () => (/* binding */ perpendicularToPathAt),\n/* harmony export */ pointAlongCurveFrom: () => (/* binding */ pointAlongCurveFrom),\n/* harmony export */ pointAlongPath: () => (/* binding */ pointAlongPath),\n/* harmony export */ pointOnCurve: () => (/* binding */ pointOnCurve),\n/* harmony export */ pointOnLine: () => (/* binding */ pointOnLine),\n/* harmony export */ populate: () => (/* binding */ populate),\n/* harmony export */ quadrant: () => (/* binding */ quadrant),\n/* harmony export */ ready: () => (/* binding */ ready),\n/* harmony export */ registerEndpointRenderer: () => (/* binding */ registerEndpointRenderer),\n/* harmony export */ remove: () => (/* binding */ remove),\n/* harmony export */ removeClass: () => (/* binding */ removeClass),\n/* harmony export */ removeWithFunction: () => (/* binding */ removeWithFunction),\n/* harmony export */ replace: () => (/* binding */ replace),\n/* harmony export */ rotateAnchorOrientation: () => (/* binding */ rotateAnchorOrientation),\n/* harmony export */ rotatePoint: () => (/* binding */ rotatePoint),\n/* harmony export */ setForceMouseEvents: () => (/* binding */ setForceMouseEvents),\n/* harmony export */ setForceTouchEvents: () => (/* binding */ setForceTouchEvents),\n/* harmony export */ setToArray: () => (/* binding */ setToArray),\n/* harmony export */ sgn: () => (/* binding */ sgn$1),\n/* harmony export */ snapToGrid: () => (/* binding */ snapToGrid),\n/* harmony export */ subtract: () => (/* binding */ subtract),\n/* harmony export */ suggest: () => (/* binding */ suggest),\n/* harmony export */ svg: () => (/* binding */ svg),\n/* harmony export */ svgWidthHeightSize: () => (/* binding */ svgWidthHeightSize),\n/* harmony export */ svgXYPosition: () => (/* binding */ svgXYPosition),\n/* harmony export */ theta: () => (/* binding */ theta),\n/* harmony export */ toggleClass: () => (/* binding */ toggleClass),\n/* harmony export */ touchCount: () => (/* binding */ touchCount),\n/* harmony export */ touches: () => (/* binding */ touches),\n/* harmony export */ uuid: () => (/* binding */ uuid),\n/* harmony export */ wrap: () => (/* binding */ wrap)\n/* harmony export */ });\nfunction _typeof(obj) {\n "@babel/helpers - typeof";\n\n if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n}\n\nfunction _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, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\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\n return obj;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== "function" && superClass !== null) {\n throw new TypeError("Super expression must either be null or a function");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === "undefined" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === "function") return true;\n\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === "object" || typeof call === "function")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== "undefined" && Reflect.get) {\n _get = Reflect.get;\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i["return"] != null) _i["return"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _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\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _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\nfunction _nonIterableRest() {\n throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");\n}\n\nfunction filterList(list, value, missingIsFalse) {\n if (list === "*") {\n return true;\n }\n return list.length > 0 ? list.indexOf(value) !== -1 : !missingIsFalse;\n}\nfunction extend(o1, o2, keys) {\n var i;\n o1 = o1 || {};\n o2 = o2 || {};\n var _o1 = o1,\n _o2 = o2;\n if (keys) {\n for (i = 0; i < keys.length; i++) {\n _o1[keys[i]] = _o2[keys[i]];\n }\n } else {\n for (i in _o2) {\n _o1[i] = _o2[i];\n }\n }\n return o1;\n}\nfunction isNumber(n) {\n return Object.prototype.toString.call(n) === "[object Number]";\n}\nfunction isString(s) {\n return typeof s === "string";\n}\nfunction isBoolean(s) {\n return typeof s === "boolean";\n}\nfunction isObject(o) {\n return o == null ? false : Object.prototype.toString.call(o) === "[object Object]";\n}\nfunction isDate(o) {\n return Object.prototype.toString.call(o) === "[object Date]";\n}\nfunction isFunction(o) {\n return Object.prototype.toString.call(o) === "[object Function]";\n}\nfunction isNamedFunction(o) {\n return isFunction(o) && o.name != null && o.name.length > 0;\n}\nfunction isEmpty(o) {\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n return false;\n }\n }\n return true;\n}\nfunction clone(a) {\n if (isString(a)) {\n return "" + a;\n } else if (isBoolean(a)) {\n return !!a;\n } else if (isDate(a)) {\n return new Date(a.getTime());\n } else if (isFunction(a)) {\n return a;\n } else if (Array.isArray(a)) {\n var _b = [];\n for (var i = 0; i < a.length; i++) {\n _b.push(clone(a[i]));\n }\n return _b;\n } else if (isObject(a)) {\n var c = {};\n for (var j in a) {\n c[j] = clone(a[j]);\n }\n return c;\n } else {\n return a;\n }\n}\nfunction filterNull(obj) {\n var o = {};\n for (var k in obj) {\n if (obj[k] != null) {\n o[k] = obj[k];\n }\n }\n return o;\n}\nfunction merge(a, b, collations, overwrites) {\n var cMap = {},\n ar,\n i,\n oMap = {};\n collations = collations || [];\n overwrites = overwrites || [];\n for (i = 0; i < collations.length; i++) {\n cMap[collations[i]] = true;\n }\n for (i = 0; i < overwrites.length; i++) {\n oMap[overwrites[i]] = true;\n }\n var c = clone(a);\n for (i in b) {\n if (c[i] == null || oMap[i]) {\n c[i] = b[i];\n } else if (cMap[i]) {\n ar = [];\n ar.push.apply(ar, Array.isArray(c[i]) ? c[i] : [c[i]]);\n ar.push(b[i]);\n c[i] = ar;\n } else if (isString(b[i]) || isBoolean(b[i]) || isFunction(b[i]) || isNumber(b[i])) {\n c[i] = b[i];\n } else {\n if (Array.isArray(b[i])) {\n ar = [];\n if (Array.isArray(c[i])) {\n ar.push.apply(ar, c[i]);\n }\n ar.push.apply(ar, b[i]);\n c[i] = ar;\n } else if (isObject(b[i])) {\n if (!isObject(c[i])) {\n c[i] = {};\n }\n for (var j in b[i]) {\n c[i][j] = b[i][j];\n }\n }\n }\n }\n return c;\n}\nfunction _areEqual(a, b) {\n if (a != null && b == null) {\n return false;\n } else {\n if ((a == null || isString(a) || isBoolean(a) || isNumber(a)) && a !== b) {\n return false;\n } else {\n if (Array.isArray(a)) {\n if (!Array.isArray(b)) {\n return false;\n } else {\n if (!arraysEqual(a, b)) {\n return false;\n }\n }\n } else if (isObject(a)) {\n if (!isObject(a)) {\n return false;\n } else {\n if (!objectsEqual(a, b)) {\n return false;\n }\n }\n }\n }\n }\n return true;\n}\nfunction arraysEqual(a, b) {\n if (a == null && b == null) {\n return true;\n } else if (a == null && b != null) {\n return false;\n } else if (a != null && b == null) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n } else {\n for (var i = 0; i < a.length; i++) {\n if (!_areEqual(a[i], b[i])) {\n return false;\n }\n }\n }\n return true;\n}\nfunction objectsEqual(a, b) {\n if (a == null && b == null) {\n return true;\n } else if (a == null && b != null) {\n return false;\n } else if (a != null && b == null) {\n return false;\n }\n for (var key in a) {\n var va = a[key],\n vb = b[key];\n if (!_areEqual(va, vb)) {\n return false;\n }\n }\n return true;\n}\nfunction replace(inObj, path, value) {\n if (inObj == null) {\n return;\n }\n var q = inObj,\n t = q;\n path.replace(/([^\\.])+/g, function (term, lc, pos, str) {\n var array = term.match(/([^\\[0-9]+){1}(\\[)([0-9+])/),\n last = pos + term.length >= str.length,\n _getArray = function _getArray() {\n return t[array[1]] || function () {\n t[array[1]] = [];\n return t[array[1]];\n }();\n };\n if (last) {\n if (array) {\n _getArray()[array[3]] = value;\n } else {\n t[term] = value;\n }\n } else {\n if (array) {\n var _a2 = _getArray();\n t = _a2[array[3]] || function () {\n _a2[array[3]] = {};\n return _a2[array[3]];\n }();\n } else {\n t = t[term] || function () {\n t[term] = {};\n return t[term];\n }();\n }\n }\n return "";\n });\n return inObj;\n}\nfunction functionChain(successValue, failValue, fns) {\n for (var i = 0; i < fns.length; i++) {\n var o = fns[i][0][fns[i][1]].apply(fns[i][0], fns[i][2]);\n if (o === failValue) {\n return o;\n }\n }\n return successValue;\n}\nfunction populate(model, values, functionPrefix, doNotExpandFunctions) {\n var getValue = function getValue(fromString) {\n var matches = fromString.match(/(\\${.*?})/g);\n if (matches != null) {\n for (var i = 0; i < matches.length; i++) {\n var val = values[matches[i].substring(2, matches[i].length - 1)] || "";\n if (val != null) {\n fromString = fromString.replace(matches[i], val);\n }\n }\n }\n matches = fromString.match(/({{.*?}})/g);\n if (matches != null) {\n for (var _i = 0; _i < matches.length; _i++) {\n var _val = values[matches[_i].substring(2, matches[_i].length - 2)] || "";\n if (_val != null) {\n fromString = fromString.replace(matches[_i], _val);\n }\n }\n }\n return fromString;\n };\n var _one = function _one(d) {\n if (d != null) {\n if (isString(d)) {\n return getValue(d);\n } else if (isFunction(d) && !doNotExpandFunctions && (functionPrefix == null || (d.name || "").indexOf(functionPrefix) === 0)) {\n return d(values);\n } else if (Array.isArray(d)) {\n var r = [];\n for (var i = 0; i < d.length; i++) {\n r.push(_one(d[i]));\n }\n return r;\n } else if (isObject(d)) {\n var s = {};\n for (var j in d) {\n s[j] = _one(d[j]);\n }\n return s;\n } else {\n return d;\n }\n }\n };\n return _one(model);\n}\nfunction forEach(a, f) {\n if (a) {\n for (var i = 0; i < a.length; i++) {\n f(a[i]);\n }\n } else {\n return null;\n }\n}\nfunction findWithFunction(a, f) {\n if (a) {\n for (var i = 0; i < a.length; i++) {\n if (f(a[i])) {\n return i;\n }\n }\n }\n return -1;\n}\nfunction findAllWithFunction(a, predicate) {\n var o = [];\n if (a) {\n for (var i = 0; i < a.length; i++) {\n if (predicate(a[i])) {\n o.push(i);\n }\n }\n }\n return o;\n}\nfunction getWithFunction(a, f) {\n var idx = findWithFunction(a, f);\n return idx === -1 ? null : a[idx];\n}\nfunction getAllWithFunction(a, f) {\n var indexes = findAllWithFunction(a, f);\n return indexes.map(function (i) {\n return a[i];\n });\n}\nfunction getFromSetWithFunction(s, f) {\n var out = null;\n s.forEach(function (t) {\n if (f(t)) {\n out = t;\n }\n });\n return out;\n}\nfunction setToArray(s) {\n var a = [];\n s.forEach(function (t) {\n a.push(t);\n });\n return a;\n}\nfunction removeWithFunction(a, f) {\n var idx = findWithFunction(a, f);\n if (idx > -1) {\n a.splice(idx, 1);\n }\n return idx !== -1;\n}\nfunction fromArray(a) {\n if (Array.fromArray != null) {\n return Array.from(a);\n } else {\n var arr = [];\n Array.prototype.push.apply(arr, a);\n return arr;\n }\n}\nfunction remove(l, v) {\n var idx = l.indexOf(v);\n if (idx > -1) {\n l.splice(idx, 1);\n }\n return idx !== -1;\n}\nfunction addWithFunction(list, item, hashFunction) {\n if (findWithFunction(list, hashFunction) === -1) {\n list.push(item);\n }\n}\nfunction addToDictionary(map, key, value, insertAtStart) {\n var l = map[key];\n if (l == null) {\n l = [];\n map[key] = l;\n }\n l[insertAtStart ? "unshift" : "push"](value);\n return l;\n}\nfunction addToList(map, key, value, insertAtStart) {\n var l = map.get(key);\n if (l == null) {\n l = [];\n map.set(key, l);\n }\n l[insertAtStart ? "unshift" : "push"](value);\n return l;\n}\nfunction suggest(list, item, insertAtHead) {\n if (list.indexOf(item) === -1) {\n if (insertAtHead) {\n list.unshift(item);\n } else {\n list.push(item);\n }\n return true;\n }\n return false;\n}\nvar lut$1 = [];\nfor (var i$1 = 0; i$1 < 256; i$1++) {\n lut$1[i$1] = (i$1 < 16 ? \'0\' : \'\') + i$1.toString(16);\n}\nfunction uuid() {\n var d0 = Math.random() * 0xffffffff | 0;\n var d1 = Math.random() * 0xffffffff | 0;\n var d2 = Math.random() * 0xffffffff | 0;\n var d3 = Math.random() * 0xffffffff | 0;\n return lut$1[d0 & 0xff] + lut$1[d0 >> 8 & 0xff] + lut$1[d0 >> 16 & 0xff] + lut$1[d0 >> 24 & 0xff] + \'-\' + lut$1[d1 & 0xff] + lut$1[d1 >> 8 & 0xff] + \'-\' + lut$1[d1 >> 16 & 0x0f | 0x40] + lut$1[d1 >> 24 & 0xff] + \'-\' + lut$1[d2 & 0x3f | 0x80] + lut$1[d2 >> 8 & 0xff] + \'-\' + lut$1[d2 >> 16 & 0xff] + lut$1[d2 >> 24 & 0xff] + lut$1[d3 & 0xff] + lut$1[d3 >> 8 & 0xff] + lut$1[d3 >> 16 & 0xff] + lut$1[d3 >> 24 & 0xff];\n}\nfunction rotatePoint(point, center, rotation) {\n var radial = {\n x: point.x - center.x,\n y: point.y - center.y\n },\n cr = Math.cos(rotation / 360 * Math.PI * 2),\n sr = Math.sin(rotation / 360 * Math.PI * 2);\n return {\n x: radial.x * cr - radial.y * sr + center.x,\n y: radial.y * cr + radial.x * sr + center.y,\n cr: cr,\n sr: sr\n };\n}\nfunction rotateAnchorOrientation(orientation, rotation) {\n var r = rotatePoint({\n x: orientation[0],\n y: orientation[1]\n }, {\n x: 0,\n y: 0\n }, rotation);\n return [Math.round(r.x), Math.round(r.y)];\n}\nfunction fastTrim(s) {\n if (s == null) {\n return null;\n }\n var str = s.replace(/^\\s\\s*/, \'\'),\n ws = /\\s/,\n i = str.length;\n while (ws.test(str.charAt(--i))) {}\n return str.slice(0, i + 1);\n}\nfunction each(obj, fn) {\n obj = obj.length == null || typeof obj === "string" ? [obj] : obj;\n for (var _i2 = 0; _i2 < obj.length; _i2++) {\n fn(obj[_i2]);\n }\n}\nfunction map(obj, fn) {\n var o = [];\n for (var _i3 = 0; _i3 < obj.length; _i3++) {\n o.push(fn(obj[_i3]));\n }\n return o;\n}\nvar logEnabled = true;\nfunction log() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof console !== "undefined") {\n try {\n var msg = arguments[arguments.length - 1];\n console.log(msg);\n } catch (e) {}\n }\n}\nfunction sgn$1(x) {\n return x < 0 ? -1 : x > 0 ? 1 : 0;\n}\nfunction wrap(wrappedFunction, newFunction, returnOnThisValue) {\n return function () {\n var r = null;\n try {\n if (newFunction != null) {\n r = newFunction.apply(this, arguments);\n }\n } catch (e) {\n log("jsPlumb function failed : " + e);\n }\n if (wrappedFunction != null && (returnOnThisValue == null || r !== returnOnThisValue)) {\n try {\n r = wrappedFunction.apply(this, arguments);\n } catch (e) {\n log("wrapped function failed : " + e);\n }\n }\n return r;\n };\n}\nfunction getsert(map, key, valueGenerator) {\n if (!map.has(key)) {\n map.set(key, valueGenerator());\n }\n return map.get(key);\n}\nfunction isAssignableFrom(object, cls) {\n var proto = object.__proto__;\n while (proto != null) {\n if (proto instanceof cls) {\n return true;\n } else {\n proto = proto.__proto__;\n }\n }\n return false;\n}\nfunction insertSorted(value, array, comparator, sortDescending) {\n if (array.length === 0) {\n array.push(value);\n } else {\n var flip = sortDescending ? -1 : 1;\n var min = 0;\n var max = array.length;\n var index = Math.floor((min + max) / 2);\n while (max > min) {\n var c = comparator(value, array[index]) * flip;\n if (c < 0) {\n max = index;\n } else {\n min = index + 1;\n }\n index = Math.floor((min + max) / 2);\n }\n array.splice(index, 0, value);\n }\n}\n\nfunction matchesSelector$1(el, selector, ctx) {\n ctx = ctx || el.parentNode;\n var possibles = ctx.querySelectorAll(selector);\n for (var i = 0; i < possibles.length; i++) {\n if (possibles[i] === el) {\n return true;\n }\n }\n return false;\n}\nfunction consume(e, doNotPreventDefault) {\n if (e.stopPropagation) {\n e.stopPropagation();\n } else {\n e.returnValue = false;\n }\n if (!doNotPreventDefault && e.preventDefault) {\n e.preventDefault();\n }\n}\nfunction findParent(el, selector, container, matchOnElementAlso) {\n if (matchOnElementAlso && matchesSelector$1(el, selector, container)) {\n return el;\n } else {\n el = el.parentNode;\n }\n while (el != null && el !== container) {\n if (matchesSelector$1(el, selector)) {\n return el;\n } else {\n el = el.parentNode;\n }\n }\n}\nfunction getEventSource(e) {\n return e.srcElement || e.target;\n}\nfunction _setClassName(el, cn, classList) {\n cn = fastTrim(cn);\n if (typeof el.className.baseVal !== "undefined") {\n el.className.baseVal = cn;\n } else {\n el.className = cn;\n }\n try {\n var cl = el.classList;\n if (cl != null) {\n while (cl.length > 0) {\n cl.remove(cl.item(0));\n }\n for (var i = 0; i < classList.length; i++) {\n if (classList[i]) {\n cl.add(classList[i]);\n }\n }\n }\n } catch (e) {\n log("WARN: cannot set class list", e);\n }\n}\nfunction _getClassName(el) {\n return el.className != null ? typeof el.className.baseVal === "undefined" ? el.className : el.className.baseVal : "";\n}\nfunction _classManip(el, classesToAdd, classesToRemove) {\n var cta = classesToAdd == null ? [] : Array.isArray(classesToAdd) ? classesToAdd : classesToAdd.split(/\\s+/);\n var ctr = classesToRemove == null ? [] : Array.isArray(classesToRemove) ? classesToRemove : classesToRemove.split(/\\s+/);\n var className = _getClassName(el),\n curClasses = className.split(/\\s+/);\n var _oneSet = function _oneSet(add, classes) {\n for (var i = 0; i < classes.length; i++) {\n if (add) {\n if (curClasses.indexOf(classes[i]) === -1) {\n curClasses.push(classes[i]);\n }\n } else {\n var idx = curClasses.indexOf(classes[i]);\n if (idx !== -1) {\n curClasses.splice(idx, 1);\n }\n }\n }\n };\n _oneSet(true, cta);\n _oneSet(false, ctr);\n _setClassName(el, curClasses.join(" "), curClasses);\n}\nfunction isNodeList(el) {\n return !isString(el) && !Array.isArray(el) && el.length != null && el.documentElement == null && el.nodeType == null;\n}\nfunction isArrayLike(el) {\n return !isString(el) && (Array.isArray(el) || isNodeList(el));\n}\nfunction getClass(el) {\n return _getClassName(el);\n}\nfunction addClass(el, clazz) {\n var _one = function _one(el, clazz) {\n if (el != null && clazz != null && clazz.length > 0) {\n if (el.classList) {\n var parts = fastTrim(clazz).split(/\\s+/);\n forEach(parts, function (part) {\n el.classList.add(part);\n });\n } else {\n _classManip(el, clazz);\n }\n }\n };\n if (isNodeList(el)) {\n forEach(el, function (el) {\n return _one(el, clazz);\n });\n } else {\n _one(el, clazz);\n }\n}\nfunction hasClass(el, clazz) {\n if (el.classList) {\n return el.classList.contains(clazz);\n } else {\n return _getClassName(el).indexOf(clazz) !== -1;\n }\n}\nfunction removeClass(el, clazz) {\n var _one = function _one(el, clazz) {\n if (el != null && clazz != null && clazz.length > 0) {\n if (el.classList) {\n var parts = fastTrim(clazz).split(/\\s+/);\n parts.forEach(function (part) {\n el.classList.remove(part);\n });\n } else {\n _classManip(el, null, clazz);\n }\n }\n };\n if (isNodeList(el)) {\n forEach(el, function (el) {\n return _one(el, clazz);\n });\n } else {\n _one(el, clazz);\n }\n}\nfunction toggleClass(el, clazz) {\n var _this = this;\n var _one = function _one(el, clazz) {\n if (el != null && clazz != null && clazz.length > 0) {\n if (el.classList) {\n el.classList.toggle(clazz);\n } else {\n if (_this.hasClass(el, clazz)) {\n _this.removeClass(el, clazz);\n } else {\n _this.addClass(el, clazz);\n }\n }\n }\n };\n if (isNodeList(el)) {\n forEach(el, function (el) {\n return _one(el, clazz);\n });\n } else {\n _one(el, clazz);\n }\n}\nfunction createElement(tag, style, clazz, atts) {\n return createElementNS(null, tag, style, clazz, atts);\n}\nfunction createElementNS(ns, tag, style, clazz, atts) {\n var e = ns == null ? document.createElement(tag) : document.createElementNS(ns, tag);\n var i;\n style = style || {};\n for (i in style) {\n e.style[i] = style[i];\n }\n if (clazz) {\n e.className = clazz;\n }\n atts = atts || {};\n for (i in atts) {\n e.setAttribute(i, "" + atts[i]);\n }\n return e;\n}\nfunction offsetRelativeToRoot(el) {\n var box = el.getBoundingClientRect(),\n body = document.body,\n docElem = document.documentElement,\n scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop,\n scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft,\n clientTop = docElem.clientTop || body.clientTop || 0,\n clientLeft = docElem.clientLeft || body.clientLeft || 0,\n top = box.top + scrollTop - clientTop,\n left = box.left + scrollLeft - clientLeft;\n return {\n x: Math.round(left),\n y: Math.round(top)\n };\n}\nfunction offsetSize(el) {\n return {\n w: el.offsetWidth,\n h: el.offsetHeight\n };\n}\nfunction svgWidthHeightSize(el) {\n try {\n return {\n w: parseFloat(el.width.baseVal.value),\n h: parseFloat(el.height.baseVal.value)\n };\n } catch (e) {\n return {\n w: 0,\n h: 0\n };\n }\n}\nfunction svgXYPosition(el) {\n try {\n return {\n x: parseFloat(el.x.baseVal.value),\n y: parseFloat(el.y.baseVal.value)\n };\n } catch (e) {\n return {\n x: 0,\n y: 0\n };\n }\n}\nfunction getElementPosition(el, instance) {\n var pc = instance.getContainer().getBoundingClientRect();\n var ec = el.getBoundingClientRect();\n var z = instance.currentZoom;\n return {\n x: (ec.left - pc.left) / z,\n y: (ec.top - pc.top) / z\n };\n}\nfunction getElementSize(el, instance) {\n var ec = el.getBoundingClientRect();\n var z = instance.currentZoom;\n return {\n w: ec.width / z,\n h: ec.height / z\n };\n}\nvar ElementTypes;\n(function (ElementTypes) {\n ElementTypes["SVG"] = "SVG";\n ElementTypes["HTML"] = "HTML";\n})(ElementTypes || (ElementTypes = {}));\nfunction getElementType(el) {\n return el instanceof SVGElement ? ElementTypes.SVG : ElementTypes.HTML;\n}\nfunction isSVGElement(el) {\n return getElementType(el) === ElementTypes.SVG;\n}\nfunction onDocumentReady(f) {\n var _do = function _do() {\n if (/complete|loaded|interactive/.test(document.readyState) && typeof document.body !== "undefined" && document.body != null) {\n f();\n } else {\n setTimeout(_do, 9);\n }\n };\n _do();\n}\n\nfunction cls() {\n for (var _len = arguments.length, className = new Array(_len), _key = 0; _key < _len; _key++) {\n className[_key] = arguments[_key];\n }\n return className.map(function (cn) {\n return "." + cn;\n }).join(",");\n}\nfunction classList() {\n for (var _len2 = arguments.length, className = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n className[_key2] = arguments[_key2];\n }\n return className.join(" ");\n}\nfunction att() {\n for (var _len3 = arguments.length, attName = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n attName[_key3] = arguments[_key3];\n }\n return attName.map(function (an) {\n return "[" + an + "]";\n }).join(",");\n}\nvar SOURCE = "source";\nvar TARGET = "target";\nvar BLOCK = "block";\nvar NONE = "none";\nvar SOURCE_INDEX = 0;\nvar TARGET_INDEX = 1;\nvar ABSOLUTE = "absolute";\nvar FIXED = "fixed";\nvar STATIC = "static";\nvar ATTRIBUTE_GROUP = "data-jtk-group";\nvar ATTRIBUTE_MANAGED = "data-jtk-managed";\nvar ATTRIBUTE_NOT_DRAGGABLE = "data-jtk-not-draggable";\nvar ATTRIBUTE_TABINDEX = "tabindex";\nvar ATTRIBUTE_SCOPE = "data-jtk-scope";\nvar ATTRIBUTE_SCOPE_PREFIX = ATTRIBUTE_SCOPE + "-";\nvar CHECK_CONDITION = "checkCondition";\nvar CHECK_DROP_ALLOWED = "checkDropAllowed";\nvar CLASS_CONNECTOR = "jtk-connector";\nvar CLASS_CONNECTOR_OUTLINE = "jtk-connector-outline";\nvar CLASS_CONNECTED = "jtk-connected";\nvar CLASS_ENDPOINT = "jtk-endpoint";\nvar CLASS_ENDPOINT_CONNECTED = "jtk-endpoint-connected";\nvar CLASS_ENDPOINT_FULL = "jtk-endpoint-full";\nvar CLASS_ENDPOINT_FLOATING = "jtk-floating-endpoint";\nvar CLASS_ENDPOINT_DROP_ALLOWED = "jtk-endpoint-drop-allowed";\nvar CLASS_ENDPOINT_DROP_FORBIDDEN = "jtk-endpoint-drop-forbidden";\nvar CLASS_ENDPOINT_ANCHOR_PREFIX = "jtk-endpoint-anchor";\nvar CLASS_GROUP_COLLAPSED = "jtk-group-collapsed";\nvar CLASS_GROUP_EXPANDED = "jtk-group-expanded";\nvar CLASS_OVERLAY = "jtk-overlay";\nvar EVENT_ANCHOR_CHANGED = "anchor:changed";\nvar EVENT_CONNECTION = "connection";\nvar EVENT_INTERNAL_CONNECTION = "internal.connection";\nvar EVENT_CONNECTION_DETACHED = "connection:detach";\nvar EVENT_CONNECTION_MOVED = "connection:move";\nvar EVENT_CONTAINER_CHANGE = "container:change";\nvar EVENT_ENDPOINT_REPLACED = "endpoint:replaced";\nvar EVENT_INTERNAL_ENDPOINT_UNREGISTERED = "internal.endpoint:unregistered";\nvar EVENT_INTERNAL_CONNECTION_DETACHED = "internal.connection:detached";\nvar EVENT_MANAGE_ELEMENT = "element:manage";\nvar EVENT_GROUP_ADDED = "group:added";\nvar EVENT_GROUP_COLLAPSE = "group:collapse";\nvar EVENT_GROUP_EXPAND = "group:expand";\nvar EVENT_GROUP_MEMBER_ADDED = "group:member:added";\nvar EVENT_GROUP_MEMBER_REMOVED = "group:member:removed";\nvar EVENT_GROUP_REMOVED = "group:removed";\nvar EVENT_MAX_CONNECTIONS = "maxConnections";\nvar EVENT_NESTED_GROUP_ADDED = "group:nested:added";\nvar EVENT_NESTED_GROUP_REMOVED = "group:nested:removed";\nvar EVENT_UNMANAGE_ELEMENT = "element:unmanage";\nvar EVENT_ZOOM = "zoom";\nvar IS_DETACH_ALLOWED = "isDetachAllowed";\nvar INTERCEPT_BEFORE_DRAG = "beforeDrag";\nvar INTERCEPT_BEFORE_DROP = "beforeDrop";\nvar INTERCEPT_BEFORE_DETACH = "beforeDetach";\nvar INTERCEPT_BEFORE_START_DETACH = "beforeStartDetach";\nvar SELECTOR_MANAGED_ELEMENT = att(ATTRIBUTE_MANAGED);\nvar ERROR_SOURCE_ENDPOINT_FULL = "Cannot establish connection: source endpoint is full";\nvar ERROR_TARGET_ENDPOINT_FULL = "Cannot establish connection: target endpoint is full";\nvar ERROR_SOURCE_DOES_NOT_EXIST = "Cannot establish connection: source does not exist";\nvar ERROR_TARGET_DOES_NOT_EXIST = "Cannot establish connection: target does not exist";\nvar KEY_CONNECTION_OVERLAYS = "connectionOverlays";\n\nvar svgAttributeMap = {\n "stroke-linejoin": "stroke-linejoin",\n "stroke-dashoffset": "stroke-dashoffset",\n "stroke-linecap": "stroke-linecap"\n};\nvar STROKE_DASHARRAY = "stroke-dasharray";\nvar DASHSTYLE = "dashstyle";\nvar FILL = "fill";\nvar STROKE = "stroke";\nvar STROKE_WIDTH = "stroke-width";\nvar LINE_WIDTH = "strokeWidth";\nvar ELEMENT_SVG = "svg";\nvar ELEMENT_PATH = "path";\nvar ns = {\n svg: "http://www.w3.org/2000/svg"\n};\nfunction _attr(node, attributes) {\n for (var i in attributes) {\n node.setAttribute(i, "" + attributes[i]);\n }\n}\nfunction _node(name, attributes) {\n attributes = attributes || {};\n attributes.version = "1.1";\n attributes.xmlns = ns.svg;\n return createElementNS(ns.svg, name, null, null, attributes);\n}\nfunction _pos(d) {\n return "position:absolute;left:" + d[0] + "px;top:" + d[1] + "px";\n}\nfunction _applyStyles(parent, node, style) {\n node.setAttribute(FILL, style.fill ? style.fill : NONE);\n node.setAttribute(STROKE, style.stroke ? style.stroke : NONE);\n if (style.strokeWidth) {\n node.setAttribute(STROKE_WIDTH, style.strokeWidth);\n }\n if (style[DASHSTYLE] && style[LINE_WIDTH] && !style[STROKE_DASHARRAY]) {\n var sep = style[DASHSTYLE].indexOf(",") === -1 ? " " : ",",\n parts = style[DASHSTYLE].split(sep),\n styleToUse = "";\n forEach(parts, function (p) {\n styleToUse += Math.floor(p * style.strokeWidth) + sep;\n });\n node.setAttribute(STROKE_DASHARRAY, styleToUse);\n } else if (style[STROKE_DASHARRAY]) {\n node.setAttribute(STROKE_DASHARRAY, style[STROKE_DASHARRAY]);\n }\n for (var i in svgAttributeMap) {\n if (style[i]) {\n node.setAttribute(svgAttributeMap[i], style[i]);\n }\n }\n}\nfunction _appendAtIndex(svg, path, idx) {\n if (svg.childNodes.length > idx) {\n svg.insertBefore(path, svg.childNodes[idx]);\n } else {\n svg.appendChild(path);\n }\n}\nvar svg = {\n attr: _attr,\n node: _node,\n ns: ns\n};\n\nfunction compoundEvent(stem, event, subevent) {\n var a = [stem, event];\n if (subevent) {\n a.push(subevent);\n }\n return a.join(":");\n}\nvar ATTRIBUTE_CONTAINER = "data-jtk-container";\nvar ATTRIBUTE_GROUP_CONTENT = "data-jtk-group-content";\nvar ATTRIBUTE_JTK_ENABLED = "data-jtk-enabled";\nvar ATTRIBUTE_JTK_SCOPE = "data-jtk-scope";\nvar ENDPOINT = "endpoint";\nvar ELEMENT = "element";\nvar CONNECTION = "connection";\nvar ELEMENT_DIV = "div";\nvar EVENT_CLICK = "click";\nvar EVENT_CONTEXTMENU = "contextmenu";\nvar EVENT_DBL_CLICK = "dblclick";\nvar EVENT_DBL_TAP = "dbltap";\nvar EVENT_FOCUS = "focus";\nvar EVENT_MOUSEDOWN = "mousedown";\nvar EVENT_MOUSEENTER = "mouseenter";\nvar EVENT_MOUSEEXIT = "mouseexit";\nvar EVENT_MOUSEMOVE = "mousemove";\nvar EVENT_MOUSEUP = "mouseup";\nvar EVENT_MOUSEOUT = "mouseout";\nvar EVENT_MOUSEOVER = "mouseover";\nvar EVENT_TAP = "tap";\nvar EVENT_TOUCHSTART = "touchstart";\nvar EVENT_TOUCHEND = "touchend";\nvar EVENT_TOUCHMOVE = "touchmove";\nvar EVENT_DRAG_MOVE = "drag:move";\nvar EVENT_DRAG_STOP = "drag:stop";\nvar EVENT_DRAG_START = "drag:start";\nvar EVENT_REVERT = "revert";\nvar EVENT_CONNECTION_ABORT = "connection:abort";\nvar EVENT_CONNECTION_DRAG = "connection:drag";\nvar EVENT_ELEMENT_CLICK = compoundEvent(ELEMENT, EVENT_CLICK);\nvar EVENT_ELEMENT_DBL_CLICK = compoundEvent(ELEMENT, EVENT_DBL_CLICK);\nvar EVENT_ELEMENT_DBL_TAP = compoundEvent(ELEMENT, EVENT_DBL_TAP);\nvar EVENT_ELEMENT_MOUSE_OUT = compoundEvent(ELEMENT, EVENT_MOUSEOUT);\nvar EVENT_ELEMENT_MOUSE_OVER = compoundEvent(ELEMENT, EVENT_MOUSEOVER);\nvar EVENT_ELEMENT_MOUSE_MOVE = compoundEvent(ELEMENT, EVENT_MOUSEMOVE);\nvar EVENT_ELEMENT_MOUSE_UP = compoundEvent(ELEMENT, EVENT_MOUSEUP);\nvar EVENT_ELEMENT_MOUSE_DOWN = compoundEvent(ELEMENT, EVENT_MOUSEDOWN);\nvar EVENT_ELEMENT_CONTEXTMENU = compoundEvent(ELEMENT, EVENT_CONTEXTMENU);\nvar EVENT_ELEMENT_TAP = compoundEvent(ELEMENT, EVENT_TAP);\nvar EVENT_ENDPOINT_CLICK = compoundEvent(ENDPOINT, EVENT_CLICK);\nvar EVENT_ENDPOINT_DBL_CLICK = compoundEvent(ENDPOINT, EVENT_DBL_CLICK);\nvar EVENT_ENDPOINT_DBL_TAP = compoundEvent(ENDPOINT, EVENT_DBL_TAP);\nvar EVENT_ENDPOINT_MOUSEOUT = compoundEvent(ENDPOINT, EVENT_MOUSEOUT);\nvar EVENT_ENDPOINT_MOUSEOVER = compoundEvent(ENDPOINT, EVENT_MOUSEOVER);\nvar EVENT_ENDPOINT_MOUSEUP = compoundEvent(ENDPOINT, EVENT_MOUSEUP);\nvar EVENT_ENDPOINT_MOUSEDOWN = compoundEvent(ENDPOINT, EVENT_MOUSEDOWN);\nvar EVENT_ENDPOINT_TAP = compoundEvent(ENDPOINT, EVENT_TAP);\nvar EVENT_CONNECTION_CLICK = compoundEvent(CONNECTION, EVENT_CLICK);\nvar EVENT_CONNECTION_DBL_CLICK = compoundEvent(CONNECTION, EVENT_DBL_CLICK);\nvar EVENT_CONNECTION_DBL_TAP = compoundEvent(CONNECTION, EVENT_DBL_TAP);\nvar EVENT_CONNECTION_MOUSEOUT = compoundEvent(CONNECTION, EVENT_MOUSEOUT);\nvar EVENT_CONNECTION_MOUSEOVER = compoundEvent(CONNECTION, EVENT_MOUSEOVER);\nvar EVENT_CONNECTION_MOUSEUP = compoundEvent(CONNECTION, EVENT_MOUSEUP);\nvar EVENT_CONNECTION_MOUSEDOWN = compoundEvent(CONNECTION, EVENT_MOUSEDOWN);\nvar EVENT_CONNECTION_CONTEXTMENU = compoundEvent(CONNECTION, EVENT_CONTEXTMENU);\nvar EVENT_CONNECTION_TAP = compoundEvent(CONNECTION, EVENT_TAP);\nvar PROPERTY_POSITION = "position";\nvar SELECTOR_CONNECTOR = cls(CLASS_CONNECTOR);\nvar SELECTOR_ENDPOINT = cls(CLASS_ENDPOINT);\nvar SELECTOR_GROUP = att(ATTRIBUTE_GROUP);\nvar SELECTOR_GROUP_CONTAINER = att(ATTRIBUTE_GROUP_CONTENT);\nvar SELECTOR_OVERLAY = cls(CLASS_OVERLAY);\n\nvar PerimeterAnchorShapes;\n(function (PerimeterAnchorShapes) {\n PerimeterAnchorShapes["Circle"] = "Circle";\n PerimeterAnchorShapes["Ellipse"] = "Ellipse";\n PerimeterAnchorShapes["Triangle"] = "Triangle";\n PerimeterAnchorShapes["Diamond"] = "Diamond";\n PerimeterAnchorShapes["Rectangle"] = "Rectangle";\n PerimeterAnchorShapes["Square"] = "Square";\n})(PerimeterAnchorShapes || (PerimeterAnchorShapes = {}));\nvar AnchorLocations;\n(function (AnchorLocations) {\n AnchorLocations["Assign"] = "Assign";\n AnchorLocations["AutoDefault"] = "AutoDefault";\n AnchorLocations["Bottom"] = "Bottom";\n AnchorLocations["BottomLeft"] = "BottomLeft";\n AnchorLocations["BottomRight"] = "BottomRight";\n AnchorLocations["Center"] = "Center";\n AnchorLocations["Continuous"] = "Continuous";\n AnchorLocations["ContinuousBottom"] = "ContinuousBottom";\n AnchorLocations["ContinuousLeft"] = "ContinuousLeft";\n AnchorLocations["ContinuousRight"] = "ContinuousRight";\n AnchorLocations["ContinuousTop"] = "ContinuousTop";\n AnchorLocations["ContinuousLeftRight"] = "ContinuousLeftRight";\n AnchorLocations["ContinuousTopBottom"] = "ContinuousTopBottom";\n AnchorLocations["Left"] = "Left";\n AnchorLocations["Perimeter"] = "Perimeter";\n AnchorLocations["Right"] = "Right";\n AnchorLocations["Top"] = "Top";\n AnchorLocations["TopLeft"] = "TopLeft";\n AnchorLocations["TopRight"] = "TopRight";\n})(AnchorLocations || (AnchorLocations = {}));\n\nfunction noSuchPoint() {\n return {\n d: Infinity,\n x: null,\n y: null,\n l: null,\n x1: null,\n y1: null,\n x2: null,\n y2: null\n };\n}\nfunction EMPTY_BOUNDS() {\n return {\n xmin: Infinity,\n xmax: -Infinity,\n ymin: Infinity,\n ymax: -Infinity\n };\n}\nvar AbstractSegment = function () {\n function AbstractSegment(params) {\n _classCallCheck(this, AbstractSegment);\n this.params = params;\n _defineProperty(this, "x1", void 0);\n _defineProperty(this, "x2", void 0);\n _defineProperty(this, "y1", void 0);\n _defineProperty(this, "y2", void 0);\n _defineProperty(this, "extents", EMPTY_BOUNDS());\n _defineProperty(this, "type", void 0);\n this.x1 = params.x1;\n this.y1 = params.y1;\n this.x2 = params.x2;\n this.y2 = params.y2;\n }\n _createClass(AbstractSegment, [{\n key: "findClosestPointOnPath",\n value: function findClosestPointOnPath(x, y) {\n return noSuchPoint();\n }\n }, {\n key: "lineIntersection",\n value: function lineIntersection(x1, y1, x2, y2) {\n return [];\n }\n }, {\n key: "boxIntersection",\n value: function boxIntersection(x, y, w, h) {\n var a = [];\n a.push.apply(a, this.lineIntersection(x, y, x + w, y));\n a.push.apply(a, this.lineIntersection(x + w, y, x + w, y + h));\n a.push.apply(a, this.lineIntersection(x + w, y + h, x, y + h));\n a.push.apply(a, this.lineIntersection(x, y + h, x, y));\n return a;\n }\n }, {\n key: "boundingBoxIntersection",\n value: function boundingBoxIntersection(box) {\n return this.boxIntersection(box.x, box.y, box.w, box.h);\n }\n }]);\n return AbstractSegment;\n}();\n\nvar UNDEFINED = "undefined";\nvar DEFAULT = "default";\nvar TRUE$1 = "true";\nvar FALSE$1 = "false";\nvar WILDCARD = "*";\n\nvar _touchMap, _tapProfiles2;\nfunction _touch(target, pageX, pageY, screenX, screenY, clientX, clientY) {\n return new Touch({\n target: target,\n identifier: uuid(),\n pageX: pageX,\n pageY: pageY,\n screenX: screenX,\n screenY: screenY,\n clientX: clientX || screenX,\n clientY: clientY || screenY\n });\n}\nfunction _touchList() {\n var list = [];\n list.push.apply(list, arguments);\n list.item = function (index) {\n return this[index];\n };\n return list;\n}\nfunction _touchAndList(target, pageX, pageY, screenX, screenY, clientX, clientY) {\n return _touchList(_touch(target, pageX, pageY, screenX, screenY, clientX, clientY));\n}\nfunction matchesSelector(el, selector, ctx) {\n ctx = ctx || el.parentNode;\n var possibles = ctx.querySelectorAll(selector);\n for (var i = 0; i < possibles.length; i++) {\n if (possibles[i] === el) {\n return true;\n }\n }\n return false;\n}\nfunction _t(e) {\n return e.srcElement || e.target;\n}\nfunction _pi(e, target, obj, doCompute) {\n if (!doCompute) {\n return {\n path: [target],\n end: 1\n };\n } else {\n var path = e.composedPath ? e.composedPath() : e.path;\n if (typeof path !== "undefined" && path.indexOf) {\n return {\n path: path,\n end: path.indexOf(obj)\n };\n } else {\n var out = {\n path: [],\n end: -1\n },\n _one = function _one(el) {\n out.path.push(el);\n if (el === obj) {\n out.end = out.path.length - 1;\n } else if (el.parentNode != null) {\n _one(el.parentNode);\n }\n };\n _one(target);\n return out;\n }\n }\n}\nfunction _d(l, fn) {\n var i = 0,\n j;\n for (i = 0, j = l.length; i < j; i++) {\n if (l[i][0] === fn) {\n break;\n }\n }\n if (i < l.length) {\n l.splice(i, 1);\n }\n}\nvar guid = 1;\nvar forceTouchEvents = false;\nvar forceMouseEvents = false;\nfunction isTouchDevice() {\n return forceTouchEvents || "ontouchstart" in document.documentElement || navigator.maxTouchPoints != null && navigator.maxTouchPoints > 0;\n}\nfunction isMouseDevice() {\n return forceMouseEvents || "onmousedown" in document.documentElement;\n}\nvar touchMap = (_touchMap = {}, _defineProperty(_touchMap, EVENT_MOUSEDOWN, EVENT_TOUCHSTART), _defineProperty(_touchMap, EVENT_MOUSEUP, EVENT_TOUCHEND), _defineProperty(_touchMap, EVENT_MOUSEMOVE, EVENT_TOUCHMOVE), _touchMap);\nvar PAGE = "page";\nvar SCREEN = "screen";\nvar CLIENT = "client";\nfunction _genLoc(e, prefix) {\n if (e == null) return {\n x: 0,\n y: 0\n };\n var ts = touches(e),\n t = getTouch(ts, 0);\n return {\n x: t[prefix + "X"],\n y: t[prefix + "Y"]\n };\n}\nfunction pageLocation(e) {\n return _genLoc(e, PAGE);\n}\nfunction screenLocation(e) {\n return _genLoc(e, SCREEN);\n}\nfunction clientLocation(e) {\n return _genLoc(e, CLIENT);\n}\nfunction getTouch(touches, idx) {\n return touches.item ? touches.item(idx) : touches[idx];\n}\nfunction touches(e) {\n return e.touches && e.touches.length > 0 ? e.touches : e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches : e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches : [e];\n}\nfunction touchCount(e) {\n return touches(e).length;\n}\nfunction getPageLocation(e) {\n if (e == null) {\n return {\n x: 0,\n y: 0\n };\n } else if (e.pageX !== null) {\n return {\n x: e.pageX,\n y: e.pageY\n };\n } else {\n var ts = touches(e),\n t = getTouch(ts, 0);\n if (t != null && t.pageX != null) {\n return {\n x: t.pageX,\n y: t.pageY\n };\n } else {\n return {\n x: 0,\n y: 0\n };\n }\n }\n}\nfunction _bind(obj, type, fn, originalFn, options) {\n _store(obj, type, fn);\n originalFn.__tauid = fn.__tauid;\n if (obj.addEventListener) {\n obj.addEventListener(type, fn, false, options);\n } else if (obj.attachEvent) {\n var key = type + fn.__tauid;\n obj["e" + key] = fn;\n obj[key] = function () {\n obj["e" + key] && obj["e" + key](window.event);\n };\n obj.attachEvent("on" + type, obj[key]);\n }\n}\nfunction _unbind(obj, type, fn) {\n var _this = this;\n if (fn == null) return;\n _each$1(obj, function (_el) {\n _unstore(_el, type, fn);\n if (fn.__tauid != null) {\n if (_el.removeEventListener) {\n _el.removeEventListener(type, fn, false);\n if (isTouchDevice() && touchMap[type]) _el.removeEventListener(touchMap[type], fn, false);\n } else if (_this.detachEvent) {\n var key = type + fn.__tauid;\n _el[key] && _el.detachEvent("on" + type, _el[key]);\n _el[key] = null;\n _el["e" + key] = null;\n }\n }\n if (fn.__taTouchProxy) {\n _unbind(obj, fn.__taTouchProxy[1], fn.__taTouchProxy[0]);\n }\n });\n}\nfunction _each$1(obj, fn) {\n if (obj == null) return;\n var entries = typeof obj === "string" ? document.querySelectorAll(obj) : obj.length != null ? obj : [obj];\n for (var i = 0; i < entries.length; i++) {\n fn(entries[i]);\n }\n}\nfunction _store(obj, event, fn) {\n var g = guid++;\n obj.__ta = obj.__ta || {};\n obj.__ta[event] = obj.__ta[event] || {};\n obj.__ta[event][g] = fn;\n fn.__tauid = g;\n return g;\n}\nfunction _unstore(obj, event, fn) {\n obj.__ta && obj.__ta[event] && delete obj.__ta[event][fn.__tauid];\n if (fn.__taExtra) {\n for (var i = 0; i < fn.__taExtra.length; i++) {\n _unbind(obj, fn.__taExtra[i][0], fn.__taExtra[i][1]);\n }\n fn.__taExtra.length = 0;\n }\n fn.__taUnstore && fn.__taUnstore();\n}\nvar NOT_SELECTOR_REGEX = /:not\\(([^)]+)\\)/;\nfunction _curryChildFilter(children, obj, fn, evt) {\n if (children == null) {\n return fn;\n } else {\n var c = children.split(","),\n pc = [],\n nc = [];\n forEach(c, function (sel) {\n var m = sel.match(NOT_SELECTOR_REGEX);\n if (m != null) {\n nc.push(m[1]);\n } else {\n pc.push(sel);\n }\n });\n if (nc.length > 0 && pc.length === 0) {\n pc.push(WILDCARD);\n }\n var _fn = function _fn(e) {\n _fn.__tauid = fn.__tauid;\n var t = _t(e);\n var done = false;\n var target = t;\n var pathInfo = _pi(e, t, obj, children != null);\n if (pathInfo.end != -1) {\n for (var p = 0; !done && p < pathInfo.end; p++) {\n target = pathInfo.path[p];\n for (var i = 0; i < nc.length; i++) {\n if (matchesSelector(target, nc[i], obj)) {\n return;\n }\n }\n for (var _i = 0; !done && _i < pc.length; _i++) {\n if (matchesSelector(target, pc[_i], obj)) {\n fn.apply(target, [e, target]);\n done = true;\n break;\n }\n }\n }\n }\n };\n registerExtraFunction(fn, evt, _fn);\n return _fn;\n }\n}\nfunction registerExtraFunction(fn, evt, newFn) {\n fn.__taExtra = fn.__taExtra || [];\n fn.__taExtra.push([evt, newFn]);\n}\nvar DefaultHandler = function DefaultHandler(obj, evt, fn, children, options) {\n if (isTouchDevice() && touchMap[evt]) {\n var tfn = _curryChildFilter(children, obj, fn, touchMap[evt]);\n _bind(obj, touchMap[evt], tfn, fn, options);\n }\n if (evt === EVENT_FOCUS && obj.getAttribute(ATTRIBUTE_TABINDEX) == null) {\n obj.setAttribute(ATTRIBUTE_TABINDEX, "1");\n }\n _bind(obj, evt, _curryChildFilter(children, obj, fn, evt), fn, options);\n};\nvar _tapProfiles = (_tapProfiles2 = {}, _defineProperty(_tapProfiles2, EVENT_TAP, {\n touches: 1,\n taps: 1\n}), _defineProperty(_tapProfiles2, EVENT_DBL_TAP, {\n touches: 1,\n taps: 2\n}), _defineProperty(_tapProfiles2, EVENT_CONTEXTMENU, {\n touches: 2,\n taps: 1\n}), _tapProfiles2);\nfunction meeHelper(type, evt, obj, target) {\n for (var i in obj.__tamee[type]) {\n if (obj.__tamee[type].hasOwnProperty(i)) {\n obj.__tamee[type][i].apply(target, [evt]);\n }\n }\n}\nvar TapHandler = function () {\n function TapHandler() {\n _classCallCheck(this, TapHandler);\n }\n _createClass(TapHandler, null, [{\n key: "generate",\n value: function generate(clickThreshold, dblClickThreshold) {\n return function (obj, evt, fn, children) {\n if (evt == EVENT_CONTEXTMENU && isMouseDevice()) DefaultHandler(obj, evt, fn, children);else {\n if (obj.__taTapHandler == null) {\n var tt = obj.__taTapHandler = {\n tap: [],\n dbltap: [],\n down: false,\n taps: 0,\n downSelectors: []\n };\n var down = function down(e) {\n var target = _t(e),\n pathInfo = _pi(e, target, obj, children != null),\n finished = false;\n for (var p = 0; p < pathInfo.end; p++) {\n if (finished) return;\n target = pathInfo.path[p];\n for (var i = 0; i < tt.downSelectors.length; i++) {\n if (tt.downSelectors[i] == null || matchesSelector(target, tt.downSelectors[i], obj)) {\n tt.down = true;\n setTimeout(clearSingle, clickThreshold);\n setTimeout(clearDouble, dblClickThreshold);\n finished = true;\n break;\n }\n }\n }\n },\n up = function up(e) {\n if (tt.down) {\n var target = _t(e),\n currentTarget,\n pathInfo;\n tt.taps++;\n var tc = touchCount(e);\n for (var eventId in _tapProfiles) {\n if (_tapProfiles.hasOwnProperty(eventId)) {\n var p = _tapProfiles[eventId];\n if (p.touches === tc && (p.taps === 1 || p.taps === tt.taps)) {\n for (var i = 0; i < tt[eventId].length; i++) {\n pathInfo = _pi(e, target, obj, tt[eventId][i][1] != null);\n for (var pLoop = 0; pLoop < pathInfo.end; pLoop++) {\n currentTarget = pathInfo.path[pLoop];\n if (tt[eventId][i][1] == null || matchesSelector(currentTarget, tt[eventId][i][1], obj)) {\n tt[eventId][i][0].apply(currentTarget, [e, currentTarget]);\n break;\n }\n }\n }\n }\n }\n }\n }\n },\n clearSingle = function clearSingle() {\n tt.down = false;\n },\n clearDouble = function clearDouble() {\n tt.taps = 0;\n };\n obj.__taTapHandler.downHandler = down;\n obj.__taTapHandler.upHandler = up;\n DefaultHandler(obj, EVENT_MOUSEDOWN, down);\n DefaultHandler(obj, EVENT_MOUSEUP, up);\n }\n obj.__taTapHandler.downSelectors.push(children);\n obj.__taTapHandler[evt].push([fn, children]);\n fn.__taUnstore = function () {\n if (obj.__taTapHandler != null) {\n removeWithFunction(obj.__taTapHandler.downSelectors, function (ds) {\n return ds === children;\n });\n _d(obj.__taTapHandler[evt], fn);\n if (obj.__taTapHandler.downSelectors.length === 0) {\n _unbind(obj, EVENT_MOUSEDOWN, obj.__taTapHandler.downHandler);\n _unbind(obj, EVENT_MOUSEUP, obj.__taTapHandler.upHandler);\n delete obj.__taTapHandler;\n }\n }\n };\n }\n };\n }\n }]);\n return TapHandler;\n}();\nvar MouseEnterExitHandler = function () {\n function MouseEnterExitHandler() {\n _classCallCheck(this, MouseEnterExitHandler);\n }\n _createClass(MouseEnterExitHandler, null, [{\n key: "generate",\n value: function generate() {\n var activeElements = [];\n return function (obj, evt, fn, children) {\n if (!obj.__tamee) {\n obj.__tamee = {\n over: false,\n mouseenter: [],\n mouseexit: []\n };\n var over = function over(e) {\n var t = _t(e);\n if (children == null && t == obj && !obj.__tamee.over || matchesSelector(t, children, obj) && (t.__tamee == null || !t.__tamee.over)) {\n meeHelper(EVENT_MOUSEENTER, e, obj, t);\n t.__tamee = t.__tamee || {};\n t.__tamee.over = true;\n activeElements.push(t);\n }\n },\n out = function out(e) {\n var t = _t(e);\n for (var i = 0; i < activeElements.length; i++) {\n if (t == activeElements[i] && !matchesSelector(e.relatedTarget || e.toElement, "*", t)) {\n t.__tamee.over = false;\n activeElements.splice(i, 1);\n meeHelper(EVENT_MOUSEEXIT, e, obj, t);\n }\n }\n };\n _bind(obj, EVENT_MOUSEOVER, _curryChildFilter(children, obj, over, EVENT_MOUSEOVER), over);\n _bind(obj, EVENT_MOUSEOUT, _curryChildFilter(children, obj, out, EVENT_MOUSEOUT), out);\n }\n fn.__taUnstore = function () {\n delete obj.__tamee[evt][fn.__tauid];\n };\n _store(obj, evt, fn);\n obj.__tamee[evt][fn.__tauid] = fn;\n };\n }\n }]);\n return MouseEnterExitHandler;\n}();\nvar EventManager = function () {\n function EventManager(params) {\n _classCallCheck(this, EventManager);\n _defineProperty(this, "clickThreshold", void 0);\n _defineProperty(this, "dblClickThreshold", void 0);\n _defineProperty(this, "tapHandler", void 0);\n _defineProperty(this, "mouseEnterExitHandler", void 0);\n params = params || {};\n this.clickThreshold = params.clickThreshold || 250;\n this.dblClickThreshold = params.dblClickThreshold || 450;\n this.mouseEnterExitHandler = MouseEnterExitHandler.generate();\n this.tapHandler = TapHandler.generate(this.clickThreshold, this.dblClickThreshold);\n }\n _createClass(EventManager, [{\n key: "_doBind",\n value: function _doBind(el, evt, fn, children, options) {\n if (fn == null) return;\n var jel = el;\n if (evt === EVENT_TAP || evt === EVENT_DBL_TAP || evt === EVENT_CONTEXTMENU) {\n this.tapHandler(jel, evt, fn, children, options);\n } else if (evt === EVENT_MOUSEENTER || evt == EVENT_MOUSEEXIT) this.mouseEnterExitHandler(jel, evt, fn, children, options);else {\n DefaultHandler(jel, evt, fn, children, options);\n }\n }\n }, {\n key: "on",\n value: function on(el, event, children, fn, options) {\n var _c = fn == null ? null : children,\n _f = fn == null ? children : fn;\n this._doBind(el, event, _f, _c, options);\n return this;\n }\n }, {\n key: "off",\n value: function off(el, event, fn) {\n _unbind(el, event, fn);\n return this;\n }\n }, {\n key: "trigger",\n value: function trigger(el, event, originalEvent, payload, detail) {\n var originalIsMouse = isMouseDevice() && (typeof MouseEvent === "undefined" || originalEvent == null || originalEvent.constructor === MouseEvent);\n var eventToBind = isTouchDevice() && !isMouseDevice() && touchMap[event] ? touchMap[event] : event,\n bindingAMouseEvent = !(isTouchDevice() && !isMouseDevice() && touchMap[event]);\n var pl = pageLocation(originalEvent),\n sl = screenLocation(originalEvent),\n cl = clientLocation(originalEvent);\n _each$1(el, function (_el) {\n var evt;\n originalEvent = originalEvent || {\n screenX: sl.x,\n screenY: sl.y,\n clientX: cl.x,\n clientY: cl.y\n };\n var _decorate = function _decorate(_evt) {\n if (payload) {\n _evt.payload = payload;\n }\n };\n var eventGenerators = {\n "TouchEvent": function TouchEvent(evt) {\n var touchList = _touchAndList(_el, pl.x, pl.y, sl.x, sl.y, cl.x, cl.y),\n init = evt.initTouchEvent || evt.initEvent;\n init(eventToBind, true, true, window, null, sl.x, sl.y, cl.x, cl.y, false, false, false, false, touchList, touchList, touchList, 1, 0);\n },\n "MouseEvents": function MouseEvents(evt) {\n evt.initMouseEvent(eventToBind, true, true, window, detail == null ? 1 : detail, sl.x, sl.y, cl.x, cl.y, false, false, false, false, 1, _el);\n }\n };\n var ite = !bindingAMouseEvent && !originalIsMouse && isTouchDevice() && touchMap[event],\n evtName = ite ? "TouchEvent" : "MouseEvents";\n evt = document.createEvent(evtName);\n eventGenerators[evtName](evt);\n _decorate(evt);\n _el.dispatchEvent(evt);\n });\n return this;\n }\n }]);\n return EventManager;\n}();\nfunction setForceTouchEvents(value) {\n forceTouchEvents = value;\n}\nfunction setForceMouseEvents(value) {\n forceMouseEvents = value;\n}\n\nvar segmentMultipliers = [null, [1, -1], [1, 1], [-1, 1], [-1, -1]];\nvar inverseSegmentMultipliers = [null, [-1, -1], [-1, 1], [1, 1], [1, -1]];\nvar TWO_PI = 2 * Math.PI;\nfunction add(p1, p2) {\n return {\n x: p1.x + p2.x,\n y: p1.y + p2.y\n };\n}\nfunction subtract(p1, p2) {\n return {\n x: p1.x - p2.x,\n y: p1.y - p2.y\n };\n}\nfunction gradient(p1, p2) {\n if (p2.x === p1.x) return p2.y > p1.y ? Infinity : -Infinity;else if (p2.y === p1.y) return p2.x > p1.x ? 0 : -0;else return (p2.y - p1.y) / (p2.x - p1.x);\n}\nfunction normal(p1, p2) {\n return -1 / gradient(p1, p2);\n}\nfunction lineLength(p1, p2) {\n return Math.sqrt(Math.pow(p2.y - p1.y, 2) + Math.pow(p2.x - p1.x, 2));\n}\nfunction quadrant(p1, p2) {\n if (p2.x > p1.x) {\n return p2.y > p1.y ? 2 : 1;\n } else if (p2.x == p1.x) {\n return p2.y > p1.y ? 2 : 1;\n } else {\n return p2.y > p1.y ? 3 : 4;\n }\n}\nfunction theta(p1, p2) {\n var m = gradient(p1, p2),\n t = Math.atan(m),\n s = quadrant(p1, p2);\n if (s == 4 || s == 3) t += Math.PI;\n if (t < 0) t += 2 * Math.PI;\n return t;\n}\nfunction intersects(r1, r2) {\n var x1 = r1.x,\n x2 = r1.x + r1.w,\n y1 = r1.y,\n y2 = r1.y + r1.h,\n a1 = r2.x,\n a2 = r2.x + r2.w,\n b1 = r2.y,\n b2 = r2.y + r2.h;\n return x1 <= a1 && a1 <= x2 && y1 <= b1 && b1 <= y2 || x1 <= a2 && a2 <= x2 && y1 <= b1 && b1 <= y2 || x1 <= a1 && a1 <= x2 && y1 <= b2 && b2 <= y2 || x1 <= a2 && a1 <= x2 && y1 <= b2 && b2 <= y2 || a1 <= x1 && x1 <= a2 && b1 <= y1 && y1 <= b2 || a1 <= x2 && x2 <= a2 && b1 <= y1 && y1 <= b2 || a1 <= x1 && x1 <= a2 && b1 <= y2 && y2 <= b2 || a1 <= x2 && x1 <= a2 && b1 <= y2 && y2 <= b2;\n}\nfunction toABC(line) {\n var A = line[1].y - line[0].y;\n var B = line[0].x - line[1].x;\n return {\n A: A,\n B: B,\n C: fixPrecision(A * line[0].x + B * line[0].y)\n };\n}\nfunction fixPrecision(n, digits) {\n digits = digits == null ? 3 : digits;\n return Math.floor(n * Math.pow(10, digits)) / Math.pow(10, digits);\n}\nfunction lineIntersection(l1, l2) {\n var abc1 = toABC(l1),\n abc2 = toABC(l2),\n det = abc1.A * abc2.B - abc2.A * abc1.B;\n if (det == 0) {\n return null;\n } else {\n var candidate = {\n x: Math.round((abc2.B * abc1.C - abc1.B * abc2.C) / det),\n y: Math.round((abc1.A * abc2.C - abc2.A * abc1.C) / det)\n },\n l1xmin = Math.floor(Math.min(l1[0].x, l1[1].x)),\n l1xmax = Math.round(Math.max(l1[0].x, l1[1].x)),\n l1ymin = Math.floor(Math.min(l1[0].y, l1[1].y)),\n l1ymax = Math.round(Math.max(l1[0].y, l1[1].y)),\n l2xmin = Math.floor(Math.min(l2[0].x, l2[1].x)),\n l2xmax = Math.round(Math.max(l2[0].x, l2[1].x)),\n l2ymin = Math.floor(Math.min(l2[0].y, l2[1].y)),\n l2ymax = Math.round(Math.max(l2[0].y, l2[1].y));\n if (candidate.x >= l1xmin && candidate.x <= l1xmax && candidate.y >= l1ymin && candidate.y <= l1ymax && candidate.x >= l2xmin && candidate.x <= l2xmax && candidate.y >= l2ymin && candidate.y <= l2ymax) {\n return candidate;\n } else {\n return null;\n }\n }\n}\nfunction lineRectangleIntersection(line, r) {\n var out = [],\n rectangleLines = [[{\n x: r.x,\n y: r.y\n }, {\n x: r.x + r.w,\n y: r.y\n }], [{\n x: r.x + r.w,\n y: r.y\n }, {\n x: r.x + r.w,\n y: r.y + r.h\n }], [{\n x: r.x,\n y: r.y\n }, {\n x: r.x,\n y: r.y + r.h\n }], [{\n x: r.x,\n y: r.y + r.h\n }, {\n x: r.x + r.w,\n y: r.y + r.h\n }]];\n forEach(rectangleLines, function (rLine) {\n var intersection = lineIntersection(line, rLine);\n if (intersection != null) {\n out.push(intersection);\n }\n });\n return out;\n}\nfunction encloses(r1, r2, allowSharedEdges) {\n var x1 = r1.x,\n x2 = r1.x + r1.w,\n y1 = r1.y,\n y2 = r1.y + r1.h,\n a1 = r2.x,\n a2 = r2.x + r2.w,\n b1 = r2.y,\n b2 = r2.y + r2.h,\n c = function c(v1, v2, v3, v4) {\n return allowSharedEdges ? v1 <= v2 && v3 >= v4 : v1 < v2 && v3 > v4;\n };\n return c(x1, a1, x2, a2) && c(y1, b1, y2, b2);\n}\nfunction pointOnLine(fromPoint, toPoint, distance) {\n var m = gradient(fromPoint, toPoint),\n s = quadrant(fromPoint, toPoint),\n segmentMultiplier = distance > 0 ? segmentMultipliers[s] : inverseSegmentMultipliers[s],\n theta = Math.atan(m),\n y = Math.abs(distance * Math.sin(theta)) * segmentMultiplier[1],\n x = Math.abs(distance * Math.cos(theta)) * segmentMultiplier[0];\n return {\n x: fromPoint.x + x,\n y: fromPoint.y + y\n };\n}\nfunction perpendicularLineTo(fromPoint, toPoint, length) {\n var m = gradient(fromPoint, toPoint),\n theta2 = Math.atan(-1 / m),\n y = length / 2 * Math.sin(theta2),\n x = length / 2 * Math.cos(theta2);\n return [{\n x: toPoint.x + x,\n y: toPoint.y + y\n }, {\n x: toPoint.x - x,\n y: toPoint.y - y\n }];\n}\nfunction snapToGrid(pos, grid, thresholdX, thresholdY) {\n thresholdX = thresholdX == null ? grid.thresholdX == null ? grid.w / 2 : grid.thresholdX : thresholdX;\n thresholdY = thresholdY == null ? grid.thresholdY == null ? grid.h / 2 : grid.thresholdY : thresholdY;\n var _dx = Math.floor(pos.x / grid.w),\n _dxl = grid.w * _dx,\n _dxt = _dxl + grid.w,\n x = Math.abs(pos.x - _dxl) <= thresholdX ? _dxl : Math.abs(_dxt - pos.x) <= thresholdX ? _dxt : pos.x;\n var _dy = Math.floor(pos.y / grid.h),\n _dyl = grid.h * _dy,\n _dyt = _dyl + grid.h,\n y = Math.abs(pos.y - _dyl) <= thresholdY ? _dyl : Math.abs(_dyt - pos.y) <= thresholdY ? _dyt : pos.y;\n return {\n x: x,\n y: y\n };\n}\n\nfunction findDelegateElement(parentElement, childElement, selector) {\n if (matchesSelector$1(childElement, selector, parentElement)) {\n return childElement;\n } else {\n var currentParent = childElement.parentNode;\n while (currentParent != null && currentParent !== parentElement) {\n if (matchesSelector$1(currentParent, selector, parentElement)) {\n return currentParent;\n } else {\n currentParent = currentParent.parentNode;\n }\n }\n }\n}\nfunction _assignId(obj) {\n if (typeof obj === "function") {\n obj._katavorioId = uuid();\n return obj._katavorioId;\n } else {\n return obj;\n }\n}\nfunction isInsideParent(instance, _el, pos) {\n var p = _el.parentNode,\n s = instance.getSize(p),\n ss = instance.getSize(_el),\n leftEdge = pos.x,\n rightEdge = leftEdge + ss.w,\n topEdge = pos.y,\n bottomEdge = topEdge + ss.h;\n return rightEdge > 0 && leftEdge < s.w && bottomEdge > 0 && topEdge < s.h;\n}\nfunction findMatchingSelector(availableSelectors, parentElement, childElement) {\n var el = null;\n var draggableId = parentElement.getAttribute("katavorio-draggable"),\n prefix = draggableId != null ? "[katavorio-draggable=\'" + draggableId + "\'] " : "";\n for (var i = 0; i < availableSelectors.length; i++) {\n el = findDelegateElement(parentElement, childElement, prefix + availableSelectors[i].selector);\n if (el != null) {\n if (availableSelectors[i].filter) {\n var matches = matchesSelector$1(childElement, availableSelectors[i].filter, el),\n exclude = availableSelectors[i].filterExclude === true;\n if (exclude && !matches || matches) {\n return null;\n }\n }\n return [availableSelectors[i], el];\n }\n }\n return null;\n}\nvar EVENT_START = "start";\nvar EVENT_BEFORE_START = "beforeStart";\nvar EVENT_DRAG = "drag";\nvar EVENT_DROP = "drop";\nvar EVENT_OVER = "over";\nvar EVENT_OUT = "out";\nvar EVENT_STOP = "stop";\nvar ATTRIBUTE_DRAGGABLE = "katavorio-draggable";\nvar CLASS_DRAGGABLE$1 = ATTRIBUTE_DRAGGABLE;\nvar DEFAULT_GRID_X = 10;\nvar DEFAULT_GRID_Y = 10;\nvar TRUE = function TRUE() {\n return true;\n};\nvar FALSE = function FALSE() {\n return false;\n};\nvar _classes = {\n delegatedDraggable: "katavorio-delegated-draggable",\n draggable: CLASS_DRAGGABLE$1,\n drag: "katavorio-drag",\n selected: "katavorio-drag-selected",\n noSelect: "katavorio-drag-no-select",\n ghostProxy: "katavorio-ghost-proxy",\n clonedDrag: "katavorio-clone-drag"\n};\nvar PositioningStrategies;\n(function (PositioningStrategies) {\n PositioningStrategies["absolutePosition"] = "absolutePosition";\n PositioningStrategies["transform"] = "transform";\n PositioningStrategies["xyAttributes"] = "xyAttributes";\n})(PositioningStrategies || (PositioningStrategies = {}));\nvar positionerSetters = new Map();\npositionerSetters.set(PositioningStrategies.absolutePosition, function (el, p) {\n el.style.left = "".concat(p.x, "px");\n el.style.top = "".concat(p.y, "px");\n});\npositionerSetters.set(PositioningStrategies.xyAttributes, function (el, p) {\n el.setAttribute("x", "".concat(p.x));\n el.setAttribute("y", "".concat(p.y));\n});\nvar positionerGetters = new Map();\npositionerGetters.set(PositioningStrategies.absolutePosition, function (el) {\n return {\n x: el.offsetLeft,\n y: el.offsetTop\n };\n});\npositionerGetters.set(PositioningStrategies.xyAttributes, function (el) {\n return {\n x: parseFloat(el.getAttribute("x")),\n y: parseFloat(el.getAttribute("y"))\n };\n});\nvar sizeSetters = new Map();\nsizeSetters.set(PositioningStrategies.absolutePosition, function (el, s) {\n el.style.width = "".concat(s.w, "px");\n el.style.height = "".concat(s.h, "px");\n});\nsizeSetters.set(PositioningStrategies.xyAttributes, function (el, s) {\n el.setAttribute("width", "".concat(s.w));\n el.setAttribute("height", "".concat(s.h));\n});\nvar sizeGetters = new Map();\nsizeGetters.set(PositioningStrategies.absolutePosition, function (el) {\n return {\n w: el.offsetWidth,\n h: el.offsetHeight\n };\n});\nsizeGetters.set(PositioningStrategies.xyAttributes, function (el) {\n return {\n w: parseFloat(el.getAttribute("width")),\n h: parseFloat(el.getAttribute("height"))\n };\n});\nvar _events = [EVENT_STOP, EVENT_START, EVENT_DRAG, EVENT_DROP, EVENT_OVER, EVENT_OUT, EVENT_BEFORE_START];\nvar _devNull = function _devNull() {};\nvar _each = function _each(obj, fn) {\n if (obj == null) return;\n obj = !isString(obj) && obj.tagName == null && obj.length != null ? obj : [obj];\n for (var i = 0; i < obj.length; i++) {\n fn.apply(obj[i], [obj[i]]);\n }\n};\nvar _inputFilter = function _inputFilter(e, el, collicat) {\n var t = e.srcElement || e.target;\n return !matchesSelector$1(t, collicat.getInputFilterSelector(), el);\n};\nvar Base = function () {\n function Base(el, manager) {\n _classCallCheck(this, Base);\n this.el = el;\n this.manager = manager;\n _defineProperty(this, "_class", void 0);\n _defineProperty(this, "uuid", uuid());\n _defineProperty(this, "enabled", true);\n _defineProperty(this, "scopes", []);\n _defineProperty(this, "eventManager", void 0);\n this.eventManager = manager.eventManager;\n }\n _createClass(Base, [{\n key: "setEnabled",\n value: function setEnabled(e) {\n this.enabled = e;\n }\n }, {\n key: "isEnabled",\n value: function isEnabled() {\n return this.enabled;\n }\n }, {\n key: "toggleEnabled",\n value: function toggleEnabled() {\n this.enabled = !this.enabled;\n }\n }, {\n key: "addScope",\n value: function addScope(scopes) {\n var m = {};\n _each(this.scopes, function (s) {\n m[s] = true;\n });\n _each(scopes ? scopes.split(/\\s+/) : [], function (s) {\n m[s] = true;\n });\n this.scopes.length = 0;\n for (var i in m) {\n this.scopes.push(i);\n }\n }\n }, {\n key: "removeScope",\n value: function removeScope(scopes) {\n var m = {};\n _each(this.scopes, function (s) {\n m[s] = true;\n });\n _each(scopes ? scopes.split(/\\s+/) : [], function (s) {\n delete m[s];\n });\n this.scopes.length = 0;\n for (var i in m) {\n this.scopes.push(i);\n }\n }\n }, {\n key: "toggleScope",\n value: function toggleScope(scopes) {\n var m = {};\n _each(this.scopes, function (s) {\n m[s] = true;\n });\n _each(scopes ? scopes.split(/\\s+/) : [], function (s) {\n if (m[s]) delete m[s];else m[s] = true;\n });\n this.scopes.length = 0;\n for (var i in m) {\n this.scopes.push(i);\n }\n }\n }]);\n return Base;\n}();\nfunction getConstrainingRectangle(el) {\n return {\n w: el.parentNode.offsetWidth + el.parentNode.scrollLeft,\n h: el.parentNode.offsetHeight + el.parentNode.scrollTop\n };\n}\nvar ContainmentType;\n(function (ContainmentType) {\n ContainmentType["notNegative"] = "notNegative";\n ContainmentType["parent"] = "parent";\n ContainmentType["parentEnclosed"] = "parentEnclosed";\n})(ContainmentType || (ContainmentType = {}));\nvar Drag = function (_Base) {\n _inherits(Drag, _Base);\n var _super = _createSuper(Drag);\n function Drag(el, params, manager) {\n var _this;\n _classCallCheck(this, Drag);\n _this = _super.call(this, el, manager);\n _defineProperty(_assertThisInitialized(_this), "_class", void 0);\n _defineProperty(_assertThisInitialized(_this), "rightButtonCanDrag", void 0);\n _defineProperty(_assertThisInitialized(_this), "consumeStartEvent", void 0);\n _defineProperty(_assertThisInitialized(_this), "clone", void 0);\n _defineProperty(_assertThisInitialized(_this), "scroll", void 0);\n _defineProperty(_assertThisInitialized(_this), "trackScroll", void 0);\n _defineProperty(_assertThisInitialized(_this), "_downAt", void 0);\n _defineProperty(_assertThisInitialized(_this), "_posAtDown", void 0);\n _defineProperty(_assertThisInitialized(_this), "_pagePosAtDown", void 0);\n _defineProperty(_assertThisInitialized(_this), "_pageDelta", {\n x: 0,\n y: 0\n });\n _defineProperty(_assertThisInitialized(_this), "_moving", void 0);\n _defineProperty(_assertThisInitialized(_this), "_lastPosition", void 0);\n _defineProperty(_assertThisInitialized(_this), "_lastScrollValues", {\n x: 0,\n y: 0\n });\n _defineProperty(_assertThisInitialized(_this), "_initialScroll", {\n x: 0,\n y: 0\n });\n _defineProperty(_assertThisInitialized(_this), "_size", void 0);\n _defineProperty(_assertThisInitialized(_this), "_currentParentPosition", void 0);\n _defineProperty(_assertThisInitialized(_this), "_ghostParentPosition", void 0);\n _defineProperty(_assertThisInitialized(_this), "_dragEl", void 0);\n _defineProperty(_assertThisInitialized(_this), "_multipleDrop", void 0);\n _defineProperty(_assertThisInitialized(_this), "_ghostProxyOffsets", void 0);\n _defineProperty(_assertThisInitialized(_this), "_ghostDx", void 0);\n _defineProperty(_assertThisInitialized(_this), "_ghostDy", void 0);\n _defineProperty(_assertThisInitialized(_this), "_isConstrained", false);\n _defineProperty(_assertThisInitialized(_this), "_ghostProxyParent", void 0);\n _defineProperty(_assertThisInitialized(_this), "_useGhostProxy", void 0);\n _defineProperty(_assertThisInitialized(_this), "_ghostProxyFunction", void 0);\n _defineProperty(_assertThisInitialized(_this), "_activeSelectorParams", void 0);\n _defineProperty(_assertThisInitialized(_this), "_availableSelectors", []);\n _defineProperty(_assertThisInitialized(_this), "_canDrag", void 0);\n _defineProperty(_assertThisInitialized(_this), "_consumeFilteredEvents", void 0);\n _defineProperty(_assertThisInitialized(_this), "_parent", void 0);\n _defineProperty(_assertThisInitialized(_this), "_ignoreZoom", void 0);\n _defineProperty(_assertThisInitialized(_this), "_filters", {});\n _defineProperty(_assertThisInitialized(_this), "_constrainRect", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementToDrag", void 0);\n _defineProperty(_assertThisInitialized(_this), "downListener", void 0);\n _defineProperty(_assertThisInitialized(_this), "moveListener", void 0);\n _defineProperty(_assertThisInitialized(_this), "upListener", void 0);\n _defineProperty(_assertThisInitialized(_this), "scrollTracker", void 0);\n _defineProperty(_assertThisInitialized(_this), "listeners", {\n "start": [],\n "drag": [],\n "stop": [],\n "over": [],\n "out": [],\n "beforeStart": [],\n "revert": []\n });\n _this._class = _this.manager.css.draggable;\n addClass(_this.el, _this._class);\n _this.downListener = _this._downListener.bind(_assertThisInitialized(_this));\n _this.upListener = _this._upListener.bind(_assertThisInitialized(_this));\n _this.moveListener = _this._moveListener.bind(_assertThisInitialized(_this));\n _this.rightButtonCanDrag = params.rightButtonCanDrag === true;\n _this.consumeStartEvent = params.consumeStartEvent !== false;\n _this._dragEl = _this.el;\n _this.clone = params.clone === true;\n _this.scroll = params.scroll === true;\n _this.trackScroll = params.trackScroll !== false;\n _this._multipleDrop = params.multipleDrop !== false;\n _this._canDrag = params.canDrag || TRUE;\n _this._consumeFilteredEvents = params.consumeFilteredEvents;\n _this._parent = params.parent;\n _this._ignoreZoom = params.ignoreZoom === true;\n _this._ghostProxyParent = params.ghostProxyParent;\n if (_this.trackScroll) {\n _this.scrollTracker = _this._trackScroll.bind(_assertThisInitialized(_this));\n document.addEventListener("scroll", _this.scrollTracker);\n }\n if (params.ghostProxy === true) {\n _this._useGhostProxy = TRUE;\n } else {\n if (params.ghostProxy && typeof params.ghostProxy === "function") {\n _this._useGhostProxy = params.ghostProxy;\n } else {\n _this._useGhostProxy = function (container, dragEl) {\n if (_this._activeSelectorParams && _this._activeSelectorParams.useGhostProxy) {\n return _this._activeSelectorParams.useGhostProxy(container, dragEl);\n } else {\n return false;\n }\n };\n }\n }\n if (params.makeGhostProxy) {\n _this._ghostProxyFunction = params.makeGhostProxy;\n } else {\n _this._ghostProxyFunction = function (el) {\n if (_this._activeSelectorParams && _this._activeSelectorParams.makeGhostProxy) {\n return _this._activeSelectorParams.makeGhostProxy(el);\n } else {\n return el.cloneNode(true);\n }\n };\n }\n if (params.selector) {\n var draggableId = _this.el.getAttribute(ATTRIBUTE_DRAGGABLE);\n if (draggableId == null) {\n draggableId = "" + new Date().getTime();\n _this.el.setAttribute("katavorio-draggable", draggableId);\n }\n _this._availableSelectors.push(params);\n }\n _this.eventManager.on(_this.el, EVENT_MOUSEDOWN, _this.downListener);\n return _this;\n }\n _createClass(Drag, [{\n key: "_trackScroll",\n value: function _trackScroll(e) {\n if (this._moving) {\n var currentScrollValues = {\n x: document.documentElement.scrollLeft,\n y: document.documentElement.scrollTop\n },\n dsx = currentScrollValues.x - this._lastScrollValues.x,\n dsy = currentScrollValues.y - this._lastScrollValues.y,\n _pos = {\n x: dsx + this._lastPosition.x,\n y: dsy + this._lastPosition.y\n },\n dx = _pos.x - this._downAt.x,\n dy = _pos.y - this._downAt.y,\n _z = this._ignoreZoom ? 1 : this.manager.getZoom();\n if (this._dragEl && this._dragEl.parentNode) {\n dx += this._dragEl.parentNode.scrollLeft - this._initialScroll.x;\n dy += this._dragEl.parentNode.scrollTop - this._initialScroll.y;\n }\n dx /= _z;\n dy /= _z;\n this.moveBy(dx, dy, e);\n this._lastPosition = _pos;\n this._lastScrollValues = currentScrollValues;\n }\n }\n }, {\n key: "on",\n value: function on(evt, fn) {\n if (this.listeners[evt]) {\n this.listeners[evt].push(fn);\n }\n }\n }, {\n key: "off",\n value: function off(evt, fn) {\n if (this.listeners[evt]) {\n var l = [];\n for (var i = 0; i < this.listeners[evt].length; i++) {\n if (this.listeners[evt][i] !== fn) {\n l.push(this.listeners[evt][i]);\n }\n }\n this.listeners[evt] = l;\n }\n }\n }, {\n key: "_upListener",\n value: function _upListener(e) {\n if (this._downAt) {\n this._downAt = null;\n this.eventManager.off(document, EVENT_MOUSEMOVE, this.moveListener);\n this.eventManager.off(document, EVENT_MOUSEUP, this.upListener);\n removeClass(document.body, _classes.noSelect);\n this.unmark(e);\n this.stop(e);\n this._moving = false;\n if (this.clone) {\n this._dragEl && this._dragEl.parentNode && this._dragEl.parentNode.removeChild(this._dragEl);\n this._dragEl = null;\n } else {\n if (this._activeSelectorParams && this._activeSelectorParams.revertFunction) {\n if (this._activeSelectorParams.revertFunction(this._dragEl, this.manager.getPosition(this._dragEl)) === true) {\n this.manager.setPosition(this._dragEl, this._posAtDown);\n this._dispatch(EVENT_REVERT, this._dragEl);\n }\n }\n }\n }\n }\n }, {\n key: "_downListener",\n value: function _downListener(e) {\n if (e.defaultPrevented) {\n return;\n }\n var isNotRightClick = this.rightButtonCanDrag || e.which !== 3 && e.button !== 2;\n if (isNotRightClick && this.isEnabled() && this._canDrag()) {\n var _f = this._testFilter(e) && _inputFilter(e, this.el, this.manager);\n if (_f) {\n this._activeSelectorParams = null;\n this._elementToDrag = null;\n if (this._availableSelectors.length === 0) {\n console.log("JSPLUMB: no available drag selectors");\n }\n var eventTarget = e.target || e.srcElement;\n var match = findMatchingSelector(this._availableSelectors, this.el, eventTarget);\n if (match != null) {\n this._activeSelectorParams = match[0];\n this._elementToDrag = match[1];\n }\n if (this._activeSelectorParams == null || this._elementToDrag == null) {\n return;\n }\n var initial = this._activeSelectorParams.dragInit ? this._activeSelectorParams.dragInit(this._elementToDrag, e) : null;\n if (initial != null) {\n this._elementToDrag = initial;\n }\n if (this.clone) {\n this._dragEl = this._elementToDrag.cloneNode(true);\n addClass(this._dragEl, _classes.clonedDrag);\n this._dragEl.setAttribute("id", null);\n this._dragEl.style.position = "absolute";\n if (this._parent != null) {\n var _p2 = this.manager.getPosition(this.el);\n this._dragEl.style.left = _p2.x + "px";\n this._dragEl.style.top = _p2.y + "px";\n this._parent.appendChild(this._dragEl);\n } else {\n var b = offsetRelativeToRoot(this._elementToDrag);\n this._dragEl.style.left = b.x + "px";\n this._dragEl.style.top = b.y + "px";\n document.body.appendChild(this._dragEl);\n }\n } else {\n this._dragEl = this._elementToDrag;\n }\n if (this.consumeStartEvent) {\n consume(e);\n }\n this._downAt = pageLocation(e);\n if (this._dragEl && this._dragEl.parentNode) {\n this._initialScroll = {\n x: this._dragEl.parentNode.scrollLeft,\n y: this._dragEl.parentNode.scrollTop\n };\n }\n this._posAtDown = this.manager.getPosition(this._dragEl);\n this._pagePosAtDown = offsetRelativeToRoot(this._dragEl);\n this._pageDelta = {\n x: this._pagePosAtDown.x - this._posAtDown.x,\n y: this._pagePosAtDown.y - this._posAtDown.y\n };\n this._size = this.manager.getSize(this._dragEl);\n this.eventManager.on(document, EVENT_MOUSEMOVE, this.moveListener);\n this.eventManager.on(document, EVENT_MOUSEUP, this.upListener);\n addClass(document.body, _classes.noSelect);\n this._dispatch(EVENT_BEFORE_START, {\n el: this.el,\n pos: this._posAtDown,\n e: e,\n drag: this,\n size: this._size\n });\n } else if (this._consumeFilteredEvents) {\n consume(e);\n }\n }\n }\n }, {\n key: "_moveListener",\n value: function _moveListener(e) {\n if (this._downAt) {\n if (!this._moving) {\n var dispatchResult = this._dispatch(EVENT_START, {\n el: this.el,\n pos: this._posAtDown,\n e: e,\n drag: this,\n size: this._size\n });\n if (dispatchResult !== false) {\n if (!this._downAt) {\n return;\n }\n this.mark(dispatchResult);\n this._moving = true;\n } else {\n this.abort();\n }\n }\n if (this._downAt) {\n var _pos2 = pageLocation(e),\n dx = _pos2.x - this._downAt.x,\n dy = _pos2.y - this._downAt.y,\n _z2 = this._ignoreZoom ? 1 : this.manager.getZoom();\n this._lastPosition = {\n x: _pos2.x,\n y: _pos2.y\n };\n this._lastScrollValues = {\n x: document.documentElement.scrollLeft,\n y: document.documentElement.scrollTop\n };\n if (this._dragEl && this._dragEl.parentNode) {\n dx += this._dragEl.parentNode.scrollLeft - this._initialScroll.x;\n dy += this._dragEl.parentNode.scrollTop - this._initialScroll.y;\n }\n dx /= _z2;\n dy /= _z2;\n this.moveBy(dx, dy, e);\n }\n }\n }\n }, {\n key: "getDragDelta",\n value: function getDragDelta() {\n if (this._posAtDown != null && this._downAt != null) {\n return {\n x: this._downAt.x - this._posAtDown.x,\n y: this._downAt.y - this._posAtDown.y\n };\n } else {\n return {\n x: 0,\n y: 0\n };\n }\n }\n }, {\n key: "mark",\n value: function mark(payload) {\n this._posAtDown = this.manager.getPosition(this._dragEl);\n this._pagePosAtDown = offsetRelativeToRoot(this._dragEl);\n this._pageDelta = {\n x: this._pagePosAtDown.x - this._posAtDown.x,\n y: this._pagePosAtDown.y - this._posAtDown.y\n };\n this._size = this.manager.getSize(this._dragEl);\n addClass(this._dragEl, this.manager.css.drag);\n this._constrainRect = getConstrainingRectangle(this._dragEl);\n this._ghostDx = 0;\n this._ghostDy = 0;\n }\n }, {\n key: "unmark",\n value: function unmark(e) {\n if (this._isConstrained && this._useGhostProxy(this._elementToDrag, this._dragEl)) {\n this._ghostProxyOffsets = {\n x: this._dragEl.offsetLeft - this._ghostDx,\n y: this._dragEl.offsetTop - this._ghostDy\n };\n this._dragEl.parentNode.removeChild(this._dragEl);\n this._dragEl = this._elementToDrag;\n } else {\n this._ghostProxyOffsets = null;\n }\n removeClass(this._dragEl, this.manager.css.drag);\n this._isConstrained = false;\n }\n }, {\n key: "moveBy",\n value: function moveBy(dx, dy, e) {\n var desiredLoc = this.toGrid({\n x: this._posAtDown.x + dx,\n y: this._posAtDown.y + dy\n }),\n cPos = this._doConstrain(desiredLoc, this._dragEl, this._constrainRect, this._size, e);\n if (cPos != null) {\n if (this._useGhostProxy(this.el, this._dragEl)) {\n if (desiredLoc.x !== cPos.x || desiredLoc.y !== cPos.y) {\n if (!this._isConstrained) {\n var gp = this._ghostProxyFunction(this._elementToDrag);\n addClass(gp, _classes.ghostProxy);\n if (this._ghostProxyParent) {\n this._ghostProxyParent.appendChild(gp);\n this._currentParentPosition = offsetRelativeToRoot(this._elementToDrag.parentNode);\n this._ghostParentPosition = offsetRelativeToRoot(this._ghostProxyParent);\n this._ghostDx = this._currentParentPosition.x - this._ghostParentPosition.x;\n this._ghostDy = this._currentParentPosition.y - this._ghostParentPosition.y;\n } else {\n this._elementToDrag.parentNode.appendChild(gp);\n }\n this._dragEl = gp;\n this._isConstrained = true;\n }\n cPos = desiredLoc;\n } else {\n if (this._isConstrained) {\n this._dragEl.parentNode.removeChild(this._dragEl);\n this._dragEl = this._elementToDrag;\n this._isConstrained = false;\n this._currentParentPosition = null;\n this._ghostParentPosition = null;\n this._ghostDx = 0;\n this._ghostDy = 0;\n }\n }\n }\n this.manager.setPosition(this._dragEl, {\n x: cPos.x + this._ghostDx,\n y: cPos.y + this._ghostDy\n });\n this._dispatch(EVENT_DRAG, {\n el: this.el,\n pos: cPos,\n e: e,\n drag: this,\n size: this._size,\n originalPos: this._posAtDown\n });\n }\n }\n }, {\n key: "abort",\n value: function abort() {\n if (this._downAt != null) {\n this._upListener();\n }\n }\n }, {\n key: "getDragElement",\n value: function getDragElement(retrieveOriginalElement) {\n return retrieveOriginalElement ? this._elementToDrag || this.el : this._dragEl || this.el;\n }\n }, {\n key: "stop",\n value: function stop(e, force) {\n if (force || this._moving) {\n var positions = [],\n dPos = this.manager.getPosition(this._dragEl);\n positions.push([this._dragEl, dPos, this, this._size]);\n this._dispatch(EVENT_STOP, {\n el: this._dragEl,\n pos: this._ghostProxyOffsets || dPos,\n finalPos: dPos,\n e: e,\n drag: this,\n selection: positions,\n size: this._size,\n originalPos: {\n x: this._posAtDown.x,\n y: this._posAtDown.y\n }\n });\n } else if (!this._moving) {\n this._activeSelectorParams.dragAbort ? this._activeSelectorParams.dragAbort(this._elementToDrag) : null;\n }\n }\n }, {\n key: "_dispatch",\n value: function _dispatch(evt, value) {\n var result = null;\n if (this._activeSelectorParams && this._activeSelectorParams[evt]) {\n result = this._activeSelectorParams[evt](value);\n } else if (this.listeners[evt]) {\n for (var i = 0; i < this.listeners[evt].length; i++) {\n try {\n var v = this.listeners[evt][i](value);\n if (v != null) {\n result = v;\n }\n } catch (e) {}\n }\n }\n return result;\n }\n }, {\n key: "resolveGrid",\n value: function resolveGrid() {\n var out = {\n grid: null,\n thresholdX: DEFAULT_GRID_X / 2,\n thresholdY: DEFAULT_GRID_Y / 2\n };\n if (this._activeSelectorParams != null && this._activeSelectorParams.grid != null) {\n out.grid = this._activeSelectorParams.grid;\n if (this._activeSelectorParams.snapThreshold != null) {\n out.thresholdX = this._activeSelectorParams.snapThreshold;\n out.thresholdY = this._activeSelectorParams.snapThreshold;\n }\n }\n return out;\n }\n }, {\n key: "toGrid",\n value: function toGrid(pos) {\n var _this$resolveGrid = this.resolveGrid(),\n grid = _this$resolveGrid.grid,\n thresholdX = _this$resolveGrid.thresholdX,\n thresholdY = _this$resolveGrid.thresholdY;\n if (grid == null) {\n return pos;\n } else {\n var tx = grid ? grid.w / 2 : thresholdX,\n ty = grid ? grid.h / 2 : thresholdY;\n return snapToGrid(pos, grid, tx, ty);\n }\n }\n }, {\n key: "setUseGhostProxy",\n value: function setUseGhostProxy(val) {\n this._useGhostProxy = val ? TRUE : FALSE;\n }\n }, {\n key: "_doConstrain",\n value: function _doConstrain(pos, dragEl, _constrainRect, _size, e) {\n if (this._activeSelectorParams != null && this._activeSelectorParams.constrainFunction && typeof this._activeSelectorParams.constrainFunction === "function") {\n return this._activeSelectorParams.constrainFunction(pos, dragEl, _constrainRect, _size, e);\n } else {\n return pos;\n }\n }\n }, {\n key: "_testFilter",\n value: function _testFilter(e) {\n for (var key in this._filters) {\n var f = this._filters[key];\n var rv = f[0](e);\n if (f[1]) {\n rv = !rv;\n }\n if (!rv) {\n return false;\n }\n }\n return true;\n }\n }, {\n key: "addFilter",\n value: function addFilter(f, _exclude) {\n var _this2 = this;\n if (f) {\n var key = _assignId(f);\n this._filters[key] = [function (e) {\n var t = e.srcElement || e.target;\n var m;\n if (isString(f)) {\n m = matchesSelector$1(t, f, _this2.el);\n } else if (typeof f === "function") {\n m = f(e, _this2.el);\n }\n return m;\n }, _exclude !== false];\n }\n }\n }, {\n key: "removeFilter",\n value: function removeFilter(f) {\n var key = typeof f === "function" ? f._katavorioId : f;\n delete this._filters[key];\n }\n }, {\n key: "clearAllFilters",\n value: function clearAllFilters() {\n this._filters = {};\n }\n }, {\n key: "addSelector",\n value: function addSelector(params, atStart) {\n if (params.selector) {\n if (atStart) {\n this._availableSelectors.unshift(params);\n } else {\n this._availableSelectors.push(params);\n }\n }\n }\n }, {\n key: "destroy",\n value: function destroy() {\n this.eventManager.off(this.el, EVENT_MOUSEDOWN, this.downListener);\n this.eventManager.off(document, EVENT_MOUSEMOVE, this.moveListener);\n this.eventManager.off(document, EVENT_MOUSEUP, this.upListener);\n this.downListener = null;\n this.upListener = null;\n this.moveListener = null;\n if (this.scrollTracker != null) {\n document.removeEventListener("scroll", this.scrollTracker);\n }\n }\n }]);\n return Drag;\n}(Base);\nvar DEFAULT_INPUTS = ["input", "textarea", "select", "button", "option"];\nvar DEFAULT_INPUT_FILTER_SELECTOR = DEFAULT_INPUTS.join(",");\nvar Collicat = function () {\n function Collicat(options) {\n _classCallCheck(this, Collicat);\n _defineProperty(this, "eventManager", void 0);\n _defineProperty(this, "zoom", 1);\n _defineProperty(this, "css", {});\n _defineProperty(this, "inputFilterSelector", void 0);\n _defineProperty(this, "positioningStrategy", void 0);\n _defineProperty(this, "_positionSetter", void 0);\n _defineProperty(this, "_positionGetter", void 0);\n _defineProperty(this, "_sizeSetter", void 0);\n _defineProperty(this, "_sizeGetter", void 0);\n options = options || {};\n this.inputFilterSelector = options.inputFilterSelector || DEFAULT_INPUT_FILTER_SELECTOR;\n this.eventManager = new EventManager();\n this.zoom = options.zoom || 1;\n this.positioningStrategy = options.positioningStrategy || PositioningStrategies.absolutePosition;\n this._positionGetter = positionerGetters.get(this.positioningStrategy);\n this._positionSetter = positionerSetters.get(this.positioningStrategy);\n this._sizeGetter = sizeGetters.get(this.positioningStrategy);\n this._sizeSetter = sizeSetters.get(this.positioningStrategy);\n var _c = options.css || {};\n extend(this.css, _c);\n }\n _createClass(Collicat, [{\n key: "getPosition",\n value: function getPosition(el) {\n return this._positionGetter(el);\n }\n }, {\n key: "setPosition",\n value: function setPosition(el, p) {\n this._positionSetter(el, p);\n }\n }, {\n key: "getSize",\n value: function getSize(el) {\n return this._sizeGetter(el);\n }\n }, {\n key: "getZoom",\n value: function getZoom() {\n return this.zoom;\n }\n }, {\n key: "setZoom",\n value: function setZoom(z) {\n this.zoom = z;\n }\n }, {\n key: "_prepareParams",\n value: function _prepareParams(p) {\n p = p || {};\n var _p = {\n events: {}\n },\n i;\n for (i in p) {\n _p[i] = p[i];\n }\n for (i = 0; i < _events.length; i++) {\n _p.events[_events[i]] = p[_events[i]] || _devNull;\n }\n return _p;\n }\n }, {\n key: "getInputFilterSelector",\n value: function getInputFilterSelector() {\n return this.inputFilterSelector;\n }\n }, {\n key: "setInputFilterSelector",\n value: function setInputFilterSelector(selector) {\n this.inputFilterSelector = selector;\n return this;\n }\n }, {\n key: "draggable",\n value: function draggable(el, params) {\n if (el._katavorioDrag == null) {\n var _p3 = this._prepareParams(params);\n var d = new Drag(el, _p3, this);\n addClass(el, _classes.delegatedDraggable);\n el._katavorioDrag = d;\n return d;\n } else {\n return el._katavorioDrag;\n }\n }\n }, {\n key: "destroyDraggable",\n value: function destroyDraggable(el) {\n if (el._katavorioDrag) {\n el._katavorioDrag.destroy();\n delete el._katavorioDrag;\n }\n }\n }]);\n return Collicat;\n}();\n\nvar CLASS_DRAG_SELECTED = "jtk-drag-selected";\nvar DragSelection = function () {\n function DragSelection(instance) {\n _classCallCheck(this, DragSelection);\n this.instance = instance;\n _defineProperty(this, "_dragSelection", []);\n _defineProperty(this, "_dragSizes", new Map());\n _defineProperty(this, "_dragElements", new Map());\n _defineProperty(this, "_dragElementStartPositions", new Map());\n _defineProperty(this, "_dragElementPositions", new Map());\n _defineProperty(this, "__activeSet", void 0);\n }\n _createClass(DragSelection, [{\n key: "_activeSet",\n get: function get() {\n if (this.__activeSet == null) {\n return this._dragSelection;\n } else {\n return this.__activeSet;\n }\n }\n }, {\n key: "length",\n get: function get() {\n return this._dragSelection.length;\n }\n }, {\n key: "filterActiveSet",\n value: function filterActiveSet(fn) {\n var _this = this;\n this.__activeSet = [];\n forEach(this._dragSelection, function (p) {\n if (fn(p)) {\n _this.__activeSet.push(p);\n }\n });\n }\n }, {\n key: "clear",\n value: function clear() {\n var _this2 = this;\n this.reset();\n forEach(this._dragSelection, function (p) {\n return _this2.instance.removeClass(p.jel, CLASS_DRAG_SELECTED);\n });\n this._dragSelection.length = 0;\n }\n }, {\n key: "reset",\n value: function reset() {\n this._dragElementStartPositions.clear();\n this._dragElementPositions.clear();\n this._dragSizes.clear();\n this._dragElements.clear();\n this.__activeSet = null;\n }\n }, {\n key: "initialisePositions",\n value: function initialisePositions() {\n var _this3 = this;\n forEach(this._activeSet, function (p) {\n var vp = _this3.instance.viewport.getPosition(p.id);\n var off = {\n x: parseInt("" + p.jel.offsetLeft, 10),\n y: parseInt("" + p.jel.offsetTop, 10)\n };\n _this3._dragElementStartPositions.set(p.id, off);\n _this3._dragElementPositions.set(p.id, off);\n _this3._dragSizes.set(p.id, {\n w: vp.w,\n h: vp.h\n });\n });\n }\n }, {\n key: "updatePositions",\n value: function updatePositions(currentPosition, originalPosition, callback) {\n var _this4 = this;\n var dx = currentPosition.x - originalPosition.x,\n dy = currentPosition.y - originalPosition.y;\n forEach(this._activeSet, function (p) {\n var op = _this4._dragElementStartPositions.get(p.id);\n if (op) {\n var x = op.x + dx,\n y = op.y + dy;\n var _s = _this4._dragSizes.get(p.id);\n var _b = {\n x: x,\n y: y,\n w: _s.w,\n h: _s.h\n };\n if (p.jel._jsPlumbParentGroup && p.jel._jsPlumbParentGroup.constrain) {\n var constrainRect = {\n w: p.jel.parentNode.offsetWidth + p.jel.parentNode.scrollLeft,\n h: p.jel.parentNode.offsetHeight + p.jel.parentNode.scrollTop\n };\n _b.x = Math.max(_b.x, 0);\n _b.y = Math.max(_b.y, 0);\n _b.x = Math.min(_b.x, constrainRect.w - _s.w);\n _b.y = Math.min(_b.y, constrainRect.h - _s.h);\n }\n _this4._dragElementPositions.set(p.id, {\n x: x,\n y: y\n });\n p.jel.style.left = _b.x + "px";\n p.jel.style.top = _b.y + "px";\n callback(p.jel, p.id, _s, _b);\n }\n });\n }\n }, {\n key: "each",\n value: function each(f) {\n var _this5 = this;\n forEach(this._activeSet, function (p) {\n var s = _this5._dragSizes.get(p.id);\n var o = _this5._dragElementPositions.get(p.id);\n var orig = _this5._dragElementStartPositions.get(p.id);\n f(p.jel, p.id, o, s, orig);\n });\n }\n }, {\n key: "add",\n value: function add(el, id) {\n var jel = el;\n id = id || this.instance.getId(jel);\n var idx = findWithFunction(this._dragSelection, function (p) {\n return p.id === id;\n });\n if (idx === -1) {\n this.instance.addClass(el, CLASS_DRAG_SELECTED);\n this._dragSelection.push({\n id: id,\n jel: jel\n });\n }\n }\n }, {\n key: "remove",\n value: function remove(el) {\n var _this6 = this;\n var jel = el;\n this._dragSelection = this._dragSelection.filter(function (p) {\n var out = p.jel !== jel;\n if (!out) {\n _this6.instance.removeClass(p.jel, CLASS_DRAG_SELECTED);\n }\n return out;\n });\n }\n }, {\n key: "toggle",\n value: function toggle(el) {\n var jel = el;\n var idx = findWithFunction(this._dragSelection, function (p) {\n return p.jel === jel;\n });\n if (idx !== -1) {\n this.remove(jel);\n } else {\n this.add(el);\n }\n }\n }]);\n return DragSelection;\n}();\n\nvar CLASS_DELEGATED_DRAGGABLE = "jtk-delegated-draggable";\nvar CLASS_DRAGGABLE = "jtk-draggable";\nvar CLASS_DRAG_CONTAINER = "jtk-drag";\nvar CLASS_GHOST_PROXY = "jtk-ghost-proxy";\nvar CLASS_DRAG_ACTIVE = "jtk-drag-active";\nvar CLASS_DRAGGED = "jtk-dragged";\nvar CLASS_DRAG_HOVER = "jtk-drag-hover";\nvar DragManager = function () {\n function DragManager(instance, dragSelection, options) {\n var _this = this;\n _classCallCheck(this, DragManager);\n this.instance = instance;\n this.dragSelection = dragSelection;\n _defineProperty(this, "collicat", void 0);\n _defineProperty(this, "drag", void 0);\n _defineProperty(this, "_draggables", {});\n _defineProperty(this, "_dlist", []);\n _defineProperty(this, "_elementsWithEndpoints", {});\n _defineProperty(this, "_draggablesForElements", {});\n _defineProperty(this, "handlers", []);\n _defineProperty(this, "_trackScroll", void 0);\n _defineProperty(this, "_filtersToAdd", []);\n this.collicat = new Collicat({\n zoom: this.instance.currentZoom,\n css: {\n noSelect: this.instance.dragSelectClass,\n delegatedDraggable: CLASS_DELEGATED_DRAGGABLE,\n draggable: CLASS_DRAGGABLE,\n drag: CLASS_DRAG_CONTAINER,\n selected: CLASS_DRAG_SELECTED,\n active: CLASS_DRAG_ACTIVE,\n hover: CLASS_DRAG_HOVER,\n ghostProxy: CLASS_GHOST_PROXY\n }\n });\n this.instance.bind(EVENT_ZOOM, function (z) {\n _this.collicat.setZoom(z);\n });\n options = options || {};\n this._trackScroll = options.trackScroll !== false;\n }\n _createClass(DragManager, [{\n key: "addHandler",\n value: function addHandler(handler, dragOptions) {\n var _this2 = this;\n var o = extend({\n selector: handler.selector\n }, dragOptions || {});\n o.start = wrap(o.start, function (p) {\n return handler.onStart(p);\n }, false);\n o.drag = wrap(o.drag, function (p) {\n return handler.onDrag(p);\n });\n o.stop = wrap(o.stop, function (p) {\n return handler.onStop(p);\n });\n var handlerBeforeStart = (handler.onBeforeStart || function (p) {}).bind(handler);\n o.beforeStart = wrap(o.beforeStart, function (p) {\n return handlerBeforeStart(p);\n });\n o.dragInit = function (el, e) {\n return handler.onDragInit(el, e);\n };\n o.dragAbort = function (el) {\n return handler.onDragAbort(el);\n };\n if (handler.useGhostProxy) {\n o.useGhostProxy = handler.useGhostProxy;\n o.makeGhostProxy = handler.makeGhostProxy;\n }\n if (o.constrainFunction == null && o.containment != null) {\n switch (o.containment) {\n case ContainmentType.notNegative:\n {\n o.constrainFunction = function (pos, dragEl, _constrainRect, _size) {\n return {\n x: Math.max(0, Math.min(pos.x)),\n y: Math.max(0, Math.min(pos.y))\n };\n };\n break;\n }\n case ContainmentType.parent:\n {\n var padding = o.containmentPadding || 5;\n o.constrainFunction = function (pos, dragEl, _constrainRect, _size) {\n var x = pos.x < 0 ? 0 : pos.x > _constrainRect.w - padding ? _constrainRect.w - padding : pos.x;\n var y = pos.y < 0 ? 0 : pos.y > _constrainRect.h - padding ? _constrainRect.h - padding : pos.y;\n return {\n x: x,\n y: y\n };\n };\n break;\n }\n case ContainmentType.parentEnclosed:\n {\n o.constrainFunction = function (pos, dragEl, _constrainRect, _size) {\n var x = pos.x < 0 ? 0 : pos.x + _size.w > _constrainRect.w ? _constrainRect.w - _size.w : pos.x;\n var y = pos.y < 0 ? 0 : pos.y + _size.h > _constrainRect.h ? _constrainRect.h - _size.h : pos.y;\n return {\n x: x,\n y: y\n };\n };\n break;\n }\n }\n }\n if (this.drag == null) {\n o.trackScroll = this._trackScroll;\n this.drag = this.collicat.draggable(this.instance.getContainer(), o);\n forEach(this._filtersToAdd, function (filterToAdd) {\n return _this2.drag.addFilter(filterToAdd[0], filterToAdd[1]);\n });\n this.drag.on(EVENT_REVERT, function (el) {\n _this2.instance.revalidate(el);\n });\n } else {\n this.drag.addSelector(o);\n }\n this.handlers.push({\n handler: handler,\n options: o\n });\n handler.init(this.drag);\n }\n }, {\n key: "addSelector",\n value: function addSelector(params, atStart) {\n this.drag && this.drag.addSelector(params, atStart);\n }\n }, {\n key: "addFilter",\n value: function addFilter(filter, exclude) {\n if (this.drag == null) {\n this._filtersToAdd.push([filter, exclude === true]);\n } else {\n this.drag.addFilter(filter, exclude);\n }\n }\n }, {\n key: "removeFilter",\n value: function removeFilter(filter) {\n if (this.drag != null) {\n this.drag.removeFilter(filter);\n }\n }\n }, {\n key: "setFilters",\n value: function setFilters(filters) {\n var _this3 = this;\n forEach(filters, function (f) {\n _this3.drag.addFilter(f[0], f[1]);\n });\n }\n }, {\n key: "reset",\n value: function reset() {\n var out = [];\n forEach(this.handlers, function (p) {\n p.handler.reset();\n });\n this.handlers.length = 0;\n if (this.drag != null) {\n var currentFilters = this.drag._filters;\n for (var f in currentFilters) {\n out.push([f, currentFilters[f][1]]);\n }\n this.collicat.destroyDraggable(this.instance.getContainer());\n }\n delete this.drag;\n return out;\n }\n }, {\n key: "setOption",\n value: function setOption(handler, options) {\n var handlerAndOptions = getWithFunction(this.handlers, function (p) {\n return p.handler === handler;\n });\n if (handlerAndOptions != null) {\n extend(handlerAndOptions.options, options || {});\n }\n }\n }]);\n return DragManager;\n}();\n\nfunction decodeDragGroupSpec(instance, spec) {\n if (isString(spec)) {\n return {\n id: spec,\n active: true\n };\n } else {\n return {\n id: spec.id,\n active: spec.active\n };\n }\n}\nfunction isActiveDragGroupMember(dragGroup, el) {\n var details = getFromSetWithFunction(dragGroup.members, function (m) {\n return m.el === el;\n });\n if (details !== null) {\n return details.active === true;\n } else {\n return false;\n }\n}\nfunction getAncestors(el) {\n var ancestors = [];\n var p = el._jsPlumbParentGroup;\n while (p != null) {\n ancestors.push(p.el);\n p = p.group;\n }\n return ancestors;\n}\nvar ElementDragHandler = function () {\n function ElementDragHandler(instance, _dragSelection) {\n _classCallCheck(this, ElementDragHandler);\n this.instance = instance;\n this._dragSelection = _dragSelection;\n _defineProperty(this, "selector", "> " + SELECTOR_MANAGED_ELEMENT + ":not(" + cls(CLASS_OVERLAY) + ")");\n _defineProperty(this, "_dragOffset", null);\n _defineProperty(this, "_groupLocations", []);\n _defineProperty(this, "_intersectingGroups", []);\n _defineProperty(this, "_currentDragParentGroup", null);\n _defineProperty(this, "_dragGroupByElementIdMap", {});\n _defineProperty(this, "_dragGroupMap", {});\n _defineProperty(this, "_currentDragGroup", null);\n _defineProperty(this, "_currentDragGroupOffsets", new Map());\n _defineProperty(this, "_currentDragGroupSizes", new Map());\n _defineProperty(this, "_currentDragGroupOriginalPositions", new Map());\n _defineProperty(this, "_dragPayload", null);\n _defineProperty(this, "drag", void 0);\n _defineProperty(this, "originalPosition", void 0);\n }\n _createClass(ElementDragHandler, [{\n key: "onDragInit",\n value: function onDragInit(el) {\n return null;\n }\n }, {\n key: "onDragAbort",\n value: function onDragAbort(el) {\n return null;\n }\n }, {\n key: "getDropGroup",\n value: function getDropGroup() {\n var dropGroup = null;\n if (this._intersectingGroups.length > 0) {\n var targetGroup = this._intersectingGroups[0].groupLoc.group;\n var intersectingElement = this._intersectingGroups[0].intersectingElement;\n var currentGroup = intersectingElement._jsPlumbParentGroup;\n if (currentGroup !== targetGroup) {\n if (currentGroup == null || !currentGroup.overrideDrop(intersectingElement, targetGroup)) {\n dropGroup = this._intersectingGroups[0];\n }\n }\n }\n return dropGroup;\n }\n }, {\n key: "onStop",\n value: function onStop(params) {\n var _this$_currentDragGro,\n _this = this;\n var jel = params.drag.getDragElement();\n var dropGroup = this.getDropGroup();\n var elementsToProcess = [];\n elementsToProcess.push({\n el: jel,\n id: this.instance.getId(jel),\n pos: params.finalPos,\n originalGroup: jel._jsPlumbParentGroup,\n redrawResult: null,\n originalPos: params.originalPos,\n reverted: false,\n dropGroup: dropGroup != null ? dropGroup.groupLoc.group : null\n });\n function addElementToProcess(el, id, currentPos, s, originalPosition) {\n var x = currentPos.x,\n y = currentPos.y;\n if (el._jsPlumbParentGroup && el._jsPlumbParentGroup.constrain) {\n var constrainRect = {\n w: el.parentNode.offsetWidth + el.parentNode.scrollLeft,\n h: el.parentNode.offsetHeight + el.parentNode.scrollTop\n };\n x = Math.max(x, 0);\n y = Math.max(y, 0);\n x = Math.min(x, constrainRect.w - s.w);\n y = Math.min(y, constrainRect.h - s.h);\n currentPos.x = x;\n currentPos.y = y;\n }\n elementsToProcess.push({\n el: el,\n id: id,\n pos: currentPos,\n originalPos: originalPosition,\n originalGroup: el._jsPlumbParentGroup,\n redrawResult: null,\n reverted: false,\n dropGroup: dropGroup === null || dropGroup === void 0 ? void 0 : dropGroup.groupLoc.group\n });\n }\n this._dragSelection.each(function (el, id, o, s, originalPosition) {\n if (el !== params.el) {\n addElementToProcess(el, id, {\n x: o.x,\n y: o.y\n }, s, originalPosition);\n }\n });\n (_this$_currentDragGro = this._currentDragGroup) === null || _this$_currentDragGro === void 0 ? void 0 : _this$_currentDragGro.members.forEach(function (d) {\n if (d.el !== params.el) {\n var offset = _this._currentDragGroupOffsets.get(d.elId);\n var s = _this._currentDragGroupSizes.get(d.elId);\n var pp = {\n x: params.finalPos.x + offset[0].x,\n y: params.finalPos.y + offset[0].y\n };\n addElementToProcess(d.el, d.elId, pp, s, _this._currentDragGroupOriginalPositions.get(d.elId));\n }\n });\n forEach(elementsToProcess, function (p) {\n var wasInGroup = p.originalGroup != null,\n isInOriginalGroup = wasInGroup && isInsideParent(_this.instance, p.el, p.pos),\n parentOffset = {\n x: 0,\n y: 0\n };\n if (wasInGroup && !isInOriginalGroup) {\n if (dropGroup == null) {\n var orphanedPosition = _this._pruneOrOrphan(p, true, true);\n if (orphanedPosition.pos != null) {\n p.pos = orphanedPosition.pos.pos;\n } else {\n if (!orphanedPosition.pruned && p.originalGroup.revert) {\n p.pos = p.originalPos;\n p.reverted = true;\n }\n }\n }\n } else if (wasInGroup && isInOriginalGroup) {\n parentOffset = _this._computeOffsetByParentGroup(p.originalGroup);\n }\n if (dropGroup != null && !isInOriginalGroup) {\n _this.instance.groupManager.addToGroup(dropGroup.groupLoc.group, false, p.el);\n } else {\n p.dropGroup = null;\n }\n if (p.reverted) {\n _this.instance.setPosition(p.el, p.pos);\n }\n p.redrawResult = _this.instance.setElementPosition(p.el, p.pos.x + parentOffset.x, p.pos.y + parentOffset.y);\n _this.instance.removeClass(p.el, CLASS_DRAGGED);\n _this.instance.select({\n source: p.el\n }).removeClass(_this.instance.elementDraggingClass + " " + _this.instance.sourceElementDraggingClass, true);\n _this.instance.select({\n target: p.el\n }).removeClass(_this.instance.elementDraggingClass + " " + _this.instance.targetElementDraggingClass, true);\n });\n if (elementsToProcess[0].originalGroup != null) {\n var currentGroup = jel._jsPlumbParentGroup;\n if (currentGroup !== elementsToProcess[0].originalGroup) {\n var originalElement = params.drag.getDragElement(true);\n if (elementsToProcess[0].originalGroup.ghost) {\n var o1 = this.instance.getPosition(this.instance.getGroupContentArea(currentGroup));\n var o2 = this.instance.getPosition(this.instance.getGroupContentArea(elementsToProcess[0].originalGroup));\n var o = {\n x: o2.x + params.pos.x - o1.x,\n y: o2.y + params.pos.y - o1.y\n };\n originalElement.style.left = o.x + "px";\n originalElement.style.top = o.y + "px";\n this.instance.revalidate(originalElement);\n }\n }\n }\n this.instance.fire(EVENT_DRAG_STOP, {\n elements: elementsToProcess,\n e: params.e,\n el: jel,\n payload: this._dragPayload\n });\n this._cleanup();\n }\n }, {\n key: "_cleanup",\n value: function _cleanup() {\n var _this2 = this;\n forEach(this._groupLocations, function (groupLoc) {\n _this2.instance.removeClass(groupLoc.el, CLASS_DRAG_ACTIVE);\n _this2.instance.removeClass(groupLoc.el, CLASS_DRAG_HOVER);\n });\n this._currentDragParentGroup = null;\n this._groupLocations.length = 0;\n this.instance.hoverSuspended = false;\n this._dragOffset = null;\n this._dragSelection.reset();\n this._dragPayload = null;\n this._currentDragGroupOffsets.clear();\n this._currentDragGroupSizes.clear();\n this._currentDragGroupOriginalPositions.clear();\n this._currentDragGroup = null;\n }\n }, {\n key: "reset",\n value: function reset() {}\n }, {\n key: "init",\n value: function init(drag) {\n this.drag = drag;\n }\n }, {\n key: "onDrag",\n value: function onDrag(params) {\n var _this3 = this;\n var el = params.drag.getDragElement();\n var id = this.instance.getId(el);\n var finalPos = params.pos;\n var elSize = this.instance.viewport.getPosition(id);\n var ui = {\n x: finalPos.x,\n y: finalPos.y\n };\n this._intersectingGroups.length = 0;\n if (this._dragOffset != null) {\n ui.x += this._dragOffset.x;\n ui.y += this._dragOffset.y;\n }\n var _one = function _one(el, bounds, findIntersectingGroups) {\n if (findIntersectingGroups) {\n var ancestorsOfIntersectingGroups = new Set();\n forEach(_this3._groupLocations, function (groupLoc) {\n if (!ancestorsOfIntersectingGroups.has(groupLoc.group.id) && intersects(bounds, groupLoc.r)) {\n if (groupLoc.group !== _this3._currentDragParentGroup) {\n _this3.instance.addClass(groupLoc.el, CLASS_DRAG_HOVER);\n }\n _this3._intersectingGroups.push({\n groupLoc: groupLoc,\n intersectingElement: params.drag.getDragElement(true),\n d: 0\n });\n forEach(_this3.instance.groupManager.getAncestors(groupLoc.group), function (g) {\n return ancestorsOfIntersectingGroups.add(g.id);\n });\n } else {\n _this3.instance.removeClass(groupLoc.el, CLASS_DRAG_HOVER);\n }\n });\n }\n _this3.instance.setElementPosition(el, bounds.x, bounds.y);\n _this3.instance.fire(EVENT_DRAG_MOVE, {\n el: el,\n e: params.e,\n pos: {\n x: bounds.x,\n y: bounds.y\n },\n originalPosition: _this3.originalPosition,\n payload: _this3._dragPayload\n });\n };\n var elBounds = {\n x: ui.x,\n y: ui.y,\n w: elSize.w,\n h: elSize.h\n };\n _one(el, elBounds, true);\n this._dragSelection.updatePositions(finalPos, this.originalPosition, function (el, id, s, b) {\n _one(el, b, false);\n });\n this._currentDragGroupOffsets.forEach(function (v, k) {\n var s = _this3._currentDragGroupSizes.get(k);\n var _b = {\n x: elBounds.x + v[0].x,\n y: elBounds.y + v[0].y,\n w: s.w,\n h: s.h\n };\n v[1].style.left = _b.x + "px";\n v[1].style.top = _b.y + "px";\n _one(v[1], _b, false);\n });\n }\n }, {\n key: "_computeOffsetByParentGroup",\n value: function _computeOffsetByParentGroup(group) {\n var parentGroupOffset = this.instance.getPosition(group.el);\n var contentArea = group.contentArea;\n if (contentArea !== group.el) {\n var caOffset = this.instance.getPosition(contentArea);\n parentGroupOffset.x += caOffset.x;\n parentGroupOffset.y += caOffset.y;\n }\n if (group.el._jsPlumbParentGroup) {\n var ancestorOffset = this._computeOffsetByParentGroup(group.el._jsPlumbParentGroup);\n parentGroupOffset.x += ancestorOffset.x;\n parentGroupOffset.y += ancestorOffset.y;\n }\n return parentGroupOffset;\n }\n }, {\n key: "onStart",\n value: function onStart(params) {\n var _this4 = this;\n var el = params.drag.getDragElement();\n var elOffset = this.instance.getPosition(el);\n this.originalPosition = {\n x: params.pos.x,\n y: params.pos.y\n };\n if (el._jsPlumbParentGroup) {\n this._dragOffset = this._computeOffsetByParentGroup(el._jsPlumbParentGroup);\n this._currentDragParentGroup = el._jsPlumbParentGroup;\n }\n var cont = true;\n var nd = el.getAttribute(ATTRIBUTE_NOT_DRAGGABLE);\n if (this.instance.elementsDraggable === false || nd != null && nd !== FALSE$1) {\n cont = false;\n }\n if (cont) {\n this._groupLocations.length = 0;\n this._intersectingGroups.length = 0;\n this.instance.hoverSuspended = true;\n var originalElement = params.drag.getDragElement(true),\n descendants = originalElement.querySelectorAll(SELECTOR_MANAGED_ELEMENT),\n ancestors = getAncestors(originalElement),\n a = [];\n Array.prototype.push.apply(a, descendants);\n Array.prototype.push.apply(a, ancestors);\n this._dragSelection.filterActiveSet(function (p) {\n return a.indexOf(p.jel) === -1;\n });\n this._dragSelection.initialisePositions();\n var _one = function _one(_el, dragGroup, dragGroupMemberSpec) {\n if (!_el._isJsPlumbGroup || _this4.instance.allowNestedGroups) {\n var isNotInAGroup = !_el._jsPlumbParentGroup;\n var membersAreDroppable = isNotInAGroup || _el._jsPlumbParentGroup.dropOverride !== true;\n var isGhostOrNotConstrained = !isNotInAGroup && (_el._jsPlumbParentGroup.ghost || _el._jsPlumbParentGroup.constrain !== true);\n if (isNotInAGroup || membersAreDroppable && isGhostOrNotConstrained) {\n forEach(_this4.instance.groupManager.getGroups(), function (group) {\n var elementGroup = _el._jsPlumbGroup;\n if (group.droppable !== false && group.enabled !== false && _el._jsPlumbGroup !== group && !_this4.instance.groupManager.isDescendant(group, elementGroup)) {\n var groupEl = group.el,\n groupElId = _this4.instance.getId(groupEl),\n p = _this4.instance.viewport.getPosition(groupElId),\n boundingRect = {\n x: p.x,\n y: p.y,\n w: p.w,\n h: p.h\n };\n var groupLocation = {\n el: groupEl,\n r: boundingRect,\n group: group\n };\n _this4._groupLocations.push(groupLocation);\n if (group !== _this4._currentDragParentGroup) {\n _this4.instance.addClass(groupEl, CLASS_DRAG_ACTIVE);\n }\n }\n });\n _this4._groupLocations.sort(function (a, b) {\n if (_this4.instance.groupManager.isDescendant(a.group, b.group)) {\n return -1;\n } else if (_this4.instance.groupManager.isAncestor(b.group, a.group)) {\n return 1;\n } else {\n return 0;\n }\n });\n }\n }\n _this4.instance.select({\n source: _el\n }).addClass(_this4.instance.elementDraggingClass + " " + _this4.instance.sourceElementDraggingClass, true);\n _this4.instance.select({\n target: _el\n }).addClass(_this4.instance.elementDraggingClass + " " + _this4.instance.targetElementDraggingClass, true);\n return _this4.instance.fire(EVENT_DRAG_START, {\n el: _el,\n e: params.e,\n originalPosition: _this4.originalPosition,\n pos: _this4.originalPosition,\n dragGroup: dragGroup,\n dragGroupMemberSpec: dragGroupMemberSpec\n });\n };\n var elId = this.instance.getId(el);\n this._currentDragGroup = this._dragGroupByElementIdMap[elId];\n if (this._currentDragGroup && !isActiveDragGroupMember(this._currentDragGroup, el)) {\n this._currentDragGroup = null;\n }\n var dragStartReturn = _one(el);\n if (dragStartReturn === false) {\n this._cleanup();\n return false;\n } else {\n this._dragPayload = dragStartReturn;\n }\n if (this._currentDragGroup != null) {\n this._currentDragGroupOffsets.clear();\n this._currentDragGroupSizes.clear();\n this._currentDragGroup.members.forEach(function (jel) {\n var vp = _this4.instance.viewport.getPosition(jel.elId);\n _this4._currentDragGroupOffsets.set(jel.elId, [{\n x: vp.x - elOffset.x,\n y: vp.y - elOffset.y\n }, jel.el]);\n _this4._currentDragGroupSizes.set(jel.elId, vp);\n _this4._currentDragGroupOriginalPositions.set(jel.elId, {\n x: vp.x,\n y: vp.y\n });\n _one(jel.el, _this4._currentDragGroup, jel);\n });\n }\n }\n return cont;\n }\n }, {\n key: "addToDragGroup",\n value: function addToDragGroup(spec) {\n var _this5 = this;\n var details = decodeDragGroupSpec(this.instance, spec);\n var dragGroup = this._dragGroupMap[details.id];\n if (dragGroup == null) {\n dragGroup = {\n id: details.id,\n members: new Set()\n };\n this._dragGroupMap[details.id] = dragGroup;\n }\n for (var _len = arguments.length, els = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n els[_key - 1] = arguments[_key];\n }\n this.removeFromDragGroup.apply(this, els);\n forEach(els, function (el) {\n var elId = _this5.instance.getId(el);\n dragGroup.members.add({\n elId: elId,\n el: el,\n active: details.active\n });\n _this5._dragGroupByElementIdMap[elId] = dragGroup;\n });\n }\n }, {\n key: "removeFromDragGroup",\n value: function removeFromDragGroup() {\n var _this6 = this;\n for (var _len2 = arguments.length, els = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n els[_key2] = arguments[_key2];\n }\n forEach(els, function (el) {\n var id = _this6.instance.getId(el);\n var dragGroup = _this6._dragGroupByElementIdMap[id];\n if (dragGroup != null) {\n var s = new Set();\n dragGroup.members.forEach(function (member) {\n if (member.el !== el) {\n s.add(member);\n }\n });\n dragGroup.members = s;\n delete _this6._dragGroupByElementIdMap[id];\n }\n });\n }\n }, {\n key: "setDragGroupState",\n value: function setDragGroupState(active) {\n var _this7 = this;\n for (var _len3 = arguments.length, els = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n els[_key3 - 1] = arguments[_key3];\n }\n var elementIds = els.map(function (el) {\n return _this7.instance.getId(el);\n });\n forEach(elementIds, function (id) {\n var dragGroup = _this7._dragGroupByElementIdMap[id];\n if (dragGroup != null) {\n var member = getFromSetWithFunction(dragGroup.members, function (m) {\n return m.elId === id;\n });\n if (member != null) {\n member.active = active;\n }\n }\n });\n }\n }, {\n key: "clearDragGroup",\n value: function clearDragGroup(name) {\n var _this8 = this;\n var dragGroup = this._dragGroupMap[name];\n if (dragGroup != null) {\n dragGroup.members.forEach(function (member) {\n delete _this8._dragGroupByElementIdMap[member.elId];\n });\n dragGroup.members.clear();\n }\n }\n }, {\n key: "_pruneOrOrphan",\n value: function _pruneOrOrphan(params, doNotTransferToAncestor, isDefinitelyNotInsideParent) {\n var jel = params.el;\n var orphanedPosition = {\n pruned: false,\n pos: null\n };\n if (isDefinitelyNotInsideParent || !isInsideParent(this.instance, jel, params.pos)) {\n var group = jel._jsPlumbParentGroup;\n if (group.prune) {\n if (jel._isJsPlumbGroup) {\n this.instance.removeGroup(jel._jsPlumbGroup);\n } else {\n group.remove(params.el, true);\n }\n orphanedPosition.pruned = true;\n } else if (group.orphan) {\n orphanedPosition.pos = this.instance.groupManager.orphan(params.el, doNotTransferToAncestor);\n if (jel._isJsPlumbGroup) {\n group.removeGroup(jel._jsPlumbGroup);\n } else {\n group.remove(params.el);\n }\n }\n }\n return orphanedPosition;\n }\n }]);\n return ElementDragHandler;\n}();\n\nvar endpointMap$1 = {};\nvar endpointComputers = {};\nvar handlers = {};\nvar EndpointFactory = {\n get: function get(ep, name, params) {\n var e = endpointMap$1[name];\n if (!e) {\n throw {\n message: "jsPlumb: unknown endpoint type \'" + name + "\'"\n };\n } else {\n return new e(ep, params);\n }\n },\n clone: function clone(epr) {\n var handler = handlers[epr.type];\n return EndpointFactory.get(epr.endpoint, epr.type, handler.getParams(epr));\n },\n compute: function compute(endpoint, anchorPoint, orientation, endpointStyle) {\n var c = endpointComputers[endpoint.type];\n if (c != null) {\n return c(endpoint, anchorPoint, orientation, endpointStyle);\n } else {\n log("jsPlumb: cannot find endpoint calculator for endpoint of type ", endpoint.type);\n }\n },\n registerHandler: function registerHandler(eph) {\n handlers[eph.type] = eph;\n endpointMap$1[eph.type] = eph.cls;\n endpointComputers[eph.type] = eph.compute;\n }\n};\n\nvar EndpointRepresentation = function () {\n function EndpointRepresentation(endpoint, params) {\n _classCallCheck(this, EndpointRepresentation);\n this.endpoint = endpoint;\n _defineProperty(this, "typeId", void 0);\n _defineProperty(this, "x", void 0);\n _defineProperty(this, "y", void 0);\n _defineProperty(this, "w", void 0);\n _defineProperty(this, "h", void 0);\n _defineProperty(this, "computedValue", void 0);\n _defineProperty(this, "bounds", EMPTY_BOUNDS());\n _defineProperty(this, "classes", []);\n _defineProperty(this, "instance", void 0);\n _defineProperty(this, "type", void 0);\n params = params || {};\n this.instance = endpoint.instance;\n if (endpoint.cssClass) {\n this.classes.push(endpoint.cssClass);\n }\n if (params.cssClass) {\n this.classes.push(params.cssClass);\n }\n }\n _createClass(EndpointRepresentation, [{\n key: "addClass",\n value: function addClass(c) {\n this.classes.push(c);\n this.instance.addEndpointClass(this.endpoint, c);\n }\n }, {\n key: "removeClass",\n value: function removeClass(c) {\n this.classes = this.classes.filter(function (_c) {\n return _c !== c;\n });\n this.instance.removeEndpointClass(this.endpoint, c);\n }\n }, {\n key: "compute",\n value: function compute(anchorPoint, orientation, endpointStyle) {\n this.computedValue = EndpointFactory.compute(this, anchorPoint, orientation, endpointStyle);\n this.bounds.xmin = this.x;\n this.bounds.ymin = this.y;\n this.bounds.xmax = this.x + this.w;\n this.bounds.ymax = this.y + this.h;\n }\n }, {\n key: "setVisible",\n value: function setVisible(v) {\n this.instance.setEndpointVisible(this.endpoint, v);\n }\n }]);\n return EndpointRepresentation;\n}();\n\nvar _opposites, _clockwiseOptions, _antiClockwiseOptions;\nvar FaceValues;\n(function (FaceValues) {\n FaceValues["top"] = "top";\n FaceValues["left"] = "left";\n FaceValues["right"] = "right";\n FaceValues["bottom"] = "bottom";\n})(FaceValues || (FaceValues = {}));\nvar TOP = FaceValues.top;\nvar LEFT = FaceValues.left;\nvar RIGHT = FaceValues.right;\nvar BOTTOM = FaceValues.bottom;\nvar X_AXIS_FACES = [LEFT, RIGHT];\nvar Y_AXIS_FACES = [TOP, BOTTOM];\nvar LightweightFloatingAnchor = function () {\n function LightweightFloatingAnchor(instance, element, elementId) {\n _classCallCheck(this, LightweightFloatingAnchor);\n this.instance = instance;\n this.element = element;\n _defineProperty(this, "isFloating", true);\n _defineProperty(this, "isContinuous", void 0);\n _defineProperty(this, "isDynamic", void 0);\n _defineProperty(this, "locations", []);\n _defineProperty(this, "currentLocation", 0);\n _defineProperty(this, "locked", false);\n _defineProperty(this, "cssClass", \'\');\n _defineProperty(this, "timestamp", null);\n _defineProperty(this, "type", "Floating");\n _defineProperty(this, "id", uuid());\n _defineProperty(this, "orientation", [0, 0]);\n _defineProperty(this, "size", void 0);\n this.size = instance.viewport.getPosition(elementId);\n this.locations.push({\n x: 0.5,\n y: 0.5,\n ox: this.orientation[0],\n oy: this.orientation[1],\n offx: 0,\n offy: 0,\n iox: this.orientation[0],\n ioy: this.orientation[1],\n cls: \'\'\n });\n }\n _createClass(LightweightFloatingAnchor, [{\n key: "_updateOrientationInRouter",\n value: function _updateOrientationInRouter() {\n this.instance.router.setAnchorOrientation(this, [this.locations[0].ox, this.locations[0].oy]);\n }\n }, {\n key: "over",\n value: function over(endpoint) {\n this.orientation = this.instance.router.getEndpointOrientation(endpoint);\n this.locations[0].ox = this.orientation[0];\n this.locations[0].oy = this.orientation[1];\n this._updateOrientationInRouter();\n }\n }, {\n key: "out",\n value: function out() {\n this.orientation = null;\n this.locations[0].ox = this.locations[0].iox;\n this.locations[0].oy = this.locations[0].ioy;\n this._updateOrientationInRouter();\n }\n }]);\n return LightweightFloatingAnchor;\n}();\nvar opposites = (_opposites = {}, _defineProperty(_opposites, TOP, BOTTOM), _defineProperty(_opposites, RIGHT, LEFT), _defineProperty(_opposites, LEFT, RIGHT), _defineProperty(_opposites, BOTTOM, TOP), _opposites);\nvar clockwiseOptions = (_clockwiseOptions = {}, _defineProperty(_clockwiseOptions, TOP, RIGHT), _defineProperty(_clockwiseOptions, RIGHT, BOTTOM), _defineProperty(_clockwiseOptions, LEFT, TOP), _defineProperty(_clockwiseOptions, BOTTOM, LEFT), _clockwiseOptions);\nvar antiClockwiseOptions = (_antiClockwiseOptions = {}, _defineProperty(_antiClockwiseOptions, TOP, LEFT), _defineProperty(_antiClockwiseOptions, RIGHT, TOP), _defineProperty(_antiClockwiseOptions, LEFT, BOTTOM), _defineProperty(_antiClockwiseOptions, BOTTOM, RIGHT), _antiClockwiseOptions);\nfunction getDefaultFace(a) {\n return a.faces.length === 0 ? TOP : a.faces[0];\n}\nfunction _isFaceAvailable(a, face) {\n return a.faces.indexOf(face) !== -1;\n}\nfunction _secondBest(a, edge) {\n return (a.clockwise ? clockwiseOptions : antiClockwiseOptions)[edge];\n}\nfunction _lastChoice(a, edge) {\n return (a.clockwise ? antiClockwiseOptions : clockwiseOptions)[edge];\n}\nfunction isEdgeSupported(a, edge) {\n return a.lockedAxis == null ? a.lockedFace == null ? _isFaceAvailable(a, edge) === true : a.lockedFace === edge : a.lockedAxis.indexOf(edge) !== -1;\n}\nfunction verifyFace(a, edge) {\n if (_isFaceAvailable(a, edge)) {\n return edge;\n } else if (_isFaceAvailable(a, opposites[edge])) {\n return opposites[edge];\n } else {\n var secondBest = _secondBest(a, edge);\n if (_isFaceAvailable(a, secondBest)) {\n return secondBest;\n } else {\n var lastChoice = _lastChoice(a, edge);\n if (_isFaceAvailable(a, lastChoice)) {\n return lastChoice;\n }\n }\n }\n return edge;\n}\nvar _top = {\n x: 0.5,\n y: 0,\n ox: 0,\n oy: -1,\n offx: 0,\n offy: 0\n},\n _bottom = {\n x: 0.5,\n y: 1,\n ox: 0,\n oy: 1,\n offx: 0,\n offy: 0\n},\n _left = {\n x: 0,\n y: 0.5,\n ox: -1,\n oy: 0,\n offx: 0,\n offy: 0\n},\n _right = {\n x: 1,\n y: 0.5,\n ox: 1,\n oy: 0,\n offx: 0,\n offy: 0\n},\n _topLeft = {\n x: 0,\n y: 0,\n ox: 0,\n oy: -1,\n offx: 0,\n offy: 0\n},\n _topRight = {\n x: 1,\n y: 0,\n ox: 1,\n oy: -1,\n offx: 0,\n offy: 0\n},\n _bottomLeft = {\n x: 0,\n y: 1,\n ox: 0,\n oy: 1,\n offx: 0,\n offy: 0\n},\n _bottomRight = {\n x: 1,\n y: 1,\n ox: 0,\n oy: 1,\n offx: 0,\n offy: 0\n},\n _center = {\n x: 0.5,\n y: 0.5,\n ox: 0,\n oy: 0,\n offx: 0,\n offy: 0\n};\nvar namedValues = {\n "Top": [_top],\n "Bottom": [_bottom],\n "Left": [_left],\n "Right": [_right],\n "TopLeft": [_topLeft],\n "TopRight": [_topRight],\n "BottomLeft": [_bottomLeft],\n "BottomRight": [_bottomRight],\n "Center": [_center],\n "AutoDefault": [_top, _left, _bottom, _right]\n};\nvar namedContinuousValues = {\n "Continuous": {\n faces: [TOP, LEFT, BOTTOM, RIGHT]\n },\n "ContinuousTop": {\n faces: [TOP]\n },\n "ContinuousRight": {\n faces: [RIGHT]\n },\n "ContinuousBottom": {\n faces: [BOTTOM]\n },\n "ContinuousLeft": {\n faces: [LEFT]\n },\n "ContinuousLeftRight": {\n faces: [LEFT, RIGHT]\n },\n "ContinuousTopBottom": {\n faces: [TOP, BOTTOM]\n }\n};\nfunction getNamedAnchor(name, params) {\n params = params || {};\n if (name === AnchorLocations.Perimeter) {\n return _createPerimeterAnchor(params);\n }\n var a = namedValues[name];\n if (a != null) {\n return _createAnchor(name, map(a, function (_a) {\n return extend({\n iox: _a.ox,\n ioy: _a.oy\n }, _a);\n }), params);\n }\n a = namedContinuousValues[name];\n if (a != null) {\n return _createContinuousAnchor(name, a.faces, params);\n }\n throw {\n message: "jsPlumb: unknown anchor type \'" + name + "\'"\n };\n}\nfunction _createAnchor(type, locations, params) {\n return {\n type: type,\n locations: locations,\n currentLocation: 0,\n locked: false,\n id: uuid(),\n isFloating: false,\n isContinuous: false,\n isDynamic: locations.length > 1,\n timestamp: null,\n cssClass: params.cssClass || ""\n };\n}\nfunction createFloatingAnchor(instance, element, elementId) {\n return new LightweightFloatingAnchor(instance, element, elementId);\n}\nvar PROPERTY_CURRENT_FACE = "currentFace";\nfunction _createContinuousAnchor(type, faces, params) {\n var ca = {\n type: type,\n locations: [],\n currentLocation: 0,\n locked: false,\n id: uuid(),\n cssClass: params.cssClass || "",\n isFloating: false,\n isContinuous: true,\n timestamp: null,\n faces: params.faces || faces,\n lockedFace: null,\n lockedAxis: null,\n clockwise: !(params.clockwise === false),\n __currentFace: null\n };\n Object.defineProperty(ca, PROPERTY_CURRENT_FACE, {\n get: function get() {\n return this.__currentFace;\n },\n set: function set(f) {\n this.__currentFace = verifyFace(this, f);\n }\n });\n return ca;\n}\nfunction isPrimitiveAnchorSpec(sa) {\n return sa.length < 7 && sa.every(isNumber) || sa.length === 7 && sa.slice(0, 5).every(isNumber) && isString(sa[6]);\n}\nfunction makeLightweightAnchorFromSpec(spec) {\n if (isString(spec)) {\n return getNamedAnchor(spec, null);\n } else if (Array.isArray(spec)) {\n if (isPrimitiveAnchorSpec(spec)) {\n var _spec = spec;\n return _createAnchor(null, [{\n x: _spec[0],\n y: _spec[1],\n ox: _spec[2],\n oy: _spec[3],\n offx: _spec[4] == null ? 0 : _spec[4],\n offy: _spec[5] == null ? 0 : _spec[5],\n iox: _spec[2],\n ioy: _spec[3],\n cls: _spec[6] || ""\n }], {\n cssClass: _spec[6] || ""\n });\n } else {\n var locations = map(spec, function (aSpec) {\n if (isString(aSpec)) {\n var a = namedValues[aSpec];\n return a != null ? extend({\n iox: a[0].ox,\n ioy: a[0].oy,\n cls: ""\n }, a[0]) : null;\n } else if (isPrimitiveAnchorSpec(aSpec)) {\n return {\n x: aSpec[0],\n y: aSpec[1],\n ox: aSpec[2],\n oy: aSpec[3],\n offx: aSpec[4] == null ? 0 : aSpec[4],\n offy: aSpec[5] == null ? 0 : aSpec[5],\n iox: aSpec[2],\n ioy: aSpec[3],\n cls: aSpec[6] || ""\n };\n }\n }).filter(function (ar) {\n return ar != null;\n });\n return _createAnchor("Dynamic", locations, {});\n }\n } else {\n var sa = spec;\n return getNamedAnchor(sa.type, sa.options);\n }\n}\nfunction circleGenerator(anchorCount) {\n var r = 0.5,\n step = Math.PI * 2 / anchorCount,\n a = [];\n var current = 0;\n for (var i = 0; i < anchorCount; i++) {\n var x = r + r * Math.sin(current),\n y = r + r * Math.cos(current);\n a.push({\n x: x,\n y: y,\n ox: 0,\n oy: 0,\n offx: 0,\n offy: 0,\n iox: 0,\n ioy: 0,\n cls: \'\'\n });\n current += step;\n }\n return a;\n}\nfunction _path(segments, anchorCount) {\n var anchorsPerFace = anchorCount / segments.length,\n a = [],\n _computeFace = function _computeFace(x1, y1, x2, y2, fractionalLength, ox, oy) {\n anchorsPerFace = anchorCount * fractionalLength;\n var dx = (x2 - x1) / anchorsPerFace,\n dy = (y2 - y1) / anchorsPerFace;\n for (var i = 0; i < anchorsPerFace; i++) {\n a.push({\n x: x1 + dx * i,\n y: y1 + dy * i,\n ox: ox == null ? 0 : ox,\n oy: oy == null ? 0 : oy,\n offx: 0,\n offy: 0,\n iox: 0,\n ioy: 0,\n cls: \'\'\n });\n }\n };\n for (var i = 0; i < segments.length; i++) {\n _computeFace.apply(null, segments[i]);\n }\n return a;\n}\nfunction shapeGenerator(faces, anchorCount) {\n var s = [];\n for (var i = 0; i < faces.length; i++) {\n s.push([faces[i][0], faces[i][1], faces[i][2], faces[i][3], 1 / faces.length, faces[i][4], faces[i][5]]);\n }\n return _path(s, anchorCount);\n}\nfunction rectangleGenerator(anchorCount) {\n return shapeGenerator([[0, 0, 1, 0, 0, -1], [1, 0, 1, 1, 1, 0], [1, 1, 0, 1, 0, 1], [0, 1, 0, 0, -1, 0]], anchorCount);\n}\nfunction diamondGenerator(anchorCount) {\n return shapeGenerator([[0.5, 0, 1, 0.5], [1, 0.5, 0.5, 1], [0.5, 1, 0, 0.5], [0, 0.5, 0.5, 0]], anchorCount);\n}\nfunction triangleGenerator(anchorCount) {\n return shapeGenerator([[0.5, 0, 1, 1], [1, 1, 0, 1], [0, 1, 0.5, 0]], anchorCount);\n}\nfunction rotate$1(points, amountInDegrees) {\n var o = [],\n theta = amountInDegrees / 180 * Math.PI;\n for (var i = 0; i < points.length; i++) {\n var _x = points[i].x - 0.5,\n _y = points[i].y - 0.5;\n o.push({\n x: 0.5 + (_x * Math.cos(theta) - _y * Math.sin(theta)),\n y: 0.5 + (_x * Math.sin(theta) + _y * Math.cos(theta)),\n ox: points[i].ox,\n oy: points[i].oy,\n offx: 0,\n offy: 0,\n iox: 0,\n ioy: 0,\n cls: \'\'\n });\n }\n return o;\n}\nvar anchorGenerators = new Map();\nanchorGenerators.set(PerimeterAnchorShapes.Circle, circleGenerator);\nanchorGenerators.set(PerimeterAnchorShapes.Ellipse, circleGenerator);\nanchorGenerators.set(PerimeterAnchorShapes.Rectangle, rectangleGenerator);\nanchorGenerators.set(PerimeterAnchorShapes.Square, rectangleGenerator);\nanchorGenerators.set(PerimeterAnchorShapes.Diamond, diamondGenerator);\nanchorGenerators.set(PerimeterAnchorShapes.Triangle, triangleGenerator);\nfunction _createPerimeterAnchor(params) {\n params = params || {};\n var anchorCount = params.anchorCount || 60,\n shape = params.shape;\n if (!shape) {\n throw new Error("no shape supplied to Perimeter Anchor type");\n }\n if (!anchorGenerators.has(shape)) {\n throw new Error("Shape [" + shape + "] is unknown by Perimeter Anchor type");\n }\n var da = anchorGenerators.get(shape)(anchorCount);\n if (params.rotation) {\n da = rotate$1(da, params.rotation);\n }\n var a = _createAnchor(AnchorLocations.Perimeter, da, params);\n var aa = extend(a, {\n shape: shape\n });\n return aa;\n}\n\nvar ConnectionDragSelector = function () {\n function ConnectionDragSelector(selector, def) {\n var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n _classCallCheck(this, ConnectionDragSelector);\n this.selector = selector;\n this.def = def;\n this.exclude = exclude;\n _defineProperty(this, "id", void 0);\n _defineProperty(this, "redrop", void 0);\n this.id = uuid();\n this.redrop = def.def.redrop || REDROP_POLICY_STRICT;\n }\n _createClass(ConnectionDragSelector, [{\n key: "setEnabled",\n value: function setEnabled(enabled) {\n this.def.enabled = enabled;\n }\n }, {\n key: "isEnabled",\n value: function isEnabled() {\n return this.def.enabled !== false;\n }\n }]);\n return ConnectionDragSelector;\n}();\nvar REDROP_POLICY_STRICT = "strict";\nvar REDROP_POLICY_ANY = "any";\nvar REDROP_POLICY_ANY_SOURCE = "anySource";\nvar REDROP_POLICY_ANY_TARGET = "anyTarget";\nvar REDROP_POLICY_ANY_SOURCE_OR_TARGET = "anySourceOrTarget";\n\nfunction _makeFloatingEndpoint(ep, endpoint, referenceCanvas, sourceElement, sourceElementId, instance) {\n var floatingAnchor = createFloatingAnchor(instance, sourceElement, sourceElementId);\n var p = {\n paintStyle: ep.getPaintStyle(),\n preparedAnchor: floatingAnchor,\n element: sourceElement,\n scope: ep.scope,\n cssClass: [CLASS_ENDPOINT_FLOATING, ep.cssClass].join(" ")\n };\n if (endpoint != null) {\n if (isAssignableFrom(endpoint, EndpointRepresentation)) {\n p.existingEndpoint = endpoint;\n } else {\n p.endpoint = endpoint;\n }\n }\n var actualEndpoint = instance._internal_newEndpoint(p);\n instance._paintEndpoint(actualEndpoint, {});\n return actualEndpoint;\n}\nfunction selectorFilter(evt, _el, selector, _instance, negate) {\n var t = evt.target || evt.srcElement,\n ok = false,\n sel = _instance.getSelector(_el, selector);\n for (var j = 0; j < sel.length; j++) {\n if (sel[j] === t) {\n ok = true;\n break;\n }\n }\n return negate ? !ok : ok;\n}\nvar SELECTOR_DRAG_ACTIVE_OR_HOVER = cls(CLASS_DRAG_ACTIVE, CLASS_DRAG_HOVER);\nvar SOURCE_SELECTOR_UNIQUE_ENDPOINT_DATA = "sourceSelectorEndpoint";\nvar EndpointDragHandler = function () {\n function EndpointDragHandler(instance) {\n _classCallCheck(this, EndpointDragHandler);\n this.instance = instance;\n _defineProperty(this, "jpc", void 0);\n _defineProperty(this, "existingJpc", void 0);\n _defineProperty(this, "_originalAnchorSpec", void 0);\n _defineProperty(this, "ep", void 0);\n _defineProperty(this, "endpointRepresentation", void 0);\n _defineProperty(this, "canvasElement", void 0);\n _defineProperty(this, "_activeDefinition", void 0);\n _defineProperty(this, "placeholderInfo", {\n id: null,\n element: null\n });\n _defineProperty(this, "floatingIndex", void 0);\n _defineProperty(this, "floatingId", void 0);\n _defineProperty(this, "floatingElement", void 0);\n _defineProperty(this, "floatingEndpoint", void 0);\n _defineProperty(this, "floatingAnchor", void 0);\n _defineProperty(this, "_stopped", void 0);\n _defineProperty(this, "inPlaceCopy", void 0);\n _defineProperty(this, "endpointDropTargets", []);\n _defineProperty(this, "currentDropTarget", null);\n _defineProperty(this, "payload", void 0);\n _defineProperty(this, "floatingConnections", {});\n _defineProperty(this, "_forceReattach", void 0);\n _defineProperty(this, "_forceDetach", void 0);\n _defineProperty(this, "mousedownHandler", void 0);\n _defineProperty(this, "mouseupHandler", void 0);\n _defineProperty(this, "selector", cls(CLASS_ENDPOINT));\n var container = instance.getContainer();\n this.mousedownHandler = this._mousedownHandler.bind(this);\n this.mouseupHandler = this._mouseupHandler.bind(this);\n instance.on(container, EVENT_MOUSEDOWN, SELECTOR_MANAGED_ELEMENT, this.mousedownHandler);\n instance.on(container, EVENT_MOUSEUP, [SELECTOR_MANAGED_ELEMENT, cls(CLASS_ENDPOINT)].join(","), this.mouseupHandler);\n }\n _createClass(EndpointDragHandler, [{\n key: "_resolveDragParent",\n value: function _resolveDragParent(def, eventTarget) {\n var container = this.instance.getContainer();\n var parent = findParent(eventTarget, SELECTOR_MANAGED_ELEMENT, container, true);\n if (def.parentSelector != null) {\n var child = findParent(eventTarget, def.parentSelector, container, true);\n if (child != null) {\n parent = findParent(child.parentNode, SELECTOR_MANAGED_ELEMENT, container, false);\n }\n return child || parent;\n } else {\n return parent;\n }\n }\n }, {\n key: "_mousedownHandler",\n value: function _mousedownHandler(e) {\n var sourceEl;\n var sourceSelector;\n if (e.which === 3 || e.button === 2) {\n return;\n }\n var eventTarget = e.target || e.srcElement;\n sourceSelector = this._getSourceDefinition(e);\n if (sourceSelector != null) {\n sourceEl = this._resolveDragParent(sourceSelector.def.def, eventTarget);\n if (sourceEl == null || sourceEl.getAttribute(ATTRIBUTE_JTK_ENABLED) === FALSE$1) {\n return;\n }\n }\n if (sourceSelector) {\n var sourceElement = e.currentTarget,\n def;\n if (eventTarget.getAttribute(ATTRIBUTE_JTK_ENABLED) !== FALSE$1) {\n consume(e);\n this._activeDefinition = sourceSelector;\n def = sourceSelector.def.def;\n if (def.canAcceptNewConnection != null && !def.canAcceptNewConnection(sourceEl, e)) {\n return false;\n }\n var elxy = getPositionOnElement(e, sourceEl, this.instance.currentZoom);\n var tempEndpointParams = {\n element: sourceEl\n };\n extend(tempEndpointParams, def);\n tempEndpointParams.isTemporarySource = true;\n if (def.scope) {\n tempEndpointParams.scope = def.scope;\n } else {\n var scopeFromElement = eventTarget.getAttribute(ATTRIBUTE_JTK_SCOPE);\n if (scopeFromElement != null) {\n tempEndpointParams.scope = scopeFromElement;\n }\n }\n var extractedParameters = def.parameterExtractor ? def.parameterExtractor(sourceEl, eventTarget, e) : {};\n tempEndpointParams = merge(tempEndpointParams, extractedParameters);\n if (tempEndpointParams.maxConnections != null && tempEndpointParams.maxConnections >= 0) {\n var sourceCount = this.instance.select({\n source: sourceEl\n }).length;\n if (sourceCount >= tempEndpointParams.maxConnections) {\n consume(e);\n if (def.onMaxConnections) {\n def.onMaxConnections({\n element: sourceEl,\n maxConnections: tempEndpointParams.maxConnections\n }, e);\n }\n e.stopImmediatePropagation && e.stopImmediatePropagation();\n return false;\n }\n }\n if (def.anchorPositionFinder) {\n var maybeAnchorSpec = def.anchorPositionFinder(sourceEl, elxy, def, e);\n if (maybeAnchorSpec != null) {\n tempEndpointParams.anchor = maybeAnchorSpec;\n }\n }\n this._originalAnchorSpec = tempEndpointParams.anchor || (this.instance.areDefaultAnchorsSet() ? this.instance.defaults.anchors[0] : this.instance.defaults.anchor);\n var _originalAnchor = this.instance.router.prepareAnchor(this._originalAnchorSpec);\n var anchorSpecToUse = [elxy.x, elxy.y, 0, 0];\n if (_originalAnchor.locations.length > 0) {\n anchorSpecToUse[2] = _originalAnchor.locations[0].ox;\n anchorSpecToUse[3] = _originalAnchor.locations[0].oy;\n } else if (_originalAnchor.isContinuous) {\n var dx = elxy.x < 0.5 ? elxy.x : 1 - elxy.x;\n var dy = elxy.y < 0.5 ? elxy.y : 1 - elxy.y;\n anchorSpecToUse[2] = dx < dy ? elxy.x < 0.5 ? -1 : 1 : 0;\n anchorSpecToUse[3] = dy < dx ? elxy.y < 0.5 ? -1 : 1 : 0;\n }\n tempEndpointParams.anchor = anchorSpecToUse;\n tempEndpointParams.deleteOnEmpty = true;\n this.ep = this.instance._internal_newEndpoint(tempEndpointParams);\n var payload = {};\n if (def.extract) {\n for (var att in def.extract) {\n var v = eventTarget.getAttribute(att);\n if (v) {\n payload[def.extract[att]] = v;\n }\n }\n this.ep.mergeParameters(payload);\n }\n if (tempEndpointParams.uniqueEndpoint) {\n var elementId = this.ep.elementId;\n var existingUniqueEndpoint = this.instance.getManagedData(elementId, SOURCE_SELECTOR_UNIQUE_ENDPOINT_DATA, sourceSelector.id);\n if (existingUniqueEndpoint == null) {\n this.instance.setManagedData(elementId, SOURCE_SELECTOR_UNIQUE_ENDPOINT_DATA, sourceSelector.id, this.ep);\n this.ep.deleteOnEmpty = false;\n } else {\n this.ep.finalEndpoint = existingUniqueEndpoint;\n }\n }\n sourceElement._jsPlumbOrphanedEndpoints = sourceElement._jsPlumbOrphanedEndpoints || [];\n sourceElement._jsPlumbOrphanedEndpoints.push(this.ep);\n this.instance.trigger(this.ep.endpoint.canvas, EVENT_MOUSEDOWN, e, payload);\n }\n }\n }\n }, {\n key: "_mouseupHandler",\n value: function _mouseupHandler(e) {\n var el = e.currentTarget || e.srcElement;\n if (el._jsPlumbOrphanedEndpoints) {\n each(el._jsPlumbOrphanedEndpoints, this.instance._maybePruneEndpoint.bind(this.instance));\n el._jsPlumbOrphanedEndpoints.length = 0;\n }\n this._activeDefinition = null;\n }\n }, {\n key: "onDragInit",\n value: function onDragInit(el) {\n var ipco = getElementPosition(el, this.instance),\n ips = getElementSize(el, this.instance);\n this._makeDraggablePlaceholder(ipco, ips);\n this.placeholderInfo.element.jtk = el.jtk;\n return this.placeholderInfo.element;\n }\n }, {\n key: "onDragAbort",\n value: function onDragAbort(el) {\n this._cleanupDraggablePlaceholder();\n }\n }, {\n key: "_makeDraggablePlaceholder",\n value: function _makeDraggablePlaceholder(ipco, ips) {\n this.placeholderInfo = this.placeholderInfo || {};\n var n = createElement(ELEMENT_DIV, {\n position: "absolute"\n });\n this.instance._appendElementToContainer(n);\n var id = this.instance.getId(n);\n this.instance.setPosition(n, ipco);\n n.style.width = ips.w + "px";\n n.style.height = ips.h + "px";\n this.instance.manage(n);\n this.placeholderInfo.id = id;\n this.placeholderInfo.element = n;\n return n;\n }\n }, {\n key: "_cleanupDraggablePlaceholder",\n value: function _cleanupDraggablePlaceholder() {\n if (this.placeholderInfo.element) {\n this.instance.unmanage(this.placeholderInfo.element, true);\n delete this.placeholderInfo.element;\n delete this.placeholderInfo.id;\n }\n }\n }, {\n key: "reset",\n value: function reset() {\n var c = this.instance.getContainer();\n this.instance.off(c, EVENT_MOUSEUP, this.mouseupHandler);\n this.instance.off(c, EVENT_MOUSEDOWN, this.mousedownHandler);\n }\n }, {\n key: "init",\n value: function init(drag) {}\n }, {\n key: "startNewConnectionDrag",\n value: function startNewConnectionDrag(scope, data) {\n this.jpc = this.instance._newConnection({\n sourceEndpoint: this.ep,\n targetEndpoint: this.floatingEndpoint,\n source: this.ep.element,\n target: this.placeholderInfo.element,\n paintStyle: this.ep.connectorStyle,\n hoverPaintStyle: this.ep.connectorHoverStyle,\n connector: this.ep.connector,\n overlays: this.ep.connectorOverlays,\n type: this.ep.edgeType,\n cssClass: this.ep.connectorClass,\n hoverClass: this.ep.connectorHoverClass,\n scope: scope,\n data: data\n });\n this.jpc.pending = true;\n this.jpc.addClass(this.instance.draggingClass);\n this.ep.addClass(this.instance.draggingClass);\n this.instance.fire(EVENT_CONNECTION_DRAG, this.jpc);\n }\n }, {\n key: "startExistingConnectionDrag",\n value: function startExistingConnectionDrag() {\n this.existingJpc = true;\n this.instance.setHover(this.jpc, false);\n var anchorIdx = this.jpc.endpoints[0].id === this.ep.id ? 0 : 1;\n this.ep.detachFromConnection(this.jpc, null, true);\n this.floatingEndpoint.addConnection(this.jpc);\n this.instance.fire(EVENT_CONNECTION_DRAG, this.jpc);\n this.instance.sourceOrTargetChanged(this.jpc.endpoints[anchorIdx].elementId, this.placeholderInfo.id, this.jpc, this.placeholderInfo.element, anchorIdx);\n this.jpc.suspendedEndpoint = this.jpc.endpoints[anchorIdx];\n this.jpc.suspendedElement = this.jpc.endpoints[anchorIdx].element;\n this.jpc.suspendedElementId = this.jpc.endpoints[anchorIdx].elementId;\n this.jpc.suspendedElementType = anchorIdx === 0 ? SOURCE : TARGET;\n this.instance.setHover(this.jpc.suspendedEndpoint, false);\n this.floatingEndpoint.referenceEndpoint = this.jpc.suspendedEndpoint;\n this.floatingEndpoint.mergeParameters(this.jpc.suspendedEndpoint.parameters);\n this.jpc.endpoints[anchorIdx] = this.floatingEndpoint;\n this.jpc.addClass(this.instance.draggingClass);\n this.floatingId = this.placeholderInfo.id;\n this.floatingIndex = anchorIdx;\n this.instance._refreshEndpoint(this.ep);\n }\n }, {\n key: "_shouldStartDrag",\n value: function _shouldStartDrag() {\n var _continue = true;\n if (!this.ep.enabled) {\n _continue = false;\n }\n if (this.jpc == null && !this.ep.isSource && !this.ep.isTemporarySource) {\n _continue = false;\n }\n if (this.ep.isSource && this.ep.isFull() && !(this.jpc != null && this.ep.dragAllowedWhenFull)) {\n _continue = false;\n }\n if (this.jpc != null && !this.jpc.isDetachable(this.ep)) {\n if (this.ep.isFull()) {\n _continue = false;\n } else {\n this.jpc = null;\n }\n }\n var payload = {};\n var beforeDrag = this.instance.checkCondition(this.jpc == null ? INTERCEPT_BEFORE_DRAG : INTERCEPT_BEFORE_START_DETACH, {\n endpoint: this.ep,\n source: this.ep.element,\n sourceId: this.ep.elementId,\n connection: this.jpc\n });\n if (beforeDrag === false) {\n _continue = false;\n }\n else if (_typeof(beforeDrag) === "object") {\n payload = beforeDrag;\n extend(payload, this.payload || {});\n } else {\n payload = this.payload || {};\n }\n return [_continue, payload];\n }\n }, {\n key: "_createFloatingEndpoint",\n value: function _createFloatingEndpoint(canvasElement) {\n var endpointToFloat = this.ep.endpoint;\n if (this.ep.edgeType != null) {\n var aae = this.instance._deriveEndpointAndAnchorSpec(this.ep.edgeType);\n endpointToFloat = aae.endpoints[1];\n }\n this.floatingEndpoint = _makeFloatingEndpoint(this.ep, endpointToFloat, canvasElement, this.placeholderInfo.element, this.placeholderInfo.id, this.instance);\n this.floatingAnchor = this.floatingEndpoint._anchor;\n this.floatingEndpoint.deleteOnEmpty = true;\n this.floatingElement = this.floatingEndpoint.endpoint.canvas;\n this.floatingId = this.instance.getId(this.floatingElement);\n }\n }, {\n key: "_populateTargets",\n value: function _populateTargets(canvasElement, event) {\n var _this = this;\n var isSourceDrag = this.jpc && this.jpc.endpoints[0] === this.ep;\n var boundingRect;\n var matchingEndpoints = this.instance.getContainer().querySelectorAll([".", CLASS_ENDPOINT, "[", ATTRIBUTE_SCOPE_PREFIX, this.ep.scope, "]:not(.", CLASS_ENDPOINT_FLOATING, ")"].join(""));\n forEach(matchingEndpoints, function (candidate) {\n if ((_this.jpc != null || candidate !== canvasElement) && candidate !== _this.floatingElement && (_this.jpc != null || !candidate.jtk.endpoint.isFull())) {\n if (isSourceDrag && candidate.jtk.endpoint.isSource || !isSourceDrag && candidate.jtk.endpoint.isTarget) {\n var o = getElementPosition(candidate, _this.instance),\n s = getElementSize(candidate, _this.instance);\n boundingRect = {\n x: o.x,\n y: o.y,\n w: s.w,\n h: s.h\n };\n _this.endpointDropTargets.push({\n el: candidate,\n targetEl: candidate,\n r: boundingRect,\n endpoint: candidate.jtk.endpoint,\n def: null\n });\n _this.instance.addClass(candidate, CLASS_DRAG_ACTIVE);\n }\n }\n });\n if (isSourceDrag) {\n var sourceDef = getWithFunction(this.instance.sourceSelectors, function (sSel) {\n return sSel.isEnabled() && (sSel.def.def.scope == null || sSel.def.def.scope === _this.ep.scope);\n });\n if (sourceDef != null) {\n var targetZones = this._findTargetZones(sourceDef);\n forEach(targetZones, function (el) {\n if (el.getAttribute(ATTRIBUTE_JTK_ENABLED) !== FALSE$1) {\n var scopeFromElement = el.getAttribute(ATTRIBUTE_JTK_SCOPE);\n if (scopeFromElement != null && scopeFromElement !== _this.ep.scope) {\n return;\n }\n var d = {\n r: null,\n el: el\n };\n d.targetEl = findParent(el, SELECTOR_MANAGED_ELEMENT, _this.instance.getContainer(), true);\n var o = getElementPosition(d.el, _this.instance),\n s = getElementSize(d.el, _this.instance);\n d.r = {\n x: o.x,\n y: o.y,\n w: s.w,\n h: s.h\n };\n if (sourceDef.def.def.rank != null) {\n d.rank = sourceDef.def.def.rank;\n }\n d.def = sourceDef.def;\n _this.endpointDropTargets.push(d);\n _this.instance.addClass(d.targetEl, CLASS_DRAG_ACTIVE);\n }\n });\n }\n } else {\n var targetDefs = getAllWithFunction(this.instance.targetSelectors, function (tSel) {\n return tSel.isEnabled();\n });\n targetDefs.forEach(function (targetDef) {\n var targetZones = _this._findTargetZones(targetDef);\n forEach(targetZones, function (el) {\n if (el.getAttribute(ATTRIBUTE_JTK_ENABLED) !== FALSE$1) {\n var scopeFromElement = el.getAttribute(ATTRIBUTE_JTK_SCOPE);\n if (scopeFromElement != null && scopeFromElement !== _this.ep.scope) {\n return;\n }\n var d = {\n r: null,\n el: el\n };\n if (targetDef.def.def.parentSelector != null) {\n d.targetEl = findParent(el, targetDef.def.def.parentSelector, _this.instance.getContainer(), true);\n }\n if (d.targetEl == null) {\n d.targetEl = findParent(el, SELECTOR_MANAGED_ELEMENT, _this.instance.getContainer(), true);\n }\n if (targetDef.def.def.allowLoopback === false || _this._activeDefinition && _this._activeDefinition.def.def.allowLoopback === false) {\n if (d.targetEl === _this.ep.element) {\n return;\n }\n }\n if (targetDef.def.def.canAcceptNewConnection != null && !targetDef.def.def.canAcceptNewConnection(d.targetEl, event)) {\n return;\n }\n var maxConnections = targetDef.def.def.maxConnections;\n if (maxConnections != null && maxConnections !== -1) {\n if (_this.instance.select({\n target: d.targetEl\n }).length >= maxConnections) {\n return;\n }\n }\n var o = getElementPosition(el, _this.instance),\n s = getElementSize(el, _this.instance);\n d.r = {\n x: o.x,\n y: o.y,\n w: s.w,\n h: s.h\n };\n d.def = targetDef.def;\n if (targetDef.def.def.rank != null) {\n d.rank = targetDef.def.def.rank;\n }\n _this.endpointDropTargets.push(d);\n _this.instance.addClass(d.targetEl, CLASS_DRAG_ACTIVE);\n }\n });\n });\n }\n this.endpointDropTargets.sort(function (a, b) {\n if (a.targetEl._isJsPlumbGroup && !b.targetEl._isJsPlumbGroup) {\n return 1;\n } else if (!a.targetEl._isJsPlumbGroup && b.targetEl._isJsPlumbGroup) {\n return -1;\n } else {\n if (a.targetEl._isJsPlumbGroup && b.targetEl._isJsPlumbGroup) {\n if (_this.instance.groupManager.isAncestor(a.targetEl._jsPlumbGroup, b.targetEl._jsPlumbGroup)) {\n return -1;\n } else if (_this.instance.groupManager.isAncestor(b.targetEl._jsPlumbGroup, a.targetEl._jsPlumbGroup)) {\n return 1;\n }\n } else {\n if (a.rank != null && b.rank != null) {\n if (a.rank > b.rank) {\n return -1;\n } else if (a.rank < b.rank) {\n return 1;\n } else ;\n } else {\n return 0;\n }\n }\n }\n });\n }\n }, {\n key: "_findTargetZones",\n value: function _findTargetZones(dragSelector) {\n var targetZonesSelector;\n if (dragSelector.redrop === REDROP_POLICY_ANY) {\n var t = this.instance.targetSelectors.map(function (s) {\n return s.selector;\n });\n t.push.apply(t, _toConsumableArray(this.instance.sourceSelectors.map(function (s) {\n return s.selector;\n })));\n t.push(SELECTOR_MANAGED_ELEMENT);\n targetZonesSelector = t.join(",");\n } else if (dragSelector.redrop === REDROP_POLICY_STRICT) {\n targetZonesSelector = dragSelector.selector;\n } else if (dragSelector.redrop === REDROP_POLICY_ANY_SOURCE) {\n targetZonesSelector = this.instance.sourceSelectors.map(function (s) {\n return s.selector;\n }).join(",");\n } else if (dragSelector.redrop === REDROP_POLICY_ANY_TARGET) {\n targetZonesSelector = this.instance.targetSelectors.map(function (s) {\n return s.selector;\n }).join(",");\n } else if (dragSelector.redrop === REDROP_POLICY_ANY_SOURCE_OR_TARGET) {\n var _t = this.instance.targetSelectors.map(function (s) {\n return s.selector;\n });\n _t.push.apply(_t, _toConsumableArray(this.instance.sourceSelectors.map(function (s) {\n return s.selector;\n })));\n targetZonesSelector = _t.join(",");\n }\n return this.instance.getContainer().querySelectorAll(targetZonesSelector);\n }\n }, {\n key: "onStart",\n value: function onStart(p) {\n this.endpointDropTargets.length = 0;\n this.currentDropTarget = null;\n this._stopped = false;\n var dragEl = p.drag.getDragElement();\n this.ep = dragEl.jtk.endpoint;\n if (!this.ep) {\n return false;\n }\n this.endpointRepresentation = this.ep.endpoint;\n this.canvasElement = this.endpointRepresentation.canvas;\n this.jpc = this.ep.connectorSelector();\n var _this$_shouldStartDra = this._shouldStartDrag(),\n _this$_shouldStartDra2 = _slicedToArray(_this$_shouldStartDra, 2),\n _continue = _this$_shouldStartDra2[0],\n payload = _this$_shouldStartDra2[1];\n if (_continue === false) {\n this._stopped = true;\n return false;\n }\n this.instance.setHover(this.ep, false);\n this.instance.isConnectionBeingDragged = true;\n if (this.jpc && !this.ep.isFull() && this.ep.isSource) {\n this.jpc = null;\n }\n this._createFloatingEndpoint(this.canvasElement);\n this._populateTargets(this.canvasElement, p.e);\n if (this.jpc == null) {\n this.startNewConnectionDrag(this.ep.scope, payload);\n } else {\n this.startExistingConnectionDrag();\n }\n this._registerFloatingConnection(this.placeholderInfo, this.jpc);\n this.instance.currentlyDragging = true;\n }\n }, {\n key: "onBeforeStart",\n value: function onBeforeStart(beforeStartParams) {\n this.payload = beforeStartParams.e.payload || {};\n }\n }, {\n key: "onDrag",\n value: function onDrag(params) {\n if (this._stopped) {\n return true;\n }\n if (this.placeholderInfo.element) {\n var floatingElementSize = getElementSize(this.floatingElement, this.instance);\n this.instance.setElementPosition(this.placeholderInfo.element, params.pos.x, params.pos.y);\n var boundingRect = {\n x: params.pos.x,\n y: params.pos.y,\n w: floatingElementSize.w,\n h: floatingElementSize.h\n },\n newDropTarget,\n idx,\n _cont;\n for (var i = 0; i < this.endpointDropTargets.length; i++) {\n if (intersects(boundingRect, this.endpointDropTargets[i].r)) {\n newDropTarget = this.endpointDropTargets[i];\n break;\n }\n }\n if (newDropTarget !== this.currentDropTarget && this.currentDropTarget != null) {\n idx = this._getFloatingAnchorIndex();\n this.instance.removeClass(this.currentDropTarget.el, CLASS_DRAG_HOVER);\n if (this.currentDropTarget.endpoint) {\n this.currentDropTarget.endpoint.endpoint.removeClass(this.instance.endpointDropAllowedClass);\n this.currentDropTarget.endpoint.endpoint.removeClass(this.instance.endpointDropForbiddenClass);\n }\n this.floatingAnchor.out();\n }\n if (newDropTarget != null) {\n this.instance.addClass(newDropTarget.el, CLASS_DRAG_HOVER);\n idx = this._getFloatingAnchorIndex();\n if (newDropTarget.endpoint != null) {\n _cont = newDropTarget.endpoint.isSource && idx === 0 || newDropTarget.endpoint.isTarget && idx !== 0 || this.jpc.suspendedEndpoint && newDropTarget.endpoint.referenceEndpoint && newDropTarget.endpoint.referenceEndpoint.id === this.jpc.suspendedEndpoint.id;\n if (_cont) {\n var bb = this.instance.checkCondition(CHECK_DROP_ALLOWED, {\n sourceEndpoint: this.jpc.endpoints[idx],\n targetEndpoint: newDropTarget.endpoint.endpoint,\n connection: this.jpc\n });\n if (bb) {\n newDropTarget.endpoint.endpoint.addClass(this.instance.endpointDropAllowedClass);\n newDropTarget.endpoint.endpoint.removeClass(this.instance.endpointDropForbiddenClass);\n } else {\n newDropTarget.endpoint.endpoint.removeClass(this.instance.endpointDropAllowedClass);\n newDropTarget.endpoint.endpoint.addClass(this.instance.endpointDropForbiddenClass);\n }\n this.floatingAnchor.over(newDropTarget.endpoint);\n this.instance._paintConnection(this.jpc);\n } else {\n newDropTarget = null;\n }\n }\n }\n this.currentDropTarget = newDropTarget;\n }\n }\n }, {\n key: "_maybeCleanup",\n value: function _maybeCleanup(ep) {\n if (ep._mtNew && ep.connections.length === 0) {\n this.instance.deleteEndpoint(ep);\n } else {\n delete ep._mtNew;\n }\n }\n }, {\n key: "_reattachOrDiscard",\n value: function _reattachOrDiscard(originalEvent) {\n var existingConnection = this.jpc.suspendedEndpoint != null;\n var idx = this._getFloatingAnchorIndex();\n if (existingConnection && this._shouldReattach()) {\n if (idx === 0) {\n this.jpc.source = this.jpc.suspendedElement;\n this.jpc.sourceId = this.jpc.suspendedElementId;\n } else {\n this.jpc.target = this.jpc.suspendedElement;\n this.jpc.targetId = this.jpc.suspendedElementId;\n }\n this._doForceReattach(idx);\n return true;\n } else {\n this._discard(idx, originalEvent);\n return false;\n }\n }\n }, {\n key: "onStop",\n value: function onStop(p) {\n var _this2 = this;\n var originalEvent = p.e;\n this.instance.isConnectionBeingDragged = false;\n this.instance.currentlyDragging = false;\n var classesToRemove = classList(CLASS_DRAG_HOVER, CLASS_DRAG_ACTIVE);\n var matchingSelectors = this.instance.getContainer().querySelectorAll(SELECTOR_DRAG_ACTIVE_OR_HOVER);\n forEach(matchingSelectors, function (el) {\n _this2.instance.removeClass(el, classesToRemove);\n });\n if (this.jpc && this.jpc.endpoints != null) {\n var existingConnection = this.jpc.suspendedEndpoint != null;\n var idx = this._getFloatingAnchorIndex();\n var suspendedEndpoint = this.jpc.suspendedEndpoint;\n var dropEndpoint;\n if (this.currentDropTarget != null) {\n dropEndpoint = this._getDropEndpoint(p, this.jpc);\n if (dropEndpoint == null) {\n this._reattachOrDiscard(p.e);\n } else {\n if (suspendedEndpoint && suspendedEndpoint.id === dropEndpoint.id) {\n this._doForceReattach(idx);\n } else {\n if (!dropEndpoint.enabled) {\n this._reattachOrDiscard(p.e);\n } else if (dropEndpoint.isFull()) {\n dropEndpoint.fire(EVENT_MAX_CONNECTIONS, {\n endpoint: this,\n connection: this.jpc,\n maxConnections: this.instance.defaults.maxConnections\n }, originalEvent);\n this._reattachOrDiscard(p.e);\n } else {\n if (idx === 0) {\n this.jpc.source = dropEndpoint.element;\n this.jpc.sourceId = dropEndpoint.elementId;\n } else {\n this.jpc.target = dropEndpoint.element;\n this.jpc.targetId = dropEndpoint.elementId;\n }\n var _doContinue = true;\n if (existingConnection && this.jpc.suspendedEndpoint.id !== dropEndpoint.id) {\n if (!this.jpc.isDetachAllowed(this.jpc) || !this.jpc.endpoints[idx].isDetachAllowed(this.jpc) || !this.jpc.suspendedEndpoint.isDetachAllowed(this.jpc) || !this.instance.checkCondition("beforeDetach", this.jpc)) {\n _doContinue = false;\n }\n }\n _doContinue = _doContinue && dropEndpoint.isDropAllowed(this.jpc.sourceId, this.jpc.targetId, this.jpc.scope, this.jpc, dropEndpoint);\n if (_doContinue) {\n this._drop(dropEndpoint, idx, originalEvent, _doContinue);\n } else {\n this._reattachOrDiscard(p.e);\n }\n }\n }\n }\n } else {\n this._reattachOrDiscard(p.e);\n }\n this.instance._refreshEndpoint(this.ep);\n this.ep.removeClass(this.instance.draggingClass);\n this._cleanupDraggablePlaceholder();\n this.jpc.removeClass(this.instance.draggingClass);\n delete this.jpc.suspendedEndpoint;\n delete this.jpc.suspendedElement;\n delete this.jpc.suspendedElementType;\n delete this.jpc.suspendedElementId;\n delete this.jpc.suspendedIndex;\n delete this.floatingId;\n delete this.floatingIndex;\n delete this.floatingElement;\n delete this.floatingEndpoint;\n delete this.floatingAnchor;\n delete this.jpc.pending;\n if (dropEndpoint != null) {\n this._maybeCleanup(dropEndpoint);\n }\n }\n }\n }, {\n key: "_getSourceDefinition",\n value: function _getSourceDefinition(evt) {\n var selector;\n var container = this.instance.getContainer();\n for (var i = 0; i < this.instance.sourceSelectors.length; i++) {\n selector = this.instance.sourceSelectors[i];\n if (selector.isEnabled()) {\n var r = selectorFilter(evt, container, selector.selector, this.instance, selector.exclude);\n if (r !== false) {\n return selector;\n }\n }\n }\n }\n }, {\n key: "_getDropEndpoint",\n value: function _getDropEndpoint(p, jpc) {\n var dropEndpoint;\n if (this.currentDropTarget.endpoint == null) {\n var targetDefinition = this.currentDropTarget.def;\n var eventTarget = p.e.target || p.e.srcElement;\n if (targetDefinition == null) {\n return null;\n }\n var targetElement = this.currentDropTarget.targetEl;\n var elxy = getPositionOnElement(p.e, targetElement, this.instance.currentZoom);\n var eps = this.instance._deriveEndpointAndAnchorSpec(jpc.getType().join(" "), true);\n var pp = eps.endpoints ? extend(p, {\n endpoint: targetDefinition.def.endpoint || eps.endpoints[1],\n cssClass: targetDefinition.def.cssClass || "",\n source: targetDefinition.def.source === true,\n target: targetDefinition.def.target === true\n }) : p;\n var anchorsToUse = this.instance.validAnchorsSpec(eps.anchors) ? eps.anchors : this.instance.areDefaultAnchorsSet() ? this.instance.defaults.anchors : null;\n var anchorFromDef = targetDefinition.def.anchor;\n var anchorFromPositionFinder = targetDefinition.def.anchorPositionFinder ? targetDefinition.def.anchorPositionFinder(targetElement, elxy, targetDefinition.def, p.e) : null;\n var dropAnchor = anchorFromPositionFinder != null ? anchorFromPositionFinder : anchorFromDef != null ? anchorFromDef : anchorsToUse != null && anchorsToUse[1] != null ? anchorsToUse[1] : null;\n if (dropAnchor != null) {\n pp = extend(pp, {\n anchor: dropAnchor\n });\n }\n if (targetDefinition.def.portId != null) {\n pp.portId = targetDefinition.def.portId;\n }\n var extractedParameters = targetDefinition.def.parameterExtractor ? targetDefinition.def.parameterExtractor(this.currentDropTarget.el, eventTarget, p.e) : {};\n pp = merge(pp, extractedParameters);\n pp.element = targetElement;\n dropEndpoint = this.instance._internal_newEndpoint(pp);\n dropEndpoint._mtNew = true;\n dropEndpoint.deleteOnEmpty = true;\n if (targetDefinition.def.parameters) {\n dropEndpoint.mergeParameters(targetDefinition.def.parameters);\n }\n if (targetDefinition.def.extract) {\n var tpayload = {};\n for (var att in targetDefinition.def.extract) {\n var v = this.currentDropTarget.el.getAttribute(att);\n if (v) {\n tpayload[targetDefinition.def.extract[att]] = v;\n }\n }\n dropEndpoint.mergeParameters(tpayload);\n }\n } else {\n dropEndpoint = this.currentDropTarget.endpoint;\n }\n if (dropEndpoint) {\n dropEndpoint.removeClass(this.instance.endpointDropAllowedClass);\n dropEndpoint.removeClass(this.instance.endpointDropForbiddenClass);\n }\n return dropEndpoint;\n }\n }, {\n key: "_doForceReattach",\n value: function _doForceReattach(idx) {\n this.floatingEndpoint.detachFromConnection(this.jpc, null, true);\n this.jpc.endpoints[idx] = this.jpc.suspendedEndpoint;\n this.instance.setHover(this.jpc, false);\n this.jpc._forceDetach = true;\n this.jpc.suspendedEndpoint.addConnection(this.jpc);\n this.instance.sourceOrTargetChanged(this.floatingId, this.jpc.suspendedEndpoint.elementId, this.jpc, this.jpc.suspendedEndpoint.element, idx);\n this.instance.deleteEndpoint(this.floatingEndpoint);\n this.instance.repaint(this.jpc.source);\n delete this.jpc._forceDetach;\n }\n }, {\n key: "_shouldReattach",\n value: function _shouldReattach() {\n if (this.jpc.isReattach() || this.jpc._forceReattach) {\n return true;\n } else {\n var suspendedEndpoint = this.jpc.suspendedEndpoint,\n otherEndpointIdx = this.jpc.suspendedElementType == SOURCE ? 1 : 0,\n otherEndpoint = this.jpc.endpoints[otherEndpointIdx];\n return !functionChain(true, false, [[suspendedEndpoint, IS_DETACH_ALLOWED, [this.jpc]], [otherEndpoint, IS_DETACH_ALLOWED, [this.jpc]], [this.jpc, IS_DETACH_ALLOWED, [this.jpc]], [this.instance, CHECK_CONDITION, [INTERCEPT_BEFORE_DETACH, this.jpc]]]);\n }\n }\n }, {\n key: "_discard",\n value: function _discard(idx, originalEvent) {\n if (this.jpc.pending) {\n this.instance.fire(EVENT_CONNECTION_ABORT, this.jpc, originalEvent);\n } else {\n if (idx === 0) {\n this.jpc.source = this.jpc.suspendedEndpoint.element;\n this.jpc.sourceId = this.jpc.suspendedEndpoint.elementId;\n } else {\n this.jpc.target = this.jpc.suspendedEndpoint.element;\n this.jpc.targetId = this.jpc.suspendedEndpoint.elementId;\n }\n this.jpc.endpoints[idx] = this.jpc.suspendedEndpoint;\n }\n if (this.floatingEndpoint) {\n this.floatingEndpoint.detachFromConnection(this.jpc);\n }\n this.instance.deleteConnection(this.jpc, {\n originalEvent: originalEvent,\n force: true\n });\n }\n }, {\n key: "_drop",\n value: function _drop(dropEndpoint, idx, originalEvent, optionalData) {\n this.jpc.endpoints[idx].detachFromConnection(this.jpc);\n if (this.jpc.suspendedEndpoint) {\n this.jpc.suspendedEndpoint.detachFromConnection(this.jpc);\n }\n this.jpc.endpoints[idx] = dropEndpoint;\n dropEndpoint.addConnection(this.jpc);\n if (this.jpc.suspendedEndpoint) {\n var suspendedElementId = this.jpc.suspendedEndpoint.elementId;\n this.instance.fireMoveEvent({\n index: idx,\n originalSourceId: idx === 0 ? suspendedElementId : this.jpc.sourceId,\n newSourceId: idx === 0 ? dropEndpoint.elementId : this.jpc.sourceId,\n originalTargetId: idx === 1 ? suspendedElementId : this.jpc.targetId,\n newTargetId: idx === 1 ? dropEndpoint.elementId : this.jpc.targetId,\n originalEndpoint: this.jpc.suspendedEndpoint,\n connection: this.jpc,\n newEndpoint: dropEndpoint\n }, originalEvent);\n }\n if (idx === 1) {\n this.instance.sourceOrTargetChanged(this.floatingId, this.jpc.targetId, this.jpc, this.jpc.target, 1);\n } else {\n this.instance.sourceOrTargetChanged(this.floatingId, this.jpc.sourceId, this.jpc, this.jpc.source, 0);\n }\n if (this.jpc.endpoints[0].finalEndpoint) {\n var _toDelete = this.jpc.endpoints[0];\n _toDelete.detachFromConnection(this.jpc);\n this.jpc.endpoints[0] = this.jpc.endpoints[0].finalEndpoint;\n this.jpc.endpoints[0].addConnection(this.jpc);\n }\n if (isObject(optionalData)) {\n this.jpc.mergeData(optionalData);\n }\n if (this._originalAnchorSpec) {\n this.jpc.endpoints[0].setAnchor(this._originalAnchorSpec);\n this._originalAnchorSpec = null;\n }\n this.instance._finaliseConnection(this.jpc, null, originalEvent);\n this.instance.setHover(this.jpc, false);\n this.instance.revalidate(this.jpc.endpoints[0].element);\n }\n }, {\n key: "_registerFloatingConnection",\n value: function _registerFloatingConnection(info, conn) {\n this.floatingConnections[info.id] = conn;\n }\n }, {\n key: "_getFloatingAnchorIndex",\n value: function _getFloatingAnchorIndex() {\n return this.floatingIndex == null ? 1 : this.floatingIndex;\n }\n }]);\n return EndpointDragHandler;\n}();\n\nvar GroupDragHandler = function (_ElementDragHandler) {\n _inherits(GroupDragHandler, _ElementDragHandler);\n var _super = _createSuper(GroupDragHandler);\n function GroupDragHandler(instance, dragSelection) {\n var _this;\n _classCallCheck(this, GroupDragHandler);\n _this = _super.call(this, instance, dragSelection);\n _this.instance = instance;\n _this.dragSelection = dragSelection;\n _defineProperty(_assertThisInitialized(_this), "selector", [">", SELECTOR_GROUP, SELECTOR_MANAGED_ELEMENT].join(" "));\n _defineProperty(_assertThisInitialized(_this), "doRevalidate", void 0);\n _this.doRevalidate = _this._revalidate.bind(_assertThisInitialized(_this));\n return _this;\n }\n _createClass(GroupDragHandler, [{\n key: "reset",\n value: function reset() {\n this.drag.off(EVENT_REVERT, this.doRevalidate);\n }\n }, {\n key: "_revalidate",\n value: function _revalidate(el) {\n this.instance.revalidate(el);\n }\n }, {\n key: "init",\n value: function init(drag) {\n this.drag = drag;\n drag.on(EVENT_REVERT, this.doRevalidate);\n }\n }, {\n key: "useGhostProxy",\n value: function useGhostProxy(container, dragEl) {\n var group = dragEl._jsPlumbParentGroup;\n return group == null ? false : group.ghost === true;\n }\n }, {\n key: "makeGhostProxy",\n value: function makeGhostProxy(el) {\n var jel = el;\n var newEl = jel.cloneNode(true);\n newEl._jsPlumbParentGroup = jel._jsPlumbParentGroup;\n return newEl;\n }\n }]);\n return GroupDragHandler;\n}(ElementDragHandler);\n\nvar HTMLElementOverlay = function () {\n function HTMLElementOverlay(instance, overlay) {\n _classCallCheck(this, HTMLElementOverlay);\n this.instance = instance;\n this.overlay = overlay;\n _defineProperty(this, "htmlElementOverlay", void 0);\n this.htmlElementOverlay = overlay;\n }\n _createClass(HTMLElementOverlay, null, [{\n key: "getElement",\n value: function getElement(o, component, elementCreator) {\n if (o.canvas == null) {\n if (elementCreator && component) {\n o.canvas = elementCreator(component);\n var cls = o.instance.overlayClass + " " + (o.cssClass ? o.cssClass : "");\n o.instance.addClass(o.canvas, cls);\n } else {\n o.canvas = createElement(ELEMENT_DIV, {}, o.instance.overlayClass + " " + (o.cssClass ? o.cssClass : ""));\n }\n o.instance.setAttribute(o.canvas, "jtk-overlay-id", o.id);\n for (var att in o.attributes) {\n o.instance.setAttribute(o.canvas, att, o.attributes[att]);\n }\n o.canvas.style.position = ABSOLUTE;\n o.instance._appendElement(o.canvas, o.instance.getContainer());\n o.instance.getId(o.canvas);\n var ts = "translate(-50%, -50%)";\n o.canvas.style.webkitTransform = ts;\n o.canvas.style.mozTransform = ts;\n o.canvas.style.msTransform = ts;\n o.canvas.style.oTransform = ts;\n o.canvas.style.transform = ts;\n if (!o.isVisible()) {\n o.canvas.style.display = NONE;\n }\n o.canvas.jtk = {\n overlay: o\n };\n }\n return o.canvas;\n }\n }, {\n key: "destroy",\n value: function destroy(o) {\n o.canvas && o.canvas.parentNode && o.canvas.parentNode.removeChild(o.canvas);\n delete o.canvas;\n delete o.cachedDimensions;\n }\n }, {\n key: "_getDimensions",\n value: function _getDimensions(o, forceRefresh) {\n if (o.cachedDimensions == null || forceRefresh) {\n o.cachedDimensions = {\n w: 1,\n h: 1\n };\n }\n return o.cachedDimensions;\n }\n }]);\n return HTMLElementOverlay;\n}();\n\nvar EventGenerator = function () {\n function EventGenerator() {\n _classCallCheck(this, EventGenerator);\n _defineProperty(this, "_listeners", {});\n _defineProperty(this, "eventsSuspended", false);\n _defineProperty(this, "tick", false);\n _defineProperty(this, "eventsToDieOn", {\n "ready": true\n });\n _defineProperty(this, "queue", []);\n }\n _createClass(EventGenerator, [{\n key: "fire",\n value: function fire(event, value, originalEvent) {\n var ret = null;\n if (!this.tick) {\n this.tick = true;\n if (!this.eventsSuspended && this._listeners[event]) {\n var l = this._listeners[event].length,\n i = 0,\n _gone = false;\n if (!this.shouldFireEvent || this.shouldFireEvent(event, value, originalEvent)) {\n while (!_gone && i < l && ret !== false) {\n if (this.eventsToDieOn[event]) {\n this._listeners[event][i](value, originalEvent);\n } else {\n try {\n ret = this._listeners[event][i](value, originalEvent);\n } catch (e) {\n log("jsPlumb: fire failed for event " + event + " : " + (e.message || e));\n }\n }\n i++;\n if (this._listeners == null || this._listeners[event] == null) {\n _gone = true;\n }\n }\n }\n }\n this.tick = false;\n this._drain();\n } else {\n this.queue.unshift(arguments);\n }\n return ret;\n }\n }, {\n key: "_drain",\n value: function _drain() {\n var n = this.queue.pop();\n if (n) {\n this.fire.apply(this, n);\n }\n }\n }, {\n key: "unbind",\n value: function unbind(eventOrListener, listener) {\n if (arguments.length === 0) {\n this._listeners = {};\n } else if (arguments.length === 1) {\n if (typeof eventOrListener === "string") {\n delete this._listeners[eventOrListener];\n } else if (eventOrListener.__jsPlumb) {\n var evt;\n for (var i in eventOrListener.__jsPlumb) {\n evt = eventOrListener.__jsPlumb[i];\n remove(this._listeners[evt] || [], eventOrListener);\n }\n }\n } else if (arguments.length === 2) {\n remove(this._listeners[eventOrListener] || [], listener);\n }\n return this;\n }\n }, {\n key: "getListener",\n value: function getListener(forEvent) {\n return this._listeners[forEvent] || [];\n }\n }, {\n key: "isSuspendEvents",\n value: function isSuspendEvents() {\n return this.eventsSuspended;\n }\n }, {\n key: "setSuspendEvents",\n value: function setSuspendEvents(val) {\n this.eventsSuspended = val;\n }\n }, {\n key: "bind",\n value: function bind(event, listener, insertAtStart) {\n var _this = this;\n var _one = function _one(evt) {\n addToDictionary(_this._listeners, evt, listener, insertAtStart);\n listener.__jsPlumb = listener.__jsPlumb || {};\n listener.__jsPlumb[uuid()] = evt;\n };\n if (typeof event === "string") {\n _one(event);\n } else if (event.length != null) {\n for (var i = 0; i < event.length; i++) {\n _one(event[i]);\n }\n }\n return this;\n }\n }, {\n key: "silently",\n value: function silently(fn) {\n this.setSuspendEvents(true);\n try {\n fn();\n } catch (e) {\n log("Cannot execute silent function " + e);\n }\n this.setSuspendEvents(false);\n }\n }]);\n return EventGenerator;\n}();\nvar OptimisticEventGenerator = function (_EventGenerator) {\n _inherits(OptimisticEventGenerator, _EventGenerator);\n var _super = _createSuper(OptimisticEventGenerator);\n function OptimisticEventGenerator() {\n _classCallCheck(this, OptimisticEventGenerator);\n return _super.apply(this, arguments);\n }\n _createClass(OptimisticEventGenerator, [{\n key: "shouldFireEvent",\n value: function shouldFireEvent(event, value, originalEvent) {\n return true;\n }\n }]);\n return OptimisticEventGenerator;\n}(EventGenerator);\n\nfunction isFullOverlaySpec(o) {\n return o.type != null && o.options != null;\n}\nfunction convertToFullOverlaySpec(spec) {\n var o = null;\n if (isString(spec)) {\n o = {\n type: spec,\n options: {}\n };\n } else {\n o = spec;\n }\n o.options.id = o.options.id || uuid();\n return o;\n}\nvar Overlay = function (_EventGenerator) {\n _inherits(Overlay, _EventGenerator);\n var _super = _createSuper(Overlay);\n function Overlay(instance, component, p) {\n var _this;\n _classCallCheck(this, Overlay);\n _this = _super.call(this);\n _this.instance = instance;\n _this.component = component;\n _defineProperty(_assertThisInitialized(_this), "id", void 0);\n _defineProperty(_assertThisInitialized(_this), "type", void 0);\n _defineProperty(_assertThisInitialized(_this), "cssClass", void 0);\n _defineProperty(_assertThisInitialized(_this), "visible", true);\n _defineProperty(_assertThisInitialized(_this), "location", void 0);\n _defineProperty(_assertThisInitialized(_this), "events", void 0);\n _defineProperty(_assertThisInitialized(_this), "attributes", void 0);\n p = p || {};\n _this.id = p.id || uuid();\n _this.cssClass = p.cssClass || "";\n _this.setLocation(p.location);\n _this.events = p.events || {};\n _this.attributes = p.attributes || {};\n for (var _event in _this.events) {\n _this.bind(_event, _this.events[_event]);\n }\n return _this;\n }\n _createClass(Overlay, [{\n key: "setLocation",\n value: function setLocation(l) {\n var newLocation = this.location == null ? 0.5 : this.location;\n if (l != null) {\n try {\n var _l = typeof l === "string" ? parseFloat(l) : l;\n if (!isNaN(_l)) {\n newLocation = _l;\n }\n } catch (e) {\n }\n }\n this.location = newLocation;\n }\n }, {\n key: "shouldFireEvent",\n value: function shouldFireEvent(event, value, originalEvent) {\n return true;\n }\n }, {\n key: "setVisible",\n value: function setVisible(v) {\n this.visible = v;\n this.instance.setOverlayVisible(this, v);\n }\n }, {\n key: "isVisible",\n value: function isVisible() {\n return this.visible;\n }\n }]);\n return Overlay;\n}(EventGenerator);\n\nvar overlayMap = {};\nvar OverlayFactory = {\n get: function get(instance, name, component, params) {\n var c = overlayMap[name];\n if (!c) {\n throw {\n message: "jsPlumb: unknown overlay type \'" + name + "\'"\n };\n } else {\n return new c(instance, component, params);\n }\n },\n register: function register(name, overlay) {\n overlayMap[name] = overlay;\n }\n};\n\nvar LabelOverlay = function (_Overlay) {\n _inherits(LabelOverlay, _Overlay);\n var _super = _createSuper(LabelOverlay);\n function LabelOverlay(instance, component, p) {\n var _this;\n _classCallCheck(this, LabelOverlay);\n _this = _super.call(this, instance, component, p);\n _this.instance = instance;\n _this.component = component;\n _defineProperty(_assertThisInitialized(_this), "label", void 0);\n _defineProperty(_assertThisInitialized(_this), "labelText", void 0);\n _defineProperty(_assertThisInitialized(_this), "type", LabelOverlay.type);\n _defineProperty(_assertThisInitialized(_this), "cachedDimensions", void 0);\n p = p || {\n label: ""\n };\n _this.setLabel(p.label);\n return _this;\n }\n _createClass(LabelOverlay, [{\n key: "getLabel",\n value: function getLabel() {\n if (isFunction(this.label)) {\n return this.label(this);\n } else {\n return this.labelText;\n }\n }\n }, {\n key: "setLabel",\n value: function setLabel(l) {\n this.label = l;\n this.labelText = null;\n this.instance.updateLabel(this);\n }\n }, {\n key: "getDimensions",\n value: function getDimensions() {\n return {\n w: 1,\n h: 1\n };\n }\n }, {\n key: "updateFrom",\n value: function updateFrom(d) {\n if (d.label != null) {\n this.setLabel(d.label);\n }\n if (d.location != null) {\n this.setLocation(d.location);\n this.instance.updateLabel(this);\n }\n }\n }]);\n return LabelOverlay;\n}(Overlay);\n_defineProperty(LabelOverlay, "type", "Label");\nfunction isLabelOverlay(o) {\n return o.type === LabelOverlay.type;\n}\nOverlayFactory.register(LabelOverlay.type, LabelOverlay);\n\nfunction _splitType(t) {\n return t == null ? null : t.split(" ").filter(function (t) {\n return t != null && t.length > 0;\n });\n}\nfunction _mapType(map, obj, typeId) {\n for (var i in obj) {\n map[i] = typeId;\n }\n}\nvar CONNECTOR = "connector";\nvar MERGE_STRATEGY_OVERRIDE = "override";\nvar CSS_CLASS = "cssClass";\nvar DEFAULT_TYPE_KEY = "__default";\nvar ANCHOR = "anchor";\nvar ANCHORS = "anchors";\nvar _internalLabelOverlayId = "__label";\nvar _internalLabelOverlayClass = "jtk-default-label";\nvar TYPE_ITEM_OVERLAY = "overlay";\nvar LOCATION_ATTRIBUTE = "labelLocation";\nvar ACTION_ADD = "add";\nvar ACTION_REMOVE = "remove";\nfunction _applyTypes(component, params) {\n if (component.getDefaultType) {\n var td = component.getTypeDescriptor(),\n map = {};\n var defType = component.getDefaultType();\n var o = extend({}, defType);\n _mapType(map, defType, DEFAULT_TYPE_KEY);\n component._types.forEach(function (tid) {\n if (tid !== DEFAULT_TYPE_KEY) {\n var _t = component.instance.getType(tid, td);\n if (_t != null) {\n var overrides = new Set([CONNECTOR, ANCHOR, ANCHORS]);\n if (_t.mergeStrategy === MERGE_STRATEGY_OVERRIDE) {\n for (var k in _t) {\n overrides.add(k);\n }\n }\n o = merge(o, _t, [CSS_CLASS], setToArray(overrides));\n _mapType(map, _t, tid);\n }\n }\n });\n if (params) {\n o = populate(o, params, "_");\n }\n component.applyType(o, map);\n }\n}\nfunction _removeTypeCssHelper(component, typeId) {\n var type = component.instance.getType(typeId, component.getTypeDescriptor());\n if (type != null && type.cssClass) {\n component.removeClass(type.cssClass);\n }\n}\nfunction _updateHoverStyle(component) {\n if (component.paintStyle && component.hoverPaintStyle) {\n var mergedHoverStyle = {};\n extend(mergedHoverStyle, component.paintStyle);\n extend(mergedHoverStyle, component.hoverPaintStyle);\n component.hoverPaintStyle = mergedHoverStyle;\n }\n}\nvar ADD_CLASS_ACTION = "add";\nvar REMOVE_CLASS_ACTION = "remove";\nfunction _makeLabelOverlay(component, params) {\n var _params = {\n cssClass: params.cssClass,\n id: _internalLabelOverlayId,\n component: component\n },\n mergedParams = extend(_params, params);\n return new LabelOverlay(component.instance, component, mergedParams);\n}\nfunction _processOverlay(component, o) {\n var _newOverlay = null;\n if (isString(o)) {\n _newOverlay = OverlayFactory.get(component.instance, o, component, {});\n } else if (o.type != null && o.options != null) {\n var oa = o;\n var p = extend({}, oa.options);\n _newOverlay = OverlayFactory.get(component.instance, oa.type, component, p);\n } else {\n _newOverlay = o;\n }\n _newOverlay.id = _newOverlay.id || uuid();\n component.cacheTypeItem(TYPE_ITEM_OVERLAY, _newOverlay, _newOverlay.id);\n component.overlays[_newOverlay.id] = _newOverlay;\n return _newOverlay;\n}\nvar Component = function (_EventGenerator) {\n _inherits(Component, _EventGenerator);\n var _super = _createSuper(Component);\n function Component(instance, params) {\n var _this;\n _classCallCheck(this, Component);\n _this = _super.call(this);\n _this.instance = instance;\n _defineProperty(_assertThisInitialized(_this), "defaultLabelLocation", 0.5);\n _defineProperty(_assertThisInitialized(_this), "overlays", {});\n _defineProperty(_assertThisInitialized(_this), "overlayPositions", {});\n _defineProperty(_assertThisInitialized(_this), "overlayPlacements", {});\n _defineProperty(_assertThisInitialized(_this), "clone", void 0);\n _defineProperty(_assertThisInitialized(_this), "deleted", void 0);\n _defineProperty(_assertThisInitialized(_this), "segment", void 0);\n _defineProperty(_assertThisInitialized(_this), "x", void 0);\n _defineProperty(_assertThisInitialized(_this), "y", void 0);\n _defineProperty(_assertThisInitialized(_this), "w", void 0);\n _defineProperty(_assertThisInitialized(_this), "h", void 0);\n _defineProperty(_assertThisInitialized(_this), "id", void 0);\n _defineProperty(_assertThisInitialized(_this), "visible", true);\n _defineProperty(_assertThisInitialized(_this), "typeId", void 0);\n _defineProperty(_assertThisInitialized(_this), "params", {});\n _defineProperty(_assertThisInitialized(_this), "paintStyle", void 0);\n _defineProperty(_assertThisInitialized(_this), "hoverPaintStyle", void 0);\n _defineProperty(_assertThisInitialized(_this), "paintStyleInUse", void 0);\n _defineProperty(_assertThisInitialized(_this), "_hover", false);\n _defineProperty(_assertThisInitialized(_this), "lastPaintedAt", void 0);\n _defineProperty(_assertThisInitialized(_this), "data", void 0);\n _defineProperty(_assertThisInitialized(_this), "_defaultType", void 0);\n _defineProperty(_assertThisInitialized(_this), "events", void 0);\n _defineProperty(_assertThisInitialized(_this), "parameters", void 0);\n _defineProperty(_assertThisInitialized(_this), "_types", void 0);\n _defineProperty(_assertThisInitialized(_this), "_typeCache", void 0);\n _defineProperty(_assertThisInitialized(_this), "cssClass", void 0);\n _defineProperty(_assertThisInitialized(_this), "hoverClass", void 0);\n _defineProperty(_assertThisInitialized(_this), "beforeDetach", void 0);\n _defineProperty(_assertThisInitialized(_this), "beforeDrop", void 0);\n params = params || {};\n _this.cssClass = params.cssClass || "";\n _this.hoverClass = params.hoverClass || instance.defaults.hoverClass;\n _this.beforeDetach = params.beforeDetach;\n _this.beforeDrop = params.beforeDrop;\n _this._types = new Set();\n _this._typeCache = {};\n _this.parameters = clone(params.parameters || {});\n _this.id = params.id || _this.getIdPrefix() + new Date().getTime();\n _this._defaultType = {\n parameters: _this.parameters,\n scope: params.scope || _this.instance.defaultScope,\n overlays: {}\n };\n if (params.events) {\n for (var evtName in params.events) {\n _this.bind(evtName, params.events[evtName]);\n }\n }\n _this.clone = function () {\n var o = Object.create(_this.constructor.prototype);\n _this.constructor.apply(o, [instance, params]);\n return o;\n };\n _this.overlays = {};\n _this.overlayPositions = {};\n var o = params.overlays || [],\n oo = {};\n var defaultOverlayKey = _this.getDefaultOverlayKey();\n if (defaultOverlayKey) {\n var defaultOverlays = _this.instance.defaults[defaultOverlayKey];\n if (defaultOverlays) {\n o.push.apply(o, _toConsumableArray(defaultOverlays));\n }\n for (var i = 0; i < o.length; i++) {\n var fo = convertToFullOverlaySpec(o[i]);\n oo[fo.options.id] = fo;\n }\n }\n _this._defaultType.overlays = oo;\n if (params.label) {\n _this.getDefaultType().overlays[_internalLabelOverlayId] = {\n type: LabelOverlay.type,\n options: {\n label: params.label,\n location: params.labelLocation || _this.defaultLabelLocation,\n id: _internalLabelOverlayId,\n cssClass: _internalLabelOverlayClass\n }\n };\n }\n return _this;\n }\n _createClass(Component, [{\n key: "isDetachAllowed",\n value: function isDetachAllowed(connection) {\n var r = true;\n if (this.beforeDetach) {\n try {\n r = this.beforeDetach(connection);\n } catch (e) {\n log("jsPlumb: beforeDetach callback failed", e);\n }\n }\n return r;\n }\n }, {\n key: "isDropAllowed",\n value: function isDropAllowed(sourceId, targetId, scope, connection, dropEndpoint) {\n var r;\n var payload = {\n sourceId: sourceId,\n targetId: targetId,\n scope: scope,\n connection: connection,\n dropEndpoint: dropEndpoint\n };\n if (this.beforeDrop) {\n try {\n r = this.beforeDrop(payload);\n } catch (e) {\n log("jsPlumb: beforeDrop callback failed", e);\n }\n } else {\n r = this.instance.checkCondition(INTERCEPT_BEFORE_DROP, payload);\n }\n return r;\n }\n }, {\n key: "getDefaultType",\n value: function getDefaultType() {\n return this._defaultType;\n }\n }, {\n key: "appendToDefaultType",\n value: function appendToDefaultType(obj) {\n for (var i in obj) {\n this._defaultType[i] = obj[i];\n }\n }\n }, {\n key: "getId",\n value: function getId() {\n return this.id;\n }\n }, {\n key: "cacheTypeItem",\n value: function cacheTypeItem(key, item, typeId) {\n this._typeCache[typeId] = this._typeCache[typeId] || {};\n this._typeCache[typeId][key] = item;\n }\n }, {\n key: "getCachedTypeItem",\n value: function getCachedTypeItem(key, typeId) {\n return this._typeCache[typeId] ? this._typeCache[typeId][key] : null;\n }\n }, {\n key: "setType",\n value: function setType(typeId, params) {\n this.clearTypes();\n (_splitType(typeId) || []).forEach(this._types.add, this._types);\n _applyTypes(this, params);\n }\n }, {\n key: "getType",\n value: function getType() {\n return Array.from(this._types.keys());\n }\n }, {\n key: "reapplyTypes",\n value: function reapplyTypes(params) {\n _applyTypes(this, params);\n }\n }, {\n key: "hasType",\n value: function hasType(typeId) {\n return this._types.has(typeId);\n }\n }, {\n key: "addType",\n value: function addType(typeId, params) {\n var t = _splitType(typeId),\n _somethingAdded = false;\n if (t != null) {\n for (var i = 0, j = t.length; i < j; i++) {\n if (!this._types.has(t[i])) {\n this._types.add(t[i]);\n _somethingAdded = true;\n }\n }\n if (_somethingAdded) {\n _applyTypes(this, params);\n }\n }\n }\n }, {\n key: "removeType",\n value: function removeType(typeId, params) {\n var _this2 = this;\n var t = _splitType(typeId),\n _cont = false,\n _one = function _one(tt) {\n if (_this2._types.has(tt)) {\n _removeTypeCssHelper(_this2, tt);\n _this2._types["delete"](tt);\n return true;\n }\n return false;\n };\n if (t != null) {\n for (var i = 0, j = t.length; i < j; i++) {\n _cont = _one(t[i]) || _cont;\n }\n if (_cont) {\n _applyTypes(this, params);\n }\n }\n }\n }, {\n key: "clearTypes",\n value: function clearTypes(params) {\n var _this3 = this;\n this._types.forEach(function (t) {\n _removeTypeCssHelper(_this3, t);\n });\n this._types.clear();\n _applyTypes(this, params);\n }\n }, {\n key: "toggleType",\n value: function toggleType(typeId, params) {\n var t = _splitType(typeId);\n if (t != null) {\n for (var i = 0, j = t.length; i < j; i++) {\n if (this._types.has(t[i])) {\n _removeTypeCssHelper(this, t[i]);\n this._types["delete"](t[i]);\n } else {\n this._types.add(t[i]);\n }\n }\n _applyTypes(this, params);\n }\n }\n }, {\n key: "applyType",\n value: function applyType(t, params) {\n this.setPaintStyle(t.paintStyle);\n this.setHoverPaintStyle(t.hoverPaintStyle);\n this.mergeParameters(t.parameters);\n this.paintStyleInUse = this.getPaintStyle();\n if (t.overlays) {\n var keep = {},\n i;\n for (i in t.overlays) {\n var existing = this.overlays[t.overlays[i].options.id];\n if (existing) {\n existing.updateFrom(t.overlays[i].options);\n keep[t.overlays[i].options.id] = true;\n this.instance.reattachOverlay(existing, this);\n } else {\n var _c = this.getCachedTypeItem(TYPE_ITEM_OVERLAY, t.overlays[i].options.id);\n if (_c != null) {\n this.instance.reattachOverlay(_c, this);\n _c.setVisible(true);\n _c.updateFrom(t.overlays[i].options);\n this.overlays[_c.id] = _c;\n } else {\n _c = this.addOverlay(t.overlays[i]);\n }\n keep[_c.id] = true;\n }\n }\n for (i in this.overlays) {\n if (keep[this.overlays[i].id] == null) {\n this.removeOverlay(this.overlays[i].id, true);\n }\n }\n }\n }\n }, {\n key: "setPaintStyle",\n value: function setPaintStyle(style) {\n this.paintStyle = style;\n this.paintStyleInUse = this.paintStyle;\n _updateHoverStyle(this);\n }\n }, {\n key: "getPaintStyle",\n value: function getPaintStyle() {\n return this.paintStyle;\n }\n }, {\n key: "setHoverPaintStyle",\n value: function setHoverPaintStyle(style) {\n this.hoverPaintStyle = style;\n _updateHoverStyle(this);\n }\n }, {\n key: "getHoverPaintStyle",\n value: function getHoverPaintStyle() {\n return this.hoverPaintStyle;\n }\n }, {\n key: "destroy",\n value: function destroy() {\n for (var i in this.overlays) {\n this.instance.destroyOverlay(this.overlays[i]);\n }\n this.overlays = {};\n this.overlayPositions = {};\n this.unbind();\n this.clone = null;\n }\n }, {\n key: "isHover",\n value: function isHover() {\n return this._hover;\n }\n }, {\n key: "mergeParameters",\n value: function mergeParameters(p) {\n if (p != null) {\n extend(this.parameters, p);\n }\n }\n }, {\n key: "setVisible",\n value: function setVisible(v) {\n this.visible = v;\n if (v) {\n this.showOverlays();\n } else {\n this.hideOverlays();\n }\n }\n }, {\n key: "isVisible",\n value: function isVisible() {\n return this.visible;\n }\n }, {\n key: "setAbsoluteOverlayPosition",\n value: function setAbsoluteOverlayPosition(overlay, xy) {\n this.overlayPositions[overlay.id] = xy;\n }\n }, {\n key: "getAbsoluteOverlayPosition",\n value: function getAbsoluteOverlayPosition(overlay) {\n return this.overlayPositions ? this.overlayPositions[overlay.id] : null;\n }\n }, {\n key: "_clazzManip",\n value: function _clazzManip(action, clazz) {\n for (var i in this.overlays) {\n if (action === ACTION_ADD) {\n this.instance.addOverlayClass(this.overlays[i], clazz);\n } else if (action === ACTION_REMOVE) {\n this.instance.removeOverlayClass(this.overlays[i], clazz);\n }\n }\n }\n }, {\n key: "addClass",\n value: function addClass(clazz, cascade) {\n var parts = (this.cssClass || "").split(" ");\n parts.push(clazz);\n this.cssClass = parts.join(" ");\n this._clazzManip(ACTION_ADD, clazz);\n }\n }, {\n key: "removeClass",\n value: function removeClass(clazz, cascade) {\n var parts = (this.cssClass || "").split(" ");\n this.cssClass = parts.filter(function (p) {\n return p !== clazz;\n }).join(" ");\n this._clazzManip(ACTION_REMOVE, clazz);\n }\n }, {\n key: "getClass",\n value: function getClass() {\n return this.cssClass;\n }\n }, {\n key: "shouldFireEvent",\n value: function shouldFireEvent(event, value, originalEvent) {\n return true;\n }\n }, {\n key: "getData",\n value: function getData() {\n return this.data;\n }\n }, {\n key: "setData",\n value: function setData(d) {\n this.data = d || {};\n }\n }, {\n key: "mergeData",\n value: function mergeData(d) {\n this.data = extend(this.data, d);\n }\n }, {\n key: "addOverlay",\n value: function addOverlay(overlay) {\n var o = _processOverlay(this, overlay);\n if (this.getData && o.type === LabelOverlay.type && !isString(overlay)) {\n var d = this.getData(),\n p = overlay.options;\n if (d) {\n var locationAttribute = p.labelLocationAttribute || LOCATION_ATTRIBUTE;\n var loc = d[locationAttribute];\n if (loc) {\n o.location = loc;\n }\n }\n }\n return o;\n }\n }, {\n key: "getOverlay",\n value: function getOverlay(id) {\n return this.overlays[id];\n }\n }, {\n key: "getOverlays",\n value: function getOverlays() {\n return this.overlays;\n }\n }, {\n key: "hideOverlay",\n value: function hideOverlay(id) {\n var o = this.getOverlay(id);\n if (o) {\n o.setVisible(false);\n }\n }\n }, {\n key: "hideOverlays",\n value: function hideOverlays() {\n for (var _len = arguments.length, ids = new Array(_len), _key = 0; _key < _len; _key++) {\n ids[_key] = arguments[_key];\n }\n ids = ids || [];\n for (var i in this.overlays) {\n if (ids.length === 0 || ids.indexOf(i) !== -1) {\n this.overlays[i].setVisible(false);\n }\n }\n }\n }, {\n key: "showOverlay",\n value: function showOverlay(id) {\n var o = this.getOverlay(id);\n if (o) {\n o.setVisible(true);\n }\n }\n }, {\n key: "showOverlays",\n value: function showOverlays() {\n for (var _len2 = arguments.length, ids = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n ids[_key2] = arguments[_key2];\n }\n ids = ids || [];\n for (var i in this.overlays) {\n if (ids.length === 0 || ids.indexOf(i) !== -1) {\n this.overlays[i].setVisible(true);\n }\n }\n }\n }, {\n key: "removeAllOverlays",\n value: function removeAllOverlays() {\n for (var i in this.overlays) {\n this.instance.destroyOverlay(this.overlays[i]);\n }\n this.overlays = {};\n this.overlayPositions = null;\n this.overlayPlacements = {};\n }\n }, {\n key: "removeOverlay",\n value: function removeOverlay(overlayId, dontCleanup) {\n var o = this.overlays[overlayId];\n if (o) {\n o.setVisible(false);\n if (!dontCleanup) {\n this.instance.destroyOverlay(o);\n }\n delete this.overlays[overlayId];\n if (this.overlayPositions) {\n delete this.overlayPositions[overlayId];\n }\n if (this.overlayPlacements) {\n delete this.overlayPlacements[overlayId];\n }\n }\n }\n }, {\n key: "removeOverlays",\n value: function removeOverlays() {\n for (var _len3 = arguments.length, overlays = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n overlays[_key3] = arguments[_key3];\n }\n for (var i = 0, j = overlays.length; i < j; i++) {\n this.removeOverlay(arguments[i]);\n }\n }\n }, {\n key: "getLabel",\n value: function getLabel() {\n var lo = this.getLabelOverlay();\n return lo != null ? lo.getLabel() : null;\n }\n }, {\n key: "getLabelOverlay",\n value: function getLabelOverlay() {\n return this.getOverlay(_internalLabelOverlayId);\n }\n }, {\n key: "setLabel",\n value: function setLabel(l) {\n var lo = this.getLabelOverlay();\n if (!lo) {\n var _params2 = isString(l) || isFunction(l) ? {\n label: l\n } : l;\n lo = _makeLabelOverlay(this, _params2);\n this.overlays[_internalLabelOverlayId] = lo;\n } else {\n if (isString(l) || isFunction(l)) {\n lo.setLabel(l);\n } else {\n var ll = l;\n if (ll.label) {\n lo.setLabel(ll.label);\n }\n if (ll.location) {\n lo.location = ll.location;\n }\n }\n }\n }\n }]);\n return Component;\n}(EventGenerator);\n\nvar typeParameters = ["connectorStyle", "connectorHoverStyle", "connectorOverlays", "connector", "connectionType", "connectorClass", "connectorHoverClass"];\nvar Endpoint = function (_Component) {\n _inherits(Endpoint, _Component);\n var _super = _createSuper(Endpoint);\n function Endpoint(instance, params) {\n var _this;\n _classCallCheck(this, Endpoint);\n _this = _super.call(this, instance, params);\n _this.instance = instance;\n _defineProperty(_assertThisInitialized(_this), "connections", []);\n _defineProperty(_assertThisInitialized(_this), "endpoint", void 0);\n _defineProperty(_assertThisInitialized(_this), "element", void 0);\n _defineProperty(_assertThisInitialized(_this), "elementId", void 0);\n _defineProperty(_assertThisInitialized(_this), "dragAllowedWhenFull", true);\n _defineProperty(_assertThisInitialized(_this), "timestamp", void 0);\n _defineProperty(_assertThisInitialized(_this), "portId", void 0);\n _defineProperty(_assertThisInitialized(_this), "maxConnections", void 0);\n _defineProperty(_assertThisInitialized(_this), "proxiedBy", void 0);\n _defineProperty(_assertThisInitialized(_this), "connectorClass", void 0);\n _defineProperty(_assertThisInitialized(_this), "connectorHoverClass", void 0);\n _defineProperty(_assertThisInitialized(_this), "finalEndpoint", void 0);\n _defineProperty(_assertThisInitialized(_this), "enabled", true);\n _defineProperty(_assertThisInitialized(_this), "isSource", void 0);\n _defineProperty(_assertThisInitialized(_this), "isTarget", void 0);\n _defineProperty(_assertThisInitialized(_this), "isTemporarySource", void 0);\n _defineProperty(_assertThisInitialized(_this), "connectionCost", 1);\n _defineProperty(_assertThisInitialized(_this), "connectionsDirected", void 0);\n _defineProperty(_assertThisInitialized(_this), "connectionsDetachable", void 0);\n _defineProperty(_assertThisInitialized(_this), "reattachConnections", void 0);\n _defineProperty(_assertThisInitialized(_this), "currentAnchorClass", void 0);\n _defineProperty(_assertThisInitialized(_this), "referenceEndpoint", void 0);\n _defineProperty(_assertThisInitialized(_this), "edgeType", void 0);\n _defineProperty(_assertThisInitialized(_this), "connector", void 0);\n _defineProperty(_assertThisInitialized(_this), "connectorOverlays", void 0);\n _defineProperty(_assertThisInitialized(_this), "connectorStyle", void 0);\n _defineProperty(_assertThisInitialized(_this), "connectorHoverStyle", void 0);\n _defineProperty(_assertThisInitialized(_this), "deleteOnEmpty", void 0);\n _defineProperty(_assertThisInitialized(_this), "uuid", void 0);\n _defineProperty(_assertThisInitialized(_this), "scope", void 0);\n _defineProperty(_assertThisInitialized(_this), "_anchor", void 0);\n _defineProperty(_assertThisInitialized(_this), "defaultLabelLocation", [0.5, 0.5]);\n _this.appendToDefaultType({\n edgeType: params.edgeType,\n maxConnections: params.maxConnections == null ? _this.instance.defaults.maxConnections : params.maxConnections,\n paintStyle: params.paintStyle || _this.instance.defaults.endpointStyle,\n hoverPaintStyle: params.hoverPaintStyle || _this.instance.defaults.endpointHoverStyle,\n connectorStyle: params.connectorStyle,\n connectorHoverStyle: params.connectorHoverStyle,\n connectorClass: params.connectorClass,\n connectorHoverClass: params.connectorHoverClass,\n connectorOverlays: params.connectorOverlays,\n connector: params.connector\n });\n _this.enabled = !(params.enabled === false);\n _this.visible = true;\n _this.element = params.element;\n _this.uuid = params.uuid;\n _this.portId = params.portId;\n _this.elementId = params.elementId;\n _this.connectionCost = params.connectionCost == null ? 1 : params.connectionCost;\n _this.connectionsDirected = params.connectionsDirected;\n _this.currentAnchorClass = "";\n _this.events = {};\n _this.connectorOverlays = params.connectorOverlays;\n _this.connectorStyle = params.connectorStyle;\n _this.connectorHoverStyle = params.connectorHoverStyle;\n _this.connector = params.connector;\n _this.edgeType = params.edgeType;\n _this.connectorClass = params.connectorClass;\n _this.connectorHoverClass = params.connectorHoverClass;\n _this.deleteOnEmpty = params.deleteOnEmpty === true;\n _this.isSource = params.source || false;\n _this.isTemporarySource = params.isTemporarySource || false;\n _this.isTarget = params.target || false;\n _this.connections = params.connections || [];\n _this.scope = params.scope || instance.defaultScope;\n _this.timestamp = null;\n _this.reattachConnections = params.reattachConnections || instance.defaults.reattachConnections;\n _this.connectionsDetachable = instance.defaults.connectionsDetachable;\n if (params.connectionsDetachable === false) {\n _this.connectionsDetachable = false;\n }\n _this.dragAllowedWhenFull = params.dragAllowedWhenFull !== false;\n if (params.onMaxConnections) {\n _this.bind(EVENT_MAX_CONNECTIONS, params.onMaxConnections);\n }\n var ep = params.endpoint || params.existingEndpoint || instance.defaults.endpoint;\n _this.setEndpoint(ep);\n if (params.preparedAnchor != null) {\n _this.setPreparedAnchor(params.preparedAnchor);\n } else {\n var anchorParamsToUse = params.anchor ? params.anchor : params.anchors ? params.anchors : instance.defaults.anchor || AnchorLocations.Top;\n _this.setAnchor(anchorParamsToUse);\n }\n var type = [DEFAULT, params.type || ""].join(" ");\n _this.addType(type, params.data);\n return _this;\n }\n _createClass(Endpoint, [{\n key: "getIdPrefix",\n value: function getIdPrefix() {\n return "_jsplumb_e";\n }\n }, {\n key: "getTypeDescriptor",\n value: function getTypeDescriptor() {\n return "endpoint";\n }\n }, {\n key: "getXY",\n value: function getXY() {\n return {\n x: this.endpoint.x,\n y: this.endpoint.y\n };\n }\n }, {\n key: "getDefaultOverlayKey",\n value: function getDefaultOverlayKey() {\n return "endpointOverlays";\n }\n }, {\n key: "_updateAnchorClass",\n value: function _updateAnchorClass() {\n var ac = this._anchor && this._anchor.cssClass;\n if (ac != null && ac.length > 0) {\n var oldAnchorClass = this.instance.endpointAnchorClassPrefix + "-" + this.currentAnchorClass;\n this.currentAnchorClass = ac;\n var anchorClass = this.instance.endpointAnchorClassPrefix + (this.currentAnchorClass ? "-" + this.currentAnchorClass : "");\n if (oldAnchorClass !== anchorClass) {\n this.removeClass(oldAnchorClass);\n this.addClass(anchorClass);\n this.instance.removeClass(this.element, oldAnchorClass);\n this.instance.addClass(this.element, anchorClass);\n }\n }\n }\n }, {\n key: "setPreparedAnchor",\n value: function setPreparedAnchor(anchor) {\n this.instance.router.setAnchor(this, anchor);\n this._updateAnchorClass();\n return this;\n }\n }, {\n key: "_anchorLocationChanged",\n value: function _anchorLocationChanged(currentAnchor) {\n this.fire(EVENT_ANCHOR_CHANGED, {\n endpoint: this,\n anchor: currentAnchor\n });\n this._updateAnchorClass();\n }\n }, {\n key: "setAnchor",\n value: function setAnchor(anchorParams) {\n var a = this.instance.router.prepareAnchor(anchorParams);\n this.setPreparedAnchor(a);\n return this;\n }\n }, {\n key: "addConnection",\n value: function addConnection(conn) {\n this.connections.push(conn);\n this.instance._refreshEndpoint(this);\n }\n }, {\n key: "detachFromConnection",\n value: function detachFromConnection(connection, idx, transientDetach) {\n idx = idx == null ? this.connections.indexOf(connection) : idx;\n if (idx >= 0) {\n this.connections.splice(idx, 1);\n this.instance._refreshEndpoint(this);\n }\n if (!transientDetach && this.deleteOnEmpty && this.connections.length === 0) {\n this.instance.deleteEndpoint(this);\n }\n }\n }, {\n key: "deleteEveryConnection",\n value: function deleteEveryConnection(params) {\n var c = this.connections.length;\n for (var i = 0; i < c; i++) {\n this.instance.deleteConnection(this.connections[0], params);\n }\n }\n }, {\n key: "detachFrom",\n value: function detachFrom(otherEndpoint) {\n var c = [];\n for (var i = 0; i < this.connections.length; i++) {\n if (this.connections[i].endpoints[1] === otherEndpoint || this.connections[i].endpoints[0] === otherEndpoint) {\n c.push(this.connections[i]);\n }\n }\n for (var j = 0, count = c.length; j < count; j++) {\n this.instance.deleteConnection(c[0]);\n }\n return this;\n }\n }, {\n key: "setVisible",\n value: function setVisible(v, doNotChangeConnections, doNotNotifyOtherEndpoint) {\n _get(_getPrototypeOf(Endpoint.prototype), "setVisible", this).call(this, v);\n this.endpoint.setVisible(v);\n if (v) {\n this.showOverlays();\n } else {\n this.hideOverlays();\n }\n if (!doNotChangeConnections) {\n for (var i = 0; i < this.connections.length; i++) {\n this.connections[i].setVisible(v);\n if (!doNotNotifyOtherEndpoint) {\n var oIdx = this === this.connections[i].endpoints[0] ? 1 : 0;\n if (this.connections[i].endpoints[oIdx].connections.length === 1) {\n this.connections[i].endpoints[oIdx].setVisible(v, true, true);\n }\n }\n }\n }\n }\n }, {\n key: "applyType",\n value: function applyType(t, typeMap) {\n _get(_getPrototypeOf(Endpoint.prototype), "applyType", this).call(this, t, typeMap);\n this.setPaintStyle(t.endpointStyle || t.paintStyle);\n this.setHoverPaintStyle(t.endpointHoverStyle || t.hoverPaintStyle);\n this.connectorStyle = t.connectorStyle;\n this.connectorHoverStyle = t.connectorHoverStyle;\n this.connector = t.connector;\n this.connectorOverlays = t.connectorOverlays;\n this.edgeType = t.edgeType;\n if (t.maxConnections != null) {\n this.maxConnections = t.maxConnections;\n }\n if (t.scope) {\n this.scope = t.scope;\n }\n extend(t, typeParameters);\n this.instance.applyEndpointType(this, t);\n }\n }, {\n key: "destroy",\n value: function destroy() {\n _get(_getPrototypeOf(Endpoint.prototype), "destroy", this).call(this);\n this.deleted = true;\n if (this.endpoint != null) {\n this.instance.destroyEndpoint(this);\n }\n }\n }, {\n key: "isFull",\n value: function isFull() {\n return this.maxConnections === 0 ? true : !(this.isFloating() || this.maxConnections < 0 || this.connections.length < this.maxConnections);\n }\n }, {\n key: "isFloating",\n value: function isFloating() {\n return this.instance.router.isFloating(this);\n }\n }, {\n key: "isConnectedTo",\n value: function isConnectedTo(otherEndpoint) {\n var found = false;\n if (otherEndpoint) {\n for (var i = 0; i < this.connections.length; i++) {\n if (this.connections[i].endpoints[1] === otherEndpoint || this.connections[i].endpoints[0] === otherEndpoint) {\n found = true;\n break;\n }\n }\n }\n return found;\n }\n }, {\n key: "setDragAllowedWhenFull",\n value: function setDragAllowedWhenFull(allowed) {\n this.dragAllowedWhenFull = allowed;\n }\n }, {\n key: "getUuid",\n value: function getUuid() {\n return this.uuid;\n }\n }, {\n key: "connectorSelector",\n value: function connectorSelector() {\n return this.connections[0];\n }\n }, {\n key: "prepareEndpoint",\n value: function prepareEndpoint(ep, typeId) {\n var endpointArgs = {\n cssClass: this.cssClass,\n endpoint: this\n };\n var endpoint;\n if (isAssignableFrom(ep, EndpointRepresentation)) {\n var epr = ep;\n endpoint = EndpointFactory.clone(epr);\n endpoint.classes = endpointArgs.cssClass.split(" ");\n } else if (isString(ep)) {\n endpoint = EndpointFactory.get(this, ep, endpointArgs);\n } else {\n var fep = ep;\n extend(endpointArgs, fep.options || {});\n endpoint = EndpointFactory.get(this, fep.type, endpointArgs);\n }\n endpoint.typeId = typeId;\n return endpoint;\n }\n }, {\n key: "setEndpoint",\n value: function setEndpoint(ep) {\n var _ep = this.prepareEndpoint(ep);\n this.setPreparedEndpoint(_ep);\n }\n }, {\n key: "setPreparedEndpoint",\n value: function setPreparedEndpoint(ep) {\n if (this.endpoint != null) {\n this.instance.destroyEndpoint(this);\n }\n this.endpoint = ep;\n }\n }, {\n key: "addClass",\n value: function addClass(clazz, cascade) {\n _get(_getPrototypeOf(Endpoint.prototype), "addClass", this).call(this, clazz, cascade);\n if (this.endpoint != null) {\n this.endpoint.addClass(clazz);\n }\n }\n }, {\n key: "removeClass",\n value: function removeClass(clazz, cascade) {\n _get(_getPrototypeOf(Endpoint.prototype), "removeClass", this).call(this, clazz, cascade);\n if (this.endpoint != null) {\n this.endpoint.removeClass(clazz);\n }\n }\n }]);\n return Endpoint;\n}(Component);\n\nvar TYPE_ITEM_ANCHORS = "anchors";\nvar TYPE_ITEM_CONNECTOR = "connector";\nfunction prepareEndpoint(conn, existing, index, anchor, element, elementId, endpoint) {\n var e;\n if (existing) {\n conn.endpoints[index] = existing;\n existing.addConnection(conn);\n } else {\n var ep = endpoint || conn.endpointSpec || conn.endpointsSpec[index] || conn.instance.defaults.endpoints[index] || conn.instance.defaults.endpoint;\n var es = conn.endpointStyles[index] || conn.endpointStyle || conn.instance.defaults.endpointStyles[index] || conn.instance.defaults.endpointStyle;\n if (es.fill == null && conn.paintStyle != null) {\n es.fill = conn.paintStyle.stroke;\n }\n if (es.outlineStroke == null && conn.paintStyle != null) {\n es.outlineStroke = conn.paintStyle.outlineStroke;\n }\n if (es.outlineWidth == null && conn.paintStyle != null) {\n es.outlineWidth = conn.paintStyle.outlineWidth;\n }\n var ehs = conn.endpointHoverStyles[index] || conn.endpointHoverStyle || conn.endpointHoverStyle || conn.instance.defaults.endpointHoverStyles[index] || conn.instance.defaults.endpointHoverStyle;\n if (conn.hoverPaintStyle != null) {\n if (ehs == null) {\n ehs = {};\n }\n if (ehs.fill == null) {\n ehs.fill = conn.hoverPaintStyle.stroke;\n }\n }\n var u = conn.uuids ? conn.uuids[index] : null;\n anchor = anchor != null ? anchor : conn.instance.defaults.anchors != null ? conn.instance.defaults.anchors[index] : conn.instance.defaults.anchor;\n e = conn.instance._internal_newEndpoint({\n paintStyle: es,\n hoverPaintStyle: ehs,\n endpoint: ep,\n connections: [conn],\n uuid: u,\n element: element,\n scope: conn.scope,\n anchor: anchor,\n reattachConnections: conn.reattach || conn.instance.defaults.reattachConnections,\n connectionsDetachable: conn.detachable || conn.instance.defaults.connectionsDetachable\n });\n conn.instance._refreshEndpoint(e);\n if (existing == null) {\n e.deleteOnEmpty = true;\n }\n conn.endpoints[index] = e;\n }\n return e;\n}\nvar Connection = function (_Component) {\n _inherits(Connection, _Component);\n var _super = _createSuper(Connection);\n function Connection(instance, params) {\n var _this;\n _classCallCheck(this, Connection);\n _this = _super.call(this, instance, params);\n _this.instance = instance;\n _defineProperty(_assertThisInitialized(_this), "connector", void 0);\n _defineProperty(_assertThisInitialized(_this), "defaultLabelLocation", 0.5);\n _defineProperty(_assertThisInitialized(_this), "scope", void 0);\n _defineProperty(_assertThisInitialized(_this), "typeId", "_jsplumb_connection");\n _defineProperty(_assertThisInitialized(_this), "previousConnection", void 0);\n _defineProperty(_assertThisInitialized(_this), "sourceId", void 0);\n _defineProperty(_assertThisInitialized(_this), "targetId", void 0);\n _defineProperty(_assertThisInitialized(_this), "source", void 0);\n _defineProperty(_assertThisInitialized(_this), "target", void 0);\n _defineProperty(_assertThisInitialized(_this), "detachable", true);\n _defineProperty(_assertThisInitialized(_this), "reattach", false);\n _defineProperty(_assertThisInitialized(_this), "uuids", void 0);\n _defineProperty(_assertThisInitialized(_this), "cost", 1);\n _defineProperty(_assertThisInitialized(_this), "directed", void 0);\n _defineProperty(_assertThisInitialized(_this), "endpoints", [null, null]);\n _defineProperty(_assertThisInitialized(_this), "endpointStyles", void 0);\n _defineProperty(_assertThisInitialized(_this), "endpointSpec", void 0);\n _defineProperty(_assertThisInitialized(_this), "endpointsSpec", void 0);\n _defineProperty(_assertThisInitialized(_this), "endpointStyle", {});\n _defineProperty(_assertThisInitialized(_this), "endpointHoverStyle", {});\n _defineProperty(_assertThisInitialized(_this), "endpointHoverStyles", void 0);\n _defineProperty(_assertThisInitialized(_this), "suspendedEndpoint", void 0);\n _defineProperty(_assertThisInitialized(_this), "suspendedIndex", void 0);\n _defineProperty(_assertThisInitialized(_this), "suspendedElement", void 0);\n _defineProperty(_assertThisInitialized(_this), "suspendedElementId", void 0);\n _defineProperty(_assertThisInitialized(_this), "suspendedElementType", void 0);\n _defineProperty(_assertThisInitialized(_this), "_forceReattach", void 0);\n _defineProperty(_assertThisInitialized(_this), "_forceDetach", void 0);\n _defineProperty(_assertThisInitialized(_this), "proxies", []);\n _defineProperty(_assertThisInitialized(_this), "pending", false);\n _this.id = params.id;\n _this.previousConnection = params.previousConnection;\n _this.source = params.source;\n _this.target = params.target;\n if (params.sourceEndpoint) {\n _this.source = params.sourceEndpoint.element;\n _this.sourceId = params.sourceEndpoint.elementId;\n } else {\n _this.sourceId = instance.getId(_this.source);\n }\n if (params.targetEndpoint) {\n _this.target = params.targetEndpoint.element;\n _this.targetId = params.targetEndpoint.elementId;\n } else {\n _this.targetId = instance.getId(_this.target);\n }\n _this.scope = params.scope;\n var sourceAnchor = params.anchors ? params.anchors[0] : params.anchor;\n var targetAnchor = params.anchors ? params.anchors[1] : params.anchor;\n instance.manage(_this.source);\n instance.manage(_this.target);\n _this.visible = true;\n _this.params = {\n cssClass: params.cssClass,\n hoverClass: params.hoverClass,\n "pointer-events": params["pointer-events"],\n overlays: params.overlays\n };\n _this.lastPaintedAt = null;\n if (params.type) {\n params.endpoints = params.endpoints || _this.instance._deriveEndpointAndAnchorSpec(params.type).endpoints;\n }\n _this.endpointSpec = params.endpoint;\n _this.endpointsSpec = params.endpoints || [null, null];\n _this.endpointStyle = params.endpointStyle;\n _this.endpointHoverStyle = params.endpointHoverStyle;\n _this.endpointStyles = params.endpointStyles || [null, null];\n _this.endpointHoverStyles = params.endpointHoverStyles || [null, null];\n _this.paintStyle = params.paintStyle;\n _this.hoverPaintStyle = params.hoverPaintStyle;\n _this.uuids = params.uuids;\n _this.makeEndpoint(true, _this.source, _this.sourceId, sourceAnchor, params.sourceEndpoint);\n _this.makeEndpoint(false, _this.target, _this.targetId, targetAnchor, params.targetEndpoint);\n if (!_this.scope) {\n _this.scope = _this.endpoints[0].scope;\n }\n if (params.deleteEndpointsOnEmpty != null) {\n _this.endpoints[0].deleteOnEmpty = params.deleteEndpointsOnEmpty;\n _this.endpoints[1].deleteOnEmpty = params.deleteEndpointsOnEmpty;\n }\n var _detachable = _this.instance.defaults.connectionsDetachable;\n if (params.detachable === false) {\n _detachable = false;\n }\n if (_this.endpoints[0].connectionsDetachable === false) {\n _detachable = false;\n }\n if (_this.endpoints[1].connectionsDetachable === false) {\n _detachable = false;\n }\n _this.endpointsSpec = params.endpoints || [null, null];\n _this.endpointSpec = params.endpoint || null;\n var _reattach = params.reattach || _this.endpoints[0].reattachConnections || _this.endpoints[1].reattachConnections || _this.instance.defaults.reattachConnections;\n var initialPaintStyle = extend({}, _this.endpoints[0].connectorStyle || _this.endpoints[1].connectorStyle || params.paintStyle || _this.instance.defaults.paintStyle);\n _this.appendToDefaultType({\n detachable: _detachable,\n reattach: _reattach,\n paintStyle: initialPaintStyle,\n hoverPaintStyle: extend({}, _this.endpoints[0].connectorHoverStyle || _this.endpoints[1].connectorHoverStyle || params.hoverPaintStyle || _this.instance.defaults.hoverPaintStyle)\n });\n if (params.outlineWidth) {\n initialPaintStyle.outlineWidth = params.outlineWidth;\n }\n if (params.outlineColor) {\n initialPaintStyle.outlineStroke = params.outlineColor;\n }\n if (params.lineWidth) {\n initialPaintStyle.strokeWidth = params.lineWidth;\n }\n if (params.color) {\n initialPaintStyle.stroke = params.color;\n }\n if (!_this.instance._suspendDrawing) {\n var initialTimestamp = _this.instance._suspendedAt || uuid();\n _this.instance._paintEndpoint(_this.endpoints[0], {\n timestamp: initialTimestamp\n });\n _this.instance._paintEndpoint(_this.endpoints[1], {\n timestamp: initialTimestamp\n });\n }\n _this.cost = params.cost || _this.endpoints[0].connectionCost;\n _this.directed = params.directed;\n if (params.directed == null) {\n _this.directed = _this.endpoints[0].connectionsDirected;\n }\n var _p = extend({}, _this.endpoints[1].parameters);\n extend(_p, _this.endpoints[0].parameters);\n extend(_p, _this.parameters);\n _this.parameters = _p;\n _this.paintStyleInUse = _this.getPaintStyle() || {};\n _this._setConnector(_this.endpoints[0].connector || _this.endpoints[1].connector || params.connector || _this.instance.defaults.connector, true);\n var data = params.data == null || !isObject(params.data) ? {} : params.data;\n _this.setData(data);\n var _types = [DEFAULT, _this.endpoints[0].edgeType, _this.endpoints[1].edgeType, params.type].join(" ");\n if (/[^\\s]/.test(_types)) {\n _this.addType(_types, params.data);\n }\n return _this;\n }\n _createClass(Connection, [{\n key: "getIdPrefix",\n value: function getIdPrefix() {\n return "_jsPlumb_c";\n }\n }, {\n key: "getDefaultOverlayKey",\n value: function getDefaultOverlayKey() {\n return KEY_CONNECTION_OVERLAYS;\n }\n }, {\n key: "getXY",\n value: function getXY() {\n return {\n x: this.connector.x,\n y: this.connector.y\n };\n }\n }, {\n key: "makeEndpoint",\n value: function makeEndpoint(isSource, el, elId, anchor, ep) {\n elId = elId || this.instance.getId(el);\n return prepareEndpoint(this, ep, isSource ? 0 : 1, anchor, el);\n }\n }, {\n key: "getTypeDescriptor",\n value: function getTypeDescriptor() {\n return Connection.type;\n }\n }, {\n key: "isDetachable",\n value: function isDetachable(ep) {\n return this.detachable === false ? false : ep != null ? ep.connectionsDetachable === true : this.detachable === true;\n }\n }, {\n key: "setDetachable",\n value: function setDetachable(detachable) {\n this.detachable = detachable === true;\n }\n }, {\n key: "isReattach",\n value: function isReattach() {\n return this.reattach === true || this.endpoints[0].reattachConnections === true || this.endpoints[1].reattachConnections === true;\n }\n }, {\n key: "setReattach",\n value: function setReattach(reattach) {\n this.reattach = reattach === true;\n }\n }, {\n key: "applyType",\n value: function applyType(t, typeMap) {\n var _connector = null;\n if (t.connector != null) {\n _connector = this.getCachedTypeItem(TYPE_ITEM_CONNECTOR, typeMap.connector);\n if (_connector == null) {\n _connector = this.prepareConnector(t.connector, typeMap.connector);\n this.cacheTypeItem(TYPE_ITEM_CONNECTOR, _connector, typeMap.connector);\n }\n this.setPreparedConnector(_connector);\n }\n _get(_getPrototypeOf(Connection.prototype), "applyType", this).call(this, t, typeMap);\n if (t.detachable != null) {\n this.setDetachable(t.detachable);\n }\n if (t.reattach != null) {\n this.setReattach(t.reattach);\n }\n if (t.scope) {\n this.scope = t.scope;\n }\n var _anchors = null;\n if (t.anchor) {\n _anchors = this.getCachedTypeItem(TYPE_ITEM_ANCHORS, typeMap.anchor);\n if (_anchors == null) {\n _anchors = [makeLightweightAnchorFromSpec(t.anchor), makeLightweightAnchorFromSpec(t.anchor)];\n this.cacheTypeItem(TYPE_ITEM_ANCHORS, _anchors, typeMap.anchor);\n }\n } else if (t.anchors) {\n _anchors = this.getCachedTypeItem(TYPE_ITEM_ANCHORS, typeMap.anchors);\n if (_anchors == null) {\n _anchors = [makeLightweightAnchorFromSpec(t.anchors[0]), makeLightweightAnchorFromSpec(t.anchors[1])];\n this.cacheTypeItem(TYPE_ITEM_ANCHORS, _anchors, typeMap.anchors);\n }\n }\n if (_anchors != null) {\n this.instance.router.setConnectionAnchors(this, _anchors);\n if (this.instance.router.isDynamicAnchor(this.endpoints[1])) {\n this.instance.repaint(this.endpoints[1].element);\n }\n }\n this.instance.applyConnectorType(this.connector, t);\n }\n }, {\n key: "addClass",\n value: function addClass(c, cascade) {\n _get(_getPrototypeOf(Connection.prototype), "addClass", this).call(this, c);\n if (cascade) {\n this.endpoints[0].addClass(c);\n this.endpoints[1].addClass(c);\n if (this.suspendedEndpoint) {\n this.suspendedEndpoint.addClass(c);\n }\n }\n if (this.connector) {\n this.instance.addConnectorClass(this.connector, c);\n }\n }\n }, {\n key: "removeClass",\n value: function removeClass(c, cascade) {\n _get(_getPrototypeOf(Connection.prototype), "removeClass", this).call(this, c);\n if (cascade) {\n this.endpoints[0].removeClass(c);\n this.endpoints[1].removeClass(c);\n if (this.suspendedEndpoint) {\n this.suspendedEndpoint.removeClass(c);\n }\n }\n if (this.connector) {\n this.instance.removeConnectorClass(this.connector, c);\n }\n }\n }, {\n key: "setVisible",\n value: function setVisible(v) {\n _get(_getPrototypeOf(Connection.prototype), "setVisible", this).call(this, v);\n if (this.connector) {\n this.instance.setConnectorVisible(this.connector, v);\n }\n this.instance._paintConnection(this);\n }\n }, {\n key: "destroy",\n value: function destroy() {\n _get(_getPrototypeOf(Connection.prototype), "destroy", this).call(this);\n this.endpoints = null;\n this.endpointStyles = null;\n this.source = null;\n this.target = null;\n this.instance.destroyConnector(this);\n this.connector = null;\n this.deleted = true;\n }\n }, {\n key: "getUuids",\n value: function getUuids() {\n return [this.endpoints[0].getUuid(), this.endpoints[1].getUuid()];\n }\n }, {\n key: "prepareConnector",\n value: function prepareConnector(connectorSpec, typeId) {\n var connectorArgs = {\n cssClass: this.params.cssClass,\n hoverClass: this.params.hoverClass,\n "pointer-events": this.params["pointer-events"]\n },\n connector;\n if (isString(connectorSpec)) {\n connector = this.instance._makeConnector(this, connectorSpec, connectorArgs);\n } else {\n var co = connectorSpec;\n connector = this.instance._makeConnector(this, co.type, merge(co.options || {}, connectorArgs));\n }\n if (typeId != null) {\n connector.typeId = typeId;\n }\n return connector;\n }\n }, {\n key: "setPreparedConnector",\n value: function setPreparedConnector(connector, doNotRepaint, doNotChangeListenerComponent, typeId) {\n if (this.connector !== connector) {\n var previous,\n previousClasses = "";\n if (this.connector != null) {\n previous = this.connector;\n previousClasses = this.instance.getConnectorClass(this.connector);\n this.instance.destroyConnector(this);\n }\n this.connector = connector;\n if (typeId) {\n this.cacheTypeItem(TYPE_ITEM_CONNECTOR, connector, typeId);\n }\n this.addClass(previousClasses);\n if (previous != null) {\n var o = this.getOverlays();\n for (var i in o) {\n this.instance.reattachOverlay(o[i], this);\n }\n }\n if (!doNotRepaint) {\n this.instance._paintConnection(this);\n }\n }\n }\n }, {\n key: "_setConnector",\n value: function _setConnector(connectorSpec, doNotRepaint, doNotChangeListenerComponent, typeId) {\n var connector = this.prepareConnector(connectorSpec, typeId);\n this.setPreparedConnector(connector, doNotRepaint, doNotChangeListenerComponent, typeId);\n }\n }, {\n key: "replaceEndpoint",\n value: function replaceEndpoint(idx, endpointDef) {\n var current = this.endpoints[idx],\n elId = current.elementId,\n ebe = this.instance.getEndpoints(current.element),\n _idx = ebe.indexOf(current),\n _new = prepareEndpoint(this, null, idx, null, current.element, elId, endpointDef);\n this.endpoints[idx] = _new;\n ebe.splice(_idx, 1, _new);\n current.detachFromConnection(this);\n this.instance.deleteEndpoint(current);\n this.instance.fire(EVENT_ENDPOINT_REPLACED, {\n previous: current,\n current: _new\n });\n }\n }]);\n return Connection;\n}(Component);\n_defineProperty(Connection, "type", "connection");\n\nfunction ensureSVGOverlayPath(o) {\n if (o.path == null) {\n var atts = extend({\n "jtk-overlay-id": o.id\n }, o.attributes);\n o.path = _node(ELEMENT_PATH, atts);\n var cls = o.instance.overlayClass + " " + (o.cssClass ? o.cssClass : "");\n o.instance.addClass(o.path, cls);\n o.path.jtk = {\n overlay: o\n };\n }\n var parent = o.path.parentNode;\n if (parent == null) {\n if (o.component instanceof Connection) {\n var connector = o.component.connector;\n parent = connector != null ? connector.canvas : null;\n } else if (o.component instanceof Endpoint) {\n var endpoint = o.component.endpoint;\n parent = endpoint != null ? endpoint.canvas : endpoint;\n }\n if (parent != null) {\n _appendAtIndex(parent, o.path, 1);\n }\n }\n return o.path;\n}\nfunction paintSVGOverlay(o, path, params, extents) {\n ensureSVGOverlayPath(o);\n var offset = [0, 0];\n if (extents.xmin < 0) {\n offset[0] = -extents.xmin;\n }\n if (extents.ymin < 0) {\n offset[1] = -extents.ymin;\n }\n var a = {\n "d": path,\n stroke: params.stroke ? params.stroke : null,\n fill: params.fill ? params.fill : null,\n transform: "translate(" + offset[0] + "," + offset[1] + ")",\n "pointer-events": "visibleStroke"\n };\n _attr(o.path, a);\n}\nfunction destroySVGOverlay(o, force) {\n var _o = o;\n if (_o.path != null && _o.path.parentNode != null) {\n _o.path.parentNode.removeChild(_o.path);\n }\n if (_o.bgPath != null && _o.bgPath.parentNode != null) {\n _o.bgPath.parentNode.removeChild(_o.bgPath);\n }\n delete _o.path;\n delete _o.bgPath;\n}\n(function (_Overlay) {\n _inherits(SVGElementOverlay, _Overlay);\n var _super = _createSuper(SVGElementOverlay);\n function SVGElementOverlay() {\n var _this;\n _classCallCheck(this, SVGElementOverlay);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), "path", void 0);\n return _this;\n }\n return SVGElementOverlay;\n})(Overlay);\n\nvar SvgComponent = function () {\n function SvgComponent() {\n _classCallCheck(this, SvgComponent);\n }\n _createClass(SvgComponent, null, [{\n key: "paint",\n value: function paint(connector, instance, paintStyle, extents) {\n if (paintStyle != null) {\n var xy = [connector.x, connector.y],\n wh = [connector.w, connector.h];\n if (extents != null) {\n if (extents.xmin < 0) {\n xy[0] += extents.xmin;\n }\n if (extents.ymin < 0) {\n xy[1] += extents.ymin;\n }\n wh[0] = extents.xmax + (extents.xmin < 0 ? -extents.xmin : 0);\n wh[1] = extents.ymax + (extents.ymin < 0 ? -extents.ymin : 0);\n }\n if (isFinite(wh[0]) && isFinite(wh[1])) {\n var attrs = {\n "width": "" + (wh[0] || 0),\n "height": "" + (wh[1] || 0)\n };\n if (instance.containerType === ElementTypes.HTML) {\n _attr(connector.canvas, extend(attrs, {\n style: _pos([xy[0], xy[1]])\n }));\n } else {\n _attr(connector.canvas, extend(attrs, {\n x: xy[0],\n y: xy[1]\n }));\n }\n }\n }\n }\n }]);\n return SvgComponent;\n}();\n\nfunction paintSvgConnector(instance, connector, paintStyle, extents) {\n getConnectorElement(instance, connector);\n SvgComponent.paint(connector, instance, paintStyle, extents);\n var p = "",\n offset = [0, 0];\n if (extents.xmin < 0) {\n offset[0] = -extents.xmin;\n }\n if (extents.ymin < 0) {\n offset[1] = -extents.ymin;\n }\n if (connector.segments.length > 0) {\n p = instance.getPathData(connector);\n var a = {\n d: p,\n transform: "translate(" + offset[0] + "," + offset[1] + ")",\n "pointer-events": "visibleStroke"\n },\n outlineStyle = null;\n if (paintStyle.outlineStroke) {\n var outlineWidth = paintStyle.outlineWidth || 1,\n outlineStrokeWidth = paintStyle.strokeWidth + 2 * outlineWidth;\n outlineStyle = extend({}, paintStyle);\n outlineStyle.stroke = paintStyle.outlineStroke;\n outlineStyle.strokeWidth = outlineStrokeWidth;\n if (connector.bgPath == null) {\n connector.bgPath = _node(ELEMENT_PATH, a);\n instance.addClass(connector.bgPath, instance.connectorOutlineClass);\n _appendAtIndex(connector.canvas, connector.bgPath, 0);\n } else {\n _attr(connector.bgPath, a);\n }\n _applyStyles(connector.canvas, connector.bgPath, outlineStyle);\n }\n var cany = connector;\n if (cany.path == null) {\n cany.path = _node(ELEMENT_PATH, a);\n _appendAtIndex(cany.canvas, cany.path, paintStyle.outlineStroke ? 1 : 0);\n } else {\n if (cany.path.parentNode !== cany.canvas) {\n _appendAtIndex(cany.canvas, cany.path, paintStyle.outlineStroke ? 1 : 0);\n }\n _attr(connector.path, a);\n }\n _applyStyles(connector.canvas, connector.path, paintStyle);\n }\n}\nfunction getConnectorElement(instance, c) {\n if (c.canvas != null) {\n return c.canvas;\n } else {\n var svg = _node(ELEMENT_SVG, {\n "style": "",\n "width": "0",\n "height": "0",\n "pointer-events": NONE,\n "position": ABSOLUTE\n });\n c.canvas = svg;\n instance._appendElement(c.canvas, instance.getContainer());\n if (c.cssClass != null) {\n instance.addClass(svg, c.cssClass);\n }\n instance.addClass(svg, instance.connectorClass);\n svg.jtk = svg.jtk || {};\n svg.jtk.connector = c;\n return svg;\n }\n}\n\nvar SvgEndpoint = function () {\n function SvgEndpoint() {\n _classCallCheck(this, SvgEndpoint);\n }\n _createClass(SvgEndpoint, null, [{\n key: "getEndpointElement",\n value: function getEndpointElement(ep) {\n if (ep.canvas != null) {\n return ep.canvas;\n } else {\n var canvas = _node(ELEMENT_SVG, {\n "style": "",\n "width": "0",\n "height": "0",\n "pointer-events": "all",\n "position": ABSOLUTE\n });\n ep.canvas = canvas;\n var classes = ep.classes.join(" ");\n ep.instance.addClass(canvas, classes);\n var scopes = ep.endpoint.scope.split(/\\s/);\n for (var i = 0; i < scopes.length; i++) {\n ep.instance.setAttribute(canvas, ATTRIBUTE_SCOPE_PREFIX + scopes[i], TRUE$1);\n }\n ep.instance._appendElementToContainer(canvas);\n if (ep.cssClass != null) {\n ep.instance.addClass(canvas, ep.cssClass);\n }\n ep.instance.addClass(canvas, ep.instance.endpointClass);\n canvas.jtk = canvas.jtk || {};\n canvas.jtk.endpoint = ep.endpoint;\n canvas.style.display = ep.endpoint.visible !== false ? BLOCK : NONE;\n return canvas;\n }\n }\n }, {\n key: "paint",\n value: function paint(ep, handlers, paintStyle) {\n if (ep.endpoint.deleted !== true) {\n this.getEndpointElement(ep);\n SvgComponent.paint(ep, ep.instance, paintStyle);\n var s = extend({}, paintStyle);\n if (s.outlineStroke) {\n s.stroke = s.outlineStroke;\n }\n if (ep.node == null) {\n ep.node = handlers.makeNode(ep, s);\n ep.canvas.appendChild(ep.node);\n } else if (handlers.updateNode != null) {\n handlers.updateNode(ep, ep.node);\n }\n _applyStyles(ep.canvas, ep.node, s);\n }\n }\n }]);\n return SvgEndpoint;\n}();\n\nvar AbstractConnector = function () {\n function AbstractConnector(connection, params) {\n _classCallCheck(this, AbstractConnector);\n this.connection = connection;\n _defineProperty(this, "type", void 0);\n _defineProperty(this, "edited", false);\n _defineProperty(this, "stub", void 0);\n _defineProperty(this, "sourceStub", void 0);\n _defineProperty(this, "targetStub", void 0);\n _defineProperty(this, "maxStub", void 0);\n _defineProperty(this, "typeId", void 0);\n _defineProperty(this, "gap", void 0);\n _defineProperty(this, "sourceGap", void 0);\n _defineProperty(this, "targetGap", void 0);\n _defineProperty(this, "segments", []);\n _defineProperty(this, "totalLength", 0);\n _defineProperty(this, "segmentProportions", []);\n _defineProperty(this, "segmentProportionalLengths", []);\n _defineProperty(this, "paintInfo", null);\n _defineProperty(this, "strokeWidth", void 0);\n _defineProperty(this, "x", void 0);\n _defineProperty(this, "y", void 0);\n _defineProperty(this, "w", void 0);\n _defineProperty(this, "h", void 0);\n _defineProperty(this, "segment", void 0);\n _defineProperty(this, "bounds", EMPTY_BOUNDS());\n _defineProperty(this, "cssClass", void 0);\n _defineProperty(this, "hoverClass", void 0);\n _defineProperty(this, "geometry", void 0);\n this.stub = params.stub || this.getDefaultStubs();\n this.sourceStub = Array.isArray(this.stub) ? this.stub[0] : this.stub;\n this.targetStub = Array.isArray(this.stub) ? this.stub[1] : this.stub;\n this.gap = params.gap || 0;\n this.sourceGap = Array.isArray(this.gap) ? this.gap[0] : this.gap;\n this.targetGap = Array.isArray(this.gap) ? this.gap[1] : this.gap;\n this.maxStub = Math.max(this.sourceStub, this.targetStub);\n this.cssClass = params.cssClass || "";\n this.hoverClass = params.hoverClass || "";\n }\n _createClass(AbstractConnector, [{\n key: "getTypeDescriptor",\n value: function getTypeDescriptor() {\n return "connector";\n }\n }, {\n key: "getIdPrefix",\n value: function getIdPrefix() {\n return "_jsplumb_connector";\n }\n }, {\n key: "setGeometry",\n value: function setGeometry(g, internal) {\n this.geometry = g;\n this.edited = g != null && !internal;\n }\n }, {\n key: "exportGeometry",\n value: function exportGeometry() {\n return this.geometry;\n }\n }, {\n key: "importGeometry",\n value: function importGeometry(g) {\n this.geometry = g;\n return true;\n }\n }, {\n key: "resetGeometry",\n value: function resetGeometry() {\n this.geometry = null;\n this.edited = false;\n }\n }, {\n key: "transformAnchorPlacement",\n value:\n function transformAnchorPlacement(a, dx, dy) {\n return {\n x: a.x,\n y: a.y,\n ox: a.ox,\n oy: a.oy,\n curX: a.curX + dx,\n curY: a.curY + dy\n };\n }\n }, {\n key: "resetBounds",\n value: function resetBounds() {\n this.bounds = EMPTY_BOUNDS();\n }\n }, {\n key: "findSegmentForPoint",\n value: function findSegmentForPoint(x, y) {\n var out = {\n d: Infinity,\n s: null,\n x: null,\n y: null,\n l: null,\n x1: null,\n y1: null,\n x2: null,\n y2: null,\n index: null,\n connectorLocation: null\n };\n for (var i = 0; i < this.segments.length; i++) {\n var _s = this.segments[i].findClosestPointOnPath(x, y);\n if (_s.d < out.d) {\n out.d = _s.d;\n out.l = _s.l;\n out.x = _s.x;\n out.y = _s.y;\n out.s = this.segments[i];\n out.x1 = _s.x1;\n out.x2 = _s.x2;\n out.y1 = _s.y1;\n out.y2 = _s.y2;\n out.index = i;\n out.connectorLocation = this.segmentProportions[i][0] + _s.l * (this.segmentProportions[i][1] - this.segmentProportions[i][0]);\n }\n }\n return out;\n }\n }, {\n key: "lineIntersection",\n value: function lineIntersection(x1, y1, x2, y2) {\n var out = [];\n for (var i = 0; i < this.segments.length; i++) {\n out.push.apply(out, this.segments[i].lineIntersection(x1, y1, x2, y2));\n }\n return out;\n }\n }, {\n key: "boxIntersection",\n value: function boxIntersection(x, y, w, h) {\n var out = [];\n for (var i = 0; i < this.segments.length; i++) {\n out.push.apply(out, this.segments[i].boxIntersection(x, y, w, h));\n }\n return out;\n }\n }, {\n key: "boundingBoxIntersection",\n value: function boundingBoxIntersection(box) {\n var out = [];\n for (var i = 0; i < this.segments.length; i++) {\n out.push.apply(out, this.segments[i].boundingBoxIntersection(box));\n }\n return out;\n }\n }, {\n key: "_updateSegmentProportions",\n value: function _updateSegmentProportions() {\n var curLoc = 0;\n for (var i = 0; i < this.segments.length; i++) {\n var sl = this.segments[i].getLength();\n this.segmentProportionalLengths[i] = sl / this.totalLength;\n this.segmentProportions[i] = [curLoc, curLoc += sl / this.totalLength];\n }\n }\n }, {\n key: "_findSegmentForLocation",\n value: function _findSegmentForLocation(location, absolute) {\n var idx, i, inSegmentProportion;\n if (absolute) {\n location = location > 0 ? location / this.totalLength : (this.totalLength + location) / this.totalLength;\n }\n if (location === 1) {\n idx = this.segments.length - 1;\n inSegmentProportion = 1;\n } else if (location === 0) {\n inSegmentProportion = 0;\n idx = 0;\n } else {\n if (location >= 0.5) {\n idx = 0;\n inSegmentProportion = 0;\n for (i = this.segmentProportions.length - 1; i > -1; i--) {\n if (this.segmentProportions[i][1] >= location && this.segmentProportions[i][0] <= location) {\n idx = i;\n inSegmentProportion = (location - this.segmentProportions[i][0]) / this.segmentProportionalLengths[i];\n break;\n }\n }\n } else {\n idx = this.segmentProportions.length - 1;\n inSegmentProportion = 1;\n for (i = 0; i < this.segmentProportions.length; i++) {\n if (this.segmentProportions[i][1] >= location) {\n idx = i;\n inSegmentProportion = (location - this.segmentProportions[i][0]) / this.segmentProportionalLengths[i];\n break;\n }\n }\n }\n }\n return {\n segment: this.segments[idx],\n proportion: inSegmentProportion,\n index: idx\n };\n }\n }, {\n key: "_addSegment",\n value: function _addSegment(clazz, params) {\n if (params.x1 === params.x2 && params.y1 === params.y2) {\n return;\n }\n var s = new clazz(params);\n this.segments.push(s);\n this.totalLength += s.getLength();\n this.updateBounds(s);\n }\n }, {\n key: "_clearSegments",\n value: function _clearSegments() {\n this.totalLength = 0;\n this.segments.length = 0;\n this.segmentProportions.length = 0;\n this.segmentProportionalLengths.length = 0;\n }\n }, {\n key: "getLength",\n value: function getLength() {\n return this.totalLength;\n }\n }, {\n key: "_prepareCompute",\n value: function _prepareCompute(params) {\n this.strokeWidth = params.strokeWidth;\n var x1 = params.sourcePos.curX,\n x2 = params.targetPos.curX,\n y1 = params.sourcePos.curY,\n y2 = params.targetPos.curY,\n segment = quadrant({\n x: x1,\n y: y1\n }, {\n x: x2,\n y: y2\n }),\n swapX = x2 < x1,\n swapY = y2 < y1,\n so = [params.sourcePos.ox, params.sourcePos.oy],\n to = [params.targetPos.ox, params.targetPos.oy],\n x = swapX ? x2 : x1,\n y = swapY ? y2 : y1,\n w = Math.abs(x2 - x1),\n h = Math.abs(y2 - y1);\n var noSourceOrientation = so[0] === 0 && so[1] === 0;\n var noTargetOrientation = to[0] === 0 && to[1] === 0;\n if (noSourceOrientation || noTargetOrientation) {\n var index = w > h ? 0 : 1,\n oIndex = [1, 0][index],\n v1 = index === 0 ? x1 : y1,\n v2 = index === 0 ? x2 : y2;\n if (noSourceOrientation) {\n so[index] = v1 > v2 ? -1 : 1;\n so[oIndex] = 0;\n }\n if (noTargetOrientation) {\n to[index] = v1 > v2 ? 1 : -1;\n to[oIndex] = 0;\n }\n }\n var sx = swapX ? w + this.sourceGap * so[0] : this.sourceGap * so[0],\n sy = swapY ? h + this.sourceGap * so[1] : this.sourceGap * so[1],\n tx = swapX ? this.targetGap * to[0] : w + this.targetGap * to[0],\n ty = swapY ? this.targetGap * to[1] : h + this.targetGap * to[1],\n oProduct = so[0] * to[0] + so[1] * to[1];\n var result = {\n sx: sx,\n sy: sy,\n tx: tx,\n ty: ty,\n xSpan: Math.abs(tx - sx),\n ySpan: Math.abs(ty - sy),\n mx: (sx + tx) / 2,\n my: (sy + ty) / 2,\n so: so,\n to: to,\n x: x,\n y: y,\n w: w,\n h: h,\n segment: segment,\n startStubX: sx + so[0] * this.sourceStub,\n startStubY: sy + so[1] * this.sourceStub,\n endStubX: tx + to[0] * this.targetStub,\n endStubY: ty + to[1] * this.targetStub,\n isXGreaterThanStubTimes2: Math.abs(sx - tx) > this.sourceStub + this.targetStub,\n isYGreaterThanStubTimes2: Math.abs(sy - ty) > this.sourceStub + this.targetStub,\n opposite: oProduct === -1,\n perpendicular: oProduct === 0,\n orthogonal: oProduct === 1,\n sourceAxis: so[0] === 0 ? "y" : "x",\n points: [x, y, w, h, sx, sy, tx, ty],\n stubs: [this.sourceStub, this.targetStub]\n };\n result.anchorOrientation = result.opposite ? "opposite" : result.orthogonal ? "orthogonal" : "perpendicular";\n return result;\n }\n }, {\n key: "updateBounds",\n value: function updateBounds(segment) {\n var segBounds = segment.extents;\n this.bounds.xmin = Math.min(this.bounds.xmin, segBounds.xmin);\n this.bounds.xmax = Math.max(this.bounds.xmax, segBounds.xmax);\n this.bounds.ymin = Math.min(this.bounds.ymin, segBounds.ymin);\n this.bounds.ymax = Math.max(this.bounds.ymax, segBounds.ymax);\n }\n }, {\n key: "dumpSegmentsToConsole",\n value: function dumpSegmentsToConsole() {\n log("SEGMENTS:");\n for (var i = 0; i < this.segments.length; i++) {\n log(this.segments[i].type, "" + this.segments[i].getLength(), "" + this.segmentProportions[i]);\n }\n }\n }, {\n key: "pointOnPath",\n value: function pointOnPath(location, absolute) {\n var seg = this._findSegmentForLocation(location, absolute);\n return seg.segment && seg.segment.pointOnPath(seg.proportion, false) || {\n x: 0,\n y: 0\n };\n }\n }, {\n key: "gradientAtPoint",\n value: function gradientAtPoint(location, absolute) {\n var seg = this._findSegmentForLocation(location, absolute);\n return seg.segment && seg.segment.gradientAtPoint(seg.proportion, false) || 0;\n }\n }, {\n key: "pointAlongPathFrom",\n value: function pointAlongPathFrom(location, distance, absolute) {\n var seg = this._findSegmentForLocation(location, absolute);\n return seg.segment && seg.segment.pointAlongPathFrom(seg.proportion, distance, false) || {\n x: 0,\n y: 0\n };\n }\n }, {\n key: "compute",\n value: function compute(params) {\n this.paintInfo = this._prepareCompute(params);\n this._clearSegments();\n this._compute(this.paintInfo, params);\n this.x = this.paintInfo.points[0];\n this.y = this.paintInfo.points[1];\n this.w = this.paintInfo.points[2];\n this.h = this.paintInfo.points[3];\n this.segment = this.paintInfo.segment;\n this._updateSegmentProportions();\n }\n }, {\n key: "setAnchorOrientation",\n value: function setAnchorOrientation(idx, orientation) {}\n }]);\n return AbstractConnector;\n}();\n\nvar DEFAULT_WIDTH = 20;\nvar DEFAULT_LENGTH = 20;\nvar ArrowOverlay = function (_Overlay) {\n _inherits(ArrowOverlay, _Overlay);\n var _super = _createSuper(ArrowOverlay);\n function ArrowOverlay(instance, component, p) {\n var _this;\n _classCallCheck(this, ArrowOverlay);\n _this = _super.call(this, instance, component, p);\n _this.instance = instance;\n _this.component = component;\n _defineProperty(_assertThisInitialized(_this), "width", void 0);\n _defineProperty(_assertThisInitialized(_this), "length", void 0);\n _defineProperty(_assertThisInitialized(_this), "foldback", void 0);\n _defineProperty(_assertThisInitialized(_this), "direction", void 0);\n _defineProperty(_assertThisInitialized(_this), "location", 0.5);\n _defineProperty(_assertThisInitialized(_this), "paintStyle", void 0);\n _defineProperty(_assertThisInitialized(_this), "type", ArrowOverlay.type);\n _defineProperty(_assertThisInitialized(_this), "cachedDimensions", void 0);\n p = p || {};\n _this.width = p.width || DEFAULT_WIDTH;\n _this.length = p.length || DEFAULT_LENGTH;\n _this.direction = (p.direction || 1) < 0 ? -1 : 1;\n _this.foldback = p.foldback || 0.623;\n _this.paintStyle = p.paintStyle || {\n "strokeWidth": 1\n };\n _this.location = p.location == null ? _this.location : Array.isArray(p.location) ? p.location[0] : p.location;\n return _this;\n }\n _createClass(ArrowOverlay, [{\n key: "draw",\n value: function draw(component, currentConnectionPaintStyle, absolutePosition) {\n if (component instanceof AbstractConnector) {\n var connector = component;\n var hxy, mid, txy, tail, cxy;\n if (this.location > 1 || this.location < 0) {\n var fromLoc = this.location < 0 ? 1 : 0;\n hxy = connector.pointAlongPathFrom(fromLoc, this.location, false);\n mid = connector.pointAlongPathFrom(fromLoc, this.location - this.direction * this.length / 2, false);\n txy = pointOnLine(hxy, mid, this.length);\n } else if (this.location === 1) {\n hxy = connector.pointOnPath(this.location);\n mid = connector.pointAlongPathFrom(this.location, -this.length);\n txy = pointOnLine(hxy, mid, this.length);\n if (this.direction === -1) {\n var _ = txy;\n txy = hxy;\n hxy = _;\n }\n } else if (this.location === 0) {\n txy = connector.pointOnPath(this.location);\n mid = connector.pointAlongPathFrom(this.location, this.length);\n hxy = pointOnLine(txy, mid, this.length);\n if (this.direction === -1) {\n var __ = txy;\n txy = hxy;\n hxy = __;\n }\n } else {\n hxy = connector.pointAlongPathFrom(this.location, this.direction * this.length / 2);\n mid = connector.pointOnPath(this.location);\n txy = pointOnLine(hxy, mid, this.length);\n }\n tail = perpendicularLineTo(hxy, txy, this.width);\n cxy = pointOnLine(hxy, txy, this.foldback * this.length);\n var d = {\n hxy: hxy,\n tail: tail,\n cxy: cxy\n },\n stroke = this.paintStyle.stroke || currentConnectionPaintStyle.stroke,\n fill = this.paintStyle.fill || currentConnectionPaintStyle.stroke,\n lineWidth = this.paintStyle.strokeWidth || currentConnectionPaintStyle.strokeWidth;\n return {\n component: component,\n d: d,\n "stroke-width": lineWidth,\n stroke: stroke,\n fill: fill,\n xmin: Math.min(hxy.x, tail[0].x, tail[1].x),\n xmax: Math.max(hxy.x, tail[0].x, tail[1].x),\n ymin: Math.min(hxy.y, tail[0].y, tail[1].y),\n ymax: Math.max(hxy.y, tail[0].y, tail[1].y)\n };\n }\n }\n }, {\n key: "updateFrom",\n value: function updateFrom(d) {}\n }]);\n return ArrowOverlay;\n}(Overlay);\n_defineProperty(ArrowOverlay, "type", "Arrow");\nfunction isArrowOverlay(o) {\n return o.type === ArrowOverlay.type;\n}\nOverlayFactory.register(ArrowOverlay.type, ArrowOverlay);\n\nvar DiamondOverlay = function (_ArrowOverlay) {\n _inherits(DiamondOverlay, _ArrowOverlay);\n var _super = _createSuper(DiamondOverlay);\n function DiamondOverlay(instance, component, p) {\n var _this;\n _classCallCheck(this, DiamondOverlay);\n _this = _super.call(this, instance, component, p);\n _this.instance = instance;\n _defineProperty(_assertThisInitialized(_this), "type", DiamondOverlay.type);\n _this.length = _this.length / 2;\n _this.foldback = 2;\n return _this;\n }\n return DiamondOverlay;\n}(ArrowOverlay);\n_defineProperty(DiamondOverlay, "type", "Diamond");\nfunction isDiamondOverlay(o) {\n return o.type === DiamondOverlay.type;\n}\nOverlayFactory.register(DiamondOverlay.type, DiamondOverlay);\n\nvar PlainArrowOverlay = function (_ArrowOverlay) {\n _inherits(PlainArrowOverlay, _ArrowOverlay);\n var _super = _createSuper(PlainArrowOverlay);\n function PlainArrowOverlay(instance, component, p) {\n var _this;\n _classCallCheck(this, PlainArrowOverlay);\n _this = _super.call(this, instance, component, p);\n _this.instance = instance;\n _defineProperty(_assertThisInitialized(_this), "type", PlainArrowOverlay.type);\n _this.foldback = 1;\n return _this;\n }\n return PlainArrowOverlay;\n}(ArrowOverlay);\n_defineProperty(PlainArrowOverlay, "type", "PlainArrow");\nfunction isPlainArrowOverlay(o) {\n return o.type === PlainArrowOverlay.type;\n}\nOverlayFactory.register("PlainArrow", PlainArrowOverlay);\n\nvar CustomOverlay = function (_Overlay) {\n _inherits(CustomOverlay, _Overlay);\n var _super = _createSuper(CustomOverlay);\n function CustomOverlay(instance, component, p) {\n var _this;\n _classCallCheck(this, CustomOverlay);\n _this = _super.call(this, instance, component, p);\n _this.instance = instance;\n _this.component = component;\n _defineProperty(_assertThisInitialized(_this), "create", void 0);\n _defineProperty(_assertThisInitialized(_this), "type", CustomOverlay.type);\n _this.create = p.create;\n return _this;\n }\n _createClass(CustomOverlay, [{\n key: "updateFrom",\n value: function updateFrom(d) {}\n }]);\n return CustomOverlay;\n}(Overlay);\n_defineProperty(CustomOverlay, "type", "Custom");\nfunction isCustomOverlay(o) {\n return o.type === CustomOverlay.type;\n}\nOverlayFactory.register(CustomOverlay.type, CustomOverlay);\n\nvar DEFAULT_KEY_ALLOW_NESTED_GROUPS = "allowNestedGroups";\nvar DEFAULT_KEY_ANCHOR = "anchor";\nvar DEFAULT_KEY_ANCHORS = "anchors";\nvar DEFAULT_KEY_CONNECTION_OVERLAYS = "connectionOverlays";\nvar DEFAULT_KEY_CONNECTIONS_DETACHABLE = "connectionsDetachable";\nvar DEFAULT_KEY_CONNECTOR = "connector";\nvar DEFAULT_KEY_CONTAINER = "container";\nvar DEFAULT_KEY_ENDPOINT = "endpoint";\nvar DEFAULT_KEY_ENDPOINT_OVERLAYS = "endpointOverlays";\nvar DEFAULT_KEY_ENDPOINTS = "endpoints";\nvar DEFAULT_KEY_ENDPOINT_STYLE = "endpointStyle";\nvar DEFAULT_KEY_ENDPOINT_STYLES = "endpointStyles";\nvar DEFAULT_KEY_ENDPOINT_HOVER_STYLE = "endpointHoverStyle";\nvar DEFAULT_KEY_ENDPOINT_HOVER_STYLES = "endpointHoverStyles";\nvar DEFAULT_KEY_HOVER_CLASS = "hoverClass";\nvar DEFAULT_KEY_HOVER_PAINT_STYLE = "hoverPaintStyle";\nvar DEFAULT_KEY_LIST_STYLE = "listStyle";\nvar DEFAULT_KEY_MAX_CONNECTIONS = "maxConnections";\nvar DEFAULT_KEY_PAINT_STYLE = "paintStyle";\nvar DEFAULT_KEY_REATTACH_CONNECTIONS = "reattachConnections";\nvar DEFAULT_KEY_SCOPE = "scope";\n\nvar DotEndpoint = function (_EndpointRepresentati) {\n _inherits(DotEndpoint, _EndpointRepresentati);\n var _super = _createSuper(DotEndpoint);\n function DotEndpoint(endpoint, params) {\n var _this;\n _classCallCheck(this, DotEndpoint);\n _this = _super.call(this, endpoint, params);\n _defineProperty(_assertThisInitialized(_this), "radius", void 0);\n _defineProperty(_assertThisInitialized(_this), "defaultOffset", void 0);\n _defineProperty(_assertThisInitialized(_this), "defaultInnerRadius", void 0);\n _defineProperty(_assertThisInitialized(_this), "type", DotEndpoint.type);\n params = params || {};\n _this.radius = params.radius || 5;\n _this.defaultOffset = 0.5 * _this.radius;\n _this.defaultInnerRadius = _this.radius / 3;\n return _this;\n }\n return DotEndpoint;\n}(EndpointRepresentation);\n_defineProperty(DotEndpoint, "type", "Dot");\nvar DotEndpointHandler = {\n type: DotEndpoint.type,\n cls: DotEndpoint,\n compute: function compute(ep, anchorPoint, orientation, endpointStyle) {\n var x = anchorPoint.curX - ep.radius,\n y = anchorPoint.curY - ep.radius,\n w = ep.radius * 2,\n h = ep.radius * 2;\n if (endpointStyle && endpointStyle.stroke) {\n var lw = endpointStyle.strokeWidth || 1;\n x -= lw;\n y -= lw;\n w += lw * 2;\n h += lw * 2;\n }\n ep.x = x;\n ep.y = y;\n ep.w = w;\n ep.h = h;\n return [x, y, w, h, ep.radius];\n },\n getParams: function getParams(ep) {\n return {\n radius: ep.radius\n };\n }\n};\n\nvar UINode = function UINode(instance, el) {\n _classCallCheck(this, UINode);\n this.instance = instance;\n this.el = el;\n _defineProperty(this, "group", void 0);\n};\nvar UIGroup = function (_UINode) {\n _inherits(UIGroup, _UINode);\n var _super = _createSuper(UIGroup);\n function UIGroup(instance, el, options) {\n var _this;\n _classCallCheck(this, UIGroup);\n _this = _super.call(this, instance, el);\n _this.instance = instance;\n _defineProperty(_assertThisInitialized(_this), "children", []);\n _defineProperty(_assertThisInitialized(_this), "collapsed", false);\n _defineProperty(_assertThisInitialized(_this), "droppable", void 0);\n _defineProperty(_assertThisInitialized(_this), "enabled", void 0);\n _defineProperty(_assertThisInitialized(_this), "orphan", void 0);\n _defineProperty(_assertThisInitialized(_this), "constrain", void 0);\n _defineProperty(_assertThisInitialized(_this), "proxied", void 0);\n _defineProperty(_assertThisInitialized(_this), "ghost", void 0);\n _defineProperty(_assertThisInitialized(_this), "revert", void 0);\n _defineProperty(_assertThisInitialized(_this), "prune", void 0);\n _defineProperty(_assertThisInitialized(_this), "dropOverride", void 0);\n _defineProperty(_assertThisInitialized(_this), "anchor", void 0);\n _defineProperty(_assertThisInitialized(_this), "endpoint", void 0);\n _defineProperty(_assertThisInitialized(_this), "connections", {\n source: [],\n target: [],\n internal: []\n });\n _defineProperty(_assertThisInitialized(_this), "manager", void 0);\n _defineProperty(_assertThisInitialized(_this), "id", void 0);\n _defineProperty(_assertThisInitialized(_this), "elId", void 0);\n var jel = _this.el;\n jel._isJsPlumbGroup = true;\n jel._jsPlumbGroup = _assertThisInitialized(_this);\n _this.elId = instance.getId(el);\n _this.orphan = options.orphan === true;\n _this.revert = _this.orphan === true ? false : options.revert !== false;\n _this.droppable = options.droppable !== false;\n _this.ghost = options.ghost === true;\n _this.enabled = options.enabled !== false;\n _this.prune = _this.orphan !== true && options.prune === true;\n _this.constrain = _this.ghost || options.constrain === true;\n _this.proxied = options.proxied !== false;\n _this.id = options.id || uuid();\n _this.dropOverride = options.dropOverride === true;\n _this.anchor = options.anchor;\n _this.endpoint = options.endpoint;\n _this.anchor = options.anchor;\n instance.setAttribute(el, ATTRIBUTE_GROUP, "");\n return _this;\n }\n _createClass(UIGroup, [{\n key: "contentArea",\n get: function get() {\n return this.instance.getGroupContentArea(this);\n }\n }, {\n key: "overrideDrop",\n value: function overrideDrop(el, targetGroup) {\n return this.dropOverride && (this.revert || this.prune || this.orphan);\n }\n }, {\n key: "getAnchor",\n value: function getAnchor(conn, endpointIndex) {\n return this.anchor || "Continuous";\n }\n }, {\n key: "getEndpoint",\n value: function getEndpoint(conn, endpointIndex) {\n return this.endpoint || {\n type: DotEndpoint.type,\n options: {\n radius: 10\n }\n };\n }\n }, {\n key: "add",\n value: function add(_el, doNotFireEvent) {\n var dragArea = this.instance.getGroupContentArea(this);\n var __el = _el;\n if (__el._jsPlumbParentGroup != null) {\n if (__el._jsPlumbParentGroup === this) {\n return;\n } else {\n __el._jsPlumbParentGroup.remove(_el, true, doNotFireEvent, false);\n }\n }\n __el._jsPlumbParentGroup = this;\n this.children.push(new UINode(this.instance, _el));\n this.instance._appendElement(__el, dragArea);\n this.manager._updateConnectionsForGroup(this);\n }\n }, {\n key: "resolveNode",\n value: function resolveNode(el) {\n return el == null ? null : getWithFunction(this.children, function (u) {\n return u.el === el;\n });\n }\n }, {\n key: "remove",\n value: function remove(el, manipulateDOM, doNotFireEvent, doNotUpdateConnections, targetGroup) {\n var uiNode = this.resolveNode(el);\n if (uiNode != null) {\n this._doRemove(uiNode, manipulateDOM, doNotFireEvent, doNotUpdateConnections, targetGroup);\n }\n }\n }, {\n key: "_doRemove",\n value: function _doRemove(child, manipulateDOM, doNotFireEvent, doNotUpdateConnections, targetGroup) {\n var __el = child.el;\n delete __el._jsPlumbParentGroup;\n removeWithFunction(this.children, function (e) {\n return e === child;\n });\n if (manipulateDOM) {\n try {\n this.instance.getGroupContentArea(this).removeChild(__el);\n } catch (e) {\n log("Could not remove element from Group " + e);\n }\n }\n if (!doNotFireEvent) {\n var p = {\n group: this,\n el: __el\n };\n if (targetGroup) {\n p.targetGroup = targetGroup;\n }\n this.instance.fire(EVENT_GROUP_MEMBER_REMOVED, p);\n }\n if (!doNotUpdateConnections) {\n this.manager._updateConnectionsForGroup(this);\n }\n }\n }, {\n key: "removeAll",\n value: function removeAll(manipulateDOM, doNotFireEvent) {\n for (var i = 0, l = this.children.length; i < l; i++) {\n var child = this.children[0];\n this._doRemove(child, manipulateDOM, doNotFireEvent, true);\n this.instance.unmanage(child.el, true);\n }\n this.children.length = 0;\n this.manager._updateConnectionsForGroup(this);\n }\n }, {\n key: "orphanAll",\n value: function orphanAll() {\n var orphanedPositions = {};\n for (var i = 0; i < this.children.length; i++) {\n var newPosition = this.manager.orphan(this.children[i].el, false);\n orphanedPositions[newPosition.id] = newPosition.pos;\n }\n this.children.length = 0;\n return orphanedPositions;\n }\n }, {\n key: "addGroup",\n value: function addGroup(group) {\n if (this.instance.allowNestedGroups && group !== this) {\n if (this.instance.groupManager.isAncestor(this, group)) {\n return false;\n }\n if (group.group != null) {\n group.group.removeGroup(group);\n }\n var groupElId = this.instance.getId(group.el);\n var entry = this.instance.getManagedElements()[groupElId];\n entry.group = this.elId;\n var elpos = this.instance.getOffsetRelativeToRoot(group.el);\n var cpos = this.collapsed ? this.instance.getOffsetRelativeToRoot(this.el) : this.instance.getOffsetRelativeToRoot(this.instance.getGroupContentArea(this));\n group.el._jsPlumbParentGroup = this;\n this.children.push(group);\n this.instance._appendElementToGroup(this, group.el);\n group.group = this;\n var newPosition = {\n x: elpos.x - cpos.x,\n y: elpos.y - cpos.y\n };\n this.instance.setPosition(group.el, newPosition);\n this.instance.fire(EVENT_NESTED_GROUP_ADDED, {\n parent: this,\n child: group\n });\n return true;\n } else {\n return false;\n }\n }\n }, {\n key: "removeGroup",\n value: function removeGroup(group) {\n if (group.group === this) {\n var jel = group.el;\n var d = this.instance.getGroupContentArea(this);\n if (d === jel.parentNode) {\n d.removeChild(group.el);\n }\n var groupElId = this.instance.getId(group.el);\n var entry = this.instance.getManagedElements()[groupElId];\n if (entry) {\n delete entry.group;\n }\n this.children = this.children.filter(function (cg) {\n return cg.id !== group.id;\n });\n delete group.group;\n delete jel._jsPlumbParentGroup;\n this.instance.fire(EVENT_NESTED_GROUP_REMOVED, {\n parent: this,\n child: group\n });\n }\n }\n }, {\n key: "getGroups",\n value: function getGroups() {\n return this.children.filter(function (cg) {\n return cg.constructor === UIGroup;\n });\n }\n }, {\n key: "getNodes",\n value: function getNodes() {\n return this.children.filter(function (cg) {\n return cg.constructor === UINode;\n });\n }\n }, {\n key: "collapseParent",\n get: function get() {\n var cg = null;\n if (this.group == null) {\n return null;\n } else {\n var g = this.group;\n while (g != null) {\n if (g.collapsed) {\n cg = g;\n }\n g = g.group;\n }\n return cg;\n }\n }\n }]);\n return UIGroup;\n}(UINode);\n\nvar GroupManager = function () {\n function GroupManager(instance) {\n var _this = this;\n _classCallCheck(this, GroupManager);\n this.instance = instance;\n _defineProperty(this, "groupMap", {});\n _defineProperty(this, "_connectionSourceMap", {});\n _defineProperty(this, "_connectionTargetMap", {});\n instance.bind(EVENT_INTERNAL_CONNECTION, function (p) {\n var sourceGroup = _this.getGroupFor(p.source);\n var targetGroup = _this.getGroupFor(p.target);\n if (sourceGroup != null && targetGroup != null && sourceGroup === targetGroup) {\n _this._connectionSourceMap[p.connection.id] = sourceGroup;\n _this._connectionTargetMap[p.connection.id] = sourceGroup;\n suggest(sourceGroup.connections.internal, p.connection);\n } else {\n if (sourceGroup != null) {\n if (p.target._jsPlumbGroup === sourceGroup) {\n suggest(sourceGroup.connections.internal, p.connection);\n } else {\n suggest(sourceGroup.connections.source, p.connection);\n }\n _this._connectionSourceMap[p.connection.id] = sourceGroup;\n }\n if (targetGroup != null) {\n if (p.source._jsPlumbGroup === targetGroup) {\n suggest(targetGroup.connections.internal, p.connection);\n } else {\n suggest(targetGroup.connections.target, p.connection);\n }\n _this._connectionTargetMap[p.connection.id] = targetGroup;\n }\n }\n });\n instance.bind(EVENT_INTERNAL_CONNECTION_DETACHED, function (p) {\n _this._cleanupDetachedConnection(p.connection);\n });\n instance.bind(EVENT_CONNECTION_MOVED, function (p) {\n var originalElement = p.originalEndpoint.element,\n originalGroup = _this.getGroupFor(originalElement),\n newEndpoint = p.connection.endpoints[p.index],\n newElement = newEndpoint.element,\n newGroup = _this.getGroupFor(newElement),\n connMap = p.index === 0 ? _this._connectionSourceMap : _this._connectionTargetMap,\n otherConnMap = p.index === 0 ? _this._connectionTargetMap : _this._connectionSourceMap;\n if (newGroup != null) {\n connMap[p.connection.id] = newGroup;\n if (p.connection.source === p.connection.target) {\n otherConnMap[p.connection.id] = newGroup;\n }\n } else {\n delete connMap[p.connection.id];\n if (p.connection.source === p.connection.target) {\n delete otherConnMap[p.connection.id];\n }\n }\n if (originalGroup != null) {\n _this._updateConnectionsForGroup(originalGroup);\n }\n if (newGroup != null) {\n _this._updateConnectionsForGroup(newGroup);\n }\n });\n }\n _createClass(GroupManager, [{\n key: "_cleanupDetachedConnection",\n value: function _cleanupDetachedConnection(conn) {\n conn.proxies.length = 0;\n var group = this._connectionSourceMap[conn.id],\n f;\n if (group != null) {\n f = function f(c) {\n return c.id === conn.id;\n };\n removeWithFunction(group.connections.source, f);\n removeWithFunction(group.connections.target, f);\n removeWithFunction(group.connections.internal, f);\n delete this._connectionSourceMap[conn.id];\n }\n group = this._connectionTargetMap[conn.id];\n if (group != null) {\n f = function f(c) {\n return c.id === conn.id;\n };\n removeWithFunction(group.connections.source, f);\n removeWithFunction(group.connections.target, f);\n removeWithFunction(group.connections.internal, f);\n delete this._connectionTargetMap[conn.id];\n }\n }\n }, {\n key: "addGroup",\n value: function addGroup(params) {\n var jel = params.el;\n if (this.groupMap[params.id] != null) {\n throw new Error("cannot create Group [" + params.id + "]; a Group with that ID exists");\n }\n if (jel._isJsPlumbGroup != null) {\n throw new Error("cannot create Group [" + params.id + "]; the given element is already a Group");\n }\n var group = new UIGroup(this.instance, params.el, params);\n this.groupMap[group.id] = group;\n if (params.collapsed) {\n this.collapseGroup(group);\n }\n this.instance.manage(group.el);\n this.instance.addClass(group.el, CLASS_GROUP_EXPANDED);\n group.manager = this;\n this._updateConnectionsForGroup(group);\n this.instance.fire(EVENT_GROUP_ADDED, {\n group: group\n });\n return group;\n }\n }, {\n key: "getGroup",\n value: function getGroup(groupId) {\n var group = groupId;\n if (isString(groupId)) {\n group = this.groupMap[groupId];\n if (group == null) {\n throw new Error("No such group [" + groupId + "]");\n }\n }\n return group;\n }\n }, {\n key: "getGroupFor",\n value: function getGroupFor(el) {\n var jel = el;\n var c = this.instance.getContainer();\n var abort = false,\n g = null;\n while (!abort) {\n if (jel == null || jel === c) {\n abort = true;\n } else {\n if (jel._jsPlumbParentGroup) {\n g = jel._jsPlumbParentGroup;\n abort = true;\n } else {\n jel = jel.parentNode;\n }\n }\n }\n return g;\n }\n }, {\n key: "getGroups",\n value: function getGroups() {\n var g = [];\n for (var key in this.groupMap) {\n g.push(this.groupMap[key]);\n }\n return g;\n }\n }, {\n key: "removeGroup",\n value: function removeGroup(group, deleteMembers, manipulateView, doNotFireEvent) {\n var _this2 = this;\n var actualGroup = this.getGroup(group);\n this.expandGroup(actualGroup, true);\n var newPositions = {};\n forEach(actualGroup.children, function (uiNode) {\n var entry = _this2.instance.getManagedElements()[_this2.instance.getId(uiNode.el)];\n if (entry) {\n delete entry.group;\n }\n });\n if (deleteMembers) {\n forEach(actualGroup.getGroups(), function (cg) {\n return _this2.removeGroup(cg, deleteMembers, manipulateView);\n });\n actualGroup.removeAll(manipulateView, doNotFireEvent);\n } else {\n if (actualGroup.group) {\n forEach(actualGroup.children, function (c) {\n return actualGroup.group.add(c.el);\n });\n }\n newPositions = actualGroup.orphanAll();\n }\n if (actualGroup.group) {\n actualGroup.group.removeGroup(actualGroup);\n }\n this.instance.unmanage(actualGroup.el, true);\n delete this.groupMap[actualGroup.id];\n this.instance.fire(EVENT_GROUP_REMOVED, {\n group: actualGroup\n });\n return newPositions;\n }\n }, {\n key: "removeAllGroups",\n value: function removeAllGroups(deleteMembers, manipulateView, doNotFireEvent) {\n for (var _g in this.groupMap) {\n this.removeGroup(this.groupMap[_g], deleteMembers, manipulateView, doNotFireEvent);\n }\n }\n }, {\n key: "forEach",\n value: function forEach(f) {\n for (var key in this.groupMap) {\n f(this.groupMap[key]);\n }\n }\n }, {\n key: "orphan",\n value: function orphan(el, doNotTransferToAncestor) {\n var jel = el;\n if (jel._jsPlumbParentGroup) {\n var currentParent = jel._jsPlumbParentGroup;\n var id = this.instance.getId(jel);\n var pos = this.instance.getOffset(el);\n if (doNotTransferToAncestor !== true && currentParent.group) {\n this.instance._appendElementToGroup(currentParent.group, el);\n } else {\n this.instance._appendElementToContainer(el);\n }\n this.instance.setPosition(el, pos);\n delete jel._jsPlumbParentGroup;\n return {\n id: id,\n pos: pos\n };\n }\n }\n }, {\n key: "_updateConnectionsForGroup",\n value: function _updateConnectionsForGroup(group) {\n var _this3 = this;\n group.connections.source.length = 0;\n group.connections.target.length = 0;\n group.connections.internal.length = 0;\n var members = group.children.slice().map(function (cn) {\n return cn.el;\n });\n var childMembers = [];\n forEach(members, function (member) {\n Array.prototype.push.apply(childMembers, _this3.instance.getSelector(member, SELECTOR_MANAGED_ELEMENT));\n });\n Array.prototype.push.apply(members, childMembers);\n if (members.length > 0) {\n var c1 = this.instance.getConnections({\n source: members,\n scope: WILDCARD\n }, true);\n var c2 = this.instance.getConnections({\n target: members,\n scope: WILDCARD\n }, true);\n var processed = {};\n var gs, gt;\n var oneSet = function oneSet(c) {\n for (var i = 0; i < c.length; i++) {\n if (processed[c[i].id]) {\n continue;\n }\n processed[c[i].id] = true;\n gs = _this3.getGroupFor(c[i].source);\n gt = _this3.getGroupFor(c[i].target);\n if (c[i].source === group.el && gt === group || c[i].target === group.el && gs === group) {\n group.connections.internal.push(c[i]);\n } else if (gs === group) {\n if (gt !== group) {\n group.connections.source.push(c[i]);\n } else {\n group.connections.internal.push(c[i]);\n }\n _this3._connectionSourceMap[c[i].id] = group;\n } else if (gt === group) {\n group.connections.target.push(c[i]);\n _this3._connectionTargetMap[c[i].id] = group;\n }\n }\n };\n oneSet(c1);\n oneSet(c2);\n }\n }\n }, {\n key: "_collapseConnection",\n value: function _collapseConnection(conn, index, group) {\n var otherEl = conn.endpoints[index === 0 ? 1 : 0].element;\n if (otherEl._jsPlumbParentGroup && !otherEl._jsPlumbParentGroup.proxied && otherEl._jsPlumbParentGroup.collapsed) {\n return false;\n }\n var es = conn.endpoints[0].element,\n esg = es._jsPlumbParentGroup,\n esgcp = esg != null ? esg.collapseParent || esg : null,\n et = conn.endpoints[1].element,\n etg = et._jsPlumbParentGroup,\n etgcp = etg != null ? etg.collapseParent || etg : null;\n if (esgcp == null || etgcp == null || esgcp.id !== etgcp.id) {\n var groupEl = group.el;\n this.instance.getId(groupEl);\n this.instance.proxyConnection(conn, index, groupEl,\n function (conn, index) {\n return group.getEndpoint(conn, index);\n }, function (conn, index) {\n return group.getAnchor(conn, index);\n });\n return true;\n } else {\n return false;\n }\n }\n }, {\n key: "_expandConnection",\n value: function _expandConnection(c, index, group) {\n this.instance.unproxyConnection(c, index);\n }\n }, {\n key: "isElementDescendant",\n value: function isElementDescendant(el, parentEl) {\n var c = this.instance.getContainer();\n var abort = false;\n while (!abort) {\n if (el == null || el === c) {\n return false;\n } else {\n if (el === parentEl) {\n return true;\n } else {\n el = el.parentNode;\n }\n }\n }\n }\n }, {\n key: "collapseGroup",\n value: function collapseGroup(group) {\n var _this4 = this;\n var actualGroup = this.getGroup(group);\n if (actualGroup == null || actualGroup.collapsed) {\n return;\n }\n var groupEl = actualGroup.el;\n if (actualGroup.collapseParent == null) {\n this.instance.setGroupVisible(actualGroup, false);\n actualGroup.collapsed = true;\n this.instance.removeClass(groupEl, CLASS_GROUP_EXPANDED);\n this.instance.addClass(groupEl, CLASS_GROUP_COLLAPSED);\n if (actualGroup.proxied) {\n var collapsedConnectionIds = new Set();\n var _collapseSet = function _collapseSet(conns, index) {\n for (var i = 0; i < conns.length; i++) {\n var c = conns[i];\n if (_this4._collapseConnection(c, index, actualGroup) === true) {\n collapsedConnectionIds.add(c.id);\n }\n }\n };\n _collapseSet(actualGroup.connections.source, 0);\n _collapseSet(actualGroup.connections.target, 1);\n forEach(actualGroup.getGroups(), function (cg) {\n _this4.cascadeCollapse(actualGroup, cg, collapsedConnectionIds);\n });\n }\n this.instance.revalidate(groupEl);\n this.repaintGroup(actualGroup);\n this.instance.fire(EVENT_GROUP_COLLAPSE, {\n group: actualGroup\n });\n } else {\n actualGroup.collapsed = true;\n this.instance.removeClass(groupEl, CLASS_GROUP_EXPANDED);\n this.instance.addClass(groupEl, CLASS_GROUP_COLLAPSED);\n }\n }\n }, {\n key: "cascadeCollapse",\n value: function cascadeCollapse(collapsedGroup, targetGroup, collapsedIds) {\n var _this5 = this;\n if (collapsedGroup.proxied) {\n var _collapseSet = function _collapseSet(conns, index) {\n for (var i = 0; i < conns.length; i++) {\n var c = conns[i];\n if (!collapsedIds.has(c.id)) {\n if (_this5._collapseConnection(c, index, collapsedGroup) === true) {\n collapsedIds.add(c.id);\n }\n }\n }\n };\n _collapseSet(targetGroup.connections.source, 0);\n _collapseSet(targetGroup.connections.target, 1);\n }\n forEach(targetGroup.getGroups(), function (cg) {\n _this5.cascadeCollapse(collapsedGroup, cg, collapsedIds);\n });\n }\n }, {\n key: "expandGroup",\n value: function expandGroup(group, doNotFireEvent) {\n var _this6 = this;\n var actualGroup = this.getGroup(group);\n if (actualGroup == null) {\n return;\n }\n var groupEl = actualGroup.el;\n if (actualGroup.collapseParent == null) {\n this.instance.setGroupVisible(actualGroup, true);\n actualGroup.collapsed = false;\n this.instance.addClass(groupEl, CLASS_GROUP_EXPANDED);\n this.instance.removeClass(groupEl, CLASS_GROUP_COLLAPSED);\n if (actualGroup.proxied) {\n var _expandSet = function _expandSet(conns, index) {\n for (var i = 0; i < conns.length; i++) {\n var c = conns[i];\n _this6._expandConnection(c, index, actualGroup);\n }\n };\n _expandSet(actualGroup.connections.source, 0);\n _expandSet(actualGroup.connections.target, 1);\n var _expandNestedGroup = function _expandNestedGroup(group, ignoreCollapsedStateForNested) {\n if (ignoreCollapsedStateForNested || group.collapsed) {\n var _collapseSet = function _collapseSet(conns, index) {\n for (var i = 0; i < conns.length; i++) {\n var c = conns[i];\n _this6._collapseConnection(c, index, group.collapseParent || group);\n }\n };\n _collapseSet(group.connections.source, 0);\n _collapseSet(group.connections.target, 1);\n forEach(group.connections.internal, function (c) {\n return c.setVisible(false);\n });\n forEach(group.getGroups(), function (g) {\n return _expandNestedGroup(g, true);\n });\n } else {\n _this6.expandGroup(group, true);\n }\n };\n forEach(actualGroup.getGroups(), _expandNestedGroup);\n }\n this.instance.revalidate(groupEl);\n this.repaintGroup(actualGroup);\n if (!doNotFireEvent) {\n this.instance.fire(EVENT_GROUP_EXPAND, {\n group: actualGroup\n });\n }\n } else {\n actualGroup.collapsed = false;\n this.instance.addClass(groupEl, CLASS_GROUP_EXPANDED);\n this.instance.removeClass(groupEl, CLASS_GROUP_COLLAPSED);\n }\n }\n }, {\n key: "toggleGroup",\n value: function toggleGroup(group) {\n group = this.getGroup(group);\n if (group != null) {\n if (group.collapsed) {\n this.expandGroup(group);\n } else {\n this.collapseGroup(group);\n }\n }\n }\n }, {\n key: "repaintGroup",\n value: function repaintGroup(group) {\n var actualGroup = this.getGroup(group);\n var m = actualGroup.children;\n for (var i = 0; i < m.length; i++) {\n this.instance.revalidate(m[i].el);\n }\n }\n }, {\n key: "addToGroup",\n value: function addToGroup(group, doNotFireEvent) {\n var _this7 = this;\n var actualGroup = this.getGroup(group);\n if (actualGroup) {\n var groupEl = actualGroup.el;\n var _one = function _one(el) {\n var jel = el;\n var isGroup = jel._isJsPlumbGroup != null,\n droppingGroup = jel._jsPlumbGroup;\n var currentGroup = jel._jsPlumbParentGroup;\n if (currentGroup !== actualGroup) {\n var entry = _this7.instance.manage(el);\n var elpos = _this7.instance.getOffset(el);\n var cpos = actualGroup.collapsed ? _this7.instance.getOffsetRelativeToRoot(groupEl) : _this7.instance.getOffset(_this7.instance.getGroupContentArea(actualGroup));\n entry.group = actualGroup.elId;\n if (currentGroup != null) {\n currentGroup.remove(el, false, doNotFireEvent, false, actualGroup);\n _this7._updateConnectionsForGroup(currentGroup);\n }\n if (isGroup) {\n actualGroup.addGroup(droppingGroup);\n } else {\n actualGroup.add(el, doNotFireEvent);\n }\n var handleDroppedConnections = function handleDroppedConnections(list, index) {\n var oidx = index === 0 ? 1 : 0;\n list.each(function (c) {\n c.setVisible(false);\n if (c.endpoints[oidx].element._jsPlumbGroup === actualGroup) {\n c.endpoints[oidx].setVisible(false);\n _this7._expandConnection(c, oidx, actualGroup);\n } else {\n c.endpoints[index].setVisible(false);\n _this7._collapseConnection(c, index, actualGroup);\n }\n });\n };\n if (actualGroup.collapsed) {\n handleDroppedConnections(_this7.instance.select({\n source: el\n }), 0);\n handleDroppedConnections(_this7.instance.select({\n target: el\n }), 1);\n }\n _this7.instance.getId(el);\n var newPosition = {\n x: elpos.x - cpos.x,\n y: elpos.y - cpos.y\n };\n _this7.instance.setPosition(el, newPosition);\n _this7._updateConnectionsForGroup(actualGroup);\n _this7.instance.revalidate(el);\n if (!doNotFireEvent) {\n var p = {\n group: actualGroup,\n el: el,\n pos: newPosition\n };\n if (currentGroup) {\n p.sourceGroup = currentGroup;\n }\n _this7.instance.fire(EVENT_GROUP_MEMBER_ADDED, p);\n }\n }\n };\n for (var _len = arguments.length, el = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n el[_key - 2] = arguments[_key];\n }\n forEach(el, _one);\n }\n }\n }, {\n key: "removeFromGroup",\n value: function removeFromGroup(group, doNotFireEvent) {\n var _this8 = this;\n var actualGroup = this.getGroup(group);\n if (actualGroup) {\n var _one = function _one(_el) {\n if (actualGroup.collapsed) {\n var _expandSet = function _expandSet(conns, index) {\n for (var i = 0; i < conns.length; i++) {\n var c = conns[i];\n if (c.proxies) {\n for (var j = 0; j < c.proxies.length; j++) {\n if (c.proxies[j] != null) {\n var proxiedElement = c.proxies[j].originalEp.element;\n if (proxiedElement === _el || _this8.isElementDescendant(proxiedElement, _el)) {\n _this8._expandConnection(c, index, actualGroup);\n }\n }\n }\n }\n }\n };\n _expandSet(actualGroup.connections.source.slice(), 0);\n _expandSet(actualGroup.connections.target.slice(), 1);\n }\n actualGroup.remove(_el, null, doNotFireEvent);\n var entry = _this8.instance.getManagedElements()[_this8.instance.getId(_el)];\n if (entry) {\n delete entry.group;\n }\n };\n for (var _len2 = arguments.length, el = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n el[_key2 - 2] = arguments[_key2];\n }\n forEach(el, _one);\n }\n }\n }, {\n key: "getAncestors",\n value: function getAncestors(group) {\n var ancestors = [];\n var p = group.group;\n while (p != null) {\n ancestors.push(p);\n p = p.group;\n }\n return ancestors;\n }\n }, {\n key: "isAncestor",\n value: function isAncestor(group, possibleAncestor) {\n if (group == null || possibleAncestor == null) {\n return false;\n }\n return this.getAncestors(group).indexOf(possibleAncestor) !== -1;\n }\n }, {\n key: "getDescendants",\n value: function getDescendants(group) {\n var d = [];\n var _one = function _one(g) {\n var childGroups = g.getGroups();\n d.push.apply(d, _toConsumableArray(childGroups));\n forEach(childGroups, _one);\n };\n _one(group);\n return d;\n }\n }, {\n key: "isDescendant",\n value: function isDescendant(possibleDescendant, ancestor) {\n if (possibleDescendant == null || ancestor == null) {\n return false;\n }\n return this.getDescendants(ancestor).indexOf(possibleDescendant) !== -1;\n }\n }, {\n key: "reset",\n value: function reset() {\n this._connectionSourceMap = {};\n this._connectionTargetMap = {};\n this.groupMap = {};\n }\n }]);\n return GroupManager;\n}();\n\nvar SelectionBase = function () {\n function SelectionBase(instance, entries) {\n _classCallCheck(this, SelectionBase);\n this.instance = instance;\n this.entries = entries;\n }\n _createClass(SelectionBase, [{\n key: "length",\n get: function get() {\n return this.entries.length;\n }\n }, {\n key: "each",\n value: function each(handler) {\n forEach(this.entries, function (e) {\n return handler(e);\n });\n return this;\n }\n }, {\n key: "get",\n value: function get(index) {\n return this.entries[index];\n }\n }, {\n key: "addClass",\n value: function addClass(clazz, cascade) {\n this.each(function (c) {\n return c.addClass(clazz, cascade);\n });\n return this;\n }\n }, {\n key: "removeClass",\n value: function removeClass(clazz, cascade) {\n this.each(function (c) {\n return c.removeClass(clazz, cascade);\n });\n return this;\n }\n }, {\n key: "removeAllOverlays",\n value: function removeAllOverlays() {\n this.each(function (c) {\n return c.removeAllOverlays();\n });\n return this;\n }\n }, {\n key: "setLabel",\n value: function setLabel(label) {\n this.each(function (c) {\n return c.setLabel(label);\n });\n return this;\n }\n }, {\n key: "clear",\n value: function clear() {\n this.entries.length = 0;\n return this;\n }\n }, {\n key: "map",\n value: function map(fn) {\n var a = [];\n this.each(function (e) {\n return a.push(fn(e));\n });\n return a;\n }\n }, {\n key: "addOverlay",\n value: function addOverlay(spec) {\n this.each(function (c) {\n return c.addOverlay(spec);\n });\n return this;\n }\n }, {\n key: "removeOverlay",\n value: function removeOverlay(id) {\n this.each(function (c) {\n return c.removeOverlay(id);\n });\n return this;\n }\n }, {\n key: "removeOverlays",\n value: function removeOverlays() {\n this.each(function (c) {\n return c.removeOverlays();\n });\n return this;\n }\n }, {\n key: "showOverlay",\n value: function showOverlay(id) {\n this.each(function (c) {\n return c.showOverlay(id);\n });\n return this;\n }\n }, {\n key: "hideOverlay",\n value: function hideOverlay(id) {\n this.each(function (c) {\n return c.hideOverlay(id);\n });\n return this;\n }\n }, {\n key: "setPaintStyle",\n value: function setPaintStyle(style) {\n this.each(function (c) {\n return c.setPaintStyle(style);\n });\n return this;\n }\n }, {\n key: "setHoverPaintStyle",\n value: function setHoverPaintStyle(style) {\n this.each(function (c) {\n return c.setHoverPaintStyle(style);\n });\n return this;\n }\n }, {\n key: "setSuspendEvents",\n value: function setSuspendEvents(suspend) {\n this.each(function (c) {\n return c.setSuspendEvents(suspend);\n });\n return this;\n }\n }, {\n key: "setParameter",\n value: function setParameter(name, value) {\n this.each(function (c) {\n return c.parameters[name] = value;\n });\n return this;\n }\n }, {\n key: "setParameters",\n value: function setParameters(p) {\n this.each(function (c) {\n return c.parameters = p;\n });\n return this;\n }\n }, {\n key: "setVisible",\n value: function setVisible(v) {\n this.each(function (c) {\n return c.setVisible(v);\n });\n return this;\n }\n }, {\n key: "addType",\n value: function addType(name) {\n this.each(function (c) {\n return c.addType(name);\n });\n return this;\n }\n }, {\n key: "toggleType",\n value: function toggleType(name) {\n this.each(function (c) {\n return c.toggleType(name);\n });\n return this;\n }\n }, {\n key: "removeType",\n value: function removeType(name) {\n this.each(function (c) {\n return c.removeType(name);\n });\n return this;\n }\n }, {\n key: "bind",\n value: function bind(evt, handler) {\n this.each(function (c) {\n return c.bind(evt, handler);\n });\n return this;\n }\n }, {\n key: "unbind",\n value: function unbind(evt, handler) {\n this.each(function (c) {\n return c.unbind(evt, handler);\n });\n return this;\n }\n }, {\n key: "setHover",\n value: function setHover(h) {\n var _this = this;\n this.each(function (c) {\n return _this.instance.setHover(c, h);\n });\n return this;\n }\n }]);\n return SelectionBase;\n}();\n\nvar EndpointSelection = function (_SelectionBase) {\n _inherits(EndpointSelection, _SelectionBase);\n var _super = _createSuper(EndpointSelection);\n function EndpointSelection() {\n _classCallCheck(this, EndpointSelection);\n return _super.apply(this, arguments);\n }\n _createClass(EndpointSelection, [{\n key: "setEnabled",\n value: function setEnabled(e) {\n this.each(function (ep) {\n return ep.enabled = e;\n });\n return this;\n }\n }, {\n key: "setAnchor",\n value: function setAnchor(a) {\n this.each(function (ep) {\n return ep.setAnchor(a);\n });\n return this;\n }\n }, {\n key: "deleteEveryConnection",\n value: function deleteEveryConnection() {\n this.each(function (ep) {\n return ep.deleteEveryConnection();\n });\n return this;\n }\n }, {\n key: "deleteAll",\n value: function deleteAll() {\n var _this = this;\n this.each(function (ep) {\n return _this.instance.deleteEndpoint(ep);\n });\n this.clear();\n return this;\n }\n }]);\n return EndpointSelection;\n}(SelectionBase);\n\nvar ConnectionSelection = function (_SelectionBase) {\n _inherits(ConnectionSelection, _SelectionBase);\n var _super = _createSuper(ConnectionSelection);\n function ConnectionSelection() {\n _classCallCheck(this, ConnectionSelection);\n return _super.apply(this, arguments);\n }\n _createClass(ConnectionSelection, [{\n key: "setDetachable",\n value: function setDetachable(d) {\n this.each(function (c) {\n return c.setDetachable(d);\n });\n return this;\n }\n }, {\n key: "setReattach",\n value: function setReattach(d) {\n this.each(function (c) {\n return c.setReattach(d);\n });\n return this;\n }\n }, {\n key: "setConnector",\n value: function setConnector(spec) {\n this.each(function (c) {\n return c._setConnector(spec);\n });\n return this;\n }\n }, {\n key: "deleteAll",\n value: function deleteAll() {\n var _this = this;\n this.each(function (c) {\n return _this.instance.deleteConnection(c);\n });\n this.clear();\n }\n }, {\n key: "repaint",\n value: function repaint() {\n var _this2 = this;\n this.each(function (c) {\n return _this2.instance._paintConnection(c);\n });\n return this;\n }\n }]);\n return ConnectionSelection;\n}(SelectionBase);\n\nvar Transaction = function Transaction() {\n _classCallCheck(this, Transaction);\n _defineProperty(this, "affectedElements", new Set());\n};\nfunction EMPTY_POSITION() {\n return {\n x: 0,\n y: 0,\n w: 0,\n h: 0,\n r: 0,\n c: {\n x: 0,\n y: 0\n },\n x2: 0,\n y2: 0,\n t: {\n x: 0,\n y: 0,\n c: {\n x: 0,\n y: 0\n },\n w: 0,\n h: 0,\n r: 0,\n x2: 0,\n y2: 0,\n cr: 0,\n sr: 0\n },\n dirty: true\n };\n}\nfunction rotate(x, y, w, h, r) {\n var center = {\n x: x + w / 2,\n y: y + h / 2\n },\n cr = Math.cos(r / 360 * Math.PI * 2),\n sr = Math.sin(r / 360 * Math.PI * 2),\n _point = function _point(x, y) {\n return {\n x: center.x + Math.round((x - center.x) * cr - (y - center.y) * sr),\n y: center.y + Math.round((y - center.y) * cr - (x - center.x) * sr)\n };\n };\n var p1 = _point(x, y),\n p2 = _point(x + w, y),\n p3 = _point(x + w, y + h),\n p4 = _point(x, y + h),\n c = _point(x + w / 2, y + h / 2);\n var xmin = Math.min(p1.x, p2.x, p3.x, p4.x),\n xmax = Math.max(p1.x, p2.x, p3.x, p4.x),\n ymin = Math.min(p1.y, p2.y, p3.y, p4.y),\n ymax = Math.max(p1.y, p2.y, p3.y, p4.y);\n return {\n x: xmin,\n y: ymin,\n w: xmax - xmin,\n h: ymax - ymin,\n c: c,\n r: r,\n x2: xmax,\n y2: ymax,\n cr: cr,\n sr: sr\n };\n}\nvar entryComparator = function entryComparator(value, arrayEntry) {\n var c = 0;\n if (arrayEntry[1] > value[1]) {\n c = -1;\n } else if (arrayEntry[1] < value[1]) {\n c = 1;\n }\n return c;\n};\nvar reverseEntryComparator = function reverseEntryComparator(value, arrayEntry) {\n return entryComparator(value, arrayEntry) * -1;\n};\nfunction _updateElementIndex(id, value, array, sortDescending) {\n insertSorted([id, value], array, entryComparator, sortDescending);\n}\nfunction _clearElementIndex(id, array) {\n var idx = findWithFunction(array, function (entry) {\n return entry[0] === id;\n });\n if (idx > -1) {\n array.splice(idx, 1);\n }\n}\nvar Viewport = function (_EventGenerator) {\n _inherits(Viewport, _EventGenerator);\n var _super = _createSuper(Viewport);\n function Viewport(instance) {\n var _this;\n _classCallCheck(this, Viewport);\n _this = _super.call(this);\n _this.instance = instance;\n _defineProperty(_assertThisInitialized(_this), "_currentTransaction", null);\n _defineProperty(_assertThisInitialized(_this), "_sortedElements", {\n xmin: [],\n xmax: [],\n ymin: [],\n ymax: []\n });\n _defineProperty(_assertThisInitialized(_this), "_elementMap", new Map());\n _defineProperty(_assertThisInitialized(_this), "_transformedElementMap", new Map());\n _defineProperty(_assertThisInitialized(_this), "_bounds", {\n minx: 0,\n maxx: 0,\n miny: 0,\n maxy: 0\n });\n return _this;\n }\n _createClass(Viewport, [{\n key: "_updateBounds",\n value: function _updateBounds(id, updatedElement, doNotRecalculateBounds) {\n if (updatedElement != null) {\n _clearElementIndex(id, this._sortedElements.xmin);\n _clearElementIndex(id, this._sortedElements.xmax);\n _clearElementIndex(id, this._sortedElements.ymin);\n _clearElementIndex(id, this._sortedElements.ymax);\n _updateElementIndex(id, updatedElement.t.x, this._sortedElements.xmin, false);\n _updateElementIndex(id, updatedElement.t.x + updatedElement.t.w, this._sortedElements.xmax, true);\n _updateElementIndex(id, updatedElement.t.y, this._sortedElements.ymin, false);\n _updateElementIndex(id, updatedElement.t.y + updatedElement.t.h, this._sortedElements.ymax, true);\n if (doNotRecalculateBounds !== true) {\n this._recalculateBounds();\n }\n }\n }\n }, {\n key: "_recalculateBounds",\n value: function _recalculateBounds() {\n this._bounds.minx = this._sortedElements.xmin.length > 0 ? this._sortedElements.xmin[0][1] : 0;\n this._bounds.maxx = this._sortedElements.xmax.length > 0 ? this._sortedElements.xmax[0][1] : 0;\n this._bounds.miny = this._sortedElements.ymin.length > 0 ? this._sortedElements.ymin[0][1] : 0;\n this._bounds.maxy = this._sortedElements.ymax.length > 0 ? this._sortedElements.ymax[0][1] : 0;\n }\n }, {\n key: "recomputeBounds",\n value: function recomputeBounds() {\n var _this2 = this;\n this._sortedElements.xmin.length = 0;\n this._sortedElements.xmax.length = 0;\n this._sortedElements.ymin.length = 0;\n this._sortedElements.ymax.length = 0;\n this._elementMap.forEach(function (vp, id) {\n _this2._sortedElements.xmin.push([id, vp.t.x]);\n _this2._sortedElements.xmax.push([id, vp.t.x + vp.t.w]);\n _this2._sortedElements.ymin.push([id, vp.t.y]);\n _this2._sortedElements.ymax.push([id, vp.t.y + vp.t.h]);\n });\n this._sortedElements.xmin.sort(entryComparator);\n this._sortedElements.ymin.sort(entryComparator);\n this._sortedElements.xmax.sort(reverseEntryComparator);\n this._sortedElements.ymax.sort(reverseEntryComparator);\n this._recalculateBounds();\n }\n }, {\n key: "_finaliseUpdate",\n value: function _finaliseUpdate(id, e, doNotRecalculateBounds) {\n e.t = rotate(e.x, e.y, e.w, e.h, e.r);\n this._transformedElementMap.set(id, e.t);\n if (doNotRecalculateBounds !== true) {\n this._updateBounds(id, e, doNotRecalculateBounds);\n }\n }\n }, {\n key: "shouldFireEvent",\n value: function shouldFireEvent(event, value, originalEvent) {\n return true;\n }\n }, {\n key: "startTransaction",\n value: function startTransaction() {\n if (this._currentTransaction != null) {\n throw new Error("Viewport: cannot start transaction; a transaction is currently active.");\n }\n this._currentTransaction = new Transaction();\n }\n }, {\n key: "endTransaction",\n value: function endTransaction() {\n var _this3 = this;\n if (this._currentTransaction != null) {\n this._currentTransaction.affectedElements.forEach(function (id) {\n var entry = _this3.getPosition(id);\n _this3._finaliseUpdate(id, entry, true);\n });\n this.recomputeBounds();\n this._currentTransaction = null;\n }\n }\n }, {\n key: "updateElements",\n value: function updateElements(entries) {\n var _this4 = this;\n forEach(entries, function (e) {\n return _this4.updateElement(e.id, e.x, e.y, e.width, e.height, e.rotation);\n });\n }\n }, {\n key: "updateElement",\n value: function updateElement(id, x, y, width, height, rotation, doNotRecalculateBounds) {\n var e = getsert(this._elementMap, id, EMPTY_POSITION);\n e.dirty = x == null && e.x == null || y == null && e.y == null || width == null && e.w == null || height == null && e.h == null;\n if (x != null) {\n e.x = x;\n }\n if (y != null) {\n e.y = y;\n }\n if (width != null) {\n e.w = width;\n }\n if (height != null) {\n e.h = height;\n }\n if (rotation != null) {\n e.r = rotation || 0;\n }\n e.c.x = e.x + e.w / 2;\n e.c.y = e.y + e.h / 2;\n e.x2 = e.x + e.w;\n e.y2 = e.y + e.h;\n if (this._currentTransaction == null) {\n this._finaliseUpdate(id, e, doNotRecalculateBounds);\n } else {\n this._currentTransaction.affectedElements.add(id);\n }\n return e;\n }\n }, {\n key: "refreshElement",\n value: function refreshElement(elId, doNotRecalculateBounds) {\n var me = this.instance.getManagedElements();\n var s = me[elId] ? me[elId].el : null;\n if (s != null) {\n var size = this.getSize(s);\n var offset = this.getOffset(s);\n return this.updateElement(elId, offset.x, offset.y, size.w, size.h, null, doNotRecalculateBounds);\n } else {\n return null;\n }\n }\n }, {\n key: "getSize",\n value: function getSize(el) {\n return this.instance.getSize(el);\n }\n }, {\n key: "getOffset",\n value: function getOffset(el) {\n return this.instance.getOffset(el);\n }\n }, {\n key: "registerElement",\n value: function registerElement(id, doNotRecalculateBounds) {\n return this.updateElement(id, 0, 0, 0, 0, 0, doNotRecalculateBounds);\n }\n }, {\n key: "addElement",\n value: function addElement(id, x, y, width, height, rotation) {\n return this.updateElement(id, x, y, width, height, rotation);\n }\n }, {\n key: "rotateElement",\n value: function rotateElement(id, rotation) {\n var e = getsert(this._elementMap, id, EMPTY_POSITION);\n e.r = rotation || 0;\n this._finaliseUpdate(id, e);\n return e;\n }\n }, {\n key: "getBoundsWidth",\n value: function getBoundsWidth() {\n return this._bounds.maxx - this._bounds.minx;\n }\n }, {\n key: "getBoundsHeight",\n value: function getBoundsHeight() {\n return this._bounds.maxy - this._bounds.miny;\n }\n }, {\n key: "getX",\n value: function getX() {\n return this._bounds.minx;\n }\n }, {\n key: "getY",\n value: function getY() {\n return this._bounds.miny;\n }\n }, {\n key: "setSize",\n value: function setSize(id, w, h) {\n if (this._elementMap.has(id)) {\n return this.updateElement(id, null, null, w, h, null);\n }\n }\n }, {\n key: "setPosition",\n value: function setPosition(id, x, y) {\n if (this._elementMap.has(id)) {\n return this.updateElement(id, x, y, null, null, null);\n }\n }\n }, {\n key: "reset",\n value: function reset() {\n this._sortedElements.xmin.length = 0;\n this._sortedElements.xmax.length = 0;\n this._sortedElements.ymin.length = 0;\n this._sortedElements.ymax.length = 0;\n this._elementMap.clear();\n this._transformedElementMap.clear();\n this._recalculateBounds();\n }\n }, {\n key: "remove",\n value: function remove(id) {\n _clearElementIndex(id, this._sortedElements.xmin);\n _clearElementIndex(id, this._sortedElements.xmax);\n _clearElementIndex(id, this._sortedElements.ymin);\n _clearElementIndex(id, this._sortedElements.ymax);\n this._elementMap["delete"](id);\n this._transformedElementMap["delete"](id);\n this._recalculateBounds();\n }\n }, {\n key: "getPosition",\n value: function getPosition(id) {\n return this._elementMap.get(id);\n }\n }, {\n key: "getElements",\n value: function getElements() {\n return this._elementMap;\n }\n }, {\n key: "isEmpty",\n value: function isEmpty() {\n return this._elementMap.size === 0;\n }\n }]);\n return Viewport;\n}(EventGenerator);\n\nvar _edgeSortFunctions;\nfunction _placeAnchorsOnLine(element, connections, horizontal, otherMultiplier, reverse) {\n var sizeInAxis = horizontal ? element.w : element.h;\n var sizeInOtherAxis = horizontal ? element.h : element.w;\n var a = [],\n step = sizeInAxis / (connections.length + 1);\n for (var i = 0; i < connections.length; i++) {\n var val = (i + 1) * step,\n other = otherMultiplier * sizeInOtherAxis;\n if (reverse) {\n val = sizeInAxis - val;\n }\n var dx = horizontal ? val : other,\n x = element.x + dx,\n xp = dx / element.w;\n var dy = horizontal ? other : val,\n y = element.y + dy,\n yp = dy / element.h;\n if (element.r !== 0 && element.r != null) {\n var rotated = rotatePoint({\n x: x,\n y: y\n }, element.c, element.r);\n x = rotated.x;\n y = rotated.y;\n }\n a.push({\n x: x,\n y: y,\n xLoc: xp,\n yLoc: yp,\n c: connections[i].c\n });\n }\n return a;\n}\nfunction _rightAndBottomSort(a, b) {\n return b.theta - a.theta;\n}\nfunction _leftAndTopSort(a, b) {\n var p1 = a.theta < 0 ? -Math.PI - a.theta : Math.PI - a.theta,\n p2 = b.theta < 0 ? -Math.PI - b.theta : Math.PI - b.theta;\n return p1 - p2;\n}\nvar edgeSortFunctions = (_edgeSortFunctions = {}, _defineProperty(_edgeSortFunctions, TOP, _leftAndTopSort), _defineProperty(_edgeSortFunctions, RIGHT, _rightAndBottomSort), _defineProperty(_edgeSortFunctions, BOTTOM, _rightAndBottomSort), _defineProperty(_edgeSortFunctions, LEFT, _leftAndTopSort), _edgeSortFunctions);\nfunction isContinuous(a) {\n return a.isContinuous === true;\n}\nfunction _isFloating(a) {\n return a.isContinuous === true;\n}\nfunction isDynamic(a) {\n return a.locations.length > 1;\n}\nfunction getCurrentLocation(anchor) {\n return [anchor.currentLocation, anchor.locations[anchor.currentLocation]];\n}\nvar LightweightRouter = function () {\n function LightweightRouter(instance) {\n var _this = this;\n _classCallCheck(this, LightweightRouter);\n this.instance = instance;\n _defineProperty(this, "anchorLists", new Map());\n _defineProperty(this, "anchorLocations", new Map());\n instance.bind(EVENT_INTERNAL_CONNECTION_DETACHED, function (p) {\n if (p.sourceEndpoint._anchor.isContinuous) {\n _this._removeEndpointFromAnchorLists(p.sourceEndpoint);\n }\n if (p.targetEndpoint._anchor.isContinuous) {\n _this._removeEndpointFromAnchorLists(p.targetEndpoint);\n }\n });\n instance.bind(EVENT_INTERNAL_ENDPOINT_UNREGISTERED, function (ep) {\n _this._removeEndpointFromAnchorLists(ep);\n });\n }\n _createClass(LightweightRouter, [{\n key: "getAnchorOrientation",\n value: function getAnchorOrientation(anchor) {\n var loc = this.anchorLocations.get(anchor.id);\n return loc ? [loc.ox, loc.oy] : [0, 0];\n }\n }, {\n key: "_distance",\n value: function _distance(anchor, cx, cy, xy, wh, rotation, targetRotation) {\n var ax = xy.x + anchor.x * wh.w,\n ay = xy.y + anchor.y * wh.h,\n acx = xy.x + wh.w / 2,\n acy = xy.y + wh.h / 2;\n if (rotation != null && rotation.length > 0) {\n var rotated = this.instance._applyRotations([ax, ay, 0, 0], rotation);\n ax = rotated.x;\n ay = rotated.y;\n }\n return Math.sqrt(Math.pow(cx - ax, 2) + Math.pow(cy - ay, 2)) + Math.sqrt(Math.pow(acx - ax, 2) + Math.pow(acy - ay, 2));\n }\n }, {\n key: "_anchorSelector",\n value: function _anchorSelector(xy, wh, txy, twh, rotation, targetRotation, locations) {\n var cx = txy.x + twh.w / 2,\n cy = txy.y + twh.h / 2;\n var minIdx = -1,\n minDist = Infinity;\n for (var i = 0; i < locations.length; i++) {\n var d = this._distance(locations[i], cx, cy, xy, wh, rotation, targetRotation);\n if (d < minDist) {\n minIdx = i + 0;\n minDist = d;\n }\n }\n return [minIdx, locations[minIdx]];\n }\n }, {\n key: "_floatingAnchorCompute",\n value: function _floatingAnchorCompute(anchor, params) {\n var xy = params.xy;\n var pos = {\n curX: xy.x + anchor.size.w / 2,\n curY: xy.y + anchor.size.h / 2,\n x: 0,\n y: 0,\n ox: 0,\n oy: 0\n };\n return this._setComputedPosition(anchor, pos);\n }\n }, {\n key: "_setComputedPosition",\n value: function _setComputedPosition(anchor, pos, timestamp) {\n this.anchorLocations.set(anchor.id, pos);\n anchor.computedPosition = pos;\n if (timestamp) {\n anchor.timestamp = timestamp;\n }\n return pos;\n }\n }, {\n key: "_computeSingleLocation",\n value: function _computeSingleLocation(loc, xy, wh, params) {\n var pos;\n var rotation = params.rotation;\n var candidate = {\n curX: xy.x + loc.x * wh.w + loc.offx,\n curY: xy.y + loc.y * wh.h + loc.offy,\n x: loc.x,\n y: loc.y,\n ox: 0,\n oy: 0\n };\n if (rotation != null && rotation.length > 0) {\n var o = [loc.iox, loc.ioy],\n current = {\n x: candidate.curX,\n y: candidate.curY,\n cr: 0,\n sr: 0\n };\n forEach(rotation, function (r) {\n current = rotatePoint(current, r.c, r.r);\n var _o = [Math.round(o[0] * current.cr - o[1] * current.sr), Math.round(o[1] * current.cr + o[0] * current.sr)];\n o = _o.slice();\n });\n loc.ox = o[0];\n loc.oy = o[1];\n pos = {\n curX: current.x,\n curY: current.y,\n x: loc.x,\n y: loc.y,\n ox: o[0],\n oy: o[1]\n };\n } else {\n loc.ox = loc.iox;\n loc.oy = loc.ioy;\n pos = extend({\n ox: loc.iox,\n oy: loc.ioy\n }, candidate);\n }\n return pos;\n }\n }, {\n key: "_singleAnchorCompute",\n value: function _singleAnchorCompute(anchor, params) {\n var xy = params.xy,\n wh = params.wh,\n timestamp = params.timestamp,\n pos = this.anchorLocations.get(anchor.id);\n if (pos != null && timestamp && timestamp === anchor.timestamp) {\n return pos;\n }\n var _getCurrentLocation = getCurrentLocation(anchor),\n _getCurrentLocation2 = _slicedToArray(_getCurrentLocation, 2);\n _getCurrentLocation2[0];\n var currentLoc = _getCurrentLocation2[1];\n pos = this._computeSingleLocation(currentLoc, xy, wh, params);\n return this._setComputedPosition(anchor, pos, timestamp);\n }\n }, {\n key: "_defaultAnchorCompute",\n value: function _defaultAnchorCompute(anchor, params) {\n var pos;\n if (anchor.locations.length === 1) {\n return this._singleAnchorCompute(anchor, params);\n }\n var xy = params.xy,\n wh = params.wh,\n txy = params.txy,\n twh = params.twh;\n var _getCurrentLocation3 = getCurrentLocation(anchor),\n _getCurrentLocation4 = _slicedToArray(_getCurrentLocation3, 2),\n currentIdx = _getCurrentLocation4[0],\n currentLoc = _getCurrentLocation4[1];\n if (anchor.locked || txy == null || twh == null) {\n pos = this._computeSingleLocation(currentLoc, xy, wh, params);\n } else {\n var _this$_anchorSelector = this._anchorSelector(xy, wh, txy, twh, params.rotation, params.tRotation, anchor.locations),\n _this$_anchorSelector2 = _slicedToArray(_this$_anchorSelector, 2),\n newIdx = _this$_anchorSelector2[0],\n newLoc = _this$_anchorSelector2[1];\n anchor.currentLocation = newIdx;\n if (newIdx !== currentIdx) {\n anchor.cssClass = newLoc.cls || anchor.cssClass;\n params.element._anchorLocationChanged(anchor);\n }\n pos = this._computeSingleLocation(newLoc, xy, wh, params);\n }\n return this._setComputedPosition(anchor, pos, params.timestamp);\n }\n }, {\n key: "_placeAnchors",\n value: function _placeAnchors(elementId, _anchorLists) {\n var _this2 = this;\n var cd = this.instance.viewport.getPosition(elementId),\n placeSomeAnchors = function placeSomeAnchors(desc, element, unsortedConnections, isHorizontal, otherMultiplier, orientation) {\n if (unsortedConnections.length > 0) {\n var sc = unsortedConnections.sort(edgeSortFunctions[desc]),\n reverse = desc === RIGHT || desc === TOP,\n anchors = _placeAnchorsOnLine(cd, sc, isHorizontal, otherMultiplier, reverse);\n for (var i = 0; i < anchors.length; i++) {\n var c = anchors[i].c,\n weAreSource = c.endpoints[0].elementId === elementId,\n ep = weAreSource ? c.endpoints[0] : c.endpoints[1];\n _this2._setComputedPosition(ep._anchor, {\n curX: anchors[i].x,\n curY: anchors[i].y,\n x: anchors[i].xLoc,\n y: anchors[i].yLoc,\n ox: orientation[0],\n oy: orientation[1]\n });\n }\n }\n };\n placeSomeAnchors(BOTTOM, cd, _anchorLists.bottom, true, 1, [0, 1]);\n placeSomeAnchors(TOP, cd, _anchorLists.top, true, 0, [0, -1]);\n placeSomeAnchors(LEFT, cd, _anchorLists.left, false, 0, [-1, 0]);\n placeSomeAnchors(RIGHT, cd, _anchorLists.right, false, 1, [1, 0]);\n }\n }, {\n key: "_updateAnchorList",\n value: function _updateAnchorList(lists, theta, order, conn, aBoolean, otherElId, idx, reverse, edgeId, connsToPaint, endpointsToPaint) {\n var endpoint = conn.endpoints[idx],\n endpointId = endpoint.id,\n oIdx = [1, 0][idx],\n values = {\n theta: theta,\n order: order,\n c: conn,\n b: aBoolean,\n elId: otherElId,\n epId: endpointId\n },\n listToAddTo = lists[edgeId],\n listToRemoveFrom = endpoint._continuousAnchorEdge ? lists[endpoint._continuousAnchorEdge] : null,\n candidate;\n if (listToRemoveFrom) {\n var rIdx = findWithFunction(listToRemoveFrom, function (e) {\n return e.epId === endpointId;\n });\n if (rIdx !== -1) {\n listToRemoveFrom.splice(rIdx, 1);\n for (var i = 0; i < listToRemoveFrom.length; i++) {\n candidate = listToRemoveFrom[i].c;\n if (candidate.placeholder !== true) {\n connsToPaint.add(candidate);\n }\n endpointsToPaint.add(listToRemoveFrom[i].c.endpoints[idx]);\n endpointsToPaint.add(listToRemoveFrom[i].c.endpoints[oIdx]);\n }\n }\n }\n for (var _i = 0; _i < listToAddTo.length; _i++) {\n candidate = listToAddTo[_i].c;\n if (candidate.placeholder !== true) {\n connsToPaint.add(candidate);\n }\n endpointsToPaint.add(listToAddTo[_i].c.endpoints[idx]);\n endpointsToPaint.add(listToAddTo[_i].c.endpoints[oIdx]);\n }\n {\n var insertIdx = reverse ? 0 : listToAddTo.length;\n listToAddTo.splice(insertIdx, 0, values);\n }\n endpoint._continuousAnchorEdge = edgeId;\n }\n }, {\n key: "_removeEndpointFromAnchorLists",\n value: function _removeEndpointFromAnchorLists(endpoint) {\n var listsForElement = this.anchorLists.get(endpoint.elementId);\n var total = 0;\n (function (list, eId) {\n if (list) {\n var f = function f(e) {\n return e.epId === eId;\n };\n removeWithFunction(list.top, f);\n removeWithFunction(list.left, f);\n removeWithFunction(list.bottom, f);\n removeWithFunction(list.right, f);\n total += list.top.length;\n total += list.left.length;\n total += list.bottom.length;\n total += list.right.length;\n }\n })(listsForElement, endpoint.id);\n if (total === 0) {\n this.anchorLists["delete"](endpoint.elementId);\n }\n this.anchorLocations["delete"](endpoint._anchor.id);\n }\n }, {\n key: "computeAnchorLocation",\n value: function computeAnchorLocation(anchor, params) {\n var pos;\n if (isContinuous(anchor)) {\n pos = this.anchorLocations.get(anchor.id) || {\n curX: 0,\n curY: 0,\n x: 0,\n y: 0,\n ox: 0,\n oy: 0\n };\n } else if (_isFloating(anchor)) {\n pos = this._floatingAnchorCompute(anchor, params);\n } else {\n pos = this._defaultAnchorCompute(anchor, params);\n }\n anchor.timestamp = params.timestamp;\n return pos;\n }\n }, {\n key: "computePath",\n value: function computePath(connection, timestamp) {\n var sourceInfo = this.instance.viewport.getPosition(connection.sourceId),\n targetInfo = this.instance.viewport.getPosition(connection.targetId),\n sE = connection.endpoints[0],\n tE = connection.endpoints[1];\n var sAnchorP = this.getEndpointLocation(sE, {\n xy: sourceInfo,\n wh: sourceInfo,\n element: sE,\n timestamp: timestamp,\n rotation: this.instance._getRotations(connection.sourceId)\n }),\n tAnchorP = this.getEndpointLocation(tE, {\n xy: targetInfo,\n wh: targetInfo,\n element: tE,\n timestamp: timestamp,\n rotation: this.instance._getRotations(connection.targetId)\n });\n connection.connector.resetBounds();\n connection.connector.compute({\n sourcePos: sAnchorP,\n targetPos: tAnchorP,\n sourceEndpoint: connection.endpoints[0],\n targetEndpoint: connection.endpoints[1],\n strokeWidth: connection.paintStyleInUse.strokeWidth,\n sourceInfo: sourceInfo,\n targetInfo: targetInfo\n });\n }\n }, {\n key: "getEndpointLocation",\n value: function getEndpointLocation(endpoint, params) {\n params = params || {};\n var anchor = endpoint._anchor;\n var pos = this.anchorLocations.get(anchor.id);\n if (pos == null || params.timestamp != null && anchor.timestamp !== params.timestamp) {\n pos = this.computeAnchorLocation(anchor, params);\n this._setComputedPosition(anchor, pos, params.timestamp);\n }\n return pos;\n }\n }, {\n key: "getEndpointOrientation",\n value: function getEndpointOrientation(ep) {\n return ep._anchor ? this.getAnchorOrientation(ep._anchor) : [0, 0];\n }\n }, {\n key: "setAnchorOrientation",\n value: function setAnchorOrientation(anchor, orientation) {\n var anchorLoc = this.anchorLocations.get(anchor.id);\n if (anchorLoc != null) {\n anchorLoc.ox = orientation[0];\n anchorLoc.oy = orientation[1];\n }\n }\n }, {\n key: "isDynamicAnchor",\n value: function isDynamicAnchor(ep) {\n return ep._anchor ? !isContinuous(ep._anchor) && ep._anchor.locations.length > 1 : false;\n }\n }, {\n key: "isFloating",\n value: function isFloating(ep) {\n return ep._anchor ? _isFloating(ep._anchor) : false;\n }\n }, {\n key: "prepareAnchor",\n value: function prepareAnchor(params) {\n return makeLightweightAnchorFromSpec(params);\n }\n }, {\n key: "redraw",\n value: function redraw(elementId, timestamp, offsetToUI) {\n var _this3 = this;\n var connectionsToPaint = new Set(),\n endpointsToPaint = new Set(),\n anchorsToUpdate = new Set();\n if (!this.instance._suspendDrawing) {\n var ep = this.instance.endpointsByElement[elementId] || [];\n timestamp = timestamp || uuid();\n var orientationCache = {},\n a,\n anEndpoint;\n for (var i = 0; i < ep.length; i++) {\n anEndpoint = ep[i];\n if (anEndpoint.visible === false) {\n continue;\n }\n endpointsToPaint.add(anEndpoint);\n a = anEndpoint._anchor;\n if (anEndpoint.connections.length === 0) {\n if (isContinuous(a)) {\n if (!this.anchorLists.has(elementId)) {\n this.anchorLists.set(elementId, {\n top: [],\n right: [],\n bottom: [],\n left: []\n });\n }\n this._updateAnchorList(this.anchorLists.get(elementId), -Math.PI / 2, 0, {\n endpoints: [anEndpoint, anEndpoint],\n placeholder: true\n }, false, elementId, 0, false, getDefaultFace(a), connectionsToPaint, endpointsToPaint);\n anchorsToUpdate.add(elementId);\n }\n } else {\n for (var _i2 = 0; _i2 < anEndpoint.connections.length; _i2++) {\n var conn = anEndpoint.connections[_i2],\n sourceId = conn.sourceId,\n targetId = conn.targetId,\n sourceContinuous = isContinuous(conn.endpoints[0]._anchor),\n targetContinuous = isContinuous(conn.endpoints[1]._anchor);\n if (sourceContinuous || targetContinuous) {\n var c1 = (conn.endpoints[0]._anchor.faces || []).join("-"),\n c2 = (conn.endpoints[1]._anchor.faces || []).join("-"),\n oKey = [sourceId, c1, targetId, c2].join("-"),\n o = orientationCache[oKey],\n oIdx = conn.sourceId === elementId ? 1 : 0;\n if (sourceContinuous && !this.anchorLists.has(sourceId)) {\n this.anchorLists.set(sourceId, {\n top: [],\n right: [],\n bottom: [],\n left: []\n });\n }\n if (targetContinuous && !this.anchorLists.has(targetId)) {\n this.anchorLists.set(targetId, {\n top: [],\n right: [],\n bottom: [],\n left: []\n });\n }\n var td = this.instance.viewport.getPosition(targetId),\n sd = this.instance.viewport.getPosition(sourceId);\n if (targetId === sourceId && (sourceContinuous || targetContinuous)) {\n this._updateAnchorList(this.anchorLists.get(sourceId), -Math.PI / 2, 0, conn, false, targetId, 0, false, TOP, connectionsToPaint, endpointsToPaint);\n this._updateAnchorList(this.anchorLists.get(targetId), -Math.PI / 2, 0, conn, false, sourceId, 1, false, TOP, connectionsToPaint, endpointsToPaint);\n } else {\n var sourceRotation = this.instance._getRotations(sourceId);\n var targetRotation = this.instance._getRotations(targetId);\n if (!o) {\n o = this._calculateOrientation(sourceId, targetId, sd, td, conn.endpoints[0]._anchor, conn.endpoints[1]._anchor, sourceRotation, targetRotation);\n orientationCache[oKey] = o;\n }\n if (sourceContinuous) {\n this._updateAnchorList(this.anchorLists.get(sourceId), o.theta, 0, conn, false, targetId, 0, false, o.a[0], connectionsToPaint, endpointsToPaint);\n }\n if (targetContinuous) {\n this._updateAnchorList(this.anchorLists.get(targetId), o.theta2, -1, conn, true, sourceId, 1, true, o.a[1], connectionsToPaint, endpointsToPaint);\n }\n }\n if (sourceContinuous) {\n anchorsToUpdate.add(sourceId);\n }\n if (targetContinuous) {\n anchorsToUpdate.add(targetId);\n }\n connectionsToPaint.add(conn);\n if (sourceContinuous && oIdx === 0 || targetContinuous && oIdx === 1) {\n endpointsToPaint.add(conn.endpoints[oIdx]);\n }\n } else {\n var otherEndpoint = anEndpoint.connections[_i2].endpoints[conn.sourceId === elementId ? 1 : 0],\n otherAnchor = otherEndpoint._anchor;\n if (isDynamic(otherAnchor)) {\n this.instance._paintEndpoint(otherEndpoint, {\n elementWithPrecedence: elementId,\n timestamp: timestamp\n });\n connectionsToPaint.add(anEndpoint.connections[_i2]);\n for (var k = 0; k < otherEndpoint.connections.length; k++) {\n if (otherEndpoint.connections[k] !== anEndpoint.connections[_i2]) {\n connectionsToPaint.add(otherEndpoint.connections[k]);\n }\n }\n } else {\n connectionsToPaint.add(anEndpoint.connections[_i2]);\n }\n }\n }\n }\n }\n anchorsToUpdate.forEach(function (anchor) {\n _this3._placeAnchors(anchor, _this3.anchorLists.get(anchor));\n });\n endpointsToPaint.forEach(function (ep) {\n var cd = _this3.instance.viewport.getPosition(ep.elementId);\n _this3.instance._paintEndpoint(ep, {\n timestamp: timestamp,\n offset: cd\n });\n });\n connectionsToPaint.forEach(function (c) {\n _this3.instance._paintConnection(c, {\n timestamp: timestamp\n });\n });\n }\n return {\n c: connectionsToPaint,\n e: endpointsToPaint\n };\n }\n }, {\n key: "reset",\n value: function reset() {\n this.anchorLocations.clear();\n this.anchorLists.clear();\n }\n }, {\n key: "setAnchor",\n value: function setAnchor(endpoint, anchor) {\n if (anchor != null) {\n endpoint._anchor = anchor;\n }\n }\n }, {\n key: "setConnectionAnchors",\n value: function setConnectionAnchors(conn, anchors) {\n conn.endpoints[0]._anchor = anchors[0];\n conn.endpoints[1]._anchor = anchors[1];\n }\n }, {\n key: "_calculateOrientation",\n value: function _calculateOrientation(sourceId, targetId, sd, td, sourceAnchor, targetAnchor, sourceRotation, targetRotation) {\n var _this4 = this;\n var Orientation = {\n HORIZONTAL: "horizontal",\n VERTICAL: "vertical",\n DIAGONAL: "diagonal",\n IDENTITY: "identity"\n };\n if (sourceId === targetId) {\n return {\n orientation: Orientation.IDENTITY,\n a: [TOP, TOP]\n };\n }\n var theta = Math.atan2(td.c.y - sd.c.y, td.c.x - sd.c.x),\n theta2 = Math.atan2(sd.c.y - td.c.y, sd.c.x - td.c.x);\n var candidates = [],\n midpoints = {};\n (function (types, dim) {\n for (var i = 0; i < types.length; i++) {\n var _midpoints$types$i;\n midpoints[types[i]] = (_midpoints$types$i = {}, _defineProperty(_midpoints$types$i, LEFT, {\n x: dim[i][0].x,\n y: dim[i][0].c.y\n }), _defineProperty(_midpoints$types$i, RIGHT, {\n x: dim[i][0].x + dim[i][0].w,\n y: dim[i][0].c.y\n }), _defineProperty(_midpoints$types$i, TOP, {\n x: dim[i][0].c.x,\n y: dim[i][0].y\n }), _defineProperty(_midpoints$types$i, BOTTOM, {\n x: dim[i][0].c.x,\n y: dim[i][0].y + dim[i][0].h\n }), _midpoints$types$i);\n if (dim[i][1] != null && dim[i][1].length > 0) {\n for (var axis in midpoints[types[i]]) {\n midpoints[types[i]][axis] = _this4.instance._applyRotationsXY(midpoints[types[i]][axis], dim[i][1]);\n }\n }\n }\n })([SOURCE, TARGET], [[sd, sourceRotation], [td, targetRotation]]);\n var FACES = [TOP, LEFT, RIGHT, BOTTOM];\n for (var sf = 0; sf < FACES.length; sf++) {\n for (var tf = 0; tf < FACES.length; tf++) {\n candidates.push({\n source: FACES[sf],\n target: FACES[tf],\n dist: lineLength(midpoints.source[FACES[sf]], midpoints.target[FACES[tf]])\n });\n }\n }\n candidates.sort(function (a, b) {\n if (a.dist < b.dist) {\n return -1;\n } else if (b.dist < a.dist) {\n return 1;\n } else {\n var _axisIndices;\n var axisIndices = (_axisIndices = {}, _defineProperty(_axisIndices, LEFT, 0), _defineProperty(_axisIndices, TOP, 1), _defineProperty(_axisIndices, RIGHT, 2), _defineProperty(_axisIndices, BOTTOM, 3), _axisIndices),\n ais = axisIndices[a.source],\n bis = axisIndices[b.source],\n ait = axisIndices[a.target],\n bit = axisIndices[b.target];\n return ais < bis ? -1 : bis < ais ? 1 : ait < bit ? -1 : bit < ait ? 1 : 0;\n }\n });\n var sourceEdge = candidates[0].source,\n targetEdge = candidates[0].target;\n for (var i = 0; i < candidates.length; i++) {\n if (isContinuous(sourceAnchor) && sourceAnchor.locked) {\n sourceEdge = sourceAnchor.currentFace;\n } else if (!sourceAnchor.isContinuous || isEdgeSupported(sourceAnchor, candidates[i].source)) {\n sourceEdge = candidates[i].source;\n } else {\n sourceEdge = null;\n }\n if (targetAnchor.isContinuous && targetAnchor.locked) {\n targetEdge = targetAnchor.currentFace;\n } else if (!targetAnchor.isContinuous || isEdgeSupported(targetAnchor, candidates[i].target)) {\n targetEdge = candidates[i].target;\n } else {\n targetEdge = null;\n }\n if (sourceEdge != null && targetEdge != null) {\n break;\n }\n }\n if (sourceAnchor.isContinuous) {\n this.setCurrentFace(sourceAnchor, sourceEdge);\n }\n if (targetAnchor.isContinuous) {\n this.setCurrentFace(targetAnchor, targetEdge);\n }\n return {\n a: [sourceEdge, targetEdge],\n theta: theta,\n theta2: theta2\n };\n }\n }, {\n key: "setCurrentFace",\n value: function setCurrentFace(a, face, overrideLock) {\n a.currentFace = face;\n if (overrideLock && a.lockedFace != null) {\n a.lockedFace = a.currentFace;\n }\n }\n }, {\n key: "lock",\n value: function lock(a) {\n a.locked = true;\n if (isContinuous(a)) {\n a.lockedFace = a.currentFace;\n }\n }\n }, {\n key: "unlock",\n value: function unlock(a) {\n a.locked = false;\n if (isContinuous(a)) {\n a.lockedFace = null;\n }\n }\n }, {\n key: "selectAnchorLocation",\n value: function selectAnchorLocation(a, coords) {\n var idx = findWithFunction(a.locations, function (loc) {\n return loc.x === coords.x && loc.y === coords.y;\n });\n if (idx !== -1) {\n a.currentLocation = idx;\n return true;\n } else {\n return false;\n }\n }\n }, {\n key: "lockCurrentAxis",\n value: function lockCurrentAxis(a) {\n if (a.currentFace != null) {\n a.lockedAxis = a.currentFace === LEFT || a.currentFace === RIGHT ? X_AXIS_FACES : Y_AXIS_FACES;\n }\n }\n }, {\n key: "unlockCurrentAxis",\n value: function unlockCurrentAxis(a) {\n a.lockedAxis = null;\n }\n }, {\n key: "anchorsEqual",\n value: function anchorsEqual(a1, a2) {\n if (!a1 || !a2) {\n return false;\n }\n var l1 = a1.locations[a1.currentLocation],\n l2 = a2.locations[a2.currentLocation];\n return l1.x === l2.x && l1.y === l2.y && l1.offx === l2.offx && l1.offy === l2.offy && l1.ox === l2.ox && l1.oy === l2.oy;\n }\n }]);\n return LightweightRouter;\n}();\n\nvar connectorMap = {};\nvar Connectors = {\n get: function get(connection, name, params) {\n var c = connectorMap[name];\n if (!c) {\n throw {\n message: "jsPlumb: unknown connector type \'" + name + "\'"\n };\n } else {\n return new c(connection, params);\n }\n },\n register: function register(name, conn) {\n connectorMap[name] = conn;\n }\n};\n\nvar StraightSegment = function (_AbstractSegment) {\n _inherits(StraightSegment, _AbstractSegment);\n var _super = _createSuper(StraightSegment);\n function StraightSegment(params) {\n var _this;\n _classCallCheck(this, StraightSegment);\n _this = _super.call(this, params);\n _defineProperty(_assertThisInitialized(_this), "length", void 0);\n _defineProperty(_assertThisInitialized(_this), "m", void 0);\n _defineProperty(_assertThisInitialized(_this), "m2", void 0);\n _defineProperty(_assertThisInitialized(_this), "type", StraightSegment.segmentType);\n _this._setCoordinates({\n x1: params.x1,\n y1: params.y1,\n x2: params.x2,\n y2: params.y2\n });\n return _this;\n }\n _createClass(StraightSegment, [{\n key: "getPath",\n value: function getPath(isFirstSegment) {\n return (isFirstSegment ? "M " + this.x1 + " " + this.y1 + " " : "") + "L " + this.x2 + " " + this.y2;\n }\n }, {\n key: "_recalc",\n value: function _recalc() {\n this.length = Math.sqrt(Math.pow(this.x2 - this.x1, 2) + Math.pow(this.y2 - this.y1, 2));\n this.m = gradient({\n x: this.x1,\n y: this.y1\n }, {\n x: this.x2,\n y: this.y2\n });\n this.m2 = -1 / this.m;\n this.extents = {\n xmin: Math.min(this.x1, this.x2),\n ymin: Math.min(this.y1, this.y2),\n xmax: Math.max(this.x1, this.x2),\n ymax: Math.max(this.y1, this.y2)\n };\n }\n }, {\n key: "getLength",\n value: function getLength() {\n return this.length;\n }\n }, {\n key: "getGradient",\n value: function getGradient() {\n return this.m;\n }\n }, {\n key: "_setCoordinates",\n value: function _setCoordinates(coords) {\n this.x1 = coords.x1;\n this.y1 = coords.y1;\n this.x2 = coords.x2;\n this.y2 = coords.y2;\n this._recalc();\n }\n }, {\n key: "pointOnPath",\n value: function pointOnPath(location, absolute) {\n if (location === 0 && !absolute) {\n return {\n x: this.x1,\n y: this.y1\n };\n } else if (location === 1 && !absolute) {\n return {\n x: this.x2,\n y: this.y2\n };\n } else {\n var l = absolute ? location > 0 ? location : this.length + location : location * this.length;\n return pointOnLine({\n x: this.x1,\n y: this.y1\n }, {\n x: this.x2,\n y: this.y2\n }, l);\n }\n }\n }, {\n key: "gradientAtPoint",\n value: function gradientAtPoint(location, absolute) {\n return this.m;\n }\n }, {\n key: "pointAlongPathFrom",\n value: function pointAlongPathFrom(location, distance, absolute) {\n var p = this.pointOnPath(location, absolute),\n farAwayPoint = distance <= 0 ? {\n x: this.x1,\n y: this.y1\n } : {\n x: this.x2,\n y: this.y2\n };\n if (distance <= 0 && Math.abs(distance) > 1) {\n distance *= -1;\n }\n return pointOnLine(p, farAwayPoint, distance);\n }\n }, {\n key: "within",\n value: function within(a, b, c) {\n return c >= Math.min(a, b) && c <= Math.max(a, b);\n }\n }, {\n key: "closest",\n value: function closest(a, b, c) {\n return Math.abs(c - a) < Math.abs(c - b) ? a : b;\n }\n }, {\n key: "findClosestPointOnPath",\n value: function findClosestPointOnPath(x, y) {\n var out = {\n d: Infinity,\n x: null,\n y: null,\n l: null,\n x1: this.x1,\n x2: this.x2,\n y1: this.y1,\n y2: this.y2\n };\n if (this.m === 0) {\n out.y = this.y1;\n out.x = this.within(this.x1, this.x2, x) ? x : this.closest(this.x1, this.x2, x);\n } else if (this.m === Infinity || this.m === -Infinity) {\n out.x = this.x1;\n out.y = this.within(this.y1, this.y2, y) ? y : this.closest(this.y1, this.y2, y);\n } else {\n var b = this.y1 - this.m * this.x1,\n b2 = y - this.m2 * x,\n _x1 = (b2 - b) / (this.m - this.m2),\n _y1 = this.m * _x1 + b;\n out.x = this.within(this.x1, this.x2, _x1) ? _x1 : this.closest(this.x1, this.x2, _x1);\n out.y = this.within(this.y1, this.y2, _y1) ? _y1 : this.closest(this.y1, this.y2, _y1);\n }\n var fractionInSegment = lineLength({\n x: out.x,\n y: out.y\n }, {\n x: this.x1,\n y: this.y1\n });\n out.d = lineLength({\n x: x,\n y: y\n }, out);\n out.l = fractionInSegment / length;\n return out;\n }\n }, {\n key: "_pointLiesBetween",\n value: function _pointLiesBetween(q, p1, p2) {\n return p2 > p1 ? p1 <= q && q <= p2 : p1 >= q && q >= p2;\n }\n }, {\n key: "lineIntersection",\n value: function lineIntersection(_x1, _y1, _x2, _y2) {\n var m2 = Math.abs(gradient({\n x: _x1,\n y: _y1\n }, {\n x: _x2,\n y: _y2\n })),\n m1 = Math.abs(this.m),\n b = m1 === Infinity ? this.x1 : this.y1 - m1 * this.x1,\n out = [],\n b2 = m2 === Infinity ? _x1 : _y1 - m2 * _x1;\n if (m2 !== m1) {\n if (m2 === Infinity && m1 === 0) {\n if (this._pointLiesBetween(_x1, this.x1, this.x2) && this._pointLiesBetween(this.y1, _y1, _y2)) {\n out.push({\n x: _x1,\n y: this.y1\n });\n }\n } else if (m2 === 0 && m1 === Infinity) {\n if (this._pointLiesBetween(_y1, this.y1, this.y2) && this._pointLiesBetween(this.x1, _x1, _x2)) {\n out.push({\n x: this.x1,\n y: _y1\n });\n }\n } else {\n var X, Y;\n if (m2 === Infinity) {\n X = _x1;\n if (this._pointLiesBetween(X, this.x1, this.x2)) {\n Y = m1 * _x1 + b;\n if (this._pointLiesBetween(Y, _y1, _y2)) {\n out.push({\n x: X,\n y: Y\n });\n }\n }\n } else if (m2 === 0) {\n Y = _y1;\n if (this._pointLiesBetween(Y, this.y1, this.y2)) {\n X = (_y1 - b) / m1;\n if (this._pointLiesBetween(X, _x1, _x2)) {\n out.push({\n x: X,\n y: Y\n });\n }\n }\n } else {\n X = (b2 - b) / (m1 - m2);\n Y = m1 * X + b;\n if (this._pointLiesBetween(X, this.x1, this.x2) && this._pointLiesBetween(Y, this.y1, this.y2)) {\n out.push({\n x: X,\n y: Y\n });\n }\n }\n }\n }\n return out;\n }\n }, {\n key: "boxIntersection",\n value: function boxIntersection(x, y, w, h) {\n var a = [];\n a.push.apply(a, this.lineIntersection(x, y, x + w, y));\n a.push.apply(a, this.lineIntersection(x + w, y, x + w, y + h));\n a.push.apply(a, this.lineIntersection(x + w, y + h, x, y + h));\n a.push.apply(a, this.lineIntersection(x, y + h, x, y));\n return a;\n }\n }]);\n return StraightSegment;\n}(AbstractSegment);\n_defineProperty(StraightSegment, "segmentType", "Straight");\n\nvar StraightConnector = function (_AbstractConnector) {\n _inherits(StraightConnector, _AbstractConnector);\n var _super = _createSuper(StraightConnector);\n function StraightConnector() {\n var _this;\n _classCallCheck(this, StraightConnector);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), "type", StraightConnector.type);\n return _this;\n }\n _createClass(StraightConnector, [{\n key: "getDefaultStubs",\n value: function getDefaultStubs() {\n return [0, 0];\n }\n }, {\n key: "_compute",\n value: function _compute(paintInfo, p) {\n this._addSegment(StraightSegment, {\n x1: paintInfo.sx,\n y1: paintInfo.sy,\n x2: paintInfo.startStubX,\n y2: paintInfo.startStubY\n });\n this._addSegment(StraightSegment, {\n x1: paintInfo.startStubX,\n y1: paintInfo.startStubY,\n x2: paintInfo.endStubX,\n y2: paintInfo.endStubY\n });\n this._addSegment(StraightSegment, {\n x1: paintInfo.endStubX,\n y1: paintInfo.endStubY,\n x2: paintInfo.tx,\n y2: paintInfo.ty\n });\n this.geometry = {\n source: p.sourcePos,\n target: p.targetPos\n };\n }\n }, {\n key: "transformGeometry",\n value: function transformGeometry(g, dx, dy) {\n return {\n source: this.transformAnchorPlacement(g.source, dx, dy),\n target: this.transformAnchorPlacement(g.target, dx, dy)\n };\n }\n }]);\n return StraightConnector;\n}(AbstractConnector);\n_defineProperty(StraightConnector, "type", "Straight");\n\nfunction _scopeMatch(e1, e2) {\n var s1 = e1.scope.split(/\\s/),\n s2 = e2.scope.split(/\\s/);\n for (var i = 0; i < s1.length; i++) {\n for (var j = 0; j < s2.length; j++) {\n if (s2[j] === s1[i]) {\n return true;\n }\n }\n }\n return false;\n}\nfunction prepareList(instance, input, doNotGetIds) {\n var r = [];\n var _resolveId = function _resolveId(i) {\n if (isString(i)) {\n return i;\n } else {\n return instance.getId(i);\n }\n };\n if (input) {\n if (typeof input === \'string\') {\n if (input === "*") {\n return input;\n }\n r.push(input);\n } else {\n if (doNotGetIds) {\n r = input;\n } else {\n if (input.length != null) {\n var _r;\n (_r = r).push.apply(_r, _toConsumableArray(_toConsumableArray(input).map(_resolveId)));\n } else {\n r.push(_resolveId(input));\n }\n }\n }\n }\n return r;\n}\nfunction addManagedEndpoint(managedElement, ep) {\n if (managedElement != null) {\n managedElement.endpoints.push(ep);\n }\n}\nfunction removeManagedEndpoint(managedElement, endpoint) {\n if (managedElement != null) {\n removeWithFunction(managedElement.endpoints, function (ep) {\n return ep === endpoint;\n });\n }\n}\nfunction addManagedConnection(connection, sourceEl, targetEl) {\n if (sourceEl != null) {\n sourceEl.connections.push(connection);\n if (sourceEl.connections.length === 1) {\n connection.instance.addClass(connection.source, connection.instance.connectedClass);\n }\n }\n if (targetEl != null) {\n if (sourceEl == null || connection.sourceId !== connection.targetId) {\n targetEl.connections.push(connection);\n if (targetEl.connections.length === 1) {\n connection.instance.addClass(connection.target, connection.instance.connectedClass);\n }\n }\n }\n}\nfunction removeManagedConnection(connection, sourceEl, targetEl) {\n if (sourceEl != null) {\n var sourceCount = sourceEl.connections.length;\n removeWithFunction(sourceEl.connections, function (_c) {\n return connection.id === _c.id;\n });\n if (sourceCount > 0 && sourceEl.connections.length === 0) {\n connection.instance.removeClass(connection.source, connection.instance.connectedClass);\n }\n }\n if (targetEl != null) {\n var targetCount = targetEl.connections.length;\n if (sourceEl == null || connection.sourceId !== connection.targetId) {\n removeWithFunction(targetEl.connections, function (_c) {\n return connection.id === _c.id;\n });\n }\n if (targetCount > 0 && targetEl.connections.length === 0) {\n connection.instance.removeClass(connection.target, connection.instance.connectedClass);\n }\n }\n}\nvar JsPlumbInstance = function (_EventGenerator) {\n _inherits(JsPlumbInstance, _EventGenerator);\n var _super = _createSuper(JsPlumbInstance);\n function JsPlumbInstance(_instanceIndex, defaults) {\n var _this;\n _classCallCheck(this, JsPlumbInstance);\n _this = _super.call(this);\n _this._instanceIndex = _instanceIndex;\n _defineProperty(_assertThisInitialized(_this), "defaults", void 0);\n _defineProperty(_assertThisInitialized(_this), "_initialDefaults", {});\n _defineProperty(_assertThisInitialized(_this), "isConnectionBeingDragged", false);\n _defineProperty(_assertThisInitialized(_this), "currentlyDragging", false);\n _defineProperty(_assertThisInitialized(_this), "hoverSuspended", false);\n _defineProperty(_assertThisInitialized(_this), "_suspendDrawing", false);\n _defineProperty(_assertThisInitialized(_this), "_suspendedAt", null);\n _defineProperty(_assertThisInitialized(_this), "connectorClass", CLASS_CONNECTOR);\n _defineProperty(_assertThisInitialized(_this), "connectorOutlineClass", CLASS_CONNECTOR_OUTLINE);\n _defineProperty(_assertThisInitialized(_this), "connectedClass", CLASS_CONNECTED);\n _defineProperty(_assertThisInitialized(_this), "endpointClass", CLASS_ENDPOINT);\n _defineProperty(_assertThisInitialized(_this), "endpointConnectedClass", CLASS_ENDPOINT_CONNECTED);\n _defineProperty(_assertThisInitialized(_this), "endpointFullClass", CLASS_ENDPOINT_FULL);\n _defineProperty(_assertThisInitialized(_this), "endpointFloatingClass", CLASS_ENDPOINT_FLOATING);\n _defineProperty(_assertThisInitialized(_this), "endpointDropAllowedClass", CLASS_ENDPOINT_DROP_ALLOWED);\n _defineProperty(_assertThisInitialized(_this), "endpointDropForbiddenClass", CLASS_ENDPOINT_DROP_FORBIDDEN);\n _defineProperty(_assertThisInitialized(_this), "endpointAnchorClassPrefix", CLASS_ENDPOINT_ANCHOR_PREFIX);\n _defineProperty(_assertThisInitialized(_this), "overlayClass", CLASS_OVERLAY);\n _defineProperty(_assertThisInitialized(_this), "connections", []);\n _defineProperty(_assertThisInitialized(_this), "endpointsByElement", {});\n _defineProperty(_assertThisInitialized(_this), "endpointsByUUID", new Map());\n _defineProperty(_assertThisInitialized(_this), "sourceSelectors", []);\n _defineProperty(_assertThisInitialized(_this), "targetSelectors", []);\n _defineProperty(_assertThisInitialized(_this), "allowNestedGroups", void 0);\n _defineProperty(_assertThisInitialized(_this), "_curIdStamp", 1);\n _defineProperty(_assertThisInitialized(_this), "viewport", new Viewport(_assertThisInitialized(_this)));\n _defineProperty(_assertThisInitialized(_this), "router", void 0);\n _defineProperty(_assertThisInitialized(_this), "groupManager", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectionTypes", new Map());\n _defineProperty(_assertThisInitialized(_this), "_endpointTypes", new Map());\n _defineProperty(_assertThisInitialized(_this), "_container", void 0);\n _defineProperty(_assertThisInitialized(_this), "_managedElements", {});\n _defineProperty(_assertThisInitialized(_this), "DEFAULT_SCOPE", void 0);\n _defineProperty(_assertThisInitialized(_this), "_zoom", 1);\n _this.defaults = {\n anchor: AnchorLocations.Bottom,\n anchors: [null, null],\n connectionsDetachable: true,\n connectionOverlays: [],\n connector: StraightConnector.type,\n container: null,\n endpoint: DotEndpoint.type,\n endpointOverlays: [],\n endpoints: [null, null],\n endpointStyle: {\n fill: "#456"\n },\n endpointStyles: [null, null],\n endpointHoverStyle: null,\n endpointHoverStyles: [null, null],\n hoverPaintStyle: null,\n listStyle: {},\n maxConnections: 1,\n paintStyle: {\n strokeWidth: 2,\n stroke: "#456"\n },\n reattachConnections: false,\n scope: "jsplumb_defaultscope",\n allowNestedGroups: true\n };\n if (defaults) {\n extend(_this.defaults, defaults);\n }\n extend(_this._initialDefaults, _this.defaults);\n if (_this._initialDefaults[DEFAULT_KEY_PAINT_STYLE] != null) {\n _this._initialDefaults[DEFAULT_KEY_PAINT_STYLE].strokeWidth = _this._initialDefaults[DEFAULT_KEY_PAINT_STYLE].strokeWidth || 2;\n }\n _this.DEFAULT_SCOPE = _this.defaults[DEFAULT_KEY_SCOPE];\n _this.allowNestedGroups = _this._initialDefaults[DEFAULT_KEY_ALLOW_NESTED_GROUPS] !== false;\n _this.router = new LightweightRouter(_assertThisInitialized(_this));\n _this.groupManager = new GroupManager(_assertThisInitialized(_this));\n _this.setContainer(_this._initialDefaults.container);\n return _this;\n }\n _createClass(JsPlumbInstance, [{\n key: "defaultScope",\n get: function get() {\n return this.DEFAULT_SCOPE;\n }\n }, {\n key: "currentZoom",\n get: function get() {\n return this._zoom;\n }\n }, {\n key: "areDefaultAnchorsSet",\n value: function areDefaultAnchorsSet() {\n return this.validAnchorsSpec(this.defaults.anchors);\n }\n }, {\n key: "validAnchorsSpec",\n value: function validAnchorsSpec(anchors) {\n return anchors != null && anchors[0] != null && anchors[1] != null;\n }\n }, {\n key: "getContainer",\n value: function getContainer() {\n return this._container;\n }\n }, {\n key: "setZoom",\n value: function setZoom(z, repaintEverything) {\n this._zoom = z;\n this.fire(EVENT_ZOOM, this._zoom);\n if (repaintEverything) {\n this.repaintEverything();\n }\n return true;\n }\n }, {\n key: "_idstamp",\n value: function _idstamp() {\n return "" + this._curIdStamp++;\n }\n }, {\n key: "checkCondition",\n value: function checkCondition(conditionName, args) {\n var l = this.getListener(conditionName),\n r = true;\n if (l && l.length > 0) {\n var values = Array.prototype.slice.call(arguments, 1);\n try {\n for (var i = 0, j = l.length; i < j; i++) {\n r = r && l[i].apply(l[i], values);\n }\n } catch (e) {\n log("cannot check condition [" + conditionName + "]" + e);\n }\n }\n return r;\n }\n }, {\n key: "getId",\n value: function getId(element, uuid) {\n if (element == null) {\n return null;\n }\n var id = this.getAttribute(element, ATTRIBUTE_MANAGED);\n if (!id || id === "undefined") {\n if (arguments.length === 2 && arguments[1] !== undefined) {\n id = uuid;\n } else if (arguments.length === 1 || arguments.length === 3 && !arguments[2]) {\n id = "jsplumb-" + this._instanceIndex + "-" + this._idstamp();\n }\n this.setAttribute(element, ATTRIBUTE_MANAGED, id);\n }\n return id;\n }\n }, {\n key: "getConnections",\n value: function getConnections(options, flat) {\n if (!options) {\n options = {};\n } else if (options.constructor === String) {\n options = {\n "scope": options\n };\n }\n var scope = options.scope || this.defaultScope,\n scopes = prepareList(this, scope, true),\n sources = prepareList(this, options.source),\n targets = prepareList(this, options.target),\n results = !flat && scopes.length > 1 ? {} : [],\n _addOne = function _addOne(scope, obj) {\n if (!flat && scopes.length > 1) {\n var ss = results[scope];\n if (ss == null) {\n ss = results[scope] = [];\n }\n ss.push(obj);\n } else {\n results.push(obj);\n }\n };\n for (var j = 0, jj = this.connections.length; j < jj; j++) {\n var _c2 = this.connections[j],\n sourceId = _c2.proxies && _c2.proxies[0] ? _c2.proxies[0].originalEp.elementId : _c2.sourceId,\n targetId = _c2.proxies && _c2.proxies[1] ? _c2.proxies[1].originalEp.elementId : _c2.targetId;\n if (filterList(scopes, _c2.scope) && filterList(sources, sourceId) && filterList(targets, targetId)) {\n _addOne(_c2.scope, _c2);\n }\n }\n return results;\n }\n }, {\n key: "select",\n value: function select(params) {\n params = params || {};\n params.scope = params.scope || "*";\n return new ConnectionSelection(this, params.connections || this.getConnections(params, true));\n }\n }, {\n key: "selectEndpoints",\n value: function selectEndpoints(params) {\n params = params || {};\n params.scope = params.scope || WILDCARD;\n var noElementFilters = !params.element && !params.source && !params.target,\n elements = noElementFilters ? WILDCARD : prepareList(this, params.element),\n sources = noElementFilters ? WILDCARD : prepareList(this, params.source),\n targets = noElementFilters ? WILDCARD : prepareList(this, params.target),\n scopes = prepareList(this, params.scope, true);\n var ep = [];\n for (var _el2 in this.endpointsByElement) {\n var either = filterList(elements, _el2, true),\n source = filterList(sources, _el2, true),\n sourceMatchExact = sources !== "*",\n target = filterList(targets, _el2, true),\n targetMatchExact = targets !== "*";\n if (either || source || target) {\n inner: for (var i = 0, ii = this.endpointsByElement[_el2].length; i < ii; i++) {\n var _ep = this.endpointsByElement[_el2][i];\n if (filterList(scopes, _ep.scope, true)) {\n var noMatchSource = sourceMatchExact && sources.length > 0 && !_ep.isSource,\n noMatchTarget = targetMatchExact && targets.length > 0 && !_ep.isTarget;\n if (noMatchSource || noMatchTarget) {\n continue inner;\n }\n ep.push(_ep);\n }\n }\n }\n }\n return new EndpointSelection(this, ep);\n }\n }, {\n key: "setContainer",\n value: function setContainer(c) {\n this._container = c;\n this.fire(EVENT_CONTAINER_CHANGE, this._container);\n }\n }, {\n key: "_set",\n value: function _set(c, el, idx) {\n var stTypes = [{\n el: "source",\n elId: "sourceId"\n }, {\n el: "target",\n elId: "targetId"\n }];\n var ep,\n _st = stTypes[idx],\n cId = c[_st.elId],\n sid,\n oldEndpoint = c.endpoints[idx];\n var evtParams = {\n index: idx,\n originalEndpoint: oldEndpoint,\n originalSourceId: idx === 0 ? cId : c.sourceId,\n newSourceId: c.sourceId,\n originalTargetId: idx === 1 ? cId : c.targetId,\n newTargetId: c.targetId,\n connection: c,\n newEndpoint: oldEndpoint\n };\n if (el instanceof Endpoint) {\n ep = el;\n ep.addConnection(c);\n } else {\n sid = this.getId(el);\n if (sid === c[_st.elId]) {\n ep = null;\n } else {\n ep = c.makeEndpoint(idx === 0, el, sid);\n }\n }\n if (ep != null) {\n evtParams.newEndpoint = ep;\n oldEndpoint.detachFromConnection(c);\n c.endpoints[idx] = ep;\n c[_st.el] = ep.element;\n c[_st.elId] = ep.elementId;\n evtParams[idx === 0 ? "newSourceId" : "newTargetId"] = ep.elementId;\n this.fireMoveEvent(evtParams);\n this._paintConnection(c);\n }\n return evtParams;\n }\n }, {\n key: "setSource",\n value: function setSource(connection, el) {\n removeManagedConnection(connection, this._managedElements[connection.sourceId]);\n var p = this._set(connection, el, 0);\n addManagedConnection(connection, this._managedElements[p.newSourceId]);\n }\n }, {\n key: "setTarget",\n value: function setTarget(connection, el) {\n removeManagedConnection(connection, this._managedElements[connection.targetId]);\n var p = this._set(connection, el, 1);\n addManagedConnection(connection, this._managedElements[p.newTargetId]);\n }\n }, {\n key: "setConnectionType",\n value: function setConnectionType(connection, type, params) {\n connection.setType(type, params);\n this._paintConnection(connection);\n }\n }, {\n key: "isHoverSuspended",\n value: function isHoverSuspended() {\n return this.hoverSuspended;\n }\n }, {\n key: "setSuspendDrawing",\n value: function setSuspendDrawing(val, repaintAfterwards) {\n var curVal = this._suspendDrawing;\n this._suspendDrawing = val;\n if (val) {\n this._suspendedAt = "" + new Date().getTime();\n } else {\n this._suspendedAt = null;\n this.viewport.recomputeBounds();\n }\n if (repaintAfterwards) {\n this.repaintEverything();\n }\n return curVal;\n }\n }, {\n key: "getSuspendedAt",\n value: function getSuspendedAt() {\n return this._suspendedAt;\n }\n }, {\n key: "batch",\n value: function batch(fn, doNotRepaintAfterwards) {\n var _wasSuspended = this._suspendDrawing === true;\n if (!_wasSuspended) {\n this.setSuspendDrawing(true);\n }\n fn();\n if (!_wasSuspended) {\n this.setSuspendDrawing(false, !doNotRepaintAfterwards);\n }\n }\n }, {\n key: "each",\n value: function each(spec, fn) {\n if (spec == null) {\n return;\n }\n if (spec.length != null) {\n for (var i = 0; i < spec.length; i++) {\n fn(spec[i]);\n }\n } else {\n fn(spec);\n }\n return this;\n }\n }, {\n key: "updateOffset",\n value: function updateOffset(params) {\n var elId = params.elId;\n if (params.recalc) {\n return this.viewport.refreshElement(elId);\n } else {\n return this.viewport.getPosition(elId);\n }\n }\n }, {\n key: "deleteConnection",\n value: function deleteConnection(connection, params) {\n if (connection != null && connection.deleted !== true) {\n params = params || {};\n if (params.force || functionChain(true, false, [[connection.endpoints[0], IS_DETACH_ALLOWED, [connection]], [connection.endpoints[1], IS_DETACH_ALLOWED, [connection]], [connection, IS_DETACH_ALLOWED, [connection]], [this, CHECK_CONDITION, [INTERCEPT_BEFORE_DETACH, connection]]])) {\n removeManagedConnection(connection, this._managedElements[connection.sourceId], this._managedElements[connection.targetId]);\n this.fireDetachEvent(connection, !connection.pending && params.fireEvent !== false, params.originalEvent);\n var _sourceEndpoint = connection.endpoints[0];\n var targetEndpoint = connection.endpoints[1];\n if (_sourceEndpoint !== params.endpointToIgnore) {\n _sourceEndpoint.detachFromConnection(connection, null, true);\n }\n if (targetEndpoint !== params.endpointToIgnore) {\n targetEndpoint.detachFromConnection(connection, null, true);\n }\n removeWithFunction(this.connections, function (_c) {\n return connection.id === _c.id;\n });\n connection.destroy();\n if (_sourceEndpoint !== params.endpointToIgnore && _sourceEndpoint.deleteOnEmpty && _sourceEndpoint.connections.length === 0) {\n this.deleteEndpoint(_sourceEndpoint);\n }\n if (targetEndpoint !== params.endpointToIgnore && targetEndpoint.deleteOnEmpty && targetEndpoint.connections.length === 0) {\n this.deleteEndpoint(targetEndpoint);\n }\n return true;\n }\n }\n return false;\n }\n }, {\n key: "deleteEveryConnection",\n value: function deleteEveryConnection(params) {\n var _this2 = this;\n params = params || {};\n var count = this.connections.length,\n deletedCount = 0;\n this.batch(function () {\n for (var i = 0; i < count; i++) {\n deletedCount += _this2.deleteConnection(_this2.connections[0], params) ? 1 : 0;\n }\n });\n return deletedCount;\n }\n }, {\n key: "deleteConnectionsForElement",\n value: function deleteConnectionsForElement(el, params) {\n var id = this.getId(el),\n m = this._managedElements[id];\n if (m) {\n var l = m.connections.length;\n for (var i = 0; i < l; i++) {\n this.deleteConnection(m.connections[0], params);\n }\n }\n return this;\n }\n }, {\n key: "fireDetachEvent",\n value: function fireDetachEvent(jpc, doFireEvent, originalEvent) {\n var argIsConnection = jpc.id != null,\n params = argIsConnection ? {\n connection: jpc,\n source: jpc.source,\n target: jpc.target,\n sourceId: jpc.sourceId,\n targetId: jpc.targetId,\n sourceEndpoint: jpc.endpoints[0],\n targetEndpoint: jpc.endpoints[1]\n } : jpc;\n if (doFireEvent) {\n this.fire(EVENT_CONNECTION_DETACHED, params, originalEvent);\n }\n this.fire(EVENT_INTERNAL_CONNECTION_DETACHED, params, originalEvent);\n }\n }, {\n key: "fireMoveEvent",\n value: function fireMoveEvent(params, evt) {\n this.fire(EVENT_CONNECTION_MOVED, params, evt);\n }\n }, {\n key: "manageAll",\n value: function manageAll(elements, recalc) {\n var nl = isString(elements) ? this.getSelector(this.getContainer(), elements) : elements;\n for (var i = 0; i < nl.length; i++) {\n this.manage(nl[i], null, recalc);\n }\n }\n }, {\n key: "manage",\n value: function manage(element, internalId, _recalc) {\n if (this.getAttribute(element, ATTRIBUTE_MANAGED) == null) {\n internalId = internalId || this.getAttribute(element, "id") || uuid();\n this.setAttribute(element, ATTRIBUTE_MANAGED, internalId);\n }\n var elId = this.getId(element);\n if (!this._managedElements[elId]) {\n var obj = {\n el: element,\n endpoints: [],\n connections: [],\n rotation: 0,\n data: {}\n };\n this._managedElements[elId] = obj;\n if (this._suspendDrawing) {\n obj.viewportElement = this.viewport.registerElement(elId, true);\n } else {\n obj.viewportElement = this.updateOffset({\n elId: elId,\n recalc: true\n });\n }\n this.fire(EVENT_MANAGE_ELEMENT, {\n el: element\n });\n } else {\n if (_recalc) {\n this._managedElements[elId].viewportElement = this.updateOffset({\n elId: elId,\n timestamp: null,\n recalc: true\n });\n }\n }\n return this._managedElements[elId];\n }\n }, {\n key: "getManagedData",\n value: function getManagedData(elementId, dataIdentifier, key) {\n if (this._managedElements[elementId]) {\n var data = this._managedElements[elementId].data[dataIdentifier];\n return data != null ? data[key] : null;\n }\n }\n }, {\n key: "setManagedData",\n value: function setManagedData(elementId, dataIdentifier, key, data) {\n if (this._managedElements[elementId]) {\n this._managedElements[elementId].data[dataIdentifier] = this._managedElements[elementId].data[dataIdentifier] || {};\n this._managedElements[elementId].data[dataIdentifier][key] = data;\n }\n }\n }, {\n key: "getManagedElement",\n value: function getManagedElement(id) {\n return this._managedElements[id] ? this._managedElements[id].el : null;\n }\n }, {\n key: "unmanage",\n value: function unmanage(el, removeElement) {\n var _this3 = this;\n this.removeAllEndpoints(el, true);\n var _one = function _one(_el) {\n var id = _this3.getId(_el);\n _this3.removeAttribute(_el, ATTRIBUTE_MANAGED);\n delete _this3._managedElements[id];\n _this3.viewport.remove(id);\n _this3.fire(EVENT_UNMANAGE_ELEMENT, {\n el: _el,\n id: id\n });\n if (_el && removeElement) {\n _this3._removeElement(_el);\n }\n };\n this._getAssociatedElements(el).map(_one);\n _one(el);\n }\n }, {\n key: "rotate",\n value: function rotate(element, rotation, _doNotRepaint) {\n var elementId = this.getId(element);\n if (this._managedElements[elementId]) {\n this._managedElements[elementId].rotation = rotation;\n this.viewport.rotateElement(elementId, rotation);\n if (_doNotRepaint !== true) {\n return this.revalidate(element);\n }\n }\n return {\n c: new Set(),\n e: new Set()\n };\n }\n }, {\n key: "_getRotation",\n value: function _getRotation(elementId) {\n var entry = this._managedElements[elementId];\n if (entry != null) {\n return entry.rotation || 0;\n } else {\n return 0;\n }\n }\n }, {\n key: "_getRotations",\n value: function _getRotations(elementId) {\n var _this4 = this;\n var rotations = [];\n var entry = this._managedElements[elementId];\n var _oneLevel = function _oneLevel(e) {\n if (e.group != null) {\n var gEntry = _this4._managedElements[e.group];\n if (gEntry != null) {\n rotations.push({\n r: gEntry.viewportElement.r,\n c: gEntry.viewportElement.c\n });\n _oneLevel(gEntry);\n }\n }\n };\n if (entry != null) {\n rotations.push({\n r: entry.viewportElement.r || 0,\n c: entry.viewportElement.c\n });\n _oneLevel(entry);\n }\n return rotations;\n }\n }, {\n key: "_applyRotations",\n value: function _applyRotations(point, rotations) {\n var sl = point.slice();\n var current = {\n x: sl[0],\n y: sl[1],\n cr: 0,\n sr: 0\n };\n forEach(rotations, function (rotation) {\n current = rotatePoint(current, rotation.c, rotation.r);\n });\n return current;\n }\n }, {\n key: "_applyRotationsXY",\n value: function _applyRotationsXY(point, rotations) {\n forEach(rotations, function (rotation) {\n point = rotatePoint(point, rotation.c, rotation.r);\n });\n return point;\n }\n }, {\n key: "_internal_newEndpoint",\n value: function _internal_newEndpoint(params) {\n var _p = extend({}, params);\n var managedElement = this.manage(_p.element);\n _p.elementId = this.getId(_p.element);\n _p.id = "ep_" + this._idstamp();\n var ep = new Endpoint(this, _p);\n addManagedEndpoint(managedElement, ep);\n if (params.uuid) {\n this.endpointsByUUID.set(params.uuid, ep);\n }\n addToDictionary(this.endpointsByElement, ep.elementId, ep);\n if (!this._suspendDrawing) {\n this._paintEndpoint(ep, {\n timestamp: this._suspendedAt\n });\n }\n return ep;\n }\n }, {\n key: "_deriveEndpointAndAnchorSpec",\n value: function _deriveEndpointAndAnchorSpec(type, dontPrependDefault) {\n var bits = ((dontPrependDefault ? "" : "default ") + type).split(/[\\s]/),\n eps = null,\n ep = null,\n a = null,\n as = null;\n for (var i = 0; i < bits.length; i++) {\n var _t = this.getConnectionType(bits[i]);\n if (_t) {\n if (_t.endpoints) {\n eps = _t.endpoints;\n }\n if (_t.endpoint) {\n ep = _t.endpoint;\n }\n if (_t.anchors) {\n as = _t.anchors;\n }\n if (_t.anchor) {\n a = _t.anchor;\n }\n }\n }\n return {\n endpoints: eps ? eps : [ep, ep],\n anchors: as ? as : [a, a]\n };\n }\n }, {\n key: "revalidate",\n value: function revalidate(el, timestamp) {\n var elId = this.getId(el);\n this.updateOffset({\n elId: elId,\n recalc: true,\n timestamp: timestamp\n });\n return this.repaint(el);\n }\n }, {\n key: "repaintEverything",\n value: function repaintEverything() {\n var timestamp = uuid(),\n elId;\n for (elId in this._managedElements) {\n this.viewport.refreshElement(elId, true);\n }\n this.viewport.recomputeBounds();\n for (elId in this._managedElements) {\n this.repaint(this._managedElements[elId].el, timestamp, true);\n }\n return this;\n }\n }, {\n key: "setElementPosition",\n value: function setElementPosition(el, x, y) {\n var id = this.getId(el);\n this.viewport.setPosition(id, x, y);\n return this.repaint(el);\n }\n }, {\n key: "repaint",\n value: function repaint(el, timestamp, offsetsWereJustCalculated) {\n var r = {\n c: new Set(),\n e: new Set()\n };\n var _mergeRedraw = function _mergeRedraw(r2) {\n r2.c.forEach(function (c) {\n return r.c.add(c);\n });\n r2.e.forEach(function (e) {\n return r.e.add(e);\n });\n };\n if (!this._suspendDrawing) {\n var id = this.getId(el);\n if (el != null) {\n var repaintEls = this._getAssociatedElements(el);\n if (timestamp == null) {\n timestamp = uuid();\n }\n if (!offsetsWereJustCalculated) {\n for (var i = 0; i < repaintEls.length; i++) {\n this.updateOffset({\n elId: this.getId(repaintEls[i]),\n recalc: true,\n timestamp: timestamp\n });\n }\n }\n _mergeRedraw(this.router.redraw(id, timestamp, null));\n if (repaintEls.length > 0) {\n for (var j = 0; j < repaintEls.length; j++) {\n _mergeRedraw(this.router.redraw(this.getId(repaintEls[j]), timestamp, null));\n }\n }\n }\n }\n return r;\n }\n }, {\n key: "unregisterEndpoint",\n value: function unregisterEndpoint(endpoint) {\n var uuid = endpoint.getUuid();\n if (uuid) {\n this.endpointsByUUID["delete"](uuid);\n }\n removeManagedEndpoint(this._managedElements[endpoint.elementId], endpoint);\n var ebe = this.endpointsByElement[endpoint.elementId];\n if (ebe != null) {\n this.endpointsByElement[endpoint.elementId] = ebe.filter(function (e) {\n return e !== endpoint;\n });\n }\n this.fire(EVENT_INTERNAL_ENDPOINT_UNREGISTERED, endpoint);\n }\n }, {\n key: "_maybePruneEndpoint",\n value: function _maybePruneEndpoint(endpoint) {\n if (endpoint.deleteOnEmpty && endpoint.connections.length === 0) {\n this.deleteEndpoint(endpoint);\n return true;\n } else {\n return false;\n }\n }\n }, {\n key: "deleteEndpoint",\n value: function deleteEndpoint(object) {\n var _this5 = this;\n var endpoint = typeof object === "string" ? this.endpointsByUUID.get(object) : object;\n if (endpoint) {\n var proxy = endpoint.proxiedBy;\n var connectionsToDelete = endpoint.connections.slice();\n forEach(connectionsToDelete, function (connection) {\n endpoint.detachFromConnection(connection, null, true);\n });\n this.unregisterEndpoint(endpoint);\n endpoint.destroy();\n forEach(connectionsToDelete, function (connection) {\n _this5.deleteConnection(connection, {\n force: true,\n endpointToIgnore: endpoint\n });\n });\n if (proxy != null) {\n this.deleteEndpoint(proxy);\n }\n }\n return this;\n }\n }, {\n key: "addEndpoint",\n value: function addEndpoint(el, params, referenceParams) {\n referenceParams = referenceParams || {};\n var p = extend({}, referenceParams);\n extend(p, params || {});\n var _p = extend({\n element: el\n }, p);\n return this._internal_newEndpoint(_p);\n }\n }, {\n key: "addEndpoints",\n value: function addEndpoints(el, endpoints, referenceParams) {\n var results = [];\n for (var i = 0, j = endpoints.length; i < j; i++) {\n results.push(this.addEndpoint(el, endpoints[i], referenceParams));\n }\n return results;\n }\n }, {\n key: "reset",\n value: function reset() {\n var _this6 = this;\n this.silently(function () {\n _this6.endpointsByElement = {};\n _this6._managedElements = {};\n _this6.endpointsByUUID.clear();\n _this6.viewport.reset();\n _this6.router.reset();\n _this6.groupManager.reset();\n _this6.connections.length = 0;\n });\n }\n }, {\n key: "destroy",\n value: function destroy() {\n this.reset();\n this.unbind();\n this.sourceSelectors.length = 0;\n this.targetSelectors.length = 0;\n this._connectionTypes.clear();\n this._endpointTypes.clear();\n }\n }, {\n key: "getEndpoints",\n value: function getEndpoints(el) {\n return this.endpointsByElement[this.getId(el)] || [];\n }\n }, {\n key: "getEndpoint",\n value: function getEndpoint(uuid) {\n return this.endpointsByUUID.get(uuid);\n }\n }, {\n key: "setEndpointUuid",\n value: function setEndpointUuid(endpoint, uuid) {\n if (endpoint.uuid) {\n this.endpointsByUUID["delete"](endpoint.uuid);\n }\n endpoint.uuid = uuid;\n this.endpointsByUUID.set(uuid, endpoint);\n }\n }, {\n key: "connect",\n value: function connect(params, referenceParams) {\n try {\n var _p = this._prepareConnectionParams(params, referenceParams),\n jpc = this._newConnection(_p);\n this._finaliseConnection(jpc, _p);\n return jpc;\n } catch (errorMessage) {\n log(errorMessage);\n return;\n }\n }\n }, {\n key: "_prepareConnectionParams",\n value: function _prepareConnectionParams(params, referenceParams) {\n var temp = extend({}, params);\n if (referenceParams) {\n extend(temp, referenceParams);\n }\n var _p = temp;\n if (_p.source) {\n if (_p.source.endpoint) {\n _p.sourceEndpoint = _p.source;\n }\n }\n if (_p.target) {\n if (_p.target.endpoint) {\n _p.targetEndpoint = _p.target;\n }\n }\n if (params.uuids) {\n _p.sourceEndpoint = this.getEndpoint(params.uuids[0]);\n _p.targetEndpoint = this.getEndpoint(params.uuids[1]);\n }\n if (_p.sourceEndpoint != null) {\n if (_p.sourceEndpoint.isFull()) {\n throw ERROR_SOURCE_ENDPOINT_FULL;\n }\n if (!_p.type) {\n _p.type = _p.sourceEndpoint.edgeType;\n }\n if (_p.sourceEndpoint.connectorOverlays) {\n _p.overlays = _p.overlays || [];\n for (var i = 0, j = _p.sourceEndpoint.connectorOverlays.length; i < j; i++) {\n _p.overlays.push(_p.sourceEndpoint.connectorOverlays[i]);\n }\n }\n if (_p.sourceEndpoint.scope) {\n _p.scope = _p.sourceEndpoint.scope;\n }\n } else {\n if (_p.source == null) {\n throw ERROR_SOURCE_DOES_NOT_EXIST;\n }\n }\n if (_p.targetEndpoint != null) {\n if (_p.targetEndpoint.isFull()) {\n throw ERROR_TARGET_ENDPOINT_FULL;\n }\n } else {\n if (_p.target == null) {\n throw ERROR_TARGET_DOES_NOT_EXIST;\n }\n }\n if (_p.sourceEndpoint && _p.targetEndpoint) {\n if (!_scopeMatch(_p.sourceEndpoint, _p.targetEndpoint)) {\n throw "Cannot establish connection: scopes do not match";\n }\n }\n return _p;\n }\n }, {\n key: "_newConnection",\n value: function _newConnection(params) {\n params.id = "con_" + this._idstamp();\n var c = new Connection(this, params);\n addManagedConnection(c, this._managedElements[c.sourceId], this._managedElements[c.targetId]);\n this._paintConnection(c);\n return c;\n }\n }, {\n key: "_finaliseConnection",\n value: function _finaliseConnection(jpc, params, originalEvent) {\n params = params || {};\n if (!jpc.suspendedEndpoint) {\n this.connections.push(jpc);\n }\n jpc.pending = null;\n jpc.endpoints[0].isTemporarySource = false;\n this.repaint(jpc.source);\n var payload = {\n connection: jpc,\n source: jpc.source,\n target: jpc.target,\n sourceId: jpc.sourceId,\n targetId: jpc.targetId,\n sourceEndpoint: jpc.endpoints[0],\n targetEndpoint: jpc.endpoints[1]\n };\n this.fire(EVENT_INTERNAL_CONNECTION, payload, originalEvent);\n if (!params.doNotFireConnectionEvent && params.fireEvent !== false) {\n this.fire(EVENT_CONNECTION, payload, originalEvent);\n }\n }\n }, {\n key: "removeAllEndpoints",\n value: function removeAllEndpoints(el, recurse) {\n var _this7 = this;\n var _one = function _one(_el) {\n var id = _this7.getId(_el),\n ebe = _this7.endpointsByElement[id],\n i,\n ii;\n if (ebe) {\n for (i = 0, ii = ebe.length; i < ii; i++) {\n _this7.deleteEndpoint(ebe[i]);\n }\n }\n delete _this7.endpointsByElement[id];\n };\n if (recurse) {\n this._getAssociatedElements(el).map(_one);\n }\n _one(el);\n return this;\n }\n }, {\n key: "_createSourceDefinition",\n value: function _createSourceDefinition(params, referenceParams) {\n var p = extend({}, referenceParams);\n extend(p, params);\n p.edgeType = p.edgeType || DEFAULT;\n var aae = this._deriveEndpointAndAnchorSpec(p.edgeType);\n p.endpoint = p.endpoint || aae.endpoints[0];\n p.anchor = p.anchor || aae.anchors[0];\n var maxConnections = p.maxConnections || -1;\n var _def = {\n def: extend({}, p),\n uniqueEndpoint: p.uniqueEndpoint,\n maxConnections: maxConnections,\n enabled: true,\n endpoint: null\n };\n return _def;\n }\n }, {\n key: "addSourceSelector",\n value: function addSourceSelector(selector, params) {\n var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var _def = this._createSourceDefinition(params);\n var sel = new ConnectionDragSelector(selector, _def, exclude);\n this.sourceSelectors.push(sel);\n return sel;\n }\n }, {\n key: "removeSourceSelector",\n value: function removeSourceSelector(selector) {\n removeWithFunction(this.sourceSelectors, function (s) {\n return s === selector;\n });\n }\n }, {\n key: "removeTargetSelector",\n value: function removeTargetSelector(selector) {\n removeWithFunction(this.targetSelectors, function (s) {\n return s === selector;\n });\n }\n }, {\n key: "addTargetSelector",\n value: function addTargetSelector(selector, params) {\n var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var _def = this._createTargetDefinition(params);\n var sel = new ConnectionDragSelector(selector, _def, exclude);\n this.targetSelectors.push(sel);\n return sel;\n }\n }, {\n key: "_createTargetDefinition",\n value: function _createTargetDefinition(params, referenceParams) {\n var p = extend({}, referenceParams);\n extend(p, params);\n p.edgeType = p.edgeType || DEFAULT;\n var maxConnections = p.maxConnections || -1;\n var _def = {\n def: extend({}, p),\n uniqueEndpoint: p.uniqueEndpoint,\n maxConnections: maxConnections,\n enabled: true,\n endpoint: null\n };\n return _def;\n }\n }, {\n key: "show",\n value: function show(el, changeEndpoints) {\n return this._setVisible(el, BLOCK, changeEndpoints);\n }\n }, {\n key: "hide",\n value: function hide(el, changeEndpoints) {\n return this._setVisible(el, NONE, changeEndpoints);\n }\n }, {\n key: "_setVisible",\n value: function _setVisible(el, state, alsoChangeEndpoints) {\n var visible = state === BLOCK;\n var endpointFunc = null;\n if (alsoChangeEndpoints) {\n endpointFunc = function endpointFunc(ep) {\n ep.setVisible(visible, true, true);\n };\n }\n var id = this.getId(el);\n this._operation(el, function (jpc) {\n if (visible && alsoChangeEndpoints) {\n var oidx = jpc.sourceId === id ? 1 : 0;\n if (jpc.endpoints[oidx].isVisible()) {\n jpc.setVisible(true);\n }\n } else {\n jpc.setVisible(visible);\n }\n }, endpointFunc);\n return this;\n }\n }, {\n key: "toggleVisible",\n value: function toggleVisible(el, changeEndpoints) {\n var endpointFunc = null;\n if (changeEndpoints) {\n endpointFunc = function endpointFunc(ep) {\n var state = ep.isVisible();\n ep.setVisible(!state);\n };\n }\n this._operation(el, function (jpc) {\n var state = jpc.isVisible();\n jpc.setVisible(!state);\n }, endpointFunc);\n }\n }, {\n key: "_operation",\n value: function _operation(el, func, endpointFunc) {\n var elId = this.getId(el);\n var endpoints = this.endpointsByElement[elId];\n if (endpoints && endpoints.length) {\n for (var i = 0, ii = endpoints.length; i < ii; i++) {\n for (var j = 0, jj = endpoints[i].connections.length; j < jj; j++) {\n var retVal = func(endpoints[i].connections[j]);\n if (retVal) {\n return;\n }\n }\n if (endpointFunc) {\n endpointFunc(endpoints[i]);\n }\n }\n }\n }\n }, {\n key: "registerConnectionType",\n value: function registerConnectionType(id, type) {\n this._connectionTypes.set(id, extend({}, type));\n if (type.overlays) {\n var to = {};\n for (var i = 0; i < type.overlays.length; i++) {\n var fo = convertToFullOverlaySpec(type.overlays[i]);\n to[fo.options.id] = fo;\n }\n this._connectionTypes.get(id).overlays = to;\n }\n }\n }, {\n key: "registerConnectionTypes",\n value: function registerConnectionTypes(types) {\n for (var i in types) {\n this.registerConnectionType(i, types[i]);\n }\n }\n }, {\n key: "registerEndpointType",\n value: function registerEndpointType(id, type) {\n this._endpointTypes.set(id, extend({}, type));\n if (type.overlays) {\n var to = {};\n for (var i = 0; i < type.overlays.length; i++) {\n var fo = convertToFullOverlaySpec(type.overlays[i]);\n to[fo.options.id] = fo;\n }\n this._endpointTypes.get(id).overlays = to;\n }\n }\n }, {\n key: "registerEndpointTypes",\n value: function registerEndpointTypes(types) {\n for (var i in types) {\n this.registerEndpointType(i, types[i]);\n }\n }\n }, {\n key: "getType",\n value: function getType(id, typeDescriptor) {\n return typeDescriptor === "connection" ? this.getConnectionType(id) : this.getEndpointType(id);\n }\n }, {\n key: "getConnectionType",\n value: function getConnectionType(id) {\n return this._connectionTypes.get(id);\n }\n }, {\n key: "getEndpointType",\n value: function getEndpointType(id) {\n return this._endpointTypes.get(id);\n }\n }, {\n key: "importDefaults",\n value: function importDefaults(d) {\n for (var i in d) {\n this.defaults[i] = d[i];\n }\n if (this.defaults[DEFAULT_KEY_PAINT_STYLE] != null) {\n this.defaults[DEFAULT_KEY_PAINT_STYLE].strokeWidth = this.defaults[DEFAULT_KEY_PAINT_STYLE].strokeWidth || 2;\n }\n if (d.container) {\n this.setContainer(d.container);\n }\n return this;\n }\n }, {\n key: "restoreDefaults",\n value: function restoreDefaults() {\n this.defaults = extend({}, this._initialDefaults);\n return this;\n }\n }, {\n key: "getManagedElements",\n value: function getManagedElements() {\n return this._managedElements;\n }\n }, {\n key: "proxyConnection",\n value: function proxyConnection(connection, index, proxyEl, endpointGenerator, anchorGenerator) {\n var alreadyProxied = connection.proxies[index] != null,\n proxyEp,\n originalElementId = alreadyProxied ? connection.proxies[index].originalEp.elementId : connection.endpoints[index].elementId,\n originalEndpoint = alreadyProxied ? connection.proxies[index].originalEp : connection.endpoints[index],\n proxyElId = this.getId(proxyEl);\n if (connection.proxies[index]) {\n if (connection.proxies[index].ep.elementId === proxyElId) {\n proxyEp = connection.proxies[index].ep;\n } else {\n connection.proxies[index].ep.detachFromConnection(connection, index);\n proxyEp = this._internal_newEndpoint({\n element: proxyEl,\n endpoint: endpointGenerator(connection, index),\n anchor: anchorGenerator(connection, index),\n parameters: {\n isProxyEndpoint: true\n }\n });\n }\n } else {\n proxyEp = this._internal_newEndpoint({\n element: proxyEl,\n endpoint: endpointGenerator(connection, index),\n anchor: anchorGenerator(connection, index),\n parameters: {\n isProxyEndpoint: true\n }\n });\n }\n proxyEp.deleteOnEmpty = true;\n connection.proxies[index] = {\n ep: proxyEp,\n originalEp: originalEndpoint\n };\n this.sourceOrTargetChanged(originalElementId, proxyElId, connection, proxyEl, index);\n originalEndpoint.detachFromConnection(connection, null, true);\n proxyEp.connections = [connection];\n connection.endpoints[index] = proxyEp;\n originalEndpoint.proxiedBy = proxyEp;\n originalEndpoint.setVisible(false);\n connection.setVisible(true);\n this.revalidate(proxyEl);\n }\n }, {\n key: "unproxyConnection",\n value: function unproxyConnection(connection, index) {\n if (connection.proxies == null || connection.proxies[index] == null) {\n return;\n }\n var originalElement = connection.proxies[index].originalEp.element,\n originalElementId = connection.proxies[index].originalEp.elementId,\n proxyElId = connection.proxies[index].ep.elementId;\n connection.endpoints[index] = connection.proxies[index].originalEp;\n delete connection.proxies[index].originalEp.proxiedBy;\n this.sourceOrTargetChanged(proxyElId, originalElementId, connection, originalElement, index);\n connection.proxies[index].ep.detachFromConnection(connection, null);\n connection.proxies[index].originalEp.addConnection(connection);\n if (connection.isVisible()) {\n connection.proxies[index].originalEp.setVisible(true);\n }\n connection.proxies[index] = null;\n if (findWithFunction(connection.proxies, function (p) {\n return p != null;\n }) === -1) {\n connection.proxies.length = 0;\n }\n }\n }, {\n key: "sourceOrTargetChanged",\n value: function sourceOrTargetChanged(originalId, newId, connection, newElement, index) {\n if (originalId !== newId) {\n if (index === 0) {\n connection.sourceId = newId;\n connection.source = newElement;\n } else if (index === 1) {\n connection.targetId = newId;\n connection.target = newElement;\n }\n removeManagedConnection(connection, this._managedElements[originalId]);\n addManagedConnection(connection, this._managedElements[newId]);\n }\n }\n }, {\n key: "getGroup",\n value:\n function getGroup(groupId) {\n return this.groupManager.getGroup(groupId);\n }\n }, {\n key: "getGroupFor",\n value: function getGroupFor(el) {\n return this.groupManager.getGroupFor(el);\n }\n }, {\n key: "addGroup",\n value: function addGroup(params) {\n return this.groupManager.addGroup(params);\n }\n }, {\n key: "addToGroup",\n value: function addToGroup(group) {\n var _this$groupManager;\n for (var _len = arguments.length, el = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n el[_key - 1] = arguments[_key];\n }\n return (_this$groupManager = this.groupManager).addToGroup.apply(_this$groupManager, [group, false].concat(el));\n }\n }, {\n key: "collapseGroup",\n value: function collapseGroup(group) {\n this.groupManager.collapseGroup(group);\n }\n }, {\n key: "expandGroup",\n value: function expandGroup(group) {\n this.groupManager.expandGroup(group);\n }\n }, {\n key: "toggleGroup",\n value: function toggleGroup(group) {\n this.groupManager.toggleGroup(group);\n }\n }, {\n key: "removeGroup",\n value: function removeGroup(group, deleteMembers, _manipulateView, _doNotFireEvent) {\n return this.groupManager.removeGroup(group, deleteMembers, _manipulateView, _doNotFireEvent);\n }\n }, {\n key: "removeAllGroups",\n value: function removeAllGroups(deleteMembers, _manipulateView) {\n this.groupManager.removeAllGroups(deleteMembers, _manipulateView, false);\n }\n }, {\n key: "removeFromGroup",\n value: function removeFromGroup(group, el, _doNotFireEvent) {\n this.groupManager.removeFromGroup(group, _doNotFireEvent, el);\n this._appendElement(el, this.getContainer());\n this.updateOffset({\n recalc: true,\n elId: this.getId(el)\n });\n }\n }, {\n key: "_paintEndpoint",\n value: function _paintEndpoint(endpoint, params) {\n function findConnectionToUseForDynamicAnchor(ep) {\n var idx = 0;\n if (params.elementWithPrecedence != null) {\n for (var i = 0; i < ep.connections.length; i++) {\n if (ep.connections[i].sourceId === params.elementWithPrecedence || ep.connections[i].targetId === params.elementWithPrecedence) {\n idx = i;\n break;\n }\n }\n }\n return ep.connections[idx];\n }\n params = params || {};\n var timestamp = params.timestamp,\n recalc = !(params.recalc === false);\n if (!timestamp || endpoint.timestamp !== timestamp) {\n var info = this.viewport.getPosition(endpoint.elementId);\n var xy = params.offset ? {\n x: params.offset.x,\n y: params.offset.y\n } : {\n x: info.x,\n y: info.y\n };\n if (xy != null) {\n var ap = params.anchorLoc;\n if (ap == null) {\n var anchorParams = {\n xy: xy,\n wh: info,\n element: endpoint,\n timestamp: timestamp\n };\n if (recalc && this.router.isDynamicAnchor(endpoint) && endpoint.connections.length > 0) {\n var _c3 = findConnectionToUseForDynamicAnchor(endpoint),\n oIdx = _c3.endpoints[0] === endpoint ? 1 : 0,\n oId = oIdx === 0 ? _c3.sourceId : _c3.targetId,\n oInfo = this.viewport.getPosition(oId);\n anchorParams.index = oIdx === 0 ? 1 : 0;\n anchorParams.connection = _c3;\n anchorParams.txy = oInfo;\n anchorParams.twh = oInfo;\n anchorParams.tElement = _c3.endpoints[oIdx];\n anchorParams.tRotation = this._getRotations(oId);\n } else if (endpoint.connections.length > 0) {\n anchorParams.connection = endpoint.connections[0];\n }\n anchorParams.rotation = this._getRotations(endpoint.elementId);\n ap = this.router.computeAnchorLocation(endpoint._anchor, anchorParams);\n }\n endpoint.endpoint.compute(ap, this.router.getEndpointOrientation(endpoint), endpoint.paintStyleInUse);\n this.renderEndpoint(endpoint, endpoint.paintStyleInUse);\n endpoint.timestamp = timestamp;\n for (var i in endpoint.overlays) {\n if (endpoint.overlays.hasOwnProperty(i)) {\n var _o = endpoint.overlays[i];\n if (_o.isVisible()) {\n endpoint.overlayPlacements[i] = this.drawOverlay(_o, endpoint.endpoint, endpoint.paintStyleInUse, endpoint.getAbsoluteOverlayPosition(_o));\n this._paintOverlay(_o, endpoint.overlayPlacements[i], {\n xmin: 0,\n ymin: 0\n });\n }\n }\n }\n }\n }\n }\n }, {\n key: "_paintConnection",\n value: function _paintConnection(connection, params) {\n if (!this._suspendDrawing && connection.visible !== false) {\n params = params || {};\n var timestamp = params.timestamp;\n if (timestamp != null && timestamp === connection.lastPaintedAt) {\n return;\n }\n if (timestamp == null || timestamp !== connection.lastPaintedAt) {\n this.router.computePath(connection, timestamp);\n var overlayExtents = {\n xmin: Infinity,\n ymin: Infinity,\n xmax: -Infinity,\n ymax: -Infinity\n };\n for (var i in connection.overlays) {\n if (connection.overlays.hasOwnProperty(i)) {\n var _o2 = connection.overlays[i];\n if (_o2.isVisible()) {\n connection.overlayPlacements[i] = this.drawOverlay(_o2, connection.connector, connection.paintStyleInUse, connection.getAbsoluteOverlayPosition(_o2));\n overlayExtents.xmin = Math.min(overlayExtents.xmin, connection.overlayPlacements[i].xmin);\n overlayExtents.xmax = Math.max(overlayExtents.xmax, connection.overlayPlacements[i].xmax);\n overlayExtents.ymin = Math.min(overlayExtents.ymin, connection.overlayPlacements[i].ymin);\n overlayExtents.ymax = Math.max(overlayExtents.ymax, connection.overlayPlacements[i].ymax);\n }\n }\n }\n var lineWidth = parseFloat("" + connection.paintStyleInUse.strokeWidth || "1") / 2,\n outlineWidth = parseFloat("" + connection.paintStyleInUse.strokeWidth || "0"),\n _extents = {\n xmin: Math.min(connection.connector.bounds.xmin - (lineWidth + outlineWidth), overlayExtents.xmin),\n ymin: Math.min(connection.connector.bounds.ymin - (lineWidth + outlineWidth), overlayExtents.ymin),\n xmax: Math.max(connection.connector.bounds.xmax + (lineWidth + outlineWidth), overlayExtents.xmax),\n ymax: Math.max(connection.connector.bounds.ymax + (lineWidth + outlineWidth), overlayExtents.ymax)\n };\n this.paintConnector(connection.connector, connection.paintStyleInUse, _extents);\n for (var j in connection.overlays) {\n if (connection.overlays.hasOwnProperty(j)) {\n var _p2 = connection.overlays[j];\n if (_p2.isVisible()) {\n this._paintOverlay(_p2, connection.overlayPlacements[j], _extents);\n }\n }\n }\n }\n connection.lastPaintedAt = timestamp;\n }\n }\n }, {\n key: "_refreshEndpoint",\n value: function _refreshEndpoint(endpoint) {\n if (!endpoint._anchor.isFloating) {\n if (endpoint.connections.length > 0) {\n this.addEndpointClass(endpoint, this.endpointConnectedClass);\n } else {\n this.removeEndpointClass(endpoint, this.endpointConnectedClass);\n }\n if (endpoint.isFull()) {\n this.addEndpointClass(endpoint, this.endpointFullClass);\n } else {\n this.removeEndpointClass(endpoint, this.endpointFullClass);\n }\n }\n }\n }, {\n key: "_makeConnector",\n value: function _makeConnector(connection, name, args) {\n return Connectors.get(connection, name, args);\n }\n }, {\n key: "addOverlay",\n value: function addOverlay(component, overlay, doNotRevalidate) {\n component.addOverlay(overlay);\n if (!doNotRevalidate) {\n var relatedElement = component instanceof Endpoint ? component.element : component.source;\n this.revalidate(relatedElement);\n }\n }\n }, {\n key: "removeOverlay",\n value: function removeOverlay(component, overlayId) {\n component.removeOverlay(overlayId);\n var relatedElement = component instanceof Endpoint ? component.element : component.source;\n this.revalidate(relatedElement);\n }\n }, {\n key: "setOutlineColor",\n value: function setOutlineColor(conn, color) {\n conn.paintStyleInUse.outlineStroke = color;\n this._paintConnection(conn);\n }\n }, {\n key: "setOutlineWidth",\n value: function setOutlineWidth(conn, width) {\n conn.paintStyleInUse.outlineWidth = width;\n this._paintConnection(conn);\n }\n }, {\n key: "setColor",\n value: function setColor(conn, color) {\n conn.paintStyleInUse.stroke = color;\n this._paintConnection(conn);\n }\n }, {\n key: "setLineWidth",\n value: function setLineWidth(conn, width) {\n conn.paintStyleInUse.strokeWidth = width;\n this._paintConnection(conn);\n }\n }, {\n key: "setLineStyle",\n value: function setLineStyle(conn, style) {\n if (style.lineWidth != null) {\n conn.paintStyleInUse.strokeWidth = style.lineWidth;\n }\n if (style.outlineWidth != null) {\n conn.paintStyleInUse.outlineWidth = style.outlineWidth;\n }\n if (style.color != null) {\n conn.paintStyleInUse.stroke = style.color;\n }\n if (style.outlineColor != null) {\n conn.paintStyleInUse.outlineStroke = style.outlineColor;\n }\n this._paintConnection(conn);\n }\n }, {\n key: "getPathData",\n value:\n function getPathData(connector) {\n var p = "";\n for (var i = 0; i < connector.segments.length; i++) {\n p += connector.segments[i].getPath(i === 0);\n p += " ";\n }\n return p;\n }\n }]);\n return JsPlumbInstance;\n}(EventGenerator);\n\nvar endpointMap = {};\nfunction registerEndpointRenderer(name, fns) {\n endpointMap[name] = fns;\n}\nfunction getPositionOnElement(evt, el, zoom) {\n var jel = el;\n var box = _typeof(el.getBoundingClientRect) !== UNDEFINED ? el.getBoundingClientRect() : {\n left: 0,\n top: 0,\n width: 0,\n height: 0\n },\n body = document.body,\n docElem = document.documentElement,\n scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop,\n scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft,\n clientTop = docElem.clientTop || body.clientTop || 0,\n clientLeft = docElem.clientLeft || body.clientLeft || 0,\n pst = 0,\n psl = 0,\n top = box.top + scrollTop - clientTop + pst * zoom,\n left = box.left + scrollLeft - clientLeft + psl * zoom,\n cl = pageLocation(evt),\n w = box.width || jel.offsetWidth * zoom,\n h = box.height || jel.offsetHeight * zoom,\n x = (cl.x - left) / w,\n y = (cl.y - top) / h;\n return {\n x: x,\n y: y\n };\n}\nfunction isSVGElementOverlay(o) {\n return isArrowOverlay(o) || isDiamondOverlay(o) || isPlainArrowOverlay(o);\n}\nfunction setVisible(component, v) {\n if (component.canvas) {\n component.canvas.style.display = v ? "block" : "none";\n }\n}\nfunction cleanup(component) {\n if (component.canvas) {\n component.canvas.parentNode.removeChild(component.canvas);\n }\n delete component.canvas;\n}\nfunction getEndpointCanvas(ep) {\n return ep.canvas;\n}\nfunction getLabelElement(o) {\n return HTMLElementOverlay.getElement(o);\n}\nfunction getCustomElement(o) {\n return HTMLElementOverlay.getElement(o, o.component, function (c) {\n var el = o.create(c);\n o.instance.addClass(el, o.instance.overlayClass);\n return el;\n });\n}\nfunction groupDragConstrain(desiredLoc, dragEl, constrainRect, size) {\n var x = desiredLoc.x,\n y = desiredLoc.y;\n if (dragEl._jsPlumbParentGroup && dragEl._jsPlumbParentGroup.constrain) {\n x = Math.max(desiredLoc.x, 0);\n y = Math.max(desiredLoc.y, 0);\n x = Math.min(x, constrainRect.w - size.w);\n y = Math.min(y, constrainRect.h - size.h);\n }\n return {\n x: x,\n y: y\n };\n}\nvar BrowserJsPlumbInstance = function (_JsPlumbInstance) {\n _inherits(BrowserJsPlumbInstance, _JsPlumbInstance);\n var _super = _createSuper(BrowserJsPlumbInstance);\n function BrowserJsPlumbInstance(_instanceIndex, defaults) {\n var _this;\n _classCallCheck(this, BrowserJsPlumbInstance);\n _this = _super.call(this, _instanceIndex, defaults);\n _this._instanceIndex = _instanceIndex;\n _defineProperty(_assertThisInitialized(_this), "containerType", null);\n _defineProperty(_assertThisInitialized(_this), "dragSelection", void 0);\n _defineProperty(_assertThisInitialized(_this), "dragManager", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectorClick", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectorDblClick", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectorTap", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectorDblTap", void 0);\n _defineProperty(_assertThisInitialized(_this), "_endpointClick", void 0);\n _defineProperty(_assertThisInitialized(_this), "_endpointDblClick", void 0);\n _defineProperty(_assertThisInitialized(_this), "_overlayClick", void 0);\n _defineProperty(_assertThisInitialized(_this), "_overlayDblClick", void 0);\n _defineProperty(_assertThisInitialized(_this), "_overlayTap", void 0);\n _defineProperty(_assertThisInitialized(_this), "_overlayDblTap", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectorMouseover", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectorMouseout", void 0);\n _defineProperty(_assertThisInitialized(_this), "_endpointMouseover", void 0);\n _defineProperty(_assertThisInitialized(_this), "_endpointMouseout", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectorContextmenu", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectorMousedown", void 0);\n _defineProperty(_assertThisInitialized(_this), "_connectorMouseup", void 0);\n _defineProperty(_assertThisInitialized(_this), "_endpointMousedown", void 0);\n _defineProperty(_assertThisInitialized(_this), "_endpointMouseup", void 0);\n _defineProperty(_assertThisInitialized(_this), "_overlayMouseover", void 0);\n _defineProperty(_assertThisInitialized(_this), "_overlayMouseout", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementClick", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementTap", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementDblTap", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementMouseenter", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementMouseexit", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementMousemove", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementMouseup", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementMousedown", void 0);\n _defineProperty(_assertThisInitialized(_this), "_elementContextmenu", void 0);\n _defineProperty(_assertThisInitialized(_this), "_resizeObserver", void 0);\n _defineProperty(_assertThisInitialized(_this), "eventManager", void 0);\n _defineProperty(_assertThisInitialized(_this), "draggingClass", "jtk-dragging");\n _defineProperty(_assertThisInitialized(_this), "elementDraggingClass", "jtk-element-dragging");\n _defineProperty(_assertThisInitialized(_this), "hoverClass", "jtk-hover");\n _defineProperty(_assertThisInitialized(_this), "sourceElementDraggingClass", "jtk-source-element-dragging");\n _defineProperty(_assertThisInitialized(_this), "targetElementDraggingClass", "jtk-target-element-dragging");\n _defineProperty(_assertThisInitialized(_this), "hoverSourceClass", "jtk-source-hover");\n _defineProperty(_assertThisInitialized(_this), "hoverTargetClass", "jtk-target-hover");\n _defineProperty(_assertThisInitialized(_this), "dragSelectClass", "jtk-drag-select");\n _defineProperty(_assertThisInitialized(_this), "managedElementsSelector", void 0);\n _defineProperty(_assertThisInitialized(_this), "elementsDraggable", void 0);\n _defineProperty(_assertThisInitialized(_this), "elementDragHandler", void 0);\n _defineProperty(_assertThisInitialized(_this), "groupDragOptions", void 0);\n _defineProperty(_assertThisInitialized(_this), "elementDragOptions", void 0);\n _defineProperty(_assertThisInitialized(_this), "svg", {\n node: function node(name, attributes) {\n return _node(name, attributes);\n },\n attr: function attr(node, attributes) {\n return _attr(node, attributes);\n },\n pos: function pos(d) {\n return _pos(d);\n }\n });\n defaults = defaults || {};\n _this.containerType = getElementType(_this.getContainer());\n _this.elementsDraggable = defaults && defaults.elementsDraggable !== false;\n _this.managedElementsSelector = defaults ? defaults.managedElementsSelector || SELECTOR_MANAGED_ELEMENT : SELECTOR_MANAGED_ELEMENT;\n _this.eventManager = new EventManager();\n _this.dragSelection = new DragSelection(_assertThisInitialized(_this));\n _this.dragManager = new DragManager(_assertThisInitialized(_this), _this.dragSelection);\n _this.dragManager.addHandler(new EndpointDragHandler(_assertThisInitialized(_this)));\n _this.groupDragOptions = {\n constrainFunction: groupDragConstrain\n };\n _this.dragManager.addHandler(new GroupDragHandler(_assertThisInitialized(_this), _this.dragSelection), _this.groupDragOptions);\n _this.elementDragHandler = new ElementDragHandler(_assertThisInitialized(_this), _this.dragSelection);\n _this.elementDragOptions = defaults && defaults.dragOptions || {};\n _this.dragManager.addHandler(_this.elementDragHandler, _this.elementDragOptions);\n if (defaults && defaults.dragOptions && defaults.dragOptions.filter) {\n _this.dragManager.addFilter(defaults.dragOptions.filter);\n }\n _this._createEventListeners();\n _this._attachEventDelegates();\n if (defaults.resizeObserver !== false) {\n try {\n _this._resizeObserver = new ResizeObserver(function (entries) {\n var updates = entries.filter(function (e) {\n var a = _this.getAttribute(e.target, ATTRIBUTE_MANAGED);\n if (a != null) {\n var v = _this.viewport._elementMap.get(a);\n return v ? v.w !== e.contentRect.width || v.h !== e.contentRect.height : false;\n } else {\n return false;\n }\n });\n updates.forEach(function (el) {\n return _this.revalidate(el.target);\n });\n });\n } catch (e) {\n log("WARN: ResizeObserver could not be attached.");\n }\n }\n return _this;\n }\n _createClass(BrowserJsPlumbInstance, [{\n key: "fireOverlayMethod",\n value: function fireOverlayMethod(overlay, event, e) {\n var stem = overlay.component instanceof Connection ? CONNECTION : ENDPOINT;\n var mappedEvent = compoundEvent(stem, event)\n ;\n e._jsPlumbOverlay = overlay;\n overlay.fire(event, {\n e: e,\n overlay: overlay\n });\n this.fire(mappedEvent, overlay.component, e);\n }\n }, {\n key: "addDragFilter",\n value: function addDragFilter(filter, exclude) {\n this.dragManager.addFilter(filter, exclude);\n }\n }, {\n key: "removeDragFilter",\n value: function removeDragFilter(filter) {\n this.dragManager.removeFilter(filter);\n }\n }, {\n key: "setDragGrid",\n value: function setDragGrid(grid) {\n this.dragManager.setOption(this.elementDragHandler, {\n grid: grid\n });\n }\n }, {\n key: "setDragConstrainFunction",\n value: function setDragConstrainFunction(constrainFunction) {\n this.dragManager.setOption(this.elementDragHandler, {\n constrainFunction: constrainFunction\n });\n }\n }, {\n key: "_removeElement",\n value: function _removeElement(element) {\n element.parentNode && element.parentNode.removeChild(element);\n }\n }, {\n key: "_appendElement",\n value: function _appendElement(el, parent) {\n if (parent) {\n parent.appendChild(el);\n }\n }\n }, {\n key: "_appendElementToGroup",\n value: function _appendElementToGroup(group, el) {\n this.getGroupContentArea(group).appendChild(el);\n }\n }, {\n key: "_appendElementToContainer",\n value: function _appendElementToContainer(el) {\n this._appendElement(el, this.getContainer());\n }\n }, {\n key: "_getAssociatedElements",\n value: function _getAssociatedElements(el) {\n var a = [];\n if (el.nodeType !== 3 && el.nodeType !== 8) {\n var els = el.querySelectorAll(SELECTOR_MANAGED_ELEMENT);\n Array.prototype.push.apply(a, els);\n }\n return a.filter(function (_a) {\n return _a.nodeType !== 3 && _a.nodeType !== 8;\n });\n }\n }, {\n key: "shouldFireEvent",\n value: function shouldFireEvent(event, value, originalEvent) {\n return true;\n }\n }, {\n key: "getClass",\n value: function getClass$1(el) {\n return getClass(el);\n }\n }, {\n key: "addClass",\n value: function addClass$1(el, clazz) {\n addClass(el, clazz);\n }\n }, {\n key: "hasClass",\n value: function hasClass$1(el, clazz) {\n return hasClass(el, clazz);\n }\n }, {\n key: "removeClass",\n value: function removeClass$1(el, clazz) {\n removeClass(el, clazz);\n }\n }, {\n key: "toggleClass",\n value: function toggleClass$1(el, clazz) {\n toggleClass(el, clazz);\n }\n }, {\n key: "setAttribute",\n value: function setAttribute(el, name, value) {\n el.setAttribute(name, value);\n }\n }, {\n key: "getAttribute",\n value: function getAttribute(el, name) {\n return el.getAttribute(name);\n }\n }, {\n key: "setAttributes",\n value: function setAttributes(el, atts) {\n for (var i in atts) {\n el.setAttribute(i, atts[i]);\n }\n }\n }, {\n key: "removeAttribute",\n value: function removeAttribute(el, attName) {\n el.removeAttribute && el.removeAttribute(attName);\n }\n }, {\n key: "on",\n value: function on(el, event, callbackOrSelector, callback) {\n var _this2 = this;\n var _one = function _one(_el) {\n if (callback == null) {\n _this2.eventManager.on(_el, event, callbackOrSelector);\n } else {\n _this2.eventManager.on(_el, event, callbackOrSelector, callback);\n }\n };\n if (isNodeList(el)) {\n forEach(el, function (el) {\n return _one(el);\n });\n } else {\n _one(el);\n }\n return this;\n }\n }, {\n key: "off",\n value: function off(el, event, callback) {\n var _this3 = this;\n if (isNodeList(el)) {\n forEach(el, function (_el) {\n return _this3.eventManager.off(_el, event, callback);\n });\n } else {\n this.eventManager.off(el, event, callback);\n }\n return this;\n }\n }, {\n key: "trigger",\n value: function trigger(el, event, originalEvent, payload, detail) {\n this.eventManager.trigger(el, event, originalEvent, payload, detail);\n }\n }, {\n key: "getOffsetRelativeToRoot",\n value: function getOffsetRelativeToRoot(el) {\n return offsetRelativeToRoot(el);\n }\n }, {\n key: "getOffset",\n value: function getOffset(el) {\n var jel = el;\n var container = this.getContainer();\n var out = this.getPosition(jel),\n op = el !== container && jel.offsetParent !== container ? jel.offsetParent : null,\n _maybeAdjustScroll = function _maybeAdjustScroll(offsetParent) {\n if (offsetParent != null && offsetParent !== document.body && (offsetParent.scrollTop > 0 || offsetParent.scrollLeft > 0)) {\n out.x -= offsetParent.scrollLeft;\n out.y -= offsetParent.scrollTop;\n }\n };\n while (op != null) {\n out.x += op.offsetLeft;\n out.y += op.offsetTop;\n _maybeAdjustScroll(op);\n op = op.offsetParent === container ? null : op.offsetParent;\n }\n if (container != null && (container.scrollTop > 0 || container.scrollLeft > 0)) {\n var pp = jel.offsetParent != null ? this.getStyle(jel.offsetParent, PROPERTY_POSITION) : STATIC,\n p = this.getStyle(jel, PROPERTY_POSITION);\n if (p !== ABSOLUTE && p !== FIXED && pp !== ABSOLUTE && pp !== FIXED) {\n out.x -= container.scrollLeft;\n out.y -= container.scrollTop;\n }\n }\n return out;\n }\n }, {\n key: "getSize",\n value: function getSize(el) {\n var _el = el;\n if (_el.offsetWidth != null) {\n return offsetSize(el);\n } else if (_el.width && _el.width.baseVal) {\n return svgWidthHeightSize(_el);\n }\n }\n }, {\n key: "getPosition",\n value: function getPosition(el) {\n var _el = el;\n if (_el.offsetLeft != null) {\n return {\n x: parseFloat(_el.offsetLeft),\n y: parseFloat(_el.offsetTop)\n };\n } else if (_el.x && _el.x.baseVal) {\n return svgXYPosition(_el);\n }\n }\n }, {\n key: "getStyle",\n value: function getStyle(el, prop) {\n if (_typeof(window.getComputedStyle) !== UNDEFINED) {\n return getComputedStyle(el, null).getPropertyValue(prop);\n } else {\n return el.currentStyle[prop];\n }\n }\n }, {\n key: "getGroupContentArea",\n value: function getGroupContentArea(group) {\n var da = this.getSelector(group.el, SELECTOR_GROUP_CONTAINER);\n return da && da.length > 0 ? da[0] : group.el;\n }\n }, {\n key: "getSelector",\n value: function getSelector(ctx, spec) {\n var sel = null;\n if (arguments.length === 1) {\n if (!isString(ctx)) {\n var nodeList = document.createDocumentFragment();\n nodeList.appendChild(ctx);\n return fromArray(nodeList.childNodes);\n }\n sel = fromArray(document.querySelectorAll(ctx));\n } else {\n sel = fromArray(ctx.querySelectorAll(spec));\n }\n return sel;\n }\n }, {\n key: "setPosition",\n value: function setPosition(el, p) {\n var jel = el;\n jel.style.left = p.x + "px";\n jel.style.top = p.y + "px";\n }\n }, {\n key: "setDraggable",\n value: function setDraggable(element, draggable) {\n if (draggable) {\n this.removeAttribute(element, ATTRIBUTE_NOT_DRAGGABLE);\n } else {\n this.setAttribute(element, ATTRIBUTE_NOT_DRAGGABLE, TRUE$1);\n }\n }\n }, {\n key: "isDraggable",\n value: function isDraggable(el) {\n var d = this.getAttribute(el, ATTRIBUTE_NOT_DRAGGABLE);\n return d == null || d === FALSE$1;\n }\n }, {\n key: "toggleDraggable",\n value: function toggleDraggable(el) {\n var state = this.isDraggable(el);\n this.setDraggable(el, !state);\n return !state;\n }\n }, {\n key: "_createEventListeners",\n value: function _createEventListeners() {\n var _connClick = function _connClick(event, e) {\n if (!e.defaultPrevented && e._jsPlumbOverlay == null) {\n var connectorElement = findParent(getEventSource(e), SELECTOR_CONNECTOR, this.getContainer(), true);\n this.fire(event, connectorElement.jtk.connector.connection, e);\n }\n };\n this._connectorClick = _connClick.bind(this, EVENT_CONNECTION_CLICK);\n this._connectorDblClick = _connClick.bind(this, EVENT_CONNECTION_DBL_CLICK);\n this._connectorTap = _connClick.bind(this, EVENT_CONNECTION_TAP);\n this._connectorDblTap = _connClick.bind(this, EVENT_CONNECTION_DBL_TAP);\n var _connectorHover = function _connectorHover(state, e) {\n var el = getEventSource(e).parentNode;\n if (el.jtk && el.jtk.connector) {\n var connector = el.jtk.connector;\n var connection = connector.connection;\n this.setConnectorHover(connector, state);\n if (state) {\n this.addClass(connection.source, this.hoverSourceClass);\n this.addClass(connection.target, this.hoverTargetClass);\n } else {\n this.removeClass(connection.source, this.hoverSourceClass);\n this.removeClass(connection.target, this.hoverTargetClass);\n }\n this.fire(state ? EVENT_CONNECTION_MOUSEOVER : EVENT_CONNECTION_MOUSEOUT, el.jtk.connector.connection, e);\n }\n };\n this._connectorMouseover = _connectorHover.bind(this, true);\n this._connectorMouseout = _connectorHover.bind(this, false);\n var _connectorMouseupdown = function _connectorMouseupdown(state, e) {\n var el = getEventSource(e).parentNode;\n if (el.jtk && el.jtk.connector) {\n this.fire(state ? EVENT_CONNECTION_MOUSEUP : EVENT_CONNECTION_MOUSEDOWN, el.jtk.connector.connection, e);\n }\n };\n this._connectorMouseup = _connectorMouseupdown.bind(this, true);\n this._connectorMousedown = _connectorMouseupdown.bind(this, false);\n this._connectorContextmenu = function (e) {\n var el = getEventSource(e).parentNode;\n if (el.jtk && el.jtk.connector) {\n this.fire(EVENT_CONNECTION_CONTEXTMENU, el.jtk.connector.connection, e);\n }\n }.bind(this);\n var _epClick = function _epClick(event, e, endpointElement) {\n if (!e.defaultPrevented && e._jsPlumbOverlay == null) {\n this.fire(event, endpointElement.jtk.endpoint, e);\n }\n };\n this._endpointClick = _epClick.bind(this, EVENT_ENDPOINT_CLICK);\n this._endpointDblClick = _epClick.bind(this, EVENT_ENDPOINT_DBL_CLICK);\n var _endpointHover = function _endpointHover(state, e) {\n var el = getEventSource(e);\n if (el.jtk && el.jtk.endpoint) {\n this.setEndpointHover(el.jtk.endpoint, state);\n this.fire(state ? EVENT_ENDPOINT_MOUSEOVER : EVENT_ENDPOINT_MOUSEOUT, el.jtk.endpoint, e);\n }\n };\n this._endpointMouseover = _endpointHover.bind(this, true);\n this._endpointMouseout = _endpointHover.bind(this, false);\n var _endpointMouseupdown = function _endpointMouseupdown(state, e) {\n var el = getEventSource(e);\n if (el.jtk && el.jtk.endpoint) {\n this.fire(state ? EVENT_ENDPOINT_MOUSEUP : EVENT_ENDPOINT_MOUSEDOWN, el.jtk.endpoint, e);\n }\n };\n this._endpointMouseup = _endpointMouseupdown.bind(this, true);\n this._endpointMousedown = _endpointMouseupdown.bind(this, false);\n var _oClick = function (method, e) {\n var overlayElement = findParent(getEventSource(e), SELECTOR_OVERLAY, this.getContainer(), true);\n var overlay = overlayElement.jtk.overlay;\n if (overlay) {\n this.fireOverlayMethod(overlay, method, e);\n }\n }.bind(this);\n this._overlayClick = _oClick.bind(this, EVENT_CLICK);\n this._overlayDblClick = _oClick.bind(this, EVENT_DBL_CLICK);\n this._overlayTap = _oClick.bind(this, EVENT_TAP);\n this._overlayDblTap = _oClick.bind(this, EVENT_DBL_TAP);\n var _overlayHover = function _overlayHover(state, e) {\n var overlayElement = findParent(getEventSource(e), SELECTOR_OVERLAY, this.getContainer(), true);\n var overlay = overlayElement.jtk.overlay;\n if (overlay) {\n this.setOverlayHover(overlay, state);\n }\n };\n this._overlayMouseover = _overlayHover.bind(this, true);\n this._overlayMouseout = _overlayHover.bind(this, false);\n var _elementClick = function _elementClick(event, e, target) {\n if (!e.defaultPrevented) {\n this.fire(e.detail === 1 ? EVENT_ELEMENT_CLICK : EVENT_ELEMENT_DBL_CLICK, target, e);\n }\n };\n this._elementClick = _elementClick.bind(this, EVENT_ELEMENT_CLICK);\n var _elementTap = function _elementTap(event, e, target) {\n if (!e.defaultPrevented) {\n this.fire(EVENT_ELEMENT_TAP, target, e);\n }\n };\n this._elementTap = _elementTap.bind(this, EVENT_ELEMENT_TAP);\n var _elementDblTap = function _elementDblTap(event, e, target) {\n if (!e.defaultPrevented) {\n this.fire(EVENT_ELEMENT_DBL_TAP, target, e);\n }\n };\n this._elementDblTap = _elementDblTap.bind(this, EVENT_ELEMENT_DBL_TAP);\n var _elementHover = function _elementHover(state, e) {\n this.fire(state ? EVENT_ELEMENT_MOUSE_OVER : EVENT_ELEMENT_MOUSE_OUT, getEventSource(e), e);\n };\n this._elementMouseenter = _elementHover.bind(this, true);\n this._elementMouseexit = _elementHover.bind(this, false);\n this._elementMousemove = function (e) {\n this.fire(EVENT_ELEMENT_MOUSE_MOVE, getEventSource(e), e);\n }.bind(this);\n this._elementMouseup = function (e) {\n this.fire(EVENT_ELEMENT_MOUSE_UP, getEventSource(e), e);\n }.bind(this);\n this._elementMousedown = function (e) {\n this.fire(EVENT_ELEMENT_MOUSE_DOWN, getEventSource(e), e);\n }.bind(this);\n this._elementContextmenu = function (e) {\n this.fire(EVENT_ELEMENT_CONTEXTMENU, getEventSource(e), e);\n }.bind(this);\n }\n }, {\n key: "_attachEventDelegates",\n value: function _attachEventDelegates() {\n var currentContainer = this.getContainer();\n this.eventManager.on(currentContainer, EVENT_CLICK, SELECTOR_OVERLAY, this._overlayClick);\n this.eventManager.on(currentContainer, EVENT_DBL_CLICK, SELECTOR_OVERLAY, this._overlayDblClick);\n this.eventManager.on(currentContainer, EVENT_TAP, SELECTOR_OVERLAY, this._overlayTap);\n this.eventManager.on(currentContainer, EVENT_DBL_TAP, SELECTOR_OVERLAY, this._overlayDblTap);\n this.eventManager.on(currentContainer, EVENT_CLICK, SELECTOR_CONNECTOR, this._connectorClick);\n this.eventManager.on(currentContainer, EVENT_DBL_CLICK, SELECTOR_CONNECTOR, this._connectorDblClick);\n this.eventManager.on(currentContainer, EVENT_TAP, SELECTOR_CONNECTOR, this._connectorTap);\n this.eventManager.on(currentContainer, EVENT_DBL_TAP, SELECTOR_CONNECTOR, this._connectorDblTap);\n this.eventManager.on(currentContainer, EVENT_CLICK, SELECTOR_ENDPOINT, this._endpointClick);\n this.eventManager.on(currentContainer, EVENT_DBL_CLICK, SELECTOR_ENDPOINT, this._endpointDblClick);\n this.eventManager.on(currentContainer, EVENT_CLICK, this.managedElementsSelector, this._elementClick);\n this.eventManager.on(currentContainer, EVENT_TAP, this.managedElementsSelector, this._elementTap);\n this.eventManager.on(currentContainer, EVENT_DBL_TAP, this.managedElementsSelector, this._elementDblTap);\n this.eventManager.on(currentContainer, EVENT_MOUSEOVER, SELECTOR_CONNECTOR, this._connectorMouseover);\n this.eventManager.on(currentContainer, EVENT_MOUSEOUT, SELECTOR_CONNECTOR, this._connectorMouseout);\n this.eventManager.on(currentContainer, EVENT_CONTEXTMENU, SELECTOR_CONNECTOR, this._connectorContextmenu);\n this.eventManager.on(currentContainer, EVENT_MOUSEUP, SELECTOR_CONNECTOR, this._connectorMouseup);\n this.eventManager.on(currentContainer, EVENT_MOUSEDOWN, SELECTOR_CONNECTOR, this._connectorMousedown);\n this.eventManager.on(currentContainer, EVENT_MOUSEOVER, SELECTOR_ENDPOINT, this._endpointMouseover);\n this.eventManager.on(currentContainer, EVENT_MOUSEOUT, SELECTOR_ENDPOINT, this._endpointMouseout);\n this.eventManager.on(currentContainer, EVENT_MOUSEUP, SELECTOR_ENDPOINT, this._endpointMouseup);\n this.eventManager.on(currentContainer, EVENT_MOUSEDOWN, SELECTOR_ENDPOINT, this._endpointMousedown);\n this.eventManager.on(currentContainer, EVENT_MOUSEOVER, SELECTOR_OVERLAY, this._overlayMouseover);\n this.eventManager.on(currentContainer, EVENT_MOUSEOUT, SELECTOR_OVERLAY, this._overlayMouseout);\n this.eventManager.on(currentContainer, EVENT_MOUSEOVER, SELECTOR_MANAGED_ELEMENT, this._elementMouseenter);\n this.eventManager.on(currentContainer, EVENT_MOUSEOUT, SELECTOR_MANAGED_ELEMENT, this._elementMouseexit);\n this.eventManager.on(currentContainer, EVENT_MOUSEMOVE, SELECTOR_MANAGED_ELEMENT, this._elementMousemove);\n this.eventManager.on(currentContainer, EVENT_MOUSEUP, SELECTOR_MANAGED_ELEMENT, this._elementMouseup);\n this.eventManager.on(currentContainer, EVENT_MOUSEDOWN, SELECTOR_MANAGED_ELEMENT, this._elementMousedown);\n this.eventManager.on(currentContainer, EVENT_CONTEXTMENU, SELECTOR_MANAGED_ELEMENT, this._elementContextmenu);\n }\n }, {\n key: "_detachEventDelegates",\n value: function _detachEventDelegates() {\n var currentContainer = this.getContainer();\n if (currentContainer) {\n this.eventManager.off(currentContainer, EVENT_CLICK, this._connectorClick);\n this.eventManager.off(currentContainer, EVENT_DBL_CLICK, this._connectorDblClick);\n this.eventManager.off(currentContainer, EVENT_TAP, this._connectorTap);\n this.eventManager.off(currentContainer, EVENT_DBL_TAP, this._connectorDblTap);\n this.eventManager.off(currentContainer, EVENT_CLICK, this._endpointClick);\n this.eventManager.off(currentContainer, EVENT_DBL_CLICK, this._endpointDblClick);\n this.eventManager.off(currentContainer, EVENT_CLICK, this._overlayClick);\n this.eventManager.off(currentContainer, EVENT_DBL_CLICK, this._overlayDblClick);\n this.eventManager.off(currentContainer, EVENT_TAP, this._overlayTap);\n this.eventManager.off(currentContainer, EVENT_DBL_TAP, this._overlayDblTap);\n this.eventManager.off(currentContainer, EVENT_CLICK, this._elementClick);\n this.eventManager.off(currentContainer, EVENT_TAP, this._elementTap);\n this.eventManager.off(currentContainer, EVENT_DBL_TAP, this._elementDblTap);\n this.eventManager.off(currentContainer, EVENT_MOUSEOVER, this._connectorMouseover);\n this.eventManager.off(currentContainer, EVENT_MOUSEOUT, this._connectorMouseout);\n this.eventManager.off(currentContainer, EVENT_CONTEXTMENU, this._connectorContextmenu);\n this.eventManager.off(currentContainer, EVENT_MOUSEUP, this._connectorMouseup);\n this.eventManager.off(currentContainer, EVENT_MOUSEDOWN, this._connectorMousedown);\n this.eventManager.off(currentContainer, EVENT_MOUSEOVER, this._endpointMouseover);\n this.eventManager.off(currentContainer, EVENT_MOUSEOUT, this._endpointMouseout);\n this.eventManager.off(currentContainer, EVENT_MOUSEUP, this._endpointMouseup);\n this.eventManager.off(currentContainer, EVENT_MOUSEDOWN, this._endpointMousedown);\n this.eventManager.off(currentContainer, EVENT_MOUSEOVER, this._overlayMouseover);\n this.eventManager.off(currentContainer, EVENT_MOUSEOUT, this._overlayMouseout);\n this.eventManager.off(currentContainer, EVENT_MOUSEENTER, this._elementMouseenter);\n this.eventManager.off(currentContainer, EVENT_MOUSEEXIT, this._elementMouseexit);\n this.eventManager.off(currentContainer, EVENT_MOUSEMOVE, this._elementMousemove);\n this.eventManager.off(currentContainer, EVENT_MOUSEUP, this._elementMouseup);\n this.eventManager.off(currentContainer, EVENT_MOUSEDOWN, this._elementMousedown);\n this.eventManager.off(currentContainer, EVENT_CONTEXTMENU, this._elementContextmenu);\n }\n }\n }, {\n key: "setContainer",\n value: function setContainer(newContainer) {\n var _this4 = this;\n if (newContainer === document || newContainer === document.body) {\n throw new Error("Cannot set document or document.body as container element");\n }\n this._detachEventDelegates();\n var dragFilters;\n if (this.dragManager != null) {\n dragFilters = this.dragManager.reset();\n }\n this.setAttribute(newContainer, ATTRIBUTE_CONTAINER, uuid().replace("-", ""));\n var currentContainer = this.getContainer();\n if (currentContainer != null) {\n currentContainer.removeAttribute(ATTRIBUTE_CONTAINER);\n var children = fromArray(currentContainer.childNodes).filter(function (cn) {\n return cn != null && (_this4.hasClass(cn, CLASS_CONNECTOR) || _this4.hasClass(cn, CLASS_ENDPOINT) || _this4.hasClass(cn, CLASS_OVERLAY) || cn.getAttribute && cn.getAttribute(ATTRIBUTE_MANAGED) != null);\n });\n forEach(children, function (el) {\n newContainer.appendChild(el);\n });\n }\n _get(_getPrototypeOf(BrowserJsPlumbInstance.prototype), "setContainer", this).call(this, newContainer);\n this.containerType = getElementType(newContainer);\n if (this.eventManager != null) {\n this._attachEventDelegates();\n }\n if (this.dragManager != null) {\n this.dragManager.addHandler(new EndpointDragHandler(this));\n this.dragManager.addHandler(new GroupDragHandler(this, this.dragSelection), this.groupDragOptions);\n this.elementDragHandler = new ElementDragHandler(this, this.dragSelection);\n this.dragManager.addHandler(this.elementDragHandler, this.elementDragOptions);\n if (dragFilters != null) {\n this.dragManager.setFilters(dragFilters);\n }\n }\n }\n }, {\n key: "reset",\n value: function reset() {\n _get(_getPrototypeOf(BrowserJsPlumbInstance.prototype), "reset", this).call(this);\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n }\n var container = this.getContainer();\n var els = container.querySelectorAll([SELECTOR_MANAGED_ELEMENT, SELECTOR_ENDPOINT, SELECTOR_CONNECTOR, SELECTOR_OVERLAY].join(","));\n forEach(els, function (el) {\n return el.parentNode && el.parentNode.removeChild(el);\n });\n }\n }, {\n key: "destroy",\n value: function destroy() {\n this._detachEventDelegates();\n if (this.dragManager != null) {\n this.dragManager.reset();\n }\n this.clearDragSelection();\n _get(_getPrototypeOf(BrowserJsPlumbInstance.prototype), "destroy", this).call(this);\n }\n }, {\n key: "unmanage",\n value: function unmanage(el, removeElement) {\n if (this._resizeObserver != null) {\n this._resizeObserver.unobserve(el);\n }\n this.removeFromDragSelection(el);\n _get(_getPrototypeOf(BrowserJsPlumbInstance.prototype), "unmanage", this).call(this, el, removeElement);\n }\n }, {\n key: "addToDragSelection",\n value: function addToDragSelection() {\n var _this5 = this;\n for (var _len = arguments.length, el = new Array(_len), _key = 0; _key < _len; _key++) {\n el[_key] = arguments[_key];\n }\n forEach(el, function (_el) {\n return _this5.dragSelection.add(_el);\n });\n }\n }, {\n key: "clearDragSelection",\n value: function clearDragSelection() {\n this.dragSelection.clear();\n }\n }, {\n key: "removeFromDragSelection",\n value: function removeFromDragSelection() {\n var _this6 = this;\n for (var _len2 = arguments.length, el = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n el[_key2] = arguments[_key2];\n }\n forEach(el, function (_el) {\n return _this6.dragSelection.remove(_el);\n });\n }\n }, {\n key: "toggleDragSelection",\n value: function toggleDragSelection() {\n var _this7 = this;\n for (var _len3 = arguments.length, el = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n el[_key3] = arguments[_key3];\n }\n forEach(el, function (_el) {\n return _this7.dragSelection.toggle(_el);\n });\n }\n }, {\n key: "addToDragGroup",\n value: function addToDragGroup(spec) {\n var _this$elementDragHand;\n for (var _len4 = arguments.length, els = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n els[_key4 - 1] = arguments[_key4];\n }\n (_this$elementDragHand = this.elementDragHandler).addToDragGroup.apply(_this$elementDragHand, [spec].concat(els));\n }\n }, {\n key: "removeFromDragGroup",\n value: function removeFromDragGroup() {\n var _this$elementDragHand2;\n (_this$elementDragHand2 = this.elementDragHandler).removeFromDragGroup.apply(_this$elementDragHand2, arguments);\n }\n }, {\n key: "setDragGroupState",\n value: function setDragGroupState(state) {\n var _this$elementDragHand3;\n for (var _len5 = arguments.length, els = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {\n els[_key5 - 1] = arguments[_key5];\n }\n (_this$elementDragHand3 = this.elementDragHandler).setDragGroupState.apply(_this$elementDragHand3, [state].concat(els));\n }\n }, {\n key: "clearDragGroup",\n value: function clearDragGroup(name) {\n this.elementDragHandler.clearDragGroup(name);\n }\n }, {\n key: "consume",\n value: function consume$1(e, doNotPreventDefault) {\n consume(e, doNotPreventDefault);\n }\n }, {\n key: "rotate",\n value: function rotate(element, rotation, doNotRepaint) {\n var elementId = this.getId(element);\n if (this._managedElements[elementId]) {\n this._managedElements[elementId].el.style.transform = "rotate(" + rotation + "deg)";\n this._managedElements[elementId].el.style.transformOrigin = "center center";\n return _get(_getPrototypeOf(BrowserJsPlumbInstance.prototype), "rotate", this).call(this, element, rotation, doNotRepaint);\n }\n return {\n c: new Set(),\n e: new Set()\n };\n }\n }, {\n key: "addOverlayClass",\n value:\n function addOverlayClass(o, clazz) {\n if (isLabelOverlay(o)) {\n o.instance.addClass(getLabelElement(o), clazz);\n } else if (isSVGElementOverlay(o)) {\n o.instance.addClass(ensureSVGOverlayPath(o), clazz);\n } else if (isCustomOverlay(o)) {\n o.instance.addClass(getCustomElement(o), clazz);\n } else {\n throw "Could not add class to overlay of type [" + o.type + "]";\n }\n }\n }, {\n key: "removeOverlayClass",\n value: function removeOverlayClass(o, clazz) {\n if (isLabelOverlay(o)) {\n o.instance.removeClass(getLabelElement(o), clazz);\n } else if (isSVGElementOverlay(o)) {\n o.instance.removeClass(ensureSVGOverlayPath(o), clazz);\n } else if (isCustomOverlay(o)) {\n o.instance.removeClass(getCustomElement(o), clazz);\n } else {\n throw "Could not remove class from overlay of type [" + o.type + "]";\n }\n }\n }, {\n key: "_paintOverlay",\n value: function _paintOverlay(o, params, extents) {\n if (isLabelOverlay(o)) {\n getLabelElement(o);\n var XY = o.component.getXY();\n o.canvas.style.left = XY.x + params.d.minx + "px";\n o.canvas.style.top = XY.y + params.d.miny + "px";\n } else if (isSVGElementOverlay(o)) {\n var path = isNaN(params.d.cxy.x) || isNaN(params.d.cxy.y) ? "M 0 0" : "M" + params.d.hxy.x + "," + params.d.hxy.y + " L" + params.d.tail[0].x + "," + params.d.tail[0].y + " L" + params.d.cxy.x + "," + params.d.cxy.y + " L" + params.d.tail[1].x + "," + params.d.tail[1].y + " Z";\n paintSVGOverlay(o, path, params, extents);\n } else if (isCustomOverlay(o)) {\n getCustomElement(o);\n var _XY = o.component.getXY();\n o.canvas.style.left = _XY.x + params.d.minx + "px";\n o.canvas.style.top = _XY.y + params.d.miny + "px";\n } else {\n throw "Could not paint overlay of type [" + o.type + "]";\n }\n }\n }, {\n key: "setOverlayVisible",\n value: function setOverlayVisible(o, visible) {\n var d = visible ? "block" : "none";\n function s(el) {\n if (el != null) {\n el.style.display = d;\n }\n }\n if (isLabelOverlay(o)) {\n s(getLabelElement(o));\n } else if (isCustomOverlay(o)) {\n s(getCustomElement(o));\n } else if (isSVGElementOverlay(o)) {\n s(o.path);\n }\n }\n }, {\n key: "reattachOverlay",\n value: function reattachOverlay(o, c) {\n if (isLabelOverlay(o)) {\n o.instance._appendElement(getLabelElement(o), this.getContainer());\n } else if (isCustomOverlay(o)) {\n o.instance._appendElement(getCustomElement(o), this.getContainer());\n } else if (isSVGElementOverlay(o)) {\n this._appendElement(ensureSVGOverlayPath(o), c.connector.canvas);\n }\n }\n }, {\n key: "setOverlayHover",\n value: function setOverlayHover(o, hover) {\n var canvas;\n if (isLabelOverlay(o)) {\n canvas = getLabelElement(o);\n } else if (isCustomOverlay(o)) {\n canvas = getCustomElement(o);\n } else if (isSVGElementOverlay(o)) {\n canvas = ensureSVGOverlayPath(o);\n }\n if (canvas != null) {\n if (this.hoverClass != null) {\n if (hover) {\n this.addClass(canvas, this.hoverClass);\n } else {\n this.removeClass(canvas, this.hoverClass);\n }\n }\n this.setHover(o.component, hover);\n }\n }\n }, {\n key: "destroyOverlay",\n value: function destroyOverlay(o) {\n if (isLabelOverlay(o)) {\n var _el2 = getLabelElement(o);\n _el2.parentNode.removeChild(_el2);\n delete o.canvas;\n delete o.cachedDimensions;\n } else if (isArrowOverlay(o) || isDiamondOverlay(o) || isPlainArrowOverlay(o)) {\n destroySVGOverlay(o);\n } else if (isCustomOverlay(o)) {\n var _el3 = getCustomElement(o);\n _el3.parentNode.removeChild(_el3);\n delete o.canvas;\n delete o.cachedDimensions;\n }\n }\n }, {\n key: "drawOverlay",\n value: function drawOverlay(o, component, paintStyle, absolutePosition) {\n if (isLabelOverlay(o) || isCustomOverlay(o)) {\n var td = HTMLElementOverlay._getDimensions(o);\n if (td != null && td.w != null && td.h != null) {\n var cxy = {\n x: 0,\n y: 0\n };\n if (absolutePosition) {\n cxy = {\n x: absolutePosition.x,\n y: absolutePosition.y\n };\n } else if (component instanceof EndpointRepresentation) {\n var locToUse = Array.isArray(o.location) ? o.location : [o.location, o.location];\n cxy = {\n x: locToUse[0] * component.w,\n y: locToUse[1] * component.h\n };\n } else {\n var loc = o.location,\n absolute = false;\n if (isString(o.location) || o.location < 0 || o.location > 1) {\n loc = parseInt("" + o.location, 10);\n absolute = true;\n }\n cxy = component.pointOnPath(loc, absolute);\n }\n var minx = cxy.x - td.w / 2,\n miny = cxy.y - td.h / 2;\n return {\n component: o,\n d: {\n minx: minx,\n miny: miny,\n td: td,\n cxy: cxy\n },\n xmin: minx,\n xmax: minx + td.w,\n ymin: miny,\n ymax: miny + td.h\n };\n } else {\n return {\n xmin: 0,\n xmax: 0,\n ymin: 0,\n ymax: 0\n };\n }\n } else if (isArrowOverlay(o) || isDiamondOverlay(o) || isPlainArrowOverlay(o)) {\n return o.draw(component, paintStyle, absolutePosition);\n } else {\n throw "Could not draw overlay of type [" + o.type + "]";\n }\n }\n }, {\n key: "updateLabel",\n value: function updateLabel(o) {\n if (isFunction(o.label)) {\n var lt = o.label(this);\n if (lt != null) {\n getLabelElement(o).innerText = lt;\n } else {\n getLabelElement(o).innerText = "";\n }\n } else {\n if (o.labelText == null) {\n o.labelText = o.label;\n if (o.labelText != null) {\n getLabelElement(o).innerText = o.labelText;\n } else {\n getLabelElement(o).innerText = "";\n }\n }\n }\n }\n }, {\n key: "setHover",\n value: function setHover(component, hover) {\n component._hover = hover;\n if (component instanceof Endpoint && component.endpoint != null) {\n this.setEndpointHover(component, hover, -1);\n } else if (component instanceof Connection && component.connector != null) {\n this.setConnectorHover(component.connector, hover);\n }\n }\n }, {\n key: "paintConnector",\n value: function paintConnector(connector, paintStyle, extents) {\n paintSvgConnector(this, connector, paintStyle, extents);\n }\n }, {\n key: "setConnectorHover",\n value: function setConnectorHover(connector, hover, sourceEndpoint) {\n if (hover === false || !this.currentlyDragging && !this.isHoverSuspended()) {\n var canvas = connector.canvas;\n if (canvas != null) {\n if (connector.hoverClass != null) {\n if (hover) {\n this.addClass(canvas, connector.hoverClass);\n } else {\n this.removeClass(canvas, connector.hoverClass);\n }\n }\n if (hover) {\n this.addClass(canvas, this.hoverClass);\n } else {\n this.removeClass(canvas, this.hoverClass);\n }\n }\n if (connector.connection.hoverPaintStyle != null) {\n connector.connection.paintStyleInUse = hover ? connector.connection.hoverPaintStyle : connector.connection.paintStyle;\n if (!this._suspendDrawing) {\n this._paintConnection(connector.connection);\n }\n }\n if (connector.connection.endpoints[0] !== sourceEndpoint) {\n this.setEndpointHover(connector.connection.endpoints[0], hover, 0, true);\n }\n if (connector.connection.endpoints[1] !== sourceEndpoint) {\n this.setEndpointHover(connector.connection.endpoints[1], hover, 1, true);\n }\n }\n }\n }, {\n key: "destroyConnector",\n value: function destroyConnector(connection) {\n if (connection.connector != null) {\n cleanup(connection.connector);\n }\n }\n }, {\n key: "addConnectorClass",\n value: function addConnectorClass(connector, clazz) {\n if (connector.canvas) {\n this.addClass(connector.canvas, clazz);\n }\n }\n }, {\n key: "removeConnectorClass",\n value: function removeConnectorClass(connector, clazz) {\n if (connector.canvas) {\n this.removeClass(connector.canvas, clazz);\n }\n }\n }, {\n key: "getConnectorClass",\n value: function getConnectorClass(connector) {\n if (connector.canvas) {\n return connector.canvas.className.baseVal;\n } else {\n return "";\n }\n }\n }, {\n key: "setConnectorVisible",\n value: function setConnectorVisible(connector, v) {\n setVisible(connector, v);\n }\n }, {\n key: "applyConnectorType",\n value: function applyConnectorType(connector, t) {\n if (connector.canvas && t.cssClass) {\n var classes = Array.isArray(t.cssClass) ? t.cssClass : [t.cssClass];\n this.addClass(connector.canvas, classes.join(" "));\n }\n }\n }, {\n key: "addEndpointClass",\n value: function addEndpointClass(ep, c) {\n var canvas = getEndpointCanvas(ep.endpoint);\n if (canvas != null) {\n this.addClass(canvas, c);\n }\n }\n }, {\n key: "applyEndpointType",\n value: function applyEndpointType(ep, t) {\n if (t.cssClass) {\n var canvas = getEndpointCanvas(ep.endpoint);\n if (canvas) {\n var classes = Array.isArray(t.cssClass) ? t.cssClass : [t.cssClass];\n this.addClass(canvas, classes.join(" "));\n }\n }\n }\n }, {\n key: "destroyEndpoint",\n value: function destroyEndpoint(ep) {\n var anchorClass = this.endpointAnchorClassPrefix + (ep.currentAnchorClass ? "-" + ep.currentAnchorClass : "");\n this.removeClass(ep.element, anchorClass);\n cleanup(ep.endpoint);\n }\n }, {\n key: "renderEndpoint",\n value: function renderEndpoint(ep, paintStyle) {\n var renderer = endpointMap[ep.endpoint.type];\n if (renderer != null) {\n SvgEndpoint.paint(ep.endpoint, renderer, paintStyle);\n } else {\n log("jsPlumb: no endpoint renderer found for type [" + ep.endpoint.type + "]");\n }\n }\n }, {\n key: "removeEndpointClass",\n value: function removeEndpointClass(ep, c) {\n var canvas = getEndpointCanvas(ep.endpoint);\n if (canvas != null) {\n this.removeClass(canvas, c);\n }\n }\n }, {\n key: "getEndpointClass",\n value: function getEndpointClass(ep) {\n var canvas = getEndpointCanvas(ep.endpoint);\n if (canvas != null) {\n return canvas.className;\n } else {\n return "";\n }\n }\n }, {\n key: "setEndpointHover",\n value: function setEndpointHover(endpoint, hover, endpointIndex, doNotCascade) {\n if (endpoint != null && (hover === false || !this.currentlyDragging && !this.isHoverSuspended())) {\n var canvas = getEndpointCanvas(endpoint.endpoint);\n if (canvas != null) {\n if (endpoint.hoverClass != null) {\n if (hover) {\n this.addClass(canvas, endpoint.hoverClass);\n } else {\n this.removeClass(canvas, endpoint.hoverClass);\n }\n }\n if (endpointIndex === 0 || endpointIndex === 1) {\n var genericHoverClass = endpointIndex === 0 ? this.hoverSourceClass : this.hoverTargetClass;\n if (hover) {\n this.addClass(canvas, genericHoverClass);\n } else {\n this.removeClass(canvas, genericHoverClass);\n }\n }\n }\n if (endpoint.hoverPaintStyle != null) {\n endpoint.paintStyleInUse = hover ? endpoint.hoverPaintStyle : endpoint.paintStyle;\n if (!this._suspendDrawing) {\n this.renderEndpoint(endpoint, endpoint.paintStyleInUse);\n }\n }\n if (!doNotCascade) {\n for (var i = 0; i < endpoint.connections.length; i++) {\n this.setConnectorHover(endpoint.connections[i].connector, hover, endpoint);\n }\n }\n }\n }\n }, {\n key: "setEndpointVisible",\n value: function setEndpointVisible(ep, v) {\n setVisible(ep.endpoint, v);\n }\n }, {\n key: "setGroupVisible",\n value: function setGroupVisible(group, state) {\n var m = group.el.querySelectorAll(SELECTOR_MANAGED_ELEMENT);\n for (var i = 0; i < m.length; i++) {\n if (state) {\n this.show(m[i], true);\n } else {\n this.hide(m[i], true);\n }\n }\n }\n }, {\n key: "deleteConnection",\n value: function deleteConnection(connection, params) {\n if (connection != null && connection.deleted !== true) {\n if (connection.endpoints[0].deleted !== true) {\n this.setEndpointHover(connection.endpoints[0], false, 0, true);\n }\n if (connection.endpoints[1].deleted !== true) {\n this.setEndpointHover(connection.endpoints[1], false, 1, true);\n }\n return _get(_getPrototypeOf(BrowserJsPlumbInstance.prototype), "deleteConnection", this).call(this, connection, params);\n } else {\n return false;\n }\n }\n }, {\n key: "addSourceSelector",\n value: function addSourceSelector(selector, params, exclude) {\n this.addDragFilter(selector);\n return _get(_getPrototypeOf(BrowserJsPlumbInstance.prototype), "addSourceSelector", this).call(this, selector, params, exclude);\n }\n }, {\n key: "removeSourceSelector",\n value: function removeSourceSelector(selector) {\n this.removeDragFilter(selector.selector);\n _get(_getPrototypeOf(BrowserJsPlumbInstance.prototype), "removeSourceSelector", this).call(this, selector);\n }\n }, {\n key: "manage",\n value: function manage(element, internalId, _recalc) {\n if (this.containerType === ElementTypes.SVG && !isSVGElement(element)) {\n throw new Error("ERROR: cannot manage non-svg element when container is an SVG element.");\n }\n var managedElement = _get(_getPrototypeOf(BrowserJsPlumbInstance.prototype), "manage", this).call(this, element, internalId, _recalc);\n if (managedElement != null) {\n if (this._resizeObserver != null) {\n this._resizeObserver.observe(managedElement.el);\n }\n }\n return managedElement;\n }\n }]);\n return BrowserJsPlumbInstance;\n}(JsPlumbInstance);\n\nvar CIRCLE = "circle";\nvar register$2 = function register() {\n registerEndpointRenderer(DotEndpoint.type, {\n makeNode: function makeNode(ep, style) {\n return _node(CIRCLE, {\n "cx": ep.w / 2,\n "cy": ep.h / 2,\n "r": ep.radius\n });\n },\n updateNode: function updateNode(ep, node) {\n _attr(node, {\n "cx": "" + ep.w / 2,\n "cy": "" + ep.h / 2,\n "r": "" + ep.radius\n });\n }\n });\n};\n\nvar RectangleEndpoint = function (_EndpointRepresentati) {\n _inherits(RectangleEndpoint, _EndpointRepresentati);\n var _super = _createSuper(RectangleEndpoint);\n function RectangleEndpoint(endpoint, params) {\n var _this;\n _classCallCheck(this, RectangleEndpoint);\n _this = _super.call(this, endpoint, params);\n _defineProperty(_assertThisInitialized(_this), "width", void 0);\n _defineProperty(_assertThisInitialized(_this), "height", void 0);\n _defineProperty(_assertThisInitialized(_this), "type", RectangleEndpoint.type);\n params = params || {};\n _this.width = params.width || 10;\n _this.height = params.height || 10;\n return _this;\n }\n _createClass(RectangleEndpoint, null, [{\n key: "_getParams",\n value: function _getParams(ep) {\n return {\n width: ep.width,\n height: ep.height\n };\n }\n }]);\n return RectangleEndpoint;\n}(EndpointRepresentation);\n_defineProperty(RectangleEndpoint, "type", "Rectangle");\nvar RectangleEndpointHandler = {\n type: RectangleEndpoint.type,\n cls: RectangleEndpoint,\n compute: function compute(ep, anchorPoint, orientation, endpointStyle) {\n var width = endpointStyle.width || ep.width,\n height = endpointStyle.height || ep.height,\n x = anchorPoint.curX - width / 2,\n y = anchorPoint.curY - height / 2;\n ep.x = x;\n ep.y = y;\n ep.w = width;\n ep.h = height;\n return [x, y, width, height];\n },\n getParams: function getParams(ep) {\n return {\n width: ep.width,\n height: ep.height\n };\n }\n};\n\nvar RECT = "rect";\nvar register$1 = function register() {\n registerEndpointRenderer(RectangleEndpoint.type, {\n makeNode: function makeNode(ep, style) {\n return _node(RECT, {\n "width": ep.w,\n "height": ep.h\n });\n },\n updateNode: function updateNode(ep, node) {\n _attr(node, {\n "width": ep.w,\n "height": ep.h\n });\n }\n });\n};\n\nvar BlankEndpoint = function (_EndpointRepresentati) {\n _inherits(BlankEndpoint, _EndpointRepresentati);\n var _super = _createSuper(BlankEndpoint);\n function BlankEndpoint(endpoint, params) {\n var _this;\n _classCallCheck(this, BlankEndpoint);\n _this = _super.call(this, endpoint, params);\n _defineProperty(_assertThisInitialized(_this), "type", BlankEndpoint.type);\n return _this;\n }\n return BlankEndpoint;\n}(EndpointRepresentation);\n_defineProperty(BlankEndpoint, "type", "Blank");\nvar BlankEndpointHandler = {\n type: BlankEndpoint.type,\n cls: BlankEndpoint,\n compute: function compute(ep, anchorPoint, orientation, endpointStyle) {\n ep.x = anchorPoint.curX;\n ep.y = anchorPoint.curY;\n ep.w = 10;\n ep.h = 0;\n return [anchorPoint.curX, anchorPoint.curY, 10, 0];\n },\n getParams: function getParams(ep) {\n return {};\n }\n};\n\nvar BLANK_ATTRIBUTES = {\n "width": 10,\n "height": 0,\n "fill": "transparent",\n "stroke": "transparent"\n};\nvar register = function register() {\n registerEndpointRenderer(BlankEndpoint.type, {\n makeNode: function makeNode(ep, style) {\n return _node("rect", BLANK_ATTRIBUTES);\n },\n updateNode: function updateNode(ep, node) {\n _attr(node, BLANK_ATTRIBUTES);\n }\n });\n};\n\nregister$2();\nregister();\nregister$1();\n\nvar SupportedEdge;\n(function (SupportedEdge) {\n SupportedEdge[SupportedEdge["top"] = 0] = "top";\n SupportedEdge[SupportedEdge["bottom"] = 1] = "bottom";\n})(SupportedEdge || (SupportedEdge = {}));\nvar DEFAULT_ANCHOR_LOCATIONS = new Map();\nDEFAULT_ANCHOR_LOCATIONS.set(SupportedEdge.top, [AnchorLocations.TopRight, AnchorLocations.TopLeft]);\nDEFAULT_ANCHOR_LOCATIONS.set(SupportedEdge.bottom, [AnchorLocations.BottomRight, AnchorLocations.BottomLeft]);\nvar DEFAULT_LIST_OPTIONS = {\n deriveAnchor: function deriveAnchor(edge, index, ep, conn) {\n return DEFAULT_ANCHOR_LOCATIONS.get(edge)[index];\n }\n};\nvar ATTR_SCROLLABLE_LIST = "jtk-scrollable-list";\nvar SELECTOR_SCROLLABLE_LIST = att(ATTR_SCROLLABLE_LIST);\nvar EVENT_SCROLL = "scroll";\n\nvar JsPlumbListManager = function () {\n function JsPlumbListManager(instance, params) {\n var _this = this;\n _classCallCheck(this, JsPlumbListManager);\n this.instance = instance;\n _defineProperty(this, "options", void 0);\n _defineProperty(this, "count", void 0);\n _defineProperty(this, "lists", void 0);\n this.count = 0;\n this.lists = {};\n this.options = params || {};\n this.instance.bind(EVENT_MANAGE_ELEMENT, function (p) {\n var scrollableLists = _this.instance.getSelector(p.el, SELECTOR_SCROLLABLE_LIST);\n for (var i = 0; i < scrollableLists.length; i++) {\n _this.addList(scrollableLists[i]);\n }\n });\n this.instance.bind(EVENT_UNMANAGE_ELEMENT, function (p) {\n _this.removeList(p.el);\n });\n this.instance.bind(EVENT_CONNECTION, function (params, evt) {\n if (evt == null) {\n var targetParent = _this.findParentList(params.target);\n if (targetParent != null) {\n targetParent.newConnection(params.connection, params.target, 1);\n }\n var sourceParent = _this.findParentList(params.source);\n if (sourceParent != null) {\n sourceParent.newConnection(params.connection, params.source, 0);\n }\n }\n });\n this.instance.bind(INTERCEPT_BEFORE_DROP, function (p) {\n var el = p.dropEndpoint.element;\n var dropList = _this.findParentList(el);\n return dropList == null || el.offsetTop >= dropList.domElement.scrollTop && el.offsetTop + el.offsetHeight <= dropList.domElement.scrollTop + dropList.domElement.offsetHeight;\n });\n }\n _createClass(JsPlumbListManager, [{\n key: "addList",\n value: function addList(el, options) {\n var dp = extend({}, DEFAULT_LIST_OPTIONS);\n extend(dp, this.options);\n options = extend(dp, options || {});\n var id = [this.instance._instanceIndex, this.count++].join("_");\n this.lists[id] = new JsPlumbList(this.instance, el, options, id);\n return this.lists[id];\n }\n }, {\n key: "getList",\n value: function getList(el) {\n var listId = this.instance.getAttribute(el, ATTR_SCROLLABLE_LIST);\n if (listId != null) {\n return this.lists[listId];\n }\n }\n }, {\n key: "removeList",\n value: function removeList(el) {\n var list = this.getList(el);\n if (list) {\n list.destroy();\n delete this.lists[list.id];\n }\n }\n }, {\n key: "findParentList",\n value: function findParentList(el) {\n var parent = el.parentNode,\n container = this.instance.getContainer(),\n parentList;\n while (parent != null && parent !== container && parent !== document) {\n parentList = this.getList(parent);\n if (parentList != null) {\n return parentList;\n }\n parent = parent.parentNode;\n }\n }\n }]);\n return JsPlumbListManager;\n}();\nvar JsPlumbList = function () {\n function JsPlumbList(instance, el, options, id) {\n _classCallCheck(this, JsPlumbList);\n this.instance = instance;\n this.el = el;\n this.options = options;\n this.id = id;\n _defineProperty(this, "_scrollHandler", void 0);\n _defineProperty(this, "domElement", void 0);\n _defineProperty(this, "elId", void 0);\n this.domElement = el;\n this.elId = this.instance.getId(el);\n instance.setAttribute(el, ATTR_SCROLLABLE_LIST, id);\n this._scrollHandler = this.scrollHandler.bind(this);\n this.domElement._jsPlumbScrollHandler = this._scrollHandler;\n instance.on(el, EVENT_SCROLL, this._scrollHandler);\n this._scrollHandler();\n }\n _createClass(JsPlumbList, [{\n key: "deriveAnchor",\n value: function deriveAnchor(edge, index, ep, conn) {\n return this.options.anchor ? this.options.anchor : this.options.deriveAnchor(edge, index, ep, conn);\n }\n }, {\n key: "deriveEndpoint",\n value: function deriveEndpoint(edge, index, ep, conn) {\n return this.options.deriveEndpoint ? this.options.deriveEndpoint(edge, index, ep, conn) : this.options.endpoint ? this.options.endpoint : ep.endpoint.type;\n }\n }, {\n key: "newConnection",\n value: function newConnection(c, el, index) {\n if (el.offsetTop < this.el.scrollTop) {\n this._proxyConnection(el, c, index, SupportedEdge.top);\n } else if (el.offsetTop + el.offsetHeight > this.el.scrollTop + this.domElement.offsetHeight) {\n this._proxyConnection(el, c, index, SupportedEdge.bottom);\n }\n }\n }, {\n key: "scrollHandler",\n value: function scrollHandler() {\n var _this2 = this;\n var children = this.instance.getSelector(this.el, SELECTOR_MANAGED_ELEMENT);\n var _loop = function _loop(i) {\n if (children[i].offsetTop < _this2.el.scrollTop) {\n children[i]._jsPlumbProxies = children[i]._jsPlumbProxies || [];\n _this2.instance.select({\n source: children[i]\n }).each(function (c) {\n _this2._proxyConnection(children[i], c, 0, SupportedEdge.top);\n });\n _this2.instance.select({\n target: children[i]\n }).each(function (c) {\n _this2._proxyConnection(children[i], c, 1, SupportedEdge.top);\n });\n }\n else if (children[i].offsetTop + children[i].offsetHeight > _this2.el.scrollTop + _this2.domElement.offsetHeight) {\n children[i]._jsPlumbProxies = children[i]._jsPlumbProxies || [];\n _this2.instance.select({\n source: children[i]\n }).each(function (c) {\n _this2._proxyConnection(children[i], c, 0, SupportedEdge.bottom);\n });\n _this2.instance.select({\n target: children[i]\n }).each(function (c) {\n _this2._proxyConnection(children[i], c, 1, SupportedEdge.bottom);\n });\n } else if (children[i]._jsPlumbProxies) {\n for (var j = 0; j < children[i]._jsPlumbProxies.length; j++) {\n _this2.instance.unproxyConnection(children[i]._jsPlumbProxies[j][0], children[i]._jsPlumbProxies[j][1]);\n }\n delete children[i]._jsPlumbProxies;\n }\n _this2.instance.revalidate(children[i]);\n };\n for (var i = 0; i < children.length; i++) {\n _loop(i);\n }\n }\n }, {\n key: "_proxyConnection",\n value: function _proxyConnection(el, conn, index, edge) {\n var _this3 = this;\n this.instance.proxyConnection(conn, index, this.domElement, function (c, index) {\n return _this3.deriveEndpoint(edge, index, conn.endpoints[index], conn);\n }, function (c, index) {\n return _this3.deriveAnchor(edge, index, conn.endpoints[index], conn);\n });\n el._jsPlumbProxies = el._jsPlumbProxies || [];\n el._jsPlumbProxies.push([conn, index]);\n }\n }, {\n key: "destroy",\n value: function destroy() {\n this.instance.off(this.el, EVENT_SCROLL, this._scrollHandler);\n delete this.domElement._jsPlumbScrollHandler;\n var children = this.instance.getSelector(this.el, SELECTOR_MANAGED_ELEMENT);\n for (var i = 0; i < children.length; i++) {\n if (children[i]._jsPlumbProxies) {\n for (var j = 0; j < children[i]._jsPlumbProxies.length; j++) {\n this.instance.unproxyConnection(children[i]._jsPlumbProxies[j][0], children[i]._jsPlumbProxies[j][1]);\n }\n delete children[i]._jsPlumbProxies;\n }\n }\n }\n }]);\n return JsPlumbList;\n}();\n\nvar VERY_SMALL_VALUE = 0.0000000001;\nfunction gentleRound(n) {\n var f = Math.floor(n),\n r = Math.ceil(n);\n if (n - f < VERY_SMALL_VALUE) {\n return f;\n } else if (r - n < VERY_SMALL_VALUE) {\n return r;\n }\n return n;\n}\nvar ArcSegment = function (_AbstractSegment) {\n _inherits(ArcSegment, _AbstractSegment);\n var _super = _createSuper(ArcSegment);\n function ArcSegment(params) {\n var _this;\n _classCallCheck(this, ArcSegment);\n _this = _super.call(this, params);\n _defineProperty(_assertThisInitialized(_this), "type", ArcSegment.segmentType);\n _defineProperty(_assertThisInitialized(_this), "cx", void 0);\n _defineProperty(_assertThisInitialized(_this), "cy", void 0);\n _defineProperty(_assertThisInitialized(_this), "radius", void 0);\n _defineProperty(_assertThisInitialized(_this), "anticlockwise", void 0);\n _defineProperty(_assertThisInitialized(_this), "startAngle", void 0);\n _defineProperty(_assertThisInitialized(_this), "endAngle", void 0);\n _defineProperty(_assertThisInitialized(_this), "sweep", void 0);\n _defineProperty(_assertThisInitialized(_this), "length", void 0);\n _defineProperty(_assertThisInitialized(_this), "circumference", void 0);\n _defineProperty(_assertThisInitialized(_this), "frac", void 0);\n _this.cx = params.cx;\n _this.cy = params.cy;\n _this.radius = params.r;\n _this.anticlockwise = params.ac;\n if (params.startAngle && params.endAngle) {\n _this.startAngle = params.startAngle;\n _this.endAngle = params.endAngle;\n _this.x1 = _this.cx + _this.radius * Math.cos(_this.startAngle);\n _this.y1 = _this.cy + _this.radius * Math.sin(_this.startAngle);\n _this.x2 = _this.cx + _this.radius * Math.cos(_this.endAngle);\n _this.y2 = _this.cy + _this.radius * Math.sin(_this.endAngle);\n } else {\n _this.startAngle = _this._calcAngle(_this.x1, _this.y1);\n _this.endAngle = _this._calcAngle(_this.x2, _this.y2);\n }\n if (_this.endAngle < 0) {\n _this.endAngle += TWO_PI;\n }\n if (_this.startAngle < 0) {\n _this.startAngle += TWO_PI;\n }\n var ea = _this.endAngle < _this.startAngle ? _this.endAngle + TWO_PI : _this.endAngle;\n _this.sweep = Math.abs(ea - _this.startAngle);\n if (_this.anticlockwise) {\n _this.sweep = TWO_PI - _this.sweep;\n }\n _this.circumference = 2 * Math.PI * _this.radius;\n _this.frac = _this.sweep / TWO_PI;\n _this.length = _this.circumference * _this.frac;\n _this.extents = {\n xmin: _this.cx - _this.radius,\n xmax: _this.cx + _this.radius,\n ymin: _this.cy - _this.radius,\n ymax: _this.cy + _this.radius\n };\n return _this;\n }\n _createClass(ArcSegment, [{\n key: "_calcAngle",\n value: function _calcAngle(_x, _y) {\n return theta({\n x: this.cx,\n y: this.cy\n }, {\n x: _x,\n y: _y\n });\n }\n }, {\n key: "_calcAngleForLocation",\n value: function _calcAngleForLocation(segment, location) {\n if (segment.anticlockwise) {\n var sa = segment.startAngle < segment.endAngle ? segment.startAngle + TWO_PI : segment.startAngle,\n s = Math.abs(sa - segment.endAngle);\n return sa - s * location;\n } else {\n var ea = segment.endAngle < segment.startAngle ? segment.endAngle + TWO_PI : segment.endAngle,\n ss = Math.abs(ea - segment.startAngle);\n return segment.startAngle + ss * location;\n }\n }\n }, {\n key: "getPath",\n value: function getPath(isFirstSegment) {\n var laf = this.sweep > Math.PI ? 1 : 0,\n sf = this.anticlockwise ? 0 : 1;\n return (isFirstSegment ? "M" + this.x1 + " " + this.y1 + " " : "") + "A " + this.radius + " " + this.radius + " 0 " + laf + "," + sf + " " + this.x2 + " " + this.y2;\n }\n }, {\n key: "getLength",\n value: function getLength() {\n return this.length;\n }\n }, {\n key: "pointOnPath",\n value: function pointOnPath(location, absolute) {\n if (location === 0) {\n return {\n x: this.x1,\n y: this.y1,\n theta: this.startAngle\n };\n } else if (location === 1) {\n return {\n x: this.x2,\n y: this.y2,\n theta: this.endAngle\n };\n }\n if (absolute) {\n location = location / length;\n }\n var angle = this._calcAngleForLocation(this, location),\n _x = this.cx + this.radius * Math.cos(angle),\n _y = this.cy + this.radius * Math.sin(angle);\n return {\n x: gentleRound(_x),\n y: gentleRound(_y),\n theta: angle\n };\n }\n }, {\n key: "gradientAtPoint",\n value: function gradientAtPoint(location, absolute) {\n var p = this.pointOnPath(location, absolute);\n var m = normal({\n x: this.cx,\n y: this.cy\n }, p);\n if (!this.anticlockwise && (m === Infinity || m === -Infinity)) {\n m *= -1;\n }\n return m;\n }\n }, {\n key: "pointAlongPathFrom",\n value: function pointAlongPathFrom(location, distance, absolute) {\n var p = this.pointOnPath(location, absolute),\n arcSpan = distance / this.circumference * 2 * Math.PI,\n dir = this.anticlockwise ? -1 : 1,\n startAngle = p.theta + dir * arcSpan,\n startX = this.cx + this.radius * Math.cos(startAngle),\n startY = this.cy + this.radius * Math.sin(startAngle);\n return {\n x: startX,\n y: startY\n };\n }\n }]);\n return ArcSegment;\n}(AbstractSegment);\n_defineProperty(ArcSegment, "segmentType", "Arc");\n\nvar AbstractBezierConnector = function (_AbstractConnector) {\n _inherits(AbstractBezierConnector, _AbstractConnector);\n var _super = _createSuper(AbstractBezierConnector);\n function AbstractBezierConnector(connection, params) {\n var _this;\n _classCallCheck(this, AbstractBezierConnector);\n _this = _super.call(this, connection, params);\n _this.connection = connection;\n _defineProperty(_assertThisInitialized(_this), "showLoopback", void 0);\n _defineProperty(_assertThisInitialized(_this), "curviness", void 0);\n _defineProperty(_assertThisInitialized(_this), "margin", void 0);\n _defineProperty(_assertThisInitialized(_this), "proximityLimit", void 0);\n _defineProperty(_assertThisInitialized(_this), "orientation", void 0);\n _defineProperty(_assertThisInitialized(_this), "loopbackRadius", void 0);\n _defineProperty(_assertThisInitialized(_this), "clockwise", void 0);\n _defineProperty(_assertThisInitialized(_this), "isLoopbackCurrently", void 0);\n _defineProperty(_assertThisInitialized(_this), "geometry", null);\n params = params || {};\n _this.showLoopback = params.showLoopback !== false;\n _this.curviness = params.curviness || 10;\n _this.margin = params.margin || 5;\n _this.proximityLimit = params.proximityLimit || 80;\n _this.clockwise = params.orientation && params.orientation === "clockwise";\n _this.loopbackRadius = params.loopbackRadius || 25;\n _this.isLoopbackCurrently = false;\n return _this;\n }\n _createClass(AbstractBezierConnector, [{\n key: "getDefaultStubs",\n value: function getDefaultStubs() {\n return [0, 0];\n }\n }, {\n key: "_compute",\n value: function _compute(paintInfo, p) {\n var sp = p.sourcePos,\n tp = p.targetPos,\n _w = Math.abs(sp.curX - tp.curX),\n _h = Math.abs(sp.curY - tp.curY);\n if (!this.showLoopback || p.sourceEndpoint.elementId !== p.targetEndpoint.elementId) {\n this.isLoopbackCurrently = false;\n this._computeBezier(paintInfo, p, sp, tp, _w, _h);\n } else {\n this.isLoopbackCurrently = true;\n var x1 = p.sourcePos.curX,\n y1 = p.sourcePos.curY - this.margin,\n cx = x1,\n cy = y1 - this.loopbackRadius,\n _x = cx - this.loopbackRadius,\n _y = cy - this.loopbackRadius;\n _w = 2 * this.loopbackRadius;\n _h = 2 * this.loopbackRadius;\n paintInfo.points[0] = _x;\n paintInfo.points[1] = _y;\n paintInfo.points[2] = _w;\n paintInfo.points[3] = _h;\n this._addSegment(ArcSegment, {\n loopback: true,\n x1: x1 - _x + 4,\n y1: y1 - _y,\n startAngle: 0,\n endAngle: 2 * Math.PI,\n r: this.loopbackRadius,\n ac: !this.clockwise,\n x2: x1 - _x - 4,\n y2: y1 - _y,\n cx: cx - _x,\n cy: cy - _y\n });\n }\n }\n }, {\n key: "exportGeometry",\n value: function exportGeometry() {\n if (this.geometry == null) {\n return null;\n } else {\n return {\n controlPoints: [extend({}, this.geometry.controlPoints[0]), extend({}, this.geometry.controlPoints[1])],\n source: extend({}, this.geometry.source),\n target: extend({}, this.geometry.target)\n };\n }\n }\n }, {\n key: "transformGeometry",\n value: function transformGeometry(g, dx, dy) {\n return {\n controlPoints: [{\n x: g.controlPoints[0].x + dx,\n y: g.controlPoints[0].y + dy\n }, {\n x: g.controlPoints[1].x + dx,\n y: g.controlPoints[1].y + dy\n }],\n source: this.transformAnchorPlacement(g.source, dx, dy),\n target: this.transformAnchorPlacement(g.target, dx, dy)\n };\n }\n }, {\n key: "importGeometry",\n value: function importGeometry(geometry) {\n if (geometry != null) {\n if (geometry.controlPoints == null || geometry.controlPoints.length != 2) {\n log("jsPlumb Bezier: cannot import geometry; controlPoints missing or does not have length 2");\n this.setGeometry(null, true);\n return false;\n }\n if (geometry.controlPoints[0].x == null || geometry.controlPoints[0].y == null || geometry.controlPoints[1].x == null || geometry.controlPoints[1].y == null) {\n log("jsPlumb Bezier: cannot import geometry; controlPoints malformed");\n this.setGeometry(null, true);\n return false;\n }\n if (geometry.source == null || geometry.source.curX == null || geometry.source.curY == null) {\n log("jsPlumb Bezier: cannot import geometry; source missing or malformed");\n this.setGeometry(null, true);\n return false;\n }\n if (geometry.target == null || geometry.target.curX == null || geometry.target.curY == null) {\n log("jsPlumb Bezier: cannot import geometry; target missing or malformed");\n this.setGeometry(null, true);\n return false;\n }\n this.setGeometry(geometry, false);\n return true;\n } else {\n return false;\n }\n }\n }]);\n return AbstractBezierConnector;\n}(AbstractConnector);\n\nvar Vectors = {\n subtract: function subtract(v1, v2) {\n return {\n x: v1.x - v2.x,\n y: v1.y - v2.y\n };\n },\n dotProduct: function dotProduct(v1, v2) {\n return v1.x * v2.x + v1.y * v2.y;\n },\n square: function square(v) {\n return Math.sqrt(v.x * v.x + v.y * v.y);\n },\n scale: function scale(v, s) {\n return {\n x: v.x * s,\n y: v.y * s\n };\n }\n};\nvar maxRecursion = 64;\nvar flatnessTolerance = Math.pow(2.0, -maxRecursion - 1);\nfunction distanceFromCurve(point, curve) {\n var candidates = [],\n w = _convertToBezier(point, curve),\n degree = curve.length - 1,\n higherDegree = 2 * degree - 1,\n numSolutions = _findRoots(w, higherDegree, candidates, 0),\n v = Vectors.subtract(point, curve[0]),\n dist = Vectors.square(v),\n t = 0.0,\n newDist;\n for (var i = 0; i < numSolutions; i++) {\n v = Vectors.subtract(point, _bezier(curve, degree, candidates[i], null, null));\n newDist = Vectors.square(v);\n if (newDist < dist) {\n dist = newDist;\n t = candidates[i];\n }\n }\n v = Vectors.subtract(point, curve[degree]);\n newDist = Vectors.square(v);\n if (newDist < dist) {\n dist = newDist;\n t = 1.0;\n }\n return {\n location: t,\n distance: dist\n };\n}\nfunction nearestPointOnCurve(point, curve) {\n var td = distanceFromCurve(point, curve);\n return {\n point: _bezier(curve, curve.length - 1, td.location, null, null),\n location: td.location\n };\n}\nfunction _convertToBezier(point, curve) {\n var degree = curve.length - 1,\n higherDegree = 2 * degree - 1,\n c = [],\n d = [],\n cdTable = [],\n w = [],\n z = [[1.0, 0.6, 0.3, 0.1], [0.4, 0.6, 0.6, 0.4], [0.1, 0.3, 0.6, 1.0]];\n for (var i = 0; i <= degree; i++) {\n c[i] = Vectors.subtract(curve[i], point);\n }\n for (var _i = 0; _i <= degree - 1; _i++) {\n d[_i] = Vectors.subtract(curve[_i + 1], curve[_i]);\n d[_i] = Vectors.scale(d[_i], 3.0);\n }\n for (var row = 0; row <= degree - 1; row++) {\n for (var column = 0; column <= degree; column++) {\n if (!cdTable[row]) cdTable[row] = [];\n cdTable[row][column] = Vectors.dotProduct(d[row], c[column]);\n }\n }\n for (var _i2 = 0; _i2 <= higherDegree; _i2++) {\n if (!w[_i2]) {\n w[_i2] = [];\n }\n w[_i2].y = 0.0;\n w[_i2].x = parseFloat("" + _i2) / higherDegree;\n }\n var n = degree,\n m = degree - 1;\n for (var k = 0; k <= n + m; k++) {\n var lb = Math.max(0, k - m),\n ub = Math.min(k, n);\n for (var _i3 = lb; _i3 <= ub; _i3++) {\n var j = k - _i3;\n w[_i3 + j].y += cdTable[j][_i3] * z[j][_i3];\n }\n }\n return w;\n}\nfunction _findRoots(w, degree, t, depth) {\n var left = [],\n right = [],\n left_count,\n right_count,\n left_t = [],\n right_t = [];\n switch (_getCrossingCount(w, degree)) {\n case 0:\n {\n return 0;\n }\n case 1:\n {\n if (depth >= maxRecursion) {\n t[0] = (w[0].x + w[degree].x) / 2.0;\n return 1;\n }\n if (_isFlatEnough(w, degree)) {\n t[0] = _computeXIntercept(w, degree);\n return 1;\n }\n break;\n }\n }\n _bezier(w, degree, 0.5, left, right);\n left_count = _findRoots(left, degree, left_t, depth + 1);\n right_count = _findRoots(right, degree, right_t, depth + 1);\n for (var i = 0; i < left_count; i++) {\n t[i] = left_t[i];\n }\n for (var _i4 = 0; _i4 < right_count; _i4++) {\n t[_i4 + left_count] = right_t[_i4];\n }\n return left_count + right_count;\n}\nfunction _getCrossingCount(curve, degree) {\n var n_crossings = 0,\n sign,\n old_sign;\n sign = old_sign = sgn$1(curve[0].y);\n for (var i = 1; i <= degree; i++) {\n sign = sgn$1(curve[i].y);\n if (sign != old_sign) n_crossings++;\n old_sign = sign;\n }\n return n_crossings;\n}\nfunction _isFlatEnough(curve, degree) {\n var error, intercept_1, intercept_2, left_intercept, right_intercept, a, b, c, det, dInv, a1, b1, c1, a2, b2, c2;\n a = curve[0].y - curve[degree].y;\n b = curve[degree].x - curve[0].x;\n c = curve[0].x * curve[degree].y - curve[degree].x * curve[0].y;\n var max_distance_above, max_distance_below;\n max_distance_above = max_distance_below = 0.0;\n for (var i = 1; i < degree; i++) {\n var value = a * curve[i].x + b * curve[i].y + c;\n if (value > max_distance_above) {\n max_distance_above = value;\n } else if (value < max_distance_below) {\n max_distance_below = value;\n }\n }\n a1 = 0.0;\n b1 = 1.0;\n c1 = 0.0;\n a2 = a;\n b2 = b;\n c2 = c - max_distance_above;\n det = a1 * b2 - a2 * b1;\n dInv = 1.0 / det;\n intercept_1 = (b1 * c2 - b2 * c1) * dInv;\n a2 = a;\n b2 = b;\n c2 = c - max_distance_below;\n det = a1 * b2 - a2 * b1;\n dInv = 1.0 / det;\n intercept_2 = (b1 * c2 - b2 * c1) * dInv;\n left_intercept = Math.min(intercept_1, intercept_2);\n right_intercept = Math.max(intercept_1, intercept_2);\n error = right_intercept - left_intercept;\n return error < flatnessTolerance ? 1 : 0;\n}\nfunction _computeXIntercept(curve, degree) {\n var XLK = 1.0,\n YLK = 0.0,\n XNM = curve[degree].x - curve[0].x,\n YNM = curve[degree].y - curve[0].y,\n XMK = curve[0].x - 0.0,\n YMK = curve[0].y - 0.0,\n det = XNM * YLK - YNM * XLK,\n detInv = 1.0 / det,\n S = (XNM * YMK - YNM * XMK) * detInv;\n return 0.0 + XLK * S;\n}\nfunction _bezier(curve, degree, t, left, right) {\n var temp = [[]];\n for (var j = 0; j <= degree; j++) {\n temp[0][j] = curve[j];\n }\n for (var i = 1; i <= degree; i++) {\n for (var _j = 0; _j <= degree - i; _j++) {\n if (!temp[i]) temp[i] = [];\n if (!temp[i][_j]) temp[i][_j] = {};\n temp[i][_j].x = (1.0 - t) * temp[i - 1][_j].x + t * temp[i - 1][_j + 1].x;\n temp[i][_j].y = (1.0 - t) * temp[i - 1][_j].y + t * temp[i - 1][_j + 1].y;\n }\n }\n if (left != null) {\n for (var _j2 = 0; _j2 <= degree; _j2++) {\n left[_j2] = temp[_j2][0];\n }\n }\n if (right != null) {\n for (var _j3 = 0; _j3 <= degree; _j3++) {\n right[_j3] = temp[degree - _j3][_j3];\n }\n }\n return temp[degree][0];\n}\nfunction _getLUT(steps, curve) {\n var out = [];\n steps--;\n for (var n = 0; n <= steps; n++) {\n out.push(_computeLookup(n / steps, curve));\n }\n return out;\n}\nfunction _computeLookup(e, curve) {\n var EMPTY_POINT = {\n x: 0,\n y: 0\n };\n if (e === 0) {\n return curve[0];\n }\n var degree = curve.length - 1;\n if (e === 1) {\n return curve[degree];\n }\n var o = curve;\n var s = 1 - e;\n if (degree === 0) {\n return curve[0];\n }\n if (degree === 1) {\n return {\n x: s * o[0].x + e * o[1].x,\n y: s * o[0].y + e * o[1].y\n };\n }\n if (4 > degree) {\n var l = s * s,\n h = e * e,\n u = 0,\n m,\n g,\n f;\n if (degree === 2) {\n o = [o[0], o[1], o[2], EMPTY_POINT];\n m = l;\n g = 2 * (s * e);\n f = h;\n } else if (degree === 3) {\n m = l * s;\n g = 3 * (l * e);\n f = 3 * (s * h);\n u = e * h;\n }\n return {\n x: m * o[0].x + g * o[1].x + f * o[2].x + u * o[3].x,\n y: m * o[0].y + g * o[1].y + f * o[2].y + u * o[3].y\n };\n } else {\n return EMPTY_POINT;\n }\n}\nfunction computeBezierLength(curve) {\n var length = 0;\n if (!isPoint(curve)) {\n var steps = 16;\n var lut = _getLUT(steps, curve);\n for (var i = 0; i < steps - 1; i++) {\n var a = lut[i],\n b = lut[i + 1];\n length += dist(a, b);\n }\n }\n return length;\n}\nvar _curveFunctionCache = new Map();\nfunction _getCurveFunctions(order) {\n var fns = _curveFunctionCache.get(order);\n if (!fns) {\n fns = [];\n var f_term = function f_term() {\n return function (t) {\n return Math.pow(t, order);\n };\n },\n l_term = function l_term() {\n return function (t) {\n return Math.pow(1 - t, order);\n };\n },\n c_term = function c_term(c) {\n return function (t) {\n return c;\n };\n },\n t_term = function t_term() {\n return function (t) {\n return t;\n };\n },\n one_minus_t_term = function one_minus_t_term() {\n return function (t) {\n return 1 - t;\n };\n },\n _termFunc = function _termFunc(terms) {\n return function (t) {\n var p = 1;\n for (var i = 0; i < terms.length; i++) {\n p = p * terms[i](t);\n }\n return p;\n };\n };\n fns.push(f_term());\n for (var i = 1; i < order; i++) {\n var terms = [c_term(order)];\n for (var j = 0; j < order - i; j++) {\n terms.push(t_term());\n }\n for (var _j4 = 0; _j4 < i; _j4++) {\n terms.push(one_minus_t_term());\n }\n fns.push(_termFunc(terms));\n }\n fns.push(l_term());\n _curveFunctionCache.set(order, fns);\n }\n return fns;\n}\nfunction pointOnCurve(curve, location) {\n var cc = _getCurveFunctions(curve.length - 1),\n _x = 0,\n _y = 0;\n for (var i = 0; i < curve.length; i++) {\n _x = _x + curve[i].x * cc[i](location);\n _y = _y + curve[i].y * cc[i](location);\n }\n return {\n x: _x,\n y: _y\n };\n}\nfunction dist(p1, p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\nfunction isPoint(curve) {\n return curve[0].x === curve[1].x && curve[0].y === curve[1].y;\n}\nfunction pointAlongPath(curve, location, distance) {\n if (isPoint(curve)) {\n return {\n point: curve[0],\n location: location\n };\n }\n var prev = pointOnCurve(curve, location),\n tally = 0,\n curLoc = location,\n direction = distance > 0 ? 1 : -1,\n cur = null;\n while (tally < Math.abs(distance)) {\n curLoc += 0.005 * direction;\n cur = pointOnCurve(curve, curLoc);\n tally += dist(cur, prev);\n prev = cur;\n }\n return {\n point: cur,\n location: curLoc\n };\n}\nfunction pointAlongCurveFrom(curve, location, distance) {\n return pointAlongPath(curve, location, distance).point;\n}\nfunction locationAlongCurveFrom(curve, location, distance) {\n return pointAlongPath(curve, location, distance).location;\n}\nfunction gradientAtPoint(curve, location) {\n var p1 = pointOnCurve(curve, location),\n p2 = pointOnCurve(curve.slice(0, curve.length - 1), location),\n dy = p2.y - p1.y,\n dx = p2.x - p1.x;\n return dy === 0 ? Infinity : Math.atan(dy / dx);\n}\nfunction gradientAtPointAlongPathFrom(curve, location, distance) {\n var p = pointAlongPath(curve, location, distance);\n if (p.location > 1) p.location = 1;\n if (p.location < 0) p.location = 0;\n return gradientAtPoint(curve, p.location);\n}\nfunction perpendicularToPathAt(curve, location, length, distance) {\n distance = distance == null ? 0 : distance;\n var p = pointAlongPath(curve, location, distance),\n m = gradientAtPoint(curve, p.location),\n _theta2 = Math.atan(-1 / m),\n y = length / 2 * Math.sin(_theta2),\n x = length / 2 * Math.cos(_theta2);\n return [{\n x: p.point.x + x,\n y: p.point.y + y\n }, {\n x: p.point.x - x,\n y: p.point.y - y\n }];\n}\nfunction bezierLineIntersection(x1, y1, x2, y2, curve) {\n var a = y2 - y1,\n b = x1 - x2,\n c = x1 * (y1 - y2) + y1 * (x2 - x1),\n coeffs = _computeCoefficients(curve),\n p = [a * coeffs[0][0] + b * coeffs[1][0], a * coeffs[0][1] + b * coeffs[1][1], a * coeffs[0][2] + b * coeffs[1][2], a * coeffs[0][3] + b * coeffs[1][3] + c],\n r = _cubicRoots.apply(null, p),\n intersections = [];\n if (r != null) {\n for (var i = 0; i < 3; i++) {\n var _t = r[i],\n t2 = Math.pow(_t, 2),\n t3 = Math.pow(_t, 3),\n x = {\n x: coeffs[0][0] * t3 + coeffs[0][1] * t2 + coeffs[0][2] * _t + coeffs[0][3],\n y: coeffs[1][0] * t3 + coeffs[1][1] * t2 + coeffs[1][2] * _t + coeffs[1][3]\n };\n var s = void 0;\n if (x2 - x1 !== 0) {\n s = (x[0] - x1) / (x2 - x1);\n } else {\n s = (x[1] - y1) / (y2 - y1);\n }\n if (_t >= 0 && _t <= 1.0 && s >= 0 && s <= 1.0) {\n intersections.push(x);\n }\n }\n }\n return intersections;\n}\nfunction boxIntersection(x, y, w, h, curve) {\n var i = [];\n i.push.apply(i, bezierLineIntersection(x, y, x + w, y, curve));\n i.push.apply(i, bezierLineIntersection(x + w, y, x + w, y + h, curve));\n i.push.apply(i, bezierLineIntersection(x + w, y + h, x, y + h, curve));\n i.push.apply(i, bezierLineIntersection(x, y + h, x, y, curve));\n return i;\n}\nfunction boundingBoxIntersection(boundingBox, curve) {\n var i = [];\n i.push.apply(i, bezierLineIntersection(boundingBox.x, boundingBox.y, boundingBox.x + boundingBox.w, boundingBox.y, curve));\n i.push.apply(i, bezierLineIntersection(boundingBox.x + boundingBox.w, boundingBox.y, boundingBox.x + boundingBox.w, boundingBox.y + boundingBox.h, curve));\n i.push.apply(i, bezierLineIntersection(boundingBox.x + boundingBox.w, boundingBox.y + boundingBox.h, boundingBox.x, boundingBox.y + boundingBox.h, curve));\n i.push.apply(i, bezierLineIntersection(boundingBox.x, boundingBox.y + boundingBox.h, boundingBox.x, boundingBox.y, curve));\n return i;\n}\nfunction _computeCoefficientsForAxis(curve, axis) {\n return [-curve[0][axis] + 3 * curve[1][axis] + -3 * curve[2][axis] + curve[3][axis], 3 * curve[0][axis] - 6 * curve[1][axis] + 3 * curve[2][axis], -3 * curve[0][axis] + 3 * curve[1][axis], curve[0][axis]];\n}\nfunction _computeCoefficients(curve) {\n return [_computeCoefficientsForAxis(curve, "x"), _computeCoefficientsForAxis(curve, "y")];\n}\nfunction _cubicRoots(a, b, c, d) {\n var A = b / a,\n B = c / a,\n C = d / a,\n Q = (3 * B - Math.pow(A, 2)) / 9,\n R = (9 * A * B - 27 * C - 2 * Math.pow(A, 3)) / 54,\n D = Math.pow(Q, 3) + Math.pow(R, 2),\n S,\n T,\n t = [0, 0, 0];\n if (D >= 0)\n {\n S = sgn$1(R + Math.sqrt(D)) * Math.pow(Math.abs(R + Math.sqrt(D)), 1 / 3);\n T = sgn$1(R - Math.sqrt(D)) * Math.pow(Math.abs(R - Math.sqrt(D)), 1 / 3);\n t[0] = -A / 3 + (S + T);\n t[1] = -A / 3 - (S + T) / 2;\n t[2] = -A / 3 - (S + T) / 2;\n if (Math.abs(Math.sqrt(3) * (S - T) / 2) !== 0) {\n t[1] = -1;\n t[2] = -1;\n }\n } else\n {\n var th = Math.acos(R / Math.sqrt(-Math.pow(Q, 3)));\n t[0] = 2 * Math.sqrt(-Q) * Math.cos(th / 3) - A / 3;\n t[1] = 2 * Math.sqrt(-Q) * Math.cos((th + 2 * Math.PI) / 3) - A / 3;\n t[2] = 2 * Math.sqrt(-Q) * Math.cos((th + 4 * Math.PI) / 3) - A / 3;\n }\n for (var i = 0; i < 3; i++) {\n if (t[i] < 0 || t[i] > 1.0) {\n t[i] = -1;\n }\n }\n return t;\n}\n\nvar BezierSegment = function (_AbstractSegment) {\n _inherits(BezierSegment, _AbstractSegment);\n var _super = _createSuper(BezierSegment);\n function BezierSegment(params) {\n var _this;\n _classCallCheck(this, BezierSegment);\n _this = _super.call(this, params);\n _defineProperty(_assertThisInitialized(_this), "curve", void 0);\n _defineProperty(_assertThisInitialized(_this), "cp1x", void 0);\n _defineProperty(_assertThisInitialized(_this), "cp1y", void 0);\n _defineProperty(_assertThisInitialized(_this), "cp2x", void 0);\n _defineProperty(_assertThisInitialized(_this), "cp2y", void 0);\n _defineProperty(_assertThisInitialized(_this), "length", 0);\n _defineProperty(_assertThisInitialized(_this), "type", BezierSegment.segmentType);\n _this.cp1x = params.cp1x;\n _this.cp1y = params.cp1y;\n _this.cp2x = params.cp2x;\n _this.cp2y = params.cp2y;\n _this.x1 = params.x1;\n _this.x2 = params.x2;\n _this.y1 = params.y1;\n _this.y2 = params.y2;\n _this.curve = [{\n x: _this.x1,\n y: _this.y1\n }, {\n x: _this.cp1x,\n y: _this.cp1y\n }, {\n x: _this.cp2x,\n y: _this.cp2y\n }, {\n x: _this.x2,\n y: _this.y2\n }];\n _this.extents = {\n xmin: Math.min(_this.x1, _this.x2, _this.cp1x, _this.cp2x),\n ymin: Math.min(_this.y1, _this.y2, _this.cp1y, _this.cp2y),\n xmax: Math.max(_this.x1, _this.x2, _this.cp1x, _this.cp2x),\n ymax: Math.max(_this.y1, _this.y2, _this.cp1y, _this.cp2y)\n };\n return _this;\n }\n _createClass(BezierSegment, [{\n key: "getPath",\n value: function getPath(isFirstSegment) {\n return (isFirstSegment ? "M " + this.x2 + " " + this.y2 + " " : "") + "C " + this.cp2x + " " + this.cp2y + " " + this.cp1x + " " + this.cp1y + " " + this.x1 + " " + this.y1;\n }\n }, {\n key: "pointOnPath",\n value: function pointOnPath(location, absolute) {\n location = BezierSegment._translateLocation(this.curve, location, absolute);\n return pointOnCurve(this.curve, location);\n }\n }, {\n key: "gradientAtPoint",\n value: function gradientAtPoint$1(location, absolute) {\n location = BezierSegment._translateLocation(this.curve, location, absolute);\n return gradientAtPoint(this.curve, location);\n }\n }, {\n key: "pointAlongPathFrom",\n value: function pointAlongPathFrom(location, distance, absolute) {\n location = BezierSegment._translateLocation(this.curve, location, absolute);\n return pointAlongCurveFrom(this.curve, location, distance);\n }\n }, {\n key: "getLength",\n value: function getLength() {\n if (this.length == null || this.length === 0) {\n this.length = computeBezierLength(this.curve);\n }\n return this.length;\n }\n }, {\n key: "findClosestPointOnPath",\n value: function findClosestPointOnPath(x, y) {\n var p = nearestPointOnCurve({\n x: x,\n y: y\n }, this.curve);\n return {\n d: Math.sqrt(Math.pow(p.point.x - x, 2) + Math.pow(p.point.y - y, 2)),\n x: p.point.x,\n y: p.point.y,\n l: 1 - p.location,\n s: this,\n x1: null,\n y1: null,\n x2: null,\n y2: null\n };\n }\n }, {\n key: "lineIntersection",\n value: function lineIntersection(x1, y1, x2, y2) {\n return bezierLineIntersection(x1, y1, x2, y2, this.curve);\n }\n }], [{\n key: "_translateLocation",\n value: function _translateLocation(_curve, location, absolute) {\n if (absolute) {\n location = locationAlongCurveFrom(_curve, location > 0 ? 0 : 1, location);\n }\n return location;\n }\n }]);\n return BezierSegment;\n}(AbstractSegment);\n_defineProperty(BezierSegment, "segmentType", "Bezier");\n\nvar BezierConnector = function (_AbstractBezierConnec) {\n _inherits(BezierConnector, _AbstractBezierConnec);\n var _super = _createSuper(BezierConnector);\n function BezierConnector(connection, params) {\n var _this;\n _classCallCheck(this, BezierConnector);\n _this = _super.call(this, connection, params);\n _this.connection = connection;\n _defineProperty(_assertThisInitialized(_this), "type", BezierConnector.type);\n _defineProperty(_assertThisInitialized(_this), "majorAnchor", void 0);\n _defineProperty(_assertThisInitialized(_this), "minorAnchor", void 0);\n params = params || {};\n _this.majorAnchor = params.curviness || 150;\n _this.minorAnchor = 10;\n return _this;\n }\n _createClass(BezierConnector, [{\n key: "getCurviness",\n value: function getCurviness() {\n return this.majorAnchor;\n }\n }, {\n key: "_findControlPoint",\n value: function _findControlPoint(point, sourceAnchorPosition, targetAnchorPosition, soo, too) {\n var perpendicular = soo[0] !== too[0] || soo[1] === too[1],\n p = {\n x: 0,\n y: 0\n };\n if (!perpendicular) {\n if (soo[0] === 0) {\n p.x = sourceAnchorPosition.curX < targetAnchorPosition.curX ? point.x + this.minorAnchor : point.x - this.minorAnchor;\n } else {\n p.x = point.x - this.majorAnchor * soo[0];\n }\n if (soo[1] === 0) {\n p.y = sourceAnchorPosition.curY < targetAnchorPosition.curY ? point.y + this.minorAnchor : point.y - this.minorAnchor;\n } else {\n p.y = point.y + this.majorAnchor * too[1];\n }\n } else {\n if (too[0] === 0) {\n p.x = targetAnchorPosition.curX < sourceAnchorPosition.curX ? point.x + this.minorAnchor : point.x - this.minorAnchor;\n } else {\n p.x = point.x + this.majorAnchor * too[0];\n }\n if (too[1] === 0) {\n p.y = targetAnchorPosition.curY < sourceAnchorPosition.curY ? point.y + this.minorAnchor : point.y - this.minorAnchor;\n } else {\n p.y = point.y + this.majorAnchor * soo[1];\n }\n }\n return p;\n }\n }, {\n key: "_computeBezier",\n value: function _computeBezier(paintInfo, p, sp, tp, _w, _h) {\n var _CP,\n _CP2,\n _sx = sp.curX < tp.curX ? _w : 0,\n _sy = sp.curY < tp.curY ? _h : 0,\n _tx = sp.curX < tp.curX ? 0 : _w,\n _ty = sp.curY < tp.curY ? 0 : _h;\n if (this.edited !== true) {\n _CP = this._findControlPoint({\n x: _sx,\n y: _sy\n }, sp, tp, paintInfo.so, paintInfo.to);\n _CP2 = this._findControlPoint({\n x: _tx,\n y: _ty\n }, tp, sp, paintInfo.to, paintInfo.so);\n } else {\n _CP = this.geometry.controlPoints[0];\n _CP2 = this.geometry.controlPoints[1];\n }\n this.geometry = {\n controlPoints: [_CP, _CP2],\n source: p.sourcePos,\n target: p.targetPos\n };\n this._addSegment(BezierSegment, {\n x1: _sx,\n y1: _sy,\n x2: _tx,\n y2: _ty,\n cp1x: _CP.x,\n cp1y: _CP.y,\n cp2x: _CP2.x,\n cp2y: _CP2.y\n });\n }\n }]);\n return BezierConnector;\n}(AbstractBezierConnector);\n_defineProperty(BezierConnector, "type", "Bezier");\n\nfunction _segment(x1, y1, x2, y2) {\n if (x1 <= x2 && y2 <= y1) {\n return 1;\n } else if (x1 <= x2 && y1 <= y2) {\n return 2;\n } else if (x2 <= x1 && y2 >= y1) {\n return 3;\n }\n return 4;\n}\nfunction _findControlPoint(midx, midy, segment, sourceEdge, targetEdge, dx, dy, distance, proximityLimit) {\n if (distance <= proximityLimit) {\n return {\n x: midx,\n y: midy\n };\n }\n if (segment === 1) {\n if (sourceEdge.curY <= 0 && targetEdge.curY >= 1) {\n return {\n x: midx + (sourceEdge.x < 0.5 ? -1 * dx : dx),\n y: midy\n };\n } else if (sourceEdge.curX >= 1 && targetEdge.curX <= 0) {\n return {\n x: midx,\n y: midy + (sourceEdge.y < 0.5 ? -1 * dy : dy)\n };\n } else {\n return {\n x: midx + -1 * dx,\n y: midy + -1 * dy\n };\n }\n } else if (segment === 2) {\n if (sourceEdge.curY >= 1 && targetEdge.curY <= 0) {\n return {\n x: midx + (sourceEdge.x < 0.5 ? -1 * dx : dx),\n y: midy\n };\n } else if (sourceEdge.curX >= 1 && targetEdge.curX <= 0) {\n return {\n x: midx,\n y: midy + (sourceEdge.y < 0.5 ? -1 * dy : dy)\n };\n } else {\n return {\n x: midx + dx,\n y: midy + -1 * dy\n };\n }\n } else if (segment === 3) {\n if (sourceEdge.curY >= 1 && targetEdge.curY <= 0) {\n return {\n x: midx + (sourceEdge.x < 0.5 ? -1 * dx : dx),\n y: midy\n };\n } else if (sourceEdge.curX <= 0 && targetEdge.curX >= 1) {\n return {\n x: midx,\n y: midy + (sourceEdge.y < 0.5 ? -1 * dy : dy)\n };\n } else {\n return {\n x: midx + -1 * dx,\n y: midy + -1 * dy\n };\n }\n } else if (segment === 4) {\n if (sourceEdge.curY <= 0 && targetEdge.curY >= 1) {\n return {\n x: midx + (sourceEdge.x < 0.5 ? -1 * dx : dx),\n y: midy\n };\n } else if (sourceEdge.curX <= 0 && targetEdge.curX >= 1) {\n return {\n x: midx,\n y: midy + (sourceEdge.y < 0.5 ? -1 * dy : dy)\n };\n } else {\n return {\n x: midx + dx,\n y: midy + -1 * dy\n };\n }\n }\n}\nvar StateMachineConnector = function (_AbstractBezierConnec) {\n _inherits(StateMachineConnector, _AbstractBezierConnec);\n var _super = _createSuper(StateMachineConnector);\n function StateMachineConnector(connection, params) {\n var _this;\n _classCallCheck(this, StateMachineConnector);\n _this = _super.call(this, connection, params);\n _this.connection = connection;\n _defineProperty(_assertThisInitialized(_this), "type", StateMachineConnector.type);\n _defineProperty(_assertThisInitialized(_this), "_controlPoint", void 0);\n _this.curviness = params.curviness || 10;\n _this.margin = params.margin || 5;\n _this.proximityLimit = params.proximityLimit || 80;\n _this.clockwise = params.orientation && params.orientation === "clockwise";\n return _this;\n }\n _createClass(StateMachineConnector, [{\n key: "_computeBezier",\n value: function _computeBezier(paintInfo, params, sp, tp, w, h) {\n var _sx = sp.curX < tp.curX ? 0 : w,\n _sy = sp.curY < tp.curY ? 0 : h,\n _tx = sp.curX < tp.curX ? w : 0,\n _ty = sp.curY < tp.curY ? h : 0;\n if (sp.x === 0) {\n _sx -= this.margin;\n }\n if (sp.x === 1) {\n _sx += this.margin;\n }\n if (sp.y === 0) {\n _sy -= this.margin;\n }\n if (sp.y === 1) {\n _sy += this.margin;\n }\n if (tp.x === 0) {\n _tx -= this.margin;\n }\n if (tp.x === 1) {\n _tx += this.margin;\n }\n if (tp.y === 0) {\n _ty -= this.margin;\n }\n if (tp.y === 1) {\n _ty += this.margin;\n }\n if (this.edited !== true) {\n var _midx = (_sx + _tx) / 2,\n _midy = (_sy + _ty) / 2,\n segment = _segment(_sx, _sy, _tx, _ty),\n distance = Math.sqrt(Math.pow(_tx - _sx, 2) + Math.pow(_ty - _sy, 2));\n this._controlPoint = _findControlPoint(_midx, _midy, segment, params.sourcePos, params.targetPos, this.curviness, this.curviness, distance, this.proximityLimit);\n } else {\n this._controlPoint = this.geometry.controlPoints[0];\n }\n var cp1x, cp2x, cp1y, cp2y;\n cp1x = this._controlPoint.x;\n cp2x = this._controlPoint.x;\n cp1y = this._controlPoint.y;\n cp2y = this._controlPoint.y;\n this.geometry = {\n controlPoints: [this._controlPoint, this._controlPoint],\n source: params.sourcePos,\n target: params.targetPos\n };\n this._addSegment(BezierSegment, {\n x1: _tx,\n y1: _ty,\n x2: _sx,\n y2: _sy,\n cp1x: cp1x,\n cp1y: cp1y,\n cp2x: cp2x,\n cp2y: cp2y\n });\n }\n }]);\n return StateMachineConnector;\n}(AbstractBezierConnector);\n_defineProperty(StateMachineConnector, "type", "StateMachine");\n\nConnectors.register(BezierConnector.type, BezierConnector);\nConnectors.register(StateMachineConnector.type, StateMachineConnector);\n\nfunction sgn(n) {\n return n < 0 ? -1 : n === 0 ? 0 : 1;\n}\nfunction segmentDirections(segment) {\n return [sgn(segment[2] - segment[0]), sgn(segment[3] - segment[1])];\n}\nfunction segLength(s) {\n return Math.sqrt(Math.pow(s[0] - s[2], 2) + Math.pow(s[1] - s[3], 2));\n}\nfunction _cloneArray(a) {\n var _a = [];\n _a.push.apply(_a, a);\n return _a;\n}\nvar FlowchartConnector = function (_AbstractConnector) {\n _inherits(FlowchartConnector, _AbstractConnector);\n var _super = _createSuper(FlowchartConnector);\n function FlowchartConnector(connection, params) {\n var _this;\n _classCallCheck(this, FlowchartConnector);\n _this = _super.call(this, connection, params);\n _this.connection = connection;\n _defineProperty(_assertThisInitialized(_this), "type", FlowchartConnector.type);\n _defineProperty(_assertThisInitialized(_this), "internalSegments", []);\n _defineProperty(_assertThisInitialized(_this), "midpoint", void 0);\n _defineProperty(_assertThisInitialized(_this), "alwaysRespectStubs", void 0);\n _defineProperty(_assertThisInitialized(_this), "cornerRadius", void 0);\n _defineProperty(_assertThisInitialized(_this), "lastx", void 0);\n _defineProperty(_assertThisInitialized(_this), "lasty", void 0);\n _defineProperty(_assertThisInitialized(_this), "lastOrientation", void 0);\n _defineProperty(_assertThisInitialized(_this), "loopbackRadius", void 0);\n _defineProperty(_assertThisInitialized(_this), "isLoopbackCurrently", void 0);\n _this.midpoint = params.midpoint == null || isNaN(params.midpoint) ? 0.5 : params.midpoint;\n _this.cornerRadius = params.cornerRadius != null ? params.cornerRadius : 0;\n _this.alwaysRespectStubs = params.alwaysRespectStubs === true;\n _this.lastx = null;\n _this.lasty = null;\n _this.lastOrientation = null;\n _this.loopbackRadius = params.loopbackRadius || 25;\n _this.isLoopbackCurrently = false;\n return _this;\n }\n _createClass(FlowchartConnector, [{\n key: "getDefaultStubs",\n value: function getDefaultStubs() {\n return [30, 30];\n }\n }, {\n key: "addASegment",\n value: function addASegment(x, y, paintInfo) {\n if (this.lastx === x && this.lasty === y) {\n return;\n }\n var lx = this.lastx == null ? paintInfo.sx : this.lastx,\n ly = this.lasty == null ? paintInfo.sy : this.lasty,\n o = lx === x ? "v" : "h";\n this.lastx = x;\n this.lasty = y;\n this.internalSegments.push([lx, ly, x, y, o]);\n }\n }, {\n key: "writeSegments",\n value: function writeSegments(paintInfo) {\n var current = null,\n next,\n currentDirection,\n nextDirection;\n for (var i = 0; i < this.internalSegments.length - 1; i++) {\n current = current || _cloneArray(this.internalSegments[i]);\n next = _cloneArray(this.internalSegments[i + 1]);\n currentDirection = segmentDirections(current);\n nextDirection = segmentDirections(next);\n if (this.cornerRadius > 0 && current[4] !== next[4]) {\n var minSegLength = Math.min(segLength(current), segLength(next));\n var radiusToUse = Math.min(this.cornerRadius, minSegLength / 2);\n current[2] -= currentDirection[0] * radiusToUse;\n current[3] -= currentDirection[1] * radiusToUse;\n next[0] += nextDirection[0] * radiusToUse;\n next[1] += nextDirection[1] * radiusToUse;\n var ac = currentDirection[1] === nextDirection[0] && nextDirection[0] === 1 || currentDirection[1] === nextDirection[0] && nextDirection[0] === 0 && currentDirection[0] !== nextDirection[1] || currentDirection[1] === nextDirection[0] && nextDirection[0] === -1,\n sgny = next[1] > current[3] ? 1 : -1,\n sgnx = next[0] > current[2] ? 1 : -1,\n sgnEqual = sgny === sgnx,\n cx = sgnEqual && ac || !sgnEqual && !ac ? next[0] : current[2],\n cy = sgnEqual && ac || !sgnEqual && !ac ? current[3] : next[1];\n this._addSegment(StraightSegment, {\n x1: current[0],\n y1: current[1],\n x2: current[2],\n y2: current[3]\n });\n this._addSegment(ArcSegment, {\n r: radiusToUse,\n x1: current[2],\n y1: current[3],\n x2: next[0],\n y2: next[1],\n cx: cx,\n cy: cy,\n ac: ac\n });\n } else {\n this._addSegment(StraightSegment, {\n x1: current[0],\n y1: current[1],\n x2: current[2],\n y2: current[3]\n });\n }\n current = next;\n }\n if (next != null) {\n this._addSegment(StraightSegment, {\n x1: next[0],\n y1: next[1],\n x2: next[2],\n y2: next[3]\n });\n }\n }\n }, {\n key: "_compute",\n value: function _compute(paintInfo, params) {\n var _this2 = this;\n this.internalSegments.length = 0;\n this.lastx = null;\n this.lasty = null;\n this.lastOrientation = null;\n var commonStubCalculator = function commonStubCalculator(axis) {\n return [paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY];\n },\n stubCalculators = {\n perpendicular: commonStubCalculator,\n orthogonal: commonStubCalculator,\n opposite: function opposite(axis) {\n var pi = paintInfo,\n idx = axis === "x" ? 0 : 1,\n areInProximity = {\n "x": function x() {\n return pi.so[idx] === 1 && (pi.startStubX > pi.endStubX && pi.tx > pi.startStubX || pi.sx > pi.endStubX && pi.tx > pi.sx) || pi.so[idx] === -1 && (pi.startStubX < pi.endStubX && pi.tx < pi.startStubX || pi.sx < pi.endStubX && pi.tx < pi.sx);\n },\n "y": function y() {\n return pi.so[idx] === 1 && (pi.startStubY > pi.endStubY && pi.ty > pi.startStubY || pi.sy > pi.endStubY && pi.ty > pi.sy) || pi.so[idx] === -1 && (pi.startStubY < pi.endStubY && pi.ty < pi.startStubY || pi.sy < pi.endStubY && pi.ty < pi.sy);\n }\n };\n if (!_this2.alwaysRespectStubs && areInProximity[axis]()) {\n return {\n "x": [(paintInfo.sx + paintInfo.tx) / 2, paintInfo.startStubY, (paintInfo.sx + paintInfo.tx) / 2, paintInfo.endStubY],\n "y": [paintInfo.startStubX, (paintInfo.sy + paintInfo.ty) / 2, paintInfo.endStubX, (paintInfo.sy + paintInfo.ty) / 2]\n }[axis];\n } else {\n return [paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY];\n }\n }\n };\n var stubs = stubCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis),\n idx = paintInfo.sourceAxis === "x" ? 0 : 1,\n oidx = paintInfo.sourceAxis === "x" ? 1 : 0,\n ss = stubs[idx],\n oss = stubs[oidx],\n es = stubs[idx + 2],\n oes = stubs[oidx + 2];\n this.addASegment(stubs[0], stubs[1], paintInfo);\n var midx = paintInfo.startStubX + (paintInfo.endStubX - paintInfo.startStubX) * this.midpoint,\n midy = paintInfo.startStubY + (paintInfo.endStubY - paintInfo.startStubY) * this.midpoint;\n var orientations = {\n x: [0, 1],\n y: [1, 0]\n },\n lineCalculators = {\n perpendicular: function perpendicular(axis, ss, oss, es, oes) {\n var pi = paintInfo,\n sis = {\n x: [[[1, 2, 3, 4], null, [2, 1, 4, 3]], null, [[4, 3, 2, 1], null, [3, 4, 1, 2]]],\n y: [[[3, 2, 1, 4], null, [2, 3, 4, 1]], null, [[4, 1, 2, 3], null, [1, 4, 3, 2]]]\n },\n stubs = {\n x: [[pi.startStubX, pi.endStubX], null, [pi.endStubX, pi.startStubX]],\n y: [[pi.startStubY, pi.endStubY], null, [pi.endStubY, pi.startStubY]]\n },\n midLines = {\n x: [[midx, pi.startStubY], [midx, pi.endStubY]],\n y: [[pi.startStubX, midy], [pi.endStubX, midy]]\n },\n linesToEnd = {\n x: [[pi.endStubX, pi.startStubY]],\n y: [[pi.startStubX, pi.endStubY]]\n },\n startToEnd = {\n x: [[pi.startStubX, pi.endStubY], [pi.endStubX, pi.endStubY]],\n y: [[pi.endStubX, pi.startStubY], [pi.endStubX, pi.endStubY]]\n },\n startToMidToEnd = {\n x: [[pi.startStubX, midy], [pi.endStubX, midy], [pi.endStubX, pi.endStubY]],\n y: [[midx, pi.startStubY], [midx, pi.endStubY], [pi.endStubX, pi.endStubY]]\n },\n otherStubs = {\n x: [pi.startStubY, pi.endStubY],\n y: [pi.startStubX, pi.endStubX]\n },\n soIdx = orientations[axis][0],\n toIdx = orientations[axis][1],\n _so = pi.so[soIdx] + 1,\n _to = pi.to[toIdx] + 1,\n otherFlipped = pi.to[toIdx] === -1 && otherStubs[axis][1] < otherStubs[axis][0] || pi.to[toIdx] === 1 && otherStubs[axis][1] > otherStubs[axis][0],\n stub1 = stubs[axis][_so][0],\n stub2 = stubs[axis][_so][1],\n segmentIndexes = sis[axis][_so][_to];\n if (pi.segment === segmentIndexes[3] || pi.segment === segmentIndexes[2] && otherFlipped) {\n return midLines[axis];\n } else if (pi.segment === segmentIndexes[2] && stub2 < stub1) {\n return linesToEnd[axis];\n } else if (pi.segment === segmentIndexes[2] && stub2 >= stub1 || pi.segment === segmentIndexes[1] && !otherFlipped) {\n return startToMidToEnd[axis];\n } else if (pi.segment === segmentIndexes[0] || pi.segment === segmentIndexes[1] && otherFlipped) {\n return startToEnd[axis];\n }\n },\n orthogonal: function orthogonal(axis, startStub, otherStartStub, endStub, otherEndStub) {\n var pi = paintInfo,\n extent = {\n "x": pi.so[0] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub),\n "y": pi.so[1] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub)\n }[axis];\n return {\n "x": [[extent, otherStartStub], [extent, otherEndStub], [endStub, otherEndStub]],\n "y": [[otherStartStub, extent], [otherEndStub, extent], [otherEndStub, endStub]]\n }[axis];\n },\n opposite: function opposite(axis, ss, oss, es, oes) {\n var pi = paintInfo,\n otherAxis = {\n "x": "y",\n "y": "x"\n }[axis],\n dim = {\n "x": "h",\n "y": "w"\n }[axis],\n comparator = pi["is" + axis.toUpperCase() + "GreaterThanStubTimes2"];\n if (params.sourceEndpoint.elementId === params.targetEndpoint.elementId) {\n var _val = oss + (1 - params.sourceEndpoint._anchor.computedPosition[otherAxis]) * params.sourceInfo[dim] + _this2.maxStub;\n return {\n "x": [[ss, _val], [es, _val]],\n "y": [[_val, ss], [_val, es]]\n }[axis];\n } else if (!comparator || pi.so[idx] === 1 && ss > es || pi.so[idx] === -1 && ss < es) {\n return {\n "x": [[ss, midy], [es, midy]],\n "y": [[midx, ss], [midx, es]]\n }[axis];\n } else if (pi.so[idx] === 1 && ss < es || pi.so[idx] === -1 && ss > es) {\n return {\n "x": [[midx, pi.sy], [midx, pi.ty]],\n "y": [[pi.sx, midy], [pi.tx, midy]]\n }[axis];\n }\n }\n };\n var p = lineCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis, ss, oss, es, oes);\n if (p) {\n for (var i = 0; i < p.length; i++) {\n this.addASegment(p[i][0], p[i][1], paintInfo);\n }\n }\n this.addASegment(stubs[2], stubs[3], paintInfo);\n this.addASegment(paintInfo.tx, paintInfo.ty, paintInfo);\n this.writeSegments(paintInfo);\n }\n }, {\n key: "transformGeometry",\n value: function transformGeometry(g, dx, dy) {\n return g;\n }\n }]);\n return FlowchartConnector;\n}(AbstractConnector);\n_defineProperty(FlowchartConnector, "type", "Flowchart");\n\nConnectors.register(FlowchartConnector.type, FlowchartConnector);\n\nEndpointFactory.registerHandler(DotEndpointHandler);\nEndpointFactory.registerHandler(RectangleEndpointHandler);\nEndpointFactory.registerHandler(BlankEndpointHandler);\nConnectors.register(StraightConnector.type, StraightConnector);\n\nfunction _randomEvent() {\n var x = Math.floor(Math.random() * 2000),\n y = Math.floor(Math.random() * 2000);\n return {\n clientX: x,\n clientY: y,\n screenX: x,\n screenY: y,\n pageX: x,\n pageY: y\n };\n}\nvar _distantPointEvent = {\n clientX: 50000,\n clientY: 50000,\n screenX: 50000,\n screenY: 50000,\n pageX: 50000,\n pageY: 50000\n};\nvar lut = [];\nfor (var i = 0; i < 256; i++) {\n lut[i] = (i < 16 ? \'0\' : \'\') + i.toString(16);\n}\nvar VERY_SMALL_NUMBER = 0.00000000001;\nvar BrowserUITestSupport = function () {\n function BrowserUITestSupport(_jsPlumb, ok, equal) {\n _classCallCheck(this, BrowserUITestSupport);\n this._jsPlumb = _jsPlumb;\n this.ok = ok;\n this.equal = equal;\n _defineProperty(this, "_divs", []);\n _defineProperty(this, "mottle", void 0);\n this.mottle = new EventManager();\n }\n _createClass(BrowserUITestSupport, [{\n key: "_t",\n value: function _t(el, evt, x, y) {\n this.mottle.trigger(el, evt, {\n pageX: x,\n pageY: y,\n screenX: x,\n screenY: y,\n clientX: x,\n clientY: y\n });\n }\n }, {\n key: "addDiv",\n value: function addDiv(id, parent, className, x, y, w, h) {\n var d1 = document.createElement("div");\n d1.style.position = "absolute";\n d1.innerHTML = id;\n if (parent) parent.appendChild(d1);else this._jsPlumb.getContainer().appendChild(d1);\n d1.setAttribute("id", id);\n d1.style.left = (x != null ? x : Math.floor(Math.random() * 1000)) + "px";\n d1.style.top = (y != null ? y : Math.floor(Math.random() * 1000)) + "px";\n if (className) d1.className = className;\n if (w) d1.style.width = w + "px";\n if (h) d1.style.height = h + "px";\n this._divs.push(id);\n return d1;\n }\n }, {\n key: "addDivs",\n value: function addDivs(ids, parent) {\n for (var _i = 0; _i < ids.length; _i++) {\n this.addDiv(ids[_i], parent);\n }\n }\n }, {\n key: "assertEndpointCount",\n value: function assertEndpointCount(el, count) {\n var ep = this._jsPlumb.getEndpoints(el),\n epl = ep ? ep.length : 0;\n this.equal(epl, count, el.getAttribute("data-jtk-managed") + " has " + count + (count > 1 || count == 0 ? " endpoints" : " endpoint"));\n }\n }, {\n key: "_assertManagedEndpointCount",\n value: function _assertManagedEndpointCount(el, count) {\n var id = this._jsPlumb.getId(el),\n _mel = this._jsPlumb._managedElements[id];\n this.equal(_mel.endpoints.length, count, id + " has " + count + " endpoints in managed record");\n }\n }, {\n key: "_assertManagedConnectionCount",\n value: function _assertManagedConnectionCount(el, count) {\n var id = this._jsPlumb.getId(el),\n _mel = this._jsPlumb._managedElements[id];\n this.equal(_mel.connections.length, count, id + " has " + count + " connections in managed record");\n }\n }, {\n key: "_registerDiv",\n value: function _registerDiv(div) {\n this._divs.push(div);\n }\n }, {\n key: "makeDragStartEvt",\n value: function makeDragStartEvt(el) {\n var e = this.makeEvent(el),\n c = this._jsPlumb.getContainer();\n e.clientX += c.offsetLeft;\n e.screenX += c.offsetLeft;\n e.pageX += c.offsetLeft;\n e.clientY += c.offsetTop;\n e.screenY += c.offsetTop;\n e.pageY += c.offsetTop;\n return e;\n }\n }, {\n key: "getAttribute",\n value: function getAttribute(el, att) {\n return el.getAttribute(att);\n }\n }, {\n key: "dragNodeBy",\n value: function dragNodeBy(el, x, y, events) {\n events = events || {};\n if (events.before) events.before();\n var downEvent = this.makeEvent(el);\n this._jsPlumb.trigger(el, EVENT_MOUSEDOWN, downEvent);\n if (events.beforeMouseMove) {\n events.beforeMouseMove();\n }\n this._t(document, EVENT_MOUSEMOVE, downEvent.pageX + x, downEvent.pageY + y);\n if (events.beforeMouseUp) {\n events.beforeMouseUp();\n }\n this.mottle.trigger(document, EVENT_MOUSEUP, null);\n if (events.after) events.after();\n }\n }, {\n key: "dragNodeTo",\n value: function dragNodeTo(el, x, y, events) {\n events = events || {};\n var size = this._jsPlumb.viewport.getPosition(this._jsPlumb.getId(el));\n if (events.before) events.before();\n var downEvent = this.makeEvent(el);\n this._jsPlumb.trigger(el, EVENT_MOUSEDOWN, downEvent);\n var cb = this._jsPlumb.getContainer().getBoundingClientRect();\n if (events.beforeMouseMove) {\n events.beforeMouseMove();\n }\n this._t(document, EVENT_MOUSEMOVE, cb.x + x + size.w / 2, cb.y + y + size.h / 2);\n if (events.beforeMouseUp) {\n events.beforeMouseUp();\n }\n this.mottle.trigger(document, EVENT_MOUSEUP, null);\n if (events.after) events.after();\n }\n }, {\n key: "dragToGroup",\n value: function dragToGroup(el, targetGroupId, events) {\n var targetGroup = this._jsPlumb.getGroup(targetGroupId);\n var tgo = this._jsPlumb.viewport.getPosition(targetGroup.elId),\n tx = tgo.x + tgo.w / 2,\n ty = tgo.y + tgo.h / 2;\n this.dragNodeTo(el, tx, ty, events);\n }\n }, {\n key: "aSyncDragNodeBy",\n value: function aSyncDragNodeBy(el, x, y, events) {\n var _this = this;\n events = events || {};\n if (events.before) {\n events.before();\n }\n var downEvent = this.makeEvent(el);\n this._jsPlumb.trigger(el, EVENT_MOUSEDOWN, downEvent);\n if (events.beforeMouseMove) {\n events.beforeMouseMove();\n }\n setTimeout(function () {\n _this._t(document, EVENT_MOUSEMOVE, downEvent.pageX + x, downEvent.pageY + y);\n if (events.beforeMouseUp) {\n events.beforeMouseUp();\n }\n setTimeout(function () {\n _this.mottle.trigger(document, EVENT_MOUSEUP, null);\n if (events.after) {\n events.after();\n }\n }, 45);\n }, 45);\n }\n }, {\n key: "dragANodeAround",\n value: function dragANodeAround(el, functionToAssertWhileDragging, assertMessage) {\n this._jsPlumb.trigger(el, EVENT_MOUSEDOWN, this.makeEvent(el));\n var steps = Math.random() * 50;\n for (var _i2 = 0; _i2 < steps; _i2++) {\n var evt = _randomEvent();\n el.style.left = evt.screenX + "px";\n el.style.top = evt.screenY + "px";\n this._jsPlumb.trigger(document, EVENT_MOUSEMOVE, evt);\n }\n if (functionToAssertWhileDragging) {\n this.ok(functionToAssertWhileDragging(), assertMessage || "while dragging assert");\n }\n this._jsPlumb.trigger(document, EVENT_MOUSEUP, _distantPointEvent);\n }\n }, {\n key: "dragConnection",\n value: function dragConnection(d1, d2, mouseUpOnTarget, events) {\n var el1 = this.getCanvas(d1),\n el2 = this.getCanvas(d2);\n var e1 = this.makeEvent(el1),\n e2 = this.makeEvent(el2);\n events = events || {};\n var conns = this._jsPlumb.select().length;\n this._jsPlumb.trigger(el1, EVENT_MOUSEDOWN, e1);\n if (events.beforeMouseMove) {\n events.beforeMouseMove();\n }\n this._jsPlumb.trigger(mouseUpOnTarget ? el2 : document, EVENT_MOUSEMOVE, e2);\n if (events.beforeMouseUp) {\n events.beforeMouseUp();\n }\n this._jsPlumb.trigger(mouseUpOnTarget ? el2 : document, EVENT_MOUSEUP, e2);\n return this._jsPlumb.select().get(conns);\n }\n }, {\n key: "aSyncDragConnection",\n value: function aSyncDragConnection(d1, d2, events) {\n var _this2 = this;\n events = events || {};\n var el1 = this.getCanvas(d1),\n el2 = this.getCanvas(d2);\n var e1 = this.makeEvent(el1),\n e2 = this.makeEvent(el2);\n var conns = this._jsPlumb.select().length;\n this._jsPlumb.trigger(el1, EVENT_MOUSEDOWN, e1);\n setTimeout(function () {\n if (events.beforeMouseMove) {\n events.beforeMouseMove();\n }\n _this2._jsPlumb.trigger(document, EVENT_MOUSEMOVE, e2);\n setTimeout(function () {\n if (events.beforeMouseUp) {\n events.beforeMouseUp();\n }\n _this2._jsPlumb.trigger(el2, EVENT_MOUSEUP, e2);\n if (events.after) {\n events.after(_this2._jsPlumb.select().get(conns));\n }\n }, 5);\n }, 5);\n }\n }, {\n key: "dragAndAbortConnection",\n value: function dragAndAbortConnection(d1) {\n var el1 = this.getCanvas(d1);\n var e1 = this.makeEvent(el1);\n this._jsPlumb.trigger(el1, EVENT_MOUSEDOWN, e1);\n this._jsPlumb.trigger(document, EVENT_MOUSEMOVE, _distantPointEvent);\n this._jsPlumb.trigger(document, EVENT_MOUSEUP, _distantPointEvent);\n }\n }, {\n key: "detachConnection",\n value: function detachConnection(e, events) {\n events = events || {};\n var el1 = this.getEndpointCanvas(e);\n var e1 = this.makeEvent(el1);\n events.before && events.before();\n this._jsPlumb.trigger(el1, EVENT_MOUSEDOWN, e1);\n events.beforeMouseMove && events.beforeMouseMove();\n this._jsPlumb.trigger(document, EVENT_MOUSEMOVE, _distantPointEvent);\n events.beforeMouseUp && events.beforeMouseUp();\n this._jsPlumb.trigger(document, EVENT_MOUSEUP, _distantPointEvent);\n events.after && events.after();\n }\n }, {\n key: "detachAndReattachConnection",\n value: function detachAndReattachConnection(e, events) {\n events = events || {};\n var el1 = this.getEndpointCanvas(e);\n var e1 = this.makeEvent(el1);\n events.before && events.before();\n this._jsPlumb.trigger(el1, EVENT_MOUSEDOWN, e1);\n events.beforeMouseMove && events.beforeMouseMove();\n this._jsPlumb.trigger(document, EVENT_MOUSEMOVE, _distantPointEvent);\n this._jsPlumb.trigger(document, EVENT_MOUSEMOVE, e1);\n events.beforeMouseUp && events.beforeMouseUp();\n this._jsPlumb.trigger(document, EVENT_MOUSEUP, e1);\n events.after && events.after();\n }\n }, {\n key: "detachConnectionByTarget",\n value: function detachConnectionByTarget(c, events) {\n this.detachConnection(c.endpoints[1], events);\n }\n }, {\n key: "relocateTarget",\n value: function relocateTarget(conn, newEl, events) {\n this.relocate(conn, 1, newEl, events);\n }\n }, {\n key: "relocate",\n value: function relocate(conn, idx, newEl, events) {\n events = events || {};\n newEl = this.getCanvas(newEl);\n var el1 = this.getEndpointCanvas(conn.endpoints[idx]);\n var e1 = this.makeEvent(el1);\n var e2 = this.makeEvent(newEl);\n events.before && events.before();\n this._jsPlumb.trigger(el1, EVENT_MOUSEDOWN, e1);\n events.beforeMouseMove && events.beforeMouseMove();\n this._jsPlumb.trigger(document, EVENT_MOUSEMOVE, e2);\n events.beforeMouseUp && events.beforeMouseUp();\n this._jsPlumb.trigger(newEl, EVENT_MOUSEUP, e2);\n events.after && events.after();\n }\n }, {\n key: "relocateSource",\n value: function relocateSource(conn, newEl, events) {\n this.relocate(conn, 0, newEl, events);\n }\n }, {\n key: "makeEvent",\n value: function makeEvent(el) {\n var b = el.getBoundingClientRect();\n var l = b.x + b.width / 2,\n t = b.y + b.height / 2;\n return {\n clientX: l,\n clientY: t,\n screenX: l,\n screenY: t,\n pageX: l,\n pageY: t\n };\n }\n }, {\n key: "getCanvas",\n value: function getCanvas(epOrEl) {\n if (epOrEl.endpoint) {\n return this.getEndpointCanvas(epOrEl);\n } else {\n return epOrEl;\n }\n }\n }, {\n key: "getEndpointCanvas",\n value: function getEndpointCanvas(ep) {\n return ep.endpoint.canvas;\n }\n }, {\n key: "getConnectionCanvas",\n value: function getConnectionCanvas(c) {\n return c.connector.canvas;\n }\n }, {\n key: "getEndpointCanvasPosition",\n value: function getEndpointCanvasPosition(ep) {\n var c = this.getEndpointCanvas(ep);\n return {\n x: parseInt(c.style.left, 10),\n y: parseInt(c.style.top, 10),\n w: c.getAttribute("width"),\n h: c.getAttribute("height")\n };\n }\n }, {\n key: "within",\n value: function within(val, target, msg) {\n this.ok(Math.abs(val - target) < VERY_SMALL_NUMBER, msg + "[expected: " + target + " got " + val + "] [diff:" + Math.abs(val - target) + "]");\n }\n }, {\n key: "assertManagedEndpointCount",\n value: function assertManagedEndpointCount(el, count) {\n var id = this._jsPlumb.getId(el),\n _mel = this._jsPlumb._managedElements[id];\n this.equal(_mel.endpoints.length, count, id + " has " + count + " endpoints in managed record");\n }\n }, {\n key: "assertManagedConnectionCount",\n value: function assertManagedConnectionCount(el, count) {\n var id = this._jsPlumb.getId(el),\n _mel = this._jsPlumb._managedElements[id];\n this.equal(_mel.connections.length, count, id + " has " + count + " connections in managed record");\n }\n }, {\n key: "fireEventOnEndpoint",\n value: function fireEventOnEndpoint(ep) {\n var canvas = this.getEndpointCanvas(ep);\n for (var _i3 = 0; _i3 < (arguments.length <= 1 ? 0 : arguments.length - 1); _i3++) {\n this._jsPlumb.trigger(canvas, _i3 + 1 < 1 || arguments.length <= _i3 + 1 ? undefined : arguments[_i3 + 1]);\n }\n }\n }, {\n key: "fireEventOnElement",\n value: function fireEventOnElement(e) {\n for (var _i4 = 0; _i4 < (arguments.length <= 1 ? 0 : arguments.length - 1); _i4++) {\n this._jsPlumb.trigger(e, _i4 + 1 < 1 || arguments.length <= _i4 + 1 ? undefined : arguments[_i4 + 1]);\n }\n }\n }, {\n key: "fireEventOnConnection",\n value: function fireEventOnConnection(connection) {\n var canvas = this.getConnectionCanvas(connection);\n for (var _len = arguments.length, events = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n events[_key - 1] = arguments[_key];\n }\n this.fireEventOnElement.apply(this, [canvas].concat(events));\n }\n }, {\n key: "clickOnConnection",\n value: function clickOnConnection(connection) {\n this.fireEventOnConnection(connection, EVENT_CLICK);\n }\n }, {\n key: "dblClickOnConnection",\n value: function dblClickOnConnection(connection) {\n this.fireEventOnConnection(connection, EVENT_DBL_CLICK);\n }\n }, {\n key: "tapOnConnection",\n value: function tapOnConnection(connection) {\n this.fireEventOnConnection(connection, EVENT_MOUSEDOWN);\n this.fireEventOnConnection(connection, EVENT_MOUSEUP);\n }\n }, {\n key: "dblTapOnConnection",\n value: function dblTapOnConnection(connection) {\n this.fireEventOnConnection(connection, EVENT_MOUSEDOWN);\n this.fireEventOnConnection(connection, EVENT_MOUSEUP);\n this.fireEventOnConnection(connection, EVENT_MOUSEDOWN);\n this.fireEventOnConnection(connection, EVENT_MOUSEUP);\n }\n }, {\n key: "clickOnElement",\n value: function clickOnElement(element, clickCount) {\n this._jsPlumb.trigger(element, EVENT_CLICK, null, null, clickCount == null ? 1 : clickCount);\n }\n }, {\n key: "dblClickOnElement",\n value: function dblClickOnElement(element) {\n this._jsPlumb.trigger(element, EVENT_DBL_CLICK);\n }\n }, {\n key: "tapOnElement",\n value: function tapOnElement(element) {\n this._jsPlumb.trigger(element, EVENT_MOUSEDOWN);\n this._jsPlumb.trigger(element, EVENT_MOUSEUP);\n }\n }, {\n key: "dblTapOnElement",\n value: function dblTapOnElement(element) {\n this._jsPlumb.trigger(element, EVENT_MOUSEDOWN);\n this._jsPlumb.trigger(element, EVENT_MOUSEUP);\n this._jsPlumb.trigger(element, EVENT_MOUSEDOWN);\n this._jsPlumb.trigger(element, EVENT_MOUSEUP);\n }\n }, {\n key: "getOverlayCanvas",\n value: function getOverlayCanvas(overlay) {\n return overlay.canvas || overlay.path;\n }\n }, {\n key: "fireEventOnOverlay",\n value: function fireEventOnOverlay(connection, overlayId, event) {\n var overlay = connection.getOverlay(overlayId);\n var canvas = this.getOverlayCanvas(overlay);\n this._jsPlumb.trigger(canvas, event);\n }\n }, {\n key: "clickOnOverlay",\n value: function clickOnOverlay(connection, overlayId) {\n this.fireEventOnOverlay(connection, overlayId, EVENT_CLICK);\n }\n }, {\n key: "dblClickOnOverlay",\n value: function dblClickOnOverlay(connection, overlayId) {\n this.fireEventOnOverlay(connection, overlayId, EVENT_DBL_CLICK);\n }\n }, {\n key: "tapOnOverlay",\n value: function tapOnOverlay(connection, overlayId) {\n this.fireEventOnOverlay(connection, overlayId, EVENT_MOUSEDOWN);\n this.fireEventOnOverlay(connection, overlayId, EVENT_MOUSEUP);\n }\n }, {\n key: "dblTapOnOverlay",\n value: function dblTapOnOverlay(connection, overlayId) {\n this.fireEventOnOverlay(connection, overlayId, EVENT_MOUSEDOWN);\n this.fireEventOnOverlay(connection, overlayId, EVENT_MOUSEUP);\n this.fireEventOnOverlay(connection, overlayId, EVENT_MOUSEDOWN);\n this.fireEventOnOverlay(connection, overlayId, EVENT_MOUSEUP);\n }\n }, {\n key: "cleanup",\n value: function cleanup() {\n var container = this._jsPlumb.getContainer();\n this._jsPlumb.destroy();\n for (var _i5 in this._divs) {\n var d = document.getElementById(this._divs[_i5]);\n d && d.parentNode.removeChild(d);\n }\n this._divs.length = 0;\n var connCount = this._jsPlumb.select().length,\n epCount = this._jsPlumb.selectEndpoints().length,\n epElCount = container.querySelectorAll(".jtk-endpoint").length,\n connElCount = container.querySelectorAll(".jtk-connector").length;\n for (var k in container.__ta) {\n for (var kk in container.__ta[k]) {\n throw "Container event bindings not empty for key " + k;\n }\n }\n if (connCount > 0) throw "there are connections in the data model!";\n if (epCount > 0) throw "there are endpoints in the data model!";\n if (epElCount > 0) {\n throw "there are " + epElCount + " endpoints left in the dom!";\n }\n if (connElCount > 0) {\n throw "there are " + connElCount + " connections left in the dom!";\n }\n }\n }, {\n key: "makeContent",\n value: function makeContent(s) {\n var d = document.createElement("div");\n d.innerHTML = s;\n return d.firstChild;\n }\n }, {\n key: "length",\n value: function length(obj) {\n var c = 0;\n for (var _i6 in obj) {\n if (obj.hasOwnProperty(_i6)) {\n c++;\n }\n }\n return c;\n }\n }, {\n key: "head",\n value: function head(obj) {\n for (var _i7 in obj) {\n return obj[_i7];\n }\n }\n }, {\n key: "uuid",\n value: function uuid$1() {\n return uuid();\n }\n }]);\n return BrowserUITestSupport;\n}();\n\nfunction createTestSupportInstance(instance, ok, equal) {\n return new BrowserUITestSupport(instance, ok, equal);\n}\nfunction createTestSupportInstanceQUnit(instance) {\n return new BrowserUITestSupport(instance, QUnit.ok, QUnit.equal);\n}\n\nvar _jsPlumbInstanceIndex = 0;\nfunction getInstanceIndex() {\n var i = _jsPlumbInstanceIndex + 1;\n _jsPlumbInstanceIndex++;\n return i;\n}\nfunction newInstance(defaults) {\n return new BrowserJsPlumbInstance(getInstanceIndex(), defaults);\n}\nfunction ready(f) {\n var _do = function _do() {\n if (/complete|loaded|interactive/.test(document.readyState) && typeof document.body !== "undefined" && document.body != null) {\n f();\n } else {\n setTimeout(_do, 9);\n }\n };\n _do();\n}\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@jsplumb/browser-ui/js/jsplumb.browser-ui.es.js?')},"./node_modules/codemirror-readonly-ranges/dist/index.es.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ c),\n/* harmony export */ preventModifyTargetRanges: () => (/* binding */ u),\n/* harmony export */ smartDelete: () => (/* binding */ m),\n/* harmony export */ smartPaste: () => (/* binding */ l)\n/* harmony export */ });\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */var n=function(){return n=Object.assign||function(t){for(var o,r=1,n=arguments.length;r0&&(p=Math.max.apply(Math,d),h=Math.min.apply(Math,d));var g=Math.abs(p),M=Math.abs(h),y=Math.max(g,M)+1,S=-y;return a=a.map((function(t){return t.from=e(t.from)?t.from:S,t.to=e(t.to)?t.to:y,t})),m={from:e(m.from)?m.from:S,to:e(m.to)?m.to:y},l={from:e(l.from)?l.from:S,to:e(l.to)?l.to:y},a=a.slice().sort((function(t,o){var r=t.to-t.from,n=o.to-o.from;if(t.from>o.from)return 1;if(t.from===o.from){if(t.from+r>o.from+n)return-1;if(t.from+r===o.from+n)return 0;if(t.from+r=n.from}))).map((function(t){return function(t,o){return{from:t.fromo.to?o.to:t.to}}(t,n)}));var e=o.to-o.from;if(o.from>=t[0].from&&o.from<=t[0].to)o.from+e<=t[0].to?o=null:o.from=t[0].to+1;else if(o.from=t[0].from){var a=o.to,m={from:o.from,to:t[0].from-1};r.push(m),a>t[0].to?o.from=t[0].to+1:o=null}return t.shift(),i(t,o,r,n)},m=function(r){return _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorState.transactionFilter.of((function(t){if(t.isUserEvent("delete.selection")&&!t.isUserEvent("delete.selection.smart")){var n=t.startState.selection.ranges.map((function(t){return{from:t.from,to:t.to}}));if(n.length>0){var f=r(t.startState);return a(f,n[0],{from:0,to:t.startState.doc.line(t.startState.doc.lines).to}).map((function(r){return t.startState.update({changes:{from:r.from,to:r.to},annotations:_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.Transaction.userEvent.of("".concat(t.annotation(_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.Transaction.userEvent),".smart"))})}))}}return t}))},u=function(o){return _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.EditorState.changeFilter.of((function(t){var r,n,f,e;try{for(var a=o(t.startState),i=o(t.state),m=0;m0){var i=t(n.state),m=a(i,e[0],{from:0,to:n.state.doc.line(n.state.doc.lines).to});m.length>0&&n.dispatch({changes:{from:m[0].from,to:m[0].to,insert:f},annotations:_codemirror_state__WEBPACK_IMPORTED_MODULE_0__.Transaction.userEvent.of("input.paste.smart")})}return!0}})},c=function(t){return[l(t),m(t),u(t)]};\n//# sourceMappingURL=index.es.js.map\n\n\n//# sourceURL=webpack://Papyros/./node_modules/codemirror-readonly-ranges/dist/index.es.js?')},"./node_modules/comsync/dist/index.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('!function(e,t){ true?module.exports=t(__webpack_require__(/*! sync-message */ "./node_modules/sync-message/dist/index.js"),__webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs")):0}(self,(function(e,t){return(()=>{"use strict";var s={272:e=>{e.exports=t},746:t=>{t.exports=e}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return s[e](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{i.r(n),i.d(n,{InterruptError:()=>r,NoChannelError:()=>o,SyncClient:()=>a,syncExpose:()=>h});var e=i(746),t=i(272),s=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{h(r.next(e))}catch(e){n(e)}}function a(e){try{h(r.throw(e))}catch(e){n(e)}}function h(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}h((r=r.apply(e,t||[])).next())}))};class r extends Error{constructor(){super(...arguments),this.type="InterruptError",this.name=this.type}}class o extends Error{constructor(){super(...arguments),this.type="NoChannelError",this.name=this.type}}class a{constructor(e,t){this.workerCreator=e,this.channel=t,this.state="idle",this._messageIdBase="",this._messageIdSeq=0,this._start()}interrupt(){return s(this,void 0,void 0,(function*(){"idle"!==this.state&&("awaitingMessage"!==this.state&&"sleeping"!==this.state?this.interrupter?yield this.interrupter():(this.terminate(),this._start()):yield this._writeMessage({interrupted:!0}))}))}call(r,...i){return s(this,void 0,void 0,(function*(){if("idle"!==this.state)throw new Error(`State is ${this.state}, not idle`);let s=!0;this.state="running",this._messageIdBase=(0,e.uuidv4)(),this._messageIdSeq=0;const n=e=>{var t;s&&"init"!==e&&("reading"===e?(this.state="awaitingMessage",this._messageIdSeq++,null===(t=this._awaitingMessageResolve)||void 0===t||t.call(this)):"sleeping"===e?(this.state="sleeping",this._messageIdSeq++):"slept"===e&&(this.state="running"))};this._interruptPromise=new Promise(((e,t)=>this._interruptRejector=t));try{return yield Promise.race([r(this.channel,t.proxy(n),this._messageIdBase,...i),this._interruptPromise])}finally{s=!1,this._reset()}}))}writeMessage(e){return s(this,void 0,void 0,(function*(){if("idle"===this.state||!this._messageIdBase)throw new Error("No active call to send a message to.");if("awaitingMessage"!==this.state){if(this._awaitingMessageResolve)throw new Error("Not waiting for message, and another write is already queued.");yield new Promise((e=>{this._awaitingMessageResolve=e})),delete this._awaitingMessageResolve}yield this._writeMessage({message:e})}))}terminate(){var e;null===(e=this._interruptRejector)||void 0===e||e.call(this,new r("Worker terminated")),this.workerProxy[t.releaseProxy](),this.worker.terminate(),delete this.workerProxy,delete this.worker}_writeMessage(t){return s(this,void 0,void 0,(function*(){this.state="running";const s=l(this._messageIdBase,this._messageIdSeq);yield(0,e.writeMessage)(this.channel,t,s)}))}_start(){this._reset(),this.worker=this.workerCreator(),this.workerProxy=t.wrap(this.worker)}_reset(){this.state="idle",delete this._interruptPromise,delete this._interruptRejector,delete this._awaitingMessageResolve,delete this._messageIdBase}}function h(t){return function(i,n,a,...h){return s(this,void 0,void 0,(function*(){yield n("init");let s=0;function u(t,h){if(!i)throw new o;n(t);const u=l(a,++s),d=(0,e.readMessage)(i,u,h);if(d){const{message:e,interrupted:t}=d;if(t)throw new r;return e}"sleeping"===t&&n("slept")}return t({channel:i,readMessage:()=>u("reading"),syncSleep(e){e>0&&u("sleeping",{timeout:e})}},...h)}))}}function l(e,t){return`${e}-${t}`}})(),n})()}));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/comsync/dist/index.js?')},"./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/dist/cjs.js!./src/Papyros.css":(module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/noSourceMaps.js */ "./node_modules/css-loader/dist/runtime/noSourceMaps.js");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);\n// Imports\n\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `/* Utitilies are prefixed by Tailwind */\n._tw-col-span-2 {\n grid-column: span 2 / span 2 !important;\n}\n._tw-col-span-6 {\n grid-column: span 6 / span 6 !important;\n}\n._tw-m-10 {\n margin: 2.5rem !important;\n}\n._tw-m-2 {\n margin: 0.5rem !important;\n}\n._tw-mx-1 {\n margin-left: 0.25rem !important;\n margin-right: 0.25rem !important;\n}\n._tw-my-1 {\n margin-top: 0.25rem !important;\n margin-bottom: 0.25rem !important;\n}\n._tw-mr-0 {\n margin-right: 0px !important;\n}\n._tw-mr-0\\\\.5 {\n margin-right: 0.125rem !important;\n}\n._tw-mr-3 {\n margin-right: 0.75rem !important;\n}\n._tw-box-border {\n box-sizing: border-box !important;\n}\n._tw-flex {\n display: flex !important;\n}\n._tw-grid {\n display: grid !important;\n}\n._tw-h-\\\\[10px\\\\] {\n height: 10px !important;\n}\n._tw-h-\\\\[20px\\\\] {\n height: 20px !important;\n}\n._tw-h-full {\n height: 100% !important;\n}\n._tw-max-h-1\\\\/5 {\n max-height: 16vh !important;\n}\n._tw-max-h-3\\\\/5 {\n max-height: 48vh !important;\n}\n._tw-min-h-1\\\\/4 {\n min-height: 20vh !important;\n}\n._tw-min-h-screen {\n min-height: 100vh !important;\n}\n._tw-w-\\\\[10px\\\\] {\n width: 10px !important;\n}\n._tw-w-\\\\[20px\\\\] {\n width: 20px !important;\n}\n._tw-w-full {\n width: 100% !important;\n}\n@keyframes _tw-spin {\n to {\n transform: rotate(360deg);\n }\n}\n._tw-animate-spin {\n animation: _tw-spin 1s linear infinite !important;\n}\n._tw-grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr)) !important;\n}\n._tw-grid-cols-8 {\n grid-template-columns: repeat(8, minmax(0, 1fr)) !important;\n}\n._tw-flex-row {\n flex-direction: row !important;\n}\n._tw-flex-row-reverse {\n flex-direction: row-reverse !important;\n}\n._tw-items-center {\n align-items: center !important;\n}\n._tw-justify-between {\n justify-content: space-between !important;\n}\n._tw-gap-4 {\n gap: 1rem !important;\n}\n._tw-overflow-auto {\n overflow: auto !important;\n}\n._tw-whitespace-pre {\n white-space: pre !important;\n}\n._tw-rounded-full {\n border-radius: 9999px !important;\n}\n._tw-rounded-lg {\n border-radius: 0.5rem !important;\n}\n._tw-border {\n border-width: 1px !important;\n}\n._tw-border-2 {\n border-width: 2px !important;\n}\n._tw-border-b-2 {\n border-bottom-width: 2px !important;\n}\n._tw-border-solid {\n border-style: solid !important;\n}\n._tw-border-blue-500 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(59 130 246 / var(--tw-border-opacity)) !important;\n}\n._tw-border-gray-200 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(229 231 235 / var(--tw-border-opacity)) !important;\n}\n._tw-border-red-500 {\n --tw-border-opacity: 1 !important;\n border-color: rgb(239 68 68 / var(--tw-border-opacity)) !important;\n}\n._tw-border-b-red-500 {\n --tw-border-opacity: 1 !important;\n border-bottom-color: rgb(239 68 68 / var(--tw-border-opacity)) !important;\n}\n._tw-bg-blue-500 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity)) !important;\n}\n._tw-bg-slate-200 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(226 232 240 / var(--tw-bg-opacity)) !important;\n}\n._tw-bg-slate-500 {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(100 116 139 / var(--tw-bg-opacity)) !important;\n}\n._tw-p-4 {\n padding: 1rem !important;\n}\n._tw-px-1 {\n padding-left: 0.25rem !important;\n padding-right: 0.25rem !important;\n}\n._tw-px-2 {\n padding-left: 0.5rem !important;\n padding-right: 0.5rem !important;\n}\n._tw-py-1 {\n padding-top: 0.25rem !important;\n padding-bottom: 0.25rem !important;\n}\n._tw-text-center {\n text-align: center !important;\n}\n._tw-text-4xl {\n font-size: 2.25rem !important;\n line-height: 2.5rem !important;\n}\n._tw-text-lg {\n font-size: 1.125rem !important;\n line-height: 1.75rem !important;\n}\n._tw-font-bold {\n font-weight: 700 !important;\n}\n._tw-font-medium {\n font-weight: 500 !important;\n}\n._tw-text-\\\\[\\\\#FF8F00\\\\] {\n --tw-text-opacity: 1 !important;\n color: rgb(255 143 0 / var(--tw-text-opacity)) !important;\n}\n._tw-text-black {\n --tw-text-opacity: 1 !important;\n color: rgb(0 0 0 / var(--tw-text-opacity)) !important;\n}\n._tw-text-blue-500 {\n --tw-text-opacity: 1 !important;\n color: rgb(59 130 246 / var(--tw-text-opacity)) !important;\n}\n._tw-text-red-500 {\n --tw-text-opacity: 1 !important;\n color: rgb(239 68 68 / var(--tw-text-opacity)) !important;\n}\n._tw-text-white {\n --tw-text-opacity: 1 !important;\n color: rgb(255 255 255 / var(--tw-text-opacity)) !important;\n}\n._tw-border-b-red-500 {\n border-bottom-color: #ef4444 !important;\n}\n/* Tailwind base css that is used in Papyros */\n/* Source: node_modules/tailwindcss/src/css/preflight.css */\n/*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n.tailwind *,\n.tailwind ::before,\n.tailwind ::after {\n box-sizing: border-box;\n /* 1 */\n border-width: 0;\n /* 2 */\n border-style: solid;\n /* 2 */\n border-color: #e5e7eb;\n /* 2 */\n}\n.tailwind ::before,\n.tailwind ::after {\n --tw-content: \'\';\n}\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user\'s configured \\`sans\\` font-family by default.\n*/\n.tailwind-html {\n line-height: 1.5;\n /* 1 */\n -webkit-text-size-adjust: 100%;\n /* 2 */\n -moz-tab-size: 4;\n /* 3 */\n -o-tab-size: 4;\n tab-size: 4;\n /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";\n /* 4 */\n}\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from \\`html\\` so users can set them as a class directly on the \\`html\\` element.\n*/\n.tailwind-body {\n margin: 0;\n /* 1 */\n line-height: inherit;\n /* 2 */\n}\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n.tailwind button,\n.tailwind input,\n.tailwind select,\n.tailwind textarea {\n font-family: inherit;\n /* 1 */\n font-size: 100%;\n /* 1 */\n line-height: inherit;\n /* 1 */\n color: inherit;\n /* 1 */\n margin: 0;\n /* 2 */\n padding: 0;\n /* 3 */\n}\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n.tailwind :-moz-focusring {\n outline: auto;\n}\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n.tailwind p {\n margin: 0;\n}\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user\'s configured gray 400 color.\n*/\n.tailwind input::-moz-placeholder, .tailwind textarea::-moz-placeholder {\n opacity: 1;\n /* 1 */\n color: #9ca3af;\n /* 2 */\n}\n.tailwind input::placeholder,\n.tailwind textarea::placeholder {\n opacity: 1;\n /* 1 */\n color: #9ca3af;\n /* 2 */\n}\n/* Ensure the default browser behavior of the \\`hidden\\` attribute. */\n[hidden] {\n /* Make it invisible while keeping page layout */\n visibility: hidden !important; \n}\n/* CodeMirror search panel close button*/\n.cm-search > [name="close"] {\n cursor: pointer;\n}\n.cm-content,\n.papyros-font-family {\n font-family: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace;\n}\n/* Override top border generated by @codemirror/one-dark-theme */\n.ͼo .cm-panels.cm-panels-bottom {\n /* dark-mode-content in tailwind.config.js*/\n border-color: #37474F;\n}\n/* Change styling of tooltips generated by CodeMirror */\n.cm-completionInfo {\n white-space: pre;\n overflow: auto;\n resize: both;\n /* override default max width/height to allow resizing */\n max-width: 600px !important;\n max-height: 600px !important;\n}\n/* \n Disable resizing left completion infos as its movements are mirrored\n According to https://github.com/codemirror/codemirror.next/issues/815\n this feature is out of scope for CodeMirror\n*/\n.cm-completionInfo-left {\n resize: none;\n}\n/* Add placeholder to an empty element */\n.with-placeholder:empty:before {\n content: attr(data-placeholder);\n /* same value as placeholder-grey in tailwind.config.js */\n color: #888;\n}\n/* Also override CodeMirror buttons to use this style */\n.papyros-button,\n.cm-button,\n.tailwind .papyros-button,\n.tailwind .cm-button {\n margin: 0.25rem;\n cursor: pointer;\n border-radius: 0.5rem;\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.papyros-button:disabled,\n.cm-button:disabled,\n.tailwind .papyros-button:disabled,\n.tailwind .cm-button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.papyros-button,\n.cm-button,\n.tailwind .papyros-button,\n.tailwind .cm-button{\n min-width: 60px;\n}\n/* Round the corners of textfields created by CodeMirror */\n.cm-textfield {\n border-radius: 0.5rem !important;\n}\n.papyros-button.btn-primary {\n --tw-bg-opacity: 1;\n background-color: rgb(59 130 246 / var(--tw-bg-opacity));\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n.papyros-button.btn-secondary {\n --tw-bg-opacity: 1;\n background-color: rgb(107 114 128 / var(--tw-bg-opacity));\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n.papyros-button.btn-danger {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity));\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity));\n}\n.papyros-button.with-icon {\n padding-left: 8px;\n}\n.papyros-button.with-icon svg{\n vertical-align: middle;\n}\n.papyros-test-code {\n background-color: rgba(143, 182, 130, 0.1);\n}\n.papyros-test-code.cm-activeLine {\n background-color: rgba(143, 182, 130, 0.1)\n}\n.papyros-test-code-widget {\n background-color: rgba(143, 182, 130, 0.1);\n color: #7d8799;\n padding: 0 2px 0 6px;\n position: relative;\n}\n.papyros-test-code-buttons {\n position: absolute;\n top: -2px;\n left: -42px;\n z-index: 220;\n}\n.papyros-icon-link {\n --tw-text-opacity: 1;\n color: rgb(59 130 246 / var(--tw-text-opacity));\n font-size: 16px;\n padding: 2px;\n cursor: pointer;\n}\n.papyros-icon-link:hover {\n --tw-text-opacity: 1;\n color: rgb(96 165 250 / var(--tw-text-opacity));\n}\n.papyros-state-card.cm-panels {\n display: none;\n position: absolute;\n right: 8px;\n top: -31px;\n left: initial;\n padding: 4px 8px;\n border-top-left-radius: 12px;\n border-top-right-radius: 12px;\n border: 1px solid;\n --tw-border-opacity: 1;\n border-color: rgb(229 231 235 / var(--tw-border-opacity));\n}\n.papyros-state-card.cm-panels:is(._tw-dark *) {\n border-style: none;\n}\n.papyros-state-card.cm-panels.show {\n display: flex;\n}\n.papyros-bottom-padding-widget {\n position: relative;\n height: 0;\n}\n.papyros-bottom-padding-widget div {\n background-color: rgba(143, 182, 130, 0.1);\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 4px;\n}\n#__papyros-code-output-area.papyros-debug > * {\n opacity: 0.1;\n}\n#__papyros-code-output-area.papyros-debug > .papyros-highlight-debugged {\n opacity: 1;\n}\n.papyros-code-editor .cm-content[contenteditable="false"] {\n cursor: default;\n}\n.papyros-code-editor .cm-gutters {\n cursor: default;\n}\n.placeholder\\\\:_tw-text-placeholder-grey::-moz-placeholder {\n --tw-text-opacity: 1 !important;\n color: rgb(136 136 136 / var(--tw-text-opacity)) !important;\n}\n.placeholder\\\\:_tw-text-placeholder-grey::placeholder {\n --tw-text-opacity: 1 !important;\n color: rgb(136 136 136 / var(--tw-text-opacity)) !important;\n}\n.hover\\\\:_tw-cursor-pointer:hover {\n cursor: pointer !important;\n}\n.focus\\\\:_tw-outline-none:focus {\n outline: 2px solid transparent !important;\n outline-offset: 2px !important;\n}\n.focus\\\\:_tw-ring-1:focus {\n --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;\n --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;\n box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000) !important;\n}\n.focus\\\\:_tw-ring-blue-500:focus {\n --tw-ring-opacity: 1 !important;\n --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)) !important;\n}\n.disabled\\\\:_tw-cursor-not-allowed:disabled {\n cursor: not-allowed !important;\n}\n.dark\\\\:_tw-border-dark-mode-blue:is(._tw-dark *) {\n --tw-border-opacity: 1 !important;\n border-color: rgb(2 119 189 / var(--tw-border-opacity)) !important;\n}\n.dark\\\\:_tw-border-dark-mode-content:is(._tw-dark *) {\n --tw-border-opacity: 1 !important;\n border-color: rgb(55 71 79 / var(--tw-border-opacity)) !important;\n}\n.dark\\\\:_tw-bg-dark-mode-bg:is(._tw-dark *) {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(38 50 56 / var(--tw-bg-opacity)) !important;\n}\n.dark\\\\:_tw-bg-dark-mode-blue:is(._tw-dark *) {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(2 119 189 / var(--tw-bg-opacity)) !important;\n}\n.dark\\\\:_tw-bg-slate-500:is(._tw-dark *) {\n --tw-bg-opacity: 1 !important;\n background-color: rgb(100 116 139 / var(--tw-bg-opacity)) !important;\n}\n.dark\\\\:_tw-text-dark-mode-blue:is(._tw-dark *) {\n --tw-text-opacity: 1 !important;\n color: rgb(2 119 189 / var(--tw-text-opacity)) !important;\n}\n.dark\\\\:_tw-text-white:is(._tw-dark *) {\n --tw-text-opacity: 1 !important;\n color: rgb(255 255 255 / var(--tw-text-opacity)) !important;\n}`, ""]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://Papyros/./src/Papyros.css?./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/dist/cjs.js')},"./node_modules/css-loader/dist/runtime/api.js":module=>{"use strict";eval('\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nmodule.exports = function (cssWithMappingToString) {\n var list = [];\n\n // return the list of modules as css string\n list.toString = function toString() {\n return this.map(function (item) {\n var content = "";\n var needLayer = typeof item[5] !== "undefined";\n if (item[4]) {\n content += "@supports (".concat(item[4], ") {");\n }\n if (item[2]) {\n content += "@media ".concat(item[2], " {");\n }\n if (needLayer) {\n content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");\n }\n content += cssWithMappingToString(item);\n if (needLayer) {\n content += "}";\n }\n if (item[2]) {\n content += "}";\n }\n if (item[4]) {\n content += "}";\n }\n return content;\n }).join("");\n };\n\n // import a list of modules into the list\n list.i = function i(modules, media, dedupe, supports, layer) {\n if (typeof modules === "string") {\n modules = [[null, modules, undefined]];\n }\n var alreadyImportedModules = {};\n if (dedupe) {\n for (var k = 0; k < this.length; k++) {\n var id = this[k][0];\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n for (var _k = 0; _k < modules.length; _k++) {\n var item = [].concat(modules[_k]);\n if (dedupe && alreadyImportedModules[item[0]]) {\n continue;\n }\n if (typeof layer !== "undefined") {\n if (typeof item[5] === "undefined") {\n item[5] = layer;\n } else {\n item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");\n item[5] = layer;\n }\n }\n if (media) {\n if (!item[2]) {\n item[2] = media;\n } else {\n item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");\n item[2] = media;\n }\n }\n if (supports) {\n if (!item[4]) {\n item[4] = "".concat(supports);\n } else {\n item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");\n item[4] = supports;\n }\n }\n list.push(item);\n }\n };\n return list;\n};\n\n//# sourceURL=webpack://Papyros/./node_modules/css-loader/dist/runtime/api.js?')},"./node_modules/css-loader/dist/runtime/noSourceMaps.js":module=>{"use strict";eval("\n\nmodule.exports = function (i) {\n return i[1];\n};\n\n//# sourceURL=webpack://Papyros/./node_modules/css-loader/dist/runtime/noSourceMaps.js?")},"./node_modules/escape-html/index.js":module=>{"use strict";eval("/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n\n\n//# sourceURL=webpack://Papyros/./node_modules/escape-html/index.js?")},"./node_modules/i18n-js/dist/import/I18n.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ I18n: () => (/* binding */ I18n)\n/* harmony export */ });\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/get */ "./node_modules/lodash/get.js");\n/* harmony import */ var lodash_get__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_get__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var lodash_has__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/has */ "./node_modules/lodash/has.js");\n/* harmony import */ var lodash_has__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_has__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/merge */ "./node_modules/lodash/merge.js");\n/* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _Locales__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Locales */ "./node_modules/i18n-js/dist/import/Locales.js");\n/* harmony import */ var _Pluralization__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Pluralization */ "./node_modules/i18n-js/dist/import/Pluralization.js");\n/* harmony import */ var _MissingTranslation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./MissingTranslation */ "./node_modules/i18n-js/dist/import/MissingTranslation.js");\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "./node_modules/i18n-js/dist/import/helpers/index.js");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\n\n\n\n\n\nconst DEFAULT_I18N_OPTIONS = {\n defaultLocale: "en",\n availableLocales: ["en"],\n locale: "en",\n defaultSeparator: ".",\n placeholder: /(?:\\{\\{|%\\{)(.*?)(?:\\}\\}?)/gm,\n enableFallback: false,\n missingBehavior: "message",\n missingTranslationPrefix: "",\n missingPlaceholder: (_i18n, placeholder) => `[missing "${placeholder}" value]`,\n nullPlaceholder: (i18n, placeholder, message, options) => i18n.missingPlaceholder(i18n, placeholder, message, options),\n transformKey: (key) => key,\n};\nclass I18n {\n constructor(translations = {}, options = {}) {\n this._locale = DEFAULT_I18N_OPTIONS.locale;\n this._defaultLocale = DEFAULT_I18N_OPTIONS.defaultLocale;\n this._version = 0;\n this.onChangeHandlers = [];\n this.translations = {};\n this.availableLocales = [];\n this.t = this.translate;\n this.p = this.pluralize;\n this.l = this.localize;\n this.distanceOfTimeInWords = this.timeAgoInWords;\n const { locale, enableFallback, missingBehavior, missingTranslationPrefix, missingPlaceholder, nullPlaceholder, defaultLocale, defaultSeparator, placeholder, transformKey, } = Object.assign(Object.assign({}, DEFAULT_I18N_OPTIONS), options);\n this.locale = locale;\n this.defaultLocale = defaultLocale;\n this.defaultSeparator = defaultSeparator;\n this.enableFallback = enableFallback;\n this.locale = locale;\n this.missingBehavior = missingBehavior;\n this.missingTranslationPrefix = missingTranslationPrefix;\n this.missingPlaceholder = missingPlaceholder;\n this.nullPlaceholder = nullPlaceholder;\n this.placeholder = placeholder;\n this.pluralization = new _Pluralization__WEBPACK_IMPORTED_MODULE_4__.Pluralization(this);\n this.locales = new _Locales__WEBPACK_IMPORTED_MODULE_3__.Locales(this);\n this.missingTranslation = new _MissingTranslation__WEBPACK_IMPORTED_MODULE_5__.MissingTranslation(this);\n this.transformKey = transformKey;\n this.interpolate = _helpers__WEBPACK_IMPORTED_MODULE_6__.interpolate;\n this.store(translations);\n }\n store(translations) {\n lodash_merge__WEBPACK_IMPORTED_MODULE_2___default()(this.translations, translations);\n this.hasChanged();\n }\n get locale() {\n return this._locale || this.defaultLocale || "en";\n }\n set locale(newLocale) {\n if (typeof newLocale !== "string") {\n throw new Error(`Expected newLocale to be a string; got ${(0,_helpers__WEBPACK_IMPORTED_MODULE_6__.inferType)(newLocale)}`);\n }\n const changed = this._locale !== newLocale;\n this._locale = newLocale;\n if (changed) {\n this.hasChanged();\n }\n }\n get defaultLocale() {\n return this._defaultLocale || "en";\n }\n set defaultLocale(newLocale) {\n if (typeof newLocale !== "string") {\n throw new Error(`Expected newLocale to be a string; got ${(0,_helpers__WEBPACK_IMPORTED_MODULE_6__.inferType)(newLocale)}`);\n }\n const changed = this._defaultLocale !== newLocale;\n this._defaultLocale = newLocale;\n if (changed) {\n this.hasChanged();\n }\n }\n translate(scope, options) {\n options = Object.assign({}, options);\n const translationOptions = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.createTranslationOptions)(this, scope, options);\n let translation;\n const hasFoundTranslation = translationOptions.some((translationOption) => {\n if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isSet)(translationOption.scope)) {\n translation = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.lookup)(this, translationOption.scope, options);\n }\n else if ((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isSet)(translationOption.message)) {\n translation = translationOption.message;\n }\n return translation !== undefined && translation !== null;\n });\n if (!hasFoundTranslation) {\n return this.missingTranslation.get(scope, options);\n }\n if (typeof translation === "string") {\n translation = this.interpolate(this, translation, options);\n }\n else if (typeof translation === "object" &&\n translation &&\n (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.isSet)(options.count)) {\n translation = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.pluralize)({\n i18n: this,\n count: options.count || 0,\n scope: translation,\n options,\n baseScope: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.getFullScope)(this, scope, options),\n });\n }\n if (options && translation instanceof Array) {\n translation = translation.map((entry) => typeof entry === "string"\n ? (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.interpolate)(this, entry, options)\n : entry);\n }\n return translation;\n }\n pluralize(count, scope, options) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.pluralize)({\n i18n: this,\n count,\n scope,\n options: Object.assign({}, options),\n baseScope: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.getFullScope)(this, scope, options !== null && options !== void 0 ? options : {}),\n });\n }\n localize(type, value, options) {\n options = Object.assign({}, options);\n if (value === undefined || value === null) {\n return "";\n }\n switch (type) {\n case "currency":\n return this.numberToCurrency(value);\n case "number":\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.formatNumber)(value, Object.assign({ delimiter: ",", precision: 3, separator: ".", significant: false, stripInsignificantZeros: false }, (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.lookup)(this, "number.format")));\n case "percentage":\n return this.numberToPercentage(value);\n default: {\n let localizedValue;\n if (type.match(/^(date|time)/)) {\n localizedValue = this.toTime(type, value);\n }\n else {\n localizedValue = value.toString();\n }\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.interpolate)(this, localizedValue, options);\n }\n }\n }\n toTime(scope, input) {\n const date = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.parseDate)(input);\n const format = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.lookup)(this, scope);\n if (date.toString().match(/invalid/i)) {\n return date.toString();\n }\n if (!format) {\n return date.toString();\n }\n return this.strftime(date, format);\n }\n numberToCurrency(input, options = {}) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.formatNumber)(input, Object.assign(Object.assign(Object.assign({ delimiter: ",", format: "%u%n", precision: 2, separator: ".", significant: false, stripInsignificantZeros: false, unit: "$" }, (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)(this.get("number.format"))), (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)(this.get("number.currency.format"))), options));\n }\n numberToPercentage(input, options = {}) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.formatNumber)(input, Object.assign(Object.assign(Object.assign({ delimiter: "", format: "%n%", precision: 3, stripInsignificantZeros: false, separator: ".", significant: false }, (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)(this.get("number.format"))), (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)(this.get("number.percentage.format"))), options));\n }\n numberToHumanSize(input, options = {}) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.numberToHumanSize)(this, input, Object.assign(Object.assign(Object.assign({ delimiter: "", precision: 3, significant: true, stripInsignificantZeros: true, units: {\n billion: "Billion",\n million: "Million",\n quadrillion: "Quadrillion",\n thousand: "Thousand",\n trillion: "Trillion",\n unit: "",\n } }, (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)(this.get("number.human.format"))), (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)(this.get("number.human.storage_units"))), options));\n }\n numberToHuman(input, options = {}) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.numberToHuman)(this, input, Object.assign(Object.assign(Object.assign({ delimiter: "", separator: ".", precision: 3, significant: true, stripInsignificantZeros: true, format: "%n %u", roundMode: "default", units: {\n billion: "Billion",\n million: "Million",\n quadrillion: "Quadrillion",\n thousand: "Thousand",\n trillion: "Trillion",\n unit: "",\n } }, (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)(this.get("number.human.format"))), (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)(this.get("number.human.decimal_units"))), options));\n }\n numberToRounded(input, options) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.formatNumber)(input, Object.assign({ unit: "", precision: 3, significant: false, separator: ".", delimiter: "", stripInsignificantZeros: false }, options));\n }\n numberToDelimited(input, options = {}) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.numberToDelimited)(input, Object.assign({ delimiterPattern: /(\\d)(?=(\\d\\d\\d)+(?!\\d))/g, delimiter: ",", separator: "." }, options));\n }\n withLocale(locale, callback) {\n return __awaiter(this, void 0, void 0, function* () {\n const originalLocale = this.locale;\n try {\n this.locale = locale;\n yield callback();\n }\n finally {\n this.locale = originalLocale;\n }\n });\n }\n strftime(date, format, options = {}) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.strftime)(date, format, Object.assign(Object.assign(Object.assign({}, (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.lookup)(this, "date"))), { meridian: {\n am: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.lookup)(this, "time.am") || "AM",\n pm: (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.lookup)(this, "time.pm") || "PM",\n } }), options));\n }\n update(path, override, options = { strict: false }) {\n if (options.strict && !lodash_has__WEBPACK_IMPORTED_MODULE_1___default()(this.translations, path)) {\n throw new Error(`The path "${path}" is not currently defined`);\n }\n const currentNode = lodash_get__WEBPACK_IMPORTED_MODULE_0___default()(this.translations, path);\n const currentType = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.inferType)(currentNode);\n const overrideType = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.inferType)(override);\n if (options.strict && currentType !== overrideType) {\n throw new Error(`The current type for "${path}" is "${currentType}", but you\'re trying to override it with "${overrideType}"`);\n }\n let newNode;\n if (overrideType === "object") {\n newNode = Object.assign(Object.assign({}, currentNode), override);\n }\n else {\n newNode = override;\n }\n const components = path.split(this.defaultSeparator);\n const prop = components.pop();\n let buffer = this.translations;\n for (const component of components) {\n if (!buffer[component]) {\n buffer[component] = {};\n }\n buffer = buffer[component];\n }\n buffer[prop] = newNode;\n this.hasChanged();\n }\n toSentence(items, options = {}) {\n const { wordsConnector, twoWordsConnector, lastWordConnector } = Object.assign(Object.assign({ wordsConnector: ", ", twoWordsConnector: " and ", lastWordConnector: ", and " }, (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)((0,_helpers__WEBPACK_IMPORTED_MODULE_6__.lookup)(this, "support.array"))), options);\n const size = items.length;\n switch (size) {\n case 0:\n return "";\n case 1:\n return `${items[0]}`;\n case 2:\n return items.join(twoWordsConnector);\n default:\n return [\n items.slice(0, size - 1).join(wordsConnector),\n lastWordConnector,\n items[size - 1],\n ].join("");\n }\n }\n timeAgoInWords(fromTime, toTime, options = {}) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.timeAgoInWords)(this, fromTime, toTime, options);\n }\n onChange(callback) {\n this.onChangeHandlers.push(callback);\n return () => {\n this.onChangeHandlers.splice(this.onChangeHandlers.indexOf(callback), 1);\n };\n }\n get version() {\n return this._version;\n }\n formatNumber(input, options = {}) {\n options = Object.assign(Object.assign({ delimiter: ",", precision: 3, separator: ".", unit: "", format: "%u%n", significant: false, stripInsignificantZeros: false }, (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.camelCaseKeys)(this.get("number.format"))), options);\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.formatNumber)(input, options);\n }\n get(scope) {\n return (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.lookup)(this, scope);\n }\n runCallbacks() {\n this.onChangeHandlers.forEach((callback) => callback(this));\n }\n hasChanged() {\n this._version += 1;\n this.runCallbacks();\n }\n}\n//# sourceMappingURL=I18n.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/I18n.js?')},"./node_modules/i18n-js/dist/import/Locales.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Locales: () => (/* binding */ Locales),\n/* harmony export */ defaultLocaleResolver: () => (/* binding */ defaultLocaleResolver)\n/* harmony export */ });\n/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/uniq */ "./node_modules/lodash/uniq.js");\n/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_0__);\n\nconst defaultLocaleResolver = (i18n, locale) => {\n const locales = [];\n const list = [];\n locales.push(locale);\n if (!locale) {\n locales.push(i18n.locale);\n }\n if (i18n.enableFallback) {\n locales.push(i18n.defaultLocale);\n }\n locales\n .filter(Boolean)\n .map((entry) => entry.toString())\n .forEach(function (currentLocale) {\n if (!list.includes(currentLocale)) {\n list.push(currentLocale);\n }\n if (!i18n.enableFallback) {\n return;\n }\n const codes = currentLocale.split("-");\n if (codes.length === 3) {\n list.push(`${codes[0]}-${codes[1]}`);\n }\n list.push(codes[0]);\n });\n return lodash_uniq__WEBPACK_IMPORTED_MODULE_0___default()(list);\n};\nclass Locales {\n constructor(i18n) {\n this.i18n = i18n;\n this.registry = {};\n this.register("default", defaultLocaleResolver);\n }\n register(locale, localeResolver) {\n if (typeof localeResolver !== "function") {\n const result = localeResolver;\n localeResolver = (() => result);\n }\n this.registry[locale] = localeResolver;\n }\n get(locale) {\n let locales = this.registry[locale] ||\n this.registry[this.i18n.locale] ||\n this.registry.default;\n if (typeof locales === "function") {\n locales = locales(this.i18n, locale);\n }\n if (!(locales instanceof Array)) {\n locales = [locales];\n }\n return locales;\n }\n}\n//# sourceMappingURL=Locales.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/Locales.js?')},"./node_modules/i18n-js/dist/import/MissingTranslation.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MissingTranslation: () => (/* binding */ MissingTranslation),\n/* harmony export */ errorStrategy: () => (/* binding */ errorStrategy),\n/* harmony export */ guessStrategy: () => (/* binding */ guessStrategy),\n/* harmony export */ messageStrategy: () => (/* binding */ messageStrategy)\n/* harmony export */ });\n/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./node_modules/i18n-js/dist/import/helpers/index.js");\n\nconst guessStrategy = function (i18n, scope) {\n if (scope instanceof Array) {\n scope = scope.join(i18n.defaultSeparator);\n }\n const message = scope.split(i18n.defaultSeparator).slice(-1)[0];\n return (i18n.missingTranslationPrefix +\n message\n .replace("_", " ")\n .replace(/([a-z])([A-Z])/g, (_match, p1, p2) => `${p1} ${p2.toLowerCase()}`));\n};\nconst messageStrategy = (i18n, scope, options) => {\n const fullScope = (0,_helpers__WEBPACK_IMPORTED_MODULE_0__.getFullScope)(i18n, scope, options);\n const locale = "locale" in options ? options.locale : i18n.locale;\n const localeType = (0,_helpers__WEBPACK_IMPORTED_MODULE_0__.inferType)(locale);\n const fullScopeWithLocale = [\n localeType == "string" ? locale : localeType,\n fullScope,\n ].join(i18n.defaultSeparator);\n return `[missing "${fullScopeWithLocale}" translation]`;\n};\nconst errorStrategy = (i18n, scope, options) => {\n const fullScope = (0,_helpers__WEBPACK_IMPORTED_MODULE_0__.getFullScope)(i18n, scope, options);\n const fullScopeWithLocale = [i18n.locale, fullScope].join(i18n.defaultSeparator);\n throw new Error(`Missing translation: ${fullScopeWithLocale}`);\n};\nclass MissingTranslation {\n constructor(i18n) {\n this.i18n = i18n;\n this.registry = {};\n this.register("guess", guessStrategy);\n this.register("message", messageStrategy);\n this.register("error", errorStrategy);\n }\n register(name, strategy) {\n this.registry[name] = strategy;\n }\n get(scope, options) {\n var _a;\n return this.registry[(_a = options.missingBehavior) !== null && _a !== void 0 ? _a : this.i18n.missingBehavior](this.i18n, scope, options);\n }\n}\n//# sourceMappingURL=MissingTranslation.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/MissingTranslation.js?')},"./node_modules/i18n-js/dist/import/Pluralization.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Pluralization: () => (/* binding */ Pluralization),\n/* harmony export */ defaultPluralizer: () => (/* binding */ defaultPluralizer),\n/* harmony export */ useMakePlural: () => (/* binding */ useMakePlural)\n/* harmony export */ });\n/* harmony import */ var make_plural__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! make-plural */ "./node_modules/make-plural/plurals.mjs");\n\nfunction useMakePlural({ pluralizer, includeZero = true, ordinal = false, }) {\n return function (_i18n, count) {\n return [\n includeZero && count === 0 ? "zero" : "",\n pluralizer(count, ordinal),\n ].filter(Boolean);\n };\n}\nconst defaultPluralizer = useMakePlural({\n pluralizer: make_plural__WEBPACK_IMPORTED_MODULE_0__.en,\n includeZero: true,\n});\nclass Pluralization {\n constructor(i18n) {\n this.i18n = i18n;\n this.registry = {};\n this.register("default", defaultPluralizer);\n }\n register(locale, pluralizer) {\n this.registry[locale] = pluralizer;\n }\n get(locale) {\n return (this.registry[locale] ||\n this.registry[this.i18n.locale] ||\n this.registry["default"]);\n }\n}\n//# sourceMappingURL=Pluralization.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/Pluralization.js?')},"./node_modules/i18n-js/dist/import/helpers/camelCaseKeys.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ camelCaseKeys: () => (/* binding */ camelCaseKeys)\n/* harmony export */ });\n/* harmony import */ var lodash_camelCase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/camelCase */ "./node_modules/lodash/camelCase.js");\n/* harmony import */ var lodash_camelCase__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_camelCase__WEBPACK_IMPORTED_MODULE_0__);\n\nfunction camelCaseKeys(target) {\n if (!target) {\n return {};\n }\n return Object.keys(target).reduce((buffer, key) => {\n buffer[lodash_camelCase__WEBPACK_IMPORTED_MODULE_0___default()(key)] = target[key];\n return buffer;\n }, {});\n}\n//# sourceMappingURL=camelCaseKeys.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/camelCaseKeys.js?')},"./node_modules/i18n-js/dist/import/helpers/createTranslationOptions.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createTranslationOptions: () => (/* binding */ createTranslationOptions)\n/* harmony export */ });\n/* harmony import */ var _isSet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isSet */ "./node_modules/i18n-js/dist/import/helpers/isSet.js");\n\nfunction createTranslationOptions(i18n, scope, options) {\n let translationOptions = [{ scope }];\n if ((0,_isSet__WEBPACK_IMPORTED_MODULE_0__.isSet)(options.defaults)) {\n translationOptions = translationOptions.concat(options.defaults);\n }\n if ((0,_isSet__WEBPACK_IMPORTED_MODULE_0__.isSet)(options.defaultValue)) {\n const message = typeof options.defaultValue === "function"\n ? options.defaultValue(i18n, scope, options)\n : options.defaultValue;\n translationOptions.push({ message });\n delete options.defaultValue;\n }\n return translationOptions;\n}\n//# sourceMappingURL=createTranslationOptions.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/createTranslationOptions.js?')},"./node_modules/i18n-js/dist/import/helpers/expandRoundMode.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ expandRoundMode: () => (/* binding */ expandRoundMode)\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ "./node_modules/bignumber.js/bignumber.mjs");\n\nvar RoundingModeMap;\n(function (RoundingModeMap) {\n RoundingModeMap[RoundingModeMap["up"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_UP] = "up";\n RoundingModeMap[RoundingModeMap["down"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_DOWN] = "down";\n RoundingModeMap[RoundingModeMap["truncate"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_DOWN] = "truncate";\n RoundingModeMap[RoundingModeMap["halfUp"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_HALF_UP] = "halfUp";\n RoundingModeMap[RoundingModeMap["default"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_HALF_UP] = "default";\n RoundingModeMap[RoundingModeMap["halfDown"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_HALF_DOWN] = "halfDown";\n RoundingModeMap[RoundingModeMap["halfEven"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_HALF_EVEN] = "halfEven";\n RoundingModeMap[RoundingModeMap["banker"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_HALF_EVEN] = "banker";\n RoundingModeMap[RoundingModeMap["ceiling"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_CEIL] = "ceiling";\n RoundingModeMap[RoundingModeMap["ceil"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_CEIL] = "ceil";\n RoundingModeMap[RoundingModeMap["floor"] = bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_FLOOR] = "floor";\n})(RoundingModeMap || (RoundingModeMap = {}));\nfunction expandRoundMode(roundMode) {\n var _a;\n return ((_a = RoundingModeMap[roundMode]) !== null && _a !== void 0 ? _a : RoundingModeMap.default);\n}\n//# sourceMappingURL=expandRoundMode.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/expandRoundMode.js?')},"./node_modules/i18n-js/dist/import/helpers/formatNumber.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ formatNumber: () => (/* binding */ formatNumber)\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ "./node_modules/bignumber.js/bignumber.mjs");\n/* harmony import */ var lodash_repeat__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/repeat */ "./node_modules/lodash/repeat.js");\n/* harmony import */ var lodash_repeat__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_repeat__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _roundNumber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./roundNumber */ "./node_modules/i18n-js/dist/import/helpers/roundNumber.js");\n\n\n\nfunction replaceInFormat(format, { formattedNumber, unit }) {\n return format.replace("%n", formattedNumber).replace("%u", unit);\n}\nfunction computeSignificand({ significand, whole, precision, }) {\n if (whole === "0" || precision === null) {\n return significand;\n }\n const limit = Math.max(0, precision - whole.length);\n return (significand !== null && significand !== void 0 ? significand : "").substr(0, limit);\n}\nfunction formatNumber(input, options) {\n var _a, _b, _c;\n const originalNumber = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"](input);\n if (options.raise && !originalNumber.isFinite()) {\n throw new Error(`"${input}" is not a valid numeric value`);\n }\n const roundedNumber = (0,_roundNumber__WEBPACK_IMPORTED_MODULE_2__.roundNumber)(originalNumber, options);\n const numeric = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"](roundedNumber);\n const isNegative = numeric.lt(0);\n const isZero = numeric.isZero();\n let [whole, significand] = roundedNumber.split(".");\n const buffer = [];\n let formattedNumber;\n const positiveFormat = (_a = options.format) !== null && _a !== void 0 ? _a : "%n";\n const negativeFormat = (_b = options.negativeFormat) !== null && _b !== void 0 ? _b : `-${positiveFormat}`;\n const format = isNegative && !isZero ? negativeFormat : positiveFormat;\n whole = whole.replace("-", "");\n while (whole.length > 0) {\n buffer.unshift(whole.substr(Math.max(0, whole.length - 3), 3));\n whole = whole.substr(0, whole.length - 3);\n }\n whole = buffer.join("");\n formattedNumber = buffer.join(options.delimiter);\n if (options.significant) {\n significand = computeSignificand({\n whole,\n significand,\n precision: options.precision,\n });\n }\n else {\n significand = significand !== null && significand !== void 0 ? significand : lodash_repeat__WEBPACK_IMPORTED_MODULE_1___default()("0", (_c = options.precision) !== null && _c !== void 0 ? _c : 0);\n }\n if (options.stripInsignificantZeros && significand) {\n significand = significand.replace(/0+$/, "");\n }\n if (originalNumber.isNaN()) {\n formattedNumber = input.toString();\n }\n if (significand && originalNumber.isFinite()) {\n formattedNumber += (options.separator || ".") + significand;\n }\n return replaceInFormat(format, {\n formattedNumber,\n unit: options.unit,\n });\n}\n//# sourceMappingURL=formatNumber.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/formatNumber.js?')},"./node_modules/i18n-js/dist/import/helpers/getFullScope.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getFullScope: () => (/* binding */ getFullScope)\n/* harmony export */ });\nfunction getFullScope(i18n, scope, options) {\n let result = "";\n if (scope instanceof String || typeof scope === "string") {\n result = scope;\n }\n if (scope instanceof Array) {\n result = scope.join(i18n.defaultSeparator);\n }\n if (options.scope) {\n result = [options.scope, result].join(i18n.defaultSeparator);\n }\n return result;\n}\n//# sourceMappingURL=getFullScope.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/getFullScope.js?')},"./node_modules/i18n-js/dist/import/helpers/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ camelCaseKeys: () => (/* reexport safe */ _camelCaseKeys__WEBPACK_IMPORTED_MODULE_0__.camelCaseKeys),\n/* harmony export */ createTranslationOptions: () => (/* reexport safe */ _createTranslationOptions__WEBPACK_IMPORTED_MODULE_1__.createTranslationOptions),\n/* harmony export */ expandRoundMode: () => (/* reexport safe */ _expandRoundMode__WEBPACK_IMPORTED_MODULE_2__.expandRoundMode),\n/* harmony export */ formatNumber: () => (/* reexport safe */ _formatNumber__WEBPACK_IMPORTED_MODULE_3__.formatNumber),\n/* harmony export */ getFullScope: () => (/* reexport safe */ _getFullScope__WEBPACK_IMPORTED_MODULE_4__.getFullScope),\n/* harmony export */ inferType: () => (/* reexport safe */ _inferType__WEBPACK_IMPORTED_MODULE_5__.inferType),\n/* harmony export */ interpolate: () => (/* reexport safe */ _interpolate__WEBPACK_IMPORTED_MODULE_6__.interpolate),\n/* harmony export */ isSet: () => (/* reexport safe */ _isSet__WEBPACK_IMPORTED_MODULE_7__.isSet),\n/* harmony export */ lookup: () => (/* reexport safe */ _lookup__WEBPACK_IMPORTED_MODULE_8__.lookup),\n/* harmony export */ numberToDelimited: () => (/* reexport safe */ _numberToDelimited__WEBPACK_IMPORTED_MODULE_9__.numberToDelimited),\n/* harmony export */ numberToHuman: () => (/* reexport safe */ _numberToHuman__WEBPACK_IMPORTED_MODULE_10__.numberToHuman),\n/* harmony export */ numberToHumanSize: () => (/* reexport safe */ _numberToHumanSize__WEBPACK_IMPORTED_MODULE_11__.numberToHumanSize),\n/* harmony export */ parseDate: () => (/* reexport safe */ _parseDate__WEBPACK_IMPORTED_MODULE_12__.parseDate),\n/* harmony export */ pluralize: () => (/* reexport safe */ _pluralize__WEBPACK_IMPORTED_MODULE_13__.pluralize),\n/* harmony export */ roundNumber: () => (/* reexport safe */ _roundNumber__WEBPACK_IMPORTED_MODULE_14__.roundNumber),\n/* harmony export */ strftime: () => (/* reexport safe */ _strftime__WEBPACK_IMPORTED_MODULE_15__.strftime),\n/* harmony export */ timeAgoInWords: () => (/* reexport safe */ _timeAgoInWords__WEBPACK_IMPORTED_MODULE_16__.timeAgoInWords)\n/* harmony export */ });\n/* harmony import */ var _camelCaseKeys__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./camelCaseKeys */ "./node_modules/i18n-js/dist/import/helpers/camelCaseKeys.js");\n/* harmony import */ var _createTranslationOptions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createTranslationOptions */ "./node_modules/i18n-js/dist/import/helpers/createTranslationOptions.js");\n/* harmony import */ var _expandRoundMode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./expandRoundMode */ "./node_modules/i18n-js/dist/import/helpers/expandRoundMode.js");\n/* harmony import */ var _formatNumber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./formatNumber */ "./node_modules/i18n-js/dist/import/helpers/formatNumber.js");\n/* harmony import */ var _getFullScope__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./getFullScope */ "./node_modules/i18n-js/dist/import/helpers/getFullScope.js");\n/* harmony import */ var _inferType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./inferType */ "./node_modules/i18n-js/dist/import/helpers/inferType.js");\n/* harmony import */ var _interpolate__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./interpolate */ "./node_modules/i18n-js/dist/import/helpers/interpolate.js");\n/* harmony import */ var _isSet__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./isSet */ "./node_modules/i18n-js/dist/import/helpers/isSet.js");\n/* harmony import */ var _lookup__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lookup */ "./node_modules/i18n-js/dist/import/helpers/lookup.js");\n/* harmony import */ var _numberToDelimited__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./numberToDelimited */ "./node_modules/i18n-js/dist/import/helpers/numberToDelimited.js");\n/* harmony import */ var _numberToHuman__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./numberToHuman */ "./node_modules/i18n-js/dist/import/helpers/numberToHuman.js");\n/* harmony import */ var _numberToHumanSize__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./numberToHumanSize */ "./node_modules/i18n-js/dist/import/helpers/numberToHumanSize.js");\n/* harmony import */ var _parseDate__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./parseDate */ "./node_modules/i18n-js/dist/import/helpers/parseDate.js");\n/* harmony import */ var _pluralize__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./pluralize */ "./node_modules/i18n-js/dist/import/helpers/pluralize.js");\n/* harmony import */ var _roundNumber__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./roundNumber */ "./node_modules/i18n-js/dist/import/helpers/roundNumber.js");\n/* harmony import */ var _strftime__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./strftime */ "./node_modules/i18n-js/dist/import/helpers/strftime.js");\n/* harmony import */ var _timeAgoInWords__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./timeAgoInWords */ "./node_modules/i18n-js/dist/import/helpers/timeAgoInWords.js");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/index.js?')},"./node_modules/i18n-js/dist/import/helpers/inferType.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ inferType: () => (/* binding */ inferType)\n/* harmony export */ });\nfunction inferType(instance) {\n var _a, _b;\n if (instance === null) {\n return "null";\n }\n const type = typeof instance;\n if (type !== "object") {\n return type;\n }\n return ((_b = (_a = instance === null || instance === void 0 ? void 0 : instance.constructor) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || "object";\n}\n//# sourceMappingURL=inferType.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/inferType.js?')},"./node_modules/i18n-js/dist/import/helpers/interpolate.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ interpolate: () => (/* binding */ interpolate)\n/* harmony export */ });\n/* harmony import */ var _isSet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isSet */ "./node_modules/i18n-js/dist/import/helpers/isSet.js");\n\nfunction interpolate(i18n, message, options) {\n options = Object.keys(options).reduce((buffer, key) => {\n buffer[i18n.transformKey(key)] = options[key];\n return buffer;\n }, {});\n const matches = message.match(i18n.placeholder);\n if (!matches) {\n return message;\n }\n while (matches.length) {\n let value;\n const placeholder = matches.shift();\n const name = placeholder.replace(i18n.placeholder, "$1");\n if ((0,_isSet__WEBPACK_IMPORTED_MODULE_0__.isSet)(options[name])) {\n value = options[name].toString().replace(/\\$/gm, "_#$#_");\n }\n else if (name in options) {\n value = i18n.nullPlaceholder(i18n, placeholder, message, options);\n }\n else {\n value = i18n.missingPlaceholder(i18n, placeholder, message, options);\n }\n const regex = new RegExp(placeholder.replace(/\\{/gm, "\\\\{").replace(/\\}/gm, "\\\\}"));\n message = message.replace(regex, value);\n }\n return message.replace(/_#\\$#_/g, "$");\n}\n//# sourceMappingURL=interpolate.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/interpolate.js?')},"./node_modules/i18n-js/dist/import/helpers/isSet.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isSet: () => (/* binding */ isSet)\n/* harmony export */ });\nfunction isSet(value) {\n return value !== undefined && value !== null;\n}\n//# sourceMappingURL=isSet.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/isSet.js?")},"./node_modules/i18n-js/dist/import/helpers/lookup.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ lookup: () => (/* binding */ lookup)\n/* harmony export */ });\n/* harmony import */ var _isSet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isSet */ "./node_modules/i18n-js/dist/import/helpers/isSet.js");\n/* harmony import */ var _getFullScope__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./getFullScope */ "./node_modules/i18n-js/dist/import/helpers/getFullScope.js");\n/* harmony import */ var _inferType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./inferType */ "./node_modules/i18n-js/dist/import/helpers/inferType.js");\n\n\n\nfunction lookup(i18n, scope, options = {}) {\n options = Object.assign({}, options);\n const locale = "locale" in options ? options.locale : i18n.locale;\n const localeType = (0,_inferType__WEBPACK_IMPORTED_MODULE_2__.inferType)(locale);\n const locales = i18n.locales\n .get(localeType === "string" ? locale : typeof locale)\n .slice();\n const keys = (0,_getFullScope__WEBPACK_IMPORTED_MODULE_1__.getFullScope)(i18n, scope, options)\n .split(i18n.defaultSeparator)\n .map((component) => i18n.transformKey(component));\n const entries = locales.map((locale) => keys.reduce((path, key) => path && path[key], i18n.translations[locale]));\n entries.push(options.defaultValue);\n return entries.find((entry) => (0,_isSet__WEBPACK_IMPORTED_MODULE_0__.isSet)(entry));\n}\n//# sourceMappingURL=lookup.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/lookup.js?')},"./node_modules/i18n-js/dist/import/helpers/numberToDelimited.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ numberToDelimited: () => (/* binding */ numberToDelimited)\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ "./node_modules/bignumber.js/bignumber.mjs");\n\nfunction numberToDelimited(input, options) {\n const numeric = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"](input);\n if (!numeric.isFinite()) {\n return input.toString();\n }\n if (!options.delimiterPattern.global) {\n throw new Error(`options.delimiterPattern must be a global regular expression; received ${options.delimiterPattern}`);\n }\n let [left, right] = numeric.toString().split(".");\n left = left.replace(options.delimiterPattern, (digitToDelimiter) => `${digitToDelimiter}${options.delimiter}`);\n return [left, right].filter(Boolean).join(options.separator);\n}\n//# sourceMappingURL=numberToDelimited.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/numberToDelimited.js?')},"./node_modules/i18n-js/dist/import/helpers/numberToHuman.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ numberToHuman: () => (/* binding */ numberToHuman)\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ "./node_modules/bignumber.js/bignumber.mjs");\n/* harmony import */ var lodash_sortBy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/sortBy */ "./node_modules/lodash/sortBy.js");\n/* harmony import */ var lodash_sortBy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_sortBy__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash_zipObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/zipObject */ "./node_modules/lodash/zipObject.js");\n/* harmony import */ var lodash_zipObject__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_zipObject__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _getFullScope__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./getFullScope */ "./node_modules/i18n-js/dist/import/helpers/getFullScope.js");\n/* harmony import */ var _lookup__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lookup */ "./node_modules/i18n-js/dist/import/helpers/lookup.js");\n/* harmony import */ var _roundNumber__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./roundNumber */ "./node_modules/i18n-js/dist/import/helpers/roundNumber.js");\n/* harmony import */ var _inferType__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./inferType */ "./node_modules/i18n-js/dist/import/helpers/inferType.js");\n\n\n\n\n\n\n\nconst DECIMAL_UNITS = {\n "0": "unit",\n "1": "ten",\n "2": "hundred",\n "3": "thousand",\n "6": "million",\n "9": "billion",\n "12": "trillion",\n "15": "quadrillion",\n "-1": "deci",\n "-2": "centi",\n "-3": "mili",\n "-6": "micro",\n "-9": "nano",\n "-12": "pico",\n "-15": "femto",\n};\nconst INVERTED_DECIMAL_UNITS = lodash_zipObject__WEBPACK_IMPORTED_MODULE_2___default()(Object.values(DECIMAL_UNITS), Object.keys(DECIMAL_UNITS).map((key) => parseInt(key, 10)));\nfunction numberToHuman(i18n, input, options) {\n const roundOptions = {\n roundMode: options.roundMode,\n precision: options.precision,\n significant: options.significant,\n };\n let units;\n if ((0,_inferType__WEBPACK_IMPORTED_MODULE_6__.inferType)(options.units) === "string") {\n const scope = options.units;\n units = (0,_lookup__WEBPACK_IMPORTED_MODULE_4__.lookup)(i18n, scope);\n if (!units) {\n throw new Error(`The scope "${i18n.locale}${i18n.defaultSeparator}${(0,_getFullScope__WEBPACK_IMPORTED_MODULE_3__.getFullScope)(i18n, scope, {})}" couldn\'t be found`);\n }\n }\n else {\n units = options.units;\n }\n let formattedNumber = (0,_roundNumber__WEBPACK_IMPORTED_MODULE_5__.roundNumber)(new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"](input), roundOptions);\n const unitExponents = (units) => lodash_sortBy__WEBPACK_IMPORTED_MODULE_1___default()(Object.keys(units).map((name) => INVERTED_DECIMAL_UNITS[name]), (numeric) => numeric * -1);\n const calculateExponent = (num, units) => {\n const exponent = num.isZero()\n ? 0\n : Math.floor(Math.log10(num.abs().toNumber()));\n return unitExponents(units).find((exp) => exponent >= exp) || 0;\n };\n const determineUnit = (units, exponent) => {\n const expName = DECIMAL_UNITS[exponent.toString()];\n return units[expName] || "";\n };\n const exponent = calculateExponent(new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"](formattedNumber), units);\n const unit = determineUnit(units, exponent);\n formattedNumber = (0,_roundNumber__WEBPACK_IMPORTED_MODULE_5__.roundNumber)(new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"](formattedNumber).div(Math.pow(10, exponent)), roundOptions);\n if (options.stripInsignificantZeros) {\n let [whole, significand] = formattedNumber.split(".");\n significand = (significand || "").replace(/0+$/, "");\n formattedNumber = whole;\n if (significand) {\n formattedNumber += `${options.separator}${significand}`;\n }\n }\n return options.format\n .replace("%n", formattedNumber || "0")\n .replace("%u", unit)\n .trim();\n}\n//# sourceMappingURL=numberToHuman.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/numberToHuman.js?')},"./node_modules/i18n-js/dist/import/helpers/numberToHumanSize.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ numberToHumanSize: () => (/* binding */ numberToHumanSize)\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ "./node_modules/bignumber.js/bignumber.mjs");\n/* harmony import */ var _roundNumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./roundNumber */ "./node_modules/i18n-js/dist/import/helpers/roundNumber.js");\n/* harmony import */ var _expandRoundMode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./expandRoundMode */ "./node_modules/i18n-js/dist/import/helpers/expandRoundMode.js");\n\n\n\nconst STORAGE_UNITS = ["byte", "kb", "mb", "gb", "tb", "pb", "eb"];\nfunction numberToHumanSize(i18n, input, options) {\n const roundMode = (0,_expandRoundMode__WEBPACK_IMPORTED_MODULE_2__.expandRoundMode)(options.roundMode);\n const base = 1024;\n const num = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"](input).abs();\n const smallerThanBase = num.lt(base);\n let numberToBeFormatted;\n const computeExponent = (numeric, units) => {\n const max = units.length - 1;\n const exp = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"](Math.log(numeric.toNumber()))\n .div(Math.log(base))\n .integerValue(bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"].ROUND_DOWN)\n .toNumber();\n return Math.min(max, exp);\n };\n const storageUnitKey = (units) => {\n const keyEnd = smallerThanBase ? "byte" : units[exponent];\n return `number.human.storage_units.units.${keyEnd}`;\n };\n const exponent = computeExponent(num, STORAGE_UNITS);\n if (smallerThanBase) {\n numberToBeFormatted = num.integerValue();\n }\n else {\n numberToBeFormatted = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"]((0,_roundNumber__WEBPACK_IMPORTED_MODULE_1__.roundNumber)(num.div(Math.pow(base, exponent)), {\n significant: options.significant,\n precision: options.precision,\n roundMode: options.roundMode,\n }));\n }\n const format = i18n.translate("number.human.storage_units.format", {\n defaultValue: "%n %u",\n });\n const unit = i18n.translate(storageUnitKey(STORAGE_UNITS), {\n count: num.integerValue().toNumber(),\n });\n let formattedNumber = numberToBeFormatted.toFixed(options.precision, roundMode);\n if (options.stripInsignificantZeros) {\n formattedNumber = formattedNumber\n .replace(/(\\..*?)0+$/, "$1")\n .replace(/\\.$/, "");\n }\n return format.replace("%n", formattedNumber).replace("%u", unit);\n}\n//# sourceMappingURL=numberToHumanSize.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/numberToHumanSize.js?')},"./node_modules/i18n-js/dist/import/helpers/parseDate.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parseDate: () => (/* binding */ parseDate)\n/* harmony export */ });\nfunction parseDate(input) {\n if (input instanceof Date) {\n return input;\n }\n if (typeof input === "number") {\n const date = new Date();\n date.setTime(input);\n return date;\n }\n const matches = new String(input).match(/(\\d{4})-(\\d{2})-(\\d{2})(?:[ T](\\d{2}):(\\d{2}):(\\d{2})(?:[.,](\\d{1,3}))?)?(Z|\\+00:?00)?/);\n if (matches) {\n const parts = matches.slice(1, 8).map((match) => parseInt(match, 10) || 0);\n parts[1] -= 1;\n const [year, month, day, hour, minute, second, milliseconds] = parts;\n const timezone = matches[8];\n if (timezone) {\n return new Date(Date.UTC(year, month, day, hour, minute, second, milliseconds));\n }\n else {\n return new Date(year, month, day, hour, minute, second, milliseconds);\n }\n }\n if (input.match(/([A-Z][a-z]{2}) ([A-Z][a-z]{2}) (\\d+) (\\d+:\\d+:\\d+) ([+-]\\d+) (\\d+)/)) {\n const date = new Date();\n date.setTime(Date.parse([RegExp.$1, RegExp.$2, RegExp.$3, RegExp.$6, RegExp.$4, RegExp.$5].join(" ")));\n }\n const date = new Date();\n date.setTime(Date.parse(input));\n return date;\n}\n//# sourceMappingURL=parseDate.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/parseDate.js?')},"./node_modules/i18n-js/dist/import/helpers/pluralize.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ pluralize: () => (/* binding */ pluralize)\n/* harmony export */ });\n/* harmony import */ var _isSet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isSet */ "./node_modules/i18n-js/dist/import/helpers/isSet.js");\n/* harmony import */ var _lookup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lookup */ "./node_modules/i18n-js/dist/import/helpers/lookup.js");\n\n\nfunction pluralize({ i18n, count, scope, options, baseScope, }) {\n options = Object.assign({}, options);\n let translations;\n let message;\n if (typeof scope === "object" && scope) {\n translations = scope;\n }\n else {\n translations = (0,_lookup__WEBPACK_IMPORTED_MODULE_1__.lookup)(i18n, scope, options);\n }\n if (!translations) {\n return i18n.missingTranslation.get(scope, options);\n }\n const pluralizer = i18n.pluralization.get(options.locale);\n const keys = pluralizer(i18n, count);\n const missingKeys = [];\n while (keys.length) {\n const key = keys.shift();\n if ((0,_isSet__WEBPACK_IMPORTED_MODULE_0__.isSet)(translations[key])) {\n message = translations[key];\n break;\n }\n missingKeys.push(key);\n }\n if (!(0,_isSet__WEBPACK_IMPORTED_MODULE_0__.isSet)(message)) {\n return i18n.missingTranslation.get(baseScope.split(i18n.defaultSeparator).concat([missingKeys[0]]), options);\n }\n options.count = count;\n return i18n.interpolate(i18n, message, options);\n}\n//# sourceMappingURL=pluralize.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/pluralize.js?')},"./node_modules/i18n-js/dist/import/helpers/roundNumber.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ roundNumber: () => (/* binding */ roundNumber)\n/* harmony export */ });\n/* harmony import */ var bignumber_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bignumber.js */ "./node_modules/bignumber.js/bignumber.mjs");\n/* harmony import */ var _expandRoundMode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./expandRoundMode */ "./node_modules/i18n-js/dist/import/helpers/expandRoundMode.js");\n\n\nfunction digitCount(numeric) {\n if (numeric.isZero()) {\n return 1;\n }\n return Math.floor(Math.log10(numeric.abs().toNumber()) + 1);\n}\nfunction getAbsolutePrecision(numeric, { precision, significant }) {\n if (significant && precision !== null && precision > 0) {\n return precision - digitCount(numeric);\n }\n return precision;\n}\nfunction roundNumber(numeric, options) {\n const precision = getAbsolutePrecision(numeric, options);\n if (precision === null) {\n return numeric.toString();\n }\n const roundMode = (0,_expandRoundMode__WEBPACK_IMPORTED_MODULE_1__.expandRoundMode)(options.roundMode);\n if (precision >= 0) {\n return numeric.toFixed(precision, roundMode);\n }\n const rounder = Math.pow(10, Math.abs(precision));\n numeric = new bignumber_js__WEBPACK_IMPORTED_MODULE_0__["default"](numeric.div(rounder).toFixed(0, roundMode)).times(rounder);\n return numeric.toString();\n}\n//# sourceMappingURL=roundNumber.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/roundNumber.js?')},"./node_modules/i18n-js/dist/import/helpers/strftime.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ strftime: () => (/* binding */ strftime)\n/* harmony export */ });\nconst DEFAULT_OPTIONS = {\n meridian: { am: "AM", pm: "PM" },\n dayNames: [\n "Sunday",\n "Monday",\n "Tuesday",\n "Wednesday",\n "Thursday",\n "Friday",\n "Saturday",\n ],\n abbrDayNames: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],\n monthNames: [\n null,\n "January",\n "February",\n "March",\n "April",\n "May",\n "June",\n "July",\n "August",\n "September",\n "October",\n "November",\n "December",\n ],\n abbrMonthNames: [\n null,\n "Jan",\n "Feb",\n "Mar",\n "Apr",\n "May",\n "Jun",\n "Jul",\n "Aug",\n "Sep",\n "Oct",\n "Nov",\n "Dec",\n ],\n};\nfunction strftime(date, format, options = {}) {\n const { abbrDayNames, dayNames, abbrMonthNames, monthNames, meridian: AM_PM, } = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);\n if (isNaN(date.getTime())) {\n throw new Error("strftime() requires a valid date object, but received an invalid date.");\n }\n const weekDay = date.getDay();\n const day = date.getDate();\n const year = date.getFullYear();\n const month = date.getMonth() + 1;\n const hour = date.getHours();\n let hour12 = hour;\n const meridian = hour > 11 ? "pm" : "am";\n const secs = date.getSeconds();\n const mins = date.getMinutes();\n const offset = date.getTimezoneOffset();\n const absOffsetHours = Math.floor(Math.abs(offset / 60));\n const absOffsetMinutes = Math.abs(offset) - absOffsetHours * 60;\n const timezoneoffset = (offset > 0 ? "-" : "+") +\n (absOffsetHours.toString().length < 2\n ? "0" + absOffsetHours\n : absOffsetHours) +\n (absOffsetMinutes.toString().length < 2\n ? "0" + absOffsetMinutes\n : absOffsetMinutes);\n if (hour12 > 12) {\n hour12 = hour12 - 12;\n }\n else if (hour12 === 0) {\n hour12 = 12;\n }\n format = format.replace("%a", abbrDayNames[weekDay]);\n format = format.replace("%A", dayNames[weekDay]);\n format = format.replace("%b", abbrMonthNames[month]);\n format = format.replace("%B", monthNames[month]);\n format = format.replace("%d", day.toString().padStart(2, "0"));\n format = format.replace("%e", day.toString());\n format = format.replace("%-d", day.toString());\n format = format.replace("%H", hour.toString().padStart(2, "0"));\n format = format.replace("%-H", hour.toString());\n format = format.replace("%k", hour.toString());\n format = format.replace("%I", hour12.toString().padStart(2, "0"));\n format = format.replace("%-I", hour12.toString());\n format = format.replace("%l", hour12.toString());\n format = format.replace("%m", month.toString().padStart(2, "0"));\n format = format.replace("%-m", month.toString());\n format = format.replace("%M", mins.toString().padStart(2, "0"));\n format = format.replace("%-M", mins.toString());\n format = format.replace("%p", AM_PM[meridian]);\n format = format.replace("%P", AM_PM[meridian].toLowerCase());\n format = format.replace("%S", secs.toString().padStart(2, "0"));\n format = format.replace("%-S", secs.toString());\n format = format.replace("%w", weekDay.toString());\n format = format.replace("%y", year.toString().padStart(2, "0").substr(-2));\n format = format.replace("%-y", year.toString().padStart(2, "0").substr(-2).replace(/^0+/, ""));\n format = format.replace("%Y", year.toString());\n format = format.replace(/%z/i, timezoneoffset);\n return format;\n}\n//# sourceMappingURL=strftime.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/strftime.js?')},"./node_modules/i18n-js/dist/import/helpers/timeAgoInWords.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ timeAgoInWords: () => (/* binding */ timeAgoInWords)\n/* harmony export */ });\n/* harmony import */ var lodash_range__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/range */ "./node_modules/lodash/range.js");\n/* harmony import */ var lodash_range__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_range__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _parseDate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parseDate */ "./node_modules/i18n-js/dist/import/helpers/parseDate.js");\n\n\nconst within = (start, end, actual) => actual >= start && actual <= end;\nfunction timeAgoInWords(i18n, fromTime, toTime, options = {}) {\n const scope = options.scope || "datetime.distance_in_words";\n const t = (name, count = 0) => i18n.t(name, { count, scope });\n fromTime = (0,_parseDate__WEBPACK_IMPORTED_MODULE_1__.parseDate)(fromTime);\n toTime = (0,_parseDate__WEBPACK_IMPORTED_MODULE_1__.parseDate)(toTime);\n let fromInSeconds = fromTime.getTime() / 1000;\n let toInSeconds = toTime.getTime() / 1000;\n if (fromInSeconds > toInSeconds) {\n [fromTime, toTime, fromInSeconds, toInSeconds] = [\n toTime,\n fromTime,\n toInSeconds,\n fromInSeconds,\n ];\n }\n const distanceInSeconds = Math.round(toInSeconds - fromInSeconds);\n const distanceInMinutes = Math.round((toInSeconds - fromInSeconds) / 60);\n const distanceInHours = distanceInMinutes / 60;\n const distanceInDays = distanceInHours / 24;\n const distanceInHoursRounded = Math.round(distanceInMinutes / 60);\n const distanceInDaysRounded = Math.round(distanceInDays);\n const distanceInMonthsRounded = Math.round(distanceInDaysRounded / 30);\n if (within(0, 1, distanceInMinutes)) {\n if (!options.includeSeconds) {\n return distanceInMinutes === 0\n ? t("less_than_x_minutes", 1)\n : t("x_minutes", distanceInMinutes);\n }\n if (within(0, 4, distanceInSeconds)) {\n return t("less_than_x_seconds", 5);\n }\n if (within(5, 9, distanceInSeconds)) {\n return t("less_than_x_seconds", 10);\n }\n if (within(10, 19, distanceInSeconds)) {\n return t("less_than_x_seconds", 20);\n }\n if (within(20, 39, distanceInSeconds)) {\n return t("half_a_minute");\n }\n if (within(40, 59, distanceInSeconds)) {\n return t("less_than_x_minutes", 1);\n }\n return t("x_minutes", 1);\n }\n if (within(2, 44, distanceInMinutes)) {\n return t("x_minutes", distanceInMinutes);\n }\n if (within(45, 89, distanceInMinutes)) {\n return t("about_x_hours", 1);\n }\n if (within(90, 1439, distanceInMinutes)) {\n return t("about_x_hours", distanceInHoursRounded);\n }\n if (within(1440, 2519, distanceInMinutes)) {\n return t("x_days", 1);\n }\n if (within(2520, 43199, distanceInMinutes)) {\n return t("x_days", distanceInDaysRounded);\n }\n if (within(43200, 86399, distanceInMinutes)) {\n return t("about_x_months", Math.round(distanceInMinutes / 43200));\n }\n if (within(86400, 525599, distanceInMinutes)) {\n return t("x_months", distanceInMonthsRounded);\n }\n let fromYear = fromTime.getFullYear();\n if (fromTime.getMonth() + 1 >= 3) {\n fromYear += 1;\n }\n let toYear = toTime.getFullYear();\n if (toTime.getMonth() + 1 < 3) {\n toYear -= 1;\n }\n const leapYears = fromYear > toYear\n ? 0\n : lodash_range__WEBPACK_IMPORTED_MODULE_0___default()(fromYear, toYear).filter((year) => new Date(year, 1, 29).getMonth() == 1).length;\n const minutesInYear = 525600;\n const minuteOffsetForLeapYear = leapYears * 1440;\n const minutesWithOffset = distanceInMinutes - minuteOffsetForLeapYear;\n const distanceInYears = Math.trunc(minutesWithOffset / minutesInYear);\n const diff = parseFloat((minutesWithOffset / minutesInYear - distanceInYears).toPrecision(3));\n if (diff < 0.25) {\n return t("about_x_years", distanceInYears);\n }\n if (diff < 0.75) {\n return t("over_x_years", distanceInYears);\n }\n return t("almost_x_years", distanceInYears + 1);\n}\n//# sourceMappingURL=timeAgoInWords.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/helpers/timeAgoInWords.js?')},"./node_modules/i18n-js/dist/import/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ I18n: () => (/* reexport safe */ _I18n__WEBPACK_IMPORTED_MODULE_0__.I18n),\n/* harmony export */ Locales: () => (/* reexport safe */ _Locales__WEBPACK_IMPORTED_MODULE_1__.Locales),\n/* harmony export */ MissingTranslation: () => (/* reexport safe */ _MissingTranslation__WEBPACK_IMPORTED_MODULE_2__.MissingTranslation),\n/* harmony export */ Pluralization: () => (/* reexport safe */ _Pluralization__WEBPACK_IMPORTED_MODULE_3__.Pluralization),\n/* harmony export */ useMakePlural: () => (/* reexport safe */ _Pluralization__WEBPACK_IMPORTED_MODULE_3__.useMakePlural)\n/* harmony export */ });\n/* harmony import */ var _I18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./I18n */ "./node_modules/i18n-js/dist/import/I18n.js");\n/* harmony import */ var _Locales__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Locales */ "./node_modules/i18n-js/dist/import/Locales.js");\n/* harmony import */ var _MissingTranslation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./MissingTranslation */ "./node_modules/i18n-js/dist/import/MissingTranslation.js");\n/* harmony import */ var _Pluralization__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Pluralization */ "./node_modules/i18n-js/dist/import/Pluralization.js");\n/* harmony import */ var _typing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./typing */ "./node_modules/i18n-js/dist/import/typing.js");\n\n\n\n\n\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/index.js?')},"./node_modules/i18n-js/dist/import/typing.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n\n//# sourceMappingURL=typing.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/i18n-js/dist/import/typing.js?")},"./node_modules/lodash/_DataView.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getNative = __webpack_require__(/*! ./_getNative */ "./node_modules/lodash/_getNative.js"),\n root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, \'DataView\');\n\nmodule.exports = DataView;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_DataView.js?')},"./node_modules/lodash/_Hash.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var hashClear = __webpack_require__(/*! ./_hashClear */ "./node_modules/lodash/_hashClear.js"),\n hashDelete = __webpack_require__(/*! ./_hashDelete */ "./node_modules/lodash/_hashDelete.js"),\n hashGet = __webpack_require__(/*! ./_hashGet */ "./node_modules/lodash/_hashGet.js"),\n hashHas = __webpack_require__(/*! ./_hashHas */ "./node_modules/lodash/_hashHas.js"),\n hashSet = __webpack_require__(/*! ./_hashSet */ "./node_modules/lodash/_hashSet.js");\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype[\'delete\'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_Hash.js?')},"./node_modules/lodash/_ListCache.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "./node_modules/lodash/_listCacheClear.js"),\n listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "./node_modules/lodash/_listCacheDelete.js"),\n listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "./node_modules/lodash/_listCacheGet.js"),\n listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "./node_modules/lodash/_listCacheHas.js"),\n listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "./node_modules/lodash/_listCacheSet.js");\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype[\'delete\'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_ListCache.js?')},"./node_modules/lodash/_Map.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getNative = __webpack_require__(/*! ./_getNative */ "./node_modules/lodash/_getNative.js"),\n root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, \'Map\');\n\nmodule.exports = Map;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_Map.js?')},"./node_modules/lodash/_MapCache.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var mapCacheClear = __webpack_require__(/*! ./_mapCacheClear */ "./node_modules/lodash/_mapCacheClear.js"),\n mapCacheDelete = __webpack_require__(/*! ./_mapCacheDelete */ "./node_modules/lodash/_mapCacheDelete.js"),\n mapCacheGet = __webpack_require__(/*! ./_mapCacheGet */ "./node_modules/lodash/_mapCacheGet.js"),\n mapCacheHas = __webpack_require__(/*! ./_mapCacheHas */ "./node_modules/lodash/_mapCacheHas.js"),\n mapCacheSet = __webpack_require__(/*! ./_mapCacheSet */ "./node_modules/lodash/_mapCacheSet.js");\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype[\'delete\'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_MapCache.js?')},"./node_modules/lodash/_Promise.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getNative = __webpack_require__(/*! ./_getNative */ "./node_modules/lodash/_getNative.js"),\n root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, \'Promise\');\n\nmodule.exports = Promise;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_Promise.js?')},"./node_modules/lodash/_Set.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getNative = __webpack_require__(/*! ./_getNative */ "./node_modules/lodash/_getNative.js"),\n root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, \'Set\');\n\nmodule.exports = Set;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_Set.js?')},"./node_modules/lodash/_SetCache.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var MapCache = __webpack_require__(/*! ./_MapCache */ "./node_modules/lodash/_MapCache.js"),\n setCacheAdd = __webpack_require__(/*! ./_setCacheAdd */ "./node_modules/lodash/_setCacheAdd.js"),\n setCacheHas = __webpack_require__(/*! ./_setCacheHas */ "./node_modules/lodash/_setCacheHas.js");\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nmodule.exports = SetCache;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_SetCache.js?')},"./node_modules/lodash/_Stack.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var ListCache = __webpack_require__(/*! ./_ListCache */ "./node_modules/lodash/_ListCache.js"),\n stackClear = __webpack_require__(/*! ./_stackClear */ "./node_modules/lodash/_stackClear.js"),\n stackDelete = __webpack_require__(/*! ./_stackDelete */ "./node_modules/lodash/_stackDelete.js"),\n stackGet = __webpack_require__(/*! ./_stackGet */ "./node_modules/lodash/_stackGet.js"),\n stackHas = __webpack_require__(/*! ./_stackHas */ "./node_modules/lodash/_stackHas.js"),\n stackSet = __webpack_require__(/*! ./_stackSet */ "./node_modules/lodash/_stackSet.js");\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype[\'delete\'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nmodule.exports = Stack;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_Stack.js?')},"./node_modules/lodash/_Symbol.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_Symbol.js?')},"./node_modules/lodash/_Uint8Array.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nmodule.exports = Uint8Array;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_Uint8Array.js?')},"./node_modules/lodash/_WeakMap.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getNative = __webpack_require__(/*! ./_getNative */ "./node_modules/lodash/_getNative.js"),\n root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, \'WeakMap\');\n\nmodule.exports = WeakMap;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_WeakMap.js?')},"./node_modules/lodash/_apply.js":module=>{eval("/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nmodule.exports = apply;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_apply.js?")},"./node_modules/lodash/_arrayFilter.js":module=>{eval("/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_arrayFilter.js?")},"./node_modules/lodash/_arrayIncludes.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseIndexOf = __webpack_require__(/*! ./_baseIndexOf */ "./node_modules/lodash/_baseIndexOf.js");\n\n/**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n}\n\nmodule.exports = arrayIncludes;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_arrayIncludes.js?')},"./node_modules/lodash/_arrayIncludesWith.js":module=>{eval("/**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arrayIncludesWith;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_arrayIncludesWith.js?")},"./node_modules/lodash/_arrayLikeKeys.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseTimes = __webpack_require__(/*! ./_baseTimes */ \"./node_modules/lodash/_baseTimes.js\"),\n isArguments = __webpack_require__(/*! ./isArguments */ \"./node_modules/lodash/isArguments.js\"),\n isArray = __webpack_require__(/*! ./isArray */ \"./node_modules/lodash/isArray.js\"),\n isBuffer = __webpack_require__(/*! ./isBuffer */ \"./node_modules/lodash/isBuffer.js\"),\n isIndex = __webpack_require__(/*! ./_isIndex */ \"./node_modules/lodash/_isIndex.js\"),\n isTypedArray = __webpack_require__(/*! ./isTypedArray */ \"./node_modules/lodash/isTypedArray.js\");\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = arrayLikeKeys;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_arrayLikeKeys.js?")},"./node_modules/lodash/_arrayMap.js":module=>{eval("/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nmodule.exports = arrayMap;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_arrayMap.js?")},"./node_modules/lodash/_arrayPush.js":module=>{eval("/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_arrayPush.js?")},"./node_modules/lodash/_arrayReduce.js":module=>{eval("/**\n * A specialized version of `_.reduce` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initAccum] Specify using the first element of `array` as\n * the initial value.\n * @returns {*} Returns the accumulated value.\n */\nfunction arrayReduce(array, iteratee, accumulator, initAccum) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n if (initAccum && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n}\n\nmodule.exports = arrayReduce;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_arrayReduce.js?")},"./node_modules/lodash/_arraySome.js":module=>{eval("/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arraySome;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_arraySome.js?")},"./node_modules/lodash/_asciiToArray.js":module=>{eval("/**\n * Converts an ASCII `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction asciiToArray(string) {\n return string.split('');\n}\n\nmodule.exports = asciiToArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_asciiToArray.js?")},"./node_modules/lodash/_asciiWords.js":module=>{eval("/** Used to match words composed of alphanumeric characters. */\nvar reAsciiWord = /[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g;\n\n/**\n * Splits an ASCII `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\nfunction asciiWords(string) {\n return string.match(reAsciiWord) || [];\n}\n\nmodule.exports = asciiWords;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_asciiWords.js?")},"./node_modules/lodash/_assignMergeValue.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseAssignValue = __webpack_require__(/*! ./_baseAssignValue */ "./node_modules/lodash/_baseAssignValue.js"),\n eq = __webpack_require__(/*! ./eq */ "./node_modules/lodash/eq.js");\n\n/**\n * This function is like `assignValue` except that it doesn\'t assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignMergeValue;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_assignMergeValue.js?')},"./node_modules/lodash/_assignValue.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseAssignValue = __webpack_require__(/*! ./_baseAssignValue */ "./node_modules/lodash/_baseAssignValue.js"),\n eq = __webpack_require__(/*! ./eq */ "./node_modules/lodash/eq.js");\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignValue;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_assignValue.js?')},"./node_modules/lodash/_assocIndexOf.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var eq = __webpack_require__(/*! ./eq */ "./node_modules/lodash/eq.js");\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_assocIndexOf.js?')},"./node_modules/lodash/_baseAssignValue.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var defineProperty = __webpack_require__(/*! ./_defineProperty */ \"./node_modules/lodash/_defineProperty.js\");\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseAssignValue.js?")},"./node_modules/lodash/_baseCreate.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js");\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nmodule.exports = baseCreate;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseCreate.js?')},"./node_modules/lodash/_baseEach.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseForOwn = __webpack_require__(/*! ./_baseForOwn */ "./node_modules/lodash/_baseForOwn.js"),\n createBaseEach = __webpack_require__(/*! ./_createBaseEach */ "./node_modules/lodash/_createBaseEach.js");\n\n/**\n * The base implementation of `_.forEach` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object} Returns `collection`.\n */\nvar baseEach = createBaseEach(baseForOwn);\n\nmodule.exports = baseEach;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseEach.js?')},"./node_modules/lodash/_baseFindIndex.js":module=>{eval("/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = baseFindIndex;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseFindIndex.js?")},"./node_modules/lodash/_baseFlatten.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var arrayPush = __webpack_require__(/*! ./_arrayPush */ "./node_modules/lodash/_arrayPush.js"),\n isFlattenable = __webpack_require__(/*! ./_isFlattenable */ "./node_modules/lodash/_isFlattenable.js");\n\n/**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\nmodule.exports = baseFlatten;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseFlatten.js?')},"./node_modules/lodash/_baseFor.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var createBaseFor = __webpack_require__(/*! ./_createBaseFor */ "./node_modules/lodash/_createBaseFor.js");\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseFor.js?')},"./node_modules/lodash/_baseForOwn.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseFor = __webpack_require__(/*! ./_baseFor */ "./node_modules/lodash/_baseFor.js"),\n keys = __webpack_require__(/*! ./keys */ "./node_modules/lodash/keys.js");\n\n/**\n * The base implementation of `_.forOwn` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\nfunction baseForOwn(object, iteratee) {\n return object && baseFor(object, iteratee, keys);\n}\n\nmodule.exports = baseForOwn;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseForOwn.js?')},"./node_modules/lodash/_baseGet.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var castPath = __webpack_require__(/*! ./_castPath */ "./node_modules/lodash/_castPath.js"),\n toKey = __webpack_require__(/*! ./_toKey */ "./node_modules/lodash/_toKey.js");\n\n/**\n * The base implementation of `_.get` without support for default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path) {\n path = castPath(path, object);\n\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[toKey(path[index++])];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseGet.js?')},"./node_modules/lodash/_baseGetAllKeys.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var arrayPush = __webpack_require__(/*! ./_arrayPush */ "./node_modules/lodash/_arrayPush.js"),\n isArray = __webpack_require__(/*! ./isArray */ "./node_modules/lodash/isArray.js");\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseGetAllKeys.js?')},"./node_modules/lodash/_baseGetTag.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var Symbol = __webpack_require__(/*! ./_Symbol */ "./node_modules/lodash/_Symbol.js"),\n getRawTag = __webpack_require__(/*! ./_getRawTag */ "./node_modules/lodash/_getRawTag.js"),\n objectToString = __webpack_require__(/*! ./_objectToString */ "./node_modules/lodash/_objectToString.js");\n\n/** `Object#toString` result references. */\nvar nullTag = \'[object Null]\',\n undefinedTag = \'[object Undefined]\';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseGetTag.js?')},"./node_modules/lodash/_baseHas.js":module=>{eval("/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHas(object, key) {\n return object != null && hasOwnProperty.call(object, key);\n}\n\nmodule.exports = baseHas;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseHas.js?")},"./node_modules/lodash/_baseHasIn.js":module=>{eval("/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nmodule.exports = baseHasIn;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseHasIn.js?")},"./node_modules/lodash/_baseIndexOf.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseFindIndex = __webpack_require__(/*! ./_baseFindIndex */ "./node_modules/lodash/_baseFindIndex.js"),\n baseIsNaN = __webpack_require__(/*! ./_baseIsNaN */ "./node_modules/lodash/_baseIsNaN.js"),\n strictIndexOf = __webpack_require__(/*! ./_strictIndexOf */ "./node_modules/lodash/_strictIndexOf.js");\n\n/**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n}\n\nmodule.exports = baseIndexOf;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseIndexOf.js?')},"./node_modules/lodash/_baseIsArguments.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "./node_modules/lodash/_baseGetTag.js"),\n isObjectLike = __webpack_require__(/*! ./isObjectLike */ "./node_modules/lodash/isObjectLike.js");\n\n/** `Object#toString` result references. */\nvar argsTag = \'[object Arguments]\';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseIsArguments.js?')},"./node_modules/lodash/_baseIsEqual.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseIsEqualDeep = __webpack_require__(/*! ./_baseIsEqualDeep */ "./node_modules/lodash/_baseIsEqualDeep.js"),\n isObjectLike = __webpack_require__(/*! ./isObjectLike */ "./node_modules/lodash/isObjectLike.js");\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nmodule.exports = baseIsEqual;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseIsEqual.js?')},"./node_modules/lodash/_baseIsEqualDeep.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var Stack = __webpack_require__(/*! ./_Stack */ "./node_modules/lodash/_Stack.js"),\n equalArrays = __webpack_require__(/*! ./_equalArrays */ "./node_modules/lodash/_equalArrays.js"),\n equalByTag = __webpack_require__(/*! ./_equalByTag */ "./node_modules/lodash/_equalByTag.js"),\n equalObjects = __webpack_require__(/*! ./_equalObjects */ "./node_modules/lodash/_equalObjects.js"),\n getTag = __webpack_require__(/*! ./_getTag */ "./node_modules/lodash/_getTag.js"),\n isArray = __webpack_require__(/*! ./isArray */ "./node_modules/lodash/isArray.js"),\n isBuffer = __webpack_require__(/*! ./isBuffer */ "./node_modules/lodash/isBuffer.js"),\n isTypedArray = __webpack_require__(/*! ./isTypedArray */ "./node_modules/lodash/isTypedArray.js");\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = \'[object Arguments]\',\n arrayTag = \'[object Array]\',\n objectTag = \'[object Object]\';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, \'__wrapped__\'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, \'__wrapped__\');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nmodule.exports = baseIsEqualDeep;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseIsEqualDeep.js?')},"./node_modules/lodash/_baseIsMatch.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var Stack = __webpack_require__(/*! ./_Stack */ "./node_modules/lodash/_Stack.js"),\n baseIsEqual = __webpack_require__(/*! ./_baseIsEqual */ "./node_modules/lodash/_baseIsEqual.js");\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.isMatch` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Array} matchData The property names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparisons.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\nfunction baseIsMatch(object, source, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = Object(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var stack = new Stack;\n if (customizer) {\n var result = customizer(objValue, srcValue, key, object, source, stack);\n }\n if (!(result === undefined\n ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)\n : result\n )) {\n return false;\n }\n }\n }\n return true;\n}\n\nmodule.exports = baseIsMatch;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseIsMatch.js?')},"./node_modules/lodash/_baseIsNaN.js":module=>{eval("/**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\nfunction baseIsNaN(value) {\n return value !== value;\n}\n\nmodule.exports = baseIsNaN;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseIsNaN.js?")},"./node_modules/lodash/_baseIsNative.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var isFunction = __webpack_require__(/*! ./isFunction */ \"./node_modules/lodash/isFunction.js\"),\n isMasked = __webpack_require__(/*! ./_isMasked */ \"./node_modules/lodash/_isMasked.js\"),\n isObject = __webpack_require__(/*! ./isObject */ \"./node_modules/lodash/isObject.js\"),\n toSource = __webpack_require__(/*! ./_toSource */ \"./node_modules/lodash/_toSource.js\");\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseIsNative.js?")},"./node_modules/lodash/_baseIsTypedArray.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ \"./node_modules/lodash/_baseGetTag.js\"),\n isLength = __webpack_require__(/*! ./isLength */ \"./node_modules/lodash/isLength.js\"),\n isObjectLike = __webpack_require__(/*! ./isObjectLike */ \"./node_modules/lodash/isObjectLike.js\");\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nmodule.exports = baseIsTypedArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseIsTypedArray.js?")},"./node_modules/lodash/_baseIteratee.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseMatches = __webpack_require__(/*! ./_baseMatches */ "./node_modules/lodash/_baseMatches.js"),\n baseMatchesProperty = __webpack_require__(/*! ./_baseMatchesProperty */ "./node_modules/lodash/_baseMatchesProperty.js"),\n identity = __webpack_require__(/*! ./identity */ "./node_modules/lodash/identity.js"),\n isArray = __webpack_require__(/*! ./isArray */ "./node_modules/lodash/isArray.js"),\n property = __webpack_require__(/*! ./property */ "./node_modules/lodash/property.js");\n\n/**\n * The base implementation of `_.iteratee`.\n *\n * @private\n * @param {*} [value=_.identity] The value to convert to an iteratee.\n * @returns {Function} Returns the iteratee.\n */\nfunction baseIteratee(value) {\n // Don\'t store the `typeof` result in a variable to avoid a JIT bug in Safari 9.\n // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.\n if (typeof value == \'function\') {\n return value;\n }\n if (value == null) {\n return identity;\n }\n if (typeof value == \'object\') {\n return isArray(value)\n ? baseMatchesProperty(value[0], value[1])\n : baseMatches(value);\n }\n return property(value);\n}\n\nmodule.exports = baseIteratee;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseIteratee.js?')},"./node_modules/lodash/_baseKeys.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isPrototype = __webpack_require__(/*! ./_isPrototype */ "./node_modules/lodash/_isPrototype.js"),\n nativeKeys = __webpack_require__(/*! ./_nativeKeys */ "./node_modules/lodash/_nativeKeys.js");\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn\'t treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != \'constructor\') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseKeys.js?')},"./node_modules/lodash/_baseKeysIn.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js"),\n isPrototype = __webpack_require__(/*! ./_isPrototype */ "./node_modules/lodash/_isPrototype.js"),\n nativeKeysIn = __webpack_require__(/*! ./_nativeKeysIn */ "./node_modules/lodash/_nativeKeysIn.js");\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn\'t treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == \'constructor\' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeysIn;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseKeysIn.js?')},"./node_modules/lodash/_baseMap.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseEach = __webpack_require__(/*! ./_baseEach */ "./node_modules/lodash/_baseEach.js"),\n isArrayLike = __webpack_require__(/*! ./isArrayLike */ "./node_modules/lodash/isArrayLike.js");\n\n/**\n * The base implementation of `_.map` without support for iteratee shorthands.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n}\n\nmodule.exports = baseMap;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseMap.js?')},"./node_modules/lodash/_baseMatches.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseIsMatch = __webpack_require__(/*! ./_baseIsMatch */ "./node_modules/lodash/_baseIsMatch.js"),\n getMatchData = __webpack_require__(/*! ./_getMatchData */ "./node_modules/lodash/_getMatchData.js"),\n matchesStrictComparable = __webpack_require__(/*! ./_matchesStrictComparable */ "./node_modules/lodash/_matchesStrictComparable.js");\n\n/**\n * The base implementation of `_.matches` which doesn\'t clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n return matchesStrictComparable(matchData[0][0], matchData[0][1]);\n }\n return function(object) {\n return object === source || baseIsMatch(object, source, matchData);\n };\n}\n\nmodule.exports = baseMatches;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseMatches.js?')},"./node_modules/lodash/_baseMatchesProperty.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseIsEqual = __webpack_require__(/*! ./_baseIsEqual */ "./node_modules/lodash/_baseIsEqual.js"),\n get = __webpack_require__(/*! ./get */ "./node_modules/lodash/get.js"),\n hasIn = __webpack_require__(/*! ./hasIn */ "./node_modules/lodash/hasIn.js"),\n isKey = __webpack_require__(/*! ./_isKey */ "./node_modules/lodash/_isKey.js"),\n isStrictComparable = __webpack_require__(/*! ./_isStrictComparable */ "./node_modules/lodash/_isStrictComparable.js"),\n matchesStrictComparable = __webpack_require__(/*! ./_matchesStrictComparable */ "./node_modules/lodash/_matchesStrictComparable.js"),\n toKey = __webpack_require__(/*! ./_toKey */ "./node_modules/lodash/_toKey.js");\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * The base implementation of `_.matchesProperty` which doesn\'t clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction baseMatchesProperty(path, srcValue) {\n if (isKey(path) && isStrictComparable(srcValue)) {\n return matchesStrictComparable(toKey(path), srcValue);\n }\n return function(object) {\n var objValue = get(object, path);\n return (objValue === undefined && objValue === srcValue)\n ? hasIn(object, path)\n : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);\n };\n}\n\nmodule.exports = baseMatchesProperty;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseMatchesProperty.js?')},"./node_modules/lodash/_baseMerge.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var Stack = __webpack_require__(/*! ./_Stack */ "./node_modules/lodash/_Stack.js"),\n assignMergeValue = __webpack_require__(/*! ./_assignMergeValue */ "./node_modules/lodash/_assignMergeValue.js"),\n baseFor = __webpack_require__(/*! ./_baseFor */ "./node_modules/lodash/_baseFor.js"),\n baseMergeDeep = __webpack_require__(/*! ./_baseMergeDeep */ "./node_modules/lodash/_baseMergeDeep.js"),\n isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js"),\n keysIn = __webpack_require__(/*! ./keysIn */ "./node_modules/lodash/keysIn.js"),\n safeGet = __webpack_require__(/*! ./_safeGet */ "./node_modules/lodash/_safeGet.js");\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + \'\'), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\nmodule.exports = baseMerge;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseMerge.js?')},"./node_modules/lodash/_baseMergeDeep.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var assignMergeValue = __webpack_require__(/*! ./_assignMergeValue */ "./node_modules/lodash/_assignMergeValue.js"),\n cloneBuffer = __webpack_require__(/*! ./_cloneBuffer */ "./node_modules/lodash/_cloneBuffer.js"),\n cloneTypedArray = __webpack_require__(/*! ./_cloneTypedArray */ "./node_modules/lodash/_cloneTypedArray.js"),\n copyArray = __webpack_require__(/*! ./_copyArray */ "./node_modules/lodash/_copyArray.js"),\n initCloneObject = __webpack_require__(/*! ./_initCloneObject */ "./node_modules/lodash/_initCloneObject.js"),\n isArguments = __webpack_require__(/*! ./isArguments */ "./node_modules/lodash/isArguments.js"),\n isArray = __webpack_require__(/*! ./isArray */ "./node_modules/lodash/isArray.js"),\n isArrayLikeObject = __webpack_require__(/*! ./isArrayLikeObject */ "./node_modules/lodash/isArrayLikeObject.js"),\n isBuffer = __webpack_require__(/*! ./isBuffer */ "./node_modules/lodash/isBuffer.js"),\n isFunction = __webpack_require__(/*! ./isFunction */ "./node_modules/lodash/isFunction.js"),\n isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js"),\n isPlainObject = __webpack_require__(/*! ./isPlainObject */ "./node_modules/lodash/isPlainObject.js"),\n isTypedArray = __webpack_require__(/*! ./isTypedArray */ "./node_modules/lodash/isTypedArray.js"),\n safeGet = __webpack_require__(/*! ./_safeGet */ "./node_modules/lodash/_safeGet.js"),\n toPlainObject = __webpack_require__(/*! ./toPlainObject */ "./node_modules/lodash/toPlainObject.js");\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + \'\'), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack[\'delete\'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\nmodule.exports = baseMergeDeep;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseMergeDeep.js?')},"./node_modules/lodash/_baseOrderBy.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var arrayMap = __webpack_require__(/*! ./_arrayMap */ "./node_modules/lodash/_arrayMap.js"),\n baseGet = __webpack_require__(/*! ./_baseGet */ "./node_modules/lodash/_baseGet.js"),\n baseIteratee = __webpack_require__(/*! ./_baseIteratee */ "./node_modules/lodash/_baseIteratee.js"),\n baseMap = __webpack_require__(/*! ./_baseMap */ "./node_modules/lodash/_baseMap.js"),\n baseSortBy = __webpack_require__(/*! ./_baseSortBy */ "./node_modules/lodash/_baseSortBy.js"),\n baseUnary = __webpack_require__(/*! ./_baseUnary */ "./node_modules/lodash/_baseUnary.js"),\n compareMultiple = __webpack_require__(/*! ./_compareMultiple */ "./node_modules/lodash/_compareMultiple.js"),\n identity = __webpack_require__(/*! ./identity */ "./node_modules/lodash/identity.js"),\n isArray = __webpack_require__(/*! ./isArray */ "./node_modules/lodash/isArray.js");\n\n/**\n * The base implementation of `_.orderBy` without param guards.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {string[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\nfunction baseOrderBy(collection, iteratees, orders) {\n if (iteratees.length) {\n iteratees = arrayMap(iteratees, function(iteratee) {\n if (isArray(iteratee)) {\n return function(value) {\n return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);\n }\n }\n return iteratee;\n });\n } else {\n iteratees = [identity];\n }\n\n var index = -1;\n iteratees = arrayMap(iteratees, baseUnary(baseIteratee));\n\n var result = baseMap(collection, function(value, key, collection) {\n var criteria = arrayMap(iteratees, function(iteratee) {\n return iteratee(value);\n });\n return { \'criteria\': criteria, \'index\': ++index, \'value\': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n}\n\nmodule.exports = baseOrderBy;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseOrderBy.js?')},"./node_modules/lodash/_baseProperty.js":module=>{eval("/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = baseProperty;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseProperty.js?")},"./node_modules/lodash/_basePropertyDeep.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseGet = __webpack_require__(/*! ./_baseGet */ "./node_modules/lodash/_baseGet.js");\n\n/**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyDeep(path) {\n return function(object) {\n return baseGet(object, path);\n };\n}\n\nmodule.exports = basePropertyDeep;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_basePropertyDeep.js?')},"./node_modules/lodash/_basePropertyOf.js":module=>{eval("/**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n}\n\nmodule.exports = basePropertyOf;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_basePropertyOf.js?")},"./node_modules/lodash/_baseRange.js":module=>{eval("/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeCeil = Math.ceil,\n nativeMax = Math.max;\n\n/**\n * The base implementation of `_.range` and `_.rangeRight` which doesn't\n * coerce arguments.\n *\n * @private\n * @param {number} start The start of the range.\n * @param {number} end The end of the range.\n * @param {number} step The value to increment or decrement by.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the range of numbers.\n */\nfunction baseRange(start, end, step, fromRight) {\n var index = -1,\n length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),\n result = Array(length);\n\n while (length--) {\n result[fromRight ? length : ++index] = start;\n start += step;\n }\n return result;\n}\n\nmodule.exports = baseRange;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseRange.js?")},"./node_modules/lodash/_baseRepeat.js":module=>{eval("/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeFloor = Math.floor;\n\n/**\n * The base implementation of `_.repeat` which doesn't coerce arguments.\n *\n * @private\n * @param {string} string The string to repeat.\n * @param {number} n The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n */\nfunction baseRepeat(string, n) {\n var result = '';\n if (!string || n < 1 || n > MAX_SAFE_INTEGER) {\n return result;\n }\n // Leverage the exponentiation by squaring algorithm for a faster repeat.\n // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n do {\n if (n % 2) {\n result += string;\n }\n n = nativeFloor(n / 2);\n if (n) {\n string += string;\n }\n } while (n);\n\n return result;\n}\n\nmodule.exports = baseRepeat;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseRepeat.js?")},"./node_modules/lodash/_baseRest.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var identity = __webpack_require__(/*! ./identity */ "./node_modules/lodash/identity.js"),\n overRest = __webpack_require__(/*! ./_overRest */ "./node_modules/lodash/_overRest.js"),\n setToString = __webpack_require__(/*! ./_setToString */ "./node_modules/lodash/_setToString.js");\n\n/**\n * The base implementation of `_.rest` which doesn\'t validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + \'\');\n}\n\nmodule.exports = baseRest;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseRest.js?')},"./node_modules/lodash/_baseSetToString.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var constant = __webpack_require__(/*! ./constant */ \"./node_modules/lodash/constant.js\"),\n defineProperty = __webpack_require__(/*! ./_defineProperty */ \"./node_modules/lodash/_defineProperty.js\"),\n identity = __webpack_require__(/*! ./identity */ \"./node_modules/lodash/identity.js\");\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nmodule.exports = baseSetToString;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseSetToString.js?")},"./node_modules/lodash/_baseSlice.js":module=>{eval("/**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\nfunction baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = end > length ? length : end;\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n}\n\nmodule.exports = baseSlice;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseSlice.js?")},"./node_modules/lodash/_baseSortBy.js":module=>{eval("/**\n * The base implementation of `_.sortBy` which uses `comparer` to define the\n * sort order of `array` and replaces criteria objects with their corresponding\n * values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\nfunction baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n}\n\nmodule.exports = baseSortBy;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseSortBy.js?")},"./node_modules/lodash/_baseTimes.js":module=>{eval("/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nmodule.exports = baseTimes;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseTimes.js?")},"./node_modules/lodash/_baseToString.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var Symbol = __webpack_require__(/*! ./_Symbol */ \"./node_modules/lodash/_Symbol.js\"),\n arrayMap = __webpack_require__(/*! ./_arrayMap */ \"./node_modules/lodash/_arrayMap.js\"),\n isArray = __webpack_require__(/*! ./isArray */ \"./node_modules/lodash/isArray.js\"),\n isSymbol = __webpack_require__(/*! ./isSymbol */ \"./node_modules/lodash/isSymbol.js\");\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = baseToString;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseToString.js?")},"./node_modules/lodash/_baseTrim.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var trimmedEndIndex = __webpack_require__(/*! ./_trimmedEndIndex */ \"./node_modules/lodash/_trimmedEndIndex.js\");\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseTrim.js?")},"./node_modules/lodash/_baseUnary.js":module=>{eval("/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nmodule.exports = baseUnary;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseUnary.js?")},"./node_modules/lodash/_baseUniq.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var SetCache = __webpack_require__(/*! ./_SetCache */ "./node_modules/lodash/_SetCache.js"),\n arrayIncludes = __webpack_require__(/*! ./_arrayIncludes */ "./node_modules/lodash/_arrayIncludes.js"),\n arrayIncludesWith = __webpack_require__(/*! ./_arrayIncludesWith */ "./node_modules/lodash/_arrayIncludesWith.js"),\n cacheHas = __webpack_require__(/*! ./_cacheHas */ "./node_modules/lodash/_cacheHas.js"),\n createSet = __webpack_require__(/*! ./_createSet */ "./node_modules/lodash/_createSet.js"),\n setToArray = __webpack_require__(/*! ./_setToArray */ "./node_modules/lodash/_setToArray.js");\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\nfunction baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n}\n\nmodule.exports = baseUniq;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseUniq.js?')},"./node_modules/lodash/_baseZipObject.js":module=>{eval("/**\n * This base implementation of `_.zipObject` which assigns values using `assignFunc`.\n *\n * @private\n * @param {Array} props The property identifiers.\n * @param {Array} values The property values.\n * @param {Function} assignFunc The function to assign values.\n * @returns {Object} Returns the new object.\n */\nfunction baseZipObject(props, values, assignFunc) {\n var index = -1,\n length = props.length,\n valsLength = values.length,\n result = {};\n\n while (++index < length) {\n var value = index < valsLength ? values[index] : undefined;\n assignFunc(result, props[index], value);\n }\n return result;\n}\n\nmodule.exports = baseZipObject;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_baseZipObject.js?")},"./node_modules/lodash/_cacheHas.js":module=>{eval("/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nmodule.exports = cacheHas;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_cacheHas.js?")},"./node_modules/lodash/_castPath.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isArray = __webpack_require__(/*! ./isArray */ "./node_modules/lodash/isArray.js"),\n isKey = __webpack_require__(/*! ./_isKey */ "./node_modules/lodash/_isKey.js"),\n stringToPath = __webpack_require__(/*! ./_stringToPath */ "./node_modules/lodash/_stringToPath.js"),\n toString = __webpack_require__(/*! ./toString */ "./node_modules/lodash/toString.js");\n\n/**\n * Casts `value` to a path array if it\'s not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @param {Object} [object] The object to query keys on.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value, object) {\n if (isArray(value)) {\n return value;\n }\n return isKey(value, object) ? [value] : stringToPath(toString(value));\n}\n\nmodule.exports = castPath;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_castPath.js?')},"./node_modules/lodash/_castSlice.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseSlice = __webpack_require__(/*! ./_baseSlice */ "./node_modules/lodash/_baseSlice.js");\n\n/**\n * Casts `array` to a slice if it\'s needed.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {number} start The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the cast slice.\n */\nfunction castSlice(array, start, end) {\n var length = array.length;\n end = end === undefined ? length : end;\n return (!start && end >= length) ? array : baseSlice(array, start, end);\n}\n\nmodule.exports = castSlice;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_castSlice.js?')},"./node_modules/lodash/_cloneArrayBuffer.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var Uint8Array = __webpack_require__(/*! ./_Uint8Array */ "./node_modules/lodash/_Uint8Array.js");\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\nmodule.exports = cloneArrayBuffer;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_cloneArrayBuffer.js?')},"./node_modules/lodash/_cloneBuffer.js":(module,exports,__webpack_require__)=>{eval('/* module decorator */ module = __webpack_require__.nmd(module);\nvar root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");\n\n/** Detect free variable `exports`. */\nvar freeExports = true && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && "object" == \'object\' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nmodule.exports = cloneBuffer;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_cloneBuffer.js?')},"./node_modules/lodash/_cloneTypedArray.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var cloneArrayBuffer = __webpack_require__(/*! ./_cloneArrayBuffer */ "./node_modules/lodash/_cloneArrayBuffer.js");\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nmodule.exports = cloneTypedArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_cloneTypedArray.js?')},"./node_modules/lodash/_compareAscending.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isSymbol = __webpack_require__(/*! ./isSymbol */ "./node_modules/lodash/isSymbol.js");\n\n/**\n * Compares values to sort them in ascending order.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\nfunction compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined,\n valIsNull = value === null,\n valIsReflexive = value === value,\n valIsSymbol = isSymbol(value);\n\n var othIsDefined = other !== undefined,\n othIsNull = other === null,\n othIsReflexive = other === other,\n othIsSymbol = isSymbol(other);\n\n if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||\n (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||\n (valIsNull && othIsDefined && othIsReflexive) ||\n (!valIsDefined && othIsReflexive) ||\n !valIsReflexive) {\n return 1;\n }\n if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||\n (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||\n (othIsNull && valIsDefined && valIsReflexive) ||\n (!othIsDefined && valIsReflexive) ||\n !othIsReflexive) {\n return -1;\n }\n }\n return 0;\n}\n\nmodule.exports = compareAscending;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_compareAscending.js?')},"./node_modules/lodash/_compareMultiple.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var compareAscending = __webpack_require__(/*! ./_compareAscending */ "./node_modules/lodash/_compareAscending.js");\n\n/**\n * Used by `_.orderBy` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,\n * specify an order of "desc" for descending or "asc" for ascending sort order\n * of corresponding values.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]|string[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\nfunction compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = compareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * (order == \'desc\' ? -1 : 1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n}\n\nmodule.exports = compareMultiple;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_compareMultiple.js?')},"./node_modules/lodash/_copyArray.js":module=>{eval("/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = copyArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_copyArray.js?")},"./node_modules/lodash/_copyObject.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var assignValue = __webpack_require__(/*! ./_assignValue */ "./node_modules/lodash/_assignValue.js"),\n baseAssignValue = __webpack_require__(/*! ./_baseAssignValue */ "./node_modules/lodash/_baseAssignValue.js");\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nmodule.exports = copyObject;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_copyObject.js?')},"./node_modules/lodash/_coreJsData.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var root = __webpack_require__(/*! ./_root */ \"./node_modules/lodash/_root.js\");\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_coreJsData.js?")},"./node_modules/lodash/_createAssigner.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseRest = __webpack_require__(/*! ./_baseRest */ "./node_modules/lodash/_baseRest.js"),\n isIterateeCall = __webpack_require__(/*! ./_isIterateeCall */ "./node_modules/lodash/_isIterateeCall.js");\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == \'function\')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nmodule.exports = createAssigner;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_createAssigner.js?')},"./node_modules/lodash/_createBaseEach.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isArrayLike = __webpack_require__(/*! ./isArrayLike */ "./node_modules/lodash/isArrayLike.js");\n\n/**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n if (collection == null) {\n return collection;\n }\n if (!isArrayLike(collection)) {\n return eachFunc(collection, iteratee);\n }\n var length = collection.length,\n index = fromRight ? length : -1,\n iterable = Object(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n}\n\nmodule.exports = createBaseEach;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_createBaseEach.js?')},"./node_modules/lodash/_createBaseFor.js":module=>{eval("/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_createBaseFor.js?")},"./node_modules/lodash/_createCaseFirst.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var castSlice = __webpack_require__(/*! ./_castSlice */ "./node_modules/lodash/_castSlice.js"),\n hasUnicode = __webpack_require__(/*! ./_hasUnicode */ "./node_modules/lodash/_hasUnicode.js"),\n stringToArray = __webpack_require__(/*! ./_stringToArray */ "./node_modules/lodash/_stringToArray.js"),\n toString = __webpack_require__(/*! ./toString */ "./node_modules/lodash/toString.js");\n\n/**\n * Creates a function like `_.lowerFirst`.\n *\n * @private\n * @param {string} methodName The name of the `String` case method to use.\n * @returns {Function} Returns the new case function.\n */\nfunction createCaseFirst(methodName) {\n return function(string) {\n string = toString(string);\n\n var strSymbols = hasUnicode(string)\n ? stringToArray(string)\n : undefined;\n\n var chr = strSymbols\n ? strSymbols[0]\n : string.charAt(0);\n\n var trailing = strSymbols\n ? castSlice(strSymbols, 1).join(\'\')\n : string.slice(1);\n\n return chr[methodName]() + trailing;\n };\n}\n\nmodule.exports = createCaseFirst;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_createCaseFirst.js?')},"./node_modules/lodash/_createCompounder.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var arrayReduce = __webpack_require__(/*! ./_arrayReduce */ "./node_modules/lodash/_arrayReduce.js"),\n deburr = __webpack_require__(/*! ./deburr */ "./node_modules/lodash/deburr.js"),\n words = __webpack_require__(/*! ./words */ "./node_modules/lodash/words.js");\n\n/** Used to compose unicode capture groups. */\nvar rsApos = "[\'\\u2019]";\n\n/** Used to match apostrophes. */\nvar reApos = RegExp(rsApos, \'g\');\n\n/**\n * Creates a function like `_.camelCase`.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\nfunction createCompounder(callback) {\n return function(string) {\n return arrayReduce(words(deburr(string).replace(reApos, \'\')), callback, \'\');\n };\n}\n\nmodule.exports = createCompounder;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_createCompounder.js?')},"./node_modules/lodash/_createRange.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseRange = __webpack_require__(/*! ./_baseRange */ "./node_modules/lodash/_baseRange.js"),\n isIterateeCall = __webpack_require__(/*! ./_isIterateeCall */ "./node_modules/lodash/_isIterateeCall.js"),\n toFinite = __webpack_require__(/*! ./toFinite */ "./node_modules/lodash/toFinite.js");\n\n/**\n * Creates a `_.range` or `_.rangeRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new range function.\n */\nfunction createRange(fromRight) {\n return function(start, end, step) {\n if (step && typeof step != \'number\' && isIterateeCall(start, end, step)) {\n end = step = undefined;\n }\n // Ensure the sign of `-0` is preserved.\n start = toFinite(start);\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = toFinite(end);\n }\n step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);\n return baseRange(start, end, step, fromRight);\n };\n}\n\nmodule.exports = createRange;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_createRange.js?')},"./node_modules/lodash/_createSet.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var Set = __webpack_require__(/*! ./_Set */ "./node_modules/lodash/_Set.js"),\n noop = __webpack_require__(/*! ./noop */ "./node_modules/lodash/noop.js"),\n setToArray = __webpack_require__(/*! ./_setToArray */ "./node_modules/lodash/_setToArray.js");\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\nvar createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n};\n\nmodule.exports = createSet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_createSet.js?')},"./node_modules/lodash/_deburrLetter.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var basePropertyOf = __webpack_require__(/*! ./_basePropertyOf */ \"./node_modules/lodash/_basePropertyOf.js\");\n\n/** Used to map Latin Unicode letters to basic Latin letters. */\nvar deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcc': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xec': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n '\\u0100': 'A', '\\u0102': 'A', '\\u0104': 'A',\n '\\u0101': 'a', '\\u0103': 'a', '\\u0105': 'a',\n '\\u0106': 'C', '\\u0108': 'C', '\\u010a': 'C', '\\u010c': 'C',\n '\\u0107': 'c', '\\u0109': 'c', '\\u010b': 'c', '\\u010d': 'c',\n '\\u010e': 'D', '\\u0110': 'D', '\\u010f': 'd', '\\u0111': 'd',\n '\\u0112': 'E', '\\u0114': 'E', '\\u0116': 'E', '\\u0118': 'E', '\\u011a': 'E',\n '\\u0113': 'e', '\\u0115': 'e', '\\u0117': 'e', '\\u0119': 'e', '\\u011b': 'e',\n '\\u011c': 'G', '\\u011e': 'G', '\\u0120': 'G', '\\u0122': 'G',\n '\\u011d': 'g', '\\u011f': 'g', '\\u0121': 'g', '\\u0123': 'g',\n '\\u0124': 'H', '\\u0126': 'H', '\\u0125': 'h', '\\u0127': 'h',\n '\\u0128': 'I', '\\u012a': 'I', '\\u012c': 'I', '\\u012e': 'I', '\\u0130': 'I',\n '\\u0129': 'i', '\\u012b': 'i', '\\u012d': 'i', '\\u012f': 'i', '\\u0131': 'i',\n '\\u0134': 'J', '\\u0135': 'j',\n '\\u0136': 'K', '\\u0137': 'k', '\\u0138': 'k',\n '\\u0139': 'L', '\\u013b': 'L', '\\u013d': 'L', '\\u013f': 'L', '\\u0141': 'L',\n '\\u013a': 'l', '\\u013c': 'l', '\\u013e': 'l', '\\u0140': 'l', '\\u0142': 'l',\n '\\u0143': 'N', '\\u0145': 'N', '\\u0147': 'N', '\\u014a': 'N',\n '\\u0144': 'n', '\\u0146': 'n', '\\u0148': 'n', '\\u014b': 'n',\n '\\u014c': 'O', '\\u014e': 'O', '\\u0150': 'O',\n '\\u014d': 'o', '\\u014f': 'o', '\\u0151': 'o',\n '\\u0154': 'R', '\\u0156': 'R', '\\u0158': 'R',\n '\\u0155': 'r', '\\u0157': 'r', '\\u0159': 'r',\n '\\u015a': 'S', '\\u015c': 'S', '\\u015e': 'S', '\\u0160': 'S',\n '\\u015b': 's', '\\u015d': 's', '\\u015f': 's', '\\u0161': 's',\n '\\u0162': 'T', '\\u0164': 'T', '\\u0166': 'T',\n '\\u0163': 't', '\\u0165': 't', '\\u0167': 't',\n '\\u0168': 'U', '\\u016a': 'U', '\\u016c': 'U', '\\u016e': 'U', '\\u0170': 'U', '\\u0172': 'U',\n '\\u0169': 'u', '\\u016b': 'u', '\\u016d': 'u', '\\u016f': 'u', '\\u0171': 'u', '\\u0173': 'u',\n '\\u0174': 'W', '\\u0175': 'w',\n '\\u0176': 'Y', '\\u0177': 'y', '\\u0178': 'Y',\n '\\u0179': 'Z', '\\u017b': 'Z', '\\u017d': 'Z',\n '\\u017a': 'z', '\\u017c': 'z', '\\u017e': 'z',\n '\\u0132': 'IJ', '\\u0133': 'ij',\n '\\u0152': 'Oe', '\\u0153': 'oe',\n '\\u0149': \"'n\", '\\u017f': 's'\n};\n\n/**\n * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A\n * letters to basic Latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\nvar deburrLetter = basePropertyOf(deburredLetters);\n\nmodule.exports = deburrLetter;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_deburrLetter.js?")},"./node_modules/lodash/_defineProperty.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var getNative = __webpack_require__(/*! ./_getNative */ \"./node_modules/lodash/_getNative.js\");\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_defineProperty.js?")},"./node_modules/lodash/_equalArrays.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var SetCache = __webpack_require__(/*! ./_SetCache */ "./node_modules/lodash/_SetCache.js"),\n arraySome = __webpack_require__(/*! ./_arraySome */ "./node_modules/lodash/_arraySome.js"),\n cacheHas = __webpack_require__(/*! ./_cacheHas */ "./node_modules/lodash/_cacheHas.js");\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack[\'delete\'](array);\n stack[\'delete\'](other);\n return result;\n}\n\nmodule.exports = equalArrays;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_equalArrays.js?')},"./node_modules/lodash/_equalByTag.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var Symbol = __webpack_require__(/*! ./_Symbol */ \"./node_modules/lodash/_Symbol.js\"),\n Uint8Array = __webpack_require__(/*! ./_Uint8Array */ \"./node_modules/lodash/_Uint8Array.js\"),\n eq = __webpack_require__(/*! ./eq */ \"./node_modules/lodash/eq.js\"),\n equalArrays = __webpack_require__(/*! ./_equalArrays */ \"./node_modules/lodash/_equalArrays.js\"),\n mapToArray = __webpack_require__(/*! ./_mapToArray */ \"./node_modules/lodash/_mapToArray.js\"),\n setToArray = __webpack_require__(/*! ./_setToArray */ \"./node_modules/lodash/_setToArray.js\");\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nmodule.exports = equalByTag;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_equalByTag.js?")},"./node_modules/lodash/_equalObjects.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var getAllKeys = __webpack_require__(/*! ./_getAllKeys */ \"./node_modules/lodash/_getAllKeys.js\");\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nmodule.exports = equalObjects;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_equalObjects.js?")},"./node_modules/lodash/_freeGlobal.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;\n\nmodule.exports = freeGlobal;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_freeGlobal.js?")},"./node_modules/lodash/_getAllKeys.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseGetAllKeys = __webpack_require__(/*! ./_baseGetAllKeys */ "./node_modules/lodash/_baseGetAllKeys.js"),\n getSymbols = __webpack_require__(/*! ./_getSymbols */ "./node_modules/lodash/_getSymbols.js"),\n keys = __webpack_require__(/*! ./keys */ "./node_modules/lodash/keys.js");\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_getAllKeys.js?')},"./node_modules/lodash/_getMapData.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var isKeyable = __webpack_require__(/*! ./_isKeyable */ \"./node_modules/lodash/_isKeyable.js\");\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_getMapData.js?")},"./node_modules/lodash/_getMatchData.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isStrictComparable = __webpack_require__(/*! ./_isStrictComparable */ "./node_modules/lodash/_isStrictComparable.js"),\n keys = __webpack_require__(/*! ./keys */ "./node_modules/lodash/keys.js");\n\n/**\n * Gets the property names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\nfunction getMatchData(object) {\n var result = keys(object),\n length = result.length;\n\n while (length--) {\n var key = result[length],\n value = object[key];\n\n result[length] = [key, value, isStrictComparable(value)];\n }\n return result;\n}\n\nmodule.exports = getMatchData;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_getMatchData.js?')},"./node_modules/lodash/_getNative.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseIsNative = __webpack_require__(/*! ./_baseIsNative */ "./node_modules/lodash/_baseIsNative.js"),\n getValue = __webpack_require__(/*! ./_getValue */ "./node_modules/lodash/_getValue.js");\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it\'s native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_getNative.js?')},"./node_modules/lodash/_getPrototype.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var overArg = __webpack_require__(/*! ./_overArg */ "./node_modules/lodash/_overArg.js");\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_getPrototype.js?')},"./node_modules/lodash/_getRawTag.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var Symbol = __webpack_require__(/*! ./_Symbol */ "./node_modules/lodash/_Symbol.js");\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_getRawTag.js?')},"./node_modules/lodash/_getSymbols.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var arrayFilter = __webpack_require__(/*! ./_arrayFilter */ "./node_modules/lodash/_arrayFilter.js"),\n stubArray = __webpack_require__(/*! ./stubArray */ "./node_modules/lodash/stubArray.js");\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_getSymbols.js?')},"./node_modules/lodash/_getTag.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var DataView = __webpack_require__(/*! ./_DataView */ \"./node_modules/lodash/_DataView.js\"),\n Map = __webpack_require__(/*! ./_Map */ \"./node_modules/lodash/_Map.js\"),\n Promise = __webpack_require__(/*! ./_Promise */ \"./node_modules/lodash/_Promise.js\"),\n Set = __webpack_require__(/*! ./_Set */ \"./node_modules/lodash/_Set.js\"),\n WeakMap = __webpack_require__(/*! ./_WeakMap */ \"./node_modules/lodash/_WeakMap.js\"),\n baseGetTag = __webpack_require__(/*! ./_baseGetTag */ \"./node_modules/lodash/_baseGetTag.js\"),\n toSource = __webpack_require__(/*! ./_toSource */ \"./node_modules/lodash/_toSource.js\");\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_getTag.js?")},"./node_modules/lodash/_getValue.js":module=>{eval("/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_getValue.js?")},"./node_modules/lodash/_hasPath.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var castPath = __webpack_require__(/*! ./_castPath */ "./node_modules/lodash/_castPath.js"),\n isArguments = __webpack_require__(/*! ./isArguments */ "./node_modules/lodash/isArguments.js"),\n isArray = __webpack_require__(/*! ./isArray */ "./node_modules/lodash/isArray.js"),\n isIndex = __webpack_require__(/*! ./_isIndex */ "./node_modules/lodash/_isIndex.js"),\n isLength = __webpack_require__(/*! ./isLength */ "./node_modules/lodash/isLength.js"),\n toKey = __webpack_require__(/*! ./_toKey */ "./node_modules/lodash/_toKey.js");\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nmodule.exports = hasPath;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_hasPath.js?')},"./node_modules/lodash/_hasUnicode.js":module=>{eval("/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsZWJ = '\\\\u200d';\n\n/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */\nvar reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');\n\n/**\n * Checks if `string` contains Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a symbol is found, else `false`.\n */\nfunction hasUnicode(string) {\n return reHasUnicode.test(string);\n}\n\nmodule.exports = hasUnicode;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_hasUnicode.js?")},"./node_modules/lodash/_hasUnicodeWord.js":module=>{eval("/** Used to detect strings that need a more robust regexp to match words. */\nvar reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;\n\n/**\n * Checks if `string` contains a word composed of Unicode symbols.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {boolean} Returns `true` if a word is found, else `false`.\n */\nfunction hasUnicodeWord(string) {\n return reHasUnicodeWord.test(string);\n}\n\nmodule.exports = hasUnicodeWord;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_hasUnicodeWord.js?")},"./node_modules/lodash/_hashClear.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var nativeCreate = __webpack_require__(/*! ./_nativeCreate */ "./node_modules/lodash/_nativeCreate.js");\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_hashClear.js?')},"./node_modules/lodash/_hashDelete.js":module=>{eval("/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_hashDelete.js?")},"./node_modules/lodash/_hashGet.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var nativeCreate = __webpack_require__(/*! ./_nativeCreate */ \"./node_modules/lodash/_nativeCreate.js\");\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_hashGet.js?")},"./node_modules/lodash/_hashHas.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var nativeCreate = __webpack_require__(/*! ./_nativeCreate */ "./node_modules/lodash/_nativeCreate.js");\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_hashHas.js?')},"./node_modules/lodash/_hashSet.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var nativeCreate = __webpack_require__(/*! ./_nativeCreate */ \"./node_modules/lodash/_nativeCreate.js\");\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_hashSet.js?")},"./node_modules/lodash/_initCloneObject.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseCreate = __webpack_require__(/*! ./_baseCreate */ "./node_modules/lodash/_baseCreate.js"),\n getPrototype = __webpack_require__(/*! ./_getPrototype */ "./node_modules/lodash/_getPrototype.js"),\n isPrototype = __webpack_require__(/*! ./_isPrototype */ "./node_modules/lodash/_isPrototype.js");\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == \'function\' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\nmodule.exports = initCloneObject;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_initCloneObject.js?')},"./node_modules/lodash/_isFlattenable.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var Symbol = __webpack_require__(/*! ./_Symbol */ "./node_modules/lodash/_Symbol.js"),\n isArguments = __webpack_require__(/*! ./isArguments */ "./node_modules/lodash/isArguments.js"),\n isArray = __webpack_require__(/*! ./isArray */ "./node_modules/lodash/isArray.js");\n\n/** Built-in value references. */\nvar spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;\n\n/**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\nfunction isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\nmodule.exports = isFlattenable;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_isFlattenable.js?')},"./node_modules/lodash/_isIndex.js":module=>{eval("/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nmodule.exports = isIndex;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_isIndex.js?")},"./node_modules/lodash/_isIterateeCall.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var eq = __webpack_require__(/*! ./eq */ "./node_modules/lodash/eq.js"),\n isArrayLike = __webpack_require__(/*! ./isArrayLike */ "./node_modules/lodash/isArrayLike.js"),\n isIndex = __webpack_require__(/*! ./_isIndex */ "./node_modules/lodash/_isIndex.js"),\n isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js");\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == \'number\'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == \'string\' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_isIterateeCall.js?')},"./node_modules/lodash/_isKey.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var isArray = __webpack_require__(/*! ./isArray */ \"./node_modules/lodash/isArray.js\"),\n isSymbol = __webpack_require__(/*! ./isSymbol */ \"./node_modules/lodash/isSymbol.js\");\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/;\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\nmodule.exports = isKey;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_isKey.js?")},"./node_modules/lodash/_isKeyable.js":module=>{eval("/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_isKeyable.js?")},"./node_modules/lodash/_isMasked.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var coreJsData = __webpack_require__(/*! ./_coreJsData */ \"./node_modules/lodash/_coreJsData.js\");\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_isMasked.js?")},"./node_modules/lodash/_isPrototype.js":module=>{eval("/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nmodule.exports = isPrototype;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_isPrototype.js?")},"./node_modules/lodash/_isStrictComparable.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js");\n\n/**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\nfunction isStrictComparable(value) {\n return value === value && !isObject(value);\n}\n\nmodule.exports = isStrictComparable;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_isStrictComparable.js?')},"./node_modules/lodash/_listCacheClear.js":module=>{eval("/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_listCacheClear.js?")},"./node_modules/lodash/_listCacheDelete.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var assocIndexOf = __webpack_require__(/*! ./_assocIndexOf */ "./node_modules/lodash/_assocIndexOf.js");\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_listCacheDelete.js?')},"./node_modules/lodash/_listCacheGet.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var assocIndexOf = __webpack_require__(/*! ./_assocIndexOf */ "./node_modules/lodash/_assocIndexOf.js");\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_listCacheGet.js?')},"./node_modules/lodash/_listCacheHas.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var assocIndexOf = __webpack_require__(/*! ./_assocIndexOf */ "./node_modules/lodash/_assocIndexOf.js");\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_listCacheHas.js?')},"./node_modules/lodash/_listCacheSet.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var assocIndexOf = __webpack_require__(/*! ./_assocIndexOf */ "./node_modules/lodash/_assocIndexOf.js");\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_listCacheSet.js?')},"./node_modules/lodash/_mapCacheClear.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var Hash = __webpack_require__(/*! ./_Hash */ \"./node_modules/lodash/_Hash.js\"),\n ListCache = __webpack_require__(/*! ./_ListCache */ \"./node_modules/lodash/_ListCache.js\"),\n Map = __webpack_require__(/*! ./_Map */ \"./node_modules/lodash/_Map.js\");\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_mapCacheClear.js?")},"./node_modules/lodash/_mapCacheDelete.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var getMapData = __webpack_require__(/*! ./_getMapData */ \"./node_modules/lodash/_getMapData.js\");\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_mapCacheDelete.js?")},"./node_modules/lodash/_mapCacheGet.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getMapData = __webpack_require__(/*! ./_getMapData */ "./node_modules/lodash/_getMapData.js");\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_mapCacheGet.js?')},"./node_modules/lodash/_mapCacheHas.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getMapData = __webpack_require__(/*! ./_getMapData */ "./node_modules/lodash/_getMapData.js");\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_mapCacheHas.js?')},"./node_modules/lodash/_mapCacheSet.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getMapData = __webpack_require__(/*! ./_getMapData */ "./node_modules/lodash/_getMapData.js");\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_mapCacheSet.js?')},"./node_modules/lodash/_mapToArray.js":module=>{eval("/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nmodule.exports = mapToArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_mapToArray.js?")},"./node_modules/lodash/_matchesStrictComparable.js":module=>{eval("/**\n * A specialized version of `matchesProperty` for source values suitable\n * for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @param {*} srcValue The value to match.\n * @returns {Function} Returns the new spec function.\n */\nfunction matchesStrictComparable(key, srcValue) {\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === srcValue &&\n (srcValue !== undefined || (key in Object(object)));\n };\n}\n\nmodule.exports = matchesStrictComparable;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_matchesStrictComparable.js?")},"./node_modules/lodash/_memoizeCapped.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var memoize = __webpack_require__(/*! ./memoize */ "./node_modules/lodash/memoize.js");\n\n/** Used as the maximum memoize cache size. */\nvar MAX_MEMOIZE_SIZE = 500;\n\n/**\n * A specialized version of `_.memoize` which clears the memoized function\'s\n * cache when it exceeds `MAX_MEMOIZE_SIZE`.\n *\n * @private\n * @param {Function} func The function to have its output memoized.\n * @returns {Function} Returns the new memoized function.\n */\nfunction memoizeCapped(func) {\n var result = memoize(func, function(key) {\n if (cache.size === MAX_MEMOIZE_SIZE) {\n cache.clear();\n }\n return key;\n });\n\n var cache = result.cache;\n return result;\n}\n\nmodule.exports = memoizeCapped;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_memoizeCapped.js?')},"./node_modules/lodash/_nativeCreate.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var getNative = __webpack_require__(/*! ./_getNative */ \"./node_modules/lodash/_getNative.js\");\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_nativeCreate.js?")},"./node_modules/lodash/_nativeKeys.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var overArg = __webpack_require__(/*! ./_overArg */ "./node_modules/lodash/_overArg.js");\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_nativeKeys.js?')},"./node_modules/lodash/_nativeKeysIn.js":module=>{eval("/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = nativeKeysIn;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_nativeKeysIn.js?")},"./node_modules/lodash/_nodeUtil.js":(module,exports,__webpack_require__)=>{eval("/* module decorator */ module = __webpack_require__.nmd(module);\nvar freeGlobal = __webpack_require__(/*! ./_freeGlobal */ \"./node_modules/lodash/_freeGlobal.js\");\n\n/** Detect free variable `exports`. */\nvar freeExports = true && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && \"object\" == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nmodule.exports = nodeUtil;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_nodeUtil.js?")},"./node_modules/lodash/_objectToString.js":module=>{eval("/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_objectToString.js?")},"./node_modules/lodash/_overArg.js":module=>{eval("/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nmodule.exports = overArg;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_overArg.js?")},"./node_modules/lodash/_overRest.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var apply = __webpack_require__(/*! ./_apply */ "./node_modules/lodash/_apply.js");\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nmodule.exports = overRest;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_overRest.js?')},"./node_modules/lodash/_root.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var freeGlobal = __webpack_require__(/*! ./_freeGlobal */ \"./node_modules/lodash/_freeGlobal.js\");\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_root.js?")},"./node_modules/lodash/_safeGet.js":module=>{eval("/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\nmodule.exports = safeGet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_safeGet.js?")},"./node_modules/lodash/_setCacheAdd.js":module=>{eval("/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nmodule.exports = setCacheAdd;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_setCacheAdd.js?")},"./node_modules/lodash/_setCacheHas.js":module=>{eval("/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nmodule.exports = setCacheHas;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_setCacheHas.js?")},"./node_modules/lodash/_setToArray.js":module=>{eval("/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nmodule.exports = setToArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_setToArray.js?")},"./node_modules/lodash/_setToString.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseSetToString = __webpack_require__(/*! ./_baseSetToString */ "./node_modules/lodash/_baseSetToString.js"),\n shortOut = __webpack_require__(/*! ./_shortOut */ "./node_modules/lodash/_shortOut.js");\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nmodule.exports = setToString;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_setToString.js?')},"./node_modules/lodash/_shortOut.js":module=>{eval("/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nmodule.exports = shortOut;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_shortOut.js?")},"./node_modules/lodash/_stackClear.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var ListCache = __webpack_require__(/*! ./_ListCache */ "./node_modules/lodash/_ListCache.js");\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nmodule.exports = stackClear;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_stackClear.js?')},"./node_modules/lodash/_stackDelete.js":module=>{eval("/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nmodule.exports = stackDelete;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_stackDelete.js?")},"./node_modules/lodash/_stackGet.js":module=>{eval("/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nmodule.exports = stackGet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_stackGet.js?")},"./node_modules/lodash/_stackHas.js":module=>{eval("/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nmodule.exports = stackHas;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_stackHas.js?")},"./node_modules/lodash/_stackSet.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var ListCache = __webpack_require__(/*! ./_ListCache */ "./node_modules/lodash/_ListCache.js"),\n Map = __webpack_require__(/*! ./_Map */ "./node_modules/lodash/_Map.js"),\n MapCache = __webpack_require__(/*! ./_MapCache */ "./node_modules/lodash/_MapCache.js");\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nmodule.exports = stackSet;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_stackSet.js?')},"./node_modules/lodash/_strictIndexOf.js":module=>{eval("/**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = strictIndexOf;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_strictIndexOf.js?")},"./node_modules/lodash/_stringToArray.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var asciiToArray = __webpack_require__(/*! ./_asciiToArray */ "./node_modules/lodash/_asciiToArray.js"),\n hasUnicode = __webpack_require__(/*! ./_hasUnicode */ "./node_modules/lodash/_hasUnicode.js"),\n unicodeToArray = __webpack_require__(/*! ./_unicodeToArray */ "./node_modules/lodash/_unicodeToArray.js");\n\n/**\n * Converts `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction stringToArray(string) {\n return hasUnicode(string)\n ? unicodeToArray(string)\n : asciiToArray(string);\n}\n\nmodule.exports = stringToArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_stringToArray.js?')},"./node_modules/lodash/_stringToPath.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var memoizeCapped = __webpack_require__(/*! ./_memoizeCapped */ \"./node_modules/lodash/_memoizeCapped.js\");\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoizeCapped(function(string) {\n var result = [];\n if (string.charCodeAt(0) === 46 /* . */) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, subString) {\n result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\nmodule.exports = stringToPath;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_stringToPath.js?")},"./node_modules/lodash/_toKey.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var isSymbol = __webpack_require__(/*! ./isSymbol */ \"./node_modules/lodash/isSymbol.js\");\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nmodule.exports = toKey;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_toKey.js?")},"./node_modules/lodash/_toSource.js":module=>{eval("/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_toSource.js?")},"./node_modules/lodash/_trimmedEndIndex.js":module=>{eval("/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_trimmedEndIndex.js?")},"./node_modules/lodash/_unicodeToArray.js":module=>{eval("/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsVarRange = '\\\\ufe0e\\\\ufe0f';\n\n/** Used to compose unicode capture groups. */\nvar rsAstral = '[' + rsAstralRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';\n\n/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */\nvar reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');\n\n/**\n * Converts a Unicode `string` to an array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the converted array.\n */\nfunction unicodeToArray(string) {\n return string.match(reUnicode) || [];\n}\n\nmodule.exports = unicodeToArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_unicodeToArray.js?")},"./node_modules/lodash/_unicodeWords.js":module=>{eval("/** Used to compose unicode character classes. */\nvar rsAstralRange = '\\\\ud800-\\\\udfff',\n rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,\n rsDingbatRange = '\\\\u2700-\\\\u27bf',\n rsLowerRange = 'a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff',\n rsMathOpRange = '\\\\xac\\\\xb1\\\\xd7\\\\xf7',\n rsNonCharRange = '\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf',\n rsPunctuationRange = '\\\\u2000-\\\\u206f',\n rsSpaceRange = ' \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000',\n rsUpperRange = 'A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde',\n rsVarRange = '\\\\ufe0e\\\\ufe0f',\n rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;\n\n/** Used to compose unicode capture groups. */\nvar rsApos = \"['\\u2019]\",\n rsBreak = '[' + rsBreakRange + ']',\n rsCombo = '[' + rsComboRange + ']',\n rsDigits = '\\\\d+',\n rsDingbat = '[' + rsDingbatRange + ']',\n rsLower = '[' + rsLowerRange + ']',\n rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',\n rsFitz = '\\\\ud83c[\\\\udffb-\\\\udfff]',\n rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',\n rsNonAstral = '[^' + rsAstralRange + ']',\n rsRegional = '(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}',\n rsSurrPair = '[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]',\n rsUpper = '[' + rsUpperRange + ']',\n rsZWJ = '\\\\u200d';\n\n/** Used to compose unicode regexes. */\nvar rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',\n rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',\n rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',\n rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',\n reOptMod = rsModifier + '?',\n rsOptVar = '[' + rsVarRange + ']?',\n rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',\n rsOrdLower = '\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])',\n rsOrdUpper = '\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])',\n rsSeq = rsOptVar + reOptMod + rsOptJoin,\n rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;\n\n/** Used to match complex or compound words. */\nvar reUnicodeWord = RegExp([\n rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',\n rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',\n rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,\n rsUpper + '+' + rsOptContrUpper,\n rsOrdUpper,\n rsOrdLower,\n rsDigits,\n rsEmoji\n].join('|'), 'g');\n\n/**\n * Splits a Unicode `string` into an array of its words.\n *\n * @private\n * @param {string} The string to inspect.\n * @returns {Array} Returns the words of `string`.\n */\nfunction unicodeWords(string) {\n return string.match(reUnicodeWord) || [];\n}\n\nmodule.exports = unicodeWords;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/_unicodeWords.js?")},"./node_modules/lodash/camelCase.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var capitalize = __webpack_require__(/*! ./capitalize */ \"./node_modules/lodash/capitalize.js\"),\n createCompounder = __webpack_require__(/*! ./_createCompounder */ \"./node_modules/lodash/_createCompounder.js\");\n\n/**\n * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the camel cased string.\n * @example\n *\n * _.camelCase('Foo Bar');\n * // => 'fooBar'\n *\n * _.camelCase('--foo-bar--');\n * // => 'fooBar'\n *\n * _.camelCase('__FOO_BAR__');\n * // => 'fooBar'\n */\nvar camelCase = createCompounder(function(result, word, index) {\n word = word.toLowerCase();\n return result + (index ? capitalize(word) : word);\n});\n\nmodule.exports = camelCase;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/camelCase.js?")},"./node_modules/lodash/capitalize.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var toString = __webpack_require__(/*! ./toString */ \"./node_modules/lodash/toString.js\"),\n upperFirst = __webpack_require__(/*! ./upperFirst */ \"./node_modules/lodash/upperFirst.js\");\n\n/**\n * Converts the first character of `string` to upper case and the remaining\n * to lower case.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('FRED');\n * // => 'Fred'\n */\nfunction capitalize(string) {\n return upperFirst(toString(string).toLowerCase());\n}\n\nmodule.exports = capitalize;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/capitalize.js?")},"./node_modules/lodash/constant.js":module=>{eval("/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nmodule.exports = constant;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/constant.js?")},"./node_modules/lodash/deburr.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var deburrLetter = __webpack_require__(/*! ./_deburrLetter */ \"./node_modules/lodash/_deburrLetter.js\"),\n toString = __webpack_require__(/*! ./toString */ \"./node_modules/lodash/toString.js\");\n\n/** Used to match Latin Unicode letters (excluding mathematical operators). */\nvar reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n\n/** Used to compose unicode character classes. */\nvar rsComboMarksRange = '\\\\u0300-\\\\u036f',\n reComboHalfMarksRange = '\\\\ufe20-\\\\ufe2f',\n rsComboSymbolsRange = '\\\\u20d0-\\\\u20ff',\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;\n\n/** Used to compose unicode capture groups. */\nvar rsCombo = '[' + rsComboRange + ']';\n\n/**\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\n */\nvar reComboMark = RegExp(rsCombo, 'g');\n\n/**\n * Deburrs `string` by converting\n * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)\n * letters to basic Latin letters and removing\n * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\nfunction deburr(string) {\n string = toString(string);\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n}\n\nmodule.exports = deburr;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/deburr.js?")},"./node_modules/lodash/eq.js":module=>{eval("/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/eq.js?")},"./node_modules/lodash/get.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseGet = __webpack_require__(/*! ./_baseGet */ \"./node_modules/lodash/_baseGet.js\");\n\n/**\n * Gets the value at `path` of `object`. If the resolved value is\n * `undefined`, the `defaultValue` is returned in its place.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned for `undefined` resolved values.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, path);\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/get.js?")},"./node_modules/lodash/has.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseHas = __webpack_require__(/*! ./_baseHas */ \"./node_modules/lodash/_baseHas.js\"),\n hasPath = __webpack_require__(/*! ./_hasPath */ \"./node_modules/lodash/_hasPath.js\");\n\n/**\n * Checks if `path` is a direct property of `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': 2 } };\n * var other = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b');\n * // => true\n *\n * _.has(object, ['a', 'b']);\n * // => true\n *\n * _.has(other, 'a');\n * // => false\n */\nfunction has(object, path) {\n return object != null && hasPath(object, path, baseHas);\n}\n\nmodule.exports = has;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/has.js?")},"./node_modules/lodash/hasIn.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseHasIn = __webpack_require__(/*! ./_baseHasIn */ \"./node_modules/lodash/_baseHasIn.js\"),\n hasPath = __webpack_require__(/*! ./_hasPath */ \"./node_modules/lodash/_hasPath.js\");\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nmodule.exports = hasIn;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/hasIn.js?")},"./node_modules/lodash/identity.js":module=>{eval("/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/identity.js?")},"./node_modules/lodash/isArguments.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseIsArguments = __webpack_require__(/*! ./_baseIsArguments */ \"./node_modules/lodash/_baseIsArguments.js\"),\n isObjectLike = __webpack_require__(/*! ./isObjectLike */ \"./node_modules/lodash/isObjectLike.js\");\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nmodule.exports = isArguments;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isArguments.js?")},"./node_modules/lodash/isArray.js":module=>{eval("/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isArray.js?")},"./node_modules/lodash/isArrayLike.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var isFunction = __webpack_require__(/*! ./isFunction */ \"./node_modules/lodash/isFunction.js\"),\n isLength = __webpack_require__(/*! ./isLength */ \"./node_modules/lodash/isLength.js\");\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nmodule.exports = isArrayLike;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isArrayLike.js?")},"./node_modules/lodash/isArrayLikeObject.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isArrayLike = __webpack_require__(/*! ./isArrayLike */ "./node_modules/lodash/isArrayLike.js"),\n isObjectLike = __webpack_require__(/*! ./isObjectLike */ "./node_modules/lodash/isObjectLike.js");\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject(\'abc\');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\nmodule.exports = isArrayLikeObject;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isArrayLikeObject.js?')},"./node_modules/lodash/isBuffer.js":(module,exports,__webpack_require__)=>{eval('/* module decorator */ module = __webpack_require__.nmd(module);\nvar root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js"),\n stubFalse = __webpack_require__(/*! ./stubFalse */ "./node_modules/lodash/stubFalse.js");\n\n/** Detect free variable `exports`. */\nvar freeExports = true && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && "object" == \'object\' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nmodule.exports = isBuffer;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isBuffer.js?')},"./node_modules/lodash/isFunction.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ \"./node_modules/lodash/_baseGetTag.js\"),\n isObject = __webpack_require__(/*! ./isObject */ \"./node_modules/lodash/isObject.js\");\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isFunction.js?")},"./node_modules/lodash/isLength.js":module=>{eval("/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isLength.js?")},"./node_modules/lodash/isObject.js":module=>{eval("/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isObject.js?")},"./node_modules/lodash/isObjectLike.js":module=>{eval("/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isObjectLike.js?")},"./node_modules/lodash/isPlainObject.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ \"./node_modules/lodash/_baseGetTag.js\"),\n getPrototype = __webpack_require__(/*! ./_getPrototype */ \"./node_modules/lodash/_getPrototype.js\"),\n isObjectLike = __webpack_require__(/*! ./isObjectLike */ \"./node_modules/lodash/isObjectLike.js\");\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nmodule.exports = isPlainObject;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isPlainObject.js?")},"./node_modules/lodash/isSymbol.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ \"./node_modules/lodash/_baseGetTag.js\"),\n isObjectLike = __webpack_require__(/*! ./isObjectLike */ \"./node_modules/lodash/isObjectLike.js\");\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isSymbol.js?")},"./node_modules/lodash/isTypedArray.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseIsTypedArray = __webpack_require__(/*! ./_baseIsTypedArray */ "./node_modules/lodash/_baseIsTypedArray.js"),\n baseUnary = __webpack_require__(/*! ./_baseUnary */ "./node_modules/lodash/_baseUnary.js"),\n nodeUtil = __webpack_require__(/*! ./_nodeUtil */ "./node_modules/lodash/_nodeUtil.js");\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nmodule.exports = isTypedArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/isTypedArray.js?')},"./node_modules/lodash/keys.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var arrayLikeKeys = __webpack_require__(/*! ./_arrayLikeKeys */ \"./node_modules/lodash/_arrayLikeKeys.js\"),\n baseKeys = __webpack_require__(/*! ./_baseKeys */ \"./node_modules/lodash/_baseKeys.js\"),\n isArrayLike = __webpack_require__(/*! ./isArrayLike */ \"./node_modules/lodash/isArrayLike.js\");\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/keys.js?")},"./node_modules/lodash/keysIn.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var arrayLikeKeys = __webpack_require__(/*! ./_arrayLikeKeys */ \"./node_modules/lodash/_arrayLikeKeys.js\"),\n baseKeysIn = __webpack_require__(/*! ./_baseKeysIn */ \"./node_modules/lodash/_baseKeysIn.js\"),\n isArrayLike = __webpack_require__(/*! ./isArrayLike */ \"./node_modules/lodash/isArrayLike.js\");\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = keysIn;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/keysIn.js?")},"./node_modules/lodash/memoize.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var MapCache = __webpack_require__(/*! ./_MapCache */ \"./node_modules/lodash/_MapCache.js\");\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `clear`, `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result) || cache;\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Expose `MapCache`.\nmemoize.Cache = MapCache;\n\nmodule.exports = memoize;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/memoize.js?")},"./node_modules/lodash/merge.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseMerge = __webpack_require__(/*! ./_baseMerge */ \"./node_modules/lodash/_baseMerge.js\"),\n createAssigner = __webpack_require__(/*! ./_createAssigner */ \"./node_modules/lodash/_createAssigner.js\");\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n});\n\nmodule.exports = merge;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/merge.js?")},"./node_modules/lodash/noop.js":module=>{eval("/**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\nfunction noop() {\n // No operation performed.\n}\n\nmodule.exports = noop;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/noop.js?")},"./node_modules/lodash/property.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseProperty = __webpack_require__(/*! ./_baseProperty */ \"./node_modules/lodash/_baseProperty.js\"),\n basePropertyDeep = __webpack_require__(/*! ./_basePropertyDeep */ \"./node_modules/lodash/_basePropertyDeep.js\"),\n isKey = __webpack_require__(/*! ./_isKey */ \"./node_modules/lodash/_isKey.js\"),\n toKey = __webpack_require__(/*! ./_toKey */ \"./node_modules/lodash/_toKey.js\");\n\n/**\n * Creates a function that returns the value at `path` of a given object.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new accessor function.\n * @example\n *\n * var objects = [\n * { 'a': { 'b': 2 } },\n * { 'a': { 'b': 1 } }\n * ];\n *\n * _.map(objects, _.property('a.b'));\n * // => [2, 1]\n *\n * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');\n * // => [1, 2]\n */\nfunction property(path) {\n return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);\n}\n\nmodule.exports = property;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/property.js?")},"./node_modules/lodash/range.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var createRange = __webpack_require__(/*! ./_createRange */ "./node_modules/lodash/_createRange.js");\n\n/**\n * Creates an array of numbers (positive and/or negative) progressing from\n * `start` up to, but not including, `end`. A step of `-1` is used if a negative\n * `start` is specified without an `end` or `step`. If `end` is not specified,\n * it\'s set to `start` with `start` then set to `0`.\n *\n * **Note:** JavaScript follows the IEEE-754 standard for resolving\n * floating-point values which can produce unexpected results.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @param {number} [step=1] The value to increment or decrement by.\n * @returns {Array} Returns the range of numbers.\n * @see _.inRange, _.rangeRight\n * @example\n *\n * _.range(4);\n * // => [0, 1, 2, 3]\n *\n * _.range(-4);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 5);\n * // => [1, 2, 3, 4]\n *\n * _.range(0, 20, 5);\n * // => [0, 5, 10, 15]\n *\n * _.range(0, -4, -1);\n * // => [0, -1, -2, -3]\n *\n * _.range(1, 4, 0);\n * // => [1, 1, 1]\n *\n * _.range(0);\n * // => []\n */\nvar range = createRange();\n\nmodule.exports = range;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/range.js?')},"./node_modules/lodash/repeat.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseRepeat = __webpack_require__(/*! ./_baseRepeat */ \"./node_modules/lodash/_baseRepeat.js\"),\n isIterateeCall = __webpack_require__(/*! ./_isIterateeCall */ \"./node_modules/lodash/_isIterateeCall.js\"),\n toInteger = __webpack_require__(/*! ./toInteger */ \"./node_modules/lodash/toInteger.js\"),\n toString = __webpack_require__(/*! ./toString */ \"./node_modules/lodash/toString.js\");\n\n/**\n * Repeats the given string `n` times.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to repeat.\n * @param {number} [n=1] The number of times to repeat the string.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {string} Returns the repeated string.\n * @example\n *\n * _.repeat('*', 3);\n * // => '***'\n *\n * _.repeat('abc', 2);\n * // => 'abcabc'\n *\n * _.repeat('abc', 0);\n * // => ''\n */\nfunction repeat(string, n, guard) {\n if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {\n n = 1;\n } else {\n n = toInteger(n);\n }\n return baseRepeat(toString(string), n);\n}\n\nmodule.exports = repeat;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/repeat.js?")},"./node_modules/lodash/sortBy.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseFlatten = __webpack_require__(/*! ./_baseFlatten */ \"./node_modules/lodash/_baseFlatten.js\"),\n baseOrderBy = __webpack_require__(/*! ./_baseOrderBy */ \"./node_modules/lodash/_baseOrderBy.js\"),\n baseRest = __webpack_require__(/*! ./_baseRest */ \"./node_modules/lodash/_baseRest.js\"),\n isIterateeCall = __webpack_require__(/*! ./_isIterateeCall */ \"./node_modules/lodash/_isIterateeCall.js\");\n\n/**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection thru each iteratee. This method\n * performs a stable sort, that is, it preserves the original sort order of\n * equal elements. The iteratees are invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {...(Function|Function[])} [iteratees=[_.identity]]\n * The iteratees to sort by.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 30 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.sortBy(users, [function(o) { return o.user; }]);\n * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]\n *\n * _.sortBy(users, ['user', 'age']);\n * // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]\n */\nvar sortBy = baseRest(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var length = iteratees.length;\n if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {\n iteratees = [];\n } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {\n iteratees = [iteratees[0]];\n }\n return baseOrderBy(collection, baseFlatten(iteratees, 1), []);\n});\n\nmodule.exports = sortBy;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/sortBy.js?")},"./node_modules/lodash/stubArray.js":module=>{eval("/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nmodule.exports = stubArray;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/stubArray.js?")},"./node_modules/lodash/stubFalse.js":module=>{eval("/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = stubFalse;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/stubFalse.js?")},"./node_modules/lodash/toFinite.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var toNumber = __webpack_require__(/*! ./toNumber */ \"./node_modules/lodash/toNumber.js\");\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n return value === value ? value : 0;\n}\n\nmodule.exports = toFinite;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/toFinite.js?")},"./node_modules/lodash/toInteger.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var toFinite = __webpack_require__(/*! ./toFinite */ \"./node_modules/lodash/toFinite.js\");\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n var result = toFinite(value),\n remainder = result % 1;\n\n return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nmodule.exports = toInteger;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/toInteger.js?")},"./node_modules/lodash/toNumber.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseTrim = __webpack_require__(/*! ./_baseTrim */ \"./node_modules/lodash/_baseTrim.js\"),\n isObject = __webpack_require__(/*! ./isObject */ \"./node_modules/lodash/isObject.js\"),\n isSymbol = __webpack_require__(/*! ./isSymbol */ \"./node_modules/lodash/isSymbol.js\");\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/toNumber.js?")},"./node_modules/lodash/toPlainObject.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var copyObject = __webpack_require__(/*! ./_copyObject */ \"./node_modules/lodash/_copyObject.js\"),\n keysIn = __webpack_require__(/*! ./keysIn */ \"./node_modules/lodash/keysIn.js\");\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\nmodule.exports = toPlainObject;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/toPlainObject.js?")},"./node_modules/lodash/toString.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var baseToString = __webpack_require__(/*! ./_baseToString */ \"./node_modules/lodash/_baseToString.js\");\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nmodule.exports = toString;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/toString.js?")},"./node_modules/lodash/uniq.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var baseUniq = __webpack_require__(/*! ./_baseUniq */ "./node_modules/lodash/_baseUniq.js");\n\n/**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurrence of each element\n * is kept. The order of result values is determined by the order they occur\n * in the array.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n */\nfunction uniq(array) {\n return (array && array.length) ? baseUniq(array) : [];\n}\n\nmodule.exports = uniq;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/uniq.js?')},"./node_modules/lodash/upperFirst.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var createCaseFirst = __webpack_require__(/*! ./_createCaseFirst */ \"./node_modules/lodash/_createCaseFirst.js\");\n\n/**\n * Converts the first character of `string` to upper case.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.upperFirst('fred');\n * // => 'Fred'\n *\n * _.upperFirst('FRED');\n * // => 'FRED'\n */\nvar upperFirst = createCaseFirst('toUpperCase');\n\nmodule.exports = upperFirst;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/upperFirst.js?")},"./node_modules/lodash/words.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var asciiWords = __webpack_require__(/*! ./_asciiWords */ \"./node_modules/lodash/_asciiWords.js\"),\n hasUnicodeWord = __webpack_require__(/*! ./_hasUnicodeWord */ \"./node_modules/lodash/_hasUnicodeWord.js\"),\n toString = __webpack_require__(/*! ./toString */ \"./node_modules/lodash/toString.js\"),\n unicodeWords = __webpack_require__(/*! ./_unicodeWords */ \"./node_modules/lodash/_unicodeWords.js\");\n\n/**\n * Splits `string` into an array of its words.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {RegExp|string} [pattern] The pattern to match words.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Array} Returns the words of `string`.\n * @example\n *\n * _.words('fred, barney, & pebbles');\n * // => ['fred', 'barney', 'pebbles']\n *\n * _.words('fred, barney, & pebbles', /[^, ]+/g);\n * // => ['fred', 'barney', '&', 'pebbles']\n */\nfunction words(string, pattern, guard) {\n string = toString(string);\n pattern = guard ? undefined : pattern;\n\n if (pattern === undefined) {\n return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);\n }\n return string.match(pattern) || [];\n}\n\nmodule.exports = words;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/words.js?")},"./node_modules/lodash/zipObject.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var assignValue = __webpack_require__(/*! ./_assignValue */ \"./node_modules/lodash/_assignValue.js\"),\n baseZipObject = __webpack_require__(/*! ./_baseZipObject */ \"./node_modules/lodash/_baseZipObject.js\");\n\n/**\n * This method is like `_.fromPairs` except that it accepts two arrays,\n * one of property identifiers and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @since 0.4.0\n * @category Array\n * @param {Array} [props=[]] The property identifiers.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject(['a', 'b'], [1, 2]);\n * // => { 'a': 1, 'b': 2 }\n */\nfunction zipObject(props, values) {\n return baseZipObject(props || [], values || [], assignValue);\n}\n\nmodule.exports = zipObject;\n\n\n//# sourceURL=webpack://Papyros/./node_modules/lodash/zipObject.js?")},"./node_modules/pyodide-worker-runner/dist/index.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('!function(t,e){ true?module.exports=e(__webpack_require__(/*! comsync */ "./node_modules/comsync/dist/index.js"),__webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs"),__webpack_require__(/*! pyodide */ "./node_modules/pyodide/pyodide.js")):0}(self,((t,e,o)=>(()=>{var r={237:(t,e,o)=>{"use strict";o.d(e,{Z:()=>r});const r=\'import importlib\\nimport sys\\nfrom typing import Callable, Literal, Union, TypedDict\\n\\nimport pyodide # noqa\\nimport pyodide_js # noqa\\n\\nsys.setrecursionlimit(400)\\n\\n\\nclass InstallEntry(TypedDict):\\n module: str\\n package: str\\n\\n\\ndef find_imports_to_install(imports: list[str]) -> list[InstallEntry]:\\n """\\n Given a list of module names being imported, return a list of dicts\\n representing the packages that need to be installed to import those modules.\\n The returned list will only contain modules that aren\\\'t already installed.\\n Each returned dict has the following keys:\\n - module: the name of the module being imported\\n - package: the name of the package that needs to be installed\\n """\\n try:\\n to_package_name = pyodide_js._module._import_name_to_package_name.to_py()\\n except AttributeError:\\n to_package_name = pyodide_js._api._import_name_to_package_name.to_py()\\n\\n to_install: list[InstallEntry] = []\\n for module in imports:\\n try:\\n importlib.import_module(module)\\n except ModuleNotFoundError:\\n to_install.append(\\n dict(\\n module=module,\\n package=to_package_name.get(module, module),\\n )\\n )\\n return to_install\\n\\n\\nasync def install_imports(\\n source_code_or_imports: Union[str, list[str]],\\n message_callback: Callable[\\n [\\n Literal[\\n "loading_all",\\n "loaded_all",\\n "loading_one",\\n "loaded_one",\\n "loading_micropip",\\n "loaded_micropip",\\n ],\\n Union[InstallEntry, list[InstallEntry]],\\n ],\\n None,\\n ] = lambda event_type, data: None,\\n):\\n """\\n Accepts a string of Python source code or a list of module names being imported.\\n Installs any packages that need to be installed to import those modules,\\n using micropip, which may also be installed if needed.\\n If the package is not specially built for Pyodide, it must be available on PyPI\\n as a pure Python wheel file.\\n If the `message_callback` argument is provided, it will be called with an\\n event type and data about the packages being installed.\\n The event types start with `loading_` before installation, and `loaded_` after.\\n The data is either a single dict representing the package being installed,\\n or a list of all the packages being installed.\\n The events are:\\n - loading/loaded_all, with a list of all the packages being installed.\\n - loading/loaded_one, with a dict for a single package.\\n - loading/loaded_micropip, with a dict for the special micropip package.\\n """\\n if isinstance(source_code_or_imports, str):\\n try:\\n imports: list[str] = pyodide.find_imports(source_code_or_imports)\\n except SyntaxError:\\n return\\n else:\\n imports: list[str] = source_code_or_imports\\n\\n to_install = find_imports_to_install(imports)\\n if to_install:\\n message_callback("loading_all", to_install)\\n try:\\n import micropip # noqa\\n except ModuleNotFoundError:\\n micropip_entry = dict(module="micropip", package="micropip")\\n message_callback("loading_micropip", micropip_entry)\\n await pyodide_js.loadPackage("micropip")\\n import micropip # noqa\\n\\n message_callback("loaded_micropip", micropip_entry)\\n\\n for entry in to_install:\\n message_callback("loading_one", entry)\\n await micropip.install(entry["package"])\\n message_callback("loaded_one", entry)\\n message_callback("loaded_all", to_install)\\n\'},353:(t,e,o)=>{t.exports=o(846)},846:(t,e,o)=>{var r=o(960);e.operation=function(t){var o=e.timeouts(t);return new r(o,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var o in t)e[o]=t[o];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],n=0;n{function e(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=e,e.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},e.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},e.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var o=this._timeouts.shift();if(void 0===o){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),o=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout((function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout((function(){r._operationTimeoutCb(r._attempts)}),r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)}),o),this._options.unref&&this._timer.unref(),!0},e.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var o=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){o._operationTimeoutCb()}),o._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},e.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},e.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},e.prototype.start=e.prototype.try,e.prototype.errors=function(){return this._errors},e.prototype.attempts=function(){return this._attempts},e.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,o=0,r=0;r=o&&(e=n,o=a)}return e}},272:t=>{"use strict";t.exports=e},422:e=>{"use strict";e.exports=t},28:t=>{"use strict";t.exports=o}},n={};function i(t){var e=n[t];if(void 0!==e)return e.exports;var o=n[t]={exports:{}};return r[t](o,o.exports,i),o.exports}i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var a={};return(()=>{"use strict";i.r(a),i.d(a,{PyodideClient:()=>v,PyodideFatalErrorReloader:()=>b,defaultPyodideLoader:()=>d,initPyodide:()=>f,loadPyodideAndPackage:()=>h,makeRunnerCallback:()=>y,pyodideExpose:()=>g,versionInfo:()=>m});var t=i(353);const e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"]);class o extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,({message:t}=t)):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const r=t=>void 0===globalThis.DOMException?new Error(t):new DOMException(t);async function n(n,i){return new Promise(((a,s)=>{i={onFailedAttempt(){},retries:10,...i};const l=t.operation(i);l.attempt((async t=>{try{a(await n(t))}catch(n){if(!(n instanceof Error))return void s(new TypeError(`Non-error was thrown: "${n}". You should only throw errors.`));if(n instanceof o)l.stop(),s(n.originalError);else if(n instanceof TypeError&&(r=n.message,!e.has(r)))l.stop(),s(n);else{((t,e,o)=>{const r=o.retries-(e-1);t.attemptNumber=e,t.retriesLeft=r})(n,t,i);try{await i.onFailedAttempt(n)}catch(t){return void s(t)}l.retry(n)||s(l.mainError())}}var r})),i.signal&&!i.signal.aborted&&i.signal.addEventListener("abort",(()=>{l.stop();const t=void 0===i.signal.reason?r("The operation was aborted."):i.signal.reason;s(t instanceof Error?t:r(t))}),{once:!0})}))}var s=i(422),l=i(272),p=i(28),c=function(t,e,o,r){return new(o||(o=Promise))((function(n,i){function a(t){try{l(r.next(t))}catch(t){i(t)}}function s(t){try{l(r.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(a,s)}l((r=r.apply(t,e||[])).next())}))};const u=i(237).Z;function d(t=p.version){return c(this,void 0,void 0,(function*(){const e=`https://cdn.jsdelivr.net/pyodide/v${t}/full/`,o=yield(0,p.loadPyodide)({indexURL:e});if(o.version!==t)throw new Error(`loadPyodide loaded version ${o.version} instead of ${t}`);return o}))}function m(t){return t.split(".").map(Number)}function h(t,e=d){return c(this,void 0,void 0,(function*(){let o,r,{format:i,extractDir:a,url:s}=t;a=a||"/tmp/",[o,r]=yield Promise.all([n((()=>e()),{retries:3}),n((()=>function(t){return c(this,void 0,void 0,(function*(){if(_.has(t))return console.log("Loaded package from cache"),_.get(t);console.log("Fetching package from "+t.slice(0,100)+"...");const e=yield fetch(t);if(!e.ok)throw new Error(`Request for package failed with status ${e.status}: ${e.statusText}`);const o=yield e.arrayBuffer();return console.log("Fetched package"),_.set(t,o),o}))}(s)),{retries:3})]);const l=m(o.version);return o.unpackArchive(r,i,0===l[0]&&l[1]<=19?a:{extractDir:a}),o.pyimport("sys").path.append(a),f(o),o}))}function f(t){t.registerComlink(l);const e=t.pyimport("sys"),o=t.pyimport("pathlib"),r="/tmp/pyodide_worker_runner/";e.path.append(r),o.Path(r).mkdir(),o.Path(r+"pyodide_worker_runner.py").write_text(u),t.pyimport("pyodide_worker_runner")}const _=new Map;function y(t,e){return function(o,r){return r.toJs&&(r=r.toJs({dict_converter:Object.fromEntries})),"input"===o?(e.input&&e.input(r.prompt),t.readMessage()+"\\n"):"sleep"!==o?"output"===o?e.output(r.parts):e.other(o,r):void t.syncSleep(1e3*r.seconds)}}function g(t){return(0,s.syncExpose)((function(e,o,...r){return c(this,void 0,void 0,(function*(){return t(Object.assign(Object.assign({},e),{interruptBuffer:o}),...r)}))}))}class v extends s.SyncClient{call(t,...e){const o=Object.create(null,{call:{get:()=>super.call}});return c(this,void 0,void 0,(function*(){let r=null;return"undefined"!=typeof SharedArrayBuffer&&(r=new Int32Array(new SharedArrayBuffer(1*Int32Array.BYTES_PER_ELEMENT)),this.interrupter=()=>{r[0]=2}),o.call.call(this,t,r,...e)}))}}class b{constructor(t){this.loader=t,this.pyodidePromise=t()}withPyodide(t){return c(this,void 0,void 0,(function*(){const e=yield this.pyodidePromise;try{return yield t(e)}catch(t){throw t.pyodide_fatal_error&&(this.pyodidePromise=this.loader()),t}}))}}})(),a})()));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/pyodide-worker-runner/dist/index.js?')},"./node_modules/pyodide/pyodide.js":function(__unused_webpack_module,exports,__webpack_require__){eval('var __dirname = "/";\n!function(global,factory){ true?factory(exports):0}(this,(function(exports){"use strict";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof __webpack_require__.g?__webpack_require__.g:"undefined"!=typeof self&&self;var errorStackParser={exports:{}},stackframe={exports:{}};!function(module,exports){module.exports=function(){function _isNumber(n){return!isNaN(parseFloat(n))&&isFinite(n)}function _capitalize(str){return str.charAt(0).toUpperCase()+str.substring(1)}function _getter(p){return function(){return this[p]}}var booleanProps=["isConstructor","isEval","isNative","isToplevel"],numericProps=["columnNumber","lineNumber"],stringProps=["fileName","functionName","source"],arrayProps=["args"],objectProps=["evalOrigin"],props=booleanProps.concat(numericProps,stringProps,arrayProps,objectProps);function StackFrame(obj){if(obj)for(var i=0;i-1&&(line=line.replace(/eval code/g,"eval").replace(/(\\(eval at [^()]*)|(,.*$)/g,""));var sanitizedLine=line.replace(/^\\s+/,"").replace(/\\(eval code/g,"(").replace(/^.*?\\s+/,""),location=sanitizedLine.match(/ (\\(.+\\)$)/);sanitizedLine=location?sanitizedLine.replace(location[0],""):sanitizedLine;var locationParts=this.extractLocation(location?location[1]:sanitizedLine),functionName=location&&sanitizedLine||void 0,fileName=["eval",""].indexOf(locationParts[0])>-1?void 0:locationParts[0];return new StackFrame({functionName:functionName,fileName:fileName,lineNumber:locationParts[1],columnNumber:locationParts[2],source:line})}),this)},parseFFOrSafari:function(error){return error.stack.split("\\n").filter((function(line){return!line.match(SAFARI_NATIVE_CODE_REGEXP)}),this).map((function(line){if(line.indexOf(" > eval")>-1&&(line=line.replace(/ line (\\d+)(?: > eval line \\d+)* > eval:\\d+:\\d+/g,":$1")),-1===line.indexOf("@")&&-1===line.indexOf(":"))return new StackFrame({functionName:line});var functionNameRegex=/((.*".+"[^@]*)?[^@]*)(?:@)/,matches=line.match(functionNameRegex),functionName=matches&&matches[1]?matches[1]:void 0,locationParts=this.extractLocation(line.replace(functionNameRegex,""));return new StackFrame({functionName:functionName,fileName:locationParts[0],lineNumber:locationParts[1],columnNumber:locationParts[2],source:line})}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\\n")>-1&&e.message.split("\\n").length>e.stacktrace.split("\\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var lineRE=/Line (\\d+).*script (?:in )?(\\S+)/i,lines=e.message.split("\\n"),result=[],i=2,len=lines.length;i/,"$2").replace(/\\([^)]*\\)/g,"")||void 0;functionCall.match(/\\(([^)]*)\\)/)&&(argsRaw=functionCall.replace(/^[^(]+\\(([^)]*)\\)$/,"$1"));var args=void 0===argsRaw||"[arguments not available]"===argsRaw?void 0:argsRaw.split(",");return new StackFrame({functionName:functionName,args:args,fileName:locationParts[0],lineNumber:locationParts[1],columnNumber:locationParts[2],source:line})}),this)}})}(errorStackParser);var ErrorStackParser=errorStackParser.exports;const IN_NODE="undefined"!=typeof process&&process.release&&"node"===process.release.name&&void 0===process.browser;let nodeUrlMod,nodeFetch,nodePath,nodeVmMod,nodeFsPromisesMod,resolvePath,pathSep,loadBinaryFile,loadScript;if(resolvePath=IN_NODE?function(path,base){return nodePath.resolve(base||".",path)}:function(path,base){return void 0===base&&(base=location),new URL(path,base).toString()},IN_NODE||(pathSep="/"),loadBinaryFile=IN_NODE?async function(path,_file_sub_resource_hash){if(path.startsWith("file://")&&(path=path.slice("file://".length)),path.includes("://")){let response=await nodeFetch(path);if(!response.ok)throw new Error(`Failed to load \'${path}\': request failed.`);return new Uint8Array(await response.arrayBuffer())}{const data=await nodeFsPromisesMod.readFile(path);return new Uint8Array(data.buffer,data.byteOffset,data.byteLength)}}:async function(path,subResourceHash){const url=new URL(path,location);let options=subResourceHash?{integrity:subResourceHash}:{},response=await fetch(url,options);if(!response.ok)throw new Error(`Failed to load \'${url}\': request failed.`);return new Uint8Array(await response.arrayBuffer())},globalThis.document)loadScript=async url=>await import(/* webpackIgnore: true */url);else if(globalThis.importScripts)loadScript=async url=>{try{globalThis.importScripts(url)}catch(e){if(!(e instanceof TypeError))throw e;await import(/* webpackIgnore: true */url)}};else{if(!IN_NODE)throw new Error("Cannot determine runtime environment");loadScript=async function(url){url.startsWith("file://")&&(url=url.slice("file://".length));url.includes("://")?nodeVmMod.runInThisContext(await(await nodeFetch(url)).text()):await import(/* webpackIgnore: true */nodeUrlMod.pathToFileURL(url).href)}}function __values(o){var s="function"==typeof Symbol&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&"number"==typeof o.length)return{next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,m=o[Symbol.asyncIterator];return m?m.call(o):(o=__values(o),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise((function(resolve,reject){(function(resolve,reject,d,v){Promise.resolve(v).then((function(v){resolve({value:v,done:d})}),reject)})(resolve,reject,(v=o[n](v)).done,v.value)}))}}}const getFsHandles=async dirHandle=>{const handles=[];await async function collect(curDirHandle){var e_1,_a;try{for(var _c,_b=__asyncValues(curDirHandle.values());!(_c=await _b.next()).done;){const entry=_c.value;handles.push(entry),"directory"===entry.kind&&await collect(entry)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{_c&&!_c.done&&(_a=_b.return)&&await _a.call(_b)}finally{if(e_1)throw e_1.error}}}(dirHandle);const result=new Map;result.set(".",dirHandle);for(const handle of handles){const relativePath=(await dirHandle.resolve(handle)).join("/");result.set(relativePath,handle)}return result};function finalizeBootstrap(API,config){API.runPythonInternal_dict=API._pyodide._base.eval_code("{}"),API.importlib=API.runPythonInternal("import importlib; importlib");let import_module=API.importlib.import_module;API.sys=import_module("sys"),API.sys.path.insert(0,config.homedir),API.os=import_module("os");let globals=API.runPythonInternal("import __main__; __main__.__dict__"),builtins=API.runPythonInternal("import builtins; builtins.__dict__");var builtins_dict;API.globals=(builtins_dict=builtins,new Proxy(globals,{get:(target,symbol)=>"get"===symbol?key=>{let result=target.get(key);return void 0===result&&(result=builtins_dict.get(key)),result}:"has"===symbol?key=>target.has(key)||builtins_dict.has(key):Reflect.get(target,symbol)}));let importhook=API._pyodide._importhook;importhook.register_js_finder(),importhook.register_js_module("js",config.jsglobals);let pyodide=API.makePublicAPI();return importhook.register_js_module("pyodide_js",pyodide),API.pyodide_py=import_module("pyodide"),API.pyodide_code=import_module("pyodide.code"),API.pyodide_ffi=import_module("pyodide.ffi"),API.package_loader=import_module("pyodide._package_loader"),API.sitepackages=API.package_loader.SITE_PACKAGES.__str__(),API.dsodir=API.package_loader.DSO_DIR.__str__(),API.defaultLdLibraryPath=[API.dsodir,API.sitepackages],API.os.environ.__setitem__("LD_LIBRARY_PATH",API.defaultLdLibraryPath.join(":")),pyodide.pyodide_py=API.pyodide_py,pyodide.globals=API.globals,pyodide}async function loadPyodide(options={}){await async function(){if(!IN_NODE)return;if(nodeUrlMod=(await __webpack_require__.e(/*! import() */ "_5679").then(__webpack_require__.t.bind(__webpack_require__, /*! url */ "?5679", 23))).default,nodeFsPromisesMod=await __webpack_require__.e(/*! import() */ "_3bf2").then(__webpack_require__.t.bind(__webpack_require__, /*! fs/promises */ "?3bf2", 23)),nodeFetch=globalThis.fetch?fetch:(await __webpack_require__.e(/*! import() */ "node_modules_node-fetch_browser_js").then(__webpack_require__.t.bind(__webpack_require__, /*! node-fetch */ "./node_modules/node-fetch/browser.js", 23))).default,nodeVmMod=(await __webpack_require__.e(/*! import() */ "_6add").then(__webpack_require__.t.bind(__webpack_require__, /*! vm */ "?6add", 23))).default,nodePath=await __webpack_require__.e(/*! import() */ "_a0f9").then(__webpack_require__.t.bind(__webpack_require__, /*! path */ "?a0f9", 23)),pathSep=nodePath.sep,"undefined"!="function")return;const node_modules={fs:await __webpack_require__.e(/*! import() */ "_d940").then(__webpack_require__.t.bind(__webpack_require__, /*! fs */ "?d940", 23)),crypto:await __webpack_require__.e(/*! import() */ "_b190").then(__webpack_require__.t.bind(__webpack_require__, /*! crypto */ "?b190", 23)),ws:await __webpack_require__.e(/*! import() */ "_296d").then(__webpack_require__.t.bind(__webpack_require__, /*! ws */ "?296d", 23)),child_process:await __webpack_require__.e(/*! import() */ "_425d").then(__webpack_require__.t.bind(__webpack_require__, /*! child_process */ "?425d", 23))};globalThis.require=function(mod){return node_modules[mod]}}();let indexURL=options.indexURL||function(){if(true)return __dirname;let err;try{throw new Error}catch(e){err=e}let fileName=ErrorStackParser.parse(err)[0].fileName;const indexOfLastSlash=fileName.lastIndexOf(pathSep);if(-1===indexOfLastSlash)throw new Error("Could not extract indexURL path from pyodide module location");return fileName.slice(0,indexOfLastSlash)}();indexURL=resolvePath(indexURL),indexURL.endsWith("/")||(indexURL+="/"),options.indexURL=indexURL;const default_config={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,homedir:"/home/pyodide",lockFileURL:indexURL+"repodata.json",args:[],_node_mounts:[]},config=Object.assign(default_config,options),pyodide_py_tar_promise=loadBinaryFile(config.indexURL+"pyodide_py.tar"),Module=function(){let Module={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:[],quit:(status,toThrow)=>{throw Module.exited={status:status,toThrow:toThrow},toThrow}};return Module}();Module.print=config.stdout,Module.printErr=config.stderr,Module.preRun.push((()=>{for(const mount of config._node_mounts)Module.FS.mkdirTree(mount),Module.FS.mount(Module.NODEFS,{root:mount},mount)})),Module.arguments=config.args;const API={config:config};Module.API=API,function(Module,path){Module.preRun.push((function(){try{Module.FS.mkdirTree(path)}catch(e){console.error(`Error occurred while making a home directory \'${path}\':`),console.error(e),console.error("Using \'/\' for a home directory instead"),path="/"}Module.ENV.HOME=path,Module.FS.chdir(path)}))}(Module,config.homedir);const moduleLoaded=new Promise((r=>Module.postRun=r));if(Module.locateFile=path=>config.indexURL+path,"function"!=typeof _createPyodideModule){const scriptSrc=`${config.indexURL}pyodide.asm.js`;await loadScript(scriptSrc)}if(await _createPyodideModule(Module),await moduleLoaded,Module.exited)throw Module.exited.toThrow;if("0.22.1"!==API.version)throw new Error(`Pyodide version does not match: \'0.22.1\' <==> \'${API.version}\'. If you updated the Pyodide version, make sure you also updated the \'indexURL\' parameter passed to loadPyodide.`);Module.locateFile=path=>{throw new Error("Didn\'t expect to load any more file_packager files!")},function(module){const FS=module.FS,MEMFS=module.FS.filesystems.MEMFS,PATH=module.PATH,nativeFSAsync={DIR_MODE:16895,FILE_MODE:33279,mount:function(mount){if(!mount.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return MEMFS.mount.apply(null,arguments)},syncfs:async(mount,populate,callback)=>{try{const local=nativeFSAsync.getLocalSet(mount),remote=await nativeFSAsync.getRemoteSet(mount),src=populate?remote:local,dst=populate?local:remote;await nativeFSAsync.reconcile(mount,src,dst),callback(null)}catch(e){callback(e)}},getLocalSet:mount=>{let entries=Object.create(null);function isRealDir(p){return"."!==p&&".."!==p}function toAbsolute(root){return p=>PATH.join2(root,p)}let check=FS.readdir(mount.mountpoint).filter(isRealDir).map(toAbsolute(mount.mountpoint));for(;check.length;){let path=check.pop(),stat=FS.stat(path);FS.isDir(stat.mode)&&check.push.apply(check,FS.readdir(path).filter(isRealDir).map(toAbsolute(path))),entries[path]={timestamp:stat.mtime,mode:stat.mode}}return{type:"local",entries:entries}},getRemoteSet:async mount=>{const entries=Object.create(null),handles=await getFsHandles(mount.opts.fileSystemHandle);for(const[path,handle]of handles)"."!==path&&(entries[PATH.join2(mount.mountpoint,path)]={timestamp:"file"===handle.kind?(await handle.getFile()).lastModifiedDate:new Date,mode:"file"===handle.kind?nativeFSAsync.FILE_MODE:nativeFSAsync.DIR_MODE});return{type:"remote",entries:entries,handles:handles}},loadLocalEntry:path=>{const node=FS.lookupPath(path).node,stat=FS.stat(path);if(FS.isDir(stat.mode))return{timestamp:stat.mtime,mode:stat.mode};if(FS.isFile(stat.mode))return node.contents=MEMFS.getFileDataAsTypedArray(node),{timestamp:stat.mtime,mode:stat.mode,contents:node.contents};throw new Error("node type not supported")},storeLocalEntry:(path,entry)=>{if(FS.isDir(entry.mode))FS.mkdirTree(path,entry.mode);else{if(!FS.isFile(entry.mode))throw new Error("node type not supported");FS.writeFile(path,entry.contents,{canOwn:!0})}FS.chmod(path,entry.mode),FS.utime(path,entry.timestamp,entry.timestamp)},removeLocalEntry:path=>{var stat=FS.stat(path);FS.isDir(stat.mode)?FS.rmdir(path):FS.isFile(stat.mode)&&FS.unlink(path)},loadRemoteEntry:async handle=>{if("file"===handle.kind){const file=await handle.getFile();return{contents:new Uint8Array(await file.arrayBuffer()),mode:nativeFSAsync.FILE_MODE,timestamp:file.lastModifiedDate}}if("directory"===handle.kind)return{mode:nativeFSAsync.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+handle.kind)},storeRemoteEntry:async(handles,path,entry)=>{const parentDirHandle=handles.get(PATH.dirname(path)),handle=FS.isFile(entry.mode)?await parentDirHandle.getFileHandle(PATH.basename(path),{create:!0}):await parentDirHandle.getDirectoryHandle(PATH.basename(path),{create:!0});if("file"===handle.kind){const writable=await handle.createWritable();await writable.write(entry.contents),await writable.close()}handles.set(path,handle)},removeRemoteEntry:async(handles,path)=>{const parentDirHandle=handles.get(PATH.dirname(path));await parentDirHandle.removeEntry(PATH.basename(path)),handles.delete(path)},reconcile:async(mount,src,dst)=>{let total=0;const create=[];Object.keys(src.entries).forEach((function(key){const e=src.entries[key],e2=dst.entries[key];(!e2||FS.isFile(e.mode)&&e.timestamp.getTime()>e2.timestamp.getTime())&&(create.push(key),total++)})),create.sort();const remove=[];if(Object.keys(dst.entries).forEach((function(key){src.entries[key]||(remove.push(key),total++)})),remove.sort().reverse(),!total)return;const handles="remote"===src.type?src.handles:dst.handles;for(const path of create){const relPath=PATH.normalize(path.replace(mount.mountpoint,"/")).substring(1);if("local"===dst.type){const handle=handles.get(relPath),entry=await nativeFSAsync.loadRemoteEntry(handle);nativeFSAsync.storeLocalEntry(path,entry)}else{const entry=nativeFSAsync.loadLocalEntry(path);await nativeFSAsync.storeRemoteEntry(handles,relPath,entry)}}for(const path of remove)if("local"===dst.type)nativeFSAsync.removeLocalEntry(path);else{const relPath=PATH.normalize(path.replace(mount.mountpoint,"/")).substring(1);await nativeFSAsync.removeRemoteEntry(handles,relPath)}}};module.FS.filesystems.NATIVEFS_ASYNC=nativeFSAsync}(Module);const pyodide_py_tar=await pyodide_py_tar_promise;!function(Module,pyodide_py_tar){let stream=Module.FS.open("/pyodide_py.tar","w");Module.FS.write(stream,pyodide_py_tar,0,pyodide_py_tar.byteLength,void 0,!0),Module.FS.close(stream);let[errcode,captured_stderr]=Module.API.rawRun(\'\\nfrom sys import version_info\\npyversion = f"python{version_info.major}.{version_info.minor}"\\nimport shutil\\nshutil.unpack_archive("/pyodide_py.tar", f"/lib/{pyversion}/")\\ndel shutil\\nimport importlib\\nimportlib.invalidate_caches()\\ndel importlib\\n\');errcode&&Module.API.fatal_loading_error("Failed to unpack standard library.\\n",captured_stderr),Module.FS.unlink("/pyodide_py.tar")}(Module,pyodide_py_tar);let[err,captured_stderr]=API.rawRun("import _pyodide_core");err&&Module.API.fatal_loading_error("Failed to import _pyodide_core\\n",captured_stderr);const pyodide=finalizeBootstrap(API,config);if(pyodide.version.includes("dev")||API.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${pyodide.version}/full/`),await API.packageIndexReady,API._pyodide._importhook.register_module_not_found_hook(API._import_name_to_package_name),"0.22.1"!==API.repodata_info.version)throw new Error("Lock file version doesn\'t match Pyodide version");return API.package_loader.init_loaded_packages(),config.fullStdLib&&await pyodide.loadPackage(API._pyodide._importhook.UNVENDORED_STDLIBS),API.initializeStreams(config.stdin,config.stdout,config.stderr),pyodide}globalThis.loadPyodide=loadPyodide,exports.loadPyodide=loadPyodide,exports.version="0.22.1",Object.defineProperty(exports,"__esModule",{value:!0})}));\n//# sourceMappingURL=pyodide.js.map\n\n\n//# sourceURL=webpack://Papyros/./node_modules/pyodide/pyodide.js?')},"./src/Papyros.css":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleDomAPI.js */ "./node_modules/style-loader/dist/runtime/styleDomAPI.js");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertBySelector.js */ "./node_modules/style-loader/dist/runtime/insertBySelector.js");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js */ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertStyleElement.js */ "./node_modules/style-loader/dist/runtime/insertStyleElement.js");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleTagTransform.js */ "./node_modules/style-loader/dist/runtime/styleTagTransform.js");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_node_modules_postcss_loader_dist_cjs_js_Papyros_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../node_modules/css-loader/dist/cjs.js!../node_modules/postcss-loader/dist/cjs.js!./Papyros.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/dist/cjs.js!./src/Papyros.css");\n\n \n \n \n \n \n \n \n \n \n\nvar options = {};\n\noptions.styleTagTransform = (_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());\noptions.setAttributes = (_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default());\n\n options.insert = _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, "head");\n \noptions.domAPI = (_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());\noptions.insertStyleElement = (_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_node_modules_postcss_loader_dist_cjs_js_Papyros_css__WEBPACK_IMPORTED_MODULE_6__["default"], options);\n\n\n\n\n /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_node_modules_postcss_loader_dist_cjs_js_Papyros_css__WEBPACK_IMPORTED_MODULE_6__["default"] && _node_modules_css_loader_dist_cjs_js_node_modules_postcss_loader_dist_cjs_js_Papyros_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals ? _node_modules_css_loader_dist_cjs_js_node_modules_postcss_loader_dist_cjs_js_Papyros_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals : undefined);\n\n\n//# sourceURL=webpack://Papyros/./src/Papyros.css?')},"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":module=>{"use strict";eval('\n\nvar stylesInDOM = [];\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n for (var i = 0; i < stylesInDOM.length; i++) {\n if (stylesInDOM[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n return result;\n}\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = "".concat(id, " ").concat(count);\n idCountMap[id] = count + 1;\n var indexByIdentifier = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3],\n supports: item[4],\n layer: item[5]\n };\n if (indexByIdentifier !== -1) {\n stylesInDOM[indexByIdentifier].references++;\n stylesInDOM[indexByIdentifier].updater(obj);\n } else {\n var updater = addElementStyle(obj, options);\n options.byIndex = i;\n stylesInDOM.splice(i, 0, {\n identifier: identifier,\n updater: updater,\n references: 1\n });\n }\n identifiers.push(identifier);\n }\n return identifiers;\n}\nfunction addElementStyle(obj, options) {\n var api = options.domAPI(options);\n api.update(obj);\n var updater = function updater(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {\n return;\n }\n api.update(obj = newObj);\n } else {\n api.remove();\n }\n };\n return updater;\n}\nmodule.exports = function (list, options) {\n options = options || {};\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDOM[index].references--;\n }\n var newLastIdentifiers = modulesToDom(newList, options);\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n var _index = getIndexByIdentifier(_identifier);\n if (stylesInDOM[_index].references === 0) {\n stylesInDOM[_index].updater();\n stylesInDOM.splice(_index, 1);\n }\n }\n lastIdentifiers = newLastIdentifiers;\n };\n};\n\n//# sourceURL=webpack://Papyros/./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?')},"./node_modules/style-loader/dist/runtime/insertBySelector.js":module=>{"use strict";eval('\n\nvar memo = {};\n\n/* istanbul ignore next */\nfunction getTarget(target) {\n if (typeof memo[target] === "undefined") {\n var styleTarget = document.querySelector(target);\n\n // Special case to return head of iframe instead of iframe itself\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n memo[target] = styleTarget;\n }\n return memo[target];\n}\n\n/* istanbul ignore next */\nfunction insertBySelector(insert, style) {\n var target = getTarget(insert);\n if (!target) {\n throw new Error("Couldn\'t find a style target. This probably means that the value for the \'insert\' parameter is invalid.");\n }\n target.appendChild(style);\n}\nmodule.exports = insertBySelector;\n\n//# sourceURL=webpack://Papyros/./node_modules/style-loader/dist/runtime/insertBySelector.js?')},"./node_modules/style-loader/dist/runtime/insertStyleElement.js":module=>{"use strict";eval('\n\n/* istanbul ignore next */\nfunction insertStyleElement(options) {\n var element = document.createElement("style");\n options.setAttributes(element, options.attributes);\n options.insert(element, options.options);\n return element;\n}\nmodule.exports = insertStyleElement;\n\n//# sourceURL=webpack://Papyros/./node_modules/style-loader/dist/runtime/insertStyleElement.js?')},"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\n\n/* istanbul ignore next */\nfunction setAttributesWithoutAttributes(styleElement) {\n var nonce = true ? __webpack_require__.nc : 0;\n if (nonce) {\n styleElement.setAttribute("nonce", nonce);\n }\n}\nmodule.exports = setAttributesWithoutAttributes;\n\n//# sourceURL=webpack://Papyros/./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js?')},"./node_modules/style-loader/dist/runtime/styleDomAPI.js":module=>{"use strict";eval('\n\n/* istanbul ignore next */\nfunction apply(styleElement, options, obj) {\n var css = "";\n if (obj.supports) {\n css += "@supports (".concat(obj.supports, ") {");\n }\n if (obj.media) {\n css += "@media ".concat(obj.media, " {");\n }\n var needLayer = typeof obj.layer !== "undefined";\n if (needLayer) {\n css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");\n }\n css += obj.css;\n if (needLayer) {\n css += "}";\n }\n if (obj.media) {\n css += "}";\n }\n if (obj.supports) {\n css += "}";\n }\n var sourceMap = obj.sourceMap;\n if (sourceMap && typeof btoa !== "undefined") {\n css += "\\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");\n }\n\n // For old IE\n /* istanbul ignore if */\n options.styleTagTransform(css, styleElement, options.options);\n}\nfunction removeStyleElement(styleElement) {\n // istanbul ignore if\n if (styleElement.parentNode === null) {\n return false;\n }\n styleElement.parentNode.removeChild(styleElement);\n}\n\n/* istanbul ignore next */\nfunction domAPI(options) {\n if (typeof document === "undefined") {\n return {\n update: function update() {},\n remove: function remove() {}\n };\n }\n var styleElement = options.insertStyleElement(options);\n return {\n update: function update(obj) {\n apply(styleElement, options, obj);\n },\n remove: function remove() {\n removeStyleElement(styleElement);\n }\n };\n}\nmodule.exports = domAPI;\n\n//# sourceURL=webpack://Papyros/./node_modules/style-loader/dist/runtime/styleDomAPI.js?')},"./node_modules/style-loader/dist/runtime/styleTagTransform.js":module=>{"use strict";eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElement) {\n if (styleElement.styleSheet) {\n styleElement.styleSheet.cssText = css;\n } else {\n while (styleElement.firstChild) {\n styleElement.removeChild(styleElement.firstChild);\n }\n styleElement.appendChild(document.createTextNode(css));\n }\n}\nmodule.exports = styleTagTransform;\n\n//# sourceURL=webpack://Papyros/./node_modules/style-loader/dist/runtime/styleTagTransform.js?")},"./node_modules/sync-message/dist/index.js":module=>{eval('!function(e,t){ true?module.exports=t():0}(self,(function(){return(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{isServiceWorkerRequest:()=>s,serviceWorkerFetchListener:()=>i,asyncSleep:()=>u,ServiceWorkerError:()=>c,writeMessageAtomics:()=>a,writeMessageServiceWorker:()=>f,writeMessage:()=>d,makeChannel:()=>l,makeAtomicsChannel:()=>m,makeServiceWorkerChannel:()=>y,readMessage:()=>h,syncSleep:()=>g,uuidv4:()=>w});var r=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function u(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,u)}c((n=n.apply(e,t||[])).next())}))};const n="__SyncMessageServiceWorkerInput__",o="__sync-message-v2__";function s(e){return"string"!=typeof e&&(e=e.request.url),e.includes(n)}function i(){const e={},t={};return n=>{const{url:i}=n.request;return!!s(i)&&(n.respondWith(function(){return r(this,void 0,void 0,(function*(){function r(e){const t={message:e,version:o};return new Response(JSON.stringify(t),{status:200})}if(i.endsWith("/read")){const{messageId:o,timeout:s}=yield n.request.json();if(o in e){const t=e[o];return delete e[o],r(t)}return yield new Promise((e=>{t[o]=e,setTimeout((function(){delete t[o],e(new Response("",{status:408}))}),s)}))}if(i.endsWith("/write")){const{message:o,messageId:s}=yield n.request.json(),i=t[s];return i?(i(r(o)),delete t[s]):e[s]=o,r({early:!i})}if(i.endsWith("/version"))return new Response(o,{status:200})}))}()),!0)}}function u(e){return new Promise((t=>setTimeout(t,e)))}class c extends Error{constructor(e,t){super(`Received status ${t} from ${e}. Ensure the service worker is registered and active.`),this.url=e,this.status=t,this.type="ServiceWorkerError",Object.setPrototypeOf(this,c.prototype)}}function a(e,t){const r=(new TextEncoder).encode(JSON.stringify(t)),{data:n,meta:o}=e;if(r.length>n.length)throw new Error("Message is too big, increase bufferSize when making channel.");n.set(r,0),Atomics.store(o,0,r.length),Atomics.store(o,1,1),Atomics.notify(o,1)}function f(e,t,n){return r(this,void 0,void 0,(function*(){yield navigator.serviceWorker.ready;const r=e.baseUrl+"/write",s=Date.now();for(;;){const i={message:t,messageId:n},a=yield fetch(r,{method:"POST",body:JSON.stringify(i)});if(200===a.status&&(yield a.json()).version===o)return;if(!(Date.now()-s0?+e:t}function h(e,t,{checkInterrupt:r,checkTimeout:n,timeout:s}={}){const i=performance.now();n=p(n,r?100:5e3);const u=p(s,Number.POSITIVE_INFINITY);let a;if("atomics"===e.type){const{data:t,meta:r}=e;a=()=>{if("timed-out"===Atomics.wait(r,1,0,n))return null;{const e=Atomics.exchange(r,0,0),n=t.slice(0,e);Atomics.store(r,1,0);const o=(new TextDecoder).decode(n);return JSON.parse(o)}}}else a=()=>{const r=new XMLHttpRequest,s=e.baseUrl+"/read";r.open("POST",s,!1);const u={messageId:t,timeout:n};r.send(JSON.stringify(u));const{status:a}=r;if(408===a)return null;if(200===a){const e=JSON.parse(r.responseText);return e.version!==o?null:e.message}if(performance.now()-i{const t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))},t})()}));\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/sync-message/dist/index.js?')},"./src/App.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Papyros_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Papyros.css */ "./src/Papyros.css");\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Constants */ "./src/Constants.ts");\n/* harmony import */ var _Papyros__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Papyros */ "./src/Papyros.ts");\n/* harmony import */ var _InputManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./InputManager */ "./src/InputManager.ts");\n/* harmony import */ var _input_BatchInputHandler__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./input/BatchInputHandler */ "./src/input/BatchInputHandler.ts");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\n\n\n\nconst LOCAL_STORAGE_KEYS = {\n code: (0,_Constants__WEBPACK_IMPORTED_MODULE_1__.addPapyrosPrefix)("previous-code"),\n input: (0,_Constants__WEBPACK_IMPORTED_MODULE_1__.addPapyrosPrefix)("previous-batch-input")\n};\nfunction setUpEditor(editor, storageKey) {\n const previousValue = window.localStorage.getItem(storageKey);\n if (previousValue) {\n editor.setText(previousValue);\n }\n editor.onChange({\n onChange: (text) => {\n window.localStorage.setItem(storageKey, text);\n },\n delay: 0\n });\n}\nfunction startPapyros() {\n return __awaiter(this, void 0, void 0, function* () {\n // Retrieve initial locale and programming language from URL\n // This allows easier sharing of Papyros-related links with others\n // While preventing loading an unwanted backend\n const urlParams = new URLSearchParams(window.location.search);\n const language = _Papyros__WEBPACK_IMPORTED_MODULE_2__.Papyros.toProgrammingLanguage(urlParams.get("language") ||\n _Constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_PROGRAMMING_LANGUAGE);\n const locale = urlParams.get("locale") || _Constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_LOCALE;\n const config = {\n standAlone: true,\n programmingLanguage: language,\n locale: locale,\n inputMode: _InputManager__WEBPACK_IMPORTED_MODULE_3__.InputMode.Batch,\n channelOptions: {\n serviceWorkerName: _Constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SERVICE_WORKER\n }\n };\n const papyros = new _Papyros__WEBPACK_IMPORTED_MODULE_2__.Papyros(config);\n let darkMode = false;\n if (window.matchMedia) {\n darkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;\n window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", e => {\n papyros.setDarkMode(e.matches);\n });\n }\n papyros.render({\n standAloneOptions: {\n parentElementId: "root"\n },\n darkMode: darkMode,\n traceOptions: {\n parentElementId: "trace-root"\n }\n });\n setUpEditor(papyros.codeRunner.editor, LOCAL_STORAGE_KEYS.code);\n papyros.codeRunner.editor.focus();\n const handler = papyros.codeRunner.inputManager.getInputHandler(_InputManager__WEBPACK_IMPORTED_MODULE_3__.InputMode.Batch);\n if (handler instanceof _input_BatchInputHandler__WEBPACK_IMPORTED_MODULE_4__.BatchInputHandler) {\n setUpEditor(handler.batchEditor, LOCAL_STORAGE_KEYS.input);\n }\n yield papyros.launch();\n });\n}\nstartPapyros();\n\n\n//# sourceURL=webpack://Papyros/./src/App.ts?')},"./src/Backend.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Backend: () => (/* binding */ Backend),\n/* harmony export */ RunMode: () => (/* binding */ RunMode)\n/* harmony export */ });\n/* harmony import */ var _BackendEvent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BackendEvent */ "./src/BackendEvent.ts");\n/* harmony import */ var comsync__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! comsync */ "./node_modules/comsync/dist/index.js");\n/* harmony import */ var comsync__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(comsync__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _BackendEventQueue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BackendEventQueue */ "./src/BackendEventQueue.ts");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\n\nvar RunMode;\n(function (RunMode) {\n RunMode["Run"] = "run";\n RunMode["Debug"] = "debug";\n RunMode["Doctest"] = "doctest";\n})(RunMode || (RunMode = {}));\nclass Backend {\n /**\n * Constructor is limited as it is meant to be used as a WebWorker\n * Proper initialization occurs in the launch method when the worker is started\n * Synchronously exposing methods should be done here\n */\n constructor() {\n this.extras = {};\n this.onEvent = () => {\n // Empty, initialized in launch\n };\n this.runCode = this.syncExpose()(this.runCode.bind(this));\n this.queue = {};\n }\n /**\n * @return {any} The function to expose methods for Comsync to allow interrupting\n */\n syncExpose() {\n return comsync__WEBPACK_IMPORTED_MODULE_2__.syncExpose;\n }\n /**\n * Initialize the backend by doing all setup-related work\n * @param {function(BackendEvent):void} onEvent Callback for when events occur\n * @param {function():void} onOverflow Callback for when overflow occurs\n * @return {Promise} Promise of launching\n */\n launch(onEvent, onOverflow) {\n return __awaiter(this, void 0, void 0, function* () {\n this.onEvent = (e) => {\n onEvent(e);\n if (e.type === _BackendEvent__WEBPACK_IMPORTED_MODULE_0__.BackendEventType.Sleep) {\n return this.extras.syncSleep(e.data);\n }\n else if (e.type === _BackendEvent__WEBPACK_IMPORTED_MODULE_0__.BackendEventType.Input) {\n return this.extras.readMessage();\n }\n };\n this.queue = new _BackendEventQueue__WEBPACK_IMPORTED_MODULE_1__.BackendEventQueue(this.onEvent.bind(this), onOverflow);\n return Promise.resolve();\n });\n }\n /**\n * Determine whether the modes supported by this Backend are active\n * @param {string} code The current code in the editor\n * @return {Array} The run modes of this Backend\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n runModes(code) {\n return [];\n }\n /**\n * @return {boolean} Whether too many output events were generated\n */\n hasOverflow() {\n return this.queue.hasOverflow();\n }\n /**\n * @return {Array} The events that happened after overflow\n */\n getOverflow() {\n return this.queue.getOverflow();\n }\n /**\n * Provide files to be used by the backend\n * @param {Record} inlineFiles Map of file names to their contents\n * @param {Record} hrefFiles Map of file names to URLS with their contents\n * @return {Promise} Resolves when the files are present in the backend\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n provideFiles(inlineFiles, hrefFiles) {\n return Promise.resolve();\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/Backend.ts?')},"./src/BackendEvent.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BackendEventType: () => (/* binding */ BackendEventType)\n/* harmony export */ });\n/**\n * Enum representing all possible types for supported events\n */\nvar BackendEventType;\n(function (BackendEventType) {\n BackendEventType["Start"] = "start";\n BackendEventType["End"] = "end";\n BackendEventType["Input"] = "input";\n BackendEventType["Output"] = "output";\n BackendEventType["Sleep"] = "sleep";\n BackendEventType["Error"] = "error";\n BackendEventType["Interrupt"] = "interrupt";\n BackendEventType["Loading"] = "loading";\n BackendEventType["Frame"] = "frame";\n BackendEventType["FrameChange"] = "frame-change";\n BackendEventType["Stop"] = "stop";\n})(BackendEventType || (BackendEventType = {}));\n\n\n//# sourceURL=webpack://Papyros/./src/BackendEvent.ts?')},"./src/BackendEventQueue.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BackendEventQueue: () => (/* binding */ BackendEventQueue)\n/* harmony export */ });\n/* harmony import */ var _BackendEvent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BackendEvent */ "./src/BackendEvent.ts");\n\n/**\n * Queue to limit the amount of messages sent between threads\n * This prevents communication issues which arise either in Comlink\n * or in the WebWorker message passing code\n */\nclass BackendEventQueue {\n /**\n * @param {function(BackendEvent):void} callback Function to process events in the queue\n * @param {function():void} onOverflow Callback for when overflow occurs\n * @param {number} limit The maximal amount of output lines to send before overflowing\n * @param {number} flushTime The time in milliseconds before sending events through\n */\n constructor(callback, onOverflow, limit = 1000, flushTime = 100) {\n this.callback = callback;\n this.limit = limit;\n this.flushTime = flushTime;\n this.queue = [];\n this.overflow = [];\n this.onOverflow = onOverflow;\n this.overflown = false;\n this.lastFlushTime = new Date().getTime();\n this.sendCount = 0;\n this.decoder = new TextDecoder();\n }\n /**\n * Add an element to the queue\n * @param {BackendEventType} type The type of the event\n * @param {string | BufferSource} text The data for the event\n * @param {string | any} extra Extra data for the event\n * If string, interpreted as the contentType\n * If anything else, it should contain a contentType\n * If the contentType is not textual, an error is thrown\n */\n put(type, text, extra) {\n let stringData = "";\n if (typeof text !== "string") {\n stringData = this.decoder.decode(text);\n }\n else {\n stringData = text;\n }\n let extraArgs = {};\n let contentType = "text/plain";\n if (extra) {\n if (typeof extra === "string") {\n contentType = extra;\n }\n else {\n contentType = extra["contentType"];\n delete extra["contentType"];\n extraArgs = extra;\n }\n }\n if (this.queue.length === 0 ||\n !contentType.startsWith("text") || // Non textual cannot be combined\n this.queue[this.queue.length - 1].type !== type || // Different type\n // Can\'t be combined if contentType doesn\'t match\n this.queue[this.queue.length - 1].contentType !== contentType) {\n this.queue.push(Object.assign({ type: type, data: stringData, contentType: contentType }, extraArgs));\n }\n else { // Same kind of event, combine into one\n this.queue[this.queue.length - 1].data += stringData;\n }\n if (this.shouldFlush()) {\n this.flush();\n }\n }\n /**\n * @return {boolean} Whether the queue contents should be flushed\n */\n shouldFlush() {\n return this.queue.length > 1 || // different types of Events present\n new Date().getTime() - this.lastFlushTime > this.flushTime;\n }\n /**\n * Reset the queue contents for a new run\n */\n reset() {\n this.queue = [];\n this.overflow = [];\n this.overflown = false;\n this.lastFlushTime = new Date().getTime();\n this.sendCount = 0;\n }\n /**\n * @param {BackendEvent} e The event put in the queue\n * @return {number} The amount of lines of data in the event\n */\n static lines(e) {\n return (e.data.match(/\\n/g) || []).length + 1;\n }\n /**\n * Flush the queue contents using the callback\n */\n flush() {\n this.queue.forEach(e => {\n if (e.type === _BackendEvent__WEBPACK_IMPORTED_MODULE_0__.BackendEventType.Output) {\n this.overflow.push(e);\n if (this.sendCount < this.limit) {\n this.sendCount += BackendEventQueue.lines(e);\n this.callback(e);\n }\n else if (!this.overflown) {\n this.overflown = true;\n this.onOverflow();\n }\n }\n else {\n this.callback(e);\n }\n });\n this.queue = [];\n this.lastFlushTime = new Date().getTime();\n }\n /**\n * @return {boolean} Whether too many output events were generated\n */\n hasOverflow() {\n return this.overflown;\n }\n /**\n * @return {Array} The events that happened after overflow\n */\n getOverflow() {\n return this.overflow;\n }\n /**\n * @param {Function} callback The event-consuming callback\n */\n setCallback(callback) {\n this.callback = callback;\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/BackendEventQueue.ts?')},"./src/BackendManager.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BackendManager: () => (/* binding */ BackendManager)\n/* harmony export */ });\n/* harmony import */ var _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ProgrammingLanguage */ "./src/ProgrammingLanguage.ts");\n/* harmony import */ var _BackendEvent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BackendEvent */ "./src/BackendEvent.ts");\n/* harmony import */ var _util_Logging__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/Logging */ "./src/util/Logging.ts");\n/* harmony import */ var sync_message__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! sync-message */ "./node_modules/sync-message/dist/index.js");\n/* harmony import */ var sync_message__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(sync_message__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var comsync__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! comsync */ "./node_modules/comsync/dist/index.js");\n/* harmony import */ var comsync__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(comsync__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var pyodide_worker_runner__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! pyodide-worker-runner */ "./node_modules/pyodide-worker-runner/dist/index.js");\n/* harmony import */ var pyodide_worker_runner__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(pyodide_worker_runner__WEBPACK_IMPORTED_MODULE_4__);\n\n\n\n\n\n\n/**\n * Abstract class to implement the singleton pattern\n * Static methods group functionality\n */\nclass BackendManager {\n /**\n * @param {ProgrammingLanguage} language The language to support\n * @param {Function} backendCreator The constructor for a SyncClient\n */\n static registerBackend(language, backendCreator) {\n BackendManager.removeBackend(language);\n BackendManager.createBackendMap.set(language, backendCreator);\n }\n /**\n * Start a backend for the given language and cache for reuse\n * @param {ProgrammingLanguage} language The programming language supported by the backend\n * @return {SyncClient} A SyncClient for the Backend\n */\n static getBackend(language) {\n if (this.backendMap.has(language)) { // Cached\n return this.backendMap.get(language);\n }\n else if (this.createBackendMap.has(language)) {\n // Create and then cache\n const syncClient = this.createBackendMap.get(language)();\n this.backendMap.set(language, syncClient);\n return syncClient;\n }\n else {\n throw new Error(`${language} is not yet supported.`);\n }\n }\n /**\n * Remove a backend for the given language\n * @param {ProgrammingLanguage} language The programming language supported by the backend\n * @return {boolean} Whether the remove operation had any effect\n */\n static removeBackend(language) {\n this.backendMap.delete(language);\n return this.createBackendMap.delete(language);\n }\n /**\n * Register a callback for when an event of a certain type is published\n * @param {BackendEventType} type The type of event to subscribe to\n * @param {BackendEventListener} subscriber Callback for when an event\n * of the given type is published\n */\n static subscribe(type, subscriber) {\n if (!this.subscriberMap.has(type)) {\n this.subscriberMap.set(type, []);\n }\n const subscribers = this.subscriberMap.get(type);\n if (!subscribers.includes(subscriber)) {\n subscribers.push(subscriber);\n }\n }\n /**\n * Publish an event, notifying all listeners for its type\n * @param {BackendEventType} e The event to publish\n */\n static publish(e) {\n (0,_util_Logging__WEBPACK_IMPORTED_MODULE_2__.papyrosLog)(_util_Logging__WEBPACK_IMPORTED_MODULE_2__.LogType.Debug, "Publishing event: ", e);\n if (e.type === _BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Start) {\n BackendManager.halted = false;\n }\n if ((!BackendManager.halted || e.type === _BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.FrameChange) && this.subscriberMap.has(e.type)) {\n this.subscriberMap.get(e.type).forEach(cb => cb(e));\n }\n }\n static halt() {\n BackendManager.halted = true;\n }\n}\n/**\n * Initialise the fields and setup the maps\n */\n(() => {\n BackendManager.channel = (0,sync_message__WEBPACK_IMPORTED_MODULE_3__.makeChannel)();\n BackendManager.createBackendMap = new Map();\n BackendManager.backendMap = new Map();\n BackendManager.subscriberMap = new Map();\n BackendManager.registerBackend(_ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__.ProgrammingLanguage.Python, () => new pyodide_worker_runner__WEBPACK_IMPORTED_MODULE_4__.PyodideClient(() => new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u("src_workers_python_worker_ts"), __webpack_require__.b)), BackendManager.channel));\n BackendManager.registerBackend(_ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__.ProgrammingLanguage.JavaScript, () => new comsync__WEBPACK_IMPORTED_MODULE_5__.SyncClient(() => new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u("src_workers_javascript_worker_ts"), __webpack_require__.b)), BackendManager.channel));\n BackendManager.halted = false;\n BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.End, () => BackendManager.halt());\n BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Interrupt, () => BackendManager.halt());\n})();\n\n\n//# sourceURL=webpack://Papyros/./src/BackendManager.ts?')},"./src/CodeRunner.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CodeRunner: () => (/* binding */ CodeRunner),\n/* harmony export */ RunState: () => (/* binding */ RunState)\n/* harmony export */ });\n/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs");\n/* harmony import */ var _Backend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Backend */ "./src/Backend.ts");\n/* harmony import */ var _BackendEvent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BackendEvent */ "./src/BackendEvent.ts");\n/* harmony import */ var _BackendManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BackendManager */ "./src/BackendManager.ts");\n/* harmony import */ var _editor_CodeEditor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./editor/CodeEditor */ "./src/editor/CodeEditor.ts");\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Constants */ "./src/Constants.ts");\n/* harmony import */ var _InputManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./InputManager */ "./src/InputManager.ts");\n/* harmony import */ var _util_HTMLShapes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util/HTMLShapes */ "./src/util/HTMLShapes.ts");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _util_Rendering__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./util/Rendering */ "./src/util/Rendering.ts");\n/* harmony import */ var _OutputManager__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./OutputManager */ "./src/OutputManager.ts");\n/* harmony import */ var _Debugger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Debugger */ "./src/Debugger.ts");\nvar __runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\nvar __esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }\n var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";\n var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === "accessor") {\n if (result === void 0) continue;\n if (result === null || typeof result !== "object") throw new TypeError("Object expected");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === "field") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\n\n\n\n\n\n\n\n\n\n\n\nconst MODE_ICONS = {\n "debug": "",\n "doctest": "",\n "run": ""\n};\nconst DEBUG_STOP_ICON = "";\n/**\n * Enum representing the possible states while processing code\n */\nvar RunState;\n(function (RunState) {\n RunState["Loading"] = "loading";\n RunState["Running"] = "running";\n RunState["AwaitingInput"] = "awaiting_input";\n RunState["Stopping"] = "stopping";\n RunState["Ready"] = "ready";\n})(RunState || (RunState = {}));\n/**\n * Helper class to avoid code duplication when handling buttons\n * It is an ordered array that does not allow duplicate ids\n */\nclass ButtonArray extends Array {\n add(button, onClick) {\n this.remove(button.id);\n this.push({\n id: button.id,\n buttonHTML: (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_8__.renderButton)(button),\n onClick\n });\n }\n remove(id) {\n const existingIndex = this.findIndex(b => b.id === id);\n if (existingIndex !== -1) {\n this.splice(existingIndex, 1);\n }\n }\n}\n/*\n * class function decorator that adds a delay,\n * so that the function is only called after the delay has passed\n *\n * If it is called again before the delay has passed, the previous call is cancelled\n */\nfunction delay(delay) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n return function (original, context) {\n let timeout;\n return function (...args) {\n clearTimeout(timeout);\n timeout = setTimeout(() => original.apply(this, args), delay);\n };\n };\n}\n/**\n * Helper component to manage and visualize the current RunState\n */\nlet CodeRunner = (() => {\n var _a;\n let _classSuper = _util_Rendering__WEBPACK_IMPORTED_MODULE_8__.Renderable;\n let _instanceExtraInitializers = [];\n let _renderButtons_decorators;\n return _a = class CodeRunner extends _classSuper {\n /**\n * Construct a new RunStateManager with the given listeners\n * @param {ProgrammingLanguage} programmingLanguage The language to use\n * @param {InputMode} inputMode The input mode to use\n */\n constructor(programmingLanguage, inputMode) {\n super();\n /**\n * The currently used programming language\n */\n this.programmingLanguage = __runInitializers(this, _instanceExtraInitializers);\n // True while running or viewing with debugger\n this._debugMode = false;\n this.programmingLanguage = programmingLanguage;\n this.editor = new _editor_CodeEditor__WEBPACK_IMPORTED_MODULE_3__.CodeEditor(() => {\n if (this.state === RunState.Ready) {\n this.runCode();\n }\n });\n this.inputManager = new _InputManager__WEBPACK_IMPORTED_MODULE_5__.InputManager((input) => __awaiter(this, void 0, void 0, function* () {\n const backend = yield this.backend;\n backend.writeMessage(input);\n this.setState(RunState.Running);\n }), inputMode);\n this.outputManager = new _OutputManager__WEBPACK_IMPORTED_MODULE_9__.OutputManager();\n this.backend = Promise.resolve({});\n this.userButtons = new ButtonArray();\n this.runButtons = new ButtonArray();\n this.updateRunButtons([_Backend__WEBPACK_IMPORTED_MODULE_0__.RunMode.Debug]);\n this.editor.onChange({\n onChange: (code) => __awaiter(this, void 0, void 0, function* () {\n const backend = yield this.backend;\n const modes = yield backend.workerProxy.runModes(code);\n this.updateRunButtons(modes);\n this.renderButtons();\n }),\n delay: _Constants__WEBPACK_IMPORTED_MODULE_4__.DEFAULT_EDITOR_DELAY\n });\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Input, () => this.setState(RunState.AwaitingInput));\n this.loadingPackages = [];\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Loading, e => this.onLoad(e));\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Start, e => this.onStart(e));\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Stop, () => this.stop());\n this.previousState = RunState.Ready;\n this.runStartTime = new Date().getTime();\n this.state = RunState.Ready;\n this.traceViewer = new _Debugger__WEBPACK_IMPORTED_MODULE_10__.Debugger();\n }\n set debugMode(debugMode) {\n this._debugMode = debugMode;\n this.renderButtons();\n if (this.inputManager.getInputMode() === _InputManager__WEBPACK_IMPORTED_MODULE_5__.InputMode.Batch) {\n const handler = this.inputManager.inputHandler;\n handler.debugMode = debugMode;\n }\n this.outputManager.debugMode = debugMode;\n this.editor.debugMode = debugMode;\n if (!this._debugMode) {\n this.traceViewer.reset();\n this.outputManager.reset();\n this.inputManager.inputHandler.reset();\n }\n this.dispatchEvent(new CustomEvent("debug-mode", { detail: debugMode }));\n }\n get debugMode() {\n return this._debugMode;\n }\n /**\n * Stops the current run and resets the state of the program\n * Regular and debug output is cleared\n * @return {Promise} Returns when the program has been reset\n */\n reset() {\n return __awaiter(this, void 0, void 0, function* () {\n if (![RunState.Ready, RunState.Loading].includes(this.state)) {\n yield this.stop();\n }\n this.debugMode = false;\n this.inputManager.inputHandler.reset();\n this.outputManager.reset();\n this.traceViewer.reset();\n });\n }\n updateRunButtons(modes) {\n this.runButtons = new ButtonArray();\n this.addRunButton(_Backend__WEBPACK_IMPORTED_MODULE_0__.RunMode.Run, "btn-primary");\n modes.forEach(m => this.addRunButton(m));\n }\n addRunButton(mode, classNames = "btn-secondary") {\n const id = (0,_Constants__WEBPACK_IMPORTED_MODULE_4__.addPapyrosPrefix)(mode) + "-code-btn";\n this.runButtons.add({\n id: id,\n buttonText: (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.t)(`Papyros.run_modes.${mode}`),\n classNames,\n icon: MODE_ICONS[mode]\n }, () => this.runCode(mode));\n }\n /**\n * Start the backend to enable running code\n */\n start() {\n return __awaiter(this, void 0, void 0, function* () {\n this.setState(RunState.Loading);\n const backend = _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.getBackend(this.programmingLanguage);\n this.editor.setProgrammingLanguage(this.programmingLanguage);\n // Use a Promise to immediately enable running while downloading\n // eslint-disable-next-line no-async-promise-executor\n this.backend = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {\n const workerProxy = backend.workerProxy;\n yield workerProxy\n // Allow passing messages between worker and main thread\n .launch((0,comlink__WEBPACK_IMPORTED_MODULE_11__.proxy)((e) => _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.publish(e)), (0,comlink__WEBPACK_IMPORTED_MODULE_11__.proxy)(() => {\n this.outputManager.onOverflow(null);\n }));\n this.editor.setLintingSource((view) => __awaiter(this, void 0, void 0, function* () {\n const workerDiagnostics = yield workerProxy.lintCode(this.editor.getCode());\n return workerDiagnostics.map(d => {\n const fromline = view.state.doc.line(d.lineNr);\n const toLine = view.state.doc.line(d.endLineNr);\n const from = Math.min(fromline.from + d.columnNr, fromline.to);\n const to = Math.min(toLine.from + d.endColumnNr, toLine.to);\n return Object.assign(Object.assign({}, d), { from: from, to: to });\n });\n }));\n return resolve(backend);\n }));\n this.editor.focus();\n this.setState(RunState.Ready);\n });\n }\n /**\n * Interrupt the currently running code\n * @return {Promise} Returns when the code has been interrupted\n */\n stop() {\n return __awaiter(this, void 0, void 0, function* () {\n this.setState(RunState.Stopping);\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.publish({\n type: _BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.End,\n data: "User cancelled run", contentType: "text/plain"\n });\n const backend = yield this.backend;\n yield backend.interrupt();\n while (this.state === RunState.Stopping) {\n yield new Promise(resolve => setTimeout(resolve, 100));\n }\n });\n }\n /**\n * Set the used programming language to the given one to allow editing and running code\n * @param {ProgrammingLanguage} programmingLanguage The language to use\n */\n setProgrammingLanguage(programmingLanguage) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.programmingLanguage !== programmingLanguage) { // Expensive, so ensure it is needed\n yield this.backend.then(b => b.interrupt());\n this.programmingLanguage = programmingLanguage;\n yield this.start();\n }\n });\n }\n provideFiles(inlinedFiles, hrefFiles) {\n return __awaiter(this, void 0, void 0, function* () {\n const fileNames = [...Object.keys(inlinedFiles), ...Object.keys(hrefFiles)];\n if (fileNames.length === 0) {\n return;\n }\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.publish({ type: _BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Loading, data: JSON.stringify({\n modules: fileNames,\n status: "loading"\n }) });\n const backend = yield this.backend;\n yield backend.workerProxy.provideFiles(inlinedFiles, hrefFiles);\n });\n }\n /**\n * @return {ProgrammingLanguage} The current programming language\n */\n getProgrammingLanguage() {\n return this.programmingLanguage;\n }\n /**\n * Show or hide the spinning circle, representing a running animation\n * @param {boolean} show Whether to show the spinner\n */\n showSpinner(show) {\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_4__.STATE_SPINNER_ID).style.display = show ? "" : "none";\n }\n /**\n * Show the current state of the program to the user\n * @param {RunState} state The current state of the run\n * @param {string} message Optional message to indicate the state\n */\n setState(state, message) {\n var _b;\n const stateElement = (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_4__.APPLICATION_STATE_TEXT_ID);\n stateElement.innerText = message || (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.t)(`Papyros.states.${state}`);\n (_b = stateElement.parentElement) === null || _b === void 0 ? void 0 : _b.classList.toggle("show", stateElement.innerText.length > 0);\n if (state !== this.state) {\n this.previousState = this.state;\n this.state = state;\n }\n this.showSpinner(this.state !== RunState.Ready);\n this.renderButtons();\n }\n /**\n * @return {RunState} The state of the current run\n */\n getState() {\n return this.state;\n }\n /**\n * Remove a button from the internal button list. Requires a re-render to update\n * @param {string} id Identifier of the button to remove\n */\n removeButton(id) {\n this.userButtons.remove(id);\n this.renderButtons(this.userButtons, _Constants__WEBPACK_IMPORTED_MODULE_4__.CODE_BUTTONS_WRAPPER_ID);\n }\n /**\n * Add a button to display to the user\n * @param {ButtonOptions} options Options for rendering the button\n * @param {function} onClick Listener for click events on the button\n */\n addButton(options, onClick) {\n this.userButtons.add(options, onClick);\n this.renderButtons(this.userButtons, _Constants__WEBPACK_IMPORTED_MODULE_4__.CODE_BUTTONS_WRAPPER_ID);\n }\n /**\n * Generate a button that the user can click to process code\n * Can either run the code or interrupt it if already running\n * @return {DynamicButton} A list of buttons to interact with the code according to the current state\n */\n getCodeActionButtons() {\n if (this.state === RunState.Ready) {\n if (this.debugMode) {\n return [{\n id: "stop-debug-btn",\n buttonHTML: (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_8__.renderButton)({\n id: "stop-debug-btn",\n buttonText: (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.t)("Papyros.debug.stop"),\n classNames: "btn-secondary",\n icon: DEBUG_STOP_ICON\n }),\n onClick: () => this.debugMode = false\n }];\n }\n else {\n return this.runButtons;\n }\n }\n else {\n return [{\n id: _Constants__WEBPACK_IMPORTED_MODULE_4__.STOP_BTN_ID,\n buttonHTML: (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_8__.renderButton)({\n id: _Constants__WEBPACK_IMPORTED_MODULE_4__.STOP_BTN_ID,\n buttonText: (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.t)("Papyros.stop"),\n classNames: "btn-danger",\n icon: ""\n }),\n onClick: () => this.stop()\n }];\n }\n }\n /**\n * Specific helper method to render only the buttons required by the user\n * @param {DynamicButton[]} buttons The buttons to render\n * @param {string} id The id of the element to render the buttons in\n */\n renderButtons(buttons = undefined, id = _Constants__WEBPACK_IMPORTED_MODULE_4__.RUN_BUTTONS_WRAPPER_ID) {\n const btns = buttons || this.getCodeActionButtons();\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.getElement)(id).innerHTML =\n btns.map(b => b.buttonHTML).join("\\n");\n // Buttons are freshly added to the DOM, so attach listeners now\n btns.forEach(b => (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.addListener)(b.id, b.onClick, "click"));\n }\n _render(options) {\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_8__.appendClasses)(options.statusPanelOptions, \n // eslint-disable-next-line max-len\n "_tw-border-solid _tw-border-gray-200 _tw-border-b-2 dark:_tw-border-dark-mode-content");\n const rendered = (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_8__.renderWithOptions)(options.statusPanelOptions, `\n
\n
\n ${(0,_util_HTMLShapes__WEBPACK_IMPORTED_MODULE_6__.renderSpinningCircle)(_Constants__WEBPACK_IMPORTED_MODULE_4__.STATE_SPINNER_ID, "_tw-border-gray-200 _tw-border-b-red-500")}\n
\n
\n
\n
\n
\n
\n
\n
\n
`);\n this.setState(this.state);\n this.renderButtons(this.userButtons, _Constants__WEBPACK_IMPORTED_MODULE_4__.CODE_BUTTONS_WRAPPER_ID);\n this.inputManager.render(options.inputOptions);\n this.outputManager.render(options.outputOptions);\n this.editor.render(options.codeEditorOptions);\n this.editor.setPanel(rendered);\n // Set language again to update the placeholder\n this.editor.setProgrammingLanguage(this.programmingLanguage);\n this.traceViewer.render(options.traceOptions);\n return rendered;\n }\n /**\n * Execute the code in the editor\n * @param {RunMode} mode The mode to run with\n * @return {Promise} Promise of running the code\n */\n runCode(mode) {\n return __awaiter(this, void 0, void 0, function* () {\n this.debugMode = mode === _Backend__WEBPACK_IMPORTED_MODULE_0__.RunMode.Debug;\n const code = this.editor.getCode();\n // Setup pre-run\n this.setState(RunState.Loading);\n // Ensure we go back to Loading after finishing any remaining installs\n this.previousState = RunState.Loading;\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.publish({\n type: _BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Start,\n data: "StartClicked", contentType: "text/plain"\n });\n let interrupted = false;\n let terminated = false;\n const backend = yield this.backend;\n this.runStartTime = new Date().getTime();\n try {\n yield backend.call(backend.workerProxy.runCode, code, mode);\n }\n catch (error) {\n if (error.type === "InterruptError") {\n // Error signaling forceful interrupt\n interrupted = true;\n terminated = true;\n }\n else {\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.publish({\n type: _BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Error,\n data: JSON.stringify(error),\n contentType: "text/json"\n });\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.publish({\n type: _BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.End,\n data: "RunError", contentType: "text/plain"\n });\n }\n }\n finally {\n if (this.state === RunState.Stopping) {\n // Was interrupted, End message already published\n interrupted = true;\n }\n if (terminated) {\n yield this.start();\n }\n else if (yield backend.workerProxy.hasOverflow()) {\n this.outputManager.onOverflow(() => __awaiter(this, void 0, void 0, function* () {\n const backend = yield this.backend;\n const overflowResults = (yield backend.workerProxy.getOverflow())\n .map(e => e.data).join("");\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.downloadResults)(overflowResults, "overflow-results.txt");\n }));\n }\n this.setState(RunState.Ready, (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.t)(interrupted ? "Papyros.interrupted" : "Papyros.finished", { time: (new Date().getTime() - this.runStartTime) / 1000 }));\n }\n });\n }\n /**\n * Callback to handle loading events\n * @param {BackendEvent} e The loading event\n */\n onLoad(e) {\n const loadingData = (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.parseData)(e.data, e.contentType);\n if (loadingData.status === "loading") {\n loadingData.modules.forEach(m => {\n if (!this.loadingPackages.includes(m)) {\n this.loadingPackages.push(m);\n }\n });\n }\n else if (loadingData.status === "loaded") {\n loadingData.modules.forEach(m => {\n const index = this.loadingPackages.indexOf(m);\n if (index !== -1) {\n this.loadingPackages.splice(index, 1);\n }\n });\n }\n else { // failed\n // If it is a true module, an Exception will be raised when running\n // So this does not need to be handled here, as it is often an incomplete package-name\n // that causes micropip to not find the correct wheel\n this.loadingPackages = [];\n }\n if (this.loadingPackages.length > 0) {\n const packageMessage = (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.t)("Papyros.loading", {\n // limit amount of package names shown\n packages: this.loadingPackages.slice(0, 3).join(", ")\n });\n this.setState(RunState.Loading, packageMessage);\n }\n else {\n this.setState(this.previousState);\n }\n }\n onStart(e) {\n const startData = (0,_util_Util__WEBPACK_IMPORTED_MODULE_7__.parseData)(e.data, e.contentType);\n if (startData.includes("RunCode")) {\n this.runStartTime = new Date().getTime();\n this.setState(RunState.Running);\n }\n }\n },\n (() => {\n var _b;\n const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;\n _renderButtons_decorators = [delay(100)];\n __esDecorate(_a, null, _renderButtons_decorators, { kind: "method", name: "renderButtons", static: false, private: false, access: { has: obj => "renderButtons" in obj, get: obj => obj.renderButtons }, metadata: _metadata }, null, _instanceExtraInitializers);\n if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });\n })(),\n _a;\n})();\n\n\n\n//# sourceURL=webpack://Papyros/./src/CodeRunner.ts?')},"./src/Constants.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ APPLICATION_STATE_TEXT_ID: () => (/* binding */ APPLICATION_STATE_TEXT_ID),\n/* harmony export */ CODE_BUTTONS_WRAPPER_ID: () => (/* binding */ CODE_BUTTONS_WRAPPER_ID),\n/* harmony export */ DARK_MODE_TOGGLE_ID: () => (/* binding */ DARK_MODE_TOGGLE_ID),\n/* harmony export */ DEFAULT_EDITOR_DELAY: () => (/* binding */ DEFAULT_EDITOR_DELAY),\n/* harmony export */ DEFAULT_LOCALE: () => (/* binding */ DEFAULT_LOCALE),\n/* harmony export */ DEFAULT_PROGRAMMING_LANGUAGE: () => (/* binding */ DEFAULT_PROGRAMMING_LANGUAGE),\n/* harmony export */ DEFAULT_SERVICE_WORKER: () => (/* binding */ DEFAULT_SERVICE_WORKER),\n/* harmony export */ EDITOR_WRAPPER_ID: () => (/* binding */ EDITOR_WRAPPER_ID),\n/* harmony export */ EXAMPLE_SELECT_ID: () => (/* binding */ EXAMPLE_SELECT_ID),\n/* harmony export */ INPUT_AREA_WRAPPER_ID: () => (/* binding */ INPUT_AREA_WRAPPER_ID),\n/* harmony export */ INPUT_TA_ID: () => (/* binding */ INPUT_TA_ID),\n/* harmony export */ LOCALE_SELECT_ID: () => (/* binding */ LOCALE_SELECT_ID),\n/* harmony export */ MAIN_APP_ID: () => (/* binding */ MAIN_APP_ID),\n/* harmony export */ OUTPUT_AREA_ID: () => (/* binding */ OUTPUT_AREA_ID),\n/* harmony export */ OUTPUT_AREA_WRAPPER_ID: () => (/* binding */ OUTPUT_AREA_WRAPPER_ID),\n/* harmony export */ OUTPUT_OVERFLOW_ID: () => (/* binding */ OUTPUT_OVERFLOW_ID),\n/* harmony export */ PANEL_WRAPPER_ID: () => (/* binding */ PANEL_WRAPPER_ID),\n/* harmony export */ PROGRAMMING_LANGUAGE_SELECT_ID: () => (/* binding */ PROGRAMMING_LANGUAGE_SELECT_ID),\n/* harmony export */ RUN_BUTTONS_WRAPPER_ID: () => (/* binding */ RUN_BUTTONS_WRAPPER_ID),\n/* harmony export */ SEND_INPUT_BTN_ID: () => (/* binding */ SEND_INPUT_BTN_ID),\n/* harmony export */ STATE_SPINNER_ID: () => (/* binding */ STATE_SPINNER_ID),\n/* harmony export */ STOP_BTN_ID: () => (/* binding */ STOP_BTN_ID),\n/* harmony export */ SWITCH_INPUT_MODE_A_ID: () => (/* binding */ SWITCH_INPUT_MODE_A_ID),\n/* harmony export */ USER_INPUT_WRAPPER_ID: () => (/* binding */ USER_INPUT_WRAPPER_ID),\n/* harmony export */ addPapyrosPrefix: () => (/* binding */ addPapyrosPrefix)\n/* harmony export */ });\n/* harmony import */ var _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ProgrammingLanguage */ "./src/ProgrammingLanguage.ts");\n\n/**\n * Add a prefix to a string, ensuring uniqueness in the page\n * @param {string} s The value to add a prefix to\n * @return {string} The value with an almost certainly unused prefix\n */\nfunction addPapyrosPrefix(s) {\n return `__papyros-${s}`;\n}\n/* Default HTML ids for various elements */\nconst MAIN_APP_ID = addPapyrosPrefix("root");\nconst OUTPUT_AREA_WRAPPER_ID = addPapyrosPrefix("code-output-area-wrapper");\nconst OUTPUT_AREA_ID = addPapyrosPrefix("code-output-area");\nconst OUTPUT_OVERFLOW_ID = addPapyrosPrefix("output-overflow");\nconst INPUT_AREA_WRAPPER_ID = addPapyrosPrefix("code-input-area-wrapper");\nconst INPUT_TA_ID = addPapyrosPrefix("code-input-area");\nconst USER_INPUT_WRAPPER_ID = addPapyrosPrefix("user-input-wrapper");\nconst EDITOR_WRAPPER_ID = addPapyrosPrefix("code-area");\nconst PANEL_WRAPPER_ID = addPapyrosPrefix("code-status-panel");\nconst STATE_SPINNER_ID = addPapyrosPrefix("state-spinner");\nconst APPLICATION_STATE_TEXT_ID = addPapyrosPrefix("application-state-text");\nconst CODE_BUTTONS_WRAPPER_ID = addPapyrosPrefix("code-buttons");\nconst RUN_BUTTONS_WRAPPER_ID = addPapyrosPrefix("run-buttons");\nconst STOP_BTN_ID = addPapyrosPrefix("stop-btn");\nconst SEND_INPUT_BTN_ID = addPapyrosPrefix("send-input-btn");\nconst SWITCH_INPUT_MODE_A_ID = addPapyrosPrefix("switch-input-mode");\nconst EXAMPLE_SELECT_ID = addPapyrosPrefix("example-select");\nconst LOCALE_SELECT_ID = addPapyrosPrefix("locale-select");\nconst PROGRAMMING_LANGUAGE_SELECT_ID = addPapyrosPrefix("programming-language-select");\nconst DARK_MODE_TOGGLE_ID = addPapyrosPrefix("toggle-dark-mode");\n/* Default values for various properties */\nconst DEFAULT_PROGRAMMING_LANGUAGE = _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__.ProgrammingLanguage.Python;\nconst DEFAULT_LOCALE = "nl";\nconst DEFAULT_SERVICE_WORKER = "InputServiceWorker.js";\nconst DEFAULT_EDITOR_DELAY = 750; // milliseconds\n\n\n//# sourceURL=webpack://Papyros/./src/Constants.ts?')},"./src/Debugger.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Debugger: () => (/* binding */ Debugger)\n/* harmony export */ });\n/* harmony import */ var _util_Rendering__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/Rendering */ "./src/util/Rendering.ts");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _BackendManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BackendManager */ "./src/BackendManager.ts");\n/* harmony import */ var _BackendEvent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BackendEvent */ "./src/BackendEvent.ts");\n/* harmony import */ var _dodona_trace_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @dodona/trace-component */ "./node_modules/@dodona/trace-component/dist/index.js");\n\n\n\n\n\nconst TRACE_COMPONENT_ID = "trace-component";\nconst EXECUTION_LIMIT = 10000;\nfunction createDelayer() {\n let timer;\n return (callback, ms) => {\n clearTimeout(timer);\n timer = setTimeout(callback, ms);\n };\n}\nconst delay = createDelayer();\nclass Debugger extends _util_Rendering__WEBPACK_IMPORTED_MODULE_0__.Renderable {\n constructor() {\n super();\n this.frameStates = [];\n this.currentOutputs = 0;\n this.currentInputs = 0;\n this.traceBuffer = [];\n this.reset();\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_3__.BackendEventType.Start, () => {\n this.reset();\n });\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_3__.BackendEventType.Output, () => {\n this.currentOutputs++;\n });\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_3__.BackendEventType.Input, () => {\n this.currentInputs++;\n });\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_3__.BackendEventType.Frame, e => {\n const frame = JSON.parse(e.data);\n const frameState = {\n line: frame.line,\n outputs: this.currentOutputs,\n inputs: this.currentInputs\n };\n this.frameStates.push(frameState);\n this.traceBuffer.push(frame);\n if (this.traceBuffer.length > 100) {\n this.clearBuffer();\n }\n else {\n delay(() => this.clearBuffer(), 100);\n }\n if (this.frameStates.length >= EXECUTION_LIMIT) {\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.publish({\n type: _BackendEvent__WEBPACK_IMPORTED_MODULE_3__.BackendEventType.Stop,\n data: "Execution limit reached"\n });\n }\n });\n }\n _render(options) {\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_0__.renderWithOptions)(options, `\n \n `);\n this.traceComponent = (0,_util_Util__WEBPACK_IMPORTED_MODULE_1__.getElement)(TRACE_COMPONENT_ID);\n this.traceComponent.translations = (0,_util_Util__WEBPACK_IMPORTED_MODULE_1__.t)("Papyros.debugger");\n this.traceComponent.addEventListener("frame-change", e => {\n const frame = e.detail.frame;\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.publish({\n type: _BackendEvent__WEBPACK_IMPORTED_MODULE_3__.BackendEventType.FrameChange,\n data: this.frameStates[frame]\n });\n });\n }\n reset() {\n this.frameStates = [];\n this.currentOutputs = 0;\n this.currentInputs = 0;\n if (this.traceComponent) {\n this.traceComponent.trace = [];\n }\n }\n clearBuffer() {\n var _a;\n for (const frame of this.traceBuffer) {\n (_a = this.traceComponent) === null || _a === void 0 ? void 0 : _a.addFrame(frame);\n }\n this.traceBuffer = [];\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/Debugger.ts?')},"./src/InputManager.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ INPUT_MODES: () => (/* binding */ INPUT_MODES),\n/* harmony export */ InputManager: () => (/* binding */ InputManager),\n/* harmony export */ InputMode: () => (/* binding */ InputMode)\n/* harmony export */ });\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants */ "./src/Constants.ts");\n/* harmony import */ var _BackendEvent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BackendEvent */ "./src/BackendEvent.ts");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _input_InteractiveInputHandler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./input/InteractiveInputHandler */ "./src/input/InteractiveInputHandler.ts");\n/* harmony import */ var _input_BatchInputHandler__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./input/BatchInputHandler */ "./src/input/BatchInputHandler.ts");\n/* harmony import */ var _BackendManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BackendManager */ "./src/BackendManager.ts");\n/* harmony import */ var _util_Rendering__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util/Rendering */ "./src/util/Rendering.ts");\n\n\n\n\n\n\n\nvar InputMode;\n(function (InputMode) {\n InputMode["Interactive"] = "interactive";\n InputMode["Batch"] = "batch";\n})(InputMode || (InputMode = {}));\nconst INPUT_MODES = [InputMode.Batch, InputMode.Interactive];\nclass InputManager extends _util_Rendering__WEBPACK_IMPORTED_MODULE_6__.Renderable {\n constructor(sendInput, inputMode) {\n super();\n this.onUserInput = this.onUserInput.bind(this);\n this.inputHandlers = this.buildInputHandlerMap();\n this.inputMode = inputMode;\n this.sendInput = sendInput;\n this.waiting = false;\n this.prompt = "";\n _BackendManager__WEBPACK_IMPORTED_MODULE_5__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Start, () => this.onRunStart());\n _BackendManager__WEBPACK_IMPORTED_MODULE_5__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.End, () => this.onRunEnd());\n _BackendManager__WEBPACK_IMPORTED_MODULE_5__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Input, e => this.onInputRequest(e));\n }\n buildInputHandlerMap() {\n const interactiveInputHandler = new _input_InteractiveInputHandler__WEBPACK_IMPORTED_MODULE_3__.InteractiveInputHandler(this.onUserInput);\n const batchInputHandler = new _input_BatchInputHandler__WEBPACK_IMPORTED_MODULE_4__.BatchInputHandler(this.onUserInput);\n return new Map([\n [InputMode.Interactive, interactiveInputHandler],\n [InputMode.Batch, batchInputHandler]\n ]);\n }\n getInputMode() {\n return this.inputMode;\n }\n setInputMode(inputMode) {\n this.inputHandler.toggle(false);\n this.inputMode = inputMode;\n this.render();\n this.inputHandler.toggle(true);\n }\n getInputHandler(inputMode) {\n return this.inputHandlers.get(inputMode);\n }\n get inputHandler() {\n return this.getInputHandler(this.inputMode);\n }\n isWaiting() {\n return this.waiting;\n }\n _render(options) {\n let switchMode = "";\n const otherMode = this.inputMode === InputMode.Interactive ?\n InputMode.Batch : InputMode.Interactive;\n switchMode = `\n ${(0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)(`Papyros.switch_input_mode_to.${otherMode}`)}\n `;\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderWithOptions)(options, `\n
\n
\n${switchMode}`);\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.addListener)(_Constants__WEBPACK_IMPORTED_MODULE_0__.SWITCH_INPUT_MODE_A_ID, im => this.setInputMode(im), "click", "data-value");\n this.inputHandler.render({\n parentElementId: _Constants__WEBPACK_IMPORTED_MODULE_0__.USER_INPUT_WRAPPER_ID,\n darkMode: options.darkMode,\n inputStyling: options.inputStyling\n });\n this.inputHandler.waitWithPrompt(this.waiting, this.prompt);\n }\n waitWithPrompt(waiting, prompt = "") {\n this.waiting = waiting;\n this.prompt = prompt;\n this.inputHandler.waitWithPrompt(this.waiting, this.prompt);\n }\n onUserInput(line) {\n this.sendInput(line);\n this.waitWithPrompt(false);\n }\n /**\n * Asynchronously handle an input request by prompting the user for input\n * @param {BackendEvent} e Event containing the input data\n */\n onInputRequest(e) {\n this.waitWithPrompt(true, e.data);\n }\n onRunStart() {\n // Prevent switching input mode during runs\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_0__.SWITCH_INPUT_MODE_A_ID).hidden = true;\n this.waitWithPrompt(false);\n this.inputHandler.onRunStart();\n }\n onRunEnd() {\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_0__.SWITCH_INPUT_MODE_A_ID).hidden = false;\n this.inputHandler.onRunEnd();\n this.waitWithPrompt(false);\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/InputManager.ts?')},"./src/OutputManager.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OutputManager: () => (/* binding */ OutputManager)\n/* harmony export */ });\n/* harmony import */ var escape_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! escape-html */ "./node_modules/escape-html/index.js");\n/* harmony import */ var escape_html__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(escape_html__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _BackendEvent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BackendEvent */ "./src/BackendEvent.ts");\n/* harmony import */ var _BackendManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BackendManager */ "./src/BackendManager.ts");\n/* harmony import */ var _util_HTMLShapes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util/HTMLShapes */ "./src/util/HTMLShapes.ts");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _util_Logging__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./util/Logging */ "./src/util/Logging.ts");\n/* harmony import */ var _util_Rendering__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util/Rendering */ "./src/util/Rendering.ts");\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Constants */ "./src/Constants.ts");\n\n\n\n\n\n\n\n\n/**\n * Component for displaying code output or errors to the user\n */\nclass OutputManager extends _util_Rendering__WEBPACK_IMPORTED_MODULE_6__.Renderable {\n set debugMode(value) {\n this.outputArea.classList.toggle("papyros-debug", value);\n this._debugMode = value;\n }\n constructor() {\n super();\n this._debugMode = false;\n this.content = [];\n this.overflown = false;\n this.downloadCallback = null;\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Start, () => this.reset());\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Output, e => this.showOutput(e));\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.Error, e => this.showError(e));\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.End, () => this.onRunEnd());\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_1__.BackendEventType.FrameChange, e => {\n const outputsToHighlight = e.data.outputs;\n const outputElements = this.outputArea.children;\n for (let i = 0; i < outputElements.length; i++) {\n const outputElement = outputElements[i];\n outputElement.classList.toggle("papyros-highlight-debugged", i < outputsToHighlight);\n }\n });\n }\n /**\n * Retrieve the parent element containing all output parts\n */\n get outputArea() {\n return (0,_util_Util__WEBPACK_IMPORTED_MODULE_4__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_7__.OUTPUT_AREA_ID);\n }\n /**\n * Render an element in the next position of the output area\n * @param {string} html Safe string version of the next child to render\n * @param {boolean} isNewElement Whether this a newly generated element\n */\n renderNextElement(html, isNewElement = true) {\n if (isNewElement) { // Only save new ones to prevent duplicating\n this.content.push(html);\n }\n this.outputArea.insertAdjacentHTML("beforeend", html);\n // Ensure overflowElement is at the bottom\n const overflowElement = document.getElementById(_Constants__WEBPACK_IMPORTED_MODULE_7__.OUTPUT_OVERFLOW_ID);\n if (overflowElement) {\n this.outputArea.append(overflowElement);\n }\n // Scroll to bottom to show latest output\n this.outputArea.scrollTop = this.outputArea.scrollHeight;\n }\n /**\n * Convert a piece of text to a span element for displaying\n * @param {string} text The text content for the span\n * @param {boolean} ignoreEmpty Whether to remove empty lines in the text\n * @param {string} className Optional class name for the span\n * @return {string} String version of the created span\n */\n spanify(text, ignoreEmpty = false, className = "") {\n let spanText = text;\n if (spanText.includes("\\n") && spanText !== "\\n") {\n spanText = spanText.split("\\n")\n .filter(line => !ignoreEmpty || line.trim().length > 0)\n .join("\\n");\n }\n return `${escape_html__WEBPACK_IMPORTED_MODULE_0___default()(spanText)}`;\n }\n /**\n * Display output to the user, based on its content type\n * @param {BackendEvent} output Event containing the output data\n */\n showOutput(output) {\n const data = (0,_util_Util__WEBPACK_IMPORTED_MODULE_4__.parseData)(output.data, output.contentType);\n if (output.contentType && output.contentType.startsWith("img")) {\n this.renderNextElement(``);\n }\n else {\n this.renderNextElement(this.spanify(data, false));\n }\n }\n /**\n * Display to the user that overflow has occurred, limiting the shown output\n * @param {function():void | null} downloadCallback Optional callback to download overflow\n */\n onOverflow(downloadCallback) {\n this.overflown = true;\n this.downloadCallback = downloadCallback;\n if (document.getElementById(_Constants__WEBPACK_IMPORTED_MODULE_7__.OUTPUT_OVERFLOW_ID) == null) {\n this.renderNextElement(`\n
${(0,_util_Util__WEBPACK_IMPORTED_MODULE_4__.t)("Papyros.output_overflow")}\n\n
`, false);\n }\n const overflowDiv = (0,_util_Util__WEBPACK_IMPORTED_MODULE_4__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_7__.OUTPUT_OVERFLOW_ID);\n if (this.downloadCallback !== null) {\n const overflowLink = overflowDiv.lastElementChild;\n overflowLink.hidden = false;\n overflowLink.addEventListener("click", this.downloadCallback);\n }\n }\n /**\n * Display an error to the user\n * @param {BackendEvent} error Event containing the error data\n */\n showError(error) {\n let errorHTML = "";\n const errorData = (0,_util_Util__WEBPACK_IMPORTED_MODULE_4__.parseData)(error.data, error.contentType);\n (0,_util_Logging__WEBPACK_IMPORTED_MODULE_5__.papyrosLog)(_util_Logging__WEBPACK_IMPORTED_MODULE_5__.LogType.Debug, "Showing error: ", errorData);\n if (typeof (errorData) === "string") {\n errorHTML = this.spanify(errorData, false, "_tw-text-red-500");\n }\n else {\n const errorObject = errorData;\n let shortTraceback = (errorObject.where || "").trim();\n // Prepend a bit of indentation, so every part has indentation\n if (shortTraceback) {\n shortTraceback = this.spanify(" " + shortTraceback, true, "where");\n }\n errorHTML += "
";\n const infoQM = (0,_util_HTMLShapes__WEBPACK_IMPORTED_MODULE_3__.renderInCircle)("?", escape_html__WEBPACK_IMPORTED_MODULE_0___default()(errorObject.info), \n // eslint-disable-next-line max-len\n "_tw-text-blue-500 _tw-border-blue-500 dark:_tw-text-dark-mode-blue dark:_tw-border-dark-mode-blue");\n const tracebackEM = (0,_util_HTMLShapes__WEBPACK_IMPORTED_MODULE_3__.renderInCircle)("!", escape_html__WEBPACK_IMPORTED_MODULE_0___default()(errorObject.traceback), "_tw-text-red-500 _tw-border-red-500");\n errorHTML += `${infoQM}${errorObject.name} traceback:${tracebackEM}\\n`;\n errorHTML += shortTraceback;\n errorHTML += "
\\n";\n if (errorObject.what) {\n errorHTML += this.spanify(errorObject.what.trim(), true, "what") + "\\n";\n }\n if (errorObject.why) {\n errorHTML += this.spanify(errorObject.why.trim(), true, "why") + "\\n";\n }\n }\n this.renderNextElement(errorHTML);\n }\n _render(options) {\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderWithOptions)(options, `\n
\n `);\n // Restore previously rendered items\n this.content.forEach(html => this.renderNextElement(html, false));\n if (this.overflown) {\n this.onOverflow(this.downloadCallback);\n }\n }\n /**\n * Clear the contents of the output area\n */\n reset() {\n this.content = [];\n this.overflown = false;\n this.downloadCallback = null;\n this.render();\n }\n onRunEnd() {\n if (this.outputArea.childElementCount === 0) {\n this.outputArea.setAttribute("data-placeholder", (0,_util_Util__WEBPACK_IMPORTED_MODULE_4__.t)("Papyros.no_output"));\n }\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/OutputManager.ts?')},"./src/Papyros.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Papyros: () => (/* binding */ Papyros)\n/* harmony export */ });\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Constants */ "./src/Constants.ts");\n/* harmony import */ var _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ProgrammingLanguage */ "./src/ProgrammingLanguage.ts");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _CodeRunner__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CodeRunner */ "./src/CodeRunner.ts");\n/* harmony import */ var _examples_Examples__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./examples/Examples */ "./src/examples/Examples.ts");\n/* harmony import */ var sync_message__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! sync-message */ "./node_modules/sync-message/dist/index.js");\n/* harmony import */ var sync_message__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(sync_message__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _BackendManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BackendManager */ "./src/BackendManager.ts");\n/* harmony import */ var _util_Rendering__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util/Rendering */ "./src/util/Rendering.ts");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n/* eslint-disable max-len */\n\n\n\n\n\n\n\n\nconst LANGUAGE_MAP = new Map([\n ["python", _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_1__.ProgrammingLanguage.Python],\n ["javascript", _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_1__.ProgrammingLanguage.JavaScript]\n]);\n/**\n * Class that manages multiple components to form a coding scratchpad\n */\nclass Papyros extends _util_Rendering__WEBPACK_IMPORTED_MODULE_6__.Renderable {\n /**\n * Construct a new Papyros instance\n * @param {PapyrosConfig} config Properties to configure this instance\n */\n constructor(config) {\n super();\n this.config = config;\n _util_Util__WEBPACK_IMPORTED_MODULE_2__.i18n.locale = config.locale;\n this.codeRunner = new _CodeRunner__WEBPACK_IMPORTED_MODULE_3__.CodeRunner(config.programmingLanguage, config.inputMode);\n }\n /**\n * @return {RunState} The current state of the user\'s code\n */\n getState() {\n return this.codeRunner.getState();\n }\n /**\n * Launch this instance of Papyros, making it ready to run code\n * @return {Promise} Promise of launching, chainable\n */\n launch() {\n return __awaiter(this, void 0, void 0, function* () {\n if (!(yield this.configureInput())) {\n alert((0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.service_worker_error"));\n }\n else {\n try {\n yield this.codeRunner.start();\n }\n catch (error) {\n if (confirm((0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.launch_error"))) {\n return this.launch();\n }\n }\n }\n return this;\n });\n }\n /**\n * Set the used programming language to the given one to allow editing and running code\n * @param {ProgrammingLanguage} programmingLanguage The language to use\n */\n setProgrammingLanguage(programmingLanguage) {\n return __awaiter(this, void 0, void 0, function* () {\n this.config.programmingLanguage = programmingLanguage;\n yield this.codeRunner.setProgrammingLanguage(programmingLanguage);\n });\n }\n /**\n * @param {string} locale The locale to use\n */\n setLocale(locale) {\n if (locale !== this.config.locale) {\n this.config.locale = locale;\n _util_Util__WEBPACK_IMPORTED_MODULE_2__.i18n.locale = locale;\n this.render();\n }\n }\n /**\n * @param {boolean} darkMode Whether to use dark mode\n */\n setDarkMode(darkMode) {\n if (darkMode !== this.renderOptions.darkMode) {\n this.renderOptions.darkMode = darkMode;\n this.render();\n }\n }\n /**\n * @param {string} code The code to use in the editor\n */\n setCode(code) {\n this.codeRunner.editor.setText(code);\n }\n /**\n * @return {string} The currently written code\n */\n getCode() {\n return this.codeRunner.editor.getText();\n }\n /**\n * Configure how user input is handled within Papyros\n * By default, we will try to use SharedArrayBuffers\n * If this option is not available, the optional arguments in the channelOptions config are used\n * They are needed to register a service worker to handle communication between threads\n * @return {Promise} Promise of configuring input\n */\n configureInput() {\n return __awaiter(this, void 0, void 0, function* () {\n var _a;\n if (typeof SharedArrayBuffer === "undefined") {\n if (!((_a = this.config.channelOptions) === null || _a === void 0 ? void 0 : _a.serviceWorkerName) || !("serviceWorker" in navigator)) {\n return false;\n }\n const serviceWorkerRoot = this.config.channelOptions.root || (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.cleanCurrentUrl)(true);\n const { serviceWorkerName } = this.config.channelOptions;\n this.config.channelOptions.scope = serviceWorkerRoot;\n const serviceWorkerUrl = serviceWorkerRoot + serviceWorkerName;\n try {\n yield navigator.serviceWorker.register(serviceWorkerUrl, { scope: "/" });\n _BackendManager__WEBPACK_IMPORTED_MODULE_5__.BackendManager.channel = (0,sync_message__WEBPACK_IMPORTED_MODULE_7__.makeChannel)({ serviceWorker: this.config.channelOptions });\n }\n catch (error) {\n return false;\n }\n }\n else {\n _BackendManager__WEBPACK_IMPORTED_MODULE_5__.BackendManager.channel = (0,sync_message__WEBPACK_IMPORTED_MODULE_7__.makeChannel)({\n atomics: Object.assign({}, this.config.channelOptions)\n });\n }\n return true;\n });\n }\n _render(renderOptions) {\n // Set default values for each option\n for (const [option, defaultParentId] of [\n ["inputOptions", _Constants__WEBPACK_IMPORTED_MODULE_0__.INPUT_AREA_WRAPPER_ID], ["statusPanelOptions", _Constants__WEBPACK_IMPORTED_MODULE_0__.PANEL_WRAPPER_ID],\n ["codeEditorOptions", _Constants__WEBPACK_IMPORTED_MODULE_0__.EDITOR_WRAPPER_ID], ["outputOptions", _Constants__WEBPACK_IMPORTED_MODULE_0__.OUTPUT_AREA_WRAPPER_ID],\n ["standAloneOptions", _Constants__WEBPACK_IMPORTED_MODULE_0__.MAIN_APP_ID]\n ]) {\n const elementOptions = renderOptions[option] || {};\n elementOptions.darkMode = renderOptions.darkMode;\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.appendClasses)(elementOptions, "tailwind");\n renderOptions[option] = Object.assign({ parentElementId: defaultParentId }, elementOptions);\n }\n if (this.config.standAlone) {\n const { locale, programmingLanguage } = this.config;\n const programmingLanguageSelect = (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderSelect)(_Constants__WEBPACK_IMPORTED_MODULE_0__.PROGRAMMING_LANGUAGE_SELECT_ID, new Array(...LANGUAGE_MAP.values()), l => (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)(`Papyros.programming_languages.${l}`), programmingLanguage, (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.programming_language"));\n const exampleSelect = (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderSelect)(_Constants__WEBPACK_IMPORTED_MODULE_0__.EXAMPLE_SELECT_ID, (0,_examples_Examples__WEBPACK_IMPORTED_MODULE_4__.getExampleNames)(programmingLanguage), name => name, this.config.example, (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.examples"));\n const locales = [locale, ...(0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.getLocales)().filter(l => l != locale)];\n const toggleIconClasses = renderOptions.darkMode ? "mdi-toggle-switch _tw-text-[#FF8F00]" : "mdi-toggle-switch-off _tw-text-white";\n const navOptions = `\n
\n \x3c!-- row-reverse to start at the right, so put elements in order of display --\x3e\n \n

${(0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.dark_mode")}

\n ${(0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderSelect)(_Constants__WEBPACK_IMPORTED_MODULE_0__.LOCALE_SELECT_ID, locales, l => (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)(`Papyros.locales.${l}`), locale)}\n \n
\n `;\n const navBar = `\n
\n
\n ${(0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.Papyros")}\n
\n
\n ${navOptions}\n
\n
\n `;\n const header = `\n \x3c!-- Header --\x3e\n
\n ${programmingLanguageSelect}\n ${exampleSelect}\n
`;\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderWithOptions)(renderOptions.standAloneOptions, `\n
\n ${navBar}\n
\n ${header}\n \x3c!--Body of the application--\x3e\n
\n \x3c!-- Code section--\x3e\n
\n ${(0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderLabel)((0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.code"), renderOptions.codeEditorOptions.parentElementId)}\n
\n
\n
\n \x3c!-- User input and output section--\x3e\n
\n ${(0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderLabel)((0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.output"), renderOptions.outputOptions.parentElementId)}\n
\n ${(0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderLabel)((0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.input"), renderOptions.inputOptions.parentElementId)}\n
\n
\n
\n \x3c!-- Debugging section--\x3e\n
\n
\n
\n `);\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.addListener)(_Constants__WEBPACK_IMPORTED_MODULE_0__.PROGRAMMING_LANGUAGE_SELECT_ID, pl => {\n this.setProgrammingLanguage(pl);\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_0__.EXAMPLE_SELECT_ID).innerHTML =\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_6__.renderSelectOptions)((0,_examples_Examples__WEBPACK_IMPORTED_MODULE_4__.getExampleNames)(pl), name => name);\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.removeSelection)(_Constants__WEBPACK_IMPORTED_MODULE_0__.EXAMPLE_SELECT_ID);\n this.config.example = undefined;\n // Modify search query params without reloading page\n history.pushState(null, "", `?locale=${_util_Util__WEBPACK_IMPORTED_MODULE_2__.i18n.locale}&language=${pl}`);\n }, "change", "value");\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.addListener)(_Constants__WEBPACK_IMPORTED_MODULE_0__.LOCALE_SELECT_ID, locale => {\n // Modify search query params without reloading page\n history.pushState(null, "", `?locale=${locale}&language=${this.codeRunner.getProgrammingLanguage()}`);\n this.setLocale(locale);\n }, "change", "value");\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.addListener)(_Constants__WEBPACK_IMPORTED_MODULE_0__.EXAMPLE_SELECT_ID, (name) => __awaiter(this, void 0, void 0, function* () {\n this.config.example = name;\n const code = (0,_examples_Examples__WEBPACK_IMPORTED_MODULE_4__.getCodeForExample)(this.codeRunner.getProgrammingLanguage(), name);\n yield this.codeRunner.reset();\n this.setCode(code);\n }), "change", "value");\n // If example is null, it removes the selection\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_0__.EXAMPLE_SELECT_ID).value = this.config.example;\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.addListener)(_Constants__WEBPACK_IMPORTED_MODULE_0__.DARK_MODE_TOGGLE_ID, () => {\n this.setDarkMode(!renderOptions.darkMode);\n }, "click");\n }\n this.codeRunner.render({\n statusPanelOptions: renderOptions.statusPanelOptions,\n inputOptions: renderOptions.inputOptions,\n codeEditorOptions: renderOptions.codeEditorOptions,\n outputOptions: renderOptions.outputOptions,\n traceOptions: renderOptions.traceOptions,\n });\n }\n /**\n * Add a button to the status panel within Papyros\n * @param {ButtonOptions} options Options to render the button with\n * @param {function} onClick Listener for click events on the button\n */\n addButton(options, onClick) {\n this.codeRunner.addButton(options, onClick);\n }\n /**\n * @param {ProgrammingLanguage} language The language to check\n * @return {boolean} Whether Papyros supports this language by default\n */\n static supportsProgrammingLanguage(language) {\n return Papyros.toProgrammingLanguage(language) !== undefined;\n }\n /**\n * Convert a string to a ProgrammingLanguage\n * @param {string} language The language to convert\n * @return {ProgrammingLanguage | undefined} The ProgrammingLanguage, or undefined if not supported\n */\n static toProgrammingLanguage(language) {\n return LANGUAGE_MAP.get(language.toLowerCase());\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/Papyros.ts?')},"./src/ProgrammingLanguage.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ProgrammingLanguage: () => (/* binding */ ProgrammingLanguage)\n/* harmony export */ });\n/**\n * String enum representing programming languages supported by Papyros\n */\nvar ProgrammingLanguage;\n(function (ProgrammingLanguage) {\n ProgrammingLanguage["Python"] = "Python";\n ProgrammingLanguage["JavaScript"] = "JavaScript";\n})(ProgrammingLanguage || (ProgrammingLanguage = {}));\n\n\n//# sourceURL=webpack://Papyros/./src/ProgrammingLanguage.ts?')},"./src/editor/BatchInputEditor.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BatchInputEditor: () => (/* binding */ BatchInputEditor)\n/* harmony export */ });\n/* harmony import */ var _CodeMirrorEditor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CodeMirrorEditor */ "./src/editor/CodeMirrorEditor.ts");\n/* harmony import */ var _Gutters__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Gutters */ "./src/editor/Gutters.ts");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _codemirror_commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @codemirror/commands */ "./node_modules/@codemirror/commands/dist/index.js");\n\n\n\n\n/**\n * Editor to handle and highlight user input\n */\nclass BatchInputEditor extends _CodeMirrorEditor__WEBPACK_IMPORTED_MODULE_0__.CodeMirrorEditor {\n constructor() {\n super(new Set([_CodeMirrorEditor__WEBPACK_IMPORTED_MODULE_0__.CodeMirrorEditor.PLACEHOLDER, _CodeMirrorEditor__WEBPACK_IMPORTED_MODULE_0__.CodeMirrorEditor.STYLE]), {\n classes: ["papyros-input-editor", "_tw-overflow-auto",\n "_tw-border-solid", "_tw-border-gray-200", "_tw-border-2", "_tw-rounded-lg",\n "dark:_tw-bg-dark-mode-bg", "dark:_tw-border-dark-mode-content",\n "focus:_tw-outline-none", "focus:_tw-ring-1", "focus:_tw-ring-blue-500"],\n minHeight: "10vh",\n maxHeight: "20vh",\n theme: {}\n });\n this.usedInputGutters = new _Gutters__WEBPACK_IMPORTED_MODULE_1__.UsedInputGutters();\n this.addExtension(this.usedInputGutters.toExtension());\n this.addExtension([\n _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.keymap.of([\n {\n key: "Enter", run: _codemirror_commands__WEBPACK_IMPORTED_MODULE_3__.insertNewline\n }\n ]),\n ]);\n }\n getLastHighlightArgs() {\n return this.lastHighlightArgs || {\n running: false,\n getInfo: lineNr => {\n return {\n lineNr,\n on: false,\n title: ""\n };\n }\n };\n }\n onViewUpdate(v) {\n super.onViewUpdate(v);\n // Ensure that highlighting occurs after CodeMirrors internal update\n // so that the style classes are not overwritten\n setTimeout(() => {\n this.highlight(this.getLastHighlightArgs());\n }, 10);\n }\n /**\n * Apply highlighting to the lines in the Editor\n * @param {HightlightArgs} args Arguments for highlighting\n * @param {Array} highlightClasses HTML classes to use for consumed lines\n */\n highlight(args, highlightClasses = ["_tw-bg-slate-200", "dark:_tw-bg-slate-500"]) {\n this.lastHighlightArgs = args;\n const { running, getInfo } = args;\n let nextLineToUse = 0;\n this.editorView.dom.querySelectorAll(".cm-line").forEach((line, i) => {\n const info = getInfo(i + 1);\n if (info.on) {\n nextLineToUse += 1;\n }\n line.classList.toggle("cm-activeLine", running && i === nextLineToUse);\n highlightClasses.forEach(className => {\n line.classList.toggle(className, i !== nextLineToUse && info.on);\n });\n line.setAttribute("contenteditable", "" + (!running || !info.on));\n this.usedInputGutters.setMarker(this.editorView, info);\n });\n }\n /**\n * @return {Array} Array of valid user input\n * Data in the last line that is not terminated by a newline is omitted\n */\n getLines() {\n const lines = this.editorView.state.doc.toString().split("\\n");\n return lines.slice(0, lines.length - 1);\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/editor/BatchInputEditor.ts?')},"./src/editor/CodeEditor.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CodeEditor: () => (/* binding */ CodeEditor)\n/* harmony export */ });\n/* harmony import */ var _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ProgrammingLanguage */ "./src/ProgrammingLanguage.ts");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @codemirror/autocomplete */ "./node_modules/@codemirror/autocomplete/dist/index.js");\n/* harmony import */ var _codemirror_commands__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @codemirror/commands */ "./node_modules/@codemirror/commands/dist/index.js");\n/* harmony import */ var _codemirror_lang_javascript__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @codemirror/lang-javascript */ "./node_modules/@codemirror/lang-javascript/dist/index.js");\n/* harmony import */ var _codemirror_lang_python__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @codemirror/lang-python */ "./node_modules/@codemirror/lang-python/dist/index.js");\n/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @codemirror/language */ "./node_modules/@codemirror/language/dist/index.js");\n/* harmony import */ var _codemirror_search__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @codemirror/search */ "./node_modules/@codemirror/search/dist/index.js");\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @codemirror/theme-one-dark */ "./node_modules/@codemirror/theme-one-dark/dist/index.js");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _codemirror_lint__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @codemirror/lint */ "./node_modules/@codemirror/lint/dist/index.js");\n/* harmony import */ var _CodeMirrorEditor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./CodeMirrorEditor */ "./src/editor/CodeMirrorEditor.ts");\n/* harmony import */ var _DarkTheme__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DarkTheme */ "./src/editor/DarkTheme.ts");\n/* harmony import */ var _TestCodeExtension__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TestCodeExtension */ "./src/editor/TestCodeExtension.ts");\n/* harmony import */ var _DebugExtension__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./DebugExtension */ "./src/editor/DebugExtension.ts");\n/* eslint-disable valid-jsdoc */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst tabCompletionKeyMap = [{ key: "Tab", run: _codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_6__.acceptCompletion }];\n/**\n * Component that provides useful features to users writing code\n */\nclass CodeEditor extends _CodeMirrorEditor__WEBPACK_IMPORTED_MODULE_2__.CodeMirrorEditor {\n /**\n * Construct a new CodeEditor\n * @param {Function} onRunRequest Callback for when the user wants to run the code\n * @param {string} initialCode The initial code to display\n * @param {number} indentLength The length in spaces for the indent unit\n */\n constructor(onRunRequest, initialCode = "", indentLength = 4) {\n super(new Set([\n CodeEditor.PROGRAMMING_LANGUAGE, CodeEditor.INDENTATION, CodeEditor.DEBUGGING,\n CodeEditor.PANEL, CodeEditor.AUTOCOMPLETION, CodeEditor.LINTING\n ]), {\n classes: ["papyros-code-editor", "_tw-overflow-auto",\n "_tw-border-solid", "_tw-border-gray-200", "_tw-border-2",\n "_tw-rounded-lg", "dark:_tw-border-dark-mode-content"],\n minHeight: "20vh",\n maxHeight: "72vh",\n theme: {}\n });\n this.debugExtension = new _DebugExtension__WEBPACK_IMPORTED_MODULE_5__.DebugExtension(this.editorView);\n this.addExtension([\n _codemirror_view__WEBPACK_IMPORTED_MODULE_7__.keymap.of([\n {\n key: "Mod-Enter", run: () => {\n onRunRequest();\n return true;\n }\n },\n // The original Ctrl-Enter keybind gets assigned to Shift-Enter\n {\n key: "Shift-Enter", run: _codemirror_commands__WEBPACK_IMPORTED_MODULE_8__.insertBlankLine\n }\n ]),\n ...CodeEditor.getExtensions()\n ]);\n this.setText(initialCode);\n this.setIndentLength(indentLength);\n this.testCodeExtension = new _TestCodeExtension__WEBPACK_IMPORTED_MODULE_4__.TestCodeExtension(this.editorView);\n this.addExtension(this.testCodeExtension.toExtension());\n this.debugMode = false;\n }\n set debugMode(value) {\n if (value) {\n this.reconfigure([CodeEditor.DEBUGGING, [\n this.debugExtension.toExtension(),\n ]]);\n this.debugExtension.reset();\n }\n else {\n this.reconfigure([CodeEditor.DEBUGGING, [\n (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_7__.highlightActiveLineGutter)(),\n (0,_codemirror_lint__WEBPACK_IMPORTED_MODULE_9__.lintGutter)(),\n (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_7__.highlightActiveLine)()\n ]]);\n }\n }\n set testCode(code) {\n this.testCodeExtension.testCode = code;\n }\n getText() {\n if (this.testCodeExtension) {\n return this.testCodeExtension.getNonTestCode();\n }\n else {\n return super.getText();\n }\n }\n getCode() {\n return super.getText();\n }\n setDarkMode(darkMode) {\n let styleExtensions = [];\n if (darkMode) {\n styleExtensions = [_DarkTheme__WEBPACK_IMPORTED_MODULE_3__.darkTheme, (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_10__.syntaxHighlighting)(_codemirror_theme_one_dark__WEBPACK_IMPORTED_MODULE_11__.oneDarkHighlightStyle)];\n }\n else {\n styleExtensions = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_10__.syntaxHighlighting)(_codemirror_language__WEBPACK_IMPORTED_MODULE_10__.defaultHighlightStyle);\n }\n this.reconfigure([_CodeMirrorEditor__WEBPACK_IMPORTED_MODULE_2__.CodeMirrorEditor.STYLE, styleExtensions]);\n }\n /**\n * @param {ProgrammingLanguage} language The language to use\n */\n setProgrammingLanguage(language) {\n this.reconfigure([CodeEditor.PROGRAMMING_LANGUAGE, CodeEditor.getLanguageSupport(language)]);\n this.setPlaceholder((0,_util_Util__WEBPACK_IMPORTED_MODULE_1__.t)("Papyros.code_placeholder", { programmingLanguage: language }));\n }\n /**\n * @param {LintSource} lintSource Function to obtain linting results\n */\n setLintingSource(lintSource) {\n this.reconfigure([\n CodeEditor.LINTING,\n (0,_codemirror_lint__WEBPACK_IMPORTED_MODULE_9__.linter)(lintSource)\n ]);\n }\n /**\n * @param {number} indentLength The number of spaces to use for indentation\n */\n setIndentLength(indentLength) {\n this.reconfigure([CodeEditor.INDENTATION, _codemirror_language__WEBPACK_IMPORTED_MODULE_10__.indentUnit.of(CodeEditor.getIndentUnit(indentLength))]);\n }\n /**\n * @param {HTMLElement} panel The panel to display at the bottom of the editor\n */\n setPanel(panel) {\n this.reconfigure([CodeEditor.PANEL, _codemirror_view__WEBPACK_IMPORTED_MODULE_7__.showPanel.of(() => {\n return { dom: panel };\n })]);\n }\n /**\n * @param {number} indentLength The amount of spaces to use\n * @return {string} The indentation unit to be used by CodeMirror\n */\n static getIndentUnit(indentLength) {\n return new Array(indentLength).fill(" ").join("");\n }\n /**\n * @param {ProgrammingLanguage} language The language to support\n * @return {LanguageSupport} CodeMirror LanguageSupport for the language\n */\n static getLanguageSupport(language) {\n switch (language) {\n case _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__.ProgrammingLanguage.Python: {\n return (0,_codemirror_lang_python__WEBPACK_IMPORTED_MODULE_12__.python)();\n }\n case _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__.ProgrammingLanguage.JavaScript: {\n return (0,_codemirror_lang_javascript__WEBPACK_IMPORTED_MODULE_13__.javascript)();\n }\n default: {\n throw new Error(`${language} is not yet supported.`);\n }\n }\n }\n /**\n * - line numbers\n * - special character highlighting\n * - the undo history\n * - a fold gutter\n * - custom selection drawing\n * - multiple selections\n * - reindentation on input\n * - bracket matching\n * - bracket closing\n * - autocompletion\n * - rectangular selection\n * - active line highlighting\n * - active line gutter highlighting\n * - selection match highlighting\n * - gutter for linting\n * Keymaps:\n * - the default command bindings\n * - bracket closing\n * - searching\n * - linting\n * - completion\n * - indenting with tab\n * @return {Array{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CodeMirrorEditor: () => (/* binding */ CodeMirrorEditor)\n/* harmony export */ });\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _util_Rendering__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/Rendering */ "./src/util/Rendering.ts");\n/* harmony import */ var _DarkTheme__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DarkTheme */ "./src/editor/DarkTheme.ts");\n/* harmony import */ var _Translations__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Translations */ "./src/Translations.js");\n/* harmony import */ var _codemirror_commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @codemirror/commands */ "./node_modules/@codemirror/commands/dist/index.js");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/Util */ "./src/util/Util.ts");\n\n\n\n\n\n\n\n/**\n * Base class for Editors implemented using CodeMirror 6\n * https://codemirror.net/6/\n */\nclass CodeMirrorEditor extends _util_Rendering__WEBPACK_IMPORTED_MODULE_0__.Renderable {\n /**\n * @param {Set} compartments Identifiers for configurable extensions\n * @param {EditorStyling} styling Data to style this editor\n */\n constructor(compartments, styling) {\n super();\n this.styling = styling;\n this.listenerTimeouts = new Map();\n // Ensure default compartments are present\n compartments.add(CodeMirrorEditor.STYLE);\n compartments.add(CodeMirrorEditor.PLACEHOLDER);\n compartments.add(CodeMirrorEditor.THEME);\n compartments.add(CodeMirrorEditor.LANGUAGE);\n this.compartments = new Map();\n const configurableExtensions = [];\n compartments.forEach(opt => {\n const compartment = new _codemirror_state__WEBPACK_IMPORTED_MODULE_4__.Compartment();\n this.compartments.set(opt, compartment);\n configurableExtensions.push(compartment.of([]));\n });\n this.editorView = new _codemirror_view__WEBPACK_IMPORTED_MODULE_5__.EditorView({\n state: _codemirror_state__WEBPACK_IMPORTED_MODULE_4__.EditorState.create({\n extensions: [\n configurableExtensions,\n _codemirror_view__WEBPACK_IMPORTED_MODULE_5__.EditorView.updateListener.of(this.onViewUpdate.bind(this))\n ]\n })\n });\n }\n onViewUpdate(v) {\n if (v.docChanged) {\n this.handleChange();\n }\n }\n /**\n * @param {Extension} extension The extension to add to the Editor\n */\n addExtension(extension) {\n this.editorView.dispatch({\n effects: _codemirror_state__WEBPACK_IMPORTED_MODULE_4__.StateEffect.appendConfig.of(extension)\n });\n }\n /**\n * @return {string} The text within the editor\n */\n getText() {\n return this.editorView.state.doc.toString();\n }\n /**\n * @param {string} text The new value to be shown in the editor\n */\n setText(text) {\n this.editorView.dispatch({ changes: { from: 0, to: this.getText().length, insert: text } });\n }\n /**\n * Helper method to dispatch configuration changes at runtime\n * @param {Array<[Option, Extension]>} items Array of items to reconfigure\n * The option indicates the relevant compartment\n * The extension indicates the new configuration\n */\n reconfigure(...items) {\n this.editorView.dispatch({\n effects: items.map(([opt, ext]) => this.compartments.get(opt).reconfigure(ext))\n });\n }\n /**\n * Apply focus to the Editor\n */\n focus() {\n this.editorView.focus();\n (0,_codemirror_commands__WEBPACK_IMPORTED_MODULE_6__.cursorDocEnd)(this.editorView);\n }\n /**\n * @param {string} placeholderValue The contents of the placeholder\n */\n setPlaceholder(placeholderValue) {\n this.reconfigure([\n CodeMirrorEditor.PLACEHOLDER,\n (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_5__.placeholder)(placeholderValue)\n ]);\n }\n /**\n * @param {boolean} darkMode Whether to use dark mode\n */\n setDarkMode(darkMode) {\n let styleExtensions = [];\n if (darkMode) {\n styleExtensions = [_DarkTheme__WEBPACK_IMPORTED_MODULE_1__.darkTheme];\n }\n this.reconfigure([CodeMirrorEditor.STYLE, styleExtensions]);\n }\n /**\n * Override the style used by this Editor\n * @param {Partial} styling Object with keys of EditorStyling to override styles\n */\n setStyling(styling) {\n Object.assign(this.styling, styling);\n this.reconfigure([\n CodeMirrorEditor.THEME,\n _codemirror_view__WEBPACK_IMPORTED_MODULE_5__.EditorView.theme(Object.assign({ ".cm-scroller": { overflow: "auto" }, "&": {\n "maxHeight": this.styling.maxHeight, "height": "100%",\n "font-size": "14px" // use proper size to align gutters with editor\n }, ".cm-gutter,.cm-content": { minHeight: this.styling.minHeight }, ".cm-button": {\n "background-color": "#455A64",\n "color": "white", "background-image": "none"\n } }, (this.styling.theme || {})))\n ]);\n }\n _render(options) {\n this.setStyling(this.styling);\n this.setDarkMode(options.darkMode || false);\n this.reconfigure([\n CodeMirrorEditor.LANGUAGE,\n _codemirror_state__WEBPACK_IMPORTED_MODULE_4__.EditorState.phrases.of(_Translations__WEBPACK_IMPORTED_MODULE_2__.CODE_MIRROR_TRANSLATIONS[_util_Util__WEBPACK_IMPORTED_MODULE_3__.i18n.locale])\n ]);\n const wrappingDiv = document.createElement("div");\n wrappingDiv.classList.add(...this.styling.classes);\n wrappingDiv.replaceChildren(this.editorView.dom);\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_0__.renderWithOptions)(options, wrappingDiv);\n }\n /**\n * Process the changes by informing the listeners of the new contents\n */\n handleChange() {\n const currentDoc = this.getText();\n const now = Date.now();\n this.listenerTimeouts.forEach((timeoutData, listener) => {\n // Clear existing scheduled calls\n if (timeoutData.timeout !== null) {\n clearTimeout(timeoutData.timeout);\n }\n timeoutData.lastCalled = now;\n if (listener.delay && listener.delay > 0) {\n timeoutData.timeout = setTimeout(() => {\n timeoutData.timeout = null;\n listener.onChange(currentDoc);\n }, listener.delay);\n }\n else {\n listener.onChange(currentDoc);\n }\n timeoutData.lastCalled = now;\n });\n }\n /**\n * @param {DocChangeListener} changeListener Listener that performs actions on the new contents\n */\n onChange(changeListener) {\n this.listenerTimeouts.set(changeListener, { timeout: null, lastCalled: 0 });\n }\n}\nCodeMirrorEditor.STYLE = "style";\nCodeMirrorEditor.PLACEHOLDER = "placeholder";\nCodeMirrorEditor.THEME = "theme";\nCodeMirrorEditor.LANGUAGE = "language";\n\n\n//# sourceURL=webpack://Papyros/./src/editor/CodeMirrorEditor.ts?')},"./src/editor/DarkTheme.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ darkTheme: () => (/* binding */ darkTheme)\n/* harmony export */ });\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n// Based on https://github.com/codemirror/theme-one-dark/blob/main/src/one-dark.ts with slight edits\n\n// Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors\nconst ivory = "#abb2bf";\nconst stone = "#7d8799"; // Brightened compared to original to increase contrast\nconst darkBackground = "#21252b";\nconst highlightBackground = "#2c313a";\nconst background = "#282c34";\nconst tooltipBackground = "#353a42";\nconst selection = "#3E4451";\nconst cursor = "#528bff";\n// / The editor theme styles\nconst darkTheme = _codemirror_view__WEBPACK_IMPORTED_MODULE_0__.EditorView.theme({\n "&": {\n color: ivory,\n backgroundColor: background\n },\n ".cm-content": {\n caretColor: cursor\n },\n ".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor },\n // eslint-disable-next-line max-len\n "&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection },\n ".cm-panels": { backgroundColor: darkBackground, color: ivory },\n ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },\n ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },\n ".cm-searchMatch": {\n backgroundColor: "#72a1ff59",\n outline: "1px solid #457dff"\n },\n ".cm-searchMatch.cm-searchMatch-selected": {\n backgroundColor: "#6199ff2f"\n },\n ".cm-activeLine": { backgroundColor: highlightBackground },\n ".cm-selectionMatch": { backgroundColor: "#aafe661a" },\n "&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": {\n backgroundColor: "#bad0f847",\n outline: "1px solid #515a6b"\n },\n ".cm-gutters": {\n // make gutters darker\n backgroundColor: darkBackground,\n color: stone,\n border: "none"\n },\n ".cm-activeLineGutter": {\n backgroundColor: highlightBackground\n },\n ".cm-foldPlaceholder": {\n backgroundColor: "transparent",\n border: "none",\n color: "#ddd"\n },\n ".cm-tooltip": {\n border: "none",\n backgroundColor: tooltipBackground\n },\n ".cm-tooltip .cm-tooltip-arrow:before": {\n borderTopColor: "transparent",\n borderBottomColor: "transparent"\n },\n ".cm-tooltip .cm-tooltip-arrow:after": {\n borderTopColor: tooltipBackground,\n borderBottomColor: tooltipBackground\n },\n ".cm-tooltip-autocomplete": {\n "& > ul > li[aria-selected]": {\n backgroundColor: highlightBackground,\n color: ivory\n }\n }\n}, { dark: true });\n\n\n//# sourceURL=webpack://Papyros/./src/editor/DarkTheme.ts?')},"./src/editor/DebugExtension.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DebugExtension: () => (/* binding */ DebugExtension)\n/* harmony export */ });\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _LineEffectExtension__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LineEffectExtension */ "./src/editor/LineEffectExtension.ts");\n/* harmony import */ var _Gutters__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Gutters */ "./src/editor/Gutters.ts");\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _BackendManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../BackendManager */ "./src/BackendManager.ts");\n/* harmony import */ var _BackendEvent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../BackendEvent */ "./src/BackendEvent.ts");\n\n\n\n\n\n\nconst activeLineDecoration = _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.line({ class: "cm-activeLine" });\nconst activeLineGutterMarker = new class extends _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.GutterMarker {\n constructor() {\n super(...arguments);\n this.elementClass = "cm-activeLineGutter";\n }\n};\nconst markLine = _codemirror_state__WEBPACK_IMPORTED_MODULE_5__.StateEffect.define();\nconst markedLine = _codemirror_state__WEBPACK_IMPORTED_MODULE_5__.StateField.define({\n create: () => undefined,\n update(value, tr) {\n for (const effect of tr.effects) {\n if (effect.is(markLine)) {\n return effect.value;\n }\n }\n return value;\n }\n});\nconst markedLineGutterHighlighter = _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.gutterLineClass.compute([markedLine], state => {\n if (state.field(markedLine) === undefined) {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_5__.RangeSet.empty;\n }\n const linePos = state.doc.line(state.field(markedLine)).from;\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_5__.RangeSet.of([activeLineGutterMarker.range(linePos)]);\n});\nclass DebugExtension {\n constructor(view) {\n this.view = view;\n this.gutter = new _Gutters__WEBPACK_IMPORTED_MODULE_1__.DebugLineGutter();\n this.lineEffect = new _LineEffectExtension__WEBPACK_IMPORTED_MODULE_0__.LineEffectExtension(view);\n _BackendManager__WEBPACK_IMPORTED_MODULE_2__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_3__.BackendEventType.FrameChange, e => {\n const line = e.data.line;\n this.markLine(line);\n });\n }\n reset() {\n this.markLine(1);\n }\n markLine(lineNr) {\n this.gutter.markLine(this.view, lineNr);\n this.lineEffect.set([activeLineDecoration.range(this.view.state.doc.line(lineNr).from)]);\n this.view.dispatch({ effects: [\n markLine.of(lineNr),\n _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.scrollIntoView(this.view.state.doc.line(lineNr).from)\n ] });\n }\n toExtension() {\n return [\n this.lineEffect.toExtension(),\n this.gutter.toExtension(),\n markedLine,\n markedLineGutterHighlighter,\n _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.editable.of(false)\n ];\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/editor/DebugExtension.ts?')},"./src/editor/Gutters.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BreakpointsGutter: () => (/* binding */ BreakpointsGutter),\n/* harmony export */ DebugLineGutter: () => (/* binding */ DebugLineGutter),\n/* harmony export */ Gutters: () => (/* binding */ Gutters),\n/* harmony export */ UsedInputGutters: () => (/* binding */ UsedInputGutters)\n/* harmony export */ });\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _util_Rendering__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/Rendering */ "./src/util/Rendering.ts");\n\n\n\n\n\n/**\n * Helper class to create markers in the gutter\n */\nclass SimpleMarker extends _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.GutterMarker {\n constructor(\n // Function to create the DOM element\n createMarker) {\n super();\n this.createMarker = createMarker;\n }\n toDOM() {\n return this.createMarker();\n }\n}\nclass Gutters {\n constructor(config) {\n this.config = config;\n this.effect = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define();\n this.state = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateField.define({\n create: () => {\n return new Map();\n },\n update: (current, transaction) => {\n const updatedMap = new Map(current);\n for (const e of transaction.effects) {\n if (e.is(this.effect)) {\n updatedMap.set(e.value.lineNr, e.value);\n }\n }\n return updatedMap;\n }\n });\n }\n applyClasses(marker) {\n const classes = { classNames: this.config.markerClasses };\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_0__.appendClasses)(classes, "_tw-px-1 papyros-gutter-marker");\n marker.elementClass += classes.classNames;\n return marker;\n }\n hasMarker(view, lineNr) {\n const guttersInfo = view.state.field(this.state);\n return guttersInfo.has(lineNr) && guttersInfo.get(lineNr).on;\n }\n /**\n * Set a marker with the given info\n * @param {EditorView} view View in which the Gutters live\n * @param {Info} info Info used to render the marker\n */\n setMarker(view, info) {\n if (this.hasMarker(view, info.lineNr) !== info.on) {\n view.dispatch({\n effects: this.effect.of(info)\n });\n }\n }\n /**\n * @param {EditorView} view The view in which the Gutters live\n * @return {Set} The 1-based line numbers with a breakpoint\n */\n getMarkedLines(view) {\n const markedLines = new Set();\n const guttersInfo = view.state.field(this.state);\n guttersInfo.forEach((info, lineNr) => {\n if (info.on) {\n markedLines.add(lineNr);\n }\n });\n return markedLines;\n }\n /**\n * @return {Extension} The Gutters as a CodeMirror Extension\n */\n toExtension() {\n // TODO correct type: https://github.com/codemirror/codemirror.next/issues/839\n const handlers = {};\n if (this.config.onClick) {\n handlers["mousedown"] = (view, line) => {\n const markings = view.state.field(this.state);\n const lineNr = view.state.doc.lineAt(line.from).number;\n const markerInfo = markings.get(lineNr);\n // Line numbers start at 1\n this.config.onClick(view, markerInfo);\n };\n }\n return [\n this.state,\n (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.gutter)({\n class: `cm-${this.config.name}-gutter`,\n lineMarker: (view, line) => {\n // Lookup whether the element should be drawn\n const guttersInfo = view.state.field(this.state);\n const lineNr = view.state.doc.lineAt(line.from).number;\n if (guttersInfo.has(lineNr) && guttersInfo.get(lineNr).on) {\n return this.applyClasses(this.marker(guttersInfo.get(lineNr)));\n }\n else {\n return null;\n }\n },\n lineMarkerChange: update => {\n return update.startState.field(this.state) !== update.state.field(this.state);\n },\n initialSpacer: () => {\n return this.applyClasses(this.marker({ lineNr: -1, on: true }));\n },\n domEventHandlers: handlers\n }),\n this.config.extraExtensions || []\n ];\n }\n}\n/**\n * Gutters to show and allow toggling of breakpoints\n */\nclass BreakpointsGutter extends Gutters {\n constructor() {\n super({\n name: "breakpoint",\n onClick: (view, info) => {\n info.on = !info.on;\n this.setMarker(view, info);\n },\n extraExtensions: [\n _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.baseTheme({\n ".cm-breakpoint-gutter .cm-gutterElement": {\n color: "red",\n paddingLeft: "5px",\n cursor: "default"\n }\n })\n ]\n });\n }\n marker() {\n return new SimpleMarker(() => document.createTextNode("🔴"));\n }\n}\n/**\n * Gutters to show a checkmark for used input\n */\nclass UsedInputGutters extends Gutters {\n constructor() {\n super({\n name: "input"\n });\n }\n marker(info) {\n return new SimpleMarker(() => {\n const node = document.createElement("div");\n node.replaceChildren(document.createTextNode("✔"));\n node.setAttribute("title", info.title);\n // Text interface tells us that more complex node will be processed into Text nodes\n return node;\n });\n }\n}\nclass DebugMarker extends _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.GutterMarker {\n toDOM() {\n const icon = document.createElement("i");\n icon.classList.add("mdi", "mdi-arrow-right-bold", "mdi-18");\n return icon;\n }\n}\n/**\n * shows the debugged line\n */\nclass DebugLineGutter extends Gutters {\n constructor() {\n super({\n name: "debugline",\n extraExtensions: [\n _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.baseTheme({\n ".cm-debugline-gutter .cm-gutterElement": {\n lineHeight: "20px",\n marginRight: "-5px",\n fontSize: "18px"\n }\n })\n ]\n });\n this.activeLine = 1;\n }\n marker() {\n return new DebugMarker();\n }\n markLine(view, lineNr) {\n this.setMarker(view, { lineNr: this.activeLine, on: false });\n this.setMarker(view, { lineNr, on: true });\n this.activeLine = lineNr;\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/editor/Gutters.ts?')},"./src/editor/LineEffectExtension.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LineEffectExtension: () => (/* binding */ LineEffectExtension)\n/* harmony export */ });\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n\n\nclass LineEffectExtension {\n constructor(view) {\n this.addEffect = _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.StateEffect.define();\n this.clearEffect = _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.StateEffect.define();\n this.setEffect = _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.StateEffect.define();\n this.editorView = view;\n }\n add(range) {\n this.editorView.dispatch({\n effects: this.addEffect.of(range)\n });\n }\n clear() {\n this.editorView.dispatch({\n effects: this.clearEffect.of(null)\n });\n }\n set(range) {\n this.editorView.dispatch({\n effects: this.setEffect.of(range)\n });\n }\n toExtension() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_0__.StateField.define({\n create() {\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.Decoration.none;\n },\n update(value, transaction) {\n let v = value.map(transaction.changes);\n for (const effect of transaction.effects) {\n if (effect.is(self.clearEffect) || effect.is(self.setEffect)) {\n v = _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.Decoration.none;\n }\n if (effect.is(self.addEffect) || effect.is(self.setEffect)) {\n v = v.update({ add: effect.value });\n }\n }\n return v;\n },\n provide: f => _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.decorations.from(f)\n });\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/editor/LineEffectExtension.ts?')},"./src/editor/TestCodeExtension.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TestCodeExtension: () => (/* binding */ TestCodeExtension)\n/* harmony export */ });\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var codemirror_readonly_ranges__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! codemirror-readonly-ranges */ "./node_modules/codemirror-readonly-ranges/dist/index.es.js");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _LineEffectExtension__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LineEffectExtension */ "./src/editor/LineEffectExtension.ts");\n\n\n\n\nconst highlightDecoration = _codemirror_view__WEBPACK_IMPORTED_MODULE_3__.Decoration.line({ class: "papyros-test-code" });\n// Widget to manage the test code\nclass TestCodeWidget extends _codemirror_view__WEBPACK_IMPORTED_MODULE_3__.WidgetType {\n constructor(testCodeExtension) {\n super();\n this.testCodeExtension = testCodeExtension;\n }\n toDOM() {\n const element = document.createElement("div");\n element.classList.add("papyros-test-code-widget");\n const span = document.createElement("span");\n span.innerText = (0,_util_Util__WEBPACK_IMPORTED_MODULE_1__.t)("Papyros.editor.test_code.description");\n element.appendChild(span);\n const buttons = document.createElement("div");\n buttons.classList.add("papyros-test-code-buttons");\n const editButton = document.createElement("a");\n editButton.classList.add("papyros-icon-link");\n editButton.innerHTML = "";\n editButton.addEventListener("click", () => {\n console.log("edit test code");\n this.testCodeExtension.reset(true);\n });\n editButton.title = (0,_util_Util__WEBPACK_IMPORTED_MODULE_1__.t)("Papyros.editor.test_code.edit");\n buttons.appendChild(editButton);\n const deleteButton = document.createElement("a");\n deleteButton.classList.add("papyros-icon-link");\n deleteButton.innerHTML = "";\n deleteButton.addEventListener("click", () => {\n console.log("remove test code");\n this.testCodeExtension.reset();\n });\n deleteButton.title = (0,_util_Util__WEBPACK_IMPORTED_MODULE_1__.t)("Papyros.editor.test_code.remove");\n buttons.appendChild(deleteButton);\n element.appendChild(buttons);\n return element;\n }\n ignoreEvent() {\n return false;\n }\n}\nclass BottomPaddingWidget extends _codemirror_view__WEBPACK_IMPORTED_MODULE_3__.WidgetType {\n toDOM() {\n const element = document.createElement("div");\n element.classList.add("papyros-bottom-padding-widget");\n element.appendChild(document.createElement("div"));\n return element;\n }\n}\nconst bottomPaddingDecoration = _codemirror_view__WEBPACK_IMPORTED_MODULE_3__.Decoration.widget({ widget: new BottomPaddingWidget(), side: 1, block: true });\nclass TestCodeExtension {\n constructor(view) {\n this.lines = "";\n this.allowEdit = true;\n this.view = view;\n this.widget = _codemirror_view__WEBPACK_IMPORTED_MODULE_3__.Decoration.widget({ widget: new TestCodeWidget(this), block: true, side: 1 });\n this.lineEffect = new _LineEffectExtension__WEBPACK_IMPORTED_MODULE_2__.LineEffectExtension(view);\n }\n get numberOfTestLines() {\n return this.lines.split("\\n").length;\n }\n lineFromEnd(line, state = undefined) {\n const currentState = state || this.view.state;\n const lineFromEnd = currentState.doc.lines - line;\n return currentState.doc.line(lineFromEnd);\n }\n highlightLines() {\n for (let i = 0; i < this.numberOfTestLines; i++) {\n this.lineEffect.add([highlightDecoration.range(this.lineFromEnd(i).from)]);\n }\n }\n addWidget() {\n this.lineEffect.add([\n this.widget.range(this.lineFromEnd(this.numberOfTestLines).to),\n bottomPaddingDecoration.range(this.lineFromEnd(0).to)\n ]);\n }\n clearAllLineEffects() {\n this.lineEffect.clear();\n }\n getReadOnlyRanges(state) {\n if (this.allowEdit) {\n return [];\n }\n return [{\n from: this.lineFromEnd(this.numberOfTestLines - 1, state).from,\n to: undefined // until last line\n }];\n }\n insertTestCode(code) {\n var _a;\n // insert up to two new lines to separate the test code from the user code\n // but only if they are not already there\n const finalNewLineCount = ((_a = this.view.state.doc.toString().match(/\\n*$/)) === null || _a === void 0 ? void 0 : _a[0].length) || 0;\n const newLinesToInsert = Math.max(0, 2 - finalNewLineCount);\n this.view.dispatch({ changes: { from: this.lineFromEnd(0).to, insert: "\\n".repeat(newLinesToInsert) } });\n this.view.dispatch({ changes: { from: this.lineFromEnd(0).to, insert: code } });\n this.lines = code;\n }\n reset(keepCode = false) {\n this.allowEdit = true;\n this.clearAllLineEffects();\n if (this.lines === "") {\n return;\n }\n if (!keepCode) {\n this.view.dispatch({ changes: { from: this.lineFromEnd(this.numberOfTestLines).to, to: this.lineFromEnd(0).to, insert: "" } });\n }\n this.lines = "";\n }\n set testCode(code) {\n this.reset();\n if (code === "") {\n return;\n }\n this.insertTestCode(code);\n this.allowEdit = false;\n this.highlightLines();\n this.addWidget();\n }\n getNonTestCode() {\n if (this.allowEdit) {\n return this.view.state.doc.toString();\n }\n return this.view.state.doc.sliceString(0, this.lineFromEnd(this.numberOfTestLines).to);\n }\n toExtension() {\n return [this.lineEffect.toExtension(), (0,codemirror_readonly_ranges__WEBPACK_IMPORTED_MODULE_0__["default"])(this.getReadOnlyRanges.bind(this))];\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/editor/TestCodeExtension.ts?')},"./src/examples/Examples.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getCodeForExample: () => (/* binding */ getCodeForExample),\n/* harmony export */ getExampleNames: () => (/* binding */ getExampleNames),\n/* harmony export */ getExamples: () => (/* binding */ getExamples)\n/* harmony export */ });\n/* harmony import */ var _ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ProgrammingLanguage */ "./src/ProgrammingLanguage.ts");\n/* harmony import */ var _JavaScriptExamples__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./JavaScriptExamples */ "./src/examples/JavaScriptExamples.ts");\n/* harmony import */ var _PythonExamples__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./PythonExamples */ "./src/examples/PythonExamples.ts");\n\n\n\nconst EXAMPLES_MAP = new Map([\n [_ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__.ProgrammingLanguage.JavaScript, _JavaScriptExamples__WEBPACK_IMPORTED_MODULE_1__.JAVASCRIPT_EXAMPLES],\n // Hello, World! as key seems to cause issues for TypeScript\n [_ProgrammingLanguage__WEBPACK_IMPORTED_MODULE_0__.ProgrammingLanguage.Python, _PythonExamples__WEBPACK_IMPORTED_MODULE_2__.PYTHON_EXAMPLES]\n]);\nfunction getExamples(language) {\n if (EXAMPLES_MAP.has(language)) {\n return EXAMPLES_MAP.get(language);\n }\n else {\n return {};\n }\n}\nfunction getExampleNames(language) {\n return Object.keys(getExamples(language));\n}\nfunction getCodeForExample(language, name) {\n return getExamples(language)[name];\n}\n\n\n//# sourceURL=webpack://Papyros/./src/examples/Examples.ts?')},"./src/examples/JavaScriptExamples.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ JAVASCRIPT_EXAMPLES: () => (/* binding */ JAVASCRIPT_EXAMPLES)\n/* harmony export */ });\nconst JAVASCRIPT_EXAMPLES = {\n "Hello world!": "console.log(\\"Hello, World!\\");",\n "Input": `const name = prompt(\'What is your name?\')\nconsole.log(\\`Hello, \\${name}!\\`)`,\n "Fibonacci": `function fibonacci(n){\n if (n <= 1) {\n return n;\n }\n return fibonacci(n - 2) + fibonacci(n - 1);\n}\nfor(let i = 0; i < 10; i += 1){\n console.log(fibonacci(i));\n}\n`\n};\n\n\n//# sourceURL=webpack://Papyros/./src/examples/JavaScriptExamples.ts?')},"./src/examples/PythonExamples.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PYTHON_EXAMPLES: () => (/* binding */ PYTHON_EXAMPLES)\n/* harmony export */ });\nconst PYTHON_EXAMPLES = {\n "Hello, World!": "print(\'Hello, World!\')",\n "Input": `name = input(\'What is your name?\')\nprint(f\'Hello, {name}!\')`,\n "Fibonacci": `def fibonacci(n):\n return n if n <= 1 else fibonacci(n- 2) + fibonacci(n - 1)\n\nprint([fibonacci(n) for n in range(10)])`,\n "Doctests": `def factorial(n):\n """Return the factorial of n, an exact integer >= 0.\n\n >>> [factorial(n) for n in range(6)]\n [1, 1, 2, 6, 24, 120]\n >>> factorial(30)\n 265252859812191058636308480000000\n >>> factorial(-1)\n Traceback (most recent call last):\n ...\n ValueError: n must be >= 0\n\n Factorials of floats are OK, but the float must be an exact integer:\n >>> factorial(30.1)\n Traceback (most recent call last):\n ...\n ValueError: n must be exact integer\n >>> factorial(30.0)\n 265252859812191058636308480000000\n\n It must also not be ridiculously large:\n >>> factorial(1e100)\n Traceback (most recent call last):\n ...\n OverflowError: n too large\n """\n\n import math\n if not n >= 0:\n raise ValueError("n must be >= 0")\n if math.floor(n) != n:\n raise ValueError("n must be exact integer")\n if n+1 == n: # catch a value like 1e300\n raise OverflowError("n too large")\n result = 1\n factor = 2\n while factor <= n:\n result *= factor\n factor += 1\n return result\n\ndef wrong_factorial(n):\n """\n >>> [wrong_factorial(n) for n in range(6)]\n [1, 1, 2, 6, 24, 120]\n >>> wrong_factorial(30)\n 265252859812191058636308480000000\n """\n return 0\n`,\n "Async": `import asyncio\n\nasync def nested():\n print(42)\n\nasync def main():\n # Schedule nested() to run soon concurrently\n # with "main()".\n task = asyncio.create_task(nested())\n\n # "task" can now be used to cancel "nested()", or\n # can simply be awaited to wait until it is complete:\n await task\n\nawait main()\n`,\n "Erroneous": `def bitonic_search(numbers, query):\n if not numbers:\n return -1\n if len(numbers) == 1:\n return 0 if numbers[0] == query else -1\n int top_index = find_max_index(numbers, 0, len(numbers))\n possible_position = find_bitonic_query(numbers,query,0,top_index+1, lambda a, b: a - b)\n if possible_position != -1:\n return possible_position\n else:\n return find_bitonic_query(numbers,query,top_index, len(numbers), lambda a, b: b - a)\n\ndef find_max_index(numbers, start, stop):\n while start <= stop:\n if stop - start <= 1:\n return start\n middle = (start + stop) / 2;\n if numbers[middle] < numbers[middle+1]:\n start = midden + 1\n else:\n stop = midden\n \ndef find_bitonic_query(numbers, query, start, stop, comp):\n while start <= stop:\n if stop - start <= 1:\n return start if numbers[start] == query else -1\n middle = (start + stop) / 2;\n if comp(numbers[midden], query) <= 0:\n start = midden\n else:\n stop = midden\n`,\n "Unicode": `import random\nemoji = \'🎅🤶👪🦌🌟❄️☃️🔥🎄🎁🧦🔔🎶🕯️🦆\'\nfor _ in range(10):\n print(\'\'.join(random.choice(emoji) for _ in range(30)))\n`,\n "Files": `with open("names.txt", "w") as out_file:\n for name in ["Alice", "Bob", "Claire"]:\n print(name, file=out_file)\n\nwith open("names.txt", "r") as in_file:\n for line in in_file:\n print(line.rstrip())\n`,\n "Matplotlib": `import matplotlib.pyplot as plt\nimport networkx as nx\n\nplt.rcParams["font.size"] = 10\nplt.figure()\nplt.title(\'Random graph\')\n\nplt.tick_params(\n axis=\'both\', left=\'off\', top=\'off\', right=\'off\', \n bottom=\'off\', labelleft=\'off\', labeltop=\'off\', \n labelright=\'off\', labelbottom=\'off\'\n)\nG = nx.random_geometric_graph(512, 0.125)\npos=nx.spring_layout(G)\nnx.draw_networkx_edges(G, pos, alpha=0.2)\nnx.draw_networkx_nodes(G, pos, node_color=\'r\', node_size=12)\n\nplt.show()\n`,\n "Sleep": `import time\ntext = """What is the air-speed velocity of an unladen swallow?\nWhat do you mean? An African or European swallow?\nWhat? I, I don\'t know that.\n"""\nfor character in text:\n print(character, end="")\n time.sleep(0.1)\n`,\n "Overflow": `from functools import lru_cache\n\n@lru_cache\ndef fibonacci(n):\n return n if n <= 1 else fibonacci(n- 2) + fibonacci(n - 1)\n\nfor index in range(5000):\n print(f\'{index}: {fibonacci(index)}\')\n`,\n "Interrupt": `i = 0\nwhile i >= 0:\n print(i)\n i += 1\n`\n};\n\n\n//# sourceURL=webpack://Papyros/./src/examples/PythonExamples.ts?')},"./src/input/BatchInputHandler.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BatchInputHandler: () => (/* binding */ BatchInputHandler)\n/* harmony export */ });\n/* harmony import */ var _InputManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../InputManager */ "./src/InputManager.ts");\n/* harmony import */ var _UserInputHandler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./UserInputHandler */ "./src/input/UserInputHandler.ts");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _editor_BatchInputEditor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../editor/BatchInputEditor */ "./src/editor/BatchInputEditor.ts");\n/* harmony import */ var _BackendManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../BackendManager */ "./src/BackendManager.ts");\n/* harmony import */ var _BackendEvent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../BackendEvent */ "./src/BackendEvent.ts");\n\n\n\n\n\n\nclass BatchInputHandler extends _UserInputHandler__WEBPACK_IMPORTED_MODULE_1__.UserInputHandler {\n /**\n * Construct a new BatchInputHandler\n * @param {function()} inputCallback Callback for when the user has entered a value\n */\n constructor(inputCallback) {\n super(inputCallback);\n this.debugMode = false;\n this.debugLine = 0;\n this.lineNr = 0;\n this.previousInput = "";\n this.running = false;\n this.prompts = [];\n this.batchEditor = new _editor_BatchInputEditor__WEBPACK_IMPORTED_MODULE_3__.BatchInputEditor();\n this.batchEditor.onChange({\n onChange: this.handleInputChanged.bind(this),\n delay: 0\n });\n _BackendManager__WEBPACK_IMPORTED_MODULE_4__.BackendManager.subscribe(_BackendEvent__WEBPACK_IMPORTED_MODULE_5__.BackendEventType.FrameChange, e => {\n this.debugLine = e.data.inputs;\n this.highlight(this.running);\n });\n }\n /**\n * Handle new input, potentially sending it to the awaiting receiver\n * @param {string} newInput The new user input\n */\n handleInputChanged(newInput) {\n const newLines = newInput ? newInput.split("\\n") : [];\n if (newLines.length < this.lineNr) {\n this.lineNr = newLines.length;\n }\n if (this.waiting && newLines.length > this.lineNr + 1) {\n // Require explicitly pressing enter\n this.inputCallback(this.next());\n }\n this.highlight(this.running);\n this.previousInput = newInput;\n }\n toggle(active) {\n if (active) {\n this.batchEditor.setText(this.previousInput);\n }\n else {\n this.previousInput = this.batchEditor.getText();\n }\n }\n getInputMode() {\n return _InputManager__WEBPACK_IMPORTED_MODULE_0__.InputMode.Batch;\n }\n /**\n * Retrieve the lines of input that the user has given so far\n * @return {Array} The entered lines\n */\n get lines() {\n return this.batchEditor.getLines();\n }\n hasNext() {\n return this.lineNr < this.lines.length;\n }\n highlight(running) {\n const whichLines = (index) => {\n if (this.debugMode) {\n return index < this.debugLine;\n }\n return index < this.lineNr;\n };\n this.batchEditor.highlight({\n running,\n getInfo: (lineNr) => {\n let message = (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.used_input");\n const index = lineNr - 1;\n const shouldShow = whichLines(index);\n if (index < this.prompts.length && this.prompts[index]) {\n message = (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.used_input_with_prompt", { prompt: this.prompts[index] });\n }\n return { lineNr, on: shouldShow, title: message };\n }\n });\n }\n next() {\n const nextLine = this.lines[this.lineNr];\n this.lineNr += 1;\n this.highlight(true);\n return nextLine;\n }\n reset() {\n super.reset();\n this.lineNr = 0;\n this.debugLine = 0;\n this.prompts = [];\n this.highlight(this.running);\n }\n onRunStart() {\n this.running = true;\n this.reset();\n }\n onRunEnd() {\n this.running = false;\n this.highlight(false);\n }\n waitWithPrompt(waiting, prompt) {\n super.waitWithPrompt(waiting, prompt);\n if (this.waiting) {\n this.prompts.push(prompt || "");\n if (this.hasNext()) {\n this.inputCallback(this.next());\n }\n }\n }\n setPlaceholder(placeholderValue) {\n this.batchEditor.setPlaceholder(placeholderValue);\n }\n focus() {\n this.batchEditor.focus();\n }\n _render(options) {\n this.batchEditor.render(options);\n if (options.inputStyling) {\n this.batchEditor.setStyling(options.inputStyling);\n }\n this.highlight(this.running);\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/input/BatchInputHandler.ts?')},"./src/input/InteractiveInputHandler.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ InteractiveInputHandler: () => (/* binding */ InteractiveInputHandler)\n/* harmony export */ });\n/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Constants */ "./src/Constants.ts");\n/* harmony import */ var _InputManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../InputManager */ "./src/InputManager.ts");\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _UserInputHandler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./UserInputHandler */ "./src/input/UserInputHandler.ts");\n/* harmony import */ var _util_Rendering__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/Rendering */ "./src/util/Rendering.ts");\n\n\n\n\n\n/**\n * Input handler that takes input from the user in an interactive fashion\n */\nclass InteractiveInputHandler extends _UserInputHandler__WEBPACK_IMPORTED_MODULE_3__.UserInputHandler {\n /**\n * Retrieve the button that users can click to send their input\n */\n get sendButton() {\n return (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_0__.SEND_INPUT_BTN_ID);\n }\n /**\n * Retrieve the HTMLInputElement for this InputHandler\n */\n get inputArea() {\n return (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.getElement)(_Constants__WEBPACK_IMPORTED_MODULE_0__.INPUT_TA_ID);\n }\n getInputMode() {\n return _InputManager__WEBPACK_IMPORTED_MODULE_1__.InputMode.Interactive;\n }\n hasNext() {\n return this.waiting; // Allow sending empty lines when the user does this explicitly\n }\n next() {\n const value = this.inputArea.value;\n this.reset();\n return value;\n }\n waitWithPrompt(waiting, prompt) {\n this.waiting = waiting;\n this.sendButton.disabled = !waiting;\n this.inputArea.disabled = !waiting;\n super.waitWithPrompt(waiting, prompt);\n }\n setPlaceholder(placeholder) {\n if (this.waiting) {\n this.inputArea.setAttribute("placeholder", placeholder);\n this.inputArea.setAttribute("title", "");\n }\n else {\n this.inputArea.setAttribute("placeholder", "");\n this.inputArea.setAttribute("title", (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.input_disabled"));\n }\n }\n focus() {\n this.inputArea.focus();\n }\n toggle() {\n this.reset();\n }\n onRunStart() {\n this.reset();\n }\n onRunEnd() {\n // Intentionally empty\n }\n _render(options) {\n const buttonHTML = (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_4__.renderButton)({\n id: _Constants__WEBPACK_IMPORTED_MODULE_0__.SEND_INPUT_BTN_ID,\n // eslint-disable-next-line max-len\n classNames: "btn-secondary",\n buttonText: (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.t)("Papyros.enter")\n });\n (0,_util_Rendering__WEBPACK_IMPORTED_MODULE_4__.renderWithOptions)(options, `\n
\n \n \n ${buttonHTML}\n
`);\n (0,_util_Util__WEBPACK_IMPORTED_MODULE_2__.addListener)(_Constants__WEBPACK_IMPORTED_MODULE_0__.SEND_INPUT_BTN_ID, () => this.inputCallback(this.next()), "click");\n this.inputArea.addEventListener("keydown", (ev) => {\n if (this.waiting && ev.key && ev.key.toLowerCase() === "enter") {\n this.inputCallback(this.next());\n }\n });\n }\n reset() {\n super.reset();\n this.inputArea.value = "";\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/input/InteractiveInputHandler.ts?')},"./src/input/UserInputHandler.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ UserInputHandler: () => (/* binding */ UserInputHandler)\n/* harmony export */ });\n/* harmony import */ var _util_Util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/Util */ "./src/util/Util.ts");\n/* harmony import */ var _util_Rendering__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/Rendering */ "./src/util/Rendering.ts");\n\n\n/**\n * Base class for components that handle input from the user\n */\nclass UserInputHandler extends _util_Rendering__WEBPACK_IMPORTED_MODULE_1__.Renderable {\n /**\n * Construct a new UserInputHandler\n * @param {function()} inputCallback Callback for when the user has entered a value\n */\n constructor(inputCallback) {\n super();\n this.waiting = false;\n this.inputCallback = inputCallback;\n }\n /**\n * Wait for input of the user for a certain prompt\n * @param {boolean} waiting Whether we are waiting for input\n * @param {string} prompt Optional message to display if waiting\n */\n waitWithPrompt(waiting, prompt = "") {\n this.waiting = waiting;\n this.setPlaceholder(prompt || (0,_util_Util__WEBPACK_IMPORTED_MODULE_0__.t)(`Papyros.input_placeholder.${this.getInputMode()}`));\n if (this.waiting) {\n // Focusing is a rendering operation\n // Subclasses can execute code after this operation, skipping the rendering\n // Using setTimeout ensures rendering will be done when the main thread has time\n // eslint-disable-next-line max-len\n // More info here: https://stackoverflow.com/questions/1096436/document-getelementbyidid-focus-is-not-working-for-firefox-or-chrome\n setTimeout(() => this.focus(), 0);\n }\n }\n /**\n * Helper method to reset internal state\n */\n reset() {\n this.waiting = false;\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/input/UserInputHandler.ts?')},"./src/util/HTMLShapes.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ renderInCircle: () => (/* binding */ renderInCircle),\n/* harmony export */ renderSpinningCircle: () => (/* binding */ renderSpinningCircle)\n/* harmony export */ });\n/**\n * Draw a spinning circle to represent a loading animation\n * @param {string} id HTML id for this element\n * @param {string} borderColors The tailwind color classes for the borders of the circle\n * @return {string} A string representation of the circle\n */\nfunction renderSpinningCircle(id, borderColors) {\n return `\n
`;\n}\n/**\n * Wrap text (best a single character) in a circle to provide information to the user\n * @param {string} content The symbol in the circle, e.g. ? of !\n * @param {string} title The information to display when hovering over the element\n * @param {string} colorClasses The classes to color the content\n * @return {string} A string representation of the circle with content\n */\nfunction renderInCircle(content, title, colorClasses) {\n const htmlTitle = title ? `title="${title}"` : "";\n return `${content}`;\n}\n\n\n//# sourceURL=webpack://Papyros/./src/util/HTMLShapes.ts?')},"./src/util/Logging.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LogType: () => (/* binding */ LogType),\n/* harmony export */ papyrosLog: () => (/* binding */ papyrosLog)\n/* harmony export */ });\n/**\n * Enum representing the importance of a log message\n * This is helpful for debugging while allowing filtering in production\n */\nvar LogType;\n(function (LogType) {\n LogType[LogType["Debug"] = 0] = "Debug";\n LogType[LogType["Error"] = 1] = "Error";\n LogType[LogType["Important"] = 2] = "Important";\n})(LogType || (LogType = {}));\nconst ENVIRONMENT = "development" || 0;\n// Log everything in development\nconst SHOULD_LOG = ENVIRONMENT !== "production";\n/**\n * Helper method to log useful information at runtime\n * @param {LogType} logType The importance of this log message\n * @param {any[]} args The data to log\n */\nfunction papyrosLog(logType, ...args) {\n const doLog = SHOULD_LOG || logType !== LogType.Debug;\n if (doLog) {\n if (logType === LogType.Error) {\n console.error(...args);\n }\n else {\n console.log(...args);\n }\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/util/Logging.ts?')},"./src/util/Rendering.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Renderable: () => (/* binding */ Renderable),\n/* harmony export */ addAttributes: () => (/* binding */ addAttributes),\n/* harmony export */ appendClasses: () => (/* binding */ appendClasses),\n/* harmony export */ renderButton: () => (/* binding */ renderButton),\n/* harmony export */ renderLabel: () => (/* binding */ renderLabel),\n/* harmony export */ renderSelect: () => (/* binding */ renderSelect),\n/* harmony export */ renderSelectOptions: () => (/* binding */ renderSelectOptions),\n/* harmony export */ renderWithOptions: () => (/* binding */ renderWithOptions)\n/* harmony export */ });\n/* harmony import */ var _Util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Util */ "./src/util/Util.ts");\n/* harmony import */ var escape_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! escape-html */ "./node_modules/escape-html/index.js");\n/* harmony import */ var escape_html__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(escape_html__WEBPACK_IMPORTED_MODULE_1__);\n/* eslint-disable max-len */\n\n\n/**\n * Helper method to append classes to the class attribute of an HTMLElement\n * as consecutive whitespace is not allowed\n * @param {Object} options Object containing classNames\n * @param {string} classNames The classes to append\n */\nfunction appendClasses(options, classNames) {\n if (options.classNames && !options.classNames.includes(classNames)) {\n options.classNames = `${options.classNames} ${classNames}`;\n }\n else {\n options.classNames = classNames;\n }\n}\n/**\n * Helper method to add attributes to options with a possibly undefined attribute Map\n * @param {Object} options Object containing attributes\n * @param {Map} attributes The attributes to add\n */\nfunction addAttributes(options, attributes) {\n options.attributes = new Map([\n ...(options.attributes || []),\n ...attributes\n ]);\n}\n/**\n * Renders an element with the given options\n * @param {RenderOptions} options Options to be used while rendering\n * @param {string | HTMLElement} content What to fill the parent with.\n * If the content is a string, it should be properly formatted HTML\n * @return {HTMLElement} The parent with the new child\n */\nfunction renderWithOptions(options, content) {\n const parent = (0,_Util__WEBPACK_IMPORTED_MODULE_0__.getElement)(options.parentElementId);\n if (options.classNames) {\n parent.classList.add(...options.classNames.split(" "));\n }\n parent.classList.toggle("_tw-dark", Boolean(options.darkMode));\n if (options.attributes) {\n for (const [attr, value] of options.attributes.entries()) {\n parent.setAttribute(attr, value);\n }\n }\n if (typeof content === "string") {\n parent.innerHTML = content;\n }\n else {\n parent.replaceChildren(content);\n }\n return parent;\n}\n/**\n * Construct a HTML button string from the given options\n * @param {ButtonOptions} options The options for the button\n * @return {string} HTML string for the button\n */\nfunction renderButton(options) {\n appendClasses(options, "papyros-button");\n if (options.icon) {\n appendClasses(options, "with-icon");\n }\n return `\n`;\n}\n/**\n * Constructs the options for use within an HTML select element\n * @param {Array} options All options to display in the list\n * @param {function(T):string} optionText Function to convert the elements to a string\n * @param {T} selected The initially selected element in the list, if any\n * @return {string} The string representation of the select options\n */\nfunction renderSelectOptions(options, optionText, selected) {\n return options.map((option) => {\n const selectedValue = option === selected ? "selected" : "";\n return `\n \n `;\n }).join("\\n");\n}\n/**\n * Build a string representation of an HTML label element\n * @param {string} labelText Optional text to display in a label\n * If not provided, no label is created\n * @param {string} forElement The id of the element this label is for\n * @return {string} The HTML string of the label\n */\nfunction renderLabel(labelText, forElement) {\n return labelText ? `\n` : "";\n}\n/**\n * Constructs an HTML select element\n * @param {string} selectId The HTML id for the element\n * @param {Array} options to display in the list\n * @param {function(T):string} optionText to convert elements to a string\n * @param {T} selected The initially selected element in the list, if any\n * @param {string} labelText Optional text to display in a label\n * @return {string} The string representation of the select element\n */\nfunction renderSelect(selectId, options, optionText, selected, labelText) {\n const select = `\n `;\n return `\n ${renderLabel(labelText, selectId)}\n ${select}\n `;\n}\n/**\n * Helper superclass to handle storing options used during rendering\n * to allow re-rendering without needing to explicitly store used options each time\n */\nclass Renderable extends EventTarget {\n get renderOptions() {\n if (!this._renderOptions) {\n throw new Error(`${this.constructor.name} not yet rendered!`);\n }\n return this._renderOptions;\n }\n /**\n * Render this component into the DOM\n * @param {Options} options Optional options to render with. If omitted, stored options are used\n */\n render(options) {\n if (options) {\n this._renderOptions = options;\n }\n this._render(this.renderOptions);\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/util/Rendering.ts?')},"./src/util/Util.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addListener: () => (/* binding */ addListener),\n/* harmony export */ cleanCurrentUrl: () => (/* binding */ cleanCurrentUrl),\n/* harmony export */ downloadResults: () => (/* binding */ downloadResults),\n/* harmony export */ getElement: () => (/* binding */ getElement),\n/* harmony export */ getLocales: () => (/* binding */ getLocales),\n/* harmony export */ i18n: () => (/* binding */ i18n),\n/* harmony export */ parseData: () => (/* binding */ parseData),\n/* harmony export */ placeCaretAtEnd: () => (/* binding */ placeCaretAtEnd),\n/* harmony export */ removeSelection: () => (/* binding */ removeSelection),\n/* harmony export */ t: () => (/* binding */ t)\n/* harmony export */ });\n/* harmony import */ var i18n_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! i18n-js */ "./node_modules/i18n-js/dist/import/index.js");\n/* harmony import */ var _Translations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Translations */ "./src/Translations.js");\n/* harmony import */ var _Logging__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Logging */ "./src/util/Logging.ts");\n\n\n\nconst i18n = new i18n_js__WEBPACK_IMPORTED_MODULE_0__.I18n(_Translations__WEBPACK_IMPORTED_MODULE_1__.TRANSLATIONS);\n// Shorthand for ease of use\nconst t = i18n.t.bind(i18n);\nfunction getLocales() {\n return Object.keys(_Translations__WEBPACK_IMPORTED_MODULE_1__.TRANSLATIONS);\n}\n/**\n * Resolve an ElementIdentifier to the corresponding HTLMElement\n * @param {ElementIdentifier} elementId The identifier for the element\n * @return {T} The corresponding element\n */\nfunction getElement(elementId) {\n if (typeof elementId === "string") {\n return document.getElementById(elementId);\n }\n else {\n return elementId;\n }\n}\n/**\n * Add a listener to an HTML element for an event on an attribute\n * Element attributes tend to be strings, but string Enums can also be used\n * by using the type-parameter T\n * @param {ElementIdentifier} elementId Identifier for the element\n * @param {function(T)} onEvent The listener for the event\n * @param {string} eventType The type of the event\n * @param {string} attribute The attribute affected by the event\n */\nfunction addListener(elementId, onEvent, eventType = "change", attribute = "value") {\n const element = getElement(elementId);\n element.addEventListener(eventType, () => {\n onEvent(element[attribute] || element.getAttribute(attribute));\n });\n}\n/**\n * Unset the selected item of a select element to prevent a default selection\n * @param {ElementIdentifier} selectId Identifier for the select element\n */\nfunction removeSelection(selectId) {\n getElement(selectId).selectedIndex = -1;\n}\n/**\n * Parse the data contained within a PapyrosEvent using its contentType\n * Supported content types are: text/plain, text/json, img/png;base64\n * @param {string} data The data to parse\n * @param {string} contentType The content type of the data\n * @return {any} The parsed data\n */\nfunction parseData(data, contentType) {\n if (!contentType) {\n return data;\n }\n const [baseType, specificType] = contentType.split("/");\n switch (baseType) {\n case "text": {\n switch (specificType) {\n case "plain": {\n return data;\n }\n case "json": {\n return JSON.parse(data);\n }\n case "integer": {\n return parseInt(data);\n }\n case "float": {\n return parseFloat(data);\n }\n }\n break;\n }\n case "img": {\n switch (specificType) {\n case "png;base64": {\n return data;\n }\n }\n break;\n }\n case "application": {\n // Content such as application/json does not need parsing as it is in the correct shape\n return data;\n }\n }\n (0,_Logging__WEBPACK_IMPORTED_MODULE_2__.papyrosLog)(_Logging__WEBPACK_IMPORTED_MODULE_2__.LogType.Important, `Unhandled content type: ${contentType}`);\n return data;\n}\nfunction downloadResults(data, filename) {\n const blob = new Blob([data], { type: "text/plain" });\n const elem = window.document.createElement("a");\n // Cast URL to any as TypeScript doesn\'t recognize it properly\n // error TS2339: Property \'revokeObjectURL\' does not exist on type\n const windowUrl = URL;\n elem.href = windowUrl.createObjectURL(blob);\n elem.download = filename;\n document.body.appendChild(elem);\n elem.click();\n document.body.removeChild(elem);\n windowUrl.revokeObjectURL(elem.href);\n}\n/**\n * Obtain the url of the current page without hashes, identifiers, query params, ...\n * @param {boolean} endingSlash Whether the url should end in a slash\n * @return {string} The current url\n */\nfunction cleanCurrentUrl(endingSlash = false) {\n let url = location.origin + location.pathname;\n if (endingSlash && !url.endsWith("/")) {\n url += "/";\n }\n else if (!endingSlash && url.endsWith("/")) {\n url = url.slice(0, url.length - 1);\n }\n return url;\n}\n/**\n * Focus an element, setting the user\'s caret at the end of the contents\n * Needed to ensure focusing a contenteditable element works as expected\n * @param {HTMLElement} el The element to focus\n */\nfunction placeCaretAtEnd(el) {\n // eslint-disable-next-line max-len\n // Source: https://stackoverflow.com/questions/4233265/contenteditable-set-caret-at-the-end-of-the-text-cross-browser\n el.focus();\n if (typeof window.getSelection !== "undefined" &&\n typeof document.createRange !== "undefined") {\n const range = document.createRange();\n range.selectNodeContents(el);\n range.collapse(false);\n const sel = window.getSelection();\n if (sel) {\n sel.removeAllRanges();\n sel.addRange(range);\n }\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./src/util/Util.ts?')},"./src/Translations.js":module=>{eval('/* eslint-disable max-len */\n// Empty strings are considered missing by i18n-extract\n// Therefore the ready-key is an explicit space now, which is still invisible\n\nconst ENGLISH_TRANSLATION = {\n "Papyros": "Papyros",\n "code": "Code",\n "code_placeholder": "Write your %{programmingLanguage} code here and click \'Run\' to execute...",\n "input": "Input",\n "input_placeholder": {\n "interactive": "Provide input and press enter to send",\n "batch": "Provide all input required by your code here.\\n" +\n "You can enter multiple lines by pressing enter."\n },\n "input_disabled": "You can only provide input when your code requires it in interactive mode",\n "output": "Output",\n "output_placeholder": "The output of your code will appear here.",\n "stop": "Stop",\n "finished": "Code executed in %{time} s",\n "interrupted": "Code interrupted after %{time} s",\n "states": {\n "running": "Running",\n "stopping": "Stopping",\n "loading": "Loading",\n "awaiting_input": "Awaiting input",\n "ready": "",\n },\n "programming_language": "Programming language",\n "programming_languages": {\n "Python": "Python",\n "JavaScript": "JavaScript"\n },\n "locales": {\n "en": "English",\n "nl": "Nederlands"\n },\n "switch_input_mode_to": {\n "interactive": "Switch to interactive mode",\n "batch": "Switch to batch input"\n },\n "enter": "Enter",\n "examples": "Examples",\n "dark_mode": "Dark mode",\n "output_overflow": "Output truncated. No more results will be shown.",\n "output_overflow_download": "Click here to download the results.",\n "no_output": "The code did not produce any output.",\n "service_worker_error": "The service worker failed to load.",\n "launch_error": "Papyros failed to load. Do you want to reload?",\n "loading": "Loading %{packages}.",\n "run_modes": {\n "doctest": "Run doctests",\n "debug": "Debug",\n "run": "Run"\n },\n "used_input": "This line has already been used as input.",\n "used_input_with_prompt": "This line was used as input for the following prompt: %{prompt}",\n "debugger": {\n "title": "Drag the slider to walk through your code.",\n "text_1": "This window shows how your program works step by step. Explore to see how your program builds and stores information.",\n "text_2": "You can also use the %{previous} and %{next} buttons to go to the previous or next step. The %{first} and %{last} buttons can be used to directly jump to the first or last step respectively."\n },\n "editor": {\n "test_code": {\n "description": "# Appended testcase code for debugging purposes",\n "edit": "Edit",\n "remove": "Remove"\n }\n },\n "debug": {\n "stop": "Stop debugging"\n },\n};\n\nconst DUTCH_TRANSLATION = {\n "Papyros": "Papyros",\n "code": "Code",\n "code_placeholder": "Schrijf hier je %{programmingLanguage} code en klik op \'Uitvoeren\' om uit te voeren...",\n "input": "Invoer",\n "input_placeholder": {\n "interactive": "Geef invoer in en druk op enter",\n "batch": "Geef hier alle invoer die je code nodig heeft vooraf in.\\n" +\n "Je kan verschillende lijnen ingeven door op enter te drukken."\n },\n "input_disabled": "Je kan enkel invoer invullen als je code erom vraagt in interactieve modus",\n "output": "Uitvoer",\n "output_placeholder": "Hier komt de uitvoer van je code.",\n "stop": "Stop",\n "states": {\n "running": "Aan het uitvoeren",\n "stopping": "Aan het stoppen",\n "loading": "Aan het laden",\n "awaiting_input": "Aan het wachten op invoer",\n "ready": "",\n },\n "finished": "Code uitgevoerd in %{time} s",\n "interrupted": "Code onderbroken na %{time} s",\n "programming_language": "Programmeertaal",\n "programming_languages": {\n "Python": "Python",\n "JavaScript": "JavaScript"\n },\n "locales": {\n "en": "English",\n "nl": "Nederlands"\n },\n "switch_input_mode_to": {\n "interactive": "Wisselen naar interactieve invoer",\n "batch": "Geef invoer vooraf in"\n },\n "enter": "Enter",\n "examples": "Voorbeelden",\n "dark_mode": "Donkere modus",\n "output_overflow": "Uitvoer ingekort. Er zullen geen nieuwe resultaten getoond worden.",\n "output_overflow_download": "Klik hier om de resultaten te downloaden.",\n "no_output": "De code produceerde geen uitvoer.",\n "service_worker_error": "Er liep iets fout bij het laden van de service worker.",\n "launch_error": "Er liep iets fout bij het laden van Papyros. Wil je herladen?",\n "loading": "Bezig met het installeren van %{packages}.",\n "run_modes": {\n "doctest": "Doctests uitvoeren",\n "debug": "Debuggen",\n "run": "Uitvoeren"\n },\n "used_input": "Deze regel werd al gebruikt als invoer.",\n "used_input_with_prompt": "Deze regel werd gebruikt als invoer voor de volgende vraag: %{prompt}",\n "debugger": {\n "title": "Verken je code stap voor stap",\n "text_1": "Dit venster toont de werking van je programma in detail. Ontdek hoe je programma informatie opbouwt en bewaart.",\n "text_2": "Gebruik de schuifbalk om door je code te wandelen. Je kan ook de %{previous} en %{next} knoppen gebruiken om naar de vorige of volgende stap te gaan. De %{first} en %{last} knoppen kunnen gebruikt worden om direct naar de eerste of laatste stap te gaan."\n },\n "editor": {\n "test_code": {\n "description": "# Toegevoegde testcase code voor debugdoeleinden",\n "edit": "Bewerk",\n "remove": "Verwijder"\n }\n },\n "debug": {\n "stop": "Stop debugger"\n },\n};\n\n// Override some default English phrases to also use capitalized text\nconst ENGLISH_PHRASES = {\n // @codemirror/search\n "Go to line": "Go to line",\n "go": "OK",\n "Find": "Find",\n "Replace": "Replace",\n "next": "Next",\n "previous": "Previous",\n "all": "All",\n "match case": "match case",\n "replace": "Replace",\n "replace all": "Replace all",\n "close": "Sluiten",\n}\n\nconst DUTCH_PHRASES = {\n // @codemirror/view\n "Control character": "Controlekarakter",\n // @codemirror/fold\n "Folded lines": "Ingeklapte regels",\n "Unfolded lines": "Uitgeklapte regels",\n "to": "tot",\n "folded code": "ingeklapte code",\n "unfold": "uitklappen",\n "Fold line": "Regel inklappen",\n "Unfold line": "Regel uitklappen",\n // @codemirror/search\n "Go to line": "Spring naar regel",\n "go": "OK",\n "Find": "Zoeken",\n "Replace": "Vervangen",\n "next": "Volgende",\n "previous": "Vorige",\n "all": "Alle",\n "match case": "hoofdlettergevoelig",\n "replace": "Vervangen",\n "replace all": "Alles vervangen",\n "close": "Sluiten",\n "current match": "huidige overeenkomst",\n "on line": "op regel",\n // @codemirror/lint\n "Diagnostics": "Problemen",\n "No diagnostics": "Geen problemen",\n }\n\nconst TRANSLATIONS = {\n en: { "Papyros": ENGLISH_TRANSLATION },\n nl: { "Papyros": DUTCH_TRANSLATION }\n};\n\nconst CODE_MIRROR_TRANSLATIONS = {\n en: ENGLISH_PHRASES,\n nl: DUTCH_PHRASES\n};\n// JS exports to allow use in TS and JS files\nmodule.exports.TRANSLATIONS = TRANSLATIONS;\nmodule.exports.CODE_MIRROR_TRANSLATIONS = CODE_MIRROR_TRANSLATIONS;\n\n\n//# sourceURL=webpack://Papyros/./src/Translations.js?')},"./node_modules/@codemirror/autocomplete/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CompletionContext: () => (/* binding */ CompletionContext),\n/* harmony export */ acceptCompletion: () => (/* binding */ acceptCompletion),\n/* harmony export */ autocompletion: () => (/* binding */ autocompletion),\n/* harmony export */ clearSnippet: () => (/* binding */ clearSnippet),\n/* harmony export */ closeBrackets: () => (/* binding */ closeBrackets),\n/* harmony export */ closeBracketsKeymap: () => (/* binding */ closeBracketsKeymap),\n/* harmony export */ closeCompletion: () => (/* binding */ closeCompletion),\n/* harmony export */ completeAnyWord: () => (/* binding */ completeAnyWord),\n/* harmony export */ completeFromList: () => (/* binding */ completeFromList),\n/* harmony export */ completionKeymap: () => (/* binding */ completionKeymap),\n/* harmony export */ completionStatus: () => (/* binding */ completionStatus),\n/* harmony export */ currentCompletions: () => (/* binding */ currentCompletions),\n/* harmony export */ deleteBracketPair: () => (/* binding */ deleteBracketPair),\n/* harmony export */ hasNextSnippetField: () => (/* binding */ hasNextSnippetField),\n/* harmony export */ hasPrevSnippetField: () => (/* binding */ hasPrevSnippetField),\n/* harmony export */ ifIn: () => (/* binding */ ifIn),\n/* harmony export */ ifNotIn: () => (/* binding */ ifNotIn),\n/* harmony export */ insertBracket: () => (/* binding */ insertBracket),\n/* harmony export */ insertCompletionText: () => (/* binding */ insertCompletionText),\n/* harmony export */ moveCompletionSelection: () => (/* binding */ moveCompletionSelection),\n/* harmony export */ nextSnippetField: () => (/* binding */ nextSnippetField),\n/* harmony export */ pickedCompletion: () => (/* binding */ pickedCompletion),\n/* harmony export */ prevSnippetField: () => (/* binding */ prevSnippetField),\n/* harmony export */ selectedCompletion: () => (/* binding */ selectedCompletion),\n/* harmony export */ selectedCompletionIndex: () => (/* binding */ selectedCompletionIndex),\n/* harmony export */ setSelectedCompletion: () => (/* binding */ setSelectedCompletion),\n/* harmony export */ snippet: () => (/* binding */ snippet),\n/* harmony export */ snippetCompletion: () => (/* binding */ snippetCompletion),\n/* harmony export */ snippetKeymap: () => (/* binding */ snippetKeymap),\n/* harmony export */ startCompletion: () => (/* binding */ startCompletion)\n/* harmony export */ });\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @codemirror/language */ "./node_modules/@codemirror/language/dist/index.js");\n\n\n\n\n/**\nAn instance of this is passed to completion source functions.\n*/\nclass CompletionContext {\n /**\n Create a new completion context. (Mostly useful for testing\n completion sources—in the editor, the extension will create\n these for you.)\n */\n constructor(\n /**\n The editor state that the completion happens in.\n */\n state, \n /**\n The position at which the completion is happening.\n */\n pos, \n /**\n Indicates whether completion was activated explicitly, or\n implicitly by typing. The usual way to respond to this is to\n only return completions when either there is part of a\n completable entity before the cursor, or `explicit` is true.\n */\n explicit, \n /**\n The editor view. May be undefined if the context was created\n in a situation where there is no such view available, such as\n in synchronous updates via\n [`CompletionResult.update`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.update)\n or when called by test code.\n */\n view) {\n this.state = state;\n this.pos = pos;\n this.explicit = explicit;\n this.view = view;\n /**\n @internal\n */\n this.abortListeners = [];\n }\n /**\n Get the extent, content, and (if there is a token) type of the\n token before `this.pos`.\n */\n tokenBefore(types) {\n let token = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_0__.syntaxTree)(this.state).resolveInner(this.pos, -1);\n while (token && types.indexOf(token.name) < 0)\n token = token.parent;\n return token ? { from: token.from, to: this.pos,\n text: this.state.sliceDoc(token.from, this.pos),\n type: token.type } : null;\n }\n /**\n Get the match of the given expression directly before the\n cursor.\n */\n matchBefore(expr) {\n let line = this.state.doc.lineAt(this.pos);\n let start = Math.max(line.from, this.pos - 250);\n let str = line.text.slice(start - line.from, this.pos - line.from);\n let found = str.search(ensureAnchor(expr, false));\n return found < 0 ? null : { from: start + found, to: this.pos, text: str.slice(found) };\n }\n /**\n Yields true when the query has been aborted. Can be useful in\n asynchronous queries to avoid doing work that will be ignored.\n */\n get aborted() { return this.abortListeners == null; }\n /**\n Allows you to register abort handlers, which will be called when\n the query is\n [aborted](https://codemirror.net/6/docs/ref/#autocomplete.CompletionContext.aborted).\n */\n addEventListener(type, listener) {\n if (type == "abort" && this.abortListeners)\n this.abortListeners.push(listener);\n }\n}\nfunction toSet(chars) {\n let flat = Object.keys(chars).join("");\n let words = /\\w/.test(flat);\n if (words)\n flat = flat.replace(/\\w/g, "");\n return `[${words ? "\\\\w" : ""}${flat.replace(/[^\\w\\s]/g, "\\\\$&")}]`;\n}\nfunction prefixMatch(options) {\n let first = Object.create(null), rest = Object.create(null);\n for (let { label } of options) {\n first[label[0]] = true;\n for (let i = 1; i < label.length; i++)\n rest[label[i]] = true;\n }\n let source = toSet(first) + toSet(rest) + "*$";\n return [new RegExp("^" + source), new RegExp(source)];\n}\n/**\nGiven a a fixed array of options, return an autocompleter that\ncompletes them.\n*/\nfunction completeFromList(list) {\n let options = list.map(o => typeof o == "string" ? { label: o } : o);\n let [validFor, match] = options.every(o => /^\\w+$/.test(o.label)) ? [/\\w*$/, /\\w+$/] : prefixMatch(options);\n return (context) => {\n let token = context.matchBefore(match);\n return token || context.explicit ? { from: token ? token.from : context.pos, options, validFor } : null;\n };\n}\n/**\nWrap the given completion source so that it will only fire when the\ncursor is in a syntax node with one of the given names.\n*/\nfunction ifIn(nodes, source) {\n return (context) => {\n for (let pos = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_0__.syntaxTree)(context.state).resolveInner(context.pos, -1); pos; pos = pos.parent) {\n if (nodes.indexOf(pos.name) > -1)\n return source(context);\n if (pos.type.isTop)\n break;\n }\n return null;\n };\n}\n/**\nWrap the given completion source so that it will not fire when the\ncursor is in a syntax node with one of the given names.\n*/\nfunction ifNotIn(nodes, source) {\n return (context) => {\n for (let pos = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_0__.syntaxTree)(context.state).resolveInner(context.pos, -1); pos; pos = pos.parent) {\n if (nodes.indexOf(pos.name) > -1)\n return null;\n if (pos.type.isTop)\n break;\n }\n return source(context);\n };\n}\nclass Option {\n constructor(completion, source, match, score) {\n this.completion = completion;\n this.source = source;\n this.match = match;\n this.score = score;\n }\n}\nfunction cur(state) { return state.selection.main.from; }\n// Make sure the given regexp has a $ at its end and, if `start` is\n// true, a ^ at its start.\nfunction ensureAnchor(expr, start) {\n var _a;\n let { source } = expr;\n let addStart = start && source[0] != "^", addEnd = source[source.length - 1] != "$";\n if (!addStart && !addEnd)\n return expr;\n return new RegExp(`${addStart ? "^" : ""}(?:${source})${addEnd ? "$" : ""}`, (_a = expr.flags) !== null && _a !== void 0 ? _a : (expr.ignoreCase ? "i" : ""));\n}\n/**\nThis annotation is added to transactions that are produced by\npicking a completion.\n*/\nconst pickedCompletion = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Annotation.define();\n/**\nHelper function that returns a transaction spec which inserts a\ncompletion\'s text in the main selection range, and any other\nselection range that has the same text in front of it.\n*/\nfunction insertCompletionText(state, text, from, to) {\n let { main } = state.selection, fromOff = from - main.from, toOff = to - main.from;\n return Object.assign(Object.assign({}, state.changeByRange(range => {\n if (range != main && from != to &&\n state.sliceDoc(range.from + fromOff, range.from + toOff) != state.sliceDoc(from, to))\n return { range };\n return {\n changes: { from: range.from + fromOff, to: to == main.from ? range.to : range.from + toOff, insert: text },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(range.from + fromOff + text.length)\n };\n })), { scrollIntoView: true, userEvent: "input.complete" });\n}\nconst SourceCache = /*@__PURE__*/new WeakMap();\nfunction asSource(source) {\n if (!Array.isArray(source))\n return source;\n let known = SourceCache.get(source);\n if (!known)\n SourceCache.set(source, known = completeFromList(source));\n return known;\n}\nconst startCompletionEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define();\nconst closeCompletionEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define();\n\n// A pattern matcher for fuzzy completion matching. Create an instance\n// once for a pattern, and then use that to match any number of\n// completions.\nclass FuzzyMatcher {\n constructor(pattern) {\n this.pattern = pattern;\n this.chars = [];\n this.folded = [];\n // Buffers reused by calls to `match` to track matched character\n // positions.\n this.any = [];\n this.precise = [];\n this.byWord = [];\n this.score = 0;\n this.matched = [];\n for (let p = 0; p < pattern.length;) {\n let char = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(pattern, p), size = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointSize)(char);\n this.chars.push(char);\n let part = pattern.slice(p, p + size), upper = part.toUpperCase();\n this.folded.push((0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(upper == part ? part.toLowerCase() : upper, 0));\n p += size;\n }\n this.astral = pattern.length != this.chars.length;\n }\n ret(score, matched) {\n this.score = score;\n this.matched = matched;\n return this;\n }\n // Matches a given word (completion) against the pattern (input).\n // Will return a boolean indicating whether there was a match and,\n // on success, set `this.score` to the score, `this.matched` to an\n // array of `from, to` pairs indicating the matched parts of `word`.\n //\n // The score is a number that is more negative the worse the match\n // is. See `Penalty` above.\n match(word) {\n if (this.pattern.length == 0)\n return this.ret(-100 /* Penalty.NotFull */, []);\n if (word.length < this.pattern.length)\n return null;\n let { chars, folded, any, precise, byWord } = this;\n // For single-character queries, only match when they occur right\n // at the start\n if (chars.length == 1) {\n let first = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(word, 0), firstSize = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointSize)(first);\n let score = firstSize == word.length ? 0 : -100 /* Penalty.NotFull */;\n if (first == chars[0]) ;\n else if (first == folded[0])\n score += -200 /* Penalty.CaseFold */;\n else\n return null;\n return this.ret(score, [0, firstSize]);\n }\n let direct = word.indexOf(this.pattern);\n if (direct == 0)\n return this.ret(word.length == this.pattern.length ? 0 : -100 /* Penalty.NotFull */, [0, this.pattern.length]);\n let len = chars.length, anyTo = 0;\n if (direct < 0) {\n for (let i = 0, e = Math.min(word.length, 200); i < e && anyTo < len;) {\n let next = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(word, i);\n if (next == chars[anyTo] || next == folded[anyTo])\n any[anyTo++] = i;\n i += (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointSize)(next);\n }\n // No match, exit immediately\n if (anyTo < len)\n return null;\n }\n // This tracks the extent of the precise (non-folded, not\n // necessarily adjacent) match\n let preciseTo = 0;\n // Tracks whether there is a match that hits only characters that\n // appear to be starting words. `byWordFolded` is set to true when\n // a case folded character is encountered in such a match\n let byWordTo = 0, byWordFolded = false;\n // If we\'ve found a partial adjacent match, these track its state\n let adjacentTo = 0, adjacentStart = -1, adjacentEnd = -1;\n let hasLower = /[a-z]/.test(word), wordAdjacent = true;\n // Go over the option\'s text, scanning for the various kinds of matches\n for (let i = 0, e = Math.min(word.length, 200), prevType = 0 /* Tp.NonWord */; i < e && byWordTo < len;) {\n let next = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(word, i);\n if (direct < 0) {\n if (preciseTo < len && next == chars[preciseTo])\n precise[preciseTo++] = i;\n if (adjacentTo < len) {\n if (next == chars[adjacentTo] || next == folded[adjacentTo]) {\n if (adjacentTo == 0)\n adjacentStart = i;\n adjacentEnd = i + 1;\n adjacentTo++;\n }\n else {\n adjacentTo = 0;\n }\n }\n }\n let ch, type = next < 0xff\n ? (next >= 48 && next <= 57 || next >= 97 && next <= 122 ? 2 /* Tp.Lower */ : next >= 65 && next <= 90 ? 1 /* Tp.Upper */ : 0 /* Tp.NonWord */)\n : ((ch = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.fromCodePoint)(next)) != ch.toLowerCase() ? 1 /* Tp.Upper */ : ch != ch.toUpperCase() ? 2 /* Tp.Lower */ : 0 /* Tp.NonWord */);\n if (!i || type == 1 /* Tp.Upper */ && hasLower || prevType == 0 /* Tp.NonWord */ && type != 0 /* Tp.NonWord */) {\n if (chars[byWordTo] == next || (folded[byWordTo] == next && (byWordFolded = true)))\n byWord[byWordTo++] = i;\n else if (byWord.length)\n wordAdjacent = false;\n }\n prevType = type;\n i += (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointSize)(next);\n }\n if (byWordTo == len && byWord[0] == 0 && wordAdjacent)\n return this.result(-100 /* Penalty.ByWord */ + (byWordFolded ? -200 /* Penalty.CaseFold */ : 0), byWord, word);\n if (adjacentTo == len && adjacentStart == 0)\n return this.ret(-200 /* Penalty.CaseFold */ - word.length + (adjacentEnd == word.length ? 0 : -100 /* Penalty.NotFull */), [0, adjacentEnd]);\n if (direct > -1)\n return this.ret(-700 /* Penalty.NotStart */ - word.length, [direct, direct + this.pattern.length]);\n if (adjacentTo == len)\n return this.ret(-200 /* Penalty.CaseFold */ + -700 /* Penalty.NotStart */ - word.length, [adjacentStart, adjacentEnd]);\n if (byWordTo == len)\n return this.result(-100 /* Penalty.ByWord */ + (byWordFolded ? -200 /* Penalty.CaseFold */ : 0) + -700 /* Penalty.NotStart */ +\n (wordAdjacent ? 0 : -1100 /* Penalty.Gap */), byWord, word);\n return chars.length == 2 ? null\n : this.result((any[0] ? -700 /* Penalty.NotStart */ : 0) + -200 /* Penalty.CaseFold */ + -1100 /* Penalty.Gap */, any, word);\n }\n result(score, positions, word) {\n let result = [], i = 0;\n for (let pos of positions) {\n let to = pos + (this.astral ? (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointSize)((0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(word, pos)) : 1);\n if (i && result[i - 1] == pos)\n result[i - 1] = to;\n else {\n result[i++] = pos;\n result[i++] = to;\n }\n }\n return this.ret(score - word.length, result);\n }\n}\nclass StrictMatcher {\n constructor(pattern) {\n this.pattern = pattern;\n this.matched = [];\n this.score = 0;\n this.folded = pattern.toLowerCase();\n }\n match(word) {\n if (word.length < this.pattern.length)\n return null;\n let start = word.slice(0, this.pattern.length);\n let match = start == this.pattern ? 0 : start.toLowerCase() == this.folded ? -200 /* Penalty.CaseFold */ : null;\n if (match == null)\n return null;\n this.matched = [0, start.length];\n this.score = match + (word.length == this.pattern.length ? 0 : -100 /* Penalty.NotFull */);\n return this;\n }\n}\n\nconst completionConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Facet.define({\n combine(configs) {\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.combineConfig)(configs, {\n activateOnTyping: true,\n activateOnCompletion: () => false,\n activateOnTypingDelay: 100,\n selectOnOpen: true,\n override: null,\n closeOnBlur: true,\n maxRenderedOptions: 100,\n defaultKeymap: true,\n tooltipClass: () => "",\n optionClass: () => "",\n aboveCursor: false,\n icons: true,\n addToOptions: [],\n positionInfo: defaultPositionInfo,\n filterStrict: false,\n compareCompletions: (a, b) => a.label.localeCompare(b.label),\n interactionDelay: 75,\n updateSyncTime: 100\n }, {\n defaultKeymap: (a, b) => a && b,\n closeOnBlur: (a, b) => a && b,\n icons: (a, b) => a && b,\n tooltipClass: (a, b) => c => joinClass(a(c), b(c)),\n optionClass: (a, b) => c => joinClass(a(c), b(c)),\n addToOptions: (a, b) => a.concat(b),\n filterStrict: (a, b) => a || b,\n });\n }\n});\nfunction joinClass(a, b) {\n return a ? b ? a + " " + b : a : b;\n}\nfunction defaultPositionInfo(view, list, option, info, space, tooltip) {\n let rtl = view.textDirection == _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Direction.RTL, left = rtl, narrow = false;\n let side = "top", offset, maxWidth;\n let spaceLeft = list.left - space.left, spaceRight = space.right - list.right;\n let infoWidth = info.right - info.left, infoHeight = info.bottom - info.top;\n if (left && spaceLeft < Math.min(infoWidth, spaceRight))\n left = false;\n else if (!left && spaceRight < Math.min(infoWidth, spaceLeft))\n left = true;\n if (infoWidth <= (left ? spaceLeft : spaceRight)) {\n offset = Math.max(space.top, Math.min(option.top, space.bottom - infoHeight)) - list.top;\n maxWidth = Math.min(400 /* Info.Width */, left ? spaceLeft : spaceRight);\n }\n else {\n narrow = true;\n maxWidth = Math.min(400 /* Info.Width */, (rtl ? list.right : space.right - list.left) - 30 /* Info.Margin */);\n let spaceBelow = space.bottom - list.bottom;\n if (spaceBelow >= infoHeight || spaceBelow > list.top) { // Below the completion\n offset = option.bottom - list.top;\n }\n else { // Above it\n side = "bottom";\n offset = list.bottom - option.top;\n }\n }\n let scaleY = (list.bottom - list.top) / tooltip.offsetHeight;\n let scaleX = (list.right - list.left) / tooltip.offsetWidth;\n return {\n style: `${side}: ${offset / scaleY}px; max-width: ${maxWidth / scaleX}px`,\n class: "cm-completionInfo-" + (narrow ? (rtl ? "left-narrow" : "right-narrow") : left ? "left" : "right")\n };\n}\n\nfunction optionContent(config) {\n let content = config.addToOptions.slice();\n if (config.icons)\n content.push({\n render(completion) {\n let icon = document.createElement("div");\n icon.classList.add("cm-completionIcon");\n if (completion.type)\n icon.classList.add(...completion.type.split(/\\s+/g).map(cls => "cm-completionIcon-" + cls));\n icon.setAttribute("aria-hidden", "true");\n return icon;\n },\n position: 20\n });\n content.push({\n render(completion, _s, _v, match) {\n let labelElt = document.createElement("span");\n labelElt.className = "cm-completionLabel";\n let label = completion.displayLabel || completion.label, off = 0;\n for (let j = 0; j < match.length;) {\n let from = match[j++], to = match[j++];\n if (from > off)\n labelElt.appendChild(document.createTextNode(label.slice(off, from)));\n let span = labelElt.appendChild(document.createElement("span"));\n span.appendChild(document.createTextNode(label.slice(from, to)));\n span.className = "cm-completionMatchedText";\n off = to;\n }\n if (off < label.length)\n labelElt.appendChild(document.createTextNode(label.slice(off)));\n return labelElt;\n },\n position: 50\n }, {\n render(completion) {\n if (!completion.detail)\n return null;\n let detailElt = document.createElement("span");\n detailElt.className = "cm-completionDetail";\n detailElt.textContent = completion.detail;\n return detailElt;\n },\n position: 80\n });\n return content.sort((a, b) => a.position - b.position).map(a => a.render);\n}\nfunction rangeAroundSelected(total, selected, max) {\n if (total <= max)\n return { from: 0, to: total };\n if (selected < 0)\n selected = 0;\n if (selected <= (total >> 1)) {\n let off = Math.floor(selected / max);\n return { from: off * max, to: (off + 1) * max };\n }\n let off = Math.floor((total - selected) / max);\n return { from: total - (off + 1) * max, to: total - off * max };\n}\nclass CompletionTooltip {\n constructor(view, stateField, applyCompletion) {\n this.view = view;\n this.stateField = stateField;\n this.applyCompletion = applyCompletion;\n this.info = null;\n this.infoDestroy = null;\n this.placeInfoReq = {\n read: () => this.measureInfo(),\n write: (pos) => this.placeInfo(pos),\n key: this\n };\n this.space = null;\n this.currentClass = "";\n let cState = view.state.field(stateField);\n let { options, selected } = cState.open;\n let config = view.state.facet(completionConfig);\n this.optionContent = optionContent(config);\n this.optionClass = config.optionClass;\n this.tooltipClass = config.tooltipClass;\n this.range = rangeAroundSelected(options.length, selected, config.maxRenderedOptions);\n this.dom = document.createElement("div");\n this.dom.className = "cm-tooltip-autocomplete";\n this.updateTooltipClass(view.state);\n this.dom.addEventListener("mousedown", (e) => {\n let { options } = view.state.field(stateField).open;\n for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {\n if (dom.nodeName == "LI" && (match = /-(\\d+)$/.exec(dom.id)) && +match[1] < options.length) {\n this.applyCompletion(view, options[+match[1]]);\n e.preventDefault();\n return;\n }\n }\n });\n this.dom.addEventListener("focusout", (e) => {\n let state = view.state.field(this.stateField, false);\n if (state && state.tooltip && view.state.facet(completionConfig).closeOnBlur &&\n e.relatedTarget != view.contentDOM)\n view.dispatch({ effects: closeCompletionEffect.of(null) });\n });\n this.showOptions(options, cState.id);\n }\n mount() { this.updateSel(); }\n showOptions(options, id) {\n if (this.list)\n this.list.remove();\n this.list = this.dom.appendChild(this.createListBox(options, id, this.range));\n this.list.addEventListener("scroll", () => {\n if (this.info)\n this.view.requestMeasure(this.placeInfoReq);\n });\n }\n update(update) {\n var _a;\n let cState = update.state.field(this.stateField);\n let prevState = update.startState.field(this.stateField);\n this.updateTooltipClass(update.state);\n if (cState != prevState) {\n let { options, selected, disabled } = cState.open;\n if (!prevState.open || prevState.open.options != options) {\n this.range = rangeAroundSelected(options.length, selected, update.state.facet(completionConfig).maxRenderedOptions);\n this.showOptions(options, cState.id);\n }\n this.updateSel();\n if (disabled != ((_a = prevState.open) === null || _a === void 0 ? void 0 : _a.disabled))\n this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!disabled);\n }\n }\n updateTooltipClass(state) {\n let cls = this.tooltipClass(state);\n if (cls != this.currentClass) {\n for (let c of this.currentClass.split(" "))\n if (c)\n this.dom.classList.remove(c);\n for (let c of cls.split(" "))\n if (c)\n this.dom.classList.add(c);\n this.currentClass = cls;\n }\n }\n positioned(space) {\n this.space = space;\n if (this.info)\n this.view.requestMeasure(this.placeInfoReq);\n }\n updateSel() {\n let cState = this.view.state.field(this.stateField), open = cState.open;\n if (open.selected > -1 && open.selected < this.range.from || open.selected >= this.range.to) {\n this.range = rangeAroundSelected(open.options.length, open.selected, this.view.state.facet(completionConfig).maxRenderedOptions);\n this.showOptions(open.options, cState.id);\n }\n if (this.updateSelectedOption(open.selected)) {\n this.destroyInfo();\n let { completion } = open.options[open.selected];\n let { info } = completion;\n if (!info)\n return;\n let infoResult = typeof info === "string" ? document.createTextNode(info) : info(completion);\n if (!infoResult)\n return;\n if ("then" in infoResult) {\n infoResult.then(obj => {\n if (obj && this.view.state.field(this.stateField, false) == cState)\n this.addInfoPane(obj, completion);\n }).catch(e => (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.logException)(this.view.state, e, "completion info"));\n }\n else {\n this.addInfoPane(infoResult, completion);\n }\n }\n }\n addInfoPane(content, completion) {\n this.destroyInfo();\n let wrap = this.info = document.createElement("div");\n wrap.className = "cm-tooltip cm-completionInfo";\n if (content.nodeType != null) {\n wrap.appendChild(content);\n this.infoDestroy = null;\n }\n else {\n let { dom, destroy } = content;\n wrap.appendChild(dom);\n this.infoDestroy = destroy || null;\n }\n this.dom.appendChild(wrap);\n this.view.requestMeasure(this.placeInfoReq);\n }\n updateSelectedOption(selected) {\n let set = null;\n for (let opt = this.list.firstChild, i = this.range.from; opt; opt = opt.nextSibling, i++) {\n if (opt.nodeName != "LI" || !opt.id) {\n i--; // A section header\n }\n else if (i == selected) {\n if (!opt.hasAttribute("aria-selected")) {\n opt.setAttribute("aria-selected", "true");\n set = opt;\n }\n }\n else {\n if (opt.hasAttribute("aria-selected"))\n opt.removeAttribute("aria-selected");\n }\n }\n if (set)\n scrollIntoView(this.list, set);\n return set;\n }\n measureInfo() {\n let sel = this.dom.querySelector("[aria-selected]");\n if (!sel || !this.info)\n return null;\n let listRect = this.dom.getBoundingClientRect();\n let infoRect = this.info.getBoundingClientRect();\n let selRect = sel.getBoundingClientRect();\n let space = this.space;\n if (!space) {\n let win = this.dom.ownerDocument.defaultView || window;\n space = { left: 0, top: 0, right: win.innerWidth, bottom: win.innerHeight };\n }\n if (selRect.top > Math.min(space.bottom, listRect.bottom) - 10 ||\n selRect.bottom < Math.max(space.top, listRect.top) + 10)\n return null;\n return this.view.state.facet(completionConfig).positionInfo(this.view, listRect, selRect, infoRect, space, this.dom);\n }\n placeInfo(pos) {\n if (this.info) {\n if (pos) {\n if (pos.style)\n this.info.style.cssText = pos.style;\n this.info.className = "cm-tooltip cm-completionInfo " + (pos.class || "");\n }\n else {\n this.info.style.cssText = "top: -1e6px";\n }\n }\n }\n createListBox(options, id, range) {\n const ul = document.createElement("ul");\n ul.id = id;\n ul.setAttribute("role", "listbox");\n ul.setAttribute("aria-expanded", "true");\n ul.setAttribute("aria-label", this.view.state.phrase("Completions"));\n let curSection = null;\n for (let i = range.from; i < range.to; i++) {\n let { completion, match } = options[i], { section } = completion;\n if (section) {\n let name = typeof section == "string" ? section : section.name;\n if (name != curSection && (i > range.from || range.from == 0)) {\n curSection = name;\n if (typeof section != "string" && section.header) {\n ul.appendChild(section.header(section));\n }\n else {\n let header = ul.appendChild(document.createElement("completion-section"));\n header.textContent = name;\n }\n }\n }\n const li = ul.appendChild(document.createElement("li"));\n li.id = id + "-" + i;\n li.setAttribute("role", "option");\n let cls = this.optionClass(completion);\n if (cls)\n li.className = cls;\n for (let source of this.optionContent) {\n let node = source(completion, this.view.state, this.view, match);\n if (node)\n li.appendChild(node);\n }\n }\n if (range.from)\n ul.classList.add("cm-completionListIncompleteTop");\n if (range.to < options.length)\n ul.classList.add("cm-completionListIncompleteBottom");\n return ul;\n }\n destroyInfo() {\n if (this.info) {\n if (this.infoDestroy)\n this.infoDestroy();\n this.info.remove();\n this.info = null;\n }\n }\n destroy() {\n this.destroyInfo();\n }\n}\nfunction completionTooltip(stateField, applyCompletion) {\n return (view) => new CompletionTooltip(view, stateField, applyCompletion);\n}\nfunction scrollIntoView(container, element) {\n let parent = container.getBoundingClientRect();\n let self = element.getBoundingClientRect();\n let scaleY = parent.height / container.offsetHeight;\n if (self.top < parent.top)\n container.scrollTop -= (parent.top - self.top) / scaleY;\n else if (self.bottom > parent.bottom)\n container.scrollTop += (self.bottom - parent.bottom) / scaleY;\n}\n\n// Used to pick a preferred option when two options with the same\n// label occur in the result.\nfunction score(option) {\n return (option.boost || 0) * 100 + (option.apply ? 10 : 0) + (option.info ? 5 : 0) +\n (option.type ? 1 : 0);\n}\nfunction sortOptions(active, state) {\n let options = [];\n let sections = null;\n let addOption = (option) => {\n options.push(option);\n let { section } = option.completion;\n if (section) {\n if (!sections)\n sections = [];\n let name = typeof section == "string" ? section : section.name;\n if (!sections.some(s => s.name == name))\n sections.push(typeof section == "string" ? { name } : section);\n }\n };\n let conf = state.facet(completionConfig);\n for (let a of active)\n if (a.hasResult()) {\n let getMatch = a.result.getMatch;\n if (a.result.filter === false) {\n for (let option of a.result.options) {\n addOption(new Option(option, a.source, getMatch ? getMatch(option) : [], 1e9 - options.length));\n }\n }\n else {\n let pattern = state.sliceDoc(a.from, a.to), match;\n let matcher = conf.filterStrict ? new StrictMatcher(pattern) : new FuzzyMatcher(pattern);\n for (let option of a.result.options)\n if (match = matcher.match(option.label)) {\n let matched = !option.displayLabel ? match.matched : getMatch ? getMatch(option, match.matched) : [];\n addOption(new Option(option, a.source, matched, match.score + (option.boost || 0)));\n }\n }\n }\n if (sections) {\n let sectionOrder = Object.create(null), pos = 0;\n let cmp = (a, b) => { var _a, _b; return ((_a = a.rank) !== null && _a !== void 0 ? _a : 1e9) - ((_b = b.rank) !== null && _b !== void 0 ? _b : 1e9) || (a.name < b.name ? -1 : 1); };\n for (let s of sections.sort(cmp)) {\n pos -= 1e5;\n sectionOrder[s.name] = pos;\n }\n for (let option of options) {\n let { section } = option.completion;\n if (section)\n option.score += sectionOrder[typeof section == "string" ? section : section.name];\n }\n }\n let result = [], prev = null;\n let compare = conf.compareCompletions;\n for (let opt of options.sort((a, b) => (b.score - a.score) || compare(a.completion, b.completion))) {\n let cur = opt.completion;\n if (!prev || prev.label != cur.label || prev.detail != cur.detail ||\n (prev.type != null && cur.type != null && prev.type != cur.type) ||\n prev.apply != cur.apply || prev.boost != cur.boost)\n result.push(opt);\n else if (score(opt.completion) > score(prev))\n result[result.length - 1] = opt;\n prev = opt.completion;\n }\n return result;\n}\nclass CompletionDialog {\n constructor(options, attrs, tooltip, timestamp, selected, disabled) {\n this.options = options;\n this.attrs = attrs;\n this.tooltip = tooltip;\n this.timestamp = timestamp;\n this.selected = selected;\n this.disabled = disabled;\n }\n setSelected(selected, id) {\n return selected == this.selected || selected >= this.options.length ? this\n : new CompletionDialog(this.options, makeAttrs(id, selected), this.tooltip, this.timestamp, selected, this.disabled);\n }\n static build(active, state, id, prev, conf) {\n let options = sortOptions(active, state);\n if (!options.length) {\n return prev && active.some(a => a.state == 1 /* State.Pending */) ?\n new CompletionDialog(prev.options, prev.attrs, prev.tooltip, prev.timestamp, prev.selected, true) : null;\n }\n let selected = state.facet(completionConfig).selectOnOpen ? 0 : -1;\n if (prev && prev.selected != selected && prev.selected != -1) {\n let selectedValue = prev.options[prev.selected].completion;\n for (let i = 0; i < options.length; i++)\n if (options[i].completion == selectedValue) {\n selected = i;\n break;\n }\n }\n return new CompletionDialog(options, makeAttrs(id, selected), {\n pos: active.reduce((a, b) => b.hasResult() ? Math.min(a, b.from) : a, 1e8),\n create: createTooltip,\n above: conf.aboveCursor,\n }, prev ? prev.timestamp : Date.now(), selected, false);\n }\n map(changes) {\n return new CompletionDialog(this.options, this.attrs, Object.assign(Object.assign({}, this.tooltip), { pos: changes.mapPos(this.tooltip.pos) }), this.timestamp, this.selected, this.disabled);\n }\n}\nclass CompletionState {\n constructor(active, id, open) {\n this.active = active;\n this.id = id;\n this.open = open;\n }\n static start() {\n return new CompletionState(none, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);\n }\n update(tr) {\n let { state } = tr, conf = state.facet(completionConfig);\n let sources = conf.override ||\n state.languageDataAt("autocomplete", cur(state)).map(asSource);\n let active = sources.map(source => {\n let value = this.active.find(s => s.source == source) ||\n new ActiveSource(source, this.active.some(a => a.state != 0 /* State.Inactive */) ? 1 /* State.Pending */ : 0 /* State.Inactive */);\n return value.update(tr, conf);\n });\n if (active.length == this.active.length && active.every((a, i) => a == this.active[i]))\n active = this.active;\n let open = this.open;\n if (open && tr.docChanged)\n open = open.map(tr.changes);\n if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||\n !sameResults(active, this.active))\n open = CompletionDialog.build(active, state, this.id, open, conf);\n else if (open && open.disabled && !active.some(a => a.state == 1 /* State.Pending */))\n open = null;\n if (!open && active.every(a => a.state != 1 /* State.Pending */) && active.some(a => a.hasResult()))\n active = active.map(a => a.hasResult() ? new ActiveSource(a.source, 0 /* State.Inactive */) : a);\n for (let effect of tr.effects)\n if (effect.is(setSelectedEffect))\n open = open && open.setSelected(effect.value, this.id);\n return active == this.active && open == this.open ? this : new CompletionState(active, this.id, open);\n }\n get tooltip() { return this.open ? this.open.tooltip : null; }\n get attrs() { return this.open ? this.open.attrs : this.active.length ? baseAttrs : noAttrs; }\n}\nfunction sameResults(a, b) {\n if (a == b)\n return true;\n for (let iA = 0, iB = 0;;) {\n while (iA < a.length && !a[iA].hasResult)\n iA++;\n while (iB < b.length && !b[iB].hasResult)\n iB++;\n let endA = iA == a.length, endB = iB == b.length;\n if (endA || endB)\n return endA == endB;\n if (a[iA++].result != b[iB++].result)\n return false;\n }\n}\nconst baseAttrs = {\n "aria-autocomplete": "list"\n};\nconst noAttrs = {};\nfunction makeAttrs(id, selected) {\n let result = {\n "aria-autocomplete": "list",\n "aria-haspopup": "listbox",\n "aria-controls": id\n };\n if (selected > -1)\n result["aria-activedescendant"] = id + "-" + selected;\n return result;\n}\nconst none = [];\nfunction getUpdateType(tr, conf) {\n if (tr.isUserEvent("input.complete")) {\n let completion = tr.annotation(pickedCompletion);\n if (completion && conf.activateOnCompletion(completion))\n return 4 /* UpdateType.Activate */ | 8 /* UpdateType.Reset */;\n }\n let typing = tr.isUserEvent("input.type");\n return typing && conf.activateOnTyping ? 4 /* UpdateType.Activate */ | 1 /* UpdateType.Typing */\n : typing ? 1 /* UpdateType.Typing */\n : tr.isUserEvent("delete.backward") ? 2 /* UpdateType.Backspacing */\n : tr.selection ? 8 /* UpdateType.Reset */\n : tr.docChanged ? 16 /* UpdateType.ResetIfTouching */ : 0 /* UpdateType.None */;\n}\nclass ActiveSource {\n constructor(source, state, explicitPos = -1) {\n this.source = source;\n this.state = state;\n this.explicitPos = explicitPos;\n }\n hasResult() { return false; }\n update(tr, conf) {\n let type = getUpdateType(tr, conf), value = this;\n if ((type & 8 /* UpdateType.Reset */) || (type & 16 /* UpdateType.ResetIfTouching */) && this.touches(tr))\n value = new ActiveSource(value.source, 0 /* State.Inactive */);\n if ((type & 4 /* UpdateType.Activate */) && value.state == 0 /* State.Inactive */)\n value = new ActiveSource(this.source, 1 /* State.Pending */);\n value = value.updateFor(tr, type);\n for (let effect of tr.effects) {\n if (effect.is(startCompletionEffect))\n value = new ActiveSource(value.source, 1 /* State.Pending */, effect.value ? cur(tr.state) : -1);\n else if (effect.is(closeCompletionEffect))\n value = new ActiveSource(value.source, 0 /* State.Inactive */);\n else if (effect.is(setActiveEffect))\n for (let active of effect.value)\n if (active.source == value.source)\n value = active;\n }\n return value;\n }\n updateFor(tr, type) { return this.map(tr.changes); }\n map(changes) {\n return changes.empty || this.explicitPos < 0 ? this : new ActiveSource(this.source, this.state, changes.mapPos(this.explicitPos));\n }\n touches(tr) {\n return tr.changes.touchesRange(cur(tr.state));\n }\n}\nclass ActiveResult extends ActiveSource {\n constructor(source, explicitPos, result, from, to) {\n super(source, 2 /* State.Result */, explicitPos);\n this.result = result;\n this.from = from;\n this.to = to;\n }\n hasResult() { return true; }\n updateFor(tr, type) {\n var _a;\n if (!(type & 3 /* UpdateType.SimpleInteraction */))\n return this.map(tr.changes);\n let result = this.result;\n if (result.map && !tr.changes.empty)\n result = result.map(result, tr.changes);\n let from = tr.changes.mapPos(this.from), to = tr.changes.mapPos(this.to, 1);\n let pos = cur(tr.state);\n if ((this.explicitPos < 0 ? pos <= from : pos < this.from) ||\n pos > to || !result ||\n (type & 2 /* UpdateType.Backspacing */) && cur(tr.startState) == this.from)\n return new ActiveSource(this.source, type & 4 /* UpdateType.Activate */ ? 1 /* State.Pending */ : 0 /* State.Inactive */);\n let explicitPos = this.explicitPos < 0 ? -1 : tr.changes.mapPos(this.explicitPos);\n if (checkValid(result.validFor, tr.state, from, to))\n return new ActiveResult(this.source, explicitPos, result, from, to);\n if (result.update &&\n (result = result.update(result, from, to, new CompletionContext(tr.state, pos, explicitPos >= 0))))\n return new ActiveResult(this.source, explicitPos, result, result.from, (_a = result.to) !== null && _a !== void 0 ? _a : cur(tr.state));\n return new ActiveSource(this.source, 1 /* State.Pending */, explicitPos);\n }\n map(mapping) {\n if (mapping.empty)\n return this;\n let result = this.result.map ? this.result.map(this.result, mapping) : this.result;\n if (!result)\n return new ActiveSource(this.source, 0 /* State.Inactive */);\n return new ActiveResult(this.source, this.explicitPos < 0 ? -1 : mapping.mapPos(this.explicitPos), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));\n }\n touches(tr) {\n return tr.changes.touchesRange(this.from, this.to);\n }\n}\nfunction checkValid(validFor, state, from, to) {\n if (!validFor)\n return false;\n let text = state.sliceDoc(from, to);\n return typeof validFor == "function" ? validFor(text, from, to, state) : ensureAnchor(validFor, true).test(text);\n}\nconst setActiveEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define({\n map(sources, mapping) { return sources.map(s => s.map(mapping)); }\n});\nconst setSelectedEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define();\nconst completionState = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateField.define({\n create() { return CompletionState.start(); },\n update(value, tr) { return value.update(tr); },\n provide: f => [\n _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.showTooltip.from(f, val => val.tooltip),\n _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.contentAttributes.from(f, state => state.attrs)\n ]\n});\nfunction applyCompletion(view, option) {\n const apply = option.completion.apply || option.completion.label;\n let result = view.state.field(completionState).active.find(a => a.source == option.source);\n if (!(result instanceof ActiveResult))\n return false;\n if (typeof apply == "string")\n view.dispatch(Object.assign(Object.assign({}, insertCompletionText(view.state, apply, result.from, result.to)), { annotations: pickedCompletion.of(option.completion) }));\n else\n apply(view, option.completion, result.from, result.to);\n return true;\n}\nconst createTooltip = /*@__PURE__*/completionTooltip(completionState, applyCompletion);\n\n/**\nReturns a command that moves the completion selection forward or\nbackward by the given amount.\n*/\nfunction moveCompletionSelection(forward, by = "option") {\n return (view) => {\n let cState = view.state.field(completionState, false);\n if (!cState || !cState.open || cState.open.disabled ||\n Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay)\n return false;\n let step = 1, tooltip;\n if (by == "page" && (tooltip = (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.getTooltip)(view, cState.open.tooltip)))\n step = Math.max(2, Math.floor(tooltip.dom.offsetHeight /\n tooltip.dom.querySelector("li").offsetHeight) - 1);\n let { length } = cState.open.options;\n let selected = cState.open.selected > -1 ? cState.open.selected + step * (forward ? 1 : -1) : forward ? 0 : length - 1;\n if (selected < 0)\n selected = by == "page" ? 0 : length - 1;\n else if (selected >= length)\n selected = by == "page" ? length - 1 : 0;\n view.dispatch({ effects: setSelectedEffect.of(selected) });\n return true;\n };\n}\n/**\nAccept the current completion.\n*/\nconst acceptCompletion = (view) => {\n let cState = view.state.field(completionState, false);\n if (view.state.readOnly || !cState || !cState.open || cState.open.selected < 0 || cState.open.disabled ||\n Date.now() - cState.open.timestamp < view.state.facet(completionConfig).interactionDelay)\n return false;\n return applyCompletion(view, cState.open.options[cState.open.selected]);\n};\n/**\nExplicitly start autocompletion.\n*/\nconst startCompletion = (view) => {\n let cState = view.state.field(completionState, false);\n if (!cState)\n return false;\n view.dispatch({ effects: startCompletionEffect.of(true) });\n return true;\n};\n/**\nClose the currently active completion.\n*/\nconst closeCompletion = (view) => {\n let cState = view.state.field(completionState, false);\n if (!cState || !cState.active.some(a => a.state != 0 /* State.Inactive */))\n return false;\n view.dispatch({ effects: closeCompletionEffect.of(null) });\n return true;\n};\nclass RunningQuery {\n constructor(active, context) {\n this.active = active;\n this.context = context;\n this.time = Date.now();\n this.updates = [];\n // Note that \'undefined\' means \'not done yet\', whereas \'null\' means\n // \'query returned null\'.\n this.done = undefined;\n }\n}\nconst MaxUpdateCount = 50, MinAbortTime = 1000;\nconst completionPlugin = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.debounceUpdate = -1;\n this.running = [];\n this.debounceAccept = -1;\n this.pendingStart = false;\n this.composing = 0 /* CompositionState.None */;\n for (let active of view.state.field(completionState).active)\n if (active.state == 1 /* State.Pending */)\n this.startQuery(active);\n }\n update(update) {\n let cState = update.state.field(completionState);\n let conf = update.state.facet(completionConfig);\n if (!update.selectionSet && !update.docChanged && update.startState.field(completionState) == cState)\n return;\n let doesReset = update.transactions.some(tr => {\n let type = getUpdateType(tr, conf);\n return (type & 8 /* UpdateType.Reset */) || (tr.selection || tr.docChanged) && !(type & 3 /* UpdateType.SimpleInteraction */);\n });\n for (let i = 0; i < this.running.length; i++) {\n let query = this.running[i];\n if (doesReset ||\n query.updates.length + update.transactions.length > MaxUpdateCount && Date.now() - query.time > MinAbortTime) {\n for (let handler of query.context.abortListeners) {\n try {\n handler();\n }\n catch (e) {\n (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.logException)(this.view.state, e);\n }\n }\n query.context.abortListeners = null;\n this.running.splice(i--, 1);\n }\n else {\n query.updates.push(...update.transactions);\n }\n }\n if (this.debounceUpdate > -1)\n clearTimeout(this.debounceUpdate);\n if (update.transactions.some(tr => tr.effects.some(e => e.is(startCompletionEffect))))\n this.pendingStart = true;\n let delay = this.pendingStart ? 50 : conf.activateOnTypingDelay;\n this.debounceUpdate = cState.active.some(a => a.state == 1 /* State.Pending */ && !this.running.some(q => q.active.source == a.source))\n ? setTimeout(() => this.startUpdate(), delay) : -1;\n if (this.composing != 0 /* CompositionState.None */)\n for (let tr of update.transactions) {\n if (tr.isUserEvent("input.type"))\n this.composing = 2 /* CompositionState.Changed */;\n else if (this.composing == 2 /* CompositionState.Changed */ && tr.selection)\n this.composing = 3 /* CompositionState.ChangedAndMoved */;\n }\n }\n startUpdate() {\n this.debounceUpdate = -1;\n this.pendingStart = false;\n let { state } = this.view, cState = state.field(completionState);\n for (let active of cState.active) {\n if (active.state == 1 /* State.Pending */ && !this.running.some(r => r.active.source == active.source))\n this.startQuery(active);\n }\n }\n startQuery(active) {\n let { state } = this.view, pos = cur(state);\n let context = new CompletionContext(state, pos, active.explicitPos == pos, this.view);\n let pending = new RunningQuery(active, context);\n this.running.push(pending);\n Promise.resolve(active.source(context)).then(result => {\n if (!pending.context.aborted) {\n pending.done = result || null;\n this.scheduleAccept();\n }\n }, err => {\n this.view.dispatch({ effects: closeCompletionEffect.of(null) });\n (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.logException)(this.view.state, err);\n });\n }\n scheduleAccept() {\n if (this.running.every(q => q.done !== undefined))\n this.accept();\n else if (this.debounceAccept < 0)\n this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);\n }\n // For each finished query in this.running, try to create a result\n // or, if appropriate, restart the query.\n accept() {\n var _a;\n if (this.debounceAccept > -1)\n clearTimeout(this.debounceAccept);\n this.debounceAccept = -1;\n let updated = [];\n let conf = this.view.state.facet(completionConfig);\n for (let i = 0; i < this.running.length; i++) {\n let query = this.running[i];\n if (query.done === undefined)\n continue;\n this.running.splice(i--, 1);\n if (query.done) {\n let active = new ActiveResult(query.active.source, query.active.explicitPos, query.done, query.done.from, (_a = query.done.to) !== null && _a !== void 0 ? _a : cur(query.updates.length ? query.updates[0].startState : this.view.state));\n // Replay the transactions that happened since the start of\n // the request and see if that preserves the result\n for (let tr of query.updates)\n active = active.update(tr, conf);\n if (active.hasResult()) {\n updated.push(active);\n continue;\n }\n }\n let current = this.view.state.field(completionState).active.find(a => a.source == query.active.source);\n if (current && current.state == 1 /* State.Pending */) {\n if (query.done == null) {\n // Explicitly failed. Should clear the pending status if it\n // hasn\'t been re-set in the meantime.\n let active = new ActiveSource(query.active.source, 0 /* State.Inactive */);\n for (let tr of query.updates)\n active = active.update(tr, conf);\n if (active.state != 1 /* State.Pending */)\n updated.push(active);\n }\n else {\n // Cleared by subsequent transactions. Restart.\n this.startQuery(current);\n }\n }\n }\n if (updated.length)\n this.view.dispatch({ effects: setActiveEffect.of(updated) });\n }\n}, {\n eventHandlers: {\n blur(event) {\n let state = this.view.state.field(completionState, false);\n if (state && state.tooltip && this.view.state.facet(completionConfig).closeOnBlur) {\n let dialog = state.open && (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.getTooltip)(this.view, state.open.tooltip);\n if (!dialog || !dialog.dom.contains(event.relatedTarget))\n setTimeout(() => this.view.dispatch({ effects: closeCompletionEffect.of(null) }), 10);\n }\n },\n compositionstart() {\n this.composing = 1 /* CompositionState.Started */;\n },\n compositionend() {\n if (this.composing == 3 /* CompositionState.ChangedAndMoved */) {\n // Safari fires compositionend events synchronously, possibly\n // from inside an update, so dispatch asynchronously to avoid reentrancy\n setTimeout(() => this.view.dispatch({ effects: startCompletionEffect.of(false) }), 20);\n }\n this.composing = 0 /* CompositionState.None */;\n }\n }\n});\nconst windows = typeof navigator == "object" && /*@__PURE__*//Win/.test(navigator.platform);\nconst commitCharacters = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Prec.highest(/*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.domEventHandlers({\n keydown(event, view) {\n let field = view.state.field(completionState, false);\n if (!field || !field.open || field.open.disabled || field.open.selected < 0 ||\n event.key.length > 1 || event.ctrlKey && !(windows && event.altKey) || event.metaKey)\n return false;\n let option = field.open.options[field.open.selected];\n let result = field.active.find(a => a.source == option.source);\n let commitChars = option.completion.commitCharacters || result.result.commitCharacters;\n if (commitChars && commitChars.indexOf(event.key) > -1)\n applyCompletion(view, option);\n return false;\n }\n}));\n\nconst baseTheme = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.baseTheme({\n ".cm-tooltip.cm-tooltip-autocomplete": {\n "& > ul": {\n fontFamily: "monospace",\n whiteSpace: "nowrap",\n overflow: "hidden auto",\n maxWidth_fallback: "700px",\n maxWidth: "min(700px, 95vw)",\n minWidth: "250px",\n maxHeight: "10em",\n height: "100%",\n listStyle: "none",\n margin: 0,\n padding: 0,\n "& > li, & > completion-section": {\n padding: "1px 3px",\n lineHeight: 1.2\n },\n "& > li": {\n overflowX: "hidden",\n textOverflow: "ellipsis",\n cursor: "pointer"\n },\n "& > completion-section": {\n display: "list-item",\n borderBottom: "1px solid silver",\n paddingLeft: "0.5em",\n opacity: 0.7\n }\n }\n },\n "&light .cm-tooltip-autocomplete ul li[aria-selected]": {\n background: "#17c",\n color: "white",\n },\n "&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]": {\n background: "#777",\n },\n "&dark .cm-tooltip-autocomplete ul li[aria-selected]": {\n background: "#347",\n color: "white",\n },\n "&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]": {\n background: "#444",\n },\n ".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after": {\n content: \'"···"\',\n opacity: 0.5,\n display: "block",\n textAlign: "center"\n },\n ".cm-tooltip.cm-completionInfo": {\n position: "absolute",\n padding: "3px 9px",\n width: "max-content",\n maxWidth: `${400 /* Info.Width */}px`,\n boxSizing: "border-box"\n },\n ".cm-completionInfo.cm-completionInfo-left": { right: "100%" },\n ".cm-completionInfo.cm-completionInfo-right": { left: "100%" },\n ".cm-completionInfo.cm-completionInfo-left-narrow": { right: `${30 /* Info.Margin */}px` },\n ".cm-completionInfo.cm-completionInfo-right-narrow": { left: `${30 /* Info.Margin */}px` },\n "&light .cm-snippetField": { backgroundColor: "#00000022" },\n "&dark .cm-snippetField": { backgroundColor: "#ffffff22" },\n ".cm-snippetFieldPosition": {\n verticalAlign: "text-top",\n width: 0,\n height: "1.15em",\n display: "inline-block",\n margin: "0 -0.7px -.7em",\n borderLeft: "1.4px dotted #888"\n },\n ".cm-completionMatchedText": {\n textDecoration: "underline"\n },\n ".cm-completionDetail": {\n marginLeft: "0.5em",\n fontStyle: "italic"\n },\n ".cm-completionIcon": {\n fontSize: "90%",\n width: ".8em",\n display: "inline-block",\n textAlign: "center",\n paddingRight: ".6em",\n opacity: "0.6",\n boxSizing: "content-box"\n },\n ".cm-completionIcon-function, .cm-completionIcon-method": {\n "&:after": { content: "\'ƒ\'" }\n },\n ".cm-completionIcon-class": {\n "&:after": { content: "\'○\'" }\n },\n ".cm-completionIcon-interface": {\n "&:after": { content: "\'◌\'" }\n },\n ".cm-completionIcon-variable": {\n "&:after": { content: "\'𝑥\'" }\n },\n ".cm-completionIcon-constant": {\n "&:after": { content: "\'𝐶\'" }\n },\n ".cm-completionIcon-type": {\n "&:after": { content: "\'𝑡\'" }\n },\n ".cm-completionIcon-enum": {\n "&:after": { content: "\'∪\'" }\n },\n ".cm-completionIcon-property": {\n "&:after": { content: "\'□\'" }\n },\n ".cm-completionIcon-keyword": {\n "&:after": { content: "\'🔑\\uFE0E\'" } // Disable emoji rendering\n },\n ".cm-completionIcon-namespace": {\n "&:after": { content: "\'▢\'" }\n },\n ".cm-completionIcon-text": {\n "&:after": { content: "\'abc\'", fontSize: "50%", verticalAlign: "middle" }\n }\n});\n\nclass FieldPos {\n constructor(field, line, from, to) {\n this.field = field;\n this.line = line;\n this.from = from;\n this.to = to;\n }\n}\nclass FieldRange {\n constructor(field, from, to) {\n this.field = field;\n this.from = from;\n this.to = to;\n }\n map(changes) {\n let from = changes.mapPos(this.from, -1, _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.MapMode.TrackDel);\n let to = changes.mapPos(this.to, 1, _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.MapMode.TrackDel);\n return from == null || to == null ? null : new FieldRange(this.field, from, to);\n }\n}\nclass Snippet {\n constructor(lines, fieldPositions) {\n this.lines = lines;\n this.fieldPositions = fieldPositions;\n }\n instantiate(state, pos) {\n let text = [], lineStart = [pos];\n let lineObj = state.doc.lineAt(pos), baseIndent = /^\\s*/.exec(lineObj.text)[0];\n for (let line of this.lines) {\n if (text.length) {\n let indent = baseIndent, tabs = /^\\t*/.exec(line)[0].length;\n for (let i = 0; i < tabs; i++)\n indent += state.facet(_codemirror_language__WEBPACK_IMPORTED_MODULE_0__.indentUnit);\n lineStart.push(pos + indent.length - tabs);\n line = indent + line.slice(tabs);\n }\n text.push(line);\n pos += line.length + 1;\n }\n let ranges = this.fieldPositions.map(pos => new FieldRange(pos.field, lineStart[pos.line] + pos.from, lineStart[pos.line] + pos.to));\n return { text, ranges };\n }\n static parse(template) {\n let fields = [];\n let lines = [], positions = [], m;\n for (let line of template.split(/\\r\\n?|\\n/)) {\n while (m = /[#$]\\{(?:(\\d+)(?::([^}]*))?|((?:\\\\[{}]|[^}])*))\\}/.exec(line)) {\n let seq = m[1] ? +m[1] : null, rawName = m[2] || m[3] || "", found = -1;\n let name = rawName.replace(/\\\\[{}]/g, m => m[1]);\n for (let i = 0; i < fields.length; i++) {\n if (seq != null ? fields[i].seq == seq : name ? fields[i].name == name : false)\n found = i;\n }\n if (found < 0) {\n let i = 0;\n while (i < fields.length && (seq == null || (fields[i].seq != null && fields[i].seq < seq)))\n i++;\n fields.splice(i, 0, { seq, name });\n found = i;\n for (let pos of positions)\n if (pos.field >= found)\n pos.field++;\n }\n positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));\n line = line.slice(0, m.index) + rawName + line.slice(m.index + m[0].length);\n }\n line = line.replace(/\\\\([{}])/g, (_, brace, index) => {\n for (let pos of positions)\n if (pos.line == lines.length && pos.from > index) {\n pos.from--;\n pos.to--;\n }\n return brace;\n });\n lines.push(line);\n }\n return new Snippet(lines, positions);\n }\n}\nlet fieldMarker = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.widget({ widget: /*@__PURE__*/new class extends _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.WidgetType {\n toDOM() {\n let span = document.createElement("span");\n span.className = "cm-snippetFieldPosition";\n return span;\n }\n ignoreEvent() { return false; }\n } });\nlet fieldRange = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.mark({ class: "cm-snippetField" });\nclass ActiveSnippet {\n constructor(ranges, active) {\n this.ranges = ranges;\n this.active = active;\n this.deco = _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.set(ranges.map(r => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)));\n }\n map(changes) {\n let ranges = [];\n for (let r of this.ranges) {\n let mapped = r.map(changes);\n if (!mapped)\n return null;\n ranges.push(mapped);\n }\n return new ActiveSnippet(ranges, this.active);\n }\n selectionInsideField(sel) {\n return sel.ranges.every(range => this.ranges.some(r => r.field == this.active && r.from <= range.from && r.to >= range.to));\n }\n}\nconst setActive = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define({\n map(value, changes) { return value && value.map(changes); }\n});\nconst moveToField = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define();\nconst snippetState = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateField.define({\n create() { return null; },\n update(value, tr) {\n for (let effect of tr.effects) {\n if (effect.is(setActive))\n return effect.value;\n if (effect.is(moveToField) && value)\n return new ActiveSnippet(value.ranges, effect.value);\n }\n if (value && tr.docChanged)\n value = value.map(tr.changes);\n if (value && tr.selection && !value.selectionInsideField(tr.selection))\n value = null;\n return value;\n },\n provide: f => _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.decorations.from(f, val => val ? val.deco : _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.none)\n});\nfunction fieldSelection(ranges, field) {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.create(ranges.filter(r => r.field == field).map(r => _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(r.from, r.to)));\n}\n/**\nConvert a snippet template to a function that can\n[apply](https://codemirror.net/6/docs/ref/#autocomplete.Completion.apply) it. Snippets are written\nusing syntax like this:\n\n "for (let ${index} = 0; ${index} < ${end}; ${index}++) {\\n\\t${}\\n}"\n\nEach `${}` placeholder (you may also use `#{}`) indicates a field\nthat the user can fill in. Its name, if any, will be the default\ncontent for the field.\n\nWhen the snippet is activated by calling the returned function,\nthe code is inserted at the given position. Newlines in the\ntemplate are indented by the indentation of the start line, plus\none [indent unit](https://codemirror.net/6/docs/ref/#language.indentUnit) per tab character after\nthe newline.\n\nOn activation, (all instances of) the first field are selected.\nThe user can move between fields with Tab and Shift-Tab as long as\nthe fields are active. Moving to the last field or moving the\ncursor out of the current field deactivates the fields.\n\nThe order of fields defaults to textual order, but you can add\nnumbers to placeholders (`${1}` or `${1:defaultText}`) to provide\na custom order.\n\nTo include a literal `{` or `}` in your template, put a backslash\nin front of it. This will be removed and the brace will not be\ninterpreted as indicating a placeholder.\n*/\nfunction snippet(template) {\n let snippet = Snippet.parse(template);\n return (editor, completion, from, to) => {\n let { text, ranges } = snippet.instantiate(editor.state, from);\n let spec = {\n changes: { from, to, insert: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Text.of(text) },\n scrollIntoView: true,\n annotations: completion ? [pickedCompletion.of(completion), _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Transaction.userEvent.of("input.complete")] : undefined\n };\n if (ranges.length)\n spec.selection = fieldSelection(ranges, 0);\n if (ranges.some(r => r.field > 0)) {\n let active = new ActiveSnippet(ranges, 0);\n let effects = spec.effects = [setActive.of(active)];\n if (editor.state.field(snippetState, false) === undefined)\n effects.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.appendConfig.of([snippetState, addSnippetKeymap, snippetPointerHandler, baseTheme]));\n }\n editor.dispatch(editor.state.update(spec));\n };\n}\nfunction moveField(dir) {\n return ({ state, dispatch }) => {\n let active = state.field(snippetState, false);\n if (!active || dir < 0 && active.active == 0)\n return false;\n let next = active.active + dir, last = dir > 0 && !active.ranges.some(r => r.field == next + dir);\n dispatch(state.update({\n selection: fieldSelection(active.ranges, next),\n effects: setActive.of(last ? null : new ActiveSnippet(active.ranges, next)),\n scrollIntoView: true\n }));\n return true;\n };\n}\n/**\nA command that clears the active snippet, if any.\n*/\nconst clearSnippet = ({ state, dispatch }) => {\n let active = state.field(snippetState, false);\n if (!active)\n return false;\n dispatch(state.update({ effects: setActive.of(null) }));\n return true;\n};\n/**\nMove to the next snippet field, if available.\n*/\nconst nextSnippetField = /*@__PURE__*/moveField(1);\n/**\nMove to the previous snippet field, if available.\n*/\nconst prevSnippetField = /*@__PURE__*/moveField(-1);\n/**\nCheck if there is an active snippet with a next field for\n`nextSnippetField` to move to.\n*/\nfunction hasNextSnippetField(state) {\n let active = state.field(snippetState, false);\n return !!(active && active.ranges.some(r => r.field == active.active + 1));\n}\n/**\nReturns true if there is an active snippet and a previous field\nfor `prevSnippetField` to move to.\n*/\nfunction hasPrevSnippetField(state) {\n let active = state.field(snippetState, false);\n return !!(active && active.active > 0);\n}\nconst defaultSnippetKeymap = [\n { key: "Tab", run: nextSnippetField, shift: prevSnippetField },\n { key: "Escape", run: clearSnippet }\n];\n/**\nA facet that can be used to configure the key bindings used by\nsnippets. The default binds Tab to\n[`nextSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.nextSnippetField), Shift-Tab to\n[`prevSnippetField`](https://codemirror.net/6/docs/ref/#autocomplete.prevSnippetField), and Escape\nto [`clearSnippet`](https://codemirror.net/6/docs/ref/#autocomplete.clearSnippet).\n*/\nconst snippetKeymap = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Facet.define({\n combine(maps) { return maps.length ? maps[0] : defaultSnippetKeymap; }\n});\nconst addSnippetKeymap = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Prec.highest(/*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.keymap.compute([snippetKeymap], state => state.facet(snippetKeymap)));\n/**\nCreate a completion from a snippet. Returns an object with the\nproperties from `completion`, plus an `apply` function that\napplies the snippet.\n*/\nfunction snippetCompletion(template, completion) {\n return Object.assign(Object.assign({}, completion), { apply: snippet(template) });\n}\nconst snippetPointerHandler = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.domEventHandlers({\n mousedown(event, view) {\n let active = view.state.field(snippetState, false), pos;\n if (!active || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null)\n return false;\n let match = active.ranges.find(r => r.from <= pos && r.to >= pos);\n if (!match || match.field == active.active)\n return false;\n view.dispatch({\n selection: fieldSelection(active.ranges, match.field),\n effects: setActive.of(active.ranges.some(r => r.field > match.field)\n ? new ActiveSnippet(active.ranges, match.field) : null),\n scrollIntoView: true\n });\n return true;\n }\n});\n\nfunction wordRE(wordChars) {\n let escaped = wordChars.replace(/[\\]\\-\\\\]/g, "\\\\$&");\n try {\n return new RegExp(`[\\\\p{Alphabetic}\\\\p{Number}_${escaped}]+`, "ug");\n }\n catch (_a) {\n return new RegExp(`[\\w${escaped}]`, "g");\n }\n}\nfunction mapRE(re, f) {\n return new RegExp(f(re.source), re.unicode ? "u" : "");\n}\nconst wordCaches = /*@__PURE__*/Object.create(null);\nfunction wordCache(wordChars) {\n return wordCaches[wordChars] || (wordCaches[wordChars] = new WeakMap);\n}\nfunction storeWords(doc, wordRE, result, seen, ignoreAt) {\n for (let lines = doc.iterLines(), pos = 0; !lines.next().done;) {\n let { value } = lines, m;\n wordRE.lastIndex = 0;\n while (m = wordRE.exec(value)) {\n if (!seen[m[0]] && pos + m.index != ignoreAt) {\n result.push({ type: "text", label: m[0] });\n seen[m[0]] = true;\n if (result.length >= 2000 /* C.MaxList */)\n return;\n }\n }\n pos += value.length + 1;\n }\n}\nfunction collectWords(doc, cache, wordRE, to, ignoreAt) {\n let big = doc.length >= 1000 /* C.MinCacheLen */;\n let cached = big && cache.get(doc);\n if (cached)\n return cached;\n let result = [], seen = Object.create(null);\n if (doc.children) {\n let pos = 0;\n for (let ch of doc.children) {\n if (ch.length >= 1000 /* C.MinCacheLen */) {\n for (let c of collectWords(ch, cache, wordRE, to - pos, ignoreAt - pos)) {\n if (!seen[c.label]) {\n seen[c.label] = true;\n result.push(c);\n }\n }\n }\n else {\n storeWords(ch, wordRE, result, seen, ignoreAt - pos);\n }\n pos += ch.length + 1;\n }\n }\n else {\n storeWords(doc, wordRE, result, seen, ignoreAt);\n }\n if (big && result.length < 2000 /* C.MaxList */)\n cache.set(doc, result);\n return result;\n}\n/**\nA completion source that will scan the document for words (using a\n[character categorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer)), and\nreturn those as completions.\n*/\nconst completeAnyWord = context => {\n let wordChars = context.state.languageDataAt("wordChars", context.pos).join("");\n let re = wordRE(wordChars);\n let token = context.matchBefore(mapRE(re, s => s + "$"));\n if (!token && !context.explicit)\n return null;\n let from = token ? token.from : context.pos;\n let options = collectWords(context.state.doc, wordCache(wordChars), re, 50000 /* C.Range */, from);\n return { from, options, validFor: mapRE(re, s => "^" + s) };\n};\n\nconst defaults = {\n brackets: ["(", "[", "{", "\'", \'"\'],\n before: ")]}:;>",\n stringPrefixes: []\n};\nconst closeBracketEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define({\n map(value, mapping) {\n let mapped = mapping.mapPos(value, -1, _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.MapMode.TrackAfter);\n return mapped == null ? undefined : mapped;\n }\n});\nconst closedBracket = /*@__PURE__*/new class extends _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.RangeValue {\n};\nclosedBracket.startSide = 1;\nclosedBracket.endSide = -1;\nconst bracketState = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateField.define({\n create() { return _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.RangeSet.empty; },\n update(value, tr) {\n value = value.map(tr.changes);\n if (tr.selection) {\n let line = tr.state.doc.lineAt(tr.selection.main.head);\n value = value.update({ filter: from => from >= line.from && from <= line.to });\n }\n for (let effect of tr.effects)\n if (effect.is(closeBracketEffect))\n value = value.update({ add: [closedBracket.range(effect.value, effect.value + 1)] });\n return value;\n }\n});\n/**\nExtension to enable bracket-closing behavior. When a closeable\nbracket is typed, its closing bracket is immediately inserted\nafter the cursor. When closing a bracket directly in front of a\nclosing bracket inserted by the extension, the cursor moves over\nthat bracket.\n*/\nfunction closeBrackets() {\n return [inputHandler, bracketState];\n}\nconst definedClosing = "()[]{}<>";\nfunction closing(ch) {\n for (let i = 0; i < definedClosing.length; i += 2)\n if (definedClosing.charCodeAt(i) == ch)\n return definedClosing.charAt(i + 1);\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.fromCodePoint)(ch < 128 ? ch : ch + 1);\n}\nfunction config(state, pos) {\n return state.languageDataAt("closeBrackets", pos)[0] || defaults;\n}\nconst android = typeof navigator == "object" && /*@__PURE__*//Android\\b/.test(navigator.userAgent);\nconst inputHandler = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.inputHandler.of((view, from, to, insert) => {\n if ((android ? view.composing : view.compositionStarted) || view.state.readOnly)\n return false;\n let sel = view.state.selection.main;\n if (insert.length > 2 || insert.length == 2 && (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointSize)((0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(insert, 0)) == 1 ||\n from != sel.from || to != sel.to)\n return false;\n let tr = insertBracket(view.state, insert);\n if (!tr)\n return false;\n view.dispatch(tr);\n return true;\n});\n/**\nCommand that implements deleting a pair of matching brackets when\nthe cursor is between them.\n*/\nconst deleteBracketPair = ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n let conf = config(state, state.selection.main.head);\n let tokens = conf.brackets || defaults.brackets;\n let dont = null, changes = state.changeByRange(range => {\n if (range.empty) {\n let before = prevChar(state.doc, range.head);\n for (let token of tokens) {\n if (token == before && nextChar(state.doc, range.head) == closing((0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(token, 0)))\n return { changes: { from: range.head - token.length, to: range.head + token.length },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(range.head - token.length) };\n }\n }\n return { range: dont = range };\n });\n if (!dont)\n dispatch(state.update(changes, { scrollIntoView: true, userEvent: "delete.backward" }));\n return !dont;\n};\n/**\nClose-brackets related key bindings. Binds Backspace to\n[`deleteBracketPair`](https://codemirror.net/6/docs/ref/#autocomplete.deleteBracketPair).\n*/\nconst closeBracketsKeymap = [\n { key: "Backspace", run: deleteBracketPair }\n];\n/**\nImplements the extension\'s behavior on text insertion. If the\ngiven string counts as a bracket in the language around the\nselection, and replacing the selection with it requires custom\nbehavior (inserting a closing version or skipping past a\npreviously-closed bracket), this function returns a transaction\nrepresenting that custom behavior. (You only need this if you want\nto programmatically insert brackets—the\n[`closeBrackets`](https://codemirror.net/6/docs/ref/#autocomplete.closeBrackets) extension will\ntake care of running this for user input.)\n*/\nfunction insertBracket(state, bracket) {\n let conf = config(state, state.selection.main.head);\n let tokens = conf.brackets || defaults.brackets;\n for (let tok of tokens) {\n let closed = closing((0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(tok, 0));\n if (bracket == tok)\n return closed == tok ? handleSame(state, tok, tokens.indexOf(tok + tok + tok) > -1, conf)\n : handleOpen(state, tok, closed, conf.before || defaults.before);\n if (bracket == closed && closedBracketAt(state, state.selection.main.from))\n return handleClose(state, tok, closed);\n }\n return null;\n}\nfunction closedBracketAt(state, pos) {\n let found = false;\n state.field(bracketState).between(0, state.doc.length, from => {\n if (from == pos)\n found = true;\n });\n return found;\n}\nfunction nextChar(doc, pos) {\n let next = doc.sliceString(pos, pos + 2);\n return next.slice(0, (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointSize)((0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(next, 0)));\n}\nfunction prevChar(doc, pos) {\n let prev = doc.sliceString(pos - 2, pos);\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointSize)((0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(prev, 0)) == prev.length ? prev : prev.slice(1);\n}\nfunction handleOpen(state, open, close, closeBefore) {\n let dont = null, changes = state.changeByRange(range => {\n if (!range.empty)\n return { changes: [{ insert: open, from: range.from }, { insert: close, from: range.to }],\n effects: closeBracketEffect.of(range.to + open.length),\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(range.anchor + open.length, range.head + open.length) };\n let next = nextChar(state.doc, range.head);\n if (!next || /\\s/.test(next) || closeBefore.indexOf(next) > -1)\n return { changes: { insert: open + close, from: range.head },\n effects: closeBracketEffect.of(range.head + open.length),\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(range.head + open.length) };\n return { range: dont = range };\n });\n return dont ? null : state.update(changes, {\n scrollIntoView: true,\n userEvent: "input.type"\n });\n}\nfunction handleClose(state, _open, close) {\n let dont = null, changes = state.changeByRange(range => {\n if (range.empty && nextChar(state.doc, range.head) == close)\n return { changes: { from: range.head, to: range.head + close.length, insert: close },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(range.head + close.length) };\n return dont = { range };\n });\n return dont ? null : state.update(changes, {\n scrollIntoView: true,\n userEvent: "input.type"\n });\n}\n// Handles cases where the open and close token are the same, and\n// possibly triple quotes (as in `"""abc"""`-style quoting).\nfunction handleSame(state, token, allowTriple, config) {\n let stringPrefixes = config.stringPrefixes || defaults.stringPrefixes;\n let dont = null, changes = state.changeByRange(range => {\n if (!range.empty)\n return { changes: [{ insert: token, from: range.from }, { insert: token, from: range.to }],\n effects: closeBracketEffect.of(range.to + token.length),\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(range.anchor + token.length, range.head + token.length) };\n let pos = range.head, next = nextChar(state.doc, pos), start;\n if (next == token) {\n if (nodeStart(state, pos)) {\n return { changes: { insert: token + token, from: pos },\n effects: closeBracketEffect.of(pos + token.length),\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(pos + token.length) };\n }\n else if (closedBracketAt(state, pos)) {\n let isTriple = allowTriple && state.sliceDoc(pos, pos + token.length * 3) == token + token + token;\n let content = isTriple ? token + token + token : token;\n return { changes: { from: pos, to: pos + content.length, insert: content },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(pos + content.length) };\n }\n }\n else if (allowTriple && state.sliceDoc(pos - 2 * token.length, pos) == token + token &&\n (start = canStartStringAt(state, pos - 2 * token.length, stringPrefixes)) > -1 &&\n nodeStart(state, start)) {\n return { changes: { insert: token + token + token + token, from: pos },\n effects: closeBracketEffect.of(pos + token.length),\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(pos + token.length) };\n }\n else if (state.charCategorizer(pos)(next) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word) {\n if (canStartStringAt(state, pos, stringPrefixes) > -1 && !probablyInString(state, pos, token, stringPrefixes))\n return { changes: { insert: token + token, from: pos },\n effects: closeBracketEffect.of(pos + token.length),\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(pos + token.length) };\n }\n return { range: dont = range };\n });\n return dont ? null : state.update(changes, {\n scrollIntoView: true,\n userEvent: "input.type"\n });\n}\nfunction nodeStart(state, pos) {\n let tree = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_0__.syntaxTree)(state).resolveInner(pos + 1);\n return tree.parent && tree.from == pos;\n}\nfunction probablyInString(state, pos, quoteToken, prefixes) {\n let node = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_0__.syntaxTree)(state).resolveInner(pos, -1);\n let maxPrefix = prefixes.reduce((m, p) => Math.max(m, p.length), 0);\n for (let i = 0; i < 5; i++) {\n let start = state.sliceDoc(node.from, Math.min(node.to, node.from + quoteToken.length + maxPrefix));\n let quotePos = start.indexOf(quoteToken);\n if (!quotePos || quotePos > -1 && prefixes.indexOf(start.slice(0, quotePos)) > -1) {\n let first = node.firstChild;\n while (first && first.from == node.from && first.to - first.from > quoteToken.length + quotePos) {\n if (state.sliceDoc(first.to - quoteToken.length, first.to) == quoteToken)\n return false;\n first = first.firstChild;\n }\n return true;\n }\n let parent = node.to == pos && node.parent;\n if (!parent)\n break;\n node = parent;\n }\n return false;\n}\nfunction canStartStringAt(state, pos, prefixes) {\n let charCat = state.charCategorizer(pos);\n if (charCat(state.sliceDoc(pos - 1, pos)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word)\n return pos;\n for (let prefix of prefixes) {\n let start = pos - prefix.length;\n if (state.sliceDoc(start, pos) == prefix && charCat(state.sliceDoc(start - 1, start)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word)\n return start;\n }\n return -1;\n}\n\n/**\nReturns an extension that enables autocompletion.\n*/\nfunction autocompletion(config = {}) {\n return [\n commitCharacters,\n completionState,\n completionConfig.of(config),\n completionPlugin,\n completionKeymapExt,\n baseTheme\n ];\n}\n/**\nBasic keybindings for autocompletion.\n\n - Ctrl-Space: [`startCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.startCompletion)\n - Escape: [`closeCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.closeCompletion)\n - ArrowDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true)`\n - ArrowUp: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(false)`\n - PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`\n - PageDown: [`moveCompletionSelection`](https://codemirror.net/6/docs/ref/#autocomplete.moveCompletionSelection)`(true, "page")`\n - Enter: [`acceptCompletion`](https://codemirror.net/6/docs/ref/#autocomplete.acceptCompletion)\n*/\nconst completionKeymap = [\n { key: "Ctrl-Space", run: startCompletion },\n { key: "Escape", run: closeCompletion },\n { key: "ArrowDown", run: /*@__PURE__*/moveCompletionSelection(true) },\n { key: "ArrowUp", run: /*@__PURE__*/moveCompletionSelection(false) },\n { key: "PageDown", run: /*@__PURE__*/moveCompletionSelection(true, "page") },\n { key: "PageUp", run: /*@__PURE__*/moveCompletionSelection(false, "page") },\n { key: "Enter", run: acceptCompletion }\n];\nconst completionKeymapExt = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Prec.highest(/*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.keymap.computeN([completionConfig], state => state.facet(completionConfig).defaultKeymap ? [completionKeymap] : []));\n/**\nGet the current completion status. When completions are available,\nthis will return `"active"`. When completions are pending (in the\nprocess of being queried), this returns `"pending"`. Otherwise, it\nreturns `null`.\n*/\nfunction completionStatus(state) {\n let cState = state.field(completionState, false);\n return cState && cState.active.some(a => a.state == 1 /* State.Pending */) ? "pending"\n : cState && cState.active.some(a => a.state != 0 /* State.Inactive */) ? "active" : null;\n}\nconst completionArrayCache = /*@__PURE__*/new WeakMap;\n/**\nReturns the available completions as an array.\n*/\nfunction currentCompletions(state) {\n var _a;\n let open = (_a = state.field(completionState, false)) === null || _a === void 0 ? void 0 : _a.open;\n if (!open || open.disabled)\n return [];\n let completions = completionArrayCache.get(open.options);\n if (!completions)\n completionArrayCache.set(open.options, completions = open.options.map(o => o.completion));\n return completions;\n}\n/**\nReturn the currently selected completion, if any.\n*/\nfunction selectedCompletion(state) {\n var _a;\n let open = (_a = state.field(completionState, false)) === null || _a === void 0 ? void 0 : _a.open;\n return open && !open.disabled && open.selected >= 0 ? open.options[open.selected].completion : null;\n}\n/**\nReturns the currently selected position in the active completion\nlist, or null if no completions are active.\n*/\nfunction selectedCompletionIndex(state) {\n var _a;\n let open = (_a = state.field(completionState, false)) === null || _a === void 0 ? void 0 : _a.open;\n return open && !open.disabled && open.selected >= 0 ? open.selected : null;\n}\n/**\nCreate an effect that can be attached to a transaction to change\nthe currently selected completion.\n*/\nfunction setSelectedCompletion(index) {\n return setSelectedEffect.of(index);\n}\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/autocomplete/dist/index.js?')},"./node_modules/@codemirror/commands/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ blockComment: () => (/* binding */ blockComment),\n/* harmony export */ blockUncomment: () => (/* binding */ blockUncomment),\n/* harmony export */ copyLineDown: () => (/* binding */ copyLineDown),\n/* harmony export */ copyLineUp: () => (/* binding */ copyLineUp),\n/* harmony export */ cursorCharBackward: () => (/* binding */ cursorCharBackward),\n/* harmony export */ cursorCharForward: () => (/* binding */ cursorCharForward),\n/* harmony export */ cursorCharLeft: () => (/* binding */ cursorCharLeft),\n/* harmony export */ cursorCharRight: () => (/* binding */ cursorCharRight),\n/* harmony export */ cursorDocEnd: () => (/* binding */ cursorDocEnd),\n/* harmony export */ cursorDocStart: () => (/* binding */ cursorDocStart),\n/* harmony export */ cursorGroupBackward: () => (/* binding */ cursorGroupBackward),\n/* harmony export */ cursorGroupForward: () => (/* binding */ cursorGroupForward),\n/* harmony export */ cursorGroupLeft: () => (/* binding */ cursorGroupLeft),\n/* harmony export */ cursorGroupRight: () => (/* binding */ cursorGroupRight),\n/* harmony export */ cursorLineBoundaryBackward: () => (/* binding */ cursorLineBoundaryBackward),\n/* harmony export */ cursorLineBoundaryForward: () => (/* binding */ cursorLineBoundaryForward),\n/* harmony export */ cursorLineBoundaryLeft: () => (/* binding */ cursorLineBoundaryLeft),\n/* harmony export */ cursorLineBoundaryRight: () => (/* binding */ cursorLineBoundaryRight),\n/* harmony export */ cursorLineDown: () => (/* binding */ cursorLineDown),\n/* harmony export */ cursorLineEnd: () => (/* binding */ cursorLineEnd),\n/* harmony export */ cursorLineStart: () => (/* binding */ cursorLineStart),\n/* harmony export */ cursorLineUp: () => (/* binding */ cursorLineUp),\n/* harmony export */ cursorMatchingBracket: () => (/* binding */ cursorMatchingBracket),\n/* harmony export */ cursorPageDown: () => (/* binding */ cursorPageDown),\n/* harmony export */ cursorPageUp: () => (/* binding */ cursorPageUp),\n/* harmony export */ cursorSubwordBackward: () => (/* binding */ cursorSubwordBackward),\n/* harmony export */ cursorSubwordForward: () => (/* binding */ cursorSubwordForward),\n/* harmony export */ cursorSyntaxLeft: () => (/* binding */ cursorSyntaxLeft),\n/* harmony export */ cursorSyntaxRight: () => (/* binding */ cursorSyntaxRight),\n/* harmony export */ defaultKeymap: () => (/* binding */ defaultKeymap),\n/* harmony export */ deleteCharBackward: () => (/* binding */ deleteCharBackward),\n/* harmony export */ deleteCharBackwardStrict: () => (/* binding */ deleteCharBackwardStrict),\n/* harmony export */ deleteCharForward: () => (/* binding */ deleteCharForward),\n/* harmony export */ deleteGroupBackward: () => (/* binding */ deleteGroupBackward),\n/* harmony export */ deleteGroupForward: () => (/* binding */ deleteGroupForward),\n/* harmony export */ deleteLine: () => (/* binding */ deleteLine),\n/* harmony export */ deleteLineBoundaryBackward: () => (/* binding */ deleteLineBoundaryBackward),\n/* harmony export */ deleteLineBoundaryForward: () => (/* binding */ deleteLineBoundaryForward),\n/* harmony export */ deleteToLineEnd: () => (/* binding */ deleteToLineEnd),\n/* harmony export */ deleteToLineStart: () => (/* binding */ deleteToLineStart),\n/* harmony export */ deleteTrailingWhitespace: () => (/* binding */ deleteTrailingWhitespace),\n/* harmony export */ emacsStyleKeymap: () => (/* binding */ emacsStyleKeymap),\n/* harmony export */ history: () => (/* binding */ history),\n/* harmony export */ historyField: () => (/* binding */ historyField),\n/* harmony export */ historyKeymap: () => (/* binding */ historyKeymap),\n/* harmony export */ indentLess: () => (/* binding */ indentLess),\n/* harmony export */ indentMore: () => (/* binding */ indentMore),\n/* harmony export */ indentSelection: () => (/* binding */ indentSelection),\n/* harmony export */ indentWithTab: () => (/* binding */ indentWithTab),\n/* harmony export */ insertBlankLine: () => (/* binding */ insertBlankLine),\n/* harmony export */ insertNewline: () => (/* binding */ insertNewline),\n/* harmony export */ insertNewlineAndIndent: () => (/* binding */ insertNewlineAndIndent),\n/* harmony export */ insertNewlineKeepIndent: () => (/* binding */ insertNewlineKeepIndent),\n/* harmony export */ insertTab: () => (/* binding */ insertTab),\n/* harmony export */ invertedEffects: () => (/* binding */ invertedEffects),\n/* harmony export */ isolateHistory: () => (/* binding */ isolateHistory),\n/* harmony export */ lineComment: () => (/* binding */ lineComment),\n/* harmony export */ lineUncomment: () => (/* binding */ lineUncomment),\n/* harmony export */ moveLineDown: () => (/* binding */ moveLineDown),\n/* harmony export */ moveLineUp: () => (/* binding */ moveLineUp),\n/* harmony export */ redo: () => (/* binding */ redo),\n/* harmony export */ redoDepth: () => (/* binding */ redoDepth),\n/* harmony export */ redoSelection: () => (/* binding */ redoSelection),\n/* harmony export */ selectAll: () => (/* binding */ selectAll),\n/* harmony export */ selectCharBackward: () => (/* binding */ selectCharBackward),\n/* harmony export */ selectCharForward: () => (/* binding */ selectCharForward),\n/* harmony export */ selectCharLeft: () => (/* binding */ selectCharLeft),\n/* harmony export */ selectCharRight: () => (/* binding */ selectCharRight),\n/* harmony export */ selectDocEnd: () => (/* binding */ selectDocEnd),\n/* harmony export */ selectDocStart: () => (/* binding */ selectDocStart),\n/* harmony export */ selectGroupBackward: () => (/* binding */ selectGroupBackward),\n/* harmony export */ selectGroupForward: () => (/* binding */ selectGroupForward),\n/* harmony export */ selectGroupLeft: () => (/* binding */ selectGroupLeft),\n/* harmony export */ selectGroupRight: () => (/* binding */ selectGroupRight),\n/* harmony export */ selectLine: () => (/* binding */ selectLine),\n/* harmony export */ selectLineBoundaryBackward: () => (/* binding */ selectLineBoundaryBackward),\n/* harmony export */ selectLineBoundaryForward: () => (/* binding */ selectLineBoundaryForward),\n/* harmony export */ selectLineBoundaryLeft: () => (/* binding */ selectLineBoundaryLeft),\n/* harmony export */ selectLineBoundaryRight: () => (/* binding */ selectLineBoundaryRight),\n/* harmony export */ selectLineDown: () => (/* binding */ selectLineDown),\n/* harmony export */ selectLineEnd: () => (/* binding */ selectLineEnd),\n/* harmony export */ selectLineStart: () => (/* binding */ selectLineStart),\n/* harmony export */ selectLineUp: () => (/* binding */ selectLineUp),\n/* harmony export */ selectMatchingBracket: () => (/* binding */ selectMatchingBracket),\n/* harmony export */ selectPageDown: () => (/* binding */ selectPageDown),\n/* harmony export */ selectPageUp: () => (/* binding */ selectPageUp),\n/* harmony export */ selectParentSyntax: () => (/* binding */ selectParentSyntax),\n/* harmony export */ selectSubwordBackward: () => (/* binding */ selectSubwordBackward),\n/* harmony export */ selectSubwordForward: () => (/* binding */ selectSubwordForward),\n/* harmony export */ selectSyntaxLeft: () => (/* binding */ selectSyntaxLeft),\n/* harmony export */ selectSyntaxRight: () => (/* binding */ selectSyntaxRight),\n/* harmony export */ simplifySelection: () => (/* binding */ simplifySelection),\n/* harmony export */ splitLine: () => (/* binding */ splitLine),\n/* harmony export */ standardKeymap: () => (/* binding */ standardKeymap),\n/* harmony export */ temporarilySetTabFocusMode: () => (/* binding */ temporarilySetTabFocusMode),\n/* harmony export */ toggleBlockComment: () => (/* binding */ toggleBlockComment),\n/* harmony export */ toggleBlockCommentByLine: () => (/* binding */ toggleBlockCommentByLine),\n/* harmony export */ toggleComment: () => (/* binding */ toggleComment),\n/* harmony export */ toggleLineComment: () => (/* binding */ toggleLineComment),\n/* harmony export */ toggleTabFocusMode: () => (/* binding */ toggleTabFocusMode),\n/* harmony export */ transposeChars: () => (/* binding */ transposeChars),\n/* harmony export */ undo: () => (/* binding */ undo),\n/* harmony export */ undoDepth: () => (/* binding */ undoDepth),\n/* harmony export */ undoSelection: () => (/* binding */ undoSelection)\n/* harmony export */ });\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @codemirror/language */ "./node_modules/@codemirror/language/dist/index.js");\n/* harmony import */ var _lezer_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/common */ "./node_modules/@lezer/common/dist/index.js");\n\n\n\n\n\n/**\nComment or uncomment the current selection. Will use line comments\nif available, otherwise falling back to block comments.\n*/\nconst toggleComment = target => {\n let { state } = target, line = state.doc.lineAt(state.selection.main.from), config = getConfig(target.state, line.from);\n return config.line ? toggleLineComment(target) : config.block ? toggleBlockCommentByLine(target) : false;\n};\nfunction command(f, option) {\n return ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n let tr = f(option, state);\n if (!tr)\n return false;\n dispatch(state.update(tr));\n return true;\n };\n}\n/**\nComment or uncomment the current selection using line comments.\nThe line comment syntax is taken from the\n[`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language\ndata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).\n*/\nconst toggleLineComment = /*@__PURE__*/command(changeLineComment, 0 /* CommentOption.Toggle */);\n/**\nComment the current selection using line comments.\n*/\nconst lineComment = /*@__PURE__*/command(changeLineComment, 1 /* CommentOption.Comment */);\n/**\nUncomment the current selection using line comments.\n*/\nconst lineUncomment = /*@__PURE__*/command(changeLineComment, 2 /* CommentOption.Uncomment */);\n/**\nComment or uncomment the current selection using block comments.\nThe block comment syntax is taken from the\n[`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language\ndata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).\n*/\nconst toggleBlockComment = /*@__PURE__*/command(changeBlockComment, 0 /* CommentOption.Toggle */);\n/**\nComment the current selection using block comments.\n*/\nconst blockComment = /*@__PURE__*/command(changeBlockComment, 1 /* CommentOption.Comment */);\n/**\nUncomment the current selection using block comments.\n*/\nconst blockUncomment = /*@__PURE__*/command(changeBlockComment, 2 /* CommentOption.Uncomment */);\n/**\nComment or uncomment the lines around the current selection using\nblock comments.\n*/\nconst toggleBlockCommentByLine = /*@__PURE__*/command((o, s) => changeBlockComment(o, s, selectedLineRanges(s)), 0 /* CommentOption.Toggle */);\nfunction getConfig(state, pos) {\n let data = state.languageDataAt("commentTokens", pos);\n return data.length ? data[0] : {};\n}\nconst SearchMargin = 50;\n/**\nDetermines if the given range is block-commented in the given\nstate.\n*/\nfunction findBlockComment(state, { open, close }, from, to) {\n let textBefore = state.sliceDoc(from - SearchMargin, from);\n let textAfter = state.sliceDoc(to, to + SearchMargin);\n let spaceBefore = /\\s*$/.exec(textBefore)[0].length, spaceAfter = /^\\s*/.exec(textAfter)[0].length;\n let beforeOff = textBefore.length - spaceBefore;\n if (textBefore.slice(beforeOff - open.length, beforeOff) == open &&\n textAfter.slice(spaceAfter, spaceAfter + close.length) == close) {\n return { open: { pos: from - spaceBefore, margin: spaceBefore && 1 },\n close: { pos: to + spaceAfter, margin: spaceAfter && 1 } };\n }\n let startText, endText;\n if (to - from <= 2 * SearchMargin) {\n startText = endText = state.sliceDoc(from, to);\n }\n else {\n startText = state.sliceDoc(from, from + SearchMargin);\n endText = state.sliceDoc(to - SearchMargin, to);\n }\n let startSpace = /^\\s*/.exec(startText)[0].length, endSpace = /\\s*$/.exec(endText)[0].length;\n let endOff = endText.length - endSpace - close.length;\n if (startText.slice(startSpace, startSpace + open.length) == open &&\n endText.slice(endOff, endOff + close.length) == close) {\n return { open: { pos: from + startSpace + open.length,\n margin: /\\s/.test(startText.charAt(startSpace + open.length)) ? 1 : 0 },\n close: { pos: to - endSpace - close.length,\n margin: /\\s/.test(endText.charAt(endOff - 1)) ? 1 : 0 } };\n }\n return null;\n}\nfunction selectedLineRanges(state) {\n let ranges = [];\n for (let r of state.selection.ranges) {\n let fromLine = state.doc.lineAt(r.from);\n let toLine = r.to <= fromLine.to ? fromLine : state.doc.lineAt(r.to);\n let last = ranges.length - 1;\n if (last >= 0 && ranges[last].to > fromLine.from)\n ranges[last].to = toLine.to;\n else\n ranges.push({ from: fromLine.from + /^\\s*/.exec(fromLine.text)[0].length, to: toLine.to });\n }\n return ranges;\n}\n// Performs toggle, comment and uncomment of block comments in\n// languages that support them.\nfunction changeBlockComment(option, state, ranges = state.selection.ranges) {\n let tokens = ranges.map(r => getConfig(state, r.from).block);\n if (!tokens.every(c => c))\n return null;\n let comments = ranges.map((r, i) => findBlockComment(state, tokens[i], r.from, r.to));\n if (option != 2 /* CommentOption.Uncomment */ && !comments.every(c => c)) {\n return { changes: state.changes(ranges.map((range, i) => {\n if (comments[i])\n return [];\n return [{ from: range.from, insert: tokens[i].open + " " }, { from: range.to, insert: " " + tokens[i].close }];\n })) };\n }\n else if (option != 1 /* CommentOption.Comment */ && comments.some(c => c)) {\n let changes = [];\n for (let i = 0, comment; i < comments.length; i++)\n if (comment = comments[i]) {\n let token = tokens[i], { open, close } = comment;\n changes.push({ from: open.pos - token.open.length, to: open.pos + open.margin }, { from: close.pos - close.margin, to: close.pos + token.close.length });\n }\n return { changes };\n }\n return null;\n}\n// Performs toggle, comment and uncomment of line comments.\nfunction changeLineComment(option, state, ranges = state.selection.ranges) {\n let lines = [];\n let prevLine = -1;\n for (let { from, to } of ranges) {\n let startI = lines.length, minIndent = 1e9;\n let token = getConfig(state, from).line;\n if (!token)\n continue;\n for (let pos = from; pos <= to;) {\n let line = state.doc.lineAt(pos);\n if (line.from > prevLine && (from == to || to > line.from)) {\n prevLine = line.from;\n let indent = /^\\s*/.exec(line.text)[0].length;\n let empty = indent == line.length;\n let comment = line.text.slice(indent, indent + token.length) == token ? indent : -1;\n if (indent < line.text.length && indent < minIndent)\n minIndent = indent;\n lines.push({ line, comment, token, indent, empty, single: false });\n }\n pos = line.to + 1;\n }\n if (minIndent < 1e9)\n for (let i = startI; i < lines.length; i++)\n if (lines[i].indent < lines[i].line.text.length)\n lines[i].indent = minIndent;\n if (lines.length == startI + 1)\n lines[startI].single = true;\n }\n if (option != 2 /* CommentOption.Uncomment */ && lines.some(l => l.comment < 0 && (!l.empty || l.single))) {\n let changes = [];\n for (let { line, token, indent, empty, single } of lines)\n if (single || !empty)\n changes.push({ from: line.from + indent, insert: token + " " });\n let changeSet = state.changes(changes);\n return { changes: changeSet, selection: state.selection.map(changeSet, 1) };\n }\n else if (option != 1 /* CommentOption.Comment */ && lines.some(l => l.comment >= 0)) {\n let changes = [];\n for (let { line, comment, token } of lines)\n if (comment >= 0) {\n let from = line.from + comment, to = from + token.length;\n if (line.text[to - line.from] == " ")\n to++;\n changes.push({ from, to });\n }\n return { changes };\n }\n return null;\n}\n\nconst fromHistory = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Annotation.define();\n/**\nTransaction annotation that will prevent that transaction from\nbeing combined with other transactions in the undo history. Given\n`"before"`, it\'ll prevent merging with previous transactions. With\n`"after"`, subsequent transactions won\'t be combined with this\none. With `"full"`, the transaction is isolated on both sides.\n*/\nconst isolateHistory = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Annotation.define();\n/**\nThis facet provides a way to register functions that, given a\ntransaction, provide a set of effects that the history should\nstore when inverting the transaction. This can be used to\nintegrate some kinds of effects in the history, so that they can\nbe undone (and redone again).\n*/\nconst invertedEffects = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Facet.define();\nconst historyConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Facet.define({\n combine(configs) {\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.combineConfig)(configs, {\n minDepth: 100,\n newGroupDelay: 500,\n joinToEvent: (_t, isAdjacent) => isAdjacent,\n }, {\n minDepth: Math.max,\n newGroupDelay: Math.min,\n joinToEvent: (a, b) => (tr, adj) => a(tr, adj) || b(tr, adj)\n });\n }\n});\nconst historyField_ = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateField.define({\n create() {\n return HistoryState.empty;\n },\n update(state, tr) {\n let config = tr.state.facet(historyConfig);\n let fromHist = tr.annotation(fromHistory);\n if (fromHist) {\n let item = HistEvent.fromTransaction(tr, fromHist.selection), from = fromHist.side;\n let other = from == 0 /* BranchName.Done */ ? state.undone : state.done;\n if (item)\n other = updateBranch(other, other.length, config.minDepth, item);\n else\n other = addSelection(other, tr.startState.selection);\n return new HistoryState(from == 0 /* BranchName.Done */ ? fromHist.rest : other, from == 0 /* BranchName.Done */ ? other : fromHist.rest);\n }\n let isolate = tr.annotation(isolateHistory);\n if (isolate == "full" || isolate == "before")\n state = state.isolate();\n if (tr.annotation(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Transaction.addToHistory) === false)\n return !tr.changes.empty ? state.addMapping(tr.changes.desc) : state;\n let event = HistEvent.fromTransaction(tr);\n let time = tr.annotation(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Transaction.time), userEvent = tr.annotation(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Transaction.userEvent);\n if (event)\n state = state.addChanges(event, time, userEvent, config, tr);\n else if (tr.selection)\n state = state.addSelection(tr.startState.selection, time, userEvent, config.newGroupDelay);\n if (isolate == "full" || isolate == "after")\n state = state.isolate();\n return state;\n },\n toJSON(value) {\n return { done: value.done.map(e => e.toJSON()), undone: value.undone.map(e => e.toJSON()) };\n },\n fromJSON(json) {\n return new HistoryState(json.done.map(HistEvent.fromJSON), json.undone.map(HistEvent.fromJSON));\n }\n});\n/**\nCreate a history extension with the given configuration.\n*/\nfunction history(config = {}) {\n return [\n historyField_,\n historyConfig.of(config),\n _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.domEventHandlers({\n beforeinput(e, view) {\n let command = e.inputType == "historyUndo" ? undo : e.inputType == "historyRedo" ? redo : null;\n if (!command)\n return false;\n e.preventDefault();\n return command(view);\n }\n })\n ];\n}\n/**\nThe state field used to store the history data. Should probably\nonly be used when you want to\n[serialize](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) or\n[deserialize](https://codemirror.net/6/docs/ref/#state.EditorState^fromJSON) state objects in a way\nthat preserves history.\n*/\nconst historyField = historyField_;\nfunction cmd(side, selection) {\n return function ({ state, dispatch }) {\n if (!selection && state.readOnly)\n return false;\n let historyState = state.field(historyField_, false);\n if (!historyState)\n return false;\n let tr = historyState.pop(side, state, selection);\n if (!tr)\n return false;\n dispatch(tr);\n return true;\n };\n}\n/**\nUndo a single group of history events. Returns false if no group\nwas available.\n*/\nconst undo = /*@__PURE__*/cmd(0 /* BranchName.Done */, false);\n/**\nRedo a group of history events. Returns false if no group was\navailable.\n*/\nconst redo = /*@__PURE__*/cmd(1 /* BranchName.Undone */, false);\n/**\nUndo a change or selection change.\n*/\nconst undoSelection = /*@__PURE__*/cmd(0 /* BranchName.Done */, true);\n/**\nRedo a change or selection change.\n*/\nconst redoSelection = /*@__PURE__*/cmd(1 /* BranchName.Undone */, true);\nfunction depth(side) {\n return function (state) {\n let histState = state.field(historyField_, false);\n if (!histState)\n return 0;\n let branch = side == 0 /* BranchName.Done */ ? histState.done : histState.undone;\n return branch.length - (branch.length && !branch[0].changes ? 1 : 0);\n };\n}\n/**\nThe amount of undoable change events available in a given state.\n*/\nconst undoDepth = /*@__PURE__*/depth(0 /* BranchName.Done */);\n/**\nThe amount of redoable change events available in a given state.\n*/\nconst redoDepth = /*@__PURE__*/depth(1 /* BranchName.Undone */);\n// History events store groups of changes or effects that need to be\n// undone/redone together.\nclass HistEvent {\n constructor(\n // The changes in this event. Normal events hold at least one\n // change or effect. But it may be necessary to store selection\n // events before the first change, in which case a special type of\n // instance is created which doesn\'t hold any changes, with\n // changes == startSelection == undefined\n changes, \n // The effects associated with this event\n effects, \n // Accumulated mapping (from addToHistory==false) that should be\n // applied to events below this one.\n mapped, \n // The selection before this event\n startSelection, \n // Stores selection changes after this event, to be used for\n // selection undo/redo.\n selectionsAfter) {\n this.changes = changes;\n this.effects = effects;\n this.mapped = mapped;\n this.startSelection = startSelection;\n this.selectionsAfter = selectionsAfter;\n }\n setSelAfter(after) {\n return new HistEvent(this.changes, this.effects, this.mapped, this.startSelection, after);\n }\n toJSON() {\n var _a, _b, _c;\n return {\n changes: (_a = this.changes) === null || _a === void 0 ? void 0 : _a.toJSON(),\n mapped: (_b = this.mapped) === null || _b === void 0 ? void 0 : _b.toJSON(),\n startSelection: (_c = this.startSelection) === null || _c === void 0 ? void 0 : _c.toJSON(),\n selectionsAfter: this.selectionsAfter.map(s => s.toJSON())\n };\n }\n static fromJSON(json) {\n return new HistEvent(json.changes && _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.ChangeSet.fromJSON(json.changes), [], json.mapped && _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.ChangeDesc.fromJSON(json.mapped), json.startSelection && _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.fromJSON(json.startSelection), json.selectionsAfter.map(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.fromJSON));\n }\n // This does not check `addToHistory` and such, it assumes the\n // transaction needs to be converted to an item. Returns null when\n // there are no changes or effects in the transaction.\n static fromTransaction(tr, selection) {\n let effects = none;\n for (let invert of tr.startState.facet(invertedEffects)) {\n let result = invert(tr);\n if (result.length)\n effects = effects.concat(result);\n }\n if (!effects.length && tr.changes.empty)\n return null;\n return new HistEvent(tr.changes.invert(tr.startState.doc), effects, undefined, selection || tr.startState.selection, none);\n }\n static selection(selections) {\n return new HistEvent(undefined, none, undefined, undefined, selections);\n }\n}\nfunction updateBranch(branch, to, maxLen, newEvent) {\n let start = to + 1 > maxLen + 20 ? to - maxLen - 1 : 0;\n let newBranch = branch.slice(start, to);\n newBranch.push(newEvent);\n return newBranch;\n}\nfunction isAdjacent(a, b) {\n let ranges = [], isAdjacent = false;\n a.iterChangedRanges((f, t) => ranges.push(f, t));\n b.iterChangedRanges((_f, _t, f, t) => {\n for (let i = 0; i < ranges.length;) {\n let from = ranges[i++], to = ranges[i++];\n if (t >= from && f <= to)\n isAdjacent = true;\n }\n });\n return isAdjacent;\n}\nfunction eqSelectionShape(a, b) {\n return a.ranges.length == b.ranges.length &&\n a.ranges.filter((r, i) => r.empty != b.ranges[i].empty).length === 0;\n}\nfunction conc(a, b) {\n return !a.length ? b : !b.length ? a : a.concat(b);\n}\nconst none = [];\nconst MaxSelectionsPerEvent = 200;\nfunction addSelection(branch, selection) {\n if (!branch.length) {\n return [HistEvent.selection([selection])];\n }\n else {\n let lastEvent = branch[branch.length - 1];\n let sels = lastEvent.selectionsAfter.slice(Math.max(0, lastEvent.selectionsAfter.length - MaxSelectionsPerEvent));\n if (sels.length && sels[sels.length - 1].eq(selection))\n return branch;\n sels.push(selection);\n return updateBranch(branch, branch.length - 1, 1e9, lastEvent.setSelAfter(sels));\n }\n}\n// Assumes the top item has one or more selectionAfter values\nfunction popSelection(branch) {\n let last = branch[branch.length - 1];\n let newBranch = branch.slice();\n newBranch[branch.length - 1] = last.setSelAfter(last.selectionsAfter.slice(0, last.selectionsAfter.length - 1));\n return newBranch;\n}\n// Add a mapping to the top event in the given branch. If this maps\n// away all the changes and effects in that item, drop it and\n// propagate the mapping to the next item.\nfunction addMappingToBranch(branch, mapping) {\n if (!branch.length)\n return branch;\n let length = branch.length, selections = none;\n while (length) {\n let event = mapEvent(branch[length - 1], mapping, selections);\n if (event.changes && !event.changes.empty || event.effects.length) { // Event survived mapping\n let result = branch.slice(0, length);\n result[length - 1] = event;\n return result;\n }\n else { // Drop this event, since there\'s no changes or effects left\n mapping = event.mapped;\n length--;\n selections = event.selectionsAfter;\n }\n }\n return selections.length ? [HistEvent.selection(selections)] : none;\n}\nfunction mapEvent(event, mapping, extraSelections) {\n let selections = conc(event.selectionsAfter.length ? event.selectionsAfter.map(s => s.map(mapping)) : none, extraSelections);\n // Change-less events don\'t store mappings (they are always the last event in a branch)\n if (!event.changes)\n return HistEvent.selection(selections);\n let mappedChanges = event.changes.map(mapping), before = mapping.mapDesc(event.changes, true);\n let fullMapping = event.mapped ? event.mapped.composeDesc(before) : before;\n return new HistEvent(mappedChanges, _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.mapEffects(event.effects, mapping), fullMapping, event.startSelection.map(before), selections);\n}\nconst joinableUserEvent = /^(input\\.type|delete)($|\\.)/;\nclass HistoryState {\n constructor(done, undone, prevTime = 0, prevUserEvent = undefined) {\n this.done = done;\n this.undone = undone;\n this.prevTime = prevTime;\n this.prevUserEvent = prevUserEvent;\n }\n isolate() {\n return this.prevTime ? new HistoryState(this.done, this.undone) : this;\n }\n addChanges(event, time, userEvent, config, tr) {\n let done = this.done, lastEvent = done[done.length - 1];\n if (lastEvent && lastEvent.changes && !lastEvent.changes.empty && event.changes &&\n (!userEvent || joinableUserEvent.test(userEvent)) &&\n ((!lastEvent.selectionsAfter.length &&\n time - this.prevTime < config.newGroupDelay &&\n config.joinToEvent(tr, isAdjacent(lastEvent.changes, event.changes))) ||\n // For compose (but not compose.start) events, always join with previous event\n userEvent == "input.type.compose")) {\n done = updateBranch(done, done.length - 1, config.minDepth, new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none));\n }\n else {\n done = updateBranch(done, done.length, config.minDepth, event);\n }\n return new HistoryState(done, none, time, userEvent);\n }\n addSelection(selection, time, userEvent, newGroupDelay) {\n let last = this.done.length ? this.done[this.done.length - 1].selectionsAfter : none;\n if (last.length > 0 &&\n time - this.prevTime < newGroupDelay &&\n userEvent == this.prevUserEvent && userEvent && /^select($|\\.)/.test(userEvent) &&\n eqSelectionShape(last[last.length - 1], selection))\n return this;\n return new HistoryState(addSelection(this.done, selection), this.undone, time, userEvent);\n }\n addMapping(mapping) {\n return new HistoryState(addMappingToBranch(this.done, mapping), addMappingToBranch(this.undone, mapping), this.prevTime, this.prevUserEvent);\n }\n pop(side, state, onlySelection) {\n let branch = side == 0 /* BranchName.Done */ ? this.done : this.undone;\n if (branch.length == 0)\n return null;\n let event = branch[branch.length - 1], selection = event.selectionsAfter[0] || state.selection;\n if (onlySelection && event.selectionsAfter.length) {\n return state.update({\n selection: event.selectionsAfter[event.selectionsAfter.length - 1],\n annotations: fromHistory.of({ side, rest: popSelection(branch), selection }),\n userEvent: side == 0 /* BranchName.Done */ ? "select.undo" : "select.redo",\n scrollIntoView: true\n });\n }\n else if (!event.changes) {\n return null;\n }\n else {\n let rest = branch.length == 1 ? none : branch.slice(0, branch.length - 1);\n if (event.mapped)\n rest = addMappingToBranch(rest, event.mapped);\n return state.update({\n changes: event.changes,\n selection: event.startSelection,\n effects: event.effects,\n annotations: fromHistory.of({ side, rest, selection }),\n filter: false,\n userEvent: side == 0 /* BranchName.Done */ ? "undo" : "redo",\n scrollIntoView: true\n });\n }\n }\n}\nHistoryState.empty = /*@__PURE__*/new HistoryState(none, none);\n/**\nDefault key bindings for the undo history.\n\n- Mod-z: [`undo`](https://codemirror.net/6/docs/ref/#commands.undo).\n- Mod-y (Mod-Shift-z on macOS) + Ctrl-Shift-z on Linux: [`redo`](https://codemirror.net/6/docs/ref/#commands.redo).\n- Mod-u: [`undoSelection`](https://codemirror.net/6/docs/ref/#commands.undoSelection).\n- Alt-u (Mod-Shift-u on macOS): [`redoSelection`](https://codemirror.net/6/docs/ref/#commands.redoSelection).\n*/\nconst historyKeymap = [\n { key: "Mod-z", run: undo, preventDefault: true },\n { key: "Mod-y", mac: "Mod-Shift-z", run: redo, preventDefault: true },\n { linux: "Ctrl-Shift-z", run: redo, preventDefault: true },\n { key: "Mod-u", run: undoSelection, preventDefault: true },\n { key: "Alt-u", mac: "Mod-Shift-u", run: redoSelection, preventDefault: true }\n];\n\nfunction updateSel(sel, by) {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.create(sel.ranges.map(by), sel.mainIndex);\n}\nfunction setSel(state, selection) {\n return state.update({ selection, scrollIntoView: true, userEvent: "select" });\n}\nfunction moveSel({ state, dispatch }, how) {\n let selection = updateSel(state.selection, how);\n if (selection.eq(state.selection, true))\n return false;\n dispatch(setSel(state, selection));\n return true;\n}\nfunction rangeEnd(range, forward) {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(forward ? range.to : range.from);\n}\nfunction cursorByChar(view, forward) {\n return moveSel(view, range => range.empty ? view.moveByChar(range, forward) : rangeEnd(range, forward));\n}\nfunction ltrAtCursor(view) {\n return view.textDirectionAt(view.state.selection.main.head) == _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Direction.LTR;\n}\n/**\nMove the selection one character to the left (which is backward in\nleft-to-right text, forward in right-to-left text).\n*/\nconst cursorCharLeft = view => cursorByChar(view, !ltrAtCursor(view));\n/**\nMove the selection one character to the right.\n*/\nconst cursorCharRight = view => cursorByChar(view, ltrAtCursor(view));\n/**\nMove the selection one character forward.\n*/\nconst cursorCharForward = view => cursorByChar(view, true);\n/**\nMove the selection one character backward.\n*/\nconst cursorCharBackward = view => cursorByChar(view, false);\nfunction cursorByGroup(view, forward) {\n return moveSel(view, range => range.empty ? view.moveByGroup(range, forward) : rangeEnd(range, forward));\n}\n/**\nMove the selection to the left across one group of word or\nnon-word (but also non-space) characters.\n*/\nconst cursorGroupLeft = view => cursorByGroup(view, !ltrAtCursor(view));\n/**\nMove the selection one group to the right.\n*/\nconst cursorGroupRight = view => cursorByGroup(view, ltrAtCursor(view));\n/**\nMove the selection one group forward.\n*/\nconst cursorGroupForward = view => cursorByGroup(view, true);\n/**\nMove the selection one group backward.\n*/\nconst cursorGroupBackward = view => cursorByGroup(view, false);\nconst segmenter = typeof Intl != "undefined" && Intl.Segmenter ?\n /*@__PURE__*/new (Intl.Segmenter)(undefined, { granularity: "word" }) : null;\nfunction moveBySubword(view, range, forward) {\n let categorize = view.state.charCategorizer(range.from);\n let cat = _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Space, pos = range.from, steps = 0;\n let done = false, sawUpper = false, sawLower = false;\n let step = (next) => {\n if (done)\n return false;\n pos += forward ? next.length : -next.length;\n let nextCat = categorize(next), ahead;\n if (nextCat == _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word && next.charCodeAt(0) < 128 && /[\\W_]/.test(next))\n nextCat = -1; // Treat word punctuation specially\n if (cat == _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Space)\n cat = nextCat;\n if (cat != nextCat)\n return false;\n if (cat == _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word) {\n if (next.toLowerCase() == next) {\n if (!forward && sawUpper)\n return false;\n sawLower = true;\n }\n else if (sawLower) {\n if (forward)\n return false;\n done = true;\n }\n else {\n if (sawUpper && forward && categorize(ahead = view.state.sliceDoc(pos, pos + 1)) == _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word &&\n ahead.toLowerCase() == ahead)\n return false;\n sawUpper = true;\n }\n }\n steps++;\n return true;\n };\n let end = view.moveByChar(range, forward, start => {\n step(start);\n return step;\n });\n if (segmenter && cat == _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word && end.from == range.from + steps * (forward ? 1 : -1)) {\n let from = Math.min(range.head, end.head), to = Math.max(range.head, end.head);\n let skipped = view.state.sliceDoc(from, to);\n if (skipped.length > 1 && /[\\u4E00-\\uffff]/.test(skipped)) {\n let segments = Array.from(segmenter.segment(skipped));\n if (segments.length > 1) {\n if (forward)\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(range.head + segments[1].index, -1);\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(end.head + segments[segments.length - 1].index, 1);\n }\n }\n }\n return end;\n}\nfunction cursorBySubword(view, forward) {\n return moveSel(view, range => range.empty ? moveBySubword(view, range, forward) : rangeEnd(range, forward));\n}\n/**\nMove the selection one group or camel-case subword forward.\n*/\nconst cursorSubwordForward = view => cursorBySubword(view, true);\n/**\nMove the selection one group or camel-case subword backward.\n*/\nconst cursorSubwordBackward = view => cursorBySubword(view, false);\nfunction interestingNode(state, node, bracketProp) {\n if (node.type.prop(bracketProp))\n return true;\n let len = node.to - node.from;\n return len && (len > 2 || /[^\\s,.;:]/.test(state.sliceDoc(node.from, node.to))) || node.firstChild;\n}\nfunction moveBySyntax(state, start, forward) {\n let pos = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.syntaxTree)(state).resolveInner(start.head);\n let bracketProp = forward ? _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.closedBy : _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.openedBy;\n // Scan forward through child nodes to see if there\'s an interesting\n // node ahead.\n for (let at = start.head;;) {\n let next = forward ? pos.childAfter(at) : pos.childBefore(at);\n if (!next)\n break;\n if (interestingNode(state, next, bracketProp))\n pos = next;\n else\n at = forward ? next.to : next.from;\n }\n let bracket = pos.type.prop(bracketProp), match, newPos;\n if (bracket && (match = forward ? (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.matchBrackets)(state, pos.from, 1) : (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.matchBrackets)(state, pos.to, -1)) && match.matched)\n newPos = forward ? match.end.to : match.end.from;\n else\n newPos = forward ? pos.to : pos.from;\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(newPos, forward ? -1 : 1);\n}\n/**\nMove the cursor over the next syntactic element to the left.\n*/\nconst cursorSyntaxLeft = view => moveSel(view, range => moveBySyntax(view.state, range, !ltrAtCursor(view)));\n/**\nMove the cursor over the next syntactic element to the right.\n*/\nconst cursorSyntaxRight = view => moveSel(view, range => moveBySyntax(view.state, range, ltrAtCursor(view)));\nfunction cursorByLine(view, forward) {\n return moveSel(view, range => {\n if (!range.empty)\n return rangeEnd(range, forward);\n let moved = view.moveVertically(range, forward);\n return moved.head != range.head ? moved : view.moveToLineBoundary(range, forward);\n });\n}\n/**\nMove the selection one line up.\n*/\nconst cursorLineUp = view => cursorByLine(view, false);\n/**\nMove the selection one line down.\n*/\nconst cursorLineDown = view => cursorByLine(view, true);\nfunction pageInfo(view) {\n let selfScroll = view.scrollDOM.clientHeight < view.scrollDOM.scrollHeight - 2;\n let marginTop = 0, marginBottom = 0, height;\n if (selfScroll) {\n for (let source of view.state.facet(_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.scrollMargins)) {\n let margins = source(view);\n if (margins === null || margins === void 0 ? void 0 : margins.top)\n marginTop = Math.max(margins === null || margins === void 0 ? void 0 : margins.top, marginTop);\n if (margins === null || margins === void 0 ? void 0 : margins.bottom)\n marginBottom = Math.max(margins === null || margins === void 0 ? void 0 : margins.bottom, marginBottom);\n }\n height = view.scrollDOM.clientHeight - marginTop - marginBottom;\n }\n else {\n height = (view.dom.ownerDocument.defaultView || window).innerHeight;\n }\n return { marginTop, marginBottom, selfScroll,\n height: Math.max(view.defaultLineHeight, height - 5) };\n}\nfunction cursorByPage(view, forward) {\n let page = pageInfo(view);\n let { state } = view, selection = updateSel(state.selection, range => {\n return range.empty ? view.moveVertically(range, forward, page.height)\n : rangeEnd(range, forward);\n });\n if (selection.eq(state.selection))\n return false;\n let effect;\n if (page.selfScroll) {\n let startPos = view.coordsAtPos(state.selection.main.head);\n let scrollRect = view.scrollDOM.getBoundingClientRect();\n let scrollTop = scrollRect.top + page.marginTop, scrollBottom = scrollRect.bottom - page.marginBottom;\n if (startPos && startPos.top > scrollTop && startPos.bottom < scrollBottom)\n effect = _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.scrollIntoView(selection.main.head, { y: "start", yMargin: startPos.top - scrollTop });\n }\n view.dispatch(setSel(state, selection), { effects: effect });\n return true;\n}\n/**\nMove the selection one page up.\n*/\nconst cursorPageUp = view => cursorByPage(view, false);\n/**\nMove the selection one page down.\n*/\nconst cursorPageDown = view => cursorByPage(view, true);\nfunction moveByLineBoundary(view, start, forward) {\n let line = view.lineBlockAt(start.head), moved = view.moveToLineBoundary(start, forward);\n if (moved.head == start.head && moved.head != (forward ? line.to : line.from))\n moved = view.moveToLineBoundary(start, forward, false);\n if (!forward && moved.head == line.from && line.length) {\n let space = /^\\s*/.exec(view.state.sliceDoc(line.from, Math.min(line.from + 100, line.to)))[0].length;\n if (space && start.head != line.from + space)\n moved = _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(line.from + space);\n }\n return moved;\n}\n/**\nMove the selection to the next line wrap point, or to the end of\nthe line if there isn\'t one left on this line.\n*/\nconst cursorLineBoundaryForward = view => moveSel(view, range => moveByLineBoundary(view, range, true));\n/**\nMove the selection to previous line wrap point, or failing that to\nthe start of the line. If the line is indented, and the cursor\nisn\'t already at the end of the indentation, this will move to the\nend of the indentation instead of the start of the line.\n*/\nconst cursorLineBoundaryBackward = view => moveSel(view, range => moveByLineBoundary(view, range, false));\n/**\nMove the selection one line wrap point to the left.\n*/\nconst cursorLineBoundaryLeft = view => moveSel(view, range => moveByLineBoundary(view, range, !ltrAtCursor(view)));\n/**\nMove the selection one line wrap point to the right.\n*/\nconst cursorLineBoundaryRight = view => moveSel(view, range => moveByLineBoundary(view, range, ltrAtCursor(view)));\n/**\nMove the selection to the start of the line.\n*/\nconst cursorLineStart = view => moveSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(view.lineBlockAt(range.head).from, 1));\n/**\nMove the selection to the end of the line.\n*/\nconst cursorLineEnd = view => moveSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(view.lineBlockAt(range.head).to, -1));\nfunction toMatchingBracket(state, dispatch, extend) {\n let found = false, selection = updateSel(state.selection, range => {\n let matching = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.matchBrackets)(state, range.head, -1)\n || (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.matchBrackets)(state, range.head, 1)\n || (range.head > 0 && (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.matchBrackets)(state, range.head - 1, 1))\n || (range.head < state.doc.length && (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.matchBrackets)(state, range.head + 1, -1));\n if (!matching || !matching.end)\n return range;\n found = true;\n let head = matching.start.from == range.head ? matching.end.to : matching.end.from;\n return extend ? _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(range.anchor, head) : _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(head);\n });\n if (!found)\n return false;\n dispatch(setSel(state, selection));\n return true;\n}\n/**\nMove the selection to the bracket matching the one it is currently\non, if any.\n*/\nconst cursorMatchingBracket = ({ state, dispatch }) => toMatchingBracket(state, dispatch, false);\n/**\nExtend the selection to the bracket matching the one the selection\nhead is currently on, if any.\n*/\nconst selectMatchingBracket = ({ state, dispatch }) => toMatchingBracket(state, dispatch, true);\nfunction extendSel(view, how) {\n let selection = updateSel(view.state.selection, range => {\n let head = how(range);\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);\n });\n if (selection.eq(view.state.selection))\n return false;\n view.dispatch(setSel(view.state, selection));\n return true;\n}\nfunction selectByChar(view, forward) {\n return extendSel(view, range => view.moveByChar(range, forward));\n}\n/**\nMove the selection head one character to the left, while leaving\nthe anchor in place.\n*/\nconst selectCharLeft = view => selectByChar(view, !ltrAtCursor(view));\n/**\nMove the selection head one character to the right.\n*/\nconst selectCharRight = view => selectByChar(view, ltrAtCursor(view));\n/**\nMove the selection head one character forward.\n*/\nconst selectCharForward = view => selectByChar(view, true);\n/**\nMove the selection head one character backward.\n*/\nconst selectCharBackward = view => selectByChar(view, false);\nfunction selectByGroup(view, forward) {\n return extendSel(view, range => view.moveByGroup(range, forward));\n}\n/**\nMove the selection head one [group](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) to\nthe left.\n*/\nconst selectGroupLeft = view => selectByGroup(view, !ltrAtCursor(view));\n/**\nMove the selection head one group to the right.\n*/\nconst selectGroupRight = view => selectByGroup(view, ltrAtCursor(view));\n/**\nMove the selection head one group forward.\n*/\nconst selectGroupForward = view => selectByGroup(view, true);\n/**\nMove the selection head one group backward.\n*/\nconst selectGroupBackward = view => selectByGroup(view, false);\nfunction selectBySubword(view, forward) {\n return extendSel(view, range => moveBySubword(view, range, forward));\n}\n/**\nMove the selection head one group or camel-case subword forward.\n*/\nconst selectSubwordForward = view => selectBySubword(view, true);\n/**\nMove the selection head one group or subword backward.\n*/\nconst selectSubwordBackward = view => selectBySubword(view, false);\n/**\nMove the selection head over the next syntactic element to the left.\n*/\nconst selectSyntaxLeft = view => extendSel(view, range => moveBySyntax(view.state, range, !ltrAtCursor(view)));\n/**\nMove the selection head over the next syntactic element to the right.\n*/\nconst selectSyntaxRight = view => extendSel(view, range => moveBySyntax(view.state, range, ltrAtCursor(view)));\nfunction selectByLine(view, forward) {\n return extendSel(view, range => view.moveVertically(range, forward));\n}\n/**\nMove the selection head one line up.\n*/\nconst selectLineUp = view => selectByLine(view, false);\n/**\nMove the selection head one line down.\n*/\nconst selectLineDown = view => selectByLine(view, true);\nfunction selectByPage(view, forward) {\n return extendSel(view, range => view.moveVertically(range, forward, pageInfo(view).height));\n}\n/**\nMove the selection head one page up.\n*/\nconst selectPageUp = view => selectByPage(view, false);\n/**\nMove the selection head one page down.\n*/\nconst selectPageDown = view => selectByPage(view, true);\n/**\nMove the selection head to the next line boundary.\n*/\nconst selectLineBoundaryForward = view => extendSel(view, range => moveByLineBoundary(view, range, true));\n/**\nMove the selection head to the previous line boundary.\n*/\nconst selectLineBoundaryBackward = view => extendSel(view, range => moveByLineBoundary(view, range, false));\n/**\nMove the selection head one line boundary to the left.\n*/\nconst selectLineBoundaryLeft = view => extendSel(view, range => moveByLineBoundary(view, range, !ltrAtCursor(view)));\n/**\nMove the selection head one line boundary to the right.\n*/\nconst selectLineBoundaryRight = view => extendSel(view, range => moveByLineBoundary(view, range, ltrAtCursor(view)));\n/**\nMove the selection head to the start of the line.\n*/\nconst selectLineStart = view => extendSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(view.lineBlockAt(range.head).from));\n/**\nMove the selection head to the end of the line.\n*/\nconst selectLineEnd = view => extendSel(view, range => _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(view.lineBlockAt(range.head).to));\n/**\nMove the selection to the start of the document.\n*/\nconst cursorDocStart = ({ state, dispatch }) => {\n dispatch(setSel(state, { anchor: 0 }));\n return true;\n};\n/**\nMove the selection to the end of the document.\n*/\nconst cursorDocEnd = ({ state, dispatch }) => {\n dispatch(setSel(state, { anchor: state.doc.length }));\n return true;\n};\n/**\nMove the selection head to the start of the document.\n*/\nconst selectDocStart = ({ state, dispatch }) => {\n dispatch(setSel(state, { anchor: state.selection.main.anchor, head: 0 }));\n return true;\n};\n/**\nMove the selection head to the end of the document.\n*/\nconst selectDocEnd = ({ state, dispatch }) => {\n dispatch(setSel(state, { anchor: state.selection.main.anchor, head: state.doc.length }));\n return true;\n};\n/**\nSelect the entire document.\n*/\nconst selectAll = ({ state, dispatch }) => {\n dispatch(state.update({ selection: { anchor: 0, head: state.doc.length }, userEvent: "select" }));\n return true;\n};\n/**\nExpand the selection to cover entire lines.\n*/\nconst selectLine = ({ state, dispatch }) => {\n let ranges = selectedLineBlocks(state).map(({ from, to }) => _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(from, Math.min(to + 1, state.doc.length)));\n dispatch(state.update({ selection: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.create(ranges), userEvent: "select" }));\n return true;\n};\n/**\nSelect the next syntactic construct that is larger than the\nselection. Note that this will only work insofar as the language\n[provider](https://codemirror.net/6/docs/ref/#language.language) you use builds up a full\nsyntax tree.\n*/\nconst selectParentSyntax = ({ state, dispatch }) => {\n let selection = updateSel(state.selection, range => {\n var _a;\n let stack = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.syntaxTree)(state).resolveStack(range.from, 1);\n for (let cur = stack; cur; cur = cur.next) {\n let { node } = cur;\n if (((node.from < range.from && node.to >= range.to) ||\n (node.to > range.to && node.from <= range.from)) &&\n ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent))\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(node.to, node.from);\n }\n return range;\n });\n dispatch(setSel(state, selection));\n return true;\n};\n/**\nSimplify the current selection. When multiple ranges are selected,\nreduce it to its main range. Otherwise, if the selection is\nnon-empty, convert it to a cursor selection.\n*/\nconst simplifySelection = ({ state, dispatch }) => {\n let cur = state.selection, selection = null;\n if (cur.ranges.length > 1)\n selection = _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.create([cur.main]);\n else if (!cur.main.empty)\n selection = _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.create([_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(cur.main.head)]);\n if (!selection)\n return false;\n dispatch(setSel(state, selection));\n return true;\n};\nfunction deleteBy(target, by) {\n if (target.state.readOnly)\n return false;\n let event = "delete.selection", { state } = target;\n let changes = state.changeByRange(range => {\n let { from, to } = range;\n if (from == to) {\n let towards = by(range);\n if (towards < from) {\n event = "delete.backward";\n towards = skipAtomic(target, towards, false);\n }\n else if (towards > from) {\n event = "delete.forward";\n towards = skipAtomic(target, towards, true);\n }\n from = Math.min(from, towards);\n to = Math.max(to, towards);\n }\n else {\n from = skipAtomic(target, from, false);\n to = skipAtomic(target, to, true);\n }\n return from == to ? { range } : { changes: { from, to }, range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(from, from < range.head ? -1 : 1) };\n });\n if (changes.changes.empty)\n return false;\n target.dispatch(state.update(changes, {\n scrollIntoView: true,\n userEvent: event,\n effects: event == "delete.selection" ? _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.announce.of(state.phrase("Selection deleted")) : undefined\n }));\n return true;\n}\nfunction skipAtomic(target, pos, forward) {\n if (target instanceof _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView)\n for (let ranges of target.state.facet(_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.atomicRanges).map(f => f(target)))\n ranges.between(pos, pos, (from, to) => {\n if (from < pos && to > pos)\n pos = forward ? to : from;\n });\n return pos;\n}\nconst deleteByChar = (target, forward, byIndentUnit) => deleteBy(target, range => {\n let pos = range.from, { state } = target, line = state.doc.lineAt(pos), before, targetPos;\n if (byIndentUnit && !forward && pos > line.from && pos < line.from + 200 &&\n !/[^ \\t]/.test(before = line.text.slice(0, pos - line.from))) {\n if (before[before.length - 1] == "\\t")\n return pos - 1;\n let col = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.countColumn)(before, state.tabSize), drop = col % (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.getIndentUnit)(state) || (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.getIndentUnit)(state);\n for (let i = 0; i < drop && before[before.length - 1 - i] == " "; i++)\n pos--;\n targetPos = pos;\n }\n else {\n targetPos = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.findClusterBreak)(line.text, pos - line.from, forward, forward) + line.from;\n if (targetPos == pos && line.number != (forward ? state.doc.lines : 1))\n targetPos += forward ? 1 : -1;\n else if (!forward && /[\\ufe00-\\ufe0f]/.test(line.text.slice(targetPos - line.from, pos - line.from)))\n targetPos = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.findClusterBreak)(line.text, targetPos - line.from, false, false) + line.from;\n }\n return targetPos;\n});\n/**\nDelete the selection, or, for cursor selections, the character or\nindentation unit before the cursor.\n*/\nconst deleteCharBackward = view => deleteByChar(view, false, true);\n/**\nDelete the selection or the character before the cursor. Does not\nimplement any extended behavior like deleting whole indentation\nunits in one go.\n*/\nconst deleteCharBackwardStrict = view => deleteByChar(view, false, false);\n/**\nDelete the selection or the character after the cursor.\n*/\nconst deleteCharForward = view => deleteByChar(view, true, false);\nconst deleteByGroup = (target, forward) => deleteBy(target, range => {\n let pos = range.head, { state } = target, line = state.doc.lineAt(pos);\n let categorize = state.charCategorizer(pos);\n for (let cat = null;;) {\n if (pos == (forward ? line.to : line.from)) {\n if (pos == range.head && line.number != (forward ? state.doc.lines : 1))\n pos += forward ? 1 : -1;\n break;\n }\n let next = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.findClusterBreak)(line.text, pos - line.from, forward) + line.from;\n let nextChar = line.text.slice(Math.min(pos, next) - line.from, Math.max(pos, next) - line.from);\n let nextCat = categorize(nextChar);\n if (cat != null && nextCat != cat)\n break;\n if (nextChar != " " || pos != range.head)\n cat = nextCat;\n pos = next;\n }\n return pos;\n});\n/**\nDelete the selection or backward until the end of the next\n[group](https://codemirror.net/6/docs/ref/#view.EditorView.moveByGroup), only skipping groups of\nwhitespace when they consist of a single space.\n*/\nconst deleteGroupBackward = target => deleteByGroup(target, false);\n/**\nDelete the selection or forward until the end of the next group.\n*/\nconst deleteGroupForward = target => deleteByGroup(target, true);\n/**\nDelete the selection, or, if it is a cursor selection, delete to\nthe end of the line. If the cursor is directly at the end of the\nline, delete the line break after it.\n*/\nconst deleteToLineEnd = view => deleteBy(view, range => {\n let lineEnd = view.lineBlockAt(range.head).to;\n return range.head < lineEnd ? lineEnd : Math.min(view.state.doc.length, range.head + 1);\n});\n/**\nDelete the selection, or, if it is a cursor selection, delete to\nthe start of the line. If the cursor is directly at the start of the\nline, delete the line break before it.\n*/\nconst deleteToLineStart = view => deleteBy(view, range => {\n let lineStart = view.lineBlockAt(range.head).from;\n return range.head > lineStart ? lineStart : Math.max(0, range.head - 1);\n});\n/**\nDelete the selection, or, if it is a cursor selection, delete to\nthe start of the line or the next line wrap before the cursor.\n*/\nconst deleteLineBoundaryBackward = view => deleteBy(view, range => {\n let lineStart = view.moveToLineBoundary(range, false).head;\n return range.head > lineStart ? lineStart : Math.max(0, range.head - 1);\n});\n/**\nDelete the selection, or, if it is a cursor selection, delete to\nthe end of the line or the next line wrap after the cursor.\n*/\nconst deleteLineBoundaryForward = view => deleteBy(view, range => {\n let lineStart = view.moveToLineBoundary(range, true).head;\n return range.head < lineStart ? lineStart : Math.min(view.state.doc.length, range.head + 1);\n});\n/**\nDelete all whitespace directly before a line end from the\ndocument.\n*/\nconst deleteTrailingWhitespace = ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n let changes = [];\n for (let pos = 0, prev = "", iter = state.doc.iter();;) {\n iter.next();\n if (iter.lineBreak || iter.done) {\n let trailing = prev.search(/\\s+$/);\n if (trailing > -1)\n changes.push({ from: pos - (prev.length - trailing), to: pos });\n if (iter.done)\n break;\n prev = "";\n }\n else {\n prev = iter.value;\n }\n pos += iter.value.length;\n }\n if (!changes.length)\n return false;\n dispatch(state.update({ changes, userEvent: "delete" }));\n return true;\n};\n/**\nReplace each selection range with a line break, leaving the cursor\non the line before the break.\n*/\nconst splitLine = ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n let changes = state.changeByRange(range => {\n return { changes: { from: range.from, to: range.to, insert: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Text.of(["", ""]) },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(range.from) };\n });\n dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" }));\n return true;\n};\n/**\nFlip the characters before and after the cursor(s).\n*/\nconst transposeChars = ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n let changes = state.changeByRange(range => {\n if (!range.empty || range.from == 0 || range.from == state.doc.length)\n return { range };\n let pos = range.from, line = state.doc.lineAt(pos);\n let from = pos == line.from ? pos - 1 : (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.findClusterBreak)(line.text, pos - line.from, false) + line.from;\n let to = pos == line.to ? pos + 1 : (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.findClusterBreak)(line.text, pos - line.from, true) + line.from;\n return { changes: { from, to, insert: state.doc.slice(pos, to).append(state.doc.slice(from, pos)) },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(to) };\n });\n if (changes.changes.empty)\n return false;\n dispatch(state.update(changes, { scrollIntoView: true, userEvent: "move.character" }));\n return true;\n};\nfunction selectedLineBlocks(state) {\n let blocks = [], upto = -1;\n for (let range of state.selection.ranges) {\n let startLine = state.doc.lineAt(range.from), endLine = state.doc.lineAt(range.to);\n if (!range.empty && range.to == endLine.from)\n endLine = state.doc.lineAt(range.to - 1);\n if (upto >= startLine.number) {\n let prev = blocks[blocks.length - 1];\n prev.to = endLine.to;\n prev.ranges.push(range);\n }\n else {\n blocks.push({ from: startLine.from, to: endLine.to, ranges: [range] });\n }\n upto = endLine.number + 1;\n }\n return blocks;\n}\nfunction moveLine(state, dispatch, forward) {\n if (state.readOnly)\n return false;\n let changes = [], ranges = [];\n for (let block of selectedLineBlocks(state)) {\n if (forward ? block.to == state.doc.length : block.from == 0)\n continue;\n let nextLine = state.doc.lineAt(forward ? block.to + 1 : block.from - 1);\n let size = nextLine.length + 1;\n if (forward) {\n changes.push({ from: block.to, to: nextLine.to }, { from: block.from, insert: nextLine.text + state.lineBreak });\n for (let r of block.ranges)\n ranges.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(Math.min(state.doc.length, r.anchor + size), Math.min(state.doc.length, r.head + size)));\n }\n else {\n changes.push({ from: nextLine.from, to: block.from }, { from: block.to, insert: state.lineBreak + nextLine.text });\n for (let r of block.ranges)\n ranges.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(r.anchor - size, r.head - size));\n }\n }\n if (!changes.length)\n return false;\n dispatch(state.update({\n changes,\n scrollIntoView: true,\n selection: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.create(ranges, state.selection.mainIndex),\n userEvent: "move.line"\n }));\n return true;\n}\n/**\nMove the selected lines up one line.\n*/\nconst moveLineUp = ({ state, dispatch }) => moveLine(state, dispatch, false);\n/**\nMove the selected lines down one line.\n*/\nconst moveLineDown = ({ state, dispatch }) => moveLine(state, dispatch, true);\nfunction copyLine(state, dispatch, forward) {\n if (state.readOnly)\n return false;\n let changes = [];\n for (let block of selectedLineBlocks(state)) {\n if (forward)\n changes.push({ from: block.from, insert: state.doc.slice(block.from, block.to) + state.lineBreak });\n else\n changes.push({ from: block.to, insert: state.lineBreak + state.doc.slice(block.from, block.to) });\n }\n dispatch(state.update({ changes, scrollIntoView: true, userEvent: "input.copyline" }));\n return true;\n}\n/**\nCreate a copy of the selected lines. Keep the selection in the top copy.\n*/\nconst copyLineUp = ({ state, dispatch }) => copyLine(state, dispatch, false);\n/**\nCreate a copy of the selected lines. Keep the selection in the bottom copy.\n*/\nconst copyLineDown = ({ state, dispatch }) => copyLine(state, dispatch, true);\n/**\nDelete selected lines.\n*/\nconst deleteLine = view => {\n if (view.state.readOnly)\n return false;\n let { state } = view, changes = state.changes(selectedLineBlocks(state).map(({ from, to }) => {\n if (from > 0)\n from--;\n else if (to < state.doc.length)\n to++;\n return { from, to };\n }));\n let selection = updateSel(state.selection, range => {\n let dist = undefined;\n if (view.lineWrapping) {\n let block = view.lineBlockAt(range.head), pos = view.coordsAtPos(range.head, range.assoc || 1);\n if (pos)\n dist = (block.bottom + view.documentTop) - pos.bottom + view.defaultLineHeight / 2;\n }\n return view.moveVertically(range, true, dist);\n }).map(changes);\n view.dispatch({ changes, selection, scrollIntoView: true, userEvent: "delete.line" });\n return true;\n};\n/**\nReplace the selection with a newline.\n*/\nconst insertNewline = ({ state, dispatch }) => {\n dispatch(state.update(state.replaceSelection(state.lineBreak), { scrollIntoView: true, userEvent: "input" }));\n return true;\n};\n/**\nReplace the selection with a newline and the same amount of\nindentation as the line above.\n*/\nconst insertNewlineKeepIndent = ({ state, dispatch }) => {\n dispatch(state.update(state.changeByRange(range => {\n let indent = /^\\s*/.exec(state.doc.lineAt(range.from).text)[0];\n return {\n changes: { from: range.from, to: range.to, insert: state.lineBreak + indent },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(range.from + indent.length + 1)\n };\n }), { scrollIntoView: true, userEvent: "input" }));\n return true;\n};\nfunction isBetweenBrackets(state, pos) {\n if (/\\(\\)|\\[\\]|\\{\\}/.test(state.sliceDoc(pos - 1, pos + 1)))\n return { from: pos, to: pos };\n let context = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.syntaxTree)(state).resolveInner(pos);\n let before = context.childBefore(pos), after = context.childAfter(pos), closedBy;\n if (before && after && before.to <= pos && after.from >= pos &&\n (closedBy = before.type.prop(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.closedBy)) && closedBy.indexOf(after.name) > -1 &&\n state.doc.lineAt(before.to).from == state.doc.lineAt(after.from).from &&\n !/\\S/.test(state.sliceDoc(before.to, after.from)))\n return { from: before.to, to: after.from };\n return null;\n}\n/**\nReplace the selection with a newline and indent the newly created\nline(s). If the current line consists only of whitespace, this\nwill also delete that whitespace. When the cursor is between\nmatching brackets, an additional newline will be inserted after\nthe cursor.\n*/\nconst insertNewlineAndIndent = /*@__PURE__*/newlineAndIndent(false);\n/**\nCreate a blank, indented line below the current line.\n*/\nconst insertBlankLine = /*@__PURE__*/newlineAndIndent(true);\nfunction newlineAndIndent(atEof) {\n return ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n let changes = state.changeByRange(range => {\n let { from, to } = range, line = state.doc.lineAt(from);\n let explode = !atEof && from == to && isBetweenBrackets(state, from);\n if (atEof)\n from = to = (to <= line.to ? line : state.doc.lineAt(to)).to;\n let cx = new _codemirror_language__WEBPACK_IMPORTED_MODULE_3__.IndentContext(state, { simulateBreak: from, simulateDoubleBreak: !!explode });\n let indent = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.getIndentation)(cx, from);\n if (indent == null)\n indent = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.countColumn)(/^\\s*/.exec(state.doc.lineAt(from).text)[0], state.tabSize);\n while (to < line.to && /\\s/.test(line.text[to - line.from]))\n to++;\n if (explode)\n ({ from, to } = explode);\n else if (from > line.from && from < line.from + 100 && !/\\S/.test(line.text.slice(0, from)))\n from = line.from;\n let insert = ["", (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.indentString)(state, indent)];\n if (explode)\n insert.push((0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.indentString)(state, cx.lineIndent(line.from, -1)));\n return { changes: { from, to, insert: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Text.of(insert) },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(from + 1 + insert[1].length) };\n });\n dispatch(state.update(changes, { scrollIntoView: true, userEvent: "input" }));\n return true;\n };\n}\nfunction changeBySelectedLine(state, f) {\n let atLine = -1;\n return state.changeByRange(range => {\n let changes = [];\n for (let pos = range.from; pos <= range.to;) {\n let line = state.doc.lineAt(pos);\n if (line.number > atLine && (range.empty || range.to > line.from)) {\n f(line, changes, range);\n atLine = line.number;\n }\n pos = line.to + 1;\n }\n let changeSet = state.changes(changes);\n return { changes,\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(changeSet.mapPos(range.anchor, 1), changeSet.mapPos(range.head, 1)) };\n });\n}\n/**\nAuto-indent the selected lines. This uses the [indentation service\nfacet](https://codemirror.net/6/docs/ref/#language.indentService) as source for auto-indent\ninformation.\n*/\nconst indentSelection = ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n let updated = Object.create(null);\n let context = new _codemirror_language__WEBPACK_IMPORTED_MODULE_3__.IndentContext(state, { overrideIndentation: start => {\n let found = updated[start];\n return found == null ? -1 : found;\n } });\n let changes = changeBySelectedLine(state, (line, changes, range) => {\n let indent = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.getIndentation)(context, line.from);\n if (indent == null)\n return;\n if (!/\\S/.test(line.text))\n indent = 0;\n let cur = /^\\s*/.exec(line.text)[0];\n let norm = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.indentString)(state, indent);\n if (cur != norm || range.from < line.from + cur.length) {\n updated[line.from] = indent;\n changes.push({ from: line.from, to: line.from + cur.length, insert: norm });\n }\n });\n if (!changes.changes.empty)\n dispatch(state.update(changes, { userEvent: "indent" }));\n return true;\n};\n/**\nAdd a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation to all selected\nlines.\n*/\nconst indentMore = ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n dispatch(state.update(changeBySelectedLine(state, (line, changes) => {\n changes.push({ from: line.from, insert: state.facet(_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.indentUnit) });\n }), { userEvent: "input.indent" }));\n return true;\n};\n/**\nRemove a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation from all\nselected lines.\n*/\nconst indentLess = ({ state, dispatch }) => {\n if (state.readOnly)\n return false;\n dispatch(state.update(changeBySelectedLine(state, (line, changes) => {\n let space = /^\\s*/.exec(line.text)[0];\n if (!space)\n return;\n let col = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.countColumn)(space, state.tabSize), keep = 0;\n let insert = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.indentString)(state, Math.max(0, col - (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.getIndentUnit)(state)));\n while (keep < space.length && keep < insert.length && space.charCodeAt(keep) == insert.charCodeAt(keep))\n keep++;\n changes.push({ from: line.from + keep, to: line.from + space.length, insert: insert.slice(keep) });\n }), { userEvent: "delete.dedent" }));\n return true;\n};\n/**\nEnables or disables\n[tab-focus mode](https://codemirror.net/6/docs/ref/#view.EditorView.setTabFocusMode). While on, this\nprevents the editor\'s key bindings from capturing Tab or\nShift-Tab, making it possible for the user to move focus out of\nthe editor with the keyboard.\n*/\nconst toggleTabFocusMode = view => {\n view.setTabFocusMode();\n return true;\n};\n/**\nTemporarily enables [tab-focus\nmode](https://codemirror.net/6/docs/ref/#view.EditorView.setTabFocusMode) for two seconds or until\nanother key is pressed.\n*/\nconst temporarilySetTabFocusMode = view => {\n view.setTabFocusMode(2000);\n return true;\n};\n/**\nInsert a tab character at the cursor or, if something is selected,\nuse [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) to indent the entire\nselection.\n*/\nconst insertTab = ({ state, dispatch }) => {\n if (state.selection.ranges.some(r => !r.empty))\n return indentMore({ state, dispatch });\n dispatch(state.update(state.replaceSelection("\\t"), { scrollIntoView: true, userEvent: "input" }));\n return true;\n};\n/**\nArray of key bindings containing the Emacs-style bindings that are\navailable on macOS by default.\n\n - Ctrl-b: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)\n - Ctrl-f: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)\n - Ctrl-p: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)\n - Ctrl-n: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)\n - Ctrl-a: [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)\n - Ctrl-e: [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)\n - Ctrl-d: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)\n - Ctrl-h: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)\n - Ctrl-k: [`deleteToLineEnd`](https://codemirror.net/6/docs/ref/#commands.deleteToLineEnd)\n - Ctrl-Alt-h: [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)\n - Ctrl-o: [`splitLine`](https://codemirror.net/6/docs/ref/#commands.splitLine)\n - Ctrl-t: [`transposeChars`](https://codemirror.net/6/docs/ref/#commands.transposeChars)\n - Ctrl-v: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown)\n - Alt-v: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp)\n*/\nconst emacsStyleKeymap = [\n { key: "Ctrl-b", run: cursorCharLeft, shift: selectCharLeft, preventDefault: true },\n { key: "Ctrl-f", run: cursorCharRight, shift: selectCharRight },\n { key: "Ctrl-p", run: cursorLineUp, shift: selectLineUp },\n { key: "Ctrl-n", run: cursorLineDown, shift: selectLineDown },\n { key: "Ctrl-a", run: cursorLineStart, shift: selectLineStart },\n { key: "Ctrl-e", run: cursorLineEnd, shift: selectLineEnd },\n { key: "Ctrl-d", run: deleteCharForward },\n { key: "Ctrl-h", run: deleteCharBackward },\n { key: "Ctrl-k", run: deleteToLineEnd },\n { key: "Ctrl-Alt-h", run: deleteGroupBackward },\n { key: "Ctrl-o", run: splitLine },\n { key: "Ctrl-t", run: transposeChars },\n { key: "Ctrl-v", run: cursorPageDown },\n];\n/**\nAn array of key bindings closely sticking to platform-standard or\nwidely used bindings. (This includes the bindings from\n[`emacsStyleKeymap`](https://codemirror.net/6/docs/ref/#commands.emacsStyleKeymap), with their `key`\nproperty changed to `mac`.)\n\n - ArrowLeft: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)\n - ArrowRight: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)\n - Ctrl-ArrowLeft (Alt-ArrowLeft on macOS): [`cursorGroupLeft`](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) ([`selectGroupLeft`](https://codemirror.net/6/docs/ref/#commands.selectGroupLeft) with Shift)\n - Ctrl-ArrowRight (Alt-ArrowRight on macOS): [`cursorGroupRight`](https://codemirror.net/6/docs/ref/#commands.cursorGroupRight) ([`selectGroupRight`](https://codemirror.net/6/docs/ref/#commands.selectGroupRight) with Shift)\n - Cmd-ArrowLeft (on macOS): [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)\n - Cmd-ArrowRight (on macOS): [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)\n - ArrowUp: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)\n - ArrowDown: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)\n - Cmd-ArrowUp (on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)\n - Cmd-ArrowDown (on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)\n - Ctrl-ArrowUp (on macOS): [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)\n - Ctrl-ArrowDown (on macOS): [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)\n - PageUp: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)\n - PageDown: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)\n - Home: [`cursorLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryBackward) ([`selectLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryBackward) with Shift)\n - End: [`cursorLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryForward) ([`selectLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryForward) with Shift)\n - Ctrl-Home (Cmd-Home on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)\n - Ctrl-End (Cmd-Home on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)\n - Enter: [`insertNewlineAndIndent`](https://codemirror.net/6/docs/ref/#commands.insertNewlineAndIndent)\n - Ctrl-a (Cmd-a on macOS): [`selectAll`](https://codemirror.net/6/docs/ref/#commands.selectAll)\n - Backspace: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)\n - Delete: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)\n - Ctrl-Backspace (Alt-Backspace on macOS): [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)\n - Ctrl-Delete (Alt-Delete on macOS): [`deleteGroupForward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupForward)\n - Cmd-Backspace (macOS): [`deleteLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryBackward).\n - Cmd-Delete (macOS): [`deleteLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryForward).\n*/\nconst standardKeymap = /*@__PURE__*/[\n { key: "ArrowLeft", run: cursorCharLeft, shift: selectCharLeft, preventDefault: true },\n { key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: cursorGroupLeft, shift: selectGroupLeft, preventDefault: true },\n { mac: "Cmd-ArrowLeft", run: cursorLineBoundaryLeft, shift: selectLineBoundaryLeft, preventDefault: true },\n { key: "ArrowRight", run: cursorCharRight, shift: selectCharRight, preventDefault: true },\n { key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: cursorGroupRight, shift: selectGroupRight, preventDefault: true },\n { mac: "Cmd-ArrowRight", run: cursorLineBoundaryRight, shift: selectLineBoundaryRight, preventDefault: true },\n { key: "ArrowUp", run: cursorLineUp, shift: selectLineUp, preventDefault: true },\n { mac: "Cmd-ArrowUp", run: cursorDocStart, shift: selectDocStart },\n { mac: "Ctrl-ArrowUp", run: cursorPageUp, shift: selectPageUp },\n { key: "ArrowDown", run: cursorLineDown, shift: selectLineDown, preventDefault: true },\n { mac: "Cmd-ArrowDown", run: cursorDocEnd, shift: selectDocEnd },\n { mac: "Ctrl-ArrowDown", run: cursorPageDown, shift: selectPageDown },\n { key: "PageUp", run: cursorPageUp, shift: selectPageUp },\n { key: "PageDown", run: cursorPageDown, shift: selectPageDown },\n { key: "Home", run: cursorLineBoundaryBackward, shift: selectLineBoundaryBackward, preventDefault: true },\n { key: "Mod-Home", run: cursorDocStart, shift: selectDocStart },\n { key: "End", run: cursorLineBoundaryForward, shift: selectLineBoundaryForward, preventDefault: true },\n { key: "Mod-End", run: cursorDocEnd, shift: selectDocEnd },\n { key: "Enter", run: insertNewlineAndIndent },\n { key: "Mod-a", run: selectAll },\n { key: "Backspace", run: deleteCharBackward, shift: deleteCharBackward },\n { key: "Delete", run: deleteCharForward },\n { key: "Mod-Backspace", mac: "Alt-Backspace", run: deleteGroupBackward },\n { key: "Mod-Delete", mac: "Alt-Delete", run: deleteGroupForward },\n { mac: "Mod-Backspace", run: deleteLineBoundaryBackward },\n { mac: "Mod-Delete", run: deleteLineBoundaryForward }\n].concat(/*@__PURE__*/emacsStyleKeymap.map(b => ({ mac: b.key, run: b.run, shift: b.shift })));\n/**\nThe default keymap. Includes all bindings from\n[`standardKeymap`](https://codemirror.net/6/docs/ref/#commands.standardKeymap) plus the following:\n\n- Alt-ArrowLeft (Ctrl-ArrowLeft on macOS): [`cursorSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxLeft) ([`selectSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxLeft) with Shift)\n- Alt-ArrowRight (Ctrl-ArrowRight on macOS): [`cursorSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxRight) ([`selectSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxRight) with Shift)\n- Alt-ArrowUp: [`moveLineUp`](https://codemirror.net/6/docs/ref/#commands.moveLineUp)\n- Alt-ArrowDown: [`moveLineDown`](https://codemirror.net/6/docs/ref/#commands.moveLineDown)\n- Shift-Alt-ArrowUp: [`copyLineUp`](https://codemirror.net/6/docs/ref/#commands.copyLineUp)\n- Shift-Alt-ArrowDown: [`copyLineDown`](https://codemirror.net/6/docs/ref/#commands.copyLineDown)\n- Escape: [`simplifySelection`](https://codemirror.net/6/docs/ref/#commands.simplifySelection)\n- Ctrl-Enter (Cmd-Enter on macOS): [`insertBlankLine`](https://codemirror.net/6/docs/ref/#commands.insertBlankLine)\n- Alt-l (Ctrl-l on macOS): [`selectLine`](https://codemirror.net/6/docs/ref/#commands.selectLine)\n- Ctrl-i (Cmd-i on macOS): [`selectParentSyntax`](https://codemirror.net/6/docs/ref/#commands.selectParentSyntax)\n- Ctrl-[ (Cmd-[ on macOS): [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess)\n- Ctrl-] (Cmd-] on macOS): [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore)\n- Ctrl-Alt-\\\\ (Cmd-Alt-\\\\ on macOS): [`indentSelection`](https://codemirror.net/6/docs/ref/#commands.indentSelection)\n- Shift-Ctrl-k (Shift-Cmd-k on macOS): [`deleteLine`](https://codemirror.net/6/docs/ref/#commands.deleteLine)\n- Shift-Ctrl-\\\\ (Shift-Cmd-\\\\ on macOS): [`cursorMatchingBracket`](https://codemirror.net/6/docs/ref/#commands.cursorMatchingBracket)\n- Ctrl-/ (Cmd-/ on macOS): [`toggleComment`](https://codemirror.net/6/docs/ref/#commands.toggleComment).\n- Shift-Alt-a: [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).\n- Ctrl-m (Alt-Shift-m on macOS): [`toggleTabFocusMode`](https://codemirror.net/6/docs/ref/#commands.toggleTabFocusMode).\n*/\nconst defaultKeymap = /*@__PURE__*/[\n { key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: cursorSyntaxLeft, shift: selectSyntaxLeft },\n { key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: cursorSyntaxRight, shift: selectSyntaxRight },\n { key: "Alt-ArrowUp", run: moveLineUp },\n { key: "Shift-Alt-ArrowUp", run: copyLineUp },\n { key: "Alt-ArrowDown", run: moveLineDown },\n { key: "Shift-Alt-ArrowDown", run: copyLineDown },\n { key: "Escape", run: simplifySelection },\n { key: "Mod-Enter", run: insertBlankLine },\n { key: "Alt-l", mac: "Ctrl-l", run: selectLine },\n { key: "Mod-i", run: selectParentSyntax, preventDefault: true },\n { key: "Mod-[", run: indentLess },\n { key: "Mod-]", run: indentMore },\n { key: "Mod-Alt-\\\\", run: indentSelection },\n { key: "Shift-Mod-k", run: deleteLine },\n { key: "Shift-Mod-\\\\", run: cursorMatchingBracket },\n { key: "Mod-/", run: toggleComment },\n { key: "Alt-A", run: toggleBlockComment },\n { key: "Ctrl-m", mac: "Shift-Alt-m", run: toggleTabFocusMode },\n].concat(standardKeymap);\n/**\nA binding that binds Tab to [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) and\nShift-Tab to [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess).\nPlease see the [Tab example](../../examples/tab/) before using\nthis.\n*/\nconst indentWithTab = { key: "Tab", run: indentMore, shift: indentLess };\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/commands/dist/index.js?')},"./node_modules/@codemirror/lang-javascript/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ autoCloseTags: () => (/* binding */ autoCloseTags),\n/* harmony export */ completionPath: () => (/* binding */ completionPath),\n/* harmony export */ esLint: () => (/* binding */ esLint),\n/* harmony export */ javascript: () => (/* binding */ javascript),\n/* harmony export */ javascriptLanguage: () => (/* binding */ javascriptLanguage),\n/* harmony export */ jsxLanguage: () => (/* binding */ jsxLanguage),\n/* harmony export */ localCompletionSource: () => (/* binding */ localCompletionSource),\n/* harmony export */ scopeCompletionSource: () => (/* binding */ scopeCompletionSource),\n/* harmony export */ snippets: () => (/* binding */ snippets),\n/* harmony export */ tsxLanguage: () => (/* binding */ tsxLanguage),\n/* harmony export */ typescriptLanguage: () => (/* binding */ typescriptLanguage),\n/* harmony export */ typescriptSnippets: () => (/* binding */ typescriptSnippets)\n/* harmony export */ });\n/* harmony import */ var _lezer_javascript__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/javascript */ "./node_modules/@lezer/javascript/dist/index.js");\n/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @codemirror/language */ "./node_modules/@codemirror/language/dist/index.js");\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/autocomplete */ "./node_modules/@codemirror/autocomplete/dist/index.js");\n/* harmony import */ var _lezer_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lezer/common */ "./node_modules/@lezer/common/dist/index.js");\n\n\n\n\n\n\n\n/**\nA collection of JavaScript-related\n[snippets](https://codemirror.net/6/docs/ref/#autocomplete.snippet).\n*/\nconst snippets = [\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("function ${name}(${params}) {\\n\\t${}\\n}", {\n label: "function",\n detail: "definition",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\\n\\t${}\\n}", {\n label: "for",\n detail: "loop",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("for (let ${name} of ${collection}) {\\n\\t${}\\n}", {\n label: "for",\n detail: "of loop",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("do {\\n\\t${}\\n} while (${})", {\n label: "do",\n detail: "loop",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("while (${}) {\\n\\t${}\\n}", {\n label: "while",\n detail: "loop",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("try {\\n\\t${}\\n} catch (${error}) {\\n\\t${}\\n}", {\n label: "try",\n detail: "/ catch block",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("if (${}) {\\n\\t${}\\n}", {\n label: "if",\n detail: "block",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("if (${}) {\\n\\t${}\\n} else {\\n\\t${}\\n}", {\n label: "if",\n detail: "/ else block",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("class ${name} {\\n\\tconstructor(${params}) {\\n\\t\\t${}\\n\\t}\\n}", {\n label: "class",\n detail: "definition",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("import {${names}} from \\"${module}\\"\\n${}", {\n label: "import",\n detail: "named",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("import ${name} from \\"${module}\\"\\n${}", {\n label: "import",\n detail: "default",\n type: "keyword"\n })\n];\n/**\nA collection of snippet completions for TypeScript. Includes the\nJavaScript [snippets](https://codemirror.net/6/docs/ref/#lang-javascript.snippets).\n*/\nconst typescriptSnippets = /*@__PURE__*/snippets.concat([\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("interface ${name} {\\n\\t${}\\n}", {\n label: "interface",\n detail: "definition",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("type ${name} = ${type}", {\n label: "type",\n detail: "definition",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.snippetCompletion)("enum ${name} {\\n\\t${}\\n}", {\n label: "enum",\n detail: "definition",\n type: "keyword"\n })\n]);\n\nconst cache = /*@__PURE__*/new _lezer_common__WEBPACK_IMPORTED_MODULE_1__.NodeWeakMap();\nconst ScopeNodes = /*@__PURE__*/new Set([\n "Script", "Block",\n "FunctionExpression", "FunctionDeclaration", "ArrowFunction", "MethodDeclaration",\n "ForStatement"\n]);\nfunction defID(type) {\n return (node, def) => {\n let id = node.node.getChild("VariableDefinition");\n if (id)\n def(id, type);\n return true;\n };\n}\nconst functionContext = ["FunctionDeclaration"];\nconst gatherCompletions = {\n FunctionDeclaration: /*@__PURE__*/defID("function"),\n ClassDeclaration: /*@__PURE__*/defID("class"),\n ClassExpression: () => true,\n EnumDeclaration: /*@__PURE__*/defID("constant"),\n TypeAliasDeclaration: /*@__PURE__*/defID("type"),\n NamespaceDeclaration: /*@__PURE__*/defID("namespace"),\n VariableDefinition(node, def) { if (!node.matchContext(functionContext))\n def(node, "variable"); },\n TypeDefinition(node, def) { def(node, "type"); },\n __proto__: null\n};\nfunction getScope(doc, node) {\n let cached = cache.get(node);\n if (cached)\n return cached;\n let completions = [], top = true;\n function def(node, type) {\n let name = doc.sliceString(node.from, node.to);\n completions.push({ label: name, type });\n }\n node.cursor(_lezer_common__WEBPACK_IMPORTED_MODULE_1__.IterMode.IncludeAnonymous).iterate(node => {\n if (top) {\n top = false;\n }\n else if (node.name) {\n let gather = gatherCompletions[node.name];\n if (gather && gather(node, def) || ScopeNodes.has(node.name))\n return false;\n }\n else if (node.to - node.from > 8192) {\n // Allow caching for bigger internal nodes\n for (let c of getScope(doc, node.node))\n completions.push(c);\n return false;\n }\n });\n cache.set(node, completions);\n return completions;\n}\nconst Identifier = /^[\\w$\\xa1-\\uffff][\\w$\\d\\xa1-\\uffff]*$/;\nconst dontComplete = [\n "TemplateString", "String", "RegExp",\n "LineComment", "BlockComment",\n "VariableDefinition", "TypeDefinition", "Label",\n "PropertyDefinition", "PropertyName",\n "PrivatePropertyDefinition", "PrivatePropertyName",\n ".", "?."\n];\n/**\nCompletion source that looks up locally defined names in\nJavaScript code.\n*/\nfunction localCompletionSource(context) {\n let inner = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.syntaxTree)(context.state).resolveInner(context.pos, -1);\n if (dontComplete.indexOf(inner.name) > -1)\n return null;\n let isWord = inner.name == "VariableName" ||\n inner.to - inner.from < 20 && Identifier.test(context.state.sliceDoc(inner.from, inner.to));\n if (!isWord && !context.explicit)\n return null;\n let options = [];\n for (let pos = inner; pos; pos = pos.parent) {\n if (ScopeNodes.has(pos.name))\n options = options.concat(getScope(context.state.doc, pos));\n }\n return {\n options,\n from: isWord ? inner.from : context.pos,\n validFor: Identifier\n };\n}\nfunction pathFor(read, member, name) {\n var _a;\n let path = [];\n for (;;) {\n let obj = member.firstChild, prop;\n if ((obj === null || obj === void 0 ? void 0 : obj.name) == "VariableName") {\n path.push(read(obj));\n return { path: path.reverse(), name };\n }\n else if ((obj === null || obj === void 0 ? void 0 : obj.name) == "MemberExpression" && ((_a = (prop = obj.lastChild)) === null || _a === void 0 ? void 0 : _a.name) == "PropertyName") {\n path.push(read(prop));\n member = obj;\n }\n else {\n return null;\n }\n }\n}\n/**\nHelper function for defining JavaScript completion sources. It\nreturns the completable name and object path for a completion\ncontext, or null if no name/property completion should happen at\nthat position. For example, when completing after `a.b.c` it will\nreturn `{path: ["a", "b"], name: "c"}`. When completing after `x`\nit will return `{path: [], name: "x"}`. When not in a property or\nname, it will return null if `context.explicit` is false, and\n`{path: [], name: ""}` otherwise.\n*/\nfunction completionPath(context) {\n let read = (node) => context.state.doc.sliceString(node.from, node.to);\n let inner = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.syntaxTree)(context.state).resolveInner(context.pos, -1);\n if (inner.name == "PropertyName") {\n return pathFor(read, inner.parent, read(inner));\n }\n else if ((inner.name == "." || inner.name == "?.") && inner.parent.name == "MemberExpression") {\n return pathFor(read, inner.parent, "");\n }\n else if (dontComplete.indexOf(inner.name) > -1) {\n return null;\n }\n else if (inner.name == "VariableName" || inner.to - inner.from < 20 && Identifier.test(read(inner))) {\n return { path: [], name: read(inner) };\n }\n else if (inner.name == "MemberExpression") {\n return pathFor(read, inner, "");\n }\n else {\n return context.explicit ? { path: [], name: "" } : null;\n }\n}\nfunction enumeratePropertyCompletions(obj, top) {\n let options = [], seen = new Set;\n for (let depth = 0;; depth++) {\n for (let name of (Object.getOwnPropertyNames || Object.keys)(obj)) {\n if (!/^[a-zA-Z_$\\xaa-\\uffdc][\\w$\\xaa-\\uffdc]*$/.test(name) || seen.has(name))\n continue;\n seen.add(name);\n let value;\n try {\n value = obj[name];\n }\n catch (_) {\n continue;\n }\n options.push({\n label: name,\n type: typeof value == "function" ? (/^[A-Z]/.test(name) ? "class" : top ? "function" : "method")\n : top ? "variable" : "property",\n boost: -depth\n });\n }\n let next = Object.getPrototypeOf(obj);\n if (!next)\n return options;\n obj = next;\n }\n}\n/**\nDefines a [completion source](https://codemirror.net/6/docs/ref/#autocomplete.CompletionSource) that\ncompletes from the given scope object (for example `globalThis`).\nWill enter properties of the object when completing properties on\na directly-named path.\n*/\nfunction scopeCompletionSource(scope) {\n let cache = new Map;\n return (context) => {\n let path = completionPath(context);\n if (!path)\n return null;\n let target = scope;\n for (let step of path.path) {\n target = target[step];\n if (!target)\n return null;\n }\n let options = cache.get(target);\n if (!options)\n cache.set(target, options = enumeratePropertyCompletions(target, !path.path.length));\n return {\n from: context.pos - path.name.length,\n options,\n validFor: Identifier\n };\n };\n}\n\n/**\nA language provider based on the [Lezer JavaScript\nparser](https://github.com/lezer-parser/javascript), extended with\nhighlighting and indentation information.\n*/\nconst javascriptLanguage = /*@__PURE__*/_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.LRLanguage.define({\n name: "javascript",\n parser: /*@__PURE__*/_lezer_javascript__WEBPACK_IMPORTED_MODULE_0__.parser.configure({\n props: [\n /*@__PURE__*/_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.indentNodeProp.add({\n IfStatement: /*@__PURE__*/(0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.continuedIndent)({ except: /^\\s*({|else\\b)/ }),\n TryStatement: /*@__PURE__*/(0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.continuedIndent)({ except: /^\\s*({|catch\\b|finally\\b)/ }),\n LabeledStatement: _codemirror_language__WEBPACK_IMPORTED_MODULE_3__.flatIndent,\n SwitchBody: context => {\n let after = context.textAfter, closed = /^\\s*\\}/.test(after), isCase = /^\\s*(case|default)\\b/.test(after);\n return context.baseIndent + (closed ? 0 : isCase ? 1 : 2) * context.unit;\n },\n Block: /*@__PURE__*/(0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.delimitedIndent)({ closing: "}" }),\n ArrowFunction: cx => cx.baseIndent + cx.unit,\n "TemplateString BlockComment": () => null,\n "Statement Property": /*@__PURE__*/(0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.continuedIndent)({ except: /^{/ }),\n JSXElement(context) {\n let closed = /^\\s*<\\//.test(context.textAfter);\n return context.lineIndent(context.node.from) + (closed ? 0 : context.unit);\n },\n JSXEscape(context) {\n let closed = /\\s*\\}/.test(context.textAfter);\n return context.lineIndent(context.node.from) + (closed ? 0 : context.unit);\n },\n "JSXOpenTag JSXSelfClosingTag"(context) {\n return context.column(context.node.from) + context.unit;\n }\n }),\n /*@__PURE__*/_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.foldNodeProp.add({\n "Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType": _codemirror_language__WEBPACK_IMPORTED_MODULE_3__.foldInside,\n BlockComment(tree) { return { from: tree.from + 2, to: tree.to - 2 }; }\n })\n ]\n }),\n languageData: {\n closeBrackets: { brackets: ["(", "[", "{", "\'", \'"\', "`"] },\n commentTokens: { line: "//", block: { open: "/*", close: "*/" } },\n indentOnInput: /^\\s*(?:case |default:|\\{|\\}|<\\/)$/,\n wordChars: "$"\n }\n});\nconst jsxSublanguage = {\n test: node => /^JSX/.test(node.name),\n facet: /*@__PURE__*/(0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.defineLanguageFacet)({ commentTokens: { block: { open: "{/*", close: "*/}" } } })\n};\n/**\nA language provider for TypeScript.\n*/\nconst typescriptLanguage = /*@__PURE__*/javascriptLanguage.configure({ dialect: "ts" }, "typescript");\n/**\nLanguage provider for JSX.\n*/\nconst jsxLanguage = /*@__PURE__*/javascriptLanguage.configure({\n dialect: "jsx",\n props: [/*@__PURE__*/_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.sublanguageProp.add(n => n.isTop ? [jsxSublanguage] : undefined)]\n});\n/**\nLanguage provider for JSX + TypeScript.\n*/\nconst tsxLanguage = /*@__PURE__*/javascriptLanguage.configure({\n dialect: "jsx ts",\n props: [/*@__PURE__*/_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.sublanguageProp.add(n => n.isTop ? [jsxSublanguage] : undefined)]\n}, "typescript");\nlet kwCompletion = (name) => ({ label: name, type: "keyword" });\nconst keywords = /*@__PURE__*/"break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(kwCompletion);\nconst typescriptKeywords = /*@__PURE__*/keywords.concat(/*@__PURE__*/["declare", "implements", "private", "protected", "public"].map(kwCompletion));\n/**\nJavaScript support. Includes [snippet](https://codemirror.net/6/docs/ref/#lang-javascript.snippets)\nand local variable completion.\n*/\nfunction javascript(config = {}) {\n let lang = config.jsx ? (config.typescript ? tsxLanguage : jsxLanguage)\n : config.typescript ? typescriptLanguage : javascriptLanguage;\n let completions = config.typescript ? typescriptSnippets.concat(typescriptKeywords) : snippets.concat(keywords);\n return new _codemirror_language__WEBPACK_IMPORTED_MODULE_3__.LanguageSupport(lang, [\n javascriptLanguage.data.of({\n autocomplete: (0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.ifNotIn)(dontComplete, (0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_2__.completeFromList)(completions))\n }),\n javascriptLanguage.data.of({\n autocomplete: localCompletionSource\n }),\n config.jsx ? autoCloseTags : [],\n ]);\n}\nfunction findOpenTag(node) {\n for (;;) {\n if (node.name == "JSXOpenTag" || node.name == "JSXSelfClosingTag" || node.name == "JSXFragmentTag")\n return node;\n if (node.name == "JSXEscape" || !node.parent)\n return null;\n node = node.parent;\n }\n}\nfunction elementName(doc, tree, max = doc.length) {\n for (let ch = tree === null || tree === void 0 ? void 0 : tree.firstChild; ch; ch = ch.nextSibling) {\n if (ch.name == "JSXIdentifier" || ch.name == "JSXBuiltin" || ch.name == "JSXNamespacedName" ||\n ch.name == "JSXMemberExpression")\n return doc.sliceString(ch.from, Math.min(ch.to, max));\n }\n return "";\n}\nconst android = typeof navigator == "object" && /*@__PURE__*//Android\\b/.test(navigator.userAgent);\n/**\nExtension that will automatically insert JSX close tags when a `>` or\n`/` is typed.\n*/\nconst autoCloseTags = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.inputHandler.of((view, from, to, text, defaultInsert) => {\n if ((android ? view.composing : view.compositionStarted) || view.state.readOnly ||\n from != to || (text != ">" && text != "/") ||\n !javascriptLanguage.isActiveAt(view.state, from, -1))\n return false;\n let base = defaultInsert(), { state } = base;\n let closeTags = state.changeByRange(range => {\n var _a;\n let { head } = range, around = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_3__.syntaxTree)(state).resolveInner(head - 1, -1), name;\n if (around.name == "JSXStartTag")\n around = around.parent;\n if (state.doc.sliceString(head - 1, head) != text || around.name == "JSXAttributeValue" && around.to > head) ;\n else if (text == ">" && around.name == "JSXFragmentTag") {\n return { range, changes: { from: head, insert: `` } };\n }\n else if (text == "/" && around.name == "JSXStartCloseTag") {\n let empty = around.parent, base = empty.parent;\n if (base && empty.from == head - 2 &&\n ((name = elementName(state.doc, base.firstChild, head)) || ((_a = base.firstChild) === null || _a === void 0 ? void 0 : _a.name) == "JSXFragmentTag")) {\n let insert = `${name}>`;\n return { range: _codemirror_state__WEBPACK_IMPORTED_MODULE_5__.EditorSelection.cursor(head + insert.length, -1), changes: { from: head, insert } };\n }\n }\n else if (text == ">") {\n let openTag = findOpenTag(around);\n if (openTag && openTag.name == "JSXOpenTag" &&\n !/^\\/?>|^<\\//.test(state.doc.sliceString(head, head + 2)) &&\n (name = elementName(state.doc, openTag, head)))\n return { range, changes: { from: head, insert: `` } };\n }\n return { range };\n });\n if (closeTags.changes.empty)\n return false;\n view.dispatch([\n base,\n state.update(closeTags, { userEvent: "input.complete", scrollIntoView: true })\n ]);\n return true;\n});\n\n/**\nConnects an [ESLint](https://eslint.org/) linter to CodeMirror\'s\n[lint](https://codemirror.net/6/docs/ref/#lint) integration. `eslint` should be an instance of the\n[`Linter`](https://eslint.org/docs/developer-guide/nodejs-api#linter)\nclass, and `config` an optional ESLint configuration. The return\nvalue of this function can be passed to [`linter`](https://codemirror.net/6/docs/ref/#lint.linter)\nto create a JavaScript linting extension.\n\nNote that ESLint targets node, and is tricky to run in the\nbrowser. The\n[eslint-linter-browserify](https://github.com/UziTech/eslint-linter-browserify)\npackage may help with that (see\n[example](https://github.com/UziTech/eslint-linter-browserify/blob/master/example/script.js)).\n*/\nfunction esLint(eslint, config) {\n if (!config) {\n config = {\n parserOptions: { ecmaVersion: 2019, sourceType: "module" },\n env: { browser: true, node: true, es6: true, es2015: true, es2017: true, es2020: true },\n rules: {}\n };\n eslint.getRules().forEach((desc, name) => {\n if (desc.meta.docs.recommended)\n config.rules[name] = 2;\n });\n }\n return (view) => {\n let { state } = view, found = [];\n for (let { from, to } of javascriptLanguage.findRegions(state)) {\n let fromLine = state.doc.lineAt(from), offset = { line: fromLine.number - 1, col: from - fromLine.from, pos: from };\n for (let d of eslint.verify(state.sliceDoc(from, to), config))\n found.push(translateDiagnostic(d, state.doc, offset));\n }\n return found;\n };\n}\nfunction mapPos(line, col, doc, offset) {\n return doc.line(line + offset.line).from + col + (line == 1 ? offset.col - 1 : -1);\n}\nfunction translateDiagnostic(input, doc, offset) {\n let start = mapPos(input.line, input.column, doc, offset);\n let result = {\n from: start,\n to: input.endLine != null && input.endColumn != 1 ? mapPos(input.endLine, input.endColumn, doc, offset) : start,\n message: input.message,\n source: input.ruleId ? "eslint:" + input.ruleId : "eslint",\n severity: input.severity == 1 ? "warning" : "error",\n };\n if (input.fix) {\n let { range, text } = input.fix, from = range[0] + offset.pos - start, to = range[1] + offset.pos - start;\n result.actions = [{\n name: "fix",\n apply(view, start) {\n view.dispatch({ changes: { from: start + from, to: start + to, insert: text }, scrollIntoView: true });\n }\n }];\n }\n return result;\n}\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/lang-javascript/dist/index.js?')},"./node_modules/@codemirror/lang-python/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ globalCompletion: () => (/* binding */ globalCompletion),\n/* harmony export */ localCompletionSource: () => (/* binding */ localCompletionSource),\n/* harmony export */ python: () => (/* binding */ python),\n/* harmony export */ pythonLanguage: () => (/* binding */ pythonLanguage)\n/* harmony export */ });\n/* harmony import */ var _lezer_python__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/python */ "./node_modules/@lezer/python/dist/index.js");\n/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/language */ "./node_modules/@codemirror/language/dist/index.js");\n/* harmony import */ var _lezer_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lezer/common */ "./node_modules/@lezer/common/dist/index.js");\n/* harmony import */ var _codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @codemirror/autocomplete */ "./node_modules/@codemirror/autocomplete/dist/index.js");\n\n\n\n\n\nconst cache = /*@__PURE__*/new _lezer_common__WEBPACK_IMPORTED_MODULE_1__.NodeWeakMap();\nconst ScopeNodes = /*@__PURE__*/new Set([\n "Script", "Body",\n "FunctionDefinition", "ClassDefinition", "LambdaExpression",\n "ForStatement", "MatchClause"\n]);\nfunction defID(type) {\n return (node, def, outer) => {\n if (outer)\n return false;\n let id = node.node.getChild("VariableName");\n if (id)\n def(id, type);\n return true;\n };\n}\nconst gatherCompletions = {\n FunctionDefinition: /*@__PURE__*/defID("function"),\n ClassDefinition: /*@__PURE__*/defID("class"),\n ForStatement(node, def, outer) {\n if (outer)\n for (let child = node.node.firstChild; child; child = child.nextSibling) {\n if (child.name == "VariableName")\n def(child, "variable");\n else if (child.name == "in")\n break;\n }\n },\n ImportStatement(_node, def) {\n var _a, _b;\n let { node } = _node;\n let isFrom = ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.name) == "from";\n for (let ch = node.getChild("import"); ch; ch = ch.nextSibling) {\n if (ch.name == "VariableName" && ((_b = ch.nextSibling) === null || _b === void 0 ? void 0 : _b.name) != "as")\n def(ch, isFrom ? "variable" : "namespace");\n }\n },\n AssignStatement(node, def) {\n for (let child = node.node.firstChild; child; child = child.nextSibling) {\n if (child.name == "VariableName")\n def(child, "variable");\n else if (child.name == ":" || child.name == "AssignOp")\n break;\n }\n },\n ParamList(node, def) {\n for (let prev = null, child = node.node.firstChild; child; child = child.nextSibling) {\n if (child.name == "VariableName" && (!prev || !/\\*|AssignOp/.test(prev.name)))\n def(child, "variable");\n prev = child;\n }\n },\n CapturePattern: /*@__PURE__*/defID("variable"),\n AsPattern: /*@__PURE__*/defID("variable"),\n __proto__: null\n};\nfunction getScope(doc, node) {\n let cached = cache.get(node);\n if (cached)\n return cached;\n let completions = [], top = true;\n function def(node, type) {\n let name = doc.sliceString(node.from, node.to);\n completions.push({ label: name, type });\n }\n node.cursor(_lezer_common__WEBPACK_IMPORTED_MODULE_1__.IterMode.IncludeAnonymous).iterate(node => {\n if (node.name) {\n let gather = gatherCompletions[node.name];\n if (gather && gather(node, def, top) || !top && ScopeNodes.has(node.name))\n return false;\n top = false;\n }\n else if (node.to - node.from > 8192) {\n // Allow caching for bigger internal nodes\n for (let c of getScope(doc, node.node))\n completions.push(c);\n return false;\n }\n });\n cache.set(node, completions);\n return completions;\n}\nconst Identifier = /^[\\w\\xa1-\\uffff][\\w\\d\\xa1-\\uffff]*$/;\nconst dontComplete = ["String", "FormatString", "Comment", "PropertyName"];\n/**\nCompletion source that looks up locally defined names in\nPython code.\n*/\nfunction localCompletionSource(context) {\n let inner = (0,_codemirror_language__WEBPACK_IMPORTED_MODULE_2__.syntaxTree)(context.state).resolveInner(context.pos, -1);\n if (dontComplete.indexOf(inner.name) > -1)\n return null;\n let isWord = inner.name == "VariableName" ||\n inner.to - inner.from < 20 && Identifier.test(context.state.sliceDoc(inner.from, inner.to));\n if (!isWord && !context.explicit)\n return null;\n let options = [];\n for (let pos = inner; pos; pos = pos.parent) {\n if (ScopeNodes.has(pos.name))\n options = options.concat(getScope(context.state.doc, pos));\n }\n return {\n options,\n from: isWord ? inner.from : context.pos,\n validFor: Identifier\n };\n}\nconst globals = /*@__PURE__*/[\n "__annotations__", "__builtins__", "__debug__", "__doc__", "__import__", "__name__",\n "__loader__", "__package__", "__spec__",\n "False", "None", "True"\n].map(n => ({ label: n, type: "constant" })).concat(/*@__PURE__*/[\n "ArithmeticError", "AssertionError", "AttributeError", "BaseException", "BlockingIOError",\n "BrokenPipeError", "BufferError", "BytesWarning", "ChildProcessError", "ConnectionAbortedError",\n "ConnectionError", "ConnectionRefusedError", "ConnectionResetError", "DeprecationWarning",\n "EOFError", "Ellipsis", "EncodingWarning", "EnvironmentError", "Exception", "FileExistsError",\n "FileNotFoundError", "FloatingPointError", "FutureWarning", "GeneratorExit", "IOError",\n "ImportError", "ImportWarning", "IndentationError", "IndexError", "InterruptedError",\n "IsADirectoryError", "KeyError", "KeyboardInterrupt", "LookupError", "MemoryError",\n "ModuleNotFoundError", "NameError", "NotADirectoryError", "NotImplemented", "NotImplementedError",\n "OSError", "OverflowError", "PendingDeprecationWarning", "PermissionError", "ProcessLookupError",\n "RecursionError", "ReferenceError", "ResourceWarning", "RuntimeError", "RuntimeWarning",\n "StopAsyncIteration", "StopIteration", "SyntaxError", "SyntaxWarning", "SystemError",\n "SystemExit", "TabError", "TimeoutError", "TypeError", "UnboundLocalError", "UnicodeDecodeError",\n "UnicodeEncodeError", "UnicodeError", "UnicodeTranslateError", "UnicodeWarning", "UserWarning",\n "ValueError", "Warning", "ZeroDivisionError"\n].map(n => ({ label: n, type: "type" }))).concat(/*@__PURE__*/[\n "bool", "bytearray", "bytes", "classmethod", "complex", "float", "frozenset", "int", "list",\n "map", "memoryview", "object", "range", "set", "staticmethod", "str", "super", "tuple", "type"\n].map(n => ({ label: n, type: "class" }))).concat(/*@__PURE__*/[\n "abs", "aiter", "all", "anext", "any", "ascii", "bin", "breakpoint", "callable", "chr",\n "compile", "delattr", "dict", "dir", "divmod", "enumerate", "eval", "exec", "exit", "filter",\n "format", "getattr", "globals", "hasattr", "hash", "help", "hex", "id", "input", "isinstance",\n "issubclass", "iter", "len", "license", "locals", "max", "min", "next", "oct", "open",\n "ord", "pow", "print", "property", "quit", "repr", "reversed", "round", "setattr", "slice",\n "sorted", "sum", "vars", "zip"\n].map(n => ({ label: n, type: "function" })));\nconst snippets = [\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.snippetCompletion)("def ${name}(${params}):\\n\\t${}", {\n label: "def",\n detail: "function",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.snippetCompletion)("for ${name} in ${collection}:\\n\\t${}", {\n label: "for",\n detail: "loop",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.snippetCompletion)("while ${}:\\n\\t${}", {\n label: "while",\n detail: "loop",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.snippetCompletion)("try:\\n\\t${}\\nexcept ${error}:\\n\\t${}", {\n label: "try",\n detail: "/ except block",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.snippetCompletion)("if ${}:\\n\\t\\n", {\n label: "if",\n detail: "block",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.snippetCompletion)("if ${}:\\n\\t${}\\nelse:\\n\\t${}", {\n label: "if",\n detail: "/ else block",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.snippetCompletion)("class ${name}:\\n\\tdef __init__(self, ${params}):\\n\\t\\t\\t${}", {\n label: "class",\n detail: "definition",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.snippetCompletion)("import ${module}", {\n label: "import",\n detail: "statement",\n type: "keyword"\n }),\n /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.snippetCompletion)("from ${module} import ${names}", {\n label: "from",\n detail: "import",\n type: "keyword"\n })\n];\n/**\nAutocompletion for built-in Python globals and keywords.\n*/\nconst globalCompletion = /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.ifNotIn)(dontComplete, /*@__PURE__*/(0,_codemirror_autocomplete__WEBPACK_IMPORTED_MODULE_3__.completeFromList)(/*@__PURE__*/globals.concat(snippets)));\n\nfunction innerBody(context) {\n let { node, pos } = context;\n let lineIndent = context.lineIndent(pos, -1);\n let found = null;\n for (;;) {\n let before = node.childBefore(pos);\n if (!before) {\n break;\n }\n else if (before.name == "Comment") {\n pos = before.from;\n }\n else if (before.name == "Body") {\n if (context.baseIndentFor(before) + context.unit <= lineIndent)\n found = before;\n node = before;\n }\n else if (before.type.is("Statement")) {\n node = before;\n }\n else {\n break;\n }\n }\n return found;\n}\nfunction indentBody(context, node) {\n let base = context.baseIndentFor(node);\n let line = context.lineAt(context.pos, -1), to = line.from + line.text.length;\n // Don\'t consider blank, deindented lines at the end of the\n // block part of the block\n if (/^\\s*($|#)/.test(line.text) &&\n context.node.to < to + 100 &&\n !/\\S/.test(context.state.sliceDoc(to, context.node.to)) &&\n context.lineIndent(context.pos, -1) <= base)\n return null;\n // A normally deindenting keyword that appears at a higher\n // indentation than the block should probably be handled by the next\n // level\n if (/^\\s*(else:|elif |except |finally:)/.test(context.textAfter) && context.lineIndent(context.pos, -1) > base)\n return null;\n return base + context.unit;\n}\n/**\nA language provider based on the [Lezer Python\nparser](https://github.com/lezer-parser/python), extended with\nhighlighting and indentation information.\n*/\nconst pythonLanguage = /*@__PURE__*/_codemirror_language__WEBPACK_IMPORTED_MODULE_2__.LRLanguage.define({\n name: "python",\n parser: /*@__PURE__*/_lezer_python__WEBPACK_IMPORTED_MODULE_0__.parser.configure({\n props: [\n /*@__PURE__*/_codemirror_language__WEBPACK_IMPORTED_MODULE_2__.indentNodeProp.add({\n Body: context => {\n var _a;\n let inner = innerBody(context);\n return (_a = indentBody(context, inner || context.node)) !== null && _a !== void 0 ? _a : context.continue();\n },\n IfStatement: cx => /^\\s*(else:|elif )/.test(cx.textAfter) ? cx.baseIndent : cx.continue(),\n "ForStatement WhileStatement": cx => /^\\s*else:/.test(cx.textAfter) ? cx.baseIndent : cx.continue(),\n TryStatement: cx => /^\\s*(except |finally:|else:)/.test(cx.textAfter) ? cx.baseIndent : cx.continue(),\n "TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression": /*@__PURE__*/(0,_codemirror_language__WEBPACK_IMPORTED_MODULE_2__.delimitedIndent)({ closing: ")" }),\n "DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression": /*@__PURE__*/(0,_codemirror_language__WEBPACK_IMPORTED_MODULE_2__.delimitedIndent)({ closing: "}" }),\n "ArrayExpression ArrayComprehensionExpression": /*@__PURE__*/(0,_codemirror_language__WEBPACK_IMPORTED_MODULE_2__.delimitedIndent)({ closing: "]" }),\n "String FormatString": () => null,\n Script: context => {\n var _a;\n let inner = innerBody(context);\n return (_a = (inner && indentBody(context, inner))) !== null && _a !== void 0 ? _a : context.continue();\n }\n }),\n /*@__PURE__*/_codemirror_language__WEBPACK_IMPORTED_MODULE_2__.foldNodeProp.add({\n "ArrayExpression DictionaryExpression SetExpression TupleExpression": _codemirror_language__WEBPACK_IMPORTED_MODULE_2__.foldInside,\n Body: (node, state) => ({ from: node.from + 1, to: node.to - (node.to == state.doc.length ? 0 : 1) })\n })\n ],\n }),\n languageData: {\n closeBrackets: {\n brackets: ["(", "[", "{", "\'", \'"\', "\'\'\'", \'"""\'],\n stringPrefixes: ["f", "fr", "rf", "r", "u", "b", "br", "rb",\n "F", "FR", "RF", "R", "U", "B", "BR", "RB"]\n },\n commentTokens: { line: "#" },\n indentOnInput: /^\\s*([\\}\\]\\)]|else:|elif |except |finally:)$/\n }\n});\n/**\nPython language support.\n*/\nfunction python() {\n return new _codemirror_language__WEBPACK_IMPORTED_MODULE_2__.LanguageSupport(pythonLanguage, [\n pythonLanguage.data.of({ autocomplete: localCompletionSource }),\n pythonLanguage.data.of({ autocomplete: globalCompletion }),\n ]);\n}\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/lang-python/dist/index.js?')},"./node_modules/@codemirror/language/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DocInput: () => (/* binding */ DocInput),\n/* harmony export */ HighlightStyle: () => (/* binding */ HighlightStyle),\n/* harmony export */ IndentContext: () => (/* binding */ IndentContext),\n/* harmony export */ LRLanguage: () => (/* binding */ LRLanguage),\n/* harmony export */ Language: () => (/* binding */ Language),\n/* harmony export */ LanguageDescription: () => (/* binding */ LanguageDescription),\n/* harmony export */ LanguageSupport: () => (/* binding */ LanguageSupport),\n/* harmony export */ ParseContext: () => (/* binding */ ParseContext),\n/* harmony export */ StreamLanguage: () => (/* binding */ StreamLanguage),\n/* harmony export */ StringStream: () => (/* binding */ StringStream),\n/* harmony export */ TreeIndentContext: () => (/* binding */ TreeIndentContext),\n/* harmony export */ bidiIsolates: () => (/* binding */ bidiIsolates),\n/* harmony export */ bracketMatching: () => (/* binding */ bracketMatching),\n/* harmony export */ bracketMatchingHandle: () => (/* binding */ bracketMatchingHandle),\n/* harmony export */ codeFolding: () => (/* binding */ codeFolding),\n/* harmony export */ continuedIndent: () => (/* binding */ continuedIndent),\n/* harmony export */ defaultHighlightStyle: () => (/* binding */ defaultHighlightStyle),\n/* harmony export */ defineLanguageFacet: () => (/* binding */ defineLanguageFacet),\n/* harmony export */ delimitedIndent: () => (/* binding */ delimitedIndent),\n/* harmony export */ ensureSyntaxTree: () => (/* binding */ ensureSyntaxTree),\n/* harmony export */ flatIndent: () => (/* binding */ flatIndent),\n/* harmony export */ foldAll: () => (/* binding */ foldAll),\n/* harmony export */ foldCode: () => (/* binding */ foldCode),\n/* harmony export */ foldEffect: () => (/* binding */ foldEffect),\n/* harmony export */ foldGutter: () => (/* binding */ foldGutter),\n/* harmony export */ foldInside: () => (/* binding */ foldInside),\n/* harmony export */ foldKeymap: () => (/* binding */ foldKeymap),\n/* harmony export */ foldNodeProp: () => (/* binding */ foldNodeProp),\n/* harmony export */ foldService: () => (/* binding */ foldService),\n/* harmony export */ foldState: () => (/* binding */ foldState),\n/* harmony export */ foldable: () => (/* binding */ foldable),\n/* harmony export */ foldedRanges: () => (/* binding */ foldedRanges),\n/* harmony export */ forceParsing: () => (/* binding */ forceParsing),\n/* harmony export */ getIndentUnit: () => (/* binding */ getIndentUnit),\n/* harmony export */ getIndentation: () => (/* binding */ getIndentation),\n/* harmony export */ highlightingFor: () => (/* binding */ highlightingFor),\n/* harmony export */ indentNodeProp: () => (/* binding */ indentNodeProp),\n/* harmony export */ indentOnInput: () => (/* binding */ indentOnInput),\n/* harmony export */ indentRange: () => (/* binding */ indentRange),\n/* harmony export */ indentService: () => (/* binding */ indentService),\n/* harmony export */ indentString: () => (/* binding */ indentString),\n/* harmony export */ indentUnit: () => (/* binding */ indentUnit),\n/* harmony export */ language: () => (/* binding */ language),\n/* harmony export */ languageDataProp: () => (/* binding */ languageDataProp),\n/* harmony export */ matchBrackets: () => (/* binding */ matchBrackets),\n/* harmony export */ sublanguageProp: () => (/* binding */ sublanguageProp),\n/* harmony export */ syntaxHighlighting: () => (/* binding */ syntaxHighlighting),\n/* harmony export */ syntaxParserRunning: () => (/* binding */ syntaxParserRunning),\n/* harmony export */ syntaxTree: () => (/* binding */ syntaxTree),\n/* harmony export */ syntaxTreeAvailable: () => (/* binding */ syntaxTreeAvailable),\n/* harmony export */ toggleFold: () => (/* binding */ toggleFold),\n/* harmony export */ unfoldAll: () => (/* binding */ unfoldAll),\n/* harmony export */ unfoldCode: () => (/* binding */ unfoldCode),\n/* harmony export */ unfoldEffect: () => (/* binding */ unfoldEffect)\n/* harmony export */ });\n/* harmony import */ var _lezer_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/common */ "./node_modules/@lezer/common/dist/index.js");\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lezer/highlight */ "./node_modules/@lezer/highlight/dist/index.js");\n/* harmony import */ var style_mod__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! style-mod */ "./node_modules/style-mod/src/style-mod.js");\n\n\n\n\n\n\nvar _a;\n/**\nNode prop stored in a parser\'s top syntax node to provide the\nfacet that stores language-specific data for that language.\n*/\nconst languageDataProp = /*@__PURE__*/new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp();\n/**\nHelper function to define a facet (to be added to the top syntax\nnode(s) for a language via\n[`languageDataProp`](https://codemirror.net/6/docs/ref/#language.languageDataProp)), that will be\nused to associate language data with the language. You\nprobably only need this when subclassing\n[`Language`](https://codemirror.net/6/docs/ref/#language.Language).\n*/\nfunction defineLanguageFacet(baseData) {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define({\n combine: baseData ? values => values.concat(baseData) : undefined\n });\n}\n/**\nSyntax node prop used to register sublanguages. Should be added to\nthe top level node type for the language.\n*/\nconst sublanguageProp = /*@__PURE__*/new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp();\n/**\nA language object manages parsing and per-language\n[metadata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt). Parse data is\nmanaged as a [Lezer](https://lezer.codemirror.net) tree. The class\ncan be used directly, via the [`LRLanguage`](https://codemirror.net/6/docs/ref/#language.LRLanguage)\nsubclass for [Lezer](https://lezer.codemirror.net/) LR parsers, or\nvia the [`StreamLanguage`](https://codemirror.net/6/docs/ref/#language.StreamLanguage) subclass\nfor stream parsers.\n*/\nclass Language {\n /**\n Construct a language object. If you need to invoke this\n directly, first define a data facet with\n [`defineLanguageFacet`](https://codemirror.net/6/docs/ref/#language.defineLanguageFacet), and then\n configure your parser to [attach](https://codemirror.net/6/docs/ref/#language.languageDataProp) it\n to the language\'s outer syntax node.\n */\n constructor(\n /**\n The [language data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) facet\n used for this language.\n */\n data, parser, extraExtensions = [], \n /**\n A language name.\n */\n name = "") {\n this.data = data;\n this.name = name;\n // Kludge to define EditorState.tree as a debugging helper,\n // without the EditorState package actually knowing about\n // languages and lezer trees.\n if (!_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.EditorState.prototype.hasOwnProperty("tree"))\n Object.defineProperty(_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.EditorState.prototype, "tree", { get() { return syntaxTree(this); } });\n this.parser = parser;\n this.extension = [\n language.of(this),\n _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.EditorState.languageData.of((state, pos, side) => {\n let top = topNodeAt(state, pos, side), data = top.type.prop(languageDataProp);\n if (!data)\n return [];\n let base = state.facet(data), sub = top.type.prop(sublanguageProp);\n if (sub) {\n let innerNode = top.resolve(pos - top.from, side);\n for (let sublang of sub)\n if (sublang.test(innerNode, state)) {\n let data = state.facet(sublang.facet);\n return sublang.type == "replace" ? data : data.concat(base);\n }\n }\n return base;\n })\n ].concat(extraExtensions);\n }\n /**\n Query whether this language is active at the given position.\n */\n isActiveAt(state, pos, side = -1) {\n return topNodeAt(state, pos, side).type.prop(languageDataProp) == this.data;\n }\n /**\n Find the document regions that were parsed using this language.\n The returned regions will _include_ any nested languages rooted\n in this language, when those exist.\n */\n findRegions(state) {\n let lang = state.facet(language);\n if ((lang === null || lang === void 0 ? void 0 : lang.data) == this.data)\n return [{ from: 0, to: state.doc.length }];\n if (!lang || !lang.allowsNesting)\n return [];\n let result = [];\n let explore = (tree, from) => {\n if (tree.prop(languageDataProp) == this.data) {\n result.push({ from, to: from + tree.length });\n return;\n }\n let mount = tree.prop(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.mounted);\n if (mount) {\n if (mount.tree.prop(languageDataProp) == this.data) {\n if (mount.overlay)\n for (let r of mount.overlay)\n result.push({ from: r.from + from, to: r.to + from });\n else\n result.push({ from: from, to: from + tree.length });\n return;\n }\n else if (mount.overlay) {\n let size = result.length;\n explore(mount.tree, mount.overlay[0].from + from);\n if (result.length > size)\n return;\n }\n }\n for (let i = 0; i < tree.children.length; i++) {\n let ch = tree.children[i];\n if (ch instanceof _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree)\n explore(ch, tree.positions[i] + from);\n }\n };\n explore(syntaxTree(state), 0);\n return result;\n }\n /**\n Indicates whether this language allows nested languages. The\n default implementation returns true.\n */\n get allowsNesting() { return true; }\n}\n/**\n@internal\n*/\nLanguage.setState = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.StateEffect.define();\nfunction topNodeAt(state, pos, side) {\n let topLang = state.facet(language), tree = syntaxTree(state).topNode;\n if (!topLang || topLang.allowsNesting) {\n for (let node = tree; node; node = node.enter(pos, side, _lezer_common__WEBPACK_IMPORTED_MODULE_0__.IterMode.ExcludeBuffers))\n if (node.type.isTop)\n tree = node;\n }\n return tree;\n}\n/**\nA subclass of [`Language`](https://codemirror.net/6/docs/ref/#language.Language) for use with Lezer\n[LR parsers](https://lezer.codemirror.net/docs/ref#lr.LRParser)\nparsers.\n*/\nclass LRLanguage extends Language {\n constructor(data, parser, name) {\n super(data, parser, [], name);\n this.parser = parser;\n }\n /**\n Define a language from a parser.\n */\n static define(spec) {\n let data = defineLanguageFacet(spec.languageData);\n return new LRLanguage(data, spec.parser.configure({\n props: [languageDataProp.add(type => type.isTop ? data : undefined)]\n }), spec.name);\n }\n /**\n Create a new instance of this language with a reconfigured\n version of its parser and optionally a new name.\n */\n configure(options, name) {\n return new LRLanguage(this.data, this.parser.configure(options), name || this.name);\n }\n get allowsNesting() { return this.parser.hasWrappers(); }\n}\n/**\nGet the syntax tree for a state, which is the current (possibly\nincomplete) parse tree of the active\n[language](https://codemirror.net/6/docs/ref/#language.Language), or the empty tree if there is no\nlanguage available.\n*/\nfunction syntaxTree(state) {\n let field = state.field(Language.state, false);\n return field ? field.tree : _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree.empty;\n}\n/**\nTry to get a parse tree that spans at least up to `upto`. The\nmethod will do at most `timeout` milliseconds of work to parse\nup to that point if the tree isn\'t already available.\n*/\nfunction ensureSyntaxTree(state, upto, timeout = 50) {\n var _a;\n let parse = (_a = state.field(Language.state, false)) === null || _a === void 0 ? void 0 : _a.context;\n if (!parse)\n return null;\n let oldVieport = parse.viewport;\n parse.updateViewport({ from: 0, to: upto });\n let result = parse.isDone(upto) || parse.work(timeout, upto) ? parse.tree : null;\n parse.updateViewport(oldVieport);\n return result;\n}\n/**\nQueries whether there is a full syntax tree available up to the\ngiven document position. If there isn\'t, the background parse\nprocess _might_ still be working and update the tree further, but\nthere is no guarantee of that—the parser will [stop\nworking](https://codemirror.net/6/docs/ref/#language.syntaxParserRunning) when it has spent a\ncertain amount of time or has moved beyond the visible viewport.\nAlways returns false if no language has been enabled.\n*/\nfunction syntaxTreeAvailable(state, upto = state.doc.length) {\n var _a;\n return ((_a = state.field(Language.state, false)) === null || _a === void 0 ? void 0 : _a.context.isDone(upto)) || false;\n}\n/**\nMove parsing forward, and update the editor state afterwards to\nreflect the new tree. Will work for at most `timeout`\nmilliseconds. Returns true if the parser managed get to the given\nposition in that time.\n*/\nfunction forceParsing(view, upto = view.viewport.to, timeout = 100) {\n let success = ensureSyntaxTree(view.state, upto, timeout);\n if (success != syntaxTree(view.state))\n view.dispatch({});\n return !!success;\n}\n/**\nTells you whether the language parser is planning to do more\nparsing work (in a `requestIdleCallback` pseudo-thread) or has\nstopped running, either because it parsed the entire document,\nbecause it spent too much time and was cut off, or because there\nis no language parser enabled.\n*/\nfunction syntaxParserRunning(view) {\n var _a;\n return ((_a = view.plugin(parseWorker)) === null || _a === void 0 ? void 0 : _a.isWorking()) || false;\n}\n/**\nLezer-style\n[`Input`](https://lezer.codemirror.net/docs/ref#common.Input)\nobject for a [`Text`](https://codemirror.net/6/docs/ref/#state.Text) object.\n*/\nclass DocInput {\n /**\n Create an input object for the given document.\n */\n constructor(doc) {\n this.doc = doc;\n this.cursorPos = 0;\n this.string = "";\n this.cursor = doc.iter();\n }\n get length() { return this.doc.length; }\n syncTo(pos) {\n this.string = this.cursor.next(pos - this.cursorPos).value;\n this.cursorPos = pos + this.string.length;\n return this.cursorPos - this.string.length;\n }\n chunk(pos) {\n this.syncTo(pos);\n return this.string;\n }\n get lineChunks() { return true; }\n read(from, to) {\n let stringStart = this.cursorPos - this.string.length;\n if (from < stringStart || to >= this.cursorPos)\n return this.doc.sliceString(from, to);\n else\n return this.string.slice(from - stringStart, to - stringStart);\n }\n}\nlet currentContext = null;\n/**\nA parse context provided to parsers working on the editor content.\n*/\nclass ParseContext {\n constructor(parser, \n /**\n The current editor state.\n */\n state, \n /**\n Tree fragments that can be reused by incremental re-parses.\n */\n fragments = [], \n /**\n @internal\n */\n tree, \n /**\n @internal\n */\n treeLen, \n /**\n The current editor viewport (or some overapproximation\n thereof). Intended to be used for opportunistically avoiding\n work (in which case\n [`skipUntilInView`](https://codemirror.net/6/docs/ref/#language.ParseContext.skipUntilInView)\n should be called to make sure the parser is restarted when the\n skipped region becomes visible).\n */\n viewport, \n /**\n @internal\n */\n skipped, \n /**\n This is where skipping parsers can register a promise that,\n when resolved, will schedule a new parse. It is cleared when\n the parse worker picks up the promise. @internal\n */\n scheduleOn) {\n this.parser = parser;\n this.state = state;\n this.fragments = fragments;\n this.tree = tree;\n this.treeLen = treeLen;\n this.viewport = viewport;\n this.skipped = skipped;\n this.scheduleOn = scheduleOn;\n this.parse = null;\n /**\n @internal\n */\n this.tempSkipped = [];\n }\n /**\n @internal\n */\n static create(parser, state, viewport) {\n return new ParseContext(parser, state, [], _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree.empty, 0, viewport, [], null);\n }\n startParse() {\n return this.parser.startParse(new DocInput(this.state.doc), this.fragments);\n }\n /**\n @internal\n */\n work(until, upto) {\n if (upto != null && upto >= this.state.doc.length)\n upto = undefined;\n if (this.tree != _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree.empty && this.isDone(upto !== null && upto !== void 0 ? upto : this.state.doc.length)) {\n this.takeTree();\n return true;\n }\n return this.withContext(() => {\n var _a;\n if (typeof until == "number") {\n let endTime = Date.now() + until;\n until = () => Date.now() > endTime;\n }\n if (!this.parse)\n this.parse = this.startParse();\n if (upto != null && (this.parse.stoppedAt == null || this.parse.stoppedAt > upto) &&\n upto < this.state.doc.length)\n this.parse.stopAt(upto);\n for (;;) {\n let done = this.parse.advance();\n if (done) {\n this.fragments = this.withoutTempSkipped(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.TreeFragment.addTree(done, this.fragments, this.parse.stoppedAt != null));\n this.treeLen = (_a = this.parse.stoppedAt) !== null && _a !== void 0 ? _a : this.state.doc.length;\n this.tree = done;\n this.parse = null;\n if (this.treeLen < (upto !== null && upto !== void 0 ? upto : this.state.doc.length))\n this.parse = this.startParse();\n else\n return true;\n }\n if (until())\n return false;\n }\n });\n }\n /**\n @internal\n */\n takeTree() {\n let pos, tree;\n if (this.parse && (pos = this.parse.parsedPos) >= this.treeLen) {\n if (this.parse.stoppedAt == null || this.parse.stoppedAt > pos)\n this.parse.stopAt(pos);\n this.withContext(() => { while (!(tree = this.parse.advance())) { } });\n this.treeLen = pos;\n this.tree = tree;\n this.fragments = this.withoutTempSkipped(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.TreeFragment.addTree(this.tree, this.fragments, true));\n this.parse = null;\n }\n }\n withContext(f) {\n let prev = currentContext;\n currentContext = this;\n try {\n return f();\n }\n finally {\n currentContext = prev;\n }\n }\n withoutTempSkipped(fragments) {\n for (let r; r = this.tempSkipped.pop();)\n fragments = cutFragments(fragments, r.from, r.to);\n return fragments;\n }\n /**\n @internal\n */\n changes(changes, newState) {\n let { fragments, tree, treeLen, viewport, skipped } = this;\n this.takeTree();\n if (!changes.empty) {\n let ranges = [];\n changes.iterChangedRanges((fromA, toA, fromB, toB) => ranges.push({ fromA, toA, fromB, toB }));\n fragments = _lezer_common__WEBPACK_IMPORTED_MODULE_0__.TreeFragment.applyChanges(fragments, ranges);\n tree = _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree.empty;\n treeLen = 0;\n viewport = { from: changes.mapPos(viewport.from, -1), to: changes.mapPos(viewport.to, 1) };\n if (this.skipped.length) {\n skipped = [];\n for (let r of this.skipped) {\n let from = changes.mapPos(r.from, 1), to = changes.mapPos(r.to, -1);\n if (from < to)\n skipped.push({ from, to });\n }\n }\n }\n return new ParseContext(this.parser, newState, fragments, tree, treeLen, viewport, skipped, this.scheduleOn);\n }\n /**\n @internal\n */\n updateViewport(viewport) {\n if (this.viewport.from == viewport.from && this.viewport.to == viewport.to)\n return false;\n this.viewport = viewport;\n let startLen = this.skipped.length;\n for (let i = 0; i < this.skipped.length; i++) {\n let { from, to } = this.skipped[i];\n if (from < viewport.to && to > viewport.from) {\n this.fragments = cutFragments(this.fragments, from, to);\n this.skipped.splice(i--, 1);\n }\n }\n if (this.skipped.length >= startLen)\n return false;\n this.reset();\n return true;\n }\n /**\n @internal\n */\n reset() {\n if (this.parse) {\n this.takeTree();\n this.parse = null;\n }\n }\n /**\n Notify the parse scheduler that the given region was skipped\n because it wasn\'t in view, and the parse should be restarted\n when it comes into view.\n */\n skipUntilInView(from, to) {\n this.skipped.push({ from, to });\n }\n /**\n Returns a parser intended to be used as placeholder when\n asynchronously loading a nested parser. It\'ll skip its input and\n mark it as not-really-parsed, so that the next update will parse\n it again.\n \n When `until` is given, a reparse will be scheduled when that\n promise resolves.\n */\n static getSkippingParser(until) {\n return new class extends _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Parser {\n createParse(input, fragments, ranges) {\n let from = ranges[0].from, to = ranges[ranges.length - 1].to;\n let parser = {\n parsedPos: from,\n advance() {\n let cx = currentContext;\n if (cx) {\n for (let r of ranges)\n cx.tempSkipped.push(r);\n if (until)\n cx.scheduleOn = cx.scheduleOn ? Promise.all([cx.scheduleOn, until]) : until;\n }\n this.parsedPos = to;\n return new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeType.none, [], [], to - from);\n },\n stoppedAt: null,\n stopAt() { }\n };\n return parser;\n }\n };\n }\n /**\n @internal\n */\n isDone(upto) {\n upto = Math.min(upto, this.state.doc.length);\n let frags = this.fragments;\n return this.treeLen >= upto && frags.length && frags[0].from == 0 && frags[0].to >= upto;\n }\n /**\n Get the context for the current parse, or `null` if no editor\n parse is in progress.\n */\n static get() { return currentContext; }\n}\nfunction cutFragments(fragments, from, to) {\n return _lezer_common__WEBPACK_IMPORTED_MODULE_0__.TreeFragment.applyChanges(fragments, [{ fromA: from, toA: to, fromB: from, toB: to }]);\n}\nclass LanguageState {\n constructor(\n // A mutable parse state that is used to preserve work done during\n // the lifetime of a state when moving to the next state.\n context) {\n this.context = context;\n this.tree = context.tree;\n }\n apply(tr) {\n if (!tr.docChanged && this.tree == this.context.tree)\n return this;\n let newCx = this.context.changes(tr.changes, tr.state);\n // If the previous parse wasn\'t done, go forward only up to its\n // end position or the end of the viewport, to avoid slowing down\n // state updates with parse work beyond the viewport.\n let upto = this.context.treeLen == tr.startState.doc.length ? undefined\n : Math.max(tr.changes.mapPos(this.context.treeLen), newCx.viewport.to);\n if (!newCx.work(20 /* Work.Apply */, upto))\n newCx.takeTree();\n return new LanguageState(newCx);\n }\n static init(state) {\n let vpTo = Math.min(3000 /* Work.InitViewport */, state.doc.length);\n let parseState = ParseContext.create(state.facet(language).parser, state, { from: 0, to: vpTo });\n if (!parseState.work(20 /* Work.Apply */, vpTo))\n parseState.takeTree();\n return new LanguageState(parseState);\n }\n}\nLanguage.state = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.StateField.define({\n create: LanguageState.init,\n update(value, tr) {\n for (let e of tr.effects)\n if (e.is(Language.setState))\n return e.value;\n if (tr.startState.facet(language) != tr.state.facet(language))\n return LanguageState.init(tr.state);\n return value.apply(tr);\n }\n});\nlet requestIdle = (callback) => {\n let timeout = setTimeout(() => callback(), 500 /* Work.MaxPause */);\n return () => clearTimeout(timeout);\n};\nif (typeof requestIdleCallback != "undefined")\n requestIdle = (callback) => {\n let idle = -1, timeout = setTimeout(() => {\n idle = requestIdleCallback(callback, { timeout: 500 /* Work.MaxPause */ - 100 /* Work.MinPause */ });\n }, 100 /* Work.MinPause */);\n return () => idle < 0 ? clearTimeout(timeout) : cancelIdleCallback(idle);\n };\nconst isInputPending = typeof navigator != "undefined" && ((_a = navigator.scheduling) === null || _a === void 0 ? void 0 : _a.isInputPending)\n ? () => navigator.scheduling.isInputPending() : null;\nconst parseWorker = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.ViewPlugin.fromClass(class ParseWorker {\n constructor(view) {\n this.view = view;\n this.working = null;\n this.workScheduled = 0;\n // End of the current time chunk\n this.chunkEnd = -1;\n // Milliseconds of budget left for this chunk\n this.chunkBudget = -1;\n this.work = this.work.bind(this);\n this.scheduleWork();\n }\n update(update) {\n let cx = this.view.state.field(Language.state).context;\n if (cx.updateViewport(update.view.viewport) || this.view.viewport.to > cx.treeLen)\n this.scheduleWork();\n if (update.docChanged || update.selectionSet) {\n if (this.view.hasFocus)\n this.chunkBudget += 50 /* Work.ChangeBonus */;\n this.scheduleWork();\n }\n this.checkAsyncSchedule(cx);\n }\n scheduleWork() {\n if (this.working)\n return;\n let { state } = this.view, field = state.field(Language.state);\n if (field.tree != field.context.tree || !field.context.isDone(state.doc.length))\n this.working = requestIdle(this.work);\n }\n work(deadline) {\n this.working = null;\n let now = Date.now();\n if (this.chunkEnd < now && (this.chunkEnd < 0 || this.view.hasFocus)) { // Start a new chunk\n this.chunkEnd = now + 30000 /* Work.ChunkTime */;\n this.chunkBudget = 3000 /* Work.ChunkBudget */;\n }\n if (this.chunkBudget <= 0)\n return; // No more budget\n let { state, viewport: { to: vpTo } } = this.view, field = state.field(Language.state);\n if (field.tree == field.context.tree && field.context.isDone(vpTo + 100000 /* Work.MaxParseAhead */))\n return;\n let endTime = Date.now() + Math.min(this.chunkBudget, 100 /* Work.Slice */, deadline && !isInputPending ? Math.max(25 /* Work.MinSlice */, deadline.timeRemaining() - 5) : 1e9);\n let viewportFirst = field.context.treeLen < vpTo && state.doc.length > vpTo + 1000;\n let done = field.context.work(() => {\n return isInputPending && isInputPending() || Date.now() > endTime;\n }, vpTo + (viewportFirst ? 0 : 100000 /* Work.MaxParseAhead */));\n this.chunkBudget -= Date.now() - now;\n if (done || this.chunkBudget <= 0) {\n field.context.takeTree();\n this.view.dispatch({ effects: Language.setState.of(new LanguageState(field.context)) });\n }\n if (this.chunkBudget > 0 && !(done && !viewportFirst))\n this.scheduleWork();\n this.checkAsyncSchedule(field.context);\n }\n checkAsyncSchedule(cx) {\n if (cx.scheduleOn) {\n this.workScheduled++;\n cx.scheduleOn\n .then(() => this.scheduleWork())\n .catch(err => (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.logException)(this.view.state, err))\n .then(() => this.workScheduled--);\n cx.scheduleOn = null;\n }\n }\n destroy() {\n if (this.working)\n this.working();\n }\n isWorking() {\n return !!(this.working || this.workScheduled > 0);\n }\n}, {\n eventHandlers: { focus() { this.scheduleWork(); } }\n});\n/**\nThe facet used to associate a language with an editor state. Used\nby `Language` object\'s `extension` property (so you don\'t need to\nmanually wrap your languages in this). Can be used to access the\ncurrent language on a state.\n*/\nconst language = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define({\n combine(languages) { return languages.length ? languages[0] : null; },\n enables: language => [\n Language.state,\n parseWorker,\n _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.contentAttributes.compute([language], state => {\n let lang = state.facet(language);\n return lang && lang.name ? { "data-language": lang.name } : {};\n })\n ]\n});\n/**\nThis class bundles a [language](https://codemirror.net/6/docs/ref/#language.Language) with an\noptional set of supporting extensions. Language packages are\nencouraged to export a function that optionally takes a\nconfiguration object and returns a `LanguageSupport` instance, as\nthe main way for client code to use the package.\n*/\nclass LanguageSupport {\n /**\n Create a language support object.\n */\n constructor(\n /**\n The language object.\n */\n language, \n /**\n An optional set of supporting extensions. When nesting a\n language in another language, the outer language is encouraged\n to include the supporting extensions for its inner languages\n in its own set of support extensions.\n */\n support = []) {\n this.language = language;\n this.support = support;\n this.extension = [language, support];\n }\n}\n/**\nLanguage descriptions are used to store metadata about languages\nand to dynamically load them. Their main role is finding the\nappropriate language for a filename or dynamically loading nested\nparsers.\n*/\nclass LanguageDescription {\n constructor(\n /**\n The name of this language.\n */\n name, \n /**\n Alternative names for the mode (lowercased, includes `this.name`).\n */\n alias, \n /**\n File extensions associated with this language.\n */\n extensions, \n /**\n Optional filename pattern that should be associated with this\n language.\n */\n filename, loadFunc, \n /**\n If the language has been loaded, this will hold its value.\n */\n support = undefined) {\n this.name = name;\n this.alias = alias;\n this.extensions = extensions;\n this.filename = filename;\n this.loadFunc = loadFunc;\n this.support = support;\n this.loading = null;\n }\n /**\n Start loading the the language. Will return a promise that\n resolves to a [`LanguageSupport`](https://codemirror.net/6/docs/ref/#language.LanguageSupport)\n object when the language successfully loads.\n */\n load() {\n return this.loading || (this.loading = this.loadFunc().then(support => this.support = support, err => { this.loading = null; throw err; }));\n }\n /**\n Create a language description.\n */\n static of(spec) {\n let { load, support } = spec;\n if (!load) {\n if (!support)\n throw new RangeError("Must pass either \'load\' or \'support\' to LanguageDescription.of");\n load = () => Promise.resolve(support);\n }\n return new LanguageDescription(spec.name, (spec.alias || []).concat(spec.name).map(s => s.toLowerCase()), spec.extensions || [], spec.filename, load, support);\n }\n /**\n Look for a language in the given array of descriptions that\n matches the filename. Will first match\n [`filename`](https://codemirror.net/6/docs/ref/#language.LanguageDescription.filename) patterns,\n and then [extensions](https://codemirror.net/6/docs/ref/#language.LanguageDescription.extensions),\n and return the first language that matches.\n */\n static matchFilename(descs, filename) {\n for (let d of descs)\n if (d.filename && d.filename.test(filename))\n return d;\n let ext = /\\.([^.]+)$/.exec(filename);\n if (ext)\n for (let d of descs)\n if (d.extensions.indexOf(ext[1]) > -1)\n return d;\n return null;\n }\n /**\n Look for a language whose name or alias matches the the given\n name (case-insensitively). If `fuzzy` is true, and no direct\n matchs is found, this\'ll also search for a language whose name\n or alias occurs in the string (for names shorter than three\n characters, only when surrounded by non-word characters).\n */\n static matchLanguageName(descs, name, fuzzy = true) {\n name = name.toLowerCase();\n for (let d of descs)\n if (d.alias.some(a => a == name))\n return d;\n if (fuzzy)\n for (let d of descs)\n for (let a of d.alias) {\n let found = name.indexOf(a);\n if (found > -1 && (a.length > 2 || !/\\w/.test(name[found - 1]) && !/\\w/.test(name[found + a.length])))\n return d;\n }\n return null;\n }\n}\n\n/**\nFacet that defines a way to provide a function that computes the\nappropriate indentation depth, as a column number (see\n[`indentString`](https://codemirror.net/6/docs/ref/#language.indentString)), at the start of a given\nline. A return value of `null` indicates no indentation can be\ndetermined, and the line should inherit the indentation of the one\nabove it. A return value of `undefined` defers to the next indent\nservice.\n*/\nconst indentService = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define();\n/**\nFacet for overriding the unit by which indentation happens. Should\nbe a string consisting either entirely of the same whitespace\ncharacter. When not set, this defaults to 2 spaces.\n*/\nconst indentUnit = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define({\n combine: values => {\n if (!values.length)\n return " ";\n let unit = values[0];\n if (!unit || /\\S/.test(unit) || Array.from(unit).some(e => e != unit[0]))\n throw new Error("Invalid indent unit: " + JSON.stringify(values[0]));\n return unit;\n }\n});\n/**\nReturn the _column width_ of an indent unit in the state.\nDetermined by the [`indentUnit`](https://codemirror.net/6/docs/ref/#language.indentUnit)\nfacet, and [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) when that\ncontains tabs.\n*/\nfunction getIndentUnit(state) {\n let unit = state.facet(indentUnit);\n return unit.charCodeAt(0) == 9 ? state.tabSize * unit.length : unit.length;\n}\n/**\nCreate an indentation string that covers columns 0 to `cols`.\nWill use tabs for as much of the columns as possible when the\n[`indentUnit`](https://codemirror.net/6/docs/ref/#language.indentUnit) facet contains\ntabs.\n*/\nfunction indentString(state, cols) {\n let result = "", ts = state.tabSize, ch = state.facet(indentUnit)[0];\n if (ch == "\\t") {\n while (cols >= ts) {\n result += "\\t";\n cols -= ts;\n }\n ch = " ";\n }\n for (let i = 0; i < cols; i++)\n result += ch;\n return result;\n}\n/**\nGet the indentation, as a column number, at the given position.\nWill first consult any [indent services](https://codemirror.net/6/docs/ref/#language.indentService)\nthat are registered, and if none of those return an indentation,\nthis will check the syntax tree for the [indent node\nprop](https://codemirror.net/6/docs/ref/#language.indentNodeProp) and use that if found. Returns a\nnumber when an indentation could be determined, and null\notherwise.\n*/\nfunction getIndentation(context, pos) {\n if (context instanceof _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.EditorState)\n context = new IndentContext(context);\n for (let service of context.state.facet(indentService)) {\n let result = service(context, pos);\n if (result !== undefined)\n return result;\n }\n let tree = syntaxTree(context.state);\n return tree.length >= pos ? syntaxIndentation(context, tree, pos) : null;\n}\n/**\nCreate a change set that auto-indents all lines touched by the\ngiven document range.\n*/\nfunction indentRange(state, from, to) {\n let updated = Object.create(null);\n let context = new IndentContext(state, { overrideIndentation: start => { var _a; return (_a = updated[start]) !== null && _a !== void 0 ? _a : -1; } });\n let changes = [];\n for (let pos = from; pos <= to;) {\n let line = state.doc.lineAt(pos);\n pos = line.to + 1;\n let indent = getIndentation(context, line.from);\n if (indent == null)\n continue;\n if (!/\\S/.test(line.text))\n indent = 0;\n let cur = /^\\s*/.exec(line.text)[0];\n let norm = indentString(state, indent);\n if (cur != norm) {\n updated[line.from] = indent;\n changes.push({ from: line.from, to: line.from + cur.length, insert: norm });\n }\n }\n return state.changes(changes);\n}\n/**\nIndentation contexts are used when calling [indentation\nservices](https://codemirror.net/6/docs/ref/#language.indentService). They provide helper utilities\nuseful in indentation logic, and can selectively override the\nindentation reported for some lines.\n*/\nclass IndentContext {\n /**\n Create an indent context.\n */\n constructor(\n /**\n The editor state.\n */\n state, \n /**\n @internal\n */\n options = {}) {\n this.state = state;\n this.options = options;\n this.unit = getIndentUnit(state);\n }\n /**\n Get a description of the line at the given position, taking\n [simulated line\n breaks](https://codemirror.net/6/docs/ref/#language.IndentContext.constructor^options.simulateBreak)\n into account. If there is such a break at `pos`, the `bias`\n argument determines whether the part of the line line before or\n after the break is used.\n */\n lineAt(pos, bias = 1) {\n let line = this.state.doc.lineAt(pos);\n let { simulateBreak, simulateDoubleBreak } = this.options;\n if (simulateBreak != null && simulateBreak >= line.from && simulateBreak <= line.to) {\n if (simulateDoubleBreak && simulateBreak == pos)\n return { text: "", from: pos };\n else if (bias < 0 ? simulateBreak < pos : simulateBreak <= pos)\n return { text: line.text.slice(simulateBreak - line.from), from: simulateBreak };\n else\n return { text: line.text.slice(0, simulateBreak - line.from), from: line.from };\n }\n return line;\n }\n /**\n Get the text directly after `pos`, either the entire line\n or the next 100 characters, whichever is shorter.\n */\n textAfterPos(pos, bias = 1) {\n if (this.options.simulateDoubleBreak && pos == this.options.simulateBreak)\n return "";\n let { text, from } = this.lineAt(pos, bias);\n return text.slice(pos - from, Math.min(text.length, pos + 100 - from));\n }\n /**\n Find the column for the given position.\n */\n column(pos, bias = 1) {\n let { text, from } = this.lineAt(pos, bias);\n let result = this.countColumn(text, pos - from);\n let override = this.options.overrideIndentation ? this.options.overrideIndentation(from) : -1;\n if (override > -1)\n result += override - this.countColumn(text, text.search(/\\S|$/));\n return result;\n }\n /**\n Find the column position (taking tabs into account) of the given\n position in the given string.\n */\n countColumn(line, pos = line.length) {\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.countColumn)(line, this.state.tabSize, pos);\n }\n /**\n Find the indentation column of the line at the given point.\n */\n lineIndent(pos, bias = 1) {\n let { text, from } = this.lineAt(pos, bias);\n let override = this.options.overrideIndentation;\n if (override) {\n let overriden = override(from);\n if (overriden > -1)\n return overriden;\n }\n return this.countColumn(text, text.search(/\\S|$/));\n }\n /**\n Returns the [simulated line\n break](https://codemirror.net/6/docs/ref/#language.IndentContext.constructor^options.simulateBreak)\n for this context, if any.\n */\n get simulatedBreak() {\n return this.options.simulateBreak || null;\n }\n}\n/**\nA syntax tree node prop used to associate indentation strategies\nwith node types. Such a strategy is a function from an indentation\ncontext to a column number (see also\n[`indentString`](https://codemirror.net/6/docs/ref/#language.indentString)) or null, where null\nindicates that no definitive indentation can be determined.\n*/\nconst indentNodeProp = /*@__PURE__*/new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp();\n// Compute the indentation for a given position from the syntax tree.\nfunction syntaxIndentation(cx, ast, pos) {\n let stack = ast.resolveStack(pos);\n let inner = stack.node.enterUnfinishedNodesBefore(pos);\n if (inner != stack.node) {\n let add = [];\n for (let cur = inner; cur != stack.node; cur = cur.parent)\n add.push(cur);\n for (let i = add.length - 1; i >= 0; i--)\n stack = { node: add[i], next: stack };\n }\n return indentFor(stack, cx, pos);\n}\nfunction indentFor(stack, cx, pos) {\n for (let cur = stack; cur; cur = cur.next) {\n let strategy = indentStrategy(cur.node);\n if (strategy)\n return strategy(TreeIndentContext.create(cx, pos, cur));\n }\n return 0;\n}\nfunction ignoreClosed(cx) {\n return cx.pos == cx.options.simulateBreak && cx.options.simulateDoubleBreak;\n}\nfunction indentStrategy(tree) {\n let strategy = tree.type.prop(indentNodeProp);\n if (strategy)\n return strategy;\n let first = tree.firstChild, close;\n if (first && (close = first.type.prop(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.closedBy))) {\n let last = tree.lastChild, closed = last && close.indexOf(last.name) > -1;\n return cx => delimitedStrategy(cx, true, 1, undefined, closed && !ignoreClosed(cx) ? last.from : undefined);\n }\n return tree.parent == null ? topIndent : null;\n}\nfunction topIndent() { return 0; }\n/**\nObjects of this type provide context information and helper\nmethods to indentation functions registered on syntax nodes.\n*/\nclass TreeIndentContext extends IndentContext {\n constructor(base, \n /**\n The position at which indentation is being computed.\n */\n pos, \n /**\n @internal\n */\n context) {\n super(base.state, base.options);\n this.base = base;\n this.pos = pos;\n this.context = context;\n }\n /**\n The syntax tree node to which the indentation strategy\n applies.\n */\n get node() { return this.context.node; }\n /**\n @internal\n */\n static create(base, pos, context) {\n return new TreeIndentContext(base, pos, context);\n }\n /**\n Get the text directly after `this.pos`, either the entire line\n or the next 100 characters, whichever is shorter.\n */\n get textAfter() {\n return this.textAfterPos(this.pos);\n }\n /**\n Get the indentation at the reference line for `this.node`, which\n is the line on which it starts, unless there is a node that is\n _not_ a parent of this node covering the start of that line. If\n so, the line at the start of that node is tried, again skipping\n on if it is covered by another such node.\n */\n get baseIndent() {\n return this.baseIndentFor(this.node);\n }\n /**\n Get the indentation for the reference line of the given node\n (see [`baseIndent`](https://codemirror.net/6/docs/ref/#language.TreeIndentContext.baseIndent)).\n */\n baseIndentFor(node) {\n let line = this.state.doc.lineAt(node.from);\n // Skip line starts that are covered by a sibling (or cousin, etc)\n for (;;) {\n let atBreak = node.resolve(line.from);\n while (atBreak.parent && atBreak.parent.from == atBreak.from)\n atBreak = atBreak.parent;\n if (isParent(atBreak, node))\n break;\n line = this.state.doc.lineAt(atBreak.from);\n }\n return this.lineIndent(line.from);\n }\n /**\n Continue looking for indentations in the node\'s parent nodes,\n and return the result of that.\n */\n continue() {\n return indentFor(this.context.next, this.base, this.pos);\n }\n}\nfunction isParent(parent, of) {\n for (let cur = of; cur; cur = cur.parent)\n if (parent == cur)\n return true;\n return false;\n}\n// Check whether a delimited node is aligned (meaning there are\n// non-skipped nodes on the same line as the opening delimiter). And\n// if so, return the opening token.\nfunction bracketedAligned(context) {\n let tree = context.node;\n let openToken = tree.childAfter(tree.from), last = tree.lastChild;\n if (!openToken)\n return null;\n let sim = context.options.simulateBreak;\n let openLine = context.state.doc.lineAt(openToken.from);\n let lineEnd = sim == null || sim <= openLine.from ? openLine.to : Math.min(openLine.to, sim);\n for (let pos = openToken.to;;) {\n let next = tree.childAfter(pos);\n if (!next || next == last)\n return null;\n if (!next.type.isSkipped)\n return next.from < lineEnd ? openToken : null;\n pos = next.to;\n }\n}\n/**\nAn indentation strategy for delimited (usually bracketed) nodes.\nWill, by default, indent one unit more than the parent\'s base\nindent unless the line starts with a closing token. When `align`\nis true and there are non-skipped nodes on the node\'s opening\nline, the content of the node will be aligned with the end of the\nopening node, like this:\n\n foo(bar,\n baz)\n*/\nfunction delimitedIndent({ closing, align = true, units = 1 }) {\n return (context) => delimitedStrategy(context, align, units, closing);\n}\nfunction delimitedStrategy(context, align, units, closing, closedAt) {\n let after = context.textAfter, space = after.match(/^\\s*/)[0].length;\n let closed = closing && after.slice(space, space + closing.length) == closing || closedAt == context.pos + space;\n let aligned = align ? bracketedAligned(context) : null;\n if (aligned)\n return closed ? context.column(aligned.from) : context.column(aligned.to);\n return context.baseIndent + (closed ? 0 : context.unit * units);\n}\n/**\nAn indentation strategy that aligns a node\'s content to its base\nindentation.\n*/\nconst flatIndent = (context) => context.baseIndent;\n/**\nCreates an indentation strategy that, by default, indents\ncontinued lines one unit more than the node\'s base indentation.\nYou can provide `except` to prevent indentation of lines that\nmatch a pattern (for example `/^else\\b/` in `if`/`else`\nconstructs), and you can change the amount of units used with the\n`units` option.\n*/\nfunction continuedIndent({ except, units = 1 } = {}) {\n return (context) => {\n let matchExcept = except && except.test(context.textAfter);\n return context.baseIndent + (matchExcept ? 0 : units * context.unit);\n };\n}\nconst DontIndentBeyond = 200;\n/**\nEnables reindentation on input. When a language defines an\n`indentOnInput` field in its [language\ndata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt), which must hold a regular\nexpression, the line at the cursor will be reindented whenever new\ntext is typed and the input from the start of the line up to the\ncursor matches that regexp.\n\nTo avoid unneccesary reindents, it is recommended to start the\nregexp with `^` (usually followed by `\\s*`), and end it with `$`.\nFor example, `/^\\s*\\}$/` will reindent when a closing brace is\nadded at the start of a line.\n*/\nfunction indentOnInput() {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.EditorState.transactionFilter.of(tr => {\n if (!tr.docChanged || !tr.isUserEvent("input.type") && !tr.isUserEvent("input.complete"))\n return tr;\n let rules = tr.startState.languageDataAt("indentOnInput", tr.startState.selection.main.head);\n if (!rules.length)\n return tr;\n let doc = tr.newDoc, { head } = tr.newSelection.main, line = doc.lineAt(head);\n if (head > line.from + DontIndentBeyond)\n return tr;\n let lineStart = doc.sliceString(line.from, head);\n if (!rules.some(r => r.test(lineStart)))\n return tr;\n let { state } = tr, last = -1, changes = [];\n for (let { head } of state.selection.ranges) {\n let line = state.doc.lineAt(head);\n if (line.from == last)\n continue;\n last = line.from;\n let indent = getIndentation(state, line.from);\n if (indent == null)\n continue;\n let cur = /^\\s*/.exec(line.text)[0];\n let norm = indentString(state, indent);\n if (cur != norm)\n changes.push({ from: line.from, to: line.from + cur.length, insert: norm });\n }\n return changes.length ? [tr, { changes, sequential: true }] : tr;\n });\n}\n\n/**\nA facet that registers a code folding service. When called with\nthe extent of a line, such a function should return a foldable\nrange that starts on that line (but continues beyond it), if one\ncan be found.\n*/\nconst foldService = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define();\n/**\nThis node prop is used to associate folding information with\nsyntax node types. Given a syntax node, it should check whether\nthat tree is foldable and return the range that can be collapsed\nwhen it is.\n*/\nconst foldNodeProp = /*@__PURE__*/new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp();\n/**\n[Fold](https://codemirror.net/6/docs/ref/#language.foldNodeProp) function that folds everything but\nthe first and the last child of a syntax node. Useful for nodes\nthat start and end with delimiters.\n*/\nfunction foldInside(node) {\n let first = node.firstChild, last = node.lastChild;\n return first && first.to < last.from ? { from: first.to, to: last.type.isError ? node.to : last.from } : null;\n}\nfunction syntaxFolding(state, start, end) {\n let tree = syntaxTree(state);\n if (tree.length < end)\n return null;\n let stack = tree.resolveStack(end, 1);\n let found = null;\n for (let iter = stack; iter; iter = iter.next) {\n let cur = iter.node;\n if (cur.to <= end || cur.from > end)\n continue;\n if (found && cur.from < start)\n break;\n let prop = cur.type.prop(foldNodeProp);\n if (prop && (cur.to < tree.length - 50 || tree.length == state.doc.length || !isUnfinished(cur))) {\n let value = prop(cur, state);\n if (value && value.from <= end && value.from >= start && value.to > end)\n found = value;\n }\n }\n return found;\n}\nfunction isUnfinished(node) {\n let ch = node.lastChild;\n return ch && ch.to == node.to && ch.type.isError;\n}\n/**\nCheck whether the given line is foldable. First asks any fold\nservices registered through\n[`foldService`](https://codemirror.net/6/docs/ref/#language.foldService), and if none of them return\na result, tries to query the [fold node\nprop](https://codemirror.net/6/docs/ref/#language.foldNodeProp) of syntax nodes that cover the end\nof the line.\n*/\nfunction foldable(state, lineStart, lineEnd) {\n for (let service of state.facet(foldService)) {\n let result = service(state, lineStart, lineEnd);\n if (result)\n return result;\n }\n return syntaxFolding(state, lineStart, lineEnd);\n}\nfunction mapRange(range, mapping) {\n let from = mapping.mapPos(range.from, 1), to = mapping.mapPos(range.to, -1);\n return from >= to ? undefined : { from, to };\n}\n/**\nState effect that can be attached to a transaction to fold the\ngiven range. (You probably only need this in exceptional\ncircumstances—usually you\'ll just want to let\n[`foldCode`](https://codemirror.net/6/docs/ref/#language.foldCode) and the [fold\ngutter](https://codemirror.net/6/docs/ref/#language.foldGutter) create the transactions.)\n*/\nconst foldEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.StateEffect.define({ map: mapRange });\n/**\nState effect that unfolds the given range (if it was folded).\n*/\nconst unfoldEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.StateEffect.define({ map: mapRange });\nfunction selectedLines(view) {\n let lines = [];\n for (let { head } of view.state.selection.ranges) {\n if (lines.some(l => l.from <= head && l.to >= head))\n continue;\n lines.push(view.lineBlockAt(head));\n }\n return lines;\n}\n/**\nThe state field that stores the folded ranges (as a [decoration\nset](https://codemirror.net/6/docs/ref/#view.DecorationSet)). Can be passed to\n[`EditorState.toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) and\n[`fromJSON`](https://codemirror.net/6/docs/ref/#state.EditorState^fromJSON) to serialize the fold\nstate.\n*/\nconst foldState = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.StateField.define({\n create() {\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.none;\n },\n update(folded, tr) {\n folded = folded.map(tr.changes);\n for (let e of tr.effects) {\n if (e.is(foldEffect) && !foldExists(folded, e.value.from, e.value.to)) {\n let { preparePlaceholder } = tr.state.facet(foldConfig);\n let widget = !preparePlaceholder ? foldWidget :\n _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.replace({ widget: new PreparedFoldWidget(preparePlaceholder(tr.state, e.value)) });\n folded = folded.update({ add: [widget.range(e.value.from, e.value.to)] });\n }\n else if (e.is(unfoldEffect)) {\n folded = folded.update({ filter: (from, to) => e.value.from != from || e.value.to != to,\n filterFrom: e.value.from, filterTo: e.value.to });\n }\n }\n // Clear folded ranges that cover the selection head\n if (tr.selection) {\n let onSelection = false, { head } = tr.selection.main;\n folded.between(head, head, (a, b) => { if (a < head && b > head)\n onSelection = true; });\n if (onSelection)\n folded = folded.update({\n filterFrom: head,\n filterTo: head,\n filter: (a, b) => b <= head || a >= head\n });\n }\n return folded;\n },\n provide: f => _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.decorations.from(f),\n toJSON(folded, state) {\n let ranges = [];\n folded.between(0, state.doc.length, (from, to) => { ranges.push(from, to); });\n return ranges;\n },\n fromJSON(value) {\n if (!Array.isArray(value) || value.length % 2)\n throw new RangeError("Invalid JSON for fold state");\n let ranges = [];\n for (let i = 0; i < value.length;) {\n let from = value[i++], to = value[i++];\n if (typeof from != "number" || typeof to != "number")\n throw new RangeError("Invalid JSON for fold state");\n ranges.push(foldWidget.range(from, to));\n }\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.set(ranges, true);\n }\n});\n/**\nGet a [range set](https://codemirror.net/6/docs/ref/#state.RangeSet) containing the folded ranges\nin the given state.\n*/\nfunction foldedRanges(state) {\n return state.field(foldState, false) || _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.RangeSet.empty;\n}\nfunction findFold(state, from, to) {\n var _a;\n let found = null;\n (_a = state.field(foldState, false)) === null || _a === void 0 ? void 0 : _a.between(from, to, (from, to) => {\n if (!found || found.from > from)\n found = { from, to };\n });\n return found;\n}\nfunction foldExists(folded, from, to) {\n let found = false;\n folded.between(from, from, (a, b) => { if (a == from && b == to)\n found = true; });\n return found;\n}\nfunction maybeEnable(state, other) {\n return state.field(foldState, false) ? other : other.concat(_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.StateEffect.appendConfig.of(codeFolding()));\n}\n/**\nFold the lines that are selected, if possible.\n*/\nconst foldCode = view => {\n for (let line of selectedLines(view)) {\n let range = foldable(view.state, line.from, line.to);\n if (range) {\n view.dispatch({ effects: maybeEnable(view.state, [foldEffect.of(range), announceFold(view, range)]) });\n return true;\n }\n }\n return false;\n};\n/**\nUnfold folded ranges on selected lines.\n*/\nconst unfoldCode = view => {\n if (!view.state.field(foldState, false))\n return false;\n let effects = [];\n for (let line of selectedLines(view)) {\n let folded = findFold(view.state, line.from, line.to);\n if (folded)\n effects.push(unfoldEffect.of(folded), announceFold(view, folded, false));\n }\n if (effects.length)\n view.dispatch({ effects });\n return effects.length > 0;\n};\nfunction announceFold(view, range, fold = true) {\n let lineFrom = view.state.doc.lineAt(range.from).number, lineTo = view.state.doc.lineAt(range.to).number;\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.announce.of(`${view.state.phrase(fold ? "Folded lines" : "Unfolded lines")} ${lineFrom} ${view.state.phrase("to")} ${lineTo}.`);\n}\n/**\nFold all top-level foldable ranges. Note that, in most cases,\nfolding information will depend on the [syntax\ntree](https://codemirror.net/6/docs/ref/#language.syntaxTree), and folding everything may not work\nreliably when the document hasn\'t been fully parsed (either\nbecause the editor state was only just initialized, or because the\ndocument is so big that the parser decided not to parse it\nentirely).\n*/\nconst foldAll = view => {\n let { state } = view, effects = [];\n for (let pos = 0; pos < state.doc.length;) {\n let line = view.lineBlockAt(pos), range = foldable(state, line.from, line.to);\n if (range)\n effects.push(foldEffect.of(range));\n pos = (range ? view.lineBlockAt(range.to) : line).to + 1;\n }\n if (effects.length)\n view.dispatch({ effects: maybeEnable(view.state, effects) });\n return !!effects.length;\n};\n/**\nUnfold all folded code.\n*/\nconst unfoldAll = view => {\n let field = view.state.field(foldState, false);\n if (!field || !field.size)\n return false;\n let effects = [];\n field.between(0, view.state.doc.length, (from, to) => { effects.push(unfoldEffect.of({ from, to })); });\n view.dispatch({ effects });\n return true;\n};\n// Find the foldable region containing the given line, if one exists\nfunction foldableContainer(view, lineBlock) {\n // Look backwards through line blocks until we find a foldable region that\n // intersects with the line\n for (let line = lineBlock;;) {\n let foldableRegion = foldable(view.state, line.from, line.to);\n if (foldableRegion && foldableRegion.to > lineBlock.from)\n return foldableRegion;\n if (!line.from)\n return null;\n line = view.lineBlockAt(line.from - 1);\n }\n}\n/**\nToggle folding at cursors. Unfolds if there is an existing fold\nstarting in that line, tries to find a foldable range around it\notherwise.\n*/\nconst toggleFold = (view) => {\n let effects = [];\n for (let line of selectedLines(view)) {\n let folded = findFold(view.state, line.from, line.to);\n if (folded) {\n effects.push(unfoldEffect.of(folded), announceFold(view, folded, false));\n }\n else {\n let foldRange = foldableContainer(view, line);\n if (foldRange)\n effects.push(foldEffect.of(foldRange), announceFold(view, foldRange));\n }\n }\n if (effects.length > 0)\n view.dispatch({ effects: maybeEnable(view.state, effects) });\n return !!effects.length;\n};\n/**\nDefault fold-related key bindings.\n\n - Ctrl-Shift-[ (Cmd-Alt-[ on macOS): [`foldCode`](https://codemirror.net/6/docs/ref/#language.foldCode).\n - Ctrl-Shift-] (Cmd-Alt-] on macOS): [`unfoldCode`](https://codemirror.net/6/docs/ref/#language.unfoldCode).\n - Ctrl-Alt-[: [`foldAll`](https://codemirror.net/6/docs/ref/#language.foldAll).\n - Ctrl-Alt-]: [`unfoldAll`](https://codemirror.net/6/docs/ref/#language.unfoldAll).\n*/\nconst foldKeymap = [\n { key: "Ctrl-Shift-[", mac: "Cmd-Alt-[", run: foldCode },\n { key: "Ctrl-Shift-]", mac: "Cmd-Alt-]", run: unfoldCode },\n { key: "Ctrl-Alt-[", run: foldAll },\n { key: "Ctrl-Alt-]", run: unfoldAll }\n];\nconst defaultConfig = {\n placeholderDOM: null,\n preparePlaceholder: null,\n placeholderText: "…"\n};\nconst foldConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define({\n combine(values) { return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.combineConfig)(values, defaultConfig); }\n});\n/**\nCreate an extension that configures code folding.\n*/\nfunction codeFolding(config) {\n let result = [foldState, baseTheme$1];\n if (config)\n result.push(foldConfig.of(config));\n return result;\n}\nfunction widgetToDOM(view, prepared) {\n let { state } = view, conf = state.facet(foldConfig);\n let onclick = (event) => {\n let line = view.lineBlockAt(view.posAtDOM(event.target));\n let folded = findFold(view.state, line.from, line.to);\n if (folded)\n view.dispatch({ effects: unfoldEffect.of(folded) });\n event.preventDefault();\n };\n if (conf.placeholderDOM)\n return conf.placeholderDOM(view, onclick, prepared);\n let element = document.createElement("span");\n element.textContent = conf.placeholderText;\n element.setAttribute("aria-label", state.phrase("folded code"));\n element.title = state.phrase("unfold");\n element.className = "cm-foldPlaceholder";\n element.onclick = onclick;\n return element;\n}\nconst foldWidget = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.replace({ widget: /*@__PURE__*/new class extends _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.WidgetType {\n toDOM(view) { return widgetToDOM(view, null); }\n } });\nclass PreparedFoldWidget extends _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.WidgetType {\n constructor(value) {\n super();\n this.value = value;\n }\n eq(other) { return this.value == other.value; }\n toDOM(view) { return widgetToDOM(view, this.value); }\n}\nconst foldGutterDefaults = {\n openText: "⌄",\n closedText: "›",\n markerDOM: null,\n domEventHandlers: {},\n foldingChanged: () => false\n};\nclass FoldMarker extends _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.GutterMarker {\n constructor(config, open) {\n super();\n this.config = config;\n this.open = open;\n }\n eq(other) { return this.config == other.config && this.open == other.open; }\n toDOM(view) {\n if (this.config.markerDOM)\n return this.config.markerDOM(this.open);\n let span = document.createElement("span");\n span.textContent = this.open ? this.config.openText : this.config.closedText;\n span.title = view.state.phrase(this.open ? "Fold line" : "Unfold line");\n return span;\n }\n}\n/**\nCreate an extension that registers a fold gutter, which shows a\nfold status indicator before foldable lines (which can be clicked\nto fold or unfold the line).\n*/\nfunction foldGutter(config = {}) {\n let fullConfig = Object.assign(Object.assign({}, foldGutterDefaults), config);\n let canFold = new FoldMarker(fullConfig, true), canUnfold = new FoldMarker(fullConfig, false);\n let markers = _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.ViewPlugin.fromClass(class {\n constructor(view) {\n this.from = view.viewport.from;\n this.markers = this.buildMarkers(view);\n }\n update(update) {\n if (update.docChanged || update.viewportChanged ||\n update.startState.facet(language) != update.state.facet(language) ||\n update.startState.field(foldState, false) != update.state.field(foldState, false) ||\n syntaxTree(update.startState) != syntaxTree(update.state) ||\n fullConfig.foldingChanged(update))\n this.markers = this.buildMarkers(update.view);\n }\n buildMarkers(view) {\n let builder = new _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.RangeSetBuilder();\n for (let line of view.viewportLineBlocks) {\n let mark = findFold(view.state, line.from, line.to) ? canUnfold\n : foldable(view.state, line.from, line.to) ? canFold : null;\n if (mark)\n builder.add(line.from, line.from, mark);\n }\n return builder.finish();\n }\n });\n let { domEventHandlers } = fullConfig;\n return [\n markers,\n (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.gutter)({\n class: "cm-foldGutter",\n markers(view) { var _a; return ((_a = view.plugin(markers)) === null || _a === void 0 ? void 0 : _a.markers) || _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.RangeSet.empty; },\n initialSpacer() {\n return new FoldMarker(fullConfig, false);\n },\n domEventHandlers: Object.assign(Object.assign({}, domEventHandlers), { click: (view, line, event) => {\n if (domEventHandlers.click && domEventHandlers.click(view, line, event))\n return true;\n let folded = findFold(view.state, line.from, line.to);\n if (folded) {\n view.dispatch({ effects: unfoldEffect.of(folded) });\n return true;\n }\n let range = foldable(view.state, line.from, line.to);\n if (range) {\n view.dispatch({ effects: foldEffect.of(range) });\n return true;\n }\n return false;\n } })\n }),\n codeFolding()\n ];\n}\nconst baseTheme$1 = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.baseTheme({\n ".cm-foldPlaceholder": {\n backgroundColor: "#eee",\n border: "1px solid #ddd",\n color: "#888",\n borderRadius: ".2em",\n margin: "0 1px",\n padding: "0 1px",\n cursor: "pointer"\n },\n ".cm-foldGutter span": {\n padding: "0 1px",\n cursor: "pointer"\n }\n});\n\n/**\nA highlight style associates CSS styles with higlighting\n[tags](https://lezer.codemirror.net/docs/ref#highlight.Tag).\n*/\nclass HighlightStyle {\n constructor(\n /**\n The tag styles used to create this highlight style.\n */\n specs, options) {\n this.specs = specs;\n let modSpec;\n function def(spec) {\n let cls = style_mod__WEBPACK_IMPORTED_MODULE_2__.StyleModule.newName();\n (modSpec || (modSpec = Object.create(null)))["." + cls] = spec;\n return cls;\n }\n const all = typeof options.all == "string" ? options.all : options.all ? def(options.all) : undefined;\n const scopeOpt = options.scope;\n this.scope = scopeOpt instanceof Language ? (type) => type.prop(languageDataProp) == scopeOpt.data\n : scopeOpt ? (type) => type == scopeOpt : undefined;\n this.style = (0,_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tagHighlighter)(specs.map(style => ({\n tag: style.tag,\n class: style.class || def(Object.assign({}, style, { tag: null }))\n })), {\n all,\n }).style;\n this.module = modSpec ? new style_mod__WEBPACK_IMPORTED_MODULE_2__.StyleModule(modSpec) : null;\n this.themeType = options.themeType;\n }\n /**\n Create a highlighter style that associates the given styles to\n the given tags. The specs must be objects that hold a style tag\n or array of tags in their `tag` property, and either a single\n `class` property providing a static CSS class (for highlighter\n that rely on external styling), or a\n [`style-mod`](https://github.com/marijnh/style-mod#documentation)-style\n set of CSS properties (which define the styling for those tags).\n \n The CSS rules created for a highlighter will be emitted in the\n order of the spec\'s properties. That means that for elements that\n have multiple tags associated with them, styles defined further\n down in the list will have a higher CSS precedence than styles\n defined earlier.\n */\n static define(specs, options) {\n return new HighlightStyle(specs, options || {});\n }\n}\nconst highlighterFacet = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define();\nconst fallbackHighlighter = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define({\n combine(values) { return values.length ? [values[0]] : null; }\n});\nfunction getHighlighters(state) {\n let main = state.facet(highlighterFacet);\n return main.length ? main : state.facet(fallbackHighlighter);\n}\n/**\nWrap a highlighter in an editor extension that uses it to apply\nsyntax highlighting to the editor content.\n\nWhen multiple (non-fallback) styles are provided, the styling\napplied is the union of the classes they emit.\n*/\nfunction syntaxHighlighting(highlighter, options) {\n let ext = [treeHighlighter], themeType;\n if (highlighter instanceof HighlightStyle) {\n if (highlighter.module)\n ext.push(_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.styleModule.of(highlighter.module));\n themeType = highlighter.themeType;\n }\n if (options === null || options === void 0 ? void 0 : options.fallback)\n ext.push(fallbackHighlighter.of(highlighter));\n else if (themeType)\n ext.push(highlighterFacet.computeN([_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.darkTheme], state => {\n return state.facet(_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.darkTheme) == (themeType == "dark") ? [highlighter] : [];\n }));\n else\n ext.push(highlighterFacet.of(highlighter));\n return ext;\n}\n/**\nReturns the CSS classes (if any) that the highlighters active in\nthe state would assign to the given style\n[tags](https://lezer.codemirror.net/docs/ref#highlight.Tag) and\n(optional) language\n[scope](https://codemirror.net/6/docs/ref/#language.HighlightStyle^define^options.scope).\n*/\nfunction highlightingFor(state, tags, scope) {\n let highlighters = getHighlighters(state);\n let result = null;\n if (highlighters)\n for (let highlighter of highlighters) {\n if (!highlighter.scope || scope && highlighter.scope(scope)) {\n let cls = highlighter.style(tags);\n if (cls)\n result = result ? result + " " + cls : cls;\n }\n }\n return result;\n}\nclass TreeHighlighter {\n constructor(view) {\n this.markCache = Object.create(null);\n this.tree = syntaxTree(view.state);\n this.decorations = this.buildDeco(view, getHighlighters(view.state));\n this.decoratedTo = view.viewport.to;\n }\n update(update) {\n let tree = syntaxTree(update.state), highlighters = getHighlighters(update.state);\n let styleChange = highlighters != getHighlighters(update.startState);\n let { viewport } = update.view, decoratedToMapped = update.changes.mapPos(this.decoratedTo, 1);\n if (tree.length < viewport.to && !styleChange && tree.type == this.tree.type && decoratedToMapped >= viewport.to) {\n this.decorations = this.decorations.map(update.changes);\n this.decoratedTo = decoratedToMapped;\n }\n else if (tree != this.tree || update.viewportChanged || styleChange) {\n this.tree = tree;\n this.decorations = this.buildDeco(update.view, highlighters);\n this.decoratedTo = viewport.to;\n }\n }\n buildDeco(view, highlighters) {\n if (!highlighters || !this.tree.length)\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.none;\n let builder = new _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.RangeSetBuilder();\n for (let { from, to } of view.visibleRanges) {\n (0,_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.highlightTree)(this.tree, highlighters, (from, to, style) => {\n builder.add(from, to, this.markCache[style] || (this.markCache[style] = _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.mark({ class: style })));\n }, from, to);\n }\n return builder.finish();\n }\n}\nconst treeHighlighter = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Prec.high(/*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.ViewPlugin.fromClass(TreeHighlighter, {\n decorations: v => v.decorations\n}));\n/**\nA default highlight style (works well with light themes).\n*/\nconst defaultHighlightStyle = /*@__PURE__*/HighlightStyle.define([\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.meta,\n color: "#404740" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.link,\n textDecoration: "underline" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.heading,\n textDecoration: "underline",\n fontWeight: "bold" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.emphasis,\n fontStyle: "italic" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.strong,\n fontWeight: "bold" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.strikethrough,\n textDecoration: "line-through" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.keyword,\n color: "#708" },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.atom, _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.bool, _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.url, _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.contentSeparator, _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.labelName],\n color: "#219" },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.literal, _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.inserted],\n color: "#164" },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.string, _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.deleted],\n color: "#a11" },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.regexp, _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.escape, /*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.string)],\n color: "#e40" },\n { tag: /*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName),\n color: "#00f" },\n { tag: /*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.local(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName),\n color: "#30a" },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.typeName, _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.namespace],\n color: "#085" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.className,\n color: "#167" },\n { tag: [/*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName), _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.macroName],\n color: "#256" },\n { tag: /*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.propertyName),\n color: "#00c" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.comment,\n color: "#940" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.invalid,\n color: "#f00" }\n]);\n\nconst baseTheme = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.baseTheme({\n "&.cm-focused .cm-matchingBracket": { backgroundColor: "#328c8252" },\n "&.cm-focused .cm-nonmatchingBracket": { backgroundColor: "#bb555544" }\n});\nconst DefaultScanDist = 10000, DefaultBrackets = "()[]{}";\nconst bracketMatchingConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define({\n combine(configs) {\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.combineConfig)(configs, {\n afterCursor: true,\n brackets: DefaultBrackets,\n maxScanDistance: DefaultScanDist,\n renderMatch: defaultRenderMatch\n });\n }\n});\nconst matchingMark = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.mark({ class: "cm-matchingBracket" }), nonmatchingMark = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.mark({ class: "cm-nonmatchingBracket" });\nfunction defaultRenderMatch(match) {\n let decorations = [];\n let mark = match.matched ? matchingMark : nonmatchingMark;\n decorations.push(mark.range(match.start.from, match.start.to));\n if (match.end)\n decorations.push(mark.range(match.end.from, match.end.to));\n return decorations;\n}\nconst bracketMatchingState = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.StateField.define({\n create() { return _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.none; },\n update(deco, tr) {\n if (!tr.docChanged && !tr.selection)\n return deco;\n let decorations = [];\n let config = tr.state.facet(bracketMatchingConfig);\n for (let range of tr.state.selection.ranges) {\n if (!range.empty)\n continue;\n let match = matchBrackets(tr.state, range.head, -1, config)\n || (range.head > 0 && matchBrackets(tr.state, range.head - 1, 1, config))\n || (config.afterCursor &&\n (matchBrackets(tr.state, range.head, 1, config) ||\n (range.head < tr.state.doc.length && matchBrackets(tr.state, range.head + 1, -1, config))));\n if (match)\n decorations = decorations.concat(config.renderMatch(match, tr.state));\n }\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.set(decorations, true);\n },\n provide: f => _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.decorations.from(f)\n});\nconst bracketMatchingUnique = [\n bracketMatchingState,\n baseTheme\n];\n/**\nCreate an extension that enables bracket matching. Whenever the\ncursor is next to a bracket, that bracket and the one it matches\nare highlighted. Or, when no matching bracket is found, another\nhighlighting style is used to indicate this.\n*/\nfunction bracketMatching(config = {}) {\n return [bracketMatchingConfig.of(config), bracketMatchingUnique];\n}\n/**\nWhen larger syntax nodes, such as HTML tags, are marked as\nopening/closing, it can be a bit messy to treat the whole node as\na matchable bracket. This node prop allows you to define, for such\na node, a ‘handle’—the part of the node that is highlighted, and\nthat the cursor must be on to activate highlighting in the first\nplace.\n*/\nconst bracketMatchingHandle = /*@__PURE__*/new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp();\nfunction matchingNodes(node, dir, brackets) {\n let byProp = node.prop(dir < 0 ? _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.openedBy : _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.closedBy);\n if (byProp)\n return byProp;\n if (node.name.length == 1) {\n let index = brackets.indexOf(node.name);\n if (index > -1 && index % 2 == (dir < 0 ? 1 : 0))\n return [brackets[index + dir]];\n }\n return null;\n}\nfunction findHandle(node) {\n let hasHandle = node.type.prop(bracketMatchingHandle);\n return hasHandle ? hasHandle(node.node) : node;\n}\n/**\nFind the matching bracket for the token at `pos`, scanning\ndirection `dir`. Only the `brackets` and `maxScanDistance`\nproperties are used from `config`, if given. Returns null if no\nbracket was found at `pos`, or a match result otherwise.\n*/\nfunction matchBrackets(state, pos, dir, config = {}) {\n let maxScanDistance = config.maxScanDistance || DefaultScanDist, brackets = config.brackets || DefaultBrackets;\n let tree = syntaxTree(state), node = tree.resolveInner(pos, dir);\n for (let cur = node; cur; cur = cur.parent) {\n let matches = matchingNodes(cur.type, dir, brackets);\n if (matches && cur.from < cur.to) {\n let handle = findHandle(cur);\n if (handle && (dir > 0 ? pos >= handle.from && pos < handle.to : pos > handle.from && pos <= handle.to))\n return matchMarkedBrackets(state, pos, dir, cur, handle, matches, brackets);\n }\n }\n return matchPlainBrackets(state, pos, dir, tree, node.type, maxScanDistance, brackets);\n}\nfunction matchMarkedBrackets(_state, _pos, dir, token, handle, matching, brackets) {\n let parent = token.parent, firstToken = { from: handle.from, to: handle.to };\n let depth = 0, cursor = parent === null || parent === void 0 ? void 0 : parent.cursor();\n if (cursor && (dir < 0 ? cursor.childBefore(token.from) : cursor.childAfter(token.to)))\n do {\n if (dir < 0 ? cursor.to <= token.from : cursor.from >= token.to) {\n if (depth == 0 && matching.indexOf(cursor.type.name) > -1 && cursor.from < cursor.to) {\n let endHandle = findHandle(cursor);\n return { start: firstToken, end: endHandle ? { from: endHandle.from, to: endHandle.to } : undefined, matched: true };\n }\n else if (matchingNodes(cursor.type, dir, brackets)) {\n depth++;\n }\n else if (matchingNodes(cursor.type, -dir, brackets)) {\n if (depth == 0) {\n let endHandle = findHandle(cursor);\n return {\n start: firstToken,\n end: endHandle && endHandle.from < endHandle.to ? { from: endHandle.from, to: endHandle.to } : undefined,\n matched: false\n };\n }\n depth--;\n }\n }\n } while (dir < 0 ? cursor.prevSibling() : cursor.nextSibling());\n return { start: firstToken, matched: false };\n}\nfunction matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, brackets) {\n let startCh = dir < 0 ? state.sliceDoc(pos - 1, pos) : state.sliceDoc(pos, pos + 1);\n let bracket = brackets.indexOf(startCh);\n if (bracket < 0 || (bracket % 2 == 0) != (dir > 0))\n return null;\n let startToken = { from: dir < 0 ? pos - 1 : pos, to: dir > 0 ? pos + 1 : pos };\n let iter = state.doc.iterRange(pos, dir > 0 ? state.doc.length : 0), depth = 0;\n for (let distance = 0; !(iter.next()).done && distance <= maxScanDistance;) {\n let text = iter.value;\n if (dir < 0)\n distance += text.length;\n let basePos = pos + distance * dir;\n for (let pos = dir > 0 ? 0 : text.length - 1, end = dir > 0 ? text.length : -1; pos != end; pos += dir) {\n let found = brackets.indexOf(text[pos]);\n if (found < 0 || tree.resolveInner(basePos + pos, 1).type != tokenType)\n continue;\n if ((found % 2 == 0) == (dir > 0)) {\n depth++;\n }\n else if (depth == 1) { // Closing\n return { start: startToken, end: { from: basePos + pos, to: basePos + pos + 1 }, matched: (found >> 1) == (bracket >> 1) };\n }\n else {\n depth--;\n }\n }\n if (dir > 0)\n distance += text.length;\n }\n return iter.done ? { start: startToken, matched: false } : null;\n}\n\n// Counts the column offset in a string, taking tabs into account.\n// Used mostly to find indentation.\nfunction countCol(string, end, tabSize, startIndex = 0, startValue = 0) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1)\n end = string.length;\n }\n let n = startValue;\n for (let i = startIndex; i < end; i++) {\n if (string.charCodeAt(i) == 9)\n n += tabSize - (n % tabSize);\n else\n n++;\n }\n return n;\n}\n/**\nEncapsulates a single line of input. Given to stream syntax code,\nwhich uses it to tokenize the content.\n*/\nclass StringStream {\n /**\n Create a stream.\n */\n constructor(\n /**\n The line.\n */\n string, tabSize, \n /**\n The current indent unit size.\n */\n indentUnit, overrideIndent) {\n this.string = string;\n this.tabSize = tabSize;\n this.indentUnit = indentUnit;\n this.overrideIndent = overrideIndent;\n /**\n The current position on the line.\n */\n this.pos = 0;\n /**\n The start position of the current token.\n */\n this.start = 0;\n this.lastColumnPos = 0;\n this.lastColumnValue = 0;\n }\n /**\n True if we are at the end of the line.\n */\n eol() { return this.pos >= this.string.length; }\n /**\n True if we are at the start of the line.\n */\n sol() { return this.pos == 0; }\n /**\n Get the next code unit after the current position, or undefined\n if we\'re at the end of the line.\n */\n peek() { return this.string.charAt(this.pos) || undefined; }\n /**\n Read the next code unit and advance `this.pos`.\n */\n next() {\n if (this.pos < this.string.length)\n return this.string.charAt(this.pos++);\n }\n /**\n Match the next character against the given string, regular\n expression, or predicate. Consume and return it if it matches.\n */\n eat(match) {\n let ch = this.string.charAt(this.pos);\n let ok;\n if (typeof match == "string")\n ok = ch == match;\n else\n ok = ch && (match instanceof RegExp ? match.test(ch) : match(ch));\n if (ok) {\n ++this.pos;\n return ch;\n }\n }\n /**\n Continue matching characters that match the given string,\n regular expression, or predicate function. Return true if any\n characters were consumed.\n */\n eatWhile(match) {\n let start = this.pos;\n while (this.eat(match)) { }\n return this.pos > start;\n }\n /**\n Consume whitespace ahead of `this.pos`. Return true if any was\n found.\n */\n eatSpace() {\n let start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos)))\n ++this.pos;\n return this.pos > start;\n }\n /**\n Move to the end of the line.\n */\n skipToEnd() { this.pos = this.string.length; }\n /**\n Move to directly before the given character, if found on the\n current line.\n */\n skipTo(ch) {\n let found = this.string.indexOf(ch, this.pos);\n if (found > -1) {\n this.pos = found;\n return true;\n }\n }\n /**\n Move back `n` characters.\n */\n backUp(n) { this.pos -= n; }\n /**\n Get the column position at `this.pos`.\n */\n column() {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countCol(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n return this.lastColumnValue;\n }\n /**\n Get the indentation column of the current line.\n */\n indentation() {\n var _a;\n return (_a = this.overrideIndent) !== null && _a !== void 0 ? _a : countCol(this.string, null, this.tabSize);\n }\n /**\n Match the input against the given string or regular expression\n (which should start with a `^`). Return true or the regexp match\n if it matches.\n \n Unless `consume` is set to `false`, this will move `this.pos`\n past the matched text.\n \n When matching a string `caseInsensitive` can be set to true to\n make the match case-insensitive.\n */\n match(pattern, consume, caseInsensitive) {\n if (typeof pattern == "string") {\n let cased = (str) => caseInsensitive ? str.toLowerCase() : str;\n let substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false)\n this.pos += pattern.length;\n return true;\n }\n else\n return null;\n }\n else {\n let match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0)\n return null;\n if (match && consume !== false)\n this.pos += match[0].length;\n return match;\n }\n }\n /**\n Get the current token.\n */\n current() { return this.string.slice(this.start, this.pos); }\n}\n\nfunction fullParser(spec) {\n return {\n name: spec.name || "",\n token: spec.token,\n blankLine: spec.blankLine || (() => { }),\n startState: spec.startState || (() => true),\n copyState: spec.copyState || defaultCopyState,\n indent: spec.indent || (() => null),\n languageData: spec.languageData || {},\n tokenTable: spec.tokenTable || noTokens\n };\n}\nfunction defaultCopyState(state) {\n if (typeof state != "object")\n return state;\n let newState = {};\n for (let prop in state) {\n let val = state[prop];\n newState[prop] = (val instanceof Array ? val.slice() : val);\n }\n return newState;\n}\nconst IndentedFrom = /*@__PURE__*/new WeakMap();\n/**\nA [language](https://codemirror.net/6/docs/ref/#language.Language) class based on a CodeMirror\n5-style [streaming parser](https://codemirror.net/6/docs/ref/#language.StreamParser).\n*/\nclass StreamLanguage extends Language {\n constructor(parser) {\n let data = defineLanguageFacet(parser.languageData);\n let p = fullParser(parser), self;\n let impl = new class extends _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Parser {\n createParse(input, fragments, ranges) {\n return new Parse(self, input, fragments, ranges);\n }\n };\n super(data, impl, [indentService.of((cx, pos) => this.getIndent(cx, pos))], parser.name);\n this.topNode = docID(data);\n self = this;\n this.streamParser = p;\n this.stateAfter = new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp({ perNode: true });\n this.tokenTable = parser.tokenTable ? new TokenTable(p.tokenTable) : defaultTokenTable;\n }\n /**\n Define a stream language.\n */\n static define(spec) { return new StreamLanguage(spec); }\n getIndent(cx, pos) {\n let tree = syntaxTree(cx.state), at = tree.resolve(pos);\n while (at && at.type != this.topNode)\n at = at.parent;\n if (!at)\n return null;\n let from = undefined;\n let { overrideIndentation } = cx.options;\n if (overrideIndentation) {\n from = IndentedFrom.get(cx.state);\n if (from != null && from < pos - 1e4)\n from = undefined;\n }\n let start = findState(this, tree, 0, at.from, from !== null && from !== void 0 ? from : pos), statePos, state;\n if (start) {\n state = start.state;\n statePos = start.pos + 1;\n }\n else {\n state = this.streamParser.startState(cx.unit);\n statePos = 0;\n }\n if (pos - statePos > 10000 /* C.MaxIndentScanDist */)\n return null;\n while (statePos < pos) {\n let line = cx.state.doc.lineAt(statePos), end = Math.min(pos, line.to);\n if (line.length) {\n let indentation = overrideIndentation ? overrideIndentation(line.from) : -1;\n let stream = new StringStream(line.text, cx.state.tabSize, cx.unit, indentation < 0 ? undefined : indentation);\n while (stream.pos < end - line.from)\n readToken(this.streamParser.token, stream, state);\n }\n else {\n this.streamParser.blankLine(state, cx.unit);\n }\n if (end == pos)\n break;\n statePos = line.to + 1;\n }\n let line = cx.lineAt(pos);\n if (overrideIndentation && from == null)\n IndentedFrom.set(cx.state, line.from);\n return this.streamParser.indent(state, /^\\s*(.*)/.exec(line.text)[1], cx);\n }\n get allowsNesting() { return false; }\n}\nfunction findState(lang, tree, off, startPos, before) {\n let state = off >= startPos && off + tree.length <= before && tree.prop(lang.stateAfter);\n if (state)\n return { state: lang.streamParser.copyState(state), pos: off + tree.length };\n for (let i = tree.children.length - 1; i >= 0; i--) {\n let child = tree.children[i], pos = off + tree.positions[i];\n let found = child instanceof _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree && pos < before && findState(lang, child, pos, startPos, before);\n if (found)\n return found;\n }\n return null;\n}\nfunction cutTree(lang, tree, from, to, inside) {\n if (inside && from <= 0 && to >= tree.length)\n return tree;\n if (!inside && tree.type == lang.topNode)\n inside = true;\n for (let i = tree.children.length - 1; i >= 0; i--) {\n let pos = tree.positions[i], child = tree.children[i], inner;\n if (pos < to && child instanceof _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree) {\n if (!(inner = cutTree(lang, child, from - pos, to - pos, inside)))\n break;\n return !inside ? inner\n : new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree(tree.type, tree.children.slice(0, i).concat(inner), tree.positions.slice(0, i + 1), pos + inner.length);\n }\n }\n return null;\n}\nfunction findStartInFragments(lang, fragments, startPos, editorState) {\n for (let f of fragments) {\n let from = f.from + (f.openStart ? 25 : 0), to = f.to - (f.openEnd ? 25 : 0);\n let found = from <= startPos && to > startPos && findState(lang, f.tree, 0 - f.offset, startPos, to), tree;\n if (found && (tree = cutTree(lang, f.tree, startPos + f.offset, found.pos + f.offset, false)))\n return { state: found.state, tree };\n }\n return { state: lang.streamParser.startState(editorState ? getIndentUnit(editorState) : 4), tree: _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree.empty };\n}\nclass Parse {\n constructor(lang, input, fragments, ranges) {\n this.lang = lang;\n this.input = input;\n this.fragments = fragments;\n this.ranges = ranges;\n this.stoppedAt = null;\n this.chunks = [];\n this.chunkPos = [];\n this.chunk = [];\n this.chunkReused = undefined;\n this.rangeIndex = 0;\n this.to = ranges[ranges.length - 1].to;\n let context = ParseContext.get(), from = ranges[0].from;\n let { state, tree } = findStartInFragments(lang, fragments, from, context === null || context === void 0 ? void 0 : context.state);\n this.state = state;\n this.parsedPos = this.chunkStart = from + tree.length;\n for (let i = 0; i < tree.children.length; i++) {\n this.chunks.push(tree.children[i]);\n this.chunkPos.push(tree.positions[i]);\n }\n if (context && this.parsedPos < context.viewport.from - 100000 /* C.MaxDistanceBeforeViewport */) {\n this.state = this.lang.streamParser.startState(getIndentUnit(context.state));\n context.skipUntilInView(this.parsedPos, context.viewport.from);\n this.parsedPos = context.viewport.from;\n }\n this.moveRangeIndex();\n }\n advance() {\n let context = ParseContext.get();\n let parseEnd = this.stoppedAt == null ? this.to : Math.min(this.to, this.stoppedAt);\n let end = Math.min(parseEnd, this.chunkStart + 2048 /* C.ChunkSize */);\n if (context)\n end = Math.min(end, context.viewport.to);\n while (this.parsedPos < end)\n this.parseLine(context);\n if (this.chunkStart < this.parsedPos)\n this.finishChunk();\n if (this.parsedPos >= parseEnd)\n return this.finish();\n if (context && this.parsedPos >= context.viewport.to) {\n context.skipUntilInView(this.parsedPos, parseEnd);\n return this.finish();\n }\n return null;\n }\n stopAt(pos) {\n this.stoppedAt = pos;\n }\n lineAfter(pos) {\n let chunk = this.input.chunk(pos);\n if (!this.input.lineChunks) {\n let eol = chunk.indexOf("\\n");\n if (eol > -1)\n chunk = chunk.slice(0, eol);\n }\n else if (chunk == "\\n") {\n chunk = "";\n }\n return pos + chunk.length <= this.to ? chunk : chunk.slice(0, this.to - pos);\n }\n nextLine() {\n let from = this.parsedPos, line = this.lineAfter(from), end = from + line.length;\n for (let index = this.rangeIndex;;) {\n let rangeEnd = this.ranges[index].to;\n if (rangeEnd >= end)\n break;\n line = line.slice(0, rangeEnd - (end - line.length));\n index++;\n if (index == this.ranges.length)\n break;\n let rangeStart = this.ranges[index].from;\n let after = this.lineAfter(rangeStart);\n line += after;\n end = rangeStart + after.length;\n }\n return { line, end };\n }\n skipGapsTo(pos, offset, side) {\n for (;;) {\n let end = this.ranges[this.rangeIndex].to, offPos = pos + offset;\n if (side > 0 ? end > offPos : end >= offPos)\n break;\n let start = this.ranges[++this.rangeIndex].from;\n offset += start - end;\n }\n return offset;\n }\n moveRangeIndex() {\n while (this.ranges[this.rangeIndex].to < this.parsedPos)\n this.rangeIndex++;\n }\n emitToken(id, from, to, size, offset) {\n if (this.ranges.length > 1) {\n offset = this.skipGapsTo(from, offset, 1);\n from += offset;\n let len0 = this.chunk.length;\n offset = this.skipGapsTo(to, offset, -1);\n to += offset;\n size += this.chunk.length - len0;\n }\n this.chunk.push(id, from, to, size);\n return offset;\n }\n parseLine(context) {\n let { line, end } = this.nextLine(), offset = 0, { streamParser } = this.lang;\n let stream = new StringStream(line, context ? context.state.tabSize : 4, context ? getIndentUnit(context.state) : 2);\n if (stream.eol()) {\n streamParser.blankLine(this.state, stream.indentUnit);\n }\n else {\n while (!stream.eol()) {\n let token = readToken(streamParser.token, stream, this.state);\n if (token)\n offset = this.emitToken(this.lang.tokenTable.resolve(token), this.parsedPos + stream.start, this.parsedPos + stream.pos, 4, offset);\n if (stream.start > 10000 /* C.MaxLineLength */)\n break;\n }\n }\n this.parsedPos = end;\n this.moveRangeIndex();\n if (this.parsedPos < this.to)\n this.parsedPos++;\n }\n finishChunk() {\n let tree = _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree.build({\n buffer: this.chunk,\n start: this.chunkStart,\n length: this.parsedPos - this.chunkStart,\n nodeSet,\n topID: 0,\n maxBufferLength: 2048 /* C.ChunkSize */,\n reused: this.chunkReused\n });\n tree = new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree(tree.type, tree.children, tree.positions, tree.length, [[this.lang.stateAfter, this.lang.streamParser.copyState(this.state)]]);\n this.chunks.push(tree);\n this.chunkPos.push(this.chunkStart - this.ranges[0].from);\n this.chunk = [];\n this.chunkReused = undefined;\n this.chunkStart = this.parsedPos;\n }\n finish() {\n return new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree(this.lang.topNode, this.chunks, this.chunkPos, this.parsedPos - this.ranges[0].from).balance();\n }\n}\nfunction readToken(token, stream, state) {\n stream.start = stream.pos;\n for (let i = 0; i < 10; i++) {\n let result = token(stream, state);\n if (stream.pos > stream.start)\n return result;\n }\n throw new Error("Stream parser failed to advance stream.");\n}\nconst noTokens = /*@__PURE__*/Object.create(null);\nconst typeArray = [_lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeType.none];\nconst nodeSet = /*@__PURE__*/new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeSet(typeArray);\nconst warned = [];\n// Cache of node types by name and tags\nconst byTag = /*@__PURE__*/Object.create(null);\nconst defaultTable = /*@__PURE__*/Object.create(null);\nfor (let [legacyName, name] of [\n ["variable", "variableName"],\n ["variable-2", "variableName.special"],\n ["string-2", "string.special"],\n ["def", "variableName.definition"],\n ["tag", "tagName"],\n ["attribute", "attributeName"],\n ["type", "typeName"],\n ["builtin", "variableName.standard"],\n ["qualifier", "modifier"],\n ["error", "invalid"],\n ["header", "heading"],\n ["property", "propertyName"]\n])\n defaultTable[legacyName] = /*@__PURE__*/createTokenType(noTokens, name);\nclass TokenTable {\n constructor(extra) {\n this.extra = extra;\n this.table = Object.assign(Object.create(null), defaultTable);\n }\n resolve(tag) {\n return !tag ? 0 : this.table[tag] || (this.table[tag] = createTokenType(this.extra, tag));\n }\n}\nconst defaultTokenTable = /*@__PURE__*/new TokenTable(noTokens);\nfunction warnForPart(part, msg) {\n if (warned.indexOf(part) > -1)\n return;\n warned.push(part);\n console.warn(msg);\n}\nfunction createTokenType(extra, tagStr) {\n let tags$1 = [];\n for (let name of tagStr.split(" ")) {\n let found = [];\n for (let part of name.split(".")) {\n let value = (extra[part] || _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags[part]);\n if (!value) {\n warnForPart(part, `Unknown highlighting tag ${part}`);\n }\n else if (typeof value == "function") {\n if (!found.length)\n warnForPart(part, `Modifier ${part} used at start of tag`);\n else\n found = found.map(value);\n }\n else {\n if (found.length)\n warnForPart(part, `Tag ${part} used as modifier`);\n else\n found = Array.isArray(value) ? value : [value];\n }\n }\n for (let tag of found)\n tags$1.push(tag);\n }\n if (!tags$1.length)\n return 0;\n let name = tagStr.replace(/ /g, "_"), key = name + " " + tags$1.map(t => t.id);\n let known = byTag[key];\n if (known)\n return known.id;\n let type = byTag[key] = _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeType.define({\n id: typeArray.length,\n name,\n props: [(0,_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.styleTags)({ [name]: tags$1 })]\n });\n typeArray.push(type);\n return type.id;\n}\nfunction docID(data) {\n let type = _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeType.define({ id: typeArray.length, name: "Document", props: [languageDataProp.add(() => data)], top: true });\n typeArray.push(type);\n return type;\n}\n\nfunction buildForLine(line) {\n return line.length <= 4096 && /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac\\ufb50-\\ufdff]/.test(line);\n}\nfunction textHasRTL(text) {\n for (let i = text.iter(); !i.next().done;)\n if (buildForLine(i.value))\n return true;\n return false;\n}\nfunction changeAddsRTL(change) {\n let added = false;\n change.iterChanges((fA, tA, fB, tB, ins) => {\n if (!added && textHasRTL(ins))\n added = true;\n });\n return added;\n}\nconst alwaysIsolate = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Facet.define({ combine: values => values.some(x => x) });\n/**\nMake sure nodes\n[marked](https://lezer.codemirror.net/docs/ref/#common.NodeProp^isolate)\nas isolating for bidirectional text are rendered in a way that\nisolates them from the surrounding text.\n*/\nfunction bidiIsolates(options = {}) {\n let extensions = [isolateMarks];\n if (options.alwaysIsolate)\n extensions.push(alwaysIsolate.of(true));\n return extensions;\n}\nconst isolateMarks = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.ViewPlugin.fromClass(class {\n constructor(view) {\n this.always = view.state.facet(alwaysIsolate) ||\n view.textDirection != _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Direction.LTR ||\n view.state.facet(_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.perLineTextDirection);\n this.hasRTL = !this.always && textHasRTL(view.state.doc);\n this.tree = syntaxTree(view.state);\n this.decorations = this.always || this.hasRTL ? buildDeco(view, this.tree, this.always) : _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.none;\n }\n update(update) {\n let always = update.state.facet(alwaysIsolate) ||\n update.view.textDirection != _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Direction.LTR ||\n update.state.facet(_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.perLineTextDirection);\n if (!always && !this.hasRTL && changeAddsRTL(update.changes))\n this.hasRTL = true;\n if (!always && !this.hasRTL)\n return;\n let tree = syntaxTree(update.state);\n if (always != this.always || tree != this.tree || update.docChanged || update.viewportChanged) {\n this.tree = tree;\n this.always = always;\n this.decorations = buildDeco(update.view, tree, always);\n }\n }\n}, {\n provide: plugin => {\n function access(view) {\n var _a, _b;\n return (_b = (_a = view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.decorations) !== null && _b !== void 0 ? _b : _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.none;\n }\n return [_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.outerDecorations.of(access),\n _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.Prec.lowest(_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.EditorView.bidiIsolatedRanges.of(access))];\n }\n});\nfunction buildDeco(view, tree, always) {\n let deco = new _codemirror_state__WEBPACK_IMPORTED_MODULE_3__.RangeSetBuilder();\n let ranges = view.visibleRanges;\n if (!always)\n ranges = clipRTLLines(ranges, view.state.doc);\n for (let { from, to } of ranges) {\n tree.iterate({\n enter: node => {\n let iso = node.type.prop(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.isolate);\n if (iso)\n deco.add(node.from, node.to, marks[iso]);\n },\n from, to\n });\n }\n return deco.finish();\n}\nfunction clipRTLLines(ranges, doc) {\n let cur = doc.iter(), pos = 0, result = [], last = null;\n for (let { from, to } of ranges) {\n if (last && last.to > from) {\n from = last.to;\n if (from >= to)\n continue;\n }\n if (pos + cur.value.length < from) {\n cur.next(from - (pos + cur.value.length));\n pos = from;\n }\n for (;;) {\n let start = pos, end = pos + cur.value.length;\n if (!cur.lineBreak && buildForLine(cur.value)) {\n if (last && last.to > start - 10)\n last.to = Math.min(to, end);\n else\n result.push(last = { from: start, to: Math.min(to, end) });\n }\n if (end >= to)\n break;\n pos = end;\n cur.next();\n }\n }\n return result;\n}\nconst marks = {\n rtl: /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "rtl" }, bidiIsolate: _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Direction.RTL }),\n ltr: /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "ltr" }, bidiIsolate: _codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Direction.LTR }),\n auto: /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_4__.Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "auto" }, bidiIsolate: null })\n};\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/language/dist/index.js?')},"./node_modules/@codemirror/lint/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ closeLintPanel: () => (/* binding */ closeLintPanel),\n/* harmony export */ diagnosticCount: () => (/* binding */ diagnosticCount),\n/* harmony export */ forEachDiagnostic: () => (/* binding */ forEachDiagnostic),\n/* harmony export */ forceLinting: () => (/* binding */ forceLinting),\n/* harmony export */ lintGutter: () => (/* binding */ lintGutter),\n/* harmony export */ lintKeymap: () => (/* binding */ lintKeymap),\n/* harmony export */ linter: () => (/* binding */ linter),\n/* harmony export */ nextDiagnostic: () => (/* binding */ nextDiagnostic),\n/* harmony export */ openLintPanel: () => (/* binding */ openLintPanel),\n/* harmony export */ previousDiagnostic: () => (/* binding */ previousDiagnostic),\n/* harmony export */ setDiagnostics: () => (/* binding */ setDiagnostics),\n/* harmony export */ setDiagnosticsEffect: () => (/* binding */ setDiagnosticsEffect)\n/* harmony export */ });\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var crelt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! crelt */ "./node_modules/crelt/index.js");\n\n\n\n\nclass SelectedDiagnostic {\n constructor(from, to, diagnostic) {\n this.from = from;\n this.to = to;\n this.diagnostic = diagnostic;\n }\n}\nclass LintState {\n constructor(diagnostics, panel, selected) {\n this.diagnostics = diagnostics;\n this.panel = panel;\n this.selected = selected;\n }\n static init(diagnostics, panel, state) {\n // Filter the list of diagnostics for which to create markers\n let markedDiagnostics = diagnostics;\n let diagnosticFilter = state.facet(lintConfig).markerFilter;\n if (diagnosticFilter)\n markedDiagnostics = diagnosticFilter(markedDiagnostics, state);\n let ranges = _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.Decoration.set(markedDiagnostics.map((d) => {\n // For zero-length ranges or ranges covering only a line break, create a widget\n return d.from == d.to || (d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from)\n ? _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.Decoration.widget({\n widget: new DiagnosticWidget(d),\n diagnostic: d\n }).range(d.from)\n : _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.Decoration.mark({\n attributes: { class: "cm-lintRange cm-lintRange-" + d.severity + (d.markClass ? " " + d.markClass : "") },\n diagnostic: d\n }).range(d.from, d.to);\n }), true);\n return new LintState(ranges, panel, findDiagnostic(ranges));\n }\n}\nfunction findDiagnostic(diagnostics, diagnostic = null, after = 0) {\n let found = null;\n diagnostics.between(after, 1e9, (from, to, { spec }) => {\n if (diagnostic && spec.diagnostic != diagnostic)\n return;\n found = new SelectedDiagnostic(from, to, spec.diagnostic);\n return false;\n });\n return found;\n}\nfunction hideTooltip(tr, tooltip) {\n let from = tooltip.pos, to = tooltip.end || from;\n let result = tr.state.facet(lintConfig).hideOn(tr, from, to);\n if (result != null)\n return result;\n let line = tr.startState.doc.lineAt(tooltip.pos);\n return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, Math.max(line.to, to)));\n}\nfunction maybeEnableLint(state, effects) {\n return state.field(lintState, false) ? effects : effects.concat(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.appendConfig.of(lintExtensions));\n}\n/**\nReturns a transaction spec which updates the current set of\ndiagnostics, and enables the lint extension if if wasn\'t already\nactive.\n*/\nfunction setDiagnostics(state, diagnostics) {\n return {\n effects: maybeEnableLint(state, [setDiagnosticsEffect.of(diagnostics)])\n };\n}\n/**\nThe state effect that updates the set of active diagnostics. Can\nbe useful when writing an extension that needs to track these.\n*/\nconst setDiagnosticsEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define();\nconst togglePanel = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define();\nconst movePanelSelection = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define();\nconst lintState = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateField.define({\n create() {\n return new LintState(_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.Decoration.none, null, null);\n },\n update(value, tr) {\n if (tr.docChanged && value.diagnostics.size) {\n let mapped = value.diagnostics.map(tr.changes), selected = null, panel = value.panel;\n if (value.selected) {\n let selPos = tr.changes.mapPos(value.selected.from, 1);\n selected = findDiagnostic(mapped, value.selected.diagnostic, selPos) || findDiagnostic(mapped, null, selPos);\n }\n if (!mapped.size && panel && tr.state.facet(lintConfig).autoPanel)\n panel = null;\n value = new LintState(mapped, panel, selected);\n }\n for (let effect of tr.effects) {\n if (effect.is(setDiagnosticsEffect)) {\n let panel = !tr.state.facet(lintConfig).autoPanel ? value.panel : effect.value.length ? LintPanel.open : null;\n value = LintState.init(effect.value, panel, tr.state);\n }\n else if (effect.is(togglePanel)) {\n value = new LintState(value.diagnostics, effect.value ? LintPanel.open : null, value.selected);\n }\n else if (effect.is(movePanelSelection)) {\n value = new LintState(value.diagnostics, value.panel, effect.value);\n }\n }\n return value;\n },\n provide: f => [_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.showPanel.from(f, val => val.panel),\n _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.decorations.from(f, s => s.diagnostics)]\n});\n/**\nReturns the number of active lint diagnostics in the given state.\n*/\nfunction diagnosticCount(state) {\n let lint = state.field(lintState, false);\n return lint ? lint.diagnostics.size : 0;\n}\nconst activeMark = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });\nfunction lintTooltip(view, pos, side) {\n let { diagnostics } = view.state.field(lintState);\n let found = [], stackStart = 2e8, stackEnd = 0;\n diagnostics.between(pos - (side < 0 ? 1 : 0), pos + (side > 0 ? 1 : 0), (from, to, { spec }) => {\n if (pos >= from && pos <= to &&\n (from == to || ((pos > from || side > 0) && (pos < to || side < 0)))) {\n found.push(spec.diagnostic);\n stackStart = Math.min(from, stackStart);\n stackEnd = Math.max(to, stackEnd);\n }\n });\n let diagnosticFilter = view.state.facet(lintConfig).tooltipFilter;\n if (diagnosticFilter)\n found = diagnosticFilter(found, view.state);\n if (!found.length)\n return null;\n return {\n pos: stackStart,\n end: stackEnd,\n above: view.state.doc.lineAt(stackStart).to < stackEnd,\n create() {\n return { dom: diagnosticsTooltip(view, found) };\n }\n };\n}\nfunction diagnosticsTooltip(view, diagnostics) {\n return (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("ul", { class: "cm-tooltip-lint" }, diagnostics.map(d => renderDiagnostic(view, d, false)));\n}\n/**\nCommand to open and focus the lint panel.\n*/\nconst openLintPanel = (view) => {\n let field = view.state.field(lintState, false);\n if (!field || !field.panel)\n view.dispatch({ effects: maybeEnableLint(view.state, [togglePanel.of(true)]) });\n let panel = (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.getPanel)(view, LintPanel.open);\n if (panel)\n panel.dom.querySelector(".cm-panel-lint ul").focus();\n return true;\n};\n/**\nCommand to close the lint panel, when open.\n*/\nconst closeLintPanel = (view) => {\n let field = view.state.field(lintState, false);\n if (!field || !field.panel)\n return false;\n view.dispatch({ effects: togglePanel.of(false) });\n return true;\n};\n/**\nMove the selection to the next diagnostic.\n*/\nconst nextDiagnostic = (view) => {\n let field = view.state.field(lintState, false);\n if (!field)\n return false;\n let sel = view.state.selection.main, next = field.diagnostics.iter(sel.to + 1);\n if (!next.value) {\n next = field.diagnostics.iter(0);\n if (!next.value || next.from == sel.from && next.to == sel.to)\n return false;\n }\n view.dispatch({ selection: { anchor: next.from, head: next.to }, scrollIntoView: true });\n return true;\n};\n/**\nMove the selection to the previous diagnostic.\n*/\nconst previousDiagnostic = (view) => {\n let { state } = view, field = state.field(lintState, false);\n if (!field)\n return false;\n let sel = state.selection.main;\n let prevFrom, prevTo, lastFrom, lastTo;\n field.diagnostics.between(0, state.doc.length, (from, to) => {\n if (to < sel.to && (prevFrom == null || prevFrom < from)) {\n prevFrom = from;\n prevTo = to;\n }\n if (lastFrom == null || from > lastFrom) {\n lastFrom = from;\n lastTo = to;\n }\n });\n if (lastFrom == null || prevFrom == null && lastFrom == sel.from)\n return false;\n view.dispatch({ selection: { anchor: prevFrom !== null && prevFrom !== void 0 ? prevFrom : lastFrom, head: prevTo !== null && prevTo !== void 0 ? prevTo : lastTo }, scrollIntoView: true });\n return true;\n};\n/**\nA set of default key bindings for the lint functionality.\n\n- Ctrl-Shift-m (Cmd-Shift-m on macOS): [`openLintPanel`](https://codemirror.net/6/docs/ref/#lint.openLintPanel)\n- F8: [`nextDiagnostic`](https://codemirror.net/6/docs/ref/#lint.nextDiagnostic)\n*/\nconst lintKeymap = [\n { key: "Mod-Shift-m", run: openLintPanel, preventDefault: true },\n { key: "F8", run: nextDiagnostic }\n];\nconst lintPlugin = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.timeout = -1;\n this.set = true;\n let { delay } = view.state.facet(lintConfig);\n this.lintTime = Date.now() + delay;\n this.run = this.run.bind(this);\n this.timeout = setTimeout(this.run, delay);\n }\n run() {\n clearTimeout(this.timeout);\n let now = Date.now();\n if (now < this.lintTime - 10) {\n this.timeout = setTimeout(this.run, this.lintTime - now);\n }\n else {\n this.set = false;\n let { state } = this.view, { sources } = state.facet(lintConfig);\n if (sources.length)\n Promise.all(sources.map(source => Promise.resolve(source(this.view)))).then(annotations => {\n let all = annotations.reduce((a, b) => a.concat(b));\n if (this.view.state.doc == state.doc)\n this.view.dispatch(setDiagnostics(this.view.state, all));\n }, error => { (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.logException)(this.view.state, error); });\n }\n }\n update(update) {\n let config = update.state.facet(lintConfig);\n if (update.docChanged || config != update.startState.facet(lintConfig) ||\n config.needsRefresh && config.needsRefresh(update)) {\n this.lintTime = Date.now() + config.delay;\n if (!this.set) {\n this.set = true;\n this.timeout = setTimeout(this.run, config.delay);\n }\n }\n }\n force() {\n if (this.set) {\n this.lintTime = Date.now();\n this.run();\n }\n }\n destroy() {\n clearTimeout(this.timeout);\n }\n});\nconst lintConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine(input) {\n return Object.assign({ sources: input.map(i => i.source).filter(x => x != null) }, (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.combineConfig)(input.map(i => i.config), {\n delay: 750,\n markerFilter: null,\n tooltipFilter: null,\n needsRefresh: null,\n hideOn: () => null,\n }, {\n needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u)\n }));\n }\n});\n/**\nGiven a diagnostic source, this function returns an extension that\nenables linting with that source. It will be called whenever the\neditor is idle (after its content changed). If `null` is given as\nsource, this only configures the lint extension.\n*/\nfunction linter(source, config = {}) {\n return [\n lintConfig.of({ source, config }),\n lintPlugin,\n lintExtensions\n ];\n}\n/**\nForces any linters [configured](https://codemirror.net/6/docs/ref/#lint.linter) to run when the\neditor is idle to run right away.\n*/\nfunction forceLinting(view) {\n let plugin = view.plugin(lintPlugin);\n if (plugin)\n plugin.force();\n}\nfunction assignKeys(actions) {\n let assigned = [];\n if (actions)\n actions: for (let { name } of actions) {\n for (let i = 0; i < name.length; i++) {\n let ch = name[i];\n if (/[a-zA-Z]/.test(ch) && !assigned.some(c => c.toLowerCase() == ch.toLowerCase())) {\n assigned.push(ch);\n continue actions;\n }\n }\n assigned.push("");\n }\n return assigned;\n}\nfunction renderDiagnostic(view, diagnostic, inPanel) {\n var _a;\n let keys = inPanel ? assignKeys(diagnostic.actions) : [];\n return (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage(view) : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {\n let fired = false, click = (e) => {\n e.preventDefault();\n if (fired)\n return;\n fired = true;\n let found = findDiagnostic(view.state.field(lintState).diagnostics, diagnostic);\n if (found)\n action.apply(view, found.from, found.to);\n };\n let { name } = action, keyIndex = keys[i] ? name.indexOf(keys[i]) : -1;\n let nameElt = keyIndex < 0 ? name : [name.slice(0, keyIndex),\n (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("u", name.slice(keyIndex, keyIndex + 1)),\n name.slice(keyIndex + 1)];\n return (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("button", {\n type: "button",\n class: "cm-diagnosticAction",\n onclick: click,\n onmousedown: click,\n "aria-label": ` Action: ${name}${keyIndex < 0 ? "" : ` (access key "${keys[i]})"`}.`\n }, nameElt);\n }), diagnostic.source && (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("div", { class: "cm-diagnosticSource" }, diagnostic.source));\n}\nclass DiagnosticWidget extends _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.WidgetType {\n constructor(diagnostic) {\n super();\n this.diagnostic = diagnostic;\n }\n eq(other) { return other.diagnostic == this.diagnostic; }\n toDOM() {\n return (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("span", { class: "cm-lintPoint cm-lintPoint-" + this.diagnostic.severity });\n }\n}\nclass PanelItem {\n constructor(view, diagnostic) {\n this.diagnostic = diagnostic;\n this.id = "item_" + Math.floor(Math.random() * 0xffffffff).toString(16);\n this.dom = renderDiagnostic(view, diagnostic, true);\n this.dom.id = this.id;\n this.dom.setAttribute("role", "option");\n }\n}\nclass LintPanel {\n constructor(view) {\n this.view = view;\n this.items = [];\n let onkeydown = (event) => {\n if (event.keyCode == 27) { // Escape\n closeLintPanel(this.view);\n this.view.focus();\n }\n else if (event.keyCode == 38 || event.keyCode == 33) { // ArrowUp, PageUp\n this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);\n }\n else if (event.keyCode == 40 || event.keyCode == 34) { // ArrowDown, PageDown\n this.moveSelection((this.selectedIndex + 1) % this.items.length);\n }\n else if (event.keyCode == 36) { // Home\n this.moveSelection(0);\n }\n else if (event.keyCode == 35) { // End\n this.moveSelection(this.items.length - 1);\n }\n else if (event.keyCode == 13) { // Enter\n this.view.focus();\n }\n else if (event.keyCode >= 65 && event.keyCode <= 90 && this.selectedIndex >= 0) { // A-Z\n let { diagnostic } = this.items[this.selectedIndex], keys = assignKeys(diagnostic.actions);\n for (let i = 0; i < keys.length; i++)\n if (keys[i].toUpperCase().charCodeAt(0) == event.keyCode) {\n let found = findDiagnostic(this.view.state.field(lintState).diagnostics, diagnostic);\n if (found)\n diagnostic.actions[i].apply(view, found.from, found.to);\n }\n }\n else {\n return;\n }\n event.preventDefault();\n };\n let onclick = (event) => {\n for (let i = 0; i < this.items.length; i++) {\n if (this.items[i].dom.contains(event.target))\n this.moveSelection(i);\n }\n };\n this.list = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("ul", {\n tabIndex: 0,\n role: "listbox",\n "aria-label": this.view.state.phrase("Diagnostics"),\n onkeydown,\n onclick\n });\n this.dom = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("div", { class: "cm-panel-lint" }, this.list, (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("button", {\n type: "button",\n name: "close",\n "aria-label": this.view.state.phrase("close"),\n onclick: () => closeLintPanel(this.view)\n }, "×"));\n this.update();\n }\n get selectedIndex() {\n let selected = this.view.state.field(lintState).selected;\n if (!selected)\n return -1;\n for (let i = 0; i < this.items.length; i++)\n if (this.items[i].diagnostic == selected.diagnostic)\n return i;\n return -1;\n }\n update() {\n let { diagnostics, selected } = this.view.state.field(lintState);\n let i = 0, needsSync = false, newSelectedItem = null;\n diagnostics.between(0, this.view.state.doc.length, (_start, _end, { spec }) => {\n let found = -1, item;\n for (let j = i; j < this.items.length; j++)\n if (this.items[j].diagnostic == spec.diagnostic) {\n found = j;\n break;\n }\n if (found < 0) {\n item = new PanelItem(this.view, spec.diagnostic);\n this.items.splice(i, 0, item);\n needsSync = true;\n }\n else {\n item = this.items[found];\n if (found > i) {\n this.items.splice(i, found - i);\n needsSync = true;\n }\n }\n if (selected && item.diagnostic == selected.diagnostic) {\n if (!item.dom.hasAttribute("aria-selected")) {\n item.dom.setAttribute("aria-selected", "true");\n newSelectedItem = item;\n }\n }\n else if (item.dom.hasAttribute("aria-selected")) {\n item.dom.removeAttribute("aria-selected");\n }\n i++;\n });\n while (i < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0)) {\n needsSync = true;\n this.items.pop();\n }\n if (this.items.length == 0) {\n this.items.push(new PanelItem(this.view, {\n from: -1, to: -1,\n severity: "info",\n message: this.view.state.phrase("No diagnostics")\n }));\n needsSync = true;\n }\n if (newSelectedItem) {\n this.list.setAttribute("aria-activedescendant", newSelectedItem.id);\n this.view.requestMeasure({\n key: this,\n read: () => ({ sel: newSelectedItem.dom.getBoundingClientRect(), panel: this.list.getBoundingClientRect() }),\n write: ({ sel, panel }) => {\n let scaleY = panel.height / this.list.offsetHeight;\n if (sel.top < panel.top)\n this.list.scrollTop -= (panel.top - sel.top) / scaleY;\n else if (sel.bottom > panel.bottom)\n this.list.scrollTop += (sel.bottom - panel.bottom) / scaleY;\n }\n });\n }\n else if (this.selectedIndex < 0) {\n this.list.removeAttribute("aria-activedescendant");\n }\n if (needsSync)\n this.sync();\n }\n sync() {\n let domPos = this.list.firstChild;\n function rm() {\n let prev = domPos;\n domPos = prev.nextSibling;\n prev.remove();\n }\n for (let item of this.items) {\n if (item.dom.parentNode == this.list) {\n while (domPos != item.dom)\n rm();\n domPos = item.dom.nextSibling;\n }\n else {\n this.list.insertBefore(item.dom, domPos);\n }\n }\n while (domPos)\n rm();\n }\n moveSelection(selectedIndex) {\n if (this.selectedIndex < 0)\n return;\n let field = this.view.state.field(lintState);\n let selection = findDiagnostic(field.diagnostics, this.items[selectedIndex].diagnostic);\n if (!selection)\n return;\n this.view.dispatch({\n selection: { anchor: selection.from, head: selection.to },\n scrollIntoView: true,\n effects: movePanelSelection.of(selection)\n });\n }\n static open(view) { return new LintPanel(view); }\n}\nfunction svg(content, attrs = `viewBox="0 0 40 40"`) {\n return `url(\'data:image/svg+xml,${encodeURIComponent(content)}\')`;\n}\nfunction underline(color) {\n return svg(``, `width="6" height="3"`);\n}\nconst baseTheme = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.baseTheme({\n ".cm-diagnostic": {\n padding: "3px 6px 3px 8px",\n marginLeft: "-1px",\n display: "block",\n whiteSpace: "pre-wrap"\n },\n ".cm-diagnostic-error": { borderLeft: "5px solid #d11" },\n ".cm-diagnostic-warning": { borderLeft: "5px solid orange" },\n ".cm-diagnostic-info": { borderLeft: "5px solid #999" },\n ".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },\n ".cm-diagnosticAction": {\n font: "inherit",\n border: "none",\n padding: "2px 4px",\n backgroundColor: "#444",\n color: "white",\n borderRadius: "3px",\n marginLeft: "8px",\n cursor: "pointer"\n },\n ".cm-diagnosticSource": {\n fontSize: "70%",\n opacity: .7\n },\n ".cm-lintRange": {\n backgroundPosition: "left bottom",\n backgroundRepeat: "repeat-x",\n paddingBottom: "0.7px",\n },\n ".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#d11") },\n ".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/underline("orange") },\n ".cm-lintRange-info": { backgroundImage: /*@__PURE__*/underline("#999") },\n ".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/underline("#66d") },\n ".cm-lintRange-active": { backgroundColor: "#ffdd9980" },\n ".cm-tooltip-lint": {\n padding: 0,\n margin: 0\n },\n ".cm-lintPoint": {\n position: "relative",\n "&:after": {\n content: \'""\',\n position: "absolute",\n bottom: 0,\n left: "-2px",\n borderLeft: "3px solid transparent",\n borderRight: "3px solid transparent",\n borderBottom: "4px solid #d11"\n }\n },\n ".cm-lintPoint-warning": {\n "&:after": { borderBottomColor: "orange" }\n },\n ".cm-lintPoint-info": {\n "&:after": { borderBottomColor: "#999" }\n },\n ".cm-lintPoint-hint": {\n "&:after": { borderBottomColor: "#66d" }\n },\n ".cm-panel.cm-panel-lint": {\n position: "relative",\n "& ul": {\n maxHeight: "100px",\n overflowY: "auto",\n "& [aria-selected]": {\n backgroundColor: "#ddd",\n "& u": { textDecoration: "underline" }\n },\n "&:focus [aria-selected]": {\n background_fallback: "#bdf",\n backgroundColor: "Highlight",\n color_fallback: "white",\n color: "HighlightText"\n },\n "& u": { textDecoration: "none" },\n padding: 0,\n margin: 0\n },\n "& [name=close]": {\n position: "absolute",\n top: "0",\n right: "2px",\n background: "inherit",\n border: "none",\n font: "inherit",\n padding: 0,\n margin: 0\n }\n }\n});\nfunction severityWeight(sev) {\n return sev == "error" ? 4 : sev == "warning" ? 3 : sev == "info" ? 2 : 1;\n}\nclass LintGutterMarker extends _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.GutterMarker {\n constructor(diagnostics) {\n super();\n this.diagnostics = diagnostics;\n this.severity = diagnostics.reduce((max, d) => severityWeight(max) < severityWeight(d.severity) ? d.severity : max, "hint");\n }\n toDOM(view) {\n let elt = document.createElement("div");\n elt.className = "cm-lint-marker cm-lint-marker-" + this.severity;\n let diagnostics = this.diagnostics;\n let diagnosticsFilter = view.state.facet(lintGutterConfig).tooltipFilter;\n if (diagnosticsFilter)\n diagnostics = diagnosticsFilter(diagnostics, view.state);\n if (diagnostics.length)\n elt.onmouseover = () => gutterMarkerMouseOver(view, elt, diagnostics);\n return elt;\n }\n}\nfunction trackHoverOn(view, marker) {\n let mousemove = (event) => {\n let rect = marker.getBoundingClientRect();\n if (event.clientX > rect.left - 10 /* Hover.Margin */ && event.clientX < rect.right + 10 /* Hover.Margin */ &&\n event.clientY > rect.top - 10 /* Hover.Margin */ && event.clientY < rect.bottom + 10 /* Hover.Margin */)\n return;\n for (let target = event.target; target; target = target.parentNode) {\n if (target.nodeType == 1 && target.classList.contains("cm-tooltip-lint"))\n return;\n }\n window.removeEventListener("mousemove", mousemove);\n if (view.state.field(lintGutterTooltip))\n view.dispatch({ effects: setLintGutterTooltip.of(null) });\n };\n window.addEventListener("mousemove", mousemove);\n}\nfunction gutterMarkerMouseOver(view, marker, diagnostics) {\n function hovered() {\n let line = view.elementAtHeight(marker.getBoundingClientRect().top + 5 - view.documentTop);\n const linePos = view.coordsAtPos(line.from);\n if (linePos) {\n view.dispatch({ effects: setLintGutterTooltip.of({\n pos: line.from,\n above: false,\n create() {\n return {\n dom: diagnosticsTooltip(view, diagnostics),\n getCoords: () => marker.getBoundingClientRect()\n };\n }\n }) });\n }\n marker.onmouseout = marker.onmousemove = null;\n trackHoverOn(view, marker);\n }\n let { hoverTime } = view.state.facet(lintGutterConfig);\n let hoverTimeout = setTimeout(hovered, hoverTime);\n marker.onmouseout = () => {\n clearTimeout(hoverTimeout);\n marker.onmouseout = marker.onmousemove = null;\n };\n marker.onmousemove = () => {\n clearTimeout(hoverTimeout);\n hoverTimeout = setTimeout(hovered, hoverTime);\n };\n}\nfunction markersForDiagnostics(doc, diagnostics) {\n let byLine = Object.create(null);\n for (let diagnostic of diagnostics) {\n let line = doc.lineAt(diagnostic.from);\n (byLine[line.from] || (byLine[line.from] = [])).push(diagnostic);\n }\n let markers = [];\n for (let line in byLine) {\n markers.push(new LintGutterMarker(byLine[line]).range(+line));\n }\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.of(markers, true);\n}\nconst lintGutterExtension = /*@__PURE__*/(0,_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.gutter)({\n class: "cm-gutter-lint",\n markers: view => view.state.field(lintGutterMarkers),\n});\nconst lintGutterMarkers = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateField.define({\n create() {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.empty;\n },\n update(markers, tr) {\n markers = markers.map(tr.changes);\n let diagnosticFilter = tr.state.facet(lintGutterConfig).markerFilter;\n for (let effect of tr.effects) {\n if (effect.is(setDiagnosticsEffect)) {\n let diagnostics = effect.value;\n if (diagnosticFilter)\n diagnostics = diagnosticFilter(diagnostics || [], tr.state);\n markers = markersForDiagnostics(tr.state.doc, diagnostics.slice(0));\n }\n }\n return markers;\n }\n});\nconst setLintGutterTooltip = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define();\nconst lintGutterTooltip = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateField.define({\n create() { return null; },\n update(tooltip, tr) {\n if (tooltip && tr.docChanged)\n tooltip = hideTooltip(tr, tooltip) ? null : Object.assign(Object.assign({}, tooltip), { pos: tr.changes.mapPos(tooltip.pos) });\n return tr.effects.reduce((t, e) => e.is(setLintGutterTooltip) ? e.value : t, tooltip);\n },\n provide: field => _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.showTooltip.from(field)\n});\nconst lintGutterTheme = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.baseTheme({\n ".cm-gutter-lint": {\n width: "1.4em",\n "& .cm-gutterElement": {\n padding: ".2em"\n }\n },\n ".cm-lint-marker": {\n width: "1em",\n height: "1em"\n },\n ".cm-lint-marker-info": {\n content: /*@__PURE__*/svg(``)\n },\n ".cm-lint-marker-warning": {\n content: /*@__PURE__*/svg(``),\n },\n ".cm-lint-marker-error": {\n content: /*@__PURE__*/svg(``)\n },\n});\nconst lintExtensions = [\n lintState,\n /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.decorations.compute([lintState], state => {\n let { selected, panel } = state.field(lintState);\n return !selected || !panel || selected.from == selected.to ? _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.Decoration.none : _codemirror_view__WEBPACK_IMPORTED_MODULE_1__.Decoration.set([\n activeMark.range(selected.from, selected.to)\n ]);\n }),\n /*@__PURE__*/(0,_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.hoverTooltip)(lintTooltip, { hideOn: hideTooltip }),\n baseTheme\n];\nconst lintGutterConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine(configs) {\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.combineConfig)(configs, {\n hoverTime: 300 /* Hover.Time */,\n markerFilter: null,\n tooltipFilter: null\n });\n }\n});\n/**\nReturns an extension that installs a gutter showing markers for\neach line that has diagnostics, which can be hovered over to see\nthe diagnostics.\n*/\nfunction lintGutter(config = {}) {\n return [lintGutterConfig.of(config), lintGutterMarkers, lintGutterExtension, lintGutterTheme, lintGutterTooltip];\n}\n/**\nIterate over the marked diagnostics for the given editor state,\ncalling `f` for each of them. Note that, if the document changed\nsince the diagnostics were created, the `Diagnostic` object will\nhold the original outdated position, whereas the `to` and `from`\narguments hold the diagnostic\'s current position.\n*/\nfunction forEachDiagnostic(state, f) {\n let lState = state.field(lintState, false);\n if (lState && lState.diagnostics.size)\n for (let iter = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.iter([lState.diagnostics]); iter.value; iter.next())\n f(iter.value.spec.diagnostic, iter.from, iter.to);\n}\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/lint/dist/index.js?')},"./node_modules/@codemirror/search/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RegExpCursor: () => (/* binding */ RegExpCursor),\n/* harmony export */ SearchCursor: () => (/* binding */ SearchCursor),\n/* harmony export */ SearchQuery: () => (/* binding */ SearchQuery),\n/* harmony export */ closeSearchPanel: () => (/* binding */ closeSearchPanel),\n/* harmony export */ findNext: () => (/* binding */ findNext),\n/* harmony export */ findPrevious: () => (/* binding */ findPrevious),\n/* harmony export */ getSearchQuery: () => (/* binding */ getSearchQuery),\n/* harmony export */ gotoLine: () => (/* binding */ gotoLine),\n/* harmony export */ highlightSelectionMatches: () => (/* binding */ highlightSelectionMatches),\n/* harmony export */ openSearchPanel: () => (/* binding */ openSearchPanel),\n/* harmony export */ replaceAll: () => (/* binding */ replaceAll),\n/* harmony export */ replaceNext: () => (/* binding */ replaceNext),\n/* harmony export */ search: () => (/* binding */ search),\n/* harmony export */ searchKeymap: () => (/* binding */ searchKeymap),\n/* harmony export */ searchPanelOpen: () => (/* binding */ searchPanelOpen),\n/* harmony export */ selectMatches: () => (/* binding */ selectMatches),\n/* harmony export */ selectNextOccurrence: () => (/* binding */ selectNextOccurrence),\n/* harmony export */ selectSelectionMatches: () => (/* binding */ selectSelectionMatches),\n/* harmony export */ setSearchQuery: () => (/* binding */ setSearchQuery)\n/* harmony export */ });\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var crelt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! crelt */ "./node_modules/crelt/index.js");\n\n\n\n\nconst basicNormalize = typeof String.prototype.normalize == "function"\n ? x => x.normalize("NFKD") : x => x;\n/**\nA search cursor provides an iterator over text matches in a\ndocument.\n*/\nclass SearchCursor {\n /**\n Create a text cursor. The query is the search string, `from` to\n `to` provides the region to search.\n \n When `normalize` is given, it will be called, on both the query\n string and the content it is matched against, before comparing.\n You can, for example, create a case-insensitive search by\n passing `s => s.toLowerCase()`.\n \n Text is always normalized with\n [`.normalize("NFKD")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)\n (when supported).\n */\n constructor(text, query, from = 0, to = text.length, normalize, test) {\n this.test = test;\n /**\n The current match (only holds a meaningful value after\n [`next`](https://codemirror.net/6/docs/ref/#search.SearchCursor.next) has been called and when\n `done` is false).\n */\n this.value = { from: 0, to: 0 };\n /**\n Whether the end of the iterated region has been reached.\n */\n this.done = false;\n this.matches = [];\n this.buffer = "";\n this.bufferPos = 0;\n this.iter = text.iterRange(from, to);\n this.bufferStart = from;\n this.normalize = normalize ? x => normalize(basicNormalize(x)) : basicNormalize;\n this.query = this.normalize(query);\n }\n peek() {\n if (this.bufferPos == this.buffer.length) {\n this.bufferStart += this.buffer.length;\n this.iter.next();\n if (this.iter.done)\n return -1;\n this.bufferPos = 0;\n this.buffer = this.iter.value;\n }\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointAt)(this.buffer, this.bufferPos);\n }\n /**\n Look for the next match. Updates the iterator\'s\n [`value`](https://codemirror.net/6/docs/ref/#search.SearchCursor.value) and\n [`done`](https://codemirror.net/6/docs/ref/#search.SearchCursor.done) properties. Should be called\n at least once before using the cursor.\n */\n next() {\n while (this.matches.length)\n this.matches.pop();\n return this.nextOverlapping();\n }\n /**\n The `next` method will ignore matches that partially overlap a\n previous match. This method behaves like `next`, but includes\n such matches.\n */\n nextOverlapping() {\n for (;;) {\n let next = this.peek();\n if (next < 0) {\n this.done = true;\n return this;\n }\n let str = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.fromCodePoint)(next), start = this.bufferStart + this.bufferPos;\n this.bufferPos += (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.codePointSize)(next);\n let norm = this.normalize(str);\n for (let i = 0, pos = start;; i++) {\n let code = norm.charCodeAt(i);\n let match = this.match(code, pos, this.bufferPos + this.bufferStart);\n if (i == norm.length - 1) {\n if (match) {\n this.value = match;\n return this;\n }\n break;\n }\n if (pos == start && i < str.length && str.charCodeAt(i) == code)\n pos++;\n }\n }\n }\n match(code, pos, end) {\n let match = null;\n for (let i = 0; i < this.matches.length; i += 2) {\n let index = this.matches[i], keep = false;\n if (this.query.charCodeAt(index) == code) {\n if (index == this.query.length - 1) {\n match = { from: this.matches[i + 1], to: end };\n }\n else {\n this.matches[i]++;\n keep = true;\n }\n }\n if (!keep) {\n this.matches.splice(i, 2);\n i -= 2;\n }\n }\n if (this.query.charCodeAt(0) == code) {\n if (this.query.length == 1)\n match = { from: pos, to: end };\n else\n this.matches.push(1, pos);\n }\n if (match && this.test && !this.test(match.from, match.to, this.buffer, this.bufferStart))\n match = null;\n return match;\n }\n}\nif (typeof Symbol != "undefined")\n SearchCursor.prototype[Symbol.iterator] = function () { return this; };\n\nconst empty = { from: -1, to: -1, match: /*@__PURE__*//.*/.exec("") };\nconst baseFlags = "gm" + (/x/.unicode == null ? "" : "u");\n/**\nThis class is similar to [`SearchCursor`](https://codemirror.net/6/docs/ref/#search.SearchCursor)\nbut searches for a regular expression pattern instead of a plain\nstring.\n*/\nclass RegExpCursor {\n /**\n Create a cursor that will search the given range in the given\n document. `query` should be the raw pattern (as you\'d pass it to\n `new RegExp`).\n */\n constructor(text, query, options, from = 0, to = text.length) {\n this.text = text;\n this.to = to;\n this.curLine = "";\n /**\n Set to `true` when the cursor has reached the end of the search\n range.\n */\n this.done = false;\n /**\n Will contain an object with the extent of the match and the\n match object when [`next`](https://codemirror.net/6/docs/ref/#search.RegExpCursor.next)\n sucessfully finds a match.\n */\n this.value = empty;\n if (/\\\\[sWDnr]|\\n|\\r|\\[\\^/.test(query))\n return new MultilineRegExpCursor(text, query, options, from, to);\n this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));\n this.test = options === null || options === void 0 ? void 0 : options.test;\n this.iter = text.iter();\n let startLine = text.lineAt(from);\n this.curLineStart = startLine.from;\n this.matchPos = toCharEnd(text, from);\n this.getLine(this.curLineStart);\n }\n getLine(skip) {\n this.iter.next(skip);\n if (this.iter.lineBreak) {\n this.curLine = "";\n }\n else {\n this.curLine = this.iter.value;\n if (this.curLineStart + this.curLine.length > this.to)\n this.curLine = this.curLine.slice(0, this.to - this.curLineStart);\n this.iter.next();\n }\n }\n nextLine() {\n this.curLineStart = this.curLineStart + this.curLine.length + 1;\n if (this.curLineStart > this.to)\n this.curLine = "";\n else\n this.getLine(0);\n }\n /**\n Move to the next match, if there is one.\n */\n next() {\n for (let off = this.matchPos - this.curLineStart;;) {\n this.re.lastIndex = off;\n let match = this.matchPos <= this.to && this.re.exec(this.curLine);\n if (match) {\n let from = this.curLineStart + match.index, to = from + match[0].length;\n this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0));\n if (from == this.curLineStart + this.curLine.length)\n this.nextLine();\n if ((from < to || from > this.value.to) && (!this.test || this.test(from, to, match))) {\n this.value = { from, to, match };\n return this;\n }\n off = this.matchPos - this.curLineStart;\n }\n else if (this.curLineStart + this.curLine.length < this.to) {\n this.nextLine();\n off = 0;\n }\n else {\n this.done = true;\n return this;\n }\n }\n }\n}\nconst flattened = /*@__PURE__*/new WeakMap();\n// Reusable (partially) flattened document strings\nclass FlattenedDoc {\n constructor(from, text) {\n this.from = from;\n this.text = text;\n }\n get to() { return this.from + this.text.length; }\n static get(doc, from, to) {\n let cached = flattened.get(doc);\n if (!cached || cached.from >= to || cached.to <= from) {\n let flat = new FlattenedDoc(from, doc.sliceString(from, to));\n flattened.set(doc, flat);\n return flat;\n }\n if (cached.from == from && cached.to == to)\n return cached;\n let { text, from: cachedFrom } = cached;\n if (cachedFrom > from) {\n text = doc.sliceString(from, cachedFrom) + text;\n cachedFrom = from;\n }\n if (cached.to < to)\n text += doc.sliceString(cached.to, to);\n flattened.set(doc, new FlattenedDoc(cachedFrom, text));\n return new FlattenedDoc(from, text.slice(from - cachedFrom, to - cachedFrom));\n }\n}\nclass MultilineRegExpCursor {\n constructor(text, query, options, from, to) {\n this.text = text;\n this.to = to;\n this.done = false;\n this.value = empty;\n this.matchPos = toCharEnd(text, from);\n this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));\n this.test = options === null || options === void 0 ? void 0 : options.test;\n this.flat = FlattenedDoc.get(text, from, this.chunkEnd(from + 5000 /* Chunk.Base */));\n }\n chunkEnd(pos) {\n return pos >= this.to ? this.to : this.text.lineAt(pos).to;\n }\n next() {\n for (;;) {\n let off = this.re.lastIndex = this.matchPos - this.flat.from;\n let match = this.re.exec(this.flat.text);\n // Skip empty matches directly after the last match\n if (match && !match[0] && match.index == off) {\n this.re.lastIndex = off + 1;\n match = this.re.exec(this.flat.text);\n }\n if (match) {\n let from = this.flat.from + match.index, to = from + match[0].length;\n // If a match goes almost to the end of a noncomplete chunk, try\n // again, since it\'ll likely be able to match more\n if ((this.flat.to >= this.to || match.index + match[0].length <= this.flat.text.length - 10) &&\n (!this.test || this.test(from, to, match))) {\n this.value = { from, to, match };\n this.matchPos = toCharEnd(this.text, to + (from == to ? 1 : 0));\n return this;\n }\n }\n if (this.flat.to == this.to) {\n this.done = true;\n return this;\n }\n // Grow the flattened doc\n this.flat = FlattenedDoc.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));\n }\n }\n}\nif (typeof Symbol != "undefined") {\n RegExpCursor.prototype[Symbol.iterator] = MultilineRegExpCursor.prototype[Symbol.iterator] =\n function () { return this; };\n}\nfunction validRegExp(source) {\n try {\n new RegExp(source, baseFlags);\n return true;\n }\n catch (_a) {\n return false;\n }\n}\nfunction toCharEnd(text, pos) {\n if (pos >= text.length)\n return pos;\n let line = text.lineAt(pos), next;\n while (pos < line.to && (next = line.text.charCodeAt(pos - line.from)) >= 0xDC00 && next < 0xE000)\n pos++;\n return pos;\n}\n\nfunction createLineDialog(view) {\n let line = String(view.state.doc.lineAt(view.state.selection.main.head).number);\n let input = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("input", { class: "cm-textfield", name: "line", value: line });\n let dom = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("form", {\n class: "cm-gotoLine",\n onkeydown: (event) => {\n if (event.keyCode == 27) { // Escape\n event.preventDefault();\n view.dispatch({ effects: dialogEffect.of(false) });\n view.focus();\n }\n else if (event.keyCode == 13) { // Enter\n event.preventDefault();\n go();\n }\n },\n onsubmit: (event) => {\n event.preventDefault();\n go();\n }\n }, (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("label", view.state.phrase("Go to line"), ": ", input), " ", (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("button", { class: "cm-button", type: "submit" }, view.state.phrase("go")));\n function go() {\n let match = /^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(input.value);\n if (!match)\n return;\n let { state } = view, startLine = state.doc.lineAt(state.selection.main.head);\n let [, sign, ln, cl, percent] = match;\n let col = cl ? +cl.slice(1) : 0;\n let line = ln ? +ln : startLine.number;\n if (ln && percent) {\n let pc = line / 100;\n if (sign)\n pc = pc * (sign == "-" ? -1 : 1) + (startLine.number / state.doc.lines);\n line = Math.round(state.doc.lines * pc);\n }\n else if (ln && sign) {\n line = line * (sign == "-" ? -1 : 1) + startLine.number;\n }\n let docLine = state.doc.line(Math.max(1, Math.min(state.doc.lines, line)));\n let selection = _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(docLine.from + Math.max(0, Math.min(col, docLine.length)));\n view.dispatch({\n effects: [dialogEffect.of(false), _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.scrollIntoView(selection.from, { y: \'center\' })],\n selection,\n });\n view.focus();\n }\n return { dom };\n}\nconst dialogEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define();\nconst dialogField = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateField.define({\n create() { return true; },\n update(value, tr) {\n for (let e of tr.effects)\n if (e.is(dialogEffect))\n value = e.value;\n return value;\n },\n provide: f => _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.showPanel.from(f, val => val ? createLineDialog : null)\n});\n/**\nCommand that shows a dialog asking the user for a line number, and\nwhen a valid position is provided, moves the cursor to that line.\n\nSupports line numbers, relative line offsets prefixed with `+` or\n`-`, document percentages suffixed with `%`, and an optional\ncolumn position by adding `:` and a second number after the line\nnumber.\n*/\nconst gotoLine = view => {\n let panel = (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.getPanel)(view, createLineDialog);\n if (!panel) {\n let effects = [dialogEffect.of(true)];\n if (view.state.field(dialogField, false) == null)\n effects.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.appendConfig.of([dialogField, baseTheme$1]));\n view.dispatch({ effects });\n panel = (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.getPanel)(view, createLineDialog);\n }\n if (panel)\n panel.dom.querySelector("input").select();\n return true;\n};\nconst baseTheme$1 = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.baseTheme({\n ".cm-panel.cm-gotoLine": {\n padding: "2px 6px 4px",\n "& label": { fontSize: "80%" }\n }\n});\n\nconst defaultHighlightOptions = {\n highlightWordAroundCursor: false,\n minSelectionLength: 1,\n maxMatches: 100,\n wholeWords: false\n};\nconst highlightConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Facet.define({\n combine(options) {\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.combineConfig)(options, defaultHighlightOptions, {\n highlightWordAroundCursor: (a, b) => a || b,\n minSelectionLength: Math.min,\n maxMatches: Math.min\n });\n }\n});\n/**\nThis extension highlights text that matches the selection. It uses\nthe `"cm-selectionMatch"` class for the highlighting. When\n`highlightWordAroundCursor` is enabled, the word at the cursor\nitself will be highlighted with `"cm-selectionMatch-main"`.\n*/\nfunction highlightSelectionMatches(options) {\n let ext = [defaultTheme, matchHighlighter];\n if (options)\n ext.push(highlightConfig.of(options));\n return ext;\n}\nconst matchDeco = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.mark({ class: "cm-selectionMatch" });\nconst mainMatchDeco = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });\n// Whether the characters directly outside the given positions are non-word characters\nfunction insideWordBoundaries(check, state, from, to) {\n return (from == 0 || check(state.sliceDoc(from - 1, from)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word) &&\n (to == state.doc.length || check(state.sliceDoc(to, to + 1)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word);\n}\n// Whether the characters directly at the given positions are word characters\nfunction insideWord(check, state, from, to) {\n return check(state.sliceDoc(from, from + 1)) == _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word\n && check(state.sliceDoc(to - 1, to)) == _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word;\n}\nconst matchHighlighter = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.ViewPlugin.fromClass(class {\n constructor(view) {\n this.decorations = this.getDeco(view);\n }\n update(update) {\n if (update.selectionSet || update.docChanged || update.viewportChanged)\n this.decorations = this.getDeco(update.view);\n }\n getDeco(view) {\n let conf = view.state.facet(highlightConfig);\n let { state } = view, sel = state.selection;\n if (sel.ranges.length > 1)\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.none;\n let range = sel.main, query, check = null;\n if (range.empty) {\n if (!conf.highlightWordAroundCursor)\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.none;\n let word = state.wordAt(range.head);\n if (!word)\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.none;\n check = state.charCategorizer(range.head);\n query = state.sliceDoc(word.from, word.to);\n }\n else {\n let len = range.to - range.from;\n if (len < conf.minSelectionLength || len > 200)\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.none;\n if (conf.wholeWords) {\n query = state.sliceDoc(range.from, range.to); // TODO: allow and include leading/trailing space?\n check = state.charCategorizer(range.head);\n if (!(insideWordBoundaries(check, state, range.from, range.to) &&\n insideWord(check, state, range.from, range.to)))\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.none;\n }\n else {\n query = state.sliceDoc(range.from, range.to);\n if (!query)\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.none;\n }\n }\n let deco = [];\n for (let part of view.visibleRanges) {\n let cursor = new SearchCursor(state.doc, query, part.from, part.to);\n while (!cursor.next().done) {\n let { from, to } = cursor.value;\n if (!check || insideWordBoundaries(check, state, from, to)) {\n if (range.empty && from <= range.from && to >= range.to)\n deco.push(mainMatchDeco.range(from, to));\n else if (from >= range.to || to <= range.from)\n deco.push(matchDeco.range(from, to));\n if (deco.length > conf.maxMatches)\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.none;\n }\n }\n }\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.set(deco);\n }\n}, {\n decorations: v => v.decorations\n});\nconst defaultTheme = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.baseTheme({\n ".cm-selectionMatch": { backgroundColor: "#99ff7780" },\n ".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }\n});\n// Select the words around the cursors.\nconst selectWord = ({ state, dispatch }) => {\n let { selection } = state;\n let newSel = _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.create(selection.ranges.map(range => state.wordAt(range.head) || _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.cursor(range.head)), selection.mainIndex);\n if (newSel.eq(selection))\n return false;\n dispatch(state.update({ selection: newSel }));\n return true;\n};\n// Find next occurrence of query relative to last cursor. Wrap around\n// the document if there are no more matches.\nfunction findNextOccurrence(state, query) {\n let { main, ranges } = state.selection;\n let word = state.wordAt(main.head), fullWord = word && word.from == main.from && word.to == main.to;\n for (let cycled = false, cursor = new SearchCursor(state.doc, query, ranges[ranges.length - 1].to);;) {\n cursor.next();\n if (cursor.done) {\n if (cycled)\n return null;\n cursor = new SearchCursor(state.doc, query, 0, Math.max(0, ranges[ranges.length - 1].from - 1));\n cycled = true;\n }\n else {\n if (cycled && ranges.some(r => r.from == cursor.value.from))\n continue;\n if (fullWord) {\n let word = state.wordAt(cursor.value.from);\n if (!word || word.from != cursor.value.from || word.to != cursor.value.to)\n continue;\n }\n return cursor.value;\n }\n }\n}\n/**\nSelect next occurrence of the current selection. Expand selection\nto the surrounding word when the selection is empty.\n*/\nconst selectNextOccurrence = ({ state, dispatch }) => {\n let { ranges } = state.selection;\n if (ranges.some(sel => sel.from === sel.to))\n return selectWord({ state, dispatch });\n let searchedText = state.sliceDoc(ranges[0].from, ranges[0].to);\n if (state.selection.ranges.some(r => state.sliceDoc(r.from, r.to) != searchedText))\n return false;\n let range = findNextOccurrence(state, searchedText);\n if (!range)\n return false;\n dispatch(state.update({\n selection: state.selection.addRange(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(range.from, range.to), false),\n effects: _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.scrollIntoView(range.to)\n }));\n return true;\n};\n\nconst searchConfigFacet = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Facet.define({\n combine(configs) {\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.combineConfig)(configs, {\n top: false,\n caseSensitive: false,\n literal: false,\n regexp: false,\n wholeWord: false,\n createPanel: view => new SearchPanel(view),\n scrollToMatch: range => _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.scrollIntoView(range)\n });\n }\n});\n/**\nAdd search state to the editor configuration, and optionally\nconfigure the search extension.\n([`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel) will automatically\nenable this if it isn\'t already on).\n*/\nfunction search(config) {\n return config ? [searchConfigFacet.of(config), searchExtensions] : searchExtensions;\n}\n/**\nA search query. Part of the editor\'s search state.\n*/\nclass SearchQuery {\n /**\n Create a query object.\n */\n constructor(config) {\n this.search = config.search;\n this.caseSensitive = !!config.caseSensitive;\n this.literal = !!config.literal;\n this.regexp = !!config.regexp;\n this.replace = config.replace || "";\n this.valid = !!this.search && (!this.regexp || validRegExp(this.search));\n this.unquoted = this.unquote(this.search);\n this.wholeWord = !!config.wholeWord;\n }\n /**\n @internal\n */\n unquote(text) {\n return this.literal ? text :\n text.replace(/\\\\([nrt\\\\])/g, (_, ch) => ch == "n" ? "\\n" : ch == "r" ? "\\r" : ch == "t" ? "\\t" : "\\\\");\n }\n /**\n Compare this query to another query.\n */\n eq(other) {\n return this.search == other.search && this.replace == other.replace &&\n this.caseSensitive == other.caseSensitive && this.regexp == other.regexp &&\n this.wholeWord == other.wholeWord;\n }\n /**\n @internal\n */\n create() {\n return this.regexp ? new RegExpQuery(this) : new StringQuery(this);\n }\n /**\n Get a search cursor for this query, searching through the given\n range in the given state.\n */\n getCursor(state, from = 0, to) {\n let st = state.doc ? state : _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorState.create({ doc: state });\n if (to == null)\n to = st.doc.length;\n return this.regexp ? regexpCursor(this, st, from, to) : stringCursor(this, st, from, to);\n }\n}\nclass QueryType {\n constructor(spec) {\n this.spec = spec;\n }\n}\nfunction stringCursor(spec, state, from, to) {\n return new SearchCursor(state.doc, spec.unquoted, from, to, spec.caseSensitive ? undefined : x => x.toLowerCase(), spec.wholeWord ? stringWordTest(state.doc, state.charCategorizer(state.selection.main.head)) : undefined);\n}\nfunction stringWordTest(doc, categorizer) {\n return (from, to, buf, bufPos) => {\n if (bufPos > from || bufPos + buf.length < to) {\n bufPos = Math.max(0, from - 2);\n buf = doc.sliceString(bufPos, Math.min(doc.length, to + 2));\n }\n return (categorizer(charBefore(buf, from - bufPos)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word ||\n categorizer(charAfter(buf, from - bufPos)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word) &&\n (categorizer(charAfter(buf, to - bufPos)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word ||\n categorizer(charBefore(buf, to - bufPos)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word);\n };\n}\nclass StringQuery extends QueryType {\n constructor(spec) {\n super(spec);\n }\n nextMatch(state, curFrom, curTo) {\n let cursor = stringCursor(this.spec, state, curTo, state.doc.length).nextOverlapping();\n if (cursor.done)\n cursor = stringCursor(this.spec, state, 0, curFrom).nextOverlapping();\n return cursor.done ? null : cursor.value;\n }\n // Searching in reverse is, rather than implementing an inverted search\n // cursor, done by scanning chunk after chunk forward.\n prevMatchInRange(state, from, to) {\n for (let pos = to;;) {\n let start = Math.max(from, pos - 10000 /* FindPrev.ChunkSize */ - this.spec.unquoted.length);\n let cursor = stringCursor(this.spec, state, start, pos), range = null;\n while (!cursor.nextOverlapping().done)\n range = cursor.value;\n if (range)\n return range;\n if (start == from)\n return null;\n pos -= 10000 /* FindPrev.ChunkSize */;\n }\n }\n prevMatch(state, curFrom, curTo) {\n return this.prevMatchInRange(state, 0, curFrom) ||\n this.prevMatchInRange(state, curTo, state.doc.length);\n }\n getReplacement(_result) { return this.spec.unquote(this.spec.replace); }\n matchAll(state, limit) {\n let cursor = stringCursor(this.spec, state, 0, state.doc.length), ranges = [];\n while (!cursor.next().done) {\n if (ranges.length >= limit)\n return null;\n ranges.push(cursor.value);\n }\n return ranges;\n }\n highlight(state, from, to, add) {\n let cursor = stringCursor(this.spec, state, Math.max(0, from - this.spec.unquoted.length), Math.min(to + this.spec.unquoted.length, state.doc.length));\n while (!cursor.next().done)\n add(cursor.value.from, cursor.value.to);\n }\n}\nfunction regexpCursor(spec, state, from, to) {\n return new RegExpCursor(state.doc, spec.search, {\n ignoreCase: !spec.caseSensitive,\n test: spec.wholeWord ? regexpWordTest(state.charCategorizer(state.selection.main.head)) : undefined\n }, from, to);\n}\nfunction charBefore(str, index) {\n return str.slice((0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.findClusterBreak)(str, index, false), index);\n}\nfunction charAfter(str, index) {\n return str.slice(index, (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.findClusterBreak)(str, index));\n}\nfunction regexpWordTest(categorizer) {\n return (_from, _to, match) => !match[0].length ||\n (categorizer(charBefore(match.input, match.index)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word ||\n categorizer(charAfter(match.input, match.index)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word) &&\n (categorizer(charAfter(match.input, match.index + match[0].length)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word ||\n categorizer(charBefore(match.input, match.index + match[0].length)) != _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.CharCategory.Word);\n}\nclass RegExpQuery extends QueryType {\n nextMatch(state, curFrom, curTo) {\n let cursor = regexpCursor(this.spec, state, curTo, state.doc.length).next();\n if (cursor.done)\n cursor = regexpCursor(this.spec, state, 0, curFrom).next();\n return cursor.done ? null : cursor.value;\n }\n prevMatchInRange(state, from, to) {\n for (let size = 1;; size++) {\n let start = Math.max(from, to - size * 10000 /* FindPrev.ChunkSize */);\n let cursor = regexpCursor(this.spec, state, start, to), range = null;\n while (!cursor.next().done)\n range = cursor.value;\n if (range && (start == from || range.from > start + 10))\n return range;\n if (start == from)\n return null;\n }\n }\n prevMatch(state, curFrom, curTo) {\n return this.prevMatchInRange(state, 0, curFrom) ||\n this.prevMatchInRange(state, curTo, state.doc.length);\n }\n getReplacement(result) {\n return this.spec.unquote(this.spec.replace).replace(/\\$([$&\\d+])/g, (m, i) => i == "$" ? "$"\n : i == "&" ? result.match[0]\n : i != "0" && +i < result.match.length ? result.match[i]\n : m);\n }\n matchAll(state, limit) {\n let cursor = regexpCursor(this.spec, state, 0, state.doc.length), ranges = [];\n while (!cursor.next().done) {\n if (ranges.length >= limit)\n return null;\n ranges.push(cursor.value);\n }\n return ranges;\n }\n highlight(state, from, to, add) {\n let cursor = regexpCursor(this.spec, state, Math.max(0, from - 250 /* RegExp.HighlightMargin */), Math.min(to + 250 /* RegExp.HighlightMargin */, state.doc.length));\n while (!cursor.next().done)\n add(cursor.value.from, cursor.value.to);\n }\n}\n/**\nA state effect that updates the current search query. Note that\nthis only has an effect if the search state has been initialized\n(by including [`search`](https://codemirror.net/6/docs/ref/#search.search) in your configuration or\nby running [`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel) at least\nonce).\n*/\nconst setSearchQuery = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define();\nconst togglePanel = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.define();\nconst searchState = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateField.define({\n create(state) {\n return new SearchState(defaultQuery(state).create(), null);\n },\n update(value, tr) {\n for (let effect of tr.effects) {\n if (effect.is(setSearchQuery))\n value = new SearchState(effect.value.create(), value.panel);\n else if (effect.is(togglePanel))\n value = new SearchState(value.query, effect.value ? createSearchPanel : null);\n }\n return value;\n },\n provide: f => _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.showPanel.from(f, val => val.panel)\n});\n/**\nGet the current search query from an editor state.\n*/\nfunction getSearchQuery(state) {\n let curState = state.field(searchState, false);\n return curState ? curState.query.spec : defaultQuery(state);\n}\n/**\nQuery whether the search panel is open in the given editor state.\n*/\nfunction searchPanelOpen(state) {\n var _a;\n return ((_a = state.field(searchState, false)) === null || _a === void 0 ? void 0 : _a.panel) != null;\n}\nclass SearchState {\n constructor(query, panel) {\n this.query = query;\n this.panel = panel;\n }\n}\nconst matchMark = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.mark({ class: "cm-searchMatch" }), selectedMatchMark = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.mark({ class: "cm-searchMatch cm-searchMatch-selected" });\nconst searchHighlighter = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.decorations = this.highlight(view.state.field(searchState));\n }\n update(update) {\n let state = update.state.field(searchState);\n if (state != update.startState.field(searchState) || update.docChanged || update.selectionSet || update.viewportChanged)\n this.decorations = this.highlight(state);\n }\n highlight({ query, panel }) {\n if (!panel || !query.spec.valid)\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.Decoration.none;\n let { view } = this;\n let builder = new _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.RangeSetBuilder();\n for (let i = 0, ranges = view.visibleRanges, l = ranges.length; i < l; i++) {\n let { from, to } = ranges[i];\n while (i < l - 1 && to > ranges[i + 1].from - 2 * 250 /* RegExp.HighlightMargin */)\n to = ranges[++i].to;\n query.highlight(view.state, from, to, (from, to) => {\n let selected = view.state.selection.ranges.some(r => r.from == from && r.to == to);\n builder.add(from, to, selected ? selectedMatchMark : matchMark);\n });\n }\n return builder.finish();\n }\n}, {\n decorations: v => v.decorations\n});\nfunction searchCommand(f) {\n return view => {\n let state = view.state.field(searchState, false);\n return state && state.query.spec.valid ? f(view, state) : openSearchPanel(view);\n };\n}\n/**\nOpen the search panel if it isn\'t already open, and move the\nselection to the first match after the current main selection.\nWill wrap around to the start of the document when it reaches the\nend.\n*/\nconst findNext = /*@__PURE__*/searchCommand((view, { query }) => {\n let { to } = view.state.selection.main;\n let next = query.nextMatch(view.state, to, to);\n if (!next)\n return false;\n let selection = _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.single(next.from, next.to);\n let config = view.state.facet(searchConfigFacet);\n view.dispatch({\n selection,\n effects: [announceMatch(view, next), config.scrollToMatch(selection.main, view)],\n userEvent: "select.search"\n });\n selectSearchInput(view);\n return true;\n});\n/**\nMove the selection to the previous instance of the search query,\nbefore the current main selection. Will wrap past the start\nof the document to start searching at the end again.\n*/\nconst findPrevious = /*@__PURE__*/searchCommand((view, { query }) => {\n let { state } = view, { from } = state.selection.main;\n let prev = query.prevMatch(state, from, from);\n if (!prev)\n return false;\n let selection = _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.single(prev.from, prev.to);\n let config = view.state.facet(searchConfigFacet);\n view.dispatch({\n selection,\n effects: [announceMatch(view, prev), config.scrollToMatch(selection.main, view)],\n userEvent: "select.search"\n });\n selectSearchInput(view);\n return true;\n});\n/**\nSelect all instances of the search query.\n*/\nconst selectMatches = /*@__PURE__*/searchCommand((view, { query }) => {\n let ranges = query.matchAll(view.state, 1000);\n if (!ranges || !ranges.length)\n return false;\n view.dispatch({\n selection: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.create(ranges.map(r => _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(r.from, r.to))),\n userEvent: "select.search.matches"\n });\n return true;\n});\n/**\nSelect all instances of the currently selected text.\n*/\nconst selectSelectionMatches = ({ state, dispatch }) => {\n let sel = state.selection;\n if (sel.ranges.length > 1 || sel.main.empty)\n return false;\n let { from, to } = sel.main;\n let ranges = [], main = 0;\n for (let cur = new SearchCursor(state.doc, state.sliceDoc(from, to)); !cur.next().done;) {\n if (ranges.length > 1000)\n return false;\n if (cur.value.from == from)\n main = ranges.length;\n ranges.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.range(cur.value.from, cur.value.to));\n }\n dispatch(state.update({\n selection: _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.create(ranges, main),\n userEvent: "select.search.matches"\n }));\n return true;\n};\n/**\nReplace the current match of the search query.\n*/\nconst replaceNext = /*@__PURE__*/searchCommand((view, { query }) => {\n let { state } = view, { from, to } = state.selection.main;\n if (state.readOnly)\n return false;\n let next = query.nextMatch(state, from, from);\n if (!next)\n return false;\n let changes = [], selection, replacement;\n let effects = [];\n if (next.from == from && next.to == to) {\n replacement = state.toText(query.getReplacement(next));\n changes.push({ from: next.from, to: next.to, insert: replacement });\n next = query.nextMatch(state, next.from, next.to);\n effects.push(_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.announce.of(state.phrase("replaced match on line $", state.doc.lineAt(from).number) + "."));\n }\n if (next) {\n let off = changes.length == 0 || changes[0].from >= next.to ? 0 : next.to - next.from - replacement.length;\n selection = _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.EditorSelection.single(next.from - off, next.to - off);\n effects.push(announceMatch(view, next));\n effects.push(state.facet(searchConfigFacet).scrollToMatch(selection.main, view));\n }\n view.dispatch({\n changes, selection, effects,\n userEvent: "input.replace"\n });\n return true;\n});\n/**\nReplace all instances of the search query with the given\nreplacement.\n*/\nconst replaceAll = /*@__PURE__*/searchCommand((view, { query }) => {\n if (view.state.readOnly)\n return false;\n let changes = query.matchAll(view.state, 1e9).map(match => {\n let { from, to } = match;\n return { from, to, insert: query.getReplacement(match) };\n });\n if (!changes.length)\n return false;\n let announceText = view.state.phrase("replaced $ matches", changes.length) + ".";\n view.dispatch({\n changes,\n effects: _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.announce.of(announceText),\n userEvent: "input.replace.all"\n });\n return true;\n});\nfunction createSearchPanel(view) {\n return view.state.facet(searchConfigFacet).createPanel(view);\n}\nfunction defaultQuery(state, fallback) {\n var _a, _b, _c, _d, _e;\n let sel = state.selection.main;\n let selText = sel.empty || sel.to > sel.from + 100 ? "" : state.sliceDoc(sel.from, sel.to);\n if (fallback && !selText)\n return fallback;\n let config = state.facet(searchConfigFacet);\n return new SearchQuery({\n search: ((_a = fallback === null || fallback === void 0 ? void 0 : fallback.literal) !== null && _a !== void 0 ? _a : config.literal) ? selText : selText.replace(/\\n/g, "\\\\n"),\n caseSensitive: (_b = fallback === null || fallback === void 0 ? void 0 : fallback.caseSensitive) !== null && _b !== void 0 ? _b : config.caseSensitive,\n literal: (_c = fallback === null || fallback === void 0 ? void 0 : fallback.literal) !== null && _c !== void 0 ? _c : config.literal,\n regexp: (_d = fallback === null || fallback === void 0 ? void 0 : fallback.regexp) !== null && _d !== void 0 ? _d : config.regexp,\n wholeWord: (_e = fallback === null || fallback === void 0 ? void 0 : fallback.wholeWord) !== null && _e !== void 0 ? _e : config.wholeWord\n });\n}\nfunction getSearchInput(view) {\n let panel = (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.getPanel)(view, createSearchPanel);\n return panel && panel.dom.querySelector("[main-field]");\n}\nfunction selectSearchInput(view) {\n let input = getSearchInput(view);\n if (input && input == view.root.activeElement)\n input.select();\n}\n/**\nMake sure the search panel is open and focused.\n*/\nconst openSearchPanel = view => {\n let state = view.state.field(searchState, false);\n if (state && state.panel) {\n let searchInput = getSearchInput(view);\n if (searchInput && searchInput != view.root.activeElement) {\n let query = defaultQuery(view.state, state.query.spec);\n if (query.valid)\n view.dispatch({ effects: setSearchQuery.of(query) });\n searchInput.focus();\n searchInput.select();\n }\n }\n else {\n view.dispatch({ effects: [\n togglePanel.of(true),\n state ? setSearchQuery.of(defaultQuery(view.state, state.query.spec)) : _codemirror_state__WEBPACK_IMPORTED_MODULE_1__.StateEffect.appendConfig.of(searchExtensions)\n ] });\n }\n return true;\n};\n/**\nClose the search panel.\n*/\nconst closeSearchPanel = view => {\n let state = view.state.field(searchState, false);\n if (!state || !state.panel)\n return false;\n let panel = (0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.getPanel)(view, createSearchPanel);\n if (panel && panel.dom.contains(view.root.activeElement))\n view.focus();\n view.dispatch({ effects: togglePanel.of(false) });\n return true;\n};\n/**\nDefault search-related key bindings.\n\n - Mod-f: [`openSearchPanel`](https://codemirror.net/6/docs/ref/#search.openSearchPanel)\n - F3, Mod-g: [`findNext`](https://codemirror.net/6/docs/ref/#search.findNext)\n - Shift-F3, Shift-Mod-g: [`findPrevious`](https://codemirror.net/6/docs/ref/#search.findPrevious)\n - Mod-Alt-g: [`gotoLine`](https://codemirror.net/6/docs/ref/#search.gotoLine)\n - Mod-d: [`selectNextOccurrence`](https://codemirror.net/6/docs/ref/#search.selectNextOccurrence)\n*/\nconst searchKeymap = [\n { key: "Mod-f", run: openSearchPanel, scope: "editor search-panel" },\n { key: "F3", run: findNext, shift: findPrevious, scope: "editor search-panel", preventDefault: true },\n { key: "Mod-g", run: findNext, shift: findPrevious, scope: "editor search-panel", preventDefault: true },\n { key: "Escape", run: closeSearchPanel, scope: "editor search-panel" },\n { key: "Mod-Shift-l", run: selectSelectionMatches },\n { key: "Mod-Alt-g", run: gotoLine },\n { key: "Mod-d", run: selectNextOccurrence, preventDefault: true },\n];\nclass SearchPanel {\n constructor(view) {\n this.view = view;\n let query = this.query = view.state.field(searchState).query.spec;\n this.commit = this.commit.bind(this);\n this.searchField = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("input", {\n value: query.search,\n placeholder: phrase(view, "Find"),\n "aria-label": phrase(view, "Find"),\n class: "cm-textfield",\n name: "search",\n form: "",\n "main-field": "true",\n onchange: this.commit,\n onkeyup: this.commit\n });\n this.replaceField = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("input", {\n value: query.replace,\n placeholder: phrase(view, "Replace"),\n "aria-label": phrase(view, "Replace"),\n class: "cm-textfield",\n name: "replace",\n form: "",\n onchange: this.commit,\n onkeyup: this.commit\n });\n this.caseField = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("input", {\n type: "checkbox",\n name: "case",\n form: "",\n checked: query.caseSensitive,\n onchange: this.commit\n });\n this.reField = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("input", {\n type: "checkbox",\n name: "re",\n form: "",\n checked: query.regexp,\n onchange: this.commit\n });\n this.wordField = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("input", {\n type: "checkbox",\n name: "word",\n form: "",\n checked: query.wholeWord,\n onchange: this.commit\n });\n function button(name, onclick, content) {\n return (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("button", { class: "cm-button", name, onclick, type: "button" }, content);\n }\n this.dom = (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("div", { onkeydown: (e) => this.keydown(e), class: "cm-search" }, [\n this.searchField,\n button("next", () => findNext(view), [phrase(view, "next")]),\n button("prev", () => findPrevious(view), [phrase(view, "previous")]),\n button("select", () => selectMatches(view), [phrase(view, "all")]),\n (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("label", null, [this.caseField, phrase(view, "match case")]),\n (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("label", null, [this.reField, phrase(view, "regexp")]),\n (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("label", null, [this.wordField, phrase(view, "by word")]),\n ...view.state.readOnly ? [] : [\n (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("br"),\n this.replaceField,\n button("replace", () => replaceNext(view), [phrase(view, "replace")]),\n button("replaceAll", () => replaceAll(view), [phrase(view, "replace all")])\n ],\n (0,crelt__WEBPACK_IMPORTED_MODULE_0__["default"])("button", {\n name: "close",\n onclick: () => closeSearchPanel(view),\n "aria-label": phrase(view, "close"),\n type: "button"\n }, ["×"])\n ]);\n }\n commit() {\n let query = new SearchQuery({\n search: this.searchField.value,\n caseSensitive: this.caseField.checked,\n regexp: this.reField.checked,\n wholeWord: this.wordField.checked,\n replace: this.replaceField.value,\n });\n if (!query.eq(this.query)) {\n this.query = query;\n this.view.dispatch({ effects: setSearchQuery.of(query) });\n }\n }\n keydown(e) {\n if ((0,_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.runScopeHandlers)(this.view, e, "search-panel")) {\n e.preventDefault();\n }\n else if (e.keyCode == 13 && e.target == this.searchField) {\n e.preventDefault();\n (e.shiftKey ? findPrevious : findNext)(this.view);\n }\n else if (e.keyCode == 13 && e.target == this.replaceField) {\n e.preventDefault();\n replaceNext(this.view);\n }\n }\n update(update) {\n for (let tr of update.transactions)\n for (let effect of tr.effects) {\n if (effect.is(setSearchQuery) && !effect.value.eq(this.query))\n this.setQuery(effect.value);\n }\n }\n setQuery(query) {\n this.query = query;\n this.searchField.value = query.search;\n this.replaceField.value = query.replace;\n this.caseField.checked = query.caseSensitive;\n this.reField.checked = query.regexp;\n this.wordField.checked = query.wholeWord;\n }\n mount() {\n this.searchField.select();\n }\n get pos() { return 80; }\n get top() { return this.view.state.facet(searchConfigFacet).top; }\n}\nfunction phrase(view, phrase) { return view.state.phrase(phrase); }\nconst AnnounceMargin = 30;\nconst Break = /[\\s\\.,:;?!]/;\nfunction announceMatch(view, { from, to }) {\n let line = view.state.doc.lineAt(from), lineEnd = view.state.doc.lineAt(to).to;\n let start = Math.max(line.from, from - AnnounceMargin), end = Math.min(lineEnd, to + AnnounceMargin);\n let text = view.state.sliceDoc(start, end);\n if (start != line.from) {\n for (let i = 0; i < AnnounceMargin; i++)\n if (!Break.test(text[i + 1]) && Break.test(text[i])) {\n text = text.slice(i);\n break;\n }\n }\n if (end != lineEnd) {\n for (let i = text.length - 1; i > text.length - AnnounceMargin; i--)\n if (!Break.test(text[i - 1]) && Break.test(text[i])) {\n text = text.slice(0, i);\n break;\n }\n }\n return _codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.announce.of(`${view.state.phrase("current match")}. ${text} ${view.state.phrase("on line")} ${line.number}.`);\n}\nconst baseTheme = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_2__.EditorView.baseTheme({\n ".cm-panel.cm-search": {\n padding: "2px 6px 4px",\n position: "relative",\n "& [name=close]": {\n position: "absolute",\n top: "0",\n right: "4px",\n backgroundColor: "inherit",\n border: "none",\n font: "inherit",\n padding: 0,\n margin: 0\n },\n "& input, & button, & label": {\n margin: ".2em .6em .2em 0"\n },\n "& input[type=checkbox]": {\n marginRight: ".2em"\n },\n "& label": {\n fontSize: "80%",\n whiteSpace: "pre"\n }\n },\n "&light .cm-searchMatch": { backgroundColor: "#ffff0054" },\n "&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },\n "&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },\n "&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }\n});\nconst searchExtensions = [\n searchState,\n /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_1__.Prec.low(searchHighlighter),\n baseTheme\n];\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/search/dist/index.js?')},"./node_modules/@codemirror/state/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Annotation: () => (/* binding */ Annotation),\n/* harmony export */ AnnotationType: () => (/* binding */ AnnotationType),\n/* harmony export */ ChangeDesc: () => (/* binding */ ChangeDesc),\n/* harmony export */ ChangeSet: () => (/* binding */ ChangeSet),\n/* harmony export */ CharCategory: () => (/* binding */ CharCategory),\n/* harmony export */ Compartment: () => (/* binding */ Compartment),\n/* harmony export */ EditorSelection: () => (/* binding */ EditorSelection),\n/* harmony export */ EditorState: () => (/* binding */ EditorState),\n/* harmony export */ Facet: () => (/* binding */ Facet),\n/* harmony export */ Line: () => (/* binding */ Line),\n/* harmony export */ MapMode: () => (/* binding */ MapMode),\n/* harmony export */ Prec: () => (/* binding */ Prec),\n/* harmony export */ Range: () => (/* binding */ Range),\n/* harmony export */ RangeSet: () => (/* binding */ RangeSet),\n/* harmony export */ RangeSetBuilder: () => (/* binding */ RangeSetBuilder),\n/* harmony export */ RangeValue: () => (/* binding */ RangeValue),\n/* harmony export */ SelectionRange: () => (/* binding */ SelectionRange),\n/* harmony export */ StateEffect: () => (/* binding */ StateEffect),\n/* harmony export */ StateEffectType: () => (/* binding */ StateEffectType),\n/* harmony export */ StateField: () => (/* binding */ StateField),\n/* harmony export */ Text: () => (/* binding */ Text),\n/* harmony export */ Transaction: () => (/* binding */ Transaction),\n/* harmony export */ codePointAt: () => (/* binding */ codePointAt),\n/* harmony export */ codePointSize: () => (/* binding */ codePointSize),\n/* harmony export */ combineConfig: () => (/* binding */ combineConfig),\n/* harmony export */ countColumn: () => (/* binding */ countColumn),\n/* harmony export */ findClusterBreak: () => (/* binding */ findClusterBreak),\n/* harmony export */ findColumn: () => (/* binding */ findColumn),\n/* harmony export */ fromCodePoint: () => (/* binding */ fromCodePoint)\n/* harmony export */ });\n/**\nThe data structure for documents. @nonabstract\n*/\nclass Text {\n /**\n Get the line description around the given position.\n */\n lineAt(pos) {\n if (pos < 0 || pos > this.length)\n throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`);\n return this.lineInner(pos, false, 1, 0);\n }\n /**\n Get the description for the given (1-based) line number.\n */\n line(n) {\n if (n < 1 || n > this.lines)\n throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`);\n return this.lineInner(n, true, 1, 0);\n }\n /**\n Replace a range of the text with the given content.\n */\n replace(from, to, text) {\n [from, to] = clip(this, from, to);\n let parts = [];\n this.decompose(0, from, parts, 2 /* Open.To */);\n if (text.length)\n text.decompose(0, text.length, parts, 1 /* Open.From */ | 2 /* Open.To */);\n this.decompose(to, this.length, parts, 1 /* Open.From */);\n return TextNode.from(parts, this.length - (to - from) + text.length);\n }\n /**\n Append another document to this one.\n */\n append(other) {\n return this.replace(this.length, this.length, other);\n }\n /**\n Retrieve the text between the given points.\n */\n slice(from, to = this.length) {\n [from, to] = clip(this, from, to);\n let parts = [];\n this.decompose(from, to, parts, 0);\n return TextNode.from(parts, to - from);\n }\n /**\n Test whether this text is equal to another instance.\n */\n eq(other) {\n if (other == this)\n return true;\n if (other.length != this.length || other.lines != this.lines)\n return false;\n let start = this.scanIdentical(other, 1), end = this.length - this.scanIdentical(other, -1);\n let a = new RawTextCursor(this), b = new RawTextCursor(other);\n for (let skip = start, pos = start;;) {\n a.next(skip);\n b.next(skip);\n skip = 0;\n if (a.lineBreak != b.lineBreak || a.done != b.done || a.value != b.value)\n return false;\n pos += a.value.length;\n if (a.done || pos >= end)\n return true;\n }\n }\n /**\n Iterate over the text. When `dir` is `-1`, iteration happens\n from end to start. This will return lines and the breaks between\n them as separate strings.\n */\n iter(dir = 1) { return new RawTextCursor(this, dir); }\n /**\n Iterate over a range of the text. When `from` > `to`, the\n iterator will run in reverse.\n */\n iterRange(from, to = this.length) { return new PartialTextCursor(this, from, to); }\n /**\n Return a cursor that iterates over the given range of lines,\n _without_ returning the line breaks between, and yielding empty\n strings for empty lines.\n \n When `from` and `to` are given, they should be 1-based line numbers.\n */\n iterLines(from, to) {\n let inner;\n if (from == null) {\n inner = this.iter();\n }\n else {\n if (to == null)\n to = this.lines + 1;\n let start = this.line(from).from;\n inner = this.iterRange(start, Math.max(start, to == this.lines + 1 ? this.length : to <= 1 ? 0 : this.line(to - 1).to));\n }\n return new LineCursor(inner);\n }\n /**\n Return the document as a string, using newline characters to\n separate lines.\n */\n toString() { return this.sliceString(0); }\n /**\n Convert the document to an array of lines (which can be\n deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)).\n */\n toJSON() {\n let lines = [];\n this.flatten(lines);\n return lines;\n }\n /**\n @internal\n */\n constructor() { }\n /**\n Create a `Text` instance for the given array of lines.\n */\n static of(text) {\n if (text.length == 0)\n throw new RangeError("A document must have at least one line");\n if (text.length == 1 && !text[0])\n return Text.empty;\n return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));\n }\n}\n// Leaves store an array of line strings. There are always line breaks\n// between these strings. Leaves are limited in size and have to be\n// contained in TextNode instances for bigger documents.\nclass TextLeaf extends Text {\n constructor(text, length = textLength(text)) {\n super();\n this.text = text;\n this.length = length;\n }\n get lines() { return this.text.length; }\n get children() { return null; }\n lineInner(target, isLine, line, offset) {\n for (let i = 0;; i++) {\n let string = this.text[i], end = offset + string.length;\n if ((isLine ? line : end) >= target)\n return new Line(offset, end, line, string);\n offset = end + 1;\n line++;\n }\n }\n decompose(from, to, target, open) {\n let text = from <= 0 && to >= this.length ? this\n : new TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));\n if (open & 1 /* Open.From */) {\n let prev = target.pop();\n let joined = appendText(text.text, prev.text.slice(), 0, text.length);\n if (joined.length <= 32 /* Tree.Branch */) {\n target.push(new TextLeaf(joined, prev.length + text.length));\n }\n else {\n let mid = joined.length >> 1;\n target.push(new TextLeaf(joined.slice(0, mid)), new TextLeaf(joined.slice(mid)));\n }\n }\n else {\n target.push(text);\n }\n }\n replace(from, to, text) {\n if (!(text instanceof TextLeaf))\n return super.replace(from, to, text);\n [from, to] = clip(this, from, to);\n let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);\n let newLen = this.length + text.length - (to - from);\n if (lines.length <= 32 /* Tree.Branch */)\n return new TextLeaf(lines, newLen);\n return TextNode.from(TextLeaf.split(lines, []), newLen);\n }\n sliceString(from, to = this.length, lineSep = "\\n") {\n [from, to] = clip(this, from, to);\n let result = "";\n for (let pos = 0, i = 0; pos <= to && i < this.text.length; i++) {\n let line = this.text[i], end = pos + line.length;\n if (pos > from && i)\n result += lineSep;\n if (from < end && to > pos)\n result += line.slice(Math.max(0, from - pos), to - pos);\n pos = end + 1;\n }\n return result;\n }\n flatten(target) {\n for (let line of this.text)\n target.push(line);\n }\n scanIdentical() { return 0; }\n static split(text, target) {\n let part = [], len = -1;\n for (let line of text) {\n part.push(line);\n len += line.length + 1;\n if (part.length == 32 /* Tree.Branch */) {\n target.push(new TextLeaf(part, len));\n part = [];\n len = -1;\n }\n }\n if (len > -1)\n target.push(new TextLeaf(part, len));\n return target;\n }\n}\n// Nodes provide the tree structure of the `Text` type. They store a\n// number of other nodes or leaves, taking care to balance themselves\n// on changes. There are implied line breaks _between_ the children of\n// a node (but not before the first or after the last child).\nclass TextNode extends Text {\n constructor(children, length) {\n super();\n this.children = children;\n this.length = length;\n this.lines = 0;\n for (let child of children)\n this.lines += child.lines;\n }\n lineInner(target, isLine, line, offset) {\n for (let i = 0;; i++) {\n let child = this.children[i], end = offset + child.length, endLine = line + child.lines - 1;\n if ((isLine ? endLine : end) >= target)\n return child.lineInner(target, isLine, line, offset);\n offset = end + 1;\n line = endLine + 1;\n }\n }\n decompose(from, to, target, open) {\n for (let i = 0, pos = 0; pos <= to && i < this.children.length; i++) {\n let child = this.children[i], end = pos + child.length;\n if (from <= end && to >= pos) {\n let childOpen = open & ((pos <= from ? 1 /* Open.From */ : 0) | (end >= to ? 2 /* Open.To */ : 0));\n if (pos >= from && end <= to && !childOpen)\n target.push(child);\n else\n child.decompose(from - pos, to - pos, target, childOpen);\n }\n pos = end + 1;\n }\n }\n replace(from, to, text) {\n [from, to] = clip(this, from, to);\n if (text.lines < this.lines)\n for (let i = 0, pos = 0; i < this.children.length; i++) {\n let child = this.children[i], end = pos + child.length;\n // Fast path: if the change only affects one child and the\n // child\'s size remains in the acceptable range, only update\n // that child\n if (from >= pos && to <= end) {\n let updated = child.replace(from - pos, to - pos, text);\n let totalLines = this.lines - child.lines + updated.lines;\n if (updated.lines < (totalLines >> (5 /* Tree.BranchShift */ - 1)) &&\n updated.lines > (totalLines >> (5 /* Tree.BranchShift */ + 1))) {\n let copy = this.children.slice();\n copy[i] = updated;\n return new TextNode(copy, this.length - (to - from) + text.length);\n }\n return super.replace(pos, end, updated);\n }\n pos = end + 1;\n }\n return super.replace(from, to, text);\n }\n sliceString(from, to = this.length, lineSep = "\\n") {\n [from, to] = clip(this, from, to);\n let result = "";\n for (let i = 0, pos = 0; i < this.children.length && pos <= to; i++) {\n let child = this.children[i], end = pos + child.length;\n if (pos > from && i)\n result += lineSep;\n if (from < end && to > pos)\n result += child.sliceString(from - pos, to - pos, lineSep);\n pos = end + 1;\n }\n return result;\n }\n flatten(target) {\n for (let child of this.children)\n child.flatten(target);\n }\n scanIdentical(other, dir) {\n if (!(other instanceof TextNode))\n return 0;\n let length = 0;\n let [iA, iB, eA, eB] = dir > 0 ? [0, 0, this.children.length, other.children.length]\n : [this.children.length - 1, other.children.length - 1, -1, -1];\n for (;; iA += dir, iB += dir) {\n if (iA == eA || iB == eB)\n return length;\n let chA = this.children[iA], chB = other.children[iB];\n if (chA != chB)\n return length + chA.scanIdentical(chB, dir);\n length += chA.length + 1;\n }\n }\n static from(children, length = children.reduce((l, ch) => l + ch.length + 1, -1)) {\n let lines = 0;\n for (let ch of children)\n lines += ch.lines;\n if (lines < 32 /* Tree.Branch */) {\n let flat = [];\n for (let ch of children)\n ch.flatten(flat);\n return new TextLeaf(flat, length);\n }\n let chunk = Math.max(32 /* Tree.Branch */, lines >> 5 /* Tree.BranchShift */), maxChunk = chunk << 1, minChunk = chunk >> 1;\n let chunked = [], currentLines = 0, currentLen = -1, currentChunk = [];\n function add(child) {\n let last;\n if (child.lines > maxChunk && child instanceof TextNode) {\n for (let node of child.children)\n add(node);\n }\n else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) {\n flush();\n chunked.push(child);\n }\n else if (child instanceof TextLeaf && currentLines &&\n (last = currentChunk[currentChunk.length - 1]) instanceof TextLeaf &&\n child.lines + last.lines <= 32 /* Tree.Branch */) {\n currentLines += child.lines;\n currentLen += child.length + 1;\n currentChunk[currentChunk.length - 1] = new TextLeaf(last.text.concat(child.text), last.length + 1 + child.length);\n }\n else {\n if (currentLines + child.lines > chunk)\n flush();\n currentLines += child.lines;\n currentLen += child.length + 1;\n currentChunk.push(child);\n }\n }\n function flush() {\n if (currentLines == 0)\n return;\n chunked.push(currentChunk.length == 1 ? currentChunk[0] : TextNode.from(currentChunk, currentLen));\n currentLen = -1;\n currentLines = currentChunk.length = 0;\n }\n for (let child of children)\n add(child);\n flush();\n return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length);\n }\n}\nText.empty = /*@__PURE__*/new TextLeaf([""], 0);\nfunction textLength(text) {\n let length = -1;\n for (let line of text)\n length += line.length + 1;\n return length;\n}\nfunction appendText(text, target, from = 0, to = 1e9) {\n for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {\n let line = text[i], end = pos + line.length;\n if (end >= from) {\n if (end > to)\n line = line.slice(0, to - pos);\n if (pos < from)\n line = line.slice(from - pos);\n if (first) {\n target[target.length - 1] += line;\n first = false;\n }\n else\n target.push(line);\n }\n pos = end + 1;\n }\n return target;\n}\nfunction sliceText(text, from, to) {\n return appendText(text, [""], from, to);\n}\nclass RawTextCursor {\n constructor(text, dir = 1) {\n this.dir = dir;\n this.done = false;\n this.lineBreak = false;\n this.value = "";\n this.nodes = [text];\n this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1];\n }\n nextInner(skip, dir) {\n this.done = this.lineBreak = false;\n for (;;) {\n let last = this.nodes.length - 1;\n let top = this.nodes[last], offsetValue = this.offsets[last], offset = offsetValue >> 1;\n let size = top instanceof TextLeaf ? top.text.length : top.children.length;\n if (offset == (dir > 0 ? size : 0)) {\n if (last == 0) {\n this.done = true;\n this.value = "";\n return this;\n }\n if (dir > 0)\n this.offsets[last - 1]++;\n this.nodes.pop();\n this.offsets.pop();\n }\n else if ((offsetValue & 1) == (dir > 0 ? 0 : 1)) {\n this.offsets[last] += dir;\n if (skip == 0) {\n this.lineBreak = true;\n this.value = "\\n";\n return this;\n }\n skip--;\n }\n else if (top instanceof TextLeaf) {\n // Move to the next string\n let next = top.text[offset + (dir < 0 ? -1 : 0)];\n this.offsets[last] += dir;\n if (next.length > Math.max(0, skip)) {\n this.value = skip == 0 ? next : dir > 0 ? next.slice(skip) : next.slice(0, next.length - skip);\n return this;\n }\n skip -= next.length;\n }\n else {\n let next = top.children[offset + (dir < 0 ? -1 : 0)];\n if (skip > next.length) {\n skip -= next.length;\n this.offsets[last] += dir;\n }\n else {\n if (dir < 0)\n this.offsets[last]--;\n this.nodes.push(next);\n this.offsets.push(dir > 0 ? 1 : (next instanceof TextLeaf ? next.text.length : next.children.length) << 1);\n }\n }\n }\n }\n next(skip = 0) {\n if (skip < 0) {\n this.nextInner(-skip, (-this.dir));\n skip = this.value.length;\n }\n return this.nextInner(skip, this.dir);\n }\n}\nclass PartialTextCursor {\n constructor(text, start, end) {\n this.value = "";\n this.done = false;\n this.cursor = new RawTextCursor(text, start > end ? -1 : 1);\n this.pos = start > end ? text.length : 0;\n this.from = Math.min(start, end);\n this.to = Math.max(start, end);\n }\n nextInner(skip, dir) {\n if (dir < 0 ? this.pos <= this.from : this.pos >= this.to) {\n this.value = "";\n this.done = true;\n return this;\n }\n skip += Math.max(0, dir < 0 ? this.pos - this.to : this.from - this.pos);\n let limit = dir < 0 ? this.pos - this.from : this.to - this.pos;\n if (skip > limit)\n skip = limit;\n limit -= skip;\n let { value } = this.cursor.next(skip);\n this.pos += (value.length + skip) * dir;\n this.value = value.length <= limit ? value : dir < 0 ? value.slice(value.length - limit) : value.slice(0, limit);\n this.done = !this.value;\n return this;\n }\n next(skip = 0) {\n if (skip < 0)\n skip = Math.max(skip, this.from - this.pos);\n else if (skip > 0)\n skip = Math.min(skip, this.to - this.pos);\n return this.nextInner(skip, this.cursor.dir);\n }\n get lineBreak() { return this.cursor.lineBreak && this.value != ""; }\n}\nclass LineCursor {\n constructor(inner) {\n this.inner = inner;\n this.afterBreak = true;\n this.value = "";\n this.done = false;\n }\n next(skip = 0) {\n let { done, lineBreak, value } = this.inner.next(skip);\n if (done && this.afterBreak) {\n this.value = "";\n this.afterBreak = false;\n }\n else if (done) {\n this.done = true;\n this.value = "";\n }\n else if (lineBreak) {\n if (this.afterBreak) {\n this.value = "";\n }\n else {\n this.afterBreak = true;\n this.next();\n }\n }\n else {\n this.value = value;\n this.afterBreak = false;\n }\n return this;\n }\n get lineBreak() { return false; }\n}\nif (typeof Symbol != "undefined") {\n Text.prototype[Symbol.iterator] = function () { return this.iter(); };\n RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] =\n LineCursor.prototype[Symbol.iterator] = function () { return this; };\n}\n/**\nThis type describes a line in the document. It is created\non-demand when lines are [queried](https://codemirror.net/6/docs/ref/#state.Text.lineAt).\n*/\nclass Line {\n /**\n @internal\n */\n constructor(\n /**\n The position of the start of the line.\n */\n from, \n /**\n The position at the end of the line (_before_ the line break,\n or at the end of document for the last line).\n */\n to, \n /**\n This line\'s line number (1-based).\n */\n number, \n /**\n The line\'s content.\n */\n text) {\n this.from = from;\n this.to = to;\n this.number = number;\n this.text = text;\n }\n /**\n The length of the line (not including any line break after it).\n */\n get length() { return this.to - this.from; }\n}\nfunction clip(text, from, to) {\n from = Math.max(0, Math.min(text.length, from));\n return [from, Math.max(from, Math.min(text.length, to))];\n}\n\n// Compressed representation of the Grapheme_Cluster_Break=Extend\n// information from\n// http://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.\n// Each pair of elements represents a range, as an offet from the\n// previous range and a length. Numbers are in base-36, with the empty\n// string being a shorthand for 1.\nlet extend = /*@__PURE__*/"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(s => s ? parseInt(s, 36) : 1);\n// Convert offsets into absolute values\nfor (let i = 1; i < extend.length; i++)\n extend[i] += extend[i - 1];\nfunction isExtendingChar(code) {\n for (let i = 1; i < extend.length; i += 2)\n if (extend[i] > code)\n return extend[i - 1] <= code;\n return false;\n}\nfunction isRegionalIndicator(code) {\n return code >= 0x1F1E6 && code <= 0x1F1FF;\n}\nconst ZWJ = 0x200d;\n/**\nReturns a next grapheme cluster break _after_ (not equal to)\n`pos`, if `forward` is true, or before otherwise. Returns `pos`\nitself if no further cluster break is available in the string.\nMoves across surrogate pairs, extending characters (when\n`includeExtending` is true), characters joined with zero-width\njoiners, and flag emoji.\n*/\nfunction findClusterBreak(str, pos, forward = true, includeExtending = true) {\n return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);\n}\nfunction nextClusterBreak(str, pos, includeExtending) {\n if (pos == str.length)\n return pos;\n // If pos is in the middle of a surrogate pair, move to its start\n if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1)))\n pos--;\n let prev = codePointAt(str, pos);\n pos += codePointSize(prev);\n while (pos < str.length) {\n let next = codePointAt(str, pos);\n if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {\n pos += codePointSize(next);\n prev = next;\n }\n else if (isRegionalIndicator(next)) {\n let countBefore = 0, i = pos - 2;\n while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) {\n countBefore++;\n i -= 2;\n }\n if (countBefore % 2 == 0)\n break;\n else\n pos += 2;\n }\n else {\n break;\n }\n }\n return pos;\n}\nfunction prevClusterBreak(str, pos, includeExtending) {\n while (pos > 0) {\n let found = nextClusterBreak(str, pos - 2, includeExtending);\n if (found < pos)\n return found;\n pos--;\n }\n return 0;\n}\nfunction surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000; }\nfunction surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00; }\n/**\nFind the code point at the given position in a string (like the\n[`codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt)\nstring method).\n*/\nfunction codePointAt(str, pos) {\n let code0 = str.charCodeAt(pos);\n if (!surrogateHigh(code0) || pos + 1 == str.length)\n return code0;\n let code1 = str.charCodeAt(pos + 1);\n if (!surrogateLow(code1))\n return code0;\n return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000;\n}\n/**\nGiven a Unicode codepoint, return the JavaScript string that\nrespresents it (like\n[`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint)).\n*/\nfunction fromCodePoint(code) {\n if (code <= 0xffff)\n return String.fromCharCode(code);\n code -= 0x10000;\n return String.fromCharCode((code >> 10) + 0xd800, (code & 1023) + 0xdc00);\n}\n/**\nThe amount of positions a character takes up a JavaScript string.\n*/\nfunction codePointSize(code) { return code < 0x10000 ? 1 : 2; }\n\nconst DefaultSplit = /\\r\\n?|\\n/;\n/**\nDistinguishes different ways in which positions can be mapped.\n*/\nvar MapMode = /*@__PURE__*/(function (MapMode) {\n /**\n Map a position to a valid new position, even when its context\n was deleted.\n */\n MapMode[MapMode["Simple"] = 0] = "Simple";\n /**\n Return null if deletion happens across the position.\n */\n MapMode[MapMode["TrackDel"] = 1] = "TrackDel";\n /**\n Return null if the character _before_ the position is deleted.\n */\n MapMode[MapMode["TrackBefore"] = 2] = "TrackBefore";\n /**\n Return null if the character _after_ the position is deleted.\n */\n MapMode[MapMode["TrackAfter"] = 3] = "TrackAfter";\nreturn MapMode})(MapMode || (MapMode = {}));\n/**\nA change description is a variant of [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet)\nthat doesn\'t store the inserted text. As such, it can\'t be\napplied, but is cheaper to store and manipulate.\n*/\nclass ChangeDesc {\n // Sections are encoded as pairs of integers. The first is the\n // length in the current document, and the second is -1 for\n // unaffected sections, and the length of the replacement content\n // otherwise. So an insertion would be (0, n>0), a deletion (n>0,\n // 0), and a replacement two positive numbers.\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n sections) {\n this.sections = sections;\n }\n /**\n The length of the document before the change.\n */\n get length() {\n let result = 0;\n for (let i = 0; i < this.sections.length; i += 2)\n result += this.sections[i];\n return result;\n }\n /**\n The length of the document after the change.\n */\n get newLength() {\n let result = 0;\n for (let i = 0; i < this.sections.length; i += 2) {\n let ins = this.sections[i + 1];\n result += ins < 0 ? this.sections[i] : ins;\n }\n return result;\n }\n /**\n False when there are actual changes in this set.\n */\n get empty() { return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; }\n /**\n Iterate over the unchanged parts left by these changes. `posA`\n provides the position of the range in the old document, `posB`\n the new position in the changed document.\n */\n iterGaps(f) {\n for (let i = 0, posA = 0, posB = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n if (ins < 0) {\n f(posA, posB, len);\n posB += len;\n }\n else {\n posB += ins;\n }\n posA += len;\n }\n }\n /**\n Iterate over the ranges changed by these changes. (See\n [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a\n variant that also provides you with the inserted text.)\n `fromA`/`toA` provides the extent of the change in the starting\n document, `fromB`/`toB` the extent of the replacement in the\n changed document.\n \n When `individual` is true, adjacent changes (which are kept\n separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are\n reported separately.\n */\n iterChangedRanges(f, individual = false) {\n iterChanges(this, f, individual);\n }\n /**\n Get a description of the inverted form of these changes.\n */\n get invertedDesc() {\n let sections = [];\n for (let i = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n if (ins < 0)\n sections.push(len, ins);\n else\n sections.push(ins, len);\n }\n return new ChangeDesc(sections);\n }\n /**\n Compute the combined effect of applying another set of changes\n after this one. The length of the document after this set should\n match the length before `other`.\n */\n composeDesc(other) { return this.empty ? other : other.empty ? this : composeSets(this, other); }\n /**\n Map this description, which should start with the same document\n as `other`, over another set of changes, so that it can be\n applied after it. When `before` is true, map as if the changes\n in `other` happened before the ones in `this`.\n */\n mapDesc(other, before = false) { return other.empty ? this : mapSet(this, other, before); }\n mapPos(pos, assoc = -1, mode = MapMode.Simple) {\n let posA = 0, posB = 0;\n for (let i = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++], endA = posA + len;\n if (ins < 0) {\n if (endA > pos)\n return posB + (pos - posA);\n posB += len;\n }\n else {\n if (mode != MapMode.Simple && endA >= pos &&\n (mode == MapMode.TrackDel && posA < pos && endA > pos ||\n mode == MapMode.TrackBefore && posA < pos ||\n mode == MapMode.TrackAfter && endA > pos))\n return null;\n if (endA > pos || endA == pos && assoc < 0 && !len)\n return pos == posA || assoc < 0 ? posB : posB + ins;\n posB += ins;\n }\n posA = endA;\n }\n if (pos > posA)\n throw new RangeError(`Position ${pos} is out of range for changeset of length ${posA}`);\n return posB;\n }\n /**\n Check whether these changes touch a given range. When one of the\n changes entirely covers the range, the string `"cover"` is\n returned.\n */\n touchesRange(from, to = from) {\n for (let i = 0, pos = 0; i < this.sections.length && pos <= to;) {\n let len = this.sections[i++], ins = this.sections[i++], end = pos + len;\n if (ins >= 0 && pos <= to && end >= from)\n return pos < from && end > to ? "cover" : true;\n pos = end;\n }\n return false;\n }\n /**\n @internal\n */\n toString() {\n let result = "";\n for (let i = 0; i < this.sections.length;) {\n let len = this.sections[i++], ins = this.sections[i++];\n result += (result ? " " : "") + len + (ins >= 0 ? ":" + ins : "");\n }\n return result;\n }\n /**\n Serialize this change desc to a JSON-representable value.\n */\n toJSON() { return this.sections; }\n /**\n Create a change desc from its JSON representation (as produced\n by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON).\n */\n static fromJSON(json) {\n if (!Array.isArray(json) || json.length % 2 || json.some(a => typeof a != "number"))\n throw new RangeError("Invalid JSON representation of ChangeDesc");\n return new ChangeDesc(json);\n }\n /**\n @internal\n */\n static create(sections) { return new ChangeDesc(sections); }\n}\n/**\nA change set represents a group of modifications to a document. It\nstores the document length, and can only be applied to documents\nwith exactly that length.\n*/\nclass ChangeSet extends ChangeDesc {\n constructor(sections, \n /**\n @internal\n */\n inserted) {\n super(sections);\n this.inserted = inserted;\n }\n /**\n Apply the changes to a document, returning the modified\n document.\n */\n apply(doc) {\n if (this.length != doc.length)\n throw new RangeError("Applying change set to a document with the wrong length");\n iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false);\n return doc;\n }\n mapDesc(other, before = false) { return mapSet(this, other, before, true); }\n /**\n Given the document as it existed _before_ the changes, return a\n change set that represents the inverse of this set, which could\n be used to go from the document created by the changes back to\n the document as it existed before the changes.\n */\n invert(doc) {\n let sections = this.sections.slice(), inserted = [];\n for (let i = 0, pos = 0; i < sections.length; i += 2) {\n let len = sections[i], ins = sections[i + 1];\n if (ins >= 0) {\n sections[i] = ins;\n sections[i + 1] = len;\n let index = i >> 1;\n while (inserted.length < index)\n inserted.push(Text.empty);\n inserted.push(len ? doc.slice(pos, pos + len) : Text.empty);\n }\n pos += len;\n }\n return new ChangeSet(sections, inserted);\n }\n /**\n Combine two subsequent change sets into a single set. `other`\n must start in the document produced by `this`. If `this` goes\n `docA` → `docB` and `other` represents `docB` → `docC`, the\n returned value will represent the change `docA` → `docC`.\n */\n compose(other) { return this.empty ? other : other.empty ? this : composeSets(this, other, true); }\n /**\n Given another change set starting in the same document, maps this\n change set over the other, producing a new change set that can be\n applied to the document produced by applying `other`. When\n `before` is `true`, order changes as if `this` comes before\n `other`, otherwise (the default) treat `other` as coming first.\n \n Given two changes `A` and `B`, `A.compose(B.map(A))` and\n `B.compose(A.map(B, true))` will produce the same document. This\n provides a basic form of [operational\n transformation](https://en.wikipedia.org/wiki/Operational_transformation),\n and can be used for collaborative editing.\n */\n map(other, before = false) { return other.empty ? this : mapSet(this, other, before, true); }\n /**\n Iterate over the changed ranges in the document, calling `f` for\n each, with the range in the original document (`fromA`-`toA`)\n and the range that replaces it in the new document\n (`fromB`-`toB`).\n \n When `individual` is true, adjacent changes are reported\n separately.\n */\n iterChanges(f, individual = false) {\n iterChanges(this, f, individual);\n }\n /**\n Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change\n set.\n */\n get desc() { return ChangeDesc.create(this.sections); }\n /**\n @internal\n */\n filter(ranges) {\n let resultSections = [], resultInserted = [], filteredSections = [];\n let iter = new SectionIter(this);\n done: for (let i = 0, pos = 0;;) {\n let next = i == ranges.length ? 1e9 : ranges[i++];\n while (pos < next || pos == next && iter.len == 0) {\n if (iter.done)\n break done;\n let len = Math.min(iter.len, next - pos);\n addSection(filteredSections, len, -1);\n let ins = iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0;\n addSection(resultSections, len, ins);\n if (ins > 0)\n addInsert(resultInserted, resultSections, iter.text);\n iter.forward(len);\n pos += len;\n }\n let end = ranges[i++];\n while (pos < end) {\n if (iter.done)\n break done;\n let len = Math.min(iter.len, end - pos);\n addSection(resultSections, len, -1);\n addSection(filteredSections, len, iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0);\n iter.forward(len);\n pos += len;\n }\n }\n return { changes: new ChangeSet(resultSections, resultInserted),\n filtered: ChangeDesc.create(filteredSections) };\n }\n /**\n Serialize this change set to a JSON-representable value.\n */\n toJSON() {\n let parts = [];\n for (let i = 0; i < this.sections.length; i += 2) {\n let len = this.sections[i], ins = this.sections[i + 1];\n if (ins < 0)\n parts.push(len);\n else if (ins == 0)\n parts.push([len]);\n else\n parts.push([len].concat(this.inserted[i >> 1].toJSON()));\n }\n return parts;\n }\n /**\n Create a change set for the given changes, for a document of the\n given length, using `lineSep` as line separator.\n */\n static of(changes, length, lineSep) {\n let sections = [], inserted = [], pos = 0;\n let total = null;\n function flush(force = false) {\n if (!force && !sections.length)\n return;\n if (pos < length)\n addSection(sections, length - pos, -1);\n let set = new ChangeSet(sections, inserted);\n total = total ? total.compose(set.map(total)) : set;\n sections = [];\n inserted = [];\n pos = 0;\n }\n function process(spec) {\n if (Array.isArray(spec)) {\n for (let sub of spec)\n process(sub);\n }\n else if (spec instanceof ChangeSet) {\n if (spec.length != length)\n throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`);\n flush();\n total = total ? total.compose(spec.map(total)) : spec;\n }\n else {\n let { from, to = from, insert } = spec;\n if (from > to || from < 0 || to > length)\n throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`);\n let insText = !insert ? Text.empty : typeof insert == "string" ? Text.of(insert.split(lineSep || DefaultSplit)) : insert;\n let insLen = insText.length;\n if (from == to && insLen == 0)\n return;\n if (from < pos)\n flush();\n if (from > pos)\n addSection(sections, from - pos, -1);\n addSection(sections, to - from, insLen);\n addInsert(inserted, sections, insText);\n pos = to;\n }\n }\n process(changes);\n flush(!total);\n return total;\n }\n /**\n Create an empty changeset of the given length.\n */\n static empty(length) {\n return new ChangeSet(length ? [length, -1] : [], []);\n }\n /**\n Create a changeset from its JSON representation (as produced by\n [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON).\n */\n static fromJSON(json) {\n if (!Array.isArray(json))\n throw new RangeError("Invalid JSON representation of ChangeSet");\n let sections = [], inserted = [];\n for (let i = 0; i < json.length; i++) {\n let part = json[i];\n if (typeof part == "number") {\n sections.push(part, -1);\n }\n else if (!Array.isArray(part) || typeof part[0] != "number" || part.some((e, i) => i && typeof e != "string")) {\n throw new RangeError("Invalid JSON representation of ChangeSet");\n }\n else if (part.length == 1) {\n sections.push(part[0], 0);\n }\n else {\n while (inserted.length < i)\n inserted.push(Text.empty);\n inserted[i] = Text.of(part.slice(1));\n sections.push(part[0], inserted[i].length);\n }\n }\n return new ChangeSet(sections, inserted);\n }\n /**\n @internal\n */\n static createSet(sections, inserted) {\n return new ChangeSet(sections, inserted);\n }\n}\nfunction addSection(sections, len, ins, forceJoin = false) {\n if (len == 0 && ins <= 0)\n return;\n let last = sections.length - 2;\n if (last >= 0 && ins <= 0 && ins == sections[last + 1])\n sections[last] += len;\n else if (len == 0 && sections[last] == 0)\n sections[last + 1] += ins;\n else if (forceJoin) {\n sections[last] += len;\n sections[last + 1] += ins;\n }\n else\n sections.push(len, ins);\n}\nfunction addInsert(values, sections, value) {\n if (value.length == 0)\n return;\n let index = (sections.length - 2) >> 1;\n if (index < values.length) {\n values[values.length - 1] = values[values.length - 1].append(value);\n }\n else {\n while (values.length < index)\n values.push(Text.empty);\n values.push(value);\n }\n}\nfunction iterChanges(desc, f, individual) {\n let inserted = desc.inserted;\n for (let posA = 0, posB = 0, i = 0; i < desc.sections.length;) {\n let len = desc.sections[i++], ins = desc.sections[i++];\n if (ins < 0) {\n posA += len;\n posB += len;\n }\n else {\n let endA = posA, endB = posB, text = Text.empty;\n for (;;) {\n endA += len;\n endB += ins;\n if (ins && inserted)\n text = text.append(inserted[(i - 2) >> 1]);\n if (individual || i == desc.sections.length || desc.sections[i + 1] < 0)\n break;\n len = desc.sections[i++];\n ins = desc.sections[i++];\n }\n f(posA, endA, posB, endB, text);\n posA = endA;\n posB = endB;\n }\n }\n}\nfunction mapSet(setA, setB, before, mkSet = false) {\n // Produce a copy of setA that applies to the document after setB\n // has been applied (assuming both start at the same document).\n let sections = [], insert = mkSet ? [] : null;\n let a = new SectionIter(setA), b = new SectionIter(setB);\n // Iterate over both sets in parallel. inserted tracks, for changes\n // in A that have to be processed piece-by-piece, whether their\n // content has been inserted already, and refers to the section\n // index.\n for (let inserted = -1;;) {\n if (a.ins == -1 && b.ins == -1) {\n // Move across ranges skipped by both sets.\n let len = Math.min(a.len, b.len);\n addSection(sections, len, -1);\n a.forward(len);\n b.forward(len);\n }\n else if (b.ins >= 0 && (a.ins < 0 || inserted == a.i || a.off == 0 && (b.len < a.len || b.len == a.len && !before))) {\n // If there\'s a change in B that comes before the next change in\n // A (ordered by start pos, then len, then before flag), skip\n // that (and process any changes in A it covers).\n let len = b.len;\n addSection(sections, b.ins, -1);\n while (len) {\n let piece = Math.min(a.len, len);\n if (a.ins >= 0 && inserted < a.i && a.len <= piece) {\n addSection(sections, 0, a.ins);\n if (insert)\n addInsert(insert, sections, a.text);\n inserted = a.i;\n }\n a.forward(piece);\n len -= piece;\n }\n b.next();\n }\n else if (a.ins >= 0) {\n // Process the part of a change in A up to the start of the next\n // non-deletion change in B (if overlapping).\n let len = 0, left = a.len;\n while (left) {\n if (b.ins == -1) {\n let piece = Math.min(left, b.len);\n len += piece;\n left -= piece;\n b.forward(piece);\n }\n else if (b.ins == 0 && b.len < left) {\n left -= b.len;\n b.next();\n }\n else {\n break;\n }\n }\n addSection(sections, len, inserted < a.i ? a.ins : 0);\n if (insert && inserted < a.i)\n addInsert(insert, sections, a.text);\n inserted = a.i;\n a.forward(a.len - left);\n }\n else if (a.done && b.done) {\n return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections);\n }\n else {\n throw new Error("Mismatched change set lengths");\n }\n }\n}\nfunction composeSets(setA, setB, mkSet = false) {\n let sections = [];\n let insert = mkSet ? [] : null;\n let a = new SectionIter(setA), b = new SectionIter(setB);\n for (let open = false;;) {\n if (a.done && b.done) {\n return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections);\n }\n else if (a.ins == 0) { // Deletion in A\n addSection(sections, a.len, 0, open);\n a.next();\n }\n else if (b.len == 0 && !b.done) { // Insertion in B\n addSection(sections, 0, b.ins, open);\n if (insert)\n addInsert(insert, sections, b.text);\n b.next();\n }\n else if (a.done || b.done) {\n throw new Error("Mismatched change set lengths");\n }\n else {\n let len = Math.min(a.len2, b.len), sectionLen = sections.length;\n if (a.ins == -1) {\n let insB = b.ins == -1 ? -1 : b.off ? 0 : b.ins;\n addSection(sections, len, insB, open);\n if (insert && insB)\n addInsert(insert, sections, b.text);\n }\n else if (b.ins == -1) {\n addSection(sections, a.off ? 0 : a.len, len, open);\n if (insert)\n addInsert(insert, sections, a.textBit(len));\n }\n else {\n addSection(sections, a.off ? 0 : a.len, b.off ? 0 : b.ins, open);\n if (insert && !b.off)\n addInsert(insert, sections, b.text);\n }\n open = (a.ins > len || b.ins >= 0 && b.len > len) && (open || sections.length > sectionLen);\n a.forward2(len);\n b.forward(len);\n }\n }\n}\nclass SectionIter {\n constructor(set) {\n this.set = set;\n this.i = 0;\n this.next();\n }\n next() {\n let { sections } = this.set;\n if (this.i < sections.length) {\n this.len = sections[this.i++];\n this.ins = sections[this.i++];\n }\n else {\n this.len = 0;\n this.ins = -2;\n }\n this.off = 0;\n }\n get done() { return this.ins == -2; }\n get len2() { return this.ins < 0 ? this.len : this.ins; }\n get text() {\n let { inserted } = this.set, index = (this.i - 2) >> 1;\n return index >= inserted.length ? Text.empty : inserted[index];\n }\n textBit(len) {\n let { inserted } = this.set, index = (this.i - 2) >> 1;\n return index >= inserted.length && !len ? Text.empty\n : inserted[index].slice(this.off, len == null ? undefined : this.off + len);\n }\n forward(len) {\n if (len == this.len)\n this.next();\n else {\n this.len -= len;\n this.off += len;\n }\n }\n forward2(len) {\n if (this.ins == -1)\n this.forward(len);\n else if (len == this.ins)\n this.next();\n else {\n this.ins -= len;\n this.off += len;\n }\n }\n}\n\n/**\nA single selection range. When\n[`allowMultipleSelections`](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections)\nis enabled, a [selection](https://codemirror.net/6/docs/ref/#state.EditorSelection) may hold\nmultiple ranges. By default, selections hold exactly one range.\n*/\nclass SelectionRange {\n constructor(\n /**\n The lower boundary of the range.\n */\n from, \n /**\n The upper boundary of the range.\n */\n to, flags) {\n this.from = from;\n this.to = to;\n this.flags = flags;\n }\n /**\n The anchor of the range—the side that doesn\'t move when you\n extend it.\n */\n get anchor() { return this.flags & 32 /* RangeFlag.Inverted */ ? this.to : this.from; }\n /**\n The head of the range, which is moved when the range is\n [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend).\n */\n get head() { return this.flags & 32 /* RangeFlag.Inverted */ ? this.from : this.to; }\n /**\n True when `anchor` and `head` are at the same position.\n */\n get empty() { return this.from == this.to; }\n /**\n If this is a cursor that is explicitly associated with the\n character on one of its sides, this returns the side. -1 means\n the character before its position, 1 the character after, and 0\n means no association.\n */\n get assoc() { return this.flags & 8 /* RangeFlag.AssocBefore */ ? -1 : this.flags & 16 /* RangeFlag.AssocAfter */ ? 1 : 0; }\n /**\n The bidirectional text level associated with this cursor, if\n any.\n */\n get bidiLevel() {\n let level = this.flags & 7 /* RangeFlag.BidiLevelMask */;\n return level == 7 ? null : level;\n }\n /**\n The goal column (stored vertical offset) associated with a\n cursor. This is used to preserve the vertical position when\n [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across\n lines of different length.\n */\n get goalColumn() {\n let value = this.flags >> 6 /* RangeFlag.GoalColumnOffset */;\n return value == 16777215 /* RangeFlag.NoGoalColumn */ ? undefined : value;\n }\n /**\n Map this range through a change, producing a valid range in the\n updated document.\n */\n map(change, assoc = -1) {\n let from, to;\n if (this.empty) {\n from = to = change.mapPos(this.from, assoc);\n }\n else {\n from = change.mapPos(this.from, 1);\n to = change.mapPos(this.to, -1);\n }\n return from == this.from && to == this.to ? this : new SelectionRange(from, to, this.flags);\n }\n /**\n Extend this range to cover at least `from` to `to`.\n */\n extend(from, to = from) {\n if (from <= this.anchor && to >= this.anchor)\n return EditorSelection.range(from, to);\n let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to;\n return EditorSelection.range(this.anchor, head);\n }\n /**\n Compare this range to another range.\n */\n eq(other, includeAssoc = false) {\n return this.anchor == other.anchor && this.head == other.head &&\n (!includeAssoc || !this.empty || this.assoc == other.assoc);\n }\n /**\n Return a JSON-serializable object representing the range.\n */\n toJSON() { return { anchor: this.anchor, head: this.head }; }\n /**\n Convert a JSON representation of a range to a `SelectionRange`\n instance.\n */\n static fromJSON(json) {\n if (!json || typeof json.anchor != "number" || typeof json.head != "number")\n throw new RangeError("Invalid JSON representation for SelectionRange");\n return EditorSelection.range(json.anchor, json.head);\n }\n /**\n @internal\n */\n static create(from, to, flags) {\n return new SelectionRange(from, to, flags);\n }\n}\n/**\nAn editor selection holds one or more selection ranges.\n*/\nclass EditorSelection {\n constructor(\n /**\n The ranges in the selection, sorted by position. Ranges cannot\n overlap (but they may touch, if they aren\'t empty).\n */\n ranges, \n /**\n The index of the _main_ range in the selection (which is\n usually the range that was added last).\n */\n mainIndex) {\n this.ranges = ranges;\n this.mainIndex = mainIndex;\n }\n /**\n Map a selection through a change. Used to adjust the selection\n position for changes.\n */\n map(change, assoc = -1) {\n if (change.empty)\n return this;\n return EditorSelection.create(this.ranges.map(r => r.map(change, assoc)), this.mainIndex);\n }\n /**\n Compare this selection to another selection. By default, ranges\n are compared only by position. When `includeAssoc` is true,\n cursor ranges must also have the same\n [`assoc`](https://codemirror.net/6/docs/ref/#state.SelectionRange.assoc) value.\n */\n eq(other, includeAssoc = false) {\n if (this.ranges.length != other.ranges.length ||\n this.mainIndex != other.mainIndex)\n return false;\n for (let i = 0; i < this.ranges.length; i++)\n if (!this.ranges[i].eq(other.ranges[i], includeAssoc))\n return false;\n return true;\n }\n /**\n Get the primary selection range. Usually, you should make sure\n your code applies to _all_ ranges, by using methods like\n [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange).\n */\n get main() { return this.ranges[this.mainIndex]; }\n /**\n Make sure the selection only has one range. Returns a selection\n holding only the main range from this selection.\n */\n asSingle() {\n return this.ranges.length == 1 ? this : new EditorSelection([this.main], 0);\n }\n /**\n Extend this selection with an extra range.\n */\n addRange(range, main = true) {\n return EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1);\n }\n /**\n Replace a given range with another range, and then normalize the\n selection to merge and sort ranges if necessary.\n */\n replaceRange(range, which = this.mainIndex) {\n let ranges = this.ranges.slice();\n ranges[which] = range;\n return EditorSelection.create(ranges, this.mainIndex);\n }\n /**\n Convert this selection to an object that can be serialized to\n JSON.\n */\n toJSON() {\n return { ranges: this.ranges.map(r => r.toJSON()), main: this.mainIndex };\n }\n /**\n Create a selection from a JSON representation.\n */\n static fromJSON(json) {\n if (!json || !Array.isArray(json.ranges) || typeof json.main != "number" || json.main >= json.ranges.length)\n throw new RangeError("Invalid JSON representation for EditorSelection");\n return new EditorSelection(json.ranges.map((r) => SelectionRange.fromJSON(r)), json.main);\n }\n /**\n Create a selection holding a single range.\n */\n static single(anchor, head = anchor) {\n return new EditorSelection([EditorSelection.range(anchor, head)], 0);\n }\n /**\n Sort and merge the given set of ranges, creating a valid\n selection.\n */\n static create(ranges, mainIndex = 0) {\n if (ranges.length == 0)\n throw new RangeError("A selection needs at least one range");\n for (let pos = 0, i = 0; i < ranges.length; i++) {\n let range = ranges[i];\n if (range.empty ? range.from <= pos : range.from < pos)\n return EditorSelection.normalized(ranges.slice(), mainIndex);\n pos = range.to;\n }\n return new EditorSelection(ranges, mainIndex);\n }\n /**\n Create a cursor selection range at the given position. You can\n safely ignore the optional arguments in most situations.\n */\n static cursor(pos, assoc = 0, bidiLevel, goalColumn) {\n return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 8 /* RangeFlag.AssocBefore */ : 16 /* RangeFlag.AssocAfter */) |\n (bidiLevel == null ? 7 : Math.min(6, bidiLevel)) |\n ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215 /* RangeFlag.NoGoalColumn */) << 6 /* RangeFlag.GoalColumnOffset */));\n }\n /**\n Create a selection range.\n */\n static range(anchor, head, goalColumn, bidiLevel) {\n let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 16777215 /* RangeFlag.NoGoalColumn */) << 6 /* RangeFlag.GoalColumnOffset */) |\n (bidiLevel == null ? 7 : Math.min(6, bidiLevel));\n return head < anchor ? SelectionRange.create(head, anchor, 32 /* RangeFlag.Inverted */ | 16 /* RangeFlag.AssocAfter */ | flags)\n : SelectionRange.create(anchor, head, (head > anchor ? 8 /* RangeFlag.AssocBefore */ : 0) | flags);\n }\n /**\n @internal\n */\n static normalized(ranges, mainIndex = 0) {\n let main = ranges[mainIndex];\n ranges.sort((a, b) => a.from - b.from);\n mainIndex = ranges.indexOf(main);\n for (let i = 1; i < ranges.length; i++) {\n let range = ranges[i], prev = ranges[i - 1];\n if (range.empty ? range.from <= prev.to : range.from < prev.to) {\n let from = prev.from, to = Math.max(range.to, prev.to);\n if (i <= mainIndex)\n mainIndex--;\n ranges.splice(--i, 2, range.anchor > range.head ? EditorSelection.range(to, from) : EditorSelection.range(from, to));\n }\n }\n return new EditorSelection(ranges, mainIndex);\n }\n}\nfunction checkSelection(selection, docLength) {\n for (let range of selection.ranges)\n if (range.to > docLength)\n throw new RangeError("Selection points outside of document");\n}\n\nlet nextID = 0;\n/**\nA facet is a labeled value that is associated with an editor\nstate. It takes inputs from any number of extensions, and combines\nthose into a single output value.\n\nExamples of uses of facets are the [tab\nsize](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize), [editor\nattributes](https://codemirror.net/6/docs/ref/#view.EditorView^editorAttributes), and [update\nlisteners](https://codemirror.net/6/docs/ref/#view.EditorView^updateListener).\n\nNote that `Facet` instances can be used anywhere where\n[`FacetReader`](https://codemirror.net/6/docs/ref/#state.FacetReader) is expected.\n*/\nclass Facet {\n constructor(\n /**\n @internal\n */\n combine, \n /**\n @internal\n */\n compareInput, \n /**\n @internal\n */\n compare, isStatic, enables) {\n this.combine = combine;\n this.compareInput = compareInput;\n this.compare = compare;\n this.isStatic = isStatic;\n /**\n @internal\n */\n this.id = nextID++;\n this.default = combine([]);\n this.extensions = typeof enables == "function" ? enables(this) : enables;\n }\n /**\n Returns a facet reader for this facet, which can be used to\n [read](https://codemirror.net/6/docs/ref/#state.EditorState.facet) it but not to define values for it.\n */\n get reader() { return this; }\n /**\n Define a new facet.\n */\n static define(config = {}) {\n return new Facet(config.combine || ((a) => a), config.compareInput || ((a, b) => a === b), config.compare || (!config.combine ? sameArray : (a, b) => a === b), !!config.static, config.enables);\n }\n /**\n Returns an extension that adds the given value to this facet.\n */\n of(value) {\n return new FacetProvider([], this, 0 /* Provider.Static */, value);\n }\n /**\n Create an extension that computes a value for the facet from a\n state. You must take care to declare the parts of the state that\n this value depends on, since your function is only called again\n for a new state when one of those parts changed.\n \n In cases where your value depends only on a single field, you\'ll\n want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead.\n */\n compute(deps, get) {\n if (this.isStatic)\n throw new Error("Can\'t compute a static facet");\n return new FacetProvider(deps, this, 1 /* Provider.Single */, get);\n }\n /**\n Create an extension that computes zero or more values for this\n facet from a state.\n */\n computeN(deps, get) {\n if (this.isStatic)\n throw new Error("Can\'t compute a static facet");\n return new FacetProvider(deps, this, 2 /* Provider.Multi */, get);\n }\n from(field, get) {\n if (!get)\n get = x => x;\n return this.compute([field], state => get(state.field(field)));\n }\n}\nfunction sameArray(a, b) {\n return a == b || a.length == b.length && a.every((e, i) => e === b[i]);\n}\nclass FacetProvider {\n constructor(dependencies, facet, type, value) {\n this.dependencies = dependencies;\n this.facet = facet;\n this.type = type;\n this.value = value;\n this.id = nextID++;\n }\n dynamicSlot(addresses) {\n var _a;\n let getter = this.value;\n let compare = this.facet.compareInput;\n let id = this.id, idx = addresses[id] >> 1, multi = this.type == 2 /* Provider.Multi */;\n let depDoc = false, depSel = false, depAddrs = [];\n for (let dep of this.dependencies) {\n if (dep == "doc")\n depDoc = true;\n else if (dep == "selection")\n depSel = true;\n else if ((((_a = addresses[dep.id]) !== null && _a !== void 0 ? _a : 1) & 1) == 0)\n depAddrs.push(addresses[dep.id]);\n }\n return {\n create(state) {\n state.values[idx] = getter(state);\n return 1 /* SlotStatus.Changed */;\n },\n update(state, tr) {\n if ((depDoc && tr.docChanged) || (depSel && (tr.docChanged || tr.selection)) || ensureAll(state, depAddrs)) {\n let newVal = getter(state);\n if (multi ? !compareArray(newVal, state.values[idx], compare) : !compare(newVal, state.values[idx])) {\n state.values[idx] = newVal;\n return 1 /* SlotStatus.Changed */;\n }\n }\n return 0;\n },\n reconfigure: (state, oldState) => {\n let newVal, oldAddr = oldState.config.address[id];\n if (oldAddr != null) {\n let oldVal = getAddr(oldState, oldAddr);\n if (this.dependencies.every(dep => {\n return dep instanceof Facet ? oldState.facet(dep) === state.facet(dep) :\n dep instanceof StateField ? oldState.field(dep, false) == state.field(dep, false) : true;\n }) || (multi ? compareArray(newVal = getter(state), oldVal, compare) : compare(newVal = getter(state), oldVal))) {\n state.values[idx] = oldVal;\n return 0;\n }\n }\n else {\n newVal = getter(state);\n }\n state.values[idx] = newVal;\n return 1 /* SlotStatus.Changed */;\n }\n };\n }\n}\nfunction compareArray(a, b, compare) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (!compare(a[i], b[i]))\n return false;\n return true;\n}\nfunction ensureAll(state, addrs) {\n let changed = false;\n for (let addr of addrs)\n if (ensureAddr(state, addr) & 1 /* SlotStatus.Changed */)\n changed = true;\n return changed;\n}\nfunction dynamicFacetSlot(addresses, facet, providers) {\n let providerAddrs = providers.map(p => addresses[p.id]);\n let providerTypes = providers.map(p => p.type);\n let dynamic = providerAddrs.filter(p => !(p & 1));\n let idx = addresses[facet.id] >> 1;\n function get(state) {\n let values = [];\n for (let i = 0; i < providerAddrs.length; i++) {\n let value = getAddr(state, providerAddrs[i]);\n if (providerTypes[i] == 2 /* Provider.Multi */)\n for (let val of value)\n values.push(val);\n else\n values.push(value);\n }\n return facet.combine(values);\n }\n return {\n create(state) {\n for (let addr of providerAddrs)\n ensureAddr(state, addr);\n state.values[idx] = get(state);\n return 1 /* SlotStatus.Changed */;\n },\n update(state, tr) {\n if (!ensureAll(state, dynamic))\n return 0;\n let value = get(state);\n if (facet.compare(value, state.values[idx]))\n return 0;\n state.values[idx] = value;\n return 1 /* SlotStatus.Changed */;\n },\n reconfigure(state, oldState) {\n let depChanged = ensureAll(state, providerAddrs);\n let oldProviders = oldState.config.facets[facet.id], oldValue = oldState.facet(facet);\n if (oldProviders && !depChanged && sameArray(providers, oldProviders)) {\n state.values[idx] = oldValue;\n return 0;\n }\n let value = get(state);\n if (facet.compare(value, oldValue)) {\n state.values[idx] = oldValue;\n return 0;\n }\n state.values[idx] = value;\n return 1 /* SlotStatus.Changed */;\n }\n };\n}\nconst initField = /*@__PURE__*/Facet.define({ static: true });\n/**\nFields can store additional information in an editor state, and\nkeep it in sync with the rest of the state.\n*/\nclass StateField {\n constructor(\n /**\n @internal\n */\n id, createF, updateF, compareF, \n /**\n @internal\n */\n spec) {\n this.id = id;\n this.createF = createF;\n this.updateF = updateF;\n this.compareF = compareF;\n this.spec = spec;\n /**\n @internal\n */\n this.provides = undefined;\n }\n /**\n Define a state field.\n */\n static define(config) {\n let field = new StateField(nextID++, config.create, config.update, config.compare || ((a, b) => a === b), config);\n if (config.provide)\n field.provides = config.provide(field);\n return field;\n }\n create(state) {\n let init = state.facet(initField).find(i => i.field == this);\n return ((init === null || init === void 0 ? void 0 : init.create) || this.createF)(state);\n }\n /**\n @internal\n */\n slot(addresses) {\n let idx = addresses[this.id] >> 1;\n return {\n create: (state) => {\n state.values[idx] = this.create(state);\n return 1 /* SlotStatus.Changed */;\n },\n update: (state, tr) => {\n let oldVal = state.values[idx];\n let value = this.updateF(oldVal, tr);\n if (this.compareF(oldVal, value))\n return 0;\n state.values[idx] = value;\n return 1 /* SlotStatus.Changed */;\n },\n reconfigure: (state, oldState) => {\n if (oldState.config.address[this.id] != null) {\n state.values[idx] = oldState.field(this);\n return 0;\n }\n state.values[idx] = this.create(state);\n return 1 /* SlotStatus.Changed */;\n }\n };\n }\n /**\n Returns an extension that enables this field and overrides the\n way it is initialized. Can be useful when you need to provide a\n non-default starting value for the field.\n */\n init(create) {\n return [this, initField.of({ field: this, create })];\n }\n /**\n State field instances can be used as\n [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a\n given state.\n */\n get extension() { return this; }\n}\nconst Prec_ = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 };\nfunction prec(value) {\n return (ext) => new PrecExtension(ext, value);\n}\n/**\nBy default extensions are registered in the order they are found\nin the flattened form of nested array that was provided.\nIndividual extension values can be assigned a precedence to\noverride this. Extensions that do not have a precedence set get\nthe precedence of the nearest parent with a precedence, or\n[`default`](https://codemirror.net/6/docs/ref/#state.Prec.default) if there is no such parent. The\nfinal ordering of extensions is determined by first sorting by\nprecedence and then by order within each precedence.\n*/\nconst Prec = {\n /**\n The highest precedence level, for extensions that should end up\n near the start of the precedence ordering.\n */\n highest: /*@__PURE__*/prec(Prec_.highest),\n /**\n A higher-than-default precedence, for extensions that should\n come before those with default precedence.\n */\n high: /*@__PURE__*/prec(Prec_.high),\n /**\n The default precedence, which is also used for extensions\n without an explicit precedence.\n */\n default: /*@__PURE__*/prec(Prec_.default),\n /**\n A lower-than-default precedence.\n */\n low: /*@__PURE__*/prec(Prec_.low),\n /**\n The lowest precedence level. Meant for things that should end up\n near the end of the extension order.\n */\n lowest: /*@__PURE__*/prec(Prec_.lowest)\n};\nclass PrecExtension {\n constructor(inner, prec) {\n this.inner = inner;\n this.prec = prec;\n }\n}\n/**\nExtension compartments can be used to make a configuration\ndynamic. By [wrapping](https://codemirror.net/6/docs/ref/#state.Compartment.of) part of your\nconfiguration in a compartment, you can later\n[replace](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure) that part through a\ntransaction.\n*/\nclass Compartment {\n /**\n Create an instance of this compartment to add to your [state\n configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions).\n */\n of(ext) { return new CompartmentInstance(this, ext); }\n /**\n Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that\n reconfigures this compartment.\n */\n reconfigure(content) {\n return Compartment.reconfigure.of({ compartment: this, extension: content });\n }\n /**\n Get the current content of the compartment in the state, or\n `undefined` if it isn\'t present.\n */\n get(state) {\n return state.config.compartments.get(this);\n }\n}\nclass CompartmentInstance {\n constructor(compartment, inner) {\n this.compartment = compartment;\n this.inner = inner;\n }\n}\nclass Configuration {\n constructor(base, compartments, dynamicSlots, address, staticValues, facets) {\n this.base = base;\n this.compartments = compartments;\n this.dynamicSlots = dynamicSlots;\n this.address = address;\n this.staticValues = staticValues;\n this.facets = facets;\n this.statusTemplate = [];\n while (this.statusTemplate.length < dynamicSlots.length)\n this.statusTemplate.push(0 /* SlotStatus.Unresolved */);\n }\n staticFacet(facet) {\n let addr = this.address[facet.id];\n return addr == null ? facet.default : this.staticValues[addr >> 1];\n }\n static resolve(base, compartments, oldState) {\n let fields = [];\n let facets = Object.create(null);\n let newCompartments = new Map();\n for (let ext of flatten(base, compartments, newCompartments)) {\n if (ext instanceof StateField)\n fields.push(ext);\n else\n (facets[ext.facet.id] || (facets[ext.facet.id] = [])).push(ext);\n }\n let address = Object.create(null);\n let staticValues = [];\n let dynamicSlots = [];\n for (let field of fields) {\n address[field.id] = dynamicSlots.length << 1;\n dynamicSlots.push(a => field.slot(a));\n }\n let oldFacets = oldState === null || oldState === void 0 ? void 0 : oldState.config.facets;\n for (let id in facets) {\n let providers = facets[id], facet = providers[0].facet;\n let oldProviders = oldFacets && oldFacets[id] || [];\n if (providers.every(p => p.type == 0 /* Provider.Static */)) {\n address[facet.id] = (staticValues.length << 1) | 1;\n if (sameArray(oldProviders, providers)) {\n staticValues.push(oldState.facet(facet));\n }\n else {\n let value = facet.combine(providers.map(p => p.value));\n staticValues.push(oldState && facet.compare(value, oldState.facet(facet)) ? oldState.facet(facet) : value);\n }\n }\n else {\n for (let p of providers) {\n if (p.type == 0 /* Provider.Static */) {\n address[p.id] = (staticValues.length << 1) | 1;\n staticValues.push(p.value);\n }\n else {\n address[p.id] = dynamicSlots.length << 1;\n dynamicSlots.push(a => p.dynamicSlot(a));\n }\n }\n address[facet.id] = dynamicSlots.length << 1;\n dynamicSlots.push(a => dynamicFacetSlot(a, facet, providers));\n }\n }\n let dynamic = dynamicSlots.map(f => f(address));\n return new Configuration(base, newCompartments, dynamic, address, staticValues, facets);\n }\n}\nfunction flatten(extension, compartments, newCompartments) {\n let result = [[], [], [], [], []];\n let seen = new Map();\n function inner(ext, prec) {\n let known = seen.get(ext);\n if (known != null) {\n if (known <= prec)\n return;\n let found = result[known].indexOf(ext);\n if (found > -1)\n result[known].splice(found, 1);\n if (ext instanceof CompartmentInstance)\n newCompartments.delete(ext.compartment);\n }\n seen.set(ext, prec);\n if (Array.isArray(ext)) {\n for (let e of ext)\n inner(e, prec);\n }\n else if (ext instanceof CompartmentInstance) {\n if (newCompartments.has(ext.compartment))\n throw new RangeError(`Duplicate use of compartment in extensions`);\n let content = compartments.get(ext.compartment) || ext.inner;\n newCompartments.set(ext.compartment, content);\n inner(content, prec);\n }\n else if (ext instanceof PrecExtension) {\n inner(ext.inner, ext.prec);\n }\n else if (ext instanceof StateField) {\n result[prec].push(ext);\n if (ext.provides)\n inner(ext.provides, prec);\n }\n else if (ext instanceof FacetProvider) {\n result[prec].push(ext);\n if (ext.facet.extensions)\n inner(ext.facet.extensions, Prec_.default);\n }\n else {\n let content = ext.extension;\n if (!content)\n throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);\n inner(content, prec);\n }\n }\n inner(extension, Prec_.default);\n return result.reduce((a, b) => a.concat(b));\n}\nfunction ensureAddr(state, addr) {\n if (addr & 1)\n return 2 /* SlotStatus.Computed */;\n let idx = addr >> 1;\n let status = state.status[idx];\n if (status == 4 /* SlotStatus.Computing */)\n throw new Error("Cyclic dependency between fields and/or facets");\n if (status & 2 /* SlotStatus.Computed */)\n return status;\n state.status[idx] = 4 /* SlotStatus.Computing */;\n let changed = state.computeSlot(state, state.config.dynamicSlots[idx]);\n return state.status[idx] = 2 /* SlotStatus.Computed */ | changed;\n}\nfunction getAddr(state, addr) {\n return addr & 1 ? state.config.staticValues[addr >> 1] : state.values[addr >> 1];\n}\n\nconst languageData = /*@__PURE__*/Facet.define();\nconst allowMultipleSelections = /*@__PURE__*/Facet.define({\n combine: values => values.some(v => v),\n static: true\n});\nconst lineSeparator = /*@__PURE__*/Facet.define({\n combine: values => values.length ? values[0] : undefined,\n static: true\n});\nconst changeFilter = /*@__PURE__*/Facet.define();\nconst transactionFilter = /*@__PURE__*/Facet.define();\nconst transactionExtender = /*@__PURE__*/Facet.define();\nconst readOnly = /*@__PURE__*/Facet.define({\n combine: values => values.length ? values[0] : false\n});\n\n/**\nAnnotations are tagged values that are used to add metadata to\ntransactions in an extensible way. They should be used to model\nthings that effect the entire transaction (such as its [time\nstamp](https://codemirror.net/6/docs/ref/#state.Transaction^time) or information about its\n[origin](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent)). For effects that happen\n_alongside_ the other changes made by the transaction, [state\neffects](https://codemirror.net/6/docs/ref/#state.StateEffect) are more appropriate.\n*/\nclass Annotation {\n /**\n @internal\n */\n constructor(\n /**\n The annotation type.\n */\n type, \n /**\n The value of this annotation.\n */\n value) {\n this.type = type;\n this.value = value;\n }\n /**\n Define a new type of annotation.\n */\n static define() { return new AnnotationType(); }\n}\n/**\nMarker that identifies a type of [annotation](https://codemirror.net/6/docs/ref/#state.Annotation).\n*/\nclass AnnotationType {\n /**\n Create an instance of this annotation.\n */\n of(value) { return new Annotation(this, value); }\n}\n/**\nRepresentation of a type of state effect. Defined with\n[`StateEffect.define`](https://codemirror.net/6/docs/ref/#state.StateEffect^define).\n*/\nclass StateEffectType {\n /**\n @internal\n */\n constructor(\n // The `any` types in these function types are there to work\n // around TypeScript issue #37631, where the type guard on\n // `StateEffect.is` mysteriously stops working when these properly\n // have type `Value`.\n /**\n @internal\n */\n map) {\n this.map = map;\n }\n /**\n Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this\n type.\n */\n of(value) { return new StateEffect(this, value); }\n}\n/**\nState effects can be used to represent additional effects\nassociated with a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction.effects). They\nare often useful to model changes to custom [state\nfields](https://codemirror.net/6/docs/ref/#state.StateField), when those changes aren\'t implicit in\ndocument or selection changes.\n*/\nclass StateEffect {\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n type, \n /**\n The value of this effect.\n */\n value) {\n this.type = type;\n this.value = value;\n }\n /**\n Map this effect through a position mapping. Will return\n `undefined` when that ends up deleting the effect.\n */\n map(mapping) {\n let mapped = this.type.map(this.value, mapping);\n return mapped === undefined ? undefined : mapped == this.value ? this : new StateEffect(this.type, mapped);\n }\n /**\n Tells you whether this effect object is of a given\n [type](https://codemirror.net/6/docs/ref/#state.StateEffectType).\n */\n is(type) { return this.type == type; }\n /**\n Define a new effect type. The type parameter indicates the type\n of values that his effect holds. It should be a type that\n doesn\'t include `undefined`, since that is used in\n [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is\n removed.\n */\n static define(spec = {}) {\n return new StateEffectType(spec.map || (v => v));\n }\n /**\n Map an array of effects through a change set.\n */\n static mapEffects(effects, mapping) {\n if (!effects.length)\n return effects;\n let result = [];\n for (let effect of effects) {\n let mapped = effect.map(mapping);\n if (mapped)\n result.push(mapped);\n }\n return result;\n }\n}\n/**\nThis effect can be used to reconfigure the root extensions of\nthe editor. Doing this will discard any extensions\n[appended](https://codemirror.net/6/docs/ref/#state.StateEffect^appendConfig), but does not reset\nthe content of [reconfigured](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure)\ncompartments.\n*/\nStateEffect.reconfigure = /*@__PURE__*/StateEffect.define();\n/**\nAppend extensions to the top-level configuration of the editor.\n*/\nStateEffect.appendConfig = /*@__PURE__*/StateEffect.define();\n/**\nChanges to the editor state are grouped into transactions.\nTypically, a user action creates a single transaction, which may\ncontain any number of document changes, may change the selection,\nor have other effects. Create a transaction by calling\n[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update), or immediately\ndispatch one by calling\n[`EditorView.dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch).\n*/\nclass Transaction {\n constructor(\n /**\n The state from which the transaction starts.\n */\n startState, \n /**\n The document changes made by this transaction.\n */\n changes, \n /**\n The selection set by this transaction, or undefined if it\n doesn\'t explicitly set a selection.\n */\n selection, \n /**\n The effects added to the transaction.\n */\n effects, \n /**\n @internal\n */\n annotations, \n /**\n Whether the selection should be scrolled into view after this\n transaction is dispatched.\n */\n scrollIntoView) {\n this.startState = startState;\n this.changes = changes;\n this.selection = selection;\n this.effects = effects;\n this.annotations = annotations;\n this.scrollIntoView = scrollIntoView;\n /**\n @internal\n */\n this._doc = null;\n /**\n @internal\n */\n this._state = null;\n if (selection)\n checkSelection(selection, changes.newLength);\n if (!annotations.some((a) => a.type == Transaction.time))\n this.annotations = annotations.concat(Transaction.time.of(Date.now()));\n }\n /**\n @internal\n */\n static create(startState, changes, selection, effects, annotations, scrollIntoView) {\n return new Transaction(startState, changes, selection, effects, annotations, scrollIntoView);\n }\n /**\n The new document produced by the transaction. Contrary to\n [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won\'t\n force the entire new state to be computed right away, so it is\n recommended that [transaction\n filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter\n when they need to look at the new document.\n */\n get newDoc() {\n return this._doc || (this._doc = this.changes.apply(this.startState.doc));\n }\n /**\n The new selection produced by the transaction. If\n [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined,\n this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state\'s\n current selection through the changes made by the transaction.\n */\n get newSelection() {\n return this.selection || this.startState.selection.map(this.changes);\n }\n /**\n The new state created by the transaction. Computed on demand\n (but retained for subsequent access), so it is recommended not to\n access it in [transaction\n filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible.\n */\n get state() {\n if (!this._state)\n this.startState.applyTransaction(this);\n return this._state;\n }\n /**\n Get the value of the given annotation type, if any.\n */\n annotation(type) {\n for (let ann of this.annotations)\n if (ann.type == type)\n return ann.value;\n return undefined;\n }\n /**\n Indicates whether the transaction changed the document.\n */\n get docChanged() { return !this.changes.empty; }\n /**\n Indicates whether this transaction reconfigures the state\n (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or\n with a top-level configuration\n [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure).\n */\n get reconfigured() { return this.startState.config != this.state.config; }\n /**\n Returns true if the transaction has a [user\n event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to\n or more specific than `event`. For example, if the transaction\n has `"select.pointer"` as user event, `"select"` and\n `"select.pointer"` will match it.\n */\n isUserEvent(event) {\n let e = this.annotation(Transaction.userEvent);\n return !!(e && (e == event || e.length > event.length && e.slice(0, event.length) == event && e[event.length] == "."));\n }\n}\n/**\nAnnotation used to store transaction timestamps. Automatically\nadded to every transaction, holding `Date.now()`.\n*/\nTransaction.time = /*@__PURE__*/Annotation.define();\n/**\nAnnotation used to associate a transaction with a user interface\nevent. Holds a string identifying the event, using a\ndot-separated format to support attaching more specific\ninformation. The events used by the core libraries are:\n\n - `"input"` when content is entered\n - `"input.type"` for typed input\n - `"input.type.compose"` for composition\n - `"input.paste"` for pasted input\n - `"input.drop"` when adding content with drag-and-drop\n - `"input.complete"` when autocompleting\n - `"delete"` when the user deletes content\n - `"delete.selection"` when deleting the selection\n - `"delete.forward"` when deleting forward from the selection\n - `"delete.backward"` when deleting backward from the selection\n - `"delete.cut"` when cutting to the clipboard\n - `"move"` when content is moved\n - `"move.drop"` when content is moved within the editor through drag-and-drop\n - `"select"` when explicitly changing the selection\n - `"select.pointer"` when selecting with a mouse or other pointing device\n - `"undo"` and `"redo"` for history actions\n\nUse [`isUserEvent`](https://codemirror.net/6/docs/ref/#state.Transaction.isUserEvent) to check\nwhether the annotation matches a given event.\n*/\nTransaction.userEvent = /*@__PURE__*/Annotation.define();\n/**\nAnnotation indicating whether a transaction should be added to\nthe undo history or not.\n*/\nTransaction.addToHistory = /*@__PURE__*/Annotation.define();\n/**\nAnnotation indicating (when present and true) that a transaction\nrepresents a change made by some other actor, not the user. This\nis used, for example, to tag other people\'s changes in\ncollaborative editing.\n*/\nTransaction.remote = /*@__PURE__*/Annotation.define();\nfunction joinRanges(a, b) {\n let result = [];\n for (let iA = 0, iB = 0;;) {\n let from, to;\n if (iA < a.length && (iB == b.length || b[iB] >= a[iA])) {\n from = a[iA++];\n to = a[iA++];\n }\n else if (iB < b.length) {\n from = b[iB++];\n to = b[iB++];\n }\n else\n return result;\n if (!result.length || result[result.length - 1] < from)\n result.push(from, to);\n else if (result[result.length - 1] < to)\n result[result.length - 1] = to;\n }\n}\nfunction mergeTransaction(a, b, sequential) {\n var _a;\n let mapForA, mapForB, changes;\n if (sequential) {\n mapForA = b.changes;\n mapForB = ChangeSet.empty(b.changes.length);\n changes = a.changes.compose(b.changes);\n }\n else {\n mapForA = b.changes.map(a.changes);\n mapForB = a.changes.mapDesc(b.changes, true);\n changes = a.changes.compose(mapForA);\n }\n return {\n changes,\n selection: b.selection ? b.selection.map(mapForB) : (_a = a.selection) === null || _a === void 0 ? void 0 : _a.map(mapForA),\n effects: StateEffect.mapEffects(a.effects, mapForA).concat(StateEffect.mapEffects(b.effects, mapForB)),\n annotations: a.annotations.length ? a.annotations.concat(b.annotations) : b.annotations,\n scrollIntoView: a.scrollIntoView || b.scrollIntoView\n };\n}\nfunction resolveTransactionInner(state, spec, docSize) {\n let sel = spec.selection, annotations = asArray(spec.annotations);\n if (spec.userEvent)\n annotations = annotations.concat(Transaction.userEvent.of(spec.userEvent));\n return {\n changes: spec.changes instanceof ChangeSet ? spec.changes\n : ChangeSet.of(spec.changes || [], docSize, state.facet(lineSeparator)),\n selection: sel && (sel instanceof EditorSelection ? sel : EditorSelection.single(sel.anchor, sel.head)),\n effects: asArray(spec.effects),\n annotations,\n scrollIntoView: !!spec.scrollIntoView\n };\n}\nfunction resolveTransaction(state, specs, filter) {\n let s = resolveTransactionInner(state, specs.length ? specs[0] : {}, state.doc.length);\n if (specs.length && specs[0].filter === false)\n filter = false;\n for (let i = 1; i < specs.length; i++) {\n if (specs[i].filter === false)\n filter = false;\n let seq = !!specs[i].sequential;\n s = mergeTransaction(s, resolveTransactionInner(state, specs[i], seq ? s.changes.newLength : state.doc.length), seq);\n }\n let tr = Transaction.create(state, s.changes, s.selection, s.effects, s.annotations, s.scrollIntoView);\n return extendTransaction(filter ? filterTransaction(tr) : tr);\n}\n// Finish a transaction by applying filters if necessary.\nfunction filterTransaction(tr) {\n let state = tr.startState;\n // Change filters\n let result = true;\n for (let filter of state.facet(changeFilter)) {\n let value = filter(tr);\n if (value === false) {\n result = false;\n break;\n }\n if (Array.isArray(value))\n result = result === true ? value : joinRanges(result, value);\n }\n if (result !== true) {\n let changes, back;\n if (result === false) {\n back = tr.changes.invertedDesc;\n changes = ChangeSet.empty(state.doc.length);\n }\n else {\n let filtered = tr.changes.filter(result);\n changes = filtered.changes;\n back = filtered.filtered.mapDesc(filtered.changes).invertedDesc;\n }\n tr = Transaction.create(state, changes, tr.selection && tr.selection.map(back), StateEffect.mapEffects(tr.effects, back), tr.annotations, tr.scrollIntoView);\n }\n // Transaction filters\n let filters = state.facet(transactionFilter);\n for (let i = filters.length - 1; i >= 0; i--) {\n let filtered = filters[i](tr);\n if (filtered instanceof Transaction)\n tr = filtered;\n else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction)\n tr = filtered[0];\n else\n tr = resolveTransaction(state, asArray(filtered), false);\n }\n return tr;\n}\nfunction extendTransaction(tr) {\n let state = tr.startState, extenders = state.facet(transactionExtender), spec = tr;\n for (let i = extenders.length - 1; i >= 0; i--) {\n let extension = extenders[i](tr);\n if (extension && Object.keys(extension).length)\n spec = mergeTransaction(spec, resolveTransactionInner(state, extension, tr.changes.newLength), true);\n }\n return spec == tr ? tr : Transaction.create(state, tr.changes, tr.selection, spec.effects, spec.annotations, spec.scrollIntoView);\n}\nconst none = [];\nfunction asArray(value) {\n return value == null ? none : Array.isArray(value) ? value : [value];\n}\n\n/**\nThe categories produced by a [character\ncategorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer). These are used\ndo things like selecting by word.\n*/\nvar CharCategory = /*@__PURE__*/(function (CharCategory) {\n /**\n Word characters.\n */\n CharCategory[CharCategory["Word"] = 0] = "Word";\n /**\n Whitespace.\n */\n CharCategory[CharCategory["Space"] = 1] = "Space";\n /**\n Anything else.\n */\n CharCategory[CharCategory["Other"] = 2] = "Other";\nreturn CharCategory})(CharCategory || (CharCategory = {}));\nconst nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\nlet wordChar;\ntry {\n wordChar = /*@__PURE__*/new RegExp("[\\\\p{Alphabetic}\\\\p{Number}_]", "u");\n}\ncatch (_) { }\nfunction hasWordChar(str) {\n if (wordChar)\n return wordChar.test(str);\n for (let i = 0; i < str.length; i++) {\n let ch = str[i];\n if (/\\w/.test(ch) || ch > "\\x80" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)))\n return true;\n }\n return false;\n}\nfunction makeCategorizer(wordChars) {\n return (char) => {\n if (!/\\S/.test(char))\n return CharCategory.Space;\n if (hasWordChar(char))\n return CharCategory.Word;\n for (let i = 0; i < wordChars.length; i++)\n if (char.indexOf(wordChars[i]) > -1)\n return CharCategory.Word;\n return CharCategory.Other;\n };\n}\n\n/**\nThe editor state class is a persistent (immutable) data structure.\nTo update a state, you [create](https://codemirror.net/6/docs/ref/#state.EditorState.update) a\n[transaction](https://codemirror.net/6/docs/ref/#state.Transaction), which produces a _new_ state\ninstance, without modifying the original object.\n\nAs such, _never_ mutate properties of a state directly. That\'ll\njust break things.\n*/\nclass EditorState {\n constructor(\n /**\n @internal\n */\n config, \n /**\n The current document.\n */\n doc, \n /**\n The current selection.\n */\n selection, \n /**\n @internal\n */\n values, computeSlot, tr) {\n this.config = config;\n this.doc = doc;\n this.selection = selection;\n this.values = values;\n this.status = config.statusTemplate.slice();\n this.computeSlot = computeSlot;\n // Fill in the computed state immediately, so that further queries\n // for it made during the update return this state\n if (tr)\n tr._state = this;\n for (let i = 0; i < this.config.dynamicSlots.length; i++)\n ensureAddr(this, i << 1);\n this.computeSlot = null;\n }\n field(field, require = true) {\n let addr = this.config.address[field.id];\n if (addr == null) {\n if (require)\n throw new RangeError("Field is not present in this state");\n return undefined;\n }\n ensureAddr(this, addr);\n return getAddr(this, addr);\n }\n /**\n Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this\n state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec)\n can be passed. Unless\n [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the\n [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec\n are assumed to start in the _current_ document (not the document\n produced by previous specs), and its\n [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and\n [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer\n to the document created by its _own_ changes. The resulting\n transaction contains the combined effect of all the different\n specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later\n specs take precedence over earlier ones.\n */\n update(...specs) {\n return resolveTransaction(this, specs, true);\n }\n /**\n @internal\n */\n applyTransaction(tr) {\n let conf = this.config, { base, compartments } = conf;\n for (let effect of tr.effects) {\n if (effect.is(Compartment.reconfigure)) {\n if (conf) {\n compartments = new Map;\n conf.compartments.forEach((val, key) => compartments.set(key, val));\n conf = null;\n }\n compartments.set(effect.value.compartment, effect.value.extension);\n }\n else if (effect.is(StateEffect.reconfigure)) {\n conf = null;\n base = effect.value;\n }\n else if (effect.is(StateEffect.appendConfig)) {\n conf = null;\n base = asArray(base).concat(effect.value);\n }\n }\n let startValues;\n if (!conf) {\n conf = Configuration.resolve(base, compartments, this);\n let intermediateState = new EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null);\n startValues = intermediateState.values;\n }\n else {\n startValues = tr.startState.values.slice();\n }\n let selection = tr.startState.facet(allowMultipleSelections) ? tr.newSelection : tr.newSelection.asSingle();\n new EditorState(conf, tr.newDoc, selection, startValues, (state, slot) => slot.update(state, tr), tr);\n }\n /**\n Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that\n replaces every selection range with the given content.\n */\n replaceSelection(text) {\n if (typeof text == "string")\n text = this.toText(text);\n return this.changeByRange(range => ({ changes: { from: range.from, to: range.to, insert: text },\n range: EditorSelection.cursor(range.from + text.length) }));\n }\n /**\n Create a set of changes and a new selection by running the given\n function for each range in the active selection. The function\n can return an optional set of changes (in the coordinate space\n of the start document), plus an updated range (in the coordinate\n space of the document produced by the call\'s own changes). This\n method will merge all the changes and ranges into a single\n changeset and selection, and return it as a [transaction\n spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to\n [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update).\n */\n changeByRange(f) {\n let sel = this.selection;\n let result1 = f(sel.ranges[0]);\n let changes = this.changes(result1.changes), ranges = [result1.range];\n let effects = asArray(result1.effects);\n for (let i = 1; i < sel.ranges.length; i++) {\n let result = f(sel.ranges[i]);\n let newChanges = this.changes(result.changes), newMapped = newChanges.map(changes);\n for (let j = 0; j < i; j++)\n ranges[j] = ranges[j].map(newMapped);\n let mapBy = changes.mapDesc(newChanges, true);\n ranges.push(result.range.map(mapBy));\n changes = changes.compose(newMapped);\n effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray(result.effects), mapBy));\n }\n return {\n changes,\n selection: EditorSelection.create(ranges, sel.mainIndex),\n effects\n };\n }\n /**\n Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change\n description, taking the state\'s document length and line\n separator into account.\n */\n changes(spec = []) {\n if (spec instanceof ChangeSet)\n return spec;\n return ChangeSet.of(spec, this.doc.length, this.facet(EditorState.lineSeparator));\n }\n /**\n Using the state\'s [line\n separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a\n [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string.\n */\n toText(string) {\n return Text.of(string.split(this.facet(EditorState.lineSeparator) || DefaultSplit));\n }\n /**\n Return the given range of the document as a string.\n */\n sliceDoc(from = 0, to = this.doc.length) {\n return this.doc.sliceString(from, to, this.lineBreak);\n }\n /**\n Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet).\n */\n facet(facet) {\n let addr = this.config.address[facet.id];\n if (addr == null)\n return facet.default;\n ensureAddr(this, addr);\n return getAddr(this, addr);\n }\n /**\n Convert this state to a JSON-serializable object. When custom\n fields should be serialized, you can pass them in as an object\n mapping property names (in the resulting object, which should\n not use `doc` or `selection`) to fields.\n */\n toJSON(fields) {\n let result = {\n doc: this.sliceDoc(),\n selection: this.selection.toJSON()\n };\n if (fields)\n for (let prop in fields) {\n let value = fields[prop];\n if (value instanceof StateField && this.config.address[value.id] != null)\n result[prop] = value.spec.toJSON(this.field(fields[prop]), this);\n }\n return result;\n }\n /**\n Deserialize a state from its JSON representation. When custom\n fields should be deserialized, pass the same object you passed\n to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as\n third argument.\n */\n static fromJSON(json, config = {}, fields) {\n if (!json || typeof json.doc != "string")\n throw new RangeError("Invalid JSON representation for EditorState");\n let fieldInit = [];\n if (fields)\n for (let prop in fields) {\n if (Object.prototype.hasOwnProperty.call(json, prop)) {\n let field = fields[prop], value = json[prop];\n fieldInit.push(field.init(state => field.spec.fromJSON(value, state)));\n }\n }\n return EditorState.create({\n doc: json.doc,\n selection: EditorSelection.fromJSON(json.selection),\n extensions: config.extensions ? fieldInit.concat([config.extensions]) : fieldInit\n });\n }\n /**\n Create a new state. You\'ll usually only need this when\n initializing an editor—updated states are created by applying\n transactions.\n */\n static create(config = {}) {\n let configuration = Configuration.resolve(config.extensions || [], new Map);\n let doc = config.doc instanceof Text ? config.doc\n : Text.of((config.doc || "").split(configuration.staticFacet(EditorState.lineSeparator) || DefaultSplit));\n let selection = !config.selection ? EditorSelection.single(0)\n : config.selection instanceof EditorSelection ? config.selection\n : EditorSelection.single(config.selection.anchor, config.selection.head);\n checkSelection(selection, doc.length);\n if (!configuration.staticFacet(allowMultipleSelections))\n selection = selection.asSingle();\n return new EditorState(configuration, doc, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null);\n }\n /**\n The size (in columns) of a tab in the document, determined by\n the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet.\n */\n get tabSize() { return this.facet(EditorState.tabSize); }\n /**\n Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator)\n string for this state.\n */\n get lineBreak() { return this.facet(EditorState.lineSeparator) || "\\n"; }\n /**\n Returns true when the editor is\n [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only.\n */\n get readOnly() { return this.facet(readOnly); }\n /**\n Look up a translation for the given phrase (via the\n [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the\n original string if no translation is found.\n \n If additional arguments are passed, they will be inserted in\n place of markers like `$1` (for the first value) and `$2`, etc.\n A single `$` is equivalent to `$1`, and `$$` will produce a\n literal dollar sign.\n */\n phrase(phrase, ...insert) {\n for (let map of this.facet(EditorState.phrases))\n if (Object.prototype.hasOwnProperty.call(map, phrase)) {\n phrase = map[phrase];\n break;\n }\n if (insert.length)\n phrase = phrase.replace(/\\$(\\$|\\d*)/g, (m, i) => {\n if (i == "$")\n return "$";\n let n = +(i || 1);\n return !n || n > insert.length ? m : insert[n - 1];\n });\n return phrase;\n }\n /**\n Find the values for a given language data field, provided by the\n the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet.\n \n Examples of language data fields are...\n \n - [`"commentTokens"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying\n comment syntax.\n - [`"autocomplete"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override)\n for providing language-specific completion sources.\n - [`"wordChars"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding\n characters that should be considered part of words in this\n language.\n - [`"closeBrackets"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls\n bracket closing behavior.\n */\n languageDataAt(name, pos, side = -1) {\n let values = [];\n for (let provider of this.facet(languageData)) {\n for (let result of provider(this, pos, side)) {\n if (Object.prototype.hasOwnProperty.call(result, name))\n values.push(result[name]);\n }\n }\n return values;\n }\n /**\n Return a function that can categorize strings (expected to\n represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak))\n into one of:\n \n - Word (contains an alphanumeric character or a character\n explicitly listed in the local language\'s `"wordChars"`\n language data, which should be a string)\n - Space (contains only whitespace)\n - Other (anything else)\n */\n charCategorizer(at) {\n return makeCategorizer(this.languageDataAt("wordChars", at).join(""));\n }\n /**\n Find the word at the given position, meaning the range\n containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters\n around it. If no word characters are adjacent to the position,\n this returns null.\n */\n wordAt(pos) {\n let { text, from, length } = this.doc.lineAt(pos);\n let cat = this.charCategorizer(pos);\n let start = pos - from, end = pos - from;\n while (start > 0) {\n let prev = findClusterBreak(text, start, false);\n if (cat(text.slice(prev, start)) != CharCategory.Word)\n break;\n start = prev;\n }\n while (end < length) {\n let next = findClusterBreak(text, end);\n if (cat(text.slice(end, next)) != CharCategory.Word)\n break;\n end = next;\n }\n return start == end ? null : EditorSelection.range(start + from, end + from);\n }\n}\n/**\nA facet that, when enabled, causes the editor to allow multiple\nranges to be selected. Be careful though, because by default the\neditor relies on the native DOM selection, which cannot handle\nmultiple selections. An extension like\n[`drawSelection`](https://codemirror.net/6/docs/ref/#view.drawSelection) can be used to make\nsecondary selections visible to the user.\n*/\nEditorState.allowMultipleSelections = allowMultipleSelections;\n/**\nConfigures the tab size to use in this state. The first\n(highest-precedence) value of the facet is used. If no value is\ngiven, this defaults to 4.\n*/\nEditorState.tabSize = /*@__PURE__*/Facet.define({\n combine: values => values.length ? values[0] : 4\n});\n/**\nThe line separator to use. By default, any of `"\\n"`, `"\\r\\n"`\nand `"\\r"` is treated as a separator when splitting lines, and\nlines are joined with `"\\n"`.\n\nWhen you configure a value here, only that precise separator\nwill be used, allowing you to round-trip documents through the\neditor without normalizing line separators.\n*/\nEditorState.lineSeparator = lineSeparator;\n/**\nThis facet controls the value of the\n[`readOnly`](https://codemirror.net/6/docs/ref/#state.EditorState.readOnly) getter, which is\nconsulted by commands and extensions that implement editing\nfunctionality to determine whether they should apply. It\ndefaults to false, but when its highest-precedence value is\n`true`, such functionality disables itself.\n\nNot to be confused with\n[`EditorView.editable`](https://codemirror.net/6/docs/ref/#view.EditorView^editable), which\ncontrols whether the editor\'s DOM is set to be editable (and\nthus focusable).\n*/\nEditorState.readOnly = readOnly;\n/**\nRegisters translation phrases. The\n[`phrase`](https://codemirror.net/6/docs/ref/#state.EditorState.phrase) method will look through\nall objects registered with this facet to find translations for\nits argument.\n*/\nEditorState.phrases = /*@__PURE__*/Facet.define({\n compare(a, b) {\n let kA = Object.keys(a), kB = Object.keys(b);\n return kA.length == kB.length && kA.every(k => a[k] == b[k]);\n }\n});\n/**\nA facet used to register [language\ndata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) providers.\n*/\nEditorState.languageData = languageData;\n/**\nFacet used to register change filters, which are called for each\ntransaction (unless explicitly\n[disabled](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter)), and can suppress\npart of the transaction\'s changes.\n\nSuch a function can return `true` to indicate that it doesn\'t\nwant to do anything, `false` to completely stop the changes in\nthe transaction, or a set of ranges in which changes should be\nsuppressed. Such ranges are represented as an array of numbers,\nwith each pair of two numbers indicating the start and end of a\nrange. So for example `[10, 20, 100, 110]` suppresses changes\nbetween 10 and 20, and between 100 and 110.\n*/\nEditorState.changeFilter = changeFilter;\n/**\nFacet used to register a hook that gets a chance to update or\nreplace transaction specs before they are applied. This will\nonly be applied for transactions that don\'t have\n[`filter`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter) set to `false`. You\ncan either return a single transaction spec (possibly the input\ntransaction), or an array of specs (which will be combined in\nthe same way as the arguments to\n[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update)).\n\nWhen possible, it is recommended to avoid accessing\n[`Transaction.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state) in a filter,\nsince it will force creation of a state that will then be\ndiscarded again, if the transaction is actually filtered.\n\n(This functionality should be used with care. Indiscriminately\nmodifying transaction is likely to break something or degrade\nthe user experience.)\n*/\nEditorState.transactionFilter = transactionFilter;\n/**\nThis is a more limited form of\n[`transactionFilter`](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter),\nwhich can only add\n[annotations](https://codemirror.net/6/docs/ref/#state.TransactionSpec.annotations) and\n[effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects). _But_, this type\nof filter runs even if the transaction has disabled regular\n[filtering](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter), making it suitable\nfor effects that don\'t need to touch the changes or selection,\nbut do want to process every transaction.\n\nExtenders run _after_ filters, when both are present.\n*/\nEditorState.transactionExtender = transactionExtender;\nCompartment.reconfigure = /*@__PURE__*/StateEffect.define();\n\n/**\nUtility function for combining behaviors to fill in a config\nobject from an array of provided configs. `defaults` should hold\ndefault values for all optional fields in `Config`.\n\nThe function will, by default, error\nwhen a field gets two values that aren\'t `===`-equal, but you can\nprovide combine functions per field to do something else.\n*/\nfunction combineConfig(configs, defaults, // Should hold only the optional properties of Config, but I haven\'t managed to express that\ncombine = {}) {\n let result = {};\n for (let config of configs)\n for (let key of Object.keys(config)) {\n let value = config[key], current = result[key];\n if (current === undefined)\n result[key] = value;\n else if (current === value || value === undefined) ; // No conflict\n else if (Object.hasOwnProperty.call(combine, key))\n result[key] = combine[key](current, value);\n else\n throw new Error("Config merge conflict for field " + key);\n }\n for (let key in defaults)\n if (result[key] === undefined)\n result[key] = defaults[key];\n return result;\n}\n\n/**\nEach range is associated with a value, which must inherit from\nthis class.\n*/\nclass RangeValue {\n /**\n Compare this value with another value. Used when comparing\n rangesets. The default implementation compares by identity.\n Unless you are only creating a fixed number of unique instances\n of your value type, it is a good idea to implement this\n properly.\n */\n eq(other) { return this == other; }\n /**\n Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value.\n */\n range(from, to = from) { return Range.create(from, to, this); }\n}\nRangeValue.prototype.startSide = RangeValue.prototype.endSide = 0;\nRangeValue.prototype.point = false;\nRangeValue.prototype.mapMode = MapMode.TrackDel;\n/**\nA range associates a value with a range of positions.\n*/\nclass Range {\n constructor(\n /**\n The range\'s start position.\n */\n from, \n /**\n Its end position.\n */\n to, \n /**\n The value associated with this range.\n */\n value) {\n this.from = from;\n this.to = to;\n this.value = value;\n }\n /**\n @internal\n */\n static create(from, to, value) {\n return new Range(from, to, value);\n }\n}\nfunction cmpRange(a, b) {\n return a.from - b.from || a.value.startSide - b.value.startSide;\n}\nclass Chunk {\n constructor(from, to, value, \n // Chunks are marked with the largest point that occurs\n // in them (or -1 for no points), so that scans that are\n // only interested in points (such as the\n // heightmap-related logic) can skip range-only chunks.\n maxPoint) {\n this.from = from;\n this.to = to;\n this.value = value;\n this.maxPoint = maxPoint;\n }\n get length() { return this.to[this.to.length - 1]; }\n // Find the index of the given position and side. Use the ranges\'\n // `from` pos when `end == false`, `to` when `end == true`.\n findIndex(pos, side, end, startAt = 0) {\n let arr = end ? this.to : this.from;\n for (let lo = startAt, hi = arr.length;;) {\n if (lo == hi)\n return lo;\n let mid = (lo + hi) >> 1;\n let diff = arr[mid] - pos || (end ? this.value[mid].endSide : this.value[mid].startSide) - side;\n if (mid == lo)\n return diff >= 0 ? lo : hi;\n if (diff >= 0)\n hi = mid;\n else\n lo = mid + 1;\n }\n }\n between(offset, from, to, f) {\n for (let i = this.findIndex(from, -1000000000 /* C.Far */, true), e = this.findIndex(to, 1000000000 /* C.Far */, false, i); i < e; i++)\n if (f(this.from[i] + offset, this.to[i] + offset, this.value[i]) === false)\n return false;\n }\n map(offset, changes) {\n let value = [], from = [], to = [], newPos = -1, maxPoint = -1;\n for (let i = 0; i < this.value.length; i++) {\n let val = this.value[i], curFrom = this.from[i] + offset, curTo = this.to[i] + offset, newFrom, newTo;\n if (curFrom == curTo) {\n let mapped = changes.mapPos(curFrom, val.startSide, val.mapMode);\n if (mapped == null)\n continue;\n newFrom = newTo = mapped;\n if (val.startSide != val.endSide) {\n newTo = changes.mapPos(curFrom, val.endSide);\n if (newTo < newFrom)\n continue;\n }\n }\n else {\n newFrom = changes.mapPos(curFrom, val.startSide);\n newTo = changes.mapPos(curTo, val.endSide);\n if (newFrom > newTo || newFrom == newTo && val.startSide > 0 && val.endSide <= 0)\n continue;\n }\n if ((newTo - newFrom || val.endSide - val.startSide) < 0)\n continue;\n if (newPos < 0)\n newPos = newFrom;\n if (val.point)\n maxPoint = Math.max(maxPoint, newTo - newFrom);\n value.push(val);\n from.push(newFrom - newPos);\n to.push(newTo - newPos);\n }\n return { mapped: value.length ? new Chunk(from, to, value, maxPoint) : null, pos: newPos };\n }\n}\n/**\nA range set stores a collection of [ranges](https://codemirror.net/6/docs/ref/#state.Range) in a\nway that makes them efficient to [map](https://codemirror.net/6/docs/ref/#state.RangeSet.map) and\n[update](https://codemirror.net/6/docs/ref/#state.RangeSet.update). This is an immutable data\nstructure.\n*/\nclass RangeSet {\n constructor(\n /**\n @internal\n */\n chunkPos, \n /**\n @internal\n */\n chunk, \n /**\n @internal\n */\n nextLayer, \n /**\n @internal\n */\n maxPoint) {\n this.chunkPos = chunkPos;\n this.chunk = chunk;\n this.nextLayer = nextLayer;\n this.maxPoint = maxPoint;\n }\n /**\n @internal\n */\n static create(chunkPos, chunk, nextLayer, maxPoint) {\n return new RangeSet(chunkPos, chunk, nextLayer, maxPoint);\n }\n /**\n @internal\n */\n get length() {\n let last = this.chunk.length - 1;\n return last < 0 ? 0 : Math.max(this.chunkEnd(last), this.nextLayer.length);\n }\n /**\n The number of ranges in the set.\n */\n get size() {\n if (this.isEmpty)\n return 0;\n let size = this.nextLayer.size;\n for (let chunk of this.chunk)\n size += chunk.value.length;\n return size;\n }\n /**\n @internal\n */\n chunkEnd(index) {\n return this.chunkPos[index] + this.chunk[index].length;\n }\n /**\n Update the range set, optionally adding new ranges or filtering\n out existing ones.\n \n (Note: The type parameter is just there as a kludge to work\n around TypeScript variance issues that prevented `RangeSet`\n from being a subtype of `RangeSet` when `X` is a subtype of\n `Y`.)\n */\n update(updateSpec) {\n let { add = [], sort = false, filterFrom = 0, filterTo = this.length } = updateSpec;\n let filter = updateSpec.filter;\n if (add.length == 0 && !filter)\n return this;\n if (sort)\n add = add.slice().sort(cmpRange);\n if (this.isEmpty)\n return add.length ? RangeSet.of(add) : this;\n let cur = new LayerCursor(this, null, -1).goto(0), i = 0, spill = [];\n let builder = new RangeSetBuilder();\n while (cur.value || i < add.length) {\n if (i < add.length && (cur.from - add[i].from || cur.startSide - add[i].value.startSide) >= 0) {\n let range = add[i++];\n if (!builder.addInner(range.from, range.to, range.value))\n spill.push(range);\n }\n else if (cur.rangeIndex == 1 && cur.chunkIndex < this.chunk.length &&\n (i == add.length || this.chunkEnd(cur.chunkIndex) < add[i].from) &&\n (!filter || filterFrom > this.chunkEnd(cur.chunkIndex) || filterTo < this.chunkPos[cur.chunkIndex]) &&\n builder.addChunk(this.chunkPos[cur.chunkIndex], this.chunk[cur.chunkIndex])) {\n cur.nextChunk();\n }\n else {\n if (!filter || filterFrom > cur.to || filterTo < cur.from || filter(cur.from, cur.to, cur.value)) {\n if (!builder.addInner(cur.from, cur.to, cur.value))\n spill.push(Range.create(cur.from, cur.to, cur.value));\n }\n cur.next();\n }\n }\n return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? RangeSet.empty\n : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo }));\n }\n /**\n Map this range set through a set of changes, return the new set.\n */\n map(changes) {\n if (changes.empty || this.isEmpty)\n return this;\n let chunks = [], chunkPos = [], maxPoint = -1;\n for (let i = 0; i < this.chunk.length; i++) {\n let start = this.chunkPos[i], chunk = this.chunk[i];\n let touch = changes.touchesRange(start, start + chunk.length);\n if (touch === false) {\n maxPoint = Math.max(maxPoint, chunk.maxPoint);\n chunks.push(chunk);\n chunkPos.push(changes.mapPos(start));\n }\n else if (touch === true) {\n let { mapped, pos } = chunk.map(start, changes);\n if (mapped) {\n maxPoint = Math.max(maxPoint, mapped.maxPoint);\n chunks.push(mapped);\n chunkPos.push(pos);\n }\n }\n }\n let next = this.nextLayer.map(changes);\n return chunks.length == 0 ? next : new RangeSet(chunkPos, chunks, next || RangeSet.empty, maxPoint);\n }\n /**\n Iterate over the ranges that touch the region `from` to `to`,\n calling `f` for each. There is no guarantee that the ranges will\n be reported in any specific order. When the callback returns\n `false`, iteration stops.\n */\n between(from, to, f) {\n if (this.isEmpty)\n return;\n for (let i = 0; i < this.chunk.length; i++) {\n let start = this.chunkPos[i], chunk = this.chunk[i];\n if (to >= start && from <= start + chunk.length &&\n chunk.between(start, from - start, to - start, f) === false)\n return;\n }\n this.nextLayer.between(from, to, f);\n }\n /**\n Iterate over the ranges in this set, in order, including all\n ranges that end at or after `from`.\n */\n iter(from = 0) {\n return HeapCursor.from([this]).goto(from);\n }\n /**\n @internal\n */\n get isEmpty() { return this.nextLayer == this; }\n /**\n Iterate over the ranges in a collection of sets, in order,\n starting from `from`.\n */\n static iter(sets, from = 0) {\n return HeapCursor.from(sets).goto(from);\n }\n /**\n Iterate over two groups of sets, calling methods on `comparator`\n to notify it of possible differences.\n */\n static compare(oldSets, newSets, \n /**\n This indicates how the underlying data changed between these\n ranges, and is needed to synchronize the iteration.\n */\n textDiff, comparator, \n /**\n Can be used to ignore all non-point ranges, and points below\n the given size. When -1, all ranges are compared.\n */\n minPointSize = -1) {\n let a = oldSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);\n let b = newSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);\n let sharedChunks = findSharedChunks(a, b, textDiff);\n let sideA = new SpanCursor(a, sharedChunks, minPointSize);\n let sideB = new SpanCursor(b, sharedChunks, minPointSize);\n textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator));\n if (textDiff.empty && textDiff.length == 0)\n compare(sideA, 0, sideB, 0, 0, comparator);\n }\n /**\n Compare the contents of two groups of range sets, returning true\n if they are equivalent in the given range.\n */\n static eq(oldSets, newSets, from = 0, to) {\n if (to == null)\n to = 1000000000 /* C.Far */ - 1;\n let a = oldSets.filter(set => !set.isEmpty && newSets.indexOf(set) < 0);\n let b = newSets.filter(set => !set.isEmpty && oldSets.indexOf(set) < 0);\n if (a.length != b.length)\n return false;\n if (!a.length)\n return true;\n let sharedChunks = findSharedChunks(a, b);\n let sideA = new SpanCursor(a, sharedChunks, 0).goto(from), sideB = new SpanCursor(b, sharedChunks, 0).goto(from);\n for (;;) {\n if (sideA.to != sideB.to ||\n !sameValues(sideA.active, sideB.active) ||\n sideA.point && (!sideB.point || !sideA.point.eq(sideB.point)))\n return false;\n if (sideA.to > to)\n return true;\n sideA.next();\n sideB.next();\n }\n }\n /**\n Iterate over a group of range sets at the same time, notifying\n the iterator about the ranges covering every given piece of\n content. Returns the open count (see\n [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end\n of the iteration.\n */\n static spans(sets, from, to, iterator, \n /**\n When given and greater than -1, only points of at least this\n size are taken into account.\n */\n minPointSize = -1) {\n let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from;\n let openRanges = cursor.openStart;\n for (;;) {\n let curTo = Math.min(cursor.to, to);\n if (cursor.point) {\n let active = cursor.activeForPoint(cursor.to);\n let openCount = cursor.pointFrom < from ? active.length + 1\n : cursor.point.startSide < 0 ? active.length\n : Math.min(active.length, openRanges);\n iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);\n openRanges = Math.min(cursor.openEnd(curTo), active.length);\n }\n else if (curTo > pos) {\n iterator.span(pos, curTo, cursor.active, openRanges);\n openRanges = cursor.openEnd(curTo);\n }\n if (cursor.to > to)\n return openRanges + (cursor.point && cursor.to > to ? 1 : 0);\n pos = cursor.to;\n cursor.next();\n }\n }\n /**\n Create a range set for the given range or array of ranges. By\n default, this expects the ranges to be _sorted_ (by start\n position and, if two start at the same position,\n `value.startSide`). You can pass `true` as second argument to\n cause the method to sort them.\n */\n static of(ranges, sort = false) {\n let build = new RangeSetBuilder();\n for (let range of ranges instanceof Range ? [ranges] : sort ? lazySort(ranges) : ranges)\n build.add(range.from, range.to, range.value);\n return build.finish();\n }\n /**\n Join an array of range sets into a single set.\n */\n static join(sets) {\n if (!sets.length)\n return RangeSet.empty;\n let result = sets[sets.length - 1];\n for (let i = sets.length - 2; i >= 0; i--) {\n for (let layer = sets[i]; layer != RangeSet.empty; layer = layer.nextLayer)\n result = new RangeSet(layer.chunkPos, layer.chunk, result, Math.max(layer.maxPoint, result.maxPoint));\n }\n return result;\n }\n}\n/**\nThe empty set of ranges.\n*/\nRangeSet.empty = /*@__PURE__*/new RangeSet([], [], null, -1);\nfunction lazySort(ranges) {\n if (ranges.length > 1)\n for (let prev = ranges[0], i = 1; i < ranges.length; i++) {\n let cur = ranges[i];\n if (cmpRange(prev, cur) > 0)\n return ranges.slice().sort(cmpRange);\n prev = cur;\n }\n return ranges;\n}\nRangeSet.empty.nextLayer = RangeSet.empty;\n/**\nA range set builder is a data structure that helps build up a\n[range set](https://codemirror.net/6/docs/ref/#state.RangeSet) directly, without first allocating\nan array of [`Range`](https://codemirror.net/6/docs/ref/#state.Range) objects.\n*/\nclass RangeSetBuilder {\n finishChunk(newArrays) {\n this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint));\n this.chunkPos.push(this.chunkStart);\n this.chunkStart = -1;\n this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint);\n this.maxPoint = -1;\n if (newArrays) {\n this.from = [];\n this.to = [];\n this.value = [];\n }\n }\n /**\n Create an empty builder.\n */\n constructor() {\n this.chunks = [];\n this.chunkPos = [];\n this.chunkStart = -1;\n this.last = null;\n this.lastFrom = -1000000000 /* C.Far */;\n this.lastTo = -1000000000 /* C.Far */;\n this.from = [];\n this.to = [];\n this.value = [];\n this.maxPoint = -1;\n this.setMaxPoint = -1;\n this.nextLayer = null;\n }\n /**\n Add a range. Ranges should be added in sorted (by `from` and\n `value.startSide`) order.\n */\n add(from, to, value) {\n if (!this.addInner(from, to, value))\n (this.nextLayer || (this.nextLayer = new RangeSetBuilder)).add(from, to, value);\n }\n /**\n @internal\n */\n addInner(from, to, value) {\n let diff = from - this.lastTo || value.startSide - this.last.endSide;\n if (diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0)\n throw new Error("Ranges must be added sorted by `from` position and `startSide`");\n if (diff < 0)\n return false;\n if (this.from.length == 250 /* C.ChunkSize */)\n this.finishChunk(true);\n if (this.chunkStart < 0)\n this.chunkStart = from;\n this.from.push(from - this.chunkStart);\n this.to.push(to - this.chunkStart);\n this.last = value;\n this.lastFrom = from;\n this.lastTo = to;\n this.value.push(value);\n if (value.point)\n this.maxPoint = Math.max(this.maxPoint, to - from);\n return true;\n }\n /**\n @internal\n */\n addChunk(from, chunk) {\n if ((from - this.lastTo || chunk.value[0].startSide - this.last.endSide) < 0)\n return false;\n if (this.from.length)\n this.finishChunk(true);\n this.setMaxPoint = Math.max(this.setMaxPoint, chunk.maxPoint);\n this.chunks.push(chunk);\n this.chunkPos.push(from);\n let last = chunk.value.length - 1;\n this.last = chunk.value[last];\n this.lastFrom = chunk.from[last] + from;\n this.lastTo = chunk.to[last] + from;\n return true;\n }\n /**\n Finish the range set. Returns the new set. The builder can\'t be\n used anymore after this has been called.\n */\n finish() { return this.finishInner(RangeSet.empty); }\n /**\n @internal\n */\n finishInner(next) {\n if (this.from.length)\n this.finishChunk(false);\n if (this.chunks.length == 0)\n return next;\n let result = RangeSet.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(next) : next, this.setMaxPoint);\n this.from = null; // Make sure further `add` calls produce errors\n return result;\n }\n}\nfunction findSharedChunks(a, b, textDiff) {\n let inA = new Map();\n for (let set of a)\n for (let i = 0; i < set.chunk.length; i++)\n if (set.chunk[i].maxPoint <= 0)\n inA.set(set.chunk[i], set.chunkPos[i]);\n let shared = new Set();\n for (let set of b)\n for (let i = 0; i < set.chunk.length; i++) {\n let known = inA.get(set.chunk[i]);\n if (known != null && (textDiff ? textDiff.mapPos(known) : known) == set.chunkPos[i] &&\n !(textDiff === null || textDiff === void 0 ? void 0 : textDiff.touchesRange(known, known + set.chunk[i].length)))\n shared.add(set.chunk[i]);\n }\n return shared;\n}\nclass LayerCursor {\n constructor(layer, skip, minPoint, rank = 0) {\n this.layer = layer;\n this.skip = skip;\n this.minPoint = minPoint;\n this.rank = rank;\n }\n get startSide() { return this.value ? this.value.startSide : 0; }\n get endSide() { return this.value ? this.value.endSide : 0; }\n goto(pos, side = -1000000000 /* C.Far */) {\n this.chunkIndex = this.rangeIndex = 0;\n this.gotoInner(pos, side, false);\n return this;\n }\n gotoInner(pos, side, forward) {\n while (this.chunkIndex < this.layer.chunk.length) {\n let next = this.layer.chunk[this.chunkIndex];\n if (!(this.skip && this.skip.has(next) ||\n this.layer.chunkEnd(this.chunkIndex) < pos ||\n next.maxPoint < this.minPoint))\n break;\n this.chunkIndex++;\n forward = false;\n }\n if (this.chunkIndex < this.layer.chunk.length) {\n let rangeIndex = this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true);\n if (!forward || this.rangeIndex < rangeIndex)\n this.setRangeIndex(rangeIndex);\n }\n this.next();\n }\n forward(pos, side) {\n if ((this.to - pos || this.endSide - side) < 0)\n this.gotoInner(pos, side, true);\n }\n next() {\n for (;;) {\n if (this.chunkIndex == this.layer.chunk.length) {\n this.from = this.to = 1000000000 /* C.Far */;\n this.value = null;\n break;\n }\n else {\n let chunkPos = this.layer.chunkPos[this.chunkIndex], chunk = this.layer.chunk[this.chunkIndex];\n let from = chunkPos + chunk.from[this.rangeIndex];\n this.from = from;\n this.to = chunkPos + chunk.to[this.rangeIndex];\n this.value = chunk.value[this.rangeIndex];\n this.setRangeIndex(this.rangeIndex + 1);\n if (this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint)\n break;\n }\n }\n }\n setRangeIndex(index) {\n if (index == this.layer.chunk[this.chunkIndex].value.length) {\n this.chunkIndex++;\n if (this.skip) {\n while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]))\n this.chunkIndex++;\n }\n this.rangeIndex = 0;\n }\n else {\n this.rangeIndex = index;\n }\n }\n nextChunk() {\n this.chunkIndex++;\n this.rangeIndex = 0;\n this.next();\n }\n compare(other) {\n return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank ||\n this.to - other.to || this.endSide - other.endSide;\n }\n}\nclass HeapCursor {\n constructor(heap) {\n this.heap = heap;\n }\n static from(sets, skip = null, minPoint = -1) {\n let heap = [];\n for (let i = 0; i < sets.length; i++) {\n for (let cur = sets[i]; !cur.isEmpty; cur = cur.nextLayer) {\n if (cur.maxPoint >= minPoint)\n heap.push(new LayerCursor(cur, skip, minPoint, i));\n }\n }\n return heap.length == 1 ? heap[0] : new HeapCursor(heap);\n }\n get startSide() { return this.value ? this.value.startSide : 0; }\n goto(pos, side = -1000000000 /* C.Far */) {\n for (let cur of this.heap)\n cur.goto(pos, side);\n for (let i = this.heap.length >> 1; i >= 0; i--)\n heapBubble(this.heap, i);\n this.next();\n return this;\n }\n forward(pos, side) {\n for (let cur of this.heap)\n cur.forward(pos, side);\n for (let i = this.heap.length >> 1; i >= 0; i--)\n heapBubble(this.heap, i);\n if ((this.to - pos || this.value.endSide - side) < 0)\n this.next();\n }\n next() {\n if (this.heap.length == 0) {\n this.from = this.to = 1000000000 /* C.Far */;\n this.value = null;\n this.rank = -1;\n }\n else {\n let top = this.heap[0];\n this.from = top.from;\n this.to = top.to;\n this.value = top.value;\n this.rank = top.rank;\n if (top.value)\n top.next();\n heapBubble(this.heap, 0);\n }\n }\n}\nfunction heapBubble(heap, index) {\n for (let cur = heap[index];;) {\n let childIndex = (index << 1) + 1;\n if (childIndex >= heap.length)\n break;\n let child = heap[childIndex];\n if (childIndex + 1 < heap.length && child.compare(heap[childIndex + 1]) >= 0) {\n child = heap[childIndex + 1];\n childIndex++;\n }\n if (cur.compare(child) < 0)\n break;\n heap[childIndex] = cur;\n heap[index] = child;\n index = childIndex;\n }\n}\nclass SpanCursor {\n constructor(sets, skip, minPoint) {\n this.minPoint = minPoint;\n this.active = [];\n this.activeTo = [];\n this.activeRank = [];\n this.minActive = -1;\n // A currently active point range, if any\n this.point = null;\n this.pointFrom = 0;\n this.pointRank = 0;\n this.to = -1000000000 /* C.Far */;\n this.endSide = 0;\n // The amount of open active ranges at the start of the iterator.\n // Not including points.\n this.openStart = -1;\n this.cursor = HeapCursor.from(sets, skip, minPoint);\n }\n goto(pos, side = -1000000000 /* C.Far */) {\n this.cursor.goto(pos, side);\n this.active.length = this.activeTo.length = this.activeRank.length = 0;\n this.minActive = -1;\n this.to = pos;\n this.endSide = side;\n this.openStart = -1;\n this.next();\n return this;\n }\n forward(pos, side) {\n while (this.minActive > -1 && (this.activeTo[this.minActive] - pos || this.active[this.minActive].endSide - side) < 0)\n this.removeActive(this.minActive);\n this.cursor.forward(pos, side);\n }\n removeActive(index) {\n remove(this.active, index);\n remove(this.activeTo, index);\n remove(this.activeRank, index);\n this.minActive = findMinIndex(this.active, this.activeTo);\n }\n addActive(trackOpen) {\n let i = 0, { value, to, rank } = this.cursor;\n // Organize active marks by rank first, then by size\n while (i < this.activeRank.length && (rank - this.activeRank[i] || to - this.activeTo[i]) > 0)\n i++;\n insert(this.active, i, value);\n insert(this.activeTo, i, to);\n insert(this.activeRank, i, rank);\n if (trackOpen)\n insert(trackOpen, i, this.cursor.from);\n this.minActive = findMinIndex(this.active, this.activeTo);\n }\n // After calling this, if `this.point` != null, the next range is a\n // point. Otherwise, it\'s a regular range, covered by `this.active`.\n next() {\n let from = this.to, wasPoint = this.point;\n this.point = null;\n let trackOpen = this.openStart < 0 ? [] : null;\n for (;;) {\n let a = this.minActive;\n if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0) {\n if (this.activeTo[a] > from) {\n this.to = this.activeTo[a];\n this.endSide = this.active[a].endSide;\n break;\n }\n this.removeActive(a);\n if (trackOpen)\n remove(trackOpen, a);\n }\n else if (!this.cursor.value) {\n this.to = this.endSide = 1000000000 /* C.Far */;\n break;\n }\n else if (this.cursor.from > from) {\n this.to = this.cursor.from;\n this.endSide = this.cursor.startSide;\n break;\n }\n else {\n let nextVal = this.cursor.value;\n if (!nextVal.point) { // Opening a range\n this.addActive(trackOpen);\n this.cursor.next();\n }\n else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) {\n // Ignore any non-empty points that end precisely at the end of the prev point\n this.cursor.next();\n }\n else { // New point\n this.point = nextVal;\n this.pointFrom = this.cursor.from;\n this.pointRank = this.cursor.rank;\n this.to = this.cursor.to;\n this.endSide = nextVal.endSide;\n this.cursor.next();\n this.forward(this.to, this.endSide);\n break;\n }\n }\n }\n if (trackOpen) {\n this.openStart = 0;\n for (let i = trackOpen.length - 1; i >= 0 && trackOpen[i] < from; i--)\n this.openStart++;\n }\n }\n activeForPoint(to) {\n if (!this.active.length)\n return this.active;\n let active = [];\n for (let i = this.active.length - 1; i >= 0; i--) {\n if (this.activeRank[i] < this.pointRank)\n break;\n if (this.activeTo[i] > to || this.activeTo[i] == to && this.active[i].endSide >= this.point.endSide)\n active.push(this.active[i]);\n }\n return active.reverse();\n }\n openEnd(to) {\n let open = 0;\n for (let i = this.activeTo.length - 1; i >= 0 && this.activeTo[i] > to; i--)\n open++;\n return open;\n }\n}\nfunction compare(a, startA, b, startB, length, comparator) {\n a.goto(startA);\n b.goto(startB);\n let endB = startB + length;\n let pos = startB, dPos = startB - startA;\n for (;;) {\n let diff = (a.to + dPos) - b.to || a.endSide - b.endSide;\n let end = diff < 0 ? a.to + dPos : b.to, clipEnd = Math.min(end, endB);\n if (a.point || b.point) {\n if (!(a.point && b.point && (a.point == b.point || a.point.eq(b.point)) &&\n sameValues(a.activeForPoint(a.to), b.activeForPoint(b.to))))\n comparator.comparePoint(pos, clipEnd, a.point, b.point);\n }\n else {\n if (clipEnd > pos && !sameValues(a.active, b.active))\n comparator.compareRange(pos, clipEnd, a.active, b.active);\n }\n if (end > endB)\n break;\n pos = end;\n if (diff <= 0)\n a.next();\n if (diff >= 0)\n b.next();\n }\n}\nfunction sameValues(a, b) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (a[i] != b[i] && !a[i].eq(b[i]))\n return false;\n return true;\n}\nfunction remove(array, index) {\n for (let i = index, e = array.length - 1; i < e; i++)\n array[i] = array[i + 1];\n array.pop();\n}\nfunction insert(array, index, value) {\n for (let i = array.length - 1; i >= index; i--)\n array[i + 1] = array[i];\n array[index] = value;\n}\nfunction findMinIndex(value, array) {\n let found = -1, foundPos = 1000000000 /* C.Far */;\n for (let i = 0; i < array.length; i++)\n if ((array[i] - foundPos || value[i].endSide - value[found].endSide) < 0) {\n found = i;\n foundPos = array[i];\n }\n return found;\n}\n\n/**\nCount the column position at the given offset into the string,\ntaking extending characters and tab size into account.\n*/\nfunction countColumn(string, tabSize, to = string.length) {\n let n = 0;\n for (let i = 0; i < to;) {\n if (string.charCodeAt(i) == 9) {\n n += tabSize - (n % tabSize);\n i++;\n }\n else {\n n++;\n i = findClusterBreak(string, i);\n }\n }\n return n;\n}\n/**\nFind the offset that corresponds to the given column position in a\nstring, taking extending characters and tab size into account. By\ndefault, the string length is returned when it is too short to\nreach the column. Pass `strict` true to make it return -1 in that\nsituation.\n*/\nfunction findColumn(string, col, tabSize, strict) {\n for (let i = 0, n = 0;;) {\n if (n >= col)\n return i;\n if (i == string.length)\n break;\n n += string.charCodeAt(i) == 9 ? tabSize - (n % tabSize) : 1;\n i = findClusterBreak(string, i);\n }\n return strict === true ? -1 : string.length;\n}\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/state/dist/index.js?')},"./node_modules/@codemirror/theme-one-dark/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ color: () => (/* binding */ color),\n/* harmony export */ oneDark: () => (/* binding */ oneDark),\n/* harmony export */ oneDarkHighlightStyle: () => (/* binding */ oneDarkHighlightStyle),\n/* harmony export */ oneDarkTheme: () => (/* binding */ oneDarkTheme)\n/* harmony export */ });\n/* harmony import */ var _codemirror_view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @codemirror/view */ "./node_modules/@codemirror/view/dist/index.js");\n/* harmony import */ var _codemirror_language__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/language */ "./node_modules/@codemirror/language/dist/index.js");\n/* harmony import */ var _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/highlight */ "./node_modules/@lezer/highlight/dist/index.js");\n\n\n\n\n// Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors\nconst chalky = "#e5c07b", coral = "#e06c75", cyan = "#56b6c2", invalid = "#ffffff", ivory = "#abb2bf", stone = "#7d8799", // Brightened compared to original to increase contrast\nmalibu = "#61afef", sage = "#98c379", whiskey = "#d19a66", violet = "#c678dd", darkBackground = "#21252b", highlightBackground = "#2c313a", background = "#282c34", tooltipBackground = "#353a42", selection = "#3E4451", cursor = "#528bff";\n/**\nThe colors used in the theme, as CSS color strings.\n*/\nconst color = {\n chalky,\n coral,\n cyan,\n invalid,\n ivory,\n stone,\n malibu,\n sage,\n whiskey,\n violet,\n darkBackground,\n highlightBackground,\n background,\n tooltipBackground,\n selection,\n cursor\n};\n/**\nThe editor theme styles for One Dark.\n*/\nconst oneDarkTheme = /*@__PURE__*/_codemirror_view__WEBPACK_IMPORTED_MODULE_1__.EditorView.theme({\n "&": {\n color: ivory,\n backgroundColor: background\n },\n ".cm-content": {\n caretColor: cursor\n },\n ".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor },\n "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection },\n ".cm-panels": { backgroundColor: darkBackground, color: ivory },\n ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },\n ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },\n ".cm-searchMatch": {\n backgroundColor: "#72a1ff59",\n outline: "1px solid #457dff"\n },\n ".cm-searchMatch.cm-searchMatch-selected": {\n backgroundColor: "#6199ff2f"\n },\n ".cm-activeLine": { backgroundColor: "#6699ff0b" },\n ".cm-selectionMatch": { backgroundColor: "#aafe661a" },\n "&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": {\n backgroundColor: "#bad0f847"\n },\n ".cm-gutters": {\n backgroundColor: background,\n color: stone,\n border: "none"\n },\n ".cm-activeLineGutter": {\n backgroundColor: highlightBackground\n },\n ".cm-foldPlaceholder": {\n backgroundColor: "transparent",\n border: "none",\n color: "#ddd"\n },\n ".cm-tooltip": {\n border: "none",\n backgroundColor: tooltipBackground\n },\n ".cm-tooltip .cm-tooltip-arrow:before": {\n borderTopColor: "transparent",\n borderBottomColor: "transparent"\n },\n ".cm-tooltip .cm-tooltip-arrow:after": {\n borderTopColor: tooltipBackground,\n borderBottomColor: tooltipBackground\n },\n ".cm-tooltip-autocomplete": {\n "& > ul > li[aria-selected]": {\n backgroundColor: highlightBackground,\n color: ivory\n }\n }\n}, { dark: true });\n/**\nThe highlighting style for code in the One Dark theme.\n*/\nconst oneDarkHighlightStyle = /*@__PURE__*/_codemirror_language__WEBPACK_IMPORTED_MODULE_2__.HighlightStyle.define([\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.keyword,\n color: violet },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.name, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.deleted, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.character, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.propertyName, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.macroName],\n color: coral },\n { tag: [/*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.variableName), _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.labelName],\n color: malibu },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.color, /*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.constant(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.name), /*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.standard(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.name)],\n color: whiskey },\n { tag: [/*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.name), _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.separator],\n color: ivory },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.typeName, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.className, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.number, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.changed, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.annotation, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.modifier, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.self, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.namespace],\n color: chalky },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.operator, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.operatorKeyword, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.url, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.escape, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.regexp, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.link, /*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.string)],\n color: cyan },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.meta, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.comment],\n color: stone },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.strong,\n fontWeight: "bold" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.emphasis,\n fontStyle: "italic" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.strikethrough,\n textDecoration: "line-through" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.link,\n color: stone,\n textDecoration: "underline" },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.heading,\n fontWeight: "bold",\n color: coral },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.atom, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.bool, /*@__PURE__*/_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.variableName)],\n color: whiskey },\n { tag: [_lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.processingInstruction, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.string, _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.inserted],\n color: sage },\n { tag: _lezer_highlight__WEBPACK_IMPORTED_MODULE_0__.tags.invalid,\n color: invalid },\n]);\n/**\nExtension to enable the One Dark theme (both the editor theme and\nthe highlight style).\n*/\nconst oneDark = [oneDarkTheme, /*@__PURE__*/(0,_codemirror_language__WEBPACK_IMPORTED_MODULE_2__.syntaxHighlighting)(oneDarkHighlightStyle)];\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/theme-one-dark/dist/index.js?')},"./node_modules/@codemirror/view/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BidiSpan: () => (/* binding */ BidiSpan),\n/* harmony export */ BlockInfo: () => (/* binding */ BlockInfo),\n/* harmony export */ BlockType: () => (/* binding */ BlockType),\n/* harmony export */ Decoration: () => (/* binding */ Decoration),\n/* harmony export */ Direction: () => (/* binding */ Direction),\n/* harmony export */ EditorView: () => (/* binding */ EditorView),\n/* harmony export */ GutterMarker: () => (/* binding */ GutterMarker),\n/* harmony export */ MatchDecorator: () => (/* binding */ MatchDecorator),\n/* harmony export */ RectangleMarker: () => (/* binding */ RectangleMarker),\n/* harmony export */ ViewPlugin: () => (/* binding */ ViewPlugin),\n/* harmony export */ ViewUpdate: () => (/* binding */ ViewUpdate),\n/* harmony export */ WidgetType: () => (/* binding */ WidgetType),\n/* harmony export */ __test: () => (/* binding */ __test),\n/* harmony export */ closeHoverTooltips: () => (/* binding */ closeHoverTooltips),\n/* harmony export */ crosshairCursor: () => (/* binding */ crosshairCursor),\n/* harmony export */ drawSelection: () => (/* binding */ drawSelection),\n/* harmony export */ dropCursor: () => (/* binding */ dropCursor),\n/* harmony export */ getDrawSelectionConfig: () => (/* binding */ getDrawSelectionConfig),\n/* harmony export */ getPanel: () => (/* binding */ getPanel),\n/* harmony export */ getTooltip: () => (/* binding */ getTooltip),\n/* harmony export */ gutter: () => (/* binding */ gutter),\n/* harmony export */ gutterLineClass: () => (/* binding */ gutterLineClass),\n/* harmony export */ gutters: () => (/* binding */ gutters),\n/* harmony export */ hasHoverTooltips: () => (/* binding */ hasHoverTooltips),\n/* harmony export */ highlightActiveLine: () => (/* binding */ highlightActiveLine),\n/* harmony export */ highlightActiveLineGutter: () => (/* binding */ highlightActiveLineGutter),\n/* harmony export */ highlightSpecialChars: () => (/* binding */ highlightSpecialChars),\n/* harmony export */ highlightTrailingWhitespace: () => (/* binding */ highlightTrailingWhitespace),\n/* harmony export */ highlightWhitespace: () => (/* binding */ highlightWhitespace),\n/* harmony export */ hoverTooltip: () => (/* binding */ hoverTooltip),\n/* harmony export */ keymap: () => (/* binding */ keymap),\n/* harmony export */ layer: () => (/* binding */ layer),\n/* harmony export */ lineNumberMarkers: () => (/* binding */ lineNumberMarkers),\n/* harmony export */ lineNumbers: () => (/* binding */ lineNumbers),\n/* harmony export */ logException: () => (/* binding */ logException),\n/* harmony export */ panels: () => (/* binding */ panels),\n/* harmony export */ placeholder: () => (/* binding */ placeholder),\n/* harmony export */ rectangularSelection: () => (/* binding */ rectangularSelection),\n/* harmony export */ repositionTooltips: () => (/* binding */ repositionTooltips),\n/* harmony export */ runScopeHandlers: () => (/* binding */ runScopeHandlers),\n/* harmony export */ scrollPastEnd: () => (/* binding */ scrollPastEnd),\n/* harmony export */ showPanel: () => (/* binding */ showPanel),\n/* harmony export */ showTooltip: () => (/* binding */ showTooltip),\n/* harmony export */ tooltips: () => (/* binding */ tooltips)\n/* harmony export */ });\n/* harmony import */ var _codemirror_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @codemirror/state */ "./node_modules/@codemirror/state/dist/index.js");\n/* harmony import */ var style_mod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! style-mod */ "./node_modules/style-mod/src/style-mod.js");\n/* harmony import */ var w3c_keyname__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! w3c-keyname */ "./node_modules/w3c-keyname/index.js");\n\n\n\n\nfunction getSelection(root) {\n let target;\n // Browsers differ on whether shadow roots have a getSelection\n // method. If it exists, use that, otherwise, call it on the\n // document.\n if (root.nodeType == 11) { // Shadow root\n target = root.getSelection ? root : root.ownerDocument;\n }\n else {\n target = root;\n }\n return target.getSelection();\n}\nfunction contains(dom, node) {\n return node ? dom == node || dom.contains(node.nodeType != 1 ? node.parentNode : node) : false;\n}\nfunction deepActiveElement(doc) {\n let elt = doc.activeElement;\n while (elt && elt.shadowRoot)\n elt = elt.shadowRoot.activeElement;\n return elt;\n}\nfunction hasSelection(dom, selection) {\n if (!selection.anchorNode)\n return false;\n try {\n // Firefox will raise \'permission denied\' errors when accessing\n // properties of `sel.anchorNode` when it\'s in a generated CSS\n // element.\n return contains(dom, selection.anchorNode);\n }\n catch (_) {\n return false;\n }\n}\nfunction clientRectsFor(dom) {\n if (dom.nodeType == 3)\n return textRange(dom, 0, dom.nodeValue.length).getClientRects();\n else if (dom.nodeType == 1)\n return dom.getClientRects();\n else\n return [];\n}\n// Scans forward and backward through DOM positions equivalent to the\n// given one to see if the two are in the same place (i.e. after a\n// text node vs at the end of that text node)\nfunction isEquivalentPosition(node, off, targetNode, targetOff) {\n return targetNode ? (scanFor(node, off, targetNode, targetOff, -1) ||\n scanFor(node, off, targetNode, targetOff, 1)) : false;\n}\nfunction domIndex(node) {\n for (var index = 0;; index++) {\n node = node.previousSibling;\n if (!node)\n return index;\n }\n}\nfunction isBlockElement(node) {\n return node.nodeType == 1 && /^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\\d|SECTION|PRE)$/.test(node.nodeName);\n}\nfunction scanFor(node, off, targetNode, targetOff, dir) {\n for (;;) {\n if (node == targetNode && off == targetOff)\n return true;\n if (off == (dir < 0 ? 0 : maxOffset(node))) {\n if (node.nodeName == "DIV")\n return false;\n let parent = node.parentNode;\n if (!parent || parent.nodeType != 1)\n return false;\n off = domIndex(node) + (dir < 0 ? 0 : 1);\n node = parent;\n }\n else if (node.nodeType == 1) {\n node = node.childNodes[off + (dir < 0 ? -1 : 0)];\n if (node.nodeType == 1 && node.contentEditable == "false")\n return false;\n off = dir < 0 ? maxOffset(node) : 0;\n }\n else {\n return false;\n }\n }\n}\nfunction maxOffset(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;\n}\nfunction flattenRect(rect, left) {\n let x = left ? rect.left : rect.right;\n return { left: x, right: x, top: rect.top, bottom: rect.bottom };\n}\nfunction windowRect(win) {\n let vp = win.visualViewport;\n if (vp)\n return {\n left: 0, right: vp.width,\n top: 0, bottom: vp.height\n };\n return { left: 0, right: win.innerWidth,\n top: 0, bottom: win.innerHeight };\n}\nfunction getScale(elt, rect) {\n let scaleX = rect.width / elt.offsetWidth;\n let scaleY = rect.height / elt.offsetHeight;\n if (scaleX > 0.995 && scaleX < 1.005 || !isFinite(scaleX) || Math.abs(rect.width - elt.offsetWidth) < 1)\n scaleX = 1;\n if (scaleY > 0.995 && scaleY < 1.005 || !isFinite(scaleY) || Math.abs(rect.height - elt.offsetHeight) < 1)\n scaleY = 1;\n return { scaleX, scaleY };\n}\nfunction scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {\n let doc = dom.ownerDocument, win = doc.defaultView || window;\n for (let cur = dom, stop = false; cur && !stop;) {\n if (cur.nodeType == 1) { // Element\n let bounding, top = cur == doc.body;\n let scaleX = 1, scaleY = 1;\n if (top) {\n bounding = windowRect(win);\n }\n else {\n if (/^(fixed|sticky)$/.test(getComputedStyle(cur).position))\n stop = true;\n if (cur.scrollHeight <= cur.clientHeight && cur.scrollWidth <= cur.clientWidth) {\n cur = cur.assignedSlot || cur.parentNode;\n continue;\n }\n let rect = cur.getBoundingClientRect();\n ({ scaleX, scaleY } = getScale(cur, rect));\n // Make sure scrollbar width isn\'t included in the rectangle\n bounding = { left: rect.left, right: rect.left + cur.clientWidth * scaleX,\n top: rect.top, bottom: rect.top + cur.clientHeight * scaleY };\n }\n let moveX = 0, moveY = 0;\n if (y == "nearest") {\n if (rect.top < bounding.top) {\n moveY = -(bounding.top - rect.top + yMargin);\n if (side > 0 && rect.bottom > bounding.bottom + moveY)\n moveY = rect.bottom - bounding.bottom + moveY + yMargin;\n }\n else if (rect.bottom > bounding.bottom) {\n moveY = rect.bottom - bounding.bottom + yMargin;\n if (side < 0 && (rect.top - moveY) < bounding.top)\n moveY = -(bounding.top + moveY - rect.top + yMargin);\n }\n }\n else {\n let rectHeight = rect.bottom - rect.top, boundingHeight = bounding.bottom - bounding.top;\n let targetTop = y == "center" && rectHeight <= boundingHeight ? rect.top + rectHeight / 2 - boundingHeight / 2 :\n y == "start" || y == "center" && side < 0 ? rect.top - yMargin :\n rect.bottom - boundingHeight + yMargin;\n moveY = targetTop - bounding.top;\n }\n if (x == "nearest") {\n if (rect.left < bounding.left) {\n moveX = -(bounding.left - rect.left + xMargin);\n if (side > 0 && rect.right > bounding.right + moveX)\n moveX = rect.right - bounding.right + moveX + xMargin;\n }\n else if (rect.right > bounding.right) {\n moveX = rect.right - bounding.right + xMargin;\n if (side < 0 && rect.left < bounding.left + moveX)\n moveX = -(bounding.left + moveX - rect.left + xMargin);\n }\n }\n else {\n let targetLeft = x == "center" ? rect.left + (rect.right - rect.left) / 2 - (bounding.right - bounding.left) / 2 :\n (x == "start") == ltr ? rect.left - xMargin :\n rect.right - (bounding.right - bounding.left) + xMargin;\n moveX = targetLeft - bounding.left;\n }\n if (moveX || moveY) {\n if (top) {\n win.scrollBy(moveX, moveY);\n }\n else {\n let movedX = 0, movedY = 0;\n if (moveY) {\n let start = cur.scrollTop;\n cur.scrollTop += moveY / scaleY;\n movedY = (cur.scrollTop - start) * scaleY;\n }\n if (moveX) {\n let start = cur.scrollLeft;\n cur.scrollLeft += moveX / scaleX;\n movedX = (cur.scrollLeft - start) * scaleX;\n }\n rect = { left: rect.left - movedX, top: rect.top - movedY,\n right: rect.right - movedX, bottom: rect.bottom - movedY };\n if (movedX && Math.abs(movedX - moveX) < 1)\n x = "nearest";\n if (movedY && Math.abs(movedY - moveY) < 1)\n y = "nearest";\n }\n }\n if (top)\n break;\n cur = cur.assignedSlot || cur.parentNode;\n }\n else if (cur.nodeType == 11) { // A shadow root\n cur = cur.host;\n }\n else {\n break;\n }\n }\n}\nfunction scrollableParents(dom) {\n let doc = dom.ownerDocument, x, y;\n for (let cur = dom.parentNode; cur;) {\n if (cur == doc.body || (x && y)) {\n break;\n }\n else if (cur.nodeType == 1) {\n if (!y && cur.scrollHeight > cur.clientHeight)\n y = cur;\n if (!x && cur.scrollWidth > cur.clientWidth)\n x = cur;\n cur = cur.assignedSlot || cur.parentNode;\n }\n else if (cur.nodeType == 11) {\n cur = cur.host;\n }\n else {\n break;\n }\n }\n return { x, y };\n}\nclass DOMSelectionState {\n constructor() {\n this.anchorNode = null;\n this.anchorOffset = 0;\n this.focusNode = null;\n this.focusOffset = 0;\n }\n eq(domSel) {\n return this.anchorNode == domSel.anchorNode && this.anchorOffset == domSel.anchorOffset &&\n this.focusNode == domSel.focusNode && this.focusOffset == domSel.focusOffset;\n }\n setRange(range) {\n let { anchorNode, focusNode } = range;\n // Clip offsets to node size to avoid crashes when Safari reports bogus offsets (#1152)\n this.set(anchorNode, Math.min(range.anchorOffset, anchorNode ? maxOffset(anchorNode) : 0), focusNode, Math.min(range.focusOffset, focusNode ? maxOffset(focusNode) : 0));\n }\n set(anchorNode, anchorOffset, focusNode, focusOffset) {\n this.anchorNode = anchorNode;\n this.anchorOffset = anchorOffset;\n this.focusNode = focusNode;\n this.focusOffset = focusOffset;\n }\n}\nlet preventScrollSupported = null;\n// Feature-detects support for .focus({preventScroll: true}), and uses\n// a fallback kludge when not supported.\nfunction focusPreventScroll(dom) {\n if (dom.setActive)\n return dom.setActive(); // in IE\n if (preventScrollSupported)\n return dom.focus(preventScrollSupported);\n let stack = [];\n for (let cur = dom; cur; cur = cur.parentNode) {\n stack.push(cur, cur.scrollTop, cur.scrollLeft);\n if (cur == cur.ownerDocument)\n break;\n }\n dom.focus(preventScrollSupported == null ? {\n get preventScroll() {\n preventScrollSupported = { preventScroll: true };\n return true;\n }\n } : undefined);\n if (!preventScrollSupported) {\n preventScrollSupported = false;\n for (let i = 0; i < stack.length;) {\n let elt = stack[i++], top = stack[i++], left = stack[i++];\n if (elt.scrollTop != top)\n elt.scrollTop = top;\n if (elt.scrollLeft != left)\n elt.scrollLeft = left;\n }\n }\n}\nlet scratchRange;\nfunction textRange(node, from, to = from) {\n let range = scratchRange || (scratchRange = document.createRange());\n range.setEnd(node, to);\n range.setStart(node, from);\n return range;\n}\nfunction dispatchKey(elt, name, code, mods) {\n let options = { key: name, code: name, keyCode: code, which: code, cancelable: true };\n if (mods)\n ({ altKey: options.altKey, ctrlKey: options.ctrlKey, shiftKey: options.shiftKey, metaKey: options.metaKey } = mods);\n let down = new KeyboardEvent("keydown", options);\n down.synthetic = true;\n elt.dispatchEvent(down);\n let up = new KeyboardEvent("keyup", options);\n up.synthetic = true;\n elt.dispatchEvent(up);\n return down.defaultPrevented || up.defaultPrevented;\n}\nfunction getRoot(node) {\n while (node) {\n if (node && (node.nodeType == 9 || node.nodeType == 11 && node.host))\n return node;\n node = node.assignedSlot || node.parentNode;\n }\n return null;\n}\nfunction clearAttributes(node) {\n while (node.attributes.length)\n node.removeAttributeNode(node.attributes[0]);\n}\nfunction atElementStart(doc, selection) {\n let node = selection.focusNode, offset = selection.focusOffset;\n if (!node || selection.anchorNode != node || selection.anchorOffset != offset)\n return false;\n // Safari can report bogus offsets (#1152)\n offset = Math.min(offset, maxOffset(node));\n for (;;) {\n if (offset) {\n if (node.nodeType != 1)\n return false;\n let prev = node.childNodes[offset - 1];\n if (prev.contentEditable == "false")\n offset--;\n else {\n node = prev;\n offset = maxOffset(node);\n }\n }\n else if (node == doc) {\n return true;\n }\n else {\n offset = domIndex(node);\n node = node.parentNode;\n }\n }\n}\nfunction isScrolledToBottom(elt) {\n return elt.scrollTop > Math.max(1, elt.scrollHeight - elt.clientHeight - 4);\n}\nfunction textNodeBefore(startNode, startOffset) {\n for (let node = startNode, offset = startOffset;;) {\n if (node.nodeType == 3 && offset > 0) {\n return { node: node, offset: offset };\n }\n else if (node.nodeType == 1 && offset > 0) {\n if (node.contentEditable == "false")\n return null;\n node = node.childNodes[offset - 1];\n offset = maxOffset(node);\n }\n else if (node.parentNode && !isBlockElement(node)) {\n offset = domIndex(node);\n node = node.parentNode;\n }\n else {\n return null;\n }\n }\n}\nfunction textNodeAfter(startNode, startOffset) {\n for (let node = startNode, offset = startOffset;;) {\n if (node.nodeType == 3 && offset < node.nodeValue.length) {\n return { node: node, offset: offset };\n }\n else if (node.nodeType == 1 && offset < node.childNodes.length) {\n if (node.contentEditable == "false")\n return null;\n node = node.childNodes[offset];\n offset = 0;\n }\n else if (node.parentNode && !isBlockElement(node)) {\n offset = domIndex(node) + 1;\n node = node.parentNode;\n }\n else {\n return null;\n }\n }\n}\n\nclass DOMPos {\n constructor(node, offset, precise = true) {\n this.node = node;\n this.offset = offset;\n this.precise = precise;\n }\n static before(dom, precise) { return new DOMPos(dom.parentNode, domIndex(dom), precise); }\n static after(dom, precise) { return new DOMPos(dom.parentNode, domIndex(dom) + 1, precise); }\n}\nconst noChildren = [];\nclass ContentView {\n constructor() {\n this.parent = null;\n this.dom = null;\n this.flags = 2 /* ViewFlag.NodeDirty */;\n }\n get overrideDOMText() { return null; }\n get posAtStart() {\n return this.parent ? this.parent.posBefore(this) : 0;\n }\n get posAtEnd() {\n return this.posAtStart + this.length;\n }\n posBefore(view) {\n let pos = this.posAtStart;\n for (let child of this.children) {\n if (child == view)\n return pos;\n pos += child.length + child.breakAfter;\n }\n throw new RangeError("Invalid child in posBefore");\n }\n posAfter(view) {\n return this.posBefore(view) + view.length;\n }\n sync(view, track) {\n if (this.flags & 2 /* ViewFlag.NodeDirty */) {\n let parent = this.dom;\n let prev = null, next;\n for (let child of this.children) {\n if (child.flags & 7 /* ViewFlag.Dirty */) {\n if (!child.dom && (next = prev ? prev.nextSibling : parent.firstChild)) {\n let contentView = ContentView.get(next);\n if (!contentView || !contentView.parent && contentView.canReuseDOM(child))\n child.reuseDOM(next);\n }\n child.sync(view, track);\n child.flags &= ~7 /* ViewFlag.Dirty */;\n }\n next = prev ? prev.nextSibling : parent.firstChild;\n if (track && !track.written && track.node == parent && next != child.dom)\n track.written = true;\n if (child.dom.parentNode == parent) {\n while (next && next != child.dom)\n next = rm$1(next);\n }\n else {\n parent.insertBefore(child.dom, next);\n }\n prev = child.dom;\n }\n next = prev ? prev.nextSibling : parent.firstChild;\n if (next && track && track.node == parent)\n track.written = true;\n while (next)\n next = rm$1(next);\n }\n else if (this.flags & 1 /* ViewFlag.ChildDirty */) {\n for (let child of this.children)\n if (child.flags & 7 /* ViewFlag.Dirty */) {\n child.sync(view, track);\n child.flags &= ~7 /* ViewFlag.Dirty */;\n }\n }\n }\n reuseDOM(_dom) { }\n localPosFromDOM(node, offset) {\n let after;\n if (node == this.dom) {\n after = this.dom.childNodes[offset];\n }\n else {\n let bias = maxOffset(node) == 0 ? 0 : offset == 0 ? -1 : 1;\n for (;;) {\n let parent = node.parentNode;\n if (parent == this.dom)\n break;\n if (bias == 0 && parent.firstChild != parent.lastChild) {\n if (node == parent.firstChild)\n bias = -1;\n else\n bias = 1;\n }\n node = parent;\n }\n if (bias < 0)\n after = node;\n else\n after = node.nextSibling;\n }\n if (after == this.dom.firstChild)\n return 0;\n while (after && !ContentView.get(after))\n after = after.nextSibling;\n if (!after)\n return this.length;\n for (let i = 0, pos = 0;; i++) {\n let child = this.children[i];\n if (child.dom == after)\n return pos;\n pos += child.length + child.breakAfter;\n }\n }\n domBoundsAround(from, to, offset = 0) {\n let fromI = -1, fromStart = -1, toI = -1, toEnd = -1;\n for (let i = 0, pos = offset, prevEnd = offset; i < this.children.length; i++) {\n let child = this.children[i], end = pos + child.length;\n if (pos < from && end > to)\n return child.domBoundsAround(from, to, pos);\n if (end >= from && fromI == -1) {\n fromI = i;\n fromStart = pos;\n }\n if (pos > to && child.dom.parentNode == this.dom) {\n toI = i;\n toEnd = prevEnd;\n break;\n }\n prevEnd = end;\n pos = end + child.breakAfter;\n }\n return { from: fromStart, to: toEnd < 0 ? offset + this.length : toEnd,\n startDOM: (fromI ? this.children[fromI - 1].dom.nextSibling : null) || this.dom.firstChild,\n endDOM: toI < this.children.length && toI >= 0 ? this.children[toI].dom : null };\n }\n markDirty(andParent = false) {\n this.flags |= 2 /* ViewFlag.NodeDirty */;\n this.markParentsDirty(andParent);\n }\n markParentsDirty(childList) {\n for (let parent = this.parent; parent; parent = parent.parent) {\n if (childList)\n parent.flags |= 2 /* ViewFlag.NodeDirty */;\n if (parent.flags & 1 /* ViewFlag.ChildDirty */)\n return;\n parent.flags |= 1 /* ViewFlag.ChildDirty */;\n childList = false;\n }\n }\n setParent(parent) {\n if (this.parent != parent) {\n this.parent = parent;\n if (this.flags & 7 /* ViewFlag.Dirty */)\n this.markParentsDirty(true);\n }\n }\n setDOM(dom) {\n if (this.dom == dom)\n return;\n if (this.dom)\n this.dom.cmView = null;\n this.dom = dom;\n dom.cmView = this;\n }\n get rootView() {\n for (let v = this;;) {\n let parent = v.parent;\n if (!parent)\n return v;\n v = parent;\n }\n }\n replaceChildren(from, to, children = noChildren) {\n this.markDirty();\n for (let i = from; i < to; i++) {\n let child = this.children[i];\n if (child.parent == this && children.indexOf(child) < 0)\n child.destroy();\n }\n this.children.splice(from, to - from, ...children);\n for (let i = 0; i < children.length; i++)\n children[i].setParent(this);\n }\n ignoreMutation(_rec) { return false; }\n ignoreEvent(_event) { return false; }\n childCursor(pos = this.length) {\n return new ChildCursor(this.children, pos, this.children.length);\n }\n childPos(pos, bias = 1) {\n return this.childCursor().findPos(pos, bias);\n }\n toString() {\n let name = this.constructor.name.replace("View", "");\n return name + (this.children.length ? "(" + this.children.join() + ")" :\n this.length ? "[" + (name == "Text" ? this.text : this.length) + "]" : "") +\n (this.breakAfter ? "#" : "");\n }\n static get(node) { return node.cmView; }\n get isEditable() { return true; }\n get isWidget() { return false; }\n get isHidden() { return false; }\n merge(from, to, source, hasStart, openStart, openEnd) {\n return false;\n }\n become(other) { return false; }\n canReuseDOM(other) {\n return other.constructor == this.constructor && !((this.flags | other.flags) & 8 /* ViewFlag.Composition */);\n }\n // When this is a zero-length view with a side, this should return a\n // number <= 0 to indicate it is before its position, or a\n // number > 0 when after its position.\n getSide() { return 0; }\n destroy() {\n for (let child of this.children)\n if (child.parent == this)\n child.destroy();\n this.parent = null;\n }\n}\nContentView.prototype.breakAfter = 0;\n// Remove a DOM node and return its next sibling.\nfunction rm$1(dom) {\n let next = dom.nextSibling;\n dom.parentNode.removeChild(dom);\n return next;\n}\nclass ChildCursor {\n constructor(children, pos, i) {\n this.children = children;\n this.pos = pos;\n this.i = i;\n this.off = 0;\n }\n findPos(pos, bias = 1) {\n for (;;) {\n if (pos > this.pos || pos == this.pos &&\n (bias > 0 || this.i == 0 || this.children[this.i - 1].breakAfter)) {\n this.off = pos - this.pos;\n return this;\n }\n let next = this.children[--this.i];\n this.pos -= next.length + next.breakAfter;\n }\n }\n}\nfunction replaceRange(parent, fromI, fromOff, toI, toOff, insert, breakAtStart, openStart, openEnd) {\n let { children } = parent;\n let before = children.length ? children[fromI] : null;\n let last = insert.length ? insert[insert.length - 1] : null;\n let breakAtEnd = last ? last.breakAfter : breakAtStart;\n // Change within a single child\n if (fromI == toI && before && !breakAtStart && !breakAtEnd && insert.length < 2 &&\n before.merge(fromOff, toOff, insert.length ? last : null, fromOff == 0, openStart, openEnd))\n return;\n if (toI < children.length) {\n let after = children[toI];\n // Make sure the end of the child after the update is preserved in `after`\n if (after && (toOff < after.length || after.breakAfter && (last === null || last === void 0 ? void 0 : last.breakAfter))) {\n // If we\'re splitting a child, separate part of it to avoid that\n // being mangled when updating the child before the update.\n if (fromI == toI) {\n after = after.split(toOff);\n toOff = 0;\n }\n // If the element after the replacement should be merged with\n // the last replacing element, update `content`\n if (!breakAtEnd && last && after.merge(0, toOff, last, true, 0, openEnd)) {\n insert[insert.length - 1] = after;\n }\n else {\n // Remove the start of the after element, if necessary, and\n // add it to `content`.\n if (toOff || after.children.length && !after.children[0].length)\n after.merge(0, toOff, null, false, 0, openEnd);\n insert.push(after);\n }\n }\n else if (after === null || after === void 0 ? void 0 : after.breakAfter) {\n // The element at `toI` is entirely covered by this range.\n // Preserve its line break, if any.\n if (last)\n last.breakAfter = 1;\n else\n breakAtStart = 1;\n }\n // Since we\'ve handled the next element from the current elements\n // now, make sure `toI` points after that.\n toI++;\n }\n if (before) {\n before.breakAfter = breakAtStart;\n if (fromOff > 0) {\n if (!breakAtStart && insert.length && before.merge(fromOff, before.length, insert[0], false, openStart, 0)) {\n before.breakAfter = insert.shift().breakAfter;\n }\n else if (fromOff < before.length || before.children.length && before.children[before.children.length - 1].length == 0) {\n before.merge(fromOff, before.length, null, false, openStart, 0);\n }\n fromI++;\n }\n }\n // Try to merge widgets on the boundaries of the replacement\n while (fromI < toI && insert.length) {\n if (children[toI - 1].become(insert[insert.length - 1])) {\n toI--;\n insert.pop();\n openEnd = insert.length ? 0 : openStart;\n }\n else if (children[fromI].become(insert[0])) {\n fromI++;\n insert.shift();\n openStart = insert.length ? 0 : openEnd;\n }\n else {\n break;\n }\n }\n if (!insert.length && fromI && toI < children.length && !children[fromI - 1].breakAfter &&\n children[toI].merge(0, 0, children[fromI - 1], false, openStart, openEnd))\n fromI--;\n if (fromI < toI || insert.length)\n parent.replaceChildren(fromI, toI, insert);\n}\nfunction mergeChildrenInto(parent, from, to, insert, openStart, openEnd) {\n let cur = parent.childCursor();\n let { i: toI, off: toOff } = cur.findPos(to, 1);\n let { i: fromI, off: fromOff } = cur.findPos(from, -1);\n let dLen = from - to;\n for (let view of insert)\n dLen += view.length;\n parent.length += dLen;\n replaceRange(parent, fromI, fromOff, toI, toOff, insert, 0, openStart, openEnd);\n}\n\nlet nav = typeof navigator != "undefined" ? navigator : { userAgent: "", vendor: "", platform: "" };\nlet doc = typeof document != "undefined" ? document : { documentElement: { style: {} } };\nconst ie_edge = /*@__PURE__*//Edge\\/(\\d+)/.exec(nav.userAgent);\nconst ie_upto10 = /*@__PURE__*//MSIE \\d/.test(nav.userAgent);\nconst ie_11up = /*@__PURE__*//Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(nav.userAgent);\nconst ie = !!(ie_upto10 || ie_11up || ie_edge);\nconst gecko = !ie && /*@__PURE__*//gecko\\/(\\d+)/i.test(nav.userAgent);\nconst chrome = !ie && /*@__PURE__*//Chrome\\/(\\d+)/.exec(nav.userAgent);\nconst webkit = "webkitFontSmoothing" in doc.documentElement.style;\nconst safari = !ie && /*@__PURE__*//Apple Computer/.test(nav.vendor);\nconst ios = safari && (/*@__PURE__*//Mobile\\/\\w+/.test(nav.userAgent) || nav.maxTouchPoints > 2);\nvar browser = {\n mac: ios || /*@__PURE__*//Mac/.test(nav.platform),\n windows: /*@__PURE__*//Win/.test(nav.platform),\n linux: /*@__PURE__*//Linux|X11/.test(nav.platform),\n ie,\n ie_version: ie_upto10 ? doc.documentMode || 6 : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0,\n gecko,\n gecko_version: gecko ? +(/*@__PURE__*//Firefox\\/(\\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0,\n chrome: !!chrome,\n chrome_version: chrome ? +chrome[1] : 0,\n ios,\n android: /*@__PURE__*//Android\\b/.test(nav.userAgent),\n webkit,\n safari,\n webkit_version: webkit ? +(/*@__PURE__*//\\bAppleWebKit\\/(\\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0,\n tabSize: doc.documentElement.style.tabSize != null ? "tab-size" : "-moz-tab-size"\n};\n\nconst MaxJoinLen = 256;\nclass TextView extends ContentView {\n constructor(text) {\n super();\n this.text = text;\n }\n get length() { return this.text.length; }\n createDOM(textDOM) {\n this.setDOM(textDOM || document.createTextNode(this.text));\n }\n sync(view, track) {\n if (!this.dom)\n this.createDOM();\n if (this.dom.nodeValue != this.text) {\n if (track && track.node == this.dom)\n track.written = true;\n this.dom.nodeValue = this.text;\n }\n }\n reuseDOM(dom) {\n if (dom.nodeType == 3)\n this.createDOM(dom);\n }\n merge(from, to, source) {\n if ((this.flags & 8 /* ViewFlag.Composition */) ||\n source && (!(source instanceof TextView) ||\n this.length - (to - from) + source.length > MaxJoinLen ||\n (source.flags & 8 /* ViewFlag.Composition */)))\n return false;\n this.text = this.text.slice(0, from) + (source ? source.text : "") + this.text.slice(to);\n this.markDirty();\n return true;\n }\n split(from) {\n let result = new TextView(this.text.slice(from));\n this.text = this.text.slice(0, from);\n this.markDirty();\n result.flags |= this.flags & 8 /* ViewFlag.Composition */;\n return result;\n }\n localPosFromDOM(node, offset) {\n return node == this.dom ? offset : offset ? this.text.length : 0;\n }\n domAtPos(pos) { return new DOMPos(this.dom, pos); }\n domBoundsAround(_from, _to, offset) {\n return { from: offset, to: offset + this.length, startDOM: this.dom, endDOM: this.dom.nextSibling };\n }\n coordsAt(pos, side) {\n return textCoords(this.dom, pos, side);\n }\n}\nclass MarkView extends ContentView {\n constructor(mark, children = [], length = 0) {\n super();\n this.mark = mark;\n this.children = children;\n this.length = length;\n for (let ch of children)\n ch.setParent(this);\n }\n setAttrs(dom) {\n clearAttributes(dom);\n if (this.mark.class)\n dom.className = this.mark.class;\n if (this.mark.attrs)\n for (let name in this.mark.attrs)\n dom.setAttribute(name, this.mark.attrs[name]);\n return dom;\n }\n canReuseDOM(other) {\n return super.canReuseDOM(other) && !((this.flags | other.flags) & 8 /* ViewFlag.Composition */);\n }\n reuseDOM(node) {\n if (node.nodeName == this.mark.tagName.toUpperCase()) {\n this.setDOM(node);\n this.flags |= 4 /* ViewFlag.AttrsDirty */ | 2 /* ViewFlag.NodeDirty */;\n }\n }\n sync(view, track) {\n if (!this.dom)\n this.setDOM(this.setAttrs(document.createElement(this.mark.tagName)));\n else if (this.flags & 4 /* ViewFlag.AttrsDirty */)\n this.setAttrs(this.dom);\n super.sync(view, track);\n }\n merge(from, to, source, _hasStart, openStart, openEnd) {\n if (source && (!(source instanceof MarkView && source.mark.eq(this.mark)) ||\n (from && openStart <= 0) || (to < this.length && openEnd <= 0)))\n return false;\n mergeChildrenInto(this, from, to, source ? source.children.slice() : [], openStart - 1, openEnd - 1);\n this.markDirty();\n return true;\n }\n split(from) {\n let result = [], off = 0, detachFrom = -1, i = 0;\n for (let elt of this.children) {\n let end = off + elt.length;\n if (end > from)\n result.push(off < from ? elt.split(from - off) : elt);\n if (detachFrom < 0 && off >= from)\n detachFrom = i;\n off = end;\n i++;\n }\n let length = this.length - from;\n this.length = from;\n if (detachFrom > -1) {\n this.children.length = detachFrom;\n this.markDirty();\n }\n return new MarkView(this.mark, result, length);\n }\n domAtPos(pos) {\n return inlineDOMAtPos(this, pos);\n }\n coordsAt(pos, side) {\n return coordsInChildren(this, pos, side);\n }\n}\nfunction textCoords(text, pos, side) {\n let length = text.nodeValue.length;\n if (pos > length)\n pos = length;\n let from = pos, to = pos, flatten = 0;\n if (pos == 0 && side < 0 || pos == length && side >= 0) {\n if (!(browser.chrome || browser.gecko)) { // These browsers reliably return valid rectangles for empty ranges\n if (pos) {\n from--;\n flatten = 1;\n } // FIXME this is wrong in RTL text\n else if (to < length) {\n to++;\n flatten = -1;\n }\n }\n }\n else {\n if (side < 0)\n from--;\n else if (to < length)\n to++;\n }\n let rects = textRange(text, from, to).getClientRects();\n if (!rects.length)\n return null;\n let rect = rects[(flatten ? flatten < 0 : side >= 0) ? 0 : rects.length - 1];\n if (browser.safari && !flatten && rect.width == 0)\n rect = Array.prototype.find.call(rects, r => r.width) || rect;\n return flatten ? flattenRect(rect, flatten < 0) : rect || null;\n}\n// Also used for collapsed ranges that don\'t have a placeholder widget!\nclass WidgetView extends ContentView {\n static create(widget, length, side) {\n return new WidgetView(widget, length, side);\n }\n constructor(widget, length, side) {\n super();\n this.widget = widget;\n this.length = length;\n this.side = side;\n this.prevWidget = null;\n }\n split(from) {\n let result = WidgetView.create(this.widget, this.length - from, this.side);\n this.length -= from;\n return result;\n }\n sync(view) {\n if (!this.dom || !this.widget.updateDOM(this.dom, view)) {\n if (this.dom && this.prevWidget)\n this.prevWidget.destroy(this.dom);\n this.prevWidget = null;\n this.setDOM(this.widget.toDOM(view));\n if (!this.widget.editable)\n this.dom.contentEditable = "false";\n }\n }\n getSide() { return this.side; }\n merge(from, to, source, hasStart, openStart, openEnd) {\n if (source && (!(source instanceof WidgetView) || !this.widget.compare(source.widget) ||\n from > 0 && openStart <= 0 || to < this.length && openEnd <= 0))\n return false;\n this.length = from + (source ? source.length : 0) + (this.length - to);\n return true;\n }\n become(other) {\n if (other instanceof WidgetView && other.side == this.side &&\n this.widget.constructor == other.widget.constructor) {\n if (!this.widget.compare(other.widget))\n this.markDirty(true);\n if (this.dom && !this.prevWidget)\n this.prevWidget = this.widget;\n this.widget = other.widget;\n this.length = other.length;\n return true;\n }\n return false;\n }\n ignoreMutation() { return true; }\n ignoreEvent(event) { return this.widget.ignoreEvent(event); }\n get overrideDOMText() {\n if (this.length == 0)\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.empty;\n let top = this;\n while (top.parent)\n top = top.parent;\n let { view } = top, text = view && view.state.doc, start = this.posAtStart;\n return text ? text.slice(start, start + this.length) : _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.empty;\n }\n domAtPos(pos) {\n return (this.length ? pos == 0 : this.side > 0)\n ? DOMPos.before(this.dom)\n : DOMPos.after(this.dom, pos == this.length);\n }\n domBoundsAround() { return null; }\n coordsAt(pos, side) {\n let custom = this.widget.coordsAt(this.dom, pos, side);\n if (custom)\n return custom;\n let rects = this.dom.getClientRects(), rect = null;\n if (!rects.length)\n return null;\n let fromBack = this.side ? this.side < 0 : pos > 0;\n for (let i = fromBack ? rects.length - 1 : 0;; i += (fromBack ? -1 : 1)) {\n rect = rects[i];\n if (pos > 0 ? i == 0 : i == rects.length - 1 || rect.top < rect.bottom)\n break;\n }\n return flattenRect(rect, !fromBack);\n }\n get isEditable() { return false; }\n get isWidget() { return true; }\n get isHidden() { return this.widget.isHidden; }\n destroy() {\n super.destroy();\n if (this.dom)\n this.widget.destroy(this.dom);\n }\n}\n// These are drawn around uneditable widgets to avoid a number of\n// browser bugs that show up when the cursor is directly next to\n// uneditable inline content.\nclass WidgetBufferView extends ContentView {\n constructor(side) {\n super();\n this.side = side;\n }\n get length() { return 0; }\n merge() { return false; }\n become(other) {\n return other instanceof WidgetBufferView && other.side == this.side;\n }\n split() { return new WidgetBufferView(this.side); }\n sync() {\n if (!this.dom) {\n let dom = document.createElement("img");\n dom.className = "cm-widgetBuffer";\n dom.setAttribute("aria-hidden", "true");\n this.setDOM(dom);\n }\n }\n getSide() { return this.side; }\n domAtPos(pos) { return this.side > 0 ? DOMPos.before(this.dom) : DOMPos.after(this.dom); }\n localPosFromDOM() { return 0; }\n domBoundsAround() { return null; }\n coordsAt(pos) {\n return this.dom.getBoundingClientRect();\n }\n get overrideDOMText() {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.empty;\n }\n get isHidden() { return true; }\n}\nTextView.prototype.children = WidgetView.prototype.children = WidgetBufferView.prototype.children = noChildren;\nfunction inlineDOMAtPos(parent, pos) {\n let dom = parent.dom, { children } = parent, i = 0;\n for (let off = 0; i < children.length; i++) {\n let child = children[i], end = off + child.length;\n if (end == off && child.getSide() <= 0)\n continue;\n if (pos > off && pos < end && child.dom.parentNode == dom)\n return child.domAtPos(pos - off);\n if (pos <= off)\n break;\n off = end;\n }\n for (let j = i; j > 0; j--) {\n let prev = children[j - 1];\n if (prev.dom.parentNode == dom)\n return prev.domAtPos(prev.length);\n }\n for (let j = i; j < children.length; j++) {\n let next = children[j];\n if (next.dom.parentNode == dom)\n return next.domAtPos(0);\n }\n return new DOMPos(dom, 0);\n}\n// Assumes `view`, if a mark view, has precisely 1 child.\nfunction joinInlineInto(parent, view, open) {\n let last, { children } = parent;\n if (open > 0 && view instanceof MarkView && children.length &&\n (last = children[children.length - 1]) instanceof MarkView && last.mark.eq(view.mark)) {\n joinInlineInto(last, view.children[0], open - 1);\n }\n else {\n children.push(view);\n view.setParent(parent);\n }\n parent.length += view.length;\n}\nfunction coordsInChildren(view, pos, side) {\n let before = null, beforePos = -1, after = null, afterPos = -1;\n function scan(view, pos) {\n for (let i = 0, off = 0; i < view.children.length && off <= pos; i++) {\n let child = view.children[i], end = off + child.length;\n if (end >= pos) {\n if (child.children.length) {\n scan(child, pos - off);\n }\n else if ((!after || after.isHidden && side > 0) &&\n (end > pos || off == end && child.getSide() > 0)) {\n after = child;\n afterPos = pos - off;\n }\n else if (off < pos || (off == end && child.getSide() < 0) && !child.isHidden) {\n before = child;\n beforePos = pos - off;\n }\n }\n off = end;\n }\n }\n scan(view, pos);\n let target = (side < 0 ? before : after) || before || after;\n if (target)\n return target.coordsAt(Math.max(0, target == before ? beforePos : afterPos), side);\n return fallbackRect(view);\n}\nfunction fallbackRect(view) {\n let last = view.dom.lastChild;\n if (!last)\n return view.dom.getBoundingClientRect();\n let rects = clientRectsFor(last);\n return rects[rects.length - 1] || null;\n}\n\nfunction combineAttrs(source, target) {\n for (let name in source) {\n if (name == "class" && target.class)\n target.class += " " + source.class;\n else if (name == "style" && target.style)\n target.style += ";" + source.style;\n else\n target[name] = source[name];\n }\n return target;\n}\nconst noAttrs = /*@__PURE__*/Object.create(null);\nfunction attrsEq(a, b, ignore) {\n if (a == b)\n return true;\n if (!a)\n a = noAttrs;\n if (!b)\n b = noAttrs;\n let keysA = Object.keys(a), keysB = Object.keys(b);\n if (keysA.length - (ignore && keysA.indexOf(ignore) > -1 ? 1 : 0) !=\n keysB.length - (ignore && keysB.indexOf(ignore) > -1 ? 1 : 0))\n return false;\n for (let key of keysA) {\n if (key != ignore && (keysB.indexOf(key) == -1 || a[key] !== b[key]))\n return false;\n }\n return true;\n}\nfunction updateAttrs(dom, prev, attrs) {\n let changed = false;\n if (prev)\n for (let name in prev)\n if (!(attrs && name in attrs)) {\n changed = true;\n if (name == "style")\n dom.style.cssText = "";\n else\n dom.removeAttribute(name);\n }\n if (attrs)\n for (let name in attrs)\n if (!(prev && prev[name] == attrs[name])) {\n changed = true;\n if (name == "style")\n dom.style.cssText = attrs[name];\n else\n dom.setAttribute(name, attrs[name]);\n }\n return changed;\n}\nfunction getAttrs(dom) {\n let attrs = Object.create(null);\n for (let i = 0; i < dom.attributes.length; i++) {\n let attr = dom.attributes[i];\n attrs[attr.name] = attr.value;\n }\n return attrs;\n}\n\nclass LineView extends ContentView {\n constructor() {\n super(...arguments);\n this.children = [];\n this.length = 0;\n this.prevAttrs = undefined;\n this.attrs = null;\n this.breakAfter = 0;\n }\n // Consumes source\n merge(from, to, source, hasStart, openStart, openEnd) {\n if (source) {\n if (!(source instanceof LineView))\n return false;\n if (!this.dom)\n source.transferDOM(this); // Reuse source.dom when appropriate\n }\n if (hasStart)\n this.setDeco(source ? source.attrs : null);\n mergeChildrenInto(this, from, to, source ? source.children.slice() : [], openStart, openEnd);\n return true;\n }\n split(at) {\n let end = new LineView;\n end.breakAfter = this.breakAfter;\n if (this.length == 0)\n return end;\n let { i, off } = this.childPos(at);\n if (off) {\n end.append(this.children[i].split(off), 0);\n this.children[i].merge(off, this.children[i].length, null, false, 0, 0);\n i++;\n }\n for (let j = i; j < this.children.length; j++)\n end.append(this.children[j], 0);\n while (i > 0 && this.children[i - 1].length == 0)\n this.children[--i].destroy();\n this.children.length = i;\n this.markDirty();\n this.length = at;\n return end;\n }\n transferDOM(other) {\n if (!this.dom)\n return;\n this.markDirty();\n other.setDOM(this.dom);\n other.prevAttrs = this.prevAttrs === undefined ? this.attrs : this.prevAttrs;\n this.prevAttrs = undefined;\n this.dom = null;\n }\n setDeco(attrs) {\n if (!attrsEq(this.attrs, attrs)) {\n if (this.dom) {\n this.prevAttrs = this.attrs;\n this.markDirty();\n }\n this.attrs = attrs;\n }\n }\n append(child, openStart) {\n joinInlineInto(this, child, openStart);\n }\n // Only called when building a line view in ContentBuilder\n addLineDeco(deco) {\n let attrs = deco.spec.attributes, cls = deco.spec.class;\n if (attrs)\n this.attrs = combineAttrs(attrs, this.attrs || {});\n if (cls)\n this.attrs = combineAttrs({ class: cls }, this.attrs || {});\n }\n domAtPos(pos) {\n return inlineDOMAtPos(this, pos);\n }\n reuseDOM(node) {\n if (node.nodeName == "DIV") {\n this.setDOM(node);\n this.flags |= 4 /* ViewFlag.AttrsDirty */ | 2 /* ViewFlag.NodeDirty */;\n }\n }\n sync(view, track) {\n var _a;\n if (!this.dom) {\n this.setDOM(document.createElement("div"));\n this.dom.className = "cm-line";\n this.prevAttrs = this.attrs ? null : undefined;\n }\n else if (this.flags & 4 /* ViewFlag.AttrsDirty */) {\n clearAttributes(this.dom);\n this.dom.className = "cm-line";\n this.prevAttrs = this.attrs ? null : undefined;\n }\n if (this.prevAttrs !== undefined) {\n updateAttrs(this.dom, this.prevAttrs, this.attrs);\n this.dom.classList.add("cm-line");\n this.prevAttrs = undefined;\n }\n super.sync(view, track);\n let last = this.dom.lastChild;\n while (last && ContentView.get(last) instanceof MarkView)\n last = last.lastChild;\n if (!last || !this.length ||\n last.nodeName != "BR" && ((_a = ContentView.get(last)) === null || _a === void 0 ? void 0 : _a.isEditable) == false &&\n (!browser.ios || !this.children.some(ch => ch instanceof TextView))) {\n let hack = document.createElement("BR");\n hack.cmIgnore = true;\n this.dom.appendChild(hack);\n }\n }\n measureTextSize() {\n if (this.children.length == 0 || this.length > 20)\n return null;\n let totalWidth = 0, textHeight;\n for (let child of this.children) {\n if (!(child instanceof TextView) || /[^ -~]/.test(child.text))\n return null;\n let rects = clientRectsFor(child.dom);\n if (rects.length != 1)\n return null;\n totalWidth += rects[0].width;\n textHeight = rects[0].height;\n }\n return !totalWidth ? null : {\n lineHeight: this.dom.getBoundingClientRect().height,\n charWidth: totalWidth / this.length,\n textHeight\n };\n }\n coordsAt(pos, side) {\n let rect = coordsInChildren(this, pos, side);\n // Correct rectangle height for empty lines when the returned\n // height is larger than the text height.\n if (!this.children.length && rect && this.parent) {\n let { heightOracle } = this.parent.view.viewState, height = rect.bottom - rect.top;\n if (Math.abs(height - heightOracle.lineHeight) < 2 && heightOracle.textHeight < height) {\n let dist = (height - heightOracle.textHeight) / 2;\n return { top: rect.top + dist, bottom: rect.bottom - dist, left: rect.left, right: rect.left };\n }\n }\n return rect;\n }\n become(other) {\n return other instanceof LineView && this.children.length == 0 && other.children.length == 0 &&\n attrsEq(this.attrs, other.attrs) && this.breakAfter == other.breakAfter;\n }\n covers() { return true; }\n static find(docView, pos) {\n for (let i = 0, off = 0; i < docView.children.length; i++) {\n let block = docView.children[i], end = off + block.length;\n if (end >= pos) {\n if (block instanceof LineView)\n return block;\n if (end > pos)\n break;\n }\n off = end + block.breakAfter;\n }\n return null;\n }\n}\nclass BlockWidgetView extends ContentView {\n constructor(widget, length, deco) {\n super();\n this.widget = widget;\n this.length = length;\n this.deco = deco;\n this.breakAfter = 0;\n this.prevWidget = null;\n }\n merge(from, to, source, _takeDeco, openStart, openEnd) {\n if (source && (!(source instanceof BlockWidgetView) || !this.widget.compare(source.widget) ||\n from > 0 && openStart <= 0 || to < this.length && openEnd <= 0))\n return false;\n this.length = from + (source ? source.length : 0) + (this.length - to);\n return true;\n }\n domAtPos(pos) {\n return pos == 0 ? DOMPos.before(this.dom) : DOMPos.after(this.dom, pos == this.length);\n }\n split(at) {\n let len = this.length - at;\n this.length = at;\n let end = new BlockWidgetView(this.widget, len, this.deco);\n end.breakAfter = this.breakAfter;\n return end;\n }\n get children() { return noChildren; }\n sync(view) {\n if (!this.dom || !this.widget.updateDOM(this.dom, view)) {\n if (this.dom && this.prevWidget)\n this.prevWidget.destroy(this.dom);\n this.prevWidget = null;\n this.setDOM(this.widget.toDOM(view));\n if (!this.widget.editable)\n this.dom.contentEditable = "false";\n }\n }\n get overrideDOMText() {\n return this.parent ? this.parent.view.state.doc.slice(this.posAtStart, this.posAtEnd) : _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.empty;\n }\n domBoundsAround() { return null; }\n become(other) {\n if (other instanceof BlockWidgetView &&\n other.widget.constructor == this.widget.constructor) {\n if (!other.widget.compare(this.widget))\n this.markDirty(true);\n if (this.dom && !this.prevWidget)\n this.prevWidget = this.widget;\n this.widget = other.widget;\n this.length = other.length;\n this.deco = other.deco;\n this.breakAfter = other.breakAfter;\n return true;\n }\n return false;\n }\n ignoreMutation() { return true; }\n ignoreEvent(event) { return this.widget.ignoreEvent(event); }\n get isEditable() { return false; }\n get isWidget() { return true; }\n coordsAt(pos, side) {\n return this.widget.coordsAt(this.dom, pos, side);\n }\n destroy() {\n super.destroy();\n if (this.dom)\n this.widget.destroy(this.dom);\n }\n covers(side) {\n let { startSide, endSide } = this.deco;\n return startSide == endSide ? false : side < 0 ? startSide < 0 : endSide > 0;\n }\n}\n\n/**\nWidgets added to the content are described by subclasses of this\nclass. Using a description object like that makes it possible to\ndelay creating of the DOM structure for a widget until it is\nneeded, and to avoid redrawing widgets even if the decorations\nthat define them are recreated.\n*/\nclass WidgetType {\n /**\n Compare this instance to another instance of the same type.\n (TypeScript can\'t express this, but only instances of the same\n specific class will be passed to this method.) This is used to\n avoid redrawing widgets when they are replaced by a new\n decoration of the same type. The default implementation just\n returns `false`, which will cause new instances of the widget to\n always be redrawn.\n */\n eq(widget) { return false; }\n /**\n Update a DOM element created by a widget of the same type (but\n different, non-`eq` content) to reflect this widget. May return\n true to indicate that it could update, false to indicate it\n couldn\'t (in which case the widget will be redrawn). The default\n implementation just returns false.\n */\n updateDOM(dom, view) { return false; }\n /**\n @internal\n */\n compare(other) {\n return this == other || this.constructor == other.constructor && this.eq(other);\n }\n /**\n The estimated height this widget will have, to be used when\n estimating the height of content that hasn\'t been drawn. May\n return -1 to indicate you don\'t know. The default implementation\n returns -1.\n */\n get estimatedHeight() { return -1; }\n /**\n For inline widgets that are displayed inline (as opposed to\n `inline-block`) and introduce line breaks (through `
` tags\n or textual newlines), this must indicate the amount of line\n breaks they introduce. Defaults to 0.\n */\n get lineBreaks() { return 0; }\n /**\n Can be used to configure which kinds of events inside the widget\n should be ignored by the editor. The default is to ignore all\n events.\n */\n ignoreEvent(event) { return true; }\n /**\n Override the way screen coordinates for positions at/in the\n widget are found. `pos` will be the offset into the widget, and\n `side` the side of the position that is being queried—less than\n zero for before, greater than zero for after, and zero for\n directly at that position.\n */\n coordsAt(dom, pos, side) { return null; }\n /**\n @internal\n */\n get isHidden() { return false; }\n /**\n @internal\n */\n get editable() { return false; }\n /**\n This is called when the an instance of the widget is removed\n from the editor view.\n */\n destroy(dom) { }\n}\n/**\nThe different types of blocks that can occur in an editor view.\n*/\nvar BlockType = /*@__PURE__*/(function (BlockType) {\n /**\n A line of text.\n */\n BlockType[BlockType["Text"] = 0] = "Text";\n /**\n A block widget associated with the position after it.\n */\n BlockType[BlockType["WidgetBefore"] = 1] = "WidgetBefore";\n /**\n A block widget associated with the position before it.\n */\n BlockType[BlockType["WidgetAfter"] = 2] = "WidgetAfter";\n /**\n A block widget [replacing](https://codemirror.net/6/docs/ref/#view.Decoration^replace) a range of content.\n */\n BlockType[BlockType["WidgetRange"] = 3] = "WidgetRange";\nreturn BlockType})(BlockType || (BlockType = {}));\n/**\nA decoration provides information on how to draw or style a piece\nof content. You\'ll usually use it wrapped in a\n[`Range`](https://codemirror.net/6/docs/ref/#state.Range), which adds a start and end position.\n@nonabstract\n*/\nclass Decoration extends _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeValue {\n constructor(\n /**\n @internal\n */\n startSide, \n /**\n @internal\n */\n endSide, \n /**\n @internal\n */\n widget, \n /**\n The config object used to create this decoration. You can\n include additional properties in there to store metadata about\n your decoration.\n */\n spec) {\n super();\n this.startSide = startSide;\n this.endSide = endSide;\n this.widget = widget;\n this.spec = spec;\n }\n /**\n @internal\n */\n get heightRelevant() { return false; }\n /**\n Create a mark decoration, which influences the styling of the\n content in its range. Nested mark decorations will cause nested\n DOM elements to be created. Nesting order is determined by\n precedence of the [facet](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), with\n the higher-precedence decorations creating the inner DOM nodes.\n Such elements are split on line boundaries and on the boundaries\n of lower-precedence decorations.\n */\n static mark(spec) {\n return new MarkDecoration(spec);\n }\n /**\n Create a widget decoration, which displays a DOM element at the\n given position.\n */\n static widget(spec) {\n let side = Math.max(-10000, Math.min(10000, spec.side || 0)), block = !!spec.block;\n side += (block && !spec.inlineOrder)\n ? (side > 0 ? 300000000 /* Side.BlockAfter */ : -400000000 /* Side.BlockBefore */)\n : (side > 0 ? 100000000 /* Side.InlineAfter */ : -100000000 /* Side.InlineBefore */);\n return new PointDecoration(spec, side, side, block, spec.widget || null, false);\n }\n /**\n Create a replace decoration which replaces the given range with\n a widget, or simply hides it.\n */\n static replace(spec) {\n let block = !!spec.block, startSide, endSide;\n if (spec.isBlockGap) {\n startSide = -500000000 /* Side.GapStart */;\n endSide = 400000000 /* Side.GapEnd */;\n }\n else {\n let { start, end } = getInclusive(spec, block);\n startSide = (start ? (block ? -300000000 /* Side.BlockIncStart */ : -1 /* Side.InlineIncStart */) : 500000000 /* Side.NonIncStart */) - 1;\n endSide = (end ? (block ? 200000000 /* Side.BlockIncEnd */ : 1 /* Side.InlineIncEnd */) : -600000000 /* Side.NonIncEnd */) + 1;\n }\n return new PointDecoration(spec, startSide, endSide, block, spec.widget || null, true);\n }\n /**\n Create a line decoration, which can add DOM attributes to the\n line starting at the given position.\n */\n static line(spec) {\n return new LineDecoration(spec);\n }\n /**\n Build a [`DecorationSet`](https://codemirror.net/6/docs/ref/#view.DecorationSet) from the given\n decorated range or ranges. If the ranges aren\'t already sorted,\n pass `true` for `sort` to make the library sort them for you.\n */\n static set(of, sort = false) {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.of(of, sort);\n }\n /**\n @internal\n */\n hasHeight() { return this.widget ? this.widget.estimatedHeight > -1 : false; }\n}\n/**\nThe empty set of decorations.\n*/\nDecoration.none = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.empty;\nclass MarkDecoration extends Decoration {\n constructor(spec) {\n let { start, end } = getInclusive(spec);\n super(start ? -1 /* Side.InlineIncStart */ : 500000000 /* Side.NonIncStart */, end ? 1 /* Side.InlineIncEnd */ : -600000000 /* Side.NonIncEnd */, null, spec);\n this.tagName = spec.tagName || "span";\n this.class = spec.class || "";\n this.attrs = spec.attributes || null;\n }\n eq(other) {\n var _a, _b;\n return this == other ||\n other instanceof MarkDecoration &&\n this.tagName == other.tagName &&\n (this.class || ((_a = this.attrs) === null || _a === void 0 ? void 0 : _a.class)) == (other.class || ((_b = other.attrs) === null || _b === void 0 ? void 0 : _b.class)) &&\n attrsEq(this.attrs, other.attrs, "class");\n }\n range(from, to = from) {\n if (from >= to)\n throw new RangeError("Mark decorations may not be empty");\n return super.range(from, to);\n }\n}\nMarkDecoration.prototype.point = false;\nclass LineDecoration extends Decoration {\n constructor(spec) {\n super(-200000000 /* Side.Line */, -200000000 /* Side.Line */, null, spec);\n }\n eq(other) {\n return other instanceof LineDecoration &&\n this.spec.class == other.spec.class &&\n attrsEq(this.spec.attributes, other.spec.attributes);\n }\n range(from, to = from) {\n if (to != from)\n throw new RangeError("Line decoration ranges must be zero-length");\n return super.range(from, to);\n }\n}\nLineDecoration.prototype.mapMode = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.MapMode.TrackBefore;\nLineDecoration.prototype.point = true;\nclass PointDecoration extends Decoration {\n constructor(spec, startSide, endSide, block, widget, isReplace) {\n super(startSide, endSide, widget, spec);\n this.block = block;\n this.isReplace = isReplace;\n this.mapMode = !block ? _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.MapMode.TrackDel : startSide <= 0 ? _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.MapMode.TrackBefore : _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.MapMode.TrackAfter;\n }\n // Only relevant when this.block == true\n get type() {\n return this.startSide != this.endSide ? BlockType.WidgetRange\n : this.startSide <= 0 ? BlockType.WidgetBefore : BlockType.WidgetAfter;\n }\n get heightRelevant() {\n return this.block || !!this.widget && (this.widget.estimatedHeight >= 5 || this.widget.lineBreaks > 0);\n }\n eq(other) {\n return other instanceof PointDecoration &&\n widgetsEq(this.widget, other.widget) &&\n this.block == other.block &&\n this.startSide == other.startSide && this.endSide == other.endSide;\n }\n range(from, to = from) {\n if (this.isReplace && (from > to || (from == to && this.startSide > 0 && this.endSide <= 0)))\n throw new RangeError("Invalid range for replacement decoration");\n if (!this.isReplace && to != from)\n throw new RangeError("Widget decorations can only have zero-length ranges");\n return super.range(from, to);\n }\n}\nPointDecoration.prototype.point = true;\nfunction getInclusive(spec, block = false) {\n let { inclusiveStart: start, inclusiveEnd: end } = spec;\n if (start == null)\n start = spec.inclusive;\n if (end == null)\n end = spec.inclusive;\n return { start: start !== null && start !== void 0 ? start : block, end: end !== null && end !== void 0 ? end : block };\n}\nfunction widgetsEq(a, b) {\n return a == b || !!(a && b && a.compare(b));\n}\nfunction addRange(from, to, ranges, margin = 0) {\n let last = ranges.length - 1;\n if (last >= 0 && ranges[last] + margin >= from)\n ranges[last] = Math.max(ranges[last], to);\n else\n ranges.push(from, to);\n}\n\nclass ContentBuilder {\n constructor(doc, pos, end, disallowBlockEffectsFor) {\n this.doc = doc;\n this.pos = pos;\n this.end = end;\n this.disallowBlockEffectsFor = disallowBlockEffectsFor;\n this.content = [];\n this.curLine = null;\n this.breakAtStart = 0;\n this.pendingBuffer = 0 /* Buf.No */;\n this.bufferMarks = [];\n // Set to false directly after a widget that covers the position after it\n this.atCursorPos = true;\n this.openStart = -1;\n this.openEnd = -1;\n this.text = "";\n this.textOff = 0;\n this.cursor = doc.iter();\n this.skip = pos;\n }\n posCovered() {\n if (this.content.length == 0)\n return !this.breakAtStart && this.doc.lineAt(this.pos).from != this.pos;\n let last = this.content[this.content.length - 1];\n return !(last.breakAfter || last instanceof BlockWidgetView && last.deco.endSide < 0);\n }\n getLine() {\n if (!this.curLine) {\n this.content.push(this.curLine = new LineView);\n this.atCursorPos = true;\n }\n return this.curLine;\n }\n flushBuffer(active = this.bufferMarks) {\n if (this.pendingBuffer) {\n this.curLine.append(wrapMarks(new WidgetBufferView(-1), active), active.length);\n this.pendingBuffer = 0 /* Buf.No */;\n }\n }\n addBlockWidget(view) {\n this.flushBuffer();\n this.curLine = null;\n this.content.push(view);\n }\n finish(openEnd) {\n if (this.pendingBuffer && openEnd <= this.bufferMarks.length)\n this.flushBuffer();\n else\n this.pendingBuffer = 0 /* Buf.No */;\n if (!this.posCovered() &&\n !(openEnd && this.content.length && this.content[this.content.length - 1] instanceof BlockWidgetView))\n this.getLine();\n }\n buildText(length, active, openStart) {\n while (length > 0) {\n if (this.textOff == this.text.length) {\n let { value, lineBreak, done } = this.cursor.next(this.skip);\n this.skip = 0;\n if (done)\n throw new Error("Ran out of text content when drawing inline views");\n if (lineBreak) {\n if (!this.posCovered())\n this.getLine();\n if (this.content.length)\n this.content[this.content.length - 1].breakAfter = 1;\n else\n this.breakAtStart = 1;\n this.flushBuffer();\n this.curLine = null;\n this.atCursorPos = true;\n length--;\n continue;\n }\n else {\n this.text = value;\n this.textOff = 0;\n }\n }\n let take = Math.min(this.text.length - this.textOff, length, 512 /* T.Chunk */);\n this.flushBuffer(active.slice(active.length - openStart));\n this.getLine().append(wrapMarks(new TextView(this.text.slice(this.textOff, this.textOff + take)), active), openStart);\n this.atCursorPos = true;\n this.textOff += take;\n length -= take;\n openStart = 0;\n }\n }\n span(from, to, active, openStart) {\n this.buildText(to - from, active, openStart);\n this.pos = to;\n if (this.openStart < 0)\n this.openStart = openStart;\n }\n point(from, to, deco, active, openStart, index) {\n if (this.disallowBlockEffectsFor[index] && deco instanceof PointDecoration) {\n if (deco.block)\n throw new RangeError("Block decorations may not be specified via plugins");\n if (to > this.doc.lineAt(this.pos).to)\n throw new RangeError("Decorations that replace line breaks may not be specified via plugins");\n }\n let len = to - from;\n if (deco instanceof PointDecoration) {\n if (deco.block) {\n if (deco.startSide > 0 && !this.posCovered())\n this.getLine();\n this.addBlockWidget(new BlockWidgetView(deco.widget || NullWidget.block, len, deco));\n }\n else {\n let view = WidgetView.create(deco.widget || NullWidget.inline, len, len ? 0 : deco.startSide);\n let cursorBefore = this.atCursorPos && !view.isEditable && openStart <= active.length &&\n (from < to || deco.startSide > 0);\n let cursorAfter = !view.isEditable && (from < to || openStart > active.length || deco.startSide <= 0);\n let line = this.getLine();\n if (this.pendingBuffer == 2 /* Buf.IfCursor */ && !cursorBefore && !view.isEditable)\n this.pendingBuffer = 0 /* Buf.No */;\n this.flushBuffer(active);\n if (cursorBefore) {\n line.append(wrapMarks(new WidgetBufferView(1), active), openStart);\n openStart = active.length + Math.max(0, openStart - active.length);\n }\n line.append(wrapMarks(view, active), openStart);\n this.atCursorPos = cursorAfter;\n this.pendingBuffer = !cursorAfter ? 0 /* Buf.No */ : from < to || openStart > active.length ? 1 /* Buf.Yes */ : 2 /* Buf.IfCursor */;\n if (this.pendingBuffer)\n this.bufferMarks = active.slice();\n }\n }\n else if (this.doc.lineAt(this.pos).from == this.pos) { // Line decoration\n this.getLine().addLineDeco(deco);\n }\n if (len) {\n // Advance the iterator past the replaced content\n if (this.textOff + len <= this.text.length) {\n this.textOff += len;\n }\n else {\n this.skip += len - (this.text.length - this.textOff);\n this.text = "";\n this.textOff = 0;\n }\n this.pos = to;\n }\n if (this.openStart < 0)\n this.openStart = openStart;\n }\n static build(text, from, to, decorations, dynamicDecorationMap) {\n let builder = new ContentBuilder(text, from, to, dynamicDecorationMap);\n builder.openEnd = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.spans(decorations, from, to, builder);\n if (builder.openStart < 0)\n builder.openStart = builder.openEnd;\n builder.finish(builder.openEnd);\n return builder;\n }\n}\nfunction wrapMarks(view, active) {\n for (let mark of active)\n view = new MarkView(mark, [view], view.length);\n return view;\n}\nclass NullWidget extends WidgetType {\n constructor(tag) {\n super();\n this.tag = tag;\n }\n eq(other) { return other.tag == this.tag; }\n toDOM() { return document.createElement(this.tag); }\n updateDOM(elt) { return elt.nodeName.toLowerCase() == this.tag; }\n get isHidden() { return true; }\n}\nNullWidget.inline = /*@__PURE__*/new NullWidget("span");\nNullWidget.block = /*@__PURE__*/new NullWidget("div");\n\n/**\nUsed to indicate [text direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection).\n*/\nvar Direction = /*@__PURE__*/(function (Direction) {\n // (These are chosen to match the base levels, in bidi algorithm\n // terms, of spans in that direction.)\n /**\n Left-to-right.\n */\n Direction[Direction["LTR"] = 0] = "LTR";\n /**\n Right-to-left.\n */\n Direction[Direction["RTL"] = 1] = "RTL";\nreturn Direction})(Direction || (Direction = {}));\nconst LTR = Direction.LTR, RTL = Direction.RTL;\n// Decode a string with each type encoded as log2(type)\nfunction dec(str) {\n let result = [];\n for (let i = 0; i < str.length; i++)\n result.push(1 << +str[i]);\n return result;\n}\n// Character types for codepoints 0 to 0xf8\nconst LowTypes = /*@__PURE__*/dec("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008");\n// Character types for codepoints 0x600 to 0x6f9\nconst ArabicTypes = /*@__PURE__*/dec("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333");\nconst Brackets = /*@__PURE__*/Object.create(null), BracketStack = [];\n// There\'s a lot more in\n// https://www.unicode.org/Public/UCD/latest/ucd/BidiBrackets.txt,\n// which are left out to keep code size down.\nfor (let p of ["()", "[]", "{}"]) {\n let l = /*@__PURE__*/p.charCodeAt(0), r = /*@__PURE__*/p.charCodeAt(1);\n Brackets[l] = r;\n Brackets[r] = -l;\n}\nfunction charType(ch) {\n return ch <= 0xf7 ? LowTypes[ch] :\n 0x590 <= ch && ch <= 0x5f4 ? 2 /* T.R */ :\n 0x600 <= ch && ch <= 0x6f9 ? ArabicTypes[ch - 0x600] :\n 0x6ee <= ch && ch <= 0x8ac ? 4 /* T.AL */ :\n 0x2000 <= ch && ch <= 0x200c ? 256 /* T.NI */ :\n 0xfb50 <= ch && ch <= 0xfdff ? 4 /* T.AL */ : 1 /* T.L */;\n}\nconst BidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac\\ufb50-\\ufdff]/;\n/**\nRepresents a contiguous range of text that has a single direction\n(as in left-to-right or right-to-left).\n*/\nclass BidiSpan {\n /**\n The direction of this span.\n */\n get dir() { return this.level % 2 ? RTL : LTR; }\n /**\n @internal\n */\n constructor(\n /**\n The start of the span (relative to the start of the line).\n */\n from, \n /**\n The end of the span.\n */\n to, \n /**\n The ["bidi\n level"](https://unicode.org/reports/tr9/#Basic_Display_Algorithm)\n of the span (in this context, 0 means\n left-to-right, 1 means right-to-left, 2 means left-to-right\n number inside right-to-left text).\n */\n level) {\n this.from = from;\n this.to = to;\n this.level = level;\n }\n /**\n @internal\n */\n side(end, dir) { return (this.dir == dir) == end ? this.to : this.from; }\n /**\n @internal\n */\n forward(forward, dir) { return forward == (this.dir == dir); }\n /**\n @internal\n */\n static find(order, index, level, assoc) {\n let maybe = -1;\n for (let i = 0; i < order.length; i++) {\n let span = order[i];\n if (span.from <= index && span.to >= index) {\n if (span.level == level)\n return i;\n // When multiple spans match, if assoc != 0, take the one that\n // covers that side, otherwise take the one with the minimum\n // level.\n if (maybe < 0 || (assoc != 0 ? (assoc < 0 ? span.from < index : span.to > index) : order[maybe].level > span.level))\n maybe = i;\n }\n }\n if (maybe < 0)\n throw new RangeError("Index out of range");\n return maybe;\n }\n}\nfunction isolatesEq(a, b) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++) {\n let iA = a[i], iB = b[i];\n if (iA.from != iB.from || iA.to != iB.to || iA.direction != iB.direction || !isolatesEq(iA.inner, iB.inner))\n return false;\n }\n return true;\n}\n// Reused array of character types\nconst types = [];\n// Fill in the character types (in `types`) from `from` to `to` and\n// apply W normalization rules.\nfunction computeCharTypes(line, rFrom, rTo, isolates, outerType) {\n for (let iI = 0; iI <= isolates.length; iI++) {\n let from = iI ? isolates[iI - 1].to : rFrom, to = iI < isolates.length ? isolates[iI].from : rTo;\n let prevType = iI ? 256 /* T.NI */ : outerType;\n // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n // (Left after this: L, R, EN, AN, ET, CS, NI)\n for (let i = from, prev = prevType, prevStrong = prevType; i < to; i++) {\n let type = charType(line.charCodeAt(i));\n if (type == 512 /* T.NSM */)\n type = prev;\n else if (type == 8 /* T.EN */ && prevStrong == 4 /* T.AL */)\n type = 16 /* T.AN */;\n types[i] = type == 4 /* T.AL */ ? 2 /* T.R */ : type;\n if (type & 7 /* T.Strong */)\n prevStrong = type;\n prev = type;\n }\n // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n // (Left after this: L, R, EN+AN, NI)\n for (let i = from, prev = prevType, prevStrong = prevType; i < to; i++) {\n let type = types[i];\n if (type == 128 /* T.CS */) {\n if (i < to - 1 && prev == types[i + 1] && (prev & 24 /* T.Num */))\n type = types[i] = prev;\n else\n types[i] = 256 /* T.NI */;\n }\n else if (type == 64 /* T.ET */) {\n let end = i + 1;\n while (end < to && types[end] == 64 /* T.ET */)\n end++;\n let replace = (i && prev == 8 /* T.EN */) || (end < rTo && types[end] == 8 /* T.EN */) ? (prevStrong == 1 /* T.L */ ? 1 /* T.L */ : 8 /* T.EN */) : 256 /* T.NI */;\n for (let j = i; j < end; j++)\n types[j] = replace;\n i = end - 1;\n }\n else if (type == 8 /* T.EN */ && prevStrong == 1 /* T.L */) {\n types[i] = 1 /* T.L */;\n }\n prev = type;\n if (type & 7 /* T.Strong */)\n prevStrong = type;\n }\n }\n}\n// Process brackets throughout a run sequence.\nfunction processBracketPairs(line, rFrom, rTo, isolates, outerType) {\n let oppositeType = outerType == 1 /* T.L */ ? 2 /* T.R */ : 1 /* T.L */;\n for (let iI = 0, sI = 0, context = 0; iI <= isolates.length; iI++) {\n let from = iI ? isolates[iI - 1].to : rFrom, to = iI < isolates.length ? isolates[iI].from : rTo;\n // N0. Process bracket pairs in an isolating run sequence\n // sequentially in the logical order of the text positions of the\n // opening paired brackets using the logic given below. Within this\n // scope, bidirectional types EN and AN are treated as R.\n for (let i = from, ch, br, type; i < to; i++) {\n // Keeps [startIndex, type, strongSeen] triples for each open\n // bracket on BracketStack.\n if (br = Brackets[ch = line.charCodeAt(i)]) {\n if (br < 0) { // Closing bracket\n for (let sJ = sI - 3; sJ >= 0; sJ -= 3) {\n if (BracketStack[sJ + 1] == -br) {\n let flags = BracketStack[sJ + 2];\n let type = (flags & 2 /* Bracketed.EmbedInside */) ? outerType :\n !(flags & 4 /* Bracketed.OppositeInside */) ? 0 :\n (flags & 1 /* Bracketed.OppositeBefore */) ? oppositeType : outerType;\n if (type)\n types[i] = types[BracketStack[sJ]] = type;\n sI = sJ;\n break;\n }\n }\n }\n else if (BracketStack.length == 189 /* Bracketed.MaxDepth */) {\n break;\n }\n else {\n BracketStack[sI++] = i;\n BracketStack[sI++] = ch;\n BracketStack[sI++] = context;\n }\n }\n else if ((type = types[i]) == 2 /* T.R */ || type == 1 /* T.L */) {\n let embed = type == outerType;\n context = embed ? 0 : 1 /* Bracketed.OppositeBefore */;\n for (let sJ = sI - 3; sJ >= 0; sJ -= 3) {\n let cur = BracketStack[sJ + 2];\n if (cur & 2 /* Bracketed.EmbedInside */)\n break;\n if (embed) {\n BracketStack[sJ + 2] |= 2 /* Bracketed.EmbedInside */;\n }\n else {\n if (cur & 4 /* Bracketed.OppositeInside */)\n break;\n BracketStack[sJ + 2] |= 4 /* Bracketed.OppositeInside */;\n }\n }\n }\n }\n }\n}\nfunction processNeutrals(rFrom, rTo, isolates, outerType) {\n for (let iI = 0, prev = outerType; iI <= isolates.length; iI++) {\n let from = iI ? isolates[iI - 1].to : rFrom, to = iI < isolates.length ? isolates[iI].from : rTo;\n // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n // (Left after this: L, R, EN+AN)\n for (let i = from; i < to;) {\n let type = types[i];\n if (type == 256 /* T.NI */) {\n let end = i + 1;\n for (;;) {\n if (end == to) {\n if (iI == isolates.length)\n break;\n end = isolates[iI++].to;\n to = iI < isolates.length ? isolates[iI].from : rTo;\n }\n else if (types[end] == 256 /* T.NI */) {\n end++;\n }\n else {\n break;\n }\n }\n let beforeL = prev == 1 /* T.L */;\n let afterL = (end < rTo ? types[end] : outerType) == 1 /* T.L */;\n let replace = beforeL == afterL ? (beforeL ? 1 /* T.L */ : 2 /* T.R */) : outerType;\n for (let j = end, jI = iI, fromJ = jI ? isolates[jI - 1].to : rFrom; j > i;) {\n if (j == fromJ) {\n j = isolates[--jI].from;\n fromJ = jI ? isolates[jI - 1].to : rFrom;\n }\n types[--j] = replace;\n }\n i = end;\n }\n else {\n prev = type;\n i++;\n }\n }\n }\n}\n// Find the contiguous ranges of character types in a given range, and\n// emit spans for them. Flip the order of the spans as appropriate\n// based on the level, and call through to compute the spans for\n// isolates at the proper point.\nfunction emitSpans(line, from, to, level, baseLevel, isolates, order) {\n let ourType = level % 2 ? 2 /* T.R */ : 1 /* T.L */;\n if ((level % 2) == (baseLevel % 2)) { // Same dir as base direction, don\'t flip\n for (let iCh = from, iI = 0; iCh < to;) {\n // Scan a section of characters in direction ourType, unless\n // there\'s another type of char right after iCh, in which case\n // we scan a section of other characters (which, if ourType ==\n // T.L, may contain both T.R and T.AN chars).\n let sameDir = true, isNum = false;\n if (iI == isolates.length || iCh < isolates[iI].from) {\n let next = types[iCh];\n if (next != ourType) {\n sameDir = false;\n isNum = next == 16 /* T.AN */;\n }\n }\n // Holds an array of isolates to pass to a recursive call if we\n // must recurse (to distinguish T.AN inside an RTL section in\n // LTR text), null if we can emit directly\n let recurse = !sameDir && ourType == 1 /* T.L */ ? [] : null;\n let localLevel = sameDir ? level : level + 1;\n let iScan = iCh;\n run: for (;;) {\n if (iI < isolates.length && iScan == isolates[iI].from) {\n if (isNum)\n break run;\n let iso = isolates[iI];\n // Scan ahead to verify that there is another char in this dir after the isolate(s)\n if (!sameDir)\n for (let upto = iso.to, jI = iI + 1;;) {\n if (upto == to)\n break run;\n if (jI < isolates.length && isolates[jI].from == upto)\n upto = isolates[jI++].to;\n else if (types[upto] == ourType)\n break run;\n else\n break;\n }\n iI++;\n if (recurse) {\n recurse.push(iso);\n }\n else {\n if (iso.from > iCh)\n order.push(new BidiSpan(iCh, iso.from, localLevel));\n let dirSwap = (iso.direction == LTR) != !(localLevel % 2);\n computeSectionOrder(line, dirSwap ? level + 1 : level, baseLevel, iso.inner, iso.from, iso.to, order);\n iCh = iso.to;\n }\n iScan = iso.to;\n }\n else if (iScan == to || (sameDir ? types[iScan] != ourType : types[iScan] == ourType)) {\n break;\n }\n else {\n iScan++;\n }\n }\n if (recurse)\n emitSpans(line, iCh, iScan, level + 1, baseLevel, recurse, order);\n else if (iCh < iScan)\n order.push(new BidiSpan(iCh, iScan, localLevel));\n iCh = iScan;\n }\n }\n else {\n // Iterate in reverse to flip the span order. Same code again, but\n // going from the back of the section to the front\n for (let iCh = to, iI = isolates.length; iCh > from;) {\n let sameDir = true, isNum = false;\n if (!iI || iCh > isolates[iI - 1].to) {\n let next = types[iCh - 1];\n if (next != ourType) {\n sameDir = false;\n isNum = next == 16 /* T.AN */;\n }\n }\n let recurse = !sameDir && ourType == 1 /* T.L */ ? [] : null;\n let localLevel = sameDir ? level : level + 1;\n let iScan = iCh;\n run: for (;;) {\n if (iI && iScan == isolates[iI - 1].to) {\n if (isNum)\n break run;\n let iso = isolates[--iI];\n // Scan ahead to verify that there is another char in this dir after the isolate(s)\n if (!sameDir)\n for (let upto = iso.from, jI = iI;;) {\n if (upto == from)\n break run;\n if (jI && isolates[jI - 1].to == upto)\n upto = isolates[--jI].from;\n else if (types[upto - 1] == ourType)\n break run;\n else\n break;\n }\n if (recurse) {\n recurse.push(iso);\n }\n else {\n if (iso.to < iCh)\n order.push(new BidiSpan(iso.to, iCh, localLevel));\n let dirSwap = (iso.direction == LTR) != !(localLevel % 2);\n computeSectionOrder(line, dirSwap ? level + 1 : level, baseLevel, iso.inner, iso.from, iso.to, order);\n iCh = iso.from;\n }\n iScan = iso.from;\n }\n else if (iScan == from || (sameDir ? types[iScan - 1] != ourType : types[iScan - 1] == ourType)) {\n break;\n }\n else {\n iScan--;\n }\n }\n if (recurse)\n emitSpans(line, iScan, iCh, level + 1, baseLevel, recurse, order);\n else if (iScan < iCh)\n order.push(new BidiSpan(iScan, iCh, localLevel));\n iCh = iScan;\n }\n }\n}\nfunction computeSectionOrder(line, level, baseLevel, isolates, from, to, order) {\n let outerType = (level % 2 ? 2 /* T.R */ : 1 /* T.L */);\n computeCharTypes(line, from, to, isolates, outerType);\n processBracketPairs(line, from, to, isolates, outerType);\n processNeutrals(from, to, isolates, outerType);\n emitSpans(line, from, to, level, baseLevel, isolates, order);\n}\nfunction computeOrder(line, direction, isolates) {\n if (!line)\n return [new BidiSpan(0, 0, direction == RTL ? 1 : 0)];\n if (direction == LTR && !isolates.length && !BidiRE.test(line))\n return trivialOrder(line.length);\n if (isolates.length)\n while (line.length > types.length)\n types[types.length] = 256 /* T.NI */; // Make sure types array has no gaps\n let order = [], level = direction == LTR ? 0 : 1;\n computeSectionOrder(line, level, level, isolates, 0, line.length, order);\n return order;\n}\nfunction trivialOrder(length) {\n return [new BidiSpan(0, length, 0)];\n}\nlet movedOver = "";\n// This implementation moves strictly visually, without concern for a\n// traversal visiting every logical position in the string. It will\n// still do so for simple input, but situations like multiple isolates\n// with the same level next to each other, or text going against the\n// main dir at the end of the line, will make some positions\n// unreachable with this motion. Each visible cursor position will\n// correspond to the lower-level bidi span that touches it.\n//\n// The alternative would be to solve an order globally for a given\n// line, making sure that it includes every position, but that would\n// require associating non-canonical (higher bidi span level)\n// positions with a given visual position, which is likely to confuse\n// people. (And would generally be a lot more complicated.)\nfunction moveVisually(line, order, dir, start, forward) {\n var _a;\n let startIndex = start.head - line.from;\n let spanI = BidiSpan.find(order, startIndex, (_a = start.bidiLevel) !== null && _a !== void 0 ? _a : -1, start.assoc);\n let span = order[spanI], spanEnd = span.side(forward, dir);\n // End of span\n if (startIndex == spanEnd) {\n let nextI = spanI += forward ? 1 : -1;\n if (nextI < 0 || nextI >= order.length)\n return null;\n span = order[spanI = nextI];\n startIndex = span.side(!forward, dir);\n spanEnd = span.side(forward, dir);\n }\n let nextIndex = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.findClusterBreak)(line.text, startIndex, span.forward(forward, dir));\n if (nextIndex < span.from || nextIndex > span.to)\n nextIndex = spanEnd;\n movedOver = line.text.slice(Math.min(startIndex, nextIndex), Math.max(startIndex, nextIndex));\n let nextSpan = spanI == (forward ? order.length - 1 : 0) ? null : order[spanI + (forward ? 1 : -1)];\n if (nextSpan && nextIndex == spanEnd && nextSpan.level + (forward ? 0 : 1) < span.level)\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(nextSpan.side(!forward, dir) + line.from, nextSpan.forward(forward, dir) ? 1 : -1, nextSpan.level);\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(nextIndex + line.from, span.forward(forward, dir) ? -1 : 1, span.level);\n}\nfunction autoDirection(text, from, to) {\n for (let i = from; i < to; i++) {\n let type = charType(text.charCodeAt(i));\n if (type == 1 /* T.L */)\n return LTR;\n if (type == 2 /* T.R */ || type == 4 /* T.AL */)\n return RTL;\n }\n return LTR;\n}\n\nconst clickAddsSelectionRange = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst dragMovesSelection$1 = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst mouseSelectionStyle = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst exceptionSink = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst updateListener = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst inputHandler = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst focusChangeEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst perLineTextDirection = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine: values => values.some(x => x)\n});\nconst nativeSelectionHidden = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine: values => values.some(x => x)\n});\nconst scrollHandler = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nclass ScrollTarget {\n constructor(range, y = "nearest", x = "nearest", yMargin = 5, xMargin = 5, \n // This data structure is abused to also store precise scroll\n // snapshots, instead of a `scrollIntoView` request. When this\n // flag is `true`, `range` points at a position in the reference\n // line, `yMargin` holds the difference between the top of that\n // line and the top of the editor, and `xMargin` holds the\n // editor\'s `scrollLeft`.\n isSnapshot = false) {\n this.range = range;\n this.y = y;\n this.x = x;\n this.yMargin = yMargin;\n this.xMargin = xMargin;\n this.isSnapshot = isSnapshot;\n }\n map(changes) {\n return changes.empty ? this :\n new ScrollTarget(this.range.map(changes), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot);\n }\n clip(state) {\n return this.range.to <= state.doc.length ? this :\n new ScrollTarget(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(state.doc.length), this.y, this.x, this.yMargin, this.xMargin, this.isSnapshot);\n }\n}\nconst scrollIntoView = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define({ map: (t, ch) => t.map(ch) });\nconst setEditContextFormatting = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define();\n/**\nLog or report an unhandled exception in client code. Should\nprobably only be used by extension code that allows client code to\nprovide functions, and calls those functions in a context where an\nexception can\'t be propagated to calling code in a reasonable way\n(for example when in an event handler).\n\nEither calls a handler registered with\n[`EditorView.exceptionSink`](https://codemirror.net/6/docs/ref/#view.EditorView^exceptionSink),\n`window.onerror`, if defined, or `console.error` (in which case\nit\'ll pass `context`, when given, as first argument).\n*/\nfunction logException(state, exception, context) {\n let handler = state.facet(exceptionSink);\n if (handler.length)\n handler[0](exception);\n else if (window.onerror)\n window.onerror(String(exception), context, undefined, undefined, exception);\n else if (context)\n console.error(context + ":", exception);\n else\n console.error(exception);\n}\nconst editable = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({ combine: values => values.length ? values[0] : true });\nlet nextPluginID = 0;\nconst viewPlugin = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\n/**\nView plugins associate stateful values with a view. They can\ninfluence the way the content is drawn, and are notified of things\nthat happen in the view.\n*/\nclass ViewPlugin {\n constructor(\n /**\n @internal\n */\n id, \n /**\n @internal\n */\n create, \n /**\n @internal\n */\n domEventHandlers, \n /**\n @internal\n */\n domEventObservers, buildExtensions) {\n this.id = id;\n this.create = create;\n this.domEventHandlers = domEventHandlers;\n this.domEventObservers = domEventObservers;\n this.extension = buildExtensions(this);\n }\n /**\n Define a plugin from a constructor function that creates the\n plugin\'s value, given an editor view.\n */\n static define(create, spec) {\n const { eventHandlers, eventObservers, provide, decorations: deco } = spec || {};\n return new ViewPlugin(nextPluginID++, create, eventHandlers, eventObservers, plugin => {\n let ext = [viewPlugin.of(plugin)];\n if (deco)\n ext.push(decorations.of(view => {\n let pluginInst = view.plugin(plugin);\n return pluginInst ? deco(pluginInst) : Decoration.none;\n }));\n if (provide)\n ext.push(provide(plugin));\n return ext;\n });\n }\n /**\n Create a plugin for a class whose constructor takes a single\n editor view as argument.\n */\n static fromClass(cls, spec) {\n return ViewPlugin.define(view => new cls(view), spec);\n }\n}\nclass PluginInstance {\n constructor(spec) {\n this.spec = spec;\n // When starting an update, all plugins have this field set to the\n // update object, indicating they need to be updated. When finished\n // updating, it is set to `false`. Retrieving a plugin that needs to\n // be updated with `view.plugin` forces an eager update.\n this.mustUpdate = null;\n // This is null when the plugin is initially created, but\n // initialized on the first update.\n this.value = null;\n }\n update(view) {\n if (!this.value) {\n if (this.spec) {\n try {\n this.value = this.spec.create(view);\n }\n catch (e) {\n logException(view.state, e, "CodeMirror plugin crashed");\n this.deactivate();\n }\n }\n }\n else if (this.mustUpdate) {\n let update = this.mustUpdate;\n this.mustUpdate = null;\n if (this.value.update) {\n try {\n this.value.update(update);\n }\n catch (e) {\n logException(update.state, e, "CodeMirror plugin crashed");\n if (this.value.destroy)\n try {\n this.value.destroy();\n }\n catch (_) { }\n this.deactivate();\n }\n }\n }\n return this;\n }\n destroy(view) {\n var _a;\n if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.destroy) {\n try {\n this.value.destroy();\n }\n catch (e) {\n logException(view.state, e, "CodeMirror plugin crashed");\n }\n }\n }\n deactivate() {\n this.spec = this.value = null;\n }\n}\nconst editorAttributes = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst contentAttributes = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\n// Provide decorations\nconst decorations = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst outerDecorations = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst atomicRanges = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst bidiIsolatedRanges = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nfunction getIsolatedRanges(view, line) {\n let isolates = view.state.facet(bidiIsolatedRanges);\n if (!isolates.length)\n return isolates;\n let sets = isolates.map(i => i instanceof Function ? i(view) : i);\n let result = [];\n _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.spans(sets, line.from, line.to, {\n point() { },\n span(fromDoc, toDoc, active, open) {\n let from = fromDoc - line.from, to = toDoc - line.from;\n let level = result;\n for (let i = active.length - 1; i >= 0; i--, open--) {\n let direction = active[i].spec.bidiIsolate, update;\n if (direction == null)\n direction = autoDirection(line.text, from, to);\n if (open > 0 && level.length &&\n (update = level[level.length - 1]).to == from && update.direction == direction) {\n update.to = to;\n level = update.inner;\n }\n else {\n let add = { from, to, direction, inner: [] };\n level.push(add);\n level = add.inner;\n }\n }\n }\n });\n return result;\n}\nconst scrollMargins = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nfunction getScrollMargins(view) {\n let left = 0, right = 0, top = 0, bottom = 0;\n for (let source of view.state.facet(scrollMargins)) {\n let m = source(view);\n if (m) {\n if (m.left != null)\n left = Math.max(left, m.left);\n if (m.right != null)\n right = Math.max(right, m.right);\n if (m.top != null)\n top = Math.max(top, m.top);\n if (m.bottom != null)\n bottom = Math.max(bottom, m.bottom);\n }\n }\n return { left, right, top, bottom };\n}\nconst styleModule = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nclass ChangedRange {\n constructor(fromA, toA, fromB, toB) {\n this.fromA = fromA;\n this.toA = toA;\n this.fromB = fromB;\n this.toB = toB;\n }\n join(other) {\n return new ChangedRange(Math.min(this.fromA, other.fromA), Math.max(this.toA, other.toA), Math.min(this.fromB, other.fromB), Math.max(this.toB, other.toB));\n }\n addToSet(set) {\n let i = set.length, me = this;\n for (; i > 0; i--) {\n let range = set[i - 1];\n if (range.fromA > me.toA)\n continue;\n if (range.toA < me.fromA)\n break;\n me = me.join(range);\n set.splice(i - 1, 1);\n }\n set.splice(i, 0, me);\n return set;\n }\n static extendWithRanges(diff, ranges) {\n if (ranges.length == 0)\n return diff;\n let result = [];\n for (let dI = 0, rI = 0, posA = 0, posB = 0;; dI++) {\n let next = dI == diff.length ? null : diff[dI], off = posA - posB;\n let end = next ? next.fromB : 1e9;\n while (rI < ranges.length && ranges[rI] < end) {\n let from = ranges[rI], to = ranges[rI + 1];\n let fromB = Math.max(posB, from), toB = Math.min(end, to);\n if (fromB <= toB)\n new ChangedRange(fromB + off, toB + off, fromB, toB).addToSet(result);\n if (to > end)\n break;\n else\n rI += 2;\n }\n if (!next)\n return result;\n new ChangedRange(next.fromA, next.toA, next.fromB, next.toB).addToSet(result);\n posA = next.toA;\n posB = next.toB;\n }\n }\n}\n/**\nView [plugins](https://codemirror.net/6/docs/ref/#view.ViewPlugin) are given instances of this\nclass, which describe what happened, whenever the view is updated.\n*/\nclass ViewUpdate {\n constructor(\n /**\n The editor view that the update is associated with.\n */\n view, \n /**\n The new editor state.\n */\n state, \n /**\n The transactions involved in the update. May be empty.\n */\n transactions) {\n this.view = view;\n this.state = state;\n this.transactions = transactions;\n /**\n @internal\n */\n this.flags = 0;\n this.startState = view.state;\n this.changes = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.ChangeSet.empty(this.startState.doc.length);\n for (let tr of transactions)\n this.changes = this.changes.compose(tr.changes);\n let changedRanges = [];\n this.changes.iterChangedRanges((fromA, toA, fromB, toB) => changedRanges.push(new ChangedRange(fromA, toA, fromB, toB)));\n this.changedRanges = changedRanges;\n }\n /**\n @internal\n */\n static create(view, state, transactions) {\n return new ViewUpdate(view, state, transactions);\n }\n /**\n Tells you whether the [viewport](https://codemirror.net/6/docs/ref/#view.EditorView.viewport) or\n [visible ranges](https://codemirror.net/6/docs/ref/#view.EditorView.visibleRanges) changed in this\n update.\n */\n get viewportChanged() {\n return (this.flags & 4 /* UpdateFlag.Viewport */) > 0;\n }\n /**\n Indicates whether the height of a block element in the editor\n changed in this update.\n */\n get heightChanged() {\n return (this.flags & 2 /* UpdateFlag.Height */) > 0;\n }\n /**\n Returns true when the document was modified or the size of the\n editor, or elements within the editor, changed.\n */\n get geometryChanged() {\n return this.docChanged || (this.flags & (8 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */)) > 0;\n }\n /**\n True when this update indicates a focus change.\n */\n get focusChanged() {\n return (this.flags & 1 /* UpdateFlag.Focus */) > 0;\n }\n /**\n Whether the document changed in this update.\n */\n get docChanged() {\n return !this.changes.empty;\n }\n /**\n Whether the selection was explicitly set in this update.\n */\n get selectionSet() {\n return this.transactions.some(tr => tr.selection);\n }\n /**\n @internal\n */\n get empty() { return this.flags == 0 && this.transactions.length == 0; }\n}\n\nclass DocView extends ContentView {\n get length() { return this.view.state.doc.length; }\n constructor(view) {\n super();\n this.view = view;\n this.decorations = [];\n this.dynamicDecorationMap = [false];\n this.domChanged = null;\n this.hasComposition = null;\n this.markedForComposition = new Set;\n this.editContextFormatting = Decoration.none;\n this.lastCompositionAfterCursor = false;\n // Track a minimum width for the editor. When measuring sizes in\n // measureVisibleLineHeights, this is updated to point at the width\n // of a given element and its extent in the document. When a change\n // happens in that range, these are reset. That way, once we\'ve seen\n // a line/element of a given length, we keep the editor wide enough\n // to fit at least that element, until it is changed, at which point\n // we forget it again.\n this.minWidth = 0;\n this.minWidthFrom = 0;\n this.minWidthTo = 0;\n // Track whether the DOM selection was set in a lossy way, so that\n // we don\'t mess it up when reading it back it\n this.impreciseAnchor = null;\n this.impreciseHead = null;\n this.forceSelection = false;\n // Used by the resize observer to ignore resizes that we caused\n // ourselves\n this.lastUpdate = Date.now();\n this.setDOM(view.contentDOM);\n this.children = [new LineView];\n this.children[0].setParent(this);\n this.updateDeco();\n this.updateInner([new ChangedRange(0, 0, 0, view.state.doc.length)], 0, null);\n }\n // Update the document view to a given state.\n update(update) {\n var _a;\n let changedRanges = update.changedRanges;\n if (this.minWidth > 0 && changedRanges.length) {\n if (!changedRanges.every(({ fromA, toA }) => toA < this.minWidthFrom || fromA > this.minWidthTo)) {\n this.minWidth = this.minWidthFrom = this.minWidthTo = 0;\n }\n else {\n this.minWidthFrom = update.changes.mapPos(this.minWidthFrom, 1);\n this.minWidthTo = update.changes.mapPos(this.minWidthTo, 1);\n }\n }\n this.updateEditContextFormatting(update);\n let readCompositionAt = -1;\n if (this.view.inputState.composing >= 0 && !this.view.observer.editContext) {\n if ((_a = this.domChanged) === null || _a === void 0 ? void 0 : _a.newSel)\n readCompositionAt = this.domChanged.newSel.head;\n else if (!touchesComposition(update.changes, this.hasComposition) && !update.selectionSet)\n readCompositionAt = update.state.selection.main.head;\n }\n let composition = readCompositionAt > -1 ? findCompositionRange(this.view, update.changes, readCompositionAt) : null;\n this.domChanged = null;\n if (this.hasComposition) {\n this.markedForComposition.clear();\n let { from, to } = this.hasComposition;\n changedRanges = new ChangedRange(from, to, update.changes.mapPos(from, -1), update.changes.mapPos(to, 1))\n .addToSet(changedRanges.slice());\n }\n this.hasComposition = composition ? { from: composition.range.fromB, to: composition.range.toB } : null;\n // When the DOM nodes around the selection are moved to another\n // parent, Chrome sometimes reports a different selection through\n // getSelection than the one that it actually shows to the user.\n // This forces a selection update when lines are joined to work\n // around that. Issue #54\n if ((browser.ie || browser.chrome) && !composition && update &&\n update.state.doc.lines != update.startState.doc.lines)\n this.forceSelection = true;\n let prevDeco = this.decorations, deco = this.updateDeco();\n let decoDiff = findChangedDeco(prevDeco, deco, update.changes);\n changedRanges = ChangedRange.extendWithRanges(changedRanges, decoDiff);\n if (!(this.flags & 7 /* ViewFlag.Dirty */) && changedRanges.length == 0) {\n return false;\n }\n else {\n this.updateInner(changedRanges, update.startState.doc.length, composition);\n if (update.transactions.length)\n this.lastUpdate = Date.now();\n return true;\n }\n }\n // Used by update and the constructor do perform the actual DOM\n // update\n updateInner(changes, oldLength, composition) {\n this.view.viewState.mustMeasureContent = true;\n this.updateChildren(changes, oldLength, composition);\n let { observer } = this.view;\n observer.ignore(() => {\n // Lock the height during redrawing, since Chrome sometimes\n // messes with the scroll position during DOM mutation (though\n // no relayout is triggered and I cannot imagine how it can\n // recompute the scroll position without a layout)\n this.dom.style.height = this.view.viewState.contentHeight / this.view.scaleY + "px";\n this.dom.style.flexBasis = this.minWidth ? this.minWidth + "px" : "";\n // Chrome will sometimes, when DOM mutations occur directly\n // around the selection, get confused and report a different\n // selection from the one it displays (issue #218). This tries\n // to detect that situation.\n let track = browser.chrome || browser.ios ? { node: observer.selectionRange.focusNode, written: false } : undefined;\n this.sync(this.view, track);\n this.flags &= ~7 /* ViewFlag.Dirty */;\n if (track && (track.written || observer.selectionRange.focusNode != track.node))\n this.forceSelection = true;\n this.dom.style.height = "";\n });\n this.markedForComposition.forEach(cView => cView.flags &= ~8 /* ViewFlag.Composition */);\n let gaps = [];\n if (this.view.viewport.from || this.view.viewport.to < this.view.state.doc.length)\n for (let child of this.children)\n if (child instanceof BlockWidgetView && child.widget instanceof BlockGapWidget)\n gaps.push(child.dom);\n observer.updateGaps(gaps);\n }\n updateChildren(changes, oldLength, composition) {\n let ranges = composition ? composition.range.addToSet(changes.slice()) : changes;\n let cursor = this.childCursor(oldLength);\n for (let i = ranges.length - 1;; i--) {\n let next = i >= 0 ? ranges[i] : null;\n if (!next)\n break;\n let { fromA, toA, fromB, toB } = next, content, breakAtStart, openStart, openEnd;\n if (composition && composition.range.fromB < toB && composition.range.toB > fromB) {\n let before = ContentBuilder.build(this.view.state.doc, fromB, composition.range.fromB, this.decorations, this.dynamicDecorationMap);\n let after = ContentBuilder.build(this.view.state.doc, composition.range.toB, toB, this.decorations, this.dynamicDecorationMap);\n breakAtStart = before.breakAtStart;\n openStart = before.openStart;\n openEnd = after.openEnd;\n let compLine = this.compositionView(composition);\n if (after.breakAtStart) {\n compLine.breakAfter = 1;\n }\n else if (after.content.length &&\n compLine.merge(compLine.length, compLine.length, after.content[0], false, after.openStart, 0)) {\n compLine.breakAfter = after.content[0].breakAfter;\n after.content.shift();\n }\n if (before.content.length &&\n compLine.merge(0, 0, before.content[before.content.length - 1], true, 0, before.openEnd)) {\n before.content.pop();\n }\n content = before.content.concat(compLine).concat(after.content);\n }\n else {\n ({ content, breakAtStart, openStart, openEnd } =\n ContentBuilder.build(this.view.state.doc, fromB, toB, this.decorations, this.dynamicDecorationMap));\n }\n let { i: toI, off: toOff } = cursor.findPos(toA, 1);\n let { i: fromI, off: fromOff } = cursor.findPos(fromA, -1);\n replaceRange(this, fromI, fromOff, toI, toOff, content, breakAtStart, openStart, openEnd);\n }\n if (composition)\n this.fixCompositionDOM(composition);\n }\n updateEditContextFormatting(update) {\n this.editContextFormatting = this.editContextFormatting.map(update.changes);\n for (let tr of update.transactions)\n for (let effect of tr.effects)\n if (effect.is(setEditContextFormatting)) {\n this.editContextFormatting = effect.value;\n }\n }\n compositionView(composition) {\n let cur = new TextView(composition.text.nodeValue);\n cur.flags |= 8 /* ViewFlag.Composition */;\n for (let { deco } of composition.marks)\n cur = new MarkView(deco, [cur], cur.length);\n let line = new LineView;\n line.append(cur, 0);\n return line;\n }\n fixCompositionDOM(composition) {\n let fix = (dom, cView) => {\n cView.flags |= 8 /* ViewFlag.Composition */ | (cView.children.some(c => c.flags & 7 /* ViewFlag.Dirty */) ? 1 /* ViewFlag.ChildDirty */ : 0);\n this.markedForComposition.add(cView);\n let prev = ContentView.get(dom);\n if (prev && prev != cView)\n prev.dom = null;\n cView.setDOM(dom);\n };\n let pos = this.childPos(composition.range.fromB, 1);\n let cView = this.children[pos.i];\n fix(composition.line, cView);\n for (let i = composition.marks.length - 1; i >= -1; i--) {\n pos = cView.childPos(pos.off, 1);\n cView = cView.children[pos.i];\n fix(i >= 0 ? composition.marks[i].node : composition.text, cView);\n }\n }\n // Sync the DOM selection to this.state.selection\n updateSelection(mustRead = false, fromPointer = false) {\n if (mustRead || !this.view.observer.selectionRange.focusNode)\n this.view.observer.readSelectionRange();\n let activeElt = this.view.root.activeElement, focused = activeElt == this.dom;\n let selectionNotFocus = !focused &&\n hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));\n if (!(focused || fromPointer || selectionNotFocus))\n return;\n let force = this.forceSelection;\n this.forceSelection = false;\n let main = this.view.state.selection.main;\n let anchor = this.moveToLine(this.domAtPos(main.anchor));\n let head = main.empty ? anchor : this.moveToLine(this.domAtPos(main.head));\n // Always reset on Firefox when next to an uneditable node to\n // avoid invisible cursor bugs (#111)\n if (browser.gecko && main.empty && !this.hasComposition && betweenUneditable(anchor)) {\n let dummy = document.createTextNode("");\n this.view.observer.ignore(() => anchor.node.insertBefore(dummy, anchor.node.childNodes[anchor.offset] || null));\n anchor = head = new DOMPos(dummy, 0);\n force = true;\n }\n let domSel = this.view.observer.selectionRange;\n // If the selection is already here, or in an equivalent position, don\'t touch it\n if (force || !domSel.focusNode || (!isEquivalentPosition(anchor.node, anchor.offset, domSel.anchorNode, domSel.anchorOffset) ||\n !isEquivalentPosition(head.node, head.offset, domSel.focusNode, domSel.focusOffset)) && !this.suppressWidgetCursorChange(domSel, main)) {\n this.view.observer.ignore(() => {\n // Chrome Android will hide the virtual keyboard when tapping\n // inside an uneditable node, and not bring it back when we\n // move the cursor to its proper position. This tries to\n // restore the keyboard by cycling focus.\n if (browser.android && browser.chrome && this.dom.contains(domSel.focusNode) &&\n inUneditable(domSel.focusNode, this.dom)) {\n this.dom.blur();\n this.dom.focus({ preventScroll: true });\n }\n let rawSel = getSelection(this.view.root);\n if (!rawSel) ;\n else if (main.empty) {\n // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=1612076\n if (browser.gecko) {\n let nextTo = nextToUneditable(anchor.node, anchor.offset);\n if (nextTo && nextTo != (1 /* NextTo.Before */ | 2 /* NextTo.After */)) {\n let text = (nextTo == 1 /* NextTo.Before */ ? textNodeBefore : textNodeAfter)(anchor.node, anchor.offset);\n if (text)\n anchor = new DOMPos(text.node, text.offset);\n }\n }\n rawSel.collapse(anchor.node, anchor.offset);\n if (main.bidiLevel != null && rawSel.caretBidiLevel !== undefined)\n rawSel.caretBidiLevel = main.bidiLevel;\n }\n else if (rawSel.extend) {\n // Selection.extend can be used to create an \'inverted\' selection\n // (one where the focus is before the anchor), but not all\n // browsers support it yet.\n rawSel.collapse(anchor.node, anchor.offset);\n // Safari will ignore the call above when the editor is\n // hidden, and then raise an error on the call to extend\n // (#940).\n try {\n rawSel.extend(head.node, head.offset);\n }\n catch (_) { }\n }\n else {\n // Primitive (IE) way\n let range = document.createRange();\n if (main.anchor > main.head)\n [anchor, head] = [head, anchor];\n range.setEnd(head.node, head.offset);\n range.setStart(anchor.node, anchor.offset);\n rawSel.removeAllRanges();\n rawSel.addRange(range);\n }\n if (selectionNotFocus && this.view.root.activeElement == this.dom) {\n this.dom.blur();\n if (activeElt)\n activeElt.focus();\n }\n });\n this.view.observer.setSelectionRange(anchor, head);\n }\n this.impreciseAnchor = anchor.precise ? null : new DOMPos(domSel.anchorNode, domSel.anchorOffset);\n this.impreciseHead = head.precise ? null : new DOMPos(domSel.focusNode, domSel.focusOffset);\n }\n // If a zero-length widget is inserted next to the cursor during\n // composition, avoid moving it across it and disrupting the\n // composition.\n suppressWidgetCursorChange(sel, cursor) {\n return this.hasComposition && cursor.empty &&\n isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset) &&\n this.posFromDOM(sel.focusNode, sel.focusOffset) == cursor.head;\n }\n enforceCursorAssoc() {\n if (this.hasComposition)\n return;\n let { view } = this, cursor = view.state.selection.main;\n let sel = getSelection(view.root);\n let { anchorNode, anchorOffset } = view.observer.selectionRange;\n if (!sel || !cursor.empty || !cursor.assoc || !sel.modify)\n return;\n let line = LineView.find(this, cursor.head);\n if (!line)\n return;\n let lineStart = line.posAtStart;\n if (cursor.head == lineStart || cursor.head == lineStart + line.length)\n return;\n let before = this.coordsAt(cursor.head, -1), after = this.coordsAt(cursor.head, 1);\n if (!before || !after || before.bottom > after.top)\n return;\n let dom = this.domAtPos(cursor.head + cursor.assoc);\n sel.collapse(dom.node, dom.offset);\n sel.modify("move", cursor.assoc < 0 ? "forward" : "backward", "lineboundary");\n // This can go wrong in corner cases like single-character lines,\n // so check and reset if necessary.\n view.observer.readSelectionRange();\n let newRange = view.observer.selectionRange;\n if (view.docView.posFromDOM(newRange.anchorNode, newRange.anchorOffset) != cursor.from)\n sel.collapse(anchorNode, anchorOffset);\n }\n // If a position is in/near a block widget, move it to a nearby text\n // line, since we don\'t want the cursor inside a block widget.\n moveToLine(pos) {\n // Block widgets will return positions before/after them, which\n // are thus directly in the document DOM element.\n let dom = this.dom, newPos;\n if (pos.node != dom)\n return pos;\n for (let i = pos.offset; !newPos && i < dom.childNodes.length; i++) {\n let view = ContentView.get(dom.childNodes[i]);\n if (view instanceof LineView)\n newPos = view.domAtPos(0);\n }\n for (let i = pos.offset - 1; !newPos && i >= 0; i--) {\n let view = ContentView.get(dom.childNodes[i]);\n if (view instanceof LineView)\n newPos = view.domAtPos(view.length);\n }\n return newPos ? new DOMPos(newPos.node, newPos.offset, true) : pos;\n }\n nearest(dom) {\n for (let cur = dom; cur;) {\n let domView = ContentView.get(cur);\n if (domView && domView.rootView == this)\n return domView;\n cur = cur.parentNode;\n }\n return null;\n }\n posFromDOM(node, offset) {\n let view = this.nearest(node);\n if (!view)\n throw new RangeError("Trying to find position for a DOM position outside of the document");\n return view.localPosFromDOM(node, offset) + view.posAtStart;\n }\n domAtPos(pos) {\n let { i, off } = this.childCursor().findPos(pos, -1);\n for (; i < this.children.length - 1;) {\n let child = this.children[i];\n if (off < child.length || child instanceof LineView)\n break;\n i++;\n off = 0;\n }\n return this.children[i].domAtPos(off);\n }\n coordsAt(pos, side) {\n let best = null, bestPos = 0;\n for (let off = this.length, i = this.children.length - 1; i >= 0; i--) {\n let child = this.children[i], end = off - child.breakAfter, start = end - child.length;\n if (end < pos)\n break;\n if (start <= pos && (start < pos || child.covers(-1)) && (end > pos || child.covers(1)) &&\n (!best || child instanceof LineView && !(best instanceof LineView && side >= 0))) {\n best = child;\n bestPos = start;\n }\n else if (best && start == pos && end == pos && child instanceof BlockWidgetView && Math.abs(side) < 2) {\n if (child.deco.startSide < 0)\n break;\n else if (i)\n best = null;\n }\n off = start;\n }\n return best ? best.coordsAt(pos - bestPos, side) : null;\n }\n coordsForChar(pos) {\n let { i, off } = this.childPos(pos, 1), child = this.children[i];\n if (!(child instanceof LineView))\n return null;\n while (child.children.length) {\n let { i, off: childOff } = child.childPos(off, 1);\n for (;; i++) {\n if (i == child.children.length)\n return null;\n if ((child = child.children[i]).length)\n break;\n }\n off = childOff;\n }\n if (!(child instanceof TextView))\n return null;\n let end = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.findClusterBreak)(child.text, off);\n if (end == off)\n return null;\n let rects = textRange(child.dom, off, end).getClientRects();\n for (let i = 0; i < rects.length; i++) {\n let rect = rects[i];\n if (i == rects.length - 1 || rect.top < rect.bottom && rect.left < rect.right)\n return rect;\n }\n return null;\n }\n measureVisibleLineHeights(viewport) {\n let result = [], { from, to } = viewport;\n let contentWidth = this.view.contentDOM.clientWidth;\n let isWider = contentWidth > Math.max(this.view.scrollDOM.clientWidth, this.minWidth) + 1;\n let widest = -1, ltr = this.view.textDirection == Direction.LTR;\n for (let pos = 0, i = 0; i < this.children.length; i++) {\n let child = this.children[i], end = pos + child.length;\n if (end > to)\n break;\n if (pos >= from) {\n let childRect = child.dom.getBoundingClientRect();\n result.push(childRect.height);\n if (isWider) {\n let last = child.dom.lastChild;\n let rects = last ? clientRectsFor(last) : [];\n if (rects.length) {\n let rect = rects[rects.length - 1];\n let width = ltr ? rect.right - childRect.left : childRect.right - rect.left;\n if (width > widest) {\n widest = width;\n this.minWidth = contentWidth;\n this.minWidthFrom = pos;\n this.minWidthTo = end;\n }\n }\n }\n }\n pos = end + child.breakAfter;\n }\n return result;\n }\n textDirectionAt(pos) {\n let { i } = this.childPos(pos, 1);\n return getComputedStyle(this.children[i].dom).direction == "rtl" ? Direction.RTL : Direction.LTR;\n }\n measureTextSize() {\n for (let child of this.children) {\n if (child instanceof LineView) {\n let measure = child.measureTextSize();\n if (measure)\n return measure;\n }\n }\n // If no workable line exists, force a layout of a measurable element\n let dummy = document.createElement("div"), lineHeight, charWidth, textHeight;\n dummy.className = "cm-line";\n dummy.style.width = "99999px";\n dummy.style.position = "absolute";\n dummy.textContent = "abc def ghi jkl mno pqr stu";\n this.view.observer.ignore(() => {\n this.dom.appendChild(dummy);\n let rect = clientRectsFor(dummy.firstChild)[0];\n lineHeight = dummy.getBoundingClientRect().height;\n charWidth = rect ? rect.width / 27 : 7;\n textHeight = rect ? rect.height : lineHeight;\n dummy.remove();\n });\n return { lineHeight, charWidth, textHeight };\n }\n childCursor(pos = this.length) {\n // Move back to start of last element when possible, so that\n // `ChildCursor.findPos` doesn\'t have to deal with the edge case\n // of being after the last element.\n let i = this.children.length;\n if (i)\n pos -= this.children[--i].length;\n return new ChildCursor(this.children, pos, i);\n }\n computeBlockGapDeco() {\n let deco = [], vs = this.view.viewState;\n for (let pos = 0, i = 0;; i++) {\n let next = i == vs.viewports.length ? null : vs.viewports[i];\n let end = next ? next.from - 1 : this.length;\n if (end > pos) {\n let height = (vs.lineBlockAt(end).bottom - vs.lineBlockAt(pos).top) / this.view.scaleY;\n deco.push(Decoration.replace({\n widget: new BlockGapWidget(height),\n block: true,\n inclusive: true,\n isBlockGap: true,\n }).range(pos, end));\n }\n if (!next)\n break;\n pos = next.to + 1;\n }\n return Decoration.set(deco);\n }\n updateDeco() {\n let i = 1;\n let allDeco = this.view.state.facet(decorations).map(d => {\n let dynamic = this.dynamicDecorationMap[i++] = typeof d == "function";\n return dynamic ? d(this.view) : d;\n });\n let dynamicOuter = false, outerDeco = this.view.state.facet(outerDecorations).map((d, i) => {\n let dynamic = typeof d == "function";\n if (dynamic)\n dynamicOuter = true;\n return dynamic ? d(this.view) : d;\n });\n if (outerDeco.length) {\n this.dynamicDecorationMap[i++] = dynamicOuter;\n allDeco.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.join(outerDeco));\n }\n this.decorations = [\n this.editContextFormatting,\n ...allDeco,\n this.computeBlockGapDeco(),\n this.view.viewState.lineGapDeco\n ];\n while (i < this.decorations.length)\n this.dynamicDecorationMap[i++] = false;\n return this.decorations;\n }\n scrollIntoView(target) {\n if (target.isSnapshot) {\n let ref = this.view.viewState.lineBlockAt(target.range.head);\n this.view.scrollDOM.scrollTop = ref.top - target.yMargin;\n this.view.scrollDOM.scrollLeft = target.xMargin;\n return;\n }\n for (let handler of this.view.state.facet(scrollHandler)) {\n try {\n if (handler(this.view, target.range, target))\n return true;\n }\n catch (e) {\n logException(this.view.state, e, "scroll handler");\n }\n }\n let { range } = target;\n let rect = this.coordsAt(range.head, range.empty ? range.assoc : range.head > range.anchor ? -1 : 1), other;\n if (!rect)\n return;\n if (!range.empty && (other = this.coordsAt(range.anchor, range.anchor > range.head ? -1 : 1)))\n rect = { left: Math.min(rect.left, other.left), top: Math.min(rect.top, other.top),\n right: Math.max(rect.right, other.right), bottom: Math.max(rect.bottom, other.bottom) };\n let margins = getScrollMargins(this.view);\n let targetRect = {\n left: rect.left - margins.left, top: rect.top - margins.top,\n right: rect.right + margins.right, bottom: rect.bottom + margins.bottom\n };\n let { offsetWidth, offsetHeight } = this.view.scrollDOM;\n scrollRectIntoView(this.view.scrollDOM, targetRect, range.head < range.anchor ? -1 : 1, target.x, target.y, Math.max(Math.min(target.xMargin, offsetWidth), -offsetWidth), Math.max(Math.min(target.yMargin, offsetHeight), -offsetHeight), this.view.textDirection == Direction.LTR);\n }\n}\nfunction betweenUneditable(pos) {\n return pos.node.nodeType == 1 && pos.node.firstChild &&\n (pos.offset == 0 || pos.node.childNodes[pos.offset - 1].contentEditable == "false") &&\n (pos.offset == pos.node.childNodes.length || pos.node.childNodes[pos.offset].contentEditable == "false");\n}\nclass BlockGapWidget extends WidgetType {\n constructor(height) {\n super();\n this.height = height;\n }\n toDOM() {\n let elt = document.createElement("div");\n elt.className = "cm-gap";\n this.updateDOM(elt);\n return elt;\n }\n eq(other) { return other.height == this.height; }\n updateDOM(elt) {\n elt.style.height = this.height + "px";\n return true;\n }\n get editable() { return true; }\n get estimatedHeight() { return this.height; }\n ignoreEvent() { return false; }\n}\nfunction findCompositionNode(view, headPos) {\n let sel = view.observer.selectionRange;\n if (!sel.focusNode)\n return null;\n let textBefore = textNodeBefore(sel.focusNode, sel.focusOffset);\n let textAfter = textNodeAfter(sel.focusNode, sel.focusOffset);\n let textNode = textBefore || textAfter;\n if (textAfter && textBefore && textAfter.node != textBefore.node) {\n let descAfter = ContentView.get(textAfter.node);\n if (!descAfter || descAfter instanceof TextView && descAfter.text != textAfter.node.nodeValue) {\n textNode = textAfter;\n }\n else if (view.docView.lastCompositionAfterCursor) {\n let descBefore = ContentView.get(textBefore.node);\n if (!(!descBefore || descBefore instanceof TextView && descBefore.text != textBefore.node.nodeValue))\n textNode = textAfter;\n }\n }\n view.docView.lastCompositionAfterCursor = textNode != textBefore;\n if (!textNode)\n return null;\n let from = headPos - textNode.offset;\n return { from, to: from + textNode.node.nodeValue.length, node: textNode.node };\n}\nfunction findCompositionRange(view, changes, headPos) {\n let found = findCompositionNode(view, headPos);\n if (!found)\n return null;\n let { node: textNode, from, to } = found, text = textNode.nodeValue;\n // Don\'t try to preserve multi-line compositions\n if (/[\\n\\r]/.test(text))\n return null;\n if (view.state.doc.sliceString(found.from, found.to) != text)\n return null;\n let inv = changes.invertedDesc;\n let range = new ChangedRange(inv.mapPos(from), inv.mapPos(to), from, to);\n let marks = [];\n for (let parent = textNode.parentNode;; parent = parent.parentNode) {\n let parentView = ContentView.get(parent);\n if (parentView instanceof MarkView)\n marks.push({ node: parent, deco: parentView.mark });\n else if (parentView instanceof LineView || parent.nodeName == "DIV" && parent.parentNode == view.contentDOM)\n return { range, text: textNode, marks, line: parent };\n else if (parent != view.contentDOM)\n marks.push({ node: parent, deco: new MarkDecoration({\n inclusive: true,\n attributes: getAttrs(parent),\n tagName: parent.tagName.toLowerCase()\n }) });\n else\n return null;\n }\n}\nfunction nextToUneditable(node, offset) {\n if (node.nodeType != 1)\n return 0;\n return (offset && node.childNodes[offset - 1].contentEditable == "false" ? 1 /* NextTo.Before */ : 0) |\n (offset < node.childNodes.length && node.childNodes[offset].contentEditable == "false" ? 2 /* NextTo.After */ : 0);\n}\nlet DecorationComparator$1 = class DecorationComparator {\n constructor() {\n this.changes = [];\n }\n compareRange(from, to) { addRange(from, to, this.changes); }\n comparePoint(from, to) { addRange(from, to, this.changes); }\n};\nfunction findChangedDeco(a, b, diff) {\n let comp = new DecorationComparator$1;\n _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.compare(a, b, diff, comp);\n return comp.changes;\n}\nfunction inUneditable(node, inside) {\n for (let cur = node; cur && cur != inside; cur = cur.assignedSlot || cur.parentNode) {\n if (cur.nodeType == 1 && cur.contentEditable == \'false\') {\n return true;\n }\n }\n return false;\n}\nfunction touchesComposition(changes, composition) {\n let touched = false;\n if (composition)\n changes.iterChangedRanges((from, to) => {\n if (from < composition.to && to > composition.from)\n touched = true;\n });\n return touched;\n}\n\nfunction groupAt(state, pos, bias = 1) {\n let categorize = state.charCategorizer(pos);\n let line = state.doc.lineAt(pos), linePos = pos - line.from;\n if (line.length == 0)\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(pos);\n if (linePos == 0)\n bias = 1;\n else if (linePos == line.length)\n bias = -1;\n let from = linePos, to = linePos;\n if (bias < 0)\n from = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.findClusterBreak)(line.text, linePos, false);\n else\n to = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.findClusterBreak)(line.text, linePos);\n let cat = categorize(line.text.slice(from, to));\n while (from > 0) {\n let prev = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.findClusterBreak)(line.text, from, false);\n if (categorize(line.text.slice(prev, from)) != cat)\n break;\n from = prev;\n }\n while (to < line.length) {\n let next = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.findClusterBreak)(line.text, to);\n if (categorize(line.text.slice(to, next)) != cat)\n break;\n to = next;\n }\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.range(from + line.from, to + line.from);\n}\n// Search the DOM for the {node, offset} position closest to the given\n// coordinates. Very inefficient and crude, but can usually be avoided\n// by calling caret(Position|Range)FromPoint instead.\nfunction getdx(x, rect) {\n return rect.left > x ? rect.left - x : Math.max(0, x - rect.right);\n}\nfunction getdy(y, rect) {\n return rect.top > y ? rect.top - y : Math.max(0, y - rect.bottom);\n}\nfunction yOverlap(a, b) {\n return a.top < b.bottom - 1 && a.bottom > b.top + 1;\n}\nfunction upTop(rect, top) {\n return top < rect.top ? { top, left: rect.left, right: rect.right, bottom: rect.bottom } : rect;\n}\nfunction upBot(rect, bottom) {\n return bottom > rect.bottom ? { top: rect.top, left: rect.left, right: rect.right, bottom } : rect;\n}\nfunction domPosAtCoords(parent, x, y) {\n let closest, closestRect, closestX, closestY, closestOverlap = false;\n let above, below, aboveRect, belowRect;\n for (let child = parent.firstChild; child; child = child.nextSibling) {\n let rects = clientRectsFor(child);\n for (let i = 0; i < rects.length; i++) {\n let rect = rects[i];\n if (closestRect && yOverlap(closestRect, rect))\n rect = upTop(upBot(rect, closestRect.bottom), closestRect.top);\n let dx = getdx(x, rect), dy = getdy(y, rect);\n if (dx == 0 && dy == 0)\n return child.nodeType == 3 ? domPosInText(child, x, y) : domPosAtCoords(child, x, y);\n if (!closest || closestY > dy || closestY == dy && closestX > dx) {\n closest = child;\n closestRect = rect;\n closestX = dx;\n closestY = dy;\n let side = dy ? (y < rect.top ? -1 : 1) : dx ? (x < rect.left ? -1 : 1) : 0;\n closestOverlap = !side || (side > 0 ? i < rects.length - 1 : i > 0);\n }\n if (dx == 0) {\n if (y > rect.bottom && (!aboveRect || aboveRect.bottom < rect.bottom)) {\n above = child;\n aboveRect = rect;\n }\n else if (y < rect.top && (!belowRect || belowRect.top > rect.top)) {\n below = child;\n belowRect = rect;\n }\n }\n else if (aboveRect && yOverlap(aboveRect, rect)) {\n aboveRect = upBot(aboveRect, rect.bottom);\n }\n else if (belowRect && yOverlap(belowRect, rect)) {\n belowRect = upTop(belowRect, rect.top);\n }\n }\n }\n if (aboveRect && aboveRect.bottom >= y) {\n closest = above;\n closestRect = aboveRect;\n }\n else if (belowRect && belowRect.top <= y) {\n closest = below;\n closestRect = belowRect;\n }\n if (!closest)\n return { node: parent, offset: 0 };\n let clipX = Math.max(closestRect.left, Math.min(closestRect.right, x));\n if (closest.nodeType == 3)\n return domPosInText(closest, clipX, y);\n if (closestOverlap && closest.contentEditable != "false")\n return domPosAtCoords(closest, clipX, y);\n let offset = Array.prototype.indexOf.call(parent.childNodes, closest) +\n (x >= (closestRect.left + closestRect.right) / 2 ? 1 : 0);\n return { node: parent, offset };\n}\nfunction domPosInText(node, x, y) {\n let len = node.nodeValue.length;\n let closestOffset = -1, closestDY = 1e9, generalSide = 0;\n for (let i = 0; i < len; i++) {\n let rects = textRange(node, i, i + 1).getClientRects();\n for (let j = 0; j < rects.length; j++) {\n let rect = rects[j];\n if (rect.top == rect.bottom)\n continue;\n if (!generalSide)\n generalSide = x - rect.left;\n let dy = (rect.top > y ? rect.top - y : y - rect.bottom) - 1;\n if (rect.left - 1 <= x && rect.right + 1 >= x && dy < closestDY) {\n let right = x >= (rect.left + rect.right) / 2, after = right;\n if (browser.chrome || browser.gecko) {\n // Check for RTL on browsers that support getting client\n // rects for empty ranges.\n let rectBefore = textRange(node, i).getBoundingClientRect();\n if (rectBefore.left == rect.right)\n after = !right;\n }\n if (dy <= 0)\n return { node, offset: i + (after ? 1 : 0) };\n closestOffset = i + (after ? 1 : 0);\n closestDY = dy;\n }\n }\n }\n return { node, offset: closestOffset > -1 ? closestOffset : generalSide > 0 ? node.nodeValue.length : 0 };\n}\nfunction posAtCoords(view, coords, precise, bias = -1) {\n var _a, _b;\n let content = view.contentDOM.getBoundingClientRect(), docTop = content.top + view.viewState.paddingTop;\n let block, { docHeight } = view.viewState;\n let { x, y } = coords, yOffset = y - docTop;\n if (yOffset < 0)\n return 0;\n if (yOffset > docHeight)\n return view.state.doc.length;\n // Scan for a text block near the queried y position\n for (let halfLine = view.viewState.heightOracle.textHeight / 2, bounced = false;;) {\n block = view.elementAtHeight(yOffset);\n if (block.type == BlockType.Text)\n break;\n for (;;) {\n // Move the y position out of this block\n yOffset = bias > 0 ? block.bottom + halfLine : block.top - halfLine;\n if (yOffset >= 0 && yOffset <= docHeight)\n break;\n // If the document consists entirely of replaced widgets, we\n // won\'t find a text block, so return 0\n if (bounced)\n return precise ? null : 0;\n bounced = true;\n bias = -bias;\n }\n }\n y = docTop + yOffset;\n let lineStart = block.from;\n // If this is outside of the rendered viewport, we can\'t determine a position\n if (lineStart < view.viewport.from)\n return view.viewport.from == 0 ? 0 : precise ? null : posAtCoordsImprecise(view, content, block, x, y);\n if (lineStart > view.viewport.to)\n return view.viewport.to == view.state.doc.length ? view.state.doc.length :\n precise ? null : posAtCoordsImprecise(view, content, block, x, y);\n // Prefer ShadowRootOrDocument.elementFromPoint if present, fall back to document if not\n let doc = view.dom.ownerDocument;\n let root = view.root.elementFromPoint ? view.root : doc;\n let element = root.elementFromPoint(x, y);\n if (element && !view.contentDOM.contains(element))\n element = null;\n // If the element is unexpected, clip x at the sides of the content area and try again\n if (!element) {\n x = Math.max(content.left + 1, Math.min(content.right - 1, x));\n element = root.elementFromPoint(x, y);\n if (element && !view.contentDOM.contains(element))\n element = null;\n }\n // There\'s visible editor content under the point, so we can try\n // using caret(Position|Range)FromPoint as a shortcut\n let node, offset = -1;\n if (element && ((_a = view.docView.nearest(element)) === null || _a === void 0 ? void 0 : _a.isEditable) != false) {\n if (doc.caretPositionFromPoint) {\n let pos = doc.caretPositionFromPoint(x, y);\n if (pos)\n ({ offsetNode: node, offset } = pos);\n }\n else if (doc.caretRangeFromPoint) {\n let range = doc.caretRangeFromPoint(x, y);\n if (range) {\n ({ startContainer: node, startOffset: offset } = range);\n if (!view.contentDOM.contains(node) ||\n browser.safari && isSuspiciousSafariCaretResult(node, offset, x) ||\n browser.chrome && isSuspiciousChromeCaretResult(node, offset, x))\n node = undefined;\n }\n }\n }\n // No luck, do our own (potentially expensive) search\n if (!node || !view.docView.dom.contains(node)) {\n let line = LineView.find(view.docView, lineStart);\n if (!line)\n return yOffset > block.top + block.height / 2 ? block.to : block.from;\n ({ node, offset } = domPosAtCoords(line.dom, x, y));\n }\n let nearest = view.docView.nearest(node);\n if (!nearest)\n return null;\n if (nearest.isWidget && ((_b = nearest.dom) === null || _b === void 0 ? void 0 : _b.nodeType) == 1) {\n let rect = nearest.dom.getBoundingClientRect();\n return coords.y < rect.top || coords.y <= rect.bottom && coords.x <= (rect.left + rect.right) / 2\n ? nearest.posAtStart : nearest.posAtEnd;\n }\n else {\n return nearest.localPosFromDOM(node, offset) + nearest.posAtStart;\n }\n}\nfunction posAtCoordsImprecise(view, contentRect, block, x, y) {\n let into = Math.round((x - contentRect.left) * view.defaultCharacterWidth);\n if (view.lineWrapping && block.height > view.defaultLineHeight * 1.5) {\n let textHeight = view.viewState.heightOracle.textHeight;\n let line = Math.floor((y - block.top - (view.defaultLineHeight - textHeight) * 0.5) / textHeight);\n into += line * view.viewState.heightOracle.lineLength;\n }\n let content = view.state.sliceDoc(block.from, block.to);\n return block.from + (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.findColumn)(content, into, view.state.tabSize);\n}\n// In case of a high line height, Safari\'s caretRangeFromPoint treats\n// the space between lines as belonging to the last character of the\n// line before. This is used to detect such a result so that it can be\n// ignored (issue #401).\nfunction isSuspiciousSafariCaretResult(node, offset, x) {\n let len;\n if (node.nodeType != 3 || offset != (len = node.nodeValue.length))\n return false;\n for (let next = node.nextSibling; next; next = next.nextSibling)\n if (next.nodeType != 1 || next.nodeName != "BR")\n return false;\n return textRange(node, len - 1, len).getBoundingClientRect().left > x;\n}\n// Chrome will move positions between lines to the start of the next line\nfunction isSuspiciousChromeCaretResult(node, offset, x) {\n if (offset != 0)\n return false;\n for (let cur = node;;) {\n let parent = cur.parentNode;\n if (!parent || parent.nodeType != 1 || parent.firstChild != cur)\n return false;\n if (parent.classList.contains("cm-line"))\n break;\n cur = parent;\n }\n let rect = node.nodeType == 1 ? node.getBoundingClientRect()\n : textRange(node, 0, Math.max(node.nodeValue.length, 1)).getBoundingClientRect();\n return x - rect.left > 5;\n}\nfunction blockAt(view, pos) {\n let line = view.lineBlockAt(pos);\n if (Array.isArray(line.type))\n for (let l of line.type) {\n if (l.to > pos || l.to == pos && (l.to == line.to || l.type == BlockType.Text))\n return l;\n }\n return line;\n}\nfunction moveToLineBoundary(view, start, forward, includeWrap) {\n let line = blockAt(view, start.head);\n let coords = !includeWrap || line.type != BlockType.Text || !(view.lineWrapping || line.widgetLineBreaks) ? null\n : view.coordsAtPos(start.assoc < 0 && start.head > line.from ? start.head - 1 : start.head);\n if (coords) {\n let editorRect = view.dom.getBoundingClientRect();\n let direction = view.textDirectionAt(line.from);\n let pos = view.posAtCoords({ x: forward == (direction == Direction.LTR) ? editorRect.right - 1 : editorRect.left + 1,\n y: (coords.top + coords.bottom) / 2 });\n if (pos != null)\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(pos, forward ? -1 : 1);\n }\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(forward ? line.to : line.from, forward ? -1 : 1);\n}\nfunction moveByChar(view, start, forward, by) {\n let line = view.state.doc.lineAt(start.head), spans = view.bidiSpans(line);\n let direction = view.textDirectionAt(line.from);\n for (let cur = start, check = null;;) {\n let next = moveVisually(line, spans, direction, cur, forward), char = movedOver;\n if (!next) {\n if (line.number == (forward ? view.state.doc.lines : 1))\n return cur;\n char = "\\n";\n line = view.state.doc.line(line.number + (forward ? 1 : -1));\n spans = view.bidiSpans(line);\n next = view.visualLineSide(line, !forward);\n }\n if (!check) {\n if (!by)\n return next;\n check = by(char);\n }\n else if (!check(char)) {\n return cur;\n }\n cur = next;\n }\n}\nfunction byGroup(view, pos, start) {\n let categorize = view.state.charCategorizer(pos);\n let cat = categorize(start);\n return (next) => {\n let nextCat = categorize(next);\n if (cat == _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.CharCategory.Space)\n cat = nextCat;\n return cat == nextCat;\n };\n}\nfunction moveVertically(view, start, forward, distance) {\n let startPos = start.head, dir = forward ? 1 : -1;\n if (startPos == (forward ? view.state.doc.length : 0))\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(startPos, start.assoc);\n let goal = start.goalColumn, startY;\n let rect = view.contentDOM.getBoundingClientRect();\n let startCoords = view.coordsAtPos(startPos, start.assoc || -1), docTop = view.documentTop;\n if (startCoords) {\n if (goal == null)\n goal = startCoords.left - rect.left;\n startY = dir < 0 ? startCoords.top : startCoords.bottom;\n }\n else {\n let line = view.viewState.lineBlockAt(startPos);\n if (goal == null)\n goal = Math.min(rect.right - rect.left, view.defaultCharacterWidth * (startPos - line.from));\n startY = (dir < 0 ? line.top : line.bottom) + docTop;\n }\n let resolvedGoal = rect.left + goal;\n let dist = distance !== null && distance !== void 0 ? distance : (view.viewState.heightOracle.textHeight >> 1);\n for (let extra = 0;; extra += 10) {\n let curY = startY + (dist + extra) * dir;\n let pos = posAtCoords(view, { x: resolvedGoal, y: curY }, false, dir);\n if (curY < rect.top || curY > rect.bottom || (dir < 0 ? pos < startPos : pos > startPos)) {\n let charRect = view.docView.coordsForChar(pos);\n let assoc = !charRect || curY < charRect.top ? -1 : 1;\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(pos, assoc, undefined, goal);\n }\n }\n}\nfunction skipAtomicRanges(atoms, pos, bias) {\n for (;;) {\n let moved = 0;\n for (let set of atoms) {\n set.between(pos - 1, pos + 1, (from, to, value) => {\n if (pos > from && pos < to) {\n let side = moved || bias || (pos - from < to - pos ? -1 : 1);\n pos = side < 0 ? from : to;\n moved = side;\n }\n });\n }\n if (!moved)\n return pos;\n }\n}\nfunction skipAtoms(view, oldPos, pos) {\n let newPos = skipAtomicRanges(view.state.facet(atomicRanges).map(f => f(view)), pos.from, oldPos.head > pos.from ? -1 : 1);\n return newPos == pos.from ? pos : _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(newPos, newPos < pos.from ? 1 : -1);\n}\n\n// This will also be where dragging info and such goes\nclass InputState {\n setSelectionOrigin(origin) {\n this.lastSelectionOrigin = origin;\n this.lastSelectionTime = Date.now();\n }\n constructor(view) {\n this.view = view;\n this.lastKeyCode = 0;\n this.lastKeyTime = 0;\n this.lastTouchTime = 0;\n this.lastFocusTime = 0;\n this.lastScrollTop = 0;\n this.lastScrollLeft = 0;\n // On iOS, some keys need to have their default behavior happen\n // (after which we retroactively handle them and reset the DOM) to\n // avoid messing up the virtual keyboard state.\n this.pendingIOSKey = undefined;\n /**\n When enabled (>-1), tab presses are not given to key handlers,\n leaving the browser\'s default behavior. If >0, the mode expires\n at that timestamp, and any other keypress clears it.\n Esc enables temporary tab focus mode for two seconds when not\n otherwise handled.\n */\n this.tabFocusMode = -1;\n this.lastSelectionOrigin = null;\n this.lastSelectionTime = 0;\n this.lastContextMenu = 0;\n this.scrollHandlers = [];\n this.handlers = Object.create(null);\n // -1 means not in a composition. Otherwise, this counts the number\n // of changes made during the composition. The count is used to\n // avoid treating the start state of the composition, before any\n // changes have been made, as part of the composition.\n this.composing = -1;\n // Tracks whether the next change should be marked as starting the\n // composition (null means no composition, true means next is the\n // first, false means first has already been marked for this\n // composition)\n this.compositionFirstChange = null;\n // End time of the previous composition\n this.compositionEndedAt = 0;\n // Used in a kludge to detect when an Enter keypress should be\n // considered part of the composition on Safari, which fires events\n // in the wrong order\n this.compositionPendingKey = false;\n // Used to categorize changes as part of a composition, even when\n // the mutation events fire shortly after the compositionend event\n this.compositionPendingChange = false;\n this.mouseSelection = null;\n // When a drag from the editor is active, this points at the range\n // being dragged.\n this.draggedContent = null;\n this.handleEvent = this.handleEvent.bind(this);\n this.notifiedFocused = view.hasFocus;\n // On Safari adding an input event handler somehow prevents an\n // issue where the composition vanishes when you press enter.\n if (browser.safari)\n view.contentDOM.addEventListener("input", () => null);\n if (browser.gecko)\n firefoxCopyCutHack(view.contentDOM.ownerDocument);\n }\n handleEvent(event) {\n if (!eventBelongsToEditor(this.view, event) || this.ignoreDuringComposition(event))\n return;\n if (event.type == "keydown" && this.keydown(event))\n return;\n this.runHandlers(event.type, event);\n }\n runHandlers(type, event) {\n let handlers = this.handlers[type];\n if (handlers) {\n for (let observer of handlers.observers)\n observer(this.view, event);\n for (let handler of handlers.handlers) {\n if (event.defaultPrevented)\n break;\n if (handler(this.view, event)) {\n event.preventDefault();\n break;\n }\n }\n }\n }\n ensureHandlers(plugins) {\n let handlers = computeHandlers(plugins), prev = this.handlers, dom = this.view.contentDOM;\n for (let type in handlers)\n if (type != "scroll") {\n let passive = !handlers[type].handlers.length;\n let exists = prev[type];\n if (exists && passive != !exists.handlers.length) {\n dom.removeEventListener(type, this.handleEvent);\n exists = null;\n }\n if (!exists)\n dom.addEventListener(type, this.handleEvent, { passive });\n }\n for (let type in prev)\n if (type != "scroll" && !handlers[type])\n dom.removeEventListener(type, this.handleEvent);\n this.handlers = handlers;\n }\n keydown(event) {\n // Must always run, even if a custom handler handled the event\n this.lastKeyCode = event.keyCode;\n this.lastKeyTime = Date.now();\n if (event.keyCode == 9 && this.tabFocusMode > -1 && (!this.tabFocusMode || Date.now() <= this.tabFocusMode))\n return true;\n if (this.tabFocusMode > 0 && event.keyCode != 27 && modifierCodes.indexOf(event.keyCode) < 0)\n this.tabFocusMode = -1;\n // Chrome for Android usually doesn\'t fire proper key events, but\n // occasionally does, usually surrounded by a bunch of complicated\n // composition changes. When an enter or backspace key event is\n // seen, hold off on handling DOM events for a bit, and then\n // dispatch it.\n if (browser.android && browser.chrome && !event.synthetic &&\n (event.keyCode == 13 || event.keyCode == 8)) {\n this.view.observer.delayAndroidKey(event.key, event.keyCode);\n return true;\n }\n // Preventing the default behavior of Enter on iOS makes the\n // virtual keyboard get stuck in the wrong (lowercase)\n // state. So we let it go through, and then, in\n // applyDOMChange, notify key handlers of it and reset to\n // the state they produce.\n let pending;\n if (browser.ios && !event.synthetic && !event.altKey && !event.metaKey &&\n ((pending = PendingKeys.find(key => key.keyCode == event.keyCode)) && !event.ctrlKey ||\n EmacsyPendingKeys.indexOf(event.key) > -1 && event.ctrlKey && !event.shiftKey)) {\n this.pendingIOSKey = pending || event;\n setTimeout(() => this.flushIOSKey(), 250);\n return true;\n }\n if (event.keyCode != 229)\n this.view.observer.forceFlush();\n return false;\n }\n flushIOSKey(change) {\n let key = this.pendingIOSKey;\n if (!key)\n return false;\n // This looks like an autocorrection before Enter\n if (key.key == "Enter" && change && change.from < change.to && /^\\S+$/.test(change.insert.toString()))\n return false;\n this.pendingIOSKey = undefined;\n return dispatchKey(this.view.contentDOM, key.key, key.keyCode, key instanceof KeyboardEvent ? key : undefined);\n }\n ignoreDuringComposition(event) {\n if (!/^key/.test(event.type))\n return false;\n if (this.composing > 0)\n return true;\n // See https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/.\n // On some input method editors (IMEs), the Enter key is used to\n // confirm character selection. On Safari, when Enter is pressed,\n // compositionend and keydown events are sometimes emitted in the\n // wrong order. The key event should still be ignored, even when\n // it happens after the compositionend event.\n if (browser.safari && !browser.ios && this.compositionPendingKey && Date.now() - this.compositionEndedAt < 100) {\n this.compositionPendingKey = false;\n return true;\n }\n return false;\n }\n startMouseSelection(mouseSelection) {\n if (this.mouseSelection)\n this.mouseSelection.destroy();\n this.mouseSelection = mouseSelection;\n }\n update(update) {\n this.view.observer.update(update);\n if (this.mouseSelection)\n this.mouseSelection.update(update);\n if (this.draggedContent && update.docChanged)\n this.draggedContent = this.draggedContent.map(update.changes);\n if (update.transactions.length)\n this.lastKeyCode = this.lastSelectionTime = 0;\n }\n destroy() {\n if (this.mouseSelection)\n this.mouseSelection.destroy();\n }\n}\nfunction bindHandler(plugin, handler) {\n return (view, event) => {\n try {\n return handler.call(plugin, event, view);\n }\n catch (e) {\n logException(view.state, e);\n }\n };\n}\nfunction computeHandlers(plugins) {\n let result = Object.create(null);\n function record(type) {\n return result[type] || (result[type] = { observers: [], handlers: [] });\n }\n for (let plugin of plugins) {\n let spec = plugin.spec;\n if (spec && spec.domEventHandlers)\n for (let type in spec.domEventHandlers) {\n let f = spec.domEventHandlers[type];\n if (f)\n record(type).handlers.push(bindHandler(plugin.value, f));\n }\n if (spec && spec.domEventObservers)\n for (let type in spec.domEventObservers) {\n let f = spec.domEventObservers[type];\n if (f)\n record(type).observers.push(bindHandler(plugin.value, f));\n }\n }\n for (let type in handlers)\n record(type).handlers.push(handlers[type]);\n for (let type in observers)\n record(type).observers.push(observers[type]);\n return result;\n}\nconst PendingKeys = [\n { key: "Backspace", keyCode: 8, inputType: "deleteContentBackward" },\n { key: "Enter", keyCode: 13, inputType: "insertParagraph" },\n { key: "Enter", keyCode: 13, inputType: "insertLineBreak" },\n { key: "Delete", keyCode: 46, inputType: "deleteContentForward" }\n];\nconst EmacsyPendingKeys = "dthko";\n// Key codes for modifier keys\nconst modifierCodes = [16, 17, 18, 20, 91, 92, 224, 225];\nconst dragScrollMargin = 6;\nfunction dragScrollSpeed(dist) {\n return Math.max(0, dist) * 0.7 + 8;\n}\nfunction dist(a, b) {\n return Math.max(Math.abs(a.clientX - b.clientX), Math.abs(a.clientY - b.clientY));\n}\nclass MouseSelection {\n constructor(view, startEvent, style, mustSelect) {\n this.view = view;\n this.startEvent = startEvent;\n this.style = style;\n this.mustSelect = mustSelect;\n this.scrollSpeed = { x: 0, y: 0 };\n this.scrolling = -1;\n this.lastEvent = startEvent;\n this.scrollParents = scrollableParents(view.contentDOM);\n this.atoms = view.state.facet(atomicRanges).map(f => f(view));\n let doc = view.contentDOM.ownerDocument;\n doc.addEventListener("mousemove", this.move = this.move.bind(this));\n doc.addEventListener("mouseup", this.up = this.up.bind(this));\n this.extend = startEvent.shiftKey;\n this.multiple = view.state.facet(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorState.allowMultipleSelections) && addsSelectionRange(view, startEvent);\n this.dragging = isInPrimarySelection(view, startEvent) && getClickType(startEvent) == 1 ? null : false;\n }\n start(event) {\n // When clicking outside of the selection, immediately apply the\n // effect of starting the selection\n if (this.dragging === false)\n this.select(event);\n }\n move(event) {\n if (event.buttons == 0)\n return this.destroy();\n if (this.dragging || this.dragging == null && dist(this.startEvent, event) < 10)\n return;\n this.select(this.lastEvent = event);\n let sx = 0, sy = 0;\n let left = 0, top = 0, right = this.view.win.innerWidth, bottom = this.view.win.innerHeight;\n if (this.scrollParents.x)\n ({ left, right } = this.scrollParents.x.getBoundingClientRect());\n if (this.scrollParents.y)\n ({ top, bottom } = this.scrollParents.y.getBoundingClientRect());\n let margins = getScrollMargins(this.view);\n if (event.clientX - margins.left <= left + dragScrollMargin)\n sx = -dragScrollSpeed(left - event.clientX);\n else if (event.clientX + margins.right >= right - dragScrollMargin)\n sx = dragScrollSpeed(event.clientX - right);\n if (event.clientY - margins.top <= top + dragScrollMargin)\n sy = -dragScrollSpeed(top - event.clientY);\n else if (event.clientY + margins.bottom >= bottom - dragScrollMargin)\n sy = dragScrollSpeed(event.clientY - bottom);\n this.setScrollSpeed(sx, sy);\n }\n up(event) {\n if (this.dragging == null)\n this.select(this.lastEvent);\n if (!this.dragging)\n event.preventDefault();\n this.destroy();\n }\n destroy() {\n this.setScrollSpeed(0, 0);\n let doc = this.view.contentDOM.ownerDocument;\n doc.removeEventListener("mousemove", this.move);\n doc.removeEventListener("mouseup", this.up);\n this.view.inputState.mouseSelection = this.view.inputState.draggedContent = null;\n }\n setScrollSpeed(sx, sy) {\n this.scrollSpeed = { x: sx, y: sy };\n if (sx || sy) {\n if (this.scrolling < 0)\n this.scrolling = setInterval(() => this.scroll(), 50);\n }\n else if (this.scrolling > -1) {\n clearInterval(this.scrolling);\n this.scrolling = -1;\n }\n }\n scroll() {\n let { x, y } = this.scrollSpeed;\n if (x && this.scrollParents.x) {\n this.scrollParents.x.scrollLeft += x;\n x = 0;\n }\n if (y && this.scrollParents.y) {\n this.scrollParents.y.scrollTop += y;\n y = 0;\n }\n if (x || y)\n this.view.win.scrollBy(x, y);\n if (this.dragging === false)\n this.select(this.lastEvent);\n }\n skipAtoms(sel) {\n let ranges = null;\n for (let i = 0; i < sel.ranges.length; i++) {\n let range = sel.ranges[i], updated = null;\n if (range.empty) {\n let pos = skipAtomicRanges(this.atoms, range.from, 0);\n if (pos != range.from)\n updated = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(pos, -1);\n }\n else {\n let from = skipAtomicRanges(this.atoms, range.from, -1);\n let to = skipAtomicRanges(this.atoms, range.to, 1);\n if (from != range.from || to != range.to)\n updated = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.range(range.from == range.anchor ? from : to, range.from == range.head ? from : to);\n }\n if (updated) {\n if (!ranges)\n ranges = sel.ranges.slice();\n ranges[i] = updated;\n }\n }\n return ranges ? _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.create(ranges, sel.mainIndex) : sel;\n }\n select(event) {\n let { view } = this, selection = this.skipAtoms(this.style.get(event, this.extend, this.multiple));\n if (this.mustSelect || !selection.eq(view.state.selection, this.dragging === false))\n this.view.dispatch({\n selection,\n userEvent: "select.pointer"\n });\n this.mustSelect = false;\n }\n update(update) {\n if (update.transactions.some(tr => tr.isUserEvent("input.type")))\n this.destroy();\n else if (this.style.update(update))\n setTimeout(() => this.select(this.lastEvent), 20);\n }\n}\nfunction addsSelectionRange(view, event) {\n let facet = view.state.facet(clickAddsSelectionRange);\n return facet.length ? facet[0](event) : browser.mac ? event.metaKey : event.ctrlKey;\n}\nfunction dragMovesSelection(view, event) {\n let facet = view.state.facet(dragMovesSelection$1);\n return facet.length ? facet[0](event) : browser.mac ? !event.altKey : !event.ctrlKey;\n}\nfunction isInPrimarySelection(view, event) {\n let { main } = view.state.selection;\n if (main.empty)\n return false;\n // On boundary clicks, check whether the coordinates are inside the\n // selection\'s client rectangles\n let sel = getSelection(view.root);\n if (!sel || sel.rangeCount == 0)\n return true;\n let rects = sel.getRangeAt(0).getClientRects();\n for (let i = 0; i < rects.length; i++) {\n let rect = rects[i];\n if (rect.left <= event.clientX && rect.right >= event.clientX &&\n rect.top <= event.clientY && rect.bottom >= event.clientY)\n return true;\n }\n return false;\n}\nfunction eventBelongsToEditor(view, event) {\n if (!event.bubbles)\n return true;\n if (event.defaultPrevented)\n return false;\n for (let node = event.target, cView; node != view.contentDOM; node = node.parentNode)\n if (!node || node.nodeType == 11 || ((cView = ContentView.get(node)) && cView.ignoreEvent(event)))\n return false;\n return true;\n}\nconst handlers = /*@__PURE__*/Object.create(null);\nconst observers = /*@__PURE__*/Object.create(null);\n// This is very crude, but unfortunately both these browsers _pretend_\n// that they have a clipboard API—all the objects and methods are\n// there, they just don\'t work, and they are hard to test.\nconst brokenClipboardAPI = (browser.ie && browser.ie_version < 15) ||\n (browser.ios && browser.webkit_version < 604);\nfunction capturePaste(view) {\n let parent = view.dom.parentNode;\n if (!parent)\n return;\n let target = parent.appendChild(document.createElement("textarea"));\n target.style.cssText = "position: fixed; left: -10000px; top: 10px";\n target.focus();\n setTimeout(() => {\n view.focus();\n target.remove();\n doPaste(view, target.value);\n }, 50);\n}\nfunction doPaste(view, input) {\n let { state } = view, changes, i = 1, text = state.toText(input);\n let byLine = text.lines == state.selection.ranges.length;\n let linewise = lastLinewiseCopy != null && state.selection.ranges.every(r => r.empty) && lastLinewiseCopy == text.toString();\n if (linewise) {\n let lastLine = -1;\n changes = state.changeByRange(range => {\n let line = state.doc.lineAt(range.from);\n if (line.from == lastLine)\n return { range };\n lastLine = line.from;\n let insert = state.toText((byLine ? text.line(i++).text : input) + state.lineBreak);\n return { changes: { from: line.from, insert },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(range.from + insert.length) };\n });\n }\n else if (byLine) {\n changes = state.changeByRange(range => {\n let line = text.line(i++);\n return { changes: { from: range.from, to: range.to, insert: line.text },\n range: _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(range.from + line.length) };\n });\n }\n else {\n changes = state.replaceSelection(text);\n }\n view.dispatch(changes, {\n userEvent: "input.paste",\n scrollIntoView: true\n });\n}\nobservers.scroll = view => {\n view.inputState.lastScrollTop = view.scrollDOM.scrollTop;\n view.inputState.lastScrollLeft = view.scrollDOM.scrollLeft;\n};\nhandlers.keydown = (view, event) => {\n view.inputState.setSelectionOrigin("select");\n if (event.keyCode == 27 && view.inputState.tabFocusMode != 0)\n view.inputState.tabFocusMode = Date.now() + 2000;\n return false;\n};\nobservers.touchstart = (view, e) => {\n view.inputState.lastTouchTime = Date.now();\n view.inputState.setSelectionOrigin("select.pointer");\n};\nobservers.touchmove = view => {\n view.inputState.setSelectionOrigin("select.pointer");\n};\nhandlers.mousedown = (view, event) => {\n view.observer.flush();\n if (view.inputState.lastTouchTime > Date.now() - 2000)\n return false; // Ignore touch interaction\n let style = null;\n for (let makeStyle of view.state.facet(mouseSelectionStyle)) {\n style = makeStyle(view, event);\n if (style)\n break;\n }\n if (!style && event.button == 0)\n style = basicMouseSelection(view, event);\n if (style) {\n let mustFocus = !view.hasFocus;\n view.inputState.startMouseSelection(new MouseSelection(view, event, style, mustFocus));\n if (mustFocus)\n view.observer.ignore(() => {\n focusPreventScroll(view.contentDOM);\n let active = view.root.activeElement;\n if (active && !active.contains(view.contentDOM))\n active.blur();\n });\n let mouseSel = view.inputState.mouseSelection;\n if (mouseSel) {\n mouseSel.start(event);\n return mouseSel.dragging === false;\n }\n }\n return false;\n};\nfunction rangeForClick(view, pos, bias, type) {\n if (type == 1) { // Single click\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(pos, bias);\n }\n else if (type == 2) { // Double click\n return groupAt(view.state, pos, bias);\n }\n else { // Triple click\n let visual = LineView.find(view.docView, pos), line = view.state.doc.lineAt(visual ? visual.posAtEnd : pos);\n let from = visual ? visual.posAtStart : line.from, to = visual ? visual.posAtEnd : line.to;\n if (to < view.state.doc.length && to == line.to)\n to++;\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.range(from, to);\n }\n}\nlet inside = (x, y, rect) => y >= rect.top && y <= rect.bottom && x >= rect.left && x <= rect.right;\n// Try to determine, for the given coordinates, associated with the\n// given position, whether they are related to the element before or\n// the element after the position.\nfunction findPositionSide(view, pos, x, y) {\n let line = LineView.find(view.docView, pos);\n if (!line)\n return 1;\n let off = pos - line.posAtStart;\n // Line boundaries point into the line\n if (off == 0)\n return 1;\n if (off == line.length)\n return -1;\n // Positions on top of an element point at that element\n let before = line.coordsAt(off, -1);\n if (before && inside(x, y, before))\n return -1;\n let after = line.coordsAt(off, 1);\n if (after && inside(x, y, after))\n return 1;\n // This is probably a line wrap point. Pick before if the point is\n // above its bottom.\n return before && before.bottom >= y ? -1 : 1;\n}\nfunction queryPos(view, event) {\n let pos = view.posAtCoords({ x: event.clientX, y: event.clientY }, false);\n return { pos, bias: findPositionSide(view, pos, event.clientX, event.clientY) };\n}\nconst BadMouseDetail = browser.ie && browser.ie_version <= 11;\nlet lastMouseDown = null, lastMouseDownCount = 0, lastMouseDownTime = 0;\nfunction getClickType(event) {\n if (!BadMouseDetail)\n return event.detail;\n let last = lastMouseDown, lastTime = lastMouseDownTime;\n lastMouseDown = event;\n lastMouseDownTime = Date.now();\n return lastMouseDownCount = !last || (lastTime > Date.now() - 400 && Math.abs(last.clientX - event.clientX) < 2 &&\n Math.abs(last.clientY - event.clientY) < 2) ? (lastMouseDownCount + 1) % 3 : 1;\n}\nfunction basicMouseSelection(view, event) {\n let start = queryPos(view, event), type = getClickType(event);\n let startSel = view.state.selection;\n return {\n update(update) {\n if (update.docChanged) {\n start.pos = update.changes.mapPos(start.pos);\n startSel = startSel.map(update.changes);\n }\n },\n get(event, extend, multiple) {\n let cur = queryPos(view, event), removed;\n let range = rangeForClick(view, cur.pos, cur.bias, type);\n if (start.pos != cur.pos && !extend) {\n let startRange = rangeForClick(view, start.pos, start.bias, type);\n let from = Math.min(startRange.from, range.from), to = Math.max(startRange.to, range.to);\n range = from < range.from ? _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.range(from, to) : _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.range(to, from);\n }\n if (extend)\n return startSel.replaceRange(startSel.main.extend(range.from, range.to));\n else if (multiple && type == 1 && startSel.ranges.length > 1 && (removed = removeRangeAround(startSel, cur.pos)))\n return removed;\n else if (multiple)\n return startSel.addRange(range);\n else\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.create([range]);\n }\n };\n}\nfunction removeRangeAround(sel, pos) {\n for (let i = 0; i < sel.ranges.length; i++) {\n let { from, to } = sel.ranges[i];\n if (from <= pos && to >= pos)\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.create(sel.ranges.slice(0, i).concat(sel.ranges.slice(i + 1)), sel.mainIndex == i ? 0 : sel.mainIndex - (sel.mainIndex > i ? 1 : 0));\n }\n return null;\n}\nhandlers.dragstart = (view, event) => {\n let { selection: { main: range } } = view.state;\n if (event.target.draggable) {\n let cView = view.docView.nearest(event.target);\n if (cView && cView.isWidget) {\n let from = cView.posAtStart, to = from + cView.length;\n if (from >= range.to || to <= range.from)\n range = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.range(from, to);\n }\n }\n let { inputState } = view;\n if (inputState.mouseSelection)\n inputState.mouseSelection.dragging = true;\n inputState.draggedContent = range;\n if (event.dataTransfer) {\n event.dataTransfer.setData("Text", view.state.sliceDoc(range.from, range.to));\n event.dataTransfer.effectAllowed = "copyMove";\n }\n return false;\n};\nhandlers.dragend = view => {\n view.inputState.draggedContent = null;\n return false;\n};\nfunction dropText(view, event, text, direct) {\n if (!text)\n return;\n let dropPos = view.posAtCoords({ x: event.clientX, y: event.clientY }, false);\n let { draggedContent } = view.inputState;\n let del = direct && draggedContent && dragMovesSelection(view, event)\n ? { from: draggedContent.from, to: draggedContent.to } : null;\n let ins = { from: dropPos, insert: text };\n let changes = view.state.changes(del ? [del, ins] : ins);\n view.focus();\n view.dispatch({\n changes,\n selection: { anchor: changes.mapPos(dropPos, -1), head: changes.mapPos(dropPos, 1) },\n userEvent: del ? "move.drop" : "input.drop"\n });\n view.inputState.draggedContent = null;\n}\nhandlers.drop = (view, event) => {\n if (!event.dataTransfer)\n return false;\n if (view.state.readOnly)\n return true;\n let files = event.dataTransfer.files;\n if (files && files.length) { // For a file drop, read the file\'s text.\n let text = Array(files.length), read = 0;\n let finishFile = () => {\n if (++read == files.length)\n dropText(view, event, text.filter(s => s != null).join(view.state.lineBreak), false);\n };\n for (let i = 0; i < files.length; i++) {\n let reader = new FileReader;\n reader.onerror = finishFile;\n reader.onload = () => {\n if (!/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(reader.result))\n text[i] = reader.result;\n finishFile();\n };\n reader.readAsText(files[i]);\n }\n return true;\n }\n else {\n let text = event.dataTransfer.getData("Text");\n if (text) {\n dropText(view, event, text, true);\n return true;\n }\n }\n return false;\n};\nhandlers.paste = (view, event) => {\n if (view.state.readOnly)\n return true;\n view.observer.flush();\n let data = brokenClipboardAPI ? null : event.clipboardData;\n if (data) {\n doPaste(view, data.getData("text/plain") || data.getData("text/uri-list"));\n return true;\n }\n else {\n capturePaste(view);\n return false;\n }\n};\nfunction captureCopy(view, text) {\n // The extra wrapper is somehow necessary on IE/Edge to prevent the\n // content from being mangled when it is put onto the clipboard\n let parent = view.dom.parentNode;\n if (!parent)\n return;\n let target = parent.appendChild(document.createElement("textarea"));\n target.style.cssText = "position: fixed; left: -10000px; top: 10px";\n target.value = text;\n target.focus();\n target.selectionEnd = text.length;\n target.selectionStart = 0;\n setTimeout(() => {\n target.remove();\n view.focus();\n }, 50);\n}\nfunction copiedRange(state) {\n let content = [], ranges = [], linewise = false;\n for (let range of state.selection.ranges)\n if (!range.empty) {\n content.push(state.sliceDoc(range.from, range.to));\n ranges.push(range);\n }\n if (!content.length) {\n // Nothing selected, do a line-wise copy\n let upto = -1;\n for (let { from } of state.selection.ranges) {\n let line = state.doc.lineAt(from);\n if (line.number > upto) {\n content.push(line.text);\n ranges.push({ from: line.from, to: Math.min(state.doc.length, line.to + 1) });\n }\n upto = line.number;\n }\n linewise = true;\n }\n return { text: content.join(state.lineBreak), ranges, linewise };\n}\nlet lastLinewiseCopy = null;\nhandlers.copy = handlers.cut = (view, event) => {\n let { text, ranges, linewise } = copiedRange(view.state);\n if (!text && !linewise)\n return false;\n lastLinewiseCopy = linewise ? text : null;\n if (event.type == "cut" && !view.state.readOnly)\n view.dispatch({\n changes: ranges,\n scrollIntoView: true,\n userEvent: "delete.cut"\n });\n let data = brokenClipboardAPI ? null : event.clipboardData;\n if (data) {\n data.clearData();\n data.setData("text/plain", text);\n return true;\n }\n else {\n captureCopy(view, text);\n return false;\n }\n};\nconst isFocusChange = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Annotation.define();\nfunction focusChangeTransaction(state, focus) {\n let effects = [];\n for (let getEffect of state.facet(focusChangeEffect)) {\n let effect = getEffect(state, focus);\n if (effect)\n effects.push(effect);\n }\n return effects ? state.update({ effects, annotations: isFocusChange.of(true) }) : null;\n}\nfunction updateForFocusChange(view) {\n setTimeout(() => {\n let focus = view.hasFocus;\n if (focus != view.inputState.notifiedFocused) {\n let tr = focusChangeTransaction(view.state, focus);\n if (tr)\n view.dispatch(tr);\n else\n view.update([]);\n }\n }, 10);\n}\nobservers.focus = view => {\n view.inputState.lastFocusTime = Date.now();\n // When focusing reset the scroll position, move it back to where it was\n if (!view.scrollDOM.scrollTop && (view.inputState.lastScrollTop || view.inputState.lastScrollLeft)) {\n view.scrollDOM.scrollTop = view.inputState.lastScrollTop;\n view.scrollDOM.scrollLeft = view.inputState.lastScrollLeft;\n }\n updateForFocusChange(view);\n};\nobservers.blur = view => {\n view.observer.clearSelectionRange();\n updateForFocusChange(view);\n};\nobservers.compositionstart = observers.compositionupdate = view => {\n if (view.observer.editContext)\n return; // Composition handled by edit context\n if (view.inputState.compositionFirstChange == null)\n view.inputState.compositionFirstChange = true;\n if (view.inputState.composing < 0) {\n // FIXME possibly set a timeout to clear it again on Android\n view.inputState.composing = 0;\n }\n};\nobservers.compositionend = view => {\n if (view.observer.editContext)\n return; // Composition handled by edit context\n view.inputState.composing = -1;\n view.inputState.compositionEndedAt = Date.now();\n view.inputState.compositionPendingKey = true;\n view.inputState.compositionPendingChange = view.observer.pendingRecords().length > 0;\n view.inputState.compositionFirstChange = null;\n if (browser.chrome && browser.android) {\n // Delay flushing for a bit on Android because it\'ll often fire a\n // bunch of contradictory changes in a row at end of compositon\n view.observer.flushSoon();\n }\n else if (view.inputState.compositionPendingChange) {\n // If we found pending records, schedule a flush.\n Promise.resolve().then(() => view.observer.flush());\n }\n else {\n // Otherwise, make sure that, if no changes come in soon, the\n // composition view is cleared.\n setTimeout(() => {\n if (view.inputState.composing < 0 && view.docView.hasComposition)\n view.update([]);\n }, 50);\n }\n};\nobservers.contextmenu = view => {\n view.inputState.lastContextMenu = Date.now();\n};\nhandlers.beforeinput = (view, event) => {\n var _a;\n // Because Chrome Android doesn\'t fire useful key events, use\n // beforeinput to detect backspace (and possibly enter and delete,\n // but those usually don\'t even seem to fire beforeinput events at\n // the moment) and fake a key event for it.\n //\n // (preventDefault on beforeinput, though supported in the spec,\n // seems to do nothing at all on Chrome).\n let pending;\n if (browser.chrome && browser.android && (pending = PendingKeys.find(key => key.inputType == event.inputType))) {\n view.observer.delayAndroidKey(pending.key, pending.keyCode);\n if (pending.key == "Backspace" || pending.key == "Delete") {\n let startViewHeight = ((_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height) || 0;\n setTimeout(() => {\n var _a;\n // Backspacing near uneditable nodes on Chrome Android sometimes\n // closes the virtual keyboard. This tries to crudely detect\n // that and refocus to get it back.\n if ((((_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height) || 0) > startViewHeight + 10 && view.hasFocus) {\n view.contentDOM.blur();\n view.focus();\n }\n }, 100);\n }\n }\n if (browser.ios && event.inputType == "deleteContentForward") {\n // For some reason, DOM changes (and beforeinput) happen _before_\n // the key event for ctrl-d on iOS when using an external\n // keyboard.\n view.observer.flushSoon();\n }\n // Safari will occasionally forget to fire compositionend at the end of a dead-key composition\n if (browser.safari && event.inputType == "insertText" && view.inputState.composing >= 0) {\n setTimeout(() => observers.compositionend(view, event), 20);\n }\n return false;\n};\nconst appliedFirefoxHack = /*@__PURE__*/new Set;\n// In Firefox, when cut/copy handlers are added to the document, that\n// somehow avoids a bug where those events aren\'t fired when the\n// selection is empty. See https://github.com/codemirror/dev/issues/1082\n// and https://bugzilla.mozilla.org/show_bug.cgi?id=995961\nfunction firefoxCopyCutHack(doc) {\n if (!appliedFirefoxHack.has(doc)) {\n appliedFirefoxHack.add(doc);\n doc.addEventListener("copy", () => { });\n doc.addEventListener("cut", () => { });\n }\n}\n\nconst wrappingWhiteSpace = ["pre-wrap", "normal", "pre-line", "break-spaces"];\n// Used to track, during updateHeight, if any actual heights changed\nlet heightChangeFlag = false;\nfunction clearHeightChangeFlag() { heightChangeFlag = false; }\nclass HeightOracle {\n constructor(lineWrapping) {\n this.lineWrapping = lineWrapping;\n this.doc = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.empty;\n this.heightSamples = {};\n this.lineHeight = 14; // The height of an entire line (line-height)\n this.charWidth = 7;\n this.textHeight = 14; // The height of the actual font (font-size)\n this.lineLength = 30;\n }\n heightForGap(from, to) {\n let lines = this.doc.lineAt(to).number - this.doc.lineAt(from).number + 1;\n if (this.lineWrapping)\n lines += Math.max(0, Math.ceil(((to - from) - (lines * this.lineLength * 0.5)) / this.lineLength));\n return this.lineHeight * lines;\n }\n heightForLine(length) {\n if (!this.lineWrapping)\n return this.lineHeight;\n let lines = 1 + Math.max(0, Math.ceil((length - this.lineLength) / (this.lineLength - 5)));\n return lines * this.lineHeight;\n }\n setDoc(doc) { this.doc = doc; return this; }\n mustRefreshForWrapping(whiteSpace) {\n return (wrappingWhiteSpace.indexOf(whiteSpace) > -1) != this.lineWrapping;\n }\n mustRefreshForHeights(lineHeights) {\n let newHeight = false;\n for (let i = 0; i < lineHeights.length; i++) {\n let h = lineHeights[i];\n if (h < 0) {\n i++;\n }\n else if (!this.heightSamples[Math.floor(h * 10)]) { // Round to .1 pixels\n newHeight = true;\n this.heightSamples[Math.floor(h * 10)] = true;\n }\n }\n return newHeight;\n }\n refresh(whiteSpace, lineHeight, charWidth, textHeight, lineLength, knownHeights) {\n let lineWrapping = wrappingWhiteSpace.indexOf(whiteSpace) > -1;\n let changed = Math.round(lineHeight) != Math.round(this.lineHeight) || this.lineWrapping != lineWrapping;\n this.lineWrapping = lineWrapping;\n this.lineHeight = lineHeight;\n this.charWidth = charWidth;\n this.textHeight = textHeight;\n this.lineLength = lineLength;\n if (changed) {\n this.heightSamples = {};\n for (let i = 0; i < knownHeights.length; i++) {\n let h = knownHeights[i];\n if (h < 0)\n i++;\n else\n this.heightSamples[Math.floor(h * 10)] = true;\n }\n }\n return changed;\n }\n}\n// This object is used by `updateHeight` to make DOM measurements\n// arrive at the right nides. The `heights` array is a sequence of\n// block heights, starting from position `from`.\nclass MeasuredHeights {\n constructor(from, heights) {\n this.from = from;\n this.heights = heights;\n this.index = 0;\n }\n get more() { return this.index < this.heights.length; }\n}\n/**\nRecord used to represent information about a block-level element\nin the editor view.\n*/\nclass BlockInfo {\n /**\n @internal\n */\n constructor(\n /**\n The start of the element in the document.\n */\n from, \n /**\n The length of the element.\n */\n length, \n /**\n The top position of the element (relative to the top of the\n document).\n */\n top, \n /**\n Its height.\n */\n height, \n /**\n @internal Weird packed field that holds an array of children\n for composite blocks, a decoration for block widgets, and a\n number indicating the amount of widget-create line breaks for\n text blocks.\n */\n _content) {\n this.from = from;\n this.length = length;\n this.top = top;\n this.height = height;\n this._content = _content;\n }\n /**\n The type of element this is. When querying lines, this may be\n an array of all the blocks that make up the line.\n */\n get type() {\n return typeof this._content == "number" ? BlockType.Text :\n Array.isArray(this._content) ? this._content : this._content.type;\n }\n /**\n The end of the element as a document position.\n */\n get to() { return this.from + this.length; }\n /**\n The bottom position of the element.\n */\n get bottom() { return this.top + this.height; }\n /**\n If this is a widget block, this will return the widget\n associated with it.\n */\n get widget() {\n return this._content instanceof PointDecoration ? this._content.widget : null;\n }\n /**\n If this is a textblock, this holds the number of line breaks\n that appear in widgets inside the block.\n */\n get widgetLineBreaks() {\n return typeof this._content == "number" ? this._content : 0;\n }\n /**\n @internal\n */\n join(other) {\n let content = (Array.isArray(this._content) ? this._content : [this])\n .concat(Array.isArray(other._content) ? other._content : [other]);\n return new BlockInfo(this.from, this.length + other.length, this.top, this.height + other.height, content);\n }\n}\nvar QueryType = /*@__PURE__*/(function (QueryType) {\n QueryType[QueryType["ByPos"] = 0] = "ByPos";\n QueryType[QueryType["ByHeight"] = 1] = "ByHeight";\n QueryType[QueryType["ByPosNoHeight"] = 2] = "ByPosNoHeight";\nreturn QueryType})(QueryType || (QueryType = {}));\nconst Epsilon = 1e-3;\nclass HeightMap {\n constructor(length, // The number of characters covered\n height, // Height of this part of the document\n flags = 2 /* Flag.Outdated */) {\n this.length = length;\n this.height = height;\n this.flags = flags;\n }\n get outdated() { return (this.flags & 2 /* Flag.Outdated */) > 0; }\n set outdated(value) { this.flags = (value ? 2 /* Flag.Outdated */ : 0) | (this.flags & ~2 /* Flag.Outdated */); }\n setHeight(height) {\n if (this.height != height) {\n if (Math.abs(this.height - height) > Epsilon)\n heightChangeFlag = true;\n this.height = height;\n }\n }\n // Base case is to replace a leaf node, which simply builds a tree\n // from the new nodes and returns that (HeightMapBranch and\n // HeightMapGap override this to actually use from/to)\n replace(_from, _to, nodes) {\n return HeightMap.of(nodes);\n }\n // Again, these are base cases, and are overridden for branch and gap nodes.\n decomposeLeft(_to, result) { result.push(this); }\n decomposeRight(_from, result) { result.push(this); }\n applyChanges(decorations, oldDoc, oracle, changes) {\n let me = this, doc = oracle.doc;\n for (let i = changes.length - 1; i >= 0; i--) {\n let { fromA, toA, fromB, toB } = changes[i];\n let start = me.lineAt(fromA, QueryType.ByPosNoHeight, oracle.setDoc(oldDoc), 0, 0);\n let end = start.to >= toA ? start : me.lineAt(toA, QueryType.ByPosNoHeight, oracle, 0, 0);\n toB += end.to - toA;\n toA = end.to;\n while (i > 0 && start.from <= changes[i - 1].toA) {\n fromA = changes[i - 1].fromA;\n fromB = changes[i - 1].fromB;\n i--;\n if (fromA < start.from)\n start = me.lineAt(fromA, QueryType.ByPosNoHeight, oracle, 0, 0);\n }\n fromB += start.from - fromA;\n fromA = start.from;\n let nodes = NodeBuilder.build(oracle.setDoc(doc), decorations, fromB, toB);\n me = replace(me, me.replace(fromA, toA, nodes));\n }\n return me.updateHeight(oracle, 0);\n }\n static empty() { return new HeightMapText(0, 0); }\n // nodes uses null values to indicate the position of line breaks.\n // There are never line breaks at the start or end of the array, or\n // two line breaks next to each other, and the array isn\'t allowed\n // to be empty (same restrictions as return value from the builder).\n static of(nodes) {\n if (nodes.length == 1)\n return nodes[0];\n let i = 0, j = nodes.length, before = 0, after = 0;\n for (;;) {\n if (i == j) {\n if (before > after * 2) {\n let split = nodes[i - 1];\n if (split.break)\n nodes.splice(--i, 1, split.left, null, split.right);\n else\n nodes.splice(--i, 1, split.left, split.right);\n j += 1 + split.break;\n before -= split.size;\n }\n else if (after > before * 2) {\n let split = nodes[j];\n if (split.break)\n nodes.splice(j, 1, split.left, null, split.right);\n else\n nodes.splice(j, 1, split.left, split.right);\n j += 2 + split.break;\n after -= split.size;\n }\n else {\n break;\n }\n }\n else if (before < after) {\n let next = nodes[i++];\n if (next)\n before += next.size;\n }\n else {\n let next = nodes[--j];\n if (next)\n after += next.size;\n }\n }\n let brk = 0;\n if (nodes[i - 1] == null) {\n brk = 1;\n i--;\n }\n else if (nodes[i] == null) {\n brk = 1;\n j++;\n }\n return new HeightMapBranch(HeightMap.of(nodes.slice(0, i)), brk, HeightMap.of(nodes.slice(j)));\n }\n}\nfunction replace(old, val) {\n if (old == val)\n return old;\n if (old.constructor != val.constructor)\n heightChangeFlag = true;\n return val;\n}\nHeightMap.prototype.size = 1;\nclass HeightMapBlock extends HeightMap {\n constructor(length, height, deco) {\n super(length, height);\n this.deco = deco;\n }\n blockAt(_height, _oracle, top, offset) {\n return new BlockInfo(offset, this.length, top, this.height, this.deco || 0);\n }\n lineAt(_value, _type, oracle, top, offset) {\n return this.blockAt(0, oracle, top, offset);\n }\n forEachLine(from, to, oracle, top, offset, f) {\n if (from <= offset + this.length && to >= offset)\n f(this.blockAt(0, oracle, top, offset));\n }\n updateHeight(oracle, offset = 0, _force = false, measured) {\n if (measured && measured.from <= offset && measured.more)\n this.setHeight(measured.heights[measured.index++]);\n this.outdated = false;\n return this;\n }\n toString() { return `block(${this.length})`; }\n}\nclass HeightMapText extends HeightMapBlock {\n constructor(length, height) {\n super(length, height, null);\n this.collapsed = 0; // Amount of collapsed content in the line\n this.widgetHeight = 0; // Maximum inline widget height\n this.breaks = 0; // Number of widget-introduced line breaks on the line\n }\n blockAt(_height, _oracle, top, offset) {\n return new BlockInfo(offset, this.length, top, this.height, this.breaks);\n }\n replace(_from, _to, nodes) {\n let node = nodes[0];\n if (nodes.length == 1 && (node instanceof HeightMapText || node instanceof HeightMapGap && (node.flags & 4 /* Flag.SingleLine */)) &&\n Math.abs(this.length - node.length) < 10) {\n if (node instanceof HeightMapGap)\n node = new HeightMapText(node.length, this.height);\n else\n node.height = this.height;\n if (!this.outdated)\n node.outdated = false;\n return node;\n }\n else {\n return HeightMap.of(nodes);\n }\n }\n updateHeight(oracle, offset = 0, force = false, measured) {\n if (measured && measured.from <= offset && measured.more)\n this.setHeight(measured.heights[measured.index++]);\n else if (force || this.outdated)\n this.setHeight(Math.max(this.widgetHeight, oracle.heightForLine(this.length - this.collapsed)) +\n this.breaks * oracle.lineHeight);\n this.outdated = false;\n return this;\n }\n toString() {\n return `line(${this.length}${this.collapsed ? -this.collapsed : ""}${this.widgetHeight ? ":" + this.widgetHeight : ""})`;\n }\n}\nclass HeightMapGap extends HeightMap {\n constructor(length) { super(length, 0); }\n heightMetrics(oracle, offset) {\n let firstLine = oracle.doc.lineAt(offset).number, lastLine = oracle.doc.lineAt(offset + this.length).number;\n let lines = lastLine - firstLine + 1;\n let perLine, perChar = 0;\n if (oracle.lineWrapping) {\n let totalPerLine = Math.min(this.height, oracle.lineHeight * lines);\n perLine = totalPerLine / lines;\n if (this.length > lines + 1)\n perChar = (this.height - totalPerLine) / (this.length - lines - 1);\n }\n else {\n perLine = this.height / lines;\n }\n return { firstLine, lastLine, perLine, perChar };\n }\n blockAt(height, oracle, top, offset) {\n let { firstLine, lastLine, perLine, perChar } = this.heightMetrics(oracle, offset);\n if (oracle.lineWrapping) {\n let guess = offset + (height < oracle.lineHeight ? 0\n : Math.round(Math.max(0, Math.min(1, (height - top) / this.height)) * this.length));\n let line = oracle.doc.lineAt(guess), lineHeight = perLine + line.length * perChar;\n let lineTop = Math.max(top, height - lineHeight / 2);\n return new BlockInfo(line.from, line.length, lineTop, lineHeight, 0);\n }\n else {\n let line = Math.max(0, Math.min(lastLine - firstLine, Math.floor((height - top) / perLine)));\n let { from, length } = oracle.doc.line(firstLine + line);\n return new BlockInfo(from, length, top + perLine * line, perLine, 0);\n }\n }\n lineAt(value, type, oracle, top, offset) {\n if (type == QueryType.ByHeight)\n return this.blockAt(value, oracle, top, offset);\n if (type == QueryType.ByPosNoHeight) {\n let { from, to } = oracle.doc.lineAt(value);\n return new BlockInfo(from, to - from, 0, 0, 0);\n }\n let { firstLine, perLine, perChar } = this.heightMetrics(oracle, offset);\n let line = oracle.doc.lineAt(value), lineHeight = perLine + line.length * perChar;\n let linesAbove = line.number - firstLine;\n let lineTop = top + perLine * linesAbove + perChar * (line.from - offset - linesAbove);\n return new BlockInfo(line.from, line.length, Math.max(top, Math.min(lineTop, top + this.height - lineHeight)), lineHeight, 0);\n }\n forEachLine(from, to, oracle, top, offset, f) {\n from = Math.max(from, offset);\n to = Math.min(to, offset + this.length);\n let { firstLine, perLine, perChar } = this.heightMetrics(oracle, offset);\n for (let pos = from, lineTop = top; pos <= to;) {\n let line = oracle.doc.lineAt(pos);\n if (pos == from) {\n let linesAbove = line.number - firstLine;\n lineTop += perLine * linesAbove + perChar * (from - offset - linesAbove);\n }\n let lineHeight = perLine + perChar * line.length;\n f(new BlockInfo(line.from, line.length, lineTop, lineHeight, 0));\n lineTop += lineHeight;\n pos = line.to + 1;\n }\n }\n replace(from, to, nodes) {\n let after = this.length - to;\n if (after > 0) {\n let last = nodes[nodes.length - 1];\n if (last instanceof HeightMapGap)\n nodes[nodes.length - 1] = new HeightMapGap(last.length + after);\n else\n nodes.push(null, new HeightMapGap(after - 1));\n }\n if (from > 0) {\n let first = nodes[0];\n if (first instanceof HeightMapGap)\n nodes[0] = new HeightMapGap(from + first.length);\n else\n nodes.unshift(new HeightMapGap(from - 1), null);\n }\n return HeightMap.of(nodes);\n }\n decomposeLeft(to, result) {\n result.push(new HeightMapGap(to - 1), null);\n }\n decomposeRight(from, result) {\n result.push(null, new HeightMapGap(this.length - from - 1));\n }\n updateHeight(oracle, offset = 0, force = false, measured) {\n let end = offset + this.length;\n if (measured && measured.from <= offset + this.length && measured.more) {\n // Fill in part of this gap with measured lines. We know there\n // can\'t be widgets or collapsed ranges in those lines, because\n // they would already have been added to the heightmap (gaps\n // only contain plain text).\n let nodes = [], pos = Math.max(offset, measured.from), singleHeight = -1;\n if (measured.from > offset)\n nodes.push(new HeightMapGap(measured.from - offset - 1).updateHeight(oracle, offset));\n while (pos <= end && measured.more) {\n let len = oracle.doc.lineAt(pos).length;\n if (nodes.length)\n nodes.push(null);\n let height = measured.heights[measured.index++];\n if (singleHeight == -1)\n singleHeight = height;\n else if (Math.abs(height - singleHeight) >= Epsilon)\n singleHeight = -2;\n let line = new HeightMapText(len, height);\n line.outdated = false;\n nodes.push(line);\n pos += len + 1;\n }\n if (pos <= end)\n nodes.push(null, new HeightMapGap(end - pos).updateHeight(oracle, pos));\n let result = HeightMap.of(nodes);\n if (singleHeight < 0 || Math.abs(result.height - this.height) >= Epsilon ||\n Math.abs(singleHeight - this.heightMetrics(oracle, offset).perLine) >= Epsilon)\n heightChangeFlag = true;\n return replace(this, result);\n }\n else if (force || this.outdated) {\n this.setHeight(oracle.heightForGap(offset, offset + this.length));\n this.outdated = false;\n }\n return this;\n }\n toString() { return `gap(${this.length})`; }\n}\nclass HeightMapBranch extends HeightMap {\n constructor(left, brk, right) {\n super(left.length + brk + right.length, left.height + right.height, brk | (left.outdated || right.outdated ? 2 /* Flag.Outdated */ : 0));\n this.left = left;\n this.right = right;\n this.size = left.size + right.size;\n }\n get break() { return this.flags & 1 /* Flag.Break */; }\n blockAt(height, oracle, top, offset) {\n let mid = top + this.left.height;\n return height < mid ? this.left.blockAt(height, oracle, top, offset)\n : this.right.blockAt(height, oracle, mid, offset + this.left.length + this.break);\n }\n lineAt(value, type, oracle, top, offset) {\n let rightTop = top + this.left.height, rightOffset = offset + this.left.length + this.break;\n let left = type == QueryType.ByHeight ? value < rightTop : value < rightOffset;\n let base = left ? this.left.lineAt(value, type, oracle, top, offset)\n : this.right.lineAt(value, type, oracle, rightTop, rightOffset);\n if (this.break || (left ? base.to < rightOffset : base.from > rightOffset))\n return base;\n let subQuery = type == QueryType.ByPosNoHeight ? QueryType.ByPosNoHeight : QueryType.ByPos;\n if (left)\n return base.join(this.right.lineAt(rightOffset, subQuery, oracle, rightTop, rightOffset));\n else\n return this.left.lineAt(rightOffset, subQuery, oracle, top, offset).join(base);\n }\n forEachLine(from, to, oracle, top, offset, f) {\n let rightTop = top + this.left.height, rightOffset = offset + this.left.length + this.break;\n if (this.break) {\n if (from < rightOffset)\n this.left.forEachLine(from, to, oracle, top, offset, f);\n if (to >= rightOffset)\n this.right.forEachLine(from, to, oracle, rightTop, rightOffset, f);\n }\n else {\n let mid = this.lineAt(rightOffset, QueryType.ByPos, oracle, top, offset);\n if (from < mid.from)\n this.left.forEachLine(from, mid.from - 1, oracle, top, offset, f);\n if (mid.to >= from && mid.from <= to)\n f(mid);\n if (to > mid.to)\n this.right.forEachLine(mid.to + 1, to, oracle, rightTop, rightOffset, f);\n }\n }\n replace(from, to, nodes) {\n let rightStart = this.left.length + this.break;\n if (to < rightStart)\n return this.balanced(this.left.replace(from, to, nodes), this.right);\n if (from > this.left.length)\n return this.balanced(this.left, this.right.replace(from - rightStart, to - rightStart, nodes));\n let result = [];\n if (from > 0)\n this.decomposeLeft(from, result);\n let left = result.length;\n for (let node of nodes)\n result.push(node);\n if (from > 0)\n mergeGaps(result, left - 1);\n if (to < this.length) {\n let right = result.length;\n this.decomposeRight(to, result);\n mergeGaps(result, right);\n }\n return HeightMap.of(result);\n }\n decomposeLeft(to, result) {\n let left = this.left.length;\n if (to <= left)\n return this.left.decomposeLeft(to, result);\n result.push(this.left);\n if (this.break) {\n left++;\n if (to >= left)\n result.push(null);\n }\n if (to > left)\n this.right.decomposeLeft(to - left, result);\n }\n decomposeRight(from, result) {\n let left = this.left.length, right = left + this.break;\n if (from >= right)\n return this.right.decomposeRight(from - right, result);\n if (from < left)\n this.left.decomposeRight(from, result);\n if (this.break && from < right)\n result.push(null);\n result.push(this.right);\n }\n balanced(left, right) {\n if (left.size > 2 * right.size || right.size > 2 * left.size)\n return HeightMap.of(this.break ? [left, null, right] : [left, right]);\n this.left = replace(this.left, left);\n this.right = replace(this.right, right);\n this.setHeight(left.height + right.height);\n this.outdated = left.outdated || right.outdated;\n this.size = left.size + right.size;\n this.length = left.length + this.break + right.length;\n return this;\n }\n updateHeight(oracle, offset = 0, force = false, measured) {\n let { left, right } = this, rightStart = offset + left.length + this.break, rebalance = null;\n if (measured && measured.from <= offset + left.length && measured.more)\n rebalance = left = left.updateHeight(oracle, offset, force, measured);\n else\n left.updateHeight(oracle, offset, force);\n if (measured && measured.from <= rightStart + right.length && measured.more)\n rebalance = right = right.updateHeight(oracle, rightStart, force, measured);\n else\n right.updateHeight(oracle, rightStart, force);\n if (rebalance)\n return this.balanced(left, right);\n this.height = this.left.height + this.right.height;\n this.outdated = false;\n return this;\n }\n toString() { return this.left + (this.break ? " " : "-") + this.right; }\n}\nfunction mergeGaps(nodes, around) {\n let before, after;\n if (nodes[around] == null &&\n (before = nodes[around - 1]) instanceof HeightMapGap &&\n (after = nodes[around + 1]) instanceof HeightMapGap)\n nodes.splice(around - 1, 3, new HeightMapGap(before.length + 1 + after.length));\n}\nconst relevantWidgetHeight = 5;\nclass NodeBuilder {\n constructor(pos, oracle) {\n this.pos = pos;\n this.oracle = oracle;\n this.nodes = [];\n this.lineStart = -1;\n this.lineEnd = -1;\n this.covering = null;\n this.writtenTo = pos;\n }\n get isCovered() {\n return this.covering && this.nodes[this.nodes.length - 1] == this.covering;\n }\n span(_from, to) {\n if (this.lineStart > -1) {\n let end = Math.min(to, this.lineEnd), last = this.nodes[this.nodes.length - 1];\n if (last instanceof HeightMapText)\n last.length += end - this.pos;\n else if (end > this.pos || !this.isCovered)\n this.nodes.push(new HeightMapText(end - this.pos, -1));\n this.writtenTo = end;\n if (to > end) {\n this.nodes.push(null);\n this.writtenTo++;\n this.lineStart = -1;\n }\n }\n this.pos = to;\n }\n point(from, to, deco) {\n if (from < to || deco.heightRelevant) {\n let height = deco.widget ? deco.widget.estimatedHeight : 0;\n let breaks = deco.widget ? deco.widget.lineBreaks : 0;\n if (height < 0)\n height = this.oracle.lineHeight;\n let len = to - from;\n if (deco.block) {\n this.addBlock(new HeightMapBlock(len, height, deco));\n }\n else if (len || breaks || height >= relevantWidgetHeight) {\n this.addLineDeco(height, breaks, len);\n }\n }\n else if (to > from) {\n this.span(from, to);\n }\n if (this.lineEnd > -1 && this.lineEnd < this.pos)\n this.lineEnd = this.oracle.doc.lineAt(this.pos).to;\n }\n enterLine() {\n if (this.lineStart > -1)\n return;\n let { from, to } = this.oracle.doc.lineAt(this.pos);\n this.lineStart = from;\n this.lineEnd = to;\n if (this.writtenTo < from) {\n if (this.writtenTo < from - 1 || this.nodes[this.nodes.length - 1] == null)\n this.nodes.push(this.blankContent(this.writtenTo, from - 1));\n this.nodes.push(null);\n }\n if (this.pos > from)\n this.nodes.push(new HeightMapText(this.pos - from, -1));\n this.writtenTo = this.pos;\n }\n blankContent(from, to) {\n let gap = new HeightMapGap(to - from);\n if (this.oracle.doc.lineAt(from).to == to)\n gap.flags |= 4 /* Flag.SingleLine */;\n return gap;\n }\n ensureLine() {\n this.enterLine();\n let last = this.nodes.length ? this.nodes[this.nodes.length - 1] : null;\n if (last instanceof HeightMapText)\n return last;\n let line = new HeightMapText(0, -1);\n this.nodes.push(line);\n return line;\n }\n addBlock(block) {\n this.enterLine();\n let deco = block.deco;\n if (deco && deco.startSide > 0 && !this.isCovered)\n this.ensureLine();\n this.nodes.push(block);\n this.writtenTo = this.pos = this.pos + block.length;\n if (deco && deco.endSide > 0)\n this.covering = block;\n }\n addLineDeco(height, breaks, length) {\n let line = this.ensureLine();\n line.length += length;\n line.collapsed += length;\n line.widgetHeight = Math.max(line.widgetHeight, height);\n line.breaks += breaks;\n this.writtenTo = this.pos = this.pos + length;\n }\n finish(from) {\n let last = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1];\n if (this.lineStart > -1 && !(last instanceof HeightMapText) && !this.isCovered)\n this.nodes.push(new HeightMapText(0, -1));\n else if (this.writtenTo < this.pos || last == null)\n this.nodes.push(this.blankContent(this.writtenTo, this.pos));\n let pos = from;\n for (let node of this.nodes) {\n if (node instanceof HeightMapText)\n node.updateHeight(this.oracle, pos);\n pos += node ? node.length : 1;\n }\n return this.nodes;\n }\n // Always called with a region that on both sides either stretches\n // to a line break or the end of the document.\n // The returned array uses null to indicate line breaks, but never\n // starts or ends in a line break, or has multiple line breaks next\n // to each other.\n static build(oracle, decorations, from, to) {\n let builder = new NodeBuilder(from, oracle);\n _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.spans(decorations, from, to, builder, 0);\n return builder.finish(from);\n }\n}\nfunction heightRelevantDecoChanges(a, b, diff) {\n let comp = new DecorationComparator;\n _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.compare(a, b, diff, comp, 0);\n return comp.changes;\n}\nclass DecorationComparator {\n constructor() {\n this.changes = [];\n }\n compareRange() { }\n comparePoint(from, to, a, b) {\n if (from < to || a && a.heightRelevant || b && b.heightRelevant)\n addRange(from, to, this.changes, 5);\n }\n}\n\nfunction visiblePixelRange(dom, paddingTop) {\n let rect = dom.getBoundingClientRect();\n let doc = dom.ownerDocument, win = doc.defaultView || window;\n let left = Math.max(0, rect.left), right = Math.min(win.innerWidth, rect.right);\n let top = Math.max(0, rect.top), bottom = Math.min(win.innerHeight, rect.bottom);\n for (let parent = dom.parentNode; parent && parent != doc.body;) {\n if (parent.nodeType == 1) {\n let elt = parent;\n let style = window.getComputedStyle(elt);\n if ((elt.scrollHeight > elt.clientHeight || elt.scrollWidth > elt.clientWidth) &&\n style.overflow != "visible") {\n let parentRect = elt.getBoundingClientRect();\n left = Math.max(left, parentRect.left);\n right = Math.min(right, parentRect.right);\n top = Math.max(top, parentRect.top);\n bottom = parent == dom.parentNode ? parentRect.bottom : Math.min(bottom, parentRect.bottom);\n }\n parent = style.position == "absolute" || style.position == "fixed" ? elt.offsetParent : elt.parentNode;\n }\n else if (parent.nodeType == 11) { // Shadow root\n parent = parent.host;\n }\n else {\n break;\n }\n }\n return { left: left - rect.left, right: Math.max(left, right) - rect.left,\n top: top - (rect.top + paddingTop), bottom: Math.max(top, bottom) - (rect.top + paddingTop) };\n}\nfunction fullPixelRange(dom, paddingTop) {\n let rect = dom.getBoundingClientRect();\n return { left: 0, right: rect.right - rect.left,\n top: paddingTop, bottom: rect.bottom - (rect.top + paddingTop) };\n}\n// Line gaps are placeholder widgets used to hide pieces of overlong\n// lines within the viewport, as a kludge to keep the editor\n// responsive when a ridiculously long line is loaded into it.\nclass LineGap {\n constructor(from, to, size) {\n this.from = from;\n this.to = to;\n this.size = size;\n }\n static same(a, b) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++) {\n let gA = a[i], gB = b[i];\n if (gA.from != gB.from || gA.to != gB.to || gA.size != gB.size)\n return false;\n }\n return true;\n }\n draw(viewState, wrapping) {\n return Decoration.replace({\n widget: new LineGapWidget(this.size * (wrapping ? viewState.scaleY : viewState.scaleX), wrapping)\n }).range(this.from, this.to);\n }\n}\nclass LineGapWidget extends WidgetType {\n constructor(size, vertical) {\n super();\n this.size = size;\n this.vertical = vertical;\n }\n eq(other) { return other.size == this.size && other.vertical == this.vertical; }\n toDOM() {\n let elt = document.createElement("div");\n if (this.vertical) {\n elt.style.height = this.size + "px";\n }\n else {\n elt.style.width = this.size + "px";\n elt.style.height = "2px";\n elt.style.display = "inline-block";\n }\n return elt;\n }\n get estimatedHeight() { return this.vertical ? this.size : -1; }\n}\nclass ViewState {\n constructor(state) {\n this.state = state;\n // These are contentDOM-local coordinates\n this.pixelViewport = { left: 0, right: window.innerWidth, top: 0, bottom: 0 };\n this.inView = true;\n this.paddingTop = 0; // Padding above the document, scaled\n this.paddingBottom = 0; // Padding below the document, scaled\n this.contentDOMWidth = 0; // contentDOM.getBoundingClientRect().width\n this.contentDOMHeight = 0; // contentDOM.getBoundingClientRect().height\n this.editorHeight = 0; // scrollDOM.clientHeight, unscaled\n this.editorWidth = 0; // scrollDOM.clientWidth, unscaled\n this.scrollTop = 0; // Last seen scrollDOM.scrollTop, scaled\n this.scrolledToBottom = false;\n // The CSS-transformation scale of the editor (transformed size /\n // concrete size)\n this.scaleX = 1;\n this.scaleY = 1;\n // The vertical position (document-relative) to which to anchor the\n // scroll position. -1 means anchor to the end of the document.\n this.scrollAnchorPos = 0;\n // The height at the anchor position. Set by the DOM update phase.\n // -1 means no height available.\n this.scrollAnchorHeight = -1;\n // See VP.MaxDOMHeight\n this.scaler = IdScaler;\n this.scrollTarget = null;\n // Briefly set to true when printing, to disable viewport limiting\n this.printing = false;\n // Flag set when editor content was redrawn, so that the next\n // measure stage knows it must read DOM layout\n this.mustMeasureContent = true;\n this.defaultTextDirection = Direction.LTR;\n this.visibleRanges = [];\n // Cursor \'assoc\' is only significant when the cursor is on a line\n // wrap point, where it must stick to the character that it is\n // associated with. Since browsers don\'t provide a reasonable\n // interface to set or query this, when a selection is set that\n // might cause this to be significant, this flag is set. The next\n // measure phase will check whether the cursor is on a line-wrapping\n // boundary and, if so, reset it to make sure it is positioned in\n // the right place.\n this.mustEnforceCursorAssoc = false;\n let guessWrapping = state.facet(contentAttributes).some(v => typeof v != "function" && v.class == "cm-lineWrapping");\n this.heightOracle = new HeightOracle(guessWrapping);\n this.stateDeco = state.facet(decorations).filter(d => typeof d != "function");\n this.heightMap = HeightMap.empty().applyChanges(this.stateDeco, _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.empty, this.heightOracle.setDoc(state.doc), [new ChangedRange(0, 0, 0, state.doc.length)]);\n for (let i = 0; i < 2; i++) {\n this.viewport = this.getViewport(0, null);\n if (!this.updateForViewport())\n break;\n }\n this.updateViewportLines();\n this.lineGaps = this.ensureLineGaps([]);\n this.lineGapDeco = Decoration.set(this.lineGaps.map(gap => gap.draw(this, false)));\n this.computeVisibleRanges();\n }\n updateForViewport() {\n let viewports = [this.viewport], { main } = this.state.selection;\n for (let i = 0; i <= 1; i++) {\n let pos = i ? main.head : main.anchor;\n if (!viewports.some(({ from, to }) => pos >= from && pos <= to)) {\n let { from, to } = this.lineBlockAt(pos);\n viewports.push(new Viewport(from, to));\n }\n }\n this.viewports = viewports.sort((a, b) => a.from - b.from);\n return this.updateScaler();\n }\n updateScaler() {\n let scaler = this.scaler;\n this.scaler = this.heightMap.height <= 7000000 /* VP.MaxDOMHeight */ ? IdScaler :\n new BigScaler(this.heightOracle, this.heightMap, this.viewports);\n return scaler.eq(this.scaler) ? 0 : 2 /* UpdateFlag.Height */;\n }\n updateViewportLines() {\n this.viewportLines = [];\n this.heightMap.forEachLine(this.viewport.from, this.viewport.to, this.heightOracle.setDoc(this.state.doc), 0, 0, block => {\n this.viewportLines.push(scaleBlock(block, this.scaler));\n });\n }\n update(update, scrollTarget = null) {\n this.state = update.state;\n let prevDeco = this.stateDeco;\n this.stateDeco = this.state.facet(decorations).filter(d => typeof d != "function");\n let contentChanges = update.changedRanges;\n let heightChanges = ChangedRange.extendWithRanges(contentChanges, heightRelevantDecoChanges(prevDeco, this.stateDeco, update ? update.changes : _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.ChangeSet.empty(this.state.doc.length)));\n let prevHeight = this.heightMap.height;\n let scrollAnchor = this.scrolledToBottom ? null : this.scrollAnchorAt(this.scrollTop);\n clearHeightChangeFlag();\n this.heightMap = this.heightMap.applyChanges(this.stateDeco, update.startState.doc, this.heightOracle.setDoc(this.state.doc), heightChanges);\n if (this.heightMap.height != prevHeight || heightChangeFlag)\n update.flags |= 2 /* UpdateFlag.Height */;\n if (scrollAnchor) {\n this.scrollAnchorPos = update.changes.mapPos(scrollAnchor.from, -1);\n this.scrollAnchorHeight = scrollAnchor.top;\n }\n else {\n this.scrollAnchorPos = -1;\n this.scrollAnchorHeight = this.heightMap.height;\n }\n let viewport = heightChanges.length ? this.mapViewport(this.viewport, update.changes) : this.viewport;\n if (scrollTarget && (scrollTarget.range.head < viewport.from || scrollTarget.range.head > viewport.to) ||\n !this.viewportIsAppropriate(viewport))\n viewport = this.getViewport(0, scrollTarget);\n let viewportChange = viewport.from != this.viewport.from || viewport.to != this.viewport.to;\n this.viewport = viewport;\n update.flags |= this.updateForViewport();\n if (viewportChange || !update.changes.empty || (update.flags & 2 /* UpdateFlag.Height */))\n this.updateViewportLines();\n if (this.lineGaps.length || this.viewport.to - this.viewport.from > (2000 /* LG.Margin */ << 1))\n this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps, update.changes)));\n update.flags |= this.computeVisibleRanges();\n if (scrollTarget)\n this.scrollTarget = scrollTarget;\n if (!this.mustEnforceCursorAssoc && update.selectionSet && update.view.lineWrapping &&\n update.state.selection.main.empty && update.state.selection.main.assoc &&\n !update.state.facet(nativeSelectionHidden))\n this.mustEnforceCursorAssoc = true;\n }\n measure(view) {\n let dom = view.contentDOM, style = window.getComputedStyle(dom);\n let oracle = this.heightOracle;\n let whiteSpace = style.whiteSpace;\n this.defaultTextDirection = style.direction == "rtl" ? Direction.RTL : Direction.LTR;\n let refresh = this.heightOracle.mustRefreshForWrapping(whiteSpace);\n let domRect = dom.getBoundingClientRect();\n let measureContent = refresh || this.mustMeasureContent || this.contentDOMHeight != domRect.height;\n this.contentDOMHeight = domRect.height;\n this.mustMeasureContent = false;\n let result = 0, bias = 0;\n if (domRect.width && domRect.height) {\n let { scaleX, scaleY } = getScale(dom, domRect);\n if (scaleX > .005 && Math.abs(this.scaleX - scaleX) > .005 ||\n scaleY > .005 && Math.abs(this.scaleY - scaleY) > .005) {\n this.scaleX = scaleX;\n this.scaleY = scaleY;\n result |= 8 /* UpdateFlag.Geometry */;\n refresh = measureContent = true;\n }\n }\n // Vertical padding\n let paddingTop = (parseInt(style.paddingTop) || 0) * this.scaleY;\n let paddingBottom = (parseInt(style.paddingBottom) || 0) * this.scaleY;\n if (this.paddingTop != paddingTop || this.paddingBottom != paddingBottom) {\n this.paddingTop = paddingTop;\n this.paddingBottom = paddingBottom;\n result |= 8 /* UpdateFlag.Geometry */ | 2 /* UpdateFlag.Height */;\n }\n if (this.editorWidth != view.scrollDOM.clientWidth) {\n if (oracle.lineWrapping)\n measureContent = true;\n this.editorWidth = view.scrollDOM.clientWidth;\n result |= 8 /* UpdateFlag.Geometry */;\n }\n let scrollTop = view.scrollDOM.scrollTop * this.scaleY;\n if (this.scrollTop != scrollTop) {\n this.scrollAnchorHeight = -1;\n this.scrollTop = scrollTop;\n }\n this.scrolledToBottom = isScrolledToBottom(view.scrollDOM);\n // Pixel viewport\n let pixelViewport = (this.printing ? fullPixelRange : visiblePixelRange)(dom, this.paddingTop);\n let dTop = pixelViewport.top - this.pixelViewport.top, dBottom = pixelViewport.bottom - this.pixelViewport.bottom;\n this.pixelViewport = pixelViewport;\n let inView = this.pixelViewport.bottom > this.pixelViewport.top && this.pixelViewport.right > this.pixelViewport.left;\n if (inView != this.inView) {\n this.inView = inView;\n if (inView)\n measureContent = true;\n }\n if (!this.inView && !this.scrollTarget)\n return 0;\n let contentWidth = domRect.width;\n if (this.contentDOMWidth != contentWidth || this.editorHeight != view.scrollDOM.clientHeight) {\n this.contentDOMWidth = domRect.width;\n this.editorHeight = view.scrollDOM.clientHeight;\n result |= 8 /* UpdateFlag.Geometry */;\n }\n if (measureContent) {\n let lineHeights = view.docView.measureVisibleLineHeights(this.viewport);\n if (oracle.mustRefreshForHeights(lineHeights))\n refresh = true;\n if (refresh || oracle.lineWrapping && Math.abs(contentWidth - this.contentDOMWidth) > oracle.charWidth) {\n let { lineHeight, charWidth, textHeight } = view.docView.measureTextSize();\n refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, textHeight, contentWidth / charWidth, lineHeights);\n if (refresh) {\n view.docView.minWidth = 0;\n result |= 8 /* UpdateFlag.Geometry */;\n }\n }\n if (dTop > 0 && dBottom > 0)\n bias = Math.max(dTop, dBottom);\n else if (dTop < 0 && dBottom < 0)\n bias = Math.min(dTop, dBottom);\n clearHeightChangeFlag();\n for (let vp of this.viewports) {\n let heights = vp.from == this.viewport.from ? lineHeights : view.docView.measureVisibleLineHeights(vp);\n this.heightMap = (refresh ? HeightMap.empty().applyChanges(this.stateDeco, _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.empty, this.heightOracle, [new ChangedRange(0, 0, 0, view.state.doc.length)]) : this.heightMap).updateHeight(oracle, 0, refresh, new MeasuredHeights(vp.from, heights));\n }\n if (heightChangeFlag)\n result |= 2 /* UpdateFlag.Height */;\n }\n let viewportChange = !this.viewportIsAppropriate(this.viewport, bias) ||\n this.scrollTarget && (this.scrollTarget.range.head < this.viewport.from ||\n this.scrollTarget.range.head > this.viewport.to);\n if (viewportChange) {\n if (result & 2 /* UpdateFlag.Height */)\n result |= this.updateScaler();\n this.viewport = this.getViewport(bias, this.scrollTarget);\n result |= this.updateForViewport();\n }\n if ((result & 2 /* UpdateFlag.Height */) || viewportChange)\n this.updateViewportLines();\n if (this.lineGaps.length || this.viewport.to - this.viewport.from > (2000 /* LG.Margin */ << 1))\n this.updateLineGaps(this.ensureLineGaps(refresh ? [] : this.lineGaps, view));\n result |= this.computeVisibleRanges();\n if (this.mustEnforceCursorAssoc) {\n this.mustEnforceCursorAssoc = false;\n // This is done in the read stage, because moving the selection\n // to a line end is going to trigger a layout anyway, so it\n // can\'t be a pure write. It should be rare that it does any\n // writing.\n view.docView.enforceCursorAssoc();\n }\n return result;\n }\n get visibleTop() { return this.scaler.fromDOM(this.pixelViewport.top); }\n get visibleBottom() { return this.scaler.fromDOM(this.pixelViewport.bottom); }\n getViewport(bias, scrollTarget) {\n // This will divide VP.Margin between the top and the\n // bottom, depending on the bias (the change in viewport position\n // since the last update). It\'ll hold a number between 0 and 1\n let marginTop = 0.5 - Math.max(-0.5, Math.min(0.5, bias / 1000 /* VP.Margin */ / 2));\n let map = this.heightMap, oracle = this.heightOracle;\n let { visibleTop, visibleBottom } = this;\n let viewport = new Viewport(map.lineAt(visibleTop - marginTop * 1000 /* VP.Margin */, QueryType.ByHeight, oracle, 0, 0).from, map.lineAt(visibleBottom + (1 - marginTop) * 1000 /* VP.Margin */, QueryType.ByHeight, oracle, 0, 0).to);\n // If scrollTarget is given, make sure the viewport includes that position\n if (scrollTarget) {\n let { head } = scrollTarget.range;\n if (head < viewport.from || head > viewport.to) {\n let viewHeight = Math.min(this.editorHeight, this.pixelViewport.bottom - this.pixelViewport.top);\n let block = map.lineAt(head, QueryType.ByPos, oracle, 0, 0), topPos;\n if (scrollTarget.y == "center")\n topPos = (block.top + block.bottom) / 2 - viewHeight / 2;\n else if (scrollTarget.y == "start" || scrollTarget.y == "nearest" && head < viewport.from)\n topPos = block.top;\n else\n topPos = block.bottom - viewHeight;\n viewport = new Viewport(map.lineAt(topPos - 1000 /* VP.Margin */ / 2, QueryType.ByHeight, oracle, 0, 0).from, map.lineAt(topPos + viewHeight + 1000 /* VP.Margin */ / 2, QueryType.ByHeight, oracle, 0, 0).to);\n }\n }\n return viewport;\n }\n mapViewport(viewport, changes) {\n let from = changes.mapPos(viewport.from, -1), to = changes.mapPos(viewport.to, 1);\n return new Viewport(this.heightMap.lineAt(from, QueryType.ByPos, this.heightOracle, 0, 0).from, this.heightMap.lineAt(to, QueryType.ByPos, this.heightOracle, 0, 0).to);\n }\n // Checks if a given viewport covers the visible part of the\n // document and not too much beyond that.\n viewportIsAppropriate({ from, to }, bias = 0) {\n if (!this.inView)\n return true;\n let { top } = this.heightMap.lineAt(from, QueryType.ByPos, this.heightOracle, 0, 0);\n let { bottom } = this.heightMap.lineAt(to, QueryType.ByPos, this.heightOracle, 0, 0);\n let { visibleTop, visibleBottom } = this;\n return (from == 0 || top <= visibleTop - Math.max(10 /* VP.MinCoverMargin */, Math.min(-bias, 250 /* VP.MaxCoverMargin */))) &&\n (to == this.state.doc.length ||\n bottom >= visibleBottom + Math.max(10 /* VP.MinCoverMargin */, Math.min(bias, 250 /* VP.MaxCoverMargin */))) &&\n (top > visibleTop - 2 * 1000 /* VP.Margin */ && bottom < visibleBottom + 2 * 1000 /* VP.Margin */);\n }\n mapLineGaps(gaps, changes) {\n if (!gaps.length || changes.empty)\n return gaps;\n let mapped = [];\n for (let gap of gaps)\n if (!changes.touchesRange(gap.from, gap.to))\n mapped.push(new LineGap(changes.mapPos(gap.from), changes.mapPos(gap.to), gap.size));\n return mapped;\n }\n // Computes positions in the viewport where the start or end of a\n // line should be hidden, trying to reuse existing line gaps when\n // appropriate to avoid unneccesary redraws.\n // Uses crude character-counting for the positioning and sizing,\n // since actual DOM coordinates aren\'t always available and\n // predictable. Relies on generous margins (see LG.Margin) to hide\n // the artifacts this might produce from the user.\n ensureLineGaps(current, mayMeasure) {\n let wrapping = this.heightOracle.lineWrapping;\n let margin = wrapping ? 10000 /* LG.MarginWrap */ : 2000 /* LG.Margin */, halfMargin = margin >> 1, doubleMargin = margin << 1;\n // The non-wrapping logic won\'t work at all in predominantly right-to-left text.\n if (this.defaultTextDirection != Direction.LTR && !wrapping)\n return [];\n let gaps = [];\n let addGap = (from, to, line, structure) => {\n if (to - from < halfMargin)\n return;\n let sel = this.state.selection.main, avoid = [sel.from];\n if (!sel.empty)\n avoid.push(sel.to);\n for (let pos of avoid) {\n if (pos > from && pos < to) {\n addGap(from, pos - 10 /* LG.SelectionMargin */, line, structure);\n addGap(pos + 10 /* LG.SelectionMargin */, to, line, structure);\n return;\n }\n }\n let gap = find(current, gap => gap.from >= line.from && gap.to <= line.to &&\n Math.abs(gap.from - from) < halfMargin && Math.abs(gap.to - to) < halfMargin &&\n !avoid.some(pos => gap.from < pos && gap.to > pos));\n if (!gap) {\n // When scrolling down, snap gap ends to line starts to avoid shifts in wrapping\n if (to < line.to && mayMeasure && wrapping &&\n mayMeasure.visibleRanges.some(r => r.from <= to && r.to >= to)) {\n let lineStart = mayMeasure.moveToLineBoundary(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(to), false, true).head;\n if (lineStart > from)\n to = lineStart;\n }\n gap = new LineGap(from, to, this.gapSize(line, from, to, structure));\n }\n gaps.push(gap);\n };\n let checkLine = (line) => {\n if (line.length < doubleMargin || line.type != BlockType.Text)\n return;\n let structure = lineStructure(line.from, line.to, this.stateDeco);\n if (structure.total < doubleMargin)\n return;\n let target = this.scrollTarget ? this.scrollTarget.range.head : null;\n let viewFrom, viewTo;\n if (wrapping) {\n let marginHeight = (margin / this.heightOracle.lineLength) * this.heightOracle.lineHeight;\n let top, bot;\n if (target != null) {\n let targetFrac = findFraction(structure, target);\n let spaceFrac = ((this.visibleBottom - this.visibleTop) / 2 + marginHeight) / line.height;\n top = targetFrac - spaceFrac;\n bot = targetFrac + spaceFrac;\n }\n else {\n top = (this.visibleTop - line.top - marginHeight) / line.height;\n bot = (this.visibleBottom - line.top + marginHeight) / line.height;\n }\n viewFrom = findPosition(structure, top);\n viewTo = findPosition(structure, bot);\n }\n else {\n let totalWidth = structure.total * this.heightOracle.charWidth;\n let marginWidth = margin * this.heightOracle.charWidth;\n let left, right;\n if (target != null) {\n let targetFrac = findFraction(structure, target);\n let spaceFrac = ((this.pixelViewport.right - this.pixelViewport.left) / 2 + marginWidth) / totalWidth;\n left = targetFrac - spaceFrac;\n right = targetFrac + spaceFrac;\n }\n else {\n left = (this.pixelViewport.left - marginWidth) / totalWidth;\n right = (this.pixelViewport.right + marginWidth) / totalWidth;\n }\n viewFrom = findPosition(structure, left);\n viewTo = findPosition(structure, right);\n }\n if (viewFrom > line.from)\n addGap(line.from, viewFrom, line, structure);\n if (viewTo < line.to)\n addGap(viewTo, line.to, line, structure);\n };\n for (let line of this.viewportLines) {\n if (Array.isArray(line.type))\n line.type.forEach(checkLine);\n else\n checkLine(line);\n }\n return gaps;\n }\n gapSize(line, from, to, structure) {\n let fraction = findFraction(structure, to) - findFraction(structure, from);\n if (this.heightOracle.lineWrapping) {\n return line.height * fraction;\n }\n else {\n return structure.total * this.heightOracle.charWidth * fraction;\n }\n }\n updateLineGaps(gaps) {\n if (!LineGap.same(gaps, this.lineGaps)) {\n this.lineGaps = gaps;\n this.lineGapDeco = Decoration.set(gaps.map(gap => gap.draw(this, this.heightOracle.lineWrapping)));\n }\n }\n computeVisibleRanges() {\n let deco = this.stateDeco;\n if (this.lineGaps.length)\n deco = deco.concat(this.lineGapDeco);\n let ranges = [];\n _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.spans(deco, this.viewport.from, this.viewport.to, {\n span(from, to) { ranges.push({ from, to }); },\n point() { }\n }, 20);\n let changed = ranges.length != this.visibleRanges.length ||\n this.visibleRanges.some((r, i) => r.from != ranges[i].from || r.to != ranges[i].to);\n this.visibleRanges = ranges;\n return changed ? 4 /* UpdateFlag.Viewport */ : 0;\n }\n lineBlockAt(pos) {\n return (pos >= this.viewport.from && pos <= this.viewport.to &&\n this.viewportLines.find(b => b.from <= pos && b.to >= pos)) ||\n scaleBlock(this.heightMap.lineAt(pos, QueryType.ByPos, this.heightOracle, 0, 0), this.scaler);\n }\n lineBlockAtHeight(height) {\n return (height >= this.viewportLines[0].top && height <= this.viewportLines[this.viewportLines.length - 1].bottom &&\n this.viewportLines.find(l => l.top <= height && l.bottom >= height)) ||\n scaleBlock(this.heightMap.lineAt(this.scaler.fromDOM(height), QueryType.ByHeight, this.heightOracle, 0, 0), this.scaler);\n }\n scrollAnchorAt(scrollTop) {\n let block = this.lineBlockAtHeight(scrollTop + 8);\n return block.from >= this.viewport.from || this.viewportLines[0].top - scrollTop > 200 ? block : this.viewportLines[0];\n }\n elementAtHeight(height) {\n return scaleBlock(this.heightMap.blockAt(this.scaler.fromDOM(height), this.heightOracle, 0, 0), this.scaler);\n }\n get docHeight() {\n return this.scaler.toDOM(this.heightMap.height);\n }\n get contentHeight() {\n return this.docHeight + this.paddingTop + this.paddingBottom;\n }\n}\nclass Viewport {\n constructor(from, to) {\n this.from = from;\n this.to = to;\n }\n}\nfunction lineStructure(from, to, stateDeco) {\n let ranges = [], pos = from, total = 0;\n _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.spans(stateDeco, from, to, {\n span() { },\n point(from, to) {\n if (from > pos) {\n ranges.push({ from: pos, to: from });\n total += from - pos;\n }\n pos = to;\n }\n }, 20); // We\'re only interested in collapsed ranges of a significant size\n if (pos < to) {\n ranges.push({ from: pos, to });\n total += to - pos;\n }\n return { total, ranges };\n}\nfunction findPosition({ total, ranges }, ratio) {\n if (ratio <= 0)\n return ranges[0].from;\n if (ratio >= 1)\n return ranges[ranges.length - 1].to;\n let dist = Math.floor(total * ratio);\n for (let i = 0;; i++) {\n let { from, to } = ranges[i], size = to - from;\n if (dist <= size)\n return from + dist;\n dist -= size;\n }\n}\nfunction findFraction(structure, pos) {\n let counted = 0;\n for (let { from, to } of structure.ranges) {\n if (pos <= to) {\n counted += pos - from;\n break;\n }\n counted += to - from;\n }\n return counted / structure.total;\n}\nfunction find(array, f) {\n for (let val of array)\n if (f(val))\n return val;\n return undefined;\n}\n// Don\'t scale when the document height is within the range of what\n// the DOM can handle.\nconst IdScaler = {\n toDOM(n) { return n; },\n fromDOM(n) { return n; },\n scale: 1,\n eq(other) { return other == this; }\n};\n// When the height is too big (> VP.MaxDOMHeight), scale down the\n// regions outside the viewports so that the total height is\n// VP.MaxDOMHeight.\nclass BigScaler {\n constructor(oracle, heightMap, viewports) {\n let vpHeight = 0, base = 0, domBase = 0;\n this.viewports = viewports.map(({ from, to }) => {\n let top = heightMap.lineAt(from, QueryType.ByPos, oracle, 0, 0).top;\n let bottom = heightMap.lineAt(to, QueryType.ByPos, oracle, 0, 0).bottom;\n vpHeight += bottom - top;\n return { from, to, top, bottom, domTop: 0, domBottom: 0 };\n });\n this.scale = (7000000 /* VP.MaxDOMHeight */ - vpHeight) / (heightMap.height - vpHeight);\n for (let obj of this.viewports) {\n obj.domTop = domBase + (obj.top - base) * this.scale;\n domBase = obj.domBottom = obj.domTop + (obj.bottom - obj.top);\n base = obj.bottom;\n }\n }\n toDOM(n) {\n for (let i = 0, base = 0, domBase = 0;; i++) {\n let vp = i < this.viewports.length ? this.viewports[i] : null;\n if (!vp || n < vp.top)\n return domBase + (n - base) * this.scale;\n if (n <= vp.bottom)\n return vp.domTop + (n - vp.top);\n base = vp.bottom;\n domBase = vp.domBottom;\n }\n }\n fromDOM(n) {\n for (let i = 0, base = 0, domBase = 0;; i++) {\n let vp = i < this.viewports.length ? this.viewports[i] : null;\n if (!vp || n < vp.domTop)\n return base + (n - domBase) / this.scale;\n if (n <= vp.domBottom)\n return vp.top + (n - vp.domTop);\n base = vp.bottom;\n domBase = vp.domBottom;\n }\n }\n eq(other) {\n if (!(other instanceof BigScaler))\n return false;\n return this.scale == other.scale && this.viewports.length == other.viewports.length &&\n this.viewports.every((vp, i) => vp.from == other.viewports[i].from && vp.to == other.viewports[i].to);\n }\n}\nfunction scaleBlock(block, scaler) {\n if (scaler.scale == 1)\n return block;\n let bTop = scaler.toDOM(block.top), bBottom = scaler.toDOM(block.bottom);\n return new BlockInfo(block.from, block.length, bTop, bBottom - bTop, Array.isArray(block._content) ? block._content.map(b => scaleBlock(b, scaler)) : block._content);\n}\n\nconst theme = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({ combine: strs => strs.join(" ") });\nconst darkTheme = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({ combine: values => values.indexOf(true) > -1 });\nconst baseThemeID = /*@__PURE__*/style_mod__WEBPACK_IMPORTED_MODULE_0__.StyleModule.newName(), baseLightID = /*@__PURE__*/style_mod__WEBPACK_IMPORTED_MODULE_0__.StyleModule.newName(), baseDarkID = /*@__PURE__*/style_mod__WEBPACK_IMPORTED_MODULE_0__.StyleModule.newName();\nconst lightDarkIDs = { "&light": "." + baseLightID, "&dark": "." + baseDarkID };\nfunction buildTheme(main, spec, scopes) {\n return new style_mod__WEBPACK_IMPORTED_MODULE_0__.StyleModule(spec, {\n finish(sel) {\n return /&/.test(sel) ? sel.replace(/&\\w*/, m => {\n if (m == "&")\n return main;\n if (!scopes || !scopes[m])\n throw new RangeError(`Unsupported selector: ${m}`);\n return scopes[m];\n }) : main + " " + sel;\n }\n });\n}\nconst baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {\n "&": {\n position: "relative !important",\n boxSizing: "border-box",\n "&.cm-focused": {\n // Provide a simple default outline to make sure a focused\n // editor is visually distinct. Can\'t leave the default behavior\n // because that will apply to the content element, which is\n // inside the scrollable container and doesn\'t include the\n // gutters. We also can\'t use an \'auto\' outline, since those\n // are, for some reason, drawn behind the element content, which\n // will cause things like the active line background to cover\n // the outline (#297).\n outline: "1px dotted #212121"\n },\n display: "flex !important",\n flexDirection: "column"\n },\n ".cm-scroller": {\n display: "flex !important",\n alignItems: "flex-start !important",\n fontFamily: "monospace",\n lineHeight: 1.4,\n height: "100%",\n overflowX: "auto",\n position: "relative",\n zIndex: 0\n },\n ".cm-content": {\n margin: 0,\n flexGrow: 2,\n flexShrink: 0,\n display: "block",\n whiteSpace: "pre",\n wordWrap: "normal", // https://github.com/codemirror/dev/issues/456\n boxSizing: "border-box",\n minHeight: "100%",\n padding: "4px 0",\n outline: "none",\n "&[contenteditable=true]": {\n WebkitUserModify: "read-write-plaintext-only",\n }\n },\n ".cm-lineWrapping": {\n whiteSpace_fallback: "pre-wrap", // For IE\n whiteSpace: "break-spaces",\n wordBreak: "break-word", // For Safari, which doesn\'t support overflow-wrap: anywhere\n overflowWrap: "anywhere",\n flexShrink: 1\n },\n "&light .cm-content": { caretColor: "black" },\n "&dark .cm-content": { caretColor: "white" },\n ".cm-line": {\n display: "block",\n padding: "0 2px 0 6px"\n },\n ".cm-layer": {\n position: "absolute",\n left: 0,\n top: 0,\n contain: "size style",\n "& > *": {\n position: "absolute"\n }\n },\n "&light .cm-selectionBackground": {\n background: "#d9d9d9"\n },\n "&dark .cm-selectionBackground": {\n background: "#222"\n },\n "&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {\n background: "#d7d4f0"\n },\n "&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {\n background: "#233"\n },\n ".cm-cursorLayer": {\n pointerEvents: "none"\n },\n "&.cm-focused > .cm-scroller > .cm-cursorLayer": {\n animation: "steps(1) cm-blink 1.2s infinite"\n },\n // Two animations defined so that we can switch between them to\n // restart the animation without forcing another style\n // recomputation.\n "@keyframes cm-blink": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },\n "@keyframes cm-blink2": { "0%": {}, "50%": { opacity: 0 }, "100%": {} },\n ".cm-cursor, .cm-dropCursor": {\n borderLeft: "1.2px solid black",\n marginLeft: "-0.6px",\n pointerEvents: "none",\n },\n ".cm-cursor": {\n display: "none"\n },\n "&dark .cm-cursor": {\n borderLeftColor: "#444"\n },\n ".cm-dropCursor": {\n position: "absolute"\n },\n "&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor": {\n display: "block"\n },\n ".cm-iso": {\n unicodeBidi: "isolate"\n },\n ".cm-announced": {\n position: "fixed",\n top: "-10000px"\n },\n "@media print": {\n ".cm-announced": { display: "none" }\n },\n "&light .cm-activeLine": { backgroundColor: "#cceeff44" },\n "&dark .cm-activeLine": { backgroundColor: "#99eeff33" },\n "&light .cm-specialChar": { color: "red" },\n "&dark .cm-specialChar": { color: "#f78" },\n ".cm-gutters": {\n flexShrink: 0,\n display: "flex",\n height: "100%",\n boxSizing: "border-box",\n insetInlineStart: 0,\n zIndex: 200\n },\n "&light .cm-gutters": {\n backgroundColor: "#f5f5f5",\n color: "#6c6c6c",\n borderRight: "1px solid #ddd"\n },\n "&dark .cm-gutters": {\n backgroundColor: "#333338",\n color: "#ccc"\n },\n ".cm-gutter": {\n display: "flex !important", // Necessary -- prevents margin collapsing\n flexDirection: "column",\n flexShrink: 0,\n boxSizing: "border-box",\n minHeight: "100%",\n overflow: "hidden"\n },\n ".cm-gutterElement": {\n boxSizing: "border-box"\n },\n ".cm-lineNumbers .cm-gutterElement": {\n padding: "0 3px 0 5px",\n minWidth: "20px",\n textAlign: "right",\n whiteSpace: "nowrap"\n },\n "&light .cm-activeLineGutter": {\n backgroundColor: "#e2f2ff"\n },\n "&dark .cm-activeLineGutter": {\n backgroundColor: "#222227"\n },\n ".cm-panels": {\n boxSizing: "border-box",\n position: "sticky",\n left: 0,\n right: 0\n },\n "&light .cm-panels": {\n backgroundColor: "#f5f5f5",\n color: "black"\n },\n "&light .cm-panels-top": {\n borderBottom: "1px solid #ddd"\n },\n "&light .cm-panels-bottom": {\n borderTop: "1px solid #ddd"\n },\n "&dark .cm-panels": {\n backgroundColor: "#333338",\n color: "white"\n },\n ".cm-tab": {\n display: "inline-block",\n overflow: "hidden",\n verticalAlign: "bottom"\n },\n ".cm-widgetBuffer": {\n verticalAlign: "text-top",\n height: "1em",\n width: 0,\n display: "inline"\n },\n ".cm-placeholder": {\n color: "#888",\n display: "inline-block",\n verticalAlign: "top",\n },\n ".cm-highlightSpace:before": {\n content: "attr(data-display)",\n position: "absolute",\n pointerEvents: "none",\n color: "#888"\n },\n ".cm-highlightTab": {\n backgroundImage: `url(\'data:image/svg+xml,\')`,\n backgroundSize: "auto 100%",\n backgroundPosition: "right 90%",\n backgroundRepeat: "no-repeat"\n },\n ".cm-trailingSpace": {\n backgroundColor: "#ff332255"\n },\n ".cm-button": {\n verticalAlign: "middle",\n color: "inherit",\n fontSize: "70%",\n padding: ".2em 1em",\n borderRadius: "1px"\n },\n "&light .cm-button": {\n backgroundImage: "linear-gradient(#eff1f5, #d9d9df)",\n border: "1px solid #888",\n "&:active": {\n backgroundImage: "linear-gradient(#b4b4b4, #d0d3d6)"\n }\n },\n "&dark .cm-button": {\n backgroundImage: "linear-gradient(#393939, #111)",\n border: "1px solid #888",\n "&:active": {\n backgroundImage: "linear-gradient(#111, #333)"\n }\n },\n ".cm-textfield": {\n verticalAlign: "middle",\n color: "inherit",\n fontSize: "70%",\n border: "1px solid silver",\n padding: ".2em .5em"\n },\n "&light .cm-textfield": {\n backgroundColor: "white"\n },\n "&dark .cm-textfield": {\n border: "1px solid #555",\n backgroundColor: "inherit"\n }\n}, lightDarkIDs);\n\nconst LineBreakPlaceholder = "\\uffff";\nclass DOMReader {\n constructor(points, state) {\n this.points = points;\n this.text = "";\n this.lineSeparator = state.facet(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorState.lineSeparator);\n }\n append(text) {\n this.text += text;\n }\n lineBreak() {\n this.text += LineBreakPlaceholder;\n }\n readRange(start, end) {\n if (!start)\n return this;\n let parent = start.parentNode;\n for (let cur = start;;) {\n this.findPointBefore(parent, cur);\n let oldLen = this.text.length;\n this.readNode(cur);\n let next = cur.nextSibling;\n if (next == end)\n break;\n let view = ContentView.get(cur), nextView = ContentView.get(next);\n if (view && nextView ? view.breakAfter :\n (view ? view.breakAfter : isBlockElement(cur)) ||\n (isBlockElement(next) && (cur.nodeName != "BR" || cur.cmIgnore) && this.text.length > oldLen))\n this.lineBreak();\n cur = next;\n }\n this.findPointBefore(parent, end);\n return this;\n }\n readTextNode(node) {\n let text = node.nodeValue;\n for (let point of this.points)\n if (point.node == node)\n point.pos = this.text.length + Math.min(point.offset, text.length);\n for (let off = 0, re = this.lineSeparator ? null : /\\r\\n?|\\n/g;;) {\n let nextBreak = -1, breakSize = 1, m;\n if (this.lineSeparator) {\n nextBreak = text.indexOf(this.lineSeparator, off);\n breakSize = this.lineSeparator.length;\n }\n else if (m = re.exec(text)) {\n nextBreak = m.index;\n breakSize = m[0].length;\n }\n this.append(text.slice(off, nextBreak < 0 ? text.length : nextBreak));\n if (nextBreak < 0)\n break;\n this.lineBreak();\n if (breakSize > 1)\n for (let point of this.points)\n if (point.node == node && point.pos > this.text.length)\n point.pos -= breakSize - 1;\n off = nextBreak + breakSize;\n }\n }\n readNode(node) {\n if (node.cmIgnore)\n return;\n let view = ContentView.get(node);\n let fromView = view && view.overrideDOMText;\n if (fromView != null) {\n this.findPointInside(node, fromView.length);\n for (let i = fromView.iter(); !i.next().done;) {\n if (i.lineBreak)\n this.lineBreak();\n else\n this.append(i.value);\n }\n }\n else if (node.nodeType == 3) {\n this.readTextNode(node);\n }\n else if (node.nodeName == "BR") {\n if (node.nextSibling)\n this.lineBreak();\n }\n else if (node.nodeType == 1) {\n this.readRange(node.firstChild, null);\n }\n }\n findPointBefore(node, next) {\n for (let point of this.points)\n if (point.node == node && node.childNodes[point.offset] == next)\n point.pos = this.text.length;\n }\n findPointInside(node, length) {\n for (let point of this.points)\n if (node.nodeType == 3 ? point.node == node : node.contains(point.node))\n point.pos = this.text.length + (isAtEnd(node, point.node, point.offset) ? length : 0);\n }\n}\nfunction isAtEnd(parent, node, offset) {\n for (;;) {\n if (!node || offset < maxOffset(node))\n return false;\n if (node == parent)\n return true;\n offset = domIndex(node) + 1;\n node = node.parentNode;\n }\n}\nclass DOMPoint {\n constructor(node, offset) {\n this.node = node;\n this.offset = offset;\n this.pos = -1;\n }\n}\n\nclass DOMChange {\n constructor(view, start, end, typeOver) {\n this.typeOver = typeOver;\n this.bounds = null;\n this.text = "";\n this.domChanged = start > -1;\n let { impreciseHead: iHead, impreciseAnchor: iAnchor } = view.docView;\n if (view.state.readOnly && start > -1) {\n // Ignore changes when the editor is read-only\n this.newSel = null;\n }\n else if (start > -1 && (this.bounds = view.docView.domBoundsAround(start, end, 0))) {\n let selPoints = iHead || iAnchor ? [] : selectionPoints(view);\n let reader = new DOMReader(selPoints, view.state);\n reader.readRange(this.bounds.startDOM, this.bounds.endDOM);\n this.text = reader.text;\n this.newSel = selectionFromPoints(selPoints, this.bounds.from);\n }\n else {\n let domSel = view.observer.selectionRange;\n let head = iHead && iHead.node == domSel.focusNode && iHead.offset == domSel.focusOffset ||\n !contains(view.contentDOM, domSel.focusNode)\n ? view.state.selection.main.head\n : view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset);\n let anchor = iAnchor && iAnchor.node == domSel.anchorNode && iAnchor.offset == domSel.anchorOffset ||\n !contains(view.contentDOM, domSel.anchorNode)\n ? view.state.selection.main.anchor\n : view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset);\n // iOS will refuse to select the block gaps when doing\n // select-all.\n // Chrome will put the selection *inside* them, confusing\n // posFromDOM\n let vp = view.viewport;\n if ((browser.ios || browser.chrome) && view.state.selection.main.empty && head != anchor &&\n (vp.from > 0 || vp.to < view.state.doc.length)) {\n let from = Math.min(head, anchor), to = Math.max(head, anchor);\n let offFrom = vp.from - from, offTo = vp.to - to;\n if ((offFrom == 0 || offFrom == 1 || from == 0) && (offTo == 0 || offTo == -1 || to == view.state.doc.length)) {\n head = 0;\n anchor = view.state.doc.length;\n }\n }\n this.newSel = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.single(anchor, head);\n }\n }\n}\nfunction applyDOMChange(view, domChange) {\n let change;\n let { newSel } = domChange, sel = view.state.selection.main;\n let lastKey = view.inputState.lastKeyTime > Date.now() - 100 ? view.inputState.lastKeyCode : -1;\n if (domChange.bounds) {\n let { from, to } = domChange.bounds;\n let preferredPos = sel.from, preferredSide = null;\n // Prefer anchoring to end when Backspace is pressed (or, on\n // Android, when something was deleted)\n if (lastKey === 8 || browser.android && domChange.text.length < to - from) {\n preferredPos = sel.to;\n preferredSide = "end";\n }\n let diff = findDiff(view.state.doc.sliceString(from, to, LineBreakPlaceholder), domChange.text, preferredPos - from, preferredSide);\n if (diff) {\n // Chrome inserts two newlines when pressing shift-enter at the\n // end of a line. DomChange drops one of those.\n if (browser.chrome && lastKey == 13 &&\n diff.toB == diff.from + 2 && domChange.text.slice(diff.from, diff.toB) == LineBreakPlaceholder + LineBreakPlaceholder)\n diff.toB--;\n change = { from: from + diff.from, to: from + diff.toA,\n insert: _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };\n }\n }\n else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {\n newSel = null;\n }\n if (!change && !newSel)\n return false;\n if (!change && domChange.typeOver && !sel.empty && newSel && newSel.main.empty) {\n // Heuristic to notice typing over a selected character\n change = { from: sel.from, to: sel.to, insert: view.state.doc.slice(sel.from, sel.to) };\n }\n else if (change && change.from >= sel.from && change.to <= sel.to &&\n (change.from != sel.from || change.to != sel.to) &&\n (sel.to - sel.from) - (change.to - change.from) <= 4) {\n // If the change is inside the selection and covers most of it,\n // assume it is a selection replace (with identical characters at\n // the start/end not included in the diff)\n change = {\n from: sel.from, to: sel.to,\n insert: view.state.doc.slice(sel.from, change.from).append(change.insert).append(view.state.doc.slice(change.to, sel.to))\n };\n }\n else if ((browser.mac || browser.android) && change && change.from == change.to && change.from == sel.head - 1 &&\n /^\\. ?$/.test(change.insert.toString()) && view.contentDOM.getAttribute("autocorrect") == "off") {\n // Detect insert-period-on-double-space Mac and Android behavior,\n // and transform it into a regular space insert.\n if (newSel && change.insert.length == 2)\n newSel = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);\n change = { from: sel.from, to: sel.to, insert: _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.of([" "]) };\n }\n else if (browser.chrome && change && change.from == change.to && change.from == sel.head &&\n change.insert.toString() == "\\n " && view.lineWrapping) {\n // In Chrome, if you insert a space at the start of a wrapped\n // line, it will actually insert a newline and a space, causing a\n // bogus new line to be created in CodeMirror (#968)\n if (newSel)\n newSel = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.single(newSel.main.anchor - 1, newSel.main.head - 1);\n change = { from: sel.from, to: sel.to, insert: _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.of([" "]) };\n }\n if (change) {\n return applyDOMChangeInner(view, change, newSel, lastKey);\n }\n else if (newSel && !newSel.main.eq(sel)) {\n let scrollIntoView = false, userEvent = "select";\n if (view.inputState.lastSelectionTime > Date.now() - 50) {\n if (view.inputState.lastSelectionOrigin == "select")\n scrollIntoView = true;\n userEvent = view.inputState.lastSelectionOrigin;\n }\n view.dispatch({ selection: newSel, scrollIntoView, userEvent });\n return true;\n }\n else {\n return false;\n }\n}\nfunction applyDOMChangeInner(view, change, newSel, lastKey = -1) {\n if (browser.ios && view.inputState.flushIOSKey(change))\n return true;\n let sel = view.state.selection.main;\n // Android browsers don\'t fire reasonable key events for enter,\n // backspace, or delete. So this detects changes that look like\n // they\'re caused by those keys, and reinterprets them as key\n // events. (Some of these keys are also handled by beforeinput\n // events and the pendingAndroidKey mechanism, but that\'s not\n // reliable in all situations.)\n if (browser.android &&\n ((change.to == sel.to &&\n // GBoard will sometimes remove a space it just inserted\n // after a completion when you press enter\n (change.from == sel.from || change.from == sel.from - 1 && view.state.sliceDoc(change.from, sel.from) == " ") &&\n change.insert.length == 1 && change.insert.lines == 2 &&\n dispatchKey(view.contentDOM, "Enter", 13)) ||\n ((change.from == sel.from - 1 && change.to == sel.to && change.insert.length == 0 ||\n lastKey == 8 && change.insert.length < change.to - change.from && change.to > sel.head) &&\n dispatchKey(view.contentDOM, "Backspace", 8)) ||\n (change.from == sel.from && change.to == sel.to + 1 && change.insert.length == 0 &&\n dispatchKey(view.contentDOM, "Delete", 46))))\n return true;\n let text = change.insert.toString();\n if (view.inputState.composing >= 0)\n view.inputState.composing++;\n let defaultTr;\n let defaultInsert = () => defaultTr || (defaultTr = applyDefaultInsert(view, change, newSel));\n if (!view.state.facet(inputHandler).some(h => h(view, change.from, change.to, text, defaultInsert)))\n view.dispatch(defaultInsert());\n return true;\n}\nfunction applyDefaultInsert(view, change, newSel) {\n let tr, startState = view.state, sel = startState.selection.main;\n if (change.from >= sel.from && change.to <= sel.to && change.to - change.from >= (sel.to - sel.from) / 3 &&\n (!newSel || newSel.main.empty && newSel.main.from == change.from + change.insert.length) &&\n view.inputState.composing < 0) {\n let before = sel.from < change.from ? startState.sliceDoc(sel.from, change.from) : "";\n let after = sel.to > change.to ? startState.sliceDoc(change.to, sel.to) : "";\n tr = startState.replaceSelection(view.state.toText(before + change.insert.sliceString(0, undefined, view.state.lineBreak) + after));\n }\n else {\n let changes = startState.changes(change);\n let mainSel = newSel && newSel.main.to <= changes.newLength ? newSel.main : undefined;\n // Try to apply a composition change to all cursors\n if (startState.selection.ranges.length > 1 && view.inputState.composing >= 0 &&\n change.to <= sel.to && change.to >= sel.to - 10) {\n let replaced = view.state.sliceDoc(change.from, change.to);\n let compositionRange, composition = newSel && findCompositionNode(view, newSel.main.head);\n if (composition) {\n let dLen = change.insert.length - (change.to - change.from);\n compositionRange = { from: composition.from, to: composition.to - dLen };\n }\n else {\n compositionRange = view.state.doc.lineAt(sel.head);\n }\n let offset = sel.to - change.to, size = sel.to - sel.from;\n tr = startState.changeByRange(range => {\n if (range.from == sel.from && range.to == sel.to)\n return { changes, range: mainSel || range.map(changes) };\n let to = range.to - offset, from = to - replaced.length;\n if (range.to - range.from != size || view.state.sliceDoc(from, to) != replaced ||\n // Unfortunately, there\'s no way to make multiple\n // changes in the same node work without aborting\n // composition, so cursors in the composition range are\n // ignored.\n range.to >= compositionRange.from && range.from <= compositionRange.to)\n return { range };\n let rangeChanges = startState.changes({ from, to, insert: change.insert }), selOff = range.to - sel.to;\n return {\n changes: rangeChanges,\n range: !mainSel ? range.map(rangeChanges) :\n _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.range(Math.max(0, mainSel.anchor + selOff), Math.max(0, mainSel.head + selOff))\n };\n });\n }\n else {\n tr = {\n changes,\n selection: mainSel && startState.selection.replaceRange(mainSel)\n };\n }\n }\n let userEvent = "input.type";\n if (view.composing ||\n view.inputState.compositionPendingChange && view.inputState.compositionEndedAt > Date.now() - 50) {\n view.inputState.compositionPendingChange = false;\n userEvent += ".compose";\n if (view.inputState.compositionFirstChange) {\n userEvent += ".start";\n view.inputState.compositionFirstChange = false;\n }\n }\n return startState.update(tr, { userEvent, scrollIntoView: true });\n}\nfunction findDiff(a, b, preferredPos, preferredSide) {\n let minLen = Math.min(a.length, b.length);\n let from = 0;\n while (from < minLen && a.charCodeAt(from) == b.charCodeAt(from))\n from++;\n if (from == minLen && a.length == b.length)\n return null;\n let toA = a.length, toB = b.length;\n while (toA > 0 && toB > 0 && a.charCodeAt(toA - 1) == b.charCodeAt(toB - 1)) {\n toA--;\n toB--;\n }\n if (preferredSide == "end") {\n let adjust = Math.max(0, from - Math.min(toA, toB));\n preferredPos -= toA + adjust - from;\n }\n if (toA < from && a.length < b.length) {\n let move = preferredPos <= from && preferredPos >= toA ? from - preferredPos : 0;\n from -= move;\n toB = from + (toB - toA);\n toA = from;\n }\n else if (toB < from) {\n let move = preferredPos <= from && preferredPos >= toB ? from - preferredPos : 0;\n from -= move;\n toA = from + (toA - toB);\n toB = from;\n }\n return { from, toA, toB };\n}\nfunction selectionPoints(view) {\n let result = [];\n if (view.root.activeElement != view.contentDOM)\n return result;\n let { anchorNode, anchorOffset, focusNode, focusOffset } = view.observer.selectionRange;\n if (anchorNode) {\n result.push(new DOMPoint(anchorNode, anchorOffset));\n if (focusNode != anchorNode || focusOffset != anchorOffset)\n result.push(new DOMPoint(focusNode, focusOffset));\n }\n return result;\n}\nfunction selectionFromPoints(points, base) {\n if (points.length == 0)\n return null;\n let anchor = points[0].pos, head = points.length == 2 ? points[1].pos : anchor;\n return anchor > -1 && head > -1 ? _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.single(anchor + base, head + base) : null;\n}\n\nconst observeOptions = {\n childList: true,\n characterData: true,\n subtree: true,\n attributes: true,\n characterDataOldValue: true\n};\n// IE11 has very broken mutation observers, so we also listen to\n// DOMCharacterDataModified there\nconst useCharData = browser.ie && browser.ie_version <= 11;\nclass DOMObserver {\n constructor(view) {\n this.view = view;\n this.active = false;\n this.editContext = null;\n // The known selection. Kept in our own object, as opposed to just\n // directly accessing the selection because:\n // - Safari doesn\'t report the right selection in shadow DOM\n // - Reading from the selection forces a DOM layout\n // - This way, we can ignore selectionchange events if we have\n // already seen the \'new\' selection\n this.selectionRange = new DOMSelectionState;\n // Set when a selection change is detected, cleared on flush\n this.selectionChanged = false;\n this.delayedFlush = -1;\n this.resizeTimeout = -1;\n this.queue = [];\n this.delayedAndroidKey = null;\n this.flushingAndroidKey = -1;\n this.lastChange = 0;\n this.scrollTargets = [];\n this.intersection = null;\n this.resizeScroll = null;\n this.intersecting = false;\n this.gapIntersection = null;\n this.gaps = [];\n this.printQuery = null;\n // Timeout for scheduling check of the parents that need scroll handlers\n this.parentCheck = -1;\n this.dom = view.contentDOM;\n this.observer = new MutationObserver(mutations => {\n for (let mut of mutations)\n this.queue.push(mut);\n // IE11 will sometimes (on typing over a selection or\n // backspacing out a single character text node) call the\n // observer callback before actually updating the DOM.\n //\n // Unrelatedly, iOS Safari will, when ending a composition,\n // sometimes first clear it, deliver the mutations, and then\n // reinsert the finished text. CodeMirror\'s handling of the\n // deletion will prevent the reinsertion from happening,\n // breaking composition.\n if ((browser.ie && browser.ie_version <= 11 || browser.ios && view.composing) &&\n mutations.some(m => m.type == "childList" && m.removedNodes.length ||\n m.type == "characterData" && m.oldValue.length > m.target.nodeValue.length))\n this.flushSoon();\n else\n this.flush();\n });\n if (window.EditContext && view.constructor.EDIT_CONTEXT !== false &&\n // Chrome <126 doesn\'t support inverted selections in edit context (#1392)\n !(browser.chrome && browser.chrome_version < 126)) {\n this.editContext = new EditContextManager(view);\n if (view.state.facet(editable))\n view.contentDOM.editContext = this.editContext.editContext;\n }\n if (useCharData)\n this.onCharData = (event) => {\n this.queue.push({ target: event.target,\n type: "characterData",\n oldValue: event.prevValue });\n this.flushSoon();\n };\n this.onSelectionChange = this.onSelectionChange.bind(this);\n this.onResize = this.onResize.bind(this);\n this.onPrint = this.onPrint.bind(this);\n this.onScroll = this.onScroll.bind(this);\n if (window.matchMedia)\n this.printQuery = window.matchMedia("print");\n if (typeof ResizeObserver == "function") {\n this.resizeScroll = new ResizeObserver(() => {\n var _a;\n if (((_a = this.view.docView) === null || _a === void 0 ? void 0 : _a.lastUpdate) < Date.now() - 75)\n this.onResize();\n });\n this.resizeScroll.observe(view.scrollDOM);\n }\n this.addWindowListeners(this.win = view.win);\n this.start();\n if (typeof IntersectionObserver == "function") {\n this.intersection = new IntersectionObserver(entries => {\n if (this.parentCheck < 0)\n this.parentCheck = setTimeout(this.listenForScroll.bind(this), 1000);\n if (entries.length > 0 && (entries[entries.length - 1].intersectionRatio > 0) != this.intersecting) {\n this.intersecting = !this.intersecting;\n if (this.intersecting != this.view.inView)\n this.onScrollChanged(document.createEvent("Event"));\n }\n }, { threshold: [0, .001] });\n this.intersection.observe(this.dom);\n this.gapIntersection = new IntersectionObserver(entries => {\n if (entries.length > 0 && entries[entries.length - 1].intersectionRatio > 0)\n this.onScrollChanged(document.createEvent("Event"));\n }, {});\n }\n this.listenForScroll();\n this.readSelectionRange();\n }\n onScrollChanged(e) {\n this.view.inputState.runHandlers("scroll", e);\n if (this.intersecting)\n this.view.measure();\n }\n onScroll(e) {\n if (this.intersecting)\n this.flush(false);\n if (this.editContext)\n this.view.requestMeasure(this.editContext.measureReq);\n this.onScrollChanged(e);\n }\n onResize() {\n if (this.resizeTimeout < 0)\n this.resizeTimeout = setTimeout(() => {\n this.resizeTimeout = -1;\n this.view.requestMeasure();\n }, 50);\n }\n onPrint(event) {\n if ((event.type == "change" || !event.type) && !event.matches)\n return;\n this.view.viewState.printing = true;\n this.view.measure();\n setTimeout(() => {\n this.view.viewState.printing = false;\n this.view.requestMeasure();\n }, 500);\n }\n updateGaps(gaps) {\n if (this.gapIntersection && (gaps.length != this.gaps.length || this.gaps.some((g, i) => g != gaps[i]))) {\n this.gapIntersection.disconnect();\n for (let gap of gaps)\n this.gapIntersection.observe(gap);\n this.gaps = gaps;\n }\n }\n onSelectionChange(event) {\n let wasChanged = this.selectionChanged;\n if (!this.readSelectionRange() || this.delayedAndroidKey)\n return;\n let { view } = this, sel = this.selectionRange;\n if (view.state.facet(editable) ? view.root.activeElement != this.dom : !hasSelection(view.dom, sel))\n return;\n let context = sel.anchorNode && view.docView.nearest(sel.anchorNode);\n if (context && context.ignoreEvent(event)) {\n if (!wasChanged)\n this.selectionChanged = false;\n return;\n }\n // Deletions on IE11 fire their events in the wrong order, giving\n // us a selection change event before the DOM changes are\n // reported.\n // Chrome Android has a similar issue when backspacing out a\n // selection (#645).\n if ((browser.ie && browser.ie_version <= 11 || browser.android && browser.chrome) && !view.state.selection.main.empty &&\n // (Selection.isCollapsed isn\'t reliable on IE)\n sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset))\n this.flushSoon();\n else\n this.flush(false);\n }\n readSelectionRange() {\n let { view } = this;\n // The Selection object is broken in shadow roots in Safari. See\n // https://github.com/codemirror/dev/issues/414\n let selection = getSelection(view.root);\n if (!selection)\n return false;\n let range = browser.safari && view.root.nodeType == 11 &&\n deepActiveElement(this.dom.ownerDocument) == this.dom &&\n safariSelectionRangeHack(this.view, selection) || selection;\n if (!range || this.selectionRange.eq(range))\n return false;\n let local = hasSelection(this.dom, range);\n // Detect the situation where the browser has, on focus, moved the\n // selection to the start of the content element. Reset it to the\n // position from the editor state.\n if (local && !this.selectionChanged &&\n view.inputState.lastFocusTime > Date.now() - 200 &&\n view.inputState.lastTouchTime < Date.now() - 300 &&\n atElementStart(this.dom, range)) {\n this.view.inputState.lastFocusTime = 0;\n view.docView.updateSelection();\n return false;\n }\n this.selectionRange.setRange(range);\n if (local)\n this.selectionChanged = true;\n return true;\n }\n setSelectionRange(anchor, head) {\n this.selectionRange.set(anchor.node, anchor.offset, head.node, head.offset);\n this.selectionChanged = false;\n }\n clearSelectionRange() {\n this.selectionRange.set(null, 0, null, 0);\n }\n listenForScroll() {\n this.parentCheck = -1;\n let i = 0, changed = null;\n for (let dom = this.dom; dom;) {\n if (dom.nodeType == 1) {\n if (!changed && i < this.scrollTargets.length && this.scrollTargets[i] == dom)\n i++;\n else if (!changed)\n changed = this.scrollTargets.slice(0, i);\n if (changed)\n changed.push(dom);\n dom = dom.assignedSlot || dom.parentNode;\n }\n else if (dom.nodeType == 11) { // Shadow root\n dom = dom.host;\n }\n else {\n break;\n }\n }\n if (i < this.scrollTargets.length && !changed)\n changed = this.scrollTargets.slice(0, i);\n if (changed) {\n for (let dom of this.scrollTargets)\n dom.removeEventListener("scroll", this.onScroll);\n for (let dom of this.scrollTargets = changed)\n dom.addEventListener("scroll", this.onScroll);\n }\n }\n ignore(f) {\n if (!this.active)\n return f();\n try {\n this.stop();\n return f();\n }\n finally {\n this.start();\n this.clear();\n }\n }\n start() {\n if (this.active)\n return;\n this.observer.observe(this.dom, observeOptions);\n if (useCharData)\n this.dom.addEventListener("DOMCharacterDataModified", this.onCharData);\n this.active = true;\n }\n stop() {\n if (!this.active)\n return;\n this.active = false;\n this.observer.disconnect();\n if (useCharData)\n this.dom.removeEventListener("DOMCharacterDataModified", this.onCharData);\n }\n // Throw away any pending changes\n clear() {\n this.processRecords();\n this.queue.length = 0;\n this.selectionChanged = false;\n }\n // Chrome Android, especially in combination with GBoard, not only\n // doesn\'t reliably fire regular key events, but also often\n // surrounds the effect of enter or backspace with a bunch of\n // composition events that, when interrupted, cause text duplication\n // or other kinds of corruption. This hack makes the editor back off\n // from handling DOM changes for a moment when such a key is\n // detected (via beforeinput or keydown), and then tries to flush\n // them or, if that has no effect, dispatches the given key.\n delayAndroidKey(key, keyCode) {\n var _a;\n if (!this.delayedAndroidKey) {\n let flush = () => {\n let key = this.delayedAndroidKey;\n if (key) {\n this.clearDelayedAndroidKey();\n this.view.inputState.lastKeyCode = key.keyCode;\n this.view.inputState.lastKeyTime = Date.now();\n let flushed = this.flush();\n if (!flushed && key.force)\n dispatchKey(this.dom, key.key, key.keyCode);\n }\n };\n this.flushingAndroidKey = this.view.win.requestAnimationFrame(flush);\n }\n // Since backspace beforeinput is sometimes signalled spuriously,\n // Enter always takes precedence.\n if (!this.delayedAndroidKey || key == "Enter")\n this.delayedAndroidKey = {\n key, keyCode,\n // Only run the key handler when no changes are detected if\n // this isn\'t coming right after another change, in which case\n // it is probably part of a weird chain of updates, and should\n // be ignored if it returns the DOM to its previous state.\n force: this.lastChange < Date.now() - 50 || !!((_a = this.delayedAndroidKey) === null || _a === void 0 ? void 0 : _a.force)\n };\n }\n clearDelayedAndroidKey() {\n this.win.cancelAnimationFrame(this.flushingAndroidKey);\n this.delayedAndroidKey = null;\n this.flushingAndroidKey = -1;\n }\n flushSoon() {\n if (this.delayedFlush < 0)\n this.delayedFlush = this.view.win.requestAnimationFrame(() => { this.delayedFlush = -1; this.flush(); });\n }\n forceFlush() {\n if (this.delayedFlush >= 0) {\n this.view.win.cancelAnimationFrame(this.delayedFlush);\n this.delayedFlush = -1;\n }\n this.flush();\n }\n pendingRecords() {\n for (let mut of this.observer.takeRecords())\n this.queue.push(mut);\n return this.queue;\n }\n processRecords() {\n let records = this.pendingRecords();\n if (records.length)\n this.queue = [];\n let from = -1, to = -1, typeOver = false;\n for (let record of records) {\n let range = this.readMutation(record);\n if (!range)\n continue;\n if (range.typeOver)\n typeOver = true;\n if (from == -1) {\n ({ from, to } = range);\n }\n else {\n from = Math.min(range.from, from);\n to = Math.max(range.to, to);\n }\n }\n return { from, to, typeOver };\n }\n readChange() {\n let { from, to, typeOver } = this.processRecords();\n let newSel = this.selectionChanged && hasSelection(this.dom, this.selectionRange);\n if (from < 0 && !newSel)\n return null;\n if (from > -1)\n this.lastChange = Date.now();\n this.view.inputState.lastFocusTime = 0;\n this.selectionChanged = false;\n let change = new DOMChange(this.view, from, to, typeOver);\n this.view.docView.domChanged = { newSel: change.newSel ? change.newSel.main : null };\n return change;\n }\n // Apply pending changes, if any\n flush(readSelection = true) {\n // Completely hold off flushing when pending keys are set—the code\n // managing those will make sure processRecords is called and the\n // view is resynchronized after\n if (this.delayedFlush >= 0 || this.delayedAndroidKey)\n return false;\n if (readSelection)\n this.readSelectionRange();\n let domChange = this.readChange();\n if (!domChange) {\n this.view.requestMeasure();\n return false;\n }\n let startState = this.view.state;\n let handled = applyDOMChange(this.view, domChange);\n // The view wasn\'t updated but DOM/selection changes were seen. Reset the view.\n if (this.view.state == startState &&\n (domChange.domChanged || domChange.newSel && !domChange.newSel.main.eq(this.view.state.selection.main)))\n this.view.update([]);\n return handled;\n }\n readMutation(rec) {\n let cView = this.view.docView.nearest(rec.target);\n if (!cView || cView.ignoreMutation(rec))\n return null;\n cView.markDirty(rec.type == "attributes");\n if (rec.type == "attributes")\n cView.flags |= 4 /* ViewFlag.AttrsDirty */;\n if (rec.type == "childList") {\n let childBefore = findChild(cView, rec.previousSibling || rec.target.previousSibling, -1);\n let childAfter = findChild(cView, rec.nextSibling || rec.target.nextSibling, 1);\n return { from: childBefore ? cView.posAfter(childBefore) : cView.posAtStart,\n to: childAfter ? cView.posBefore(childAfter) : cView.posAtEnd, typeOver: false };\n }\n else if (rec.type == "characterData") {\n return { from: cView.posAtStart, to: cView.posAtEnd, typeOver: rec.target.nodeValue == rec.oldValue };\n }\n else {\n return null;\n }\n }\n setWindow(win) {\n if (win != this.win) {\n this.removeWindowListeners(this.win);\n this.win = win;\n this.addWindowListeners(this.win);\n }\n }\n addWindowListeners(win) {\n win.addEventListener("resize", this.onResize);\n if (this.printQuery) {\n if (this.printQuery.addEventListener)\n this.printQuery.addEventListener("change", this.onPrint);\n else\n this.printQuery.addListener(this.onPrint);\n }\n else\n win.addEventListener("beforeprint", this.onPrint);\n win.addEventListener("scroll", this.onScroll);\n win.document.addEventListener("selectionchange", this.onSelectionChange);\n }\n removeWindowListeners(win) {\n win.removeEventListener("scroll", this.onScroll);\n win.removeEventListener("resize", this.onResize);\n if (this.printQuery) {\n if (this.printQuery.removeEventListener)\n this.printQuery.removeEventListener("change", this.onPrint);\n else\n this.printQuery.removeListener(this.onPrint);\n }\n else\n win.removeEventListener("beforeprint", this.onPrint);\n win.document.removeEventListener("selectionchange", this.onSelectionChange);\n }\n update(update) {\n if (this.editContext) {\n this.editContext.update(update);\n if (update.startState.facet(editable) != update.state.facet(editable))\n update.view.contentDOM.editContext = update.state.facet(editable) ? this.editContext.editContext : null;\n }\n }\n destroy() {\n var _a, _b, _c;\n this.stop();\n (_a = this.intersection) === null || _a === void 0 ? void 0 : _a.disconnect();\n (_b = this.gapIntersection) === null || _b === void 0 ? void 0 : _b.disconnect();\n (_c = this.resizeScroll) === null || _c === void 0 ? void 0 : _c.disconnect();\n for (let dom of this.scrollTargets)\n dom.removeEventListener("scroll", this.onScroll);\n this.removeWindowListeners(this.win);\n clearTimeout(this.parentCheck);\n clearTimeout(this.resizeTimeout);\n this.win.cancelAnimationFrame(this.delayedFlush);\n this.win.cancelAnimationFrame(this.flushingAndroidKey);\n if (this.editContext) {\n this.view.contentDOM.editContext = null;\n this.editContext.destroy();\n }\n }\n}\nfunction findChild(cView, dom, dir) {\n while (dom) {\n let curView = ContentView.get(dom);\n if (curView && curView.parent == cView)\n return curView;\n let parent = dom.parentNode;\n dom = parent != cView.dom ? parent : dir > 0 ? dom.nextSibling : dom.previousSibling;\n }\n return null;\n}\nfunction buildSelectionRangeFromRange(view, range) {\n let anchorNode = range.startContainer, anchorOffset = range.startOffset;\n let focusNode = range.endContainer, focusOffset = range.endOffset;\n let curAnchor = view.docView.domAtPos(view.state.selection.main.anchor);\n // Since such a range doesn\'t distinguish between anchor and head,\n // use a heuristic that flips it around if its end matches the\n // current anchor.\n if (isEquivalentPosition(curAnchor.node, curAnchor.offset, focusNode, focusOffset))\n [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];\n return { anchorNode, anchorOffset, focusNode, focusOffset };\n}\n// Used to work around a Safari Selection/shadow DOM bug (#414)\nfunction safariSelectionRangeHack(view, selection) {\n if (selection.getComposedRanges) {\n let range = selection.getComposedRanges(view.root)[0];\n if (range)\n return buildSelectionRangeFromRange(view, range);\n }\n let found = null;\n // Because Safari (at least in 2018-2021) doesn\'t provide regular\n // access to the selection inside a shadowroot, we have to perform a\n // ridiculous hack to get at it—using `execCommand` to trigger a\n // `beforeInput` event so that we can read the target range from the\n // event.\n function read(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n found = event.getTargetRanges()[0];\n }\n view.contentDOM.addEventListener("beforeinput", read, true);\n view.dom.ownerDocument.execCommand("indent");\n view.contentDOM.removeEventListener("beforeinput", read, true);\n return found ? buildSelectionRangeFromRange(view, found) : null;\n}\nclass EditContextManager {\n constructor(view) {\n // The document window for which the text in the context is\n // maintained. For large documents, this may be smaller than the\n // editor document. This window always includes the selection head.\n this.from = 0;\n this.to = 0;\n // When applying a transaction, this is used to compare the change\n // made to the context content to the change in the transaction in\n // order to make the minimal changes to the context (since touching\n // that sometimes breaks series of multiple edits made for a single\n // user action on some Android keyboards)\n this.pendingContextChange = null;\n this.handlers = Object.create(null);\n this.resetRange(view.state);\n let context = this.editContext = new window.EditContext({\n text: view.state.doc.sliceString(this.from, this.to),\n selectionStart: this.toContextPos(Math.max(this.from, Math.min(this.to, view.state.selection.main.anchor))),\n selectionEnd: this.toContextPos(view.state.selection.main.head)\n });\n this.handlers.textupdate = e => {\n let { anchor } = view.state.selection.main;\n let change = { from: this.toEditorPos(e.updateRangeStart),\n to: this.toEditorPos(e.updateRangeEnd),\n insert: _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Text.of(e.text.split("\\n")) };\n // If the window doesn\'t include the anchor, assume changes\n // adjacent to a side go up to the anchor.\n if (change.from == this.from && anchor < this.from)\n change.from = anchor;\n else if (change.to == this.to && anchor > this.to)\n change.to = anchor;\n // Edit contexts sometimes fire empty changes\n if (change.from == change.to && !change.insert.length)\n return;\n this.pendingContextChange = change;\n if (!view.state.readOnly)\n applyDOMChangeInner(view, change, _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.single(this.toEditorPos(e.selectionStart), this.toEditorPos(e.selectionEnd)));\n // If the transaction didn\'t flush our change, revert it so\n // that the context is in sync with the editor state again.\n if (this.pendingContextChange) {\n this.revertPending(view.state);\n this.setSelection(view.state);\n }\n };\n this.handlers.characterboundsupdate = e => {\n let rects = [], prev = null;\n for (let i = this.toEditorPos(e.rangeStart), end = this.toEditorPos(e.rangeEnd); i < end; i++) {\n let rect = view.coordsForChar(i);\n prev = (rect && new DOMRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top))\n || prev || new DOMRect;\n rects.push(prev);\n }\n context.updateCharacterBounds(e.rangeStart, rects);\n };\n this.handlers.textformatupdate = e => {\n let deco = [];\n for (let format of e.getTextFormats()) {\n let lineStyle = format.underlineStyle, thickness = format.underlineThickness;\n if (lineStyle != "None" && thickness != "None") {\n let style = `text-decoration: underline ${lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : ""}${thickness == "Thin" ? 1 : 2}px`;\n deco.push(Decoration.mark({ attributes: { style } })\n .range(this.toEditorPos(format.rangeStart), this.toEditorPos(format.rangeEnd)));\n }\n }\n view.dispatch({ effects: setEditContextFormatting.of(Decoration.set(deco)) });\n };\n this.handlers.compositionstart = () => {\n if (view.inputState.composing < 0) {\n view.inputState.composing = 0;\n view.inputState.compositionFirstChange = true;\n }\n };\n this.handlers.compositionend = () => {\n view.inputState.composing = -1;\n view.inputState.compositionFirstChange = null;\n };\n for (let event in this.handlers)\n context.addEventListener(event, this.handlers[event]);\n this.measureReq = { read: view => {\n this.editContext.updateControlBounds(view.contentDOM.getBoundingClientRect());\n let sel = getSelection(view.root);\n if (sel && sel.rangeCount)\n this.editContext.updateSelectionBounds(sel.getRangeAt(0).getBoundingClientRect());\n } };\n }\n applyEdits(update) {\n let off = 0, abort = false, pending = this.pendingContextChange;\n update.changes.iterChanges((fromA, toA, _fromB, _toB, insert) => {\n if (abort)\n return;\n let dLen = insert.length - (toA - fromA);\n if (pending && toA >= pending.to) {\n if (pending.from == fromA && pending.to == toA && pending.insert.eq(insert)) {\n pending = this.pendingContextChange = null; // Match\n off += dLen;\n this.to += dLen;\n return;\n }\n else { // Mismatch, revert\n pending = null;\n this.revertPending(update.state);\n }\n }\n fromA += off;\n toA += off;\n if (toA <= this.from) { // Before the window\n this.from += dLen;\n this.to += dLen;\n }\n else if (fromA < this.to) { // Overlaps with window\n if (fromA < this.from || toA > this.to || (this.to - this.from) + insert.length > 30000 /* CxVp.MaxSize */) {\n abort = true;\n return;\n }\n this.editContext.updateText(this.toContextPos(fromA), this.toContextPos(toA), insert.toString());\n this.to += dLen;\n }\n off += dLen;\n });\n if (pending && !abort)\n this.revertPending(update.state);\n return !abort;\n }\n update(update) {\n let reverted = this.pendingContextChange;\n if (!this.applyEdits(update) || !this.rangeIsValid(update.state)) {\n this.pendingContextChange = null;\n this.resetRange(update.state);\n this.editContext.updateText(0, this.editContext.text.length, update.state.doc.sliceString(this.from, this.to));\n this.setSelection(update.state);\n }\n else if (update.docChanged || update.selectionSet || reverted) {\n this.setSelection(update.state);\n }\n if (update.geometryChanged || update.docChanged || update.selectionSet)\n update.view.requestMeasure(this.measureReq);\n }\n resetRange(state) {\n let { head } = state.selection.main;\n this.from = Math.max(0, head - 10000 /* CxVp.Margin */);\n this.to = Math.min(state.doc.length, head + 10000 /* CxVp.Margin */);\n }\n revertPending(state) {\n let pending = this.pendingContextChange;\n this.pendingContextChange = null;\n this.editContext.updateText(this.toContextPos(pending.from), this.toContextPos(pending.from + pending.insert.length), state.doc.sliceString(pending.from, pending.to));\n }\n setSelection(state) {\n let { main } = state.selection;\n let start = this.toContextPos(Math.max(this.from, Math.min(this.to, main.anchor)));\n let end = this.toContextPos(main.head);\n if (this.editContext.selectionStart != start || this.editContext.selectionEnd != end)\n this.editContext.updateSelection(start, end);\n }\n rangeIsValid(state) {\n let { head } = state.selection.main;\n return !(this.from > 0 && head - this.from < 500 /* CxVp.MinMargin */ ||\n this.to < state.doc.length && this.to - head < 500 /* CxVp.MinMargin */ ||\n this.to - this.from > 10000 /* CxVp.Margin */ * 3);\n }\n toEditorPos(contextPos) { return contextPos + this.from; }\n toContextPos(editorPos) { return editorPos - this.from; }\n destroy() {\n for (let event in this.handlers)\n this.editContext.removeEventListener(event, this.handlers[event]);\n }\n}\n\n// The editor\'s update state machine looks something like this:\n//\n// Idle → Updating ⇆ Idle (unchecked) → Measuring → Idle\n// ↑ ↓\n// Updating (measure)\n//\n// The difference between \'Idle\' and \'Idle (unchecked)\' lies in\n// whether a layout check has been scheduled. A regular update through\n// the `update` method updates the DOM in a write-only fashion, and\n// relies on a check (scheduled with `requestAnimationFrame`) to make\n// sure everything is where it should be and the viewport covers the\n// visible code. That check continues to measure and then optionally\n// update until it reaches a coherent state.\n/**\nAn editor view represents the editor\'s user interface. It holds\nthe editable DOM surface, and possibly other elements such as the\nline number gutter. It handles events and dispatches state\ntransactions for editing actions.\n*/\nclass EditorView {\n /**\n The current editor state.\n */\n get state() { return this.viewState.state; }\n /**\n To be able to display large documents without consuming too much\n memory or overloading the browser, CodeMirror only draws the\n code that is visible (plus a margin around it) to the DOM. This\n property tells you the extent of the current drawn viewport, in\n document positions.\n */\n get viewport() { return this.viewState.viewport; }\n /**\n When there are, for example, large collapsed ranges in the\n viewport, its size can be a lot bigger than the actual visible\n content. Thus, if you are doing something like styling the\n content in the viewport, it is preferable to only do so for\n these ranges, which are the subset of the viewport that is\n actually drawn.\n */\n get visibleRanges() { return this.viewState.visibleRanges; }\n /**\n Returns false when the editor is entirely scrolled out of view\n or otherwise hidden.\n */\n get inView() { return this.viewState.inView; }\n /**\n Indicates whether the user is currently composing text via\n [IME](https://en.wikipedia.org/wiki/Input_method), and at least\n one change has been made in the current composition.\n */\n get composing() { return this.inputState.composing > 0; }\n /**\n Indicates whether the user is currently in composing state. Note\n that on some platforms, like Android, this will be the case a\n lot, since just putting the cursor on a word starts a\n composition there.\n */\n get compositionStarted() { return this.inputState.composing >= 0; }\n /**\n The document or shadow root that the view lives in.\n */\n get root() { return this._root; }\n /**\n @internal\n */\n get win() { return this.dom.ownerDocument.defaultView || window; }\n /**\n Construct a new view. You\'ll want to either provide a `parent`\n option, or put `view.dom` into your document after creating a\n view, so that the user can see the editor.\n */\n constructor(config = {}) {\n this.plugins = [];\n this.pluginMap = new Map;\n this.editorAttrs = {};\n this.contentAttrs = {};\n this.bidiCache = [];\n this.destroyed = false;\n /**\n @internal\n */\n this.updateState = 2 /* UpdateState.Updating */;\n /**\n @internal\n */\n this.measureScheduled = -1;\n /**\n @internal\n */\n this.measureRequests = [];\n this.contentDOM = document.createElement("div");\n this.scrollDOM = document.createElement("div");\n this.scrollDOM.tabIndex = -1;\n this.scrollDOM.className = "cm-scroller";\n this.scrollDOM.appendChild(this.contentDOM);\n this.announceDOM = document.createElement("div");\n this.announceDOM.className = "cm-announced";\n this.announceDOM.setAttribute("aria-live", "polite");\n this.dom = document.createElement("div");\n this.dom.appendChild(this.announceDOM);\n this.dom.appendChild(this.scrollDOM);\n if (config.parent)\n config.parent.appendChild(this.dom);\n let { dispatch } = config;\n this.dispatchTransactions = config.dispatchTransactions ||\n (dispatch && ((trs) => trs.forEach(tr => dispatch(tr, this)))) ||\n ((trs) => this.update(trs));\n this.dispatch = this.dispatch.bind(this);\n this._root = (config.root || getRoot(config.parent) || document);\n this.viewState = new ViewState(config.state || _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorState.create(config));\n if (config.scrollTo && config.scrollTo.is(scrollIntoView))\n this.viewState.scrollTarget = config.scrollTo.value.clip(this.viewState.state);\n this.plugins = this.state.facet(viewPlugin).map(spec => new PluginInstance(spec));\n for (let plugin of this.plugins)\n plugin.update(this);\n this.observer = new DOMObserver(this);\n this.inputState = new InputState(this);\n this.inputState.ensureHandlers(this.plugins);\n this.docView = new DocView(this);\n this.mountStyles();\n this.updateAttrs();\n this.updateState = 0 /* UpdateState.Idle */;\n this.requestMeasure();\n }\n dispatch(...input) {\n let trs = input.length == 1 && input[0] instanceof _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Transaction ? input\n : input.length == 1 && Array.isArray(input[0]) ? input[0]\n : [this.state.update(...input)];\n this.dispatchTransactions(trs, this);\n }\n /**\n Update the view for the given array of transactions. This will\n update the visible document and selection to match the state\n produced by the transactions, and notify view plugins of the\n change. You should usually call\n [`dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) instead, which uses this\n as a primitive.\n */\n update(transactions) {\n if (this.updateState != 0 /* UpdateState.Idle */)\n throw new Error("Calls to EditorView.update are not allowed while an update is in progress");\n let redrawn = false, attrsChanged = false, update;\n let state = this.state;\n for (let tr of transactions) {\n if (tr.startState != state)\n throw new RangeError("Trying to update state with a transaction that doesn\'t start from the previous state.");\n state = tr.state;\n }\n if (this.destroyed) {\n this.viewState.state = state;\n return;\n }\n let focus = this.hasFocus, focusFlag = 0, dispatchFocus = null;\n if (transactions.some(tr => tr.annotation(isFocusChange))) {\n this.inputState.notifiedFocused = focus;\n // If a focus-change transaction is being dispatched, set this update flag.\n focusFlag = 1 /* UpdateFlag.Focus */;\n }\n else if (focus != this.inputState.notifiedFocused) {\n this.inputState.notifiedFocused = focus;\n // Schedule a separate focus transaction if necessary, otherwise\n // add a flag to this update\n dispatchFocus = focusChangeTransaction(state, focus);\n if (!dispatchFocus)\n focusFlag = 1 /* UpdateFlag.Focus */;\n }\n // If there was a pending DOM change, eagerly read it and try to\n // apply it after the given transactions.\n let pendingKey = this.observer.delayedAndroidKey, domChange = null;\n if (pendingKey) {\n this.observer.clearDelayedAndroidKey();\n domChange = this.observer.readChange();\n // Only try to apply DOM changes if the transactions didn\'t\n // change the doc or selection.\n if (domChange && !this.state.doc.eq(state.doc) || !this.state.selection.eq(state.selection))\n domChange = null;\n }\n else {\n this.observer.clear();\n }\n // When the phrases change, redraw the editor\n if (state.facet(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorState.phrases) != this.state.facet(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorState.phrases))\n return this.setState(state);\n update = ViewUpdate.create(this, state, transactions);\n update.flags |= focusFlag;\n let scrollTarget = this.viewState.scrollTarget;\n try {\n this.updateState = 2 /* UpdateState.Updating */;\n for (let tr of transactions) {\n if (scrollTarget)\n scrollTarget = scrollTarget.map(tr.changes);\n if (tr.scrollIntoView) {\n let { main } = tr.state.selection;\n scrollTarget = new ScrollTarget(main.empty ? main : _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(main.head, main.head > main.anchor ? -1 : 1));\n }\n for (let e of tr.effects)\n if (e.is(scrollIntoView))\n scrollTarget = e.value.clip(this.state);\n }\n this.viewState.update(update, scrollTarget);\n this.bidiCache = CachedOrder.update(this.bidiCache, update.changes);\n if (!update.empty) {\n this.updatePlugins(update);\n this.inputState.update(update);\n }\n redrawn = this.docView.update(update);\n if (this.state.facet(styleModule) != this.styleModules)\n this.mountStyles();\n attrsChanged = this.updateAttrs();\n this.showAnnouncements(transactions);\n this.docView.updateSelection(redrawn, transactions.some(tr => tr.isUserEvent("select.pointer")));\n }\n finally {\n this.updateState = 0 /* UpdateState.Idle */;\n }\n if (update.startState.facet(theme) != update.state.facet(theme))\n this.viewState.mustMeasureContent = true;\n if (redrawn || attrsChanged || scrollTarget || this.viewState.mustEnforceCursorAssoc || this.viewState.mustMeasureContent)\n this.requestMeasure();\n if (redrawn)\n this.docViewUpdate();\n if (!update.empty)\n for (let listener of this.state.facet(updateListener)) {\n try {\n listener(update);\n }\n catch (e) {\n logException(this.state, e, "update listener");\n }\n }\n if (dispatchFocus || domChange)\n Promise.resolve().then(() => {\n if (dispatchFocus && this.state == dispatchFocus.startState)\n this.dispatch(dispatchFocus);\n if (domChange) {\n if (!applyDOMChange(this, domChange) && pendingKey.force)\n dispatchKey(this.contentDOM, pendingKey.key, pendingKey.keyCode);\n }\n });\n }\n /**\n Reset the view to the given state. (This will cause the entire\n document to be redrawn and all view plugins to be reinitialized,\n so you should probably only use it when the new state isn\'t\n derived from the old state. Otherwise, use\n [`dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch) instead.)\n */\n setState(newState) {\n if (this.updateState != 0 /* UpdateState.Idle */)\n throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");\n if (this.destroyed) {\n this.viewState.state = newState;\n return;\n }\n this.updateState = 2 /* UpdateState.Updating */;\n let hadFocus = this.hasFocus;\n try {\n for (let plugin of this.plugins)\n plugin.destroy(this);\n this.viewState = new ViewState(newState);\n this.plugins = newState.facet(viewPlugin).map(spec => new PluginInstance(spec));\n this.pluginMap.clear();\n for (let plugin of this.plugins)\n plugin.update(this);\n this.docView.destroy();\n this.docView = new DocView(this);\n this.inputState.ensureHandlers(this.plugins);\n this.mountStyles();\n this.updateAttrs();\n this.bidiCache = [];\n }\n finally {\n this.updateState = 0 /* UpdateState.Idle */;\n }\n if (hadFocus)\n this.focus();\n this.requestMeasure();\n }\n updatePlugins(update) {\n let prevSpecs = update.startState.facet(viewPlugin), specs = update.state.facet(viewPlugin);\n if (prevSpecs != specs) {\n let newPlugins = [];\n for (let spec of specs) {\n let found = prevSpecs.indexOf(spec);\n if (found < 0) {\n newPlugins.push(new PluginInstance(spec));\n }\n else {\n let plugin = this.plugins[found];\n plugin.mustUpdate = update;\n newPlugins.push(plugin);\n }\n }\n for (let plugin of this.plugins)\n if (plugin.mustUpdate != update)\n plugin.destroy(this);\n this.plugins = newPlugins;\n this.pluginMap.clear();\n }\n else {\n for (let p of this.plugins)\n p.mustUpdate = update;\n }\n for (let i = 0; i < this.plugins.length; i++)\n this.plugins[i].update(this);\n if (prevSpecs != specs)\n this.inputState.ensureHandlers(this.plugins);\n }\n docViewUpdate() {\n for (let plugin of this.plugins) {\n let val = plugin.value;\n if (val && val.docViewUpdate) {\n try {\n val.docViewUpdate(this);\n }\n catch (e) {\n logException(this.state, e, "doc view update listener");\n }\n }\n }\n }\n /**\n @internal\n */\n measure(flush = true) {\n if (this.destroyed)\n return;\n if (this.measureScheduled > -1)\n this.win.cancelAnimationFrame(this.measureScheduled);\n if (this.observer.delayedAndroidKey) {\n this.measureScheduled = -1;\n this.requestMeasure();\n return;\n }\n this.measureScheduled = 0; // Prevent requestMeasure calls from scheduling another animation frame\n if (flush)\n this.observer.forceFlush();\n let updated = null;\n let sDOM = this.scrollDOM, scrollTop = sDOM.scrollTop * this.scaleY;\n let { scrollAnchorPos, scrollAnchorHeight } = this.viewState;\n if (Math.abs(scrollTop - this.viewState.scrollTop) > 1)\n scrollAnchorHeight = -1;\n this.viewState.scrollAnchorHeight = -1;\n try {\n for (let i = 0;; i++) {\n if (scrollAnchorHeight < 0) {\n if (isScrolledToBottom(sDOM)) {\n scrollAnchorPos = -1;\n scrollAnchorHeight = this.viewState.heightMap.height;\n }\n else {\n let block = this.viewState.scrollAnchorAt(scrollTop);\n scrollAnchorPos = block.from;\n scrollAnchorHeight = block.top;\n }\n }\n this.updateState = 1 /* UpdateState.Measuring */;\n let changed = this.viewState.measure(this);\n if (!changed && !this.measureRequests.length && this.viewState.scrollTarget == null)\n break;\n if (i > 5) {\n console.warn(this.measureRequests.length\n ? "Measure loop restarted more than 5 times"\n : "Viewport failed to stabilize");\n break;\n }\n let measuring = [];\n // Only run measure requests in this cycle when the viewport didn\'t change\n if (!(changed & 4 /* UpdateFlag.Viewport */))\n [this.measureRequests, measuring] = [measuring, this.measureRequests];\n let measured = measuring.map(m => {\n try {\n return m.read(this);\n }\n catch (e) {\n logException(this.state, e);\n return BadMeasure;\n }\n });\n let update = ViewUpdate.create(this, this.state, []), redrawn = false;\n update.flags |= changed;\n if (!updated)\n updated = update;\n else\n updated.flags |= changed;\n this.updateState = 2 /* UpdateState.Updating */;\n if (!update.empty) {\n this.updatePlugins(update);\n this.inputState.update(update);\n this.updateAttrs();\n redrawn = this.docView.update(update);\n if (redrawn)\n this.docViewUpdate();\n }\n for (let i = 0; i < measuring.length; i++)\n if (measured[i] != BadMeasure) {\n try {\n let m = measuring[i];\n if (m.write)\n m.write(measured[i], this);\n }\n catch (e) {\n logException(this.state, e);\n }\n }\n if (redrawn)\n this.docView.updateSelection(true);\n if (!update.viewportChanged && this.measureRequests.length == 0) {\n if (this.viewState.editorHeight) {\n if (this.viewState.scrollTarget) {\n this.docView.scrollIntoView(this.viewState.scrollTarget);\n this.viewState.scrollTarget = null;\n scrollAnchorHeight = -1;\n continue;\n }\n else {\n let newAnchorHeight = scrollAnchorPos < 0 ? this.viewState.heightMap.height :\n this.viewState.lineBlockAt(scrollAnchorPos).top;\n let diff = newAnchorHeight - scrollAnchorHeight;\n if (diff > 1 || diff < -1) {\n scrollTop = scrollTop + diff;\n sDOM.scrollTop = scrollTop / this.scaleY;\n scrollAnchorHeight = -1;\n continue;\n }\n }\n }\n break;\n }\n }\n }\n finally {\n this.updateState = 0 /* UpdateState.Idle */;\n this.measureScheduled = -1;\n }\n if (updated && !updated.empty)\n for (let listener of this.state.facet(updateListener))\n listener(updated);\n }\n /**\n Get the CSS classes for the currently active editor themes.\n */\n get themeClasses() {\n return baseThemeID + " " +\n (this.state.facet(darkTheme) ? baseDarkID : baseLightID) + " " +\n this.state.facet(theme);\n }\n updateAttrs() {\n let editorAttrs = attrsFromFacet(this, editorAttributes, {\n class: "cm-editor" + (this.hasFocus ? " cm-focused " : " ") + this.themeClasses\n });\n let contentAttrs = {\n spellcheck: "false",\n autocorrect: "off",\n autocapitalize: "off",\n translate: "no",\n contenteditable: !this.state.facet(editable) ? "false" : "true",\n class: "cm-content",\n style: `${browser.tabSize}: ${this.state.tabSize}`,\n role: "textbox",\n "aria-multiline": "true"\n };\n if (this.state.readOnly)\n contentAttrs["aria-readonly"] = "true";\n attrsFromFacet(this, contentAttributes, contentAttrs);\n let changed = this.observer.ignore(() => {\n let changedContent = updateAttrs(this.contentDOM, this.contentAttrs, contentAttrs);\n let changedEditor = updateAttrs(this.dom, this.editorAttrs, editorAttrs);\n return changedContent || changedEditor;\n });\n this.editorAttrs = editorAttrs;\n this.contentAttrs = contentAttrs;\n return changed;\n }\n showAnnouncements(trs) {\n let first = true;\n for (let tr of trs)\n for (let effect of tr.effects)\n if (effect.is(EditorView.announce)) {\n if (first)\n this.announceDOM.textContent = "";\n first = false;\n let div = this.announceDOM.appendChild(document.createElement("div"));\n div.textContent = effect.value;\n }\n }\n mountStyles() {\n this.styleModules = this.state.facet(styleModule);\n let nonce = this.state.facet(EditorView.cspNonce);\n style_mod__WEBPACK_IMPORTED_MODULE_0__.StyleModule.mount(this.root, this.styleModules.concat(baseTheme$1).reverse(), nonce ? { nonce } : undefined);\n }\n readMeasured() {\n if (this.updateState == 2 /* UpdateState.Updating */)\n throw new Error("Reading the editor layout isn\'t allowed during an update");\n if (this.updateState == 0 /* UpdateState.Idle */ && this.measureScheduled > -1)\n this.measure(false);\n }\n /**\n Schedule a layout measurement, optionally providing callbacks to\n do custom DOM measuring followed by a DOM write phase. Using\n this is preferable reading DOM layout directly from, for\n example, an event handler, because it\'ll make sure measuring and\n drawing done by other components is synchronized, avoiding\n unnecessary DOM layout computations.\n */\n requestMeasure(request) {\n if (this.measureScheduled < 0)\n this.measureScheduled = this.win.requestAnimationFrame(() => this.measure());\n if (request) {\n if (this.measureRequests.indexOf(request) > -1)\n return;\n if (request.key != null)\n for (let i = 0; i < this.measureRequests.length; i++) {\n if (this.measureRequests[i].key === request.key) {\n this.measureRequests[i] = request;\n return;\n }\n }\n this.measureRequests.push(request);\n }\n }\n /**\n Get the value of a specific plugin, if present. Note that\n plugins that crash can be dropped from a view, so even when you\n know you registered a given plugin, it is recommended to check\n the return value of this method.\n */\n plugin(plugin) {\n let known = this.pluginMap.get(plugin);\n if (known === undefined || known && known.spec != plugin)\n this.pluginMap.set(plugin, known = this.plugins.find(p => p.spec == plugin) || null);\n return known && known.update(this).value;\n }\n /**\n The top position of the document, in screen coordinates. This\n may be negative when the editor is scrolled down. Points\n directly to the top of the first line, not above the padding.\n */\n get documentTop() {\n return this.contentDOM.getBoundingClientRect().top + this.viewState.paddingTop;\n }\n /**\n Reports the padding above and below the document.\n */\n get documentPadding() {\n return { top: this.viewState.paddingTop, bottom: this.viewState.paddingBottom };\n }\n /**\n If the editor is transformed with CSS, this provides the scale\n along the X axis. Otherwise, it will just be 1. Note that\n transforms other than translation and scaling are not supported.\n */\n get scaleX() { return this.viewState.scaleX; }\n /**\n Provide the CSS transformed scale along the Y axis.\n */\n get scaleY() { return this.viewState.scaleY; }\n /**\n Find the text line or block widget at the given vertical\n position (which is interpreted as relative to the [top of the\n document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop)).\n */\n elementAtHeight(height) {\n this.readMeasured();\n return this.viewState.elementAtHeight(height);\n }\n /**\n Find the line block (see\n [`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given\n height, again interpreted relative to the [top of the\n document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop).\n */\n lineBlockAtHeight(height) {\n this.readMeasured();\n return this.viewState.lineBlockAtHeight(height);\n }\n /**\n Get the extent and vertical position of all [line\n blocks](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) in the viewport. Positions\n are relative to the [top of the\n document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop);\n */\n get viewportLineBlocks() {\n return this.viewState.viewportLines;\n }\n /**\n Find the line block around the given document position. A line\n block is a range delimited on both sides by either a\n non-[hidden](https://codemirror.net/6/docs/ref/#view.Decoration^replace) line breaks, or the\n start/end of the document. It will usually just hold a line of\n text, but may be broken into multiple textblocks by block\n widgets.\n */\n lineBlockAt(pos) {\n return this.viewState.lineBlockAt(pos);\n }\n /**\n The editor\'s total content height.\n */\n get contentHeight() {\n return this.viewState.contentHeight;\n }\n /**\n Move a cursor position by [grapheme\n cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak). `forward` determines whether\n the motion is away from the line start, or towards it. In\n bidirectional text, the line is traversed in visual order, using\n the editor\'s [text direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection).\n When the start position was the last one on the line, the\n returned position will be across the line break. If there is no\n further line, the original position is returned.\n \n By default, this method moves over a single cluster. The\n optional `by` argument can be used to move across more. It will\n be called with the first cluster as argument, and should return\n a predicate that determines, for each subsequent cluster,\n whether it should also be moved over.\n */\n moveByChar(start, forward, by) {\n return skipAtoms(this, start, moveByChar(this, start, forward, by));\n }\n /**\n Move a cursor position across the next group of either\n [letters](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) or non-letter\n non-whitespace characters.\n */\n moveByGroup(start, forward) {\n return skipAtoms(this, start, moveByChar(this, start, forward, initial => byGroup(this, start.head, initial)));\n }\n /**\n Get the cursor position visually at the start or end of a line.\n Note that this may differ from the _logical_ position at its\n start or end (which is simply at `line.from`/`line.to`) if text\n at the start or end goes against the line\'s base text direction.\n */\n visualLineSide(line, end) {\n let order = this.bidiSpans(line), dir = this.textDirectionAt(line.from);\n let span = order[end ? order.length - 1 : 0];\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(span.side(end, dir) + line.from, span.forward(!end, dir) ? 1 : -1);\n }\n /**\n Move to the next line boundary in the given direction. If\n `includeWrap` is true, line wrapping is on, and there is a\n further wrap point on the current line, the wrap point will be\n returned. Otherwise this function will return the start or end\n of the line.\n */\n moveToLineBoundary(start, forward, includeWrap = true) {\n return moveToLineBoundary(this, start, forward, includeWrap);\n }\n /**\n Move a cursor position vertically. When `distance` isn\'t given,\n it defaults to moving to the next line (including wrapped\n lines). Otherwise, `distance` should provide a positive distance\n in pixels.\n \n When `start` has a\n [`goalColumn`](https://codemirror.net/6/docs/ref/#state.SelectionRange.goalColumn), the vertical\n motion will use that as a target horizontal position. Otherwise,\n the cursor\'s own horizontal position is used. The returned\n cursor will have its goal column set to whichever column was\n used.\n */\n moveVertically(start, forward, distance) {\n return skipAtoms(this, start, moveVertically(this, start, forward, distance));\n }\n /**\n Find the DOM parent node and offset (child offset if `node` is\n an element, character offset when it is a text node) at the\n given document position.\n \n Note that for positions that aren\'t currently in\n `visibleRanges`, the resulting DOM position isn\'t necessarily\n meaningful (it may just point before or after a placeholder\n element).\n */\n domAtPos(pos) {\n return this.docView.domAtPos(pos);\n }\n /**\n Find the document position at the given DOM node. Can be useful\n for associating positions with DOM events. Will raise an error\n when `node` isn\'t part of the editor content.\n */\n posAtDOM(node, offset = 0) {\n return this.docView.posFromDOM(node, offset);\n }\n posAtCoords(coords, precise = true) {\n this.readMeasured();\n return posAtCoords(this, coords, precise);\n }\n /**\n Get the screen coordinates at the given document position.\n `side` determines whether the coordinates are based on the\n element before (-1) or after (1) the position (if no element is\n available on the given side, the method will transparently use\n another strategy to get reasonable coordinates).\n */\n coordsAtPos(pos, side = 1) {\n this.readMeasured();\n let rect = this.docView.coordsAt(pos, side);\n if (!rect || rect.left == rect.right)\n return rect;\n let line = this.state.doc.lineAt(pos), order = this.bidiSpans(line);\n let span = order[BidiSpan.find(order, pos - line.from, -1, side)];\n return flattenRect(rect, (span.dir == Direction.LTR) == (side > 0));\n }\n /**\n Return the rectangle around a given character. If `pos` does not\n point in front of a character that is in the viewport and\n rendered (i.e. not replaced, not a line break), this will return\n null. For space characters that are a line wrap point, this will\n return the position before the line break.\n */\n coordsForChar(pos) {\n this.readMeasured();\n return this.docView.coordsForChar(pos);\n }\n /**\n The default width of a character in the editor. May not\n accurately reflect the width of all characters (given variable\n width fonts or styling of invididual ranges).\n */\n get defaultCharacterWidth() { return this.viewState.heightOracle.charWidth; }\n /**\n The default height of a line in the editor. May not be accurate\n for all lines.\n */\n get defaultLineHeight() { return this.viewState.heightOracle.lineHeight; }\n /**\n The text direction\n ([`direction`](https://developer.mozilla.org/en-US/docs/Web/CSS/direction)\n CSS property) of the editor\'s content element.\n */\n get textDirection() { return this.viewState.defaultTextDirection; }\n /**\n Find the text direction of the block at the given position, as\n assigned by CSS. If\n [`perLineTextDirection`](https://codemirror.net/6/docs/ref/#view.EditorView^perLineTextDirection)\n isn\'t enabled, or the given position is outside of the viewport,\n this will always return the same as\n [`textDirection`](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection). Note that\n this may trigger a DOM layout.\n */\n textDirectionAt(pos) {\n let perLine = this.state.facet(perLineTextDirection);\n if (!perLine || pos < this.viewport.from || pos > this.viewport.to)\n return this.textDirection;\n this.readMeasured();\n return this.docView.textDirectionAt(pos);\n }\n /**\n Whether this editor [wraps lines](https://codemirror.net/6/docs/ref/#view.EditorView.lineWrapping)\n (as determined by the\n [`white-space`](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space)\n CSS property of its content element).\n */\n get lineWrapping() { return this.viewState.heightOracle.lineWrapping; }\n /**\n Returns the bidirectional text structure of the given line\n (which should be in the current document) as an array of span\n objects. The order of these spans matches the [text\n direction](https://codemirror.net/6/docs/ref/#view.EditorView.textDirection)—if that is\n left-to-right, the leftmost spans come first, otherwise the\n rightmost spans come first.\n */\n bidiSpans(line) {\n if (line.length > MaxBidiLine)\n return trivialOrder(line.length);\n let dir = this.textDirectionAt(line.from), isolates;\n for (let entry of this.bidiCache) {\n if (entry.from == line.from && entry.dir == dir &&\n (entry.fresh || isolatesEq(entry.isolates, isolates = getIsolatedRanges(this, line))))\n return entry.order;\n }\n if (!isolates)\n isolates = getIsolatedRanges(this, line);\n let order = computeOrder(line.text, dir, isolates);\n this.bidiCache.push(new CachedOrder(line.from, line.to, dir, isolates, true, order));\n return order;\n }\n /**\n Check whether the editor has focus.\n */\n get hasFocus() {\n var _a;\n // Safari return false for hasFocus when the context menu is open\n // or closing, which leads us to ignore selection changes from the\n // context menu because it looks like the editor isn\'t focused.\n // This kludges around that.\n return (this.dom.ownerDocument.hasFocus() || browser.safari && ((_a = this.inputState) === null || _a === void 0 ? void 0 : _a.lastContextMenu) > Date.now() - 3e4) &&\n this.root.activeElement == this.contentDOM;\n }\n /**\n Put focus on the editor.\n */\n focus() {\n this.observer.ignore(() => {\n focusPreventScroll(this.contentDOM);\n this.docView.updateSelection();\n });\n }\n /**\n Update the [root](https://codemirror.net/6/docs/ref/##view.EditorViewConfig.root) in which the editor lives. This is only\n necessary when moving the editor\'s existing DOM to a new window or shadow root.\n */\n setRoot(root) {\n if (this._root != root) {\n this._root = root;\n this.observer.setWindow((root.nodeType == 9 ? root : root.ownerDocument).defaultView || window);\n this.mountStyles();\n }\n }\n /**\n Clean up this editor view, removing its element from the\n document, unregistering event handlers, and notifying\n plugins. The view instance can no longer be used after\n calling this.\n */\n destroy() {\n if (this.root.activeElement == this.contentDOM)\n this.contentDOM.blur();\n for (let plugin of this.plugins)\n plugin.destroy(this);\n this.plugins = [];\n this.inputState.destroy();\n this.docView.destroy();\n this.dom.remove();\n this.observer.destroy();\n if (this.measureScheduled > -1)\n this.win.cancelAnimationFrame(this.measureScheduled);\n this.destroyed = true;\n }\n /**\n Returns an effect that can be\n [added](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) to a transaction to\n cause it to scroll the given position or range into view.\n */\n static scrollIntoView(pos, options = {}) {\n return scrollIntoView.of(new ScrollTarget(typeof pos == "number" ? _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(pos) : pos, options.y, options.x, options.yMargin, options.xMargin));\n }\n /**\n Return an effect that resets the editor to its current (at the\n time this method was called) scroll position. Note that this\n only affects the editor\'s own scrollable element, not parents.\n See also\n [`EditorViewConfig.scrollTo`](https://codemirror.net/6/docs/ref/#view.EditorViewConfig.scrollTo).\n \n The effect should be used with a document identical to the one\n it was created for. Failing to do so is not an error, but may\n not scroll to the expected position. You can\n [map](https://codemirror.net/6/docs/ref/#state.StateEffect.map) the effect to account for changes.\n */\n scrollSnapshot() {\n let { scrollTop, scrollLeft } = this.scrollDOM;\n let ref = this.viewState.scrollAnchorAt(scrollTop);\n return scrollIntoView.of(new ScrollTarget(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(ref.from), "start", "start", ref.top - scrollTop, scrollLeft, true));\n }\n /**\n Enable or disable tab-focus mode, which disables key bindings\n for Tab and Shift-Tab, letting the browser\'s default\n focus-changing behavior go through instead. This is useful to\n prevent trapping keyboard users in your editor.\n \n Without argument, this toggles the mode. With a boolean, it\n enables (true) or disables it (false). Given a number, it\n temporarily enables the mode until that number of milliseconds\n have passed or another non-Tab key is pressed.\n */\n setTabFocusMode(to) {\n if (to == null)\n this.inputState.tabFocusMode = this.inputState.tabFocusMode < 0 ? 0 : -1;\n else if (typeof to == "boolean")\n this.inputState.tabFocusMode = to ? 0 : -1;\n else if (this.inputState.tabFocusMode != 0)\n this.inputState.tabFocusMode = Date.now() + to;\n }\n /**\n Returns an extension that can be used to add DOM event handlers.\n The value should be an object mapping event names to handler\n functions. For any given event, such functions are ordered by\n extension precedence, and the first handler to return true will\n be assumed to have handled that event, and no other handlers or\n built-in behavior will be activated for it. These are registered\n on the [content element](https://codemirror.net/6/docs/ref/#view.EditorView.contentDOM), except\n for `scroll` handlers, which will be called any time the\n editor\'s [scroll element](https://codemirror.net/6/docs/ref/#view.EditorView.scrollDOM) or one of\n its parent nodes is scrolled.\n */\n static domEventHandlers(handlers) {\n return ViewPlugin.define(() => ({}), { eventHandlers: handlers });\n }\n /**\n Create an extension that registers DOM event observers. Contrary\n to event [handlers](https://codemirror.net/6/docs/ref/#view.EditorView^domEventHandlers),\n observers can\'t be prevented from running by a higher-precedence\n handler returning true. They also don\'t prevent other handlers\n and observers from running when they return true, and should not\n call `preventDefault`.\n */\n static domEventObservers(observers) {\n return ViewPlugin.define(() => ({}), { eventObservers: observers });\n }\n /**\n Create a theme extension. The first argument can be a\n [`style-mod`](https://github.com/marijnh/style-mod#documentation)\n style spec providing the styles for the theme. These will be\n prefixed with a generated class for the style.\n \n Because the selectors will be prefixed with a scope class, rule\n that directly match the editor\'s [wrapper\n element](https://codemirror.net/6/docs/ref/#view.EditorView.dom)—to which the scope class will be\n added—need to be explicitly differentiated by adding an `&` to\n the selector for that element—for example\n `&.cm-focused`.\n \n When `dark` is set to true, the theme will be marked as dark,\n which will cause the `&dark` rules from [base\n themes](https://codemirror.net/6/docs/ref/#view.EditorView^baseTheme) to be used (as opposed to\n `&light` when a light theme is active).\n */\n static theme(spec, options) {\n let prefix = style_mod__WEBPACK_IMPORTED_MODULE_0__.StyleModule.newName();\n let result = [theme.of(prefix), styleModule.of(buildTheme(`.${prefix}`, spec))];\n if (options && options.dark)\n result.push(darkTheme.of(true));\n return result;\n }\n /**\n Create an extension that adds styles to the base theme. Like\n with [`theme`](https://codemirror.net/6/docs/ref/#view.EditorView^theme), use `&` to indicate the\n place of the editor wrapper element when directly targeting\n that. You can also use `&dark` or `&light` instead to only\n target editors with a dark or light theme.\n */\n static baseTheme(spec) {\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Prec.lowest(styleModule.of(buildTheme("." + baseThemeID, spec, lightDarkIDs)));\n }\n /**\n Retrieve an editor view instance from the view\'s DOM\n representation.\n */\n static findFromDOM(dom) {\n var _a;\n let content = dom.querySelector(".cm-content");\n let cView = content && ContentView.get(content) || ContentView.get(dom);\n return ((_a = cView === null || cView === void 0 ? void 0 : cView.rootView) === null || _a === void 0 ? void 0 : _a.view) || null;\n }\n}\n/**\nFacet to add a [style\nmodule](https://github.com/marijnh/style-mod#documentation) to\nan editor view. The view will ensure that the module is\nmounted in its [document\nroot](https://codemirror.net/6/docs/ref/#view.EditorView.constructor^config.root).\n*/\nEditorView.styleModule = styleModule;\n/**\nAn input handler can override the way changes to the editable\nDOM content are handled. Handlers are passed the document\npositions between which the change was found, and the new\ncontent. When one returns true, no further input handlers are\ncalled and the default behavior is prevented.\n\nThe `insert` argument can be used to get the default transaction\nthat would be applied for this input. This can be useful when\ndispatching the custom behavior as a separate transaction.\n*/\nEditorView.inputHandler = inputHandler;\n/**\nScroll handlers can override how things are scrolled into view.\nIf they return `true`, no further handling happens for the\nscrolling. If they return false, the default scroll behavior is\napplied. Scroll handlers should never initiate editor updates.\n*/\nEditorView.scrollHandler = scrollHandler;\n/**\nThis facet can be used to provide functions that create effects\nto be dispatched when the editor\'s focus state changes.\n*/\nEditorView.focusChangeEffect = focusChangeEffect;\n/**\nBy default, the editor assumes all its content has the same\n[text direction](https://codemirror.net/6/docs/ref/#view.Direction). Configure this with a `true`\nvalue to make it read the text direction of every (rendered)\nline separately.\n*/\nEditorView.perLineTextDirection = perLineTextDirection;\n/**\nAllows you to provide a function that should be called when the\nlibrary catches an exception from an extension (mostly from view\nplugins, but may be used by other extensions to route exceptions\nfrom user-code-provided callbacks). This is mostly useful for\ndebugging and logging. See [`logException`](https://codemirror.net/6/docs/ref/#view.logException).\n*/\nEditorView.exceptionSink = exceptionSink;\n/**\nA facet that can be used to register a function to be called\nevery time the view updates.\n*/\nEditorView.updateListener = updateListener;\n/**\nFacet that controls whether the editor content DOM is editable.\nWhen its highest-precedence value is `false`, the element will\nnot have its `contenteditable` attribute set. (Note that this\ndoesn\'t affect API calls that change the editor content, even\nwhen those are bound to keys or buttons. See the\n[`readOnly`](https://codemirror.net/6/docs/ref/#state.EditorState.readOnly) facet for that.)\n*/\nEditorView.editable = editable;\n/**\nAllows you to influence the way mouse selection happens. The\nfunctions in this facet will be called for a `mousedown` event\non the editor, and can return an object that overrides the way a\nselection is computed from that mouse click or drag.\n*/\nEditorView.mouseSelectionStyle = mouseSelectionStyle;\n/**\nFacet used to configure whether a given selection drag event\nshould move or copy the selection. The given predicate will be\ncalled with the `mousedown` event, and can return `true` when\nthe drag should move the content.\n*/\nEditorView.dragMovesSelection = dragMovesSelection$1;\n/**\nFacet used to configure whether a given selecting click adds a\nnew range to the existing selection or replaces it entirely. The\ndefault behavior is to check `event.metaKey` on macOS, and\n`event.ctrlKey` elsewhere.\n*/\nEditorView.clickAddsSelectionRange = clickAddsSelectionRange;\n/**\nA facet that determines which [decorations](https://codemirror.net/6/docs/ref/#view.Decoration)\nare shown in the view. Decorations can be provided in two\nways—directly, or via a function that takes an editor view.\n\nOnly decoration sets provided directly are allowed to influence\nthe editor\'s vertical layout structure. The ones provided as\nfunctions are called _after_ the new viewport has been computed,\nand thus **must not** introduce block widgets or replacing\ndecorations that cover line breaks.\n\nIf you want decorated ranges to behave like atomic units for\ncursor motion and deletion purposes, also provide the range set\ncontaining the decorations to\n[`EditorView.atomicRanges`](https://codemirror.net/6/docs/ref/#view.EditorView^atomicRanges).\n*/\nEditorView.decorations = decorations;\n/**\nFacet that works much like\n[`decorations`](https://codemirror.net/6/docs/ref/#view.EditorView^decorations), but puts its\ninputs at the very bottom of the precedence stack, meaning mark\ndecorations provided here will only be split by other, partially\noverlapping \\`outerDecorations\\` ranges, and wrap around all\nregular decorations. Use this for mark elements that should, as\nmuch as possible, remain in one piece.\n*/\nEditorView.outerDecorations = outerDecorations;\n/**\nUsed to provide ranges that should be treated as atoms as far as\ncursor motion is concerned. This causes methods like\n[`moveByChar`](https://codemirror.net/6/docs/ref/#view.EditorView.moveByChar) and\n[`moveVertically`](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) (and the\ncommands built on top of them) to skip across such regions when\na selection endpoint would enter them. This does _not_ prevent\ndirect programmatic [selection\nupdates](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) from moving into such\nregions.\n*/\nEditorView.atomicRanges = atomicRanges;\n/**\nWhen range decorations add a `unicode-bidi: isolate` style, they\nshould also include a\n[`bidiIsolate`](https://codemirror.net/6/docs/ref/#view.MarkDecorationSpec.bidiIsolate) property\nin their decoration spec, and be exposed through this facet, so\nthat the editor can compute the proper text order. (Other values\nfor `unicode-bidi`, except of course `normal`, are not\nsupported.)\n*/\nEditorView.bidiIsolatedRanges = bidiIsolatedRanges;\n/**\nFacet that allows extensions to provide additional scroll\nmargins (space around the sides of the scrolling element that\nshould be considered invisible). This can be useful when the\nplugin introduces elements that cover part of that element (for\nexample a horizontally fixed gutter).\n*/\nEditorView.scrollMargins = scrollMargins;\n/**\nThis facet records whether a dark theme is active. The extension\nreturned by [`theme`](https://codemirror.net/6/docs/ref/#view.EditorView^theme) automatically\nincludes an instance of this when the `dark` option is set to\ntrue.\n*/\nEditorView.darkTheme = darkTheme;\n/**\nProvides a Content Security Policy nonce to use when creating\nthe style sheets for the editor. Holds the empty string when no\nnonce has been provided.\n*/\nEditorView.cspNonce = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({ combine: values => values.length ? values[0] : "" });\n/**\nFacet that provides additional DOM attributes for the editor\'s\neditable DOM element.\n*/\nEditorView.contentAttributes = contentAttributes;\n/**\nFacet that provides DOM attributes for the editor\'s outer\nelement.\n*/\nEditorView.editorAttributes = editorAttributes;\n/**\nAn extension that enables line wrapping in the editor (by\nsetting CSS `white-space` to `pre-wrap` in the content).\n*/\nEditorView.lineWrapping = /*@__PURE__*/EditorView.contentAttributes.of({ "class": "cm-lineWrapping" });\n/**\nState effect used to include screen reader announcements in a\ntransaction. These will be added to the DOM in a visually hidden\nelement with `aria-live="polite"` set, and should be used to\ndescribe effects that are visually obvious but may not be\nnoticed by screen reader users (such as moving to the next\nsearch match).\n*/\nEditorView.announce = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define();\n// Maximum line length for which we compute accurate bidi info\nconst MaxBidiLine = 4096;\nconst BadMeasure = {};\nclass CachedOrder {\n constructor(from, to, dir, isolates, fresh, order) {\n this.from = from;\n this.to = to;\n this.dir = dir;\n this.isolates = isolates;\n this.fresh = fresh;\n this.order = order;\n }\n static update(cache, changes) {\n if (changes.empty && !cache.some(c => c.fresh))\n return cache;\n let result = [], lastDir = cache.length ? cache[cache.length - 1].dir : Direction.LTR;\n for (let i = Math.max(0, cache.length - 10); i < cache.length; i++) {\n let entry = cache[i];\n if (entry.dir == lastDir && !changes.touchesRange(entry.from, entry.to))\n result.push(new CachedOrder(changes.mapPos(entry.from, 1), changes.mapPos(entry.to, -1), entry.dir, entry.isolates, false, entry.order));\n }\n return result;\n }\n}\nfunction attrsFromFacet(view, facet, base) {\n for (let sources = view.state.facet(facet), i = sources.length - 1; i >= 0; i--) {\n let source = sources[i], value = typeof source == "function" ? source(view) : source;\n if (value)\n combineAttrs(value, base);\n }\n return base;\n}\n\nconst currentPlatform = browser.mac ? "mac" : browser.windows ? "win" : browser.linux ? "linux" : "key";\nfunction normalizeKeyName(name, platform) {\n const parts = name.split(/-(?!$)/);\n let result = parts[parts.length - 1];\n if (result == "Space")\n result = " ";\n let alt, ctrl, shift, meta;\n for (let i = 0; i < parts.length - 1; ++i) {\n const mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod))\n meta = true;\n else if (/^a(lt)?$/i.test(mod))\n alt = true;\n else if (/^(c|ctrl|control)$/i.test(mod))\n ctrl = true;\n else if (/^s(hift)?$/i.test(mod))\n shift = true;\n else if (/^mod$/i.test(mod)) {\n if (platform == "mac")\n meta = true;\n else\n ctrl = true;\n }\n else\n throw new Error("Unrecognized modifier name: " + mod);\n }\n if (alt)\n result = "Alt-" + result;\n if (ctrl)\n result = "Ctrl-" + result;\n if (meta)\n result = "Meta-" + result;\n if (shift)\n result = "Shift-" + result;\n return result;\n}\nfunction modifiers(name, event, shift) {\n if (event.altKey)\n name = "Alt-" + name;\n if (event.ctrlKey)\n name = "Ctrl-" + name;\n if (event.metaKey)\n name = "Meta-" + name;\n if (shift !== false && event.shiftKey)\n name = "Shift-" + name;\n return name;\n}\nconst handleKeyEvents = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Prec.default(/*@__PURE__*/EditorView.domEventHandlers({\n keydown(event, view) {\n return runHandlers(getKeymap(view.state), event, view, "editor");\n }\n}));\n/**\nFacet used for registering keymaps.\n\nYou can add multiple keymaps to an editor. Their priorities\ndetermine their precedence (the ones specified early or with high\npriority get checked first). When a handler has returned `true`\nfor a given key, no further handlers are called.\n*/\nconst keymap = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({ enables: handleKeyEvents });\nconst Keymaps = /*@__PURE__*/new WeakMap();\n// This is hidden behind an indirection, rather than directly computed\n// by the facet, to keep internal types out of the facet\'s type.\nfunction getKeymap(state) {\n let bindings = state.facet(keymap);\n let map = Keymaps.get(bindings);\n if (!map)\n Keymaps.set(bindings, map = buildKeymap(bindings.reduce((a, b) => a.concat(b), [])));\n return map;\n}\n/**\nRun the key handlers registered for a given scope. The event\nobject should be a `"keydown"` event. Returns true if any of the\nhandlers handled it.\n*/\nfunction runScopeHandlers(view, event, scope) {\n return runHandlers(getKeymap(view.state), event, view, scope);\n}\nlet storedPrefix = null;\nconst PrefixTimeout = 4000;\nfunction buildKeymap(bindings, platform = currentPlatform) {\n let bound = Object.create(null);\n let isPrefix = Object.create(null);\n let checkPrefix = (name, is) => {\n let current = isPrefix[name];\n if (current == null)\n isPrefix[name] = is;\n else if (current != is)\n throw new Error("Key binding " + name + " is used both as a regular binding and as a multi-stroke prefix");\n };\n let add = (scope, key, command, preventDefault, stopPropagation) => {\n var _a, _b;\n let scopeObj = bound[scope] || (bound[scope] = Object.create(null));\n let parts = key.split(/ (?!$)/).map(k => normalizeKeyName(k, platform));\n for (let i = 1; i < parts.length; i++) {\n let prefix = parts.slice(0, i).join(" ");\n checkPrefix(prefix, true);\n if (!scopeObj[prefix])\n scopeObj[prefix] = {\n preventDefault: true,\n stopPropagation: false,\n run: [(view) => {\n let ourObj = storedPrefix = { view, prefix, scope };\n setTimeout(() => { if (storedPrefix == ourObj)\n storedPrefix = null; }, PrefixTimeout);\n return true;\n }]\n };\n }\n let full = parts.join(" ");\n checkPrefix(full, false);\n let binding = scopeObj[full] || (scopeObj[full] = {\n preventDefault: false,\n stopPropagation: false,\n run: ((_b = (_a = scopeObj._any) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.slice()) || []\n });\n if (command)\n binding.run.push(command);\n if (preventDefault)\n binding.preventDefault = true;\n if (stopPropagation)\n binding.stopPropagation = true;\n };\n for (let b of bindings) {\n let scopes = b.scope ? b.scope.split(" ") : ["editor"];\n if (b.any)\n for (let scope of scopes) {\n let scopeObj = bound[scope] || (bound[scope] = Object.create(null));\n if (!scopeObj._any)\n scopeObj._any = { preventDefault: false, stopPropagation: false, run: [] };\n let { any } = b;\n for (let key in scopeObj)\n scopeObj[key].run.push(view => any(view, currentKeyEvent));\n }\n let name = b[platform] || b.key;\n if (!name)\n continue;\n for (let scope of scopes) {\n add(scope, name, b.run, b.preventDefault, b.stopPropagation);\n if (b.shift)\n add(scope, "Shift-" + name, b.shift, b.preventDefault, b.stopPropagation);\n }\n }\n return bound;\n}\nlet currentKeyEvent = null;\nfunction runHandlers(map, event, view, scope) {\n currentKeyEvent = event;\n let name = (0,w3c_keyname__WEBPACK_IMPORTED_MODULE_1__.keyName)(event);\n let charCode = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.codePointAt)(name, 0), isChar = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.codePointSize)(charCode) == name.length && name != " ";\n let prefix = "", handled = false, prevented = false, stopPropagation = false;\n if (storedPrefix && storedPrefix.view == view && storedPrefix.scope == scope) {\n prefix = storedPrefix.prefix + " ";\n if (modifierCodes.indexOf(event.keyCode) < 0) {\n prevented = true;\n storedPrefix = null;\n }\n }\n let ran = new Set;\n let runFor = (binding) => {\n if (binding) {\n for (let cmd of binding.run)\n if (!ran.has(cmd)) {\n ran.add(cmd);\n if (cmd(view)) {\n if (binding.stopPropagation)\n stopPropagation = true;\n return true;\n }\n }\n if (binding.preventDefault) {\n if (binding.stopPropagation)\n stopPropagation = true;\n prevented = true;\n }\n }\n return false;\n };\n let scopeObj = map[scope], baseName, shiftName;\n if (scopeObj) {\n if (runFor(scopeObj[prefix + modifiers(name, event, !isChar)])) {\n handled = true;\n }\n else if (isChar && (event.altKey || event.metaKey || event.ctrlKey) &&\n // Ctrl-Alt may be used for AltGr on Windows\n !(browser.windows && event.ctrlKey && event.altKey) &&\n (baseName = w3c_keyname__WEBPACK_IMPORTED_MODULE_1__.base[event.keyCode]) && baseName != name) {\n if (runFor(scopeObj[prefix + modifiers(baseName, event, true)])) {\n handled = true;\n }\n else if (event.shiftKey && (shiftName = w3c_keyname__WEBPACK_IMPORTED_MODULE_1__.shift[event.keyCode]) != name && shiftName != baseName &&\n runFor(scopeObj[prefix + modifiers(shiftName, event, false)])) {\n handled = true;\n }\n }\n else if (isChar && event.shiftKey &&\n runFor(scopeObj[prefix + modifiers(name, event, true)])) {\n handled = true;\n }\n if (!handled && runFor(scopeObj._any))\n handled = true;\n }\n if (prevented)\n handled = true;\n if (handled && stopPropagation)\n event.stopPropagation();\n currentKeyEvent = null;\n return handled;\n}\n\n/**\nImplementation of [`LayerMarker`](https://codemirror.net/6/docs/ref/#view.LayerMarker) that creates\na rectangle at a given set of coordinates.\n*/\nclass RectangleMarker {\n /**\n Create a marker with the given class and dimensions. If `width`\n is null, the DOM element will get no width style.\n */\n constructor(className, \n /**\n The left position of the marker (in pixels, document-relative).\n */\n left, \n /**\n The top position of the marker.\n */\n top, \n /**\n The width of the marker, or null if it shouldn\'t get a width assigned.\n */\n width, \n /**\n The height of the marker.\n */\n height) {\n this.className = className;\n this.left = left;\n this.top = top;\n this.width = width;\n this.height = height;\n }\n draw() {\n let elt = document.createElement("div");\n elt.className = this.className;\n this.adjust(elt);\n return elt;\n }\n update(elt, prev) {\n if (prev.className != this.className)\n return false;\n this.adjust(elt);\n return true;\n }\n adjust(elt) {\n elt.style.left = this.left + "px";\n elt.style.top = this.top + "px";\n if (this.width != null)\n elt.style.width = this.width + "px";\n elt.style.height = this.height + "px";\n }\n eq(p) {\n return this.left == p.left && this.top == p.top && this.width == p.width && this.height == p.height &&\n this.className == p.className;\n }\n /**\n Create a set of rectangles for the given selection range,\n assigning them theclass`className`. Will create a single\n rectangle for empty ranges, and a set of selection-style\n rectangles covering the range\'s content (in a bidi-aware\n way) for non-empty ones.\n */\n static forRange(view, className, range) {\n if (range.empty) {\n let pos = view.coordsAtPos(range.head, range.assoc || 1);\n if (!pos)\n return [];\n let base = getBase(view);\n return [new RectangleMarker(className, pos.left - base.left, pos.top - base.top, null, pos.bottom - pos.top)];\n }\n else {\n return rectanglesForRange(view, className, range);\n }\n }\n}\nfunction getBase(view) {\n let rect = view.scrollDOM.getBoundingClientRect();\n let left = view.textDirection == Direction.LTR ? rect.left : rect.right - view.scrollDOM.clientWidth * view.scaleX;\n return { left: left - view.scrollDOM.scrollLeft * view.scaleX, top: rect.top - view.scrollDOM.scrollTop * view.scaleY };\n}\nfunction wrappedLine(view, pos, side, inside) {\n let coords = view.coordsAtPos(pos, side * 2);\n if (!coords)\n return inside;\n let editorRect = view.dom.getBoundingClientRect();\n let y = (coords.top + coords.bottom) / 2;\n let left = view.posAtCoords({ x: editorRect.left + 1, y });\n let right = view.posAtCoords({ x: editorRect.right - 1, y });\n if (left == null || right == null)\n return inside;\n return { from: Math.max(inside.from, Math.min(left, right)), to: Math.min(inside.to, Math.max(left, right)) };\n}\nfunction rectanglesForRange(view, className, range) {\n if (range.to <= view.viewport.from || range.from >= view.viewport.to)\n return [];\n let from = Math.max(range.from, view.viewport.from), to = Math.min(range.to, view.viewport.to);\n let ltr = view.textDirection == Direction.LTR;\n let content = view.contentDOM, contentRect = content.getBoundingClientRect(), base = getBase(view);\n let lineElt = content.querySelector(".cm-line"), lineStyle = lineElt && window.getComputedStyle(lineElt);\n let leftSide = contentRect.left +\n (lineStyle ? parseInt(lineStyle.paddingLeft) + Math.min(0, parseInt(lineStyle.textIndent)) : 0);\n let rightSide = contentRect.right - (lineStyle ? parseInt(lineStyle.paddingRight) : 0);\n let startBlock = blockAt(view, from), endBlock = blockAt(view, to);\n let visualStart = startBlock.type == BlockType.Text ? startBlock : null;\n let visualEnd = endBlock.type == BlockType.Text ? endBlock : null;\n if (visualStart && (view.lineWrapping || startBlock.widgetLineBreaks))\n visualStart = wrappedLine(view, from, 1, visualStart);\n if (visualEnd && (view.lineWrapping || endBlock.widgetLineBreaks))\n visualEnd = wrappedLine(view, to, -1, visualEnd);\n if (visualStart && visualEnd && visualStart.from == visualEnd.from && visualStart.to == visualEnd.to) {\n return pieces(drawForLine(range.from, range.to, visualStart));\n }\n else {\n let top = visualStart ? drawForLine(range.from, null, visualStart) : drawForWidget(startBlock, false);\n let bottom = visualEnd ? drawForLine(null, range.to, visualEnd) : drawForWidget(endBlock, true);\n let between = [];\n if ((visualStart || startBlock).to < (visualEnd || endBlock).from - (visualStart && visualEnd ? 1 : 0) ||\n startBlock.widgetLineBreaks > 1 && top.bottom + view.defaultLineHeight / 2 < bottom.top)\n between.push(piece(leftSide, top.bottom, rightSide, bottom.top));\n else if (top.bottom < bottom.top && view.elementAtHeight((top.bottom + bottom.top) / 2).type == BlockType.Text)\n top.bottom = bottom.top = (top.bottom + bottom.top) / 2;\n return pieces(top).concat(between).concat(pieces(bottom));\n }\n function piece(left, top, right, bottom) {\n return new RectangleMarker(className, left - base.left, top - base.top - 0.01 /* C.Epsilon */, right - left, bottom - top + 0.01 /* C.Epsilon */);\n }\n function pieces({ top, bottom, horizontal }) {\n let pieces = [];\n for (let i = 0; i < horizontal.length; i += 2)\n pieces.push(piece(horizontal[i], top, horizontal[i + 1], bottom));\n return pieces;\n }\n // Gets passed from/to in line-local positions\n function drawForLine(from, to, line) {\n let top = 1e9, bottom = -1e9, horizontal = [];\n function addSpan(from, fromOpen, to, toOpen, dir) {\n // Passing 2/-2 is a kludge to force the view to return\n // coordinates on the proper side of block widgets, since\n // normalizing the side there, though appropriate for most\n // coordsAtPos queries, would break selection drawing.\n let fromCoords = view.coordsAtPos(from, (from == line.to ? -2 : 2));\n let toCoords = view.coordsAtPos(to, (to == line.from ? 2 : -2));\n if (!fromCoords || !toCoords)\n return;\n top = Math.min(fromCoords.top, toCoords.top, top);\n bottom = Math.max(fromCoords.bottom, toCoords.bottom, bottom);\n if (dir == Direction.LTR)\n horizontal.push(ltr && fromOpen ? leftSide : fromCoords.left, ltr && toOpen ? rightSide : toCoords.right);\n else\n horizontal.push(!ltr && toOpen ? leftSide : toCoords.left, !ltr && fromOpen ? rightSide : fromCoords.right);\n }\n let start = from !== null && from !== void 0 ? from : line.from, end = to !== null && to !== void 0 ? to : line.to;\n // Split the range by visible range and document line\n for (let r of view.visibleRanges)\n if (r.to > start && r.from < end) {\n for (let pos = Math.max(r.from, start), endPos = Math.min(r.to, end);;) {\n let docLine = view.state.doc.lineAt(pos);\n for (let span of view.bidiSpans(docLine)) {\n let spanFrom = span.from + docLine.from, spanTo = span.to + docLine.from;\n if (spanFrom >= endPos)\n break;\n if (spanTo > pos)\n addSpan(Math.max(spanFrom, pos), from == null && spanFrom <= start, Math.min(spanTo, endPos), to == null && spanTo >= end, span.dir);\n }\n pos = docLine.to + 1;\n if (pos >= endPos)\n break;\n }\n }\n if (horizontal.length == 0)\n addSpan(start, from == null, end, to == null, view.textDirection);\n return { top, bottom, horizontal };\n }\n function drawForWidget(block, top) {\n let y = contentRect.top + (top ? block.top : block.bottom);\n return { top: y, bottom: y, horizontal: [] };\n }\n}\nfunction sameMarker(a, b) {\n return a.constructor == b.constructor && a.eq(b);\n}\nclass LayerView {\n constructor(view, layer) {\n this.view = view;\n this.layer = layer;\n this.drawn = [];\n this.scaleX = 1;\n this.scaleY = 1;\n this.measureReq = { read: this.measure.bind(this), write: this.draw.bind(this) };\n this.dom = view.scrollDOM.appendChild(document.createElement("div"));\n this.dom.classList.add("cm-layer");\n if (layer.above)\n this.dom.classList.add("cm-layer-above");\n if (layer.class)\n this.dom.classList.add(layer.class);\n this.scale();\n this.dom.setAttribute("aria-hidden", "true");\n this.setOrder(view.state);\n view.requestMeasure(this.measureReq);\n if (layer.mount)\n layer.mount(this.dom, view);\n }\n update(update) {\n if (update.startState.facet(layerOrder) != update.state.facet(layerOrder))\n this.setOrder(update.state);\n if (this.layer.update(update, this.dom) || update.geometryChanged) {\n this.scale();\n update.view.requestMeasure(this.measureReq);\n }\n }\n docViewUpdate(view) {\n if (this.layer.updateOnDocViewUpdate !== false)\n view.requestMeasure(this.measureReq);\n }\n setOrder(state) {\n let pos = 0, order = state.facet(layerOrder);\n while (pos < order.length && order[pos] != this.layer)\n pos++;\n this.dom.style.zIndex = String((this.layer.above ? 150 : -1) - pos);\n }\n measure() {\n return this.layer.markers(this.view);\n }\n scale() {\n let { scaleX, scaleY } = this.view;\n if (scaleX != this.scaleX || scaleY != this.scaleY) {\n this.scaleX = scaleX;\n this.scaleY = scaleY;\n this.dom.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`;\n }\n }\n draw(markers) {\n if (markers.length != this.drawn.length || markers.some((p, i) => !sameMarker(p, this.drawn[i]))) {\n let old = this.dom.firstChild, oldI = 0;\n for (let marker of markers) {\n if (marker.update && old && marker.constructor && this.drawn[oldI].constructor &&\n marker.update(old, this.drawn[oldI])) {\n old = old.nextSibling;\n oldI++;\n }\n else {\n this.dom.insertBefore(marker.draw(), old);\n }\n }\n while (old) {\n let next = old.nextSibling;\n old.remove();\n old = next;\n }\n this.drawn = markers;\n }\n }\n destroy() {\n if (this.layer.destroy)\n this.layer.destroy(this.dom, this.view);\n this.dom.remove();\n }\n}\nconst layerOrder = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\n/**\nDefine a layer.\n*/\nfunction layer(config) {\n return [\n ViewPlugin.define(v => new LayerView(v, config)),\n layerOrder.of(config)\n ];\n}\n\nconst CanHidePrimary = !browser.ios; // FIXME test IE\nconst selectionConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine(configs) {\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.combineConfig)(configs, {\n cursorBlinkRate: 1200,\n drawRangeCursor: true\n }, {\n cursorBlinkRate: (a, b) => Math.min(a, b),\n drawRangeCursor: (a, b) => a || b\n });\n }\n});\n/**\nReturns an extension that hides the browser\'s native selection and\ncursor, replacing the selection with a background behind the text\n(with the `cm-selectionBackground` class), and the\ncursors with elements overlaid over the code (using\n`cm-cursor-primary` and `cm-cursor-secondary`).\n\nThis allows the editor to display secondary selection ranges, and\ntends to produce a type of selection more in line with that users\nexpect in a text editor (the native selection styling will often\nleave gaps between lines and won\'t fill the horizontal space after\na line when the selection continues past it).\n\nIt does have a performance cost, in that it requires an extra DOM\nlayout cycle for many updates (the selection is drawn based on DOM\nlayout information that\'s only available after laying out the\ncontent).\n*/\nfunction drawSelection(config = {}) {\n return [\n selectionConfig.of(config),\n cursorLayer,\n selectionLayer,\n hideNativeSelection,\n nativeSelectionHidden.of(true)\n ];\n}\n/**\nRetrieve the [`drawSelection`](https://codemirror.net/6/docs/ref/#view.drawSelection) configuration\nfor this state. (Note that this will return a set of defaults even\nif `drawSelection` isn\'t enabled.)\n*/\nfunction getDrawSelectionConfig(state) {\n return state.facet(selectionConfig);\n}\nfunction configChanged(update) {\n return update.startState.facet(selectionConfig) != update.state.facet(selectionConfig);\n}\nconst cursorLayer = /*@__PURE__*/layer({\n above: true,\n markers(view) {\n let { state } = view, conf = state.facet(selectionConfig);\n let cursors = [];\n for (let r of state.selection.ranges) {\n let prim = r == state.selection.main;\n if (r.empty ? !prim || CanHidePrimary : conf.drawRangeCursor) {\n let className = prim ? "cm-cursor cm-cursor-primary" : "cm-cursor cm-cursor-secondary";\n let cursor = r.empty ? r : _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(r.head, r.head > r.anchor ? -1 : 1);\n for (let piece of RectangleMarker.forRange(view, className, cursor))\n cursors.push(piece);\n }\n }\n return cursors;\n },\n update(update, dom) {\n if (update.transactions.some(tr => tr.selection))\n dom.style.animationName = dom.style.animationName == "cm-blink" ? "cm-blink2" : "cm-blink";\n let confChange = configChanged(update);\n if (confChange)\n setBlinkRate(update.state, dom);\n return update.docChanged || update.selectionSet || confChange;\n },\n mount(dom, view) {\n setBlinkRate(view.state, dom);\n },\n class: "cm-cursorLayer"\n});\nfunction setBlinkRate(state, dom) {\n dom.style.animationDuration = state.facet(selectionConfig).cursorBlinkRate + "ms";\n}\nconst selectionLayer = /*@__PURE__*/layer({\n above: false,\n markers(view) {\n return view.state.selection.ranges.map(r => r.empty ? [] : RectangleMarker.forRange(view, "cm-selectionBackground", r))\n .reduce((a, b) => a.concat(b));\n },\n update(update, dom) {\n return update.docChanged || update.selectionSet || update.viewportChanged || configChanged(update);\n },\n class: "cm-selectionLayer"\n});\nconst themeSpec = {\n ".cm-line": {\n "& ::selection, &::selection": { backgroundColor: "transparent !important" },\n },\n ".cm-content": {\n "& :focus": {\n caretColor: "initial !important",\n "&::selection, & ::selection": {\n backgroundColor: "Highlight !important"\n }\n }\n }\n};\nif (CanHidePrimary)\n themeSpec[".cm-line"].caretColor = themeSpec[".cm-content"].caretColor = "transparent !important";\nconst hideNativeSelection = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Prec.highest(/*@__PURE__*/EditorView.theme(themeSpec));\n\nconst setDropCursorPos = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define({\n map(pos, mapping) { return pos == null ? null : mapping.mapPos(pos); }\n});\nconst dropCursorPos = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateField.define({\n create() { return null; },\n update(pos, tr) {\n if (pos != null)\n pos = tr.changes.mapPos(pos);\n return tr.effects.reduce((pos, e) => e.is(setDropCursorPos) ? e.value : pos, pos);\n }\n});\nconst drawDropCursor = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.cursor = null;\n this.measureReq = { read: this.readPos.bind(this), write: this.drawCursor.bind(this) };\n }\n update(update) {\n var _a;\n let cursorPos = update.state.field(dropCursorPos);\n if (cursorPos == null) {\n if (this.cursor != null) {\n (_a = this.cursor) === null || _a === void 0 ? void 0 : _a.remove();\n this.cursor = null;\n }\n }\n else {\n if (!this.cursor) {\n this.cursor = this.view.scrollDOM.appendChild(document.createElement("div"));\n this.cursor.className = "cm-dropCursor";\n }\n if (update.startState.field(dropCursorPos) != cursorPos || update.docChanged || update.geometryChanged)\n this.view.requestMeasure(this.measureReq);\n }\n }\n readPos() {\n let { view } = this;\n let pos = view.state.field(dropCursorPos);\n let rect = pos != null && view.coordsAtPos(pos);\n if (!rect)\n return null;\n let outer = view.scrollDOM.getBoundingClientRect();\n return {\n left: rect.left - outer.left + view.scrollDOM.scrollLeft * view.scaleX,\n top: rect.top - outer.top + view.scrollDOM.scrollTop * view.scaleY,\n height: rect.bottom - rect.top\n };\n }\n drawCursor(pos) {\n if (this.cursor) {\n let { scaleX, scaleY } = this.view;\n if (pos) {\n this.cursor.style.left = pos.left / scaleX + "px";\n this.cursor.style.top = pos.top / scaleY + "px";\n this.cursor.style.height = pos.height / scaleY + "px";\n }\n else {\n this.cursor.style.left = "-100000px";\n }\n }\n }\n destroy() {\n if (this.cursor)\n this.cursor.remove();\n }\n setDropPos(pos) {\n if (this.view.state.field(dropCursorPos) != pos)\n this.view.dispatch({ effects: setDropCursorPos.of(pos) });\n }\n}, {\n eventObservers: {\n dragover(event) {\n this.setDropPos(this.view.posAtCoords({ x: event.clientX, y: event.clientY }));\n },\n dragleave(event) {\n if (event.target == this.view.contentDOM || !this.view.contentDOM.contains(event.relatedTarget))\n this.setDropPos(null);\n },\n dragend() {\n this.setDropPos(null);\n },\n drop() {\n this.setDropPos(null);\n }\n }\n});\n/**\nDraws a cursor at the current drop position when something is\ndragged over the editor.\n*/\nfunction dropCursor() {\n return [dropCursorPos, drawDropCursor];\n}\n\nfunction iterMatches(doc, re, from, to, f) {\n re.lastIndex = 0;\n for (let cursor = doc.iterRange(from, to), pos = from, m; !cursor.next().done; pos += cursor.value.length) {\n if (!cursor.lineBreak)\n while (m = re.exec(cursor.value))\n f(pos + m.index, m);\n }\n}\nfunction matchRanges(view, maxLength) {\n let visible = view.visibleRanges;\n if (visible.length == 1 && visible[0].from == view.viewport.from &&\n visible[0].to == view.viewport.to)\n return visible;\n let result = [];\n for (let { from, to } of visible) {\n from = Math.max(view.state.doc.lineAt(from).from, from - maxLength);\n to = Math.min(view.state.doc.lineAt(to).to, to + maxLength);\n if (result.length && result[result.length - 1].to >= from)\n result[result.length - 1].to = to;\n else\n result.push({ from, to });\n }\n return result;\n}\n/**\nHelper class used to make it easier to maintain decorations on\nvisible code that matches a given regular expression. To be used\nin a [view plugin](https://codemirror.net/6/docs/ref/#view.ViewPlugin). Instances of this object\nrepresent a matching configuration.\n*/\nclass MatchDecorator {\n /**\n Create a decorator.\n */\n constructor(config) {\n const { regexp, decoration, decorate, boundary, maxLength = 1000 } = config;\n if (!regexp.global)\n throw new RangeError("The regular expression given to MatchDecorator should have its \'g\' flag set");\n this.regexp = regexp;\n if (decorate) {\n this.addMatch = (match, view, from, add) => decorate(add, from, from + match[0].length, match, view);\n }\n else if (typeof decoration == "function") {\n this.addMatch = (match, view, from, add) => {\n let deco = decoration(match, view, from);\n if (deco)\n add(from, from + match[0].length, deco);\n };\n }\n else if (decoration) {\n this.addMatch = (match, _view, from, add) => add(from, from + match[0].length, decoration);\n }\n else {\n throw new RangeError("Either \'decorate\' or \'decoration\' should be provided to MatchDecorator");\n }\n this.boundary = boundary;\n this.maxLength = maxLength;\n }\n /**\n Compute the full set of decorations for matches in the given\n view\'s viewport. You\'ll want to call this when initializing your\n plugin.\n */\n createDeco(view) {\n let build = new _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSetBuilder(), add = build.add.bind(build);\n for (let { from, to } of matchRanges(view, this.maxLength))\n iterMatches(view.state.doc, this.regexp, from, to, (from, m) => this.addMatch(m, view, from, add));\n return build.finish();\n }\n /**\n Update a set of decorations for a view update. `deco` _must_ be\n the set of decorations produced by _this_ `MatchDecorator` for\n the view state before the update.\n */\n updateDeco(update, deco) {\n let changeFrom = 1e9, changeTo = -1;\n if (update.docChanged)\n update.changes.iterChanges((_f, _t, from, to) => {\n if (to > update.view.viewport.from && from < update.view.viewport.to) {\n changeFrom = Math.min(from, changeFrom);\n changeTo = Math.max(to, changeTo);\n }\n });\n if (update.viewportChanged || changeTo - changeFrom > 1000)\n return this.createDeco(update.view);\n if (changeTo > -1)\n return this.updateRange(update.view, deco.map(update.changes), changeFrom, changeTo);\n return deco;\n }\n updateRange(view, deco, updateFrom, updateTo) {\n for (let r of view.visibleRanges) {\n let from = Math.max(r.from, updateFrom), to = Math.min(r.to, updateTo);\n if (to > from) {\n let fromLine = view.state.doc.lineAt(from), toLine = fromLine.to < to ? view.state.doc.lineAt(to) : fromLine;\n let start = Math.max(r.from, fromLine.from), end = Math.min(r.to, toLine.to);\n if (this.boundary) {\n for (; from > fromLine.from; from--)\n if (this.boundary.test(fromLine.text[from - 1 - fromLine.from])) {\n start = from;\n break;\n }\n for (; to < toLine.to; to++)\n if (this.boundary.test(toLine.text[to - toLine.from])) {\n end = to;\n break;\n }\n }\n let ranges = [], m;\n let add = (from, to, deco) => ranges.push(deco.range(from, to));\n if (fromLine == toLine) {\n this.regexp.lastIndex = start - fromLine.from;\n while ((m = this.regexp.exec(fromLine.text)) && m.index < end - fromLine.from)\n this.addMatch(m, view, m.index + fromLine.from, add);\n }\n else {\n iterMatches(view.state.doc, this.regexp, start, end, (from, m) => this.addMatch(m, view, from, add));\n }\n deco = deco.update({ filterFrom: start, filterTo: end, filter: (from, to) => from < start || to > end, add: ranges });\n }\n }\n return deco;\n }\n}\n\nconst UnicodeRegexpSupport = /x/.unicode != null ? "gu" : "g";\nconst Specials = /*@__PURE__*/new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b\\u200e\\u200f\\u2028\\u2029\\u202d\\u202e\\u2066\\u2067\\u2069\\ufeff\\ufff9-\\ufffc]", UnicodeRegexpSupport);\nconst Names = {\n 0: "null",\n 7: "bell",\n 8: "backspace",\n 10: "newline",\n 11: "vertical tab",\n 13: "carriage return",\n 27: "escape",\n 8203: "zero width space",\n 8204: "zero width non-joiner",\n 8205: "zero width joiner",\n 8206: "left-to-right mark",\n 8207: "right-to-left mark",\n 8232: "line separator",\n 8237: "left-to-right override",\n 8238: "right-to-left override",\n 8294: "left-to-right isolate",\n 8295: "right-to-left isolate",\n 8297: "pop directional isolate",\n 8233: "paragraph separator",\n 65279: "zero width no-break space",\n 65532: "object replacement"\n};\nlet _supportsTabSize = null;\nfunction supportsTabSize() {\n var _a;\n if (_supportsTabSize == null && typeof document != "undefined" && document.body) {\n let styles = document.body.style;\n _supportsTabSize = ((_a = styles.tabSize) !== null && _a !== void 0 ? _a : styles.MozTabSize) != null;\n }\n return _supportsTabSize || false;\n}\nconst specialCharConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine(configs) {\n let config = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.combineConfig)(configs, {\n render: null,\n specialChars: Specials,\n addSpecialChars: null\n });\n if (config.replaceTabs = !supportsTabSize())\n config.specialChars = new RegExp("\\t|" + config.specialChars.source, UnicodeRegexpSupport);\n if (config.addSpecialChars)\n config.specialChars = new RegExp(config.specialChars.source + "|" + config.addSpecialChars.source, UnicodeRegexpSupport);\n return config;\n }\n});\n/**\nReturns an extension that installs highlighting of special\ncharacters.\n*/\nfunction highlightSpecialChars(\n/**\nConfiguration options.\n*/\nconfig = {}) {\n return [specialCharConfig.of(config), specialCharPlugin()];\n}\nlet _plugin = null;\nfunction specialCharPlugin() {\n return _plugin || (_plugin = ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.decorations = Decoration.none;\n this.decorationCache = Object.create(null);\n this.decorator = this.makeDecorator(view.state.facet(specialCharConfig));\n this.decorations = this.decorator.createDeco(view);\n }\n makeDecorator(conf) {\n return new MatchDecorator({\n regexp: conf.specialChars,\n decoration: (m, view, pos) => {\n let { doc } = view.state;\n let code = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.codePointAt)(m[0], 0);\n if (code == 9) {\n let line = doc.lineAt(pos);\n let size = view.state.tabSize, col = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.countColumn)(line.text, size, pos - line.from);\n return Decoration.replace({\n widget: new TabWidget((size - (col % size)) * this.view.defaultCharacterWidth / this.view.scaleX)\n });\n }\n return this.decorationCache[code] ||\n (this.decorationCache[code] = Decoration.replace({ widget: new SpecialCharWidget(conf, code) }));\n },\n boundary: conf.replaceTabs ? undefined : /[^]/\n });\n }\n update(update) {\n let conf = update.state.facet(specialCharConfig);\n if (update.startState.facet(specialCharConfig) != conf) {\n this.decorator = this.makeDecorator(conf);\n this.decorations = this.decorator.createDeco(update.view);\n }\n else {\n this.decorations = this.decorator.updateDeco(update, this.decorations);\n }\n }\n }, {\n decorations: v => v.decorations\n }));\n}\nconst DefaultPlaceholder = "\\u2022";\n// Assigns placeholder characters from the Control Pictures block to\n// ASCII control characters\nfunction placeholder$1(code) {\n if (code >= 32)\n return DefaultPlaceholder;\n if (code == 10)\n return "\\u2424";\n return String.fromCharCode(9216 + code);\n}\nclass SpecialCharWidget extends WidgetType {\n constructor(options, code) {\n super();\n this.options = options;\n this.code = code;\n }\n eq(other) { return other.code == this.code; }\n toDOM(view) {\n let ph = placeholder$1(this.code);\n let desc = view.state.phrase("Control character") + " " + (Names[this.code] || "0x" + this.code.toString(16));\n let custom = this.options.render && this.options.render(this.code, desc, ph);\n if (custom)\n return custom;\n let span = document.createElement("span");\n span.textContent = ph;\n span.title = desc;\n span.setAttribute("aria-label", desc);\n span.className = "cm-specialChar";\n return span;\n }\n ignoreEvent() { return false; }\n}\nclass TabWidget extends WidgetType {\n constructor(width) {\n super();\n this.width = width;\n }\n eq(other) { return other.width == this.width; }\n toDOM() {\n let span = document.createElement("span");\n span.textContent = "\\t";\n span.className = "cm-tab";\n span.style.width = this.width + "px";\n return span;\n }\n ignoreEvent() { return false; }\n}\n\nconst plugin = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor() {\n this.height = 1000;\n this.attrs = { style: "padding-bottom: 1000px" };\n }\n update(update) {\n let { view } = update;\n let height = view.viewState.editorHeight -\n view.defaultLineHeight - view.documentPadding.top - 0.5;\n if (height >= 0 && height != this.height) {\n this.height = height;\n this.attrs = { style: `padding-bottom: ${height}px` };\n }\n }\n});\n/**\nReturns an extension that makes sure the content has a bottom\nmargin equivalent to the height of the editor, minus one line\nheight, so that every line in the document can be scrolled to the\ntop of the editor.\n\nThis is only meaningful when the editor is scrollable, and should\nnot be enabled in editors that take the size of their content.\n*/\nfunction scrollPastEnd() {\n return [plugin, contentAttributes.of(view => { var _a; return ((_a = view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.attrs) || null; })];\n}\n\n/**\nMark lines that have a cursor on them with the `"cm-activeLine"`\nDOM class.\n*/\nfunction highlightActiveLine() {\n return activeLineHighlighter;\n}\nconst lineDeco = /*@__PURE__*/Decoration.line({ class: "cm-activeLine" });\nconst activeLineHighlighter = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor(view) {\n this.decorations = this.getDeco(view);\n }\n update(update) {\n if (update.docChanged || update.selectionSet)\n this.decorations = this.getDeco(update.view);\n }\n getDeco(view) {\n let lastLineStart = -1, deco = [];\n for (let r of view.state.selection.ranges) {\n let line = view.lineBlockAt(r.head);\n if (line.from > lastLineStart) {\n deco.push(lineDeco.range(line.from));\n lastLineStart = line.from;\n }\n }\n return Decoration.set(deco);\n }\n}, {\n decorations: v => v.decorations\n});\n\nclass Placeholder extends WidgetType {\n constructor(content) {\n super();\n this.content = content;\n }\n toDOM() {\n let wrap = document.createElement("span");\n wrap.className = "cm-placeholder";\n wrap.style.pointerEvents = "none";\n wrap.appendChild(typeof this.content == "string" ? document.createTextNode(this.content) : this.content);\n if (typeof this.content == "string")\n wrap.setAttribute("aria-label", "placeholder " + this.content);\n else\n wrap.setAttribute("aria-hidden", "true");\n return wrap;\n }\n coordsAt(dom) {\n let rects = dom.firstChild ? clientRectsFor(dom.firstChild) : [];\n if (!rects.length)\n return null;\n let style = window.getComputedStyle(dom.parentNode);\n let rect = flattenRect(rects[0], style.direction != "rtl");\n let lineHeight = parseInt(style.lineHeight);\n if (rect.bottom - rect.top > lineHeight * 1.5)\n return { left: rect.left, right: rect.right, top: rect.top, bottom: rect.top + lineHeight };\n return rect;\n }\n ignoreEvent() { return false; }\n}\n/**\nExtension that enables a placeholder—a piece of example content\nto show when the editor is empty.\n*/\nfunction placeholder(content) {\n return ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.placeholder = content\n ? Decoration.set([Decoration.widget({ widget: new Placeholder(content), side: 1 }).range(0)])\n : Decoration.none;\n }\n get decorations() { return this.view.state.doc.length ? Decoration.none : this.placeholder; }\n }, { decorations: v => v.decorations });\n}\n\n// Don\'t compute precise column positions for line offsets above this\n// (since it could get expensive). Assume offset==column for them.\nconst MaxOff = 2000;\nfunction rectangleFor(state, a, b) {\n let startLine = Math.min(a.line, b.line), endLine = Math.max(a.line, b.line);\n let ranges = [];\n if (a.off > MaxOff || b.off > MaxOff || a.col < 0 || b.col < 0) {\n let startOff = Math.min(a.off, b.off), endOff = Math.max(a.off, b.off);\n for (let i = startLine; i <= endLine; i++) {\n let line = state.doc.line(i);\n if (line.length <= endOff)\n ranges.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.range(line.from + startOff, line.to + endOff));\n }\n }\n else {\n let startCol = Math.min(a.col, b.col), endCol = Math.max(a.col, b.col);\n for (let i = startLine; i <= endLine; i++) {\n let line = state.doc.line(i);\n let start = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.findColumn)(line.text, startCol, state.tabSize, true);\n if (start < 0) {\n ranges.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.cursor(line.to));\n }\n else {\n let end = (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.findColumn)(line.text, endCol, state.tabSize);\n ranges.push(_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.range(line.from + start, line.from + end));\n }\n }\n }\n return ranges;\n}\nfunction absoluteColumn(view, x) {\n let ref = view.coordsAtPos(view.viewport.from);\n return ref ? Math.round(Math.abs((ref.left - x) / view.defaultCharacterWidth)) : -1;\n}\nfunction getPos(view, event) {\n let offset = view.posAtCoords({ x: event.clientX, y: event.clientY }, false);\n let line = view.state.doc.lineAt(offset), off = offset - line.from;\n let col = off > MaxOff ? -1\n : off == line.length ? absoluteColumn(view, event.clientX)\n : (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.countColumn)(line.text, view.state.tabSize, offset - line.from);\n return { line: line.number, col, off };\n}\nfunction rectangleSelectionStyle(view, event) {\n let start = getPos(view, event), startSel = view.state.selection;\n if (!start)\n return null;\n return {\n update(update) {\n if (update.docChanged) {\n let newStart = update.changes.mapPos(update.startState.doc.line(start.line).from);\n let newLine = update.state.doc.lineAt(newStart);\n start = { line: newLine.number, col: start.col, off: Math.min(start.off, newLine.length) };\n startSel = startSel.map(update.changes);\n }\n },\n get(event, _extend, multiple) {\n let cur = getPos(view, event);\n if (!cur)\n return startSel;\n let ranges = rectangleFor(view.state, start, cur);\n if (!ranges.length)\n return startSel;\n if (multiple)\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.create(ranges.concat(startSel.ranges));\n else\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.EditorSelection.create(ranges);\n }\n };\n}\n/**\nCreate an extension that enables rectangular selections. By\ndefault, it will react to left mouse drag with the Alt key held\ndown. When such a selection occurs, the text within the rectangle\nthat was dragged over will be selected, as one selection\n[range](https://codemirror.net/6/docs/ref/#state.SelectionRange) per line.\n*/\nfunction rectangularSelection(options) {\n let filter = (options === null || options === void 0 ? void 0 : options.eventFilter) || (e => e.altKey && e.button == 0);\n return EditorView.mouseSelectionStyle.of((view, event) => filter(event) ? rectangleSelectionStyle(view, event) : null);\n}\nconst keys = {\n Alt: [18, e => !!e.altKey],\n Control: [17, e => !!e.ctrlKey],\n Shift: [16, e => !!e.shiftKey],\n Meta: [91, e => !!e.metaKey]\n};\nconst showCrosshair = { style: "cursor: crosshair" };\n/**\nReturns an extension that turns the pointer cursor into a\ncrosshair when a given modifier key, defaulting to Alt, is held\ndown. Can serve as a visual hint that rectangular selection is\ngoing to happen when paired with\n[`rectangularSelection`](https://codemirror.net/6/docs/ref/#view.rectangularSelection).\n*/\nfunction crosshairCursor(options = {}) {\n let [code, getter] = keys[options.key || "Alt"];\n let plugin = ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.isDown = false;\n }\n set(isDown) {\n if (this.isDown != isDown) {\n this.isDown = isDown;\n this.view.update([]);\n }\n }\n }, {\n eventObservers: {\n keydown(e) {\n this.set(e.keyCode == code || getter(e));\n },\n keyup(e) {\n if (e.keyCode == code || !getter(e))\n this.set(false);\n },\n mousemove(e) {\n this.set(getter(e));\n }\n }\n });\n return [\n plugin,\n EditorView.contentAttributes.of(view => { var _a; return ((_a = view.plugin(plugin)) === null || _a === void 0 ? void 0 : _a.isDown) ? showCrosshair : null; })\n ];\n}\n\nconst Outside = "-10000px";\nclass TooltipViewManager {\n constructor(view, facet, createTooltipView, removeTooltipView) {\n this.facet = facet;\n this.createTooltipView = createTooltipView;\n this.removeTooltipView = removeTooltipView;\n this.input = view.state.facet(facet);\n this.tooltips = this.input.filter(t => t);\n let prev = null;\n this.tooltipViews = this.tooltips.map(t => prev = createTooltipView(t, prev));\n }\n update(update, above) {\n var _a;\n let input = update.state.facet(this.facet);\n let tooltips = input.filter(x => x);\n if (input === this.input) {\n for (let t of this.tooltipViews)\n if (t.update)\n t.update(update);\n return false;\n }\n let tooltipViews = [], newAbove = above ? [] : null;\n for (let i = 0; i < tooltips.length; i++) {\n let tip = tooltips[i], known = -1;\n if (!tip)\n continue;\n for (let i = 0; i < this.tooltips.length; i++) {\n let other = this.tooltips[i];\n if (other && other.create == tip.create)\n known = i;\n }\n if (known < 0) {\n tooltipViews[i] = this.createTooltipView(tip, i ? tooltipViews[i - 1] : null);\n if (newAbove)\n newAbove[i] = !!tip.above;\n }\n else {\n let tooltipView = tooltipViews[i] = this.tooltipViews[known];\n if (newAbove)\n newAbove[i] = above[known];\n if (tooltipView.update)\n tooltipView.update(update);\n }\n }\n for (let t of this.tooltipViews)\n if (tooltipViews.indexOf(t) < 0) {\n this.removeTooltipView(t);\n (_a = t.destroy) === null || _a === void 0 ? void 0 : _a.call(t);\n }\n if (above) {\n newAbove.forEach((val, i) => above[i] = val);\n above.length = newAbove.length;\n }\n this.input = input;\n this.tooltips = tooltips;\n this.tooltipViews = tooltipViews;\n return true;\n }\n}\n/**\nCreates an extension that configures tooltip behavior.\n*/\nfunction tooltips(config = {}) {\n return tooltipConfig.of(config);\n}\nfunction windowSpace(view) {\n let { win } = view;\n return { top: 0, left: 0, bottom: win.innerHeight, right: win.innerWidth };\n}\nconst tooltipConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine: values => {\n var _a, _b, _c;\n return ({\n position: browser.ios ? "absolute" : ((_a = values.find(conf => conf.position)) === null || _a === void 0 ? void 0 : _a.position) || "fixed",\n parent: ((_b = values.find(conf => conf.parent)) === null || _b === void 0 ? void 0 : _b.parent) || null,\n tooltipSpace: ((_c = values.find(conf => conf.tooltipSpace)) === null || _c === void 0 ? void 0 : _c.tooltipSpace) || windowSpace,\n });\n }\n});\nconst knownHeight = /*@__PURE__*/new WeakMap();\nconst tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.above = [];\n this.inView = true;\n this.madeAbsolute = false;\n this.lastTransaction = 0;\n this.measureTimeout = -1;\n let config = view.state.facet(tooltipConfig);\n this.position = config.position;\n this.parent = config.parent;\n this.classes = view.themeClasses;\n this.createContainer();\n this.measureReq = { read: this.readMeasure.bind(this), write: this.writeMeasure.bind(this), key: this };\n this.resizeObserver = typeof ResizeObserver == "function" ? new ResizeObserver(() => this.measureSoon()) : null;\n this.manager = new TooltipViewManager(view, showTooltip, (t, p) => this.createTooltip(t, p), t => {\n if (this.resizeObserver)\n this.resizeObserver.unobserve(t.dom);\n t.dom.remove();\n });\n this.above = this.manager.tooltips.map(t => !!t.above);\n this.intersectionObserver = typeof IntersectionObserver == "function" ? new IntersectionObserver(entries => {\n if (Date.now() > this.lastTransaction - 50 &&\n entries.length > 0 && entries[entries.length - 1].intersectionRatio < 1)\n this.measureSoon();\n }, { threshold: [1] }) : null;\n this.observeIntersection();\n view.win.addEventListener("resize", this.measureSoon = this.measureSoon.bind(this));\n this.maybeMeasure();\n }\n createContainer() {\n if (this.parent) {\n this.container = document.createElement("div");\n this.container.style.position = "relative";\n this.container.className = this.view.themeClasses;\n this.parent.appendChild(this.container);\n }\n else {\n this.container = this.view.dom;\n }\n }\n observeIntersection() {\n if (this.intersectionObserver) {\n this.intersectionObserver.disconnect();\n for (let tooltip of this.manager.tooltipViews)\n this.intersectionObserver.observe(tooltip.dom);\n }\n }\n measureSoon() {\n if (this.measureTimeout < 0)\n this.measureTimeout = setTimeout(() => {\n this.measureTimeout = -1;\n this.maybeMeasure();\n }, 50);\n }\n update(update) {\n if (update.transactions.length)\n this.lastTransaction = Date.now();\n let updated = this.manager.update(update, this.above);\n if (updated)\n this.observeIntersection();\n let shouldMeasure = updated || update.geometryChanged;\n let newConfig = update.state.facet(tooltipConfig);\n if (newConfig.position != this.position && !this.madeAbsolute) {\n this.position = newConfig.position;\n for (let t of this.manager.tooltipViews)\n t.dom.style.position = this.position;\n shouldMeasure = true;\n }\n if (newConfig.parent != this.parent) {\n if (this.parent)\n this.container.remove();\n this.parent = newConfig.parent;\n this.createContainer();\n for (let t of this.manager.tooltipViews)\n this.container.appendChild(t.dom);\n shouldMeasure = true;\n }\n else if (this.parent && this.view.themeClasses != this.classes) {\n this.classes = this.container.className = this.view.themeClasses;\n }\n if (shouldMeasure)\n this.maybeMeasure();\n }\n createTooltip(tooltip, prev) {\n let tooltipView = tooltip.create(this.view);\n let before = prev ? prev.dom : null;\n tooltipView.dom.classList.add("cm-tooltip");\n if (tooltip.arrow && !tooltipView.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")) {\n let arrow = document.createElement("div");\n arrow.className = "cm-tooltip-arrow";\n tooltipView.dom.appendChild(arrow);\n }\n tooltipView.dom.style.position = this.position;\n tooltipView.dom.style.top = Outside;\n tooltipView.dom.style.left = "0px";\n this.container.insertBefore(tooltipView.dom, before);\n if (tooltipView.mount)\n tooltipView.mount(this.view);\n if (this.resizeObserver)\n this.resizeObserver.observe(tooltipView.dom);\n return tooltipView;\n }\n destroy() {\n var _a, _b, _c;\n this.view.win.removeEventListener("resize", this.measureSoon);\n for (let tooltipView of this.manager.tooltipViews) {\n tooltipView.dom.remove();\n (_a = tooltipView.destroy) === null || _a === void 0 ? void 0 : _a.call(tooltipView);\n }\n if (this.parent)\n this.container.remove();\n (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();\n (_c = this.intersectionObserver) === null || _c === void 0 ? void 0 : _c.disconnect();\n clearTimeout(this.measureTimeout);\n }\n readMeasure() {\n let editor = this.view.dom.getBoundingClientRect();\n let scaleX = 1, scaleY = 1, makeAbsolute = false;\n if (this.position == "fixed" && this.manager.tooltipViews.length) {\n let { dom } = this.manager.tooltipViews[0];\n if (browser.gecko) {\n // Firefox sets the element\'s `offsetParent` to the\n // transformed element when a transform interferes with fixed\n // positioning.\n makeAbsolute = dom.offsetParent != this.container.ownerDocument.body;\n }\n else if (dom.style.top == Outside && dom.style.left == "0px") {\n // On other browsers, we have to awkwardly try and use other\n // information to detect a transform.\n let rect = dom.getBoundingClientRect();\n makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;\n }\n }\n if (makeAbsolute || this.position == "absolute") {\n if (this.parent) {\n let rect = this.parent.getBoundingClientRect();\n if (rect.width && rect.height) {\n scaleX = rect.width / this.parent.offsetWidth;\n scaleY = rect.height / this.parent.offsetHeight;\n }\n }\n else {\n ({ scaleX, scaleY } = this.view.viewState);\n }\n }\n return {\n editor,\n parent: this.parent ? this.container.getBoundingClientRect() : editor,\n pos: this.manager.tooltips.map((t, i) => {\n let tv = this.manager.tooltipViews[i];\n return tv.getCoords ? tv.getCoords(t.pos) : this.view.coordsAtPos(t.pos);\n }),\n size: this.manager.tooltipViews.map(({ dom }) => dom.getBoundingClientRect()),\n space: this.view.state.facet(tooltipConfig).tooltipSpace(this.view),\n scaleX, scaleY, makeAbsolute\n };\n }\n writeMeasure(measured) {\n var _a;\n if (measured.makeAbsolute) {\n this.madeAbsolute = true;\n this.position = "absolute";\n for (let t of this.manager.tooltipViews)\n t.dom.style.position = "absolute";\n }\n let { editor, space, scaleX, scaleY } = measured;\n let others = [];\n for (let i = 0; i < this.manager.tooltips.length; i++) {\n let tooltip = this.manager.tooltips[i], tView = this.manager.tooltipViews[i], { dom } = tView;\n let pos = measured.pos[i], size = measured.size[i];\n // Hide tooltips that are outside of the editor.\n if (!pos || pos.bottom <= Math.max(editor.top, space.top) ||\n pos.top >= Math.min(editor.bottom, space.bottom) ||\n pos.right < Math.max(editor.left, space.left) - .1 ||\n pos.left > Math.min(editor.right, space.right) + .1) {\n dom.style.top = Outside;\n continue;\n }\n let arrow = tooltip.arrow ? tView.dom.querySelector(".cm-tooltip-arrow") : null;\n let arrowHeight = arrow ? 7 /* Arrow.Size */ : 0;\n let width = size.right - size.left, height = (_a = knownHeight.get(tView)) !== null && _a !== void 0 ? _a : size.bottom - size.top;\n let offset = tView.offset || noOffset, ltr = this.view.textDirection == Direction.LTR;\n let left = size.width > space.right - space.left\n ? (ltr ? space.left : space.right - size.width)\n : ltr ? Math.max(space.left, Math.min(pos.left - (arrow ? 14 /* Arrow.Offset */ : 0) + offset.x, space.right - width))\n : Math.min(Math.max(space.left, pos.left - width + (arrow ? 14 /* Arrow.Offset */ : 0) - offset.x), space.right - width);\n let above = this.above[i];\n if (!tooltip.strictSide && (above\n ? pos.top - (size.bottom - size.top) - offset.y < space.top\n : pos.bottom + (size.bottom - size.top) + offset.y > space.bottom) &&\n above == (space.bottom - pos.bottom > pos.top - space.top))\n above = this.above[i] = !above;\n let spaceVert = (above ? pos.top - space.top : space.bottom - pos.bottom) - arrowHeight;\n if (spaceVert < height && tView.resize !== false) {\n if (spaceVert < this.view.defaultLineHeight) {\n dom.style.top = Outside;\n continue;\n }\n knownHeight.set(tView, height);\n dom.style.height = (height = spaceVert) / scaleY + "px";\n }\n else if (dom.style.height) {\n dom.style.height = "";\n }\n let top = above ? pos.top - height - arrowHeight - offset.y : pos.bottom + arrowHeight + offset.y;\n let right = left + width;\n if (tView.overlap !== true)\n for (let r of others)\n if (r.left < right && r.right > left && r.top < top + height && r.bottom > top)\n top = above ? r.top - height - 2 - arrowHeight : r.bottom + arrowHeight + 2;\n if (this.position == "absolute") {\n dom.style.top = (top - measured.parent.top) / scaleY + "px";\n dom.style.left = (left - measured.parent.left) / scaleX + "px";\n }\n else {\n dom.style.top = top / scaleY + "px";\n dom.style.left = left / scaleX + "px";\n }\n if (arrow) {\n let arrowLeft = pos.left + (ltr ? offset.x : -offset.x) - (left + 14 /* Arrow.Offset */ - 7 /* Arrow.Size */);\n arrow.style.left = arrowLeft / scaleX + "px";\n }\n if (tView.overlap !== true)\n others.push({ left, top, right, bottom: top + height });\n dom.classList.toggle("cm-tooltip-above", above);\n dom.classList.toggle("cm-tooltip-below", !above);\n if (tView.positioned)\n tView.positioned(measured.space);\n }\n }\n maybeMeasure() {\n if (this.manager.tooltips.length) {\n if (this.view.inView)\n this.view.requestMeasure(this.measureReq);\n if (this.inView != this.view.inView) {\n this.inView = this.view.inView;\n if (!this.inView)\n for (let tv of this.manager.tooltipViews)\n tv.dom.style.top = Outside;\n }\n }\n }\n}, {\n eventObservers: {\n scroll() { this.maybeMeasure(); }\n }\n});\nconst baseTheme = /*@__PURE__*/EditorView.baseTheme({\n ".cm-tooltip": {\n zIndex: 100,\n boxSizing: "border-box"\n },\n "&light .cm-tooltip": {\n border: "1px solid #bbb",\n backgroundColor: "#f5f5f5"\n },\n "&light .cm-tooltip-section:not(:first-child)": {\n borderTop: "1px solid #bbb",\n },\n "&dark .cm-tooltip": {\n backgroundColor: "#333338",\n color: "white"\n },\n ".cm-tooltip-arrow": {\n height: `${7 /* Arrow.Size */}px`,\n width: `${7 /* Arrow.Size */ * 2}px`,\n position: "absolute",\n zIndex: -1,\n overflow: "hidden",\n "&:before, &:after": {\n content: "\'\'",\n position: "absolute",\n width: 0,\n height: 0,\n borderLeft: `${7 /* Arrow.Size */}px solid transparent`,\n borderRight: `${7 /* Arrow.Size */}px solid transparent`,\n },\n ".cm-tooltip-above &": {\n bottom: `-${7 /* Arrow.Size */}px`,\n "&:before": {\n borderTop: `${7 /* Arrow.Size */}px solid #bbb`,\n },\n "&:after": {\n borderTop: `${7 /* Arrow.Size */}px solid #f5f5f5`,\n bottom: "1px"\n }\n },\n ".cm-tooltip-below &": {\n top: `-${7 /* Arrow.Size */}px`,\n "&:before": {\n borderBottom: `${7 /* Arrow.Size */}px solid #bbb`,\n },\n "&:after": {\n borderBottom: `${7 /* Arrow.Size */}px solid #f5f5f5`,\n top: "1px"\n }\n },\n },\n "&dark .cm-tooltip .cm-tooltip-arrow": {\n "&:before": {\n borderTopColor: "#333338",\n borderBottomColor: "#333338"\n },\n "&:after": {\n borderTopColor: "transparent",\n borderBottomColor: "transparent"\n }\n }\n});\nconst noOffset = { x: 0, y: 0 };\n/**\nFacet to which an extension can add a value to show a tooltip.\n*/\nconst showTooltip = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n enables: [tooltipPlugin, baseTheme]\n});\nconst showHoverTooltip = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine: inputs => inputs.reduce((a, i) => a.concat(i), [])\n});\nclass HoverTooltipHost {\n // Needs to be static so that host tooltip instances always match\n static create(view) {\n return new HoverTooltipHost(view);\n }\n constructor(view) {\n this.view = view;\n this.mounted = false;\n this.dom = document.createElement("div");\n this.dom.classList.add("cm-tooltip-hover");\n this.manager = new TooltipViewManager(view, showHoverTooltip, (t, p) => this.createHostedView(t, p), t => t.dom.remove());\n }\n createHostedView(tooltip, prev) {\n let hostedView = tooltip.create(this.view);\n hostedView.dom.classList.add("cm-tooltip-section");\n this.dom.insertBefore(hostedView.dom, prev ? prev.dom.nextSibling : this.dom.firstChild);\n if (this.mounted && hostedView.mount)\n hostedView.mount(this.view);\n return hostedView;\n }\n mount(view) {\n for (let hostedView of this.manager.tooltipViews) {\n if (hostedView.mount)\n hostedView.mount(view);\n }\n this.mounted = true;\n }\n positioned(space) {\n for (let hostedView of this.manager.tooltipViews) {\n if (hostedView.positioned)\n hostedView.positioned(space);\n }\n }\n update(update) {\n this.manager.update(update);\n }\n destroy() {\n var _a;\n for (let t of this.manager.tooltipViews)\n (_a = t.destroy) === null || _a === void 0 ? void 0 : _a.call(t);\n }\n passProp(name) {\n let value = undefined;\n for (let view of this.manager.tooltipViews) {\n let given = view[name];\n if (given !== undefined) {\n if (value === undefined)\n value = given;\n else if (value !== given)\n return undefined;\n }\n }\n return value;\n }\n get offset() { return this.passProp("offset"); }\n get getCoords() { return this.passProp("getCoords"); }\n get overlap() { return this.passProp("overlap"); }\n get resize() { return this.passProp("resize"); }\n}\nconst showHoverTooltipHost = /*@__PURE__*/showTooltip.compute([showHoverTooltip], state => {\n let tooltips = state.facet(showHoverTooltip);\n if (tooltips.length === 0)\n return null;\n return {\n pos: Math.min(...tooltips.map(t => t.pos)),\n end: Math.max(...tooltips.map(t => { var _a; return (_a = t.end) !== null && _a !== void 0 ? _a : t.pos; })),\n create: HoverTooltipHost.create,\n above: tooltips[0].above,\n arrow: tooltips.some(t => t.arrow),\n };\n});\nclass HoverPlugin {\n constructor(view, source, field, setHover, hoverTime) {\n this.view = view;\n this.source = source;\n this.field = field;\n this.setHover = setHover;\n this.hoverTime = hoverTime;\n this.hoverTimeout = -1;\n this.restartTimeout = -1;\n this.pending = null;\n this.lastMove = { x: 0, y: 0, target: view.dom, time: 0 };\n this.checkHover = this.checkHover.bind(this);\n view.dom.addEventListener("mouseleave", this.mouseleave = this.mouseleave.bind(this));\n view.dom.addEventListener("mousemove", this.mousemove = this.mousemove.bind(this));\n }\n update() {\n if (this.pending) {\n this.pending = null;\n clearTimeout(this.restartTimeout);\n this.restartTimeout = setTimeout(() => this.startHover(), 20);\n }\n }\n get active() {\n return this.view.state.field(this.field);\n }\n checkHover() {\n this.hoverTimeout = -1;\n if (this.active.length)\n return;\n let hovered = Date.now() - this.lastMove.time;\n if (hovered < this.hoverTime)\n this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime - hovered);\n else\n this.startHover();\n }\n startHover() {\n clearTimeout(this.restartTimeout);\n let { view, lastMove } = this;\n let desc = view.docView.nearest(lastMove.target);\n if (!desc)\n return;\n let pos, side = 1;\n if (desc instanceof WidgetView) {\n pos = desc.posAtStart;\n }\n else {\n pos = view.posAtCoords(lastMove);\n if (pos == null)\n return;\n let posCoords = view.coordsAtPos(pos);\n if (!posCoords ||\n lastMove.y < posCoords.top || lastMove.y > posCoords.bottom ||\n lastMove.x < posCoords.left - view.defaultCharacterWidth ||\n lastMove.x > posCoords.right + view.defaultCharacterWidth)\n return;\n let bidi = view.bidiSpans(view.state.doc.lineAt(pos)).find(s => s.from <= pos && s.to >= pos);\n let rtl = bidi && bidi.dir == Direction.RTL ? -1 : 1;\n side = (lastMove.x < posCoords.left ? -rtl : rtl);\n }\n let open = this.source(view, pos, side);\n if (open === null || open === void 0 ? void 0 : open.then) {\n let pending = this.pending = { pos };\n open.then(result => {\n if (this.pending == pending) {\n this.pending = null;\n if (result && !(Array.isArray(result) && !result.length))\n view.dispatch({ effects: this.setHover.of(Array.isArray(result) ? result : [result]) });\n }\n }, e => logException(view.state, e, "hover tooltip"));\n }\n else if (open && !(Array.isArray(open) && !open.length)) {\n view.dispatch({ effects: this.setHover.of(Array.isArray(open) ? open : [open]) });\n }\n }\n get tooltip() {\n let plugin = this.view.plugin(tooltipPlugin);\n let index = plugin ? plugin.manager.tooltips.findIndex(t => t.create == HoverTooltipHost.create) : -1;\n return index > -1 ? plugin.manager.tooltipViews[index] : null;\n }\n mousemove(event) {\n var _a, _b;\n this.lastMove = { x: event.clientX, y: event.clientY, target: event.target, time: Date.now() };\n if (this.hoverTimeout < 0)\n this.hoverTimeout = setTimeout(this.checkHover, this.hoverTime);\n let { active, tooltip } = this;\n if (active.length && tooltip && !isInTooltip(tooltip.dom, event) || this.pending) {\n let { pos } = active[0] || this.pending, end = (_b = (_a = active[0]) === null || _a === void 0 ? void 0 : _a.end) !== null && _b !== void 0 ? _b : pos;\n if ((pos == end ? this.view.posAtCoords(this.lastMove) != pos\n : !isOverRange(this.view, pos, end, event.clientX, event.clientY))) {\n this.view.dispatch({ effects: this.setHover.of([]) });\n this.pending = null;\n }\n }\n }\n mouseleave(event) {\n clearTimeout(this.hoverTimeout);\n this.hoverTimeout = -1;\n let { active } = this;\n if (active.length) {\n let { tooltip } = this;\n let inTooltip = tooltip && tooltip.dom.contains(event.relatedTarget);\n if (!inTooltip)\n this.view.dispatch({ effects: this.setHover.of([]) });\n else\n this.watchTooltipLeave(tooltip.dom);\n }\n }\n watchTooltipLeave(tooltip) {\n let watch = (event) => {\n tooltip.removeEventListener("mouseleave", watch);\n if (this.active.length && !this.view.dom.contains(event.relatedTarget))\n this.view.dispatch({ effects: this.setHover.of([]) });\n };\n tooltip.addEventListener("mouseleave", watch);\n }\n destroy() {\n clearTimeout(this.hoverTimeout);\n this.view.dom.removeEventListener("mouseleave", this.mouseleave);\n this.view.dom.removeEventListener("mousemove", this.mousemove);\n }\n}\nconst tooltipMargin = 4;\nfunction isInTooltip(tooltip, event) {\n let rect = tooltip.getBoundingClientRect();\n return event.clientX >= rect.left - tooltipMargin && event.clientX <= rect.right + tooltipMargin &&\n event.clientY >= rect.top - tooltipMargin && event.clientY <= rect.bottom + tooltipMargin;\n}\nfunction isOverRange(view, from, to, x, y, margin) {\n let rect = view.scrollDOM.getBoundingClientRect();\n let docBottom = view.documentTop + view.documentPadding.top + view.contentHeight;\n if (rect.left > x || rect.right < x || rect.top > y || Math.min(rect.bottom, docBottom) < y)\n return false;\n let pos = view.posAtCoords({ x, y }, false);\n return pos >= from && pos <= to;\n}\n/**\nSet up a hover tooltip, which shows up when the pointer hovers\nover ranges of text. The callback is called when the mouse hovers\nover the document text. It should, if there is a tooltip\nassociated with position `pos`, return the tooltip description\n(either directly or in a promise). The `side` argument indicates\non which side of the position the pointer is—it will be -1 if the\npointer is before the position, 1 if after the position.\n\nNote that all hover tooltips are hosted within a single tooltip\ncontainer element. This allows multiple tooltips over the same\nrange to be "merged" together without overlapping.\n*/\nfunction hoverTooltip(source, options = {}) {\n let setHover = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define();\n let hoverState = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateField.define({\n create() { return []; },\n update(value, tr) {\n if (value.length) {\n if (options.hideOnChange && (tr.docChanged || tr.selection))\n value = [];\n else if (options.hideOn)\n value = value.filter(v => !options.hideOn(tr, v));\n if (tr.docChanged) {\n let mapped = [];\n for (let tooltip of value) {\n let newPos = tr.changes.mapPos(tooltip.pos, -1, _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.MapMode.TrackDel);\n if (newPos != null) {\n let copy = Object.assign(Object.create(null), tooltip);\n copy.pos = newPos;\n if (copy.end != null)\n copy.end = tr.changes.mapPos(copy.end);\n mapped.push(copy);\n }\n }\n value = mapped;\n }\n }\n for (let effect of tr.effects) {\n if (effect.is(setHover))\n value = effect.value;\n if (effect.is(closeHoverTooltipEffect))\n value = [];\n }\n return value;\n },\n provide: f => showHoverTooltip.from(f)\n });\n return [\n hoverState,\n ViewPlugin.define(view => new HoverPlugin(view, source, hoverState, setHover, options.hoverTime || 300 /* Hover.Time */)),\n showHoverTooltipHost\n ];\n}\n/**\nGet the active tooltip view for a given tooltip, if available.\n*/\nfunction getTooltip(view, tooltip) {\n let plugin = view.plugin(tooltipPlugin);\n if (!plugin)\n return null;\n let found = plugin.manager.tooltips.indexOf(tooltip);\n return found < 0 ? null : plugin.manager.tooltipViews[found];\n}\n/**\nReturns true if any hover tooltips are currently active.\n*/\nfunction hasHoverTooltips(state) {\n return state.facet(showHoverTooltip).some(x => x);\n}\nconst closeHoverTooltipEffect = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.StateEffect.define();\n/**\nTransaction effect that closes all hover tooltips.\n*/\nconst closeHoverTooltips = /*@__PURE__*/closeHoverTooltipEffect.of(null);\n/**\nTell the tooltip extension to recompute the position of the active\ntooltips. This can be useful when something happens (such as a\nre-positioning or CSS change affecting the editor) that could\ninvalidate the existing tooltip positions.\n*/\nfunction repositionTooltips(view) {\n let plugin = view.plugin(tooltipPlugin);\n if (plugin)\n plugin.maybeMeasure();\n}\n\nconst panelConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine(configs) {\n let topContainer, bottomContainer;\n for (let c of configs) {\n topContainer = topContainer || c.topContainer;\n bottomContainer = bottomContainer || c.bottomContainer;\n }\n return { topContainer, bottomContainer };\n }\n});\n/**\nConfigures the panel-managing extension.\n*/\nfunction panels(config) {\n return config ? [panelConfig.of(config)] : [];\n}\n/**\nGet the active panel created by the given constructor, if any.\nThis can be useful when you need access to your panels\' DOM\nstructure.\n*/\nfunction getPanel(view, panel) {\n let plugin = view.plugin(panelPlugin);\n let index = plugin ? plugin.specs.indexOf(panel) : -1;\n return index > -1 ? plugin.panels[index] : null;\n}\nconst panelPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor(view) {\n this.input = view.state.facet(showPanel);\n this.specs = this.input.filter(s => s);\n this.panels = this.specs.map(spec => spec(view));\n let conf = view.state.facet(panelConfig);\n this.top = new PanelGroup(view, true, conf.topContainer);\n this.bottom = new PanelGroup(view, false, conf.bottomContainer);\n this.top.sync(this.panels.filter(p => p.top));\n this.bottom.sync(this.panels.filter(p => !p.top));\n for (let p of this.panels) {\n p.dom.classList.add("cm-panel");\n if (p.mount)\n p.mount();\n }\n }\n update(update) {\n let conf = update.state.facet(panelConfig);\n if (this.top.container != conf.topContainer) {\n this.top.sync([]);\n this.top = new PanelGroup(update.view, true, conf.topContainer);\n }\n if (this.bottom.container != conf.bottomContainer) {\n this.bottom.sync([]);\n this.bottom = new PanelGroup(update.view, false, conf.bottomContainer);\n }\n this.top.syncClasses();\n this.bottom.syncClasses();\n let input = update.state.facet(showPanel);\n if (input != this.input) {\n let specs = input.filter(x => x);\n let panels = [], top = [], bottom = [], mount = [];\n for (let spec of specs) {\n let known = this.specs.indexOf(spec), panel;\n if (known < 0) {\n panel = spec(update.view);\n mount.push(panel);\n }\n else {\n panel = this.panels[known];\n if (panel.update)\n panel.update(update);\n }\n panels.push(panel);\n (panel.top ? top : bottom).push(panel);\n }\n this.specs = specs;\n this.panels = panels;\n this.top.sync(top);\n this.bottom.sync(bottom);\n for (let p of mount) {\n p.dom.classList.add("cm-panel");\n if (p.mount)\n p.mount();\n }\n }\n else {\n for (let p of this.panels)\n if (p.update)\n p.update(update);\n }\n }\n destroy() {\n this.top.sync([]);\n this.bottom.sync([]);\n }\n}, {\n provide: plugin => EditorView.scrollMargins.of(view => {\n let value = view.plugin(plugin);\n return value && { top: value.top.scrollMargin(), bottom: value.bottom.scrollMargin() };\n })\n});\nclass PanelGroup {\n constructor(view, top, container) {\n this.view = view;\n this.top = top;\n this.container = container;\n this.dom = undefined;\n this.classes = "";\n this.panels = [];\n this.syncClasses();\n }\n sync(panels) {\n for (let p of this.panels)\n if (p.destroy && panels.indexOf(p) < 0)\n p.destroy();\n this.panels = panels;\n this.syncDOM();\n }\n syncDOM() {\n if (this.panels.length == 0) {\n if (this.dom) {\n this.dom.remove();\n this.dom = undefined;\n }\n return;\n }\n if (!this.dom) {\n this.dom = document.createElement("div");\n this.dom.className = this.top ? "cm-panels cm-panels-top" : "cm-panels cm-panels-bottom";\n this.dom.style[this.top ? "top" : "bottom"] = "0";\n let parent = this.container || this.view.dom;\n parent.insertBefore(this.dom, this.top ? parent.firstChild : null);\n }\n let curDOM = this.dom.firstChild;\n for (let panel of this.panels) {\n if (panel.dom.parentNode == this.dom) {\n while (curDOM != panel.dom)\n curDOM = rm(curDOM);\n curDOM = curDOM.nextSibling;\n }\n else {\n this.dom.insertBefore(panel.dom, curDOM);\n }\n }\n while (curDOM)\n curDOM = rm(curDOM);\n }\n scrollMargin() {\n return !this.dom || this.container ? 0\n : Math.max(0, this.top ?\n this.dom.getBoundingClientRect().bottom - Math.max(0, this.view.scrollDOM.getBoundingClientRect().top) :\n Math.min(innerHeight, this.view.scrollDOM.getBoundingClientRect().bottom) - this.dom.getBoundingClientRect().top);\n }\n syncClasses() {\n if (!this.container || this.classes == this.view.themeClasses)\n return;\n for (let cls of this.classes.split(" "))\n if (cls)\n this.container.classList.remove(cls);\n for (let cls of (this.classes = this.view.themeClasses).split(" "))\n if (cls)\n this.container.classList.add(cls);\n }\n}\nfunction rm(node) {\n let next = node.nextSibling;\n node.remove();\n return next;\n}\n/**\nOpening a panel is done by providing a constructor function for\nthe panel through this facet. (The panel is closed again when its\nconstructor is no longer provided.) Values of `null` are ignored.\n*/\nconst showPanel = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n enables: panelPlugin\n});\n\n/**\nA gutter marker represents a bit of information attached to a line\nin a specific gutter. Your own custom markers have to extend this\nclass.\n*/\nclass GutterMarker extends _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeValue {\n /**\n @internal\n */\n compare(other) {\n return this == other || this.constructor == other.constructor && this.eq(other);\n }\n /**\n Compare this marker to another marker of the same type.\n */\n eq(other) { return false; }\n /**\n Called if the marker has a `toDOM` method and its representation\n was removed from a gutter.\n */\n destroy(dom) { }\n}\nGutterMarker.prototype.elementClass = "";\nGutterMarker.prototype.toDOM = undefined;\nGutterMarker.prototype.mapMode = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.MapMode.TrackBefore;\nGutterMarker.prototype.startSide = GutterMarker.prototype.endSide = -1;\nGutterMarker.prototype.point = true;\n/**\nFacet used to add a class to all gutter elements for a given line.\nMarkers given to this facet should _only_ define an\n[`elementclass`](https://codemirror.net/6/docs/ref/#view.GutterMarker.elementClass), not a\n[`toDOM`](https://codemirror.net/6/docs/ref/#view.GutterMarker.toDOM) (or the marker will appear\nin all gutters for the line).\n*/\nconst gutterLineClass = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst defaults = {\n class: "",\n renderEmptyElements: false,\n elementStyle: "",\n markers: () => _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.empty,\n lineMarker: () => null,\n widgetMarker: () => null,\n lineMarkerChange: null,\n initialSpacer: null,\n updateSpacer: null,\n domEventHandlers: {}\n};\nconst activeGutters = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\n/**\nDefine an editor gutter. The order in which the gutters appear is\ndetermined by their extension priority.\n*/\nfunction gutter(config) {\n return [gutters(), activeGutters.of(Object.assign(Object.assign({}, defaults), config))];\n}\nconst unfixGutters = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine: values => values.some(x => x)\n});\n/**\nThe gutter-drawing plugin is automatically enabled when you add a\ngutter, but you can use this function to explicitly configure it.\n\nUnless `fixed` is explicitly set to `false`, the gutters are\nfixed, meaning they don\'t scroll along with the content\nhorizontally (except on Internet Explorer, which doesn\'t support\nCSS [`position:\nsticky`](https://developer.mozilla.org/en-US/docs/Web/CSS/position#sticky)).\n*/\nfunction gutters(config) {\n let result = [\n gutterView,\n ];\n if (config && config.fixed === false)\n result.push(unfixGutters.of(true));\n return result;\n}\nconst gutterView = /*@__PURE__*/ViewPlugin.fromClass(class {\n constructor(view) {\n this.view = view;\n this.prevViewport = view.viewport;\n this.dom = document.createElement("div");\n this.dom.className = "cm-gutters";\n this.dom.setAttribute("aria-hidden", "true");\n this.dom.style.minHeight = (this.view.contentHeight / this.view.scaleY) + "px";\n this.gutters = view.state.facet(activeGutters).map(conf => new SingleGutterView(view, conf));\n for (let gutter of this.gutters)\n this.dom.appendChild(gutter.dom);\n this.fixed = !view.state.facet(unfixGutters);\n if (this.fixed) {\n // FIXME IE11 fallback, which doesn\'t support position: sticky,\n // by using position: relative + event handlers that realign the\n // gutter (or just force fixed=false on IE11?)\n this.dom.style.position = "sticky";\n }\n this.syncGutters(false);\n view.scrollDOM.insertBefore(this.dom, view.contentDOM);\n }\n update(update) {\n if (this.updateGutters(update)) {\n // Detach during sync when the viewport changed significantly\n // (such as during scrolling), since for large updates that is\n // faster.\n let vpA = this.prevViewport, vpB = update.view.viewport;\n let vpOverlap = Math.min(vpA.to, vpB.to) - Math.max(vpA.from, vpB.from);\n this.syncGutters(vpOverlap < (vpB.to - vpB.from) * 0.8);\n }\n if (update.geometryChanged) {\n this.dom.style.minHeight = (this.view.contentHeight / this.view.scaleY) + "px";\n }\n if (this.view.state.facet(unfixGutters) != !this.fixed) {\n this.fixed = !this.fixed;\n this.dom.style.position = this.fixed ? "sticky" : "";\n }\n this.prevViewport = update.view.viewport;\n }\n syncGutters(detach) {\n let after = this.dom.nextSibling;\n if (detach)\n this.dom.remove();\n let lineClasses = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.iter(this.view.state.facet(gutterLineClass), this.view.viewport.from);\n let classSet = [];\n let contexts = this.gutters.map(gutter => new UpdateContext(gutter, this.view.viewport, -this.view.documentPadding.top));\n for (let line of this.view.viewportLineBlocks) {\n if (classSet.length)\n classSet = [];\n if (Array.isArray(line.type)) {\n let first = true;\n for (let b of line.type) {\n if (b.type == BlockType.Text && first) {\n advanceCursor(lineClasses, classSet, b.from);\n for (let cx of contexts)\n cx.line(this.view, b, classSet);\n first = false;\n }\n else if (b.widget) {\n for (let cx of contexts)\n cx.widget(this.view, b);\n }\n }\n }\n else if (line.type == BlockType.Text) {\n advanceCursor(lineClasses, classSet, line.from);\n for (let cx of contexts)\n cx.line(this.view, line, classSet);\n }\n else if (line.widget) {\n for (let cx of contexts)\n cx.widget(this.view, line);\n }\n }\n for (let cx of contexts)\n cx.finish();\n if (detach)\n this.view.scrollDOM.insertBefore(this.dom, after);\n }\n updateGutters(update) {\n let prev = update.startState.facet(activeGutters), cur = update.state.facet(activeGutters);\n let change = update.docChanged || update.heightChanged || update.viewportChanged ||\n !_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.eq(update.startState.facet(gutterLineClass), update.state.facet(gutterLineClass), update.view.viewport.from, update.view.viewport.to);\n if (prev == cur) {\n for (let gutter of this.gutters)\n if (gutter.update(update))\n change = true;\n }\n else {\n change = true;\n let gutters = [];\n for (let conf of cur) {\n let known = prev.indexOf(conf);\n if (known < 0) {\n gutters.push(new SingleGutterView(this.view, conf));\n }\n else {\n this.gutters[known].update(update);\n gutters.push(this.gutters[known]);\n }\n }\n for (let g of this.gutters) {\n g.dom.remove();\n if (gutters.indexOf(g) < 0)\n g.destroy();\n }\n for (let g of gutters)\n this.dom.appendChild(g.dom);\n this.gutters = gutters;\n }\n return change;\n }\n destroy() {\n for (let view of this.gutters)\n view.destroy();\n this.dom.remove();\n }\n}, {\n provide: plugin => EditorView.scrollMargins.of(view => {\n let value = view.plugin(plugin);\n if (!value || value.gutters.length == 0 || !value.fixed)\n return null;\n return view.textDirection == Direction.LTR\n ? { left: value.dom.offsetWidth * view.scaleX }\n : { right: value.dom.offsetWidth * view.scaleX };\n })\n});\nfunction asArray(val) { return (Array.isArray(val) ? val : [val]); }\nfunction advanceCursor(cursor, collect, pos) {\n while (cursor.value && cursor.from <= pos) {\n if (cursor.from == pos)\n collect.push(cursor.value);\n cursor.next();\n }\n}\nclass UpdateContext {\n constructor(gutter, viewport, height) {\n this.gutter = gutter;\n this.height = height;\n this.i = 0;\n this.cursor = _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.iter(gutter.markers, viewport.from);\n }\n addElement(view, block, markers) {\n let { gutter } = this, above = (block.top - this.height) / view.scaleY, height = block.height / view.scaleY;\n if (this.i == gutter.elements.length) {\n let newElt = new GutterElement(view, height, above, markers);\n gutter.elements.push(newElt);\n gutter.dom.appendChild(newElt.dom);\n }\n else {\n gutter.elements[this.i].update(view, height, above, markers);\n }\n this.height = block.bottom;\n this.i++;\n }\n line(view, line, extraMarkers) {\n let localMarkers = [];\n advanceCursor(this.cursor, localMarkers, line.from);\n if (extraMarkers.length)\n localMarkers = localMarkers.concat(extraMarkers);\n let forLine = this.gutter.config.lineMarker(view, line, localMarkers);\n if (forLine)\n localMarkers.unshift(forLine);\n let gutter = this.gutter;\n if (localMarkers.length == 0 && !gutter.config.renderEmptyElements)\n return;\n this.addElement(view, line, localMarkers);\n }\n widget(view, block) {\n let marker = this.gutter.config.widgetMarker(view, block.widget, block);\n if (marker)\n this.addElement(view, block, [marker]);\n }\n finish() {\n let gutter = this.gutter;\n while (gutter.elements.length > this.i) {\n let last = gutter.elements.pop();\n gutter.dom.removeChild(last.dom);\n last.destroy();\n }\n }\n}\nclass SingleGutterView {\n constructor(view, config) {\n this.view = view;\n this.config = config;\n this.elements = [];\n this.spacer = null;\n this.dom = document.createElement("div");\n this.dom.className = "cm-gutter" + (this.config.class ? " " + this.config.class : "");\n for (let prop in config.domEventHandlers) {\n this.dom.addEventListener(prop, (event) => {\n let target = event.target, y;\n if (target != this.dom && this.dom.contains(target)) {\n while (target.parentNode != this.dom)\n target = target.parentNode;\n let rect = target.getBoundingClientRect();\n y = (rect.top + rect.bottom) / 2;\n }\n else {\n y = event.clientY;\n }\n let line = view.lineBlockAtHeight(y - view.documentTop);\n if (config.domEventHandlers[prop](view, line, event))\n event.preventDefault();\n });\n }\n this.markers = asArray(config.markers(view));\n if (config.initialSpacer) {\n this.spacer = new GutterElement(view, 0, 0, [config.initialSpacer(view)]);\n this.dom.appendChild(this.spacer.dom);\n this.spacer.dom.style.cssText += "visibility: hidden; pointer-events: none";\n }\n }\n update(update) {\n let prevMarkers = this.markers;\n this.markers = asArray(this.config.markers(update.view));\n if (this.spacer && this.config.updateSpacer) {\n let updated = this.config.updateSpacer(this.spacer.markers[0], update);\n if (updated != this.spacer.markers[0])\n this.spacer.update(update.view, 0, 0, [updated]);\n }\n let vp = update.view.viewport;\n return !_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.eq(this.markers, prevMarkers, vp.from, vp.to) ||\n (this.config.lineMarkerChange ? this.config.lineMarkerChange(update) : false);\n }\n destroy() {\n for (let elt of this.elements)\n elt.destroy();\n }\n}\nclass GutterElement {\n constructor(view, height, above, markers) {\n this.height = -1;\n this.above = 0;\n this.markers = [];\n this.dom = document.createElement("div");\n this.dom.className = "cm-gutterElement";\n this.update(view, height, above, markers);\n }\n update(view, height, above, markers) {\n if (this.height != height) {\n this.height = height;\n this.dom.style.height = height + "px";\n }\n if (this.above != above)\n this.dom.style.marginTop = (this.above = above) ? above + "px" : "";\n if (!sameMarkers(this.markers, markers))\n this.setMarkers(view, markers);\n }\n setMarkers(view, markers) {\n let cls = "cm-gutterElement", domPos = this.dom.firstChild;\n for (let iNew = 0, iOld = 0;;) {\n let skipTo = iOld, marker = iNew < markers.length ? markers[iNew++] : null, matched = false;\n if (marker) {\n let c = marker.elementClass;\n if (c)\n cls += " " + c;\n for (let i = iOld; i < this.markers.length; i++)\n if (this.markers[i].compare(marker)) {\n skipTo = i;\n matched = true;\n break;\n }\n }\n else {\n skipTo = this.markers.length;\n }\n while (iOld < skipTo) {\n let next = this.markers[iOld++];\n if (next.toDOM) {\n next.destroy(domPos);\n let after = domPos.nextSibling;\n domPos.remove();\n domPos = after;\n }\n }\n if (!marker)\n break;\n if (marker.toDOM) {\n if (matched)\n domPos = domPos.nextSibling;\n else\n this.dom.insertBefore(marker.toDOM(view), domPos);\n }\n if (matched)\n iOld++;\n }\n this.dom.className = cls;\n this.markers = markers;\n }\n destroy() {\n this.setMarkers(null, []); // First argument not used unless creating markers\n }\n}\nfunction sameMarkers(a, b) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (!a[i].compare(b[i]))\n return false;\n return true;\n}\n/**\nFacet used to provide markers to the line number gutter.\n*/\nconst lineNumberMarkers = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define();\nconst lineNumberConfig = /*@__PURE__*/_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.Facet.define({\n combine(values) {\n return (0,_codemirror_state__WEBPACK_IMPORTED_MODULE_2__.combineConfig)(values, { formatNumber: String, domEventHandlers: {} }, {\n domEventHandlers(a, b) {\n let result = Object.assign({}, a);\n for (let event in b) {\n let exists = result[event], add = b[event];\n result[event] = exists ? (view, line, event) => exists(view, line, event) || add(view, line, event) : add;\n }\n return result;\n }\n });\n }\n});\nclass NumberMarker extends GutterMarker {\n constructor(number) {\n super();\n this.number = number;\n }\n eq(other) { return this.number == other.number; }\n toDOM() { return document.createTextNode(this.number); }\n}\nfunction formatNumber(view, number) {\n return view.state.facet(lineNumberConfig).formatNumber(number, view.state);\n}\nconst lineNumberGutter = /*@__PURE__*/activeGutters.compute([lineNumberConfig], state => ({\n class: "cm-lineNumbers",\n renderEmptyElements: false,\n markers(view) { return view.state.facet(lineNumberMarkers); },\n lineMarker(view, line, others) {\n if (others.some(m => m.toDOM))\n return null;\n return new NumberMarker(formatNumber(view, view.state.doc.lineAt(line.from).number));\n },\n widgetMarker: () => null,\n lineMarkerChange: update => update.startState.facet(lineNumberConfig) != update.state.facet(lineNumberConfig),\n initialSpacer(view) {\n return new NumberMarker(formatNumber(view, maxLineNumber(view.state.doc.lines)));\n },\n updateSpacer(spacer, update) {\n let max = formatNumber(update.view, maxLineNumber(update.view.state.doc.lines));\n return max == spacer.number ? spacer : new NumberMarker(max);\n },\n domEventHandlers: state.facet(lineNumberConfig).domEventHandlers\n}));\n/**\nCreate a line number gutter extension.\n*/\nfunction lineNumbers(config = {}) {\n return [\n lineNumberConfig.of(config),\n gutters(),\n lineNumberGutter\n ];\n}\nfunction maxLineNumber(lines) {\n let last = 9;\n while (last < lines)\n last = last * 10 + 9;\n return last;\n}\nconst activeLineGutterMarker = /*@__PURE__*/new class extends GutterMarker {\n constructor() {\n super(...arguments);\n this.elementClass = "cm-activeLineGutter";\n }\n};\nconst activeLineGutterHighlighter = /*@__PURE__*/gutterLineClass.compute(["selection"], state => {\n let marks = [], last = -1;\n for (let range of state.selection.ranges) {\n let linePos = state.doc.lineAt(range.head).from;\n if (linePos > last) {\n last = linePos;\n marks.push(activeLineGutterMarker.range(linePos));\n }\n }\n return _codemirror_state__WEBPACK_IMPORTED_MODULE_2__.RangeSet.of(marks);\n});\n/**\nReturns an extension that adds a `cm-activeLineGutter` class to\nall gutter elements on the [active\nline](https://codemirror.net/6/docs/ref/#view.highlightActiveLine).\n*/\nfunction highlightActiveLineGutter() {\n return activeLineGutterHighlighter;\n}\n\nconst WhitespaceDeco = /*@__PURE__*/new Map();\nfunction getWhitespaceDeco(space) {\n let deco = WhitespaceDeco.get(space);\n if (!deco)\n WhitespaceDeco.set(space, deco = Decoration.mark({\n attributes: space === "\\t" ? {\n class: "cm-highlightTab",\n } : {\n class: "cm-highlightSpace",\n "data-display": space.replace(/ /g, "·")\n }\n }));\n return deco;\n}\nfunction matcher(decorator) {\n return ViewPlugin.define(view => ({\n decorations: decorator.createDeco(view),\n update(u) {\n this.decorations = decorator.updateDeco(u, this.decorations);\n },\n }), {\n decorations: v => v.decorations\n });\n}\nconst whitespaceHighlighter = /*@__PURE__*/matcher(/*@__PURE__*/new MatchDecorator({\n regexp: /\\t| +/g,\n decoration: match => getWhitespaceDeco(match[0]),\n boundary: /\\S/,\n}));\n/**\nReturns an extension that highlights whitespace, adding a\n`cm-highlightSpace` class to stretches of spaces, and a\n`cm-highlightTab` class to individual tab characters. By default,\nthe former are shown as faint dots, and the latter as arrows.\n*/\nfunction highlightWhitespace() {\n return whitespaceHighlighter;\n}\nconst trailingHighlighter = /*@__PURE__*/matcher(/*@__PURE__*/new MatchDecorator({\n regexp: /\\s+$/g,\n decoration: /*@__PURE__*/Decoration.mark({ class: "cm-trailingSpace" }),\n boundary: /\\S/,\n}));\n/**\nReturns an extension that adds a `cm-trailingSpace` class to all\ntrailing whitespace.\n*/\nfunction highlightTrailingWhitespace() {\n return trailingHighlighter;\n}\n\n/**\n@internal\n*/\nconst __test = { HeightMap, HeightOracle, MeasuredHeights, QueryType, ChangedRange, computeOrder, moveVisually };\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@codemirror/view/dist/index.js?')},"./node_modules/@lezer/common/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DefaultBufferLength: () => (/* binding */ DefaultBufferLength),\n/* harmony export */ IterMode: () => (/* binding */ IterMode),\n/* harmony export */ MountedTree: () => (/* binding */ MountedTree),\n/* harmony export */ NodeProp: () => (/* binding */ NodeProp),\n/* harmony export */ NodeSet: () => (/* binding */ NodeSet),\n/* harmony export */ NodeType: () => (/* binding */ NodeType),\n/* harmony export */ NodeWeakMap: () => (/* binding */ NodeWeakMap),\n/* harmony export */ Parser: () => (/* binding */ Parser),\n/* harmony export */ Tree: () => (/* binding */ Tree),\n/* harmony export */ TreeBuffer: () => (/* binding */ TreeBuffer),\n/* harmony export */ TreeCursor: () => (/* binding */ TreeCursor),\n/* harmony export */ TreeFragment: () => (/* binding */ TreeFragment),\n/* harmony export */ parseMixed: () => (/* binding */ parseMixed)\n/* harmony export */ });\n/**\nThe default maximum length of a `TreeBuffer` node.\n*/\nconst DefaultBufferLength = 1024;\nlet nextPropID = 0;\nclass Range {\n constructor(from, to) {\n this.from = from;\n this.to = to;\n }\n}\n/**\nEach [node type](#common.NodeType) or [individual tree](#common.Tree)\ncan have metadata associated with it in props. Instances of this\nclass represent prop names.\n*/\nclass NodeProp {\n /**\n Create a new node prop type.\n */\n constructor(config = {}) {\n this.id = nextPropID++;\n this.perNode = !!config.perNode;\n this.deserialize = config.deserialize || (() => {\n throw new Error("This node type doesn\'t define a deserialize function");\n });\n }\n /**\n This is meant to be used with\n [`NodeSet.extend`](#common.NodeSet.extend) or\n [`LRParser.configure`](#lr.ParserConfig.props) to compute\n prop values for each node type in the set. Takes a [match\n object](#common.NodeType^match) or function that returns undefined\n if the node type doesn\'t get this prop, and the prop\'s value if\n it does.\n */\n add(match) {\n if (this.perNode)\n throw new RangeError("Can\'t add per-node props to node types");\n if (typeof match != "function")\n match = NodeType.match(match);\n return (type) => {\n let result = match(type);\n return result === undefined ? null : [this, result];\n };\n }\n}\n/**\nProp that is used to describe matching delimiters. For opening\ndelimiters, this holds an array of node names (written as a\nspace-separated string when declaring this prop in a grammar)\nfor the node types of closing delimiters that match it.\n*/\nNodeProp.closedBy = new NodeProp({ deserialize: str => str.split(" ") });\n/**\nThe inverse of [`closedBy`](#common.NodeProp^closedBy). This is\nattached to closing delimiters, holding an array of node names\nof types of matching opening delimiters.\n*/\nNodeProp.openedBy = new NodeProp({ deserialize: str => str.split(" ") });\n/**\nUsed to assign node types to groups (for example, all node\ntypes that represent an expression could be tagged with an\n`"Expression"` group).\n*/\nNodeProp.group = new NodeProp({ deserialize: str => str.split(" ") });\n/**\nAttached to nodes to indicate these should be\n[displayed](https://codemirror.net/docs/ref/#language.syntaxTree)\nin a bidirectional text isolate, so that direction-neutral\ncharacters on their sides don\'t incorrectly get associated with\nsurrounding text. You\'ll generally want to set this for nodes\nthat contain arbitrary text, like strings and comments, and for\nnodes that appear _inside_ arbitrary text, like HTML tags. When\nnot given a value, in a grammar declaration, defaults to\n`"auto"`.\n*/\nNodeProp.isolate = new NodeProp({ deserialize: value => {\n if (value && value != "rtl" && value != "ltr" && value != "auto")\n throw new RangeError("Invalid value for isolate: " + value);\n return value || "auto";\n } });\n/**\nThe hash of the [context](#lr.ContextTracker.constructor)\nthat the node was parsed in, if any. Used to limit reuse of\ncontextual nodes.\n*/\nNodeProp.contextHash = new NodeProp({ perNode: true });\n/**\nThe distance beyond the end of the node that the tokenizer\nlooked ahead for any of the tokens inside the node. (The LR\nparser only stores this when it is larger than 25, for\nefficiency reasons.)\n*/\nNodeProp.lookAhead = new NodeProp({ perNode: true });\n/**\nThis per-node prop is used to replace a given node, or part of a\nnode, with another tree. This is useful to include trees from\ndifferent languages in mixed-language parsers.\n*/\nNodeProp.mounted = new NodeProp({ perNode: true });\n/**\nA mounted tree, which can be [stored](#common.NodeProp^mounted) on\na tree node to indicate that parts of its content are\nrepresented by another tree.\n*/\nclass MountedTree {\n constructor(\n /**\n The inner tree.\n */\n tree, \n /**\n If this is null, this tree replaces the entire node (it will\n be included in the regular iteration instead of its host\n node). If not, only the given ranges are considered to be\n covered by this tree. This is used for trees that are mixed in\n a way that isn\'t strictly hierarchical. Such mounted trees are\n only entered by [`resolveInner`](#common.Tree.resolveInner)\n and [`enter`](#common.SyntaxNode.enter).\n */\n overlay, \n /**\n The parser used to create this subtree.\n */\n parser) {\n this.tree = tree;\n this.overlay = overlay;\n this.parser = parser;\n }\n /**\n @internal\n */\n static get(tree) {\n return tree && tree.props && tree.props[NodeProp.mounted.id];\n }\n}\nconst noProps = Object.create(null);\n/**\nEach node in a syntax tree has a node type associated with it.\n*/\nclass NodeType {\n /**\n @internal\n */\n constructor(\n /**\n The name of the node type. Not necessarily unique, but if the\n grammar was written properly, different node types with the\n same name within a node set should play the same semantic\n role.\n */\n name, \n /**\n @internal\n */\n props, \n /**\n The id of this node in its set. Corresponds to the term ids\n used in the parser.\n */\n id, \n /**\n @internal\n */\n flags = 0) {\n this.name = name;\n this.props = props;\n this.id = id;\n this.flags = flags;\n }\n /**\n Define a node type.\n */\n static define(spec) {\n let props = spec.props && spec.props.length ? Object.create(null) : noProps;\n let flags = (spec.top ? 1 /* NodeFlag.Top */ : 0) | (spec.skipped ? 2 /* NodeFlag.Skipped */ : 0) |\n (spec.error ? 4 /* NodeFlag.Error */ : 0) | (spec.name == null ? 8 /* NodeFlag.Anonymous */ : 0);\n let type = new NodeType(spec.name || "", props, spec.id, flags);\n if (spec.props)\n for (let src of spec.props) {\n if (!Array.isArray(src))\n src = src(type);\n if (src) {\n if (src[0].perNode)\n throw new RangeError("Can\'t store a per-node prop on a node type");\n props[src[0].id] = src[1];\n }\n }\n return type;\n }\n /**\n Retrieves a node prop for this type. Will return `undefined` if\n the prop isn\'t present on this node.\n */\n prop(prop) { return this.props[prop.id]; }\n /**\n True when this is the top node of a grammar.\n */\n get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }\n /**\n True when this node is produced by a skip rule.\n */\n get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }\n /**\n Indicates whether this is an error node.\n */\n get isError() { return (this.flags & 4 /* NodeFlag.Error */) > 0; }\n /**\n When true, this node type doesn\'t correspond to a user-declared\n named node, for example because it is used to cache repetition.\n */\n get isAnonymous() { return (this.flags & 8 /* NodeFlag.Anonymous */) > 0; }\n /**\n Returns true when this node\'s name or one of its\n [groups](#common.NodeProp^group) matches the given string.\n */\n is(name) {\n if (typeof name == \'string\') {\n if (this.name == name)\n return true;\n let group = this.prop(NodeProp.group);\n return group ? group.indexOf(name) > -1 : false;\n }\n return this.id == name;\n }\n /**\n Create a function from node types to arbitrary values by\n specifying an object whose property names are node or\n [group](#common.NodeProp^group) names. Often useful with\n [`NodeProp.add`](#common.NodeProp.add). You can put multiple\n names, separated by spaces, in a single property name to map\n multiple node names to a single value.\n */\n static match(map) {\n let direct = Object.create(null);\n for (let prop in map)\n for (let name of prop.split(" "))\n direct[name] = map[prop];\n return (node) => {\n for (let groups = node.prop(NodeProp.group), i = -1; i < (groups ? groups.length : 0); i++) {\n let found = direct[i < 0 ? node.name : groups[i]];\n if (found)\n return found;\n }\n };\n }\n}\n/**\nAn empty dummy node type to use when no actual type is available.\n*/\nNodeType.none = new NodeType("", Object.create(null), 0, 8 /* NodeFlag.Anonymous */);\n/**\nA node set holds a collection of node types. It is used to\ncompactly represent trees by storing their type ids, rather than a\nfull pointer to the type object, in a numeric array. Each parser\n[has](#lr.LRParser.nodeSet) a node set, and [tree\nbuffers](#common.TreeBuffer) can only store collections of nodes\nfrom the same set. A set can have a maximum of 2**16 (65536) node\ntypes in it, so that the ids fit into 16-bit typed array slots.\n*/\nclass NodeSet {\n /**\n Create a set with the given types. The `id` property of each\n type should correspond to its position within the array.\n */\n constructor(\n /**\n The node types in this set, by id.\n */\n types) {\n this.types = types;\n for (let i = 0; i < types.length; i++)\n if (types[i].id != i)\n throw new RangeError("Node type ids should correspond to array positions when creating a node set");\n }\n /**\n Create a copy of this set with some node properties added. The\n arguments to this method can be created with\n [`NodeProp.add`](#common.NodeProp.add).\n */\n extend(...props) {\n let newTypes = [];\n for (let type of this.types) {\n let newProps = null;\n for (let source of props) {\n let add = source(type);\n if (add) {\n if (!newProps)\n newProps = Object.assign({}, type.props);\n newProps[add[0].id] = add[1];\n }\n }\n newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type);\n }\n return new NodeSet(newTypes);\n }\n}\nconst CachedNode = new WeakMap(), CachedInnerNode = new WeakMap();\n/**\nOptions that control iteration. Can be combined with the `|`\noperator to enable multiple ones.\n*/\nvar IterMode;\n(function (IterMode) {\n /**\n When enabled, iteration will only visit [`Tree`](#common.Tree)\n objects, not nodes packed into\n [`TreeBuffer`](#common.TreeBuffer)s.\n */\n IterMode[IterMode["ExcludeBuffers"] = 1] = "ExcludeBuffers";\n /**\n Enable this to make iteration include anonymous nodes (such as\n the nodes that wrap repeated grammar constructs into a balanced\n tree).\n */\n IterMode[IterMode["IncludeAnonymous"] = 2] = "IncludeAnonymous";\n /**\n By default, regular [mounted](#common.NodeProp^mounted) nodes\n replace their base node in iteration. Enable this to ignore them\n instead.\n */\n IterMode[IterMode["IgnoreMounts"] = 4] = "IgnoreMounts";\n /**\n This option only applies in\n [`enter`](#common.SyntaxNode.enter)-style methods. It tells the\n library to not enter mounted overlays if one covers the given\n position.\n */\n IterMode[IterMode["IgnoreOverlays"] = 8] = "IgnoreOverlays";\n})(IterMode || (IterMode = {}));\n/**\nA piece of syntax tree. There are two ways to approach these\ntrees: the way they are actually stored in memory, and the\nconvenient way.\n\nSyntax trees are stored as a tree of `Tree` and `TreeBuffer`\nobjects. By packing detail information into `TreeBuffer` leaf\nnodes, the representation is made a lot more memory-efficient.\n\nHowever, when you want to actually work with tree nodes, this\nrepresentation is very awkward, so most client code will want to\nuse the [`TreeCursor`](#common.TreeCursor) or\n[`SyntaxNode`](#common.SyntaxNode) interface instead, which provides\na view on some part of this data structure, and can be used to\nmove around to adjacent nodes.\n*/\nclass Tree {\n /**\n Construct a new tree. See also [`Tree.build`](#common.Tree^build).\n */\n constructor(\n /**\n The type of the top node.\n */\n type, \n /**\n This node\'s child nodes.\n */\n children, \n /**\n The positions (offsets relative to the start of this tree) of\n the children.\n */\n positions, \n /**\n The total length of this tree\n */\n length, \n /**\n Per-node [node props](#common.NodeProp) to associate with this node.\n */\n props) {\n this.type = type;\n this.children = children;\n this.positions = positions;\n this.length = length;\n /**\n @internal\n */\n this.props = null;\n if (props && props.length) {\n this.props = Object.create(null);\n for (let [prop, value] of props)\n this.props[typeof prop == "number" ? prop : prop.id] = value;\n }\n }\n /**\n @internal\n */\n toString() {\n let mounted = MountedTree.get(this);\n if (mounted && !mounted.overlay)\n return mounted.tree.toString();\n let children = "";\n for (let ch of this.children) {\n let str = ch.toString();\n if (str) {\n if (children)\n children += ",";\n children += str;\n }\n }\n return !this.type.name ? children :\n (/\\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) +\n (children.length ? "(" + children + ")" : "");\n }\n /**\n Get a [tree cursor](#common.TreeCursor) positioned at the top of\n the tree. Mode can be used to [control](#common.IterMode) which\n nodes the cursor visits.\n */\n cursor(mode = 0) {\n return new TreeCursor(this.topNode, mode);\n }\n /**\n Get a [tree cursor](#common.TreeCursor) pointing into this tree\n at the given position and side (see\n [`moveTo`](#common.TreeCursor.moveTo).\n */\n cursorAt(pos, side = 0, mode = 0) {\n let scope = CachedNode.get(this) || this.topNode;\n let cursor = new TreeCursor(scope);\n cursor.moveTo(pos, side);\n CachedNode.set(this, cursor._tree);\n return cursor;\n }\n /**\n Get a [syntax node](#common.SyntaxNode) object for the top of the\n tree.\n */\n get topNode() {\n return new TreeNode(this, 0, 0, null);\n }\n /**\n Get the [syntax node](#common.SyntaxNode) at the given position.\n If `side` is -1, this will move into nodes that end at the\n position. If 1, it\'ll move into nodes that start at the\n position. With 0, it\'ll only enter nodes that cover the position\n from both sides.\n \n Note that this will not enter\n [overlays](#common.MountedTree.overlay), and you often want\n [`resolveInner`](#common.Tree.resolveInner) instead.\n */\n resolve(pos, side = 0) {\n let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false);\n CachedNode.set(this, node);\n return node;\n }\n /**\n Like [`resolve`](#common.Tree.resolve), but will enter\n [overlaid](#common.MountedTree.overlay) nodes, producing a syntax node\n pointing into the innermost overlaid tree at the given position\n (with parent links going through all parent structure, including\n the host trees).\n */\n resolveInner(pos, side = 0) {\n let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true);\n CachedInnerNode.set(this, node);\n return node;\n }\n /**\n In some situations, it can be useful to iterate through all\n nodes around a position, including those in overlays that don\'t\n directly cover the position. This method gives you an iterator\n that will produce all nodes, from small to big, around the given\n position.\n */\n resolveStack(pos, side = 0) {\n return stackIterator(this, pos, side);\n }\n /**\n Iterate over the tree and its children, calling `enter` for any\n node that touches the `from`/`to` region (if given) before\n running over such a node\'s children, and `leave` (if given) when\n leaving the node. When `enter` returns `false`, that node will\n not have its children iterated over (or `leave` called).\n */\n iterate(spec) {\n let { enter, leave, from = 0, to = this.length } = spec;\n let mode = spec.mode || 0, anon = (mode & IterMode.IncludeAnonymous) > 0;\n for (let c = this.cursor(mode | IterMode.IncludeAnonymous);;) {\n let entered = false;\n if (c.from <= to && c.to >= from && (!anon && c.type.isAnonymous || enter(c) !== false)) {\n if (c.firstChild())\n continue;\n entered = true;\n }\n for (;;) {\n if (entered && leave && (anon || !c.type.isAnonymous))\n leave(c);\n if (c.nextSibling())\n break;\n if (!c.parent())\n return;\n entered = true;\n }\n }\n }\n /**\n Get the value of the given [node prop](#common.NodeProp) for this\n node. Works with both per-node and per-type props.\n */\n prop(prop) {\n return !prop.perNode ? this.type.prop(prop) : this.props ? this.props[prop.id] : undefined;\n }\n /**\n Returns the node\'s [per-node props](#common.NodeProp.perNode) in a\n format that can be passed to the [`Tree`](#common.Tree)\n constructor.\n */\n get propValues() {\n let result = [];\n if (this.props)\n for (let id in this.props)\n result.push([+id, this.props[id]]);\n return result;\n }\n /**\n Balance the direct children of this tree, producing a copy of\n which may have children grouped into subtrees with type\n [`NodeType.none`](#common.NodeType^none).\n */\n balance(config = {}) {\n return this.children.length <= 8 /* Balance.BranchFactor */ ? this :\n balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));\n }\n /**\n Build a tree from a postfix-ordered buffer of node information,\n or a cursor over such a buffer.\n */\n static build(data) { return buildTree(data); }\n}\n/**\nThe empty tree\n*/\nTree.empty = new Tree(NodeType.none, [], [], 0);\nclass FlatBufferCursor {\n constructor(buffer, index) {\n this.buffer = buffer;\n this.index = index;\n }\n get id() { return this.buffer[this.index - 4]; }\n get start() { return this.buffer[this.index - 3]; }\n get end() { return this.buffer[this.index - 2]; }\n get size() { return this.buffer[this.index - 1]; }\n get pos() { return this.index; }\n next() { this.index -= 4; }\n fork() { return new FlatBufferCursor(this.buffer, this.index); }\n}\n/**\nTree buffers contain (type, start, end, endIndex) quads for each\nnode. In such a buffer, nodes are stored in prefix order (parents\nbefore children, with the endIndex of the parent indicating which\nchildren belong to it).\n*/\nclass TreeBuffer {\n /**\n Create a tree buffer.\n */\n constructor(\n /**\n The buffer\'s content.\n */\n buffer, \n /**\n The total length of the group of nodes in the buffer.\n */\n length, \n /**\n The node set used in this buffer.\n */\n set) {\n this.buffer = buffer;\n this.length = length;\n this.set = set;\n }\n /**\n @internal\n */\n get type() { return NodeType.none; }\n /**\n @internal\n */\n toString() {\n let result = [];\n for (let index = 0; index < this.buffer.length;) {\n result.push(this.childString(index));\n index = this.buffer[index + 3];\n }\n return result.join(",");\n }\n /**\n @internal\n */\n childString(index) {\n let id = this.buffer[index], endIndex = this.buffer[index + 3];\n let type = this.set.types[id], result = type.name;\n if (/\\W/.test(result) && !type.isError)\n result = JSON.stringify(result);\n index += 4;\n if (endIndex == index)\n return result;\n let children = [];\n while (index < endIndex) {\n children.push(this.childString(index));\n index = this.buffer[index + 3];\n }\n return result + "(" + children.join(",") + ")";\n }\n /**\n @internal\n */\n findChild(startIndex, endIndex, dir, pos, side) {\n let { buffer } = this, pick = -1;\n for (let i = startIndex; i != endIndex; i = buffer[i + 3]) {\n if (checkSide(side, pos, buffer[i + 1], buffer[i + 2])) {\n pick = i;\n if (dir > 0)\n break;\n }\n }\n return pick;\n }\n /**\n @internal\n */\n slice(startI, endI, from) {\n let b = this.buffer;\n let copy = new Uint16Array(endI - startI), len = 0;\n for (let i = startI, j = 0; i < endI;) {\n copy[j++] = b[i++];\n copy[j++] = b[i++] - from;\n let to = copy[j++] = b[i++] - from;\n copy[j++] = b[i++] - startI;\n len = Math.max(len, to);\n }\n return new TreeBuffer(copy, len, this.set);\n }\n}\nfunction checkSide(side, pos, from, to) {\n switch (side) {\n case -2 /* Side.Before */: return from < pos;\n case -1 /* Side.AtOrBefore */: return to >= pos && from < pos;\n case 0 /* Side.Around */: return from < pos && to > pos;\n case 1 /* Side.AtOrAfter */: return from <= pos && to > pos;\n case 2 /* Side.After */: return to > pos;\n case 4 /* Side.DontCare */: return true;\n }\n}\nfunction resolveNode(node, pos, side, overlays) {\n var _a;\n // Move up to a node that actually holds the position, if possible\n while (node.from == node.to ||\n (side < 1 ? node.from >= pos : node.from > pos) ||\n (side > -1 ? node.to <= pos : node.to < pos)) {\n let parent = !overlays && node instanceof TreeNode && node.index < 0 ? null : node.parent;\n if (!parent)\n return node;\n node = parent;\n }\n let mode = overlays ? 0 : IterMode.IgnoreOverlays;\n // Must go up out of overlays when those do not overlap with pos\n if (overlays)\n for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) {\n if (scan instanceof TreeNode && scan.index < 0 && ((_a = parent.enter(pos, side, mode)) === null || _a === void 0 ? void 0 : _a.from) != scan.from)\n node = parent;\n }\n for (;;) {\n let inner = node.enter(pos, side, mode);\n if (!inner)\n return node;\n node = inner;\n }\n}\nclass BaseNode {\n cursor(mode = 0) { return new TreeCursor(this, mode); }\n getChild(type, before = null, after = null) {\n let r = getChildren(this, type, before, after);\n return r.length ? r[0] : null;\n }\n getChildren(type, before = null, after = null) {\n return getChildren(this, type, before, after);\n }\n resolve(pos, side = 0) {\n return resolveNode(this, pos, side, false);\n }\n resolveInner(pos, side = 0) {\n return resolveNode(this, pos, side, true);\n }\n matchContext(context) {\n return matchNodeContext(this, context);\n }\n enterUnfinishedNodesBefore(pos) {\n let scan = this.childBefore(pos), node = this;\n while (scan) {\n let last = scan.lastChild;\n if (!last || last.to != scan.to)\n break;\n if (last.type.isError && last.from == last.to) {\n node = scan;\n scan = last.prevSibling;\n }\n else {\n scan = last;\n }\n }\n return node;\n }\n get node() { return this; }\n get next() { return this.parent; }\n}\nclass TreeNode extends BaseNode {\n constructor(_tree, from, \n // Index in parent node, set to -1 if the node is not a direct child of _parent.node (overlay)\n index, _parent) {\n super();\n this._tree = _tree;\n this.from = from;\n this.index = index;\n this._parent = _parent;\n }\n get type() { return this._tree.type; }\n get name() { return this._tree.type.name; }\n get to() { return this.from + this._tree.length; }\n nextChild(i, dir, pos, side, mode = 0) {\n for (let parent = this;;) {\n for (let { children, positions } = parent._tree, e = dir > 0 ? children.length : -1; i != e; i += dir) {\n let next = children[i], start = positions[i] + parent.from;\n if (!checkSide(side, pos, start, start + next.length))\n continue;\n if (next instanceof TreeBuffer) {\n if (mode & IterMode.ExcludeBuffers)\n continue;\n let index = next.findChild(0, next.buffer.length, dir, pos - start, side);\n if (index > -1)\n return new BufferNode(new BufferContext(parent, next, i, start), null, index);\n }\n else if ((mode & IterMode.IncludeAnonymous) || (!next.type.isAnonymous || hasChild(next))) {\n let mounted;\n if (!(mode & IterMode.IgnoreMounts) && (mounted = MountedTree.get(next)) && !mounted.overlay)\n return new TreeNode(mounted.tree, start, i, parent);\n let inner = new TreeNode(next, start, i, parent);\n return (mode & IterMode.IncludeAnonymous) || !inner.type.isAnonymous ? inner\n : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, pos, side);\n }\n }\n if ((mode & IterMode.IncludeAnonymous) || !parent.type.isAnonymous)\n return null;\n if (parent.index >= 0)\n i = parent.index + dir;\n else\n i = dir < 0 ? -1 : parent._parent._tree.children.length;\n parent = parent._parent;\n if (!parent)\n return null;\n }\n }\n get firstChild() { return this.nextChild(0, 1, 0, 4 /* Side.DontCare */); }\n get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */); }\n childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* Side.After */); }\n childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */); }\n enter(pos, side, mode = 0) {\n let mounted;\n if (!(mode & IterMode.IgnoreOverlays) && (mounted = MountedTree.get(this._tree)) && mounted.overlay) {\n let rPos = pos - this.from;\n for (let { from, to } of mounted.overlay) {\n if ((side > 0 ? from <= rPos : from < rPos) &&\n (side < 0 ? to >= rPos : to > rPos))\n return new TreeNode(mounted.tree, mounted.overlay[0].from + this.from, -1, this);\n }\n }\n return this.nextChild(0, 1, pos, side, mode);\n }\n nextSignificantParent() {\n let val = this;\n while (val.type.isAnonymous && val._parent)\n val = val._parent;\n return val;\n }\n get parent() {\n return this._parent ? this._parent.nextSignificantParent() : null;\n }\n get nextSibling() {\n return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* Side.DontCare */) : null;\n }\n get prevSibling() {\n return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* Side.DontCare */) : null;\n }\n get tree() { return this._tree; }\n toTree() { return this._tree; }\n /**\n @internal\n */\n toString() { return this._tree.toString(); }\n}\nfunction getChildren(node, type, before, after) {\n let cur = node.cursor(), result = [];\n if (!cur.firstChild())\n return result;\n if (before != null)\n for (let found = false; !found;) {\n found = cur.type.is(before);\n if (!cur.nextSibling())\n return result;\n }\n for (;;) {\n if (after != null && cur.type.is(after))\n return result;\n if (cur.type.is(type))\n result.push(cur.node);\n if (!cur.nextSibling())\n return after == null ? result : [];\n }\n}\nfunction matchNodeContext(node, context, i = context.length - 1) {\n for (let p = node.parent; i >= 0; p = p.parent) {\n if (!p)\n return false;\n if (!p.type.isAnonymous) {\n if (context[i] && context[i] != p.name)\n return false;\n i--;\n }\n }\n return true;\n}\nclass BufferContext {\n constructor(parent, buffer, index, start) {\n this.parent = parent;\n this.buffer = buffer;\n this.index = index;\n this.start = start;\n }\n}\nclass BufferNode extends BaseNode {\n get name() { return this.type.name; }\n get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }\n get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }\n constructor(context, _parent, index) {\n super();\n this.context = context;\n this._parent = _parent;\n this.index = index;\n this.type = context.buffer.set.types[context.buffer.buffer[index]];\n }\n child(dir, pos, side) {\n let { buffer } = this.context;\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side);\n return index < 0 ? null : new BufferNode(this.context, this, index);\n }\n get firstChild() { return this.child(1, 0, 4 /* Side.DontCare */); }\n get lastChild() { return this.child(-1, 0, 4 /* Side.DontCare */); }\n childAfter(pos) { return this.child(1, pos, 2 /* Side.After */); }\n childBefore(pos) { return this.child(-1, pos, -2 /* Side.Before */); }\n enter(pos, side, mode = 0) {\n if (mode & IterMode.ExcludeBuffers)\n return null;\n let { buffer } = this.context;\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side);\n return index < 0 ? null : new BufferNode(this.context, this, index);\n }\n get parent() {\n return this._parent || this.context.parent.nextSignificantParent();\n }\n externalSibling(dir) {\n return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* Side.DontCare */);\n }\n get nextSibling() {\n let { buffer } = this.context;\n let after = buffer.buffer[this.index + 3];\n if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length))\n return new BufferNode(this.context, this._parent, after);\n return this.externalSibling(1);\n }\n get prevSibling() {\n let { buffer } = this.context;\n let parentStart = this._parent ? this._parent.index + 4 : 0;\n if (this.index == parentStart)\n return this.externalSibling(-1);\n return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));\n }\n get tree() { return null; }\n toTree() {\n let children = [], positions = [];\n let { buffer } = this.context;\n let startI = this.index + 4, endI = buffer.buffer[this.index + 3];\n if (endI > startI) {\n let from = buffer.buffer[this.index + 1];\n children.push(buffer.slice(startI, endI, from));\n positions.push(0);\n }\n return new Tree(this.type, children, positions, this.to - this.from);\n }\n /**\n @internal\n */\n toString() { return this.context.buffer.childString(this.index); }\n}\nfunction iterStack(heads) {\n if (!heads.length)\n return null;\n let pick = 0, picked = heads[0];\n for (let i = 1; i < heads.length; i++) {\n let node = heads[i];\n if (node.from > picked.from || node.to < picked.to) {\n picked = node;\n pick = i;\n }\n }\n let next = picked instanceof TreeNode && picked.index < 0 ? null : picked.parent;\n let newHeads = heads.slice();\n if (next)\n newHeads[pick] = next;\n else\n newHeads.splice(pick, 1);\n return new StackIterator(newHeads, picked);\n}\nclass StackIterator {\n constructor(heads, node) {\n this.heads = heads;\n this.node = node;\n }\n get next() { return iterStack(this.heads); }\n}\nfunction stackIterator(tree, pos, side) {\n let inner = tree.resolveInner(pos, side), layers = null;\n for (let scan = inner instanceof TreeNode ? inner : inner.context.parent; scan; scan = scan.parent) {\n if (scan.index < 0) { // This is an overlay root\n let parent = scan.parent;\n (layers || (layers = [inner])).push(parent.resolve(pos, side));\n scan = parent;\n }\n else {\n let mount = MountedTree.get(scan.tree);\n // Relevant overlay branching off\n if (mount && mount.overlay && mount.overlay[0].from <= pos && mount.overlay[mount.overlay.length - 1].to >= pos) {\n let root = new TreeNode(mount.tree, mount.overlay[0].from + scan.from, -1, scan);\n (layers || (layers = [inner])).push(resolveNode(root, pos, side, false));\n }\n }\n }\n return layers ? iterStack(layers) : inner;\n}\n/**\nA tree cursor object focuses on a given node in a syntax tree, and\nallows you to move to adjacent nodes.\n*/\nclass TreeCursor {\n /**\n Shorthand for `.type.name`.\n */\n get name() { return this.type.name; }\n /**\n @internal\n */\n constructor(node, \n /**\n @internal\n */\n mode = 0) {\n this.mode = mode;\n /**\n @internal\n */\n this.buffer = null;\n this.stack = [];\n /**\n @internal\n */\n this.index = 0;\n this.bufferNode = null;\n if (node instanceof TreeNode) {\n this.yieldNode(node);\n }\n else {\n this._tree = node.context.parent;\n this.buffer = node.context;\n for (let n = node._parent; n; n = n._parent)\n this.stack.unshift(n.index);\n this.bufferNode = node;\n this.yieldBuf(node.index);\n }\n }\n yieldNode(node) {\n if (!node)\n return false;\n this._tree = node;\n this.type = node.type;\n this.from = node.from;\n this.to = node.to;\n return true;\n }\n yieldBuf(index, type) {\n this.index = index;\n let { start, buffer } = this.buffer;\n this.type = type || buffer.set.types[buffer.buffer[index]];\n this.from = start + buffer.buffer[index + 1];\n this.to = start + buffer.buffer[index + 2];\n return true;\n }\n /**\n @internal\n */\n yield(node) {\n if (!node)\n return false;\n if (node instanceof TreeNode) {\n this.buffer = null;\n return this.yieldNode(node);\n }\n this.buffer = node.context;\n return this.yieldBuf(node.index, node.type);\n }\n /**\n @internal\n */\n toString() {\n return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString();\n }\n /**\n @internal\n */\n enterChild(dir, pos, side) {\n if (!this.buffer)\n return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode));\n let { buffer } = this.buffer;\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side);\n if (index < 0)\n return false;\n this.stack.push(this.index);\n return this.yieldBuf(index);\n }\n /**\n Move the cursor to this node\'s first child. When this returns\n false, the node has no child, and the cursor has not been moved.\n */\n firstChild() { return this.enterChild(1, 0, 4 /* Side.DontCare */); }\n /**\n Move the cursor to this node\'s last child.\n */\n lastChild() { return this.enterChild(-1, 0, 4 /* Side.DontCare */); }\n /**\n Move the cursor to the first child that ends after `pos`.\n */\n childAfter(pos) { return this.enterChild(1, pos, 2 /* Side.After */); }\n /**\n Move to the last child that starts before `pos`.\n */\n childBefore(pos) { return this.enterChild(-1, pos, -2 /* Side.Before */); }\n /**\n Move the cursor to the child around `pos`. If side is -1 the\n child may end at that position, when 1 it may start there. This\n will also enter [overlaid](#common.MountedTree.overlay)\n [mounted](#common.NodeProp^mounted) trees unless `overlays` is\n set to false.\n */\n enter(pos, side, mode = this.mode) {\n if (!this.buffer)\n return this.yield(this._tree.enter(pos, side, mode));\n return mode & IterMode.ExcludeBuffers ? false : this.enterChild(1, pos, side);\n }\n /**\n Move to the node\'s parent node, if this isn\'t the top node.\n */\n parent() {\n if (!this.buffer)\n return this.yieldNode((this.mode & IterMode.IncludeAnonymous) ? this._tree._parent : this._tree.parent);\n if (this.stack.length)\n return this.yieldBuf(this.stack.pop());\n let parent = (this.mode & IterMode.IncludeAnonymous) ? this.buffer.parent : this.buffer.parent.nextSignificantParent();\n this.buffer = null;\n return this.yieldNode(parent);\n }\n /**\n @internal\n */\n sibling(dir) {\n if (!this.buffer)\n return !this._tree._parent ? false\n : this.yield(this._tree.index < 0 ? null\n : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode));\n let { buffer } = this.buffer, d = this.stack.length - 1;\n if (dir < 0) {\n let parentStart = d < 0 ? 0 : this.stack[d] + 4;\n if (this.index != parentStart)\n return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));\n }\n else {\n let after = buffer.buffer[this.index + 3];\n if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))\n return this.yieldBuf(after);\n }\n return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode)) : false;\n }\n /**\n Move to this node\'s next sibling, if any.\n */\n nextSibling() { return this.sibling(1); }\n /**\n Move to this node\'s previous sibling, if any.\n */\n prevSibling() { return this.sibling(-1); }\n atLastNode(dir) {\n let index, parent, { buffer } = this;\n if (buffer) {\n if (dir > 0) {\n if (this.index < buffer.buffer.buffer.length)\n return false;\n }\n else {\n for (let i = 0; i < this.index; i++)\n if (buffer.buffer.buffer[i + 3] < this.index)\n return false;\n }\n ({ index, parent } = buffer);\n }\n else {\n ({ index, _parent: parent } = this._tree);\n }\n for (; parent; { index, _parent: parent } = parent) {\n if (index > -1)\n for (let i = index + dir, e = dir < 0 ? -1 : parent._tree.children.length; i != e; i += dir) {\n let child = parent._tree.children[i];\n if ((this.mode & IterMode.IncludeAnonymous) ||\n child instanceof TreeBuffer ||\n !child.type.isAnonymous ||\n hasChild(child))\n return false;\n }\n }\n return true;\n }\n move(dir, enter) {\n if (enter && this.enterChild(dir, 0, 4 /* Side.DontCare */))\n return true;\n for (;;) {\n if (this.sibling(dir))\n return true;\n if (this.atLastNode(dir) || !this.parent())\n return false;\n }\n }\n /**\n Move to the next node in a\n [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)\n traversal, going from a node to its first child or, if the\n current node is empty or `enter` is false, its next sibling or\n the next sibling of the first parent node that has one.\n */\n next(enter = true) { return this.move(1, enter); }\n /**\n Move to the next node in a last-to-first pre-order traveral. A\n node is followed by its last child or, if it has none, its\n previous sibling or the previous sibling of the first parent\n node that has one.\n */\n prev(enter = true) { return this.move(-1, enter); }\n /**\n Move the cursor to the innermost node that covers `pos`. If\n `side` is -1, it will enter nodes that end at `pos`. If it is 1,\n it will enter nodes that start at `pos`.\n */\n moveTo(pos, side = 0) {\n // Move up to a node that actually holds the position, if possible\n while (this.from == this.to ||\n (side < 1 ? this.from >= pos : this.from > pos) ||\n (side > -1 ? this.to <= pos : this.to < pos))\n if (!this.parent())\n break;\n // Then scan down into child nodes as far as possible\n while (this.enterChild(1, pos, side)) { }\n return this;\n }\n /**\n Get a [syntax node](#common.SyntaxNode) at the cursor\'s current\n position.\n */\n get node() {\n if (!this.buffer)\n return this._tree;\n let cache = this.bufferNode, result = null, depth = 0;\n if (cache && cache.context == this.buffer) {\n scan: for (let index = this.index, d = this.stack.length; d >= 0;) {\n for (let c = cache; c; c = c._parent)\n if (c.index == index) {\n if (index == this.index)\n return c;\n result = c;\n depth = d + 1;\n break scan;\n }\n index = this.stack[--d];\n }\n }\n for (let i = depth; i < this.stack.length; i++)\n result = new BufferNode(this.buffer, result, this.stack[i]);\n return this.bufferNode = new BufferNode(this.buffer, result, this.index);\n }\n /**\n Get the [tree](#common.Tree) that represents the current node, if\n any. Will return null when the node is in a [tree\n buffer](#common.TreeBuffer).\n */\n get tree() {\n return this.buffer ? null : this._tree._tree;\n }\n /**\n Iterate over the current node and all its descendants, calling\n `enter` when entering a node and `leave`, if given, when leaving\n one. When `enter` returns `false`, any children of that node are\n skipped, and `leave` isn\'t called for it.\n */\n iterate(enter, leave) {\n for (let depth = 0;;) {\n let mustLeave = false;\n if (this.type.isAnonymous || enter(this) !== false) {\n if (this.firstChild()) {\n depth++;\n continue;\n }\n if (!this.type.isAnonymous)\n mustLeave = true;\n }\n for (;;) {\n if (mustLeave && leave)\n leave(this);\n mustLeave = this.type.isAnonymous;\n if (this.nextSibling())\n break;\n if (!depth)\n return;\n this.parent();\n depth--;\n mustLeave = true;\n }\n }\n }\n /**\n Test whether the current node matches a given context—a sequence\n of direct parent node names. Empty strings in the context array\n are treated as wildcards.\n */\n matchContext(context) {\n if (!this.buffer)\n return matchNodeContext(this.node, context);\n let { buffer } = this.buffer, { types } = buffer.set;\n for (let i = context.length - 1, d = this.stack.length - 1; i >= 0; d--) {\n if (d < 0)\n return matchNodeContext(this.node, context, i);\n let type = types[buffer.buffer[this.stack[d]]];\n if (!type.isAnonymous) {\n if (context[i] && context[i] != type.name)\n return false;\n i--;\n }\n }\n return true;\n }\n}\nfunction hasChild(tree) {\n return tree.children.some(ch => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch));\n}\nfunction buildTree(data) {\n var _a;\n let { buffer, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data;\n let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer;\n let types = nodeSet.types;\n let contextHash = 0, lookAhead = 0;\n function takeNode(parentStart, minPos, children, positions, inRepeat, depth) {\n let { id, start, end, size } = cursor;\n let lookAheadAtStart = lookAhead;\n while (size < 0) {\n cursor.next();\n if (size == -1 /* SpecialRecord.Reuse */) {\n let node = reused[id];\n children.push(node);\n positions.push(start - parentStart);\n return;\n }\n else if (size == -3 /* SpecialRecord.ContextChange */) { // Context change\n contextHash = id;\n return;\n }\n else if (size == -4 /* SpecialRecord.LookAhead */) {\n lookAhead = id;\n return;\n }\n else {\n throw new RangeError(`Unrecognized record size: ${size}`);\n }\n }\n let type = types[id], node, buffer;\n let startPos = start - parentStart;\n if (end - start <= maxBufferLength && (buffer = findBufferSize(cursor.pos - minPos, inRepeat))) {\n // Small enough for a buffer, and no reused nodes inside\n let data = new Uint16Array(buffer.size - buffer.skip);\n let endPos = cursor.pos - buffer.size, index = data.length;\n while (cursor.pos > endPos)\n index = copyToBuffer(buffer.start, data, index);\n node = new TreeBuffer(data, end - buffer.start, nodeSet);\n startPos = buffer.start - parentStart;\n }\n else { // Make it a node\n let endPos = cursor.pos - size;\n cursor.next();\n let localChildren = [], localPositions = [];\n let localInRepeat = id >= minRepeatType ? id : -1;\n let lastGroup = 0, lastEnd = end;\n while (cursor.pos > endPos) {\n if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) {\n if (cursor.end <= lastEnd - maxBufferLength) {\n makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart);\n lastGroup = localChildren.length;\n lastEnd = cursor.end;\n }\n cursor.next();\n }\n else if (depth > 2500 /* CutOff.Depth */) {\n takeFlatNode(start, endPos, localChildren, localPositions);\n }\n else {\n takeNode(start, endPos, localChildren, localPositions, localInRepeat, depth + 1);\n }\n }\n if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)\n makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, lookAheadAtStart);\n localChildren.reverse();\n localPositions.reverse();\n if (localInRepeat > -1 && lastGroup > 0) {\n let make = makeBalanced(type);\n node = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make);\n }\n else {\n node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end);\n }\n }\n children.push(node);\n positions.push(startPos);\n }\n function takeFlatNode(parentStart, minPos, children, positions) {\n let nodes = []; // Temporary, inverted array of leaf nodes found, with absolute positions\n let nodeCount = 0, stopAt = -1;\n while (cursor.pos > minPos) {\n let { id, start, end, size } = cursor;\n if (size > 4) { // Not a leaf\n cursor.next();\n }\n else if (stopAt > -1 && start < stopAt) {\n break;\n }\n else {\n if (stopAt < 0)\n stopAt = end - maxBufferLength;\n nodes.push(id, start, end);\n nodeCount++;\n cursor.next();\n }\n }\n if (nodeCount) {\n let buffer = new Uint16Array(nodeCount * 4);\n let start = nodes[nodes.length - 2];\n for (let i = nodes.length - 3, j = 0; i >= 0; i -= 3) {\n buffer[j++] = nodes[i];\n buffer[j++] = nodes[i + 1] - start;\n buffer[j++] = nodes[i + 2] - start;\n buffer[j++] = j;\n }\n children.push(new TreeBuffer(buffer, nodes[2] - start, nodeSet));\n positions.push(start - parentStart);\n }\n }\n function makeBalanced(type) {\n return (children, positions, length) => {\n let lookAhead = 0, lastI = children.length - 1, last, lookAheadProp;\n if (lastI >= 0 && (last = children[lastI]) instanceof Tree) {\n if (!lastI && last.type == type && last.length == length)\n return last;\n if (lookAheadProp = last.prop(NodeProp.lookAhead))\n lookAhead = positions[lastI] + last.length + lookAheadProp;\n }\n return makeTree(type, children, positions, length, lookAhead);\n };\n }\n function makeRepeatLeaf(children, positions, base, i, from, to, type, lookAhead) {\n let localChildren = [], localPositions = [];\n while (children.length > i) {\n localChildren.push(children.pop());\n localPositions.push(positions.pop() + base - from);\n }\n children.push(makeTree(nodeSet.types[type], localChildren, localPositions, to - from, lookAhead - to));\n positions.push(from - base);\n }\n function makeTree(type, children, positions, length, lookAhead = 0, props) {\n if (contextHash) {\n let pair = [NodeProp.contextHash, contextHash];\n props = props ? [pair].concat(props) : [pair];\n }\n if (lookAhead > 25) {\n let pair = [NodeProp.lookAhead, lookAhead];\n props = props ? [pair].concat(props) : [pair];\n }\n return new Tree(type, children, positions, length, props);\n }\n function findBufferSize(maxSize, inRepeat) {\n // Scan through the buffer to find previous siblings that fit\n // together in a TreeBuffer, and don\'t contain any reused nodes\n // (which can\'t be stored in a buffer).\n // If `inRepeat` is > -1, ignore node boundaries of that type for\n // nesting, but make sure the end falls either at the start\n // (`maxSize`) or before such a node.\n let fork = cursor.fork();\n let size = 0, start = 0, skip = 0, minStart = fork.end - maxBufferLength;\n let result = { size: 0, start: 0, skip: 0 };\n scan: for (let minPos = fork.pos - maxSize; fork.pos > minPos;) {\n let nodeSize = fork.size;\n // Pretend nested repeat nodes of the same type don\'t exist\n if (fork.id == inRepeat && nodeSize >= 0) {\n // Except that we store the current state as a valid return\n // value.\n result.size = size;\n result.start = start;\n result.skip = skip;\n skip += 4;\n size += 4;\n fork.next();\n continue;\n }\n let startPos = fork.pos - nodeSize;\n if (nodeSize < 0 || startPos < minPos || fork.start < minStart)\n break;\n let localSkipped = fork.id >= minRepeatType ? 4 : 0;\n let nodeStart = fork.start;\n fork.next();\n while (fork.pos > startPos) {\n if (fork.size < 0) {\n if (fork.size == -3 /* SpecialRecord.ContextChange */)\n localSkipped += 4;\n else\n break scan;\n }\n else if (fork.id >= minRepeatType) {\n localSkipped += 4;\n }\n fork.next();\n }\n start = nodeStart;\n size += nodeSize;\n skip += localSkipped;\n }\n if (inRepeat < 0 || size == maxSize) {\n result.size = size;\n result.start = start;\n result.skip = skip;\n }\n return result.size > 4 ? result : undefined;\n }\n function copyToBuffer(bufferStart, buffer, index) {\n let { id, start, end, size } = cursor;\n cursor.next();\n if (size >= 0 && id < minRepeatType) {\n let startIndex = index;\n if (size > 4) {\n let endPos = cursor.pos - (size - 4);\n while (cursor.pos > endPos)\n index = copyToBuffer(bufferStart, buffer, index);\n }\n buffer[--index] = startIndex;\n buffer[--index] = end - bufferStart;\n buffer[--index] = start - bufferStart;\n buffer[--index] = id;\n }\n else if (size == -3 /* SpecialRecord.ContextChange */) {\n contextHash = id;\n }\n else if (size == -4 /* SpecialRecord.LookAhead */) {\n lookAhead = id;\n }\n return index;\n }\n let children = [], positions = [];\n while (cursor.pos > 0)\n takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1, 0);\n let length = (_a = data.length) !== null && _a !== void 0 ? _a : (children.length ? positions[0] + children[0].length : 0);\n return new Tree(types[data.topID], children.reverse(), positions.reverse(), length);\n}\nconst nodeSizeCache = new WeakMap;\nfunction nodeSize(balanceType, node) {\n if (!balanceType.isAnonymous || node instanceof TreeBuffer || node.type != balanceType)\n return 1;\n let size = nodeSizeCache.get(node);\n if (size == null) {\n size = 1;\n for (let child of node.children) {\n if (child.type != balanceType || !(child instanceof Tree)) {\n size = 1;\n break;\n }\n size += nodeSize(balanceType, child);\n }\n nodeSizeCache.set(node, size);\n }\n return size;\n}\nfunction balanceRange(\n// The type the balanced tree\'s inner nodes.\nbalanceType, \n// The direct children and their positions\nchildren, positions, \n// The index range in children/positions to use\nfrom, to, \n// The start position of the nodes, relative to their parent.\nstart, \n// Length of the outer node\nlength, \n// Function to build the top node of the balanced tree\nmkTop, \n// Function to build internal nodes for the balanced tree\nmkTree) {\n let total = 0;\n for (let i = from; i < to; i++)\n total += nodeSize(balanceType, children[i]);\n let maxChild = Math.ceil((total * 1.5) / 8 /* Balance.BranchFactor */);\n let localChildren = [], localPositions = [];\n function divide(children, positions, from, to, offset) {\n for (let i = from; i < to;) {\n let groupFrom = i, groupStart = positions[i], groupSize = nodeSize(balanceType, children[i]);\n i++;\n for (; i < to; i++) {\n let nextSize = nodeSize(balanceType, children[i]);\n if (groupSize + nextSize >= maxChild)\n break;\n groupSize += nextSize;\n }\n if (i == groupFrom + 1) {\n if (groupSize > maxChild) {\n let only = children[groupFrom]; // Only trees can have a size > 1\n divide(only.children, only.positions, 0, only.children.length, positions[groupFrom] + offset);\n continue;\n }\n localChildren.push(children[groupFrom]);\n }\n else {\n let length = positions[i - 1] + children[i - 1].length - groupStart;\n localChildren.push(balanceRange(balanceType, children, positions, groupFrom, i, groupStart, length, null, mkTree));\n }\n localPositions.push(groupStart + offset - start);\n }\n }\n divide(children, positions, from, to, 0);\n return (mkTop || mkTree)(localChildren, localPositions, length);\n}\n/**\nProvides a way to associate values with pieces of trees. As long\nas that part of the tree is reused, the associated values can be\nretrieved from an updated tree.\n*/\nclass NodeWeakMap {\n constructor() {\n this.map = new WeakMap();\n }\n setBuffer(buffer, index, value) {\n let inner = this.map.get(buffer);\n if (!inner)\n this.map.set(buffer, inner = new Map);\n inner.set(index, value);\n }\n getBuffer(buffer, index) {\n let inner = this.map.get(buffer);\n return inner && inner.get(index);\n }\n /**\n Set the value for this syntax node.\n */\n set(node, value) {\n if (node instanceof BufferNode)\n this.setBuffer(node.context.buffer, node.index, value);\n else if (node instanceof TreeNode)\n this.map.set(node.tree, value);\n }\n /**\n Retrieve value for this syntax node, if it exists in the map.\n */\n get(node) {\n return node instanceof BufferNode ? this.getBuffer(node.context.buffer, node.index)\n : node instanceof TreeNode ? this.map.get(node.tree) : undefined;\n }\n /**\n Set the value for the node that a cursor currently points to.\n */\n cursorSet(cursor, value) {\n if (cursor.buffer)\n this.setBuffer(cursor.buffer.buffer, cursor.index, value);\n else\n this.map.set(cursor.tree, value);\n }\n /**\n Retrieve the value for the node that a cursor currently points\n to.\n */\n cursorGet(cursor) {\n return cursor.buffer ? this.getBuffer(cursor.buffer.buffer, cursor.index) : this.map.get(cursor.tree);\n }\n}\n\n/**\nTree fragments are used during [incremental\nparsing](#common.Parser.startParse) to track parts of old trees\nthat can be reused in a new parse. An array of fragments is used\nto track regions of an old tree whose nodes might be reused in new\nparses. Use the static\n[`applyChanges`](#common.TreeFragment^applyChanges) method to\nupdate fragments for document changes.\n*/\nclass TreeFragment {\n /**\n Construct a tree fragment. You\'ll usually want to use\n [`addTree`](#common.TreeFragment^addTree) and\n [`applyChanges`](#common.TreeFragment^applyChanges) instead of\n calling this directly.\n */\n constructor(\n /**\n The start of the unchanged range pointed to by this fragment.\n This refers to an offset in the _updated_ document (as opposed\n to the original tree).\n */\n from, \n /**\n The end of the unchanged range.\n */\n to, \n /**\n The tree that this fragment is based on.\n */\n tree, \n /**\n The offset between the fragment\'s tree and the document that\n this fragment can be used against. Add this when going from\n document to tree positions, subtract it to go from tree to\n document positions.\n */\n offset, openStart = false, openEnd = false) {\n this.from = from;\n this.to = to;\n this.tree = tree;\n this.offset = offset;\n this.open = (openStart ? 1 /* Open.Start */ : 0) | (openEnd ? 2 /* Open.End */ : 0);\n }\n /**\n Whether the start of the fragment represents the start of a\n parse, or the end of a change. (In the second case, it may not\n be safe to reuse some nodes at the start, depending on the\n parsing algorithm.)\n */\n get openStart() { return (this.open & 1 /* Open.Start */) > 0; }\n /**\n Whether the end of the fragment represents the end of a\n full-document parse, or the start of a change.\n */\n get openEnd() { return (this.open & 2 /* Open.End */) > 0; }\n /**\n Create a set of fragments from a freshly parsed tree, or update\n an existing set of fragments by replacing the ones that overlap\n with a tree with content from the new tree. When `partial` is\n true, the parse is treated as incomplete, and the resulting\n fragment has [`openEnd`](#common.TreeFragment.openEnd) set to\n true.\n */\n static addTree(tree, fragments = [], partial = false) {\n let result = [new TreeFragment(0, tree.length, tree, 0, false, partial)];\n for (let f of fragments)\n if (f.to > tree.length)\n result.push(f);\n return result;\n }\n /**\n Apply a set of edits to an array of fragments, removing or\n splitting fragments as necessary to remove edited ranges, and\n adjusting offsets for fragments that moved.\n */\n static applyChanges(fragments, changes, minGap = 128) {\n if (!changes.length)\n return fragments;\n let result = [];\n let fI = 1, nextF = fragments.length ? fragments[0] : null;\n for (let cI = 0, pos = 0, off = 0;; cI++) {\n let nextC = cI < changes.length ? changes[cI] : null;\n let nextPos = nextC ? nextC.fromA : 1e9;\n if (nextPos - pos >= minGap)\n while (nextF && nextF.from < nextPos) {\n let cut = nextF;\n if (pos >= cut.from || nextPos <= cut.to || off) {\n let fFrom = Math.max(cut.from, pos) - off, fTo = Math.min(cut.to, nextPos) - off;\n cut = fFrom >= fTo ? null : new TreeFragment(fFrom, fTo, cut.tree, cut.offset + off, cI > 0, !!nextC);\n }\n if (cut)\n result.push(cut);\n if (nextF.to > nextPos)\n break;\n nextF = fI < fragments.length ? fragments[fI++] : null;\n }\n if (!nextC)\n break;\n pos = nextC.toA;\n off = nextC.toA - nextC.toB;\n }\n return result;\n }\n}\n/**\nA superclass that parsers should extend.\n*/\nclass Parser {\n /**\n Start a parse, returning a [partial parse](#common.PartialParse)\n object. [`fragments`](#common.TreeFragment) can be passed in to\n make the parse incremental.\n \n By default, the entire input is parsed. You can pass `ranges`,\n which should be a sorted array of non-empty, non-overlapping\n ranges, to parse only those ranges. The tree returned in that\n case will start at `ranges[0].from`.\n */\n startParse(input, fragments, ranges) {\n if (typeof input == "string")\n input = new StringInput(input);\n ranges = !ranges ? [new Range(0, input.length)] : ranges.length ? ranges.map(r => new Range(r.from, r.to)) : [new Range(0, 0)];\n return this.createParse(input, fragments || [], ranges);\n }\n /**\n Run a full parse, returning the resulting tree.\n */\n parse(input, fragments, ranges) {\n let parse = this.startParse(input, fragments, ranges);\n for (;;) {\n let done = parse.advance();\n if (done)\n return done;\n }\n }\n}\nclass StringInput {\n constructor(string) {\n this.string = string;\n }\n get length() { return this.string.length; }\n chunk(from) { return this.string.slice(from); }\n get lineChunks() { return false; }\n read(from, to) { return this.string.slice(from, to); }\n}\n\n/**\nCreate a parse wrapper that, after the inner parse completes,\nscans its tree for mixed language regions with the `nest`\nfunction, runs the resulting [inner parses](#common.NestedParse),\nand then [mounts](#common.NodeProp^mounted) their results onto the\ntree.\n*/\nfunction parseMixed(nest) {\n return (parse, input, fragments, ranges) => new MixedParse(parse, nest, input, fragments, ranges);\n}\nclass InnerParse {\n constructor(parser, parse, overlay, target, from) {\n this.parser = parser;\n this.parse = parse;\n this.overlay = overlay;\n this.target = target;\n this.from = from;\n }\n}\nfunction checkRanges(ranges) {\n if (!ranges.length || ranges.some(r => r.from >= r.to))\n throw new RangeError("Invalid inner parse ranges given: " + JSON.stringify(ranges));\n}\nclass ActiveOverlay {\n constructor(parser, predicate, mounts, index, start, target, prev) {\n this.parser = parser;\n this.predicate = predicate;\n this.mounts = mounts;\n this.index = index;\n this.start = start;\n this.target = target;\n this.prev = prev;\n this.depth = 0;\n this.ranges = [];\n }\n}\nconst stoppedInner = new NodeProp({ perNode: true });\nclass MixedParse {\n constructor(base, nest, input, fragments, ranges) {\n this.nest = nest;\n this.input = input;\n this.fragments = fragments;\n this.ranges = ranges;\n this.inner = [];\n this.innerDone = 0;\n this.baseTree = null;\n this.stoppedAt = null;\n this.baseParse = base;\n }\n advance() {\n if (this.baseParse) {\n let done = this.baseParse.advance();\n if (!done)\n return null;\n this.baseParse = null;\n this.baseTree = done;\n this.startInner();\n if (this.stoppedAt != null)\n for (let inner of this.inner)\n inner.parse.stopAt(this.stoppedAt);\n }\n if (this.innerDone == this.inner.length) {\n let result = this.baseTree;\n if (this.stoppedAt != null)\n result = new Tree(result.type, result.children, result.positions, result.length, result.propValues.concat([[stoppedInner, this.stoppedAt]]));\n return result;\n }\n let inner = this.inner[this.innerDone], done = inner.parse.advance();\n if (done) {\n this.innerDone++;\n // This is a somewhat dodgy but super helpful hack where we\n // patch up nodes created by the inner parse (and thus\n // presumably not aliased anywhere else) to hold the information\n // about the inner parse.\n let props = Object.assign(Object.create(null), inner.target.props);\n props[NodeProp.mounted.id] = new MountedTree(done, inner.overlay, inner.parser);\n inner.target.props = props;\n }\n return null;\n }\n get parsedPos() {\n if (this.baseParse)\n return 0;\n let pos = this.input.length;\n for (let i = this.innerDone; i < this.inner.length; i++) {\n if (this.inner[i].from < pos)\n pos = Math.min(pos, this.inner[i].parse.parsedPos);\n }\n return pos;\n }\n stopAt(pos) {\n this.stoppedAt = pos;\n if (this.baseParse)\n this.baseParse.stopAt(pos);\n else\n for (let i = this.innerDone; i < this.inner.length; i++)\n this.inner[i].parse.stopAt(pos);\n }\n startInner() {\n let fragmentCursor = new FragmentCursor(this.fragments);\n let overlay = null;\n let covered = null;\n let cursor = new TreeCursor(new TreeNode(this.baseTree, this.ranges[0].from, 0, null), IterMode.IncludeAnonymous | IterMode.IgnoreMounts);\n scan: for (let nest, isCovered;;) {\n let enter = true, range;\n if (this.stoppedAt != null && cursor.from >= this.stoppedAt) {\n enter = false;\n }\n else if (fragmentCursor.hasNode(cursor)) {\n if (overlay) {\n let match = overlay.mounts.find(m => m.frag.from <= cursor.from && m.frag.to >= cursor.to && m.mount.overlay);\n if (match)\n for (let r of match.mount.overlay) {\n let from = r.from + match.pos, to = r.to + match.pos;\n if (from >= cursor.from && to <= cursor.to && !overlay.ranges.some(r => r.from < to && r.to > from))\n overlay.ranges.push({ from, to });\n }\n }\n enter = false;\n }\n else if (covered && (isCovered = checkCover(covered.ranges, cursor.from, cursor.to))) {\n enter = isCovered != 2 /* Cover.Full */;\n }\n else if (!cursor.type.isAnonymous && (nest = this.nest(cursor, this.input)) &&\n (cursor.from < cursor.to || !nest.overlay)) {\n if (!cursor.tree)\n materialize(cursor);\n let oldMounts = fragmentCursor.findMounts(cursor.from, nest.parser);\n if (typeof nest.overlay == "function") {\n overlay = new ActiveOverlay(nest.parser, nest.overlay, oldMounts, this.inner.length, cursor.from, cursor.tree, overlay);\n }\n else {\n let ranges = punchRanges(this.ranges, nest.overlay ||\n (cursor.from < cursor.to ? [new Range(cursor.from, cursor.to)] : []));\n if (ranges.length)\n checkRanges(ranges);\n if (ranges.length || !nest.overlay)\n this.inner.push(new InnerParse(nest.parser, ranges.length ? nest.parser.startParse(this.input, enterFragments(oldMounts, ranges), ranges)\n : nest.parser.startParse(""), nest.overlay ? nest.overlay.map(r => new Range(r.from - cursor.from, r.to - cursor.from)) : null, cursor.tree, ranges.length ? ranges[0].from : cursor.from));\n if (!nest.overlay)\n enter = false;\n else if (ranges.length)\n covered = { ranges, depth: 0, prev: covered };\n }\n }\n else if (overlay && (range = overlay.predicate(cursor))) {\n if (range === true)\n range = new Range(cursor.from, cursor.to);\n if (range.from < range.to)\n overlay.ranges.push(range);\n }\n if (enter && cursor.firstChild()) {\n if (overlay)\n overlay.depth++;\n if (covered)\n covered.depth++;\n }\n else {\n for (;;) {\n if (cursor.nextSibling())\n break;\n if (!cursor.parent())\n break scan;\n if (overlay && !--overlay.depth) {\n let ranges = punchRanges(this.ranges, overlay.ranges);\n if (ranges.length) {\n checkRanges(ranges);\n this.inner.splice(overlay.index, 0, new InnerParse(overlay.parser, overlay.parser.startParse(this.input, enterFragments(overlay.mounts, ranges), ranges), overlay.ranges.map(r => new Range(r.from - overlay.start, r.to - overlay.start)), overlay.target, ranges[0].from));\n }\n overlay = overlay.prev;\n }\n if (covered && !--covered.depth)\n covered = covered.prev;\n }\n }\n }\n }\n}\nfunction checkCover(covered, from, to) {\n for (let range of covered) {\n if (range.from >= to)\n break;\n if (range.to > from)\n return range.from <= from && range.to >= to ? 2 /* Cover.Full */ : 1 /* Cover.Partial */;\n }\n return 0 /* Cover.None */;\n}\n// Take a piece of buffer and convert it into a stand-alone\n// TreeBuffer.\nfunction sliceBuf(buf, startI, endI, nodes, positions, off) {\n if (startI < endI) {\n let from = buf.buffer[startI + 1];\n nodes.push(buf.slice(startI, endI, from));\n positions.push(from - off);\n }\n}\n// This function takes a node that\'s in a buffer, and converts it, and\n// its parent buffer nodes, into a Tree. This is again acting on the\n// assumption that the trees and buffers have been constructed by the\n// parse that was ran via the mix parser, and thus aren\'t shared with\n// any other code, making violations of the immutability safe.\nfunction materialize(cursor) {\n let { node } = cursor, stack = [];\n let buffer = node.context.buffer;\n // Scan up to the nearest tree\n do {\n stack.push(cursor.index);\n cursor.parent();\n } while (!cursor.tree);\n // Find the index of the buffer in that tree\n let base = cursor.tree, i = base.children.indexOf(buffer);\n let buf = base.children[i], b = buf.buffer, newStack = [i];\n // Split a level in the buffer, putting the nodes before and after\n // the child that contains `node` into new buffers.\n function split(startI, endI, type, innerOffset, length, stackPos) {\n let targetI = stack[stackPos];\n let children = [], positions = [];\n sliceBuf(buf, startI, targetI, children, positions, innerOffset);\n let from = b[targetI + 1], to = b[targetI + 2];\n newStack.push(children.length);\n let child = stackPos\n ? split(targetI + 4, b[targetI + 3], buf.set.types[b[targetI]], from, to - from, stackPos - 1)\n : node.toTree();\n children.push(child);\n positions.push(from - innerOffset);\n sliceBuf(buf, b[targetI + 3], endI, children, positions, innerOffset);\n return new Tree(type, children, positions, length);\n }\n base.children[i] = split(0, b.length, NodeType.none, 0, buf.length, stack.length - 1);\n // Move the cursor back to the target node\n for (let index of newStack) {\n let tree = cursor.tree.children[index], pos = cursor.tree.positions[index];\n cursor.yield(new TreeNode(tree, pos + cursor.from, index, cursor._tree));\n }\n}\nclass StructureCursor {\n constructor(root, offset) {\n this.offset = offset;\n this.done = false;\n this.cursor = root.cursor(IterMode.IncludeAnonymous | IterMode.IgnoreMounts);\n }\n // Move to the first node (in pre-order) that starts at or after `pos`.\n moveTo(pos) {\n let { cursor } = this, p = pos - this.offset;\n while (!this.done && cursor.from < p) {\n if (cursor.to >= pos && cursor.enter(p, 1, IterMode.IgnoreOverlays | IterMode.ExcludeBuffers)) ;\n else if (!cursor.next(false))\n this.done = true;\n }\n }\n hasNode(cursor) {\n this.moveTo(cursor.from);\n if (!this.done && this.cursor.from + this.offset == cursor.from && this.cursor.tree) {\n for (let tree = this.cursor.tree;;) {\n if (tree == cursor.tree)\n return true;\n if (tree.children.length && tree.positions[0] == 0 && tree.children[0] instanceof Tree)\n tree = tree.children[0];\n else\n break;\n }\n }\n return false;\n }\n}\nclass FragmentCursor {\n constructor(fragments) {\n var _a;\n this.fragments = fragments;\n this.curTo = 0;\n this.fragI = 0;\n if (fragments.length) {\n let first = this.curFrag = fragments[0];\n this.curTo = (_a = first.tree.prop(stoppedInner)) !== null && _a !== void 0 ? _a : first.to;\n this.inner = new StructureCursor(first.tree, -first.offset);\n }\n else {\n this.curFrag = this.inner = null;\n }\n }\n hasNode(node) {\n while (this.curFrag && node.from >= this.curTo)\n this.nextFrag();\n return this.curFrag && this.curFrag.from <= node.from && this.curTo >= node.to && this.inner.hasNode(node);\n }\n nextFrag() {\n var _a;\n this.fragI++;\n if (this.fragI == this.fragments.length) {\n this.curFrag = this.inner = null;\n }\n else {\n let frag = this.curFrag = this.fragments[this.fragI];\n this.curTo = (_a = frag.tree.prop(stoppedInner)) !== null && _a !== void 0 ? _a : frag.to;\n this.inner = new StructureCursor(frag.tree, -frag.offset);\n }\n }\n findMounts(pos, parser) {\n var _a;\n let result = [];\n if (this.inner) {\n this.inner.cursor.moveTo(pos, 1);\n for (let pos = this.inner.cursor.node; pos; pos = pos.parent) {\n let mount = (_a = pos.tree) === null || _a === void 0 ? void 0 : _a.prop(NodeProp.mounted);\n if (mount && mount.parser == parser) {\n for (let i = this.fragI; i < this.fragments.length; i++) {\n let frag = this.fragments[i];\n if (frag.from >= pos.to)\n break;\n if (frag.tree == this.curFrag.tree)\n result.push({\n frag,\n pos: pos.from - frag.offset,\n mount\n });\n }\n }\n }\n }\n return result;\n }\n}\nfunction punchRanges(outer, ranges) {\n let copy = null, current = ranges;\n for (let i = 1, j = 0; i < outer.length; i++) {\n let gapFrom = outer[i - 1].to, gapTo = outer[i].from;\n for (; j < current.length; j++) {\n let r = current[j];\n if (r.from >= gapTo)\n break;\n if (r.to <= gapFrom)\n continue;\n if (!copy)\n current = copy = ranges.slice();\n if (r.from < gapFrom) {\n copy[j] = new Range(r.from, gapFrom);\n if (r.to > gapTo)\n copy.splice(j + 1, 0, new Range(gapTo, r.to));\n }\n else if (r.to > gapTo) {\n copy[j--] = new Range(gapTo, r.to);\n }\n else {\n copy.splice(j--, 1);\n }\n }\n }\n return current;\n}\nfunction findCoverChanges(a, b, from, to) {\n let iA = 0, iB = 0, inA = false, inB = false, pos = -1e9;\n let result = [];\n for (;;) {\n let nextA = iA == a.length ? 1e9 : inA ? a[iA].to : a[iA].from;\n let nextB = iB == b.length ? 1e9 : inB ? b[iB].to : b[iB].from;\n if (inA != inB) {\n let start = Math.max(pos, from), end = Math.min(nextA, nextB, to);\n if (start < end)\n result.push(new Range(start, end));\n }\n pos = Math.min(nextA, nextB);\n if (pos == 1e9)\n break;\n if (nextA == pos) {\n if (!inA)\n inA = true;\n else {\n inA = false;\n iA++;\n }\n }\n if (nextB == pos) {\n if (!inB)\n inB = true;\n else {\n inB = false;\n iB++;\n }\n }\n }\n return result;\n}\n// Given a number of fragments for the outer tree, and a set of ranges\n// to parse, find fragments for inner trees mounted around those\n// ranges, if any.\nfunction enterFragments(mounts, ranges) {\n let result = [];\n for (let { pos, mount, frag } of mounts) {\n let startPos = pos + (mount.overlay ? mount.overlay[0].from : 0), endPos = startPos + mount.tree.length;\n let from = Math.max(frag.from, startPos), to = Math.min(frag.to, endPos);\n if (mount.overlay) {\n let overlay = mount.overlay.map(r => new Range(r.from + pos, r.to + pos));\n let changes = findCoverChanges(ranges, overlay, from, to);\n for (let i = 0, pos = from;; i++) {\n let last = i == changes.length, end = last ? to : changes[i].from;\n if (end > pos)\n result.push(new TreeFragment(pos, end, mount.tree, -startPos, frag.from >= pos || frag.openStart, frag.to <= end || frag.openEnd));\n if (last)\n break;\n pos = changes[i].to;\n }\n }\n else {\n result.push(new TreeFragment(from, to, mount.tree, -startPos, frag.from >= startPos || frag.openStart, frag.to <= endPos || frag.openEnd));\n }\n }\n return result;\n}\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@lezer/common/dist/index.js?')},"./node_modules/@lezer/highlight/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Tag: () => (/* binding */ Tag),\n/* harmony export */ classHighlighter: () => (/* binding */ classHighlighter),\n/* harmony export */ getStyleTags: () => (/* binding */ getStyleTags),\n/* harmony export */ highlightCode: () => (/* binding */ highlightCode),\n/* harmony export */ highlightTree: () => (/* binding */ highlightTree),\n/* harmony export */ styleTags: () => (/* binding */ styleTags),\n/* harmony export */ tagHighlighter: () => (/* binding */ tagHighlighter),\n/* harmony export */ tags: () => (/* binding */ tags)\n/* harmony export */ });\n/* harmony import */ var _lezer_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/common */ "./node_modules/@lezer/common/dist/index.js");\n\n\nlet nextTagID = 0;\n/**\nHighlighting tags are markers that denote a highlighting category.\nThey are [associated](#highlight.styleTags) with parts of a syntax\ntree by a language mode, and then mapped to an actual CSS style by\na [highlighter](#highlight.Highlighter).\n\nBecause syntax tree node types and highlight styles have to be\nable to talk the same language, CodeMirror uses a mostly _closed_\n[vocabulary](#highlight.tags) of syntax tags (as opposed to\ntraditional open string-based systems, which make it hard for\nhighlighting themes to cover all the tokens produced by the\nvarious languages).\n\nIt _is_ possible to [define](#highlight.Tag^define) your own\nhighlighting tags for system-internal use (where you control both\nthe language package and the highlighter), but such tags will not\nbe picked up by regular highlighters (though you can derive them\nfrom standard tags to allow highlighters to fall back to those).\n*/\nclass Tag {\n /**\n @internal\n */\n constructor(\n /**\n The set of this tag and all its parent tags, starting with\n this one itself and sorted in order of decreasing specificity.\n */\n set, \n /**\n The base unmodified tag that this one is based on, if it\'s\n modified @internal\n */\n base, \n /**\n The modifiers applied to this.base @internal\n */\n modified) {\n this.set = set;\n this.base = base;\n this.modified = modified;\n /**\n @internal\n */\n this.id = nextTagID++;\n }\n /**\n Define a new tag. If `parent` is given, the tag is treated as a\n sub-tag of that parent, and\n [highlighters](#highlight.tagHighlighter) that don\'t mention\n this tag will try to fall back to the parent tag (or grandparent\n tag, etc).\n */\n static define(parent) {\n if (parent === null || parent === void 0 ? void 0 : parent.base)\n throw new Error("Can not derive from a modified tag");\n let tag = new Tag([], null, []);\n tag.set.push(tag);\n if (parent)\n for (let t of parent.set)\n tag.set.push(t);\n return tag;\n }\n /**\n Define a tag _modifier_, which is a function that, given a tag,\n will return a tag that is a subtag of the original. Applying the\n same modifier to a twice tag will return the same value (`m1(t1)\n == m1(t1)`) and applying multiple modifiers will, regardless or\n order, produce the same tag (`m1(m2(t1)) == m2(m1(t1))`).\n \n When multiple modifiers are applied to a given base tag, each\n smaller set of modifiers is registered as a parent, so that for\n example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,\n `m1(m3(t1)`, and so on.\n */\n static defineModifier() {\n let mod = new Modifier;\n return (tag) => {\n if (tag.modified.indexOf(mod) > -1)\n return tag;\n return Modifier.get(tag.base || tag, tag.modified.concat(mod).sort((a, b) => a.id - b.id));\n };\n }\n}\nlet nextModifierID = 0;\nclass Modifier {\n constructor() {\n this.instances = [];\n this.id = nextModifierID++;\n }\n static get(base, mods) {\n if (!mods.length)\n return base;\n let exists = mods[0].instances.find(t => t.base == base && sameArray(mods, t.modified));\n if (exists)\n return exists;\n let set = [], tag = new Tag(set, base, mods);\n for (let m of mods)\n m.instances.push(tag);\n let configs = powerSet(mods);\n for (let parent of base.set)\n if (!parent.modified.length)\n for (let config of configs)\n set.push(Modifier.get(parent, config));\n return tag;\n }\n}\nfunction sameArray(a, b) {\n return a.length == b.length && a.every((x, i) => x == b[i]);\n}\nfunction powerSet(array) {\n let sets = [[]];\n for (let i = 0; i < array.length; i++) {\n for (let j = 0, e = sets.length; j < e; j++) {\n sets.push(sets[j].concat(array[i]));\n }\n }\n return sets.sort((a, b) => b.length - a.length);\n}\n/**\nThis function is used to add a set of tags to a language syntax\nvia [`NodeSet.extend`](#common.NodeSet.extend) or\n[`LRParser.configure`](#lr.LRParser.configure).\n\nThe argument object maps node selectors to [highlighting\ntags](#highlight.Tag) or arrays of tags.\n\nNode selectors may hold one or more (space-separated) node paths.\nSuch a path can be a [node name](#common.NodeType.name), or\nmultiple node names (or `*` wildcards) separated by slash\ncharacters, as in `"Block/Declaration/VariableName"`. Such a path\nmatches the final node but only if its direct parent nodes are the\nother nodes mentioned. A `*` in such a path matches any parent,\nbut only a single level—wildcards that match multiple parents\naren\'t supported, both for efficiency reasons and because Lezer\ntrees make it rather hard to reason about what they would match.)\n\nA path can be ended with `/...` to indicate that the tag assigned\nto the node should also apply to all child nodes, even if they\nmatch their own style (by default, only the innermost style is\nused).\n\nWhen a path ends in `!`, as in `Attribute!`, no further matching\nhappens for the node\'s child nodes, and the entire node gets the\ngiven style.\n\nIn this notation, node names that contain `/`, `!`, `*`, or `...`\nmust be quoted as JSON strings.\n\nFor example:\n\n```javascript\nparser.withProps(\n styleTags({\n // Style Number and BigNumber nodes\n "Number BigNumber": tags.number,\n // Style Escape nodes whose parent is String\n "String/Escape": tags.escape,\n // Style anything inside Attributes nodes\n "Attributes!": tags.meta,\n // Add a style to all content inside Italic nodes\n "Italic/...": tags.emphasis,\n // Style InvalidString nodes as both `string` and `invalid`\n "InvalidString": [tags.string, tags.invalid],\n // Style the node named "/" as punctuation\n \'"/"\': tags.punctuation\n })\n)\n```\n*/\nfunction styleTags(spec) {\n let byName = Object.create(null);\n for (let prop in spec) {\n let tags = spec[prop];\n if (!Array.isArray(tags))\n tags = [tags];\n for (let part of prop.split(" "))\n if (part) {\n let pieces = [], mode = 2 /* Mode.Normal */, rest = part;\n for (let pos = 0;;) {\n if (rest == "..." && pos > 0 && pos + 3 == part.length) {\n mode = 1 /* Mode.Inherit */;\n break;\n }\n let m = /^"(?:[^"\\\\]|\\\\.)*?"|[^\\/!]+/.exec(rest);\n if (!m)\n throw new RangeError("Invalid path: " + part);\n pieces.push(m[0] == "*" ? "" : m[0][0] == \'"\' ? JSON.parse(m[0]) : m[0]);\n pos += m[0].length;\n if (pos == part.length)\n break;\n let next = part[pos++];\n if (pos == part.length && next == "!") {\n mode = 0 /* Mode.Opaque */;\n break;\n }\n if (next != "/")\n throw new RangeError("Invalid path: " + part);\n rest = part.slice(pos);\n }\n let last = pieces.length - 1, inner = pieces[last];\n if (!inner)\n throw new RangeError("Invalid path: " + part);\n let rule = new Rule(tags, mode, last > 0 ? pieces.slice(0, last) : null);\n byName[inner] = rule.sort(byName[inner]);\n }\n }\n return ruleNodeProp.add(byName);\n}\nconst ruleNodeProp = new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp();\nclass Rule {\n constructor(tags, mode, context, next) {\n this.tags = tags;\n this.mode = mode;\n this.context = context;\n this.next = next;\n }\n get opaque() { return this.mode == 0 /* Mode.Opaque */; }\n get inherit() { return this.mode == 1 /* Mode.Inherit */; }\n sort(other) {\n if (!other || other.depth < this.depth) {\n this.next = other;\n return this;\n }\n other.next = this.sort(other.next);\n return other;\n }\n get depth() { return this.context ? this.context.length : 0; }\n}\nRule.empty = new Rule([], 2 /* Mode.Normal */, null);\n/**\nDefine a [highlighter](#highlight.Highlighter) from an array of\ntag/class pairs. Classes associated with more specific tags will\ntake precedence.\n*/\nfunction tagHighlighter(tags, options) {\n let map = Object.create(null);\n for (let style of tags) {\n if (!Array.isArray(style.tag))\n map[style.tag.id] = style.class;\n else\n for (let tag of style.tag)\n map[tag.id] = style.class;\n }\n let { scope, all = null } = options || {};\n return {\n style: (tags) => {\n let cls = all;\n for (let tag of tags) {\n for (let sub of tag.set) {\n let tagClass = map[sub.id];\n if (tagClass) {\n cls = cls ? cls + " " + tagClass : tagClass;\n break;\n }\n }\n }\n return cls;\n },\n scope\n };\n}\nfunction highlightTags(highlighters, tags) {\n let result = null;\n for (let highlighter of highlighters) {\n let value = highlighter.style(tags);\n if (value)\n result = result ? result + " " + value : value;\n }\n return result;\n}\n/**\nHighlight the given [tree](#common.Tree) with the given\n[highlighter](#highlight.Highlighter). Often, the higher-level\n[`highlightCode`](#highlight.highlightCode) function is easier to\nuse.\n*/\nfunction highlightTree(tree, highlighter, \n/**\nAssign styling to a region of the text. Will be called, in order\nof position, for any ranges where more than zero classes apply.\n`classes` is a space separated string of CSS classes.\n*/\nputStyle, \n/**\nThe start of the range to highlight.\n*/\nfrom = 0, \n/**\nThe end of the range.\n*/\nto = tree.length) {\n let builder = new HighlightBuilder(from, Array.isArray(highlighter) ? highlighter : [highlighter], putStyle);\n builder.highlightRange(tree.cursor(), from, to, "", builder.highlighters);\n builder.flush(to);\n}\n/**\nHighlight the given tree with the given highlighter, calling\n`putText` for every piece of text, either with a set of classes or\nwith the empty string when unstyled, and `putBreak` for every line\nbreak.\n*/\nfunction highlightCode(code, tree, highlighter, putText, putBreak, from = 0, to = code.length) {\n let pos = from;\n function writeTo(p, classes) {\n if (p <= pos)\n return;\n for (let text = code.slice(pos, p), i = 0;;) {\n let nextBreak = text.indexOf("\\n", i);\n let upto = nextBreak < 0 ? text.length : nextBreak;\n if (upto > i)\n putText(text.slice(i, upto), classes);\n if (nextBreak < 0)\n break;\n putBreak();\n i = nextBreak + 1;\n }\n pos = p;\n }\n highlightTree(tree, highlighter, (from, to, classes) => {\n writeTo(from, "");\n writeTo(to, classes);\n }, from, to);\n writeTo(to, "");\n}\nclass HighlightBuilder {\n constructor(at, highlighters, span) {\n this.at = at;\n this.highlighters = highlighters;\n this.span = span;\n this.class = "";\n }\n startSpan(at, cls) {\n if (cls != this.class) {\n this.flush(at);\n if (at > this.at)\n this.at = at;\n this.class = cls;\n }\n }\n flush(to) {\n if (to > this.at && this.class)\n this.span(this.at, to, this.class);\n }\n highlightRange(cursor, from, to, inheritedClass, highlighters) {\n let { type, from: start, to: end } = cursor;\n if (start >= to || end <= from)\n return;\n if (type.isTop)\n highlighters = this.highlighters.filter(h => !h.scope || h.scope(type));\n let cls = inheritedClass;\n let rule = getStyleTags(cursor) || Rule.empty;\n let tagCls = highlightTags(highlighters, rule.tags);\n if (tagCls) {\n if (cls)\n cls += " ";\n cls += tagCls;\n if (rule.mode == 1 /* Mode.Inherit */)\n inheritedClass += (inheritedClass ? " " : "") + tagCls;\n }\n this.startSpan(Math.max(from, start), cls);\n if (rule.opaque)\n return;\n let mounted = cursor.tree && cursor.tree.prop(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.mounted);\n if (mounted && mounted.overlay) {\n let inner = cursor.node.enter(mounted.overlay[0].from + start, 1);\n let innerHighlighters = this.highlighters.filter(h => !h.scope || h.scope(mounted.tree.type));\n let hasChild = cursor.firstChild();\n for (let i = 0, pos = start;; i++) {\n let next = i < mounted.overlay.length ? mounted.overlay[i] : null;\n let nextPos = next ? next.from + start : end;\n let rangeFrom = Math.max(from, pos), rangeTo = Math.min(to, nextPos);\n if (rangeFrom < rangeTo && hasChild) {\n while (cursor.from < rangeTo) {\n this.highlightRange(cursor, rangeFrom, rangeTo, inheritedClass, highlighters);\n this.startSpan(Math.min(rangeTo, cursor.to), cls);\n if (cursor.to >= nextPos || !cursor.nextSibling())\n break;\n }\n }\n if (!next || nextPos > to)\n break;\n pos = next.to + start;\n if (pos > from) {\n this.highlightRange(inner.cursor(), Math.max(from, next.from + start), Math.min(to, pos), "", innerHighlighters);\n this.startSpan(Math.min(to, pos), cls);\n }\n }\n if (hasChild)\n cursor.parent();\n }\n else if (cursor.firstChild()) {\n if (mounted)\n inheritedClass = "";\n do {\n if (cursor.to <= from)\n continue;\n if (cursor.from >= to)\n break;\n this.highlightRange(cursor, from, to, inheritedClass, highlighters);\n this.startSpan(Math.min(to, cursor.to), cls);\n } while (cursor.nextSibling());\n cursor.parent();\n }\n }\n}\n/**\nMatch a syntax node\'s [highlight rules](#highlight.styleTags). If\nthere\'s a match, return its set of tags, and whether it is\nopaque (uses a `!`) or applies to all child nodes (`/...`).\n*/\nfunction getStyleTags(node) {\n let rule = node.type.prop(ruleNodeProp);\n while (rule && rule.context && !node.matchContext(rule.context))\n rule = rule.next;\n return rule || null;\n}\nconst t = Tag.define;\nconst comment = t(), name = t(), typeName = t(name), propertyName = t(name), literal = t(), string = t(literal), number = t(literal), content = t(), heading = t(content), keyword = t(), operator = t(), punctuation = t(), bracket = t(punctuation), meta = t();\n/**\nThe default set of highlighting [tags](#highlight.Tag).\n\nThis collection is heavily biased towards programming languages,\nand necessarily incomplete. A full ontology of syntactic\nconstructs would fill a stack of books, and be impractical to\nwrite themes for. So try to make do with this set. If all else\nfails, [open an\nissue](https://github.com/codemirror/codemirror.next) to propose a\nnew tag, or [define](#highlight.Tag^define) a local custom tag for\nyour use case.\n\nNote that it is not obligatory to always attach the most specific\ntag possible to an element—if your grammar can\'t easily\ndistinguish a certain type of element (such as a local variable),\nit is okay to style it as its more general variant (a variable).\n\nFor tags that extend some parent tag, the documentation links to\nthe parent.\n*/\nconst tags = {\n /**\n A comment.\n */\n comment,\n /**\n A line [comment](#highlight.tags.comment).\n */\n lineComment: t(comment),\n /**\n A block [comment](#highlight.tags.comment).\n */\n blockComment: t(comment),\n /**\n A documentation [comment](#highlight.tags.comment).\n */\n docComment: t(comment),\n /**\n Any kind of identifier.\n */\n name,\n /**\n The [name](#highlight.tags.name) of a variable.\n */\n variableName: t(name),\n /**\n A type [name](#highlight.tags.name).\n */\n typeName: typeName,\n /**\n A tag name (subtag of [`typeName`](#highlight.tags.typeName)).\n */\n tagName: t(typeName),\n /**\n A property or field [name](#highlight.tags.name).\n */\n propertyName: propertyName,\n /**\n An attribute name (subtag of [`propertyName`](#highlight.tags.propertyName)).\n */\n attributeName: t(propertyName),\n /**\n The [name](#highlight.tags.name) of a class.\n */\n className: t(name),\n /**\n A label [name](#highlight.tags.name).\n */\n labelName: t(name),\n /**\n A namespace [name](#highlight.tags.name).\n */\n namespace: t(name),\n /**\n The [name](#highlight.tags.name) of a macro.\n */\n macroName: t(name),\n /**\n A literal value.\n */\n literal,\n /**\n A string [literal](#highlight.tags.literal).\n */\n string,\n /**\n A documentation [string](#highlight.tags.string).\n */\n docString: t(string),\n /**\n A character literal (subtag of [string](#highlight.tags.string)).\n */\n character: t(string),\n /**\n An attribute value (subtag of [string](#highlight.tags.string)).\n */\n attributeValue: t(string),\n /**\n A number [literal](#highlight.tags.literal).\n */\n number,\n /**\n An integer [number](#highlight.tags.number) literal.\n */\n integer: t(number),\n /**\n A floating-point [number](#highlight.tags.number) literal.\n */\n float: t(number),\n /**\n A boolean [literal](#highlight.tags.literal).\n */\n bool: t(literal),\n /**\n Regular expression [literal](#highlight.tags.literal).\n */\n regexp: t(literal),\n /**\n An escape [literal](#highlight.tags.literal), for example a\n backslash escape in a string.\n */\n escape: t(literal),\n /**\n A color [literal](#highlight.tags.literal).\n */\n color: t(literal),\n /**\n A URL [literal](#highlight.tags.literal).\n */\n url: t(literal),\n /**\n A language keyword.\n */\n keyword,\n /**\n The [keyword](#highlight.tags.keyword) for the self or this\n object.\n */\n self: t(keyword),\n /**\n The [keyword](#highlight.tags.keyword) for null.\n */\n null: t(keyword),\n /**\n A [keyword](#highlight.tags.keyword) denoting some atomic value.\n */\n atom: t(keyword),\n /**\n A [keyword](#highlight.tags.keyword) that represents a unit.\n */\n unit: t(keyword),\n /**\n A modifier [keyword](#highlight.tags.keyword).\n */\n modifier: t(keyword),\n /**\n A [keyword](#highlight.tags.keyword) that acts as an operator.\n */\n operatorKeyword: t(keyword),\n /**\n A control-flow related [keyword](#highlight.tags.keyword).\n */\n controlKeyword: t(keyword),\n /**\n A [keyword](#highlight.tags.keyword) that defines something.\n */\n definitionKeyword: t(keyword),\n /**\n A [keyword](#highlight.tags.keyword) related to defining or\n interfacing with modules.\n */\n moduleKeyword: t(keyword),\n /**\n An operator.\n */\n operator,\n /**\n An [operator](#highlight.tags.operator) that dereferences something.\n */\n derefOperator: t(operator),\n /**\n Arithmetic-related [operator](#highlight.tags.operator).\n */\n arithmeticOperator: t(operator),\n /**\n Logical [operator](#highlight.tags.operator).\n */\n logicOperator: t(operator),\n /**\n Bit [operator](#highlight.tags.operator).\n */\n bitwiseOperator: t(operator),\n /**\n Comparison [operator](#highlight.tags.operator).\n */\n compareOperator: t(operator),\n /**\n [Operator](#highlight.tags.operator) that updates its operand.\n */\n updateOperator: t(operator),\n /**\n [Operator](#highlight.tags.operator) that defines something.\n */\n definitionOperator: t(operator),\n /**\n Type-related [operator](#highlight.tags.operator).\n */\n typeOperator: t(operator),\n /**\n Control-flow [operator](#highlight.tags.operator).\n */\n controlOperator: t(operator),\n /**\n Program or markup punctuation.\n */\n punctuation,\n /**\n [Punctuation](#highlight.tags.punctuation) that separates\n things.\n */\n separator: t(punctuation),\n /**\n Bracket-style [punctuation](#highlight.tags.punctuation).\n */\n bracket,\n /**\n Angle [brackets](#highlight.tags.bracket) (usually `<` and `>`\n tokens).\n */\n angleBracket: t(bracket),\n /**\n Square [brackets](#highlight.tags.bracket) (usually `[` and `]`\n tokens).\n */\n squareBracket: t(bracket),\n /**\n Parentheses (usually `(` and `)` tokens). Subtag of\n [bracket](#highlight.tags.bracket).\n */\n paren: t(bracket),\n /**\n Braces (usually `{` and `}` tokens). Subtag of\n [bracket](#highlight.tags.bracket).\n */\n brace: t(bracket),\n /**\n Content, for example plain text in XML or markup documents.\n */\n content,\n /**\n [Content](#highlight.tags.content) that represents a heading.\n */\n heading,\n /**\n A level 1 [heading](#highlight.tags.heading).\n */\n heading1: t(heading),\n /**\n A level 2 [heading](#highlight.tags.heading).\n */\n heading2: t(heading),\n /**\n A level 3 [heading](#highlight.tags.heading).\n */\n heading3: t(heading),\n /**\n A level 4 [heading](#highlight.tags.heading).\n */\n heading4: t(heading),\n /**\n A level 5 [heading](#highlight.tags.heading).\n */\n heading5: t(heading),\n /**\n A level 6 [heading](#highlight.tags.heading).\n */\n heading6: t(heading),\n /**\n A prose separator (such as a horizontal rule).\n */\n contentSeparator: t(content),\n /**\n [Content](#highlight.tags.content) that represents a list.\n */\n list: t(content),\n /**\n [Content](#highlight.tags.content) that represents a quote.\n */\n quote: t(content),\n /**\n [Content](#highlight.tags.content) that is emphasized.\n */\n emphasis: t(content),\n /**\n [Content](#highlight.tags.content) that is styled strong.\n */\n strong: t(content),\n /**\n [Content](#highlight.tags.content) that is part of a link.\n */\n link: t(content),\n /**\n [Content](#highlight.tags.content) that is styled as code or\n monospace.\n */\n monospace: t(content),\n /**\n [Content](#highlight.tags.content) that has a strike-through\n style.\n */\n strikethrough: t(content),\n /**\n Inserted text in a change-tracking format.\n */\n inserted: t(),\n /**\n Deleted text.\n */\n deleted: t(),\n /**\n Changed text.\n */\n changed: t(),\n /**\n An invalid or unsyntactic element.\n */\n invalid: t(),\n /**\n Metadata or meta-instruction.\n */\n meta,\n /**\n [Metadata](#highlight.tags.meta) that applies to the entire\n document.\n */\n documentMeta: t(meta),\n /**\n [Metadata](#highlight.tags.meta) that annotates or adds\n attributes to a given syntactic element.\n */\n annotation: t(meta),\n /**\n Processing instruction or preprocessor directive. Subtag of\n [meta](#highlight.tags.meta).\n */\n processingInstruction: t(meta),\n /**\n [Modifier](#highlight.Tag^defineModifier) that indicates that a\n given element is being defined. Expected to be used with the\n various [name](#highlight.tags.name) tags.\n */\n definition: Tag.defineModifier(),\n /**\n [Modifier](#highlight.Tag^defineModifier) that indicates that\n something is constant. Mostly expected to be used with\n [variable names](#highlight.tags.variableName).\n */\n constant: Tag.defineModifier(),\n /**\n [Modifier](#highlight.Tag^defineModifier) used to indicate that\n a [variable](#highlight.tags.variableName) or [property\n name](#highlight.tags.propertyName) is being called or defined\n as a function.\n */\n function: Tag.defineModifier(),\n /**\n [Modifier](#highlight.Tag^defineModifier) that can be applied to\n [names](#highlight.tags.name) to indicate that they belong to\n the language\'s standard environment.\n */\n standard: Tag.defineModifier(),\n /**\n [Modifier](#highlight.Tag^defineModifier) that indicates a given\n [names](#highlight.tags.name) is local to some scope.\n */\n local: Tag.defineModifier(),\n /**\n A generic variant [modifier](#highlight.Tag^defineModifier) that\n can be used to tag language-specific alternative variants of\n some common tag. It is recommended for themes to define special\n forms of at least the [string](#highlight.tags.string) and\n [variable name](#highlight.tags.variableName) tags, since those\n come up a lot.\n */\n special: Tag.defineModifier()\n};\n/**\nThis is a highlighter that adds stable, predictable classes to\ntokens, for styling with external CSS.\n\nThe following tags are mapped to their name prefixed with `"tok-"`\n(for example `"tok-comment"`):\n\n* [`link`](#highlight.tags.link)\n* [`heading`](#highlight.tags.heading)\n* [`emphasis`](#highlight.tags.emphasis)\n* [`strong`](#highlight.tags.strong)\n* [`keyword`](#highlight.tags.keyword)\n* [`atom`](#highlight.tags.atom)\n* [`bool`](#highlight.tags.bool)\n* [`url`](#highlight.tags.url)\n* [`labelName`](#highlight.tags.labelName)\n* [`inserted`](#highlight.tags.inserted)\n* [`deleted`](#highlight.tags.deleted)\n* [`literal`](#highlight.tags.literal)\n* [`string`](#highlight.tags.string)\n* [`number`](#highlight.tags.number)\n* [`variableName`](#highlight.tags.variableName)\n* [`typeName`](#highlight.tags.typeName)\n* [`namespace`](#highlight.tags.namespace)\n* [`className`](#highlight.tags.className)\n* [`macroName`](#highlight.tags.macroName)\n* [`propertyName`](#highlight.tags.propertyName)\n* [`operator`](#highlight.tags.operator)\n* [`comment`](#highlight.tags.comment)\n* [`meta`](#highlight.tags.meta)\n* [`punctuation`](#highlight.tags.punctuation)\n* [`invalid`](#highlight.tags.invalid)\n\nIn addition, these mappings are provided:\n\n* [`regexp`](#highlight.tags.regexp),\n [`escape`](#highlight.tags.escape), and\n [`special`](#highlight.tags.special)[`(string)`](#highlight.tags.string)\n are mapped to `"tok-string2"`\n* [`special`](#highlight.tags.special)[`(variableName)`](#highlight.tags.variableName)\n to `"tok-variableName2"`\n* [`local`](#highlight.tags.local)[`(variableName)`](#highlight.tags.variableName)\n to `"tok-variableName tok-local"`\n* [`definition`](#highlight.tags.definition)[`(variableName)`](#highlight.tags.variableName)\n to `"tok-variableName tok-definition"`\n* [`definition`](#highlight.tags.definition)[`(propertyName)`](#highlight.tags.propertyName)\n to `"tok-propertyName tok-definition"`\n*/\nconst classHighlighter = tagHighlighter([\n { tag: tags.link, class: "tok-link" },\n { tag: tags.heading, class: "tok-heading" },\n { tag: tags.emphasis, class: "tok-emphasis" },\n { tag: tags.strong, class: "tok-strong" },\n { tag: tags.keyword, class: "tok-keyword" },\n { tag: tags.atom, class: "tok-atom" },\n { tag: tags.bool, class: "tok-bool" },\n { tag: tags.url, class: "tok-url" },\n { tag: tags.labelName, class: "tok-labelName" },\n { tag: tags.inserted, class: "tok-inserted" },\n { tag: tags.deleted, class: "tok-deleted" },\n { tag: tags.literal, class: "tok-literal" },\n { tag: tags.string, class: "tok-string" },\n { tag: tags.number, class: "tok-number" },\n { tag: [tags.regexp, tags.escape, tags.special(tags.string)], class: "tok-string2" },\n { tag: tags.variableName, class: "tok-variableName" },\n { tag: tags.local(tags.variableName), class: "tok-variableName tok-local" },\n { tag: tags.definition(tags.variableName), class: "tok-variableName tok-definition" },\n { tag: tags.special(tags.variableName), class: "tok-variableName2" },\n { tag: tags.definition(tags.propertyName), class: "tok-propertyName tok-definition" },\n { tag: tags.typeName, class: "tok-typeName" },\n { tag: tags.namespace, class: "tok-namespace" },\n { tag: tags.className, class: "tok-className" },\n { tag: tags.macroName, class: "tok-macroName" },\n { tag: tags.propertyName, class: "tok-propertyName" },\n { tag: tags.operator, class: "tok-operator" },\n { tag: tags.comment, class: "tok-comment" },\n { tag: tags.meta, class: "tok-meta" },\n { tag: tags.invalid, class: "tok-invalid" },\n { tag: tags.punctuation, class: "tok-punctuation" }\n]);\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@lezer/highlight/dist/index.js?')},"./node_modules/@lezer/javascript/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parser: () => (/* binding */ parser)\n/* harmony export */ });\n/* harmony import */ var _lezer_lr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/lr */ \"./node_modules/@lezer/lr/dist/index.js\");\n/* harmony import */ var _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lezer/highlight */ \"./node_modules/@lezer/highlight/dist/index.js\");\n\n\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst noSemi = 304,\n incdec = 1,\n incdecPrefix = 2,\n insertSemi = 305,\n spaces = 307,\n newline = 308,\n LineComment = 3,\n BlockComment = 4;\n\n/* Hand-written tokenizers for JavaScript tokens that can't be\n expressed by lezer's built-in tokenizer. */\n\nconst space = [9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200,\n 8201, 8202, 8232, 8233, 8239, 8287, 12288];\n\nconst braceR = 125, semicolon = 59, slash = 47, star = 42, plus = 43, minus = 45;\n\nconst trackNewline = new _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.ContextTracker({\n start: false,\n shift(context, term) {\n return term == LineComment || term == BlockComment || term == spaces ? context : term == newline\n },\n strict: false\n});\n\nconst insertSemicolon = new _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.ExternalTokenizer((input, stack) => {\n let {next} = input;\n if (next == braceR || next == -1 || stack.context)\n input.acceptToken(insertSemi);\n}, {contextual: true, fallback: true});\n\nconst noSemicolon = new _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.ExternalTokenizer((input, stack) => {\n let {next} = input, after;\n if (space.indexOf(next) > -1) return\n if (next == slash && ((after = input.peek(1)) == slash || after == star)) return\n if (next != braceR && next != semicolon && next != -1 && !stack.context)\n input.acceptToken(noSemi);\n}, {contextual: true});\n\nconst incdecToken = new _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.ExternalTokenizer((input, stack) => {\n let {next} = input;\n if (next == plus || next == minus) {\n input.advance();\n if (next == input.next) {\n input.advance();\n let mayPostfix = !stack.context && stack.canShift(incdec);\n input.acceptToken(mayPostfix ? incdec : incdecPrefix);\n }\n }\n}, {contextual: true});\n\nconst jsHighlight = (0,_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.styleTags)({\n \"get set async static\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.modifier,\n \"for while do if else switch try catch finally return throw break continue default case\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.controlKeyword,\n \"in of await yield void typeof delete instanceof\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.operatorKeyword,\n \"let var const using function class extends\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definitionKeyword,\n \"import export from\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.moduleKeyword,\n \"with debugger as new\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.keyword,\n TemplateString: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.string),\n super: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.atom,\n BooleanLiteral: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.bool,\n this: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.self,\n null: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.null,\n Star: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.modifier,\n VariableName: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName,\n \"CallExpression/VariableName TaggedTemplateExpression/VariableName\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName),\n VariableDefinition: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName),\n Label: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.labelName,\n PropertyName: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.propertyName,\n PrivatePropertyName: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.propertyName),\n \"CallExpression/MemberExpression/PropertyName\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.propertyName),\n \"FunctionDeclaration/VariableDefinition\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName)),\n \"ClassDeclaration/VariableDefinition\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.className),\n PropertyDefinition: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.propertyName),\n PrivatePropertyDefinition: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.propertyName)),\n UpdateOp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.updateOperator,\n \"LineComment Hashbang\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.lineComment,\n BlockComment: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.blockComment,\n Number: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.number,\n String: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.string,\n Escape: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.escape,\n ArithOp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.arithmeticOperator,\n LogicOp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.logicOperator,\n BitOp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.bitwiseOperator,\n CompareOp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.compareOperator,\n RegExp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.regexp,\n Equals: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definitionOperator,\n Arrow: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.punctuation),\n \": Spread\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.punctuation,\n \"( )\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.paren,\n \"[ ]\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.squareBracket,\n \"{ }\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.brace,\n \"InterpolationStart InterpolationEnd\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.brace),\n \".\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.derefOperator,\n \", ;\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.separator,\n \"@\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.meta,\n\n TypeName: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.typeName,\n TypeDefinition: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.typeName),\n \"type enum interface implements namespace module declare\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definitionKeyword,\n \"abstract global Privacy readonly override\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.modifier,\n \"is keyof unique infer\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.operatorKeyword,\n\n JSXAttributeValue: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.attributeValue,\n JSXText: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.content,\n \"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.angleBracket,\n \"JSXIdentifier JSXNameSpacedName\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.tagName,\n \"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.attributeName,\n \"JSXBuiltin/JSXIdentifier\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.standard(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.tagName)\n});\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst spec_identifier = {__proto__:null,export:16, as:21, from:29, default:32, async:37, function:38, extends:48, this:52, true:60, false:60, null:72, void:76, typeof:80, super:98, new:132, delete:148, yield:157, await:161, class:166, public:223, private:223, protected:223, readonly:225, instanceof:244, satisfies:247, in:248, const:250, import:282, keyof:337, unique:341, infer:347, is:383, abstract:403, implements:405, type:407, let:410, var:412, using:415, interface:421, enum:425, namespace:431, module:433, declare:437, global:441, for:460, of:469, while:472, with:476, do:480, if:484, else:486, switch:490, case:496, try:502, catch:506, finally:510, return:514, throw:518, break:522, continue:526, debugger:530};\nconst spec_word = {__proto__:null,async:119, get:121, set:123, declare:183, public:185, private:185, protected:185, static:187, abstract:189, override:191, readonly:197, accessor:199, new:387};\nconst spec_LessThan = {__proto__:null,\"<\":139};\nconst parser = _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.LRParser.deserialize({\n version: 14,\n states: \"$6zO%TQUOOO%[QUOOO'_QWOOP(lOSOOO*zQ(CjO'#CgO+ROpO'#ChO+aO!bO'#ChO+oO07`O'#D[O.QQUO'#DbO.bQUO'#DmO%[QUO'#DwO0fQUO'#EPOOQ(CY'#EX'#EXO1PQSO'#EUOOQO'#Ej'#EjOOQO'#Id'#IdO1XQSO'#GlO1dQSO'#EiO1iQSO'#EiO3kQ(CjO'#JeO6[Q(CjO'#JfO6xQSO'#FXO6}Q#tO'#FpOOQ(CY'#Fa'#FaO7YO&jO'#FaO7hQ,UO'#FwO9OQSO'#FvOOQ(CY'#Jf'#JfOOQ(CW'#Je'#JeO9TQSO'#GpOOQQ'#KQ'#KQO9`QSO'#IQO9eQ(C[O'#IROOQQ'#JR'#JROOQQ'#IV'#IVQ`QUOOO`QUOOO%[QUO'#DoO9mQUO'#D{O9tQUO'#D}O9ZQSO'#GlO9{Q,UO'#CmO:ZQSO'#EhO:fQSO'#EsO:kQ,UO'#F`O;YQSO'#GlOOQO'#KR'#KRO;_QSO'#KRO;mQSO'#GtO;mQSO'#GuO;mQSO'#GwO9ZQSO'#GzO]QSO'#HZO>eQSO'#HaO>eQSO'#HcO`QUO'#HeO>eQSO'#HgO>eQSO'#HjO>jQSO'#HpO>oQ(C]O'#HvO%[QUO'#HxO>zQ(C]O'#HzO?VQ(C]O'#H|O9eQ(C[O'#IOO?bQ(CjO'#CgO@dQWO'#DgQOQSOOO%[QUO'#D}O@zQSO'#EQO9{Q,UO'#EhOAVQSO'#EhOAbQ`O'#F`OOQQ'#Ce'#CeOOQ(CW'#Dl'#DlOOQ(CW'#Ji'#JiO%[QUO'#JiOOQO'#Jm'#JmOOQO'#Ia'#IaOBbQWO'#EaOOQ(CW'#E`'#E`OC^Q(C`O'#EaOChQWO'#ETOOQO'#Jl'#JlOC|QWO'#JmOEZQWO'#ETOChQWO'#EaPEhO?MpO'#C`POOO)CDp)CDpOOOO'#IW'#IWOEsOpO,59SOOQ(CY,59S,59SOOOO'#IX'#IXOFRO!bO,59SO%[QUO'#D^OOOO'#IZ'#IZOFaO07`O,59vOOQ(CY,59v,59vOFoQUO'#I[OGSQSO'#JgOIUQbO'#JgO+}QUO'#JgOI]QSO,59|OIsQSO'#EjOJQQSO'#JuOJ]QSO'#JtOJ]QSO'#JtOJeQSO,5;WOJjQSO'#JsOOQ(CY,5:X,5:XOJqQUO,5:XOLrQ(CjO,5:cOMcQSO,5:kOM|Q(C[O'#JrONTQSO'#JqO9TQSO'#JqONiQSO'#JqONqQSO,5;VONvQSO'#JqO!#OQbO'#JfOOQ(CY'#Cg'#CgO%[QUO'#EPO!#nQ`O,5:pOOQO'#Jn'#JnOOQO-ElOOQQ'#JZ'#JZOOQQ,5>m,5>mOOQQ-ExQ(CjO,5:iOOQO,5@m,5@mO!?iQ,UO,5=WO!?wQ(C[O'#J[O9OQSO'#J[O!@YQ(C[O,59XO!@eQWO,59XO!@mQ,UO,59XO9{Q,UO,59XO!@xQSO,5;TO!AQQSO'#HYO!AfQSO'#KVO%[QUO,5;xO!7cQWO,5;zO!AnQSO,5=sO!AsQSO,5=sO!AxQSO,5=sO9eQ(C[O,5=sO;mQSO,5=cOOQO'#Cs'#CsO!BWQWO,5=`O!B`Q,UO,5=aO!BkQSO,5=cO!BpQ`O,5=fO!BxQSO'#KRO>jQSO'#HPO9ZQSO'#HRO!B}QSO'#HRO9{Q,UO'#HTO!CSQSO'#HTOOQQ,5=i,5=iO!CXQSO'#HUO!CjQSO'#CmO!CoQSO,58}O!CyQSO,58}O!FOQUO,58}OOQQ,58},58}O!F`Q(C[O,58}O%[QUO,58}O!HkQUO'#H]OOQQ'#H^'#H^OOQQ'#H_'#H_O`QUO,5=uO!IRQSO,5=uO`QUO,5={O`QUO,5=}O!IWQSO,5>PO`QUO,5>RO!I]QSO,5>UO!IbQUO,5>[OOQQ,5>b,5>bO%[QUO,5>bO9eQ(C[O,5>dOOQQ,5>f,5>fO!MlQSO,5>fOOQQ,5>h,5>hO!MlQSO,5>hOOQQ,5>j,5>jO!MqQWO'#DYO%[QUO'#JiO!N`QWO'#JiO!N}QWO'#DhO# `QWO'#DhO##qQUO'#DhO##xQSO'#JhO#$QQSO,5:RO#$VQSO'#EnO#$eQSO'#JvO#$mQSO,5;XO#$rQWO'#DhO#%PQWO'#ESOOQ(CY,5:l,5:lO%[QUO,5:lO#%WQSO,5:lO>jQSO,5;SO!@eQWO,5;SO!@mQ,UO,5;SO9{Q,UO,5;SO#%`QSO,5@TO#%eQ!LQO,5:pOOQO-E<_-E<_O#&kQ(C`O,5:{OChQWO,5:oO#&uQWO,5:oOChQWO,5:{O!@YQ(C[O,5:oOOQ(CW'#Ed'#EdOOQO,5:{,5:{O%[QUO,5:{O#'SQ(C[O,5:{O#'_Q(C[O,5:{O!@eQWO,5:oOOQO,5;R,5;RO#'mQ(C[O,5:{POOO'#IU'#IUP#(RO?MpO,58zPOOO,58z,58zOOOO-EvO+}QUO,5>vOOQO,5>|,5>|O#(mQUO'#I[OOQO-EWQ(CjO1G0yO#>_Q(CjO1G0yO#@VQ(CjO1G0yO#CVQ$IUO'#CgO#ETQ$IUO1G1[O#E[Q$IUO'#JfO!,YQSO1G1bO#ElQ(CjO,5?SOOQ(CW-EeQSO1G3kO$.fQUO1G3mO$2jQUO'#HlOOQQ1G3p1G3pO$2wQSO'#HrO>jQSO'#HtOOQQ1G3v1G3vO$3PQUO1G3vO9eQ(C[O1G3|OOQQ1G4O1G4OOOQ(CW'#GX'#GXO9eQ(C[O1G4QO9eQ(C[O1G4SO$7WQSO,5@TO!*SQUO,5;YO9TQSO,5;YO>jQSO,5:SO!*SQUO,5:SO!@eQWO,5:SO$7]Q$IUO,5:SOOQO,5;Y,5;YO$7gQWO'#I]O$7}QSO,5@SOOQ(CY1G/m1G/mO$8VQWO'#IcO$8aQSO,5@bOOQ(CW1G0s1G0sO# `QWO,5:SOOQO'#I`'#I`O$8iQWO,5:nOOQ(CY,5:n,5:nO#%ZQSO1G0WOOQ(CY1G0W1G0WO%[QUO1G0WOOQ(CY1G0n1G0nO>jQSO1G0nO!@eQWO1G0nO!@mQ,UO1G0nOOQ(CW1G5o1G5oO!@YQ(C[O1G0ZOOQO1G0g1G0gO%[QUO1G0gO$8pQ(C[O1G0gO$8{Q(C[O1G0gO!@eQWO1G0ZOChQWO1G0ZO$9ZQ(C[O1G0gOOQO1G0Z1G0ZO$9oQ(CjO1G0gPOOO-EvO$:]QSO1G5mO$:eQSO1G5zO$:mQbO1G5{O9TQSO,5>|O$:wQ(CjO1G5xO%[QUO1G5xO$;XQ(C[O1G5xO$;jQSO1G5wO$;jQSO1G5wO9TQSO1G5wO$;rQSO,5?PO9TQSO,5?POOQO,5?P,5?PO$WOOQQ,5>W,5>WO%[QUO'#HmO%(vQSO'#HoOOQQ,5>^,5>^O9TQSO,5>^OOQQ,5>`,5>`OOQQ7+)b7+)bOOQQ7+)h7+)hOOQQ7+)l7+)lOOQQ7+)n7+)nO%({QWO1G5oO%)aQ$IUO1G0tO%)kQSO1G0tOOQO1G/n1G/nO%)vQ$IUO1G/nO>jQSO1G/nO!*SQUO'#DhOOQO,5>w,5>wOOQO-E},5>}OOQO-EjQSO7+&YO!@eQWO7+&YOOQO7+%u7+%uO$9oQ(CjO7+&ROOQO7+&R7+&RO%[QUO7+&RO%*QQ(C[O7+&RO!@YQ(C[O7+%uO!@eQWO7+%uO%*]Q(C[O7+&RO%*kQ(CjO7++dO%[QUO7++dO%*{QSO7++cO%*{QSO7++cOOQO1G4k1G4kO9TQSO1G4kO%+TQSO1G4kOOQO7+%z7+%zO#%ZQSO<xOOQO-E<[-E<[O%2yQbO,5>yO%[QUO,5>yOOQO-E<]-E<]O%3TQSO1G5qOOQ(CY<tQ$IUO1G0yO%>{Q$IUO1G0yO%@sQ$IUO1G0yO%AWQ(CjO<XOOQQ,5>Z,5>ZO& PQSO1G3xO9TQSO7+&`O!*SQUO7+&`OOQO7+%Y7+%YO& UQ$IUO1G5{O>jQSO7+%YOOQ(CY<jQSO<jQSO7+)dO&6mQSO<{AN>{O%[QUOAN?XOOQO<PQSO7+*ZO&>[QSO<= ZO&>dQ`O7+*]OOQ(CW<nQ`O<uQSO<= dOOQQG27kG27kO9eQ(C[OG27kO!*SQUO1G4vO&>}QSO7++uO%MbQSOANAyOOQQANAyANAyO!&^Q,UOANAyO&?VQSOANAyOOQQANA{ANA{O9eQ(C[OANA{O#NWQSOANA{OOQO'#HW'#HWOOQO7+*e7+*eOOQQG22uG22uOOQQANEPANEPOOQQANEQANEQOOQQANBTANBTO&?_QSOANBTOOQQ<fOPZXYZXlZXzZX{ZX}ZX!fZX!gZX!iZX!mZX#YZX#edX#hZX#iZX#jZX#kZX#lZX#mZX#nZX#oZX#pZX#rZX#tZX#vZX#wZX#|ZX(TZX(dZX(kZX(lZX!WZX!XZX~O#zZX~P#APOP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO#t:RO#v:TO#w:UO(TVO(d$ZO(k#|O(l#}O~O#z.iO~P#C^O#Y:ZO#|:ZO#z(YX!X(YX~P! UO_'[a!W'[a'm'[a'k'[a!h'[a!T'[ap'[a!Y'[a%b'[a!b'[a~P!7zOP#giY#gi_#gil#gi{#gi!W#gi!f#gi!g#gi!i#gi!m#gi#h#gi#i#gi#j#gi#k#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi'm#gi(T#gi(d#gi'k#gi!T#gi!h#gip#gi!Y#gi%b#gi!b#gi~P#,sO_#{i!W#{i'm#{i'k#{i!T#{i!h#{ip#{i!Y#{i%b#{i!b#{i~P!7zO$X.nO$Z.nO~O$X.oO$Z.oO~O!b)_O#Y.pO!Y$_X$U$_X$X$_X$Z$_X$b$_X~O!V.qO~O!Y)bO$U.sO$X)aO$Z)aO$b.tO~O!W:VO!X(XX~P#C^O!X.uO~O!b)_O$b(mX~O$b.wO~Or)qO(U)rO(V.zO~O!T/OO~P!&^O!WdX!bdX!hdX!h$tX(ddX~P!/bO!h/UO~P#,sO!W/VO!b#uO(d'gO!h(qX~O!h/[O~O!V*SO'v%`O!h(qP~O#e/^O~O!T$tX!W$tX!b${X~P!/bO!W/_O!T(rX~P#,sO!b/aO~O!T/cO~Ol/gO!b#uO!i%^O(P%RO(d'gO~O'v/iO~O!b+YO~O_%gO!W/mO'm%gO~O!X/oO~P!3`O!^/pO!_/pO'w!lO(W!mO~O}/rO(W!mO~O#U/sO~O'v&QOe'aX!W'aX~O!W*lOe(Qa~Oe/xO~Oz/yO{/yO}/zOhwa(kwa(lwa!Wwa#Ywa~Oewa#zwa~P$ tOz)vO})wOh$ma(k$ma(l$ma!W$ma#Y$ma~Oe$ma#z$ma~P$!jOz)vO})wOh$oa(k$oa(l$oa!W$oa#Y$oa~Oe$oa#z$oa~P$#]O#e/|O~Oe$}a!W$}a#Y$}a#z$}a~P!0kO!b#uO~O#e0PO~O!W*}O_(va'm(va~Oz#yO{#zO}#{O!g#wO!i#xO(TVOP!oiY!oil!oi!W!oi!f!oi!m!oi#h!oi#i!oi#j!oi#k!oi#l!oi#m!oi#n!oi#o!oi#p!oi#r!oi#t!oi#v!oi#w!oi(d!oi(k!oi(l!oi~O_!oi'm!oi'k!oi!T!oi!h!oip!oi!Y!oi%b!oi!b!oi~P$$zOh.UO!Y'VO%b.TO~Oj0ZO'v0YO~P!1]O!b+YO_(Oa!Y(Oa'm(Oa!W(Oa~O#e0aO~OYZX!WdX!XdX~O!W0bO!X(zX~O!X0dO~OY0eO~O`0gO'v+bO'xTO'{UO~O!Y%wO'v%`O^'iX!W'iX~O!W+gO^(ya~O!h0jO~P!7zOY0mO~O^0nO~O#Y0qO~Oh0tO!Y$|O~O(W(tO!X(wP~Oh0}O!Y0zO%b0|O(P%RO~OY1XO!W1VO!X(xX~O!X1YO~O^1[O_%gO'm%gO~O'v#mO'xTO'{UO~O#Y$eO#|$eOP(YXY(YXl(YXz(YX{(YX}(YX!W(YX!f(YX!i(YX!m(YX#h(YX#i(YX#j(YX#k(YX#l(YX#m(YX#n(YX#o(YX#r(YX#t(YX#v(YX#w(YX(T(YX(d(YX(k(YX(l(YX~O#p1_O&S1`O_(YX!g(YX~P$+sO#Y$eO#p1_O&S1`O~O_1bO~P%[O_1dO~O&]1gOP&ZiQ&ZiW&Zi_&Zib&Zic&Zij&Zil&Zim&Zin&Zit&Ziv&Zix&Zi}&Zi!R&Zi!S&Zi!Y&Zi!d&Zi!i&Zi!l&Zi!m&Zi!n&Zi!p&Zi!r&Zi!u&Zi!y&Zi#q&Zi$R&Zi$V&Zi%a&Zi%c&Zi%e&Zi%f&Zi%g&Zi%j&Zi%l&Zi%o&Zi%p&Zi%r&Zi&O&Zi&U&Zi&W&Zi&Y&Zi&[&Zi&_&Zi&e&Zi&k&Zi&m&Zi&o&Zi&q&Zi&s&Zi'k&Zi'v&Zi'x&Zi'{&Zi(T&Zi(c&Zi(p&Zi!X&Zi`&Zi&b&Zi~O`1mO!X1kO&b1lO~P`O!YXO!i1oO~O&i,jOP&diQ&diW&di_&dib&dic&dij&dil&dim&din&dit&div&dix&di}&di!R&di!S&di!Y&di!d&di!i&di!l&di!m&di!n&di!p&di!r&di!u&di!y&di#q&di$R&di$V&di%a&di%c&di%e&di%f&di%g&di%j&di%l&di%o&di%p&di%r&di&O&di&U&di&W&di&Y&di&[&di&_&di&e&di&k&di&m&di&o&di&q&di&s&di'k&di'v&di'x&di'{&di(T&di(c&di(p&di!X&di&]&di`&di&b&di~O!T1uO~O!W![a!X![a~P#C^Om!nO}!oO!V1{O(W!mO!W'PX!X'PX~P@OO!W,zO!X([a~O!W'VX!X'VX~P!7SO!W,}O!X(ja~O!X2SO~P'_O_%gO#Y2]O'm%gO~O_%gO!b#uO#Y2]O'm%gO~O_%gO!b#uO!m2aO#Y2]O'm%gO(d'gO~O_%gO'm%gO~P!7zO!W$aOp$la~O!T'Oi!W'Oi~P!7zO!W'{O!T(Zi~O!W(SO!T(hi~O!T(ii!W(ii~P!7zO!W(fi!h(fi_(fi'm(fi~P!7zO#Y2cO!W(fi!h(fi_(fi'm(fi~O!W(`O!h(ei~O}%aO!Y%bO!y]O#c2hO#d2gO'v%`O~O}%aO!Y%bO#d2gO'v%`O~Oh2oO!Y'VO%b2nO~Oh2oO!Y'VO%b2nO(P%RO~O#ewaPwaYwa_walwa!fwa!gwa!iwa!mwa#hwa#iwa#jwa#kwa#lwa#mwa#nwa#owa#pwa#rwa#twa#vwa#wwa'mwa(Twa(dwa!hwa!Twa'kwapwa!Ywa%bwa!bwa~P$ tO#e$maP$maY$ma_$mal$ma{$ma!f$ma!g$ma!i$ma!m$ma#h$ma#i$ma#j$ma#k$ma#l$ma#m$ma#n$ma#o$ma#p$ma#r$ma#t$ma#v$ma#w$ma'm$ma(T$ma(d$ma!h$ma!T$ma'k$map$ma!Y$ma%b$ma!b$ma~P$!jO#e$oaP$oaY$oa_$oal$oa{$oa!f$oa!g$oa!i$oa!m$oa#h$oa#i$oa#j$oa#k$oa#l$oa#m$oa#n$oa#o$oa#p$oa#r$oa#t$oa#v$oa#w$oa'm$oa(T$oa(d$oa!h$oa!T$oa'k$oap$oa!Y$oa%b$oa!b$oa~P$#]O#e$}aP$}aY$}a_$}al$}a{$}a!W$}a!f$}a!g$}a!i$}a!m$}a#h$}a#i$}a#j$}a#k$}a#l$}a#m$}a#n$}a#o$}a#p$}a#r$}a#t$}a#v$}a#w$}a'm$}a(T$}a(d$}a!h$}a!T$}a'k$}a#Y$}ap$}a!Y$}a%b$}a!b$}a~P#,sO_#]q!W#]q'm#]q'k#]q!T#]q!h#]qp#]q!Y#]q%b#]q!b#]q~P!7zOe'QX!W'QX~P!'vO!W._Oe(^a~O!V2wO!W'RX!h'RX~P%[O!W.bO!h(_a~O!W.bO!h(_a~P!7zO!T2zO~O#z!ka!X!ka~PJxO#z!ca!W!ca!X!ca~P#C^O#z!oa!X!oa~P!:eO#z!qa!X!qa~P!=OO!Y3^O$VfO$`3_O~O!X3cO~Op3dO~P#,sO_$iq!W$iq'm$iq'k$iq!T$iq!h$iqp$iq!Y$iq%b$iq!b$iq~P!7zO!T3eO~P#,sOz)vO})wO(l){Oh%Yi(k%Yi!W%Yi#Y%Yi~Oe%Yi#z%Yi~P$J]Oz)vO})wOh%[i(k%[i(l%[i!W%[i#Y%[i~Oe%[i#z%[i~P$KOO(d$ZO~P#,sO!V3hO'v%`O!W']X!h']X~O!W/VO!h(qa~O!W/VO!b#uO!h(qa~O!W/VO!b#uO(d'gO!h(qa~Oe$vi!W$vi#Y$vi#z$vi~P!0kO!V3pO'v*XO!T'_X!W'_X~P!1YO!W/_O!T(ra~O!W/_O!T(ra~P#,sO!b#uO#p3xO~Ol3{O!b#uO(d'gO~Oe(Ri!W(Ri~P!0kO#Y4OOe(Ri!W(Ri~P!0kO!h4RO~O_$jq!W$jq'm$jq'k$jq!T$jq!h$jqp$jq!Y$jq%b$jq!b$jq~P!7zO!T4VO~O!W4WO!Y(sX~P#,sO!g#wO~P4XO_$tX!Y$tX%VZX'm$tX!W$tX~P!/bO%V4YO_iXhiXziX}iX!YiX'miX(kiX(liX!WiX~O%V4YO~O`4`O%c4aO'v+bO'xTO'{UO!W'hX!X'hX~O!W0bO!X(za~OY4eO~O^4fO~O_%gO'm%gO~P#,sO!Y$|O~P#,sO!W4nO#Y4pO!X(wX~O!X4qO~Om!nO}4rO!]!xO!^!uO!_!uO!y9rO!}!pO#O!pO#P!pO#Q!pO#R!pO#U4wO#V!yO'w!lO'xTO'{UO(W!mO(c!sO~O!X4vO~P%%QOh4|O!Y0zO%b4{O~Oh4|O!Y0zO%b4{O(P%RO~O`5TO'v#mO'xTO'{UO!W'gX!X'gX~O!W1VO!X(xa~O'xTO'{UO(W5VO~O^5ZO~O#p5^O&S5_O~PMhO!h5`O~P%[O_5bO~O_5bO~P%[O`1mO!X5gO&b1lO~P`O!b5iO~O!b5kO!W(]i!X(]i!b(]i!i(]i(P(]i~O!W#bi!X#bi~P#C^O#Y5lO!W#bi!X#bi~O!W![i!X![i~P#C^O_%gO#Y5uO'm%gO~O_%gO!b#uO#Y5uO'm%gO~O!W(fq!h(fq_(fq'm(fq~P!7zO!W(`O!h(eq~O}%aO!Y%bO#d5|O'v%`O~O!Y'VO%b6PO~Oh6SO!Y'VO%b6PO~O#e%YiP%YiY%Yi_%Yil%Yi{%Yi!f%Yi!g%Yi!i%Yi!m%Yi#h%Yi#i%Yi#j%Yi#k%Yi#l%Yi#m%Yi#n%Yi#o%Yi#p%Yi#r%Yi#t%Yi#v%Yi#w%Yi'm%Yi(T%Yi(d%Yi!h%Yi!T%Yi'k%Yip%Yi!Y%Yi%b%Yi!b%Yi~P$J]O#e%[iP%[iY%[i_%[il%[i{%[i!f%[i!g%[i!i%[i!m%[i#h%[i#i%[i#j%[i#k%[i#l%[i#m%[i#n%[i#o%[i#p%[i#r%[i#t%[i#v%[i#w%[i'm%[i(T%[i(d%[i!h%[i!T%[i'k%[ip%[i!Y%[i%b%[i!b%[i~P$KOO#e$viP$viY$vi_$vil$vi{$vi!W$vi!f$vi!g$vi!i$vi!m$vi#h$vi#i$vi#j$vi#k$vi#l$vi#m$vi#n$vi#o$vi#p$vi#r$vi#t$vi#v$vi#w$vi'm$vi(T$vi(d$vi!h$vi!T$vi'k$vi#Y$vip$vi!Y$vi%b$vi!b$vi~P#,sOe'Qa!W'Qa~P!0kO!W'Ra!h'Ra~P!7zO!W.bO!h(_i~O#z#]i!W#]i!X#]i~P#C^OP$]Oz#yO{#zO}#{O!g#wO!i#xO!m$]O(TVOY#gil#gi!f#gi#i#gi#j#gi#k#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi#z#gi(d#gi(k#gi(l#gi!W#gi!X#gi~O#h#gi~P%3jO#h9zO~P%3jOP$]Oz#yO{#zO}#{O!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O(TVOY#gi!f#gi#l#gi#m#gi#n#gi#o#gi#p#gi#r#gi#t#gi#v#gi#w#gi#z#gi(d#gi(k#gi(l#gi!W#gi!X#gi~Ol#gi~P%5uOl9|O~P%5uOP$]Ol9|Oz#yO{#zO}#{O!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O(TVO#r#gi#t#gi#v#gi#w#gi#z#gi(d#gi(k#gi(l#gi!W#gi!X#gi~OY#gi!f#gi#m#gi#n#gi#o#gi#p#gi~P%8QOY:YO!f:OO#m:OO#n:OO#o:XO#p:OO~P%8QOP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO(TVO#t#gi#v#gi#w#gi#z#gi(d#gi(l#gi!W#gi!X#gi~O(k#gi~P%:lO(k#|O~P%:lOP$]OY:YOl9|Oz#yO{#zO}#{O!f:OO!g#wO!i#xO!m$]O#h9zO#i9{O#j9{O#k9{O#l9}O#m:OO#n:OO#o:XO#p:OO#r:PO#t:RO(TVO(k#|O#v#gi#w#gi#z#gi(d#gi!W#gi!X#gi~O(l#gi~P%yP?^P?^PPP?^PAOP?^P?^P?^PASPPAXPArPFjPPPFnPPPPFnIoPPPIuJpPFnPMOPPPP! ^FnPPPFnPFnP!#lFnP!'Q!(S!(]P!)P!)T!)PPPPPP!,`!(SPP!,|!-vP!0jFnFn!0o!3y!8`!8`!}P#@^#@e#@mPPPP#D{#Gr#NZ#N^#Na$ Y$ ]$ `$ g$ oPP$ u$ y$!q$#p$#t$$YPP$$^$$d$$hP$$k$$o$$r$%h$&P$&h$&l$&o$&r$&x$&{$'P$'TR!{RoqOXst!Z#c%f&i&k&l&n,b,g1g1jY!uQ'V-S0z4uQ%lvQ%tyQ%{|Q&a!VS&}!e,zQ']!iS'c!r!xS*_$|*dQ+`%uQ+m%}Q,R&ZQ-Q'UQ-['^Q-d'dQ/p*fQ1U,SR:d9u%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|,_,b,g-W-`-n-t.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2w4r4|5^5_5b5u7Z7`7o7yS#p]9r!r)W$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ*o%VQ+e%wQ,T&^Q,[&fQ.X:[Q0W+WQ0[+YQ0g+fQ1^,YQ2k.UQ4`0bQ5T1VQ6R2oQ6X:]Q6z4aR8P6S&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;ct!nQ!r!u!x!y&}'U'V'c'd'e,z-Q-S-d0z4u4w$^$si#u#w$c$d$x${%W%X%])q)w)z)|)}*U*[*j*k+V+Y+q+t.T._/P/^/_/a/|0q0t0|2n3f3p3x4O4W4Y4{6P6g6p7]7|8X8l9O9^9f:X:Y:^:_:`:a:b:c:i:j:k:l:m:n:q:r:s:t:w:x;`;h;i;l;mQ&O|Q&{!eS'R%b,}Q+e%wQ,T&^Q/{*sQ0g+fQ0l+lQ1],XQ1^,YQ4`0bQ4i0nQ5T1VQ5W1XQ5X1[Q6z4aQ6}4fQ7h5ZQ8g7OR8r7ernOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jR,V&b&v^OPXYstuvwz!Z!`!g!j!o#R#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'X'i'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;b;c[#[WZ#V#Y'O'y!S%cm#g#h#k%^%a(S(^(_(`*z*{*},^,t-r-x-y-z-|1o2g2h5k5|Q%oxQ%syS%x|%}Q&U!TQ'Y!hQ'[!iQ(g#rS*R$x*VS+_%t%uQ+c%wQ+|&XQ,Q&ZS-Z']'^Q.W(hQ/Z*SQ0`+`Q0f+fQ0h+gQ0k+kQ1P+}S1T,R,SQ2X-[Q3g/VQ4_0bQ4c0eQ4h0mQ5S1UQ6d3hQ6y4aQ6|4eQ8c6xR9X8dv$zi#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;i!S%qy!i!t%s%t%u&|'[']'^'b'l*^+_+`,w-Z-[-c/h0`2Q2X2`3zQ+X%oQ+r&RQ+u&SQ,P&ZQ.V(gQ1O+|U1S,Q,R,SQ2p.WQ4}1PS5R1T1UQ7d5S#O;d#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mg;e:X:Y:_:a:c:j:l:n:r:t:xW%Pi%R*l;`S&R!Q&`Q&S!RQ&T!SR+p&P$_%Oi#u#w$c$d$x${%W%X%])q)w)z)|)}*U*[*j*k+V+Y+q+t.T._/P/^/_/a/|0q0t0|2n3f3p3x4O4W4Y4{6P6g6p7]7|8X8l9O9^9f:X:Y:^:_:`:a:b:c:i:j:k:l:m:n:q:r:s:t:w:x;`;h;i;l;mT)r$u)sV*p%V:[:]U'R!e%b,}S(u#y#zQ+j%zS.P(c(dQ0u+vQ4P/yR7S4n&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;c$i$`c#X#d%j%k%m'x(O(j(q(y(z({(|(})O)P)Q)R)S)T)V)Y)^)h+T+i,x-g-l-q-s.^.d.h.j.k.l.{/}1v1y2Z2b2v2{2|2}3O3P3Q3R3S3T3U3V3W3X3[3]3b4T4]5n5t5y6V6W6]6^7U7s7w8Q8U8V8{9Z9b9s;VT#SV#T&}kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ'P!eR1|,zv!nQ!e!r!u!x!y&}'U'V'c'd'e,z-Q-S-d0z4u4wS*^$|*dS/h*_*fQ/q*gQ0w+xQ3z/pR3}/snqOXst!Z#c%f&i&k&l&n,b,g1g1jQ&p!^Q'm!wS(i#t9yQ+]%rQ+z&UQ+{&WQ-X'ZQ-f'fS.](n:fS0O*x:oQ0^+^Q0y+yQ1n,iQ1p,jQ1x,uQ2V-YQ2Y-^S4U0P:uQ4Z0_S4^0a:vQ5m1zQ5q2WQ5v2_Q6w4[Q7t5oQ7u5rQ7x5wR8x7q$d$_c#X#d%k%m'x(O(j(q(y(z({(|(})O)P)Q)R)S)T)V)Y)^)h+T+i,x-g-l-q-s.^.d.h.k.l.{/}1v1y2Z2b2v2{2|2}3O3P3Q3R3S3T3U3V3W3X3[3]3b4T4]5n5t5y6V6W6]6^7U7s7w8Q8U8V8{9Z9b9s;VS(f#o'`U*i$}(m3ZS+S%j.jQ2l0WQ6O2kQ8O6RR9P8P$d$^c#X#d%k%m'x(O(j(q(y(z({(|(})O)P)Q)R)S)T)V)Y)^)h+T+i,x-g-l-q-s.^.d.h.k.l.{/}1v1y2Z2b2v2{2|2}3O3P3Q3R3S3T3U3V3W3X3[3]3b4T4]5n5t5y6V6W6]6^7U7s7w8Q8U8V8{9Z9b9s;VS(e#o'`S(w#z$_S+R%j.jS.Q(d(fQ.m)XQ0T+SR2i.R&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cS#p]9rQ&k!XQ&l!YQ&n![Q&o!]R1f,eQ'W!hQ+U%oQ-V'YS.S(g+XQ2T-UW2m.V.W0V0XQ5p2UU5}2j2l2pS7{6O6QS8}7}8OS9d8|9PQ9l9eR9o9mU!vQ'V-ST4s0z4u!Q_OXZ`st!V!Z#c#g%^%f&`&b&i&k&l&n(`,b,g-y1g1j]!pQ!r'V-S0z4uT#p]9r%Y{OPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yS(u#y#zS.P(c(d!s:|$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cY!tQ'V-S0z4uQ'b!rS'l!u!xS'n!y4wS-c'c'dQ-e'eR2`-dQ'k!tS([#f1aS-b'b'nQ/Y*RQ/f*^Q2a-eQ3l/ZS3u/g/qQ6c3gS6n3{3}Q8Z6dR8b6qQ#vbQ'j!tS(Z#f1aS(]#l*wQ*y%_Q+Z%pQ+a%vU-a'b'k'nQ-u([Q/X*RQ/e*^Q/k*aQ0]+[Q1Q,OS2^-b-eQ2f-}S3k/Y/ZS3t/f/qQ3w/jQ3y/lQ5P1RQ5x2aQ6b3gQ6f3lS6j3u3}Q6o3|Q7b5QS8Y6c6dQ8^6kQ8`6nQ8o7cQ9T8ZQ9U8_Q9W8bQ9`8pQ9h9VQ;P:zQ;[;TR;];UV!vQ'V-S%YaOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yS#vz!j!r:y$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cR;P;b%YbOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yQ%_j!S%py!i!t%s%t%u&|'[']'^'b'l*^+_+`,w-Z-[-c/h0`2Q2X2`3zS%vz!jQ+[%qQ,O&ZW1R,P,Q,R,SU5Q1S1T1US7c5R5SQ8p7d!r:z$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ;T;aR;U;b$|eOPXYstuvw!Z!`!g!o#R#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&i&k&l&n&r&z'X'i'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7yY#aWZ#V#Y'y!S%cm#g#h#k%^%a(S(^(_(`*z*{*},^,t-r-x-y-z-|1o2g2h5k5|Q,]&f!p:{$[$m)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cR;O'OS'S!e%bR2O,}%OdOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|,_,b,g-W-`-n-t.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2w4r4|5^5_5b5u7Z7`7o7y!r)W$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cQ,[&fQ0W+WQ2k.UQ6R2oR8P6S!f$Uc#X%j'x(O(j(q)Q)R)S)T)Y)^+i-g-l-q-s.^.d.{/}2Z2b2v3X4T4]5t5y6V7w8{9s!T:Q)V)h,x.j1v1y2{3T3U3V3W3[3b5n6W6]6^7U7s8Q8U8V9Z9b;V!b$Wc#X%j'x(O(j(q)S)T)Y)^+i-g-l-q-s.^.d.{/}2Z2b2v3X4T4]5t5y6V7w8{9s!P:S)V)h,x.j1v1y2{3V3W3[3b5n6W6]6^7U7s8Q8U8V9Z9b;V!^$[c#X%j'x(O(j(q)Y)^+i-g-l-q-s.^.d.{/}2Z2b2v3X4T4]5t5y6V7w8{9sQ3f/Tz;c)V)h,x.j1v1y2{3[3b5n6W6]6^7U7s8Q8U8V9Z9b;VQ;h;jR;i;k&|kOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cS$nh$oR3_.p'TgOPWXYZhstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m$o%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.p.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cT$jf$pQ$hfS)a$k)eR)m$pT$if$pT)c$k)e'ThOPWXYZhstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$[$a$e$m$o%f%l%y&b&e&f&i&k&l&n&r&z'O'X'i'y'{(R(Y(n(r(v)j)u*x*|+W,_,b,g,s,v-W-`-n-t.U.b.i.p.q/z0P0a0}1_1`1b1d1g1j1l1{2]2c2o2w3^4p4r4|5^5_5b5l5u6S7Z7`7o7y8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;cT$nh$oQ$qhR)l$o%YjOPWXYZstuvw!Z!`!g!o#R#V#Y#c#n#t#x#{$O$P$Q$R$S$T$U$V$W$X$Y$a$e%f%l%y&b&e&f&i&k&l&n&r&z'X'i'y'{(R(Y(n(r(v)u*x*|+W,_,b,g-W-`-n-t.U.b.i/z0P0a0}1_1`1b1d1g1j1l2]2c2o2w4r4|5^5_5b5u6S7Z7`7o7y!s;a$[$m'O)j,s,v.q1{3^4p5l8h8y9q9t9u9x9y9z9{9|9}:O:P:Q:R:S:T:U:V:Z:d:e:f:h:o:p:u:v;c#clOPXZst!Z!`!o#R#c#n#{$m%f&b&e&f&i&k&l&n&r&z'X(v)j*|+W,_,b,g-W.U.q/z0}1_1`1b1d1g1j1l2o3^4r4|5^5_5b6S7Z7`7ov$}i#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;i#O(m#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mQ*t%ZQ.|)vg3Z:X:Y:_:a:c:j:l:n:r:t:xv$yi#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;iQ*W$zS*a$|*dQ*u%[Q/l*b#O;R#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mf;S:X:Y:_:a:c:j:l:n:r:t:xQ;W;dQ;X;eQ;Y;fR;Z;gv$}i#w%W%X%])z)|*U*j*k._/^/|3f4O8X;`;h;i#O(m#u$c$d$x${)q)w)}*[+V+Y+q+t.T/P/_/a0q0t0|2n3p3x4W4Y4{6P6g6p7]7|8l9O9^9f:^:`:b:i:k:m:q:s:w;l;mg3Z:X:Y:_:a:c:j:l:n:r:t:xnoOXst!Z#c%f&i&k&l&n,b,g1g1jQ*Z${Q,p&uQ,q&wR3o/_$^%Oi#u#w$c$d$x${%W%X%])q)w)z)|)}*U*[*j*k+V+Y+q+t.T._/P/^/_/a/|0q0t0|2n3f3p3x4O4W4Y4{6P6g6p7]7|8X8l9O9^9f:X:Y:^:_:`:a:b:c:i:j:k:l:m:n:q:r:s:t:w:x;`;h;i;l;mQ+s&SQ0s+uQ4l0rR7R4mT*c$|*dS*c$|*dT4t0z4uS/j*`4rT3|/r7ZQ+Z%pQ/k*aQ0]+[Q1Q,OQ5P1RQ7b5QQ8o7cR9`8pn)z$v(o*v/]/t/u2t3m4S6a6r9S;Q;^;_!Y:i(k)[*Q*Y.[.x.}/T/b0U0p0r2s3n3r4k4m6T6U6h6l6t6v8]8a9g;j;k]:j3Y6[8R9Q9R9pp)|$v(o*v/R/]/t/u2t3m4S6a6r9S;Q;^;_![:k(k)[*Q*Y.[.x.}/T/b0U0p0r2q2s3n3r4k4m6T6U6h6l6t6v8]8a9g;j;k_:l3Y6[8R8S9Q9R9prnOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jQ&]!UR,_&frnOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jR&]!UQ+w&TR0o+psnOXst!V!Z#c%f&`&i&k&l&n,b,g1g1jQ0{+|S4z1O1PU7[4x4y4}S8k7^7_S9[8j8mQ9i9]R9n9jQ&d!VR,W&`R5W1XS%x|%}R0h+gQ&i!WR,b&jR,h&oT1h,g1jR,l&pQ,k&pR1q,lQ'p!zR-h'pSsOtQ#cXT%is#cQ!}TR'r!}Q#QUR't#QQ)s$uR.y)sQ#TVR'v#TQ#WWU'|#W'}-oQ'}#XR-o(OQ,{'PR1},{Q.`(oR2u.`Q.c(qS2x.c2yR2y.dQ-S'VR2R-SY!rQ'V-S0z4uR'a!rS#^W%aU(T#^(U-pQ(U#_R-p(PQ-O'SR2P-Ot`OXst!V!Z#c%f&`&b&i&k&l&n,b,g1g1jS#gZ%^U#q`#g-yR-y(`Q(a#iQ-v(]W.O(a-v2d5zQ2d-wR5z2eQ)e$kR.r)eQ$ohR)k$oQ$bcU)Z$b-k:WQ-k9sR:W)hQ/W*RW3i/W3j6e8[U3j/X/Y/ZS6e3k3lR8[6f#o)x$v(k(o)[*Q*Y*q*r*v.Y.Z.[.x.}/R/S/T/]/b/t/u0U0p0r2q2r2s2t3Y3m3n3r4S4k4m6T6U6Y6Z6[6a6h6l6r6t6v8R8S8T8]8a9Q9R9S9g9p;Q;^;_;j;kQ/`*YU3q/`3s6iQ3s/bR6i3rQ*d$|R/n*dQ*m%QR/w*mQ4X0UR6u4XQ+O%dR0S+OQ4o0uS7T4o8iR8i7UQ+y&UR0x+yQ4u0zR7X4uQ1W,TS5U1W7fR7f5WQ0c+cW4b0c4d6{8eQ4d0fQ6{4cR8e6|Q+h%xR0i+hQ1j,gR5f1jYrOXst#cQ&m!ZQ+Q%fQ,a&iQ,c&kQ,d&lQ,f&nQ1e,bS1h,g1jR5e1gQ%hpQ&q!_Q&t!aQ&v!bQ&x!cQ'h!tQ+P%eQ+]%rQ+o&OQ,V&dQ,n&sW-_'b'j'k'nQ-f'fQ/m*cQ0^+^S1Z,W,ZQ1r,mQ1s,pQ1t,qQ2Y-^W2[-a-b-e-gQ4Z0_Q4g0lQ4j0pQ5O1QQ5Y1]Q5d1fU5s2Z2^2aQ5v2_Q6w4[Q7P4iQ7Q4kQ7W4tQ7a5PQ7g5XS7v5t5xQ7x5wQ8f6}Q8n7bQ8s7hQ8z7wQ9Y8gQ9_8oQ9c8{R9k9`Q%ryQ'Z!iQ'f!tU+^%s%t%uQ,u&|U-Y'[']'^S-^'b'lQ/d*^S0_+_+`Q1z,wS2W-Z-[Q2_-cQ3v/hQ4[0`Q5o2QQ5r2XQ5w2`R6m3zS$wi;`R*n%RU%Qi%R;`R/v*lQ$viS(k#u+YQ(o#wS)[$c$dQ*Q$xQ*Y${Q*q%WQ*r%XQ*v%]Q.Y:^Q.Z:`Q.[:bQ.x)qS.})w/PQ/R)zQ/S)|Q/T)}Q/]*UQ/b*[Q/t*jQ/u*kh0U+V.T0|2n4{6P7]7|8l9O9^9fQ0p+qQ0r+tQ2q:iQ2r:kQ2s:mQ2t._S3Y:X:YQ3m/^Q3n/_Q3r/aQ4S/|Q4k0qQ4m0tQ6T:qQ6U:sQ6Y:_Q6Z:aQ6[:cQ6a3fQ6h3pQ6l3xQ6r4OQ6t4WQ6v4YQ8R:nQ8S:jQ8T:lQ8]6gQ8a6pQ9Q:rQ9R:tQ9S8XQ9g:wQ9p:xQ;Q;`Q;^;hQ;_;iQ;j;lR;k;mnpOXst!Z#c%f&i&k&l&n,b,g1g1jQ!fPS#eZ#nQ&s!`U'_!o4r7ZQ'u#RQ(x#{Q)i$mS,Z&b&eQ,`&fQ,m&rQ,r&zQ-U'XQ.f(vQ.v)jQ0Q*|Q0X+WQ1c,_Q2U-WQ2l.UQ3a.qQ4Q/zQ4y0}Q5[1_Q5]1`Q5a1bQ5c1dQ5h1lQ6O2oQ6_3^Q7_4|Q7k5^Q7l5_Q7n5bQ8O6SQ8m7`R8w7o#WcOPXZst!Z!`!o#c#n#{%f&b&e&f&i&k&l&n&r&z'X(v*|+W,_,b,g-W.U/z0}1_1`1b1d1g1j1l2o4r4|5^5_5b6S7Z7`7oQ#XWQ#dYQ%juQ%kvS%mw!gS'x#V'{Q(O#YQ(j#tQ(q#xQ(y$OQ(z$PQ({$QQ(|$RQ(}$SQ)O$TQ)P$UQ)Q$VQ)R$WQ)S$XQ)T$YQ)V$[Q)Y$aQ)^$eW)h$m)j.q3^Q+T%lQ+i%yS,x'O1{Q-g'iS-l'y-nQ-q(RQ-s(YQ.^(nQ.d(rQ.h9qQ.j9tQ.k9uQ.l9xQ.{)uQ/}*xQ1v,sQ1y,vQ2Z-`Q2b-tQ2v.bQ2{9yQ2|9zQ2}9{Q3O9|Q3P9}Q3Q:OQ3R:PQ3S:QQ3T:RQ3U:SQ3V:TQ3W:UQ3X.iQ3[:ZQ3]:dQ3b:VQ4T0PQ4]0aQ5n:eQ5t2]Q5y2cQ6V2wQ6W:fQ6]:hQ6^:oQ7U4pQ7s5lQ7w5uQ8Q:pQ8U:uQ8V:vQ8{7yQ9Z8hQ9b8yQ9s#RR;V;cR#ZWR'Q!eY!tQ'V-S0z4uS&|!e,zQ'b!rS'l!u!xS'n!y4wS,w&}'US-c'c'dQ-e'eQ2Q-QR2`-dR(p#wR(s#xQ!fQT-R'V-S]!qQ!r'V-S0z4uQ#o]R'`9rT#jZ%^S#iZ%^S%dm,^U(]#g#h#kS-w(^(_Q-{(`Q0R*}Q2e-xU2f-y-z-|S5{2g2hR7z5|`#]W#V#Y%a'y(S*z-rr#fZm#g#h#k%^(^(_(`*}-x-y-z-|2g2h5|Q1a,^Q1w,tQ5j1oQ7r5kT:}'O*{T#`W%aS#_W%aS'z#V(SS(P#Y*zS,y'O*{T-m'y-rT'T!e%bQ$kfR)o$pT)d$k)eR3`.pT*T$x*VR*]${Q0V+VQ2j.TQ4x0|Q6Q2nQ7^4{Q7}6PQ8j7]Q8|7|Q9]8lQ9e9OQ9j9^R9m9fnqOXst!Z#c%f&i&k&l&n,b,g1g1jQ&c!VR,V&`tmOXst!U!V!Z#c%f&`&i&k&l&n,b,g1g1jR,^&fT%em,^R0v+vR,U&^Q%||R+n%}R+d%wT&g!W&jT&h!W&jT1i,g1j\",\n nodeNames: \"⚠ ArithOp ArithOp LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem\",\n maxTerm: 367,\n context: trackNewline,\n nodeProps: [\n [\"group\", -26,7,15,17,63,200,204,208,209,211,214,217,227,229,235,237,239,241,244,250,256,258,260,262,264,266,267,\"Statement\",-32,11,12,26,29,30,36,46,49,50,52,57,65,73,77,79,81,82,104,105,114,115,132,135,137,138,139,140,142,143,163,164,166,\"Expression\",-23,25,27,31,35,37,39,167,169,171,172,174,175,176,178,179,180,182,183,184,194,196,198,199,\"Type\",-3,85,97,103,\"ClassItem\"],\n [\"openedBy\", 32,\"InterpolationStart\",51,\"[\",55,\"{\",70,\"(\",144,\"JSXStartTag\",156,\"JSXStartTag JSXStartCloseTag\"],\n [\"closedBy\", 34,\"InterpolationEnd\",45,\"]\",56,\"}\",71,\")\",145,\"JSXSelfCloseEndTag JSXEndTag\",161,\"JSXEndTag\"]\n ],\n propSources: [jsHighlight],\n skippedNodes: [0,3,4,270],\n repeatNodeCount: 33,\n tokenData: \"$Fl(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Nu!`!a$#a!a!b$(n!b!c$,m!c!}Er!}#O$-w#O#P$/R#P#Q$4j#Q#R$5t#R#SEr#S#T$7R#T#o$8]#o#p$s#r#s$@P#s$f%Z$f$g+g$g#BYEr#BY#BZ$AZ#BZ$ISEr$IS$I_$AZ$I_$I|Er$I|$I}$Df$I}$JO$Df$JO$JTEr$JT$JU$AZ$JU$KVEr$KV$KW$AZ$KW&FUEr&FU&FV$AZ&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$AZ?HUOEr(n%d_$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$e&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$e&j'|!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU'|!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$e&j'ypOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU'ypOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX'yp'|!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z(CS+rq$e&j'yp'|!b'o(;dOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z(CS.ST'z#S$e&j'p(;dO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c(CS.n_$e&j'yp'|!b'p(;dOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#`/x`$e&j!m$Ip'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S1V`#r$Id$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z%#S2d_#r$Id$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$2b3l_'x$(n$e&j'|!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k*r4r_$e&j'|!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k)`5vX$e&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q)`6jT$`#t$e&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c#t6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y#t7bO$`#t#t7eP;=`<%l6y)`7kP;=`<%l5q*r7w]$`#t$e&j'|!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}%W8uZ'|!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p%W9oU$`#t'|!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}%W:UP;=`<%l8p*r:[P;=`<%l4k#%|:hh$e&j'yp'|!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXUS$e&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSUSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWUS'|!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]US$e&j'ypOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWUS'ypOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYUS'yp'|!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%lQ^$e&j!SSOY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@Y!_!}!=y!}#O!Bw#O#P!Dj#P#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!?Ta$e&j!SSO!^&c!_#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&cS!@_X!SSOY!@YZ!P!@Y!P!Q!@z!Q!}!@Y!}#O!Ac#O#P!Bb#P;'S!@Y;'S;=`!Bq<%lO!@YS!APU!SS#Z#[!@z#]#^!@z#a#b!@z#g#h!@z#i#j!@z#m#n!@zS!AfVOY!AcZ#O!Ac#O#P!A{#P#Q!@Y#Q;'S!Ac;'S;=`!B[<%lO!AcS!BOSOY!AcZ;'S!Ac;'S;=`!B[<%lO!AcS!B_P;=`<%l!AcS!BeSOY!@YZ;'S!@Y;'S;=`!Bq<%lO!@YS!BtP;=`<%l!@Y&n!B|[$e&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#O!Bw#O#P!Cr#P#Q!=y#Q#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!CwX$e&jOY!BwYZ&cZ!^!Bw!^!_!Ac!_#o!Bw#o#p!Ac#p;'S!Bw;'S;=`!Dd<%lO!Bw&n!DgP;=`<%l!Bw&n!DoX$e&jOY!=yYZ&cZ!^!=y!^!_!@Y!_#o!=y#o#p!@Y#p;'S!=y;'S;=`!E[<%lO!=y&n!E_P;=`<%l!=y(Q!Eki$e&j'|!b!SSOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#Z&}#Z#[!Eb#[#]&}#]#^!Eb#^#a&}#a#b!Eb#b#g&}#g#h!Eb#h#i&}#i#j!Eb#j#m&}#m#n!Eb#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!f!GaZ'|!b!SSOY!GYZw!GYwx!@Yx!P!GY!P!Q!HS!Q!}!GY!}#O!Ic#O#P!Bb#P;'S!GY;'S;=`!JZ<%lO!GY!f!HZb'|!b!SSOY'}Zw'}x#O'}#P#Z'}#Z#[!HS#[#]'}#]#^!HS#^#a'}#a#b!HS#b#g'}#g#h!HS#h#i'}#i#j!HS#j#m'}#m#n!HS#n;'S'};'S;=`(f<%lO'}!f!IhX'|!bOY!IcZw!Icwx!Acx#O!Ic#O#P!A{#P#Q!GY#Q;'S!Ic;'S;=`!JT<%lO!Ic!f!JWP;=`<%l!Ic!f!J^P;=`<%l!GY(Q!Jh^$e&j'|!bOY!JaYZ&cZw!Jawx!Bwx!^!Ja!^!_!Ic!_#O!Ja#O#P!Cr#P#Q!Q#V#X%Z#X#Y!4|#Y#b%Z#b#c#Zd$e&j'yp'|!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z$/l#?tf$e&j'yp'|!bm$'|OY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c# spec_identifier[value] || -1},{term: 330, get: (value) => spec_word[value] || -1},{term: 68, get: (value) => spec_LessThan[value] || -1}],\n tokenPrec: 12868\n});\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@lezer/javascript/dist/index.js?")},"./node_modules/@lezer/lr/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContextTracker: () => (/* binding */ ContextTracker),\n/* harmony export */ ExternalTokenizer: () => (/* binding */ ExternalTokenizer),\n/* harmony export */ InputStream: () => (/* binding */ InputStream),\n/* harmony export */ LRParser: () => (/* binding */ LRParser),\n/* harmony export */ LocalTokenGroup: () => (/* binding */ LocalTokenGroup),\n/* harmony export */ Stack: () => (/* binding */ Stack)\n/* harmony export */ });\n/* harmony import */ var _lezer_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/common */ "./node_modules/@lezer/common/dist/index.js");\n\n\n/**\nA parse stack. These are used internally by the parser to track\nparsing progress. They also provide some properties and methods\nthat external code such as a tokenizer can use to get information\nabout the parse state.\n*/\nclass Stack {\n /**\n @internal\n */\n constructor(\n /**\n The parse that this stack is part of @internal\n */\n p, \n /**\n Holds state, input pos, buffer index triplets for all but the\n top state @internal\n */\n stack, \n /**\n The current parse state @internal\n */\n state, \n // The position at which the next reduce should take place. This\n // can be less than `this.pos` when skipped expressions have been\n // added to the stack (which should be moved outside of the next\n // reduction)\n /**\n @internal\n */\n reducePos, \n /**\n The input position up to which this stack has parsed.\n */\n pos, \n /**\n The dynamic score of the stack, including dynamic precedence\n and error-recovery penalties\n @internal\n */\n score, \n // The output buffer. Holds (type, start, end, size) quads\n // representing nodes created by the parser, where `size` is\n // amount of buffer array entries covered by this node.\n /**\n @internal\n */\n buffer, \n // The base offset of the buffer. When stacks are split, the split\n // instance shared the buffer history with its parent up to\n // `bufferBase`, which is the absolute offset (including the\n // offset of previous splits) into the buffer at which this stack\n // starts writing.\n /**\n @internal\n */\n bufferBase, \n /**\n @internal\n */\n curContext, \n /**\n @internal\n */\n lookAhead = 0, \n // A parent stack from which this was split off, if any. This is\n // set up so that it always points to a stack that has some\n // additional buffer content, never to a stack with an equal\n // `bufferBase`.\n /**\n @internal\n */\n parent) {\n this.p = p;\n this.stack = stack;\n this.state = state;\n this.reducePos = reducePos;\n this.pos = pos;\n this.score = score;\n this.buffer = buffer;\n this.bufferBase = bufferBase;\n this.curContext = curContext;\n this.lookAhead = lookAhead;\n this.parent = parent;\n }\n /**\n @internal\n */\n toString() {\n return `[${this.stack.filter((_, i) => i % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`;\n }\n // Start an empty stack\n /**\n @internal\n */\n static start(p, state, pos = 0) {\n let cx = p.parser.context;\n return new Stack(p, [], state, pos, pos, 0, [], 0, cx ? new StackContext(cx, cx.start) : null, 0, null);\n }\n /**\n The stack\'s current [context](#lr.ContextTracker) value, if\n any. Its type will depend on the context tracker\'s type\n parameter, or it will be `null` if there is no context\n tracker.\n */\n get context() { return this.curContext ? this.curContext.context : null; }\n // Push a state onto the stack, tracking its start position as well\n // as the buffer base at that point.\n /**\n @internal\n */\n pushState(state, start) {\n this.stack.push(this.state, start, this.bufferBase + this.buffer.length);\n this.state = state;\n }\n // Apply a reduce action\n /**\n @internal\n */\n reduce(action) {\n var _a;\n let depth = action >> 19 /* Action.ReduceDepthShift */, type = action & 65535 /* Action.ValueMask */;\n let { parser } = this.p;\n let dPrec = parser.dynamicPrecedence(type);\n if (dPrec)\n this.score += dPrec;\n if (depth == 0) {\n this.pushState(parser.getGoto(this.state, type, true), this.reducePos);\n // Zero-depth reductions are a special case—they add stuff to\n // the stack without popping anything off.\n if (type < parser.minRepeatTerm)\n this.storeNode(type, this.reducePos, this.reducePos, 4, true);\n this.reduceContext(type, this.reducePos);\n return;\n }\n // Find the base index into `this.stack`, content after which will\n // be dropped. Note that with `StayFlag` reductions we need to\n // consume two extra frames (the dummy parent node for the skipped\n // expression and the state that we\'ll be staying in, which should\n // be moved to `this.state`).\n let base = this.stack.length - ((depth - 1) * 3) - (action & 262144 /* Action.StayFlag */ ? 6 : 0);\n let start = base ? this.stack[base - 2] : this.p.ranges[0].from, size = this.reducePos - start;\n // This is a kludge to try and detect overly deep left-associative\n // trees, which will not increase the parse stack depth and thus\n // won\'t be caught by the regular stack-depth limit check.\n if (size >= 2000 /* Recover.MinBigReduction */ && !((_a = this.p.parser.nodeSet.types[type]) === null || _a === void 0 ? void 0 : _a.isAnonymous)) {\n if (start == this.p.lastBigReductionStart) {\n this.p.bigReductionCount++;\n this.p.lastBigReductionSize = size;\n }\n else if (this.p.lastBigReductionSize < size) {\n this.p.bigReductionCount = 1;\n this.p.lastBigReductionStart = start;\n this.p.lastBigReductionSize = size;\n }\n }\n let bufferBase = base ? this.stack[base - 1] : 0, count = this.bufferBase + this.buffer.length - bufferBase;\n // Store normal terms or `R -> R R` repeat reductions\n if (type < parser.minRepeatTerm || (action & 131072 /* Action.RepeatFlag */)) {\n let pos = parser.stateFlag(this.state, 1 /* StateFlag.Skipped */) ? this.pos : this.reducePos;\n this.storeNode(type, start, pos, count + 4, true);\n }\n if (action & 262144 /* Action.StayFlag */) {\n this.state = this.stack[base];\n }\n else {\n let baseStateID = this.stack[base - 3];\n this.state = parser.getGoto(baseStateID, type, true);\n }\n while (this.stack.length > base)\n this.stack.pop();\n this.reduceContext(type, start);\n }\n // Shift a value into the buffer\n /**\n @internal\n */\n storeNode(term, start, end, size = 4, isReduce = false) {\n if (term == 0 /* Term.Err */ &&\n (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {\n // Try to omit/merge adjacent error nodes\n let cur = this, top = this.buffer.length;\n if (top == 0 && cur.parent) {\n top = cur.bufferBase - cur.parent.bufferBase;\n cur = cur.parent;\n }\n if (top > 0 && cur.buffer[top - 4] == 0 /* Term.Err */ && cur.buffer[top - 1] > -1) {\n if (start == end)\n return;\n if (cur.buffer[top - 2] >= start) {\n cur.buffer[top - 2] = end;\n return;\n }\n }\n }\n if (!isReduce || this.pos == end) { // Simple case, just append\n this.buffer.push(term, start, end, size);\n }\n else { // There may be skipped nodes that have to be moved forward\n let index = this.buffer.length;\n if (index > 0 && this.buffer[index - 4] != 0 /* Term.Err */)\n while (index > 0 && this.buffer[index - 2] > end) {\n // Move this record forward\n this.buffer[index] = this.buffer[index - 4];\n this.buffer[index + 1] = this.buffer[index - 3];\n this.buffer[index + 2] = this.buffer[index - 2];\n this.buffer[index + 3] = this.buffer[index - 1];\n index -= 4;\n if (size > 4)\n size -= 4;\n }\n this.buffer[index] = term;\n this.buffer[index + 1] = start;\n this.buffer[index + 2] = end;\n this.buffer[index + 3] = size;\n }\n }\n // Apply a shift action\n /**\n @internal\n */\n shift(action, type, start, end) {\n if (action & 131072 /* Action.GotoFlag */) {\n this.pushState(action & 65535 /* Action.ValueMask */, this.pos);\n }\n else if ((action & 262144 /* Action.StayFlag */) == 0) { // Regular shift\n let nextState = action, { parser } = this.p;\n if (end > this.pos || type <= parser.maxNode) {\n this.pos = end;\n if (!parser.stateFlag(nextState, 1 /* StateFlag.Skipped */))\n this.reducePos = end;\n }\n this.pushState(nextState, start);\n this.shiftContext(type, start);\n if (type <= parser.maxNode)\n this.buffer.push(type, start, end, 4);\n }\n else { // Shift-and-stay, which means this is a skipped token\n this.pos = end;\n this.shiftContext(type, start);\n if (type <= this.p.parser.maxNode)\n this.buffer.push(type, start, end, 4);\n }\n }\n // Apply an action\n /**\n @internal\n */\n apply(action, next, nextStart, nextEnd) {\n if (action & 65536 /* Action.ReduceFlag */)\n this.reduce(action);\n else\n this.shift(action, next, nextStart, nextEnd);\n }\n // Add a prebuilt (reused) node into the buffer.\n /**\n @internal\n */\n useNode(value, next) {\n let index = this.p.reused.length - 1;\n if (index < 0 || this.p.reused[index] != value) {\n this.p.reused.push(value);\n index++;\n }\n let start = this.pos;\n this.reducePos = this.pos = start + value.length;\n this.pushState(next, start);\n this.buffer.push(index, start, this.reducePos, -1 /* size == -1 means this is a reused value */);\n if (this.curContext)\n this.updateContext(this.curContext.tracker.reuse(this.curContext.context, value, this, this.p.stream.reset(this.pos - value.length)));\n }\n // Split the stack. Due to the buffer sharing and the fact\n // that `this.stack` tends to stay quite shallow, this isn\'t very\n // expensive.\n /**\n @internal\n */\n split() {\n let parent = this;\n let off = parent.buffer.length;\n // Because the top of the buffer (after this.pos) may be mutated\n // to reorder reductions and skipped tokens, and shared buffers\n // should be immutable, this copies any outstanding skipped tokens\n // to the new buffer, and puts the base pointer before them.\n while (off > 0 && parent.buffer[off - 2] > parent.reducePos)\n off -= 4;\n let buffer = parent.buffer.slice(off), base = parent.bufferBase + off;\n // Make sure parent points to an actual parent with content, if there is such a parent.\n while (parent && base == parent.bufferBase)\n parent = parent.parent;\n return new Stack(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, buffer, base, this.curContext, this.lookAhead, parent);\n }\n // Try to recover from an error by \'deleting\' (ignoring) one token.\n /**\n @internal\n */\n recoverByDelete(next, nextEnd) {\n let isNode = next <= this.p.parser.maxNode;\n if (isNode)\n this.storeNode(next, this.pos, nextEnd, 4);\n this.storeNode(0 /* Term.Err */, this.pos, nextEnd, isNode ? 8 : 4);\n this.pos = this.reducePos = nextEnd;\n this.score -= 190 /* Recover.Delete */;\n }\n /**\n Check if the given term would be able to be shifted (optionally\n after some reductions) on this stack. This can be useful for\n external tokenizers that want to make sure they only provide a\n given token when it applies.\n */\n canShift(term) {\n for (let sim = new SimulatedStack(this);;) {\n let action = this.p.parser.stateSlot(sim.state, 4 /* ParseState.DefaultReduce */) || this.p.parser.hasAction(sim.state, term);\n if (action == 0)\n return false;\n if ((action & 65536 /* Action.ReduceFlag */) == 0)\n return true;\n sim.reduce(action);\n }\n }\n // Apply up to Recover.MaxNext recovery actions that conceptually\n // inserts some missing token or rule.\n /**\n @internal\n */\n recoverByInsert(next) {\n if (this.stack.length >= 300 /* Recover.MaxInsertStackDepth */)\n return [];\n let nextStates = this.p.parser.nextStates(this.state);\n if (nextStates.length > 4 /* Recover.MaxNext */ << 1 || this.stack.length >= 120 /* Recover.DampenInsertStackDepth */) {\n let best = [];\n for (let i = 0, s; i < nextStates.length; i += 2) {\n if ((s = nextStates[i + 1]) != this.state && this.p.parser.hasAction(s, next))\n best.push(nextStates[i], s);\n }\n if (this.stack.length < 120 /* Recover.DampenInsertStackDepth */)\n for (let i = 0; best.length < 4 /* Recover.MaxNext */ << 1 && i < nextStates.length; i += 2) {\n let s = nextStates[i + 1];\n if (!best.some((v, i) => (i & 1) && v == s))\n best.push(nextStates[i], s);\n }\n nextStates = best;\n }\n let result = [];\n for (let i = 0; i < nextStates.length && result.length < 4 /* Recover.MaxNext */; i += 2) {\n let s = nextStates[i + 1];\n if (s == this.state)\n continue;\n let stack = this.split();\n stack.pushState(s, this.pos);\n stack.storeNode(0 /* Term.Err */, stack.pos, stack.pos, 4, true);\n stack.shiftContext(nextStates[i], this.pos);\n stack.reducePos = this.pos;\n stack.score -= 200 /* Recover.Insert */;\n result.push(stack);\n }\n return result;\n }\n // Force a reduce, if possible. Return false if that can\'t\n // be done.\n /**\n @internal\n */\n forceReduce() {\n let { parser } = this.p;\n let reduce = parser.stateSlot(this.state, 5 /* ParseState.ForcedReduce */);\n if ((reduce & 65536 /* Action.ReduceFlag */) == 0)\n return false;\n if (!parser.validAction(this.state, reduce)) {\n let depth = reduce >> 19 /* Action.ReduceDepthShift */, term = reduce & 65535 /* Action.ValueMask */;\n let target = this.stack.length - depth * 3;\n if (target < 0 || parser.getGoto(this.stack[target], term, false) < 0) {\n let backup = this.findForcedReduction();\n if (backup == null)\n return false;\n reduce = backup;\n }\n this.storeNode(0 /* Term.Err */, this.pos, this.pos, 4, true);\n this.score -= 100 /* Recover.Reduce */;\n }\n this.reducePos = this.pos;\n this.reduce(reduce);\n return true;\n }\n /**\n Try to scan through the automaton to find some kind of reduction\n that can be applied. Used when the regular ForcedReduce field\n isn\'t a valid action. @internal\n */\n findForcedReduction() {\n let { parser } = this.p, seen = [];\n let explore = (state, depth) => {\n if (seen.includes(state))\n return;\n seen.push(state);\n return parser.allActions(state, (action) => {\n if (action & (262144 /* Action.StayFlag */ | 131072 /* Action.GotoFlag */)) ;\n else if (action & 65536 /* Action.ReduceFlag */) {\n let rDepth = (action >> 19 /* Action.ReduceDepthShift */) - depth;\n if (rDepth > 1) {\n let term = action & 65535 /* Action.ValueMask */, target = this.stack.length - rDepth * 3;\n if (target >= 0 && parser.getGoto(this.stack[target], term, false) >= 0)\n return (rDepth << 19 /* Action.ReduceDepthShift */) | 65536 /* Action.ReduceFlag */ | term;\n }\n }\n else {\n let found = explore(action, depth + 1);\n if (found != null)\n return found;\n }\n });\n };\n return explore(this.state, 0);\n }\n /**\n @internal\n */\n forceAll() {\n while (!this.p.parser.stateFlag(this.state, 2 /* StateFlag.Accepting */)) {\n if (!this.forceReduce()) {\n this.storeNode(0 /* Term.Err */, this.pos, this.pos, 4, true);\n break;\n }\n }\n return this;\n }\n /**\n Check whether this state has no further actions (assumed to be a direct descendant of the\n top state, since any other states must be able to continue\n somehow). @internal\n */\n get deadEnd() {\n if (this.stack.length != 3)\n return false;\n let { parser } = this.p;\n return parser.data[parser.stateSlot(this.state, 1 /* ParseState.Actions */)] == 65535 /* Seq.End */ &&\n !parser.stateSlot(this.state, 4 /* ParseState.DefaultReduce */);\n }\n /**\n Restart the stack (put it back in its start state). Only safe\n when this.stack.length == 3 (state is directly below the top\n state). @internal\n */\n restart() {\n this.storeNode(0 /* Term.Err */, this.pos, this.pos, 4, true);\n this.state = this.stack[0];\n this.stack.length = 0;\n }\n /**\n @internal\n */\n sameState(other) {\n if (this.state != other.state || this.stack.length != other.stack.length)\n return false;\n for (let i = 0; i < this.stack.length; i += 3)\n if (this.stack[i] != other.stack[i])\n return false;\n return true;\n }\n /**\n Get the parser used by this stack.\n */\n get parser() { return this.p.parser; }\n /**\n Test whether a given dialect (by numeric ID, as exported from\n the terms file) is enabled.\n */\n dialectEnabled(dialectID) { return this.p.parser.dialect.flags[dialectID]; }\n shiftContext(term, start) {\n if (this.curContext)\n this.updateContext(this.curContext.tracker.shift(this.curContext.context, term, this, this.p.stream.reset(start)));\n }\n reduceContext(term, start) {\n if (this.curContext)\n this.updateContext(this.curContext.tracker.reduce(this.curContext.context, term, this, this.p.stream.reset(start)));\n }\n /**\n @internal\n */\n emitContext() {\n let last = this.buffer.length - 1;\n if (last < 0 || this.buffer[last] != -3)\n this.buffer.push(this.curContext.hash, this.pos, this.pos, -3);\n }\n /**\n @internal\n */\n emitLookAhead() {\n let last = this.buffer.length - 1;\n if (last < 0 || this.buffer[last] != -4)\n this.buffer.push(this.lookAhead, this.pos, this.pos, -4);\n }\n updateContext(context) {\n if (context != this.curContext.context) {\n let newCx = new StackContext(this.curContext.tracker, context);\n if (newCx.hash != this.curContext.hash)\n this.emitContext();\n this.curContext = newCx;\n }\n }\n /**\n @internal\n */\n setLookAhead(lookAhead) {\n if (lookAhead > this.lookAhead) {\n this.emitLookAhead();\n this.lookAhead = lookAhead;\n }\n }\n /**\n @internal\n */\n close() {\n if (this.curContext && this.curContext.tracker.strict)\n this.emitContext();\n if (this.lookAhead > 0)\n this.emitLookAhead();\n }\n}\nclass StackContext {\n constructor(tracker, context) {\n this.tracker = tracker;\n this.context = context;\n this.hash = tracker.strict ? tracker.hash(context) : 0;\n }\n}\n// Used to cheaply run some reductions to scan ahead without mutating\n// an entire stack\nclass SimulatedStack {\n constructor(start) {\n this.start = start;\n this.state = start.state;\n this.stack = start.stack;\n this.base = this.stack.length;\n }\n reduce(action) {\n let term = action & 65535 /* Action.ValueMask */, depth = action >> 19 /* Action.ReduceDepthShift */;\n if (depth == 0) {\n if (this.stack == this.start.stack)\n this.stack = this.stack.slice();\n this.stack.push(this.state, 0, 0);\n this.base += 3;\n }\n else {\n this.base -= (depth - 1) * 3;\n }\n let goto = this.start.p.parser.getGoto(this.stack[this.base - 3], term, true);\n this.state = goto;\n }\n}\n// This is given to `Tree.build` to build a buffer, and encapsulates\n// the parent-stack-walking necessary to read the nodes.\nclass StackBufferCursor {\n constructor(stack, pos, index) {\n this.stack = stack;\n this.pos = pos;\n this.index = index;\n this.buffer = stack.buffer;\n if (this.index == 0)\n this.maybeNext();\n }\n static create(stack, pos = stack.bufferBase + stack.buffer.length) {\n return new StackBufferCursor(stack, pos, pos - stack.bufferBase);\n }\n maybeNext() {\n let next = this.stack.parent;\n if (next != null) {\n this.index = this.stack.bufferBase - next.bufferBase;\n this.stack = next;\n this.buffer = next.buffer;\n }\n }\n get id() { return this.buffer[this.index - 4]; }\n get start() { return this.buffer[this.index - 3]; }\n get end() { return this.buffer[this.index - 2]; }\n get size() { return this.buffer[this.index - 1]; }\n next() {\n this.index -= 4;\n this.pos -= 4;\n if (this.index == 0)\n this.maybeNext();\n }\n fork() {\n return new StackBufferCursor(this.stack, this.pos, this.index);\n }\n}\n\n// See lezer-generator/src/encode.ts for comments about the encoding\n// used here\nfunction decodeArray(input, Type = Uint16Array) {\n if (typeof input != "string")\n return input;\n let array = null;\n for (let pos = 0, out = 0; pos < input.length;) {\n let value = 0;\n for (;;) {\n let next = input.charCodeAt(pos++), stop = false;\n if (next == 126 /* Encode.BigValCode */) {\n value = 65535 /* Encode.BigVal */;\n break;\n }\n if (next >= 92 /* Encode.Gap2 */)\n next--;\n if (next >= 34 /* Encode.Gap1 */)\n next--;\n let digit = next - 32 /* Encode.Start */;\n if (digit >= 46 /* Encode.Base */) {\n digit -= 46 /* Encode.Base */;\n stop = true;\n }\n value += digit;\n if (stop)\n break;\n value *= 46 /* Encode.Base */;\n }\n if (array)\n array[out++] = value;\n else\n array = new Type(value);\n }\n return array;\n}\n\nclass CachedToken {\n constructor() {\n this.start = -1;\n this.value = -1;\n this.end = -1;\n this.extended = -1;\n this.lookAhead = 0;\n this.mask = 0;\n this.context = 0;\n }\n}\nconst nullToken = new CachedToken;\n/**\n[Tokenizers](#lr.ExternalTokenizer) interact with the input\nthrough this interface. It presents the input as a stream of\ncharacters, tracking lookahead and hiding the complexity of\n[ranges](#common.Parser.parse^ranges) from tokenizer code.\n*/\nclass InputStream {\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n input, \n /**\n @internal\n */\n ranges) {\n this.input = input;\n this.ranges = ranges;\n /**\n @internal\n */\n this.chunk = "";\n /**\n @internal\n */\n this.chunkOff = 0;\n /**\n Backup chunk\n */\n this.chunk2 = "";\n this.chunk2Pos = 0;\n /**\n The character code of the next code unit in the input, or -1\n when the stream is at the end of the input.\n */\n this.next = -1;\n /**\n @internal\n */\n this.token = nullToken;\n this.rangeIndex = 0;\n this.pos = this.chunkPos = ranges[0].from;\n this.range = ranges[0];\n this.end = ranges[ranges.length - 1].to;\n this.readNext();\n }\n /**\n @internal\n */\n resolveOffset(offset, assoc) {\n let range = this.range, index = this.rangeIndex;\n let pos = this.pos + offset;\n while (pos < range.from) {\n if (!index)\n return null;\n let next = this.ranges[--index];\n pos -= range.from - next.to;\n range = next;\n }\n while (assoc < 0 ? pos > range.to : pos >= range.to) {\n if (index == this.ranges.length - 1)\n return null;\n let next = this.ranges[++index];\n pos += next.from - range.to;\n range = next;\n }\n return pos;\n }\n /**\n @internal\n */\n clipPos(pos) {\n if (pos >= this.range.from && pos < this.range.to)\n return pos;\n for (let range of this.ranges)\n if (range.to > pos)\n return Math.max(pos, range.from);\n return this.end;\n }\n /**\n Look at a code unit near the stream position. `.peek(0)` equals\n `.next`, `.peek(-1)` gives you the previous character, and so\n on.\n \n Note that looking around during tokenizing creates dependencies\n on potentially far-away content, which may reduce the\n effectiveness incremental parsing—when looking forward—or even\n cause invalid reparses when looking backward more than 25 code\n units, since the library does not track lookbehind.\n */\n peek(offset) {\n let idx = this.chunkOff + offset, pos, result;\n if (idx >= 0 && idx < this.chunk.length) {\n pos = this.pos + offset;\n result = this.chunk.charCodeAt(idx);\n }\n else {\n let resolved = this.resolveOffset(offset, 1);\n if (resolved == null)\n return -1;\n pos = resolved;\n if (pos >= this.chunk2Pos && pos < this.chunk2Pos + this.chunk2.length) {\n result = this.chunk2.charCodeAt(pos - this.chunk2Pos);\n }\n else {\n let i = this.rangeIndex, range = this.range;\n while (range.to <= pos)\n range = this.ranges[++i];\n this.chunk2 = this.input.chunk(this.chunk2Pos = pos);\n if (pos + this.chunk2.length > range.to)\n this.chunk2 = this.chunk2.slice(0, range.to - pos);\n result = this.chunk2.charCodeAt(0);\n }\n }\n if (pos >= this.token.lookAhead)\n this.token.lookAhead = pos + 1;\n return result;\n }\n /**\n Accept a token. By default, the end of the token is set to the\n current stream position, but you can pass an offset (relative to\n the stream position) to change that.\n */\n acceptToken(token, endOffset = 0) {\n let end = endOffset ? this.resolveOffset(endOffset, -1) : this.pos;\n if (end == null || end < this.token.start)\n throw new RangeError("Token end out of bounds");\n this.token.value = token;\n this.token.end = end;\n }\n getChunk() {\n if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) {\n let { chunk, chunkPos } = this;\n this.chunk = this.chunk2;\n this.chunkPos = this.chunk2Pos;\n this.chunk2 = chunk;\n this.chunk2Pos = chunkPos;\n this.chunkOff = this.pos - this.chunkPos;\n }\n else {\n this.chunk2 = this.chunk;\n this.chunk2Pos = this.chunkPos;\n let nextChunk = this.input.chunk(this.pos);\n let end = this.pos + nextChunk.length;\n this.chunk = end > this.range.to ? nextChunk.slice(0, this.range.to - this.pos) : nextChunk;\n this.chunkPos = this.pos;\n this.chunkOff = 0;\n }\n }\n readNext() {\n if (this.chunkOff >= this.chunk.length) {\n this.getChunk();\n if (this.chunkOff == this.chunk.length)\n return this.next = -1;\n }\n return this.next = this.chunk.charCodeAt(this.chunkOff);\n }\n /**\n Move the stream forward N (defaults to 1) code units. Returns\n the new value of [`next`](#lr.InputStream.next).\n */\n advance(n = 1) {\n this.chunkOff += n;\n while (this.pos + n >= this.range.to) {\n if (this.rangeIndex == this.ranges.length - 1)\n return this.setDone();\n n -= this.range.to - this.pos;\n this.range = this.ranges[++this.rangeIndex];\n this.pos = this.range.from;\n }\n this.pos += n;\n if (this.pos >= this.token.lookAhead)\n this.token.lookAhead = this.pos + 1;\n return this.readNext();\n }\n setDone() {\n this.pos = this.chunkPos = this.end;\n this.range = this.ranges[this.rangeIndex = this.ranges.length - 1];\n this.chunk = "";\n return this.next = -1;\n }\n /**\n @internal\n */\n reset(pos, token) {\n if (token) {\n this.token = token;\n token.start = pos;\n token.lookAhead = pos + 1;\n token.value = token.extended = -1;\n }\n else {\n this.token = nullToken;\n }\n if (this.pos != pos) {\n this.pos = pos;\n if (pos == this.end) {\n this.setDone();\n return this;\n }\n while (pos < this.range.from)\n this.range = this.ranges[--this.rangeIndex];\n while (pos >= this.range.to)\n this.range = this.ranges[++this.rangeIndex];\n if (pos >= this.chunkPos && pos < this.chunkPos + this.chunk.length) {\n this.chunkOff = pos - this.chunkPos;\n }\n else {\n this.chunk = "";\n this.chunkOff = 0;\n }\n this.readNext();\n }\n return this;\n }\n /**\n @internal\n */\n read(from, to) {\n if (from >= this.chunkPos && to <= this.chunkPos + this.chunk.length)\n return this.chunk.slice(from - this.chunkPos, to - this.chunkPos);\n if (from >= this.chunk2Pos && to <= this.chunk2Pos + this.chunk2.length)\n return this.chunk2.slice(from - this.chunk2Pos, to - this.chunk2Pos);\n if (from >= this.range.from && to <= this.range.to)\n return this.input.read(from, to);\n let result = "";\n for (let r of this.ranges) {\n if (r.from >= to)\n break;\n if (r.to > from)\n result += this.input.read(Math.max(r.from, from), Math.min(r.to, to));\n }\n return result;\n }\n}\n/**\n@internal\n*/\nclass TokenGroup {\n constructor(data, id) {\n this.data = data;\n this.id = id;\n }\n token(input, stack) {\n let { parser } = stack.p;\n readToken(this.data, input, stack, this.id, parser.data, parser.tokenPrecTable);\n }\n}\nTokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false;\n/**\n@hide\n*/\nclass LocalTokenGroup {\n constructor(data, precTable, elseToken) {\n this.precTable = precTable;\n this.elseToken = elseToken;\n this.data = typeof data == "string" ? decodeArray(data) : data;\n }\n token(input, stack) {\n let start = input.pos, skipped = 0;\n for (;;) {\n let atEof = input.next < 0, nextPos = input.resolveOffset(1, 1);\n readToken(this.data, input, stack, 0, this.data, this.precTable);\n if (input.token.value > -1)\n break;\n if (this.elseToken == null)\n return;\n if (!atEof)\n skipped++;\n if (nextPos == null)\n break;\n input.reset(nextPos, input.token);\n }\n if (skipped) {\n input.reset(start, input.token);\n input.acceptToken(this.elseToken, skipped);\n }\n }\n}\nLocalTokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false;\n/**\n`@external tokens` declarations in the grammar should resolve to\nan instance of this class.\n*/\nclass ExternalTokenizer {\n /**\n Create a tokenizer. The first argument is the function that,\n given an input stream, scans for the types of tokens it\n recognizes at the stream\'s position, and calls\n [`acceptToken`](#lr.InputStream.acceptToken) when it finds\n one.\n */\n constructor(\n /**\n @internal\n */\n token, options = {}) {\n this.token = token;\n this.contextual = !!options.contextual;\n this.fallback = !!options.fallback;\n this.extend = !!options.extend;\n }\n}\n// Tokenizer data is stored a big uint16 array containing, for each\n// state:\n//\n// - A group bitmask, indicating what token groups are reachable from\n// this state, so that paths that can only lead to tokens not in\n// any of the current groups can be cut off early.\n//\n// - The position of the end of the state\'s sequence of accepting\n// tokens\n//\n// - The number of outgoing edges for the state\n//\n// - The accepting tokens, as (token id, group mask) pairs\n//\n// - The outgoing edges, as (start character, end character, state\n// index) triples, with end character being exclusive\n//\n// This function interprets that data, running through a stream as\n// long as new states with the a matching group mask can be reached,\n// and updating `input.token` when it matches a token.\nfunction readToken(data, input, stack, group, precTable, precOffset) {\n let state = 0, groupMask = 1 << group, { dialect } = stack.p.parser;\n scan: for (;;) {\n if ((groupMask & data[state]) == 0)\n break;\n let accEnd = data[state + 1];\n // Check whether this state can lead to a token in the current group\n // Accept tokens in this state, possibly overwriting\n // lower-precedence / shorter tokens\n for (let i = state + 3; i < accEnd; i += 2)\n if ((data[i + 1] & groupMask) > 0) {\n let term = data[i];\n if (dialect.allows(term) &&\n (input.token.value == -1 || input.token.value == term ||\n overrides(term, input.token.value, precTable, precOffset))) {\n input.acceptToken(term);\n break;\n }\n }\n let next = input.next, low = 0, high = data[state + 2];\n // Special case for EOF\n if (input.next < 0 && high > low && data[accEnd + high * 3 - 3] == 65535 /* Seq.End */) {\n state = data[accEnd + high * 3 - 1];\n continue scan;\n }\n // Do a binary search on the state\'s edges\n for (; low < high;) {\n let mid = (low + high) >> 1;\n let index = accEnd + mid + (mid << 1);\n let from = data[index], to = data[index + 1] || 0x10000;\n if (next < from)\n high = mid;\n else if (next >= to)\n low = mid + 1;\n else {\n state = data[index + 2];\n input.advance();\n continue scan;\n }\n }\n break;\n }\n}\nfunction findOffset(data, start, term) {\n for (let i = start, next; (next = data[i]) != 65535 /* Seq.End */; i++)\n if (next == term)\n return i - start;\n return -1;\n}\nfunction overrides(token, prev, tableData, tableOffset) {\n let iPrev = findOffset(tableData, tableOffset, prev);\n return iPrev < 0 || findOffset(tableData, tableOffset, token) < iPrev;\n}\n\n// Environment variable used to control console output\nconst verbose = typeof process != "undefined" && process.env && /\\bparse\\b/.test(process.env.LOG);\nlet stackIDs = null;\nfunction cutAt(tree, pos, side) {\n let cursor = tree.cursor(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.IterMode.IncludeAnonymous);\n cursor.moveTo(pos);\n for (;;) {\n if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos)))\n for (;;) {\n if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError)\n return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Safety.Margin */))\n : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Safety.Margin */));\n if (side < 0 ? cursor.prevSibling() : cursor.nextSibling())\n break;\n if (!cursor.parent())\n return side < 0 ? 0 : tree.length;\n }\n }\n}\nclass FragmentCursor {\n constructor(fragments, nodeSet) {\n this.fragments = fragments;\n this.nodeSet = nodeSet;\n this.i = 0;\n this.fragment = null;\n this.safeFrom = -1;\n this.safeTo = -1;\n this.trees = [];\n this.start = [];\n this.index = [];\n this.nextFragment();\n }\n nextFragment() {\n let fr = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++];\n if (fr) {\n this.safeFrom = fr.openStart ? cutAt(fr.tree, fr.from + fr.offset, 1) - fr.offset : fr.from;\n this.safeTo = fr.openEnd ? cutAt(fr.tree, fr.to + fr.offset, -1) - fr.offset : fr.to;\n while (this.trees.length) {\n this.trees.pop();\n this.start.pop();\n this.index.pop();\n }\n this.trees.push(fr.tree);\n this.start.push(-fr.offset);\n this.index.push(0);\n this.nextStart = this.safeFrom;\n }\n else {\n this.nextStart = 1e9;\n }\n }\n // `pos` must be >= any previously given `pos` for this cursor\n nodeAt(pos) {\n if (pos < this.nextStart)\n return null;\n while (this.fragment && this.safeTo <= pos)\n this.nextFragment();\n if (!this.fragment)\n return null;\n for (;;) {\n let last = this.trees.length - 1;\n if (last < 0) { // End of tree\n this.nextFragment();\n return null;\n }\n let top = this.trees[last], index = this.index[last];\n if (index == top.children.length) {\n this.trees.pop();\n this.start.pop();\n this.index.pop();\n continue;\n }\n let next = top.children[index];\n let start = this.start[last] + top.positions[index];\n if (start > pos) {\n this.nextStart = start;\n return null;\n }\n if (next instanceof _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree) {\n if (start == pos) {\n if (start < this.safeFrom)\n return null;\n let end = start + next.length;\n if (end <= this.safeTo) {\n let lookAhead = next.prop(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.lookAhead);\n if (!lookAhead || end + lookAhead < this.fragment.to)\n return next;\n }\n }\n this.index[last]++;\n if (start + next.length >= Math.max(this.safeFrom, pos)) { // Enter this node\n this.trees.push(next);\n this.start.push(start);\n this.index.push(0);\n }\n }\n else {\n this.index[last]++;\n this.nextStart = start + next.length;\n }\n }\n }\n}\nclass TokenCache {\n constructor(parser, stream) {\n this.stream = stream;\n this.tokens = [];\n this.mainToken = null;\n this.actions = [];\n this.tokens = parser.tokenizers.map(_ => new CachedToken);\n }\n getActions(stack) {\n let actionIndex = 0;\n let main = null;\n let { parser } = stack.p, { tokenizers } = parser;\n let mask = parser.stateSlot(stack.state, 3 /* ParseState.TokenizerMask */);\n let context = stack.curContext ? stack.curContext.hash : 0;\n let lookAhead = 0;\n for (let i = 0; i < tokenizers.length; i++) {\n if (((1 << i) & mask) == 0)\n continue;\n let tokenizer = tokenizers[i], token = this.tokens[i];\n if (main && !tokenizer.fallback)\n continue;\n if (tokenizer.contextual || token.start != stack.pos || token.mask != mask || token.context != context) {\n this.updateCachedToken(token, tokenizer, stack);\n token.mask = mask;\n token.context = context;\n }\n if (token.lookAhead > token.end + 25 /* Safety.Margin */)\n lookAhead = Math.max(token.lookAhead, lookAhead);\n if (token.value != 0 /* Term.Err */) {\n let startIndex = actionIndex;\n if (token.extended > -1)\n actionIndex = this.addActions(stack, token.extended, token.end, actionIndex);\n actionIndex = this.addActions(stack, token.value, token.end, actionIndex);\n if (!tokenizer.extend) {\n main = token;\n if (actionIndex > startIndex)\n break;\n }\n }\n }\n while (this.actions.length > actionIndex)\n this.actions.pop();\n if (lookAhead)\n stack.setLookAhead(lookAhead);\n if (!main && stack.pos == this.stream.end) {\n main = new CachedToken;\n main.value = stack.p.parser.eofTerm;\n main.start = main.end = stack.pos;\n actionIndex = this.addActions(stack, main.value, main.end, actionIndex);\n }\n this.mainToken = main;\n return this.actions;\n }\n getMainToken(stack) {\n if (this.mainToken)\n return this.mainToken;\n let main = new CachedToken, { pos, p } = stack;\n main.start = pos;\n main.end = Math.min(pos + 1, p.stream.end);\n main.value = pos == p.stream.end ? p.parser.eofTerm : 0 /* Term.Err */;\n return main;\n }\n updateCachedToken(token, tokenizer, stack) {\n let start = this.stream.clipPos(stack.pos);\n tokenizer.token(this.stream.reset(start, token), stack);\n if (token.value > -1) {\n let { parser } = stack.p;\n for (let i = 0; i < parser.specialized.length; i++)\n if (parser.specialized[i] == token.value) {\n let result = parser.specializers[i](this.stream.read(token.start, token.end), stack);\n if (result >= 0 && stack.p.parser.dialect.allows(result >> 1)) {\n if ((result & 1) == 0 /* Specialize.Specialize */)\n token.value = result >> 1;\n else\n token.extended = result >> 1;\n break;\n }\n }\n }\n else {\n token.value = 0 /* Term.Err */;\n token.end = this.stream.clipPos(start + 1);\n }\n }\n putAction(action, token, end, index) {\n // Don\'t add duplicate actions\n for (let i = 0; i < index; i += 3)\n if (this.actions[i] == action)\n return index;\n this.actions[index++] = action;\n this.actions[index++] = token;\n this.actions[index++] = end;\n return index;\n }\n addActions(stack, token, end, index) {\n let { state } = stack, { parser } = stack.p, { data } = parser;\n for (let set = 0; set < 2; set++) {\n for (let i = parser.stateSlot(state, set ? 2 /* ParseState.Skip */ : 1 /* ParseState.Actions */);; i += 3) {\n if (data[i] == 65535 /* Seq.End */) {\n if (data[i + 1] == 1 /* Seq.Next */) {\n i = pair(data, i + 2);\n }\n else {\n if (index == 0 && data[i + 1] == 2 /* Seq.Other */)\n index = this.putAction(pair(data, i + 2), token, end, index);\n break;\n }\n }\n if (data[i] == token)\n index = this.putAction(pair(data, i + 1), token, end, index);\n }\n }\n return index;\n }\n}\nclass Parse {\n constructor(parser, input, fragments, ranges) {\n this.parser = parser;\n this.input = input;\n this.ranges = ranges;\n this.recovering = 0;\n this.nextStackID = 0x2654; // ♔, ♕, ♖, ♗, ♘, ♙, ♠, ♡, ♢, ♣, ♤, ♥, ♦, ♧\n this.minStackPos = 0;\n this.reused = [];\n this.stoppedAt = null;\n this.lastBigReductionStart = -1;\n this.lastBigReductionSize = 0;\n this.bigReductionCount = 0;\n this.stream = new InputStream(input, ranges);\n this.tokens = new TokenCache(parser, this.stream);\n this.topTerm = parser.top[1];\n let { from } = ranges[0];\n this.stacks = [Stack.start(this, parser.top[0], from)];\n this.fragments = fragments.length && this.stream.end - from > parser.bufferLength * 4\n ? new FragmentCursor(fragments, parser.nodeSet) : null;\n }\n get parsedPos() {\n return this.minStackPos;\n }\n // Move the parser forward. This will process all parse stacks at\n // `this.pos` and try to advance them to a further position. If no\n // stack for such a position is found, it\'ll start error-recovery.\n //\n // When the parse is finished, this will return a syntax tree. When\n // not, it returns `null`.\n advance() {\n let stacks = this.stacks, pos = this.minStackPos;\n // This will hold stacks beyond `pos`.\n let newStacks = this.stacks = [];\n let stopped, stoppedTokens;\n // If a large amount of reductions happened with the same start\n // position, force the stack out of that production in order to\n // avoid creating a tree too deep to recurse through.\n // (This is an ugly kludge, because unfortunately there is no\n // straightforward, cheap way to check for this happening, due to\n // the history of reductions only being available in an\n // expensive-to-access format in the stack buffers.)\n if (this.bigReductionCount > 300 /* Rec.MaxLeftAssociativeReductionCount */ && stacks.length == 1) {\n let [s] = stacks;\n while (s.forceReduce() && s.stack.length && s.stack[s.stack.length - 2] >= this.lastBigReductionStart) { }\n this.bigReductionCount = this.lastBigReductionSize = 0;\n }\n // Keep advancing any stacks at `pos` until they either move\n // forward or can\'t be advanced. Gather stacks that can\'t be\n // advanced further in `stopped`.\n for (let i = 0; i < stacks.length; i++) {\n let stack = stacks[i];\n for (;;) {\n this.tokens.mainToken = null;\n if (stack.pos > pos) {\n newStacks.push(stack);\n }\n else if (this.advanceStack(stack, newStacks, stacks)) {\n continue;\n }\n else {\n if (!stopped) {\n stopped = [];\n stoppedTokens = [];\n }\n stopped.push(stack);\n let tok = this.tokens.getMainToken(stack);\n stoppedTokens.push(tok.value, tok.end);\n }\n break;\n }\n }\n if (!newStacks.length) {\n let finished = stopped && findFinished(stopped);\n if (finished) {\n if (verbose)\n console.log("Finish with " + this.stackID(finished));\n return this.stackToTree(finished);\n }\n if (this.parser.strict) {\n if (verbose && stopped)\n console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none"));\n throw new SyntaxError("No parse at " + pos);\n }\n if (!this.recovering)\n this.recovering = 5 /* Rec.Distance */;\n }\n if (this.recovering && stopped) {\n let finished = this.stoppedAt != null && stopped[0].pos > this.stoppedAt ? stopped[0]\n : this.runRecovery(stopped, stoppedTokens, newStacks);\n if (finished) {\n if (verbose)\n console.log("Force-finish " + this.stackID(finished));\n return this.stackToTree(finished.forceAll());\n }\n }\n if (this.recovering) {\n let maxRemaining = this.recovering == 1 ? 1 : this.recovering * 3 /* Rec.MaxRemainingPerStep */;\n if (newStacks.length > maxRemaining) {\n newStacks.sort((a, b) => b.score - a.score);\n while (newStacks.length > maxRemaining)\n newStacks.pop();\n }\n if (newStacks.some(s => s.reducePos > pos))\n this.recovering--;\n }\n else if (newStacks.length > 1) {\n // Prune stacks that are in the same state, or that have been\n // running without splitting for a while, to avoid getting stuck\n // with multiple successful stacks running endlessly on.\n outer: for (let i = 0; i < newStacks.length - 1; i++) {\n let stack = newStacks[i];\n for (let j = i + 1; j < newStacks.length; j++) {\n let other = newStacks[j];\n if (stack.sameState(other) ||\n stack.buffer.length > 500 /* Rec.MinBufferLengthPrune */ && other.buffer.length > 500 /* Rec.MinBufferLengthPrune */) {\n if (((stack.score - other.score) || (stack.buffer.length - other.buffer.length)) > 0) {\n newStacks.splice(j--, 1);\n }\n else {\n newStacks.splice(i--, 1);\n continue outer;\n }\n }\n }\n }\n if (newStacks.length > 12 /* Rec.MaxStackCount */)\n newStacks.splice(12 /* Rec.MaxStackCount */, newStacks.length - 12 /* Rec.MaxStackCount */);\n }\n this.minStackPos = newStacks[0].pos;\n for (let i = 1; i < newStacks.length; i++)\n if (newStacks[i].pos < this.minStackPos)\n this.minStackPos = newStacks[i].pos;\n return null;\n }\n stopAt(pos) {\n if (this.stoppedAt != null && this.stoppedAt < pos)\n throw new RangeError("Can\'t move stoppedAt forward");\n this.stoppedAt = pos;\n }\n // Returns an updated version of the given stack, or null if the\n // stack can\'t advance normally. When `split` and `stacks` are\n // given, stacks split off by ambiguous operations will be pushed to\n // `split`, or added to `stacks` if they move `pos` forward.\n advanceStack(stack, stacks, split) {\n let start = stack.pos, { parser } = this;\n let base = verbose ? this.stackID(stack) + " -> " : "";\n if (this.stoppedAt != null && start > this.stoppedAt)\n return stack.forceReduce() ? stack : null;\n if (this.fragments) {\n let strictCx = stack.curContext && stack.curContext.tracker.strict, cxHash = strictCx ? stack.curContext.hash : 0;\n for (let cached = this.fragments.nodeAt(start); cached;) {\n let match = this.parser.nodeSet.types[cached.type.id] == cached.type ? parser.getGoto(stack.state, cached.type.id) : -1;\n if (match > -1 && cached.length && (!strictCx || (cached.prop(_lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp.contextHash) || 0) == cxHash)) {\n stack.useNode(cached, match);\n if (verbose)\n console.log(base + this.stackID(stack) + ` (via reuse of ${parser.getName(cached.type.id)})`);\n return true;\n }\n if (!(cached instanceof _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree) || cached.children.length == 0 || cached.positions[0] > 0)\n break;\n let inner = cached.children[0];\n if (inner instanceof _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree && cached.positions[0] == 0)\n cached = inner;\n else\n break;\n }\n }\n let defaultReduce = parser.stateSlot(stack.state, 4 /* ParseState.DefaultReduce */);\n if (defaultReduce > 0) {\n stack.reduce(defaultReduce);\n if (verbose)\n console.log(base + this.stackID(stack) + ` (via always-reduce ${parser.getName(defaultReduce & 65535 /* Action.ValueMask */)})`);\n return true;\n }\n if (stack.stack.length >= 8400 /* Rec.CutDepth */) {\n while (stack.stack.length > 6000 /* Rec.CutTo */ && stack.forceReduce()) { }\n }\n let actions = this.tokens.getActions(stack);\n for (let i = 0; i < actions.length;) {\n let action = actions[i++], term = actions[i++], end = actions[i++];\n let last = i == actions.length || !split;\n let localStack = last ? stack : stack.split();\n let main = this.tokens.mainToken;\n localStack.apply(action, term, main ? main.start : localStack.pos, end);\n if (verbose)\n console.log(base + this.stackID(localStack) + ` (via ${(action & 65536 /* Action.ReduceFlag */) == 0 ? "shift"\n : `reduce of ${parser.getName(action & 65535 /* Action.ValueMask */)}`} for ${parser.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`);\n if (last)\n return true;\n else if (localStack.pos > start)\n stacks.push(localStack);\n else\n split.push(localStack);\n }\n return false;\n }\n // Advance a given stack forward as far as it will go. Returns the\n // (possibly updated) stack if it got stuck, or null if it moved\n // forward and was given to `pushStackDedup`.\n advanceFully(stack, newStacks) {\n let pos = stack.pos;\n for (;;) {\n if (!this.advanceStack(stack, null, null))\n return false;\n if (stack.pos > pos) {\n pushStackDedup(stack, newStacks);\n return true;\n }\n }\n }\n runRecovery(stacks, tokens, newStacks) {\n let finished = null, restarted = false;\n for (let i = 0; i < stacks.length; i++) {\n let stack = stacks[i], token = tokens[i << 1], tokenEnd = tokens[(i << 1) + 1];\n let base = verbose ? this.stackID(stack) + " -> " : "";\n if (stack.deadEnd) {\n if (restarted)\n continue;\n restarted = true;\n stack.restart();\n if (verbose)\n console.log(base + this.stackID(stack) + " (restarted)");\n let done = this.advanceFully(stack, newStacks);\n if (done)\n continue;\n }\n let force = stack.split(), forceBase = base;\n for (let j = 0; force.forceReduce() && j < 10 /* Rec.ForceReduceLimit */; j++) {\n if (verbose)\n console.log(forceBase + this.stackID(force) + " (via force-reduce)");\n let done = this.advanceFully(force, newStacks);\n if (done)\n break;\n if (verbose)\n forceBase = this.stackID(force) + " -> ";\n }\n for (let insert of stack.recoverByInsert(token)) {\n if (verbose)\n console.log(base + this.stackID(insert) + " (via recover-insert)");\n this.advanceFully(insert, newStacks);\n }\n if (this.stream.end > stack.pos) {\n if (tokenEnd == stack.pos) {\n tokenEnd++;\n token = 0 /* Term.Err */;\n }\n stack.recoverByDelete(token, tokenEnd);\n if (verbose)\n console.log(base + this.stackID(stack) + ` (via recover-delete ${this.parser.getName(token)})`);\n pushStackDedup(stack, newStacks);\n }\n else if (!finished || finished.score < stack.score) {\n finished = stack;\n }\n }\n return finished;\n }\n // Convert the stack\'s buffer to a syntax tree.\n stackToTree(stack) {\n stack.close();\n return _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Tree.build({ buffer: StackBufferCursor.create(stack),\n nodeSet: this.parser.nodeSet,\n topID: this.topTerm,\n maxBufferLength: this.parser.bufferLength,\n reused: this.reused,\n start: this.ranges[0].from,\n length: stack.pos - this.ranges[0].from,\n minRepeatType: this.parser.minRepeatTerm });\n }\n stackID(stack) {\n let id = (stackIDs || (stackIDs = new WeakMap)).get(stack);\n if (!id)\n stackIDs.set(stack, id = String.fromCodePoint(this.nextStackID++));\n return id + stack;\n }\n}\nfunction pushStackDedup(stack, newStacks) {\n for (let i = 0; i < newStacks.length; i++) {\n let other = newStacks[i];\n if (other.pos == stack.pos && other.sameState(stack)) {\n if (newStacks[i].score < stack.score)\n newStacks[i] = stack;\n return;\n }\n }\n newStacks.push(stack);\n}\nclass Dialect {\n constructor(source, flags, disabled) {\n this.source = source;\n this.flags = flags;\n this.disabled = disabled;\n }\n allows(term) { return !this.disabled || this.disabled[term] == 0; }\n}\nconst id = x => x;\n/**\nContext trackers are used to track stateful context (such as\nindentation in the Python grammar, or parent elements in the XML\ngrammar) needed by external tokenizers. You declare them in a\ngrammar file as `@context exportName from "module"`.\n\nContext values should be immutable, and can be updated (replaced)\non shift or reduce actions.\n\nThe export used in a `@context` declaration should be of this\ntype.\n*/\nclass ContextTracker {\n /**\n Define a context tracker.\n */\n constructor(spec) {\n this.start = spec.start;\n this.shift = spec.shift || id;\n this.reduce = spec.reduce || id;\n this.reuse = spec.reuse || id;\n this.hash = spec.hash || (() => 0);\n this.strict = spec.strict !== false;\n }\n}\n/**\nHolds the parse tables for a given grammar, as generated by\n`lezer-generator`, and provides [methods](#common.Parser) to parse\ncontent with.\n*/\nclass LRParser extends _lezer_common__WEBPACK_IMPORTED_MODULE_0__.Parser {\n /**\n @internal\n */\n constructor(spec) {\n super();\n /**\n @internal\n */\n this.wrappers = [];\n if (spec.version != 14 /* File.Version */)\n throw new RangeError(`Parser version (${spec.version}) doesn\'t match runtime version (${14 /* File.Version */})`);\n let nodeNames = spec.nodeNames.split(" ");\n this.minRepeatTerm = nodeNames.length;\n for (let i = 0; i < spec.repeatNodeCount; i++)\n nodeNames.push("");\n let topTerms = Object.keys(spec.topRules).map(r => spec.topRules[r][1]);\n let nodeProps = [];\n for (let i = 0; i < nodeNames.length; i++)\n nodeProps.push([]);\n function setProp(nodeID, prop, value) {\n nodeProps[nodeID].push([prop, prop.deserialize(String(value))]);\n }\n if (spec.nodeProps)\n for (let propSpec of spec.nodeProps) {\n let prop = propSpec[0];\n if (typeof prop == "string")\n prop = _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeProp[prop];\n for (let i = 1; i < propSpec.length;) {\n let next = propSpec[i++];\n if (next >= 0) {\n setProp(next, prop, propSpec[i++]);\n }\n else {\n let value = propSpec[i + -next];\n for (let j = -next; j > 0; j--)\n setProp(propSpec[i++], prop, value);\n i++;\n }\n }\n }\n this.nodeSet = new _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeSet(nodeNames.map((name, i) => _lezer_common__WEBPACK_IMPORTED_MODULE_0__.NodeType.define({\n name: i >= this.minRepeatTerm ? undefined : name,\n id: i,\n props: nodeProps[i],\n top: topTerms.indexOf(i) > -1,\n error: i == 0,\n skipped: spec.skippedNodes && spec.skippedNodes.indexOf(i) > -1\n })));\n if (spec.propSources)\n this.nodeSet = this.nodeSet.extend(...spec.propSources);\n this.strict = false;\n this.bufferLength = _lezer_common__WEBPACK_IMPORTED_MODULE_0__.DefaultBufferLength;\n let tokenArray = decodeArray(spec.tokenData);\n this.context = spec.context;\n this.specializerSpecs = spec.specialized || [];\n this.specialized = new Uint16Array(this.specializerSpecs.length);\n for (let i = 0; i < this.specializerSpecs.length; i++)\n this.specialized[i] = this.specializerSpecs[i].term;\n this.specializers = this.specializerSpecs.map(getSpecializer);\n this.states = decodeArray(spec.states, Uint32Array);\n this.data = decodeArray(spec.stateData);\n this.goto = decodeArray(spec.goto);\n this.maxTerm = spec.maxTerm;\n this.tokenizers = spec.tokenizers.map(value => typeof value == "number" ? new TokenGroup(tokenArray, value) : value);\n this.topRules = spec.topRules;\n this.dialects = spec.dialects || {};\n this.dynamicPrecedences = spec.dynamicPrecedences || null;\n this.tokenPrecTable = spec.tokenPrec;\n this.termNames = spec.termNames || null;\n this.maxNode = this.nodeSet.types.length - 1;\n this.dialect = this.parseDialect();\n this.top = this.topRules[Object.keys(this.topRules)[0]];\n }\n createParse(input, fragments, ranges) {\n let parse = new Parse(this, input, fragments, ranges);\n for (let w of this.wrappers)\n parse = w(parse, input, fragments, ranges);\n return parse;\n }\n /**\n Get a goto table entry @internal\n */\n getGoto(state, term, loose = false) {\n let table = this.goto;\n if (term >= table[0])\n return -1;\n for (let pos = table[term + 1];;) {\n let groupTag = table[pos++], last = groupTag & 1;\n let target = table[pos++];\n if (last && loose)\n return target;\n for (let end = pos + (groupTag >> 1); pos < end; pos++)\n if (table[pos] == state)\n return target;\n if (last)\n return -1;\n }\n }\n /**\n Check if this state has an action for a given terminal @internal\n */\n hasAction(state, terminal) {\n let data = this.data;\n for (let set = 0; set < 2; set++) {\n for (let i = this.stateSlot(state, set ? 2 /* ParseState.Skip */ : 1 /* ParseState.Actions */), next;; i += 3) {\n if ((next = data[i]) == 65535 /* Seq.End */) {\n if (data[i + 1] == 1 /* Seq.Next */)\n next = data[i = pair(data, i + 2)];\n else if (data[i + 1] == 2 /* Seq.Other */)\n return pair(data, i + 2);\n else\n break;\n }\n if (next == terminal || next == 0 /* Term.Err */)\n return pair(data, i + 1);\n }\n }\n return 0;\n }\n /**\n @internal\n */\n stateSlot(state, slot) {\n return this.states[(state * 6 /* ParseState.Size */) + slot];\n }\n /**\n @internal\n */\n stateFlag(state, flag) {\n return (this.stateSlot(state, 0 /* ParseState.Flags */) & flag) > 0;\n }\n /**\n @internal\n */\n validAction(state, action) {\n return !!this.allActions(state, a => a == action ? true : null);\n }\n /**\n @internal\n */\n allActions(state, action) {\n let deflt = this.stateSlot(state, 4 /* ParseState.DefaultReduce */);\n let result = deflt ? action(deflt) : undefined;\n for (let i = this.stateSlot(state, 1 /* ParseState.Actions */); result == null; i += 3) {\n if (this.data[i] == 65535 /* Seq.End */) {\n if (this.data[i + 1] == 1 /* Seq.Next */)\n i = pair(this.data, i + 2);\n else\n break;\n }\n result = action(pair(this.data, i + 1));\n }\n return result;\n }\n /**\n Get the states that can follow this one through shift actions or\n goto jumps. @internal\n */\n nextStates(state) {\n let result = [];\n for (let i = this.stateSlot(state, 1 /* ParseState.Actions */);; i += 3) {\n if (this.data[i] == 65535 /* Seq.End */) {\n if (this.data[i + 1] == 1 /* Seq.Next */)\n i = pair(this.data, i + 2);\n else\n break;\n }\n if ((this.data[i + 2] & (65536 /* Action.ReduceFlag */ >> 16)) == 0) {\n let value = this.data[i + 1];\n if (!result.some((v, i) => (i & 1) && v == value))\n result.push(this.data[i], value);\n }\n }\n return result;\n }\n /**\n Configure the parser. Returns a new parser instance that has the\n given settings modified. Settings not provided in `config` are\n kept from the original parser.\n */\n configure(config) {\n // Hideous reflection-based kludge to make it easy to create a\n // slightly modified copy of a parser.\n let copy = Object.assign(Object.create(LRParser.prototype), this);\n if (config.props)\n copy.nodeSet = this.nodeSet.extend(...config.props);\n if (config.top) {\n let info = this.topRules[config.top];\n if (!info)\n throw new RangeError(`Invalid top rule name ${config.top}`);\n copy.top = info;\n }\n if (config.tokenizers)\n copy.tokenizers = this.tokenizers.map(t => {\n let found = config.tokenizers.find(r => r.from == t);\n return found ? found.to : t;\n });\n if (config.specializers) {\n copy.specializers = this.specializers.slice();\n copy.specializerSpecs = this.specializerSpecs.map((s, i) => {\n let found = config.specializers.find(r => r.from == s.external);\n if (!found)\n return s;\n let spec = Object.assign(Object.assign({}, s), { external: found.to });\n copy.specializers[i] = getSpecializer(spec);\n return spec;\n });\n }\n if (config.contextTracker)\n copy.context = config.contextTracker;\n if (config.dialect)\n copy.dialect = this.parseDialect(config.dialect);\n if (config.strict != null)\n copy.strict = config.strict;\n if (config.wrap)\n copy.wrappers = copy.wrappers.concat(config.wrap);\n if (config.bufferLength != null)\n copy.bufferLength = config.bufferLength;\n return copy;\n }\n /**\n Tells you whether any [parse wrappers](#lr.ParserConfig.wrap)\n are registered for this parser.\n */\n hasWrappers() {\n return this.wrappers.length > 0;\n }\n /**\n Returns the name associated with a given term. This will only\n work for all terms when the parser was generated with the\n `--names` option. By default, only the names of tagged terms are\n stored.\n */\n getName(term) {\n return this.termNames ? this.termNames[term] : String(term <= this.maxNode && this.nodeSet.types[term].name || term);\n }\n /**\n The eof term id is always allocated directly after the node\n types. @internal\n */\n get eofTerm() { return this.maxNode + 1; }\n /**\n The type of top node produced by the parser.\n */\n get topNode() { return this.nodeSet.types[this.top[1]]; }\n /**\n @internal\n */\n dynamicPrecedence(term) {\n let prec = this.dynamicPrecedences;\n return prec == null ? 0 : prec[term] || 0;\n }\n /**\n @internal\n */\n parseDialect(dialect) {\n let values = Object.keys(this.dialects), flags = values.map(() => false);\n if (dialect)\n for (let part of dialect.split(" ")) {\n let id = values.indexOf(part);\n if (id >= 0)\n flags[id] = true;\n }\n let disabled = null;\n for (let i = 0; i < values.length; i++)\n if (!flags[i]) {\n for (let j = this.dialects[values[i]], id; (id = this.data[j++]) != 65535 /* Seq.End */;)\n (disabled || (disabled = new Uint8Array(this.maxTerm + 1)))[id] = 1;\n }\n return new Dialect(dialect, flags, disabled);\n }\n /**\n Used by the output of the parser generator. Not available to\n user code. @hide\n */\n static deserialize(spec) {\n return new LRParser(spec);\n }\n}\nfunction pair(data, off) { return data[off] | (data[off + 1] << 16); }\nfunction findFinished(stacks) {\n let best = null;\n for (let stack of stacks) {\n let stopped = stack.p.stoppedAt;\n if ((stack.pos == stack.p.stream.end || stopped != null && stack.pos > stopped) &&\n stack.p.parser.stateFlag(stack.state, 2 /* StateFlag.Accepting */) &&\n (!best || best.score < stack.score))\n best = stack;\n }\n return best;\n}\nfunction getSpecializer(spec) {\n if (spec.external) {\n let mask = spec.extend ? 1 /* Specialize.Extend */ : 0 /* Specialize.Specialize */;\n return (value, stack) => (spec.external(value, stack) << 1) | mask;\n }\n return spec.get;\n}\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@lezer/lr/dist/index.js?')},"./node_modules/@lezer/python/dist/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ parser: () => (/* binding */ parser)\n/* harmony export */ });\n/* harmony import */ var _lezer_lr__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lezer/lr */ \"./node_modules/@lezer/lr/dist/index.js\");\n/* harmony import */ var _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @lezer/highlight */ \"./node_modules/@lezer/highlight/dist/index.js\");\n\n\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst printKeyword = 1,\n indent = 201,\n dedent = 202,\n newline$1 = 203,\n blankLineStart = 204,\n newlineBracketed = 205,\n eof = 206,\n formatString1Content = 207,\n formatString1Brace = 2,\n formatString1End = 208,\n formatString2Content = 209,\n formatString2Brace = 3,\n formatString2End = 210,\n formatString1lContent = 211,\n formatString1lBrace = 4,\n formatString1lEnd = 212,\n formatString2lContent = 213,\n formatString2lBrace = 5,\n formatString2lEnd = 214,\n ParenL = 26,\n ParenthesizedExpression = 27,\n TupleExpression = 51,\n ComprehensionExpression = 52,\n BracketL = 57,\n ArrayExpression = 58,\n ArrayComprehensionExpression = 59,\n BraceL = 61,\n DictionaryExpression = 62,\n DictionaryComprehensionExpression = 63,\n SetExpression = 64,\n SetComprehensionExpression = 65,\n ArgList = 67,\n subscript = 251,\n FormatString = 74,\n importList = 270,\n TypeParamList = 115,\n ParamList = 133,\n SequencePattern = 154,\n MappingPattern = 155,\n PatternArgList = 158;\n\nconst newline = 10, carriageReturn = 13, space = 32, tab = 9, hash = 35, parenOpen = 40, dot = 46,\n braceOpen = 123, singleQuote = 39, doubleQuote = 34, backslash = 92;\n\nconst bracketed = new Set([\n ParenthesizedExpression, TupleExpression, ComprehensionExpression, importList, ArgList, ParamList,\n ArrayExpression, ArrayComprehensionExpression, subscript,\n SetExpression, SetComprehensionExpression, FormatString,\n DictionaryExpression, DictionaryComprehensionExpression,\n SequencePattern, MappingPattern, PatternArgList, TypeParamList\n]);\n\nfunction isLineBreak(ch) {\n return ch == newline || ch == carriageReturn\n}\n\nconst newlines = new _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.ExternalTokenizer((input, stack) => {\n let prev;\n if (input.next < 0) {\n input.acceptToken(eof);\n } else if (stack.context.depth < 0) {\n if (isLineBreak(input.next)) input.acceptToken(newlineBracketed, 1);\n } else if (((prev = input.peek(-1)) < 0 || isLineBreak(prev)) &&\n stack.canShift(blankLineStart)) {\n let spaces = 0;\n while (input.next == space || input.next == tab) { input.advance(); spaces++; }\n if (input.next == newline || input.next == carriageReturn || input.next == hash)\n input.acceptToken(blankLineStart, -spaces);\n } else if (isLineBreak(input.next)) {\n input.acceptToken(newline$1, 1);\n }\n}, {contextual: true});\n\nconst indentation = new _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.ExternalTokenizer((input, stack) => {\n let cDepth = stack.context.depth;\n if (cDepth < 0) return\n let prev = input.peek(-1);\n if (prev == newline || prev == carriageReturn) {\n let depth = 0, chars = 0;\n for (;;) {\n if (input.next == space) depth++;\n else if (input.next == tab) depth += 8 - (depth % 8);\n else break\n input.advance();\n chars++;\n }\n if (depth != cDepth &&\n input.next != newline && input.next != carriageReturn && input.next != hash) {\n if (depth < cDepth) input.acceptToken(dedent, -chars);\n else input.acceptToken(indent);\n }\n }\n});\n\nfunction IndentLevel(parent, depth) {\n this.parent = parent;\n // -1 means this is not an actual indent level but a set of brackets\n this.depth = depth;\n this.hash = (parent ? parent.hash + parent.hash << 8 : 0) + depth + (depth << 4);\n}\n\nconst topIndent = new IndentLevel(null, 0);\n\nfunction countIndent(space) {\n let depth = 0;\n for (let i = 0; i < space.length; i++)\n depth += space.charCodeAt(i) == tab ? 8 - (depth % 8) : 1;\n return depth\n}\n\nconst trackIndent = new _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.ContextTracker({\n start: topIndent,\n reduce(context, term) {\n return context.depth < 0 && bracketed.has(term) ? context.parent : context\n },\n shift(context, term, stack, input) {\n if (term == indent) return new IndentLevel(context, countIndent(input.read(input.pos, stack.pos)))\n if (term == dedent) return context.parent\n if (term == ParenL || term == BracketL || term == BraceL) return new IndentLevel(context, -1)\n return context\n },\n hash(context) { return context.hash }\n});\n\nconst legacyPrint = new _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.ExternalTokenizer(input => {\n for (let i = 0; i < 5; i++) {\n if (input.next != \"print\".charCodeAt(i)) return\n input.advance();\n }\n if (/\\w/.test(String.fromCharCode(input.next))) return\n for (let off = 0;; off++) {\n let next = input.peek(off);\n if (next == space || next == tab) continue\n if (next != parenOpen && next != dot && next != newline && next != carriageReturn && next != hash)\n input.acceptToken(printKeyword);\n return\n }\n});\n\nfunction formatString(quote, len, content, brace, end) {\n return new _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.ExternalTokenizer(input => {\n let start = input.pos;\n for (;;) {\n if (input.next < 0) {\n break\n } else if (input.next == braceOpen) {\n if (input.peek(1) == braceOpen) {\n input.advance(2);\n } else {\n if (input.pos == start) {\n input.acceptToken(brace, 1);\n return\n }\n break\n }\n } else if (input.next == backslash) {\n input.advance();\n if (input.next >= 0) input.advance();\n } else if (input.next == quote && (len == 1 || input.peek(1) == quote && input.peek(2) == quote)) {\n if (input.pos == start) {\n input.acceptToken(end, len);\n return\n }\n break\n } else {\n input.advance();\n }\n }\n if (input.pos > start) input.acceptToken(content);\n })\n}\n\nconst formatString1 = formatString(singleQuote, 1, formatString1Content, formatString1Brace, formatString1End);\nconst formatString2 = formatString(doubleQuote, 1, formatString2Content, formatString2Brace, formatString2End);\nconst formatString1l = formatString(singleQuote, 3, formatString1lContent, formatString1lBrace, formatString1lEnd);\nconst formatString2l = formatString(doubleQuote, 3, formatString2lContent, formatString2lBrace, formatString2lEnd);\n\nconst pythonHighlighting = (0,_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.styleTags)({\n \"async \\\"*\\\" \\\"**\\\" FormatConversion FormatSpec\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.modifier,\n \"for while if elif else try except finally return raise break continue with pass assert await yield match case\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.controlKeyword,\n \"in not and or is del\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.operatorKeyword,\n \"from def class global nonlocal lambda\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definitionKeyword,\n import: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.moduleKeyword,\n \"with as print\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.keyword,\n Boolean: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.bool,\n None: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.null,\n VariableName: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName,\n \"CallExpression/VariableName\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName),\n \"FunctionDefinition/VariableName\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.variableName)),\n \"ClassDefinition/VariableName\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definition(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.className),\n PropertyName: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.propertyName,\n \"CallExpression/MemberExpression/PropertyName\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.function(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.propertyName),\n Comment: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.lineComment,\n Number: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.number,\n String: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.string,\n FormatString: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.special(_lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.string),\n UpdateOp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.updateOperator,\n \"ArithOp!\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.arithmeticOperator,\n BitOp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.bitwiseOperator,\n CompareOp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.compareOperator,\n AssignOp: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.definitionOperator,\n Ellipsis: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.punctuation,\n At: _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.meta,\n \"( )\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.paren,\n \"[ ]\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.squareBracket,\n \"{ }\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.brace,\n \".\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.derefOperator,\n \", ;\": _lezer_highlight__WEBPACK_IMPORTED_MODULE_1__.tags.separator\n});\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst spec_identifier = {__proto__:null,await:48, or:58, and:60, in:64, not:66, is:68, if:74, else:76, lambda:80, yield:98, from:100, async:106, for:108, None:168, True:170, False:170, del:184, pass:188, break:192, continue:196, return:200, raise:208, import:212, as:214, global:218, nonlocal:220, assert:224, type:229, elif:242, while:246, try:252, except:254, finally:256, with:260, def:264, class:274, match:285, case:291};\nconst parser = _lezer_lr__WEBPACK_IMPORTED_MODULE_0__.LRParser.deserialize({\n version: 14,\n states: \"#&jO`Q#yOOP$bOSOOO%kQ&nO'#HcOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HbOOQS'#Hc'#HcOOQS'#DW'#DWOOQS'#Hb'#HbO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HSOOQS'#HS'#HSO'ZQ#xO'#HRO/ZQ&nO'#HROOQS'#Ee'#EeO/rQ#xO'#EfOOQS'#HQ'#HQO/|Q#xO'#HPOOQV'#HP'#HPO0XQ#xO'#F]OOQS'#Ge'#GeO0^Q#xO'#F[OOQV'#IY'#IYOOQV'#HO'#HOOOQV'#Ft'#FtQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#DPO0sQ#xO'#DTO1RQ#xO'#HgO1cQ&nO'#EYO'ZQ#xO'#EZOOQS'#E]'#E]OOQS'#E_'#E_OOQS'#Ea'#EaO1wQ#xO'#EcO2_Q#xO'#EgO0XQ#xO'#EiO2rQ&nO'#EiO0XQ#xO'#ElO/rQ#xO'#EoO0XQ#xO'#EqO/rQ#xO'#EwO/rQ#xO'#EzO2}Q#xO'#E|O3UQ#xO'#FRO3aQ#xO'#E}O/rQ#xO'#FRO0XQ#xO'#FTO0XQ#xO'#FYO3fQ#xO'#F_P3mO#xO'#G}POOO)CBq)CBqOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Ck'#CkOOQS'#Cl'#ClOOQS'#Cn'#CnO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO3xQ#xO'#DqOOQS,5:[,5:[O4]Q#xO'#HqOOQS,5:_,5:_O4jQMlO,5:_O4oQ&nO,59[O0lQ#xO,59dO0lQ#xO,59dO0lQ#xO,59dO7_Q#xO,59dO7dQ#xO,59dO7kQ#xO,59lO7rQ#xO'#HbO8xQ#xO'#HaOOQS'#Ha'#HaOOQS'#D^'#D^O9aQ#xO,59cO'ZQ#xO,59cO9oQ#xO,59cOOQS,59{,59{O9tQ#xO,5:TO'ZQ#xO,5:TOOQS,5:S,5:SO:SQ#xO,5:SO:XQ#xO,5:ZO'ZQ#xO,5:ZO'ZQ#xO,5:XOOQS,5:W,5:WO:jQ#xO,5:WO:oQ#xO,5:YOOOO'#F|'#F|O:tO,UO,5:cOOQS,5:c,5:cOOOO'#F}'#F}O:|O7[O,5:cO;UQ#xO'#DyOOOW'#GO'#GOO;fOWO,5:dOOQS,5:d,5:dO;UQ#xO'#D}OOO`'#GR'#GRO;qO`O,5:dO;UQ#xO'#EOOOOp'#GS'#GSO;|OpO,5:dO;UQ#xO'#EPOOO!b'#GT'#GTOROOQS,5>R,5>RO/rQ#xO'#EUOOQS'#EV'#EVOGZQ#xO'#GWOGkQ#xO,59OOGkQ#xO,59OO)pQ#xO,5:rOGyQ&nO'#HjOOQS,5:u,5:uOOQS,5:},5:}OH^Q#xO,5;ROHoQ#xO,5;TOOQS'#GZ'#GZOH}Q&nO,5;TOI]Q#xO,5;TOIbQ#xO'#IWOOQS,5;W,5;WOIpQ#xO'#ISOOQS,5;Z,5;ZOJRQ#xO,5;]O3aQ#xO,5;cO3aQ#xO,5;fOJZQ&nO'#IZO'ZQ#xO'#IZOJeQ#xO,5;hO2}Q#xO,5;hO/rQ#xO,5;mO0XQ#xO,5;oOJjQ#yO'#ExOKvQ#{O,5;iO! [Q#xO'#I[O3aQ#xO,5;mO! gQ#xO,5;oO! oQ#xO,5;tO! zQ&nO,5;yO'ZQ#xO,5;yPOOO,5=i,5=iP!!ROSO,5=iP!!WO#xO,5=iO!${Q&nO1G.lO!%SQ&nO1G.lO!'sQ&nO1G.lO!'}Q&nO1G.lO!*hQ&nO1G.lO!*{Q&nO1G.lO!+`Q#xO'#HpO!+nQ&nO'#HSO/rQ#xO'#HpO!+xQ#xO'#HoOOQS,5:],5:]O!,QQ#xO,5:]O!,VQ#xO'#HrO!,bQ#xO'#HrO!,uQ#xO,5>]OOQS'#Du'#DuOOQS1G/y1G/yOOQS1G/O1G/OO!-uQ&nO1G/OO!-|Q&nO1G/OO0lQ#xO1G/OO!.iQ#xO1G/WOOQS'#D]'#D]O/rQ#xO,59vOOQS1G.}1G.}O!.pQ#xO1G/gO!/QQ#xO1G/gO!/YQ#xO1G/hO'ZQ#xO'#HiO!/_Q#xO'#HiO!/dQ&nO1G.}O!/tQ#xO,59kO!0zQ#xO,5>XO!1[Q#xO,5>XO!1dQ#xO1G/oO!1iQ&nO1G/oOOQS1G/n1G/nO!1yQ#xO,5>SO!2pQ#xO,5>SO/rQ#xO1G/sO!3_Q#xO1G/uO!3dQ&nO1G/uO!3tQ&nO1G/sOOQS1G/r1G/rOOQS1G/t1G/tOOOO-E9z-E9zOOQS1G/}1G/}OOOO-E9{-E9{O!4UQ#xO'#H|O/rQ#xO'#H|O!4dQ#xO,5:eOOOW-E9|-E9|OOQS1G0O1G0OO!4oQ#xO,5:iOOO`-E:P-E:PO!4zQ#xO,5:jOOOp-E:Q-E:QO!5VQ#xO,5:kOOO!b-E:R-E:ROOQS-E:S-E:SO!5bQ!LUO1G3XO!6RQ&nO1G3XO'ZQ#xO,5oOOQS1G1c1G1cO!7RQ#xO1G1cOOQS'#DX'#DXO/rQ#xO,5>OOOQS,5>O,5>OO!7WQ#xO'#FuO!7cQ#xO,59qO!7kQ#xO1G/ZO!7uQ&nO,5>SOOQS1G3m1G3mOOQS,5:p,5:pO!8fQ#xO'#HROOQS,5UO!9gQ#xO,5>UO/rQ#xO1G0mO/rQ#xO1G0mO0XQ#xO1G0oOOQS-E:X-E:XO!9xQ#xO1G0oO!:TQ#xO1G0oO!:YQ#xO,5>rO!:hQ#xO,5>rO!:vQ#xO,5>nO!;^Q#xO,5>nO!;oQ#xO'#EsO/rQ#xO1G0wO!;zQ#xO1G0wO!uO!BzQ#xO,5>uO!CSQ&nO,5>uO/rQ#xO1G1SO!C^Q#xO1G1SO3aQ#xO1G1XO! gQ#xO1G1ZOOQV,5;d,5;dO!CcQ#zO,5;dO!ChQ#{O1G1TO!F|Q#xO'#GbO3aQ#xO1G1TO3aQ#xO1G1TO!G^Q#xO,5>vO!GkQ#xO,5>vO0XQ#xO,5>vOOQV1G1X1G1XO!GsQ#xO'#FVO!HUQMlO1G1ZO!H^Q#xO1G1ZOOQV1G1`1G1`O3aQ#xO1G1`O!HcQ#xO1G1`O!HkQ#xO'#FaOOQV1G1e1G1eO! zQ&nO1G1ePOOO1G3T1G3TP!HpOSO1G3TOOQS,5>[,5>[OOQS'#Dr'#DrO/rQ#xO,5>[O!HuQ#xO,5>ZO!IYQ#xO,5>ZOOQS1G/w1G/wO!IbQ#xO,5>^O!IrQ#xO,5>^O!IzQ#xO,5>^O!J_Q#xO,5>^O!JoQ#xO,5>^OOQS1G3w1G3wOOQS7+$j7+$jO!7kQ#xO7+$rO!LbQ#xO1G/OO!LiQ#xO1G/OOOQS1G/b1G/bOOQS,5TO'ZQ#xO,5>TOOQS7+$i7+$iO!MVQ#xO7+%RO!M_Q#xO7+%SO!MdQ#xO1G3sOOQS7+%Z7+%ZO!MtQ#xO1G3sO!M|Q#xO7+%ZOOQS,5hO##PQ#xO,5>hO##PQ#xO,5>hO##_O$ISO'#D{O##jO#tO'#H}OOOW1G0P1G0PO##oQ#xO1G0POOO`1G0T1G0TO##wQ#xO1G0TOOOp1G0U1G0UO#$PQ#xO1G0UOOO!b1G0V1G0VO#$XQ#xO1G0VO#$aQ!LUO7+(sO#%QQ&nO1G2]P#%kQ#xO'#GVOOQS,5i,5>iOOOW7+%k7+%kOOO`7+%o7+%oOOOp7+%p7+%pOOO!b7+%q7+%qO#:`Q#xO1G3XO#:yQ#xO1G3XP'ZQ#xO'#FxO/rQ#xO<qO#;mQ#xO,5>qO0XQ#xO,5>qO#pOOQS<sO#sOOQS1G0y1G0yOOQS<xO#DpQ#xO,5>xOOQS,5>x,5>xO#D{Q#xO,5>wO#E^Q#xO,5>wOOQS1G1]1G1]OOQS,5;s,5;sOOQV<XAN>XO#HmQ#xO<eAN>eO/rQ#xO1G2PO#H}Q&nO1G2PP#IXQ#xO'#FyOOQS1G2V1G2VP#IfQ#xO'#GPO#IsQ#xO7+)nO#JZQ#xO,5:hOOOO-E:O-E:OO#JfQ#xO7+(sOOQSAN?_AN?_O#KPQ#xO,5VOOQSANBaANBaOOOO7+%n7+%nOOQS7+'|7+'|O$+jQ#xO<zO$.`Q#xO,5>zO0XQ#xO,5|O$!pQ#xO,5>|OOQS1G1s1G1sO$2WQ&nO,5<_OOQU7+'S7+'SO$$mQ#xO1G/kO$!pQ#xO,5<]O$2_Q#xO,5>}O$2fQ#xO,5>}OOQS1G1v1G1vOOQS7+'V7+'VP$!pQ#xO'#GkO$2nQ#xO1G4hO$2xQ#xO1G4hO$3QQ#xO1G4hOOQS7+%V7+%VO$3`Q#xO1G1wO$3nQ&nO'#FdO$3uQ#xO,5=UOOQS,5=U,5=UO$4TQ#xO1G4iOOQS-E:h-E:hO$!pQ#xO,5=TO$4[Q#xO,5=TO$4aQ#xO7+*SOOQS-E:g-E:gO$4kQ#xO7+*SO$!pQ#xO,5<^P$!pQ#xO'#GjO$4sQ#xO1G2oO$!pQ#xO1G2oP$5RQ#xO'#GiO$5YQ#xO<fPP>i?Z?^PP'a'aPP?vPP'a'aPP'a'a'a'a'a?z@t'aP@wP@}EXHxPH|IYI^IbIf'aPPPIjIs'XP'X'XP'XP'XP'XP'XP'X'X'XP'XPP'XPP'XP'XPIyJVJ_PJfJlPJfPJfJfPPPJfPLzPMTM_MeLzPJfMnPJfPMuM{PNPNe! S! mNPNP! s!!QNPNPNPNP!!f!!l!!o!!t!!w!#R!#X!#e!#w!#}!$X!$_!${!%R!%X!%_!%i!%o!%u!%{!&R!&X!&k!&u!&{!'R!'X!'c!'i!'o!'u!'{!(V!(]!(g!(m!(v!(|!)]!)e!)o!)vPPPPPPPPPPPPPPPPP!)|!*P!*V!*`!*j!*uPPPPPPPPPPPP!/l!1Q!5T!8hPP!8p!9S!9]!:U!9{!:_!:e!:h!:k!:n!:v!;gPPPPPPPPP!;j!;yPPPP!V!>`!?[!?_]jOs#v$w*W,d(TeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)V)X)a)d)p)w)y)}*O*S*W*^*b*l*v*y*z*}+T+U+W+Y+]+^+a+d+h+i+l+t+v+w,O,],^,d,l,m,p,z,{,|-O-P-S-U-W-Y-[-^-_-b-y-{.S.V.Y.}/O/o/s0[0z0{0|0}1P1Q1R1S1T1V1Z}!hQ#r$P$b$q$}%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1O!P!iQ#r$P$b$q$}%S%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1O!R!jQ#r$P$b$q$}%S%T%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1O!T!kQ#r$P$b$q$}%S%T%U%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1O!V!lQ#r$P$b$q$}%S%T%U%V%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1O!X!mQ#r$P$b$q$}%S%T%U%V%W%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1O!]!mQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1O(TTOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)V)X)a)d)p)w)y)}*O*S*W*^*b*l*v*y*z*}+T+U+W+Y+]+^+a+d+h+i+l+t+v+w,O,],^,d,l,m,p,z,{,|-O-P-S-U-W-Y-[-^-_-b-y-{.S.V.Y.}/O/o/s0[0z0{0|0}1P1Q1R1S1T1V1Z&iVOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)V)X)a)p)w)y*S*W*^*b*l*v*y*z*}+T+U+W+Y+]+^+a+h+i+l+t+w,O,d,l,m,p,z,{,|-O-P-S-U-W-Y-[-^-_-b-y-{.S.V.Y.}/O/s0[0z0{0|0}1P1Q1R1S1V1Z%sXOYZ[isw}!O!S!U!V!Z!n!p#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)V)X)a)p)w)y*S*W*^*b*l*v*y*z*}+T+W+Y+]+^+a+h+i+l+t+w,O,d,l,m,p,z,{,|-O-P-S-W-Y-[-^-_-b-y-{.S.V.}/O/s1Q1R1SQ$VvQ/t/SR1W1Y'zeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(R(T(U(Y(_(a(e(i(n(o(u(x)V)X)a)d)p)w)y)}*O*S*W*^*b*l*y*z*}+T+U+W+Y+]+^+a+d+h+i+l+t+v+w,O,],^,d,l,m,p,{,|-O-P-S-U-W-Y-[-^-_-b-y-{.S.V.Y.}/O/o/s0[0z0{0|0}1P1Q1R1S1T1V1ZW#ym!P!Q$hW$Rv&q/S1YQ$j!RQ$n!TQ${![Q$|!]W%Z!n(O*v,zS&p$S$TQ'e$vQ)Y&jQ)h'QU)i'S)j)kU)l'U)m+}W)s'Y,Q-j.dQ*d'nW*e'p,s-}.lQ,P)rS,r*f*gY-d+x-e.a.b/XQ-g+zQ-t,hQ-x,kQ.j-vl.o.R.u.v.x/d/f/k0R0W0]0b0m0r0uQ/W.`Q/l.wQ/x/^Q0T/hU0h0^0k0sX0n0c0o0v0wR&o$R!_!|YZ!U!V!p%a%m%t(R(T(U(a(i)y*y*z*}+T+W+Y,{,|-O-P-S.S.V.}/O/sR%k!{Q#QYQ&W#cQ&Z#gQ&]#jQ&_#mQ&x$^Q&{$aR-`+lT/R.Y0[![!oQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1OQ&m#zQ't$|R*p'uR'}%ZQ%d!rR/v/[(SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)V)X)a)d)p)w)y)}*O*S*W*^*b*l*v*y*z*}+T+U+W+Y+]+^+a+d+h+i+l+t+v+w,O,],^,d,l,m,p,z,{,|-O-P-S-U-W-Y-[-^-_-b-y-{.S.V.Y.}/O/o/s0[0z0{0|0}1P1Q1R1S1T1V1ZS#pd#q!P.s.R.u.v.w.x/^/d/f/k0R0W0]0^0b0c0k0m0o0r0s0u0v0w(SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)V)X)a)d)p)w)y)}*O*S*W*^*b*l*v*y*z*}+T+U+W+Y+]+^+a+d+h+i+l+t+v+w,O,],^,d,l,m,p,z,{,|-O-P-S-U-W-Y-[-^-_-b-y-{.S.V.Y.}/O/o/s0[0z0{0|0}1P1Q1R1S1T1V1ZT#pd#qT#d`#ee(|&W&Z&]&_)O)Q)S)U-`._T+m({+nT#ha#iT#kb#lT#nc#oQ$`xQ,P)sR,q*eX$^x$_$`&zQ'[$nQ'r${Q'u$|R*V'eQ)t'YV-i,Q-j.dZlOs$w*W,dXpOs*W,dQ$x!YQ']$oQ'^$pQ'o$zQ's$|Q*T'dQ*['iQ*_'jQ*`'kQ*m'qS*o't'uQ,W)yQ,Y)zQ,Z){Q,_*RS,a*U*nQ,e*YQ,f*ZS,g*]*^Q,w*pQ-l,VQ-m,XQ-o,`S-p,b,cQ-u,iQ-w,jQ.e-nQ.g-qQ.h-sQ.i-tQ/Y.fQ/Z.jQ/p.{R0Z/qWpOs*W,dR#|oQ'q${S*U'e'rR,c*VQ,p*eR-{,qQ*n'qQ,b*UR-q,cZnOos*W,dQ'w$}R*r'xT.P,x.Qu.z.R.u.v.x/^/d/f/k0R0W0]0^0b0k0m0r0s0ut.z.R.u.v.x/^/d/f/k0R0W0]0^0b0k0m0r0s0uQ/l.wX0n0c0o0v0w!P.r.R.u.v.w.x/^/d/f/k0R0W0]0^0b0c0k0m0o0r0s0u0v0wQ/a.qR/}/bg/d.t/e/y0Q0V0e0g0i0t0x0yu.y.R.u.v.x/^/d/f/k0R0W0]0^0b0k0m0r0s0uX/_.o.y/x0hR/z/^V0j0^0k0sR/q.{QsOS$Os,dR,d*WQ&r$UR)_&rS%z#W$WS(p%z(sT(s%}&tQ%n#OQ%u#SW(b%n%u(g(kQ(g%rR(k%wQ&}$bR)e&}Q(v&OQ+_(qT+e(v+_Q(P%]R*w(PS(S%`%aY*{(S*|-Q.W/PU*|(T(U(VU-Q*}+O+PS.W-R-SR/P.XQ#_^R&R#_Q#b_R&T#bQ#e`R&X#eQ(y&US+j(y+kR+k(zQ+n({R-a+nQ#iaR&[#iQ#lbR&^#lQ#ocR&`#oQ#qdR&a#qQ#tgQ&c#rW&f#t&c)b+uQ)b&wR+u1OQ$_xS&y$_&zR&z$`Q'X$lR)q'XQ&k#yR)Z&kQ$h!QR'R$hQ+y)iS-f+y.cR.c-gQ'V$jR)n'VQ,R)tR-k,RQ#wkR&h#wQ)x']R,U)xQ'`$qS*P'`*QR*Q'aQ'h$xR*X'hQ'm$yS*c'm,nR,n*dQ,t*iR.O,tWoOs*W,dR#{oQ.Q,xR.m.Qd/e.t/y0Q0V0e0g0i0t0x0yR0P/eU/].o/x0hR/w/]Q0d0VS0p0d0qR0q0eS0_/y/zR0l0_Q/g.tR0S/gR!`PXrOs*W,dWqOs*W,dR'f$wYkOs$w*W,dR&g#v[xOs#v$w*W,dR&x$^&hQOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)V)X)a)p)w)y*S*W*^*b*l*v*y*z*}+T+U+W+Y+]+^+a+h+i+l+t+w,O,d,l,m,p,z,{,|-O-P-S-U-W-Y-[-^-_-b-y-{.S.V.Y.}/O/s0[0z0{0|0}1P1Q1R1S1V1ZQ!sTQ#rfQ$PtU$by%p(eS$q!W$tQ$}!^Q%S!hQ%T!iQ%U!jQ%V!kQ%W!lQ%X!mQ%r#PQ%w#TQ%}#XQ&O#YQ&t$XQ'a$rQ'x%OQ)W&dU)c&|)d+vW)|'_*O,],^Q+R(_Q+[(nQ,[)}Q-Z+dQ0Y/oR1O1TQ#OYQ#SZQ$o!UQ$p!VQ%`!pQ(V%a^(^%m%t(a(i+T+W+Y^*x(R*z-O-P.V/O/sQ+O(TQ+P(UQ,X)yQ,}*yQ-R*}Q.T,{Q.U,|Q.X-SQ.|.SR/r.}[gOs#v$w*W,d!^!{YZ!U!V!p%a%m%t(R(T(U(a(i)y*y*z*}+T+W+Y,{,|-O-P-S.S.V.}/O/sQ#W[Q#uiS$Ww}Q$e!OW$l!S$a'b*SS$y!Z$uW%Y!n(O*v,zY&U#c#g#j#m+l`&e#s&b)V)X)a+t-b1SQ&u$YQ&v$[Q&w$^Q'{%[Q(]%kW(m%y(o+]+aQ(q%{Q(z&VQ)]&oS)`&s1QQ)f'OQ)g'PU)o'W)p,OQ)v'ZQ*]'iY*a'l*b,l,m-yQ*t'}S+Q(Y1RW+c(u+^-W-[W+g(x+i-^-_Q,T)wQ,i*^Q,v*lQ-]+hQ-c+wQ-z,pQ.]-YR.k-{hUOs#s#v$w&b&s(Y)V)X*W,d%Y!zYZ[iw}!O!S!U!V!Z!n!p#c#g#j#m$Y$[$^$a$u%[%a%k%m%t%y%{&V&o'O'P'W'Z'b'i'l'}(O(R(T(U(a(i(o(u(x)a)p)w)y*S*^*b*l*v*y*z*}+T+W+Y+]+^+a+h+i+l+t+w,O,l,m,p,z,{,|-O-P-S-W-Y-[-^-_-b-y-{.S.V.}/O/s1Q1R1SQ$QuW%e!t!x0{1VQ%f!uQ%g!vQ%i!yQ%s0zS(X%h1PQ(Z0|Q([0}Q-T+UQ.[-US/Q.Y0[R1X1ZU$Uv/S1YR)^&q[hOs#v$w*W,da!}Y#c#g#j#m$^$a+lQ#][Q$ZwR$d}Q%o#OQ%v#SQ%|#WQ'{%YQ(h%rQ(l%wQ(t%}Q(w&OQ+`(qQ,y*tQ.Z-TQ/U.[R/u/TQ$cyQ(d%pR+V(eQ/T.YR0f0[R#VZR#[[R%_!nQ%]!nV*u(O*v,z!]!qQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1OR%b!pQ&W#cQ&Z#gQ&]#jQ&_#mR-`+lQ(}&WQ)P&ZQ)R&]Q)T&_Q+p)OQ+q)QQ+r)SQ+s)UQ.^-`R/V._Q$m!SQ&{$aQ*R'bR,`*SQ#zmQ$f!PQ$i!QR'T$hQ)h'SR+|)kQ)h'SQ+{)jR+|)kR$k!RR)u'YXqOs*W,dQ$s!WR'c$tQ$z!ZR'd$uR*k'pQ*i'pV-|,s-}.lQ.{.RQ/i.uR/j.vU.t.R.u.vQ/n.xQ/y/^Q0O/dU0Q/f0R0bQ0V/kQ0e0WQ0g0]U0i0^0k0sQ0t0mQ0x0rR0y0uR/m.wR/{/^\",\n nodeNames: \"⚠ print { { { { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatConversion FormatSpec FormatReplacement FormatReplacement FormatReplacement FormatReplacement ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard\",\n maxTerm: 283,\n context: trackIndent,\n nodeProps: [\n [\"group\", -15,8,88,90,91,93,95,97,99,101,102,103,105,108,111,113,\"Statement Statement\",-22,10,20,23,27,42,51,52,58,59,62,63,64,65,66,69,72,73,74,82,83,84,85,\"Expression\",-10,117,119,122,124,125,129,131,136,138,141,\"Statement\",-9,146,147,150,151,153,154,155,156,157,\"Pattern\"],\n [\"openedBy\", 25,\"(\",56,\"[\",60,\"{\"],\n [\"closedBy\", 26,\")\",57,\"]\",61,\"}\"]\n ],\n propSources: [pythonHighlighting],\n skippedNodes: [0,6],\n repeatNodeCount: 38,\n tokenData: \"%-W#sR!`OX%TXY=|Y[%T[]=|]p%Tpq=|qr@_rsDOst!+|tu%Tuv!Nnvw#!|wx#$Wxy#:Uyz#;Yz{#<^{|#>x|}#@S}!O#AW!O!P#Ci!P!Q#N_!Q!R$!y!R![$&w![!]$1e!]!^$3s!^!_$4w!_!`$7c!`!a$8m!a!b%T!b!c$;U!c!d$W!e!h$W#V#Y$Q<%lO$Xc&r!b&jS&mW%p!TOX%TXY=|Y[%T[]=|]p%Tpq=|qr%Trs&Vsw%Twx/Xx#O%T#O#P?d#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#s?i[&r!bOY%TYZ=|Z]%T]^=|^#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=P;=`<%l8^<%lO%T!q@hd&r!b&jS&mWOr%Trs&Vsw%Twx/Xx!_%T!_!`Av!`#O%T#O#P7o#P#T%T#T#UBz#U#f%T#f#gBz#g#hBz#h#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qBR]oR&r!b&jS&mWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qCV]!nR&r!b&jS&mWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cDXa&r!b&jS&hsOYE^YZ%TZ]E^]^%T^rE^rs!)|swE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cEia&r!b&jS&mW&hsOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cFw]&r!b&jS&hsOr%Trs'Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cGya&r!b&mW&hsOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxIOx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cIXa&r!b&mW&hsOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxJ^x#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#_Jg_&r!b&mW&hsOYJ^YZ1XZ]J^]^1X^rJ^rsKfs#OJ^#O#PL`#P#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`!!o<%lOJ^#_KmZ&r!b&hsOr1Xrs2ys#O1X#O#P3q#P#o1X#o#p4`#p#q1X#q#r4`#r;'S1X;'S;=`7i<%lO1X#_LeW&r!bO#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`! r;=`<%lL}<%lOJ^{MUZ&mW&hsOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l<%lOL}{M|V&hsOr4`rs5ds#O4`#O#P5y#P;'S4`;'S;=`6t<%lO4`{NfRO;'SL};'S;=`No;=`OL}{Nv[&mW&hsOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lL}<%lOL}{! oP;=`<%lL}#_! y[&mW&hsOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lJ^<%lOL}#_!!rP;=`<%lJ^#c!!zW&r!bO#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!(q;=`<%l!#d<%lOE^!P!#m]&jS&mW&hsOY!#dYZ8^Z]!#d]^8^^r!#drs!$fsw!#dwx!%Yx#O!#d#O#P!'Y#P;'S!#d;'S;=`!(k<%lO!#d!P!$mX&jS&hsOr8^rs9rsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`^s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!>e_U!T&r!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!?ds#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!?k_U!T&r!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!3`s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!@q[U!T&r!bOY!=UYZ1XZ]!=U]^1X^#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!Ec;=`<%l4`<%lO!=U!]!AnZU!T&mWOY!AgYZ4`Z]!Ag]^4`^r!Agrs!Bas#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!BfZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!CXs#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!C^ZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!4Ys#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!DUWU!TOY!AgYZ4`Z]!Ag]^4`^;'S!Ag;'S;=`!Dn;=`<%l4`<%lO!Ag!]!DsW&mWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!Ag<%lO4`!]!E`P;=`<%l!Ag#o!EhW&mWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!=U<%lO4`#o!FTP;=`<%l!=U#s!F_[U!T&r!bOY!+|YZ%TZ]!+|]^%T^#o!+|#o#p!GT#p#q!+|#q#r!GT#r;'S!+|;'S;=`!Mq;=`<%l8^<%lO!+|!a!G^]U!T&jS&mWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!H^]U!T&jSOY!GTYZ8^Z]!GT]^8^^r!GTrs!IVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!I^]U!T&jSOY!GTYZ8^Z]!GT]^8^^r!GTrs!5wsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!J^]U!T&mWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!KVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!K^]U!T&mWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!Agx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!L[WU!TOY!GTYZ8^Z]!GT]^8^^;'S!GT;'S;=`!Lt;=`<%l8^<%lO!GT!a!L{Y&jS&mWOr8^rs9Qsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`Q<%lO$TP;=`<%l$ei&r!b&jS&mW&g`&SsOr%Trs$@Ssw%Twx$C`x!Q%T!Q![$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Q<%lO$ spec_identifier[value] || -1}],\n tokenPrec: 7372\n});\n\n\n\n\n//# sourceURL=webpack://Papyros/./node_modules/@lezer/python/dist/index.js?")},"./node_modules/@lit/reactive-element/development/css-tag.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CSSResult: () => (/* binding */ CSSResult),\n/* harmony export */ adoptStyles: () => (/* binding */ adoptStyles),\n/* harmony export */ css: () => (/* binding */ css),\n/* harmony export */ getCompatibleStyle: () => (/* binding */ getCompatibleStyle),\n/* harmony export */ supportsAdoptingStyleSheets: () => (/* binding */ supportsAdoptingStyleSheets),\n/* harmony export */ unsafeCSS: () => (/* binding */ unsafeCSS)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst NODE_MODE = false;\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nconst supportsAdoptingStyleSheets = global.ShadowRoot &&\n (global.ShadyCSS === undefined || global.ShadyCSS.nativeShadow) &&\n 'adoptedStyleSheets' in Document.prototype &&\n 'replace' in CSSStyleSheet.prototype;\nconst constructionToken = Symbol();\nconst cssTagCache = new WeakMap();\n/**\n * A container for a string of CSS text, that may be used to create a CSSStyleSheet.\n *\n * CSSResult is the return value of `css`-tagged template literals and\n * `unsafeCSS()`. In order to ensure that CSSResults are only created via the\n * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.\n */\nclass CSSResult {\n constructor(cssText, strings, safeToken) {\n // This property needs to remain unminified.\n this['_$cssResult$'] = true;\n if (safeToken !== constructionToken) {\n throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n }\n this.cssText = cssText;\n this._strings = strings;\n }\n // This is a getter so that it's lazy. In practice, this means stylesheets\n // are not created until the first element instance is made.\n get styleSheet() {\n // If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is\n // constructable.\n let styleSheet = this._styleSheet;\n const strings = this._strings;\n if (supportsAdoptingStyleSheets && styleSheet === undefined) {\n const cacheable = strings !== undefined && strings.length === 1;\n if (cacheable) {\n styleSheet = cssTagCache.get(strings);\n }\n if (styleSheet === undefined) {\n (this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(this.cssText);\n if (cacheable) {\n cssTagCache.set(strings, styleSheet);\n }\n }\n }\n return styleSheet;\n }\n toString() {\n return this.cssText;\n }\n}\nconst textFromCSSResult = (value) => {\n // This property needs to remain unminified.\n if (value['_$cssResult$'] === true) {\n return value.cssText;\n }\n else if (typeof value === 'number') {\n return value;\n }\n else {\n throw new Error(`Value passed to 'css' function must be a 'css' function result: ` +\n `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +\n `to ensure page security.`);\n }\n};\n/**\n * Wrap a value for interpolation in a {@linkcode css} tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nconst unsafeCSS = (value) => new CSSResult(typeof value === 'string' ? value : String(value), undefined, constructionToken);\n/**\n * A template literal tag which can be used with LitElement's\n * {@linkcode LitElement.styles} property to set element styles.\n *\n * For security reasons, only literal string values and number may be used in\n * embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS}\n * may be used inside an expression.\n */\nconst css = (strings, ...values) => {\n const cssText = strings.length === 1\n ? strings[0]\n : values.reduce((acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], strings[0]);\n return new CSSResult(cssText, strings, constructionToken);\n};\n/**\n * Applies the given styles to a `shadowRoot`. When Shadow DOM is\n * available but `adoptedStyleSheets` is not, styles are appended to the\n * `shadowRoot` to [mimic spec behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n * Note, when shimming is used, any styles that are subsequently placed into\n * the shadowRoot should be placed *before* any shimmed adopted styles. This\n * will match spec behavior that gives adopted sheets precedence over styles in\n * shadowRoot.\n */\nconst adoptStyles = (renderRoot, styles) => {\n if (supportsAdoptingStyleSheets) {\n renderRoot.adoptedStyleSheets = styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);\n }\n else {\n for (const s of styles) {\n const style = document.createElement('style');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const nonce = global['litNonce'];\n if (nonce !== undefined) {\n style.setAttribute('nonce', nonce);\n }\n style.textContent = s.cssText;\n renderRoot.appendChild(style);\n }\n }\n};\nconst cssResultFromStyleSheet = (sheet) => {\n let cssText = '';\n for (const rule of sheet.cssRules) {\n cssText += rule.cssText;\n }\n return unsafeCSS(cssText);\n};\nconst getCompatibleStyle = supportsAdoptingStyleSheets ||\n (NODE_MODE && global.CSSStyleSheet === undefined)\n ? (s) => s\n : (s) => s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;\n//# sourceMappingURL=css-tag.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/css-tag.js?")},"./node_modules/@lit/reactive-element/development/decorators/base.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ desc: () => (/* binding */ desc)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/**\n * Wraps up a few best practices when returning a property descriptor from a\n * decorator.\n *\n * Marks the defined property as configurable, and enumerable, and handles\n * the case where we have a busted Reflect.decorate zombiefill (e.g. in Angular\n * apps).\n *\n * @internal\n */\nconst desc = (obj, name, descriptor) => {\n // For backwards compatibility, we keep them configurable and enumerable.\n descriptor.configurable = true;\n descriptor.enumerable = true;\n if (\n // We check for Reflect.decorate each time, in case the zombiefill\n // is applied via lazy loading some Angular code.\n Reflect.decorate &&\n typeof name !== 'object') {\n // If we're called as a legacy decorator, and Reflect.decorate is present\n // then we have no guarantees that the returned descriptor will be\n // defined on the class, so we must apply it directly ourselves.\n Object.defineProperty(obj, name, descriptor);\n }\n return descriptor;\n};\n//# sourceMappingURL=base.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/base.js?")},"./node_modules/@lit/reactive-element/development/decorators/custom-element.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ customElement: () => (/* binding */ customElement)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```js\n * @customElement('my-element')\n * class MyElement extends LitElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n * @category Decorator\n * @param tagName The tag name of the custom element to define.\n */\nconst customElement = (tagName) => (classOrTarget, context) => {\n if (context !== undefined) {\n context.addInitializer(() => {\n customElements.define(tagName, classOrTarget);\n });\n }\n else {\n customElements.define(tagName, classOrTarget);\n }\n};\n//# sourceMappingURL=custom-element.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/custom-element.js?")},"./node_modules/@lit/reactive-element/development/decorators/event-options.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ eventOptions: () => (/* binding */ eventOptions)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n *
\n * \n *
\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nfunction eventOptions(options) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return ((protoOrValue, nameOrContext) => {\n const method = typeof protoOrValue === 'function'\n ? protoOrValue\n : protoOrValue[nameOrContext];\n Object.assign(method, options);\n });\n}\n//# sourceMappingURL=event-options.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/event-options.js?")},"./node_modules/@lit/reactive-element/development/decorators/property.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ property: () => (/* binding */ property),\n/* harmony export */ standardProperty: () => (/* binding */ standardProperty)\n/* harmony export */ });\n/* harmony import */ var _reactive_element_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../reactive-element.js */ \"./node_modules/@lit/reactive-element/development/reactive-element.js\");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nconst DEV_MODE = true;\nlet issueWarning;\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n const issuedWarnings = (globalThis.litIssuedWarnings ??= new Set());\n // Issue a warning, if we haven't already.\n issueWarning = (code, warning) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (!issuedWarnings.has(warning)) {\n console.warn(warning);\n issuedWarnings.add(warning);\n }\n };\n}\nconst legacyProperty = (options, proto, name) => {\n const hasOwnProperty = proto.hasOwnProperty(name);\n proto.constructor.createProperty(name, hasOwnProperty ? { ...options, wrapped: true } : options);\n // For accessors (which have a descriptor on the prototype) we need to\n // return a descriptor, otherwise TypeScript overwrites the descriptor we\n // define in createProperty() with the original descriptor. We don't do this\n // for fields, which don't have a descriptor, because this could overwrite\n // descriptor defined by other decorators.\n return hasOwnProperty\n ? Object.getOwnPropertyDescriptor(proto, name)\n : undefined;\n};\n// This is duplicated from a similar variable in reactive-element.ts, but\n// actually makes sense to have this default defined with the decorator, so\n// that different decorators could have different defaults.\nconst defaultPropertyDeclaration = {\n attribute: true,\n type: String,\n converter: _reactive_element_js__WEBPACK_IMPORTED_MODULE_0__.defaultConverter,\n reflect: false,\n hasChanged: _reactive_element_js__WEBPACK_IMPORTED_MODULE_0__.notEqual,\n};\n/**\n * Wraps a class accessor or setter so that `requestUpdate()` is called with the\n * property name and old value when the accessor is set.\n */\nconst standardProperty = (options = defaultPropertyDeclaration, target, context) => {\n const { kind, metadata } = context;\n if (DEV_MODE && metadata == null) {\n issueWarning('missing-class-metadata', `The class ${target} is missing decorator metadata. This ` +\n `could mean that you're using a compiler that supports decorators ` +\n `but doesn't support decorator metadata, such as TypeScript 5.1. ` +\n `Please update your compiler.`);\n }\n // Store the property options\n let properties = globalThis.litPropertyMetadata.get(metadata);\n if (properties === undefined) {\n globalThis.litPropertyMetadata.set(metadata, (properties = new Map()));\n }\n properties.set(context.name, options);\n if (kind === 'accessor') {\n // Standard decorators cannot dynamically modify the class, so we can't\n // replace a field with accessors. The user must use the new `accessor`\n // keyword instead.\n const { name } = context;\n return {\n set(v) {\n const oldValue = target.get.call(this);\n target.set.call(this, v);\n this.requestUpdate(name, oldValue, options);\n },\n init(v) {\n if (v !== undefined) {\n this._$changeProperty(name, undefined, options);\n }\n return v;\n },\n };\n }\n else if (kind === 'setter') {\n const { name } = context;\n return function (value) {\n const oldValue = this[name];\n target.call(this, value);\n this.requestUpdate(name, oldValue, options);\n };\n }\n throw new Error(`Unsupported decorator location: ${kind}`);\n};\n/**\n * A class field or accessor decorator which creates a reactive property that\n * reflects a corresponding attribute value. When a decorated property is set\n * the element will update and render. A {@linkcode PropertyDeclaration} may\n * optionally be supplied to configure property features.\n *\n * This decorator should only be used for public fields. As public fields,\n * properties should be considered as primarily settable by element users,\n * either via attribute or the property itself.\n *\n * Generally, properties that are changed by the element should be private or\n * protected fields and should use the {@linkcode state} decorator.\n *\n * However, sometimes element code does need to set a public property. This\n * should typically only be done in response to user interaction, and an event\n * should be fired informing the user; for example, a checkbox sets its\n * `checked` property when clicked and fires a `changed` event. Mutating public\n * properties should typically not be done for non-primitive (object or array)\n * properties. In other cases when an element needs to manage state, a private\n * property decorated via the {@linkcode state} decorator should be used. When\n * needed, state properties can be initialized via public properties to\n * facilitate complex interactions.\n *\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nfunction property(options) {\n return (protoOrTarget, nameOrContext\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) => {\n return (typeof nameOrContext === 'object'\n ? standardProperty(options, protoOrTarget, nameOrContext)\n : legacyProperty(options, protoOrTarget, nameOrContext));\n };\n}\n//# sourceMappingURL=property.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/property.js?")},"./node_modules/@lit/reactive-element/development/decorators/query-all.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ queryAll: () => (/* binding */ queryAll)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ "./node_modules/@lit/reactive-element/development/decorators/base.js");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// Shared fragment used to generate empty NodeLists when a render root is\n// undefined\nlet fragment;\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element\'s renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * ```ts\n * class MyElement {\n * @queryAll(\'div\')\n * divs: NodeListOf;\n *\n * render() {\n * return html`\n *
\n *
\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nfunction queryAll(selector) {\n return ((obj, name) => {\n return (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.desc)(obj, name, {\n get() {\n const container = this.renderRoot ?? (fragment ??= document.createDocumentFragment());\n return container.querySelectorAll(selector);\n },\n });\n });\n}\n//# sourceMappingURL=query-all.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/query-all.js?')},"./node_modules/@lit/reactive-element/development/decorators/query-assigned-elements.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ queryAssignedElements: () => (/* binding */ queryAssignedElements)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/@lit/reactive-element/development/decorators/base.js\");\n/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedElements` of the given `slot`. Provides a declarative\n * way to use\n * [`HTMLSlotElement.assignedElements`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).\n *\n * Can be passed an optional {@linkcode QueryAssignedElementsOptions} object.\n *\n * Example usage:\n * ```ts\n * class MyElement {\n * @queryAssignedElements({ slot: 'list' })\n * listItems!: Array;\n * @queryAssignedElements()\n * unnamedSlotEls!: Array;\n *\n * render() {\n * return html`\n * \n * \n * `;\n * }\n * }\n * ```\n *\n * Note, the type of this property should be annotated as `Array`.\n *\n * @category Decorator\n */\nfunction queryAssignedElements(options) {\n return ((obj, name) => {\n const { slot, selector } = options ?? {};\n const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;\n return (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.desc)(obj, name, {\n get() {\n const slotEl = this.renderRoot?.querySelector(slotSelector);\n const elements = slotEl?.assignedElements(options) ?? [];\n return (selector === undefined\n ? elements\n : elements.filter((node) => node.matches(selector)));\n },\n });\n });\n}\n//# sourceMappingURL=query-assigned-elements.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/query-assigned-elements.js?")},"./node_modules/@lit/reactive-element/development/decorators/query-assigned-nodes.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ queryAssignedNodes: () => (/* binding */ queryAssignedNodes)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/@lit/reactive-element/development/decorators/base.js\");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given `slot`.\n *\n * Can be passed an optional {@linkcode QueryAssignedNodesOptions} object.\n *\n * Example usage:\n * ```ts\n * class MyElement {\n * @queryAssignedNodes({slot: 'list', flatten: true})\n * listItems!: Array;\n *\n * render() {\n * return html`\n * \n * `;\n * }\n * }\n * ```\n *\n * Note the type of this property should be annotated as `Array`. Use the\n * queryAssignedElements decorator to list only elements, and optionally filter\n * the element list using a CSS selector.\n *\n * @category Decorator\n */\nfunction queryAssignedNodes(options) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return ((obj, name) => {\n const { slot } = options ?? {};\n const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;\n return (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.desc)(obj, name, {\n get() {\n const slotEl = this.renderRoot?.querySelector(slotSelector);\n return (slotEl?.assignedNodes(options) ?? []);\n },\n });\n });\n}\n//# sourceMappingURL=query-assigned-nodes.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/query-assigned-nodes.js?")},"./node_modules/@lit/reactive-element/development/decorators/query-async.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ queryAsync: () => (/* binding */ queryAsync)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ "./node_modules/@lit/reactive-element/development/decorators/base.js");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element\'s renderRoot done after the element\'s `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * ```ts\n * class MyElement {\n * @queryAsync(\'#first\')\n * first: Promise;\n *\n * render() {\n * return html`\n *
\n *
\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nfunction queryAsync(selector) {\n return ((obj, name) => {\n return (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.desc)(obj, name, {\n async get() {\n await this.updateComplete;\n return this.renderRoot?.querySelector(selector) ?? null;\n },\n });\n });\n}\n//# sourceMappingURL=query-async.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/query-async.js?')},"./node_modules/@lit/reactive-element/development/decorators/query.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ query: () => (/* binding */ query)\n/* harmony export */ });\n/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ \"./node_modules/@lit/reactive-element/development/decorators/base.js\");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nconst DEV_MODE = true;\nlet issueWarning;\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n const issuedWarnings = (globalThis.litIssuedWarnings ??= new Set());\n // Issue a warning, if we haven't already.\n issueWarning = (code, warning) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (!issuedWarnings.has(warning)) {\n console.warn(warning);\n issuedWarnings.add(warning);\n }\n };\n}\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first: HTMLDivElement;\n *\n * render() {\n * return html`\n *
\n *
\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nfunction query(selector, cache) {\n return ((protoOrTarget, nameOrContext, descriptor) => {\n const doQuery = (el) => {\n const result = (el.renderRoot?.querySelector(selector) ?? null);\n if (DEV_MODE && result === null && cache && !el.hasUpdated) {\n const name = typeof nameOrContext === 'object'\n ? nameOrContext.name\n : nameOrContext;\n issueWarning('', `@query'd field ${JSON.stringify(String(name))} with the 'cache' ` +\n `flag set for selector '${selector}' has been accessed before ` +\n `the first update and returned null. This is expected if the ` +\n `renderRoot tree has not been provided beforehand (e.g. via ` +\n `Declarative Shadow DOM). Therefore the value hasn't been cached.`);\n }\n // TODO: if we want to allow users to assert that the query will never\n // return null, we need a new option and to throw here if the result\n // is null.\n return result;\n };\n if (cache) {\n // Accessors to wrap from either:\n // 1. The decorator target, in the case of standard decorators\n // 2. The property descriptor, in the case of experimental decorators\n // on auto-accessors.\n // 3. Functions that access our own cache-key property on the instance,\n // in the case of experimental decorators on fields.\n const { get, set } = typeof nameOrContext === 'object'\n ? protoOrTarget\n : descriptor ??\n (() => {\n const key = DEV_MODE\n ? Symbol(`${String(nameOrContext)} (@query() cache)`)\n : Symbol();\n return {\n get() {\n return this[key];\n },\n set(v) {\n this[key] = v;\n },\n };\n })();\n return (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.desc)(protoOrTarget, nameOrContext, {\n get() {\n let result = get.call(this);\n if (result === undefined) {\n result = doQuery(this);\n if (result !== null || this.hasUpdated) {\n set.call(this, result);\n }\n }\n return result;\n },\n });\n }\n else {\n // This object works as the return type for both standard and\n // experimental decorators.\n return (0,_base_js__WEBPACK_IMPORTED_MODULE_0__.desc)(protoOrTarget, nameOrContext, {\n get() {\n return doQuery(this);\n },\n });\n }\n });\n}\n//# sourceMappingURL=query.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/query.js?")},"./node_modules/@lit/reactive-element/development/decorators/state.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ state: () => (/* binding */ state)\n/* harmony export */ });\n/* harmony import */ var _property_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./property.js */ "./node_modules/@lit/reactive-element/development/decorators/property.js");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\n/**\n * Declares a private or protected reactive property that still triggers\n * updates to the element when it changes. It does not reflect from the\n * corresponding attribute.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they\'re solely for properties internal to the element. These\n * properties may be renamed by optimization tools like closure compiler.\n * @category Decorator\n */\nfunction state(options) {\n return (0,_property_js__WEBPACK_IMPORTED_MODULE_0__.property)({\n ...options,\n // Add both `state` and `attribute` because we found a third party\n // controller that is keying off of PropertyOptions.state to determine\n // whether a field is a private internal property or not.\n state: true,\n attribute: false,\n });\n}\n//# sourceMappingURL=state.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/decorators/state.js?')},"./node_modules/@lit/reactive-element/development/reactive-element.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CSSResult: () => (/* reexport safe */ _css_tag_js__WEBPACK_IMPORTED_MODULE_0__.CSSResult),\n/* harmony export */ ReactiveElement: () => (/* binding */ ReactiveElement),\n/* harmony export */ adoptStyles: () => (/* reexport safe */ _css_tag_js__WEBPACK_IMPORTED_MODULE_0__.adoptStyles),\n/* harmony export */ css: () => (/* reexport safe */ _css_tag_js__WEBPACK_IMPORTED_MODULE_0__.css),\n/* harmony export */ defaultConverter: () => (/* binding */ defaultConverter),\n/* harmony export */ getCompatibleStyle: () => (/* reexport safe */ _css_tag_js__WEBPACK_IMPORTED_MODULE_0__.getCompatibleStyle),\n/* harmony export */ notEqual: () => (/* binding */ notEqual),\n/* harmony export */ supportsAdoptingStyleSheets: () => (/* reexport safe */ _css_tag_js__WEBPACK_IMPORTED_MODULE_0__.supportsAdoptingStyleSheets),\n/* harmony export */ unsafeCSS: () => (/* reexport safe */ _css_tag_js__WEBPACK_IMPORTED_MODULE_0__.unsafeCSS)\n/* harmony export */ });\n/* harmony import */ var _css_tag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./css-tag.js */ \"./node_modules/@lit/reactive-element/development/css-tag.js\");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/**\n * Use this module if you want to create your own base class extending\n * {@link ReactiveElement}.\n * @packageDocumentation\n */\n\n// In the Node build, this import will be injected by Rollup:\n// import {HTMLElement, customElements} from '@lit-labs/ssr-dom-shim';\n\n// TODO (justinfagnani): Add `hasOwn` here when we ship ES2022\nconst { is, defineProperty, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, } = Object;\nconst NODE_MODE = false;\n// Lets a minifier replace globalThis references with a minified name\nconst global = globalThis;\nif (NODE_MODE) {\n global.customElements ??= customElements;\n}\nconst DEV_MODE = true;\nlet issueWarning;\nconst trustedTypes = global\n .trustedTypes;\n// Temporary workaround for https://crbug.com/993268\n// Currently, any attribute starting with \"on\" is considered to be a\n// TrustedScript source. Such boolean attributes must be set to the equivalent\n// trusted emptyScript value.\nconst emptyStringForBooleanAttribute = trustedTypes\n ? trustedTypes.emptyScript\n : '';\nconst polyfillSupport = DEV_MODE\n ? global.reactiveElementPolyfillSupportDevMode\n : global.reactiveElementPolyfillSupport;\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n const issuedWarnings = (global.litIssuedWarnings ??=\n new Set());\n // Issue a warning, if we haven't already.\n issueWarning = (code, warning) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (!issuedWarnings.has(warning)) {\n console.warn(warning);\n issuedWarnings.add(warning);\n }\n };\n issueWarning('dev-mode', `Lit is in dev mode. Not recommended for production!`);\n // Issue polyfill support warning.\n if (global.ShadyDOM?.inUse && polyfillSupport === undefined) {\n issueWarning('polyfill-support-missing', `Shadow DOM is being polyfilled via \\`ShadyDOM\\` but ` +\n `the \\`polyfill-support\\` module has not been loaded.`);\n }\n}\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event) => {\n const shouldEmit = global\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(new CustomEvent('lit-debug', {\n detail: event,\n }));\n }\n : undefined;\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = (prop, _obj) => prop;\nconst defaultConverter = {\n toAttribute(value, type) {\n switch (type) {\n case Boolean:\n value = value ? emptyStringForBooleanAttribute : null;\n break;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n value = value == null ? value : JSON.stringify(value);\n break;\n }\n return value;\n },\n fromAttribute(value, type) {\n let fromValue = value;\n switch (type) {\n case Boolean:\n fromValue = value !== null;\n break;\n case Number:\n fromValue = value === null ? null : Number(value);\n break;\n case Object:\n case Array:\n // Do *not* generate exception when invalid JSON is set as elements\n // don't normally complain on being mis-configured.\n // TODO(sorvell): Do generate exception in *dev mode*.\n try {\n // Assert to adhere to Bazel's \"must type assert JSON parse\" rule.\n fromValue = JSON.parse(value);\n }\n catch (e) {\n fromValue = null;\n }\n break;\n }\n return fromValue;\n },\n};\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nconst notEqual = (value, old) => !is(value, old);\nconst defaultPropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual,\n};\n// Ensure metadata is enabled. TypeScript does not polyfill\n// Symbol.metadata, so we must ensure that it exists.\nSymbol.metadata ??= Symbol('metadata');\n// Map from a class's metadata object to property options\n// Note that we must use nullish-coalescing assignment so that we only use one\n// map even if we load multiple version of this module.\nglobal.litPropertyMetadata ??= new WeakMap();\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclasses to render updates as desired.\n * @noInheritDoc\n */\nclass ReactiveElement\n// In the Node build, this `extends` clause will be substituted with\n// `(globalThis.HTMLElement ?? HTMLElement)`.\n//\n// This way, we will first prefer any global `HTMLElement` polyfill that the\n// user has assigned, and then fall back to the `HTMLElement` shim which has\n// been imported (see note at the top of this file about how this import is\n// generated by Rollup). Note that the `HTMLElement` variable has been\n// shadowed by this import, so it no longer refers to the global.\n extends HTMLElement {\n /**\n * Adds an initializer function to the class that is called during instance\n * construction.\n *\n * This is useful for code that runs against a `ReactiveElement`\n * subclass, such as a decorator, that needs to do work for each\n * instance, such as setting up a `ReactiveController`.\n *\n * ```ts\n * const myDecorator = (target: typeof ReactiveElement, key: string) => {\n * target.addInitializer((instance: ReactiveElement) => {\n * // This is run during construction of the element\n * new MyController(instance);\n * });\n * }\n * ```\n *\n * Decorating a field will then cause each instance to run an initializer\n * that adds a controller:\n *\n * ```ts\n * class MyElement extends LitElement {\n * @myDecorator foo;\n * }\n * ```\n *\n * Initializers are stored per-constructor. Adding an initializer to a\n * subclass does not add it to a superclass. Since initializers are run in\n * constructors, initializers will run in order of the class hierarchy,\n * starting with superclasses and progressing to the instance's class.\n *\n * @nocollapse\n */\n static addInitializer(initializer) {\n this.__prepare();\n (this._initializers ??= []).push(initializer);\n }\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n * @category attributes\n */\n static get observedAttributes() {\n // Ensure we've created all properties\n this.finalize();\n // this.__attributeToPropertyMap is only undefined after finalize() in\n // ReactiveElement itself. ReactiveElement.observedAttributes is only\n // accessed with ReactiveElement as the receiver when a subclass or mixin\n // calls super.observedAttributes\n return (this.__attributeToPropertyMap && [...this.__attributeToPropertyMap.keys()]);\n }\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a {@linkcode PropertyDeclaration} for the property with the\n * given options. The property setter calls the property's `hasChanged`\n * property option or uses a strict identity check to determine whether or not\n * to request an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * ```ts\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n static createProperty(name, options = defaultPropertyDeclaration) {\n // If this is a state property, force the attribute to false.\n if (options.state) {\n options.attribute = false;\n }\n this.__prepare();\n this.elementProperties.set(name, options);\n if (!options.noAccessor) {\n const key = DEV_MODE\n ? // Use Symbol.for in dev mode to make it easier to maintain state\n // when doing HMR.\n Symbol.for(`${String(name)} (@property() cache)`)\n : Symbol();\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n defineProperty(this.prototype, name, descriptor);\n }\n }\n }\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * ```ts\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n * ```\n *\n * @nocollapse\n * @category properties\n */\n static getPropertyDescriptor(name, key, options) {\n const { get, set } = getOwnPropertyDescriptor(this.prototype, name) ?? {\n get() {\n return this[key];\n },\n set(v) {\n this[key] = v;\n },\n };\n if (DEV_MODE && get == null) {\n if ('value' in (getOwnPropertyDescriptor(this.prototype, name) ?? {})) {\n throw new Error(`Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it's actually declared as a value on the prototype. ` +\n `Usually this is due to using @property or @state on a method.`);\n }\n issueWarning('reactive-property-without-getter', `Field ${JSON.stringify(String(name))} on ` +\n `${this.name} was declared as a reactive property ` +\n `but it does not have a getter. This will be an error in a ` +\n `future version of Lit.`);\n }\n return {\n get() {\n return get?.call(this);\n },\n set(value) {\n const oldValue = get?.call(this);\n set.call(this, value);\n this.requestUpdate(name, oldValue, options);\n },\n configurable: true,\n enumerable: true,\n };\n }\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a `PropertyDeclaration` via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override\n * {@linkcode createProperty}.\n *\n * @nocollapse\n * @final\n * @category properties\n */\n static getPropertyOptions(name) {\n return this.elementProperties.get(name) ?? defaultPropertyDeclaration;\n }\n /**\n * Initializes static own properties of the class used in bookkeeping\n * for element properties, initializers, etc.\n *\n * Can be called multiple times by code that needs to ensure these\n * properties exist before using them.\n *\n * This method ensures the superclass is finalized so that inherited\n * property metadata can be copied down.\n * @nocollapse\n */\n static __prepare() {\n if (this.hasOwnProperty(JSCompiler_renameProperty('elementProperties', this))) {\n // Already prepared\n return;\n }\n // Finalize any superclasses\n const superCtor = getPrototypeOf(this);\n superCtor.finalize();\n // Create own set of initializers for this class if any exist on the\n // superclass and copy them down. Note, for a small perf boost, avoid\n // creating initializers unless needed.\n if (superCtor._initializers !== undefined) {\n this._initializers = [...superCtor._initializers];\n }\n // Initialize elementProperties from the superclass\n this.elementProperties = new Map(superCtor.elementProperties);\n }\n /**\n * Finishes setting up the class so that it's ready to be registered\n * as a custom element and instantiated.\n *\n * This method is called by the ReactiveElement.observedAttributes getter.\n * If you override the observedAttributes getter, you must either call\n * super.observedAttributes to trigger finalization, or call finalize()\n * yourself.\n *\n * @nocollapse\n */\n static finalize() {\n if (this.hasOwnProperty(JSCompiler_renameProperty('finalized', this))) {\n return;\n }\n this.finalized = true;\n this.__prepare();\n // Create properties from the static properties block:\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n const propKeys = [\n ...getOwnPropertyNames(props),\n ...getOwnPropertySymbols(props),\n ];\n for (const p of propKeys) {\n this.createProperty(p, props[p]);\n }\n }\n // Create properties from standard decorator metadata:\n const metadata = this[Symbol.metadata];\n if (metadata !== null) {\n const properties = litPropertyMetadata.get(metadata);\n if (properties !== undefined) {\n for (const [p, options] of properties) {\n this.elementProperties.set(p, options);\n }\n }\n }\n // Create the attribute-to-property map\n this.__attributeToPropertyMap = new Map();\n for (const [p, options] of this.elementProperties) {\n const attr = this.__attributeNameForProperty(p, options);\n if (attr !== undefined) {\n this.__attributeToPropertyMap.set(attr, p);\n }\n }\n this.elementStyles = this.finalizeStyles(this.styles);\n if (DEV_MODE) {\n if (this.hasOwnProperty('createProperty')) {\n issueWarning('no-override-create-property', 'Overriding ReactiveElement.createProperty() is deprecated. ' +\n 'The override will not be called with standard decorators');\n }\n if (this.hasOwnProperty('getPropertyDescriptor')) {\n issueWarning('no-override-get-property-descriptor', 'Overriding ReactiveElement.getPropertyDescriptor() is deprecated. ' +\n 'The override will not be called with standard decorators');\n }\n }\n }\n /**\n * Takes the styles the user supplied via the `static styles` property and\n * returns the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * Styles are deduplicated preserving the _last_ instance in the list. This\n * is a performance optimization to avoid duplicated styles that can occur\n * especially when composing via subclassing. The last item is kept to try\n * to preserve the cascade order with the assumption that it's most important\n * that last added styles override previous styles.\n *\n * @nocollapse\n * @category styles\n */\n static finalizeStyles(styles) {\n const elementStyles = [];\n if (Array.isArray(styles)) {\n // Dedupe the flattened array in reverse order to preserve the last items.\n // Casting to Array works around TS error that\n // appears to come from trying to flatten a type CSSResultArray.\n const set = new Set(styles.flat(Infinity).reverse());\n // Then preserve original order by adding the set items in reverse order.\n for (const s of set) {\n elementStyles.unshift((0,_css_tag_js__WEBPACK_IMPORTED_MODULE_0__.getCompatibleStyle)(s));\n }\n }\n else if (styles !== undefined) {\n elementStyles.push((0,_css_tag_js__WEBPACK_IMPORTED_MODULE_0__.getCompatibleStyle)(styles));\n }\n return elementStyles;\n }\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n static __attributeNameForProperty(name, options) {\n const attribute = options.attribute;\n return attribute === false\n ? undefined\n : typeof attribute === 'string'\n ? attribute\n : typeof name === 'string'\n ? name.toLowerCase()\n : undefined;\n }\n constructor() {\n super();\n this.__instanceProperties = undefined;\n /**\n * True if there is a pending update as a result of calling `requestUpdate()`.\n * Should only be read.\n * @category updates\n */\n this.isUpdatePending = false;\n /**\n * Is set to `true` after the first update. The element code cannot assume\n * that `renderRoot` exists before the element `hasUpdated`.\n * @category updates\n */\n this.hasUpdated = false;\n /**\n * Name of currently reflecting property\n */\n this.__reflectingProperty = null;\n this.__initialize();\n }\n /**\n * Internal only override point for customizing work done when elements\n * are constructed.\n */\n __initialize() {\n this.__updatePromise = new Promise((res) => (this.enableUpdating = res));\n this._$changedProperties = new Map();\n // This enqueues a microtask that ust run before the first update, so it\n // must be called before requestUpdate()\n this.__saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdate();\n this.constructor._initializers?.forEach((i) => i(this));\n }\n /**\n * Registers a `ReactiveController` to participate in the element's reactive\n * update cycle. The element automatically calls into any registered\n * controllers during its lifecycle callbacks.\n *\n * If the element is connected when `addController()` is called, the\n * controller's `hostConnected()` callback will be immediately called.\n * @category controllers\n */\n addController(controller) {\n (this.__controllers ??= new Set()).add(controller);\n // If a controller is added after the element has been connected,\n // call hostConnected. Note, re-using existence of `renderRoot` here\n // (which is set in connectedCallback) to avoid the need to track a\n // first connected state.\n if (this.renderRoot !== undefined && this.isConnected) {\n controller.hostConnected?.();\n }\n }\n /**\n * Removes a `ReactiveController` from the element.\n * @category controllers\n */\n removeController(controller) {\n this.__controllers?.delete(controller);\n }\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n __saveInstanceProperties() {\n const instanceProperties = new Map();\n const elementProperties = this.constructor\n .elementProperties;\n for (const p of elementProperties.keys()) {\n if (this.hasOwnProperty(p)) {\n instanceProperties.set(p, this[p]);\n delete this[p];\n }\n }\n if (instanceProperties.size > 0) {\n this.__instanceProperties = instanceProperties;\n }\n }\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n *\n * @return Returns a node into which to render.\n * @category rendering\n */\n createRenderRoot() {\n const renderRoot = this.shadowRoot ??\n this.attachShadow(this.constructor.shadowRootOptions);\n (0,_css_tag_js__WEBPACK_IMPORTED_MODULE_0__.adoptStyles)(renderRoot, this.constructor.elementStyles);\n return renderRoot;\n }\n /**\n * On first connection, creates the element's renderRoot, sets up\n * element styling, and enables updating.\n * @category lifecycle\n */\n connectedCallback() {\n // Create renderRoot before controllers `hostConnected`\n this.renderRoot ??=\n this.createRenderRoot();\n this.enableUpdating(true);\n this.__controllers?.forEach((c) => c.hostConnected?.());\n }\n /**\n * Note, this method should be considered final and not overridden. It is\n * overridden on the element instance with a function that triggers the first\n * update.\n * @category updates\n */\n enableUpdating(_requestedUpdate) { }\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n * @category lifecycle\n */\n disconnectedCallback() {\n this.__controllers?.forEach((c) => c.hostDisconnected?.());\n }\n /**\n * Synchronizes property values when attributes change.\n *\n * Specifically, when an attribute is set, the corresponding property is set.\n * You should rarely need to implement this callback. If this method is\n * overridden, `super.attributeChangedCallback(name, _old, value)` must be\n * called.\n *\n * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks)\n * on MDN for more information about the `attributeChangedCallback`.\n * @category attributes\n */\n attributeChangedCallback(name, _old, value) {\n this._$attributeToProperty(name, value);\n }\n __propertyToAttribute(name, value) {\n const elemProperties = this.constructor.elementProperties;\n const options = elemProperties.get(name);\n const attr = this.constructor.__attributeNameForProperty(name, options);\n if (attr !== undefined && options.reflect === true) {\n const converter = options.converter?.toAttribute !==\n undefined\n ? options.converter\n : defaultConverter;\n const attrValue = converter.toAttribute(value, options.type);\n if (DEV_MODE &&\n this.constructor.enabledWarnings.includes('migration') &&\n attrValue === undefined) {\n issueWarning('undefined-attribute-value', `The attribute value for the ${name} property is ` +\n `undefined on element ${this.localName}. The attribute will be ` +\n `removed, but in the previous version of \\`ReactiveElement\\`, ` +\n `the attribute would not have changed.`);\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this.__reflectingProperty = name;\n if (attrValue == null) {\n this.removeAttribute(attr);\n }\n else {\n this.setAttribute(attr, attrValue);\n }\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n /** @internal */\n _$attributeToProperty(name, value) {\n const ctor = this.constructor;\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n const propName = ctor.__attributeToPropertyMap.get(name);\n // Use tracking info to avoid reflecting a property value to an attribute\n // if it was just set because the attribute changed.\n if (propName !== undefined && this.__reflectingProperty !== propName) {\n const options = ctor.getPropertyOptions(propName);\n const converter = typeof options.converter === 'function'\n ? { fromAttribute: options.converter }\n : options.converter?.fromAttribute !== undefined\n ? options.converter\n : defaultConverter;\n // mark state reflecting\n this.__reflectingProperty = propName;\n this[propName] = converter.fromAttribute(value, options.type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n );\n // mark state not reflecting\n this.__reflectingProperty = null;\n }\n }\n /**\n * Requests an update which is processed asynchronously. This should be called\n * when an element should update based on some state not triggered by setting\n * a reactive property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored.\n *\n * @param name name of requesting property\n * @param oldValue old value of requesting property\n * @param options property options to use instead of the previously\n * configured options\n * @category updates\n */\n requestUpdate(name, oldValue, options) {\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n if (DEV_MODE && name instanceof Event) {\n issueWarning(``, `The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()`);\n }\n options ??= this.constructor.getPropertyOptions(name);\n const hasChanged = options.hasChanged ?? notEqual;\n const newValue = this[name];\n if (hasChanged(newValue, oldValue)) {\n this._$changeProperty(name, oldValue, options);\n }\n else {\n // Abort the request if the property should not be considered changed.\n return;\n }\n }\n if (this.isUpdatePending === false) {\n this.__updatePromise = this.__enqueueUpdate();\n }\n }\n /**\n * @internal\n */\n _$changeProperty(name, oldValue, options) {\n // TODO (justinfagnani): Create a benchmark of Map.has() + Map.set(\n // vs just Map.set()\n if (!this._$changedProperties.has(name)) {\n this._$changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `__reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true && this.__reflectingProperty !== name) {\n (this.__reflectingProperties ??= new Set()).add(name);\n }\n }\n /**\n * Sets up the element to asynchronously update.\n */\n async __enqueueUpdate() {\n this.isUpdatePending = true;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this.__updatePromise;\n }\n catch (e) {\n // Refire any previous errors async so they do not disrupt the update\n // cycle. Errors are refired so developers have a chance to observe\n // them, and this can be done by implementing\n // `window.onunhandledrejection`.\n Promise.reject(e);\n }\n const result = this.scheduleUpdate();\n // If `scheduleUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this.isUpdatePending;\n }\n /**\n * Schedules an element update. You can override this method to change the\n * timing of updates by returning a Promise. The update will await the\n * returned Promise, and you should resolve the Promise to allow the update\n * to proceed. If this method is overridden, `super.scheduleUpdate()`\n * must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```ts\n * override protected async scheduleUpdate(): Promise {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.scheduleUpdate();\n * }\n * ```\n * @category updates\n */\n scheduleUpdate() {\n const result = this.performUpdate();\n if (DEV_MODE &&\n this.constructor.enabledWarnings.includes('async-perform-update') &&\n typeof result?.then ===\n 'function') {\n issueWarning('async-perform-update', `Element ${this.localName} returned a Promise from performUpdate(). ` +\n `This behavior is deprecated and will be removed in a future ` +\n `version of ReactiveElement.`);\n }\n return result;\n }\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * Call `performUpdate()` to immediately process a pending update. This should\n * generally not be needed, but it can be done in rare cases when you need to\n * update synchronously.\n *\n * @category updates\n */\n performUpdate() {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this.isUpdatePending) {\n return;\n }\n debugLogEvent?.({ kind: 'update' });\n if (!this.hasUpdated) {\n // Create renderRoot before first update. This occurs in `connectedCallback`\n // but is done here to support out of tree calls to `enableUpdating`/`performUpdate`.\n this.renderRoot ??=\n this.createRenderRoot();\n if (DEV_MODE) {\n // Produce warning if any reactive properties on the prototype are\n // shadowed by class fields. Instance fields set before upgrade are\n // deleted by this point, so any own property is caused by class field\n // initialization in the constructor.\n const ctor = this.constructor;\n const shadowedProperties = [...ctor.elementProperties.keys()].filter((p) => this.hasOwnProperty(p) && p in getPrototypeOf(this));\n if (shadowedProperties.length) {\n throw new Error(`The following properties on element ${this.localName} will not ` +\n `trigger updates as expected because they are set using class ` +\n `fields: ${shadowedProperties.join(', ')}. ` +\n `Native class fields and some compiled output will overwrite ` +\n `accessors used for detecting changes. See ` +\n `https://lit.dev/msg/class-field-shadowing ` +\n `for more information.`);\n }\n }\n // Mixin instance properties once, if they exist.\n if (this.__instanceProperties) {\n // TODO (justinfagnani): should we use the stored value? Could a new value\n // have been set since we stored the own property value?\n for (const [p, value] of this.__instanceProperties) {\n this[p] = value;\n }\n this.__instanceProperties = undefined;\n }\n // Trigger initial value reflection and populate the initial\n // changedProperties map, but only for the case of experimental\n // decorators on accessors, which will not have already populated the\n // changedProperties map. We can't know if these accessors had\n // initializers, so we just set them anyway - a difference from\n // experimental decorators on fields and standard decorators on\n // auto-accessors.\n // For context why experimentalDecorators with auto accessors are handled\n // specifically also see:\n // https://github.com/lit/lit/pull/4183#issuecomment-1711959635\n const elementProperties = this.constructor\n .elementProperties;\n if (elementProperties.size > 0) {\n for (const [p, options] of elementProperties) {\n if (options.wrapped === true &&\n !this._$changedProperties.has(p) &&\n this[p] !== undefined) {\n this._$changeProperty(p, this[p], options);\n }\n }\n }\n }\n let shouldUpdate = false;\n const changedProperties = this._$changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.willUpdate(changedProperties);\n this.__controllers?.forEach((c) => c.hostUpdate?.());\n this.update(changedProperties);\n }\n else {\n this.__markUpdated();\n }\n }\n catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this.__markUpdated();\n throw e;\n }\n // The update is no longer considered pending and further updates are now allowed.\n if (shouldUpdate) {\n this._$didUpdate(changedProperties);\n }\n }\n /**\n * Invoked before `update()` to compute values needed during the update.\n *\n * Implement `willUpdate` to compute property values that depend on other\n * properties and are used in the rest of the update process.\n *\n * ```ts\n * willUpdate(changedProperties) {\n * // only need to check changed properties for an expensive computation.\n * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {\n * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);\n * }\n * }\n *\n * render() {\n * return html`SHA: ${this.sha}`;\n * }\n * ```\n *\n * @category updates\n */\n willUpdate(_changedProperties) { }\n // Note, this is an override point for polyfill-support.\n // @internal\n _$didUpdate(changedProperties) {\n this.__controllers?.forEach((c) => c.hostUpdated?.());\n if (!this.hasUpdated) {\n this.hasUpdated = true;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n if (DEV_MODE &&\n this.isUpdatePending &&\n this.constructor.enabledWarnings.includes('change-in-update')) {\n issueWarning('change-in-update', `Element ${this.localName} scheduled an update ` +\n `(generally because a property was set) ` +\n `after an update completed, causing a new update to be scheduled. ` +\n `This is inefficient and should be avoided unless the next update ` +\n `can only be scheduled as a side effect of the previous update.`);\n }\n }\n __markUpdated() {\n this._$changedProperties = new Map();\n this.isUpdatePending = false;\n }\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super.getUpdateComplete()`, then any subsequent state.\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n get updateComplete() {\n return this.getUpdateComplete();\n }\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * ```ts\n * class MyElement extends LitElement {\n * override async getUpdateComplete() {\n * const result = await super.getUpdateComplete();\n * await this._myChild.updateComplete;\n * return result;\n * }\n * }\n * ```\n *\n * @return A promise of a boolean that resolves to true if the update completed\n * without triggering another update.\n * @category updates\n */\n getUpdateComplete() {\n return this.__updatePromise;\n }\n /**\n * Controls whether or not `update()` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n shouldUpdate(_changedProperties) {\n return true;\n }\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n update(_changedProperties) {\n // The forEach() expression will only run when when __reflectingProperties is\n // defined, and it returns undefined, setting __reflectingProperties to\n // undefined\n this.__reflectingProperties &&= this.__reflectingProperties.forEach((p) => this.__propertyToAttribute(p, this[p]));\n this.__markUpdated();\n }\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n updated(_changedProperties) { }\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * ```ts\n * firstUpdated() {\n * this.renderRoot.getElementById('my-text-area').focus();\n * }\n * ```\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n * @category updates\n */\n firstUpdated(_changedProperties) { }\n}\n/**\n * Memoized list of all element styles.\n * Created lazily on user subclasses when finalizing the class.\n * @nocollapse\n * @category styles\n */\nReactiveElement.elementStyles = [];\n/**\n * Options used when calling `attachShadow`. Set this property to customize\n * the options for the shadowRoot; for example, to create a closed\n * shadowRoot: `{mode: 'closed'}`.\n *\n * Note, these options are used in `createRenderRoot`. If this method\n * is customized, options should be respected if possible.\n * @nocollapse\n * @category rendering\n */\nReactiveElement.shadowRootOptions = { mode: 'open' };\n// Assigned here to work around a jscompiler bug with static fields\n// when compiling to ES5.\n// https://github.com/google/closure-compiler/issues/3177\nReactiveElement[JSCompiler_renameProperty('elementProperties', ReactiveElement)] = new Map();\nReactiveElement[JSCompiler_renameProperty('finalized', ReactiveElement)] = new Map();\n// Apply polyfills if available\npolyfillSupport?.({ ReactiveElement });\n// Dev mode warnings...\nif (DEV_MODE) {\n // Default warning set.\n ReactiveElement.enabledWarnings = [\n 'change-in-update',\n 'async-perform-update',\n ];\n const ensureOwnWarnings = function (ctor) {\n if (!ctor.hasOwnProperty(JSCompiler_renameProperty('enabledWarnings', ctor))) {\n ctor.enabledWarnings = ctor.enabledWarnings.slice();\n }\n };\n ReactiveElement.enableWarning = function (warning) {\n ensureOwnWarnings(this);\n if (!this.enabledWarnings.includes(warning)) {\n this.enabledWarnings.push(warning);\n }\n };\n ReactiveElement.disableWarning = function (warning) {\n ensureOwnWarnings(this);\n const i = this.enabledWarnings.indexOf(warning);\n if (i >= 0) {\n this.enabledWarnings.splice(i, 1);\n }\n };\n}\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for ReactiveElement usage.\n(global.reactiveElementVersions ??= []).push('2.0.4');\nif (DEV_MODE && global.reactiveElementVersions.length > 1) {\n issueWarning('multiple-versions', `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`);\n}\n//# sourceMappingURL=reactive-element.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/@lit/reactive-element/development/reactive-element.js?")},"./node_modules/bignumber.js/bignumber.mjs":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ BigNumber: () => (/* binding */ BigNumber),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/*\r\n * bignumber.js v9.1.2\r\n * A JavaScript library for arbitrary-precision arithmetic.\r\n * https://github.com/MikeMcl/bignumber.js\r\n * Copyright (c) 2022 Michael Mclaughlin \r\n * MIT Licensed.\r\n *\r\n * BigNumber.prototype methods | BigNumber methods\r\n * |\r\n * absoluteValue abs | clone\r\n * comparedTo | config set\r\n * decimalPlaces dp | DECIMAL_PLACES\r\n * dividedBy div | ROUNDING_MODE\r\n * dividedToIntegerBy idiv | EXPONENTIAL_AT\r\n * exponentiatedBy pow | RANGE\r\n * integerValue | CRYPTO\r\n * isEqualTo eq | MODULO_MODE\r\n * isFinite | POW_PRECISION\r\n * isGreaterThan gt | FORMAT\r\n * isGreaterThanOrEqualTo gte | ALPHABET\r\n * isInteger | isBigNumber\r\n * isLessThan lt | maximum max\r\n * isLessThanOrEqualTo lte | minimum min\r\n * isNaN | random\r\n * isNegative | sum\r\n * isPositive |\r\n * isZero |\r\n * minus |\r\n * modulo mod |\r\n * multipliedBy times |\r\n * negated |\r\n * plus |\r\n * precision sd |\r\n * shiftedBy |\r\n * squareRoot sqrt |\r\n * toExponential |\r\n * toFixed |\r\n * toFormat |\r\n * toFraction |\r\n * toJSON |\r\n * toNumber |\r\n * toPrecision |\r\n * toString |\r\n * valueOf |\r\n *\r\n */\r\n\r\n\r\nvar\r\n isNumeric = /^-?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i,\r\n mathceil = Math.ceil,\r\n mathfloor = Math.floor,\r\n\r\n bignumberError = '[BigNumber Error] ',\r\n tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ',\r\n\r\n BASE = 1e14,\r\n LOG_BASE = 14,\r\n MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1\r\n // MAX_INT32 = 0x7fffffff, // 2^31 - 1\r\n POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],\r\n SQRT_BASE = 1e7,\r\n\r\n // EDITABLE\r\n // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and\r\n // the arguments to toExponential, toFixed, toFormat, and toPrecision.\r\n MAX = 1E9; // 0 to MAX_INT32\r\n\r\n\r\n/*\r\n * Create and return a BigNumber constructor.\r\n */\r\nfunction clone(configObject) {\r\n var div, convertBase, parseNumeric,\r\n P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },\r\n ONE = new BigNumber(1),\r\n\r\n\r\n //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------\r\n\r\n\r\n // The default values below must be integers within the inclusive ranges stated.\r\n // The values can also be changed at run-time using BigNumber.set.\r\n\r\n // The maximum number of decimal places for operations involving division.\r\n DECIMAL_PLACES = 20, // 0 to MAX\r\n\r\n // The rounding mode used when rounding to the above decimal places, and when using\r\n // toExponential, toFixed, toFormat and toPrecision, and round (default value).\r\n // UP 0 Away from zero.\r\n // DOWN 1 Towards zero.\r\n // CEIL 2 Towards +Infinity.\r\n // FLOOR 3 Towards -Infinity.\r\n // HALF_UP 4 Towards nearest neighbour. If equidistant, up.\r\n // HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\r\n // HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\r\n // HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\r\n // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\r\n ROUNDING_MODE = 4, // 0 to 8\r\n\r\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\r\n\r\n // The exponent value at and beneath which toString returns exponential notation.\r\n // Number type: -7\r\n TO_EXP_NEG = -7, // 0 to -MAX\r\n\r\n // The exponent value at and above which toString returns exponential notation.\r\n // Number type: 21\r\n TO_EXP_POS = 21, // 0 to MAX\r\n\r\n // RANGE : [MIN_EXP, MAX_EXP]\r\n\r\n // The minimum exponent value, beneath which underflow to zero occurs.\r\n // Number type: -324 (5e-324)\r\n MIN_EXP = -1e7, // -1 to -MAX\r\n\r\n // The maximum exponent value, above which overflow to Infinity occurs.\r\n // Number type: 308 (1.7976931348623157e+308)\r\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\r\n MAX_EXP = 1e7, // 1 to MAX\r\n\r\n // Whether to use cryptographically-secure random number generation, if available.\r\n CRYPTO = false, // true or false\r\n\r\n // The modulo mode used when calculating the modulus: a mod n.\r\n // The quotient (q = a / n) is calculated according to the corresponding rounding mode.\r\n // The remainder (r) is calculated as: r = a - n * q.\r\n //\r\n // UP 0 The remainder is positive if the dividend is negative, else is negative.\r\n // DOWN 1 The remainder has the same sign as the dividend.\r\n // This modulo mode is commonly known as 'truncated division' and is\r\n // equivalent to (a % n) in JavaScript.\r\n // FLOOR 3 The remainder has the same sign as the divisor (Python %).\r\n // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\r\n // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\r\n // The remainder is always positive.\r\n //\r\n // The truncated division, floored division, Euclidian division and IEEE 754 remainder\r\n // modes are commonly used for the modulus operation.\r\n // Although the other rounding modes can also be used, they may not give useful results.\r\n MODULO_MODE = 1, // 0 to 9\r\n\r\n // The maximum number of significant digits of the result of the exponentiatedBy operation.\r\n // If POW_PRECISION is 0, there will be unlimited significant digits.\r\n POW_PRECISION = 0, // 0 to MAX\r\n\r\n // The format specification used by the BigNumber.prototype.toFormat method.\r\n FORMAT = {\r\n prefix: '',\r\n groupSize: 3,\r\n secondaryGroupSize: 0,\r\n groupSeparator: ',',\r\n decimalSeparator: '.',\r\n fractionGroupSize: 0,\r\n fractionGroupSeparator: '\\xA0', // non-breaking space\r\n suffix: ''\r\n },\r\n\r\n // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',\r\n // '-', '.', whitespace, or repeated character.\r\n // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'\r\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz',\r\n alphabetHasNormalDecimalDigits = true;\r\n\r\n\r\n //------------------------------------------------------------------------------------------\r\n\r\n\r\n // CONSTRUCTOR\r\n\r\n\r\n /*\r\n * The BigNumber constructor and exported function.\r\n * Create and return a new instance of a BigNumber object.\r\n *\r\n * v {number|string|BigNumber} A numeric value.\r\n * [b] {number} The base of v. Integer, 2 to ALPHABET.length inclusive.\r\n */\r\n function BigNumber(v, b) {\r\n var alphabet, c, caseChanged, e, i, isNum, len, str,\r\n x = this;\r\n\r\n // Enable constructor call without `new`.\r\n if (!(x instanceof BigNumber)) return new BigNumber(v, b);\r\n\r\n if (b == null) {\r\n\r\n if (v && v._isBigNumber === true) {\r\n x.s = v.s;\r\n\r\n if (!v.c || v.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else if (v.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = v.e;\r\n x.c = v.c.slice();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if ((isNum = typeof v == 'number') && v * 0 == 0) {\r\n\r\n // Use `1 / n` to handle minus zero also.\r\n x.s = 1 / v < 0 ? (v = -v, -1) : 1;\r\n\r\n // Fast path for integers, where n < 2147483648 (2**31).\r\n if (v === ~~v) {\r\n for (e = 0, i = v; i >= 10; i /= 10, e++);\r\n\r\n if (e > MAX_EXP) {\r\n x.c = x.e = null;\r\n } else {\r\n x.e = e;\r\n x.c = [v];\r\n }\r\n\r\n return;\r\n }\r\n\r\n str = String(v);\r\n } else {\r\n\r\n if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);\r\n\r\n x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n\r\n // Exponential form?\r\n if ((i = str.search(/e/i)) > 0) {\r\n\r\n // Determine exponent.\r\n if (e < 0) e = i;\r\n e += +str.slice(i + 1);\r\n str = str.substring(0, i);\r\n } else if (e < 0) {\r\n\r\n // Integer.\r\n e = str.length;\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n\r\n // Allow exponential notation to be used with base 10 argument, while\r\n // also rounding to DECIMAL_PLACES as with other bases.\r\n if (b == 10 && alphabetHasNormalDecimalDigits) {\r\n x = new BigNumber(v);\r\n return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);\r\n }\r\n\r\n str = String(v);\r\n\r\n if (isNum = typeof v == 'number') {\r\n\r\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\r\n if (v * 0 != 0) return parseNumeric(x, str, isNum, b);\r\n\r\n x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (BigNumber.DEBUG && str.replace(/^0\\.0*|\\./, '').length > 15) {\r\n throw Error\r\n (tooManyDigits + v);\r\n }\r\n } else {\r\n x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;\r\n }\r\n\r\n alphabet = ALPHABET.slice(0, b);\r\n e = i = 0;\r\n\r\n // Check that str is a valid base b number.\r\n // Don't use RegExp, so alphabet can contain special characters.\r\n for (len = str.length; i < len; i++) {\r\n if (alphabet.indexOf(c = str.charAt(i)) < 0) {\r\n if (c == '.') {\r\n\r\n // If '.' is not the first character and it has not be found before.\r\n if (i > e) {\r\n e = len;\r\n continue;\r\n }\r\n } else if (!caseChanged) {\r\n\r\n // Allow e.g. hexadecimal 'FF' as well as 'ff'.\r\n if (str == str.toUpperCase() && (str = str.toLowerCase()) ||\r\n str == str.toLowerCase() && (str = str.toUpperCase())) {\r\n caseChanged = true;\r\n i = -1;\r\n e = 0;\r\n continue;\r\n }\r\n }\r\n\r\n return parseNumeric(x, String(v), isNum, b);\r\n }\r\n }\r\n\r\n // Prevent later check for length on converted number.\r\n isNum = false;\r\n str = convertBase(str, b, 10, x.s);\r\n\r\n // Decimal point?\r\n if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');\r\n else e = str.length;\r\n }\r\n\r\n // Determine leading zeros.\r\n for (i = 0; str.charCodeAt(i) === 48; i++);\r\n\r\n // Determine trailing zeros.\r\n for (len = str.length; str.charCodeAt(--len) === 48;);\r\n\r\n if (str = str.slice(i, ++len)) {\r\n len -= i;\r\n\r\n // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'\r\n if (isNum && BigNumber.DEBUG &&\r\n len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {\r\n throw Error\r\n (tooManyDigits + (x.s * v));\r\n }\r\n\r\n // Overflow?\r\n if ((e = e - i - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n x.c = x.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n } else {\r\n x.e = e;\r\n x.c = [];\r\n\r\n // Transform base\r\n\r\n // e is the base 10 exponent.\r\n // i is where to slice str to get the first element of the coefficient array.\r\n i = (e + 1) % LOG_BASE;\r\n if (e < 0) i += LOG_BASE; // i < 1\r\n\r\n if (i < len) {\r\n if (i) x.c.push(+str.slice(0, i));\r\n\r\n for (len -= LOG_BASE; i < len;) {\r\n x.c.push(+str.slice(i, i += LOG_BASE));\r\n }\r\n\r\n i = LOG_BASE - (str = str.slice(i)).length;\r\n } else {\r\n i -= len;\r\n }\r\n\r\n for (; i--; str += '0');\r\n x.c.push(+str);\r\n }\r\n } else {\r\n\r\n // Zero.\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n\r\n // CONSTRUCTOR PROPERTIES\r\n\r\n\r\n BigNumber.clone = clone;\r\n\r\n BigNumber.ROUND_UP = 0;\r\n BigNumber.ROUND_DOWN = 1;\r\n BigNumber.ROUND_CEIL = 2;\r\n BigNumber.ROUND_FLOOR = 3;\r\n BigNumber.ROUND_HALF_UP = 4;\r\n BigNumber.ROUND_HALF_DOWN = 5;\r\n BigNumber.ROUND_HALF_EVEN = 6;\r\n BigNumber.ROUND_HALF_CEIL = 7;\r\n BigNumber.ROUND_HALF_FLOOR = 8;\r\n BigNumber.EUCLID = 9;\r\n\r\n\r\n /*\r\n * Configure infrequently-changing library-wide settings.\r\n *\r\n * Accept an object with the following optional properties (if the value of a property is\r\n * a number, it must be an integer within the inclusive range stated):\r\n *\r\n * DECIMAL_PLACES {number} 0 to MAX\r\n * ROUNDING_MODE {number} 0 to 8\r\n * EXPONENTIAL_AT {number|number[]} -MAX to MAX or [-MAX to 0, 0 to MAX]\r\n * RANGE {number|number[]} -MAX to MAX (not zero) or [-MAX to -1, 1 to MAX]\r\n * CRYPTO {boolean} true or false\r\n * MODULO_MODE {number} 0 to 9\r\n * POW_PRECISION {number} 0 to MAX\r\n * ALPHABET {string} A string of two or more unique characters which does\r\n * not contain '.'.\r\n * FORMAT {object} An object with some of the following properties:\r\n * prefix {string}\r\n * groupSize {number}\r\n * secondaryGroupSize {number}\r\n * groupSeparator {string}\r\n * decimalSeparator {string}\r\n * fractionGroupSize {number}\r\n * fractionGroupSeparator {string}\r\n * suffix {string}\r\n *\r\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\r\n *\r\n * E.g.\r\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\r\n *\r\n * Ignore properties/parameters set to null or undefined, except for ALPHABET.\r\n *\r\n * Return an object with the properties current values.\r\n */\r\n BigNumber.config = BigNumber.set = function (obj) {\r\n var p, v;\r\n\r\n if (obj != null) {\r\n\r\n if (typeof obj == 'object') {\r\n\r\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n DECIMAL_PLACES = v;\r\n }\r\n\r\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\r\n // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 8, p);\r\n ROUNDING_MODE = v;\r\n }\r\n\r\n // EXPONENTIAL_AT {number|number[]}\r\n // Integer, -MAX to MAX inclusive or\r\n // [integer -MAX to 0 inclusive, 0 to MAX inclusive].\r\n // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, 0, p);\r\n intCheck(v[1], 0, MAX, p);\r\n TO_EXP_NEG = v[0];\r\n TO_EXP_POS = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);\r\n }\r\n }\r\n\r\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\r\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\r\n // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'\r\n if (obj.hasOwnProperty(p = 'RANGE')) {\r\n v = obj[p];\r\n if (v && v.pop) {\r\n intCheck(v[0], -MAX, -1, p);\r\n intCheck(v[1], 1, MAX, p);\r\n MIN_EXP = v[0];\r\n MAX_EXP = v[1];\r\n } else {\r\n intCheck(v, -MAX, MAX, p);\r\n if (v) {\r\n MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' cannot be zero: ' + v);\r\n }\r\n }\r\n }\r\n\r\n // CRYPTO {boolean} true or false.\r\n // '[BigNumber Error] CRYPTO not true or false: {v}'\r\n // '[BigNumber Error] crypto unavailable'\r\n if (obj.hasOwnProperty(p = 'CRYPTO')) {\r\n v = obj[p];\r\n if (v === !!v) {\r\n if (v) {\r\n if (typeof crypto != 'undefined' && crypto &&\r\n (crypto.getRandomValues || crypto.randomBytes)) {\r\n CRYPTO = v;\r\n } else {\r\n CRYPTO = !v;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n } else {\r\n CRYPTO = v;\r\n }\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' not true or false: ' + v);\r\n }\r\n }\r\n\r\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\r\n // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'MODULO_MODE')) {\r\n v = obj[p];\r\n intCheck(v, 0, 9, p);\r\n MODULO_MODE = v;\r\n }\r\n\r\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\r\n // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'\r\n if (obj.hasOwnProperty(p = 'POW_PRECISION')) {\r\n v = obj[p];\r\n intCheck(v, 0, MAX, p);\r\n POW_PRECISION = v;\r\n }\r\n\r\n // FORMAT {object}\r\n // '[BigNumber Error] FORMAT not an object: {v}'\r\n if (obj.hasOwnProperty(p = 'FORMAT')) {\r\n v = obj[p];\r\n if (typeof v == 'object') FORMAT = v;\r\n else throw Error\r\n (bignumberError + p + ' not an object: ' + v);\r\n }\r\n\r\n // ALPHABET {string}\r\n // '[BigNumber Error] ALPHABET invalid: {v}'\r\n if (obj.hasOwnProperty(p = 'ALPHABET')) {\r\n v = obj[p];\r\n\r\n // Disallow if less than two characters,\r\n // or if it contains '+', '-', '.', whitespace, or a repeated character.\r\n if (typeof v == 'string' && !/^.?$|[+\\-.\\s]|(.).*\\1/.test(v)) {\r\n alphabetHasNormalDecimalDigits = v.slice(0, 10) == '0123456789';\r\n ALPHABET = v;\r\n } else {\r\n throw Error\r\n (bignumberError + p + ' invalid: ' + v);\r\n }\r\n }\r\n\r\n } else {\r\n\r\n // '[BigNumber Error] Object expected: {v}'\r\n throw Error\r\n (bignumberError + 'Object expected: ' + obj);\r\n }\r\n }\r\n\r\n return {\r\n DECIMAL_PLACES: DECIMAL_PLACES,\r\n ROUNDING_MODE: ROUNDING_MODE,\r\n EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],\r\n RANGE: [MIN_EXP, MAX_EXP],\r\n CRYPTO: CRYPTO,\r\n MODULO_MODE: MODULO_MODE,\r\n POW_PRECISION: POW_PRECISION,\r\n FORMAT: FORMAT,\r\n ALPHABET: ALPHABET\r\n };\r\n };\r\n\r\n\r\n /*\r\n * Return true if v is a BigNumber instance, otherwise return false.\r\n *\r\n * If BigNumber.DEBUG is true, throw if a BigNumber instance is not well-formed.\r\n *\r\n * v {any}\r\n *\r\n * '[BigNumber Error] Invalid BigNumber: {v}'\r\n */\r\n BigNumber.isBigNumber = function (v) {\r\n if (!v || v._isBigNumber !== true) return false;\r\n if (!BigNumber.DEBUG) return true;\r\n\r\n var i, n,\r\n c = v.c,\r\n e = v.e,\r\n s = v.s;\r\n\r\n out: if ({}.toString.call(c) == '[object Array]') {\r\n\r\n if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {\r\n\r\n // If the first element is zero, the BigNumber value must be zero.\r\n if (c[0] === 0) {\r\n if (e === 0 && c.length === 1) return true;\r\n break out;\r\n }\r\n\r\n // Calculate number of digits that c[0] should have, based on the exponent.\r\n i = (e + 1) % LOG_BASE;\r\n if (i < 1) i += LOG_BASE;\r\n\r\n // Calculate number of digits of c[0].\r\n //if (Math.ceil(Math.log(c[0] + 1) / Math.LN10) == i) {\r\n if (String(c[0]).length == i) {\r\n\r\n for (i = 0; i < c.length; i++) {\r\n n = c[i];\r\n if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;\r\n }\r\n\r\n // Last element cannot be zero, unless it is the only element.\r\n if (n !== 0) return true;\r\n }\r\n }\r\n\r\n // Infinity/NaN\r\n } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {\r\n return true;\r\n }\r\n\r\n throw Error\r\n (bignumberError + 'Invalid BigNumber: ' + v);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the maximum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.maximum = BigNumber.max = function () {\r\n return maxOrMin(arguments, -1);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the minimum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.minimum = BigNumber.min = function () {\r\n return maxOrMin(arguments, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\r\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\r\n * zeros are produced).\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'\r\n * '[BigNumber Error] crypto unavailable'\r\n */\r\n BigNumber.random = (function () {\r\n var pow2_53 = 0x20000000000000;\r\n\r\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\r\n // Check if Math.random() produces more than 32 bits of randomness.\r\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\r\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\r\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\r\n ? function () { return mathfloor(Math.random() * pow2_53); }\r\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\r\n (Math.random() * 0x800000 | 0); };\r\n\r\n return function (dp) {\r\n var a, b, e, k, v,\r\n i = 0,\r\n c = [],\r\n rand = new BigNumber(ONE);\r\n\r\n if (dp == null) dp = DECIMAL_PLACES;\r\n else intCheck(dp, 0, MAX);\r\n\r\n k = mathceil(dp / LOG_BASE);\r\n\r\n if (CRYPTO) {\r\n\r\n // Browsers supporting crypto.getRandomValues.\r\n if (crypto.getRandomValues) {\r\n\r\n a = crypto.getRandomValues(new Uint32Array(k *= 2));\r\n\r\n for (; i < k;) {\r\n\r\n // 53 bits:\r\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\r\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\r\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\r\n // 11111 11111111 11111111\r\n // 0x20000 is 2^21.\r\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\r\n\r\n // Rejection sampling:\r\n // 0 <= v < 9007199254740992\r\n // Probability that v >= 9e15, is\r\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\r\n if (v >= 9e15) {\r\n b = crypto.getRandomValues(new Uint32Array(2));\r\n a[i] = b[0];\r\n a[i + 1] = b[1];\r\n } else {\r\n\r\n // 0 <= v <= 8999999999999999\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 2;\r\n }\r\n }\r\n i = k / 2;\r\n\r\n // Node.js supporting crypto.randomBytes.\r\n } else if (crypto.randomBytes) {\r\n\r\n // buffer\r\n a = crypto.randomBytes(k *= 7);\r\n\r\n for (; i < k;) {\r\n\r\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\r\n // 0x100000000 is 2^32, 0x1000000 is 2^24\r\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\r\n // 0 <= v < 9007199254740992\r\n v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +\r\n (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +\r\n (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];\r\n\r\n if (v >= 9e15) {\r\n crypto.randomBytes(7).copy(a, i);\r\n } else {\r\n\r\n // 0 <= (v % 1e14) <= 99999999999999\r\n c.push(v % 1e14);\r\n i += 7;\r\n }\r\n }\r\n i = k / 7;\r\n } else {\r\n CRYPTO = false;\r\n throw Error\r\n (bignumberError + 'crypto unavailable');\r\n }\r\n }\r\n\r\n // Use Math.random.\r\n if (!CRYPTO) {\r\n\r\n for (; i < k;) {\r\n v = random53bitInt();\r\n if (v < 9e15) c[i++] = v % 1e14;\r\n }\r\n }\r\n\r\n k = c[--i];\r\n dp %= LOG_BASE;\r\n\r\n // Convert trailing digits to zeros according to dp.\r\n if (k && dp) {\r\n v = POWS_TEN[LOG_BASE - dp];\r\n c[i] = mathfloor(k / v) * v;\r\n }\r\n\r\n // Remove trailing elements which are zero.\r\n for (; c[i] === 0; c.pop(), i--);\r\n\r\n // Zero?\r\n if (i < 0) {\r\n c = [e = 0];\r\n } else {\r\n\r\n // Remove leading elements which are zero and adjust exponent accordingly.\r\n for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);\r\n\r\n // Count the digits of the first element of c to determine leading zeros, and...\r\n for (i = 1, v = c[0]; v >= 10; v /= 10, i++);\r\n\r\n // adjust the exponent accordingly.\r\n if (i < LOG_BASE) e -= LOG_BASE - i;\r\n }\r\n\r\n rand.e = e;\r\n rand.c = c;\r\n return rand;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the sum of the arguments.\r\n *\r\n * arguments {number|string|BigNumber}\r\n */\r\n BigNumber.sum = function () {\r\n var i = 1,\r\n args = arguments,\r\n sum = new BigNumber(args[0]);\r\n for (; i < args.length;) sum = sum.plus(args[i++]);\r\n return sum;\r\n };\r\n\r\n\r\n // PRIVATE FUNCTIONS\r\n\r\n\r\n // Called by BigNumber and BigNumber.prototype.toString.\r\n convertBase = (function () {\r\n var decimal = '0123456789';\r\n\r\n /*\r\n * Convert string of baseIn to an array of numbers of baseOut.\r\n * Eg. toBaseOut('255', 10, 16) returns [15, 15].\r\n * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].\r\n */\r\n function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }\r\n\r\n // Convert a numeric string of baseIn to a numeric string of baseOut.\r\n // If the caller is toString, we are converting from base 10 to baseOut.\r\n // If the caller is BigNumber, we are converting from baseIn to base 10.\r\n return function (str, baseIn, baseOut, sign, callerIsToString) {\r\n var alphabet, d, e, k, r, x, xc, y,\r\n i = str.indexOf('.'),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n // Non-integer.\r\n if (i >= 0) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace('.', '');\r\n y = new BigNumber(baseIn);\r\n x = y.pow(str.length - i);\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n\r\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),\r\n 10, baseOut, decimal);\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n\r\n xc = toBaseOut(str, baseIn, baseOut, callerIsToString\r\n ? (alphabet = ALPHABET, decimal)\r\n : (alphabet = decimal, ALPHABET));\r\n\r\n // xc now represents str as an integer and converted to baseOut. e is the exponent.\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for (; xc[--k] == 0; xc.pop());\r\n\r\n // Zero?\r\n if (!xc[0]) return alphabet.charAt(0);\r\n\r\n // Does str represent an integer? If so, no need for the division.\r\n if (i < 0) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // The sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div(x, y, dp, rm, baseOut);\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n // xc now represents str converted to baseOut.\r\n\r\n // THe index of the rounding digit.\r\n d = e + dp + 1;\r\n\r\n // The rounding digit: the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n\r\n // Look at the rounding digits and mode to determine whether to round up.\r\n\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n // If the index of the rounding digit is not greater than zero, or xc represents\r\n // zero, then the result of the base conversion is zero or, if rounding up, a value\r\n // such as 0.00001.\r\n if (d < 1 || !xc[0]) {\r\n\r\n // 1^-dp or 0\r\n str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);\r\n } else {\r\n\r\n // Truncate xc to the required number of decimal places.\r\n xc.length = d;\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for (--baseOut; ++xc[--d] > baseOut;) {\r\n xc[d] = 0;\r\n\r\n if (!d) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (k = xc.length; !xc[--k];);\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));\r\n\r\n // Add leading zeros, decimal point and trailing zeros as required.\r\n str = toFixedPoint(str, e, alphabet.charAt(0));\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n };\r\n })();\r\n\r\n\r\n // Perform division in the specified base. Called by div and convertBase.\r\n div = (function () {\r\n\r\n // Assume non-zero x and k.\r\n function multiply(x, k, base) {\r\n var m, temp, xlo, xhi,\r\n carry = 0,\r\n i = x.length,\r\n klo = k % SQRT_BASE,\r\n khi = k / SQRT_BASE | 0;\r\n\r\n for (x = x.slice(); i--;) {\r\n xlo = x[i] % SQRT_BASE;\r\n xhi = x[i] / SQRT_BASE | 0;\r\n m = khi * xlo + xhi * klo;\r\n temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;\r\n carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;\r\n x[i] = temp % base;\r\n }\r\n\r\n if (carry) x = [carry].concat(x);\r\n\r\n return x;\r\n }\r\n\r\n function compare(a, b, aL, bL) {\r\n var i, cmp;\r\n\r\n if (aL != bL) {\r\n cmp = aL > bL ? 1 : -1;\r\n } else {\r\n\r\n for (i = cmp = 0; i < aL; i++) {\r\n\r\n if (a[i] != b[i]) {\r\n cmp = a[i] > b[i] ? 1 : -1;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n function subtract(a, b, aL, base) {\r\n var i = 0;\r\n\r\n // Subtract b from a.\r\n for (; aL--;) {\r\n a[aL] -= i;\r\n i = a[aL] < b[aL] ? 1 : 0;\r\n a[aL] = i * base + a[aL] - b[aL];\r\n }\r\n\r\n // Remove leading zeros.\r\n for (; !a[0] && a.length > 1; a.splice(0, 1));\r\n }\r\n\r\n // x: dividend, y: divisor.\r\n return function (x, y, dp, rm, base) {\r\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\r\n yL, yz,\r\n s = x.s == y.s ? 1 : -1,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n // Either NaN, Infinity or 0?\r\n if (!xc || !xc[0] || !yc || !yc[0]) {\r\n\r\n return new BigNumber(\r\n\r\n // Return NaN if either NaN, or both Infinity or 0.\r\n !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :\r\n\r\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\r\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\r\n );\r\n }\r\n\r\n q = new BigNumber(s);\r\n qc = q.c = [];\r\n e = x.e - y.e;\r\n s = dp + e + 1;\r\n\r\n if (!base) {\r\n base = BASE;\r\n e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);\r\n s = s / LOG_BASE | 0;\r\n }\r\n\r\n // Result exponent may be one less then the current value of e.\r\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\r\n for (i = 0; yc[i] == (xc[i] || 0); i++);\r\n\r\n if (yc[i] > (xc[i] || 0)) e--;\r\n\r\n if (s < 0) {\r\n qc.push(1);\r\n more = true;\r\n } else {\r\n xL = xc.length;\r\n yL = yc.length;\r\n i = 0;\r\n s += 2;\r\n\r\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\r\n\r\n n = mathfloor(base / (yc[0] + 1));\r\n\r\n // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.\r\n // if (n > 1 || n++ == 1 && yc[0] < base / 2) {\r\n if (n > 1) {\r\n yc = multiply(yc, n, base);\r\n xc = multiply(xc, n, base);\r\n yL = yc.length;\r\n xL = xc.length;\r\n }\r\n\r\n xi = yL;\r\n rem = xc.slice(0, yL);\r\n remL = rem.length;\r\n\r\n // Add zeros to make remainder as long as divisor.\r\n for (; remL < yL; rem[remL++] = 0);\r\n yz = yc.slice();\r\n yz = [0].concat(yz);\r\n yc0 = yc[0];\r\n if (yc[1] >= base / 2) yc0++;\r\n // Not necessary, but to prevent trial digit n > base, when using base 3.\r\n // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;\r\n\r\n do {\r\n n = 0;\r\n\r\n // Compare divisor and remainder.\r\n cmp = compare(yc, rem, yL, remL);\r\n\r\n // If divisor < remainder.\r\n if (cmp < 0) {\r\n\r\n // Calculate trial digit, n.\r\n\r\n rem0 = rem[0];\r\n if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);\r\n\r\n // n is how many times the divisor goes into the current remainder.\r\n n = mathfloor(rem0 / yc0);\r\n\r\n // Algorithm:\r\n // product = divisor multiplied by trial digit (n).\r\n // Compare product and remainder.\r\n // If product is greater than remainder:\r\n // Subtract divisor from product, decrement trial digit.\r\n // Subtract product from remainder.\r\n // If product was less than remainder at the last compare:\r\n // Compare new remainder and divisor.\r\n // If remainder is greater than divisor:\r\n // Subtract divisor from remainder, increment trial digit.\r\n\r\n if (n > 1) {\r\n\r\n // n may be > base only when base is 3.\r\n if (n >= base) n = base - 1;\r\n\r\n // product = divisor * trial digit.\r\n prod = multiply(yc, n, base);\r\n prodL = prod.length;\r\n remL = rem.length;\r\n\r\n // Compare product and remainder.\r\n // If product > remainder then trial digit n too high.\r\n // n is 1 too high about 5% of the time, and is not known to have\r\n // ever been more than 1 too high.\r\n while (compare(prod, rem, prodL, remL) == 1) {\r\n n--;\r\n\r\n // Subtract divisor from product.\r\n subtract(prod, yL < prodL ? yz : yc, prodL, base);\r\n prodL = prod.length;\r\n cmp = 1;\r\n }\r\n } else {\r\n\r\n // n is 0 or 1, cmp is -1.\r\n // If n is 0, there is no need to compare yc and rem again below,\r\n // so change cmp to 1 to avoid it.\r\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\r\n if (n == 0) {\r\n\r\n // divisor < remainder, so n must be at least 1.\r\n cmp = n = 1;\r\n }\r\n\r\n // product = divisor\r\n prod = yc.slice();\r\n prodL = prod.length;\r\n }\r\n\r\n if (prodL < remL) prod = [0].concat(prod);\r\n\r\n // Subtract product from remainder.\r\n subtract(rem, prod, remL, base);\r\n remL = rem.length;\r\n\r\n // If product was < remainder.\r\n if (cmp == -1) {\r\n\r\n // Compare divisor and new remainder.\r\n // If divisor < new remainder, subtract divisor from remainder.\r\n // Trial digit n too low.\r\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\r\n while (compare(yc, rem, yL, remL) < 1) {\r\n n++;\r\n\r\n // Subtract divisor from remainder.\r\n subtract(rem, yL < remL ? yz : yc, remL, base);\r\n remL = rem.length;\r\n }\r\n }\r\n } else if (cmp === 0) {\r\n n++;\r\n rem = [0];\r\n } // else cmp === 1 and n will be 0\r\n\r\n // Add the next digit, n, to the result array.\r\n qc[i++] = n;\r\n\r\n // Update the remainder.\r\n if (rem[0]) {\r\n rem[remL++] = xc[xi] || 0;\r\n } else {\r\n rem = [xc[xi]];\r\n remL = 1;\r\n }\r\n } while ((xi++ < xL || rem[0] != null) && s--);\r\n\r\n more = rem[0] != null;\r\n\r\n // Leading zero?\r\n if (!qc[0]) qc.splice(0, 1);\r\n }\r\n\r\n if (base == BASE) {\r\n\r\n // To calculate q.e, first get the number of digits of qc[0].\r\n for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);\r\n\r\n round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);\r\n\r\n // Caller is convertBase.\r\n } else {\r\n q.e = e;\r\n q.r = +more;\r\n }\r\n\r\n return q;\r\n };\r\n })();\r\n\r\n\r\n /*\r\n * Return a string representing the value of BigNumber n in fixed-point or exponential\r\n * notation rounded to the specified decimal places or significant digits.\r\n *\r\n * n: a BigNumber.\r\n * i: the index of the last digit required (i.e. the digit that may be rounded up).\r\n * rm: the rounding mode.\r\n * id: 1 (toExponential) or 2 (toPrecision).\r\n */\r\n function format(n, i, rm, id) {\r\n var c0, e, ne, len, str;\r\n\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n if (!n.c) return n.toString();\r\n\r\n c0 = n.c[0];\r\n ne = n.e;\r\n\r\n if (i == null) {\r\n str = coeffToString(n.c);\r\n str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)\r\n ? toExponential(str, ne)\r\n : toFixedPoint(str, ne, '0');\r\n } else {\r\n n = round(new BigNumber(n), i, rm);\r\n\r\n // n.e may have changed if the value was rounded up.\r\n e = n.e;\r\n\r\n str = coeffToString(n.c);\r\n len = str.length;\r\n\r\n // toPrecision returns exponential notation if the number of significant digits\r\n // specified is less than the number of digits necessary to represent the integer\r\n // part of the value in fixed-point notation.\r\n\r\n // Exponential notation.\r\n if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {\r\n\r\n // Append zeros?\r\n for (; len < i; str += '0', len++);\r\n str = toExponential(str, e);\r\n\r\n // Fixed-point notation.\r\n } else {\r\n i -= ne;\r\n str = toFixedPoint(str, e, '0');\r\n\r\n // Append zeros?\r\n if (e + 1 > len) {\r\n if (--i > 0) for (str += '.'; i--; str += '0');\r\n } else {\r\n i += e - len;\r\n if (i > 0) {\r\n if (e + 1 == len) str += '.';\r\n for (; i--; str += '0');\r\n }\r\n }\r\n }\r\n }\r\n\r\n return n.s < 0 && c0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // Handle BigNumber.max and BigNumber.min.\r\n // If any number is NaN, return NaN.\r\n function maxOrMin(args, n) {\r\n var k, y,\r\n i = 1,\r\n x = new BigNumber(args[0]);\r\n\r\n for (; i < args.length; i++) {\r\n y = new BigNumber(args[i]);\r\n if (!y.s || (k = compare(x, y)) === n || k === 0 && x.s === n) {\r\n x = y;\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n /*\r\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\r\n * Called by minus, plus and times.\r\n */\r\n function normalise(n, c, e) {\r\n var i = 1,\r\n j = c.length;\r\n\r\n // Remove trailing zeros.\r\n for (; !c[--j]; c.pop());\r\n\r\n // Calculate the base 10 exponent. First get the number of digits of c[0].\r\n for (j = c[0]; j >= 10; j /= 10, i++);\r\n\r\n // Overflow?\r\n if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {\r\n\r\n // Infinity.\r\n n.c = n.e = null;\r\n\r\n // Underflow?\r\n } else if (e < MIN_EXP) {\r\n\r\n // Zero.\r\n n.c = [n.e = 0];\r\n } else {\r\n n.e = e;\r\n n.c = c;\r\n }\r\n\r\n return n;\r\n }\r\n\r\n\r\n // Handle values that fail the validity test in BigNumber.\r\n parseNumeric = (function () {\r\n var basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i,\r\n dotAfter = /^([^.]+)\\.$/,\r\n dotBefore = /^\\.([^.]+)$/,\r\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\r\n whitespaceOrPlus = /^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g;\r\n\r\n return function (x, str, isNum, b) {\r\n var base,\r\n s = isNum ? str : str.replace(whitespaceOrPlus, '');\r\n\r\n // No exception on ±Infinity or NaN.\r\n if (isInfinityOrNaN.test(s)) {\r\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\r\n } else {\r\n if (!isNum) {\r\n\r\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\r\n s = s.replace(basePrefix, function (m, p1, p2) {\r\n base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\r\n return !b || b == base ? p1 : m;\r\n });\r\n\r\n if (b) {\r\n base = b;\r\n\r\n // E.g. '1.' to '1', '.1' to '0.1'\r\n s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');\r\n }\r\n\r\n if (str != s) return new BigNumber(s, base);\r\n }\r\n\r\n // '[BigNumber Error] Not a number: {n}'\r\n // '[BigNumber Error] Not a base {b} number: {n}'\r\n if (BigNumber.DEBUG) {\r\n throw Error\r\n (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);\r\n }\r\n\r\n // NaN\r\n x.s = null;\r\n }\r\n\r\n x.c = x.e = null;\r\n }\r\n })();\r\n\r\n\r\n /*\r\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\r\n * If r is truthy, it is known that there are more digits after the rounding digit.\r\n */\r\n function round(x, sd, rm, r) {\r\n var d, i, j, k, n, ni, rd,\r\n xc = x.c,\r\n pows10 = POWS_TEN;\r\n\r\n // if x is not Infinity or NaN...\r\n if (xc) {\r\n\r\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\r\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\r\n // ni is the index of n within x.c.\r\n // d is the number of digits of n.\r\n // i is the index of rd within n including leading zeros.\r\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\r\n out: {\r\n\r\n // Get the number of digits of the first element of xc.\r\n for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);\r\n i = sd - d;\r\n\r\n // If the rounding digit is in the first element of xc...\r\n if (i < 0) {\r\n i += LOG_BASE;\r\n j = sd;\r\n n = xc[ni = 0];\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = mathfloor(n / pows10[d - j - 1] % 10);\r\n } else {\r\n ni = mathceil((i + 1) / LOG_BASE);\r\n\r\n if (ni >= xc.length) {\r\n\r\n if (r) {\r\n\r\n // Needed by sqrt.\r\n for (; xc.length <= ni; xc.push(0));\r\n n = rd = 0;\r\n d = 1;\r\n i %= LOG_BASE;\r\n j = i - LOG_BASE + 1;\r\n } else {\r\n break out;\r\n }\r\n } else {\r\n n = k = xc[ni];\r\n\r\n // Get the number of digits of n.\r\n for (d = 1; k >= 10; k /= 10, d++);\r\n\r\n // Get the index of rd within n.\r\n i %= LOG_BASE;\r\n\r\n // Get the index of rd within n, adjusted for leading zeros.\r\n // The number of leading zeros of n is given by LOG_BASE - d.\r\n j = i - LOG_BASE + d;\r\n\r\n // Get the rounding digit at index j of n.\r\n rd = j < 0 ? 0 : mathfloor(n / pows10[d - j - 1] % 10);\r\n }\r\n }\r\n\r\n r = r || sd < 0 ||\r\n\r\n // Are there any non-zero digits after the rounding digit?\r\n // The expression n % pows10[d - j - 1] returns all digits of n to the right\r\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\r\n xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);\r\n\r\n r = rm < 4\r\n ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))\r\n : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&\r\n\r\n // Check whether the digit to the left of the rounding digit is odd.\r\n ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||\r\n rm == (x.s < 0 ? 8 : 7));\r\n\r\n if (sd < 1 || !xc[0]) {\r\n xc.length = 0;\r\n\r\n if (r) {\r\n\r\n // Convert sd to decimal places.\r\n sd -= x.e + 1;\r\n\r\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\r\n xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];\r\n x.e = -sd || 0;\r\n } else {\r\n\r\n // Zero.\r\n xc[0] = x.e = 0;\r\n }\r\n\r\n return x;\r\n }\r\n\r\n // Remove excess digits.\r\n if (i == 0) {\r\n xc.length = ni;\r\n k = 1;\r\n ni--;\r\n } else {\r\n xc.length = ni + 1;\r\n k = pows10[LOG_BASE - i];\r\n\r\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\r\n // j > 0 means i > number of leading zeros of n.\r\n xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;\r\n }\r\n\r\n // Round up?\r\n if (r) {\r\n\r\n for (; ;) {\r\n\r\n // If the digit to be rounded up is in the first element of xc...\r\n if (ni == 0) {\r\n\r\n // i will be the length of xc[0] before k is added.\r\n for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);\r\n j = xc[0] += k;\r\n for (k = 1; j >= 10; j /= 10, k++);\r\n\r\n // if i != k the length has increased.\r\n if (i != k) {\r\n x.e++;\r\n if (xc[0] == BASE) xc[0] = 1;\r\n }\r\n\r\n break;\r\n } else {\r\n xc[ni] += k;\r\n if (xc[ni] != BASE) break;\r\n xc[ni--] = 0;\r\n k = 1;\r\n }\r\n }\r\n }\r\n\r\n // Remove trailing zeros.\r\n for (i = xc.length; xc[--i] === 0; xc.pop());\r\n }\r\n\r\n // Overflow? Infinity.\r\n if (x.e > MAX_EXP) {\r\n x.c = x.e = null;\r\n\r\n // Underflow? Zero.\r\n } else if (x.e < MIN_EXP) {\r\n x.c = [x.e = 0];\r\n }\r\n }\r\n\r\n return x;\r\n }\r\n\r\n\r\n function valueOf(n) {\r\n var str,\r\n e = n.e;\r\n\r\n if (e === null) return n.toString();\r\n\r\n str = coeffToString(n.c);\r\n\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(str, e)\r\n : toFixedPoint(str, e, '0');\r\n\r\n return n.s < 0 ? '-' + str : str;\r\n }\r\n\r\n\r\n // PROTOTYPE/INSTANCE METHODS\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\r\n */\r\n P.absoluteValue = P.abs = function () {\r\n var x = new BigNumber(this);\r\n if (x.s < 0) x.s = 1;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * Return\r\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * 0 if they have the same value,\r\n * or null if the value of either is NaN.\r\n */\r\n P.comparedTo = function (y, b) {\r\n return compare(this, new BigNumber(y, b));\r\n };\r\n\r\n\r\n /*\r\n * If dp is undefined or null or true or false, return the number of decimal places of the\r\n * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n *\r\n * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * [dp] {number} Decimal places: integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.decimalPlaces = P.dp = function (dp, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), dp + x.e + 1, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;\r\n\r\n // Subtract the number of trailing zeros of the last number.\r\n if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);\r\n if (n < 0) n = 0;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * n / 0 = I\r\n * n / N = N\r\n * n / I = 0\r\n * 0 / n = 0\r\n * 0 / 0 = N\r\n * 0 / N = N\r\n * 0 / I = 0\r\n * N / n = N\r\n * N / 0 = N\r\n * N / N = N\r\n * N / I = N\r\n * I / n = I\r\n * I / 0 = I\r\n * I / N = N\r\n * I / I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\r\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.dividedBy = P.div = function (y, b) {\r\n return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the integer part of dividing the value of this\r\n * BigNumber by the value of BigNumber(y, b).\r\n */\r\n P.dividedToIntegerBy = P.idiv = function (y, b) {\r\n return div(this, new BigNumber(y, b), 0, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.\r\n *\r\n * If m is present, return the result modulo m.\r\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\r\n * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.\r\n *\r\n * The modular power operation works efficiently when x, n, and m are integers, otherwise it\r\n * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.\r\n *\r\n * n {number|string|BigNumber} The exponent. An integer.\r\n * [m] {number|string|BigNumber} The modulus.\r\n *\r\n * '[BigNumber Error] Exponent not an integer: {n}'\r\n */\r\n P.exponentiatedBy = P.pow = function (n, m) {\r\n var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,\r\n x = this;\r\n\r\n n = new BigNumber(n);\r\n\r\n // Allow NaN and ±Infinity, but not other non-integers.\r\n if (n.c && !n.isInteger()) {\r\n throw Error\r\n (bignumberError + 'Exponent not an integer: ' + valueOf(n));\r\n }\r\n\r\n if (m != null) m = new BigNumber(m);\r\n\r\n // Exponent of MAX_SAFE_INTEGER is 15.\r\n nIsBig = n.e > 14;\r\n\r\n // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.\r\n if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {\r\n\r\n // The sign of the result of pow when x is negative depends on the evenness of n.\r\n // If +n overflows to ±Infinity, the evenness of n would be not be known.\r\n y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));\r\n return m ? y.mod(m) : y;\r\n }\r\n\r\n nIsNeg = n.s < 0;\r\n\r\n if (m) {\r\n\r\n // x % m returns NaN if abs(m) is zero, or m is NaN.\r\n if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);\r\n\r\n isModExp = !nIsNeg && x.isInteger() && m.isInteger();\r\n\r\n if (isModExp) x = x.mod(m);\r\n\r\n // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.\r\n // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.\r\n } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0\r\n // [1, 240000000]\r\n ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7\r\n // [80000000000000] [99999750000000]\r\n : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {\r\n\r\n // If x is negative and n is odd, k = -0, else k = 0.\r\n k = x.s < 0 && isOdd(n) ? -0 : 0;\r\n\r\n // If x >= 1, k = ±Infinity.\r\n if (x.e > -1) k = 1 / k;\r\n\r\n // If n is negative return ±0, else return ±Infinity.\r\n return new BigNumber(nIsNeg ? 1 / k : k);\r\n\r\n } else if (POW_PRECISION) {\r\n\r\n // Truncating each coefficient array to a length of k after each multiplication\r\n // equates to truncating significant digits to POW_PRECISION + [28, 41],\r\n // i.e. there will be a minimum of 28 guard digits retained.\r\n k = mathceil(POW_PRECISION / LOG_BASE + 2);\r\n }\r\n\r\n if (nIsBig) {\r\n half = new BigNumber(0.5);\r\n if (nIsNeg) n.s = 1;\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = Math.abs(+valueOf(n));\r\n nIsOdd = i % 2;\r\n }\r\n\r\n y = new BigNumber(ONE);\r\n\r\n // Performs 54 loop iterations for n of 9007199254740991.\r\n for (; ;) {\r\n\r\n if (nIsOdd) {\r\n y = y.times(x);\r\n if (!y.c) break;\r\n\r\n if (k) {\r\n if (y.c.length > k) y.c.length = k;\r\n } else if (isModExp) {\r\n y = y.mod(m); //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (i) {\r\n i = mathfloor(i / 2);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n } else {\r\n n = n.times(half);\r\n round(n, n.e + 1, 1);\r\n\r\n if (n.e > 14) {\r\n nIsOdd = isOdd(n);\r\n } else {\r\n i = +valueOf(n);\r\n if (i === 0) break;\r\n nIsOdd = i % 2;\r\n }\r\n }\r\n\r\n x = x.times(x);\r\n\r\n if (k) {\r\n if (x.c && x.c.length > k) x.c.length = k;\r\n } else if (isModExp) {\r\n x = x.mod(m); //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));\r\n }\r\n }\r\n\r\n if (isModExp) return y;\r\n if (nIsNeg) y = ONE.div(y);\r\n\r\n return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer\r\n * using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'\r\n */\r\n P.integerValue = function (rm) {\r\n var n = new BigNumber(this);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n return round(n, n.e + 1, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isEqualTo = P.eq = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is a finite number, otherwise return false.\r\n */\r\n P.isFinite = function () {\r\n return !!this.c;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isGreaterThan = P.gt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is greater than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isGreaterThanOrEqualTo = P.gte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;\r\n\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is an integer, otherwise return false.\r\n */\r\n P.isInteger = function () {\r\n return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\r\n * otherwise return false.\r\n */\r\n P.isLessThan = P.lt = function (y, b) {\r\n return compare(this, new BigNumber(y, b)) < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is less than or equal to the value of\r\n * BigNumber(y, b), otherwise return false.\r\n */\r\n P.isLessThanOrEqualTo = P.lte = function (y, b) {\r\n return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is NaN, otherwise return false.\r\n */\r\n P.isNaN = function () {\r\n return !this.s;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is negative, otherwise return false.\r\n */\r\n P.isNegative = function () {\r\n return this.s < 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is positive, otherwise return false.\r\n */\r\n P.isPositive = function () {\r\n return this.s > 0;\r\n };\r\n\r\n\r\n /*\r\n * Return true if the value of this BigNumber is 0 or -0, otherwise return false.\r\n */\r\n P.isZero = function () {\r\n return !!this.c && this.c[0] == 0;\r\n };\r\n\r\n\r\n /*\r\n * n - 0 = n\r\n * n - N = N\r\n * n - I = -I\r\n * 0 - n = -n\r\n * 0 - 0 = 0\r\n * 0 - N = N\r\n * 0 - I = -I\r\n * N - n = N\r\n * N - 0 = N\r\n * N - N = N\r\n * N - I = N\r\n * I - n = I\r\n * I - 0 = I\r\n * I - N = N\r\n * I - I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.minus = function (y, b) {\r\n var i, j, t, xLTy,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.plus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);\r\n\r\n // Either zero?\r\n if (!xc[0] || !yc[0]) {\r\n\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :\r\n\r\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\r\n ROUNDING_MODE == 3 ? -0 : 0);\r\n }\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Determine which is the bigger number.\r\n if (a = xe - ye) {\r\n\r\n if (xLTy = a < 0) {\r\n a = -a;\r\n t = xc;\r\n } else {\r\n ye = xe;\r\n t = yc;\r\n }\r\n\r\n t.reverse();\r\n\r\n // Prepend zeros to equalise exponents.\r\n for (b = a; b--; t.push(0));\r\n t.reverse();\r\n } else {\r\n\r\n // Exponents equal. Check digit by digit.\r\n j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;\r\n\r\n for (a = b = 0; b < j; b++) {\r\n\r\n if (xc[b] != yc[b]) {\r\n xLTy = xc[b] < yc[b];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // x < y? Point xc to the array of the bigger number.\r\n if (xLTy) {\r\n t = xc;\r\n xc = yc;\r\n yc = t;\r\n y.s = -y.s;\r\n }\r\n\r\n b = (j = yc.length) - (i = xc.length);\r\n\r\n // Append zeros to xc if shorter.\r\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\r\n if (b > 0) for (; b--; xc[i++] = 0);\r\n b = BASE - 1;\r\n\r\n // Subtract yc from xc.\r\n for (; j > a;) {\r\n\r\n if (xc[--j] < yc[j]) {\r\n for (i = j; i && !xc[--i]; xc[i] = b);\r\n --xc[i];\r\n xc[j] += BASE;\r\n }\r\n\r\n xc[j] -= yc[j];\r\n }\r\n\r\n // Remove leading zeros and adjust exponent accordingly.\r\n for (; xc[0] == 0; xc.splice(0, 1), --ye);\r\n\r\n // Zero?\r\n if (!xc[0]) {\r\n\r\n // Following IEEE 754 (2008) 6.3,\r\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\r\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\r\n y.c = [y.e = 0];\r\n return y;\r\n }\r\n\r\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\r\n // for finite x and y.\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * n % 0 = N\r\n * n % N = N\r\n * n % I = n\r\n * 0 % n = 0\r\n * -0 % n = -0\r\n * 0 % 0 = N\r\n * 0 % N = N\r\n * 0 % I = 0\r\n * N % n = N\r\n * N % 0 = N\r\n * N % N = N\r\n * N % I = N\r\n * I % n = N\r\n * I % 0 = N\r\n * I % N = N\r\n * I % I = N\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\r\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\r\n */\r\n P.modulo = P.mod = function (y, b) {\r\n var q, s,\r\n x = this;\r\n\r\n y = new BigNumber(y, b);\r\n\r\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\r\n if (!x.c || !y.s || y.c && !y.c[0]) {\r\n return new BigNumber(NaN);\r\n\r\n // Return x if y is Infinity or x is zero.\r\n } else if (!y.c || x.c && !x.c[0]) {\r\n return new BigNumber(x);\r\n }\r\n\r\n if (MODULO_MODE == 9) {\r\n\r\n // Euclidian division: q = sign(y) * floor(x / abs(y))\r\n // r = x - qy where 0 <= r < abs(y)\r\n s = y.s;\r\n y.s = 1;\r\n q = div(x, y, 0, 3);\r\n y.s = s;\r\n q.s *= s;\r\n } else {\r\n q = div(x, y, 0, MODULO_MODE);\r\n }\r\n\r\n y = x.minus(q.times(y));\r\n\r\n // To match JavaScript %, ensure sign of zero is sign of dividend.\r\n if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;\r\n\r\n return y;\r\n };\r\n\r\n\r\n /*\r\n * n * 0 = 0\r\n * n * N = N\r\n * n * I = I\r\n * 0 * n = 0\r\n * 0 * 0 = 0\r\n * 0 * N = N\r\n * 0 * I = N\r\n * N * n = N\r\n * N * 0 = N\r\n * N * N = N\r\n * N * I = N\r\n * I * n = I\r\n * I * 0 = N\r\n * I * N = N\r\n * I * I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value\r\n * of BigNumber(y, b).\r\n */\r\n P.multipliedBy = P.times = function (y, b) {\r\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\r\n base, sqrtBase,\r\n x = this,\r\n xc = x.c,\r\n yc = (y = new BigNumber(y, b)).c;\r\n\r\n // Either NaN, ±Infinity or ±0?\r\n if (!xc || !yc || !xc[0] || !yc[0]) {\r\n\r\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\r\n if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {\r\n y.c = y.e = y.s = null;\r\n } else {\r\n y.s *= x.s;\r\n\r\n // Return ±Infinity if either is ±Infinity.\r\n if (!xc || !yc) {\r\n y.c = y.e = null;\r\n\r\n // Return ±0 if either is ±0.\r\n } else {\r\n y.c = [0];\r\n y.e = 0;\r\n }\r\n }\r\n\r\n return y;\r\n }\r\n\r\n e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);\r\n y.s *= x.s;\r\n xcL = xc.length;\r\n ycL = yc.length;\r\n\r\n // Ensure xc points to longer array and xcL to its length.\r\n if (xcL < ycL) {\r\n zc = xc;\r\n xc = yc;\r\n yc = zc;\r\n i = xcL;\r\n xcL = ycL;\r\n ycL = i;\r\n }\r\n\r\n // Initialise the result array with zeros.\r\n for (i = xcL + ycL, zc = []; i--; zc.push(0));\r\n\r\n base = BASE;\r\n sqrtBase = SQRT_BASE;\r\n\r\n for (i = ycL; --i >= 0;) {\r\n c = 0;\r\n ylo = yc[i] % sqrtBase;\r\n yhi = yc[i] / sqrtBase | 0;\r\n\r\n for (k = xcL, j = i + k; j > i;) {\r\n xlo = xc[--k] % sqrtBase;\r\n xhi = xc[k] / sqrtBase | 0;\r\n m = yhi * xlo + xhi * ylo;\r\n xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;\r\n c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;\r\n zc[j--] = xlo % base;\r\n }\r\n\r\n zc[j] = c;\r\n }\r\n\r\n if (c) {\r\n ++e;\r\n } else {\r\n zc.splice(0, 1);\r\n }\r\n\r\n return normalise(y, zc, e);\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber negated,\r\n * i.e. multiplied by -1.\r\n */\r\n P.negated = function () {\r\n var x = new BigNumber(this);\r\n x.s = -x.s || null;\r\n return x;\r\n };\r\n\r\n\r\n /*\r\n * n + 0 = n\r\n * n + N = N\r\n * n + I = I\r\n * 0 + n = n\r\n * 0 + 0 = 0\r\n * 0 + N = N\r\n * 0 + I = I\r\n * N + n = N\r\n * N + 0 = N\r\n * N + N = N\r\n * N + I = N\r\n * I + n = I\r\n * I + 0 = I\r\n * I + N = N\r\n * I + I = I\r\n *\r\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\r\n * BigNumber(y, b).\r\n */\r\n P.plus = function (y, b) {\r\n var t,\r\n x = this,\r\n a = x.s;\r\n\r\n y = new BigNumber(y, b);\r\n b = y.s;\r\n\r\n // Either NaN?\r\n if (!a || !b) return new BigNumber(NaN);\r\n\r\n // Signs differ?\r\n if (a != b) {\r\n y.s = -b;\r\n return x.minus(y);\r\n }\r\n\r\n var xe = x.e / LOG_BASE,\r\n ye = y.e / LOG_BASE,\r\n xc = x.c,\r\n yc = y.c;\r\n\r\n if (!xe || !ye) {\r\n\r\n // Return ±Infinity if either ±Infinity.\r\n if (!xc || !yc) return new BigNumber(a / 0);\r\n\r\n // Either zero?\r\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\r\n if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);\r\n }\r\n\r\n xe = bitFloor(xe);\r\n ye = bitFloor(ye);\r\n xc = xc.slice();\r\n\r\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\r\n if (a = xe - ye) {\r\n if (a > 0) {\r\n ye = xe;\r\n t = yc;\r\n } else {\r\n a = -a;\r\n t = xc;\r\n }\r\n\r\n t.reverse();\r\n for (; a--; t.push(0));\r\n t.reverse();\r\n }\r\n\r\n a = xc.length;\r\n b = yc.length;\r\n\r\n // Point xc to the longer array, and b to the shorter length.\r\n if (a - b < 0) {\r\n t = yc;\r\n yc = xc;\r\n xc = t;\r\n b = a;\r\n }\r\n\r\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\r\n for (a = 0; b;) {\r\n a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;\r\n xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;\r\n }\r\n\r\n if (a) {\r\n xc = [a].concat(xc);\r\n ++ye;\r\n }\r\n\r\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\r\n // ye = MAX_EXP + 1 possible\r\n return normalise(y, xc, ye);\r\n };\r\n\r\n\r\n /*\r\n * If sd is undefined or null or true or false, return the number of significant digits of\r\n * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.\r\n * If sd is true include integer-part trailing zeros in the count.\r\n *\r\n * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this\r\n * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or\r\n * ROUNDING_MODE if rm is omitted.\r\n *\r\n * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.\r\n * boolean: whether to count integer-part trailing zeros: true or false.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.precision = P.sd = function (sd, rm) {\r\n var c, n, v,\r\n x = this;\r\n\r\n if (sd != null && sd !== !!sd) {\r\n intCheck(sd, 1, MAX);\r\n if (rm == null) rm = ROUNDING_MODE;\r\n else intCheck(rm, 0, 8);\r\n\r\n return round(new BigNumber(x), sd, rm);\r\n }\r\n\r\n if (!(c = x.c)) return null;\r\n v = c.length - 1;\r\n n = v * LOG_BASE + 1;\r\n\r\n if (v = c[v]) {\r\n\r\n // Subtract the number of trailing zeros of the last element.\r\n for (; v % 10 == 0; v /= 10, n--);\r\n\r\n // Add the number of digits of the first element.\r\n for (v = c[0]; v >= 10; v /= 10, n++);\r\n }\r\n\r\n if (sd && x.e + 1 > n) n = x.e + 1;\r\n\r\n return n;\r\n };\r\n\r\n\r\n /*\r\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\r\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\r\n *\r\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'\r\n */\r\n P.shiftedBy = function (k) {\r\n intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);\r\n return this.times('1e' + k);\r\n };\r\n\r\n\r\n /*\r\n * sqrt(-n) = N\r\n * sqrt(N) = N\r\n * sqrt(-I) = N\r\n * sqrt(I) = I\r\n * sqrt(0) = 0\r\n * sqrt(-0) = -0\r\n *\r\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\r\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\r\n */\r\n P.squareRoot = P.sqrt = function () {\r\n var m, n, r, rep, t,\r\n x = this,\r\n c = x.c,\r\n s = x.s,\r\n e = x.e,\r\n dp = DECIMAL_PLACES + 4,\r\n half = new BigNumber('0.5');\r\n\r\n // Negative/NaN/Infinity/zero?\r\n if (s !== 1 || !c || !c[0]) {\r\n return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);\r\n }\r\n\r\n // Initial estimate.\r\n s = Math.sqrt(+valueOf(x));\r\n\r\n // Math.sqrt underflow/overflow?\r\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\r\n if (s == 0 || s == 1 / 0) {\r\n n = coeffToString(c);\r\n if ((n.length + e) % 2 == 0) n += '0';\r\n s = Math.sqrt(+n);\r\n e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);\r\n\r\n if (s == 1 / 0) {\r\n n = '5e' + e;\r\n } else {\r\n n = s.toExponential();\r\n n = n.slice(0, n.indexOf('e') + 1) + e;\r\n }\r\n\r\n r = new BigNumber(n);\r\n } else {\r\n r = new BigNumber(s + '');\r\n }\r\n\r\n // Check for zero.\r\n // r could be zero if MIN_EXP is changed after the this value was created.\r\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\r\n // coeffToString to throw.\r\n if (r.c[0]) {\r\n e = r.e;\r\n s = e + dp;\r\n if (s < 3) s = 0;\r\n\r\n // Newton-Raphson iteration.\r\n for (; ;) {\r\n t = r;\r\n r = half.times(t.plus(div(x, t, dp, 1)));\r\n\r\n if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {\r\n\r\n // The exponent of r may here be one less than the final result exponent,\r\n // e.g 0.0009999 (e-4) --\x3e 0.001 (e-3), so adjust s so the rounding digits\r\n // are indexed correctly.\r\n if (r.e < e) --s;\r\n n = n.slice(s - 3, s + 1);\r\n\r\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\r\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\r\n // iteration.\r\n if (n == '9999' || !rep && n == '4999') {\r\n\r\n // On the first iteration only, check to see if rounding up gives the\r\n // exact result as the nines may infinitely repeat.\r\n if (!rep) {\r\n round(t, t.e + DECIMAL_PLACES + 2, 0);\r\n\r\n if (t.times(t).eq(x)) {\r\n r = t;\r\n break;\r\n }\r\n }\r\n\r\n dp += 4;\r\n s += 4;\r\n rep = 1;\r\n } else {\r\n\r\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\r\n // result. If not, then there are further digits and m will be truthy.\r\n if (!+n || !+n.slice(1) && n.charAt(0) == '5') {\r\n\r\n // Truncate to the first rounding digit.\r\n round(r, r.e + DECIMAL_PLACES + 2, 1);\r\n m = !r.times(r).eq(x);\r\n }\r\n\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in exponential notation and\r\n * rounded using ROUNDING_MODE to dp fixed decimal places.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toExponential = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp++;\r\n }\r\n return format(this, dp, rm, 1);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\r\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\r\n *\r\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\r\n * but e.g. (-0.00001).toFixed(0) is '-0'.\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n */\r\n P.toFixed = function (dp, rm) {\r\n if (dp != null) {\r\n intCheck(dp, 0, MAX);\r\n dp = dp + this.e + 1;\r\n }\r\n return format(this, dp, rm);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\r\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\r\n * of the format or FORMAT object (see BigNumber.set).\r\n *\r\n * The formatting object may contain some or all of the properties shown below.\r\n *\r\n * FORMAT = {\r\n * prefix: '',\r\n * groupSize: 3,\r\n * secondaryGroupSize: 0,\r\n * groupSeparator: ',',\r\n * decimalSeparator: '.',\r\n * fractionGroupSize: 0,\r\n * fractionGroupSeparator: '\\xA0', // non-breaking space\r\n * suffix: ''\r\n * };\r\n *\r\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n * [format] {object} Formatting options. See FORMAT pbject above.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'\r\n * '[BigNumber Error] Argument not an object: {format}'\r\n */\r\n P.toFormat = function (dp, rm, format) {\r\n var str,\r\n x = this;\r\n\r\n if (format == null) {\r\n if (dp != null && rm && typeof rm == 'object') {\r\n format = rm;\r\n rm = null;\r\n } else if (dp && typeof dp == 'object') {\r\n format = dp;\r\n dp = rm = null;\r\n } else {\r\n format = FORMAT;\r\n }\r\n } else if (typeof format != 'object') {\r\n throw Error\r\n (bignumberError + 'Argument not an object: ' + format);\r\n }\r\n\r\n str = x.toFixed(dp, rm);\r\n\r\n if (x.c) {\r\n var i,\r\n arr = str.split('.'),\r\n g1 = +format.groupSize,\r\n g2 = +format.secondaryGroupSize,\r\n groupSeparator = format.groupSeparator || '',\r\n intPart = arr[0],\r\n fractionPart = arr[1],\r\n isNeg = x.s < 0,\r\n intDigits = isNeg ? intPart.slice(1) : intPart,\r\n len = intDigits.length;\r\n\r\n if (g2) {\r\n i = g1;\r\n g1 = g2;\r\n g2 = i;\r\n len -= i;\r\n }\r\n\r\n if (g1 > 0 && len > 0) {\r\n i = len % g1 || g1;\r\n intPart = intDigits.substr(0, i);\r\n for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);\r\n if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);\r\n if (isNeg) intPart = '-' + intPart;\r\n }\r\n\r\n str = fractionPart\r\n ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)\r\n ? fractionPart.replace(new RegExp('\\\\d{' + g2 + '}\\\\B', 'g'),\r\n '$&' + (format.fractionGroupSeparator || ''))\r\n : fractionPart)\r\n : intPart;\r\n }\r\n\r\n return (format.prefix || '') + str + (format.suffix || '');\r\n };\r\n\r\n\r\n /*\r\n * Return an array of two BigNumbers representing the value of this BigNumber as a simple\r\n * fraction with an integer numerator and an integer denominator.\r\n * The denominator will be a positive non-zero value less than or equal to the specified\r\n * maximum denominator. If a maximum denominator is not specified, the denominator will be\r\n * the lowest value necessary to represent the number exactly.\r\n *\r\n * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.\r\n *\r\n * '[BigNumber Error] Argument {not an integer|out of range} : {md}'\r\n */\r\n P.toFraction = function (md) {\r\n var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,\r\n x = this,\r\n xc = x.c;\r\n\r\n if (md != null) {\r\n n = new BigNumber(md);\r\n\r\n // Throw if md is less than one or is not an integer, unless it is Infinity.\r\n if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {\r\n throw Error\r\n (bignumberError + 'Argument ' +\r\n (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));\r\n }\r\n }\r\n\r\n if (!xc) return new BigNumber(x);\r\n\r\n d = new BigNumber(ONE);\r\n n1 = d0 = new BigNumber(ONE);\r\n d1 = n0 = new BigNumber(ONE);\r\n s = coeffToString(xc);\r\n\r\n // Determine initial denominator.\r\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\r\n e = d.e = s.length - x.e - 1;\r\n d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];\r\n md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;\r\n\r\n exp = MAX_EXP;\r\n MAX_EXP = 1 / 0;\r\n n = new BigNumber(s);\r\n\r\n // n0 = d1 = 0\r\n n0.c[0] = 0;\r\n\r\n for (; ;) {\r\n q = div(n, d, 0, 1);\r\n d2 = d0.plus(q.times(d1));\r\n if (d2.comparedTo(md) == 1) break;\r\n d0 = d1;\r\n d1 = d2;\r\n n1 = n0.plus(q.times(d2 = n1));\r\n n0 = d2;\r\n d = n.minus(q.times(d2 = d));\r\n n = d2;\r\n }\r\n\r\n d2 = div(md.minus(d0), d1, 0, 1);\r\n n0 = n0.plus(d2.times(n1));\r\n d0 = d0.plus(d2.times(d1));\r\n n0.s = n1.s = x.s;\r\n e = e * 2;\r\n\r\n // Determine which fraction is closer to x, n0/d0 or n1/d1\r\n r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(\r\n div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];\r\n\r\n MAX_EXP = exp;\r\n\r\n return r;\r\n };\r\n\r\n\r\n /*\r\n * Return the value of this BigNumber converted to a number primitive.\r\n */\r\n P.toNumber = function () {\r\n return +valueOf(this);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber rounded to sd significant digits\r\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\r\n * necessary to represent the integer part of the value in fixed-point notation, then use\r\n * exponential notation.\r\n *\r\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\r\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\r\n *\r\n * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'\r\n */\r\n P.toPrecision = function (sd, rm) {\r\n if (sd != null) intCheck(sd, 1, MAX);\r\n return format(this, sd, rm, 2);\r\n };\r\n\r\n\r\n /*\r\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\r\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\r\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\r\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\r\n * TO_EXP_NEG, return exponential notation.\r\n *\r\n * [b] {number} Integer, 2 to ALPHABET.length inclusive.\r\n *\r\n * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'\r\n */\r\n P.toString = function (b) {\r\n var str,\r\n n = this,\r\n s = n.s,\r\n e = n.e;\r\n\r\n // Infinity or NaN?\r\n if (e === null) {\r\n if (s) {\r\n str = 'Infinity';\r\n if (s < 0) str = '-' + str;\r\n } else {\r\n str = 'NaN';\r\n }\r\n } else {\r\n if (b == null) {\r\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\r\n ? toExponential(coeffToString(n.c), e)\r\n : toFixedPoint(coeffToString(n.c), e, '0');\r\n } else if (b === 10 && alphabetHasNormalDecimalDigits) {\r\n n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);\r\n str = toFixedPoint(coeffToString(n.c), n.e, '0');\r\n } else {\r\n intCheck(b, 2, ALPHABET.length, 'Base');\r\n str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);\r\n }\r\n\r\n if (s < 0 && n.c[0]) str = '-' + str;\r\n }\r\n\r\n return str;\r\n };\r\n\r\n\r\n /*\r\n * Return as toString, but do not accept a base argument, and include the minus sign for\r\n * negative zero.\r\n */\r\n P.valueOf = P.toJSON = function () {\r\n return valueOf(this);\r\n };\r\n\r\n\r\n P._isBigNumber = true;\r\n\r\n P[Symbol.toStringTag] = 'BigNumber';\r\n\r\n // Node.js v10.12.0+\r\n P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf;\r\n\r\n if (configObject != null) BigNumber.set(configObject);\r\n\r\n return BigNumber;\r\n}\r\n\r\n\r\n// PRIVATE HELPER FUNCTIONS\r\n\r\n// These functions don't need access to variables,\r\n// e.g. DECIMAL_PLACES, in the scope of the `clone` function above.\r\n\r\n\r\nfunction bitFloor(n) {\r\n var i = n | 0;\r\n return n > 0 || n === i ? i : i - 1;\r\n}\r\n\r\n\r\n// Return a coefficient array as a string of base 10 digits.\r\nfunction coeffToString(a) {\r\n var s, z,\r\n i = 1,\r\n j = a.length,\r\n r = a[0] + '';\r\n\r\n for (; i < j;) {\r\n s = a[i++] + '';\r\n z = LOG_BASE - s.length;\r\n for (; z--; s = '0' + s);\r\n r += s;\r\n }\r\n\r\n // Determine trailing zeros.\r\n for (j = r.length; r.charCodeAt(--j) === 48;);\r\n\r\n return r.slice(0, j + 1 || 1);\r\n}\r\n\r\n\r\n// Compare the value of BigNumbers x and y.\r\nfunction compare(x, y) {\r\n var a, b,\r\n xc = x.c,\r\n yc = y.c,\r\n i = x.s,\r\n j = y.s,\r\n k = x.e,\r\n l = y.e;\r\n\r\n // Either NaN?\r\n if (!i || !j) return null;\r\n\r\n a = xc && !xc[0];\r\n b = yc && !yc[0];\r\n\r\n // Either zero?\r\n if (a || b) return a ? b ? 0 : -j : i;\r\n\r\n // Signs differ?\r\n if (i != j) return i;\r\n\r\n a = i < 0;\r\n b = k == l;\r\n\r\n // Either Infinity?\r\n if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;\r\n\r\n // Compare exponents.\r\n if (!b) return k > l ^ a ? 1 : -1;\r\n\r\n j = (k = xc.length) < (l = yc.length) ? k : l;\r\n\r\n // Compare digit by digit.\r\n for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;\r\n\r\n // Compare lengths.\r\n return k == l ? 0 : k > l ^ a ? 1 : -1;\r\n}\r\n\r\n\r\n/*\r\n * Check that n is a primitive number, an integer, and in range, otherwise throw.\r\n */\r\nfunction intCheck(n, min, max, name) {\r\n if (n < min || n > max || n !== mathfloor(n)) {\r\n throw Error\r\n (bignumberError + (name || 'Argument') + (typeof n == 'number'\r\n ? n < min || n > max ? ' out of range: ' : ' not an integer: '\r\n : ' not a primitive number: ') + String(n));\r\n }\r\n}\r\n\r\n\r\n// Assumes finite n.\r\nfunction isOdd(n) {\r\n var k = n.c.length - 1;\r\n return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;\r\n}\r\n\r\n\r\nfunction toExponential(str, e) {\r\n return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) +\r\n (e < 0 ? 'e' : 'e+') + e;\r\n}\r\n\r\n\r\nfunction toFixedPoint(str, e, z) {\r\n var len, zs;\r\n\r\n // Negative exponent?\r\n if (e < 0) {\r\n\r\n // Prepend zeros.\r\n for (zs = z + '.'; ++e; zs += z);\r\n str = zs + str;\r\n\r\n // Positive exponent\r\n } else {\r\n len = str.length;\r\n\r\n // Append zeros.\r\n if (++e > len) {\r\n for (zs = z, e -= len; --e; zs += z);\r\n str += zs;\r\n } else if (e < len) {\r\n str = str.slice(0, e) + '.' + str.slice(e);\r\n }\r\n }\r\n\r\n return str;\r\n}\r\n\r\n\r\n// EXPORT\r\n\r\n\r\nvar BigNumber = clone();\r\n\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BigNumber);\r\n\n\n//# sourceURL=webpack://Papyros/./node_modules/bignumber.js/bignumber.mjs?")},"./node_modules/comlink/dist/esm/comlink.mjs":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createEndpoint: () => (/* binding */ createEndpoint),\n/* harmony export */ expose: () => (/* binding */ expose),\n/* harmony export */ finalizer: () => (/* binding */ finalizer),\n/* harmony export */ proxy: () => (/* binding */ proxy),\n/* harmony export */ proxyMarker: () => (/* binding */ proxyMarker),\n/* harmony export */ releaseProxy: () => (/* binding */ releaseProxy),\n/* harmony export */ transfer: () => (/* binding */ transfer),\n/* harmony export */ transferHandlers: () => (/* binding */ transferHandlers),\n/* harmony export */ windowEndpoint: () => (/* binding */ windowEndpoint),\n/* harmony export */ wrap: () => (/* binding */ wrap)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst proxyMarker = Symbol("Comlink.proxy");\nconst createEndpoint = Symbol("Comlink.endpoint");\nconst releaseProxy = Symbol("Comlink.releaseProxy");\nconst finalizer = Symbol("Comlink.finalizer");\nconst throwMarker = Symbol("Comlink.thrown");\nconst isObject = (val) => (typeof val === "object" && val !== null) || typeof val === "function";\n/**\n * Internal transfer handle to handle objects marked to proxy.\n */\nconst proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n};\n/**\n * Internal transfer handler to handle thrown exceptions.\n */\nconst throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n },\n};\n/**\n * Allows customizing the serialization of certain values.\n */\nconst transferHandlers = new Map([\n ["proxy", proxyTransferHandler],\n ["throw", throwTransferHandler],\n]);\nfunction isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === "*") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n}\nfunction expose(obj, ep = globalThis, allowedOrigins = ["*"]) {\n ep.addEventListener("message", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin \'${ev.origin}\' for comlink proxy`);\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case "GET" /* MessageType.GET */:\n {\n returnValue = rawValue;\n }\n break;\n case "SET" /* MessageType.SET */:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case "APPLY" /* MessageType.APPLY */:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case "CONSTRUCT" /* MessageType.CONSTRUCT */:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case "ENDPOINT" /* MessageType.ENDPOINT */:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case "RELEASE" /* MessageType.RELEASE */:\n {\n returnValue = undefined;\n }\n break;\n default:\n return;\n }\n }\n catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === "RELEASE" /* MessageType.RELEASE */) {\n // detach and deactive after sending release response above.\n ep.removeEventListener("message", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === "function") {\n obj[finalizer]();\n }\n }\n })\n .catch((error) => {\n // Send Serialization Error To Caller\n const [wireValue, transferables] = toWireValue({\n value: new TypeError("Unserializable return value"),\n [throwMarker]: 0,\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n });\n });\n if (ep.start) {\n ep.start();\n }\n}\nfunction isMessagePort(endpoint) {\n return endpoint.constructor.name === "MessagePort";\n}\nfunction closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n}\nfunction wrap(ep, target) {\n return createProxy(ep, [], target);\n}\nfunction throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error("Proxy has been released and is not useable");\n }\n}\nfunction releaseEndpoint(ep) {\n return requestResponseMessage(ep, {\n type: "RELEASE" /* MessageType.RELEASE */,\n }).then(() => {\n closeEndPoint(ep);\n });\n}\nconst proxyCounter = new WeakMap();\nconst proxyFinalizers = "FinalizationRegistry" in globalThis &&\n new FinalizationRegistry((ep) => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n });\nfunction registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n}\nfunction unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n}\nfunction createProxy(ep, path = [], target = function () { }) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n isProxyReleased = true;\n };\n }\n if (prop === "then") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, {\n type: "GET" /* MessageType.GET */,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, {\n type: "SET" /* MessageType.SET */,\n path: [...path, prop].map((p) => p.toString()),\n value,\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, {\n type: "ENDPOINT" /* MessageType.ENDPOINT */,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === "bind") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "APPLY" /* MessageType.APPLY */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: "CONSTRUCT" /* MessageType.CONSTRUCT */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n });\n registerProxy(proxy, ep);\n return proxy;\n}\nfunction myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n}\nfunction processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n}\nconst transferCache = new WeakMap();\nfunction transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n}\nfunction proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n}\nfunction windowEndpoint(w, context = globalThis, targetOrigin = "*") {\n return {\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context),\n };\n}\nfunction toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: "HANDLER" /* WireValueType.HANDLER */,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: "RAW" /* WireValueType.RAW */,\n value,\n },\n transferCache.get(value) || [],\n ];\n}\nfunction fromWireValue(value) {\n switch (value.type) {\n case "HANDLER" /* WireValueType.HANDLER */:\n return transferHandlers.get(value.name).deserialize(value.value);\n case "RAW" /* WireValueType.RAW */:\n return value.value;\n }\n}\nfunction requestResponseMessage(ep, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n ep.addEventListener("message", function l(ev) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener("message", l);\n resolve(ev.data);\n });\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n}\nfunction generateUUID() {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join("-");\n}\n\n\n//# sourceMappingURL=comlink.mjs.map\n\n\n//# sourceURL=webpack://Papyros/./node_modules/comlink/dist/esm/comlink.mjs?')},"./node_modules/crelt/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ crelt)\n/* harmony export */ });\nfunction crelt() {\n var elt = arguments[0]\n if (typeof elt == "string") elt = document.createElement(elt)\n var i = 1, next = arguments[1]\n if (next && typeof next == "object" && next.nodeType == null && !Array.isArray(next)) {\n for (var name in next) if (Object.prototype.hasOwnProperty.call(next, name)) {\n var value = next[name]\n if (typeof value == "string") elt.setAttribute(name, value)\n else if (value != null) elt[name] = value\n }\n i++\n }\n for (; i < arguments.length; i++) add(elt, arguments[i])\n return elt\n}\n\nfunction add(elt, child) {\n if (typeof child == "string") {\n elt.appendChild(document.createTextNode(child))\n } else if (child == null) {\n } else if (child.nodeType != null) {\n elt.appendChild(child)\n } else if (Array.isArray(child)) {\n for (var i = 0; i < child.length; i++) add(elt, child[i])\n } else {\n throw new RangeError("Unsupported child node: " + child)\n }\n}\n\n\n//# sourceURL=webpack://Papyros/./node_modules/crelt/index.js?')},"./node_modules/lit-element/development/lit-element.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ CSSResult: () => (/* reexport safe */ _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.CSSResult),\n/* harmony export */ LitElement: () => (/* binding */ LitElement),\n/* harmony export */ ReactiveElement: () => (/* reexport safe */ _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.ReactiveElement),\n/* harmony export */ _$LE: () => (/* binding */ _$LE),\n/* harmony export */ _$LH: () => (/* reexport safe */ lit_html__WEBPACK_IMPORTED_MODULE_1__._$LH),\n/* harmony export */ adoptStyles: () => (/* reexport safe */ _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.adoptStyles),\n/* harmony export */ css: () => (/* reexport safe */ _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.css),\n/* harmony export */ defaultConverter: () => (/* reexport safe */ _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.defaultConverter),\n/* harmony export */ getCompatibleStyle: () => (/* reexport safe */ _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.getCompatibleStyle),\n/* harmony export */ html: () => (/* reexport safe */ lit_html__WEBPACK_IMPORTED_MODULE_1__.html),\n/* harmony export */ noChange: () => (/* reexport safe */ lit_html__WEBPACK_IMPORTED_MODULE_1__.noChange),\n/* harmony export */ notEqual: () => (/* reexport safe */ _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.notEqual),\n/* harmony export */ nothing: () => (/* reexport safe */ lit_html__WEBPACK_IMPORTED_MODULE_1__.nothing),\n/* harmony export */ render: () => (/* reexport safe */ lit_html__WEBPACK_IMPORTED_MODULE_1__.render),\n/* harmony export */ supportsAdoptingStyleSheets: () => (/* reexport safe */ _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.supportsAdoptingStyleSheets),\n/* harmony export */ svg: () => (/* reexport safe */ lit_html__WEBPACK_IMPORTED_MODULE_1__.svg),\n/* harmony export */ unsafeCSS: () => (/* reexport safe */ _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.unsafeCSS)\n/* harmony export */ });\n/* harmony import */ var _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lit/reactive-element */ \"./node_modules/@lit/reactive-element/development/reactive-element.js\");\n/* harmony import */ var lit_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lit-html */ \"./node_modules/lit-html/development/lit-html.js\");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/**\n * The main LitElement module, which defines the {@linkcode LitElement} base\n * class and related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import {@linkcode LitElement} and {@linkcode html} from this module to\n * create a component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`

your ${adjective} template here

`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends {@linkcode ReactiveElement} and adds lit-html\n * templating. The `ReactiveElement` class is provided for users that want to\n * build their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\n\n\n\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\n/*@__INLINE__*/\nconst JSCompiler_renameProperty = (prop, _obj) => prop;\nconst DEV_MODE = true;\nlet issueWarning;\nif (DEV_MODE) {\n // Ensure warnings are issued only 1x, even if multiple versions of Lit\n // are loaded.\n const issuedWarnings = (globalThis.litIssuedWarnings ??= new Set());\n // Issue a warning, if we haven't already.\n issueWarning = (code, warning) => {\n warning += ` See https://lit.dev/msg/${code} for more information.`;\n if (!issuedWarnings.has(warning)) {\n console.warn(warning);\n issuedWarnings.add(warning);\n }\n };\n}\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the {@linkcode LitElement.properties properties} property or the\n * {@linkcode property} decorator.\n */\nclass LitElement extends _lit_reactive_element__WEBPACK_IMPORTED_MODULE_0__.ReactiveElement {\n constructor() {\n super(...arguments);\n /**\n * @category rendering\n */\n this.renderOptions = { host: this };\n this.__childPart = undefined;\n }\n /**\n * @category rendering\n */\n createRenderRoot() {\n const renderRoot = super.createRenderRoot();\n // When adoptedStyleSheets are shimmed, they are inserted into the\n // shadowRoot by createRenderRoot. Adjust the renderBefore node so that\n // any styles in Lit content render before adoptedStyleSheets. This is\n // important so that adoptedStyleSheets have precedence over styles in\n // the shadowRoot.\n this.renderOptions.renderBefore ??= renderRoot.firstChild;\n return renderRoot;\n }\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param changedProperties Map of changed properties with old values\n * @category updates\n */\n update(changedProperties) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const value = this.render();\n if (!this.hasUpdated) {\n this.renderOptions.isConnected = this.isConnected;\n }\n super.update(changedProperties);\n this.__childPart = (0,lit_html__WEBPACK_IMPORTED_MODULE_1__.render)(value, this.renderRoot, this.renderOptions);\n }\n /**\n * Invoked when the component is added to the document's DOM.\n *\n * In `connectedCallback()` you should setup tasks that should only occur when\n * the element is connected to the document. The most common of these is\n * adding event listeners to nodes external to the element, like a keydown\n * event handler added to the window.\n *\n * ```ts\n * connectedCallback() {\n * super.connectedCallback();\n * addEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * Typically, anything done in `connectedCallback()` should be undone when the\n * element is disconnected, in `disconnectedCallback()`.\n *\n * @category lifecycle\n */\n connectedCallback() {\n super.connectedCallback();\n this.__childPart?.setConnected(true);\n }\n /**\n * Invoked when the component is removed from the document's DOM.\n *\n * This callback is the main signal to the element that it may no longer be\n * used. `disconnectedCallback()` should ensure that nothing is holding a\n * reference to the element (such as event listeners added to nodes external\n * to the element), so that it is free to be garbage collected.\n *\n * ```ts\n * disconnectedCallback() {\n * super.disconnectedCallback();\n * window.removeEventListener('keydown', this._handleKeydown);\n * }\n * ```\n *\n * An element may be re-connected after being disconnected.\n *\n * @category lifecycle\n */\n disconnectedCallback() {\n super.disconnectedCallback();\n this.__childPart?.setConnected(false);\n }\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `ChildPart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n * @category rendering\n */\n render() {\n return lit_html__WEBPACK_IMPORTED_MODULE_1__.noChange;\n }\n}\n// This property needs to remain unminified.\nLitElement['_$litElement$'] = true;\n/**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See @lit/reactive-element for more information.\n */\nLitElement[JSCompiler_renameProperty('finalized', LitElement)] = true;\n// Install hydration if available\nglobalThis.litElementHydrateSupport?.({ LitElement });\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? globalThis.litElementPolyfillSupportDevMode\n : globalThis.litElementPolyfillSupport;\npolyfillSupport?.({ LitElement });\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LE object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-html, since this module re-exports all of lit-html.\n *\n * @private\n */\nconst _$LE = {\n _$attributeToProperty: (el, name, value) => {\n // eslint-disable-next-line\n el._$attributeToProperty(name, value);\n },\n // eslint-disable-next-line\n _$changedProperties: (el) => el._$changedProperties,\n};\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n(globalThis.litElementVersions ??= []).push('4.0.6');\nif (DEV_MODE && globalThis.litElementVersions.length > 1) {\n issueWarning('multiple-versions', `Multiple versions of Lit loaded. Loading multiple versions ` +\n `is not recommended.`);\n}\n//# sourceMappingURL=lit-element.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/lit-element/development/lit-element.js?")},"./node_modules/lit-html/development/async-directive.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AsyncDirective: () => (/* binding */ AsyncDirective),\n/* harmony export */ Directive: () => (/* reexport safe */ _directive_js__WEBPACK_IMPORTED_MODULE_1__.Directive),\n/* harmony export */ PartType: () => (/* reexport safe */ _directive_js__WEBPACK_IMPORTED_MODULE_1__.PartType),\n/* harmony export */ directive: () => (/* reexport safe */ _directive_js__WEBPACK_IMPORTED_MODULE_1__.directive)\n/* harmony export */ });\n/* harmony import */ var _directive_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./directive-helpers.js */ \"./node_modules/lit-html/development/directive-helpers.js\");\n/* harmony import */ var _directive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./directive.js */ \"./node_modules/lit-html/development/directive.js\");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n\n\nconst DEV_MODE = true;\n/**\n * Recursively walks down the tree of Parts/TemplateInstances/Directives to set\n * the connected state of directives and run `disconnected`/ `reconnected`\n * callbacks.\n *\n * @return True if there were children to disconnect; false otherwise\n */\nconst notifyChildrenConnectedChanged = (parent, isConnected) => {\n const children = parent._$disconnectableChildren;\n if (children === undefined) {\n return false;\n }\n for (const obj of children) {\n // The existence of `_$notifyDirectiveConnectionChanged` is used as a \"brand\" to\n // disambiguate AsyncDirectives from other DisconnectableChildren\n // (as opposed to using an instanceof check to know when to call it); the\n // redundancy of \"Directive\" in the API name is to avoid conflicting with\n // `_$notifyConnectionChanged`, which exists `ChildParts` which are also in\n // this list\n // Disconnect Directive (and any nested directives contained within)\n // This property needs to remain unminified.\n obj['_$notifyDirectiveConnectionChanged']?.(isConnected, false);\n // Disconnect Part/TemplateInstance\n notifyChildrenConnectedChanged(obj, isConnected);\n }\n return true;\n};\n/**\n * Removes the given child from its parent list of disconnectable children, and\n * if the parent list becomes empty as a result, removes the parent from its\n * parent, and so forth up the tree when that causes subsequent parent lists to\n * become empty.\n */\nconst removeDisconnectableFromParent = (obj) => {\n let parent, children;\n do {\n if ((parent = obj._$parent) === undefined) {\n break;\n }\n children = parent._$disconnectableChildren;\n children.delete(obj);\n obj = parent;\n } while (children?.size === 0);\n};\nconst addDisconnectableToParent = (obj) => {\n // Climb the parent tree, creating a sparse tree of children needing\n // disconnection\n for (let parent; (parent = obj._$parent); obj = parent) {\n let children = parent._$disconnectableChildren;\n if (children === undefined) {\n parent._$disconnectableChildren = children = new Set();\n }\n else if (children.has(obj)) {\n // Once we've reached a parent that already contains this child, we\n // can short-circuit\n break;\n }\n children.add(obj);\n installDisconnectAPI(parent);\n }\n};\n/**\n * Changes the parent reference of the ChildPart, and updates the sparse tree of\n * Disconnectable children accordingly.\n *\n * Note, this method will be patched onto ChildPart instances and called from\n * the core code when parts are moved between different parents.\n */\nfunction reparentDisconnectables(newParent) {\n if (this._$disconnectableChildren !== undefined) {\n removeDisconnectableFromParent(this);\n this._$parent = newParent;\n addDisconnectableToParent(this);\n }\n else {\n this._$parent = newParent;\n }\n}\n/**\n * Sets the connected state on any directives contained within the committed\n * value of this part (i.e. within a TemplateInstance or iterable of\n * ChildParts) and runs their `disconnected`/`reconnected`s, as well as within\n * any directives stored on the ChildPart (when `valueOnly` is false).\n *\n * `isClearingValue` should be passed as `true` on a top-level part that is\n * clearing itself, and not as a result of recursively disconnecting directives\n * as part of a `clear` operation higher up the tree. This both ensures that any\n * directive on this ChildPart that produced a value that caused the clear\n * operation is not disconnected, and also serves as a performance optimization\n * to avoid needless bookkeeping when a subtree is going away; when clearing a\n * subtree, only the top-most part need to remove itself from the parent.\n *\n * `fromPartIndex` is passed only in the case of a partial `_clear` running as a\n * result of truncating an iterable.\n *\n * Note, this method will be patched onto ChildPart instances and called from the\n * core code when parts are cleared or the connection state is changed by the\n * user.\n */\nfunction notifyChildPartConnectedChanged(isConnected, isClearingValue = false, fromPartIndex = 0) {\n const value = this._$committedValue;\n const children = this._$disconnectableChildren;\n if (children === undefined || children.size === 0) {\n return;\n }\n if (isClearingValue) {\n if (Array.isArray(value)) {\n // Iterable case: Any ChildParts created by the iterable should be\n // disconnected and removed from this ChildPart's disconnectable\n // children (starting at `fromPartIndex` in the case of truncation)\n for (let i = fromPartIndex; i < value.length; i++) {\n notifyChildrenConnectedChanged(value[i], false);\n removeDisconnectableFromParent(value[i]);\n }\n }\n else if (value != null) {\n // TemplateInstance case: If the value has disconnectable children (will\n // only be in the case that it is a TemplateInstance), we disconnect it\n // and remove it from this ChildPart's disconnectable children\n notifyChildrenConnectedChanged(value, false);\n removeDisconnectableFromParent(value);\n }\n }\n else {\n notifyChildrenConnectedChanged(this, isConnected);\n }\n}\n/**\n * Patches disconnection API onto ChildParts.\n */\nconst installDisconnectAPI = (obj) => {\n if (obj.type == _directive_js__WEBPACK_IMPORTED_MODULE_1__.PartType.CHILD) {\n obj._$notifyConnectionChanged ??=\n notifyChildPartConnectedChanged;\n obj._$reparentDisconnectables ??= reparentDisconnectables;\n }\n};\n/**\n * An abstract `Directive` base class whose `disconnected` method will be\n * called when the part containing the directive is cleared as a result of\n * re-rendering, or when the user calls `part.setConnected(false)` on\n * a part that was previously rendered containing the directive (as happens\n * when e.g. a LitElement disconnects from the DOM).\n *\n * If `part.setConnected(true)` is subsequently called on a\n * containing part, the directive's `reconnected` method will be called prior\n * to its next `update`/`render` callbacks. When implementing `disconnected`,\n * `reconnected` should also be implemented to be compatible with reconnection.\n *\n * Note that updates may occur while the directive is disconnected. As such,\n * directives should generally check the `this.isConnected` flag during\n * render/update to determine whether it is safe to subscribe to resources\n * that may prevent garbage collection.\n */\nclass AsyncDirective extends _directive_js__WEBPACK_IMPORTED_MODULE_1__.Directive {\n constructor() {\n super(...arguments);\n // @internal\n this._$disconnectableChildren = undefined;\n }\n /**\n * Initialize the part with internal fields\n * @param part\n * @param parent\n * @param attributeIndex\n */\n _$initialize(part, parent, attributeIndex) {\n super._$initialize(part, parent, attributeIndex);\n addDisconnectableToParent(this);\n this.isConnected = part._$isConnected;\n }\n // This property needs to remain unminified.\n /**\n * Called from the core code when a directive is going away from a part (in\n * which case `shouldRemoveFromParent` should be true), and from the\n * `setChildrenConnected` helper function when recursively changing the\n * connection state of a tree (in which case `shouldRemoveFromParent` should\n * be false).\n *\n * @param isConnected\n * @param isClearingDirective - True when the directive itself is being\n * removed; false when the tree is being disconnected\n * @internal\n */\n ['_$notifyDirectiveConnectionChanged'](isConnected, isClearingDirective = true) {\n if (isConnected !== this.isConnected) {\n this.isConnected = isConnected;\n if (isConnected) {\n this.reconnected?.();\n }\n else {\n this.disconnected?.();\n }\n }\n if (isClearingDirective) {\n notifyChildrenConnectedChanged(this, isConnected);\n removeDisconnectableFromParent(this);\n }\n }\n /**\n * Sets the value of the directive's Part outside the normal `update`/`render`\n * lifecycle of a directive.\n *\n * This method should not be called synchronously from a directive's `update`\n * or `render`.\n *\n * @param directive The directive to update\n * @param value The value to set\n */\n setValue(value) {\n if ((0,_directive_helpers_js__WEBPACK_IMPORTED_MODULE_0__.isSingleExpression)(this.__part)) {\n this.__part._$setValue(value, this);\n }\n else {\n // this.__attributeIndex will be defined in this case, but\n // assert it in dev mode\n if (DEV_MODE && this.__attributeIndex === undefined) {\n throw new Error(`Expected this.__attributeIndex to be a number`);\n }\n const newValues = [...this.__part._$committedValue];\n newValues[this.__attributeIndex] = value;\n this.__part._$setValue(newValues, this, 0);\n }\n }\n /**\n * User callbacks for implementing logic to release any resources/subscriptions\n * that may have been retained by this directive. Since directives may also be\n * re-connected, `reconnected` should also be implemented to restore the\n * working state of the directive prior to the next render.\n */\n disconnected() { }\n reconnected() { }\n}\n//# sourceMappingURL=async-directive.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/lit-html/development/async-directive.js?")},"./node_modules/lit-html/development/directive-helpers.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TemplateResultType: () => (/* binding */ TemplateResultType),\n/* harmony export */ clearPart: () => (/* binding */ clearPart),\n/* harmony export */ getCommittedValue: () => (/* binding */ getCommittedValue),\n/* harmony export */ getDirectiveClass: () => (/* binding */ getDirectiveClass),\n/* harmony export */ insertPart: () => (/* binding */ insertPart),\n/* harmony export */ isCompiledTemplateResult: () => (/* binding */ isCompiledTemplateResult),\n/* harmony export */ isDirectiveResult: () => (/* binding */ isDirectiveResult),\n/* harmony export */ isPrimitive: () => (/* binding */ isPrimitive),\n/* harmony export */ isSingleExpression: () => (/* binding */ isSingleExpression),\n/* harmony export */ isTemplateResult: () => (/* binding */ isTemplateResult),\n/* harmony export */ removePart: () => (/* binding */ removePart),\n/* harmony export */ setChildPartValue: () => (/* binding */ setChildPartValue),\n/* harmony export */ setCommittedValue: () => (/* binding */ setCommittedValue)\n/* harmony export */ });\n/* harmony import */ var _lit_html_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lit-html.js */ \"./node_modules/lit-html/development/lit-html.js\");\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nconst { _ChildPart: ChildPart } = _lit_html_js__WEBPACK_IMPORTED_MODULE_0__._$LH;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst wrap = ENABLE_SHADYDOM_NOPATCH &&\n window.ShadyDOM?.inUse &&\n window.ShadyDOM?.noPatch === true\n ? window.ShadyDOM.wrap\n : (node) => node;\n/**\n * Tests if a value is a primitive value.\n *\n * See https://tc39.github.io/ecma262/#sec-typeof-operator\n */\nconst isPrimitive = (value) => value === null || (typeof value != 'object' && typeof value != 'function');\nconst TemplateResultType = {\n HTML: 1,\n SVG: 2,\n};\n/**\n * Tests if a value is a TemplateResult or a CompiledTemplateResult.\n */\nconst isTemplateResult = (value, type) => type === undefined\n ? // This property needs to remain unminified.\n value?.['_$litType$'] !== undefined\n : value?.['_$litType$'] === type;\n/**\n * Tests if a value is a CompiledTemplateResult.\n */\nconst isCompiledTemplateResult = (value) => {\n return value?.['_$litType$']?.h != null;\n};\n/**\n * Tests if a value is a DirectiveResult.\n */\nconst isDirectiveResult = (value) => \n// This property needs to remain unminified.\nvalue?.['_$litDirective$'] !== undefined;\n/**\n * Retrieves the Directive class for a DirectiveResult\n */\nconst getDirectiveClass = (value) => \n// This property needs to remain unminified.\nvalue?.['_$litDirective$'];\n/**\n * Tests whether a part has only a single-expression with no strings to\n * interpolate between.\n *\n * Only AttributePart and PropertyPart can have multiple expressions.\n * Multi-expression parts have a `strings` property and single-expression\n * parts do not.\n */\nconst isSingleExpression = (part) => part.strings === undefined;\nconst createMarker = () => document.createComment('');\n/**\n * Inserts a ChildPart into the given container ChildPart's DOM, either at the\n * end of the container ChildPart, or before the optional `refPart`.\n *\n * This does not add the part to the containerPart's committed value. That must\n * be done by callers.\n *\n * @param containerPart Part within which to add the new ChildPart\n * @param refPart Part before which to add the new ChildPart; when omitted the\n * part added to the end of the `containerPart`\n * @param part Part to insert, or undefined to create a new part\n */\nconst insertPart = (containerPart, refPart, part) => {\n const container = wrap(containerPart._$startNode).parentNode;\n const refNode = refPart === undefined ? containerPart._$endNode : refPart._$startNode;\n if (part === undefined) {\n const startNode = wrap(container).insertBefore(createMarker(), refNode);\n const endNode = wrap(container).insertBefore(createMarker(), refNode);\n part = new ChildPart(startNode, endNode, containerPart, containerPart.options);\n }\n else {\n const endNode = wrap(part._$endNode).nextSibling;\n const oldParent = part._$parent;\n const parentChanged = oldParent !== containerPart;\n if (parentChanged) {\n part._$reparentDisconnectables?.(containerPart);\n // Note that although `_$reparentDisconnectables` updates the part's\n // `_$parent` reference after unlinking from its current parent, that\n // method only exists if Disconnectables are present, so we need to\n // unconditionally set it here\n part._$parent = containerPart;\n // Since the _$isConnected getter is somewhat costly, only\n // read it once we know the subtree has directives that need\n // to be notified\n let newConnectionState;\n if (part._$notifyConnectionChanged !== undefined &&\n (newConnectionState = containerPart._$isConnected) !==\n oldParent._$isConnected) {\n part._$notifyConnectionChanged(newConnectionState);\n }\n }\n if (endNode !== refNode || parentChanged) {\n let start = part._$startNode;\n while (start !== endNode) {\n const n = wrap(start).nextSibling;\n wrap(container).insertBefore(start, refNode);\n start = n;\n }\n }\n }\n return part;\n};\n/**\n * Sets the value of a Part.\n *\n * Note that this should only be used to set/update the value of user-created\n * parts (i.e. those created using `insertPart`); it should not be used\n * by directives to set the value of the directive's container part. Directives\n * should return a value from `update`/`render` to update their part state.\n *\n * For directives that require setting their part value asynchronously, they\n * should extend `AsyncDirective` and call `this.setValue()`.\n *\n * @param part Part to set\n * @param value Value to set\n * @param index For `AttributePart`s, the index to set\n * @param directiveParent Used internally; should not be set by user\n */\nconst setChildPartValue = (part, value, directiveParent = part) => {\n part._$setValue(value, directiveParent);\n return part;\n};\n// A sentinel value that can never appear as a part value except when set by\n// live(). Used to force a dirty-check to fail and cause a re-render.\nconst RESET_VALUE = {};\n/**\n * Sets the committed value of a ChildPart directly without triggering the\n * commit stage of the part.\n *\n * This is useful in cases where a directive needs to update the part such\n * that the next update detects a value change or not. When value is omitted,\n * the next update will be guaranteed to be detected as a change.\n *\n * @param part\n * @param value\n */\nconst setCommittedValue = (part, value = RESET_VALUE) => (part._$committedValue = value);\n/**\n * Returns the committed value of a ChildPart.\n *\n * The committed value is used for change detection and efficient updates of\n * the part. It can differ from the value set by the template or directive in\n * cases where the template value is transformed before being committed.\n *\n * - `TemplateResult`s are committed as a `TemplateInstance`\n * - Iterables are committed as `Array`\n * - All other types are committed as the template value or value returned or\n * set by a directive.\n *\n * @param part\n */\nconst getCommittedValue = (part) => part._$committedValue;\n/**\n * Removes a ChildPart from the DOM, including any of its content.\n *\n * @param part The Part to remove\n */\nconst removePart = (part) => {\n part._$notifyConnectionChanged?.(false, true);\n let start = part._$startNode;\n const end = wrap(part._$endNode).nextSibling;\n while (start !== end) {\n const n = wrap(start).nextSibling;\n wrap(start).remove();\n start = n;\n }\n};\nconst clearPart = (part) => {\n part._$clear();\n};\n//# sourceMappingURL=directive-helpers.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/lit-html/development/directive-helpers.js?")},"./node_modules/lit-html/development/directive.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Directive: () => (/* binding */ Directive),\n/* harmony export */ PartType: () => (/* binding */ PartType),\n/* harmony export */ directive: () => (/* binding */ directive)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n};\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nconst directive = (c) => (...values) => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n});\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nclass Directive {\n constructor(_partInfo) { }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n /** @internal */\n _$initialize(part, parent, attributeIndex) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part, props) {\n return this.update(part, props);\n }\n update(_part, props) {\n return this.render(...props);\n }\n}\n//# sourceMappingURL=directive.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/lit-html/development/directive.js?")},"./node_modules/lit-html/development/directives/ref.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createRef: () => (/* binding */ createRef),\n/* harmony export */ ref: () => (/* binding */ ref)\n/* harmony export */ });\n/* harmony import */ var _lit_html_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lit-html.js */ \"./node_modules/lit-html/development/lit-html.js\");\n/* harmony import */ var _async_directive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../async-directive.js */ \"./node_modules/lit-html/development/async-directive.js\");\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n\n/**\n * Creates a new Ref object, which is container for a reference to an element.\n */\nconst createRef = () => new Ref();\n/**\n * An object that holds a ref value.\n */\nclass Ref {\n}\n// When callbacks are used for refs, this map tracks the last value the callback\n// was called with, for ensuring a directive doesn't clear the ref if the ref\n// has already been rendered to a new spot. It is double-keyed on both the\n// context (`options.host`) and the callback, since we auto-bind class methods\n// to `options.host`.\nconst lastElementForContextAndCallback = new WeakMap();\nclass RefDirective extends _async_directive_js__WEBPACK_IMPORTED_MODULE_1__.AsyncDirective {\n render(_ref) {\n return _lit_html_js__WEBPACK_IMPORTED_MODULE_0__.nothing;\n }\n update(part, [ref]) {\n const refChanged = ref !== this._ref;\n if (refChanged && this._ref !== undefined) {\n // The ref passed to the directive has changed;\n // unset the previous ref's value\n this._updateRefValue(undefined);\n }\n if (refChanged || this._lastElementForRef !== this._element) {\n // We either got a new ref or this is the first render;\n // store the ref/element & update the ref value\n this._ref = ref;\n this._context = part.options?.host;\n this._updateRefValue((this._element = part.element));\n }\n return _lit_html_js__WEBPACK_IMPORTED_MODULE_0__.nothing;\n }\n _updateRefValue(element) {\n if (!this.isConnected) {\n element = undefined;\n }\n if (typeof this._ref === 'function') {\n // If the current ref was called with a previous value, call with\n // `undefined`; We do this to ensure callbacks are called in a consistent\n // way regardless of whether a ref might be moving up in the tree (in\n // which case it would otherwise be called with the new value before the\n // previous one unsets it) and down in the tree (where it would be unset\n // before being set). Note that element lookup is keyed by\n // both the context and the callback, since we allow passing unbound\n // functions that are called on options.host, and we want to treat\n // these as unique \"instances\" of a function.\n const context = this._context ?? globalThis;\n let lastElementForCallback = lastElementForContextAndCallback.get(context);\n if (lastElementForCallback === undefined) {\n lastElementForCallback = new WeakMap();\n lastElementForContextAndCallback.set(context, lastElementForCallback);\n }\n if (lastElementForCallback.get(this._ref) !== undefined) {\n this._ref.call(this._context, undefined);\n }\n lastElementForCallback.set(this._ref, element);\n // Call the ref with the new element value\n if (element !== undefined) {\n this._ref.call(this._context, element);\n }\n }\n else {\n this._ref.value = element;\n }\n }\n get _lastElementForRef() {\n return typeof this._ref === 'function'\n ? lastElementForContextAndCallback\n .get(this._context ?? globalThis)\n ?.get(this._ref)\n : this._ref?.value;\n }\n disconnected() {\n // Only clear the box if our element is still the one in it (i.e. another\n // directive instance hasn't rendered its element to it before us); that\n // only happens in the event of the directive being cleared (not via manual\n // disconnection)\n if (this._lastElementForRef === this._element) {\n this._updateRefValue(undefined);\n }\n }\n reconnected() {\n // If we were manually disconnected, we can safely put our element back in\n // the box, since no rendering could have occurred to change its state\n this._updateRefValue(this._element);\n }\n}\n/**\n * Sets the value of a Ref object or calls a ref callback with the element it's\n * bound to.\n *\n * A Ref object acts as a container for a reference to an element. A ref\n * callback is a function that takes an element as its only argument.\n *\n * The ref directive sets the value of the Ref object or calls the ref callback\n * during rendering, if the referenced element changed.\n *\n * Note: If a ref callback is rendered to a different element position or is\n * removed in a subsequent render, it will first be called with `undefined`,\n * followed by another call with the new element it was rendered to (if any).\n *\n * ```js\n * // Using Ref object\n * const inputRef = createRef();\n * render(html``, container);\n * inputRef.value.focus();\n *\n * // Using callback\n * const callback = (inputElement) => inputElement.focus();\n * render(html``, container);\n * ```\n */\nconst ref = (0,_async_directive_js__WEBPACK_IMPORTED_MODULE_1__.directive)(RefDirective);\n//# sourceMappingURL=ref.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/lit-html/development/directives/ref.js?")},"./node_modules/lit-html/development/directives/unsafe-html.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ UnsafeHTMLDirective: () => (/* binding */ UnsafeHTMLDirective),\n/* harmony export */ unsafeHTML: () => (/* binding */ unsafeHTML)\n/* harmony export */ });\n/* harmony import */ var _lit_html_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lit-html.js */ \"./node_modules/lit-html/development/lit-html.js\");\n/* harmony import */ var _directive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../directive.js */ \"./node_modules/lit-html/development/directive.js\");\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n\nconst HTML_RESULT = 1;\nclass UnsafeHTMLDirective extends _directive_js__WEBPACK_IMPORTED_MODULE_1__.Directive {\n constructor(partInfo) {\n super(partInfo);\n this._value = _lit_html_js__WEBPACK_IMPORTED_MODULE_0__.nothing;\n if (partInfo.type !== _directive_js__WEBPACK_IMPORTED_MODULE_1__.PartType.CHILD) {\n throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);\n }\n }\n render(value) {\n if (value === _lit_html_js__WEBPACK_IMPORTED_MODULE_0__.nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === _lit_html_js__WEBPACK_IMPORTED_MODULE_0__.noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(`${this.constructor.directiveName}() called with a non-string value`);\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n strings.raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: this.constructor\n .resultType,\n strings,\n values: [],\n });\n }\n}\nUnsafeHTMLDirective.directiveName = 'unsafeHTML';\nUnsafeHTMLDirective.resultType = HTML_RESULT;\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nconst unsafeHTML = (0,_directive_js__WEBPACK_IMPORTED_MODULE_1__.directive)(UnsafeHTMLDirective);\n//# sourceMappingURL=unsafe-html.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/lit-html/development/directives/unsafe-html.js?")},"./node_modules/lit-html/development/is-server.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ isServer: () => (/* binding */ isServer)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2022 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n/**\n * @fileoverview\n *\n * This file exports a boolean const whose value will depend on what environment\n * the module is being imported from.\n */\nconst NODE_MODE = false;\n/**\n * A boolean that will be `true` in server environments like Node, and `false`\n * in browser environments. Note that your server environment or toolchain must\n * support the `"node"` export condition for this to be `true`.\n *\n * This can be used when authoring components to change behavior based on\n * whether or not the component is executing in an SSR context.\n */\nconst isServer = NODE_MODE;\n//# sourceMappingURL=is-server.js.map\n\n//# sourceURL=webpack://Papyros/./node_modules/lit-html/development/is-server.js?')},"./node_modules/lit-html/development/lit-html.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ _$LH: () => (/* binding */ _$LH),\n/* harmony export */ html: () => (/* binding */ html),\n/* harmony export */ noChange: () => (/* binding */ noChange),\n/* harmony export */ nothing: () => (/* binding */ nothing),\n/* harmony export */ render: () => (/* binding */ render),\n/* harmony export */ svg: () => (/* binding */ svg)\n/* harmony export */ });\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event) => {\n const shouldEmit = global\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(new CustomEvent('lit-debug', {\n detail: event,\n }));\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\nlet issueWarning;\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n // Issue a warning, if we haven't already.\n issueWarning = (code, warning) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (!global.litIssuedWarnings.has(warning)) {\n console.warn(warning);\n global.litIssuedWarnings.add(warning);\n }\n };\n issueWarning('dev-mode', `Lit is in dev mode. Not recommended for production!`);\n}\nconst wrap = ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? global.ShadyDOM.wrap\n : (node) => node;\nconst trustedTypes = global.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\nconst identityFunction = (value) => value;\nconst noopSanitizer = (_node, _name, _type) => identityFunction;\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(`Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`);\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\nconst createSanitizer = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${Math.random().toFixed(9).slice(2)}$`;\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\nconst d = NODE_MODE && global.document === undefined\n ? {\n createTreeWalker() {\n return {};\n },\n }\n : document;\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\nconst isPrimitive = (value) => value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value) => isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof value?.[Symbol.iterator] === 'function';\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\nconst commentEndRegex = /--\x3e/g;\n/**\n * Comments not started with \x3c!--, like `\n */\nconst comment2EndRegex = />/g;\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nconst tagEndRegex = new RegExp(`>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`, 'g');\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag = (type) => (strings, ...values) => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn('Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.');\n }\n if (DEV_MODE) {\n // Import static-html.js results in a circular dependency which g3 doesn't\n // handle. Instead we know that static values must have the field\n // `_$litStatic$`.\n if (values.some((val) => val?.['_$litStatic$'])) {\n issueWarning('', `Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\\n` +\n `Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`);\n }\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n};\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`

${title}

`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nconst html = tag(HTML_RESULT);\n/**\n * Interprets a template literal as an SVG fragment that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const rect = svg``;\n *\n * const myImage = html`\n * \n * ${rect}\n * `;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `` HTML element. A common error is\n * placing an `` *element* in a template tagged with the `svg` tag\n * function. The `` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus cannot be used within an `` HTML element.\n */\nconst svg = tag(SVG_RESULT);\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nconst noChange = Symbol.for('lit-noChange');\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html``\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nconst nothing = Symbol.for('lit-nothing');\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - the must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap();\nconst walker = d.createTreeWalker(d, 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */);\nlet sanitizerFactoryInternal = noopSanitizer;\nfunction trustFromTemplateString(tsa, stringFromTSA) {\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!Array.isArray(tsa) || !tsa.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message = `\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n `\n .trim()\n .replace(/\\n */g, '\\n');\n }\n throw new Error(message);\n }\n return policy !== undefined\n ? policy.createHTML(stringFromTSA)\n : stringFromTSA;\n}\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment markers denoting the `ChildPart`s\n * and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (strings, type) => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames = [];\n let html = type === SVG_RESULT ? '' : '';\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex;\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName;\n let lastIndex = 0;\n let match;\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n }\n else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like ') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n }\n else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n }\n else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n }\n else if (regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex) {\n regex = tagEndRegex;\n }\n else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n }\n else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex, 'unexpected parse state B');\n }\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end = regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s + marker + (attrNameEndIndex === -2 ? i : end);\n }\n const htmlResult = html + (strings[l] || '') + (type === SVG_RESULT ? '' : '');\n // Returned as an array for terseness\n return [trustFromTemplateString(strings, htmlResult), attrNames];\n};\nclass Template {\n constructor(\n // This property needs to remain unminified.\n { strings, ['_$litType$']: type }, options) {\n this.parts = [];\n let node;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n // Re-parent SVG nodes into template root\n if (type === SVG_RESULT) {\n const svgElement = this.el.content.firstChild;\n svgElement.replaceWith(...svgElement.childNodes);\n }\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = node.localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (/^(?:textarea|template)$/i.test(tag) &&\n node.innerHTML.includes(marker)) {\n const m = `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n }\n else\n issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if (node.hasAttributes()) {\n for (const name of node.getAttributeNames()) {\n if (name.endsWith(boundAttributeSuffix)) {\n const realName = attrNames[attrNameIndex++];\n const value = node.getAttribute(name);\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName);\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor: m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n node.removeAttribute(name);\n }\n else if (name.startsWith(marker)) {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n node.removeAttribute(name);\n }\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test(node.tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = node.textContent.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n node.textContent = trustedTypes\n ? trustedTypes.emptyScript\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n // We can't use empty text nodes as markers because they're\n // normalized when cloning in IE (could simplify when\n // IE is no longer supported)\n for (let i = 0; i < lastIndex; i++) {\n node.append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({ type: CHILD_PART, index: ++nodeIndex });\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n node.append(strings[lastIndex], createMarker());\n }\n }\n }\n else if (node.nodeType === 8) {\n const data = node.data;\n if (data === markerMatch) {\n parts.push({ type: CHILD_PART, index: nodeIndex });\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n parts.push({ type: COMMENT_PART, index: nodeIndex });\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n if (DEV_MODE) {\n // If there was a duplicate attribute on a tag, then when the tag is\n // parsed into an element the attribute gets de-duplicated. We can detect\n // this mismatch if we haven't precisely consumed every attribute name\n // when preparing the template. This works because `attrNames` is built\n // from the template string and `attrNameIndex` comes from processing the\n // resulting DOM.\n if (attrNames.length !== attrNameIndex) {\n throw new Error(`Detected duplicate attribute bindings. This occurs if your template ` +\n `has duplicate attributes on an element tag. For example ` +\n `\" does not. So first we need to put a\n // text node into the document, then we can sanitize its content.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: textNode,\n value,\n options: this.options,\n });\n textNode.data = value;\n }\n else {\n this._commitNode(d.createTextNode(value));\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: wrap(this._$startNode).nextSibling,\n value,\n options: this.options,\n });\n }\n }\n this._$committedValue = value;\n }\n _commitTemplateResult(result) {\n // This property needs to remain unminified.\n const { values, ['_$litType$']: type } = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the