From a6b3e77d206416decc0c443dd222d8682784671c Mon Sep 17 00:00:00 2001 From: Local Dev Date: Sun, 20 Sep 2026 20:46:29 +0200 Subject: [PATCH] feat(docx-editor): edit Word documents without quietly eating what Word put in them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A .docx editor is easy to write badly: read the file into HTML, let someone edit it, write a fresh document back, and hand them a file that lost its headers, its page size and half its formatting without ever saying so. Three things keep this one honest. The reader doesn't use mammoth's HTML. mammoth's converter is deliberately semantic, and HTML has nowhere to put a run's colour or a paragraph's line spacing, so it drops them — and those are controls this editor puts in the ribbon. Taking its parsed document model instead means what the ribbon offers is what the file can actually carry. Six properties mammoth's model didn't keep are added by build-time patches, each asserting its anchor so an upgrade that moves the code fails the build rather than shipping a lossy reader. The writer rebuilds the body but carries the rest of the package across: headers, footers, footnotes, endnotes, the document's own style catalogue, its theme and its page setup, with relationship ids and content types re-wired. Word features the editor can't model are still lost, so they are detected when the file opens and named in a banner before anyone edits. Tracked changes get their own gate. mammoth renders insertions as ordinary text and drops deletions, so saving would accept every pending revision without Word ever asking. Such a document opens read-only until the user says that is what they want. Verified over 66 real documents: 65 round-trip with an identical model and a structurally valid package, the one exception being a 7 MB WMF picture, which no browser can display and the writer cannot emit. Also driven end to end through a real Theseus over CDP — sidebar, ribbon, typing, save, reopen. --- addon-build/docx-editor/.gitignore | 9 + addon-build/docx-editor/build.mjs | 77 + addon-build/docx-editor/package-lock.json | 1587 +++++++++++++++++ addon-build/docx-editor/package.json | 29 + addon-build/docx-editor/patches.mjs | 204 +++ addon-build/docx-editor/test/corpus.mjs | 114 ++ addon-build/docx-editor/test/fixture.mjs | 204 +++ addon-build/docx-editor/test/harness.mjs | 124 ++ addon-build/docx-editor/test/probe.mjs | 72 + addon-build/docx-editor/test/roundtrip.mjs | 95 + addon-build/docx-editor/vendor-entry.js | 30 + bundled-addons/docx-editor/ROUND-TRIP.md | 121 ++ bundled-addons/docx-editor/addon.json | 11 + bundled-addons/docx-editor/editor.css | 234 +++ bundled-addons/docx-editor/editor.html | 210 +++ bundled-addons/docx-editor/editor.js | 1015 +++++++++++ bundled-addons/docx-editor/index.js | 192 ++ bundled-addons/docx-editor/lib/pkg.js | 490 +++++ bundled-addons/docx-editor/lib/read.js | 502 ++++++ bundled-addons/docx-editor/lib/schema.js | 378 ++++ bundled-addons/docx-editor/lib/write.js | 576 ++++++ bundled-addons/docx-editor/panel.html | 221 +++ .../docx-editor/vendor/LICENSES.txt | 416 +++++ .../docx-editor/vendor/docx-vendor.js | 253 +++ 24 files changed, 7164 insertions(+) create mode 100644 addon-build/docx-editor/.gitignore create mode 100644 addon-build/docx-editor/build.mjs create mode 100644 addon-build/docx-editor/package-lock.json create mode 100644 addon-build/docx-editor/package.json create mode 100644 addon-build/docx-editor/patches.mjs create mode 100644 addon-build/docx-editor/test/corpus.mjs create mode 100644 addon-build/docx-editor/test/fixture.mjs create mode 100644 addon-build/docx-editor/test/harness.mjs create mode 100644 addon-build/docx-editor/test/probe.mjs create mode 100644 addon-build/docx-editor/test/roundtrip.mjs create mode 100644 addon-build/docx-editor/vendor-entry.js create mode 100644 bundled-addons/docx-editor/ROUND-TRIP.md create mode 100644 bundled-addons/docx-editor/addon.json create mode 100644 bundled-addons/docx-editor/editor.css create mode 100644 bundled-addons/docx-editor/editor.html create mode 100644 bundled-addons/docx-editor/editor.js create mode 100644 bundled-addons/docx-editor/index.js create mode 100644 bundled-addons/docx-editor/lib/pkg.js create mode 100644 bundled-addons/docx-editor/lib/read.js create mode 100644 bundled-addons/docx-editor/lib/schema.js create mode 100644 bundled-addons/docx-editor/lib/write.js create mode 100644 bundled-addons/docx-editor/panel.html create mode 100644 bundled-addons/docx-editor/vendor/LICENSES.txt create mode 100644 bundled-addons/docx-editor/vendor/docx-vendor.js diff --git a/addon-build/docx-editor/.gitignore b/addon-build/docx-editor/.gitignore new file mode 100644 index 00000000..6a7c9ff0 --- /dev/null +++ b/addon-build/docx-editor/.gitignore @@ -0,0 +1,9 @@ +# The patched copy of mammoth is regenerated by `npm run build`; the patches +# themselves (patches.mjs) are the source of truth and are checked in. +.patched/ + +# Test scratch — regenerate with test/fixture.mjs and test/roundtrip.mjs. +test/fixture.docx +test/roundtrip-out.docx +test/roundtrip-a.json +test/roundtrip-b.json diff --git a/addon-build/docx-editor/build.mjs b/addon-build/docx-editor/build.mjs new file mode 100644 index 00000000..8846d5ad --- /dev/null +++ b/addon-build/docx-editor/build.mjs @@ -0,0 +1,77 @@ +// Bundles the add-on's npm dependencies into +// bundled-addons/docx-editor/vendor/docx-vendor.js. +// +// npm run build (from addon-build/docx-editor/) +// +// mammoth is patched on the way through — see patches.mjs for why. The +// patched copy is materialised under .patched/ so the node round-trip tests +// exercise exactly the same reader the browser does. +import * as esbuild from "esbuild"; +import { mkdirSync, writeFileSync, readFileSync, statSync, rmSync, cpSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; +import { applyPatches, patches } from "./patches.mjs"; + +const here = path.dirname(fileURLToPath(import.meta.url)); +const out = path.resolve(here, "../../bundled-addons/docx-editor/vendor"); +const patchedRoot = path.join(here, ".patched"); + +// --- 1. patched mammoth --------------------------------------------------- +rmSync(patchedRoot, { recursive: true, force: true }); +mkdirSync(patchedRoot, { recursive: true }); +cpSync(path.join(here, "node_modules", "mammoth"), path.join(patchedRoot, "mammoth"), { recursive: true }); +const touched = new Set(); +for (const p of patches) { + const f = path.join(patchedRoot, "mammoth", p.file); + if (touched.has(f)) continue; + touched.add(f); +} +for (const f of touched) { + const rel = "mammoth/" + path.relative(path.join(patchedRoot, "mammoth"), f).split(path.sep).join("/"); + const { code, hits } = applyPatches(rel, readFileSync(f, "utf8")); + writeFileSync(f, code); + console.log(`patched ${rel} (${hits} hunks)`); +} + +// --- 2. bundle ------------------------------------------------------------ +mkdirSync(out, { recursive: true }); +const res = await esbuild.build({ + entryPoints: [path.join(here, "vendor-entry.js")], + bundle: true, + minify: true, + format: "iife", + platform: "browser", + target: ["chrome120"], + legalComments: "none", + outfile: path.join(out, "docx-vendor.js"), + define: { "process.env.NODE_ENV": '"production"' }, + alias: { mammoth: path.join(patchedRoot, "mammoth") }, + logLevel: "info", +}); +if (res.errors.length) process.exit(1); + +// --- 3. licences ---------------------------------------------------------- +// Vendored code without its licence text is the kind of thing that bites +// later; this file ships next to the bundle. +const pkgs = ["mammoth", "docx", "jszip", "underscore", "orderedmap", "w3c-keyname", + "rope-sequence", "prosemirror-state", "prosemirror-view", "prosemirror-model", + "prosemirror-schema-basic", "prosemirror-schema-list", "prosemirror-tables", + "prosemirror-history", "prosemirror-commands", "prosemirror-keymap", + "prosemirror-inputrules", "prosemirror-dropcursor", "prosemirror-gapcursor", + "prosemirror-transform"]; +let notice = "Third-party code bundled into vendor/docx-vendor.js\n" + + "===================================================\n\n" + + "mammoth is shipped with small local patches (colour, paragraph spacing,\n" + + "numbering format); see addon-build/docx-editor/patches.mjs.\n\n"; +for (const p of pkgs) { + let j; try { j = JSON.parse(readFileSync(path.join(here, "node_modules", p, "package.json"), "utf8")); } + catch { continue; } + let text = ""; + for (const f of ["LICENSE", "LICENSE.md", "LICENSE.txt", "LICENCE", "license", "LICENSE-MIT"]) { + try { text = readFileSync(path.join(here, "node_modules", p, f), "utf8").trim(); break; } catch {} + } + notice += `--- ${p} ${j.version} — ${j.license || "see project"} ---\n` + + (text || `(no licence file in the package; see ${j.homepage || j.repository?.url || "the project homepage"})`) + "\n\n"; +} +writeFileSync(path.join(out, "LICENSES.txt"), notice); +console.log(`vendor bundle: ${(statSync(path.join(out, "docx-vendor.js")).size / 1024).toFixed(0)} KB`); diff --git a/addon-build/docx-editor/package-lock.json b/addon-build/docx-editor/package-lock.json new file mode 100644 index 00000000..de77cbe6 --- /dev/null +++ b/addon-build/docx-editor/package-lock.json @@ -0,0 +1,1587 @@ +{ + "name": "docx-editor-vendor-build", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "docx-editor-vendor-build", + "version": "0.0.0", + "devDependencies": { + "docx": "^9.5.1", + "esbuild": "^0.28.2", + "jsdom": "^29.1.1", + "jszip": "^3.10.1", + "mammoth": "^1.12.3", + "prosemirror-commands": "^1.7.1", + "prosemirror-dropcursor": "^1.8.2", + "prosemirror-gapcursor": "^1.3.2", + "prosemirror-history": "^1.4.1", + "prosemirror-inputrules": "^1.5.0", + "prosemirror-keymap": "^1.2.3", + "prosemirror-model": "^1.25.0", + "prosemirror-schema-basic": "^1.2.4", + "prosemirror-schema-list": "^1.5.1", + "prosemirror-state": "^1.4.3", + "prosemirror-tables": "^1.7.1", + "prosemirror-view": "^1.40.0" + } + }, + "node_modules/@asamuzakjp/css-color": { + "version": "5.1.11", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-5.1.11.tgz", + "integrity": "sha512-KVw6qIiCTUQhByfTd78h2yD1/00waTmm9uy/R7Ck/ctUyAPj+AEDLkQIdJW0T8+qGgj3j5bpNKK7Q3G+LedJWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@csstools/css-calc": "^3.2.0", + "@csstools/css-color-parser": "^4.1.0", + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-7.1.1.tgz", + "integrity": "sha512-67RZDnYRc8H/8MLDgQCDE//zoqVFwajkepHZgmXrbwybzXOEwOWGPYGmALYl9J2DOLfFPPs6kKCqmbzV895hTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@asamuzakjp/nwsapi": "^2.3.9", + "bidi-js": "^1.0.3", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/generational-cache": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/generational-cache/-/generational-cache-1.0.1.tgz", + "integrity": "sha512-wajfB8KqzMCN2KGNFdLkReeHncd0AslUSrvHVvvYWuU8ghncRJoA50kT3zP9MVL0+9g4/67H+cdvBskj9THPzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/nwsapi": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@asamuzakjp/nwsapi/-/nwsapi-2.3.9.tgz", + "integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@bramus/specificity": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz", + "integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.0.0" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.1.tgz", + "integrity": "sha512-gLNsunvwf3mCi5u5o46/Z/JcJMnhbHSaZ69rkgPzNM3J4s8hWwpPUQB6/tt0EDFyCiWzxANlx+2LJwpYj4zS1w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.0.tgz", + "integrity": "sha512-XQKj5B7QiZcHiegCOCAzcAOJdhGgWOHbbu62h5e5mkHnn8lWcfiJhllkqWmxu5zWR9jucPHuo1iTB56P033hcg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.3.tgz", + "integrity": "sha512-y4LpL+lmpuyKDiEFq2PnZUVFdAjsoB/qQJod79yLNokXyW7jewi+/WJ69EfItj8A2unWtxXnGjw6LYXgXu5ZjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.1", + "@csstools/css-calc": "^3.4.0" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz", + "integrity": "sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.14.tgz", + "integrity": "sha512-HpbVXyrofRXpHpgkNIjU/3EWR4WJvOkO3emNK/L6X/mTJU7bGUI3AkkpoTNXznQLp0KRjLHELTGeKI5dIkI9JQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.1.tgz", + "integrity": "sha512-bPlN9S9O1A0euCpEWE4qnvB5YDuyYVsUTrxSgmAM1Is0j4tICHoVyOVAXfWMP/kS9ZrjvyIXWV2PmomiAXXqOw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@exodus/bytes": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz", + "integrity": "sha512-S6mL0yNB/Abt9Ei4tq8gDhcczc4S3+vQ4ra7vxnAf+YHC02srtqxKKZghx2Dq6p0e66THKwR6r8N6P95wEty7Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, + "node_modules/@types/node": { + "version": "25.9.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.8.tgz", + "integrity": "sha512-VfMrScDmMhUJQmd5hArdQnFvK0OIeD36uN2Va1FcpYaLB/BgkgM8Ulc50XtYISPMz7APJ30+N0T5EM0jlcdfRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": ">=7.24.0 <7.24.7" + } + }, + "node_modules/@xmldom/xmldom": { + "version": "0.8.15", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.15.tgz", + "integrity": "sha512-/5NV/vDALVFDXgLmfsy9TRCBlKwO2LNBFzpzvb9iIj+jR+eSc6DLYYvVOdivT/jm7MtU6TebYuRmzEOI7w40UA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bidi-js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", + "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, + "node_modules/bluebird": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", + "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, + "node_modules/data-urls": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz", + "integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, + "node_modules/dingbat-to-unicode": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/dingbat-to-unicode/-/dingbat-to-unicode-1.0.2.tgz", + "integrity": "sha512-R0bRerYzy/EZP6QzD3Hkl6JjUDA1Mnn+pd928w0nWjPzihnbAR6dcjGJGiRyznj5E4S1duEKzWrTqw02DPcdzg==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/docx": { + "version": "9.7.1", + "resolved": "https://registry.npmjs.org/docx/-/docx-9.7.1.tgz", + "integrity": "sha512-ilXFf9Moz47ABjFpDiA5s1w9lpb4EFSp7+5iiJSbfyYDM+bpZdAgLlSr7fW4aXhVe/E+F6QCv0EvRVFEd5CsWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "^25.2.3", + "hash.js": "^1.1.7", + "jszip": "^3.10.1", + "nanoid": "^5.1.3", + "xml": "^1.0.1", + "xml-js": "^1.6.8" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/duck": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/duck/-/duck-0.1.12.tgz", + "integrity": "sha512-wkctla1O6VfP89gQ+J/yDesM0S7B7XLXjKGzXxMDVFg7uEn706niAtyYovKbyq1oT9YwDcly721/iUWoc8MVRg==", + "dev": true, + "license": "BSD", + "dependencies": { + "underscore": "^1.13.1" + } + }, + "node_modules/entities": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", + "integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.6.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsdom": { + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-29.1.1.tgz", + "integrity": "sha512-ECi4Fi2f7BdJtUKTflYRTiaMxIB0O6zfR1fX0GXpUrf6flp8QIYn1UT20YQqdSOfk2dfkCwS8LAFoJDEppNK5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^5.1.11", + "@asamuzakjp/dom-selector": "^7.1.1", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.3", + "@exodus/bytes": "^1.15.0", + "css-tree": "^3.2.1", + "data-urls": "^7.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^6.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.3.5", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^6.0.1", + "undici": "^7.25.0", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.1", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jszip": { + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.2.tgz", + "integrity": "sha512-3l+rb15IOWtUhU0H5MFqES/T6Kh7abYwjosBey/vD6hDt8zoEffkSC5Ws5SGtgVw3gBx2NEbhTeSW1+kWkpyTQ==", + "dev": true, + "license": "(MIT OR GPL-3.0-or-later)", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "immediate": "~3.0.5" + } + }, + "node_modules/lop": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/lop/-/lop-0.4.2.tgz", + "integrity": "sha512-RefILVDQ4DKoRZsJ4Pj22TxE3omDO47yFpkIBoDKzkqPRISs5U1cnAdg/5583YPkWPaLIYHOKRMQSvjFsO26cw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "duck": "^0.1.12", + "option": "~0.2.1", + "underscore": "^1.13.1" + } + }, + "node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/mammoth": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/mammoth/-/mammoth-1.12.3.tgz", + "integrity": "sha512-kkv2MrSFk3f/w3uLsz4FG/91LdWp2j+qmp7AjG2v7w2xgX5YDxiaFlaWourXrXtyUR6335+9guyIlPBnhHLvKw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@xmldom/xmldom": "^0.8.6", + "argparse": "~1.0.3", + "base64-js": "^1.5.1", + "bluebird": "~3.4.0", + "dingbat-to-unicode": "^1.0.1", + "jszip": "^3.7.1", + "lop": "^0.4.2", + "path-is-absolute": "^1.0.0", + "underscore": "^1.13.1", + "xmlbuilder": "^10.0.0" + }, + "bin": { + "mammoth": "bin/mammoth" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true, + "license": "ISC" + }, + "node_modules/nanoid": { + "version": "5.1.16", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.16.tgz", + "integrity": "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.js" + }, + "engines": { + "node": "^18 || >=20" + } + }, + "node_modules/option": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/option/-/option-0.2.4.tgz", + "integrity": "sha512-pkEqbDyl8ou5cpq+VsnQbe/WlEy5qS7xPzMS1U55OCG9KPvwFD46zDbxQIj3egJSFc3D+XhYOPUzz49zQAVy7A==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/orderedmap": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/orderedmap/-/orderedmap-2.1.1.tgz", + "integrity": "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==", + "dev": true, + "license": "MIT" + }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true, + "license": "(MIT AND Zlib)" + }, + "node_modules/parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^8.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, + "license": "MIT" + }, + "node_modules/prosemirror-commands": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/prosemirror-commands/-/prosemirror-commands-1.7.2.tgz", + "integrity": "sha512-q6Q6szxqdu9Xd6EcdKsqXghu5nQdZTpB4Q9yd04WRc7/jt763e/rT60Owh0L1GYY+T46o5rD+9lEN36dZS43tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.10.2" + } + }, + "node_modules/prosemirror-dropcursor": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/prosemirror-dropcursor/-/prosemirror-dropcursor-1.8.3.tgz", + "integrity": "sha512-FoYbsJR8gK+DGlqhNoE29Loa38eIZPzQRIb1VMaDNBoo4OLP6vVof/jR8qFY/6XvUd6Dhug8MDCHl2a/h8RTfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0", + "prosemirror-view": "^1.1.0" + } + }, + "node_modules/prosemirror-gapcursor": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/prosemirror-gapcursor/-/prosemirror-gapcursor-1.4.1.tgz", + "integrity": "sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-keymap": "^1.0.0", + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-view": "^1.0.0" + } + }, + "node_modules/prosemirror-history": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.5.0.tgz", + "integrity": "sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-state": "^1.2.2", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.31.0", + "rope-sequence": "^1.3.0" + } + }, + "node_modules/prosemirror-inputrules": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/prosemirror-inputrules/-/prosemirror-inputrules-1.5.1.tgz", + "integrity": "sha512-7wj4uMjKaXWAQ1CDgxNzNtR9AlsuwzHfdFH1ygEHA2KHF2DOEaXl1CJfNPAKCg9qNEh4rum975QLaCiQPyY6Fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.0.0" + } + }, + "node_modules/prosemirror-keymap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/prosemirror-keymap/-/prosemirror-keymap-1.2.3.tgz", + "integrity": "sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-state": "^1.0.0", + "w3c-keyname": "^2.2.0" + } + }, + "node_modules/prosemirror-model": { + "version": "1.25.11", + "resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.25.11.tgz", + "integrity": "sha512-QWg9RhnpLlogAmp3p96uEFrE5txQpFynd4vhBAELkwgOCWQs/X0yCzB3/hrHqiPwf91RG5KyWq6553zs9JqIOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "orderedmap": "^2.0.0" + } + }, + "node_modules/prosemirror-schema-basic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/prosemirror-schema-basic/-/prosemirror-schema-basic-1.2.4.tgz", + "integrity": "sha512-ELxP4TlX3yr2v5rM7Sb70SqStq5NvI15c0j9j/gjsrO5vaw+fnnpovCLEGIcpeGfifkuqJwl4fon6b+KdrODYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.25.0" + } + }, + "node_modules/prosemirror-schema-list": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/prosemirror-schema-list/-/prosemirror-schema-list-1.5.1.tgz", + "integrity": "sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.7.3" + } + }, + "node_modules/prosemirror-state": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.4.4.tgz", + "integrity": "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.27.0" + } + }, + "node_modules/prosemirror-tables": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/prosemirror-tables/-/prosemirror-tables-1.8.5.tgz", + "integrity": "sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-keymap": "^1.2.3", + "prosemirror-model": "^1.25.4", + "prosemirror-state": "^1.4.4", + "prosemirror-transform": "^1.10.5", + "prosemirror-view": "^1.41.4" + } + }, + "node_modules/prosemirror-transform": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/prosemirror-transform/-/prosemirror-transform-1.12.1.tgz", + "integrity": "sha512-t4F5615FycnCqsX7ShTUs8+jfnwcf46kuFRvSl/3qFx2QTZ4DjgowesLHQXcFP7G//TjesqZG3WtgL7vdyVJyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.21.0" + } + }, + "node_modules/prosemirror-view": { + "version": "1.42.4", + "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.42.4.tgz", + "integrity": "sha512-H/LErnE8Vms1GYkvhfj6G3K9rc2p+o5EHGmTwvPOl0f21wPPxlMVRB8ICOseH+COb2oPKFEoufbgY6yet/dR4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.25.8", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rope-sequence": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz", + "integrity": "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/sax": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz", + "integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=11.0.0" + } + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "dev": true, + "license": "MIT" + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tldts": { + "version": "7.4.13", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.13.tgz", + "integrity": "sha512-iHtaIWWIbMDkCeJdTBzZFGgbluE5J+oHlb2g7+oAz1S1gpuVpabRZdQyd471Vl8UUkcz2vXSL8xZH2kyCe8tfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.13" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.13", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.13.tgz", + "integrity": "sha512-mbYsrih5FRtGxs3Usvl/PqwJsNpp+jsmrdFviiK02teHDG0/HebBG/pqCylje3kzgXYzuLoHJF/0mz9W53t8Xg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", + "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/underscore": { + "version": "1.13.8", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.8.tgz", + "integrity": "sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici": { + "version": "7.29.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.1.tgz", + "integrity": "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", + "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", + "dev": true, + "license": "MIT" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-url": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz", + "integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.11.0", + "tr46": "^6.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "dev": true, + "license": "MIT" + }, + "node_modules/xml-js": { + "version": "1.6.11", + "resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz", + "integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "sax": "^1.2.4" + }, + "bin": { + "xml-js": "bin/cli.js" + } + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlbuilder": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-10.1.1.tgz", + "integrity": "sha512-OyzrcFLL/nb6fMGHbiRDuPup9ljBycsdCypwuyg5AAHvyWzGfChJpCXMG88AGTIMFhGZ9RccFN1e6lhg3hkwKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/addon-build/docx-editor/package.json b/addon-build/docx-editor/package.json new file mode 100644 index 00000000..63b9d8e5 --- /dev/null +++ b/addon-build/docx-editor/package.json @@ -0,0 +1,29 @@ +{ + "name": "docx-editor-vendor-build", + "private": true, + "version": "0.0.0", + "description": "Build-time only: bundles mammoth + ProseMirror + docx into bundled-addons/docx-editor/vendor/.", + "type": "module", + "scripts": { + "build": "node build.mjs" + }, + "devDependencies": { + "docx": "^9.5.1", + "esbuild": "^0.28.2", + "jsdom": "^29.1.1", + "jszip": "^3.10.1", + "mammoth": "^1.12.3", + "prosemirror-commands": "^1.7.1", + "prosemirror-dropcursor": "^1.8.2", + "prosemirror-gapcursor": "^1.3.2", + "prosemirror-history": "^1.4.1", + "prosemirror-inputrules": "^1.5.0", + "prosemirror-keymap": "^1.2.3", + "prosemirror-model": "^1.25.0", + "prosemirror-schema-basic": "^1.2.4", + "prosemirror-schema-list": "^1.5.1", + "prosemirror-state": "^1.4.3", + "prosemirror-tables": "^1.7.1", + "prosemirror-view": "^1.40.0" + } +} diff --git a/addon-build/docx-editor/patches.mjs b/addon-build/docx-editor/patches.mjs new file mode 100644 index 00000000..d6f698c8 --- /dev/null +++ b/addon-build/docx-editor/patches.mjs @@ -0,0 +1,204 @@ +// Build-time patches applied to vendored mammoth. +// +// Why: mammoth's document model deliberately drops direct formatting that +// isn't semantic — run colour, paragraph line/space spacing — and flattens +// every numbering level to a bare isOrdered boolean. All three are v1 editor +// features (text colour, line spacing, numbered-list formats), so without +// these a document would visibly lose them on the first round-trip. +// +// Each patch asserts its anchor: if a mammoth upgrade moves the code, the +// build fails loudly instead of silently shipping an editor that eats +// formatting. +export const patches = [ + { + file: "lib/docx/body-reader.js", + find: ` highlight: readHighlightValue(element.firstOrEmpty("w:highlight").attributes["w:val"])`, + replace: ` highlight: readHighlightValue(element.firstOrEmpty("w:highlight").attributes["w:val"]), + color: readColorValue(element.firstOrEmpty("w:color").attributes["w:val"])`, + }, + { + file: "lib/docx/body-reader.js", + find: ` function readUnderline(element) {`, + replace: ` function readColorValue(value) { + // w:color w:val is RRGGBB, or "auto" meaning "let the renderer pick". + return /^[0-9a-fA-F]{6}$/.test(value || "") ? value.toUpperCase() : null; + } + + function readParagraphSpacing(element) { + var attrs = element.attributes; + var line = attrs["w:line"]; + var num = function(v) { return /^-?[0-9]+$/.test(v || "") ? parseInt(v, 10) : null; }; + return { + // w:line is 240ths of a line when w:lineRule is auto (the common + // case); exact/atLeast are in twips and the reader leaves them be. + line: num(line), + lineRule: attrs["w:lineRule"] || null, + before: num(attrs["w:before"]), + after: num(attrs["w:after"]) + }; + } + + function readUnderline(element) {`, + }, + { + file: "lib/docx/body-reader.js", + find: ` indent: readParagraphIndent(element.firstOrEmpty("w:ind"))`, + replace: ` indent: readParagraphIndent(element.firstOrEmpty("w:ind")), + spacing: readParagraphSpacing(element.firstOrEmpty("w:spacing")), + // Word's horizontal rule is an empty paragraph with a bottom + // border; without this the editor can't tell one from a + // blank line, and can't write one back either. + hasBottomBorder: readHasBottomBorder(element.firstOrEmpty("w:pBdr"))`, + }, + { + file: "lib/docx/body-reader.js", + find: ` function readParagraphIndent(element) {`, + replace: ` function readHasBottomBorder(element) { + var bottom = element.firstOrEmpty("w:bottom").attributes["w:val"]; + return !!bottom && bottom !== "none" && bottom !== "nil"; + } + + function readParagraphIndent(element) {`, + }, + // Images: mammoth hands back the file but not the size Word was drawing it + // at (wp:extent, in EMU). Without it a picture the author scaled down to a + // thumbnail would come back at full natural size on the next save. + { + file: "lib/docx/body-reader.js", + find: ` return readImage(blipImageFile, altText).map(function(imageElement) {`, + replace: ` var extentAttributes = element.firstOrEmpty("wp:extent").attributes; + return readImage(blipImageFile, altText, extentAttributes).map(function(imageElement) {`, + }, + { + file: "lib/docx/body-reader.js", + find: ` function readImage(imageFile, altText) { + var contentType = contentTypes.findContentType(imageFile.path); + + var image = documents.Image({ + readImage: imageFile.read, + altText: altText, + contentType: contentType + });`, + replace: ` function readImage(imageFile, altText, extent) { + var contentType = contentTypes.findContentType(imageFile.path); + + // 12700 EMU to the point. + var emuToPt = function(v) { + return /^[0-9]+$/.test(v || "") ? Math.round(parseInt(v, 10) / 12700 * 100) / 100 : null; + }; + var image = documents.Image({ + readImage: imageFile.read, + altText: altText, + contentType: contentType, + widthPt: emuToPt(extent && extent.cx), + heightPt: emuToPt(extent && extent.cy) + });`, + }, + { + file: "lib/documents.js", + find: ` altText: options.altText, + contentType: options.contentType`, + replace: ` altText: options.altText, + contentType: options.contentType, + widthPt: options.widthPt == null ? null : options.widthPt, + heightPt: options.heightPt == null ? null : options.heightPt`, + }, + { + file: "lib/documents.js", + find: ` highlight: properties.highlight || null + }; +}`, + replace: ` highlight: properties.highlight || null, + color: properties.color || null + }; +}`, + }, + { + file: "lib/documents.js", + find: ` indent: { + start: indent.start || null, + end: indent.end || null, + firstLine: indent.firstLine || null, + hanging: indent.hanging || null + } + };`, + replace: ` indent: { + start: indent.start || null, + end: indent.end || null, + firstLine: indent.firstLine || null, + hanging: indent.hanging || null + }, + spacing: properties.spacing || null, + hasBottomBorder: !!properties.hasBottomBorder + };`, + }, + // Which numbering definition a list item belongs to. Word uses numId to + // tell two adjacent lists apart — the point at which the numbering starts + // again at 1 — and mammoth resolves it to a level and then forgets it, + // which leaves the reader unable to see where one list ends and the next + // begins. + { + file: "lib/docx/body-reader.js", + find: `function readNumberingProperties(styleId, element, numbering) { + var level = element.firstOrEmpty("w:ilvl").attributes["w:val"]; + var numId = element.firstOrEmpty("w:numId").attributes["w:val"]; + if (level !== undefined && numId !== undefined) { + return numbering.findLevel(numId, level); + }`, + replace: `function readNumberingProperties(styleId, element, numbering) { + var level = element.firstOrEmpty("w:ilvl").attributes["w:val"]; + var numId = element.firstOrEmpty("w:numId").attributes["w:val"]; + var withNumId = function(found, id) { + return found == null ? found : Object.assign({}, found, {numId: id == null ? null : String(id)}); + }; + if (level !== undefined && numId !== undefined) { + return withNumId(numbering.findLevel(numId, level), numId); + }`, + }, + { + file: "lib/docx/body-reader.js", + find: ` if (numId !== undefined) { + return numbering.findLevel(numId, "0"); + } + + return null; +}`, + replace: ` if (numId !== undefined) { + return withNumId(numbering.findLevel(numId, "0"), numId); + } + + return null; +}`, + }, + { + file: "lib/docx/numbering-xml.js", + find: ` levelWithoutIndex = { + isOrdered: isOrdered,`, + replace: ` levelWithoutIndex = { + numFmt: numFmt || null, + isOrdered: isOrdered,`, + }, + { + file: "lib/docx/numbering-xml.js", + find: ` levels[levelIndex] = { + isOrdered: isOrdered,`, + replace: ` levels[levelIndex] = { + numFmt: numFmt || null, + isOrdered: isOrdered,`, + }, +]; + +export function applyPatches(relPath, source) { + let out = source; + let hits = 0; + for (const p of patches) { + if (relPath !== "mammoth/" + p.file) continue; + if (!out.includes(p.find)) { + throw new Error(`mammoth patch anchor missing in ${p.file}:\n${p.find.slice(0, 90)}…\n` + + `A mammoth upgrade probably moved it. Re-check the patch before shipping.`); + } + out = out.replace(p.find, p.replace); + hits++; + } + return { code: out, hits }; +} diff --git a/addon-build/docx-editor/test/corpus.mjs b/addon-build/docx-editor/test/corpus.mjs new file mode 100644 index 00000000..0e536159 --- /dev/null +++ b/addon-build/docx-editor/test/corpus.mjs @@ -0,0 +1,114 @@ +// Runs the round-trip over a folder of real .docx files. +// +// node test/corpus.mjs [more…] +// +// Reports structure only — block counts, features found, whether the saved +// package is well-formed and whether a second read matches the first. It +// never prints document text, and it writes its output to a temp folder +// rather than next to the input. +import { readFileSync, writeFileSync, readdirSync, statSync, mkdtempSync } from "node:fs"; +import path from "node:path"; +import os from "node:os"; +import { loadAddonLibs, summarise, diff } from "./harness.mjs"; + +const DocxEditor = loadAddonLibs(); +const schema = DocxEditor.schema.build(); +const outDir = mkdtempSync(path.join(os.tmpdir(), "docx-corpus-")); + +function collect(target, into) { + let st; + try { st = statSync(target); } catch { return into; } + if (st.isDirectory()) { + for (const name of readdirSync(target)) { + if (name.startsWith("~$")) continue; // Word lock files + collect(path.join(target, name), into); + } + } else if (/\.docx$/i.test(target)) { + into.push(target); + } + return into; +} + +const targets = []; +for (const arg of process.argv.slice(2)) collect(arg, targets); +if (!targets.length) { console.error("no .docx files found"); process.exit(2); } + +const counters = { ok: 0, drift: 0, invalid: 0, failed: 0 }; +const featureTally = new Map(); +const problems = []; + +for (const file of targets) { + const label = path.basename(file).replace(/[^\x20-\x7e]/g, "?"); + let bytes; + try { bytes = new Uint8Array(readFileSync(file)); } + catch (e) { problems.push(`${label}: unreadable (${e.message})`); counters.failed++; continue; } + + try { + const first = await DocxEditor.read.docxToDoc(bytes, schema); + for (const f of first.report.features) { + featureTally.set(f.label, (featureTally.get(f.label) || 0) + 1); + } + const saved = await DocxEditor.write.docToDocx(first.doc, { + originalBytes: bytes, setup: first.setup, meta: first.meta, + }); + const second = await DocxEditor.read.docxToDoc(saved.bytes, schema); + + // Package sanity, same checks as the fixture round-trip. + const zip = await DocxEditor.pkg.loadZip(saved.bytes); + const names = Object.keys(zip.files); + const bad = []; + for (const name of names) { + if (!name.endsWith(".xml") && !name.endsWith(".rels")) continue; + try { DocxEditor.pkg.parseXml(await zip.file(name).async("string")); } + catch (e) { bad.push(name); } + } + const relsDoc = DocxEditor.pkg.parseXml(await zip.file("word/_rels/document.xml.rels").async("string")); + const declared = new Set(Array.from(relsDoc.getElementsByTagName("*")) + .filter((e) => e.localName === "Relationship").map((e) => e.getAttribute("Id"))); + const docXml = await zip.file("word/document.xml").async("string"); + const dangling = [...new Set([...docXml.matchAll(/r:(?:id|embed|link)="([^"]+)"/g)].map((m) => m[1]))] + .filter((id) => !declared.has(id)); + const missingParts = Array.from(relsDoc.getElementsByTagName("*")) + .filter((e) => e.localName === "Relationship" && e.getAttribute("TargetMode") !== "External") + .map((e) => "word/" + (e.getAttribute("Target") || "").replace(/^\.\//, "")) + .filter((p) => !p.includes("://") && !names.includes(p)); + + const d = diff(summarise(first.doc), summarise(second.doc)); + const sizeKb = (bytes.length / 1024).toFixed(0); + + if (bad.length || dangling.length || missingParts.length) { + counters.invalid++; + problems.push(`${label}: INVALID PACKAGE — ${[ + bad.length ? `malformed ${bad.join(",")}` : "", + dangling.length ? `dangling ${dangling.join(",")}` : "", + missingParts.length ? `missing ${missingParts.join(",")}` : "", + ].filter(Boolean).join("; ")}`); + writeFileSync(path.join(outDir, label + ".out.docx"), Buffer.from(saved.bytes)); + } else if (d.length) { + counters.drift++; + problems.push(`${label} (${sizeKb} KB, ${first.doc.childCount} blocks): ${d.length} drift — ` + + d.slice(0, 3).map((x) => x.replace(/"[^"]{40,}"/g, '"…"')).join(" | ")); + } else { + counters.ok++; + } + } catch (e) { + counters.failed++; + problems.push(`${label}: THREW — ${(e && e.message || e).toString().slice(0, 160)}`); + } +} + +console.log(`\ncorpus: ${targets.length} documents`); +console.log(` clean round-trip : ${counters.ok}`); +console.log(` content drift : ${counters.drift}`); +console.log(` invalid package : ${counters.invalid}`); +console.log(` threw : ${counters.failed}`); +console.log(`\nfeatures across the corpus:`); +for (const [label, n] of [...featureTally].sort((a, b) => b[1] - a[1])) { + console.log(` ${String(n).padStart(3)}x ${label}`); +} +if (problems.length) { + console.log(`\nproblems:`); + for (const p of problems) console.log(" " + p); +} +console.log(`\noutput for failures: ${outDir}`); +process.exit(counters.invalid || counters.failed ? 2 : counters.drift ? 1 : 0); diff --git a/addon-build/docx-editor/test/fixture.mjs b/addon-build/docx-editor/test/fixture.mjs new file mode 100644 index 00000000..66e7f193 --- /dev/null +++ b/addon-build/docx-editor/test/fixture.mjs @@ -0,0 +1,204 @@ +// Builds the round-trip fixture: one .docx containing every feature v1 +// claims to support, plus a few it doesn't (a header, a footer, a footnote, +// a text box) so the preservation half of the deal is tested too. +// +// node test/fixture.mjs [out.docx] +import { + Document, Packer, Paragraph, TextRun, HeadingLevel, AlignmentType, Table, TableRow, + TableCell, WidthType, BorderStyle, ImageRun, ExternalHyperlink, PageBreak, Header, + Footer, FootnoteReferenceRun, LevelFormat, Tab, +} from "docx"; +import { writeFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; +import zlib from "node:zlib"; + +// A 4x3 red PNG, built rather than checked in so the fixture stays one file. +function tinyPng(w = 4, h = 3, rgb = [220, 40, 40]) { + const crcTable = (() => { + const t = new Int32Array(256); + for (let n = 0; n < 256; n++) { + let c = n; + for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1; + t[n] = c; + } + return t; + })(); + const crc = (buf) => { + let c = -1; + for (const b of buf) c = crcTable[(c ^ b) & 0xff] ^ (c >>> 8); + return (c ^ -1) >>> 0; + }; + const chunk = (type, data) => { + const len = Buffer.alloc(4); len.writeUInt32BE(data.length); + const body = Buffer.concat([Buffer.from(type, "latin1"), data]); + const c = Buffer.alloc(4); c.writeUInt32BE(crc(body)); + return Buffer.concat([len, body, c]); + }; + const ihdr = Buffer.alloc(13); + ihdr.writeUInt32BE(w, 0); ihdr.writeUInt32BE(h, 4); + ihdr[8] = 8; ihdr[9] = 2; ihdr[10] = 0; ihdr[11] = 0; ihdr[12] = 0; + const raw = Buffer.concat(Array.from({ length: h }, () => + Buffer.concat([Buffer.from([0]), Buffer.concat(Array.from({ length: w }, () => Buffer.from(rgb)))]))); + return Buffer.concat([ + Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]), + chunk("IHDR", ihdr), + chunk("IDAT", zlib.deflateSync(raw)), + chunk("IEND", Buffer.alloc(0)), + ]); +} + +const border = { style: BorderStyle.SINGLE, size: 4, color: "999999" }; +const cell = (text, opts = {}) => new TableCell(Object.assign({ + children: [new Paragraph({ children: [new TextRun({ text })] })], +}, opts)); + +export function buildFixture() { + const png = tinyPng(); + + const doc = new Document({ + title: "Round-trip fixture", + creator: "Silent Mode", + description: "Every v1 feature, once.", + numbering: { + config: [ + { + reference: "bullets", + levels: [ + { level: 0, format: LevelFormat.BULLET, text: "●", style: { paragraph: { indent: { left: 720, hanging: 360 } } } }, + { level: 1, format: LevelFormat.BULLET, text: "○", style: { paragraph: { indent: { left: 1440, hanging: 360 } } } }, + ], + }, + { + reference: "romans", + levels: [ + { level: 0, format: LevelFormat.LOWER_ROMAN, text: "%1.", style: { paragraph: { indent: { left: 720, hanging: 360 } } } }, + { level: 1, format: LevelFormat.LOWER_LETTER, text: "%2.", style: { paragraph: { indent: { left: 1440, hanging: 360 } } } }, + ], + }, + ], + }, + footnotes: { + 1: { children: [new Paragraph({ children: [new TextRun("A footnote the editor never renders.")] })] }, + }, + sections: [{ + properties: { + page: { + size: { width: 11906, height: 16838, orientation: "portrait" }, // A4 + margin: { top: 1134, right: 1134, bottom: 1134, left: 1701 }, // 2cm / 3cm left + }, + }, + headers: { + default: new Header({ children: [new Paragraph({ children: [new TextRun("Fixture header")] })] }), + }, + footers: { + default: new Footer({ children: [new Paragraph({ children: [new TextRun("Fixture footer")] })] }), + }, + children: [ + new Paragraph({ heading: HeadingLevel.HEADING_1, children: [new TextRun("Heading one")] }), + new Paragraph({ heading: HeadingLevel.HEADING_2, children: [new TextRun("Heading two")] }), + new Paragraph({ heading: HeadingLevel.HEADING_3, children: [new TextRun("Heading three")] }), + + new Paragraph({ + children: [ + new TextRun({ text: "plain " }), + new TextRun({ text: "bold", bold: true }), + new TextRun({ text: " italic", italics: true }), + new TextRun({ text: " underline", underline: {} }), + new TextRun({ text: " strike", strike: true }), + new TextRun({ text: " sup", superScript: true }), + new TextRun({ text: " sub", subScript: true }), + new TextRun({ text: " smallcaps", smallCaps: true }), + new TextRun({ text: " allcaps", allCaps: true }), + ], + }), + new Paragraph({ + children: [ + new TextRun({ text: "Georgia 16pt teal", font: "Georgia", size: 32, color: "008080" }), + new TextRun({ text: " highlighted", highlight: "yellow" }), + ], + }), + new Paragraph({ + alignment: AlignmentType.CENTER, + children: [new TextRun("centred")], + }), + new Paragraph({ + alignment: AlignmentType.RIGHT, + children: [new TextRun("right aligned")], + }), + new Paragraph({ + alignment: AlignmentType.JUSTIFIED, + spacing: { line: 360, lineRule: "auto", before: 120, after: 240 }, + indent: { left: 720 }, + children: [new TextRun("justified, 1.5 line spacing, 6pt before, 12pt after, indented one level")], + }), + new Paragraph({ + children: [ + new TextRun("before tab"), + new TextRun({ children: [new Tab()] }), + new TextRun("after tab"), + ], + }), + new Paragraph({ + children: [ + new TextRun("a link to "), + new ExternalHyperlink({ + link: "https://silentmode.st/", + children: [new TextRun({ text: "silentmode.st", style: "Hyperlink" })], + }), + new TextRun(" and a footnote"), + new FootnoteReferenceRun(1), + ], + }), + + new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun("bullet one")] }), + new Paragraph({ numbering: { reference: "bullets", level: 1 }, children: [new TextRun("nested bullet")] }), + new Paragraph({ numbering: { reference: "bullets", level: 0 }, children: [new TextRun("bullet two")] }), + + new Paragraph({ numbering: { reference: "romans", level: 0 }, children: [new TextRun("roman one")] }), + new Paragraph({ numbering: { reference: "romans", level: 1 }, children: [new TextRun("lettered sub-item")] }), + new Paragraph({ numbering: { reference: "romans", level: 0 }, children: [new TextRun("roman two")] }), + + new Paragraph({ style: "Quote", children: [new TextRun("A quotation, styled as Quote.")] }), + + new Paragraph({ + children: [new ImageRun({ + data: png, type: "png", + transformation: { width: 96, height: 72 }, + altText: { name: "red", description: "a red rectangle", title: "red" }, + })], + }), + + new Table({ + width: { size: 100, type: WidthType.PERCENTAGE }, + borders: { top: border, bottom: border, left: border, right: border, + insideHorizontal: border, insideVertical: border }, + rows: [ + new TableRow({ children: [cell("head A"), cell("head B"), cell("head C")] }), + new TableRow({ children: [cell("spans two", { columnSpan: 2 }), cell("c2")] }), + new TableRow({ children: [cell("tall", { rowSpan: 2 }), cell("b3"), cell("c3")] }), + new TableRow({ children: [cell("b4"), cell("c4")] }), + ], + }), + new Paragraph({ children: [new TextRun("after the table")] }), + + new Paragraph({ + border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: "808080", space: 1 } }, + }), + new Paragraph({ children: [new TextRun("after the rule")] }), + + new Paragraph({ children: [new PageBreak()] }), + new Paragraph({ children: [new TextRun("second page")] }), + ], + }], + }); + return Packer.toBuffer(doc); +} + +if (process.argv[1] && process.argv[1].endsWith("fixture.mjs")) { + const out = process.argv[2] || + path.join(path.dirname(fileURLToPath(import.meta.url)), "fixture.docx"); + const buf = await buildFixture(); + writeFileSync(out, buf); + console.log(`wrote ${out} (${(buf.length / 1024).toFixed(1)} KB)`); +} diff --git a/addon-build/docx-editor/test/harness.mjs b/addon-build/docx-editor/test/harness.mjs new file mode 100644 index 00000000..35458cfb --- /dev/null +++ b/addon-build/docx-editor/test/harness.mjs @@ -0,0 +1,124 @@ +// Loads the add-on's libraries the way the browser does, but under node, so +// the round-trip can be tested without driving a browser. +// +// The only difference from the real thing is where the vendored packages come +// from: the browser gets them out of vendor/docx-vendor.js, node gets them +// from node_modules — with mammoth taken from .patched/, the same patched copy +// that goes into the bundle. +import { readFileSync } from "node:fs"; +import { createRequire } from "node:module"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; +import vm from "node:vm"; +import { JSDOM } from "jsdom"; + +const here = path.dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); +export const ADDON = path.resolve(here, "../../../bundled-addons/docx-editor"); + +export function loadAddonLibs() { + const dom = new JSDOM(""); + globalThis.window = dom.window; + globalThis.document = dom.window.document; + globalThis.DOMParser = dom.window.DOMParser; + globalThis.XMLSerializer = dom.window.XMLSerializer; + globalThis.Node = dom.window.Node; + + globalThis.DOCXV = { + mammoth: require(path.resolve(here, "../.patched/mammoth")), + docx: require("docx"), + JSZip: require("jszip"), + pm: { + state: require("prosemirror-state"), + view: null, // not needed outside the browser + model: require("prosemirror-model"), + schemaBasic: require("prosemirror-schema-basic"), + schemaList: require("prosemirror-schema-list"), + tables: require("prosemirror-tables"), + history: require("prosemirror-history"), + commands: require("prosemirror-commands"), + keymap: require("prosemirror-keymap"), + inputrules: require("prosemirror-inputrules"), + dropcursor: null, + gapcursor: null, + }, + }; + globalThis.DocxEditor = {}; + + for (const f of ["pkg.js", "schema.js", "read.js", "write.js"]) { + const src = readFileSync(path.join(ADDON, "lib", f), "utf8"); + vm.runInThisContext(src, { filename: path.join(ADDON, "lib", f) }); + } + return globalThis.DocxEditor; +} + +// A compact, comparable view of a ProseMirror document: node types, the +// attributes that came from Word, and each text node's marks. Positions and +// ids are left out so the diff shows content drift and nothing else. +export function summarise(doc) { + const MEANINGFUL = ["level", "align", "indent", "lineHeight", "spaceBefore", "spaceAfter", + "format", "order", "colspan", "rowspan", "noteType", "noteId", + "alt", "width", "height"]; + function attrs(node) { + const out = {}; + for (const k of MEANINGFUL) { + const v = node.attrs && node.attrs[k]; + if (v === undefined || v === null) continue; + if ((k === "colspan" || k === "rowspan" || k === "order") && v === 1) continue; + if (k === "indent" && v === 0) continue; + out[k] = v; + } + return out; + } + function walk(node) { + if (node.isText) { + const marks = node.marks.map((m) => { + const a = Object.keys(m.attrs || {}) + .filter((k) => m.attrs[k] !== null && m.attrs[k] !== undefined) + .sort() + .map((k) => `${k}=${m.attrs[k]}`) + .join(","); + return a ? `${m.type.name}(${a})` : m.type.name; + }).sort(); + return { t: "text", text: node.text, marks }; + } + const entry = { t: node.type.name }; + const a = attrs(node); + if (Object.keys(a).length) entry.a = a; + if (node.type.name === "image") { + // Compare the bytes by length, not by the whole base64 blob. + entry.a = Object.assign(entry.a || {}, { srcLen: (node.attrs.src || "").length }); + } + const kids = []; + node.forEach((child) => kids.push(walk(child))); + if (kids.length) entry.c = kids; + return entry; + } + return walk(doc); +} + +export function diff(a, b, pathStr = "doc", out = []) { + const ja = JSON.stringify(a), jb = JSON.stringify(b); + if (ja === jb) return out; + if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) { + out.push(`${pathStr}: ${ja} -> ${jb}`); + return out; + } + if (Array.isArray(a) !== Array.isArray(b)) { + out.push(`${pathStr}: shape changed`); + return out; + } + if (Array.isArray(a)) { + if (a.length !== b.length) out.push(`${pathStr}: ${a.length} children -> ${b.length}`); + for (let i = 0; i < Math.max(a.length, b.length); i++) { + if (i >= a.length) { out.push(`${pathStr}[${i}]: added ${JSON.stringify(b[i]).slice(0, 120)}`); continue; } + if (i >= b.length) { out.push(`${pathStr}[${i}]: lost ${JSON.stringify(a[i]).slice(0, 120)}`); continue; } + diff(a[i], b[i], `${pathStr}[${i}]`, out); + } + return out; + } + for (const k of new Set([...Object.keys(a), ...Object.keys(b)])) { + diff(a[k], b[k], `${pathStr}.${k}`, out); + } + return out; +} diff --git a/addon-build/docx-editor/test/probe.mjs b/addon-build/docx-editor/test/probe.mjs new file mode 100644 index 00000000..4493f507 --- /dev/null +++ b/addon-build/docx-editor/test/probe.mjs @@ -0,0 +1,72 @@ +// Ad-hoc probe for one document: prints structure around a given block +// index, before and after a round-trip, plus the raw vMerge / numId picture +// from both packages. Structure only — no document text beyond short labels. +// +// node test/probe.mjs [blockIndex] +import { readFileSync, writeFileSync } from "node:fs"; +import { loadAddonLibs, summarise } from "./harness.mjs"; + +const DocxEditor = loadAddonLibs(); +const schema = DocxEditor.schema.build(); +const file = process.argv[2]; +const focus = process.argv[3] ? parseInt(process.argv[3], 10) : null; +const bytes = new Uint8Array(readFileSync(file)); + +const W = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + +async function numberingPicture(b, label) { + const zip = await DocxEditor.pkg.loadZip(b); + const doc = DocxEditor.pkg.parseXml(await zip.file("word/document.xml").async("string")); + const ps = doc.getElementsByTagNameNS(W, "p"); + const seq = []; + for (let i = 0; i < ps.length; i++) { + const numPr = ps[i].getElementsByTagNameNS(W, "numPr")[0]; + if (!numPr) { seq.push("."); continue; } + const numId = numPr.getElementsByTagNameNS(W, "numId")[0]; + const ilvl = numPr.getElementsByTagNameNS(W, "ilvl")[0]; + seq.push(`${numId ? numId.getAttributeNS(W, "val") : "?"}/${ilvl ? ilvl.getAttributeNS(W, "val") : "0"}`); + } + console.log(`${label} numbering (numId/level per paragraph, "." = not a list item):`); + console.log(" " + seq.join(" ")); + + const merges = []; + const rows = doc.getElementsByTagNameNS(W, "tr"); + for (let r = 0; r < rows.length; r++) { + const cells = rows[r].getElementsByTagNameNS(W, "tc"); + const marks = []; + for (let c = 0; c < cells.length; c++) { + const vm = cells[c].getElementsByTagNameNS(W, "vMerge")[0]; + if (!vm) { marks.push("-"); continue; } + marks.push(vm.getAttributeNS(W, "val") === "restart" ? "R" : "c"); + } + if (marks.includes("R") || marks.includes("c")) merges.push(`r${r}:${marks.join("")}`); + } + if (merges.length) console.log(`${label} vMerge: ${merges.slice(0, 20).join(" ")}`); +} + +const first = await DocxEditor.read.docxToDoc(bytes, schema); +const saved = await DocxEditor.write.docToDocx(first.doc, { + originalBytes: bytes, setup: first.setup, meta: first.meta, +}); +const second = await DocxEditor.read.docxToDoc(saved.bytes, schema); + +console.log(`blocks: ${first.doc.childCount} -> ${second.doc.childCount}`); +if (saved.warnings.length) console.log(`warnings: ${saved.warnings.join(" | ")}`); +console.log(); +await numberingPicture(bytes, "original"); +console.log(); +await numberingPicture(saved.bytes, "saved "); + +if (focus !== null) { + const outline = (doc, from) => { + const lines = []; + for (let i = from; i < Math.min(doc.childCount, from + 8); i++) { + const n = doc.child(i); + lines.push(` [${i}] ${n.type.name}${n.childCount ? ` (${n.childCount} kids)` : ""} ` + + JSON.stringify(n.textContent.slice(0, 40))); + } + return lines.join("\n"); + }; + console.log(`\nbefore, from [${focus}]:\n` + outline(first.doc, focus)); + console.log(`\nafter, from [${focus}]:\n` + outline(second.doc, focus)); +} diff --git a/addon-build/docx-editor/test/roundtrip.mjs b/addon-build/docx-editor/test/roundtrip.mjs new file mode 100644 index 00000000..a6352f17 --- /dev/null +++ b/addon-build/docx-editor/test/roundtrip.mjs @@ -0,0 +1,95 @@ +// The round-trip test: fixture.docx -> editor model -> .docx -> editor model, +// then diff the two models. Anything that shows up in the diff is something a +// user would lose by opening a document and pressing Save. +// +// node test/roundtrip.mjs [some-other.docx] +import { writeFileSync, readFileSync, existsSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import path from "node:path"; +import { loadAddonLibs, summarise, diff } from "./harness.mjs"; +import { buildFixture } from "./fixture.mjs"; + +const here = path.dirname(fileURLToPath(import.meta.url)); +const DocxEditor = loadAddonLibs(); +const schema = DocxEditor.schema.build(); + +const input = process.argv[2]; +const original = input && existsSync(input) + ? new Uint8Array(readFileSync(input)) + : new Uint8Array(await buildFixture()); +console.log(`input: ${input || "generated fixture"} (${(original.length / 1024).toFixed(1)} KB)\n`); + +// --- pass 1: read --------------------------------------------------------- +const first = await DocxEditor.read.docxToDoc(original, schema); +console.log(`read: ${first.doc.childCount} top-level blocks`); +if (first.report.features.length) { + for (const f of first.report.features) { + console.log(` [${f.level}] ${f.label}${f.note ? " — " + f.note : ""}`); + } +} +if (first.warnings.length) console.log(` warnings: ${first.warnings.join(", ")}`); + +// --- pass 2: write -------------------------------------------------------- +const saved = await DocxEditor.write.docToDocx(first.doc, { + originalBytes: original, + setup: first.setup, + meta: first.meta, +}); +console.log(`\nwrote: ${(saved.bytes.length / 1024).toFixed(1)} KB`); +if (saved.carried.length) console.log(` carried over: ${saved.carried.join(", ")}`); +if (saved.warnings.length) console.log(` warnings: ${saved.warnings.join(", ")}`); +const outPath = path.join(here, "roundtrip-out.docx"); +writeFileSync(outPath, Buffer.from(saved.bytes)); + +// --- pass 3: read back ---------------------------------------------------- +const second = await DocxEditor.read.docxToDoc(saved.bytes, schema); +console.log(`re-read: ${second.doc.childCount} top-level blocks`); + +// --- package sanity ------------------------------------------------------- +const zip = await DocxEditor.pkg.loadZip(saved.bytes); +const names = Object.keys(zip.files).sort(); +const required = ["[Content_Types].xml", "_rels/.rels", "word/document.xml", + "word/_rels/document.xml.rels", "word/styles.xml"]; +const missing = required.filter((r) => !names.includes(r)); +let xmlErrors = []; +for (const name of names) { + if (!name.endsWith(".xml") && !name.endsWith(".rels")) continue; + try { DocxEditor.pkg.parseXml(await zip.file(name).async("string")); } + catch (e) { xmlErrors.push(`${name}: ${e.message}`); } +} +// Every r:id the document references must exist in its rels part. +const relsDoc = DocxEditor.pkg.parseXml(await zip.file("word/_rels/document.xml.rels").async("string")); +const declared = new Set(Array.from(relsDoc.getElementsByTagName("*")) + .filter((e) => e.localName === "Relationship").map((e) => e.getAttribute("Id"))); +const docXml = await zip.file("word/document.xml").async("string"); +const referenced = [...docXml.matchAll(/r:(?:id|embed|link)="([^"]+)"/g)].map((m) => m[1]); +const danglingRels = [...new Set(referenced)].filter((id) => !declared.has(id)); +// Every part declared in the rels must actually be in the package. +const danglingParts = Array.from(relsDoc.getElementsByTagName("*")) + .filter((e) => e.localName === "Relationship" && e.getAttribute("TargetMode") !== "External") + .map((e) => "word/" + (e.getAttribute("Target") || "").replace(/^\.\//, "")) + .filter((p) => !p.includes("://") && !names.includes(p)); + +console.log("\npackage sanity"); +console.log(` parts: ${names.length}`); +console.log(` missing required: ${missing.length ? missing.join(", ") : "none"}`); +console.log(` malformed xml: ${xmlErrors.length ? xmlErrors.join("; ") : "none"}`); +console.log(` dangling r:ids: ${danglingRels.length ? danglingRels.join(", ") : "none"}`); +console.log(` rels pointing at missing parts: ${danglingParts.length ? danglingParts.join(", ") : "none"}`); +for (const want of ["word/header1.xml", "word/footer1.xml", "word/footnotes.xml"]) { + if (names.includes(want)) console.log(` kept ${want}`); +} + +// --- the diff ------------------------------------------------------------- +const a = summarise(first.doc); +const b = summarise(second.doc); +const d = diff(a, b); +console.log(`\nround-trip diff: ${d.length ? d.length + " difference(s)" : "clean"}`); +for (const line of d.slice(0, 60)) console.log(" " + line); +if (d.length > 60) console.log(` … and ${d.length - 60} more`); + +writeFileSync(path.join(here, "roundtrip-a.json"), JSON.stringify(a, null, 1)); +writeFileSync(path.join(here, "roundtrip-b.json"), JSON.stringify(b, null, 1)); + +const fatal = missing.length || xmlErrors.length || danglingRels.length || danglingParts.length; +process.exit(fatal ? 2 : d.length ? 1 : 0); diff --git a/addon-build/docx-editor/vendor-entry.js b/addon-build/docx-editor/vendor-entry.js new file mode 100644 index 00000000..b2960f48 --- /dev/null +++ b/addon-build/docx-editor/vendor-entry.js @@ -0,0 +1,30 @@ +// Build-time entry. Everything the docx-editor add-on needs from npm gets +// pulled in here and re-exported on one global, so the shipped add-on can +// stay plain classic scripts (file:// pages can't load ES modules — Chromium +// blocks module fetches from the null origin). +import mammoth from "mammoth"; +import * as docx from "docx"; +import JSZip from "jszip"; + +import * as pmState from "prosemirror-state"; +import * as pmView from "prosemirror-view"; +import * as pmModel from "prosemirror-model"; +import * as pmSchemaBasic from "prosemirror-schema-basic"; +import * as pmSchemaList from "prosemirror-schema-list"; +import * as pmTables from "prosemirror-tables"; +import * as pmHistory from "prosemirror-history"; +import * as pmCommands from "prosemirror-commands"; +import * as pmKeymap from "prosemirror-keymap"; +import * as pmInputRules from "prosemirror-inputrules"; +import * as pmDropCursor from "prosemirror-dropcursor"; +import * as pmGapCursor from "prosemirror-gapcursor"; + +window.DOCXV = { + mammoth, docx, JSZip, + pm: { + state: pmState, view: pmView, model: pmModel, + schemaBasic: pmSchemaBasic, schemaList: pmSchemaList, tables: pmTables, + history: pmHistory, commands: pmCommands, keymap: pmKeymap, + inputrules: pmInputRules, dropcursor: pmDropCursor, gapcursor: pmGapCursor, + }, +}; diff --git a/bundled-addons/docx-editor/ROUND-TRIP.md b/bundled-addons/docx-editor/ROUND-TRIP.md new file mode 100644 index 00000000..64f33c87 --- /dev/null +++ b/bundled-addons/docx-editor/ROUND-TRIP.md @@ -0,0 +1,121 @@ +# What survives a round trip + +The editor rebuilds a document's body from what you see on screen and carries +the rest of the original package across. This is the ledger of what that costs. + +Measured over 66 real-world Word documents found on a working machine (CVs, +contracts, invoices, forms, letters — Greek, Russian, German and English): + + clean round-trip : 65 + content drift : 1 (a 7 MB WMF picture, see "Dropped") + invalid package : 0 + threw : 0 + +"Clean" means: read the file, save it, read it again, and the two editor +documents are identical — same blocks, same attributes, same marks on the same +text. The saved package is also checked for well-formed XML, no dangling +relationship ids and no relationships pointing at parts that aren't there. + +Reproduce with: + + cd addon-build/docx-editor + npm install && npm run build + node test/roundtrip.mjs # the built-in fixture + node test/corpus.mjs # a real corpus + +## How the two halves work + +Reading uses [mammoth](https://github.com/mwilliamson/mammoth.js), but not its +HTML. mammoth's converter is deliberately semantic, and HTML has nowhere to put +a run's colour or a paragraph's line spacing, so it drops them. We take its +parsed *document model* instead, through the public `transformDocument` hook, +and walk that into the editor's model. See `addon-build/docx-editor/patches.mjs` +for the six properties we taught that model to carry: run colour, paragraph +spacing, paragraph bottom border, image display size, numbering format and +numbering id. + +Writing uses [docx](https://www.npmjs.com/package/docx), which always builds a +brand-new package. Anything living outside the document body would therefore +vanish, so `lib/pkg.js` grafts it back: headers, footers, footnotes, endnotes, +the style catalogue, the theme and the page setup, re-wiring relationship ids +and content types as it goes. + +## Kept + +| | How | +|---|---| +| Headers and footers | The parts are copied across with their own relationships and images, and re-referenced from the new `sectPr`. | +| Footnotes and endnotes | The markers survive in the body as their own node; `footnotes.xml` is copied wholesale so the ids still match. | +| Page size, orientation, margins, gutter, title page | Read off the first `sectPr` and handed to the builder. | +| The document's styles | The original `styles.xml` is merged over the builder's. Where both define a style id the original wins — it is what the document actually looked like. `docDefaults` comes across too, so unstyled paragraphs don't shift. | +| Theme, fonts | `theme1.xml` is copied. | +| Title, author, subject, keywords | From `docProps/core.xml`. | +| Bold, italic, underline, strike, super/subscript, all-caps, small-caps | | +| Font family, size, colour, highlight | Highlight is Word's 15-value enum, not a hex colour, so it passes through exactly. | +| Alignment, indent, line spacing, space before/after | | +| Headings 1–6, quotes, code blocks | Code blocks ride on a `SourceCode` paragraph style. | +| Bulleted and numbered lists, nested, with their numbering format | Format is kept per level, so a list that is decimal at the top and lettered underneath stays that way. | +| Where one list ends and the next begins | Tracked by Word's `numId`, so a second list still restarts at 1. | +| Tables, including merged cells | Both directions. A 12-row vertical merge comes back as a 12-row vertical merge. | +| Images | At the size Word was displaying them, to EMU precision, not the file's natural size. | +| Links, internal anchors | | +| Page breaks, horizontal rules | A rule is Word's empty paragraph with a bottom border, and is written back as one. | + +## Dropped + +These are detected when the file opens and named in a banner before any +editing, and again in the About dialog. The original file on disk is never +overwritten — a save downloads `-edited.docx`. + +- **Tracked changes.** mammoth renders insertions as ordinary text and drops + deletions, so a save would silently accept every pending revision. A document + with them opens read-only until you explicitly choose "Accept all and edit". +- **Comments.** Same gate as tracked changes. +- **Equations** (OMML), **shapes, text boxes and WordArt**, **content controls**. +- **Fields** — page numbers, tables of contents, cross-references. The text Word + last calculated is kept; the field code that would recalculate it is not. +- **Bookmarks.** +- **Section breaks and multi-column layout.** Only the first section's page + setup is kept. +- **Metafile pictures (WMF/EMF).** Word's vector picture format: browsers can't + display it and the builder can't write it. This is the single drift in the + corpus above — one CV with a 7 MB WMF. + +## Kept, but not exactly + +- **Paragraph borders and shading.** Only the rule under an empty paragraph + round-trips. A box around a paragraph, or a shaded paragraph, is lost. +- **Custom tab stops.** Tab characters are kept; the stop positions are not. +- **Exact line spacing.** `atLeast` and `exact` line rules are read but the + editor has no control for them, so they are written back as-is only when the + paragraph is untouched. +- **Table borders.** mammoth doesn't report the borders it read, so every table + is written with a plain single-line border. A borderless table gains lines. +- **List indentation depth.** A list Word started at level 2 with no level 0 or + 1 above it becomes a top-level list, and is written at level 0. +- **An empty paragraph after a table inside a cell.** OOXML forbids a cell that + ends with a table, so every such document carries a paragraph the author + never typed. It is dropped on read and put back on write. + +## Decisions worth knowing about + +**Why not preserve the dropped features as raw XML?** `docx` can embed raw +OOXML (`ImportedXmlComponent`), so it is technically possible. What makes it +expensive is position: mammoth silently discards the elements it can't model +and reports no location for them, so anchoring a passthrough node in the right +place needs a second OOXML reader running alongside mammoth purely to recover +block order. That is a large amount of machinery whose failure mode is a subtly +corrupt package, which is worse than an honest warning. The grafting approach +gets headers, footers, notes, page setup and styles — the things most real +documents actually have — without that risk. + +**Why patch mammoth instead of using it as shipped?** Colour, line spacing and +numbering format are all editable in this editor's ribbon. Shipping without the +patches would mean the editor shows a control for something it silently eats on +the next save. The patches are six string replacements applied at build time +and each one asserts its anchor, so a mammoth upgrade that moves the code fails +the build instead of quietly shipping a lossy reader. + +**Why is the original file never overwritten?** Because of everything on the +"Dropped" list. A save is a download of a new file, so the original is always +still there to fall back on. diff --git a/bundled-addons/docx-editor/addon.json b/bundled-addons/docx-editor/addon.json new file mode 100644 index 00000000..37a041fd --- /dev/null +++ b/bundled-addons/docx-editor/addon.json @@ -0,0 +1,11 @@ +{ + "id": "docx-editor", + "name": "Word editor", + "version": "0.1.0", + "description": "Open, edit and save Word documents (.docx) in a full Theseus tab. Ribbon-style formatting, tables, lists, images and links; headers, footers, footnotes, page setup and the document's own styles are carried through a save untouched.", + "author": "Silent Mode", + "icon": "📝", + "main": "index.js", + "capabilities": ["sidebar-panel", "open-tab"], + "updateURL": "https://navigate.st/bns/theseus.x/extensions/docx-editor/updates.json" +} diff --git a/bundled-addons/docx-editor/editor.css b/bundled-addons/docx-editor/editor.css new file mode 100644 index 00000000..fc317355 --- /dev/null +++ b/bundled-addons/docx-editor/editor.css @@ -0,0 +1,234 @@ +/* Word editor — full-tab. Shares the screenshot editor's shell (same + variables, same topbar + toolbar + footer skeleton) with a ribbon-ish + toolbar over a continuous document surface. + + "Ribbon-ish" means grouped button sets with labelled groups, not a real + ribbon widget: no tabs, no gallery, no contextual tab strip. It reads as + Office without pretending to be it. */ +:root { color-scheme: light dark; + --bg:#0e131c; --panel:#141a24; --panel2:#191f2b; --line:rgba(255,255,255,.09); + --ink:#e7eaf1; --mut:#8b98a9; --dim:#5e6678; --acid:#d6ff3d; + --danger:#ff5b5b; --warn:#ffb648; --board:#0a0d13; + --paper:#ffffff; --paper-ink:#14161a; --paper-edge:rgba(0,0,0,.4); } +@media (prefers-color-scheme: light) { + :root { --bg:#f8faff; --panel:#ffffff; --panel2:#eff3fb; --line:rgba(0,0,0,.10); + --ink:#1a1f2b; --mut:#5c6577; --dim:#8a93a5; --acid:#0AC18E; + --board:#dde3ee; --paper-edge:rgba(0,0,0,.18); } +} +* { box-sizing: border-box; } +html, body { margin: 0; height: 100%; } +body { background: var(--bg); color: var(--ink); + font: 13px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; + display: flex; flex-direction: column; overflow: hidden; } +[hidden] { display: none !important; } + +/* ---- top bar --------------------------------------------------------- */ +.topbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; + border-bottom: 1px solid var(--line); background: var(--panel); + user-select: none; flex-wrap: nowrap; } +.topbar .spacer { flex: 1; } +.topbar .docname { color: var(--ink); font-size: 12.5px; font-weight: 600; + overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + max-width: 42vw; margin: 0 6px; } +.topbar .docname .dirty { color: var(--acid); margin-left: 4px; } + +/* ---- ribbon ---------------------------------------------------------- */ +.ribbon { display: flex; align-items: stretch; gap: 0; + padding: 4px 6px 2px; border-bottom: 1px solid var(--line); + background: linear-gradient(180deg, var(--panel), var(--panel2)); + user-select: none; overflow-x: auto; overflow-y: hidden; } +.rgroup { display: flex; flex-direction: column; align-items: center; + gap: 3px; padding: 0 8px; flex: 0 0 auto; + border-right: 1px solid var(--line); } +.rgroup:last-child { border-right: 0; } +.rgroup .rrow { display: flex; align-items: center; gap: 3px; flex-wrap: nowrap; } +.rgroup .rlabel { font-size: 10px; color: var(--dim); letter-spacing: .02em; + text-transform: lowercase; } +.rgroup[data-contextual] { opacity: .45; pointer-events: none; } +.rgroup[data-contextual="on"] { opacity: 1; pointer-events: auto; } + +.btn { + border: 1px solid transparent; background: transparent; color: var(--ink); + min-width: 26px; height: 26px; border-radius: 5px; cursor: pointer; + display: inline-flex; align-items: center; justify-content: center; + padding: 0 4px; font: inherit; line-height: 0; + transition: background 90ms, border-color 90ms; +} +.btn:hover:not(:disabled) { background: var(--panel2); border-color: var(--line); } +.btn.on { background: rgb(from var(--acid) r g b / .16); + border-color: rgb(from var(--acid) r g b / .55); color: var(--acid); } +.btn:disabled { opacity: .35; cursor: default; } +.btn svg { width: 15px; height: 15px; display: block; } +.btn.wide { min-width: auto; padding: 0 8px; gap: 5px; line-height: 1; } +.btn.wide span { font-size: 12px; } +.btn.primary { background: var(--acid); color: #101418; border-color: transparent; font-weight: 600; } +.btn.primary:hover:not(:disabled) { filter: brightness(1.06); background: var(--acid); } +.btn.danger:hover:not(:disabled) { border-color: rgba(255,91,91,.55); color: var(--danger); } +.btn .caret { width: 8px; height: 8px; opacity: .6; } + +select.rsel, input.rnum { + height: 26px; border-radius: 5px; border: 1px solid var(--line); + background: var(--panel2); color: var(--ink); font: inherit; font-size: 12px; + padding: 0 4px; cursor: pointer; max-width: 150px; +} +select.rsel:focus, input.rnum:focus { outline: 1px solid rgb(from var(--acid) r g b / .5); } +input.rnum { width: 52px; cursor: text; text-align: center; } +.swatch-btn { position: relative; } +.swatch-btn .bar { position: absolute; left: 4px; right: 4px; bottom: 3px; + height: 3px; border-radius: 1px; background: #c00; } + +/* colour / highlight popovers */ +.pop { position: absolute; z-index: 60; background: var(--panel); + border: 1px solid var(--line); border-radius: 8px; padding: 8px; + box-shadow: 0 10px 28px rgba(0,0,0,.35); } +.pop .grid { display: grid; grid-template-columns: repeat(8, 20px); gap: 4px; } +.pop .chip { width: 20px; height: 20px; border-radius: 4px; cursor: pointer; + border: 1px solid var(--line); padding: 0; } +.pop .chip:hover { outline: 2px solid rgb(from var(--acid) r g b / .6); } +.pop .prow { display: flex; align-items: center; gap: 6px; margin-top: 8px; } +.pop .prow .btn { height: 24px; } + +/* ---- banners --------------------------------------------------------- */ +.banners { background: var(--board); } +.banner { display: flex; align-items: flex-start; gap: 10px; + padding: 9px 14px; font-size: 12.5px; line-height: 1.45; + border-bottom: 1px solid var(--line); background: var(--panel); } +.banner .ico { flex: 0 0 auto; font-size: 14px; line-height: 1.3; } +.banner .body { flex: 1 1 auto; min-width: 0; } +.banner .body b { font-weight: 600; } +.banner .acts { flex: 0 0 auto; display: flex; gap: 6px; } +.banner.warn { border-left: 3px solid var(--warn); } +.banner.block { border-left: 3px solid var(--danger); } +.banner.info { border-left: 3px solid var(--acid); } +.banner .btn { border-color: var(--line); background: var(--panel2); } + +/* ---- document surface ------------------------------------------------ */ +.board { flex: 1; overflow: auto; background: var(--board); padding: 20px 16px 60px; } +.sheet { max-width: 8.27in; margin: 0 auto; background: var(--paper); + color: var(--paper-ink); box-shadow: 0 2px 18px var(--paper-edge); + padding: 0.9in 1in; min-height: 60vh; } +.sheet:focus { outline: none; } +.sheet .ProseMirror { outline: none; min-height: 50vh; } + +/* Word's own defaults are a serif body at 11pt with a little space after + each paragraph; matching them means what the editor shows is roughly + what Word will show. */ +.sheet { + font: 11pt/1.5 Georgia, "Times New Roman", serif; +} +.sheet p { margin: 0 0 8pt; } +.sheet h1, .sheet h2, .sheet h3, .sheet h4, .sheet h5, .sheet h6 { + font-family: "Segoe UI Semibold", "Segoe UI", Calibri, system-ui, sans-serif; + color: #1f4e79; font-weight: 600; margin: 14pt 0 6pt; line-height: 1.25; +} +.sheet h1 { font-size: 20pt; } .sheet h2 { font-size: 16pt; } +.sheet h3 { font-size: 13pt; } .sheet h4 { font-size: 12pt; } +.sheet h5 { font-size: 11pt; } .sheet h6 { font-size: 10.5pt; color: #2e74b5; } +.sheet blockquote { margin: 8pt 0 8pt 24pt; padding-left: 10pt; + border-left: 3px solid rgba(0,0,0,.15); color: #404040; font-style: italic; } +.sheet pre { font: 10pt/1.4 Consolas, "Courier New", monospace; + background: rgba(0,0,0,.04); border: 1px solid rgba(0,0,0,.08); + border-radius: 3px; padding: 8pt 10pt; margin: 8pt 0; white-space: pre-wrap; } +.sheet hr { border: 0; border-top: 1px solid #808080; margin: 10pt 0; } +.sheet ul, .sheet ol { margin: 0 0 8pt; padding-left: 28pt; } +.sheet li { margin: 0 0 2pt; } +.sheet li > p { margin: 0 0 2pt; } +.sheet a { color: #0563c1; text-decoration: underline; } +.sheet img { max-width: 100%; height: auto; vertical-align: baseline; } +.sheet table { border-collapse: collapse; margin: 8pt 0; width: 100%; table-layout: fixed; } +.sheet td, .sheet th { border: 1px solid #999; padding: 4pt 6pt; vertical-align: top; + position: relative; min-width: 1em; } +.sheet th { background: rgba(0,0,0,.04); font-weight: 600; text-align: left; } +.sheet td > p:last-child, .sheet th > p:last-child { margin-bottom: 0; } +.sheet .docx-page-break { + border-top: 1px dashed #b00; margin: 14pt 0; text-align: center; + user-select: none; position: relative; +} +.sheet .docx-page-break span { + font: 9pt/1 system-ui, sans-serif; color: #b00; background: var(--paper); + padding: 0 8px; position: relative; top: -6pt; letter-spacing: .04em; +} +.sheet .docx-note-ref { + color: #0563c1; font-size: .7em; padding: 0 1px; cursor: default; + border-bottom: 1px dotted #0563c1; +} + +/* prosemirror-tables' own furniture */ +.sheet .selectedCell:after { + content: ""; position: absolute; inset: 0; background: rgba(100,150,255,.25); + pointer-events: none; z-index: 2; +} +.sheet .column-resize-handle { + position: absolute; right: -2px; top: 0; bottom: 0; width: 4px; + background: #6ba0ff; pointer-events: none; z-index: 3; +} +.resize-cursor { cursor: col-resize; } +.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; } +.ProseMirror-gapcursor:after { + content: ""; display: block; position: absolute; top: -2px; + width: 20px; border-top: 1px solid var(--paper-ink); animation: pm-blink 1.1s steps(2, start) infinite; +} +.ProseMirror-focused .ProseMirror-gapcursor { display: block; } +@keyframes pm-blink { to { visibility: hidden; } } +.ProseMirror-selectednode { outline: 2px solid #6ba0ff; } + +.empty-state { color: var(--dim); text-align: center; padding: 60px 20px; } + +/* ---- footer ---------------------------------------------------------- */ +.footer { display: flex; align-items: center; gap: 14px; + padding: 5px 12px; border-top: 1px solid var(--line); + background: var(--panel); font-size: 11.5px; color: var(--dim); } +.footer .stat { flex: 0 0 auto; white-space: nowrap; } +.footer .msg { flex: 1 1 auto; min-width: 0; overflow: hidden; + text-overflow: ellipsis; white-space: nowrap; text-align: right; } +.footer .msg.err { color: var(--danger); } +.footer .msg.ok { color: var(--acid); } +.footer .fbtn { border: 1px solid var(--line); background: var(--panel2); + color: var(--ink); border-radius: 5px; cursor: pointer; + padding: 3px 7px; font: inherit; font-size: 11px; flex: 0 0 auto; } +.footer .fbtn:hover { border-color: rgb(from var(--acid) r g b / .55); } + +/* ---- dialogs --------------------------------------------------------- */ +.scrim { position: fixed; inset: 0; background: rgba(4,7,12,.6); z-index: 80; + display: flex; align-items: center; justify-content: center; padding: 24px; } +.dialog { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; + box-shadow: 0 18px 50px rgba(0,0,0,.45); width: min(560px, 100%); + max-height: 80vh; display: flex; flex-direction: column; } +.dialog h2 { margin: 0; padding: 14px 18px 10px; font-size: 14.5px; font-weight: 600; } +.dialog .dbody { padding: 0 18px 4px; overflow: auto; font-size: 12.5px; line-height: 1.55; color: var(--mut); } +.dialog .dbody h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; + color: var(--dim); margin: 14px 0 6px; font-weight: 600; } +.dialog .dbody ul { margin: 0 0 8px; padding-left: 18px; } +.dialog .dbody li { margin: 2px 0; } +.dialog .dbody code { font-family: Consolas, monospace; font-size: 11.5px; color: var(--ink); } +.dialog .dfoot { display: flex; gap: 8px; justify-content: flex-end; + padding: 12px 18px 14px; border-top: 1px solid var(--line); margin-top: 10px; } +.dialog .field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; } +.dialog .field label { font-size: 11.5px; color: var(--dim); } +.dialog .field input { + height: 30px; border-radius: 6px; border: 1px solid var(--line); + background: var(--panel2); color: var(--ink); font: inherit; padding: 0 8px; +} +.dialog .field input:focus { outline: 1px solid rgb(from var(--acid) r g b / .5); } +.dialog .row { display: flex; gap: 12px; } +.dialog .row .field { flex: 1; } +.pill { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 99px; + border: 1px solid var(--line); margin-right: 6px; } +.pill.keep { color: var(--acid); border-color: rgb(from var(--acid) r g b / .45); } +.pill.lose { color: var(--warn); border-color: rgba(255,182,72,.45); } +.pill.stop { color: var(--danger); border-color: rgba(255,91,91,.45); } + +/* ---- drop target ----------------------------------------------------- */ +.dropzone { position: fixed; inset: 0; z-index: 90; background: rgba(10,14,20,.82); + display: flex; align-items: center; justify-content: center; + border: 3px dashed var(--acid); font-size: 16px; color: var(--ink); } + +/* ---- print ----------------------------------------------------------- */ +@media print { + .topbar, .ribbon, .footer, .banners, .pop, .scrim, .dropzone { display: none !important; } + html, body { height: auto; overflow: visible; background: #fff; } + .board { overflow: visible; padding: 0; background: #fff; } + .sheet { box-shadow: none; max-width: none; margin: 0; padding: 0; background: #fff; color: #000; } + .sheet .docx-page-break { border: 0; margin: 0; break-after: page; page-break-after: always; } + .sheet .docx-page-break span { display: none; } +} diff --git a/bundled-addons/docx-editor/editor.html b/bundled-addons/docx-editor/editor.html new file mode 100644 index 00000000..68058685 --- /dev/null +++ b/bundled-addons/docx-editor/editor.html @@ -0,0 +1,210 @@ + + + + +Word editor + + + + +
+ + + + + + Untitled document + + + + +
+ + +
+ +
+
+ + +
+
undo
+
+ +
+
+ +
+
style
+
+ +
+
+ + +
+
+ + + + + + + + + +
+
font
+
+ +
+
+ + + + + +
+
+ + + + + +
+
paragraph
+
+ +
+
+ + + + + +
+
insert
+
+ +
+
+ + + + +
+
+ + + + +
+
table
+
+
+ +
+ +
+
+
Loading document…
+
+
+ + + + + +
+ + + + + + + + + diff --git a/bundled-addons/docx-editor/editor.js b/bundled-addons/docx-editor/editor.js new file mode 100644 index 00000000..509547ae --- /dev/null +++ b/bundled-addons/docx-editor/editor.js @@ -0,0 +1,1015 @@ +// Word editor — the tab. +// +// Load path: +// editor.html?doc=, or storage.__pending = {id, name} +// → silentmode.invoke("getBytes", {id}) → base64 of the original .docx +// → read.docxToDoc() → a ProseMirror document + a report of what's in +// the file that this editor can't render +// → the report becomes the banners at the top of the page +// +// Save path: +// write.docToDocx() → bytes → . The original bytes are kept in +// memory for the whole session because the save grafts the document's +// headers, footers, notes, styles and page setup back out of them. +// +// The "blocked" state is worth understanding: a document with tracked +// changes or comments opens read-only, because mammoth silently renders +// insertions as ordinary text and drops deletions — saving would accept +// every pending revision without anyone choosing to. The user has to say so +// out loud, and then the editor unlocks. + +const $ = (id) => document.getElementById(id); +const V = () => window.DOCXV; +const DE = () => window.DocxEditor; + +const AUTOSAVE_MS = 20_000; +const WORDS_PER_PAGE = 500; + +const FONTS = [ + "Calibri", "Cambria", "Georgia", "Times New Roman", "Arial", "Helvetica", + "Verdana", "Tahoma", "Trebuchet MS", "Garamond", "Book Antiqua", + "Courier New", "Consolas", "Segoe UI", +]; +const TEXT_COLORS = [ + "000000", "404040", "808080", "BFBFBF", "FFFFFF", "C00000", "FF0000", "FFC000", + "FFFF00", "92D050", "00B050", "00B0F0", "0070C0", "002060", "7030A0", "1F4E79", +]; + +let view = null; // ProseMirror EditorView +let schema = null; +let originalBytes = null; // the .docx this document was read from +let docMeta = {}; // docProps carried through a save +let docSetup = null; // page setup carried through a save +let docName = "Untitled document"; +let scratchId = ""; // id in the add-on's recent ring +let report = { features: [] }; +let locked = false; // tracked changes / comments, not yet accepted +let dirty = false; +let lastSavedAt = 0; +let autosaveTimer = null; + +// ---------------------------------------------------------------- status --- + +function status(text, kind) { + const el = $("msg"); + el.textContent = text || ""; + el.classList.toggle("err", kind === "err"); + el.classList.toggle("ok", kind === "ok"); + clearTimeout(status._t); + if (text) status._t = setTimeout(() => { el.textContent = ""; el.className = "msg"; }, 6000); +} + +function setDirty(on) { + dirty = !!on; + const el = $("docname"); + el.innerHTML = ""; + el.append(document.createTextNode(docName)); + if (dirty) { + const dot = document.createElement("span"); + dot.className = "dirty"; + dot.textContent = "•"; + dot.title = "Unsaved changes"; + el.append(dot); + } + document.title = (dirty ? "• " : "") + docName + " — Word editor"; +} + +function updateCounts() { + if (!view) return; + const text = view.state.doc.textBetween(0, view.state.doc.content.size, " ", " "); + const words = (text.match(/[^\s]+/g) || []).length; + const breaks = countPageBreaks(view.state.doc); + const pages = Math.max(1, Math.ceil(words / WORDS_PER_PAGE)) + breaks; + $("stat-words").textContent = `${words.toLocaleString()} word${words === 1 ? "" : "s"}`; + $("stat-pages").textContent = `${pages} page${pages === 1 ? "" : "s"}` + (breaks ? "" : " (estimated)"); +} + +function countPageBreaks(doc) { + let n = 0; + doc.descendants((node) => { if (node.type.name === "page_break") n++; }); + return n; +} + +// ---------------------------------------------------------------- banners --- + +function renderBanners() { + const host = $("banners"); + host.innerHTML = ""; + + const add = (cls, icon, html, actions) => { + const el = document.createElement("div"); + el.className = "banner " + cls; + const i = document.createElement("span"); i.className = "ico"; i.textContent = icon; + const b = document.createElement("div"); b.className = "body"; b.innerHTML = html; + el.append(i, b); + if (actions && actions.length) { + const a = document.createElement("div"); a.className = "acts"; + for (const act of actions) { + const btn = document.createElement("button"); + btn.className = "btn wide" + (act.primary ? " primary" : ""); + btn.innerHTML = `${act.label}`; + btn.addEventListener("click", act.onClick); + a.append(btn); + } + el.append(a); + } + host.append(el); + return el; + }; + + const blocked = report.features.filter((f) => f.level === "blocked"); + const dropped = report.features.filter((f) => f.level === "dropped"); + const lossy = report.features.filter((f) => f.level === "lossy"); + + if (locked && blocked.length) { + const names = blocked.map((f) => f.label.toLowerCase()).join(" and "); + add("block", "⚠", + `This document has ${names}. This editor can't keep ${blocked.length > 1 ? "them" : "it"}: ` + + `saving would accept every pending revision and drop the comment threads, without Word ever asking. ` + + `The document is open for reading until you say that's what you want.`, + [{ + label: "Accept all and edit", primary: true, + onClick: () => { + locked = false; + if (view) view.setProps({ editable: () => true }); + renderBanners(); + syncRibbon(); + status("Revisions accepted in this copy. The original file on disk is untouched.", "ok"); + }, + }]); + } + + if (dropped.length || lossy.length) { + const parts = []; + if (dropped.length) parts.push(`${dropped.map((f) => f.label.toLowerCase()).join(", ")} won't survive a save`); + if (lossy.length) parts.push(`${lossy.map((f) => f.label.toLowerCase()).join(", ")} come through only in part`); + add("warn", "○", + `In this document, ${parts.join("; ")}. Everything else — including headers, footers, ` + + `footnotes, page setup and the document's own styles — comes through untouched.`, + [{ label: "Details", onClick: () => openAbout() }]); + } +} + +// ------------------------------------------------------------------ marks --- + +function markActive(state, type) { + const { from, $from, to, empty } = state.selection; + if (empty) return !!type.isInSet(state.storedMarks || $from.marks()); + return state.doc.rangeHasMark(from, to, type); +} + +function markAttrs(state, type) { + const { $from, empty, from, to } = state.selection; + if (empty) { + const m = type.isInSet(state.storedMarks || $from.marks()); + return m ? m.attrs : null; + } + let found = null; + state.doc.nodesBetween(from, to, (node) => { + if (found || !node.isText) return; + const m = type.isInSet(node.marks); + if (m) found = m.attrs; + }); + return found; +} + +function toggleMark(typeName, attrs) { + const { commands } = V().pm; + const type = schema.marks[typeName]; + if (!type) return; + commands.toggleMark(type, attrs)(view.state, view.dispatch); + view.focus(); +} + +// Applying a value-carrying mark (font, size, colour, highlight) is not a +// toggle: picking Georgia over Arial has to replace, not stack. +function setValueMark(typeName, attrs) { + const type = schema.marks[typeName]; + const { state, dispatch } = view; + const { from, to, empty } = state.selection; + const tr = state.tr; + if (empty) { + const marks = (state.storedMarks || state.selection.$from.marks()).filter((m) => m.type !== type); + dispatch(tr.setStoredMarks(attrs ? marks.concat(type.create(attrs)) : marks)); + } else { + tr.removeMark(from, to, type); + if (attrs) tr.addMark(from, to, type.create(attrs)); + dispatch(tr); + } + view.focus(); +} + +function clearFormatting() { + const { state, dispatch } = view; + const { from, to, empty } = state.selection; + if (empty) { dispatch(state.tr.setStoredMarks([])); view.focus(); return; } + const tr = state.tr; + for (const name of Object.keys(schema.marks)) { + if (name === "link") continue; // a link is content, not styling + tr.removeMark(from, to, schema.marks[name]); + } + dispatch(tr); + view.focus(); +} + +// ------------------------------------------------------------- paragraphs --- + +function setBlockAttr(name, value) { + const { state, dispatch } = view; + const { from, to } = state.selection; + const tr = state.tr; + let touched = false; + state.doc.nodesBetween(from, to, (node, pos) => { + if (node.type !== schema.nodes.paragraph && node.type !== schema.nodes.heading) return; + tr.setNodeMarkup(pos, null, Object.assign({}, node.attrs, { [name]: value })); + touched = true; + }); + if (touched) dispatch(tr); + view.focus(); +} + +function currentBlockAttrs() { + const { $from } = view.state.selection; + for (let d = $from.depth; d >= 0; d--) { + const node = $from.node(d); + if (node.type === schema.nodes.paragraph || node.type === schema.nodes.heading) return node; + } + return null; +} + +function shiftIndent(delta) { + const node = currentBlockAttrs(); + if (!node) return; + const next = Math.max(0, Math.min(8, (node.attrs.indent || 0) + delta)); + setBlockAttr("indent", next); +} + +function setStyle(value) { + const { commands } = V().pm; + const { setBlockType, lift, wrapIn } = commands; + const { state, dispatch } = view; + // Leave a quote before becoming something else, so switching Quote → + // Heading 2 doesn't leave the heading stranded inside a blockquote. + const inQuote = findParent(state.selection.$from, schema.nodes.blockquote); + if (inQuote && value !== "blockquote") lift(view.state, view.dispatch); + + if (value === "paragraph") setBlockType(schema.nodes.paragraph)(view.state, view.dispatch); + else if (/^h([1-6])$/.test(value)) { + setBlockType(schema.nodes.heading, { level: parseInt(value.slice(1), 10) })(view.state, view.dispatch); + } else if (value === "code_block") setBlockType(schema.nodes.code_block)(view.state, view.dispatch); + else if (value === "blockquote") { + setBlockType(schema.nodes.paragraph)(view.state, view.dispatch); + if (!findParent(view.state.selection.$from, schema.nodes.blockquote)) { + wrapIn(schema.nodes.blockquote)(view.state, view.dispatch); + } + } + view.focus(); +} + +function findParent($pos, type) { + for (let d = $pos.depth; d > 0; d--) if ($pos.node(d).type === type) return { node: $pos.node(d), depth: d }; + return null; +} + +// ------------------------------------------------------------------ lists --- + +function toggleList(kind) { + const { schemaList, commands } = V().pm; + const type = kind === "ordered" ? schema.nodes.ordered_list : schema.nodes.bullet_list; + const other = kind === "ordered" ? schema.nodes.bullet_list : schema.nodes.ordered_list; + const { state } = view; + const inThis = findParent(state.selection.$from, type); + const inOther = findParent(state.selection.$from, other); + + if (inThis) { + schemaList.liftListItem(schema.nodes.list_item)(view.state, view.dispatch); + } else if (inOther) { + // Swap one kind of list for the other in place. + const tr = view.state.tr; + tr.setNodeMarkup(state.selection.$from.before(inOther.depth), type, + type === schema.nodes.ordered_list ? { order: 1, format: currentListFormat() } : {}); + view.dispatch(tr); + } else { + const attrs = type === schema.nodes.ordered_list ? { order: 1, format: currentListFormat() } : {}; + schemaList.wrapInList(type, attrs)(view.state, view.dispatch); + } + view.focus(); +} + +function currentListFormat() { + return $("list-format").value || "decimal"; +} + +function applyListFormat(format) { + const { state, dispatch } = view; + const found = findParent(state.selection.$from, schema.nodes.ordered_list); + if (!found) return; + const pos = state.selection.$from.before(found.depth); + dispatch(state.tr.setNodeMarkup(pos, null, Object.assign({}, found.node.attrs, { format }))); + view.focus(); +} + +// ----------------------------------------------------------------- tables --- + +function inTable() { + return !!findParent(view.state.selection.$from, schema.nodes.table); +} + +function tableCmd(name) { + const t = V().pm.tables; + const fn = t[name]; + if (typeof fn === "function") { fn(view.state, view.dispatch); view.focus(); } +} + +function insertTable(rows, cols, withHeader) { + const { state, dispatch } = view; + const cell = (type) => schema.nodes[type].createAndFill(); + const rowNodes = []; + for (let r = 0; r < rows; r++) { + const cells = []; + for (let c = 0; c < cols; c++) cells.push(cell(withHeader && r === 0 ? "table_header" : "table_cell")); + rowNodes.push(schema.nodes.table_row.create(null, cells)); + } + const table = schema.nodes.table.create(null, rowNodes); + dispatch(state.tr.replaceSelectionWith(table).scrollIntoView()); + view.focus(); +} + +function toggleHeaderRow() { + const t = V().pm.tables; + if (typeof t.toggleHeaderRow === "function") { t.toggleHeaderRow(view.state, view.dispatch); view.focus(); } +} + +// ----------------------------------------------------------------- insert --- + +function insertNode(node) { + const { state, dispatch } = view; + dispatch(state.tr.replaceSelectionWith(node).scrollIntoView()); + view.focus(); +} + +async function insertImageFile(file) { + const bytes = new Uint8Array(await file.arrayBuffer()); + const type = file.type || "image/png"; + if (!/^image\/(png|jpeg|gif|bmp)$/.test(type)) { + status(`${type} pictures can't be saved into a .docx — use PNG, JPEG, GIF or BMP.`, "err"); + return; + } + const size = DE().read.imageSizePt(bytes, null); + const src = `data:${type};base64,${DE().read.bytesToBase64(bytes)}`; + insertNode(schema.nodes.image.create({ + src, alt: file.name || null, width: size.width, height: size.height, + })); +} + +// ---------------------------------------------------------------- dialogs --- + +function dialog(title, bodyHtml, buttons) { + const scrim = document.createElement("div"); + scrim.className = "scrim"; + const box = document.createElement("div"); + box.className = "dialog"; + box.innerHTML = `

${title}

${bodyHtml}
`; + const foot = box.querySelector(".dfoot"); + const close = () => { scrim.remove(); document.removeEventListener("keydown", onKey); if (view) view.focus(); }; + const onKey = (e) => { + if (e.key === "Escape") { e.preventDefault(); close(); } + if (e.key === "Enter" && !e.shiftKey) { + const primary = buttons.find((b) => b.primary); + if (primary) { e.preventDefault(); if (primary.onClick(box, close) !== false) close(); } + } + }; + for (const b of buttons) { + const btn = document.createElement("button"); + btn.className = "btn wide" + (b.primary ? " primary" : ""); + btn.innerHTML = `${b.label}`; + btn.addEventListener("click", () => { if (b.onClick(box, close) !== false) close(); }); + foot.append(btn); + } + scrim.append(box); + scrim.addEventListener("mousedown", (e) => { if (e.target === scrim) close(); }); + document.addEventListener("keydown", onKey); + document.body.append(scrim); + const first = box.querySelector("input"); + if (first) first.focus(); + return { box, close }; +} + +function openLinkDialog() { + const existing = markAttrs(view.state, schema.marks.link); + const { state } = view; + const selected = state.doc.textBetween(state.selection.from, state.selection.to, " "); + dialog("Link", ` +
+
+
+
+ `, [ + ...(existing ? [{ label: "Remove link", onClick: () => { + const { from, to } = view.state.selection; + view.dispatch(view.state.tr.removeMark(from, to, schema.marks.link)); + view.focus(); + } }] : []), + { label: "Cancel", onClick: () => {} }, + { label: existing ? "Update" : "Add link", primary: true, onClick: (box) => { + const href = box.querySelector("#lnk-href").value.trim(); + const text = box.querySelector("#lnk-text").value; + if (!href) return false; + const { state, dispatch } = view; + const mark = schema.marks.link.create({ href, title: null, anchor: null }); + if (state.selection.empty || text !== selected) { + const node = schema.text(text || href, [mark]); + dispatch(state.tr.replaceSelectionWith(node, false).scrollIntoView()); + } else { + dispatch(state.tr.addMark(state.selection.from, state.selection.to, mark)); + } + view.focus(); + } }, + ]); +} + +function openTableDialog() { + dialog("Insert table", ` +
+
+
+
+
+ `, [ + { label: "Cancel", onClick: () => {} }, + { label: "Insert", primary: true, onClick: (box) => { + const rows = Math.max(1, Math.min(60, parseInt(box.querySelector("#tbl-rows").value, 10) || 3)); + const cols = Math.max(1, Math.min(20, parseInt(box.querySelector("#tbl-cols").value, 10) || 3)); + insertTable(rows, cols, box.querySelector("#tbl-head").checked); + } }, + ]); +} + +const NOT_YET = [ + "Tracked changes — a document that has them opens read-only until you accept them", + "Comments", + "Equations (OMML)", + "Shapes, text boxes and WordArt", + "Content controls", + "Fields: page numbers, tables of contents, cross-references", + "Bookmarks and internal cross-references", + "Section breaks and multi-column layout", + "Headers and footers can't be edited here — they are carried through unchanged", + "Footnote and endnote text can't be edited here — the notes and their markers are carried through unchanged", + "A styles panel: styles are applied by the Style box, not edited", + "Paragraph borders and shading, other than a horizontal rule", + "Metafile pictures (WMF/EMF) — they can't be written back and are dropped", +]; + +function openAbout() { + const found = report.features || []; + const line = (f) => { + const cls = f.level === "preserved" ? "keep" : f.level === "blocked" ? "stop" : "lose"; + const word = f.level === "preserved" ? "kept" : f.level === "lossy" ? "partly" : f.level === "blocked" ? "blocked" : "dropped"; + return `
  • ${word}${f.label}${f.note ? ` — ${f.note}` : ""}
  • `; + }; + dialog("Word editor", ` +

    A basic, honest .docx editor. It opens most Word documents, lets you edit the + things below, and writes a file Word will open without complaint.

    + +

    Saving rebuilds the document body from what you see, and carries the rest of the + original file across untouched: headers, footers, footnotes, endnotes, page size and + margins, the document's style catalogue and its theme. Saving never overwrites the + file you opened — it downloads a new one.

    + + ${found.length ? `

    In this document

      ${found.map(line).join("")}
    ` : ""} + +

    Not supported yet

    +
      ${NOT_YET.map((t) => `
    • ${t}
    • `).join("")}
    + +

    Built with

    +
      +
    • mammoth — reads the .docx (BSD-2-Clause)
    • +
    • ProseMirror — the editor itself (MIT)
    • +
    • docx — writes the .docx (MIT)
    • +
    • JSZip — the package layer (MIT)
    • +
    +

    Full licence texts ship in vendor/LICENSES.txt.

    + `, [{ label: "Close", primary: true, onClick: () => {} }]); +} + +// ------------------------------------------------------------- colour pops --- + +function openColorPop(anchor, colors, onPick, onClear, clearLabel) { + document.querySelectorAll(".pop").forEach((p) => p.remove()); + const pop = document.createElement("div"); + pop.className = "pop"; + const grid = document.createElement("div"); + grid.className = "grid"; + for (const c of colors) { + const chip = document.createElement("button"); + chip.className = "chip"; + chip.style.background = c.css; + chip.title = c.label; + chip.addEventListener("click", () => { onPick(c); pop.remove(); }); + grid.append(chip); + } + const row = document.createElement("div"); + row.className = "prow"; + const clear = document.createElement("button"); + clear.className = "btn wide"; + clear.innerHTML = `${clearLabel}`; + clear.addEventListener("click", () => { onClear(); pop.remove(); }); + row.append(clear); + pop.append(grid, row); + document.body.append(pop); + const r = anchor.getBoundingClientRect(); + pop.style.left = Math.min(r.left, window.innerWidth - pop.offsetWidth - 8) + "px"; + pop.style.top = (r.bottom + 4) + "px"; + const away = (e) => { + if (!pop.contains(e.target) && e.target !== anchor) { pop.remove(); document.removeEventListener("mousedown", away); } + }; + setTimeout(() => document.addEventListener("mousedown", away), 0); +} + +// ------------------------------------------------------------------ ribbon --- + +function syncRibbon() { + if (!view) return; + const st = view.state; + const on = (id, active) => $(id).classList.toggle("on", !!active); + + on("m-strong", markActive(st, schema.marks.strong)); + on("m-em", markActive(st, schema.marks.em)); + on("m-underline", markActive(st, schema.marks.underline)); + on("m-strike", markActive(st, schema.marks.strike)); + on("m-sup", markActive(st, schema.marks.sup)); + on("m-sub", markActive(st, schema.marks.sub)); + + const fontAttrs = markAttrs(st, schema.marks.font); + $("font-family").value = FONTS.includes(fontAttrs && fontAttrs.family) ? fontAttrs.family : ""; + const sizeAttrs = markAttrs(st, schema.marks.fsize); + $("font-size").value = sizeAttrs ? sizeAttrs.pt : ""; + const colorAttrs = markAttrs(st, schema.marks.color); + $("color-bar").style.background = colorAttrs ? "#" + colorAttrs.hex : "#c00000"; + const hlAttrs = markAttrs(st, schema.marks.highlight); + $("hl-bar").style.background = hlAttrs + ? (DE().schema.HIGHLIGHT_CSS[hlAttrs.name] || "#ffff00") : "#ffff00"; + + const block = currentBlockAttrs(); + const $from = st.selection.$from; + const inQuote = findParent($from, schema.nodes.blockquote); + const inCode = findParent($from, schema.nodes.code_block); + let style = "paragraph"; + if (inCode) style = "code_block"; + else if (inQuote) style = "blockquote"; + else if (block && block.type === schema.nodes.heading) style = "h" + block.attrs.level; + $("style-select").value = style; + + const align = block ? block.attrs.align : null; + on("a-left", align === "left"); + on("a-center", align === "center"); + on("a-right", align === "right"); + on("a-justify", align === "justify"); + $("line-height").value = block && block.attrs.lineHeight ? String(block.attrs.lineHeight) : ""; + + const ol = findParent($from, schema.nodes.ordered_list); + const ul = findParent($from, schema.nodes.bullet_list); + on("l-bullet", !!ul); + on("l-ordered", !!ol); + $("list-format").disabled = !ol; + if (ol) $("list-format").value = ol.node.attrs.format || "decimal"; + + $("table-group").dataset.contextual = inTable() ? "on" : "off"; + + const { history } = V().pm; + $("undo").disabled = history.undoDepth(st) === 0; + $("redo").disabled = history.redoDepth(st) === 0; + + // Everything that writes is off while the document is locked. + document.querySelectorAll("#ribbon .btn, #ribbon .rsel, #ribbon .rnum").forEach((el) => { + if (el.id === "undo" || el.id === "redo") return; + el.disabled = locked || (el.id === "list-format" && !ol); + }); + $("file-save").disabled = locked; +} + +function wireRibbon() { + const sel = $("font-family"); + for (const f of FONTS) { + const opt = document.createElement("option"); + opt.value = f; opt.textContent = f; opt.style.fontFamily = f; + sel.append(opt); + } + + $("m-strong").onclick = () => toggleMark("strong"); + $("m-em").onclick = () => toggleMark("em"); + $("m-underline").onclick = () => toggleMark("underline"); + $("m-strike").onclick = () => toggleMark("strike"); + $("m-sup").onclick = () => toggleMark("sup"); + $("m-sub").onclick = () => toggleMark("sub"); + $("m-clear").onclick = clearFormatting; + + sel.onchange = () => setValueMark("font", sel.value ? { family: sel.value } : null); + $("font-size").onchange = () => { + const pt = parseFloat($("font-size").value); + setValueMark("fsize", Number.isFinite(pt) && pt > 0 ? { pt } : null); + }; + + $("m-color").onclick = (e) => openColorPop( + e.currentTarget, + TEXT_COLORS.map((hex) => ({ css: "#" + hex, label: "#" + hex, hex })), + (c) => setValueMark("color", { hex: c.hex }), + () => setValueMark("color", null), + "Automatic"); + + $("m-highlight").onclick = (e) => openColorPop( + e.currentTarget, + DE().schema.HIGHLIGHTS.map((h) => ({ css: h.css, label: h.label, name: h.name })), + (c) => setValueMark("highlight", { name: c.name }), + () => setValueMark("highlight", null), + "No highlight"); + + $("style-select").onchange = (e) => setStyle(e.target.value); + + for (const [id, value] of [["a-left", "left"], ["a-center", "center"], ["a-right", "right"], ["a-justify", "justify"]]) { + $(id).onclick = () => { + const block = currentBlockAttrs(); + setBlockAttr("align", block && block.attrs.align === value ? null : value); + }; + } + $("line-height").onchange = (e) => setBlockAttr("lineHeight", e.target.value ? parseFloat(e.target.value) : null); + $("indent-in").onclick = () => shiftIndent(1); + $("indent-out").onclick = () => shiftIndent(-1); + + $("l-bullet").onclick = () => toggleList("bullet"); + $("l-ordered").onclick = () => toggleList("ordered"); + $("list-format").onchange = (e) => applyListFormat(e.target.value); + + $("i-link").onclick = openLinkDialog; + $("i-table").onclick = openTableDialog; + $("i-image").onclick = () => $("image-input").click(); + $("i-rule").onclick = () => insertNode(schema.nodes.horizontal_rule.create()); + $("i-pagebreak").onclick = () => insertNode(schema.nodes.page_break.create()); + + $("t-row-after").onclick = () => tableCmd("addRowAfter"); + $("t-row-del").onclick = () => tableCmd("deleteRow"); + $("t-col-after").onclick = () => tableCmd("addColumnAfter"); + $("t-col-del").onclick = () => tableCmd("deleteColumn"); + $("t-merge").onclick = () => tableCmd("mergeCells"); + $("t-split").onclick = () => tableCmd("splitCell"); + $("t-header").onclick = toggleHeaderRow; + $("t-del").onclick = () => tableCmd("deleteTable"); + + $("undo").onclick = () => { V().pm.history.undo(view.state, view.dispatch); view.focus(); }; + $("redo").onclick = () => { V().pm.history.redo(view.state, view.dispatch); view.focus(); }; + + $("file-new").onclick = () => newDocument(); + $("file-open").onclick = () => $("file-input").click(); + $("file-save").onclick = () => save(); + $("file-print").onclick = () => window.print(); + $("about").onclick = openAbout; + $("discard").onclick = () => closeTab(); + $("open-folder").onclick = async () => { + try { await window.silentmode?.invoke("openFolder", { id: scratchId }); } + catch (e) { status("Couldn't open the folder: " + (e && e.message || e), "err"); } + }; + + $("file-input").onchange = async (e) => { + const file = e.target.files && e.target.files[0]; + e.target.value = ""; + if (file) await openFile(file); + }; + $("image-input").onchange = async (e) => { + const file = e.target.files && e.target.files[0]; + e.target.value = ""; + if (file) await insertImageFile(file); + }; +} + +// ------------------------------------------------------------------ editor --- + +function buildPlugins() { + const { keymap, history, commands, inputrules, dropcursor, gapcursor, tables, state: pmState } = V().pm; + const { baseKeymap, toggleMark: tm, chainCommands, exitCode } = commands; + const { wrapInList, splitListItem, liftListItem, sinkListItem } = V().pm.schemaList; + + const keys = { + "Mod-z": history.undo, + "Shift-Mod-z": history.redo, + "Mod-y": history.redo, + "Mod-b": tm(schema.marks.strong), + "Mod-i": tm(schema.marks.em), + "Mod-u": tm(schema.marks.underline), + "Mod-k": () => { openLinkDialog(); return true; }, + "Mod-s": () => { save(); return true; }, + "Mod-o": () => { $("file-input").click(); return true; }, + "Mod-p": () => { window.print(); return true; }, + "Mod-Enter": (state, dispatch) => { + if (dispatch) dispatch(state.tr.replaceSelectionWith(schema.nodes.page_break.create()).scrollIntoView()); + return true; + }, + "Shift-Enter": chainCommands(exitCode, (state, dispatch) => { + if (dispatch) dispatch(state.tr.replaceSelectionWith(schema.nodes.hard_break.create()).scrollIntoView()); + return true; + }), + "Enter": splitListItem(schema.nodes.list_item), + "Tab": (state, dispatch) => { + // Inside a table Tab moves between cells, the way Word does it; + // inside a list it nests; elsewhere it indents the paragraph. + if (tables.goToNextCell(1)(state, dispatch)) return true; + if (sinkListItem(schema.nodes.list_item)(state, dispatch)) return true; + shiftIndent(1); + return true; + }, + "Shift-Tab": (state, dispatch) => { + if (tables.goToNextCell(-1)(state, dispatch)) return true; + if (liftListItem(schema.nodes.list_item)(state, dispatch)) return true; + shiftIndent(-1); + return true; + }, + }; + + const { inputRules, wrappingInputRule, textblockTypeInputRule, smartQuotes, + ellipsis, emDash } = inputrules; + const rules = [ + ...smartQuotes, ellipsis, emDash, + wrappingInputRule(/^\s*([-+*])\s$/, schema.nodes.bullet_list), + wrappingInputRule(/^(\d+)\.\s$/, schema.nodes.ordered_list, + (match) => ({ order: +match[1], format: "decimal" }), + (match, node) => node.childCount + node.attrs.order === +match[1]), + wrappingInputRule(/^\s*>\s$/, schema.nodes.blockquote), + textblockTypeInputRule(/^```$/, schema.nodes.code_block), + textblockTypeInputRule(/^(#{1,6})\s$/, schema.nodes.heading, + (match) => ({ level: match[1].length })), + ]; + + return [ + inputRules({ rules }), + keymap.keymap(keys), + keymap.keymap(baseKeymap), + dropcursor.dropCursor(), + gapcursor.gapCursor(), + history.history(), + tables.columnResizing(), + tables.tableEditing(), + ]; +} + +function mountEditor(doc) { + const { state: pmState, view: pmView } = V().pm; + const sheet = $("sheet"); + sheet.innerHTML = ""; + + const state = pmState.EditorState.create({ doc, plugins: buildPlugins() }); + if (view) view.destroy(); + view = new pmView.EditorView(sheet, { + state, + editable: () => !locked, + dispatchTransaction(tr) { + const next = view.state.apply(tr); + view.updateState(next); + if (tr.docChanged) { setDirty(true); updateCounts(); scheduleAutosave(); } + syncRibbon(); + }, + handlePaste(v, event) { + // A .docx dropped or pasted as a file goes through the document + // reader, not the HTML paste path. + const files = Array.from(event.clipboardData?.files || []); + const docxFile = files.find((f) => /\.docx$/i.test(f.name)); + if (docxFile) { openFile(docxFile); return true; } + const image = files.find((f) => /^image\//.test(f.type)); + if (image) { insertImageFile(image); return true; } + return false; + }, + handleDrop(v, event) { + const files = Array.from(event.dataTransfer?.files || []); + const docxFile = files.find((f) => /\.docx$/i.test(f.name)); + if (docxFile) { event.preventDefault(); openFile(docxFile); return true; } + const image = files.find((f) => /^image\//.test(f.type)); + if (image) { event.preventDefault(); insertImageFile(image); return true; } + return false; + }, + }); + updateCounts(); + syncRibbon(); + view.focus(); +} + +// ------------------------------------------------------------------- files --- + +function blankDoc() { + return V().pm.model.Node.fromJSON(schema, { + type: "doc", content: [{ type: "paragraph" }], + }); +} + +function newDocument() { + if (dirty && !confirm("Start a new document? Unsaved changes will be lost.")) return; + originalBytes = null; + docMeta = {}; + docSetup = null; + scratchId = ""; + docName = "Untitled document"; + report = { features: [] }; + locked = false; + renderBanners(); + mountEditor(blankDoc()); + setDirty(false); + status("New document."); +} + +async function loadBytes(bytes, name, id) { + const t0 = performance.now(); + status("Reading document…"); + const res = await DE().read.docxToDoc(bytes, schema); + originalBytes = bytes; + docMeta = res.meta || {}; + docSetup = res.setup || null; + report = res.report || { features: [] }; + docName = name || "document.docx"; + scratchId = id || ""; + locked = report.blocked && report.blocked.length > 0; + + renderBanners(); + mountEditor(res.doc); + setDirty(false); + const ms = Math.round(performance.now() - t0); + status(`Opened ${docName} — ${res.doc.childCount} blocks in ${ms} ms`, "ok"); + if (res.warnings && res.warnings.length) { + console.warn("[docx-editor] read warnings:", res.warnings, res.messages); + } +} + +async function openFile(file) { + if (dirty && !confirm(`Open ${file.name}? Unsaved changes will be lost.`)) return; + try { + const bytes = new Uint8Array(await file.arrayBuffer()); + // Park a copy with the add-on so the document survives a tab reload and + // shows up in the sidebar's recent list. + let id = ""; + try { + const stashed = await window.silentmode?.invoke("stash", { + name: file.name, base64: DE().read.bytesToBase64(bytes), kind: "opened", + }); + id = stashed && stashed.id || ""; + } catch (e) { + console.warn("[docx-editor] could not stash the document:", e); + } + await loadBytes(bytes, file.name, id); + } catch (e) { + console.error(e); + showError(`Couldn't open ${file.name}: ${e && e.message || e}`); + } +} + +function showError(text) { + status(text, "err"); + if (!view) { + $("sheet").innerHTML = `
    ${text}
    `; + } +} + +function downloadName() { + const base = docName.replace(/\.docx$/i, "") || "document"; + return `${base}-edited.docx`; +} + +async function save() { + if (!view || locked) return; + try { + status("Saving…"); + const res = await DE().write.docToDocx(view.state.doc, { + originalBytes, setup: docSetup, meta: docMeta, + }); + const blob = new Blob([res.bytes], { + type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + }); + const url = URL.createObjectURL(blob); + const a = $("download-link"); + a.href = url; + a.download = downloadName(); + a.click(); + setTimeout(() => URL.revokeObjectURL(url), 8000); + + setDirty(false); + lastSavedAt = Date.now(); + await autosave(true); + + const carried = res.carried && res.carried.length ? ` — carried over ${res.carried.join(", ")}` : ""; + status(`Saved ${a.download} (${(res.bytes.length / 1024).toFixed(0)} KB)${carried}`, "ok"); + if (res.warnings && res.warnings.length) { + console.warn("[docx-editor] save warnings:", res.warnings); + status(`Saved with warnings: ${res.warnings.join("; ")}`, "err"); + } + } catch (e) { + console.error(e); + status("Save failed: " + (e && e.message || e), "err"); + } +} + +// Autosave into the add-on's recent ring — not to the user's file. It exists +// so a closed tab or a crash doesn't cost the session's work: the sidebar +// lists the last few documents and can hand them back. +function scheduleAutosave() { + clearTimeout(autosaveTimer); + autosaveTimer = setTimeout(() => autosave(false), AUTOSAVE_MS); +} + +async function autosave(force) { + if (!view || locked) return; + if (!force && !dirty) return; + try { + const res = await DE().write.docToDocx(view.state.doc, { + originalBytes, setup: docSetup, meta: docMeta, + }); + const stashed = await window.silentmode?.invoke("autosave", { + name: docName, + base64: DE().read.bytesToBase64(res.bytes), + replaces: scratchId, + }); + if (stashed && stashed.id) scratchId = stashed.id; + } catch (e) { + console.warn("[docx-editor] autosave failed:", e); + } +} + +function closeTab() { + if (dirty && !confirm("Close the editor? Unsaved changes will be lost.")) return; + try { window.silentmode?.closeTab(); } + catch { window.close(); } +} + +// ------------------------------------------------------------------- boot --- + +function base64ToBytes(b64) { + const bin = atob(b64); + const out = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i); + return out; +} + +async function boot() { + if (!window.DOCXV || !window.DocxEditor?.read) { + showError("The editor's libraries didn't load. Check vendor/docx-vendor.js."); + return; + } + schema = DE().schema.build(); + wireRibbon(); + + // Whole-window drop target, so dropping a file anywhere works and not + // only over the page surface. + let dropDepth = 0; + const zone = document.createElement("div"); + zone.className = "dropzone"; + zone.textContent = "Drop a .docx to open it"; + zone.hidden = true; + document.body.append(zone); + window.addEventListener("dragenter", (e) => { + if (!Array.from(e.dataTransfer?.types || []).includes("Files")) return; + dropDepth++; zone.hidden = false; + }); + window.addEventListener("dragleave", () => { if (--dropDepth <= 0) { dropDepth = 0; zone.hidden = true; } }); + window.addEventListener("dragover", (e) => e.preventDefault()); + window.addEventListener("drop", async (e) => { + e.preventDefault(); + dropDepth = 0; zone.hidden = true; + const file = Array.from(e.dataTransfer?.files || [])[0]; + if (!file) return; + if (/\.docx$/i.test(file.name)) await openFile(file); + else if (/^image\//.test(file.type)) await insertImageFile(file); + else status(`${file.name} isn't a .docx.`, "err"); + }); + + window.addEventListener("beforeunload", (e) => { + if (dirty) { e.preventDefault(); e.returnValue = ""; } + }); + + // Drain the hand-off: ?doc= wins (it survives a reload), then __pending. + let id = new URLSearchParams(location.search).get("doc") || ""; + let name = ""; + try { + const pending = await window.silentmode?.storage?.get("__pending", null); + if (pending && pending.id) { + if (!id) id = pending.id; + if (pending.id === id) name = pending.name || ""; + await window.silentmode.storage.set("__pending", null); + } + } catch (e) { + console.warn("[docx-editor] no storage hand-off:", e); + } + + if (!id) { + mountEditor(blankDoc()); + setDirty(false); + status("Blank document — drop a .docx here, or use Open."); + return; + } + + try { + const res = await window.silentmode.invoke("getBytes", { id }); + await loadBytes(base64ToBytes(res.base64), name || res.name, id); + } catch (e) { + console.error(e); + mountEditor(blankDoc()); + showError(`Couldn't load that document: ${e && e.message || e}`); + } +} + +boot(); diff --git a/bundled-addons/docx-editor/index.js b/bundled-addons/docx-editor/index.js new file mode 100644 index 00000000..25b6659d --- /dev/null +++ b/bundled-addons/docx-editor/index.js @@ -0,0 +1,192 @@ +// Word editor — the add-on half. All the document work happens in the +// editor tab; this side owns the sidebar panel, the scratch folder and the +// ring of recently-opened documents. +// +// Flow: +// panel picks a file (, or a drop) → invokes "stash" with +// the bytes → we write them to the scratch dir and push them onto the +// recent ring → panel invokes "openEditor" → we park a pointer under +// storage.__pending and openTab("editor.html") → the editor drains +// __pending on its first paint and pulls the bytes with "getBytes". +// +// Only a pointer goes through storage, never the document: add-on storage is +// a single JSON file rewritten in full on every set, and a few megabytes of +// base64 in there would make every unrelated write expensive. + +const fs = require("node:fs"); +const path = require("node:path"); + +const MAX_RECENT = 8; // documents kept in the ring +const SCRATCH_DIR = "docx-scratch"; +const MAX_BYTES = 64 * 1024 * 1024; // refuse absurd inputs early + +module.exports = { + activate(api) { + api.registerSidebarPanel({ + id: "main", + title: "Word editor", + icon: "📝", + page: "panel.html", + }); + + // Per-add-on scratch dir under /addons-data/, same arrangement + // as the screenshot add-on: never write inside the add-on folder itself, + // where it would confuse anyone reading the shipped source. + const dataParent = path.dirname(path.join(api.folder, "..")); + const scratchDir = path.join(dataParent, "addons-data", SCRATCH_DIR); + try { fs.mkdirSync(scratchDir, { recursive: true }); } + catch (e) { api.log("scratch mkdir failed:", e?.message); } + + function stamp() { + const d = new Date(); + const p = (n) => String(n).padStart(2, "0"); + return `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`; + } + + // A scratch filename that can't escape the folder however the original + // was named. The display name is kept separately in the ring. + function scratchName(displayName) { + const base = String(displayName || "document") + .replace(/\.docx$/i, "") + .replace(/[^\w.\- ]+/g, "_") + .replace(/\s+/g, " ") + .trim() + .slice(0, 60) || "document"; + return `${stamp()}-${base}.docx`; + } + + function pruneRecent(recent) { + const alive = recent.filter((r) => { try { fs.accessSync(r.path); return true; } catch { return false; } }); + const keep = alive.slice(0, MAX_RECENT); + for (const gone of alive.slice(MAX_RECENT)) { try { fs.unlinkSync(gone.path); } catch {} } + return keep; + } + + function readRecent() { + let recent = api.storage.get("recent", []); + return Array.isArray(recent) ? recent : []; + } + + function findRecent(id) { + return readRecent().find((r) => r.id === id) || null; + } + + function pathOf(id) { + // Belt and braces: the id came from a renderer, so re-derive the path + // from the ring rather than joining whatever string arrived. + const hit = findRecent(id); + if (!hit) throw new Error(`no document "${id}" in the recent list`); + const abs = path.resolve(hit.path); + if (path.dirname(abs) !== path.resolve(scratchDir)) { + throw new Error("document path escapes the scratch folder"); + } + return abs; + } + + // Write bytes to the scratch folder and put them at the head of the ring. + // `kind` distinguishes what the user opened from what the editor saved + // back, so the panel can say which is which. + function stash({ name, base64, kind, replaces }) { + const buf = Buffer.from(String(base64 || ""), "base64"); + if (!buf.length) throw new Error("no document bytes"); + if (buf.length > MAX_BYTES) throw new Error(`document is too large (${(buf.length / 1048576).toFixed(0)} MB)`); + // Every .docx is a zip; catching this here beats a confusing parse + // error three layers deeper in the editor. + if (!(buf[0] === 0x50 && buf[1] === 0x4b)) { + throw new Error("that doesn't look like a .docx file"); + } + const id = scratchName(name); + const file = path.join(scratchDir, id); + fs.writeFileSync(file, buf); + + let recent = readRecent(); + if (replaces) recent = recent.filter((r) => r.id !== replaces); + recent.unshift({ + id, + name: String(name || "document.docx"), + path: file, + bytes: buf.length, + at: Date.now(), + kind: kind === "saved" ? "saved" : "opened", + }); + recent = pruneRecent(recent); + api.storage.set("recent", recent); + api.log(`stashed ${id} (${buf.length} bytes, ${kind || "opened"})`); + return { id, name: String(name || "document.docx"), bytes: buf.length }; + } + + api.onMessage("stash", (payload) => stash(payload || {})); + + // Hand a document to the editor tab. The pointer under __pending is what + // the editor drains on its first paint; the query string carries the same + // id so a reload of the tab still finds its document. + api.onMessage("openEditor", (payload) => { + const id = payload && payload.id ? String(payload.id) : ""; + if (id) { + const hit = findRecent(id); + if (!hit) throw new Error(`no document "${id}" in the recent list`); + api.storage.set("__pending", { id, name: hit.name, at: Date.now() }); + } else { + api.storage.set("__pending", null); + } + api.openTab("editor.html", id ? { query: { doc: id } } : undefined); + api.log(id ? `opening editor for ${id}` : "opening editor with a blank document"); + return { ok: true, id }; + }); + + api.onMessage("listRecent", () => { + const recent = pruneRecent(readRecent()); + api.storage.set("recent", recent); + return recent.map((r) => ({ id: r.id, name: r.name, bytes: r.bytes, at: r.at, kind: r.kind })); + }); + + api.onMessage("getBytes", (payload) => { + const id = String(payload && payload.id || ""); + const hit = findRecent(id); + if (!hit) throw new Error(`no document "${id}" in the recent list`); + const buf = fs.readFileSync(pathOf(id)); + return { id, name: hit.name, base64: buf.toString("base64"), bytes: buf.length, at: hit.at, kind: hit.kind }; + }); + + // Autosave. The editor calls this as the user works; each document keeps + // one autosave entry rather than filling the ring with its own history. + api.onMessage("autosave", (payload) => { + const p = payload || {}; + const res = stash({ + name: String(p.name || "document.docx"), + base64: p.base64, + kind: "saved", + replaces: p.replaces ? String(p.replaces) : "", + }); + return res; + }); + + api.onMessage("clearRecent", (payload) => { + const id = payload && payload.id ? String(payload.id) : ""; + let recent = readRecent(); + if (id) { + const hit = recent.find((r) => r.id === id); + if (hit) { try { fs.unlinkSync(hit.path); } catch {} } + recent = recent.filter((r) => r.id !== id); + } else { + for (const r of recent) { try { fs.unlinkSync(r.path); } catch {} } + recent = []; + } + api.storage.set("recent", recent); + return { ok: true }; + }); + + api.onMessage("openFolder", (payload) => { + const { shell } = api.require("electron"); + const id = payload && payload.id ? String(payload.id) : ""; + if (id) { + const hit = findRecent(id); + if (hit) { shell.showItemInFolder(hit.path); return { ok: true, path: hit.path }; } + } + shell.openPath(scratchDir); + return { ok: true, path: scratchDir }; + }); + + api.log("registered docx-editor sidebar panel"); + }, +}; diff --git a/bundled-addons/docx-editor/lib/pkg.js b/bundled-addons/docx-editor/lib/pkg.js new file mode 100644 index 00000000..b93ea1ad --- /dev/null +++ b/bundled-addons/docx-editor/lib/pkg.js @@ -0,0 +1,490 @@ +// Package-level work on a .docx: everything that happens at the zip layer, +// either side of mammoth and the docx builder. +// +// Two jobs: +// +// scan(zip) — walk the original package and report what's in it that the +// v1 editor can't render, so the user is told BEFORE they +// edit rather than after they've lost something. +// +// graft(...) — the save-side half of the preservation deal. docx (the npm +// builder) always emits a brand-new package, so anything that +// lives outside the document body would vanish on save. We +// take the parts that survive a body rewrite unharmed — +// headers, footers, footnotes, endnotes, the style catalogue, +// the theme, page setup — and carry them across from the +// original into the freshly built package, re-wiring +// relationship ids and content types as we go. +// +// Body-level things we can't model (textboxes, shapes, equations, content +// controls, fields) are NOT preserved; scan() names them so the loss is +// visible. See ROUND-TRIP.md for the full ledger. +(function (root, factory) { + const api = factory(); + if (typeof module === "object" && module.exports) module.exports = api; + root.DocxEditor = Object.assign(root.DocxEditor || {}, { pkg: api }); +})(typeof globalThis !== "undefined" ? globalThis : this, function () { + "use strict"; + + const V = () => globalThis.DOCXV; + + const W_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + const R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"; + const CT_NS = "http://schemas.openxmlformats.org/package/2006/content-types"; + const PR_NS = "http://schemas.openxmlformats.org/package/2006/relationships"; + + const CONTENT_TYPES = { + header: "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", + footer: "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", + footnotes: "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", + endnotes: "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", + }; + const REL_TYPES = { + header: R_NS + "/header", + footer: R_NS + "/footer", + footnotes: R_NS + "/footnotes", + endnotes: R_NS + "/endnotes", + image: R_NS + "/image", + }; + + function parseXml(text) { + const doc = new DOMParser().parseFromString(text, "application/xml"); + const err = doc.getElementsByTagName("parsererror")[0]; + if (err) throw new Error("malformed XML in package: " + err.textContent.slice(0, 200)); + return doc; + } + function serializeXml(doc) { + const body = new XMLSerializer().serializeToString(doc); + return body.startsWith("\r\n' + body; + } + // Namespace-agnostic child lookup: packages in the wild are inconsistent + // about prefixes, and getElementsByTagNameNS is the only reliable route. + function kids(el, ns, local) { + return Array.prototype.filter.call(el.childNodes, + (n) => n.nodeType === 1 && n.namespaceURI === ns && n.localName === local); + } + function firstKid(el, ns, local) { return kids(el, ns, local)[0] || null; } + function descendants(doc, ns, local) { + return Array.prototype.slice.call(doc.getElementsByTagNameNS(ns, local)); + } + + async function loadZip(bytes) { + return V().JSZip.loadAsync(bytes); + } + async function textOf(zip, path) { + const f = zip.file(path); + return f ? f.async("string") : null; + } + + // ---------------------------------------------------------------- scan --- + + // What the scan can say about a feature. + // preserved — survives a save untouched (carried across by graft()). + // lossy — the content survives but not exactly as Word wrote it. + // dropped — gone on save; the user needs to know before editing. + // blocked — dangerous to flatten silently; editing is gated on consent. + const FEATURES = [ + { key: "trackedChanges", level: "blocked", label: "Tracked changes", + note: "Saving would silently accept every pending revision.", + test: (d) => descendants(d, W_NS, "ins").length + descendants(d, W_NS, "del").length > 0 }, + { key: "comments", level: "blocked", label: "Comments", + note: "Comment anchors and the comment text are not carried across.", + test: (d, z) => !!z.file("word/comments.xml") && + descendants(d, W_NS, "commentRangeStart").length > 0 }, + + { key: "headers", level: "preserved", label: "Headers", + test: (d, z) => z.file(/^word\/header\d*\.xml$/).length > 0 }, + { key: "footers", level: "preserved", label: "Footers", + test: (d, z) => z.file(/^word\/footer\d*\.xml$/).length > 0 }, + { key: "footnotes", level: "preserved", label: "Footnotes", + test: (d, z) => !!z.file("word/footnotes.xml") && + descendants(d, W_NS, "footnoteReference").length > 0 }, + { key: "endnotes", level: "preserved", label: "Endnotes", + test: (d, z) => !!z.file("word/endnotes.xml") && + descendants(d, W_NS, "endnoteReference").length > 0 }, + { key: "pageSetup", level: "preserved", label: "Page size and margins", + test: (d) => descendants(d, W_NS, "sectPr").length > 0 }, + + { key: "equations", level: "dropped", label: "Equations", + note: "OMML equations are removed from the body.", + test: (d) => d.getElementsByTagNameNS("http://schemas.openxmlformats.org/officeDocument/2006/math", "oMath").length > 0 }, + { key: "shapes", level: "dropped", label: "Shapes, text boxes and WordArt", + test: (d) => descendants(d, W_NS, "pict").length > 0 || + d.getElementsByTagNameNS("http://schemas.openxmlformats.org/markup-compatibility/2006", "AlternateContent").length > 0 }, + { key: "contentControls", level: "dropped", label: "Content controls", + test: (d) => descendants(d, W_NS, "sdt").length > 0 }, + { key: "fields", level: "dropped", label: "Fields (page numbers, tables of contents, cross-references)", + note: "Field codes are dropped; the text Word last calculated is kept.", + test: (d) => descendants(d, W_NS, "fldSimple").length > 0 || + descendants(d, W_NS, "instrText").length > 0 }, + { key: "bookmarks", level: "dropped", label: "Bookmarks", + test: (d) => descendants(d, W_NS, "bookmarkStart") + .some((b) => !(b.getAttributeNS(W_NS, "name") || "").startsWith("_GoBack") ) }, + { key: "sections", level: "dropped", label: "Multiple sections", + note: "Only the first section's page setup is kept; section breaks are lost.", + test: (d) => descendants(d, W_NS, "sectPr").length > 1 }, + { key: "columns", level: "dropped", label: "Multi-column layout", + test: (d) => descendants(d, W_NS, "cols").some((c) => { + const n = c.getAttributeNS(W_NS, "num"); + return n && parseInt(n, 10) > 1; + }) }, + + { key: "metafiles", level: "dropped", label: "Metafile pictures (WMF/EMF)", + note: "Word's vector picture format. Browsers can't display it and it can't be written back, so those pictures are lost on save.", + test: (d, z) => z.file(/^word\/media\/.*\.(wmf|emf)$/i).length > 0 }, + + { key: "paragraphBorders", level: "lossy", label: "Paragraph borders and shading", + note: "A rule under an empty paragraph is kept as a horizontal rule; other borders are dropped.", + test: (d) => descendants(d, W_NS, "pBdr").length > 0 || descendants(d, W_NS, "shd").length > 0 }, + { key: "tabStops", level: "lossy", label: "Custom tab stops", + note: "Tab characters are kept, custom stop positions are not.", + test: (d) => descendants(d, W_NS, "tabs").length > 0 }, + ]; + + async function scan(zip) { + const xml = await textOf(zip, "word/document.xml"); + if (!xml) throw new Error("not a Word document: word/document.xml is missing"); + const doc = parseXml(xml); + const found = []; + for (const f of FEATURES) { + let hit = false; + try { hit = !!f.test(doc, zip); } catch { hit = false; } + if (hit) found.push({ key: f.key, level: f.level, label: f.label, note: f.note || "" }); + } + return { + features: found, + blocked: found.filter((f) => f.level === "blocked"), + dropped: found.filter((f) => f.level === "dropped"), + lossy: found.filter((f) => f.level === "lossy"), + preserved: found.filter((f) => f.level === "preserved"), + }; + } + + // ------------------------------------------------------------ page setup --- + + // The first sectPr, mapped onto what the docx builder wants. Word writes + // these in twips; the builder takes twips too, so this is mostly a rename. + async function readSectionSetup(zip) { + const xml = await textOf(zip, "word/document.xml"); + if (!xml) return null; + const doc = parseXml(xml); + const sect = descendants(doc, W_NS, "sectPr")[0]; + if (!sect) return null; + const num = (el, attr) => { + if (!el) return null; + const v = el.getAttributeNS(W_NS, attr); + return /^-?\d+$/.test(v || "") ? parseInt(v, 10) : null; + }; + const pgSz = firstKid(sect, W_NS, "pgSz"); + const pgMar = firstKid(sect, W_NS, "pgMar"); + const setup = { page: {} }; + if (pgSz) { + const w = num(pgSz, "w"), h = num(pgSz, "h"); + const orient = pgSz.getAttributeNS(W_NS, "orient"); + if (w && h) setup.page.size = { width: w, height: h, orientation: orient === "landscape" ? "landscape" : "portrait" }; + } + if (pgMar) { + const m = {}; + for (const [k, a] of [["top", "top"], ["right", "right"], ["bottom", "bottom"], + ["left", "left"], ["header", "header"], ["footer", "footer"], ["gutter", "gutter"]]) { + const v = num(pgMar, a); + if (v !== null) m[k] = v; + } + if (Object.keys(m).length) setup.page.margin = m; + } + setup.titlePg = !!firstKid(sect, W_NS, "titlePg"); + // Which header/footer parts this section points at, by type. + setup.refs = []; + for (const kind of ["header", "footer"]) { + for (const ref of kids(sect, W_NS, kind + "Reference")) { + setup.refs.push({ + kind, + type: ref.getAttributeNS(W_NS, "type") || "default", + rId: ref.getAttributeNS(R_NS, "id") || "", + }); + } + } + return setup; + } + + // docProps/core.xml — cheap to carry, and losing the author of a document + // is the kind of small betrayal people notice. + async function readCoreProps(zip) { + const xml = await textOf(zip, "docProps/core.xml"); + if (!xml) return {}; + let doc; try { doc = parseXml(xml); } catch { return {}; } + const pick = (ns, local) => { + const el = doc.getElementsByTagNameNS(ns, local)[0]; + return el && el.textContent ? el.textContent : undefined; + }; + const DC = "http://purl.org/dc/elements/1.1/"; + const CP = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"; + return { + title: pick(DC, "title"), + creator: pick(DC, "creator"), + description: pick(DC, "description"), + subject: pick(DC, "subject"), + keywords: pick(CP, "keywords"), + lastModifiedBy: pick(CP, "lastModifiedBy"), + }; + } + + // --------------------------------------------------------------- graft --- + + function relsPathFor(partPath) { + const i = partPath.lastIndexOf("/"); + return partPath.slice(0, i) + "/_rels" + partPath.slice(i) + ".rels"; + } + + function nextRelId(relsDoc) { + let max = 0; + for (const r of descendants(relsDoc, PR_NS, "Relationship")) { + const m = /^rId(\d+)$/.exec(r.getAttribute("Id") || ""); + if (m) max = Math.max(max, parseInt(m[1], 10)); + } + return (n) => "rId" + (max + n); + } + + function addRelationship(relsDoc, id, type, target) { + const el = relsDoc.createElementNS(PR_NS, "Relationship"); + el.setAttribute("Id", id); + el.setAttribute("Type", type); + el.setAttribute("Target", target); + relsDoc.documentElement.appendChild(el); + } + + function addOverride(ctDoc, partName, contentType) { + const already = descendants(ctDoc, CT_NS, "Override") + .some((o) => o.getAttribute("PartName") === partName); + if (already) return; + const el = ctDoc.createElementNS(CT_NS, "Override"); + el.setAttribute("PartName", partName); + el.setAttribute("ContentType", contentType); + ctDoc.documentElement.appendChild(el); + } + + function addDefaultExt(ctDoc, ext, contentType) { + const already = descendants(ctDoc, CT_NS, "Default") + .some((o) => (o.getAttribute("Extension") || "").toLowerCase() === ext.toLowerCase()); + if (already) return; + const el = ctDoc.createElementNS(CT_NS, "Default"); + el.setAttribute("Extension", ext); + el.setAttribute("ContentType", contentType); + ctDoc.documentElement.insertBefore(el, ctDoc.documentElement.firstChild); + } + + // Copy one part plus anything its own .rels file points at. Media gets a + // fresh name whenever the generated package already has a file there, and + // the part's rels are rewritten to match — otherwise a header's logo would + // quietly replace an image from the body. + async function copyPartWithRels(orig, gen, partPath, usedMedia) { + const data = await orig.file(partPath).async("uint8array"); + gen.file(partPath, data); + const rp = relsPathFor(partPath); + const relsText = await textOf(orig, rp); + if (!relsText) return; + const relsDoc = parseXml(relsText); + for (const rel of descendants(relsDoc, PR_NS, "Relationship")) { + if (rel.getAttribute("TargetMode") === "External") continue; + const target = rel.getAttribute("Target") || ""; + // Targets in word/_rels/*.rels are relative to word/. + const src = ("word/" + target.replace(/^\.\//, "")).replace(/\/+/g, "/"); + const f = orig.file(src); + if (!f) continue; + let dest = src; + if (gen.file(dest) && !usedMedia.has(src)) { + const dot = src.lastIndexOf("."); + dest = src.slice(0, dot) + "-carried" + usedMedia.size + src.slice(dot); + rel.setAttribute("Target", dest.replace(/^word\//, "")); + } + usedMedia.set(src, dest); + gen.file(dest, await f.async("uint8array")); + } + gen.file(rp, serializeXml(relsDoc)); + } + + // Merge the original style catalogue into the generated one. Where both + // define a style id, the ORIGINAL wins: it is what the document actually + // looked like, and the builder's defaults are only there to make a blank + // document presentable. Styles the original doesn't have (the editor's own + // SourceCode, for instance) are left in place. + async function mergeStyles(orig, gen) { + const origText = await textOf(orig, "word/styles.xml"); + const genText = await textOf(gen, "word/styles.xml"); + if (!origText || !genText) return { merged: 0 }; + const origDoc = parseXml(origText); + const genDoc = parseXml(genText); + const genRoot = genDoc.documentElement; + + const byId = new Map(); + for (const s of kids(genRoot, W_NS, "style")) { + byId.set(s.getAttributeNS(W_NS, "styleId"), s); + } + let merged = 0; + for (const s of descendants(origDoc, W_NS, "style")) { + const id = s.getAttributeNS(W_NS, "styleId"); + if (!id) continue; + const imported = genDoc.importNode(s, true); + const existing = byId.get(id); + if (existing) genRoot.replaceChild(imported, existing); + else genRoot.appendChild(imported); + byId.set(id, imported); + merged++; + } + // docDefaults carries the document's base font and spacing; without it a + // grafted style catalogue sits on the builder's defaults and every + // unstyled paragraph shifts. + const origDefaults = descendants(origDoc, W_NS, "docDefaults")[0]; + if (origDefaults) { + const genDefaults = kids(genRoot, W_NS, "docDefaults")[0]; + const imported = genDoc.importNode(origDefaults, true); + if (genDefaults) genRoot.replaceChild(imported, genDefaults); + else genRoot.insertBefore(imported, genRoot.firstChild); + } + gen.file("word/styles.xml", serializeXml(genDoc)); + return { merged }; + } + + // Header/footer references have to be the FIRST children of sectPr — the + // schema is order-sensitive and Word refuses a file that gets it wrong. + function injectSectionRefs(docDoc, refs, titlePg) { + const sect = descendants(docDoc, W_NS, "sectPr")[0]; + if (!sect) return 0; + let n = 0; + const anchor = sect.firstChild; + for (const ref of refs) { + const el = docDoc.createElementNS(W_NS, "w:" + ref.kind + "Reference"); + el.setAttributeNS(W_NS, "w:type", ref.type); + el.setAttributeNS(R_NS, "r:id", ref.newRId); + sect.insertBefore(el, anchor); + n++; + } + if (titlePg && !firstKid(sect, W_NS, "titlePg")) { + // titlePg sits after the references but before pgSz; appending is fine + // because Word tolerates it at the tail of sectPr in practice, and the + // references above are the order-critical part. + sect.appendChild(docDoc.createElementNS(W_NS, "w:titlePg")); + } + return n; + } + + /** + * Carry preserved parts from the original package into the generated one. + * + * @param {Uint8Array} originalBytes the .docx the user opened + * @param {Uint8Array} generatedBytes what the docx builder just produced + * @param {object} opts { headers, footers, notes, styles, theme } + * @returns {Promise<{bytes: Uint8Array, carried: string[]}>} + */ + async function graft(originalBytes, generatedBytes, opts) { + const o = Object.assign({ headers: true, footers: true, notes: true, styles: true, theme: true }, opts || {}); + const orig = await loadZip(originalBytes); + const gen = await loadZip(generatedBytes); + const carried = []; + + const ctText = await textOf(gen, "[Content_Types].xml"); + const ctDoc = parseXml(ctText); + const relsText = await textOf(gen, "word/_rels/document.xml.rels"); + const relsDoc = parseXml(relsText); + const mkId = nextRelId(relsDoc); + let idN = 0; + const usedMedia = new Map(); + + // --- headers and footers ------------------------------------------- + const setup = await readSectionSetup(orig); + const origRels = await textOf(orig, "word/_rels/document.xml.rels"); + const origRelsDoc = origRels ? parseXml(origRels) : null; + const targetOf = (rId) => { + if (!origRelsDoc) return null; + const hit = descendants(origRelsDoc, PR_NS, "Relationship") + .find((r) => r.getAttribute("Id") === rId); + return hit ? "word/" + (hit.getAttribute("Target") || "").replace(/^\.\//, "") : null; + }; + + const newRefs = []; + if (setup && setup.refs.length) { + for (const ref of setup.refs) { + if (ref.kind === "header" && !o.headers) continue; + if (ref.kind === "footer" && !o.footers) continue; + const part = targetOf(ref.rId); + if (!part || !orig.file(part)) continue; + await copyPartWithRels(orig, gen, part, usedMedia); + const newRId = mkId(++idN); + addRelationship(relsDoc, newRId, REL_TYPES[ref.kind], part.replace(/^word\//, "")); + addOverride(ctDoc, "/" + part, CONTENT_TYPES[ref.kind]); + newRefs.push({ kind: ref.kind, type: ref.type, newRId }); + } + if (newRefs.length) carried.push(`${newRefs.length} header/footer part(s)`); + } + + // --- footnotes and endnotes ----------------------------------------- + // The body keeps its footnote references (see read.js), so the note text + // has to come across with the same ids the references use — which is + // exactly what copying the original part wholesale gives us. The builder + // writes its own footnotes.xml only when the document declares notes, so + // in practice this replaces an absent or separator-only part. + if (o.notes) { + for (const kind of ["footnotes", "endnotes"]) { + const part = `word/${kind}.xml`; + if (!orig.file(part)) continue; + await copyPartWithRels(orig, gen, part, usedMedia); + addOverride(ctDoc, "/" + part, CONTENT_TYPES[kind]); + const has = descendants(relsDoc, PR_NS, "Relationship") + .some((r) => r.getAttribute("Type") === REL_TYPES[kind]); + if (!has) addRelationship(relsDoc, mkId(++idN), REL_TYPES[kind], `${kind}.xml`); + carried.push(kind); + } + } + + // --- styles and theme ------------------------------------------------ + if (o.styles) { + const r = await mergeStyles(orig, gen); + if (r.merged) carried.push(`${r.merged} style definition(s)`); + } + if (o.theme) { + const themeFile = orig.file(/^word\/theme\/theme\d*\.xml$/)[0]; + if (themeFile) { + const genTheme = gen.file(/^word\/theme\/theme\d*\.xml$/)[0]; + const dest = genTheme ? genTheme.name : "word/theme/theme1.xml"; + gen.file(dest, await themeFile.async("uint8array")); + if (!genTheme) { + addOverride(ctDoc, "/" + dest, "application/vnd.openxmlformats-officedocument.theme+xml"); + addRelationship(relsDoc, mkId(++idN), R_NS + "/theme", dest.replace(/^word\//, "")); + } + carried.push("theme"); + } + } + + // Any media extension the carried parts brought with them needs a Default + // entry or Word rejects the package. + for (const dest of usedMedia.values()) { + const ext = (dest.split(".").pop() || "").toLowerCase(); + const mime = { png: "image/png", jpeg: "image/jpeg", jpg: "image/jpeg", gif: "image/gif", + bmp: "image/bmp", tiff: "image/tiff", svg: "image/svg+xml", + emf: "image/x-emf", wmf: "image/x-wmf" }[ext]; + if (mime) addDefaultExt(ctDoc, ext, mime); + } + + // --- rewrite the parts we changed ------------------------------------ + if (newRefs.length || (setup && setup.titlePg)) { + const docText = await textOf(gen, "word/document.xml"); + const docDoc = parseXml(docText); + injectSectionRefs(docDoc, newRefs, setup && setup.titlePg); + gen.file("word/document.xml", serializeXml(docDoc)); + } + gen.file("[Content_Types].xml", serializeXml(ctDoc)); + gen.file("word/_rels/document.xml.rels", serializeXml(relsDoc)); + + const bytes = await gen.generateAsync({ + type: "uint8array", + compression: "DEFLATE", + compressionOptions: { level: 6 }, + mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + }); + return { bytes, carried }; + } + + return { loadZip, scan, graft, readSectionSetup, readCoreProps, parseXml, serializeXml, FEATURES }; +}); diff --git a/bundled-addons/docx-editor/lib/read.js b/bundled-addons/docx-editor/lib/read.js new file mode 100644 index 00000000..d2f314f5 --- /dev/null +++ b/bundled-addons/docx-editor/lib/read.js @@ -0,0 +1,502 @@ +// .docx -> editor model. +// +// mammoth does the hard part of reading OOXML: resolving style inheritance, +// numbering definitions, relationship targets, merged table cells. What it +// is designed to produce, though, is semantic HTML — and HTML has nowhere to +// put a run's colour or a paragraph's line spacing, so its converter throws +// them away. +// +// So we don't use its HTML at all. `transformDocument` hands us mammoth's +// parsed document model on the way past, and we walk THAT into ProseMirror +// JSON. Everything the model carries survives; see addon-build/docx-editor/ +// patches.mjs for the handful of properties we taught it to carry. +(function (root, factory) { + const api = factory(); + if (typeof module === "object" && module.exports) module.exports = api; + root.DocxEditor = Object.assign(root.DocxEditor || {}, { read: api }); +})(typeof globalThis !== "undefined" ? globalThis : this, function () { + "use strict"; + + const V = () => globalThis.DOCXV; + + const PAGE_CONTENT_PT = 468; // 6.5in of text between 1in margins + const DEFAULT_IMAGE_PT = 300; + + // ------------------------------------------------------------- images --- + + // Natural pixel size, straight out of the file header. Decoding through an + // would work in the editor but not in the round-trip tests, and a + // size that depends on which half of the codebase is asking is a bug + // waiting to happen. + function imagePixelSize(bytes) { + const b = bytes; + const u16 = (i, le) => le ? b[i] | (b[i + 1] << 8) : (b[i] << 8) | b[i + 1]; + const u32 = (i, le) => le + ? (b[i] | (b[i + 1] << 8) | (b[i + 2] << 16) | (b[i + 3] << 24)) >>> 0 + : ((b[i] << 24) | (b[i + 1] << 16) | (b[i + 2] << 8) | b[i + 3]) >>> 0; + + if (b.length > 24 && b[0] === 0x89 && b[1] === 0x50) { // PNG + return { w: u32(16, false), h: u32(20, false) }; + } + if (b.length > 10 && b[0] === 0x47 && b[1] === 0x49) { // GIF + return { w: u16(6, true), h: u16(8, true) }; + } + if (b.length > 26 && b[0] === 0x42 && b[1] === 0x4d) { // BMP + return { w: u32(18, true), h: u32(22, true) }; + } + if (b.length > 4 && b[0] === 0xff && b[1] === 0xd8) { // JPEG + let i = 2; + while (i + 9 < b.length) { + if (b[i] !== 0xff) { i++; continue; } + const marker = b[i + 1]; + if (marker === 0xd8 || marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7)) { i += 2; continue; } + const len = u16(i + 2, false); + // SOF0..SOF15, skipping the four that aren't start-of-frame. + if (marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc) { + return { h: u16(i + 5, false), w: u16(i + 7, false) }; + } + i += 2 + len; + } + } + return null; + } + + function imageSizePt(bytes, declared) { + // What Word was drawing it at always wins — the author chose it. + if (declared && declared.widthPt) { + return { width: declared.widthPt, height: declared.heightPt || null }; + } + const px = imagePixelSize(bytes); + if (!px || !px.w) return { width: DEFAULT_IMAGE_PT, height: null }; + const ratio = px.h / px.w; + let w = px.w * 0.75; // 96dpi pixels to points + if (w > PAGE_CONTENT_PT) w = PAGE_CONTENT_PT; + return { width: Math.round(w * 100) / 100, height: Math.round(w * ratio * 100) / 100 }; + } + + function bytesToBase64(bytes) { + if (typeof Buffer !== "undefined") return Buffer.from(bytes).toString("base64"); + let s = ""; + for (let i = 0; i < bytes.length; i += 0x8000) { + s += String.fromCharCode.apply(null, bytes.subarray(i, i + 0x8000)); + } + return btoa(s); + } + + // --------------------------------------------------------------- marks --- + + const HIGHLIGHT_NAMES = new Set([ + "yellow", "green", "cyan", "magenta", "blue", "red", "darkBlue", "darkCyan", + "darkGreen", "darkMagenta", "darkRed", "darkYellow", "darkGray", "lightGray", "black", + ]); + + function runMarks(run, inherited) { + const marks = inherited ? inherited.slice() : []; + const add = (type, attrs) => marks.push(attrs ? { type, attrs } : { type }); + if (run.isBold) add("strong"); + if (run.isItalic) add("em"); + if (run.isUnderline) add("underline"); + if (run.isStrikethrough) add("strike"); + if (run.isAllCaps) add("caps"); + if (run.isSmallCaps) add("smallcaps"); + if (run.verticalAlignment === "superscript") add("sup"); + if (run.verticalAlignment === "subscript") add("sub"); + if (run.font) add("font", { family: run.font }); + if (run.fontSize) add("fsize", { pt: run.fontSize }); + if (run.color && run.color !== "000000") add("color", { hex: run.color }); + if (run.highlight && HIGHLIGHT_NAMES.has(run.highlight)) add("highlight", { name: run.highlight }); + return marks; + } + + // ---------------------------------------------------------- paragraphs --- + + const HEADING_RE = /^heading\s*([1-6])$/i; + + // Which block a paragraph becomes, from its Word style. styleName is what + // the user sees in the styles gallery; styleId is the internal one, and + // documents from non-Word producers often set only one of the two. + function classifyParagraph(p) { + const name = (p.styleName || "").trim(); + const id = (p.styleId || "").trim(); + const m = HEADING_RE.exec(name) || /^Heading([1-6])$/.exec(id); + if (m) return { kind: "heading", level: parseInt(m[1], 10) }; + if (/^title$/i.test(name) || id === "Title") return { kind: "heading", level: 1 }; + if (/^subtitle$/i.test(name) || id === "Subtitle") return { kind: "heading", level: 2 }; + if (/quote$/i.test(name) || /Quote$/.test(id)) return { kind: "blockquote" }; + if (/^(source code|html preformatted|code|plain text|preformatted text)$/i.test(name) || + /^(SourceCode|HTMLPreformatted|PlainText)$/.test(id)) return { kind: "code_block" }; + return { kind: "paragraph" }; + } + + function alignmentOf(p) { + const a = (p.alignment || "").toLowerCase(); + if (a === "center") return "center"; + if (a === "right" || a === "end") return "right"; + if (a === "both" || a === "justify" || a === "distribute") return "justify"; + if (a === "left" || a === "start") return "left"; + return null; + } + + function indentLevelOf(p) { + const twips = parseInt((p.indent && (p.indent.start)) || "0", 10); + if (!Number.isFinite(twips) || twips <= 0) return 0; + return Math.min(8, Math.round(twips / 720)); + } + + function spacingOf(p) { + const s = p.spacing; + if (!s) return { lineHeight: null, spaceBefore: null, spaceAfter: null }; + // w:line is 240ths of a line under the "auto" rule; under exact/atLeast + // it's twips, which the editor has no control for, so it is left alone + // (and reported as lossy). + const lineHeight = s.line && (!s.lineRule || s.lineRule === "auto") + ? Math.round((s.line / 240) * 100) / 100 : null; + const pt = (twips) => (twips == null ? null : Math.round((twips / 20) * 10) / 10); + return { lineHeight, spaceBefore: pt(s.before), spaceAfter: pt(s.after) }; + } + + function paragraphAttrs(p) { + return Object.assign({ align: alignmentOf(p), indent: indentLevelOf(p) }, spacingOf(p)); + } + + // --------------------------------------------------------------- walker --- + + function Reader(options) { + this.warnings = []; + this.options = options || {}; + } + + Reader.prototype.warn = function (msg) { + if (!this.warnings.includes(msg)) this.warnings.push(msg); + }; + + // Inline children of a paragraph or table cell. Returns + // {inline: [...], breaks: [...]} — a page break inside a paragraph has to + // become a sibling block, so it is reported up rather than inlined. + Reader.prototype.inlineChildren = async function (children, marks) { + const out = []; + let sawPageBreak = false; + for (const child of children) { + switch (child.type) { + case "run": { + const sub = await this.inlineChildren(child.children, runMarks(child, marks)); + out.push(...sub.inline); + sawPageBreak = sawPageBreak || sub.sawPageBreak; + break; + } + case "text": { + if (child.value) out.push({ type: "text", text: child.value, marks: marks.length ? marks : undefined }); + break; + } + case "tab": { + out.push({ type: "text", text: "\t", marks: marks.length ? marks : undefined }); + break; + } + case "checkbox": { + out.push({ type: "text", text: child.checked ? "☒" : "☐", marks: marks.length ? marks : undefined }); + break; + } + case "break": { + if (child.breakType === "line") out.push({ type: "hard_break" }); + else if (child.breakType === "page") sawPageBreak = true; + else if (child.breakType === "column") { sawPageBreak = true; this.warn("columns"); } + break; + } + case "hyperlink": { + const href = child.href || (child.anchor ? "#" + child.anchor : ""); + const linkMark = { type: "link", attrs: { href, title: null, anchor: child.anchor || null } }; + const sub = await this.inlineChildren(child.children, marks.concat([linkMark])); + out.push(...sub.inline); + sawPageBreak = sawPageBreak || sub.sawPageBreak; + break; + } + case "image": { + const node = await this.imageNode(child); + if (node) out.push(node); + break; + } + case "noteReference": { + out.push({ + type: "note_ref", + attrs: { + noteType: child.noteType === "endnote" ? "endnote" : "footnote", + noteId: String(child.noteId), + label: child.noteType === "endnote" ? "†" : "*", + }, + }); + break; + } + case "commentReference": + this.warn("comments"); + break; + case "bookmarkStart": + // Anchors for internal links. Dropped, but only worth mentioning + // when it isn't Word's own cursor-position bookmark. + if (child.name && !String(child.name).startsWith("_GoBack")) this.warn("bookmarks"); + break; + default: + break; + } + } + return { inline: out, sawPageBreak }; + }; + + Reader.prototype.imageNode = async function (image) { + let bytes; + try { + const buf = await image.readAsArrayBuffer(); + bytes = new Uint8Array(buf); + } catch (e) { + this.warn("unreadable-image"); + return null; + } + const size = imageSizePt(bytes, image); + const type = image.contentType || "image/png"; + return { + type: "image", + attrs: { + src: `data:${type};base64,${bytesToBase64(bytes)}`, + alt: image.altText || null, + title: null, + width: size.width, + height: size.height, + }, + }; + }; + + // ----------------------------------------------------------- list stack --- + + // Word has no list elements: every list item is a paragraph carrying a + // numbering id and a level. Rebuilding the nesting is on us. + function ListStack(out) { + this.out = out; // the block array lists get appended to + this.stack = []; // [{level, ordered, node}] + } + + ListStack.prototype.flush = function () { this.stack.length = 0; }; + + ListStack.prototype.push = function (numbering, itemBlocks) { + const level = Math.max(0, Math.min(8, parseInt(numbering.level, 10) || 0)); + const ordered = !!numbering.isOrdered; + const format = numbering.numFmt || (ordered ? "decimal" : null); + const numId = numbering.numId == null ? null : String(numbering.numId); + + // Leaving a deeper level. + while (this.stack.length && this.stack[this.stack.length - 1].level > level) this.stack.pop(); + + let top = this.stack[this.stack.length - 1]; + // Same level, but a different list. Word marks the boundary between two + // adjacent lists with a change of numbering id — it's the difference + // between "4. 5. 6." and a second list starting again at 1 — and a + // change of bullet-versus-number means the same thing. + if (top && top.level === level && + (top.ordered !== ordered || (numId !== null && top.numId !== null && top.numId !== numId))) { + this.stack.pop(); + top = this.stack[this.stack.length - 1]; + } + + if (!top || top.level < level) { + const node = ordered + ? { type: "ordered_list", attrs: { order: 1, format: format || "decimal" }, content: [] } + : { type: "bullet_list", content: [] }; + if (top) { + // Nested: the sub-list belongs inside the parent's last item. + let parentItems = top.node.content; + if (!parentItems.length) { + parentItems.push({ type: "list_item", content: [{ type: "paragraph", content: [] }] }); + } + parentItems[parentItems.length - 1].content.push(node); + } else { + this.out.push(node); + } + this.stack.push({ level, ordered, numId, node }); + top = this.stack[this.stack.length - 1]; + } + + top.node.content.push({ type: "list_item", content: itemBlocks }); + }; + + // --------------------------------------------------------------- blocks --- + + Reader.prototype.blocks = async function (children) { + const out = []; + const lists = new ListStack(out); + // Consecutive code-styled paragraphs read as one code block, the way + // they were almost certainly written. + let codeRun = null; + + const closeCode = () => { codeRun = null; }; + + for (const child of children) { + if (child.type === "paragraph") { + const cls = classifyParagraph(child); + const { inline, sawPageBreak } = await this.inlineChildren(child.children, []); + + if (cls.kind === "code_block") { + const text = inline.filter((n) => n.type === "text").map((n) => n.text).join(""); + if (codeRun) codeRun.content.push({ type: "text", text: "\n" + text }); + else { + codeRun = { type: "code_block", content: text ? [{ type: "text", text }] : [] }; + lists.flush(); + out.push(codeRun); + } + continue; + } + closeCode(); + + if (sawPageBreak) { + lists.flush(); + out.push({ type: "page_break" }); + // A paragraph that held nothing but the break IS the break; keeping + // the husk would grow the document by one blank line every save. + if (!inline.length) continue; + } + + // An empty paragraph carrying only a bottom border is Word's + // horizontal rule (what AutoFormat makes from "---"). + if (!inline.length && child.hasBottomBorder) { + lists.flush(); + out.push({ type: "horizontal_rule" }); + continue; + } + + const attrs = paragraphAttrs(child); + let block; + if (cls.kind === "heading") { + block = { type: "heading", attrs: Object.assign({ level: cls.level }, attrs), content: inline }; + } else { + block = { type: "paragraph", attrs, content: inline }; + } + + if (child.numbering) { + // List items don't carry their own indent — the list level owns it. + block.attrs = Object.assign({}, block.attrs, { indent: 0 }); + lists.push(child.numbering, [block]); + continue; + } + lists.flush(); + + if (cls.kind === "blockquote") { + // The blockquote owns the indent; leaving it on the paragraph too + // would push the quote one level deeper on every round-trip. + block.attrs = Object.assign({}, block.attrs, { indent: 0 }); + out.push({ type: "blockquote", content: [block] }); + } + else out.push(block); + continue; + } + + closeCode(); + lists.flush(); + + if (child.type === "table") { + const table = await this.table(child); + if (table) out.push(table); + continue; + } + // Anything else at body level (bookmarks, stray runs) contributes no + // block of its own. + if (child.type === "bookmarkStart") continue; + } + + return out; + }; + + Reader.prototype.table = async function (table) { + const rows = []; + for (const row of table.children) { + if (row.type !== "tableRow") continue; + const cells = []; + for (const cell of row.children) { + if (cell.type !== "tableCell") continue; + let content = await this.blocks(cell.children); + if (!content.length) content = [{ type: "paragraph", content: [] }]; + // OOXML forbids a cell that ends with a table, so every document + // with a nested table carries an empty paragraph after it that the + // author never typed. Dropping it here keeps the cell stable across + // saves; the writer puts it back on the way out. + if (content.length > 1) { + const last = content[content.length - 1]; + const prev = content[content.length - 2]; + if (prev.type === "table" && last.type === "paragraph" && !(last.content || []).length) { + content.pop(); + } + } + cells.push({ + type: row.isHeader ? "table_header" : "table_cell", + attrs: { + colspan: cell.colSpan || 1, + rowspan: cell.rowSpan || 1, + colwidth: null, + background: null, + }, + content, + }); + } + // A row whose every column is covered by a merge from above has no + // cells of its own, and that's not an empty row to be thrown away — + // it's how both this model and HTML represent the middle of a + // vertical merge. Dropping it turns a 12-row merge into a 2-row one. + rows.push({ type: "table_row", content: cells }); + } + if (!rows.length) return null; + return { type: "table", content: rows }; + }; + + // ----------------------------------------------------------------- api --- + + /** + * Read a .docx into an editor document. + * + * @param {ArrayBuffer|Uint8Array} bytes + * @param {object} schema the ProseMirror schema from schema.js + * @returns {Promise<{doc, report, meta, setup, warnings, messages}>} + */ + async function docxToDoc(bytes, schema) { + const { mammoth, pm } = V(); + const { pkg } = globalThis.DocxEditor; + const arrayBuffer = bytes instanceof Uint8Array + ? bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) + : bytes; + const u8 = new Uint8Array(arrayBuffer); + + const zip = await pkg.loadZip(u8); + const [report, setup, meta] = await Promise.all([ + pkg.scan(zip), pkg.readSectionSetup(zip), pkg.readCoreProps(zip), + ]); + + let captured = null; + // mammoth takes {arrayBuffer} in the browser and {buffer} under node; + // the round-trip tests run under node against this same file. + const underNode = typeof process !== "undefined" && !!(process.versions && process.versions.node) && + typeof Buffer !== "undefined"; + const input = underNode ? { buffer: Buffer.from(u8) } : { arrayBuffer }; + // The HTML this produces is thrown away — transformDocument is just the + // public seam that hands over the parsed model. + const result = await mammoth.convertToHtml(input, { + transformDocument: (document) => { + captured = document; + return document; + }, + }); + if (!captured) throw new Error("mammoth did not hand back a document model"); + + const reader = new Reader(); + const blocks = await reader.blocks(captured.children); + if (!blocks.length) blocks.push({ type: "paragraph", content: [] }); + + const doc = pm.model.Node.fromJSON(schema, { type: "doc", content: blocks }); + doc.check(); + + return { + doc, + report, + meta, + setup, + warnings: reader.warnings, + messages: (result.messages || []).map((m) => `${m.type}: ${m.message}`), + }; + } + + return { docxToDoc, imagePixelSize, imageSizePt, classifyParagraph, bytesToBase64 }; +}); diff --git a/bundled-addons/docx-editor/lib/schema.js b/bundled-addons/docx-editor/lib/schema.js new file mode 100644 index 00000000..3ba6eee9 --- /dev/null +++ b/bundled-addons/docx-editor/lib/schema.js @@ -0,0 +1,378 @@ +// The editor's document model. +// +// This schema is the contract between the two halves of the round-trip: the +// reader (mammoth's document model -> here) and the writer (here -> the docx +// builder). Every attribute below exists because something on the Word side +// needs it, and every one of them is written back out. If you add a node or a +// mark, add it to BOTH read.js and write.js or it will silently vanish the +// first time someone saves. +// +// Units follow Word rather than CSS, deliberately — converting twips to +// pixels and back is how round-trips accumulate drift: +// indent integer level, 1 level = 720 twips (Word's default tab) +// fsize points +// lineHeight multiple of single spacing (1, 1.15, 1.5, 2) +// space* points before/after the paragraph +// highlight Word's highlight enum name, NOT a hex colour — w:highlight +// only accepts the 15 named values, so storing a hex here +// would mean guessing on the way out +(function (root, factory) { + const api = factory(); + if (typeof module === "object" && module.exports) module.exports = api; + root.DocxEditor = Object.assign(root.DocxEditor || {}, { schema: api }); +})(typeof globalThis !== "undefined" ? globalThis : this, function () { + "use strict"; + + const V = () => globalThis.DOCXV; + + // Word's highlight palette, in the order the ribbon shows it, with the CSS + // each one renders as in the editor. + const HIGHLIGHTS = [ + { name: "yellow", css: "#ffff00", label: "Yellow" }, + { name: "green", css: "#00ff00", label: "Bright green" }, + { name: "cyan", css: "#00ffff", label: "Turquoise" }, + { name: "magenta", css: "#ff00ff", label: "Pink" }, + { name: "blue", css: "#0000ff", label: "Blue" }, + { name: "red", css: "#ff0000", label: "Red" }, + { name: "darkBlue", css: "#000080", label: "Dark blue" }, + { name: "darkCyan", css: "#008080", label: "Teal" }, + { name: "darkGreen", css: "#008000", label: "Green" }, + { name: "darkMagenta", css: "#800080", label: "Violet" }, + { name: "darkRed", css: "#800000", label: "Dark red" }, + { name: "darkYellow", css: "#808000", label: "Dark yellow" }, + { name: "darkGray", css: "#808080", label: "Grey 50%" }, + { name: "lightGray", css: "#c0c0c0", label: "Grey 25%" }, + { name: "black", css: "#000000", label: "Black" }, + ]; + const HIGHLIGHT_CSS = Object.fromEntries(HIGHLIGHTS.map((h) => [h.name, h.css])); + + const TWIPS_PER_INDENT = 720; + + // Attributes shared by every block that can carry paragraph formatting. + function paragraphAttrs(extra) { + return Object.assign({ + align: { default: null }, // left | center | right | justify + indent: { default: 0 }, // 0..8 + lineHeight: { default: null }, // 1 | 1.15 | 1.5 | 2 | … + spaceBefore: { default: null }, // points + spaceAfter: { default: null }, // points + }, extra || {}); + } + + // Reading paragraph formatting back off a DOM element, for copy/paste and + // for the drag-and-drop of HTML into the editor. + function readParagraphAttrs(dom) { + const st = dom.style || {}; + const alignRaw = (st.textAlign || "").toLowerCase(); + const align = ["left", "center", "right", "justify"].includes(alignRaw) ? alignRaw : null; + const indentAttr = dom.getAttribute("data-indent"); + let indent = indentAttr ? parseInt(indentAttr, 10) : 0; + if (!Number.isFinite(indent) || indent < 0) indent = 0; + const lh = parseFloat(st.lineHeight); + const num = (v) => { const n = parseFloat(v); return Number.isFinite(n) ? n : null; }; + return { + align, + indent: Math.min(8, indent), + lineHeight: Number.isFinite(lh) ? lh : null, + spaceBefore: num(dom.getAttribute("data-space-before")), + spaceAfter: num(dom.getAttribute("data-space-after")), + }; + } + + function paragraphStyle(attrs) { + const css = []; + if (attrs.align) css.push(`text-align:${attrs.align}`); + if (attrs.indent) css.push(`margin-left:${attrs.indent * 0.5}in`); + if (attrs.lineHeight) css.push(`line-height:${attrs.lineHeight}`); + if (attrs.spaceBefore != null) css.push(`margin-top:${attrs.spaceBefore}pt`); + if (attrs.spaceAfter != null) css.push(`margin-bottom:${attrs.spaceAfter}pt`); + return css.join(";"); + } + + function paragraphDomAttrs(attrs) { + const out = {}; + const style = paragraphStyle(attrs); + if (style) out.style = style; + if (attrs.indent) out["data-indent"] = String(attrs.indent); + if (attrs.spaceBefore != null) out["data-space-before"] = String(attrs.spaceBefore); + if (attrs.spaceAfter != null) out["data-space-after"] = String(attrs.spaceAfter); + return out; + } + + function build() { + const { model, schemaList, tables } = V().pm; + const { Schema } = model; + + const nodes = { + doc: { content: "block+" }, + + paragraph: { + content: "inline*", + group: "block", + attrs: paragraphAttrs(), + parseDOM: [{ tag: "p", getAttrs: readParagraphAttrs }], + toDOM(node) { return ["p", paragraphDomAttrs(node.attrs), 0]; }, + }, + + heading: { + content: "inline*", + group: "block", + defining: true, + attrs: paragraphAttrs({ level: { default: 1 } }), + parseDOM: [1, 2, 3, 4, 5, 6].map((level) => ({ + tag: "h" + level, + getAttrs: (dom) => Object.assign(readParagraphAttrs(dom), { level }), + })), + toDOM(node) { return ["h" + node.attrs.level, paragraphDomAttrs(node.attrs), 0]; }, + }, + + blockquote: { + content: "block+", + group: "block", + defining: true, + parseDOM: [{ tag: "blockquote" }], + toDOM() { return ["blockquote", 0]; }, + }, + + code_block: { + content: "text*", + marks: "", + group: "block", + code: true, + defining: true, + parseDOM: [{ tag: "pre", preserveWhitespace: "full" }], + toDOM() { return ["pre", ["code", 0]]; }, + }, + + horizontal_rule: { + group: "block", + parseDOM: [{ tag: "hr" }], + toDOM() { return ["hr"]; }, + }, + + // Word's hard page break. An atom so the caret skips over it rather + // than landing inside something with no content. + page_break: { + group: "block", + atom: true, + selectable: true, + parseDOM: [{ tag: "div.docx-page-break" }], + toDOM() { return ["div", { class: "docx-page-break", contenteditable: "false" }, ["span", "Page break"]]; }, + }, + + text: { group: "inline" }, + + image: { + inline: true, + group: "inline", + draggable: true, + attrs: { + src: {}, alt: { default: null }, title: { default: null }, + width: { default: null }, height: { default: null }, // points + }, + parseDOM: [{ + tag: "img[src]", + getAttrs: (dom) => ({ + src: dom.getAttribute("src"), + alt: dom.getAttribute("alt"), + title: dom.getAttribute("title"), + width: parseFloat(dom.getAttribute("data-w")) || null, + height: parseFloat(dom.getAttribute("data-h")) || null, + }), + }], + toDOM(node) { + const a = { src: node.attrs.src, alt: node.attrs.alt || "", title: node.attrs.title || "" }; + if (node.attrs.width) { + a["data-w"] = String(node.attrs.width); + a.style = `width:${node.attrs.width}pt`; + } + if (node.attrs.height) a["data-h"] = String(node.attrs.height); + return ["img", a]; + }, + }, + + hard_break: { + inline: true, group: "inline", selectable: false, + parseDOM: [{ tag: "br" }], + toDOM() { return ["br"]; }, + }, + + // A footnote or endnote the editor doesn't render but refuses to throw + // away: the note text stays in the package (see pkg.graft) and this + // carries the reference that points at it. + note_ref: { + inline: true, group: "inline", atom: true, selectable: true, + attrs: { noteType: { default: "footnote" }, noteId: { default: "" }, label: { default: "*" } }, + parseDOM: [{ + tag: "sup.docx-note-ref", + getAttrs: (dom) => ({ + noteType: dom.getAttribute("data-note-type") || "footnote", + noteId: dom.getAttribute("data-note-id") || "", + label: dom.textContent || "*", + }), + }], + toDOM(node) { + return ["sup", { + class: "docx-note-ref", contenteditable: "false", + "data-note-type": node.attrs.noteType, + "data-note-id": node.attrs.noteId, + title: (node.attrs.noteType === "endnote" ? "Endnote" : "Footnote") + + " — kept in the file, not shown in the editor", + }, node.attrs.label]; + }, + }, + }; + + const marks = { + strong: { + parseDOM: [{ tag: "strong" }, { tag: "b" }, + { style: "font-weight", getAttrs: (v) => /^(bold(er)?|[5-9]\d{2,})$/.test(v) && null }], + toDOM() { return ["strong", 0]; }, + }, + em: { + parseDOM: [{ tag: "i" }, { tag: "em" }, { style: "font-style=italic" }], + toDOM() { return ["em", 0]; }, + }, + underline: { + parseDOM: [{ tag: "u" }, { style: "text-decoration=underline" }], + toDOM() { return ["u", 0]; }, + }, + strike: { + parseDOM: [{ tag: "s" }, { tag: "strike" }, { tag: "del" }, + { style: "text-decoration=line-through" }], + toDOM() { return ["s", 0]; }, + }, + // Word treats these as one property (w:vertAlign), so they exclude + // each other here too. + sup: { + group: "vertalign", excludes: "vertalign", + parseDOM: [{ tag: "sup:not(.docx-note-ref)" }], + toDOM() { return ["sup", 0]; }, + }, + sub: { + group: "vertalign", excludes: "vertalign", + parseDOM: [{ tag: "sub" }], + toDOM() { return ["sub", 0]; }, + }, + caps: { + parseDOM: [{ style: "text-transform=uppercase" }], + toDOM() { return ["span", { style: "text-transform:uppercase" }, 0]; }, + }, + smallcaps: { + parseDOM: [{ style: "font-variant=small-caps" }], + toDOM() { return ["span", { style: "font-variant:small-caps" }, 0]; }, + }, + link: { + attrs: { href: { default: "" }, title: { default: null }, anchor: { default: null } }, + inclusive: false, + parseDOM: [{ + tag: "a[href]", + getAttrs: (dom) => ({ + href: dom.getAttribute("href") || "", + title: dom.getAttribute("title"), + anchor: dom.getAttribute("data-anchor"), + }), + }], + toDOM(node) { + const a = { href: node.attrs.href || "#", title: node.attrs.title || "" }; + if (node.attrs.anchor) a["data-anchor"] = node.attrs.anchor; + return ["a", a, 0]; + }, + }, + font: { + attrs: { family: {} }, + parseDOM: [{ + tag: "span[data-font]", + getAttrs: (dom) => ({ family: dom.getAttribute("data-font") }), + }], + toDOM(node) { + return ["span", { "data-font": node.attrs.family, style: `font-family:${JSON.stringify(node.attrs.family)}` }, 0]; + }, + }, + fsize: { + attrs: { pt: {} }, + parseDOM: [{ + tag: "span[data-size]", + getAttrs: (dom) => ({ pt: parseFloat(dom.getAttribute("data-size")) || 11 }), + }], + toDOM(node) { + return ["span", { "data-size": String(node.attrs.pt), style: `font-size:${node.attrs.pt}pt` }, 0]; + }, + }, + color: { + attrs: { hex: {} }, // RRGGBB, no leading # + parseDOM: [{ + tag: "span[data-color]", + getAttrs: (dom) => ({ hex: (dom.getAttribute("data-color") || "").replace("#", "") }), + }], + toDOM(node) { + return ["span", { "data-color": node.attrs.hex, style: `color:#${node.attrs.hex}` }, 0]; + }, + }, + highlight: { + attrs: { name: { default: "yellow" } }, + parseDOM: [{ + tag: "mark", + getAttrs: (dom) => ({ name: dom.getAttribute("data-highlight") || "yellow" }), + }], + toDOM(node) { + const css = HIGHLIGHT_CSS[node.attrs.name] || "#ffff00"; + return ["mark", { + "data-highlight": node.attrs.name, + style: `background-color:${css};color:${css === "#000000" || css === "#000080" || css === "#800000" || css === "#808000" ? "#fff" : "inherit"}`, + }, 0]; + }, + }, + }; + + // Lists and tables come from the ProseMirror packages, so the node specs + // match what their commands expect. Building a throwaway Schema first is + // the cheapest way to get an OrderedMap without reaching for the + // orderedmap module directly — it isn't re-exported by the bundle. + let nodeMap = new Schema({ nodes, marks }).spec.nodes; + nodeMap = schemaList.addListNodes(nodeMap, "paragraph block*", "block"); + + // Ordered lists keep Word's numbering format instead of collapsing + // every list to 1. 2. 3. + nodeMap = nodeMap.update("ordered_list", { + content: "list_item+", + group: "block", + attrs: { + order: { default: 1 }, + // decimal | lowerLetter | upperLetter | lowerRoman | upperRoman + format: { default: "decimal" }, + }, + parseDOM: [{ + tag: "ol", + getAttrs: (dom) => ({ + order: dom.hasAttribute("start") ? parseInt(dom.getAttribute("start"), 10) || 1 : 1, + format: dom.getAttribute("data-format") || "decimal", + }), + }], + toDOM(node) { + const a = {}; + if (node.attrs.order !== 1) a.start = node.attrs.order; + if (node.attrs.format !== "decimal") a["data-format"] = node.attrs.format; + return ["ol", a, 0]; + }, + }); + + nodeMap = nodeMap.append(tables.tableNodes({ + tableGroup: "block", + cellContent: "block+", + cellAttributes: { + background: { + default: null, + getFromDOM: (dom) => dom.style.backgroundColor || null, + setDOMAttr: (value, attrs) => { + if (value) attrs.style = (attrs.style || "") + `background-color:${value};`; + }, + }, + }, + })); + + return new Schema({ nodes: nodeMap, marks }); + } + + return { build, HIGHLIGHTS, HIGHLIGHT_CSS, TWIPS_PER_INDENT }; +}); diff --git a/bundled-addons/docx-editor/lib/write.js b/bundled-addons/docx-editor/lib/write.js new file mode 100644 index 00000000..df5c85d9 --- /dev/null +++ b/bundled-addons/docx-editor/lib/write.js @@ -0,0 +1,576 @@ +// Editor model -> .docx. +// +// The docx builder gives us paragraphs, runs, tables, numbering and images; +// what it can't do is merge into an existing package, so this module builds a +// complete new document and then hands it to pkg.graft(), which carries the +// original's headers, footers, notes, styles and theme across. +// +// Mapping notes, because the two models disagree in places: +// +// * Marks are per-text-node in ProseMirror and per-run in Word, which is a +// clean fit: one text node with its mark set becomes one TextRun. +// * A ProseMirror list is a tree; Word's is a flat run of paragraphs each +// tagged with a numbering id and a level. flattenList() does that, and +// allocates one numbering instance per top-level list so that a second +// list on the page starts again at 1 instead of continuing. +// * Highlight is Word's 15-value enum, not a colour, so it passes straight +// through (see schema.js). +// * Tables get single-line borders. Word writes no borders unless a table +// style says otherwise and mammoth doesn't report the ones it read, so +// this is a deliberate default rather than a round-trip: see ROUND-TRIP.md. +(function (root, factory) { + const api = factory(); + if (typeof module === "object" && module.exports) module.exports = api; + root.DocxEditor = Object.assign(root.DocxEditor || {}, { write: api }); +})(typeof globalThis !== "undefined" ? globalThis : this, function () { + "use strict"; + + const V = () => globalThis.DOCXV; + + const TWIPS_PER_INDENT = 720; + const PT_TO_TWIP = 20; + const DEFAULT_FONT_PT = 11; + + function alignmentOf(align) { + const { AlignmentType } = V().docx; + switch (align) { + case "center": return AlignmentType.CENTER; + case "right": return AlignmentType.RIGHT; + case "justify": return AlignmentType.JUSTIFIED; + case "left": return AlignmentType.LEFT; + default: return undefined; + } + } + + function spacingOf(attrs) { + const spacing = {}; + if (attrs.lineHeight) { + spacing.line = Math.round(attrs.lineHeight * 240); + spacing.lineRule = "auto"; + } + if (attrs.spaceBefore != null) spacing.before = Math.round(attrs.spaceBefore * PT_TO_TWIP); + if (attrs.spaceAfter != null) spacing.after = Math.round(attrs.spaceAfter * PT_TO_TWIP); + return Object.keys(spacing).length ? spacing : undefined; + } + + function indentOf(attrs, extraTwips) { + const left = (attrs.indent || 0) * TWIPS_PER_INDENT + (extraTwips || 0); + return left ? { left } : undefined; + } + + function base64ToBytes(b64) { + if (typeof Buffer !== "undefined") return new Uint8Array(Buffer.from(b64, "base64")); + const bin = atob(b64); + const out = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i); + return out; + } + + const IMAGE_TYPES = { + "image/png": "png", "image/jpeg": "jpg", "image/jpg": "jpg", + "image/gif": "gif", "image/bmp": "bmp", "image/svg+xml": "svg", + }; + + // ---------------------------------------------------------------- runs --- + + function runsFromInline(node, ctx) { + const { TextRun, ExternalHyperlink, InternalHyperlink, Tab, + FootnoteReferenceRun } = V().docx; + const out = []; + + node.forEach((child) => { + if (child.isText) { + const props = { text: child.text }; + let link = null; + for (const mark of child.marks) { + switch (mark.type.name) { + case "strong": props.bold = true; break; + case "em": props.italics = true; break; + case "underline": props.underline = {}; break; + case "strike": props.strike = true; break; + case "sup": props.superScript = true; break; + case "sub": props.subScript = true; break; + case "caps": props.allCaps = true; break; + case "smallcaps": props.smallCaps = true; break; + case "font": props.font = mark.attrs.family; break; + case "fsize": props.size = Math.round(mark.attrs.pt * 2); break; // half-points + case "color": props.color = mark.attrs.hex; break; + case "highlight": props.highlight = mark.attrs.name; break; + case "link": link = mark.attrs; break; + default: break; + } + } + // Tabs are their own element in Word, so a run's text has to be cut + // around them — left inline they'd be written as literal tab + // characters, which Word renders as nothing at all. + const pieces = String(props.text).split("\t"); + const finalRuns = []; + pieces.forEach((piece, i) => { + if (i > 0) { + const tabProps = Object.assign({}, props); + delete tabProps.text; + finalRuns.push(new TextRun(Object.assign(tabProps, { children: [new Tab()] }))); + } + if (piece) finalRuns.push(new TextRun(Object.assign({}, props, { text: piece }))); + }); + if (!finalRuns.length) finalRuns.push(new TextRun(Object.assign({}, props, { text: "" }))); + + if (link) { + if (link.anchor) out.push(new InternalHyperlink({ anchor: link.anchor, children: finalRuns })); + else if (link.href) out.push(new ExternalHyperlink({ link: link.href, children: finalRuns })); + else out.push(...finalRuns); + } else { + out.push(...finalRuns); + } + return; + } + + switch (child.type.name) { + case "hard_break": + out.push(new TextRun({ break: 1 })); + break; + case "image": { + const run = imageRun(child, ctx); + if (run) out.push(run); + break; + } + case "note_ref": { + const id = parseInt(child.attrs.noteId, 10); + if (Number.isFinite(id)) { + try { out.push(new FootnoteReferenceRun(id)); } + catch { ctx.warn(`footnote reference ${id} could not be written`); } + } + break; + } + default: + break; + } + }); + return out; + } + + function imageRun(node, ctx) { + const { ImageRun } = V().docx; + const m = /^data:([^;,]+);base64,(.*)$/.exec(node.attrs.src || ""); + if (!m) { ctx.warn("an image could not be saved (unsupported source)"); return null; } + const type = IMAGE_TYPES[m[1].toLowerCase()]; + if (!type) { ctx.warn(`an image of type ${m[1]} could not be saved`); return null; } + const data = base64ToBytes(m[2]); + const width = node.attrs.width || 300; + const height = node.attrs.height || Math.round(width * 0.75); + const opts = { + data, + // The builder wants pixels at 96dpi and rounds to whole EMU itself + // (1px = 9525 EMU), so these stay fractional — rounding to whole + // pixels here would quantise every picture to 0.75pt and shift it a + // little further on every save. + transformation: { width: width / 0.75, height: height / 0.75 }, + type, + }; + if (node.attrs.alt) opts.altText = { name: node.attrs.alt, description: node.attrs.alt, title: node.attrs.alt }; + if (type === "svg") { + // The builder requires a raster fallback for SVG; without one it + // throws, and a thrown save is worse than a missing picture. + ctx.warn("an SVG image was skipped (Word needs a raster fallback)"); + return null; + } + return new ImageRun(opts); + } + + // ---------------------------------------------------------- paragraphs --- + + function paragraphFrom(node, ctx, extra) { + const { Paragraph, HeadingLevel, BorderStyle } = V().docx; + const attrs = node.attrs || {}; + const opts = Object.assign({ + children: runsFromInline(node, ctx), + alignment: alignmentOf(attrs.align), + spacing: spacingOf(attrs), + indent: indentOf(attrs, (extra && extra.extraIndent) || 0), + }, extra && extra.paragraph); + + if (node.type.name === "heading") { + opts.heading = [HeadingLevel.HEADING_1, HeadingLevel.HEADING_2, HeadingLevel.HEADING_3, + HeadingLevel.HEADING_4, HeadingLevel.HEADING_5, HeadingLevel.HEADING_6][ + Math.max(1, Math.min(6, attrs.level || 1)) - 1]; + } + return new Paragraph(opts); + } + + // A ProseMirror list tree flattened into Word's numbered paragraphs. + function flattenList(listNode, ctx, out, level, reference) { + listNode.forEach((item) => { + let first = true; + item.forEach((child) => { + const name = child.type.name; + if (name === "bullet_list" || name === "ordered_list") { + flattenList(child, ctx, out, level + 1, reference); + return; + } + if (name === "paragraph" || name === "heading") { + // Only the item's first paragraph carries the bullet; the rest are + // continuation paragraphs indented to match, which is what Word + // does for a multi-paragraph list item. + if (first) { + out.push(paragraphFrom(child, ctx, { + paragraph: { numbering: { reference, level } }, + })); + first = false; + } else { + out.push(paragraphFrom(child, ctx, { + extraIndent: (level + 1) * TWIPS_PER_INDENT, + })); + } + return; + } + // Tables and anything else inside a list item: emit it after, since + // Word can't nest a table under a bullet in our model. + blockFrom(child, ctx, out, {}); + }); + if (first) { + // An empty list item still needs a bullet. + const { Paragraph } = V().docx; + out.push(new Paragraph({ numbering: { reference, level } })); + } + }); + } + + // Tables are a grid, not a list of rows: a cell that spans rows downwards + // is written once with vMerge="restart", and every row it reaches into + // needs its own vMerge="continue" placeholder in that column. ProseMirror + // stores the covered cells as absent (the same convention HTML uses), so + // the writer has to put them back — without them Word reads a 12-row merge + // as a 2-row one. + function tableFrom(node, ctx) { + const { Table, TableRow, TableCell, WidthType, BorderStyle, Paragraph, + VerticalMergeType } = V().docx; + const border = { style: BorderStyle.SINGLE, size: 4, color: "999999" }; + + const pmRows = []; + node.forEach((r) => pmRows.push(r)); + + const continuation = (colspan) => new TableCell(Object.assign( + { children: [new Paragraph({})], verticalMerge: VerticalMergeType.CONTINUE }, + colspan > 1 ? { columnSpan: colspan } : {})); + + const realCell = (cell) => { + const colspan = cell.attrs.colspan || 1; + const rowspan = cell.attrs.rowspan || 1; + const children = []; + blocksOf(cell, ctx, children, true); + if (!children.length) children.push(new Paragraph({})); + const opts = { children }; + if (colspan > 1) opts.columnSpan = colspan; + if (rowspan > 1) opts.verticalMerge = VerticalMergeType.RESTART; + if (cell.attrs.background) opts.shading = { fill: String(cell.attrs.background).replace("#", "") }; + return new TableCell(opts); + }; + + let active = []; // [{col, colspan, rowsLeft}] still merging down + const rows = []; + for (const pmRow of pmRows) { + const pmCells = []; + pmRow.forEach((c) => pmCells.push(c)); + const outCells = []; + const nextActive = []; + let col = 0; + let i = 0; + const coveringAt = (c) => active.find((a) => a.col === c); + + while (i < pmCells.length || coveringAt(col)) { + const cover = coveringAt(col); + if (cover) { + outCells.push(continuation(cover.colspan)); + if (cover.rowsLeft > 1) { + nextActive.push({ col: cover.col, colspan: cover.colspan, rowsLeft: cover.rowsLeft - 1 }); + } + col += cover.colspan; + continue; + } + const cell = pmCells[i++]; + const colspan = cell.attrs.colspan || 1; + const rowspan = cell.attrs.rowspan || 1; + outCells.push(realCell(cell)); + if (rowspan > 1) nextActive.push({ col, colspan, rowsLeft: rowspan - 1 }); + col += colspan; + } + active = nextActive; + rows.push(new TableRow({ children: outCells })); + } + if (!rows.length) return null; + return new Table({ + rows, + width: { size: 100, type: WidthType.PERCENTAGE }, + borders: { top: border, bottom: border, left: border, right: border, + insideHorizontal: border, insideVertical: border }, + }); + } + + function blocksOf(parent, ctx, out, inCell) { + const kids = []; + parent.forEach((child) => kids.push(child)); + kids.forEach((child, i) => { + blockFrom(child, ctx, out, { + next: kids[i + 1] || null, + isLast: i === kids.length - 1, + inCell: !!inCell, + }); + }); + } + + function blockFrom(node, ctx, out, pos) { + const { Paragraph, PageBreak, TextRun, BorderStyle } = V().docx; + const at = pos || {}; + switch (node.type.name) { + case "paragraph": + case "heading": + out.push(paragraphFrom(node, ctx)); + break; + + case "blockquote": { + node.forEach((child) => { + if (child.type.name === "paragraph" || child.type.name === "heading") { + out.push(paragraphFrom(child, ctx, { + paragraph: { style: "Quote" }, + extraIndent: TWIPS_PER_INDENT, + })); + } else { + blockFrom(child, ctx, out, {}); + } + }); + break; + } + + case "code_block": { + // One Word paragraph per line, all in the editor's SourceCode style, + // so the block reads back as a block rather than as prose. + const lines = (node.textContent || "").split("\n"); + for (const line of lines) { + out.push(new Paragraph({ + style: "SourceCode", + children: [new TextRun({ text: line })], + })); + } + break; + } + + case "bullet_list": + case "ordered_list": { + const reference = ctx.newNumbering(node, collectLevelFormats(node, 0, [])); + flattenList(node, ctx, out, 0, reference); + break; + } + + case "table": { + const t = tableFrom(node, ctx); + if (t) out.push(t); + // OOXML requires a table cell to end with a paragraph, so a table in + // that position gets one. Between two tables at body level it is + // only a rendering nicety, and adding one there would come back as a + // stray empty paragraph on the next read — documents that legitimately + // hold two adjacent tables would gain a blank line on every save. + if (at.inCell && at.isLast) out.push(new Paragraph({ spacing: { after: 0 } })); + break; + } + + case "horizontal_rule": + out.push(new Paragraph({ + border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: "808080", space: 1 } }, + })); + break; + + case "page_break": + out.push(new Paragraph({ children: [new PageBreak()] })); + break; + + default: + ctx.warn(`"${node.type.name}" is not written to Word`); + break; + } + } + + // ----------------------------------------------------------- numbering --- + + const BULLETS = ["●", "○", "▪", "●", "○", "▪", "●", "○", "▪"]; + + function levelFormatFor(format) { + const { LevelFormat } = V().docx; + switch (format) { + case "lowerLetter": return LevelFormat.LOWER_LETTER; + case "upperLetter": return LevelFormat.UPPER_LETTER; + case "lowerRoman": return LevelFormat.LOWER_ROMAN; + case "upperRoman": return LevelFormat.UPPER_ROMAN; + case "bullet": return LevelFormat.BULLET; + default: return LevelFormat.DECIMAL; + } + } + + // Word keeps numbering formats per level on one numbering definition, so a + // list that is bulleted at the top and lettered underneath needs both + // facts before the definition can be written. Walk the tree first and + // record what each depth actually uses; where two sibling sub-lists + // disagree at the same depth, the first one wins (Word has nowhere to put + // the second answer). + function collectLevelFormats(node, level, into) { + if (level > 8) return into; + const ordered = node.type.name === "ordered_list"; + if (!into[level]) { + into[level] = { + ordered, + format: ordered ? (node.attrs.format || "decimal") : "bullet", + start: ordered && node.attrs.order > 1 ? node.attrs.order : null, + }; + } + node.forEach((item) => { + item.forEach((child) => { + const n = child.type.name; + if (n === "bullet_list" || n === "ordered_list") collectLevelFormats(child, level + 1, into); + }); + }); + return into; + } + + // One numbering instance per top-level list. Nine levels each, because a + // list can be nested deeper than the levels we actually saw. + function numberingConfigFor(reference, levelFormats) { + const { LevelFormat, AlignmentType } = V().docx; + const levels = []; + for (let i = 0; i < 9; i++) { + const indent = { left: (i + 1) * TWIPS_PER_INDENT, hanging: 360 }; + // Depths the document didn't reach still need a definition; fall back + // to Word's own default rotation. + const spec = levelFormats[i] || + { ordered: false, format: "bullet", start: null }; + if (spec.ordered) { + levels.push({ + level: i, + format: levelFormatFor(spec.format), + text: `%${i + 1}.`, + alignment: AlignmentType.START, + style: { paragraph: { indent } }, + }); + if (spec.start) levels[i].start = spec.start; + } else { + levels.push({ + level: i, + format: LevelFormat.BULLET, + text: BULLETS[i], + alignment: AlignmentType.LEFT, + style: { paragraph: { indent } }, + }); + } + } + return { reference, levels }; + } + + // --------------------------------------------------------------- styles --- + + // Only the styles the writer itself references. Anything the original + // document defined is grafted back over the top of these by pkg.graft(). + function paragraphStyles() { + return [ + { + id: "SourceCode", + name: "Source Code", + basedOn: "Normal", + quickFormat: true, + run: { font: "Consolas", size: 20 }, + paragraph: { spacing: { before: 0, after: 0, line: 240, lineRule: "auto" } }, + }, + { + id: "Quote", + name: "Quote", + basedOn: "Normal", + quickFormat: true, + run: { italics: true, color: "404040" }, + paragraph: { spacing: { before: 120, after: 120 } }, + }, + ]; + } + + // ------------------------------------------------------------------ api --- + + /** + * Serialise an editor document to .docx bytes. + * + * @param {Node} doc ProseMirror document + * @param {object} opts + * originalBytes the file this document was read from, if any — its + * headers, footers, notes, styles and theme are grafted + * onto the result + * setup page setup read from the original (pkg.readSectionSetup) + * meta document properties (pkg.readCoreProps) + * @returns {Promise<{bytes: Uint8Array, warnings: string[], carried: string[]}>} + */ + async function docToDocx(doc, opts) { + const o = opts || {}; + const { docx } = V(); + const { Document, Packer } = docx; + + const warnings = []; + const numbering = []; + let numberingSeq = 0; + const ctx = { + warn(msg) { if (!warnings.includes(msg)) warnings.push(msg); }, + newNumbering(node, levelFormats) { + const reference = `list-${++numberingSeq}`; + numbering.push(numberingConfigFor(reference, levelFormats)); + return reference; + }, + }; + + const children = []; + blocksOf(doc, ctx, children, false); + if (!children.length) { + const { Paragraph } = docx; + children.push(new Paragraph({})); + } + + const section = { children, properties: {} }; + if (o.setup && o.setup.page && Object.keys(o.setup.page).length) { + section.properties.page = o.setup.page; + } + if (o.setup && o.setup.titlePg) section.properties.titlePage = true; + + const meta = o.meta || {}; + const document = new Document({ + title: meta.title || undefined, + creator: meta.creator || undefined, + description: meta.description || undefined, + subject: meta.subject || undefined, + keywords: meta.keywords || undefined, + numbering: numbering.length ? { config: numbering } : undefined, + styles: { paragraphStyles: paragraphStyles() }, + sections: [section], + }); + + // Packer.toBuffer asks JSZip for a "nodebuffer", which browsers don't + // support — in the tab it throws before a single byte is written. Blob + // is the browser's route; node keeps toBuffer so the round-trip tests + // exercise the same code without a Blob shim. + let bytes; + if (typeof Buffer !== "undefined") { + const buf = await Packer.toBuffer(document); + bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf); + } else { + const blob = await Packer.toBlob(document); + bytes = new Uint8Array(await blob.arrayBuffer()); + } + + let carried = []; + if (o.originalBytes) { + try { + const grafted = await globalThis.DocxEditor.pkg.graft(o.originalBytes, bytes, o.graft); + bytes = grafted.bytes; + carried = grafted.carried; + } catch (e) { + // A failed graft must not cost the user their edits: the rebuilt + // document is still a valid .docx, just a plainer one. + ctx.warn(`could not carry over the original's headers/styles (${e && e.message || e})`); + } + } + return { bytes, warnings, carried }; + } + + return { docToDocx, numberingConfigFor, collectLevelFormats, paragraphStyles }; +}); diff --git a/bundled-addons/docx-editor/panel.html b/bundled-addons/docx-editor/panel.html new file mode 100644 index 00000000..ec3c7551 --- /dev/null +++ b/bundled-addons/docx-editor/panel.html @@ -0,0 +1,221 @@ + + + + +Word editor + + + + +
    📝

    Word editor

    + +
    +

    Open a .docx in a full tab. Headers, footers, footnotes, page setup and + the document's own styles survive a save; a few Word features don't, and the editor says + which before you start.

    + + + + +
    or drop a .docx here
    + +

    Recent

    +
    Nothing yet.
    + +
    +
    + +
    + Documents are kept in a scratch folder. + + +
    + + + + + + diff --git a/bundled-addons/docx-editor/vendor/LICENSES.txt b/bundled-addons/docx-editor/vendor/LICENSES.txt new file mode 100644 index 00000000..3e2140ae --- /dev/null +++ b/bundled-addons/docx-editor/vendor/LICENSES.txt @@ -0,0 +1,416 @@ +Third-party code bundled into vendor/docx-vendor.js +=================================================== + +mammoth is shipped with small local patches (colour, paragraph spacing, +numbering format); see addon-build/docx-editor/patches.mjs. + +--- mammoth 1.12.3 — BSD-2-Clause --- +Copyright (c) 2013, Michael Williamson +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +--- docx 9.7.1 — MIT --- +The MIT License (MIT) + +Copyright (c) 2016 Dolan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- jszip 3.10.2 — (MIT OR GPL-3.0-or-later) --- +(no licence file in the package; see https://github.com/Stuk/jszip.git) + +--- underscore 1.13.8 — MIT --- +Copyright (c) 2009-2022 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +--- orderedmap 2.1.1 — MIT --- +Copyright (C) 2016 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- w3c-keyname 2.2.8 — MIT --- +Copyright (C) 2016 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- rope-sequence 1.3.4 — MIT --- +Copyright (C) 2016 by Marijn Haverbeke + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-state 1.4.4 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-view 1.42.4 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-model 1.25.11 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-schema-basic 1.2.4 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-schema-list 1.5.1 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-tables 1.8.5 — MIT --- +Copyright (C) 2015-2016 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-history 1.5.0 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-commands 1.7.2 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-keymap 1.2.3 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-inputrules 1.5.1 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-dropcursor 1.8.3 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-gapcursor 1.4.1 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- prosemirror-transform 1.12.1 — MIT --- +Copyright (C) 2015-2017 by Marijn Haverbeke and others + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/bundled-addons/docx-editor/vendor/docx-vendor.js b/bundled-addons/docx-editor/vendor/docx-vendor.js new file mode 100644 index 00000000..2b95369e --- /dev/null +++ b/bundled-addons/docx-editor/vendor/docx-vendor.js @@ -0,0 +1,253 @@ +(()=>{var x3=Object.create;var fu=Object.defineProperty;var E3=Object.getOwnPropertyDescriptor;var A3=Object.getOwnPropertyNames;var S3=Object.getPrototypeOf,T3=Object.prototype.hasOwnProperty;var vr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ce=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var pe=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ut=(e,t)=>{for(var r in t)fu(e,r,{get:t[r],enumerable:!0})},c1=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of A3(t))!T3.call(e,i)&&i!==r&&fu(e,i,{get:()=>t[i],enumerable:!(n=E3(t,i))||n.enumerable});return e};var f1=(e,t,r)=>(r=e!=null?x3(S3(e)):{},c1(t||!e||!e.__esModule?fu(r,"default",{value:e,enumerable:!0}):r,e)),it=e=>c1(fu({},"__esModule",{value:!0}),e);var Ys,wh,Qs,hu,bh,h1,Gr,yn,d1,_h,p1,m1,xh,Eh,Ah,g1,y1,du,Sh,v1,Ye=ce(()=>{Ys="1.13.8",wh=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},Qs=Array.prototype,hu=Object.prototype,bh=typeof Symbol<"u"?Symbol.prototype:null,h1=Qs.push,Gr=Qs.slice,yn=hu.toString,d1=hu.hasOwnProperty,_h=typeof ArrayBuffer<"u",p1=typeof DataView<"u",m1=Array.isArray,xh=Object.keys,Eh=Object.create,Ah=_h&&ArrayBuffer.isView,g1=isNaN,y1=isFinite,du=!{toString:null}.propertyIsEnumerable("toString"),Sh=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],v1=Math.pow(2,53)-1});function je(e,t){return t=t==null?e.length-1:+t,function(){for(var r=Math.max(arguments.length-t,0),n=Array(r),i=0;i{});function Nt(e){var t=typeof e;return t==="function"||t==="object"&&!!e}var Xn=ce(()=>{});function pu(e){return e===null}var w1=ce(()=>{});function Ao(e){return e===void 0}var Th=ce(()=>{});function So(e){return e===!0||e===!1||yn.call(e)==="[object Boolean]"}var Ch=ce(()=>{Ye()});function mu(e){return!!(e&&e.nodeType===1)}var b1=ce(()=>{});function Be(e){var t="[object "+e+"]";return function(r){return yn.call(r)===t}}var wt=ce(()=>{Ye()});var Ni,gu=ce(()=>{wt();Ni=Be("String")});var ea,kh=ce(()=>{wt();ea=Be("Number")});var Dh,_1=ce(()=>{wt();Dh=Be("Date")});var Nh,x1=ce(()=>{wt();Nh=Be("RegExp")});var Oh,E1=ce(()=>{wt();Oh=Be("Error")});var ta,Rh=ce(()=>{wt();ta=Be("Symbol")});var ra,Ih=ce(()=>{wt();ra=Be("ArrayBuffer")});var A1,C3,Ve,fr=ce(()=>{wt();Ye();A1=Be("Function"),C3=wh.document&&wh.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof C3!="function"&&(A1=function(e){return typeof e=="function"||!1});Ve=A1});var Fh,S1=ce(()=>{wt();Fh=Be("Object")});var yu,To,Co=ce(()=>{Ye();S1();yu=p1&&(!/\[native code\]/.test(String(DataView))||Fh(new DataView(new ArrayBuffer(8)))),To=typeof Map<"u"&&Fh(new Map)});function D3(e){return e!=null&&Ve(e.getInt8)&&ra(e.buffer)}var k3,Zn,vu=ce(()=>{wt();fr();Ih();Co();k3=Be("DataView");Zn=yu?D3:k3});var qt,Jn=ce(()=>{Ye();wt();qt=m1||Be("Array")});function bt(e,t){return e!=null&&d1.call(e,t)}var vn=ce(()=>{Ye()});var Mh,Oi,wu=ce(()=>{wt();vn();Mh=Be("Arguments");(function(){Mh(arguments)||(Mh=function(e){return bt(e,"callee")})})();Oi=Mh});function bu(e){return!ta(e)&&y1(e)&&!isNaN(parseFloat(e))}var T1=ce(()=>{Ye();Rh()});function ko(e){return ea(e)&&g1(e)}var Bh=ce(()=>{Ye();kh()});function Do(e){return function(){return e}}var Lh=ce(()=>{});function na(e){return function(t){var r=e(t);return typeof r=="number"&&r>=0&&r<=v1}}var Ph=ce(()=>{Ye()});function ia(e){return function(t){return t?.[e]}}var zh=ce(()=>{});var Ri,_u=ce(()=>{zh();Ri=ia("byteLength")});var C1,k1=ce(()=>{Ph();_u();C1=na(Ri)});function O3(e){return Ah?Ah(e)&&!Zn(e):C1(e)&&N3.test(yn.call(e))}var N3,oa,Uh=ce(()=>{Ye();vu();Lh();k1();N3=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;oa=_h?O3:Do(!1)});var Ge,hr=ce(()=>{zh();Ge=ia("length")});function R3(e){for(var t={},r=e.length,n=0;n{Ye();fr();vn()});function Re(e){if(!Nt(e))return[];if(xh)return xh(e);var t=[];for(var r in e)bt(e,r)&&t.push(r);return du&&sa(e,t),t}var ft=ce(()=>{Xn();Ye();vn();qh()});function xu(e){if(e==null)return!0;var t=Ge(e);return typeof t=="number"&&(qt(e)||Ni(e)||Oi(e))?t===0:Ge(Re(e))===0}var D1=ce(()=>{hr();Jn();gu();wu();ft()});function No(e,t){var r=Re(t),n=r.length;if(e==null)return!n;for(var i=Object(e),o=0;o{ft()});function De(e){if(e instanceof De)return e;if(!(this instanceof De))return new De(e);this._wrapped=e}var Yt=ce(()=>{Ye();De.VERSION=Ys;De.prototype.value=function(){return this._wrapped};De.prototype.valueOf=De.prototype.toJSON=De.prototype.value;De.prototype.toString=function(){return String(this._wrapped)}});function Eu(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,Ri(e))}var N1=ce(()=>{_u()});function Au(e,t){for(var r=[{a:e,b:t}],n=[],i=[];r.length;){var o=r.pop();if(o===!0){n.pop(),i.pop();continue}if(e=o.a,t=o.b,e===t){if(e!==0||1/e===1/t)continue;return!1}if(e==null||t==null)return!1;if(e!==e){if(t!==t)continue;return!1}var s=typeof e;if(s!=="function"&&s!=="object"&&typeof t!="object")return!1;e instanceof De&&(e=e._wrapped),t instanceof De&&(t=t._wrapped);var a=yn.call(e);if(a!==yn.call(t))return!1;if(yu&&a=="[object Object]"&&Zn(e)){if(!Zn(t))return!1;a=O1}switch(a){case"[object RegExp]":case"[object String]":if(""+e==""+t)continue;return!1;case"[object Number]":r.push({a:+e,b:+t});continue;case"[object Date]":case"[object Boolean]":if(+e==+t)continue;return!1;case"[object Symbol]":if(bh.valueOf.call(e)===bh.valueOf.call(t))continue;return!1;case"[object ArrayBuffer]":case O1:r.push({a:Eu(e),b:Eu(t)});continue}var u=a==="[object Array]";if(!u&&oa(e)){var c=Ri(e);if(c!==Ri(t))return!1;if(e.buffer===t.buffer&&e.byteOffset===t.byteOffset)continue;u=!0}if(!u){if(typeof e!="object"||typeof t!="object")return!1;var f=e.constructor,h=t.constructor;if(f!==h&&!(Ve(f)&&f instanceof f&&Ve(h)&&h instanceof h)&&"constructor"in e&&"constructor"in t)return!1}for(var p=n.length;p--;)if(n[p]===e){if(i[p]===t)break;return!1}if(!(p>=0))if(n.push(e),i.push(t),r.push(!0),u){if(p=e.length,p!==t.length)return!1;for(;p--;)r.push({a:e[p],b:t[p]})}else{var d=Re(e),m;if(p=d.length,Re(t).length!==p)return!1;for(;p--;){if(m=d[p],!bt(t,m))return!1;r.push({a:e[m],b:t[m]})}}}return!0}var O1,R1=ce(()=>{Yt();Ye();_u();Uh();fr();Co();vu();ft();vn();N1();O1="[object DataView]"});function wr(e){if(!Nt(e))return[];var t=[];for(var r in e)t.push(r);return du&&sa(e,t),t}var Oo=ce(()=>{Xn();Ye();qh()});function Ro(e){var t=Ge(e);return function(r){if(r==null)return!1;var n=wr(r);if(Ge(n))return!1;for(var i=0;i{hr();fr();Oo();Hh="forEach",I1="has",Wh=["clear","delete"],F1=["get",I1,"set"],M1=Wh.concat(Hh,F1),Vh=Wh.concat(F1),B1=["add"].concat(Wh,Hh,I1)});var Gh,L1=ce(()=>{wt();Co();Su();Gh=To?Ro(M1):Be("Map")});var Kh,P1=ce(()=>{wt();Co();Su();Kh=To?Ro(Vh):Be("WeakMap")});var $h,z1=ce(()=>{wt();Co();Su();$h=To?Ro(B1):Be("Set")});var Xh,U1=ce(()=>{wt();Xh=Be("WeakSet")});function Qt(e){for(var t=Re(e),r=t.length,n=Array(r),i=0;i{ft()});function Tu(e){for(var t=Re(e),r=t.length,n=Array(r),i=0;i{ft()});function Io(e){for(var t={},r=Re(e),n=0,i=r.length;n{ft()});function Fi(e){var t=[];for(var r in e)Ve(e[r])&&t.push(r);return t.sort()}var Jh=ce(()=>{fr()});function Mi(e,t){return function(r){var n=arguments.length;if(t&&(r=Object(r)),n<2||r==null)return r;for(var i=1;i{});var aa,Yh=ce(()=>{Cu();Oo();aa=Mi(wr)});var Yn,ku=ce(()=>{Cu();ft();Yn=Mi(Re)});var la,Qh=ce(()=>{Cu();Oo();la=Mi(wr,!0)});function I3(){return function(){}}function ua(e){if(!Nt(e))return{};if(Eh)return Eh(e);var t=I3();t.prototype=e;var r=new t;return t.prototype=null,r}var ed=ce(()=>{Xn();Ye()});function Du(e,t){var r=ua(e);return t&&Yn(r,t),r}var j1=ce(()=>{ed();ku()});function Nu(e){return Nt(e)?qt(e)?e.slice():aa({},e):e}var H1=ce(()=>{Xn();Jn();Yh()});function Ou(e,t){return t(e),e}var W1=ce(()=>{});function ca(e){return qt(e)?e:[e]}var td=ce(()=>{Yt();Jn();De.toPath=ca});function Rr(e){return De.toPath(e)}var Fo=ce(()=>{Yt();td()});function Bi(e,t){for(var r=t.length,n=0;n{});function Mo(e,t,r){var n=Bi(e,Rr(t));return Ao(n)?r:n}var rd=ce(()=>{Fo();Ru();Th()});function Iu(e,t){t=Rr(t);for(var r=t.length,n=0;n{vn();Fo()});function Qn(e){return e}var Fu=ce(()=>{});function Ir(e){return e=Yn({},e),function(t){return No(t,e)}}var fa=ce(()=>{ku();jh()});function ei(e){return e=Rr(e),function(t){return Bi(t,e)}}var Mu=ce(()=>{Ru();Fo()});function Fr(e,t,r){if(t===void 0)return e;switch(r??3){case 1:return function(n){return e.call(t,n)};case 3:return function(n,i,o){return e.call(t,n,i,o)};case 4:return function(n,i,o,s){return e.call(t,n,i,o,s)}}return function(){return e.apply(t,arguments)}}var Bo=ce(()=>{});function ha(e,t,r){return e==null?Qn:Ve(e)?Fr(e,t,r):Nt(e)&&!qt(e)?Ir(e):ei(e)}var nd=ce(()=>{Fu();fr();Xn();Jn();fa();Mu();Bo()});function Li(e,t){return ha(e,t,1/0)}var id=ce(()=>{Yt();nd();De.iteratee=Li});function He(e,t,r){return De.iteratee!==Li?De.iteratee(e,t):ha(e,t,r)}var jt=ce(()=>{Yt();nd();id()});function Bu(e,t,r){t=He(t,r);for(var n=Re(e),i=n.length,o={},s=0;s{jt();ft()});function Lo(){}var od=ce(()=>{});function Lu(e){return e==null?Lo:function(t){return Mo(e,t)}}var K1=ce(()=>{od();rd()});function Pu(e,t,r){var n=Array(Math.max(0,e));t=Fr(t,r,1);for(var i=0;i{Bo()});function Pi(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))}var sd=ce(()=>{});var wn,zu=ce(()=>{wn=Date.now||function(){return new Date().getTime()}});function da(e){var t=function(o){return e[o]},r="(?:"+Re(e).join("|")+")",n=RegExp(r),i=RegExp(r,"g");return function(o){return o=o==null?"":""+o,n.test(o)?o.replace(i,t):o}}var ad=ce(()=>{ft()});var Uu,ld=ce(()=>{Uu={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"}});var ud,X1=ce(()=>{ad();ld();ud=da(Uu)});var Z1,J1=ce(()=>{Zh();ld();Z1=Io(Uu)});var cd,Y1=ce(()=>{ad();J1();cd=da(Z1)});var fd,hd=ce(()=>{Yt();fd=De.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g}});function B3(e){return"\\"+F3[e]}function qu(e,t,r){!t&&r&&(t=r),t=la({},t,De.templateSettings);var n=RegExp([(t.escape||dd).source,(t.interpolate||dd).source,(t.evaluate||dd).source].join("|")+"|$","g"),i=0,o="__p+='";e.replace(n,function(c,f,h,p,d){return o+=e.slice(i,d).replace(M3,B3),i=d+c.length,f?o+=`'+ +((__t=(`+f+`))==null?'':_.escape(__t))+ +'`:h?o+=`'+ +((__t=(`+h+`))==null?'':__t)+ +'`:p&&(o+=`'; +`+p+` +__p+='`),c}),o+=`'; +`;var s=t.variable;if(s){if(!L3.test(s))throw new Error("variable is not a bare identifier: "+s)}else o=`with(obj||{}){ +`+o+`} +`,s="obj";o=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');}; +`+o+`return __p; +`;var a;try{a=new Function(s,"_",o)}catch(c){throw c.source=o,c}var u=function(c){return a.call(this,c,De)};return u.source="function("+s+`){ +`+o+"}",u}var dd,F3,M3,L3,Q1=ce(()=>{Qh();Yt();hd();dd=/(.)^/,F3={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},M3=/\\|'|\r|\n|\u2028|\u2029/g;L3=/^\s*(\w|\$)+\s*$/});function ju(e,t,r){t=Rr(t);var n=t.length;if(!n)return Ve(r)?r.call(e):r;for(var i=0;i{fr();Fo()});function Hu(e){var t=++P3+"";return e?e+t:t}var P3,ty=ce(()=>{P3=0});function Wu(e){var t=De(e);return t._chain=!0,t}var ry=ce(()=>{Yt()});function pa(e,t,r,n,i){if(!(n instanceof t))return e.apply(r,i);var o=ua(e.prototype),s=e.apply(o,i);return Nt(s)?s:o}var pd=ce(()=>{ed();Xn()});var md,bn,ma=ce(()=>{Jt();pd();Yt();md=je(function(e,t){var r=md.placeholder,n=function(){for(var i=0,o=t.length,s=Array(o),a=0;a{Jt();fr();pd();ga=je(function(e,t,r){if(!Ve(e))throw new TypeError("Bind must be called on a function");var n=je(function(i){return pa(e,n,t,this,r.concat(i))});return n})});var Ze,er=ce(()=>{Ph();hr();Ze=na(Ge)});function dr(e,t,r){!t&&t!==0&&(t=1/0);for(var n=[],i=0,o=0,s=Ge(e)||0,a=[];;){if(o>=s){if(!a.length)break;var u=a.pop();o=u.i,e=u.v,s=Ge(e);continue}var c=e[o++];a.length>=t?n[i++]=c:Ze(c)&&(qt(c)||Oi(c))?(a.push({i:o,v:e}),o=0,e=c,s=Ge(e)):r||(n[i++]=c)}return n}var zi=ce(()=>{hr();er();Jn();wu()});var yd,ny=ce(()=>{Jt();zi();gd();yd=je(function(e,t){t=dr(t,!1,!1);var r=t.length;if(r<1)throw new Error("bindAll must be passed function names");for(;r--;){var n=t[r];e[n]=ga(e[n],e)}return e})});function Vu(e,t){var r=function(n){var i=r.cache,o=""+(t?t.apply(this,arguments):n);return bt(i,o)||(i[o]=e.apply(this,arguments)),i[o]};return r.cache={},r}var iy=ce(()=>{vn()});var ya,vd=ce(()=>{Jt();ya=je(function(e,t,r){return setTimeout(function(){return e.apply(null,r)},t)})});var wd,oy=ce(()=>{ma();vd();Yt();wd=bn(ya,De,1)});function Gu(e,t,r){var n,i,o,s,a=0;r||(r={});var u=function(){a=r.leading===!1?0:wn(),n=null,s=e.apply(i,o),n||(i=o=null)},c=function(){var f=wn();!a&&r.leading===!1&&(a=f);var h=t-(f-a);return i=this,o=arguments,h<=0||h>t?(n&&(clearTimeout(n),n=null),a=f,s=e.apply(i,o),n||(i=o=null)):!n&&r.trailing!==!1&&(n=setTimeout(u,h)),s};return c.cancel=function(){clearTimeout(n),a=0,n=i=o=null},c}var sy=ce(()=>{zu()});function Ku(e,t,r){var n,i,o,s,a,u=function(){var f=wn()-i;t>f?n=setTimeout(u,t-f):(n=null,r||(s=e.apply(a,o)),n||(o=a=null))},c=je(function(f){return a=this,o=f,i=wn(),n||(n=setTimeout(u,t),r&&(s=e.apply(a,o))),s});return c.cancel=function(){clearTimeout(n),n=o=a=null},c}var ay=ce(()=>{Jt();zu()});function $u(e,t){return bn(t,e)}var ly=ce(()=>{ma()});function ti(e){return function(){return!e.apply(this,arguments)}}var Xu=ce(()=>{});function Zu(){var e=arguments,t=e.length-1;return function(){for(var r=t,n=e[t].apply(this,arguments);r--;)n=e[r].call(this,n);return n}}var uy=ce(()=>{});function Ju(e,t){return function(){if(--e<1)return t.apply(this,arguments)}}var cy=ce(()=>{});function Po(e,t){var r;return function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=null),r}}var bd=ce(()=>{});var _d,fy=ce(()=>{ma();bd();_d=bn(Po,2)});function zo(e,t,r){t=He(t,r);for(var n=Re(e),i,o=0,s=n.length;o{jt();ft()});function va(e){return function(t,r,n){r=He(r,n);for(var i=Ge(t),o=e>0?0:i-1;o>=0&&o{jt();hr()});var Ui,Yu=ce(()=>{Ed();Ui=va(1)});var wa,Ad=ce(()=>{Ed();wa=va(-1)});function Uo(e,t,r,n){r=He(r,n,1);for(var i=r(t),o=0,s=Ge(e);o{jt();hr()});function ba(e,t,r){return function(n,i,o){var s=0,a=Ge(n);if(typeof o=="number")e>0?s=o>=0?o:Math.max(o+a,s):a=o>=0?Math.min(o+1,a):o+a+1;else if(r&&o&&a)return o=r(n,i),n[o]===i?o:-1;if(i!==i)return o=t(Gr.call(n,s,a),ko),o>=0?o+s:-1;for(o=e>0?s:a-1;o>=0&&o{hr();Ye();Bh()});var _a,Cd=ce(()=>{Sd();Yu();Td();_a=ba(1,Ui,Uo)});var kd,hy=ce(()=>{Ad();Td();kd=ba(-1,wa)});function qi(e,t,r){var n=Ze(e)?Ui:zo,i=n(e,t,r);if(i!==void 0&&i!==-1)return e[i]}var Dd=ce(()=>{er();Yu();xd()});function Qu(e,t){return qi(e,Ir(t))}var dy=ce(()=>{Dd();fa()});function ht(e,t,r){t=Fr(t,r);var n,i;if(Ze(e))for(n=0,i=e.length;n{Bo();er();ft()});function Ht(e,t,r){t=He(t,r);for(var n=!Ze(e)&&Re(e),i=(n||e).length,o=Array(i),s=0;s{jt();er();ft()});function xa(e){var t=function(r,n,i,o){var s=!Ze(r)&&Re(r),a=(s||r).length,u=e>0?0:a-1;for(o||(i=r[s?s[u]:u],u+=e);u>=0&&u=3;return t(r,Fr(n,o,4),i,s)}}var Nd=ce(()=>{er();ft();Bo()});var Ea,py=ce(()=>{Nd();Ea=xa(1)});var ec,my=ce(()=>{Nd();ec=xa(-1)});function pr(e,t,r){var n=[];return t=He(t,r),ht(e,function(i,o,s){t(i,o,s)&&n.push(i)}),n}var qo=ce(()=>{jt();ri()});function tc(e,t,r){return pr(e,ti(He(t)),r)}var gy=ce(()=>{qo();Xu();jt()});function Aa(e,t,r){t=He(t,r);for(var n=!Ze(e)&&Re(e),i=(n||e).length,o=0;o{jt();er();ft()});function Sa(e,t,r){t=He(t,r);for(var n=!Ze(e)&&Re(e),i=(n||e).length,o=0;o{jt();er();ft()});function Ot(e,t,r,n){return Ze(e)||(e=Qt(e)),(typeof r!="number"||n)&&(r=0),_a(e,t,r)>=0}var jo=ce(()=>{er();Ii();Cd()});var Od,wy=ce(()=>{Jt();fr();ji();Ru();Fo();Od=je(function(e,t,r){var n,i;return Ve(t)?i=t:(t=Rr(t),n=t.slice(0,-1),t=t[t.length-1]),Ht(e,function(o){var s=i;if(!s){if(n&&n.length&&(o=Bi(o,n)),o==null)return;s=o[t]}return s==null?s:s.apply(o,r)})})});function ni(e,t){return Ht(e,ei(t))}var rc=ce(()=>{ji();Mu()});function nc(e,t){return pr(e,Ir(t))}var by=ce(()=>{qo();fa()});function Ho(e,t,r){var n=-1/0,i=-1/0,o,s;if(t==null||typeof t=="number"&&typeof e[0]!="object"&&e!=null){e=Ze(e)?e:Qt(e);for(var a=0,u=e.length;an&&(n=o)}else t=He(t,r),ht(e,function(c,f,h){s=t(c,f,h),(s>i||s===-1/0&&n===-1/0)&&(n=c,i=s)});return n}var Rd=ce(()=>{er();Ii();jt();ri()});function ic(e,t,r){var n=1/0,i=1/0,o,s;if(t==null||typeof t=="number"&&typeof e[0]!="object"&&e!=null){e=Ze(e)?e:Qt(e);for(var a=0,u=e.length;a{er();Ii();jt();ri()});function Wo(e){return e?qt(e)?Gr.call(e):Ni(e)?e.match(z3):Ze(e)?Ht(e,Qn):Qt(e):[]}var z3,Id=ce(()=>{Jn();Ye();gu();er();ji();Fu();Ii();z3=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g});function Vo(e,t,r){if(t==null||r)return Ze(e)||(e=Qt(e)),e[Pi(e.length-1)];var n=Wo(e),i=Ge(n);t=Math.max(Math.min(t,i),0);for(var o=i-1,s=0;s{er();Ii();hr();sd();Id()});function oc(e){return Vo(e,1/0)}var xy=ce(()=>{Fd()});function sc(e,t,r){var n=0;return t=He(t,r),ni(Ht(e,function(i,o,s){return{value:i,index:n++,criteria:t(i,o,s)}}).sort(function(i,o){var s=i.criteria,a=o.criteria;if(s!==a){if(s>a||s===void 0)return 1;if(s{jt();rc();ji()});function _n(e,t){return function(r,n,i){var o=t?[[],[]]:{};return n=He(n,i),ht(r,function(s,a){var u=n(s,a,r);e(o,s,u)}),o}}var Ta=ce(()=>{jt();ri()});var Md,Ay=ce(()=>{Ta();vn();Md=_n(function(e,t,r){bt(e,r)?e[r].push(t):e[r]=[t]})});var Bd,Sy=ce(()=>{Ta();Bd=_n(function(e,t,r){e[r]=t})});var Ld,Ty=ce(()=>{Ta();vn();Ld=_n(function(e,t,r){bt(e,r)?e[r]++:e[r]=1})});var Pd,Cy=ce(()=>{Ta();Pd=_n(function(e,t,r){e[r?0:1].push(t)},!0)});function ac(e){return e==null?0:Ze(e)?e.length:Re(e).length}var ky=ce(()=>{er();ft()});function zd(e,t,r){return t in r}var Dy=ce(()=>{});var Ca,Ud=ce(()=>{Jt();fr();Bo();Oo();Dy();zi();Ca=je(function(e,t){var r={},n=t[0];if(e==null)return r;Ve(n)?(t.length>1&&(n=Fr(n,t[1])),t=wr(e)):(n=zd,t=dr(t,!1,!1),e=Object(e));for(var i=0,o=t.length;i{Jt();fr();Xu();ji();zi();jo();Ud();qd=je(function(e,t){var r=t[0],n;return Ve(r)?(r=ti(r),t.length>1&&(n=t[1])):(t=Ht(dr(t,!1,!1),String),r=function(i,o){return!Ot(t,o)}),Ca(e,r,n)})});function Go(e,t,r){return Gr.call(e,0,Math.max(0,e.length-(t==null||r?1:t)))}var jd=ce(()=>{Ye()});function Ko(e,t,r){return e==null||e.length<1?t==null||r?void 0:[]:t==null||r?e[0]:Go(e,e.length-t)}var Oy=ce(()=>{jd()});function ii(e,t,r){return Gr.call(e,t==null||r?1:t)}var Hd=ce(()=>{Ye()});function lc(e,t,r){return e==null||e.length<1?t==null||r?void 0:[]:t==null||r?e[e.length-1]:ii(e,Math.max(0,e.length-t))}var Ry=ce(()=>{Hd()});function uc(e){return pr(e,Boolean)}var Iy=ce(()=>{qo()});function cc(e,t){return dr(e,t,!1)}var Fy=ce(()=>{zi()});var ka,Wd=ce(()=>{Jt();zi();qo();jo();ka=je(function(e,t){return t=dr(t,!0,!0),pr(e,function(r){return!Ot(t,r)})})});var Vd,My=ce(()=>{Jt();Wd();Vd=je(function(e,t){return ka(e,t)})});function Hi(e,t,r,n){So(t)||(n=r,r=t,t=!1),r!=null&&(r=He(r,n));for(var i=[],o=[],s=0,a=Ge(e);s{Ch();jt();hr();jo()});var Kd,By=ce(()=>{Jt();Gd();zi();Kd=je(function(e){return Hi(dr(e,!0,!0))})});function fc(e){for(var t=[],r=arguments.length,n=0,i=Ge(e);n{hr();jo()});function Wi(e){for(var t=e&&Ho(e,Ge).length||0,r=Array(t),n=0;n{Rd();hr();rc()});var Xd,Py=ce(()=>{Jt();$d();Xd=je(Wi)});function hc(e,t){for(var r={},n=0,i=Ge(e);n{hr()});function dc(e,t,r){t==null&&(t=e||0,e=0),r||(r=t{});function pc(e,t){if(t==null||t<1)return[];for(var r=[],n=0,i=e.length;n{Ye()});function $o(e,t){return e._chain?De(t).chain():t}var Zd=ce(()=>{Yt()});function Xo(e){return ht(Fi(e),function(t){var r=De[t]=e[t];De.prototype[t]=function(){var n=[this._wrapped];return h1.apply(n,arguments),$o(this,r.apply(De,n))}}),De}var jy=ce(()=>{Yt();ri();Jh();Ye();Zd()});var Hy,Wy=ce(()=>{Yt();ri();Ye();Zd();ht(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=Qs[e];De.prototype[e]=function(){var r=this._wrapped;return r!=null&&(t.apply(r,arguments),(e==="shift"||e==="splice")&&r.length===0&&delete r[0]),$o(this,r)}});ht(["concat","join","slice"],function(e){var t=Qs[e];De.prototype[e]=function(){var r=this._wrapped;return r!=null&&(r=t.apply(r,arguments)),$o(this,r)}});Hy=De});var Jd={};Ut(Jd,{VERSION:()=>Ys,after:()=>Ju,all:()=>Aa,allKeys:()=>wr,any:()=>Sa,assign:()=>Yn,before:()=>Po,bind:()=>ga,bindAll:()=>yd,chain:()=>Wu,chunk:()=>pc,clone:()=>Nu,collect:()=>Ht,compact:()=>uc,compose:()=>Zu,constant:()=>Do,contains:()=>Ot,countBy:()=>Ld,create:()=>Du,debounce:()=>Ku,default:()=>Hy,defaults:()=>la,defer:()=>wd,delay:()=>ya,detect:()=>qi,difference:()=>ka,drop:()=>ii,each:()=>ht,escape:()=>ud,every:()=>Aa,extend:()=>aa,extendOwn:()=>Yn,filter:()=>pr,find:()=>qi,findIndex:()=>Ui,findKey:()=>zo,findLastIndex:()=>wa,findWhere:()=>Qu,first:()=>Ko,flatten:()=>cc,foldl:()=>Ea,foldr:()=>ec,forEach:()=>ht,functions:()=>Fi,get:()=>Mo,groupBy:()=>Md,has:()=>Iu,head:()=>Ko,identity:()=>Qn,include:()=>Ot,includes:()=>Ot,indexBy:()=>Bd,indexOf:()=>_a,initial:()=>Go,inject:()=>Ea,intersection:()=>fc,invert:()=>Io,invoke:()=>Od,isArguments:()=>Oi,isArray:()=>qt,isArrayBuffer:()=>ra,isBoolean:()=>So,isDataView:()=>Zn,isDate:()=>Dh,isElement:()=>mu,isEmpty:()=>xu,isEqual:()=>Au,isError:()=>Oh,isFinite:()=>bu,isFunction:()=>Ve,isMap:()=>Gh,isMatch:()=>No,isNaN:()=>ko,isNull:()=>pu,isNumber:()=>ea,isObject:()=>Nt,isRegExp:()=>Nh,isSet:()=>$h,isString:()=>Ni,isSymbol:()=>ta,isTypedArray:()=>oa,isUndefined:()=>Ao,isWeakMap:()=>Kh,isWeakSet:()=>Xh,iteratee:()=>Li,keys:()=>Re,last:()=>lc,lastIndexOf:()=>kd,map:()=>Ht,mapObject:()=>Bu,matcher:()=>Ir,matches:()=>Ir,max:()=>Ho,memoize:()=>Vu,methods:()=>Fi,min:()=>ic,mixin:()=>Xo,negate:()=>ti,noop:()=>Lo,now:()=>wn,object:()=>hc,omit:()=>qd,once:()=>_d,pairs:()=>Tu,partial:()=>bn,partition:()=>Pd,pick:()=>Ca,pluck:()=>ni,property:()=>ei,propertyOf:()=>Lu,random:()=>Pi,range:()=>dc,reduce:()=>Ea,reduceRight:()=>ec,reject:()=>tc,rest:()=>ii,restArguments:()=>je,result:()=>ju,sample:()=>Vo,select:()=>pr,shuffle:()=>oc,size:()=>ac,some:()=>Sa,sortBy:()=>sc,sortedIndex:()=>Uo,tail:()=>ii,take:()=>Ko,tap:()=>Ou,template:()=>qu,templateSettings:()=>fd,throttle:()=>Gu,times:()=>Pu,toArray:()=>Wo,toPath:()=>ca,transpose:()=>Wi,unescape:()=>cd,union:()=>Kd,uniq:()=>Hi,unique:()=>Hi,uniqueId:()=>Hu,unzip:()=>Wi,values:()=>Qt,where:()=>nc,without:()=>Vd,wrap:()=>$u,zip:()=>Xd});var mc=ce(()=>{Ye();Jt();Xn();w1();Th();Ch();b1();gu();kh();_1();x1();E1();Rh();Ih();vu();Jn();fr();wu();T1();Bh();Uh();D1();jh();R1();L1();P1();z1();U1();ft();Oo();Ii();q1();Zh();Jh();Yh();ku();Qh();j1();H1();W1();rd();V1();G1();Fu();Lh();od();td();Mu();K1();fa();$1();sd();zu();X1();Y1();hd();Q1();ey();ty();ry();id();ma();gd();ny();iy();vd();oy();sy();ay();ly();Xu();uy();cy();bd();fy();xd();Yu();Ad();Sd();Cd();hy();Dd();dy();ri();ji();py();my();qo();gy();yy();vy();jo();wy();rc();by();Rd();_y();xy();Fd();Ey();Ay();Sy();Ty();Cy();Id();ky();Ud();Ny();Oy();jd();Ry();Hd();Iy();Fy();My();Gd();By();Ly();Wd();$d();Py();zy();Uy();qy();jy();Wy()});var Yd,Vy,Gy=ce(()=>{mc();mc();Yd=Xo(Jd);Yd._=Yd;Vy=Yd});var tt={};Ut(tt,{VERSION:()=>Ys,after:()=>Ju,all:()=>Aa,allKeys:()=>wr,any:()=>Sa,assign:()=>Yn,before:()=>Po,bind:()=>ga,bindAll:()=>yd,chain:()=>Wu,chunk:()=>pc,clone:()=>Nu,collect:()=>Ht,compact:()=>uc,compose:()=>Zu,constant:()=>Do,contains:()=>Ot,countBy:()=>Ld,create:()=>Du,debounce:()=>Ku,default:()=>Vy,defaults:()=>la,defer:()=>wd,delay:()=>ya,detect:()=>qi,difference:()=>ka,drop:()=>ii,each:()=>ht,escape:()=>ud,every:()=>Aa,extend:()=>aa,extendOwn:()=>Yn,filter:()=>pr,find:()=>qi,findIndex:()=>Ui,findKey:()=>zo,findLastIndex:()=>wa,findWhere:()=>Qu,first:()=>Ko,flatten:()=>cc,foldl:()=>Ea,foldr:()=>ec,forEach:()=>ht,functions:()=>Fi,get:()=>Mo,groupBy:()=>Md,has:()=>Iu,head:()=>Ko,identity:()=>Qn,include:()=>Ot,includes:()=>Ot,indexBy:()=>Bd,indexOf:()=>_a,initial:()=>Go,inject:()=>Ea,intersection:()=>fc,invert:()=>Io,invoke:()=>Od,isArguments:()=>Oi,isArray:()=>qt,isArrayBuffer:()=>ra,isBoolean:()=>So,isDataView:()=>Zn,isDate:()=>Dh,isElement:()=>mu,isEmpty:()=>xu,isEqual:()=>Au,isError:()=>Oh,isFinite:()=>bu,isFunction:()=>Ve,isMap:()=>Gh,isMatch:()=>No,isNaN:()=>ko,isNull:()=>pu,isNumber:()=>ea,isObject:()=>Nt,isRegExp:()=>Nh,isSet:()=>$h,isString:()=>Ni,isSymbol:()=>ta,isTypedArray:()=>oa,isUndefined:()=>Ao,isWeakMap:()=>Kh,isWeakSet:()=>Xh,iteratee:()=>Li,keys:()=>Re,last:()=>lc,lastIndexOf:()=>kd,map:()=>Ht,mapObject:()=>Bu,matcher:()=>Ir,matches:()=>Ir,max:()=>Ho,memoize:()=>Vu,methods:()=>Fi,min:()=>ic,mixin:()=>Xo,negate:()=>ti,noop:()=>Lo,now:()=>wn,object:()=>hc,omit:()=>qd,once:()=>_d,pairs:()=>Tu,partial:()=>bn,partition:()=>Pd,pick:()=>Ca,pluck:()=>ni,property:()=>ei,propertyOf:()=>Lu,random:()=>Pi,range:()=>dc,reduce:()=>Ea,reduceRight:()=>ec,reject:()=>tc,rest:()=>ii,restArguments:()=>je,result:()=>ju,sample:()=>Vo,select:()=>pr,shuffle:()=>oc,size:()=>ac,some:()=>Sa,sortBy:()=>sc,sortedIndex:()=>Uo,tail:()=>ii,take:()=>Ko,tap:()=>Ou,template:()=>qu,templateSettings:()=>fd,throttle:()=>Gu,times:()=>Pu,toArray:()=>Wo,toPath:()=>ca,transpose:()=>Wi,unescape:()=>cd,union:()=>Kd,uniq:()=>Hi,unique:()=>Hi,uniqueId:()=>Hu,unzip:()=>Wi,values:()=>Qt,where:()=>nc,without:()=>Vd,wrap:()=>$u,zip:()=>Xd});var rt=ce(()=>{Gy();mc()});var Vi=pe((hZ,tp)=>{var Qd=(function(){"use strict";return this===void 0})();Qd?tp.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:Qd,propertyIsWritable:function(e,t){var r=Object.getOwnPropertyDescriptor(e,t);return!!(!r||r.writable||r.set)}}:(Ky={}.hasOwnProperty,$y={}.toString,Xy={}.constructor.prototype,ep=function(e){var t=[];for(var r in e)Ky.call(e,r)&&t.push(r);return t},Zy=function(e,t){return{value:e[t]}},Jy=function(e,t,r){return e[t]=r.value,e},Yy=function(e){return e},Qy=function(e){try{return Object(e).constructor.prototype}catch{return Xy}},ev=function(e){try{return $y.call(e)==="[object Array]"}catch{return!1}},tp.exports={isArray:ev,keys:ep,names:ep,defineProperty:Jy,getDescriptor:Zy,freeze:Yy,getPrototypeOf:Qy,isES5:Qd,propertyIsWritable:function(){return!0}});var Ky,$y,Xy,ep,Zy,Jy,Yy,Qy,ev});var $e=pe((exports,module)=>{"use strict";var es5=Vi(),canEvaluate=typeof navigator>"u",errorObj={e:{}},tryCatchTarget,globalObject=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:exports!==void 0?exports:null;function tryCatcher(){try{var e=tryCatchTarget;return tryCatchTarget=null,e.apply(this,arguments)}catch(t){return errorObj.e=t,errorObj}}function tryCatch(e){return tryCatchTarget=e,tryCatcher}var inherits=function(e,t){var r={}.hasOwnProperty;function n(){this.constructor=e,this.constructor$=t;for(var i in t.prototype)r.call(t.prototype,i)&&i.charAt(i.length-1)!=="$"&&(this[i+"$"]=t.prototype[i])}return n.prototype=t.prototype,e.prototype=new n,e.prototype};function isPrimitive(e){return e==null||e===!0||e===!1||typeof e=="string"||typeof e=="number"}function isObject(e){return typeof e=="function"||typeof e=="object"&&e!==null}function maybeWrapAsError(e){return isPrimitive(e)?new Error(safeToString(e)):e}function withAppended(e,t){var r=e.length,n=new Array(r+1),i;for(i=0;i1,n=t.length>0&&!(t.length===1&&t[0]==="constructor"),i=thisAssignmentPattern.test(e+"")&&es5.names(e).length>0;if(r||n||i)return!0}return!1}catch{return!1}}function toFastProperties(obj){function FakeConstructor(){}FakeConstructor.prototype=obj;for(var l=8;l--;)new FakeConstructor;return obj}var rident=/^[a-z$_][a-z$_0-9]*$/i;function isIdentifier(e){return rident.test(e)}function filledRange(e,t,r){for(var n=new Array(e),i=0;i10||e[0]>0})();ret.isNode&&ret.toFastProperties(process);try{throw new Error}catch(e){ret.lastLineError=e}module.exports=ret});var ov=pe((dZ,iv)=>{"use strict";var np=$e(),Gi,U3=function(){throw new Error(`No async scheduler available + + See http://goo.gl/MqrFmX +`)},rp=np.getNativePromise();np.isNode&&typeof MutationObserver>"u"?(tv=global.setImmediate,rv=process.nextTick,Gi=np.isRecentNode?function(e){tv.call(global,e)}:function(e){rv.call(process,e)}):typeof rp=="function"&&typeof rp.resolve=="function"?(nv=rp.resolve(),Gi=function(e){nv.then(e)}):typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova))?Gi=(function(){var e=document.createElement("div"),t={attributes:!0},r=!1,n=document.createElement("div"),i=new MutationObserver(function(){e.classList.toggle("foo"),r=!1});i.observe(n,t);var o=function(){r||(r=!0,n.classList.toggle("foo"))};return function(a){var u=new MutationObserver(function(){u.disconnect(),a()});u.observe(e,t),o()}})():typeof setImmediate<"u"?Gi=function(e){setImmediate(e)}:typeof setTimeout<"u"?Gi=function(e){setTimeout(e,0)}:Gi=U3;var tv,rv,nv;iv.exports=Gi});var av=pe((pZ,sv)=>{"use strict";function q3(e,t,r,n,i){for(var o=0;o{"use strict";var hv;try{throw new Error}catch(e){hv=e}var j3=ov(),lv=av(),dv=$e();function dt(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new lv(16),this._normalQueue=new lv(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var e=this;this.drainQueues=function(){e._drainQueues()},this._schedule=j3}dt.prototype.setScheduler=function(e){var t=this._schedule;return this._schedule=e,this._customScheduler=!0,t};dt.prototype.hasCustomScheduler=function(){return this._customScheduler};dt.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};dt.prototype.disableTrampolineIfNecessary=function(){dv.hasDevTools&&(this._trampolineEnabled=!1)};dt.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};dt.prototype.fatalError=function(e,t){t?(process.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+` +`),process.exit(2)):this.throwLater(e)};dt.prototype.throwLater=function(e,t){if(arguments.length===1&&(t=e,e=function(){throw t}),typeof setTimeout<"u")setTimeout(function(){e(t)},0);else try{this._schedule(function(){e(t)})}catch{throw new Error(`No async scheduler available + + See http://goo.gl/MqrFmX +`)}};function uv(e,t,r){this._lateQueue.push(e,t,r),this._queueTick()}function cv(e,t,r){this._normalQueue.push(e,t,r),this._queueTick()}function fv(e){this._normalQueue._pushOne(e),this._queueTick()}dv.hasDevTools?(dt.prototype.invokeLater=function(e,t,r){this._trampolineEnabled?uv.call(this,e,t,r):this._schedule(function(){setTimeout(function(){e.call(t,r)},100)})},dt.prototype.invoke=function(e,t,r){this._trampolineEnabled?cv.call(this,e,t,r):this._schedule(function(){e.call(t,r)})},dt.prototype.settlePromises=function(e){this._trampolineEnabled?fv.call(this,e):this._schedule(function(){e._settlePromises()})}):(dt.prototype.invokeLater=uv,dt.prototype.invoke=cv,dt.prototype.settlePromises=fv);dt.prototype._drainQueue=function(e){for(;e.length()>0;){var t=e.shift();if(typeof t!="function"){t._settlePromises();continue}var r=e.shift(),n=e.shift();t.call(r,n)}};dt.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};dt.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))};dt.prototype._reset=function(){this._isTickUsed=!1};ip.exports=dt;ip.exports.firstLineError=hv});var xn=pe((gZ,yv)=>{"use strict";var ap=Vi(),H3=ap.freeze,mv=$e(),gv=mv.inherits,Jo=mv.notEnumerableProp;function Yo(e,t){function r(n){if(!(this instanceof r))return new r(n);Jo(this,"message",typeof n=="string"?n:t),Jo(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return gv(r,Error),r}var op,sp,W3=Yo("Warning","warning"),V3=Yo("CancellationError","cancellation error"),G3=Yo("TimeoutError","timeout error"),Na=Yo("AggregateError","aggregate error");try{op=TypeError,sp=RangeError}catch{op=Yo("TypeError","type error"),sp=Yo("RangeError","range error")}var gc="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(Zo=0;Zo{"use strict";vv.exports=function(e,t){var r=$e(),n=r.errorObj,i=r.isObject;function o(h,p){if(i(h)){if(h instanceof e)return h;var d=a(h);if(d===n){p&&p._pushContext();var m=e.reject(d.e);return p&&p._popContext(),m}else if(typeof d=="function"){if(c(h)){var m=new e(t);return h._then(m._fulfill,m._reject,void 0,m,null),m}return f(h,d,p)}}return h}function s(h){return h.then}function a(h){try{return s(h)}catch(p){return n.e=p,n}}var u={}.hasOwnProperty;function c(h){try{return u.call(h,"_promise0")}catch{return!1}}function f(h,p,d){var m=new e(t),g=m;d&&d._pushContext(),m._captureStackTrace(),d&&d._popContext();var y=!0,w=r.tryCatch(p).call(h,E,b);y=!1,m&&w===n&&(m._rejectCallback(w.e,!0,!0),m=null);function E(C){m&&(m._resolveCallback(C),m=null)}function b(C){m&&(m._rejectCallback(C,y,!0),m=null)}return g}return o}});var _v=pe((vZ,bv)=>{"use strict";bv.exports=function(e,t,r,n,i){var o=$e(),s=o.isArray;function a(c){switch(c){case-2:return[];case-3:return{}}}function u(c){var f=this._promise=new e(t);c instanceof e&&f._propagateFrom(c,3),f._setOnCancel(this),this._values=c,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return o.inherits(u,i),u.prototype.length=function(){return this._length},u.prototype.promise=function(){return this._promise},u.prototype._init=function c(f,h){var p=r(this._values,this._promise);if(p instanceof e){p=p._target();var d=p._bitField;if(this._values=p,(d&50397184)===0)return this._promise._setAsyncGuaranteed(),p._then(c,this._reject,void 0,this,h);if((d&33554432)!==0)p=p._value();else return(d&16777216)!==0?this._reject(p._reason()):this._cancel()}if(p=o.asArray(p),p===null){var m=n("expecting an array or an iterable object but got "+o.classString(p)).reason();this._promise._rejectCallback(m,!1);return}if(p.length===0){h===-5?this._resolveEmptyArray():this._resolve(a(h));return}this._iterate(p)},u.prototype._iterate=function(c){var f=this.getActualLength(c.length);this._length=f,this._values=this.shouldCopyValues()?new Array(f):this._values;for(var h=this._promise,p=!1,d=null,m=0;m=this._length?(this._resolve(this._values),!0):!1},u.prototype._promiseCancelled=function(){return this._cancel(),!0},u.prototype._promiseRejected=function(c){return this._totalResolved++,this._reject(c),!0},u.prototype._resultCancelled=function(){if(!this._isResolved()){var c=this._values;if(this._cancel(),c instanceof e)c.cancel();else for(var f=0;f{"use strict";xv.exports=function(e){var t=!1,r=[];e.prototype._promiseCreated=function(){},e.prototype._pushContext=function(){},e.prototype._popContext=function(){return null},e._peekContext=e.prototype._peekContext=function(){};function n(){this._trace=new n.CapturedTrace(o())}n.prototype._pushContext=function(){this._trace!==void 0&&(this._trace._promiseCreated=null,r.push(this._trace))},n.prototype._popContext=function(){if(this._trace!==void 0){var s=r.pop(),a=s._promiseCreated;return s._promiseCreated=null,a}return null};function i(){if(t)return new n}function o(){var s=r.length-1;if(s>=0)return r[s]}return n.CapturedTrace=null,n.create=i,n.deactivateLongStackTraces=function(){},n.activateLongStackTraces=function(){var s=e.prototype._pushContext,a=e.prototype._popContext,u=e._peekContext,c=e.prototype._peekContext,f=e.prototype._promiseCreated;n.deactivateLongStackTraces=function(){e.prototype._pushContext=s,e.prototype._popContext=a,e._peekContext=u,e.prototype._peekContext=c,e.prototype._promiseCreated=f,t=!1},t=!0,e.prototype._pushContext=n.prototype._pushContext,e.prototype._popContext=n.prototype._popContext,e._peekContext=e.prototype._peekContext=o,e.prototype._promiseCreated=function(){var h=this._peekContext();h&&h._promiseCreated==null&&(h._promiseCreated=this)}},n}});var Sv=pe((bZ,Av)=>{"use strict";Av.exports=function(e,t){var r=e._getDomain,n=e._async,i=xn().Warning,o=$e(),s=o.canAttachTrace,a,u,c=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,f=/\((?:timers\.js):\d+:\d+\)/,h=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,p=null,d=null,m=!1,g,y=!!(o.env("BLUEBIRD_DEBUG")!=0&&(o.env("BLUEBIRD_DEBUG")||o.env("NODE_ENV")==="development")),w=!!(o.env("BLUEBIRD_WARNINGS")!=0&&(y||o.env("BLUEBIRD_WARNINGS"))),E=!!(o.env("BLUEBIRD_LONG_STACK_TRACES")!=0&&(y||o.env("BLUEBIRD_LONG_STACK_TRACES"))),b=o.env("BLUEBIRD_W_FORGOTTEN_RETURN")!=0&&(w||!!o.env("BLUEBIRD_W_FORGOTTEN_RETURN"));e.prototype.suppressUnhandledRejections=function(){var K=this._target();K._bitField=K._bitField&-1048577|524288},e.prototype._ensurePossibleRejectionHandled=function(){(this._bitField&524288)===0&&(this._setRejectionIsUnhandled(),n.invokeLater(this._notifyUnhandledRejection,this,void 0))},e.prototype._notifyUnhandledRejectionIsHandled=function(){D("rejectionHandled",a,void 0,this)},e.prototype._setReturnedNonUndefined=function(){this._bitField=this._bitField|268435456},e.prototype._returnedNonUndefined=function(){return(this._bitField&268435456)!==0},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var K=this._settledValue();this._setUnhandledRejectionIsNotified(),D("unhandledRejection",u,K,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=this._bitField|262144},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=this._bitField&-262145},e.prototype._isUnhandledRejectionNotified=function(){return(this._bitField&262144)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=this._bitField|1048576},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=this._bitField&-1048577,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(this._bitField&1048576)>0},e.prototype._warn=function(K,te,ie){return oe(K,te,ie||this)},e.onPossiblyUnhandledRejection=function(K){var te=r();u=typeof K=="function"?te===null?K:o.domainBind(te,K):void 0},e.onUnhandledRejectionHandled=function(K){var te=r();a=typeof K=="function"?te===null?K:o.domainBind(te,K):void 0};var C=function(){};e.longStackTraces=function(){if(n.haveItemsQueued()&&!Z.longStackTraces)throw new Error(`cannot enable long stack traces after promises have been created + + See http://goo.gl/MqrFmX +`);if(!Z.longStackTraces&&I()){var K=e.prototype._captureStackTrace,te=e.prototype._attachExtraTrace;Z.longStackTraces=!0,C=function(){if(n.haveItemsQueued()&&!Z.longStackTraces)throw new Error(`cannot enable long stack traces after promises have been created + + See http://goo.gl/MqrFmX +`);e.prototype._captureStackTrace=K,e.prototype._attachExtraTrace=te,t.deactivateLongStackTraces(),n.enableTrampoline(),Z.longStackTraces=!1},e.prototype._captureStackTrace=G,e.prototype._attachExtraTrace=X,t.activateLongStackTraces(),n.disableTrampolineIfNecessary()}},e.hasLongStackTraces=function(){return Z.longStackTraces&&I()};var S=(function(){try{if(typeof CustomEvent=="function"){var K=new CustomEvent("CustomEvent");return o.global.dispatchEvent(K),function(te,ie){var se=new CustomEvent(te.toLowerCase(),{detail:ie,cancelable:!0});return!o.global.dispatchEvent(se)}}else if(typeof Event=="function"){var K=new Event("CustomEvent");return o.global.dispatchEvent(K),function(ie,se){var de=new Event(ie.toLowerCase(),{cancelable:!0});return de.detail=se,!o.global.dispatchEvent(de)}}else{var K=document.createEvent("CustomEvent");return K.initCustomEvent("testingtheevent",!1,!0,{}),o.global.dispatchEvent(K),function(ie,se){var de=document.createEvent("CustomEvent");return de.initCustomEvent(ie.toLowerCase(),!1,!0,se),!o.global.dispatchEvent(de)}}}catch{}return function(){return!1}})(),A=(function(){return o.isNode?function(){return process.emit.apply(process,arguments)}:o.global?function(K){var te="on"+K.toLowerCase(),ie=o.global[te];return ie?(ie.apply(o.global,[].slice.call(arguments,1)),!0):!1}:function(){return!1}})();function k(K,te){return{promise:te}}var B={promiseCreated:k,promiseFulfilled:k,promiseRejected:k,promiseResolved:k,promiseCancelled:k,promiseChained:function(K,te,ie){return{promise:te,child:ie}},warning:function(K,te){return{warning:te}},unhandledRejection:function(K,te,ie){return{reason:te,promise:ie}},rejectionHandled:k},O=function(K){var te=!1;try{te=A.apply(null,arguments)}catch(se){n.throwLater(se),te=!0}var ie=!1;try{ie=S(K,B[K].apply(null,arguments))}catch(se){n.throwLater(se),ie=!0}return ie||te};e.config=function(K){if(K=Object(K),"longStackTraces"in K&&(K.longStackTraces?e.longStackTraces():!K.longStackTraces&&e.hasLongStackTraces()&&C()),"warnings"in K){var te=K.warnings;Z.warnings=!!te,b=Z.warnings,o.isObject(te)&&"wForgottenReturn"in te&&(b=!!te.wForgottenReturn)}if("cancellation"in K&&K.cancellation&&!Z.cancellation){if(n.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");e.prototype._clearCancellationData=J,e.prototype._propagateFrom=j,e.prototype._onCancel=W,e.prototype._setOnCancel=F,e.prototype._attachCancellationCallback=_,e.prototype._execute=Y,$=j,Z.cancellation=!0}return"monitoring"in K&&(K.monitoring&&!Z.monitoring?(Z.monitoring=!0,e.prototype._fireEvent=O):!K.monitoring&&Z.monitoring&&(Z.monitoring=!1,e.prototype._fireEvent=P)),e};function P(){return!1}e.prototype._fireEvent=P,e.prototype._execute=function(K,te,ie){try{K(te,ie)}catch(se){return se}},e.prototype._onCancel=function(){},e.prototype._setOnCancel=function(K){},e.prototype._attachCancellationCallback=function(K){},e.prototype._captureStackTrace=function(){},e.prototype._attachExtraTrace=function(){},e.prototype._clearCancellationData=function(){},e.prototype._propagateFrom=function(K,te){};function Y(K,te,ie){var se=this;try{K(te,ie,function(de){if(typeof de!="function")throw new TypeError("onCancel must be a function, got: "+o.toString(de));se._attachCancellationCallback(de)})}catch(de){return de}}function _(K){if(!this._isCancellable())return this;var te=this._onCancel();te!==void 0?o.isArray(te)?te.push(K):this._setOnCancel([te,K]):this._setOnCancel(K)}function W(){return this._onCancelField}function F(K){this._onCancelField=K}function J(){this._cancellationParent=void 0,this._onCancelField=void 0}function j(K,te){if((te&1)!==0){this._cancellationParent=K;var ie=K._branchesRemainingToCancel;ie===void 0&&(ie=0),K._branchesRemainingToCancel=ie+1}(te&2)!==0&&K._isBound()&&this._setBoundTo(K._boundTo)}function H(K,te){(te&2)!==0&&K._isBound()&&this._setBoundTo(K._boundTo)}var $=H;function z(){var K=this._boundTo;return K!==void 0&&K instanceof e?K.isFulfilled()?K.value():void 0:K}function G(){this._trace=new U(this._peekContext())}function X(K,te){if(s(K)){var ie=this._trace;if(ie!==void 0&&te&&(ie=ie._parent),ie!==void 0)ie.attachExtraTrace(K);else if(!K.__stackCleaned__){var se=ne(K);o.notEnumerableProp(K,"stack",se.message+` +`+se.stack.join(` +`)),o.notEnumerableProp(K,"__stackCleaned__",!0)}}}function q(K,te,ie,se,de){if(K===void 0&&te!==null&&b){if(de!==void 0&&de._returnedNonUndefined()||(se._bitField&65535)===0)return;ie&&(ie=ie+" ");var xe="",Te="";if(te._trace){for(var Ae=te._trace.stack.split(` +`),Se=M(Ae),Pe=Se.length-1;Pe>=0;--Pe){var Ie=Se[Pe];if(!f.test(Ie)){var Qe=Ie.match(h);Qe&&(xe="at "+Qe[1]+":"+Qe[2]+":"+Qe[3]+" ");break}}if(Se.length>0){for(var $n=Se[0],Pe=0;Pe0&&(Te=` +`+Ae[Pe-1]);break}}}var cr="a promise was created in a "+ie+"handler "+xe+"but was not returned from it, see http://goo.gl/rRqMUw"+Te;se._warn(cr,!0,te)}}function Q(K,te){var ie=K+" is deprecated and will be removed in a future version.";return te&&(ie+=" Use "+te+" instead."),oe(ie)}function oe(K,te,ie){if(Z.warnings){var se=new i(K),de;if(te)ie._attachExtraTrace(se);else if(Z.longStackTraces&&(de=e._peekContext()))de.attachExtraTrace(se);else{var xe=ne(se);se.stack=xe.message+` +`+xe.stack.join(` +`)}O("warning",se)||fe(se,"",!0)}}function ae(K,te){for(var ie=0;ie=0;--Ae)if(se[Ae]===xe){Te=Ae;break}for(var Ae=Te;Ae>=0;--Ae){var Se=se[Ae];if(te[de]===Se)te.pop(),de--;else break}te=se}}function M(K){for(var te=[],ie=0;ie0&&K.name!="SyntaxError"&&(te=te.slice(ie)),te}function ne(K){var te=K.stack,ie=K.toString();return te=typeof te=="string"&&te.length>0?re(K):[" (No stack trace)"],{message:ie,stack:K.name=="SyntaxError"?te:M(te)}}function fe(K,te,ie){if(typeof console<"u"){var se;if(o.isObject(K)){var de=K.stack;se=te+d(de,K)}else se=te+String(K);typeof g=="function"?g(se,ie):(typeof console.log=="function"||typeof console.log=="object")&&console.log(se)}}function D(K,te,ie,se){var de=!1;try{typeof te=="function"&&(de=!0,K==="rejectionHandled"?te(se):te(ie,se))}catch(xe){n.throwLater(xe)}K==="unhandledRejection"?!O(K,ie,se)&&!de&&fe(ie,"Unhandled rejection "):O(K,se)}function V(K){var te;if(typeof K=="function")te="[function "+(K.name||"anonymous")+"]";else{te=K&&typeof K.toString=="function"?K.toString():o.toString(K);var ie=/\[object [a-zA-Z0-9$_]+\]/;if(ie.test(te))try{var se=JSON.stringify(K);te=se}catch{}te.length===0&&(te="(empty array)")}return"(<"+N(te)+">, no stack trace)"}function N(K){var te=41;return K.length=xe||(T=function(Ie){if(c.test(Ie))return!0;var Qe=x(Ie);return!!(Qe&&Qe.fileName===Te&&de<=Qe.line&&Qe.line<=xe)})}}function U(K){this._parent=K,this._promisesCreated=0;var te=this._length=1+(K===void 0?0:K._length);ee(this,U),te>32&&this.uncycle()}o.inherits(U,Error),t.CapturedTrace=U,U.prototype.uncycle=function(){var K=this._length;if(!(K<2)){for(var te=[],ie={},se=0,de=this;de!==void 0;++se)te.push(de),de=de._parent;K=this._length=se;for(var se=K-1;se>=0;--se){var xe=te[se].stack;ie[xe]===void 0&&(ie[xe]=se)}for(var se=0;se0&&(te[Ae-1]._parent=void 0,te[Ae-1]._length=1),te[se]._parent=void 0,te[se]._length=1;var Se=se>0?te[se-1]:this;Ae=0;--Ie)te[Ie]._length=Pe,Pe++;return}}}},U.prototype.attachExtraTrace=function(K){if(!K.__stackCleaned__){this.uncycle();for(var te=ne(K),ie=te.message,se=[te.stack],de=this;de!==void 0;)se.push(M(de.stack.split(` +`))),de=de._parent;L(se),he(se),o.notEnumerableProp(K,"stack",ae(ie,se)),o.notEnumerableProp(K,"__stackCleaned__",!0)}};var ee=(function(){var te=/^\s*at\s*/,ie=function(Te,Ae){return typeof Te=="string"?Te:Ae.name!==void 0&&Ae.message!==void 0?Ae.toString():V(Ae)};if(typeof Error.stackTraceLimit=="number"&&typeof Error.captureStackTrace=="function"){Error.stackTraceLimit+=6,p=te,d=ie;var se=Error.captureStackTrace;return T=function(Te){return c.test(Te)},function(Te,Ae){Error.stackTraceLimit+=6,se(Te,Ae),Error.stackTraceLimit-=6}}var de=new Error;if(typeof de.stack=="string"&&de.stack.split(` +`)[0].indexOf("stackDetection@")>=0)return p=/@/,d=ie,m=!0,function(Ae){Ae.stack=new Error().stack};var xe;try{throw new Error}catch(Te){xe="stack"in Te}return!("stack"in de)&&xe&&typeof Error.stackTraceLimit=="number"?(p=te,d=ie,function(Ae){Error.stackTraceLimit+=6;try{throw new Error}catch(Se){Ae.stack=Se.stack}Error.stackTraceLimit-=6}):(d=function(Te,Ae){return typeof Te=="string"?Te:(typeof Ae=="object"||typeof Ae=="function")&&Ae.name!==void 0&&Ae.message!==void 0?Ae.toString():V(Ae)},null)})([]);typeof console<"u"&&typeof console.warn<"u"&&(g=function(K){console.warn(K)},o.isNode&&process.stderr.isTTY?g=function(K,te){var ie=te?"\x1B[33m":"\x1B[31m";console.warn(ie+K+`\x1B[0m +`)}:!o.isNode&&typeof new Error().stack=="string"&&(g=function(K,te){console.warn("%c"+K,te?"color: darkorange":"color: red")}));var Z={warnings:w,longStackTraces:!1,cancellation:!1,monitoring:!1};return E&&e.longStackTraces(),{longStackTraces:function(){return Z.longStackTraces},warnings:function(){return Z.warnings},cancellation:function(){return Z.cancellation},monitoring:function(){return Z.monitoring},propagateFromFunction:function(){return $},boundValueFunction:function(){return z},checkForgottenReturns:q,setBounds:R,warn:oe,deprecated:Q,CapturedTrace:U,fireDomEvent:S,fireGlobalEvent:A}}});var Cv=pe((_Z,Tv)=>{"use strict";Tv.exports=function(e,t){var r=$e(),n=e.CancellationError,i=r.errorObj;function o(h,p,d){this.promise=h,this.type=p,this.handler=d,this.called=!1,this.cancelPromise=null}o.prototype.isFinallyHandler=function(){return this.type===0};function s(h){this.finallyHandler=h}s.prototype._resultCancelled=function(){a(this.finallyHandler)};function a(h,p){return h.cancelPromise!=null?(arguments.length>1?h.cancelPromise._reject(p):h.cancelPromise._cancel(),h.cancelPromise=null,!0):!1}function u(){return f.call(this,this.promise._target()._settledValue())}function c(h){if(!a(this,h))return i.e=h,i}function f(h){var p=this.promise,d=this.handler;if(!this.called){this.called=!0;var m=this.isFinallyHandler()?d.call(p._boundValue()):d.call(p._boundValue(),h);if(m!==void 0){p._setReturnedNonUndefined();var g=t(m,p);if(g instanceof e){if(this.cancelPromise!=null)if(g._isCancelled()){var y=new n("late cancellation observer");return p._attachExtraTrace(y),i.e=y,i}else g.isPending()&&g._attachCancellationCallback(new s(this));return g._then(u,c,void 0,this,void 0)}}}return p.isRejected()?(a(this),i.e=h,i):(a(this),h)}return e.prototype._passThrough=function(h,p,d,m){return typeof h!="function"?this.then():this._then(d,m,void 0,new o(this,p,h),void 0)},e.prototype.lastly=e.prototype.finally=function(h){return this._passThrough(h,0,f,f)},e.prototype.tap=function(h){return this._passThrough(h,1,f)},o}});var Dv=pe((xZ,kv)=>{"use strict";kv.exports=function(e){var t=$e(),r=Vi().keys,n=t.tryCatch,i=t.errorObj;function o(s,a,u){return function(c){var f=u._boundValue();e:for(var h=0;h{"use strict";var Nv=$e(),K3=Nv.maybeWrapAsError,$3=xn(),X3=$3.OperationalError,Ov=Vi();function Z3(e){return e instanceof Error&&Ov.getPrototypeOf(e)===Error.prototype}var J3=/^(?:name|message|stack|cause)$/;function Y3(e){var t;if(Z3(e)){t=new X3(e),t.name=e.name,t.message=e.message,t.stack=e.stack;for(var r=Ov.keys(e),n=0;n{"use strict";Iv.exports=function(e,t,r,n,i){var o=$e(),s=o.tryCatch;e.method=function(a){if(typeof a!="function")throw new e.TypeError("expecting a function but got "+o.classString(a));return function(){var u=new e(t);u._captureStackTrace(),u._pushContext();var c=s(a).apply(this,arguments),f=u._popContext();return i.checkForgottenReturns(c,f,"Promise.method",u),u._resolveFromSyncValue(c),u}},e.attempt=e.try=function(a){if(typeof a!="function")return n("expecting a function but got "+o.classString(a));var u=new e(t);u._captureStackTrace(),u._pushContext();var c;if(arguments.length>1){i.deprecated("calling Promise.try with more than 1 argument");var f=arguments[1],h=arguments[2];c=o.isArray(f)?s(a).apply(h,f):s(a).call(h,f)}else c=s(a)();var p=u._popContext();return i.checkForgottenReturns(c,p,"Promise.try",u),u._resolveFromSyncValue(c),u},e.prototype._resolveFromSyncValue=function(a){a===o.errorObj?this._rejectCallback(a.e,!1):this._resolveCallback(a,!0)}}});var Bv=pe((SZ,Mv)=>{"use strict";Mv.exports=function(e,t,r,n){var i=!1,o=function(c,f){this._reject(f)},s=function(c,f){f.promiseRejectionQueued=!0,f.bindingPromise._then(o,o,null,this,c)},a=function(c,f){(this._bitField&50397184)===0&&this._resolveCallback(f.target)},u=function(c,f){f.promiseRejectionQueued||this._reject(c)};e.prototype.bind=function(c){i||(i=!0,e.prototype._propagateFrom=n.propagateFromFunction(),e.prototype._boundValue=n.boundValueFunction());var f=r(c),h=new e(t);h._propagateFrom(this,1);var p=this._target();if(h._setBoundTo(f),f instanceof e){var d={promiseRejectionQueued:!1,promise:h,target:p,bindingPromise:f};p._then(t,s,void 0,h,d),f._then(a,u,void 0,h,d),h._setOnCancel(f)}else h._resolveCallback(p);return h},e.prototype._setBoundTo=function(c){c!==void 0?(this._bitField=this._bitField|2097152,this._boundTo=c):this._bitField=this._bitField&-2097153},e.prototype._isBound=function(){return(this._bitField&2097152)===2097152},e.bind=function(c,f){return e.resolve(f).bind(c)}}});var Pv=pe((TZ,Lv)=>{"use strict";Lv.exports=function(e,t,r,n){var i=$e(),o=i.tryCatch,s=i.errorObj,a=e._async;e.prototype.break=e.prototype.cancel=function(){if(!n.cancellation())return this._warn("cancellation is disabled");for(var u=this,c=u;u._isCancellable();){if(!u._cancelBy(c)){c._isFollowing()?c._followee().cancel():c._cancelBranched();break}var f=u._cancellationParent;if(f==null||!f._isCancellable()){u._isFollowing()?u._followee().cancel():u._cancelBranched();break}else u._isFollowing()&&u._followee().cancel(),u._setWillBeCancelled(),c=u,u=f}},e.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},e.prototype._enoughBranchesHaveCancelled=function(){return this._branchesRemainingToCancel===void 0||this._branchesRemainingToCancel<=0},e.prototype._cancelBy=function(u){return u===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),this._enoughBranchesHaveCancelled()?(this._invokeOnCancel(),!0):!1)},e.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},e.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),a.invoke(this._cancelPromises,this,void 0))},e.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},e.prototype._unsetOnCancel=function(){this._onCancelField=void 0},e.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},e.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},e.prototype._doInvokeOnCancel=function(u,c){if(i.isArray(u))for(var f=0;f{"use strict";zv.exports=function(e){function t(){return this.value}function r(){throw this.reason}e.prototype.return=e.prototype.thenReturn=function(n){return n instanceof e&&n.suppressUnhandledRejections(),this._then(t,void 0,void 0,{value:n},void 0)},e.prototype.throw=e.prototype.thenThrow=function(n){return this._then(r,void 0,void 0,{reason:n},void 0)},e.prototype.catchThrow=function(n){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:n},void 0);var i=arguments[1],o=function(){throw i};return this.caught(n,o)},e.prototype.catchReturn=function(n){if(arguments.length<=1)return n instanceof e&&n.suppressUnhandledRejections(),this._then(void 0,t,void 0,{value:n},void 0);var i=arguments[1];i instanceof e&&i.suppressUnhandledRejections();var o=function(){return i};return this.caught(n,o)}}});var jv=pe((kZ,qv)=>{"use strict";qv.exports=function(e){function t(u){u!==void 0?(u=u._target(),this._bitField=u._bitField,this._settledValueField=u._isFateSealed()?u._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}t.prototype._settledValue=function(){return this._settledValueField};var r=t.prototype.value=function(){if(!this.isFulfilled())throw new TypeError(`cannot get fulfillment value of a non-fulfilled promise + + See http://goo.gl/MqrFmX +`);return this._settledValue()},n=t.prototype.error=t.prototype.reason=function(){if(!this.isRejected())throw new TypeError(`cannot get rejection reason of a non-rejected promise + + See http://goo.gl/MqrFmX +`);return this._settledValue()},i=t.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},o=t.prototype.isRejected=function(){return(this._bitField&16777216)!==0},s=t.prototype.isPending=function(){return(this._bitField&50397184)===0},a=t.prototype.isResolved=function(){return(this._bitField&50331648)!==0};t.prototype.isCancelled=function(){return(this._bitField&8454144)!==0},e.prototype.__isCancelled=function(){return(this._bitField&65536)===65536},e.prototype._isCancelled=function(){return this._target().__isCancelled()},e.prototype.isCancelled=function(){return(this._target()._bitField&8454144)!==0},e.prototype.isPending=function(){return s.call(this._target())},e.prototype.isRejected=function(){return o.call(this._target())},e.prototype.isFulfilled=function(){return i.call(this._target())},e.prototype.isResolved=function(){return a.call(this._target())},e.prototype.value=function(){return r.call(this._target())},e.prototype.reason=function(){var u=this._target();return u._unsetRejectionIsUnhandled(),n.call(u)},e.prototype._value=function(){return this._settledValue()},e.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},e.PromiseInspection=t}});var Wv=pe((DZ,Hv)=>{"use strict";Hv.exports=function(e,t,r,n,i,o){var s=$e(),a=s.canEvaluate,u=s.tryCatch,c=s.errorObj,f;if(a){for(var h=function(E){return new Function("value","holder",` + 'use strict'; + holder.pIndex = value; + holder.checkFulfillment(this); + `.replace(/Index/g,E))},p=function(E){return new Function("promise","holder",` + 'use strict'; + holder.pIndex = promise; + `.replace(/Index/g,E))},d=function(E){for(var b=new Array(E),C=0;C0&&typeof arguments[E]=="function"&&(b=arguments[E],E<=8&&a)){var F=new e(n);F._captureStackTrace();for(var C=m[E-1],S=new C(b),A=g,k=0;k{"use strict";Vv.exports=function(e,t,r,n,i,o){var s=e._getDomain,a=$e(),u=a.tryCatch,c=a.errorObj,f=e._async;function h(d,m,g,y){this.constructor$(d),this._promise._captureStackTrace();var w=s();this._callback=w===null?m:a.domainBind(w,m),this._preservedValues=y===i?new Array(this.length()):null,this._limit=g,this._inFlight=0,this._queue=[],f.invoke(this._asyncInit,this,void 0)}a.inherits(h,t),h.prototype._asyncInit=function(){this._init$(void 0,-2)},h.prototype._init=function(){},h.prototype._promiseFulfilled=function(d,m){var g=this._values,y=this.length(),w=this._preservedValues,E=this._limit;if(m<0){if(m=m*-1-1,g[m]=d,E>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(E>=1&&this._inFlight>=E)return g[m]=d,this._queue.push(m),!1;w!==null&&(w[m]=d);var b=this._promise,C=this._callback,S=b._boundValue();b._pushContext();var A=u(C).call(S,d,m,y),k=b._popContext();if(o.checkForgottenReturns(A,k,w!==null?"Promise.filter":"Promise.map",b),A===c)return this._reject(A.e),!0;var B=n(A,this._promise);if(B instanceof e){B=B._target();var O=B._bitField;if((O&50397184)===0)return E>=1&&this._inFlight++,g[m]=B,B._proxy(this,(m+1)*-1),!1;if((O&33554432)!==0)A=B._value();else return(O&16777216)!==0?(this._reject(B._reason()),!0):(this._cancel(),!0)}g[m]=A}var P=++this._totalResolved;return P>=y?(w!==null?this._filter(g,w):this._resolve(g),!0):!1},h.prototype._drainQueue=function(){for(var d=this._queue,m=this._limit,g=this._values;d.length>0&&this._inFlight=1?w:0,new h(d,m,w,y).promise()}e.prototype.map=function(d,m){return p(this,d,m,null)},e.map=function(d,m,g,y){return p(d,m,g,y)}}});var $v=pe((OZ,Kv)=>{"use strict";var up=Object.create;up&&(cp=up(null),fp=up(null),cp[" size"]=fp[" size"]=0);var cp,fp;Kv.exports=function(e){var t=$e(),r=t.canEvaluate,n=t.isIdentifier,i,o,s=function(d){return new Function("ensureMethod",` + return function(obj) { + 'use strict' + var len = this.length; + ensureMethod(obj, 'methodName'); + switch(len) { + case 1: return obj.methodName(this[0]); + case 2: return obj.methodName(this[0], this[1]); + case 3: return obj.methodName(this[0], this[1], this[2]); + case 0: return obj.methodName(); + default: + return obj.methodName.apply(obj, this); + } + }; + `.replace(/methodName/g,d))(c)},a=function(d){return new Function("obj",` + 'use strict'; + return obj.propertyName; + `.replace("propertyName",d))},u=function(d,m,g){var y=g[d];if(typeof y!="function"){if(!n(d))return null;if(y=m(d),g[d]=y,g[" size"]++,g[" size"]>512){for(var w=Object.keys(g),E=0;E<256;++E)delete g[w[E]];g[" size"]=w.length-256}}return y};i=function(d){return u(d,s,cp)},o=function(d){return u(d,a,fp)};function c(d,m){var g;if(d!=null&&(g=d[m]),typeof g!="function"){var y="Object "+t.classString(d)+" has no method '"+t.toString(m)+"'";throw new e.TypeError(y)}return g}function f(d){var m=this.pop(),g=c(d,m);return g.apply(d,this)}e.prototype.call=function(d){for(var m=arguments.length,g=new Array(Math.max(m-1,0)),y=1;y{"use strict";Xv.exports=function(e,t,r,n,i,o){var s=$e(),a=xn().TypeError,u=$e().inherits,c=s.errorObj,f=s.tryCatch,h={};function p(b){setTimeout(function(){throw b},0)}function d(b){var C=r(b);return C!==b&&typeof b._isDisposable=="function"&&typeof b._getDisposer=="function"&&b._isDisposable()&&C._setDisposable(b._getDisposer()),C}function m(b,C){var S=0,A=b.length,k=new e(i);function B(){if(S>=A)return k._fulfill();var O=d(b[S++]);if(O instanceof e&&O._isDisposable()){try{O=r(O._getDisposer().tryDispose(C),b.promise)}catch(P){return p(P)}if(O instanceof e)return O._then(B,p,null,null,null)}B()}return B(),k}function g(b,C,S){this._data=b,this._promise=C,this._context=S}g.prototype.data=function(){return this._data},g.prototype.promise=function(){return this._promise},g.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():h},g.prototype.tryDispose=function(b){var C=this.resource(),S=this._context;S!==void 0&&S._pushContext();var A=C!==h?this.doDispose(C,b):null;return S!==void 0&&S._popContext(),this._promise._unsetDisposable(),this._data=null,A},g.isDisposer=function(b){return b!=null&&typeof b.resource=="function"&&typeof b.tryDispose=="function"};function y(b,C,S){this.constructor$(b,C,S)}u(y,g),y.prototype.doDispose=function(b,C){var S=this.data();return S.call(b,b,C)};function w(b){return g.isDisposer(b)?(this.resources[this.index]._setDisposable(b),b.promise()):b}function E(b){this.length=b,this.promise=null,this[b-1]=null}E.prototype._resultCancelled=function(){for(var b=this.length,C=0;C0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=this._bitField&-131073,this._disposer=void 0},e.prototype.disposer=function(b){if(typeof b=="function")return new y(b,this,n());throw new a}}});var Yv=pe((IZ,Jv)=>{"use strict";Jv.exports=function(e,t,r){var n=$e(),i=e.TimeoutError;function o(h){this.handle=h}o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(h){return a(+this).thenReturn(h)},a=e.delay=function(h,p){var d,m;return p!==void 0?(d=e.resolve(p)._then(s,null,null,h,void 0),r.cancellation()&&p instanceof e&&d._setOnCancel(p)):(d=new e(t),m=setTimeout(function(){d._fulfill()},+h),r.cancellation()&&d._setOnCancel(new o(m)),d._captureStackTrace()),d._setAsyncGuaranteed(),d};e.prototype.delay=function(h){return a(h,this)};var u=function(h,p,d){var m;typeof p!="string"?p instanceof Error?m=p:m=new i("operation timed out"):m=new i(p),n.markAsOriginatingFromRejection(m),h._attachExtraTrace(m),h._reject(m),d?.cancel()};function c(h){return clearTimeout(this.handle),h}function f(h){throw clearTimeout(this.handle),h}e.prototype.timeout=function(h,p){h=+h;var d,m,g=new o(setTimeout(function(){d.isPending()&&u(d,p,m)},h));return r.cancellation()?(m=this.then(),d=m._then(c,f,void 0,g,void 0),d._setOnCancel(g)):d=this._then(c,f,void 0,g,void 0),d}}});var e2=pe((FZ,Qv)=>{"use strict";Qv.exports=function(e,t,r,n,i,o){var s=xn(),a=s.TypeError,u=$e(),c=u.errorObj,f=u.tryCatch,h=[];function p(m,g,y){for(var w=0;w{"use strict";t2.exports=function(e){var t=$e(),r=e._async,n=t.tryCatch,i=t.errorObj;function o(u,c){var f=this;if(!t.isArray(u))return s.call(f,u,c);var h=n(c).apply(f._boundValue(),[null].concat(u));h===i&&r.throwLater(h.e)}function s(u,c){var f=this,h=f._boundValue(),p=u===void 0?n(c).call(h,null):n(c).call(h,null,u);p===i&&r.throwLater(p.e)}function a(u,c){var f=this;if(!u){var h=new Error(u+"");h.cause=u,u=h}var p=n(c).call(f._boundValue(),u);p===i&&r.throwLater(p.e)}e.prototype.asCallback=e.prototype.nodeify=function(u,c){if(typeof u=="function"){var f=s;c!==void 0&&Object(c).spread&&(f=o),this._then(f,a,void 0,this,u)}return this}}});var i2=pe((BZ,n2)=>{"use strict";n2.exports=function(e,t){var r={},n=$e(),i=lp(),o=n.withAppended,s=n.maybeWrapAsError,a=n.canEvaluate,u=xn().TypeError,c="Async",f={__isPromisified__:!0},h=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],p=new RegExp("^(?:"+h.join("|")+")$"),d=function(W){return n.isIdentifier(W)&&W.charAt(0)!=="_"&&W!=="constructor"};function m(W){return!p.test(W)}function g(W){try{return W.__isPromisified__===!0}catch{return!1}}function y(W,F,J){var j=n.getDataPropertyOrDefault(W,F+J,f);return j?g(j):!1}function w(W,F,J){for(var j=0;j=J;--j)F.push(j);for(var j=W+1;j<=3;++j)F.push(j);return F},A=function(W){return n.filledRange(W,"_arg","")},k=function(W){return n.filledRange(Math.max(W,3),"_arg","")},B=function(W){return typeof W.length=="number"?Math.max(Math.min(W.length,1024),0):0};C=function(W,F,J,j,H,$){var z=Math.max(0,B(j)-1),G=S(z),X=typeof W=="string"||F===r;function q(he){var L=A(he).join(", "),M=he>0?", ":"",re;return X?re=`ret = callback.call(this, {{args}}, nodeback); break; +`:re=F===void 0?`ret = callback({{args}}, nodeback); break; +`:`ret = callback.call(receiver, {{args}}, nodeback); break; +`,re.replace("{{args}}",L).replace(", ",M)}function Q(){for(var he="",L=0;L{"use strict";o2.exports=function(e,t,r,n){var i=$e(),o=i.isObject,s=Vi(),a;typeof Map=="function"&&(a=Map);var u=(function(){var p=0,d=0;function m(g,y){this[p]=g,this[p+d]=y,p++}return function(y){d=y.size,p=0;var w=new Array(y.size*2);return y.forEach(m,w),w}})(),c=function(p){for(var d=new a,m=p.length/2|0,g=0;g=this._length){var g;if(this._isMap)g=c(this._values);else{g={};for(var y=this.length(),w=0,E=this.length();w>1};function h(p){var d,m=r(p);if(o(m))m instanceof e?d=m._then(e.props,void 0,void 0,void 0,void 0):d=new f(m).promise();else return n(`cannot await properties of a non-object + + See http://goo.gl/MqrFmX +`);return m instanceof e&&d._propagateFrom(m,2),d}e.prototype.props=function(){return h(this)},e.props=function(p){return h(p)}}});var l2=pe((PZ,a2)=>{"use strict";a2.exports=function(e,t,r,n){var i=$e(),o=function(a){return a.then(function(u){return s(u,a)})};function s(a,u){var c=r(a);if(c instanceof e)return o(c);if(a=i.asArray(a),a===null)return n("expecting an array or an iterable object but got "+i.classString(a));var f=new e(t);u!==void 0&&f._propagateFrom(u,3);for(var h=f._fulfill,p=f._reject,d=0,m=a.length;d{"use strict";u2.exports=function(e,t,r,n,i,o){var s=e._getDomain,a=$e(),u=a.tryCatch;function c(m,g,y,w){this.constructor$(m);var E=s();this._fn=E===null?g:a.domainBind(E,g),y!==void 0&&(y=e.resolve(y),y._attachCancellationCallback(this)),this._initialValue=y,this._currentCancellable=null,w===i?this._eachValues=Array(this._length):w===0?this._eachValues=null:this._eachValues=void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}a.inherits(c,t),c.prototype._gotAccum=function(m){this._eachValues!==void 0&&this._eachValues!==null&&m!==i&&this._eachValues.push(m)},c.prototype._eachComplete=function(m){return this._eachValues!==null&&this._eachValues.push(m),this._eachValues},c.prototype._init=function(){},c.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},c.prototype.shouldCopyValues=function(){return!1},c.prototype._resolve=function(m){this._promise._resolveCallback(m),this._values=null},c.prototype._resultCancelled=function(m){if(m===this._initialValue)return this._cancel();this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof e&&this._currentCancellable.cancel(),this._initialValue instanceof e&&this._initialValue.cancel())},c.prototype._iterate=function(m){this._values=m;var g,y,w=m.length;if(this._initialValue!==void 0?(g=this._initialValue,y=0):(g=e.resolve(m[0]),y=1),this._currentCancellable=g,!g.isRejected())for(;y{"use strict";f2.exports=function(e,t,r){var n=e.PromiseInspection,i=$e();function o(s){this.constructor$(s)}i.inherits(o,t),o.prototype._promiseResolved=function(s,a){this._values[s]=a;var u=++this._totalResolved;return u>=this._length?(this._resolve(this._values),!0):!1},o.prototype._promiseFulfilled=function(s,a){var u=new n;return u._bitField=33554432,u._settledValueField=s,this._promiseResolved(a,u)},o.prototype._promiseRejected=function(s,a){var u=new n;return u._bitField=16777216,u._settledValueField=s,this._promiseResolved(a,u)},e.settle=function(s){return r.deprecated(".settle()",".reflect()"),new o(s).promise()},e.prototype.settle=function(){return e.settle(this)}}});var p2=pe((qZ,d2)=>{"use strict";d2.exports=function(e,t,r){var n=$e(),i=xn().RangeError,o=xn().AggregateError,s=n.isArray,a={};function u(f){this.constructor$(f),this._howMany=0,this._unwrap=!1,this._initialized=!1}n.inherits(u,t),u.prototype._init=function(){if(this._initialized){if(this._howMany===0){this._resolve([]);return}this._init$(void 0,-5);var f=s(this._values);!this._isResolved()&&f&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},u.prototype.init=function(){this._initialized=!0,this._init()},u.prototype.setUnwrap=function(){this._unwrap=!0},u.prototype.howMany=function(){return this._howMany},u.prototype.setHowMany=function(f){this._howMany=f},u.prototype._promiseFulfilled=function(f){return this._addFulfilled(f),this._fulfilled()===this.howMany()?(this._values.length=this.howMany(),this.howMany()===1&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0):!1},u.prototype._promiseRejected=function(f){return this._addRejected(f),this._checkOutcome()},u.prototype._promiseCancelled=function(){return this._values instanceof e||this._values==null?this._cancel():(this._addRejected(a),this._checkOutcome())},u.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var f=new o,h=this.length();h0?this._reject(f):this._cancel(),!0}return!1},u.prototype._fulfilled=function(){return this._totalResolved},u.prototype._rejected=function(){return this._values.length-this.length()},u.prototype._addRejected=function(f){this._values.push(f)},u.prototype._addFulfilled=function(f){this._values[this._totalResolved++]=f},u.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},u.prototype._getRangeError=function(f){var h="Input array must contain at least "+this._howMany+" items but contains only "+f+" items";return new i(h)},u.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))};function c(f,h){if((h|0)!==h||h<0)return r(`expecting a positive integer + + See http://goo.gl/MqrFmX +`);var p=new u(f),d=p.promise();return p.setHowMany(h),p.init(),d}e.some=function(f,h){return c(f,h)},e.prototype.some=function(f){return c(this,f)},e._SomePromiseArray=u}});var g2=pe((jZ,m2)=>{"use strict";m2.exports=function(e,t){var r=e.map;e.prototype.filter=function(n,i){return r(this,n,i,t)},e.filter=function(n,i,o){return r(n,i,o,t)}}});var v2=pe((HZ,y2)=>{"use strict";y2.exports=function(e,t){var r=e.reduce,n=e.all;function i(){return n(this)}function o(s,a){return r(s,a,t,t)}e.prototype.each=function(s){return r(this,s,t,0)._then(i,void 0,void 0,this,void 0)},e.prototype.mapSeries=function(s){return r(this,s,t,t)},e.each=function(s,a){return r(s,a,t,0)._then(i,void 0,void 0,s,void 0)},e.mapSeries=o}});var b2=pe((WZ,w2)=>{"use strict";w2.exports=function(e){var t=e._SomePromiseArray;function r(n){var i=new t(n),o=i.promise();return i.setHowMany(1),i.setUnwrap(),i.init(),o}e.any=function(n){return r(n)},e.prototype.any=function(){return r(this)}}});var _2=pe((VZ,hp)=>{"use strict";hp.exports=function(){var e=function(){return new h(`circular promise resolution chain + + See http://goo.gl/MqrFmX +`)},t=function(){return new _.PromiseInspection(this._target())},r=function(j){return _.reject(new h(j))};function n(){}var i={},o=$e(),s;o.isNode?s=function(){var j=process.domain;return j===void 0&&(j=null),j}:s=function(){return null},o.notEnumerableProp(_,"_getDomain",s);var a=Vi(),u=pv(),c=new u;a.defineProperty(_,"_async",{value:c});var f=xn(),h=_.TypeError=f.TypeError;_.RangeError=f.RangeError;var p=_.CancellationError=f.CancellationError;_.TimeoutError=f.TimeoutError,_.OperationalError=f.OperationalError,_.RejectionError=f.OperationalError,_.AggregateError=f.AggregateError;var d=function(){},m={},g={},y=wv()(_,d),w=_v()(_,d,y,r,n),E=Ev()(_),b=E.create,C=Sv()(_,E),S=C.CapturedTrace,A=Cv()(_,y),k=Dv()(g),B=lp(),O=o.errorObj,P=o.tryCatch;function Y(j,H){if(typeof H!="function")throw new h("expecting a function but got "+o.classString(H));if(j.constructor!==_)throw new h(`the promise constructor cannot be invoked directly + + See http://goo.gl/MqrFmX +`)}function _(j){this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,j!==d&&(Y(this,j),this._resolveFromExecutor(j)),this._promiseCreated(),this._fireEvent("promiseCreated",this)}_.prototype.toString=function(){return"[object Promise]"},_.prototype.caught=_.prototype.catch=function(j){var H=arguments.length;if(H>1){var $=new Array(H-1),z=0,G;for(G=0;G0&&typeof j!="function"&&typeof H!="function"){var $=".then() only accepts functions but was passed: "+o.classString(j);arguments.length>1&&($+=", "+o.classString(H)),this._warn($)}return this._then(j,H,void 0,void 0,void 0)},_.prototype.done=function(j,H){var $=this._then(j,H,void 0,void 0,void 0);$._setIsFinal()},_.prototype.spread=function(j){return typeof j!="function"?r("expecting a function but got "+o.classString(j)):this.all()._then(j,void 0,void 0,m,void 0)},_.prototype.toJSON=function(){var j={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(j.fulfillmentValue=this.value(),j.isFulfilled=!0):this.isRejected()&&(j.rejectionReason=this.reason(),j.isRejected=!0),j},_.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new w(this).promise()},_.prototype.error=function(j){return this.caught(o.originatesFromRejection,j)},_.getNewLibraryCopy=hp.exports,_.is=function(j){return j instanceof _},_.fromNode=_.fromCallback=function(j){var H=new _(d);H._captureStackTrace();var $=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,z=P(j)(B(H,$));return z===O&&H._rejectCallback(z.e,!0),H._isFateSealed()||H._setAsyncGuaranteed(),H},_.all=function(j){return new w(j).promise()},_.cast=function(j){var H=y(j);return H instanceof _||(H=new _(d),H._captureStackTrace(),H._setFulfilled(),H._rejectionHandler0=j),H},_.resolve=_.fulfilled=_.cast,_.reject=_.rejected=function(j){var H=new _(d);return H._captureStackTrace(),H._rejectCallback(j,!0),H},_.setScheduler=function(j){if(typeof j!="function")throw new h("expecting a function but got "+o.classString(j));return c.setScheduler(j)},_.prototype._then=function(j,H,$,z,G){var X=G!==void 0,q=X?G:new _(d),Q=this._target(),oe=Q._bitField;X||(q._propagateFrom(this,3),q._captureStackTrace(),z===void 0&&(this._bitField&2097152)!==0&&((oe&50397184)!==0?z=this._boundValue():z=Q===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,q));var ae=s();if((oe&50397184)!==0){var he,L,M=Q._settlePromiseCtx;(oe&33554432)!==0?(L=Q._rejectionHandler0,he=j):(oe&16777216)!==0?(L=Q._fulfillmentHandler0,he=H,Q._unsetRejectionIsUnhandled()):(M=Q._settlePromiseLateCancellationObserver,L=new p("late cancellation observer"),Q._attachExtraTrace(L),he=H),c.invoke(M,Q,{handler:ae===null?he:typeof he=="function"&&o.domainBind(ae,he),promise:q,receiver:z,value:L})}else Q._addCallbacks(j,H,q,z,ae);return q},_.prototype._length=function(){return this._bitField&65535},_.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},_.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},_.prototype._setLength=function(j){this._bitField=this._bitField&-65536|j&65535},_.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},_.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},_.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},_.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},_.prototype._isFinal=function(){return(this._bitField&4194304)>0},_.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},_.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},_.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},_.prototype._setAsyncGuaranteed=function(){c.hasCustomScheduler()||(this._bitField=this._bitField|134217728)},_.prototype._receiverAt=function(j){var H=j===0?this._receiver0:this[j*4-4+3];if(H!==i)return H===void 0&&this._isBound()?this._boundValue():H},_.prototype._promiseAt=function(j){return this[j*4-4+2]},_.prototype._fulfillmentHandlerAt=function(j){return this[j*4-4+0]},_.prototype._rejectionHandlerAt=function(j){return this[j*4-4+1]},_.prototype._boundValue=function(){},_.prototype._migrateCallback0=function(j){var H=j._bitField,$=j._fulfillmentHandler0,z=j._rejectionHandler0,G=j._promise0,X=j._receiverAt(0);X===void 0&&(X=i),this._addCallbacks($,z,G,X,null)},_.prototype._migrateCallbackAt=function(j,H){var $=j._fulfillmentHandlerAt(H),z=j._rejectionHandlerAt(H),G=j._promiseAt(H),X=j._receiverAt(H);X===void 0&&(X=i),this._addCallbacks($,z,G,X,null)},_.prototype._addCallbacks=function(j,H,$,z,G){var X=this._length();if(X>=65531&&(X=0,this._setLength(0)),X===0)this._promise0=$,this._receiver0=z,typeof j=="function"&&(this._fulfillmentHandler0=G===null?j:o.domainBind(G,j)),typeof H=="function"&&(this._rejectionHandler0=G===null?H:o.domainBind(G,H));else{var q=X*4-4;this[q+2]=$,this[q+3]=z,typeof j=="function"&&(this[q+0]=G===null?j:o.domainBind(G,j)),typeof H=="function"&&(this[q+1]=G===null?H:o.domainBind(G,H))}return this._setLength(X+1),X},_.prototype._proxy=function(j,H){this._addCallbacks(void 0,void 0,H,j,null)},_.prototype._resolveCallback=function(j,H){if((this._bitField&117506048)===0){if(j===this)return this._rejectCallback(e(),!1);var $=y(j,this);if(!($ instanceof _))return this._fulfill(j);H&&this._propagateFrom($,2);var z=$._target();if(z===this){this._reject(e());return}var G=z._bitField;if((G&50397184)===0){var X=this._length();X>0&&z._migrateCallback0(this);for(var q=1;q>>16)){if(j===this){var $=e();return this._attachExtraTrace($),this._reject($)}this._setFulfilled(),this._rejectionHandler0=j,(H&65535)>0&&((H&134217728)!==0?this._settlePromises():c.settlePromises(this))}},_.prototype._reject=function(j){var H=this._bitField;if(!((H&117506048)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=j,this._isFinal())return c.fatalError(j,o.isNode);(H&65535)>0?c.settlePromises(this):this._ensurePossibleRejectionHandled()}},_.prototype._fulfillPromises=function(j,H){for(var $=1;$0){if((j&16842752)!==0){var $=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,$,j),this._rejectPromises(H,$)}else{var z=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,z,j),this._fulfillPromises(H,z)}this._setLength(0)}this._clearCancellationData()},_.prototype._settledValue=function(){var j=this._bitField;if((j&33554432)!==0)return this._rejectionHandler0;if((j&16777216)!==0)return this._fulfillmentHandler0};function W(j){this.promise._resolveCallback(j)}function F(j){this.promise._rejectCallback(j,!1)}_.defer=_.pending=function(){C.deprecated("Promise.defer","new Promise");var j=new _(d);return{promise:j,resolve:W,reject:F}},o.notEnumerableProp(_,"_makeSelfResolutionError",e),Fv()(_,d,y,r,C),Bv()(_,d,y,C),Pv()(_,w,r,C),Uv()(_),jv()(_),Wv()(_,w,y,d,c,s),_.Promise=_,_.version="3.4.7",Gv()(_,w,r,y,d,C),$v()(_),Zv()(_,r,y,b,d,C),Yv()(_,d,C),e2()(_,r,d,y,n,C),r2()(_),i2()(_,d),s2()(_,w,y,r),l2()(_,d,y,r),c2()(_,w,r,y,d,C),h2()(_,w,C),p2()(_,w,r),g2()(_,d),v2()(_,d),b2()(_),o.toFastProperties(_),o.toFastProperties(_.prototype);function J(j){var H=new _(d);H._fulfillmentHandler0=j,H._rejectionHandler0=j,H._promise0=j,H._receiver0=j}return J({a:1}),J({b:2}),J({c:3}),J(1),J(function(){}),J(void 0),J(!1),J(new _(d)),C.setBounds(u.firstLineError,o.lastLineError),_}});var En=pe(Mr=>{var eD=(rt(),it(tt)),tr=_2()();Mr.defer=tD;Mr.when=tr.resolve;Mr.resolve=tr.resolve;Mr.all=tr.all;Mr.props=tr.props;Mr.reject=tr.reject;Mr.promisify=tr.promisify;Mr.mapSeries=tr.mapSeries;Mr.attempt=tr.attempt;Mr.nfcall=function(e){var t=Array.prototype.slice.call(arguments,1),r=tr.promisify(e);return r.apply(null,t)};tr.prototype.fail=tr.prototype.caught;tr.prototype.also=function(e){return this.then(function(t){var r=eD.extend({},t,e(t));return tr.props(r)})};function tD(){var e,t,r=new tr.Promise(function(n,i){e=n,t=i});return{resolve:e,reject:t,promise:r}}});var si=pe(qe=>{var rD=(rt(),it(tt)),_t=qe.types={document:"document",paragraph:"paragraph",run:"run",text:"text",tab:"tab",checkbox:"checkbox",hyperlink:"hyperlink",noteReference:"noteReference",image:"image",note:"note",commentReference:"commentReference",comment:"comment",table:"table",tableRow:"tableRow",tableCell:"tableCell",break:"break",bookmarkStart:"bookmarkStart"};function nD(e,t){return t=t||{},{type:_t.document,children:e,notes:t.notes||new vc({}),comments:t.comments||[]}}function iD(e,t){t=t||{};var r=t.indent||{};return{type:_t.paragraph,children:e,styleId:t.styleId||null,styleName:t.styleName||null,numbering:t.numbering||null,alignment:t.alignment||null,indent:{start:r.start||null,end:r.end||null,firstLine:r.firstLine||null,hanging:r.hanging||null},spacing:t.spacing||null,hasBottomBorder:!!t.hasBottomBorder}}function oD(e,t){return t=t||{},{type:_t.run,children:e,styleId:t.styleId||null,styleName:t.styleName||null,isBold:!!t.isBold,isUnderline:!!t.isUnderline,isItalic:!!t.isItalic,isStrikethrough:!!t.isStrikethrough,isAllCaps:!!t.isAllCaps,isSmallCaps:!!t.isSmallCaps,verticalAlignment:t.verticalAlignment||x2.baseline,font:t.font||null,fontSize:t.fontSize||null,highlight:t.highlight||null,color:t.color||null}}var x2={baseline:"baseline",superscript:"superscript",subscript:"subscript"};function sD(e){return{type:_t.text,value:e}}function aD(){return{type:_t.tab}}function lD(e){return{type:_t.checkbox,checked:e.checked}}function uD(e,t){return{type:_t.hyperlink,children:e,href:t.href,anchor:t.anchor,targetFrame:t.targetFrame}}function cD(e){return{type:_t.noteReference,noteType:e.noteType,noteId:e.noteId}}function vc(e){this._notes=rD.indexBy(e,function(t){return E2(t.noteType,t.noteId)})}vc.prototype.resolve=function(e){return this.findNoteByKey(E2(e.noteType,e.noteId))};vc.prototype.findNoteByKey=function(e){return this._notes[e]||null};function fD(e){return{type:_t.note,noteType:e.noteType,noteId:e.noteId,body:e.body}}function hD(e){return{type:_t.commentReference,commentId:e.commentId}}function dD(e){return{type:_t.comment,commentId:e.commentId,body:e.body,authorName:e.authorName,authorInitials:e.authorInitials}}function E2(e,t){return e+"-"+t}function pD(e){return{type:_t.image,read:function(t){return t?e.readImage(t):e.readImage().then(function(r){return Buffer.from(r)})},readAsArrayBuffer:function(){return e.readImage()},readAsBase64String:function(){return e.readImage("base64")},readAsBuffer:function(){return e.readImage().then(function(t){return Buffer.from(t)})},altText:e.altText,contentType:e.contentType,widthPt:e.widthPt==null?null:e.widthPt,heightPt:e.heightPt==null?null:e.heightPt}}function mD(e,t){return t=t||{},{type:_t.table,children:e,styleId:t.styleId||null,styleName:t.styleName||null}}function gD(e,t){return t=t||{},{type:_t.tableRow,children:e,isHeader:t.isHeader||!1}}function yD(e,t){return t=t||{},{type:_t.tableCell,children:e,colSpan:t.colSpan==null?1:t.colSpan,rowSpan:t.rowSpan==null?1:t.rowSpan}}function dp(e){return{type:_t.break,breakType:e}}function vD(e){return{type:_t.bookmarkStart,name:e.name}}qe.document=qe.Document=nD;qe.paragraph=qe.Paragraph=iD;qe.run=qe.Run=oD;qe.text=qe.Text=sD;qe.tab=qe.Tab=aD;qe.checkbox=qe.Checkbox=lD;qe.Hyperlink=uD;qe.noteReference=qe.NoteReference=cD;qe.Notes=vc;qe.Note=fD;qe.commentReference=hD;qe.comment=dD;qe.Image=pD;qe.Table=mD;qe.TableRow=gD;qe.TableCell=yD;qe.lineBreak=dp("line");qe.pageBreak=dp("page");qe.columnBreak=dp("column");qe.BookmarkStart=vD;qe.verticalAlignment=x2});var $r=pe(Ra=>{var Oa=(rt(),it(tt));Ra.Result=Kr;Ra.success=wD;Ra.warning=bD;Ra.error=_D;function Kr(e,t){this.value=e,this.messages=t||[]}Kr.prototype.map=function(e){return new Kr(e(this.value),this.messages)};Kr.prototype.flatMap=function(e){var t=e(this.value);return new Kr(t.value,pp([this,t]))};Kr.prototype.flatMapThen=function(e){var t=this;return e(this.value).then(function(r){return new Kr(r.value,pp([t,r]))})};Kr.combine=function(e){var t=Oa.flatten(Oa.pluck(e,"value")),r=pp(e);return new Kr(t,r)};function wD(e){return new Kr(e,[])}function bD(e){return{type:"warning",message:e}}function _D(e){return{type:"error",message:e.message,error:e}}function pp(e){var t=[];return Oa.flatten(Oa.pluck(e,"messages"),!0).forEach(function(r){xD(t,r)||t.push(r)}),t}function xD(e,t){return Oa.find(e,ED.bind(null,t))!==void 0}function ED(e,t){return e.type===t.type&&e.message===t.message}});var T2=pe(wc=>{"use strict";wc.byteLength=SD;wc.toByteArray=CD;wc.fromByteArray=ND;var Xr=[],br=[],AD=typeof Uint8Array<"u"?Uint8Array:Array,mp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($i=0,A2=mp.length;$i0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function SD(e){var t=S2(e),r=t[0],n=t[1];return(r+n)*3/4-n}function TD(e,t,r){return(t+r)*3/4-r}function CD(e){var t,r=S2(e),n=r[0],i=r[1],o=new AD(TD(e,n,i)),s=0,a=i>0?n-4:n,u;for(u=0;u>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=br[e.charCodeAt(u)]<<2|br[e.charCodeAt(u+1)]>>4,o[s++]=t&255),i===1&&(t=br[e.charCodeAt(u)]<<10|br[e.charCodeAt(u+1)]<<4|br[e.charCodeAt(u+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function kD(e){return Xr[e>>18&63]+Xr[e>>12&63]+Xr[e>>6&63]+Xr[e&63]}function DD(e,t,r){for(var n,i=[],o=t;oa?a:s+o));return n===1?(t=e[r-1],i.push(Xr[t>>2]+Xr[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Xr[t>>10]+Xr[t>>4&63]+Xr[t<<2&63]+"=")),i.join("")}});var yp=pe((C2,gp)=>{(function(e){typeof C2=="object"&&typeof gp<"u"?gp.exports=e():typeof define=="function"&&define.amd?define([],e):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=e()})(function(){return(function e(t,r,n){function i(a,u){if(!r[a]){if(!t[a]){var c=typeof vr=="function"&&vr;if(!u&&c)return c(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var h=r[a]={exports:{}};t[a][0].call(h.exports,function(p){var d=t[a][1][p];return i(d||p)},h,h.exports,e,t,r,n)}return r[a].exports}for(var o=typeof vr=="function"&&vr,s=0;s>2,h=(3&a)<<4|u>>4,p=1>6:64,d=2>4,u=(15&f)<<4|(h=o.indexOf(s.charAt(d++)))>>2,c=(3&h)<<6|(p=o.indexOf(s.charAt(d++))),y[m++]=a,h!==64&&(y[m++]=u),p!==64&&(y[m++]=c);return y}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function a(u,c,f,h,p){this.compressedSize=u,this.uncompressedSize=c,this.crc32=f,this.compression=h,this.compressedContent=p}a.prototype={getContentWorker:function(){var u=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),c=this;return u.on("end",function(){if(this.streamInfo.data_length!==c.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(u,c,f){return u.pipe(new o).pipe(new s("uncompressedSize")).pipe(c.compressWorker(f)).pipe(new s("compressedSize")).withStreamInfo("compression",c)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils"),i=(function(){for(var o,s=[],a=0;a<256;a++){o=a;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;s[a]=o}return s})();t.exports=function(o,s){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?(function(a,u,c,f){var h=i,p=f+c;a^=-1;for(var d=f;d>>8^h[255&(a^u[d])];return-1^a})(0|s,o,o.length,0):(function(a,u,c,f){var h=i,p=f+c;a^=-1;for(var d=f;d>>8^h[255&(a^u.charCodeAt(d))];return-1^a})(0|s,o,o.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n=typeof Promise<"u"?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),a=n?"uint8array":"array";function u(c,f){s.call(this,"FlateWorker/"+c),this._pako=null,this._pakoAction=c,this._pakoOptions=f,this.meta={}}r.magic="\b\0",o.inherits(u,s),u.prototype.processChunk=function(c){this.meta=c.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(a,c.data),!1)},u.prototype.flush=function(){s.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var c=this;this._pako.onData=function(f){c.push({data:f,meta:c.meta})}},r.compressWorker=function(c){return new u("Deflate",c)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function n(h,p){var d,m="";for(d=0;d>>=8;return m}function i(h,p,d,m,g,y){var w,E,b=h.file,C=h.compression,S=y!==a.utf8encode,A=o.transformTo("string",y(b.name)),k=o.transformTo("string",a.utf8encode(b.name)),B=b.comment,O=o.transformTo("string",y(B)),P=o.transformTo("string",a.utf8encode(B)),Y=k.length!==b.name.length,_=P.length!==B.length,W="",F="",J="",j=b.dir,H=b.date,$={crc32:0,compressedSize:0,uncompressedSize:0};p&&!d||($.crc32=h.crc32,$.compressedSize=h.compressedSize,$.uncompressedSize=h.uncompressedSize);var z=0;p&&(z|=8),S||!Y&&!_||(z|=2048);var G=0,X=0;j&&(G|=16),g==="UNIX"?(X=798,G|=(function(Q,oe){var ae=Q;return Q||(ae=oe?16893:33204),(65535&ae)<<16})(b.unixPermissions,j)):(X=20,G|=(function(Q){return 63&(Q||0)})(b.dosPermissions)),w=H.getUTCHours(),w<<=6,w|=H.getUTCMinutes(),w<<=5,w|=H.getUTCSeconds()/2,E=H.getUTCFullYear()-1980,E<<=4,E|=H.getUTCMonth()+1,E<<=5,E|=H.getUTCDate(),Y&&(F=n(1,1)+n(u(A),4)+k,W+="up"+n(F.length,2)+F),_&&(J=n(1,1)+n(u(O),4)+P,W+="uc"+n(J.length,2)+J);var q="";return q+=` +\0`,q+=n(z,2),q+=C.magic,q+=n(w,2),q+=n(E,2),q+=n($.crc32,4),q+=n($.compressedSize,4),q+=n($.uncompressedSize,4),q+=n(A.length,2),q+=n(W.length,2),{fileRecord:c.LOCAL_FILE_HEADER+q+A+W,dirRecord:c.CENTRAL_FILE_HEADER+n(X,2)+q+n(O.length,2)+"\0\0\0\0"+n(G,4)+n(m,4)+A+W+O}}var o=e("../utils"),s=e("../stream/GenericWorker"),a=e("../utf8"),u=e("../crc32"),c=e("../signature");function f(h,p,d,m){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=d,this.encodeFileName=m,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(f,s),f.prototype.push=function(h){var p=h.meta.percent||0,d=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,s.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:d?(p+100*(d-m-1))/d:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var p=this.streamFiles&&!h.file.dir;if(p){var d=i(h,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var p=this.streamFiles&&!h.file.dir,d=i(h,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),p)this.push({data:(function(m){return c.DATA_DESCRIPTOR+n(m.crc32,4)+n(m.compressedSize,4)+n(m.uncompressedSize,4)})(h),meta:{percent:100}});else for(this.push({data:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=this.bytesWritten,p=0;p=this.index;s--)a=(a<<8)+this.byteAt(s);return this.index+=o,a},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.readData=function(o){this.checkOffset(o);var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},i.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},i.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},i.prototype.readData=function(o){this.checkOffset(o);var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var s=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),o=e("./ArrayReader"),s=e("./StringReader"),a=e("./NodeBufferReader"),u=e("./Uint8ArrayReader");t.exports=function(c){var f=n.getTypeOf(c);return n.checkSupport(f),f!=="string"||i.uint8array?f==="nodebuffer"?new a(c):i.uint8array?new u(n.transformTo("uint8array",c)):new o(n.transformTo("array",c)):new s(c)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function o(s){n.call(this,"ConvertWorker to "+s),this.destType=s}i.inherits(o,n),o.prototype.processChunk=function(s){this.push({data:i.transformTo(this.destType,s.data),meta:s.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,n),o.prototype.processChunk=function(s){this.streamInfo.crc32=i(s.data,this.streamInfo.crc32||0),this.push(s)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(s){i.call(this,"DataLengthProbe for "+s),this.propName=s,this.withStreamInfo(s,0)}n.inherits(o,i),o.prototype.processChunk=function(s){if(s){var a=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=a+s.data.length}i.prototype.processChunk.call(this,s)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(s){i.call(this,"DataWorker");var a=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,s.then(function(u){a.dataIsReady=!0,a.data=u,a.max=u&&u.length||0,a.type=n.getTypeOf(u),a.isPaused||a._tickAndRepeat()},function(u){a.error(u)})}n.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var s=null,a=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":s=this.data.substring(this.index,a);break;case"uint8array":s=this.data.subarray(this.index,a);break;case"array":case"nodebuffer":s=this.data.slice(this.index,a)}return this.index=a,this.push({data:s,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,o){return this._listeners[i].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,o){if(this._listeners[i])for(var s=0;s "+i:i}},t.exports=n},{}],29:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./ConvertWorker"),o=e("./GenericWorker"),s=e("../base64"),a=e("../support"),u=e("../external"),c=null;if(a.nodestream)try{c=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(p,d){return new u.Promise(function(m,g){var y=[],w=p._internalType,E=p._outputType,b=p._mimeType;p.on("data",function(C,S){y.push(C),d&&d(S)}).on("error",function(C){y=[],g(C)}).on("end",function(){try{var C=(function(S,A,k){switch(S){case"blob":return n.newBlob(n.transformTo("arraybuffer",A),k);case"base64":return s.encode(A);default:return n.transformTo(S,A)}})(E,(function(S,A){var k,B=0,O=null,P=0;for(k=0;k"u")r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=i.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var n=e("./utils"),i=e("./support"),o=e("./nodejsUtils"),s=e("./stream/GenericWorker"),a=new Array(256),u=0;u<256;u++)a[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;a[254]=a[254]=1;function c(){s.call(this,"utf-8 decode"),this.leftOver=null}function f(){s.call(this,"utf-8 encode")}r.utf8encode=function(h){return i.nodebuffer?o.newBufferFrom(h,"utf-8"):(function(p){var d,m,g,y,w,E=p.length,b=0;for(y=0;y>>6:(m<65536?d[w++]=224|m>>>12:(d[w++]=240|m>>>18,d[w++]=128|m>>>12&63),d[w++]=128|m>>>6&63),d[w++]=128|63&m);return d})(h)},r.utf8decode=function(h){return i.nodebuffer?n.transformTo("nodebuffer",h).toString("utf-8"):(function(p){var d,m,g,y,w=p.length,E=new Array(2*w);for(d=m=0;d>10&1023,E[m++]=56320|1023&g)}return E.length!==m&&(E.subarray?E=E.subarray(0,m):E.length=m),n.applyFromCharCode(E)})(h=n.transformTo(i.uint8array?"uint8array":"array",h))},n.inherits(c,s),c.prototype.processChunk=function(h){var p=n.transformTo(i.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var d=p;(p=new Uint8Array(d.length+this.leftOver.length)).set(this.leftOver,0),p.set(d,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var m=(function(y,w){var E;for((w=w||y.length)>y.length&&(w=y.length),E=w-1;0<=E&&(192&y[E])==128;)E--;return E<0||E===0?w:E+a[y[E]]>w?E:w})(p),g=p;m!==p.length&&(i.uint8array?(g=p.subarray(0,m),this.leftOver=p.subarray(m,p.length)):(g=p.slice(0,m),this.leftOver=p.slice(m,p.length))),this.push({data:r.utf8decode(g),meta:h.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=c,n.inherits(f,s),f.prototype.processChunk=function(h){this.push({data:r.utf8encode(h.data),meta:h.meta})},r.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var n=e("./support"),i=e("./base64"),o=e("./nodejsUtils"),s=e("./external");function a(d){return d}function u(d,m){for(var g=0;g>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var p,d,m,g=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?f[m++]=224|h>>>12:(f[m++]=240|h>>>18,f[m++]=128|h>>>12&63),f[m++]=128|h>>>6&63),f[m++]=128|63&h);return f},r.buf2binstring=function(c){return u(c,c.length)},r.binstring2buf=function(c){for(var f=new n.Buf8(c.length),h=0,p=f.length;h>10&1023,y[p++]=56320|1023&d)}return u(y,p)},r.utf8border=function(c,f){var h;for((f=f||c.length)>c.length&&(f=c.length),h=f-1;0<=h&&(192&c[h])==128;)h--;return h<0||h===0?f:h+s[c[h]]>f?h:f}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(n,i,o,s){for(var a=65535&n|0,u=n>>>16&65535|0,c=0;o!==0;){for(o-=c=2e3>>1:i>>>1;o[s]=i}return o})();t.exports=function(i,o,s,a){var u=n,c=a+s;i^=-1;for(var f=a;f>>8^u[255&(i^o[f])];return-1^i}},{}],46:[function(e,t,r){"use strict";var n,i=e("../utils/common"),o=e("./trees"),s=e("./adler32"),a=e("./crc32"),u=e("./messages"),c=0,f=4,h=0,p=-2,d=-1,m=4,g=2,y=8,w=9,E=286,b=30,C=19,S=2*E+1,A=15,k=3,B=258,O=B+k+1,P=42,Y=113,_=1,W=2,F=3,J=4;function j(D,V){return D.msg=u[V],V}function H(D){return(D<<1)-(4D.avail_out&&(N=D.avail_out),N!==0&&(i.arraySet(D.output,V.pending_buf,V.pending_out,N,D.next_out),D.next_out+=N,V.pending_out+=N,D.total_out+=N,D.avail_out-=N,V.pending-=N,V.pending===0&&(V.pending_out=0))}function G(D,V){o._tr_flush_block(D,0<=D.block_start?D.block_start:-1,D.strstart-D.block_start,V),D.block_start=D.strstart,z(D.strm)}function X(D,V){D.pending_buf[D.pending++]=V}function q(D,V){D.pending_buf[D.pending++]=V>>>8&255,D.pending_buf[D.pending++]=255&V}function Q(D,V){var N,I,T=D.max_chain_length,v=D.strstart,x=D.prev_length,R=D.nice_match,U=D.strstart>D.w_size-O?D.strstart-(D.w_size-O):0,ee=D.window,Z=D.w_mask,K=D.prev,te=D.strstart+B,ie=ee[v+x-1],se=ee[v+x];D.prev_length>=D.good_match&&(T>>=2),R>D.lookahead&&(R=D.lookahead);do if(ee[(N=V)+x]===se&&ee[N+x-1]===ie&&ee[N]===ee[v]&&ee[++N]===ee[v+1]){v+=2,N++;do;while(ee[++v]===ee[++N]&&ee[++v]===ee[++N]&&ee[++v]===ee[++N]&&ee[++v]===ee[++N]&&ee[++v]===ee[++N]&&ee[++v]===ee[++N]&&ee[++v]===ee[++N]&&ee[++v]===ee[++N]&&vU&&--T!=0);return x<=D.lookahead?x:D.lookahead}function oe(D){var V,N,I,T,v,x,R,U,ee,Z,K=D.w_size;do{if(T=D.window_size-D.lookahead-D.strstart,D.strstart>=K+(K-O)){for(i.arraySet(D.window,D.window,K,K,0),D.match_start-=K,D.strstart-=K,D.block_start-=K,V=N=D.hash_size;I=D.head[--V],D.head[V]=K<=I?I-K:0,--N;);for(V=N=K;I=D.prev[--V],D.prev[V]=K<=I?I-K:0,--N;);T+=K}if(D.strm.avail_in===0)break;if(x=D.strm,R=D.window,U=D.strstart+D.lookahead,ee=T,Z=void 0,Z=x.avail_in,ee=k)for(v=D.strstart-D.insert,D.ins_h=D.window[v],D.ins_h=(D.ins_h<=k&&(D.ins_h=(D.ins_h<=k)if(I=o._tr_tally(D,D.strstart-D.match_start,D.match_length-k),D.lookahead-=D.match_length,D.match_length<=D.max_lazy_match&&D.lookahead>=k){for(D.match_length--;D.strstart++,D.ins_h=(D.ins_h<=k&&(D.ins_h=(D.ins_h<=k&&D.match_length<=D.prev_length){for(T=D.strstart+D.lookahead-k,I=o._tr_tally(D,D.strstart-1-D.prev_match,D.prev_length-k),D.lookahead-=D.prev_length-1,D.prev_length-=2;++D.strstart<=T&&(D.ins_h=(D.ins_h<D.pending_buf_size-5&&(N=D.pending_buf_size-5);;){if(D.lookahead<=1){if(oe(D),D.lookahead===0&&V===c)return _;if(D.lookahead===0)break}D.strstart+=D.lookahead,D.lookahead=0;var I=D.block_start+N;if((D.strstart===0||D.strstart>=I)&&(D.lookahead=D.strstart-I,D.strstart=I,G(D,!1),D.strm.avail_out===0)||D.strstart-D.block_start>=D.w_size-O&&(G(D,!1),D.strm.avail_out===0))return _}return D.insert=0,V===f?(G(D,!0),D.strm.avail_out===0?F:J):(D.strstart>D.block_start&&(G(D,!1),D.strm.avail_out),_)}),new L(4,4,8,4,ae),new L(4,5,16,8,ae),new L(4,6,32,32,ae),new L(4,4,16,16,he),new L(8,16,32,32,he),new L(8,16,128,128,he),new L(8,32,128,256,he),new L(32,128,258,1024,he),new L(32,258,258,4096,he)],r.deflateInit=function(D,V){return fe(D,V,y,15,8,0)},r.deflateInit2=fe,r.deflateReset=ne,r.deflateResetKeep=re,r.deflateSetHeader=function(D,V){return D&&D.state?D.state.wrap!==2?p:(D.state.gzhead=V,h):p},r.deflate=function(D,V){var N,I,T,v;if(!D||!D.state||5>8&255),X(I,I.gzhead.time>>16&255),X(I,I.gzhead.time>>24&255),X(I,I.level===9?2:2<=I.strategy||I.level<2?4:0),X(I,255&I.gzhead.os),I.gzhead.extra&&I.gzhead.extra.length&&(X(I,255&I.gzhead.extra.length),X(I,I.gzhead.extra.length>>8&255)),I.gzhead.hcrc&&(D.adler=a(D.adler,I.pending_buf,I.pending,0)),I.gzindex=0,I.status=69):(X(I,0),X(I,0),X(I,0),X(I,0),X(I,0),X(I,I.level===9?2:2<=I.strategy||I.level<2?4:0),X(I,3),I.status=Y);else{var x=y+(I.w_bits-8<<4)<<8;x|=(2<=I.strategy||I.level<2?0:I.level<6?1:I.level===6?2:3)<<6,I.strstart!==0&&(x|=32),x+=31-x%31,I.status=Y,q(I,x),I.strstart!==0&&(q(I,D.adler>>>16),q(I,65535&D.adler)),D.adler=1}if(I.status===69)if(I.gzhead.extra){for(T=I.pending;I.gzindex<(65535&I.gzhead.extra.length)&&(I.pending!==I.pending_buf_size||(I.gzhead.hcrc&&I.pending>T&&(D.adler=a(D.adler,I.pending_buf,I.pending-T,T)),z(D),T=I.pending,I.pending!==I.pending_buf_size));)X(I,255&I.gzhead.extra[I.gzindex]),I.gzindex++;I.gzhead.hcrc&&I.pending>T&&(D.adler=a(D.adler,I.pending_buf,I.pending-T,T)),I.gzindex===I.gzhead.extra.length&&(I.gzindex=0,I.status=73)}else I.status=73;if(I.status===73)if(I.gzhead.name){T=I.pending;do{if(I.pending===I.pending_buf_size&&(I.gzhead.hcrc&&I.pending>T&&(D.adler=a(D.adler,I.pending_buf,I.pending-T,T)),z(D),T=I.pending,I.pending===I.pending_buf_size)){v=1;break}v=I.gzindexT&&(D.adler=a(D.adler,I.pending_buf,I.pending-T,T)),v===0&&(I.gzindex=0,I.status=91)}else I.status=91;if(I.status===91)if(I.gzhead.comment){T=I.pending;do{if(I.pending===I.pending_buf_size&&(I.gzhead.hcrc&&I.pending>T&&(D.adler=a(D.adler,I.pending_buf,I.pending-T,T)),z(D),T=I.pending,I.pending===I.pending_buf_size)){v=1;break}v=I.gzindexT&&(D.adler=a(D.adler,I.pending_buf,I.pending-T,T)),v===0&&(I.status=103)}else I.status=103;if(I.status===103&&(I.gzhead.hcrc?(I.pending+2>I.pending_buf_size&&z(D),I.pending+2<=I.pending_buf_size&&(X(I,255&D.adler),X(I,D.adler>>8&255),D.adler=0,I.status=Y)):I.status=Y),I.pending!==0){if(z(D),D.avail_out===0)return I.last_flush=-1,h}else if(D.avail_in===0&&H(V)<=H(N)&&V!==f)return j(D,-5);if(I.status===666&&D.avail_in!==0)return j(D,-5);if(D.avail_in!==0||I.lookahead!==0||V!==c&&I.status!==666){var R=I.strategy===2?(function(U,ee){for(var Z;;){if(U.lookahead===0&&(oe(U),U.lookahead===0)){if(ee===c)return _;break}if(U.match_length=0,Z=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++,Z&&(G(U,!1),U.strm.avail_out===0))return _}return U.insert=0,ee===f?(G(U,!0),U.strm.avail_out===0?F:J):U.last_lit&&(G(U,!1),U.strm.avail_out===0)?_:W})(I,V):I.strategy===3?(function(U,ee){for(var Z,K,te,ie,se=U.window;;){if(U.lookahead<=B){if(oe(U),U.lookahead<=B&&ee===c)return _;if(U.lookahead===0)break}if(U.match_length=0,U.lookahead>=k&&0U.lookahead&&(U.match_length=U.lookahead)}if(U.match_length>=k?(Z=o._tr_tally(U,1,U.match_length-k),U.lookahead-=U.match_length,U.strstart+=U.match_length,U.match_length=0):(Z=o._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++),Z&&(G(U,!1),U.strm.avail_out===0))return _}return U.insert=0,ee===f?(G(U,!0),U.strm.avail_out===0?F:J):U.last_lit&&(G(U,!1),U.strm.avail_out===0)?_:W})(I,V):n[I.level].func(I,V);if(R!==F&&R!==J||(I.status=666),R===_||R===F)return D.avail_out===0&&(I.last_flush=-1),h;if(R===W&&(V===1?o._tr_align(I):V!==5&&(o._tr_stored_block(I,0,0,!1),V===3&&($(I.head),I.lookahead===0&&(I.strstart=0,I.block_start=0,I.insert=0))),z(D),D.avail_out===0))return I.last_flush=-1,h}return V!==f?h:I.wrap<=0?1:(I.wrap===2?(X(I,255&D.adler),X(I,D.adler>>8&255),X(I,D.adler>>16&255),X(I,D.adler>>24&255),X(I,255&D.total_in),X(I,D.total_in>>8&255),X(I,D.total_in>>16&255),X(I,D.total_in>>24&255)):(q(I,D.adler>>>16),q(I,65535&D.adler)),z(D),0=N.w_size&&(v===0&&($(N.head),N.strstart=0,N.block_start=0,N.insert=0),ee=new i.Buf8(N.w_size),i.arraySet(ee,V,Z-N.w_size,N.w_size,0),V=ee,Z=N.w_size),x=D.avail_in,R=D.next_in,U=D.input,D.avail_in=Z,D.next_in=0,D.input=V,oe(N);N.lookahead>=k;){for(I=N.strstart,T=N.lookahead-(k-1);N.ins_h=(N.ins_h<>>=k=A>>>24,w-=k,(k=A>>>16&255)===0)W[u++]=65535&A;else{if(!(16&k)){if((64&k)==0){A=E[(65535&A)+(y&(1<>>=k,w-=k),w<15&&(y+=_[s++]<>>=k=A>>>24,w-=k,!(16&(k=A>>>16&255))){if((64&k)==0){A=b[(65535&A)+(y&(1<>>=k,w-=k,(k=u-c)>3,y&=(1<<(w-=B<<3))-1,n.next_in=s,n.next_out=u,n.avail_in=s>>24&255)+(P>>>8&65280)+((65280&P)<<8)+((255&P)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(P){var Y;return P&&P.state?(Y=P.state,P.total_in=P.total_out=Y.total=0,P.msg="",Y.wrap&&(P.adler=1&Y.wrap),Y.mode=p,Y.last=0,Y.havedict=0,Y.dmax=32768,Y.head=null,Y.hold=0,Y.bits=0,Y.lencode=Y.lendyn=new n.Buf32(d),Y.distcode=Y.distdyn=new n.Buf32(m),Y.sane=1,Y.back=-1,f):h}function E(P){var Y;return P&&P.state?((Y=P.state).wsize=0,Y.whave=0,Y.wnext=0,w(P)):h}function b(P,Y){var _,W;return P&&P.state?(W=P.state,Y<0?(_=0,Y=-Y):(_=1+(Y>>4),Y<48&&(Y&=15)),Y&&(Y<8||15=J.wsize?(n.arraySet(J.window,Y,_-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):(W<(F=J.wsize-J.wnext)&&(F=W),n.arraySet(J.window,Y,_-W,F,J.wnext),(W-=F)?(n.arraySet(J.window,Y,_-W,W,0),J.wnext=W,J.whave=J.wsize):(J.wnext+=F,J.wnext===J.wsize&&(J.wnext=0),J.whave>>8&255,_.check=o(_.check,v,2,0),G=z=0,_.mode=2;break}if(_.flags=0,_.head&&(_.head.done=!1),!(1&_.wrap)||(((255&z)<<8)+(z>>8))%31){P.msg="incorrect header check",_.mode=30;break}if((15&z)!=8){P.msg="unknown compression method",_.mode=30;break}if(G-=4,D=8+(15&(z>>>=4)),_.wbits===0)_.wbits=D;else if(D>_.wbits){P.msg="invalid window size",_.mode=30;break}_.dmax=1<>8&1),512&_.flags&&(v[0]=255&z,v[1]=z>>>8&255,_.check=o(_.check,v,2,0)),G=z=0,_.mode=3;case 3:for(;G<32;){if(H===0)break e;H--,z+=W[J++]<>>8&255,v[2]=z>>>16&255,v[3]=z>>>24&255,_.check=o(_.check,v,4,0)),G=z=0,_.mode=4;case 4:for(;G<16;){if(H===0)break e;H--,z+=W[J++]<>8),512&_.flags&&(v[0]=255&z,v[1]=z>>>8&255,_.check=o(_.check,v,2,0)),G=z=0,_.mode=5;case 5:if(1024&_.flags){for(;G<16;){if(H===0)break e;H--,z+=W[J++]<>>8&255,_.check=o(_.check,v,2,0)),G=z=0}else _.head&&(_.head.extra=null);_.mode=6;case 6:if(1024&_.flags&&(H<(Q=_.length)&&(Q=H),Q&&(_.head&&(D=_.head.extra_len-_.length,_.head.extra||(_.head.extra=new Array(_.head.extra_len)),n.arraySet(_.head.extra,W,J,Q,D)),512&_.flags&&(_.check=o(_.check,W,Q,J)),H-=Q,J+=Q,_.length-=Q),_.length))break e;_.length=0,_.mode=7;case 7:if(2048&_.flags){if(H===0)break e;for(Q=0;D=W[J+Q++],_.head&&D&&_.length<65536&&(_.head.name+=String.fromCharCode(D)),D&&Q>9&1,_.head.done=!0),P.adler=_.check=0,_.mode=12;break;case 10:for(;G<32;){if(H===0)break e;H--,z+=W[J++]<>>=7&G,G-=7&G,_.mode=27;break}for(;G<3;){if(H===0)break e;H--,z+=W[J++]<>>=1)){case 0:_.mode=14;break;case 1:if(B(_),_.mode=20,Y!==6)break;z>>>=2,G-=2;break e;case 2:_.mode=17;break;case 3:P.msg="invalid block type",_.mode=30}z>>>=2,G-=2;break;case 14:for(z>>>=7&G,G-=7&G;G<32;){if(H===0)break e;H--,z+=W[J++]<>>16^65535)){P.msg="invalid stored block lengths",_.mode=30;break}if(_.length=65535&z,G=z=0,_.mode=15,Y===6)break e;case 15:_.mode=16;case 16:if(Q=_.length){if(H>>=5,G-=5,_.ndist=1+(31&z),z>>>=5,G-=5,_.ncode=4+(15&z),z>>>=4,G-=4,286<_.nlen||30<_.ndist){P.msg="too many length or distance symbols",_.mode=30;break}_.have=0,_.mode=18;case 18:for(;_.have<_.ncode;){for(;G<3;){if(H===0)break e;H--,z+=W[J++]<>>=3,G-=3}for(;_.have<19;)_.lens[x[_.have++]]=0;if(_.lencode=_.lendyn,_.lenbits=7,N={bits:_.lenbits},V=a(0,_.lens,0,19,_.lencode,0,_.work,N),_.lenbits=N.bits,V){P.msg="invalid code lengths set",_.mode=30;break}_.have=0,_.mode=19;case 19:for(;_.have<_.nlen+_.ndist;){for(;L=(T=_.lencode[z&(1<<_.lenbits)-1])>>>16&255,M=65535&T,!((he=T>>>24)<=G);){if(H===0)break e;H--,z+=W[J++]<>>=he,G-=he,_.lens[_.have++]=M;else{if(M===16){for(I=he+2;G>>=he,G-=he,_.have===0){P.msg="invalid bit length repeat",_.mode=30;break}D=_.lens[_.have-1],Q=3+(3&z),z>>>=2,G-=2}else if(M===17){for(I=he+3;G>>=he)),z>>>=3,G-=3}else{for(I=he+7;G>>=he)),z>>>=7,G-=7}if(_.have+Q>_.nlen+_.ndist){P.msg="invalid bit length repeat",_.mode=30;break}for(;Q--;)_.lens[_.have++]=D}}if(_.mode===30)break;if(_.lens[256]===0){P.msg="invalid code -- missing end-of-block",_.mode=30;break}if(_.lenbits=9,N={bits:_.lenbits},V=a(u,_.lens,0,_.nlen,_.lencode,0,_.work,N),_.lenbits=N.bits,V){P.msg="invalid literal/lengths set",_.mode=30;break}if(_.distbits=6,_.distcode=_.distdyn,N={bits:_.distbits},V=a(c,_.lens,_.nlen,_.ndist,_.distcode,0,_.work,N),_.distbits=N.bits,V){P.msg="invalid distances set",_.mode=30;break}if(_.mode=20,Y===6)break e;case 20:_.mode=21;case 21:if(6<=H&&258<=$){P.next_out=j,P.avail_out=$,P.next_in=J,P.avail_in=H,_.hold=z,_.bits=G,s(P,q),j=P.next_out,F=P.output,$=P.avail_out,J=P.next_in,W=P.input,H=P.avail_in,z=_.hold,G=_.bits,_.mode===12&&(_.back=-1);break}for(_.back=0;L=(T=_.lencode[z&(1<<_.lenbits)-1])>>>16&255,M=65535&T,!((he=T>>>24)<=G);){if(H===0)break e;H--,z+=W[J++]<>re)])>>>16&255,M=65535&T,!(re+(he=T>>>24)<=G);){if(H===0)break e;H--,z+=W[J++]<>>=re,G-=re,_.back+=re}if(z>>>=he,G-=he,_.back+=he,_.length=M,L===0){_.mode=26;break}if(32&L){_.back=-1,_.mode=12;break}if(64&L){P.msg="invalid literal/length code",_.mode=30;break}_.extra=15&L,_.mode=22;case 22:if(_.extra){for(I=_.extra;G>>=_.extra,G-=_.extra,_.back+=_.extra}_.was=_.length,_.mode=23;case 23:for(;L=(T=_.distcode[z&(1<<_.distbits)-1])>>>16&255,M=65535&T,!((he=T>>>24)<=G);){if(H===0)break e;H--,z+=W[J++]<>re)])>>>16&255,M=65535&T,!(re+(he=T>>>24)<=G);){if(H===0)break e;H--,z+=W[J++]<>>=re,G-=re,_.back+=re}if(z>>>=he,G-=he,_.back+=he,64&L){P.msg="invalid distance code",_.mode=30;break}_.offset=M,_.extra=15&L,_.mode=24;case 24:if(_.extra){for(I=_.extra;G>>=_.extra,G-=_.extra,_.back+=_.extra}if(_.offset>_.dmax){P.msg="invalid distance too far back",_.mode=30;break}_.mode=25;case 25:if($===0)break e;if(Q=q-$,_.offset>Q){if((Q=_.offset-Q)>_.whave&&_.sane){P.msg="invalid distance too far back",_.mode=30;break}oe=Q>_.wnext?(Q-=_.wnext,_.wsize-Q):_.wnext-Q,Q>_.length&&(Q=_.length),ae=_.window}else ae=F,oe=j-_.offset,Q=_.length;for($S?(k=oe[ae+m[Y]],G[X+m[Y]]):(k=96,0),y=1<>j)+(w-=y)]=A<<24|k<<16|B|0,w!==0;);for(y=1<>=1;if(y!==0?(z&=y-1,z+=y):z=0,Y++,--q[P]==0){if(P===W)break;P=c[f+m[Y]]}if(F>>7)]}function X(T,v){T.pending_buf[T.pending++]=255&v,T.pending_buf[T.pending++]=v>>>8&255}function q(T,v,x){T.bi_valid>g-x?(T.bi_buf|=v<>g-T.bi_valid,T.bi_valid+=x-g):(T.bi_buf|=v<>>=1,x<<=1,0<--v;);return x>>>1}function ae(T,v,x){var R,U,ee=new Array(m+1),Z=0;for(R=1;R<=m;R++)ee[R]=Z=Z+x[R-1]<<1;for(U=0;U<=v;U++){var K=T[2*U+1];K!==0&&(T[2*U]=oe(ee[K]++,K))}}function he(T){var v;for(v=0;v>1;1<=x;x--)re(T,ee,x);for(U=te;x=T.heap[1],T.heap[1]=T.heap[T.heap_len--],re(T,ee,1),R=T.heap[1],T.heap[--T.heap_max]=x,T.heap[--T.heap_max]=R,ee[2*U]=ee[2*x]+ee[2*R],T.depth[U]=(T.depth[x]>=T.depth[R]?T.depth[x]:T.depth[R])+1,ee[2*x+1]=ee[2*R+1]=U,T.heap[1]=U++,re(T,ee,1),2<=T.heap_len;);T.heap[--T.heap_max]=T.heap[1],(function(se,de){var xe,Te,Ae,Se,Pe,Ie,Qe=de.dyn_tree,$n=de.max_code,cr=de.stat_desc.static_tree,lu=de.stat_desc.has_stree,vh=de.stat_desc.extra_bits,uu=de.stat_desc.extra_base,ki=de.stat_desc.max_length,Di=0;for(Se=0;Se<=m;Se++)se.bl_count[Se]=0;for(Qe[2*se.heap[se.heap_max]+1]=0,xe=se.heap_max+1;xe>=7;U>>=1)if(1&ie&&K.dyn_ltree[2*te]!==0)return i;if(K.dyn_ltree[18]!==0||K.dyn_ltree[20]!==0||K.dyn_ltree[26]!==0)return o;for(te=32;te>>3,(ee=T.static_len+3+7>>>3)<=U&&(U=ee)):U=ee=x+5,x+4<=U&&v!==-1?I(T,v,x,R):T.strategy===4||ee===U?(q(T,2+(R?1:0),3),ne(T,O,P)):(q(T,4+(R?1:0),3),(function(K,te,ie,se){var de;for(q(K,te-257,5),q(K,ie-1,5),q(K,se-4,4),de=0;de>>8&255,T.pending_buf[T.d_buf+2*T.last_lit+1]=255&v,T.pending_buf[T.l_buf+T.last_lit]=255&x,T.last_lit++,v===0?T.dyn_ltree[2*x]++:(T.matches++,v--,T.dyn_ltree[2*(_[x]+c+1)]++,T.dyn_dtree[2*G(v)]++),T.last_lit===T.lit_bufsize-1},r._tr_align=function(T){q(T,2,3),Q(T,w,O),(function(v){v.bi_valid===16?(X(v,v.bi_buf),v.bi_buf=0,v.bi_valid=0):8<=v.bi_valid&&(v.pending_buf[v.pending++]=255&v.bi_buf,v.bi_buf>>=8,v.bi_valid-=8)})(T)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(n){(function(i,o){"use strict";if(!i.setImmediate){var s,a,u,c,f=1,h={},p=!1,d=i.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(i);m=m&&m.setTimeout?m:i,s={}.toString.call(i.process)==="[object process]"?function(E){process.nextTick(function(){y(E)})}:(function(){if(i.postMessage&&!i.importScripts){var E=!0,b=i.onmessage;return i.onmessage=function(){E=!1},i.postMessage("","*"),i.onmessage=b,E}})()?(c="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(E){i.postMessage(c+E,"*")}):i.MessageChannel?((u=new MessageChannel).port1.onmessage=function(E){y(E.data)},function(E){u.port2.postMessage(E)}):d&&"onreadystatechange"in d.createElement("script")?(a=d.documentElement,function(E){var b=d.createElement("script");b.onreadystatechange=function(){y(E),b.onreadystatechange=null,a.removeChild(b),b=null},a.appendChild(b)}):function(E){setTimeout(y,0,E)},m.setImmediate=function(E){typeof E!="function"&&(E=new Function(""+E));for(var b=new Array(arguments.length-1),C=0;C"u"?n===void 0?this:n:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})});var vp=pe(bc=>{var OD=T2(),RD=yp();bc.openArrayBuffer=ID;bc.splitPath=FD;bc.joinPath=MD;function ID(e){return RD.loadAsync(e).then(function(t){function r(s){return t.file(s)!==null}function n(s,a){return t.file(s).async("uint8array").then(function(u){if(a==="base64")return OD.fromByteArray(u);if(a){var c=new TextDecoder(a);return c.decode(u)}else return u})}function i(s,a){t.file(s,a)}function o(){return t.generateAsync({type:"arraybuffer"})}return{exists:r,read:n,write:i,toArrayBuffer:o}})}function FD(e){var t=e.lastIndexOf("/");return t===-1?{dirname:"",basename:e}:{dirname:e.substring(0,t),basename:e.substring(t+1)}}function MD(){var e=Array.prototype.filter.call(arguments,function(r){return r}),t=[];return e.forEach(function(r){/^\//.test(r)?t=[r]:t.push(r)}),t.join("/")}});var wp=pe(Ia=>{var _c=(rt(),it(tt));Ia.Element=Qo;Ia.element=function(e,t,r){return new Qo(e,t,r)};Ia.text=function(e){return{type:"text",value:e}};var k2=Ia.emptyElement={first:function(){return null},firstOrEmpty:function(){return k2},attributes:{},children:[]};function Qo(e,t,r){this.type="element",this.name=e,this.attributes=t||{},this.children=r||[]}Qo.prototype.first=function(e){return _c.find(this.children,function(t){return t.name===e})};Qo.prototype.firstOrEmpty=function(e){return this.first(e)||k2};Qo.prototype.getElementsByTagName=function(e){var t=_c.filter(this.children,function(r){return r.name===e});return D2(t)};Qo.prototype.text=function(){if(this.children.length===0)return"";if(this.children.length!==1||this.children[0].type!=="text")throw new Error("Not implemented");return this.children[0].value};var BD={getElementsByTagName:function(e){return D2(_c.flatten(this.map(function(t){return t.getElementsByTagName(e)},!0)))}};function D2(e){return _c.extend(e,BD)}});var es=pe(An=>{"use strict";function LD(e,t,r){if(r===void 0&&(r=Array.prototype),e&&typeof r.find=="function")return r.find.call(e,t);for(var n=0;n{var xp=es(),Zr=xp.find,Ma=xp.NAMESPACE,ts=xp.tagNamePattern;function UD(e){return e!==""}function qD(e){return e?e.split(/[\t\n\f\r ]+/).filter(UD):[]}function jD(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function R2(e){if(!e)return[];var t=qD(e);return Object.keys(t.reduce(jD,{}))}function HD(e){return function(t){return e&&e.indexOf(t)!==-1}}function La(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function nr(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,La(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var ir={},_r=ir.ELEMENT_NODE=1,rs=ir.ATTRIBUTE_NODE=2,Fa=ir.TEXT_NODE=3,U2=ir.CDATA_SECTION_NODE=4,q2=ir.ENTITY_REFERENCE_NODE=5,WD=ir.ENTITY_NODE=6,Ep=ir.PROCESSING_INSTRUCTION_NODE=7,Ap=ir.COMMENT_NODE=8,j2=ir.DOCUMENT_NODE=9,H2=ir.DOCUMENT_TYPE_NODE=10,Sn=ir.DOCUMENT_FRAGMENT_NODE=11,VD=ir.NOTATION_NODE=12,Rt={},mt={},eJ=Rt.INDEX_SIZE_ERR=(mt[1]="Index size error",1),tJ=Rt.DOMSTRING_SIZE_ERR=(mt[2]="DOMString size error",2),rr=Rt.HIERARCHY_REQUEST_ERR=(mt[3]="Hierarchy request error",3),rJ=Rt.WRONG_DOCUMENT_ERR=(mt[4]="Wrong document",4),I2=Rt.INVALID_CHARACTER_ERR=(mt[5]="Invalid character",5),nJ=Rt.NO_DATA_ALLOWED_ERR=(mt[6]="No data allowed",6),iJ=Rt.NO_MODIFICATION_ALLOWED_ERR=(mt[7]="No modification allowed",7),W2=Rt.NOT_FOUND_ERR=(mt[8]="Not found",8),oJ=Rt.NOT_SUPPORTED_ERR=(mt[9]="Not supported",9),F2=Rt.INUSE_ATTRIBUTE_ERR=(mt[10]="Attribute in use",10),Br=Rt.INVALID_STATE_ERR=(mt[11]="Invalid state",11),sJ=Rt.SYNTAX_ERR=(mt[12]="Syntax error",12),aJ=Rt.INVALID_MODIFICATION_ERR=(mt[13]="Invalid modification",13),lJ=Rt.NAMESPACE_ERR=(mt[14]="Invalid namespace",14),uJ=Rt.INVALID_ACCESS_ERR=(mt[15]="Invalid access",15);function Me(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,mt[e]),this.message=mt[e],Error.captureStackTrace&&Error.captureStackTrace(this,Me);return r.code=e,t&&(this.message=this.message+": "+t),r}Me.prototype=Error.prototype;La(Rt,Me);function Tn(){}Tn.prototype={length:0,item:function(e){return e>=0&&e=0){for(var i=t.length-1;n0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&r[n]===e)return n}t=t.nodeType==rs?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==rs?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}};function $2(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}La(ir,We);La(ir,We.prototype);function Sc(e,t){return pt(e,null,{enter:function(r){return t(r)?pt.STOP:!0}})===pt.STOP}function pt(e,t,r){for(var n=[{node:e,context:t,phase:pt.ENTER}];n.length>0;){var i=n.pop();if(i.phase===pt.ENTER){var o=r.enter(i.node,i.context);if(o===pt.STOP)return pt.STOP;if(n.push({node:i.node,context:o,phase:pt.EXIT}),o==null)continue;for(var s=i.node.lastChild;s;)n.push({node:s,context:o,phase:pt.ENTER}),s=s.previousSibling}else r.exit&&r.exit(i.node,i.context)}}pt.STOP=Symbol("walkDOM.STOP");pt.ENTER=0;pt.EXIT=1;function Pa(){this.ownerDocument=this}function KD(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Ma.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function X2(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===Ma.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function kc(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r)n[n.length++]=r;else{for(var i=t.firstChild,o=0;i;)n[o++]=i,i=i.nextSibling;n.length=o,delete n[n.length]}}}function Z2(e,t){var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,kc(e.ownerDocument,e),t}function $D(e){return e&&(e.nodeType===We.DOCUMENT_NODE||e.nodeType===We.DOCUMENT_FRAGMENT_NODE||e.nodeType===We.ELEMENT_NODE)}function XD(e){return e&&(Jr(e)||Tp(e)||Cn(e)||e.nodeType===We.DOCUMENT_FRAGMENT_NODE||e.nodeType===We.COMMENT_NODE||e.nodeType===We.PROCESSING_INSTRUCTION_NODE)}function Cn(e){return e&&e.nodeType===We.DOCUMENT_TYPE_NODE}function Jr(e){return e&&e.nodeType===We.ELEMENT_NODE}function Tp(e){return e&&e.nodeType===We.TEXT_NODE}function L2(e,t){var r=e.childNodes||[];if(Zr(r,Jr)||Cn(t))return!1;var n=Zr(r,Cn);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function P2(e,t){var r=e.childNodes||[];function n(o){return Jr(o)&&o!==t}if(Zr(r,n))return!1;var i=Zr(r,Cn);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function ZD(e,t,r){if(!$D(e))throw new Me(rr,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new Me(W2,"child not in parent");if(!XD(t)||Cn(t)&&e.nodeType!==We.DOCUMENT_NODE)throw new Me(rr,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function JD(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===We.DOCUMENT_FRAGMENT_NODE){var o=i.filter(Jr);if(o.length>1||Zr(i,Tp))throw new Me(rr,"More than one element or text in fragment");if(o.length===1&&!L2(e,r))throw new Me(rr,"Element in fragment can not be inserted before doctype")}if(Jr(t)&&!L2(e,r))throw new Me(rr,"Only one element can be added and only after doctype");if(Cn(t)){if(Zr(n,Cn))throw new Me(rr,"Only one doctype is allowed");var s=Zr(n,Jr);if(r&&n.indexOf(s)1||Zr(i,Tp))throw new Me(rr,"More than one element or text in fragment");if(o.length===1&&!P2(e,r))throw new Me(rr,"Element in fragment can not be inserted before doctype")}if(Jr(t)&&!P2(e,r))throw new Me(rr,"Only one element can be added and only after doctype");if(Cn(t)){let u=function(c){return Cn(c)&&c!==r};var a=u;if(Zr(n,u))throw new Me(rr,"Only one doctype is allowed");var s=Zr(n,Jr);if(r&&n.indexOf(s)0&&Sc(r.documentElement,function(i){if(i!==r&&i.nodeType===_r){var o=i.getAttribute("class");if(o){var s=e===o;if(!s){var a=R2(o);s=t.every(HD(a))}s&&n.push(i)}}}),n})},createElement:function(e){var t=new Xi;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new Tn;var r=t.attributes=new Ac;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new Nc;return e.ownerDocument=this,e.childNodes=new Tn,e},createTextNode:function(e){var t=new Cp;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new kp;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new Me(I2,'data contains "]]>"');var t=new Dp;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new Op;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new Cc;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){if(!ts.test(e))throw new Me(I2,'not a valid xml name "'+e+'"');var t=new Np;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Xi,n=t.split(":"),i=r.attributes=new Ac;return r.childNodes=new Tn,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,i._ownerElement=r,r},createAttributeNS:function(e,t){var r=new Cc,n=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,r}};nr(Pa,We);function Xi(){this._nsMap={}}Xi.prototype={nodeType:_r,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===Sn?this.insertBefore(e,null):YD(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return this.getAttributeNodeNS(e,t)!=null},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new ns(this,function(t){var r=[];return Sc(t,function(n){n!==t&&n.nodeType==_r&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new ns(this,function(r){var n=[];return Sc(r,function(i){i!==r&&i.nodeType===_r&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};Pa.prototype.getElementsByTagName=Xi.prototype.getElementsByTagName;Pa.prototype.getElementsByTagNameNS=Xi.prototype.getElementsByTagNameNS;nr(Xi,We);function Cc(){}Cc.prototype.nodeType=rs;nr(Cc,We);function za(){}za.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(mt[rr])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){var n=this.data.substring(0,e),i=this.data.substring(e+t);r=n+r+i,this.nodeValue=this.data=r,this.length=r.length}};nr(za,We);function Cp(){}Cp.prototype={nodeName:"#text",nodeType:Fa,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};nr(Cp,za);function kp(){}kp.prototype={nodeName:"#comment",nodeType:Ap};nr(kp,za);function Dp(){}Dp.prototype={nodeName:"#cdata-section",nodeType:U2};nr(Dp,za);function Dc(){}Dc.prototype.nodeType=H2;nr(Dc,We);function Y2(){}Y2.prototype.nodeType=VD;nr(Y2,We);function Q2(){}Q2.prototype.nodeType=WD;nr(Q2,We);function Np(){}Np.prototype.nodeType=q2;nr(Np,We);function Nc(){}Nc.prototype.nodeName="#document-fragment";Nc.prototype.nodeType=Sn;nr(Nc,We);function Op(){}Op.prototype.nodeType=Ep;nr(Op,We);function ew(){}ew.prototype.serializeToString=function(e,t,r,n){return tw.call(e,t,r,n)};We.prototype.toString=tw;function tw(e,t,r){var n=!!r&&!!r.requireWellFormed,i=[],o=this.nodeType==9&&this.documentElement||this,s=o.prefix,a=o.namespaceURI;if(a&&s==null){var s=o.lookupPrefix(a);if(s==null)var u=[{namespace:a,prefix:null}]}return Rp(this,i,e,t,u,n),i.join("")}function z2(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===Ma.XML||i===Ma.XMLNS)return!1;for(var o=r.length;o--;){var s=r[o];if(s.prefix===n)return s.namespace!==i}return!0}function Ec(e,t,r,n){if(n&&!ts.test(t))throw new Me(Br,'The attribute name "'+t+'" is not a valid XML QName');e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,$2),'"')}function Rp(e,t,r,n,i,o){i||(i=[]),pt(e,{ns:i,isHTML:r},{enter:function(s,a){var u=a.ns,c=a.isHTML;if(n)if(s=n(s),s){if(typeof s=="string")return t.push(s),null}else return null;switch(s.nodeType){case _r:var f=s.attributes,h=f.length,p=s.tagName;c=Ma.isHTML(s.namespaceURI)||c;var d=p;if(!c&&!s.prefix&&s.namespaceURI){for(var m,g=0;g=0;y--){var w=u[y];if(w.prefix===""&&w.namespace===s.namespaceURI){m=w.namespace;break}}if(m!==s.namespaceURI)for(var y=u.length-1;y>=0;y--){var w=u[y];if(w.namespace===s.namespaceURI){w.prefix&&(d=w.prefix+":"+p);break}}}if(o&&!ts.test(d))throw new Me(Br,'The element name "'+d+'" is not a valid XML QName');t.push("<",d);for(var E=u.slice(),b=0;b"),c&&/^script$/i.test(p)){for(;O;)O.data?t.push(O.data):Rp(O,t,c,n,E.slice(),o),O=O.nextSibling;return t.push(""),null}return{ns:E,isHTML:c,tag:d}}else return t.push("/>"),null;case j2:case Sn:return{ns:u.slice(),isHTML:c,tag:null};case rs:return Ec(t,s.name,s.value,o),null;case Fa:return t.push(s.data.replace(/[<&>]/g,$2)),null;case U2:if(o&&s.data.indexOf("]]>")!==-1)throw new Me(Br,'The CDATASection data contains "]]>"');return t.push("/g,"]]]]>"),"]]>"),null;case Ap:if(o&&s.data.indexOf("-->")!==-1)throw new Me(Br,'The comment node data contains "-->"');return t.push(""),null;case H2:if(o){if(!ts.test(s.name))throw new Me(Br,'The doctype name "'+s.name+'" is not a valid XML Name');if(s.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(s.publicId))throw new Me(Br,"DocumentType publicId is not a valid PubidLiteral");if(s.systemId&&!/^("[^"]*"|'[^']*')$/.test(s.systemId))throw new Me(Br,"DocumentType systemId is not a valid SystemLiteral");if(s.internalSubset&&s.internalSubset.indexOf("]>")!==-1)throw new Me(Br,'DocumentType internalSubset contains "]>"')}var P=s.publicId,Y=s.systemId;if(t.push("");else if(Y&&Y!=".")t.push(" SYSTEM ",Y,">");else{var _=s.internalSubset;_&&t.push(" [",_,"]"),t.push(">")}return null;case Ep:if(o){if(!ts.test(s.target)||s.target.indexOf(":")!==-1||s.target.toLowerCase()==="xml")throw new Me(Br,'The processing instruction target "'+s.target+'" is not a valid XML NCName or is reserved');if(s.data.indexOf("?>")!==-1)throw new Me(Br,'The ProcessingInstruction data contains "?>"')}return t.push(""),null;case q2:if(o&&!ts.test(s.nodeName))throw new Me(Br,'The entity reference name "'+s.nodeName+'" is not a valid XML Name');return t.push("&",s.nodeName,";"),null;default:return t.push("??",s.nodeName),null}},exit:function(s,a){a&&a.tag&&t.push("")}})}function QD(e,t,r){var n;return pt(t,null,{enter:function(i,o){var s=i.cloneNode(!1);s.ownerDocument=e,s.parentNode=null,o===null?n=s:o.appendChild(s);var a=i.nodeType===rs||r;return a?s:null}}),n}function rw(e,t,r){var n;return pt(t,null,{enter:function(i,o){var s=new i.constructor;for(var a in i)if(Object.prototype.hasOwnProperty.call(i,a)){var u=i[a];typeof u!="object"&&u!=s[a]&&(s[a]=u)}i.childNodes&&(s.childNodes=new Tn),s.ownerDocument=e;var c=r;switch(s.nodeType){case _r:var f=i.attributes,h=s.attributes=new Ac,p=f.length;h._ownerElement=s;for(var d=0;d{"use strict";var iw=es().freeze;Ua.XML_ENTITIES=iw({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});Ua.HTML_ENTITIES=iw({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:` +`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});Ua.entityMap=Ua.HTML_ENTITIES});var cw=pe(Fp=>{var Ha=es().NAMESPACE,Ip=es().tagNamePattern,is=0,ai=1,ss=2,qa=3,as=4,ls=5,ja=6,Rc=7;function us(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,us)}us.prototype=new Error;us.prototype.name=us.name;function lw(){}lw.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),i5(t,t={}),e5(e,t,r,n,this.errorHandler),n.endDocument()}};function e5(e,t,r,n,i){function o(j){if(j>65535){j-=65536;var H=55296+(j>>10),$=56320+(j&1023);return String.fromCharCode(H,$)}else return String.fromCharCode(j)}function s(j){var H=j.slice(1,-1);return Object.hasOwnProperty.call(r,H)?r[H]:H.charAt(0)==="#"?o(parseInt(H.substr(1).replace("x","0x"))):(i.error("entity not found:"+j),j)}function a(j){if(j>g){var H=e.substring(g,j).replace(/&#?\w+;/g,s);p&&u(g),n.characters(H,0,j-g),g=j}}function u(j,H){for(;j>=f&&(H=h.exec(e));)c=H.index,f=c+H[0].length,p.lineNumber++;p.columnNumber=j-c+1}for(var c=0,f=0,h=/.*(?:\r\n?|\n)|.*$/g,p=n.locator,d=[{currentNSMap:t}],m={},g=0;;){try{var y=e.indexOf("<",g);if(y<0){if(!e.substr(g).match(/^\s*$/)){var w=n.doc,E=w.createTextNode(e.substr(g));w.appendChild(E),n.currentElement=E}return}switch(y>g&&a(y),e.charAt(y+1)){case"/":var Y=e.indexOf(">",y+3),b=e.substring(y+2,Y).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/,"$1"),C=d.pop();Y<0?(b=e.substring(y+2).replace(/[\s<].*/,""),i.error("end tag name: "+b+" is not complete:"+C.tagName),Y=y+1+b.length):b.match(/\sg?g=Y:a(Math.max(y,g)+1)}}function sw(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function t5(e,t,r,n,i,o){function s(d,m,g){r.attributeNames.hasOwnProperty(d)&&o.fatalError("Attribute "+d+" redefined"),r.addValue(d,m.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),g)}for(var a,u,c=++t,f=is;;){var h=e.charAt(c);if(f===is&&h==="<")throw new Error("unexpected < in tag name: "+e.slice(t,c));switch(h){case"=":if(f===ai)a=e.slice(t,c),f=qa;else if(f===ss)f=qa;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(f===qa||f===ai)if(f===ai&&(o.warning('attribute value must after "="'),a=e.slice(t,c)),t=c+1,c=e.indexOf(h,t),c>0)u=e.slice(t,c),s(a,u,t-1),f=ls;else throw new Error("attribute value no end '"+h+"' match");else if(f==as)u=e.slice(t,c),s(a,u,t),o.warning('attribute "'+a+'" missed start quot('+h+")!!"),t=c+1,f=ls;else throw new Error('attribute value must after "="');break;case"/":switch(f){case is:r.setTagName(e.slice(t,c));case ls:case ja:case Rc:f=Rc,r.closed=!0;case as:case ai:break;case ss:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),f==is&&r.setTagName(e.slice(t,c)),c;case">":switch(f){case is:r.setTagName(e.slice(t,c));case ls:case ja:case Rc:break;case as:case ai:u=e.slice(t,c),u.slice(-1)==="/"&&(r.closed=!0,u=u.slice(0,-1));case ss:f===ss&&(u=a),f==as?(o.warning('attribute "'+u+'" missed quot(")!'),s(a,u,t)):((!Ha.isHTML(n[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),s(u,u,t));break;case qa:throw new Error("attribute value missed!!")}return c;case"\x80":h=" ";default:if(h<=" ")switch(f){case is:r.setTagName(e.slice(t,c)),f=ja;break;case ai:a=e.slice(t,c),f=ss;break;case as:var u=e.slice(t,c);o.warning('attribute "'+u+'" missed quot(")!!'),s(a,u,t);case ls:f=ja;break}else switch(f){case ss:var p=r.tagName;(!Ha.isHTML(n[""])||!a.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),s(a,a,t),t=c,f=ai;break;case ls:o.warning('attribute space is required"'+a+'"!!');case ja:f=ai,t=c;break;case qa:f=as,t=c;break;case Rc:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function aw(e,t,r){for(var n=e.tagName,i=null,h=e.length;h--;){var o=e[h],s=o.qName,a=o.value,p=s.indexOf(":");if(p>0)var u=o.prefix=s.slice(0,p),c=s.slice(p+1),f=u==="xmlns"&&c;else c=s,u=null,f=s==="xmlns"&&"";o.localName=c,f!==!1&&(i==null&&(i={},r=Object.create(r)),r[f]=i[f]=a,o.uri=Ha.XMLNS,t.startPrefixMapping(f,a))}for(var h=e.length;h--;){o=e[h];var u=o.prefix;u&&(u==="xml"&&(o.uri=Ha.XML),u!=="xmlns"&&(o.uri=r[u||""]))}var p=n.indexOf(":");p>0?(u=e.prefix=n.slice(0,p),c=e.localName=n.slice(p+1)):(u=null,c=e.localName=n);var d=e.uri=r[u||""];if(t.startElement(d,c,n,e),e.closed){if(t.endElement(d,c,n),i)for(u in i)Object.prototype.hasOwnProperty.call(i,u)&&t.endPrefixMapping(u)}else return e.currentNSMap=r,e.localNSMap=i,!0}function r5(e,t,r,n,i){if(/^(?:script|textarea)$/i.test(r)){var o=e.indexOf("",t),s=e.substring(t+1,o);if(/[&<]/.test(s))return/^script$/i.test(r)?(i.characters(s,0,s.length),o):(s=s.replace(/&#?\w+;/g,n),i.characters(s,0,s.length),o)}return t+1}function n5(e,t,r,n){var i=n[r];return i==null&&(i=e.lastIndexOf(""),i",t+4);return o>t?(r.comment(e,t+4,o-t-4),o+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(e.substr(t+3,6)=="CDATA["){var o=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,o-t-9),r.endCDATA(),o+3}var s=a5(e,t),a=s.length;if(a>1&&/!doctype/i.test(s[0][0])){var u=s[1][0],c=!1,f=!1;a>3&&(/^public$/i.test(s[2][0])?(c=s[3][0],f=a>4&&s[4][0]):/^system$/i.test(s[2][0])&&(f=s[3][0]));var h=s[a-1];return r.startDTD(u,c,f),r.endDTD(),h.index+h[0].length}}return-1}function s5(e,t,r){var n=e.indexOf("?>",t);if(n){var i=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(i){var o=i[0].length;return r.processingInstruction(i[1],i[2]),n+2}else return-1}return-1}function uw(){this.attributeNames={}}uw.prototype={setTagName:function(e){if(!Ip.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!Ip.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function a5(e,t){var r,n=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=t,i.exec(e);r=i.exec(e);)if(n.push(r),r[1])return n}Fp.XMLReader=lw;Fp.ParseError=us});var yw=pe(Fc=>{var l5=es(),u5=Oc(),fw=ow(),pw=cw(),c5=u5.DOMImplementation,hw=l5.NAMESPACE,f5=pw.ParseError,h5=pw.XMLReader;function mw(e){return e.replace(/\r[\n\u0085]/g,` +`).replace(/[\r\u0085\u2028]/g,` +`)}function gw(e){this.options=e||{locator:{}}}gw.prototype.parseFromString=function(e,t){var r=this.options,n=new h5,i=r.domBuilder||new Wa,o=r.errorHandler,s=r.locator,a=r.xmlns||{},u=/\/x?html?$/.test(t),c=u?fw.HTML_ENTITIES:fw.XML_ENTITIES;s&&i.setDocumentLocator(s),n.errorHandler=d5(o,i,s),n.domBuilder=r.domBuilder||i,u&&(a[""]=hw.HTML),a.xml=a.xml||hw.XML;var f=r.normalizeLineEndings||mw;return e&&typeof e=="string"?n.parse(f(e),a,c):n.errorHandler.error("invalid doc source"),i.doc};function d5(e,t,r){if(!e){if(t instanceof Wa)return t;e=t}var n={},i=e instanceof Function;r=r||{};function o(s){var a=e[s];!a&&i&&(a=e.length==2?function(u){e(s,u)}:e),n[s]=a&&function(u){a("[xmldom "+s+"] "+u+Mp(r))}||function(){}}return o("warning"),o("error"),o("fatalError"),n}function Wa(){this.cdata=!1}function cs(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}Wa.prototype={startDocument:function(){this.doc=new c5().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,n){var i=this.doc,o=i.createElementNS(e,r||t),s=n.length;Ic(this,o),this.currentElement=o,this.locator&&cs(this.locator,o);for(var a=0;a=t+r||t?new java.lang.String(e,t,r)+"":e}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){Wa.prototype[e]=function(){return null}});function Ic(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Fc.__DOMHandler=Wa;Fc.normalizeLineEndings=mw;Fc.DOMParser=gw});var ww=pe(Mc=>{var vw=Oc();Mc.DOMImplementation=vw.DOMImplementation;Mc.XMLSerializer=vw.XMLSerializer;Mc.DOMParser=yw().DOMParser});var bw=pe(Bp=>{var p5=ww(),m5=Oc();function g5(e){var t=null,r=new p5.DOMParser({errorHandler:function(i,o){t={level:i,message:o}}}),n=r.parseFromString(e);if(t===null)return n;throw new Error(t.level+": "+t.message)}Bp.parseFromString=g5;Bp.Node=m5.Node});var Tw=pe(Sw=>{var Lp=En(),_w=(rt(),it(tt)),Ew=bw(),Aw=wp(),y5=Aw.Element;Sw.readString=v5;var xw=Ew.Node;function v5(e,t){t=t||{};try{var r=Ew.parseFromString(e,"text/xml")}catch(s){return Lp.reject(s)}if(r.documentElement.tagName==="parsererror")return Lp.resolve(new Error(r.documentElement.textContent));function n(s){switch(s.nodeType){case xw.ELEMENT_NODE:return i(s);case xw.TEXT_NODE:return Aw.text(s.nodeValue)}}function i(s){var a=o(s),u=[];_w.forEach(s.childNodes,function(f){var h=n(f);h&&u.push(h)});var c=Object.create(null);return _w.forEach(s.attributes,function(f){c[o(f)]=f.value}),new y5(a,c,u)}function o(s){if(s.namespaceURI){var a=t[s.namespaceURI],u;return a?u=a+":":u="{"+s.namespaceURI+"}",u+s.localName}else return s.localName}return Lp.resolve(n(r.documentElement))}});var Dn=pe((Cw,li)=>{(function(){var e,t,r,n,i,o,s,a=[].slice,u={}.hasOwnProperty;e=function(){var c,f,h,p,d,m;if(m=arguments[0],d=2<=arguments.length?a.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(c=0,h=d.length;c{(function(){var e;Dw.exports=e=(function(){function t(r,n,i){if(this.options=r.options,this.stringify=r.stringify,this.parent=r,n==null)throw new Error("Missing attribute name. "+this.debugInfo(n));if(i==null)throw new Error("Missing attribute value. "+this.debugInfo(n));this.name=this.stringify.attName(n),this.value=this.stringify.attValue(i)}return t.prototype.clone=function(){return Object.create(this)},t.prototype.toString=function(r){return this.options.writer.set(r).attribute(this)},t.prototype.debugInfo=function(r){return r=r||this.name,r==null?"parent: <"+this.parent.name+">":"attribute: {"+r+"}, parent: <"+this.parent.name+">"},t})()}).call(kw)});var Va=pe((Nw,Ow)=>{(function(){var e,t,r,n,i,o,s,a=function(c,f){for(var h in f)u.call(f,h)&&(c[h]=f[h]);function p(){this.constructor=c}return p.prototype=f.prototype,c.prototype=new p,c.__super__=f.prototype,c},u={}.hasOwnProperty;s=Dn(),o=s.isObject,i=s.isFunction,n=s.getValue,r=Wt(),e=Pp(),Ow.exports=t=(function(c){a(f,c);function f(h,p,d){if(f.__super__.constructor.call(this,h),p==null)throw new Error("Missing element name. "+this.debugInfo());this.name=this.stringify.eleName(p),this.attributes={},d!=null&&this.attribute(d),h.isDocument&&(this.isRoot=!0,this.documentObject=h,h.rootObject=this)}return f.prototype.clone=function(){var h,p,d,m;d=Object.create(this),d.isRoot&&(d.documentObject=null),d.attributes={},m=this.attributes;for(p in m)u.call(m,p)&&(h=m[p],d.attributes[p]=h.clone());return d.children=[],this.children.forEach(function(g){var y;return y=g.clone(),y.parent=d,d.children.push(y)}),d},f.prototype.attribute=function(h,p){var d,m;if(h!=null&&(h=n(h)),o(h))for(d in h)u.call(h,d)&&(m=h[d],this.attribute(d,m));else i(p)&&(p=p.apply()),(!this.options.skipNullAttributes||p!=null)&&(this.attributes[h]=new e(this,h,p));return this},f.prototype.removeAttribute=function(h){var p,d,m;if(h==null)throw new Error("Missing attribute name. "+this.debugInfo());if(h=n(h),Array.isArray(h))for(d=0,m=h.length;d{(function(){var e,t,r=function(i,o){for(var s in o)n.call(o,s)&&(i[s]=o[s]);function a(){this.constructor=i}return a.prototype=o.prototype,i.prototype=new a,i.__super__=o.prototype,i},n={}.hasOwnProperty;t=Wt(),Iw.exports=e=(function(i){r(o,i);function o(s,a){if(o.__super__.constructor.call(this,s),a==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.text=this.stringify.cdata(a)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(s){return this.options.writer.set(s).cdata(this)},o})(t)}).call(Rw)});var Ka=pe((Fw,Mw)=>{(function(){var e,t,r=function(i,o){for(var s in o)n.call(o,s)&&(i[s]=o[s]);function a(){this.constructor=i}return a.prototype=o.prototype,i.prototype=new a,i.__super__=o.prototype,i},n={}.hasOwnProperty;t=Wt(),Mw.exports=e=(function(i){r(o,i);function o(s,a){if(o.__super__.constructor.call(this,s),a==null)throw new Error("Missing comment text. "+this.debugInfo());this.text=this.stringify.comment(a)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(s){return this.options.writer.set(s).comment(this)},o})(t)}).call(Fw)});var $a=pe((Bw,Lw)=>{(function(){var e,t,r,n=function(o,s){for(var a in s)i.call(s,a)&&(o[a]=s[a]);function u(){this.constructor=o}return u.prototype=s.prototype,o.prototype=new u,o.__super__=s.prototype,o},i={}.hasOwnProperty;r=Dn().isObject,t=Wt(),Lw.exports=e=(function(o){n(s,o);function s(a,u,c,f){var h;s.__super__.constructor.call(this,a),r(u)&&(h=u,u=h.version,c=h.encoding,f=h.standalone),u||(u="1.0"),this.version=this.stringify.xmlVersion(u),c!=null&&(this.encoding=this.stringify.xmlEncoding(c)),f!=null&&(this.standalone=this.stringify.xmlStandalone(f))}return s.prototype.toString=function(a){return this.options.writer.set(a).declaration(this)},s})(t)}).call(Bw)});var Xa=pe((Pw,zw)=>{(function(){var e,t,r=function(i,o){for(var s in o)n.call(o,s)&&(i[s]=o[s]);function a(){this.constructor=i}return a.prototype=o.prototype,i.prototype=new a,i.__super__=o.prototype,i},n={}.hasOwnProperty;t=Wt(),zw.exports=e=(function(i){r(o,i);function o(s,a,u,c,f,h){if(o.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(u==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(a));if(!c)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!f)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(f.indexOf("#")!==0&&(f="#"+f),!f.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(h&&!f.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(a));this.elementName=this.stringify.eleName(a),this.attributeName=this.stringify.attName(u),this.attributeType=this.stringify.dtdAttType(c),this.defaultValue=this.stringify.dtdAttDefault(h),this.defaultValueType=f}return o.prototype.toString=function(s){return this.options.writer.set(s).dtdAttList(this)},o})(t)}).call(Pw)});var Za=pe((Uw,qw)=>{(function(){var e,t,r,n=function(o,s){for(var a in s)i.call(s,a)&&(o[a]=s[a]);function u(){this.constructor=o}return u.prototype=s.prototype,o.prototype=new u,o.__super__=s.prototype,o},i={}.hasOwnProperty;r=Dn().isObject,t=Wt(),qw.exports=e=(function(o){n(s,o);function s(a,u,c,f){if(s.__super__.constructor.call(this,a),c==null)throw new Error("Missing DTD entity name. "+this.debugInfo(c));if(f==null)throw new Error("Missing DTD entity value. "+this.debugInfo(c));if(this.pe=!!u,this.name=this.stringify.eleName(c),!r(f))this.value=this.stringify.dtdEntityValue(f);else{if(!f.pubID&&!f.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(c));if(f.pubID&&!f.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(c));if(f.pubID!=null&&(this.pubID=this.stringify.dtdPubID(f.pubID)),f.sysID!=null&&(this.sysID=this.stringify.dtdSysID(f.sysID)),f.nData!=null&&(this.nData=this.stringify.dtdNData(f.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(c))}}return s.prototype.toString=function(a){return this.options.writer.set(a).dtdEntity(this)},s})(t)}).call(Uw)});var Ja=pe((jw,Hw)=>{(function(){var e,t,r=function(i,o){for(var s in o)n.call(o,s)&&(i[s]=o[s]);function a(){this.constructor=i}return a.prototype=o.prototype,i.prototype=new a,i.__super__=o.prototype,i},n={}.hasOwnProperty;t=Wt(),Hw.exports=e=(function(i){r(o,i);function o(s,a,u){if(o.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());u||(u="(#PCDATA)"),Array.isArray(u)&&(u="("+u.join(",")+")"),this.name=this.stringify.eleName(a),this.value=this.stringify.dtdElementValue(u)}return o.prototype.toString=function(s){return this.options.writer.set(s).dtdElement(this)},o})(t)}).call(jw)});var Ya=pe((Ww,Vw)=>{(function(){var e,t,r=function(i,o){for(var s in o)n.call(o,s)&&(i[s]=o[s]);function a(){this.constructor=i}return a.prototype=o.prototype,i.prototype=new a,i.__super__=o.prototype,i},n={}.hasOwnProperty;t=Wt(),Vw.exports=e=(function(i){r(o,i);function o(s,a,u){if(o.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD notation name. "+this.debugInfo(a));if(!u.pubID&&!u.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(a));this.name=this.stringify.eleName(a),u.pubID!=null&&(this.pubID=this.stringify.dtdPubID(u.pubID)),u.sysID!=null&&(this.sysID=this.stringify.dtdSysID(u.sysID))}return o.prototype.toString=function(s){return this.options.writer.set(s).dtdNotation(this)},o})(t)}).call(Ww)});var Qa=pe((Gw,Kw)=>{(function(){var e,t,r,n,i,o,s,a=function(c,f){for(var h in f)u.call(f,h)&&(c[h]=f[h]);function p(){this.constructor=c}return p.prototype=f.prototype,c.prototype=new p,c.__super__=f.prototype,c},u={}.hasOwnProperty;s=Dn().isObject,o=Wt(),e=Xa(),r=Za(),t=Ja(),n=Ya(),Kw.exports=i=(function(c){a(f,c);function f(h,p,d){var m,g;f.__super__.constructor.call(this,h),this.name="!DOCTYPE",this.documentObject=h,s(p)&&(m=p,p=m.pubID,d=m.sysID),d==null&&(g=[p,d],d=g[0],p=g[1]),p!=null&&(this.pubID=this.stringify.dtdPubID(p)),d!=null&&(this.sysID=this.stringify.dtdSysID(d))}return f.prototype.element=function(h,p){var d;return d=new t(this,h,p),this.children.push(d),this},f.prototype.attList=function(h,p,d,m,g){var y;return y=new e(this,h,p,d,m,g),this.children.push(y),this},f.prototype.entity=function(h,p){var d;return d=new r(this,!1,h,p),this.children.push(d),this},f.prototype.pEntity=function(h,p){var d;return d=new r(this,!0,h,p),this.children.push(d),this},f.prototype.notation=function(h,p){var d;return d=new n(this,h,p),this.children.push(d),this},f.prototype.toString=function(h){return this.options.writer.set(h).docType(this)},f.prototype.ele=function(h,p){return this.element(h,p)},f.prototype.att=function(h,p,d,m,g){return this.attList(h,p,d,m,g)},f.prototype.ent=function(h,p){return this.entity(h,p)},f.prototype.pent=function(h,p){return this.pEntity(h,p)},f.prototype.not=function(h,p){return this.notation(h,p)},f.prototype.up=function(){return this.root()||this.documentObject},f})(o)}).call(Gw)});var el=pe(($w,Xw)=>{(function(){var e,t,r=function(i,o){for(var s in o)n.call(o,s)&&(i[s]=o[s]);function a(){this.constructor=i}return a.prototype=o.prototype,i.prototype=new a,i.__super__=o.prototype,i},n={}.hasOwnProperty;e=Wt(),Xw.exports=t=(function(i){r(o,i);function o(s,a){if(o.__super__.constructor.call(this,s),a==null)throw new Error("Missing raw text. "+this.debugInfo());this.value=this.stringify.raw(a)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(s){return this.options.writer.set(s).raw(this)},o})(e)}).call($w)});var tl=pe((Zw,Jw)=>{(function(){var e,t,r=function(i,o){for(var s in o)n.call(o,s)&&(i[s]=o[s]);function a(){this.constructor=i}return a.prototype=o.prototype,i.prototype=new a,i.__super__=o.prototype,i},n={}.hasOwnProperty;e=Wt(),Jw.exports=t=(function(i){r(o,i);function o(s,a){if(o.__super__.constructor.call(this,s),a==null)throw new Error("Missing element text. "+this.debugInfo());this.value=this.stringify.eleText(a)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(s){return this.options.writer.set(s).text(this)},o})(e)}).call(Zw)});var rl=pe((Yw,Qw)=>{(function(){var e,t,r=function(i,o){for(var s in o)n.call(o,s)&&(i[s]=o[s]);function a(){this.constructor=i}return a.prototype=o.prototype,i.prototype=new a,i.__super__=o.prototype,i},n={}.hasOwnProperty;e=Wt(),Qw.exports=t=(function(i){r(o,i);function o(s,a,u){if(o.__super__.constructor.call(this,s),a==null)throw new Error("Missing instruction target. "+this.debugInfo());this.target=this.stringify.insTarget(a),u&&(this.value=this.stringify.insValue(u))}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(s){return this.options.writer.set(s).processingInstruction(this)},o})(e)}).call(Yw)});var Bc=pe((eb,tb)=>{(function(){var e,t,r=function(i,o){for(var s in o)n.call(o,s)&&(i[s]=o[s]);function a(){this.constructor=i}return a.prototype=o.prototype,i.prototype=new a,i.__super__=o.prototype,i},n={}.hasOwnProperty;t=Wt(),tb.exports=e=(function(i){r(o,i);function o(s){o.__super__.constructor.call(this,s),this.isDummy=!0}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(s){return""},o})(t)}).call(eb)});var Wt=pe((rb,nb)=>{(function(){var e,t,r,n,i,o,s,a,u,c,f,h,p,d,m,g={}.hasOwnProperty;m=Dn(),d=m.isObject,p=m.isFunction,h=m.isEmpty,f=m.getValue,o=null,e=null,t=null,r=null,n=null,u=null,c=null,a=null,i=null,nb.exports=s=(function(){function y(w){this.parent=w,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.children=[],o||(o=Va(),e=Ga(),t=Ka(),r=$a(),n=Qa(),u=el(),c=tl(),a=rl(),i=Bc())}return y.prototype.element=function(w,E,b){var C,S,A,k,B,O,P,Y,_,W,F;if(O=null,E===null&&b==null&&(_=[{},null],E=_[0],b=_[1]),E==null&&(E={}),E=f(E),d(E)||(W=[E,b],b=W[0],E=W[1]),w!=null&&(w=f(w)),Array.isArray(w))for(A=0,P=w.length;A0&&this.parent.children[w-1].isDummy;)w=w-1;if(w<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[w-1]},y.prototype.next=function(){var w;for(w=this.parent.children.indexOf(this);w":(b=this.parent)!=null&&b.name?"node: <"+w+">, parent: <"+this.parent.name+">":"node: <"+w+">"},y.prototype.ele=function(w,E,b){return this.element(w,E,b)},y.prototype.nod=function(w,E,b){return this.node(w,E,b)},y.prototype.txt=function(w){return this.text(w)},y.prototype.dat=function(w){return this.cdata(w)},y.prototype.com=function(w){return this.comment(w)},y.prototype.ins=function(w,E){return this.instruction(w,E)},y.prototype.doc=function(){return this.document()},y.prototype.dec=function(w,E,b){return this.declaration(w,E,b)},y.prototype.dtd=function(w,E){return this.doctype(w,E)},y.prototype.e=function(w,E,b){return this.element(w,E,b)},y.prototype.n=function(w,E,b){return this.node(w,E,b)},y.prototype.t=function(w){return this.text(w)},y.prototype.d=function(w){return this.cdata(w)},y.prototype.c=function(w){return this.comment(w)},y.prototype.r=function(w){return this.raw(w)},y.prototype.i=function(w,E){return this.instruction(w,E)},y.prototype.u=function(){return this.up()},y.prototype.importXMLBuilder=function(w){return this.importDocument(w)},y})()}).call(rb)});var zp=pe((ib,ob)=>{(function(){var e,t=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;ob.exports=e=(function(){function n(i){this.assertLegalChar=t(this.assertLegalChar,this);var o,s,a;i||(i={}),this.noDoubleEncoding=i.noDoubleEncoding,s=i.stringify||{};for(o in s)r.call(s,o)&&(a=s[o],this[o]=a)}return n.prototype.eleName=function(i){return i=""+i||"",this.assertLegalChar(i)},n.prototype.eleText=function(i){return i=""+i||"",this.assertLegalChar(this.elEscape(i))},n.prototype.cdata=function(i){return i=""+i||"",i=i.replace("]]>","]]]]>"),this.assertLegalChar(i)},n.prototype.comment=function(i){if(i=""+i||"",i.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+i);return this.assertLegalChar(i)},n.prototype.raw=function(i){return""+i||""},n.prototype.attName=function(i){return i=""+i||""},n.prototype.attValue=function(i){return i=""+i||"",this.attEscape(i)},n.prototype.insTarget=function(i){return""+i||""},n.prototype.insValue=function(i){if(i=""+i||"",i.match(/\?>/))throw new Error("Invalid processing instruction value: "+i);return i},n.prototype.xmlVersion=function(i){if(i=""+i||"",!i.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+i);return i},n.prototype.xmlEncoding=function(i){if(i=""+i||"",!i.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+i);return i},n.prototype.xmlStandalone=function(i){return i?"yes":"no"},n.prototype.dtdPubID=function(i){return""+i||""},n.prototype.dtdSysID=function(i){return""+i||""},n.prototype.dtdElementValue=function(i){return""+i||""},n.prototype.dtdAttType=function(i){return""+i||""},n.prototype.dtdAttDefault=function(i){return i!=null?""+i||"":i},n.prototype.dtdEntityValue=function(i){return""+i||""},n.prototype.dtdNData=function(i){return""+i||""},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(i){var o;if(o=i.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/),o)throw new Error("Invalid character in string: "+i+" at index "+o.index);return i},n.prototype.elEscape=function(i){var o;return o=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(o,"&").replace(//g,">").replace(/\r/g," ")},n.prototype.attEscape=function(i){var o;return o=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(o,"&").replace(/{(function(){var e,t={}.hasOwnProperty;ab.exports=e=(function(){function r(n){var i,o,s,a,u,c,f,h,p;n||(n={}),this.pretty=n.pretty||!1,this.allowEmpty=(o=n.allowEmpty)!=null?o:!1,this.pretty?(this.indent=(s=n.indent)!=null?s:" ",this.newline=(a=n.newline)!=null?a:` +`,this.offset=(u=n.offset)!=null?u:0,this.dontprettytextnodes=(c=n.dontprettytextnodes)!=null?c:0):(this.indent="",this.newline="",this.offset=0,this.dontprettytextnodes=0),this.spacebeforeslash=(f=n.spacebeforeslash)!=null?f:"",this.spacebeforeslash===!0&&(this.spacebeforeslash=" "),this.newlinedefault=this.newline,this.prettydefault=this.pretty,h=n.writer||{};for(i in h)t.call(h,i)&&(p=h[i],this[i]=p)}return r.prototype.set=function(n){var i,o,s;n||(n={}),"pretty"in n&&(this.pretty=n.pretty),"allowEmpty"in n&&(this.allowEmpty=n.allowEmpty),this.pretty?(this.indent="indent"in n?n.indent:" ",this.newline="newline"in n?n.newline:` +`,this.offset="offset"in n?n.offset:0,this.dontprettytextnodes="dontprettytextnodes"in n?n.dontprettytextnodes:0):(this.indent="",this.newline="",this.offset=0,this.dontprettytextnodes=0),this.spacebeforeslash="spacebeforeslash"in n?n.spacebeforeslash:"",this.spacebeforeslash===!0&&(this.spacebeforeslash=" "),this.newlinedefault=this.newline,this.prettydefault=this.pretty,o=n.writer||{};for(i in o)t.call(o,i)&&(s=o[i],this[i]=s);return this},r.prototype.space=function(n){var i;return this.pretty?(i=(n||0)+this.offset+1,i>0?new Array(i).join(this.indent):""):""},r})()}).call(sb)});var Lc=pe((lb,ub)=>{(function(){var e,t,r,n,i,o,s,a,u,c,f,h,p,d,m,g=function(w,E){for(var b in E)y.call(E,b)&&(w[b]=E[b]);function C(){this.constructor=w}return C.prototype=E.prototype,w.prototype=new C,w.__super__=E.prototype,w},y={}.hasOwnProperty;s=$a(),a=Qa(),e=Ga(),t=Ka(),c=Va(),h=el(),d=tl(),f=rl(),u=Bc(),r=Xa(),n=Ja(),i=Za(),o=Ya(),m=Up(),ub.exports=p=(function(w){g(E,w);function E(b){E.__super__.constructor.call(this,b)}return E.prototype.document=function(b){var C,S,A,k,B;for(this.textispresent=!1,k="",B=b.children,S=0,A=B.length;S"+this.newline},E.prototype.comment=function(b,C){return this.space(C)+""+this.newline},E.prototype.declaration=function(b,C){var S;return S=this.space(C),S+='",S+=this.newline,S},E.prototype.docType=function(b,C){var S,A,k,B,O;if(C||(C=0),B=this.space(C),B+="0){for(B+=" [",B+=this.newline,O=b.children,A=0,k=O.length;A",B+=this.newline,B},E.prototype.element=function(b,C){var S,A,k,B,O,P,Y,_,W,F,J,j,H;C||(C=0),H=!1,this.textispresent?(this.newline="",this.pretty=!1):(this.newline=this.newlinedefault,this.pretty=this.prettydefault),j=this.space(C),_="",_+=j+"<"+b.name,W=b.attributes;for(Y in W)y.call(W,Y)&&(S=W[Y],_+=this.attribute(S));if(b.children.length===0||b.children.every(function($){return $.value===""}))this.allowEmpty?_+=">"+this.newline:_+=this.spacebeforeslash+"/>"+this.newline;else if(this.pretty&&b.children.length===1&&b.children[0].value!=null)_+=">",_+=b.children[0].value,_+=""+this.newline;else{if(this.dontprettytextnodes){for(F=b.children,k=0,O=F.length;k"+this.newline,J=b.children,B=0,P=J.length;B"+this.newline}return _},E.prototype.processingInstruction=function(b,C){var S;return S=this.space(C)+""+this.newline,S},E.prototype.raw=function(b,C){return this.space(C)+b.value+this.newline},E.prototype.text=function(b,C){return this.space(C)+b.value+this.newline},E.prototype.dtdAttList=function(b,C){var S;return S=this.space(C)+""+this.newline,S},E.prototype.dtdElement=function(b,C){return this.space(C)+""+this.newline},E.prototype.dtdEntity=function(b,C){var S;return S=this.space(C)+""+this.newline,S},E.prototype.dtdNotation=function(b,C){var S;return S=this.space(C)+""+this.newline,S},E.prototype.openNode=function(b,C){var S,A,k,B;if(C||(C=0),b instanceof c){k=this.space(C)+"<"+b.name,B=b.attributes;for(A in B)y.call(B,A)&&(S=B[A],k+=this.attribute(S));return k+=(b.children?">":"/>")+this.newline,k}else return k=this.space(C)+"")+this.newline,k},E.prototype.closeNode=function(b,C){switch(C||(C=0),!1){case!(b instanceof c):return this.space(C)+""+this.newline;case!(b instanceof a):return this.space(C)+"]>"+this.newline}},E})(m)}).call(lb)});var hb=pe((cb,fb)=>{(function(){var e,t,r,n,i,o=function(a,u){for(var c in u)s.call(u,c)&&(a[c]=u[c]);function f(){this.constructor=a}return f.prototype=u.prototype,a.prototype=new f,a.__super__=u.prototype,a},s={}.hasOwnProperty;i=Dn().isPlainObject,t=Wt(),n=zp(),r=Lc(),fb.exports=e=(function(a){o(u,a);function u(c){u.__super__.constructor.call(this,null),this.name="?xml",c||(c={}),c.writer||(c.writer=new r),this.options=c,this.stringify=new n(c),this.isDocument=!0}return u.prototype.end=function(c){var f;return c?i(c)&&(f=c,c=this.options.writer.set(f)):c=this.options.writer,c.document(this)},u.prototype.toString=function(c){return this.options.writer.set(c).document(this)},u})(t)}).call(cb)});var mb=pe((db,pb)=>{(function(){var e,t,r,n,i,o,s,a,u,c,f,h,p,d,m,g,y,w,E,b,C,S={}.hasOwnProperty;C=Dn(),E=C.isObject,w=C.isFunction,b=C.isPlainObject,y=C.getValue,f=Va(),t=Ga(),r=Ka(),p=el(),g=tl(),h=rl(),a=$a(),u=Qa(),n=Xa(),o=Za(),i=Ja(),s=Ya(),e=Pp(),m=zp(),d=Lc(),pb.exports=c=(function(){function A(k,B,O){var P;this.name="?xml",k||(k={}),k.writer?b(k.writer)&&(P=k.writer,k.writer=new d(P)):k.writer=new d(k),this.options=k,this.writer=k.writer,this.stringify=new m(k),this.onDataCallback=B||function(){},this.onEndCallback=O||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return A.prototype.node=function(k,B,O){var P,Y;if(k==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(k));return this.openCurrent(),k=y(k),B===null&&O==null&&(P=[{},null],B=P[0],O=P[1]),B==null&&(B={}),B=y(B),E(B)||(Y=[B,O],O=Y[0],B=Y[1]),this.currentNode=new f(this,k,B),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,O!=null&&this.text(O),this},A.prototype.element=function(k,B,O){return this.currentNode&&this.currentNode instanceof u?this.dtdElement.apply(this,arguments):this.node(k,B,O)},A.prototype.attribute=function(k,B){var O,P;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(k));if(k!=null&&(k=y(k)),E(k))for(O in k)S.call(k,O)&&(P=k[O],this.attribute(O,P));else w(B)&&(B=B.apply()),(!this.options.skipNullAttributes||B!=null)&&(this.currentNode.attributes[k]=new e(this,k,B));return this},A.prototype.text=function(k){var B;return this.openCurrent(),B=new g(this,k),this.onData(this.writer.text(B,this.currentLevel+1),this.currentLevel+1),this},A.prototype.cdata=function(k){var B;return this.openCurrent(),B=new t(this,k),this.onData(this.writer.cdata(B,this.currentLevel+1),this.currentLevel+1),this},A.prototype.comment=function(k){var B;return this.openCurrent(),B=new r(this,k),this.onData(this.writer.comment(B,this.currentLevel+1),this.currentLevel+1),this},A.prototype.raw=function(k){var B;return this.openCurrent(),B=new p(this,k),this.onData(this.writer.raw(B,this.currentLevel+1),this.currentLevel+1),this},A.prototype.instruction=function(k,B){var O,P,Y,_,W;if(this.openCurrent(),k!=null&&(k=y(k)),B!=null&&(B=y(B)),Array.isArray(k))for(O=0,_=k.length;O<_;O++)P=k[O],this.instruction(P);else if(E(k))for(P in k)S.call(k,P)&&(Y=k[P],this.instruction(P,Y));else w(B)&&(B=B.apply()),W=new h(this,k,B),this.onData(this.writer.processingInstruction(W,this.currentLevel+1),this.currentLevel+1);return this},A.prototype.declaration=function(k,B,O){var P;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return P=new a(this,k,B,O),this.onData(this.writer.declaration(P,this.currentLevel+1),this.currentLevel+1),this},A.prototype.doctype=function(k,B,O){if(this.openCurrent(),k==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new u(this,B,O),this.currentNode.rootNodeName=k,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},A.prototype.dtdElement=function(k,B){var O;return this.openCurrent(),O=new i(this,k,B),this.onData(this.writer.dtdElement(O,this.currentLevel+1),this.currentLevel+1),this},A.prototype.attList=function(k,B,O,P,Y){var _;return this.openCurrent(),_=new n(this,k,B,O,P,Y),this.onData(this.writer.dtdAttList(_,this.currentLevel+1),this.currentLevel+1),this},A.prototype.entity=function(k,B){var O;return this.openCurrent(),O=new o(this,!1,k,B),this.onData(this.writer.dtdEntity(O,this.currentLevel+1),this.currentLevel+1),this},A.prototype.pEntity=function(k,B){var O;return this.openCurrent(),O=new o(this,!0,k,B),this.onData(this.writer.dtdEntity(O,this.currentLevel+1),this.currentLevel+1),this},A.prototype.notation=function(k,B){var O;return this.openCurrent(),O=new s(this,k,B),this.onData(this.writer.dtdNotation(O,this.currentLevel+1),this.currentLevel+1),this},A.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},A.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},A.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},A.prototype.openNode=function(k){if(!k.isOpen)return!this.root&&this.currentLevel===0&&k instanceof f&&(this.root=k),this.onData(this.writer.openNode(k,this.currentLevel),this.currentLevel),k.isOpen=!0},A.prototype.closeNode=function(k){if(!k.isClosed)return this.onData(this.writer.closeNode(k,this.currentLevel),this.currentLevel),k.isClosed=!0},A.prototype.onData=function(k,B){return this.documentStarted=!0,this.onDataCallback(k,B+1)},A.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},A.prototype.debugInfo=function(k){return k==null?"":"node: <"+k+">"},A.prototype.ele=function(){return this.element.apply(this,arguments)},A.prototype.nod=function(k,B,O){return this.node(k,B,O)},A.prototype.txt=function(k){return this.text(k)},A.prototype.dat=function(k){return this.cdata(k)},A.prototype.com=function(k){return this.comment(k)},A.prototype.ins=function(k,B){return this.instruction(k,B)},A.prototype.dec=function(k,B,O){return this.declaration(k,B,O)},A.prototype.dtd=function(k,B,O){return this.doctype(k,B,O)},A.prototype.e=function(k,B,O){return this.element(k,B,O)},A.prototype.n=function(k,B,O){return this.node(k,B,O)},A.prototype.t=function(k){return this.text(k)},A.prototype.d=function(k){return this.cdata(k)},A.prototype.c=function(k){return this.comment(k)},A.prototype.r=function(k){return this.raw(k)},A.prototype.i=function(k,B){return this.instruction(k,B)},A.prototype.att=function(){return this.currentNode&&this.currentNode instanceof u?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},A.prototype.a=function(){return this.currentNode&&this.currentNode instanceof u?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},A.prototype.ent=function(k,B){return this.entity(k,B)},A.prototype.pent=function(k,B){return this.pEntity(k,B)},A.prototype.not=function(k,B){return this.notation(k,B)},A})()}).call(db)});var vb=pe((gb,yb)=>{(function(){var e,t,r,n,i,o,s,a,u,c,f,h,p,d,m,g=function(w,E){for(var b in E)y.call(E,b)&&(w[b]=E[b]);function C(){this.constructor=w}return C.prototype=E.prototype,w.prototype=new C,w.__super__=E.prototype,w},y={}.hasOwnProperty;s=$a(),a=Qa(),e=Ga(),t=Ka(),c=Va(),h=el(),d=tl(),f=rl(),u=Bc(),r=Xa(),n=Ja(),i=Za(),o=Ya(),m=Up(),yb.exports=p=(function(w){g(E,w);function E(b,C){E.__super__.constructor.call(this,C),this.stream=b}return E.prototype.document=function(b){var C,S,A,k,B,O,P,Y;for(O=b.children,S=0,k=O.length;S"+this.endline(b))},E.prototype.comment=function(b,C){return this.stream.write(this.space(C)+""+this.endline(b))},E.prototype.declaration=function(b,C){return this.stream.write(this.space(C)),this.stream.write('"),this.stream.write(this.endline(b))},E.prototype.docType=function(b,C){var S,A,k,B;if(C||(C=0),this.stream.write(this.space(C)),this.stream.write("0){for(this.stream.write(" ["),this.stream.write(this.endline(b)),B=b.children,A=0,k=B.length;A"),this.stream.write(this.endline(b))},E.prototype.element=function(b,C){var S,A,k,B,O,P,Y,_;C||(C=0),_=this.space(C),this.stream.write(_+"<"+b.name),P=b.attributes;for(O in P)y.call(P,O)&&(S=P[O],this.attribute(S));if(b.children.length===0||b.children.every(function(W){return W.value===""}))this.allowEmpty?this.stream.write(">"):this.stream.write(this.spacebeforeslash+"/>");else if(this.pretty&&b.children.length===1&&b.children[0].value!=null)this.stream.write(">"),this.stream.write(b.children[0].value),this.stream.write("");else{for(this.stream.write(">"+this.newline),Y=b.children,k=0,B=Y.length;k")}return this.stream.write(this.endline(b))},E.prototype.processingInstruction=function(b,C){return this.stream.write(this.space(C)+""+this.endline(b))},E.prototype.raw=function(b,C){return this.stream.write(this.space(C)+b.value+this.endline(b))},E.prototype.text=function(b,C){return this.stream.write(this.space(C)+b.value+this.endline(b))},E.prototype.dtdAttList=function(b,C){return this.stream.write(this.space(C)+""+this.endline(b))},E.prototype.dtdElement=function(b,C){return this.stream.write(this.space(C)+""+this.endline(b))},E.prototype.dtdEntity=function(b,C){return this.stream.write(this.space(C)+""+this.endline(b))},E.prototype.dtdNotation=function(b,C){return this.stream.write(this.space(C)+""+this.endline(b))},E.prototype.endline=function(b){return b.isLastRootNode?"":this.newline},E})(m)}).call(gb)});var bb=pe((wb,nl)=>{(function(){var e,t,r,n,i,o,s;s=Dn(),i=s.assign,o=s.isFunction,e=hb(),t=mb(),n=Lc(),r=vb(),nl.exports.create=function(a,u,c,f){var h,p;if(a==null)throw new Error("Root element needs a name.");return f=i({},u,c,f),h=new e(f),p=h.element(a),f.headless||(h.declaration(f),(f.pubID!=null||f.sysID!=null)&&h.doctype(f)),p},nl.exports.begin=function(a,u,c){var f;return o(a)&&(f=[a,u],u=f[0],c=f[1],a={}),u?new t(a,u,c):new e(a)},nl.exports.stringWriter=function(a){return new n(a)},nl.exports.streamWriter=function(a,u){return new r(a,u)}}).call(wb)});var Eb=pe(xb=>{var _b=(rt(),it(tt)),w5=bb();xb.writeString=b5;function b5(e,t){var r=_b.invert(t),n={element:o,text:_5};function i(u,c){return n[c.type](u,c)}function o(u,c){var f=u.element(s(c.name),c.attributes);c.children.forEach(function(h){i(f,h)})}function s(u){var c=/^\{(.*)\}(.*)$/.exec(u);if(c){var f=r[c[1]];return f+(f===""?"":":")+c[2]}else return u}function a(u){var c=w5.create(s(u.name),{version:"1.0",encoding:"UTF-8",standalone:!0});return _b.forEach(t,function(f,h){var p="xmlns"+(h===""?"":":"+h);c.attribute(p,f)}),u.children.forEach(function(f){i(c,f)}),c.end()}return a(e)}function _5(e,t){e.text(t.value)}});var zc=pe(Zi=>{var Pc=wp();Zi.Element=Pc.Element;Zi.element=Pc.element;Zi.emptyElement=Pc.emptyElement;Zi.text=Pc.text;Zi.readString=Tw().readString;Zi.writeString=Eb().writeString});var Tb=pe(qp=>{var x5=(rt(),it(tt)),E5=En(),A5=zc();qp.read=Ab;qp.readXmlFromZipFile=T5;var S5={"http://schemas.openxmlformats.org/wordprocessingml/2006/main":"w","http://schemas.openxmlformats.org/officeDocument/2006/relationships":"r","http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing":"wp","http://schemas.openxmlformats.org/drawingml/2006/main":"a","http://schemas.openxmlformats.org/drawingml/2006/picture":"pic","http://purl.oclc.org/ooxml/wordprocessingml/main":"w","http://purl.oclc.org/ooxml/officeDocument/relationships":"r","http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing":"wp","http://purl.oclc.org/ooxml/drawingml/main":"a","http://purl.oclc.org/ooxml/drawingml/picture":"pic","http://schemas.openxmlformats.org/package/2006/content-types":"content-types","http://schemas.openxmlformats.org/package/2006/relationships":"relationships","http://schemas.openxmlformats.org/markup-compatibility/2006":"mc","urn:schemas-microsoft-com:vml":"v","urn:schemas-microsoft-com:office:word":"office-word","http://schemas.microsoft.com/office/word/2010/wordml":"wordml"};function Ab(e){return A5.readString(e,S5).then(function(t){return Sb(t)[0]})}function T5(e,t){return e.exists(t)?e.read(t,"utf-8").then(C5).then(Ab):E5.resolve(null)}function C5(e){return e.replace(/^\uFEFF/g,"")}function Sb(e){return e.type==="element"?e.name==="mc:AlternateContent"?e.firstOrEmpty("mc:Fallback").children:(e.children=x5.flatten(e.children.map(Sb,!0)),[e]):[e]}});var Cb=pe(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var k5={SYMBOL:{32:32,33:33,34:8704,35:35,36:8707,37:37,38:38,39:8717,40:40,41:41,42:42,43:43,44:44,45:8722,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:8773,65:913,66:914,67:935,68:916,69:917,70:934,71:915,72:919,73:921,74:977,75:922,76:923,77:924,78:925,79:927,80:928,81:920,82:929,83:931,84:932,85:933,86:962,87:937,88:926,89:936,90:918,91:91,92:8756,93:93,94:8869,95:95,96:8254,97:945,98:946,99:967,100:948,101:949,102:966,103:947,104:951,105:953,106:981,107:954,108:955,109:956,110:957,111:959,112:960,113:952,114:961,115:963,116:964,117:965,118:982,119:969,120:958,121:968,122:950,123:123,124:124,125:125,126:126,160:8364,161:978,162:8242,163:8804,164:8260,165:8734,166:402,167:9827,168:9830,169:9829,170:9824,171:8596,172:8592,173:8593,174:8594,175:8595,176:176,177:177,178:8243,179:8805,180:215,181:8733,182:8706,183:8226,184:247,185:8800,186:8801,187:8776,188:8230,189:9168,190:9135,191:8629,192:8501,193:8465,194:8476,195:8472,196:8855,197:8853,198:8709,199:8745,200:8746,201:8835,202:8839,203:8836,204:8834,205:8838,206:8712,207:8713,208:8736,209:8711,210:174,211:169,212:8482,213:8719,214:8730,215:8901,216:172,217:8743,218:8744,219:8660,220:8656,221:8657,222:8658,223:8659,224:9674,225:12296,226:174,227:169,228:8482,229:8721,230:9115,231:9116,232:9117,233:9121,234:9122,235:9123,236:9127,237:9128,238:9129,239:9130,240:63743,241:12297,242:8747,243:8992,244:9134,245:8993,246:9118,247:9119,248:9120,249:9124,250:9125,251:9126,252:9131,253:9132,254:9133},WEBDINGS:{32:32,33:128375,34:128376,35:128370,36:128374,37:127942,38:127894,39:128391,40:128488,41:128489,42:128496,43:128497,44:127798,45:127895,46:128638,47:128636,48:128469,49:128470,50:128471,51:9204,52:9205,53:9206,54:9207,55:9194,56:9193,57:9198,58:9197,59:9208,60:9209,61:9210,62:128474,63:128499,64:128736,65:127959,66:127960,67:127961,68:127962,69:127964,70:127981,71:127963,72:127968,73:127958,74:127965,75:128739,76:128269,77:127956,78:128065,79:128066,80:127966,81:127957,82:128740,83:127967,84:128755,85:128364,86:128363,87:128360,88:128264,89:127892,90:127893,91:128492,92:128637,93:128493,94:128490,95:128491,96:11156,97:10004,98:128690,99:11036,100:128737,101:128230,102:128753,103:11035,104:128657,105:128712,106:128745,107:128752,108:128968,109:128372,110:11044,111:128741,112:128660,113:128472,114:128473,115:10067,116:128754,117:128647,118:128653,119:9971,120:10680,121:8854,122:128685,123:128494,124:9168,125:128495,126:128498,128:128697,129:128698,130:128713,131:128714,132:128700,133:128125,134:127947,135:9975,136:127938,137:127948,138:127946,139:127940,140:127949,141:127950,142:128664,143:128480,144:128738,145:128176,146:127991,147:128179,148:128106,149:128481,150:128482,151:128483,152:10031,153:128388,154:128389,155:128387,156:128390,157:128441,158:128442,159:128443,160:128373,161:128368,162:128445,163:128446,164:128203,165:128466,166:128467,167:128366,168:128218,169:128478,170:128479,171:128451,172:128450,173:128444,174:127917,175:127900,176:127896,177:127897,178:127911,179:128191,180:127902,181:128247,182:127903,183:127916,184:128253,185:128249,186:128254,187:128251,188:127898,189:127899,190:128250,191:128187,192:128421,193:128422,194:128423,195:128377,196:127918,197:128379,198:128380,199:128223,200:128385,201:128384,202:128424,203:128425,204:128447,205:128426,206:128476,207:128274,208:128275,209:128477,210:128229,211:128228,212:128371,213:127779,214:127780,215:127781,216:127782,217:9729,218:127784,219:127783,220:127785,221:127786,222:127788,223:127787,224:127772,225:127777,226:128715,227:128719,228:127869,229:127864,230:128718,231:128717,232:9413,233:9855,234:128710,235:128392,236:127891,237:128484,238:128485,239:128486,240:128487,241:128746,242:128063,243:128038,244:128031,245:128021,246:128008,247:128620,248:128622,249:128621,250:128623,251:128506,252:127757,253:127759,254:127758,255:128330},WINGDINGS:{32:32,33:128393,34:9986,35:9985,36:128083,37:128365,38:128366,39:128367,40:128383,41:9990,42:128386,43:128387,44:128234,45:128235,46:128236,47:128237,48:128448,49:128449,50:128462,51:128463,52:128464,53:128452,54:8987,55:128430,56:128432,57:128434,58:128435,59:128436,60:128427,61:128428,62:9991,63:9997,64:128398,65:9996,66:128399,67:128077,68:128078,69:9756,70:9758,71:9757,72:9759,73:128400,74:9786,75:128528,76:9785,77:128163,78:128369,79:127987,80:127985,81:9992,82:9788,83:127778,84:10052,85:128326,86:10014,87:128328,88:10016,89:10017,90:9770,91:9775,92:128329,93:9784,94:9800,95:9801,96:9802,97:9803,98:9804,99:9805,100:9806,101:9807,102:9808,103:9809,104:9810,105:9811,106:128624,107:128629,108:9899,109:128318,110:9724,111:128911,112:128912,113:10065,114:10066,115:128927,116:10731,117:9670,118:10070,119:11049,120:8999,121:11193,122:8984,123:127989,124:127990,125:128630,126:128631,127:9647,128:127243,129:10112,130:10113,131:10114,132:10115,133:10116,134:10117,135:10118,136:10119,137:10120,138:10121,139:127244,140:10122,141:10123,142:10124,143:10125,144:10126,145:10127,146:10128,147:10129,148:10130,149:10131,150:128610,151:128608,152:128609,153:128611,154:128606,155:128604,156:128605,157:128607,158:8729,159:8226,160:11037,161:11096,162:128902,163:128904,164:128906,165:128907,166:128319,167:9642,168:128910,169:128961,170:128965,171:9733,172:128971,173:128975,174:128979,175:128977,176:11216,177:8982,178:11214,179:11215,180:11217,181:10026,182:10032,183:128336,184:128337,185:128338,186:128339,187:128340,188:128341,189:128342,190:128343,191:128344,192:128345,193:128346,194:128347,195:11184,196:11185,197:11186,198:11187,199:11188,200:11189,201:11190,202:11191,203:128618,204:128619,205:128597,206:128596,207:128599,208:128598,209:128592,210:128593,211:128594,212:128595,213:9003,214:8998,215:11160,216:11162,217:11161,218:11163,219:11144,220:11146,221:11145,222:11147,223:129128,224:129130,225:129129,226:129131,227:129132,228:129133,229:129135,230:129134,231:129144,232:129146,233:129145,234:129147,235:129148,236:129149,237:129151,238:129150,239:8678,240:8680,241:8679,242:8681,243:11012,244:8691,245:11009,246:11008,247:11011,248:11010,249:129196,250:129197,251:128502,252:10003,253:128503,254:128505},"WINGDINGS 2":{32:32,33:128394,34:128395,35:128396,36:128397,37:9988,38:9984,39:128382,40:128381,41:128453,42:128454,43:128455,44:128456,45:128457,46:128458,47:128459,48:128460,49:128461,50:128203,51:128465,52:128468,53:128437,54:128438,55:128439,56:128440,57:128429,58:128431,59:128433,60:128402,61:128403,62:128408,63:128409,64:128410,65:128411,66:128072,67:128073,68:128412,69:128413,70:128414,71:128415,72:128416,73:128417,74:128070,75:128071,76:128418,77:128419,78:128401,79:128500,80:128504,81:128501,82:9745,83:11197,84:9746,85:11198,86:11199,87:128711,88:10680,89:128625,90:128628,91:128626,92:128627,93:8253,94:128633,95:128634,96:128635,97:128614,98:128612,99:128613,100:128615,101:128602,102:128600,103:128601,104:128603,105:9450,106:9312,107:9313,108:9314,109:9315,110:9316,111:9317,112:9318,113:9319,114:9320,115:9321,116:9471,117:10102,118:10103,119:10104,120:10105,121:10106,122:10107,123:10108,124:10109,125:10110,126:10111,128:9737,129:127765,130:9789,131:9790,132:11839,133:10013,134:128327,135:128348,136:128349,137:128350,138:128351,139:128352,140:128353,141:128354,142:128355,143:128356,144:128357,145:128358,146:128359,147:128616,148:128617,149:8901,150:128900,151:10625,152:9679,153:9675,154:128901,155:128903,156:128905,157:8857,158:10687,159:128908,160:128909,161:9726,162:9632,163:9633,164:128913,165:128914,166:128915,167:128916,168:9635,169:128917,170:128918,171:128919,172:128920,173:11049,174:11045,175:9671,176:128922,177:9672,178:128923,179:128924,180:128925,181:128926,182:11050,183:11047,184:9674,185:128928,186:9686,187:9687,188:11210,189:11211,190:11200,191:11201,192:11039,193:11202,194:11043,195:11042,196:11203,197:11204,198:128929,199:128930,200:128931,201:128932,202:128933,203:128934,204:128935,205:128936,206:128937,207:128938,208:128939,209:128940,210:128941,211:128942,212:128943,213:128944,214:128945,215:128946,216:128947,217:128948,218:128949,219:128950,220:128951,221:128952,222:128953,223:128954,224:128955,225:128956,226:128957,227:128958,228:128959,229:128960,230:128962,231:128964,232:128966,233:128969,234:128970,235:10038,236:128972,237:128974,238:128976,239:128978,240:10041,241:128963,242:128967,243:10031,244:128973,245:128980,246:11212,247:11213,248:8251,249:8258},"WINGDINGS 3":{32:32,33:11104,34:11106,35:11105,36:11107,37:11110,38:11111,39:11113,40:11112,41:11120,42:11122,43:11121,44:11123,45:11126,46:11128,47:11131,48:11133,49:11108,50:11109,51:11114,52:11116,53:11115,54:11117,55:11085,56:11168,57:11169,58:11170,59:11171,60:11172,61:11173,62:11174,63:11175,64:11152,65:11153,66:11154,67:11155,68:11136,69:11139,70:11134,71:11135,72:11140,73:11142,74:11141,75:11143,76:11151,77:11149,78:11150,79:11148,80:11118,81:11119,82:9099,83:8996,84:8963,85:8997,86:9251,87:9085,88:8682,89:11192,90:129184,91:129185,92:129186,93:129187,94:129188,95:129189,96:129190,97:129191,98:129192,99:129193,100:129194,101:129195,102:129104,103:129106,104:129105,105:129107,106:129108,107:129109,108:129111,109:129110,110:129112,111:129113,112:9650,113:9660,114:9651,115:9661,116:9664,117:9654,118:9665,119:9655,120:9699,121:9698,122:9700,123:9701,124:128896,125:128898,126:128897,128:128899,129:11205,130:11206,131:11207,132:11208,133:11164,134:11166,135:11165,136:11167,137:129040,138:129042,139:129041,140:129043,141:129044,142:129046,143:129045,144:129047,145:129048,146:129050,147:129049,148:129051,149:129052,150:129054,151:129053,152:129055,153:129024,154:129026,155:129025,156:129027,157:129028,158:129030,159:129029,160:129031,161:129032,162:129034,163:129033,164:129035,165:129056,166:129058,167:129060,168:129062,169:129064,170:129066,171:129068,172:129180,173:129181,174:129182,175:129183,176:129070,177:129072,178:129074,179:129076,180:129078,181:129080,182:129082,183:129081,184:129083,185:129176,186:129178,187:129177,188:129179,189:129084,190:129086,191:129085,192:129087,193:129088,194:129090,195:129089,196:129091,197:129092,198:129094,199:129093,200:129095,201:11176,202:11177,203:11178,204:11179,205:11180,206:11181,207:11182,208:11183,209:129120,210:129122,211:129121,212:129123,213:129124,214:129125,215:129127,216:129126,217:129136,218:129138,219:129137,220:129139,221:129140,222:129141,223:129143,224:129142,225:129152,226:129154,227:129153,228:129155,229:129156,230:129157,231:129159,232:129158,233:129168,234:129170,235:129169,236:129171,237:129172,238:129174,239:129173,240:129175}};jp.default=k5});var kb=pe(Yr=>{"use strict";var D5=Yr&&Yr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.hex=Yr.dec=Yr.codePoint=void 0;var N5=D5(Cb()),O5=String.fromCodePoint?String.fromCodePoint:F5;function Hp(e,t){var r=N5.default[e.toUpperCase()];if(r!==void 0){var n=r[t];if(n!==void 0)return{codePoint:n,string:O5(n)}}}Yr.codePoint=Hp;function R5(e,t){return Hp(e,parseInt(t,10))}Yr.dec=R5;function I5(e,t){return Hp(e,parseInt(t,16))}Yr.hex=I5;function F5(e){if(e<=65535)return String.fromCharCode(e);var t=Math.floor((e-65536)/1024)+55296,r=(e-65536)%1024+56320;return String.fromCharCode(t,r)}});var Vp=pe(Ji=>{var Db=(rt(),it(tt));Ji.paragraph=M5;Ji.run=B5;Ji._elements=Nb;Ji._elementsOfType=Wp;Ji.getDescendantsOfType=L5;Ji.getDescendants=Ob;function M5(e){return Wp("paragraph",e)}function B5(e){return Wp("run",e)}function Wp(e,t){return Nb(function(r){return r.type===e?t(r):r})}function Nb(e){return function t(r){if(r.children){var n=Db.map(r.children,t);r=Db.extend(r,{children:n})}return e(r)}}function L5(e,t){return Ob(e).filter(function(r){return r.type===t})}function Ob(e){var t=[];return Rb(e,function(r){t.push(r)}),t}function Rb(e,t){e.children&&e.children.forEach(function(r){Rb(r,t),t(r)})}});var Ib=pe(Gp=>{Gp.uriToZipEntryName=P5;Gp.replaceFragment=z5;function P5(e,t){return t.charAt(0)==="/"?t.substr(1):e+"/"+t}function z5(e,t){var r=e.indexOf("#");return r!==-1&&(e=e.substring(0,r)),e+"#"+t}});var qb=pe(Kp=>{Kp.createBodyReader=q5;Kp._readNumberingProperties=Ub;var Fb=kb(),xr=(rt(),it(tt)),Je=si(),zb=$r().Result,Lr=$r().warning,U5=zc(),Mb=Vp(),Bb=Ib();function q5(e){return{readXmlElement:function(t){return new Lb(e).readXmlElement(t)},readXmlElements:function(t){return new Lb(e).readXmlElements(t)}}}function Lb(e){var t=[],r=[],n=[],i=e.relationships,o=e.contentTypes,s=e.docxFile,a=e.files,u=e.numbering,c=e.styles;function f(I){var T=I.map(h);return Pb(T)}function h(I){if(I.type==="element"){var T=z[I.name];if(T)return T(I);if(!Object.prototype.hasOwnProperty.call(H5,I.name)){var v=Lr("An unrecognised element was ignored: "+I.name);return Yi([v])}}return fs()}function p(I){return A(I).map(function(T){return{type:"paragraphProperties",styleId:T.styleId,styleName:T.name,alignment:I.firstOrEmpty("w:jc").attributes["w:val"],numbering:Ub(T.styleId,I.firstOrEmpty("w:numPr"),u),indent:m(I.firstOrEmpty("w:ind")),spacing:w(I.firstOrEmpty("w:spacing")),hasBottomBorder:d(I.firstOrEmpty("w:pBdr"))}})}function d(I){var T=I.firstOrEmpty("w:bottom").attributes["w:val"];return!!T&&T!=="none"&&T!=="nil"}function m(I){return{start:I.attributes["w:start"]||I.attributes["w:left"],end:I.attributes["w:end"]||I.attributes["w:right"],firstLine:I.attributes["w:firstLine"],hanging:I.attributes["w:hanging"]}}function g(I){return k(I).map(function(T){var v=I.firstOrEmpty("w:sz").attributes["w:val"],x=/^[0-9]+$/.test(v)?parseInt(v,10)/2:null;return{type:"runProperties",styleId:T.styleId,styleName:T.name,verticalAlignment:I.firstOrEmpty("w:vertAlign").attributes["w:val"],font:I.firstOrEmpty("w:rFonts").attributes["w:ascii"],fontSize:x,isBold:b(I.first("w:b")),isUnderline:E(I.first("w:u")),isItalic:b(I.first("w:i")),isStrikethrough:b(I.first("w:strike")),isAllCaps:b(I.first("w:caps")),isSmallCaps:b(I.first("w:smallCaps")),highlight:S(I.firstOrEmpty("w:highlight").attributes["w:val"]),color:y(I.firstOrEmpty("w:color").attributes["w:val"])}})}function y(I){return/^[0-9a-fA-F]{6}$/.test(I||"")?I.toUpperCase():null}function w(I){var T=I.attributes,v=T["w:line"],x=function(R){return/^-?[0-9]+$/.test(R||"")?parseInt(R,10):null};return{line:x(v),lineRule:T["w:lineRule"]||null,before:x(T["w:before"]),after:x(T["w:after"])}}function E(I){if(I){var T=I.attributes["w:val"];return T!==void 0&&T!=="false"&&T!=="0"&&T!=="none"}else return!1}function b(I){if(I){var T=I.attributes["w:val"];return T!=="false"&&T!=="0"}else return!1}function C(I){return I!=="false"&&I!=="0"}function S(I){return!I||I==="none"?null:I}function A(I){return O(I,"w:pStyle","Paragraph",c.findParagraphStyleById)}function k(I){return O(I,"w:rStyle","Run",c.findCharacterStyleById)}function B(I){return O(I,"w:tblStyle","Table",c.findTableStyleById)}function O(I,T,v,x){var R=[],U=I.first(T),ee=null,Z=null;if(U&&(ee=U.attributes["w:val"],ee)){var K=x(ee);K?Z=K.name:R.push(N(v,ee))}return Uc({styleId:ee,name:Z},R)}function P(I){var T=I.attributes["w:fldCharType"];if(T==="begin")t.push({type:"begin",fldChar:I}),r=[];else if(T==="end"){if(t.length===0)return Yi([Lr("Ignoring complex field end character without corresponding start character")]);var v=t.pop();if(v.type==="begin"&&(v=_(v)),v.type==="checkbox")return mr(Je.checkbox({checked:v.checked}))}else if(T==="separate"){if(t.length===0)return Yi([Lr("Ignoring complex field separator character without corresponding start character")]);var x=t.pop(),R=_(x);t.push(R)}return fs()}function Y(){var I=xr.last(t.filter(function(T){return T.type==="hyperlink"}));return I?I.options:null}function _(I){return W(r.join(""),I.type==="begin"?I.fldChar:U5.emptyElement)}function W(I,T){var v=/^\s*HYPERLINK\s+(\\l\s+)?(?:"(.*)"|([^\\]\S*))/.exec(I);if(v){var x=v[2]===void 0?v[3]:v[2],R=v[1]===void 0?{href:x}:{anchor:x};return{type:"hyperlink",options:R}}var U=/\s*FORMCHECKBOX\s*/.exec(I);if(U){var ee=T.firstOrEmpty("w:ffData").firstOrEmpty("w:checkBox"),Z=ee.first("w:checked"),K=Z==null?b(ee.first("w:default")):b(Z);return{type:"checkbox",checked:K}}return{type:"unknown"}}function F(I){return r.push(I.text()),fs()}function J(I){var T=I.attributes["w:font"],v=I.attributes["w:char"],x=Fb.hex(T,v);return x==null&&/^F0..$/.test(v)&&(x=Fb.hex(T,v.substring(2))),x==null?Yi([Lr("A w:sym element with an unsupported character was ignored: char "+v+" in font "+T)]):mr(new Je.Text(x.string))}function j(I){return function(T){var v=T.attributes["w:id"];return mr(new Je.NoteReference({noteType:I,noteId:v}))}}function H(I){return mr(Je.commentReference({commentId:I.attributes["w:id"]}))}function $(I){return f(I.children)}var z={"w:p":function(I){var T=I.firstOrEmpty("w:pPr"),v=!!T.firstOrEmpty("w:rPr").first("w:del");if(v)return I.children.forEach(function(R){n.push(R)}),fs();var x=I.children;return n.length>0&&(x=n.concat(x),n=[]),xt.map(p(T),f(x),function(R,U){return new Je.Paragraph(U,R)}).insertExtra()},"w:r":function(I){return xt.map(g(I.firstOrEmpty("w:rPr")),f(I.children),function(T,v){var x=Y();return x!==null&&(v=[new Je.Hyperlink(v,x)]),new Je.Run(v,T)})},"w:fldChar":P,"w:instrText":F,"w:t":function(I){return mr(new Je.Text(I.text()))},"w:tab":function(I){return mr(new Je.Tab)},"w:noBreakHyphen":function(){return mr(new Je.Text("\u2011"))},"w:softHyphen":function(I){return mr(new Je.Text("\xAD"))},"w:sym":J,"w:hyperlink":function(I){var T=I.attributes["r:id"],v=I.attributes["w:anchor"];return f(I.children).map(function(x){function R(ee){var Z=I.attributes["w:tgtFrame"]||null;return new Je.Hyperlink(x,xr.extend({targetFrame:Z},ee))}if(T){var U=i.findTargetByRelationshipId(T);return v&&(U=Bb.replaceFragment(U,v)),R({href:U})}else return v?R({anchor:v}):x})},"w:tbl":G,"w:tr":q,"w:tc":Q,"w:footnoteReference":j("footnote"),"w:endnoteReference":j("endnote"),"w:commentReference":H,"w:br":function(I){var T=I.attributes["w:type"];return T==null||T==="textWrapping"?mr(Je.lineBreak):T==="page"?mr(Je.pageBreak):T==="column"?mr(Je.columnBreak):Yi([Lr("Unsupported break type: "+T)])},"w:bookmarkStart":function(I){var T=I.attributes["w:name"];return T==="_GoBack"?fs():mr(new Je.BookmarkStart({name:T}))},"mc:AlternateContent":function(I){return $(I.firstOrEmpty("mc:Fallback"))},"w:sdt":function(I){var T=f(I.firstOrEmpty("w:sdtContent").children);return T.map(function(v){var x=I.firstOrEmpty("w:sdtPr").first("wordml:checkbox");if(x){var R=x.first("wordml:checked"),U=!!R&&C(R.attributes["wordml:val"]),ee=Je.checkbox({checked:U}),Z=!1,K=v.map(Mb._elementsOfType(Je.types.text,function(te){return te.value.length>0&&!Z?(Z=!0,ee):te}));return Z?K:ee}else return v})},"w:ins":$,"w:object":$,"w:smartTag":$,"w:drawing":$,"w:pict":function(I){return $(I).toExtra()},"v:roundrect":$,"v:shape":$,"v:textbox":$,"w:txbxContent":$,"wp:inline":L,"wp:anchor":L,"v:imagedata":fe,"v:group":$,"v:rect":$};return{readXmlElement:h,readXmlElements:f};function G(I){var T=X(I.firstOrEmpty("w:tblPr"));return f(I.children).flatMap(ae).flatMap(function(v){return T.map(function(x){return Je.Table(v,x)})})}function X(I){return B(I).map(function(T){return{styleId:T.styleId,styleName:T.name}})}function q(I){var T=I.firstOrEmpty("w:trPr"),v=!!T.first("w:del");if(v)return fs();var x=!!T.first("w:tblHeader");return f(I.children).map(function(R){return Je.TableRow(R,{isHeader:x})})}function Q(I){return f(I.children).map(function(T){var v=I.firstOrEmpty("w:tcPr"),x=v.firstOrEmpty("w:gridSpan").attributes["w:val"],R=x?parseInt(x,10):1,U=Je.TableCell(T,{colSpan:R});return U._vMerge=oe(v),U})}function oe(I){var T=I.first("w:vMerge");if(T){var v=T.attributes["w:val"];return v==="continue"||!v}else return null}function ae(I){var T=xr.any(I,function(R){return R.type!==Je.types.tableRow});if(T)return he(I),Uc(I,[Lr("unexpected non-row element in table, cell merging may be incorrect")]);var v=xr.any(I,function(R){return xr.any(R.children,function(U){return U.type!==Je.types.tableCell})});if(v)return he(I),Uc(I,[Lr("unexpected non-cell element in table row, cell merging may be incorrect")]);var x={};return I.forEach(function(R){var U=0;R.children.forEach(function(ee){ee._vMerge&&x[U]?x[U].rowSpan++:(x[U]=ee,ee._vMerge=!1),U+=ee.colSpan})}),I.forEach(function(R){R.children=R.children.filter(function(U){return!U._vMerge}),R.children.forEach(function(U){delete U._vMerge})}),mr(I)}function he(I){I.forEach(function(T){var v=Mb.getDescendantsOfType(T,Je.types.tableCell);v.forEach(function(x){delete x._vMerge})})}function L(I){var T=I.getElementsByTagName("a:graphic").getElementsByTagName("a:graphicData").getElementsByTagName("pic:pic").getElementsByTagName("pic:blipFill").getElementsByTagName("a:blip");return Pb(T.map(M.bind(null,I)))}function M(I,T){var v=I.firstOrEmpty("wp:docPr"),x=v.attributes,R=re(x.descr)?x.title:x.descr,U=ne(T);if(U===null)return Yi([Lr("Could not find image file for a:blip element")]);var ee=I.firstOrEmpty("wp:extent").attributes;return V(U,R,ee).map(function(Z){var K=v.firstOrEmpty("a:hlinkClick"),te=K.attributes["r:id"];if(te){var ie=i.findTargetByRelationshipId(te);return new Je.Hyperlink([Z],{href:ie})}else return Z})}function re(I){return I==null||/^\s*$/.test(I)}function ne(I){var T=I.attributes["r:embed"],v=I.attributes["r:link"];if(T)return D(T);if(v){var x=i.findTargetByRelationshipId(v);return{path:x,read:a.read.bind(a,x)}}else return null}function fe(I){var T=I.attributes["r:id"];return T?V(D(T),I.attributes["o:title"]):Yi([Lr("A v:imagedata element without a relationship ID was ignored")])}function D(I){var T=Bb.uriToZipEntryName("word",i.findTargetByRelationshipId(I));return{path:T,read:s.read.bind(s,T)}}function V(I,T,v){var x=o.findContentType(I.path),R=function(Z){return/^[0-9]+$/.test(Z||"")?Math.round(parseInt(Z,10)/12700*100)/100:null},U=Je.Image({readImage:I.read,altText:T,contentType:x,widthPt:R(v&&v.cx),heightPt:R(v&&v.cy)}),ee=j5[x]?[]:Lr("Image of type "+x+" is unlikely to display in web browsers");return Uc(U,ee)}function N(I,T){return Lr(I+" style with ID "+T+" was referenced but not defined in the document")}}function Ub(e,t,r){var n=t.firstOrEmpty("w:ilvl").attributes["w:val"],i=t.firstOrEmpty("w:numId").attributes["w:val"],o=function(a,u){return a==null?a:Object.assign({},a,{numId:u==null?null:String(u)})};if(n!==void 0&&i!==void 0)return o(r.findLevel(i,n),i);if(e!=null){var s=r.findLevelByParagraphStyleId(e);if(s!=null)return s}return i!==void 0?o(r.findLevel(i,"0"),i):null}var j5={"image/png":!0,"image/gif":!0,"image/jpeg":!0,"image/svg+xml":!0,"image/tiff":!0},H5={"office-word:wrap":!0,"v:shadow":!0,"v:shapetype":!0,"w:annotationRef":!0,"w:bookmarkEnd":!0,"w:sectPr":!0,"w:proofErr":!0,"w:lastRenderedPageBreak":!0,"w:commentRangeStart":!0,"w:commentRangeEnd":!0,"w:del":!0,"w:footnoteRef":!0,"w:endnoteRef":!0,"w:pPr":!0,"w:rPr":!0,"w:tblPr":!0,"w:tblGrid":!0,"w:trPr":!0,"w:tcPr":!0};function Yi(e){return new xt(null,null,e)}function fs(){return new xt(null)}function mr(e){return new xt(e)}function Uc(e,t){return new xt(e,null,t)}function xt(e,t,r){this.value=e||[],this.extra=t||[],this._result=new zb({element:this.value,extra:t},r),this.messages=this._result.messages}xt.prototype.toExtra=function(){return new xt(null,qc(this.extra,this.value),this.messages)};xt.prototype.insertExtra=function(){var e=this.extra;return e&&e.length?new xt(qc(this.value,e),null,this.messages):this};xt.prototype.map=function(e){var t=this._result.map(function(r){return e(r.element)});return new xt(t.value,this.extra,t.messages)};xt.prototype.flatMap=function(e){var t=this._result.flatMap(function(r){return e(r.element)._result});return new xt(t.value.element,qc(this.extra,t.value.extra),t.messages)};xt.map=function(e,t,r){return new xt(r(e.value,t.value),qc(e.extra,t.extra),e.messages.concat(t.messages))};function Pb(e){var t=zb.combine(xr.pluck(e,"_result"));return new xt(xr.flatten(xr.pluck(t.value,"element")),xr.filter(xr.flatten(xr.pluck(t.value,"extra")),W5),t.messages)}function qc(e,t){return xr.flatten([e,t])}function W5(e){return e}});var Hb=pe(jb=>{jb.DocumentXmlReader=K5;var V5=si(),G5=$r().Result;function K5(e){var t=e.bodyReader;function r(n){var i=n.first("w:body");if(i==null)throw new Error("Could not find the body element: are you sure this is a docx file?");var o=t.readXmlElements(i.children).map(function(s){return new V5.Document(s,{notes:e.notes,comments:e.comments})});return new G5(o.value,o.messages)}return{convertXmlToDocument:r}}});var Wb=pe(jc=>{jc.readRelationships=$5;jc.defaultValue=new $p([]);jc.Relationships=$p;function $5(e){var t=[];return e.children.forEach(function(r){if(r.name==="relationships:Relationship"){var n={relationshipId:r.attributes.Id,target:r.attributes.Target,type:r.attributes.Type};t.push(n)}}),new $p(t)}function $p(e){var t=Object.create(null);e.forEach(function(n){t[n.relationshipId]=n.target});var r=Object.create(null);return e.forEach(function(n){r[n.type]||(r[n.type]=[]),r[n.type].push(n.target)}),{findTargetByRelationshipId:function(n){return t[n]},findTargetsByType:function(n){return r[n]||[]}}}});var Gb=pe(Xp=>{Xp.readContentTypesFromXml=Z5;var X5={png:"png",gif:"gif",jpeg:"jpeg",jpg:"jpeg",tif:"tiff",tiff:"tiff",bmp:"bmp"};Xp.defaultContentTypes=Vb({},{});function Z5(e){var t=Object.create(null),r=Object.create(null);return e.children.forEach(function(n){if(n.name==="content-types:Default"&&(t[n.attributes.Extension]=n.attributes.ContentType),n.name==="content-types:Override"){var i=n.attributes.PartName;i.charAt(0)==="/"&&(i=i.substring(1)),r[i]=n.attributes.ContentType}}),Vb(r,t)}function Vb(e,t){return{findContentType:function(r){var n=e[r];if(n)return n;var i=r.split("."),o=i[i.length-1];if(Object.prototype.hasOwnProperty.call(t,o))return t[o];var s=X5[o.toLowerCase()];return s?"image/"+s:null}}}});var Kb=pe(Wc=>{var Hc=(rt(),it(tt));Wc.readNumberingXml=J5;Wc.Numbering=Zp;Wc.defaultNumbering=new Zp({},{});function Zp(e,t,r){var n=Hc.flatten(Hc.values(t).map(function(u){return Hc.values(u.levels)})),i=Hc.indexBy(n.filter(function(u){return u.paragraphStyleId!=null}),"paragraphStyleId");function o(u,c){return s(u,c,Object.create(null))}function s(u,c,f){if(f[u])return null;f[u]=!0;var h=e[u];if(!h)return null;var p=t[h.abstractNumId];if(p){if(p.numStyleLink==null)return t[h.abstractNumId].levels[c];var d=r.findNumberingStyleById(p.numStyleLink);return s(d.numId,c,f)}else return null}function a(u){return i[u]||null}return{findLevel:o,findLevelByParagraphStyleId:a}}function J5(e,t){if(!t||!t.styles)throw new Error("styles is missing");var r=Y5(e),n=e8(e,r);return new Zp(n,r,t.styles)}function Y5(e){var t=Object.create(null);return e.getElementsByTagName("w:abstractNum").forEach(function(r){var n=r.attributes["w:abstractNumId"];t[n]=Q5(r)}),t}function Q5(e){var t=Object.create(null),r=null;e.getElementsByTagName("w:lvl").forEach(function(i){var o=i.attributes["w:ilvl"],s=i.firstOrEmpty("w:numFmt").attributes["w:val"],a=s!=="bullet",u=i.firstOrEmpty("w:pStyle").attributes["w:val"];o===void 0?r={numFmt:s||null,isOrdered:a,level:"0",paragraphStyleId:u}:t[o]={numFmt:s||null,isOrdered:a,level:o,paragraphStyleId:u}}),r!==null&&t[r.level]===void 0&&(t[r.level]=r);var n=e.firstOrEmpty("w:numStyleLink").attributes["w:val"];return{levels:t,numStyleLink:n}}function e8(e){var t=Object.create(null);return e.getElementsByTagName("w:num").forEach(function(r){var n=r.attributes["w:numId"],i=r.first("w:abstractNumId").attributes["w:val"];t[n]={abstractNumId:i}}),t}});var Xb=pe(Vc=>{Vc.readStylesXml=t8;Vc.Styles=il;Vc.defaultStyles=new il({},{});function il(e,t,r,n){return{findParagraphStyleById:function(i){return e[i]},findCharacterStyleById:function(i){return t[i]},findTableStyleById:function(i){return r[i]},findNumberingStyleById:function(i){return n[i]}}}il.EMPTY=new il({},{},{},{});function t8(e){var t=Object.create(null),r=Object.create(null),n=Object.create(null),i=Object.create(null);return e.getElementsByTagName("w:style").forEach(function(o){var s=r8(o),a;switch(s.type){case"paragraph":a=t;break;case"character":a=r;break;case"table":a=n;break;case"numbering":a=i;break}a&&a[s.styleId]===void 0&&(a[s.styleId]=s)}),new il(t,r,n,i)}function r8(e){var t=e.attributes["w:type"];if(t==="numbering")return i8(t,e);var r=$b(e),n=n8(e);return{type:t,styleId:r,name:n}}function n8(e){var t=e.first("w:name");return t?t.attributes["w:val"]:null}function i8(e,t){var r=$b(t),n=t.firstOrEmpty("w:pPr").firstOrEmpty("w:numPr").firstOrEmpty("w:numId").attributes["w:val"];return{type:e,numId:n,styleId:r}}function $b(e){return e.attributes["w:styleId"]}});var Jb=pe(ol=>{var o8=si(),s8=$r().Result;ol.createFootnotesReader=Zb.bind(ol,"footnote");ol.createEndnotesReader=Zb.bind(ol,"endnote");function Zb(e,t){function r(o){return s8.combine(o.getElementsByTagName("w:"+e).filter(n).map(i))}function n(o){var s=o.attributes["w:type"];return s!=="continuationSeparator"&&s!=="separator"}function i(o){var s=o.attributes["w:id"];return t.readXmlElements(o.children).map(function(a){return o8.Note({noteType:e,noteId:s,body:a})})}return r}});var Qb=pe(Yb=>{var a8=si(),l8=$r().Result;function u8(e){function t(n){return l8.combine(n.getElementsByTagName("w:comment").map(r))}function r(n){var i=n.attributes["w:id"];function o(s){return(n.attributes[s]||"").trim()||null}return e.readXmlElements(n.children).map(function(s){return a8.comment({commentId:i,body:s,authorName:o("w:author"),authorInitials:o("w:initials")})})}return t}Yb.createCommentsReader=u8});var t_=pe(e_=>{var c8=En();e_.Files=f8;function f8(){function e(t){return c8.reject(new Error("could not open external image: '"+t+`' +cannot open linked files from a web browser`))}return{read:e}}});var c_=pe(Yp=>{Yp.read=v8;Yp._findPartPaths=l_;var h8=En(),d8=si(),Jp=$r().Result,Kc=vp(),a_=Tb().readXmlFromZipFile,p8=qb().createBodyReader,m8=Hb().DocumentXmlReader,hs=Wb(),r_=Gb(),n_=Kb(),i_=Xb(),o_=Jb(),g8=Qb(),y8=t_().Files;function v8(e,t,r){t=t||{},r=r||{};var n=new y8({externalFileAccess:r.externalFileAccess,relativeToFile:t.path});return h8.props({contentTypes:b8(e),partPaths:l_(e),docxFile:e,files:n}).also(function(i){return{styles:x8(e,i.partPaths.styles)}}).also(function(i){return{numbering:_8(e,i.partPaths.numbering,i.styles)}}).also(function(i){return{footnotes:Gc(i.partPaths.footnotes,i,function(o,s){return s?o_.createFootnotesReader(o)(s):new Jp([])}),endnotes:Gc(i.partPaths.endnotes,i,function(o,s){return s?o_.createEndnotesReader(o)(s):new Jp([])}),comments:Gc(i.partPaths.comments,i,function(o,s){return s?g8.createCommentsReader(o)(s):new Jp([])})}}).also(function(i){return{notes:i.footnotes.flatMap(function(o){return i.endnotes.map(function(s){return new d8.Notes(o.concat(s))})})}}).then(function(i){return Gc(i.partPaths.mainDocument,i,function(o,s){return i.notes.flatMap(function(a){return i.comments.flatMap(function(u){var c=new m8({bodyReader:o,notes:a,comments:u});return c.convertXmlToDocument(s)})})})})}function l_(e){return E8(e).then(function(t){var r=s_({docxFile:e,relationships:t,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",basePath:"",fallbackPath:"word/document.xml"});if(!e.exists(r))throw new Error("Could not find main document part. Are you sure this is a valid .docx file?");return ds({filename:u_(r),readElement:hs.readRelationships,defaultValue:hs.defaultValue})(e).then(function(n){function i(o){return s_({docxFile:e,relationships:n,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/"+o,basePath:Kc.splitPath(r).dirname,fallbackPath:"word/"+o+".xml"})}return{mainDocument:r,comments:i("comments"),endnotes:i("endnotes"),footnotes:i("footnotes"),numbering:i("numbering"),styles:i("styles")}})})}function s_(e){var t=e.docxFile,r=e.relationships,n=e.relationshipType,i=e.basePath,o=e.fallbackPath,s=r.findTargetsByType(n),a=s.map(function(c){return w8(Kc.joinPath(i,c),"/")}),u=a.filter(function(c){return t.exists(c)});return u.length===0?o:u[0]}function w8(e,t){return e.substring(0,t.length)===t?e.substring(t.length):e}function ds(e){return function(t){return a_(t,e.filename).then(function(r){return r?e.readElement(r):e.defaultValue})}}function Gc(e,t,r){var n=ds({filename:u_(e),readElement:hs.readRelationships,defaultValue:hs.defaultValue});return n(t.docxFile).then(function(i){var o=new p8({relationships:i,contentTypes:t.contentTypes,docxFile:t.docxFile,numbering:t.numbering,styles:t.styles,files:t.files});return a_(t.docxFile,e).then(function(s){return r(o,s)})})}function u_(e){var t=Kc.splitPath(e);return Kc.joinPath(t.dirname,"_rels",t.basename+".rels")}var b8=ds({filename:"[Content_Types].xml",readElement:r_.readContentTypesFromXml,defaultValue:r_.defaultContentTypes});function _8(e,t,r){return ds({filename:t,readElement:function(n){return n_.readNumberingXml(n,{styles:r})},defaultValue:n_.defaultNumbering})(e)}function x8(e,t){return ds({filename:t,readElement:i_.readStylesXml,defaultValue:i_.defaultStyles})(e)}var E8=ds({filename:"_rels/.rels",readElement:hs.readRelationships,defaultValue:hs.defaultValue})});var d_=pe(Qp=>{var A8=(rt(),it(tt)),S8=En(),sl=zc();Qp.writeStyleMap=C8;Qp.readStyleMap=N8;var T8="http://schemas.zwobble.org/mammoth/style-map",$c="mammoth/style-map",f_="/"+$c;function C8(e,t){return e.write($c,t),k8(e).then(function(){return D8(e)})}function k8(e){var t="word/_rels/document.xml.rels",r="http://schemas.openxmlformats.org/package/2006/relationships",n="{"+r+"}Relationship";return e.read(t,"utf8").then(sl.readString).then(function(i){var o=i.children;h_(o,n,"Id",{Id:"rMammothStyleMap",Type:T8,Target:f_});var s={"":r};return e.write(t,sl.writeString(i,s))})}function D8(e){var t="[Content_Types].xml",r="http://schemas.openxmlformats.org/package/2006/content-types",n="{"+r+"}Override";return e.read(t,"utf8").then(sl.readString).then(function(i){var o=i.children;h_(o,n,"PartName",{PartName:f_,ContentType:"text/prs.mammoth.style-map"});var s={"":r};return e.write(t,sl.writeString(i,s))})}function h_(e,t,r,n){var i=A8.find(e,function(o){return o.name===t&&o.attributes[r]===n[r]});i?i.attributes=n:e.push(sl.element(t,n))}function N8(e){return e.exists($c)?e.read($c,"utf8"):S8.resolve(null)}});var tm=pe(Qi=>{var p_=al();function O8(e,t,r){return em(p_.element(e,t,{fresh:!1}),r)}function R8(e,t,r){var n=p_.element(e,t,{fresh:!0});return em(n,r)}function em(e,t){return{type:"element",tag:e,children:t||[]}}function I8(e){return{type:"text",value:e}}var F8={type:"forceWrite"};Qi.freshElement=R8;Qi.nonFreshElement=O8;Qi.elementWithTag=em;Qi.text=I8;Qi.forceWrite=F8;var M8={br:!0,hr:!0,img:!0,input:!0};function B8(e){return e.children.length===0&&M8[e.tag.tagName]}Qi.isVoidElement=B8});var b_=pe((BJ,w_)=>{var m_=(rt(),it(tt)),Xc=tm();function L8(e){return y_(v_(e))}function y_(e){var t=[];return e.map(P8).forEach(function(r){rm(t,r)}),t}function P8(e){return z8[e.type](e)}var z8={element:U8,text:g_,forceWrite:g_};function U8(e){return Xc.elementWithTag(e.tag,y_(e.children))}function g_(e){return e}function rm(e,t){var r=e[e.length-1];t.type==="element"&&!t.tag.fresh&&r&&r.type==="element"&&t.tag.matchesElement(r.tag)?(t.tag.separator&&rm(r.children,Xc.text(t.tag.separator)),t.children.forEach(function(n){rm(r.children,n)})):e.push(t)}function v_(e){return q8(e,function(t){return j8[t.type](t)})}function q8(e,t){return m_.flatten(m_.map(e,t),!0)}var j8={element:W8,text:V8,forceWrite:H8};function H8(e){return[e]}function W8(e){var t=v_(e.children);return t.length===0&&!Xc.isVoidElement(e)?[]:[Xc.elementWithTag(e.tag,t)]}function V8(e){return e.value.length===0?[]:[e]}w_.exports=L8});var ll=pe(ui=>{var ps=tm();ui.freshElement=ps.freshElement;ui.nonFreshElement=ps.nonFreshElement;ui.elementWithTag=ps.elementWithTag;ui.text=ps.text;ui.forceWrite=ps.forceWrite;ui.simplify=b_();function __(e,t){t.forEach(function(r){G8(e,r)})}function G8(e,t){K8[t.type](e,t)}var K8={element:$8,text:X8,forceWrite:function(){}};function $8(e,t){ps.isVoidElement(t)?e.selfClosing(t.tag.tagName,t.tag.attributes):(e.open(t.tag.tagName,t.tag.attributes),__(e,t.children),e.close(t.tag.tagName))}function X8(e,t){e.text(t.value)}ui.write=__});var al=pe(ms=>{var nm=(rt(),it(tt)),Z8=ll();ms.topLevelElement=J8;ms.elements=im;ms.element=om;function J8(e,t){return im([om(e,t,{fresh:!0})])}function im(e){return new x_(e.map(function(t){return nm.isString(t)?om(t):t}))}function x_(e){this._elements=e}x_.prototype.wrap=function(t){for(var r=t(),n=this._elements.length-1;n>=0;n--)r=this._elements[n].wrapNodes(r);return r};function om(e,t,r){return r=r||{},new Zc(e,t,r)}function Zc(e,t,r){var n=Object.create(null);nm.isArray(e)?(e.forEach(function(i){n[i]=!0}),e=e[0]):n[e]=!0,this.tagName=e,this.tagNames=n,this.attributes=t||{},this.fresh=r.fresh,this.separator=r.separator}Zc.prototype.matchesElement=function(e){return this.tagNames[e.tagName]&&nm.isEqual(this.attributes||{},e.attributes||{})};Zc.prototype.wrap=function(t){return this.wrapNodes(t())};Zc.prototype.wrapNodes=function(t){return[Z8.elementWithTag(this,t)]};ms.empty=im([]);ms.ignore={wrap:function(){return[]}}});var sm=pe(gs=>{var Y8=(rt(),it(tt)),Q8=En(),eN=ll();gs.imgElement=E_;function E_(e){return function(t,r){return Q8.when(e(t)).then(function(n){var i={};return t.altText&&(i.alt=t.altText),Y8.extend(i,n),[eN.freshElement("img",i)]})}}gs.inline=gs.imgElement;gs.dataUri=E_(function(e){return e.readAsBase64String().then(function(t){return{src:"data:"+e.contentType+";base64,"+t}})});function tN(e){return e.contentType.split(/\/|\\/)[1]}gs.imageFilenameExtension=tN});var C_=pe(T_=>{var A_=(rt(),it(tt));T_.writer=rN;function rN(e){return e=e||{},e.prettyPrint?nN():S_()}var Jc={div:!0,p:!0,ul:!0,li:!0};function nN(){var e=0,t=" ",r=[],n=!0,i=!1,o=S_();function s(m,g){Jc[m]&&p(),r.push(m),o.open(m,g),Jc[m]&&e++,n=!1}function a(m){Jc[m]&&(e--,p()),r.pop(),o.close(m)}function u(m){h();var g=d()?m:m.replace(` +`,` +`+t);o.text(g)}function c(m,g){p(),o.selfClosing(m,g)}function f(){return r.length===0||Jc[r[r.length-1]]}function h(){i||(p(),i=!0)}function p(){if(i=!1,!n&&f()&&!d()){o._append(` +`);for(var m=0;m")}function r(u){e.push("")}function n(u,c){var f=i(c);e.push("<"+u+f+" />")}function i(u){return A_.map(u,function(c,f){return" "+f+'="'+oN(c)+'"'}).join("")}function o(u){e.push(iN(u))}function s(u){e.push(u)}function a(){return e.join("")}return{asString:a,open:t,close:r,text:o,selfClosing:n,_append:s}}function iN(e){return e.replace(/&/g,"&").replace(//g,">")}function oN(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")}});var I_=pe(R_=>{var sN=(rt(),it(tt));function k_(e){return Yc(e,e)}function Yc(e,t){return function(){return{start:e,end:t}}}function aN(e){var t=e.href||"";return t?{start:"[",end:"]("+t+")",anchorPosition:"before"}:{}}function lN(e){var t=e.src||"",r=e.alt||"";return t||r?{start:"!["+r+"]("+t+")"}:{}}function D_(e){return function(t,r){return{start:r?` +`:"",end:r?"":` +`,list:{isOrdered:e.isOrdered,indent:r?r.indent+1:0,count:0}}}}function uN(e,t,r){t=t||{indent:0,isOrdered:!1,count:0},t.count++,r.hasClosed=!1;var n=t.isOrdered?t.count+".":"-",i=O_(" ",t.indent)+n+" ";return{start:i,end:function(){if(!r.hasClosed)return r.hasClosed=!0,` +`}}}var N_={p:Yc("",` + +`),br:Yc("",` +`),ul:D_({isOrdered:!1}),ol:D_({isOrdered:!0}),li:uN,strong:k_("__"),em:k_("*"),a:aN,img:lN};(function(){for(var e=1;e<=6;e++)N_["h"+e]=Yc(O_("#",e)+" ",` + +`)})();function O_(e,t){return new Array(t+1).join(e)}function cN(){var e=[],t=[],r=null,n={};function i(f,h){h=h||{};var p=N_[f]||function(){return{}},d=p(h,r,n);t.push({end:d.end,list:r}),d.list&&(r=d.list);var m=d.anchorPosition==="before";m&&o(h),e.push(d.start||""),m||o(h)}function o(f){f.id&&e.push('
    ')}function s(f){var h=t.pop();r=h.list;var p=sN.isFunction(h.end)?h.end():h.end;e.push(p||"")}function a(f,h){i(f,h),s(f)}function u(f){e.push(fN(f))}function c(){return e.join("")}return{asString:c,open:i,close:s,text:u,selfClosing:a}}R_.writer=cN;function fN(e){return e.replace(/\\/g,"\\\\").replace(/([\`\*_\{\}\[\]\(\)\#\+\-\.\!])/g,"\\$1")}});var M_=pe(F_=>{var hN=C_(),dN=I_();F_.writer=pN;function pN(e){return e=e||{},e.outputFormat==="markdown"?dN.writer():hN.writer(e)}});var z_=pe(um=>{var ci=(rt(),it(tt)),B_=En(),Qc=si(),Er=al(),lm=$r(),mN=sm(),Fe=ll(),gN=M_();um.DocumentConverter=yN;function yN(e){return{convertToHtml:function(t){var r=ci.indexBy(t.type===Qc.types.document?t.comments:[],"commentId"),n=new vN(e,r);return n.convertToHtml(t)}}}function vN(e,t){var r=1,n=[],i=[];e=ci.extend({ignoreEmptyParagraphs:!0},e);var o=e.idPrefix===void 0?"":e.idPrefix,s=e.ignoreEmptyParagraphs,a=Er.topLevelElement("p"),u=e.styleMap||[];function c($){var z=[],G=h($,z,Object.create(null)),X=[];P_(G,function(Q){Q.type==="deferred"&&X.push(Q)});var q=Object.create(null);return B_.mapSeries(X,function(Q){return Q.value().then(function(oe){q[Q.id]=oe})}).then(function(){function Q(ae){return am(ae,function(he){return he.type==="deferred"?q[he.id]:he.children?[ci.extend({},he,{children:Q(he.children)})]:[he]})}var oe=gN.writer({prettyPrint:e.prettyPrint,outputFormat:e.outputFormat});return Fe.write(oe,Fe.simplify(Q(G))),new lm.Result(oe.asString(),z)})}function f($,z,G){return am($,function(X){return h(X,z,G)})}function h($,z,G){if(!G)throw new Error("options not set");var X=H[$.type];return X?X($,z,G):[]}function p($,z,G){return d($,z).wrap(function(){var X=f($.children,z,G);return s?X:[Fe.forceWrite].concat(X)})}function d($,z){var G=w($);return G?G.to:($.styleId&&z.push(L_("paragraph",$)),a)}function m($,z,G){var X=function(){return f($.children,z,G)},q=[];if($.highlight!==null){var Q=y({type:"highlight",color:$.highlight});Q&&q.push(Q)}$.isSmallCaps&&q.push(g("smallCaps")),$.isAllCaps&&q.push(g("allCaps")),$.isStrikethrough&&q.push(g("strikethrough","s")),$.isUnderline&&q.push(g("underline")),$.verticalAlignment===Qc.verticalAlignment.subscript&&q.push(Er.element("sub",{},{fresh:!1})),$.verticalAlignment===Qc.verticalAlignment.superscript&&q.push(Er.element("sup",{},{fresh:!1})),$.isItalic&&q.push(g("italic","em")),$.isBold&&q.push(g("bold","strong"));var oe=Er.empty,ae=w($);return ae?oe=ae.to:$.styleId&&z.push(L_("run",$)),q.push(oe),q.forEach(function(he){X=he.wrap.bind(he,X)}),X()}function g($,z){var G=y({type:$});return G||(z?Er.element(z,{},{fresh:!1}):Er.empty)}function y($,z){var G=w($);return G?G.to:z}function w($){for(var z=0;z{var xN=si();function U_(e){if(e.type==="text")return e.value;if(e.type===xN.types.tab)return" ";var t=e.type==="paragraph"?` + +`:"";return(e.children||[]).map(U_).join("")+t}q_.convertElementToRawText=U_});var W_=pe((VJ,H_)=>{var ys=H_.exports=function(e,t){this._tokens=e,this._startIndex=t||0};ys.prototype.head=function(){return this._tokens[this._startIndex]};ys.prototype.tail=function(e){return new ys(this._tokens,this._startIndex+1)};ys.prototype.toArray=function(){return this._tokens.slice(this._startIndex)};ys.prototype.end=function(){return this._tokens[this._tokens.length-1]};ys.prototype.to=function(e){var t=this.head().source,r=e.head()||e.end();return t.to(r.source)}});var G_=pe(V_=>{var EN=W_();V_.Parser=function(e){var t=function(r,n){return r(new EN(n))};return{parseTokens:t}}});var $_=pe(Pr=>{Pr.none=Object.create({value:function(){throw new Error("Called value on none")},isNone:function(){return!0},isSome:function(){return!1},map:function(){return Pr.none},flatMap:function(){return Pr.none},filter:function(){return Pr.none},toArray:function(){return[]},orElse:K_,valueOrElse:K_});function K_(e){return typeof e=="function"?e():e}Pr.some=function(e){return new gr(e)};var gr=function(e){this._value=e};gr.prototype.value=function(){return this._value};gr.prototype.isNone=function(){return!1};gr.prototype.isSome=function(){return!0};gr.prototype.map=function(e){return new gr(e(this._value))};gr.prototype.flatMap=function(e){return e(this._value)};gr.prototype.filter=function(e){return e(this._value)?this:Pr.none};gr.prototype.toArray=function(){return[this._value]};gr.prototype.orElse=function(e){return this};gr.prototype.valueOrElse=function(e){return this._value};Pr.isOption=function(e){return e===Pr.none||e instanceof gr};Pr.fromNullable=function(e){return e==null?Pr.none:new gr(e)}});var ef=pe(($J,X_)=>{X_.exports={failure:function(e,t){if(e.length<1)throw new Error("Failure must have errors");return new It({status:"failure",remaining:t,errors:e})},error:function(e,t){if(e.length<1)throw new Error("Failure must have errors");return new It({status:"error",remaining:t,errors:e})},success:function(e,t,r){return new It({status:"success",value:e,source:r,remaining:t,errors:[]})},cut:function(e){return new It({status:"cut",remaining:e,errors:[]})}};var It=function(e){this._value=e.value,this._status=e.status,this._hasValue=e.value!==void 0,this._remaining=e.remaining,this._source=e.source,this._errors=e.errors};It.prototype.map=function(e){return this._hasValue?new It({value:e(this._value,this._source),status:this._status,remaining:this._remaining,source:this._source,errors:this._errors}):this};It.prototype.changeRemaining=function(e){return new It({value:this._value,status:this._status,remaining:e,source:this._source,errors:this._errors})};It.prototype.isSuccess=function(){return this._status==="success"||this._status==="cut"};It.prototype.isFailure=function(){return this._status==="failure"};It.prototype.isError=function(){return this._status==="error"};It.prototype.isCut=function(){return this._status==="cut"};It.prototype.value=function(){return this._value};It.prototype.remaining=function(){return this._remaining};It.prototype.source=function(){return this._source};It.prototype.errors=function(){return this._errors}});var cm=pe(Z_=>{Z_.error=function(e){return new tf(e)};var tf=function(e){this.expected=e.expected,this.actual=e.actual,this._location=e.location};tf.prototype.describe=function(){var e=this._location?this._location.describe()+`: +`:"";return e+"Expected "+this.expected+` +but got `+this.actual};tf.prototype.lineNumber=function(){return this._location.lineNumber()};tf.prototype.characterNumber=function(){return this._location.characterNumber()}});var Y_=pe(J_=>{var ZJ=J_.fromArray=function(e){var t=0,r=function(){return t{var rf=(rt(),it(tt)),Q_=$_(),Ar=ef(),ex=cm(),AN=Y_();ze.token=function(e,t){var r=t!==void 0;return function(n){var i=n.head();if(i&&i.name===e&&(!r||i.value===t))return Ar.success(i.value,n.tail(),i.source);var o=rx({name:e,value:t});return nx(n,o)}};ze.tokenOfType=function(e){return ze.token(e)};ze.firstOf=function(e,t){return rf.isArray(t)||(t=Array.prototype.slice.call(arguments,1)),function(r){return AN.fromArray(t).map(function(n){return n(r)}).filter(function(n){return n.isSuccess()||n.isError()}).first()||nx(r,e)}};ze.then=function(e,t){return function(r){var n=e(r);return n.map||console.log(n),n.map(t)}};ze.sequence=function(){var e=Array.prototype.slice.call(arguments,0),t=function(n){var i=rf.foldl(e,function(s,a){var u=s.result,c=s.hasCut;if(!u.isSuccess())return{result:u,hasCut:c};var f=a(u.remaining());if(f.isCut())return{result:u,hasCut:!0};if(f.isSuccess()){var h;a.isCaptured?h=u.value().withValue(a,f.value()):h=u.value();var p=f.remaining(),d=n.to(p);return{result:Ar.success(h,p,d),hasCut:c}}else return c?{result:Ar.error(f.errors(),f.remaining()),hasCut:c}:{result:f,hasCut:c}},{result:Ar.success(new ul,n),hasCut:!1}).result,o=n.to(i.remaining());return i.map(function(s){return s.withValue(ze.sequence.source,o)})};t.head=function(){var n=rf.find(e,r);return ze.then(t,ze.sequence.extract(n))},t.map=function(n){return ze.then(t,function(i){return n.apply(this,i.toArray())})};function r(n){return n.isCaptured}return t};var ul=function(e,t){this._values=e||{},this._valuesArray=t||[]};ul.prototype.withValue=function(e,t){if(e.captureName&&e.captureName in this._values)throw new Error('Cannot add second value for capture "'+e.captureName+'"');var r=rf.clone(this._values);r[e.captureName]=t;var n=this._valuesArray.concat([t]);return new ul(r,n)};ul.prototype.get=function(e){if(e.captureName in this._values)return this._values[e.captureName];throw new Error('No value for capture "'+e.captureName+'"')};ul.prototype.toArray=function(){return this._valuesArray};ze.sequence.capture=function(e,t){var r=function(){return e.apply(this,arguments)};return r.captureName=t,r.isCaptured=!0,r};ze.sequence.extract=function(e){return function(t){return t.get(e)}};ze.sequence.applyValues=function(e){var t=Array.prototype.slice.call(arguments,1);return function(r){var n=t.map(function(i){return r.get(i)});return e.apply(this,n)}};ze.sequence.source={captureName:"\u2603source\u2603"};ze.sequence.cut=function(){return function(e){return Ar.cut(e)}};ze.optional=function(e){return function(t){var r=e(t);return r.isSuccess()?r.map(Q_.some):r.isFailure()?Ar.success(Q_.none,t):r}};ze.zeroOrMoreWithSeparator=function(e,t){return tx(e,t,!1)};ze.oneOrMoreWithSeparator=function(e,t){return tx(e,t,!0)};var SN=ze.zeroOrMore=function(e){return function(t){for(var r=[],n;(n=e(t))&&n.isSuccess();)t=n.remaining(),r.push(n.value());return n.isError()?n:Ar.success(r,t)}};ze.oneOrMore=function(e){return ze.oneOrMoreWithSeparator(e,TN)};function TN(e){return Ar.success(null,e)}var tx=function(e,t,r){return function(n){var i=e(n);if(i.isSuccess()){var o=ze.sequence.capture(e,"main"),s=SN(ze.then(ze.sequence(t,o),ze.sequence.extract(o))),a=s(i.remaining());return Ar.success([i.value()].concat(a.value()),a.remaining())}else return r||i.isError()?i:Ar.success([],n)}};ze.leftAssociative=function(e,t,r){var n;r?n=[{func:r,rule:t}]:n=t,n=n.map(function(o){return ze.then(o.rule,function(s){return function(a,u){return o.func(a,s,u)}})});var i=ze.firstOf.apply(null,["rules"].concat(n));return function(o){var s=o,a=e(o);if(!a.isSuccess())return a;for(var u=i(a.remaining());u.isSuccess();){var c=u.remaining(),f=s.to(u.remaining()),h=u.value();a=Ar.success(h(a.value(),f),c,f),u=i(a.remaining())}return u.isError()?u:a}};ze.leftAssociative.firstOf=function(){return Array.prototype.slice.call(arguments,0)};ze.nonConsuming=function(e){return function(t){return e(t).changeRemaining(t)}};var rx=function(e){return e.value?e.name+' "'+e.value+'"':e.name};function nx(e,t){var r,n=e.head();return n?r=ex.error({expected:t,actual:rx(n),location:n.source}):r=ex.error({expected:t,actual:"end of tokens"}),Ar.failure([r],e)}});var hm=pe((eY,ix)=>{var QJ=ix.exports=function(e,t){var r={asString:function(){return e},range:function(n,i){return new to(e,t,n,i)}};return r},to=function(e,t,r,n){this._string=e,this._description=t,this._startIndex=r,this._endIndex=n};to.prototype.to=function(e){return new to(this._string,this._description,this._startIndex,e._endIndex)};to.prototype.describe=function(){var e=this._position(),t=this._description?this._description+` +`:"";return t+"Line number: "+e.lineNumber+` +Character number: `+e.characterNumber};to.prototype.lineNumber=function(){return this._position().lineNumber};to.prototype.characterNumber=function(){return this._position().characterNumber};to.prototype._position=function(){for(var e=this,t=0,r=function(){return e._string.indexOf(` +`,t)},n=1;r()!==-1&&r(){ox.exports=function(e,t,r){this.name=e,this.value=t,r&&(this.source=r)}});var ax=pe(nf=>{var sx=fm(),CN=ef();nf.parser=function(e,t,r){var n={rule:a,leftAssociative:u,rightAssociative:c},i=new pm(r.map(s)),o=sx.firstOf(e,t);function s(p){return{name:p.name,rule:kN(p.ruleBuilder.bind(null,n))}}function a(){return f(i)}function u(p){return f(i.untilExclusive(p))}function c(p){return f(i.untilInclusive(p))}function f(p){return h.bind(null,p)}function h(p,d){var m=o(d);return m.isSuccess()?p.apply(m):m}return n};function pm(e){function t(s){return new pm(e.slice(0,n().indexOf(s)))}function r(s){return new pm(e.slice(0,n().indexOf(s)+1))}function n(){return e.map(function(s){return s.name})}function i(s){for(var a,u;;)if(a=o(s.remaining()),a.isSuccess())u=s.source().to(a.source()),s=CN.success(a.value()(s.value(),u),a.remaining(),u);else return a.isFailure()?s:a}function o(s){return sx.firstOf("infix",e.map(function(a){return a.rule}))(s)}return{apply:i,untilExclusive:t,untilInclusive:r}}nf.infix=function(e,t){function r(n){return nf.infix(e,function(i){var o=t(i);return function(s){var a=o(s);return a.map(function(u){return function(c,f){return n(c,u,f)}})}})}return{name:e,ruleBuilder:t,map:r}};var kN=function(e){var t;return function(r){return t||(t=e()),t(r)}}});var ux=pe(lx=>{var mm=dm(),DN=hm();lx.RegexTokeniser=NN;function NN(e){e=e.map(function(i){return{name:i.name,regex:new RegExp(i.regex.source,"g")}});function t(i,o){for(var s=new DN(i,o),a=0,u=[];ao){var f=c[1],p=new mm(e[a].name,f,s.range(o,h));return{token:p,endIndex:h}}}}var h=o+1,p=new mm("unrecognisedCharacter",i.substring(o,h),s.range(o,h));return{token:p,endIndex:h}}function n(i,o){return new mm("end",null,o.range(i.length,i.length))}return{tokenise:t}}});var gm=pe(Qr=>{Qr.Parser=G_().Parser;Qr.rules=fm();Qr.errors=cm();Qr.results=ef();Qr.StringSource=hm();Qr.Token=dm();Qr.bottomUp=ax();Qr.RegexTokeniser=ux().RegexTokeniser;Qr.rule=function(e){var t;return function(r){return t||(t=e()),t(r)}}});var fx=pe(Et=>{Et.paragraph=ON;Et.run=RN;Et.table=IN;Et.bold=new zr("bold");Et.italic=new zr("italic");Et.underline=new zr("underline");Et.strikethrough=new zr("strikethrough");Et.allCaps=new zr("allCaps");Et.smallCaps=new zr("smallCaps");Et.highlight=FN;Et.commentReference=new zr("commentReference");Et.lineBreak=new of({breakType:"line"});Et.pageBreak=new of({breakType:"page"});Et.columnBreak=new of({breakType:"column"});Et.equalTo=BN;Et.startsWith=LN;function ON(e){return new zr("paragraph",e)}function RN(e){return new zr("run",e)}function IN(e){return new zr("table",e)}function FN(e){return new cx(e)}function zr(e,t){t=t||{},this._elementType=e,this._styleId=t.styleId,this._styleName=t.styleName,t.list&&(this._listIndex=t.list.levelIndex,this._listIsOrdered=t.list.isOrdered)}zr.prototype.matches=function(e){return e.type===this._elementType&&(this._styleId===void 0||e.styleId===this._styleId)&&(this._styleName===void 0||e.styleName&&this._styleName.operator(this._styleName.operand,e.styleName))&&(this._listIndex===void 0||MN(e,this._listIndex,this._listIsOrdered))&&(this._breakType===void 0||this._breakType===e.breakType)};function cx(e){e=e||{},this._color=e.color}cx.prototype.matches=function(e){return e.type==="highlight"&&(this._color===void 0||e.color===this._color)};function of(e){e=e||{},this._breakType=e.breakType}of.prototype.matches=function(e){return e.type==="break"&&(this._breakType===void 0||e.breakType===this._breakType)};function MN(e,t,r){return e.numbering&&e.numbering.level==t&&e.numbering.isOrdered==r}function BN(e){return{operator:PN,operand:e}}function LN(e){return{operator:zN,operand:e}}function PN(e,t){return e.toUpperCase()===t.toUpperCase()}function zN(e,t){return t.toUpperCase().indexOf(e.toUpperCase())===0}});var px=pe(dx=>{var UN=gm(),qN=UN.RegexTokeniser;dx.tokenise=jN;var hx="'((?:\\\\(?:.|$)|[^'\\\\])*)";function jN(e){var t="(?:[a-zA-Z\\-_]|\\\\.)",r=new qN([{name:"identifier",regex:new RegExp("("+t+"(?:"+t+"|[0-9])*)")},{name:"dot",regex:/\./},{name:"colon",regex:/:/},{name:"gt",regex:/>/},{name:"whitespace",regex:/\s+/},{name:"arrow",regex:/=>/},{name:"equals",regex:/=/},{name:"startsWith",regex:/\^=/},{name:"open-paren",regex:/\(/},{name:"close-paren",regex:/\)/},{name:"open-square-bracket",regex:/\[/},{name:"close-square-bracket",regex:/\]/},{name:"string",regex:new RegExp(hx+"'")},{name:"unterminated-string",regex:new RegExp(hx)},{name:"integer",regex:/([0-9]+)/},{name:"choice",regex:/\|/},{name:"bang",regex:/(!)/}]);return r.tokenise(e)}});var vx=pe(lf=>{var HN=(rt(),it(tt)),ge=gm(),Ft=fx(),sf=al(),WN=px().tokenise,ym=$r();lf.readHtmlPath=$N;lf.readDocumentMatcher=KN;lf.readStyle=VN;function VN(e){return vm(rO,e)}function GN(){return ge.rules.sequence(ge.rules.sequence.capture(mx()),ge.rules.tokenOfType("whitespace"),ge.rules.tokenOfType("arrow"),ge.rules.sequence.capture(ge.rules.optional(ge.rules.sequence(ge.rules.tokenOfType("whitespace"),ge.rules.sequence.capture(gx())).head())),ge.rules.tokenOfType("end")).map(function(e,t){return{from:e,to:t.valueOrElse(sf.empty)}})}function KN(e){return vm(mx(),e)}function mx(){var e=ge.rules.sequence,t=function(A,k){return ge.rules.then(ge.rules.token("identifier",A),function(){return k})},r=t("p",Ft.paragraph),n=t("r",Ft.run),i=ge.rules.firstOf("p or r or table",r,n),o=ge.rules.sequence(ge.rules.tokenOfType("dot"),ge.rules.sequence.cut(),ge.rules.sequence.capture(af)).map(function(A){return{styleId:A}}),s=ge.rules.firstOf("style name matcher",ge.rules.then(ge.rules.sequence(ge.rules.tokenOfType("equals"),ge.rules.sequence.cut(),ge.rules.sequence.capture(vs)).head(),function(A){return{styleName:Ft.equalTo(A)}}),ge.rules.then(ge.rules.sequence(ge.rules.tokenOfType("startsWith"),ge.rules.sequence.cut(),ge.rules.sequence.capture(vs)).head(),function(A){return{styleName:Ft.startsWith(A)}})),a=ge.rules.sequence(ge.rules.tokenOfType("open-square-bracket"),ge.rules.sequence.cut(),ge.rules.token("identifier","style-name"),ge.rules.sequence.capture(s),ge.rules.tokenOfType("close-square-bracket")).head(),u=ge.rules.firstOf("list type",t("ordered-list",{isOrdered:!0}),t("unordered-list",{isOrdered:!1})),c=e(ge.rules.tokenOfType("colon"),e.capture(u),e.cut(),ge.rules.tokenOfType("open-paren"),e.capture(XN),ge.rules.tokenOfType("close-paren")).map(function(A,k){return{list:{isOrdered:A.isOrdered,levelIndex:k-1}}});function f(A){var k=ge.rules.firstOf.apply(ge.rules.firstOf,["matcher suffix"].concat(A)),B=ge.rules.zeroOrMore(k);return ge.rules.then(B,function(O){var P={};return O.forEach(function(Y){HN.extend(P,Y)}),P})}var h=e(e.capture(i),e.capture(f([o,a,c]))).map(function(A,k){return A(k)}),p=e(ge.rules.token("identifier","table"),e.capture(f([o,a]))).map(function(A){return Ft.table(A)}),d=t("b",Ft.bold),m=t("i",Ft.italic),g=t("u",Ft.underline),y=t("strike",Ft.strikethrough),w=t("all-caps",Ft.allCaps),E=t("small-caps",Ft.smallCaps),b=e(ge.rules.token("identifier","highlight"),ge.rules.sequence.capture(ge.rules.optional(ge.rules.sequence(ge.rules.tokenOfType("open-square-bracket"),ge.rules.sequence.cut(),ge.rules.token("identifier","color"),ge.rules.tokenOfType("equals"),ge.rules.sequence.capture(vs),ge.rules.tokenOfType("close-square-bracket")).head()))).map(function(A){return Ft.highlight({color:A.valueOrElse(void 0)})}),C=t("comment-reference",Ft.commentReference),S=e(ge.rules.token("identifier","br"),e.cut(),ge.rules.tokenOfType("open-square-bracket"),ge.rules.token("identifier","type"),ge.rules.tokenOfType("equals"),e.capture(vs),ge.rules.tokenOfType("close-square-bracket")).map(function(A){switch(A){case"line":return Ft.lineBreak;case"page":return Ft.pageBreak;case"column":return Ft.columnBreak;default:}});return ge.rules.firstOf("element type",h,p,d,m,g,y,w,E,b,C,S)}function $N(e){return vm(gx(),e)}function gx(){var e=ge.rules.sequence.capture,t=ge.rules.tokenOfType("whitespace"),r=ge.rules.then(ge.rules.optional(ge.rules.sequence(ge.rules.tokenOfType("colon"),ge.rules.token("identifier","fresh"))),function(s){return s.map(function(){return!0}).valueOrElse(!1)}),n=ge.rules.then(ge.rules.optional(ge.rules.sequence(ge.rules.tokenOfType("colon"),ge.rules.token("identifier","separator"),ge.rules.tokenOfType("open-paren"),e(vs),ge.rules.tokenOfType("close-paren")).head()),function(s){return s.valueOrElse("")}),i=ge.rules.oneOrMoreWithSeparator(af,ge.rules.tokenOfType("choice")),o=ge.rules.sequence(e(i),e(ge.rules.zeroOrMore(QN)),e(r),e(n)).map(function(s,a,u,c){var f=Object.create(null),h={};return a.forEach(function(p){p.append&&f[p.name]?f[p.name]+=" "+p.value:f[p.name]=p.value}),u&&(h.fresh=!0),c&&(h.separator=c),sf.element(s,f,h)});return ge.rules.firstOf("html path",ge.rules.then(ge.rules.tokenOfType("bang"),function(){return sf.ignore}),ge.rules.then(ge.rules.zeroOrMoreWithSeparator(o,ge.rules.sequence(t,ge.rules.tokenOfType("gt"),t)),sf.elements))}var af=ge.rules.then(ge.rules.tokenOfType("identifier"),yx),XN=ge.rules.tokenOfType("integer"),vs=ge.rules.then(ge.rules.tokenOfType("string"),yx),ZN={n:` +`,r:"\r",t:" "};function yx(e){return e.replace(/\\(.)/g,function(t,r){return ZN[r]||r})}var JN=ge.rules.sequence(ge.rules.tokenOfType("open-square-bracket"),ge.rules.sequence.cut(),ge.rules.sequence.capture(af),ge.rules.tokenOfType("equals"),ge.rules.sequence.capture(vs),ge.rules.tokenOfType("close-square-bracket")).map(function(e,t){return{name:e,value:t,append:!1}}),YN=ge.rules.sequence(ge.rules.tokenOfType("dot"),ge.rules.sequence.cut(),ge.rules.sequence.capture(af)).map(function(e){return{name:"class",value:e,append:!0}}),QN=ge.rules.firstOf("attribute or class",JN,YN);function vm(e,t){var r=WN(t),n=ge.Parser(),i=n.parseTokens(e,r);return i.isSuccess()?ym.success(i.value()):new ym.Result(null,[ym.warning(eO(t,i))])}function eO(e,t){return"Did not understand this style mapping, so ignored it: "+e+` +`+t.errors().map(tO).join(` +`)}function tO(e){return"Error was at character number "+e.characterNumber()+": Expected "+e.expected+" but got "+e.actual}var rO=GN()});var _x=pe(uf=>{uf.readOptions=oO;var bx=(rt(),it(tt)),nO=uf._defaultStyleMap=["p.Heading1 => h1:fresh","p.Heading2 => h2:fresh","p.Heading3 => h3:fresh","p.Heading4 => h4:fresh","p.Heading5 => h5:fresh","p.Heading6 => h6:fresh","p[style-name='Heading 1'] => h1:fresh","p[style-name='Heading 2'] => h2:fresh","p[style-name='Heading 3'] => h3:fresh","p[style-name='Heading 4'] => h4:fresh","p[style-name='Heading 5'] => h5:fresh","p[style-name='Heading 6'] => h6:fresh","p[style-name='heading 1'] => h1:fresh","p[style-name='heading 2'] => h2:fresh","p[style-name='heading 3'] => h3:fresh","p[style-name='heading 4'] => h4:fresh","p[style-name='heading 5'] => h5:fresh","p[style-name='heading 6'] => h6:fresh","p.Heading => h1:fresh","p[style-name='Heading'] => h1:fresh","r[style-name='Strong'] => strong","p[style-name='footnote text'] => p:fresh","r[style-name='footnote reference'] =>","p[style-name='endnote text'] => p:fresh","r[style-name='endnote reference'] =>","p[style-name='annotation text'] => p:fresh","r[style-name='annotation reference'] =>","p[style-name='Footnote'] => p:fresh","r[style-name='Footnote anchor'] =>","p[style-name='Endnote'] => p:fresh","r[style-name='Endnote anchor'] =>","p:unordered-list(1) => ul > li:fresh","p:unordered-list(2) => ul|ol > li > ul > li:fresh","p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:ordered-list(1) => ol > li:fresh","p:ordered-list(2) => ul|ol > li > ol > li:fresh","p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","r[style-name='Hyperlink'] =>","p[style-name='Normal'] => p:fresh","p.Body => p:fresh","p[style-name='Body'] => p:fresh"],iO=uf._standardOptions={externalFileAccess:!1,transformDocument:sO,includeDefaultStyleMap:!0,includeEmbeddedStyleMap:!0};function oO(e){return e=e||{},bx.extend({},iO,e,{customStyleMap:wx(e.styleMap),readStyleMap:function(){var t=this.customStyleMap;return this.includeEmbeddedStyleMap&&(t=t.concat(wx(this.embeddedStyleMap))),this.includeDefaultStyleMap&&(t=t.concat(nO)),t}})}function wx(e){return e?bx.isString(e)?e.split(` +`).map(function(t){return t.trim()}).filter(function(t){return t!==""&&t.charAt(0)!=="#"}):e:[]}function sO(e){return e}});var Ax=pe(Ex=>{var xx=En(),aO=vp();Ex.openZip=lO;function lO(e){return e.arrayBuffer?xx.resolve(aO.openArrayBuffer(e.arrayBuffer)):xx.reject(new Error("Could not find file in options"))}});var Tx=pe(Sx=>{var uO=al(),cO=ll();Sx.element=fO;function fO(e){return function(t){return cO.elementWithTag(uO.element(e),[t])}}});var kx=pe(Ur=>{var hO=(rt(),it(tt)),Cx=c_(),wm=d_(),dO=z_().DocumentConverter,pO=j_().convertElementToRawText,mO=vx().readStyle,gO=_x().readOptions,cf=Ax(),yO=$r().Result;Ur.convertToHtml=vO;Ur.convertToMarkdown=wO;Ur.convert=bm;Ur.extractRawText=EO;Ur.images=sm();Ur.transforms=Vp();Ur.underline=Tx();Ur.embedStyleMap=AO;Ur.readEmbeddedStyleMap=bO;function vO(e,t){return bm(e,t)}function wO(e,t){var r=Object.create(t||{});return r.outputFormat="markdown",bm(e,r)}function bm(e,t){return t=gO(t),cf.openZip(e).tap(function(r){return wm.readStyleMap(r).then(function(n){t.embeddedStyleMap=n})}).then(function(r){return Cx.read(r,e,t).then(function(n){return n.map(t.transformDocument)}).then(function(n){return _O(n,t)})})}function bO(e){return cf.openZip(e).then(wm.readStyleMap)}function _O(e,t){var r=xO(t.readStyleMap()),n=hO.extend({},t,{styleMap:r.value}),i=new dO(n);return e.flatMapThen(function(o){return r.flatMapThen(function(s){return i.convertToHtml(o)})})}function xO(e){return yO.combine((e||[]).map(mO)).map(function(t){return t.filter(function(r){return!!r})})}function EO(e){return cf.openZip(e).then(Cx.read).then(function(t){return t.map(pO)})}function AO(e,t){return cf.openZip(e).tap(function(r){return wm.writeStyleMap(r,t)}).then(function(r){return r.toArrayBuffer()}).then(function(r){return{toArrayBuffer:function(){return r},toBuffer:function(){return Buffer.from(r)}}})}Ur.styleMapping=function(){throw new Error(`Use a raw string instead of mammoth.styleMapping e.g. "p[style-name='Title'] => h1" instead of mammoth.styleMapping("p[style-name='Title'] => h1")`)}});var b3=f1(kx(),1);var kg={};Ut(kg,{AbstractNumbering:()=>qm,AlignmentType:()=>qr,AnnotationReference:()=>EI,Attributes:()=>ut,BaseXmlComponent:()=>yl,Body:()=>wS,Bookmark:()=>AA,BookmarkEnd:()=>TA,BookmarkStart:()=>SA,Border:()=>TE,BorderStyle:()=>Df,BuilderElement:()=>ve,CarriageReturn:()=>kI,CellMerge:()=>XA,CellMergeAttributes:()=>$A,CharacterSet:()=>JI,CheckBox:()=>UF,CheckBoxSymbolElement:()=>wf,CheckBoxUtil:()=>HS,Column:()=>T9,ColumnBreak:()=>BI,Comment:()=>Lm,CommentRangeEnd:()=>cI,CommentRangeStart:()=>uI,CommentReference:()=>fI,Comments:()=>dA,CommentsExtended:()=>pA,ConcreteHyperlink:()=>Ns,ConcreteNumbering:()=>jm,ContinuationSeparator:()=>TI,DayLong:()=>bI,DayShort:()=>yI,DeletedTableCell:()=>KA,DeletedTableRow:()=>VA,DeletedTextRun:()=>L4,Document:()=>NF,DocumentAttributeNamespaces:()=>_f,DocumentAttributes:()=>Ol,DocumentBackground:()=>_S,DocumentBackgroundAttributes:()=>bS,DocumentDefaults:()=>MS,DocumentGridType:()=>g9,Drawing:()=>Nf,DropCapType:()=>r4,EMPTY_OBJECT:()=>Zx,EmphasisMarkType:()=>ag,EmptyElement:()=>gt,EndnoteIdReference:()=>jS,EndnoteReference:()=>mA,EndnoteReferenceRun:()=>zF,EndnoteReferenceRunAttributes:()=>qS,Endnotes:()=>AS,ExternalHyperlink:()=>dg,File:()=>NF,FileChild:()=>Nl,FootNoteReferenceRunAttributes:()=>zS,FootNotes:()=>TS,Footer:()=>LF,FooterWrapper:()=>SS,FootnoteReference:()=>US,FootnoteReferenceElement:()=>AI,FootnoteReferenceRun:()=>PF,FrameAnchorType:()=>n4,FrameWrap:()=>i4,GridSpan:()=>eS,Header:()=>BF,HeaderFooterReferenceType:()=>io,HeaderFooterType:()=>Um,HeaderWrapper:()=>CS,HeadingLevel:()=>LI,HeightRule:()=>n9,HighlightColor:()=>J6,HorizontalPositionAlign:()=>R6,HorizontalPositionRelativeFrom:()=>HE,HpsMeasureElement:()=>df,HyperlinkType:()=>HI,IgnoreIfEmptyXmlComponent:()=>Mn,ImageRun:()=>YR,ImportedRootElementAttributes:()=>wE,ImportedXmlComponent:()=>vE,InitializableXmlComponent:()=>tg,InsertedTableCell:()=>GA,InsertedTableRow:()=>WA,InsertedTextRun:()=>I4,InternalHyperlink:()=>EA,LastRenderedPageBreak:()=>DI,LeaderType:()=>PI,Level:()=>kS,LevelBase:()=>Ag,LevelForOverride:()=>Y9,LevelFormat:()=>en,LevelOverride:()=>DS,LevelSuffix:()=>X9,LineNumberRestartFormat:()=>y9,LineRuleType:()=>so,Math:()=>o4,MathAngledBrackets:()=>D4,MathCurlyBrackets:()=>k4,MathDegree:()=>zA,MathDenominator:()=>OA,MathFraction:()=>l4,MathFunction:()=>E4,MathFunctionName:()=>qA,MathFunctionProperties:()=>jA,MathIntegral:()=>h4,MathLimit:()=>mg,MathLimitLower:()=>p4,MathLimitUpper:()=>d4,MathNumerator:()=>RA,MathPreSubSuperScript:()=>v4,MathRadical:()=>x4,MathRadicalProperties:()=>UA,MathRoundBrackets:()=>T4,MathRun:()=>a4,MathSquareBrackets:()=>C4,MathSubScript:()=>g4,MathSubSuperScript:()=>y4,MathSum:()=>f4,MathSuperScript:()=>m4,Media:()=>Eg,MonthLong:()=>_I,MonthShort:()=>vI,NextAttributeComponent:()=>Vm,NoBreakHyphen:()=>mI,NumberFormat:()=>F6,NumberProperties:()=>mf,NumberValueElement:()=>Ss,NumberedItemReference:()=>$I,NumberedItemReferenceFormat:()=>GI,Numbering:()=>NS,OnOffElement:()=>me,OverlapType:()=>J4,Packer:()=>GS,PageBorderDisplay:()=>v9,PageBorderOffsetFrom:()=>w9,PageBorderZOrder:()=>b9,PageBorders:()=>hS,PageBreak:()=>MI,PageBreakBefore:()=>wA,PageNumber:()=>di,PageNumberElement:()=>CI,PageNumberSeparator:()=>_9,PageOrientation:()=>xf,PageReference:()=>ZI,PageTextDirection:()=>gS,PageTextDirectionType:()=>x9,Paragraph:()=>Tr,ParagraphProperties:()=>Fn,ParagraphPropertiesChange:()=>NA,ParagraphPropertiesDefaults:()=>IS,ParagraphRunProperties:()=>RE,PatchType:()=>Hm,PositionalTab:()=>FI,PositionalTabAlignment:()=>NI,PositionalTabLeader:()=>RI,PositionalTabRelativeTo:()=>OI,PrettifyType:()=>VS,RelativeHorizontalPosition:()=>X4,RelativeVerticalPosition:()=>Z4,Run:()=>at,RunProperties:()=>ln,RunPropertiesChange:()=>IE,RunPropertiesDefaults:()=>FS,SectionProperties:()=>xg,SectionPropertiesChange:()=>vS,SectionType:()=>A9,Separator:()=>SI,SequentialIdentifier:()=>rI,ShadingType:()=>z6,SimpleField:()=>fg,SimpleMailMergeField:()=>iI,SoftHyphen:()=>gI,SpaceType:()=>sr,StringContainer:()=>fi,StringEnumValueElement:()=>O6,StringValueElement:()=>In,StyleForCharacter:()=>ao,StyleForParagraph:()=>Is,StyleLevel:()=>MF,Styles:()=>vf,SymbolRun:()=>FE,TDirection:()=>tS,Tab:()=>gA,TabStopPosition:()=>zI,TabStopType:()=>Pm,Table:()=>r9,TableAnchorType:()=>$4,TableBorders:()=>wg,TableCell:()=>vg,TableCellBorders:()=>QA,TableLayoutType:()=>Q4,TableOfContents:()=>FF,TableProperties:()=>bg,TableRow:()=>i9,TableRowProperties:()=>_g,TableRowPropertiesChange:()=>lS,TextDirection:()=>V4,TextEffect:()=>Z6,TextRun:()=>wl,TextWrappingSide:()=>rA,TextWrappingType:()=>dl,Textbox:()=>XF,ThematicBreak:()=>CE,UnderlineType:()=>ug,VerticalAlign:()=>U4,VerticalAlignSection:()=>JA,VerticalAlignTable:()=>ZA,VerticalAnchor:()=>cR,VerticalMerge:()=>zm,VerticalMergeRevisionType:()=>z4,VerticalMergeType:()=>yg,VerticalPositionAlign:()=>I6,VerticalPositionRelativeFrom:()=>WE,WORKAROUND2:()=>W9,WORKAROUND3:()=>k6,WORKAROUND4:()=>w4,WidthType:()=>bf,WpgGroupRun:()=>eI,WpsShapeRun:()=>QR,XmlAttributeComponent:()=>Ee,XmlComponent:()=>le,YearLong:()=>xI,YearShort:()=>wI,abstractNumUniqueNumericIdGen:()=>PE,bookmarkUniqueNumericIdGen:()=>qE,commentIdToParaId:()=>hA,concreteNumUniqueNumericIdGen:()=>zE,convertInchesToTwip:()=>Sr,convertMillimetersToTwip:()=>uR,convertToXmlComponent:()=>Cf,createAlignment:()=>ig,createBodyProperties:()=>ZE,createBorderElement:()=>et,createColumns:()=>uS,createDocumentGrid:()=>cS,createDotEmphasisMark:()=>j6,createEmphasisMark:()=>lg,createFrameProperties:()=>DA,createHeaderFooterReference:()=>gf,createHorizontalPosition:()=>$E,createIndent:()=>kE,createLineNumberType:()=>fS,createMathAccentCharacter:()=>IA,createMathBase:()=>Gt,createMathLimitLocation:()=>FA,createMathNAryProperties:()=>pg,createMathPreSubSuperScriptProperties:()=>PA,createMathSubScriptElement:()=>Os,createMathSubScriptProperties:()=>BA,createMathSubSuperScriptProperties:()=>LA,createMathSuperScriptElement:()=>Rs,createMathSuperScriptProperties:()=>MA,createOutlineLevel:()=>CA,createPageMargin:()=>dS,createPageNumberType:()=>pS,createPageSize:()=>mS,createParagraphStyle:()=>As,createRunFonts:()=>pf,createSectionType:()=>yS,createShading:()=>Sl,createSimplePos:()=>VE,createSpacing:()=>bA,createStringElement:()=>xs,createTabStop:()=>xA,createTabStopItem:()=>_A,createTableFloatProperties:()=>nS,createTableLayout:()=>iS,createTableLook:()=>sS,createTableRowHeight:()=>aS,createTableWidthElement:()=>bl,createTransformation:()=>cg,createUnderline:()=>OE,createVerticalAlign:()=>gg,createVerticalPosition:()=>XE,createWrapNone:()=>Bm,createWrapSquare:()=>nA,createWrapTight:()=>iA,createWrapTopAndBottom:()=>oA,dateTimeValue:()=>SE,decimalNumber:()=>lt,docPropertiesUniqueNumericIdGen:()=>UE,eighthPointMeasureValue:()=>EE,encodeUtf8:()=>ml,hashedId:()=>Fm,hexColorValue:()=>oo,hpsMeasureValue:()=>_E,longHexNumber:()=>D6,measurementOrPercentValue:()=>ng,patchDetector:()=>xM,patchDocument:()=>bM,percentageValue:()=>xE,pointMeasureValue:()=>AE,positiveUniversalMeasureValue:()=>rg,sectionMarginDefaults:()=>hi,sectionPageSizeDefaults:()=>yf,shortHexNumber:()=>bE,signedHpsMeasureValue:()=>N6,signedTwipsMeasureValue:()=>on,standardizeData:()=>cA,twipsMeasureValue:()=>ot,uCharHexNumber:()=>Im,uniqueId:()=>Dl,uniqueNumericIdCreator:()=>kl,uniqueUuid:()=>jE,universalMeasureValue:()=>Al,unsignedDecimalNumber:()=>El});var SO=Object.create,$x=Object.defineProperty,TO=Object.getOwnPropertyDescriptor,CO=Object.getOwnPropertyNames,kO=Object.getPrototypeOf,DO=Object.prototype.hasOwnProperty,Xx=(e,t)=>()=>(e&&(t=e(e=0)),t),we=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),NO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=CO(t),o=0,s=i.length,a;ot[u]).bind(null,a),enumerable:!(n=TO(t,a))||n.enumerable});return e},Wm=(e,t,r)=>(r=e!=null?SO(kO(e)):{},NO(t||!e||!e.__esModule?$x(r,"default",{value:e,enumerable:!0}):r,e)),ff=(e=>typeof vr<"u"?vr:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof vr<"u"?vr:t)[r]}):e)(function(e){if(typeof vr<"u")return vr.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});function gl(e){"@babel/helpers - typeof";return gl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gl(e)}function OO(e,t){if(gl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(gl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function RO(e){var t=OO(e,"string");return gl(t)=="symbol"?t:t+""}function ue(e,t,r){return(t=RO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var yl=class{constructor(e){ue(this,"rootKey",void 0),this.rootKey=e}},Zx=Object.seal({}),le=class extends yl{constructor(e){super(e),ue(this,"root",void 0),this.root=new Array}prepForXml(e){var t;e.stack.push(this);let r=this.root.map(n=>n instanceof yl?n.prepForXml(e):n).filter(n=>n!==void 0);return e.stack.pop(),{[this.rootKey]:r.length?r.length===1&&(!((t=r[0])===null||t===void 0)&&t._attr)?r[0]:r:Zx}}addChildElement(e){return this.root.push(e),this}},Mn=class extends le{constructor(e,t){super(e),ue(this,"includeIfEmpty",void 0),this.includeIfEmpty=t}prepForXml(e){let t=super.prepForXml(e);if(this.includeIfEmpty||t&&(typeof t[this.rootKey]!="object"||Object.keys(t[this.rootKey]).length))return t}};function Dx(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function be(e){for(var t=1;t{if(n!==void 0){let i=this.xmlKeys&&this.xmlKeys[r]||r;t[i]=n}}),{_attr:t}}},Vm=class extends yl{constructor(e){super("_attr"),ue(this,"root",void 0),this.root=e}prepForXml(e){return{_attr:Object.values(this.root).filter(({value:t})=>t!==void 0).reduce((t,{key:r,value:n})=>be(be({},t),{},{[r]:n}),{})}}},ut=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}},Gm=we(((e,t)=>{var r=typeof Reflect=="object"?Reflect:null,n=r&&typeof r.apply=="function"?r.apply:function(k,B,O){return Function.prototype.apply.call(k,B,O)},i;r&&typeof r.ownKeys=="function"?i=r.ownKeys:Object.getOwnPropertySymbols?i=function(k){return Object.getOwnPropertyNames(k).concat(Object.getOwnPropertySymbols(k))}:i=function(k){return Object.getOwnPropertyNames(k)};function o(A){console&&console.warn&&console.warn(A)}var s=Number.isNaN||function(k){return k!==k};function a(){a.init.call(this)}t.exports=a,t.exports.once=b,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function c(A){if(typeof A!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(A){if(typeof A!="number"||A<0||s(A))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+A+".");u=A}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(k){if(typeof k!="number"||k<0||s(k))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+k+".");return this._maxListeners=k,this};function f(A){return A._maxListeners===void 0?a.defaultMaxListeners:A._maxListeners}a.prototype.getMaxListeners=function(){return f(this)},a.prototype.emit=function(k){for(var B=[],O=1;O0&&(_=B[0]),_ instanceof Error)throw _;var W=new Error("Unhandled error."+(_?" ("+_.message+")":""));throw W.context=_,W}var F=Y[k];if(F===void 0)return!1;if(typeof F=="function")n(F,this,B);else for(var J=F.length,j=y(F,J),O=0;O0&&_.length>P&&!_.warned){_.warned=!0;var W=new Error("Possible EventEmitter memory leak detected. "+_.length+" "+String(k)+" listeners added. Use emitter.setMaxListeners() to increase limit");W.name="MaxListenersExceededWarning",W.emitter=A,W.type=k,W.count=_.length,o(W)}return A}a.prototype.addListener=function(k,B){return h(this,k,B,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(k,B){return h(this,k,B,!0)};function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(A,k,B){var O={fired:!1,wrapFn:void 0,target:A,type:k,listener:B},P=p.bind(O);return P.listener=B,O.wrapFn=P,P}a.prototype.once=function(k,B){return c(B),this.on(k,d(this,k,B)),this},a.prototype.prependOnceListener=function(k,B){return c(B),this.prependListener(k,d(this,k,B)),this},a.prototype.removeListener=function(k,B){var O,P,Y,_,W;if(c(B),P=this._events,P===void 0)return this;if(O=P[k],O===void 0)return this;if(O===B||O.listener===B)--this._eventsCount===0?this._events=Object.create(null):(delete P[k],P.removeListener&&this.emit("removeListener",k,O.listener||B));else if(typeof O!="function"){for(Y=-1,_=O.length-1;_>=0;_--)if(O[_]===B||O[_].listener===B){W=O[_].listener,Y=_;break}if(Y<0)return this;Y===0?O.shift():w(O,Y),O.length===1&&(P[k]=O[0]),P.removeListener!==void 0&&this.emit("removeListener",k,W||B)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(k){var B,O=this._events,P;if(O===void 0)return this;if(O.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):O[k]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete O[k]),this;if(arguments.length===0){var Y=Object.keys(O),_;for(P=0;P=0;P--)this.removeListener(k,B[P]);return this};function m(A,k,B){var O=A._events;if(O===void 0)return[];var P=O[k];return P===void 0?[]:typeof P=="function"?B?[P.listener||P]:[P]:B?E(P):y(P,P.length)}a.prototype.listeners=function(k){return m(this,k,!0)},a.prototype.rawListeners=function(k){return m(this,k,!1)},a.listenerCount=function(A,k){return typeof A.listenerCount=="function"?A.listenerCount(k):g.call(A,k)},a.prototype.listenerCount=g;function g(A){var k=this._events;if(k!==void 0){var B=k[A];if(typeof B=="function")return 1;if(B!==void 0)return B.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function y(A,k){for(var B=new Array(k),O=0;O{typeof Object.create=="function"?t.exports=function(n,i){i&&(n.super_=i,n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(n,i){if(i){n.super_=i;var o=function(){};o.prototype=i.prototype,n.prototype=new o,n.prototype.constructor=n}}})),Vt,ks=Xx((()=>{Vt=globalThis||self}));function IO(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Nm(){throw new Error("setTimeout has not been defined")}function Om(){throw new Error("clearTimeout has not been defined")}function Jx(e){if(tn===setTimeout)return setTimeout(e,0);if((tn===Nm||!tn)&&setTimeout)return tn=setTimeout,setTimeout(e,0);try{return tn(e,0)}catch{try{return tn.call(null,e,0)}catch{return tn.call(this,e,0)}}}function FO(e){if(rn===clearTimeout)return clearTimeout(e);if((rn===Om||!rn)&&clearTimeout)return rn=clearTimeout,clearTimeout(e);try{return rn(e)}catch{try{return rn.call(null,e)}catch{return rn.call(this,e)}}}function MO(){!no||!ro||(no=!1,ro.length?nn=ro.concat(nn):pl=-1,nn.length&&Yx())}function Yx(){if(!no){var e=Jx(MO);no=!0;for(var t=nn.length;t;){for(ro=nn,nn=[];++pl{_m={exports:{}},nt=_m.exports={},(function(){try{typeof setTimeout=="function"?tn=setTimeout:tn=Nm}catch{tn=Nm}try{typeof clearTimeout=="function"?rn=clearTimeout:rn=Om}catch{rn=Om}})(),nn=[],no=!1,pl=-1,nt.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r{t.exports=Gm().EventEmitter})),BO=we((e=>{e.byteLength=u,e.toByteArray=f,e.fromByteArray=d;for(var t=[],r=[],n=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=i.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var y=m.indexOf("=");y===-1&&(y=g);var w=y===g?0:4-y%4;return[y,w]}function u(m){var g=a(m),y=g[0],w=g[1];return(y+w)*3/4-w}function c(m,g,y){return(g+y)*3/4-y}function f(m){var g,y=a(m),w=y[0],E=y[1],b=new n(c(m,w,E)),C=0,S=E>0?w-4:w,A;for(A=0;A>16&255,b[C++]=g>>8&255,b[C++]=g&255;return E===2&&(g=r[m.charCodeAt(A)]<<2|r[m.charCodeAt(A+1)]>>4,b[C++]=g&255),E===1&&(g=r[m.charCodeAt(A)]<<10|r[m.charCodeAt(A+1)]<<4|r[m.charCodeAt(A+2)]>>2,b[C++]=g>>8&255,b[C++]=g&255),b}function h(m){return t[m>>18&63]+t[m>>12&63]+t[m>>6&63]+t[m&63]}function p(m,g,y){for(var w,E=[],b=g;bS?S:C+b));return w===1?(g=m[y-1],E.push(t[g>>2]+t[g<<4&63]+"==")):w===2&&(g=(m[y-2]<<8)+m[y-1],E.push(t[g>>10]+t[g>>4&63]+t[g<<2&63]+"=")),E.join("")}})),LO=we((e=>{e.read=function(t,r,n,i,o){var s,a,u=o*8-i-1,c=(1<>1,h=-7,p=n?o-1:0,d=n?-1:1,m=t[r+p];for(p+=d,s=m&(1<<-h)-1,m>>=-h,h+=u;h>0;s=s*256+t[r+p],p+=d,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=i;h>0;a=a*256+t[r+p],p+=d,h-=8);if(s===0)s=1-f;else{if(s===c)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-f}return(m?-1:1)*a*Math.pow(2,s-i)},e.write=function(t,r,n,i,o,s){var a,u,c,f=s*8-o-1,h=(1<>1,d=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:s-1,g=i?1:-1,y=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,a=h):(a=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+p>=1?r+=d/c:r+=d*Math.pow(2,1-p),r*c>=2&&(a++,c/=2),a+p>=h?(u=0,a=h):a+p>=1?(u=(r*c-1)*Math.pow(2,o),a=a+p):(u=r*Math.pow(2,p-1)*Math.pow(2,o),a=0));o>=8;t[n+m]=u&255,m+=g,u/=256,o-=8);for(a=a<0;t[n+m]=a&255,m+=g,a/=256,f-=8);t[n+m-g]|=y*128}}));var Ef=we((e=>{var t=BO(),r=LO(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=E,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=o(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{var T=new Uint8Array(1),v={foo:function(){return 42}};return Object.setPrototypeOf(v,Uint8Array.prototype),Object.setPrototypeOf(T,v),T.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');var v=new Uint8Array(T);return Object.setPrototypeOf(v,a.prototype),v}function a(T,v,x){if(typeof T=="number"){if(typeof v=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(T)}return u(T,v,x)}a.poolSize=8192;function u(T,v,x){if(typeof T=="string")return p(T,v);if(ArrayBuffer.isView(T))return m(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(V(T,ArrayBuffer)||T&&V(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(V(T,SharedArrayBuffer)||T&&V(T.buffer,SharedArrayBuffer)))return g(T,v,x);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var R=T.valueOf&&T.valueOf();if(R!=null&&R!==T)return a.from(R,v,x);var U=y(T);if(U)return U;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),v,x);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}a.from=function(T,v,x){return u(T,v,x)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function f(T,v,x){return c(T),T<=0?s(T):v!==void 0?typeof x=="string"?s(T).fill(v,x):s(T).fill(v):s(T)}a.alloc=function(T,v,x){return f(T,v,x)};function h(T){return c(T),s(T<0?0:w(T)|0)}a.allocUnsafe=function(T){return h(T)},a.allocUnsafeSlow=function(T){return h(T)};function p(T,v){if((typeof v!="string"||v==="")&&(v="utf8"),!a.isEncoding(v))throw new TypeError("Unknown encoding: "+v);var x=b(T,v)|0,R=s(x),U=R.write(T,v);return U!==x&&(R=R.slice(0,U)),R}function d(T){for(var v=T.length<0?0:w(T.length)|0,x=s(v),R=0;R=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function E(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(v){return v!=null&&v._isBuffer===!0&&v!==a.prototype},a.compare=function(v,x){if(V(v,Uint8Array)&&(v=a.from(v,v.offset,v.byteLength)),V(x,Uint8Array)&&(x=a.from(x,x.offset,x.byteLength)),!a.isBuffer(v)||!a.isBuffer(x))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(v===x)return 0;for(var R=v.length,U=x.length,ee=0,Z=Math.min(R,U);eeU.length?a.from(Z).copy(U,ee):Uint8Array.prototype.set.call(U,Z,ee);else if(a.isBuffer(Z))Z.copy(U,ee);else throw new TypeError('"list" argument must be an Array of Buffers');ee+=Z.length}return U};function b(T,v){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||V(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);var x=T.length,R=arguments.length>2&&arguments[2]===!0;if(!R&&x===0)return 0;for(var U=!1;;)switch(v){case"ascii":case"latin1":case"binary":return x;case"utf8":case"utf-8":return M(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x*2;case"hex":return x>>>1;case"base64":return fe(T).length;default:if(U)return R?-1:M(T).length;v=(""+v).toLowerCase(),U=!0}}a.byteLength=b;function C(T,v,x){var R=!1;if((v===void 0||v<0)&&(v=0),v>this.length||((x===void 0||x>this.length)&&(x=this.length),x<=0)||(x>>>=0,v>>>=0,x<=v))return"";for(T||(T="utf8");;)switch(T){case"hex":return z(this,v,x);case"utf8":case"utf-8":return F(this,v,x);case"ascii":return H(this,v,x);case"latin1":case"binary":return $(this,v,x);case"base64":return W(this,v,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,v,x);default:if(R)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),R=!0}}a.prototype._isBuffer=!0;function S(T,v,x){var R=T[v];T[v]=T[x],T[x]=R}a.prototype.swap16=function(){var v=this.length;if(v%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var x=0;xx&&(v+=" ... "),""},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(v,x,R,U,ee){if(V(v,Uint8Array)&&(v=a.from(v,v.offset,v.byteLength)),!a.isBuffer(v))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof v);if(x===void 0&&(x=0),R===void 0&&(R=v?v.length:0),U===void 0&&(U=0),ee===void 0&&(ee=this.length),x<0||R>v.length||U<0||ee>this.length)throw new RangeError("out of range index");if(U>=ee&&x>=R)return 0;if(U>=ee)return-1;if(x>=R)return 1;if(x>>>=0,R>>>=0,U>>>=0,ee>>>=0,this===v)return 0;for(var Z=ee-U,K=R-x,te=Math.min(Z,K),ie=this.slice(U,ee),se=v.slice(x,R),de=0;de2147483647?x=2147483647:x<-2147483648&&(x=-2147483648),x=+x,N(x)&&(x=U?0:T.length-1),x<0&&(x=T.length+x),x>=T.length){if(U)return-1;x=T.length-1}else if(x<0)if(U)x=0;else return-1;if(typeof v=="string"&&(v=a.from(v,R)),a.isBuffer(v))return v.length===0?-1:k(T,v,x,R,U);if(typeof v=="number")return v=v&255,typeof Uint8Array.prototype.indexOf=="function"?U?Uint8Array.prototype.indexOf.call(T,v,x):Uint8Array.prototype.lastIndexOf.call(T,v,x):k(T,[v],x,R,U);throw new TypeError("val must be string, number or Buffer")}function k(T,v,x,R,U){var ee=1,Z=T.length,K=v.length;if(R!==void 0&&(R=String(R).toLowerCase(),R==="ucs2"||R==="ucs-2"||R==="utf16le"||R==="utf-16le")){if(T.length<2||v.length<2)return-1;ee=2,Z/=2,K/=2,x/=2}function te(Te,Ae){return ee===1?Te[Ae]:Te.readUInt16BE(Ae*ee)}var ie;if(U){var se=-1;for(ie=x;ieZ&&(x=Z-K),ie=x;ie>=0;ie--){for(var de=!0,xe=0;xeU&&(R=U)):R=U;var ee=v.length;R>ee/2&&(R=ee/2);for(var Z=0;Z>>0,isFinite(R)?(R=R>>>0,U===void 0&&(U="utf8")):(U=R,R=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var ee=this.length-x;if((R===void 0||R>ee)&&(R=ee),v.length>0&&(R<0||x<0)||x>this.length)throw new RangeError("Attempt to write outside buffer bounds");U||(U="utf8");for(var Z=!1;;)switch(U){case"hex":return B(this,v,x,R);case"utf8":case"utf-8":return O(this,v,x,R);case"ascii":case"latin1":case"binary":return P(this,v,x,R);case"base64":return Y(this,v,x,R);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,v,x,R);default:if(Z)throw new TypeError("Unknown encoding: "+U);U=(""+U).toLowerCase(),Z=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function W(T,v,x){return v===0&&x===T.length?t.fromByteArray(T):t.fromByteArray(T.slice(v,x))}function F(T,v,x){x=Math.min(T.length,x);for(var R=[],U=v;U239?4:ee>223?3:ee>191?2:1;if(U+K<=x){var te,ie,se,de;switch(K){case 1:ee<128&&(Z=ee);break;case 2:te=T[U+1],(te&192)===128&&(de=(ee&31)<<6|te&63,de>127&&(Z=de));break;case 3:te=T[U+1],ie=T[U+2],(te&192)===128&&(ie&192)===128&&(de=(ee&15)<<12|(te&63)<<6|ie&63,de>2047&&(de<55296||de>57343)&&(Z=de));break;case 4:te=T[U+1],ie=T[U+2],se=T[U+3],(te&192)===128&&(ie&192)===128&&(se&192)===128&&(de=(ee&15)<<18|(te&63)<<12|(ie&63)<<6|se&63,de>65535&&de<1114112&&(Z=de))}}Z===null?(Z=65533,K=1):Z>65535&&(Z-=65536,R.push(Z>>>10&1023|55296),Z=56320|Z&1023),R.push(Z),U+=K}return j(R)}var J=4096;function j(T){var v=T.length;if(v<=J)return String.fromCharCode.apply(String,T);for(var x="",R=0;RR)&&(x=R);for(var U="",ee=v;eeR&&(v=R),x<0?(x+=R,x<0&&(x=0)):x>R&&(x=R),xx)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(v,x,R){v=v>>>0,x=x>>>0,R||X(v,x,this.length);for(var U=this[v],ee=1,Z=0;++Z>>0,x=x>>>0,R||X(v,x,this.length);for(var U=this[v+--x],ee=1;x>0&&(ee*=256);)U+=this[v+--x]*ee;return U},a.prototype.readUint8=a.prototype.readUInt8=function(v,x){return v=v>>>0,x||X(v,1,this.length),this[v]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(v,x){return v=v>>>0,x||X(v,2,this.length),this[v]|this[v+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(v,x){return v=v>>>0,x||X(v,2,this.length),this[v]<<8|this[v+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(v,x){return v=v>>>0,x||X(v,4,this.length),(this[v]|this[v+1]<<8|this[v+2]<<16)+this[v+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(v,x){return v=v>>>0,x||X(v,4,this.length),this[v]*16777216+(this[v+1]<<16|this[v+2]<<8|this[v+3])},a.prototype.readIntLE=function(v,x,R){v=v>>>0,x=x>>>0,R||X(v,x,this.length);for(var U=this[v],ee=1,Z=0;++Z=ee&&(U-=Math.pow(2,8*x)),U},a.prototype.readIntBE=function(v,x,R){v=v>>>0,x=x>>>0,R||X(v,x,this.length);for(var U=x,ee=1,Z=this[v+--U];U>0&&(ee*=256);)Z+=this[v+--U]*ee;return ee*=128,Z>=ee&&(Z-=Math.pow(2,8*x)),Z},a.prototype.readInt8=function(v,x){return v=v>>>0,x||X(v,1,this.length),this[v]&128?(255-this[v]+1)*-1:this[v]},a.prototype.readInt16LE=function(v,x){v=v>>>0,x||X(v,2,this.length);var R=this[v]|this[v+1]<<8;return R&32768?R|4294901760:R},a.prototype.readInt16BE=function(v,x){v=v>>>0,x||X(v,2,this.length);var R=this[v+1]|this[v]<<8;return R&32768?R|4294901760:R},a.prototype.readInt32LE=function(v,x){return v=v>>>0,x||X(v,4,this.length),this[v]|this[v+1]<<8|this[v+2]<<16|this[v+3]<<24},a.prototype.readInt32BE=function(v,x){return v=v>>>0,x||X(v,4,this.length),this[v]<<24|this[v+1]<<16|this[v+2]<<8|this[v+3]},a.prototype.readFloatLE=function(v,x){return v=v>>>0,x||X(v,4,this.length),r.read(this,v,!0,23,4)},a.prototype.readFloatBE=function(v,x){return v=v>>>0,x||X(v,4,this.length),r.read(this,v,!1,23,4)},a.prototype.readDoubleLE=function(v,x){return v=v>>>0,x||X(v,8,this.length),r.read(this,v,!0,52,8)},a.prototype.readDoubleBE=function(v,x){return v=v>>>0,x||X(v,8,this.length),r.read(this,v,!1,52,8)};function q(T,v,x,R,U,ee){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(v>U||vT.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(v,x,R,U){if(v=+v,x=x>>>0,R=R>>>0,!U){var ee=Math.pow(2,8*R)-1;q(this,v,x,R,ee,0)}var Z=1,K=0;for(this[x]=v&255;++K>>0,R=R>>>0,!U){var ee=Math.pow(2,8*R)-1;q(this,v,x,R,ee,0)}var Z=R-1,K=1;for(this[x+Z]=v&255;--Z>=0&&(K*=256);)this[x+Z]=v/K&255;return x+R},a.prototype.writeUint8=a.prototype.writeUInt8=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,1,255,0),this[x]=v&255,x+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,2,65535,0),this[x]=v&255,this[x+1]=v>>>8,x+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,2,65535,0),this[x]=v>>>8,this[x+1]=v&255,x+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,4,4294967295,0),this[x+3]=v>>>24,this[x+2]=v>>>16,this[x+1]=v>>>8,this[x]=v&255,x+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,4,4294967295,0),this[x]=v>>>24,this[x+1]=v>>>16,this[x+2]=v>>>8,this[x+3]=v&255,x+4},a.prototype.writeIntLE=function(v,x,R,U){if(v=+v,x=x>>>0,!U){var ee=Math.pow(2,8*R-1);q(this,v,x,R,ee-1,-ee)}var Z=0,K=1,te=0;for(this[x]=v&255;++Z>0)-te&255;return x+R},a.prototype.writeIntBE=function(v,x,R,U){if(v=+v,x=x>>>0,!U){var ee=Math.pow(2,8*R-1);q(this,v,x,R,ee-1,-ee)}var Z=R-1,K=1,te=0;for(this[x+Z]=v&255;--Z>=0&&(K*=256);)v<0&&te===0&&this[x+Z+1]!==0&&(te=1),this[x+Z]=(v/K>>0)-te&255;return x+R},a.prototype.writeInt8=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,1,127,-128),v<0&&(v=255+v+1),this[x]=v&255,x+1},a.prototype.writeInt16LE=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,2,32767,-32768),this[x]=v&255,this[x+1]=v>>>8,x+2},a.prototype.writeInt16BE=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,2,32767,-32768),this[x]=v>>>8,this[x+1]=v&255,x+2},a.prototype.writeInt32LE=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,4,2147483647,-2147483648),this[x]=v&255,this[x+1]=v>>>8,this[x+2]=v>>>16,this[x+3]=v>>>24,x+4},a.prototype.writeInt32BE=function(v,x,R){return v=+v,x=x>>>0,R||q(this,v,x,4,2147483647,-2147483648),v<0&&(v=4294967295+v+1),this[x]=v>>>24,this[x+1]=v>>>16,this[x+2]=v>>>8,this[x+3]=v&255,x+4};function Q(T,v,x,R,U,ee){if(x+R>T.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("Index out of range")}function oe(T,v,x,R,U){return v=+v,x=x>>>0,U||Q(T,v,x,4,34028234663852886e22,-34028234663852886e22),r.write(T,v,x,R,23,4),x+4}a.prototype.writeFloatLE=function(v,x,R){return oe(this,v,x,!0,R)},a.prototype.writeFloatBE=function(v,x,R){return oe(this,v,x,!1,R)};function ae(T,v,x,R,U){return v=+v,x=x>>>0,U||Q(T,v,x,8,17976931348623157e292,-17976931348623157e292),r.write(T,v,x,R,52,8),x+8}a.prototype.writeDoubleLE=function(v,x,R){return ae(this,v,x,!0,R)},a.prototype.writeDoubleBE=function(v,x,R){return ae(this,v,x,!1,R)},a.prototype.copy=function(v,x,R,U){if(!a.isBuffer(v))throw new TypeError("argument should be a Buffer");if(R||(R=0),!U&&U!==0&&(U=this.length),x>=v.length&&(x=v.length),x||(x=0),U>0&&U=this.length)throw new RangeError("Index out of range");if(U<0)throw new RangeError("sourceEnd out of bounds");U>this.length&&(U=this.length),v.length-x>>0,R=R===void 0?this.length:R>>>0,v||(v=0);var Z;if(typeof v=="number")for(Z=x;Z55295&&x<57344){if(!U){if(x>56319){(v-=3)>-1&&ee.push(239,191,189);continue}else if(Z+1===R){(v-=3)>-1&&ee.push(239,191,189);continue}U=x;continue}if(x<56320){(v-=3)>-1&&ee.push(239,191,189),U=x;continue}x=(U-55296<<10|x-56320)+65536}else U&&(v-=3)>-1&&ee.push(239,191,189);if(U=null,x<128){if((v-=1)<0)break;ee.push(x)}else if(x<2048){if((v-=2)<0)break;ee.push(x>>6|192,x&63|128)}else if(x<65536){if((v-=3)<0)break;ee.push(x>>12|224,x>>6&63|128,x&63|128)}else if(x<1114112){if((v-=4)<0)break;ee.push(x>>18|240,x>>12&63|128,x>>6&63|128,x&63|128)}else throw new Error("Invalid code point")}return ee}function re(T){for(var v=[],x=0;x>8,U=x%256,ee.push(U),ee.push(R);return ee}function fe(T){return t.toByteArray(L(T))}function D(T,v,x,R){for(var U=0;U=v.length||U>=T.length);++U)v[U+x]=T[U];return U}function V(T,v){return T instanceof v||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===v.name}function N(T){return T!==T}var I=(function(){for(var T="0123456789abcdef",v=new Array(256),x=0;x<16;++x)for(var R=x*16,U=0;U<16;++U)v[R+U]=T[x]+T[U];return v})()})),eE=we(((e,t)=>{t.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var n={},i=Symbol("test"),o=Object(i);if(typeof i=="string"||Object.prototype.toString.call(i)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var s=42;n[i]=s;for(var a in n)return!1;if(typeof Object.keys=="function"&&Object.keys(n).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(n).length!==0)return!1;var u=Object.getOwnPropertySymbols(n);if(u.length!==1||u[0]!==i||!Object.prototype.propertyIsEnumerable.call(n,i))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(n,i);if(c.value!==s||c.enumerable!==!0)return!1}return!0}})),Km=we(((e,t)=>{var r=eE();t.exports=function(){return r()&&!!Symbol.toStringTag}})),tE=we(((e,t)=>{t.exports=Object})),PO=we(((e,t)=>{t.exports=Error})),zO=we(((e,t)=>{t.exports=EvalError})),UO=we(((e,t)=>{t.exports=RangeError})),qO=we(((e,t)=>{t.exports=ReferenceError})),rE=we(((e,t)=>{t.exports=SyntaxError})),Af=we(((e,t)=>{t.exports=TypeError})),jO=we(((e,t)=>{t.exports=URIError})),HO=we(((e,t)=>{t.exports=Math.abs})),WO=we(((e,t)=>{t.exports=Math.floor})),VO=we(((e,t)=>{t.exports=Math.max})),GO=we(((e,t)=>{t.exports=Math.min})),KO=we(((e,t)=>{t.exports=Math.pow})),$O=we(((e,t)=>{t.exports=Math.round})),XO=we(((e,t)=>{t.exports=Number.isNaN||function(n){return n!==n}})),ZO=we(((e,t)=>{var r=XO();t.exports=function(i){return r(i)||i===0?i:i<0?-1:1}})),JO=we(((e,t)=>{t.exports=Object.getOwnPropertyDescriptor})),_l=we(((e,t)=>{var r=JO();if(r)try{r([],"length")}catch{r=null}t.exports=r})),Sf=we(((e,t)=>{var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}t.exports=r})),YO=we(((e,t)=>{var r=typeof Symbol<"u"&&Symbol,n=eE();t.exports=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:n()}})),nE=we(((e,t)=>{t.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null})),iE=we(((e,t)=>{t.exports=tE().getPrototypeOf||null})),QO=we(((e,t)=>{var r="Function.prototype.bind called on incompatible ",n=Object.prototype.toString,i=Math.max,o="[object Function]",s=function(f,h){for(var p=[],d=0;d{var r=QO();t.exports=Function.prototype.bind||r})),$m=we(((e,t)=>{t.exports=Function.prototype.call})),Xm=we(((e,t)=>{t.exports=Function.prototype.apply})),e6=we(((e,t)=>{t.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply})),oE=we(((e,t)=>{var r=xl(),n=Xm(),i=$m();t.exports=e6()||r.call(i,n)})),Zm=we(((e,t)=>{var r=xl(),n=Af(),i=$m(),o=oE();t.exports=function(a){if(a.length<1||typeof a[0]!="function")throw new n("a function is required");return o(r,i,a)}})),t6=we(((e,t)=>{var r=Zm(),n=_l(),i;try{i=[].__proto__===Array.prototype}catch(u){if(!u||typeof u!="object"||!("code"in u)||u.code!=="ERR_PROTO_ACCESS")throw u}var o=!!i&&n&&n(Object.prototype,"__proto__"),s=Object,a=s.getPrototypeOf;t.exports=o&&typeof o.get=="function"?r([o.get]):typeof a=="function"?function(c){return a(c==null?c:s(c))}:!1})),sE=we(((e,t)=>{var r=nE(),n=iE(),i=t6();t.exports=r?function(s){return r(s)}:n?function(s){if(!s||typeof s!="object"&&typeof s!="function")throw new TypeError("getProto: not an object");return n(s)}:i?function(s){return i(s)}:null})),r6=we(((e,t)=>{var r=Function.prototype.call,n=Object.prototype.hasOwnProperty;t.exports=xl().call(r,n)})),aE=we(((e,t)=>{var r,n=tE(),i=PO(),o=zO(),s=UO(),a=qO(),u=rE(),c=Af(),f=jO(),h=HO(),p=WO(),d=VO(),m=GO(),g=KO(),y=$O(),w=ZO(),E=Function,b=function(ne){try{return E('"use strict"; return ('+ne+").constructor;")()}catch{}},C=_l(),S=Sf(),A=function(){throw new c},k=C?(function(){try{return arguments.callee,A}catch{try{return C(arguments,"callee").get}catch{return A}}})():A,B=YO()(),O=sE(),P=iE(),Y=nE(),_=Xm(),W=$m(),F={},J=typeof Uint8Array>"u"||!O?r:O(Uint8Array),j={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":B&&O?O([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":F,"%AsyncGenerator%":F,"%AsyncGeneratorFunction%":F,"%AsyncIteratorPrototype%":F,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":o,"%Float16Array%":typeof Float16Array>"u"?r:Float16Array,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":E,"%GeneratorFunction%":F,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":B&&O?O(O([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!B||!O?r:O(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":n,"%Object.getOwnPropertyDescriptor%":C,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":s,"%ReferenceError%":a,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!B||!O?r:O(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":B&&O?O(""[Symbol.iterator]()):r,"%Symbol%":B?Symbol:r,"%SyntaxError%":u,"%ThrowTypeError%":k,"%TypedArray%":J,"%TypeError%":c,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":f,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet,"%Function.prototype.call%":W,"%Function.prototype.apply%":_,"%Object.defineProperty%":S,"%Object.getPrototypeOf%":P,"%Math.abs%":h,"%Math.floor%":p,"%Math.max%":d,"%Math.min%":m,"%Math.pow%":g,"%Math.round%":y,"%Math.sign%":w,"%Reflect.getPrototypeOf%":Y};if(O)try{null.error}catch(ne){j["%Error.prototype%"]=O(O(ne))}var H=function ne(fe){var D;if(fe==="%AsyncFunction%")D=b("async function () {}");else if(fe==="%GeneratorFunction%")D=b("function* () {}");else if(fe==="%AsyncGeneratorFunction%")D=b("async function* () {}");else if(fe==="%AsyncGenerator%"){var V=ne("%AsyncGeneratorFunction%");V&&(D=V.prototype)}else if(fe==="%AsyncIteratorPrototype%"){var N=ne("%AsyncGenerator%");N&&O&&(D=O(N.prototype))}return j[fe]=D,D},$={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},z=xl(),G=r6(),X=z.call(W,Array.prototype.concat),q=z.call(_,Array.prototype.splice),Q=z.call(W,String.prototype.replace),oe=z.call(W,String.prototype.slice),ae=z.call(W,RegExp.prototype.exec),he=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,L=/\\(\\)?/g,M=function(fe){var D=oe(fe,0,1),V=oe(fe,-1);if(D==="%"&&V!=="%")throw new u("invalid intrinsic syntax, expected closing `%`");if(V==="%"&&D!=="%")throw new u("invalid intrinsic syntax, expected opening `%`");var N=[];return Q(fe,he,function(I,T,v,x){N[N.length]=v?Q(x,L,"$1"):T||I}),N},re=function(fe,D){var V=fe,N;if(G($,V)&&(N=$[V],V="%"+N[0]+"%"),G(j,V)){var I=j[V];if(I===F&&(I=H(V)),typeof I>"u"&&!D)throw new c("intrinsic "+fe+" exists, but is not available. Please file an issue!");return{alias:N,name:V,value:I}}throw new u("intrinsic "+fe+" does not exist!")};t.exports=function(fe,D){if(typeof fe!="string"||fe.length===0)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof D!="boolean")throw new c('"allowMissing" argument must be a boolean');if(ae(/^%?[^%]*%?$/,fe)===null)throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var V=M(fe),N=V.length>0?V[0]:"",I=re("%"+N+"%",D),T=I.name,v=I.value,x=!1,R=I.alias;R&&(N=R[0],q(V,X([0,1],R)));for(var U=1,ee=!0;U=V.length){var ie=C(v,Z);ee=!!ie,ee&&"get"in ie&&!("originalValue"in ie.get)?v=ie.get:v=v[Z]}else ee=G(v,Z),v=v[Z];ee&&!x&&(j[T]=v)}}return v}})),lE=we(((e,t)=>{var r=aE(),n=Zm(),i=n([r("%String.prototype.indexOf%")]);t.exports=function(s,a){var u=r(s,!!a);return typeof u=="function"&&i(s,".prototype.")>-1?n([u]):u}})),n6=we(((e,t)=>{var r=Km()(),n=lE()("Object.prototype.toString"),i=function(u){return r&&u&&typeof u=="object"&&Symbol.toStringTag in u?!1:n(u)==="[object Arguments]"},o=function(u){return i(u)?!0:u!==null&&typeof u=="object"&&"length"in u&&typeof u.length=="number"&&u.length>=0&&n(u)!=="[object Array]"&&"callee"in u&&n(u.callee)==="[object Function]"},s=(function(){return i(arguments)})();i.isLegacyArguments=o,t.exports=s?i:o})),i6=we(((e,t)=>{var r=Object.prototype.toString,n=Function.prototype.toString,i=/^\s*(?:function)?\*/,o=Km()(),s=Object.getPrototypeOf,a=function(){if(!o)return!1;try{return Function("return function*() {}")()}catch{}},u;t.exports=function(f){if(typeof f!="function")return!1;if(i.test(n.call(f)))return!0;if(!o)return r.call(f)==="[object GeneratorFunction]";if(!s)return!1;if(typeof u>"u"){var h=a();u=h?s(h):!1}return s(f)===u}})),o6=we(((e,t)=>{var r=Function.prototype.toString,n=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,i,o;if(typeof n=="function"&&typeof Object.defineProperty=="function")try{i=Object.defineProperty({},"length",{get:function(){throw o}}),o={},n(function(){throw 42},null,i)}catch(C){C!==o&&(n=null)}else n=null;var s=/^\s*class\b/,a=function(S){try{var A=r.call(S);return s.test(A)}catch{return!1}},u=function(S){try{return a(S)?!1:(r.call(S),!0)}catch{return!1}},c=Object.prototype.toString,f="[object Object]",h="[object Function]",p="[object GeneratorFunction]",d="[object HTMLAllCollection]",m="[object HTML document.all class]",g="[object HTMLCollection]",y=typeof Symbol=="function"&&!!Symbol.toStringTag,w=!(0 in[,]),E=function(){return!1};if(typeof document=="object"){var b=document.all;c.call(b)===c.call(document.all)&&(E=function(S){if((w||!S)&&(typeof S>"u"||typeof S=="object"))try{var A=c.call(S);return(A===d||A===m||A===g||A===f)&&S("")==null}catch{}return!1})}t.exports=n?function(S){if(E(S))return!0;if(!S||typeof S!="function"&&typeof S!="object")return!1;try{n(S,null,i)}catch(A){if(A!==o)return!1}return!a(S)&&u(S)}:function(S){if(E(S))return!0;if(!S||typeof S!="function"&&typeof S!="object")return!1;if(y)return u(S);if(a(S))return!1;var A=c.call(S);return A!==h&&A!==p&&!/^\[object HTML/.test(A)?!1:u(S)}})),s6=we(((e,t)=>{var r=o6(),n=Object.prototype.toString,i=Object.prototype.hasOwnProperty,o=function(f,h,p){for(var d=0,m=f.length;d=3&&(d=p),u(f)?o(f,h,d):typeof f=="string"?s(f,h,d):a(f,h,d)}})),a6=we(((e,t)=>{t.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]})),l6=we(((e,t)=>{ks();var r=a6(),n=typeof globalThis>"u"?Vt:globalThis;t.exports=function(){for(var o=[],s=0;s{var r=Sf(),n=rE(),i=Af(),o=_l();t.exports=function(a,u,c){if(!a||typeof a!="object"&&typeof a!="function")throw new i("`obj` must be an object or a function`");if(typeof u!="string"&&typeof u!="symbol")throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new i("`loose`, if provided, must be a boolean");var f=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,m=!!o&&o(a,u);if(r)r(a,u,{configurable:p===null&&m?m.configurable:!p,enumerable:f===null&&m?m.enumerable:!f,value:c,writable:h===null&&m?m.writable:!h});else if(d||!f&&!h&&!p)a[u]=c;else throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}})),c6=we(((e,t)=>{var r=Sf(),n=function(){return!!r};n.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},t.exports=n})),f6=we(((e,t)=>{var r=aE(),n=u6(),i=c6()(),o=_l(),s=Af(),a=r("%Math.floor%");t.exports=function(c,f){if(typeof c!="function")throw new s("`fn` is not a function");if(typeof f!="number"||f<0||f>4294967295||a(f)!==f)throw new s("`length` must be a positive 32-bit integer");var h=arguments.length>2&&!!arguments[2],p=!0,d=!0;if("length"in c&&o){var m=o(c,"length");m&&!m.configurable&&(p=!1),m&&!m.writable&&(d=!1)}return(p||d||!h)&&(i?n(c,"length",f,!0,!0):n(c,"length",f)),c}})),h6=we(((e,t)=>{var r=xl(),n=Xm(),i=oE();t.exports=function(){return i(r,n,arguments)}})),d6=we(((e,t)=>{var r=f6(),n=Sf(),i=Zm(),o=h6();t.exports=function(a){var u=i(arguments),c=a.length-(arguments.length-1);return r(u,1+(c>0?c:0),!0)},n?n(t.exports,"apply",{value:o}):t.exports.apply=o})),uE=we(((e,t)=>{ks();var r=s6(),n=l6(),i=d6(),o=lE(),s=_l(),a=sE(),u=o("Object.prototype.toString"),c=Km()(),f=typeof globalThis>"u"?Vt:globalThis,h=n(),p=o("String.prototype.slice"),d=o("Array.prototype.indexOf",!0)||function(E,b){for(var C=0;C-1?b:b!=="Object"?!1:y(E)}return s?g(E):null}})),p6=we(((e,t)=>{var r=uE();t.exports=function(i){return!!r(i)}})),m6=we((e=>{var t=n6(),r=i6(),n=uE(),i=p6();function o(R){return R.call.bind(R)}var s=typeof BigInt<"u",a=typeof Symbol<"u",u=o(Object.prototype.toString),c=o(Number.prototype.valueOf),f=o(String.prototype.valueOf),h=o(Boolean.prototype.valueOf);if(s)var p=o(BigInt.prototype.valueOf);if(a)var d=o(Symbol.prototype.valueOf);function m(R,U){if(typeof R!="object")return!1;try{return U(R),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=i;function g(R){return typeof Promise<"u"&&R instanceof Promise||R!==null&&typeof R=="object"&&typeof R.then=="function"&&typeof R.catch=="function"}e.isPromise=g;function y(R){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(R):i(R)||Q(R)}e.isArrayBufferView=y;function w(R){return n(R)==="Uint8Array"}e.isUint8Array=w;function E(R){return n(R)==="Uint8ClampedArray"}e.isUint8ClampedArray=E;function b(R){return n(R)==="Uint16Array"}e.isUint16Array=b;function C(R){return n(R)==="Uint32Array"}e.isUint32Array=C;function S(R){return n(R)==="Int8Array"}e.isInt8Array=S;function A(R){return n(R)==="Int16Array"}e.isInt16Array=A;function k(R){return n(R)==="Int32Array"}e.isInt32Array=k;function B(R){return n(R)==="Float32Array"}e.isFloat32Array=B;function O(R){return n(R)==="Float64Array"}e.isFloat64Array=O;function P(R){return n(R)==="BigInt64Array"}e.isBigInt64Array=P;function Y(R){return n(R)==="BigUint64Array"}e.isBigUint64Array=Y;function _(R){return u(R)==="[object Map]"}_.working=typeof Map<"u"&&_(new Map);function W(R){return typeof Map>"u"?!1:_.working?_(R):R instanceof Map}e.isMap=W;function F(R){return u(R)==="[object Set]"}F.working=typeof Set<"u"&&F(new Set);function J(R){return typeof Set>"u"?!1:F.working?F(R):R instanceof Set}e.isSet=J;function j(R){return u(R)==="[object WeakMap]"}j.working=typeof WeakMap<"u"&&j(new WeakMap);function H(R){return typeof WeakMap>"u"?!1:j.working?j(R):R instanceof WeakMap}e.isWeakMap=H;function $(R){return u(R)==="[object WeakSet]"}$.working=typeof WeakSet<"u"&&$(new WeakSet);function z(R){return $(R)}e.isWeakSet=z;function G(R){return u(R)==="[object ArrayBuffer]"}G.working=typeof ArrayBuffer<"u"&&G(new ArrayBuffer);function X(R){return typeof ArrayBuffer>"u"?!1:G.working?G(R):R instanceof ArrayBuffer}e.isArrayBuffer=X;function q(R){return u(R)==="[object DataView]"}q.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&q(new DataView(new ArrayBuffer(1),0,1));function Q(R){return typeof DataView>"u"?!1:q.working?q(R):R instanceof DataView}e.isDataView=Q;var oe=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function ae(R){return u(R)==="[object SharedArrayBuffer]"}function he(R){return typeof oe>"u"?!1:(typeof ae.working>"u"&&(ae.working=ae(new oe)),ae.working?ae(R):R instanceof oe)}e.isSharedArrayBuffer=he;function L(R){return u(R)==="[object AsyncFunction]"}e.isAsyncFunction=L;function M(R){return u(R)==="[object Map Iterator]"}e.isMapIterator=M;function re(R){return u(R)==="[object Set Iterator]"}e.isSetIterator=re;function ne(R){return u(R)==="[object Generator]"}e.isGeneratorObject=ne;function fe(R){return u(R)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=fe;function D(R){return m(R,c)}e.isNumberObject=D;function V(R){return m(R,f)}e.isStringObject=V;function N(R){return m(R,h)}e.isBooleanObject=N;function I(R){return s&&m(R,p)}e.isBigIntObject=I;function T(R){return a&&m(R,d)}e.isSymbolObject=T;function v(R){return D(R)||V(R)||N(R)||I(R)||T(R)}e.isBoxedPrimitive=v;function x(R){return typeof Uint8Array<"u"&&(X(R)||he(R))}e.isAnyArrayBuffer=x,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(R){Object.defineProperty(e,R,{enumerable:!1,value:function(){throw new Error(R+" is not supported in userland")}})})})),g6=we(((e,t)=>{t.exports=function(n){return n&&typeof n=="object"&&typeof n.copy=="function"&&typeof n.fill=="function"&&typeof n.readUInt8=="function"}})),cE=we((e=>{mi();var t=Object.getOwnPropertyDescriptors||function(Q){for(var oe=Object.keys(Q),ae={},he=0;he=he)return re;switch(re){case"%s":return String(ae[oe++]);case"%d":return Number(ae[oe++]);case"%j":try{return JSON.stringify(ae[oe++])}catch{return"[Circular]"}default:return re}}),M=ae[oe];oe"u")return function(){return e.deprecate(q,Q).apply(this,arguments)};var oe=!1;function ae(){if(!oe){if(Oe.throwDeprecation)throw new Error(Q);Oe.traceDeprecation?console.trace(Q):console.error(Q),oe=!0}return q.apply(this,arguments)}return ae};var n={},i=/^$/;if(Oe.env.NODE_DEBUG){var o=Oe.env.NODE_DEBUG;o=o.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),i=new RegExp("^"+o+"$","i")}e.debuglog=function(q){if(q=q.toUpperCase(),!n[q])if(i.test(q)){var Q=Oe.pid;n[q]=function(){var oe=e.format.apply(e,arguments);console.error("%s %d: %s",q,Q,oe)}}else n[q]=function(){};return n[q]};function s(q,Q){var oe={seen:[],stylize:u};return arguments.length>=3&&(oe.depth=arguments[2]),arguments.length>=4&&(oe.colors=arguments[3]),w(Q)?oe.showHidden=Q:Q&&e._extend(oe,Q),k(oe.showHidden)&&(oe.showHidden=!1),k(oe.depth)&&(oe.depth=2),k(oe.colors)&&(oe.colors=!1),k(oe.customInspect)&&(oe.customInspect=!0),oe.colors&&(oe.stylize=a),f(oe,q,oe.depth)}e.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function a(q,Q){var oe=s.styles[Q];return oe?"\x1B["+s.colors[oe][0]+"m"+q+"\x1B["+s.colors[oe][1]+"m":q}function u(q,Q){return q}function c(q){var Q={};return q.forEach(function(oe,ae){Q[oe]=!0}),Q}function f(q,Q,oe){if(q.customInspect&&Q&&_(Q.inspect)&&Q.inspect!==e.inspect&&!(Q.constructor&&Q.constructor.prototype===Q)){var ae=Q.inspect(oe,q);return S(ae)||(ae=f(q,ae,oe)),ae}var he=h(q,Q);if(he)return he;var L=Object.keys(Q),M=c(L);if(q.showHidden&&(L=Object.getOwnPropertyNames(Q)),Y(Q)&&(L.indexOf("message")>=0||L.indexOf("description")>=0))return p(Q);if(L.length===0){if(_(Q)){var re=Q.name?": "+Q.name:"";return q.stylize("[Function"+re+"]","special")}if(B(Q))return q.stylize(RegExp.prototype.toString.call(Q),"regexp");if(P(Q))return q.stylize(Date.prototype.toString.call(Q),"date");if(Y(Q))return p(Q)}var ne="",fe=!1,D=["{","}"];if(y(Q)&&(fe=!0,D=["[","]"]),_(Q)&&(ne=" [Function"+(Q.name?": "+Q.name:"")+"]"),B(Q)&&(ne=" "+RegExp.prototype.toString.call(Q)),P(Q)&&(ne=" "+Date.prototype.toUTCString.call(Q)),Y(Q)&&(ne=" "+p(Q)),L.length===0&&(!fe||Q.length==0))return D[0]+ne+D[1];if(oe<0)return B(Q)?q.stylize(RegExp.prototype.toString.call(Q),"regexp"):q.stylize("[Object]","special");q.seen.push(Q);var V;return fe?V=d(q,Q,oe,M,L):V=L.map(function(N){return m(q,Q,oe,M,N,fe)}),q.seen.pop(),g(V,ne,D)}function h(q,Q){if(k(Q))return q.stylize("undefined","undefined");if(S(Q)){var oe="'"+JSON.stringify(Q).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return q.stylize(oe,"string")}if(C(Q))return q.stylize(""+Q,"number");if(w(Q))return q.stylize(""+Q,"boolean");if(E(Q))return q.stylize("null","null")}function p(q){return"["+Error.prototype.toString.call(q)+"]"}function d(q,Q,oe,ae,he){for(var L=[],M=0,re=Q.length;M-1&&(L?re=re.split(` +`).map(function(fe){return" "+fe}).join(` +`).slice(2):re=` +`+re.split(` +`).map(function(fe){return" "+fe}).join(` +`))):re=q.stylize("[Circular]","special")),k(M)){if(L&&he.match(/^\d+$/))return re;M=JSON.stringify(""+he),M.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(M=M.slice(1,-1),M=q.stylize(M,"name")):(M=M.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),M=q.stylize(M,"string"))}return M+": "+re}function g(q,Q,oe){var ae=0;return q.reduce(function(he,L){return ae++,L.indexOf(` +`)>=0&&ae++,he+L.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?oe[0]+(Q===""?"":Q+` + `)+" "+q.join(`, + `)+" "+oe[1]:oe[0]+Q+" "+q.join(", ")+" "+oe[1]}e.types=m6();function y(q){return Array.isArray(q)}e.isArray=y;function w(q){return typeof q=="boolean"}e.isBoolean=w;function E(q){return q===null}e.isNull=E;function b(q){return q==null}e.isNullOrUndefined=b;function C(q){return typeof q=="number"}e.isNumber=C;function S(q){return typeof q=="string"}e.isString=S;function A(q){return typeof q=="symbol"}e.isSymbol=A;function k(q){return q===void 0}e.isUndefined=k;function B(q){return O(q)&&F(q)==="[object RegExp]"}e.isRegExp=B,e.types.isRegExp=B;function O(q){return typeof q=="object"&&q!==null}e.isObject=O;function P(q){return O(q)&&F(q)==="[object Date]"}e.isDate=P,e.types.isDate=P;function Y(q){return O(q)&&(F(q)==="[object Error]"||q instanceof Error)}e.isError=Y,e.types.isNativeError=Y;function _(q){return typeof q=="function"}e.isFunction=_;function W(q){return q===null||typeof q=="boolean"||typeof q=="number"||typeof q=="string"||typeof q=="symbol"||typeof q>"u"}e.isPrimitive=W,e.isBuffer=g6();function F(q){return Object.prototype.toString.call(q)}function J(q){return q<10?"0"+q.toString(10):q.toString(10)}var j=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function H(){var q=new Date,Q=[J(q.getHours()),J(q.getMinutes()),J(q.getSeconds())].join(":");return[q.getDate(),j[q.getMonth()],Q].join(" ")}e.log=function(){console.log("%s - %s",H(),e.format.apply(e,arguments))},e.inherits=pi(),e._extend=function(q,Q){if(!Q||!O(Q))return q;for(var oe=Object.keys(Q),ae=oe.length;ae--;)q[oe[ae]]=Q[oe[ae]];return q};function $(q,Q){return Object.prototype.hasOwnProperty.call(q,Q)}var z=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(Q){if(typeof Q!="function")throw new TypeError('The "original" argument must be of type Function');if(z&&Q[z]){var oe=Q[z];if(typeof oe!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(oe,z,{value:oe,enumerable:!1,writable:!1,configurable:!0}),oe}function oe(){for(var ae,he,L=new Promise(function(ne,fe){ae=ne,he=fe}),M=[],re=0;re{function r(m,g){var y=Object.keys(m);if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(m);g&&(w=w.filter(function(E){return Object.getOwnPropertyDescriptor(m,E).enumerable})),y.push.apply(y,w)}return y}function n(m){for(var g=1;g0?this.tail.next=w:this.head=w,this.tail=w,++this.length}},{key:"unshift",value:function(y){var w={data:y,next:this.head};this.length===0&&(this.tail=w),this.head=w,++this.length}},{key:"shift",value:function(){if(this.length!==0){var y=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,y}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(y){if(this.length===0)return"";for(var w=this.head,E=""+w.data;w=w.next;)E+=y+w.data;return E}},{key:"concat",value:function(y){if(this.length===0)return f.alloc(0);for(var w=f.allocUnsafe(y>>>0),E=this.head,b=0;E;)d(E.data,w,b),b+=E.data.length,E=E.next;return w}},{key:"consume",value:function(y,w){var E;return yC.length?C.length:y;if(S===C.length?b+=C:b+=C.slice(0,y),y-=S,y===0){S===C.length?(++E,w.next?this.head=w.next:this.head=this.tail=null):(this.head=w,w.data=C.slice(S));break}++E}return this.length-=E,b}},{key:"_getBuffer",value:function(y){var w=f.allocUnsafe(y),E=this.head,b=1;for(E.data.copy(w),y-=E.data.length;E=E.next;){var C=E.data,S=y>C.length?C.length:y;if(C.copy(w,w.length-y,0,S),y-=S,y===0){S===C.length?(++b,E.next?this.head=E.next:this.head=this.tail=null):(this.head=E,E.data=C.slice(S));break}++b}return this.length-=b,w}},{key:p,value:function(y,w){return h(this,n(n({},w),{},{depth:0,customInspect:!1}))}}]),m})()})),fE=we(((e,t)=>{mi();function r(u,c){var f=this,h=this._readableState&&this._readableState.destroyed,p=this._writableState&&this._writableState.destroyed;return h||p?(c?c(u):u&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Oe.nextTick(s,this,u)):Oe.nextTick(s,this,u)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(u||null,function(d){!c&&d?f._writableState?f._writableState.errorEmitted?Oe.nextTick(i,f):(f._writableState.errorEmitted=!0,Oe.nextTick(n,f,d)):Oe.nextTick(n,f,d):c?(Oe.nextTick(i,f),c(d)):Oe.nextTick(i,f)}),this)}function n(u,c){s(u,c),i(u)}function i(u){u._writableState&&!u._writableState.emitClose||u._readableState&&!u._readableState.emitClose||u.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(u,c){u.emit("error",c)}function a(u,c){var f=u._readableState,h=u._writableState;f&&f.autoDestroy||h&&h.autoDestroy?u.destroy(c):u.emit("error",c)}t.exports={destroy:r,undestroy:o,errorOrDestroy:a}})),Ds=we(((e,t)=>{function r(c,f){c.prototype=Object.create(f.prototype),c.prototype.constructor=c,c.__proto__=f}var n={};function i(c,f,h){h||(h=Error);function p(m,g,y){return typeof f=="string"?f:f(m,g,y)}var d=(function(m){r(g,m);function g(y,w,E){return m.call(this,p(y,w,E))||this}return g})(h);d.prototype.name=h.name,d.prototype.code=c,n[c]=d}function o(c,f){if(Array.isArray(c)){var h=c.length;return c=c.map(function(p){return String(p)}),h>2?"one of ".concat(f," ").concat(c.slice(0,h-1).join(", "),", or ")+c[h-1]:h===2?"one of ".concat(f," ").concat(c[0]," or ").concat(c[1]):"of ".concat(f," ").concat(c[0])}else return"of ".concat(f," ").concat(String(c))}function s(c,f,h){return c.substr(!h||h<0?0:+h,f.length)===f}function a(c,f,h){return(h===void 0||h>c.length)&&(h=c.length),c.substring(h-f.length,h)===f}function u(c,f,h){return typeof h!="number"&&(h=0),h+f.length>c.length?!1:c.indexOf(f,h)!==-1}i("ERR_INVALID_OPT_VALUE",function(c,f){return'The value "'+f+'" is invalid for option "'+c+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(c,f,h){var p;typeof f=="string"&&s(f,"not ")?(p="must not be",f=f.replace(/^not /,"")):p="must be";var d;if(a(c," argument"))d="The ".concat(c," ").concat(p," ").concat(o(f,"type"));else{var m=u(c,".")?"property":"argument";d='The "'.concat(c,'" ').concat(m," ").concat(p," ").concat(o(f,"type"))}return d+=". Received type ".concat(typeof h),d},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(c){return"The "+c+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(c){return"Cannot call "+c+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(c){return"Unknown encoding: "+c},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n})),hE=we(((e,t)=>{var r=Ds().codes.ERR_INVALID_OPT_VALUE;function n(o,s,a){return o.highWaterMark!=null?o.highWaterMark:s?o[a]:null}function i(o,s,a,u){var c=n(s,u,a);if(c!=null){if(!(isFinite(c)&&Math.floor(c)===c)||c<0)throw new r(u?a:"highWaterMark",c);return Math.floor(c)}return o.objectMode?16:16*1024}t.exports={getHighWaterMark:i}})),v6=we(((e,t)=>{ks(),t.exports=r;function r(i,o){if(n("noDeprecation"))return i;var s=!1;function a(){if(!s){if(n("throwDeprecation"))throw new Error(o);n("traceDeprecation")?console.trace(o):console.warn(o),s=!0}return i.apply(this,arguments)}return a}function n(i){try{if(!Vt.localStorage)return!1}catch{return!1}var o=Vt.localStorage[i];return o==null?!1:String(o).toLowerCase()==="true"}})),dE=we(((e,t)=>{ks(),mi(),t.exports=O;function r(L){var M=this;this.next=null,this.entry=null,this.finish=function(){he(M,L)}}var n;O.WritableState=k;var i={deprecate:v6()},o=Qx(),s=Ef().Buffer,a=(typeof Vt<"u"?Vt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function u(L){return s.from(L)}function c(L){return s.isBuffer(L)||L instanceof a}var f=fE(),h=hE().getHighWaterMark,p=Ds().codes,d=p.ERR_INVALID_ARG_TYPE,m=p.ERR_METHOD_NOT_IMPLEMENTED,g=p.ERR_MULTIPLE_CALLBACK,y=p.ERR_STREAM_CANNOT_PIPE,w=p.ERR_STREAM_DESTROYED,E=p.ERR_STREAM_NULL_VALUES,b=p.ERR_STREAM_WRITE_AFTER_END,C=p.ERR_UNKNOWN_ENCODING,S=f.errorOrDestroy;pi()(O,o);function A(){}function k(L,M,re){n=n||Cs(),L=L||{},typeof re!="boolean"&&(re=M instanceof n),this.objectMode=!!L.objectMode,re&&(this.objectMode=this.objectMode||!!L.writableObjectMode),this.highWaterMark=h(this,L,"writableHighWaterMark",re),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var ne=L.decodeStrings===!1;this.decodeStrings=!ne,this.defaultEncoding=L.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(fe){H(M,fe)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=L.emitClose!==!1,this.autoDestroy=!!L.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}k.prototype.getBuffer=function(){for(var M=this.bufferedRequest,re=[];M;)re.push(M),M=M.next;return re},(function(){try{Object.defineProperty(k.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var B;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(B=Function.prototype[Symbol.hasInstance],Object.defineProperty(O,Symbol.hasInstance,{value:function(M){return B.call(this,M)?!0:this!==O?!1:M&&M._writableState instanceof k}})):B=function(M){return M instanceof this};function O(L){n=n||Cs();var M=this instanceof n;if(!M&&!B.call(O,this))return new O(L);this._writableState=new k(L,this,M),this.writable=!0,L&&(typeof L.write=="function"&&(this._write=L.write),typeof L.writev=="function"&&(this._writev=L.writev),typeof L.destroy=="function"&&(this._destroy=L.destroy),typeof L.final=="function"&&(this._final=L.final)),o.call(this)}O.prototype.pipe=function(){S(this,new y)};function P(L,M){var re=new b;S(L,re),Oe.nextTick(M,re)}function Y(L,M,re,ne){var fe;return re===null?fe=new E:typeof re!="string"&&!M.objectMode&&(fe=new d("chunk",["string","Buffer"],re)),fe?(S(L,fe),Oe.nextTick(ne,fe),!1):!0}O.prototype.write=function(L,M,re){var ne=this._writableState,fe=!1,D=!ne.objectMode&&c(L);return D&&!s.isBuffer(L)&&(L=u(L)),typeof M=="function"&&(re=M,M=null),D?M="buffer":M||(M=ne.defaultEncoding),typeof re!="function"&&(re=A),ne.ending?P(this,re):(D||Y(this,ne,L,re))&&(ne.pendingcb++,fe=W(this,ne,D,L,M,re)),fe},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){var L=this._writableState;L.corked&&(L.corked--,!L.writing&&!L.corked&&!L.bufferProcessing&&L.bufferedRequest&&G(this,L))},O.prototype.setDefaultEncoding=function(M){if(typeof M=="string"&&(M=M.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((M+"").toLowerCase())>-1))throw new C(M);return this._writableState.defaultEncoding=M,this},Object.defineProperty(O.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function _(L,M,re){return!L.objectMode&&L.decodeStrings!==!1&&typeof M=="string"&&(M=s.from(M,re)),M}Object.defineProperty(O.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function W(L,M,re,ne,fe,D){if(!re){var V=_(M,ne,fe);ne!==V&&(re=!0,fe="buffer",ne=V)}var N=M.objectMode?1:ne.length;M.length+=N;var I=M.length{mi();var r=Object.keys||function(h){var p=[];for(var d in h)p.push(d);return p};t.exports=u;var n=pE(),i=dE();pi()(u,n);for(var o=r(i.prototype),s=0;s{var r=Ef(),n=r.Buffer;function i(s,a){for(var u in s)a[u]=s[u]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o);function o(s,a,u){return n(s,a,u)}i(n,o),o.from=function(s,a,u){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,a,u)},o.alloc=function(s,a,u){if(typeof s!="number")throw new TypeError("Argument must be a number");var c=n(s);return a!==void 0?typeof u=="string"?c.fill(a,u):c.fill(a):c.fill(0),c},o.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},o.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(s)}})),Rm=we((e=>{var t=w6().Buffer,r=t.isEncoding||function(E){switch(E=""+E,E&&E.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(E){if(!E)return"utf8";for(var b;;)switch(E){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return E;default:if(b)return;E=(""+E).toLowerCase(),b=!0}}function i(E){var b=n(E);if(typeof b!="string"&&(t.isEncoding===r||!r(E)))throw new Error("Unknown encoding: "+E);return b||E}e.StringDecoder=o;function o(E){this.encoding=i(E);var b;switch(this.encoding){case"utf16le":this.text=p,this.end=d,b=4;break;case"utf8":this.fillLast=c,b=4;break;case"base64":this.text=m,this.end=g,b=3;break;default:this.write=y,this.end=w;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(b)}o.prototype.write=function(E){if(E.length===0)return"";var b,C;if(this.lastNeed){if(b=this.fillLast(E),b===void 0)return"";C=this.lastNeed,this.lastNeed=0}else C=0;return C>5===6?2:E>>4===14?3:E>>3===30?4:E>>6===2?-1:-2}function a(E,b,C){var S=b.length-1;if(S=0?(A>0&&(E.lastNeed=A-1),A):--S=0?(A>0&&(E.lastNeed=A-2),A):--S=0?(A>0&&(A===2?A=0:E.lastNeed=A-3),A):0))}function u(E,b,C){if((b[0]&192)!==128)return E.lastNeed=0,"\uFFFD";if(E.lastNeed>1&&b.length>1){if((b[1]&192)!==128)return E.lastNeed=1,"\uFFFD";if(E.lastNeed>2&&b.length>2&&(b[2]&192)!==128)return E.lastNeed=2,"\uFFFD"}}function c(E){var b=this.lastTotal-this.lastNeed,C=u(this,E,b);if(C!==void 0)return C;if(this.lastNeed<=E.length)return E.copy(this.lastChar,b,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);E.copy(this.lastChar,b,0,E.length),this.lastNeed-=E.length}function f(E,b){var C=a(this,E,b);if(!this.lastNeed)return E.toString("utf8",b);this.lastTotal=C;var S=E.length-(C-this.lastNeed);return E.copy(this.lastChar,0,S),E.toString("utf8",b,S)}function h(E){var b=E&&E.length?this.write(E):"";return this.lastNeed?b+"\uFFFD":b}function p(E,b){if((E.length-b)%2===0){var C=E.toString("utf16le",b);if(C){var S=C.charCodeAt(C.length-1);if(S>=55296&&S<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=E[E.length-2],this.lastChar[1]=E[E.length-1],C.slice(0,-1)}return C}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=E[E.length-1],E.toString("utf16le",b,E.length-1)}function d(E){var b=E&&E.length?this.write(E):"";if(this.lastNeed){var C=this.lastTotal-this.lastNeed;return b+this.lastChar.toString("utf16le",0,C)}return b}function m(E,b){var C=(E.length-b)%3;return C===0?E.toString("base64",b):(this.lastNeed=3-C,this.lastTotal=3,C===1?this.lastChar[0]=E[E.length-1]:(this.lastChar[0]=E[E.length-2],this.lastChar[1]=E[E.length-1]),E.toString("base64",b,E.length-C))}function g(E){var b=E&&E.length?this.write(E):"";return this.lastNeed?b+this.lastChar.toString("base64",0,3-this.lastNeed):b}function y(E){return E.toString(this.encoding)}function w(E){return E&&E.length?this.write(E):""}})),Jm=we(((e,t)=>{var r=Ds().codes.ERR_STREAM_PREMATURE_CLOSE;function n(a){var u=!1;return function(){if(!u){u=!0;for(var c=arguments.length,f=new Array(c),h=0;h{mi();var r;function n(C,S,A){return S=i(S),S in C?Object.defineProperty(C,S,{value:A,enumerable:!0,configurable:!0,writable:!0}):C[S]=A,C}function i(C){var S=o(C,"string");return typeof S=="symbol"?S:String(S)}function o(C,S){if(typeof C!="object"||C===null)return C;var A=C[Symbol.toPrimitive];if(A!==void 0){var k=A.call(C,S||"default");if(typeof k!="object")return k;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(C)}var s=Jm(),a=Symbol("lastResolve"),u=Symbol("lastReject"),c=Symbol("error"),f=Symbol("ended"),h=Symbol("lastPromise"),p=Symbol("handlePromise"),d=Symbol("stream");function m(C,S){return{value:C,done:S}}function g(C){var S=C[a];if(S!==null){var A=C[d].read();A!==null&&(C[h]=null,C[a]=null,C[u]=null,S(m(A,!1)))}}function y(C){Oe.nextTick(g,C)}function w(C,S){return function(A,k){C.then(function(){if(S[f]){A(m(void 0,!0));return}S[p](A,k)},k)}}var E=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((r={get stream(){return this[d]},next:function(){var S=this,A=this[c];if(A!==null)return Promise.reject(A);if(this[f])return Promise.resolve(m(void 0,!0));if(this[d].destroyed)return new Promise(function(P,Y){Oe.nextTick(function(){S[c]?Y(S[c]):P(m(void 0,!0))})});var k=this[h],B;if(k)B=new Promise(w(k,this));else{var O=this[d].read();if(O!==null)return Promise.resolve(m(O,!1));B=new Promise(this[p])}return this[h]=B,B}},n(r,Symbol.asyncIterator,function(){return this}),n(r,"return",function(){var S=this;return new Promise(function(A,k){S[d].destroy(null,function(B){if(B){k(B);return}A(m(void 0,!0))})})}),r),E);t.exports=function(S){var A,k=Object.create(b,(A={},n(A,d,{value:S,writable:!0}),n(A,a,{value:null,writable:!0}),n(A,u,{value:null,writable:!0}),n(A,c,{value:null,writable:!0}),n(A,f,{value:S._readableState.endEmitted,writable:!0}),n(A,p,{value:function(O,P){var Y=k[d].read();Y?(k[h]=null,k[a]=null,k[u]=null,O(m(Y,!1))):(k[a]=O,k[u]=P)},writable:!0}),A));return k[h]=null,s(S,function(B){if(B&&B.code!=="ERR_STREAM_PREMATURE_CLOSE"){var O=k[u];O!==null&&(k[h]=null,k[a]=null,k[u]=null,O(B)),k[c]=B;return}var P=k[a];P!==null&&(k[h]=null,k[a]=null,k[u]=null,P(m(void 0,!0))),k[f]=!0}),S.on("readable",y.bind(null,k)),k}})),_6=we(((e,t)=>{t.exports=function(){throw new Error("Readable.from is not available in the browser")}})),pE=we(((e,t)=>{ks(),mi(),t.exports=P;var r;P.ReadableState=O,Gm().EventEmitter;var n=function(V,N){return V.listeners(N).length},i=Qx(),o=Ef().Buffer,s=(typeof Vt<"u"?Vt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(D){return o.from(D)}function u(D){return o.isBuffer(D)||D instanceof s}var c=cE(),f;c&&c.debuglog?f=c.debuglog("stream"):f=function(){};var h=y6(),p=fE(),d=hE().getHighWaterMark,m=Ds().codes,g=m.ERR_INVALID_ARG_TYPE,y=m.ERR_STREAM_PUSH_AFTER_EOF,w=m.ERR_METHOD_NOT_IMPLEMENTED,E=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,b,C,S;pi()(P,i);var A=p.errorOrDestroy,k=["error","close","destroy","pause","resume"];function B(D,V,N){if(typeof D.prependListener=="function")return D.prependListener(V,N);!D._events||!D._events[V]?D.on(V,N):Array.isArray(D._events[V])?D._events[V].unshift(N):D._events[V]=[N,D._events[V]]}function O(D,V,N){r=r||Cs(),D=D||{},typeof N!="boolean"&&(N=V instanceof r),this.objectMode=!!D.objectMode,N&&(this.objectMode=this.objectMode||!!D.readableObjectMode),this.highWaterMark=d(this,D,"readableHighWaterMark",N),this.buffer=new h,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=D.emitClose!==!1,this.autoDestroy=!!D.autoDestroy,this.destroyed=!1,this.defaultEncoding=D.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,D.encoding&&(b||(b=Rm().StringDecoder),this.decoder=new b(D.encoding),this.encoding=D.encoding)}function P(D){if(r=r||Cs(),!(this instanceof P))return new P(D);var V=this instanceof r;this._readableState=new O(D,this,V),this.readable=!0,D&&(typeof D.read=="function"&&(this._read=D.read),typeof D.destroy=="function"&&(this._destroy=D.destroy)),i.call(this)}Object.defineProperty(P.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(V){this._readableState&&(this._readableState.destroyed=V)}}),P.prototype.destroy=p.destroy,P.prototype._undestroy=p.undestroy,P.prototype._destroy=function(D,V){V(D)},P.prototype.push=function(D,V){var N=this._readableState,I;return N.objectMode?I=!0:typeof D=="string"&&(V=V||N.defaultEncoding,V!==N.encoding&&(D=o.from(D,V),V=""),I=!0),Y(this,D,V,!1,I)},P.prototype.unshift=function(D){return Y(this,D,null,!0,!1)};function Y(D,V,N,I,T){f("readableAddChunk",V);var v=D._readableState;if(V===null)v.reading=!1,H(D,v);else{var x;if(T||(x=W(v,V)),x)A(D,x);else if(v.objectMode||V&&V.length>0)if(typeof V!="string"&&!v.objectMode&&Object.getPrototypeOf(V)!==o.prototype&&(V=a(V)),I)v.endEmitted?A(D,new E):_(D,v,V,!0);else if(v.ended)A(D,new y);else{if(v.destroyed)return!1;v.reading=!1,v.decoder&&!N?(V=v.decoder.write(V),v.objectMode||V.length!==0?_(D,v,V,!1):G(D,v)):_(D,v,V,!1)}else I||(v.reading=!1,G(D,v))}return!v.ended&&(v.length=F?D=F:(D--,D|=D>>>1,D|=D>>>2,D|=D>>>4,D|=D>>>8,D|=D>>>16,D++),D}function j(D,V){return D<=0||V.length===0&&V.ended?0:V.objectMode?1:D!==D?V.flowing&&V.length?V.buffer.head.data.length:V.length:(D>V.highWaterMark&&(V.highWaterMark=J(D)),D<=V.length?D:V.ended?V.length:(V.needReadable=!0,0))}P.prototype.read=function(D){f("read",D),D=parseInt(D,10);var V=this._readableState,N=D;if(D!==0&&(V.emittedReadable=!1),D===0&&V.needReadable&&((V.highWaterMark!==0?V.length>=V.highWaterMark:V.length>0)||V.ended))return f("read: emitReadable",V.length,V.ended),V.length===0&&V.ended?re(this):$(this),null;if(D=j(D,V),D===0&&V.ended)return V.length===0&&re(this),null;var I=V.needReadable;f("need readable",I),(V.length===0||V.length-D0?T=M(D,V):T=null,T===null?(V.needReadable=V.length<=V.highWaterMark,D=0):(V.length-=D,V.awaitDrain=0),V.length===0&&(V.ended||(V.needReadable=!0),N!==D&&V.ended&&re(this)),T!==null&&this.emit("data",T),T};function H(D,V){if(f("onEofChunk"),!V.ended){if(V.decoder){var N=V.decoder.end();N&&N.length&&(V.buffer.push(N),V.length+=V.objectMode?1:N.length)}V.ended=!0,V.sync?$(D):(V.needReadable=!1,V.emittedReadable||(V.emittedReadable=!0,z(D)))}}function $(D){var V=D._readableState;f("emitReadable",V.needReadable,V.emittedReadable),V.needReadable=!1,V.emittedReadable||(f("emitReadable",V.flowing),V.emittedReadable=!0,Oe.nextTick(z,D))}function z(D){var V=D._readableState;f("emitReadable_",V.destroyed,V.length,V.ended),!V.destroyed&&(V.length||V.ended)&&(D.emit("readable"),V.emittedReadable=!1),V.needReadable=!V.flowing&&!V.ended&&V.length<=V.highWaterMark,L(D)}function G(D,V){V.readingMore||(V.readingMore=!0,Oe.nextTick(X,D,V))}function X(D,V){for(;!V.reading&&!V.ended&&(V.length1&&fe(I.pipes,D)!==-1)&&!U&&(f("false write response, pause",I.awaitDrain),I.awaitDrain++),N.pause())}function K(de){f("onerror",de),se(),D.removeListener("error",K),n(D,"error")===0&&A(D,de)}B(D,"error",K);function te(){D.removeListener("finish",ie),se()}D.once("close",te);function ie(){f("onfinish"),D.removeListener("close",te),se()}D.once("finish",ie);function se(){f("unpipe"),N.unpipe(D)}return D.emit("pipe",N),I.flowing||(f("pipe resume"),N.resume()),D};function q(D){return function(){var N=D._readableState;f("pipeOnDrain",N.awaitDrain),N.awaitDrain&&N.awaitDrain--,N.awaitDrain===0&&n(D,"data")&&(N.flowing=!0,L(D))}}P.prototype.unpipe=function(D){var V=this._readableState,N={hasUnpiped:!1};if(V.pipesCount===0)return this;if(V.pipesCount===1)return D&&D!==V.pipes?this:(D||(D=V.pipes),V.pipes=null,V.pipesCount=0,V.flowing=!1,D&&D.emit("unpipe",this,N),this);if(!D){var I=V.pipes,T=V.pipesCount;V.pipes=null,V.pipesCount=0,V.flowing=!1;for(var v=0;v0,I.flowing!==!1&&this.resume()):D==="readable"&&!I.endEmitted&&!I.readableListening&&(I.readableListening=I.needReadable=!0,I.flowing=!1,I.emittedReadable=!1,f("on readable",I.length,I.reading),I.length?$(this):I.reading||Oe.nextTick(oe,this)),N},P.prototype.addListener=P.prototype.on,P.prototype.removeListener=function(D,V){var N=i.prototype.removeListener.call(this,D,V);return D==="readable"&&Oe.nextTick(Q,this),N},P.prototype.removeAllListeners=function(D){var V=i.prototype.removeAllListeners.apply(this,arguments);return(D==="readable"||D===void 0)&&Oe.nextTick(Q,this),V};function Q(D){var V=D._readableState;V.readableListening=D.listenerCount("readable")>0,V.resumeScheduled&&!V.paused?V.flowing=!0:D.listenerCount("data")>0&&D.resume()}function oe(D){f("readable nexttick read 0"),D.read(0)}P.prototype.resume=function(){var D=this._readableState;return D.flowing||(f("resume"),D.flowing=!D.readableListening,ae(this,D)),D.paused=!1,this};function ae(D,V){V.resumeScheduled||(V.resumeScheduled=!0,Oe.nextTick(he,D,V))}function he(D,V){f("resume",V.reading),V.reading||D.read(0),V.resumeScheduled=!1,D.emit("resume"),L(D),V.flowing&&!V.reading&&D.read(0)}P.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function L(D){var V=D._readableState;for(f("flow",V.flowing);V.flowing&&D.read()!==null;);}P.prototype.wrap=function(D){var V=this,N=this._readableState,I=!1;D.on("end",function(){if(f("wrapped end"),N.decoder&&!N.ended){var x=N.decoder.end();x&&x.length&&V.push(x)}V.push(null)}),D.on("data",function(x){f("wrapped data"),N.decoder&&(x=N.decoder.write(x)),!(N.objectMode&&x==null)&&(!N.objectMode&&(!x||!x.length)||V.push(x)||(I=!0,D.pause()))});for(var T in D)this[T]===void 0&&typeof D[T]=="function"&&(this[T]=(function(R){return function(){return D[R].apply(D,arguments)}})(T));for(var v=0;v=V.length?(V.decoder?N=V.buffer.join(""):V.buffer.length===1?N=V.buffer.first():N=V.buffer.concat(V.length),V.buffer.clear()):N=V.buffer.consume(D,V.decoder),N}function re(D){var V=D._readableState;f("endReadable",V.endEmitted),V.endEmitted||(V.ended=!0,Oe.nextTick(ne,V,D))}function ne(D,V){if(f("endReadableNT",D.endEmitted,D.length),!D.endEmitted&&D.length===0&&(D.endEmitted=!0,V.readable=!1,V.emit("end"),D.autoDestroy)){var N=V._writableState;(!N||N.autoDestroy&&N.finished)&&V.destroy()}}typeof Symbol=="function"&&(P.from=function(D,V){return S===void 0&&(S=_6()),S(P,D,V)});function fe(D,V){for(var N=0,I=D.length;N{t.exports=c;var r=Ds().codes,n=r.ERR_METHOD_NOT_IMPLEMENTED,i=r.ERR_MULTIPLE_CALLBACK,o=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=r.ERR_TRANSFORM_WITH_LENGTH_0,a=Cs();pi()(c,a);function u(p,d){var m=this._transformState;m.transforming=!1;var g=m.writecb;if(g===null)return this.emit("error",new i);m.writechunk=null,m.writecb=null,d!=null&&this.push(d),g(p);var y=this._readableState;y.reading=!1,(y.needReadable||y.length{t.exports=n;var r=mE();pi()(n,r);function n(i){if(!(this instanceof n))return new n(i);r.call(this,i)}n.prototype._transform=function(i,o,s){s(null,i)}})),E6=we(((e,t)=>{var r;function n(m){var g=!1;return function(){g||(g=!0,m.apply(void 0,arguments))}}var i=Ds().codes,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(m){if(m)throw m}function u(m){return m.setHeader&&typeof m.abort=="function"}function c(m,g,y,w){w=n(w);var E=!1;m.on("close",function(){E=!0}),r===void 0&&(r=Jm()),r(m,{readable:g,writable:y},function(C){if(C)return w(C);E=!0,w()});var b=!1;return function(C){if(!E&&!b){if(b=!0,u(m))return m.abort();if(typeof m.destroy=="function")return m.destroy();w(C||new s("pipe"))}}}function f(m){m()}function h(m,g){return m.pipe(g)}function p(m){return!m.length||typeof m[m.length-1]!="function"?a:m.pop()}function d(){for(var m=arguments.length,g=new Array(m),y=0;y0,function(k){E||(E=k),k&&b.forEach(f),!A&&(b.forEach(f),w(E))})});return g.reduce(h)}t.exports=d})),Ym=we(((e,t)=>{t.exports=n;var r=Gm().EventEmitter;pi()(n,r),n.Readable=pE(),n.Writable=dE(),n.Duplex=Cs(),n.Transform=mE(),n.PassThrough=x6(),n.finished=Jm(),n.pipeline=E6(),n.Stream=n;function n(){r.call(this)}n.prototype.pipe=function(i,o){var s=this;function a(m){i.writable&&i.write(m)===!1&&s.pause&&s.pause()}s.on("data",a);function u(){s.readable&&s.resume&&s.resume()}i.on("drain",u),!i._isStdio&&(!o||o.end!==!1)&&(s.on("end",f),s.on("close",h));var c=!1;function f(){c||(c=!0,i.end())}function h(){c||(c=!0,typeof i.destroy=="function"&&i.destroy())}function p(m){if(d(),r.listenerCount(this,"error")===0)throw m}s.on("error",p),i.on("error",p);function d(){s.removeListener("data",a),i.removeListener("drain",u),s.removeListener("end",f),s.removeListener("close",h),s.removeListener("error",p),i.removeListener("error",p),s.removeListener("end",d),s.removeListener("close",d),i.removeListener("close",d)}return s.on("end",d),s.on("close",d),i.on("close",d),i.emit("pipe",s),i}})),A6=we((e=>{(function(t){t.parser=function(L,M){return new n(L,M)},t.SAXParser=n,t.SAXStream=f,t.createStream=c,t.MAX_BUFFER_LENGTH=64*1024;var r=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function n(L,M){if(!(this instanceof n))return new n(L,M);var re=this;o(re),re.q=re.c="",re.bufferCheckPosition=t.MAX_BUFFER_LENGTH,re.opt=M||{},re.opt.lowercase=re.opt.lowercase||re.opt.lowercasetags,re.looseCase=re.opt.lowercase?"toLowerCase":"toUpperCase",re.tags=[],re.closed=re.closedRoot=re.sawRoot=!1,re.tag=re.error=null,re.strict=!!L,re.noscript=!!(L||re.opt.noscript),re.state=O.BEGIN,re.strictEntities=re.opt.strictEntities,re.ENTITIES=re.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),re.attribList=[],re.opt.xmlns&&(re.ns=Object.create(g)),re.trackPosition=re.opt.position!==!1,re.trackPosition&&(re.position=re.line=re.column=0),Y(re,"onready")}Object.create||(Object.create=function(L){function M(){}return M.prototype=L,new M}),Object.keys||(Object.keys=function(L){var M=[];for(var re in L)L.hasOwnProperty(re)&&M.push(re);return M});function i(L){for(var M=Math.max(t.MAX_BUFFER_LENGTH,10),re=0,ne=0,fe=r.length;neM)switch(r[ne]){case"textNode":W(L);break;case"cdata":_(L,"oncdata",L.cdata),L.cdata="";break;case"script":_(L,"onscript",L.script),L.script="";break;default:J(L,"Max buffer length exceeded: "+r[ne])}re=Math.max(re,D)}L.bufferCheckPosition=t.MAX_BUFFER_LENGTH-re+L.position}function o(L){for(var M=0,re=r.length;M"||C(L)}function k(L,M){return L.test(M)}function B(L,M){return!k(L,M)}var O=0;t.STATE={BEGIN:O++,BEGIN_WHITESPACE:O++,TEXT:O++,TEXT_ENTITY:O++,OPEN_WAKA:O++,SGML_DECL:O++,SGML_DECL_QUOTED:O++,DOCTYPE:O++,DOCTYPE_QUOTED:O++,DOCTYPE_DTD:O++,DOCTYPE_DTD_QUOTED:O++,COMMENT_STARTING:O++,COMMENT:O++,COMMENT_ENDING:O++,COMMENT_ENDED:O++,CDATA:O++,CDATA_ENDING:O++,CDATA_ENDING_2:O++,PROC_INST:O++,PROC_INST_BODY:O++,PROC_INST_ENDING:O++,OPEN_TAG:O++,OPEN_TAG_SLASH:O++,ATTRIB:O++,ATTRIB_NAME:O++,ATTRIB_NAME_SAW_WHITE:O++,ATTRIB_VALUE:O++,ATTRIB_VALUE_QUOTED:O++,ATTRIB_VALUE_CLOSED:O++,ATTRIB_VALUE_UNQUOTED:O++,ATTRIB_VALUE_ENTITY_Q:O++,ATTRIB_VALUE_ENTITY_U:O++,CLOSE_TAG:O++,CLOSE_TAG_SAW_WHITE:O++,SCRIPT:O++,SCRIPT_ENDING:O++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(L){var M=t.ENTITIES[L],re=typeof M=="number"?String.fromCharCode(M):M;t.ENTITIES[L]=re});for(var P in t.STATE)t.STATE[t.STATE[P]]=P;O=t.STATE;function Y(L,M,re){L[M]&&L[M](re)}function _(L,M,re){L.textNode&&W(L),Y(L,M,re)}function W(L){L.textNode=F(L.opt,L.textNode),L.textNode&&Y(L,"ontext",L.textNode),L.textNode=""}function F(L,M){return L.trim&&(M=M.trim()),L.normalize&&(M=M.replace(/\s+/g," ")),M}function J(L,M){return W(L),L.trackPosition&&(M+=` +Line: `+L.line+` +Column: `+L.column+` +Char: `+L.c),M=new Error(M),L.error=M,Y(L,"onerror",M),L}function j(L){return L.sawRoot&&!L.closedRoot&&H(L,"Unclosed root tag"),L.state!==O.BEGIN&&L.state!==O.BEGIN_WHITESPACE&&L.state!==O.TEXT&&J(L,"Unexpected end"),W(L),L.c="",L.closed=!0,Y(L,"onend"),n.call(L,L.strict,L.opt),L}function H(L,M){if(typeof L!="object"||!(L instanceof n))throw new Error("bad call to strictFail");L.strict&&J(L,M)}function $(L){L.strict||(L.tagName=L.tagName[L.looseCase]());var M=L.tags[L.tags.length-1]||L,re=L.tag={name:L.tagName,attributes:{}};L.opt.xmlns&&(re.ns=M.ns),L.attribList.length=0,_(L,"onopentagstart",re)}function z(L,M){var re=L.indexOf(":")<0?["",L]:L.split(":"),ne=re[0],fe=re[1];return M&&L==="xmlns"&&(ne="xmlns",fe=""),{prefix:ne,local:fe}}function G(L){if(L.strict||(L.attribName=L.attribName[L.looseCase]()),L.attribList.indexOf(L.attribName)!==-1||L.tag.attributes.hasOwnProperty(L.attribName)){L.attribName=L.attribValue="";return}if(L.opt.xmlns){var M=z(L.attribName,!0),re=M.prefix,ne=M.local;if(re==="xmlns")if(ne==="xml"&&L.attribValue!==d)H(L,"xml: prefix must be bound to "+d+` +Actual: `+L.attribValue);else if(ne==="xmlns"&&L.attribValue!==m)H(L,"xmlns: prefix must be bound to "+m+` +Actual: `+L.attribValue);else{var fe=L.tag,D=L.tags[L.tags.length-1]||L;fe.ns===D.ns&&(fe.ns=Object.create(D.ns)),fe.ns[ne]=L.attribValue}L.attribList.push([L.attribName,L.attribValue])}else L.tag.attributes[L.attribName]=L.attribValue,_(L,"onattribute",{name:L.attribName,value:L.attribValue});L.attribName=L.attribValue=""}function X(L,M){if(L.opt.xmlns){var re=L.tag,ne=z(L.tagName);re.prefix=ne.prefix,re.local=ne.local,re.uri=re.ns[ne.prefix]||"",re.prefix&&!re.uri&&(H(L,"Unbound namespace prefix: "+JSON.stringify(L.tagName)),re.uri=ne.prefix);var fe=L.tags[L.tags.length-1]||L;re.ns&&fe.ns!==re.ns&&Object.keys(re.ns).forEach(function(Z){_(L,"onopennamespace",{prefix:Z,uri:re.ns[Z]})});for(var D=0,V=L.attribList.length;D",L.tagName="",L.state=O.SCRIPT;return}_(L,"onscript",L.script),L.script=""}var M=L.tags.length,re=L.tagName;L.strict||(re=re[L.looseCase]());for(var ne=re;M--&&L.tags[M].name!==ne;)H(L,"Unexpected close tag");if(M<0){H(L,"Unmatched closing tag: "+L.tagName),L.textNode+="",L.state=O.TEXT;return}L.tagName=re;for(var fe=L.tags.length;fe-- >M;){var D=L.tag=L.tags.pop();L.tagName=L.tag.name,_(L,"onclosetag",L.tagName);var V={};for(var N in D.ns)V[N]=D.ns[N];var I=L.tags[L.tags.length-1]||L;L.opt.xmlns&&D.ns!==I.ns&&Object.keys(D.ns).forEach(function(T){var v=D.ns[T];_(L,"onclosenamespace",{prefix:T,uri:v})})}M===0&&(L.closedRoot=!0),L.tagName=L.attribValue=L.attribName="",L.attribList.length=0,L.state=O.TEXT}function Q(L){var M=L.entity,re=M.toLowerCase(),ne,fe="";return L.ENTITIES[M]?L.ENTITIES[M]:L.ENTITIES[re]?L.ENTITIES[re]:(M=re,M.charAt(0)==="#"&&(M.charAt(1)==="x"?(M=M.slice(2),ne=parseInt(M,16),fe=ne.toString(16)):(M=M.slice(1),ne=parseInt(M,10),fe=ne.toString(10))),M=M.replace(/^0+/,""),isNaN(ne)||fe.toLowerCase()!==M?(H(L,"Invalid character entity"),"&"+L.entity+";"):String.fromCodePoint(ne))}function oe(L,M){M==="<"?(L.state=O.OPEN_WAKA,L.startTagPosition=L.position):C(M)||(H(L,"Non-whitespace before first tag."),L.textNode=M,L.state=O.TEXT)}function ae(L,M){var re="";return M"?(_(M,"onsgmldeclaration",M.sgmlDecl),M.sgmlDecl="",M.state=O.TEXT):(S(ne)&&(M.state=O.SGML_DECL_QUOTED),M.sgmlDecl+=ne);continue;case O.SGML_DECL_QUOTED:ne===M.q&&(M.state=O.SGML_DECL,M.q=""),M.sgmlDecl+=ne;continue;case O.DOCTYPE:ne===">"?(M.state=O.TEXT,_(M,"ondoctype",M.doctype),M.doctype=!0):(M.doctype+=ne,ne==="["?M.state=O.DOCTYPE_DTD:S(ne)&&(M.state=O.DOCTYPE_QUOTED,M.q=ne));continue;case O.DOCTYPE_QUOTED:M.doctype+=ne,ne===M.q&&(M.q="",M.state=O.DOCTYPE);continue;case O.DOCTYPE_DTD:M.doctype+=ne,ne==="]"?M.state=O.DOCTYPE:S(ne)&&(M.state=O.DOCTYPE_DTD_QUOTED,M.q=ne);continue;case O.DOCTYPE_DTD_QUOTED:M.doctype+=ne,ne===M.q&&(M.state=O.DOCTYPE_DTD,M.q="");continue;case O.COMMENT:ne==="-"?M.state=O.COMMENT_ENDING:M.comment+=ne;continue;case O.COMMENT_ENDING:ne==="-"?(M.state=O.COMMENT_ENDED,M.comment=F(M.opt,M.comment),M.comment&&_(M,"oncomment",M.comment),M.comment=""):(M.comment+="-"+ne,M.state=O.COMMENT);continue;case O.COMMENT_ENDED:ne!==">"?(H(M,"Malformed comment"),M.comment+="--"+ne,M.state=O.COMMENT):M.state=O.TEXT;continue;case O.CDATA:ne==="]"?M.state=O.CDATA_ENDING:M.cdata+=ne;continue;case O.CDATA_ENDING:ne==="]"?M.state=O.CDATA_ENDING_2:(M.cdata+="]"+ne,M.state=O.CDATA);continue;case O.CDATA_ENDING_2:ne===">"?(M.cdata&&_(M,"oncdata",M.cdata),_(M,"onclosecdata"),M.cdata="",M.state=O.TEXT):ne==="]"?M.cdata+="]":(M.cdata+="]]"+ne,M.state=O.CDATA);continue;case O.PROC_INST:ne==="?"?M.state=O.PROC_INST_ENDING:C(ne)?M.state=O.PROC_INST_BODY:M.procInstName+=ne;continue;case O.PROC_INST_BODY:if(!M.procInstBody&&C(ne))continue;ne==="?"?M.state=O.PROC_INST_ENDING:M.procInstBody+=ne;continue;case O.PROC_INST_ENDING:ne===">"?(_(M,"onprocessinginstruction",{name:M.procInstName,body:M.procInstBody}),M.procInstName=M.procInstBody="",M.state=O.TEXT):(M.procInstBody+="?"+ne,M.state=O.PROC_INST_BODY);continue;case O.OPEN_TAG:k(w,ne)?M.tagName+=ne:($(M),ne===">"?X(M):ne==="/"?M.state=O.OPEN_TAG_SLASH:(C(ne)||H(M,"Invalid character in tag name"),M.state=O.ATTRIB));continue;case O.OPEN_TAG_SLASH:ne===">"?(X(M,!0),q(M)):(H(M,"Forward-slash in opening tag not followed by >"),M.state=O.ATTRIB);continue;case O.ATTRIB:if(C(ne))continue;ne===">"?X(M):ne==="/"?M.state=O.OPEN_TAG_SLASH:k(y,ne)?(M.attribName=ne,M.attribValue="",M.state=O.ATTRIB_NAME):H(M,"Invalid attribute name");continue;case O.ATTRIB_NAME:ne==="="?M.state=O.ATTRIB_VALUE:ne===">"?(H(M,"Attribute without value"),M.attribValue=M.attribName,G(M),X(M)):C(ne)?M.state=O.ATTRIB_NAME_SAW_WHITE:k(w,ne)?M.attribName+=ne:H(M,"Invalid attribute name");continue;case O.ATTRIB_NAME_SAW_WHITE:if(ne==="=")M.state=O.ATTRIB_VALUE;else{if(C(ne))continue;H(M,"Attribute without value"),M.tag.attributes[M.attribName]="",M.attribValue="",_(M,"onattribute",{name:M.attribName,value:""}),M.attribName="",ne===">"?X(M):k(y,ne)?(M.attribName=ne,M.state=O.ATTRIB_NAME):(H(M,"Invalid attribute name"),M.state=O.ATTRIB)}continue;case O.ATTRIB_VALUE:if(C(ne))continue;S(ne)?(M.q=ne,M.state=O.ATTRIB_VALUE_QUOTED):(H(M,"Unquoted attribute value"),M.state=O.ATTRIB_VALUE_UNQUOTED,M.attribValue=ne);continue;case O.ATTRIB_VALUE_QUOTED:if(ne!==M.q){ne==="&"?M.state=O.ATTRIB_VALUE_ENTITY_Q:M.attribValue+=ne;continue}G(M),M.q="",M.state=O.ATTRIB_VALUE_CLOSED;continue;case O.ATTRIB_VALUE_CLOSED:C(ne)?M.state=O.ATTRIB:ne===">"?X(M):ne==="/"?M.state=O.OPEN_TAG_SLASH:k(y,ne)?(H(M,"No whitespace between attributes"),M.attribName=ne,M.attribValue="",M.state=O.ATTRIB_NAME):H(M,"Invalid attribute name");continue;case O.ATTRIB_VALUE_UNQUOTED:if(!A(ne)){ne==="&"?M.state=O.ATTRIB_VALUE_ENTITY_U:M.attribValue+=ne;continue}G(M),ne===">"?X(M):M.state=O.ATTRIB;continue;case O.CLOSE_TAG:if(M.tagName)ne===">"?q(M):k(w,ne)?M.tagName+=ne:M.script?(M.script+=""?q(M):H(M,"Invalid characters in closing tag");continue;case O.TEXT_ENTITY:case O.ATTRIB_VALUE_ENTITY_Q:case O.ATTRIB_VALUE_ENTITY_U:var V,N;switch(M.state){case O.TEXT_ENTITY:V=O.TEXT,N="textNode";break;case O.ATTRIB_VALUE_ENTITY_Q:V=O.ATTRIB_VALUE_QUOTED,N="attribValue";break;case O.ATTRIB_VALUE_ENTITY_U:V=O.ATTRIB_VALUE_UNQUOTED,N="attribValue";break}ne===";"?(M[N]+=Q(M),M.entity="",M.state=V):k(M.entity.length?b:E,ne)?M.entity+=ne:(H(M,"Invalid character in entity name"),M[N]+="&"+M.entity+ne,M.entity="",M.state=V);continue;default:throw new Error(M,"Unknown state: "+M.state)}return M.position>=M.bufferCheckPosition&&i(M),M}String.fromCodePoint||(function(){var L=String.fromCharCode,M=Math.floor,re=function(){var ne=16384,fe=[],D,V,N=-1,I=arguments.length;if(!I)return"";for(var T="";++N1114111||M(v)!==v)throw RangeError("Invalid code point: "+v);v<=65535?fe.push(v):(v-=65536,D=(v>>10)+55296,V=v%1024+56320,fe.push(D,V)),(N+1===I||fe.length>ne)&&(T+=L.apply(null,fe),fe.length=0)}return T};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:re,configurable:!0,writable:!0}):String.fromCodePoint=re})()})(typeof e>"u"?e.sax={}:e)})),Qm=we(((e,t)=>{t.exports={isArray:function(r){return Array.isArray?Array.isArray(r):Object.prototype.toString.call(r)==="[object Array]"}}})),eg=we(((e,t)=>{var r=Qm().isArray;t.exports={copyOptions:function(n){var i,o={};for(i in n)n.hasOwnProperty(i)&&(o[i]=n[i]);return o},ensureFlagExists:function(n,i){(!(n in i)||typeof i[n]!="boolean")&&(i[n]=!1)},ensureSpacesExists:function(n){(!("spaces"in n)||typeof n.spaces!="number"&&typeof n.spaces!="string")&&(n.spaces=0)},ensureAlwaysArrayExists:function(n){(!("alwaysArray"in n)||typeof n.alwaysArray!="boolean"&&!r(n.alwaysArray))&&(n.alwaysArray=!1)},ensureKeyExists:function(n,i){(!(n+"Key"in i)||typeof i[n+"Key"]!="string")&&(i[n+"Key"]=i.compact?"_"+n:n)},checkFnExists:function(n,i){return n+"Fn"in i}}})),gE=we(((e,t)=>{var r=A6(),n={on:function(){},parse:function(){}},i=eg(),o=Qm().isArray,s,a=!0,u;function c(S){return s=i.copyOptions(S),i.ensureFlagExists("ignoreDeclaration",s),i.ensureFlagExists("ignoreInstruction",s),i.ensureFlagExists("ignoreAttributes",s),i.ensureFlagExists("ignoreText",s),i.ensureFlagExists("ignoreComment",s),i.ensureFlagExists("ignoreCdata",s),i.ensureFlagExists("ignoreDoctype",s),i.ensureFlagExists("compact",s),i.ensureFlagExists("alwaysChildren",s),i.ensureFlagExists("addParent",s),i.ensureFlagExists("trim",s),i.ensureFlagExists("nativeType",s),i.ensureFlagExists("nativeTypeAttributes",s),i.ensureFlagExists("sanitize",s),i.ensureFlagExists("instructionHasAttributes",s),i.ensureFlagExists("captureSpacesBetweenElements",s),i.ensureAlwaysArrayExists(s),i.ensureKeyExists("declaration",s),i.ensureKeyExists("instruction",s),i.ensureKeyExists("attributes",s),i.ensureKeyExists("text",s),i.ensureKeyExists("comment",s),i.ensureKeyExists("cdata",s),i.ensureKeyExists("doctype",s),i.ensureKeyExists("type",s),i.ensureKeyExists("name",s),i.ensureKeyExists("elements",s),i.ensureKeyExists("parent",s),i.checkFnExists("doctype",s),i.checkFnExists("instruction",s),i.checkFnExists("cdata",s),i.checkFnExists("comment",s),i.checkFnExists("text",s),i.checkFnExists("instructionName",s),i.checkFnExists("elementName",s),i.checkFnExists("attributeName",s),i.checkFnExists("attributeValue",s),i.checkFnExists("attributes",s),s}function f(S){var A=Number(S);if(!isNaN(A))return A;var k=S.toLowerCase();return k==="true"?!0:k==="false"?!1:S}function h(S,A){var k;if(s.compact){if(!u[s[S+"Key"]]&&(o(s.alwaysArray)?s.alwaysArray.indexOf(s[S+"Key"])!==-1:s.alwaysArray)&&(u[s[S+"Key"]]=[]),u[s[S+"Key"]]&&!o(u[s[S+"Key"]])&&(u[s[S+"Key"]]=[u[s[S+"Key"]]]),S+"Fn"in s&&typeof A=="string"&&(A=s[S+"Fn"](A,u)),S==="instruction"&&("instructionFn"in s||"instructionNameFn"in s)){for(k in A)if(A.hasOwnProperty(k))if("instructionFn"in s)A[k]=s.instructionFn(A[k],k,u);else{var B=A[k];delete A[k],A[s.instructionNameFn(k,B,u)]=B}}o(u[s[S+"Key"]])?u[s[S+"Key"]].push(A):u[s[S+"Key"]]=A}else{u[s.elementsKey]||(u[s.elementsKey]=[]);var O={};if(O[s.typeKey]=S,S==="instruction"){for(k in A)if(A.hasOwnProperty(k))break;O[s.nameKey]="instructionNameFn"in s?s.instructionNameFn(k,A,u):k,s.instructionHasAttributes?(O[s.attributesKey]=A[k][s.attributesKey],"instructionFn"in s&&(O[s.attributesKey]=s.instructionFn(O[s.attributesKey],k,u))):("instructionFn"in s&&(A[k]=s.instructionFn(A[k],k,u)),O[s.instructionKey]=A[k])}else S+"Fn"in s&&(A=s[S+"Fn"](A,u)),O[s[S+"Key"]]=A;s.addParent&&(O[s.parentKey]=u),u[s.elementsKey].push(O)}}function p(S){if("attributesFn"in s&&S&&(S=s.attributesFn(S,u)),(s.trim||"attributeValueFn"in s||"attributeNameFn"in s||s.nativeTypeAttributes)&&S){var A;for(A in S)if(S.hasOwnProperty(A)&&(s.trim&&(S[A]=S[A].trim()),s.nativeTypeAttributes&&(S[A]=f(S[A])),"attributeValueFn"in s&&(S[A]=s.attributeValueFn(S[A],A,u)),"attributeNameFn"in s)){var k=S[A];delete S[A],S[s.attributeNameFn(A,S[A],u)]=k}}return S}function d(S){var A={};if(S.body&&(S.name.toLowerCase()==="xml"||s.instructionHasAttributes)){for(var k=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g,B;(B=k.exec(S.body))!==null;)A[B[1]]=B[2]||B[3]||B[4];A=p(A)}if(S.name.toLowerCase()==="xml"){if(s.ignoreDeclaration)return;u[s.declarationKey]={},Object.keys(A).length&&(u[s.declarationKey][s.attributesKey]=A),s.addParent&&(u[s.declarationKey][s.parentKey]=u)}else{if(s.ignoreInstruction)return;s.trim&&(S.body=S.body.trim());var O={};s.instructionHasAttributes&&Object.keys(A).length?(O[S.name]={},O[S.name][s.attributesKey]=A):O[S.name]=S.body,h("instruction",O)}}function m(S,A){var k;if(typeof S=="object"&&(A=S.attributes,S=S.name),A=p(A),"elementNameFn"in s&&(S=s.elementNameFn(S,u)),s.compact){if(k={},!s.ignoreAttributes&&A&&Object.keys(A).length){k[s.attributesKey]={};var B;for(B in A)A.hasOwnProperty(B)&&(k[s.attributesKey][B]=A[B])}!(S in u)&&(o(s.alwaysArray)?s.alwaysArray.indexOf(S)!==-1:s.alwaysArray)&&(u[S]=[]),u[S]&&!o(u[S])&&(u[S]=[u[S]]),o(u[S])?u[S].push(k):u[S]=k}else u[s.elementsKey]||(u[s.elementsKey]=[]),k={},k[s.typeKey]="element",k[s.nameKey]=S,!s.ignoreAttributes&&A&&Object.keys(A).length&&(k[s.attributesKey]=A),s.alwaysChildren&&(k[s.elementsKey]=[]),u[s.elementsKey].push(k);k[s.parentKey]=u,u=k}function g(S){s.ignoreText||!S.trim()&&!s.captureSpacesBetweenElements||(s.trim&&(S=S.trim()),s.nativeType&&(S=f(S)),s.sanitize&&(S=S.replace(/&/g,"&").replace(//g,">")),h("text",S))}function y(S){s.ignoreComment||(s.trim&&(S=S.trim()),h("comment",S))}function w(S){var A=u[s.parentKey];s.addParent||delete u[s.parentKey],u=A}function E(S){s.ignoreCdata||(s.trim&&(S=S.trim()),h("cdata",S))}function b(S){s.ignoreDoctype||(S=S.replace(/^ /,""),s.trim&&(S=S.trim()),h("doctype",S))}function C(S){S.note=S}t.exports=function(S,A){var k=a?r.parser(!0,{}):k=new n.Parser("UTF-8"),B={};if(u=B,s=c(A),a?(k.opt={strictEntities:!0},k.onopentag=m,k.ontext=g,k.oncomment=y,k.onclosetag=w,k.onerror=C,k.oncdata=E,k.ondoctype=b,k.onprocessinginstruction=d):(k.on("startElement",m),k.on("text",g),k.on("comment",y),k.on("endElement",w),k.on("error",C)),a)k.write(S).close();else if(!k.parse(S))throw new Error("XML parsing error: "+k.getError());if(B[s.elementsKey]){var O=B[s.elementsKey];delete B[s.elementsKey],B[s.elementsKey]=O,delete B.text}return B}})),S6=we(((e,t)=>{var r=eg(),n=gE();function i(o){var s=r.copyOptions(o);return r.ensureSpacesExists(s),s}t.exports=function(o,s){var a=i(s),u=n(o,a),c,f="compact"in a&&a.compact?"_parent":"parent";return"addParent"in a&&a.addParent?c=JSON.stringify(u,function(h,p){return h===f?"_":p},a.spaces):c=JSON.stringify(u,null,a.spaces),c.replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}})),yE=we(((e,t)=>{var r=eg(),n=Qm().isArray,i,o;function s(S){var A=r.copyOptions(S);return r.ensureFlagExists("ignoreDeclaration",A),r.ensureFlagExists("ignoreInstruction",A),r.ensureFlagExists("ignoreAttributes",A),r.ensureFlagExists("ignoreText",A),r.ensureFlagExists("ignoreComment",A),r.ensureFlagExists("ignoreCdata",A),r.ensureFlagExists("ignoreDoctype",A),r.ensureFlagExists("compact",A),r.ensureFlagExists("indentText",A),r.ensureFlagExists("indentCdata",A),r.ensureFlagExists("indentAttributes",A),r.ensureFlagExists("indentInstruction",A),r.ensureFlagExists("fullTagEmptyElement",A),r.ensureFlagExists("noQuotesForNativeAttributes",A),r.ensureSpacesExists(A),typeof A.spaces=="number"&&(A.spaces=Array(A.spaces+1).join(" ")),r.ensureKeyExists("declaration",A),r.ensureKeyExists("instruction",A),r.ensureKeyExists("attributes",A),r.ensureKeyExists("text",A),r.ensureKeyExists("comment",A),r.ensureKeyExists("cdata",A),r.ensureKeyExists("doctype",A),r.ensureKeyExists("type",A),r.ensureKeyExists("name",A),r.ensureKeyExists("elements",A),r.checkFnExists("doctype",A),r.checkFnExists("instruction",A),r.checkFnExists("cdata",A),r.checkFnExists("comment",A),r.checkFnExists("text",A),r.checkFnExists("instructionName",A),r.checkFnExists("elementName",A),r.checkFnExists("attributeName",A),r.checkFnExists("attributeValue",A),r.checkFnExists("attributes",A),r.checkFnExists("fullTagEmptyElement",A),A}function a(S,A,k){return(!k&&S.spaces?` +`:"")+Array(A+1).join(S.spaces)}function u(S,A,k){if(A.ignoreAttributes)return"";"attributesFn"in A&&(S=A.attributesFn(S,o,i));var B,O,P,Y,_=[];for(B in S)S.hasOwnProperty(B)&&S[B]!==null&&S[B]!==void 0&&(Y=A.noQuotesForNativeAttributes&&typeof S[B]!="string"?"":'"',O=""+S[B],O=O.replace(/"/g,"""),P="attributeNameFn"in A?A.attributeNameFn(B,O,o,i):B,_.push(A.spaces&&A.indentAttributes?a(A,k+1,!1):" "),_.push(P+"="+Y+("attributeValueFn"in A?A.attributeValueFn(O,B,o,i):O)+Y));return S&&Object.keys(S).length&&A.spaces&&A.indentAttributes&&_.push(a(A,k,!1)),_.join("")}function c(S,A,k){return i=S,o="xml",A.ignoreDeclaration?"":""}function f(S,A,k){if(A.ignoreInstruction)return"";var B;for(B in S)if(S.hasOwnProperty(B))break;var O="instructionNameFn"in A?A.instructionNameFn(B,S[B],o,i):B;if(typeof S[B]=="object")return i=S,o=O,"";var P=S[B]?S[B]:"";return"instructionFn"in A&&(P=A.instructionFn(P,B,o,i)),""}function h(S,A){return A.ignoreComment?"":""}function p(S,A){return A.ignoreCdata?"":"","]]]]>"))+"]]>"}function d(S,A){return A.ignoreDoctype?"":""}function m(S,A){return A.ignoreText?"":(S=""+S,S=S.replace(/&/g,"&"),S=S.replace(/&/g,"&").replace(//g,">"),"textFn"in A?A.textFn(S,o,i):S)}function g(S,A){var k;if(S.elements&&S.elements.length)for(k=0;k"),S[A.elementsKey]&&S[A.elementsKey].length&&(B.push(w(S[A.elementsKey],A,k+1)),i=S,o=S.name),B.push(A.spaces&&g(S,A)?` +`+Array(k+1).join(A.spaces):""),B.push("")):B.push("/>"),B.join("")}function w(S,A,k,B){return S.reduce(function(O,P){var Y=a(A,k,B&&!O);switch(P.type){case"element":return O+Y+y(P,A,k);case"comment":return O+Y+h(P[A.commentKey],A);case"doctype":return O+Y+d(P[A.doctypeKey],A);case"cdata":return O+(A.indentCdata?Y:"")+p(P[A.cdataKey],A);case"text":return O+(A.indentText?Y:"")+m(P[A.textKey],A);case"instruction":var _={};return _[P[A.nameKey]]=P[A.attributesKey]?P:P[A.instructionKey],O+(A.indentInstruction?Y:"")+f(_,A,k)}},"")}function E(S,A,k){var B;for(B in S)if(S.hasOwnProperty(B))switch(B){case A.parentKey:case A.attributesKey:break;case A.textKey:if(A.indentText||k)return!0;break;case A.cdataKey:if(A.indentCdata||k)return!0;break;case A.instructionKey:if(A.indentInstruction||k)return!0;break;case A.doctypeKey:case A.commentKey:return!0;default:return!0}return!1}function b(S,A,k,B,O){i=S,o=A;var P="elementNameFn"in k?k.elementNameFn(A,S):A;if(typeof S>"u"||S===null||S==="")return"fullTagEmptyElementFn"in k&&k.fullTagEmptyElementFn(A,S)||k.fullTagEmptyElement?"<"+P+">":"<"+P+"/>";var Y=[];if(A){if(Y.push("<"+P),typeof S!="object")return Y.push(">"+m(S,k)+""),Y.join("");S[k.attributesKey]&&Y.push(u(S[k.attributesKey],k,B));var _=E(S,k,!0)||S[k.attributesKey]&&S[k.attributesKey]["xml:space"]==="preserve";if(_||("fullTagEmptyElementFn"in k?_=k.fullTagEmptyElementFn(A,S):_=k.fullTagEmptyElement),_)Y.push(">");else return Y.push("/>"),Y.join("")}return Y.push(C(S,k,B+1,!1)),i=S,o=A,A&&Y.push((O?a(k,B,!1):"")+""),Y.join("")}function C(S,A,k,B){var O,P,Y,_=[];for(P in S)if(S.hasOwnProperty(P))for(Y=n(S[P])?S[P]:[S[P]],O=0;O{var r=yE();t.exports=function(n,i){n instanceof Buffer&&(n=n.toString());var o=null;if(typeof n=="string")try{o=JSON.parse(n)}catch{throw new Error("The JSON structure is invalid")}else o=n;return r(o,i)}})),Tf=we(((e,t)=>{t.exports={xml2js:gE(),xml2json:S6(),js2xml:yE(),json2xml:T6()}}))(),Cf=e=>{switch(e.type){case void 0:case"element":let t=new vE(e.name,e.attributes),r=e.elements||[];for(let n of r){let i=Cf(n);i!==void 0&&t.push(i)}return t;case"text":return e.text;default:return}},C6=class extends Ee{},vE=class extends le{static fromXmlString(e){return Cf((0,Tf.xml2js)(e,{compact:!1}))}constructor(e,t){super(e),t&&this.root.push(new C6(t))}push(e){this.root.push(e)}},wE=class extends le{constructor(e){super(""),ue(this,"_attr",void 0),this._attr=e}prepForXml(e){return{_attr:this._attr}}},k6="",tg=class extends le{constructor(e,t){super(e),t&&(this.root=t.root)}},lt=e=>{if(isNaN(e))throw new Error(`Invalid value '${e}' specified. Must be an integer.`);return Math.floor(e)},El=e=>{let t=lt(e);if(t<0)throw new Error(`Invalid value '${e}' specified. Must be a positive integer.`);return t},kf=(e,t)=>{let r=t*2;if(e.length!==r||isNaN(+`0x${e}`))throw new Error(`Invalid hex value '${e}'. Expected ${r} digit hex value`);return e},D6=e=>kf(e,4),bE=e=>kf(e,2),Im=e=>kf(e,1),Al=e=>{let t=e.slice(-2),r=e.substring(0,e.length-2);return`${Number(r)}${t}`},rg=e=>{let t=Al(e);if(parseFloat(t)<0)throw new Error(`Invalid value '${t}' specified. Expected a positive number.`);return t},oo=e=>e==="auto"?e:kf(e.charAt(0)==="#"?e.substring(1):e,3),on=e=>typeof e=="string"?Al(e):lt(e),_E=e=>typeof e=="string"?rg(e):El(e),N6=e=>typeof e=="string"?Al(e):lt(e),ot=e=>typeof e=="string"?rg(e):El(e),xE=e=>{let t=e.substring(0,e.length-1);return`${Number(t)}%`},ng=e=>typeof e=="number"?lt(e):e.slice(-1)==="%"?xE(e):Al(e),EE=El,AE=El,SE=e=>e.toISOString(),me=class extends le{constructor(e,t=!0){super(e),t!==!0&&this.root.push(new ut({val:t}))}},df=class extends le{constructor(e,t){super(e),this.root.push(new ut({val:_E(t)}))}},gt=class extends le{},In=class extends le{constructor(e,t){super(e),this.root.push(new ut({val:t}))}},xs=(e,t)=>new ve({name:e,attributes:{value:{key:"w:val",value:t}}}),Ss=class extends le{constructor(e,t){super(e),this.root.push(new ut({val:t}))}},O6=class extends le{constructor(e,t){super(e),this.root.push(new ut({val:t}))}},fi=class extends le{constructor(e,t){super(e),this.root.push(t)}},ve=class extends le{constructor({name:e,attributes:t,children:r}){super(e),t&&this.root.push(new Vm(t)),r&&this.root.push(...r)}},qr={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},ig=e=>new ve({name:"w:jc",attributes:{val:{key:"w:val",value:e}}}),et=(e,{color:t,size:r,space:n,style:i})=>new ve({name:e,attributes:{style:{key:"w:val",value:i},color:{key:"w:color",value:t===void 0?void 0:oo(t)},size:{key:"w:sz",value:r===void 0?void 0:EE(r)},space:{key:"w:space",value:n===void 0?void 0:AE(n)}}}),Df={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},TE=class extends Mn{constructor(e){super("w:pBdr"),e.top&&this.root.push(et("w:top",e.top)),e.bottom&&this.root.push(et("w:bottom",e.bottom)),e.left&&this.root.push(et("w:left",e.left)),e.right&&this.root.push(et("w:right",e.right)),e.between&&this.root.push(et("w:between",e.between))}},CE=class extends le{constructor(){super("w:pBdr");let e=et("w:bottom",{color:"auto",space:1,style:Df.SINGLE,size:6});this.root.push(e)}},kE=({start:e,end:t,left:r,right:n,hanging:i,firstLine:o,firstLineChars:s})=>new ve({name:"w:ind",attributes:{start:{key:"w:start",value:e===void 0?void 0:on(e)},end:{key:"w:end",value:t===void 0?void 0:on(t)},left:{key:"w:left",value:r===void 0?void 0:on(r)},right:{key:"w:right",value:n===void 0?void 0:on(n)},hanging:{key:"w:hanging",value:i===void 0?void 0:ot(i)},firstLine:{key:"w:firstLine",value:o===void 0?void 0:ot(o)},firstLineChars:{key:"w:firstLineChars",value:s===void 0?void 0:lt(s)}}}),DE=()=>new ve({name:"w:br"}),og={BEGIN:"begin",END:"end",SEPARATE:"separate"},sg=(e,t)=>new ve({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:e},dirty:{key:"w:dirty",value:t}}}),sn=e=>sg(og.BEGIN,e),Rn=e=>sg(og.SEPARATE,e),an=e=>sg(og.END,e),R6={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},I6={BOTTOM:"bottom",CENTER:"center",INSIDE:"inside",OUTSIDE:"outside",TOP:"top"},F6={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH_DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH_2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULL_STOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PAREN:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_TEN_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL_2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW_1:"hebrew1",HEBREW_2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText"},sr={DEFAULT:"default",PRESERVE:"preserve"},yr=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{space:"xml:space"})}},M6=class extends le{constructor(){super("w:instrText"),this.root.push(new yr({space:sr.PRESERVE})),this.root.push("PAGE")}},B6=class extends le{constructor(){super("w:instrText"),this.root.push(new yr({space:sr.PRESERVE})),this.root.push("NUMPAGES")}},L6=class extends le{constructor(){super("w:instrText"),this.root.push(new yr({space:sr.PRESERVE})),this.root.push("SECTIONPAGES")}},P6=class extends le{constructor(){super("w:instrText"),this.root.push(new yr({space:sr.PRESERVE})),this.root.push("SECTION")}},Sl=({fill:e,color:t,type:r})=>new ve({name:"w:shd",attributes:{fill:{key:"w:fill",value:e===void 0?void 0:oo(e)},color:{key:"w:color",value:t===void 0?void 0:oo(t)},type:{key:"w:val",value:r}}}),z6={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},Mt=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},U6=class extends le{constructor(e){super("w:del"),this.root.push(new Mt({id:e.id,author:e.author,date:e.date}))}},q6=class extends le{constructor(e){super("w:ins"),this.root.push(new Mt({id:e.id,author:e.author,date:e.date}))}},ag={DOT:"dot"},lg=(e=ag.DOT)=>new ve({name:"w:em",attributes:{val:{key:"w:val",value:e}}}),j6=()=>lg(ag.DOT),H6=class extends le{constructor(e){super("w:spacing"),this.root.push(new ut({val:on(e)}))}},W6=class extends le{constructor(e){super("w:color"),this.root.push(new ut({val:oo(e)}))}},V6=class extends le{constructor(e){super("w:highlight"),this.root.push(new ut({val:e}))}},G6=class extends le{constructor(e){super("w:highlightCs"),this.root.push(new ut({val:e}))}},K6=e=>new ve({name:"w:lang",attributes:{value:{key:"w:val",value:e.value},eastAsia:{key:"w:eastAsia",value:e.eastAsia},bidirectional:{key:"w:bidi",value:e.bidirectional}}}),pf=(e,t)=>{if(typeof e=="string"){let n=e;return new ve({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:n},cs:{key:"w:cs",value:n},eastAsia:{key:"w:eastAsia",value:n},hAnsi:{key:"w:hAnsi",value:n},hint:{key:"w:hint",value:t}}})}let r=e;return new ve({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:r.ascii},cs:{key:"w:cs",value:r.cs},eastAsia:{key:"w:eastAsia",value:r.eastAsia},hAnsi:{key:"w:hAnsi",value:r.hAnsi},hint:{key:"w:hint",value:r.hint}}})},NE=e=>new ve({name:"w:vertAlign",attributes:{val:{key:"w:val",value:e}}}),$6=()=>NE("superscript"),X6=()=>NE("subscript"),ug={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},OE=(e=ug.SINGLE,t)=>new ve({name:"w:u",attributes:{val:{key:"w:val",value:e},color:{key:"w:color",value:t===void 0?void 0:oo(t)}}}),Z6={BLINK_BACKGROUND:"blinkBackground",LIGHTS:"lights",ANTS_BLACK:"antsBlack",ANTS_RED:"antsRed",SHIMMER:"shimmer",SPARKLE:"sparkle",NONE:"none"},J6={BLACK:"black",BLUE:"blue",CYAN:"cyan",DARK_BLUE:"darkBlue",DARK_CYAN:"darkCyan",DARK_GRAY:"darkGray",DARK_GREEN:"darkGreen",DARK_MAGENTA:"darkMagenta",DARK_RED:"darkRed",DARK_YELLOW:"darkYellow",GREEN:"green",LIGHT_GRAY:"lightGray",MAGENTA:"magenta",NONE:"none",RED:"red",WHITE:"white",YELLOW:"yellow"},ln=class extends Mn{constructor(e){if(super("w:rPr"),!e)return;if(e.style&&this.push(new In("w:rStyle",e.style)),e.font&&(typeof e.font=="string"?this.push(pf(e.font)):"name"in e.font?this.push(pf(e.font.name,e.font.hint)):this.push(pf(e.font))),e.bold!==void 0&&this.push(new me("w:b",e.bold)),e.boldComplexScript===void 0&&e.bold!==void 0||e.boldComplexScript){var t;this.push(new me("w:bCs",(t=e.boldComplexScript)!==null&&t!==void 0?t:e.bold))}if(e.italics!==void 0&&this.push(new me("w:i",e.italics)),e.italicsComplexScript===void 0&&e.italics!==void 0||e.italicsComplexScript){var r;this.push(new me("w:iCs",(r=e.italicsComplexScript)!==null&&r!==void 0?r:e.italics))}e.smallCaps!==void 0?this.push(new me("w:smallCaps",e.smallCaps)):e.allCaps!==void 0&&this.push(new me("w:caps",e.allCaps)),e.strike!==void 0&&this.push(new me("w:strike",e.strike)),e.doubleStrike!==void 0&&this.push(new me("w:dstrike",e.doubleStrike)),e.emboss!==void 0&&this.push(new me("w:emboss",e.emboss)),e.imprint!==void 0&&this.push(new me("w:imprint",e.imprint)),e.noProof!==void 0&&this.push(new me("w:noProof",e.noProof)),e.snapToGrid!==void 0&&this.push(new me("w:snapToGrid",e.snapToGrid)),e.vanish&&this.push(new me("w:vanish",e.vanish)),e.color&&this.push(new W6(e.color)),e.characterSpacing&&this.push(new H6(e.characterSpacing)),e.scale!==void 0&&this.push(new Ss("w:w",e.scale)),e.kern&&this.push(new df("w:kern",e.kern)),e.position&&this.push(new In("w:position",e.position)),e.size!==void 0&&this.push(new df("w:sz",e.size));let n=e.sizeComplexScript===void 0||e.sizeComplexScript===!0?e.size:e.sizeComplexScript;n&&this.push(new df("w:szCs",n)),e.highlight&&this.push(new V6(e.highlight));let i=e.highlightComplexScript===void 0||e.highlightComplexScript===!0?e.highlight:e.highlightComplexScript;i&&this.push(new G6(i)),e.underline&&this.push(OE(e.underline.type,e.underline.color)),e.effect&&this.push(new In("w:effect",e.effect)),e.border&&this.push(et("w:bdr",e.border)),e.shading&&this.push(Sl(e.shading)),e.subScript&&this.push(X6()),e.superScript&&this.push($6()),e.rightToLeft!==void 0&&this.push(new me("w:rtl",e.rightToLeft)),e.emphasisMark&&this.push(lg(e.emphasisMark.type)),e.language&&this.push(K6(e.language)),e.specVanish&&this.push(new me("w:specVanish",e.vanish)),e.math&&this.push(new me("w:oMath",e.math)),e.revision&&this.push(new IE(e.revision))}push(e){this.root.push(e)}},RE=class extends ln{constructor(e){super(e),e?.insertion&&this.push(new q6(e.insertion)),e?.deletion&&this.push(new U6(e.deletion))}},IE=class extends le{constructor(e){super("w:rPrChange"),this.root.push(new Mt({id:e.id,author:e.author,date:e.date})),this.addChildElement(new ln(e))}},vl=class extends le{constructor(e){if(super("w:t"),typeof e=="string")this.root.push(new yr({space:sr.PRESERVE})),this.root.push(e);else{var t;this.root.push(new yr({space:(t=e.space)!==null&&t!==void 0?t:sr.DEFAULT})),this.root.push(e.text)}}},di={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},at=class extends le{constructor(e){if(super("w:r"),ue(this,"properties",void 0),this.properties=new ln(e),this.root.push(this.properties),e.break)for(let t=0;t{t.exports=r;function r(n,i){if(!n)throw new Error(i||"Assertion failed")}r.equal=function(i,o,s){if(i!=o)throw new Error(s||"Assertion failed: "+i+" != "+o)}})),un=we((e=>{var t=Tl();e.inherits=pi();function r(_,W){return(_.charCodeAt(W)&64512)!==55296||W<0||W+1>=_.length?!1:(_.charCodeAt(W+1)&64512)===56320}function n(_,W){if(Array.isArray(_))return _.slice();if(!_)return[];var F=[];if(typeof _=="string")if(W){if(W==="hex")for(_=_.replace(/[^a-z0-9]+/gi,""),_.length%2!==0&&(_="0"+_),j=0;j<_.length;j+=2)F.push(parseInt(_[j]+_[j+1],16))}else for(var J=0,j=0;j<_.length;j++){var H=_.charCodeAt(j);H<128?F[J++]=H:H<2048?(F[J++]=H>>6|192,F[J++]=H&63|128):r(_,j)?(H=65536+((H&1023)<<10)+(_.charCodeAt(++j)&1023),F[J++]=H>>18|240,F[J++]=H>>12&63|128,F[J++]=H>>6&63|128,F[J++]=H&63|128):(F[J++]=H>>12|224,F[J++]=H>>6&63|128,F[J++]=H&63|128)}else for(j=0;j<_.length;j++)F[j]=_[j]|0;return F}e.toArray=n;function i(_){for(var W="",F=0;F<_.length;F++)W+=a(_[F].toString(16));return W}e.toHex=i;function o(_){return(_>>>24|_>>>8&65280|_<<8&16711680|(_&255)<<24)>>>0}e.htonl=o;function s(_,W){for(var F="",J=0;J<_.length;J++){var j=_[J];W==="little"&&(j=o(j)),F+=u(j.toString(16))}return F}e.toHex32=s;function a(_){return _.length===1?"0"+_:_}e.zero2=a;function u(_){return _.length===7?"0"+_:_.length===6?"00"+_:_.length===5?"000"+_:_.length===4?"0000"+_:_.length===3?"00000"+_:_.length===2?"000000"+_:_.length===1?"0000000"+_:_}e.zero8=u;function c(_,W,F,J){var j=F-W;t(j%4===0);for(var H=new Array(j/4),$=0,z=W;$>>0}return H}e.join32=c;function f(_,W){for(var F=new Array(_.length*4),J=0,j=0;J<_.length;J++,j+=4){var H=_[J];W==="big"?(F[j]=H>>>24,F[j+1]=H>>>16&255,F[j+2]=H>>>8&255,F[j+3]=H&255):(F[j+3]=H>>>24,F[j+2]=H>>>16&255,F[j+1]=H>>>8&255,F[j]=H&255)}return F}e.split32=f;function h(_,W){return _>>>W|_<<32-W}e.rotr32=h;function p(_,W){return _<>>32-W}e.rotl32=p;function d(_,W){return _+W>>>0}e.sum32=d;function m(_,W,F){return _+W+F>>>0}e.sum32_3=m;function g(_,W,F,J){return _+W+F+J>>>0}e.sum32_4=g;function y(_,W,F,J,j){return _+W+F+J+j>>>0}e.sum32_5=y;function w(_,W,F,J){var j=_[W],H=J+_[W+1]>>>0;_[W]=(H>>0,_[W+1]=H}e.sum64=w;function E(_,W,F,J){return(W+J>>>0>>0}e.sum64_hi=E;function b(_,W,F,J){return W+J>>>0}e.sum64_lo=b;function C(_,W,F,J,j,H,$,z){var G=0,X=W;return X=X+J>>>0,G+=X>>0,G+=X>>0,G+=X>>0}e.sum64_4_hi=C;function S(_,W,F,J,j,H,$,z){return W+J+H+z>>>0}e.sum64_4_lo=S;function A(_,W,F,J,j,H,$,z,G,X){var q=0,Q=W;return Q=Q+J>>>0,q+=Q>>0,q+=Q>>0,q+=Q>>0,q+=Q>>0}e.sum64_5_hi=A;function k(_,W,F,J,j,H,$,z,G,X){return W+J+H+z+X>>>0}e.sum64_5_lo=k;function B(_,W,F){return(W<<32-F|_>>>F)>>>0}e.rotr64_hi=B;function O(_,W,F){return(_<<32-F|W>>>F)>>>0}e.rotr64_lo=O;function P(_,W,F){return _>>>F}e.shr64_hi=P;function Y(_,W,F){return(_<<32-F|W>>>F)>>>0}e.shr64_lo=Y})),Cl=we((e=>{var t=un(),r=Tl();function n(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=n,n.prototype.update=function(o,s){if(o=t.toArray(o,s),this.pending?this.pending=this.pending.concat(o):this.pending=o,this.pendingTotal+=o.length,this.pending.length>=this._delta8){o=this.pending;var a=o.length%this._delta8;this.pending=o.slice(o.length-a,o.length),this.pending.length===0&&(this.pending=null),o=t.join32(o,0,o.length-a,this.endian);for(var u=0;u>>24&255,u[c++]=o>>>16&255,u[c++]=o>>>8&255,u[c++]=o&255}else for(u[c++]=o&255,u[c++]=o>>>8&255,u[c++]=o>>>16&255,u[c++]=o>>>24&255,u[c++]=0,u[c++]=0,u[c++]=0,u[c++]=0,f=8;f{var t=un().rotr32;function r(f,h,p,d){if(f===0)return n(h,p,d);if(f===1||f===3)return o(h,p,d);if(f===2)return i(h,p,d)}e.ft_1=r;function n(f,h,p){return f&h^~f&p}e.ch32=n;function i(f,h,p){return f&h^f&p^h&p}e.maj32=i;function o(f,h,p){return f^h^p}e.p32=o;function s(f){return t(f,2)^t(f,13)^t(f,22)}e.s0_256=s;function a(f){return t(f,6)^t(f,11)^t(f,25)}e.s1_256=a;function u(f){return t(f,7)^t(f,18)^f>>>3}e.g0_256=u;function c(f){return t(f,17)^t(f,19)^f>>>10}e.g1_256=c})),Q6=we(((e,t)=>{var r=un(),n=Cl(),i=ME(),o=r.rotl32,s=r.sum32,a=r.sum32_5,u=i.ft_1,c=n.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(h,c),t.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(d,m){for(var g=this.W,y=0;y<16;y++)g[y]=d[m+y];for(;y{var r=un(),n=Cl(),i=ME(),o=Tl(),s=r.sum32,a=r.sum32_4,u=r.sum32_5,c=i.ch32,f=i.maj32,h=i.s0_256,p=i.s1_256,d=i.g0_256,m=i.g1_256,g=n.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function w(){if(!(this instanceof w))return new w;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}r.inherits(w,g),t.exports=w,w.blockSize=512,w.outSize=256,w.hmacStrength=192,w.padLength=64,w.prototype._update=function(b,C){for(var S=this.W,A=0;A<16;A++)S[A]=b[C+A];for(;A{var r=un(),n=BE();function i(){if(!(this instanceof i))return new i;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}r.inherits(i,n),t.exports=i,i.blockSize=512,i.outSize=224,i.hmacStrength=192,i.padLength=64,i.prototype._digest=function(s){return s==="hex"?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}})),LE=we(((e,t)=>{var r=un(),n=Cl(),i=Tl(),o=r.rotr64_hi,s=r.rotr64_lo,a=r.shr64_hi,u=r.shr64_lo,c=r.sum64,f=r.sum64_hi,h=r.sum64_lo,p=r.sum64_4_hi,d=r.sum64_4_lo,m=r.sum64_5_hi,g=r.sum64_5_lo,y=n.BlockHash,w=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function E(){if(!(this instanceof E))return new E;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=w,this.W=new Array(160)}r.inherits(E,y),t.exports=E,E.blockSize=1024,E.outSize=512,E.hmacStrength=192,E.padLength=128,E.prototype._prepareBlock=function(j,H){for(var $=this.W,z=0;z<32;z++)$[z]=j[H+z];for(;z<$.length;z+=2){var G=W($[z-4],$[z-3]),X=F($[z-4],$[z-3]),q=$[z-14],Q=$[z-13],oe=Y($[z-30],$[z-29]),ae=_($[z-30],$[z-29]),he=$[z-32],L=$[z-31];$[z]=p(G,X,q,Q,oe,ae,he,L),$[z+1]=d(G,X,q,Q,oe,ae,he,L)}},E.prototype._update=function(j,H){this._prepareBlock(j,H);var $=this.W,z=this.h[0],G=this.h[1],X=this.h[2],q=this.h[3],Q=this.h[4],oe=this.h[5],ae=this.h[6],he=this.h[7],L=this.h[8],M=this.h[9],re=this.h[10],ne=this.h[11],fe=this.h[12],D=this.h[13],V=this.h[14],N=this.h[15];i(this.k.length===$.length);for(var I=0;I<$.length;I+=2){var T=V,v=N,x=O(L,M),R=P(L,M),U=b(L,M,re,ne,fe,D),ee=C(L,M,re,ne,fe,D),Z=this.k[I],K=this.k[I+1],te=$[I],ie=$[I+1],se=m(T,v,x,R,U,ee,Z,K,te,ie),de=g(T,v,x,R,U,ee,Z,K,te,ie);T=k(z,G),v=B(z,G),x=S(z,G,X,q,Q,oe),R=A(z,G,X,q,Q,oe);var xe=f(T,v,x,R),Te=h(T,v,x,R);V=fe,N=D,fe=re,D=ne,re=L,ne=M,L=f(ae,he,se,de),M=h(he,he,se,de),ae=Q,he=oe,Q=X,oe=q,X=z,q=G,z=f(se,de,xe,Te),G=h(se,de,xe,Te)}c(this.h,0,z,G),c(this.h,2,X,q),c(this.h,4,Q,oe),c(this.h,6,ae,he),c(this.h,8,L,M),c(this.h,10,re,ne),c(this.h,12,fe,D),c(this.h,14,V,N)},E.prototype._digest=function(j){return j==="hex"?r.toHex32(this.h,"big"):r.split32(this.h,"big")};function b(J,j,H,$,z){var G=J&H^~J&z;return G<0&&(G+=4294967296),G}function C(J,j,H,$,z,G){var X=j&$^~j&G;return X<0&&(X+=4294967296),X}function S(J,j,H,$,z){var G=J&H^J&z^H&z;return G<0&&(G+=4294967296),G}function A(J,j,H,$,z,G){var X=j&$^j&G^$&G;return X<0&&(X+=4294967296),X}function k(J,j){var H=o(J,j,28),$=o(j,J,2),z=o(j,J,7),G=H^$^z;return G<0&&(G+=4294967296),G}function B(J,j){var H=s(J,j,28),$=s(j,J,2),z=s(j,J,7),G=H^$^z;return G<0&&(G+=4294967296),G}function O(J,j){var H=o(J,j,14),$=o(J,j,18),z=o(j,J,9),G=H^$^z;return G<0&&(G+=4294967296),G}function P(J,j){var H=s(J,j,14),$=s(J,j,18),z=s(j,J,9),G=H^$^z;return G<0&&(G+=4294967296),G}function Y(J,j){var H=o(J,j,1),$=o(J,j,8),z=a(J,j,7),G=H^$^z;return G<0&&(G+=4294967296),G}function _(J,j){var H=s(J,j,1),$=s(J,j,8),z=u(J,j,7),G=H^$^z;return G<0&&(G+=4294967296),G}function W(J,j){var H=o(J,j,19),$=o(j,J,29),z=a(J,j,6),G=H^$^z;return G<0&&(G+=4294967296),G}function F(J,j){var H=s(J,j,19),$=s(j,J,29),z=u(J,j,6),G=H^$^z;return G<0&&(G+=4294967296),G}})),tR=we(((e,t)=>{var r=un(),n=LE();function i(){if(!(this instanceof i))return new i;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}r.inherits(i,n),t.exports=i,i.blockSize=1024,i.outSize=384,i.hmacStrength=192,i.padLength=128,i.prototype._digest=function(s){return s==="hex"?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}})),rR=we((e=>{e.sha1=Q6(),e.sha224=eR(),e.sha256=BE(),e.sha384=tR(),e.sha512=LE()})),nR=we((e=>{var t=un(),r=Cl(),n=t.rotl32,i=t.sum32,o=t.sum32_3,s=t.sum32_4,a=r.BlockHash;function u(){if(!(this instanceof u))return new u;a.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}t.inherits(u,a),e.ripemd160=u,u.blockSize=512,u.outSize=160,u.hmacStrength=192,u.padLength=64,u.prototype._update=function(w,E){for(var b=this.h[0],C=this.h[1],S=this.h[2],A=this.h[3],k=this.h[4],B=b,O=C,P=S,Y=A,_=k,W=0;W<80;W++){var F=i(n(s(b,c(W,C,S,A),w[p[W]+E],f(W)),m[W]),k);b=k,k=A,A=n(S,10),S=C,C=F,F=i(n(s(B,c(79-W,O,P,Y),w[d[W]+E],h(W)),g[W]),_),B=_,_=Y,Y=n(P,10),P=O,O=F}F=o(this.h[1],S,Y),this.h[1]=o(this.h[2],A,_),this.h[2]=o(this.h[3],k,B),this.h[3]=o(this.h[4],b,O),this.h[4]=o(this.h[0],C,P),this.h[0]=F},u.prototype._digest=function(w){return w==="hex"?t.toHex32(this.h,"little"):t.split32(this.h,"little")};function c(y,w,E,b){return y<=15?w^E^b:y<=31?w&E|~w&b:y<=47?(w|~E)^b:y<=63?w&b|E&~b:w^(E|~b)}function f(y){return y<=15?0:y<=31?1518500249:y<=47?1859775393:y<=63?2400959708:2840853838}function h(y){return y<=15?1352829926:y<=31?1548603684:y<=47?1836072691:y<=63?2053994217:0}var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],d=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]})),iR=we(((e,t)=>{var r=un(),n=Tl();function i(o,s,a){if(!(this instanceof i))return new i(o,s,a);this.Hash=o,this.blockSize=o.blockSize/8,this.outSize=o.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(s,a))}t.exports=i,i.prototype._init=function(s){s.length>this.blockSize&&(s=new this.Hash().update(s).digest()),n(s.length<=this.blockSize);for(var a=s.length;a{var t=e;t.utils=un(),t.common=Cl(),t.sha=rR(),t.ripemd=nR(),t.hmac=iR(),t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}))(),1),sR="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",aR=(e,t=21)=>(r=t)=>{let n="",i=r|0;for(;i--;)n+=e[Math.random()*e.length|0];return n},lR=(e=21)=>{let t="",r=e|0;for(;r--;)t+=sR[Math.random()*64|0];return t},uR=e=>Math.floor(e/25.4*72*20),Sr=e=>Math.floor(e*72*20),kl=(e=0)=>{let t=e;return()=>++t},PE=()=>kl(),zE=()=>kl(1),UE=()=>kl(),qE=()=>kl(),Dl=()=>lR().toLowerCase(),Fm=e=>oR.default.sha1().update(e instanceof ArrayBuffer?new Uint8Array(e):e).digest("hex"),cl=e=>aR("1234567890abcdef",e)(),jE=()=>`${cl(8)}-${cl(4)}-${cl(4)}-${cl(4)}-${cl(12)}`,ml=e=>new Uint8Array(new TextEncoder().encode(e)),HE={CHARACTER:"character",COLUMN:"column",INSIDE_MARGIN:"insideMargin",LEFT_MARGIN:"leftMargin",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",RIGHT_MARGIN:"rightMargin"},WE={BOTTOM_MARGIN:"bottomMargin",INSIDE_MARGIN:"insideMargin",LINE:"line",MARGIN:"margin",OUTSIDE_MARGIN:"outsideMargin",PAGE:"page",PARAGRAPH:"paragraph",TOP_MARGIN:"topMargin"},VE=()=>new ve({name:"wp:simplePos",attributes:{x:{key:"x",value:0},y:{key:"y",value:0}}}),GE=e=>new ve({name:"wp:align",children:[e]}),KE=e=>new ve({name:"wp:posOffset",children:[e.toString()]}),$E=({relative:e,align:t,offset:r})=>new ve({name:"wp:positionH",attributes:{relativeFrom:{key:"relativeFrom",value:e??HE.PAGE}},children:[(()=>{if(t)return GE(t);if(r!==void 0)return KE(r);throw new Error("There is no configuration provided for floating position (Align or offset)")})()]}),XE=({relative:e,align:t,offset:r})=>new ve({name:"wp:positionV",attributes:{relativeFrom:{key:"relativeFrom",value:e??WE.PAGE}},children:[(()=>{if(t)return GE(t);if(r!==void 0)return KE(r);throw new Error("There is no configuration provided for floating position (Align or offset)")})()]}),cR=(function(e){return e.CENTER="ctr",e.TOP="t",e.BOTTOM="b",e})({}),ZE=(e={})=>{var t,r,n,i;return new ve({name:"wps:bodyPr",attributes:{lIns:{key:"lIns",value:(t=e.margins)===null||t===void 0?void 0:t.left},rIns:{key:"rIns",value:(r=e.margins)===null||r===void 0?void 0:r.right},tIns:{key:"tIns",value:(n=e.margins)===null||n===void 0?void 0:n.top},bIns:{key:"bIns",value:(i=e.margins)===null||i===void 0?void 0:i.bottom},anchor:{key:"anchor",value:e.verticalAnchor}},children:[...e.noAutoFit?[new me("a:noAutofit",e.noAutoFit)]:[]]})},fR=(e={txBox:"1"})=>new ve({name:"wps:cNvSpPr",attributes:{txBox:{key:"txBox",value:e.txBox}}}),hR=e=>new ve({name:"w:txbxContent",children:[...e]}),dR=e=>new ve({name:"wps:txbx",children:[hR(e)]}),pR=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{cx:"cx",cy:"cy"})}},mR=class extends le{constructor(e,t){super("a:ext"),ue(this,"attributes",void 0),this.attributes=new pR({cx:e,cy:t}),this.root.push(this.attributes)}},gR=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{x:"x",y:"y"})}},yR=class extends le{constructor(e,t){super("a:off"),this.root.push(new gR({x:e??0,y:t??0}))}},vR=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{flipVertical:"flipV",flipHorizontal:"flipH",rotation:"rot"})}},JE=class extends le{constructor(e){var t,r,n,i;super("a:xfrm"),ue(this,"extents",void 0),ue(this,"offset",void 0),this.root.push(new vR({flipVertical:(t=e.flip)===null||t===void 0?void 0:t.vertical,flipHorizontal:(r=e.flip)===null||r===void 0?void 0:r.horizontal,rotation:e.rotation})),this.offset=new yR((n=e.offset)===null||n===void 0||(n=n.emus)===null||n===void 0?void 0:n.x,(i=e.offset)===null||i===void 0||(i=i.emus)===null||i===void 0?void 0:i.y),this.extents=new mR(e.emus.x,e.emus.y),this.root.push(this.offset),this.root.push(this.extents)}},YE=()=>new ve({name:"a:noFill"}),wR=e=>new ve({name:"a:srgbClr",attributes:{value:{key:"val",value:e.value}}}),bR=e=>new ve({name:"a:schemeClr",attributes:{value:{key:"val",value:e.value}}}),Mm=e=>new ve({name:"a:solidFill",children:[e.type==="rgb"?wR(e):bR(e)]}),_R=e=>new ve({name:"a:ln",attributes:{width:{key:"w",value:e.width},cap:{key:"cap",value:e.cap},compoundLine:{key:"cmpd",value:e.compoundLine},align:{key:"algn",value:e.align}},children:[e.type==="noFill"?YE():e.solidFillType==="rgb"?Mm({type:"rgb",value:e.value}):Mm({type:"scheme",value:e.value})]}),xR=class extends le{constructor(){super("a:avLst")}},ER=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{prst:"prst"})}},AR=class extends le{constructor(){super("a:prstGeom"),this.root.push(new ER({prst:"rect"})),this.root.push(new xR)}},SR=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{bwMode:"bwMode"})}},QE=class extends le{constructor({element:e,outline:t,solidFill:r,transform:n}){super(`${e}:spPr`),ue(this,"form",void 0),this.root.push(new SR({bwMode:"auto"})),this.form=new JE(n),this.root.push(this.form),this.root.push(new AR),t&&(this.root.push(YE()),this.root.push(_R(t))),r&&this.root.push(Mm(r))}},Ix=e=>new ve({name:"wps:wsp",children:[fR(e.nonVisualProperties),new QE({element:"wps",transform:e.transformation,outline:e.outline,solidFill:e.solidFill}),dR(e.children),ZE(e.bodyProperties)]}),xm=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{uri:"uri"})}},TR=e=>new ve({name:"asvg:svgBlip",attributes:{asvg:{key:"xmlns:asvg",value:"http://schemas.microsoft.com/office/drawing/2016/SVG/main"},embed:{key:"r:embed",value:`rId{${e.fileName}}`}}}),CR=e=>new ve({name:"a:ext",attributes:{uri:{key:"uri",value:"{96DAC541-7B7A-43D3-8B79-37D633B846F1}"}},children:[TR(e)]}),kR=e=>new ve({name:"a:extLst",children:[CR(e)]}),DR=e=>new ve({name:"a:blip",attributes:{embed:{key:"r:embed",value:`rId{${e.type==="svg"?e.fallback.fileName:e.fileName}}`},cstate:{key:"cstate",value:"none"}},children:e.type==="svg"?[kR(e)]:[]}),NR=class extends le{constructor(){super("a:srcRect")}},OR=class extends le{constructor(){super("a:fillRect")}},RR=class extends le{constructor(){super("a:stretch"),this.root.push(new OR)}},IR=class extends le{constructor(e){super("pic:blipFill"),this.root.push(DR(e)),this.root.push(new NR),this.root.push(new RR)}},FR=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{noChangeAspect:"noChangeAspect",noChangeArrowheads:"noChangeArrowheads"})}},MR=class extends le{constructor(){super("a:picLocks"),this.root.push(new FR({noChangeAspect:1,noChangeArrowheads:1}))}},BR=class extends le{constructor(){super("pic:cNvPicPr"),this.root.push(new MR)}},eA=(e,t)=>new ve({name:"a:hlinkClick",attributes:be(be({},t?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${e}`}})}),LR=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"id",name:"name",descr:"descr"})}},PR=class extends le{constructor(){super("pic:cNvPr"),this.root.push(new LR({id:0,name:"",descr:""}))}prepForXml(e){for(let t=e.stack.length-1;t>=0;t--){let r=e.stack[t];if(r instanceof Ns){this.root.push(eA(r.linkId,!1));break}}return super.prepForXml(e)}},zR=class extends le{constructor(){super("pic:nvPicPr"),this.root.push(new PR),this.root.push(new BR)}},UR=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{xmlns:"xmlns:pic"})}},Fx=class extends le{constructor({mediaData:e,transform:t,outline:r}){super("pic:pic"),this.root.push(new UR({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/picture"})),this.root.push(new zR),this.root.push(new IR(e)),this.root.push(new QE({element:"pic",transform:t,outline:r}))}},qR=e=>new ve({name:"wpg:grpSpPr",children:[new JE(e)]}),jR=()=>new ve({name:"wpg:cNvGrpSpPr"}),HR=e=>new ve({name:"wpg:wgp",children:[jR(),qR(e.transformation),...e.children]}),WR=class extends le{constructor({mediaData:e,transform:t,outline:r,solidFill:n}){if(super("a:graphicData"),e.type==="wps"){this.root.push(new xm({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}));let i=Ix(be(be({},e.data),{},{transformation:t,outline:r,solidFill:n}));this.root.push(i)}else if(e.type==="wpg"){this.root.push(new xm({uri:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"}));let i=HR({children:e.children.map(o=>o.type==="wps"?Ix(be(be({},o.data),{},{transformation:o.transformation,outline:o.outline,solidFill:o.solidFill})):new Fx({mediaData:o,transform:o.transformation,outline:o.outline})),transformation:t});this.root.push(i)}else{this.root.push(new xm({uri:"http://schemas.openxmlformats.org/drawingml/2006/picture"}));let i=new Fx({mediaData:e,transform:t,outline:r});this.root.push(i)}}},VR=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{a:"xmlns:a"})}},tA=class extends le{constructor({mediaData:e,transform:t,outline:r,solidFill:n}){super("a:graphic"),ue(this,"data",void 0),this.root.push(new VR({a:"http://schemas.openxmlformats.org/drawingml/2006/main"})),this.data=new WR({mediaData:e,transform:t,outline:r,solidFill:n}),this.root.push(this.data)}},dl={NONE:0,SQUARE:1,TIGHT:2,TOP_AND_BOTTOM:3},rA={BOTH_SIDES:"bothSides",LEFT:"left",RIGHT:"right",LARGEST:"largest"},Bm=()=>new ve({name:"wp:wrapNone"}),nA=(e,t={top:0,bottom:0,left:0,right:0})=>new ve({name:"wp:wrapSquare",attributes:{wrapText:{key:"wrapText",value:e.side||rA.BOTH_SIDES},distT:{key:"distT",value:t.top},distB:{key:"distB",value:t.bottom},distL:{key:"distL",value:t.left},distR:{key:"distR",value:t.right}}}),iA=(e={top:0,bottom:0})=>new ve({name:"wp:wrapTight",attributes:{distT:{key:"distT",value:e.top},distB:{key:"distB",value:e.bottom}}}),oA=(e={top:0,bottom:0})=>new ve({name:"wp:wrapTopAndBottom",attributes:{distT:{key:"distT",value:e.top},distB:{key:"distB",value:e.bottom}}}),sA=class extends le{constructor({name:e,description:t,title:r,id:n}={name:"",description:"",title:""}){super("wp:docPr"),ue(this,"docPropertiesUniqueNumericId",UE());let i={id:{key:"id",value:n??this.docPropertiesUniqueNumericId()},name:{key:"name",value:e}};t!=null&&(i.description={key:"descr",value:t}),r!=null&&(i.title={key:"title",value:r}),this.root.push(new Vm(i))}prepForXml(e){for(let t=e.stack.length-1;t>=0;t--){let r=e.stack[t];if(r instanceof Ns){this.root.push(eA(r.linkId,!0));break}}return super.prepForXml(e)}},aA=({top:e,right:t,bottom:r,left:n})=>new ve({name:"wp:effectExtent",attributes:{top:{key:"t",value:e},right:{key:"r",value:t},bottom:{key:"b",value:r},left:{key:"l",value:n}}}),lA=({x:e,y:t})=>new ve({name:"wp:extent",attributes:{x:{key:"cx",value:e},y:{key:"cy",value:t}}}),GR=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{xmlns:"xmlns:a",noChangeAspect:"noChangeAspect"})}},KR=class extends le{constructor(){super("a:graphicFrameLocks"),this.root.push(new GR({xmlns:"http://schemas.openxmlformats.org/drawingml/2006/main",noChangeAspect:1}))}},uA=()=>new ve({name:"wp:cNvGraphicFramePr",children:[new KR]}),$R=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{distT:"distT",distB:"distB",distL:"distL",distR:"distR",allowOverlap:"allowOverlap",behindDoc:"behindDoc",layoutInCell:"layoutInCell",locked:"locked",relativeHeight:"relativeHeight",simplePos:"simplePos"})}},XR=class extends le{constructor({mediaData:e,transform:t,drawingOptions:r}){super("wp:anchor");let n=be({allowOverlap:!0,behindDocument:!1,lockAnchor:!1,layoutInCell:!0,verticalPosition:{},horizontalPosition:{}},r.floating);if(this.root.push(new $R({distT:n.margins&&n.margins.top||0,distB:n.margins&&n.margins.bottom||0,distL:n.margins&&n.margins.left||0,distR:n.margins&&n.margins.right||0,simplePos:"0",allowOverlap:n.allowOverlap===!0?"1":"0",behindDoc:n.behindDocument===!0?"1":"0",locked:n.lockAnchor===!0?"1":"0",layoutInCell:n.layoutInCell===!0?"1":"0",relativeHeight:n.zIndex?n.zIndex:t.emus.y})),this.root.push(VE()),this.root.push($E(n.horizontalPosition)),this.root.push(XE(n.verticalPosition)),this.root.push(lA({x:t.emus.x,y:t.emus.y})),this.root.push(aA({top:0,right:0,bottom:0,left:0})),r.floating!==void 0&&r.floating.wrap!==void 0)switch(r.floating.wrap.type){case dl.SQUARE:this.root.push(nA(r.floating.wrap,r.floating.margins));break;case dl.TIGHT:this.root.push(iA(r.floating.margins));break;case dl.TOP_AND_BOTTOM:this.root.push(oA(r.floating.margins));break;case dl.NONE:default:this.root.push(Bm())}else this.root.push(Bm());this.root.push(new sA(r.docProperties)),this.root.push(uA()),this.root.push(new tA({mediaData:e,transform:t,outline:r.outline,solidFill:r.solidFill}))}},ZR=({mediaData:e,transform:t,docProperties:r,outline:n,solidFill:i})=>{var o,s,a,u;return new ve({name:"wp:inline",attributes:{distanceTop:{key:"distT",value:0},distanceBottom:{key:"distB",value:0},distanceLeft:{key:"distL",value:0},distanceRight:{key:"distR",value:0}},children:[lA({x:t.emus.x,y:t.emus.y}),aA(n?{top:((o=n.width)!==null&&o!==void 0?o:9525)*2,right:((s=n.width)!==null&&s!==void 0?s:9525)*2,bottom:((a=n.width)!==null&&a!==void 0?a:9525)*2,left:((u=n.width)!==null&&u!==void 0?u:9525)*2}:{top:0,right:0,bottom:0,left:0}),new sA(r),uA(),new tA({mediaData:e,transform:t,outline:n,solidFill:i})]})},Nf=class extends le{constructor(e,t={}){super("w:drawing"),t.floating?this.root.push(new XR({mediaData:e,transform:e.transformation,drawingOptions:t})):this.root.push(ZR({mediaData:e,transform:e.transformation,docProperties:t.docProperties,outline:t.outline,solidFill:t.solidFill}))}},JR=e=>{let t=e.indexOf(";base64,"),r=t===-1?0:t+8;return new Uint8Array(atob(e.substring(r)).split("").map(n=>n.charCodeAt(0)))},cA=e=>typeof e=="string"?JR(e):e,Em=(e,t)=>({data:cA(e.data),fileName:t,transformation:{pixels:{x:Math.round(e.transformation.width),y:Math.round(e.transformation.height)},emus:{x:Math.round(e.transformation.width*9525),y:Math.round(e.transformation.height*9525)},flip:e.transformation.flip,rotation:e.transformation.rotation?e.transformation.rotation*6e4:void 0}}),YR=class extends le{constructor(e){var t=(...s)=>(super(...s),ue(this,"imageData",void 0),this);let r=`${Fm(e.data)}.${e.type}`,n=e.type==="svg"?be(be({type:e.type},Em(e,r)),{},{fallback:be({type:e.fallback.type},Em(be(be({},e.fallback),{},{transformation:e.transformation}),`${Fm(e.fallback.data)}.${e.fallback.type}`))}):be({type:e.type},Em(e,r)),i=new Nf(n,{floating:e.floating,docProperties:e.altText,outline:e.outline}),o=new at({children:[i]});e.insertion?(t("w:ins"),this.root.push(new Mt({id:e.insertion.id,author:e.insertion.author,date:e.insertion.date})),this.addChildElement(o)):e.deletion?(t("w:del"),this.root.push(new Mt({id:e.deletion.id,author:e.deletion.author,date:e.deletion.date})),this.addChildElement(o)):(t("w:r"),this.root.push(new ln({})),this.root.push(i)),this.imageData=n}prepForXml(e){return e.file.Media.addImage(this.imageData.fileName,this.imageData),this.imageData.type==="svg"&&e.file.Media.addImage(this.imageData.fallback.fileName,this.imageData.fallback),super.prepForXml(e)}},cg=e=>{var t,r,n,i,o,s,a,u;return{offset:{pixels:{x:Math.round((t=(r=e.offset)===null||r===void 0?void 0:r.left)!==null&&t!==void 0?t:0),y:Math.round((n=(i=e.offset)===null||i===void 0?void 0:i.top)!==null&&n!==void 0?n:0)},emus:{x:Math.round(((o=(s=e.offset)===null||s===void 0?void 0:s.left)!==null&&o!==void 0?o:0)*9525),y:Math.round(((a=(u=e.offset)===null||u===void 0?void 0:u.top)!==null&&a!==void 0?a:0)*9525)}},pixels:{x:Math.round(e.width),y:Math.round(e.height)},emus:{x:Math.round(e.width*9525),y:Math.round(e.height*9525)},flip:e.flip,rotation:e.rotation?e.rotation*6e4:void 0}},QR=class extends at{constructor(e){super({}),ue(this,"wpsShapeData",void 0),this.wpsShapeData={type:e.type,transformation:cg(e.transformation),data:be({},e)};let t=new Nf(this.wpsShapeData,{floating:e.floating,docProperties:e.altText,outline:e.outline,solidFill:e.solidFill});this.root.push(t)}},eI=class extends at{constructor(e){super({}),ue(this,"wpgGroupData",void 0),ue(this,"mediaDatas",void 0),this.wpgGroupData={type:e.type,transformation:cg(e.transformation),children:e.children};let t=new Nf(this.wpgGroupData,{floating:e.floating,docProperties:e.altText});this.mediaDatas=e.children.filter(r=>r.type!=="wps").map(r=>r),this.root.push(t)}prepForXml(e){return this.mediaDatas.forEach(t=>{e.file.Media.addImage(t.fileName,t),t.type==="svg"&&e.file.Media.addImage(t.fallback.fileName,t.fallback)}),super.prepForXml(e)}},tI=class extends le{constructor(e){super("w:instrText"),this.root.push(new yr({space:sr.PRESERVE})),this.root.push(`SEQ ${e}`)}},rI=class extends at{constructor(e){super({}),this.root.push(sn(!0)),this.root.push(new tI(e)),this.root.push(Rn()),this.root.push(an())}},nI=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{instr:"w:instr"})}},fg=class extends le{constructor(e,t){super("w:fldSimple"),this.root.push(new nI({instr:e})),t!==void 0&&this.root.push(new wl(t))}},iI=class extends fg{constructor(e){super(` MERGEFIELD ${e} `,`\xAB${e}\xBB`)}},oI=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{xmlns:"xmlns"})}},fA={EXTERNAL:"External"},sI=(e,t,r,n)=>new ve({name:"Relationship",attributes:{id:{key:"Id",value:e},type:{key:"Type",value:t},target:{key:"Target",value:r},targetMode:{key:"TargetMode",value:n}}}),gi=class extends le{constructor(){super("Relationships"),this.root.push(new oI({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(e,t,r,n){this.root.push(sI(`rId${e}`,t,r,n))}get RelationshipCount(){return this.root.length-1}},aI=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},hg=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"w:id"})}},lI=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{"xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps"})}},uI=class extends le{constructor(e){super("w:commentRangeStart"),this.root.push(new hg({id:e}))}},cI=class extends le{constructor(e){super("w:commentRangeEnd"),this.root.push(new hg({id:e}))}},fI=class extends le{constructor(e){super("w:commentReference"),this.root.push(new hg({id:e}))}},Lm=class extends le{constructor({id:e,initials:t,author:r,date:n=new Date,children:i},o){super("w:comment"),ue(this,"paraId",void 0),this.paraId=o,this.root.push(new aI({id:e,initials:t,author:r,date:n.toISOString()}));for(let s of i)this.root.push(s)}prepForXml(e){let t=super.prepForXml(e);if(!t||!this.paraId)return t;let r=t["w:comment"];if(!Array.isArray(r))return t;for(let n=r.length-1;n>=0;n--){let i=r[n];if(i&&typeof i=="object"&&"w:p"in i){let o=i["w:p"];Array.isArray(o)&&o.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return t}},hA=e=>(e+1).toString(16).toUpperCase().padStart(8,"0"),dA=class extends le{constructor({children:e}){if(super("w:comments"),ue(this,"relationships",void 0),ue(this,"threadData",void 0),this.root.push(new lI({"xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"})),e.some(t=>t.parentId!==void 0)){let t=new Map(e.map(r=>[r.id,hA(r.id)]));for(let r of e)this.root.push(new Lm(r,t.get(r.id)));this.threadData=e.map(r=>({paraId:t.get(r.id),parentParaId:r.parentId!==void 0?t.get(r.parentId):void 0,done:r.resolved}))}else for(let t of e)this.root.push(new Lm(t));this.relationships=new gi}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}},hI=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},dI=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},pI=class extends le{constructor(e){super("w15:commentEx"),this.root.push(new dI({paraId:e.paraId,paraIdParent:e.parentParaId,done:e.done!==void 0?e.done?"1":"0":void 0}))}},pA=class extends le{constructor(e){super("w15:commentsEx"),this.root.push(new hI({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let t of e)this.root.push(new pI(t))}},mI=class extends gt{constructor(){super("w:noBreakHyphen")}},gI=class extends gt{constructor(){super("w:softHyphen")}},yI=class extends gt{constructor(){super("w:dayShort")}},vI=class extends gt{constructor(){super("w:monthShort")}},wI=class extends gt{constructor(){super("w:yearShort")}},bI=class extends gt{constructor(){super("w:dayLong")}},_I=class extends gt{constructor(){super("w:monthLong")}},xI=class extends gt{constructor(){super("w:yearLong")}},EI=class extends gt{constructor(){super("w:annotationRef")}},AI=class extends gt{constructor(){super("w:footnoteRef")}},mA=class extends gt{constructor(){super("w:endnoteRef")}},SI=class extends gt{constructor(){super("w:separator")}},TI=class extends gt{constructor(){super("w:continuationSeparator")}},CI=class extends gt{constructor(){super("w:pgNum")}},kI=class extends gt{constructor(){super("w:cr")}},gA=class extends gt{constructor(){super("w:tab")}},DI=class extends gt{constructor(){super("w:lastRenderedPageBreak")}},NI={LEFT:"left",CENTER:"center",RIGHT:"right"},OI={MARGIN:"margin",INDENT:"indent"},RI={NONE:"none",DOT:"dot",HYPHEN:"hyphen",UNDERSCORE:"underscore",MIDDLE_DOT:"middleDot"},II=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{alignment:"w:alignment",relativeTo:"w:relativeTo",leader:"w:leader"})}},FI=class extends le{constructor(e){super("w:ptab"),this.root.push(new II({alignment:e.alignment,relativeTo:e.relativeTo,leader:e.leader}))}},yA={COLUMN:"column",PAGE:"page"},vA=class extends le{constructor(e){super("w:br"),this.root.push(new ut({type:e}))}},MI=class extends at{constructor(){super({}),this.root.push(new vA(yA.PAGE))}},BI=class extends at{constructor(){super({}),this.root.push(new vA(yA.COLUMN))}},wA=class extends le{constructor(){super("w:pageBreakBefore")}},so={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},bA=({after:e,before:t,line:r,lineRule:n,beforeAutoSpacing:i,afterAutoSpacing:o})=>new ve({name:"w:spacing",attributes:{after:{key:"w:after",value:e},before:{key:"w:before",value:t},line:{key:"w:line",value:r},lineRule:{key:"w:lineRule",value:n},beforeAutoSpacing:{key:"w:beforeAutospacing",value:i},afterAutoSpacing:{key:"w:afterAutospacing",value:o}}}),LI={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},As=e=>new ve({name:"w:pStyle",attributes:{val:{key:"w:val",value:e}}}),Pm={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},PI={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},zI={MAX:9026},_A=({type:e,position:t,leader:r})=>new ve({name:"w:tab",attributes:{val:{key:"w:val",value:e},pos:{key:"w:pos",value:t},leader:{key:"w:leader",value:r}}}),xA=e=>new ve({name:"w:tabs",children:e.map(t=>_A(t))}),mf=class extends le{constructor(e,t){super("w:numPr"),this.root.push(new UI(t)),this.root.push(new qI(e))}},UI=class extends le{constructor(e){if(super("w:ilvl"),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new ut({val:e}))}},qI=class extends le{constructor(e){super("w:numId"),this.root.push(new ut({val:typeof e=="string"?`{${e}}`:e}))}},Nl=class extends le{constructor(...e){super(...e),ue(this,"fileChild",Symbol())}},jI=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},HI={INTERNAL:"INTERNAL",EXTERNAL:"EXTERNAL"},Ns=class extends le{constructor(e,t,r){super("w:hyperlink"),ue(this,"linkId",void 0),this.linkId=t;let n=new jI({history:1,anchor:r||void 0,id:r?void 0:`rId${this.linkId}`});this.root.push(n),e.forEach(i=>{this.root.push(i)})}},EA=class extends Ns{constructor(e){super(e.children,Dl(),e.anchor)}},dg=class extends le{constructor(e){super("w:externalHyperlink"),ue(this,"options",void 0),this.options=e}},WI=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"w:id",name:"w:name"})}},VI=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"w:id"})}},AA=class{constructor(e){ue(this,"bookmarkUniqueNumericId",qE()),ue(this,"start",void 0),ue(this,"children",void 0),ue(this,"end",void 0);let t=this.bookmarkUniqueNumericId();this.start=new SA(e.id,t),this.children=e.children,this.end=new TA(t)}},SA=class extends le{constructor(e,t){super("w:bookmarkStart");let r=new WI({name:e,id:t});this.root.push(r)}},TA=class extends le{constructor(e){super("w:bookmarkEnd");let t=new VI({id:e});this.root.push(t)}},GI=(function(e){return e.NONE="none",e.RELATIVE="relative",e.NO_CONTEXT="no_context",e.FULL_CONTEXT="full_context",e})({}),KI={relative:"\\r",no_context:"\\n",full_context:"\\w",none:void 0},$I=class extends fg{constructor(e,t,r={}){let{hyperlink:n=!0,referenceFormat:i="full_context"}=r,o=`${`REF ${e}`} ${[...n?["\\h"]:[],...[KI[i]].filter(s=>!!s)].join(" ")}`;super(o,t)}},CA=e=>new ve({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:e}}}),XI=class extends le{constructor(e,t={}){super("w:instrText"),this.root.push(new yr({space:sr.PRESERVE}));let r=`PAGEREF ${e}`;t.hyperlink&&(r=`${r} \\h`),t.useRelativePosition&&(r=`${r} \\p`),this.root.push(r)}},ZI=class extends at{constructor(e,t={}){super({children:[sn(!0),new XI(e,t),an()]})}},JI={ANSI:"00",DEFAULT:"01",SYMBOL:"02",MAC:"4D",JIS:"80",HANGUL:"81",JOHAB:"82",GB_2312:"86",CHINESEBIG5:"88",GREEK:"A1",TURKISH:"A2",VIETNAMESE:"A3",HEBREW:"B1",ARABIC:"B2",BALTIC:"BA",RUSSIAN:"CC",THAI:"DE",EASTEUROPE:"EE",OEM:"FF"},hf=({id:e,fontKey:t,subsetted:r},n)=>new ve({name:n,attributes:be({id:{key:"r:id",value:e}},t?{fontKey:{key:"w:fontKey",value:`{${t}}`}}:{}),children:[...r?[new me("w:subsetted",r)]:[]]}),YI=({name:e,altName:t,panose1:r,charset:n,family:i,notTrueType:o,pitch:s,sig:a,embedRegular:u,embedBold:c,embedItalic:f,embedBoldItalic:h})=>new ve({name:"w:font",attributes:{name:{key:"w:name",value:e}},children:[...t?[xs("w:altName",t)]:[],...r?[xs("w:panose1",r)]:[],...n?[xs("w:charset",n)]:[],...i?[xs("w:family",i)]:[],...o?[new me("w:notTrueType",o)]:[],...s?[xs("w:pitch",s)]:[],...a?[new ve({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:a.usb0},usb1:{key:"w:usb1",value:a.usb1},usb2:{key:"w:usb2",value:a.usb2},usb3:{key:"w:usb3",value:a.usb3},csb0:{key:"w:csb0",value:a.csb0},csb1:{key:"w:csb1",value:a.csb1}}})]:[],...u?[hf(u,"w:embedRegular")]:[],...c?[hf(c,"w:embedBold")]:[],...f?[hf(f,"w:embedItalic")]:[],...h?[hf(h,"w:embedBoldItalic")]:[]]}),QI=({name:e,index:t,fontKey:r,characterSet:n})=>YI({name:e,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:n,family:"auto",pitch:"variable",embedRegular:{fontKey:r,id:`rId${t}`}}),e4=e=>new ve({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:e.map((t,r)=>QI({name:t.name,index:r+1,fontKey:t.fontKey,characterSet:t.characterSet}))}),kA=class{constructor(e){ue(this,"options",void 0),ue(this,"fontTable",void 0),ue(this,"relationships",void 0),ue(this,"fontOptionsWithKey",[]),this.options=e,this.fontOptionsWithKey=e.map(t=>be(be({},t),{},{fontKey:jE()})),this.fontTable=e4(this.fontOptionsWithKey),this.relationships=new gi;for(let t=0;tnew ve({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),r4={NONE:"none",DROP:"drop",MARGIN:"margin"},n4={MARGIN:"margin",PAGE:"page",TEXT:"text"},i4={AROUND:"around",AUTO:"auto",NONE:"none",NOT_BESIDE:"notBeside",THROUGH:"through",TIGHT:"tight"},DA=e=>{var t,r;return new ve({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:e.anchorLock},dropCap:{key:"w:dropCap",value:e.dropCap},width:{key:"w:w",value:e.width},height:{key:"w:h",value:e.height},x:{key:"w:x",value:e.position?e.position.x:void 0},y:{key:"w:y",value:e.position?e.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:e.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:e.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(t=e.space)===null||t===void 0?void 0:t.horizontal},spaceVertical:{key:"w:vSpace",value:(r=e.space)===null||r===void 0?void 0:r.vertical},rule:{key:"w:hRule",value:e.rule},alignmentX:{key:"w:xAlign",value:e.alignment?e.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:e.alignment?e.alignment.y:void 0},lines:{key:"w:lines",value:e.lines},wrap:{key:"w:wrap",value:e.wrap}}})},Fn=class extends Mn{constructor(e){if(super("w:pPr",e?.includeIfEmpty),ue(this,"numberingReferences",[]),!e)return this;if(e.heading&&this.push(As(e.heading)),e.bullet&&this.push(As("ListParagraph")),e.numbering&&!e.style&&!e.heading&&(e.numbering.custom||this.push(As("ListParagraph"))),e.style&&this.push(As(e.style)),e.keepNext!==void 0&&this.push(new me("w:keepNext",e.keepNext)),e.keepLines!==void 0&&this.push(new me("w:keepLines",e.keepLines)),e.pageBreakBefore&&this.push(new wA),e.frame&&this.push(DA(e.frame)),e.widowControl!==void 0&&this.push(new me("w:widowControl",e.widowControl)),e.bullet&&this.push(new mf(1,e.bullet.level)),e.numbering){var t,r;this.numberingReferences.push({reference:e.numbering.reference,instance:(t=e.numbering.instance)!==null&&t!==void 0?t:0}),this.push(new mf(`${e.numbering.reference}-${(r=e.numbering.instance)!==null&&r!==void 0?r:0}`,e.numbering.level))}else e.numbering===!1&&this.push(new mf(0,0));e.border&&this.push(new TE(e.border)),e.thematicBreak&&this.push(new CE),e.shading&&this.push(Sl(e.shading)),e.wordWrap&&this.push(t4()),e.overflowPunctuation&&this.push(new me("w:overflowPunct",e.overflowPunctuation));let n=[...e.rightTabStop!==void 0?[{type:Pm.RIGHT,position:e.rightTabStop}]:[],...e.tabStops?e.tabStops:[],...e.leftTabStop!==void 0?[{type:Pm.LEFT,position:e.leftTabStop}]:[]];n.length>0&&this.push(xA(n)),e.bidirectional!==void 0&&this.push(new me("w:bidi",e.bidirectional)),e.spacing&&this.push(bA(e.spacing)),e.indent&&this.push(kE(e.indent)),e.contextualSpacing!==void 0&&this.push(new me("w:contextualSpacing",e.contextualSpacing)),e.alignment&&this.push(ig(e.alignment)),e.outlineLevel!==void 0&&this.push(CA(e.outlineLevel)),e.suppressLineNumbers!==void 0&&this.push(new me("w:suppressLineNumbers",e.suppressLineNumbers)),e.autoSpaceEastAsianText!==void 0&&this.push(new me("w:autoSpaceDN",e.autoSpaceEastAsianText)),e.run&&this.push(new RE(e.run)),e.revision&&this.push(new NA(e.revision))}push(e){this.root.push(e)}prepForXml(e){if(!(e.viewWrapper instanceof kA))for(let t of this.numberingReferences)e.file.Numbering.createConcreteNumberingInstance(t.reference,t.instance);return super.prepForXml(e)}},NA=class extends le{constructor(e){super("w:pPrChange"),this.root.push(new Mt({id:e.id,author:e.author,date:e.date})),this.root.push(new Fn(be(be({},e),{},{includeIfEmpty:!0})))}},Tr=class extends Nl{constructor(e){if(super("w:p"),ue(this,"properties",void 0),typeof e=="string")return this.properties=new Fn({}),this.root.push(this.properties),this.root.push(new wl(e)),this;if(this.properties=new Fn(e),this.root.push(this.properties),e.text&&this.root.push(new wl(e.text)),e.children)for(let t of e.children){if(t instanceof AA){this.root.push(t.start);for(let r of t.children)this.root.push(r);this.root.push(t.end);continue}this.root.push(t)}}prepForXml(e){for(let t of this.root)if(t instanceof dg){let r=this.root.indexOf(t),n=new Ns(t.options.children,Dl());e.viewWrapper.Relationships.addRelationship(n.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",t.options.link,fA.EXTERNAL),this.root[r]=n}return super.prepForXml(e)}addRunToFront(e){return this.root.splice(1,0,e),this}},o4=class extends le{constructor(e){super("m:oMath");for(let t of e.children)this.root.push(t)}},s4=class extends le{constructor(e){super("m:t"),this.root.push(e)}},a4=class extends le{constructor(e){super("m:r"),this.root.push(new s4(e))}},OA=class extends le{constructor(e){super("m:den");for(let t of e)this.root.push(t)}},RA=class extends le{constructor(e){super("m:num");for(let t of e)this.root.push(t)}},l4=class extends le{constructor(e){super("m:f"),this.root.push(new RA(e.numerator)),this.root.push(new OA(e.denominator))}},IA=({accent:e})=>new ve({name:"m:chr",attributes:{accent:{key:"m:val",value:e}}}),Gt=({children:e})=>new ve({name:"m:e",children:e}),FA=({value:e})=>new ve({name:"m:limLoc",attributes:{value:{key:"m:val",value:e||"undOvr"}}}),u4=()=>new ve({name:"m:subHide",attributes:{hide:{key:"m:val",value:1}}}),c4=()=>new ve({name:"m:supHide",attributes:{hide:{key:"m:val",value:1}}}),pg=({accent:e,hasSuperScript:t,hasSubScript:r,limitLocationVal:n})=>new ve({name:"m:naryPr",children:[...e?[IA({accent:e})]:[],FA({value:n}),...t?[]:[c4()],...r?[]:[u4()]]}),Os=({children:e})=>new ve({name:"m:sub",children:e}),Rs=({children:e})=>new ve({name:"m:sup",children:e}),f4=class extends le{constructor(e){super("m:nary"),this.root.push(pg({accent:"\u2211",hasSuperScript:!!e.superScript,hasSubScript:!!e.subScript})),e.subScript&&this.root.push(Os({children:e.subScript})),e.superScript&&this.root.push(Rs({children:e.superScript})),this.root.push(Gt({children:e.children}))}},h4=class extends le{constructor(e){super("m:nary"),this.root.push(pg({accent:"",hasSuperScript:!!e.superScript,hasSubScript:!!e.subScript,limitLocationVal:"subSup"})),e.subScript&&this.root.push(Os({children:e.subScript})),e.superScript&&this.root.push(Rs({children:e.superScript})),this.root.push(Gt({children:e.children}))}},mg=class extends le{constructor(e){super("m:lim");for(let t of e)this.root.push(t)}},d4=class extends le{constructor(e){super("m:limUpp"),this.root.push(Gt({children:e.children})),this.root.push(new mg(e.limit))}},p4=class extends le{constructor(e){super("m:limLow"),this.root.push(Gt({children:e.children})),this.root.push(new mg(e.limit))}},MA=()=>new ve({name:"m:sSupPr"}),m4=class extends le{constructor(e){super("m:sSup"),this.root.push(MA()),this.root.push(Gt({children:e.children})),this.root.push(Rs({children:e.superScript}))}},BA=()=>new ve({name:"m:sSubPr"}),g4=class extends le{constructor(e){super("m:sSub"),this.root.push(BA()),this.root.push(Gt({children:e.children})),this.root.push(Os({children:e.subScript}))}},LA=()=>new ve({name:"m:sSubSupPr"}),y4=class extends le{constructor(e){super("m:sSubSup"),this.root.push(LA()),this.root.push(Gt({children:e.children})),this.root.push(Os({children:e.subScript})),this.root.push(Rs({children:e.superScript}))}},PA=()=>new ve({name:"m:sPrePr"}),v4=class extends ve{constructor({children:e,subScript:t,superScript:r}){super({name:"m:sPre",children:[PA(),Gt({children:e}),Os({children:t}),Rs({children:r})]})}},w4="",zA=class extends le{constructor(e){if(super("m:deg"),e)for(let t of e)this.root.push(t)}},b4=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{hide:"m:val"})}},_4=class extends le{constructor(){super("m:degHide"),this.root.push(new b4({hide:1}))}},UA=class extends le{constructor(e){super("m:radPr"),e||this.root.push(new _4)}},x4=class extends le{constructor(e){super("m:rad"),this.root.push(new UA(!!e.degree)),this.root.push(new zA(e.degree)),this.root.push(Gt({children:e.children}))}},qA=class extends le{constructor(e){super("m:fName");for(let t of e)this.root.push(t)}},jA=class extends le{constructor(){super("m:funcPr")}},E4=class extends le{constructor(e){super("m:func"),this.root.push(new jA),this.root.push(new qA(e.name)),this.root.push(Gt({children:e.children}))}},A4=({character:e})=>new ve({name:"m:begChr",attributes:{character:{key:"m:val",value:e}}}),S4=({character:e})=>new ve({name:"m:endChr",attributes:{character:{key:"m:val",value:e}}}),Of=({characters:e})=>new ve({name:"m:dPr",children:e?[A4({character:e.beginningCharacter}),S4({character:e.endingCharacter})]:[]}),T4=class extends le{constructor(e){super("m:d"),this.root.push(Of({})),this.root.push(Gt({children:e.children}))}},C4=class extends le{constructor(e){super("m:d"),this.root.push(Of({characters:{beginningCharacter:"[",endingCharacter:"]"}})),this.root.push(Gt({children:e.children}))}},k4=class extends le{constructor(e){super("m:d"),this.root.push(Of({characters:{beginningCharacter:"{",endingCharacter:"}"}})),this.root.push(Gt({children:e.children}))}},D4=class extends le{constructor(e){super("m:d"),this.root.push(Of({characters:{beginningCharacter:"\u2329",endingCharacter:"\u232A"}})),this.root.push(Gt({children:e.children}))}},N4=e=>new ve({name:"w:gridCol",attributes:e!==void 0?{width:{key:"w:w",value:ot(e)}}:void 0}),HA=class extends le{constructor(e,t){super("w:tblGrid");for(let r of e)this.root.push(N4(r));t&&this.root.push(new R4(t))}},O4=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"w:id"})}},R4=class extends le{constructor(e){super("w:tblGridChange"),this.root.push(new O4({id:e.id})),this.root.push(new HA(e.columnWidths))}},I4=class extends le{constructor(e){super("w:ins"),this.root.push(new Mt({id:e.id,author:e.author,date:e.date})),this.addChildElement(new wl(e))}},F4=class extends le{constructor(){super("w:delInstrText"),this.root.push(new yr({space:sr.PRESERVE})),this.root.push("PAGE")}},M4=class extends le{constructor(){super("w:delInstrText"),this.root.push(new yr({space:sr.PRESERVE})),this.root.push("NUMPAGES")}},B4=class extends le{constructor(){super("w:delInstrText"),this.root.push(new yr({space:sr.PRESERVE})),this.root.push("SECTIONPAGES")}},Mx=class extends le{constructor(e){super("w:delText"),this.root.push(new yr({space:sr.PRESERVE})),this.root.push(e)}},L4=class extends le{constructor(e){super("w:del"),ue(this,"deletedTextRunWrapper",void 0),this.root.push(new Mt({id:e.id,author:e.author,date:e.date})),this.deletedTextRunWrapper=new P4(e),this.addChildElement(this.deletedTextRunWrapper)}},P4=class extends le{constructor(e){if(super("w:r"),this.root.push(new ln(e)),e.children)for(let t of e.children){if(typeof t=="string"){switch(t){case di.CURRENT:this.root.push(sn()),this.root.push(new F4),this.root.push(Rn()),this.root.push(an());break;case di.TOTAL_PAGES:this.root.push(sn()),this.root.push(new M4),this.root.push(Rn()),this.root.push(an());break;case di.TOTAL_PAGES_IN_SECTION:this.root.push(sn()),this.root.push(new B4),this.root.push(Rn()),this.root.push(an());break;default:this.root.push(new Mx(t));break}continue}this.root.push(t)}else e.text&&this.root.push(new Mx(e.text));if(e.break)for(let t=0;tnew ve({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:e}}}),YA=({marginUnitType:e=bf.DXA,top:t,left:r,bottom:n,right:i})=>[{name:"w:top",size:t},{name:"w:left",size:r},{name:"w:bottom",size:n},{name:"w:right",size:i}].filter(o=>o.size!==void 0).map(({name:o,size:s})=>bl(o,{type:e,size:s})),q4=e=>{let t=YA(e);if(t.length!==0)return new ve({name:"w:tblCellMar",children:t})},j4=e=>{let t=YA(e);if(t.length!==0)return new ve({name:"w:tcMar",children:t})},bf={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},bl=(e,{type:t=bf.AUTO,size:r})=>{let n=r;return t===bf.PERCENTAGE&&typeof r=="number"&&(n=`${r}%`),new ve({name:e,attributes:{type:{key:"w:type",value:t},size:{key:"w:w",value:ng(n)}}})},QA=class extends Mn{constructor(e){super("w:tcBorders"),e.top&&this.root.push(et("w:top",e.top)),e.start&&this.root.push(et("w:start",e.start)),e.left&&this.root.push(et("w:left",e.left)),e.bottom&&this.root.push(et("w:bottom",e.bottom)),e.end&&this.root.push(et("w:end",e.end)),e.right&&this.root.push(et("w:right",e.right))}},H4=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{val:"w:val"})}},eS=class extends le{constructor(e){super("w:gridSpan"),this.root.push(new H4({val:lt(e)}))}},yg={CONTINUE:"continue",RESTART:"restart"},W4=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{val:"w:val"})}},zm=class extends le{constructor(e){super("w:vMerge"),this.root.push(new W4({val:e}))}},V4={BOTTOM_TO_TOP_LEFT_TO_RIGHT:"btLr",LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},G4=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{val:"w:val"})}},tS=class extends le{constructor(e){super("w:textDirection"),this.root.push(new G4({val:e}))}},rS=class extends Mn{constructor(e){if(super("w:tcPr",e.includeIfEmpty),e.width&&this.root.push(bl("w:tcW",e.width)),e.columnSpan&&this.root.push(new eS(e.columnSpan)),e.verticalMerge?this.root.push(new zm(e.verticalMerge)):e.rowSpan&&e.rowSpan>1&&this.root.push(new zm(yg.RESTART)),e.borders&&this.root.push(new QA(e.borders)),e.shading&&this.root.push(Sl(e.shading)),e.margins){let t=j4(e.margins);t&&this.root.push(t)}e.textDirection&&this.root.push(new tS(e.textDirection)),e.verticalAlign&&this.root.push(gg(e.verticalAlign)),e.insertion&&this.root.push(new GA(e.insertion)),e.deletion&&this.root.push(new KA(e.deletion)),e.revision&&this.root.push(new K4(e.revision)),e.cellMerge&&this.root.push(new XA(e.cellMerge))}},K4=class extends le{constructor(e){super("w:tcPrChange"),this.root.push(new Mt({id:e.id,author:e.author,date:e.date})),this.root.push(new rS(be(be({},e),{},{includeIfEmpty:!0})))}},vg=class extends le{constructor(e){super("w:tc"),ue(this,"options",void 0),this.options=e,this.root.push(new rS(e));for(let t of e.children)this.root.push(t)}prepForXml(e){return this.root[this.root.length-1]instanceof Tr||this.root.push(new Tr({})),super.prepForXml(e)}},ws={style:Df.NONE,size:0,color:"auto"},bs={style:Df.SINGLE,size:4,color:"auto"},wg=class extends le{constructor(e){var t,r,n,i,o,s;super("w:tblBorders"),this.root.push(et("w:top",(t=e.top)!==null&&t!==void 0?t:bs)),this.root.push(et("w:left",(r=e.left)!==null&&r!==void 0?r:bs)),this.root.push(et("w:bottom",(n=e.bottom)!==null&&n!==void 0?n:bs)),this.root.push(et("w:right",(i=e.right)!==null&&i!==void 0?i:bs)),this.root.push(et("w:insideH",(o=e.insideHorizontal)!==null&&o!==void 0?o:bs)),this.root.push(et("w:insideV",(s=e.insideVertical)!==null&&s!==void 0?s:bs))}};ue(wg,"NONE",{top:ws,bottom:ws,left:ws,right:ws,insideHorizontal:ws,insideVertical:ws});var $4={MARGIN:"margin",PAGE:"page",TEXT:"text"},X4={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},Z4={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},J4={NEVER:"never",OVERLAP:"overlap"},Y4=e=>new ve({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:e}}}),nS=({horizontalAnchor:e,verticalAnchor:t,absoluteHorizontalPosition:r,relativeHorizontalPosition:n,absoluteVerticalPosition:i,relativeVerticalPosition:o,bottomFromText:s,topFromText:a,leftFromText:u,rightFromText:c,overlap:f})=>new ve({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:u===void 0?void 0:ot(u)},rightFromText:{key:"w:rightFromText",value:c===void 0?void 0:ot(c)},topFromText:{key:"w:topFromText",value:a===void 0?void 0:ot(a)},bottomFromText:{key:"w:bottomFromText",value:s===void 0?void 0:ot(s)},absoluteHorizontalPosition:{key:"w:tblpX",value:r===void 0?void 0:on(r)},absoluteVerticalPosition:{key:"w:tblpY",value:i===void 0?void 0:on(i)},horizontalAnchor:{key:"w:horzAnchor",value:e},relativeHorizontalPosition:{key:"w:tblpXSpec",value:n},relativeVerticalPosition:{key:"w:tblpYSpec",value:o},verticalAnchor:{key:"w:vertAnchor",value:t}},children:f?[Y4(f)]:void 0}),Q4={AUTOFIT:"autofit",FIXED:"fixed"},iS=e=>new ve({name:"w:tblLayout",attributes:{type:{key:"w:type",value:e}}}),e9={DXA:"dxa",NIL:"nil"},oS=({type:e=e9.DXA,value:t})=>new ve({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:e},value:{key:"w:w",value:ng(t)}}}),sS=({firstRow:e,lastRow:t,firstColumn:r,lastColumn:n,noHBand:i,noVBand:o})=>new ve({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:e},lastRow:{key:"w:lastRow",value:t},firstColumn:{key:"w:firstColumn",value:r},lastColumn:{key:"w:lastColumn",value:n},noHBand:{key:"w:noHBand",value:i},noVBand:{key:"w:noVBand",value:o}}}),bg=class extends Mn{constructor(e){if(super("w:tblPr",e.includeIfEmpty),e.style&&this.root.push(new In("w:tblStyle",e.style)),e.float&&this.root.push(nS(e.float)),e.visuallyRightToLeft!==void 0&&this.root.push(new me("w:bidiVisual",e.visuallyRightToLeft)),e.width&&this.root.push(bl("w:tblW",e.width)),e.alignment&&this.root.push(ig(e.alignment)),e.indent&&this.root.push(bl("w:tblInd",e.indent)),e.borders&&this.root.push(new wg(e.borders)),e.shading&&this.root.push(Sl(e.shading)),e.layout&&this.root.push(iS(e.layout)),e.cellMargin){let t=q4(e.cellMargin);t&&this.root.push(t)}e.tableLook&&this.root.push(sS(e.tableLook)),e.cellSpacing&&this.root.push(oS(e.cellSpacing)),e.revision&&this.root.push(new t9(e.revision))}},t9=class extends le{constructor(e){super("w:tblPrChange"),this.root.push(new Mt({id:e.id,author:e.author,date:e.date})),this.root.push(new bg(be(be({},e),{},{includeIfEmpty:!0})))}},r9=class extends Nl{constructor({rows:e,width:t,columnWidths:r=Array(Math.max(...e.map(g=>g.CellCount))).fill(100),columnWidthsRevision:n,margins:i,indent:o,float:s,layout:a,style:u,borders:c,alignment:f,visuallyRightToLeft:h,tableLook:p,cellSpacing:d,revision:m}){super("w:tbl"),this.root.push(new bg({borders:c??{},width:t??{size:100},indent:o,float:s,layout:a,style:u,alignment:f,cellMargin:i,visuallyRightToLeft:h,tableLook:p,cellSpacing:d,revision:m})),this.root.push(new HA(r,n));for(let g of e)this.root.push(g);e.forEach((g,y)=>{if(y===e.length-1)return;let w=0;g.cells.forEach(E=>{if(E.options.rowSpan&&E.options.rowSpan>1){let b=new vg({rowSpan:E.options.rowSpan-1,columnSpan:E.options.columnSpan,borders:E.options.borders,children:[],verticalMerge:yg.CONTINUE});e[y+1].addCellToColumnIndex(b,w)}w+=E.options.columnSpan||1})})}},n9={AUTO:"auto",ATLEAST:"atLeast",EXACT:"exact"},aS=(e,t)=>new ve({name:"w:trHeight",attributes:{value:{key:"w:val",value:ot(e)},rule:{key:"w:hRule",value:t}}}),_g=class extends Mn{constructor(e){super("w:trPr",e.includeIfEmpty),e.cantSplit!==void 0&&this.root.push(new me("w:cantSplit",e.cantSplit)),e.tableHeader!==void 0&&this.root.push(new me("w:tblHeader",e.tableHeader)),e.height&&this.root.push(aS(e.height.value,e.height.rule)),e.cellSpacing&&this.root.push(oS(e.cellSpacing)),e.insertion&&this.root.push(new WA(e.insertion)),e.deletion&&this.root.push(new VA(e.deletion)),e.revision&&this.root.push(new lS(e.revision))}},lS=class extends le{constructor(e){super("w:trPrChange"),this.root.push(new Mt({id:e.id,author:e.author,date:e.date})),this.root.push(new _g(be(be({},e),{},{includeIfEmpty:!0})))}},i9=class extends le{constructor(e){super("w:tr"),ue(this,"options",void 0),this.options=e,this.root.push(new _g(e));for(let t of e.children)this.root.push(t)}get CellCount(){return this.options.children.length}get cells(){return this.root.filter(e=>e instanceof vg)}addCellToIndex(e,t){this.root.splice(t+1,0,e)}addCellToColumnIndex(e,t){let r=this.columnIndexToRootIndex(t,!0);this.addCellToIndex(e,r-1)}rootIndexToColumnIndex(e){if(e<1||e>=this.root.length)throw new Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let t=0;for(let r=1;r=this.root.length){if(t)return this.root.length;throw new Error(`cell 'columnIndex' should not great than ${r-1}`)}let i=this.root[n];n+=1,r+=i&&i.options.columnSpan||1}return n-1}},o9=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},s9=class extends le{constructor(){super("Properties"),this.root.push(new o9({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},a9=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{xmlns:"xmlns"})}},On=(e,t)=>new ve({name:"Default",attributes:{contentType:{key:"ContentType",value:e},extension:{key:"Extension",value:t}}}),or=(e,t)=>new ve({name:"Override",attributes:{contentType:{key:"ContentType",value:e},partName:{key:"PartName",value:t}}}),l9=class extends le{constructor(){super("Types"),this.root.push(new a9({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(On("image/png","png")),this.root.push(On("image/jpeg","jpeg")),this.root.push(On("image/jpeg","jpg")),this.root.push(On("image/bmp","bmp")),this.root.push(On("image/gif","gif")),this.root.push(On("image/svg+xml","svg")),this.root.push(On("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(On("application/xml","xml")),this.root.push(On("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(or("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(or("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(or("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml")),this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml"))}addCommentsExtended(){this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addFooter(e){this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${e}.xml`))}addHeader(e){this.root.push(or("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${e}.xml`))}},_f={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ol=class extends Ee{constructor(e,t){super(be({Ignorable:t},Object.fromEntries(e.map(r=>[r,_f[r]])))),ue(this,"xmlKeys",be({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(_f).map(r=>[r,`xmlns:${r}`]))))}},u9=class extends le{constructor(e){super("cp:coreProperties"),this.root.push(new Ol(["cp","dc","dcterms","dcmitype","xsi"])),e.title&&this.root.push(new fi("dc:title",e.title)),e.subject&&this.root.push(new fi("dc:subject",e.subject)),e.creator&&this.root.push(new fi("dc:creator",e.creator)),e.keywords&&this.root.push(new fi("cp:keywords",e.keywords)),e.description&&this.root.push(new fi("dc:description",e.description)),e.lastModifiedBy&&this.root.push(new fi("cp:lastModifiedBy",e.lastModifiedBy)),e.revision&&this.root.push(new fi("cp:revision",String(e.revision))),this.root.push(new Bx("dcterms:created")),this.root.push(new Bx("dcterms:modified"))}},c9=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{type:"xsi:type"})}},Bx=class extends le{constructor(e){super(e),this.root.push(new c9({type:"dcterms:W3CDTF"})),this.root.push(SE(new Date))}},f9=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},h9=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},d9=class extends le{constructor(e,t){super("property"),this.root.push(new h9({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:e.toString(),name:t.name})),this.root.push(new p9(t.value))}},p9=class extends le{constructor(e){super("vt:lpwstr"),this.root.push(e)}},m9=class extends le{constructor(e){super("Properties"),ue(this,"nextId",void 0),ue(this,"properties",[]),this.root.push(new f9({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let t of e)this.addCustomProperty(t)}prepForXml(e){return this.properties.forEach(t=>this.root.push(t)),super.prepForXml(e)}addCustomProperty(e){this.properties.push(new d9(this.nextId++,e))}},uS=({space:e,count:t,separate:r,equalWidth:n,children:i})=>new ve({name:"w:cols",attributes:{space:{key:"w:space",value:e===void 0?void 0:ot(e)},count:{key:"w:num",value:t===void 0?void 0:lt(t)},separate:{key:"w:sep",value:r},equalWidth:{key:"w:equalWidth",value:n}},children:!n&&i?i:void 0}),g9={DEFAULT:"default",LINES:"lines",LINES_AND_CHARS:"linesAndChars",SNAP_TO_CHARS:"snapToChars"},cS=({type:e,linePitch:t,charSpace:r})=>new ve({name:"w:docGrid",attributes:{type:{key:"w:type",value:e},linePitch:{key:"w:linePitch",value:lt(t)},charSpace:{key:"w:charSpace",value:r?lt(r):void 0}}}),io={DEFAULT:"default",FIRST:"first",EVEN:"even"},Um={HEADER:"w:headerReference",FOOTER:"w:footerReference"},gf=(e,t)=>new ve({name:e,attributes:{type:{key:"w:type",value:t.type||io.DEFAULT},id:{key:"r:id",value:`rId${t.id}`}}}),y9={NEW_PAGE:"newPage",NEW_SECTION:"newSection",CONTINUOUS:"continuous"},fS=({countBy:e,start:t,restart:r,distance:n})=>new ve({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:e===void 0?void 0:lt(e)},start:{key:"w:start",value:t===void 0?void 0:lt(t)},restart:{key:"w:restart",value:r},distance:{key:"w:distance",value:n===void 0?void 0:ot(n)}}}),v9={ALL_PAGES:"allPages",FIRST_PAGE:"firstPage",NOT_FIRST_PAGE:"notFirstPage"},w9={PAGE:"page",TEXT:"text"},b9={BACK:"back",FRONT:"front"},Lx=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},hS=class extends Mn{constructor(e){if(super("w:pgBorders"),!e)return this;e.pageBorders?this.root.push(new Lx({display:e.pageBorders.display,offsetFrom:e.pageBorders.offsetFrom,zOrder:e.pageBorders.zOrder})):this.root.push(new Lx({})),e.pageBorderTop&&this.root.push(et("w:top",e.pageBorderTop)),e.pageBorderLeft&&this.root.push(et("w:left",e.pageBorderLeft)),e.pageBorderBottom&&this.root.push(et("w:bottom",e.pageBorderBottom)),e.pageBorderRight&&this.root.push(et("w:right",e.pageBorderRight))}},dS=(e,t,r,n,i,o,s)=>new ve({name:"w:pgMar",attributes:{top:{key:"w:top",value:on(e)},right:{key:"w:right",value:ot(t)},bottom:{key:"w:bottom",value:on(r)},left:{key:"w:left",value:ot(n)},header:{key:"w:header",value:ot(i)},footer:{key:"w:footer",value:ot(o)},gutter:{key:"w:gutter",value:ot(s)}}}),_9={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},pS=({start:e,formatType:t,separator:r})=>new ve({name:"w:pgNumType",attributes:{start:{key:"w:start",value:e===void 0?void 0:lt(e)},formatType:{key:"w:fmt",value:t},separator:{key:"w:chapSep",value:r}}}),xf={PORTRAIT:"portrait",LANDSCAPE:"landscape"},mS=({width:e,height:t,orientation:r,code:n})=>{let i=ot(e),o=ot(t);return new ve({name:"w:pgSz",attributes:{width:{key:"w:w",value:r===xf.LANDSCAPE?o:i},height:{key:"w:h",value:r===xf.LANDSCAPE?i:o},orientation:{key:"w:orient",value:r},code:{key:"w:code",value:n}}})},x9={LEFT_TO_RIGHT_TOP_TO_BOTTOM:"lrTb",TOP_TO_BOTTOM_RIGHT_TO_LEFT:"tbRl"},E9=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{val:"w:val"})}},gS=class extends le{constructor(e){super("w:textDirection"),this.root.push(new E9({val:e}))}},A9={NEXT_PAGE:"nextPage",NEXT_COLUMN:"nextColumn",CONTINUOUS:"continuous",EVEN_PAGE:"evenPage",ODD_PAGE:"oddPage"},yS=e=>new ve({name:"w:type",attributes:{val:{key:"w:val",value:e}}}),hi={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},yf={WIDTH:11906,HEIGHT:16838,ORIENTATION:xf.PORTRAIT},xg=class extends le{constructor({page:{size:{width:e=yf.WIDTH,height:t=yf.HEIGHT,orientation:r=yf.ORIENTATION,code:n}={},margin:{top:i=hi.TOP,right:o=hi.RIGHT,bottom:s=hi.BOTTOM,left:a=hi.LEFT,header:u=hi.HEADER,footer:c=hi.FOOTER,gutter:f=hi.GUTTER}={},pageNumbers:h={},borders:p,textDirection:d}={},grid:{linePitch:m=360,charSpace:g,type:y}={},headerWrapperGroup:w={},footerWrapperGroup:E={},lineNumbers:b,titlePage:C,verticalAlign:S,column:A,type:k,revision:B}={}){super("w:sectPr"),this.addHeaderFooterGroup(Um.HEADER,w),this.addHeaderFooterGroup(Um.FOOTER,E),k&&this.root.push(yS(k)),this.root.push(mS({width:e,height:t,orientation:r,code:n})),this.root.push(dS(i,o,s,a,u,c,f)),p&&this.root.push(new hS(p)),b&&this.root.push(fS(b)),this.root.push(pS(h)),A&&this.root.push(uS(A)),S&&this.root.push(gg(S)),C!==void 0&&this.root.push(new me("w:titlePg",C)),d&&this.root.push(new gS(d)),B&&this.root.push(new vS(B)),this.root.push(cS({linePitch:m,charSpace:g,type:y}))}addHeaderFooterGroup(e,t){t.default&&this.root.push(gf(e,{type:io.DEFAULT,id:t.default.View.ReferenceId})),t.first&&this.root.push(gf(e,{type:io.FIRST,id:t.first.View.ReferenceId})),t.even&&this.root.push(gf(e,{type:io.EVEN,id:t.even.View.ReferenceId}))}},vS=class extends le{constructor(e){super("w:sectPrChange"),this.root.push(new Mt({id:e.id,author:e.author,date:e.date})),this.root.push(new xg(e))}},S9=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{width:"w:w",space:"w:space"})}},T9=class extends le{constructor(e){super("w:col"),this.root.push(new S9({width:ot(e.width),space:e.space===void 0?void 0:ot(e.space)}))}},wS=class extends le{constructor(){super("w:body"),ue(this,"sections",[])}addSection(e){let t=this.sections.pop();this.root.push(this.createSectionParagraph(t)),this.sections.push(new xg(e))}prepForXml(e){return this.sections.length===1&&(this.root.splice(0,1),this.root.push(this.sections.pop())),super.prepForXml(e)}push(e){this.root.push(e)}createSectionParagraph(e){let t=new Tr({}),r=new Fn({});return r.push(e),t.addChildElement(r),t}},bS=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{color:"w:color",themeColor:"w:themeColor",themeShade:"w:themeShade",themeTint:"w:themeTint"})}},_S=class extends le{constructor(e){super("w:background"),this.root.push(new bS({color:e.color===void 0?void 0:oo(e.color),themeColor:e.themeColor,themeShade:e.themeShade===void 0?void 0:Im(e.themeShade),themeTint:e.themeTint===void 0?void 0:Im(e.themeTint)}))}},C9=class extends le{constructor(e){super("w:document"),ue(this,"body",void 0),this.root.push(new Ol(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new wS,e.background&&this.root.push(new _S(e.background)),this.root.push(this.body)}add(e){return this.body.push(e),this}get Body(){return this.body}},k9=class{constructor(e){ue(this,"document",void 0),ue(this,"relationships",void 0),this.document=new C9(e),this.relationships=new gi}get View(){return this.document}get Relationships(){return this.relationships}},D9=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},N9=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{type:"w:type",id:"w:id"})}},O9=class extends at{constructor(){super({style:"EndnoteReference"}),this.root.push(new mA)}},Px={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},Am=class extends le{constructor(e){super("w:endnote"),this.root.push(new N9({type:e.type,id:e.id}));for(let t=0;t9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new V9({ilvl:lt(e),tentative:1}))}},kS=class extends Ag{},Y9=class extends Ag{},Q9=class extends le{constructor(e){super("w:multiLevelType"),this.root.push(new ut({val:e}))}},eF=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},qm=class extends le{constructor(e,t){super("w:abstractNum"),ue(this,"id",void 0),this.root.push(new eF({abstractNumId:lt(e),restartNumberingAfterBreak:0})),this.root.push(new Q9("hybridMultilevel")),this.id=e;for(let r of t)this.root.push(new kS(r))}},tF=class extends le{constructor(e){super("w:abstractNumId"),this.root.push(new ut({val:e}))}},rF=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{numId:"w:numId"})}},jm=class extends le{constructor(e){if(super("w:num"),ue(this,"numId",void 0),ue(this,"reference",void 0),ue(this,"instance",void 0),this.numId=e.numId,this.reference=e.reference,this.instance=e.instance,this.root.push(new rF({numId:lt(e.numId)})),this.root.push(new tF(lt(e.abstractNumId))),e.overrideLevels&&e.overrideLevels.length)for(let t of e.overrideLevels)this.root.push(new DS(t.num,t.start))}},nF=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{ilvl:"w:ilvl"})}},DS=class extends le{constructor(e,t){super("w:lvlOverride"),this.root.push(new nF({ilvl:e})),t!==void 0&&this.root.push(new oF(t))}},iF=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{val:"w:val"})}},oF=class extends le{constructor(e){super("w:startOverride"),this.root.push(new iF({val:e}))}},NS=class extends le{constructor(e){super("w:numbering"),ue(this,"abstractNumberingMap",new Map),ue(this,"concreteNumberingMap",new Map),ue(this,"referenceConfigMap",new Map),ue(this,"abstractNumUniqueNumericId",PE()),ue(this,"concreteNumUniqueNumericId",zE()),this.root.push(new Ol(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let t=new qm(this.abstractNumUniqueNumericId(),[{level:0,format:en.BULLET,text:"\u25CF",alignment:qr.LEFT,style:{paragraph:{indent:{left:Sr(.5),hanging:Sr(.25)}}}},{level:1,format:en.BULLET,text:"\u25CB",alignment:qr.LEFT,style:{paragraph:{indent:{left:Sr(1),hanging:Sr(.25)}}}},{level:2,format:en.BULLET,text:"\u25A0",alignment:qr.LEFT,style:{paragraph:{indent:{left:2160,hanging:Sr(.25)}}}},{level:3,format:en.BULLET,text:"\u25CF",alignment:qr.LEFT,style:{paragraph:{indent:{left:2880,hanging:Sr(.25)}}}},{level:4,format:en.BULLET,text:"\u25CB",alignment:qr.LEFT,style:{paragraph:{indent:{left:3600,hanging:Sr(.25)}}}},{level:5,format:en.BULLET,text:"\u25A0",alignment:qr.LEFT,style:{paragraph:{indent:{left:4320,hanging:Sr(.25)}}}},{level:6,format:en.BULLET,text:"\u25CF",alignment:qr.LEFT,style:{paragraph:{indent:{left:5040,hanging:Sr(.25)}}}},{level:7,format:en.BULLET,text:"\u25CF",alignment:qr.LEFT,style:{paragraph:{indent:{left:5760,hanging:Sr(.25)}}}},{level:8,format:en.BULLET,text:"\u25CF",alignment:qr.LEFT,style:{paragraph:{indent:{left:6480,hanging:Sr(.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new jm({numId:1,abstractNumId:t.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",t);for(let r of e.config)this.abstractNumberingMap.set(r.reference,new qm(this.abstractNumUniqueNumericId(),r.levels)),this.referenceConfigMap.set(r.reference,r.levels)}prepForXml(e){for(let t of this.abstractNumberingMap.values())this.root.push(t);for(let t of this.concreteNumberingMap.values())this.root.push(t);return super.prepForXml(e)}createConcreteNumberingInstance(e,t){let r=this.abstractNumberingMap.get(e);if(!r)return;let n=`${e}-${t}`;if(this.concreteNumberingMap.has(n))return;let i=this.referenceConfigMap.get(e),o=i&&i[0].start,s={numId:this.concreteNumUniqueNumericId(),abstractNumId:r.id,reference:e,instance:t,overrideLevels:[typeof o=="number"&&Number.isInteger(o)?{num:0,start:o}:{num:0,start:1}]};this.concreteNumberingMap.set(n,new jm(s))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},sF=e=>new ve({name:"w:compatSetting",attributes:{version:{key:"w:val",value:e},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),aF=class extends le{constructor(e){super("w:compat"),e.version&&this.root.push(sF(e.version)),e.useSingleBorderforContiguousCells&&this.root.push(new me("w:useSingleBorderforContiguousCells",e.useSingleBorderforContiguousCells)),e.wordPerfectJustification&&this.root.push(new me("w:wpJustification",e.wordPerfectJustification)),e.noTabStopForHangingIndent&&this.root.push(new me("w:noTabHangInd",e.noTabStopForHangingIndent)),e.noLeading&&this.root.push(new me("w:noLeading",e.noLeading)),e.spaceForUnderline&&this.root.push(new me("w:spaceForUL",e.spaceForUnderline)),e.noColumnBalance&&this.root.push(new me("w:noColumnBalance",e.noColumnBalance)),e.balanceSingleByteDoubleByteWidth&&this.root.push(new me("w:balanceSingleByteDoubleByteWidth",e.balanceSingleByteDoubleByteWidth)),e.noExtraLineSpacing&&this.root.push(new me("w:noExtraLineSpacing",e.noExtraLineSpacing)),e.doNotLeaveBackslashAlone&&this.root.push(new me("w:doNotLeaveBackslashAlone",e.doNotLeaveBackslashAlone)),e.underlineTrailingSpaces&&this.root.push(new me("w:ulTrailSpace",e.underlineTrailingSpaces)),e.doNotExpandShiftReturn&&this.root.push(new me("w:doNotExpandShiftReturn",e.doNotExpandShiftReturn)),e.spacingInWholePoints&&this.root.push(new me("w:spacingInWholePoints",e.spacingInWholePoints)),e.lineWrapLikeWord6&&this.root.push(new me("w:lineWrapLikeWord6",e.lineWrapLikeWord6)),e.printBodyTextBeforeHeader&&this.root.push(new me("w:printBodyTextBeforeHeader",e.printBodyTextBeforeHeader)),e.printColorsBlack&&this.root.push(new me("w:printColBlack",e.printColorsBlack)),e.spaceWidth&&this.root.push(new me("w:wpSpaceWidth",e.spaceWidth)),e.showBreaksInFrames&&this.root.push(new me("w:showBreaksInFrames",e.showBreaksInFrames)),e.subFontBySize&&this.root.push(new me("w:subFontBySize",e.subFontBySize)),e.suppressBottomSpacing&&this.root.push(new me("w:suppressBottomSpacing",e.suppressBottomSpacing)),e.suppressTopSpacing&&this.root.push(new me("w:suppressTopSpacing",e.suppressTopSpacing)),e.suppressSpacingAtTopOfPage&&this.root.push(new me("w:suppressSpacingAtTopOfPage",e.suppressSpacingAtTopOfPage)),e.suppressTopSpacingWP&&this.root.push(new me("w:suppressTopSpacingWP",e.suppressTopSpacingWP)),e.suppressSpBfAfterPgBrk&&this.root.push(new me("w:suppressSpBfAfterPgBrk",e.suppressSpBfAfterPgBrk)),e.swapBordersFacingPages&&this.root.push(new me("w:swapBordersFacingPages",e.swapBordersFacingPages)),e.convertMailMergeEsc&&this.root.push(new me("w:convMailMergeEsc",e.convertMailMergeEsc)),e.truncateFontHeightsLikeWP6&&this.root.push(new me("w:truncateFontHeightsLikeWP6",e.truncateFontHeightsLikeWP6)),e.macWordSmallCaps&&this.root.push(new me("w:mwSmallCaps",e.macWordSmallCaps)),e.usePrinterMetrics&&this.root.push(new me("w:usePrinterMetrics",e.usePrinterMetrics)),e.doNotSuppressParagraphBorders&&this.root.push(new me("w:doNotSuppressParagraphBorders",e.doNotSuppressParagraphBorders)),e.wrapTrailSpaces&&this.root.push(new me("w:wrapTrailSpaces",e.wrapTrailSpaces)),e.footnoteLayoutLikeWW8&&this.root.push(new me("w:footnoteLayoutLikeWW8",e.footnoteLayoutLikeWW8)),e.shapeLayoutLikeWW8&&this.root.push(new me("w:shapeLayoutLikeWW8",e.shapeLayoutLikeWW8)),e.alignTablesRowByRow&&this.root.push(new me("w:alignTablesRowByRow",e.alignTablesRowByRow)),e.forgetLastTabAlignment&&this.root.push(new me("w:forgetLastTabAlignment",e.forgetLastTabAlignment)),e.adjustLineHeightInTable&&this.root.push(new me("w:adjustLineHeightInTable",e.adjustLineHeightInTable)),e.autoSpaceLikeWord95&&this.root.push(new me("w:autoSpaceLikeWord95",e.autoSpaceLikeWord95)),e.noSpaceRaiseLower&&this.root.push(new me("w:noSpaceRaiseLower",e.noSpaceRaiseLower)),e.doNotUseHTMLParagraphAutoSpacing&&this.root.push(new me("w:doNotUseHTMLParagraphAutoSpacing",e.doNotUseHTMLParagraphAutoSpacing)),e.layoutRawTableWidth&&this.root.push(new me("w:layoutRawTableWidth",e.layoutRawTableWidth)),e.layoutTableRowsApart&&this.root.push(new me("w:layoutTableRowsApart",e.layoutTableRowsApart)),e.useWord97LineBreakRules&&this.root.push(new me("w:useWord97LineBreakRules",e.useWord97LineBreakRules)),e.doNotBreakWrappedTables&&this.root.push(new me("w:doNotBreakWrappedTables",e.doNotBreakWrappedTables)),e.doNotSnapToGridInCell&&this.root.push(new me("w:doNotSnapToGridInCell",e.doNotSnapToGridInCell)),e.selectFieldWithFirstOrLastCharacter&&this.root.push(new me("w:selectFldWithFirstOrLastChar",e.selectFieldWithFirstOrLastCharacter)),e.applyBreakingRules&&this.root.push(new me("w:applyBreakingRules",e.applyBreakingRules)),e.doNotWrapTextWithPunctuation&&this.root.push(new me("w:doNotWrapTextWithPunct",e.doNotWrapTextWithPunctuation)),e.doNotUseEastAsianBreakRules&&this.root.push(new me("w:doNotUseEastAsianBreakRules",e.doNotUseEastAsianBreakRules)),e.useWord2002TableStyleRules&&this.root.push(new me("w:useWord2002TableStyleRules",e.useWord2002TableStyleRules)),e.growAutofit&&this.root.push(new me("w:growAutofit",e.growAutofit)),e.useFELayout&&this.root.push(new me("w:useFELayout",e.useFELayout)),e.useNormalStyleForList&&this.root.push(new me("w:useNormalStyleForList",e.useNormalStyleForList)),e.doNotUseIndentAsNumberingTabStop&&this.root.push(new me("w:doNotUseIndentAsNumberingTabStop",e.doNotUseIndentAsNumberingTabStop)),e.useAlternateEastAsianLineBreakRules&&this.root.push(new me("w:useAltKinsokuLineBreakRules",e.useAlternateEastAsianLineBreakRules)),e.allowSpaceOfSameStyleInTable&&this.root.push(new me("w:allowSpaceOfSameStyleInTable",e.allowSpaceOfSameStyleInTable)),e.doNotSuppressIndentation&&this.root.push(new me("w:doNotSuppressIndentation",e.doNotSuppressIndentation)),e.doNotAutofitConstrainedTables&&this.root.push(new me("w:doNotAutofitConstrainedTables",e.doNotAutofitConstrainedTables)),e.autofitToFirstFixedWidthCell&&this.root.push(new me("w:autofitToFirstFixedWidthCell",e.autofitToFirstFixedWidthCell)),e.underlineTabInNumberingList&&this.root.push(new me("w:underlineTabInNumList",e.underlineTabInNumberingList)),e.displayHangulFixedWidth&&this.root.push(new me("w:displayHangulFixedWidth",e.displayHangulFixedWidth)),e.splitPgBreakAndParaMark&&this.root.push(new me("w:splitPgBreakAndParaMark",e.splitPgBreakAndParaMark)),e.doNotVerticallyAlignCellWithSp&&this.root.push(new me("w:doNotVertAlignCellWithSp",e.doNotVerticallyAlignCellWithSp)),e.doNotBreakConstrainedForcedTable&&this.root.push(new me("w:doNotBreakConstrainedForcedTable",e.doNotBreakConstrainedForcedTable)),e.ignoreVerticalAlignmentInTextboxes&&this.root.push(new me("w:doNotVertAlignInTxbx",e.ignoreVerticalAlignmentInTextboxes)),e.useAnsiKerningPairs&&this.root.push(new me("w:useAnsiKerningPairs",e.useAnsiKerningPairs)),e.cachedColumnBalance&&this.root.push(new me("w:cachedColBalance",e.cachedColumnBalance))}},lF=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},uF=class extends le{constructor(e){var t,r,n,i,o,s,a,u;super("w:settings"),this.root.push(new lF({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new me("w:displayBackgroundShape",!0)),e.trackRevisions!==void 0&&this.root.push(new me("w:trackRevisions",e.trackRevisions)),e.evenAndOddHeaders!==void 0&&this.root.push(new me("w:evenAndOddHeaders",e.evenAndOddHeaders)),e.updateFields!==void 0&&this.root.push(new me("w:updateFields",e.updateFields)),e.defaultTabStop!==void 0&&this.root.push(new Ss("w:defaultTabStop",e.defaultTabStop)),((t=e.hyphenation)===null||t===void 0?void 0:t.autoHyphenation)!==void 0&&this.root.push(new me("w:autoHyphenation",e.hyphenation.autoHyphenation)),((r=e.hyphenation)===null||r===void 0?void 0:r.hyphenationZone)!==void 0&&this.root.push(new Ss("w:hyphenationZone",e.hyphenation.hyphenationZone)),((n=e.hyphenation)===null||n===void 0?void 0:n.consecutiveHyphenLimit)!==void 0&&this.root.push(new Ss("w:consecutiveHyphenLimit",e.hyphenation.consecutiveHyphenLimit)),((i=e.hyphenation)===null||i===void 0?void 0:i.doNotHyphenateCaps)!==void 0&&this.root.push(new me("w:doNotHyphenateCaps",e.hyphenation.doNotHyphenateCaps)),this.root.push(new aF(be(be({},(o=e.compatibility)!==null&&o!==void 0?o:{}),{},{version:(s=(a=(u=e.compatibility)===null||u===void 0?void 0:u.version)!==null&&a!==void 0?a:e.compatibilityModeVersion)!==null&&s!==void 0?s:15})))}},OS=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{val:"w:val"})}},cF=class extends le{constructor(e){super("w:name"),this.root.push(new OS({val:e}))}},fF=class extends le{constructor(e){super("w:uiPriority"),this.root.push(new OS({val:lt(e)}))}},hF=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},RS=class extends le{constructor(e,t){super("w:style"),this.root.push(new hF(e)),t.name&&this.root.push(new cF(t.name)),t.basedOn&&this.root.push(new In("w:basedOn",t.basedOn)),t.next&&this.root.push(new In("w:next",t.next)),t.link&&this.root.push(new In("w:link",t.link)),t.uiPriority!==void 0&&this.root.push(new fF(t.uiPriority)),t.semiHidden!==void 0&&this.root.push(new me("w:semiHidden",t.semiHidden)),t.unhideWhenUsed!==void 0&&this.root.push(new me("w:unhideWhenUsed",t.unhideWhenUsed)),t.quickFormat!==void 0&&this.root.push(new me("w:qFormat",t.quickFormat))}},Is=class extends RS{constructor(e){super({type:"paragraph",styleId:e.id},e),ue(this,"paragraphProperties",void 0),ue(this,"runProperties",void 0),this.paragraphProperties=new Fn(e.paragraph),this.runProperties=new ln(e.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},ao=class extends RS{constructor(e){super({type:"character",styleId:e.id},be({uiPriority:99,unhideWhenUsed:!0},e)),ue(this,"runProperties",void 0),this.runProperties=new ln(e.run),this.root.push(this.runProperties)}},yi=class extends Is{constructor(e){super(be({basedOn:"Normal",next:"Normal",quickFormat:!0},e))}},dF=class extends yi{constructor(e){super(be({id:"Title",name:"Title"},e))}},pF=class extends yi{constructor(e){super(be({id:"Heading1",name:"Heading 1"},e))}},mF=class extends yi{constructor(e){super(be({id:"Heading2",name:"Heading 2"},e))}},gF=class extends yi{constructor(e){super(be({id:"Heading3",name:"Heading 3"},e))}},yF=class extends yi{constructor(e){super(be({id:"Heading4",name:"Heading 4"},e))}},vF=class extends yi{constructor(e){super(be({id:"Heading5",name:"Heading 5"},e))}},wF=class extends yi{constructor(e){super(be({id:"Heading6",name:"Heading 6"},e))}},bF=class extends yi{constructor(e){super(be({id:"Strong",name:"Strong"},e))}},_F=class extends Is{constructor(e){super(be({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},e))}},xF=class extends Is{constructor(e){super(be({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:so.AUTO}},run:{size:20}},e))}},EF=class extends ao{constructor(e){super(be({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},AF=class extends ao{constructor(e){super(be({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},e))}},SF=class extends Is{constructor(e){super(be({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:so.AUTO}},run:{size:20}},e))}},TF=class extends ao{constructor(e){super(be({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},CF=class extends ao{constructor(e){super(be({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},e))}},kF=class extends ao{constructor(e){super(be({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:ug.SINGLE}}},e))}},vf=class extends le{constructor(e){if(super("w:styles"),e.initialStyles&&this.root.push(e.initialStyles),e.importedStyles)for(let t of e.importedStyles)this.root.push(t);if(e.paragraphStyles)for(let t of e.paragraphStyles)this.root.push(new Is(t));if(e.characterStyles)for(let t of e.characterStyles)this.root.push(new ao(t))}},IS=class extends le{constructor(e){super("w:pPrDefault"),this.root.push(new Fn(e))}},FS=class extends le{constructor(e){super("w:rPrDefault"),this.root.push(new ln(e))}},MS=class extends le{constructor(e){super("w:docDefaults"),ue(this,"runPropertiesDefaults",void 0),ue(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new FS(e.run),this.paragraphPropertiesDefaults=new IS(e.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},DF=class{newInstance(e){let t=(0,Tf.xml2js)(e,{compact:!1}),r;for(let i of t.elements||[])i.name==="w:styles"&&(r=i);if(r===void 0)throw new Error("can not find styles element");let n=r.elements||[];return{initialStyles:new wE(r.attributes),importedStyles:n.map(i=>Cf(i))}}},Tm=class{newInstance(e={}){var t;return{initialStyles:new Ol(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:[new MS((t=e.document)!==null&&t!==void 0?t:{}),new dF(be({run:{size:56}},e.title)),new pF(be({run:{color:"2E74B5",size:32}},e.heading1)),new mF(be({run:{color:"2E74B5",size:26}},e.heading2)),new gF(be({run:{color:"1F4D78",size:24}},e.heading3)),new yF(be({run:{color:"2E74B5",italics:!0}},e.heading4)),new vF(be({run:{color:"2E74B5"}},e.heading5)),new wF(be({run:{color:"1F4D78"}},e.heading6)),new bF(be({run:{bold:!0}},e.strong)),new _F(e.listParagraph||{}),new kF(e.hyperlink||{}),new EF(e.footnoteReference||{}),new xF(e.footnoteText||{}),new AF(e.footnoteTextChar||{}),new TF(e.endnoteReference||{}),new SF(e.endnoteText||{}),new CF(e.endnoteTextChar||{})]}}},NF=class{constructor(e){var t,r,n,i,o,s,a,u,c,f,h,p;if(ue(this,"currentRelationshipId",1),ue(this,"documentWrapper",void 0),ue(this,"headers",[]),ue(this,"footers",[]),ue(this,"coreProperties",void 0),ue(this,"numbering",void 0),ue(this,"media",void 0),ue(this,"fileRelationships",void 0),ue(this,"footnotesWrapper",void 0),ue(this,"endnotesWrapper",void 0),ue(this,"settings",void 0),ue(this,"contentTypes",void 0),ue(this,"customProperties",void 0),ue(this,"appProperties",void 0),ue(this,"styles",void 0),ue(this,"comments",void 0),ue(this,"commentsExtended",void 0),ue(this,"fontWrapper",void 0),this.coreProperties=new u9(be(be({},e),{},{creator:(t=e.creator)!==null&&t!==void 0?t:"Un-named",revision:(r=e.revision)!==null&&r!==void 0?r:1,lastModifiedBy:(n=e.lastModifiedBy)!==null&&n!==void 0?n:"Un-named"})),this.numbering=new NS(e.numbering?e.numbering:{config:[]}),this.comments=new dA((i=e.comments)!==null&&i!==void 0?i:{children:[]}),this.comments.ThreadData&&(this.commentsExtended=new pA(this.comments.ThreadData)),this.fileRelationships=new gi,this.customProperties=new m9((o=e.customProperties)!==null&&o!==void 0?o:[]),this.appProperties=new s9,this.footnotesWrapper=new q9,this.endnotesWrapper=new F9,this.contentTypes=new l9,this.documentWrapper=new k9({background:e.background}),this.settings=new uF({compatibilityModeVersion:e.compatabilityModeVersion,compatibility:e.compatibility,evenAndOddHeaders:!!e.evenAndOddHeaderAndFooters,trackRevisions:(s=e.features)===null||s===void 0?void 0:s.trackRevisions,updateFields:(a=e.features)===null||a===void 0?void 0:a.updateFields,defaultTabStop:e.defaultTabStop,hyphenation:{autoHyphenation:(u=e.hyphenation)===null||u===void 0?void 0:u.autoHyphenation,hyphenationZone:(c=e.hyphenation)===null||c===void 0?void 0:c.hyphenationZone,consecutiveHyphenLimit:(f=e.hyphenation)===null||f===void 0?void 0:f.consecutiveHyphenLimit,doNotHyphenateCaps:(h=e.hyphenation)===null||h===void 0?void 0:h.doNotHyphenateCaps}}),this.media=new Eg,e.externalStyles!==void 0){var d;let m=new Tm().newInstance((d=e.styles)===null||d===void 0?void 0:d.default),g=new DF().newInstance(e.externalStyles);this.styles=new vf(be(be({},g),{},{importedStyles:[...m.importedStyles,...g.importedStyles]}))}else if(e.styles){let m=new Tm().newInstance(e.styles.default);this.styles=new vf(be(be({},m),e.styles))}else{let m=new Tm;this.styles=new vf(m.newInstance())}this.addDefaultRelationships();for(let m of e.sections)this.addSection(m);if(e.footnotes)for(let m in e.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(m),e.footnotes[m].children);if(e.endnotes)for(let m in e.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(m),e.endnotes[m].children);this.fontWrapper=new kA((p=e.fonts)!==null&&p!==void 0?p:[])}addSection({headers:e={},footers:t={},children:r,properties:n}){this.documentWrapper.View.Body.addSection(be(be({},n),{},{headerWrapperGroup:{default:e.default?this.createHeader(e.default):void 0,first:e.first?this.createHeader(e.first):void 0,even:e.even?this.createHeader(e.even):void 0},footerWrapperGroup:{default:t.default?this.createFooter(t.default):void 0,first:t.first?this.createFooter(t.first):void 0,even:t.even?this.createFooter(t.even):void 0}}));for(let i of r)this.documentWrapper.View.add(i)}createHeader(e){let t=new CS(this.media,this.currentRelationshipId++);for(let r of e.options.children)t.add(r);return this.addHeaderToDocument(t),t}createFooter(e){let t=new SS(this.media,this.currentRelationshipId++);for(let r of e.options.children)t.add(r);return this.addFooterToDocument(t),t}addHeaderToDocument(e,t=io.DEFAULT){this.headers.push({header:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(e,t=io.DEFAULT){this.footers.push({footer:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.commentsExtended&&(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended())}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map(e=>e.header)}get Footers(){return this.footers.map(e=>e.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get FontTable(){return this.fontWrapper}},OF=class extends le{constructor(e={}){super("w:instrText"),ue(this,"properties",void 0),this.properties=e,this.root.push(new yr({space:sr.PRESERVE}));let t="TOC";if(this.properties.captionLabel&&(t=`${t} \\a "${this.properties.captionLabel}"`),this.properties.entriesFromBookmark&&(t=`${t} \\b "${this.properties.entriesFromBookmark}"`),this.properties.captionLabelIncludingNumbers&&(t=`${t} \\c "${this.properties.captionLabelIncludingNumbers}"`),this.properties.sequenceAndPageNumbersSeparator&&(t=`${t} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`),this.properties.tcFieldIdentifier&&(t=`${t} \\f "${this.properties.tcFieldIdentifier}"`),this.properties.hyperlink&&(t=`${t} \\h`),this.properties.tcFieldLevelRange&&(t=`${t} \\l "${this.properties.tcFieldLevelRange}"`),this.properties.pageNumbersEntryLevelsRange&&(t=`${t} \\n "${this.properties.pageNumbersEntryLevelsRange}"`),this.properties.headingStyleRange&&(t=`${t} \\o "${this.properties.headingStyleRange}"`),this.properties.entryAndPageNumberSeparator&&(t=`${t} \\p "${this.properties.entryAndPageNumberSeparator}"`),this.properties.seqFieldIdentifierForPrefix&&(t=`${t} \\s "${this.properties.seqFieldIdentifierForPrefix}"`),this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let r=this.properties.stylesWithLevels.map(n=>`${n.styleName},${n.level}`).join(",");t=`${t} \\t "${r}"`}this.properties.useAppliedParagraphOutlineLevel&&(t=`${t} \\u`),this.properties.preserveTabInEntries&&(t=`${t} \\w`),this.properties.preserveNewLineInEntries&&(t=`${t} \\x`),this.properties.hideTabAndPageNumbersInWebView&&(t=`${t} \\z`),this.root.push(t)}},BS=class extends le{constructor(){super("w:sdtContent")}},LS=class extends le{constructor(e){super("w:sdtPr"),e&&this.root.push(new In("w:alias",e))}};function RF(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}function PS(e,t){if(e==null)return{};var r,n,i=RF(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n0){let{stylesWithLevels:c}=o,f=n.map((p,d)=>{var m,g;let y=this.buildCachedContentParagraphChild(p,o),w=(m=c==null||(g=c.find(b=>b.level===p.level))===null||g===void 0?void 0:g.styleName)!==null&&m!==void 0?m:`TOC${p.level}`,E=d===0?[...a,y]:d===n.length-1?[y,...u]:[y];return new Tr({style:w,tabStops:this.getTabStopsForLevel(p.level),children:E})}),h=f;n.length<=1&&(h=[...f,new Tr({children:u})]);for(let p of h)s.addChildElement(p)}else{let c=new Tr({children:a});s.addChildElement(c);for(let h of r)s.addChildElement(h);let f=new Tr({children:u});s.addChildElement(f)}this.root.push(s)}getTabStopsForLevel(e,t=9025){return[{type:"clear",position:t+1-(e-1)*240},{type:"right",position:t,leader:"dot"}]}buildCachedContentRun(e,t){var r,n;return new at({style:t?.hyperlink&&e.href!==void 0?"IndexLink":void 0,children:[new vl({text:e.title}),new gA,new vl({text:(r=(n=e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:""})]})}buildCachedContentParagraphChild(e,t){let r=this.buildCachedContentRun(e,t);return t?.hyperlink&&e.href!==void 0?new EA({anchor:e.href,children:[r]}):r}},MF=class{constructor(e,t){ue(this,"styleName",void 0),ue(this,"level",void 0),this.styleName=e,this.level=t}},BF=class{constructor(e={children:[]}){ue(this,"options",void 0),this.options=e}},LF=class{constructor(e={children:[]}){ue(this,"options",void 0),this.options=e}},zS=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"w:id"})}},US=class extends le{constructor(e){super("w:footnoteReference"),this.root.push(new zS({id:e}))}},PF=class extends at{constructor(e){super({style:"FootnoteReference"}),this.root.push(new US(e))}},qS=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{id:"w:id"})}},jS=class extends le{constructor(e){super("w:endnoteReference"),this.root.push(new qS({id:e}))}},zF=class extends at{constructor(e){super({style:"EndnoteReference"}),this.root.push(new jS(e))}},Ux=class extends Ee{constructor(...e){super(...e),ue(this,"xmlKeys",{val:"w14:val",symbolfont:"w14:font"})}},wf=class extends le{constructor(e,t,r){super(e),r?this.root.push(new Ux({val:bE(t),symbolfont:r})):this.root.push(new Ux({val:t}))}},HS=class extends le{constructor(e){var t,r,n,i,o,s,a,u;super("w14:checkbox"),ue(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),ue(this,"DEFAULT_CHECKED_SYMBOL","2612"),ue(this,"DEFAULT_FONT","MS Gothic");let c=e?.checked?"1":"0",f,h;this.root.push(new wf("w14:checked",c)),f=!(e==null||(t=e.checkedState)===null||t===void 0)&&t.value?e==null||(r=e.checkedState)===null||r===void 0?void 0:r.value:this.DEFAULT_CHECKED_SYMBOL,h=!(e==null||(n=e.checkedState)===null||n===void 0)&&n.font?e==null||(i=e.checkedState)===null||i===void 0?void 0:i.font:this.DEFAULT_FONT,this.root.push(new wf("w14:checkedState",f,h)),f=!(e==null||(o=e.uncheckedState)===null||o===void 0)&&o.value?e==null||(s=e.uncheckedState)===null||s===void 0?void 0:s.value:this.DEFAULT_UNCHECKED_SYMBOL,h=!(e==null||(a=e.uncheckedState)===null||a===void 0)&&a.font?e==null||(u=e.uncheckedState)===null||u===void 0?void 0:u.font:this.DEFAULT_FONT,this.root.push(new wf("w14:uncheckedState",f,h))}},UF=class extends le{constructor(e){var t,r,n,i;super("w:sdt"),ue(this,"DEFAULT_UNCHECKED_SYMBOL","2610"),ue(this,"DEFAULT_CHECKED_SYMBOL","2612"),ue(this,"DEFAULT_FONT","MS Gothic");let o=new LS(e?.alias);o.addChildElement(new HS(e)),this.root.push(o);let s=new BS,a=e==null||(t=e.checkedState)===null||t===void 0?void 0:t.font,u=e==null||(r=e.checkedState)===null||r===void 0?void 0:r.value,c=e==null||(n=e.uncheckedState)===null||n===void 0?void 0:n.font,f=e==null||(i=e.uncheckedState)===null||i===void 0?void 0:i.value,h,p;e?.checked?(h=a||this.DEFAULT_FONT,p=u||this.DEFAULT_CHECKED_SYMBOL):(h=c||this.DEFAULT_FONT,p=f||this.DEFAULT_UNCHECKED_SYMBOL);let d=new FE({char:p,symbolfont:h});s.addChildElement(d),this.root.push(s)}},qF=({shape:e})=>new ve({name:"w:pict",children:[e]}),jF=({children:e=[]})=>new ve({name:"w:txbxContent",children:e}),HF=({style:e,children:t,inset:r})=>new ve({name:"v:textbox",attributes:{style:{key:"style",value:e},insetMode:{key:"insetmode",value:r?"custom":"auto"},inset:{key:"inset",value:r?`${r.left}, ${r.top}, ${r.right}, ${r.bottom}`:void 0}},children:[jF({children:t})]}),WF="#_x0000_t202",VF={flip:"flip",height:"height",left:"left",marginBottom:"margin-bottom",marginLeft:"margin-left",marginRight:"margin-right",marginTop:"margin-top",positionHorizontal:"mso-position-horizontal",positionHorizontalRelative:"mso-position-horizontal-relative",positionVertical:"mso-position-vertical",positionVerticalRelative:"mso-position-vertical-relative",wrapDistanceBottom:"mso-wrap-distance-bottom",wrapDistanceLeft:"mso-wrap-distance-left",wrapDistanceRight:"mso-wrap-distance-right",wrapDistanceTop:"mso-wrap-distance-top",wrapEdited:"mso-wrap-edited",wrapStyle:"mso-wrap-style",position:"position",rotation:"rotation",top:"top",visibility:"visibility",width:"width",zIndex:"z-index"},GF=e=>e?Object.entries(e).map(([t,r])=>`${VF[t]}:${r}`).join(";"):void 0,KF=({id:e,children:t,type:r=WF,style:n})=>new ve({name:"v:shape",attributes:{id:{key:"id",value:e},type:{key:"type",value:r},style:{key:"style",value:GF(n)}},children:[HF({style:"mso-fit-shape-to-text:t;",children:t})]}),$F=["style","children"],XF=class extends Nl{constructor(e){let{style:t,children:r}=e,n=PS(e,$F);super("w:p"),this.root.push(new Fn(n)),this.root.push(qF({shape:KF({children:r,id:Dl(),style:t})}))}},ZF=we(((e,t)=>{ks(),mi();(function(r){typeof e=="object"&&typeof t<"u"?t.exports=r():typeof define=="function"&&define.amd?define([],r):(typeof window<"u"?window:typeof Vt<"u"?Vt:typeof self<"u"?self:this).JSZip=r()})(function(){return(function r(n,i,o){function s(c,f){if(!i[c]){if(!n[c]){var h=typeof ff=="function"&&ff;if(!f&&h)return h(c,!0);if(a)return a(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var d=i[c]={exports:{}};n[c][0].call(d.exports,function(m){var g=n[c][1][m];return s(g||m)},d,d.exports,r,n,i,o)}return i[c].exports}for(var a=typeof ff=="function"&&ff,u=0;u>2,d=(3&c)<<4|f>>4,m=1>6:64,g=2>4,f=(15&p)<<4|(d=a.indexOf(u.charAt(g++)))>>2,h=(3&d)<<6|(m=a.indexOf(u.charAt(g++))),E[y++]=c,d!==64&&(E[y++]=f),m!==64&&(E[y++]=h);return E}},{"./support":30,"./utils":32}],2:[function(r,n,i){"use strict";var o=r("./external"),s=r("./stream/DataWorker"),a=r("./stream/Crc32Probe"),u=r("./stream/DataLengthProbe");function c(f,h,p,d,m){this.compressedSize=f,this.uncompressedSize=h,this.crc32=p,this.compression=d,this.compressedContent=m}c.prototype={getContentWorker:function(){var f=new s(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),h=this;return f.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),f},getCompressedWorker:function(){return new s(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(f,h,p){return f.pipe(new a).pipe(new u("uncompressedSize")).pipe(h.compressWorker(p)).pipe(new u("compressedSize")).withStreamInfo("compression",h)},n.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(r,n,i){"use strict";var o=r("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},i.DEFLATE=r("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(r,n,i){"use strict";var o=r("./utils"),s=(function(){for(var a,u=[],c=0;c<256;c++){a=c;for(var f=0;f<8;f++)a=1&a?3988292384^a>>>1:a>>>1;u[c]=a}return u})();n.exports=function(a,u){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?(function(c,f,h,p){var d=s,m=p+h;c^=-1;for(var g=p;g>>8^d[255&(c^f[g])];return-1^c})(0|u,a,a.length,0):(function(c,f,h,p){var d=s,m=p+h;c^=-1;for(var g=p;g>>8^d[255&(c^f.charCodeAt(g))];return-1^c})(0|u,a,a.length,0):0}},{"./utils":32}],5:[function(r,n,i){"use strict";i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(r,n,i){"use strict";var o=null;o=typeof Promise<"u"?Promise:r("lie"),n.exports={Promise:o}},{lie:37}],7:[function(r,n,i){"use strict";var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=r("pako"),a=r("./utils"),u=r("./stream/GenericWorker"),c=o?"uint8array":"array";function f(h,p){u.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=p,this.meta={}}i.magic="\b\0",a.inherits(f,u),f.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,h.data),!1)},f.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},f.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},f.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(p){h.push({data:p,meta:h.meta})}},i.compressWorker=function(h){return new f("Deflate",h)},i.uncompressWorker=function(){return new f("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(r,n,i){"use strict";function o(d,m){var g,y="";for(g=0;g>>=8;return y}function s(d,m,g,y,w,E){var b,C,S=d.file,A=d.compression,k=E!==c.utf8encode,B=a.transformTo("string",E(S.name)),O=a.transformTo("string",c.utf8encode(S.name)),P=S.comment,Y=a.transformTo("string",E(P)),_=a.transformTo("string",c.utf8encode(P)),W=O.length!==S.name.length,F=_.length!==P.length,J="",j="",H="",$=S.dir,z=S.date,G={crc32:0,compressedSize:0,uncompressedSize:0};m&&!g||(G.crc32=d.crc32,G.compressedSize=d.compressedSize,G.uncompressedSize=d.uncompressedSize);var X=0;m&&(X|=8),k||!W&&!F||(X|=2048);var q=0,Q=0;$&&(q|=16),w==="UNIX"?(Q=798,q|=(function(ae,he){var L=ae;return ae||(L=he?16893:33204),(65535&L)<<16})(S.unixPermissions,$)):(Q=20,q|=(function(ae){return 63&(ae||0)})(S.dosPermissions)),b=z.getUTCHours(),b<<=6,b|=z.getUTCMinutes(),b<<=5,b|=z.getUTCSeconds()/2,C=z.getUTCFullYear()-1980,C<<=4,C|=z.getUTCMonth()+1,C<<=5,C|=z.getUTCDate(),W&&(j=o(1,1)+o(f(B),4)+O,J+="up"+o(j.length,2)+j),F&&(H=o(1,1)+o(f(Y),4)+_,J+="uc"+o(H.length,2)+H);var oe="";return oe+=` +\0`,oe+=o(X,2),oe+=A.magic,oe+=o(b,2),oe+=o(C,2),oe+=o(G.crc32,4),oe+=o(G.compressedSize,4),oe+=o(G.uncompressedSize,4),oe+=o(B.length,2),oe+=o(J.length,2),{fileRecord:h.LOCAL_FILE_HEADER+oe+B+J,dirRecord:h.CENTRAL_FILE_HEADER+o(Q,2)+oe+o(Y.length,2)+"\0\0\0\0"+o(q,4)+o(y,4)+B+J+Y}}var a=r("../utils"),u=r("../stream/GenericWorker"),c=r("../utf8"),f=r("../crc32"),h=r("../signature");function p(d,m,g,y){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=g,this.encodeFileName=y,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,u),p.prototype.push=function(d){var m=d.meta.percent||0,g=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,u.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:g?(m+100*(g-y-1))/g:100}}))},p.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var m=this.streamFiles&&!d.file.dir;if(m){var g=s(d,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(d){this.accumulate=!1;var m=this.streamFiles&&!d.file.dir,g=s(d,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),m)this.push({data:(function(y){return h.DATA_DESCRIPTOR+o(y.crc32,4)+o(y.compressedSize,4)+o(y.uncompressedSize,4)})(d),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var d=this.bytesWritten,m=0;m=this.index;u--)c=(c<<8)+this.byteAt(u);return this.index+=a,c},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=s},{"../utils":32}],19:[function(r,n,i){"use strict";var o=r("./Uint8ArrayReader");function s(a){o.call(this,a)}r("../utils").inherits(s,o),s.prototype.readData=function(a){this.checkOffset(a);var u=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,u},n.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(r,n,i){"use strict";var o=r("./DataReader");function s(a){o.call(this,a)}r("../utils").inherits(s,o),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var u=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,u},n.exports=s},{"../utils":32,"./DataReader":18}],21:[function(r,n,i){"use strict";var o=r("./ArrayReader");function s(a){o.call(this,a)}r("../utils").inherits(s,o),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,u},n.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(r,n,i){"use strict";var o=r("../utils"),s=r("../support"),a=r("./ArrayReader"),u=r("./StringReader"),c=r("./NodeBufferReader"),f=r("./Uint8ArrayReader");n.exports=function(h){var p=o.getTypeOf(h);return o.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new c(h):s.uint8array?new f(o.transformTo("uint8array",h)):new a(o.transformTo("array",h)):new u(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(r,n,i){"use strict";i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(r,n,i){"use strict";var o=r("./GenericWorker"),s=r("../utils");function a(u){o.call(this,"ConvertWorker to "+u),this.destType=u}s.inherits(a,o),a.prototype.processChunk=function(u){this.push({data:s.transformTo(this.destType,u.data),meta:u.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(r,n,i){"use strict";var o=r("./GenericWorker"),s=r("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}r("../utils").inherits(a,o),a.prototype.processChunk=function(u){this.streamInfo.crc32=s(u.data,this.streamInfo.crc32||0),this.push(u)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(r,n,i){"use strict";var o=r("../utils"),s=r("./GenericWorker");function a(u){s.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}o.inherits(a,s),a.prototype.processChunk=function(u){if(u){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+u.data.length}s.prototype.processChunk.call(this,u)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(r,n,i){"use strict";var o=r("../utils"),s=r("./GenericWorker");function a(u){s.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(f){c.dataIsReady=!0,c.data=f,c.max=f&&f.length||0,c.type=o.getTypeOf(f),c.isPaused||c._tickAndRepeat()},function(f){c.error(f)})}o.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,c);break;case"uint8array":u=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":u=this.data.slice(this.index,c)}return this.index=c,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(r,n,i){"use strict";function o(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var u=0;u "+s:s}},n.exports=o},{}],29:[function(r,n,i){"use strict";var o=r("../utils"),s=r("./ConvertWorker"),a=r("./GenericWorker"),u=r("../base64"),c=r("../support"),f=r("../external"),h=null;if(c.nodestream)try{h=r("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,g){return new f.Promise(function(y,w){var E=[],b=m._internalType,C=m._outputType,S=m._mimeType;m.on("data",function(A,k){E.push(A),g&&g(k)}).on("error",function(A){E=[],w(A)}).on("end",function(){try{y((function(A,k,B){switch(A){case"blob":return o.newBlob(o.transformTo("arraybuffer",k),B);case"base64":return u.encode(k);default:return o.transformTo(A,k)}})(C,(function(A,k){var B,O=0,P=null,Y=0;for(B=0;B"u")i.blob=!1;else{var o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(o),i.blob=s.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!r("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(r,n,i){"use strict";for(var o=r("./utils"),s=r("./support"),a=r("./nodejsUtils"),u=r("./stream/GenericWorker"),c=new Array(256),f=0;f<256;f++)c[f]=252<=f?6:248<=f?5:240<=f?4:224<=f?3:192<=f?2:1;c[254]=c[254]=1;function h(){u.call(this,"utf-8 decode"),this.leftOver=null}function p(){u.call(this,"utf-8 encode")}i.utf8encode=function(d){return s.nodebuffer?a.newBufferFrom(d,"utf-8"):(function(m){var g,y,w,E,b,C=m.length,S=0;for(E=0;E>>6:(y<65536?g[b++]=224|y>>>12:(g[b++]=240|y>>>18,g[b++]=128|y>>>12&63),g[b++]=128|y>>>6&63),g[b++]=128|63&y);return g})(d)},i.utf8decode=function(d){return s.nodebuffer?o.transformTo("nodebuffer",d).toString("utf-8"):(function(m){var g,y,w,E,b=m.length,C=new Array(2*b);for(g=y=0;g>10&1023,C[y++]=56320|1023&w)}return C.length!==y&&(C.subarray?C=C.subarray(0,y):C.length=y),o.applyFromCharCode(C)})(d=o.transformTo(s.uint8array?"uint8array":"array",d))},o.inherits(h,u),h.prototype.processChunk=function(d){var m=o.transformTo(s.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var g=m;(m=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),m.set(g,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var y=(function(E,b){var C;for((b=b||E.length)>E.length&&(b=E.length),C=b-1;0<=C&&(192&E[C])==128;)C--;return C<0||C===0?b:C+c[E[C]]>b?C:b})(m),w=m;y!==m.length&&(s.uint8array?(w=m.subarray(0,y),this.leftOver=m.subarray(y,m.length)):(w=m.slice(0,y),this.leftOver=m.slice(y,m.length))),this.push({data:i.utf8decode(w),meta:d.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=h,o.inherits(p,u),p.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(r,n,i){"use strict";var o=r("./support"),s=r("./base64"),a=r("./nodejsUtils"),u=r("./external");function c(g){return g}function f(g,y){for(var w=0;w>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=o(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var m,g,y,w=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4>>6:(d<65536?p[y++]=224|d>>>12:(p[y++]=240|d>>>18,p[y++]=128|d>>>12&63),p[y++]=128|d>>>6&63),p[y++]=128|63&d);return p},i.buf2binstring=function(h){return f(h,h.length)},i.binstring2buf=function(h){for(var p=new o.Buf8(h.length),d=0,m=p.length;d>10&1023,E[m++]=56320|1023&g)}return f(E,m)},i.utf8border=function(h,p){var d;for((p=p||h.length)>h.length&&(p=h.length),d=p-1;0<=d&&(192&h[d])==128;)d--;return d<0||d===0?p:d+u[h[d]]>p?d:p}},{"./common":41}],43:[function(r,n,i){"use strict";n.exports=function(o,s,a,u){for(var c=65535&o|0,f=o>>>16&65535|0,h=0;a!==0;){for(a-=h=2e3>>1:s>>>1;a[u]=s}return a})();n.exports=function(s,a,u,c){var f=o,h=c+u;s^=-1;for(var p=c;p>>8^f[255&(s^a[p])];return-1^s}},{}],46:[function(r,n,i){"use strict";var o,s=r("../utils/common"),a=r("./trees"),u=r("./adler32"),c=r("./crc32"),f=r("./messages"),h=0,p=4,d=0,m=-2,g=-1,y=4,w=2,E=8,b=9,C=286,S=30,A=19,k=2*C+1,B=15,O=3,P=258,Y=P+O+1,_=42,W=113,F=1,J=2,j=3,H=4;function $(N,I){return N.msg=f[I],I}function z(N){return(N<<1)-(4N.avail_out&&(T=N.avail_out),T!==0&&(s.arraySet(N.output,I.pending_buf,I.pending_out,T,N.next_out),N.next_out+=T,I.pending_out+=T,N.total_out+=T,N.avail_out-=T,I.pending-=T,I.pending===0&&(I.pending_out=0))}function q(N,I){a._tr_flush_block(N,0<=N.block_start?N.block_start:-1,N.strstart-N.block_start,I),N.block_start=N.strstart,X(N.strm)}function Q(N,I){N.pending_buf[N.pending++]=I}function oe(N,I){N.pending_buf[N.pending++]=I>>>8&255,N.pending_buf[N.pending++]=255&I}function ae(N,I){var T,v,x=N.max_chain_length,R=N.strstart,U=N.prev_length,ee=N.nice_match,Z=N.strstart>N.w_size-Y?N.strstart-(N.w_size-Y):0,K=N.window,te=N.w_mask,ie=N.prev,se=N.strstart+P,de=K[R+U-1],xe=K[R+U];N.prev_length>=N.good_match&&(x>>=2),ee>N.lookahead&&(ee=N.lookahead);do if(K[(T=I)+U]===xe&&K[T+U-1]===de&&K[T]===K[R]&&K[++T]===K[R+1]){R+=2,T++;do;while(K[++R]===K[++T]&&K[++R]===K[++T]&&K[++R]===K[++T]&&K[++R]===K[++T]&&K[++R]===K[++T]&&K[++R]===K[++T]&&K[++R]===K[++T]&&K[++R]===K[++T]&&RZ&&--x!=0);return U<=N.lookahead?U:N.lookahead}function he(N){var I,T,v,x,R,U,ee,Z,K,te,ie=N.w_size;do{if(x=N.window_size-N.lookahead-N.strstart,N.strstart>=ie+(ie-Y)){for(s.arraySet(N.window,N.window,ie,ie,0),N.match_start-=ie,N.strstart-=ie,N.block_start-=ie,I=T=N.hash_size;v=N.head[--I],N.head[I]=ie<=v?v-ie:0,--T;);for(I=T=ie;v=N.prev[--I],N.prev[I]=ie<=v?v-ie:0,--T;);x+=ie}if(N.strm.avail_in===0)break;if(U=N.strm,ee=N.window,Z=N.strstart+N.lookahead,K=x,te=void 0,te=U.avail_in,K=O)for(R=N.strstart-N.insert,N.ins_h=N.window[R],N.ins_h=(N.ins_h<=O&&(N.ins_h=(N.ins_h<=O)if(v=a._tr_tally(N,N.strstart-N.match_start,N.match_length-O),N.lookahead-=N.match_length,N.match_length<=N.max_lazy_match&&N.lookahead>=O){for(N.match_length--;N.strstart++,N.ins_h=(N.ins_h<=O&&(N.ins_h=(N.ins_h<=O&&N.match_length<=N.prev_length){for(x=N.strstart+N.lookahead-O,v=a._tr_tally(N,N.strstart-1-N.prev_match,N.prev_length-O),N.lookahead-=N.prev_length-1,N.prev_length-=2;++N.strstart<=x&&(N.ins_h=(N.ins_h<N.pending_buf_size-5&&(T=N.pending_buf_size-5);;){if(N.lookahead<=1){if(he(N),N.lookahead===0&&I===h)return F;if(N.lookahead===0)break}N.strstart+=N.lookahead,N.lookahead=0;var v=N.block_start+T;if((N.strstart===0||N.strstart>=v)&&(N.lookahead=N.strstart-v,N.strstart=v,q(N,!1),N.strm.avail_out===0)||N.strstart-N.block_start>=N.w_size-Y&&(q(N,!1),N.strm.avail_out===0))return F}return N.insert=0,I===p?(q(N,!0),N.strm.avail_out===0?j:H):(N.strstart>N.block_start&&(q(N,!1),N.strm.avail_out),F)}),new re(4,4,8,4,L),new re(4,5,16,8,L),new re(4,6,32,32,L),new re(4,4,16,16,M),new re(8,16,32,32,M),new re(8,16,128,128,M),new re(8,32,128,256,M),new re(32,128,258,1024,M),new re(32,258,258,4096,M)],i.deflateInit=function(N,I){return V(N,I,E,15,8,0)},i.deflateInit2=V,i.deflateReset=D,i.deflateResetKeep=fe,i.deflateSetHeader=function(N,I){return N&&N.state?N.state.wrap!==2?m:(N.state.gzhead=I,d):m},i.deflate=function(N,I){var T,v,x,R;if(!N||!N.state||5>8&255),Q(v,v.gzhead.time>>16&255),Q(v,v.gzhead.time>>24&255),Q(v,v.level===9?2:2<=v.strategy||v.level<2?4:0),Q(v,255&v.gzhead.os),v.gzhead.extra&&v.gzhead.extra.length&&(Q(v,255&v.gzhead.extra.length),Q(v,v.gzhead.extra.length>>8&255)),v.gzhead.hcrc&&(N.adler=c(N.adler,v.pending_buf,v.pending,0)),v.gzindex=0,v.status=69):(Q(v,0),Q(v,0),Q(v,0),Q(v,0),Q(v,0),Q(v,v.level===9?2:2<=v.strategy||v.level<2?4:0),Q(v,3),v.status=W);else{var U=E+(v.w_bits-8<<4)<<8;U|=(2<=v.strategy||v.level<2?0:v.level<6?1:v.level===6?2:3)<<6,v.strstart!==0&&(U|=32),U+=31-U%31,v.status=W,oe(v,U),v.strstart!==0&&(oe(v,N.adler>>>16),oe(v,65535&N.adler)),N.adler=1}if(v.status===69)if(v.gzhead.extra){for(x=v.pending;v.gzindex<(65535&v.gzhead.extra.length)&&(v.pending!==v.pending_buf_size||(v.gzhead.hcrc&&v.pending>x&&(N.adler=c(N.adler,v.pending_buf,v.pending-x,x)),X(N),x=v.pending,v.pending!==v.pending_buf_size));)Q(v,255&v.gzhead.extra[v.gzindex]),v.gzindex++;v.gzhead.hcrc&&v.pending>x&&(N.adler=c(N.adler,v.pending_buf,v.pending-x,x)),v.gzindex===v.gzhead.extra.length&&(v.gzindex=0,v.status=73)}else v.status=73;if(v.status===73)if(v.gzhead.name){x=v.pending;do{if(v.pending===v.pending_buf_size&&(v.gzhead.hcrc&&v.pending>x&&(N.adler=c(N.adler,v.pending_buf,v.pending-x,x)),X(N),x=v.pending,v.pending===v.pending_buf_size)){R=1;break}R=v.gzindexx&&(N.adler=c(N.adler,v.pending_buf,v.pending-x,x)),R===0&&(v.gzindex=0,v.status=91)}else v.status=91;if(v.status===91)if(v.gzhead.comment){x=v.pending;do{if(v.pending===v.pending_buf_size&&(v.gzhead.hcrc&&v.pending>x&&(N.adler=c(N.adler,v.pending_buf,v.pending-x,x)),X(N),x=v.pending,v.pending===v.pending_buf_size)){R=1;break}R=v.gzindexx&&(N.adler=c(N.adler,v.pending_buf,v.pending-x,x)),R===0&&(v.status=103)}else v.status=103;if(v.status===103&&(v.gzhead.hcrc?(v.pending+2>v.pending_buf_size&&X(N),v.pending+2<=v.pending_buf_size&&(Q(v,255&N.adler),Q(v,N.adler>>8&255),N.adler=0,v.status=W)):v.status=W),v.pending!==0){if(X(N),N.avail_out===0)return v.last_flush=-1,d}else if(N.avail_in===0&&z(I)<=z(T)&&I!==p)return $(N,-5);if(v.status===666&&N.avail_in!==0)return $(N,-5);if(N.avail_in!==0||v.lookahead!==0||I!==h&&v.status!==666){var ee=v.strategy===2?(function(Z,K){for(var te;;){if(Z.lookahead===0&&(he(Z),Z.lookahead===0)){if(K===h)return F;break}if(Z.match_length=0,te=a._tr_tally(Z,0,Z.window[Z.strstart]),Z.lookahead--,Z.strstart++,te&&(q(Z,!1),Z.strm.avail_out===0))return F}return Z.insert=0,K===p?(q(Z,!0),Z.strm.avail_out===0?j:H):Z.last_lit&&(q(Z,!1),Z.strm.avail_out===0)?F:J})(v,I):v.strategy===3?(function(Z,K){for(var te,ie,se,de,xe=Z.window;;){if(Z.lookahead<=P){if(he(Z),Z.lookahead<=P&&K===h)return F;if(Z.lookahead===0)break}if(Z.match_length=0,Z.lookahead>=O&&0Z.lookahead&&(Z.match_length=Z.lookahead)}if(Z.match_length>=O?(te=a._tr_tally(Z,1,Z.match_length-O),Z.lookahead-=Z.match_length,Z.strstart+=Z.match_length,Z.match_length=0):(te=a._tr_tally(Z,0,Z.window[Z.strstart]),Z.lookahead--,Z.strstart++),te&&(q(Z,!1),Z.strm.avail_out===0))return F}return Z.insert=0,K===p?(q(Z,!0),Z.strm.avail_out===0?j:H):Z.last_lit&&(q(Z,!1),Z.strm.avail_out===0)?F:J})(v,I):o[v.level].func(v,I);if(ee!==j&&ee!==H||(v.status=666),ee===F||ee===j)return N.avail_out===0&&(v.last_flush=-1),d;if(ee===J&&(I===1?a._tr_align(v):I!==5&&(a._tr_stored_block(v,0,0,!1),I===3&&(G(v.head),v.lookahead===0&&(v.strstart=0,v.block_start=0,v.insert=0))),X(N),N.avail_out===0))return v.last_flush=-1,d}return I!==p?d:v.wrap<=0?1:(v.wrap===2?(Q(v,255&N.adler),Q(v,N.adler>>8&255),Q(v,N.adler>>16&255),Q(v,N.adler>>24&255),Q(v,255&N.total_in),Q(v,N.total_in>>8&255),Q(v,N.total_in>>16&255),Q(v,N.total_in>>24&255)):(oe(v,N.adler>>>16),oe(v,65535&N.adler)),X(N),0=T.w_size&&(R===0&&(G(T.head),T.strstart=0,T.block_start=0,T.insert=0),K=new s.Buf8(T.w_size),s.arraySet(K,I,te-T.w_size,T.w_size,0),I=K,te=T.w_size),U=N.avail_in,ee=N.next_in,Z=N.input,N.avail_in=te,N.next_in=0,N.input=I,he(T);T.lookahead>=O;){for(v=T.strstart,x=T.lookahead-(O-1);T.ins_h=(T.ins_h<>>=O=B>>>24,b-=O,(O=B>>>16&255)===0)J[f++]=65535&B;else{if(!(16&O)){if((64&O)==0){B=C[(65535&B)+(E&(1<>>=O,b-=O),b<15&&(E+=F[u++]<>>=O=B>>>24,b-=O,!(16&(O=B>>>16&255))){if((64&O)==0){B=S[(65535&B)+(E&(1<>>=O,b-=O,(O=f-h)>3,E&=(1<<(b-=P<<3))-1,o.next_in=u,o.next_out=f,o.avail_in=u>>24&255)+(_>>>8&65280)+((65280&_)<<8)+((255&_)<<24)}function E(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(_){var W;return _&&_.state?(W=_.state,_.total_in=_.total_out=W.total=0,_.msg="",W.wrap&&(_.adler=1&W.wrap),W.mode=m,W.last=0,W.havedict=0,W.dmax=32768,W.head=null,W.hold=0,W.bits=0,W.lencode=W.lendyn=new o.Buf32(g),W.distcode=W.distdyn=new o.Buf32(y),W.sane=1,W.back=-1,p):d}function C(_){var W;return _&&_.state?((W=_.state).wsize=0,W.whave=0,W.wnext=0,b(_)):d}function S(_,W){var F,J;return _&&_.state?(J=_.state,W<0?(F=0,W=-W):(F=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15=H.wsize?(o.arraySet(H.window,W,F-H.wsize,H.wsize,0),H.wnext=0,H.whave=H.wsize):(J<(j=H.wsize-H.wnext)&&(j=J),o.arraySet(H.window,W,F-J,j,H.wnext),(J-=j)?(o.arraySet(H.window,W,F-J,J,0),H.wnext=J,H.whave=H.wsize):(H.wnext+=j,H.wnext===H.wsize&&(H.wnext=0),H.whave>>8&255,F.check=a(F.check,R,2,0),q=X=0,F.mode=2;break}if(F.flags=0,F.head&&(F.head.done=!1),!(1&F.wrap)||(((255&X)<<8)+(X>>8))%31){_.msg="incorrect header check",F.mode=30;break}if((15&X)!=8){_.msg="unknown compression method",F.mode=30;break}if(q-=4,N=8+(15&(X>>>=4)),F.wbits===0)F.wbits=N;else if(N>F.wbits){_.msg="invalid window size",F.mode=30;break}F.dmax=1<>8&1),512&F.flags&&(R[0]=255&X,R[1]=X>>>8&255,F.check=a(F.check,R,2,0)),q=X=0,F.mode=3;case 3:for(;q<32;){if(z===0)break e;z--,X+=J[H++]<>>8&255,R[2]=X>>>16&255,R[3]=X>>>24&255,F.check=a(F.check,R,4,0)),q=X=0,F.mode=4;case 4:for(;q<16;){if(z===0)break e;z--,X+=J[H++]<>8),512&F.flags&&(R[0]=255&X,R[1]=X>>>8&255,F.check=a(F.check,R,2,0)),q=X=0,F.mode=5;case 5:if(1024&F.flags){for(;q<16;){if(z===0)break e;z--,X+=J[H++]<>>8&255,F.check=a(F.check,R,2,0)),q=X=0}else F.head&&(F.head.extra=null);F.mode=6;case 6:if(1024&F.flags&&(z<(ae=F.length)&&(ae=z),ae&&(F.head&&(N=F.head.extra_len-F.length,F.head.extra||(F.head.extra=new Array(F.head.extra_len)),o.arraySet(F.head.extra,J,H,ae,N)),512&F.flags&&(F.check=a(F.check,J,ae,H)),z-=ae,H+=ae,F.length-=ae),F.length))break e;F.length=0,F.mode=7;case 7:if(2048&F.flags){if(z===0)break e;for(ae=0;N=J[H+ae++],F.head&&N&&F.length<65536&&(F.head.name+=String.fromCharCode(N)),N&&ae>9&1,F.head.done=!0),_.adler=F.check=0,F.mode=12;break;case 10:for(;q<32;){if(z===0)break e;z--,X+=J[H++]<>>=7&q,q-=7&q,F.mode=27;break}for(;q<3;){if(z===0)break e;z--,X+=J[H++]<>>=1)){case 0:F.mode=14;break;case 1:if(P(F),F.mode=20,W!==6)break;X>>>=2,q-=2;break e;case 2:F.mode=17;break;case 3:_.msg="invalid block type",F.mode=30}X>>>=2,q-=2;break;case 14:for(X>>>=7&q,q-=7&q;q<32;){if(z===0)break e;z--,X+=J[H++]<>>16^65535)){_.msg="invalid stored block lengths",F.mode=30;break}if(F.length=65535&X,q=X=0,F.mode=15,W===6)break e;case 15:F.mode=16;case 16:if(ae=F.length){if(z>>=5,q-=5,F.ndist=1+(31&X),X>>>=5,q-=5,F.ncode=4+(15&X),X>>>=4,q-=4,286>>=3,q-=3}for(;F.have<19;)F.lens[U[F.have++]]=0;if(F.lencode=F.lendyn,F.lenbits=7,T={bits:F.lenbits},I=c(0,F.lens,0,19,F.lencode,0,F.work,T),F.lenbits=T.bits,I){_.msg="invalid code lengths set",F.mode=30;break}F.have=0,F.mode=19;case 19:for(;F.have>>16&255,ne=65535&x,!((M=x>>>24)<=q);){if(z===0)break e;z--,X+=J[H++]<>>=M,q-=M,F.lens[F.have++]=ne;else{if(ne===16){for(v=M+2;q>>=M,q-=M,F.have===0){_.msg="invalid bit length repeat",F.mode=30;break}N=F.lens[F.have-1],ae=3+(3&X),X>>>=2,q-=2}else if(ne===17){for(v=M+3;q>>=M)),X>>>=3,q-=3}else{for(v=M+7;q>>=M)),X>>>=7,q-=7}if(F.have+ae>F.nlen+F.ndist){_.msg="invalid bit length repeat",F.mode=30;break}for(;ae--;)F.lens[F.have++]=N}}if(F.mode===30)break;if(F.lens[256]===0){_.msg="invalid code -- missing end-of-block",F.mode=30;break}if(F.lenbits=9,T={bits:F.lenbits},I=c(f,F.lens,0,F.nlen,F.lencode,0,F.work,T),F.lenbits=T.bits,I){_.msg="invalid literal/lengths set",F.mode=30;break}if(F.distbits=6,F.distcode=F.distdyn,T={bits:F.distbits},I=c(h,F.lens,F.nlen,F.ndist,F.distcode,0,F.work,T),F.distbits=T.bits,I){_.msg="invalid distances set",F.mode=30;break}if(F.mode=20,W===6)break e;case 20:F.mode=21;case 21:if(6<=z&&258<=G){_.next_out=$,_.avail_out=G,_.next_in=H,_.avail_in=z,F.hold=X,F.bits=q,u(_,oe),$=_.next_out,j=_.output,G=_.avail_out,H=_.next_in,J=_.input,z=_.avail_in,X=F.hold,q=F.bits,F.mode===12&&(F.back=-1);break}for(F.back=0;re=(x=F.lencode[X&(1<>>16&255,ne=65535&x,!((M=x>>>24)<=q);){if(z===0)break e;z--,X+=J[H++]<>fe)])>>>16&255,ne=65535&x,!(fe+(M=x>>>24)<=q);){if(z===0)break e;z--,X+=J[H++]<>>=fe,q-=fe,F.back+=fe}if(X>>>=M,q-=M,F.back+=M,F.length=ne,re===0){F.mode=26;break}if(32&re){F.back=-1,F.mode=12;break}if(64&re){_.msg="invalid literal/length code",F.mode=30;break}F.extra=15&re,F.mode=22;case 22:if(F.extra){for(v=F.extra;q>>=F.extra,q-=F.extra,F.back+=F.extra}F.was=F.length,F.mode=23;case 23:for(;re=(x=F.distcode[X&(1<>>16&255,ne=65535&x,!((M=x>>>24)<=q);){if(z===0)break e;z--,X+=J[H++]<>fe)])>>>16&255,ne=65535&x,!(fe+(M=x>>>24)<=q);){if(z===0)break e;z--,X+=J[H++]<>>=fe,q-=fe,F.back+=fe}if(X>>>=M,q-=M,F.back+=M,64&re){_.msg="invalid distance code",F.mode=30;break}F.offset=ne,F.extra=15&re,F.mode=24;case 24:if(F.extra){for(v=F.extra;q>>=F.extra,q-=F.extra,F.back+=F.extra}if(F.offset>F.dmax){_.msg="invalid distance too far back",F.mode=30;break}F.mode=25;case 25:if(G===0)break e;if(ae=oe-G,F.offset>ae){if((ae=F.offset-ae)>F.whave&&F.sane){_.msg="invalid distance too far back",F.mode=30;break}he=ae>F.wnext?(ae-=F.wnext,F.wsize-ae):F.wnext-ae,ae>F.length&&(ae=F.length),L=F.window}else L=j,he=$-F.offset,ae=F.length;for(Gk?(O=he[L+y[W]],q[Q+y[W]]):(O=96,0),E=1<<_-$,F=b=1<>$)+(b-=E)]=B<<24|O<<16|P|0,b!==0;);for(E=1<<_-1;X&E;)E>>=1;if(E!==0?(X&=E-1,X+=E):X=0,W++,--oe[_]==0){if(_===J)break;_=h[p+y[W]]}if(j<_&&(X&S)!==C){for($===0&&($=j),A+=F,z=1<<(H=_-$);H+$>>7)]}function Q(x,R){x.pending_buf[x.pending++]=255&R,x.pending_buf[x.pending++]=R>>>8&255}function oe(x,R,U){x.bi_valid>w-U?(x.bi_buf|=R<>w-x.bi_valid,x.bi_valid+=U-w):(x.bi_buf|=R<>>=1,U<<=1,0<--R;);return U>>>1}function L(x,R,U){var ee,Z,K=new Array(y+1),te=0;for(ee=1;ee<=y;ee++)K[ee]=te=te+U[ee-1]<<1;for(Z=0;Z<=R;Z++){var ie=x[2*Z+1];ie!==0&&(x[2*Z]=he(K[ie]++,ie))}}function M(x){var R;for(R=0;R>1;1<=U;U--)fe(x,K,U);for(Z=se;U=x.heap[1],x.heap[1]=x.heap[x.heap_len--],fe(x,K,1),ee=x.heap[1],x.heap[--x.heap_max]=U,x.heap[--x.heap_max]=ee,K[2*Z]=K[2*U]+K[2*ee],x.depth[Z]=(x.depth[U]>=x.depth[ee]?x.depth[U]:x.depth[ee])+1,K[2*U+1]=K[2*ee+1]=Z,x.heap[1]=Z++,fe(x,K,1),2<=x.heap_len;);x.heap[--x.heap_max]=x.heap[1],(function(xe,Te){var Ae,Se,Pe,Ie,Qe,$n,cr=Te.dyn_tree,lu=Te.max_code,vh=Te.stat_desc.static_tree,uu=Te.stat_desc.has_stree,ki=Te.stat_desc.extra_bits,Di=Te.stat_desc.extra_base,Js=Te.stat_desc.max_length,cu=0;for(Ie=0;Ie<=y;Ie++)xe.bl_count[Ie]=0;for(cr[2*xe.heap[xe.heap_max]+1]=0,Ae=xe.heap_max+1;Ae>=7;Z>>=1)if(1&de&&ie.dyn_ltree[2*se]!==0)return s;if(ie.dyn_ltree[18]!==0||ie.dyn_ltree[20]!==0||ie.dyn_ltree[26]!==0)return a;for(se=32;se>>3,(K=x.static_len+3+7>>>3)<=Z&&(Z=K)):Z=K=U+5,U+4<=Z&&R!==-1?v(x,R,U,ee):x.strategy===4||K===Z?(oe(x,2+(ee?1:0),3),D(x,Y,_)):(oe(x,4+(ee?1:0),3),(function(ie,se,de,xe){var Te;for(oe(ie,se-257,5),oe(ie,de-1,5),oe(ie,xe-4,4),Te=0;Te>>8&255,x.pending_buf[x.d_buf+2*x.last_lit+1]=255&R,x.pending_buf[x.l_buf+x.last_lit]=255&U,x.last_lit++,R===0?x.dyn_ltree[2*U]++:(x.matches++,R--,x.dyn_ltree[2*(F[U]+h+1)]++,x.dyn_dtree[2*q(R)]++),x.last_lit===x.lit_bufsize-1},i._tr_align=function(x){oe(x,2,3),ae(x,b,Y),(function(R){R.bi_valid===16?(Q(R,R.bi_buf),R.bi_buf=0,R.bi_valid=0):8<=R.bi_valid&&(R.pending_buf[R.pending++]=255&R.bi_buf,R.bi_buf>>=8,R.bi_valid-=8)})(x)}},{"../utils/common":41}],53:[function(r,n,i){"use strict";n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(r,n,i){(function(o){(function(s,a){"use strict";if(!s.setImmediate){var u,c,f,h,p=1,d={},m=!1,g=s.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(s);y=y&&y.setTimeout?y:s,u={}.toString.call(s.process)==="[object process]"?function(C){Oe.nextTick(function(){E(C)})}:(function(){if(s.postMessage&&!s.importScripts){var C=!0,S=s.onmessage;return s.onmessage=function(){C=!1},s.postMessage("","*"),s.onmessage=S,C}})()?(h="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",b,!1):s.attachEvent("onmessage",b),function(C){s.postMessage(h+C,"*")}):s.MessageChannel?((f=new MessageChannel).port1.onmessage=function(C){E(C.data)},function(C){f.port2.postMessage(C)}):g&&"onreadystatechange"in g.createElement("script")?(c=g.documentElement,function(C){var S=g.createElement("script");S.onreadystatechange=function(){E(C),S.onreadystatechange=null,c.removeChild(S),S=null},c.appendChild(S)}):function(C){setTimeout(E,0,C)},y.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var S=new Array(arguments.length-1),A=0;A"u"?o===void 0?this:o:self)}).call(this,typeof Vt<"u"?Vt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})),JF=we(((e,t)=>{var r={"&":"&",'"':""","'":"'","<":"<",">":">"};function n(i){return i&&i.replace?i.replace(/([&"<>'])/g,function(o,s){return r[s]}):i}t.exports=n})),YF=we(((e,t)=>{mi();var r=JF(),n=Ym().Stream,i=" ";function o(h,p){typeof p!="object"&&(p={indent:p});var d=p.stream?new n:null,m="",g=!1,y=p.indent?p.indent===!0?i:p.indent:"",w=!0;function E(k){w?Oe.nextTick(k):k()}function b(k,B){if(B!==void 0&&(m+=B),k&&!g&&(d=d||new n,g=!0),k&&g){var O=m;E(function(){d.emit("data",O)}),m=""}}function C(k,B){c(b,u(k,y,y?1:0),B)}function S(){if(d){var k=m;E(function(){d.emit("data",k),d.emit("end"),d.readable=!1,d.emit("close")})}}function A(k){var B={version:"1.0",encoding:k.encoding||"UTF-8"};k.standalone&&(B.standalone=k.standalone),C({"?xml":{_attr:B}}),m=m.replace("/>","?>")}return E(function(){w=!1}),p.declaration&&A(p.declaration),h&&h.forEach?h.forEach(function(k,B){var O;B+1===h.length&&(O=S),C(k,O)}):C(h,S),d?(d.readable=!0,d):m}function s(){var h={_elem:u(Array.prototype.slice.call(arguments))};return h.push=function(p){if(!this.append)throw new Error("not assigned to a parent!");var d=this,m=this._elem.indent;c(this.append,u(p,m,this._elem.icount+(m?1:0)),function(){d.append(!0)})},h.close=function(p){p!==void 0&&this.push(p),this.end&&this.end()},h}function a(h,p){return new Array(p||0).join(h||"")}function u(h,p,d){d=d||0;var m=a(p,d),g,y=h,w=!1;if(typeof h=="object"&&(g=Object.keys(h)[0],y=h[g],y&&y._elem))return y._elem.name=g,y._elem.icount=d,y._elem.indent=p,y._elem.indents=m,y._elem.interrupt=y,y._elem;var E=[],b=[],C;function S(A){Object.keys(A).forEach(function(k){E.push(f(k,A[k]))})}switch(typeof y){case"object":if(y===null)break;y._attr&&S(y._attr),y._cdata&&b.push(("/g,"]]]]>")+"]]>"),y.forEach&&(C=!1,b.push(""),y.forEach(function(A){typeof A=="object"?Object.keys(A)[0]=="_attr"?S(A._attr):b.push(u(A,p,d+1)):(b.pop(),C=!0,b.push(r(A)))}),C||b.push(""));break;default:b.push(r(y))}return{name:g,interrupt:w,attributes:E,content:b,icount:d,indents:m,indent:p}}function c(h,p,d){if(typeof p!="object")return h(!1,p);var m=p.interrupt?1:p.content.length;function g(){for(;p.content.length;){var w=p.content.shift();if(w!==void 0){if(y(w))return;c(h,w)}}h(!1,(m>1?p.indents:"")+(p.name?"":"")+(p.indent&&!d?` +`:"")),d&&d()}function y(w){return w.interrupt?(w.interrupt.append=h,w.interrupt.end=g,w.interrupt=!1,h(!0),!0):!1}if(h(!1,p.indents+(p.name?"<"+p.name:"")+(p.attributes.length?" "+p.attributes.join(" "):"")+(m?p.name?">":"":p.name?"/>":"")+(p.indent&&m>1?` +`:"")),!m)return h(!1,p.indent?` +`:"");y(p)||g()}function f(h,p){return h+'="'+r(p)+'"'}t.exports=o,t.exports.element=t.exports.Element=s})),QF=Ym(),Ts=Wm(ZF(),1),Xe=Wm(YF(),1),fl=0,Cm=32,eM=32,tM=(e,t)=>{let r=t.replace(/-/g,"");if(r.length!==eM)throw new Error(`Error: Cannot extract GUID from font filename: ${t}`);let n=r.replace(/(..)/g,"$1 ").trim().split(" ").map(s=>parseInt(s,16));n.reverse();let i=e.slice(fl,Cm).map((s,a)=>s^n[a%n.length]),o=new Uint8Array(fl+i.length+Math.max(0,e.length-Cm));return o.set(e.slice(0,fl)),o.set(i,fl),o.set(e.slice(Cm),fl+i.length),o},Sg=class{format(e,t={stack:[]}){let r=e.prepForXml(t);if(r)return r;throw Error("XMLComponent did not format correctly")}},WS=class{replace(e,t,r){let n=e;return t.forEach((i,o)=>{n=n.replace(new RegExp(`{${i.fileName}}`,"g"),(r+o).toString())}),n}getMediaData(e,t){return t.Array.filter(r=>e.search(`{${r.fileName}}`)>0)}},rM=class{replace(e,t){let r=e;for(let n of t)r=r.replace(new RegExp(`{${n.reference}-${n.instance}}`,"g"),n.numId.toString());return r}},nM=class{constructor(){ue(this,"formatter",void 0),ue(this,"imageReplacer",void 0),ue(this,"numberingReplacer",void 0),this.formatter=new Sg,this.imageReplacer=new WS,this.numberingReplacer=new rM}compile(e,t,r=[]){let n=new Ts.default,i=this.xmlifyFile(e,t),o=new Map(Object.entries(i));for(let[,s]of o)if(Array.isArray(s))for(let a of s)n.file(a.path,ml(a.data));else n.file(s.path,ml(s.data));for(let s of r)n.file(s.path,ml(s.data));for(let s of e.Media.Array)s.type!=="svg"?n.file(`word/media/${s.fileName}`,s.data):(n.file(`word/media/${s.fileName}`,s.data),n.file(`word/media/${s.fallback.fileName}`,s.fallback.data));for(let[s,{data:a,fontKey:u}]of e.FontTable.fontOptionsWithKey.entries())n.file(`word/fonts/font${s+1}.odttf`,tM(a,u));return n}xmlifyFile(e,t){let r=e.Document.Relationships.RelationshipCount+1,n=(0,Xe.default)(this.formatter.format(e.Document.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),i=e.Comments.Relationships.RelationshipCount+1,o=(0,Xe.default)(this.formatter.format(e.Comments,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),s=e.FootNotes.Relationships.RelationshipCount+1,a=(0,Xe.default)(this.formatter.format(e.FootNotes.View,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),u=this.imageReplacer.getMediaData(n,e.Media),c=this.imageReplacer.getMediaData(o,e.Media),f=this.imageReplacer.getMediaData(a,e.Media);return be(be({Relationships:{data:(u.forEach((h,p)=>{e.Document.Relationships.addRelationship(r+p,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${h.fileName}`)}),e.Document.Relationships.addRelationship(e.Document.Relationships.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),(0,Xe.default)(this.formatter.format(e.Document.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let h=this.imageReplacer.replace(n,u,r);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let h=(0,Xe.default)(this.formatter.format(e.Styles,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:(0,Xe.default)(this.formatter.format(e.CoreProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},Numbering:{data:(0,Xe.default)(this.formatter.format(e.Numbering,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},FileRelationships:{data:(0,Xe.default)(this.formatter.format(e.FileRelationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:e.Headers.map((h,p)=>{let d=(0,Xe.default)(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(d,e.Media).forEach((m,g)=>{h.Relationships.addRelationship(g,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${m.fileName}`)}),{data:(0,Xe.default)(this.formatter.format(h.Relationships,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${p+1}.xml.rels`}}),FooterRelationships:e.Footers.map((h,p)=>{let d=(0,Xe.default)(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}});return this.imageReplacer.getMediaData(d,e.Media).forEach((m,g)=>{h.Relationships.addRelationship(g,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${m.fileName}`)}),{data:(0,Xe.default)(this.formatter.format(h.Relationships,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${p+1}.xml.rels`}}),Headers:e.Headers.map((h,p)=>{let d=(0,Xe.default)(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),m=this.imageReplacer.getMediaData(d,e.Media),g=this.imageReplacer.replace(d,m,0);return{data:this.numberingReplacer.replace(g,e.Numbering.ConcreteNumbering),path:`word/header${p+1}.xml`}}),Footers:e.Footers.map((h,p)=>{let d=(0,Xe.default)(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),m=this.imageReplacer.getMediaData(d,e.Media),g=this.imageReplacer.replace(d,m,0);return{data:this.numberingReplacer.replace(g,e.Numbering.ConcreteNumbering),path:`word/footer${p+1}.xml`}}),ContentTypes:{data:(0,Xe.default)(this.formatter.format(e.ContentTypes,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"},CustomProperties:{data:(0,Xe.default)(this.formatter.format(e.CustomProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:(0,Xe.default)(this.formatter.format(e.AppProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let h=this.imageReplacer.replace(a,f,s);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(f.forEach((h,p)=>{e.FootNotes.Relationships.addRelationship(s+p,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${h.fileName}`)}),(0,Xe.default)(this.formatter.format(e.FootNotes.Relationships,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(0,Xe.default)(this.formatter.format(e.Endnotes.View,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/endnotes.xml"},EndnotesRelationships:{data:(0,Xe.default)(this.formatter.format(e.Endnotes.Relationships,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/endnotes.xml.rels"},Settings:{data:(0,Xe.default)(this.formatter.format(e.Settings,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"},Comments:{data:(()=>{let h=this.imageReplacer.replace(o,c,i);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(c.forEach((h,p)=>{e.Comments.Relationships.addRelationship(i+p,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${h.fileName}`)}),(0,Xe.default)(this.formatter.format(e.Comments.Relationships,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})),path:"word/_rels/comments.xml.rels"}},e.CommentsExtended?{CommentsExtended:{data:(0,Xe.default)(this.formatter.format(e.CommentsExtended,{viewWrapper:{View:e.CommentsExtended,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),{},{FontTable:{data:(0,Xe.default)(this.formatter.format(e.FontTable.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:(0,Xe.default)(this.formatter.format(e.FontTable.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"}})}};function qx(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(c){r(c);return}a.done?t(u):Promise.resolve(u).then(n,i)}function Tg(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(u){qx(o,n,i,s,a,"next",u)}function a(u){qx(o,n,i,s,a,"throw",u)}s(void 0)})}}var VS={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:" "},jx=e=>e===!0?VS.WITH_2_BLANKS:e===!1?void 0:e,GS=class Es{static pack(t,r,n){var i=this;return Tg(function*(o,s,a,u=[]){return i.compiler.compile(o,jx(a),u).generateAsync({type:s,mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"})}).apply(this,arguments)}static toString(t,r,n=[]){return Es.pack(t,"string",r,n)}static toBuffer(t,r,n=[]){return Es.pack(t,"nodebuffer",r,n)}static toBase64String(t,r,n=[]){return Es.pack(t,"base64",r,n)}static toBlob(t,r,n=[]){return Es.pack(t,"blob",r,n)}static toArrayBuffer(t,r,n=[]){return Es.pack(t,"arraybuffer",r,n)}static toStream(t,r,n=[]){let i=new QF.Stream;return this.compiler.compile(t,jx(r),n).generateAsync({type:"nodebuffer",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",compression:"DEFLATE"}).then(o=>{i.emit("data",o),i.emit("end")}),i}};ue(GS,"compiler",new nM);var iM=new Sg,Rf=e=>(0,Tf.xml2js)(e,{compact:!1,captureSpacesBetweenElements:!0}),KS=e=>{var t;return(t=Rf((0,Xe.default)(iM.format(new vl({text:e})))).elements[0].elements)!==null&&t!==void 0?t:[]},$S=e=>be(be({},e),{},{attributes:{"xml:space":"preserve"}}),Cg=(e,t)=>{var r,n;return(r=(n=e.elements)===null||n===void 0?void 0:n.filter(i=>i.name===t)[0].elements)!==null&&r!==void 0?r:[]},_s=(e,t,r)=>{let n=Cg(e,"Types");n.some(i=>{var o,s;return i.type==="element"&&i.name==="Default"&&(i==null||(o=i.attributes)===null||o===void 0?void 0:o.ContentType)===t&&(i==null||(s=i.attributes)===null||s===void 0?void 0:s.Extension)===r})||n.push({attributes:{ContentType:t,Extension:r},name:"Default",type:"element"})},oM=e=>{let t=parseInt(e.substring(3),10);return isNaN(t)?0:t},sM=e=>Cg(e,"Relationships").map(t=>{var r,n;return oM((r=(n=t.attributes)===null||n===void 0||(n=n.Id)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"")}).reduce((t,r)=>Math.max(t,r),0)+1,Hx=(e,t,r,n,i)=>{let o=Cg(e,"Relationships");return o.push({attributes:{Id:`rId${t}`,Type:r,Target:n,TargetMode:i},name:"Relationship",type:"element"}),o},aM=class extends Error{constructor(e){super(`Token ${e} not found`),this.name="TokenNotFoundError"}},lM=(e,t)=>{var r;for(let s=0;s<((r=e.elements)!==null&&r!==void 0?r:[]).length;s++){let a=e.elements[s];if(a.type==="element"&&a.name==="w:r"){var n;let u=((n=a.elements)!==null&&n!==void 0?n:[]).filter(c=>c.type==="element"&&c.name==="w:t");for(let c of u){var i,o;if(!((i=c.elements)===null||i===void 0)&&i[0]&&!((o=c.elements[0].text)===null||o===void 0)&&o.includes(t))return s}}}throw new aM(t)},uM=(e,t)=>{var r,n;let i=-1,o=(r=(n=e.elements)===null||n===void 0?void 0:n.map((s,a)=>{if(i!==-1)return s;if(s.type==="element"&&s.name==="w:t"){var u,c;let f=((u=(c=s.elements)===null||c===void 0||(c=c[0])===null||c===void 0?void 0:c.text)!==null&&u!==void 0?u:"").split(t),h=f.map(p=>be(be(be({},s),$S(s)),{},{elements:KS(p)}));return f.length>1&&(i=a),h}else return s}).flat())!==null&&r!==void 0?r:[];return{left:be(be({},JSON.parse(JSON.stringify(e))),{},{elements:o.slice(0,i+1)}),right:be(be({},JSON.parse(JSON.stringify(e))),{},{elements:o.slice(i+1)})}},hl={START:0,MIDDLE:1,END:2},cM=({paragraphElement:e,renderedParagraph:t,originalText:r,replacementText:n})=>{let i=t.text.indexOf(r),o=i+r.length-1,s=hl.START;for(let a of t.runs)for(let{text:u,index:c,start:f,end:h}of a.parts)switch(s){case hl.START:if(i>=f&&i<=h){let p=i-f,d=Math.min(o,h)-f,m=a.text.substring(p,d+1);if(m==="")continue;let g=u.replace(m,n);km(e.elements[a.index].elements[c],g),s=hl.MIDDLE;continue}break;case hl.MIDDLE:if(o<=h){let p=u.substring(o-f+1);km(e.elements[a.index].elements[c],p);let d=e.elements[a.index].elements[c];e.elements[a.index].elements[c]=$S(d),s=hl.END}else km(e.elements[a.index].elements[c],"");break;default:}return e},km=(e,t)=>(e.elements=KS(t),e),fM=e=>{if(e.element.name!=="w:p")throw new Error(`Invalid node type: ${e.element.name}`);if(!e.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let t=0,r=e.element.elements.map((n,i)=>({element:n,i})).filter(({element:n})=>n.name==="w:r").map(({element:n,i})=>{let o=hM(n,i,t);return t+=o.text.length,o}).filter(n=>!!n);return{text:r.reduce((n,i)=>n+i.text,""),runs:r,index:e.index,pathToParagraph:XS(e)}},hM=(e,t,r)=>{if(!e.elements)return{text:"",parts:[],index:-1,start:r,end:r};let n=r,i=e.elements.map((o,s)=>{var a,u;return o.name==="w:t"&&o.elements&&o.elements.length>0?{text:(a=(u=o.elements[0].text)===null||u===void 0?void 0:u.toString())!==null&&a!==void 0?a:"",index:s,start:n,end:(()=>{var c,f;return n+=((c=(f=o.elements[0].text)===null||f===void 0?void 0:f.toString())!==null&&c!==void 0?c:"").length-1,n})()}:void 0}).filter(o=>!!o).map(o=>o);return{text:i.reduce((o,s)=>o+s.text,""),parts:i,index:t,start:r,end:n}},XS=e=>e.parent?[...XS(e.parent),e.index]:[e.index],Wx=e=>{var t,r;return(t=(r=e.element.elements)===null||r===void 0?void 0:r.map((n,i)=>({element:n,index:i,parent:e})))!==null&&t!==void 0?t:[]},ZS=e=>{let t=[],r=[...Wx({element:e,index:0,parent:void 0})],n;for(;r.length>0;)n=r.shift(),n.element.name==="w:p"&&(t=[...t,fM(n)]),r.push(...Wx(n));return t},dM=(e,t)=>ZS(e).filter(r=>r.text.includes(t)),pM=new Sg,Dm="\u0275",mM=({json:e,patch:t,patchText:r,context:n,keepOriginalStyles:i=!0})=>{let o=dM(e,r);if(o.length===0)return{element:e,didFindOccurrence:!1};for(let s of o){let a=t.children.map(u=>Rf((0,Xe.default)(pM.format(u,n)))).map(u=>u.elements[0]);switch(t.type){case Hm.DOCUMENT:{let u=gM(e,s.pathToParagraph),c=yM(s.pathToParagraph);u.elements.splice(c,1,...a);break}case Hm.PARAGRAPH:default:{let u=JS(e,s.pathToParagraph);cM({paragraphElement:u,renderedParagraph:s,originalText:r,replacementText:Dm});let c=lM(u,Dm),f=u.elements[c],{left:h,right:p}=uM(f,Dm),d=a,m=p;if(i){let g=f.elements.filter(y=>y.type==="element"&&y.name==="w:rPr");d=a.map(y=>{var w;return be(be({},y),{},{elements:[...g,...(w=y.elements)!==null&&w!==void 0?w:[]]})}),m=be(be({},p),{},{elements:[...g,...p.elements]})}u.elements.splice(c,1,h,...d,m);break}}}return{element:e,didFindOccurrence:!0}},JS=(e,t)=>{let r=e;for(let n=1;nJS(e,t.slice(0,t.length-1)),yM=e=>e[e.length-1],Hm={DOCUMENT:"file",PARAGRAPH:"paragraph"},Vx=new WS,vM=new Uint8Array([255,254]),wM=new Uint8Array([254,255]),Gx=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;rO.name==="w:document");if(B&&B.attributes){for(let O of["mc","wp","r","w15","m"])B.attributes[`xmlns:${O}`]=_f[O];B.attributes["mc:Ignorable"]=`${B.attributes["mc:Ignorable"]||""} w15`.trim()}}if(b.startsWith("word/")&&!b.endsWith(".xml.rels")){let B={file:c,viewWrapper:{Relationships:{addRelationship:(_,W,F,J)=>{p.push({key:b,hyperlink:{id:_,link:F}})}}},stack:[]};if(u.set(b,B),!o?.start.trim()||!o?.end.trim())throw new Error("Both start and end delimiters must be non-empty strings.");let{start:O,end:P}=o;for(let[_,W]of Object.entries(n)){let F=`${O}${_}${P}`;for(;;){let{didFindOccurrence:J}=mM({json:k,patch:be(be({},W),{},{children:W.children.map(j=>{if(j instanceof dg){let H=new Ns(j.options.children,Dl());return p.push({key:b,hyperlink:{id:H.linkId,link:j.options.link}}),H}else return j})}),patchText:F,context:B,keepOriginalStyles:i});if(!s||!J)break}}let Y=Vx.getMediaData(JSON.stringify(k),B.file.Media);Y.length>0&&(d=!0,h.push({key:b,mediaDatas:Y}))}f.set(b,k)}for(let{key:b,mediaDatas:C}of h){var y;let S=`word/_rels/${b.split("/").pop()}.rels`,A=(y=f.get(S))!==null&&y!==void 0?y:Kx();f.set(S,A);let k=sM(A),B=Vx.replace(JSON.stringify(f.get(b)),C,k);f.set(b,JSON.parse(B));for(let O=0;O(0,Tf.js2xml)(e,{attributeValueFn:t=>String(t).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}),Kx=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),xM=(function(){var e=Tg(function*({data:t}){let r=t instanceof Ts.default?t:yield Ts.default.loadAsync(t),n=new Set;for(let[i,o]of Object.entries(r.files))!i.endsWith(".xml")&&!i.endsWith(".rels")||i.startsWith("word/")&&!i.endsWith(".xml.rels")&&ZS(Rf(yield o.async("text"))).forEach(s=>EM(s.text).forEach(a=>n.add(a)));return Array.from(n)});return function(r){return e.apply(this,arguments)}})(),EM=e=>{var t;let r=new RegExp("(?<=\\{\\{).+?(?=\\}\\})","gs");return(t=e.match(r))!==null&&t!==void 0?t:[]};var _3=f1(yp(),1);var Xg={};Ut(Xg,{AllSelection:()=>ar,EditorState:()=>$g,NodeSelection:()=>Ce,Plugin:()=>Lt,PluginKey:()=>fn,Selection:()=>ke,SelectionRange:()=>Pn,TextSelection:()=>Ne,Transaction:()=>Vf});var Lg={};Ut(Lg,{ContentMatch:()=>wi,DOMParser:()=>Bs,DOMSerializer:()=>bi,Fragment:()=>ye,Mark:()=>Le,MarkType:()=>Ms,Node:()=>jr,NodeRange:()=>vi,NodeType:()=>Ml,ReplaceError:()=>Bn,ResolvedPos:()=>Fl,Schema:()=>Bl,Slice:()=>_e});function Bt(e){this.content=e}Bt.prototype={constructor:Bt,find:function(e){for(var t=0;t>1}};Bt.from=function(e){if(e instanceof Bt)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new Bt(t)};var Dg=Bt;function aT(e,t,r){for(let n=0;;n++){if(n==e.childCount||n==t.childCount)return e.childCount==t.childCount?null:r;let i=e.child(n),o=t.child(n);if(i==o){r+=i.nodeSize;continue}if(!i.sameMarkup(o))return r;if(i.isText&&i.text!=o.text){let s=i.text,a=o.text,u=0;for(;s[u]==a[u];u++)r++;return u&&u0&&p>0&&c[h-1]==f[p-1];)h--,p--,r--,n--;return h&&p&&h=56320&&e<57344}function cT(e){return e>=55296&&e<56320}var ye=class e{constructor(t,r){if(this.content=t,this.size=r||0,r==null)for(let n=0;nt&&n(u,i+a,o||null,s)!==!1&&u.content.size){let f=a+1;u.nodesBetween(Math.max(0,t-f),Math.min(u.content.size,r-f),n,i+f)}a=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,r,n,i){let o="",s=!0;return this.nodesBetween(t,r,(a,u)=>{let c=a.isText?a.text.slice(Math.max(t,u)-u,r-u):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(s?s=!1:o+=n),o+=c},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let r=this.lastChild,n=t.firstChild,i=this.content.slice(),o=0;for(r.isText&&r.sameMarkup(n)&&(i[i.length-1]=r.withText(r.text+n.text),o=1);ot)for(let o=0,s=0;st&&((sr)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,r-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,r-s-1))),n.push(a),i+=a.nodeSize),s=u}return new e(n,i)}cutByIndex(t,r){return t==r?e.empty:t==0&&r==this.content.length?this:new e(this.content.slice(t,r))}replaceChild(t,r){let n=this.content[t];if(n==r)return this;let i=this.content.slice(),o=this.size+r.nodeSize-n.nodeSize;return i[t]=r,new e(i,o)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let r=0;rthis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,n=0;;r++){let i=this.child(r),o=n+i.nodeSize;if(o>=t)return o==t?If(r+1,o):If(r,n);n=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,r){if(!r)return e.empty;if(!Array.isArray(r))throw new RangeError("Invalid input for Fragment.fromJSON");return e.fromArray(r.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let r,n=0;for(let i=0;ithis.type.rank&&(r||(r=t.slice(0,i)),r.push(this),n=!0),r&&r.push(o)}}return r||(r=t.slice()),n||r.push(this),r}removeFromSet(t){for(let r=0;rn.type.rank-i.type.rank),r}};Le.none=[];var Bn=class extends Error{},_e=class e{constructor(t,r,n){this.content=t,this.openStart=r,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,r){let n=hT(this.content,t+this.openStart,r,this.openStart+1,this.openEnd+1);return n&&new e(n,this.openStart,this.openEnd)}removeBetween(t,r){return new e(fT(this.content,t+this.openStart,r+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,r){if(!r)return e.empty;let n=r.openStart||0,i=r.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new e(ye.fromJSON(t,r.content),n,i)}static maxOpen(t,r=!0){let n=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=t.lastChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.lastChild)i++;return new e(t,n,i)}};_e.empty=new _e(ye.empty,0,0);function fT(e,t,r){let{index:n,offset:i}=e.findIndex(t),o=e.maybeChild(n),{index:s,offset:a}=e.findIndex(r);if(i==t||o.isText){if(a!=r&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(r))}if(n!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(n,o.copy(fT(o.content,t-i-1,r-i-1)))}function hT(e,t,r,n,i,o){let{index:s,offset:a}=e.findIndex(t),u=e.maybeChild(s);if(a==t||u.isText)return o&&n<=0&&i<=0&&!o.canReplace(s,s,r)?null:e.cut(0,t).append(r).append(e.cut(t));let c=hT(u.content,t-a-1,r,s==0?n-1:0,s==e.childCount-1?i-1:0,u);return c&&e.replaceChild(s,u.copy(c))}function AM(e,t,r){if(r.openStart>e.depth)throw new Bn("Inserted content deeper than insertion position");if(e.depth-r.openStart!=t.depth-r.openEnd)throw new Bn("Inconsistent open depths");return dT(e,t,r,0)}function dT(e,t,r,n){let i=e.index(n),o=e.node(n);if(i==t.index(n)&&n=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function Rl(e,t,r,n){let i=(t||e).node(r),o=0,s=t?t.index(r):i.childCount;e&&(o=e.index(r),e.depth>r?o++:e.textOffset&&(lo(e.nodeAfter,n),o++));for(let a=o;ai&&Og(e,t,i+1),s=n.depth>i&&Og(r,n,i+1),a=[];return Rl(null,e,i,a),o&&s&&t.index(i)==r.index(i)?(pT(o,s),lo(uo(o,mT(e,t,r,n,i+1)),a)):(o&&lo(uo(o,Lf(e,t,i+1)),a),Rl(t,r,i,a),s&&lo(uo(s,Lf(r,n,i+1)),a)),Rl(n,null,i,a),new ye(a)}function Lf(e,t,r){let n=[];if(Rl(null,e,r,n),e.depth>r){let i=Og(e,t,r+1);lo(uo(i,Lf(e,t,r+1)),n)}return Rl(t,null,r,n),new ye(n)}function SM(e,t){let r=t.depth-e.openStart,i=t.node(r).copy(e.content);for(let o=r-1;o>=0;o--)i=t.node(o).copy(ye.from(i));return{start:i.resolveNoCache(e.openStart+r),end:i.resolveNoCache(i.content.size-e.openEnd-r)}}var Fl=class e{constructor(t,r,n){this.pos=t,this.path=r,this.parentOffset=n,this.depth=r.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,r=this.index(this.depth);if(r==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=t.child(r);return n?t.child(r).cut(n):i}get nodeBefore(){let t=this.index(this.depth),r=this.pos-this.path[this.path.length-1];return r?this.parent.child(t).cut(0,r):t==0?null:this.parent.child(t-1)}posAtIndex(t,r){r=this.resolveDepth(r);let n=this.path[r*3],i=r==0?0:this.path[r*3-1]+1;for(let o=0;o0;r--)if(this.start(r)<=t&&this.end(r)>=t)return r;return 0}blockRange(t=this,r){if(t.pos=0;n--)if(t.pos<=this.end(n)&&(!r||r(this.node(n))))return new vi(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos=0&&r<=t.content.size))throw new RangeError("Position "+r+" out of range");let n=[],i=0,o=r;for(let s=t;;){let{index:a,offset:u}=s.content.findIndex(o),c=o-u;if(n.push(s,a,i+u),!c||(s=s.child(a),s.isText))break;o=c-1,i+=u+1}return new e(r,n,o)}static resolveCached(t,r){let n=YS.get(t);if(n)for(let o=0;ot&&this.nodesBetween(t,r,o=>(n.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),gT(this.marks,t)}contentMatchAt(t){let r=this.type.contentMatch.matchFragment(this.content,0,t);if(!r)throw new Error("Called contentMatchAt on a node with invalid content");return r}canReplace(t,r,n=ye.empty,i=0,o=n.childCount){let s=this.contentMatchAt(t).matchFragment(n,i,o),a=s&&s.matchFragment(this.content,r);if(!a||!a.validEnd)return!1;for(let u=i;ur.type.name)}`);this.content.forEach(r=>r.check())}toJSON(){let t={type:this.type.name};for(let r in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(r=>r.toJSON())),t}static fromJSON(t,r){if(!r)throw new RangeError("Invalid input for Node.fromJSON");let n;if(r.marks){if(!Array.isArray(r.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=r.marks.map(t.markFromJSON)}if(r.type=="text"){if(typeof r.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(r.text,n)}let i=ye.fromJSON(t,r.content),o=t.nodeType(r.type).create(r.attrs,i,n);return o.type.checkAttrs(o.attrs),o}};jr.prototype.text=void 0;var Ig=class e extends jr{constructor(t,r,n,i){if(super(t,r,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):gT(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,r){return this.text.slice(t,r)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(t=0,r=this.text.length){return t==0&&r==this.text.length?this:this.withText(this.text.slice(t,r))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}};function gT(e,t){for(let r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}var wi=class e{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,r){let n=new Fg(t,r);if(n.next==null)return e.empty;let i=yT(n);n.next&&n.err("Unexpected trailing text");let o=FM(IM(i));return MM(o,n),o}matchType(t){for(let r=0;rc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function r(n){t.push(n);for(let i=0;i{let o=i+(n.validEnd?"*":" ")+" ";for(let s=0;s"+t.indexOf(n.next[s].next);return o}).join(` +`)}};wi.empty=new wi(!0);var Fg=class{constructor(t,r){this.string=t,this.nodeTypes=r,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}};function yT(e){let t=[];do t.push(kM(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function kM(e){let t=[];do t.push(DM(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function DM(e){let t=RM(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=NM(e,t);else break;return t}function QS(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function NM(e,t){let r=QS(e),n=r;return e.eat(",")&&(e.next!="}"?n=QS(e):n=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:t}}function OM(e,t){let r=e.nodeTypes,n=r[t];if(n)return[n];let i=[];for(let o in r){let s=r[o];s.isInGroup(t)&&i.push(s)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function RM(e){if(e.eat("(")){let t=yT(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=OM(e,e.next).map(r=>(e.inline==null?e.inline=r.isInline:e.inline!=r.isInline&&e.err("Mixing inline and block content"),{type:"name",value:r}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function IM(e){let t=[[]];return i(o(e,0),r()),t;function r(){return t.push([])-1}function n(s,a,u){let c={term:u,to:a};return t[s].push(c),c}function i(s,a){s.forEach(u=>u.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((u,c)=>u.concat(o(c,a)),[]);if(s.type=="seq")for(let u=0;;u++){let c=o(s.exprs[u],a);if(u==s.exprs.length-1)return c;i(c,a=r())}else if(s.type=="star"){let u=r();return n(a,u),i(o(s.expr,u),u),[n(u)]}else if(s.type=="plus"){let u=r();return i(o(s.expr,a),u),i(o(s.expr,u),u),[n(u)]}else{if(s.type=="opt")return[n(a)].concat(o(s.expr,a));if(s.type=="range"){let u=a;for(let c=0;c{e[s].forEach(({term:a,to:u})=>{if(!a)return;let c;for(let f=0;f{c||i.push([a,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let o=t[n.join(",")]=new wi(n.indexOf(e.length-1)>-1);for(let s=0;s-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:bT(this.attrs,t)}create(t=null,r,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new jr(this,this.computeAttrs(t),ye.from(r),Le.setFrom(n))}createChecked(t=null,r,n){return r=ye.from(r),this.checkContent(r),new jr(this,this.computeAttrs(t),r,Le.setFrom(n))}createAndFill(t=null,r,n){if(t=this.computeAttrs(t),r=ye.from(r),r.size){let s=this.contentMatch.fillBefore(r);if(!s)return null;r=s.append(r)}let i=this.contentMatch.matchFragment(r),o=i&&i.fillBefore(ye.empty,!0);return o?new jr(this,t,r.append(o),Le.setFrom(n)):null}validContent(t){let r=this.contentMatch.matchFragment(t);if(!r||!r.validEnd)return!1;for(let n=0;n-1}allowsMarks(t){if(this.markSet==null)return!0;for(let r=0;rn[o]=new e(o,r,s));let i=r.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function BM(e,t,r){let n=r.split("|");return i=>{let o=i===null?"null":typeof i;if(n.indexOf(o)<0)throw new RangeError(`Expected value of type ${n} for attribute ${t} on type ${e}, got ${o}`)}}var Mg=class{constructor(t,r,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?BM(t,r,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Ms=class e{constructor(t,r,n,i){this.name=t,this.rank=r,this.schema=n,this.spec=i,this.attrs=xT(t,i.attrs),this.excluded=null;let o=wT(this.attrs);this.instance=o?new Le(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Le(this,bT(this.attrs,t))}static compile(t,r){let n=Object.create(null),i=0;return t.forEach((o,s)=>n[o]=new e(o,i++,r,s)),n}removeFromSet(t){for(var r=0;r-1}},Bl=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let r=this.spec={};for(let i in t)r[i]=t[i];r.nodes=Dg.from(t.nodes),r.marks=Dg.from(t.marks||{}),this.nodes=Ml.compile(this.spec.nodes,this),this.marks=Ms.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=n[s]||(n[s]=wi.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?tT(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:tT(this,s.split(" "))}this.nodeFromJSON=i=>jr.fromJSON(this,i),this.markFromJSON=i=>Le.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,r=null,n,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof Ml){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(r,n,i)}text(t,r){let n=this.nodes.text;return new Ig(n,n.defaultAttrs,t,Le.setFrom(r))}mark(t,r){return typeof t=="string"&&(t=this.marks[t]),t.create(r)}nodeType(t){let r=this.nodes[t];if(!r)throw new RangeError("Unknown node type: "+t);return r}};function tT(e,t){let r=[];for(let n=0;n-1)&&r.push(s=u)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[n]+"'")}return r}function LM(e){return e.tag!=null}function PM(e){return e.style!=null}var Bs=class e{constructor(t,r){this.schema=t,this.rules=r,this.tags=[],this.styles=[];let n=this.matchedStyles=[];r.forEach(i=>{if(LM(i))this.tags.push(i);else if(PM(i)){let o=/[^=]*/.exec(i.style)[0];n.indexOf(o)<0&&n.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=t.nodes[i.node];return o.contentMatch.matchType(o)})}parse(t,r={}){let n=new Pf(this,r,!1);return n.addAll(t,Le.none,r.from,r.to),n.finish()}parseSlice(t,r={}){let n=new Pf(this,r,!0);return n.addAll(t,Le.none,r.from,r.to),_e.maxOpen(n.finish())}matchTag(t,r,n){for(let i=n?this.tags.indexOf(n)+1:0;it.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=r))){if(s.getAttrs){let u=s.getAttrs(r);if(u===!1)continue;s.attrs=u||void 0}return s}}}static schemaRules(t){let r=[];function n(i){let o=i.priority==null?50:i.priority,s=0;for(;s{n(s=nT(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in t.nodes){let o=t.nodes[i].spec.parseDOM;o&&o.forEach(s=>{n(s=nT(s)),s.node||s.ignore||s.mark||(s.node=i)})}return r}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},ET={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},zM={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},AT={ol:!0,ul:!0},Ll=1,Bg=2,Il=4;function rT(e,t,r){return t!=null?(t?Ll:0)|(t==="full"?Bg:0):e&&e.whitespace=="pre"?Ll|Bg:r&~Il}var Fs=class{constructor(t,r,n,i,o,s){this.type=t,this.attrs=r,this.marks=n,this.solid=i,this.options=s,this.content=[],this.activeMarks=Le.none,this.match=o||(s&Il?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let r=this.type.contentMatch.fillBefore(ye.from(t));if(r)this.match=this.type.contentMatch.matchFragment(r);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(t.type))?(this.match=n,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Ll)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let o=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let r=ye.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(ye.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!ET.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}},Pf=class{constructor(t,r,n){this.parser=t,this.options=r,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=r.topNode,o,s=rT(null,r.preserveWhitespace,0)|(n?Il:0);i?o=new Fs(i.type,i.attrs,Le.none,!0,r.topMatch||i.type.contentMatch,s):n?o=new Fs(null,null,Le.none,!0,null,s):o=new Fs(t.schema.topNodeType,null,Le.none,!0,null,s),this.nodes=[o],this.find=r.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,r){t.nodeType==3?this.addTextNode(t,r):t.nodeType==1&&this.addElement(t,r)}addTextNode(t,r){let n=t.nodeValue,i=this.top,o=i.options&Bg?"full":this.localPreserveWS||(i.options&Ll)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(o)if(o==="full")n=n.replace(/\r\n?/g,` +`);else if(s.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(s.linebreakReplacement.create())){let a=n.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(c)):r=r.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)a=u;else break}}return r}addElementByRule(t,r,n,i){let o,s;if(r.node)if(s=this.parser.schema.nodes[r.node],s.isLeaf)this.insertNode(s.create(r.attrs),n,t.nodeName=="BR")||this.leafFallback(t,n);else{let u=this.enter(s,r.attrs||null,n,r.preserveWhitespace);u&&(o=!0,n=u)}else{let u=this.parser.schema.marks[r.mark];n=n.concat(u.create(r.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(t);else if(i)this.addElement(t,n,i);else if(r.getContent)this.findInside(t),r.getContent(t,this.parser.schema).forEach(u=>this.insertNode(u,n,!1));else{let u=t;typeof r.contentElement=="string"?u=t.querySelector(r.contentElement):typeof r.contentElement=="function"?u=r.contentElement(t):r.contentElement&&(u=r.contentElement),this.findAround(t,u,!0),this.addAll(u,n),this.findAround(t,u,!1)}o&&this.sync(a)&&this.open--}addAll(t,r,n,i){let o=n||0;for(let s=n?t.childNodes[n]:t.firstChild,a=i==null?null:t.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(s,r);this.findAtPoint(t,o)}findPlace(t,r,n){let i,o;for(let s=this.open,a=0;s>=0;s--){let u=this.nodes[s],c=u.findWrapping(t);if(c&&(!i||i.length>c.length+a)&&(i=c,o=u,!c.length))break;if(u.solid){if(n)break;a+=2}}if(!i)return null;this.sync(o);for(let s=0;s(s.type?s.type.allowsMarkType(c.type):iT(c.type,t))?(u=c.addToSet(u),!1):!0),this.nodes.push(new Fs(t,r,u,i,null,a)),this.open++,n}closeExtra(t=!1){let r=this.nodes.length-1;if(r>this.open){for(;r>this.open;r--)this.nodes[r-1].content.push(this.nodes[r].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let r=this.open;r>=0;r--){if(this.nodes[r]==t)return this.open=r,!0;this.localPreserveWS&&(this.nodes[r].options|=Ll)}return!1}get currentPos(){this.closeExtra();let t=0;for(let r=this.open;r>=0;r--){let n=this.nodes[r].content;for(let i=n.length-1;i>=0;i--)t+=n[i].nodeSize;r&&t++}return t}findAtPoint(t,r){if(this.find)for(let n=0;n-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let r=t.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),o=-(n?n.depth+1:0)+(i?0:1),s=(a,u)=>{for(;a>=0;a--){let c=r[a];if(c==""){if(a==r.length-1||a==0)continue;for(;u>=o;u--)if(s(a-1,u))return!0;return!1}else{let f=u>0||u==0&&i?this.nodes[u].type:n&&u>=o?n.node(u-o).type:null;if(!f||f.name!=c&&!f.isInGroup(c))return!1;u--}}return!0};return s(r.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let r=t.depth;r>=0;r--){let n=t.node(r).contentMatchAt(t.indexAfter(r)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let r in this.parser.schema.nodes){let n=this.parser.schema.nodes[r];if(n.isTextblock&&n.defaultAttrs)return n}}};function UM(e){for(let t=e.firstChild,r=null;t;t=t.nextSibling){let n=t.nodeType==1?t.nodeName.toLowerCase():null;n&&AT.hasOwnProperty(n)&&r?(r.appendChild(t),t=r):n=="li"?r=t:n&&(r=null)}}function qM(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function nT(e){let t={};for(let r in e)t[r]=e[r];return t}function iT(e,t){let r=t.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(e))continue;let o=[],s=a=>{o.push(a);for(let u=0;u{if(o.length||s.marks.length){let a=0,u=0;for(;a=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,r);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(t,r,n={}){let i=this.marks[t.type.name];return i&&Mf(Ff(n),i(t,r),null,t.attrs)}static renderSpec(t,r,n=null,i){return typeof r=="string"?{dom:t.createTextNode(r)}:Mf(t,r,n,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let r=oT(t.nodes);return r.text||(r.text=n=>n.text),r}static marksFromSchema(t){return oT(t.marks)}};function oT(e){let t={};for(let r in e){let n=e[r].spec.toDOM;n&&(t[r]=n)}return t}function Ff(e){return e.document||window.document}var sT=new WeakMap;function jM(e){let t=sT.get(e);return t===void 0&&sT.set(e,t=HM(e)),t}function HM(e){let t=null;function r(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")t||(t=[]),t.push(n);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(r=i.slice(0,s),i=i.slice(s+1));let a,u=r?e.createElementNS(r,i):e.createElement(i),c=t[1],f=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){f=2;for(let h in c)if(c[h]!=null){let p=h.indexOf(" ");p>0?u.setAttributeNS(h.slice(0,p),h.slice(p+1),c[h]):h=="style"&&u.style?u.style.cssText=c[h]:u.setAttribute(h,c[h])}}for(let h=f;hf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else if(typeof p=="string")u.appendChild(e.createTextNode(p));else{let{dom:d,contentDOM:m}=Mf(e,p,r,n);if(u.appendChild(d),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:u,contentDOM:a}}var DT=65535,NT=Math.pow(2,16);function WM(e,t){return e+t*NT}function ST(e){return e&DT}function VM(e){return(e-(e&DT))/NT}var OT=1,RT=2,zf=4,IT=8,Ul=class{constructor(t,r,n){this.pos=t,this.delInfo=r,this.recover=n}get deleted(){return(this.delInfo&IT)>0}get deletedBefore(){return(this.delInfo&(OT|zf))>0}get deletedAfter(){return(this.delInfo&(RT|zf))>0}get deletedAcross(){return(this.delInfo&zf)>0}},Ln=class e{constructor(t,r=!1){if(this.ranges=t,this.inverted=r,!t.length&&e.empty)return e.empty}recover(t){let r=0,n=ST(t);if(!this.inverted)for(let i=0;it)break;let c=this.ranges[a+o],f=this.ranges[a+s],h=u+c;if(t<=h){let p=c?t==u?-1:t==h?1:r:r,d=u+i+(p<0?0:f);if(n)return d;let m=t==(r<0?u:h)?null:WM(a/3,t-u),g=t==u?RT:t==h?OT:zf;return(r<0?t!=u:t!=h)&&(g|=IT),new Ul(d,g,m)}i+=f-c}return n?t+i:new Ul(t+i,0,null)}touches(t,r){let n=0,i=ST(r),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;at)break;let c=this.ranges[a+o],f=u+c;if(t<=f&&a==i*3)return!0;n+=this.ranges[a+s]-c}return!1}forEach(t){let r=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,o=0;i=0;r--){let i=t.getMirror(r);this.appendMap(t._maps[r].invert(),i!=null&&i>r?n-i-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(t,r=1){if(this.mirror)return this._map(t,r,!0);for(let n=this.from;no&&u!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),r.openStart,r.openEnd);return At.fromReplace(t,this.from,this.to,o)}invert(){return new co(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new e(r.pos,n.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(r.from,r.to,t.markFromJSON(r.mark))}};yt.jsonID("addMark",jl);var co=class e extends yt{constructor(t,r,n){super(),this.from=t,this.to=r,this.mark=n}apply(t){let r=t.slice(this.from,this.to),n=new _e(jg(r.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),r.openStart,r.openEnd);return At.fromReplace(t,this.from,this.to,n)}invert(){return new jl(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return r.deleted&&n.deleted||r.pos>=n.pos?null:new e(r.pos,n.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(r.from,r.to,t.markFromJSON(r.mark))}};yt.jsonID("removeMark",co);var Hl=class e extends yt{constructor(t,r){super(),this.pos=t,this.mark=r}apply(t){let r=t.nodeAt(this.pos);if(!r)return At.fail("No node at mark step's position");let n=r.type.create(r.attrs,null,this.mark.addToSet(r.marks));return At.fromReplace(t,this.pos,this.pos+1,new _e(ye.from(n),0,r.isLeaf?0:1))}invert(t){let r=t.nodeAt(this.pos);if(r){let n=this.mark.addToSet(r.marks);if(n.length==r.marks.length){for(let i=0;in.pos?null:new e(r.pos,n.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number"||typeof r.gapFrom!="number"||typeof r.gapTo!="number"||typeof r.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new e(r.from,r.to,r.gapFrom,r.gapTo,_e.fromJSON(t,r.slice),r.insert,!!r.structure)}};yt.jsonID("replaceAround",vt);function Ug(e,t,r){let n=e.resolve(t),i=r-t,o=n.depth;for(;i>0&&o>0&&n.indexAfter(o)==n.node(o).childCount;)o--,i--;if(i>0){let s=n.node(o).maybeChild(n.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function GM(e,t,r,n){let i=[],o=[],s,a;e.doc.nodesBetween(t,r,(u,c,f)=>{if(!u.isInline)return;let h=u.marks;if(!n.isInSet(h)&&f.type.allowsMarkType(n.type)){let p=Math.max(c,t),d=Math.min(c+u.nodeSize,r),m=n.addToSet(h);for(let g=0;ge.step(u)),o.forEach(u=>e.step(u))}function KM(e,t,r,n){let i=[],o=0;e.doc.nodesBetween(t,r,(s,a)=>{if(!s.isInline)return;o++;let u=null;if(n instanceof Ms){let c=s.marks,f;for(;f=n.isInSet(c);)(u||(u=[])).push(f),c=f.removeFromSet(c)}else n?n.isInSet(s.marks)&&(u=[n]):u=s.marks;if(u&&u.length){let c=Math.min(a+s.nodeSize,r);for(let f=0;fe.step(new co(s.from,s.to,s.style)))}function Hg(e,t,r,n=r.contentMatch,i=!0){let o=e.doc.nodeAt(t),s=[],a=t+1;for(let u=0;u=0;u--)e.step(s[u])}function $M(e,t,r){return(t==0||e.canReplace(t,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function fo(e){let r=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,i=0,o=0;;--n){let s=e.$from.node(n),a=e.$from.index(n)+i,u=e.$to.indexAfter(n)-o;if(nr;m--)g||n.index(m)>0?(g=!0,f=ye.from(n.node(m).copy(f)),h++):u--;let p=ye.empty,d=0;for(let m=o,g=!1;m>r;m--)g||i.after(m+1)=0;s--){if(n.size){let a=r[s].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=ye.from(r[s].type.create(r[s].attrs,n))}let i=t.start,o=t.end;e.step(new vt(i,o,i,o,new _e(n,0,0),r.length,!0))}function QM(e,t,r,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,r,(s,a)=>{let u=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(n,u)&&eB(e.doc,e.mapping.slice(o).map(a),n)){let c=null;if(n.schema.linebreakReplacement){let d=n.whitespace=="pre",m=!!n.contentMatch.matchType(n.schema.linebreakReplacement);d&&!m?c=!1:!d&&m&&(c=!0)}c===!1&&MT(e,s,a,o),Hg(e,e.mapping.slice(o).map(a,1),n,void 0,c===null);let f=e.mapping.slice(o),h=f.map(a,1),p=f.map(a+s.nodeSize,1);return e.step(new vt(h,p,h+1,p-1,new _e(ye.from(n.create(u,null,s.marks)),0,0),1,!0)),c===!0&&FT(e,s,a,o),!1}})}function FT(e,t,r,n){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let u=e.mapping.slice(n).map(r+1+o+s.index);e.replaceWith(u,u+1,t.type.schema.linebreakReplacement.create())}}})}function MT(e,t,r,n){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=e.mapping.slice(n).map(r+1+o);e.replaceWith(s,s+1,t.type.schema.text(` +`))}})}function eB(e,t,r){let n=e.resolve(t),i=n.index();return n.parent.canReplaceWith(i,i+1,r)}function tB(e,t,r,n,i){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");r||(r=o.type);let s=r.create(n,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!r.validContent(o.content))throw new RangeError("Invalid content for node type "+r.name);e.step(new vt(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new _e(ye.from(s),0,0),1,!0))}function _i(e,t,r=1,n){let i=e.resolve(t),o=i.depth-r,s=n&&n[n.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,f=r-2;c>o;c--,f--){let h=i.node(c),p=i.index(c);if(h.type.spec.isolating)return!1;let d=h.content.cutByIndex(p,h.childCount),m=n&&n[f+1];m&&(d=d.replaceChild(0,m.type.create(m.attrs)));let g=n&&n[f]||h;if(!h.canReplace(p+1,h.childCount)||!g.type.validContent(d))return!1}let a=i.indexAfter(o),u=n&&n[0];return i.node(o).canReplaceWith(a,a,u?u.type:i.node(o+1).type)}function rB(e,t,r=1,n){let i=e.doc.resolve(t),o=ye.empty,s=ye.empty;for(let a=i.depth,u=i.depth-r,c=r-1;a>u;a--,c--){o=ye.from(i.node(a).copy(o));let f=n&&n[c];s=ye.from(f?f.type.create(f.attrs,s):i.node(a).copy(s))}e.step(new Kt(t,t,new _e(o.append(s),r,r),!0))}function cn(e,t){let r=e.resolve(t),n=r.index();return BT(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function nB(e,t){t.content.size||e.type.compatibleContent(t.type);let r=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let i=0;i0?(o=n.node(i+1),a++,s=n.node(i).maybeChild(a)):(o=n.node(i).maybeChild(a-1),s=n.node(i+1)),o&&!o.isTextblock&&BT(o,s)&&n.node(i).canReplace(a,a+1))return t;if(i==0)break;t=r<0?n.before(i):n.after(i)}}function iB(e,t,r){let n=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-r),s=o.node().type;if(i&&s.inlineContent){let f=s.whitespace=="pre",h=!!s.contentMatch.matchType(i);f&&!h?n=!1:!f&&h&&(n=!0)}let a=e.steps.length;if(n===!1){let f=e.doc.resolve(t+r);MT(e,f.node(),f.before(),a)}s.inlineContent&&Hg(e,t+r-1,s,o.node().contentMatchAt(o.index()),n==null);let u=e.mapping.slice(a),c=u.map(t-r);if(e.step(new Kt(c,u.map(t+r,-1),_e.empty,!0)),n===!0){let f=e.doc.resolve(c);FT(e,f.node(),f.before(),e.steps.length)}return e}function oB(e,t,r){let n=e.resolve(t);if(n.parent.canReplaceWith(n.index(),n.index(),r))return t;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let o=n.index(i);if(n.node(i).canReplaceWith(o,o,r))return n.before(i+1);if(o>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let o=n.indexAfter(i);if(n.node(i).canReplaceWith(o,o,r))return n.after(i+1);if(o=0;s--){let a=s==n.depth?0:n.pos<=(n.start(s+1)+n.end(s+1))/2?-1:1,u=n.index(s)+(a>0?1:0),c=n.node(s),f=!1;if(o==1)f=c.canReplace(u,u,i);else{let h=c.contentMatchAt(u).findWrapping(i.firstChild.type);f=h&&c.canReplaceWith(u,u,h[0])}if(f)return a==0?n.pos:a<0?n.before(s+1):n.after(s+1)}return null}function Wl(e,t,r=t,n=_e.empty){if(t==r&&!n.size)return null;let i=e.resolve(t),o=e.resolve(r);return LT(i,o,n)?new Kt(t,r,n):new qg(i,o,n).fit()}function LT(e,t,r){return!r.openStart&&!r.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),r.content)}var qg=class{constructor(t,r,n){this.$from=t,this.$to=r,this.unplaced=n,this.frontier=[],this.placed=ye.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=ye.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(t<0?this.$to:n.doc.resolve(t));if(!i)return null;let o=this.placed,s=n.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let u=new _e(o,s,a);return t>-1?new vt(n.pos,t,this.$to.pos,this.$to.end(),u,r):u.size||n.pos!=this.$to.pos?new Kt(n.pos,i.pos,u):null}findFittable(){let t=this.unplaced.openStart;for(let r=this.unplaced.content,n=0,i=this.unplaced.openEnd;n1&&(i=0),o.type.spec.isolating&&i<=n){t=n;break}r=o.content}for(let r=1;r<=2;r++)for(let n=r==1?t:this.unplaced.openStart;n>=0;n--){let i,o=null;n?(o=CT(this.unplaced.content,n-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:u,match:c}=this.frontier[a],f,h=null;if(r==1&&(s?c.matchType(s.type)||(h=c.fillBefore(ye.from(s),!1)):o&&u.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:a,parent:o,inject:h};if(r==2&&s&&(f=c.findWrapping(s.type)))return{sliceDepth:n,frontierDepth:a,parent:o,wrap:f};if(o&&c.matchType(o.type))break}}}openMore(){let{content:t,openStart:r,openEnd:n}=this.unplaced;return kT(t,-1)<=r?!1:(this.unplaced.size>1&&kT(t,1)>n&&n++,this.unplaced=new _e(t,r+1,n),!0)}dropNode(){let{content:t,openStart:r,openEnd:n}=this.unplaced,i=CT(t,r);if(i.childCount<=1&&r>0){let o=t.size-r<=r+i.size;this.unplaced=new _e(Pl(t,r-1,1),r-1,o?r-1:n)}else this.unplaced=new _e(Pl(t,r,1),r,n)}placeNodes({sliceDepth:t,frontierDepth:r,parent:n,inject:i,wrap:o}){for(;this.depth>r;)this.closeFrontierNode();if(o)for(let g=0;g1||u==0||g.content.size)&&(h=y,f.push(PT(g.mark(p.allowedMarks(g.marks)),c==1?u:0,c==a.childCount?d:-1)))}let m=c==a.childCount;m||(d=-1),this.placed=zl(this.placed,r,ye.from(f)),this.frontier[r].match=h,m&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=a;g1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(t){e:for(let r=Math.min(this.depth,t.depth);r>=0;r--){let{match:n,type:i}=this.frontier[r],o=r=0;a--){let{match:u,type:c}=this.frontier[a],f=zg(t,a,c,u,!0);if(!f||f.childCount)continue e}return{depth:r,fit:s,move:o?t.doc.resolve(t.after(r+1)):t}}}}close(t){let r=this.findCloseLevel(t);if(!r)return null;for(;this.depth>r.depth;)this.closeFrontierNode();r.fit.childCount&&(this.placed=zl(this.placed,r.depth,r.fit)),t=r.move;for(let n=r.depth+1;n<=t.depth;n++){let i=t.node(n),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(n));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,r=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=zl(this.placed,this.depth,ye.from(t.create(r,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let r=this.frontier.pop().match.fillBefore(ye.empty,!0);r.childCount&&(this.placed=zl(this.placed,this.frontier.length,r))}};function Pl(e,t,r){return t==0?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(Pl(e.firstChild.content,t-1,r)))}function zl(e,t,r){return t==0?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(zl(e.lastChild.content,t-1,r)))}function CT(e,t){for(let r=0;r1&&(n=n.replaceChild(0,PT(n.firstChild,t-1,n.childCount==1?r-1:0))),t>0&&(n=e.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(ye.empty,!0)))),e.copy(n)}function zg(e,t,r,n,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!r.compatibleContent(o.type))return null;let a=n.fillBefore(o.content,!0,s);return a&&!sB(r,o.content,s)?a:null}function sB(e,t,r){for(let n=r;n0;p--,d--){let m=i.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?a=p:i.before(p)==d&&s.splice(1,0,-p)}let u=s.indexOf(a),c=[],f=n.openStart;for(let p=n.content,d=0;;d++){let m=p.firstChild;if(c.push(m),d==n.openStart)break;p=m.content}for(let p=f-1;p>=0;p--){let d=c[p],m=aB(d.type);if(m&&!d.sameMarkup(i.node(Math.abs(a)-1)))f=p;else if(m||!d.type.isTextblock)break}for(let p=n.openStart;p>=0;p--){let d=(p+f+1)%(n.openStart+1),m=c[d];if(m)for(let g=0;g=0&&(e.replace(t,r,n),!(e.steps.length>h));p--){let d=s[p];d<0||(t=i.before(d),r=o.after(d))}}function zT(e,t,r,n,i){if(tn){let o=i.contentMatchAt(0),s=o.fillBefore(e).append(e);e=s.append(o.matchFragment(s).fillBefore(ye.empty,!0))}return e}function uB(e,t,r,n){if(!n.isInline&&t==r&&e.doc.resolve(t).parent.content.size){let i=oB(e.doc,t,n.type);i!=null&&(t=r=i)}e.replaceRange(t,r,new _e(ye.from(n),0,0))}function cB(e,t,r){let n=e.doc.resolve(t),i=e.doc.resolve(r);if(n.parent.isTextblock&&i.parent.isTextblock&&n.start()!=i.start()&&n.parentOffset==0&&i.parentOffset==0){let s=n.sharedDepth(r),a=!1;for(let u=n.depth;u>s;u--)n.node(u).type.spec.isolating&&(a=!0);for(let u=i.depth;u>s;u--)i.node(u).type.spec.isolating&&(a=!0);if(!a){for(let u=n.depth;u>0&&t==n.start(u);u--)t=n.before(u);for(let u=i.depth;u>0&&r==i.start(u);u--)r=i.before(u);n=e.doc.resolve(t),i=e.doc.resolve(r)}}let o=UT(n,i);for(let s=0;s0&&(u||n.node(a-1).canReplace(n.index(a-1),i.indexAfter(a-1))))return e.delete(n.before(a),i.after(a))}for(let s=1;s<=n.depth&&s<=i.depth;s++)if(t-n.start(s)==n.depth-s&&r>n.end(s)&&i.end(s)-r!=i.depth-s&&n.start(s-1)==i.start(s-1)&&n.node(s-1).canReplace(n.index(s-1),i.index(s-1)))return e.delete(n.before(s),r);e.delete(t,r)}function UT(e,t){let r=[],n=Math.min(e.depth,t.depth);for(let i=n;i>=0;i--){let o=e.start(i);if(ot.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(o==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==o-1)&&r.push(i)}return r}var Uf=class e extends yt{constructor(t,r,n){super(),this.pos=t,this.attr=r,this.value=n}apply(t){let r=t.nodeAt(this.pos);if(!r)return At.fail("No node at attribute step's position");let n=Object.create(null);for(let o in r.attrs)n[o]=r.attrs[o];n[this.attr]=this.value;let i=r.type.create(n,null,r.marks);return At.fromReplace(t,this.pos,this.pos+1,new _e(ye.from(i),0,r.isLeaf?0:1))}getMap(){return Ln.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new e(r.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,r){if(typeof r.pos!="number"||typeof r.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new e(r.pos,r.attr,r.value)}};yt.jsonID("attr",Uf);var qf=class e extends yt{constructor(t,r){super(),this.attr=t,this.value=r}apply(t){let r=Object.create(null);for(let i in t.attrs)r[i]=t.attrs[i];r[this.attr]=this.value;let n=t.type.create(r,t.content,t.marks);return At.ok(n)}getMap(){return Ln.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,r){if(typeof r.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e(r.attr,r.value)}};yt.jsonID("docAttr",qf);var Ps=class extends Error{};Ps=function e(t){let r=Error.call(this,t);return r.__proto__=e.prototype,r};Ps.prototype=Object.create(Error.prototype);Ps.prototype.constructor=Ps;Ps.prototype.name="TransformError";var zs=class{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new ql}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let r=this.maybeStep(t);if(r.failed)throw new Ps(r.failed);return this}maybeStep(t){let r=t.apply(this.doc);return r.failed||this.addStep(t,r.doc),r}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,r=-1e9;for(let n=0;n{t=Math.min(t,a),r=Math.max(r,u)})}return t==1e9?null:{from:t,to:r}}addStep(t,r){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=r}replace(t,r=t,n=_e.empty){let i=Wl(this.doc,t,r,n);return i&&this.step(i),this}replaceWith(t,r,n){return this.replace(t,r,new _e(ye.from(n),0,0))}delete(t,r){return this.replace(t,r,_e.empty)}insert(t,r){return this.replaceWith(t,t,r)}replaceRange(t,r,n){return lB(this,t,r,n),this}replaceRangeWith(t,r,n){return uB(this,t,r,n),this}deleteRange(t,r){return cB(this,t,r),this}lift(t,r){return XM(this,t,r),this}join(t,r=1){return iB(this,t,r),this}wrap(t,r){return YM(this,t,r),this}setBlockType(t,r=t,n,i=null){return QM(this,t,r,n,i),this}setNodeMarkup(t,r,n=null,i){return tB(this,t,r,n,i),this}setNodeAttribute(t,r,n){return this.step(new Uf(t,r,n)),this}setDocAttribute(t,r){return this.step(new qf(t,r)),this}addNodeMark(t,r){return this.step(new Hl(t,r)),this}removeNodeMark(t,r){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(r instanceof Le)r.isInSet(n.marks)&&this.step(new Ls(t,r));else{let i=n.marks,o,s=[];for(;o=r.isInSet(i);)s.push(new Ls(t,o)),i=o.removeFromSet(i);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(t,r=1,n){return rB(this,t,r,n),this}addMark(t,r,n){return GM(this,t,r,n),this}removeMark(t,r,n){return KM(this,t,r,n),this}clearIncompatible(t,r,n){return Hg(this,t,r,n),this}};var Vg=Object.create(null),ke=class{constructor(t,r,n){this.$anchor=t,this.$head=r,this.ranges=n||[new Pn(t.min(r),t.max(r))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let r=0;r=0;o--){let s=r<0?qs(t.node(0),t.node(o),t.before(o+1),t.index(o),r,n):qs(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,r,n);if(s)return s}return null}static near(t,r=1){return this.findFrom(t,r)||this.findFrom(t,-r)||new ar(t.node(0))}static atStart(t){return qs(t,t,0,0,1)||new ar(t)}static atEnd(t){return qs(t,t,t.content.size,t.childCount,-1)||new ar(t)}static fromJSON(t,r){if(!r||!r.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Vg[r.type];if(!n)throw new RangeError(`No selection type ${r.type} defined`);return n.fromJSON(t,r)}static jsonID(t,r){if(t in Vg)throw new RangeError("Duplicate use of selection JSON ID "+t);return Vg[t]=r,r.prototype.jsonID=t,r}getBookmark(){return Ne.between(this.$anchor,this.$head).getBookmark()}};ke.prototype.visible=!0;var Pn=class{constructor(t,r){this.$from=t,this.$to=r}},qT=!1;function jT(e){!qT&&!e.parent.inlineContent&&(qT=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var Ne=class e extends ke{constructor(t,r=t){jT(t),jT(r),super(t,r)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,r){let n=t.resolve(r.map(this.head));if(!n.parent.inlineContent)return ke.near(n);let i=t.resolve(r.map(this.anchor));return new e(i.parent.inlineContent?i:n,n)}replace(t,r=_e.empty){if(super.replace(t,r),r==_e.empty){let n=this.$from.marksAcross(this.$to);n&&t.ensureMarks(n)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Wf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,r){if(typeof r.anchor!="number"||typeof r.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(r.anchor),t.resolve(r.head))}static create(t,r,n=r){let i=t.resolve(r);return new this(i,n==r?i:t.resolve(n))}static between(t,r,n){let i=t.pos-r.pos;if((!n||i)&&(n=i>=0?1:-1),!r.parent.inlineContent){let o=ke.findFrom(r,n,!0)||ke.findFrom(r,-n,!0);if(o)r=o.$head;else return ke.near(r,n)}return t.parent.inlineContent||(i==0?t=r:(t=(ke.findFrom(t,-n,!0)||ke.findFrom(t,n,!0)).$anchor,t.pos0?0:1);i>0?s=0;s+=i){let a=t.child(s);if(a.isAtom){if(!o&&Ce.isSelectable(a))return Ce.create(e,r-(i<0?a.nodeSize:0))}else{let u=qs(e,a,r+i,i<0?a.childCount:0,i,o);if(u)return u}r+=a.nodeSize*i}return null}function HT(e,t,r){let n=e.steps.length-1;if(n{s==null&&(s=f)}),e.setSelection(ke.near(e.doc.resolve(s),r))}var WT=1,Hf=2,VT=4,Vf=class extends zs{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Hf,this}ensureMarks(t){return Le.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Hf)>0}addStep(t,r){super.addStep(t,r),this.updated=this.updated&~Hf,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,r=!0){let n=this.selection;return r&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Le.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,r,n){let i=this.doc.type.schema;if(r==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(n==null&&(n=r),!t)return this.deleteRange(r,n);let o=this.storedMarks;if(!o){let s=this.doc.resolve(r);o=n==r?s.marks():s.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(r,n,i.text(t,o)),!this.selection.empty&&this.selection.to==r+t.length&&this.setSelection(ke.near(this.selection.$to)),this}}setMeta(t,r){return this.meta[typeof t=="string"?t:t.key]=r,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=VT,this}get scrolledIntoView(){return(this.updated&VT)>0}};function GT(e,t){return!t||!e?e:e.bind(t)}var ho=class{constructor(t,r,n){this.name=t,this.init=GT(r.init,n),this.apply=GT(r.apply,n)}},hB=[new ho("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new ho("selection",{init(e,t){return e.selection||ke.atStart(t.doc)},apply(e){return e.selection}}),new ho("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,r,n){return n.selection.$cursor?e.storedMarks:null}}),new ho("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Vl=class{constructor(t,r){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=hB.slice(),r&&r.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new ho(n.key,n.spec.state,n))})}},$g=class e{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,r=-1){for(let n=0;nn.toJSON())),t&&typeof t=="object")for(let n in t){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[n],o=i.spec.state;o&&o.toJSON&&(r[n]=o.toJSON.call(i,this[i.key]))}return r}static fromJSON(t,r,n){if(!r)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new Vl(t.schema,t.plugins),o=new e(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=jr.fromJSON(t.schema,r.doc);else if(s.name=="selection")o.selection=ke.fromJSON(o.doc,r.selection);else if(s.name=="storedMarks")r.storedMarks&&(o.storedMarks=r.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let a in n){let u=n[a],c=u.spec.state;if(u.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(r,a)){o[s.name]=c.fromJSON.call(u,t,r[a],o);return}}o[s.name]=s.init(t,o)}}),o}};function KT(e,t,r){for(let n in e){let i=e[n];i instanceof Function?i=i.bind(t):n=="handleDOMEvents"&&(i=KT(i,t,{})),r[n]=i}return r}var Lt=class{constructor(t){this.spec=t,this.props={},t.props&&KT(t.props,this,this.props),this.key=t.key?t.key.key:$T("plugin")}getState(t){return t[this.key]}},Gg=Object.create(null);function $T(e){return e in Gg?e+"$"+ ++Gg[e]:(Gg[e]=0,e+"$")}var fn=class{constructor(t="key"){this.key=$T(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}};var D0={};Ut(D0,{Decoration:()=>Zt,DecorationSet:()=>ct,EditorView:()=>rh,__endComposition:()=>UL,__parseFromClipboard:()=>zL});var St=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Vs=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},e0=null,Un=function(e,t,r){let n=e0||(e0=document.createRange());return n.setEnd(e,r??e.nodeValue.length),n.setStart(e,t||0),n},dB=function(){e0=null},_o=function(e,t,r,n){return r&&(XT(e,t,r,n,-1)||XT(e,t,r,n,1))},pB=/^(img|br|input|textarea|hr)$/i;function XT(e,t,r,n,i){for(var o;;){if(e==r&&t==n)return!0;if(t==(i<0?0:kr(e))){let s=e.parentNode;if(!s||s.nodeType!=1||eu(e)||pB.test(e.nodeName)||e.contentEditable=="false")return!1;t=St(e)+(i<0?0:1),e=s}else if(e.nodeType==1){let s=e.childNodes[t+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)t+=i;else return!1;else e=s,t=i<0?kr(e):0}else return!1}}function kr(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function mB(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=kr(e)}else if(e.parentNode&&!eu(e))t=St(e),e=e.parentNode;else return null}}function gB(e,t){for(;;){if(e.nodeType==3&&t2),Cr=Gs||(hn?/Mac/.test(hn.platform):!1),CC=hn?/Win/.test(hn.platform):!1,qn=/Android \d/.test(Ti),tu=!!ZT&&"webkitFontSmoothing"in ZT.documentElement.style,bB=tu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function _B(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function zn(e,t){return typeof e=="number"?e:e[t]}function xB(e){let t=e.getBoundingClientRect(),r=t.width/e.offsetWidth||1,n=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*r,top:t.top,bottom:t.top+e.clientHeight*n}}function JT(e,t,r){if(!i0(t)&&t.left==0)return;let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=r||e.dom;s;){if(s.nodeType!=1){s=Vs(s);continue}let a=s,u=a==o.body,c=u?_B(o):xB(a),f=0,h=0;if(t.topc.bottom-zn(n,"bottom")&&(h=t.bottom-t.top>c.bottom-c.top?t.top+zn(i,"top")-c.top:t.bottom-c.bottom+zn(i,"bottom")),t.leftc.right-zn(n,"right")&&(f=t.right-c.right+zn(i,"right")),f||h)if(u)o.defaultView.scrollBy(f,h);else{let d=a.scrollLeft,m=a.scrollTop;h&&(a.scrollTop+=h),f&&(a.scrollLeft+=f);let g=a.scrollLeft-d,y=a.scrollTop-m;t={left:t.left-g,top:t.top-y,right:t.right-g,bottom:t.bottom-y}}let p=u?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Vs(s)}}function EB(e){let t=e.dom.getBoundingClientRect(),r=Math.max(0,t.top),n,i;for(let o=(t.left+t.right)/2,s=r+1;s=r-20){n=a,i=u.top;break}}return{refDOM:n,refTop:i,stack:kC(e.dom)}}function kC(e){let t=[],r=e.ownerDocument;for(let n=e;n&&(t.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=r);n=Vs(n));return t}function AB({refDOM:e,refTop:t,stack:r}){let n=e?e.getBoundingClientRect().top:0;DC(r,n==0?0:n-t)}function DC(e,t){for(let r=0;r=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let g=m.left>t.left?m.left-t.left:m.right=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!u&&m.left<=t.left&&m.right>=t.left&&(u=f,c={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!r&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(o=h+1)}}return!r&&u&&(r=u,i=c,n=0),r&&r.nodeType==3?TB(r,i):!r||n&&r.nodeType==1?{node:e,offset:o}:NC(r,i)}function TB(e,t){let r=e.nodeValue.length,n=document.createRange(),i;for(let o=0;o=(s.left+s.right)/2?1:0)};break}}return n.detach(),i||{node:e,offset:0}}function b0(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function CB(e,t){let r=e.parentNode;return r&&/^li$/i.test(r.nodeName)&&t.left(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(n,i,o)}function DB(e,t,r,n){let i=-1;for(let o=t,s=!1;o!=e.dom;){let a=e.docView.nearestDesc(o,!0),u;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((u=a.dom.getBoundingClientRect()).width||u.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&u.left>n.left||u.top>n.top?i=a.posBefore:(!s&&u.right-1?i:e.docView.posFromDOM(t,r,-1)}function OC(e,t,r){let n=e.childNodes.length;if(n&&r.topt.top&&i++}let c;tu&&i&&n.nodeType==1&&(c=n.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=t.top&&i--,n==e.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&t.top>n.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(a=DB(e,n,i,t))}a==null&&(a=kB(e,s,t));let u=e.docView.nearestDesc(s,!0);return{pos:a,inside:u?u.posAtStart-u.border:-1}}function i0(e){return e.top=0&&i==n.nodeValue.length?(u--,f=1):r<0?u--:c++,Gl(xi(Un(n,u,c),f),f<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&i&&(r<0||i==kr(n))){let u=n.childNodes[i-1];if(u.nodeType==1)return Zg(u.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(r<0||i==kr(n))){let u=n.childNodes[i-1],c=u.nodeType==3?Un(u,kr(u)-(s?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(c)return Gl(xi(c,1),!1)}if(o==null&&i=0)}function Gl(e,t){if(e.width==0)return e;let r=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function Zg(e,t){if(e.height==0)return e;let r=t?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function IC(e,t,r){let n=e.state,i=e.root.activeElement;n!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return r()}finally{n!=t&&e.updateState(n),i!=e.dom&&i&&i.focus()}}function RB(e,t,r){let n=t.selection,i=r=="up"?n.$from:n.$to;return IC(e,t,()=>{let{node:o}=e.docView.domFromPos(i.pos,r=="up"?-1:1);for(;;){let a=e.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=RC(e,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let u;if(a.nodeType==1)u=a.getClientRects();else if(a.nodeType==3)u=Un(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;cf.top+1&&(r=="up"?s.top-f.top>(f.bottom-s.top)*2:f.bottom-s.bottom>(s.bottom-f.top)*2))return!1}}return!0})}var IB=/[\u0590-\u08ac]/;function FB(e,t,r){let{$head:n}=t.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,o=!i,s=i==n.parent.content.size,a=e.domSelection();return a?!IB.test(n.parent.textContent)||!a.modify?r=="left"||r=="backward"?o:s:IC(e,t,()=>{let{focusNode:u,focusOffset:c,anchorNode:f,anchorOffset:h}=e.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",r,"character");let d=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:m,focusOffset:g}=e.domSelectionRange(),y=m&&!d.contains(m.nodeType==1?m:m.parentNode)||u==m&&c==g;try{a.collapse(f,h),u&&(u!=f||c!=h)&&a.extend&&a.extend(u,c)}catch{}return p!=null&&(a.caretBidiLevel=p),y}):n.pos==n.start()||n.pos==n.end()}var YT=null,QT=null,eC=!1;function MB(e,t,r){return YT==t&&QT==r?eC:(YT=t,QT=r,eC=r=="up"||r=="down"?RB(e,t,r):FB(e,t,r))}var Nr=0,tC=1,mo=2,Hr=3,xo=class{constructor(t,r,n,i){this.parent=t,this.children=r,this.dom=n,this.contentDOM=i,this.dirty=Nr,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,r,n){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let r=0;rSt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(r==0)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&r==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(t,r=!1){for(let n=!0,i=t;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!r||o.node))if(n&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))n=!1;else return o}}getDesc(t){let r=t.pmViewDesc;for(let n=r;n;n=n.parent)if(n==this)return r}posFromDOM(t,r,n){for(let i=t;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(t,r,n)}return-1}descAt(t){for(let r=0,n=0;rt||s instanceof $f){i=t-o;break}o=a}if(i)return this.children[n].domFromPos(i-this.children[n].border,r);for(let o;n&&!(o=this.children[n-1]).size&&o instanceof Gf&&o.side>=0;n--);if(r<=0){let o,s=!0;for(;o=n?this.children[n-1]:null,!(!o||o.dom.parentNode==this.contentDOM);n--,s=!1);return o&&r&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,r):{node:this.contentDOM,offset:o?St(o.dom)+1:0}}else{let o,s=!0;for(;o=n=f&&r<=c-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(t,r,f);t=s;for(let h=a;h>0;h--){let p=this.children[h-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){i=St(p.dom)+1;break}t-=p.size}i==-1&&(i=0)}if(i>-1&&(c>r||a==this.children.length-1)){r=c;for(let f=a+1;fm&&sr){let m=a;a=u,u=m}let d=document.createRange();d.setEnd(u.node,u.offset),d.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,r){for(let n=0,i=0;i=n:tn){let a=n+o.border,u=s-o.border;if(t>=a&&r<=u){this.dirty=t==n||r==s?mo:tC,t==a&&r==u&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Hr:o.markDirty(t-a,r-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?mo:Hr}n=s}this.dirty=mo}markParentsDirty(){let t=1;for(let r=this.parent;r;r=r.parent,t++){let n=t==1?mo:tC;r.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!r.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.hasAttribute("contenteditable")||(s.contentEditable="false"),s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=r,this.widget=r,o=this}matchesWidget(t){return this.dirty==Nr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let r=this.widget.spec.stopEvent;return r?r(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},o0=class extends xo{constructor(t,r,n,i){super(t,[],r,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(t,r){return t!=this.textDOM?this.posAtStart+(r?this.size:0):this.posAtStart+r}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}},yo=class e extends xo{constructor(t,r,n,i,o){super(t,[],n,i),this.mark=r,this.spec=o}static create(t,r,n,i){let o=i.nodeViews[r.type.name],s=o&&o(r,i,n);return(!s||!s.dom)&&(s=bi.renderSpec(document,r.type.spec.toDOM(r,n),null,r.attrs)),new e(t,r,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Hr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Hr&&this.mark.eq(t)}markDirty(t,r){if(super.markDirty(t,r),this.dirty!=Nr){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty0&&(o=u0(o,0,t,n));for(let a=0;a{if(!u)return s;if(u.parent)return u.parent.posBeforeChild(u)},n,i),f=c&&c.dom,h=c&&c.contentDOM;if(r.isText){if(!f)f=document.createTextNode(r.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:h}=bi.renderSpec(document,r.type.spec.toDOM(r),null,r.attrs));!h&&!r.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),r.type.spec.draggable&&(f.draggable=!0));let p=f;return f=BC(f,n,r),c?u=new s0(t,r,n,i,f,h||null,p,c):r.isText?new Kf(t,r,n,i,f,p):new e(t,r,n,i,f,h||null,p)}parseRule(t){if(this.node.type.spec.reparseInView)return null;let r={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(r.preserveWhitespace="full"),!this.contentDOM)r.getContent=()=>this.node.content;else if(!this.contentLost)r.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let i=this.children[n];if(this.dom.contains(i.dom.parentNode)){r.contentElement=i.dom.parentNode;break}}if(!r.contentElement){let n=t&&t.find(i=>i.nodeType==1&&t.indexOf(i.parentNode)<0&&this.dom.contains(i));n?r.contentElement=n:r.getContent=()=>ye.empty}}return r}matchesNode(t,r,n){return this.dirty==Nr&&t.eq(this.node)&&Xf(r,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,r){let n=this.node.inlineContent,i=r,o=t.composing?this.localCompositionInfo(t,r):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,u=new l0(this,s&&s.node,t);zB(this.node,this.innerDeco,(c,f,h)=>{c.spec.marks?u.syncToMarks(c.spec.marks,n,t,f):c.type.side>=0&&!h&&u.syncToMarks(f==this.node.childCount?Le.none:this.node.child(f).marks,n,t,f),u.placeWidget(c,t,i)},(c,f,h,p)=>{u.syncToMarks(c.marks,n,t,p);let d;u.findNodeMatch(c,f,h,p)||a&&t.state.selection.from>i&&t.state.selection.to-1&&u.updateNodeAt(c,f,h,d,t)||u.updateNextNode(c,f,h,t,p,i)||u.addNode(c,f,h,t,i),i+=c.nodeSize}),u.syncToMarks([],n,t,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==mo)&&(s&&this.protectLocalComposition(t,s),FC(this.contentDOM,this.children,t),Gs&&UB(this.dom))}localCompositionInfo(t,r){let{from:n,to:i}=t.state.selection;if(!(t.state.selection instanceof Ne)||nr+this.node.content.size)return null;let o=t.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,a=qB(this.node.content,s,n-r,i-r);return a<0?null:{node:o,pos:a,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(t,{node:r,pos:n,text:i}){if(this.getDesc(r))return;let o=r;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new o0(this,o,r,i);t.input.compositionNodes.push(s),this.children=u0(this.children,n,n+i.length,t,s)}update(t,r,n,i){return this.dirty==Hr||!t.sameMarkup(this.node)?!1:(this.updateInner(t,r,n,i),!0)}updateInner(t,r,n,i){this.updateOuterDeco(r),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Nr}updateOuterDeco(t){if(Xf(t,this.outerDeco))return;let r=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=MC(this.dom,this.nodeDOM,a0(this.outerDeco,this.node,r),a0(t,this.node,r)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function rC(e,t,r,n,i){BC(n,t,e);let o=new Si(void 0,e,t,r,n,n,n);return o.contentDOM&&o.updateChildren(i,0),o}var Kf=class e extends Si{constructor(t,r,n,i,o,s){super(t,r,n,i,o,null,s)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,r,n,i){return this.dirty==Hr||this.dirty!=Nr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(r),(this.dirty!=Nr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=Nr,!0)}inParent(){let t=this.parent.contentDOM;for(let r=this.nodeDOM;r;r=r.parentNode)if(r==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,r,n){return t==this.nodeDOM?this.posAtStart+Math.min(r,this.node.text.length):super.localPosFromDOM(t,r,n)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,r,n){let i=this.node.cut(t,r),o=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,o,o)}markDirty(t,r){super.markDirty(t,r),this.dom!=this.nodeDOM&&(t==0||r==this.nodeDOM.nodeValue.length)&&(this.dirty=Hr)}get domAtom(){return!1}isText(t){return this.node.text==t}},$f=class extends xo{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Nr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},s0=class extends Si{constructor(t,r,n,i,o,s,a,u){super(t,r,n,i,o,s,a),this.spec=u}update(t,r,n,i){if(this.dirty==Hr)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let o=this.spec.update(t,r,n);return o&&this.updateInner(t,r,n,i),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,r,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,r,n,i){this.spec.setSelection?this.spec.setSelection(t,r,n.root):super.setSelection(t,r,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}};function FC(e,t,r){let n=e.firstChild,i=!1;for(let o=0;o>1,a=Math.min(s,t.length);for(;o-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=yo.create(this.top,t[s],r,n);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,s++}}findNodeMatch(t,r,n,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(t,r,n))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,u=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(n){let c=r.children[n-1];if(c instanceof yo)r=c,n=c.children.length;else{a=c,n--;break}}else{if(r==t)break e;n=r.parent.children.indexOf(r),r=r.parent}let u=a.node;if(u){if(u!=e.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function PB(e,t){return e.type.side-t.type.side}function zB(e,t,r,n){let i=t.locals(e),o=0;if(i.length==0){for(let c=0;co;)a.push(i[s++]);let m=o+p.nodeSize;if(p.isText){let y=m;s!y.inline):a.slice();n(p,g,t.forChild(o,p),d),o=m}}function UB(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function qB(e,t,r,n){for(let i=0,o=0;i=r){if(o>=n&&u.slice(n-t.length-a,n-a)==t)return n-t.length;let c=a=0&&c+t.length+a>=r)return a+c;if(r==n&&u.length>=n+t.length-a&&u.slice(n-a,n-a+t.length)==t)return n}}return-1}function u0(e,t,r,n,i){let o=[];for(let s=0,a=0;s=r||f<=t?o.push(u):(cr&&o.push(u.slice(r-c,u.size,n)))}return o}function _0(e,t=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let i=e.docView.nearestDesc(r.focusNode),o=i&&i.size==0,s=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(s<0)return null;let a=n.resolve(s),u,c;if(nh(r)){for(u=s;i&&!i.node;)i=i.parent;let h=i.node;if(i&&h.isAtom&&Ce.isSelectable(h)&&i.parent&&!(h.isInline&&yB(r.focusNode,r.focusOffset,i.dom))){let p=i.posBefore;c=new Ce(s==p?a:n.resolve(p))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let h=s,p=s;for(let d=0;d{(r.anchorNode!=n||r.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!LC(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function HB(e){let t=e.domSelection();if(!t)return;let r=e.cursorWrapper.dom,n=r.nodeName=="IMG";n?t.collapse(r.parentNode,St(r)+1):t.collapse(r,0),!n&&!e.state.selection.visible&&lr&&Ai<=11&&(r.disabled=!0,r.disabled=!1)}function PC(e,t){if(t instanceof Ce){let r=e.docView.descAt(t.from);r!=e.lastSelectedViewDesc&&(aC(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else aC(e)}function aC(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function x0(e,t,r,n){return e.someProp("createSelectionBetween",i=>i(e,t,r))||Ne.between(t,r,n)}function lC(e){return e.editable&&!e.hasFocus()?!1:zC(e)}function zC(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function WB(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),r=e.domSelectionRange();return _o(t.node,t.offset,r.anchorNode,r.anchorOffset)}function c0(e,t){let{$anchor:r,$head:n}=e.selection,i=t>0?r.max(n):r.min(n),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&ke.findFrom(o,t)}function Ei(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function uC(e,t,r){let n=e.state.selection;if(n instanceof Ne)if(r.indexOf("s")>-1){let{$head:i}=n,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=e.state.doc.resolve(i.pos+o.nodeSize*(t<0?-1:1));return Ei(e,new Ne(n.$anchor,s))}else if(n.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=c0(e.state,t);return i&&i instanceof Ce?Ei(e,i):!1}else if(!(Cr&&r.indexOf("m")>-1)){let i=n.$head,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=t<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=e.docView.descAt(a))&&!s.contentDOM?Ce.isSelectable(o)?Ei(e,new Ce(t<0?e.state.doc.resolve(i.pos-o.nodeSize):i)):tu?Ei(e,new Ne(e.state.doc.resolve(t<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(n instanceof Ce&&n.node.isInline)return Ei(e,new Ne(t>0?n.$to:n.$from));{let i=c0(e.state,t);return i?Ei(e,i):!1}}}function Zf(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Xl(e,t){let r=e.pmViewDesc;return r?r.size==0&&(t<0||e.nextSibling||e.nodeName!="BR"):e.nodeType==1&&e.contentEditable=="false"}function Hs(e,t){return t<0?VB(e):GB(e)}function VB(e){let t=e.domSelectionRange(),r=t.focusNode,n=t.focusOffset;if(!r)return;let i,o,s=!1;for(Dr&&r.nodeType==1&&n0){if(r.nodeType!=1)break;{let a=r.childNodes[n-1];if(Xl(a,-1))i=r,o=--n;else if(a.nodeType==3)r=a,n=r.nodeValue.length;else break}}else{if(UC(r))break;{let a=r.previousSibling;for(;a&&Xl(a,-1);)i=r.parentNode,o=St(a),a=a.previousSibling;if(a)r=a,n=Zf(r);else{if(r=r.parentNode,r==e.dom)break;n=0}}}s?f0(e,r,n):i&&f0(e,i,o)}function GB(e){let t=e.domSelectionRange(),r=t.focusNode,n=t.focusOffset;if(!r)return;let i=Zf(r),o,s;for(;;)if(n{e.state==i&&Hn(e)},50)}function cC(e,t){let r=e.state.doc.resolve(t);if(!(Tt||CC)&&r.parent.inlineContent){let i=e.coordsAtPos(t);if(t>r.start()){let o=e.coordsAtPos(t-1),s=(o.top+o.bottom)/2;if(s>i.top&&s1)return o.lefti.top&&s1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function fC(e,t,r){let n=e.state.selection;if(n instanceof Ne&&!n.empty||r.indexOf("s")>-1||Cr&&r.indexOf("m")>-1)return!1;let{$from:i,$to:o}=n;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let s=c0(e.state,t);if(s&&s instanceof Ce)return Ei(e,s)}if(!i.parent.inlineContent){let s=t<0?i:o,a=n instanceof ar?ke.near(s,t):ke.findFrom(s,t);return a?Ei(e,a):!1}return!1}function hC(e,t){if(!(e.state.selection instanceof Ne))return!0;let{$head:r,$anchor:n,empty:i}=e.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(o&&!o.isText){let s=e.state.tr;return t<0?s.delete(r.pos-o.nodeSize,r.pos):s.delete(r.pos,r.pos+o.nodeSize),e.dispatch(s),!0}return!1}function dC(e,t,r){e.domObserver.stop(),t.contentEditable=r,e.domObserver.start()}function XB(e){if(!zt||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(t&&t.nodeType==1&&r==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let n=t.firstChild;dC(e,n,"true"),setTimeout(()=>dC(e,n,"false"),20)}return!1}function ZB(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function JB(e,t){let r=t.keyCode,n=ZB(t);if(r==8||Cr&&r==72&&n=="c")return hC(e,-1)||Hs(e,-1);if(r==46&&!t.shiftKey||Cr&&r==68&&n=="c")return hC(e,1)||Hs(e,1);if(r==13||r==27)return!0;if(r==37||Cr&&r==66&&n=="c"){let i=r==37?cC(e,e.state.selection.from)=="ltr"?-1:1:-1;return uC(e,i,n)||Hs(e,i)}else if(r==39||Cr&&r==70&&n=="c"){let i=r==39?cC(e,e.state.selection.from)=="ltr"?1:-1:1;return uC(e,i,n)||Hs(e,i)}else{if(r==38||Cr&&r==80&&n=="c")return fC(e,-1,n)||Hs(e,-1);if(r==40||Cr&&r==78&&n=="c")return XB(e)||fC(e,1,n)||Hs(e,1);if(n==(Cr?"m":"c")&&(r==66||r==73||r==89||r==90))return!0}return!1}function E0(e,t){e.someProp("transformCopied",d=>{t=d(t,e)});let r=[],{content:n,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,o--;let d=n.firstChild;r.push(d.type.name,d.attrs!=d.type.defaultAttrs?d.attrs:null),n=d.content}let s=e.someProp("clipboardSerializer")||bi.fromSchema(e.state.schema),a=VC(),u=a.createElement("div");u.appendChild(s.serializeFragment(n,{document:a}));let c=u.firstChild,f,h=0;for(;c&&c.nodeType==1&&(f=WC[c.nodeName.toLowerCase()]);){for(let d=f.length-1;d>=0;d--){let m=a.createElement(f[d]);for(;u.firstChild;)m.appendChild(u.firstChild);u.appendChild(m),h++}c=u.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${h?` -${h}`:""} ${JSON.stringify(r)}`);let p=e.someProp("clipboardTextSerializer",d=>d(t,e))||t.content.textBetween(0,t.content.size,` + +`);return{dom:u,text:p,slice:t}}function A0(e,t,r,n,i){let o=i.parent.type.spec.code,s,a;if(!r&&!t)return null;let u=!!t&&(n||o||!r);if(u){if(e.someProp("transformPastedText",p=>{t=p(t,o||n,e)}),o)return a=new _e(ye.from(e.state.schema.text(t.replace(/\r\n?/g,` +`))),0,0),e.someProp("transformPasted",p=>{a=p(a,e,!0)}),a;let h=e.someProp("clipboardTextParser",p=>p(t,i,n,e));if(h)a=h;else{let p=i.marks(),{schema:d}=e.state,m=bi.fromSchema(d);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(d.text(g,p)))})}}else e.someProp("transformPastedHTML",h=>{r=h(r,e)}),s=tL(r),tu&&rL(s);let c=s&&s.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let h=+f[3];h>0;h--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||Bs.fromSchema(e.state.schema)).parseSlice(s,{preserveWhitespace:!!(u||f),context:i,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!YB.test(p.parentNode.nodeName)?{ignore:!0}:null}})),f)a=nL(pC(a,+f[1],+f[2]),f[4]);else if(a=_e.maxOpen(QB(a.content,i),!0),a.openStart||a.openEnd){let h=0,p=0;for(let d=a.content.firstChild;h{a=h(a,e,u)}),a}var YB=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function QB(e,t){if(e.childCount<2)return e;for(let r=t.depth;r>=0;r--){let i=t.node(r).contentMatchAt(t.index(r)),o,s=[];if(e.forEach(a=>{if(!s)return;let u=i.findWrapping(a.type),c;if(!u)return s=null;if(c=s.length&&o.length&&jC(u,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=HC(s[s.length-1],o.length));let f=qC(a,u);s.push(f),i=i.matchType(f.type),o=u}}),s)return ye.from(s)}return e}function qC(e,t,r=0){for(let n=t.length-1;n>=r;n--)e=t[n].create(null,ye.from(e));return e}function jC(e,t,r,n,i){if(i1&&(o=0),i=r&&(a=t<0?s.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(ye.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function pC(e,t,r){return tr})}return Kl.createHTML(e)}function tL(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let r=VC(),n=r.body,i=/<([a-z][^>\s]+)/i.exec(e),o;if((o=i&&WC[i[1].toLowerCase()])&&(e=o.map(s=>"<"+s+">").join("")+e+o.map(s=>"").reverse().join("")),n.innerHTML=eL(e),o)for(let s=0;s=0;a-=2){let u=r.nodes[n[a]];if(!u||u.hasRequiredAttrs())break;try{u.checkAttrs(n[a+1])}catch{break}i=ye.from(u.create(n[a+1],i)),o++,s++}return new _e(i,o,s)}var $t={},Xt={},iL={touchstart:!0,touchmove:!0},d0=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function oL(e){for(let t in $t){let r=$t[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=n=>{aL(e,n)&&!S0(e,n)&&(e.editable||!(n.type in Xt))&&r(e,n)},iL[t]?{passive:!0}:void 0)}zt&&e.dom.addEventListener("input",()=>null),p0(e)}function jn(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function sL(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function p0(e){e.someProp("handleDOMEvents",t=>{for(let r in t)e.input.eventHandlers[r]||e.dom.addEventListener(r,e.input.eventHandlers[r]=n=>S0(e,n))})}function S0(e,t){return e.someProp("handleDOMEvents",r=>{let n=r[t.type];return n?n(e,t)||t.defaultPrevented:!1})}function aL(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let r=t.target;r!=e.dom;r=r.parentNode)if(!r||r.nodeType==11||r.pmViewDesc&&r.pmViewDesc.stopEvent(t))return!1;return!0}function lL(e,t){!S0(e,t)&&$t[t.type]&&(e.editable||!(t.type in Xt))&&$t[t.type](e,t)}Xt.keydown=(e,t)=>{let r=t;if(e.input.shiftKey=r.keyCode==16||r.shiftKey,!$C(e)&&(e.input.lastKeyCode=r.keyCode,e.input.lastKeyCodeTime=Date.now(),!(qn&&Tt&&r.keyCode==13)))if(r.keyCode!=229&&e.domObserver.forceFlush(),Gs&&r.keyCode==13&&!r.ctrlKey&&!r.altKey&&!r.metaKey){let n=Date.now();e.input.lastIOSEnter=n,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==n&&(e.someProp("handleKeyDown",i=>i(e,po(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",n=>n(e,r))||JB(e,r)?r.preventDefault():jn(e,"key")};Xt.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};Xt.keypress=(e,t)=>{let r=t;if($C(e)||!r.charCode||r.ctrlKey&&!r.altKey||Cr&&r.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,r))){r.preventDefault();return}let n=e.state.selection;if(!(n instanceof Ne)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(r.charCode),o=()=>e.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",s=>s(e,n.$from.pos,n.$to.pos,i,o))&&e.dispatch(o()),r.preventDefault()}};function ru(e){return{left:e.clientX,top:e.clientY}}function uL(e,t){let r=t.x-e.clientX,n=t.y-e.clientY;return r*r+n*n<100}function T0(e,t,r,n,i){if(n==-1)return!1;let o=e.state.doc.resolve(n);for(let s=o.depth+1;s>0;s--)if(e.someProp(t,a=>s>o.depth?a(e,r,o.nodeAfter,o.before(s),i,!0):a(e,r,o.node(s),o.before(s),i,!1)))return!0;return!1}function nu(e,t,r){if(e.focused||e.focus(),e.state.selection.eq(t))return;let n=e.state.tr.setSelection(t);r=="pointer"&&n.setMeta("pointer",!0),e.dispatch(n)}function cL(e,t){if(t==-1)return!1;let r=e.state.doc.resolve(t),n=r.nodeAfter;return n&&n.isAtom&&Ce.isSelectable(n)?(nu(e,new Ce(r),"pointer"),!0):!1}function fL(e,t){if(t==-1)return!1;let r=e.state.selection,n,i;r instanceof Ce&&(n=r.node);let o=e.state.doc.resolve(t);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(Ce.isSelectable(a)){n&&r.$from.depth>0&&s>=r.$from.depth&&o.before(r.$from.depth+1)==r.$from.pos?i=o.before(r.$from.depth):i=o.before(s);break}}return i!=null?(nu(e,Ce.create(e.state.doc,i),"pointer"),!0):!1}function hL(e,t,r,n,i){return T0(e,"handleClickOn",t,r,n)||e.someProp("handleClick",o=>o(e,t,n))||(i?fL(e,r):cL(e,r))}function dL(e,t,r,n){return T0(e,"handleDoubleClickOn",t,r,n)||e.someProp("handleDoubleClick",i=>i(e,t,n))}function pL(e,t,r,n){return T0(e,"handleTripleClickOn",t,r,n)||e.someProp("handleTripleClick",i=>i(e,t,n))||mL(e,r,n)}function mL(e,t,r){if(r.button!=0)return!1;let n=GC(e,t,!0),i=e.state.doc;return n?(nu(e,n,"pointer"),n instanceof Ne&&i.eq(e.state.doc)&&(e.input.mouseDown=new g0(e,n)),!0):!1}function GC(e,t,r){let n=e.state.doc;if(t==-1)return n.inlineContent?Ne.create(n,0,n.content.size):null;let i=n.resolve(t);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)return Ne.create(n,a+1,a+1+s.content.size);if(r&&Ce.isSelectable(s))return Ce.create(n,a)}return null}function C0(e){return Zl(e)}var KC=Cr?"metaKey":"ctrlKey";$t.mousedown=(e,t)=>{let r=t;e.input.shiftKey=r.shiftKey;let n=C0(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&uL(r,e.input.lastClick)&&!r[KC]&&e.input.lastClick.button==r.button&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:i,x:r.clientX,y:r.clientY,type:o,button:r.button},e.input.mouseDown&&e.input.mouseDown.done();let s=e.posAtCoords(ru(r));s&&(o=="singleClick"?e.input.mouseDown=new m0(e,s,r,!!n):(o=="doubleClick"?dL:pL)(e,s.pos,s.inside,r)?r.preventDefault():jn(e,"pointer"))};var Jf=class{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},m0=class extends Jf{constructor(t,r,n,i){super(t),this.pos=r,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!n[KC],this.allowDefault=n.shiftKey;let o,s;if(r.inside>-1)o=t.state.doc.nodeAt(r.inside),s=r.inside;else{let f=t.state.doc.resolve(r.pos);o=f.parent,s=f.depth?f.before():0}let a=i?null:n.target,u=a?t.docView.nearestDesc(a,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:c}=t.state;n.button==0&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof Ce&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Dr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),jn(t,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Hn(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let r=this.pos;this.view.state.doc!=this.startDoc&&(r=this.view.posAtCoords(ru(t))),this.updateAllowDefault(t),this.allowDefault||!r?jn(this.view,"pointer"):hL(this.view,r.pos,r.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||zt&&this.mightDrag&&!this.mightDrag.node.isAtom||Tt&&!this.view.state.selection.visible&&Math.min(Math.abs(r.pos-this.view.state.selection.from),Math.abs(r.pos-this.view.state.selection.to))<=2)?(nu(this.view,ke.near(this.view.state.doc.resolve(r.pos)),"pointer"),t.preventDefault()):jn(this.view,"pointer")}move(t){this.updateAllowDefault(t),jn(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},g0=class extends Jf{constructor(t,r){super(t),this.startSelection=r,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),jn(this.view,"pointer");let r=this.view.posAtCoords(ru(t)),n=r&&GC(this.view,r.inside,!1);if(!n)return;let{doc:i}=this.view.state,o=this.startSelection,[s,a]=n.from{e.input.lastTouch=Date.now(),C0(e),jn(e,"pointer")};$t.touchmove=e=>{e.input.lastTouch=Date.now(),jn(e,"pointer")};$t.contextmenu=e=>C0(e);function $C(e,t){return e.composing?!0:zt&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var gL=qn?5e3:-1;Xt.compositionstart=Xt.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,r=t.selection.$to;if(t.selection instanceof Ne&&t.selection.empty&&(t.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||Tt&&CC&&yL(e)))e.markCursor=e.state.storedMarks||r.marks(),Zl(e,!0),e.markCursor=null;else if(Zl(e,!t.selection.empty),Dr&&t.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let n=e.domSelectionRange();for(let i=n.focusNode,o=n.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let a=e.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}e.input.composing=!0}XC(e,gL)};function yL(e){let{focusNode:t,focusOffset:r}=e.domSelectionRange();if(!t||t.nodeType!=1||r>=t.childNodes.length)return!1;let n=t.childNodes[r];return n.nodeType==1&&n.contentEditable=="false"}Xt.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,XC(e,20))};function XC(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Zl(e),t))}function ZC(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function vL(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let r=mB(t.focusNode,t.focusOffset),n=gB(t.focusNode,t.focusOffset);if(r&&n&&r!=n){let i=n.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(r==o||n==o)return o;if(!i||!i.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let s=r.pmViewDesc;if(!(!s||!s.isText(r.nodeValue)))return n}}return r||n}function Zl(e,t=!1){if(!(qn&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),ZC(e),t||e.docView&&e.docView.dirty){let r=_0(e),n=e.state.selection;return r&&!r.eq(n)?e.dispatch(e.state.tr.setSelection(r)):(e.markCursor||t)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function wL(e,t){if(!e.dom.parentNode)return;let r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(t),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{r.parentNode&&r.parentNode.removeChild(r),e.focus()},50)}var Jl=lr&&Ai<15||Gs&&bB<604;$t.copy=Xt.cut=(e,t)=>{let r=t,n=e.state.selection,i=r.type=="cut";if(n.empty)return;let o=Jl?null:r.clipboardData,s=n.content(),{dom:a,text:u}=E0(e,s);o?(r.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",u)):wL(e,a),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function bL(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function _L(e,t){if(!e.dom.parentNode)return;let r=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?Yl(e,n.value,null,i,t):Yl(e,n.textContent,n.innerHTML,i,t)},50)}function Yl(e,t,r,n,i){let o=A0(e,t,r,n,e.state.selection.$from);if(e.someProp("handlePaste",u=>u(e,i,o||_e.empty)))return!0;if(!o)return!1;let s=bL(o),a=s?e.state.tr.replaceSelectionWith(s,n):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function JC(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let r=e.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}Xt.paste=(e,t)=>{let r=t;if(e.composing&&!qn)return;let n=Jl?null:r.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;n&&Yl(e,JC(n),n.getData("text/html"),i,r)?r.preventDefault():_L(e,r)};var Yf=class{constructor(t,r,n){this.slice=t,this.move=r,this.node=n}},xL=Cr?"altKey":"ctrlKey";function YC(e,t){let r;return e.someProp("dragCopies",n=>{r=r||n(t)}),r!=null?!r:!t[xL]}$t.dragstart=(e,t)=>{let r=t,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(ru(r)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Ce?i.to-1:i.to))){if(n&&n.mightDrag)s=Ce.create(e.state.doc,n.mightDrag.pos);else if(r.target&&r.target.nodeType==1){let h=e.docView.nearestDesc(r.target,!0);h&&h.node.type.spec.draggable&&h!=e.docView&&(s=Ce.create(e.state.doc,h.posBefore))}}let a=(s||e.state.selection).content(),{dom:u,text:c,slice:f}=E0(e,a);(!r.dataTransfer.files.length||!Tt||TC>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(Jl?"Text":"text/html",u.innerHTML),r.dataTransfer.effectAllowed="copyMove",Jl||r.dataTransfer.setData("text/plain",c),e.dragging=new Yf(f,YC(e,r),s)};$t.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};Xt.dragover=Xt.dragenter=(e,t)=>t.preventDefault();Xt.drop=(e,t)=>{try{EL(e,t,e.dragging)}finally{e.dragging=null}};function EL(e,t,r){if(!t.dataTransfer)return;let n=e.posAtCoords(ru(t));if(!n)return;let i=e.state.doc.resolve(n.pos),o=r&&r.slice;o?e.someProp("transformPasted",d=>{o=d(o,e,!1)}):o=A0(e,JC(t.dataTransfer),Jl?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(r&&YC(e,t));if(e.someProp("handleDrop",d=>d(e,t,o||_e.empty,s))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?jf(e.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let u=e.state.tr;if(s){let{node:d}=r;d?d.replace(u):u.deleteSelection()}let c=u.mapping.map(a),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=u.doc;if(f?u.replaceRangeWith(c,c,o.content.firstChild):u.replaceRange(c,c,o),u.doc.eq(h))return;let p=u.doc.resolve(c);if(f&&Ce.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new Ce(p));else{let d=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((m,g,y,w)=>d=w),u.setSelection(x0(e,p,u.doc.resolve(d)))}e.focus(),e.dispatch(u.setMeta("uiEvent","drop"))}$t.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Hn(e)},20))};$t.blur=(e,t)=>{let r=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),r.relatedTarget&&e.dom.contains(r.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};$t.beforeinput=(e,t)=>{if(qn&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:n}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=n||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,po(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in Xt)$t[e]=Xt[e];function Ql(e,t){if(e==t)return!0;for(let r in e)if(e[r]!==t[r])return!1;for(let r in t)if(!(r in e))return!1;return!0}var Qf=class e{constructor(t,r){this.toDOM=t,this.spec=r||wo,this.side=this.spec.side||0}map(t,r,n,i){let{pos:o,deleted:s}=t.mapResult(r.from+i,this.side<0?-1:1);return s?null:new Zt(o-n,o-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Ql(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}},vo=class e{constructor(t,r){this.attrs=t,this.spec=r||wo}map(t,r,n,i){let o=t.map(r.from+i,this.spec.inclusiveStart?-1:1)-n,s=t.map(r.to+i,this.spec.inclusiveEnd?1:-1)-n;return o>=s?null:new Zt(o,s,this)}valid(t,r){return r.from=t&&(!o||o(a.spec))&&n.push(a.copy(a.from+i,a.to+i))}for(let s=0;st){let a=this.children[s]+1;this.children[s+2].findInner(t-a,r-a,n,i+a,o)}}map(t,r,n){return this==Pt||t.maps.length==0?this:this.mapInner(t,r,0,0,n||wo)}mapInner(t,r,n,i,o){let s;for(let a=0;a{let c=u+n,f;if(f=ek(r,a,c)){for(i||(i=this.children.slice());oa&&h.to=t){this.children[a]==t&&(n=this.children[a+2]);break}let o=t+1,s=o+r.content.size;for(let a=0;ao&&u.type instanceof vo){let c=Math.max(o,u.from)-o,f=Math.min(s,u.to)-o;ci.map(t,r,wo));return e.from(n)}forChild(t,r){if(r.isLeaf)return ct.empty;let n=[];for(let i=0;ir instanceof ct)?t:t.reduce((r,n)=>r.concat(n instanceof ct?n:n.members),[]))}}forEachSet(t){for(let r=0;r{let y=g-m-(d-p);for(let w=0;wE+f-h)continue;let b=a[w]+f-h;d>=b?a[w+1]=p<=b?-2:-1:p>=f&&y&&(a[w]+=y,a[w+1]+=y)}h+=y}),f=r.maps[c].map(f,-1)}let u=!1;for(let c=0;c=n.content.size){u=!0;continue}let p=r.map(e[c+1]+o,-1),d=p-i,{index:m,offset:g}=n.content.findIndex(h),y=n.maybeChild(m);if(y&&g==h&&g+y.nodeSize==d){let w=a[c+2].mapInner(r,y,f+1,e[c]+o+1,s);w!=Pt?(a[c]=h,a[c+1]=d,a[c+2]=w):(a[c+1]=-2,u=!0)}else u=!0}if(u){let c=SL(a,e,t,r,i,o,s),f=th(c,n,0,s);t=f.local;for(let h=0;hr&&s.to{let c=ek(e,a,u+r);if(c){o=!0;let f=th(c,a,r+u+1,n);f!=Pt&&i.push(u,u+a.nodeSize,f)}});let s=QC(o?tk(e):e,-r).sort(bo);for(let a=0;a0;)t++;e.splice(t,0,r)}function Yg(e){let t=[];return e.someProp("decorations",r=>{let n=r(e.state);n&&n!=Pt&&t.push(n)}),e.cursorWrapper&&t.push(ct.create(e.state.doc,[e.cursorWrapper.deco])),eh.from(t)}var TL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},CL=lr&&Ai<=11,v0=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}},w0=class{constructor(t,r){this.view=t,this.handleDOMChange=r,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new v0,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():zt&&t.composing&&n.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),CL&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,TL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let r=0;rthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(lC(this.view)){if(this.suppressingSelectionUpdates)return Hn(this.view);if(lr&&Ai<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&_o(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let r=new Set,n;for(let o=t.focusNode;o;o=Vs(o))r.add(o);for(let o=t.anchorNode;o;o=Vs(o))if(r.has(o)){n=o;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let r=this.pendingRecords();r.length&&(this.queue=[]);let n=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&lC(t)&&!this.ignoreSelectionChange(n),o=-1,s=-1,a=!1,u=[];if(t.editable)for(let f=0;ff.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Tt&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&r.some(f=>f.type=="childList"&&f.removedNodes.length))){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let h=f.nextSibling;for(;h&&h.nodeType==1;){if(h.contentEditable=="false"){f.parentNode.removeChild(f);break}h=h.firstChild}}}else if(Dr&&u.length){let f=u.filter(h=>h.nodeName=="BR");if(f.length==2){let[h,p]=f;h.parentNode&&h.parentNode.parentNode==p.parentNode?p.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let p of f){let d=p.parentNode;d&&d.nodeName=="LI"&&(!h||NL(t,h)!=d)&&p.remove()}}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||i)&&(o>-1&&(t.docView.markDirty(o,s),kL(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,OL(t,u)),this.handleDOMChange(o,s,a,u),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||Hn(t),this.currentSelection.set(n))}registerMutation(t,r){if(r.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(n==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!n||n.ignoreMutation(t))return null;if(t.type=="childList"){for(let f=0;fo;w--){let E=i.childNodes[w-1],b=E.pmViewDesc;if(E.nodeName=="BR"&&!b){s=w;break}if(!b||b.size)break}let p=e.state.doc,d=e.someProp("domParser")||Bs.fromSchema(e.state.schema),m=p.resolve(a),g=null,y=d.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:o,to:s,preserveWhitespace:m.parent.type.whitespace=="pre"?"full":!0,findPositions:f,ruleFromNode:IL(n),context:m});if(f&&f[0].pos!=null){let w=f[0].pos,E=f[1]&&f[1].pos;E==null&&(E=w),g={anchor:w+a,head:E+a}}return{doc:y,sel:g,from:a,to:u}}var IL=e=>t=>{let r=t.pmViewDesc;if(r)return r.parseRule(e);if(t.nodeName=="BR"&&t.parentNode){if(zt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||zt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null},FL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function ML(e,t,r,n,i){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let k=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,B=_0(e,k);if(B&&!e.state.selection.eq(B)){if(Tt&&qn&&e.input.lastKeyCode===13&&Date.now()-100P(e,po(13,"Enter"))))return;let O=e.state.tr.setSelection(B);k=="pointer"?O.setMeta("pointer",!0):k=="key"&&O.scrollIntoView(),o&&O.setMeta("composition",o),e.dispatch(O)}return}let s=e.state.doc.resolve(t),a=s.sharedDepth(r);t=s.before(a+1),r=e.state.doc.resolve(r).after(a+1);let u=e.state.selection,c=RL(e,t,r,i),f=e.state.doc,h=f.slice(c.from,c.to),p,d;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||qn)&&i.some(k=>k.nodeType==1&&!FL.test(k.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",k=>k(e,po(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(n&&u instanceof Ne&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:u.from,endA:u.to,endB:u.to};else{if(c.sel){let k=wC(e,e.state.doc,c.sel);if(k&&!k.eq(e.state.selection)){let B=e.state.tr.setSelection(k);o&&B.setMeta("composition",o),e.dispatch(B)}}return}e.state.selection.frome.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?m.start=e.state.selection.from:m.endA=e.state.selection.to-2&&e.state.selection.to<=c.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),lr&&Ai<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)==" \xA0"&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),y=c.doc.resolveNoCache(m.endB-c.from),w=f.resolve(m.start),E=g.sameParent(y)&&g.parent.inlineContent&&w.end()>=m.endA;if((Gs&&e.input.lastIOSEnter>Date.now()-225&&(!E||i.some(k=>k.nodeName=="DIV"||k.nodeName=="P"))||!E&&g.posk(e,po(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&LL(f,m.start,m.endA,g,y)&&e.someProp("handleKeyDown",k=>k(e,po(8,"Backspace")))){qn&&Tt&&e.domObserver.suppressSelectionUpdates();return}Tt&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),qn&&!E&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,y=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{e.someProp("handleKeyDown",function(k){return k(e,po(13,"Enter"))})},20));let b=m.start,C=m.endA,S=k=>{let B=k||e.state.tr.replace(b,C,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let O=wC(e,B.doc,c.sel);O&&!(Tt&&e.composing&&O.empty&&(m.start!=m.endB||e.input.lastChromeDeleteHn(e),20));let k=S(e.state.tr.delete(b,C)),B=f.resolve(m.start).marksAcross(f.resolve(m.endA));B&&k.ensureMarks(B),e.dispatch(k)}else if(m.endA==m.endB&&(A=BL(g.parent.content.cut(g.parentOffset,y.parentOffset),w.parent.content.cut(w.parentOffset,m.endA-w.start())))){let k=S(e.state.tr);A.type=="add"?k.addMark(b,C,A.mark):k.removeMark(b,C,A.mark),e.dispatch(k)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let k=g.parent.textBetween(g.parentOffset,y.parentOffset),B=()=>S(e.state.tr.insertText(k,b,C));e.someProp("handleTextInput",O=>O(e,b,C,k,B))||e.dispatch(B())}else e.dispatch(S());else e.dispatch(S())}function wC(e,t,r){return Math.max(r.anchor,r.head)>t.content.size?null:x0(e,t.resolve(r.anchor),t.resolve(r.head))}function BL(e,t){let r=e.firstChild.marks,n=t.firstChild.marks,i=r,o=n,s,a,u;for(let f=0;ff.mark(a.addToSet(f.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",u=f=>f.mark(a.removeFromSet(f.marks));else return null;let c=[];for(let f=0;fr||Qg(s,!0,!1)0&&(t||e.indexAfter(n)==e.node(n).childCount);)n--,i++,t=!1;if(r){let o=e.node(n).maybeChild(e.indexAfter(n));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function PL(e,t,r,n,i){let o=e.findDiffStart(t,r),s=r+e.size,a=r+t.size;if(o==null)return null;let{a:u,b:c}=e.findDiffEnd(t,s,a);if(i=="end"){let f=Math.max(0,o-Math.min(u,c));n-=u+f-o}if(u=u?o-n:0;o-=f,c=o+(c-u),u=o}else if(c=c?o-n:0;o-=f,u=o+(u-c),c=o}return{start:o,endA:u,endB:c}}var zL=A0,UL=Zl,rh=class{constructor(t,r){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new d0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=r,this.state=r.state,this.directPlugins=r.plugins||[],this.directPlugins.forEach(AC),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=xC(this),_C(this),this.nodeViews=EC(this),this.docView=rC(this.state.doc,bC(this),Yg(this),this.dom,this),this.domObserver=new w0(this,(n,i,o,s)=>ML(this,n,i,o,s)),this.domObserver.start(),oL(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let r in t)this._props[r]=t[r];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&p0(this);let r=this._props;this._props=t,t.plugins&&(t.plugins.forEach(AC),this.directPlugins=t.plugins),this.updateStateInner(t.state,r)}setProps(t){let r={};for(let n in this._props)r[n]=this._props[n];r.state=this.state;for(let n in t)r[n]=t[n];this.update(r)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,r){var n;let i=this.state,o=!1,s=!1;t.storedMarks&&this.composing&&(ZC(this),s=!0),this.state=t;let a=i.plugins!=t.plugins||this._props.plugins!=r.plugins;if(a||this._props.plugins!=r.plugins||this._props.nodeViews!=r.nodeViews){let d=EC(this);jL(d,this.nodeViews)&&(this.nodeViews=d,o=!0)}(a||r.handleDOMEvents!=this._props.handleDOMEvents)&&p0(this),this.editable=xC(this),_C(this);let u=Yg(this),c=bC(this),f=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",h=o||!this.docView.matchesNode(t.doc,c,u);(h||!t.selection.eq(i.selection))&&(s=!0);let p=f=="preserve"&&s&&this.dom.style.overflowAnchor==null&&EB(this);if(s){this.domObserver.stop();let d=h&&(lr||Tt)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&qL(i.selection,t.selection);if(h){let g=Tt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=vL(this)),(o||!this.docView.update(t.doc,c,u,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=rC(t.doc,c,u,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(d=!0)}let m=this.input.mouseDown;d||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&WB(this)&&m.delaySelUpdate())?Hn(this,d):(PC(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():p&&AB(p)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",r=>r(this)))if(this.state.selection instanceof Ce){let r=this.docView.domAfterPos(this.state.selection.from);r.nodeType==1&&JT(this,r.getBoundingClientRect(),t)}else JT(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let r=0;r0&&or.ownerDocument.getSelection()),this._root=r}return t||document}updateRoot(){this._root=null}posAtCoords(t){return NB(this,t)}coordsAtPos(t,r=1){return RC(this,t,r)}domAtPos(t,r=0){return this.docView.domFromPos(t,r)}nodeDOM(t){let r=this.docView.descAt(t);return r?r.nodeDOM:null}posAtDOM(t,r,n=-1){let i=this.docView.posFromDOM(t,r,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,r){return MB(this,r||this.state,t)}pasteHTML(t,r){return Yl(this,"",t,!1,r||new ClipboardEvent("paste"))}pasteText(t,r){return Yl(this,t,null,!0,r||new ClipboardEvent("paste"))}serializeForClipboard(t){return E0(this,t)}destroy(){this.docView&&(sL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Yg(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dB())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return lL(this,t)}domSelectionRange(){let t=this.domSelection();return t?zt&&this.root.nodeType===11&&vB(this.dom.ownerDocument)==this.dom&&DL(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};rh.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function bC(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",r=>{if(typeof r=="function"&&(r=r(e.state)),r)for(let n in r)n=="class"?t.class+=" "+r[n]:n=="style"?t.style=(t.style?t.style+";":"")+r[n]:!t[n]&&n!="contenteditable"&&n!="nodeName"&&(t[n]=String(r[n]))}),t.translate||(t.translate="no"),[Zt.node(0,e.state.doc.content.size,t)]}function _C(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Zt.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function xC(e){return!e.someProp("editable",t=>t(e.state)===!1)}function qL(e,t){let r=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(r)!=t.$anchor.start(r)}function EC(e){let t=Object.create(null);function r(n){for(let i in n)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=n[i])}return e.someProp("nodeViews",r),e.someProp("markViews",r),t}function jL(e,t){let r=0,n=0;for(let i in e){if(e[i]!=t[i])return!0;r++}for(let i in t)n++;return r!=n}function AC(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var N0={};Ut(N0,{marks:()=>nk,nodes:()=>rk,schema:()=>JL});var HL=["p",0],WL=["blockquote",0],VL=["hr"],GL=["pre",["code",0]],KL=["br"],rk={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return HL}},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM(){return WL}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return VL}},heading:{attrs:{level:{default:1,validate:"number"}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(e){return["h"+e.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM(){return GL}},text:{group:"inline"},image:{inline:!0,attrs:{src:{validate:"string"},alt:{default:null,validate:"string|null"},title:{default:null,validate:"string|null"}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(e){return{src:e.getAttribute("src"),title:e.getAttribute("title"),alt:e.getAttribute("alt")}}}],toDOM(e){let{src:t,alt:r,title:n}=e.attrs;return["img",{src:t,alt:r,title:n}]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return KL}}},$L=["em",0],XL=["strong",0],ZL=["code",0],nk={link:{attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(e){return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM(e){let{href:t,title:r}=e.attrs;return["a",{href:t,title:r},0]}},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:e=>e.type.name=="em"}],toDOM(){return $L}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name=="strong"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM(){return XL}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return ZL}}},JL=new Bl({nodes:rk,marks:nk});var R0={};Ut(R0,{addListNodes:()=>tP,bulletList:()=>ok,liftListItem:()=>oP,listItem:()=>sk,orderedList:()=>ik,sinkListItem:()=>lP,splitListItem:()=>lk,splitListItemKeepMarks:()=>iP,wrapInList:()=>rP,wrapRangeInList:()=>ak});var YL=["ol",0],QL=["ul",0],eP=["li",0],ik={attrs:{order:{default:1,validate:"number"}},parseDOM:[{tag:"ol",getAttrs(e){return{order:e.hasAttribute("start")?+e.getAttribute("start"):1}}}],toDOM(e){return e.attrs.order==1?YL:["ol",{start:e.attrs.order},0]}},ok={parseDOM:[{tag:"ul"}],toDOM(){return QL}},sk={parseDOM:[{tag:"li"}],toDOM(){return eP},defining:!0};function O0(e,t){let r={};for(let n in e)r[n]=e[n];for(let n in t)r[n]=t[n];return r}function tP(e,t,r){return e.append({ordered_list:O0(ik,{content:"list_item+",group:r}),bullet_list:O0(ok,{content:"list_item+",group:r}),list_item:O0(sk,{content:t})})}function rP(e,t=null){return function(r,n){let{$from:i,$to:o}=r.selection,s=i.blockRange(o);if(!s)return!1;let a=n?r.tr:null;return ak(a,s,e,t)?(n&&n(a.scrollIntoView()),!0):!1}}function ak(e,t,r,n=null){let i=!1,o=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(r)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let u=s.resolve(t.start-2);o=new vi(u,u,t.depth),t.endIndex=0;f--)o=ye.from(r[f].type.create(r[f].attrs,o));e.step(new vt(t.start-(n?2:0),t.end,t.start,t.end,new _e(o,0,0),r.length,!0));let s=0;for(let f=0;f=i.depth-3;w--)h=ye.from(i.node(w).copy(h));let d=i.indexAfter(-1){if(y>-1)return!1;w.isTextblock&&w.content.size==0&&(y=E+1)}),y>-1&&g.setSelection(ke.near(g.doc.resolve(y))),n(g.scrollIntoView())}return!0}let u=o.pos==i.end()?a.contentMatchAt(0).defaultType:null,c=r.tr.delete(i.pos,o.pos),f=u?[t?{type:e,attrs:t}:null,{type:u}]:void 0;return _i(c.doc,i.pos,2,f)?(n&&n(c.split(i.pos,2,f).scrollIntoView()),!0):!1}}function iP(e,t){let r=lk(e,t);return(n,i)=>r(n,i&&(o=>{let s=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();s&&o.ensureMarks(s),i(o)}))}function oP(e){return function(t,r){let{$from:n,$to:i}=t.selection,o=n.blockRange(i,s=>s.childCount>0&&s.firstChild.type==e);return o?r?n.node(o.depth-1).type==e?sP(t,r,e,o):aP(t,r,o):!0:!1}}function sP(e,t,r,n){let i=e.tr,o=n.end,s=n.$to.end(n.depth);og;m--)d-=i.child(m).nodeSize,n.delete(d-1,d+1);let o=n.doc.resolve(r.start),s=o.nodeAfter;if(n.mapping.map(r.end)!=r.start+o.nodeAfter.nodeSize)return!1;let a=r.startIndex==0,u=r.endIndex==i.childCount,c=o.node(-1),f=o.index(-1);if(!c.canReplace(f+(a?0:1),f+1,s.content.append(u?ye.empty:ye.from(i))))return!1;let h=o.pos,p=h+s.nodeSize;return n.step(new vt(h-(a?1:0),p+(u?1:0),h+1,p-1,new _e((a?ye.empty:ye.from(i.copy(ye.empty))).append(u?ye.empty:ye.from(i.copy(ye.empty))),a?0:1,u?0:1),a?0:1)),t(n.scrollIntoView()),!0}function lP(e){return function(t,r){let{$from:n,$to:i}=t.selection,o=n.blockRange(i,c=>c.childCount>0&&c.firstChild.type==e);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,u=a.child(s-1);if(u.type!=e)return!1;if(r){let c=u.lastChild&&u.lastChild.type==a.type,f=ye.from(c?e.create():null),h=new _e(ye.from(e.create(null,ye.from(a.type.create(null,f)))),c?3:1,0),p=o.start,d=o.end;r(t.tr.step(new vt(p-(c?3:1),d,p,d,h,1,!0)).scrollIntoView())}return!0}}var G0={};Ut(G0,{CellBookmark:()=>Sk,CellSelection:()=>Ke,ResizeState:()=>jk,TableMap:()=>Ue,TableView:()=>qk,__clipCells:()=>Pk,__insertCells:()=>U0,__pastedCells:()=>Lk,addColSpan:()=>H0,addColumn:()=>W0,addColumnAfter:()=>PP,addColumnBefore:()=>LP,addRow:()=>V0,addRowAfter:()=>qP,addRowBefore:()=>UP,cellAround:()=>Kn,cellNear:()=>q0,colCount:()=>AP,columnIsHeader:()=>Ak,columnResizing:()=>a7,columnResizingPluginKey:()=>ur,deleteCellSelection:()=>iu,deleteColumn:()=>zP,deleteRow:()=>jP,deleteTable:()=>QP,findCell:()=>EP,findCellPos:()=>P0,findCellRange:()=>OP,findTable:()=>au,fixTables:()=>Dk,fixTablesKey:()=>Ck,goToNextCell:()=>YP,handlePaste:()=>zk,inSameTable:()=>su,isInTable:()=>Or,mergeCells:()=>WP,moveCellForward:()=>Ek,moveTableColumn:()=>t7,moveTableRow:()=>e7,nextCell:()=>j0,pointsAtCell:()=>ch,removeColSpan:()=>Ci,removeColumn:()=>Ik,removeRow:()=>Mk,rowIsHeader:()=>Fk,selectedRect:()=>Wr,selectionCell:()=>ou,setCellAttr:()=>GP,splitCell:()=>VP,splitCellWithType:()=>Bk,tableEditing:()=>g7,tableEditingKey:()=>Gn,tableNodeTypes:()=>Ct,tableNodes:()=>_P,toggleHeader:()=>hh,toggleHeaderCell:()=>ZP,toggleHeaderColumn:()=>XP,toggleHeaderRow:()=>$P,updateColumnsOnResize:()=>fh});var F0={};Ut(F0,{keydownHandler:()=>Ks,keymap:()=>mP});var Wn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},oh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},uP=typeof navigator<"u"&&/Mac/.test(navigator.platform),cP=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(st=0;st<10;st++)Wn[48+st]=Wn[96+st]=String(st);var st;for(st=1;st<=24;st++)Wn[st+111]="F"+st;var st;for(st=65;st<=90;st++)Wn[st]=String.fromCharCode(st+32),oh[st]=String.fromCharCode(st);var st;for(ih in Wn)oh.hasOwnProperty(ih)||(oh[ih]=Wn[ih]);var ih;function uk(e){var t=uP&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||cP&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",r=!t&&e.key||(e.shiftKey?oh:Wn)[e.keyCode]||e.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}var fP=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),hP=typeof navigator<"u"&&/Win/.test(navigator.platform);function dP(e){let t=e.split(/-(?!$)/),r=t[t.length-1];r=="Space"&&(r=" ");let n,i,o,s;for(let a=0;ae.get(t),L0=(t,r)=>(e.set(t,r),r)}else{let e=[],r=0;B0=n=>{for(let i=0;i(r==10&&(r=0),e[r++]=n,e[r++]=i)}var Ue=class{constructor(e,t,r,n){this.width=e,this.height=t,this.map=r,this.problems=n}findCell(e){for(let t=0;t=r){(o||(o=[])).push({type:"overlong_rowspan",pos:f,n:w-b});break}let C=i+b*t;for(let S=0;Sn&&(o+=c.attrs.colspan)}}for(let s=0;s1&&(r=!0)}t==-1?t=o:t!=o&&(t=Math.max(t,o))}return t}function vP(e,t,r){e.problems||(e.problems=[]);let n={};for(let i=0;iNumber(s)):null,i=Number(e.getAttribute("colspan")||1),o={colspan:i,rowspan:Number(e.getAttribute("rowspan")||1),colwidth:n&&n.length==i?n:null};for(let s in t){let a=t[s].getFromDOM,u=a&&a(e);u!=null&&(o[s]=u)}return o}function fk(e,t){let r={};e.attrs.colspan!=1&&(r.colspan=e.attrs.colspan),e.attrs.rowspan!=1&&(r.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(r["data-colwidth"]=e.attrs.colwidth.join(","));for(let n in t){let i=t[n].setDOMAttr;i&&i(e.attrs[n],r)}return r}function bP(e){if(e!==null){if(!Array.isArray(e))throw new TypeError("colwidth must be null or an array");for(let t of e)if(typeof t!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function _P(e){let t=e.cellAttributes||{},r={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:bP}};for(let n in t)r[n]={default:t[n].default,validate:t[n].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:e.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:e.cellContent,attrs:r,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:n=>ck(n,t)}],toDOM(n){return["td",fk(n,t),0]}},table_header:{content:e.cellContent,attrs:r,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:n=>ck(n,t)}],toDOM(n){return["th",fk(n,t),0]}}}}function Ct(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let r in e.nodes){let n=e.nodes[r],i=n.spec.tableRole;i&&(t[i]=n)}}return t}var Gn=new fn("selectingCells");function Kn(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function xP(e){for(let t=e.depth;t>0;t--){let r=e.node(t).type.spec.tableRole;if(r==="cell"||r==="header_cell")return e.node(t)}return null}function Or(e){let t=e.selection.$head;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="row")return!0;return!1}function ou(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;let r=Kn(t.$head)||q0(t.$head);if(r)return r;throw new RangeError(`No cell found around position ${t.head}`)}function q0(e){for(let t=e.nodeAfter,r=e.pos;t;t=t.firstChild,r++){let n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(r)}for(let t=e.nodeBefore,r=e.pos;t;t=t.lastChild,r--){let n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(r-t.nodeSize)}}function ch(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function Ek(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function su(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function EP(e){return Ue.get(e.node(-1)).findCell(e.pos-e.start(-1))}function AP(e){return Ue.get(e.node(-1)).colCount(e.pos-e.start(-1))}function j0(e,t,r){let n=e.node(-1),i=Ue.get(n),o=e.start(-1),s=i.nextCell(e.pos-o,t,r);return s==null?null:e.node(0).resolve(o+s)}function Ci(e,t,r=1){let n={...e,colspan:e.colspan-r};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(t,r),n.colwidth.some(i=>i>0)||(n.colwidth=null)),n}function H0(e,t,r=1){let n={...e,colspan:e.colspan+r};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let i=0;if!=r.pos-o);u.unshift(r.pos-o);let c=u.map(f=>{let h=n.nodeAt(f);if(!h)throw new RangeError(`No cell with offset ${f} found`);let p=o+f+1;return new Pn(a.resolve(p),a.resolve(p+h.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=r}map(t,r){let n=t.resolve(r.map(this.$anchorCell.pos)),i=t.resolve(r.map(this.$headCell.pos));if(ch(n)&&ch(i)&&su(n,i)){let o=this.$anchorCell.node(-1)!=n.node(-1);return o&&this.isRowSelection()?Vn.rowSelection(n,i):o&&this.isColSelection()?Vn.colSelection(n,i):new Vn(n,i)}return Ne.between(n,i)}content(){let t=this.$anchorCell.node(-1),r=Ue.get(t),n=this.$anchorCell.start(-1),i=r.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},s=[];for(let u=i.top;u0||y>0){let w=m.attrs;if(g>0&&(w=Ci(w,0,g)),y>0&&(w=Ci(w,w.colspan-y,y)),d.lefti.bottom){let w={...m.attrs,rowspan:Math.min(d.bottom,i.bottom)-Math.max(d.top,i.top)};d.top0)return!1;let n=t+this.$anchorCell.nodeAfter.attrs.rowspan,i=r+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,i)==this.$headCell.node(-1).childCount}static colSelection(t,r=t){let n=t.node(-1),i=Ue.get(n),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(r.pos-o),u=t.node(0);return s.top<=a.top?(s.top>0&&(t=u.resolve(o+i.map[s.left])),a.bottom0&&(r=u.resolve(o+i.map[a.left])),s.bottom0)return!1;let s=i+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==r.width}eq(t){return t instanceof Vn&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,r=t){let n=t.node(-1),i=Ue.get(n),o=t.start(-1),s=i.findCell(t.pos-o),a=i.findCell(r.pos-o),u=t.node(0);return s.left<=a.left?(s.left>0&&(t=u.resolve(o+i.map[s.top*i.width])),a.right0&&(r=u.resolve(o+i.map[a.top*i.width])),s.right{t.push(Zt.node(n,n+r.nodeSize,{class:"selectedCell"}))}),ct.create(e.doc,t)}function TP({$from:e,$to:t}){if(e.pos==t.pos||e.pos=0&&!(e.after(i+1)=0&&!(t.before(o+1)>t.start(o));o--,n--);return r==n&&/row|table/.test(e.node(i).type.spec.tableRole)}function CP({$from:e,$to:t}){let r,n;for(let i=e.depth;i>0;i--){let o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}for(let i=t.depth;i>0;i--){let o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}return r!==n&&t.parentOffset===0}function kP(e,t,r){let n=(t||e).selection,i=(t||e).doc,o,s;if(n instanceof Ce&&(s=n.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=Ke.create(i,n.from);else if(s=="row"){let a=i.resolve(n.from+1);o=Ke.rowSelection(a,a)}else if(!r){let a=Ue.get(n.node),u=n.from+1,c=u+a.map[a.width*a.height-1];o=Ke.create(i,u+1,c)}}else n instanceof Ne&&TP(n)?o=Ne.create(i,n.from):n instanceof Ne&&CP(n)&&(o=Ne.create(i,n.$from.start(),n.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}var Ck=new fn("fix-tables");function kk(e,t,r,n){let i=e.childCount,o=t.childCount;e:for(let s=0,a=0;s{i.type.spec.tableRole=="table"&&(r=DP(e,i,o,r))};return t?t.doc!=e.doc&&kk(t.doc,e.doc,0,n):e.doc.descendants(n),r}function DP(e,t,r,n){let i=Ue.get(t);if(!i.problems)return n;n||(n=e.tr);let o=[];for(let u=0;u0){let d="cell";f.firstChild&&(d=f.firstChild.type.spec.tableRole);let m=[];for(let y=0;y0){let f=u-i;if(c===t.map[f]){s.push(null);continue}}if(a>0){let f=u-1;if(c===t.map[f]){s.push(null);continue}}s.push(e.nodeAt(c))}r.push(s)}return r}function Ok(e,t){let r=[],n=Ue.get(e),i=n.height,o=n.width;for(let s=0;sr[0]?-1:1,o=e.splice(t[0],t.length),s=o.length%2===0?1:0,a;return n===-1&&i===1?a=r[0]-1:n===1&&i===-1?a=r[r.length-1]-s+1:a=i===-1?r[0]:r[r.length-1]-s,e.splice(a,0,...o),e}function NP(e){return e instanceof Ke}function au(e){return RP(t=>t.type.spec.tableRole==="table",e)}function OP(e,t,r){var n,i;if(t==null&&r==null&&NP(e))return[e.$anchorCell,e.$headCell];let o=(n=t??r)!==null&&n!==void 0?n:e.anchor,s=(i=r??t)!==null&&i!==void 0?i:e.head,a=e.$head.doc,u=P0(a,o),c=P0(a,s);return u&&c&&su(u,c)?[u,c]:null}function P0(e,t){let r=e.resolve(t);return Kn(r)||q0(r)}function RP(e,t){for(let r=t.depth;r>=0;r-=1){let n=t.node(r);if(e(n))return{node:n,pos:r===0?0:t.before(r),start:t.start(r),depth:r}}return null}function $s(e,t){let r=au(t.$from);if(!r)return;let n=Ue.get(r.node);if(!(e<0||e>n.width-1))return n.cellsInRect({left:e,right:e+1,top:0,bottom:n.height}).map(i=>{let o=r.node.nodeAt(i),s=i+r.start;return{pos:s,start:s+1,node:o,depth:r.depth+2}})}function Xs(e,t){let r=au(t.$from);if(!r)return;let n=Ue.get(r.node);if(!(e<0||e>n.height-1))return n.cellsInRect({left:0,right:n.width,top:e,bottom:e+1}).map(i=>{let o=r.node.nodeAt(i),s=i+r.start;return{pos:s,start:s+1,node:o,depth:r.depth+2}})}function hk(e,t,r=t){let n=t,i=r;for(let f=t;f>=0;f--){let h=$s(f,e.selection);h&&h.forEach(p=>{let d=p.node.attrs.colspan+f-1;d>=n&&(n=f),d>i&&(i=d)})}for(let f=t;f<=i;f++){let h=$s(f,e.selection);h&&h.forEach(p=>{let d=p.node.attrs.colspan+f-1;p.node.attrs.colspan>1&&d>i&&(i=d)})}let o=[];for(let f=n;f<=i;f++){let h=$s(f,e.selection);h&&h.length>0&&o.push(f)}n=o[0],i=o[o.length-1];let s=$s(n,e.selection),a=Xs(0,e.selection);if(!s||!a)return;let u=e.doc.resolve(s[s.length-1].pos),c;for(let f=i;f>=n;f--){let h=$s(f,e.selection);if(h&&h.length>0){for(let p=a.length-1;p>=0;p--)if(a[p].pos===h[0].pos){c=h[0];break}if(c)break}}if(c)return{$anchor:u,$head:e.doc.resolve(c.pos),indexes:o}}function dk(e,t,r=t){let n=t,i=r;for(let f=t;f>=0;f--){let h=Xs(f,e.selection);h&&h.forEach(p=>{let d=p.node.attrs.rowspan+f-1;d>=n&&(n=f),d>i&&(i=d)})}for(let f=t;f<=i;f++){let h=Xs(f,e.selection);h&&h.forEach(p=>{let d=p.node.attrs.rowspan+f-1;p.node.attrs.rowspan>1&&d>i&&(i=d)})}let o=[];for(let f=n;f<=i;f++){let h=Xs(f,e.selection);h&&h.length>0&&o.push(f)}n=o[0],i=o[o.length-1];let s=Xs(n,e.selection),a=$s(0,e.selection);if(!s||!a)return;let u=e.doc.resolve(s[s.length-1].pos),c;for(let f=i;f>=n;f--){let h=Xs(f,e.selection);if(h&&h.length>0){for(let p=a.length-1;p>=0;p--)if(a[p].pos===h[0].pos){c=h[0];break}if(c)break}}if(c)return{$anchor:u,$head:e.doc.resolve(c.pos),indexes:o}}function pk(e){return e[0].map((t,r)=>e.map(n=>n[r]))}function IP(e){var t,r;let{tr:n,originIndex:i,targetIndex:o,select:s,pos:a}=e,u=au(n.doc.resolve(a));if(!u)return!1;let c=(t=hk(n,i))===null||t===void 0?void 0:t.indexes,f=(r=hk(n,o))===null||r===void 0?void 0:r.indexes;if(!c||!f||c.includes(o))return!1;let h=FP(u.node,c,f,0);if(n.replaceWith(u.pos,u.pos+u.node.nodeSize,h),!s)return!0;let p=Ue.get(h),d=u.start,m=o,g=p.positionAt(p.height-1,m,h),y=n.doc.resolve(d+g),w=p.positionAt(0,m,h),E=n.doc.resolve(d+w);return n.setSelection(Ke.colSelection(y,E)),!0}function FP(e,t,r,n){let i=pk(Nk(e));return i=Rk(i,t,r,n),i=pk(i),Ok(e,i)}function MP(e){var t,r;let{tr:n,originIndex:i,targetIndex:o,select:s,pos:a}=e,u=au(n.doc.resolve(a));if(!u)return!1;let c=(t=dk(n,i))===null||t===void 0?void 0:t.indexes,f=(r=dk(n,o))===null||r===void 0?void 0:r.indexes;if(!c||!f||c.includes(o))return!1;let h=BP(u.node,c,f,0);if(n.replaceWith(u.pos,u.pos+u.node.nodeSize,h),!s)return!0;let p=Ue.get(h),d=u.start,m=o,g=p.positionAt(m,p.width-1,h),y=n.doc.resolve(d+g),w=p.positionAt(m,0,h),E=n.doc.resolve(d+w);return n.setSelection(Ke.rowSelection(y,E)),!0}function BP(e,t,r,n){let i=Nk(e);return i=Rk(i,t,r,n),Ok(e,i)}function Wr(e){let t=e.selection,r=ou(e),n=r.node(-1),i=r.start(-1),o=Ue.get(n);return{...t instanceof Ke?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(r.pos-i),tableStart:i,map:o,table:n}}function W0(e,{map:t,tableStart:r,table:n},i){let o=i>0?-1:0;Ak(t,n,i+o)&&(o=i==0||i==t.width?null:0);for(let s=0;s0&&i0&&t.map[a-1]==u||i0?-1:0;Fk(t,n,i+a)&&(a=i==0||i==t.height?null:0);for(let c=0,f=t.width*i;c0&&i0&&h==t.map[f-t.width]){let p=r.nodeAt(h).attrs;e.setNodeMarkup(e.mapping.slice(a).map(h+n),null,{...p,rowspan:p.rowspan-1}),c+=p.colspan-1}else if(i0&&r[o]==r[o-1]||n.right0&&r[i]==r[i-e]||n.bottom0){let f=u+1+c.content.size,h=mk(c)?u+1:f;o.replaceWith(h+n.tableStart,f+n.tableStart,a)}o.setSelection(new Ke(o.doc.resolve(u+n.tableStart))),t(o)}return!0}function VP(e,t){let r=Ct(e.schema);return Bk(({node:n})=>r[n.type.spec.tableRole])(e,t)}function Bk(e){return(t,r)=>{let n=t.selection,i,o;if(n instanceof Ke){if(n.$anchorCell.pos!=n.$headCell.pos)return!1;i=n.$anchorCell.nodeAfter,o=n.$anchorCell.pos}else{var s;if(i=xP(n.$from),!i)return!1;o=(s=Kn(n.$from))===null||s===void 0?void 0:s.pos}if(i==null||o==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(r){let a=i.attrs,u=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let f=Wr(t),h=t.tr;for(let d=0;d{s.attrs[e]!==t&&o.setNodeMarkup(a,null,{...s.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),n(o)}return!0}}function KP(e){return function(t,r){if(!Or(t))return!1;if(r){let n=Ct(t.schema),i=Wr(t),o=t.tr,s=i.map.cellsInRect(e=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=s.map(u=>i.table.nodeAt(u));for(let u=0;u{let d=p+o.tableStart,m=s.doc.nodeAt(d);m&&s.setNodeMarkup(d,h,m.attrs)}),n(s)}return!0}}var $P=hh("row",{useDeprecatedLogic:!0}),XP=hh("column",{useDeprecatedLogic:!0}),ZP=hh("cell",{useDeprecatedLogic:!0});function JP(e,t){if(t<0){let r=e.nodeBefore;if(r)return e.pos-r.nodeSize;for(let n=e.index(-1)-1,i=e.before();n>=0;n--){let o=e.node(-1).child(n),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(e.index()0;n--)if(r.node(n).type.spec.tableRole=="table")return t&&t(e.tr.delete(r.before(n),r.after(n)).scrollIntoView()),!0;return!1}function iu(e,t){let r=e.selection;if(!(r instanceof Ke))return!1;if(t){let n=e.tr,i=Ct(e.schema).cell.createAndFill().content;r.forEachCell((o,s)=>{o.content.eq(i)||n.replace(n.mapping.map(s+1),n.mapping.map(s+o.nodeSize-1),new _e(i,0,0))}),n.docChanged&&t(n)}return!0}function e7(e){return(t,r)=>{let{from:n,to:i,select:o=!0,pos:s=t.selection.from}=e,a=t.tr;return MP({tr:a,originIndex:n,targetIndex:i,select:o,pos:s})?(r?.(a),!0):!1}}function t7(e){return(t,r)=>{let{from:n,to:i,select:o=!0,pos:s=t.selection.from}=e,a=t.tr;return IP({tr:a,originIndex:n,targetIndex:i,select:o,pos:s})?(r?.(a),!0):!1}}function Lk(e){if(e.size===0)return null;let{content:t,openStart:r,openEnd:n}=e;for(;t.childCount==1&&(r>0&&n>0||t.child(0).type.spec.tableRole=="table");)r--,n--,t=t.child(0).content;let i=t.child(0),o=i.type.spec.tableRole,s=i.type.schema,a=[];if(o=="row")for(let u=0;u=0;s--){let{rowspan:a,colspan:u}=o.child(s).attrs;for(let c=i;c=t.length&&t.push(ye.empty),r[i]n&&(p=p.type.createChecked(Ci(p.attrs,p.attrs.colspan,f+p.attrs.colspan-n),p.content)),c.push(p),f+=p.attrs.colspan;for(let d=1;di&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,i-h.attrs.rowspan)},h.content)),u.push(h)}o.push(ye.from(u))}r=o,t=i}return{width:e,height:t,rows:r}}function n7(e,t,r,n,i,o,s){let a=e.doc.type.schema,u=Ct(a),c,f;if(i>t.width)for(let h=0,p=0;ht.height){let h=[];for(let m=0,g=(t.height-1)*t.width;m=t.width?!1:r.nodeAt(t.map[g+m]).type==u.header_cell;h.push(y?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}let p=u.row.create(null,ye.from(h)),d=[];for(let m=t.height;m{if(!i)return!1;let o=r.selection;if(o instanceof Ke)return lh(r,n,ke.near(o.$headCell,t));if(e!="horiz"&&!o.empty)return!1;let s=Uk(i,e,t);if(s==null)return!1;if(e=="horiz")return lh(r,n,ke.near(r.doc.resolve(o.head+t),t));{let a=r.doc.resolve(s),u=j0(a,e,t),c;return u?c=ke.near(u,1):t<0?c=ke.near(r.doc.resolve(a.before(-1)),-1):c=ke.near(r.doc.resolve(a.after(-1)),1),lh(r,n,c)}}}function ah(e,t){return(r,n,i)=>{if(!i)return!1;let o=r.selection,s;if(o instanceof Ke)s=o;else{let u=Uk(i,e,t);if(u==null)return!1;s=new Ke(r.doc.resolve(u))}let a=j0(s.$headCell,e,t);return a?lh(r,n,new Ke(s.$anchorCell,a)):!1}}function o7(e,t){let r=e.state.doc,n=Kn(r.resolve(t));return n?(e.dispatch(e.state.tr.setSelection(new Ke(n))),!0):!1}function zk(e,t,r){if(!Or(e.state))return!1;let n=Lk(r),i=e.state.selection;if(i instanceof Ke){n||(n={width:1,height:1,rows:[ye.from(z0(Ct(e.state.schema).cell,r))]});let o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),a=Ue.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return n=Pk(n,a.right-a.left,a.bottom-a.top),U0(e.state,e.dispatch,s,a,n),!0}else if(n){let o=ou(e.state),s=o.start(-1);return U0(e.state,e.dispatch,s,Ue.get(o.node(-1)).findCell(o.pos-s),n),!0}else return!1}function s7(e,t){var r;if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=wk(e,t.target),i;if(t.shiftKey&&e.state.selection instanceof Ke)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(i=Kn(e.state.selection.$anchor))!=null&&((r=M0(e,t))===null||r===void 0?void 0:r.pos)!=i.pos)o(i,t),t.preventDefault();else if(!n)return;function o(u,c){let f=M0(e,c),h=Gn.getState(e.state)==null;if(!f||!su(u,f))if(h)f=u;else return;let p=new Ke(u,f);if(h||!e.state.selection.eq(p)){let d=e.state.tr.setSelection(p);h&&d.setMeta(Gn,u.pos),e.dispatch(d)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),Gn.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(Gn,-1))}function a(u){let c=u,f=Gn.getState(e.state),h;if(f!=null)h=e.state.doc.resolve(f);else if(wk(e,c.target)!=n&&(h=M0(e,t),!h))return s();h&&o(h,c)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function Uk(e,t,r){if(!(e.state.selection instanceof Ne))return null;let{$head:n}=e.state.selection;for(let i=n.depth-1;i>=0;i--){let o=n.node(i);if((r<0?n.index(i):n.indexAfter(i))!=(r<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){let s=n.before(i),a=t=="vert"?r>0?"down":"up":r>0?"right":"left";return e.endOfTextblock(a)?s:null}}return null}function wk(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function M0(e,t){let r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return null;let{inside:n,pos:i}=r;return n>=0&&Kn(e.state.doc.resolve(n))||Kn(e.state.doc.resolve(i))}var qk=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),fh(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,fh(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function fh(e,t,r,n,i,o){let s=0,a=!0,u=t.firstChild,c=e.firstChild;if(c){for(let h=0,p=0;hnew n(h,r,p)),new jk(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{let a=ur.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{l7(s,a,e,i)},mouseleave:s=>{u7(s)},mousedown:(s,a)=>{c7(s,a,t,r)}},decorations:s=>{let a=ur.getState(s);if(a&&a.activeHandle>-1)return m7(s,a.activeHandle)},nodeViews:{}}});return o}var jk=class uh{constructor(t,r){this.activeHandle=t,this.dragging=r}apply(t){let r=this,n=t.getMeta(ur);if(n&&n.setHandle!=null)return new uh(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new uh(r.activeHandle,n.setDragging);if(r.activeHandle>-1&&t.docChanged){let i=t.mapping.map(r.activeHandle,-1);return ch(t.doc.resolve(i))||(i=-1),new uh(i,r.dragging)}return r}};function l7(e,t,r,n){if(!e.editable)return;let i=ur.getState(e.state);if(i&&!i.dragging){let o=h7(t.target),s=-1;if(o){let{left:a,right:u}=o.getBoundingClientRect();t.clientX-a<=r?s=bk(e,t,"left",r):u-t.clientX<=r&&(s=bk(e,t,"right",r))}if(s!=i.activeHandle){if(!n&&s!==-1){let a=e.state.doc.resolve(s),u=a.node(-1),c=Ue.get(u),f=a.start(-1);if(c.colCount(a.pos-f)+a.nodeAfter.attrs.colspan-1==c.width-1)return}Hk(e,s)}}}function u7(e){if(!e.editable)return;let t=ur.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Hk(e,-1)}function c7(e,t,r,n){var i;if(!e.editable)return!1;let o=(i=e.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,s=ur.getState(e.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let a=e.state.doc.nodeAt(s.activeHandle),u=f7(e,s.activeHandle,a.attrs);e.dispatch(e.state.tr.setMeta(ur,{setDragging:{startX:t.clientX,startWidth:u}}));function c(h){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",f);let p=ur.getState(e.state);p?.dragging&&(d7(e,p.activeHandle,_k(p.dragging,h,r)),e.dispatch(e.state.tr.setMeta(ur,{setDragging:null})))}function f(h){if(!h.which)return c(h);let p=ur.getState(e.state);if(p&&p.dragging){let d=_k(p.dragging,h,r);xk(e,p.activeHandle,d,n)}}return xk(e,s.activeHandle,u,n),o.addEventListener("mouseup",c),o.addEventListener("mousemove",f),t.preventDefault(),!0}function f7(e,t,{colspan:r,colwidth:n}){let i=n&&n[n.length-1];if(i)return i;let o=e.domAtPos(t),s=o.node.childNodes[o.offset].offsetWidth,a=r;if(n)for(let u=0;uA7,history:()=>S7,isHistoryTransaction:()=>N7,redo:()=>Xk,redoDepth:()=>D7,redoNoScroll:()=>C7,undo:()=>$k,undoDepth:()=>k7,undoNoScroll:()=>T7});var dh=200,kt=function(){};kt.prototype.append=function(t){return t.length?(t=kt.from(t),!this.length&&t||t.length=r?kt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,r))};kt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};kt.prototype.forEach=function(t,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length),r<=n?this.forEachInner(t,r,n,0):this.forEachInvertedInner(t,r,n,0)};kt.prototype.map=function(t,r,n){r===void 0&&(r=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(o,s){return i.push(t(o,s))},r,n),i};kt.from=function(t){return t instanceof kt?t:t&&t.length?new Wk(t):kt.empty};var Wk=(function(e){function t(n){e.call(this),this.values=n}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new t(this.values.slice(i,o))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,o,s,a){for(var u=o;u=s;u--)if(i(this.values[u],a+u)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=dh)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=dh)return new t(i.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(t.prototype,r),t})(kt);kt.empty=new Wk([]);var y7=(function(e){function t(r,n){e.call(this),this.left=r,this.right=n,this.length=r.length+n.length,this.depth=Math.max(r.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(n){return na&&this.right.forEachInner(n,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(n,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(n,i-a,Math.max(o,a)-a,s+a)===!1||o=o?this.right.slice(n-o,i-o):this.left.slice(n,o).append(this.right.slice(0,i-o))},t.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new t(i,this.right)},t.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new t(this.left,new t(this.right,n)):new t(this,n)},t})(kt),K0=kt;var v7=500,Eo=class e{constructor(t,r){this.items=t,this.eventCount=r}popEvent(t,r){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,o;r&&(i=this.remapping(n,this.items.length),o=i.maps.length);let s=t.tr,a,u,c=[],f=[];return this.items.forEach((h,p)=>{if(!h.step){i||(i=this.remapping(n,p+1),o=i.maps.length),o--,f.push(h);return}if(i){f.push(new dn(h.map));let d=h.step.map(i.slice(o)),m;d&&s.maybeStep(d).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new dn(m,void 0,void 0,c.length+f.length))),o--,m&&i.appendMap(m,o)}else s.maybeStep(h.step);if(h.selection)return a=i?h.selection.map(i.slice(o)):h.selection,u=new e(this.items.slice(0,n).append(f.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:s,selection:a}}addTransform(t,r,n,i){let o=[],s=this.eventCount,a=this.items,u=!i&&a.length?a.get(a.length-1):null;for(let f=0;fb7&&(a=w7(a,c),s-=c),new e(a.append(o),s)}remapping(t,r){let n=new ql;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=t?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,s)},t,r),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(r=>new dn(r))),this.eventCount)}rebased(t,r){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-r),o=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},i);let u=r;this.items.forEach(p=>{let d=o.getMirror(--u);if(d==null)return;s=Math.min(s,d);let m=o.maps[d];if(p.step){let g=t.steps[d].invert(t.docs[d]),y=p.selection&&p.selection.map(o.slice(u+1,d));y&&a++,n.push(new dn(m,g,y))}else n.push(new dn(m))},i);let c=[];for(let p=r;pv7&&(h=h.compress(this.items.length-n.length)),h}emptyItemCount(){let t=0;return this.items.forEach(r=>{r.step||t++}),t}compress(t=this.items.length){let r=this.remapping(0,t),n=r.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=t)i.push(s),s.selection&&o++;else if(s.step){let u=s.step.map(r.slice(n)),c=u&&u.getMap();if(n--,c&&r.appendMap(c,n),u){let f=s.selection&&s.selection.map(r.slice(n));f&&o++;let h=new dn(c.invert(),u,f),p,d=i.length-1;(p=i.length&&i[d].merge(h))?i[d]=p:i.push(h)}}else s.map&&n--},this.items.length,0),new e(K0.from(i.reverse()),o)}};Eo.empty=new Eo(K0.empty,0);function w7(e,t){let r;return e.forEach((n,i)=>{if(n.selection&&t--==0)return r=i,!1}),e.slice(r)}var dn=class e{constructor(t,r,n,i){this.map=t,this.step=r,this.selection=n,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let r=t.step.merge(this.step);if(r)return new e(r.getMap().invert(),r,this.selection)}}},pn=class{constructor(t,r,n,i,o){this.done=t,this.undone=r,this.prevRanges=n,this.prevTime=i,this.prevComposition=o}},b7=20;function _7(e,t,r,n){let i=r.getMeta(mn),o;if(i)return i.historyState;r.getMeta(Kk)&&(e=new pn(e.done,e.undone,null,0,-1));let s=r.getMeta("appendedTransaction");if(r.steps.length==0)return e;if(s&&s.getMeta(mn))return s.getMeta(mn).redo?new pn(e.done.addTransform(r,void 0,n,ph(t)),e.undone,Vk(r.mapping.maps),e.prevTime,e.prevComposition):new pn(e.done,e.undone.addTransform(r,void 0,n,ph(t)),null,e.prevTime,e.prevComposition);if(r.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=r.getMeta("composition"),u=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(r.time||0)-n.newGroupDelay||!x7(r,e.prevRanges)),c=s?$0(e.prevRanges,r.mapping):Vk(r.mapping.maps);return new pn(e.done.addTransform(r,u?t.selection.getBookmark():void 0,n,ph(t)),Eo.empty,c,r.time,a??e.prevComposition)}else return(o=r.getMeta("rebased"))?new pn(e.done.rebased(r,o),e.undone.rebased(r,o),$0(e.prevRanges,r.mapping),e.prevTime,e.prevComposition):new pn(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),$0(e.prevRanges,r.mapping),e.prevTime,e.prevComposition)}function x7(e,t){if(!t)return!1;if(!e.docChanged)return!0;let r=!1;return e.mapping.maps[0].forEach((n,i)=>{for(let o=0;o=t[o]&&(r=!0)}),r}function Vk(e){let t=[];for(let r=e.length-1;r>=0&&t.length==0;r--)e[r].forEach((n,i,o,s)=>t.push(o,s));return t}function $0(e,t){if(!e)return null;let r=[];for(let n=0;n{let i=mn.getState(r);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(n){let o=E7(i,r,e);o&&n(t?o.scrollIntoView():o)}return!0}}var $k=mh(!1,!0),Xk=mh(!0,!0),T7=mh(!1,!1),C7=mh(!0,!1);function k7(e){let t=mn.getState(e);return t?t.done.eventCount:0}function D7(e){let t=mn.getState(e);return t?t.undone.eventCount:0}function N7(e){return e.getMeta(mn)!=null}var i1={};Ut(i1,{autoJoin:()=>V7,baseKeymap:()=>K7,chainCommands:()=>gh,createParagraphNear:()=>s3,deleteSelection:()=>Y0,exitCode:()=>o3,joinBackward:()=>Yk,joinDown:()=>F7,joinForward:()=>r3,joinTextblockBackward:()=>O7,joinTextblockForward:()=>R7,joinUp:()=>I7,lift:()=>M7,liftEmptyBlock:()=>a3,macBaseKeymap:()=>n1,newlineInCode:()=>i3,pcBaseKeymap:()=>gn,selectAll:()=>u3,selectNodeBackward:()=>e3,selectNodeForward:()=>n3,selectParentNode:()=>L7,selectTextblockEnd:()=>d3,selectTextblockStart:()=>h3,setBlockType:()=>U7,splitBlock:()=>r1,splitBlockAs:()=>l3,splitBlockKeepMarks:()=>B7,toggleMark:()=>H7,wrapIn:()=>z7});var Y0=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Jk(e,t){let{$cursor:r}=e.selection;return!r||(t?!t.endOfTextblock("backward",e):r.parentOffset>0)?null:r}var Yk=(e,t,r)=>{let n=Jk(e,r);if(!n)return!1;let i=Q0(n);if(!i){let s=n.blockRange(),a=s&&fo(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(c3(e,i,t,-1))return!0;if(n.parent.content.size==0&&(Zs(o,"end")||Ce.isSelectable(o)))for(let s=n.depth;;s--){let a=Wl(e.doc,n.before(s),n.after(s),_e.empty);if(a&&a.slice.size1)break}return o.isAtom&&i.depth==n.depth-1?(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},O7=(e,t,r)=>{let n=Jk(e,r);if(!n)return!1;let i=Q0(n);return i?Qk(e,i,t):!1},R7=(e,t,r)=>{let n=t3(e,r);if(!n)return!1;let i=e1(n);return i?Qk(e,i,t):!1};function Qk(e,t,r){let n=t.nodeBefore,i=n,o=t.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let s=t.nodeAfter,a=s,u=t.pos+1;for(;!a.isTextblock;u++){if(a.type.spec.isolating)return!1;let f=a.firstChild;if(!f)return!1;a=f}let c=Wl(e.doc,o,u,_e.empty);if(!c||c.from!=o||c instanceof Kt&&c.slice.size>=u-o)return!1;if(r){let f=e.tr.step(c);f.setSelection(Ne.create(f.doc,o)),r(f.scrollIntoView())}return!0}function Zs(e,t,r=!1){for(let n=e;n;n=t=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&n.childCount!=1)return!1}return!1}var e3=(e,t,r)=>{let{$head:n,empty:i}=e.selection,o=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;o=Q0(n)}let s=o&&o.nodeBefore;return!s||!Ce.isSelectable(s)?!1:(t&&t(e.tr.setSelection(Ce.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Q0(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function t3(e,t){let{$cursor:r}=e.selection;return!r||(t?!t.endOfTextblock("forward",e):r.parentOffset{let n=t3(e,r);if(!n)return!1;let i=e1(n);if(!i)return!1;let o=i.nodeAfter;if(c3(e,i,t,1))return!0;if(n.parent.content.size==0&&(Zs(o,"start")||Ce.isSelectable(o))){let s=Wl(e.doc,n.before(),n.after(),_e.empty);if(s&&s.slice.size{let{$head:n,empty:i}=e.selection,o=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset=0;t--){let r=e.node(t);if(e.index(t)+1{let r=e.selection,n=r instanceof Ce,i;if(n){if(r.node.isTextblock||!cn(e.doc,r.from))return!1;i=r.from}else if(i=Wg(e.doc,r.from,-1),i==null)return!1;if(t){let o=e.tr.join(i);n&&o.setSelection(Ce.create(o.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},F7=(e,t)=>{let r=e.selection,n;if(r instanceof Ce){if(r.node.isTextblock||!cn(e.doc,r.to))return!1;n=r.to}else if(n=Wg(e.doc,r.to,1),n==null)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0},M7=(e,t)=>{let{$from:r,$to:n}=e.selection,i=r.blockRange(n),o=i&&fo(i);return o==null?!1:(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)},i3=(e,t)=>{let{$head:r,$anchor:n}=e.selection;return!r.parent.type.spec.code||!r.sameParent(n)?!1:(t&&t(e.tr.insertText(` +`).scrollIntoView()),!0)};function t1(e){for(let t=0;t{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),o=r.indexAfter(-1),s=t1(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let a=r.after(),u=e.tr.replaceWith(a,a,s.createAndFill());u.setSelection(ke.near(u.doc.resolve(a),1)),t(u.scrollIntoView())}return!0},s3=(e,t)=>{let r=e.selection,{$from:n,$to:i}=r;if(r instanceof ar||n.parent.inlineContent||i.parent.inlineContent)return!1;let o=t1(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let s=(!n.parentOffset&&i.index(){let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let o=r.before();if(_i(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let n=r.blockRange(),i=n&&fo(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)};function l3(e){return(t,r)=>{if(t.selection instanceof Ce&&t.selection.node.isBlock){let{$from:d}=t.selection;return!d.parentOffset||!_i(t.doc,d.pos)?!1:(r&&r(t.tr.split(d.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let n=t.tr;!t.selection.empty&&(t.selection instanceof Ne||t.selection instanceof ar)&&n.deleteSelection();let{$from:i}=n.selection,o=n.steps.length,s=[],a,u,c=!1,f=!1;for(let d=i.depth;;d--)if(i.node(d).isBlock){c=i.end(d)==i.pos+(i.depth-d),f=i.start(d)==i.pos-(i.depth-d),u=t1(i.node(d-1).contentMatchAt(i.indexAfter(d-1)));let g=e&&e(i.parent,c,i);s.unshift(g||(c&&u?{type:u}:null)),a=d;break}else{if(d==1)return!1;s.unshift(null)}let h=i.pos,p=_i(n.doc,h,s.length,s);if(p||(s[0]=u?{type:u}:null,p=_i(n.doc,h,s.length,s)),!p)return!1;if(n.split(h,s.length,s),!c&&f&&i.node(a).type!=u){let d=n.mapping.slice(o),m=d.map(i.before(a)),g=n.doc.resolve(m);u&&i.node(a-1).canReplaceWith(g.index(),g.index()+1,u)&&n.setNodeMarkup(d.map(i.before(a)),u)}return r&&r(n.scrollIntoView()),!0}}var r1=l3(),B7=(e,t)=>r1(e,t&&(r=>{let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();n&&r.ensureMarks(n),t(r)})),L7=(e,t)=>{let{$from:r,to:n}=e.selection,i,o=r.sharedDepth(n);return o==0?!1:(i=r.before(o),t&&t(e.tr.setSelection(Ce.create(e.doc,i))),!0)},u3=(e,t)=>(t&&t(e.tr.setSelection(new ar(e.doc))),!0);function P7(e,t,r){let n=t.nodeBefore,i=t.nodeAfter,o=t.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&t.parent.canReplace(o-1,o)?(r&&r(e.tr.delete(t.pos-n.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(i.isTextblock||cn(e.doc,t.pos))?!1:(r&&r(e.tr.join(t.pos).scrollIntoView()),!0)}function c3(e,t,r,n){let i=t.nodeBefore,o=t.nodeAfter,s,a,u=i.type.spec.isolating||o.type.spec.isolating;if(!u&&P7(e,t,r))return!0;let c=!u&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(r){let d=t.pos+o.nodeSize,m=ye.empty;for(let w=s.length-1;w>=0;w--)m=ye.from(s[w].create(null,m));m=ye.from(i.copy(m));let g=e.tr.step(new vt(t.pos-1,d,t.pos,d,new _e(m,1,0),s.length,!0)),y=g.doc.resolve(d+2*s.length);y.nodeAfter&&y.nodeAfter.type==i.type&&cn(g.doc,y.pos)&&g.join(y.pos),r(g.scrollIntoView())}return!0}let f=o.type.spec.isolating||n>0&&u?null:ke.findFrom(t,1),h=f&&f.$from.blockRange(f.$to),p=h&&fo(h);if(p!=null&&p>=t.depth)return r&&r(e.tr.lift(h,p).scrollIntoView()),!0;if(c&&Zs(o,"start",!0)&&Zs(i,"end")){let d=i,m=[];for(;m.push(d),!d.isTextblock;)d=d.lastChild;let g=o,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(d.canReplace(d.childCount,d.childCount,g.content)){if(r){let w=ye.empty;for(let b=m.length-1;b>=0;b--)w=ye.from(m[b].copy(w));let E=e.tr.step(new vt(t.pos-m.length,t.pos+o.nodeSize,t.pos+y,t.pos+o.nodeSize-y,new _e(w,m.length,0),0,!0));r(E.scrollIntoView())}return!0}}return!1}function f3(e){return function(t,r){let n=t.selection,i=e<0?n.$from:n.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(r&&r(t.tr.setSelection(Ne.create(t.doc,e<0?i.start(o):i.end(o)))),!0):!1}}var h3=f3(-1),d3=f3(1);function z7(e,t=null){return function(r,n){let{$from:i,$to:o}=r.selection,s=i.blockRange(o),a=s&&Us(s,e,t);return a?(n&&n(r.tr.wrap(s,a).scrollIntoView()),!0):!1}}function U7(e,t=null){return function(r,n){let i=!1;for(let o=0;o{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(e,t)))if(u.type==e)i=!0;else{let f=r.doc.resolve(c),h=f.index();i=f.parent.canReplaceWith(h,h+1,e)}})}if(!i)return!1;if(n){let o=r.tr;for(let s=0;s{if(a||!n&&u.isAtom&&u.isInline&&c>=o.pos&&c+u.nodeSize<=s.pos)return!1;a=u.inlineContent&&u.type.allowsMarkType(r)}),a)return!0}return!1}function j7(e){let t=[];for(let r=0;r{if(o.isAtom&&o.content.size&&o.isInline&&s>=n.pos&&s+o.nodeSize<=i.pos)return s+1>n.pos&&t.push(new Pn(n,n.doc.resolve(s+1))),n=n.doc.resolve(s+1+o.content.size),!1}),n.poss.doc.rangeHasMark(d.$from.pos,d.$to.pos,e)):h=!f.every(d=>{let m=!1;return p.doc.nodesBetween(d.$from.pos,d.$to.pos,(g,y,w)=>{if(m)return!1;m=!e.isInSet(g.marks)&&!!w&&w.type.allowsMarkType(e)&&!(g.isText&&/^\s*$/.test(g.textBetween(Math.max(0,d.$from.pos-y),Math.min(g.nodeSize,d.$to.pos-y))))}),!m});for(let d=0;d{if(!r.isGeneric)return e(r);let n=[];for(let o=0;on.push(c,f))}let i=[];for(let o=0;oo-s);for(let o=i.length-1;o>=0;o--)cn(r.doc,i[o])&&r.join(i[o]);e(r)}}function V7(e,t){let r=Array.isArray(t)?n=>t.indexOf(n.type.name)>-1:t;return(n,i,o)=>e(n,i&&W7(i,r),o)}function gh(...e){return function(t,r,n){for(let i=0;iVr,closeDoubleQuote:()=>g3,closeSingleQuote:()=>v3,ellipsis:()=>Q7,emDash:()=>Y7,inputRules:()=>Z7,openDoubleQuote:()=>m3,openSingleQuote:()=>y3,smartQuotes:()=>ez,textblockTypeInputRule:()=>rz,undoInputRule:()=>J7,wrappingInputRule:()=>tz});var Vr=class{constructor(t,r,n={}){this.match=t,this.match=t,this.handler=typeof r=="string"?$7(r):r,this.undoable=n.undoable!==!1,this.inCode=n.inCode||!1,this.inCodeMark=n.inCodeMark!==!1}};function $7(e){return function(t,r,n,i){let o=e;if(r[1]){let s=r[0].lastIndexOf(r[1]);o+=r[0].slice(s+r[1].length),n+=s;let a=n-i;a>0&&(o=r[0].slice(s-a,s)+o,n=i)}return t.tr.insertText(o,n,i)}}var X7=500;function Z7({rules:e}){let t=new Lt({state:{init(){return null},apply(r,n){let i=r.getMeta(this);return i||(r.selectionSet||r.docChanged?null:n)}},props:{handleTextInput(r,n,i,o){return p3(r,n,i,o,e,t)},handleDOMEvents:{compositionend:r=>{setTimeout(()=>{let{$cursor:n}=r.state.selection;n&&p3(r,n.pos,n.pos,"",e,t)})}}},isInputRules:!0});return t}function p3(e,t,r,n,i,o){if(e.composing)return!1;let s=e.state,a=s.doc.resolve(t),u=a.parent.textBetween(Math.max(0,a.parentOffset-X7),a.parentOffset,null,"\uFFFC")+n;for(let c=0;cm.type.spec.code))continue;if(a.parent.type.spec.code){if(!f.inCode)continue}else if(f.inCode==="only")continue;let h=f.match.exec(u);if(!h||h[0].length{g.isInline&&g.marks.some(y=>y.type.spec.code)&&(m=!0)}),m)continue}let d=f.handler(s,h,p,r);if(d)return f.undoable&&d.setMeta(o,{transform:d,from:t,to:r,text:n}),e.dispatch(d),!0}return!1}var J7=(e,t)=>{let r=e.plugins;for(let n=0;n=0;u--)s.step(a.steps[u].invert(a.docs[u]));if(o.text){let u=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,e.schema.text(o.text,u))}else s.delete(o.from,o.to);t(s)}return!0}}return!1},Y7=new Vr(/--$/,"\u2014",{inCodeMark:!1}),Q7=new Vr(/\.\.\.$/,"\u2026",{inCodeMark:!1}),m3=new Vr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"\u201C",{inCodeMark:!1}),g3=new Vr(/"$/,"\u201D",{inCodeMark:!1}),y3=new Vr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"\u2018",{inCodeMark:!1}),v3=new Vr(/'$/,"\u2019",{inCodeMark:!1}),ez=[m3,g3,y3,v3];function tz(e,t,r=null,n){return new Vr(e,(i,o,s,a)=>{let u=r instanceof Function?r(o):r,c=i.tr.delete(s,a),f=c.doc.resolve(s),h=f.blockRange(),p=h&&Us(h,t,u);if(!p)return null;c.wrap(h,p);let d=c.doc.resolve(s-1).nodeBefore;return d&&d.type==t&&cn(c.doc,s-1)&&(!n||n(o,d))&&c.join(s-1),c})}function rz(e,t,r=null){return new Vr(e,(n,i,o,s)=>{let a=n.doc.resolve(o),u=r instanceof Function?r(i):r;return a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t)?n.tr.delete(o,s).setBlockType(o,o,t,u):null})}var a1={};Ut(a1,{dropCursor:()=>nz});function nz(e={}){return new Lt({view(t){return new s1(t,e)}})}var s1=class{constructor(t,r){var n;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(n=r.width)!==null&&n!==void 0?n:1,this.color=r.color===!1?void 0:r.color||"black",this.class=r.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return t.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:t,handler:r})=>this.editorView.dom.removeEventListener(t,r))}update(t,r){if(this.cursorPos!=null&&r.doc!=t.state.doc)if(this.lastDragEvent){let n=this.computeTarget(this.lastDragEvent);n==this.cursorPos?this.updateOverlay():this.setCursor(n)}else this.updateOverlay()}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),r=!t.parent.inlineContent,n,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(r){let h=t.nodeBefore,p=t.nodeAfter;if(h||p){let d=this.editorView.nodeDOM(this.cursorPos-(h?h.nodeSize:0));if(d){let m=d.getBoundingClientRect(),g=h?m.bottom:m.top;h&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;n={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!n){let h=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;n={left:h.left-p,right:h.left+p,top:h.top,bottom:h.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r);let c,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")c=-pageXOffset,f=-pageYOffset;else{let h=u.getBoundingClientRect(),p=h.width/u.offsetWidth,d=h.height/u.offsetHeight;c=h.left-u.scrollLeft*p,f=h.top-u.scrollTop*d}this.element.style.left=(n.left-c)/s+"px",this.element.style.top=(n.top-f)/a+"px",this.element.style.width=(n.right-n.left)/s+"px",this.element.style.height=(n.bottom-n.top)/a+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}computeTarget(t){let r=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),n=r&&r.inside>=0&&this.editorView.state.doc.nodeAt(r.inside),i=n&&n.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,r,t):i;if(!r||o)return null;let s=r.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=jf(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}return s}dragover(t){if(!this.editorView.editable)return;this.lastDragEvent=t;let r=this.computeTarget(t);r!=null&&(this.setCursor(r),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}};var u1={};Ut(u1,{GapCursor:()=>Dt,gapCursor:()=>sz});var Dt=class e extends ke{constructor(t){super(t,t)}map(t,r){let n=t.resolve(r.map(this.head));return e.valid(n)?new e(n):ke.near(n)}content(){return _e.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new e(t.resolve(r.pos))}getBookmark(){return new l1(this.anchor)}static valid(t){let r=t.parent;if(r.inlineContent||!iz(t)||!oz(t))return!1;let n=r.type.spec.allowGapCursor;if(n!=null)return n;let i=r.contentMatchAt(t.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(t,r,n=!1){e:for(;;){if(!n&&e.valid(t))return t;let i=t.pos,o=null;for(let s=t.depth;;s--){let a=t.node(s);if(r>0?t.indexAfter(s)0){o=a.child(r>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;i+=r;let u=t.doc.resolve(i);if(e.valid(u))return u}for(;;){let s=r>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Ce.isSelectable(o)){t=t.doc.resolve(i+o.nodeSize*r),n=!1;continue e}break}o=s,i+=r;let a=t.doc.resolve(i);if(e.valid(a))return a}return null}}};Dt.prototype.visible=!1;Dt.findFrom=Dt.findGapCursorFrom;ke.jsonID("gapcursor",Dt);var l1=class e{constructor(t){this.pos=t}map(t){return new e(t.map(this.pos))}resolve(t){let r=t.resolve(this.pos);return Dt.valid(r)?new Dt(r):ke.near(r)}};function w3(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function iz(e){for(let t=e.depth;t>=0;t--){let r=e.index(t),n=e.node(t);if(r==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(r-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||w3(i.type))return!0;if(i.inlineContent)return!1}}return!0}function oz(e){for(let t=e.depth;t>=0;t--){let r=e.indexAfter(t),n=e.node(t);if(r==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(r);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||w3(i.type))return!0;if(i.inlineContent)return!1}}return!0}function sz(){return new Lt({props:{decorations:cz,createSelectionBetween(e,t,r){return t.pos==r.pos&&Dt.valid(r)?new Dt(r):null},handleClick:lz,handleKeyDown:az,handleDOMEvents:{beforeinput:uz}}})}var az=Ks({ArrowLeft:yh("horiz",-1),ArrowRight:yh("horiz",1),ArrowUp:yh("vert",-1),ArrowDown:yh("vert",1)});function yh(e,t){let r=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(n,i,o){let s=n.selection,a=t>0?s.$to:s.$from,u=s.empty;if(s instanceof Ne){if(!o.endOfTextblock(r)||a.depth==0)return!1;u=!1,a=n.doc.resolve(t>0?a.after():a.before())}let c=Dt.findGapCursorFrom(a,t,u);return c?(i&&i(n.tr.setSelection(new Dt(c))),!0):!1}}function lz(e,t,r){if(!e||!e.editable)return!1;let n=e.state.doc.resolve(t);if(!Dt.valid(n))return!1;let i=e.posAtCoords({left:r.clientX,top:r.clientY});return i&&i.inside>-1&&Ce.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Dt(n))),!0)}function uz(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Dt))return!1;let{$from:r}=e.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);if(!n)return!1;let i=ye.empty;for(let s=n.length-1;s>=0;s--)i=ye.from(n[s].createAndFill(null,i));let o=e.state.tr.replace(r.pos,r.pos,new _e(i,0,0));return o.setSelection(Ne.near(o.doc.resolve(r.pos+1))),e.dispatch(o),!1}function cz(e){if(!(e.selection instanceof Dt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ct.create(e.doc,[Zt.widget(e.selection.head,t,{key:"gapcursor"})])}window.DOCXV={mammoth:b3.default,docx:kg,JSZip:_3.default,pm:{state:Xg,view:D0,model:Lg,schemaBasic:N0,schemaList:R0,tables:G0,history:Z0,commands:i1,keymap:F0,inputrules:o1,dropcursor:a1,gapcursor:u1}};})();