json-canvas-viewer 3.2.2 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +105 -41
  2. package/dist/bridges.cjs +2 -0
  3. package/dist/bridges.cjs.map +1 -0
  4. package/dist/bridges.js +2 -0
  5. package/dist/bridges.js.map +1 -0
  6. package/dist/chimp.cjs +1 -0
  7. package/dist/chimp.js +1 -0
  8. package/dist/controller-CnUlrkdp.cjs +2 -0
  9. package/dist/controller-CnUlrkdp.cjs.map +1 -0
  10. package/dist/controller-UN-hOZ_r.js +2 -0
  11. package/dist/controller-UN-hOZ_r.js.map +1 -0
  12. package/dist/dev.cjs +2 -0
  13. package/dist/dev.cjs.map +1 -0
  14. package/dist/dev.js +2 -0
  15. package/dist/dev.js.map +1 -0
  16. package/dist/index-RXeXyAu0.cjs +2 -0
  17. package/dist/index-RXeXyAu0.cjs.map +1 -0
  18. package/dist/index-ujiv9m9Y.js +2 -0
  19. package/dist/index-ujiv9m9Y.js.map +1 -0
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/modules.cjs +2 -0
  25. package/dist/modules.cjs.map +1 -0
  26. package/dist/modules.js +2 -0
  27. package/dist/modules.js.map +1 -0
  28. package/dist/renderer-Bzv3aLXp.cjs +2 -0
  29. package/dist/renderer-Bzv3aLXp.cjs.map +1 -0
  30. package/dist/renderer-NPxavnke.js +2 -0
  31. package/dist/renderer-NPxavnke.js.map +1 -0
  32. package/dist/types/bridges/reactComponent.d.ts +9 -0
  33. package/dist/types/bridges/renderToString.d.ts +6 -0
  34. package/dist/types/bridges/vitePlugin.d.ts +8 -0
  35. package/dist/types/bridges/vueComponent.vue.d.ts +23 -0
  36. package/dist/types/bridges.d.ts +4 -0
  37. package/dist/types/chimp.d.ts +7 -0
  38. package/dist/types/core/baseModule.d.ts +15 -0
  39. package/dist/types/{controller.d.ts → core/controller.d.ts} +4 -8
  40. package/dist/types/{dataManager.d.ts → core/dataManager.d.ts} +30 -18
  41. package/dist/types/{declarations.d.ts → core/declarations.d.ts} +22 -32
  42. package/dist/types/core/index.d.ts +14 -0
  43. package/dist/types/{interactionHandler.d.ts → core/interactionHandler.d.ts} +3 -3
  44. package/dist/types/{overlayManager.d.ts → core/overlayManager.d.ts} +4 -4
  45. package/dist/types/{renderer.d.ts → core/renderer.d.ts} +2 -3
  46. package/dist/types/{utilities.d.ts → core/utilities.d.ts} +1 -3
  47. package/dist/types/dev.d.ts +8 -0
  48. package/dist/types/index.d.ts +2 -21
  49. package/dist/types/{controls → modules/controls}/index.d.ts +2 -2
  50. package/dist/types/{debugPanel → modules/debugPanel}/index.d.ts +2 -2
  51. package/dist/types/{minimap → modules/minimap}/index.d.ts +3 -3
  52. package/dist/types/{mistouchPreventer → modules/mistouchPreventer}/index.d.ts +2 -2
  53. package/dist/types/modules.d.ts +4 -0
  54. package/package.json +36 -9
  55. package/dist/types/baseModule.d.ts +0 -11
  56. package/dist/types/canvasViewer.d.ts +0 -25
  57. package/dist/types/renderToString.d.ts +0 -2
