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B,GAAU,KAAK,QACf,KAAK,MAAM,CAAE,eAAe,IAEhC,KAAK,OAAO,SACZ,SAAS,YAAY,cAAc,EAAO,GACtC,GAAU,KAAK,QACf,EAAO,MAAM,CAAE,eAAe,GAEtC,CACA,YAAI,GACA,OAAO,KAAK,OAAO,QACvB,CACA,YAAI,CAAS,GACL,EACA,KAAK,aAAa,WAAY,IAG9B,KAAK,gBAAgB,YAEzB,KAAK,OAAO,SAAW,CAC3B,CAIA,YAAI,GACA,OAAO,KAAK,OAAO,QACvB,CACA,YAAI,CAAS,GACL,EACA,KAAK,aAAa,WAAY,IAG9B,KAAK,gBAAgB,YAEzB,KAAK,OAAO,SAAW,CAC3B,EAEJ,OAAO,eAAe,OAAO,WAAY","file":"/npm/@stedit/num-text@1.0.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@stedit/num-text@1.0.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n/**\n * A global namespace to manage the configurations for Num Text.\n*/\nvar NumText = {\n    /**\n     * A namespace which manages the theme definitions available for Num Text elements.\n    */\n    themes: {\n        entries: {},\n        /**\n         * Creates a new theme definition which can be applied to your own Num Text elements. This will resolve to a failed Promise if a theme by the given name is already defined.\n        */\n        async define(name, { type = \"any\", url, template, content = \"\" } = {}) {\n            if (NumText.themes.has(name)) {\n                return console.error(new ReferenceError(`Could not define theme \"${name}\", as it has already been defined in the global NumText object. If you would like to update an existing theme's content, use NumText.themes.update() instead.`));\n            }\n            const stylesheet = document.createElement(\"style\");\n            stylesheet.setAttribute(\"num-text-theme\", name);\n            stylesheet.setAttribute(\"num-text-theme-type\", type);\n            if (!url) {\n                stylesheet.textContent = NumText.themes._tempBackwardsCompatibility_((template) ? template.content.querySelector(`[num-text-theme=\"${name}\"]`).textContent : content);\n            }\n            NumText.themes.entries[name] = {\n                type,\n                ...url && { url },\n                stylesheet,\n                elements: []\n            };\n            if (url) {\n                await NumText.themes.update({ name, url });\n            }\n        },\n        /**\n         * Updates the stylesheet content for an already defined theme. The changes will be synced to all Num Text elements that have that theme applied.\n        */\n        async update({ name, url, content = null }) {\n            if (!NumText.themes.has(name)) {\n                return console.error(new ReferenceError(`Could not update theme \"${name}\", as it has not been defined in the global NumText object.`));\n            }\n            if (!url && content == undefined) {\n                return console.error(new ReferenceError(`Could not update theme \"${name}\". Please provide a stylesheet URL or CSS content.`));\n            }\n            if (url) {\n                content = await NumText.themes.fetch((url == \"refresh\") ? NumText.themes.entries[name].url : url);\n            }\n            content = NumText.themes._tempBackwardsCompatibility_(content);\n            NumText.themes.entries[name].stylesheet.textContent = content;\n            NumText.themes.entries[name].elements.forEach(element => element.themes.entries[name].stylesheet.textContent = content);\n        },\n        async fetch(url) {\n            const response = await fetch(url);\n            return await response.text();\n        },\n        /**\n         * This provides a legacy fallback for browsers that don't yet support the `:is()` or `:where()` selectors in CSS, and it will use the `:-webkit-any()` selector instead. This is applied to all themes automatically.\n        */\n        _tempBackwardsCompatibility_(content) {\n            if (CSS.supports(\"not selector(:is())\")) {\n                content = content.replace(/:is\\(/g, \":-webkit-any(\");\n            }\n            if (CSS.supports(\"not selector(:where())\")) {\n                content = content.replace(/:where\\(/g, \":-webkit-any(\");\n            }\n            return content;\n        },\n        /**\n         * Deletes the definition for a given theme, and removes the theme from all Num Text elements that apply it.\n        */\n        remove(name) {\n            if (!NumText.themes.has(name)) {\n                return console.error(new ReferenceError(`Could not remove theme \"${name}\", as it has not been defined in the global NumText object.`));\n            }\n            NumText.themes.entries[name].elements.forEach(element => element.themes.remove(name));\n            delete NumText.themes.entries[name];\n        },\n        /**\n         * Checks if a given theme has been defined.\n        */\n        has(name) {\n            return (name in NumText.themes.entries);\n        }\n    }\n};\n(() => {\n    const importMetaURL = document.currentScript.src;\n    NumText.themes.define(\"vanilla-layout\", {\n        type: \"user-agent\",\n        url: `${new URL(\"../styles/vanilla-layout.css\", importMetaURL)}`\n    });\n    NumText.themes.define(\"vanilla-appearance\", {\n        url: `${new URL(\"../styles/vanilla-appearance.css\", importMetaURL)}`\n    });\n    NumText.themes.define(\"vanilla-highlighting\", {\n        type: \"syntax-highlight\",\n        url: `${new URL(\"../styles/vanilla-highlighting.css\", importMetaURL)}`\n    });\n})();\nclass NumTextElement extends HTMLElement {\n    #isDefined;\n    constructor() {\n        super();\n        this.attachShadow({ mode: \"open\" });\n        this.#isDefined = false;\n        this.colorScheme = {\n            set: (appearance) => {\n                const state = this.colorScheme.get();\n                if (appearance == state)\n                    return state;\n                if (appearance == \"light\")\n                    this.classList.remove(\"color-scheme-dark\");\n                if (appearance == \"dark\")\n                    this.classList.add(\"color-scheme-dark\");\n                return this.colorScheme.get();\n            },\n            /**\n             * Toggles between the light and dark color schemes.\n            */\n            toggle: () => {\n                this.classList.toggle(\"color-scheme-dark\");\n                return this.colorScheme.get();\n            },\n            get: () => {\n                return (!this.matches(\".color-scheme-dark\")) ? \"light\" : \"dark\";\n            }\n        },\n            this.themes = {\n                entries: {},\n                /**\n                 * Adds a defined theme to the element.\n                 *\n                 * Only one syntax highlighting theme can be applied at a time. If one is already applied to the element, it will be removed.\n                */\n                add: (name) => {\n                    if (!NumText.themes.has(name)) {\n                        return console.error(new ReferenceError(`Cound not add theme \"${name}\" to ${this}, as it has not been defined in the global NumText object.`));\n                    }\n                    if (this.themes.has(name))\n                        return;\n                    const { type, stylesheet } = NumText.themes.entries[name];\n                    if (type == \"syntax-highlight\") {\n                        this.themes.getAll(\"syntax-highlight\").forEach(theme => this.themes.remove(theme));\n                    }\n                    this.themes.entries[name] = {\n                        type,\n                        stylesheet: stylesheet.cloneNode(true),\n                        active: true\n                    };\n                    if (type == \"syntax-highlight\" && !this.matches(\"[syntax-highlight]\")) {\n                        this.themes.disable(name);\n                    }\n                    this.shadowRoot.insertBefore(this.themes.entries[name].stylesheet, this.container);\n                    NumText.themes.entries[name].elements.push(this);\n                },\n                /**\n                 * Removes an applied theme from the element.\n                */\n                remove: (name) => {\n                    if (!this.themes.has(name)) {\n                        return console.error(new ReferenceError(`Could not remove theme \"${name}\", as it has not been added to ${this}.`));\n                    }\n                    this.shadowRoot.removeChild(this.themes.entries[name].stylesheet);\n                    delete this.themes.entries[name];\n                    NumText.themes.entries[name].elements.splice(NumText.themes.entries[name].elements.indexOf(this));\n                },\n                /**\n                 * Checks if a given theme has been applied to the element.\n                */\n                has: (name) => {\n                    return (name in this.themes.entries);\n                },\n                /**\n                 * Re-enables an applied theme which was previously hidden.\n                */\n                enable: (name) => {\n                    if (!this.themes.has(name)) {\n                        return console.error(new ReferenceError(`Could not enable theme \"${name}\", as it has not been added to ${this}.`));\n                    }\n                    this.themes.entries[name].active = true;\n                    this.themes.entries[name].stylesheet.removeAttribute(\"media\");\n                },\n                /**\n                 * Hides an applied theme in-place.\n                 *\n                 * This is useful for performance if you plan to add it again later, as it won't actually remove it from the element.\n                */\n                disable: (name) => {\n                    if (!this.themes.has(name)) {\n                        return console.error(new ReferenceError(`Could not disable theme \"${name}\", as it has not been added to ${this}.`));\n                    }\n                    this.themes.entries[name].active = false;\n                    this.themes.entries[name].stylesheet.media = \"not all\";\n                },\n                /**\n                 * Checks if an applied theme is currently enabled or disabled.\n                */\n                active: (name) => {\n                    if (!this.themes.has(name))\n                        return;\n                    return this.themes.entries[name].active;\n                },\n                /**\n                 * Toggles the active state of an applied theme, between enabled and disabled.\n                */\n                toggle: (name) => {\n                    if (!this.themes.has(name)) {\n                        return console.error(new ReferenceError(`Could not toggle theme \"${name}\", as it has not been added to ${this}.`));\n                    }\n                    if (!this.themes.active(name)) {\n                        this.themes.enable(name);\n                    }\n                    else {\n                        this.themes.disable(name);\n                    }\n                    return this.themes.active(name);\n                },\n                /**\n                 * Returns an array for all applied themes applied to the element of a given theme type. The default theme type is 'any'.\n                 *\n                 * The built-in theme provided by Num Text will not be included unless the 'user-agent' theme type is specified.\n                */\n                getAll: (type = \"any\") => {\n                    return Object.keys(this.themes.entries).filter(theme => {\n                        return (!type) ? (this.themes.entries[theme].type != \"user-agent\") : type == this.themes.entries[theme].type;\n                    });\n                }\n            };\n        this.syntaxHighlight = {\n            enable: () => {\n                this.setAttribute(\"syntax-highlight\", \"\");\n                this.themes.getAll(\"syntax-highlight\").forEach(theme => this.themes.enable(theme));\n                this.refreshSyntaxOverlay();\n                this.refreshScrollPosition();\n            },\n            disable: () => {\n                this.removeAttribute(\"syntax-highlight\");\n                this.themes.getAll(\"syntax-highlight\").forEach(theme => this.themes.disable(theme));\n            },\n            /**\n             * Checks if syntax highlighting is currently enabled.\n            */\n            active: () => {\n                return this.matches(\"[syntax-highlight]\");\n            },\n            toggle: () => {\n                if (!this.syntaxHighlight.active()) {\n                    this.syntaxHighlight.enable();\n                }\n                else {\n                    this.syntaxHighlight.disable();\n                }\n            }\n        };\n        this.container = document.createElement(\"div\");\n        this.gutter = document.createElement(\"ol\");\n        this.content = document.createElement(\"div\");\n        this.syntax = document.createElement(\"pre\");\n        this.editor = document.createElement(\"textarea\");\n    }\n    connectedCallback() {\n        if (this.#isDefined || !this.isConnected)\n            return;\n        this.#isDefined = true;\n        this.addEventListener(\"mousedown\", event => {\n            const target = event.composedPath()[0];\n            if (target == this.editor)\n                return;\n            event.preventDefault();\n            this.focus({ preventScroll: (!this.gutter.contains(target)) });\n        });\n        this.container.part.add(\"container\");\n        this.gutter.part.add(\"gutter\");\n        this.gutter.addEventListener(\"mousedown\", event => {\n            const index = this.getLineIndexes()[Array.from(this.gutter.children).indexOf(event.target)];\n            this.editor.setSelectionRange(index, index);\n            this.blur();\n        });\n        this.gutter.addEventListener(\"dblclick\", event => {\n            const indexes = this.getLineIndexes();\n            const line = Array.from(this.gutter.children).indexOf(event.target);\n            this.editor.setSelectionRange(indexes[line], (line + 1 in indexes) ? indexes[line + 1] : this.editor.value.length);\n        });\n        this.gutter.addEventListener(\"scroll\", () => {\n            this.refreshScrollPosition();\n        }, { passive: true });\n        this.content.part.add(\"content\");\n        this.syntax.part.add(\"syntax\");\n        this.editor.part.add(\"editor\");\n        this.editor.placeholder = this.getAttribute(\"placeholder\") || \"\";\n        this.editor.wrap = \"off\";\n        this.editor.spellcheck = false;\n        this.editor.autocomplete = \"off\";\n        this.editor.autocapitalize = \"none\";\n        this.editor.setAttribute(\"autocorrect\", \"off\");\n        this.editor.addEventListener(\"input\", () => {\n            this.refreshLineNumbers();\n        });\n        this.editor.addEventListener(\"scroll\", () => {\n            this.refreshScrollPosition();\n        }, { passive: true });\n        new ResizeObserver(() => {\n            this.style.removeProperty(\"width\");\n            this.style.height = `${this.offsetHeight - this.clientHeight + parseInt(this.editor.style.height, 10)}px`;\n            this.editor.style.removeProperty(\"height\");\n            this.refreshScrollPosition();\n        }).observe(this.editor);\n        this.shadowRoot.appendChild(this.container);\n        this.themes.add(\"vanilla-layout\");\n        this.themes.add(\"vanilla-appearance\");\n        this.themes.add(\"vanilla-highlighting\");\n        if (this.matches(\"[themes]\")) {\n            this.getAttribute(\"themes\").split(\" \").forEach(theme => this.themes.add(theme));\n        }\n        this.container.appendChild(this.gutter);\n        this.container.appendChild(this.content);\n        this.content.appendChild(this.syntax);\n        this.content.appendChild(this.editor);\n        this.disabled = this.matches(\"[disabled]\");\n        this.readonly = this.matches(\"[readonly]\");\n        this.editor.value = this.getAttribute(\"value\") || \"\";\n        this.editor.setSelectionRange(0, 0);\n        this.refreshLineNumbers();\n    }\n    /**\n     * Re-renders the internal line numbers section of the element to reflect the internal textarea's value.\n    */\n    refreshLineNumbers() {\n        this.refreshSyntaxOverlay();\n        const previousCount = Number(this.getAttribute(\"line-count\") || 0);\n        const count = (this.editor.value.match(/\\n/g) || []).length + 1;\n        const difference = count - previousCount;\n        if (difference == 0)\n            return;\n        if (difference > 0) {\n            const fragment = new DocumentFragment();\n            const lineNumber = document.createElement(\"li\");\n            lineNumber.part.add(\"line-number\");\n            for (let i = 0; i < difference; i++) {\n                fragment.appendChild(lineNumber.cloneNode());\n            }\n            this.gutter.appendChild(fragment);\n        }\n        if (difference < 0) {\n            for (let i = 0; i < Math.abs(difference); i++) {\n                this.gutter.lastChild?.remove();\n            }\n        }\n        this.setAttribute(\"line-count\", count.toString());\n        this.refreshScrollPosition();\n    }\n    /**\n     * Re-renders the internal syntax highlighting layer with Prism to reflect the internal textarea's value.\n    */\n    refreshSyntaxOverlay() {\n        if (!this.matches(\"[syntax-highlight][syntax-language]\"))\n            return;\n        let tokened = this.editor.value;\n        if (tokened[tokened.length - 1] == \"\\n\") {\n            tokened += \"\\n\";\n        }\n        if (!(\"Prism\" in window)) {\n            return console.error(`Could not refresh syntax overlay for ${this}, as Prism has not been loaded into the document.`);\n        }\n        this.syntax.innerHTML = Prism.highlight(tokened, Prism.languages[this.getAttribute(\"syntax-language\")], \"\");\n    }\n    /**\n     * Syncs the scroll positions for the internal line numbers section and the internal syntax highlighing layer to that of the internal textarea.\n     *\n     * Overscroll effects use by some platforms when scrolling past the bounds of the internal textarea's scroll box are also synced.\n    */\n    refreshScrollPosition() {\n        const { offsetWidth, offsetHeight, clientWidth, clientHeight, scrollWidth, scrollHeight, scrollLeft, scrollTop } = this.editor;\n        const scrollbarWidth = offsetWidth - clientWidth;\n        const scrollbarHeight = offsetHeight - clientHeight;\n        const overscrollX = (scrollLeft < 0 || (clientWidth + scrollLeft) > scrollWidth)\n            ? (scrollLeft < 0)\n                ? scrollLeft\n                : (clientWidth + scrollLeft) - scrollWidth\n            : false;\n        const overscrollY = (scrollTop < 0 || (clientHeight + scrollTop) > scrollHeight)\n            ? (scrollTop < 0)\n                ? scrollTop\n                : (clientHeight + scrollTop) - scrollHeight\n            : false;\n        if (scrollbarWidth > 0) {\n            this.container.style.setProperty(\"--overflow-offset-x\", `${scrollbarWidth}px`);\n        }\n        else {\n            this.container.style.removeProperty(\"--overflow-offset-x\");\n        }\n        if (scrollbarHeight > 0) {\n            this.container.style.setProperty(\"--overflow-offset-y\", `${scrollbarHeight}px`);\n        }\n        else {\n            this.container.style.removeProperty(\"--overflow-offset-y\");\n        }\n        if (overscrollX == false) {\n            this.container.style.removeProperty(\"--overscroll-left\");\n            this.container.style.removeProperty(\"--overscroll-right\");\n        }\n        else if (overscrollX < 0) {\n            this.container.style.setProperty(\"--overscroll-left\", `${Math.abs(overscrollX)}px`);\n        }\n        else {\n            this.container.style.setProperty(\"--overscroll-right\", `${overscrollX}px`);\n        }\n        if (overscrollY == false) {\n            this.container.style.removeProperty(\"--overscroll-top\");\n            this.container.style.removeProperty(\"--overscroll-bottom\");\n        }\n        else if (overscrollY < 0) {\n            this.container.style.setProperty(\"--overscroll-top\", `${Math.abs(overscrollY)}px`);\n        }\n        else {\n            this.container.style.setProperty(\"--overscroll-bottom\", `${overscrollY}px`);\n        }\n        if (this.gutter.scrollTop != scrollTop) {\n            this.gutter.scrollTop = scrollTop;\n        }\n        if (!this.matches(\"[syntax-language]\"))\n            return;\n        if (this.syntax.scrollLeft != scrollLeft) {\n            this.syntax.scrollLeft = scrollLeft;\n        }\n        if (this.syntax.scrollTop != scrollTop) {\n            this.syntax.scrollTop = scrollTop;\n        }\n    }\n    /**\n     * Returns the numerical indices of a given character (string) within the editor.\n    */\n    getCharacterIndexes(character) {\n        const list = [];\n        let i = -1;\n        while ((i = this.editor.value.indexOf(character, i + 1)) >= 0) {\n            list.push(i + 1);\n        }\n        return list;\n    }\n    /**\n     * Returns the numerical indices of the lines within the editor.\n    */\n    getLineIndexes() {\n        const indexes = this.getCharacterIndexes(\"\\n\");\n        indexes.unshift(0);\n        return indexes;\n    }\n    /**\n     * Performs a find and replace for a given pattern or string within the editor.\n    */\n    replace(pattern, value) {\n        const replaced = this.editor.value.replace(pattern, value);\n        if (replaced != this.editor.value) {\n            this.value = replaced;\n        }\n    }\n    focus(options) {\n        this.editor.focus(options);\n    }\n    blur() {\n        this.editor.blur();\n    }\n    get defined() {\n        return this.#isDefined;\n    }\n    /**\n     * Retrieves or sets the language to use for Prism's syntax highlighting tokenization.\n    */\n    get syntaxLanguage() {\n        return this.getAttribute(\"syntax-language\") ?? \"\";\n    }\n    set syntaxLanguage(language) {\n        this.setAttribute(\"syntax-language\", language);\n        this.refreshLineNumbers();\n    }\n    /**\n     * Retrieves or sets the text within the editor.\n    */\n    get value() {\n        return this.editor.value;\n    }\n    set value(content) {\n        const active = document.activeElement;\n        if (active != this.editor) {\n            this.focus({ preventScroll: true });\n        }\n        this.editor.select();\n        document.execCommand(\"insertText\", false, content);\n        if (active != this.editor) {\n            active.focus({ preventScroll: true });\n        }\n    }\n    get disabled() {\n        return this.editor.disabled;\n    }\n    set disabled(state) {\n        if (state) {\n            this.setAttribute(\"disabled\", \"\");\n        }\n        else {\n            this.removeAttribute(\"disabled\");\n        }\n        this.editor.disabled = state;\n    }\n    /**\n     * Retrieves or sets whether the editor is in read-only mode.\n    */\n    get readonly() {\n        return this.editor.readOnly;\n    }\n    set readonly(state) {\n        if (state) {\n            this.setAttribute(\"readonly\", \"\");\n        }\n        else {\n            this.removeAttribute(\"readonly\");\n        }\n        this.editor.readOnly = state;\n    }\n}\nwindow.customElements.define(\"num-text\", NumTextElement);\n"]}