package/README.md CHANGED
@@ -1,23 +1,46 @@
1
- # JSON Canvas Viewer
2
-
3
- [![npm](https://img.shields.io/npm/v/json-canvas-viewer?logo=npm&labelColor=red&logoColor=white&color=333333)](https://www.npmjs.com/package/json-canvas-viewer)
4
- [![Gzipped + Minified Size](https://img.shields.io/bundlephobia/minzip/json-canvas-viewer?style=flat&logo=webpack&labelColor=orange&logoColor=white&color=333333&label=Minified%2bGzipped)](https://bundlephobia.com/package/json-canvas-viewer)
5
- [![ci](https://img.shields.io/github/actions/workflow/status/hesprs/json-canvas-viewer/ci.yml?style=flat&logo=github&logoColor=white&label=CI&labelColor=d4ab00&color=333333)](https://github.com/hesprs/json-canvas-viewer/actions)
6
- [![CodeFactor](https://img.shields.io/codefactor/grade/github/hesprs/json-canvas-viewer?style=flat&logo=codefactor&logoColor=white&label=Code%20Quality&labelColor=17b37a&color=333333)](https://www.codefactor.io/repository/github/hesprs/json-canvas-viewer)
7
- ![TypeScript](https://img.shields.io/badge/Types-Strict-333333?logo=typescript&labelColor=blue&logoColor=white)
8
- [![Snyk Security](https://img.shields.io/badge/Snyk%20Security-Monitored-333333?logo=snyk&style=flat&labelColor=8A2BE2&logoColor=white)](https://snyk.io/test/npm/json-canvas-viewer)
9
- [![Documentation](https://img.shields.io/badge/Documentation-Ready-333333?labelColor=5C73E7&logo=github&logoColor=white)](https://github.com/hesprs/json-canvas-viewer/wiki)
10
- ![Made by Humans](https://img.shields.io/badge/%F0%9F%96%90%EF%B8%8F%20Made%20by-Humans-333333?labelColor=25C260)
11
-
12
- ![Canvas Viewer](test/preview.png)
13
-
14
- A **TypeScript-based** viewer for **JSON Canvas** files. View and interact with your canvas files directly in the browser, or embed the viewer in front-end projects with ease. It is built without frameworks so it can be easily integrated into any framework.
15
-
16
- This project is derived from [sofanati-nour/obsidian-canvas-web-renderer](https://github.com/sofanati-nour/obsidian-canvas-web-renderer), but is far more developed and optimized.
17
-
18
- - **Documentation**: [project wiki](https://github.com/hesprs/json-canvas-viewer/wiki)
19
- - **More about JSON Canvas**: [jsoncanvas.org](https://jsoncanvas.org/)
20
- - **Demo**: [in my portfolio](https://hesprs.github.io/json-canvas-viewer)
1
+ <h1 align="center">
2
+ <img src="assets/logo.svg" alt="JSON Canvas Viewer logo" width="280px">
3
+ <br />
4
+ JSON Canvas Viewer
5
+ <br />
6
+ </h1>
7
+
8
+ <h4 align="center">An extensible web-based viewer for JSON Canvas</h4>
9
+
10
+ <p align="center">
11
+ <a href="https://www.npmjs.com/package/json-canvas-viewer">
12
+ <img src="https://img.shields.io/npm/v/json-canvas-viewer?logo=npm&labelColor=red&logoColor=white&color=333333" alt="npm">
13
+ </a>
14
+ <a href="https://bundlephobia.com/package/json-canvas-viewer">
15
+ <img src="https://img.shields.io/bundlephobia/minzip/json-canvas-viewer?style=flat&logo=webpack&labelColor=orange&logoColor=white&color=333333&label=Minified%2bGzipped" alt="Gzipped + Minified Size">
16
+ </a>
17
+ <a href="https://github.com/hesprs/json-canvas-viewer/actions">
18
+ <img src="https://img.shields.io/github/actions/workflow/status/hesprs/json-canvas-viewer/ci.yml?style=flat&logo=github&logoColor=white&label=CI&labelColor=d4ab00&color=333333" alt="ci">
19
+ </a>
20
+ <a href="https://www.codefactor.io/repository/github/hesprs/json-canvas-viewer">
21
+ <img src="https://img.shields.io/codefactor/grade/github/hesprs/json-canvas-viewer?style=flat&logo=codefactor&logoColor=white&label=Code%20Quality&labelColor=17b37a&color=333333" alt="CodeFactor">
22
+ </a>
23
+ <img src="https://img.shields.io/badge/Types-Strict-333333?logo=typescript&labelColor=blue&logoColor=white" alt="TypeScript">
24
+ <a href="https://snyk.io/test/npm/json-canvas-viewer">
25
+ <img src="https://img.shields.io/badge/Snyk%20Security-Monitored-333333?logo=snyk&style=flat&labelColor=8A2BE2&logoColor=white" alt="Snyk Security">
26
+ </a>
27
+ <a href="https://github.com/hesprs/json-canvas-viewer/wiki">
28
+ <img src="https://img.shields.io/badge/Documentation-Ready-333333?labelColor=5C73E7&logo=github&logoColor=white" alt="Documentation">
29
+ </a>
30
+ <img src="https://img.shields.io/badge/%F0%9F%96%90%EF%B8%8F%20Made%20by-Humans-333333?labelColor=25C260" alt="Made by Humans">
31
+ </p>
32
+
33
+ <p align="center">
34
+ <a href="https://hesprs.github.io/json-canvas-viewer">
35
+ <strong>Demo</strong>
36
+ </a> •
37
+ <a href="https://github.com/hesprs/json-canvas-viewer/wiki">
38
+ <strong>Documentation</strong>
39
+ </a> •
40
+ <a href="https://jsoncanvas.org/">
41
+ <strong>About JSON Canvas</strong>
42
+ </a>
43
+ </p>
21
44
 
22
45
  ## 🐶 Features
23
46
 
@@ -28,7 +51,6 @@ This project is derived from [sofanati-nour/obsidian-canvas-web-renderer](https:
28
51
  - Responsive design with mobile and touchpad adaptation
29
52
  - Supports Lazy loading
30
53
  - TypeScript native
31
- - [Supports Server-side rendering (SSR)](https://github.com/hesprs/json-canvas-viewer/wiki/4-%F0%9F%96%87%EF%B8%8F-SSR-and-Bridges#server-side-rendering)
32
54
  - 🔥 More performant than rendering canvases in Obsidian!
33
55
  - 🧩 Out-of-the-box extensibility and tree-shaking, current optional modules include:
34
56
  - [`Minimap`](https://github.com/hesprs/json-canvas-viewer/wiki/3-%F0%9F%A7%A9-Modules#minimap) for easy navigation
@@ -36,56 +58,98 @@ This project is derived from [sofanati-nour/obsidian-canvas-web-renderer](https:
36
58
  - [`MistouchPreventer`](https://github.com/hesprs/json-canvas-viewer/wiki/3-%F0%9F%A7%A9-Modules#mistouch-preventer) prevents the canvas from intercepting page scroll.
37
59
  - [`DebugPanel`](https://github.com/hesprs/json-canvas-viewer/wiki/3-%F0%9F%A7%A9-Modules#debug-panel) displays scale and position data.
38
60
 
61
+ ## 🧩 Integration with Existing Paradigms
62
+
63
+ JSON Canvas Viewer currently can work seamlessly with the following techstacks / technologies (including but not limited to):
64
+
65
+ - ✅ Vanilla JS/TS: natural support
66
+ - ✅ Prerendering: [`renderToString`](https://github.com/hesprs/json-canvas-viewer/wiki/4-%F0%9F%96%87%EF%B8%8F-Prerendering-and-Bridges#prerendering)
67
+ - ✅ Vite: [Vite Plugin](https://github.com/hesprs/json-canvas-viewer/wiki/1-%F0%9F%9A%80-Quick-Start#setup-1)
68
+ - ✅ Vue: [Vue Component](https://github.com/hesprs/json-canvas-viewer/wiki/4-%F0%9F%96%87%EF%B8%8F-Prerendering-and-Bridges#vue-component)
69
+ - ✅ React: [React Component](https://github.com/hesprs/json-canvas-viewer/wiki/4-%F0%9F%96%87%EF%B8%8F-Prerendering-and-Bridges#react-component)
70
+
71
+ 🙌 Contributions are welcomed!
72
+
39
73
  ## 🚀 Quick Start
40
74
 
41
- We recommend using your favourite package manager to install the package.
75
+ ### Setup
76
+
77
+ You firstly need a markdown-to-HTML parser, which is of the type below:
78
+
79
+ ```TypeScript
80
+ type MarkdownParser = (markdown: string) => string | Promise<string>;
81
+ ```
82
+
83
+ For demonstration only, we'll use [Marked](https://github.com/markedjs/marked). **Note that `marked` will be a development dependency, when configured correctly, markdown parsing will happen only at build time.**
84
+
85
+ Then we recommend using your favourite package manager to install the package.
42
86
 
43
87
  ```sh
44
88
  # npm
45
89
  npm add json-canvas-viewer
90
+ npm add marked -D
46
91
 
47
92
  # pnpm
48
93
  pnpm add json-canvas-viewer
94
+ pnpm add marked -D
49
95
 
50
96
  # yarn
51
97
  yarn add json-canvas-viewer
98
+ yarn add marked -D
52
99
  ```
53
100
 
54
- Or include the following lines directly in your HTML file:
101
+ You also need to configure your bundler to support seamless canvas resolution. Currently, we only support Vite:
55
102
 
56
- ```html
57
- <script type="module">
58
- import { JSONCanvasViewer } from 'https://unpkg.com/json-canvas-viewer/dist/index.js';
59
- </script>
103
+ ```TypeScript
104
+ // vite.config.ts
105
+ import { defineConfig } from 'vite';
106
+ import { jsonCanvasVitePlugin } from 'json-canvas-viewer/bridges';
107
+ import { marked } from 'marked';
108
+
109
+ export default defineConfig({
110
+ // ... your other config
111
+ plugins: [
112
+ jsonCanvasVitePlugin(marked),
113
+ // ... your other plugins
114
+ ]
115
+ })
60
116
  ```
61
117
 
62
- This link ships the latest ESM version by default, to access CJS version or earlier versions, try using a different URL like:
118
+ The argument is any markdown parser, when empty, build-time parsing is disabled.
63
119
 
64
- ```html
65
- <script src="https://unpkg.com/json-canvas-viewer@3.2.0/dist/index.cjs"></script>
66
- ```
120
+ The setup above gives you:
121
+ - bundler resolution of `.canvas` file as modules
122
+ - build-time parsing of `.canvas` files (less client-side overhead)
123
+ - ease for later framework integration and prerendering
67
124
 
68
- The link above ships version 3.2.0 in CJS.
125
+ ### Instantiation
69
126
 
70
- Then we can instantiate the viewer:
127
+ Instantiate the viewer:
71
128
 
72
129
  ```TypeScript
73
- import { Controls, JSONCanvasViewer, Minimap, MistouchPreventer } from 'json-canvas-viewer';
130
+ import { JSONCanvasViewer } from 'json-canvas-viewer';
131
+ import { Minimap } from 'json-canvas-viewer/modules';
132
+ import canvasData from 'path/to/your.canvas';
74
133
 
75
134
  new JSONCanvasViewer(
76
135
  {
77
136
  container: document.body, // The element to attach the viewer to
78
- canvasPath: './Example/introduction.canvas', // The path to the canvas to load
79
- controlsCollapsed: true, // Other options, depending on the modules you passed in
80
- mistouchPreventer: {
81
- preventAtStart: false,
82
- },
137
+ canvas: canvasData, // The path to the canvas to load
83
138
  },
84
- [Controls, Minimap, MistouchPreventer], // The modules to load
139
+ [Minimap], // The modules to load
85
140
  );
86
141
  ```
87
142
 
88
- And the viewer should be right in the body, you can instantiate the viewer multiple times to render multiple canvases.
143
+ And the viewer should be right there, you can instantiate the viewer multiple times to render multiple canvases.
144
+
145
+ ## 🤝 Get Involved
146
+
147
+ This project welcomes anyone that have ideas to improve it.
148
+
149
+ - [Open a pull request](https://github.com/hesprs/pointeract/compare) for a new module, documentation update, and so on.
150
+ - [Open an issue](https://github.com/hesprs/pointeract/issues/new) if you find a bug.
151
+ - [Start a new thread in Discussions](https://github.com/hesprs/pointeract/discussions/new) if you have feature requests or questions, please avoid posting them in Issues.
152
+ - [Report a vulnerability](https://github.com/hesprs/pointeract/security/advisories/new) if you find one, please do not disclose it publicly.
89
153
 
90
154
  ## 📝 Copyright & License
91
155
 
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("./index-RXeXyAu0.cjs"),n=require("vue");async function r(e){const t=t=>function(e,t){switch(e.type){case"text":return t(e.text);case"file":return function(e,t){if(e.file.match(/\.md$/i))return async function(e,t){let n;try{const r=await fetch(e),a=await r.text(),i=a.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);n=i?await t(i[2]):await t(a)}catch{n="Failed to load content."}return n}(e.file,t);if(e.file.match(/\.(png|jpg|jpeg|gif|svg|webp)$/i))return`<img src="${e.file}" alt="${e.file.split("/").pop()}">`;if(e.file.match(/\.(mp3|wav)$/i))return`<audio src="${e.file}" controls></audio>`}(e,t);case"link":return`<a href="${e.url}" target="_blank" rel="nofollow">${e.url}</a>`;default:return""}}(t,e.markdownParser||(e=>e)),n=e.canvas.nodes||[],r=e.attachmentDir||"./";n.forEach(e=>{if("file"===e.type&&!e.file.includes("http")){const t=e.file.split("/");e.file=r+t.pop()}});let a="";return n.forEach(e=>{a+=t(e)}),a}const a=["innerHTML"],i=n.defineComponent({__name:"vueComponent",props:{modules:{},options:{},isPrerendering:{type:Boolean}},async setup(e){let i,o;const s=e,l=s.isPrerendering||"undefined"==typeof window,c=n.useTemplateRef("viewerRef");let u=null;const f=l?([i,o]=n.withAsyncContext(()=>r(s.options)),i=await i,o(),i):"";return n.onMounted(()=>{c.value&&(u=new t.JSONCanvasViewer(Object.assign(s.options,{container:c.value}),s.modules))}),n.onUnmounted(()=>{u?.dispose(),u=null}),(e,t)=>(n.openBlock(),n.createElementBlock("section",{ref_key:"viewerRef",ref:c,innerHTML:n.unref(f),style:{"max-height":"100vh","max-width":"100vw"}},null,8,a))}});exports.JSONCanvasViewerReact=function({modules:n,options:r,prerenderedContent:a="",className:i,style:o,id:s}){const l=e.useRef(null);return e.useEffect(()=>{if(!l.current)return;return new t.JSONCanvasViewer(Object.assign(r,{container:l.current}),n).dispose},[]),React.createElement("section",{ref:l,dangerouslySetInnerHTML:{__html:a},style:o,className:i,id:s})},exports.JSONCanvasViewerVue=i,exports.jsonCanvasVitePlugin=function(e){return{name:"json-canvas-vite-plugin",async transform(t,n){if(!n.endsWith(".canvas"))return null;try{const n=JSON.parse(t);return e&&n.nodes&&await Promise.all(n.nodes.map(async t=>{"text"===t.type&&(t.text=await e(t.text))})),{code:`export default ${JSON.stringify(n)}`,map:null}}catch(r){throw console.error(`[json-canvas] Failed to parse: ${n}`),r}}}},exports.renderToString=r;
2
+ //# sourceMappingURL=bridges.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridges.cjs","sources":["../src/bridges/renderToString.ts","../src/bridges/vueComponent.vue","../src/bridges/reactComponent.tsx","../src/bridges/vitePlugin.ts"],"sourcesContent":["import type { MarkdownParser } from '$/declarations';\n\nexport default async function (options: {\n\tcanvas: JSONCanvas;\n\tattachmentDir?: string;\n\tmarkdownParser?: MarkdownParser;\n}) {\n\tconst render = (node: JSONCanvasNode) =>\n\t\trenderer(node, options.markdownParser || ((markdown: string) => markdown));\n\tconst nodes = options.canvas.nodes || [];\n\tconst basePath = options.attachmentDir || './';\n\tnodes.forEach(node => {\n\t\tif (node.type === 'file' && !node.file.includes('http')) {\n\t\t\tconst file = node.file.split('/');\n\t\t\tnode.file = basePath + file.pop();\n\t\t}\n\t});\n\tlet result = '';\n\tnodes.forEach(node => {\n\t\tresult += render(node);\n\t});\n\treturn result;\n}\n\nfunction renderer(node: JSONCanvasNode, parse: MarkdownParser) {\n\tswitch (node.type) {\n\t\tcase 'text':\n\t\t\treturn parse(node.text);\n\t\tcase 'file':\n\t\t\treturn fileProcessor(node, parse);\n\t\tcase 'link':\n\t\t\treturn `<a href=\"${node.url}\" target=\"_blank\" rel=\"nofollow\">${node.url}</a>`;\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\nfunction fileProcessor(node: JSONCanvasFileNode, parse: MarkdownParser) {\n\tif (node.file.match(/\\.md$/i)) return loadMarkdown(node.file, parse);\n\telse if (node.file.match(/\\.(png|jpg|jpeg|gif|svg|webp)$/i))\n\t\treturn `<img src=\"${node.file}\" alt=\"${node.file.split('/').pop()}\">`;\n\telse if (node.file.match(/\\.(mp3|wav)$/i)) return `<audio src=\"${node.file}\" controls></audio>`;\n}\n\nasync function loadMarkdown(path: string, parse: MarkdownParser) {\n\tlet parsedContent: string;\n\ttry {\n\t\tconst response = await fetch(path);\n\t\tconst result = await response.text();\n\t\tconst frontmatterMatch = result.match(/^---\\n([\\s\\S]*?)\\n---\\n([\\s\\S]*)$/);\n\t\tif (frontmatterMatch) parsedContent = await parse(frontmatterMatch[2]);\n\t\telse parsedContent = await parse(result);\n\t} catch {\n\t\tparsedContent = 'Failed to load content.';\n\t}\n\treturn parsedContent;\n}\n","<script lang=\"ts\" generic=\"T extends ModuleInputCtor\" setup>\nimport { onMounted, onUnmounted, useTemplateRef } from 'vue';\nimport JSONCanvasViewer from '$';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\nimport renderToString from './renderToString';\n\ntype ComponentOptions<T extends ModuleInputCtor> = {\n\tmodules?: T;\n\toptions: Omit<UserOptions<T>, 'container'>;\n\tisPrerendering?: boolean;\n};\n\nconst props = defineProps<ComponentOptions<T>>();\n\nconst isPrerendering = props.isPrerendering || typeof window === 'undefined';\nconst viewerRef = useTemplateRef('viewerRef');\nlet viewer: JSONCanvasViewer<ModuleInputCtor> | null = null;\nconst prerender = isPrerendering ? await renderToString(props.options) : '';\n\nonMounted(() => {\n\tif (!viewerRef.value) return;\n\tviewer = new JSONCanvasViewer(\n\t\tObject.assign(props.options, { container: viewerRef.value }) as UserOptions<T>,\n\t\tprops.modules,\n\t);\n});\n\nonUnmounted(() => {\n\tviewer?.dispose();\n\tviewer = null;\n});\n</script>\n\n<template>\n\t<section ref=\"viewerRef\" v-html=\"prerender\" style=\"max-height: 100vh; max-width: 100vw;\" />\n</template>\n","import { useEffect, useRef } from 'react';\nimport JSONCanvasViewer from '$';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\n\nexport default function JSONCanvasViewerReact<T extends ModuleInputCtor>({\n\tmodules,\n\toptions,\n\tprerenderedContent = '',\n\tclassName,\n\tstyle,\n\tid,\n}: {\n\tmodules: T;\n\toptions: Omit<UserOptions<T>, 'container'>;\n\tprerenderedContent?: string;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\tid?: string;\n}) {\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\tif (!containerRef.current) return;\n\t\tconst instance = new JSONCanvasViewer(\n\t\t\tObject.assign(options, { container: containerRef.current }) as UserOptions<T>,\n\t\t\tmodules,\n\t\t);\n\t\treturn instance.dispose;\n\t}, []);\n\n\treturn (\n\t\t<section\n\t\t\tref={containerRef}\n\t\t\tdangerouslySetInnerHTML={{ __html: prerenderedContent }}\n\t\t\tstyle={style}\n\t\t\tclassName={className}\n\t\t\tid={id}\n\t\t/>\n\t);\n}\n","import type { MarkdownParser } from '$/declarations';\n\nexport default function (parser?: MarkdownParser) {\n\treturn {\n\t\tname: 'json-canvas-vite-plugin',\n\t\tasync transform(code: string, id: string) {\n\t\t\tif (!id.endsWith('.canvas')) return null;\n\t\t\ttry {\n\t\t\t\tconst json = JSON.parse(code) as JSONCanvas;\n\t\t\t\tif (parser && json.nodes)\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tjson.nodes.map(async node => {\n\t\t\t\t\t\t\tif (node.type === 'text') node.text = await parser(node.text);\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tcode: `export default ${JSON.stringify(json)}`,\n\t\t\t\t\tmap: null,\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(`[json-canvas] Failed to parse: ${id}`);\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t},\n\t};\n}\n"],"names":["async","renderToString","options","render","node","parse","type","text","file","match","path","parsedContent","response","fetch","result","frontmatterMatch","loadMarkdown","split","pop","fileProcessor","url","renderer","markdownParser","markdown","nodes","canvas","basePath","attachmentDir","forEach","includes","props","__props","isPrerendering","window","viewerRef","useTemplateRef","viewer","prerender","__temp","__restore","_withAsyncContext","onMounted","value","JSONCanvasViewer","Object","assign","container","modules","onUnmounted","dispose","_createElementBlock","ref","innerHTML","_unref","style","prerenderedContent","className","id","containerRef","useRef","useEffect","current","React","createElement","dangerouslySetInnerHTML","__html","parser","name","transform","code","endsWith","json","JSON","Promise","all","map","stringify","e","console","error"],"mappings":"4JAEAA,eAAAC,EAA+BC,GAK9B,MAAMC,EAAUC,GAiBjB,SAAkBA,EAAsBC,GACvC,OAAQD,EAAKE,MACZ,IAAK,OACJ,OAAOD,EAAMD,EAAKG,MACnB,IAAK,OACJ,OAQH,SAAuBH,EAA0BC,GAChD,GAAID,EAAKI,KAAKC,MAAM,UAAW,OAMhCT,eAA4BU,EAAcL,GACzC,IAAIM,EACJ,IACC,MAAMC,QAAiBC,MAAMH,GACvBI,QAAeF,EAASL,OACxBQ,EAAmBD,EAAOL,MAAM,qCAChBE,EAAlBI,QAAwCV,EAAMU,EAAiB,UACxCV,EAAMS,EAClC,CAAA,MACCH,EAAgB,yBACjB,CACA,OAAOA,CACR,CAlBuCK,CAAaZ,EAAKI,KAAMH,GAAK,GAC1DD,EAAKI,KAAKC,MAAM,mCACxB,MAAO,aAAaL,EAAKI,cAAcJ,EAAKI,KAAKS,MAAM,KAAKC,UAAK,GACzDd,EAAKI,KAAKC,MAAM,iBAAkB,MAAO,eAAeL,EAAKI,yBACvE,CAbUW,CAAcf,EAAMC,GAC5B,IAAK,OACJ,MAAO,YAAYD,EAAKgB,uCAAuChB,EAAKgB,UACrE,QACC,MAAO,GAEV,CA3BEC,CAASjB,EAAMF,EAAQoB,gBAAA,CAAoBC,GAAqBA,IAC3DC,EAAQtB,EAAQuB,OAAOD,OAAS,GAChCE,EAAWxB,EAAQyB,eAAiB,KAC1CH,EAAMI,QAAQxB,IACb,GAAkB,SAAdA,EAAKE,OAAoBF,EAAKI,KAAKqB,SAAS,QAAS,CACxD,MAAMrB,EAAOJ,EAAKI,KAAKS,MAAM,KAC7Bb,EAAKI,KAAOkB,EAAWlB,EAAKU,KAC7B,IAED,IAAIJ,EAAS,GAIb,OAHAU,EAAMI,QAAQxB,IACbU,GAAUX,EAAOC,KAEXU,CACR,qJCVA,MAAMgB,EAAQC,EAERC,EAAiBF,EAAME,gBAAoC,oBAAXC,OAChDC,EAAYC,EAAAA,eAAe,aACjC,IAAIC,EAAmD,KACvD,MAAMC,EAAYL,IAAiBM,EAAAC,GAAAC,EAAAA,iBAAA,IAAMvC,EAAe6B,EAAM5B,2BAAW,UAEzEuC,EAAAA,UAAU,KACJP,EAAUQ,QACfN,EAAS,IAAIO,EAAAA,iBACZC,OAAOC,OAAOf,EAAM5B,QAAS,CAAE4C,UAAWZ,EAAUQ,QACpDZ,EAAMiB,YAIRC,EAAAA,YAAY,KACXZ,GAAQa,UACRb,EAAS,6BAKTc,EAAAA,mBAA2F,UAAA,SAA9E,YAAJC,IAAIjB,EAAYkB,UAAQC,EAAAA,MAAAhB,GAAWiB,MAAA,CAAA,aAAA,QAAA,YAAA,sDC9B7C,UAAyEP,QACxEA,EAAA7C,QACAA,EAAAqD,mBACAA,EAAqB,GAAAC,UACrBA,EAAAF,MACAA,EAAAG,GACAA,IASA,MAAMC,EAAeC,EAAAA,OAAuB,MAW5C,OATAC,EAAAA,UAAU,KACT,IAAKF,EAAaG,QAAS,OAK3B,OAJiB,IAAIlB,EAAAA,iBACpBC,OAAOC,OAAO3C,EAAS,CAAE4C,UAAWY,EAAaG,UACjDd,GAEeE,SACd,IAGFa,MAAAC,cAAC,UAAA,CACAZ,IAAKO,EACLM,wBAAyB,CAAEC,OAAQV,GACnCD,QACAE,YACAC,MAGH,6DCrCA,SAAyBS,GACxB,MAAO,CACNC,KAAM,0BACN,eAAMC,CAAUC,EAAcZ,GAC7B,IAAKA,EAAGa,SAAS,WAAY,OAAO,KACpC,IACC,MAAMC,EAAOC,KAAKnE,MAAMgE,GAOxB,OANIH,GAAUK,EAAK/C,aACZiD,QAAQC,IACbH,EAAK/C,MAAMmD,IAAI3E,MAAMI,IACF,SAAdA,EAAKE,OAAiBF,EAAKG,WAAa2D,EAAO9D,EAAKG,UAGpD,CACN8D,KAAM,kBAAkBG,KAAKI,UAAUL,KACvCI,IAAK,KAEP,OAASE,GAER,MADAC,QAAQC,MAAM,kCAAkCtB,KAC1CoB,CACP,CACD,EAEF"}
@@ -0,0 +1,2 @@
1
+ import{useRef as e,useEffect as t}from"react";import{J as n}from"./index-ujiv9m9Y.js";import{defineComponent as r,useTemplateRef as a,withAsyncContext as i,onMounted as s,onUnmounted as o,createElementBlock as l,openBlock as c,unref as u}from"vue";function f({modules:r,options:a,prerenderedContent:i="",className:s,style:o,id:l}){const c=e(null);return t(()=>{if(!c.current)return;return new n(Object.assign(a,{container:c.current}),r).dispose},[]),/* @__PURE__ */React.createElement("section",{ref:c,dangerouslySetInnerHTML:{__html:i},style:o,className:s,id:l})}async function p(e){const t=t=>function(e,t){switch(e.type){case"text":return t(e.text);case"file":return function(e,t){if(e.file.match(/\.md$/i))return async function(e,t){let n;try{const r=await fetch(e),a=await r.text(),i=a.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);n=i?await t(i[2]):await t(a)}catch{n="Failed to load content."}return n}(e.file,t);if(e.file.match(/\.(png|jpg|jpeg|gif|svg|webp)$/i))return`<img src="${e.file}" alt="${e.file.split("/").pop()}">`;if(e.file.match(/\.(mp3|wav)$/i))return`<audio src="${e.file}" controls></audio>`}(e,t);case"link":return`<a href="${e.url}" target="_blank" rel="nofollow">${e.url}</a>`;default:return""}}(t,e.markdownParser||(e=>e)),n=e.canvas.nodes||[],r=e.attachmentDir||"./";n.forEach(e=>{if("file"===e.type&&!e.file.includes("http")){const t=e.file.split("/");e.file=r+t.pop()}});let a="";return n.forEach(e=>{a+=t(e)}),a}function d(e){return{name:"json-canvas-vite-plugin",async transform(t,n){if(!n.endsWith(".canvas"))return null;try{const n=JSON.parse(t);return e&&n.nodes&&await Promise.all(n.nodes.map(async t=>{"text"===t.type&&(t.text=await e(t.text))})),{code:`export default ${JSON.stringify(n)}`,map:null}}catch(r){throw console.error(`[json-canvas] Failed to parse: ${n}`),r}}}}const m=["innerHTML"],w=/* @__PURE__ */r({__name:"vueComponent",props:{modules:{},options:{},isPrerendering:{type:Boolean}},async setup(e){let t,r;const f=e,d=f.isPrerendering||"undefined"==typeof window,w=a("viewerRef");let h=null;const y=d?([t,r]=i(()=>p(f.options)),t=await t,r(),t):"";return s(()=>{w.value&&(h=new n(Object.assign(f.options,{container:w.value}),f.modules))}),o(()=>{h?.dispose(),h=null}),(e,t)=>(c(),l("section",{ref_key:"viewerRef",ref:w,innerHTML:u(y),style:{"max-height":"100vh","max-width":"100vw"}},null,8,m))}});export{f as JSONCanvasViewerReact,w as JSONCanvasViewerVue,d as jsonCanvasVitePlugin,p as renderToString};
2
+ //# sourceMappingURL=bridges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridges.js","sources":["../src/bridges/reactComponent.tsx","../src/bridges/renderToString.ts","../src/bridges/vitePlugin.ts","../src/bridges/vueComponent.vue"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport JSONCanvasViewer from '$';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\n\nexport default function JSONCanvasViewerReact<T extends ModuleInputCtor>({\n\tmodules,\n\toptions,\n\tprerenderedContent = '',\n\tclassName,\n\tstyle,\n\tid,\n}: {\n\tmodules: T;\n\toptions: Omit<UserOptions<T>, 'container'>;\n\tprerenderedContent?: string;\n\tclassName?: string;\n\tstyle?: React.CSSProperties;\n\tid?: string;\n}) {\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\tif (!containerRef.current) return;\n\t\tconst instance = new JSONCanvasViewer(\n\t\t\tObject.assign(options, { container: containerRef.current }) as UserOptions<T>,\n\t\t\tmodules,\n\t\t);\n\t\treturn instance.dispose;\n\t}, []);\n\n\treturn (\n\t\t<section\n\t\t\tref={containerRef}\n\t\t\tdangerouslySetInnerHTML={{ __html: prerenderedContent }}\n\t\t\tstyle={style}\n\t\t\tclassName={className}\n\t\t\tid={id}\n\t\t/>\n\t);\n}\n","import type { MarkdownParser } from '$/declarations';\n\nexport default async function (options: {\n\tcanvas: JSONCanvas;\n\tattachmentDir?: string;\n\tmarkdownParser?: MarkdownParser;\n}) {\n\tconst render = (node: JSONCanvasNode) =>\n\t\trenderer(node, options.markdownParser || ((markdown: string) => markdown));\n\tconst nodes = options.canvas.nodes || [];\n\tconst basePath = options.attachmentDir || './';\n\tnodes.forEach(node => {\n\t\tif (node.type === 'file' && !node.file.includes('http')) {\n\t\t\tconst file = node.file.split('/');\n\t\t\tnode.file = basePath + file.pop();\n\t\t}\n\t});\n\tlet result = '';\n\tnodes.forEach(node => {\n\t\tresult += render(node);\n\t});\n\treturn result;\n}\n\nfunction renderer(node: JSONCanvasNode, parse: MarkdownParser) {\n\tswitch (node.type) {\n\t\tcase 'text':\n\t\t\treturn parse(node.text);\n\t\tcase 'file':\n\t\t\treturn fileProcessor(node, parse);\n\t\tcase 'link':\n\t\t\treturn `<a href=\"${node.url}\" target=\"_blank\" rel=\"nofollow\">${node.url}</a>`;\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\nfunction fileProcessor(node: JSONCanvasFileNode, parse: MarkdownParser) {\n\tif (node.file.match(/\\.md$/i)) return loadMarkdown(node.file, parse);\n\telse if (node.file.match(/\\.(png|jpg|jpeg|gif|svg|webp)$/i))\n\t\treturn `<img src=\"${node.file}\" alt=\"${node.file.split('/').pop()}\">`;\n\telse if (node.file.match(/\\.(mp3|wav)$/i)) return `<audio src=\"${node.file}\" controls></audio>`;\n}\n\nasync function loadMarkdown(path: string, parse: MarkdownParser) {\n\tlet parsedContent: string;\n\ttry {\n\t\tconst response = await fetch(path);\n\t\tconst result = await response.text();\n\t\tconst frontmatterMatch = result.match(/^---\\n([\\s\\S]*?)\\n---\\n([\\s\\S]*)$/);\n\t\tif (frontmatterMatch) parsedContent = await parse(frontmatterMatch[2]);\n\t\telse parsedContent = await parse(result);\n\t} catch {\n\t\tparsedContent = 'Failed to load content.';\n\t}\n\treturn parsedContent;\n}\n","import type { MarkdownParser } from '$/declarations';\n\nexport default function (parser?: MarkdownParser) {\n\treturn {\n\t\tname: 'json-canvas-vite-plugin',\n\t\tasync transform(code: string, id: string) {\n\t\t\tif (!id.endsWith('.canvas')) return null;\n\t\t\ttry {\n\t\t\t\tconst json = JSON.parse(code) as JSONCanvas;\n\t\t\t\tif (parser && json.nodes)\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tjson.nodes.map(async node => {\n\t\t\t\t\t\t\tif (node.type === 'text') node.text = await parser(node.text);\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tcode: `export default ${JSON.stringify(json)}`,\n\t\t\t\t\tmap: null,\n\t\t\t\t};\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(`[json-canvas] Failed to parse: ${id}`);\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t},\n\t};\n}\n","<script lang=\"ts\" generic=\"T extends ModuleInputCtor\" setup>\nimport { onMounted, onUnmounted, useTemplateRef } from 'vue';\nimport JSONCanvasViewer from '$';\nimport type { ModuleInputCtor, UserOptions } from '$/declarations';\nimport renderToString from './renderToString';\n\ntype ComponentOptions<T extends ModuleInputCtor> = {\n\tmodules?: T;\n\toptions: Omit<UserOptions<T>, 'container'>;\n\tisPrerendering?: boolean;\n};\n\nconst props = defineProps<ComponentOptions<T>>();\n\nconst isPrerendering = props.isPrerendering || typeof window === 'undefined';\nconst viewerRef = useTemplateRef('viewerRef');\nlet viewer: JSONCanvasViewer<ModuleInputCtor> | null = null;\nconst prerender = isPrerendering ? await renderToString(props.options) : '';\n\nonMounted(() => {\n\tif (!viewerRef.value) return;\n\tviewer = new JSONCanvasViewer(\n\t\tObject.assign(props.options, { container: viewerRef.value }) as UserOptions<T>,\n\t\tprops.modules,\n\t);\n});\n\nonUnmounted(() => {\n\tviewer?.dispose();\n\tviewer = null;\n});\n</script>\n\n<template>\n\t<section ref=\"viewerRef\" v-html=\"prerender\" style=\"max-height: 100vh; max-width: 100vw;\" />\n</template>\n"],"names":["JSONCanvasViewerReact","modules","options","prerenderedContent","className","style","id","containerRef","useRef","useEffect","current","JSONCanvasViewer","Object","assign","container","dispose","React","createElement","ref","dangerouslySetInnerHTML","__html","async","renderToString","render","node","parse","type","text","file","match","path","parsedContent","response","fetch","result","frontmatterMatch","loadMarkdown","split","pop","fileProcessor","url","renderer","markdownParser","markdown","nodes","canvas","basePath","attachmentDir","forEach","includes","vitePlugin","parser","name","transform","code","endsWith","json","JSON","Promise","all","map","stringify","e","console","error","props","__props","isPrerendering","window","viewerRef","useTemplateRef","viewer","prerender","__temp","__restore","_withAsyncContext","onMounted","value","onUnmounted","_createElementBlock","innerHTML","_unref"],"mappings":"wPAIA,SAAwBA,GAAiDC,QACxEA,EAAAC,QACAA,EAAAC,mBACAA,EAAqB,GAAAC,UACrBA,EAAAC,MACAA,EAAAC,GACAA,IASA,MAAMC,EAAeC,EAAuB,MAW5C,OATAC,EAAU,KACT,IAAKF,EAAaG,QAAS,OAK3B,OAJiB,IAAIC,EACpBC,OAAOC,OAAOX,EAAS,CAAEY,UAAWP,EAAaG,UACjDT,GAEec,SACd,mBAGFC,MAAAC,cAAC,UAAA,CACAC,IAAKX,EACLY,wBAAyB,CAAEC,OAAQjB,GACnCE,QACAD,YACAE,MAGH,CCrCAe,eAAAC,EAA+BpB,GAK9B,MAAMqB,EAAUC,GAiBjB,SAAkBA,EAAsBC,GACvC,OAAQD,EAAKE,MACZ,IAAK,OACJ,OAAOD,EAAMD,EAAKG,MACnB,IAAK,OACJ,OAQH,SAAuBH,EAA0BC,GAChD,GAAID,EAAKI,KAAKC,MAAM,UAAW,OAMhCR,eAA4BS,EAAcL,GACzC,IAAIM,EACJ,IACC,MAAMC,QAAiBC,MAAMH,GACvBI,QAAeF,EAASL,OACxBQ,EAAmBD,EAAOL,MAAM,qCAChBE,EAAlBI,QAAwCV,EAAMU,EAAiB,UACxCV,EAAMS,EAClC,CAAA,MACCH,EAAgB,yBACjB,CACA,OAAOA,CACR,CAlBuCK,CAAaZ,EAAKI,KAAMH,GAAK,GAC1DD,EAAKI,KAAKC,MAAM,mCACxB,MAAO,aAAaL,EAAKI,cAAcJ,EAAKI,KAAKS,MAAM,KAAKC,UAAK,GACzDd,EAAKI,KAAKC,MAAM,iBAAkB,MAAO,eAAeL,EAAKI,yBACvE,CAbUW,CAAcf,EAAMC,GAC5B,IAAK,OACJ,MAAO,YAAYD,EAAKgB,uCAAuChB,EAAKgB,UACrE,QACC,MAAO,GAEV,CA3BEC,CAASjB,EAAMtB,EAAQwC,gBAAA,CAAoBC,GAAqBA,IAC3DC,EAAQ1C,EAAQ2C,OAAOD,OAAS,GAChCE,EAAW5C,EAAQ6C,eAAiB,KAC1CH,EAAMI,QAAQxB,IACb,GAAkB,SAAdA,EAAKE,OAAoBF,EAAKI,KAAKqB,SAAS,QAAS,CACxD,MAAMrB,EAAOJ,EAAKI,KAAKS,MAAM,KAC7Bb,EAAKI,KAAOkB,EAAWlB,EAAKU,KAC7B,IAED,IAAIJ,EAAS,GAIb,OAHAU,EAAMI,QAAQxB,IACbU,GAAUX,EAAOC,KAEXU,CACR,CCpBA,SAAAgB,EAAyBC,GACxB,MAAO,CACNC,KAAM,0BACN,eAAMC,CAAUC,EAAchD,GAC7B,IAAKA,EAAGiD,SAAS,WAAY,OAAO,KACpC,IACC,MAAMC,EAAOC,KAAKhC,MAAM6B,GAOxB,OANIH,GAAUK,EAAKZ,aACZc,QAAQC,IACbH,EAAKZ,MAAMgB,IAAIvC,MAAMG,IACF,SAAdA,EAAKE,OAAiBF,EAAKG,WAAawB,EAAO3B,EAAKG,UAGpD,CACN2B,KAAM,kBAAkBG,KAAKI,UAAUL,KACvCI,IAAK,KAEP,OAASE,GAER,MADAC,QAAQC,MAAM,kCAAkC1D,KAC1CwD,CACP,CACD,EAEF,oJCbA,MAAMG,EAAQC,EAERC,EAAiBF,EAAME,gBAAoC,oBAAXC,OAChDC,EAAYC,EAAe,aACjC,IAAIC,EAAmD,KACvD,MAAMC,EAAYL,IAAiBM,EAAAC,GAAAC,EAAA,IAAMrD,EAAe2C,EAAM/D,2BAAW,UAEzE0E,EAAU,KACJP,EAAUQ,QACfN,EAAS,IAAI5D,EACZC,OAAOC,OAAOoD,EAAM/D,QAAS,CAAEY,UAAWuD,EAAUQ,QACpDZ,EAAMhE,YAIR6E,EAAY,KACXP,GAAQxD,UACRwD,EAAS,mBAKTQ,EAA2F,UAAA,SAA9E,YAAJ7D,IAAImD,EAAYW,UAAQC,EAAAT,GAAWnE,MAAA,CAAA,aAAA,QAAA,YAAA"}
package/dist/chimp.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:i,getOwnPropertyDescriptor:s}=Object;let{freeze:r,seal:o,create:a}=Object,{apply:l,construct:c}="undefined"!=typeof Reflect&&Reflect;r||(r=function(e){return e}),o||(o=function(e){return e}),l||(l=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(t,i)}),c||(c=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const h=S(Array.prototype.forEach),p=S(Array.prototype.lastIndexOf),u=S(Array.prototype.pop),d=S(Array.prototype.push),m=S(Array.prototype.splice),f=S(String.prototype.toLowerCase),g=S(String.prototype.toString),x=S(String.prototype.match),b=S(String.prototype.replace),k=S(String.prototype.indexOf),w=S(String.prototype.trim),v=S(Object.prototype.hasOwnProperty),y=S(RegExp.prototype.test),T=(C=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c(C,t)});var C;function S(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return l(e,t,i)}}function E(e,i){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:f;t&&t(e,null);let r=i.length;for(;r--;){let t=i[r];if("string"==typeof t){const e=s(t);e!==t&&(n(i)||(i[r]=e),t=e)}e[t]=!0}return e}function _(e){for(let t=0;t<e.length;t++){v(e,t)||(e[t]=null)}return e}function M(t){const n=a(null);for(const[i,s]of e(t)){v(t,i)&&(Array.isArray(s)?n[i]=_(s):s&&"object"==typeof s&&s.constructor===Object?n[i]=M(s):n[i]=s)}return n}function z(e,t){for(;null!==e;){const n=s(e,t);if(n){if(n.get)return S(n.get);if("function"==typeof n.value)return S(n.value)}e=i(e)}return function(){return null}}const R=r(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),A=r(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),D=r(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),L=r(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),I=r(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),N=r(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),O=r(["#text"]),P=r(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),$=r(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),B=r(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),F=r(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),H=o(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Y=o(/<%[\w\W]*|[\w\W]*%>/gm),U=o(/\$\{[\w\W]*/gm),X=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),j=o(/^aria-[\-\w]+$/),V=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),q=o(/^(?:\w+script|data):/i),W=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),G=o(/^html$/i),Z=o(/^[a-z][.\w]*(-[.\w]+)+$/i);var Q=Object.freeze({__proto__:null,ARIA_ATTR:j,ATTR_WHITESPACE:W,CUSTOM_ELEMENT:Z,DATA_ATTR:X,DOCTYPE_NAME:G,ERB_EXPR:Y,IS_ALLOWED_URI:V,IS_SCRIPT_OR_DATA:q,MUSTACHE_EXPR:H,TMPLIT_EXPR:U});const K=1,J=3,ee=7,te=8,ne=9;var ie=function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window;const i=e=>t(e);if(i.version="3.3.1",i.removed=[],!n||!n.document||n.document.nodeType!==ne||!n.Element)return i.isSupported=!1,i;let{document:s}=n;const o=s,l=o.currentScript,{DocumentFragment:c,HTMLTemplateElement:C,Node:S,Element:_,NodeFilter:H,NamedNodeMap:Y=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:U,DOMParser:X,trustedTypes:j}=n,q=_.prototype,W=z(q,"cloneNode"),Z=z(q,"remove"),ie=z(q,"nextSibling"),se=z(q,"childNodes"),re=z(q,"parentNode");if("function"==typeof C){const e=s.createElement("template");e.content&&e.content.ownerDocument&&(s=e.content.ownerDocument)}let oe,ae="";const{implementation:le,createNodeIterator:ce,createDocumentFragment:he,getElementsByTagName:pe}=s,{importNode:ue}=o;let de={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};i.isSupported="function"==typeof e&&"function"==typeof re&&le&&void 0!==le.createHTMLDocument;const{MUSTACHE_EXPR:me,ERB_EXPR:fe,TMPLIT_EXPR:ge,DATA_ATTR:xe,ARIA_ATTR:be,IS_SCRIPT_OR_DATA:ke,ATTR_WHITESPACE:we,CUSTOM_ELEMENT:ve}=Q;let{IS_ALLOWED_URI:ye}=Q,Te=null;const Ce=E({},[...R,...A,...D,...I,...O]);let Se=null;const Ee=E({},[...P,...$,...B,...F]);let _e=Object.seal(a(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Me=null,ze=null;const Re=Object.seal(a(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ae=!0,De=!0,Le=!1,Ie=!0,Ne=!1,Oe=!0,Pe=!1,$e=!1,Be=!1,Fe=!1,He=!1,Ye=!1,Ue=!0,Xe=!1,je=!0,Ve=!1,qe={},We=null;const Ge=E({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ze=null;const Qe=E({},["audio","video","img","source","image","track"]);let Ke=null;const Je=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),et="http://www.w3.org/1998/Math/MathML",tt="http://www.w3.org/2000/svg",nt="http://www.w3.org/1999/xhtml";let it=nt,st=!1,rt=null;const ot=E({},[et,tt,nt],g);let at=E({},["mi","mo","mn","ms","mtext"]),lt=E({},["annotation-xml"]);const ct=E({},["title","style","font","a","script"]);let ht=null;const pt=["application/xhtml+xml","text/html"];let ut=null,dt=null;const mt=s.createElement("form"),ft=function(e){return e instanceof RegExp||e instanceof Function},gt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!dt||dt!==e){if(e&&"object"==typeof e||(e={}),e=M(e),ht=-1===pt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,ut="application/xhtml+xml"===ht?g:f,Te=v(e,"ALLOWED_TAGS")?E({},e.ALLOWED_TAGS,ut):Ce,Se=v(e,"ALLOWED_ATTR")?E({},e.ALLOWED_ATTR,ut):Ee,rt=v(e,"ALLOWED_NAMESPACES")?E({},e.ALLOWED_NAMESPACES,g):ot,Ke=v(e,"ADD_URI_SAFE_ATTR")?E(M(Je),e.ADD_URI_SAFE_ATTR,ut):Je,Ze=v(e,"ADD_DATA_URI_TAGS")?E(M(Qe),e.ADD_DATA_URI_TAGS,ut):Qe,We=v(e,"FORBID_CONTENTS")?E({},e.FORBID_CONTENTS,ut):Ge,Me=v(e,"FORBID_TAGS")?E({},e.FORBID_TAGS,ut):M({}),ze=v(e,"FORBID_ATTR")?E({},e.FORBID_ATTR,ut):M({}),qe=!!v(e,"USE_PROFILES")&&e.USE_PROFILES,Ae=!1!==e.ALLOW_ARIA_ATTR,De=!1!==e.ALLOW_DATA_ATTR,Le=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ie=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Ne=e.SAFE_FOR_TEMPLATES||!1,Oe=!1!==e.SAFE_FOR_XML,Pe=e.WHOLE_DOCUMENT||!1,Fe=e.RETURN_DOM||!1,He=e.RETURN_DOM_FRAGMENT||!1,Ye=e.RETURN_TRUSTED_TYPE||!1,Be=e.FORCE_BODY||!1,Ue=!1!==e.SANITIZE_DOM,Xe=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,Ve=e.IN_PLACE||!1,ye=e.ALLOWED_URI_REGEXP||V,it=e.NAMESPACE||nt,at=e.MATHML_TEXT_INTEGRATION_POINTS||at,lt=e.HTML_INTEGRATION_POINTS||lt,_e=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ft(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_e.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ft(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_e.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(_e.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ne&&(De=!1),He&&(Fe=!0),qe&&(Te=E({},O),Se=[],!0===qe.html&&(E(Te,R),E(Se,P)),!0===qe.svg&&(E(Te,A),E(Se,$),E(Se,F)),!0===qe.svgFilters&&(E(Te,D),E(Se,$),E(Se,F)),!0===qe.mathMl&&(E(Te,I),E(Se,B),E(Se,F))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?Re.tagCheck=e.ADD_TAGS:(Te===Ce&&(Te=M(Te)),E(Te,e.ADD_TAGS,ut))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?Re.attributeCheck=e.ADD_ATTR:(Se===Ee&&(Se=M(Se)),E(Se,e.ADD_ATTR,ut))),e.ADD_URI_SAFE_ATTR&&E(Ke,e.ADD_URI_SAFE_ATTR,ut),e.FORBID_CONTENTS&&(We===Ge&&(We=M(We)),E(We,e.FORBID_CONTENTS,ut)),e.ADD_FORBID_CONTENTS&&(We===Ge&&(We=M(We)),E(We,e.ADD_FORBID_CONTENTS,ut)),je&&(Te["#text"]=!0),Pe&&E(Te,["html","head","body"]),Te.table&&(E(Te,["tbody"]),delete Me.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw T('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw T('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');oe=e.TRUSTED_TYPES_POLICY,ae=oe.createHTML("")}else void 0===oe&&(oe=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const s="dompurify"+(n?"#"+n:"");try{return e.createPolicy(s,{createHTML:e=>e,createScriptURL:e=>e})}catch(r){return console.warn("TrustedTypes policy "+s+" could not be created."),null}}(j,l)),null!==oe&&"string"==typeof ae&&(ae=oe.createHTML(""));r&&r(e),dt=e}},xt=E({},[...A,...D,...L]),bt=E({},[...I,...N]),kt=function(e){d(i.removed,{element:e});try{re(e).removeChild(e)}catch(t){Z(e)}},wt=function(e,t){try{d(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(n){d(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Fe||He)try{kt(t)}catch(n){}else try{t.setAttribute(e,"")}catch(n){}},vt=function(e){let t=null,n=null;if(Be)e="<remove></remove>"+e;else{const t=x(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ht&&it===nt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=oe?oe.createHTML(e):e;if(it===nt)try{t=(new X).parseFromString(i,ht)}catch(o){}if(!t||!t.documentElement){t=le.createDocument(it,"template",null);try{t.documentElement.innerHTML=st?ae:i}catch(o){}}const r=t.body||t.documentElement;return e&&n&&r.insertBefore(s.createTextNode(n),r.childNodes[0]||null),it===nt?pe.call(t,Pe?"html":"body")[0]:Pe?t.documentElement:r},yt=function(e){return ce.call(e.ownerDocument||e,e,H.SHOW_ELEMENT|H.SHOW_COMMENT|H.SHOW_TEXT|H.SHOW_PROCESSING_INSTRUCTION|H.SHOW_CDATA_SECTION,null)},Tt=function(e){return e instanceof U&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof Y)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Ct=function(e){return"function"==typeof S&&e instanceof S};function St(e,t,n){h(e,e=>{e.call(i,t,n,dt)})}const Et=function(e){let t=null;if(St(de.beforeSanitizeElements,e,null),Tt(e))return kt(e),!0;const n=ut(e.nodeName);if(St(de.uponSanitizeElement,e,{tagName:n,allowedTags:Te}),Oe&&e.hasChildNodes()&&!Ct(e.firstElementChild)&&y(/<[/\w!]/g,e.innerHTML)&&y(/<[/\w!]/g,e.textContent))return kt(e),!0;if(e.nodeType===ee)return kt(e),!0;if(Oe&&e.nodeType===te&&y(/<[/\w]/g,e.data))return kt(e),!0;if(!(Re.tagCheck instanceof Function&&Re.tagCheck(n))&&(!Te[n]||Me[n])){if(!Me[n]&&Mt(n)){if(_e.tagNameCheck instanceof RegExp&&y(_e.tagNameCheck,n))return!1;if(_e.tagNameCheck instanceof Function&&_e.tagNameCheck(n))return!1}if(je&&!We[n]){const t=re(e)||e.parentNode,n=se(e)||e.childNodes;if(n&&t){for(let i=n.length-1;i>=0;--i){const s=W(n[i],!0);s.__removalCount=(e.__removalCount||0)+1,t.insertBefore(s,ie(e))}}}return kt(e),!0}return e instanceof _&&!function(e){let t=re(e);t&&t.tagName||(t={namespaceURI:it,tagName:"template"});const n=f(e.tagName),i=f(t.tagName);return!!rt[e.namespaceURI]&&(e.namespaceURI===tt?t.namespaceURI===nt?"svg"===n:t.namespaceURI===et?"svg"===n&&("annotation-xml"===i||at[i]):Boolean(xt[n]):e.namespaceURI===et?t.namespaceURI===nt?"math"===n:t.namespaceURI===tt?"math"===n&&lt[i]:Boolean(bt[n]):e.namespaceURI===nt?!(t.namespaceURI===tt&&!lt[i])&&!(t.namespaceURI===et&&!at[i])&&!bt[n]&&(ct[n]||!xt[n]):!("application/xhtml+xml"!==ht||!rt[e.namespaceURI]))}(e)?(kt(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!y(/<\/no(script|embed|frames)/i,e.innerHTML)?(Ne&&e.nodeType===J&&(t=e.textContent,h([me,fe,ge],e=>{t=b(t,e," ")}),e.textContent!==t&&(d(i.removed,{element:e.cloneNode()}),e.textContent=t)),St(de.afterSanitizeElements,e,null),!1):(kt(e),!0)},_t=function(e,t,n){if(Ue&&("id"===t||"name"===t)&&(n in s||n in mt))return!1;if(De&&!ze[t]&&y(xe,t));else if(Ae&&y(be,t));else if(Re.attributeCheck instanceof Function&&Re.attributeCheck(t,e));else if(!Se[t]||ze[t]){if(!(Mt(e)&&(_e.tagNameCheck instanceof RegExp&&y(_e.tagNameCheck,e)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(e))&&(_e.attributeNameCheck instanceof RegExp&&y(_e.attributeNameCheck,t)||_e.attributeNameCheck instanceof Function&&_e.attributeNameCheck(t,e))||"is"===t&&_e.allowCustomizedBuiltInElements&&(_e.tagNameCheck instanceof RegExp&&y(_e.tagNameCheck,n)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(n))))return!1}else if(Ke[t]);else if(y(ye,b(n,we,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==k(n,"data:")||!Ze[e]){if(Le&&!y(ke,b(n,we,"")));else if(n)return!1}else;return!0},Mt=function(e){return"annotation-xml"!==e&&x(e,ve)},zt=function(e){St(de.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Tt(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se,forceKeepAttr:void 0};let s=t.length;for(;s--;){const o=t[s],{name:a,namespaceURI:l,value:c}=o,p=ut(a),d=c;let m="value"===a?d:w(d);if(n.attrName=p,n.attrValue=m,n.keepAttr=!0,n.forceKeepAttr=void 0,St(de.uponSanitizeAttribute,e,n),m=n.attrValue,!Xe||"id"!==p&&"name"!==p||(wt(a,e),m="user-content-"+m),Oe&&y(/((--!?|])>)|<\/(style|title|textarea)/i,m)){wt(a,e);continue}if("attributename"===p&&x(m,"href")){wt(a,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){wt(a,e);continue}if(!Ie&&y(/\/>/i,m)){wt(a,e);continue}Ne&&h([me,fe,ge],e=>{m=b(m,e," ")});const f=ut(e.nodeName);if(_t(f,p,m)){if(oe&&"object"==typeof j&&"function"==typeof j.getAttributeType)if(l);else switch(j.getAttributeType(f,p)){case"TrustedHTML":m=oe.createHTML(m);break;case"TrustedScriptURL":m=oe.createScriptURL(m)}if(m!==d)try{l?e.setAttributeNS(l,a,m):e.setAttribute(a,m),Tt(e)?kt(e):u(i.removed)}catch(r){wt(a,e)}}else wt(a,e)}St(de.afterSanitizeAttributes,e,null)},Rt=function e(t){let n=null;const i=yt(t);for(St(de.beforeSanitizeShadowDOM,t,null);n=i.nextNode();)St(de.uponSanitizeShadowNode,n,null),Et(n),zt(n),n.content instanceof c&&e(n.content);St(de.afterSanitizeShadowDOM,t,null)};return i.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,s=null,r=null,a=null;if(st=!e,st&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ct(e)){if("function"!=typeof e.toString)throw T("toString is not a function");if("string"!=typeof(e=e.toString()))throw T("dirty is not a string, aborting")}if(!i.isSupported)return e;if($e||gt(t),i.removed=[],"string"==typeof e&&(Ve=!1),Ve){if(e.nodeName){const t=ut(e.nodeName);if(!Te[t]||Me[t])throw T("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof S)n=vt("\x3c!----\x3e"),s=n.ownerDocument.importNode(e,!0),s.nodeType===K&&"BODY"===s.nodeName||"HTML"===s.nodeName?n=s:n.appendChild(s);else{if(!Fe&&!Ne&&!Pe&&-1===e.indexOf("<"))return oe&&Ye?oe.createHTML(e):e;if(n=vt(e),!n)return Fe?null:Ye?ae:""}n&&Be&&kt(n.firstChild);const l=yt(Ve?e:n);for(;r=l.nextNode();)Et(r),zt(r),r.content instanceof c&&Rt(r.content);if(Ve)return e;if(Fe){if(He)for(a=he.call(n.ownerDocument);n.firstChild;)a.appendChild(n.firstChild);else a=n;return(Se.shadowroot||Se.shadowrootmode)&&(a=ue.call(o,a,!0)),a}let p=Pe?n.outerHTML:n.innerHTML;return Pe&&Te["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&y(G,n.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+p),Ne&&h([me,fe,ge],e=>{p=b(p,e," ")}),oe&&Ye?oe.createHTML(p):p},i.setConfig=function(){gt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),$e=!0},i.clearConfig=function(){dt=null,$e=!1},i.isValidAttribute=function(e,t,n){dt||gt({});const i=ut(e),s=ut(t);return _t(i,s,n)},i.addHook=function(e,t){"function"==typeof t&&d(de[e],t)},i.removeHook=function(e,t){if(void 0!==t){const n=p(de[e],t);return-1===n?void 0:m(de[e],n,1)[0]}return u(de[e])},i.removeHooks=function(e){de[e]=[]},i.removeAllHooks=function(){de={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},i}();function se(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var re={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function oe(e){re=e}var ae={exec:()=>null};function le(e,t=""){let n="string"==typeof e?e:e.source,i={replace:(e,t)=>{let s="string"==typeof t?t:t.source;return s=s.replace(he.caret,"$1"),n=n.replace(e,s),i},getRegex:()=>new RegExp(n,t)};return i}var ce=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),he={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},pe=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ue=/(?:[*+-]|\d{1,9}[.)])/,de=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,me=le(de).replace(/bull/g,ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),fe=le(de).replace(/bull/g,ue).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ge=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,xe=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,be=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ke=le(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ue).getRegex(),we="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ve=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ye=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",ve).replace("tag",we).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Te=le(ge).replace("hr",pe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",we).getRegex(),Ce={blockquote:le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Te).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:be,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:pe,html:ye,lheading:me,list:ke,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Te,table:ae,text:/^[^\n]+/},Se=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",we).getRegex(),Ee={...Ce,lheading:fe,table:Se,paragraph:le(ge).replace("hr",pe).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Se).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",we).getRegex()},_e={...Ce,html:le("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",ve).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ae,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(ge).replace("hr",pe).replace("heading"," *#{1,6} *[^\n]").replace("lheading",me).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Me=/^( {2,}|\\)\n(?!\s*$)/,ze=/[\p{P}\p{S}]/u,Re=/[\s\p{P}\p{S}]/u,Ae=/[^\s\p{P}\p{S}]/u,De=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Re).getRegex(),Le=/(?!~)[\p{P}\p{S}]/u,Ie=le(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ce?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ne=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Oe=le(Ne,"u").replace(/punct/g,ze).getRegex(),Pe=le(Ne,"u").replace(/punct/g,Le).getRegex(),$e="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Be=le($e,"gu").replace(/notPunctSpace/g,Ae).replace(/punctSpace/g,Re).replace(/punct/g,ze).getRegex(),Fe=le($e,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,Le).getRegex(),He=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ae).replace(/punctSpace/g,Re).replace(/punct/g,ze).getRegex(),Ye=le(/\\(punct)/,"gu").replace(/punct/g,ze).getRegex(),Ue=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Xe=le(ve).replace("(?:--\x3e|$)","--\x3e").getRegex(),je=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Xe).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ve=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,qe=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ve).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),We=le(/^!?\[(label)\]\[(ref)\]/).replace("label",Ve).replace("ref",xe).getRegex(),Ge=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",xe).getRegex(),Ze=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Qe={_backpedal:ae,anyPunctuation:Ye,autolink:Ue,blockSkip:Ie,br:Me,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:ae,emStrongLDelim:Oe,emStrongRDelimAst:Be,emStrongRDelimUnd:He,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:qe,nolink:Ge,punctuation:De,reflink:We,reflinkSearch:le("reflink|nolink(?!\\()","g").replace("reflink",We).replace("nolink",Ge).getRegex(),tag:je,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:ae},Ke={...Qe,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",Ve).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ve).getRegex()},Je={...Qe,emStrongRDelimAst:Fe,emStrongLDelim:Pe,url:le(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ze).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:le(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ze).getRegex()},et={...Je,br:le(Me).replace("{2,}","*").getRegex(),text:le(Je.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},tt={normal:Ce,gfm:Ee,pedantic:_e},nt={normal:Qe,gfm:Je,breaks:et,pedantic:Ke},it={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},st=e=>it[e];function rt(e,t){if(t){if(he.escapeTest.test(e))return e.replace(he.escapeReplace,st)}else if(he.escapeTestNoEncode.test(e))return e.replace(he.escapeReplaceNoEncode,st);return e}function ot(e){try{e=encodeURI(e).replace(he.percentDecode,"%")}catch{return null}return e}function at(e,t){let n=e.replace(he.findPipe,(e,t,n)=>{let i=!1,s=t;for(;--s>=0&&"\\"===n[s];)i=!i;return i?"|":" |"}).split(he.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(he.slashPipe,"|");return n}function lt(e,t,n){let i=e.length;if(0===i)return"";let s=0;for(;s<i;){if(e.charAt(i-s-1)!==t)break;s++}return e.slice(0,i-s)}function ct(e,t,n,i,s){let r=t.href,o=t.title||null,a=e[1].replace(s.other.outputLinkReplace,"$1");i.state.inLink=!0;let l={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:r,title:o,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,l}var ht=class{options;rules;lexer;constructor(e){this.options=e||re}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:lt(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(null===i)return t;let s=i[1];return t.split("\n").map(e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[i]=t;return i.length>=s.length?e.slice(s.length):e}).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=lt(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:lt(t[0],"\n")}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=lt(t[0],"\n").split("\n"),n="",i="",s=[];for(;e.length>0;){let t,r=!1,o=[];for(t=0;t<e.length;t++)if(this.rules.other.blockquoteStart.test(e[t]))o.push(e[t]),r=!0;else{if(r)break;o.push(e[t])}e=e.slice(t);let a=o.join("\n"),l=a.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${a}`:a,i=i?`${i}\n${l}`:l;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,s,!0),this.lexer.state.top=c,0===e.length)break;let h=s.at(-1);if("code"===h?.type)break;if("blockquote"===h?.type){let t=h,r=t.raw+"\n"+e.join("\n"),o=this.blockquote(r);s[s.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,i=i.substring(0,i.length-t.text.length)+o.text;break}if("list"===h?.type){let t=h,r=t.raw+"\n"+e.join("\n"),o=this.list(r);s[s.length-1]=o,n=n.substring(0,n.length-h.raw.length)+o.raw,i=i.substring(0,i.length-t.raw.length)+o.raw,e=r.substring(s.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:n,tokens:s,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let r=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,i="",a="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;i=t[0],e=e.substring(i.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),c=e.split("\n",1)[0],h=!l.trim(),p=0;if(this.options.pedantic?(p=2,a=l.trimStart()):h?p=t[1].length+1:(p=t[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,a=l.slice(p),p+=t[1].length),h&&this.rules.other.blankLine.test(c)&&(i+=c+"\n",e=e.substring(c.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),s=this.rules.other.fencesBeginRegex(p),r=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p);for(;e;){let u,d=e.split("\n",1)[0];if(c=d,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),u=c):u=c.replace(this.rules.other.tabCharGlobal," "),s.test(c)||r.test(c)||o.test(c)||t.test(c)||n.test(c))break;if(u.search(this.rules.other.nonSpaceChar)>=p||!c.trim())a+="\n"+u.slice(p);else{if(h||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||s.test(l)||r.test(l)||n.test(l))break;a+="\n"+c}!h&&!c.trim()&&(h=!0),i+=d+"\n",e=e.substring(d.length+1),l=u.slice(p)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(i)&&(o=!0)),s.items.push({type:"list_item",raw:i,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]}),s.raw+=i}let a=s.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),s.raw=s.raw.trimEnd();for(let e of s.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,""),"text"===e.tokens[0]?.type||"paragraph"===e.tokens[0]?.type){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,"");break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:"checkbox",raw:t[0]+" ",checked:"[ ]"!==t[0]};e.checked=n.checked,s.loose?e.tokens[0]&&["paragraph","text"].includes(e.tokens[0].type)&&"tokens"in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:"paragraph",raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!s.loose){let t=e.tokens.filter(e=>"space"===e.type),n=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));s.loose=n}}if(s.loose)for(let e of s.items){e.loose=!0;for(let t of e.tokens)"text"===t.type&&(t.type="paragraph")}return s}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=at(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let e of i)this.rules.other.tableAlignRight.test(e)?r.align.push("right"):this.rules.other.tableAlignCenter.test(e)?r.align.push("center"):this.rules.other.tableAlignLeft.test(e)?r.align.push("left"):r.align.push(null);for(let e=0;e<n.length;e++)r.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:r.align[e]});for(let e of s)r.rows.push(at(e,r.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:r.align[t]})));return r}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=lt(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let i=0;i<e.length;i++)if("\\"===e[i])i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),ct(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return ct(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!i[1]&&!i[2]||!n||this.rules.inline.punctuation.exec(n))){let n,s,r=[...i[0]].length-1,o=r,a=0,l="*"===i[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+r);null!=(i=l.exec(t));){if(n=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!n)continue;if(s=[...n].length,i[3]||i[4]){o+=s;continue}if((i[5]||i[6])&&r%3&&!((r+s)%3)){a+=s;continue}if(o-=s,o>0)continue;s=Math.min(s,s+o+a);let t=[...i[0]][0].length,l=e.slice(0,r+i.index+t+s);if(Math.min(r,s)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),i=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&i&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let i;do{i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(i!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},pt=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||re,this.options.tokenizer=this.options.tokenizer||new ht,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:he,block:tt.normal,inline:nt.normal};this.options.pedantic?(t.block=tt.pedantic,t.inline=nt.pedantic):this.options.gfm&&(t.block=tt.gfm,this.options.breaks?t.inline=nt.breaks:t.inline=nt.gfm),this.tokenizer.rules=t}static get rules(){return{block:tt,inline:nt}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(he.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(he.tabCharGlobal," ").replace(he.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(n=>!!(i=n.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);1===i.raw.length&&void 0!==n?n.raw+="\n":t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+i.raw,n.text+="\n"+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+i.raw,n.text+="\n"+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let s=e;if(this.options.extensions?.startBlock){let t,n=1/0,i=e.slice(1);this.options.extensions.startBlock.forEach(e=>{t=e.call({lexer:this},i),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(s=e.substring(0,n+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){let r=t.at(-1);n&&"paragraph"===r?.type?(r.raw+=(r.raw.endsWith("\n")?"":"\n")+i.raw,r.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);"text"===n?.type?(n.raw+=(n.raw.endsWith("\n")?"":"\n")+i.raw,n.text+="\n"+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i=e,s=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(s=this.tokenizer.rules.inline.reflinkSearch.exec(i));)e.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(s=this.tokenizer.rules.inline.anyPunctuation.exec(i));)i=i.slice(0,s.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(s=this.tokenizer.rules.inline.blockSkip.exec(i));)n=s[2]?s[2].length:0,i=i.slice(0,s.index+n)+"["+"a".repeat(s[0].length-n-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let r=!1,o="";for(;e;){let n;if(r||(o=""),r=!1,this.options.extensions?.inline?.some(i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))continue;if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);let i=t.at(-1);"text"===n.type&&"text"===i?.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,i,o)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}let s=e;if(this.options.extensions?.startInline){let t,n=1/0,i=e.slice(1);this.options.extensions.startInline.forEach(e=>{t=e.call({lexer:this},i),"number"==typeof t&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(s=e.substring(0,n+1))}if(n=this.tokenizer.inlineText(s)){e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),r=!0;let i=t.at(-1);"text"===i?.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}},ut=class{options;parser;constructor(e){this.options=e||re}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(he.notSpaceStart)?.[0],s=e.replace(he.endingNewline,"")+"\n";return i?'<pre><code class="language-'+rt(i)+'">'+(n?s:rt(s,!0))+"</code></pre>\n":"<pre><code>"+(n?s:rt(s,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){let t=e.ordered,n=e.start,i="";for(let r=0;r<e.items.length;r++){let t=e.items[r];i+=this.listitem(t)}let s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+i+"</"+s+">\n"}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let t=e.rows[s];n="";for(let e=0;e<t.length;e++)n+=this.tablecell(t[e]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+i+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${rt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let i=this.parser.parseInline(n),s=ot(e);if(null===s)return i;let r='<a href="'+(e=s)+'"';return t&&(r+=' title="'+rt(t)+'"'),r+=">"+i+"</a>",r}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let s=ot(e);if(null===s)return rt(n);let r=`<img src="${e=s}" alt="${n}"`;return t&&(r+=` title="${rt(t)}"`),r+=">",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:rt(e.text)}},dt=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},mt=class e{options;renderer;textRenderer;constructor(e){this.options=e||re,this.options.renderer=this.options.renderer||new ut,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new dt}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){let t="";for(let n=0;n<e.length;n++){let i=e[n];if(this.options.extensions?.renderers?.[i.type]){let e=i,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==n||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){t+=n||"";continue}}let s=i;switch(s.type){case"space":t+=this.renderer.space(s);break;case"hr":t+=this.renderer.hr(s);break;case"heading":t+=this.renderer.heading(s);break;case"code":t+=this.renderer.code(s);break;case"table":t+=this.renderer.table(s);break;case"blockquote":t+=this.renderer.blockquote(s);break;case"list":t+=this.renderer.list(s);break;case"checkbox":t+=this.renderer.checkbox(s);break;case"html":t+=this.renderer.html(s);break;case"def":t+=this.renderer.def(s);break;case"paragraph":t+=this.renderer.paragraph(s);break;case"text":t+=this.renderer.text(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return t}parseInline(e,t=this.renderer){let n="";for(let i=0;i<e.length;i++){let s=e[i];if(this.options.extensions?.renderers?.[s.type]){let e=this.options.extensions.renderers[s.type].call({parser:this},s);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=e||"";continue}}let r=s;switch(r.type){case"escape":case"text":n+=t.text(r);break;case"html":n+=t.html(r);break;case"link":n+=t.link(r);break;case"image":n+=t.image(r);break;case"checkbox":n+=t.checkbox(r);break;case"strong":n+=t.strong(r);break;case"em":n+=t.em(r);break;case"codespan":n+=t.codespan(r);break;case"br":n+=t.br(r);break;case"del":n+=t.del(r);break;default:{let e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}},ft=class{options;block;constructor(e){this.options=e||re}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?pt.lex:pt.lexInline}provideParser(){return this.block?mt.parse:mt.parseInline}},gt=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=mt;Renderer=ut;TextRenderer=dt;Lexer=pt;Tokenizer=ht;Hooks=ft;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let e=i;for(let i of e.header)n=n.concat(this.walkTokens(i.tokens,t));for(let i of e.rows)for(let e of i)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{let e=i;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=i;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(i=>{let s=e[i].flat(1/0);n=n.concat(this.walkTokens(s,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=n.apply(this,t)),i}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new ut(this.defaults);for(let n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let i=n,s=e.renderer[i],r=t[i];t[i]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=r.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ht(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let i=n,s=e.tokenizer[i],r=t[i];t[i]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new ft;for(let n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let i=n,s=e.hooks[i],r=t[i];ft.passThroughHooks.has(n)?t[i]=e=>{if(this.defaults.async&&ft.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await s.call(t,e);return r.call(t,n)})();let i=s.call(t,e);return r.call(t,i)}:t[i]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await s.apply(t,e);return!1===n&&(n=await r.apply(t,e)),n})();let n=s.apply(t,e);return!1===n&&(n=r.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,i=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(i.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return pt.lex(e,t??this.defaults)}parser(e,t){return mt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},s={...this.defaults,...i},r=this.onError(!!s.silent,!!s.async);if(!0===this.defaults.async&&!1===i.async)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return r(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let n=s.hooks?await s.hooks.preprocess(t):t,i=await(s.hooks?await s.hooks.provideLexer():e?pt.lex:pt.lexInline)(n,s),r=s.hooks?await s.hooks.processAllTokens(i):i;s.walkTokens&&await Promise.all(this.walkTokens(r,s.walkTokens));let o=await(s.hooks?await s.hooks.provideParser():e?mt.parse:mt.parseInline)(r,s);return s.hooks?await s.hooks.postprocess(o):o})().catch(r);try{s.hooks&&(t=s.hooks.preprocess(t));let n=(s.hooks?s.hooks.provideLexer():e?pt.lex:pt.lexInline)(t,s);s.hooks&&(n=s.hooks.processAllTokens(n)),s.walkTokens&&this.walkTokens(n,s.walkTokens);let i=(s.hooks?s.hooks.provideParser():e?mt.parse:mt.parseInline)(n,s);return s.hooks&&(i=s.hooks.postprocess(i)),i}catch(o){return r(o)}}}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+rt(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function xt(e,t){return gt.parse(e,t)}xt.options=xt.setOptions=function(e){return gt.setOptions(e),xt.defaults=gt.defaults,oe(xt.defaults),xt},xt.getDefaults=se,xt.defaults=re,xt.use=function(...e){return gt.use(...e),xt.defaults=gt.defaults,oe(xt.defaults),xt},xt.walkTokens=function(e,t){return gt.walkTokens(e,t)},xt.parseInline=gt.parseInline,xt.Parser=mt,xt.parser=mt.parse,xt.Renderer=ut,xt.TextRenderer=dt,xt.Lexer=pt,xt.lexer=pt.lex,xt.Tokenizer=ht,xt.Hooks=ft,xt.parse=xt,xt.options,xt.setOptions,xt.use,xt.walkTokens,xt.parseInline,mt.parse,pt.lex;class bt{constructor(e,t,n,i){this.container=e,Object.assign(this.options,t),this.onStart=n.subscribe,this.onDispose=i.subscribe}onStart;onDispose;options={}}const kt={round:function(e,t){const n=10**t;return Math.round(e*n)/n},resizeCanvasForDPR:function(e,t,n){const i=window.devicePixelRatio||1,s=e.getContext("2d");if(!s)throw new Error("[JSONCanvasViewer] This error is unexpected, probably caused uncontrollable runtime errors. Please contact the developer and show how to reproduce.");e.width=Math.round(t*i),e.height=Math.round(n*i),s.setTransform(1,0,0,1,0,0),s.scale(i,i)},applyStyles:function(e,t){const n=document.createElement("style");n.innerHTML=t,e.appendChild(n)},drawRoundRect:function(e,t,n,i,s,r){e.beginPath(),e.moveTo(t+r,n),e.lineTo(t+i-r,n),e.quadraticCurveTo(t+i,n,t+i,n+r),e.lineTo(t+i,n+s-r),e.quadraticCurveTo(t+i,n+s,t+i-r,n+s),e.lineTo(t+r,n+s),e.quadraticCurveTo(t,n+s,t,n+s-r),e.lineTo(t,n+r),e.quadraticCurveTo(t,n,t+r,n),e.closePath()},getAnchorCoord:function(e,t){const n=e.x+e.width/2,i=e.y+e.height/2;switch(t){case"top":return[n,e.y];case"bottom":return[n,e.y+e.height];case"left":return[e.x,i];case"right":return[e.x+e.width,i];default:return[n,i]}},getColor:function(e="0"){let t=null;if(1===e.length)switch(e){case"1":t="rgba(255, 120, 129, ?)";break;case"2":t="rgba(251, 187, 131, ?)";break;case"3":t="rgba(255, 232, 139, ?)";break;case"4":t="rgba(124, 211, 124, ?)";break;case"5":t="rgba(134, 223, 226, ?)";break;case"6":t="rgba(203, 158, 255, ?)";break;default:t="rgba(140, 140, 140, ?)"}else{const n=function(e){const t=e.replace("#","");return{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16)}}(e);t=`rgba(${n.r}, ${n.g}, ${n.b}, ?)`}return{border:t.replace("?","0.75"),background:t.replace("?","0.1"),active:t.replace("?","1")}},makeHook:function(e=!1){const t=(...n)=>{if(e){Array.from(t.subs).reverse().forEach(e=>{e(...n)})}else t.subs.forEach(e=>{e(...n)})};return t.subs=new Set,t.subscribe=e=>{t.subs.add(e)},t.unsubscribe=e=>{t.subs.delete(e)},t}},wt=new Error("[JSONCanvasViewer] Resource hasn't been set up or has been disposed.");const vt=800;class yt extends bt{spatialGrid=null;onToggleFullscreen=kt.makeHook();data;constructor(...e){super(...e);const t=this.options.container;for(;t.firstElementChild;)t.firstElementChild.remove();t.innerHTML="";const n=this.options.noShadow||!1?t:t.attachShadow({mode:"open"});kt.applyStyles(n,".full,.click-layer,.link-iframe,.audio{top:0;left:0;width:100%;height:100%;position:absolute}.flex-center,.overlay-container.markdown-content{display:flex;justify-content:center;align-items:center}.container{--contentTransition: color .2s, opacity .2s, text-shadow .2s, fill .2s;--containerTransition: background .2s, opacity .2s, box-shadow .2s, border .2s, filter .2s, backdrop-filter .2s;color:#fff;fill:#fff;stroke:#fff;position:relative;width:100%;height:100%;overflow:hidden;background-color:#141414}.container.numb,.container.numb *{pointer-events:none!important}.main-canvas{width:100%;height:100%;transform-origin:top left}.overlays{position:absolute;top:0;left:0;width:10000px;height:10000px;transform-origin:top left;will-change:transform}.parsed-content-wrapper{font-family:sans-serif;box-sizing:border-box;max-width:100%;max-height:100%;padding:10px 6px;pointer-events:none;overflow:hidden;scrollbar-gutter:stable both-edges;display:flex;flex-direction:column;gap:12px}@supports not (scrollbar-gutter: stable both-edges){.parsed-content-wrapper{padding:10px}}.overlay-container{position:absolute;box-sizing:border-box;border-radius:12px;overflow:hidden;-webkit-user-select:none;user-select:none;contain:strict;content-visibility:auto}.overlay-container:hover{box-shadow:0 2px 12px #00000080}.overlay-container{transition:var(--containerTransition)}.overlay-container .overlay-border{box-sizing:border-box;pointer-events:none;position:absolute;top:0;left:0;width:100%;height:100%;border-width:2px;border-style:solid;border-radius:12px;transition:var(--containerTransition)}.overlay-container img{width:100%;height:100%;object-fit:cover;pointer-events:none}.overlay-container.active .overlay-border{border:6px solid var(--active-color)}.overlay-container.markdown-content{position:absolute;padding:0 7px}.overlay-container.markdown-content.active .parsed-content-wrapper{overflow:auto;-webkit-user-select:text;user-select:text;pointer-events:auto}.overlay-container.markdown-content.rtl{direction:rtl;text-align:right}.link-iframe,.audio{border:none;background:transparent}.click-layer{background:transparent;pointer-events:auto}.active .click-layer{pointer-events:none}::-webkit-scrollbar{width:4px}::-webkit-scrollbar-track{background-color:transparent}::-webkit-scrollbar-thumb{border-radius:2px;background:#ffffff40}::-webkit-scrollbar-thumb:hover{background:#1e1e1ebf}p{font-size:16px;line-height:21px}.parsed-content-wrapper img{width:100%;border-radius:8px}h1{font-size:25px}h2{font-size:23px}h3{font-size:22px}h4{font-size:20px}h5{font-size:19px}h6{font-size:17px}p,h1,h2,h3,h4,h5,h6,ol,ul{margin:0}h1,h2{font-weight:800}h3,h4{font-weight:700}h5,h6{font-weight:600}code{background:#ffffff1a;padding:2px 4px;border-radius:8px}pre code{display:block;box-sizing:border-box;width:100%}pre:has(code),table{margin:6px 0}strong{color:#fe8e7c}em{color:#5affb2}a{text-decoration:none;color:#6dadd0;font-weight:800;font-style:italic;cursor:pointer;transition:var(--contentTransition)}a:hover{color:#86d3fd}hr{height:1px;width:100%;background-color:#fff3;border:none}li{margin:5px 0}ul{padding-left:16px}ol{padding-left:15px;padding-right:7.5px}table{border-collapse:collapse;border-radius:8px;overflow:hidden;width:100%}table th,table td{border:1px solid rgba(255,255,255,.2);padding:6px 10px;background:#ffffff0f;text-align:left}table th{background:#ffffff1f;font-weight:700}"+this.options.extraCSS);const i=document.createElement("div");i.classList.add("container"),n.appendChild(i);const s=Object.assign({nodes:[],edges:[]},this.options.canvas);this.data={canvasData:s,canvasMap:{},canvasBaseDir:this.processBaseDir(this.options.attachmentDir),nodeBounds:this.calculateNodeBounds(s),offsetX:0,offsetY:0,scale:1,container:i},this.data.canvasData.nodes.forEach(e=>{this.data.canvasMap[e.id]={type:"node",ref:e};const t=this.data.canvasMap[e.id],n=t.ref;if("file"===n.type){const e=n.file.split("/").pop()||"";t.fileName=e,n.file.startsWith("http://")||n.file.startsWith("https://")||(n.file=this.data.canvasBaseDir+e)}}),this.data.canvasData.edges.forEach(e=>{this.data.canvasMap[e.id]={type:"edge",ref:e}}),this.buildSpatialGrid(),this.resetView(),this.onDispose(this.dispose)}processBaseDir=e=>{if(!e)return"./";const t=e?.slice(-1);return"/"===t?e:`${e}/`};findNodeAt=e=>{const{x:t,y:n}=this.C2W(this.C2C({x:e.x,y:e.y}));let i=[];if(this.spatialGrid){const e=`${Math.floor(t/vt)},${Math.floor(n/vt)}`;i=this.spatialGrid[e]||[]}else i=this.data.canvasData.nodes;for(const s of i)if(!(t<s.x||t>s.x+s.width||n<s.y||n>s.y+s.height||"non-interactive"===this.judgeInteract(s)))return s;return null};judgeInteract=e=>{switch(e?.type){case"text":case"link":return"select";case"file":return e.file.match(/\.(md|wav|mp3)$/i)?"select":"non-interactive";default:return"non-interactive"}};calculateNodeBounds(e){let t=1/0,n=1/0,i=-1/0,s=-1/0;e.nodes.forEach(e=>{t=Math.min(t,e.x),n=Math.min(n,e.y),i=Math.max(i,e.x+e.width),s=Math.max(s,e.y+e.height)});const r=i-t,o=s-n;return{minX:t,minY:n,maxX:i,maxY:s,width:r,height:o,centerX:t+r/2,centerY:n+o/2}}buildSpatialGrid(){const e=this.data.canvasData;if(!(e.nodes.length<50)){this.spatialGrid={};for(const t of e.nodes){const e=Math.floor(t.x/vt),n=Math.floor((t.x+t.width)/vt),i=Math.floor(t.y/vt),s=Math.floor((t.y+t.height)/vt);for(let r=e;r<=n;r++)for(let e=i;e<=s;e++){const n=`${r},${e}`;this.spatialGrid[n]||(this.spatialGrid[n]=[]),this.spatialGrid[n].push(t)}}}}zoom=(e,t)=>{const n=this.data.scale*e;this.zoomToScale(n,t)};zoomToScale=(e,t)=>{const n=Math.max(Math.min(e,20),.05),i=this.data.scale;if(n===i)return;const s=this.C2C(t);this.data.offsetX=t.x-s.x*n/i,this.data.offsetY=t.y-s.y*n/i,this.data.scale=n};pan=({x:e,y:t})=>{this.data.offsetX=this.data.offsetX+e,this.data.offsetY=this.data.offsetY+t};panToCoords=({x:e,y:t})=>{this.data.offsetX=e,this.data.offsetY=t};shiftFullscreen=(e="toggle")=>{document.fullscreenElement||"toggle"!==e&&"enter"!==e?!document.fullscreenElement||"toggle"!==e&&"exit"!==e||(document.exitFullscreen(),this.onToggleFullscreen(!1)):(this.data.container.requestFullscreen(),this.onToggleFullscreen(!0))};resetView=()=>{const e=this.data.nodeBounds,t=this.data.container;if(!e||!t)return;const n=e.width+200,i=e.height+200,s=t.clientWidth,r=t.clientHeight,o=s/n,a=r/i,l=Math.round(1e3*Math.min(o,a))/1e3,c={scale:l,offsetX:s/2-e.centerX*l,offsetY:r/2-e.centerY*l};this.data.offsetX=c.offsetX,this.data.offsetY=c.offsetY,this.data.scale=c.scale};C2C=({x:e,y:t})=>({x:e-this.data.offsetX,y:t-this.data.offsetY});C2W=({x:e,y:t})=>({x:e/this.data.scale,y:t/this.data.scale});middleViewer=()=>{const e=this.data.container;return{x:e.clientWidth/2,y:e.clientHeight/2,width:e.clientWidth,height:e.clientHeight}};dispose=()=>this.data.container.remove()}class Tt extends bt{animationId=null;resizeAnimationId=null;DM;resizeObserver;perFrame={lastScale:1,lastOffsets:{x:0,y:0}};lastResizeCenter={x:null,y:null};hooks={onResize:kt.makeHook(),onRefresh:kt.makeHook()};constructor(...e){super(...e),this.onStart(this.start),this.onDispose(this.dispose),this.DM=this.container.get(yt),this.resizeObserver=new ResizeObserver(this.onResize)}start=()=>{this.resizeObserver.observe(this.DM.data.container),this.animationId=requestAnimationFrame(this.draw)};draw=()=>{this.perFrame.lastScale===this.DM.data.scale&&this.perFrame.lastOffsets.x===this.DM.data.offsetX&&this.perFrame.lastOffsets.y===this.DM.data.offsetY||this.refresh(),this.animationId=requestAnimationFrame(this.draw)};refresh=()=>{this.perFrame.lastScale=this.DM.data.scale,this.perFrame.lastOffsets={x:this.DM.data.offsetX,y:this.DM.data.offsetY},this.hooks.onRefresh()};onResize=()=>{this.resizeAnimationId=requestAnimationFrame(()=>{const e=this.DM.middleViewer();this.lastResizeCenter.x&&this.lastResizeCenter.y&&(this.DM.data.offsetX=this.DM.data.offsetX+e.x-this.lastResizeCenter.x,this.DM.data.offsetY=this.DM.data.offsetY+e.y-this.lastResizeCenter.y),this.lastResizeCenter.x=e.x,this.lastResizeCenter.y=e.y,this.hooks.onResize(e.width,e.height),this.refresh()})};dispose=()=>{this.animationId&&cancelAnimationFrame(this.animationId),this.resizeAnimationId&&cancelAnimationFrame(this.resizeAnimationId),this.resizeObserver.disconnect()}}const Ct='<svg viewBox="-5.28 -5.28 34.56 34.56" fill="none"><path d="M4 9V5.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C4.76 4 5.04 4 5.6 4H9M4 15v3.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C4.76 20 5.04 20 5.6 20H9m6-16h3.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C20 4.76 20 5.04 20 5.6V9m0 6v3.4c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C19.24 20 18.96 20 18.4 20H15" stroke-width="2.4" stroke-linecap="round"/></svg>';function St(e){return"function"==typeof e}function Et(e){const t=[];let n=e;for(;Object.getPrototypeOf(n).name;){const e=Object.getPrototypeOf(n);t.push(e),n=e}return t}function _t(e){if(null==e)throw Error("Expected value to be not null or undefined");return e}function Mt(e,t){if(e.length>1)throw t();const n=e.at(0);if(void 0===n)throw t();return n}function zt(e){return St(e)}function Rt(e){return"provide"in e&&"useClass"in e}function At(e){return"provide"in e&&"useFactory"in e}function Dt(e){return At(e)&&!0===e.async}function Lt(e){return"provide"in e&&"useExisting"in e}function It(e){return"provide"in e&&"multi"in e&&!0===e.multi}class Nt{description;options;constructor(e,t){this.description=e,this.options=t}toString(){return`InjectionToken "${String(this.description)}"`}}function Ot(e){return St(e)}function Pt(e){return St(e)?e.name:"symbol"==typeof e?e.description??String(e):e instanceof Nt?e.toString():e}function $t(e){return zt(e)?e:e.provide}const Bt=Symbol("injectable");class Ft{container;underConstruction=[];constructor(e){this.container=e}construct(e,t){if(Dt(e))throw new Ht(t);try{if(this.underConstruction.includes(e)){const t=[...this.underConstruction,e].map($t).map(Pt);throw new Yt(t)}return this.underConstruction.push(e),this.doConstruct(e)}finally{this.underConstruction.pop()}}async constructAsync(e){try{if(this.underConstruction.includes(e)){const t=[...this.underConstruction,e].map($t).map(Pt);throw new Yt(t)}if(this.underConstruction.push(e),Dt(e))return[await e.useFactory(this.container)];if(Rt(e)||zt(e)){const t=zt(e)?()=>[new e]:()=>[new e.useClass];return async function(e,t,n){for(;;)try{return await t()}catch(i){if(!(i instanceof e))throw i;await n(i)}}(Ht,async()=>t(),async e=>{await this.container.getAsync(e.token,{multi:!0,optional:!0})})}return this.doConstruct(e)}finally{this.underConstruction.pop()}}doConstruct(e){return zt(e)?[new e]:Rt(e)?[new e.useClass]:function(e){return"provide"in e&&"useValue"in e}(e)?[e.useValue]:At(e)?[e.useFactory(this.container)]:Lt(e)?this.container.get(e.useExisting,{multi:!0}):function(){throw new Error("invalid state")}()}}class Ht extends Error{token;constructor(e){super(`Some providers for token ${Pt(e)} are async, please use injectAsync() or container.getAsync() instead`),this.token=e}}class Yt extends Error{constructor(e){super(`Detected circular dependency: ${e.join(" -> ")}. Please change your dependency graph or use lazy injection instead.`)}}class Ut{container;constructor(e){this.container=e}run(e){const t=Xt;try{return Xt=this,e(this.container)}finally{Xt=t}}async runAsync(e){const t=Xt;try{return Xt=this,await e(this.container)}finally{Xt=t}}}let Xt=new class{run(){throw new Vt}runAsync(){throw new Vt}};function jt(e){return new Ut(e)}class Vt extends Error{constructor(){super("You can only invoke inject() or injectAsync() within an injection context")}}class qt{providers=new Map;singletons=new Map;parent;factory;constructor(e){this.parent=e,this.factory=new Ft(this),this.bind({provide:qt,useValue:this})}bindAll(...e){return e.forEach(e=>this.bind(e)),this}bind(e){const t=$t(e);if(Lt(e)&&e.provide===e.useExisting)throw Error(`The provider for token ${Pt(t)} with "useExisting" cannot refer to itself.`);if(!Lt(e)&&this.singletons.has(t))throw Error(`Cannot bind a new provider for ${Pt(t)}, since the existing provider was already constructed.`);if(Lt(e)&&It(e)&&this.existingProviderAlreadyProvided(t,e.useExisting))return this;const n=this.providers.get(t)??[],i=It(e);if(i&&n.some(e=>!It(e)))throw Error(`Cannot bind ${Pt(t)} as multi-provider, since there is already a provider which is not a multi-provider.`);if(!i&&n.some(e=>It(e))&&!n.every(Lt))throw Error(`Cannot bind ${Pt(t)} as provider, since there are already provider(s) that are multi-providers.`);return this.providers.set(t,i?[...n,e]:[e]),Ot(t)&&(Rt(e)||zt(e))&&function(e,t=2){const n=[];return e.some((i,s)=>{if(s+t>e.length)return!0;n.push(e.slice(s,s+t))}),n}([t,...Et(t)]).forEach(([e,t])=>{const n={provide:t,useExisting:e,multi:!0},i=this.providers.get(t)??[];this.existingProviderAlreadyProvided(t,e)||this.providers.set(t,[...i,n])}),this}unbind(e){const t=$t(e);return this.providers.delete(t),this.singletons.delete(t),this}unbindAll(){return this.providers.clear(),this.singletons.clear(),this}get(e,t){if(t?.lazy??!1)return()=>this.get(e,{...t,lazy:!1});this.autoBindIfNeeded(e);const n=t?.optional??!1;if(!this.providers.has(e)){if(this.parent)return this.parent.get(e,{...t,lazy:!1});if(n)return;throw Error(`No provider(s) found for ${Pt(e)}`)}const i=_t(this.providers.get(e));this.singletons.has(e)||jt(this).run(()=>{const t=i.flatMap(t=>this.factory.construct(t,e));this.singletons.set(e,t)});const s=_t(this.singletons.get(e));return t?.multi??!1?s:Mt(s,()=>Error(`Requesting a single value for ${Pt(e)}, but multiple values were provided. Consider passing "{ multi: true }" to inject all values, or adjust your bindings accordingly.`))}getAsync(e,t){return t?.lazy??!1?()=>this.getAsync(e,{...t,lazy:!1}):async function(e){return await new Promise(t=>t(e()))}(async()=>{this.autoBindIfNeeded(e);const n=t?.optional??!1;if(!this.providers.has(e)){if(n)return;throw Error(`No provider(s) found for ${Pt(e)}`)}const i=_t(this.providers.get(e));this.singletons.has(e)||await jt(this).runAsync(async()=>{const t=await Promise.all(i.map(e=>this.factory.constructAsync(e)));this.singletons.set(e,t.flat())});const s=_t(this.singletons.get(e));return t?.multi??!1?s:Mt(s,()=>new Error(`Requesting a single value for ${Pt(e)}, but multiple values were provided. Consider passing "{ multi: true }" to inject all values, or adjust your bindings accordingly.`))})}createChild(){return new qt(this)}has(e){return this.providers.has(e)||(this.parent?.has(e)??!1)}autoBindIfNeeded(e){if(!this.singletons.has(e))if(Ot(e)&&e.hasOwnProperty(Bt)){const t=function(e){return e[Bt]}(e);t.filter(e=>!this.providers.has(e)).forEach(e=>{this.bind({provide:e,useClass:e,multi:!0})})}else if(!this.providers.has(e)&&function(e){return e instanceof Nt}(e)&&e.options?.factory){const t=e.options.async;t?t&&this.bind({provide:e,async:!0,useFactory:e.options.factory}):this.bind({provide:e,async:!1,useFactory:e.options.factory})}}existingProviderAlreadyProvided(e,t){return(this.providers.get(e)??[]).some(n=>Lt(n)&&n.provide===e&&n.useExisting===t)}}class Wt{utils;window;pointers;monitoringElement;constructor(e,t,n,i){this.utils=e,this.window=t,this.pointers=n,this.monitoringElement=i}options;dispose;modifier;onPointerDown;onPointerMove;onPointerUp;onWheel;onStart;onStop}class Gt extends Wt{#e=-1/0;#t=0;options={clickPreserveTime:400,moveThreshold:5};onPointerDown=(e,t,n)=>{2===n.size&&(this.utils.getNthValue(0).interrupted=!0,t.interrupted=!0)};onPointerUp=(e,t)=>{if(t.interrupted)return;const n=this.options.moveThreshold;if(Math.abs(t.records[0].x-e.clientX)>=n||Math.abs(t.records[0].y-e.clientY)>=n)return;const i=this.utils.getLast(t.records).timestamp;i-this.#e<=this.options.clickPreserveTime?this.#t++:this.#t=1,this.#e=i;const s=this.utils.screenToTarget({x:e.clientX,y:e.clientY});this.utils.dispatch("trueClick",{...s,target:t.target,streak:this.#t})}}class Zt extends Wt{onPointerMove=(e,t,n)=>{const i=this.utils.getLast(t.records,1);if(1===n.size){const t=e.clientX-i.x,n=e.clientY-i.y;this.utils.dispatch("drag",{x:t,y:n,clientX:e.clientX,clientY:e.clientY})}}}class Qt extends Wt{#n={lastDistance:0,lastMidpoint:{x:0,y:0}};#i(){const e=this.utils.getLast(this.utils.getNthValue(0).records),t=this.utils.getLast(this.utils.getNthValue(1).records),n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)}#s(){const e=this.utils.getLast(this.utils.getNthValue(0).records),t=this.utils.getLast(this.utils.getNthValue(1).records);return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}onPointerDown=(e,t,n)=>{2===n.size&&(this.#n.lastDistance=this.#i(),this.#n.lastMidpoint=this.utils.screenToTarget(this.#s()))};onPointerMove=(e,t,n)=>{if(2===n.size){const e=this.#i(),t=this.#s(),n=e/this.#n.lastDistance;this.#n.lastDistance=e;const i=this.utils.screenToTarget(t),s=i.x-this.#n.lastMidpoint.x,r=i.y-this.#n.lastMidpoint.y;this.#n.lastMidpoint=i,this.#r({x:s,y:r}),this.#o(n,i)}};#o(e,t){this.utils.dispatch("zoom",{x:t.x,y:t.y,factor:e})}#r(e){this.utils.dispatch("pan",e)}}class Kt extends Wt{onWheel=e=>e.preventDefault();#a=e=>e.preventDefault();onStart=()=>{this.monitoringElement.style.touchAction="none",this.monitoringElement.addEventListener("gesturestart",this.#a,{passive:!1}),this.monitoringElement.addEventListener("gesturechange",this.#a,{passive:!1})};onStop=()=>{this.monitoringElement.style.touchAction="",this.monitoringElement.removeEventListener("gesturestart",this.#a),this.monitoringElement.removeEventListener("gesturechange",this.#a)};dispose=this.onStop}class Jt extends Wt{options={proControlSchema:!1,zoomFactor:.1,lockControlSchema:!1};onWheel=e=>{const t=this.options;if(t.proControlSchema||t.lockControlSchema||!(e.ctrlKey||e.shiftKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))||(t.proControlSchema=!0),t.proControlSchema)if(e.ctrlKey){const n=e.deltaY>0?1-t.zoomFactor:1+t.zoomFactor,i=this.utils.screenToTarget({x:e.clientX,y:e.clientY});this.#o(n,i)}else e.shiftKey&&Math.abs(e.deltaX)<=Math.abs(e.deltaY)?this.#r({x:-e.deltaY,y:-e.deltaX}):this.#r({x:-e.deltaX,y:-e.deltaY});else{const n=1-t.zoomFactor/50*e.deltaY,i=this.utils.screenToTarget({x:e.clientX,y:e.clientY});this.#o(n,i)}};#o(e,t){this.utils.dispatch("zoom",{x:t.x,y:t.y,factor:e})}#r(e){this.utils.dispatch("pan",e)}}class en extends EventTarget{#l;#c=new Map;#h={};#p={};#u;options;get#d(){if(!this.#u)throw new Error("[Pointeract] Window is not defined.");return this.#u}constructor(e,t,n={}){super();const i=tn(t||[]);this.#u=e.ownerDocument.defaultView,this.#l=e,this.options=n,this.#m({coordinateOutput:"relative"}),i.forEach(e=>{const t=new e(this.moduleUtils,this.#d,this.#c,this.#l);t.options&&this.#m(t.options),Object.assign(t,{options:n}),this.#h[e.name]=t})}#m=e=>{for(const[t,n]of Object.entries(e))t in this.options||(this.options[t]=n)};on=(e,t)=>(super.addEventListener(e,t),()=>this.off(e,t));off(e,t){super.removeEventListener(e,t)}moduleUtils={getNthValue:e=>{const t=new Error("[Pointeract] Invalid pointer index");if(e<0||e>=this.#c.size)throw t;let n=0;for(const i of this.#c.values()){if(n===e)return i;n++}throw t},screenToTarget:e=>{if("absolute"===this.options.coordinateOutput)return e;const t=this.#l.getBoundingClientRect();return e.x-=t.left,e.y-=t.top,"relative"===this.options.coordinateOutput||(e.x/=t.width,e.y/=t.height),e},dispatch:(e,t)=>{let n,i=!0;for(const s of Object.values(this.#h))if(s.modifier&&(i=s.modifier(e,t),!0!==i))break;!1!==i&&(n=!0===i?new CustomEvent(e,{detail:t}):new CustomEvent(i.name,{detail:i.detail}),this.dispatchEvent(n))},getLast:(e,t=0)=>e[e.length-1-t]};#f(e,...t){Object.values(this.#h).forEach(n=>{n[e]&&n[e](...t)})}#g=e=>{if(this.#c.size>=2)return;e.isPrimary&&this.#c.clear();const t={records:[{x:e.clientX,y:e.clientY,timestamp:Date.now()}],target:e.target};this.#c.set(e.pointerId,t),this.#f("onPointerDown",e,t,this.#c)};#x=e=>{const t=this.#c.get(e.pointerId);t&&(t.records.push({x:e.clientX,y:e.clientY,timestamp:Date.now()}),this.#f("onPointerMove",e,t,this.#c))};#b=e=>{const t=this.#c.get(e.pointerId);t&&(this.#c.delete(e.pointerId),this.#f("onPointerUp",e,t,this.#c))};#k=e=>this.#f("onWheel",e);stop=e=>{const t=e=>{if(!(e.name in this.#h))return;const t=this.#h[e.name];t.onStop&&t.onStop(),this.#p[e.name]=t,delete this.#h[e.name]};return e?tn(e).forEach(e=>{t(e)}):(()=>{this.#l.removeEventListener("pointerdown",this.#g),this.#d.removeEventListener("pointermove",this.#x),this.#d.removeEventListener("pointerup",this.#b),this.#l.removeEventListener("wheel",this.#k),this.#f("onStop")})(),this};start=e=>{const t=e=>{if(!(e.name in this.#p))return;const t=this.#p[e.name];t.onStart&&t.onStart(),this.#h[e.name]=t,delete this.#p[e.name]};return e?tn(e).forEach(e=>{t(e)}):(()=>{this.#l.addEventListener("pointerdown",this.#g),this.#d.addEventListener("pointermove",this.#x),this.#d.addEventListener("pointerup",this.#b),this.#l.addEventListener("wheel",this.#k),this.#f("onStart")})(),this};dispose=()=>{this.stop(),this.#u=null,this.#f("dispose")}}const tn=e=>Array.isArray(e)?e:[e];class nn extends bt{_overlaysLayer=document.createElement("div");overlays={};selectedId=null;eventListeners={};DM;IH;parse;get overlaysLayer(){if(!this._overlaysLayer)throw wt;return this._overlaysLayer}hooks={onInteractionStart:kt.makeHook(),onInteractionEnd:kt.makeHook()};constructor(...e){super(...e),this.parse=this.options.markdownParser||(e=>e),this.DM=this.container.get(yt),this.IH=this.container.get(sn,{lazy:!0});this.container.get(Tt).hooks.onRefresh.subscribe(this.updateOverlays),this._overlaysLayer=document.createElement("div"),this._overlaysLayer.className="overlays",this.DM.data.container.appendChild(this.overlaysLayer),this.onStart(this.start),this.onDispose(this.dispose)}start=()=>{this.IH().onClick.subscribe(this.select);const e=async e=>{switch(e.type){case"text":this.updateOverlay(e,e.text,"text");break;case"file":e.file.match(/\.md$/i)?this.loadMarkdownForNode(e):e.file.match(/\.(png|jpg|jpeg|gif|svg|webp)$/i)?this.updateOverlay(e,e.file,"image"):e.file.match(/\.(mp3|wav)$/i)&&this.updateOverlay(e,e.file,"audio");break;case"link":this.updateOverlay(e,e.url,"link")}};Object.values(this.DM.data.canvasMap).forEach(t=>{"node"===t.type&&e(t.ref)})};select=e=>{const t=this.selectedId?this.overlays[this.selectedId]:null,n=e?this.overlays[e]:null;t&&t.classList.remove("active"),n?(n.classList.add("active"),this.hooks.onInteractionStart()):this.hooks.onInteractionEnd(),this.selectedId=e};loadMarkdownForNode=async e=>{let t;this.updateOverlay(e,"Loading...","text");try{const n=await fetch(e.file),i=await n.text(),s=i.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);t=s?await this.parse(s[2]):await this.parse(i)}catch(n){console.error("[JSONCanvasViewer] Failed to load markdown:",n),t="Failed to load content."}this.updateOverlay(e,t,"text")};updateOverlays=()=>{const e=this.DM.data;this.overlaysLayer.style.transform=`translate(${e.offsetX}px, ${e.offsetY}px) scale(${e.scale})`};async updateOverlay(e,t,n){let i=this.overlays[e.id];if(i){if("text"===n){i.getElementsByClassName("parsed-content-wrapper")[0].innerHTML=t}}else i=await this.constructOverlay(e,t,n),this.overlaysLayer.appendChild(i),this.overlays[e.id]=i,i.style.left=`${e.x}px`,i.style.top=`${e.y}px`,i.style.width=`${e.width}px`,i.style.height=`${e.height}px`}async constructOverlay(e,t,n){const i=kt.getColor(e.color),s=document.createElement("div");switch(s.classList.add("overlay-container"),s.id=e.id,s.style.backgroundColor=i.background,s.style.setProperty("--active-color",i.active),n){case"text":{s.classList.add("markdown-content");const e=document.createElement("div");e.innerHTML=await this.parse(t||""),e.classList.add("parsed-content-wrapper"),s.appendChild(e);break}case"link":{const e=document.createElement("iframe");e.src=t,e.sandbox="allow-scripts allow-same-origin",e.className="link-iframe",e.loading="lazy",s.appendChild(e);break}case"audio":{const e=document.createElement("audio");e.className="audio",e.src=t,e.controls=!0,s.appendChild(e);break}case"image":{const e=document.createElement("img");e.src=t,e.loading="lazy",s.appendChild(e)}}switch(n){case"link":case"audio":{const e=document.createElement("div");e.className="click-layer",s.appendChild(e)}}const r=document.createElement("div");r.className="overlay-border",r.style.borderColor=i.border,s.appendChild(r);const o=()=>{e.id===this.selectedId&&this.hooks.onInteractionStart()},a=()=>{e.id===this.selectedId&&this.hooks.onInteractionEnd()};return s.addEventListener("pointerenter",o),s.addEventListener("pointerleave",a),s.addEventListener("touchstart",o),s.addEventListener("touchend",a),this.eventListeners[e.id]=[o,a],s}dispose=()=>{for(;this.overlaysLayer.firstElementChild;){const e=this.overlaysLayer.firstElementChild;if(this.eventListeners[e.id]){const t=this.eventListeners[e.id][0],n=this.eventListeners[e.id][1];if(!t||!n)throw wt;e.removeEventListener("pointerenter",t),e.removeEventListener("pointerleave",n),e.removeEventListener("touchstart",t),e.removeEventListener("touchend",n),this.eventListeners[e.id][0]=null,this.eventListeners[e.id][1]=null}e.remove()}this.overlaysLayer.remove(),this._overlaysLayer=null}}class sn extends bt{pointeract;DM;onClick=kt.makeHook();stopInteraction;startInteraction;constructor(...e){super(...e),this.DM=this.container.get(yt);const t=Object.assign(this.options.pointeract||{},{coordinateOutput:"relative"});this.pointeract=new en(this.DM.data.container,[Gt,Zt,Jt,Kt,Qt],t),this.startInteraction=this.pointeract.start,this.stopInteraction=this.pointeract.stop;const n=this.container.get(nn);n.hooks.onInteractionStart.subscribe(this.stopInteraction),n.hooks.onInteractionEnd.subscribe(this.startInteraction),this.onStart(this.start),this.onDispose(this.dispose)}start=()=>{this.pointeract.on("pan",this.onPan),this.pointeract.on("drag",this.onPan),this.pointeract.on("zoom",this.onZoom),this.pointeract.on("trueClick",this.onTrueClick),this.pointeract.start()};onPan=e=>{this.DM.pan(e.detail)};onZoom=e=>{const t=e.detail;this.DM.zoom(t.factor,{x:t.x,y:t.y})};onTrueClick=e=>{const t=e.detail;if((n=e.detail.target)&&(n.closest(".controls")||n.closest("button")||n.closest("input")))return;var n;const i=this.DM.findNodeAt({x:t.x,y:t.y});this.onClick(i?i.id:null)};dispose=()=>{this.pointeract.off("pan",this.onPan),this.pointeract.off("zoom",this.onZoom),this.pointeract.off("trueClick",this.onTrueClick),this.pointeract.dispose()}}const rn="#fff";class on extends bt{_canvas;ctx;DM;zoomInOptimize={lastDrawnScale:0,lastDrawnViewport:{left:0,right:0,top:0,bottom:0},timeout:null,lastCallTime:0};get canvas(){if(null===this._canvas)throw wt;return this._canvas}constructor(...e){super(...e);const t=this.container.get(Tt);t.hooks.onRefresh.subscribe(this.redraw),t.hooks.onResize.subscribe(this.optimizeDPR),this.DM=this.container.get(yt),this._canvas=document.createElement("canvas"),this._canvas.className="main-canvas",this.ctx=this._canvas.getContext("2d"),this.DM.data.container.appendChild(this._canvas),this.onDispose(this.dispose)}optimizeDPR=()=>{const e=this.DM.data.container;kt.resizeCanvasForDPR(this.canvas,e.offsetWidth,e.offsetHeight)};redraw=()=>{this.zoomInOptimize.timeout&&(clearTimeout(this.zoomInOptimize.timeout),this.zoomInOptimize.timeout=null);const e=Date.now(),t=this.DM.data.offsetX,n=this.DM.data.offsetY,i=this.DM.data.scale,s=this.getCurrentViewport(t,n,i);if(this.isViewportInside(s,this.zoomInOptimize.lastDrawnViewport)&&i!==this.zoomInOptimize.lastDrawnScale){if(e-this.zoomInOptimize.lastCallTime<500)return this.zoomInOptimize.timeout=setTimeout(()=>{this.trueRedraw(t,n,i,s),this.zoomInOptimize.lastCallTime=e,this.zoomInOptimize.timeout=null},60),void this.fakeRedraw(s,i)}this.zoomInOptimize.lastCallTime=e,this.trueRedraw(t,n,i,s)};trueRedraw(e,t,n,i){this.zoomInOptimize.lastDrawnViewport=i,this.zoomInOptimize.lastDrawnScale=n,this.canvas.style.transform="",this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.save(),this.ctx.translate(e,t),this.ctx.scale(n,n),Object.values(this.DM.data.canvasMap).forEach(e=>{if("edge"===e.type)this.drawEdge(e);else{const t=e.ref;"file"===t.type?this.drawFile(e):"group"===t.type&&this.drawGroup(t,n)}}),this.ctx.restore()}fakeRedraw(e,t){const n=t/this.zoomInOptimize.lastDrawnScale,i=(this.zoomInOptimize.lastDrawnViewport.left-e.left)*t,s=(this.zoomInOptimize.lastDrawnViewport.top-e.top)*t;this.canvas.style.transform=`translate(${i}px, ${s}px) scale(${n})`}isViewportInside=(e,t)=>e.left>t.left&&e.top>t.top&&e.right<t.right&&e.bottom<t.bottom;getCurrentViewport=(e,t,n)=>{const i=-e/n,s=-t/n,r=this.DM.data.container;return{left:i,top:s,right:i+r.clientWidth/n,bottom:s+r.clientHeight/n}};drawLabelBar=(e,t,n,i,s)=>{const r=30*s,o=6*s,a=8*s,l=16*s,c=6*s;this.ctx.save(),this.ctx.translate(e,t),this.ctx.scale(1/s,1/s),this.ctx.font=`${l}px 'Inter', sans-serif`;const h=this.ctx.measureText(n).width+2*c;this.ctx.translate(0,-r-a),this.ctx.fillStyle=i,this.ctx.beginPath(),this.ctx.moveTo(o,0),this.ctx.lineTo(h-o,0),this.ctx.quadraticCurveTo(h,0,h,o),this.ctx.lineTo(h,r-o),this.ctx.quadraticCurveTo(h,r,h-o,r),this.ctx.lineTo(o,r),this.ctx.quadraticCurveTo(0,r,0,r-o),this.ctx.lineTo(0,o),this.ctx.quadraticCurveTo(0,0,o,0),this.ctx.closePath(),this.ctx.fill(),this.ctx.fillStyle=rn,this.ctx.fillText(n,c,.65*r),this.ctx.restore()};drawNodeBackground=e=>{const t=kt.getColor(e.color);this.ctx.globalAlpha=1,this.ctx.fillStyle=t.background,kt.drawRoundRect(this.ctx,e.x+1,e.y+1,e.width-2,e.height-2,12),this.ctx.fill(),this.ctx.strokeStyle=t.border,this.ctx.lineWidth=2,kt.drawRoundRect(this.ctx,e.x,e.y,e.width,e.height,12),this.ctx.stroke()};drawGroup=(e,t)=>{this.drawNodeBackground(e),e.label&&this.drawLabelBar(e.x,e.y,e.label,kt.getColor(e.color).active,t)};drawFile=e=>{this.ctx.fillStyle=rn;const t=e.ref;this.ctx.font="16px sans-serif",this.ctx.fillText(e.fileName||"",t.x+5,t.y-10)};drawEdge=e=>{const t=e.ref,n=this.DM.data.canvasMap[t.fromNode].ref,i=this.DM.data.canvasMap[t.toNode].ref,s=kt.getAnchorCoord,[r,o]=s(n,t.fromSide),[a,l]=s(i,t.toSide),{active:c}=kt.getColor(t.color);let[h,p,u,d]=[0,0,0,0];if(e.controlPoints?[h,p,u,d]=e.controlPoints:([h,p,u,d]=this.getControlPoints(r,o,a,l,t.fromSide,t.toSide),e.controlPoints=[h,p,u,d]),this.drawCurvedPath(r,o,a,l,h,p,u,d,c),this.drawArrowhead(a,l,u,d,c),t.label){const e=.5,n=(1-e)**3*r+3*(1-e)**2*e*h+3*(1-e)*e*e*u+e**3*a,i=(1-e)**3*o+3*(1-e)**2*e*p+3*(1-e)*e*e*d+e**3*l;this.ctx.font="18px sans-serif";const s=8,c=this.ctx.measureText(t.label).width+2*s,m=20;this.ctx.fillStyle="#222",this.ctx.beginPath(),kt.drawRoundRect(this.ctx,n-c/2,i-m/2-2,c,m,4),this.ctx.fill(),this.ctx.fillStyle="#ccc",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(t.label,n,i-2),this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic"}};getControlPoints=(e,t,n,i,s,r)=>{const o=n-e,a=i-t,l=Math.min(Math.abs(o),Math.abs(a))+.3*Math.max(Math.abs(o),Math.abs(a)),c=(h=.5*l,p=60,u=300,Math.max(p,Math.min(u,h)));var h,p,u;let d=e,m=t,f=n,g=i;switch(s){case"top":m=t-c;break;case"bottom":m=t+c;break;case"left":d=e-c;break;case"right":d=e+c}switch(r){case"top":g=i-c;break;case"bottom":g=i+c;break;case"left":f=n-c;break;case"right":f=n+c}return[d,m,f,g]};drawCurvedPath=(e,t,n,i,s,r,o,a,l)=>{this.ctx.beginPath(),this.ctx.moveTo(e,t),this.ctx.bezierCurveTo(s,r,o,a,n,i),this.ctx.strokeStyle=l,this.ctx.lineWidth=2,this.ctx.stroke()};drawArrowhead=(e,t,n,i,s)=>{const r=e-n,o=t-i,a=Math.sqrt(r*r+o*o);if(0===a)return;const l=r/a,c=o/a,h=e-12*l-7*c,p=t-12*c+7*l,u=e-12*l+7*c,d=t-12*c-7*l;this.ctx.beginPath(),this.ctx.fillStyle=s,this.ctx.moveTo(e,t),this.ctx.lineTo(h,p),this.ctx.lineTo(u,d),this.ctx.closePath(),this.ctx.fill()};dispose=()=>{this.zoomInOptimize.timeout&&(clearTimeout(this.zoomInOptimize.timeout),this.zoomInOptimize.timeout=null),this.canvas.remove(),this._canvas=null}}exports.Controls=class extends bt{_controlsPanel=null;_toggleCollapseBtn=null;_toggleFullscreenBtn=null;_zoomOutBtn=null;_zoomSlider=null;_zoomInBtn=null;_resetViewBtn=null;DM;collapsed;get controlsPanel(){if(null===this._controlsPanel)throw wt;return this._controlsPanel}get toggleCollapseBtn(){if(null===this._toggleCollapseBtn)throw wt;return this._toggleCollapseBtn}get toggleFullscreenBtn(){if(null===this._toggleFullscreenBtn)throw wt;return this._toggleFullscreenBtn}get zoomOutBtn(){if(null===this._zoomOutBtn)throw wt;return this._zoomOutBtn}get zoomSlider(){if(null===this._zoomSlider)throw wt;return this._zoomSlider}get zoomInBtn(){if(null===this._zoomInBtn)throw wt;return this._zoomInBtn}get resetViewBtn(){if(null===this._resetViewBtn)throw wt;return this._resetViewBtn}constructor(...e){super(...e),this.collapsed=this.options.controlsCollapsed||!1,this.DM=this.container.get(yt),this.DM.onToggleFullscreen.subscribe(this.updateFullscreenBtn),this.container.get(Tt).hooks.onRefresh.subscribe(this.updateSlider),this._controlsPanel=document.createElement("div"),this._controlsPanel.className="controls",this._controlsPanel.classList.toggle("collapsed",this.collapsed),kt.applyStyles(this._controlsPanel,".collapse-button{border-radius:8px;transition:transform .2s}.collapse-button:hover{background:#444c}button{cursor:pointer;font-size:18px;height:32px;border:none;transition:var(--containerTransition);text-align:center;background-color:#444;width:32px;padding:5px 0}button svg{width:100%;height:100%}.controls{position:absolute;top:10px;right:10px;display:flex;align-items:center;transition:transform .2s;border-radius:8px;gap:10px}.controls.collapsed{transform:translate(calc(100% - 32px))}.controls.collapsed .collapse-button{transform:rotate(180deg)}.controls .controls-content{display:flex;gap:1px;align-items:center;border-radius:8px;overflow:hidden;background:#333c}.controls button:hover{background:#555}.zoom-slider{width:100px;margin:0 10px}"),this._toggleCollapseBtn=document.createElement("button"),this._toggleCollapseBtn.className="collapse-button",this._toggleCollapseBtn.innerHTML='<svg viewBox="-3.6 -3.6 31.2 31.2" stroke-width=".4"><path d="M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z" /></svg>',this._controlsPanel.appendChild(this._toggleCollapseBtn);const t=document.createElement("div");t.className="controls-content",this._toggleFullscreenBtn=document.createElement("button"),this._toggleFullscreenBtn.innerHTML=Ct,t.appendChild(this._toggleFullscreenBtn),this._zoomOutBtn=document.createElement("button"),this._zoomOutBtn.innerHTML='<svg viewBox="-1.2 -1.2 26.4 26.4"><path d="M6 12h12" stroke-width="2" stroke-linecap="round" /></svg>',t.appendChild(this._zoomOutBtn),this._zoomSlider=document.createElement("input"),this._zoomSlider.type="range",this._zoomSlider.className="zoom-slider",this._zoomSlider.min="-30",this._zoomSlider.max="30",this._zoomSlider.value="0",t.appendChild(this._zoomSlider),this._zoomInBtn=document.createElement("button"),this._zoomInBtn.innerHTML='<svg viewBox="-1.2 -1.2 26.4 26.4"><path d="M6 12h12m-6-6v12" stroke-width="2" stroke-linecap="round" /></svg>',t.appendChild(this._zoomInBtn),this._resetViewBtn=document.createElement("button"),this._resetViewBtn.innerHTML='<svg viewBox="-6 -6 30 30" stroke-width=".08"><path d="m14.955 7.986.116.01a1 1 0 0 1 .85 1.13 8 8 0 0 1-13.374 4.728l-.84.84c-.63.63-1.707.184-1.707-.707V10h3.987c.89 0 1.337 1.077.707 1.707l-.731.731a6 6 0 0 0 8.347-.264 6 6 0 0 0 1.63-3.33 1 1 0 0 1 1.131-.848zM11.514.813a8 8 0 0 1 1.942 1.336l.837-.837c.63-.63 1.707-.184 1.707.707V6h-3.981c-.89 0-1.337-1.077-.707-1.707l.728-.729a6 6 0 0 0-9.98 3.591 1 1 0 1 1-1.98-.281A8 8 0 0 1 11.514.813Z" /></svg>',t.appendChild(this._resetViewBtn),this._controlsPanel.appendChild(t),this.DM.data.container.appendChild(this._controlsPanel),this._toggleCollapseBtn.addEventListener("click",this.toggleCollapse),this._zoomInBtn.addEventListener("click",this.zoomIn),this._zoomOutBtn.addEventListener("click",this.zoomOut),this._zoomSlider.addEventListener("input",this.slide),this._resetViewBtn.addEventListener("click",this.DM.resetView),this._toggleFullscreenBtn.addEventListener("click",this.toggleFullscreen),this.onDispose(this.dispose)}toggleCollapse=()=>{this.collapsed=!this.collapsed,this.controlsPanel.classList.toggle("collapsed",this.collapsed),this.collapsed||this.updateSlider()};zoomIn=()=>this.DM.zoom(1.1,this.DM.middleViewer());zoomOut=()=>this.DM.zoom(1/1.1,this.DM.middleViewer());slide=()=>this.DM.zoomToScale(1.1**Number(this.zoomSlider.value),this.DM.middleViewer());updateFullscreenBtn=e=>{this.toggleFullscreenBtn.innerHTML=e?'<svg viewBox="-40.32 -40.32 176.64 176.64"><path d="M30 60H6a6 6 0 0 0 0 12h18v18a6 6 0 0 0 12 0V66a5.997 5.997 0 0 0-6-6Zm60 0H66a5.997 5.997 0 0 0-6 6v24a6 6 0 0 0 12 0V72h18a6 6 0 0 0 0-12ZM66 36h24a6 6 0 0 0 0-12H72V6a6 6 0 0 0-12 0v24a5.997 5.997 0 0 0 6 6ZM30 0a5.997 5.997 0 0 0-6 6v18H6a6 6 0 0 0 0 12h24a5.997 5.997 0 0 0 6-6V6a5.997 5.997 0 0 0-6-6Z"/></svg>':Ct};toggleFullscreen=()=>this.DM.shiftFullscreen("toggle");updateSlider=()=>{this.collapsed||(this.zoomSlider.value=String(this.scaleToSlider(this.DM.data.scale)))};scaleToSlider=e=>Math.log(e)/Math.log(1.1);dispose=()=>{this.toggleCollapseBtn.removeEventListener("click",this.toggleCollapse),this.zoomInBtn.removeEventListener("click",this.zoomIn),this.zoomOutBtn.removeEventListener("click",this.zoomOut),this.zoomSlider.removeEventListener("input",this.slide),this.resetViewBtn.removeEventListener("click",this.DM.resetView),this.toggleFullscreenBtn.removeEventListener("click",this.toggleFullscreen),this.controlsPanel.remove(),this._controlsPanel=null,this._toggleCollapseBtn=null,this._zoomInBtn=null,this._zoomOutBtn=null,this._zoomSlider=null,this._resetViewBtn=null,this._toggleFullscreenBtn=null}},exports.DebugPanel=class extends bt{_debugPanel=null;DM;get debugPanel(){if(!this._debugPanel)throw wt;return this._debugPanel}constructor(...e){super(...e),this.DM=this.container.get(yt),this.container.get(Tt).hooks.onRefresh.subscribe(this.update),this._debugPanel=document.createElement("div"),this._debugPanel.className="debug-panel";const t=this.DM.data.container;kt.applyStyles(t,".debug-panel{position:absolute;bottom:12px;left:12px;background:#0006;border-radius:12px;padding:12px;-webkit-backdrop-filter:blur(8px) saturate(1.5);backdrop-filter:blur(8px) saturate(1.5);border:2px solid rgba(140,140,140,.75);color:#fff;font-size:calc(14px + .3vw);line-height:calc(17px + .3vw);pointer-events:none}"),t.appendChild(this._debugPanel),this.onDispose(this.dispose)}update=()=>{const e=kt.round,t=this.DM.data;this.debugPanel.innerHTML=`<p>Scale: ${e(t.scale,3)}</p><p>Offset: ${e(t.offsetX,1)}, ${e(t.offsetY,1)}</p>`};dispose=()=>{this.debugPanel.remove(),this._debugPanel=null}},exports.JSONCanvasViewer=class{options;allModules;IO=null;onStart=kt.makeHook();onDispose=kt.makeHook(!0);container;constructor(e,t){this.container=new qt,this.options=e;this.allModules=[yt,Tt,nn,sn,on,...t||[]],this.allModules.forEach(e=>{this.container.bind({provide:e,useFactory:()=>new e(this.container,this.options,this.onStart,this.onDispose)})}),this.options.lazyLoading?(this.IO=new IntersectionObserver(this.onVisibilityCheck,{root:null,rootMargin:"50px",threshold:0}),this.IO.observe(this.options.container)):this.load()}load=()=>{this.allModules.forEach(e=>{this.container.get(e)}),this.onStart()};onVisibilityCheck=e=>{e.forEach(e=>{if(e.isIntersecting)return this.load(),this.IO?.disconnect(),void(this.IO=null)})};dispose=()=>{this.IO?.disconnect(),this.IO=null;const e=this.options.container;for(;e.firstChild;)e.firstChild.remove();this.onDispose(),this.container.unbindAll()}},exports.Minimap=class extends bt{_minimapCtx=null;_viewportRectangle=null;_minimap=null;_minimapContainer=null;_toggleMinimapBtn=null;minimapCache={scale:1,centerX:0,centerY:0};DM;collapsed;get minimap(){if(null===this._minimap)throw wt;return this._minimap}get minimapCtx(){if(null===this._minimapCtx)throw wt;return this._minimapCtx}get viewportRectangle(){if(null===this._viewportRectangle)throw wt;return this._viewportRectangle}get minimapContainer(){if(null===this._minimapContainer)throw wt;return this._minimapContainer}get toggleMinimapBtn(){if(null===this._toggleMinimapBtn)throw wt;return this._toggleMinimapBtn}constructor(...e){super(...e),this.collapsed=this.options.minimapCollapsed||!1,this.container.get(Tt).hooks.onRefresh.subscribe(this.updateViewportRectangle),this.DM=this.container.get(yt),this._minimapContainer=document.createElement("div"),this._minimapContainer.className="minimap-container",kt.applyStyles(this._minimapContainer,".collapse-button{border-radius:8px;transition:transform .2s}.collapse-button:hover{background:#444c}button{cursor:pointer;font-size:18px;height:32px;border:none;transition:var(--containerTransition);text-align:center;background-color:#444;width:32px;padding:5px 0}button svg{width:100%;height:100%}.minimap-container{position:absolute;bottom:10px;right:10px;display:flex;pointer-events:none;transition:transform .2s}.minimap-container.collapsed{transform:translate(calc(100% - 32px))}.toggle-minimap{margin:auto 10px 0 0;pointer-events:auto}.collapsed .toggle-minimap{transform:rotate(180deg)}.minimap{position:relative;width:200px;height:150px;overflow:hidden;border-radius:12px;background:#202020;-webkit-backdrop-filter:blur(8px) saturate(1.5);backdrop-filter:blur(8px) saturate(1.5);border:2px solid rgba(140,140,140,.75);transform-origin:0 0}.minimap .minimap-canvas{width:100%;height:100%}.minimap .viewport-rectangle{position:absolute;top:0;left:0;pointer-events:none;border:2px solid #fff;border-radius:6px;box-sizing:border-box;background:transparent}@container (max-width: 768px){.container .minimap{transform:scale(.6)}.container .toggle-minimap{transform:translateY(-60px)}.collapsed .container .toggle-minimap{transform:translateY(-60px) rotate(180deg)}.container .minimap-container{transform:translateY(60px) translate(80px)}.container .minimap-container.collapsed{transform:translateY(60px) translate(calc(100% - 32px))}}"),this._toggleMinimapBtn=document.createElement("button"),this._toggleMinimapBtn.className="toggle-minimap collapse-button",this._toggleMinimapBtn.innerHTML='<svg viewBox="-3.6 -3.6 31.2 31.2" stroke-width=".4"><path d="M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z" /></svg>',this._minimapContainer.appendChild(this._toggleMinimapBtn),this._minimap=document.createElement("div"),this._minimap.className="minimap";const t=document.createElement("canvas");t.className="minimap-canvas",t.width=200,t.height=150,this._minimap.appendChild(t),this._minimapCtx=t.getContext("2d"),this._viewportRectangle=document.createElement("div"),this._viewportRectangle.className="viewport-rectangle",this._minimap.appendChild(this._viewportRectangle),this._minimapContainer.appendChild(this._minimap),this.DM.data.container.appendChild(this._minimapContainer),this._minimapContainer.classList.toggle("collapsed",this.collapsed),this._toggleMinimapBtn.addEventListener("click",this.toggleCollapse),kt.resizeCanvasForDPR(t,t.width,t.height),this.onStart(this.start),this.onDispose(this.dispose)}toggleCollapse=()=>{this.collapsed=!this.collapsed,this.minimapContainer.classList.toggle("collapsed",this.collapsed),this.collapsed||this.updateViewportRectangle()};start=()=>{const e=this.DM.data.nodeBounds;if(!e)return;const t=this.minimap.clientWidth,n=this.minimap.clientHeight,i=t/e.width,s=n/e.height;this.minimapCache.scale=.9*Math.min(i,s),this.minimapCache.centerX=t/2,this.minimapCache.centerY=n/2,this.minimapCtx.clearRect(0,0,t,n),this.minimapCtx.save(),this.minimapCtx.translate(this.minimapCache.centerX,this.minimapCache.centerY),this.minimapCtx.scale(this.minimapCache.scale,this.minimapCache.scale),this.minimapCtx.translate(-e.centerX,-e.centerY);const r=this.DM.data.canvasData;for(const o of r.edges)this.drawMinimapEdge(o);for(const o of r.nodes)this.drawMinimapNode(o);this.minimapCtx.restore()};drawMinimapNode=e=>{const t=kt.getColor(e.color);this.minimapCtx.fillStyle=t.border,this.minimapCtx.globalAlpha=.3,kt.drawRoundRect(this.minimapCtx,e.x,e.y,e.width,e.height,25),this.minimapCtx.fill(),this.minimapCtx.globalAlpha=1};drawMinimapEdge=e=>{const t=this.DM.data.canvasMap,n=t[e.fromNode].ref,i=t[e.toNode].ref;if(!n||!i)return;const[s,r]=kt.getAnchorCoord(n,e.fromSide),[o,a]=kt.getAnchorCoord(i,e.toSide);this.minimapCtx.beginPath(),this.minimapCtx.moveTo(s,r),this.minimapCtx.lineTo(o,a),this.minimapCtx.strokeStyle="#555",this.minimapCtx.lineWidth=10,this.minimapCtx.stroke()};updateViewportRectangle=()=>{if(this.collapsed)return;const e=this.DM.data.nodeBounds,t=this.DM.data.container,n=this.DM.data.scale;if(!e)return;const i=t.clientWidth/n,s=t.clientHeight/n,r=-this.DM.data.offsetX/n+t.clientWidth/(2*n),o=-this.DM.data.offsetY/n+t.clientHeight/(2*n),a=this.minimapCache.centerX+(r-i/2-e.centerX)*this.minimapCache.scale,l=this.minimapCache.centerY+(o-s/2-e.centerY)*this.minimapCache.scale,c=i*this.minimapCache.scale,h=s*this.minimapCache.scale;this.viewportRectangle.style.left=`${a}px`,this.viewportRectangle.style.top=`${l}px`,this.viewportRectangle.style.width=`${c}px`,this.viewportRectangle.style.height=`${h}px`};dispose=()=>{this.toggleMinimapBtn.removeEventListener("click",this.toggleCollapse),this.minimapCtx.clearRect(0,0,this.minimap.clientWidth,this.minimap.clientHeight),this.minimapContainer.remove(),this._minimapContainer=null,this._toggleMinimapBtn=null,this._viewportRectangle=null,this._minimap=null}},exports.MistouchPreventer=class extends bt{_preventionContainer=null;preventMt=!1;DM;preventMistouch={record:!1,lastX:0,lastY:0,initialX:0,initialY:0};get preventionContainer(){if(null===this._preventionContainer)throw wt;return this._preventionContainer}constructor(...e){super(...e);const t=Object.assign({preventAtStart:!0,labelText:"Click on to unlock."},this.options.mistouchPreventer||{}),n=document.createElement("div");n.className="prevention-banner",n.textContent=t.labelText,this.DM=this.container.get(yt),this._preventionContainer=document.createElement("div"),this._preventionContainer.className="prevention-container hidden",kt.applyStyles(this._preventionContainer,".full,.prevention-container{top:0;left:0;width:100%;height:100%;position:absolute}.flex-center,.prevention-container{display:flex;justify-content:center;align-items:center}.prevention-container{overflow:visible;transition:background .2s,opacity .2s,box-shadow .2s,border .2s,filter .2s,backdrop-filter .2s}.prevention-container.hidden{pointer-events:none;opacity:0}.prevention-container .prevention-banner{background:#0006;border-radius:12px;padding:12px;margin:12px;-webkit-backdrop-filter:blur(8px) saturate(1.5);backdrop-filter:blur(8px) saturate(1.5);border:2px solid rgba(140,140,140,.75);color:#fff;font-size:calc(14px + .3vw);line-height:calc(17px + .3vw);text-align:center}"),this._preventionContainer.appendChild(n),this.DM.data.container.appendChild(this._preventionContainer),t.preventAtStart&&this.startPrevention(),window.addEventListener("pointerdown",this.onPointerDown),window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),this.onDispose(this.dispose)}onPointerDown=e=>{const t=this.DM.data.container.getBoundingClientRect();e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom?this.preventMt||this.startPrevention():this.preventMt&&(this.preventMistouch.initialX=e.clientX,this.preventMistouch.initialY=e.clientY,this.preventMistouch.lastX=e.clientX,this.preventMistouch.lastY=e.clientY,this.preventMistouch.record=!0)};onPointerMove=e=>{this.preventMistouch.record&&(this.preventMistouch.lastX=e.clientX,this.preventMistouch.lastY=e.clientY)};onPointerUp=()=>{this.preventMistouch.record&&(this.preventMistouch.record=!1,Math.abs(this.preventMistouch.lastX-this.preventMistouch.initialX)+Math.abs(this.preventMistouch.lastY-this.preventMistouch.initialY)<5&&this.endPrevention())};startPrevention=()=>{this.preventionContainer.classList.remove("hidden"),this.DM.data.container.classList.add("numb"),this.preventMt=!0};endPrevention=()=>{this.preventMt=!1,this.preventionContainer.classList.add("hidden"),setTimeout(()=>this.DM.data.container.classList.remove("numb"),50)};dispose=()=>{window.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),this.preventionContainer.remove(),this._preventionContainer=null}},exports.fetchCanvas=async function(e){return await fetch(e).then(e=>e.json())},exports.parser=async e=>ie.sanitize(await xt(e));