diff --git a/README.md b/README.md index e08a178..3fc269c 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,19 @@ repository does not keep a copy. push. A refused file (too large) is reported and does not hold back sync. A local library keeps its files on the device (de-duplicated by SHA-256) and uploads them when it turns on sync. +- **Dates and reminders** (guide 9.4, 11.8): `@明天 9点` completion, date chips + and the picker come with the editor page; the format bar has a date button. + The agenda (library menu → 日程) lists open dated to-dos across the + library, checks them off and opens a note at its task. Reminders are + system alarms (`reminders/Reminders.kt`, `Tasks` in core): set again a + moment after any change, restored after a reboot or update, exact when the + system allows it. Android 13+ asks for notification permission the first + time there is something to remind of; a tapped reminder opens its note. +- **Password-protected notes** (guide 8.4): the editor page shows the lock + panel, asks for the password and seals every edit; the app only ever stores + and syncs the sealed body. Note menu: 设置密码 / 更改密码 / 移除密码 / + 立即锁定. Protected notes are found by title only, cannot be shared, and + take no part in the agenda or reminders. - **Media library**: filters (all, images, video, audio, files, unreferenced, trash), file name search, a thumbnail grid, and details: preview, the notes that reference the file, rename, public link (make, copy, revoke), diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4661295..0967359 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,6 +6,10 @@ + + + + + + + + + + + + :first-child{margin-top:0}.prose-ivy h1,.prose-ivy h2,.prose-ivy h3{font-family:var(--font-serif);font-weight:600}.prose-ivy h1{margin-bottom:.75rem;margin-top:2.5rem;font-size:1.6em;line-height:1.375}.prose-ivy h2{margin-bottom:.5rem;margin-top:2.25rem;font-size:1.3em;line-height:1.375}.prose-ivy h3{margin-bottom:.5rem;margin-top:1.75rem;font-size:1.1em}.prose-ivy h4,.prose-ivy h5,.prose-ivy h6{margin-bottom:.375rem;margin-top:1.5rem;font-weight:600}.prose-ivy ol,.prose-ivy p,.prose-ivy ul{margin-top:1rem;margin-bottom:1rem}.prose-ivy ol,.prose-ivy ul{padding-left:1.5rem}.prose-ivy ul{list-style:disc}.prose-ivy ol{list-style:decimal}.prose-ivy li{margin-top:.375rem;margin-bottom:.375rem}.prose-ivy li::marker{color:rgb(var(--faint))}.prose-ivy li.task{list-style:none;margin-left:-1.5rem;display:flex;gap:.6rem;align-items:flex-start}.prose-ivy li.task input{margin-top:.5em;accent-color:rgb(var(--ivy));width:1rem;height:1rem;flex:none}.prose-ivy li.task.done>span{color:rgb(var(--muted));text-decoration:line-through}.prose-ivy a{color:rgb(var(--ivy));text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px;transition:text-decoration-color .18s ease}.prose-ivy a:hover{text-decoration-color:rgb(var(--ivy))}.prose-ivy a.wikilink{text-decoration-style:solid}.prose-ivy a.wikilink.missing{color:rgb(var(--muted));text-decoration-style:dashed}.prose-ivy code{border-radius:.375rem;padding:.125rem .375rem;font-size:.85em}.prose-ivy code,.prose-ivy pre{font-family:SF Mono,JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,Consolas,PingFang SC,monospace;background:rgb(var(--code-bg))}.prose-ivy pre{margin-top:1.25rem;margin-bottom:1.25rem;overflow-x:auto;border-radius:1rem;padding:1rem 1.25rem;font-size:13px;line-height:1.7}.prose-ivy pre code{background-color:transparent;padding:0;font-size:13px}.prose-ivy blockquote{margin-top:1.25rem;margin-bottom:1.25rem;padding-left:1.25rem;font-family:Iowan Old Style,Charter,"Source Serif 4",Songti SC,"Noto Serif SC","Source Han Serif SC",STSong,Georgia,serif;--tw-text-opacity:1;color:rgb(var(--ink-2)/var(--tw-text-opacity,1));box-shadow:inset 2px 0 0 rgb(var(--ivy)/.35)}.prose-ivy hr{margin-top:2.5rem;margin-bottom:2.5rem;border-width:0;text-align:center}.prose-ivy hr:after{content:"· · ·";color:rgb(var(--faint));letter-spacing:.4em}.prose-ivy img,.prose-ivy video{margin-top:1.25rem;margin-bottom:1.25rem;max-height:70vh;border-radius:1rem;max-width:100%}.prose-ivy table{margin-top:1.25rem;margin-bottom:1.25rem;display:block;width:100%;border-collapse:collapse;overflow-x:auto;font-size:14px}.prose-ivy td,.prose-ivy th{padding:.5rem .75rem;text-align:left;box-shadow:inset 0 -1px 0 rgb(var(--line))}.prose-ivy th{font-weight:500;--tw-text-opacity:1;color:rgb(var(--muted)/var(--tw-text-opacity,1))}.prose-ivy td[align=center],.prose-ivy th[align=center]{text-align:center}.prose-ivy td[align=right],.prose-ivy th[align=right]{text-align:right}.prose-ivy mark{background:rgb(var(--warn)/.22);color:inherit;border-radius:3px;padding:0 2px}.prose-ivy .file-card{margin-top:.5rem;margin-bottom:.5rem;display:inline-flex;align-items:center;gap:.5rem;border-radius:.75rem;padding:.5rem .875rem;font-size:13px;background:rgb(var(--code-bg));color:rgb(var(--ink))}.prose-ivy .file-card,.prose-ivy sup.cite a{text-decoration-line:none}.prose-ivy sup.cite a{margin-left:.125rem;border-radius:.375rem;padding:1px .375rem;font-size:11px;background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink))}.prose-sm{font-size:15px;line-height:1.8}.prose-sm p{margin-top:.625rem;margin-bottom:.625rem}.prose-ivy .mermaid-diagram{display:flex;justify-content:center;margin:1.2em 0;padding:16px;border-radius:16px;background:rgb(var(--code-bg)/.5);overflow-x:auto}.prose-ivy .mermaid-diagram svg{max-width:100%;height:auto}.prose-ivy .mermaid-diagram.mermaid-error{justify-content:flex-start;font-family:var(--font-mono);font-size:.8em;color:rgb(var(--danger))}.drag-ghost{position:fixed;top:-200px;left:0;padding:6px 14px;border-radius:999px;background:rgb(var(--ivy));color:rgb(var(--on-ivy));font-size:13px;font-weight:500;white-space:nowrap}.split-preview{font-size:var(--preview-size)}@media (max-width:767px){.split-preview{font-size:var(--editor-size);line-height:1.9}.split-preview h1{font-size:1.4em}.split-preview h2{font-size:1.2em}.split-preview pre{padding:10px 12px}.split-preview td,.split-preview th{white-space:nowrap}.split-preview ol,.split-preview ul{padding-left:1.1em}}.ivy-editor.mode-source .cm-scroller{font-family:var(--font-mono);line-height:1.9}.ivy-editor .cm-h{font-family:var(--font-serif);font-weight:600;line-height:1.4}.ivy-editor .cm-h1{font-size:1.6em;padding-top:.7em!important;padding-bottom:.15em!important}.ivy-editor .cm-h2{font-size:1.3em;padding-top:.7em!important;padding-bottom:.1em!important}.ivy-editor .cm-h3{font-size:1.1em;padding-top:.5em!important}.ivy-editor .cm-h4,.ivy-editor .cm-h5,.ivy-editor .cm-h6{font-size:1em;padding-top:.3em!important}.ivy-editor .cm-src-h,.ivy-editor .cm-strong{font-weight:600}.ivy-editor .cm-em{font-style:italic}.ivy-editor .cm-strike,.ivy-editor .cm-task-done{text-decoration:line-through;color:rgb(var(--muted))}.ivy-editor .cm-inline-code{font-family:var(--font-mono);font-size:.85em;background:rgb(var(--code-bg));border-radius:6px;padding:2px 6px}.ivy-editor .cm-link{color:rgb(var(--ivy));text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px}.ivy-editor .cm-wikilink{color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-wikilink-rendered{text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px}.ivy-editor .cm-wikilink-missing{color:rgb(var(--muted));-webkit-text-decoration:underline dashed;text-decoration:underline dashed;text-underline-offset:3px}.ivy-editor .cm-quote{box-shadow:inset 2px 0 0 rgb(var(--ivy)/.35);padding-left:18px!important;font-family:var(--font-serif);color:rgb(var(--ink-2))}.ivy-editor .cm-list-mark{color:rgb(var(--faint))}.ivy-editor .cm-codeblock{font-family:var(--font-mono);font-size:.82em;background:rgb(var(--code-bg));padding:0 20px!important}.ivy-editor .cm-codeblock-src{padding:0!important;font-size:1em;background:rgb(var(--code-bg)/.6)}.ivy-editor .cm-codeblock-first{border-radius:16px 16px 0 0;padding-top:12px!important;color:rgb(var(--faint))}.ivy-editor .cm-codeblock-last{border-radius:0 0 16px 16px;padding-bottom:12px!important;color:rgb(var(--faint))}.ivy-editor .cm-media{display:inline-block;max-width:100%;vertical-align:top;margin:10px 0}.ivy-editor .cm-media img,.ivy-editor .cm-media video{display:block;max-width:100%;max-height:60vh;border-radius:16px}.ivy-editor .cm-media audio{display:block;width:min(100%,420px)}.ivy-editor .cm-media-broken{width:180px;height:120px;border-radius:16px;background:rgb(var(--sunken))}.ivy-editor .cm-media-broken img{display:none}.ivy-editor .cm-file-card{display:inline-flex;align-items:center;gap:6px;background:rgb(var(--code-bg));border-radius:12px;padding:7px 14px;font-size:13px;color:rgb(var(--ink));text-decoration:none}.ivy-editor .cm-task{width:1.05em;height:1.05em;margin:0 .3em 0 0;vertical-align:-.15em;accent-color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-bullet{display:inline-block;width:.7em;color:rgb(var(--faint));font-weight:700}.ivy-editor .cm-table{white-space:normal;overflow-x:auto;margin:4px 0;border-radius:12px;cursor:text;transition:background-color .2s}.ivy-editor .cm-table:hover{background:rgb(var(--code-bg)/.5)}.ivy-editor .cm-table table{margin:0;font-size:.92em;line-height:1.6}.ivy-editor .cm-table td:empty,.ivy-editor .cm-table th:empty{min-width:2em}.ivy-editor .cm-mermaid{display:flex;justify-content:center;min-height:48px;margin:6px 0;padding:16px;border-radius:16px;background:rgb(var(--code-bg)/.5);cursor:pointer;overflow-x:auto;transition:background-color .2s}.ivy-editor .cm-mermaid:hover{background:rgb(var(--code-bg))}.ivy-editor .cm-mermaid svg{max-width:100%;height:auto}.ivy-editor .cm-mermaid-loading{min-height:120px}.ivy-editor .cm-mermaid.mermaid-error{justify-content:flex-start;font-family:var(--font-mono);font-size:.8em;color:rgb(var(--danger))}.ivy-editor .cm-hr-widget{display:inline-block;width:100%;height:1px;vertical-align:middle;background:rgb(var(--line))}:root{--editor-size:16px;--gutter:20px}body,html{margin:0;background:rgb(var(--surface));-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;font-family:system-ui,Roboto,Noto Sans CJK SC,Noto Sans SC,sans-serif}body{min-height:100vh;padding-bottom:40vh;box-sizing:border-box}#editor{padding:4px var(--gutter) 0}.ivy-editor .cm-editor{font-size:var(--editor-size)}.ivy-editor .cm-scroller{overflow:visible!important}@media (min-width:700px){:root{--gutter:44px}#editor{max-width:760px;margin:0 auto}}.ivy-editor .cm-table td,.ivy-editor .cm-table th{min-width:5em} \ No newline at end of file +*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,SF Pro Text,Inter,Segoe UI,PingFang SC,Hiragino Sans GB,Noto Sans SC,Microsoft YaHei,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:SF Mono,JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,Consolas,PingFang SC,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.btn{display:inline-flex;height:2.25rem;align-items:center;justify-content:center;gap:.375rem;white-space:nowrap;border-radius:9999px;padding-left:1rem;padding-right:1rem;font-size:13px;font-weight:500}.btn:disabled{pointer-events:none;opacity:.4}.btn{transition:background-color .18s ease,color .18s ease,transform .3s var(--spring)}.btn:active{transform:scale(.97)}.input{height:2.5rem;width:100%;border-radius:.75rem;--tw-bg-opacity:1;background-color:rgb(var(--sunken)/var(--tw-bg-opacity,1));padding-left:.875rem;padding-right:.875rem;font-size:14px;--tw-text-opacity:1;color:rgb(var(--ink)/var(--tw-text-opacity,1));outline:2px solid transparent;outline-offset:2px}.input::-moz-placeholder{--tw-text-opacity:1;color:rgb(var(--faint)/var(--tw-text-opacity,1))}.input::placeholder{--tw-text-opacity:1;color:rgb(var(--faint)/var(--tw-text-opacity,1))}.input{box-shadow:inset 0 0 0 1px transparent;transition:background-color .2s ease,box-shadow .2s ease}.input:focus{--tw-bg-opacity:1;background-color:rgb(var(--surface)/var(--tw-bg-opacity,1));box-shadow:inset 0 0 0 1px rgb(var(--ivy)/.4),0 0 0 4px rgb(var(--ivy)/.08)}select.input{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding-right:2.25rem;background-image:var(--select-chevron);background-position:right .75rem center;background-repeat:no-repeat;background-size:16px}.label{margin-bottom:.375rem;display:block;color:rgb(var(--muted)/var(--tw-text-opacity,1))}.chip,.label{font-size:13px;--tw-text-opacity:1}.chip{display:inline-flex;height:2rem;flex-shrink:0;align-items:center;gap:.375rem;border-radius:9999px;padding-left:.75rem;padding-right:.75rem;color:rgb(var(--ink-2)/var(--tw-text-opacity,1))}.chip:hover{--tw-bg-opacity:1;background-color:rgb(var(--sunken)/var(--tw-bg-opacity,1))}.chip{transition:background-color .18s ease,color .18s ease}.row{display:flex;align-items:center;gap:.625rem;border-radius:.75rem;padding-left:.75rem;padding-right:.75rem;font-size:14px;--tw-text-opacity:1;color:rgb(var(--ink-2)/var(--tw-text-opacity,1))}.row:hover{--tw-text-opacity:1;color:rgb(var(--ink)/var(--tw-text-opacity,1))}.row{transition:color .16s ease}.row[data-active]{font-weight:500;--tw-text-opacity:1;color:rgb(var(--ink)/var(--tw-text-opacity,1))}.toggle{position:relative;height:22px;width:38px;flex-shrink:0;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgb(var(--hover)/var(--tw-bg-opacity,1));transition:background-color .24s ease}.toggle,.toggle:before{border-radius:9999px;--tw-bg-opacity:1}.toggle:before{content:"";position:absolute;left:2px;top:2px;height:18px;width:18px;background-color:rgb(255 255 255/var(--tw-bg-opacity,1));box-shadow:0 1px 2px rgba(0,0,0,.2);transition:transform .42s var(--spring)}.toggle:checked{--tw-bg-opacity:1;background-color:rgb(var(--ivy)/var(--tw-bg-opacity,1))}.toggle:checked:before{transform:translateX(16px)}.visible{visibility:visible}.collapse{visibility:collapse}.\!block{display:block!important}.block{display:block}.inline{display:inline}.flex{display:flex}.table{display:table}.\!grid{display:grid!important}.grid{display:grid}.hidden{display:none}.border{border-width:1px}.italic{font-style:italic}.line-through{text-decoration-line:line-through}.outline{outline-style:solid}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:root{--font-mono:"SF Mono","JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,"PingFang SC",monospace;--font-serif:"Iowan Old Style",Charter,"Source Serif 4","Songti SC","Noto Serif SC","Source Han Serif SC",STSong,Georgia,serif;--shelf-w:296px;--spring:cubic-bezier(0.22,1,0.36,1)}@supports (transition-timing-function:linear(0,1)){:root{--spring:linear(0,0.009,0.035 2.1%,0.141 4.4%,0.723 12.9%,0.938 16.7%,1.017 18.9%,1.077 21.2%,1.121 24%,1.149 27.3%,1.159 31.4%,1.14 36.4%,1.052 49.3%,1.019 55.5%,1.003 61.8%,0.995 70.1%,1)}}:root,:root[data-theme=light]{color-scheme:light;--canvas:247 248 249;--surface:255 255 255;--sunken:241 243 245;--ink:28 31 34;--ink-2:70 75 80;--muted:112 118 124;--faint:160 166 172;--line:230 233 236;--hover:234 237 240;--ivy:40 122 82;--ivy-hover:31 104 69;--ivy-soft:229 243 235;--on-ivy:255 255 255;--ivy-ink:27 92 60;--warn:190 134 48;--warn-ink:110 78 26;--warn-soft:252 244 228;--danger:176 62 54;--danger-soft:252 235 233;--ok:74 142 104;--code-bg:244 246 248;--shadow-paper:0 0 0 0.5px rgba(16,24,32,.05),0 1px 2px rgba(16,24,32,.03),0 12px 32px -12px rgba(16,24,32,.08);--shadow-float:0 0 0 0.5px rgba(16,24,32,.06),0 2px 6px rgba(16,24,32,.05),0 12px 28px -10px rgba(16,24,32,.14);--shadow-lift:0 0 0 0.5px rgba(16,24,32,.07),0 8px 16px -6px rgba(16,24,32,.08),0 32px 64px -16px rgba(16,24,32,.22);--tag-green-fg:#3f7a5b;--tag-blue-fg:#4f6a9a;--tag-amber-fg:#a0702c;--tag-pink-fg:#a65a7c;--tag-gray-fg:#6f767d;--tag-purple-fg:#7a62a8;--select-chevron:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%2370767c' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}:root[data-theme=dark]{color-scheme:dark;--canvas:16 18 20;--surface:25 27 30;--sunken:34 37 41;--ink:232 235 238;--ink-2:190 195 200;--muted:138 144 150;--faint:96 101 107;--line:44 48 52;--hover:38 41 45;--ivy:86 180 130;--ivy-hover:110 196 150;--ivy-soft:28 50 39;--on-ivy:10 28 18;--ivy-ink:150 224 182;--warn:214 170 98;--warn-ink:232 205 158;--warn-soft:48 40 26;--danger:226 128 116;--danger-soft:58 33 31;--ok:124 190 150;--code-bg:31 34 38;--shadow-paper:0 0 0 0.5px hsla(0,0%,100%,.05),0 12px 32px -12px rgba(0,0,0,.5);--shadow-float:0 0 0 0.5px hsla(0,0%,100%,.07),0 12px 28px -10px rgba(0,0,0,.6);--shadow-lift:0 0 0 0.5px hsla(0,0%,100%,.08),0 32px 64px -16px rgba(0,0,0,.7);--tag-green-fg:#92c4a6;--tag-blue-fg:#9db2dc;--tag-amber-fg:#d9b77e;--tag-pink-fg:#dba6bf;--tag-gray-fg:#a3a9af;--tag-purple-fg:#bcaae0;--select-chevron:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%238a9096' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}body,html{height:100%;background:rgb(var(--canvas));color:rgb(var(--ink));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}body{font-family:-apple-system,BlinkMacSystemFont,SF Pro Text,Inter,Segoe UI,PingFang SC,Hiragino Sans GB,Noto Sans SC,Microsoft YaHei,sans-serif;font-size:14px;line-height:1.5;overscroll-behavior:none}::-moz-selection{background:rgb(var(--ivy)/.18)}::selection{background:rgb(var(--ivy)/.18)}:focus{outline:none}:focus-visible{outline:2px solid rgb(var(--ivy)/.45);outline-offset:2px}button{-webkit-user-select:none;-moz-user-select:none;user-select:none}.glide{position:relative;isolation:isolate}.glide-pill{position:absolute;left:0;top:0;z-index:-1;width:var(--gw,0);height:var(--gh,0);transform:translate3d(var(--gx,0),var(--gy,0),0);opacity:var(--go,0);border-radius:12px;background:rgb(var(--ink)/.055);pointer-events:none}:root[data-theme=dark] .glide-pill{background:rgb(var(--ink)/.08)}.glide[data-glide-ready] .glide-pill{transition:transform .46s var(--spring),width .46s var(--spring),height .3s var(--soft,ease),opacity .2s ease}.veil:before{content:"";position:sticky;top:0;z-index:5;display:block;height:20px;margin-bottom:-20px;pointer-events:none;background:linear-gradient(to bottom,rgb(var(--veil,var(--surface))),rgb(var(--veil,var(--surface))/0))}.safe-top{padding-top:env(safe-area-inset-top)}.safe-bottom{padding-bottom:env(safe-area-inset-bottom)}@view-transition{navigation:none}::view-transition-group(root){animation-duration:.42s;animation-timing-function:cubic-bezier(.22,1,.36,1)}::view-transition-new(root),::view-transition-old(root){animation-duration:.26s;animation-timing-function:ease}::view-transition-old(dock){display:none}::view-transition-new(dock){animation:none}:root[data-nav=push]::view-transition-old(root){animation:vt-recede .42s cubic-bezier(.22,1,.36,1) both}:root[data-nav=push]::view-transition-new(root){animation:vt-enter .42s cubic-bezier(.22,1,.36,1) both;box-shadow:var(--shadow-lift)}:root[data-nav=pop]::view-transition-old(root){z-index:2;animation:vt-leave .34s cubic-bezier(.22,1,.36,1) both;box-shadow:var(--shadow-lift)}:root[data-nav=pop]::view-transition-new(root){animation:vt-return .34s cubic-bezier(.22,1,.36,1) both}@keyframes vt-enter{0%{transform:translateX(100%)}}@keyframes vt-recede{to{transform:translateX(-22%);filter:brightness(.94)}}@keyframes vt-leave{to{transform:translateX(100%)}}@keyframes vt-return{0%{transform:translateX(-22%);filter:brightness(.94)}}@media (prefers-reduced-motion:reduce){*,::view-transition-group(*),::view-transition-new(*),::view-transition-old(*),:after,:before{animation-duration:1ms!important;animation-delay:0ms!important;transition-duration:1ms!important}}.prose-ivy{font-size:16px;line-height:1.85;--tw-text-opacity:1;color:rgb(var(--ink)/var(--tw-text-opacity,1));overflow-wrap:anywhere}.prose-ivy>:first-child{margin-top:0}.prose-ivy h1,.prose-ivy h2,.prose-ivy h3{font-family:var(--font-serif);font-weight:600}.prose-ivy h1{margin-bottom:.75rem;margin-top:2.5rem;font-size:1.6em;line-height:1.375}.prose-ivy h2{margin-bottom:.5rem;margin-top:2.25rem;font-size:1.3em;line-height:1.375}.prose-ivy h3{margin-bottom:.5rem;margin-top:1.75rem;font-size:1.1em}.prose-ivy h4,.prose-ivy h5,.prose-ivy h6{margin-bottom:.375rem;margin-top:1.5rem;font-weight:600}.prose-ivy ol,.prose-ivy p,.prose-ivy ul{margin-top:1rem;margin-bottom:1rem}.prose-ivy ol,.prose-ivy ul{padding-left:1.5rem}.prose-ivy ul{list-style:disc}.prose-ivy ol{list-style:decimal}.prose-ivy li{margin-top:.375rem;margin-bottom:.375rem}.prose-ivy li::marker{color:rgb(var(--faint))}.prose-ivy li.task{list-style:none;margin-left:-1.5rem;display:flex;gap:.6rem;align-items:flex-start}.prose-ivy li.task input{margin-top:.5em;accent-color:rgb(var(--ivy));width:1rem;height:1rem;flex:none}.prose-ivy li.task.done>span{color:rgb(var(--muted));text-decoration:line-through}.prose-ivy a{color:rgb(var(--ivy));text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px;transition:text-decoration-color .18s ease}.prose-ivy a:hover{text-decoration-color:rgb(var(--ivy))}.prose-ivy a.wikilink{text-decoration-style:solid}.prose-ivy a.wikilink.missing{color:rgb(var(--muted));text-decoration-style:dashed}.prose-ivy code{border-radius:.375rem;padding:.125rem .375rem;font-size:.85em}.prose-ivy code,.prose-ivy pre{font-family:SF Mono,JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,Consolas,PingFang SC,monospace;background:rgb(var(--code-bg))}.prose-ivy pre{margin-top:1.25rem;margin-bottom:1.25rem;overflow-x:auto;border-radius:1rem;padding:1rem 1.25rem;font-size:13px;line-height:1.7}.prose-ivy pre code{background-color:transparent;padding:0;font-size:13px}.prose-ivy blockquote{margin-top:1.25rem;margin-bottom:1.25rem;padding-left:1.25rem;font-family:Iowan Old Style,Charter,"Source Serif 4",Songti SC,"Noto Serif SC","Source Han Serif SC",STSong,Georgia,serif;--tw-text-opacity:1;color:rgb(var(--ink-2)/var(--tw-text-opacity,1));box-shadow:inset 2px 0 0 rgb(var(--ivy)/.35)}.prose-ivy hr{margin-top:2.5rem;margin-bottom:2.5rem;border-width:0;text-align:center}.prose-ivy hr:after{content:"· · ·";color:rgb(var(--faint));letter-spacing:.4em}.prose-ivy img,.prose-ivy video{margin-top:1.25rem;margin-bottom:1.25rem;max-height:70vh;border-radius:1rem;max-width:100%}.prose-ivy table{margin-top:1.25rem;margin-bottom:1.25rem;display:block;width:100%;border-collapse:collapse;overflow-x:auto;font-size:14px}.prose-ivy td,.prose-ivy th{padding:.5rem .75rem;text-align:left;box-shadow:inset 0 -1px 0 rgb(var(--line))}.prose-ivy th{font-weight:500;--tw-text-opacity:1;color:rgb(var(--muted)/var(--tw-text-opacity,1))}.prose-ivy td[align=center],.prose-ivy th[align=center]{text-align:center}.prose-ivy td[align=right],.prose-ivy th[align=right]{text-align:right}.prose-ivy mark{background:rgb(var(--warn)/.22);color:inherit;border-radius:3px;padding:0 2px}.prose-ivy .file-card{margin-top:.5rem;margin-bottom:.5rem;display:inline-flex;align-items:center;gap:.5rem;border-radius:.75rem;padding:.5rem .875rem;font-size:13px;background:rgb(var(--code-bg));color:rgb(var(--ink))}.prose-ivy .file-card,.prose-ivy sup.cite a{text-decoration-line:none}.prose-ivy sup.cite a{margin-left:.125rem;border-radius:.375rem;padding:1px .375rem;font-size:11px;background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink))}.prose-sm{font-size:15px;line-height:1.8}.prose-sm p{margin-top:.625rem;margin-bottom:.625rem}.prose-ivy .mermaid-diagram{display:flex;justify-content:center;margin:1.2em 0;padding:16px;border-radius:16px;background:rgb(var(--code-bg)/.5);overflow-x:auto}.prose-ivy .mermaid-diagram svg{max-width:100%;height:auto}.prose-ivy .mermaid-diagram.mermaid-error{justify-content:flex-start;font-family:var(--font-mono);font-size:.8em;color:rgb(var(--danger))}.drag-ghost{position:fixed;top:-200px;left:0;padding:6px 14px;background:rgb(var(--ivy));color:rgb(var(--on-ivy));font-size:13px;font-weight:500}.drag-ghost,.prose-ivy .due{border-radius:999px;white-space:nowrap}.prose-ivy .due{display:inline-block;margin-left:6px;padding:0 8px;font-size:.78em;line-height:1.7;vertical-align:.08em;color:rgb(var(--ink-2));background:rgb(var(--sunken))}.prose-ivy .due-today{color:rgb(var(--ivy-ink));background:rgb(var(--ivy-soft))}.prose-ivy .due-over{color:rgb(var(--danger));background:rgb(var(--danger-soft))}.prose-ivy .due-repeat{color:rgb(var(--muted))}.prose-ivy .due-done{color:rgb(var(--faint));background:transparent}.prose-ivy dl.props{display:grid;gap:2px;padding:10px 14px;border-radius:14px;background:rgb(var(--code-bg)/.55);font-size:.88em}.prose-ivy dl.props>div{display:flex;gap:12px}.prose-ivy dl.props dt{min-width:5em;color:rgb(var(--muted))}.prose-ivy .locked-note,.prose-ivy .query-note{color:rgb(var(--muted));font-size:.92em}.split-preview{font-size:var(--preview-size)}@media (max-width:767px){.split-preview{font-size:var(--editor-size);line-height:1.9}.split-preview h1{font-size:1.4em}.split-preview h2{font-size:1.2em}.split-preview pre{padding:10px 12px}.split-preview td,.split-preview th{white-space:nowrap}.split-preview ol,.split-preview ul{padding-left:1.1em}}.ivy-editor.mode-source .cm-scroller{font-family:var(--font-mono);line-height:1.9}.ivy-editor .cm-h{font-family:var(--font-serif);font-weight:600;line-height:1.4}.ivy-editor .cm-h1{font-size:1.6em;padding-top:.7em!important;padding-bottom:.15em!important}.ivy-editor .cm-h2{font-size:1.3em;padding-top:.7em!important;padding-bottom:.1em!important}.ivy-editor .cm-h3{font-size:1.1em;padding-top:.5em!important}.ivy-editor .cm-h4,.ivy-editor .cm-h5,.ivy-editor .cm-h6{font-size:1em;padding-top:.3em!important}.ivy-editor .cm-src-h,.ivy-editor .cm-strong{font-weight:600}.ivy-editor .cm-em{font-style:italic}.ivy-editor .cm-strike,.ivy-editor .cm-task-done{text-decoration:line-through;color:rgb(var(--muted))}.ivy-editor .cm-inline-code{font-family:var(--font-mono);font-size:.85em;background:rgb(var(--code-bg));border-radius:6px;padding:2px 6px}.ivy-editor .cm-link{color:rgb(var(--ivy));text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px}.ivy-editor .cm-wikilink{color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-wikilink-rendered{text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px}.ivy-editor .cm-wikilink-missing{color:rgb(var(--muted));-webkit-text-decoration:underline dashed;text-decoration:underline dashed;text-underline-offset:3px}.ivy-editor .cm-quote{box-shadow:inset 2px 0 0 rgb(var(--ivy)/.35);padding-left:18px!important;font-family:var(--font-serif);color:rgb(var(--ink-2))}.ivy-editor .cm-list-mark{color:rgb(var(--faint))}.ivy-editor .cm-codeblock{font-family:var(--font-mono);font-size:.82em;background:rgb(var(--code-bg));padding:0 20px!important}.ivy-editor .cm-codeblock-src{padding:0!important;font-size:1em;background:rgb(var(--code-bg)/.6)}.ivy-editor .cm-codeblock-first{border-radius:16px 16px 0 0;padding-top:12px!important;color:rgb(var(--faint))}.ivy-editor .cm-codeblock-last{border-radius:0 0 16px 16px;padding-bottom:12px!important;color:rgb(var(--faint))}.ivy-editor .cm-media{display:inline-block;max-width:100%;vertical-align:top;margin:10px 0}.ivy-editor .cm-media img,.ivy-editor .cm-media video{display:block;max-width:100%;max-height:60vh;border-radius:16px}.ivy-editor .cm-media audio{display:block;width:min(100%,420px)}.ivy-editor .cm-media-broken{width:180px;height:120px;border-radius:16px;background:rgb(var(--sunken))}.ivy-editor .cm-media-broken img{display:none}.ivy-editor .cm-file-card{display:inline-flex;align-items:center;gap:6px;background:rgb(var(--code-bg));border-radius:12px;padding:7px 14px;font-size:13px;color:rgb(var(--ink));text-decoration:none}.ivy-editor .cm-task{width:1.05em;height:1.05em;margin:0 .3em 0 0;vertical-align:-.15em;accent-color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-bullet{display:inline-block;width:.7em;color:rgb(var(--faint));font-weight:700}.ivy-editor .cm-table-edit{position:relative;width:-moz-fit-content;width:fit-content;max-width:100%;box-sizing:border-box;margin:6px 0;padding:0 22px 22px 0;white-space:normal;cursor:default}.ivy-editor .cm-table-scroll{overflow-x:auto}.ivy-editor .cm-table-edit table{margin:0;border-collapse:collapse;font-size:.92em;line-height:1.55}.ivy-editor .cm-table-edit td,.ivy-editor .cm-table-edit th{padding:0;border:1px solid rgb(var(--line));vertical-align:top}.ivy-editor .cm-table-edit th{background:rgb(var(--code-bg)/.6);font-weight:600;color:rgb(var(--ink))}.ivy-editor .cm-cell{min-width:3.5em;min-height:1.55em;padding:6px 10px;outline:none;cursor:text;white-space:pre-wrap;overflow-wrap:anywhere;border-radius:2px}.ivy-editor .readonly .cm-cell{cursor:default}.ivy-editor .cm-cell:focus{box-shadow:inset 0 0 0 2px rgb(var(--ivy)/.7);background:rgb(var(--surface))}.ivy-editor .cm-cell.sel{background:rgb(var(--ivy)/.12)}.ivy-editor .cm-cell a{color:rgb(var(--ivy))}.ivy-editor .cm-table-add{position:absolute;display:flex;align-items:center;justify-content:center;border-radius:6px;color:rgb(var(--faint));font-size:14px;line-height:1;opacity:0;transition:opacity .15s,background-color .15s}.ivy-editor .cm-table-add-row{left:0;right:22px;bottom:2px;height:18px}.ivy-editor .cm-table-add-col{top:0;right:2px;bottom:22px;width:18px}.ivy-editor .cm-table-edit.editing .cm-table-add,.ivy-editor .cm-table-edit:hover .cm-table-add{opacity:1}.ivy-editor .cm-table-add:hover{background:rgb(var(--sunken));color:rgb(var(--ink))}@media (pointer:coarse){.ivy-editor .cm-table-add{opacity:.6}}.ivy-editor .cm-table-more{position:absolute;z-index:2;width:24px;height:18px;border-radius:999px;background:rgb(var(--surface));box-shadow:var(--shadow-float);color:rgb(var(--muted));font-size:13px;line-height:1}.ivy-editor .cm-table-more:hover{color:rgb(var(--ink))}.ivy-editor .cm-table-stats{position:absolute;left:0;bottom:-6px;padding:2px 10px;border-radius:999px;background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink));font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}.cm-table-menu{position:fixed;z-index:80;display:flex;flex-direction:column;gap:2px;padding:6px;border-radius:14px;background:rgb(var(--surface));box-shadow:var(--shadow-lift);color:rgb(var(--ink-2));font-size:13px;animation:ivy-pop .12s ease-out}.cm-table-menu-row{display:flex;align-items:center;gap:2px}.cm-table-menu-label{width:3.2em;padding-left:6px;color:rgb(var(--faint));font-size:12px;flex:none}.cm-table-menu button{height:28px;padding:0 8px;border-radius:8px;white-space:nowrap}.cm-table-menu button:hover:not(:disabled){background:rgb(var(--sunken));color:rgb(var(--ink))}.cm-table-menu button.on{background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink))}.cm-table-menu button:disabled{color:rgb(var(--faint));opacity:.55}.cm-table-menu button.danger:not(:disabled){color:rgb(var(--danger))}.cm-table-picker{position:fixed;z-index:80;padding:10px 12px;border-radius:14px;background:rgb(var(--surface));box-shadow:var(--shadow-lift);color:rgb(var(--ink-2));font-size:13px;animation:ivy-pop .12s ease-out}.cm-table-picker-label{margin-bottom:8px;font-weight:600;color:rgb(var(--ink));font-variant-numeric:tabular-nums}.cm-table-picker-grid{display:grid;gap:3px}.cm-table-picker-grid button{width:20px;height:20px;border-radius:4px;border:1px solid rgb(var(--line));background:rgb(var(--canvas,var(--surface)))}.cm-table-picker-grid button.on{border-color:rgb(var(--ivy)/.7);background:rgb(var(--ivy)/.18)}.cm-table-picker-hint{max-width:190px;margin-top:8px;color:rgb(var(--faint));font-size:11.5px}@media (pointer:coarse){.cm-table-picker-grid button{width:28px;height:28px}}.ivy-editor .cm-mermaid{display:flex;justify-content:center;min-height:48px;margin:6px 0;padding:16px;border-radius:16px;background:rgb(var(--code-bg)/.5);cursor:pointer;overflow-x:auto;transition:background-color .2s}.ivy-editor .cm-mermaid:hover{background:rgb(var(--code-bg))}.ivy-editor .cm-mermaid svg{max-width:100%;height:auto}.ivy-editor .cm-mermaid-loading{min-height:120px}.ivy-editor .cm-mermaid.mermaid-error{justify-content:flex-start;font-family:var(--font-mono);font-size:.8em;color:rgb(var(--danger))}.ivy-editor .cm-hr-widget{display:inline-block;width:100%;height:1px;vertical-align:middle;background:rgb(var(--line))}.cm-tooltip-autocomplete:has(.ivy-insert-row){width:320px;max-width:calc(100vw - 24px)}.cm-tooltip-autocomplete:has(.ivy-insert-row>ul){max-height:min(380px,50vh)!important;min-width:0!important;padding:6px!important}.cm-tooltip-autocomplete completion-section{display:block;padding:10px 10px 4px;font-size:11px;font-weight:500;letter-spacing:.06em;color:rgb(var(--faint));border:none!important}.cm-tooltip-autocomplete completion-section:first-child{padding-top:4px}.cm-tooltip-autocomplete>ul>li.ivy-insert-row{display:grid!important;grid-template-columns:34px minmax(0,1fr) auto;grid-template-rows:auto auto;-moz-column-gap:10px;column-gap:10px;align-items:center;padding:6px 8px!important;border-radius:10px}.ivy-insert-row .ivy-insert-icon{grid-column:1;grid-row:1/3;display:flex;width:34px;height:34px;align-items:center;justify-content:center;border-radius:9px;border:1px solid rgb(var(--line));background:rgb(var(--surface));color:rgb(var(--ink-2));font-size:13px;font-weight:600;line-height:1}.ivy-insert-row[aria-selected] .ivy-insert-icon{border-color:rgb(var(--ivy)/.4);color:rgb(var(--ivy-ink))}.ivy-insert-icon-italic{font-family:var(--font-serif);font-style:italic}.ivy-insert-icon-strike{text-decoration:line-through}.ivy-insert-icon-highlight{background:linear-gradient(transparent 60%,rgb(var(--warn)/.4) 60%) 50% /14px 70% no-repeat,rgb(var(--surface))!important}.ivy-insert-icon-code,.ivy-insert-icon-codeblock,.ivy-insert-icon-wiki{font-family:var(--font-mono);font-size:12px}.ivy-insert-row .cm-completionLabel{grid-row:1;align-self:end;font-size:14px;line-height:1.35;color:rgb(var(--ink))}.ivy-insert-row .cm-completionLabel,.ivy-insert-row .ivy-insert-desc{grid-column:2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ivy-insert-row .ivy-insert-desc{grid-row:2;align-self:start;font-size:12px;line-height:1.4;color:rgb(var(--faint))}.ivy-insert-row .cm-completionDetail{grid-column:3;grid-row:1/3;margin:0!important;padding:1px 6px!important;border-radius:6px;background:rgb(var(--sunken));font-family:var(--font-mono);font-style:normal!important;font-size:11px;color:rgb(var(--muted))}.cm-tooltip-autocomplete .cm-completionDetail{margin-left:auto;padding-left:16px;font-style:normal;font-size:11px;color:rgb(var(--faint))}.ivy-bubble{position:fixed;z-index:70;display:flex;gap:1px;padding:3px;border-radius:12px;background:rgb(var(--surface));box-shadow:var(--shadow-lift);animation:ivy-pop .12s ease-out}.ivy-bubble-btn{min-width:30px;height:30px;padding:0 6px;border-radius:8px;color:rgb(var(--ink-2));font-size:13.5px;font-weight:500}.ivy-bubble-btn:hover{background:rgb(var(--sunken));color:rgb(var(--ink))}.ivy-bubble-bold{font-weight:700}.ivy-bubble-italic{font-style:italic;font-family:var(--font-serif)}.ivy-bubble-highlight{background:linear-gradient(transparent 55%,rgb(var(--warn)/.45) 55%) 50% /14px 100% no-repeat}.ivy-bubble-strike{text-decoration:line-through}.ivy-bubble-code,.ivy-bubble-wiki{font-family:var(--font-mono);font-size:12px}.ivy-editor .cm-due{display:inline-flex;align-items:center;gap:2px;margin:0 0 0 6px;padding:0 8px;border-radius:999px;font-size:.78em;line-height:1.7;vertical-align:.08em;white-space:nowrap;color:rgb(var(--ink-2));background:rgb(var(--sunken));cursor:pointer;transition:background-color .15s}.ivy-editor .cm-due:hover{background:rgb(var(--hover))}.ivy-editor .cm-due-today{color:rgb(var(--ivy-ink));background:rgb(var(--ivy-soft))}.ivy-editor .cm-due-over{color:rgb(var(--danger));background:rgb(var(--danger-soft))}.ivy-editor .cm-due-repeat{color:rgb(var(--muted))}.ivy-editor .cm-due-done{color:rgb(var(--faint));background:transparent;cursor:default;text-decoration:none}.ivy-editor .cm-due-src{color:rgb(var(--ivy))}.ivy-due-picker{position:fixed;z-index:80;width:288px;max-width:calc(100vw - 16px);padding:12px;border-radius:18px;background:rgb(var(--surface));color:rgb(var(--ink));box-shadow:var(--shadow-lift);font-size:14px;animation:ivy-pop .16s ease-out}.ivy-due-sheet{top:auto!important;left:0!important;right:0;bottom:0;width:100%;max-width:none;padding:16px 16px max(16px,env(safe-area-inset-bottom));border-radius:22px 22px 0 0;animation:ivy-sheet .22s ease-out}.ivy-due-sheet .ivy-due-input{height:42px;font-size:16px}.ivy-due-sheet .ivy-due-btn{height:42px;padding:0 20px;font-size:15px}.ivy-due-veil{position:fixed;inset:0;z-index:79;background:rgba(10,14,18,.3);animation:ivy-fade .16s ease-out}@keyframes ivy-sheet{0%{transform:translateY(100%)}}.ivy-due-quick{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}.ivy-due-chip{height:30px;padding:0 11px;border-radius:999px;background:rgb(var(--sunken));color:rgb(var(--ink-2));font-size:13px}.ivy-due-chip:focus-visible,.ivy-due-chip:hover{background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink));outline:none}.ivy-due-row{display:flex;align-items:center;gap:10px;margin-top:6px}.ivy-due-row>span{width:2.6em;flex-shrink:0;color:rgb(var(--muted));font-size:13px}.ivy-due-input{flex:1;min-width:0;height:36px;padding:0 10px;border-radius:10px;border:1px solid rgb(var(--line));background:rgb(var(--canvas));color:rgb(var(--ink));font:inherit;font-size:14px}.ivy-due-note{margin-top:8px;color:rgb(var(--faint));font-size:12px;line-height:1.5}.ivy-due-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.ivy-due-btn{height:34px;padding:0 14px;border-radius:999px;color:rgb(var(--ink-2));font-size:13.5px}.ivy-due-btn:hover{background:rgb(var(--sunken))}.ivy-due-ok{background:rgb(var(--ivy));color:rgb(var(--on-ivy))}.ivy-due-ok:hover{background:rgb(var(--ivy-hover))}.ivy-editor .cm-query .cm-table-total td{font-weight:600;font-variant-numeric:tabular-nums;border-top:1.5px solid rgb(var(--line))}.ivy-editor .cm-table-total-label{color:rgb(var(--muted))}.ivy-editor .cm-frontmatter{font-family:var(--font-mono);font-size:.85em;color:rgb(var(--muted))}.ivy-editor .cm-props{display:grid;gap:4px;margin:2px 0 10px;padding:10px 14px;border-radius:14px;background:rgb(var(--code-bg)/.55);font-size:.86em;cursor:text}.ivy-editor .cm-props-empty{color:rgb(var(--faint))}.ivy-editor .cm-prop{display:flex;gap:12px;align-items:baseline;line-height:1.7}.ivy-editor .cm-prop-key{flex:0 0 auto;min-width:5em;max-width:40%;color:rgb(var(--muted));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ivy-editor .cm-prop-val{display:flex;flex-wrap:wrap;gap:4px;min-width:0;overflow-wrap:anywhere}.ivy-editor .cm-prop-chip{padding:0 8px;border-radius:999px;background:rgb(var(--sunken))}.ivy-editor .cm-query{white-space:normal;margin:6px 0;padding:10px 12px 6px;border-radius:16px;background:rgb(var(--code-bg)/.45);cursor:text}.ivy-editor .cm-query-head{margin-bottom:4px;color:rgb(var(--faint));font-size:12px;letter-spacing:.02em}.ivy-editor .cm-query-scroll{overflow-x:auto}.ivy-editor .cm-query table{margin:0;font-size:.9em;line-height:1.6}.ivy-editor .cm-query a.wikilink{color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-query-empty,.ivy-editor .cm-query-note{padding:4px 0 6px;color:rgb(var(--muted));font-size:.9em}.ivy-editor .cm-query-error{padding:4px 0 6px;color:rgb(var(--danger));font-family:var(--font-mono);font-size:.8em}.ivy-editor .ivy-lock{display:flex;flex-direction:column;align-items:center;gap:8px;max-width:360px;margin:4vh auto 8vh;padding:28px 24px 22px;border-radius:24px;background:rgb(var(--sunken)/.6);text-align:center}.ivy-editor .ivy-lock-icon{display:flex;width:56px;height:56px;align-items:center;justify-content:center;border-radius:999px;background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink))}.ivy-editor .ivy-lock-title{margin-top:4px;font-family:var(--font-serif);font-size:17px;font-weight:600}.ivy-editor .ivy-lock-hint,.ivy-editor .ivy-lock-sub{color:rgb(var(--muted));font-size:13px;line-height:1.6}.ivy-editor .ivy-lock-hint{color:rgb(var(--ink-2))}.ivy-editor .ivy-lock-form{display:flex;width:100%;gap:8px;margin-top:8px}.ivy-dlg-input,.ivy-editor .ivy-lock-input{flex:1 1 auto;min-width:0;height:42px;padding:0 14px;border-radius:12px;border:1px solid rgb(var(--line));background:rgb(var(--surface));color:rgb(var(--ink));font:inherit;font-size:15px;outline:none}.ivy-dlg-input:focus,.ivy-editor .ivy-lock-input:focus{border-color:rgb(var(--ivy));box-shadow:0 0 0 3px rgb(var(--ivy)/.15)}.ivy-dlg-primary,.ivy-editor .ivy-lock-btn{height:42px;padding:0 18px;border-radius:12px;background:rgb(var(--ivy));color:rgb(var(--on-ivy));font-size:14.5px;font-weight:500;white-space:nowrap}.ivy-editor .ivy-lock-btn:disabled{opacity:.7}.ivy-dlg-error,.ivy-editor .ivy-lock-error{min-height:1.4em;color:rgb(var(--danger));font-size:13px}.ivy-shake{animation:ivy-shake .36s}@keyframes ivy-shake{20%,60%{transform:translateX(-6px)}40%,80%{transform:translateX(6px)}}@keyframes ivy-pop{0%{opacity:0;transform:translateY(-4px) scale(.98)}}.ivy-dlg-back{position:fixed;inset:0;z-index:90;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(10,14,18,.36);animation:ivy-fade .16s ease-out}.ivy-dlg-out{opacity:0;transition:opacity .15s}@keyframes ivy-fade{0%{opacity:0}}.ivy-dlg{width:100%;max-width:420px;max-height:calc(100vh - 32px);overflow-y:auto;padding:22px 22px 18px;border-radius:22px;background:rgb(var(--surface));color:rgb(var(--ink));box-shadow:var(--shadow-lift);animation:ivy-pop .18s ease-out}.ivy-dlg-form{display:flex;flex-direction:column;gap:10px}.ivy-dlg-title{font-family:var(--font-serif);font-size:18px;font-weight:600}.ivy-dlg-notes,.ivy-dlg-text{color:rgb(var(--ink-2));font-size:13.5px;line-height:1.65}.ivy-dlg-notes{padding-left:1.1em;list-style:disc}.ivy-dlg-field{display:flex;flex-direction:column;gap:4px}.ivy-dlg-field .ivy-dlg-input{flex:none;width:100%}.ivy-dlg-label{color:rgb(var(--muted));font-size:12.5px}.ivy-dlg-ack{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border-radius:12px;background:rgb(var(--warn-soft));color:rgb(var(--warn-ink));font-size:13px;line-height:1.55}.ivy-dlg-ack input{margin-top:3px;accent-color:rgb(var(--ivy))}.ivy-dlg-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.ivy-dlg-btn{height:40px;padding:0 16px;border-radius:12px;color:rgb(var(--ink-2));font-size:14px}.ivy-dlg-btn:hover{background:rgb(var(--sunken))}.ivy-dlg-btn.ivy-dlg-primary{background:rgb(var(--ivy));color:rgb(var(--on-ivy))}.ivy-dlg-btn.ivy-dlg-primary:hover{background:rgb(var(--ivy-hover))}.ivy-dlg-btn.ivy-dlg-danger{background:rgb(var(--danger));color:#fff}:root{--editor-size:16px;--gutter:20px}body,html{margin:0;background:rgb(var(--surface));-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;font-family:system-ui,Roboto,Noto Sans CJK SC,Noto Sans SC,sans-serif}body{min-height:100vh;padding-bottom:40vh;box-sizing:border-box}#editor{padding:4px var(--gutter) 0}.ivy-editor .cm-editor{font-size:var(--editor-size)}.ivy-editor .cm-scroller{overflow:visible!important}@media (min-width:700px){:root{--gutter:44px}#editor{max-width:760px;margin:0 auto}}.ivy-editor .cm-table td,.ivy-editor .cm-table th,.ivy-editor .cm-table-edit .cm-cell{min-width:5em} \ No newline at end of file diff --git a/app/src/main/assets/editor/main.js b/app/src/main/assets/editor/main.js index dd5c1e1..27701f1 100644 --- a/app/src/main/assets/editor/main.js +++ b/app/src/main/assets/editor/main.js @@ -1,98 +1,138 @@ -import{$ as R,A as ve,B as X,C as Te,D as Ji,E as Yr,F as es,G as zr,H as qr,I as ts,Ia as ds,J as rs,K as ns,L as K,M as Re,N as pt,O as le,P as M,Q as Wt,R as Mt,S as Ut,T as is,U as Oe,V as f,W as ss,X as Vt,Y as Ar,Z as as,_ as Ne,a as Ii,aa as os,b as _r,ba as ce,c as W,ca as Lr,d as ht,da as Gt,e as J,ea as $e,f as Lt,fa as ls,g as Z,ga as Os,h as De,ha as Fe,i as ie,ia as cs,j as ge,ja as he,k as Cr,ka as It,l as Di,la as hs,m as q,ma as us,n as Bi,na as ps,o as A,p as Qe,q as ut,r as Ni,s as Fi,t as Hi,tc as ms,u as Be,uc as gs,v as I,w as ee,x as v,y as Ki,ya as fs,z as Et}from"./chunks/chunk-GJGDCSZU.js";import{a as Dt}from"./chunks/chunk-TO3N6BD7.js";import"./chunks/chunk-Y6SLVHK3.js";var He=class{constructor(e,r,n,i){this.state=e,this.pos=r,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let r=R(this.state).resolveInner(this.pos,-1);for(;r&&e.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(e){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),i=r.text.slice(n-r.from,this.pos-r.from),s=i.search(Zs(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,r,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(r),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Qs(t){let e=Object.keys(t).join(""),r=/\w/.test(e);return r&&(e=e.replace(/\w/g,"")),`[${r?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Gl(t){let e=Object.create(null),r=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;stypeof i=="string"?{label:i}:i),[r,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Gl(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:r}:null}}function ys(t,e){return r=>{for(let n=R(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(t.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(r)}}var Nt=class{constructor(e,r,n,i){this.completion=e,this.source=r,this.match=n,this.score=i}};function _e(t){return t.selection.main.from}function Zs(t,e){var r;let{source:n}=t,i=e&&n[0]!="^",s=n[n.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(r=t.flags)!==null&&r!==void 0?r:t.ignoreCase?"i":"")}var Jr=Di.define();function Il(t,e,r,n){let{main:i}=t.selection,s=r-i.from,a=n-i.from;return{...t.changeByRange(o=>{if(o!=i&&r!=n&&t.sliceDoc(o.from+s,o.from+a)!=t.sliceDoc(r,n))return{range:o};let l=t.toText(e);return{changes:{from:o.from+s,to:n==i.from?o.to:o.from+a,insert:l},range:Z.cursor(o.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var $s=new WeakMap;function Dl(t){if(!Array.isArray(t))return t;let e=$s.get(t);return e||$s.set(t,e=Kr(t)),e}var Ft=q.define(),ft=q.define(),Ur=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(_=ht(w))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!Q||G==1&&g||y==0&&G!=0)&&(r[h]==w||n[h]==w&&(p=!0)?a[h++]=Q:a.length&&(b=!1)),y=G,Q+=J(w)}return h==l&&a[0]==0&&b?this.result(-100+(p?-200:0),a,e):u==l&&d==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):u==l?this.ret(-900-e.length,[d,m]):h==l?this.result(-100+(p?-200:0)+-700+(b?0:-1100),a,e):r.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,r,n){let i=[],s=0;for(let a of r){let o=a+(this.astral?J(W(n,a)):1);s&&i[s-1]==a?i[s-1]=o:(i[s++]=a,i[s++]=o)}return this.ret(e-n.length,i)}},Vr=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Bl,filterStrict:!1,compareCompletions:(e,r)=>(e.sortText||e.label).localeCompare(r.sortText||r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,r)=>e&&r,closeOnBlur:(e,r)=>e&&r,icons:(e,r)=>e&&r,tooltipClass:(e,r)=>n=>bs(e(n),r(n)),optionClass:(e,r)=>n=>bs(e(n),r(n)),addToOptions:(e,r)=>e.concat(r),filterStrict:(e,r)=>e||r})}});function bs(t,e){return t?e?t+" "+e:t:e}function Bl(t,e,r,n,i,s){let a=t.textDirection==Ki.RTL,o=a,l=!1,O="top",c,h,p=e.left-i.left,u=i.right-e.right,d=n.right-n.left,m=n.bottom-n.top;if(o&&p=m||Q>e.top?c=r.bottom-e.top:(O="bottom",c=e.bottom-r.top)}let g=(e.bottom-e.top)/s.offsetHeight,b=(e.right-e.left)/s.offsetWidth;return{style:`${O}: ${c/g}px; max-width: ${h/b}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":o?"left":"right")}}var en=q.define();function Nl(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(r,n,i,s){let a=document.createElement("span");a.className="cm-completionLabel";let o=r.displayLabel||r.label,l=0;for(let O=0;Ol&&a.appendChild(document.createTextNode(o.slice(l,c)));let p=a.appendChild(document.createElement("span"));p.appendChild(document.createTextNode(o.slice(c,h))),p.className="cm-completionMatchedText",l=h}return lr.position-n.position).map(r=>r.render)}function Er(t,e,r){if(t<=r)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/r);return{from:i*r,to:(i+1)*r}}let n=Math.ceil((t-e)/r);return{from:t-n*r,to:t-(n-1)*r}}var Gr=class{constructor(e,r,n){this.view=e,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(r),{options:s,selected:a}=i.open,o=e.state.facet(Y);this.optionContent=Nl(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Er(s.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:O}=e.state.field(r).open;for(let c=l.target,h;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(h=/-(\d+)$/.exec(c.id))&&+h[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:en.of(c)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let O=e.state.field(this.stateField,!1);O&&O.tooltip&&e.state.facet(Y).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:ft.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var r;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:s,selected:a,disabled:o}=n.open;(!i.open||i.open.options!=s)&&(this.range=Er(s.length,a,e.state.facet(Y).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),o!=((r=i.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let r=this.tooltipClass(e);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),r=e.open;(r.selected>-1&&r.selected=this.range.to)&&(this.range=Er(r.options.length,r.selected,this.view.state.facet(Y).maxRenderedOptions),this.showOptions(r.options,e.id));let n=this.updateSelectedOption(r.selected);if(n){this.destroyInfo();let{completion:i}=r.options[r.selected],{info:s}=i;if(!s)return;let a=typeof s=="string"?document.createTextNode(s):s(i);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>Et(this.view.state,o,"completion info")):(this.addInfoPane(a,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;n.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let r=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return r&&Hl(this.list,r),r}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(s.bottom,r.bottom)-10||i.bottom{a.target==i&&a.preventDefault()});let s=null;for(let a=n.from;an.from||n.from==0))if(s=p,typeof O!="string"&&O.header)i.appendChild(O.header(O));else{let u=i.appendChild(document.createElement("completion-section"));u.textContent=p}}let c=i.appendChild(document.createElement("li"));c.id=r+"-"+a,c.setAttribute("role","option");let h=this.optionClass(o);h&&(c.className=h);for(let p of this.optionContent){let u=p(o,this.view.state,this.view,l);u&&c.appendChild(u)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.tonew Gr(r,t,e)}function Hl(t,e){let r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),i=r.height/t.offsetHeight;n.topr.bottom&&(t.scrollTop+=(n.bottom-r.bottom)/i)}function Ss(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Kl(t,e){let r=[],n=null,i=null,s=c=>{r.push(c);let{section:h}=c.completion;if(h){n||(n=[]);let p=typeof h=="string"?h:h.name;n.some(u=>u.name==p)||n.push(typeof h=="string"?{name:p}:h)}},a=e.facet(Y);for(let c of t)if(c.hasResult()){let h=c.result.getMatch;if(c.result.filter===!1)for(let p of c.result.options)s(new Nt(p,c.source,h?h(p):[],1e9-r.length));else{let p=e.sliceDoc(c.from,c.to),u,d=a.filterStrict?new Vr(p):new Ur(p);for(let m of c.result.options)if(u=d.match(m.label)){let g=m.displayLabel?h?h(m,u.matched):[]:u.matched,b=u.score+(m.boost||0);if(s(new Nt(m,c.source,g,b)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:Q}=m.section;i||(i=Object.create(null)),i[Q]=Math.max(b,i[Q]||-1e9)}}}}if(n){let c=Object.create(null),h=0,p=(u,d)=>(u.rank==="dynamic"&&d.rank==="dynamic"?i[d.name]-i[u.name]:0)||(typeof u.rank=="number"?u.rank:1e9)-(typeof d.rank=="number"?d.rank:1e9)||(u.namep.score-h.score||O(h.completion,p.completion))){let h=c.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?o.push(c):Ss(c.completion)>Ss(l)&&(o[o.length-1]=c),l=c.completion}return o}var Ir=class t{constructor(e,r,n,i,s,a){this.options=e,this.attrs=r,this.tooltip=n,this.timestamp=i,this.selected=s,this.disabled=a}setSelected(e,r){return e==this.selected||e>=this.options.length?this:new t(this.options,ks(r,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,r,n,i,s,a){if(i&&!a&&e.some(O=>O.isPending))return i.setDisabled();let o=Kl(e,r);if(!o.length)return i&&e.some(O=>O.isPending)?i.setDisabled():null;let l=r.facet(Y).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let O=i.options[i.selected].completion;for(let c=0;cc.hasResult()?Math.min(O,c.from):O,1e8),create:iO,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new t(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new t(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},Dr=class t{constructor(e,r,n){this.active=e,this.id=r,this.open=n}static start(){return new t(rO,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:r}=e,n=r.facet(Y),s=(n.override||r.languageDataAt("autocomplete",_e(r)).map(Dl)).map(l=>(this.active.find(c=>c.source==l)||new ue(l,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((l,O)=>l==this.active[O])&&(s=this.active);let a=this.open,o=e.effects.some(l=>l.is(tn));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Jl(s,this.active)||o?a=Ir.build(s,r,this.id,a,n,o):a&&a.disabled&&!s.some(l=>l.isPending)&&(a=null),!a&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new ue(l.source,0):l));for(let l of e.effects)l.is(en)&&(a=a&&a.setSelected(l.value,this.id));return s==this.active&&a==this.open?this:new t(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?eO:tO}};function Jl(t,e){if(t==e)return!0;for(let r=0,n=0;;){for(;r-1&&(r["aria-activedescendant"]=t+"-"+e),r}var rO=[];function Xs(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(Jr);if(n&&e.activateOnCompletion(n))return 12}let r=t.isUserEvent("input.type");return r&&e.activateOnTyping?5:r?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}var ue=class t{constructor(e,r,n=!1){this.source=e,this.state=r,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,r){let n=Xs(e,r),i=this;(n&8||n&16&&this.touches(e))&&(i=new t(i.source,0)),n&4&&i.state==0&&(i=new t(this.source,1)),i=i.updateFor(e,n);for(let s of e.effects)if(s.is(Ft))i=new t(i.source,1,s.value);else if(s.is(ft))i=new t(i.source,0);else if(s.is(tn))for(let a of s.value)a.source==i.source&&(i=a);return i}updateFor(e,r){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(_e(e.state))}},Ht=class t extends ue{constructor(e,r,n,i,s,a){super(e,3,r),this.limit=n,this.result=i,this.from=s,this.to=a}hasResult(){return!0}updateFor(e,r){var n;if(!(r&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),o=_e(e.state);if(o>a||!i||r&2&&(_e(e.startState)==this.from||or.map(e))}}),U=ie.define({create(){return Dr.start()},update(t,e){return t.update(e)},provide:t=>[es.from(t,e=>e.tooltip),X.contentAttributes.from(t,e=>e.attrs)]});function rn(t,e){let r=e.completion.apply||e.completion.label,n=t.state.field(U).active.find(i=>i.source==e.source);return n instanceof Ht?(typeof r=="string"?t.dispatch({...Il(t.state,r,n.from,n.to),annotations:Jr.of(e.completion)}):r(t,e.completion,n.from,n.to),!0):!1}var iO=Fl(U,rn);function Bt(t,e="option"){return r=>{let n=r.state.field(U,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+i*(t?1:-1):t?0:a-1;return o<0?o=e=="page"?0:a-1:o>=a&&(o=e=="page"?a-1:0),r.dispatch({effects:en.of(o)}),!0}}var sO=t=>{let e=t.state.field(U,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(U,!1)?(t.dispatch({effects:Ft.of(!0)}),!0):!1,aO=t=>{let e=t.state.field(U,!1);return!e||!e.active.some(r=>r.state!=0)?!1:(t.dispatch({effects:ft.of(null)}),!0)},Br=class{constructor(e,r){this.active=e,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}},oO=50,lO=1e3,OO=ve.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(U).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(U),r=t.state.facet(Y);if(!t.selectionSet&&!t.docChanged&&t.startState.field(U)==e)return;let n=t.transactions.some(s=>{let a=Xs(s,r);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;soO&&Date.now()-a.time>lO){for(let o of a.context.abortListeners)try{o()}catch(l){Et(this.view.state,l)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(a=>a.is(Ft)))&&(this.pendingStart=!0);let i=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(a=>a.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(U);for(let r of e.active)r.isPending&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Y).updateSyncTime))}startQuery(t){let{state:e}=this.view,r=_e(e),n=new He(e,r,t.explicit,this.view),i=new Br(t,n);this.running.push(i),Promise.resolve(t.source(n)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:ft.of(null)}),Et(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Y).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],r=this.view.state.facet(Y),n=this.view.state.field(U);for(let i=0;io.source==s.active.source);if(a&&a.isPending)if(s.done==null){let o=new ue(s.active.source,0);for(let l of s.updates)o=o.update(l,r);o.isPending||e.push(o)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:tn.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(U,!1);if(e&&e.tooltip&&this.view.state.facet(Y).closeOnBlur){let r=e.open&&zr(this.view,e.open.tooltip);(!r||!r.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ft.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ft.of(!1)}),20),this.composing=0}}}),cO=typeof navigator=="object"&&/Win/.test(navigator.platform),hO=ge.highest(X.domEventHandlers({keydown(t,e){let r=e.state.field(U,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||!t.key||t.key.length>1||t.ctrlKey&&!(cO&&t.altKey)||t.metaKey)return!1;let n=r.open.options[r.open.selected],i=r.active.find(a=>a.source==n.source),s=n.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&rn(e,n),!1}})),vs=X.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Nr=class{constructor(e,r,n,i){this.field=e,this.line=r,this.from=n,this.to=i}},Fr=class t{constructor(e,r,n){this.field=e,this.from=r,this.to=n}map(e){let r=e.mapPos(this.from,-1,Lt.TrackDel),n=e.mapPos(this.to,1,Lt.TrackDel);return r==null||n==null?null:new t(this.field,r,n)}},Hr=class t{constructor(e,r){this.lines=e,this.fieldPositions=r}instantiate(e,r){let n=[],i=[r],s=e.doc.lineAt(r),a=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(n.length){let O=a,c=/^\t*/.exec(l)[0].length;for(let h=0;hnew Fr(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:o}}static parse(e){let r=[],n=[],i=[],s;for(let a of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let o=s[1]?+s[1]:null,l=s[2]||s[3]||"",O=-1;o===0&&(o=1e9);let c=l.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h=O&&p.field++}for(let h of i)if(h.line==n.length&&h.from>s.index){let p=s[2]?3+(s[1]||"").length:2;h.from-=p,h.to-=p}i.push(new Nr(O,n.length,s.index,s.index+c.length)),a=a.slice(0,s.index)+l+a.slice(s.index+s[0].length)}a=a.replace(/\\([{}])/g,(o,l,O)=>{for(let c of i)c.line==n.length&&c.from>O&&(c.from--,c.to--);return l}),n.push(a)}return new t(n,i)}},uO=v.widget({widget:new class extends ee{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),pO=v.mark({class:"cm-snippetField"}),Ke=class t{constructor(e,r){this.ranges=e,this.active=r,this.deco=v.set(e.map(n=>(n.from==n.to?uO:pO).range(n.from,n.to)),!0)}map(e){let r=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;r.push(i)}return new t(r,this.active)}selectionInsideField(e){return e.ranges.every(r=>this.ranges.some(n=>n.field==this.active&&n.from<=r.from&&n.to>=r.to))}},gt=q.define({map(t,e){return t&&t.map(e)}}),fO=q.define(),dt=ie.define({create(){return null},update(t,e){for(let r of e.effects){if(r.is(gt))return r.value;if(r.is(fO)&&t)return new Ke(t.ranges,r.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>X.decorations.from(t,e=>e?e.deco:v.none)});function nn(t,e){return Z.create(t.filter(r=>r.field==e).map(r=>Z.range(r.from,r.to)))}function dO(t){let e=Hr.parse(t);return(r,n,i,s)=>{let{text:a,ranges:o}=e.instantiate(r.state,i),{main:l}=r.state.selection,O={changes:{from:i,to:s==l.from?l.to:s,insert:Ii.of(a)},scrollIntoView:!0,annotations:n?[Jr.of(n),Bi.userEvent.of("input.complete")]:void 0};if(o.length&&(O.selection=nn(o,0)),o.some(c=>c.field>0)){let c=new Ke(o,0),h=O.effects=[gt.of(c)];r.state.field(dt,!1)===void 0&&h.push(q.appendConfig.of([dt,bO,SO,vs]))}r.dispatch(r.state.update(O))}}function Ts(t){return({state:e,dispatch:r})=>{let n=e.field(dt,!1);if(!n||t<0&&n.active==0)return!1;let i=n.active+t,s=t>0&&!n.ranges.some(a=>a.field==i+t);return r(e.update({selection:nn(n.ranges,i),effects:gt.of(s?null:new Ke(n.ranges,i)),scrollIntoView:!0})),!0}}var mO=({state:t,dispatch:e})=>t.field(dt,!1)?(e(t.update({effects:gt.of(null)})),!0):!1,gO=Ts(1),QO=Ts(-1);var $O=[{key:"Tab",run:gO,shift:QO},{key:"Escape",run:mO}],Ps=De.define({combine(t){return t.length?t[0]:$O}}),bO=ge.highest(Te.compute([Ps],t=>t.facet(Ps)));function L(t,e){return{...e,apply:dO(t)}}var SO=X.domEventHandlers({mousedown(t,e){let r=e.state.field(dt,!1),n;if(!r||(n=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=r.ranges.find(s=>s.from<=n&&s.to>=n);return!i||i.field==r.active?!1:(e.dispatch({selection:nn(r.ranges,i.field),effects:gt.of(r.ranges.some(s=>s.field>i.field)?new Ke(r.ranges,i.field):null),scrollIntoView:!0}),!0)}});var mt={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},je=q.define({map(t,e){let r=e.mapPos(t,-1,Lt.TrackAfter);return r??void 0}}),sn=new class extends Ni{};sn.startSide=1;sn.endSide=-1;var Rs=ie.define({create(){return Fi.empty},update(t,e){if(t=t.map(e.changes),e.selection){let r=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=r.from&&n<=r.to})}for(let r of e.effects)r.is(je)&&(t=t.update({add:[sn.range(r.value,r.value+1)]}));return t}});function js(){return[PO,Rs]}var Mr="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function _s(t){for(let e=0;e{if((kO?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(n.length>2||n.length==2&&J(W(n,0))==1||e!=i.from||r!=i.to)return!1;let s=wO(t.state,n);return s?(t.dispatch(s),!0):!1}),xO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Cs(t,t.selection.main.head).brackets||mt.brackets,i=null,s=t.changeByRange(a=>{if(a.empty){let o=yO(t.doc,a.head);for(let l of n)if(l==o&&Kt(t.doc,a.head)==_s(W(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:Z.cursor(a.head-l.length)}}return{range:i=a}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},Ys=[{key:"Backspace",run:xO}];function wO(t,e){let r=Cs(t,t.selection.main.head),n=r.brackets||mt.brackets;for(let i of n){let s=_s(W(i,0));if(e==i)return s==i?vO(t,i,n.indexOf(i+i+i)>-1,r):ZO(t,i,s,r.before||mt.before);if(e==s&&zs(t,t.selection.main.from))return XO(t,i,s)}return null}function zs(t,e){let r=!1;return t.field(Rs).between(0,t.doc.length,n=>{n==e&&(r=!0)}),r}function Kt(t,e){let r=t.sliceString(e,e+2);return r.slice(0,J(W(r,0)))}function yO(t,e){let r=t.sliceString(e-2,e);return J(W(r,0))==r.length?r:r.slice(1)}function ZO(t,e,r,n){let i=null,s=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:r,from:a.to}],effects:je.of(a.to+e.length),range:Z.range(a.anchor+e.length,a.head+e.length)};let o=Kt(t.doc,a.head);return!o||/\s/.test(o)||n.indexOf(o)>-1?{changes:{insert:e+r,from:a.head},effects:je.of(a.head+e.length),range:Z.cursor(a.head+e.length)}:{range:i=a}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function XO(t,e,r){let n=null,i=t.changeByRange(s=>s.empty&&Kt(t.doc,s.head)==r?{changes:{from:s.head,to:s.head+r.length,insert:r},range:Z.cursor(s.head+r.length)}:n={range:s});return n?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function vO(t,e,r,n){let i=n.stringPrefixes||mt.stringPrefixes,s=null,a=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:je.of(o.to+e.length),range:Z.range(o.anchor+e.length,o.head+e.length)};let l=o.head,O=Kt(t.doc,l),c;if(O==e){if(xs(t,l))return{changes:{insert:e+e,from:l},effects:je.of(l+e.length),range:Z.cursor(l+e.length)};if(zs(t,l)){let p=r&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+p.length,insert:p},range:Z.cursor(l+p.length)}}}else{if(r&&t.sliceDoc(l-2*e.length,l)==e+e&&(c=ws(t,l-2*e.length,i))>-1&&xs(t,c))return{changes:{insert:e+e+e+e,from:l},effects:je.of(l+e.length),range:Z.cursor(l+e.length)};if(t.charCategorizer(l)(O)!=A.Word&&ws(t,l,i)>-1&&!TO(t,l,e,i))return{changes:{insert:e+e,from:l},effects:je.of(l+e.length),range:Z.cursor(l+e.length)}}return{range:s=o}});return s?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function xs(t,e){let r=R(t).resolveInner(e+1);return r.parent&&r.from==e}function TO(t,e,r,n){let i=R(t).resolveInner(e,-1),s=n.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=t.sliceDoc(i.from,Math.min(i.to,i.from+r.length+s)),l=o.indexOf(r);if(!l||l>-1&&n.indexOf(o.slice(0,l))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>r.length+l;){if(t.sliceDoc(c.to-r.length,c.to)==r)return!1;c=c.firstChild}return!0}let O=i.to==e&&i.parent;if(!O)break;i=O}return!1}function ws(t,e,r){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=A.Word)return e;for(let i of r){let s=e-i.length;if(t.sliceDoc(s,e)==i&&n(t.sliceDoc(s-1,s))!=A.Word)return s}return-1}function qs(t={}){return[hO,U,Y.of(t),OO,RO,vs]}var an=[{key:"Ctrl-Space",run:Wr},{mac:"Alt-`",run:Wr},{mac:"Alt-i",run:Wr},{key:"Escape",run:aO},{key:"ArrowDown",run:Bt(!0)},{key:"ArrowUp",run:Bt(!1)},{key:"PageDown",run:Bt(!0,"page")},{key:"PageUp",run:Bt(!1,"page")},{key:"Enter",run:sO}],RO=ge.highest(Te.computeN([Y],t=>t.facet(Y).defaultKeymap?[an]:[]));var tr=class t{static create(e,r,n,i,s){let a=i+(i<<8)+e+(r<<4)|0;return new t(e,r,n,a,s,[],[])}constructor(e,r,n,i,s,a,o){this.type=e,this.value=r,this.from=n,this.hash=i,this.end=s,this.children=a,this.positions=o,this.blankFirstLine=!1,this.hashProp=[[K.contextHash,i]]}addChild(e,r){e.prop(K.contextHash)!=this.hash&&(e=new M(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new M(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(i,s,a)=>new M(Re.none,i,s,a,this.hashProp)})}},$;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})($||($={}));var On=class{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}},cn=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return $t(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let i=r;i=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==$.OrderedList?kn:Sn)(r,e,!1);return n>0&&(t.type!=$.BulletList||bn(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}var Ns={[$.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(T($.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(D(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[$.ListItem](t,e,r){return(r.next<0?t.blankFirstLine&&t.children.length==1:r.indentr&&D(t.charCodeAt(e-1));)e--;return e}function Fs(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(ia.SetextHeading)>-1||n<3?-1:1}function Ks(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function Sn(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||D(t.text.charCodeAt(t.pos+1)))&&(!r||Ks(e,$.BulletList)||t.skipSpace(t.pos+2)=48&&i<=57;){n++;if(n==t.text.length)return-1;i=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||i!=46&&i!=41||nt.pos+1||t.next!=49)?-1:n+1-t.pos}function Js(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e6?-1:r}function ea(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,ra=/\?>/,un=[[/^<(?:script|pre|style|textarea)(?:\s|>|$)/i,/<\/(?:script|pre|style|textarea)>/i],[/^\s*)/.exec(n);if(s)return t.append(T($.Comment,r,r+1+s[0].length));let a=/^\?[^]*?\?>/.exec(n);if(a)return t.append(T($.ProcessingInstruction,r,r+1+a[0].length));let o=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/[a-zA-Z][\w-]*\s*>|[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>)/.exec(n);return o?t.append(T($.HTMLTag,r,r+1+o[0].length)):-1},Emphasis(t,e,r){if(e!=95&&e!=42)return-1;let n=r+1;for(;t.char(n)==e;)n++;let i=t.slice(r-1,r),s=t.slice(n,n+1),a=kt.test(i),o=kt.test(s),l=/\s|^$/.test(i),O=/\s|^$/.test(s),c=!O&&(!o||l||a),h=!l&&(!a||O||o),p=c&&(e==42||!h||a),u=h&&(e==42||!c||o);return t.append(new E(e==95?Pn:xn,r,n,(p?1:0)|(u?2:0)))},HardBreak(t,e,r){if(e==92&&t.char(r+1)==10)return t.append(T($.HardBreak,r,r+2));if(e==32){let n=r+1;for(;t.char(n)==32;)n++;if(t.char(n)==10&&n>=r+2)return t.append(T($.HardBreak,r,n+1))}return-1},Link(t,e,r){return e==91?t.append(new E(Ce,r,r+1,1)):-1},Image(t,e,r){return e==33&&t.char(r+1)==91?t.append(new E(ir,r,r+2,1)):-1},LinkEnd(t,e,r){if(e!=93)return-1;for(let n=t.parts.length-1;n>=0;n--){let i=t.parts[n];if(i instanceof E&&(i.type==Ce||i.type==ir)){if(!i.side||t.skipSpace(i.to)==r&&!/[(\[]/.test(t.slice(r+1,r+2)))return t.parts[n]=null,-1;let s=t.takeContent(n),a=t.parts[n]=CO(t,s,i.type==Ce?$.Link:$.Image,i.from,r+1);if(i.type==Ce)for(let o=0;oe?T($.URL,e+r,s+r):s==t.length?null:!1}}function la(t,e,r){let n=t.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let i=n==40?41:n;for(let s=e+1,a=!1;s=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,r){return this.text.slice(e-this.offset,r-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,r,n,i,s){return this.append(new E(e,r,n,(i?1:0)|(s?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let r=this.parts[e];if(r instanceof E&&(r.type==Ce||r.type==ir))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n=e;l--){let m=this.parts[l];if(m instanceof E&&m.side&1&&m.type==i.type&&!(s&&(i.side&1||m.side&2)&&(m.size+i.size)%3==0&&(m.size%3||i.size%3))){o=m;break}}if(!o)continue;let O=i.type.resolve,c=[],h=o.from,p=i.to;if(s){let m=Math.min(2,o.to-o.from,a);h=o.to-m,p=i.from+m,O=m==1?"Emphasis":"StrongEmphasis"}o.type.mark&&c.push(this.elt(o.type.mark,h,o.to));for(let m=l+1;m=0;r--){let n=this.parts[r];if(n instanceof E&&n.type==e&&n.side&1)return r}return null}takeContent(e){let r=this.resolveMarkers(e);return this.parts.length=e,r}getDelimiterAt(e){let r=this.parts[e];return r instanceof E?r:null}skipSpace(e){return $t(this.text,e-this.offset)+this.offset}elt(e,r,n,i){return typeof e=="string"?T(this.parser.getNodeType(e),r,n,i):new nr(e,r)}};ze.linkStart=Ce;ze.imageStart=ir;ze.emphasisAsterisk=xn;ze.emphasisUnderscore=Pn;function gn(t,e){if(!e.length)return t;if(!t.length)return e;let r=t.slice(),n=0;for(let i of e){for(;n(e?e-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` -`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(le.IncludeAnonymous|le.IgnoreMounts),n.firstChild());let i=e+this.fragment.offset;for(;n.to<=i;)if(!n.parent())return!1;for(;;){if(n.from>=i)return this.fragment.from<=r;if(!n.childAfter(i))return!1}}matches(e){let r=this.cursor.tree;for(;r&&r.type.isAnonymous&&r.children[0]instanceof M;)r=r.children[0];return r&&r.prop(K.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,a=s,o=e.block.children.length,l=e.lineStart-e.block.from>>2,O=a,c=o;e:for(;;){if(r.to-n>Math.min(i,e.to)||r.type.isAnonymous&&r.tree&&(r.to-r.from>l||!YO(r.tree))){if(r.type.isAnonymous&&r.firstChild())continue;break}let h=ha(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,h);else{let p=new M(e.parser.nodeSet.types[$.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(p,r.tree),e.addNode(p,h)}for((r.type.isAnonymous||r.type.is("Block"))&&(r.type.isAnonymous||ca.indexOf(r.type.id)<0?(a=r.to-n,o=e.block.children.length):(a=O,o=c),O=r.to-n,c=e.block.children.length);;){if(r.nextSibling())continue e;if(!r.parent()||!r.type.isAnonymous)break e}}for(;e.block.children.length>o;)e.block.children.pop(),e.block.positions.pop();return a-s}};function YO(t){for(;t.type.isAnonymous;){let e=t.children[t.children.length-1];if(e instanceof M)t=e;else return!1}return t.type.is("Block")&&ca.indexOf(t.type.id)<0}function ha(t,e){let r=t;for(let n=1;nJt[t]),Object.keys(Jt).map(t=>ia[t]),Object.keys(Jt),jO,Ns,Object.keys(ln).map(t=>ln[t]),Object.keys(ln),[]);function qO(t,e,r){let n=[];for(let i=t.firstChild,s=e;;i=i.nextSibling){let a=i?i.from:r;if(a>s&&n.push({from:s,to:a}),!i)break;s=i.to}return n}function pa(t){let{codeParser:e,htmlParser:r}=t;return{wrap:Ut((i,s)=>{let a=i.type.id;if(e&&(a==$.CodeBlock||a==$.FencedCode)){let o="";if(a==$.FencedCode){let O=i.node.getChild($.CodeInfo);O&&(o=s.read(O.from,O.to))}let l=e(o);if(l)return{parser:l,overlay:O=>O.type.id==$.CodeText,bracketed:a==$.FencedCode}}else if(r&&(a==$.HTMLBlock||a==$.HTMLTag||a==$.CommentBlock))return{parser:r,overlay:qO(i.node,i.from,i.to)};return null})}}var AO={resolve:"Strikethrough",mark:"StrikethroughMark"},LO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":f.strikethrough}},{name:"StrikethroughMark",style:f.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,r){if(e!=126||t.char(r+1)!=126||t.char(r+2)==126)return-1;let n=t.slice(r-1,r),i=t.slice(r+2,r+3),s=/\s|^$/.test(n),a=/\s|^$/.test(i),o=kt.test(n),l=kt.test(i);return t.addDelimiter(AO,r,r+2,!a&&(!l||s||o),!s&&(!o||a||l))},after:"Emphasis"}]};function bt(t,e,r=0,n,i=0){let s=0,a=!0,o=-1,l=-1,O=!1,c=()=>{n.push(t.elt("TableCell",i+o,i+l,t.parser.parseInline(e.slice(o,l),i+o)))};for(let h=r;h-1)&&s++,a=!1,n&&(o>-1&&c(),n.push(t.elt("TableDelimiter",h+i,h+i+1))),o=l=-1):(O||p!=32&&p!=9)&&(o<0&&(o=h),l=h+1),O=!O&&p==92}return o>-1&&(s++,n&&c()),s}function Ms(t,e){for(let r=e;r\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,sr=class{constructor(){this.rows=null}nextLine(e,r,n){if(this.rows==null){this.rows=!1;let i;if((r.next==45||r.next==58||r.next==124)&&fa.test(i=r.text.slice(r.pos))){let s=[];bt(e,n.content,0,s,n.start)==bt(e,i,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+r.pos,e.lineStart+r.text.length)])}}else if(this.rows){let i=[];bt(e,r.text,r.pos,i,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+r.pos,e.lineStart+r.text.length,i))}return!1}finish(e,r){return this.rows?(e.addLeafElement(r,e.elt("Table",r.start,r.start+r.content.length,this.rows)),!0):!1}},EO={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":f.heading}},"TableRow",{name:"TableCell",style:f.content},{name:"TableDelimiter",style:f.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return Ms(e.content,0)?new sr:null},endLeaf(t,e,r){if(r.parsers.some(i=>i instanceof sr)||!Ms(e.text,e.basePos))return!1;let n=t.peekLine();return fa.test(n)&&bt(t,e.text,e.basePos)==bt(t,n,e.basePos)},before:"SetextHeading"}]},$n=class{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}},WO={defineNodes:[{name:"Task",block:!0,style:f.list},{name:"TaskMarker",style:f.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new $n:null},after:"SetextHeading"}]},Us=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Vs=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,MO=/[\w-]+\.[\w-]+($|[/:])/,Gs=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Is=/\/[a-zA-Z\d@.]+/gy;function Ds(t,e,r,n){let i=0;for(let s=e;s-1)return-1;let n=e+r[0].length;for(;;){let i=t[n-1],s;if(/[?!.,:*_~]/.test(i)||i==")"&&Ds(t,e,n,")")>Ds(t,e,n,"("))n--;else if(i==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,n))))n=e+s.index;else break}return n}function Bs(t,e){Gs.lastIndex=e;let r=Gs.exec(t);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}var VO={parseInline:[{name:"Autolink",parse(t,e,r){let n=r-t.offset;if(n&&/\w/.test(t.text[n-1]))return-1;Us.lastIndex=n;let i=Us.exec(t.text),s=-1;if(!i)return-1;if(i[1]||i[2]){if(s=UO(t.text,n+i[0].length),s>-1&&t.hasOpenLink){let a=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(n,s));s=n+a[0].length}}else i[3]?s=Bs(t.text,n):(s=Bs(t.text,n+i[0].length),s>-1&&i[0]=="xmpp:"&&(Is.lastIndex=s,i=Is.exec(t.text),i&&(s=i.index+i[0].length)));return s<0?-1:(t.addElement(t.elt("URL",r,s+t.offset)),s+t.offset)}}]},da=[EO,WO,LO,VO];function ma(t,e,r){return(n,i,s)=>{if(i!=t||n.char(s+1)==t)return-1;let a=[n.elt(r,s,s+1)];for(let o=s+1;or%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,r,n=0){let i=e.parser.context;return new t(e,[],r,n,n,0,[],0,i?new ar(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var r;let n=e>>19,i=e&65535,{parser:s}=this.p,a=this.reducePos=2e3&&!(!((r=this.p.parser.nodeSet.types[i])===null||r===void 0)&&r.isAnonymous)&&(O==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(i,O)}storeNode(e,r,n,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(r==n)return;if(this.buffer[a-2]>=r){this.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,r,n,i);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let o=!1;for(let l=a;l>0&&this.buffer[l-2]>n;l-=4)if(this.buffer[l-1]>=0){o=!0;break}if(o)for(;a>0&&this.buffer[a-2]>n;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,i>4&&(i-=4)}this.buffer[a]=e,this.buffer[a+1]=r,this.buffer[a+2]=n,this.buffer[a+3]=i}}shift(e,r,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:a}=this.p;this.pos=i;let o=a.stateFlag(s,1);!o&&(i>n||r<=a.maxNode)&&(this.reducePos=i),this.pushState(s,o?n:Math.min(n,this.reducePos)),this.shiftContext(r,n),r<=a.maxNode&&this.buffer.push(r,n,i,4)}else this.pos=i,this.shiftContext(r,n),r<=this.p.parser.maxNode&&this.buffer.push(r,n,i,4)}apply(e,r,n,i){e&65536?this.reduce(e):this.shift(e,r,n,i)}useNode(e,r,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.reducePos=this.pos=n+e.length;this.pushState(r,n),this.buffer.push(i,n,s,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,r=e.buffer.length;for(r&&e.buffer[r-4]==0&&(r-=4);r>0&&e.buffer[r-2]>e.reducePos;)r-=4;let n=e.buffer.slice(r),i=e.bufferBase+r;for(;e&&i==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,r){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(e){for(let r=new Xn(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,e);if(n==0)return!1;if((n&65536)==0)return!0;r.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>8||this.stack.length>=120){let i=[];for(let s=0,a;sl&1&&o==a)||i.push(r[s],a)}r=i}let n=[];for(let i=0;i>19,i=r&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;r=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:e}=this.p,r=[],n=(i,s)=>{if(!r.includes(i))return r.push(i),e.allActions(i,a=>{if(!(a&393216))if(a&65536){let o=(a>>19)-s;if(o>1){let l=a&65535,O=this.stack.length-o*3;if(O>=0&&e.getGoto(this.stack[O],l,!1)>=0)return o<<19|65536|l}}else{let o=n(a,s+1);if(o!=null)return o}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let r=0;r0&&this.emitLookAhead()}},ar=class{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}},Xn=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let r=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=i}},vn=class t{constructor(e,r,n){this.stack=e,this.pos=r,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,r=e.bufferBase+e.buffer.length){return new t(e,r,r-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new t(this.stack,this.pos,this.index)}};function Pt(t,e=Uint16Array){if(typeof t!="string")return t;let r=null;for(let n=0,i=0;n=92&&a--,a>=34&&a--;let l=a-32;if(l>=46&&(l-=46,o=!0),s+=l,o)break;s*=46}r?r[i++]=s:r=new e(s)}return r}var et=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},ba=new et,Tn=class{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=ba,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(e,r){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(i==this.ranges.length-1)return null;let a=this.ranges[++i];s+=a.from-n.to,n=a}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,r.from);return this.end}peek(e){let r=this.chunkOff+e,n,i;if(r>=0&&r=this.chunk2Pos&&no.to&&(this.chunk2=this.chunk2.slice(0,o.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,r){if(r?(this.token=r,r.start=e,r.lookAhead=e+1,r.value=r.extended=-1):this.token=ba,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,r-this.chunkPos);if(e>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,r-this.chunk2Pos);if(e>=this.range.from&&r<=this.range.to)return this.input.read(e,r);let n="";for(let i of this.ranges){if(i.from>=r)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,r)))}return n}},Se=class{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;wa(this.data,e,r,this.id,n.data,n.tokenPrecTable)}};Se.prototype.contextual=Se.prototype.fallback=Se.prototype.extend=!1;var ke=class{constructor(e,r,n){this.precTable=r,this.elseToken=n,this.data=typeof e=="string"?Pt(e):e}token(e,r){let n=e.pos,i=0;for(;;){let s=e.next<0,a=e.resolveOffset(1,1);if(wa(this.data,e,r,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,a==null)break;e.reset(a,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}};ke.prototype.contextual=Se.prototype.fallback=Se.prototype.extend=!1;var z=class{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}};function wa(t,e,r,n,i,s){let a=0,o=1<0){let d=t[u];if(l.allows(d)&&(e.token.value==-1||e.token.value==d||IO(d,e.token.value,i,s))){e.acceptToken(d);break}}let c=e.next,h=0,p=t[a+2];if(e.next<0&&p>h&&t[O+p*3-3]==65535){a=t[O+p*3-1];continue e}for(;h>1,d=O+u+(u<<1),m=t[d],g=t[d+1]||65536;if(c=g)h=u+1;else{a=t[d+2],e.advance();continue e}}break}}function Sa(t,e,r){for(let n=e,i;(i=t[n])!=65535;n++)if(i==r)return n-e;return-1}function IO(t,e,r,n){let i=Sa(r,n,e);return i<0||Sa(r,n,t)e)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:t.length}}var Rn=class{constructor(e,r){this.fragments=e,this.minRepeat=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?ka(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ka(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(s instanceof M){let o=a>this.lastRepeatPos&&s.type.id>=this.minRepeat;if(a==e||o){let l=a+s.length,O;if(a>=this.safeFrom&&l<=this.safeTo&&(!(O=s.prop(K.lookAhead))||l+O=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[r]++,this.nextStart=a+s.length}}},jn=class{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new et)}getActions(e){let r=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,a=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,l=0;for(let O=0;Oh.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let p=r;if(h.extended>-1&&(r=this.addActions(e,h.extended,h.end,r)),r=this.addActions(e,h.value,h.end,r),!c.extend&&(n=h,r>p))break}}for(;this.actions.length>r;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new et,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,r=this.addActions(e,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let r=new et,{pos:n,p:i}=e;return r.start=n,r.end=Math.min(n+1,i.stream.end),r.value=n==i.stream.end?i.parser.eofTerm:0,r}updateCachedToken(e,r,n){let i=this.stream.clipPos(n.pos);if(r.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.p;for(let a=0;a=0&&n.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,r,n,i){for(let s=0;se.bufferLength*4?new Rn(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,r=this.minStackPos,n=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;ar)n.push(o);else{if(this.advanceStack(o,n,e))continue;{i||(i=[],s=[]),i.push(o);let l=this.tokens.getMainToken(o);s.push(l.value,l.end)}}break}}if(!n.length){let a=i&&DO(i);if(a)return B&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw B&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&i){let a=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,n);if(a)return B&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(n.length>a)for(n.sort((o,l)=>l.score-o.score);n.length>a;)n.pop();n.some(o=>o.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let a=0;a500&&O.buffer.length>500)if((o.score-O.score||o.buffer.length-O.buffer.length)>0)n.splice(l--,1);else{n.splice(a--,1);continue e}}}n.length>12&&(n.sort((a,o)=>o.score-a.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let a=1;a-1&&n.length&&(!s||(n.prop(K.contextHash)||0)==a))return e.useNode(n,o,r),n;if(n.children.length==0||n.positions[0]>0)break;let l=n.children[0];if(l instanceof M&&(!i||l.type.id>=this.parser.minRepeatTerm))n=l;else break}return null}advanceStack(e,r,n){let i=e.pos,{parser:s}=this,a=B?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let O=e.reducePos0)return e.reduce(o),B&&console.log(a+this.stackID(e)+` (via always-reduce ${s.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let O=0;Oi?r.push(d):n.push(d)}return!1}advanceFully(e,r){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Pa(e,r),!0}}runRecovery(e,r,n){let i=null,s=!1;for(let a=0;a ":"";if(o.deadEnd&&(s||(s=!0,o.restart(),B&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))))continue;let h=o.split(),p=c;for(let u=0;u<10&&h.forceReduce()&&(B&&console.log(p+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));u++)B&&(p=this.stackID(h)+" -> ");for(let u of o.recoverByInsert(l))B&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>o.pos?(O==o.pos&&(O++,l=0),o.recoverByDelete(l,O),B&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),Pa(o,n)):(!i||i.scoret,tt=class{constructor(e){this.start=e.start,this.shift=e.shift||yn,this.reduce=e.reduce||yn,this.reuse=e.reuse||yn,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},Pe=class t extends Mt{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let r=e.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let o=0;oe.topRules[o][1]),i=[];for(let o=0;o=0)s(c,l,o[O++]);else{let h=o[O+-c];for(let p=-c;p>0;p--)s(o[O++],l,h);O++}}}this.nodeSet=new pt(r.map((o,l)=>Re.define({name:l>=this.minRepeatTerm?void 0:o,id:l,props:i[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let a=Pt(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;otypeof o=="number"?new Se(a,o):o),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,r,n){let i=new _n(this,e,r,n);for(let s of this.wrappers)i=s(i,e,r,n);return i}getGoto(e,r,n=!1){let i=this.goto;if(r>=i[0])return-1;for(let s=i[r+1];;){let a=i[s++],o=a&1,l=i[s++];if(o&&n)return l;for(let O=s+(a>>1);s0}validAction(e,r){return!!this.allActions(e,n=>n==r?!0:null)}allActions(e,r){let n=this.stateSlot(e,4),i=n?r(n):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=pe(this.data,s+2);else break;i=r(pe(this.data,s+1))}return i}nextStates(e){let r=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=pe(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];r.some((s,a)=>a&1&&s==i)||r.push(this.data[n],i)}}return r}configure(e){let r=Object.assign(Object.create(t.prototype),this);if(e.props&&(r.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);r.top=n}return e.tokenizers&&(r.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(o=>o.from==n.external);if(!s)return n;let a=Object.assign(Object.assign({},n),{external:s.to});return r.specializers[i]=xa(a),a})),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),e.bufferLength!=null&&(r.bufferLength=e.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let r=this.dynamicPrecedences;return r==null?0:r[e]||0}parseDialect(e){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(e)for(let s of e.split(" ")){let a=r.indexOf(s);a>=0&&(n[a]=!0)}let i=null;for(let s=0;sn)&&r.p.parser.stateFlag(r.state,2)&&(!e||e.scoret.external(r,n)<<1|e}return t.get}var BO=55,NO=1,FO=56,HO=2,KO=57,JO=3,ya=4,ec=5,Ln=6,Ca=7,Ya=8,za=9,qa=10,tc=11,rc=12,nc=13,Yn=58,ic=14,sc=15,Za=59,Aa=21,ac=23,La=24,oc=25,qn=27,Ea=28,lc=29,Oc=32,cc=35,hc=37,uc=38,pc=0,fc=1,dc={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},mc={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Xa={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function gc(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}var va=null,Ta=null,Ra=0;function An(t,e){let r=t.pos+e;if(Ra==r&&Ta==t)return va;let n=t.peek(e),i="";for(;gc(n);)i+=String.fromCharCode(n),n=t.peek(++e);return Ta=t,Ra=r,va=i?i.toLowerCase():n==Qc||n==$c?void 0:null}var Wa=60,or=62,En=47,Qc=63,$c=33,bc=45;function ja(t,e){this.name=t,this.parent=e}var Sc=[Ln,qa,Ca,Ya,za],kc=new tt({start:null,shift(t,e,r,n){return Sc.indexOf(e)>-1?new ja(An(n,1)||"",t):t},reduce(t,e){return e==Aa&&t?t.parent:t},reuse(t,e,r,n){let i=e.type.id;return i==Ln||i==hc?new ja(An(n,1)||"",t):t},strict:!1}),Pc=new z((t,e)=>{if(t.next!=Wa){t.next<0&&e.context&&t.acceptToken(Yn);return}t.advance();let r=t.next==En;r&&t.advance();let n=An(t,0);if(n===void 0)return;if(!n)return t.acceptToken(r?sc:ic);let i=e.context?e.context.name:null;if(r){if(n==i)return t.acceptToken(tc);if(i&&mc[i])return t.acceptToken(Yn,-2);if(e.dialectEnabled(pc))return t.acceptToken(rc);for(let s=e.context;s;s=s.parent)if(s.name==n)return;t.acceptToken(nc)}else{if(n=="script")return t.acceptToken(Ca);if(n=="style")return t.acceptToken(Ya);if(n=="textarea")return t.acceptToken(za);if(dc.hasOwnProperty(n))return t.acceptToken(qa);i&&Xa[i]&&Xa[i][n]?t.acceptToken(Yn,-1):t.acceptToken(Ln)}},{contextual:!0}),xc=new z(t=>{for(let e=0,r=0;;r++){if(t.next<0){r&&t.acceptToken(Za);break}if(t.next==bc)e++;else if(t.next==or&&e>=2){r>=3&&t.acceptToken(Za,-2);break}else e=0;t.advance()}});function wc(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}var yc=new z((t,e)=>{if(t.next==En&&t.peek(1)==or){let r=e.dialectEnabled(fc)||wc(e.context);t.acceptToken(r?ec:ya,2)}else t.next==or&&t.acceptToken(ya,1)});function Wn(t,e,r){let n=2+t.length;return new z(i=>{for(let s=0,a=0,o=0;;o++){if(i.next<0){o&&i.acceptToken(e);break}if(s==0&&i.next==Wa||s==1&&i.next==En||s>=2&&sa?i.acceptToken(e,-a):i.acceptToken(r,-(a-2));break}else if((i.next==10||i.next==13)&&o){i.acceptToken(e,1);break}else s=a=0;i.advance()}})}var Zc=Wn("script",BO,NO),Xc=Wn("style",FO,HO),vc=Wn("textarea",KO,JO),Tc=Oe({"Text RawText IncompleteTag IncompleteCloseTag":f.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":f.angleBracket,TagName:f.tagName,"MismatchedCloseTag/TagName":[f.tagName,f.invalid],AttributeName:f.attributeName,"AttributeValue UnquotedAttributeValue":f.attributeValue,Is:f.definitionOperator,"EntityReference CharacterReference":f.character,Comment:f.blockComment,ProcessingInst:f.processingInstruction,DoctypeDecl:f.documentMeta}),Ma=Pe.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#t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^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:kc,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[Tc],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?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&s.length){let c=o.node,h=c.firstChild,p=h&&_a(h,l),u;if(p){for(let d of s)if(d.tag==p&&(!d.attrs||d.attrs(u||(u=Ua(h,l))))){let m=c.lastChild,g=m.type.id==uc?m.from:c.to;if(g>h.to)return{parser:d.parser,overlay:[{from:h.to,to:g}]}}}}if(a&&O==La){let c=o.node,h;if(h=c.firstChild){let p=a[l.read(h.from,h.to)];if(p)for(let u of p){if(u.tagName&&u.tagName!=_a(c.parent,l))continue;let d=c.lastChild;if(d.type.id==qn){let m=d.from+1,g=d.lastChild,b=d.to-(g&&g.isError?0:1);if(b>m)return{parser:u.parser,overlay:[{from:m,to:b}],bracketed:!0}}else if(d.type.id==Ea)return{parser:u.parser,overlay:[{from:d.from,to:d.to}]}}}}return null})}var Rc=148,Va=1,jc=149,_c=150,Da=2,Cc=151,Yc=3,zc=4,qc=152,Ba=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Ac=58,Lc=40,Na=95,Ec=91,lr=45,Wc=46,Mc=35,Uc=37,Vc=38,Gc=92,Ic=10,Dc=42;function xt(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Un(t){return t>=48&&t<=57}function Ga(t){return Un(t)||t>=97&&t<=102||t>=65&&t<=70}var Fa=(t,e,r)=>(n,i)=>{for(let s=!1,a=0,o=0;;o++){let{next:l}=n;if(xt(l)||l==lr||l==Na||s&&Un(l))!s&&(l!=lr||o>0)&&(s=!0),a===o&&l==lr&&a++,n.advance();else if(l==Gc&&n.peek(1)!=Ic){if(n.advance(),Ga(n.next)){do n.advance();while(Ga(n.next));n.next==32&&n.advance()}else n.next>-1&&n.advance();s=!0}else{s&&n.acceptToken(a>=2&&i.canShift(Da)?e:l==Lc?r:t);break}}},Bc=new z(Fa(jc,Da,_c),{contextual:!0}),Nc=new z(Fa(Cc,Yc,zc),{contextual:!0}),Fc=new z(t=>{if(Ba.includes(t.peek(-1))){let{next:e}=t;(xt(e)||e==Na||e==Mc||e==Wc||e==Dc||e==Ec||e==Ac&&xt(t.peek(1))||e==lr||e==Vc)&&t.acceptToken(Rc)}}),Hc=new z(t=>{if(!Ba.includes(t.peek(-1))){let{next:e}=t;if(e==Uc&&(t.advance(),t.acceptToken(Va)),xt(e)){do t.advance();while(xt(t.next)||Un(t.next));t.acceptToken(Va)}}});function Ia(t){let e=t.length;return(e==4||e==5||e==7||e==9)&&/^#[a-f\d]+$/i.test(t)?qc:-1}var Kc=Oe({"AtKeyword import charset namespace keyframes media supports font-feature-values":f.definitionKeyword,"from to selector scope MatchFlag":f.keyword,NamespaceName:f.namespace,KeyframeName:f.labelName,KeyframeRangeName:f.operatorKeyword,TagName:f.tagName,ClassName:f.className,PseudoClassName:f.constant(f.className),IdName:f.labelName,"FeatureName PropertyName":f.propertyName,AttributeName:f.attributeName,NumberLiteral:f.number,KeywordQuery:f.keyword,UnaryQueryOp:f.operatorKeyword,"CallTag ValueName FontName":f.atom,VariableName:f.variableName,Callee:f.operatorKeyword,Unit:f.unit,"UniversalSelector NestingSelector":f.definitionOperator,"MatchOp CompareOp":f.compareOperator,"ChildOp SiblingOp, LogicOp":f.logicOperator,BinOp:f.arithmeticOperator,Important:f.modifier,Comment:f.blockComment,ColorLiteral:f.color,"ParenthesizedContent StringLiteral":f.string,":":f.punctuation,PseudoOp:f.derefOperator,"; , |":f.separator,"( )":f.paren,"[ ]":f.squareBracket,"{ }":f.brace}),Jc={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:88,url:158,"url-prefix":158,domain:158,regexp:158},eh={__proto__:null,or:102,and:102,not:112,only:112,layer:212},th={__proto__:null,selector:118,style:124,layer:208},rh={__proto__:null,"@import":204,"@media":216,"@charset":220,"@namespace":224,"@keyframes":230,"@supports":242,"@scope":246,"@font-feature-values":252},nh={__proto__:null,to:249},Ha=Pe.deserialize({version:14,states:"MrQYQdOOO$TQdOOP$[O`OOO%XQaO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gDq#g;'S%j;'S;=`%{<%lO%jbDvU!r`Oy%jz#h%j#h#iEY#i;'S%j;'S;=`%{<%lO%jbE_U!r`Oy%jz#T%j#T#UEq#U;'S%j;'S;=`%{<%lO%jbEvU!r`Oy%jz#b%j#b#cFY#c;'S%j;'S;=`%{<%lO%jbF_U!r`Oy%jz#h%j#h#iFq#i;'S%j;'S;=`%{<%lO%jbFxS$tQ!r`Oy%jz;'S%j;'S;=`%{<%lO%jjGZSrYOy%jz;'S%j;'S;=`%{<%lO%jfGlU$gUOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%jjHTSqYOy%jz;'S%j;'S;=`%{<%lO%jfHfU#SQOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%j`H{P;=`<%l%Z",tokenizers:[Fc,Hc,Bc,Nc,1,2,3,4,new ke("m~RRYZ[z{a~~g~aO$c~~dP!P!Qg~lO$d~~",28,156)],topRules:{StyleSheet:[0,6],Styles:[1,129]},dynamicPrecedences:{97:1},specialized:[{term:172,get:(t,e)=>Ia(t)<<1,external:Ia},{term:150,get:t=>Jc[t]||-1},{term:151,get:t=>eh[t]||-1},{term:4,get:t=>th[t]||-1},{term:28,get:t=>rh[t]||-1},{term:149,get:t=>nh[t]||-1}],tokenPrec:2433});var Vn=null;function Gn(){if(!Vn&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],r=new Set;for(let n in t)n!="cssText"&&n!="cssFloat"&&typeof t[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,i=>"-"+i.toLowerCase())),r.has(n)||(e.push(n),r.add(n)));Vn=e.sort().map(n=>({type:"property",label:n,apply:n+": "}))}return Vn||[]}var Ka=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),Ja=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),ih=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),sh=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(t=>({type:"keyword",label:t})),fe=/^(\w[\w-]*|-\w[\w-]*|)$/,ah=/^-(-[\w-]*)?$/;function oh(t,e){var r;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let n=(r=t.parent)===null||r===void 0?void 0:r.firstChild;return n?.name!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}var eo=new Wt,lh=["Declaration"];function Oh(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function to(t,e,r){if(e.to-e.from>4096){let n=eo.get(e);if(n)return n;let i=[],s=new Set,a=e.cursor(le.IncludeAnonymous);if(a.firstChild())do for(let o of to(t,a.node,r))s.has(o.label)||(s.add(o.label),i.push(o));while(a.nextSibling());return eo.set(e,i),i}else{let n=[],i=new Set;return e.cursor().iterate(s=>{var a;if(r(s)&&s.matchContext(lh)&&((a=s.node.nextSibling)===null||a===void 0?void 0:a.name)==":"){let o=t.sliceString(s.from,s.to);i.has(o)||(i.add(o),n.push({label:o,type:"variable"}))}}),n}}var ch=t=>e=>{let{state:r,pos:n}=e,i=R(r).resolveInner(n,-1),s=i.type.isError&&i.from==i.to-1&&r.doc.sliceString(i.from,i.to)=="-";if(i.name=="PropertyName"||(s||i.name=="TagName")&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:Gn(),validFor:fe};if(i.name=="ValueName")return{from:i.from,options:Ja,validFor:fe};if(i.name=="PseudoClassName")return{from:i.from,options:Ka,validFor:fe};if(t(i)||(e.explicit||s)&&oh(i,r.doc))return{from:t(i)||s?i.from:n,options:to(r.doc,Oh(i),t),validFor:ah};if(i.name=="TagName"){for(let{parent:l}=i;l;l=l.parent)if(l.name=="Block")return{from:i.from,options:Gn(),validFor:fe};return{from:i.from,options:ih,validFor:fe}}if(i.name=="AtKeyword")return{from:i.from,options:sh,validFor:fe};if(!e.explicit)return null;let a=i.resolve(n),o=a.childBefore(n);return o&&o.name==":"&&a.name=="PseudoClassSelector"?{from:n,options:Ka,validFor:fe}:o&&o.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:n,options:Ja,validFor:fe}:a.name=="Block"||a.name=="Styles"?{from:n,options:Gn(),validFor:fe}:null},hh=ch(t=>t.name=="VariableName"),wt=Ne.define({name:"css",parser:Ha.configure({props:[$e.add({Declaration:Fe()}),he.add({"Block KeyframeList":It})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function ro(){return new ce(wt,wt.data.of({autocomplete:hh}))}var uh=317,ph=318,no=1,fh=2,dh=3,mh=4,gh=319,Qh=321,$h=322,bh=5,Sh=6,kh=0,Dn=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],io=125,Ph=59,Bn=47,xh=42,wh=43,yh=45,Zh=60,Xh=44,vh=63,Th=46,Rh=91,jh=new tt({start:!1,shift(t,e){return e==bh||e==Sh||e==Qh?t:e==$h},strict:!1}),_h=new z((t,e)=>{let{next:r}=t;(r==io||r==-1||e.context)&&t.acceptToken(gh)},{contextual:!0,fallback:!0}),Ch=new z((t,e)=>{let{next:r}=t,n;Dn.indexOf(r)>-1||r==Bn&&((n=t.peek(1))==Bn||n==xh)||r!=io&&r!=Ph&&r!=-1&&!e.context&&t.acceptToken(uh)},{contextual:!0}),Yh=new z((t,e)=>{t.next==Rh&&!e.context&&t.acceptToken(ph)},{contextual:!0}),zh=new z((t,e)=>{let{next:r}=t;if(r==wh||r==yh){if(t.advance(),r==t.next){t.advance();let n=!e.context&&e.canShift(no);t.acceptToken(n?no:fh)}}else r==vh&&t.peek(1)==Th&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(dh))},{contextual:!0});function In(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}var qh=new z((t,e)=>{if(t.next!=Zh||!e.dialectEnabled(kh)||(t.advance(),t.next==Bn))return;let r=0;for(;Dn.indexOf(t.next)>-1;)t.advance(),r++;if(In(t.next,!0)){for(t.advance(),r++;In(t.next,!1);)t.advance(),r++;for(;Dn.indexOf(t.next)>-1;)t.advance(),r++;if(t.next==Xh)return;for(let n=0;;n++){if(n==7){if(!In(t.next,!0))return;break}if(t.next!="extends".charCodeAt(n))break;t.advance(),r++}}t.acceptToken(mh,-r)}),Ah=Oe({"get set async static":f.modifier,"for while do if else switch try catch finally return throw break continue default case defer":f.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":f.operatorKeyword,"let var const using function class extends":f.definitionKeyword,"import export from":f.moduleKeyword,"with debugger new":f.keyword,TemplateString:f.special(f.string),super:f.atom,BooleanLiteral:f.bool,this:f.self,null:f.null,Star:f.modifier,VariableName:f.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":f.function(f.variableName),VariableDefinition:f.definition(f.variableName),Label:f.labelName,PropertyName:f.propertyName,PrivatePropertyName:f.special(f.propertyName),"CallExpression/MemberExpression/PropertyName":f.function(f.propertyName),"FunctionDeclaration/VariableDefinition":f.function(f.definition(f.variableName)),"ClassDeclaration/VariableDefinition":f.definition(f.className),"NewExpression/VariableName":f.className,PropertyDefinition:f.definition(f.propertyName),PrivatePropertyDefinition:f.definition(f.special(f.propertyName)),UpdateOp:f.updateOperator,"LineComment Hashbang":f.lineComment,BlockComment:f.blockComment,Number:f.number,String:f.string,Escape:f.escape,ArithOp:f.arithmeticOperator,LogicOp:f.logicOperator,BitOp:f.bitwiseOperator,CompareOp:f.compareOperator,RegExp:f.regexp,Equals:f.definitionOperator,Arrow:f.function(f.punctuation),": Spread":f.punctuation,"( )":f.paren,"[ ]":f.squareBracket,"{ }":f.brace,"InterpolationStart InterpolationEnd":f.special(f.brace),".":f.derefOperator,", ;":f.separator,"@":f.meta,TypeName:f.typeName,TypeDefinition:f.definition(f.typeName),"type enum interface implements namespace module declare":f.definitionKeyword,"abstract global Privacy readonly override":f.modifier,"is keyof unique infer asserts":f.operatorKeyword,JSXAttributeValue:f.attributeValue,JSXText:f.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":f.angleBracket,"JSXIdentifier JSXNameSpacedName":f.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":f.attributeName,"JSXBuiltin/JSXIdentifier":f.standard(f.tagName)}),Lh={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:237,private:237,protected:237,readonly:239,instanceof:258,satisfies:261,import:294,keyof:351,unique:355,infer:361,asserts:397,is:399,abstract:419,implements:421,type:423,let:426,var:428,using:431,interface:437,enum:441,namespace:447,module:449,declare:453,global:457,defer:473,for:478,of:487,while:490,with:494,do:498,if:502,else:504,switch:508,case:514,try:520,catch:524,finally:528,return:532,throw:536,break:540,continue:544,debugger:548},Eh={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:403},Wh={__proto__:null,"<":193},so=Pe.deserialize({version:14,states:"$GSQ%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Im'#ImO1XQ`O'#GtO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JsO6[Q!0MxO'#JtO6uQ`O'#F^O6zQ,UO'#FuOOQ!0Lf'#Fg'#FgO7VO7dO'#FgO9XQMhO'#F}O9`Q`O'#F|OOQ!0Lf'#Jt'#JtOOQ!0Lb'#Js'#JsO9eQ`O'#GxOOQ['#K`'#K`O9pQ`O'#IZO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Q,y&wQ2[,uS2_,z2aR6n2^Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'r!uQ+b%lQ+n%zQ,S&XQ,j&mQ-R&|W-r'l't'u'xQ-y'pQ0Z*oQ1R+oQ1e,RS2Q,k,nQ2i-QQ2j-TQ2k-UQ3P-qW3R-t-u-x-zQ5c1SQ5o1aQ5s1gQ6X1wQ6c2SQ6m2]U6|3Q3T3WQ7P3UQ8_5dQ8g5qQ8i5tQ8n5|Q8w6YQ8}6bS9^6}7RQ9`7QQ:Y8eQ:d8xQ:i9OQ:p9_Q;W:ZQ;_:eQ;c:qQ;n;XR;q;`Q%zyQ'e!iQ'p!uU+o%{%|%}Q-X'VU-m'f'g'hS-q'l'vQ0S*kS1S+p+qQ2p-ZS2}-n-oQ3U-vS4r0T0WQ5d1TQ6x2wQ6{3OQ7Q3VU7}4t4u4xQ9|8PR;Q9}S$wi>QR*|%VU%Ui%V>QR0h*zQ$viS(v#v+kS)d$b$cQ)f$dQ*]$xS*f${*ZQ*u%OQ*v%QQ+R%^Q+S%_Q+W%cQ.nQQ>O>YQ>P>ZQ>[>^R>]>_Q+P%]Q.pTR#[WR'Z!el!tQ!r!v!y!z'a'm'n'o-g-w1q5}6PS'V!e-^U*k$|*[*pS-Z'W'`S0W*l*rQ0`*sQ2w-eQ4x0^R4}0aR(|#xQ!fQT-f'a-g]!qQ!r'a-g1q5}Q#p]R'j < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty VariableDefinition Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:381,context:jh,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,208,212,216,217,219,222,225,235,238,244,246,248,250,253,259,265,267,269,271,273,275,276,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,121,122,137,140,142,143,144,145,146,148,149,168,170,172,"Expression",-23,31,33,37,41,43,45,174,176,178,179,181,182,183,185,186,187,189,190,191,202,204,206,207,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",161,"JSXStartCloseTag"],["closedBy",-2,24,169,">",40,"InterpolationEnd",50,"]",61,"}",74,")",166,"JSXEndTag"]],propSources:[Ah],skippedNodes:[0,5,6,279],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$j&j(Xp([!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$j&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$j&j([!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU([!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;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Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$j&j(Xp([!b(O0/l$^#t(U,2j(f$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Ch,Yh,zh,qh,2,3,4,5,6,7,8,9,10,11,12,13,14,_h,new ke("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(d~~",141,341),new ke("j~RQYZXz{^~^O(R~~aP!P!Qd~iO(S~~",25,324)],topRules:{Script:[0,7],SingleExpression:[1,277],SingleClassItem:[2,278]},dialects:{jsx:0,ts:15179},dynamicPrecedences:{80:1,82:1,94:1,170:1,200:1},specialized:[{term:328,get:t=>Lh[t]||-1},{term:344,get:t=>Eh[t]||-1},{term:95,get:t=>Wh[t]||-1}],tokenPrec:15205});var Oo=[L("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),L("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),L("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),L("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),L("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),L(`try { +import{$ as I,A as je,Aa as Ja,B as j,Ba as el,C as Ne,D as _a,E as Ys,F as Ma,G as zs,H as Us,I as qa,Ia as tl,J as Ya,K as za,L as Ee,M as kt,N as Pn,O as Be,P as Qe,Q as xr,R as Qr,S as $r,T as Ua,U as He,V as x,W as Wa,X as kr,Y as Ws,Z as Ia,_ as en,a as Ea,aa as Da,b as Ms,ba as Fe,c as be,ca as Is,d as yn,da as yr,e as Ce,ea as ot,f as gr,fa as Va,g as U,ga as Ga,h as Kt,ha as tn,i as xe,ia as Na,j as Ye,ja as Ke,k as qs,ka as Sr,l as Ra,la as Ba,m as oe,ma as Ha,n as Sn,na as Fa,o as ue,p as ze,q as wn,r as Ca,s as ja,t as La,tc as nl,u as Jt,uc as rl,v as ye,w as fe,x as C,y as Aa,ya as Ka,z as br}from"./chunks/chunk-GJGDCSZU.js";import{a as wr}from"./chunks/chunk-TO3N6BD7.js";import"./chunks/chunk-Y6SLVHK3.js";var nn=class{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=I(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(fl(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}};function sl(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Nh(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Nh(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function hl(t,e){return n=>{for(let r=I(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}var vr=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function St(t){return t.selection.main.from}function fl(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}var ri=Ra.define();function Bh(t,e,n,r){let{main:s}=t.selection,i=n-s.from,o=r-s.from;return{...t.changeByRange(a=>{if(a!=s&&n!=r&&t.sliceDoc(a.from+i,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:U.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var il=new WeakMap;function Hh(t){if(!Array.isArray(t))return t;let e=il.get(t);return e||il.set(t,e=ni(t)),e}var Zr=oe.define(),Zn=oe.define(),Gs=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&k<=57||k>=97&&k<=122?2:k>=65&&k<=90?1:0:(w=yn(k))!=w.toLowerCase()?1:w!=w.toUpperCase()?2:0;(!g||P==1&&m||y==0&&P!=0)&&(n[u]==k||r[u]==k&&(h=!0)?o[u++]=g:o.length&&(b=!1)),y=P,g+=Ce(k)}return u==l&&o[0]==0&&b?this.result(-100+(h?-200:0),o,e):d==l&&p==0?this.ret(-200-e.length+(f==e.length?0:-100),[0,f]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):d==l?this.ret(-900-e.length,[p,f]):u==l?this.result(-100+(h?-200:0)+-700+(b?0:-1100),o,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?Ce(be(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(e-r.length,s)}},Ns=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Fh,filterStrict:!1,compareCompletions:(e,n)=>(e.sortText||e.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>ol(e(r),n(r)),optionClass:(e,n)=>r=>ol(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function ol(t,e){return t?e?t+" "+e:t:e}function Fh(t,e,n,r,s,i){let o=t.textDirection==Aa.RTL,a=o,l=!1,c="top",O,u,h=e.left-s.left,d=s.right-e.right,p=r.right-r.left,f=r.bottom-r.top;if(a&&h=f||g>e.top?O=n.bottom-e.top:(c="bottom",O=e.bottom-n.top)}let m=(e.bottom-e.top)/i.offsetHeight,b=(e.right-e.left)/i.offsetWidth;return{style:`${c}: ${O/m}px; max-width: ${u/b}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}var si=oe.define();function Kh(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;cl&&o.appendChild(document.createTextNode(a.slice(l,O)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(a.slice(O,u))),h.className="cm-completionMatchedText",l=u}return ln.position-r.position).map(n=>n.render)}function Ds(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.ceil((t-e)/n);return{from:t-r*n,to:t-(r-1)*n}}var Bs=class{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:o}=s.open,a=e.state.facet(le);this.optionContent=Kh(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Ds(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(n).open;for(let O=l.target,u;O&&O!=this.dom;O=O.parentNode)if(O.nodeName=="LI"&&(u=/-(\d+)$/.exec(O.id))&&+u[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;O!=null&&(e.dispatch({effects:si.of(O)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(le).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Zn.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=Ds(i.length,o,e.state.facet(le).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Ds(n.options.length,n.selected,this.view.state.facet(le).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>br(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&ef(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;or.from||r.from==0))if(i=h,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=h}}let O=s.appendChild(document.createElement("li"));O.id=n+"-"+o,O.setAttribute("role","option");let u=this.optionClass(a);u&&(O.className=u);for(let h of this.optionContent){let d=h(a,this.view.state,this.view,l);d&&O.appendChild(d)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew Bs(n,t,e)}function ef(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function al(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function tf(t,e){let n=[],r=null,s=null,i=O=>{n.push(O);let{section:u}=O.completion;if(u){r||(r=[]);let h=typeof u=="string"?u:u.name;r.some(d=>d.name==h)||r.push(typeof u=="string"?{name:h}:u)}},o=e.facet(le);for(let O of t)if(O.hasResult()){let u=O.result.getMatch;if(O.result.filter===!1)for(let h of O.result.options)i(new vr(h,O.source,u?u(h):[],1e9-n.length));else{let h=e.sliceDoc(O.from,O.to),d,p=o.filterStrict?new Ns(h):new Gs(h);for(let f of O.result.options)if(d=p.match(f.label)){let m=f.displayLabel?u?u(f,d.matched):[]:d.matched,b=d.score+(f.boost||0);if(i(new vr(f,O.source,m,b)),typeof f.section=="object"&&f.section.rank==="dynamic"){let{name:g}=f.section;s||(s=Object.create(null)),s[g]=Math.max(b,s[g]||-1e9)}}}}if(r){let O=Object.create(null),u=0,h=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameh.score-u.score||c(u.completion,h.completion))){let u=O.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?a.push(O):al(O.completion)>al(l)&&(a[a.length-1]=O),l=O.completion}return a}var Hs=class t{constructor(e,n,r,s,i,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new t(this.options,ll(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,o){if(s&&!o&&e.some(c=>c.isPending))return s.setDisabled();let a=tf(e,n);if(!a.length)return s&&e.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(le).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let O=0;OO.hasResult()?Math.min(c,O.from):c,1e8),create:lf,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new t(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new t(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},Fs=class t{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new t(of,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(le),i=(r.override||n.languageDataAt("autocomplete",St(n)).map(Hh)).map(l=>(this.active.find(O=>O.source==l)||new Je(l,this.active.some(O=>O.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=e.effects.some(l=>l.is(ii));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!nf(i,this.active)||a?o=Hs.build(i,n,this.id,o,r,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new Je(l.source,0):l));for(let l of e.effects)l.is(si)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new t(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?rf:sf}};function nf(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}var of=[];function dl(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(ri);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}var Je=class t{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=dl(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new t(s.source,0)),r&4&&s.state==0&&(s=new t(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(Zr))s=new t(s.source,1,i.value);else if(i.is(Zn))s=new t(s.source,0);else if(i.is(ii))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(St(e.state))}},Xr=class t extends Je{constructor(e,n,r,s,i,o){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=St(e.state);if(a>o||!s||n&2&&(St(e.startState)==this.from||an.map(e))}}),pe=xe.define({create(){return Fs.start()},update(t,e){return t.update(e)},provide:t=>[Ma.from(t,e=>e.tooltip),j.contentAttributes.from(t,e=>e.attrs)]});function oi(t,e){let n=e.completion.apply||e.completion.label,r=t.state.field(pe).active.find(s=>s.source==e.source);return r instanceof Xr?(typeof n=="string"?t.dispatch({...Bh(t.state,n,r.from,r.to),annotations:ri.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}var lf=Jh(pe,oi);function Pr(t,e="option"){return n=>{let r=n.state.field(pe,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:si.of(a)}),!0}}var cf=t=>{let e=t.state.field(pe,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(pe,!1)?(t.dispatch({effects:Zr.of(!0)}),!0):!1,ai=t=>{let e=t.state.field(pe,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:Zn.of(null)}),!0)},Ks=class{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}},Of=50,uf=1e3,hf=je.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(pe).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(pe),n=t.state.facet(le);if(!t.selectionSet&&!t.docChanged&&t.startState.field(pe)==e)return;let r=t.transactions.some(i=>{let o=dl(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;iOf&&Date.now()-o.time>uf){for(let a of o.context.abortListeners)try{a()}catch(l){br(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(Zr)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(pe);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(le).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=St(e),r=new nn(e,n,t.explicit,this.view),s=new Ks(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Zn.of(null)}),br(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(le).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(le),r=this.view.state.field(pe);for(let s=0;sa.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new Je(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:ii.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(pe,!1);if(e&&e.tooltip&&this.view.state.facet(le).closeOnBlur){let n=e.open&&zs(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Zn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Zr.of(!1)}),20),this.composing=0}}}),ff=typeof navigator=="object"&&/Win/.test(navigator.platform),df=Ye.highest(j.domEventHandlers({keydown(t,e){let n=e.state.field(pe,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||!t.key||t.key.length>1||t.ctrlKey&&!(ff&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&oi(e,r),!1}})),pl=j.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Js=class{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}},ei=class t{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,gr.TrackDel),r=e.mapPos(this.to,1,gr.TrackDel);return n==null||r==null?null:new t(this.field,n,r)}},ti=class t{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),o=/^\s*/.exec(i.text)[0];for(let l of this.lines){if(r.length){let c=o,O=/^\t*/.exec(l)[0].length;for(let u=0;unew ei(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],s=[],i;for(let o of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=i[1]?+i[1]:null,l=i[2]||i[3]||"",c=-1;a===0&&(a=1e9);let O=l.replace(/\\[{}]/g,u=>u[1]);for(let u=0;u=c&&h.field++}for(let u of s)if(u.line==r.length&&u.from>i.index){let h=i[2]?3+(i[1]||"").length:2;u.from-=h,u.to-=h}s.push(new Js(c,r.length,i.index,i.index+O.length)),o=o.slice(0,i.index)+l+o.slice(i.index+i[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let O of s)O.line==r.length&&O.from>c&&(O.from--,O.to--);return l}),r.push(o)}return new t(r,s)}},pf=C.widget({widget:new class extends fe{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),mf=C.mark({class:"cm-snippetField"}),rn=class t{constructor(e,n){this.ranges=e,this.active=n,this.deco=C.set(e.map(r=>(r.from==r.to?pf:mf).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new t(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}},En=oe.define({map(t,e){return t&&t.map(e)}}),gf=oe.define(),Xn=xe.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(En))return n.value;if(n.is(gf)&&t)return new rn(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>j.decorations.from(t,e=>e?e.deco:C.none)});function li(t,e){return U.create(t.filter(n=>n.field==e).map(n=>U.range(n.from,n.to)))}function bf(t){let e=ti.parse(t);return(n,r,s,i)=>{let{text:o,ranges:a}=e.instantiate(n.state,s),{main:l}=n.state.selection,c={changes:{from:s,to:i==l.from?l.to:i,insert:Ea.of(o)},scrollIntoView:!0,annotations:r?[ri.of(r),Sn.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=li(a,0)),a.some(O=>O.field>0)){let O=new rn(a,0),u=c.effects=[En.of(O)];n.state.field(Xn,!1)===void 0&&u.push(oe.appendConfig.of([Xn,yf,Sf,pl]))}n.dispatch(n.state.update(c))}}function ml(t){return({state:e,dispatch:n})=>{let r=e.field(Xn,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(o=>o.field==s+t);return n(e.update({selection:li(r.ranges,s),effects:En.of(i?null:new rn(r.ranges,s)),scrollIntoView:!0})),!0}}var xf=({state:t,dispatch:e})=>t.field(Xn,!1)?(e(t.update({effects:En.of(null)})),!0):!1,Qf=ml(1),$f=ml(-1);var kf=[{key:"Tab",run:Qf,shift:$f},{key:"Escape",run:xf}],cl=Kt.define({combine(t){return t.length?t[0]:kf}}),yf=Ye.highest(Ne.compute([cl],t=>t.facet(cl)));function me(t,e){return{...e,apply:bf(t)}}var Sf=j.domEventHandlers({mousedown(t,e){let n=e.state.field(Xn,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:li(n.ranges,s.field),effects:En.of(n.ranges.some(i=>i.field>s.field)?new rn(n.ranges,s.field):null),scrollIntoView:!0}),!0)}});var Tn={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},yt=oe.define({map(t,e){let n=e.mapPos(t,-1,gr.TrackAfter);return n??void 0}}),ci=new class extends Ca{};ci.startSide=1;ci.endSide=-1;var gl=xe.define({create(){return ja.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(yt)&&(t=t.update({add:[ci.range(n.value,n.value+1)]}));return t}});function bl(){return[Pf,gl]}var Vs="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function xl(t){for(let e=0;e{if((wf?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&Ce(be(r,0))==1||e!=s.from||n!=s.to)return!1;let i=Zf(t.state,r);return i?(t.dispatch(i),!0):!1}),vf=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Ql(t,t.selection.main.head).brackets||Tn.brackets,s=null,i=t.changeByRange(o=>{if(o.empty){let a=Xf(t.doc,o.head);for(let l of r)if(l==a&&Tr(t.doc,o.head)==xl(be(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:U.cursor(o.head-l.length)}}return{range:s=o}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},$l=[{key:"Backspace",run:vf}];function Zf(t,e){let n=Ql(t,t.selection.main.head),r=n.brackets||Tn.brackets;for(let s of r){let i=xl(be(s,0));if(e==s)return i==s?Rf(t,s,r.indexOf(s+s+s)>-1,n):Tf(t,s,i,n.before||Tn.before);if(e==i&&kl(t,t.selection.main.from))return Ef(t,s,i)}return null}function kl(t,e){let n=!1;return t.field(gl).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Tr(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Ce(be(n,0)))}function Xf(t,e){let n=t.sliceString(e-2,e);return Ce(be(n,0))==n.length?n:n.slice(1)}function Tf(t,e,n,r){let s=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:yt.of(o.to+e.length),range:U.range(o.anchor+e.length,o.head+e.length)};let a=Tr(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:yt.of(o.head+e.length),range:U.cursor(o.head+e.length)}:{range:s=o}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Ef(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&Tr(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:U.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Rf(t,e,n,r){let s=r.stringPrefixes||Tn.stringPrefixes,i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:yt.of(a.to+e.length),range:U.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Tr(t.doc,l),O;if(c==e){if(Ol(t,l))return{changes:{insert:e+e,from:l},effects:yt.of(l+e.length),range:U.cursor(l+e.length)};if(kl(t,l)){let h=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+h.length,insert:h},range:U.cursor(l+h.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(O=ul(t,l-2*e.length,s))>-1&&Ol(t,O))return{changes:{insert:e+e+e+e,from:l},effects:yt.of(l+e.length),range:U.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=ue.Word&&ul(t,l,s)>-1&&!Cf(t,l,e,s))return{changes:{insert:e+e,from:l},effects:yt.of(l+e.length),range:U.cursor(l+e.length)}}return{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ol(t,e){let n=I(t).resolveInner(e+1);return n.parent&&n.from==e}function Cf(t,e,n,r){let s=I(t).resolveInner(e,-1),i=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let O=s.firstChild;for(;O&&O.from==s.from&&O.to-O.from>n.length+l;){if(t.sliceDoc(O.to-n.length,O.to)==n)return!1;O=O.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function ul(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=ue.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=ue.Word)return i}return-1}function yl(t={}){return[df,pe,le.of(t),hf,jf,pl]}var Oi=[{key:"Ctrl-Space",run:vn},{mac:"Alt-`",run:vn},{mac:"Alt-i",run:vn},{key:"Escape",run:ai},{key:"ArrowDown",run:Pr(!0)},{key:"ArrowUp",run:Pr(!1)},{key:"PageDown",run:Pr(!0,"page")},{key:"PageUp",run:Pr(!1,"page")},{key:"Enter",run:cf}],jf=Ye.highest(Ne.computeN([le],t=>t.facet(le).defaultKeymap?[Oi]:[]));function Er(t){let e=t.field(pe,!1);return e&&e.active.some(n=>n.isPending)?"pending":e&&e.active.some(n=>n.state!=0)?"active":null}var jr=class t{static create(e,n,r,s,i){let o=s+(s<<8)+e+(n<<4)|0;return new t(e,n,r,o,i,[],[])}constructor(e,n,r,s,i,o,a){this.type=e,this.value=n,this.from=r,this.hash=s,this.end=i,this.children=o,this.positions=a,this.blankFirstLine=!1,this.hashProp=[[Ee.contextHash,s]]}addChild(e,n){e.prop(Ee.contextHash)!=this.hash&&(e=new Qe(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(n)}toTree(e,n=this.end){let r=this.children.length-1;return r>=0&&(n=Math.max(n,this.positions[r]+this.children[r].length+this.from)),new Qe(e.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(s,i,o)=>new Qe(kt.none,s,i,o,this.hashProp)})}},S;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(S||(S={}));var fi=class{constructor(e,n){this.start=e,this.content=n,this.marks=[],this.parsers=[]}},di=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return Cn(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,n=0,r=0){for(let s=n;s=e.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(t.type==S.OrderedList?Pi:wi)(n,e,!1);return r>0&&(t.type!=S.BulletList||Si(n,e,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==t.value}var Ll={[S.Blockquote](t,e,n){return n.next!=62?!1:(n.markers.push(D(S.QuoteMark,e.lineStart+n.pos,e.lineStart+n.pos+1)),n.moveBase(n.pos+(Se(n.text.charCodeAt(n.pos+1))?2:1)),t.end=e.lineStart+n.text.length,!0)},[S.ListItem](t,e,n){return(n.next<0?t.blankFirstLine&&t.children.length==1:n.indentn&&Se(t.charCodeAt(e-1));)e--;return e}function Al(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(Il.SetextHeading)>-1||r<3?-1:1}function Ml(t,e){for(let n=t.stack.length-1;n>=0;n--)if(t.stack[n].type==e)return!0;return!1}function wi(t,e,n){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||Se(t.text.charCodeAt(t.pos+1)))&&(!n||Ml(e,S.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){r++;if(r==t.text.length)return-1;s=t.text.charCodeAt(r)}return r==t.pos||r>t.pos+9||s!=46&&s!=41||rt.pos+1||t.next!=49)?-1:r+1-t.pos}function ql(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e6?-1:n}function Yl(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,Ul=/\?>/,mi=[[/^<(?:script|pre|style|textarea)(?:\s|>|$)/i,/<\/(?:script|pre|style|textarea)>/i],[/^\s*)/.exec(r);if(i)return t.append(D(S.Comment,n,n+1+i[0].length));let o=/^\?[^]*?\?>/.exec(r);if(o)return t.append(D(S.ProcessingInstruction,n,n+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/[a-zA-Z][\w-]*\s*>|[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>)/.exec(r);return a?t.append(D(S.HTMLTag,n,n+1+a[0].length)):-1},Emphasis(t,e,n){if(e!=95&&e!=42)return-1;let r=n+1;for(;t.char(r)==e;)r++;let s=t.slice(n-1,n),i=t.slice(r,r+1),o=An.test(s),a=An.test(i),l=/\s|^$/.test(s),c=/\s|^$/.test(i),O=!c&&(!a||l||o),u=!l&&(!o||c||a),h=O&&(e==42||!u||o),d=u&&(e==42||!O||a);return t.append(new ge(e==95?vi:Zi,n,r,(h?1:0)|(d?2:0)))},HardBreak(t,e,n){if(e==92&&t.char(n+1)==10)return t.append(D(S.HardBreak,n,n+2));if(e==32){let r=n+1;for(;t.char(r)==32;)r++;if(t.char(r)==10&&r>=n+2)return t.append(D(S.HardBreak,n,r+1))}return-1},Link(t,e,n){return e==91?t.append(new ge(wt,n,n+1,1)):-1},Image(t,e,n){return e==33&&t.char(n+1)==91?t.append(new ge(_r,n,n+2,1)):-1},LinkEnd(t,e,n){if(e!=93)return-1;for(let r=t.parts.length-1;r>=0;r--){let s=t.parts[r];if(s instanceof ge&&(s.type==wt||s.type==_r)){if(!s.side||t.skipSpace(s.to)==n&&!/[(\[]/.test(t.slice(n+1,n+2)))return t.parts[r]=null,-1;let i=t.takeContent(r),o=t.parts[r]=_f(t,i,s.type==wt?S.Link:S.Image,s.from,n+1);if(s.type==wt)for(let a=0;ae?D(S.URL,e+n,i+n):i==t.length?null:!1}}function Nl(t,e,n){let r=t.charCodeAt(e);if(r!=39&&r!=34&&r!=40)return!1;let s=r==40?41:r;for(let i=e+1,o=!1;i=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,n){return this.text.slice(e-this.offset,n-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,n,r,s,i){return this.append(new ge(e,n,r,(s?1:0)|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let n=this.parts[e];if(n instanceof ge&&(n.type==wt||n.type==_r))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let r=e;r=e;l--){let f=this.parts[l];if(f instanceof ge&&f.side&1&&f.type==s.type&&!(i&&(s.side&1||f.side&2)&&(f.size+s.size)%3==0&&(f.size%3||s.size%3))){a=f;break}}if(!a)continue;let c=s.type.resolve,O=[],u=a.from,h=s.to;if(i){let f=Math.min(2,a.to-a.from,o);u=a.to-f,h=s.from+f,c=f==1?"Emphasis":"StrongEmphasis"}a.type.mark&&O.push(this.elt(a.type.mark,u,a.to));for(let f=l+1;f=0;n--){let r=this.parts[n];if(r instanceof ge&&r.type==e&&r.side&1)return n}return null}takeContent(e){let n=this.resolveMarkers(e);return this.parts.length=e,n}getDelimiterAt(e){let n=this.parts[e];return n instanceof ge?n:null}skipSpace(e){return Cn(this.text,e-this.offset)+this.offset}elt(e,n,r,s){return typeof e=="string"?D(this.parser.getNodeType(e),n,r,s):new Ar(e,n)}};vt.linkStart=wt;vt.imageStart=_r;vt.emphasisAsterisk=Zi;vt.emphasisUnderscore=vi;function $i(t,e){if(!e.length)return t;if(!t.length)return e;let n=t.slice(),r=0;for(let s of e){for(;r(e?e-1:0))return!1;if(this.fragmentEnd<0){let i=this.fragment.to;for(;i>0&&this.input.read(i-1,i)!=` +`;)i--;this.fragmentEnd=i?i-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(Be.IncludeAnonymous|Be.IgnoreMounts),r.firstChild());let s=e+this.fragment.offset;for(;r.to<=s;)if(!r.parent())return!1;for(;;){if(r.from>=s)return this.fragment.from<=n;if(!r.childAfter(s))return!1}}matches(e){let n=this.cursor.tree;for(;n&&n.type.isAnonymous&&n.children[0]instanceof Qe;)n=n.children[0];return n&&n.prop(Ee.contextHash)==e}takeNodes(e){let n=this.cursor,r=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,o=i,a=e.block.children.length,l=e.lineStart-e.block.from>>2,c=o,O=a;e:for(;;){if(n.to-r>Math.min(s,e.to)||n.type.isAnonymous&&n.tree&&(n.to-n.from>l||!Mf(n.tree))){if(n.type.isAnonymous&&n.firstChild())continue;break}let u=Fl(n.from-r,e.ranges);if(n.to-r<=e.ranges[e.rangeI].to)e.addNode(n.tree,u);else{let h=new Qe(e.parser.nodeSet.types[S.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,n.tree),e.addNode(h,u)}for((n.type.isAnonymous||n.type.is("Block"))&&(n.type.isAnonymous||Hl.indexOf(n.type.id)<0?(o=n.to-r,a=e.block.children.length):(o=c,a=O),c=n.to-r,O=e.block.children.length);;){if(n.nextSibling())continue e;if(!n.parent()||!n.type.isAnonymous)break e}}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-i}};function Mf(t){for(;t.type.isAnonymous;){let e=t.children[t.children.length-1];if(e instanceof Qe)t=e;else return!1}return t.type.is("Block")&&Hl.indexOf(t.type.id)<0}function Fl(t,e){let n=t;for(let r=1;rRr[t]),Object.keys(Rr).map(t=>Il[t]),Object.keys(Rr),Lf,Ll,Object.keys(hi).map(t=>hi[t]),Object.keys(hi),[]);function Yf(t,e,n){let r=[];for(let s=t.firstChild,i=e;;s=s.nextSibling){let o=s?s.from:n;if(o>i&&r.push({from:i,to:o}),!s)break;i=s.to}return r}function Jl(t){let{codeParser:e,htmlParser:n}=t;return{wrap:$r((s,i)=>{let o=s.type.id;if(e&&(o==S.CodeBlock||o==S.FencedCode)){let a="";if(o==S.FencedCode){let c=s.node.getChild(S.CodeInfo);c&&(a=i.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==S.CodeText,bracketed:o==S.FencedCode}}else if(n&&(o==S.HTMLBlock||o==S.HTMLTag||o==S.CommentBlock))return{parser:n,overlay:Yf(s.node,s.from,s.to)};return null})}}var zf={resolve:"Strikethrough",mark:"StrikethroughMark"},Uf={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":x.strikethrough}},{name:"StrikethroughMark",style:x.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,n){if(e!=126||t.char(n+1)!=126||t.char(n+2)==126)return-1;let r=t.slice(n-1,n),s=t.slice(n+2,n+3),i=/\s|^$/.test(r),o=/\s|^$/.test(s),a=An.test(r),l=An.test(s);return t.addDelimiter(zf,n,n+2,!o&&(!l||i||a),!i&&(!a||o||l))},after:"Emphasis"}]};function jn(t,e,n=0,r,s=0){let i=0,o=!0,a=-1,l=-1,c=!1,O=()=>{r.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=n;u-1)&&i++,o=!1,r&&(a>-1&&O(),r.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1):(c||h!=32&&h!=9)&&(a<0&&(a=u),l=u+1),c=!c&&h==92}return a>-1&&(i++,r&&O()),i}function Zl(t,e){for(let n=e;n\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Mr=class{constructor(){this.rows=null}nextLine(e,n,r){if(this.rows==null){this.rows=!1;let s;if((n.next==45||n.next==58||n.next==124)&&ec.test(s=n.text.slice(n.pos))){let i=[];jn(e,r.content,0,i,r.start)==jn(e,s,0)&&(this.rows=[e.elt("TableHeader",r.start,r.start+r.content.length,i),e.elt("TableDelimiter",e.lineStart+n.pos,e.lineStart+n.text.length)])}}else if(this.rows){let s=[];jn(e,n.text,n.pos,s,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+n.pos,e.lineStart+n.text.length,s))}return!1}finish(e,n){return this.rows?(e.addLeafElement(n,e.elt("Table",n.start,n.start+n.content.length,this.rows)),!0):!1}},Wf={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":x.heading}},"TableRow",{name:"TableCell",style:x.content},{name:"TableDelimiter",style:x.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return Zl(e.content,0)?new Mr:null},endLeaf(t,e,n){if(n.parsers.some(s=>s instanceof Mr)||!Zl(e.text,e.basePos))return!1;let r=t.peekLine();return ec.test(r)&&jn(t,e.text,e.basePos)==jn(t,r,e.basePos)},before:"SetextHeading"}]},yi=class{nextLine(){return!1}finish(e,n){return e.addLeafElement(n,e.elt("Task",n.start,n.start+n.content.length,[e.elt("TaskMarker",n.start,n.start+3),...e.parser.parseInline(n.content.slice(3),n.start+3)])),!0}},If={defineNodes:[{name:"Task",block:!0,style:x.list},{name:"TaskMarker",style:x.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new yi:null},after:"SetextHeading"}]},Xl=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Tl=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,Df=/[\w-]+\.[\w-]+($|[/:])/,El=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Rl=/\/[a-zA-Z\d@.]+/gy;function Cl(t,e,n,r){let s=0;for(let i=e;i-1)return-1;let r=e+n[0].length;for(;;){let s=t[r-1],i;if(/[?!.,:*_~]/.test(s)||s==")"&&Cl(t,e,r,")")>Cl(t,e,r,"("))r--;else if(s==";"&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,r))))r=e+i.index;else break}return r}function jl(t,e){El.lastIndex=e;let n=El.exec(t);if(!n)return-1;let r=n[0][n[0].length-1];return r=="_"||r=="-"?-1:e+n[0].length-(r=="."?1:0)}var Gf={parseInline:[{name:"Autolink",parse(t,e,n){let r=n-t.offset;if(r&&/\w/.test(t.text[r-1]))return-1;Xl.lastIndex=r;let s=Xl.exec(t.text),i=-1;if(!s)return-1;if(s[1]||s[2]){if(i=Vf(t.text,r+s[0].length),i>-1&&t.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(r,i));i=r+o[0].length}}else s[3]?i=jl(t.text,r):(i=jl(t.text,r+s[0].length),i>-1&&s[0]=="xmpp:"&&(Rl.lastIndex=i,s=Rl.exec(t.text),s&&(i=s.index+s[0].length)));return i<0?-1:(t.addElement(t.elt("URL",n,i+t.offset)),i+t.offset)}}]},tc=[Wf,If,Uf,Gf];function nc(t,e,n){return(r,s,i)=>{if(s!=t||r.char(i+1)==t)return-1;let o=[r.elt(n,i,i+1)];for(let a=i+1;an%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new t(e,[],n,r,r,0,[],0,s?new qr(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,o=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=O):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(s,c)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(n==r)return;if(this.buffer[o-2]>=n){this.buffer[o-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:o}=this.p;this.pos=s;let a=o.stateFlag(i,1);!a&&(s>r||n<=o.maxNode)&&(this.reducePos=s),this.pushState(i,a?r:Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n,r){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=e)&&(this.p.reused.push(e),s++);let i=this.reducePos=this.pos=r+e.length;this.pushState(n,r),this.buffer.push(s,r,i,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(n&&e.buffer[n-4]==0&&(n-=4);n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Ri(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,o;il&1&&a==o)||s.push(n[i],o)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-i;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,i+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n0&&this.emitLookAhead()}},qr=class{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}},Ri=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}},Ci=class t{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new t(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new t(this.stack,this.pos,this.index)}};function _n(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}n?n[s++]=i:n=new e(i)}return n}var on=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},oc=new on,ji=class{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=oc,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];i+=o.from-r.to,r=o}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&ra.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=oc,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}},lt=class{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;uc(this.data,e,n,this.id,r.data,r.tokenPrecTable)}};lt.prototype.contextual=lt.prototype.fallback=lt.prototype.extend=!1;var ct=class{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?_n(e):e}token(e,n){let r=e.pos,s=0;for(;;){let i=e.next<0,o=e.resolveOffset(1,1);if(uc(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(i||s++,o==null)break;e.reset(o,e.token)}s&&(e.reset(r,e.token),e.acceptToken(this.elseToken,s))}};ct.prototype.contextual=lt.prototype.fallback=lt.prototype.extend=!1;var ce=class{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}};function uc(t,e,n,r,s,i){let o=0,a=1<0){let p=t[d];if(l.allows(p)&&(e.token.value==-1||e.token.value==p||Bf(p,e.token.value,s,i))){e.acceptToken(p);break}}let O=e.next,u=0,h=t[o+2];if(e.next<0&&h>u&&t[c+h*3-3]==65535){o=t[c+h*3-1];continue e}for(;u>1,p=c+d+(d<<1),f=t[p],m=t[p+1]||65536;if(O=m)u=d+1;else{o=t[p+2],e.advance();continue e}}break}}function ac(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function Bf(t,e,n,r){let s=ac(n,r,e);return s<0||ac(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}var Li=class{constructor(e,n){this.fragments=e,this.minRepeat=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?lc(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?lc(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(i instanceof Qe){let a=o>this.lastRepeatPos&&i.type.id>=this.minRepeat;if(o==e||a){let l=o+i.length,c;if(o>=this.safeFrom&&l<=this.safeTo&&(!(c=i.prop(Ee.lookAhead))||l+c=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+i.length}}},Ai=class{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new on)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,o=s.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;cu.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let h=n;if(u.extended>-1&&(n=this.addActions(e,u.extended,u.end,n)),n=this.addActions(e,u.value,u.end,n),!O.extend&&(r=u,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new on,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new on,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new Li(r,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;on)r.push(a);else{if(this.advanceStack(a,r,e))continue;{s||(s=[],i=[]),s.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!r.length){let o=s&&Hf(s);if(o)return we&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw we&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(o)return we&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&(r.sort((o,a)=>a.score-o.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let o=1;o-1&&r.length&&(!i||(r.prop(Ee.contextHash)||0)==o))return e.useNode(r,a,n),r;if(r.children.length==0||r.positions[0]>0)break;let l=r.children[0];if(l instanceof Qe&&(!s||l.type.id>=this.parser.minRepeatTerm))r=l;else break}return null}advanceStack(e,n,r){let s=e.pos,{parser:i}=this,o=we?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.reducePos0)return e.reduce(a),we&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;cs?n.push(p):r.push(p)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return cc(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let o=0;o ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),we&&console.log(O+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let u=a.split(),h=O;for(let d=0;d<10&&u.forceReduce()&&(we&&console.log(h+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));d++)we&&(h=this.stackID(u)+" -> ");for(let d of a.recoverByInsert(l))we&&console.log(O+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),we&&console.log(O+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),cc(a,r)):(!s||s.scoret,an=class{constructor(e){this.start=e.start,this.shift=e.shift||Ti,this.reduce=e.reduce||Ti,this.reuse=e.reuse||Ti,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},Ot=class t extends Qr{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;ae.topRules[a][1]),s=[];for(let a=0;a=0)i(O,l,a[c++]);else{let u=a[c+-O];for(let h=-O;h>0;h--)i(a[c++],l,u);c++}}}this.nodeSet=new Pn(n.map((a,l)=>kt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let o=_n(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new lt(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new _i(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let o=s[i++],a=o&1,l=s[i++];if(a&&r)return l;for(let c=i+(o>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=et(this.data,i+2);else break;s=n(et(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=et(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,o)=>o&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(t.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(a=>a.from==r.external);if(!i)return r;let o=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=Oc(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let o=n.indexOf(i);o>=0&&(r[o]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}var Ff=55,Kf=1,Jf=56,ed=2,td=57,nd=3,hc=4,rd=5,Wi=6,Qc=7,$c=8,kc=9,yc=10,sd=11,id=12,od=13,qi=58,ad=14,ld=15,fc=59,Sc=21,cd=23,wc=24,Od=25,zi=27,Pc=28,ud=29,hd=32,fd=35,dd=37,pd=38,md=0,gd=1,bd={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},xd={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},dc={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Qd(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}var pc=null,mc=null,gc=0;function Ui(t,e){let n=t.pos+e;if(gc==n&&mc==t)return pc;let r=t.peek(e),s="";for(;Qd(r);)s+=String.fromCharCode(r),r=t.peek(++e);return mc=t,gc=n,pc=s?s.toLowerCase():r==$d||r==kd?void 0:null}var vc=60,Yr=62,Ii=47,$d=63,kd=33,yd=45;function bc(t,e){this.name=t,this.parent=e}var Sd=[Wi,yc,Qc,$c,kc],wd=new an({start:null,shift(t,e,n,r){return Sd.indexOf(e)>-1?new bc(Ui(r,1)||"",t):t},reduce(t,e){return e==Sc&&t?t.parent:t},reuse(t,e,n,r){let s=e.type.id;return s==Wi||s==dd?new bc(Ui(r,1)||"",t):t},strict:!1}),Pd=new ce((t,e)=>{if(t.next!=vc){t.next<0&&e.context&&t.acceptToken(qi);return}t.advance();let n=t.next==Ii;n&&t.advance();let r=Ui(t,0);if(r===void 0)return;if(!r)return t.acceptToken(n?ld:ad);let s=e.context?e.context.name:null;if(n){if(r==s)return t.acceptToken(sd);if(s&&xd[s])return t.acceptToken(qi,-2);if(e.dialectEnabled(md))return t.acceptToken(id);for(let i=e.context;i;i=i.parent)if(i.name==r)return;t.acceptToken(od)}else{if(r=="script")return t.acceptToken(Qc);if(r=="style")return t.acceptToken($c);if(r=="textarea")return t.acceptToken(kc);if(bd.hasOwnProperty(r))return t.acceptToken(yc);s&&dc[s]&&dc[s][r]?t.acceptToken(qi,-1):t.acceptToken(Wi)}},{contextual:!0}),vd=new ce(t=>{for(let e=0,n=0;;n++){if(t.next<0){n&&t.acceptToken(fc);break}if(t.next==yd)e++;else if(t.next==Yr&&e>=2){n>=3&&t.acceptToken(fc,-2);break}else e=0;t.advance()}});function Zd(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}var Xd=new ce((t,e)=>{if(t.next==Ii&&t.peek(1)==Yr){let n=e.dialectEnabled(gd)||Zd(e.context);t.acceptToken(n?rd:hc,2)}else t.next==Yr&&t.acceptToken(hc,1)});function Di(t,e,n){let r=2+t.length;return new ce(s=>{for(let i=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(i==0&&s.next==vc||i==1&&s.next==Ii||i>=2&&io?s.acceptToken(e,-o):s.acceptToken(n,-(o-2));break}else if((s.next==10||s.next==13)&&a){s.acceptToken(e,1);break}else i=o=0;s.advance()}})}var Td=Di("script",Ff,Kf),Ed=Di("style",Jf,ed),Rd=Di("textarea",td,nd),Cd=He({"Text RawText IncompleteTag IncompleteCloseTag":x.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":x.angleBracket,TagName:x.tagName,"MismatchedCloseTag/TagName":[x.tagName,x.invalid],AttributeName:x.attributeName,"AttributeValue UnquotedAttributeValue":x.attributeValue,Is:x.definitionOperator,"EntityReference CharacterReference":x.character,Comment:x.blockComment,ProcessingInst:x.processingInstruction,DoctypeDecl:x.documentMeta}),Zc=Ot.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#D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^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:wd,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[Cd],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!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(m>u.to)return{parser:p.parser,overlay:[{from:u.to,to:m}]}}}}if(o&&c==wc){let O=a.node,u;if(u=O.firstChild){let h=o[l.read(u.from,u.to)];if(h)for(let d of h){if(d.tagName&&d.tagName!=xc(O.parent,l))continue;let p=O.lastChild;if(p.type.id==zi){let f=p.from+1,m=p.lastChild,b=p.to-(m&&m.isError?0:1);if(b>f)return{parser:d.parser,overlay:[{from:f,to:b}],bracketed:!0}}else if(p.type.id==Pc)return{parser:d.parser,overlay:[{from:p.from,to:p.to}]}}}}return null})}var jd=148,Tc=1,Ld=149,Ad=150,Cc=2,_d=151,Md=3,qd=4,Yd=152,jc=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],zd=58,Ud=40,Lc=95,Wd=91,zr=45,Id=46,Dd=35,Vd=37,Gd=38,Nd=92,Bd=10,Hd=42;function Mn(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Gi(t){return t>=48&&t<=57}function Ec(t){return Gi(t)||t>=97&&t<=102||t>=65&&t<=70}var Ac=(t,e,n)=>(r,s)=>{for(let i=!1,o=0,a=0;;a++){let{next:l}=r;if(Mn(l)||l==zr||l==Lc||i&&Gi(l))!i&&(l!=zr||a>0)&&(i=!0),o===a&&l==zr&&o++,r.advance();else if(l==Nd&&r.peek(1)!=Bd){if(r.advance(),Ec(r.next)){do r.advance();while(Ec(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();i=!0}else{i&&r.acceptToken(o>=2&&s.canShift(Cc)?e:l==Ud?n:t);break}}},Fd=new ce(Ac(Ld,Cc,Ad),{contextual:!0}),Kd=new ce(Ac(_d,Md,qd),{contextual:!0}),Jd=new ce(t=>{if(jc.includes(t.peek(-1))){let{next:e}=t;(Mn(e)||e==Lc||e==Dd||e==Id||e==Hd||e==Wd||e==zd&&Mn(t.peek(1))||e==zr||e==Gd)&&t.acceptToken(jd)}}),ep=new ce(t=>{if(!jc.includes(t.peek(-1))){let{next:e}=t;if(e==Vd&&(t.advance(),t.acceptToken(Tc)),Mn(e)){do t.advance();while(Mn(t.next)||Gi(t.next));t.acceptToken(Tc)}}});function Rc(t){let e=t.length;return(e==4||e==5||e==7||e==9)&&/^#[a-f\d]+$/i.test(t)?Yd:-1}var tp=He({"AtKeyword import charset namespace keyframes media supports font-feature-values":x.definitionKeyword,"from to selector scope MatchFlag":x.keyword,NamespaceName:x.namespace,KeyframeName:x.labelName,KeyframeRangeName:x.operatorKeyword,TagName:x.tagName,ClassName:x.className,PseudoClassName:x.constant(x.className),IdName:x.labelName,"FeatureName PropertyName":x.propertyName,AttributeName:x.attributeName,NumberLiteral:x.number,KeywordQuery:x.keyword,UnaryQueryOp:x.operatorKeyword,"CallTag ValueName FontName":x.atom,VariableName:x.variableName,Callee:x.operatorKeyword,Unit:x.unit,"UniversalSelector NestingSelector":x.definitionOperator,"MatchOp CompareOp":x.compareOperator,"ChildOp SiblingOp, LogicOp":x.logicOperator,BinOp:x.arithmeticOperator,Important:x.modifier,Comment:x.blockComment,ColorLiteral:x.color,"ParenthesizedContent StringLiteral":x.string,":":x.punctuation,PseudoOp:x.derefOperator,"; , |":x.separator,"( )":x.paren,"[ ]":x.squareBracket,"{ }":x.brace}),np={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:88,url:158,"url-prefix":158,domain:158,regexp:158},rp={__proto__:null,or:102,and:102,not:112,only:112,layer:212},sp={__proto__:null,selector:118,style:124,layer:208},ip={__proto__:null,"@import":204,"@media":216,"@charset":220,"@namespace":224,"@keyframes":230,"@supports":242,"@scope":246,"@font-feature-values":252},op={__proto__:null,to:249},_c=Ot.deserialize({version:14,states:"MrQYQdOOO$TQdOOP$[O`OOO%XQaO'#CfOOQP'#Ce'#CeO%`QdO'#CgO%eQ`O'#CgO%jQaO'#FrO&eQdO'#CkO'XQaO'#CcO'cQdO'#CnOOQP'#ES'#ESOOQP'#ER'#ERO'n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{<%lO%jbEvU!r`Oy%jz#b%j#b#cFY#c;'S%j;'S;=`%{<%lO%jbF_U!r`Oy%jz#h%j#h#iFq#i;'S%j;'S;=`%{<%lO%jbFxS$tQ!r`Oy%jz;'S%j;'S;=`%{<%lO%jjGZSrYOy%jz;'S%j;'S;=`%{<%lO%jfGlU$gUOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%jjHTSqYOy%jz;'S%j;'S;=`%{<%lO%jfHfU#SQOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%j`H{P;=`<%l%Z",tokenizers:[Jd,ep,Fd,Kd,1,2,3,4,new ct("m~RRYZ[z{a~~g~aO$c~~dP!P!Qg~lO$d~~",28,156)],topRules:{StyleSheet:[0,6],Styles:[1,129]},dynamicPrecedences:{97:1},specialized:[{term:172,get:(t,e)=>Rc(t)<<1,external:Rc},{term:150,get:t=>np[t]||-1},{term:151,get:t=>rp[t]||-1},{term:4,get:t=>sp[t]||-1},{term:28,get:t=>ip[t]||-1},{term:149,get:t=>op[t]||-1}],tokenPrec:2433});var Ni=null;function Bi(){if(!Ni&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],n=new Set;for(let r in t)r!="cssText"&&r!="cssFloat"&&typeof t[r]=="string"&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())),n.has(r)||(e.push(r),n.add(r)));Ni=e.sort().map(r=>({type:"property",label:r,apply:r+": "}))}return Ni||[]}var Mc=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),qc=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),ap=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),lp=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(t=>({type:"keyword",label:t})),tt=/^(\w[\w-]*|-\w[\w-]*|)$/,cp=/^-(-[\w-]*)?$/;function Op(t,e){var n;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let r=(n=t.parent)===null||n===void 0?void 0:n.firstChild;return r?.name!="Callee"?!1:e.sliceString(r.from,r.to)=="var"}var Yc=new xr,up=["Declaration"];function hp(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function zc(t,e,n){if(e.to-e.from>4096){let r=Yc.get(e);if(r)return r;let s=[],i=new Set,o=e.cursor(Be.IncludeAnonymous);if(o.firstChild())do for(let a of zc(t,o.node,n))i.has(a.label)||(i.add(a.label),s.push(a));while(o.nextSibling());return Yc.set(e,s),s}else{let r=[],s=new Set;return e.cursor().iterate(i=>{var o;if(n(i)&&i.matchContext(up)&&((o=i.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=t.sliceString(i.from,i.to);s.has(a)||(s.add(a),r.push({label:a,type:"variable"}))}}),r}}var fp=t=>e=>{let{state:n,pos:r}=e,s=I(n).resolveInner(r,-1),i=s.type.isError&&s.from==s.to-1&&n.doc.sliceString(s.from,s.to)=="-";if(s.name=="PropertyName"||(i||s.name=="TagName")&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:Bi(),validFor:tt};if(s.name=="ValueName")return{from:s.from,options:qc,validFor:tt};if(s.name=="PseudoClassName")return{from:s.from,options:Mc,validFor:tt};if(t(s)||(e.explicit||i)&&Op(s,n.doc))return{from:t(s)||i?s.from:r,options:zc(n.doc,hp(s),t),validFor:cp};if(s.name=="TagName"){for(let{parent:l}=s;l;l=l.parent)if(l.name=="Block")return{from:s.from,options:Bi(),validFor:tt};return{from:s.from,options:ap,validFor:tt}}if(s.name=="AtKeyword")return{from:s.from,options:lp,validFor:tt};if(!e.explicit)return null;let o=s.resolve(r),a=o.childBefore(r);return a&&a.name==":"&&o.name=="PseudoClassSelector"?{from:r,options:Mc,validFor:tt}:a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:r,options:qc,validFor:tt}:o.name=="Block"||o.name=="Styles"?{from:r,options:Bi(),validFor:tt}:null},dp=fp(t=>t.name=="VariableName"),qn=en.define({name:"css",parser:_c.configure({props:[ot.add({Declaration:tn()}),Ke.add({"Block KeyframeList":Sr})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Uc(){return new Fe(qn,qn.data.of({autocomplete:dp}))}var pp=317,mp=318,Wc=1,gp=2,bp=3,xp=4,Qp=319,$p=321,kp=322,yp=5,Sp=6,wp=0,Fi=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Ic=125,Pp=59,Ki=47,vp=42,Zp=43,Xp=45,Tp=60,Ep=44,Rp=63,Cp=46,jp=91,Lp=new an({start:!1,shift(t,e){return e==yp||e==Sp||e==$p?t:e==kp},strict:!1}),Ap=new ce((t,e)=>{let{next:n}=t;(n==Ic||n==-1||e.context)&&t.acceptToken(Qp)},{contextual:!0,fallback:!0}),_p=new ce((t,e)=>{let{next:n}=t,r;Fi.indexOf(n)>-1||n==Ki&&((r=t.peek(1))==Ki||r==vp)||n!=Ic&&n!=Pp&&n!=-1&&!e.context&&t.acceptToken(pp)},{contextual:!0}),Mp=new ce((t,e)=>{t.next==jp&&!e.context&&t.acceptToken(mp)},{contextual:!0}),qp=new ce((t,e)=>{let{next:n}=t;if(n==Zp||n==Xp){if(t.advance(),n==t.next){t.advance();let r=!e.context&&e.canShift(Wc);t.acceptToken(r?Wc:gp)}}else n==Rp&&t.peek(1)==Cp&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(bp))},{contextual:!0});function Hi(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}var Yp=new ce((t,e)=>{if(t.next!=Tp||!e.dialectEnabled(wp)||(t.advance(),t.next==Ki))return;let n=0;for(;Fi.indexOf(t.next)>-1;)t.advance(),n++;if(Hi(t.next,!0)){for(t.advance(),n++;Hi(t.next,!1);)t.advance(),n++;for(;Fi.indexOf(t.next)>-1;)t.advance(),n++;if(t.next==Ep)return;for(let r=0;;r++){if(r==7){if(!Hi(t.next,!0))return;break}if(t.next!="extends".charCodeAt(r))break;t.advance(),n++}}t.acceptToken(xp,-n)}),zp=He({"get set async static":x.modifier,"for while do if else switch try catch finally return throw break continue default case defer":x.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":x.operatorKeyword,"let var const using function class extends":x.definitionKeyword,"import export from":x.moduleKeyword,"with debugger new":x.keyword,TemplateString:x.special(x.string),super:x.atom,BooleanLiteral:x.bool,this:x.self,null:x.null,Star:x.modifier,VariableName:x.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":x.function(x.variableName),VariableDefinition:x.definition(x.variableName),Label:x.labelName,PropertyName:x.propertyName,PrivatePropertyName:x.special(x.propertyName),"CallExpression/MemberExpression/PropertyName":x.function(x.propertyName),"FunctionDeclaration/VariableDefinition":x.function(x.definition(x.variableName)),"ClassDeclaration/VariableDefinition":x.definition(x.className),"NewExpression/VariableName":x.className,PropertyDefinition:x.definition(x.propertyName),PrivatePropertyDefinition:x.definition(x.special(x.propertyName)),UpdateOp:x.updateOperator,"LineComment Hashbang":x.lineComment,BlockComment:x.blockComment,Number:x.number,String:x.string,Escape:x.escape,ArithOp:x.arithmeticOperator,LogicOp:x.logicOperator,BitOp:x.bitwiseOperator,CompareOp:x.compareOperator,RegExp:x.regexp,Equals:x.definitionOperator,Arrow:x.function(x.punctuation),": Spread":x.punctuation,"( )":x.paren,"[ ]":x.squareBracket,"{ }":x.brace,"InterpolationStart InterpolationEnd":x.special(x.brace),".":x.derefOperator,", ;":x.separator,"@":x.meta,TypeName:x.typeName,TypeDefinition:x.definition(x.typeName),"type enum interface implements namespace module declare":x.definitionKeyword,"abstract global Privacy readonly override":x.modifier,"is keyof unique infer asserts":x.operatorKeyword,JSXAttributeValue:x.attributeValue,JSXText:x.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":x.angleBracket,"JSXIdentifier JSXNameSpacedName":x.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":x.attributeName,"JSXBuiltin/JSXIdentifier":x.standard(x.tagName)}),Up={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:237,private:237,protected:237,readonly:239,instanceof:258,satisfies:261,import:294,keyof:351,unique:355,infer:361,asserts:397,is:399,abstract:419,implements:421,type:423,let:426,var:428,using:431,interface:437,enum:441,namespace:447,module:449,declare:453,global:457,defer:473,for:478,of:487,while:490,with:494,do:498,if:502,else:504,switch:508,case:514,try:520,catch:524,finally:528,return:532,throw:536,break:540,continue:544,debugger:548},Wp={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:403},Ip={__proto__:null,"<":193},Dc=Ot.deserialize({version:14,states:"$GSQ%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Im'#ImO1XQ`O'#GtO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JsO6[Q!0MxO'#JtO6uQ`O'#F^O6zQ,UO'#FuOOQ!0Lf'#Fg'#FgO7VO7dO'#FgO9XQMhO'#F}O9`Q`O'#F|OOQ!0Lf'#Jt'#JtOOQ!0Lb'#Js'#JsO9eQ`O'#GxOOQ['#K`'#K`O9pQ`O'#IZO9uQ!0LrO'#I[OOQ['#Ja'#JaOOQ['#I`'#I`Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO: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,j&mQ-R&|W-r'l't'u'xQ-y'pQ0Z*oQ1R+oQ1e,RS2Q,k,nQ2i-QQ2j-TQ2k-UQ3P-qW3R-t-u-x-zQ5c1SQ5o1aQ5s1gQ6X1wQ6c2SQ6m2]U6|3Q3T3WQ7P3UQ8_5dQ8g5qQ8i5tQ8n5|Q8w6YQ8}6bS9^6}7RQ9`7QQ:Y8eQ:d8xQ:i9OQ:p9_Q;W:ZQ;_:eQ;c:qQ;n;XR;q;`Q%zyQ'e!iQ'p!uU+o%{%|%}Q-X'VU-m'f'g'hS-q'l'vQ0S*kS1S+p+qQ2p-ZS2}-n-oQ3U-vS4r0T0WQ5d1TQ6x2wQ6{3OQ7Q3VU7}4t4u4xQ9|8PR;Q9}S$wi>QR*|%VU%Ui%V>QR0h*zQ$viS(v#v+kS)d$b$cQ)f$dQ*]$xS*f${*ZQ*u%OQ*v%QQ+R%^Q+S%_Q+W%cQ.nQQ>O>YQ>P>ZQ>[>^R>]>_Q+P%]Q.pTR#[WR'Z!el!tQ!r!v!y!z'a'm'n'o-g-w1q5}6PS'V!e-^U*k$|*[*pS-Z'W'`S0W*l*rQ0`*sQ2w-eQ4x0^R4}0aR(|#xQ!fQT-f'a-g]!qQ!r'a-g1q5}Q#p]R'j < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty VariableDefinition Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:381,context:Lp,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,208,212,216,217,219,222,225,235,238,244,246,248,250,253,259,265,267,269,271,273,275,276,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,121,122,137,140,142,143,144,145,146,148,149,168,170,172,"Expression",-23,31,33,37,41,43,45,174,176,178,179,181,182,183,185,186,187,189,190,191,202,204,206,207,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",161,"JSXStartCloseTag"],["closedBy",-2,24,169,">",40,"InterpolationEnd",50,"]",61,"}",74,")",166,"JSXEndTag"]],propSources:[zp],skippedNodes:[0,5,6,279],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$j&j(Xp([!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$j&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$j&j([!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU([!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$j&j(XpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(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_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$j&j(Xp([!b(O0/l$^#t(U,2j(f$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[_p,Mp,qp,Yp,2,3,4,5,6,7,8,9,10,11,12,13,14,Ap,new ct("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(d~~",141,341),new ct("j~RQYZXz{^~^O(R~~aP!P!Qd~iO(S~~",25,324)],topRules:{Script:[0,7],SingleExpression:[1,277],SingleClassItem:[2,278]},dialects:{jsx:0,ts:15179},dynamicPrecedences:{80:1,82:1,94:1,170:1,200:1},specialized:[{term:328,get:t=>Up[t]||-1},{term:344,get:t=>Wp[t]||-1},{term:95,get:t=>Ip[t]||-1}],tokenPrec:15205});var Bc=[me("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),me("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),me("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),me("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),me("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),me(`try { \${} } catch (\${error}) { \${} -}`,{label:"try",detail:"/ catch block",type:"keyword"}),L("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),L(`if (\${}) { +}`,{label:"try",detail:"/ catch block",type:"keyword"}),me("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),me(`if (\${}) { \${} } else { \${} -}`,{label:"if",detail:"/ else block",type:"keyword"}),L(`class \${name} { +}`,{label:"if",detail:"/ else block",type:"keyword"}),me(`class \${name} { constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),L('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),L('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Mh=Oo.concat([L("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),L("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),L("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),ao=new Wt,co=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function yt(t){return(e,r)=>{let n=e.node.getChild("VariableDefinition");return n&&r(n,t),!0}}var Uh=["FunctionDeclaration"],Vh={FunctionDeclaration:yt("function"),ClassDeclaration:yt("class"),ClassExpression:()=>!0,EnumDeclaration:yt("constant"),TypeAliasDeclaration:yt("type"),NamespaceDeclaration:yt("namespace"),VariableDefinition(t,e){t.matchContext(Uh)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function ho(t,e){let r=ao.get(e);if(r)return r;let n=[],i=!0;function s(a,o){let l=t.sliceString(a.from,a.to);n.push({label:l,type:o})}return e.cursor(le.IncludeAnonymous).iterate(a=>{if(i)i=!1;else if(a.name){let o=Vh[a.name];if(o&&o(a,s)||co.has(a.name))return!1}else if(a.to-a.from>8192){for(let o of ho(t,a.node))n.push(o);return!1}}),ao.set(e,n),n}var oo=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,uo=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Gh(t){let e=R(t.state).resolveInner(t.pos,-1);if(uo.indexOf(e.name)>-1)return null;let r=e.name=="VariableName"||e.to-e.from<20&&oo.test(t.state.sliceDoc(e.from,e.to));if(!r&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)co.has(i.name)&&(n=n.concat(ho(t.state.doc,i)));return{options:n,from:r?e.from:t.pos,validFor:oo}}var te=Ne.define({name:"javascript",parser:so.configure({props:[$e.add({IfStatement:Fe({except:/^\s*({|else\b)/}),TryStatement:Fe({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Os,SwitchBody:t=>{let e=t.textAfter,r=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(r?0:n?1:2)*t.unit},Block:ls({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":Fe({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),he.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":It,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let r=t.lastChild;return{from:e.to,to:r.type.isError?t.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let r=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,n=t.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?t.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),po={test:t=>/^JSX/.test(t.name),facet:Vt({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Nn=te.configure({dialect:"ts"},"typescript"),Fn=te.configure({dialect:"jsx",props:[Ar.add(t=>t.isTop?[po]:void 0)]}),Hn=te.configure({dialect:"jsx ts",props:[Ar.add(t=>t.isTop?[po]:void 0)]},"typescript"),fo=t=>({label:t,type:"keyword"}),mo="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(fo),Ih=mo.concat(["declare","implements","private","protected","public"].map(fo));function go(t={}){let e=t.jsx?t.typescript?Hn:Fn:t.typescript?Nn:te,r=t.typescript?Mh.concat(Ih):Oo.concat(mo);return new ce(e,[te.data.of({autocomplete:ys(uo,Kr(r))}),te.data.of({autocomplete:Gh}),t.jsx?Nh:[]])}function Dh(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function lo(t,e,r=t.length){for(let n=e?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return t.sliceString(n.from,Math.min(n.to,r));return""}var Bh=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Nh=X.inputHandler.of((t,e,r,n,i)=>{if((Bh?t.composing:t.compositionStarted)||t.state.readOnly||e!=r||n!=">"&&n!="/"||!te.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:a}=s,o=a.changeByRange(l=>{var O;let{head:c}=l,h=R(a).resolveInner(c-1,-1),p;if(h.name=="JSXStartTag"&&(h=h.parent),!(a.doc.sliceString(c-1,c)!=n||h.name=="JSXAttributeValue"&&h.to>c)){if(n==">"&&h.name=="JSXFragmentTag")return{range:l,changes:{from:c,insert:""}};if(n=="/"&&h.name=="JSXStartCloseTag"){let u=h.parent,d=u.parent;if(d&&u.from==c-2&&((p=lo(a.doc,d.firstChild,c))||((O=d.firstChild)===null||O===void 0?void 0:O.name)=="JSXFragmentTag")){let m=`${p}>`;return{range:Z.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(n==">"){let u=Dh(h);if(u&&u.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(a.doc.sliceString(c,c+2))&&(p=lo(a.doc,u,c)))return{range:l,changes:{from:c,insert:``}}}}return{range:l}});return o.changes.empty?!1:(t.dispatch([s,a.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var Zt=["_blank","_self","_top","_parent"],Kn=["ascii","utf-8","utf-16","latin1","latin1"],Jn=["get","post","put","delete"],ei=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],N=["true","false"],S={},Fh={a:{attrs:{href:null,ping:null,type:null,media:null,target:Zt,hreflang:null}},abbr:S,address:S,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:S,aside:S,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:S,base:{attrs:{href:null,target:Zt}},bdi:S,bdo:S,blockquote:{attrs:{cite:null}},body:S,br:S,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:ei,formmethod:Jn,formnovalidate:["novalidate"],formtarget:Zt,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:S,center:S,cite:S,code:S,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:S,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:S,div:S,dl:S,dt:S,em:S,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:S,figure:S,footer:S,form:{attrs:{action:null,name:null,"accept-charset":Kn,autocomplete:["on","off"],enctype:ei,method:Jn,novalidate:["novalidate"],target:Zt}},h1:S,h2:S,h3:S,h4:S,h5:S,h6:S,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:S,hgroup:S,hr:S,html:{attrs:{manifest:null}},i:S,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:ei,formmethod:Jn,formnovalidate:["novalidate"],formtarget:Zt,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:S,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:S,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:S,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Kn,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:S,noscript:S,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:S,param:{attrs:{name:null,value:null}},pre:S,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:S,rt:S,ruby:S,samp:S,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Kn}},section:S,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:S,source:{attrs:{src:null,type:null,media:null}},span:S,strong:S,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:S,summary:S,sup:S,table:S,tbody:S,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:S,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:S,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:S,time:{attrs:{datetime:null}},title:S,tr:S,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:S,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:S},So={accesskey:null,class:null,contenteditable:N,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:N,autocorrect:N,autocapitalize:N,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":N,"aria-autocomplete":["inline","list","both","none"],"aria-busy":N,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":N,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":N,"aria-hidden":N,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":N,"aria-multiselectable":N,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":N,"aria-relevant":null,"aria-required":N,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},ko="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(t=>"on"+t);for(let t of ko)So[t]=null;var qe=class{constructor(e,r){this.tags={...Fh,...e},this.globalAttrs={...So,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};qe.default=new qe;function Ae(t,e,r=t.length){if(!e)return"";let n=e.firstChild,i=n&&n.getChild("TagName");return i?t.sliceString(i.from,Math.min(i.to,r)):""}function rt(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function Po(t,e,r){let n=r.tags[Ae(t,rt(e))];return n?.children||r.allTags}function ti(t,e){let r=[];for(let n=rt(e);n&&!n.type.isTop;n=rt(n.parent)){let i=Ae(t,n);if(i&&n.lastChild.name=="CloseTag")break;i&&r.indexOf(i)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&r.push(i)}return r}var xo=/^[:\-\.\w\u00b7-\uffff]*$/;function Qo(t,e,r,n,i){let s=/\s*>/.test(t.sliceDoc(i,i+5))?"":">",a=rt(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:i,options:Po(t.doc,a,e).map(o=>({label:o,type:"type"})).concat(ti(t.doc,r).map((o,l)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function $o(t,e,r,n){let i=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:ti(t.doc,e).map((s,a)=>({label:s,apply:s+i,type:"type",boost:99-a})),validFor:xo}}function Hh(t,e,r,n){let i=[],s=0;for(let a of Po(t.doc,r,e))i.push({label:"<"+a,type:"type"});for(let a of ti(t.doc,r))i.push({label:"",type:"type",boost:99-s++});return{from:n,to:n,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Kh(t,e,r,n,i){let s=rt(r),a=s?e.tags[Ae(t.doc,s)]:null,o=a&&a.attrs?Object.keys(a.attrs):[],l=a&&a.globalAttrs===!1?o:o.length?o.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:i,options:l.map(O=>({label:O,type:"property"})),validFor:xo}}function Jh(t,e,r,n,i){var s;let a=(s=r.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),o=[],l;if(a){let O=t.sliceDoc(a.from,a.to),c=e.globalAttrs[O];if(!c){let h=rt(r),p=h?e.tags[Ae(t.doc,h)]:null;c=p?.attrs&&p.attrs[O]}if(c){let h=t.sliceDoc(n,i).toLowerCase(),p='"',u='"';/^['"]/.test(h)?(l=h[0]=='"'?/^[^"]*$/:/^[^']*$/,p="",u=t.sliceDoc(i,i+1)==h[0]?"":h[0],h=h.slice(1),n++):l=/^[^\s<>='"]*$/;for(let d of c)o.push({label:d,apply:p+d+u,type:"constant"})}}return{from:n,to:i,options:o,validFor:l}}function wo(t,e){let{state:r,pos:n}=e,i=R(r).resolveInner(n,-1),s=i.resolve(n);for(let a=n,o;s==i&&(o=i.childBefore(a));){let l=o.lastChild;if(!l||!l.type.isError||l.fromwo(n,i)}var tu=te.parser.configure({top:"SingleExpression"}),Zo=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:Nn.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:Fn.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:Hn.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:tu},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:te.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:wt.parser}],Xo=[{name:"style",parser:wt.parser.configure({top:"Styles"})}].concat(ko.map(t=>({name:t,parser:te.parser}))),vo=Ne.define({name:"html",parser:Ma.configure({props:[$e.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Or=vo.configure({wrap:Mn(Zo,Xo)});function To(t={}){let e="",r;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(r=Mn((t.nestedLanguages||[]).concat(Zo),(t.nestedAttributes||[]).concat(Xo)));let n=r?vo.configure({wrap:r,dialect:e}):e?Or.configure({dialect:e}):Or;return new ce(n,[Or.data.of({autocomplete:eu(t)}),t.autoCloseTags!==!1?nu:[],go().support,ro().support])}var bo=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function ru(t,e,r){for(var n;;){if(((n=e.lastChild)===null||n===void 0?void 0:n.name)!="CloseTag")return!1;let i=e.parent;if(!i||Ae(t,i)!=r)return!0;e=i}}var nu=X.inputHandler.of((t,e,r,n,i)=>{if(t.composing||t.state.readOnly||e!=r||n!=">"&&n!="/"||!Or.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:a}=s,o=a.changeByRange(l=>{var O;let c=a.doc.sliceString(l.from-1,l.to)==n,{head:h}=l,p=R(a).resolveInner(h,-1),u;if(c&&n==">"&&p.name=="EndTag"){let d=p.parent;if((u=Ae(a.doc,d.parent,h))&&!bo.has(u)&&!ru(a.doc,d.parent,u)){let m=h+(a.doc.sliceString(h,h+1)===">"?1:0),g=``;return{range:l,changes:{from:h,to:m,insert:g}}}}else if(c&&n=="/"&&p.name=="IncompleteCloseTag"){let d=p.parent;if(p.from==h-2&&((O=d.lastChild)===null||O===void 0?void 0:O.name)!="CloseTag"&&(u=Ae(a.doc,d,h))&&!bo.has(u)){let m=h+(a.doc.sliceString(h,h+1)===">"?1:0),g=`${u}>`;return{range:Z.cursor(h+g.length,-1),changes:{from:h,to:m,insert:g}}}}return{range:l}});return o.changes.empty?!1:(t.dispatch([s,a.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var _o=Vt({commentTokens:{block:{open:""}}}),Co=new K,Yo=ua.configure({props:[he.add(t=>!t.is("Block")||t.is("Document")||ii(t)!=null||iu(t)?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),Co.add(ii),$e.add({Document:()=>null}),ss.add({Document:_o})]});function ii(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function iu(t){return t.name=="OrderedList"||t.name=="BulletList"}function su(t,e){let r=t;for(;;){let n=r.nextSibling,i;if(!n||(i=ii(n.type))!=null&&i<=e)break;r=n}return r.to}var au=cs.of((t,e,r)=>{for(let n=R(t).resolveInner(r,-1);n&&!(n.fromr)return{from:r,to:s}}return null});function si(t){return new as(_o,t,[],"markdown")}var ou=si(Yo),lu=Yo.configure([da,Qa,ga,$a,{props:[he.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),nt=si(lu);function Ou(t,e){return r=>{if(r&&t){let n=null;if(r=/\S*/.exec(r)[0],typeof t=="function"?n=t(r):n=Lr.matchLanguageName(t,r,!0),n instanceof Lr)return n.support?n.support.language.parser:os.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}var Xt=class{constructor(e,r,n,i,s,a,o){this.node=e,this.from=r,this.to=n,this.spaceBefore=i,this.spaceAfter=s,this.type=a,this.item=o}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;i--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+qo(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}};function zo(t,e){let r=[],n=[];for(let i=t;i;i=i.parent){if(i.name=="FencedCode")return n;(i.name=="ListItem"||i.name=="Blockquote")&&r.push(i)}for(let i=r.length-1;i>=0;i--){let s=r[i],a,o=e.lineAt(s.from),l=s.from-o.from;if(s.name=="Blockquote"&&(a=/^ *>( ?)/.exec(o.text.slice(l))))n.push(new Xt(s,l,l+a[0].length,"",a[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(l)))){let O=a[3],c=a[0].length;O.length>=4&&(O=O.slice(0,O.length-4),c-=4),n.push(new Xt(s.parent,l,l+c,a[1],O,a[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(l)))){let O=a[4],c=a[0].length;O.length>4&&(O=O.slice(0,O.length-4),c-=4);let h=a[2];a[3]&&(h+=a[3].replace(/[xX]/," ")),n.push(new Xt(s.parent,l,l+c,a[1],O,h,s))}}return n}function qo(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function ri(t,e,r,n=0){for(let i=-1,s=t;;){if(s.name=="ListItem"){let o=qo(s,e),l=+o[2];if(i>=0){if(l!=i+1)return;r.push({from:s.from+o[1].length,to:s.from+o[0].length,insert:String(i+2+n)})}i=l}let a=s.nextSibling;if(!a)break;s=a}}function ai(t,e){let r=/^[ \t]*/.exec(t)[0].length;if(!r||e.facet(Gt)!=" ")return t;let n=Be(t,4,r),i="";for(let s=n;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+t.slice(r)}var cu=(t={})=>({state:e,dispatch:r})=>{let n=R(e),{doc:i}=e,s=null,a=e.changeByRange(o=>{if(!o.empty||!nt.isActiveAt(e,o.from,-1)&&!nt.isActiveAt(e,o.from,1))return s={range:o};let l=o.from,O=i.lineAt(l),c=zo(n.resolveInner(l,-1),i);for(;c.length&&c[c.length-1].from>l-O.from;)c.pop();if(!c.length)return s={range:o};let h=c[c.length-1];if(h.to-h.spaceAfter.length>l-O.from)return s={range:o};let p=l>=h.to-h.spaceAfter.length&&!/\S/.test(O.text.slice(h.to));if(h.item&&p){if(h.item.from]*$/.test(O.text.slice(0,h.to)))return s={range:o};let b=h.node.firstChild,Q=h.node.getChild("ListItem","ListItem");if(b.to>=l||Q&&Q.to0&&!/[^\s>]/.test(i.lineAt(O.from-1).text)||t.nonTightLists===!1){let k=c.length>1?c[c.length-2]:null,y,w="";k&&k.item?(y=O.from+k.from,w=k.marker(i,1)):y=O.from+(k?k.to:0);let _=[{from:y,to:l,insert:w}];return h.node.name=="OrderedList"&&ri(h.item,i,_,-2),k&&k.node.name=="OrderedList"&&ri(k.item,i,_),{range:Z.cursor(y+w.length),changes:_}}else{let k=jo(c,e,O);return{range:Z.cursor(l+k.length+1),changes:{from:O.from,insert:k+e.lineBreak}}}}if(h.node.name=="Blockquote"&&p&&O.from){let b=i.lineAt(O.from-1),Q=/>\s*$/.exec(b.text);if(Q&&Q.index==h.from){let k=e.changes([{from:b.from+Q.index,to:b.to},{from:O.from+h.from,to:O.to}]);return{range:o.map(k),changes:k}}}let u=[];h.node.name=="OrderedList"&&ri(h.item,i,u);let d=h.item&&h.item.from]*/.exec(O.text)[0].length>=h.to)for(let b=0,Q=c.length-1;b<=Q;b++)m+=b==Q&&!d?c[b].marker(i,1):c[b].blank(bO.from&&/\s/.test(O.text.charAt(g-O.from-1));)g--;return m=ai(m,e),uu(h.node,e.doc)&&(m=jo(c,e,O)+e.lineBreak+m),u.push({from:g,to:l,insert:e.lineBreak+m}),{range:Z.cursor(g+m.length+1),changes:u}});return s?!1:(r(e.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)},hu=cu();function Ro(t){return t.name=="QuoteMark"||t.name=="ListMark"}function uu(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let r=t.firstChild,n=t.getChild("ListItem","ListItem");if(!n)return!1;let i=e.lineAt(r.to),s=e.lineAt(n.from),a=/^[\s>]*$/.test(i.text);return i.number+(a?0:1){let r=R(t),n=null,i=t.changeByRange(s=>{let a=s.from,{doc:o}=t;if(s.empty&&nt.isActiveAt(t,s.from)){let l=o.lineAt(a),O=zo(pu(r,a),o);if(O.length){let c=O[O.length-1],h=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(a-l.from>h&&!/\S/.test(l.text.slice(h,a-l.from)))return{range:Z.cursor(l.from+h),changes:{from:l.from+h,to:a}};if(a-l.from==h&&(c.item&&l.from<=c.item.from||/^[\s>]*$/.test(l.text.slice(0,c.to)))){let p=l.from+c.from;if(c.item&&c.node.from{var r;let{main:n}=e.state.selection;if(n.empty)return!1;let i=(r=t.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(i)||(/^www\./.test(i)&&(i="https://"+i),!nt.isActiveAt(e.state,n.from,1)))return!1;let s=R(e.state),a=!1;return s.iterate({from:n.from,to:n.to,enter:o=>{(o.from>n.from||Qu.test(o.name))&&(a=!0)},leave:o=>{o.tot.normalize("NFKD"):t=>t,we=class{constructor(e,r,n=0,i=e.length,s,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?o=>s(Eo(o)):Eo,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return W(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=ht(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=J(e);let i=this.normalize(r);if(i.length)for(let s=0,a=n,o=!0;;s++){let l=i.charCodeAt(s),O=this.match(l,a,o,this.bufferPos+this.bufferStart,s==i.length-1);if(O)return this.value=O,this;if(s==i.length-1)break;o&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,i=n+r[0].length;if(this.matchPos=dr(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,precise:!0,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||i.to<=r){let o=new t(r,e.sliceString(r,n));return oi.set(e,o),o}if(i.from==r&&i.to==n)return i;let{text:s,from:a}=i;return a>r&&(s=e.sliceString(r,a)+s,a=r),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,i=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,precise:!0,match:r},this.matchPos=dr(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=pr.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(ur.prototype[Symbol.iterator]=fr.prototype[Symbol.iterator]=function(){return this});function bu(t){try{return new RegExp(t,pi),!0}catch{return!1}}function dr(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e=56320&&n<57344;)e++;return e}var Su=t=>{let e=ns(t,"cm-goto-line");if(e){let a=e.dom.querySelector("input[type=text]");return a&&a.select(),!0}let{state:r}=t,n=String(r.doc.lineAt(t.state.selection.main.head).number),{close:i,result:s}=rs(t,{class:"cm-goto-line",label:r.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:r.phrase("go")});return s.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){t.dispatch({effects:i});return}let l=r.doc.lineAt(r.selection.main.head),[,O,c,h,p]=o,u=h?+h.slice(1):0,d=c?+c:l.number;if(c&&p){let b=d/100;O&&(b=b*(O=="-"?-1:1)+l.number/r.doc.lines),d=Math.round(r.doc.lines*b)}else c&&O&&(d=d*(O=="-"?-1:1)+l.number);let m=r.doc.line(Math.max(1,Math.min(r.doc.lines,d))),g=Z.cursor(m.from+Math.max(0,Math.min(u,m.length)));t.dispatch({effects:[i,X.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},ku={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Vo=De.define({combine(t){return ut(t,ku,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function Go(t){let e=[Zu,yu];return t&&e.push(Vo.of(t)),e}var Pu=v.mark({class:"cm-selectionMatch"}),xu=v.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Wo(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=A.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=A.Word)}function wu(t,e,r,n){return t(e.sliceDoc(r,r+1))==A.Word&&t(e.sliceDoc(n-1,n))==A.Word}var yu=ve.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Vo),{state:r}=t,n=r.selection;if(n.ranges.length>1)return v.none;let i=n.main,s,a=null;if(i.empty){if(!e.highlightWordAroundCursor)return v.none;let l=r.wordAt(i.head);if(!l)return v.none;a=r.charCategorizer(i.head),s=r.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l200)return v.none;if(e.wholeWords){if(s=r.sliceDoc(i.from,i.to),a=r.charCategorizer(i.head),!(Wo(a,r,i.from,i.to)&&wu(a,r,i.from,i.to)))return v.none}else if(s=r.sliceDoc(i.from,i.to),!s)return v.none}let o=[];for(let l of t.visibleRanges){let O=new we(r.doc,s,l.from,l.to);for(;!O.next().done;){let{from:c,to:h}=O.value;if((!a||Wo(a,r,c,h))&&(i.empty&&c<=i.from&&h>=i.to?o.push(xu.range(c,h)):(c>=i.to||h<=i.from)&&o.push(Pu.range(c,h)),o.length>e.maxMatches))return v.none}}return v.set(o)}},{decorations:t=>t.decorations}),Zu=X.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Xu=({state:t,dispatch:e})=>{let{selection:r}=t,n=Z.create(r.ranges.map(i=>t.wordAt(i.head)||Z.cursor(i.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function vu(t,e){let{main:r,ranges:n}=t.selection,i=t.wordAt(r.head),s=i&&i.from==r.from&&i.to==r.to;for(let a=!1,o=new we(t.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(a)return null;o=new we(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),a=!0}else{if(a&&n.some(l=>l.from==o.value.from))continue;if(s){let l=t.wordAt(o.value.from);if(!l||l.from!=o.value.from||l.to!=o.value.to)continue}return o.value}}var Tu=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(s=>s.from===s.to))return Xu({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=n))return!1;let i=vu(t,n);return i?(e(t.update({selection:t.selection.addRange(Z.range(i.from,i.to),!1),effects:X.scrollIntoView(i.to)})),!0):!1},Le=De.define({combine(t){return ut(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new hi(e),scrollToMatch:e=>X.scrollIntoView(e)})}});function Io(t){return t?[Le.of(t),ui]:ui}var mr=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||bu(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?` -`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Oi(this):new li(this)}getCursor(e,r=0,n){let i=e.doc?e:Qe.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?st(this,i,r,n):it(this,i,r,n)}},gr=class{constructor(e){this.spec=e}};function Ru(t,e,r){return(n,i,s,a)=>{if(r&&!r(n,i,s,a))return!1;let o=n>=a&&i<=a+s.length?s.slice(n-a,i-a):e.doc.sliceString(n,i);return t(o,e,n,i)}}function it(t,e,r,n){let i;return t.wholeWord&&(i=ju(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(i=Ru(t.test,e,i)),new we(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:s=>s.toLowerCase(),i)}function ju(t,e){return(r,n,i,s)=>((s>r||s+i.length=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=it(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}};function _u(t,e,r){return(n,i,s)=>(!r||r(n,i,s))&&t(s[0],e,n,i)}function st(t,e,r,n){let i;return t.wholeWord&&(i=Cu(e.charCategorizer(e.selection.main.head))),t.test&&(i=_u(t.test,e,i)),new ur(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:i},r,n)}function Qr(t,e){return t.slice(_r(t,e,!1),e)}function $r(t,e){return t.slice(e,_r(t,e))}function Cu(t){return(e,r,n)=>!n[0].length||(t(Qr(n.input,n.index))!=A.Word||t($r(n.input,n.index))!=A.Word)&&(t($r(n.input,n.index+n[0].length))!=A.Word||t(Qr(n.input,n.index+n[0].length))!=A.Word)}var Oi=class extends gr{nextMatch(e,r,n){let i=st(this.spec,e,n,e.doc.length).next();return i.done&&(i=st(this.spec,e,0,r).next()),i.done?null:i.value}prevMatchInRange(e,r,n){for(let i=1;;i++){let s=Math.max(r,n-i*1e4),a=st(this.spec,e,s,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(s==r||o.from>s+10))return o;if(s==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let i=n.length;i>0;i--){let s=+n.slice(0,i);if(s>0&&s=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=st(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}},Tt=q.define(),fi=q.define(),xe=ie.define({create(t){return new vt(ci(t).create(),null)},update(t,e){for(let r of e.effects)r.is(Tt)?t=new vt(r.value.create(),t.panel):r.is(fi)&&(t=new vt(t.query,r.value?di:null));return t},provide:t=>ts.from(t,e=>e.panel)});var vt=class{constructor(e,r){this.query=e,this.panel=r}},Yu=v.mark({class:"cm-searchMatch"}),zu=v.mark({class:"cm-searchMatch cm-searchMatch-selected"}),qu=ve.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(xe))}update(t){let e=t.state.field(xe);(e!=t.startState.field(xe)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return v.none;let{view:r}=this,n=new Hi;for(let i=0,s=r.visibleRanges,a=s.length;is[i+1].from-500;)l=s[++i].to;t.highlight(r.state,o,l,(O,c)=>{let h=r.state.selection.ranges.some(p=>p.from==O&&p.to==c);n.add(O,c,h?zu:Yu)})}return n.finish()}},{decorations:t=>t.decorations});function Rt(t){return e=>{let r=e.state.field(xe,!1);return r&&r.query.spec.valid?t(e,r):No(e)}}var br=Rt((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let i=Z.single(n.from,n.to),s=t.state.facet(Le);return t.dispatch({selection:i,effects:[mi(t,n),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),Bo(t),!0}),Sr=Rt((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,i=e.prevMatch(r,n,n);if(!i)return!1;let s=Z.single(i.from,i.to),a=t.state.facet(Le);return t.dispatch({selection:s,effects:[mi(t,i),a.scrollToMatch(s.main,t)],userEvent:"select.search"}),Bo(t),!0}),Au=Rt((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:Z.create(r.map(n=>Z.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Lu=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:i}=r.main,s=[],a=0;for(let o=new we(t.doc,t.sliceDoc(n,i));!o.next().done;){if(s.length>1e3)return!1;o.value.from==n&&(a=s.length),s.push(Z.range(o.value.from,o.value.to))}return e(t.update({selection:Z.create(s,a),userEvent:"select.search.matches"})),!0},Mo=Rt((t,{query:e})=>{let{state:r}=t,{from:n,to:i}=r.selection.main;if(r.readOnly)return!1;let s=e.nextMatch(r,n,n);if(!s)return!1;let a=s,o=[],l,O,c=[];a.precise?a.from==n&&a.to==i&&(O=r.toText(e.getReplacement(a)),o.push({from:a.from,to:a.to,insert:O}),a=e.nextMatch(r,a.from,a.to),c.push(X.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+"."))):a=e.nextMatch(r,a.from,a.to);let h=t.state.changes(o);return a&&(l=Z.single(a.from,a.to).map(h),c.push(mi(t,a)),c.push(r.facet(Le).scrollToMatch(l.main,t))),t.dispatch({changes:h,selection:l,effects:c,userEvent:"input.replace"}),!0}),Eu=Rt((t,{query:e})=>{if(t.state.readOnly)return!1;let r=[];for(let i of e.matchAll(t.state,1e9)){let{from:s,to:a,precise:o}=i;o&&r.push({from:s,to:a,insert:e.getReplacement(i)})}if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:X.announce.of(n),userEvent:"input.replace.all"}),!0});function di(t){return t.state.facet(Le).createPanel(t)}function ci(t,e){var r,n,i,s,a;let o=t.selection.main,l=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!l)return e;let O=t.facet(Le);return new mr({search:((r=e?.literal)!==null&&r!==void 0?r:O.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:O.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:O.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:O.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:O.wholeWord})}function Do(t){let e=qr(t,di);return e&&e.dom.querySelector("[main-field]")}function Bo(t){let e=Do(t);e&&e==t.root.activeElement&&e.select()}var No=t=>{let e=t.state.field(xe,!1);if(e&&e.panel){let r=Do(t);if(r&&r!=t.root.activeElement){let n=ci(t.state,e.query.spec);n.valid&&t.dispatch({effects:Tt.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[fi.of(!0),e?Tt.of(ci(t.state,e.query.spec)):q.appendConfig.of(ui)]});return!0},Fo=t=>{let e=t.state.field(xe,!1);if(!e||!e.panel)return!1;let r=qr(t,di);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:fi.of(!1)}),!0},Ho=[{key:"Mod-f",run:No,scope:"editor search-panel"},{key:"F3",run:br,shift:Sr,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:br,shift:Sr,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Fo,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Lu},{key:"Mod-Alt-g",run:Su},{key:"Mod-d",run:Tu,preventDefault:!0}],hi=class{constructor(e){this.view=e;let r=this.query=e.state.field(xe).query.spec;this.commit=this.commit.bind(this),this.searchField=I("input",{value:r.search,placeholder:F(e,"Find"),"aria-label":F(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=I("input",{value:r.replace,placeholder:F(e,"Replace"),"aria-label":F(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=I("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=I("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=I("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(i,s,a){return I("button",{class:"cm-button",name:i,onclick:s,type:"button"},a)}this.dom=I("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>br(e),[F(e,"next")]),n("prev",()=>Sr(e),[F(e,"previous")]),n("select",()=>Au(e),[F(e,"all")]),I("label",null,[this.caseField,F(e,"match case")]),I("label",null,[this.reField,F(e,"regexp")]),I("label",null,[this.wordField,F(e,"by word")]),...e.state.readOnly?[]:[I("br"),this.replaceField,n("replace",()=>Mo(e),[F(e,"replace")]),n("replaceAll",()=>Eu(e),[F(e,"replace all")])],I("button",{name:"close",onclick:()=>Fo(e),"aria-label":F(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new mr({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Tt.of(e)}))}keydown(e){Ji(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Sr:br)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Mo(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(Tt)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Le).top}};function F(t,e){return t.state.phrase(e)}var cr=30,hr=/[\s\.,:;?!]/;function mi(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),i=t.state.doc.lineAt(r).to,s=Math.max(n.from,e-cr),a=Math.min(i,r+cr),o=t.state.sliceDoc(s,a);if(s!=n.from){for(let l=0;lo.length-cr;l--)if(!hr.test(o[l-1])&&hr.test(o[l])){o=o.slice(0,l);break}}return X.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${n.number}.`)}var Wu=X.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),ui=[xe,ge.low(qu),Wu];function Ee(t,e){return typeof document<"u"&&document.documentElement.lang.toLowerCase().startsWith("zh")?t:e}function de(t,e,r=""){let n=t.state.changeByRange(i=>{let{from:s,to:a}=i,o=t.state.sliceDoc(s-e.length,s),l=t.state.sliceDoc(a,a+e.length);if(o===e&&l===e)return{changes:[{from:s-e.length,to:s,insert:""},{from:a,to:a+e.length,insert:""}],range:Z.range(s-e.length,a-e.length)};let O=t.state.sliceDoc(s,a)||r;return{changes:{from:s,to:a,insert:e+O+e},range:Z.range(s+e.length,s+e.length+O.length)}});return t.dispatch(n,{scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function V(t,e){let{state:r}=t,n=[],i=new Set;for(let a of r.selection.ranges)for(let o=r.doc.lineAt(a.from).number;o<=r.doc.lineAt(a.to).number;o++)i.add(o);let s=/^(\s*)(#{1,6}\s+|>\s?|[-*+]\s+\[[ xX]\]\s+|[-*+]\s+|\d+[.)]\s+)?/;for(let a of i){let o=r.doc.line(a),l=s.exec(o.text),O=l[1],c=l[2]??"",h=o.from+O.length,p=h+c.length;n.push({from:h,to:p,insert:c===e?"":e})}return t.dispatch({changes:n,scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function gi(t,e,r=!1){let{state:n}=t,i=n.selection.main,s=e;if(r){let a=n.doc.lineAt(i.from);i.from===a.from||(s=` -`+s);let l=n.doc.lineAt(i.to);(i.to!==l.to||l.number===n.doc.lines)&&(s+=` -`)}t.dispatch({changes:{from:i.from,to:i.to,insert:s},selection:{anchor:i.from+s.length},scrollIntoView:!0,userEvent:"input"}),t.focus()}function Qi(t){let e=t.state.selection.main,r=t.state.sliceDoc(e.from,e.to)||Ee("\u94FE\u63A5","link"),n=`[${r}](https://)`;return t.dispatch({changes:{from:e.from,to:e.to,insert:n},selection:Z.range(e.from+r.length+3,e.from+n.length-1),userEvent:"input"}),t.focus(),!0}function $i(t){let e=t.state.selection.main,r=t.state.sliceDoc(e.from,e.to);return t.dispatch({changes:{from:e.from,to:e.to,insert:`[[${r}]]`},selection:{anchor:e.from+2+r.length},userEvent:"input"}),t.focus(),!0}var Ko=null,Jo="",Mu=0,at=new Map;function Si(){return typeof document<"u"&&document.documentElement.dataset.theme==="dark"?"dark":"neutral"}async function Uu(){Ko??=import("./chunks/mermaid.core-3W6VKKIW.js").then(r=>r.default);let t=await Ko,e=Si();return Jo!==e&&(t.initialize({startOnLoad:!1,securityLevel:"strict",theme:e,fontFamily:"inherit"}),Jo=e),t}async function Vu(t){let e=Si()+` -`+t,r=at.get(e);if(r)return r;let n=await Uu(),i=`ivy-mermaid-${++Mu}`;try{let{svg:s}=await n.render(i,t);return at.size>64&&at.delete(at.keys().next().value),at.set(e,s),s}finally{document.getElementById("d"+i)?.remove(),document.getElementById(i)?.remove()}}function Gu(t,e){return t.classList.add("mermaid-diagram"),t.setAttribute("role","img"),t.setAttribute("aria-label","Mermaid"),Vu(e).then(n=>{t.innerHTML=n,t.classList.remove("mermaid-error")},n=>{t.classList.add("mermaid-error"),t.textContent="Mermaid: "+String(n?.message??n).split(` -`)[0]})}var bi=class extends ee{constructor(r){super();this.code=r}eq(r){return r.code===this.code}toDOM(){let r=document.createElement("div");r.className="cm-mermaid";let n=Si()+` -`+this.code,i=at.get(n);return i?(r.classList.add("mermaid-diagram"),r.innerHTML=i):(r.classList.add("cm-mermaid-loading"),Gu(r,this.code).finally(()=>r.classList.remove("cm-mermaid-loading"))),r}get estimatedHeight(){return 200}ignoreEvent(){return!1}};function Iu(t){let e=[];return R(t).iterate({enter(r){if(r.name!=="FencedCode")return;let n=r.node.getChild("CodeInfo");if(!n||t.sliceDoc(n.from,n.to).trim().toLowerCase()!=="mermaid")return!1;let i=r.node.getChild("CodeText");return e.push({from:r.from,to:r.to,code:i?t.sliceDoc(i.from,i.to):""}),!1}}),e}function ki(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}var el=q.define();function tl(t,e){let r=[];for(let n of Iu(t)){if(e&&ki(t,n.from,n.to)||!n.code.trim())continue;let i=t.doc.lineAt(n.from).from,s=t.doc.lineAt(n.to).to;r.push(v.replace({widget:new bi(n.code),block:!0}).range(i,s))}return v.set(r,!0)}function rl(){return[ie.define({create:e=>({focused:!1,deco:tl(e,!1)}),update(e,r){let n=e.focused;for(let i of r.effects)i.is(el)&&(n=i.value);return n!==e.focused||r.docChanged||r.selection||R(r.startState)!==R(r.state)?{focused:n,deco:tl(r.state,n)}:e},provide:e=>X.decorations.from(e,r=>r.deco)}),X.focusChangeEffect.of((e,r)=>el.of(r)),X.domEventHandlers({mousedown(e,r){let n=e.target.closest(".cm-mermaid");if(!n)return!1;let i=r.posAtDOM(n),s=r.state.doc.lineAt(i);e.preventDefault();let a=s.number"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function nl(t){let e=t.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&!e.endsWith("\\|")&&(e=e.slice(0,-1)),e.split(/(?r.trim().replace(/\\\|/g,"|"))}function Bu(t){let e=t.split(` -`).filter(i=>i.trim());if(e.length<2)return"";let r=nl(e[1]).map(i=>/^:-+:$/.test(i)?"center":/^-+:$/.test(i)?"right":""),n=(i,s)=>""+nl(i).map((a,o)=>`<${s}${r[o]?` style="text-align:${r[o]}"`:""}>${Du(a)}`).join("")+"";return`${n(e[0],"th")}${e.slice(2).map(i=>n(i,"td")).join("")}
`}var Pi=class extends ee{constructor(r,n){super();this.src=r;this.render=n}eq(r){return r.src===this.src}toDOM(){let r=document.createElement("div");return r.className="cm-table prose-ivy",r.innerHTML=this.render(this.src),r}ignoreEvent(){return!1}};function Nu(t){let e=[];return R(t).iterate({enter(r){if(r.name==="Table")return e.push({from:r.from,to:r.to}),!1;if(r.name==="FencedCode"||r.name==="CodeBlock")return!1}}),e}var il=q.define();function al(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}function sl(t,e,r){let n=[];for(let i of Nu(t)){if(e&&al(t,i.from,i.to))continue;let s=t.doc.lineAt(i.from).from,a=t.doc.lineAt(i.to).to;n.push(v.replace({widget:new Pi(t.sliceDoc(s,a),r),block:!0}).range(s,a))}return v.set(n,!0)}function ol(t,e,r,n){return!(n&&al(t,e,r))}function ll(t){let e=n=>t.renderBlock?.(n)||Bu(n);return[ie.define({create:n=>({focused:!1,deco:sl(n,!1,e)}),update(n,i){let s=n.focused;for(let a of i.effects)a.is(il)&&(s=a.value);return s!==n.focused||i.docChanged||i.selection||R(i.startState)!==R(i.state)?{focused:s,deco:sl(i.state,s,e)}:n},provide:n=>X.decorations.from(n,i=>i.deco)}),X.focusChangeEffect.of((n,i)=>il.of(i)),X.domEventHandlers({mousedown(n,i){let s=n.target.closest(".cm-table");if(!s)return!1;let a=n.target.closest("a");if(n.preventDefault(),a?.dataset.note||a?.classList.contains("missing"))return t.openNote(a.dataset.note??"",a.dataset.title??a.textContent??"",n.button===1||n.shiftKey),!0;if(a?.href&&/^https?:/i.test(a.href))return window.open(a.href,"_blank","noopener"),!0;let o=i.posAtDOM(s),l=i.state.doc.lineAt(o),O=n.target.closest("tr"),c=[...s.querySelectorAll("tr")],h=O?c.indexOf(O):0;h>0&&h++;let p=i.state.doc.line(Math.min(l.number+Math.max(0,h),i.state.doc.lines));return i.dispatch({selection:{anchor:p.from+Math.min(2,p.length)}}),i.focus(),!0}})]}var Fu=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,wi=class extends ee{constructor(r,n,i){super();this.src=r;this.alt=n;this.kind=i}eq(r){return r.src===this.src&&r.alt===this.alt&&r.kind===this.kind}toDOM(){let r=document.createElement("span");if(r.className="cm-media",this.kind==="video"||this.kind==="audio"){let n=document.createElement(this.kind);n.src=this.src,n.controls=!0,n.preload="metadata",r.appendChild(n)}else if(this.kind==="file"){let n=document.createElement("a");n.className="cm-file-card",n.href=this.src,n.target="_blank",n.rel="noopener",n.textContent="\u{1F4CE} "+(this.alt||"file"),r.appendChild(n)}else{let n=document.createElement("img");n.src=this.src,n.alt=this.alt,n.loading="lazy",n.onerror=()=>r.classList.add("cm-media-broken"),r.appendChild(n)}return r}ignoreEvent(){return!1}},yi=class extends ee{constructor(r,n){super();this.checked=r;this.pos=n}eq(r){return r.checked===this.checked&&r.pos===this.pos}toDOM(r){let n=document.createElement("input");return n.type="checkbox",n.className="cm-task",n.checked=this.checked,n.setAttribute("aria-label",this.checked?Ee("\u5DF2\u5B8C\u6210","Done"):Ee("\u5F85\u529E","To-do")),n.addEventListener("mousedown",i=>{i.preventDefault();let a=r.state.sliceDoc(this.pos,this.pos+3)==="[ ]"?"[x]":"[ ]";r.dispatch({changes:{from:this.pos,to:this.pos+3,insert:a}})}),n}ignoreEvent(){return!0}},Zi=class extends ee{toDOM(){let e=document.createElement("span");return e.className="cm-hr-widget",e}eq(){return!0}},Xi=class extends ee{toDOM(){let e=document.createElement("span");return e.className="cm-bullet",e.textContent="\u2022",e}eq(){return!0}},se=v.replace({}),xi=t=>v.line({class:t}),jt=t=>v.mark({class:t});function Hu(t){let e=new Set;for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from).number,i=t.doc.lineAt(r.to).number;for(let s=n;s<=i;s++)e.add(s)}return e}function Ku(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}var Ju=/\[\[([^[\]\n]+?)\]\]/g;function Ol(t,e,r){let{state:n}=t,i=[],s=r?Hu(n):new Set,a=c=>s.has(n.doc.lineAt(c).number),o=(c,h)=>r&&Ku(n,c,h),l=[];for(let{from:c,to:h}of t.visibleRanges){R(n).iterate({from:c,to:h,enter(u){let d=u.name,m=/^ATXHeading(\d)$/.exec(d);if(m){let g=n.doc.lineAt(u.from);if(i.push(xi(`cm-h cm-h${m[1]}`).range(g.from)),!a(u.from)){let b=u.node.getChild("HeaderMark");b&&i.push(se.range(b.from,Math.min(b.to+1,g.to)))}return}switch(d){case"Table":return ol(n,u.from,u.to,r)?!1:void 0;case"FencedCode":case"CodeBlock":{l.push([u.from,u.to]);let g=u.node.getChild("CodeInfo"),b=u.node.getChild("CodeText");if(g&&b&&n.sliceDoc(g.from,g.to).trim().toLowerCase()==="mermaid"&&n.sliceDoc(b.from,b.to).trim()&&!(r&&ki(n,u.from,u.to)))return!1;let Q=n.doc.lineAt(u.from).number,k=n.doc.lineAt(u.to).number;if(d==="FencedCode"&&!o(u.from,u.to)){let y=n.doc.line(Q),w=n.doc.line(k);y.to>y.from&&i.push(se.range(y.from,y.to)),k!==Q&&w.to>w.from&&/^\s*(```|~~~)/.test(w.text)&&i.push(se.range(w.from,w.to))}for(let y=Q;y<=k;y++){let w=n.doc.line(y),_="cm-codeblock";y===Q&&(_+=" cm-codeblock-first"),y===k&&(_+=" cm-codeblock-last"),i.push(xi(_).range(w.from))}return!1}case"StrongEmphasis":case"Emphasis":case"Strikethrough":case"InlineCode":{let g=d==="StrongEmphasis"?"cm-strong":d==="Emphasis"?"cm-em":d==="Strikethrough"?"cm-strike":"cm-inline-code";if(i.push(jt(g).range(u.from,u.to)),!o(u.from,u.to)){let b=d==="InlineCode"?"CodeMark":d==="Strikethrough"?"StrikethroughMark":"EmphasisMark",Q=u.node.firstChild;for(;Q;)Q.name===b&&i.push(se.range(Q.from,Q.to)),Q=Q.nextSibling}return d!=="InlineCode"}case"Link":{if(o(u.from,u.to))return;let g=u.node.getChildren("LinkMark"),b=u.node.getChild("URL");return g.length>=2&&(i.push(se.range(g[0].from,g[0].to)),i.push(jt("cm-link").range(g[0].to,g[1].from)),i.push(se.range(g[1].from,u.to))),!1}case"Image":{let g=u.node.getChild("URL");if(!g)return!1;let b=n.sliceDoc(g.from,g.to),Q=Fu.exec(b),k=Q?e.resolveResource(Q[1]):b,y=Q?e.resourceKind(Q[1]):void 0,w=u.node.getChildren("LinkMark"),_=w.length>=2?n.sliceDoc(w[0].to,w[1].from):"";if(!k||/^javascript:/i.test(k))return!1;let G=new wi(k,_,y);return a(u.from)?i.push(v.widget({widget:G,side:1}).range(u.to)):i.push(v.replace({widget:G}).range(u.from,u.to)),!1}case"Blockquote":{let g=n.doc.lineAt(u.from).number,b=n.doc.lineAt(u.to).number;for(let Q=g;Q<=b;Q++)i.push(xi("cm-quote").range(n.doc.line(Q).from));return}case"QuoteMark":{if(!a(u.from)){let g=n.sliceDoc(u.to,u.to+1)===" "?u.to+1:u.to;i.push(se.range(u.from,g))}return}case"HorizontalRule":{a(u.from)||i.push(v.replace({widget:new Zi}).range(u.from,u.to));return}case"ListMark":{let g=n.sliceDoc(u.from,u.to),b=g==="-"||g==="*"||g==="+",Q=n.sliceDoc(u.to,u.to+4),k=/^ \[[ xX]\]/.test(Q);b&&!a(u.from)?k?i.push(se.range(u.from,u.to+1)):i.push(v.replace({widget:new Xi}).range(u.from,u.to)):i.push(jt("cm-list-mark").range(u.from,u.to));return}case"TaskMarker":{let g=/x/i.test(n.sliceDoc(u.from,u.to));if(!o(u.from,u.to)&&(i.push(v.replace({widget:new yi(g,u.from)}).range(u.from,u.to)),g)){let b=n.doc.lineAt(u.from);u.to+1d>=w&&m<=_))continue;let g=u[1],b=g.indexOf("|"),Q=(b>=0?g.slice(0,b):g).split("#")[0].trim(),k=!!e.resolveTitle(Q),y={"data-wiki":Q};if(o(d,m)){i.push(v.mark({class:"cm-wikilink cm-wikilink-src"+(k?"":" cm-wikilink-missing"),attributes:y}).range(d,m));continue}i.push(se.range(d,d+2+(b>=0?b+1:0))),i.push(v.mark({class:"cm-wikilink cm-wikilink-rendered"+(k?"":" cm-wikilink-missing"),attributes:y}).range(d+2+(b>=0?b+1:0),m-2)),i.push(se.range(m-2,m))}}let O=i.filter(c=>c.value.point===!0);return{all:v.set(i,!0),atomic:v.set(O,!0)}}function cl(t){let e=ve.fromClass(class{decorations;atomic;constructor(r){let n=Ol(r,t,r.hasFocus);this.decorations=n.all,this.atomic=n.atomic}update(r){if(r.docChanged||r.viewportChanged||r.selectionSet||r.focusChanged||R(r.startState)!==R(r.state)){let n=Ol(r.view,t,r.view.hasFocus);this.decorations=n.all,this.atomic=n.atomic}}},{decorations:r=>r.decorations,eventHandlers:{mousedown(r,n){let i=r.target.closest(".cm-wikilink");if(!i)return!1;let s=i.classList.contains("cm-wikilink-rendered"),a=r.button===1||r.shiftKey;if(r.button>1||!s&&!(r.metaKey||r.ctrlKey||r.button===1))return!1;let o=i.dataset.wiki??"";return r.preventDefault(),t.openNote(t.resolveTitle(o),o,a),!0},click(r){let n=r.target.closest(".cm-link, .cm-file-card");return n&&(r.metaKey||r.ctrlKey)&&n instanceof HTMLAnchorElement?(window.open(n.href,"_blank","noopener"),!0):!1}}});return[e,rl(),ll(t),X.atomicRanges.of(r=>r.plugin(e)?.atomic??v.none)]}var hl=X.theme({"&":{color:"rgb(var(--ink))",backgroundColor:"transparent",height:"100%"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit",lineHeight:"1.85",overflow:"visible"},".cm-content":{padding:"0 0 40vh",caretColor:"rgb(var(--ivy))"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"rgb(var(--ivy))",borderLeftWidth:"2px"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:"rgb(var(--ivy) / 0.2) !important"},".cm-placeholder":{color:"rgb(var(--faint))"},".cm-tooltip":{border:"none",backgroundColor:"rgb(var(--surface))",borderRadius:"14px",boxShadow:"var(--shadow-lift)",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:"inherit",maxHeight:"260px",padding:"4px"},".cm-tooltip-autocomplete > ul > li":{padding:"7px 10px",borderRadius:"10px",lineHeight:"1.4"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"rgb(var(--sunken))",color:"rgb(var(--ink))"},".cm-completionDetail":{marginLeft:"8px",color:"rgb(var(--muted))",fontStyle:"normal",fontSize:"12px"},".cm-completionIcon":{display:"none"},".cm-panels":{backgroundColor:"rgb(var(--surface))",color:"rgb(var(--ink))",border:"none"},".cm-searchMatch":{backgroundColor:"rgb(var(--warn) / 0.3)"},".cm-searchMatch-selected":{backgroundColor:"rgb(var(--warn) / 0.55)"}}),ul=us(hs.define([{tag:f.heading,fontWeight:"600"},{tag:f.strong,fontWeight:"600"},{tag:f.emphasis,fontStyle:"italic"},{tag:f.strikethrough,textDecoration:"line-through"},{tag:f.link,color:"rgb(var(--ivy))"},{tag:f.url,color:"rgb(var(--ivy))"},{tag:f.monospace,fontFamily:"var(--font-mono)",color:"rgb(var(--warn-ink))"},{tag:f.quote,color:"rgb(var(--ink-2))"},{tag:[f.processingInstruction,f.contentSeparator,f.meta],color:"rgb(var(--faint))"},{tag:f.labelName,color:"rgb(var(--muted))"}]));function pl(t){return e=>{let r=e.matchBefore(/\[\[[^\]\n|#]*$/);if(!r)return null;let n=r.text.slice(2).toLowerCase(),i=e.state.sliceDoc(e.pos,e.pos+2),s=[],a=new Set;for(let o of t())if(!(!o.title||a.has(o.title))&&(a.add(o.title),!(n&&!o.title.toLowerCase().includes(n))&&(s.push({label:o.title,detail:o.detail,type:"text",boost:o.title.toLowerCase().startsWith(n)?1:0,apply:(l,O,c,h)=>{let p=i==="]]"?"":"]]";l.dispatch({changes:{from:c,to:h,insert:O.label+p},selection:{anchor:c+O.label.length+2}})}}),s.length>=50)))break;if(n&&!a.has(r.text.slice(2))){let o=r.text.slice(2);s.push({label:o,detail:Ee("\u65B0\u5EFA\u94FE\u63A5","New link"),type:"keyword",boost:-1,apply:(l,O,c,h)=>l.dispatch({changes:{from:c,to:h,insert:o+(i==="]]"?"":"]]")},selection:{anchor:c+o.length+2}})})}return{from:r.from+2,options:s,validFor:/^[^\]\n|#]*$/}}}function kr(t){return t.trim().replace(/\s+/g," ").toLowerCase()}function fl(t){let e=t,r,n,i=e.indexOf("|");i>=0&&(r=e.slice(i+1).trim(),e=e.slice(0,i));let s=e.indexOf("#");return s>=0&&(n=e.slice(s+1).trim(),e=e.slice(0,s)),{target:e.trim(),alias:r,heading:n}}function ji(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ve=ji();function wl(t){Ve=t}var Me={exec:()=>null};function We(t){let e=[];return r=>{let n=Math.max(0,Math.min(3,r-1)),i=e[n];return i||(i=t(n),e[n]=i),i}}function x(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(C.caret,"$1"),r=r.replace(i,a),n},getRegex:()=>new RegExp(r,e)};return n}var yl=((t="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,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,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:We(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:We(t=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:We(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:We(t=>new RegExp(`^ {0,${t}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:We(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:We(t=>new RegExp(`^ {0,${t}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|new RegExp(`^ {0,${t}}>`))},ep=/^(?:[ \t]*(?:\n|$))+/,tp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,Yt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,np=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_i=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Zl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,Xl=x(Zl).replace(/bull/g,_i).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ip=x(Zl).replace(/bull/g,_i).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ci=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,sp=/^[^\n]+/,Yi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,ap=x(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Yi).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),op=x(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_i).getRegex(),zt="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",zi=/|$))/,lp=x("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|[^\\n]*\\n*|$)||$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",zi).replace("tag",zt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vl=t=>x(Ci).replace("hr",Yt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",cp).getRegex(),qi={blockquote:hp,code:tp,def:ap,fences:rp,heading:np,hr:Yt,html:lp,lheading:Xl,list:op,newline:ep,paragraph:Op,table:Me,text:sp},dl=x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|(?: *\\n{2,}|\\s*$)|\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",zi).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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Me,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:x(Ci).replace("hr",Yt).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",Xl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},fp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,dp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Tl=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,mp=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",yl?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),jl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kp=x(jl,"u").replace(/punct/g,ae).getRegex(),Pp=x(jl,"u").replace(/punct/g,Rl).getRegex(),xp=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,wp=x(xp,"u").replace(/openQuote/g,Qp).replace(/punct/g,ae).getRegex(),_l="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yp=x(_l,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),Zp=x(_l,"gu").replace(/notPunctSpace/g,bp).replace(/punctSpace/g,$p).replace(/punct/g,Rl).getRegex(),Xp="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",vp=x(Xp,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),Tp=x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),Rp="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",jp=x(Rp,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),_p=x(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ae).getRegex(),Cp="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Yp=x(Cp,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),zp=x(/\\(punct)/,"gu").replace(/punct/g,ae).getRegex(),qp=x(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,ae).getRegex(),Ap=x(/^<(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(),Lp=x(zi).replace("(?:-->|$)","-->").getRegex(),Ep=x("^comment|^|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",Lp).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Cl=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,wr=x(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Cl).getRegex(),Wp=x(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",wr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),Mp=x(/^!?\[(label)\]\[(ref)\]/).replace("label",wr).replace("ref",Yi).getRegex(),Up=x(/^!?\[(ref)\](?:\[\])?/).replace("ref",Yi).getRegex(),ml=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Vp=x(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Cl).getRegex(),Gp=x("reflink|nolink(?!\\()","g").replace("reflink",x(/^!?\[(label)\]\[(ref)\]/).replace("label",Vp).replace("ref",ml).getRegex()).replace("nolink",x(/^!?\[(ref)\](?:\[\])?/).replace("ref",ml).getRegex()).getRegex(),gl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ip=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Dp=x(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Ip).getRegex(),Ai={_backpedal:Me,anyPunctuation:zp,anyPunctuationOutsideCode:qp,autolink:Ap,blockSkip:Sp,br:Tl,code:dp,del:Me,delLDelim:Me,delRDelim:Me,emStrongLDelim:kp,emStrongRDelimAst:yp,emStrongRDelimUnd:Tp,escape:fp,link:Wp,nolink:Up,punctuation:gp,reflink:Mp,reflinkSearch:Gp,tag:Ep,text:mp,url:Me},Bp={...Ai,emStrongLDelim:wp,emStrongRDelimAst:vp,emStrongRDelimUnd:jp,link:x(/^!?\[(label)\]\((.*?)\)/).replace("label",wr).getRegex(),reflink:x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wr).getRegex()},vi={...Ai,emStrongRDelimAst:Zp,emStrongLDelim:Pp,delLDelim:_p,delRDelim:Yp,url:x(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Dp).replace("protocol",gl).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:x(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Ql=t=>Fp[t];function H(t,e){if(e){if(C.escapeTest.test(t))return t.replace(C.escapeReplace,Ql)}else if(C.escapeTestNoEncode.test(t))return t.replace(C.escapeReplaceNoEncode,Ql);return t}function Hp(t){return C.numericCharacterReference.test(t)?t.replace(C.numericCharacterReferenceOrAmpersand,(e,r,n)=>{if(r===void 0&&n===void 0)return"&";let i=r===void 0?Number.parseInt(n,16):Number.parseInt(r,10);return i===0||i>1114111||i>=55296&&i<=57343?"\uFFFD":i===38?"&":String.fromCodePoint(i)}):t}function $l(t){try{t=encodeURI(t).replace(C.percentDecode,"%")}catch{return null}return t}function bl(t,e){let r=t.replace(C.findPipe,(s,a,o)=>{let l=!1,O=a;for(;--O>=0&&o[O]==="\\";)l=!l;return l?"|":" |"}),n=r.split(C.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length=0&&C.blankLine.test(e[r]);)r--;return e.length-r<=2?t:e.slice(0,r+1).join(` -`)}function yr(t){return t.trim().replace(C.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function kl(t,e){if(t.indexOf(e[0])===-1&&t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n0?-2:-1}var lt=new WeakMap;function Li(t){let e={"*":-1,_:-1},r=-1,n=t.length;for(let i=0;i{let a=s.match(r.other.beginningSpace);if(a===null)return s;let[o]=a;return s.slice(Math.min(o.length,i.length))}).join(` -`)}function xl(t,e,r,n){if(!e.includes("<"))return!1;for(let i=0;ie.length-i)return!0;i+=a[0].length-1}}return!1}var ot=class{options;rules;lexer;constructor(t){this.options=t||Ve}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=this.options.pedantic?e[0]:Sl(e[0]),n=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:n}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],n=rf(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let n=me(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceTabChar.test(n))&&(r=n.trim())}return{type:"heading",raw:me(e[0],` -`),depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:me(e[0],` -`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=me(e[0],` +}`,{label:"class",detail:"definition",type:"keyword"}),me('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),me('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Dp=Bc.concat([me("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),me("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),me("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Vc=new xr,Hc=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Yn(t){return(e,n)=>{let r=e.node.getChild("VariableDefinition");return r&&n(r,t),!0}}var Vp=["FunctionDeclaration"],Gp={FunctionDeclaration:Yn("function"),ClassDeclaration:Yn("class"),ClassExpression:()=>!0,EnumDeclaration:Yn("constant"),TypeAliasDeclaration:Yn("type"),NamespaceDeclaration:Yn("namespace"),VariableDefinition(t,e){t.matchContext(Vp)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function Fc(t,e){let n=Vc.get(e);if(n)return n;let r=[],s=!0;function i(o,a){let l=t.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(Be.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let a=Gp[o.name];if(a&&a(o,i)||Hc.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of Fc(t,o.node))r.push(a);return!1}}),Vc.set(e,r),r}var Gc=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Kc=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Np(t){let e=I(t.state).resolveInner(t.pos,-1);if(Kc.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&Gc.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)Hc.has(s.name)&&(r=r.concat(Fc(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:Gc}}var Le=en.define({name:"javascript",parser:Dc.configure({props:[ot.add({IfStatement:tn({except:/^\s*({|else\b)/}),TryStatement:tn({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Ga,SwitchBody:t=>{let e=t.textAfter,n=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return t.baseIndent+(n?0:r?1:2)*t.unit},Block:Va({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":tn({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),Ke.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Sr,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let n=t.lastChild;return{from:e.to,to:n.type.isError?t.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let n=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,r=t.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?t.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Jc={test:t=>/^JSX/.test(t.name),facet:kr({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Ji=Le.configure({dialect:"ts"},"typescript"),eo=Le.configure({dialect:"jsx",props:[Ws.add(t=>t.isTop?[Jc]:void 0)]}),to=Le.configure({dialect:"jsx ts",props:[Ws.add(t=>t.isTop?[Jc]:void 0)]},"typescript"),eO=t=>({label:t,type:"keyword"}),tO="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(eO),Bp=tO.concat(["declare","implements","private","protected","public"].map(eO));function nO(t={}){let e=t.jsx?t.typescript?to:eo:t.typescript?Ji:Le,n=t.typescript?Dp.concat(Bp):Bc.concat(tO);return new Fe(e,[Le.data.of({autocomplete:hl(Kc,ni(n))}),Le.data.of({autocomplete:Np}),t.jsx?Kp:[]])}function Hp(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function Nc(t,e,n=t.length){for(let r=e?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return t.sliceString(r.from,Math.min(r.to,n));return""}var Fp=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Kp=j.inputHandler.of((t,e,n,r,s)=>{if((Fp?t.composing:t.compositionStarted)||t.state.readOnly||e!=n||r!=">"&&r!="/"||!Le.isActiveAt(t.state,e,-1))return!1;let i=s(),{state:o}=i,a=o.changeByRange(l=>{var c;let{head:O}=l,u=I(o).resolveInner(O-1,-1),h;if(u.name=="JSXStartTag"&&(u=u.parent),!(o.doc.sliceString(O-1,O)!=r||u.name=="JSXAttributeValue"&&u.to>O)){if(r==">"&&u.name=="JSXFragmentTag")return{range:l,changes:{from:O,insert:""}};if(r=="/"&&u.name=="JSXStartCloseTag"){let d=u.parent,p=d.parent;if(p&&d.from==O-2&&((h=Nc(o.doc,p.firstChild,O))||((c=p.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let f=`${h}>`;return{range:U.cursor(O+f.length,-1),changes:{from:O,insert:f}}}}else if(r==">"){let d=Hp(u);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(O,O+2))&&(h=Nc(o.doc,d,O)))return{range:l,changes:{from:O,insert:``}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([i,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var zn=["_blank","_self","_top","_parent"],no=["ascii","utf-8","utf-16","latin1","latin1"],ro=["get","post","put","delete"],so=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Pe=["true","false"],X={},Jp={a:{attrs:{href:null,ping:null,type:null,media:null,target:zn,hreflang:null}},abbr:X,address:X,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:X,aside:X,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:X,base:{attrs:{href:null,target:zn}},bdi:X,bdo:X,blockquote:{attrs:{cite:null}},body:X,br:X,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:so,formmethod:ro,formnovalidate:["novalidate"],formtarget:zn,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:X,center:X,cite:X,code:X,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:X,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:X,div:X,dl:X,dt:X,em:X,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:X,figure:X,footer:X,form:{attrs:{action:null,name:null,"accept-charset":no,autocomplete:["on","off"],enctype:so,method:ro,novalidate:["novalidate"],target:zn}},h1:X,h2:X,h3:X,h4:X,h5:X,h6:X,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:X,hgroup:X,hr:X,html:{attrs:{manifest:null}},i:X,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:so,formmethod:ro,formnovalidate:["novalidate"],formtarget:zn,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:X,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:X,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:X,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:no,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:X,noscript:X,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:X,param:{attrs:{name:null,value:null}},pre:X,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:X,rt:X,ruby:X,samp:X,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:no}},section:X,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:X,source:{attrs:{src:null,type:null,media:null}},span:X,strong:X,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:X,summary:X,sup:X,table:X,tbody:X,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:X,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:X,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:X,time:{attrs:{datetime:null}},title:X,tr:X,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:X,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:X},oO={accesskey:null,class:null,contenteditable:Pe,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Pe,autocorrect:Pe,autocapitalize:Pe,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Pe,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Pe,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Pe,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Pe,"aria-hidden":Pe,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Pe,"aria-multiselectable":Pe,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Pe,"aria-relevant":null,"aria-required":Pe,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},aO="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(t=>"on"+t);for(let t of aO)oO[t]=null;var Zt=class{constructor(e,n){this.tags={...Jp,...e},this.globalAttrs={...oO,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};Zt.default=new Zt;function Xt(t,e,n=t.length){if(!e)return"";let r=e.firstChild,s=r&&r.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,n)):""}function ln(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function lO(t,e,n){let r=n.tags[Xt(t,ln(e))];return r?.children||n.allTags}function io(t,e){let n=[];for(let r=ln(e);r&&!r.type.isTop;r=ln(r.parent)){let s=Xt(t,r);if(s&&r.lastChild.name=="CloseTag")break;s&&n.indexOf(s)<0&&(e.name=="EndTag"||e.from>=r.firstChild.to)&&n.push(s)}return n}var cO=/^[:\-\.\w\u00b7-\uffff]*$/;function rO(t,e,n,r,s){let i=/\s*>/.test(t.sliceDoc(s,s+5))?"":">",o=ln(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:s,options:lO(t.doc,o,e).map(a=>({label:a,type:"type"})).concat(io(t.doc,n).map((a,l)=>({label:"/"+a,apply:"/"+a+i,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function sO(t,e,n,r){let s=/\s*>/.test(t.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:io(t.doc,e).map((i,o)=>({label:i,apply:i+s,type:"type",boost:99-o})),validFor:cO}}function em(t,e,n,r){let s=[],i=0;for(let o of lO(t.doc,n,e))s.push({label:"<"+o,type:"type"});for(let o of io(t.doc,n))s.push({label:"",type:"type",boost:99-i++});return{from:r,to:r,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function tm(t,e,n,r,s){let i=ln(n),o=i?e.tags[Xt(t.doc,i)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:r,to:s,options:l.map(c=>({label:c,type:"property"})),validFor:cO}}function nm(t,e,n,r,s){var i;let o=(i=n.parent)===null||i===void 0?void 0:i.getChild("AttributeName"),a=[],l;if(o){let c=t.sliceDoc(o.from,o.to),O=e.globalAttrs[c];if(!O){let u=ln(n),h=u?e.tags[Xt(t.doc,u)]:null;O=h?.attrs&&h.attrs[c]}if(O){let u=t.sliceDoc(r,s).toLowerCase(),h='"',d='"';/^['"]/.test(u)?(l=u[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",d=t.sliceDoc(s,s+1)==u[0]?"":u[0],u=u.slice(1),r++):l=/^[^\s<>='"]*$/;for(let p of O)a.push({label:p,apply:h+p+d,type:"constant"})}}return{from:r,to:s,options:a,validFor:l}}function OO(t,e){let{state:n,pos:r}=e,s=I(n).resolveInner(r,-1),i=s.resolve(r);for(let o=r,a;i==s&&(a=s.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.fromOO(r,s)}var sm=Le.parser.configure({top:"SingleExpression"}),hO=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:Ji.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:eo.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:to.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:sm},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:Le.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:qn.parser}],fO=[{name:"style",parser:qn.parser.configure({top:"Styles"})}].concat(aO.map(t=>({name:t,parser:Le.parser}))),dO=en.define({name:"html",parser:Zc.configure({props:[ot.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Ur=dO.configure({wrap:Vi(hO,fO)});function pO(t={}){let e="",n;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(n=Vi((t.nestedLanguages||[]).concat(hO),(t.nestedAttributes||[]).concat(fO)));let r=n?dO.configure({wrap:n,dialect:e}):e?Ur.configure({dialect:e}):Ur;return new Fe(r,[Ur.data.of({autocomplete:rm(t)}),t.autoCloseTags!==!1?om:[],nO().support,Uc().support])}var iO=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function im(t,e,n){for(var r;;){if(((r=e.lastChild)===null||r===void 0?void 0:r.name)!="CloseTag")return!1;let s=e.parent;if(!s||Xt(t,s)!=n)return!0;e=s}}var om=j.inputHandler.of((t,e,n,r,s)=>{if(t.composing||t.state.readOnly||e!=n||r!=">"&&r!="/"||!Ur.isActiveAt(t.state,e,-1))return!1;let i=s(),{state:o}=i,a=o.changeByRange(l=>{var c;let O=o.doc.sliceString(l.from-1,l.to)==r,{head:u}=l,h=I(o).resolveInner(u,-1),d;if(O&&r==">"&&h.name=="EndTag"){let p=h.parent;if((d=Xt(o.doc,p.parent,u))&&!iO.has(d)&&!im(o.doc,p.parent,d)){let f=u+(o.doc.sliceString(u,u+1)===">"?1:0),m=``;return{range:l,changes:{from:u,to:f,insert:m}}}}else if(O&&r=="/"&&h.name=="IncompleteCloseTag"){let p=h.parent;if(h.from==u-2&&((c=p.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(d=Xt(o.doc,p,u))&&!iO.has(d)){let f=u+(o.doc.sliceString(u,u+1)===">"?1:0),m=`${d}>`;return{range:U.cursor(u+m.length,-1),changes:{from:u,to:f,insert:m}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([i,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var bO=kr({commentTokens:{block:{open:""}}}),xO=new Ee,QO=Kl.configure({props:[Ke.add(t=>!t.is("Block")||t.is("Document")||lo(t)!=null||am(t)?void 0:(e,n)=>({from:n.doc.lineAt(e.from).to,to:e.to})),xO.add(lo),ot.add({Document:()=>null}),Wa.add({Document:bO})]});function lo(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function am(t){return t.name=="OrderedList"||t.name=="BulletList"}function lm(t,e){let n=t;for(;;){let r=n.nextSibling,s;if(!r||(s=lo(r.type))!=null&&s<=e)break;n=r}return n.to}var cm=Na.of((t,e,n)=>{for(let r=I(t).resolveInner(n,-1);r&&!(r.fromn)return{from:n,to:i}}return null});function co(t){return new Ia(bO,t,[],"markdown")}var Om=co(QO),um=QO.configure([tc,sc,rc,ic,{props:[Ke.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),cn=co(um);function hm(t,e){return n=>{if(n&&t){let r=null;if(n=/\S*/.exec(n)[0],typeof t=="function"?r=t(n):r=Is.matchLanguageName(t,n,!0),r instanceof Is)return r.support?r.support.language.parser:Da.getSkippingParser(r.load());if(r)return r.parser}return e?e.parser:null}}var Un=class{constructor(e,n,r,s,i,o,a){this.node=e,this.from=n,this.to=r,this.spaceBefore=s,this.spaceAfter=i,this.type=o,this.item=a}blank(e,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;r.length0;s--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(e,n){let r=this.node.name=="OrderedList"?String(+kO(this.item,e)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}};function $O(t,e){let n=[],r=[];for(let s=t;s;s=s.parent){if(s.name=="FencedCode")return r;(s.name=="ListItem"||s.name=="Blockquote")&&n.push(s)}for(let s=n.length-1;s>=0;s--){let i=n[s],o,a=e.lineAt(i.from),l=i.from-a.from;if(i.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))r.push(new Un(i,l,l+o[0].length,"",o[1],">",null));else if(i.name=="ListItem"&&i.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let c=o[3],O=o[0].length;c.length>=4&&(c=c.slice(0,c.length-4),O-=4),r.push(new Un(i.parent,l,l+O,o[1],c,o[2],i))}else if(i.name=="ListItem"&&i.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let c=o[4],O=o[0].length;c.length>4&&(c=c.slice(0,c.length-4),O-=4);let u=o[2];o[3]&&(u+=o[3].replace(/[xX]/," ")),r.push(new Un(i.parent,l,l+O,o[1],c,u,i))}}return r}function kO(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function oo(t,e,n,r=0){for(let s=-1,i=t;;){if(i.name=="ListItem"){let a=kO(i,e),l=+a[2];if(s>=0){if(l!=s+1)return;n.push({from:i.from+a[1].length,to:i.from+a[0].length,insert:String(s+2+r)})}s=l}let o=i.nextSibling;if(!o)break;i=o}}function Oo(t,e){let n=/^[ \t]*/.exec(t)[0].length;if(!n||e.facet(yr)!=" ")return t;let r=Jt(t,4,n),s="";for(let i=r;i>0;)i>=4?(s+=" ",i-=4):(s+=" ",i--);return s+t.slice(n)}var fm=(t={})=>({state:e,dispatch:n})=>{let r=I(e),{doc:s}=e,i=null,o=e.changeByRange(a=>{if(!a.empty||!cn.isActiveAt(e,a.from,-1)&&!cn.isActiveAt(e,a.from,1))return i={range:a};let l=a.from,c=s.lineAt(l),O=$O(r.resolveInner(l,-1),s);for(;O.length&&O[O.length-1].from>l-c.from;)O.pop();if(!O.length)return i={range:a};let u=O[O.length-1];if(u.to-u.spaceAfter.length>l-c.from)return i={range:a};let h=l>=u.to-u.spaceAfter.length&&!/\S/.test(c.text.slice(u.to));if(u.item&&h){if(u.item.from]*$/.test(c.text.slice(0,u.to)))return i={range:a};let b=u.node.firstChild,g=u.node.getChild("ListItem","ListItem");if(b.to>=l||g&&g.to0&&!/[^\s>]/.test(s.lineAt(c.from-1).text)||t.nonTightLists===!1){let Q=O.length>1?O[O.length-2]:null,y,k="";Q&&Q.item?(y=c.from+Q.from,k=Q.marker(s,1)):y=c.from+(Q?Q.to:0);let w=[{from:y,to:l,insert:k}];return u.node.name=="OrderedList"&&oo(u.item,s,w,-2),Q&&Q.node.name=="OrderedList"&&oo(Q.item,s,w),{range:U.cursor(y+k.length),changes:w}}else{let Q=gO(O,e,c);return{range:U.cursor(l+Q.length+1),changes:{from:c.from,insert:Q+e.lineBreak}}}}if(u.node.name=="Blockquote"&&h&&c.from){let b=s.lineAt(c.from-1),g=/>\s*$/.exec(b.text);if(g&&g.index==u.from){let Q=e.changes([{from:b.from+g.index,to:b.to},{from:c.from+u.from,to:c.to}]);return{range:a.map(Q),changes:Q}}}let d=[];u.node.name=="OrderedList"&&oo(u.item,s,d);let p=u.item&&u.item.from]*/.exec(c.text)[0].length>=u.to)for(let b=0,g=O.length-1;b<=g;b++)f+=b==g&&!p?O[b].marker(s,1):O[b].blank(bc.from&&/\s/.test(c.text.charAt(m-c.from-1));)m--;return f=Oo(f,e),pm(u.node,e.doc)&&(f=gO(O,e,c)+e.lineBreak+f),d.push({from:m,to:l,insert:e.lineBreak+f}),{range:U.cursor(m+f.length+1),changes:d}});return i?!1:(n(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},dm=fm();function mO(t){return t.name=="QuoteMark"||t.name=="ListMark"}function pm(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let n=t.firstChild,r=t.getChild("ListItem","ListItem");if(!r)return!1;let s=e.lineAt(n.to),i=e.lineAt(r.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1){let n=I(t),r=null,s=t.changeByRange(i=>{let o=i.from,{doc:a}=t;if(i.empty&&cn.isActiveAt(t,i.from)){let l=a.lineAt(o),c=$O(mm(n,o),a);if(c.length){let O=c[c.length-1],u=O.to-O.spaceAfter.length+(O.spaceAfter?1:0);if(o-l.from>u&&!/\S/.test(l.text.slice(u,o-l.from)))return{range:U.cursor(l.from+u),changes:{from:l.from+u,to:o}};if(o-l.from==u&&(O.item&&l.from<=O.item.from||/^[\s>]*$/.test(l.text.slice(0,O.to)))){let h=l.from+O.from;if(O.item&&O.node.from{var n;let{main:r}=e.state.selection;if(r.empty)return!1;let s=(n=t.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!cn.isActiveAt(e.state,r.from,1)))return!1;let i=I(e.state),o=!1;return i.iterate({from:r.from,to:r.to,enter:a=>{(a.from>r.from||$m.test(a.name))&&(o=!0)},leave:a=>{a.tot.normalize("NFKD"):t=>t,ht=class{constructor(e,n,r=0,s=e.length,i,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?a=>i(wO(a)):wO,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return be(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=yn(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ce(e);let s=this.normalize(n);if(s.length)for(let i=0,o=r,a=!0;;i++){let l=s.charCodeAt(i),c=this.match(l,o,a,this.bufferPos+this.bufferStart,i==s.length-1);if(c)return this.value=c,this;if(i==s.length-1)break;a&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=Nr(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,precise:!0,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let a=new t(n,e.sliceString(n,r));return uo.set(e,a),a}if(s.from==n&&s.to==r)return s;let{text:i,from:o}=s;return o>n&&(i=e.sliceString(n,o)+i,o=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,precise:!0,match:n},this.matchPos=Nr(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Vr.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(Dr.prototype[Symbol.iterator]=Gr.prototype[Symbol.iterator]=function(){return this});function ym(t){try{return new RegExp(t,bo),!0}catch{return!1}}function Nr(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}var Sm=t=>{let e=za(t,"cm-goto-line");if(e){let o=e.dom.querySelector("input[type=text]");return o&&o.select(),!0}let{state:n}=t,r=String(n.doc.lineAt(t.state.selection.main.head).number),{close:s,result:i}=Ya(t,{class:"cm-goto-line",label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return i.then(o=>{let a=o&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(o.elements.line.value);if(!a){t.dispatch({effects:s});return}let l=n.doc.lineAt(n.selection.main.head),[,c,O,u,h]=a,d=u?+u.slice(1):0,p=O?+O:l.number;if(O&&h){let b=p/100;c&&(b=b*(c=="-"?-1:1)+l.number/n.doc.lines),p=Math.round(n.doc.lines*b)}else O&&c&&(p=p*(c=="-"?-1:1)+l.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,p))),m=U.cursor(f.from+Math.max(0,Math.min(d,f.length)));t.dispatch({effects:[s,j.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},wm={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},XO=Kt.define({combine(t){return wn(t,wm,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function TO(t){let e=[Tm,Xm];return t&&e.push(XO.of(t)),e}var Pm=C.mark({class:"cm-selectionMatch"}),vm=C.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function PO(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=ue.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=ue.Word)}function Zm(t,e,n,r){return t(e.sliceDoc(n,n+1))==ue.Word&&t(e.sliceDoc(r-1,r))==ue.Word}var Xm=je.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(XO),{state:n}=t,r=n.selection;if(r.ranges.length>1)return C.none;let s=r.main,i,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return C.none;let l=n.wordAt(s.head);if(!l)return C.none;o=n.charCategorizer(s.head),i=n.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l200)return C.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(PO(o,n,s.from,s.to)&&Zm(o,n,s.from,s.to)))return C.none}else if(i=n.sliceDoc(s.from,s.to),!i)return C.none}let a=[];for(let l of t.visibleRanges){let c=new ht(n.doc,i,l.from,l.to);for(;!c.next().done;){let{from:O,to:u}=c.value;if((!o||PO(o,n,O,u))&&(s.empty&&O<=s.from&&u>=s.to?a.push(vm.range(O,u)):(O>=s.to||u<=s.from)&&a.push(Pm.range(O,u)),a.length>e.maxMatches))return C.none}}return C.set(a)}},{decorations:t=>t.decorations}),Tm=j.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Em=({state:t,dispatch:e})=>{let{selection:n}=t,r=U.create(n.ranges.map(s=>t.wordAt(s.head)||U.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Rm(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let o=!1,a=new ht(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new ht(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var Cm=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return Em({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=Rm(t,r);return s?(e(t.update({selection:t.selection.addRange(U.range(s.from,s.to),!1),effects:j.scrollIntoView(s.to)})),!0):!1},Tt=Kt.define({combine(t){return wn(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new mo(e),scrollToMatch:e=>j.scrollIntoView(e)})}});function EO(t){return t?[Tt.of(t),go]:go}var Br=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||ym(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` +`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new fo(this):new ho(this)}getCursor(e,n=0,r){let s=e.doc?e:ze.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?un(this,s,n,r):On(this,s,n,r)}},Hr=class{constructor(e){this.spec=e}};function jm(t,e,n){return(r,s,i,o)=>{if(n&&!n(r,s,i,o))return!1;let a=r>=o&&s<=o+i.length?i.slice(r-o,s-o):e.doc.sliceString(r,s);return t(a,e,r,s)}}function On(t,e,n,r){let s;return t.wholeWord&&(s=Lm(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(s=jm(t.test,e,s)),new ht(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),s)}function Lm(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=On(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}};function Am(t,e,n){return(r,s,i)=>(!n||n(r,s,i))&&t(i[0],e,r,s)}function un(t,e,n,r){let s;return t.wholeWord&&(s=_m(e.charCategorizer(e.selection.main.head))),t.test&&(s=Am(t.test,e,s)),new Dr(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:s},n,r)}function Fr(t,e){return t.slice(Ms(t,e,!1),e)}function Kr(t,e){return t.slice(e,Ms(t,e))}function _m(t){return(e,n,r)=>!r[0].length||(t(Fr(r.input,r.index))!=ue.Word||t(Kr(r.input,r.index))!=ue.Word)&&(t(Kr(r.input,r.index+r[0].length))!=ue.Word||t(Fr(r.input,r.index+r[0].length))!=ue.Word)}var fo=class extends Hr{nextMatch(e,n,r){let s=un(this.spec,e,r,e.doc.length).next();return s.done&&(s=un(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),o=un(this.spec,e,i,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==n||a.from>i+10))return a;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=un(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}},In=oe.define(),xo=oe.define(),ut=xe.define({create(t){return new Wn(po(t).create(),null)},update(t,e){for(let n of e.effects)n.is(In)?t=new Wn(n.value.create(),t.panel):n.is(xo)&&(t=new Wn(t.query,n.value?Qo:null));return t},provide:t=>qa.from(t,e=>e.panel)});var Wn=class{constructor(e,n){this.query=e,this.panel=n}},Mm=C.mark({class:"cm-searchMatch"}),qm=C.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ym=je.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(ut))}update(t){let e=t.state.field(ut);(e!=t.startState.field(ut)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return C.none;let{view:n}=this,r=new La;for(let s=0,i=n.visibleRanges,o=i.length;si[s+1].from-500;)l=i[++s].to;t.highlight(n.state,a,l,(c,O)=>{let u=n.state.selection.ranges.some(h=>h.from==c&&h.to==O);r.add(c,O,u?qm:Mm)})}return r.finish()}},{decorations:t=>t.decorations});function Dn(t){return e=>{let n=e.state.field(ut,!1);return n&&n.query.spec.valid?t(e,n):jO(e)}}var Jr=Dn((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=U.single(r.from,r.to),i=t.state.facet(Tt);return t.dispatch({selection:s,effects:[$o(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),CO(t),!0}),es=Dn((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=U.single(s.from,s.to),o=t.state.facet(Tt);return t.dispatch({selection:i,effects:[$o(t,s),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),CO(t),!0}),zm=Dn((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:U.create(n.map(r=>U.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Um=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],o=0;for(let a=new ht(t.doc,t.sliceDoc(r,s));!a.next().done;){if(i.length>1e3)return!1;a.value.from==r&&(o=i.length),i.push(U.range(a.value.from,a.value.to))}return e(t.update({selection:U.create(i,o),userEvent:"select.search.matches"})),!0},vO=Dn((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let o=i,a=[],l,c,O=[];o.precise?o.from==r&&o.to==s&&(c=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(n,o.from,o.to),O.push(j.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):o=e.nextMatch(n,o.from,o.to);let u=t.state.changes(a);return o&&(l=U.single(o.from,o.to).map(u),O.push($o(t,o)),O.push(n.facet(Tt).scrollToMatch(l.main,t))),t.dispatch({changes:u,selection:l,effects:O,userEvent:"input.replace"}),!0}),Wm=Dn((t,{query:e})=>{if(t.state.readOnly)return!1;let n=[];for(let s of e.matchAll(t.state,1e9)){let{from:i,to:o,precise:a}=s;a&&n.push({from:i,to:o,insert:e.getReplacement(s)})}if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:j.announce.of(r),userEvent:"input.replace.all"}),!0});function Qo(t){return t.state.facet(Tt).createPanel(t)}function po(t,e){var n,r,s,i,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(Tt);return new Br({search:((n=e?.literal)!==null&&n!==void 0?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:c.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function RO(t){let e=Us(t,Qo);return e&&e.dom.querySelector("[main-field]")}function CO(t){let e=RO(t);e&&e==t.root.activeElement&&e.select()}var jO=t=>{let e=t.state.field(ut,!1);if(e&&e.panel){let n=RO(t);if(n&&n!=t.root.activeElement){let r=po(t.state,e.query.spec);r.valid&&t.dispatch({effects:In.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[xo.of(!0),e?In.of(po(t.state,e.query.spec)):oe.appendConfig.of(go)]});return!0},LO=t=>{let e=t.state.field(ut,!1);if(!e||!e.panel)return!1;let n=Us(t,Qo);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:xo.of(!1)}),!0},AO=[{key:"Mod-f",run:jO,scope:"editor search-panel"},{key:"F3",run:Jr,shift:es,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Jr,shift:es,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:LO,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Um},{key:"Mod-Alt-g",run:Sm},{key:"Mod-d",run:Cm,preventDefault:!0}],mo=class{constructor(e){this.view=e;let n=this.query=e.state.field(ut).query.spec;this.commit=this.commit.bind(this),this.searchField=ye("input",{value:n.search,placeholder:ve(e,"Find"),"aria-label":ve(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ye("input",{value:n.replace,placeholder:ve(e,"Replace"),"aria-label":ve(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ye("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=ye("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=ye("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,o){return ye("button",{class:"cm-button",name:s,onclick:i,type:"button"},o)}this.dom=ye("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>Jr(e),[ve(e,"next")]),r("prev",()=>es(e),[ve(e,"previous")]),r("select",()=>zm(e),[ve(e,"all")]),ye("label",null,[this.caseField,ve(e,"match case")]),ye("label",null,[this.reField,ve(e,"regexp")]),ye("label",null,[this.wordField,ve(e,"by word")]),...e.state.readOnly?[]:[ye("br"),this.replaceField,r("replace",()=>vO(e),[ve(e,"replace")]),r("replaceAll",()=>Wm(e),[ve(e,"replace all")])],ye("button",{name:"close",onclick:()=>LO(e),"aria-label":ve(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Br({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:In.of(e)}))}keydown(e){_a(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?es:Jr)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),vO(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(In)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Tt).top}};function ve(t,e){return t.state.phrase(e)}var Wr=30,Ir=/[\s\.,:;?!]/;function $o(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-Wr),o=Math.min(s,n+Wr),a=t.state.sliceDoc(i,o);if(i!=r.from){for(let l=0;la.length-Wr;l--)if(!Ir.test(a[l-1])&&Ir.test(a[l])){a=a.slice(0,l);break}}return j.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}var Im=j.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),go=[ut,Ye.low(Ym),Im];function $(t,e){return typeof document<"u"&&document.documentElement.lang.toLowerCase().startsWith("zh")?t:e}function re(t,e,n=""){let r=t.state.changeByRange(s=>{let{from:i,to:o}=s,a=t.state.sliceDoc(i-e.length,i),l=t.state.sliceDoc(o,o+e.length);if(a===e&&l===e)return{changes:[{from:i-e.length,to:i,insert:""},{from:o,to:o+e.length,insert:""}],range:U.range(i-e.length,o-e.length)};let c=t.state.sliceDoc(i,o)||n;return{changes:{from:i,to:o,insert:e+c+e},range:U.range(i+e.length,i+e.length+c.length)}});return t.dispatch(r,{scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function te(t,e){let{state:n}=t,r=[],s=new Set;for(let a of n.selection.ranges)for(let l=n.doc.lineAt(a.from).number;l<=n.doc.lineAt(a.to).number;l++)s.add(l);let i=/^(\s*)(#{1,6}\s+|>\s?|[-*+]\s+\[[ xX]\]\s+|[-*+]\s+|\d+[.)]\s+)?/;for(let a of s){let l=n.doc.line(a),c=i.exec(l.text),O=c[1],u=c[2]??"",h=l.from+O.length,d=h+u.length;r.push({from:h,to:d,insert:u===e?"":e})}let o=n.changes(r);return t.dispatch({changes:o,selection:n.selection.map(o,1),scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function Et(t,e,n=!1){let{state:r}=t,s=r.selection.main,i=e;if(n){let o=r.doc.lineAt(s.from);s.from===o.from||(i=` +`+i);let l=r.doc.lineAt(s.to);(s.to!==l.to||l.number===r.doc.lines)&&(i+=` +`)}t.dispatch({changes:{from:s.from,to:s.to,insert:i},selection:{anchor:s.from+i.length},scrollIntoView:!0,userEvent:"input"}),t.focus()}function Rt(t){let e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to)||$("\u94FE\u63A5","link"),r=`[${n}](https://)`;return t.dispatch({changes:{from:e.from,to:e.to,insert:r},selection:U.range(e.from+n.length+3,e.from+r.length-1),userEvent:"input"}),t.focus(),!0}function Ct(t){let e=t.state.selection.main,n=t.state.sliceDoc(e.from,e.to);return t.dispatch({changes:{from:e.from,to:e.to,insert:`[[${n}]]`},selection:{anchor:e.from+2+n.length},userEvent:"input"}),t.focus(),!0}function ko(t){let e=t.trim();return e.startsWith('"')&&e.endsWith('"')&&e.length>=2||e.startsWith("'")&&e.endsWith("'")&&e.length>=2?e.slice(1,-1):e==="true"||e==="false"?e==="true":/^[-+]?\d+(\.\d+)?$/.test(e)&&e.length<16?Number(e):(e=e.replace(/\s+#.*$/,""),e)}function Dm(t){return t.slice(1,-1).split(",").map(e=>String(ko(e))).filter(Boolean)}function ft(t){if(!/^---[ \t]*\r?\n/.test(t))return null;let e=t.split(` +`),n=-1;for(let a=1;ar.from<=n&&r.to>=e)}function vo(t){let e=t.sliceDoc(0,Math.min(t.doc.length,2e4)),n=ft(e);return n?{from:0,to:t.doc.line(n.endLine+1).to}:null}var wo=class extends fe{constructor(n){super();this.src=n}eq(n){return n.src===this.src}toDOM(){let n=document.createElement("div");n.className="cm-props";let r=ft(this.src+` +`);if(!r||!r.keys.length)return n.classList.add("cm-props-empty"),n.textContent=$("\u5C5E\u6027","Properties"),n;for(let s of r.keys){let i=document.createElement("div");i.className="cm-prop";let o=document.createElement("span");o.className="cm-prop-key",o.textContent=s;let a=document.createElement("span");a.className="cm-prop-val";let l=r.props[s];if(Array.isArray(l))for(let c of l){let O=document.createElement("span");O.className="cm-prop-chip",O.textContent=c,a.append(O)}else typeof l=="boolean"?a.textContent=l?"\u2713":"\u2717":a.textContent=ts(l)||"\u2014";i.append(o,a),n.append(i)}return n}ignoreEvent(){return!1}},Po=class extends fe{constructor(n,r,s){super();this.src=n;this.stamp=r;this.opts=s}eq(n){return n.src===this.src&&n.stamp===this.stamp}get estimatedHeight(){return 160}toDOM(){let n=document.createElement("div");if(n.className="cm-query prose-ivy",!this.opts.query)return n.classList.add("cm-query-note"),n.textContent=$("\u7B14\u8BB0\u67E5\u8BE2\uFF1A\u5728\u7F51\u9875\u7248\u6216\u684C\u9762\u7248\u4E2D\u663E\u793A\u7ED3\u679C\u3002","Note query: its results show in the web and desktop apps."),n;let r;try{r=this.opts.query(this.src)}catch(c){return n.classList.add("cm-query-error"),n.textContent=$("\u67E5\u8BE2\u65E0\u6CD5\u7406\u89E3\u8FD9\u4E00\u884C\uFF1A","The query does not understand: ")+String(c.message??c),n}let s=document.createElement("div");if(s.className="cm-query-head",s.textContent=$(`\u67E5\u8BE2 \xB7 ${r.total} \u7BC7\u7B14\u8BB0`,`Query \xB7 ${r.total} ${r.total===1?"note":"notes"}`)+(r.total>r.rows.length?$(`\uFF08\u663E\u793A\u524D ${r.rows.length} \u7BC7\uFF09`,` (first ${r.rows.length})`):""),n.append(s),!r.rows.length){let c=document.createElement("div");return c.className="cm-query-empty",c.textContent=$("\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u7B14\u8BB0\u3002","No notes match."),n.append(c),n}let i=document.createElement("div");i.className="cm-query-scroll";let o=document.createElement("table"),a=o.createTHead().insertRow();for(let c of[$("\u6807\u9898","Title"),...r.columns]){let O=document.createElement("th");O.textContent=c,a.append(O)}let l=o.createTBody();for(let c of r.rows){let O=l.insertRow(),u=O.insertCell(),h=document.createElement("a");h.className="wikilink",h.dataset.note=c.id,h.dataset.title=c.title,h.textContent=c.title||$("\u65E0\u6807\u9898","Untitled"),u.append(h);for(let d of c.cells)O.insertCell().textContent=d}if(r.stats.some(Boolean)&&r.rows.length>=2){let c=o.createTFoot().insertRow();c.className="cm-table-total";let O=c.insertCell();O.className="cm-table-total-label",O.textContent=$("\u5408\u8BA1","Total"),r.stats.forEach(u=>{let h=c.insertCell();u&&(h.textContent=Ae(u.sum,u),h.title=$(`\u5E73\u5747 ${Ae(u.avg,u,2)}`,`Average ${Ae(u.avg,u,2)}`))})}return i.append(o),n.append(i),n}ignoreEvent(){return!1}};function Nm(t){let e=[];return I(t).iterate({enter(n){if(n.name!=="FencedCode")return;let r=n.node.getChild("CodeInfo");if(!r||t.sliceDoc(r.from,r.to).trim().toLowerCase()!=="ivy-query")return!1;let s=n.node.getChild("CodeText");return e.push({from:n.from,to:n.to,src:s?t.sliceDoc(s.from,s.to):""}),!1}}),e}function MO(t,e,n,r){let s=[],i=vo(t);i&&!(e&&So(t,i.from,i.to))&&s.push(C.replace({widget:new wo(t.sliceDoc(i.from,i.to)),block:!0}).range(i.from,i.to));for(let o of Nm(t)){if(e&&So(t,o.from,o.to))continue;let a=t.doc.lineAt(o.from).from,l=t.doc.lineAt(o.to).to;s.push(C.replace({widget:new Po(o.src,n,r),block:!0}).range(a,l))}return C.set(s,!0)}function qO(t,e,n,r){return!(r&&So(t,e,n))}function YO(t){let e=0;return[xe.define({create:r=>({focused:!1,deco:MO(r,!1,e,t)}),update(r,s){let i=r.focused,o=!1;for(let a of s.effects)a.is(_O)&&(i=a.value),a.is(Gm)&&(o=!0);return o&&e++,o||i!==r.focused||s.docChanged||s.selection||I(s.startState)!==I(s.state)?{focused:i,deco:MO(s.state,i,e,t)}:r},provide:r=>j.decorations.from(r,s=>s.deco)}),j.focusChangeEffect.of((r,s)=>_O.of(s)),j.domEventHandlers({mousedown(r,s){let i=r.target,o=i.closest(".cm-query a[data-note]");if(o)return r.preventDefault(),t.openNote(o.dataset.note??"",o.dataset.title??"",r.button===1||r.shiftKey),!0;let a=i.closest(".cm-props, .cm-query");if(!a)return!1;if(i.closest(".cm-query-scroll")&&!(r.metaKey||r.ctrlKey))return!0;r.preventDefault();let l=s.posAtDOM(a),c=s.state.doc.lineAt(l),O=c.number23||Number(e[2])>59?"":`${Oe(Number(e[1]))}:${e[2]}`}function Bn(t){let e=t.trim().toLowerCase();if(e==="every weekday")return{every:1,unit:"weekday",text:t.trim()};let n=/^every\s+(?:(\d{1,3})\s+)?(day|week|month|year)s?$/.exec(e);if(!n)return null;let r=n[1]?Number(n[1]):1;return r<1?null:{every:r,unit:n[2],text:t.trim()}}function ss(t){let e=UO.exec(t);if(!e)return null;let n=e[4],r=Gn.exec(n),s=r&&nt(r[1])?r[1]:"",i=ns.exec(n),o=Zo.exec(n),a=n.replace(Gn,"").replace(ns,"").replace(Zo,"").replace(/\s+/g," ").trim();return{done:e[2]!==" ",text:a,due:s?{date:s,time:r?.[2]?Bm(r[2]):""}:null,repeat:o?Bn(o[1]):null,doneDate:i?.[1]??"",raw:t}}function rs(t){return`\u{1F4C5} ${t.date}${t.time?" "+t.time:""}`}function Xo(t,e,n){if(e&&n===void 0&&Gn.test(t))return t.replace(Gn,rs(e));let r=t.replace(new RegExp("\\s*"+Gn.source,"u"),"");n!==void 0&&(r=r.replace(new RegExp("\\s*"+Zo.source,"u"),o=>o.endsWith(" ")?" ":"")),r=r.replace(/\s+$/,"");let s=[];if(e&&s.push(rs(e)),n&&s.push(`\u{1F501} ${n}`),!s.length)return r;let i=r.search(/\s*✅/u);return i>=0?r.slice(0,i)+" "+s.join(" ")+r.slice(i):r+" "+s.join(" ")}function zO(t,e){let n=t.getDate(),r=new Date(t.getFullYear(),t.getMonth()+e,1),s=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();return r.setDate(Math.min(n,s)),r}function Hm(t,e){let n=nt(t);if(!n)return t;switch(e.unit){case"day":return n.setDate(n.getDate()+e.every),ne(n);case"week":return n.setDate(n.getDate()+7*e.every),ne(n);case"month":return ne(zO(n,e.every));case"year":return ne(zO(n,12*e.every));case"weekday":{do n.setDate(n.getDate()+1);while(n.getDay()===0||n.getDay()===6);return ne(n)}}}function WO(t,e,n){let r=t.split(` +`),s=r[e],i=s===void 0?null:UO.exec(s);if(!i)return t;if(i[2]!==" ")return r[e]=(i[1]+" "+i[3]+i[4].replace(new RegExp("\\s*"+ns.source,"u"),"")).replace(/\s+$/,""),r.join(` +`);let a=ss(s);if(!a.due&&!a.repeat)return r[e]=`${i[1]}x${i[3]}${i[4]}`,r.join(` +`);let l=i[4].replace(new RegExp("\\s*"+ns.source,"u"),"").replace(/\s+$/,"");if(r[e]=`${i[1]}x${i[3]}${l} \u2705 ${n}`,a.repeat&&a.due){let c=Xo(i[1]+" "+i[3]+l,{date:Hm(a.due.date,a.repeat),time:a.due.time});r.splice(e,0,c)}return r.join(` +`)}var Hn={\u96F6:0,"\u3007":0,\u4E00:1,\u4E8C:2,\u4E24:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10},Fm={\u65E5:0,\u5929:0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6},Km={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function Lt(t){return/^\d+$/.test(t)?Number(t):t==="\u5341"?10:t.startsWith("\u5341")?10+(Hn[t[1]]??0):t.endsWith("\u5341")?(Hn[t[0]]??0)*10:t.length===3&&t[1]==="\u5341"?(Hn[t[0]]??0)*10+(Hn[t[2]]??0):Hn[t]??NaN}var At="(\\d{1,4}|[\u96F6\u3007\u4E00\u4E8C\u4E24\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341]{1,3})";function $e(t,e){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate());return n.setDate(n.getDate()+e),n}function jt(t,e,n){if(n){let s=(t.getDay()+6)%7,i=$e(t,7-s);return $e(i,(e+6)%7)}let r=(e-t.getDay()+7)%7;return r===0&&(r=7),$e(t,r)}function Jm(t){let e=t,n="",r="",s=/(凌晨|早上|早晨|上午|中午|下午|傍晚|晚上|今晚|明晚|夜里)/.exec(e);s&&(r=s[1],r==="\u4ECA\u665A"?e=e.replace("\u4ECA\u665A","\u4ECA\u5929"):r==="\u660E\u665A"?e=e.replace("\u660E\u665A","\u660E\u5929"):e=e.replace(r," "));let i=/\b(\d{1,2})(?::(\d{2}))?\s*(am|pm)\b/i.exec(e),o=/(\d{1,2})[::](\d{2})/.exec(e),a=new RegExp(At+"\\s*[\u70B9\u9EDE\u65F6](\u534A|\u4E00\u523B|\u4E09\u523B|"+At+"\u5206?)?").exec(e),l=-1,c=0;if(i)l=Number(i[1])%12+(i[3].toLowerCase()==="pm"?12:0),c=i[2]?Number(i[2]):0,e=e.replace(i[0]," ");else if(o)l=Number(o[1]),c=Number(o[2]),e=e.replace(o[0]," ");else if(a){l=Lt(a[1]);let O=a[2];c=O?O==="\u534A"?30:O==="\u4E00\u523B"?15:O==="\u4E09\u523B"?45:Lt(a[3]??"0"):0,e=e.replace(a[0]," ")}else r&&(l={\u51CC\u6668:6,\u65E9\u4E0A:8,\u65E9\u6668:8,\u4E0A\u5348:9,\u4E2D\u5348:12,\u4E0B\u5348:15,\u508D\u665A:18,\u665A\u4E0A:20,\u4ECA\u665A:20,\u660E\u665A:20,\u591C\u91CC:22}[r]);return l>=0&&l<12&&/下午|傍晚|晚上|今晚|明晚|夜里/.test(r)&&(l+=12),l===12&&r==="\u51CC\u6668"&&(l=0),l>=0&&l<=23&&c>=0&&c<=59&&!Number.isNaN(l)&&!Number.isNaN(c)&&(n=`${Oe(l)}:${Oe(c)}`),{time:n,rest:e}}function eg(t,e){let n=t.trim().toLowerCase(),r,s=[[/大后天/,3],[/后天|day after tomorrow/,2],[/明天|明日|tomorrow|tmr/,1],[/今天|今日|today|tonight/,0],[/昨天|yesterday/,-1]];for(let[i,o]of s)if(i.test(n))return{date:$e(e,o),rest:n.replace(i," ")};if(r=/(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})[日号]?/.exec(n))return{date:nt(`${r[1]}-${Oe(Number(r[2]))}-${Oe(Number(r[3]))}`),rest:n.replace(r[0]," ")};if((r=new RegExp("(?:^|[^\\d])(\\d{1,2})[-/.\u6708](\\d{1,2})[\u65E5\u53F7]?").exec(n))||(r=new RegExp(At+"\u6708"+At+"[\u65E5\u53F7]?").exec(n))){let i=Lt(r[1]),o=Lt(r[2]),a=nt(`${e.getFullYear()}-${Oe(i)}-${Oe(o)}`);return a&&a<$e(e,0)&&(a=nt(`${e.getFullYear()+1}-${Oe(i)}-${Oe(o)}`)),{date:a,rest:n.replace(r[0]," ")}}if((r=new RegExp(At+"\\s*(\u5929|\u65E5|\u5468|\u661F\u671F|\u793C\u62DC|\u4E2A\u6708|\u6708|\u5E74)[\u4EE5\u4E4B]?\u540E").exec(n))||(r=/in\s+(\d{1,3})\s+(day|week|month|year)s?/.exec(n))){let i=Lt(r[1]),o=r[2],a;return/天|日|day/.test(o)?a=$e(e,i):/周|星期|礼拜|week/.test(o)?a=$e(e,7*i):/月|month/.test(o)?a=new Date(e.getFullYear(),e.getMonth()+i,Math.min(e.getDate(),new Date(e.getFullYear(),e.getMonth()+i+1,0).getDate())):a=new Date(e.getFullYear()+i,e.getMonth(),e.getDate()),{date:a,rest:n.replace(r[0]," ")}}if(r=/(下下|下个?|这个?|本)?(周|星期|礼拜)([一二三四五六日天])/.exec(n)){let i=Fm[r[3]],o;if(r[1]==="\u4E0B\u4E0B")o=$e(jt(e,i,!0),7);else if(r[1]?.startsWith("\u4E0B"))o=jt(e,i,!0);else{let a=(e.getDay()+6)%7,l=$e(e,-a+(i+6)%7);o=!r[1]&&l<$e(e,0)?jt(e,i,!1):l}return{date:o,rest:n.replace(r[0]," ")}}if(r=/(next\s+)?(sun|mon|tue|wed|thu|fri|sat)[a-z]*/.exec(n))return{date:jt(e,Km[r[2]],!!r[1]),rest:n.replace(r[0]," ")};if(r=/下个?周|next week/.exec(n))return{date:jt(e,1,!0),rest:n.replace(r[0]," ")};if(r=/下个?月|next month/.exec(n))return{date:new Date(e.getFullYear(),e.getMonth()+1,1),rest:n.replace(r[0]," ")};if(r=/月底|end of month/.exec(n))return{date:new Date(e.getFullYear(),e.getMonth()+1,0),rest:n.replace(r[0]," ")};if(r=new RegExp("(?:^|\\s)"+At+"[\u65E5\u53F7](?!\u540E)").exec(n)){let i=Lt(r[1]),o=nt(`${e.getFullYear()}-${Oe(e.getMonth()+1)}-${Oe(i)}`);if(o&&o<$e(e,0)){let a=new Date(e.getFullYear(),e.getMonth()+1,1);o=nt(`${a.getFullYear()}-${Oe(a.getMonth()+1)}-${Oe(i)}`)}return{date:o,rest:n.replace(r[0]," ")}}return{date:null,rest:n}}function DO(t,e=new Date){let n=t.trim();if(!n)return null;let r=/半/.test(n),s=new RegExp("^(?:\u8FC7)?"+At+"?\\s*(\u4E2A)?\\s*(\u5206\u949F|\u5206|\u5C0F\u65F6|\u949F\u5934|min|mins|minutes?|h|hrs?|hours?)\\s*(?:\u540E|\u4EE5\u540E|\u4E4B\u540E|later)?$","i").exec(n.replace(/半/g,"")),i=/^in\s+(\d{1,4}|an?|half an?)\s*(min|mins|minutes?|h|hrs?|hours?)$/i.exec(n);if(s||i){let u,h;if(i?(u=/^half/i.test(i[1])?.5:/^an?$/i.test(i[1])?1:Number(i[1]),h=i[2]):(u=(s[1]?Lt(s[1]):r?0:1)+(r?.5:0),h=s[3]),!Number.isFinite(u)||u<=0)return null;let d=/^(分|min)/i.test(h)?u:u*60;if(d>1440*7)return null;let p=new Date(Math.ceil((e.getTime()+d*6e4)/6e4)*6e4);return{date:ne(p),time:Nn(p)}}let{time:o,rest:a}=Jm(n),{date:l,rest:c}=eg(a,e);if(c.replace(/[\s,,的@在于到前]+/g,"").replace(/^(at|on|by)$/,""))return null;if(l)return{date:ne(l),time:o};if(!o)return null;let O=ne(e);return{date:o>Nn(e)?O:ne($e(e,1)),time:o}}function To(t=new Date){let e=jt(t,6,!1),n=jt(t,1,!0),r=t.getHours()<20?[{label:["\u4ECA\u665A 20:00","Tonight 20:00"],due:{date:ne(t),time:"20:00"}}]:[];return[{label:["\u4ECA\u5929","Today"],due:{date:ne(t),time:""}},...r,{label:["\u660E\u5929 09:00","Tomorrow 09:00"],due:{date:ne($e(t,1)),time:"09:00"}},{label:["\u660E\u5929","Tomorrow"],due:{date:ne($e(t,1)),time:""}},{label:["\u5468\u672B","This weekend"],due:{date:ne(e),time:""}},{label:["\u4E0B\u5468\u4E00","Next Monday"],due:{date:ne(n),time:""}}]}var tg=["\u5468\u65E5","\u5468\u4E00","\u5468\u4E8C","\u5468\u4E09","\u5468\u56DB","\u5468\u4E94","\u5468\u516D"],ng=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],IO=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function dt(t,e=new Date,n=!0){let r=nt(t.date);if(!r)return t.date;let s=new Date(e.getFullYear(),e.getMonth(),e.getDate()),i=Math.round((r.getTime()-s.getTime())/864e5),o;return i===0?o=n?"\u4ECA\u5929":"Today":i===1?o=n?"\u660E\u5929":"Tomorrow":i===2&&n?o="\u540E\u5929":i===-1?o=n?"\u6628\u5929":"Yesterday":i>1&&i<7?o=n?tg[r.getDay()]:ng[r.getDay()]:r.getFullYear()===e.getFullYear()?o=n?`${r.getMonth()+1}\u6708${r.getDate()}\u65E5`:`${IO[r.getMonth()]} ${r.getDate()}`:o=n?`${r.getFullYear()}\u5E74${r.getMonth()+1}\u6708${r.getDate()}\u65E5`:`${IO[r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`,t.time?`${o} ${t.time}`:o}function Fn(t,e=!0){let n={day:"\u5929",week:"\u5468",month:"\u4E2A\u6708",year:"\u5E74"};return t.unit==="weekday"?e?"\u6BCF\u4E2A\u5DE5\u4F5C\u65E5":"Every weekday":e?t.every===1?{day:"\u6BCF\u5929",week:"\u6BCF\u5468",month:"\u6BCF\u6708",year:"\u6BCF\u5E74"}[t.unit]??t.text:`\u6BCF ${t.every} ${n[t.unit]??t.unit}`:t.text.replace(/^every/i,"Every")}var Eo=[["","\u4E0D\u91CD\u590D","Never"],["every day","\u6BCF\u5929","Every day"],["every weekday","\u6BCF\u4E2A\u5DE5\u4F5C\u65E5","Every weekday"],["every week","\u6BCF\u5468","Every week"],["every 2 weeks","\u6BCF 2 \u5468","Every 2 weeks"],["every month","\u6BCF\u6708","Every month"],["every year","\u6BCF\u5E74","Every year"]];var rt=()=>$("zh","en")==="zh",Ro=/^\s*(?:[-*+]|\d+[.)])\s+\[[ xX]\]/,VO=/(📅️?\s*\d{4}-\d{2}-\d{2}(?:[ T]\d{1,2}:\d{2})?)|(🔁️?\s*every(?:\s+\d{1,3})?\s+(?:weekday|day|week|month|year)s?)|(✅️?\s*\d{4}-\d{2}-\d{2})/giu;function rg(t,e){if(e)return"cm-due cm-due-done";let n=ne(new Date);return t.date{if(s.preventDefault(),s.stopPropagation(),n.state.readOnly)return;let i=Number(r.dataset.dueLine);i>=1&&i<=n.state.doc.lines&&_t(n,n.state.doc.line(i).from,r)})),r}ignoreEvent(){return!0}};function GO(t,e){let{state:n}=t,r=[],s=new Set;if(e)for(let o of n.selection.ranges)for(let a=n.doc.lineAt(o.from).number;a<=n.doc.lineAt(o.to).number;a++)s.add(a);let i=new Date;for(let{from:o,to:a}of t.visibleRanges){let l=o;for(;l<=a;){let c=n.doc.lineAt(l);if(l=c.to+1,!Ro.test(c.text)||!/[📅🔁✅]/u.test(c.text))continue;let O=ss(c.text);if(O){if(s.has(c.number)){for(let u of c.text.matchAll(VO))r.push(C.mark({class:"cm-due-src"}).range(c.from+u.index,c.from+u.index+u[0].length));continue}for(let u of c.text.matchAll(VO)){let h=c.from+u.index,d=h+u[0].length,p;if(u[1]){if(!O.due)continue;p=new Kn("\u{1F4C5} "+dt(O.due,i,rt()),rg(O.due,O.done),c.number,"due")}else if(u[2]){let m=Bn(u[2].replace(/^🔁️?\s*/u,""));if(!m)continue;p=new Kn("\u{1F501} "+Fn(m,rt()),"cm-due cm-due-repeat",c.number,"repeat")}else p=new Kn("\u2705 "+dt({date:u[3].replace(/^✅️?\s*/u,""),time:""},i,rt()),"cm-due cm-due-done",c.number,"done");let f=h>c.from&&n.sliceDoc(h-1,h)===" "?1:0;r.push(C.replace({widget:p}).range(h-f,d))}}}}return C.set(r,!0)}function NO(){return je.fromClass(class{decorations;constructor(t){this.decorations=GO(t,t.hasFocus)}update(t){(t.docChanged||t.viewportChanged||t.selectionSet||t.focusChanged)&&(this.decorations=GO(t.view,t.view.hasFocus))}},{decorations:t=>t.decorations,provide:t=>j.atomicRanges.of(e=>e.plugin(t)?.decorations??C.none)})}function BO(t,e){let n=t.state.doc.lineAt(e),r=n.text,s=WO(r,0,ne(new Date));s!==r&&t.dispatch({changes:{from:n.from,to:n.to,insert:s},userEvent:"input"})}function HO(){typeof window<"u"&&window.dispatchEvent(new CustomEvent("ivy-due-set"))}var is=null;function sg(t){if(Ro.test(t))return t;let e=/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)?(.*)$/.exec(t);return`${e[1]}- [ ] ${e[2]}`}function _t(t,e,n){is?.();let r=e??t.state.selection.main.head,s=t.state.doc.lineAt(r).from,i=ss(t.state.doc.lineAt(r).text),o=new Date,a=document.createElement("div");a.className="ivy-due-picker",a.setAttribute("role","dialog"),a.setAttribute("aria-label",$("\u8BBE\u7F6E\u65E5\u671F\u548C\u63D0\u9192","Date and reminder"));let l=document.createElement("div");l.className="ivy-due-quick";let c=document.createElement("input");c.type="date",c.className="ivy-due-input",c.setAttribute("aria-label",$("\u65E5\u671F","Date")),c.value=i?.due?.date??"";let O=document.createElement("input");O.type="time",O.className="ivy-due-input",O.setAttribute("aria-label",$("\u63D0\u9192\u65F6\u95F4","Reminder time")),O.value=i?.due?.time??"";let u=document.createElement("select");u.className="ivy-due-input",u.setAttribute("aria-label",$("\u91CD\u590D","Repeat"));let h=i?.repeat?.text??"";for(let[Z,M,q]of Eo){let z=document.createElement("option");z.value=Z,z.textContent=rt()?M:q,u.append(z)}if(h&&!Eo.some(([Z])=>Z===h)){let Z=document.createElement("option");Z.value=h,Z.textContent=Fn(i.repeat,rt()),u.append(Z)}u.value=h;for(let Z of To(o)){let M=document.createElement("button");M.type="button",M.className="ivy-due-chip",M.textContent=rt()?Z.label[0]:Z.label[1],M.addEventListener("click",()=>{c.value=Z.due.date,O.value=Z.due.time,Q()}),l.append(M)}let d=(Z,M)=>{let q=document.createElement("label");q.className="ivy-due-row";let z=document.createElement("span");return z.textContent=Z,q.append(z,M),q},p=document.createElement("div");p.className="ivy-due-note",p.textContent=$("\u4E0D\u586B\u65F6\u95F4\uFF1A\u5F53\u5929\u6309\u8BBE\u7F6E\u4E2D\u7684\u65F6\u95F4\u63D0\u9192\u3002","No time: reminds on the day at the time set in Settings.");let f=document.createElement("div");f.className="ivy-due-actions";let m=document.createElement("button");m.type="button",m.className="ivy-due-btn",m.textContent=$("\u79FB\u9664\u65E5\u671F","Remove date"),m.hidden=!i?.due;let b=document.createElement("button");b.type="button",b.className="ivy-due-btn ivy-due-ok",b.textContent=$("\u786E\u5B9A","Done"),f.append(m,b),a.append(l,d($("\u65E5\u671F","Date"),c),d($("\u65F6\u95F4","Time"),O),d($("\u91CD\u590D","Repeat"),u),p,f);function g(Z,M){let q=t.state.doc.lineAt(Math.min(s,t.state.doc.length)),z=sg(q.text),W=Xo(z,Z,Z&&M||null);Z||(W=W.replace(/\s+$/,"")),t.dispatch({changes:{from:q.from,to:q.to,insert:W},selection:{anchor:q.from+W.length},userEvent:"input"}),Z&&HO()}function Q(){if(!c.value){_();return}g({date:c.value,time:O.value},u.value),_(),t.focus()}b.addEventListener("click",Q),m.addEventListener("click",()=>{g(null,null),_(),t.focus()}),a.addEventListener("keydown",Z=>{Z.key==="Escape"?(Z.preventDefault(),_(),t.focus()):Z.key==="Enter"&&Z.target.tagName!=="BUTTON"&&(Z.preventDefault(),Q())});let y=window.innerWidth<560,k=null;y&&(a.classList.add("ivy-due-sheet"),k=document.createElement("div"),k.className="ivy-due-veil",document.body.append(k)),document.body.append(a);let w=y?{left:0,bottom:0,top:0}:n?.getBoundingClientRect()??t.coordsAtPos(r)??{left:40,bottom:80,top:60},P=a.offsetWidth,E=a.offsetHeight,T=Math.min(Math.max(8,w.left),window.innerWidth-P-8),L=w.bottom+6;L+E>window.innerHeight-8&&(L=Math.max(8,w.top-E-6)),y||(a.style.left=`${T}px`,a.style.top=`${L}px`);let A=Z=>{a.contains(Z.target)||_()};setTimeout(()=>document.addEventListener("mousedown",A,!0),0),setTimeout(()=>document.addEventListener("touchstart",A,!0),0);function _(){a.remove(),k?.remove(),document.removeEventListener("mousedown",A,!0),document.removeEventListener("touchstart",A,!0),is===_&&(is=null)}is=_,setTimeout(()=>(c.value?b:l.querySelector("button"))?.focus({preventScroll:!0}),20)}function FO(t){let e=t.state.doc.lineAt(t.pos);if(!Ro.test(e.text))return null;let n=e.text.slice(0,t.pos-e.from),r=/(^|\s)@([^@\n]{0,24})$/.exec(n);if(!r)return null;let s=r[2],i=t.pos-s.length-1,o=new Date,a=[],l={label:"@"+s+"\u200Bpick",displayLabel:$("\u{1F4C5} \u9009\u62E9\u65E5\u671F\u548C\u91CD\u590D\u2026","\u{1F4C5} Pick a date and repeat\u2026"),type:"text",boost:-99,apply:(O,u,h,d)=>{O.dispatch({changes:{from:h,to:d,insert:""},selection:{anchor:h}}),_t(O,h)}},c=(O,u)=>{let h=rs(O);a.some(d=>d.detail===(O.time?`${O.date} ${O.time}`:O.date))||a.push({label:"@"+s,displayLabel:u,detail:O.time?`${O.date} ${O.time}`:O.date,apply:(d,p,f,m)=>{d.dispatch({changes:{from:f,to:m,insert:h},selection:{anchor:f+h.length},userEvent:"input.complete"}),HO()},type:"text",boost:99-a.length})};if(s.trim()){let O=DO(s,o);if(!O)return null;c(O,"\u{1F4C5} "+dt(O,o,rt())),O.time||c({...O,time:"09:00"},"\u{1F4C5} "+dt({...O,time:"09:00"},o,rt()))}else for(let O of To(o))c(O.due,"\u{1F4C5} "+(rt()?O.label[0]:O.label[1]));return a.push(l),{from:i,options:a,filter:!1}}var KO=null,JO="",ig=0,hn=new Map;function jo(){return typeof document<"u"&&document.documentElement.dataset.theme==="dark"?"dark":"neutral"}async function og(){KO??=import("./chunks/mermaid.core-3W6VKKIW.js").then(n=>n.default);let t=await KO,e=jo();return JO!==e&&(t.initialize({startOnLoad:!1,securityLevel:"strict",theme:e,fontFamily:"inherit"}),JO=e),t}async function ag(t){let e=jo()+` +`+t,n=hn.get(e);if(n)return n;let r=await og(),s=`ivy-mermaid-${++ig}`;try{let{svg:i}=await r.render(s,t);return hn.size>64&&hn.delete(hn.keys().next().value),hn.set(e,i),i}finally{document.getElementById("d"+s)?.remove(),document.getElementById(s)?.remove()}}function lg(t,e){return t.classList.add("mermaid-diagram"),t.setAttribute("role","img"),t.setAttribute("aria-label","Mermaid"),ag(e).then(r=>{t.innerHTML=r,t.classList.remove("mermaid-error")},r=>{t.classList.add("mermaid-error"),t.textContent="Mermaid: "+String(r?.message??r).split(` +`)[0]})}var Co=class extends fe{constructor(n){super();this.code=n}eq(n){return n.code===this.code}toDOM(){let n=document.createElement("div");n.className="cm-mermaid";let r=jo()+` +`+this.code,s=hn.get(r);return s?(n.classList.add("mermaid-diagram"),n.innerHTML=s):(n.classList.add("cm-mermaid-loading"),lg(n,this.code).finally(()=>n.classList.remove("cm-mermaid-loading"))),n}get estimatedHeight(){return 200}ignoreEvent(){return!1}};function cg(t){let e=[];return I(t).iterate({enter(n){if(n.name!=="FencedCode")return;let r=n.node.getChild("CodeInfo");if(!r||t.sliceDoc(r.from,r.to).trim().toLowerCase()!=="mermaid")return!1;let s=n.node.getChild("CodeText");return e.push({from:n.from,to:n.to,code:s?t.sliceDoc(s.from,s.to):""}),!1}}),e}function os(t,e,n){return t.selection.ranges.some(r=>r.from<=n&&r.to>=e)}var eu=oe.define();function tu(t,e){let n=[];for(let r of cg(t)){if(e&&os(t,r.from,r.to)||!r.code.trim())continue;let s=t.doc.lineAt(r.from).from,i=t.doc.lineAt(r.to).to;n.push(C.replace({widget:new Co(r.code),block:!0}).range(s,i))}return C.set(n,!0)}function nu(){return[xe.define({create:e=>({focused:!1,deco:tu(e,!1)}),update(e,n){let r=e.focused;for(let s of n.effects)s.is(eu)&&(r=s.value);return r!==e.focused||n.docChanged||n.selection||I(n.startState)!==I(n.state)?{focused:r,deco:tu(n.state,r)}:e},provide:e=>j.decorations.from(e,n=>n.deco)}),j.focusChangeEffect.of((e,n)=>eu.of(n)),j.domEventHandlers({mousedown(e,n){let r=e.target.closest(".cm-mermaid");if(!r)return!1;let s=n.posAtDOM(r),i=n.state.doc.lineAt(s);e.preventDefault();let o=i.numbern.trim().replace(/\\\|/g,"|"))}function Og(t){let e=t.trim(),n=e.startsWith(":"),r=e.endsWith(":")&&e.length>1;return n&&r?"center":r?"right":n?"left":""}function Ao(t){let e=t.split(` +`).filter(a=>a.trim());if(e.length<2||!/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(e[1]))return null;let n=Lo(e[0]),r=Lo(e[1]).map(Og),s=e.slice(2).map(Lo),i=Math.max(n.length,r.length,...s.map(a=>a.length)),o=a=>Array.from({length:i},(l,c)=>a[c]??"");return{rows:[o(n),...s.map(o)],align:Array.from({length:i},(a,l)=>r[l]??"")}}var ug=/[ᄀ-ᅟ⺀-〾ぁ-㏿㐀-䶿一-鿿ꀀ-꓏가-힣豈-﫿︰-﹏＀-⦆¢-₩]|[\u{1F300}-\u{1FAFF}\u{20000}-\u{3FFFD}]/u;function su(t){let e=0;for(let n of t)e+=ug.test(n)?2:/[̀-ͯ​-‏️]/.test(n)?0:1;return e}function hg(t){return t.replace(/\r?\n/g," ").replace(/(?i.map(hg)),n=t.align.map((i,o)=>Math.max(i==="center"?5:i?4:3,...e.map(a=>su(a[o]??"")))),r=i=>"| "+i.join(" | ")+" |",s=t.align.map((i,o)=>{let a=n[o];return i==="center"?":"+"-".repeat(a-2)+":":i==="right"?"-".repeat(a-1)+":":i==="left"?":"+"-".repeat(a-1):"-".repeat(a)});return[r(e[0].map((i,o)=>ru(i,n[o],t.align[o]))),r(s),...e.slice(1).map(i=>r(i.map((o,a)=>ru(o,n[a],t.align[a]))))].join(` +`)}function iu(t,e,n){return{rows:[Array.from({length:t},(r,s)=>n(s+1)),...Array.from({length:e},()=>Array.from({length:t},()=>""))],align:Array.from({length:t},()=>"")}}var pt=t=>({rows:t.rows.map(e=>[...e]),align:[...t.align]});function Mt(t,e){let n=pt(t);return n.rows.splice(Math.max(1,Math.min(e,n.rows.length)),0,n.align.map(()=>"")),n}function as(t,e,n=""){let r=pt(t),s=Math.max(0,Math.min(e,r.align.length));return r.rows.forEach((i,o)=>i.splice(s,0,o===0?n:"")),r.align.splice(s,0,""),r}function ou(t,e){if(e<1||e>=t.rows.length)return t;let n=pt(t);return n.rows.splice(e,1),n}function au(t,e){if(t.align.length<=1)return null;let n=pt(t);return n.rows.forEach(r=>r.splice(e,1)),n.align.splice(e,1),n}function Mo(t,e,n){let r=e+n;if(e<1||r<1||r>=t.rows.length)return t;let s=pt(t),[i]=s.rows.splice(e,1);return s.rows.splice(r,0,i),s}function qo(t,e,n){let r=e+n;if(r<0||r>=t.align.length)return t;let s=pt(t);for(let o of s.rows){let[a]=o.splice(e,1);o.splice(r,0,a)}let[i]=s.align.splice(e,1);return s.align.splice(r,0,i),s}function ls(t,e,n){let r=pt(t);return r.align[e]=n,r}function Yo(t,e,n,r){let s=pt(t),i=s.rows.slice(1);return i.sort((o,a)=>{let l=!o[e].trim(),c=!a[e].trim();return l!==c?l?1:-1:(n?-1:1)*r(o[e],a[e])}),s.rows=[s.rows[0],...i],s}function lu(t){let e=[],n=0,r=0;return t.split(` +`).forEach((s,i)=>{if(i!==1){let o=0,a=s.indexOf("|");for(;a>=0;){let l=a+1;for(;l=s.length)break;let c=s.slice(a+1,l),O=c.length-c.trimStart().length,u=c.trim(),h=n+a+1+(u?O:Math.min(1,c.length));e.push({row:r,col:o,from:h,to:h+u.length}),o++,a=l}r++}n+=s.length+1}),e}function fg(t){return t.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function fn(t){let e=[];return I(t).iterate({enter(n){if(n.name==="Table")return e.push({from:t.doc.lineAt(n.from).from,to:t.doc.lineAt(n.to).to}),!1;if(n.name==="FencedCode"||n.name==="CodeBlock")return!1}}),e}function fu(t,e,n,r){return!0}function tr(t,e){let n;try{n=t.posAtDOM(e)}catch{return null}return fn(t.state).find(r=>n>=r.from&&n<=r.to)??null}var st=null;function se(t,e,n,r){let s=tr(t,e);if(!s)return;let i=_o(n);r&&(st={from:s.from,row:r.row,col:r.col,caret:r.caret??"end"}),i!==t.state.sliceDoc(s.from,s.to)&&t.dispatch({changes:{from:s.from,to:s.to,insert:i},userEvent:"input.table"}),r&&du(t)}function du(t){let e=st;if(!e)return!1;for(let n of t.dom.querySelectorAll(".cm-table-edit")){if(tr(t,n)?.from!==e.from)continue;let r=Ue.get(n),s=r?.cells[Math.min(e.row,r.cells.length-1)]?.[Math.min(e.col,r.model.align.length-1)];return s?(st=null,s.focus(),e.caret==="all"?qt(s,0,Jn(s).length):qt(s,e.caret),!0):!1}return!1}var Ue=new WeakMap,cs=null;function Jn(t){return t.dataset.raw??""}function cu(t){let e=window.getSelection();if(!e||!e.rangeCount||!t.contains(e.anchorNode))return 0;let n=document.createRange();return n.selectNodeContents(t),n.setEnd(e.anchorNode,e.anchorOffset),n.toString().length}function Ou(t){let e=window.getSelection();if(!e||!e.rangeCount)return[0,0];let n=e.getRangeAt(0);if(!t.contains(n.startContainer))return[0,0];let r=document.createRange();r.selectNodeContents(t),r.setEnd(n.startContainer,n.startOffset);let s=r.toString().length;return[s,s+n.toString().length]}function qt(t,e,n){t.focus({preventScroll:!1});let r=t.firstChild,s=t.textContent?.length??0,i=e==="start"?0:e==="end"?s:Math.min(e,s),o=window.getSelection();if(!o)return;let a=document.createRange();r&&r.nodeType===Node.TEXT_NODE?(a.setStart(r,i),a.setEnd(r,Math.min(n??i,s))):(a.selectNodeContents(t),a.collapse(i===0)),o.removeAllRanges(),o.addRange(a)}var zo=class extends fe{constructor(n,r){super();this.src=n;this.opts=r}eq(n){return n.src===this.src}updateDOM(n,r){let s=Ue.get(n),i=Ao(this.src);return!s||!i||!n.contains(document.activeElement)||i.rows.length!==s.model.rows.length||i.align.length!==s.model.align.length?!1:(s.model=i,i.rows.forEach((o,a)=>o.forEach((l,c)=>{let O=s.cells[a]?.[c];!O||O===document.activeElement||O.dataset.raw!==l&&(O.dataset.raw=l,O.innerHTML=this.inline(l))})),!0)}inline(n){if(!n)return"";let r=this.opts.renderBlock?.(n)??"";return r?r.replace(/^\s*
'+(r?i:H(i,!0))+`
-`:"
"+(r?i:H(i,!0))+`
+`)+i.raw,a.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}linkInText(e){if(!e.includes("["))return!1;let n=this.tokenizer.rules.inline.link;for(let r of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(n.test(r[0])&&e.charAt(r.index-1)!=="!")return!0;for(let r of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let s=r[0],i=s.lastIndexOf("[");if(!(s.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,js(s.slice(i+1,-1))))&&!(i>1&&this.linkInText(s.slice(1,i-1))))return!0}return!1}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let r=this.state.linkParenPossible;this.state.linkParenPossible=r&&e.includes(")");try{return this.#e(e,n)}finally{this.state.linkParenPossible=r}}#e(e,n){let r=e.includes("*")||e.includes("_")||e.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==xn.prototype.emStrong||this.tokenizer.del!==xn.prototype.del?this.#n(e):e;c0(this.tokenizer,r);try{return this.#t(e,r,n)}finally{O0(this.tokenizer)}}#t(e,n,r){let s=!1,i="",o=1/0;for(;e;){if(e.length(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=r.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(a=this.tokenizer.emStrong(e,n,i)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.del(e,n,i)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),r.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),r.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0,O=e.slice(1),u;this.options.extensions.startInline.forEach(h=>{u=h.call({lexer:this},O),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(i=a.raw.slice(-1)),s=!0;let c=r.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return r}#n(e){let n=e;if(this.tokens.links&&e.includes("[")){let r=this.tokenizer.rules.inline.reflinkSearch,s=i=>{let o=i.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,js(i.slice(o+1,-1))))return i;if(o>1&&i.charAt(0)!=="!"){let a=i.slice(1,o-1);if(this.linkInText(a))return"["+a.replace(r,s)+"]["+"a".repeat(i.length-o-2)+"]"}return"["+"a".repeat(i.length-2)+"]"};n=n.replace(r,s)}return n=n.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(r,s,i)=>i?"+".repeat(r.length):s?s+r.slice(s.length,-s.length).replace(/`/g,"+")+s:r),n=n.replace(this.tokenizer.rules.inline.blockSkip,(r,s,i)=>{let o=i?i.length:0;return r.slice(0,o)+"["+"a".repeat(r.length-o-2)+"]"}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n,n}infiniteLoopError(e){let n="Infinite loop on byte: "+e;if(this.options.silent)console.error(n);else throw new Error(n)}},Ls=class{options;parser;constructor(t){this.options=t||It}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(ae.notSpaceStart)?.[0],s=t?t.replace(ae.endingNewline,"")+` +`:"";return r?'
'+(n?s:Te(s,!0))+`
+`:"
"+(n?s:Te(s,!0))+`
`}blockquote({tokens:t}){return`
${this.parser.parse(t)}
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`${this.parser.parseInline(t)} `}hr(t){return`
-`}list(t){let e=t.ordered,r=t.start,n="";for(let a=0;a -`+n+" +`}list(t){let e=t.ordered,n=t.start,r="";for(let o=0;o +`+r+" `}listitem(t){return`
  • ${this.parser.parse(t.tokens)}
  • `}checkbox({checked:t}){return" '}paragraph({tokens:t}){return`

    ${this.parser.parseInline(t)}

    -`}table(t){let e="",r="";for(let i=0;i${n}`),` +`}table(t){let e="",n="";for(let s=0;s${r}`),`
    `+e+` -`+n+`
    +`+r+` `}tablerow({text:t}){return` ${t} -`}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+` -`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${H(t,!0)}`}br(t){return"
    "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:e,text:r,tokens:n,autolink:i}){let s=i?H(r,!0):this.parser.parseInline(n),a=$l(t);if(a===null)return s;t=H(a,i);let o='
    ",o}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let i=$l(t);if(i===null)return H(r);t=i;let s=`${H(r)}{let a=i[s].flat(1/0);ye(r,this.walkTokens(a,e))}):i.tokens&&ye(r,this.walkTokens(i.tokens,e))}}return r}use(...t){let e=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return t.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===!1&&(o=s.apply(this,a)),o}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),r.renderer){let i=this.defaults.renderer||new Zr(this.defaults);for(let s in r.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=r.renderer[a],l=i[a];i[a]=(...O)=>{let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c===!1?"":c??""}}n.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new ot(this.defaults);for(let s in r.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=r.tokenizer[a],l=i[a];i[a]=(...O)=>{let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c}}n.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new Ct;for(let s in r.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=r.hooks[a],l=i[a];Ct.passThroughHooks.has(s)?i[a]=O=>{if(i.options.async&&Ct.passThroughHooksRespectAsync.has(s))return(async()=>{let h=await o.call(i,O);return l.call(i,h)})();let c=o.call(i,O);return l.call(i,c)}:i[a]=(...O)=>{if(i.options.async)return(async()=>{let h=await o.apply(i,O);return h===!1&&(h=await l.apply(i,O)),h})();let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c}}n.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,s=r.walkTokens;n.walkTokens=function(a){let o=[];return ye(o,s.call(this,a)),i&&ye(o,i.call(this,a)),o}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return re.lex(t,e??this.defaults)}parser(t,e){return ne.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let n={...r},i={...this.defaults,...n},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return s(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 e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(e):e,o=await(i.hooks?await i.hooks.provideLexer(t):t?re.lex:re.lexInline)(a,i),l=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let O=await(i.hooks?await i.hooks.provideParser(t):t?ne.parse:ne.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(O):O})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer(t):t?re.lex:re.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let o=(i.hooks?i.hooks.provideParser(t):t?ne.parse:ne.parseInline)(a,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(a){return s(a)}}}onError(t,e){return r=>{if(r.message+=` -Please report this to https://github.com/markedjs/marked.`,t){let n="

    An error occurred:

    "+H(r.message+"",!0)+"
    ";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Ue=new Wi;function j(t,e){return Ue.parse(t,e)}j.options=j.setOptions=function(t){return Ue.setOptions(t),j.defaults=Ue.defaults,wl(j.defaults),j};j.getDefaults=ji;j.defaults=Ve;function nf(...t){return Ue.use(...t),j.defaults=Ue.defaults,wl(j.defaults),j}j.use=nf;j.walkTokens=function(t,e){return Ue.walkTokens(t,e)};j.parseInline=Ue.parseInline;j.Parser=ne;j.parser=ne.parse;j.Renderer=Zr;j.TextRenderer=Ei;j.Lexer=re;j.lexer=re.lex;j.Tokenizer=ot;j.Hooks=Ct;j.parse=j;var zd=j.options,qd=j.setOptions,Ad=j.walkTokens,Ld=j.parseInline;var Ed=ne.parse,Wd=re.lex;var Mi=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,Yl=/^ivy:\/\/note\/([A-Za-z0-9_-]{8,64})/;function oe(t){return t.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function zl(t){return t.toLowerCase().trim().replace(/<[^>]+>/g,"").replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-")}function sf(t){let e=new Wi({gfm:!0,breaks:!1}),r=i=>{let s=Mi.exec(i);if(s)return t.resolveResource?.(s[1])||i;let a=Yl.exec(i);return a?t.noteHref?.(a[1])??"#":i},n=0;return e.use({extensions:[{name:"wikilink",level:"inline",start:i=>i.indexOf("[["),tokenizer(i){let s=/^\[\[([^[\]\n]+?)\]\]/.exec(i);if(s)return{type:"wikilink",raw:s[0],inner:s[1]}},renderer(i){let s=fl(i.inner),a=oe(s.alias||s.target),o=t.resolveTitle?.(s.target)??"";if(!o)return`
    ${a}`;let l=(t.noteHref?.(o)??"#")+(s.heading?"#"+zl(s.heading):"");return`${a}`}},{name:"highlight",level:"inline",start:i=>i.indexOf("=="),tokenizer(i){let s=/^==([^=\n]+)==/.exec(i);if(s)return{type:"highlight",raw:s[0],text:s[1]}},renderer(i){return`${oe(i.text)}`}}],renderer:{heading({tokens:i,depth:s}){let a=this.parser.parseInline(i);return`${a} -`},image({href:i,title:s,text:a}){let o=Mi.exec(i),l=o?t.resourceKind?.(o[1]):void 0,O=oe(r(i)),c=s?` title="${oe(s)}"`:"";return l==="video"?``:l==="audio"?``:l==="file"?`\u{1F4CE} ${oe(a||"file")}`:`${oe(a)}`},link({href:i,title:s,tokens:a}){let o=this.parser.parseInline(a),l=Mi.exec(i),O=Yl.exec(i),c=oe(r(i)),h=s?` title="${oe(s)}"`:"";if(O)return`${o}`;if(l)return`\u{1F4CE} ${o}`;let p=/^https?:\/\//i.test(i);return`${o}`},listitem(i){let s=this.parser.parse(i.tokens);if(i.task){let a=n++;s=s.replace(/^]*>\s*/,"");let o=t.interactiveTasks?"":" disabled";return`
  • ${s}
  • -`}return`
  • ${s}
  • -`}}}),{marked:e,resetTasks:()=>n=0}}var ql=!1;function Al(t,e={}){let{marked:r,resetTasks:n}=sf(e);n();let i=r.parse(t,{async:!1});return e.citations&&(i=i.replace(/\[(\d{1,2})\](?![^<]*<\/a>)/g,'$1')),!ql&&typeof Dt.addHook=="function"&&(Dt.addHook("afterSanitizeAttributes",s=>{s.tagName==="A"&&s.getAttribute("target")==="_blank"&&s.setAttribute("rel","noopener noreferrer")}),ql=!0),Dt.sanitize(i,{ADD_TAGS:["video","audio"],ADD_ATTR:["target","controls","preload","data-note","data-title","data-task","data-cite","loading"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|blob):|\/|#|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i})}function Ge(t){window.IvyAndroid?.postMessage(JSON.stringify(t))}var Tr="",El=[],Xr=new Map,Rr={},vr="",P=null,Wl=new Cr,Ml=new Cr,af={zh:{placeholder:"\u5F00\u59CB\u5199\u4F5C\u2026",bold:"\u52A0\u7C97",italic:"\u659C\u4F53",strike:"\u5220\u9664\u7EBF"},en:{placeholder:"Start writing\u2026",bold:"bold",italic:"italic",strike:"strikethrough"}},Ui="zh",Ze=()=>af[Ui];function Ll(t,e){return`/res/${encodeURIComponent(t)}${e?"?thumb=1":""}`}var Ul={resolveResource:Ll,resourceKind:t=>Rr[t]??"image",resolveTitle:t=>Xr.get(kr(t.split("#")[0].split("|")[0]))??"",openNote:(t,e)=>Ge({type:"open",id:t,title:e}),renderBlock:t=>Al(t,{resolveResource:Ll,resourceKind:e=>Rr[e],resolveTitle:e=>Ul.resolveTitle(e),noteHref:()=>"#"})};function of(){return El.filter(t=>t.id!==Tr&&t.title).map(t=>({title:t.title,detail:t.folder}))}function lf(t){return[fs(),js(),Io({top:!0}),Go(),Lo({base:nt,addKeymap:!0}),ul,hl,X.lineWrapping,Ml.of(Yr(Ze().placeholder)),qs({override:[pl(of)],icons:!1,activateOnTyping:!0}),Te.of([{key:"Mod-b",run:e=>de(e,"**",Ze().bold)},{key:"Mod-i",run:e=>de(e,"*",Ze().italic)},{key:"Mod-e",run:e=>de(e,"`","code")},{key:"Mod-Shift-x",run:e=>de(e,"~~",Ze().strike)},{key:"Mod-k",run:Qi},{key:"Mod-Shift-k",run:$i},{key:"Mod-Alt-1",run:e=>V(e,"# ")},{key:"Mod-Alt-2",run:e=>V(e,"## ")},{key:"Mod-Alt-3",run:e=>V(e,"### ")},{key:"Mod-Shift-7",run:e=>V(e,"1. ")},{key:"Mod-Shift-8",run:e=>V(e,"- ")},{key:"Mod-Shift-9",run:e=>V(e,"- [ ] ")},...Ys,...an,...Ho,...ds,gs,...ms]),cl(Ul),X.contentAttributes.of({class:"cm-live"}),Wl.of(Qe.readOnly.of(t)),X.updateListener.of(e=>{if(e.focusChanged&&Ge({type:"focus",focused:e.view.hasFocus}),!e.docChanged)return;let r=e.state.doc.toString();vr=r,Ge({type:"change",id:Tr,body:r})})]}var Of=document.getElementById("editor"),Vi=-1,Gi=!1;function Vl(){if(Gi=!1,!P)return;let t=P.lineBlockAtHeight(48-P.documentTop),e=P.state.doc.lineAt(Math.min(t.from,P.state.doc.length)).number-1;e!==Vi&&(Vi=e,Ge({type:"scroll",line:e}))}window.addEventListener("scroll",()=>{Gi||(Gi=!0,requestAnimationFrame(Vl))},{passive:!0});window.ivy={load(t){Tr=t.id,vr=t.body,t.fontSize&&document.documentElement.style.setProperty("--editor-size",`${t.fontSize}px`);let e=Qe.create({doc:t.body,extensions:lf(!!t.readonly)});P?P.setState(e):P=new X({state:e,parent:Of}),P.scrollDOM.scrollTop=0,document.scrollingElement?.scrollTo(0,0),Vi=-1,Vl(),t.focus&&window.ivy.focus(!0)},setBody(t,e){if(!P||t!==Tr||e===vr)return;let r=P.state.doc.toString();if(vr=e,e===r)return;let n=0;for(;nn&&s>n&&r[i-1]===e[s-1];)i--,s--;P.dispatch({changes:{from:n,to:i,insert:e.slice(n,s)}})},setTitles(t){El=t,Xr=new Map;for(let e of t){let r=kr(e.title);r&&!Xr.has(r)&&Xr.set(r,e.id)}P?.dispatch({})},setKinds(t){let e=JSON.stringify(t)!==JSON.stringify(Rr);Rr=t,e&&P?.dispatch({})},insert(t,e=!0){!P||P.state.readOnly||gi(P,t,e)},setLanguage(t){Ui=t==="en"?"en":"zh",document.documentElement.lang=Ui==="zh"?"zh-CN":"en",P?.dispatch({effects:Ml.reconfigure(Yr(Ze().placeholder))})},setTheme(t){document.documentElement.dataset.theme=t?"dark":"light"},setReadonly(t){P?.dispatch({effects:Wl.reconfigure(Qe.readOnly.of(t))})},focus(t=!1){P&&(P.focus(),t&&P.dispatch({selection:{anchor:P.state.doc.length},scrollIntoView:!0}))},scrollToLine(t,e=!1){if(!P)return;let r=P.state.doc.line(Math.min(Math.max(1,t+1),P.state.doc.lines));P.dispatch({selection:{anchor:r.from},effects:X.scrollIntoView(r.from,{y:"start",yMargin:24})}),e&&P.focus()},command(t){if(P){switch(t){case"bold":de(P,"**",Ze().bold);break;case"italic":de(P,"*",Ze().italic);break;case"strike":de(P,"~~",Ze().strike);break;case"code":de(P,"`","code");break;case"h1":V(P,"# ");break;case"h2":V(P,"## ");break;case"h3":V(P,"### ");break;case"list":V(P,"- ");break;case"ordered":V(P,"1. ");break;case"task":V(P,"- [ ] ");break;case"quote":V(P,"> ");break;case"link":Qi(P);break;case"wiki":$i(P);break;case"rule":gi(P,"---",!0);break;case"undo":import("./chunks/dist-6TNHQW23.js").then(e=>P&&e.undo(P));return;case"redo":import("./chunks/dist-6TNHQW23.js").then(e=>P&&e.redo(P));return;case"blur":P.contentDOM.blur();return}P.focus()}}};window.addEventListener("error",t=>Ge({type:"error",message:String(t.message)}));document.addEventListener("error",t=>{let e=t.target;e&&"src"in e&&e!==window&&Ge({type:"log",message:`failed to load ${e.src}`})},!0);Ge({type:"ready"}); +`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+` +`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${Te(t,!0)}`}br(t){return"
    "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:e,text:n,tokens:r,autolink:s}){let i=s?Te(n,!0):this.parser.parseInline(r),o=Qh(t);if(o===null)return i;t=Te(o,s);let a='",a}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=Qh(t);if(s===null)return Te(n);t=s;let i=`${Te(n)}{let o=s[i].flat(1/0);xt(n,this.walkTokens(o,e))}):s.tokens&&xt(n,this.walkTokens(s.tokens,e))}}return n}use(...t){let e=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){let s=this.defaults.renderer||new Ls(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,a=n.renderer[o],l=s[o];s[o]=(...c)=>{let O=a.apply(s,c);return O===!1&&(O=l.apply(s,c)),O===!1?"":O??""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new xn(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,a=n.tokenizer[o],l=s[o];s[o]=(...c)=>{let O=a.apply(s,c);return O===!1&&(O=l.apply(s,c)),O}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new hr;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,a=n.hooks[o],l=s[o];hr.passThroughHooks.has(i)?s[o]=c=>{if(s.options.async&&hr.passThroughHooksRespectAsync.has(i))return(async()=>{let u=await a.call(s,c);return l.call(s,u)})();let O=a.call(s,c);return l.call(s,O)}:s[o]=(...c)=>{if(s.options.async)return(async()=>{let u=await a.apply(s,c);return u===!1&&(u=await l.apply(s,c)),u})();let O=a.apply(s,c);return O===!1&&(O=l.apply(s,c)),O}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let a=[];return xt(a,i.call(this,o)),s&&xt(a,s.call(this,o)),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Me.lex(t,e??this.defaults)}parser(t,e){return qe.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(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 e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,a=await(s.hooks?await s.hooks.provideLexer(t):t?Me.lex:Me.lexInline)(o,s),l=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(t):t?qe.parse:qe.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer(t):t?Me.lex:Me.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser(t):t?qe.parse:qe.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return i(o)}}}onError(t,e){return n=>{if(n.message+=` +Please report this to https://github.com/markedjs/marked.`,t){let r="

    An error occurred:

    "+Te(n.message+"",!0)+"
    ";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Wt=new Pa;function K(t,e){return Wt.parse(t,e)}K.options=K.setOptions=function(t){return Wt.setOptions(t),K.defaults=Wt.defaults,Ph(K.defaults),K};K.getDefaults=ga;K.defaults=It;function d0(...t){return Wt.use(...t),K.defaults=Wt.defaults,Ph(K.defaults),K}K.use=d0;K.walkTokens=function(t,e){return Wt.walkTokens(t,e)};K.parseInline=Wt.parseInline;K.Parser=qe;K.parser=qe.parse;K.Renderer=Ls;K.TextRenderer=wa;K.Lexer=Me;K.lexer=Me.lex;K.Tokenizer=xn;K.Hooks=hr;K.parse=K;var ZQ=K.options,XQ=K.setOptions,TQ=K.walkTokens,EQ=K.parseInline;var RQ=qe.parse,CQ=Me.lex;var va=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,Ah=/^ivy:\/\/note\/([A-Za-z0-9_-]{8,64})/;function ee(t){return t.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function _h(t){return t.toLowerCase().trim().replace(/<[^>]+>/g,"").replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-")}function p0(t){let e=new Pa({gfm:!0,breaks:!1}),n=s=>{let i=va.exec(s);if(i)return t.resolveResource?.(i[1])||s;let o=Ah.exec(s);return o?t.noteHref?.(o[1])??"#":s},r=0;return e.use({extensions:[{name:"wikilink",level:"inline",start:s=>s.indexOf("[["),tokenizer(s){let i=/^\[\[([^[\]\n]+?)\]\]/.exec(s);if(i)return{type:"wikilink",raw:i[0],inner:i[1]}},renderer(s){let i=Ju(s.inner),o=ee(i.alias||i.target),a=t.resolveTitle?.(i.target)??"";if(!a)return`
    ${o}`;let l=(t.noteHref?.(a)??"#")+(i.heading?"#"+_h(i.heading):"");return`${o}`}},{name:"highlight",level:"inline",start:s=>s.indexOf("=="),tokenizer(s){let i=/^==([^=\n]+)==/.exec(s);if(i)return{type:"highlight",raw:i[0],text:i[1]}},renderer(s){return`${ee(s.text)}`}}],renderer:{code({text:s,lang:i}){if((i??"").trim().toLowerCase()!=="ivy-query")return!1;if(!t.query)return`

    ${ee(Dt("\u7B14\u8BB0\u67E5\u8BE2\uFF1A\u5728\u5E38\u9752\u7B14\u8BB0\u4E2D\u67E5\u770B\u7ED3\u679C\u3002","Note query: open it in ivyNote to see its results."))}

    +`;try{return g0(t.query(s),t)}catch(o){return`

    ${ee(String(o.message??o))}

    +`}},heading({tokens:s,depth:i}){let o=this.parser.parseInline(s);return`${o} +`},image({href:s,title:i,text:o}){let a=va.exec(s),l=a?t.resourceKind?.(a[1]):void 0,c=ee(n(s)),O=i?` title="${ee(i)}"`:"";return l==="video"?``:l==="audio"?``:l==="file"?`\u{1F4CE} ${ee(o||"file")}`:`${ee(o)}`},link({href:s,title:i,tokens:o}){let a=this.parser.parseInline(o),l=va.exec(s),c=Ah.exec(s),O=ee(n(s)),u=i?` title="${ee(i)}"`:"";if(c)return`${a}`;if(l)return`\u{1F4CE} ${a}`;let h=/^https?:\/\//i.test(s);return`${a}`},listitem(s){let i=this.parser.parse(s.tokens);if(s.task){let o=r++;i=m0(i.replace(/^]*>\s*/,""),!!s.checked);let a=t.interactiveTasks?"":" disabled";return`
  • ${i}
  • +`}return`
  • ${i}
  • +`}}}),{marked:e,resetTasks:()=>r=0}}var Mh=!1;function m0(t,e){let n=Dt("zh","en")==="zh",r=ne(new Date);return t.replace(/📅\uFE0F?\s*(\d{4}-\d{2}-\d{2})(?:[ T](\d{1,2}:\d{2}))?/gu,(s,i,o)=>`\u{1F4C5} ${ee(dt({date:i,time:o??""},new Date,n))}`).replace(/🔁\uFE0F?\s*(every(?:\s+\d{1,3})?\s+(?:weekday|day|week|month|year)s?)/giu,(s,i)=>{let o=Bn(i);return o?`\u{1F501} ${ee(Fn(o,n))}`:s}).replace(/✅\uFE0F?\s*(\d{4}-\d{2}-\d{2})/gu,(s,i)=>`\u2705 ${ee(dt({date:i,time:""},new Date,n))}`)}function Dt(t,e){return typeof document>"u"||document.documentElement.lang.toLowerCase().startsWith("zh")?t:e}function g0(t,e={}){if(!t.rows.length)return`

    ${ee(Dt("\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u7B14\u8BB0\u3002","No notes match."))}

    +`;let n=[Dt("\u6807\u9898","Title"),...t.columns].map(i=>`${ee(i)}`).join(""),r=t.rows.map(i=>{let o=ee(e.noteHref?.(i.id)??"#"),a=ee(i.title||Dt("\u65E0\u6807\u9898","Untitled"));return`${a}${i.cells.map(l=>`${ee(l)}`).join("")}`}).join(""),s=t.stats.some(Boolean)&&t.rows.length>=2?`${ee(Dt("\u5408\u8BA1","Total"))}${t.stats.map(i=>`${i?ee(Ae(i.sum,i)):""}`).join("")}`:"";return`${n}${r}${s}
    +`}function b0(t){let e=ft(t);if(!e)return{html:"",rest:t};let n=t.slice(e.to);return e.keys.length?{html:`
    ${e.keys.map(s=>`
    ${ee(s)}
    ${ee(ts(e.props[s]))}
    `).join("")}
    +`,rest:n}:{html:"",rest:n}}function qh(t,e={}){if(lr(t))return`

    \u{1F512} ${ee(Dt("\u8FD9\u7BC7\u7B14\u8BB0\u5DF2\u7528\u5BC6\u7801\u4FDD\u62A4\u3002","This note is password protected."))}

    `;let{marked:n,resetTasks:r}=p0(e);r();let s=b0(t),i=(e.properties===!1?"":s.html)+n.parse(s.rest,{async:!1});return e.citations&&(i=i.replace(/\[(\d{1,2})\](?![^<]*<\/a>)/g,'$1')),!Mh&&typeof wr.addHook=="function"&&(wr.addHook("afterSanitizeAttributes",o=>{o.tagName==="A"&&o.getAttribute("target")==="_blank"&&o.setAttribute("rel","noopener noreferrer")}),Mh=!0),wr.sanitize(i,{ADD_TAGS:["video","audio"],ADD_ATTR:["target","controls","preload","data-note","data-title","data-task","data-cite","loading"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|blob):|\/|#|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i})}function Ve(t){window.IvyAndroid?.postMessage(JSON.stringify(t))}var kn="",Uh=[],As=new Map,_s={},mr="",R=null,Wh=new qs,Ih=new qs,x0={zh:{placeholder:"\u5F00\u59CB\u5199\u4F5C\u2026",bold:"\u52A0\u7C97",italic:"\u659C\u4F53",strike:"\u5220\u9664\u7EBF"},en:{placeholder:"Start writing\u2026",bold:"bold",italic:"italic",strike:"strikethrough"}},Za="zh",$t=()=>x0[Za];function Yh(t,e){return`/res/${encodeURIComponent(t)}${e?"?thumb=1":""}`}var Dh={resolveResource:Yh,resourceKind:t=>_s[t]??"image",resolveTitle:t=>As.get(ys(t.split("#")[0].split("|")[0]))??"",openNote:(t,e)=>Ve({type:"open",id:t,title:e}),renderBlock:t=>qh(t,{resolveResource:Yh,resourceKind:e=>_s[e],resolveTitle:e=>Dh.resolveTitle(e),noteHref:()=>"#"})};function Q0(){return Uh.filter(t=>t.id!==kn&&t.title).map(t=>({title:t.title,detail:t.folder}))}function $0(t){return[Ka(),bl(),EO({top:!0}),TO(),SO({base:cn,addKeymap:!0}),Qu,xu,j.lineWrapping,Ih.of(Ys($t().placeholder)),yl({override:[Su({hosts:["image","file"],host:e=>Ve({type:"pick",kind:e})}),FO,$u(Q0)],icons:!1,activateOnTyping:!0,maxRenderedOptions:40,...yu}),wu(),Pu(),Ne.of([{key:"Mod-b",run:e=>re(e,"**",$t().bold)},{key:"Mod-i",run:e=>re(e,"*",$t().italic)},{key:"Mod-e",run:e=>re(e,"`","code")},{key:"Mod-Shift-x",run:e=>re(e,"~~",$t().strike)},{key:"Mod-k",run:Rt},{key:"Mod-Shift-k",run:Ct},{key:"Mod-Alt-1",run:e=>te(e,"# ")},{key:"Mod-Alt-2",run:e=>te(e,"## ")},{key:"Mod-Alt-3",run:e=>te(e,"### ")},{key:"Mod-Shift-7",run:e=>te(e,"1. ")},{key:"Mod-Shift-8",run:e=>te(e,"- ")},{key:"Mod-Shift-9",run:e=>te(e,"- [ ] ")},{key:"Mod-Shift-d",run:e=>(_t(e),!0)},{key:"Mod-/",run:Bo},{key:"Mod-Shift-h",run:e=>re(e,"==")},...$l,...Oi,...AO,...tl,rl,...nl]),bu(Dh),j.contentAttributes.of({class:"cm-live"}),Wh.of(ze.readOnly.of(t)),j.updateListener.of(e=>{if(e.focusChanged&&Ve({type:"focus",focused:e.view.hasFocus}),!e.docChanged||e.transactions.every(r=>r.annotation(Sn.remote)))return;let n=Qt.edited(e.state.doc.toString());mr=n,Ve({type:"change",id:kn,body:n})})]}var zh=document.getElementById("editor"),Vh=!1;function k0(t){if(!R)return;let e=R.state.doc.toString();if(t===e)return;let n=0;for(;nn&&s>n&&e[r-1]===t[s-1];)r--,s--;R.dispatch({changes:{from:n,to:r,insert:t.slice(n,s)},annotations:Sn.remote.of(!0)})}var Qt=new Ts({lockHost:zh,show(t){let e=ze.create({doc:t,extensions:$0(Vh)});R?R.setState(e):R=new j({state:e,parent:zh}),R.scrollDOM.scrollTop=0},hide(){R?.destroy(),R=null},replace:k0,text:()=>R?.state.doc.toString()??null,emit(t){mr=t,Ve({type:"change",id:kn,body:t})},state:t=>Ve({type:"protection",id:kn,...t}),readonly:()=>!R||R.state.readOnly}),Xa=-1,Ta=!1;function Gh(){if(Ta=!1,!R)return;let t=R.lineBlockAtHeight(48-R.documentTop),e=R.state.doc.lineAt(Math.min(t.from,R.state.doc.length)).number-1;e!==Xa&&(Xa=e,Ve({type:"scroll",line:e}))}window.addEventListener("scroll",()=>{Ta||(Ta=!0,requestAnimationFrame(Gh))},{passive:!0});window.ivy={load(t){kn=t.id,mr=t.body,Vh=!!t.readonly,t.fontSize&&document.documentElement.style.setProperty("--editor-size",`${t.fontSize}px`),Qt.load(t.body),document.scrollingElement?.scrollTo(0,0),Xa=-1,Gh(),t.focus&&!Qt.isLocked&&window.ivy.focus(!0)},setBody(t,e){t!==kn||e===mr||(mr=e,Qt.external(e))},setTitles(t){Uh=t,As=new Map;for(let e of t){let n=ys(e.title);n&&!As.has(n)&&As.set(n,e.id)}R?.dispatch({})},setKinds(t){let e=JSON.stringify(t)!==JSON.stringify(_s);_s=t,e&&R?.dispatch({})},insert(t,e=!0){!R||R.state.readOnly||Et(R,t,e)},setLanguage(t){Za=t==="en"?"en":"zh",document.documentElement.lang=Za==="zh"?"zh-CN":"en",R?.dispatch({effects:Ih.reconfigure(Ys($t().placeholder))})},setTheme(t){document.documentElement.dataset.theme=t?"dark":"light"},setReadonly(t){R?.dispatch({effects:Wh.reconfigure(ze.readOnly.of(t))})},focus(t=!1){R&&(R.focus(),t&&R.dispatch({selection:{anchor:R.state.doc.length},scrollIntoView:!0}))},scrollToLine(t,e=!1){if(!R)return;let n=R.state.doc.line(Math.min(Math.max(1,t+1),R.state.doc.lines));R.dispatch({selection:{anchor:n.from},effects:j.scrollIntoView(n.from,{y:"start",yMargin:24})}),e&&R.focus()},command(t){switch(t){case"protect":Qt.protect();return;case"unprotect":Qt.unprotect();return;case"changePassword":Qt.changePassword();return;case"lock":Qt.lock();return}if(R){switch(t){case"due":_t(R);return;case"insert":Bo(R);return;case"bold":re(R,"**",$t().bold);break;case"italic":re(R,"*",$t().italic);break;case"strike":re(R,"~~",$t().strike);break;case"code":re(R,"`","code");break;case"h1":te(R,"# ");break;case"h2":te(R,"## ");break;case"h3":te(R,"### ");break;case"list":te(R,"- ");break;case"ordered":te(R,"1. ");break;case"task":te(R,"- [ ] ");break;case"quote":te(R,"> ");break;case"link":Rt(R);break;case"wiki":Ct(R);break;case"rule":Et(R,"---",!0);break;case"undo":import("./chunks/dist-6TNHQW23.js").then(e=>R&&e.undo(R));return;case"redo":import("./chunks/dist-6TNHQW23.js").then(e=>R&&e.redo(R));return;case"blur":R.contentDOM.blur();return}R.focus()}}};window.addEventListener("error",t=>Ve({type:"error",message:String(t.message)}));document.addEventListener("error",t=>{let e=t.target;e&&"src"in e&&e!==window&&Ve({type:"log",message:`failed to load ${e.src}`})},!0);Ve({type:"ready"}); diff --git a/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt b/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt index 54dc332..981b7cf 100644 --- a/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt +++ b/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt @@ -9,6 +9,7 @@ import app.ivynote.android.editor.AttachmentLoader import app.ivynote.android.editor.EditorHost import app.ivynote.android.platform.SqliteDocumentStore import app.ivynote.android.platform.networkAvailable +import app.ivynote.android.reminders.Reminders import app.ivynote.core.L10n import app.ivynote.core.AddedFile import app.ivynote.core.ApiClient @@ -30,6 +31,7 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -68,6 +70,15 @@ class LibrarySession private constructor( engine.onUploaded = { att, file -> runCatching { AttachmentLoader.store(cache, att.id, file, att.mime) } } + // Reminders follow the notes: the system's alarms are set again a + // moment after any change (guide 11.8). + scope.launch { + engine.revision.collectLatest { + delay(1_500) + val notes = engine.notes.values.toList() + withContext(Dispatchers.Default) { runCatching { Reminders.schedule(context, ref.id, notes) } } + } + } } /** @@ -180,6 +191,7 @@ class LibrarySession private constructor( fun destroy() { if (closed) return closed = true + Reminders.clear(context, ref.id) deactivate() engine.stop() editorHost?.destroy() diff --git a/app/src/main/kotlin/app/ivynote/android/MainActivity.kt b/app/src/main/kotlin/app/ivynote/android/MainActivity.kt index db2d75c..5825974 100644 --- a/app/src/main/kotlin/app/ivynote/android/MainActivity.kt +++ b/app/src/main/kotlin/app/ivynote/android/MainActivity.kt @@ -1,19 +1,78 @@ package app.ivynote.android +import android.Manifest +import android.content.Intent +import android.os.Build import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge +import androidx.activity.result.contract.ActivityResultContracts +import app.ivynote.android.reminders.Reminders import app.ivynote.android.ui.IvyTheme import app.ivynote.android.ui.ProvideStrings import app.ivynote.android.ui.RootScreen +import kotlinx.coroutines.flow.MutableStateFlow class MainActivity : ComponentActivity() { + private val askNotifications = registerForActivityResult(ActivityResultContracts.RequestPermission()) { } + override fun onCreate(savedInstanceState: Bundle?) { enableEdgeToEdge() super.onCreate(savedInstanceState) + Reminders.ensureChannel(this) + Reminders.onScheduled = { runOnUiThread { askForNotificationsOnce() } } + handle(intent) setContent { ProvideStrings { IvyTheme { RootScreen() } } } } + + override fun onDestroy() { + Reminders.onScheduled = null + super.onDestroy() + } + + override fun onNewIntent(intent: Intent) { + super.onNewIntent(intent) + handle(intent) + } + + override fun onResume() { + super.onResume() + askForNotificationsOnce() + } + + /** A tapped reminder opens its note (LibraryScreen picks the request up). */ + private fun handle(intent: Intent?) { + val note = intent?.getStringExtra(EXTRA_NOTE) ?: return + val library = intent.getStringExtra(EXTRA_LIBRARY) ?: return + openRequest.value = OpenRequest(library, note) + intent.removeExtra(EXTRA_NOTE) + } + + /** + * Android 13+ asks before an app may notify. The question comes once, the + * first time a library has a reminder to come, not at the first start. + */ + private fun askForNotificationsOnce() { + if (Build.VERSION.SDK_INT < 33 || Reminders.mayNotify(this)) return + val prefs = getSharedPreferences("ivy.app", MODE_PRIVATE) + if (prefs.getBoolean(ASKED, false)) return + val any = getSharedPreferences("ivy.reminders", MODE_PRIVATE).all.values.any { ((it as? String)?.length ?: 0) > 2 } + if (!any) return + prefs.edit().putBoolean(ASKED, true).apply() + askNotifications.launch(Manifest.permission.POST_NOTIFICATIONS) + } + + data class OpenRequest(val library: String, val note: String) + + companion object { + const val EXTRA_LIBRARY = "app.ivynote.library" + const val EXTRA_NOTE = "app.ivynote.note" + private const val ASKED = "notificationsAsked" + + /** A note to open, from a tapped reminder. */ + val openRequest = MutableStateFlow(null) + } } diff --git a/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt b/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt index 4b50fbc..9610be5 100644 --- a/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt +++ b/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt @@ -32,6 +32,7 @@ import app.ivynote.core.Language import app.ivynote.core.Attachment import app.ivynote.core.IvyJson import app.ivynote.core.Note +import app.ivynote.core.NoteLock import app.ivynote.core.SyncEngine import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow @@ -90,6 +91,15 @@ class EditorHost(appContext: Context, private val session: LibrarySession) { private val _topLine = MutableStateFlow(0) val topLine: StateFlow = _topLine.asStateFlow() + /** Whether the open note has a password (guide 8.4), and is locked now. */ + data class Protection(val protected: Boolean = false, val locked: Boolean = false) + + private val _protection = MutableStateFlow(Protection()) + val protection: StateFlow = _protection.asStateFlow() + + /** The insert menu asks for a photo ("image") or a file ("file"). */ + var onPick: ((String) -> Unit)? = null + /** A followed `[[wiki link]]`: id ("" when no such note) and title. */ var onOpenNote: ((String, String) -> Unit)? = null @@ -119,6 +129,8 @@ class EditorHost(appContext: Context, private val session: LibrarySession) { fun open(note: Note, focus: Boolean) { noteId = note.id pageBody = note.body + val sealed = NoteLock.isEncrypted(note.body) + _protection.value = Protection(protected = sealed, locked = sealed) _topLine.value = 0 sendTitles() refreshKinds() @@ -243,6 +255,13 @@ class EditorHost(appContext: Context, private val session: LibrarySession) { } "open" -> onOpenNote?.invoke(m.str("id").orEmpty(), m.str("title").orEmpty()) "focus" -> _focused.value = (m["focused"] as? JsonPrimitive)?.booleanOrNull ?: false + "pick" -> onPick?.invoke(m.str("kind").orEmpty()) + "protection" -> if (m.str("id") == noteId) { + _protection.value = Protection( + protected = (m["protected"] as? JsonPrimitive)?.booleanOrNull ?: false, + locked = (m["locked"] as? JsonPrimitive)?.booleanOrNull ?: false, + ) + } "scroll" -> _topLine.value = (m["line"] as? JsonPrimitive)?.intOrNull ?: 0 "error", "log" -> if (BuildConfig.DEBUG) Log.d("ivy", "page ${m.str("type")}: ${m.str("message")}") } diff --git a/app/src/main/kotlin/app/ivynote/android/reminders/Reminders.kt b/app/src/main/kotlin/app/ivynote/android/reminders/Reminders.kt new file mode 100644 index 0000000..2c72944 --- /dev/null +++ b/app/src/main/kotlin/app/ivynote/android/reminders/Reminders.kt @@ -0,0 +1,165 @@ +package app.ivynote.android.reminders + +import android.Manifest +import android.app.AlarmManager +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Build +import androidx.core.app.NotificationCompat +import androidx.core.app.NotificationManagerCompat +import androidx.core.content.ContextCompat +import app.ivynote.android.MainActivity +import app.ivynote.android.R +import app.ivynote.core.IvyJson +import app.ivynote.core.L10n +import app.ivynote.core.Note +import app.ivynote.core.Tasks +import app.ivynote.core.nowMillis +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.ListSerializer +import java.time.LocalTime + +/** + * Reminders for tasks with a 📅 date (guide 9.4, 11.8). Whenever a library's + * notes change, the next reminders of that library are handed to the + * system's AlarmManager, so they fire while the app is closed. They are also + * kept in preferences, to be set again after a reboot or an app update. + * Protected notes take no part: their tasks are encrypted. + */ +object Reminders { + const val CHANNEL = "reminders" + private const val PREFS = "ivy.reminders" + private const val ACTION = "app.ivynote.REMINDER" + /** How far ahead alarms are set; changes reschedule anyway. */ + private const val HORIZON_MS = 8L * 24 * 3600 * 1000 + private const val MAX = 48 + /** A date without a time reminds at this hour (as the web's default). */ + val ALL_DAY: LocalTime = LocalTime.of(9, 0) + + @Serializable + data class Pending(val key: String, val library: String, val noteId: String, val title: String, val text: String, val at: Long) + + /** Called after alarms were set for at least one reminder (any thread). */ + @Volatile var onScheduled: (() -> Unit)? = null + + private fun prefs(context: Context) = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE) + + private fun load(context: Context, library: String): List = + prefs(context).getString(library, null)?.let { runCatching { IvyJson.decodeFromString(ListSerializer(Pending.serializer()), it) }.getOrNull() } ?: emptyList() + + private fun save(context: Context, library: String, list: List) { + prefs(context).edit().putString(library, IvyJson.encodeToString(ListSerializer(Pending.serializer()), list)).apply() + } + + fun ensureChannel(context: Context) { + val nm = context.getSystemService(NotificationManager::class.java) ?: return + val ch = NotificationChannel(CHANNEL, L10n.s.reminderChannel, NotificationManager.IMPORTANCE_HIGH) + ch.description = L10n.s.reminderChannelHint + nm.createNotificationChannel(ch) + } + + private fun intent(context: Context, p: Pending): PendingIntent { + val i = Intent(context, ReminderReceiver::class.java).setAction(ACTION) + .putExtra("key", p.key).putExtra("library", p.library).putExtra("note", p.noteId) + .putExtra("title", p.title).putExtra("text", p.text) + return PendingIntent.getBroadcast(context, p.key.hashCode(), i, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) + } + + private fun set(context: Context, p: Pending) { + val am = context.getSystemService(AlarmManager::class.java) ?: return + val pi = intent(context, p) + // Exact when the system allows it; otherwise within a few minutes. + val exact = Build.VERSION.SDK_INT < Build.VERSION_CODES.S || am.canScheduleExactAlarms() + runCatching { + if (exact) am.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, p.at, pi) + else am.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, p.at, pi) + } + } + + private fun cancel(context: Context, p: Pending) { + val am = context.getSystemService(AlarmManager::class.java) ?: return + am.cancel(intent(context, p)) + } + + /** Sets the alarms of a library's next reminders, replacing the earlier ones. */ + fun schedule(context: Context, library: String, notes: Collection) { + val now = nowMillis() + val next = Tasks.reminders(notes, now, now + HORIZON_MS, ALL_DAY).take(MAX).map { + Pending(it.key, library, it.noteId, it.noteTitle, it.text, it.at) + } + val old = load(context, library) + val keep = next.map { it.key }.toSet() + for (p in old) if (p.key !in keep) cancel(context, p) + for (p in next) set(context, p) + save(context, library, next) + if (next.isNotEmpty()) onScheduled?.invoke() + } + + /** Sets every saved alarm again (after a reboot or an update). */ + fun restore(context: Context) { + val now = nowMillis() + for (library in prefs(context).all.keys) { + val list = load(context, library).filter { it.at > now - 60_000 } + list.forEach { set(context, it) } + save(context, library, list) + } + } + + /** Stops the reminders of a library (signed out, removed). */ + fun clear(context: Context, library: String) { + load(context, library).forEach { cancel(context, it) } + prefs(context).edit().remove(library).apply() + } + + fun mayNotify(context: Context): Boolean = + Build.VERSION.SDK_INT < 33 || ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED + + /** Whether the library has reminders to come (to ask for permission). */ + fun hasPending(context: Context, library: String): Boolean = load(context, library).isNotEmpty() + + internal fun show(context: Context, i: Intent) { + if (!mayNotify(context)) return + ensureChannel(context) + val title = i.getStringExtra("text").orEmpty().ifEmpty { i.getStringExtra("title").orEmpty() } + val noteTitle = i.getStringExtra("title").orEmpty() + val open = Intent(context, MainActivity::class.java) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP) + .putExtra(MainActivity.EXTRA_LIBRARY, i.getStringExtra("library")) + .putExtra(MainActivity.EXTRA_NOTE, i.getStringExtra("note")) + val key = i.getStringExtra("key").orEmpty() + val tap = PendingIntent.getActivity(context, key.hashCode(), open, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) + val n = NotificationCompat.Builder(context, CHANNEL) + .setSmallIcon(R.drawable.ivy_leaf) + .setContentTitle(title) + .setContentText(if (noteTitle.isNotEmpty()) L10n.s.reminderFrom(noteTitle) else null) + .setCategory(NotificationCompat.CATEGORY_REMINDER) + .setPriority(NotificationCompat.PRIORITY_HIGH) + .setAutoCancel(true) + .setContentIntent(tap) + .build() + // Checked here, where the call is: the permission can be withdrawn at any time. + if (Build.VERSION.SDK_INT >= 33 && + ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED + ) return + try { + NotificationManagerCompat.from(context).notify(key.hashCode(), n) + } catch (_: SecurityException) { + // Withdrawn between the check and the call: nothing to show. + } + } +} + +/** Fires a reminder; after a reboot or an update, sets the alarms again. */ +class ReminderReceiver : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + when (intent.action) { + Intent.ACTION_BOOT_COMPLETED, Intent.ACTION_MY_PACKAGE_REPLACED -> Reminders.restore(context) + else -> Reminders.show(context, intent) + } + } +} diff --git a/app/src/main/kotlin/app/ivynote/android/ui/AgendaSheet.kt b/app/src/main/kotlin/app/ivynote/android/ui/AgendaSheet.kt new file mode 100644 index 0000000..f9efba7 --- /dev/null +++ b/app/src/main/kotlin/app/ivynote/android/ui/AgendaSheet.kt @@ -0,0 +1,164 @@ +package app.ivynote.android.ui + +import android.content.Context +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight +import androidx.compose.material.icons.outlined.ErrorOutline +import androidx.compose.material.icons.outlined.Event +import androidx.compose.material3.Checkbox +import androidx.compose.material3.Icon +import androidx.compose.material3.CheckboxDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ModalBottomSheet +import androidx.compose.material3.Text +import androidx.compose.material3.rememberModalBottomSheetState +import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.draw.rotate +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import app.ivynote.android.LibrarySession +import app.ivynote.core.NoteLock +import app.ivynote.core.SyncEngine +import app.ivynote.core.Tasks +import java.time.LocalDate +import java.time.format.DateTimeFormatter + +private const val FOLDS = "ivy.agenda" + +/** + * Folded and unfolded branches, as on the web: for branches open by default + * a stored key means folded, for the others unfolded. Days gone are dropped. + */ +private fun loadToggled(context: Context): Set = + context.getSharedPreferences(FOLDS, Context.MODE_PRIVATE).getStringSet("toggled", emptySet())?.toSet() ?: emptySet() + +private fun saveToggled(context: Context, keys: Set) { + context.getSharedPreferences(FOLDS, Context.MODE_PRIVATE).edit().putStringSet("toggled", keys).apply() +} + +private fun toggle(keys: Set, key: String, tree: List): Set { + val live = tree.map { it.key }.toSet() + return (if (key in keys) keys - key else keys + key).filter { it in live }.toSet() +} + +/** + * The agenda (guide 11.8): open to-dos with a 📅 date across the library as + * a tree by day — overdue, each day of the coming week, then by month. Checking one off writes the note, as the editor would; a + * tap opens the note at the task. + */ +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AgendaSheet(lib: LibrarySession, onOpen: (noteId: String, line: Int) -> Unit, onDismiss: () -> Unit) { + val c = Ivy.colors + val s = LocalStrings.current + val engine = lib.engine + val revision by engine.revision.collectAsState() + val today = LocalDate.now() + val items = remember(revision, today) { Tasks.agenda(engine.notes.values, today) } + val tree = remember(items) { Tasks.agendaTree(items) } + val context = LocalContext.current + var toggled by remember { mutableStateOf(loadToggled(context)) } + LaunchedEffect(toggled) { saveToggled(context, toggled) } + val anyProtected = remember(revision) { engine.notes.values.any { !it.deleted && !it.isTrashed && NoteLock.isEncrypted(it.body) } } + val dateFormat = remember(s) { DateTimeFormatter.ofPattern(if (s.locale.language == "zh") "M月d日" else "MMM d", s.locale) } + + ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), containerColor = c.canvas) { + Column( + Modifier.verticalScroll(rememberScrollState()).padding(horizontal = 16.dp).navigationBarsPadding().padding(bottom = 24.dp), + verticalArrangement = Arrangement.spacedBy(2.dp), + ) { + Text(s.agenda, style = SerifTitle, fontSize = 20.sp, color = c.ink, modifier = Modifier.padding(horizontal = 4.dp, vertical = 6.dp)) + if (items.isEmpty()) { + Text(s.agendaEmpty, color = c.ink, fontSize = 15.sp, modifier = Modifier.padding(horizontal = 4.dp, vertical = 8.dp)) + Text(s.agendaEmptyHint, color = c.muted, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 4.dp)) + } + for (node in tree) { + val open = (node.key in toggled) != node.openByDefault + val label = when (node.kind) { + Tasks.AgendaNode.Kind.OVERDUE -> s.agendaOverdue + Tasks.AgendaNode.Kind.MONTH -> s.agendaMonth(node.month!!, today) + else -> s.agendaDay(node.date!!, today) + } + val tint = when (node.kind) { + Tasks.AgendaNode.Kind.OVERDUE -> c.danger + Tasks.AgendaNode.Kind.TODAY -> c.ivy + else -> c.muted + } + // A branch: tap to fold or unfold; remembered on this device. + Row( + Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp)).clickable { toggled = toggle(toggled, node.key, tree) } + .padding(horizontal = 4.dp, vertical = 10.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + Icon(Icons.AutoMirrored.Filled.KeyboardArrowRight, null, tint = c.faint, modifier = Modifier.size(18.dp).rotate(if (open) 90f else 0f)) + Spacer(Modifier.width(4.dp)) + Icon(if (node.kind == Tasks.AgendaNode.Kind.OVERDUE) Icons.Outlined.ErrorOutline else Icons.Outlined.Event, null, tint = tint, modifier = Modifier.size(18.dp)) + Spacer(Modifier.width(8.dp)) + Text(label, color = if (node.kind == Tasks.AgendaNode.Kind.OVERDUE) c.danger else c.ink, fontSize = 15.sp, + fontWeight = if (node.openByDefault) FontWeight.Medium else FontWeight.Normal, modifier = Modifier.weight(1f)) + Text(node.items.size.toString(), color = c.faint, fontSize = 12.sp) + } + if (!open) continue + for (item in node.items) { + val due = item.task.due!! + val time = due.time?.let { t -> "%02d:%02d".format(t.hour, t.minute) } ?: "" + // Branches of single days say the day; the rest say it on each task. + val whenText = when (node.kind) { + Tasks.AgendaNode.Kind.OVERDUE, Tasks.AgendaNode.Kind.MONTH -> due.date.format(dateFormat) + (if (time.isEmpty()) "" else " $time") + else -> time + } + Row( + Modifier.fillMaxWidth().padding(start = 22.dp).clip(RoundedCornerShape(10.dp)) + .clickable { onOpen(item.noteId, item.task.line) }.padding(end = 8.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + Checkbox( + checked = false, + onCheckedChange = { _ -> + val note = engine.notes[item.noteId] ?: return@Checkbox + // Only if the line is still the task shown. + if (note.body.split('\n').getOrNull(item.task.line) != item.task.raw) return@Checkbox + engine.updateNote(note.id, SyncEngine.NotePatch(body = Tasks.toggle(note.body, item.task.line, today))) + }, + colors = CheckboxDefaults.colors(checkedColor = c.ivy, uncheckedColor = c.faint), + ) + Column(Modifier.weight(1f)) { + Text(item.task.text.ifEmpty { s.untitled }, color = c.ink, fontSize = 15.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) + Text(item.noteTitle.ifEmpty { s.untitled }, color = c.faint, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) + } + if (item.task.repeat != null) Text("🔁", fontSize = 11.sp, modifier = Modifier.padding(horizontal = 4.dp)) + if (whenText.isNotEmpty()) Text(whenText, color = if (item.days < 0) c.danger else c.faint, fontSize = 12.sp) + } + } + } + if (anyProtected) { + Text(s.agendaProtectedHint, color = c.faint, fontSize = 12.sp, modifier = Modifier.padding(horizontal = 4.dp, vertical = 12.dp)) + } + } + } +} diff --git a/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt b/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt index a81047c..7d4b793 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt @@ -38,6 +38,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import app.ivynote.android.IvyApp +import app.ivynote.android.MainActivity import app.ivynote.android.LibrarySession import app.ivynote.core.L10n import app.ivynote.core.SessionStore @@ -51,6 +52,9 @@ class LibraryUiState(val lib: LibrarySession) { var expanded by mutableStateOf(IvyApp.instance.catalog.expanded(lib.ref.id)) var showAccount by mutableStateOf(false) var showMedia by mutableStateOf(false) + var showAgenda by mutableStateOf(false) + /** A line to show once the note opens (a task picked on the agenda). */ + var pendingLine by mutableStateOf?>(null) val selectedNote: String? get() = selection?.let(Shelf::noteId) @@ -153,6 +157,29 @@ fun LibraryScreen(lib: LibrarySession, session: SessionStore?) { } } + if (ui.showAgenda) { + AgendaSheet(lib, onOpen = { id, line -> + ui.showAgenda = false + ui.pendingLine = id to line + ui.reveal(id) + }, onDismiss = { ui.showAgenda = false }) + } + + // A tapped reminder: its note, in its library. + val request by MainActivity.openRequest.collectAsState() + LaunchedEffect(request) { + val r = request ?: return@LaunchedEffect + val catalog = IvyApp.instance.catalog + when { + r.library == lib.ref.id -> { + MainActivity.openRequest.value = null + if (engine.notes[r.note] != null) ui.reveal(r.note) + } + catalog.library(r.library) != null -> catalog.open(r.library) + else -> MainActivity.openRequest.value = null + } + } + if (ui.showMedia) { MediaScreen(lib, onOpenNote = { id -> ui.showMedia = false; ui.reveal(id) }, onDismiss = { ui.showMedia = false }) } diff --git a/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt b/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt index 4243004..a5784a7 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt @@ -28,9 +28,14 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.FormatListBulleted import androidx.compose.material.icons.automirrored.filled.Undo +import androidx.compose.material.icons.outlined.Add import androidx.compose.material.icons.outlined.AddLink import androidx.compose.material.icons.outlined.AttachFile +import androidx.compose.material.icons.outlined.Event import androidx.compose.material.icons.outlined.History +import androidx.compose.material.icons.outlined.Lock +import androidx.compose.material.icons.outlined.LockOpen +import androidx.compose.material.icons.outlined.VpnKey import androidx.compose.material.icons.outlined.Image import androidx.compose.material.icons.outlined.IosShare import androidx.compose.material.icons.outlined.PhotoCamera @@ -60,6 +65,7 @@ import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -108,6 +114,7 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> var history by remember { mutableStateOf(false) } var sharing by remember { mutableStateOf(false) } val adding by lib.adding.collectAsState() + val protection by host.protection.collectAsState() val linkCount = remember(revision, noteId) { Links.backlinks(noteId, engine.notes.values).size } // Picked files land in the note they were picked for, even if another is open by the time they are ready. @@ -117,12 +124,22 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> pickTarget = noteId open() } + // Photos and files chosen from the editor's insert menu ("/" or +). + DisposableEffect(host, noteId) { + host.onPick = { kind -> if (kind == "image") pick(picker.photos) else pick(picker.files) } + onDispose { host.onPick = null } + } // Open the note in the editor once per note; afterwards only changes from elsewhere go in. LaunchedEffect(noteId) { host.setTheme(dark) val n = engine.notes[noteId] ?: return@LaunchedEffect host.open(n, focus = n.body.isEmpty() && n.title.isEmpty() && !n.isTrashed) + // Opened from the agenda: show the task. + ui.pendingLine?.takeIf { it.first == noteId }?.let { (_, line) -> + ui.pendingLine = null + host.scrollToLine(line) + } } LaunchedEffect(dark) { host.setTheme(dark) } LaunchedEffect(s) { host.setLanguage(L10n.language) } @@ -163,7 +180,11 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> if (focused && !wide) { TextButton(onClick = { host.hideKeyboard() }) { Text(s.done, color = c.ivy, fontWeight = FontWeight.SemiBold) } } - if (!note.isTrashed) { + if (protection.protected) { + Icon(Icons.Outlined.Lock, contentDescription = s.protectedNote, tint = c.faint, modifier = Modifier.padding(horizontal = 6.dp).size(18.dp)) + } + // A protected note is never shared: the server cannot read it. + if (!note.isTrashed && !protection.protected) { IconButton(onClick = { sharing = true }) { Icon(Icons.Outlined.IosShare, contentDescription = s.share, tint = c.ink2) } } IconButton(onClick = { outline = true }) { Icon(Icons.Outlined.Toc, contentDescription = s.outline, tint = c.ink2) } @@ -180,6 +201,24 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> DropdownMenuItem(text = { Text(s.history) }, leadingIcon = { Icon(Icons.Outlined.History, null) }, onClick = { menu = false; history = true }) } + if (!note.isTrashed && !protection.locked) { + DropdownMenuItem(text = { Text(s.dateAndReminder) }, leadingIcon = { Icon(Icons.Outlined.Event, null) }, + onClick = { menu = false; host.command("due") }) + } + if (!note.isTrashed && !protection.locked) { + HorizontalDivider() + if (protection.protected) { + DropdownMenuItem(text = { Text(s.lockNoteNow) }, leadingIcon = { Icon(Icons.Outlined.Lock, null) }, + onClick = { menu = false; host.command("lock") }) + DropdownMenuItem(text = { Text(s.changeNotePassword) }, leadingIcon = { Icon(Icons.Outlined.VpnKey, null) }, + onClick = { menu = false; host.command("changePassword") }) + DropdownMenuItem(text = { Text(s.removeNotePassword) }, leadingIcon = { Icon(Icons.Outlined.LockOpen, null) }, + onClick = { menu = false; host.command("unprotect") }) + } else { + DropdownMenuItem(text = { Text(s.protectNote) }, leadingIcon = { Icon(Icons.Outlined.Lock, null) }, + onClick = { menu = false; host.command("protect") }) + } + } HorizontalDivider() NoteMenuItems(note, ui, engine, ShelfActions( newNote = ui::newNote, newFolder = {}, renameFolder = {}, deleteFolder = {}, @@ -304,10 +343,12 @@ private fun FormatBar(host: app.ivynote.android.editor.EditorHost, modifier: Mod Triple("file", Icons.Outlined.AttachFile, s.formatAttachment), ) val items: List> = listOf( + Triple("insert", Icons.Outlined.Add, s.formatInsert), Triple("h1", Icons.Outlined.Title, s.formatHeading), Triple("bold", Icons.Outlined.FormatBold, s.formatBold), Triple("italic", Icons.Outlined.FormatItalic, s.formatItalic), Triple("task", Icons.Outlined.CheckBox, s.formatTask), + Triple("due", Icons.Outlined.Event, s.formatDue), Triple("list", Icons.AutoMirrored.Filled.FormatListBulleted, s.formatList), Triple("ordered", Icons.Outlined.FormatListNumbered, s.formatOrdered), Triple("quote", Icons.Outlined.FormatQuote, s.formatQuote), diff --git a/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt b/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt index 3fe6e48..a84bccb 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt @@ -45,6 +45,7 @@ import androidx.compose.material.icons.outlined.FolderOpen import androidx.compose.material.icons.outlined.Language import androidx.compose.material.icons.outlined.ManageAccounts import androidx.compose.material.icons.outlined.MoreHoriz +import androidx.compose.material.icons.outlined.Event import androidx.compose.material.icons.outlined.PhotoLibrary import androidx.compose.material.icons.outlined.PushPin import androidx.compose.material.icons.outlined.Restore @@ -275,6 +276,8 @@ private fun LibraryHeader(ui: LibraryUiState, session: SessionStore?, state: app DropdownMenuItem(text = { Text(s.turnOnSyncEllipsis) }, leadingIcon = { Icon(Icons.Outlined.CloudUpload, null) }, onClick = { open = false; catalog.turnOnSync(ref.id) }) } + DropdownMenuItem(text = { Text(s.agenda) }, leadingIcon = { Icon(Icons.Outlined.Event, null) }, + onClick = { open = false; ui.showAgenda = true }) DropdownMenuItem(text = { Text(s.mediaLibrary) }, leadingIcon = { Icon(Icons.Outlined.PhotoLibrary, null) }, onClick = { open = false; ui.showMedia = true }) DropdownMenuItem(text = { Text(s.language) }, leadingIcon = { Icon(Icons.Outlined.Language, null) }, diff --git a/core/src/main/kotlin/app/ivynote/core/Search.kt b/core/src/main/kotlin/app/ivynote/core/Search.kt index b895e80..9cb5e94 100644 --- a/core/src/main/kotlin/app/ivynote/core/Search.kt +++ b/core/src/main/kotlin/app/ivynote/core/Search.kt @@ -19,7 +19,9 @@ object Search { for (n in notes) { if (n.isTrashed || n.deleted) continue val title = n.title.lowercase() - val body = n.body.lowercase() + // A protected note is found by its title only (guide 8.4). + val locked = NoteLock.isEncrypted(n.body) + val body = if (locked) "" else n.body.lowercase() var score = 0.0 var all = true for (t in terms) { @@ -35,7 +37,7 @@ object Search { } if (!all) continue score += maxOf(0.0, 1 - (now - n.updatedAt).toDouble() / YEAR_MS) - val (snippet, ranges) = snippet(n.body, terms) + val (snippet, ranges) = snippet(if (locked) "" else n.body, terms) hits += Hit(n, score, snippet, ranges) } return hits.sortedWith(compareByDescending { it.score }.thenByDescending { it.note.updatedAt }).take(limit) diff --git a/core/src/main/kotlin/app/ivynote/core/Strings.kt b/core/src/main/kotlin/app/ivynote/core/Strings.kt index b8d232d..1a5e0e0 100644 --- a/core/src/main/kotlin/app/ivynote/core/Strings.kt +++ b/core/src/main/kotlin/app/ivynote/core/Strings.kt @@ -395,6 +395,31 @@ interface Strings { val serverInvalid: String fun unsupportedScheme(scheme: String): String fun insecureRemote(host: String): String + + // Dates, reminders and protected notes (guide 8.4, 9.4, 11.8) + val agenda: String + val agendaEmpty: String + val agendaEmptyHint: String + val agendaProtectedHint: String + val agendaOverdue: String + val agendaToday: String + val agendaLater: String + val dateAndReminder: String + val formatDue: String + val formatInsert: String + val protectNote: String + val changeNotePassword: String + val removeNotePassword: String + val lockNoteNow: String + val protectedNote: String + val reminderChannel: String + val reminderChannelHint: String + fun reminderFrom(title: String): String + fun daysLeft(days: Long): String + /** A day branch of the agenda: 今天 · 11月9日 周一, 11月12日 周三. */ + fun agendaDay(date: java.time.LocalDate, today: java.time.LocalDate): String + /** A month branch: 本月稍后, 12月, 2027年1月. */ + fun agendaMonth(month: java.time.YearMonth, today: java.time.LocalDate): String } object ZhStrings : Strings { @@ -776,6 +801,44 @@ object ZhStrings : Strings { override val serverInvalid = "服务器地址无效" override fun unsupportedScheme(scheme: String) = "不支持的协议:$scheme" override fun insecureRemote(host: String) = "$host 不是局域网地址,必须使用 https://" + + override val agenda = "日程" + override val agendaEmpty = "还没有带日期的待办" + override val agendaEmptyHint = "在待办后输入 @明天 9点、@周五,或点格式栏的日期按钮。选好日期就会出现在这里,到点提醒。" + override val agendaProtectedHint = "加密笔记中的待办不会出现在日程里。" + override val agendaOverdue = "已逾期" + override val agendaToday = "今天" + override val agendaLater = "接下来" + override val dateAndReminder = "日期与提醒" + override val formatDue = "日期与提醒" + override val formatInsert = "插入" + override val protectNote = "设置密码…" + override val changeNotePassword = "更改密码…" + override val removeNotePassword = "移除密码" + override val lockNoteNow = "立即锁定" + override val protectedNote = "已加密" + override val reminderChannel = "待办提醒" + override val reminderChannelHint = "带日期的待办到点提醒" + override fun reminderFrom(title: String) = "来自《$title》" + override fun agendaDay(date: java.time.LocalDate, today: java.time.LocalDate): String { + val wd = arrayOf("周一", "周二", "周三", "周四", "周五", "周六", "周日")[date.dayOfWeek.value - 1] + val day = (if (date.year == today.year) "" else "${date.year}年") + "${date.monthValue}月${date.dayOfMonth}日 $wd" + return when (date) { + today -> "今天 · $day" + today.plusDays(1) -> "明天 · $day" + else -> day + } + } + override fun agendaMonth(month: java.time.YearMonth, today: java.time.LocalDate): String = when { + month == java.time.YearMonth.from(today) -> "本月稍后" + month.year == today.year -> "${month.monthValue}月" + else -> "${month.year}年${month.monthValue}月" + } + override fun daysLeft(days: Long) = when { + days == 0L -> "今天" + days > 0 -> "$days 天后" + else -> "逾期 ${-days} 天" + } } object EnStrings : Strings { @@ -1161,4 +1224,42 @@ object EnStrings : Strings { override val serverInvalid = "The server address is not valid" override fun unsupportedScheme(scheme: String) = "Unsupported protocol: $scheme" override fun insecureRemote(host: String) = "$host is not on the local network; use https://" + + override val agenda = "Agenda" + override val agendaEmpty = "No dated to-dos yet" + override val agendaEmptyHint = "Type @tomorrow 9am or @fri after a to-do, or tap the date button in the format bar. Dated to-dos appear here and remind you when they are due." + override val agendaProtectedHint = "To-dos in password-protected notes are not shown here." + override val agendaOverdue = "Overdue" + override val agendaToday = "Today" + override val agendaLater = "Coming up" + override val dateAndReminder = "Date & reminder" + override val formatDue = "Date & reminder" + override val formatInsert = "Insert" + override val protectNote = "Protect with password…" + override val changeNotePassword = "Change password…" + override val removeNotePassword = "Remove password" + override val lockNoteNow = "Lock now" + override val protectedNote = "Protected" + override val reminderChannel = "To-do reminders" + override val reminderChannelHint = "Dated to-dos when they are due" + override fun reminderFrom(title: String) = "From “$title”" + override fun agendaDay(date: java.time.LocalDate, today: java.time.LocalDate): String { + val pattern = if (date.year == today.year) "EEE, MMM d" else "EEE, MMM d, yyyy" + val day = date.format(java.time.format.DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH)) + return when (date) { + today -> "Today · $day" + today.plusDays(1) -> "Tomorrow · $day" + else -> day + } + } + override fun agendaMonth(month: java.time.YearMonth, today: java.time.LocalDate): String { + if (month == java.time.YearMonth.from(today)) return "Later this month" + val pattern = if (month.year == today.year) "MMMM" else "MMMM yyyy" + return month.format(java.time.format.DateTimeFormatter.ofPattern(pattern, Locale.ENGLISH)) + } + override fun daysLeft(days: Long) = when { + days == 0L -> "today" + days > 0 -> if (days == 1L) "in 1 day" else "in $days days" + else -> if (days == -1L) "1 day overdue" else "${-days} days overdue" + } } diff --git a/core/src/main/kotlin/app/ivynote/core/Tasks.kt b/core/src/main/kotlin/app/ivynote/core/Tasks.kt new file mode 100644 index 0000000..2c594b6 --- /dev/null +++ b/core/src/main/kotlin/app/ivynote/core/Tasks.kt @@ -0,0 +1,187 @@ +package app.ivynote.core + +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.LocalTime +import java.time.ZoneId +import java.time.format.DateTimeParseException +import java.time.temporal.ChronoUnit + +/** + * Password-protected notes (guide 8.4): the body is one ```ivy-encrypted + * fence sealed by the editor page. The app never decrypts it; it only keeps + * it out of search, excerpts, the agenda and reminders. + */ +object NoteLock { + private val ENVELOPE = Regex("^\\s*```ivy-encrypted[ \\t]*\\n[\\s\\S]*?\\n```[ \\t]*\\s*$") + + fun isEncrypted(body: String): Boolean = + body.trimStart().startsWith("```ivy-encrypted") && ENVELOPE.matches(body) +} + +/** + * Tasks with dates (guide 9.4), as the web client's `markdown/tasks.ts` and + * `agenda.ts`: `- [ ] 交房租 📅 2026-11-15 09:00 🔁 every month`. Dates are + * local to the device. + */ +object Tasks { + data class Due(val date: LocalDate, val time: LocalTime?) + data class Repeat(val every: Int, val unit: String, val text: String) + data class Task(val line: Int, val text: String, val done: Boolean, val due: Due?, val repeat: Repeat?, val raw: String) + + private val TASK = Regex("^(\\s*(?:[-*+]|\\d+[.)])\\s+\\[)([ xX])(\\]\\s?)(.*)$") + private val DUE = Regex("📅\\uFE0F?\\s*(\\d{4}-\\d{2}-\\d{2})(?:[ T](\\d{1,2}:\\d{2}))?") + private val DONE = Regex("✅\\uFE0F?\\s*(\\d{4}-\\d{2}-\\d{2})") + private val REPEAT = Regex("🔁\\uFE0F?\\s*([^📅✅⏳🛫➕⏫🔼🔽🔺⏬\\n]*)") + private val RULE = Regex("^every\\s+(?:(\\d{1,3})\\s+)?(day|week|month|year)s?$") + private val FENCE = Regex("^\\s*(```|~~~)") + + private fun date(s: String): LocalDate? = try { LocalDate.parse(s) } catch (_: DateTimeParseException) { null } + + private fun time(s: String?): LocalTime? { + val m = Regex("^(\\d{1,2}):(\\d{2})$").find(s ?: return null) ?: return null + val h = m.groupValues[1].toInt() + val mi = m.groupValues[2].toInt() + return if (h in 0..23 && mi in 0..59) LocalTime.of(h, mi) else null + } + + fun parseRepeat(text: String): Repeat? { + val t = text.trim().lowercase() + if (t == "every weekday") return Repeat(1, "weekday", text.trim()) + val m = RULE.find(t) ?: return null + val n = m.groupValues[1].ifEmpty { "1" }.toInt() + return if (n >= 1) Repeat(n, m.groupValues[2], text.trim()) else null + } + + /** The task lines of a body, skipping code. */ + fun parse(body: String): List { + val out = ArrayList() + var inFence = false + body.split('\n').forEachIndexed { i, line -> + if (FENCE.containsMatchIn(line)) inFence = !inFence + if (inFence) return@forEachIndexed + val m = TASK.find(line) ?: return@forEachIndexed + val rest = m.groupValues[4] + val d = DUE.find(rest) + val due = d?.let { date(it.groupValues[1])?.let { day -> Due(day, time(it.groupValues[2].ifEmpty { null })) } } + val rep = REPEAT.find(rest)?.let { parseRepeat(it.groupValues[1]) } + val text = rest.replace(DUE, "").replace(DONE, "").replace(REPEAT, "").replace(Regex("\\s+"), " ").trim() + out += Task(i, text, m.groupValues[2] != " ", due, rep, line) + } + return out + } + + private fun live(n: Note) = !n.deleted && !n.isTrashed && n.body.contains("📅") && !NoteLock.isEncrypted(n.body) + + data class Reminder(val key: String, val noteId: String, val noteTitle: String, val text: String, val line: Int, val at: Millis) + + /** + * Reminders that fire in [from, to). [allDayTime] is when a task with a + * date but no time reminds; null: such tasks do not remind. + */ + fun reminders(notes: Collection, from: Millis, to: Millis, allDayTime: LocalTime?, zone: ZoneId = ZoneId.systemDefault()): List { + val out = ArrayList() + for (n in notes) { + if (!live(n)) continue + for (t in parse(n.body)) { + val due = t.due ?: continue + if (t.done) continue + val at = LocalDateTime.of(due.date, due.time ?: allDayTime ?: continue).atZone(zone).toInstant().toEpochMilli() + if (at < from || at >= to) continue + out += Reminder("${n.id}:${t.text.hashCode().toUInt().toString(36)}:${due.date}${due.time ?: ""}", n.id, n.title, t.text, t.line, at) + } + } + return out.sortedBy { it.at } + } + + data class AgendaItem(val noteId: String, val noteTitle: String, val task: Task, val days: Long) + + /** Open dated tasks across notes, soonest first (overdue at the top). */ + fun agenda(notes: Collection, today: LocalDate = LocalDate.now()): List { + val out = ArrayList() + for (n in notes) { + if (!live(n)) continue + for (t in parse(n.body)) { + val due = t.due ?: continue + if (t.done) continue + out += AgendaItem(n.id, n.title, t, ChronoUnit.DAYS.between(today, due.date)) + } + } + return out.sortedWith(compareBy { it.task.due!!.date }.thenBy { it.task.due!!.time ?: LocalTime.MAX }.thenBy { it.noteTitle }.thenBy { it.task.line }) + } + + /** A branch of the agenda tree: overdue, a day of the coming week, or a month. */ + data class AgendaNode(val key: String, val kind: Kind, val date: LocalDate?, val month: java.time.YearMonth?, val items: List) { + enum class Kind { OVERDUE, TODAY, TOMORROW, DAY, MONTH } + + /** Overdue, today and tomorrow start open; the rest start folded. */ + val openByDefault: Boolean get() = kind == Kind.OVERDUE || kind == Kind.TODAY || kind == Kind.TOMORROW + } + + /** Days within this many days get a branch each; later ones group by month (as the web). */ + const val AGENDA_DAYS = 7 + + /** The agenda as a tree (guide 11.8), in the web client's order. */ + fun agendaTree(items: List): List { + val groups = LinkedHashMap>() + val members = HashMap>() + for (it in items) { + val date = it.task.due!!.date + val (key, info) = when { + it.days < 0 -> "overdue" to Triple(AgendaNode.Kind.OVERDUE, null, null) + it.days == 0L -> "d:$date" to Triple(AgendaNode.Kind.TODAY, date, null) + it.days == 1L -> "d:$date" to Triple(AgendaNode.Kind.TOMORROW, date, null) + it.days < AGENDA_DAYS -> "d:$date" to Triple(AgendaNode.Kind.DAY, date, null) + else -> java.time.YearMonth.from(date).let { m -> "m:$m" to Triple(AgendaNode.Kind.MONTH, null, m) } + } + groups.getOrPut(key) { info } + members.getOrPut(key) { ArrayList() } += it + } + fun rank(key: String) = if (key == "overdue") "0" else "1" + key.substring(2) + if (key.startsWith("m:")) "-99" else "" + return groups.keys.sortedBy(::rank).map { k -> + val (kind, date, month) = groups.getValue(k) + AgendaNode(k, kind, date, month, members.getValue(k)) + } + } + + fun nextDate(date: LocalDate, rule: Repeat): LocalDate = when (rule.unit) { + "day" -> date.plusDays(rule.every.toLong()) + "week" -> date.plusWeeks(rule.every.toLong()) + "month" -> date.plusMonths(rule.every.toLong()) + "year" -> date.plusYears(rule.every.toLong()) + else -> { + var d = date.plusDays(1) + while (d.dayOfWeek.value >= 6) d = d.plusDays(1) + d + } + } + + /** + * Checks or unchecks the task on a 0-based line, as the editor does: + * a dated task gets ✅ and the day, and a repeating one its next + * occurrence on the line above. + */ + fun toggle(body: String, lineNo: Int, today: LocalDate = LocalDate.now()): String { + val lines = body.split('\n').toMutableList() + val line = lines.getOrNull(lineNo) ?: return body + val m = TASK.find(line) ?: return body + val (open, mark, close, rest) = m.destructured + if (mark != " ") { + lines[lineNo] = "$open $close${rest.replace(Regex("\\s*" + DONE.pattern), "")}".trimEnd() + return lines.joinToString("\n") + } + val t = parse(line).firstOrNull() ?: return body + if (t.due == null && t.repeat == null) { + lines[lineNo] = "${open}x$close$rest" + return lines.joinToString("\n") + } + val clean = rest.replace(Regex("\\s*" + DONE.pattern), "").trimEnd() + lines[lineNo] = "${open}x$close$clean ✅ $today" + if (t.repeat != null && t.due != null) { + val next = nextDate(t.due.date, t.repeat) + val marker = "📅 $next" + (t.due.time?.let { " %02d:%02d".format(it.hour, it.minute) } ?: "") + lines.add(lineNo, "$open $close" + clean.replace(DUE, marker)) + } + return lines.joinToString("\n") + } +} diff --git a/core/src/test/kotlin/app/ivynote/core/TasksTest.kt b/core/src/test/kotlin/app/ivynote/core/TasksTest.kt new file mode 100644 index 0000000..616fd74 --- /dev/null +++ b/core/src/test/kotlin/app/ivynote/core/TasksTest.kt @@ -0,0 +1,96 @@ +package app.ivynote.core + +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.LocalTime +import java.time.ZoneId +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class TasksTest { + private val sealed = "```ivy-encrypted\nThis note is encrypted.\nv: 1\nkdf: scrypt N=32768 r=8 p=1\nsalt: AA==\nnonce: AA==\ndata: AA==\n```\n" + + @Test fun detectsProtectedNotes() { + assertTrue(NoteLock.isEncrypted(sealed)) + assertFalse(NoteLock.isEncrypted("x\n$sealed")) + assertFalse(NoteLock.isEncrypted("plain")) + } + + @Test fun parsesTasks() { + val ts = Tasks.parse("- [ ] 交房租 📅 2026-11-15 09:00 🔁 every month\n```\n- [ ] code 📅 2026-11-01\n```\n* [x] done ✅ 2026-11-01 📅 2026-10-31\n- [ ] bad 📅 2026-02-30\n- [ ] plain") + assertEquals(4, ts.size) + assertEquals("交房租", ts[0].text) + assertEquals(LocalDate.of(2026, 11, 15), ts[0].due!!.date) + assertEquals(LocalTime.of(9, 0), ts[0].due!!.time) + assertEquals(Tasks.Repeat(1, "month", "every month"), ts[0].repeat) + assertTrue(ts[1].done) + assertEquals(4, ts[1].line) + assertNull(ts[2].due) + assertNull(ts[3].due) + assertEquals(Tasks.Repeat(2, "week", "every 2 weeks"), Tasks.parseRepeat("every 2 weeks")) + assertNull(Tasks.parseRepeat("sometimes")) + } + + @Test fun listsRemindersAndAgenda() { + val zone = ZoneId.of("Asia/Shanghai") + val notes = listOf( + Note("a", title = "生活", body = "- [ ] 早 📅 2026-11-09 08:00\n- [ ] 全天 📅 2026-11-09\n- [ ] 过期 📅 2026-11-01\n- [x] 完成 📅 2026-11-09 ✅ 2026-11-09"), + Note("b", title = "回收", body = "- [ ] x 📅 2026-11-09 08:00", trashedAt = 5), + Note("c", title = "秘密", body = sealed), + ) + val from = LocalDateTime.of(2026, 11, 9, 0, 0).atZone(zone).toInstant().toEpochMilli() + val to = LocalDateTime.of(2026, 11, 10, 0, 0).atZone(zone).toInstant().toEpochMilli() + assertEquals(listOf("早"), Tasks.reminders(notes, from, to, null, zone).map { it.text }) + val all = Tasks.reminders(notes, from, to, LocalTime.of(9, 0), zone) + assertEquals(listOf("早", "全天"), all.map { it.text }) + assertEquals(all, Tasks.reminders(notes, from, to, LocalTime.of(9, 0), zone)) + val agenda = Tasks.agenda(notes, LocalDate.of(2026, 11, 9)) + assertEquals(listOf("过期" to -8L, "早" to 0L, "全天" to 0L), agenda.map { it.task.text to it.days }) + } + + @Test fun togglesLikeTheEditor() { + val today = LocalDate.of(2026, 11, 15) + assertEquals( + "- [ ] 交房租 📅 2026-12-15 09:00 🔁 every month\n- [x] 交房租 📅 2026-11-15 09:00 🔁 every month ✅ 2026-11-15", + Tasks.toggle("- [ ] 交房租 📅 2026-11-15 09:00 🔁 every month", 0, today) + ) + assertEquals("- [ ] a 📅 2026-11-15", Tasks.toggle("- [x] a 📅 2026-11-15 ✅ 2026-11-15", 0, today)) + assertEquals("- [x] plain", Tasks.toggle("- [ ] plain", 0, today)) + assertEquals("text", Tasks.toggle("text", 0, today)) + assertEquals(LocalDate.of(2026, 2, 28), Tasks.nextDate(LocalDate.of(2026, 1, 31), Tasks.Repeat(1, "month", ""))) + assertEquals(LocalDate.of(2026, 11, 16), Tasks.nextDate(LocalDate.of(2026, 11, 13), Tasks.Repeat(1, "weekday", ""))) + } + + @Test fun searchSkipsProtectedBodies() { + val notes = listOf(Note("s", title = "Secret", body = sealed)) + assertTrue(Search.run(notes, "AA==").isEmpty()) + assertEquals("", Search.run(notes, "secret").single().snippet) + } + + @Test fun groupsTheAgendaByDay() { + val days = listOf("2026-11-01", "2026-11-09", "2026-11-10", "2026-11-12", "2026-11-12", "2026-11-16", "2026-12-03") + val note = Note("t", title = "t", body = days.mapIndexed { i, d -> "- [ ] t$i 📅 $d" }.joinToString("\n")) + val tree = Tasks.agendaTree(Tasks.agenda(listOf(note), LocalDate.of(2026, 11, 9))) + assertEquals( + listOf("overdue" to 1, "d:2026-11-09" to 1, "d:2026-11-10" to 1, "d:2026-11-12" to 2, "m:2026-11" to 1, "m:2026-12" to 1), + tree.map { it.key to it.items.size }, + ) + assertEquals(Tasks.AgendaNode.Kind.TOMORROW, tree[2].kind) + assertTrue(tree[1].openByDefault) + assertFalse(tree[3].openByDefault) + } +} + +class AgendaLabelTest { + @Test fun namesDaysAndMonths() { + val today = LocalDate.of(2026, 11, 9) + assertEquals("今天 · 11月9日 周一", ZhStrings.agendaDay(today, today)) + assertEquals("Tomorrow · Tue, Nov 10", EnStrings.agendaDay(today.plusDays(1), today)) + assertEquals("2027年1月2日 周六", ZhStrings.agendaDay(LocalDate.of(2027, 1, 2), today)) + assertEquals("本月稍后", ZhStrings.agendaMonth(java.time.YearMonth.of(2026, 11), today)) + assertEquals("January 2027", EnStrings.agendaMonth(java.time.YearMonth.of(2027, 1), today)) + } +} diff --git a/editor-web/build.sh b/editor-web/build.sh index 92353e5..47c76e0 100755 --- a/editor-web/build.sh +++ b/editor-web/build.sh @@ -33,9 +33,10 @@ NODE_PATH="$ivy/node_modules" "$bin/esbuild" "$here/main.ts" \ --outdir="$out" # Styles: the web's design tokens and prose styles, the editor's own styles -# lifted from Editor.svelte (":global(x)" -> "x"), and the native page frame. +# lifted from Editor.svelte (":global(x)" -> "x", "@keyframes -global-x" -> +# "@keyframes x"), and the native page frame. sed -n '/

    ([\s\S]*)<\/p>\s*$/,"$1"):fg(n)}toDOM(n){let r=Ao(this.src)??{rows:[[""]],align:[""]},s=n.state.readOnly,i=document.createElement("div");i.className="cm-table-edit"+(s?" readonly":"");let o=document.createElement("div");o.className="cm-table-scroll";let a=document.createElement("table"),l=[];r.rows.forEach((u,h)=>{let d=document.createElement("tr");l[h]=[],u.forEach((p,f)=>{let m=document.createElement(h===0?"th":"td"),b=r.align[f];b&&(m.style.textAlign=b);let g=document.createElement("div");g.className="cm-cell",g.dataset.row=String(h),g.dataset.col=String(f),g.dataset.raw=p,g.innerHTML=this.inline(p),s||(g.contentEditable="true",g.spellcheck=!0,g.setAttribute("role","textbox"),g.setAttribute("aria-label",h===0?$(`\u8868\u5934 ${f+1}`,`Header ${f+1}`):$(`\u7B2C ${h} \u884C\u7B2C ${f+1} \u5217`,`Row ${h}, column ${f+1}`))),m.append(g),d.append(m),l[h][f]=g}),(h===0?a.tHead??a.createTHead():a.tBodies[0]??a.createTBody()).append(d)}),o.append(a),i.append(o);let c={model:r,cells:l,anchor:null,range:null};Ue.set(i,c);let O=document.createElement("div");if(O.className="cm-table-stats",O.hidden=!0,s)this.wireLinks(i);else{let u=document.createElement("button");u.type="button",u.className="cm-table-add cm-table-add-row",u.textContent="+",u.title=$("\u6DFB\u52A0\u4E00\u884C","Add a row"),u.setAttribute("aria-label",u.title),u.addEventListener("mousedown",p=>p.preventDefault()),u.addEventListener("click",()=>se(n,i,Mt(this.current(i),Number.MAX_SAFE_INTEGER),{row:c.model.rows.length,col:0}));let h=document.createElement("button");h.type="button",h.className="cm-table-add cm-table-add-col",h.textContent="+",h.title=$("\u6DFB\u52A0\u4E00\u5217","Add a column"),h.setAttribute("aria-label",h.title),h.addEventListener("mousedown",p=>p.preventDefault()),h.addEventListener("click",()=>se(n,i,as(this.current(i),Number.MAX_SAFE_INTEGER),{row:0,col:c.model.align.length})),i.append(u,h);let d=document.createElement("button");d.type="button",d.className="cm-table-more",d.textContent="\u22EF",d.title=$("\u884C\u548C\u5217","Rows and columns"),d.setAttribute("aria-label",d.title),d.hidden=!0,d.addEventListener("mousedown",p=>p.preventDefault()),d.addEventListener("click",()=>{let p=i.querySelector(".cm-cell:focus")??(i.dataset.last?i.querySelector(`.cm-cell[data-row="${i.dataset.last.split(",")[0]}"][data-col="${i.dataset.last.split(",")[1]}"]`):null);p&&this.menu(n,i,p,d.getBoundingClientRect())}),i.append(d),this.wire(n,i,c,d,O)}if(i.append(O),st){let u=st;requestAnimationFrame(()=>{st===u&&du(n)})}return i}current(n){let r=Ue.get(n);return{rows:r.cells.map(s=>s.map(Jn)),align:[...r.model.align]}}wireLinks(n){n.addEventListener("mousedown",r=>{let s=r.target.closest("a");s&&(r.preventDefault(),s.dataset.note||s.classList.contains("missing")?this.opts.openNote(s.dataset.note??"",s.dataset.title??s.textContent??"",r.button===1||r.shiftKey):s.href&&/^https?:/i.test(s.href)&&window.open(s.href,"_blank","noopener"))})}wire(n,r,s,i,o){let a=p=>({row:Number(p.dataset.row),col:Number(p.dataset.col)}),l=(p,f)=>s.cells[p]?.[f]??null,c=(p,f,m="end")=>{let b=l(p,f);return b?(b.focus(),m==="all"?qt(b,0,Jn(b).length):qt(b,m),!0):!1},O=p=>{let f=tr(n,r);document.activeElement?.blur(),n.focus(),f&&(p==="after"&&f.to>=n.state.doc.length?n.dispatch({changes:{from:f.to,insert:` +`},selection:{anchor:f.to+1},scrollIntoView:!0}):p==="before"&&f.from===0?n.dispatch({changes:{from:0,insert:` +`},selection:{anchor:0},scrollIntoView:!0}):n.dispatch({selection:{anchor:p==="before"?f.from-1:f.to+1},scrollIntoView:!0}))},u=p=>{let f=(p.innerText??"").replace(/\r?\n/g," ");f!==p.dataset.raw&&(p.dataset.raw=f,se(n,r,this.current(r)))},h=()=>{s.range=null,r.querySelectorAll(".cm-cell.sel").forEach(p=>p.classList.remove("sel")),o.hidden=!0},d=(p,f,m,b)=>{h(),s.range={r0:Math.min(p,m),c0:Math.min(f,b),r1:Math.max(p,m),c1:Math.max(f,b)};let g=[],Q=0;for(let y=s.range.r0;y<=s.range.r1;y++)for(let k=s.range.c0;k<=s.range.c1;k++){let w=l(y,k);if(w&&(w.classList.add("sel"),Q++,y>0)){let P=Vn(Jn(w));P&&g.push(P)}}o.textContent=dg(g,Q),o.hidden=!1};r.addEventListener("mousedown",p=>{let f=p.target,m=f.closest("a"),b=f.closest(".cm-cell");if(m&&b&&b!==document.activeElement){p.preventDefault(),m.dataset.note||m.classList.contains("missing")?this.opts.openNote(m.dataset.note??"",m.dataset.title??m.textContent??"",p.button===1||p.shiftKey):m.href&&/^https?:/i.test(m.href)&&window.open(m.href,"_blank","noopener");return}if(b){if(p.shiftKey&&r.dataset.last){p.preventDefault();let[g,Q]=r.dataset.last.split(",").map(Number),y=a(b);d(g,Q,y.row,y.col);return}h()}}),r.addEventListener("contextmenu",p=>{let f=p.target.closest(".cm-cell");f&&(p.preventDefault(),this.menu(n,r,f,{left:p.clientX,right:p.clientX,top:p.clientY,bottom:p.clientY}))});for(let p of s.cells)for(let f of p)f.addEventListener("focus",()=>{f.textContent!==f.dataset.raw&&(f.textContent=f.dataset.raw??"");let m=a(f);r.dataset.last=`${m.row},${m.col}`,r.classList.add("editing"),i.hidden=!1;let b=f.parentElement;i.style.top=`${b.offsetTop-r.querySelector(".cm-table-scroll").scrollTop-10}px`,i.style.left=`${b.offsetLeft+b.offsetWidth-r.querySelector(".cm-table-scroll").scrollLeft-14}px`}),f.addEventListener("blur",()=>{u(f),f.innerHTML=this.inline(f.dataset.raw??""),setTimeout(()=>{r.contains(document.activeElement)||(r.classList.remove("editing"),i.hidden=!0)},0)}),f.addEventListener("input",()=>u(f)),f.addEventListener("beforeinput",m=>{(m.inputType.startsWith("format")||m.inputType==="insertParagraph"||m.inputType==="insertLineBreak")&&m.preventDefault()}),f.addEventListener("paste",m=>{m.preventDefault();let b=(m.clipboardData?.getData("text/plain")??"").replace(/\r?\n/g," "),[g,Q]=Ou(f),y=f.textContent??"";f.textContent=y.slice(0,g)+b+y.slice(Q),qt(f,g+b.length),u(f)}),f.addEventListener("drop",m=>m.preventDefault()),f.addEventListener("keydown",m=>{if(m.isComposing||m.keyCode===229)return;let b=a(f),g=s.cells.length-1,Q=s.model.align.length,y=m.metaKey||m.ctrlKey,k=f.textContent??"",w=!0;if(m.key==="Tab"&&!m.shiftKey)b.col0?c(b.row,b.col-1,"all"):b.row>0&&c(b.row-1,Q-1,"all");else if(m.key==="Enter"&&!y)b.row0?c(b.row-1,b.col):O("before");else if(m.key==="ArrowDown"&&!m.shiftKey)b.row0?c(b.row,b.col-1,"end"):b.row>0?c(b.row-1,Q-1,"end"):O("before");else if(m.key==="ArrowRight"&&!m.shiftKey&&cu(f)===k.length&&window.getSelection()?.isCollapsed)b.colthis.current(r),c=Ue.get(r).cells.length,O=Ue.get(r).model.align.length,u=Ue.get(r).cells.slice(1).some(k=>Vn(Jn(k[a]))),h=Ue.get(r).model.align[a],d=()=>{let k=tr(n,r);k&&(n.focus(),n.dispatch({changes:{from:k.from,to:Math.min(n.state.doc.length,k.to+1),insert:""},selection:{anchor:k.from},userEvent:"delete"}))},p=[{label:$("\u884C","Row"),items:[{label:$("\u2191 \u63D2\u5165","\u2191 Insert"),title:$("\u5728\u4E0A\u65B9\u63D2\u5165\u884C","Insert row above"),off:o===0,run:()=>se(n,r,Mt(l(),o),{row:o,col:a})},{label:$("\u2193 \u63D2\u5165","\u2193 Insert"),title:$("\u5728\u4E0B\u65B9\u63D2\u5165\u884C","Insert row below"),run:()=>se(n,r,Mt(l(),o+1),{row:o+1,col:a})},{label:$("\u4E0A\u79FB","Up"),title:$("\u4E0A\u79FB\u884C","Move row up"),off:o<=1,run:()=>se(n,r,Mo(l(),o,-1),{row:o-1,col:a})},{label:$("\u4E0B\u79FB","Down"),title:$("\u4E0B\u79FB\u884C","Move row down"),off:o===0||o>=c-1,run:()=>se(n,r,Mo(l(),o,1),{row:o+1,col:a})},{label:$("\u5220\u9664","Delete"),title:$("\u5220\u9664\u884C","Delete row"),off:o===0||c<=2,danger:!0,run:()=>se(n,r,ou(l(),o),{row:Math.min(o,c-2),col:a})}]},{label:$("\u5217","Column"),items:[{label:$("\u2190 \u63D2\u5165","\u2190 Insert"),title:$("\u5728\u5DE6\u4FA7\u63D2\u5165\u5217","Insert column left"),run:()=>se(n,r,as(l(),a),{row:o,col:a})},{label:$("\u2192 \u63D2\u5165","\u2192 Insert"),title:$("\u5728\u53F3\u4FA7\u63D2\u5165\u5217","Insert column right"),run:()=>se(n,r,as(l(),a+1),{row:o,col:a+1})},{label:$("\u5DE6\u79FB","Left"),title:$("\u5DE6\u79FB\u5217","Move column left"),off:a===0,run:()=>se(n,r,qo(l(),a,-1),{row:o,col:a-1})},{label:$("\u53F3\u79FB","Right"),title:$("\u53F3\u79FB\u5217","Move column right"),off:a>=O-1,run:()=>se(n,r,qo(l(),a,1),{row:o,col:a+1})},{label:$("\u5220\u9664","Delete"),title:$("\u5220\u9664\u5217","Delete column"),off:O<=1,danger:!0,run:()=>{let k=au(l(),a);k&&se(n,r,k,{row:o,col:Math.max(0,a-1)})}}]},{label:$("\u5BF9\u9F50","Align"),items:[{label:$("\u5DE6","Left"),title:$("\u5DE6\u5BF9\u9F50","Align left"),on:h==="left",run:()=>se(n,r,ls(l(),a,h==="left"?"":"left"),{row:o,col:a})},{label:$("\u4E2D","Center"),title:$("\u5C45\u4E2D","Align center"),on:h==="center",run:()=>se(n,r,ls(l(),a,h==="center"?"":"center"),{row:o,col:a})},{label:$("\u53F3","Right"),title:$("\u53F3\u5BF9\u9F50","Align right"),on:h==="right",run:()=>se(n,r,ls(l(),a,h==="right"?"":"right"),{row:o,col:a})}]},{label:$("\u6392\u5E8F","Sort"),items:[{label:$("\u5347\u5E8F","A \u2192 Z"),title:$("\u6309\u6B64\u5217\u5347\u5E8F\u6392\u5E8F","Sort ascending by this column"),off:c<3,run:()=>se(n,r,Yo(l(),a,!1,yo),{row:o,col:a})},{label:$("\u964D\u5E8F","Z \u2192 A"),title:$("\u6309\u6B64\u5217\u964D\u5E8F\u6392\u5E8F","Sort descending by this column"),off:c<3,run:()=>se(n,r,Yo(l(),a,!0,yo),{row:o,col:a})},{label:$("\u6574\u5217\u6C42\u548C","Sum column"),title:$("\u9009\u4E2D\u6574\u5217\uFF0C\u770B\u6C42\u548C\u4E0E\u5E73\u5747","Select the column to see its sum and average"),off:!u,run:()=>{r.dataset.last=`1,${a}`,Ue.get(r).cells[c-1][a].dispatchEvent(new MouseEvent("mousedown",{bubbles:!0,shiftKey:!0}))}}]},{label:"",items:[{label:$("\u5220\u9664\u8868\u683C","Delete table"),danger:!0,run:d}]}],f=document.createElement("div");f.className="cm-table-menu",f.setAttribute("role","menu");for(let k of p){let w=document.createElement("div");w.className="cm-table-menu-row";let P=document.createElement("span");P.className="cm-table-menu-label",P.textContent=k.label,w.append(P);for(let E of k.items){let T=document.createElement("button");T.type="button",T.setAttribute("role","menuitem"),T.textContent=E.label,E.title&&(T.title=E.title),T.setAttribute("aria-label",E.title??E.label),T.disabled=!!E.off,E.danger&&T.classList.add("danger"),E.on&&T.classList.add("on"),T.addEventListener("mousedown",L=>L.preventDefault()),T.addEventListener("click",()=>{y(),E.run()}),w.append(T)}f.append(w)}document.body.append(f);let m=f.offsetWidth,b=f.offsetHeight;f.style.left=`${Math.max(8,Math.min(window.innerWidth-m-8,i.left))}px`,f.style.top=`${i.bottom+4+b<=window.innerHeight-8?i.bottom+4:i.top-b-4>=8?i.top-b-4:Math.max(8,window.innerHeight-b-8)}px`;let g=k=>{f.contains(k.target)||y()},Q=k=>{k.key==="Escape"&&(k.stopPropagation(),y(),s.focus())};setTimeout(()=>{document.addEventListener("mousedown",g,!0),document.addEventListener("touchstart",g,!0)},0),document.addEventListener("keydown",Q,!0);function y(){f.remove(),document.removeEventListener("mousedown",g,!0),document.removeEventListener("touchstart",g,!0),document.removeEventListener("keydown",Q,!0),cs===y&&(cs=null)}cs=y}get estimatedHeight(){return 40*Math.max(2,this.src.split(` +`).length-1)}ignoreEvent(){return!0}};function dg(t,e){if(!t.length)return $(`\u5DF2\u9009 ${e} \u683C`,`${e} cells`);let n=t.reduce((i,o)=>i+o.value,0),r=i=>t.every(o=>o[i]===t[0][i])?t[0][i]:"",s={prefix:r("prefix"),suffix:r("suffix"),decimals:Math.min(4,Math.max(...t.map(i=>i.decimals)))};return $(`\u6C42\u548C ${Ae(n,s)} \xB7 \u5E73\u5747 ${Ae(n/t.length,s,2)} \xB7 \u8BA1\u6570 ${t.length}`,`Sum ${Ae(n,s)} \xB7 Average ${Ae(n/t.length,s,2)} \xB7 Count ${t.length}`)}function uu(t,e){let n=[];for(let r of fn(t))n.push(C.replace({widget:new zo(t.sliceDoc(r.from,r.to),e),block:!0}).range(r.from,r.to));return C.set(n,!0)}function hu(t,e,n){let r=null;for(let o of t.dom.querySelectorAll(".cm-table-edit"))tr(t,o)?.from===e&&(r=o);let s=r?Ue.get(r):null;if(!r||!s||r.classList.contains("readonly"))return!1;let i=s.cells[n==="first"?0:s.cells.length-1][0];return i.focus(),qt(i,"end"),!0}var er=t=>t.trimStart().startsWith("|"),pg=ze.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")||t.isUserEvent("input.type.compose")||t.startState.selection.ranges.length>1)return t;let e=null,n=!1;t.changes.iterChanges((d,p,f,m,b)=>{e&&(n=!0),e={from:d,to:p,text:b.toString()}});let r=e;if(n||!r||r.from!==r.to||!r.text||r.text.includes(` +`)||er(r.text))return t;let s=t.startState.doc,i=s.lineAt(r.from);if(i.text.trim()!=="")return t;let o=i.number>1&&er(s.line(i.number-1).text),a=i.numberd.to===i.from-1),O=a&&l.some(d=>d.from===i.to+1);if(!c&&!O)return t;let u=(c?` +`:"")+r.text+(O?` +`:"");return{changes:{from:i.from,to:i.to,insert:u},selection:{anchor:i.from+(c?1:0)+r.text.length},scrollIntoView:!0,userEvent:"input.type"}});function mg(t){let{state:e}=t,n=e.doc.lineAt(e.selection.main.head);if(!n.text.trim()||er(n.text))return;if(fn(e).find(i=>i.to===n.to&&i.fromuu(n,t),update(n,r){return r.docChanged||I(r.startState)!==I(r.state)?uu(r.state,t):n},provide:n=>j.decorations.from(n)}),pg,j.domEventHandlers({compositionend:(n,r)=>{setTimeout(()=>{r.composing||mg(r)},0)}}),Ye.high(Ne.of([{key:"ArrowDown",run:n=>{let r=n.state.selection.main;if(!r.empty)return!1;let s=n.state.doc.lineAt(r.head);if(s.number>=n.state.doc.lines)return!1;let i=n.state.doc.line(s.number+1),o=fn(n.state).find(a=>a.from===i.from);return!!o&&hu(n,o.from,"first")}},{key:"ArrowUp",run:n=>{let r=n.state.selection.main;if(!r.empty)return!1;let s=n.state.doc.lineAt(r.head);if(s.number<=1)return!1;let i=n.state.doc.line(s.number-1),o=fn(n.state).find(a=>a.to===i.to);return!!o&&hu(n,o.from,"last")}}]))]}function gg(t,e,n){let s=_o(iu(e,n,m=>$(`\u5217 ${m}`,`Column ${m}`))),{state:i}=t,o=i.selection.main,a=i.doc.lineAt(o.from),l=a.text.trim()==="",c=l?a.from:o.to,O=l?a.to:o.to,u=l&&a.number>1?i.doc.line(a.number-1).text.trim():"",h=l?u?` +`:"":` + +`,d=h+s+` +`+(O===i.doc.length?` +`:""),p=c+h.length;st={from:p,row:0,col:0,caret:"all"};let f=lu(s)[0];t.dispatch({changes:{from:c,to:O,insert:d},selection:{anchor:p+f.from,head:p+f.to},scrollIntoView:!0,userEvent:"input.table"}),t.focus(),setTimeout(()=>{st?.from===p&&(st=null)},600)}function mu(t){document.querySelector(".cm-table-picker")?.remove();let e=8,n=8,r=3,s=3,i=document.createElement("div");i.className="cm-table-picker",i.setAttribute("role","dialog"),i.setAttribute("aria-label",$("\u63D2\u5165\u8868\u683C","Insert table"));let o=document.createElement("div");o.className="cm-table-picker-label";let a=document.createElement("div");a.className="cm-table-picker-grid",a.style.gridTemplateColumns=`repeat(${e}, 1fr)`;let l=[];for(let Q=1;Q<=n;Q++)for(let y=1;y<=e;y++){let k=document.createElement("button");k.type="button",k.tabIndex=-1,k.dataset.r=String(Q),k.dataset.c=String(y),k.setAttribute("aria-label",`${y} \xD7 ${Q}`),k.addEventListener("mouseenter",()=>O(y,Q)),k.addEventListener("mousedown",w=>w.preventDefault()),k.addEventListener("click",()=>u(!0,y,Q)),l.push(k),a.append(k)}let c=document.createElement("div");c.className="cm-table-picker-hint",c.textContent=$("\u542B\u8868\u5934\u4E00\u884C \xB7 \u4E4B\u540E\u53EF\u968F\u65F6\u589E\u5220\u884C\u5217","Plus a header row \xB7 add or remove rows and columns any time"),i.append(o,a,c);function O(Q,y){r=Math.max(1,Math.min(e,Q)),s=Math.max(1,Math.min(n,y));for(let k of l)k.classList.toggle("on",+k.dataset.c<=r&&+k.dataset.r<=s);o.textContent=$(`${r} \u5217 \xD7 ${s} \u884C`,`${r} columns \xD7 ${s} rows`)}function u(Q,y=r,k=s){i.remove(),document.removeEventListener("keydown",h,!0),document.removeEventListener("mousedown",d,!0),Q?gg(t,y,k):t.focus()}function h(Q){let y={ArrowRight:[1,0],ArrowLeft:[-1,0],ArrowDown:[0,1],ArrowUp:[0,-1]};if(y[Q.key])O(r+y[Q.key][0],s+y[Q.key][1]);else if(Q.key==="Enter")u(!0);else if(Q.key==="Escape")u(!1);else return;Q.preventDefault(),Q.stopPropagation()}function d(Q){i.contains(Q.target)||u(!1)}O(r,s),document.body.append(i);let p=t.coordsAtPos(t.state.selection.main.head),f=i.offsetWidth,m=i.offsetHeight,b=Math.max(8,Math.min((p?.left??40)-12,window.innerWidth-f-8)),g=(p?.bottom??40)+6;i.style.left=`${b}px`,i.style.top=`${g+m>window.innerHeight-8?Math.max(8,(p?.top??40)-m-6):g}px`,document.addEventListener("keydown",h,!0),document.addEventListener("mousedown",d,!0)}var bg=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,Uo=class extends fe{constructor(n,r,s){super();this.src=n;this.alt=r;this.kind=s}eq(n){return n.src===this.src&&n.alt===this.alt&&n.kind===this.kind}toDOM(){let n=document.createElement("span");if(n.className="cm-media",this.kind==="video"||this.kind==="audio"){let r=document.createElement(this.kind);r.src=this.src,r.controls=!0,r.preload="metadata",n.appendChild(r)}else if(this.kind==="file"){let r=document.createElement("a");r.className="cm-file-card",r.href=this.src,r.target="_blank",r.rel="noopener",r.textContent="\u{1F4CE} "+(this.alt||"file"),n.appendChild(r)}else{let r=document.createElement("img");r.src=this.src,r.alt=this.alt,r.loading="lazy",r.onerror=()=>n.classList.add("cm-media-broken"),n.appendChild(r)}return n}ignoreEvent(){return!1}},Wo=class extends fe{constructor(n,r){super();this.checked=n;this.pos=r}eq(n){return n.checked===this.checked&&n.pos===this.pos}toDOM(n){let r=document.createElement("input");return r.type="checkbox",r.className="cm-task",r.checked=this.checked,r.setAttribute("aria-label",this.checked?$("\u5DF2\u5B8C\u6210","Done"):$("\u5F85\u529E","To-do")),r.addEventListener("mousedown",s=>{s.preventDefault(),BO(n,this.pos)}),r}ignoreEvent(){return!0}},Io=class extends fe{toDOM(){let e=document.createElement("span");return e.className="cm-hr-widget",e}eq(){return!0}},Do=class extends fe{toDOM(){let e=document.createElement("span");return e.className="cm-bullet",e.textContent="\u2022",e}eq(){return!0}},We=C.replace({}),Os=t=>C.line({class:t}),nr=t=>C.mark({class:t});function xg(t){let e=new Set;for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from).number,s=t.doc.lineAt(n.to).number;for(let i=r;i<=s;i++)e.add(i)}return e}function Qg(t,e,n){return t.selection.ranges.some(r=>r.from<=n&&r.to>=e)}var $g=/\[\[([^[\]\n]+?)\]\]/g;function gu(t,e,n){let{state:r}=t,s=[],i=n?xg(r):new Set,o=h=>i.has(r.doc.lineAt(h).number),a=(h,d)=>n&&Qg(r,h,d),l=[],c=vo(r),O=c&&!qO(r,c.from,c.to,n);if(c&&O)for(let h=1;h<=r.doc.lineAt(c.to).number;h++)s.push(Os("cm-frontmatter").range(r.doc.line(h).from));for(let{from:h,to:d}of t.visibleRanges){I(r).iterate({from:h,to:d,enter(f){let m=f.name;if(c&&m!=="Document"&&f.to<=c.to)return!1;let b=/^ATXHeading(\d)$/.exec(m);if(b){let g=r.doc.lineAt(f.from);if(s.push(Os(`cm-h cm-h${b[1]}`).range(g.from)),!o(f.from)){let Q=f.node.getChild("HeaderMark");Q&&s.push(We.range(Q.from,Math.min(Q.to+1,g.to)))}return}switch(m){case"Table":return fu(r,f.from,f.to,n)?!1:void 0;case"FencedCode":case"CodeBlock":{l.push([f.from,f.to]);let g=f.node.getChild("CodeInfo"),Q=f.node.getChild("CodeText");if(g&&Q&&r.sliceDoc(g.from,g.to).trim().toLowerCase()==="mermaid"&&r.sliceDoc(Q.from,Q.to).trim()&&!(n&&os(r,f.from,f.to))||g&&r.sliceDoc(g.from,g.to).trim().toLowerCase()==="ivy-query"&&!(n&&os(r,f.from,f.to)))return!1;let y=r.doc.lineAt(f.from).number,k=r.doc.lineAt(f.to).number;if(m==="FencedCode"&&!a(f.from,f.to)){let w=r.doc.line(y),P=r.doc.line(k);w.to>w.from&&s.push(We.range(w.from,w.to)),k!==y&&P.to>P.from&&/^\s*(```|~~~)/.test(P.text)&&s.push(We.range(P.from,P.to))}for(let w=y;w<=k;w++){let P=r.doc.line(w),E="cm-codeblock";w===y&&(E+=" cm-codeblock-first"),w===k&&(E+=" cm-codeblock-last"),s.push(Os(E).range(P.from))}return!1}case"StrongEmphasis":case"Emphasis":case"Strikethrough":case"InlineCode":{let g=m==="StrongEmphasis"?"cm-strong":m==="Emphasis"?"cm-em":m==="Strikethrough"?"cm-strike":"cm-inline-code";if(s.push(nr(g).range(f.from,f.to)),!a(f.from,f.to)){let Q=m==="InlineCode"?"CodeMark":m==="Strikethrough"?"StrikethroughMark":"EmphasisMark",y=f.node.firstChild;for(;y;)y.name===Q&&s.push(We.range(y.from,y.to)),y=y.nextSibling}return m!=="InlineCode"}case"Link":{if(a(f.from,f.to))return;let g=f.node.getChildren("LinkMark"),Q=f.node.getChild("URL");return g.length>=2&&(s.push(We.range(g[0].from,g[0].to)),s.push(nr("cm-link").range(g[0].to,g[1].from)),s.push(We.range(g[1].from,f.to))),!1}case"Image":{let g=f.node.getChild("URL");if(!g)return!1;let Q=r.sliceDoc(g.from,g.to),y=bg.exec(Q),k=y?e.resolveResource(y[1]):Q,w=y?e.resourceKind(y[1]):void 0,P=f.node.getChildren("LinkMark"),E=P.length>=2?r.sliceDoc(P[0].to,P[1].from):"";if(!k||/^javascript:/i.test(k))return!1;let T=new Uo(k,E,w);return o(f.from)?s.push(C.widget({widget:T,side:1}).range(f.to)):s.push(C.replace({widget:T}).range(f.from,f.to)),!1}case"Blockquote":{let g=r.doc.lineAt(f.from).number,Q=r.doc.lineAt(f.to).number;for(let y=g;y<=Q;y++)s.push(Os("cm-quote").range(r.doc.line(y).from));return}case"QuoteMark":{if(!o(f.from)){let g=r.sliceDoc(f.to,f.to+1)===" "?f.to+1:f.to;s.push(We.range(f.from,g))}return}case"HorizontalRule":{o(f.from)||s.push(C.replace({widget:new Io}).range(f.from,f.to));return}case"ListMark":{let g=r.sliceDoc(f.from,f.to),Q=g==="-"||g==="*"||g==="+",y=r.sliceDoc(f.to,f.to+4),k=/^ \[[ xX]\]/.test(y);Q&&!o(f.from)?k?s.push(We.range(f.from,f.to+1)):s.push(C.replace({widget:new Do}).range(f.from,f.to)):s.push(nr("cm-list-mark").range(f.from,f.to));return}case"TaskMarker":{let g=/x/i.test(r.sliceDoc(f.from,f.to));if(!a(f.from,f.to)&&(s.push(C.replace({widget:new Wo(g,f.from)}).range(f.from,f.to)),g)){let Q=r.doc.lineAt(f.from);f.to+1m>=P&&b<=E))continue;let g=f[1],Q=g.indexOf("|"),y=(Q>=0?g.slice(0,Q):g).split("#")[0].trim(),k=!!e.resolveTitle(y),w={"data-wiki":y};if(a(m,b)){s.push(C.mark({class:"cm-wikilink cm-wikilink-src"+(k?"":" cm-wikilink-missing"),attributes:w}).range(m,b));continue}s.push(We.range(m,m+2+(Q>=0?Q+1:0))),s.push(C.mark({class:"cm-wikilink cm-wikilink-rendered"+(k?"":" cm-wikilink-missing"),attributes:w}).range(m+2+(Q>=0?Q+1:0),b-2)),s.push(We.range(b-2,b))}}let u=s.filter(h=>h.value.point===!0);return{all:C.set(s,!0),atomic:C.set(u,!0)}}function bu(t){let e=je.fromClass(class{decorations;atomic;constructor(n){let r=gu(n,t,n.hasFocus);this.decorations=r.all,this.atomic=r.atomic}update(n){if(n.docChanged||n.viewportChanged||n.selectionSet||n.focusChanged||I(n.startState)!==I(n.state)){let r=gu(n.view,t,n.view.hasFocus);this.decorations=r.all,this.atomic=r.atomic}}},{decorations:n=>n.decorations,eventHandlers:{mousedown(n,r){let s=n.target.closest(".cm-wikilink");if(!s)return!1;let i=s.classList.contains("cm-wikilink-rendered"),o=n.button===1||n.shiftKey;if(n.button>1||!i&&!(n.metaKey||n.ctrlKey||n.button===1))return!1;let a=s.dataset.wiki??"";return n.preventDefault(),t.openNote(t.resolveTitle(a),a,o),!0},click(n){let r=n.target.closest(".cm-link, .cm-file-card");return r&&(n.metaKey||n.ctrlKey)&&r instanceof HTMLAnchorElement?(window.open(r.href,"_blank","noopener"),!0):!1}}});return[e,nu(),pu(t),YO(t),NO(),j.atomicRanges.of(n=>n.plugin(e)?.atomic??C.none)]}var xu=j.theme({"&":{color:"rgb(var(--ink))",backgroundColor:"transparent",height:"100%"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit",lineHeight:"1.85",overflow:"visible"},".cm-content":{padding:"0 0 40vh",caretColor:"rgb(var(--ivy))"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"rgb(var(--ivy))",borderLeftWidth:"2px"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:"rgb(var(--ivy) / 0.2) !important"},".cm-placeholder":{color:"rgb(var(--faint))"},".cm-tooltip":{border:"none",backgroundColor:"rgb(var(--surface))",borderRadius:"14px",boxShadow:"var(--shadow-lift)",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif',maxHeight:"min(340px, 45vh)",padding:"4px",minWidth:"240px"},".cm-tooltip-autocomplete > ul > li":{display:"flex",alignItems:"center",padding:"7px 10px",borderRadius:"10px",lineHeight:"1.4"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"rgb(var(--sunken))",color:"rgb(var(--ink))"},".cm-completionDetail":{marginLeft:"8px",color:"rgb(var(--muted))",fontStyle:"normal",fontSize:"12px"},".cm-completionIcon":{display:"none"},".cm-panels":{backgroundColor:"rgb(var(--surface))",color:"rgb(var(--ink))",border:"none"},".cm-searchMatch":{backgroundColor:"rgb(var(--warn) / 0.3)"},".cm-searchMatch-selected":{backgroundColor:"rgb(var(--warn) / 0.55)"}}),Qu=Ha(Ba.define([{tag:x.heading,fontWeight:"600"},{tag:x.strong,fontWeight:"600"},{tag:x.emphasis,fontStyle:"italic"},{tag:x.strikethrough,textDecoration:"line-through"},{tag:x.link,color:"rgb(var(--ivy))"},{tag:x.url,color:"rgb(var(--ivy))"},{tag:x.monospace,fontFamily:"var(--font-mono)",color:"rgb(var(--warn-ink))"},{tag:x.quote,color:"rgb(var(--ink-2))"},{tag:[x.processingInstruction,x.contentSeparator,x.meta],color:"rgb(var(--faint))"},{tag:x.labelName,color:"rgb(var(--muted))"}]));function $u(t){return e=>{let n=e.matchBefore(/\[\[[^\]\n|#]*$/);if(!n)return null;let r=n.text.slice(2).toLowerCase(),s=e.state.sliceDoc(e.pos,e.pos+2),i=[],o=new Set;for(let a of t())if(!(!a.title||o.has(a.title))&&(o.add(a.title),!(r&&!a.title.toLowerCase().includes(r))&&(i.push({label:a.title,detail:a.detail,type:"text",boost:a.title.toLowerCase().startsWith(r)?1:0,apply:(l,c,O,u)=>{let h=s==="]]"?"":"]]";l.dispatch({changes:{from:O,to:u,insert:c.label+h},selection:{anchor:O+c.label.length+2}})}}),i.length>=50)))break;if(r&&!o.has(n.text.slice(2))){let a=n.text.slice(2);i.push({label:a,detail:$("\u65B0\u5EFA\u94FE\u63A5","New link"),type:"keyword",boost:-1,apply:(l,c,O,u)=>l.dispatch({changes:{from:O,to:u,insert:a+(s==="]]"?"":"]]")},selection:{anchor:O+a.length+2}})})}return{from:n.from+2,options:i,validFor:/^[^\]\n|#]*$/}}}var Vo={text:["\u6587\u672C","Text"],list:["\u5217\u8868\u4E0E\u5F85\u529E","Lists & to-dos"],time:["\u65E5\u671F\u4E0E\u65F6\u95F4","Dates & time"],block:["\u5757","Blocks"],link:["\u94FE\u63A5\u4E0E\u6587\u4EF6","Links & files"],help:["\u5E2E\u52A9","Help"]},kg=[{id:"h1",section:"text",label:["\u4E00\u7EA7\u6807\u9898","Heading 1"],desc:["\u5927\u6807\u9898\uFF0C\u5F00\u542F\u4E00\u4E2A\u7AE0\u8282","Big heading for a section"],icon:"H1",keys:["biaoti","bt","heading","title","#"],hint:"#"},{id:"h2",section:"text",label:["\u4E8C\u7EA7\u6807\u9898","Heading 2"],desc:["\u4E2D\u6807\u9898","Medium heading"],icon:"H2",keys:["biaoti","bt","heading","subtitle","##"],hint:"##"},{id:"h3",section:"text",label:["\u4E09\u7EA7\u6807\u9898","Heading 3"],desc:["\u5C0F\u6807\u9898","Small heading"],icon:"H3",keys:["biaoti","bt","heading","###"],hint:"###"},{id:"bold",section:"text",label:["\u52A0\u7C97","Bold"],desc:["\u8BA9\u6587\u5B57\u66F4\u9192\u76EE","Make text stand out"],icon:"B",keys:["jiacu","jc","cuti","strong","**"],hint:"**"},{id:"italic",section:"text",label:["\u659C\u4F53","Italic"],desc:["\u503E\u659C\uFF0C\u8F7B\u8F7B\u5F3A\u8C03","Slanted emphasis"],icon:"I",keys:["xieti","xt","em","emphasis"],hint:"*"},{id:"strike",section:"text",label:["\u5220\u9664\u7EBF","Strikethrough"],desc:["\u5212\u6389\u4E0D\u518D\u9700\u8981\u7684\u5185\u5BB9","Cross something out"],icon:"S",keys:["shanchuxian","scx","strike","del","~~"],hint:"~~"},{id:"highlight",section:"text",label:["\u9AD8\u4EAE","Highlight"],desc:["\u50CF\u8367\u5149\u7B14\u4E00\u6837\u6807\u8BB0","Mark it like a highlighter"],icon:"A",keys:["gaoliang","gl","mark","highlight","=="],hint:"=="},{id:"code",section:"text",label:["\u884C\u5185\u4EE3\u7801","Inline code"],desc:["\u7B49\u5BBD\u7684\u4EE3\u7801\u6216\u547D\u4EE4","A code word or command"],icon:"\u2039\u203A",keys:["daima","dm","code","`"],hint:"`"},{id:"quote",section:"text",label:["\u5F15\u7528","Quote"],desc:["\u5F15\u7528\u4E00\u6BB5\u8BDD","Quote a passage"],icon:"\u275D",keys:["yinyong","yy","quote","blockquote",">"],hint:">"},{id:"todo",section:"list",label:["\u5F85\u529E","To-do"],desc:["\u53EF\u4EE5\u52FE\u9009\u5B8C\u6210\u7684\u4E8B\u9879","Something to check off"],icon:"\u2610",keys:["daiban","db","renwu","rw","task","todo","checkbox","[]"],hint:"- [ ]"},{id:"bullet",section:"list",label:["\u65E0\u5E8F\u5217\u8868","Bulleted list"],desc:["\u7B80\u5355\u7684\u9879\u76EE\u5217\u8868","A simple list"],icon:"\u2022",keys:["liebiao","lb","wuxu","wx","list","bullet","ul","-"],hint:"-"},{id:"ordered",section:"list",label:["\u6709\u5E8F\u5217\u8868","Numbered list"],desc:["\u5E26\u7F16\u53F7\u7684\u6B65\u9AA4","Numbered steps"],icon:"1.",keys:["liebiao","lb","youxu","yx","list","numbered","ol","1."],hint:"1."},{id:"due",section:"time",label:["\u65E5\u671F\u4E0E\u63D0\u9192","Date & reminder"],desc:["\u7ED9\u5F85\u529E\u8BBE\u65E5\u671F\u548C\u91CD\u590D\uFF0C\u5230\u70B9\u63D0\u9192","Due date and repeat, with a reminder"],icon:"\u{1F4C5}",keys:["riqi","rq","tixing","tx","richeng","rc","date","due","remind","reminder","deadline","jiezhi"],hint:"@"},{id:"today",section:"time",label:["\u4ECA\u5929\u7684\u65E5\u671F","Today's date"],desc:["\u63D2\u5165\u4ECA\u5929\u7684\u65E5\u671F","Insert the date of today"],icon:"\u{1F5D3}",keys:["jintian","jt","riqi","rq","today","date"]},{id:"now",section:"time",label:["\u5F53\u524D\u65F6\u95F4","Current time"],desc:["\u63D2\u5165\u73B0\u5728\u7684\u65E5\u671F\u548C\u65F6\u95F4","Insert the date and time"],icon:"\u{1F558}",keys:["shijian","sj","xianzai","xz","now","time"]},{id:"codeblock",section:"block",label:["\u4EE3\u7801\u5757","Code block"],desc:["\u591A\u884C\u4EE3\u7801\uFF0C\u4FDD\u7559\u539F\u6837","Multi-line code, kept as is"],icon:"{}",keys:["daimakuai","dmk","daima","code","codeblock","```"],hint:"```"},{id:"table",section:"block",label:["\u8868\u683C","Table"],desc:["\u884C\u548C\u5217\uFF0C\u6570\u5B57\u5217\u81EA\u52A8\u5408\u8BA1","Rows and columns, with totals"],icon:"\u25A6",keys:["biaoge","bg","table","grid","|"],hint:"|"},{id:"divider",section:"block",label:["\u5206\u5272\u7EBF","Divider"],desc:["\u4E00\u6761\u6A2A\u7EBF\uFF0C\u5206\u5F00\u5185\u5BB9","A line between sections"],icon:"\u2014",keys:["fengexian","fgx","divider","hr","line","rule","---"],hint:"---"},{id:"properties",section:"block",label:["\u7B14\u8BB0\u5C5E\u6027","Properties"],desc:["\u7B14\u8BB0\u5F00\u5934\u7684\u952E\u503C\u4FE1\u606F","Key\u2013value facts at the top"],icon:"\u2699",keys:["shuxing","sx","properties","frontmatter","yaml","meta"],hint:"---"},{id:"query",section:"block",label:["\u7B14\u8BB0\u67E5\u8BE2","Note query"],desc:["\u628A\u5E26\u5C5E\u6027\u7684\u7B14\u8BB0\u6C47\u6210\u8868\u683C","Notes gathered into a table"],icon:"\u2315",keys:["chaxun","cx","query","database","shujuku","sjk","biaoge"]},{id:"mermaid",section:"block",label:["\u56FE\u8868\uFF08Mermaid\uFF09","Diagram (Mermaid)"],desc:["\u6D41\u7A0B\u56FE\u3001\u65F6\u5E8F\u56FE\u7B49","Flowcharts and more"],icon:"\u29C9",keys:["tubiao","tb","liuchengtu","lct","diagram","mermaid","flowchart","chart"]},{id:"wiki",section:"link",label:["\u94FE\u63A5\u5230\u7B14\u8BB0","Link to note"],desc:["\u94FE\u63A5\u5230\u53E6\u4E00\u7BC7\u7B14\u8BB0","Link to another note"],icon:"[[",keys:["shuanglian","sl","lianjie","lj","wiki","link","note","[["],hint:"[["},{id:"link",section:"link",label:["\u7F51\u9875\u94FE\u63A5","Web link"],desc:["\u63D2\u5165\u4E00\u4E2A\u7F51\u5740","Insert a web address"],icon:"\u2197",keys:["lianjie","lj","wangzhi","wz","link","url","href"]},{id:"image",section:"link",label:["\u56FE\u7247\u6216\u89C6\u9891","Image or video"],desc:["\u4ECE\u8BBE\u5907\u9009\u62E9\u56FE\u7247\u6216\u89C6\u9891","From this device"],icon:"\u{1F5BC}",keys:["tupian","tp","zhaopian","zp","shipin","sp","image","photo","picture","video","img"],host:"image"},{id:"file",section:"link",label:["\u9644\u4EF6","Attachment"],desc:["\u63D2\u5165\u6587\u4EF6\u6216\u5A92\u4F53\u5E93\u4E2D\u7684\u6587\u4EF6","A file, or one from the library"],icon:"\u{1F4CE}",keys:["fujian","fj","wenjian","wj","file","attachment","upload"],host:"file"},{id:"help",section:"help",label:["Markdown \u4E0E\u5FEB\u6377\u952E","Markdown & shortcuts"],desc:["\u6240\u6709\u5199\u6CD5\u4E0E\u5FEB\u6377\u952E\u4E00\u89C8","Every syntax and shortcut"],icon:"?",keys:["bangzhu","bz","yufa","yf","help","markdown","shortcuts","kuaijiejian","kjj","guide"],host:"help"}];function ku(t,e=[],n=kg){let r=n.filter(o=>!o.host||e.includes(o.host)),s=t.trim().toLowerCase();if(!s)return r;let i=[];return r.forEach((o,a)=>{let l=o.label[0].toLowerCase(),c=o.label[1].toLowerCase(),O=0;l===s||c===s||o.id===s?O=100:l.startsWith(s)||c.startsWith(s)||o.id.startsWith(s)?O=80:o.keys.some(u=>u===s)?O=70:o.keys.some(u=>u.startsWith(s))?O=60:l.includes(s)||c.includes(s)?O=40:c.split(/\W+/).some(u=>u.startsWith(s))&&(O=35),O&&i.push({item:o,score:O,order:a})}),i.sort((o,a)=>a.score-o.score||o.order-a.order).map(o=>o.item)}var No=()=>$("zh","en")==="zh";function yg(t,e){let n=I(t).resolveInner(e,-1);for(let i=n;i;i=i.parent)if(i.name==="FencedCode"||i.name==="CodeBlock"||i.name==="InlineCode"||i.name==="CodeText"||i.name==="URL"||i.name==="Autolink")return!0;let r=t.sliceDoc(0,Math.min(t.doc.length,2e4)),s=ft(r);return!!s&&e<=s.to}function Sg(t,e,n){let r=(s,i)=>No()?s:i;switch(e.id){case"h1":te(t,"# ");return;case"h2":te(t,"## ");return;case"h3":te(t,"### ");return;case"bold":re(t,"**",r("\u52A0\u7C97","bold"));return;case"italic":re(t,"*",r("\u659C\u4F53","italic"));return;case"strike":re(t,"~~",r("\u5220\u9664\u7EBF","strikethrough"));return;case"highlight":re(t,"==",r("\u9AD8\u4EAE","highlight"));return;case"code":re(t,"`","code");return;case"quote":te(t,"> ");return;case"todo":te(t,"- [ ] ");return;case"bullet":te(t,"- ");return;case"ordered":te(t,"1. ");return;case"due":_t(t);return;case"today":Et(t,ne(new Date));return;case"now":{let s=new Date;Et(t,`${ne(s)} ${Nn(s)}`);return}case"codeblock":Go(t,"```\n","\n```");return;case"table":mu(t);return;case"divider":Et(t,"---",!0);return;case"properties":wg(t);return;case"query":Go(t,"```ivy-query\nfrom: ",` +show: +sort: ${r("\u66F4\u65B0","updated")} desc +\`\`\``);return;case"mermaid":Go(t,"```mermaid\nflowchart TD\n A[",`${r("\u5F00\u59CB","Start")}] --> B[${r("\u7ED3\u675F","End")}] +\`\`\``);return;case"wiki":Ct(t);return;case"link":Rt(t);return;default:e.host&&n.host?.(e.host)}}function Go(t,e,n){let{state:r}=t,s=r.selection.main,i=r.doc.lineAt(s.from),o=i.text.trim()===""?"":` +`,a=i.text.trim()===""?i.from:s.from,l=i.text.trim()===""?i.to:s.to,c=o+e+n+(l===r.doc.length?` +`:"");t.dispatch({changes:{from:a,to:l,insert:c},selection:{anchor:a+o.length+e.length},scrollIntoView:!0,userEvent:"input"}),t.focus()}function wg(t){let e=ft(t.state.sliceDoc(0,Math.min(t.state.doc.length,2e4)));if(e){let n=t.state.doc.line(Math.max(2,e.endLine));t.dispatch({selection:{anchor:n.to},scrollIntoView:!0})}else t.dispatch({changes:{from:0,insert:`--- + +--- +`},selection:{anchor:4},scrollIntoView:!0,userEvent:"input"});t.focus()}var fs=oe.define(),us=xe.define({create:()=>null,update(t,e){for(let n of e.effects)if(n.is(fs))return n.value;return!t||!e.docChanged?t:{from:e.changes.mapPos(t.from),to:e.changes.mapPos(t.to,1)}}}),Pg={quote:'',todo:'',bullet:'',ordered:'',due:'',today:'',now:'',codeblock:'',table:'',divider:'',properties:'',query:'',mermaid:'',link:'',image:'',file:'',help:''},hs=new WeakMap,yu={optionClass:t=>hs.has(t)?"ivy-insert-row":"",addToOptions:[{position:20,render:t=>{let e=hs.get(t);if(!e)return null;let n=document.createElement("span");n.className=`ivy-insert-icon ivy-insert-icon-${e.id}`;let r=Pg[e.id];return r?n.innerHTML=`${r}`:n.textContent=e.icon,n.setAttribute("aria-hidden","true"),n}},{position:60,render:t=>{let e=hs.get(t);if(!e)return null;let n=document.createElement("span");return n.className="ivy-insert-desc",n.textContent=No()?e.desc[0]:e.desc[1],n}}]};function vg(t,e,n){let r=ku(t,n.hosts??[]),s=No();return r.map((i,o)=>{let a=s?i.label[0]:i.label[1],l={label:a+"\u200B"+i.id,displayLabel:a,detail:i.hint,type:"insert",section:t?void 0:{name:Vo[i.section][s?0:1],rank:Object.keys(Vo).indexOf(i.section)},boost:-o,apply:(c,O,u,h)=>{let d=c.state.field(us,!1),p=d&&d.to>=e&&d.from<=e?d.from:e;c.dispatch({changes:{from:p,to:h,insert:""},effects:fs.of(null),selection:{anchor:p}}),Sg(c,i,n)}};return hs.set(l,i),l})}function Su(t={}){return e=>{let n=e.matchBefore(/(?:^|[\s ])\/[^\s/]{0,16}$/);if(!n)return null;let r=n.from+n.text.indexOf("/");if(yg(e.state,r))return null;let s=e.state.sliceDoc(r+1,e.pos),i=vg(s,r,t);return i.length?{from:r,options:i,filter:!1}:null}}function wu(){return[us,j.updateListener.of(t=>{!t.state.field(us,!1)||Er(t.state)!==null||Er(t.startState)===null||queueMicrotask(()=>{let e=t.view,n=e.state.field(us,!1);if(!n||Er(e.state)!==null)return;let r=/^ ?\/$/.test(e.state.sliceDoc(n.from,n.to));e.dispatch({changes:r?{from:n.from,to:n.to,insert:""}:void 0,effects:fs.of(null)})})})]}function Bo(t){if(t.state.readOnly)return!1;ai(t);let e=t.state.selection.main,n=t.state.sliceDoc(Math.max(0,e.from-1),e.from),r=n&&!/\s/.test(n)?" /":"/";return t.dispatch({changes:{from:e.from,to:e.to,insert:r},selection:{anchor:e.from+r.length},effects:fs.of({from:e.from,to:e.from+r.length}),userEvent:"input.type"}),t.focus(),vn(t),!0}var Zg=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform)?"\u2318":"Ctrl+",Xg=[{id:"bold",glyph:"B",label:["\u52A0\u7C97","Bold"],keys:"B",run:t=>re(t,"**")},{id:"italic",glyph:"I",label:["\u659C\u4F53","Italic"],keys:"I",run:t=>re(t,"*")},{id:"strike",glyph:"S",label:["\u5220\u9664\u7EBF","Strikethrough"],keys:"Shift+X",run:t=>re(t,"~~")},{id:"highlight",glyph:"A",label:["\u9AD8\u4EAE","Highlight"],run:t=>re(t,"==")},{id:"code",glyph:"\u2039\u203A",label:["\u884C\u5185\u4EE3\u7801","Code"],keys:"E",run:t=>re(t,"`")},{id:"link",glyph:"\u2197",label:["\u94FE\u63A5","Link"],keys:"K",run:t=>Rt(t)},{id:"wiki",glyph:"[[",label:["\u94FE\u63A5\u5230\u7B14\u8BB0","Link to note"],keys:"Shift+K",run:t=>Ct(t)},{id:"h2",glyph:"H",label:["\u6807\u9898","Heading"],keys:"Alt+2",run:t=>te(t,"## ")},{id:"quote",glyph:"\u275D",label:["\u5F15\u7528","Quote"],run:t=>te(t,"> ")}];function Pu(){return je.fromClass(class{constructor(t){this.view=t;this.onDown=this.onDown.bind(this),this.onUp=this.onUp.bind(this),this.onKey=this.onKey.bind(this),this.hide=this.hide.bind(this),t.contentDOM.addEventListener("mousedown",this.onDown),document.addEventListener("mouseup",this.onUp),t.contentDOM.addEventListener("keydown",this.onKey),t.contentDOM.addEventListener("blur",this.hide),window.addEventListener("scroll",this.hide,!0)}bar=null;fromMouse=!1;fine(){return typeof matchMedia<"u"&&matchMedia("(pointer: fine)").matches}onDown(t){this.fromMouse=t.button===0,this.hide()}onUp(){this.fromMouse&&(this.fromMouse=!1,setTimeout(()=>this.show(),0))}onKey(){this.hide()}show(){let{view:t}=this,e=t.state.selection.main;if(e.empty||t.state.readOnly||!this.fine()||!t.hasFocus)return this.hide();if(t.state.doc.lineAt(e.to).number-t.state.doc.lineAt(e.from).number>6)return this.hide();let n=t.coordsAtPos(e.from),r=t.coordsAtPos(e.to);if(!n||!r)return this.hide();if(!this.bar){this.bar=document.createElement("div"),this.bar.className="ivy-bubble",this.bar.setAttribute("role","toolbar"),this.bar.setAttribute("aria-label",$("\u683C\u5F0F","Format"));for(let c of Xg){let O=document.createElement("button");O.type="button",O.className="ivy-bubble-btn ivy-bubble-"+c.id,O.textContent=c.glyph;let u=$(c.label[0],c.label[1]);O.setAttribute("aria-label",u),O.title=c.keys?`${u} (${Zg()}${c.keys})`:u,O.addEventListener("mousedown",h=>h.preventDefault()),O.addEventListener("click",()=>{c.run(this.view),setTimeout(()=>this.show(),0)}),this.bar.append(O)}document.body.append(this.bar)}let s=this.bar,i=Math.min(n.top,r.top),o=(Math.min(n.left,r.left)+Math.max(n.right,r.right))/2,a=s.offsetWidth,l=s.offsetHeight;s.style.left=`${Math.max(8,Math.min(window.innerWidth-a-8,o-a/2))}px`,s.style.top=`${i-l-8<8?Math.max(n.bottom,r.bottom)+8:i-l-8}px`}hide(){this.bar?.remove(),this.bar=null}update(t){this.bar&&(t.state.selection.main.empty||t.focusChanged&&!t.view.hasFocus?this.hide():(t.docChanged||t.selectionSet)&&this.show())}destroy(){this.hide(),this.view.contentDOM.removeEventListener("mousedown",this.onDown),document.removeEventListener("mouseup",this.onUp),this.view.contentDOM.removeEventListener("keydown",this.onKey),this.view.contentDOM.removeEventListener("blur",this.hide),window.removeEventListener("scroll",this.hide,!0)}})}function Ho(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}var ds=t=>t?`"${t}" `:"";function ps(t,e=""){if(typeof t!="boolean")throw new TypeError(ds(e)+"expected boolean, got type="+typeof t);return t}function mt(t,e=""){if(typeof t!="number")throw new TypeError(ds(e)+"expected number, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError(ds(e)+"expected integer >= 0, got "+t);return t}function ie(t,e,n=""){if(Ho(t)&&(e===void 0||t.length===e))return t;e!==void 0&&mt(e,"length");let r=Ho(t),s=e!==void 0?` of length ${e}`:"",i=r?`length=${t.length}`:`type=${typeof t}`,o=ds(n)+"expected Uint8Array"+s+", got "+i;throw r?new RangeError(o):new TypeError(o)}var vu=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(e==="object"?"expected valid options object":`"${e}" expected object, got type=${typeof t}`)};function Fo(t,e=!0){if(t.destroyed)throw new Error("hash was destroyed");if(e&&t.finished)throw new Error("digest() was already called")}function Zu(t,e){ie(t,void 0,"output");let n=e.outputLen;if(!(t.length>=n))throw new RangeError('"output" expected length >= '+n)}function Ie(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Ze(...t){for(let e=0;e>>8&65280|t>>>24&255}function Rg(t){for(let e=0;et:Rg;function Cg(t,e){return!t.byteLength||!e.byteLength?!1:t.buffer===e.buffer&&t.byteOffset[]),i=(a,l)=>r(l,...s(a)).update(a).digest(),o=r(new Uint8Array(t),...s(new Uint8Array(0)));return i.outputLen=o.outputLen,i.blockLen=o.blockLen,i.create=(a,...l)=>r(a,...l),i}var Cu=(t,e)=>{function n(r,...s){if(ie(r,void 0,"key"),t.nonceLength!==void 0){let u=s[0];ie(u,t.varSizeNonce?void 0:t.nonceLength,"nonce")}let i=t.tagLength,o=t.nonceLength!==void 0?1:0;if(!t.withAAD){for(let u=o;u{if(h!==void 0){if(u!==2)throw new Error("cipher output not supported");ie(h,void 0,"output")}},c=!1;return{encrypt(u,h){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,ie(u,void 0,"data"),l(a.encrypt.length,h),a.encrypt(u,h)},decrypt(u,h){if(ie(u,void 0,"data"),i&&u.length= tagLength='+i);return l(a.decrypt.length,h),a.decrypt(u,h)}}}return Object.assign(n,t),n};function rr(t,e,n=!0){if(e===void 0)return new Uint8Array(t);if(ie(e,t,"output"),n&&!sr(e))throw new Error("invalid output, must be aligned");return e}function ju(t,e,n){mt(t),mt(e),ps(n);let r=new Uint8Array(16),s=Tg(r);return s.setBigUint64(0,BigInt(e),n),s.setBigUint64(8,BigInt(t),n),r}function sr(t){return t.byteOffset%4===0}function dn(t){return Uint8Array.from(ie(t))}function ms(t=32){mt(t,"bytesLength");let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}var Au=t=>Uint8Array.from(t.split(""),e=>e.charCodeAt(0)),jg=Xe(Ie(Au("expand 16-byte k"))),Lg=Xe(Ie(Au("expand 32-byte k")));function V(t,e){return t<>>32-e}var ir=64,Ag=16,Ko=2**32-1,Lu=Uint32Array.of();function _g(t,e,n,r,s,i,o,a){let l=s.length,c=new Uint8Array(ir),O=Ie(c),u=Re&&sr(s)&&sr(i),h=u?Ie(s):Lu,d=u?Ie(i):Lu;if(!Re){for(let p=0;p=Ko)throw new Error("arx: counter overflow");let f=Math.min(ir,l-p);for(let m=0,b;m=Ko)throw new Error("arx: counter overflow");let f=Math.min(ir,l-p);if(u&&f===ir){let m=p/4;if(p%4!==0)throw new Error("arx: invalid block position");for(let b=0,g;b{ie(a,void 0,"key"),ie(l,void 0,"nonce"),ie(c,void 0,"data");let h=c.length,d=O!==void 0;if(O=rr(h,O,!1),d&&Xu(c,O),mt(u),u<0||u>=Ko)throw new Error("arx: counter overflow");let p=[],f=a.length,m,b;if(f===32)p.push(m=dn(a)),b=Lg;else if(f===16&&n)m=new Uint8Array(32),m.set(a),m.set(a,16),b=jg,p.push(m);else throw ie(a,32,"arx key"),new Error("invalid key size");(!Re||!sr(l))&&p.push(l=dn(l));let g=Ie(m);if(r){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let k=l.subarray(0,16);if(Re)r(b,g,Ie(k),g);else{let w=Xe(Uint32Array.from(b));r(w,g,Ie(k),g),Ze(w),Xe(g)}l=l.subarray(16)}else Re||Xe(g);let Q=16-s;if(Q!==l.length)throw new Error(`arx: nonce must be ${Q} or 16 bytes`);if(Q!==12){let k=new Uint8Array(12);k.set(l,i?0:12-l.length),l=k,p.push(l)}let y=Xe(Ie(l));try{return _g(t,b,g,y,c,O,u,o),O}finally{Ze(...p)}}}function he(t,e){return t[e++]&255|(t[e++]&255)<<8}var Jo=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(e){e=dn(ie(e,32,"key"));let n=he(e,0),r=he(e,2),s=he(e,4),i=he(e,6),o=he(e,8),a=he(e,10),l=he(e,12),c=he(e,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|s<<6)&7939,this.r[3]=(s>>>7|i<<9)&8191,this.r[4]=(i>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|l<<5)&8065,this.r[8]=(l>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let O=0;O<8;O++)this.pad[O]=he(e,16+2*O)}process(e,n,r=!1){let s=r?0:2048,{h:i,r:o}=this,a=o[0],l=o[1],c=o[2],O=o[3],u=o[4],h=o[5],d=o[6],p=o[7],f=o[8],m=o[9],b=he(e,n+0),g=he(e,n+2),Q=he(e,n+4),y=he(e,n+6),k=he(e,n+8),w=he(e,n+10),P=he(e,n+12),E=he(e,n+14),T=i[0]+(b&8191),L=i[1]+((b>>>13|g<<3)&8191),A=i[2]+((g>>>10|Q<<6)&8191),_=i[3]+((Q>>>7|y<<9)&8191),Z=i[4]+((y>>>4|k<<12)&8191),M=i[5]+(k>>>1&8191),q=i[6]+((k>>>14|w<<2)&8191),z=i[7]+((w>>>11|P<<5)&8191),W=i[8]+((P>>>8|E<<8)&8191),N=i[9]+(E>>>5|s),v=0,B=v+T*a+L*(5*m)+A*(5*f)+_*(5*p)+Z*(5*d);v=B>>>13,B&=8191,B+=M*(5*h)+q*(5*u)+z*(5*O)+W*(5*c)+N*(5*l),v+=B>>>13,B&=8191;let H=v+T*l+L*a+A*(5*m)+_*(5*f)+Z*(5*p);v=H>>>13,H&=8191,H+=M*(5*d)+q*(5*h)+z*(5*u)+W*(5*O)+N*(5*c),v+=H>>>13,H&=8191;let J=v+T*c+L*l+A*a+_*(5*m)+Z*(5*f);v=J>>>13,J&=8191,J+=M*(5*p)+q*(5*d)+z*(5*h)+W*(5*u)+N*(5*O),v+=J>>>13,J&=8191;let Ge=v+T*O+L*c+A*l+_*a+Z*(5*m);v=Ge>>>13,Ge&=8191,Ge+=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let i=(s^1)-1;for(let a=0;a<10;a++)r[a]&=i;i=~i;for(let a=0;a<10;a++)e[a]=e[a]&i|r[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+n[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+n[a]|0)+(o>>>16)|0,e[a]=o&65535;Ze(r)}update(e){Fo(this),ie(e),e=dn(e);let{buffer:n,blockLen:r}=this,s=e.length;for(let i=0;i>>0,e[i++]=r[o]>>>8}digest(){let{buffer:e,outputLen:n}=this;this.digestInto(e);let r=e.slice(0,n);return this.destroy(),r}},Mu=Ru(32,t=>new Jo(t));function zu(t,e,n,r,s,i=20){let o=t[0],a=t[1],l=t[2],c=t[3],O=e[0],u=e[1],h=e[2],d=e[3],p=e[4],f=e[5],m=e[6],b=e[7],g=s,Q=n[0],y=n[1],k=n[2],w=o,P=a,E=l,T=c,L=O,A=u,_=h,Z=d,M=p,q=f,z=m,W=b,N=g,v=Q,B=y,H=k;for(let Ge=0;Ge{t.update(e);let n=e.length%16;n&&t.update(Yg.subarray(n))},zg=new Uint8Array(32);function Yu(t,e,n,r,s){s!==void 0&&ie(s,void 0,"AAD");let i=t(e,n,zg),o=ju(r.length,s?s.length:0,!0),a=Mu.create(i);s&&qu(a,s),qu(a,r),a.update(o);let l=a.digest();return Ze(i,o),l}var Ug=t=>(e,n,r)=>({encrypt(i,o){let a=i.length;o=rr(a+16,o,!1),o.set(i);let l=o.subarray(0,-16);t(e,n,l,l,1);let c=Yu(t,e,n,l,r);return o.set(c,a),Ze(c),o},decrypt(i,o){o=rr(i.length-16,o,!1);let a=i.subarray(0,-16),l=i.subarray(-16),c=Yu(t,e,n,a,r);if(!Eu(l,c))throw Ze(c),new Error("invalid tag");return o.set(i.subarray(0,-16)),t(e,n,o,o,1),Ze(c),o}});var ea=Cu({blockSize:64,nonceLength:24,tagLength:16,withAAD:!0},Ug(qg));function Uu(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}var ta=t=>t?`"${t}" `:"";function de(t,e=""){if(typeof t!="number")throw new TypeError(ta(e)+"expected number, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError(ta(e)+"expected integer >= 0, got "+t);return t}function pn(t,e,n=""){if(Uu(t)&&(e===void 0||t.length===e))return t;e!==void 0&&de(e,"length");let r=Uu(t),s=e!==void 0?` of length ${e}`:"",i=r?`length=${t.length}`:`type=${typeof t}`,o=ta(n)+"expected Uint8Array"+s+", got "+i;throw r?new RangeError(o):new TypeError(o)}function gs(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("expected hash wrapped by utils.createHasher");if(de(t.outputLen),de(t.blockLen),t.outputLen<1||t.blockLen<1)throw new Error("hash blockLen / outputLen must be >= 1")}var Wg=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError((e==="object"?"":`"${e}" `)+"expected object, got type="+typeof t)},Wu=(t,e)=>{Wg(t,e);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)throw new TypeError(`"${e}" expected plain object`);if(Object.hasOwn(t,"__proto__"))throw new TypeError(`"${e}.__proto__" is not allowed`)};function mn(t,e=!0){if(t.destroyed)throw new Error("hash was destroyed");if(e&&t.finished)throw new Error("digest() was already called")}function bs(t,e){pn(t,void 0,"output");let n=e.outputLen;if(!(t.length>=n))throw new RangeError('"output" expected length >= '+n)}function xs(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function ke(...t){for(let e=0;e>>e}function G(t,e){return t<>>32-e>>>0}var Ig=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Dg(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Vg(t){for(let e=0;et:Vg;function Gg(t){let e=globalThis;if(typeof e.scheduler?.yield=="function"){let n=e.scheduler.yield();return t&&n.catch(t),n}return new Promise(n=>e.setTimeout(n,0))}async function Qs(t,e,n,r){if(de(t,"iters"),de(e,"tick"),typeof n!="function")throw new TypeError("callback must be a function");let s=Date.now();for(let i=0;i=0&&o= 1');if(o<1)throw new Error('"dkLen" must be >= 1');if(o>(2**32-1)*t.outputLen)throw new Error("derived key too long");let l=ra(e,"password");try{let c=ra(n,"salt");try{let O=new Uint8Array(o),{iHash:u,oHash:h,outputLen:d}=Vu.create(t,l),p=new Uint8Array(d),f=Hg(u,h,c,p);return{c:i,dkLen:o,asyncTick:a,DK:O,outputLen:d,eng:f}}finally{typeof n=="string"&&ke(c)}}finally{typeof e=="string"&&ke(l)}}function Hg(t,e,n,r){let s=new Uint8Array(4),i=gn(s),o=t._cloneInto().update(n),a=e._cloneInto(),l=t._cloneInto,c=e._cloneInto;return{u1:(O,u)=>{i.setInt32(0,O,!1),o._cloneInto(a).update(s).digestInto(r),e._cloneInto(a).update(r).digestInto(r),u.set(r.subarray(0,u.length))},rounds:(O,u)=>{for(let h=1;h(t.destroy(),e.destroy(),o.destroy(),a.destroy(),ke(r),O)}}function sa(t,e,n,r){let{c:s,dkLen:i,DK:o,outputLen:a,eng:l}=Bg(t,e,n,r);for(let c=1,O=0;Ot/2**32|0,Kg=t=>t>>>0;function Gu(t,e,n,r){let s=Fg(n),i=Kg(n);t.setUint32(e,r?i:s,r),t.setUint32(e+4,r?s:i,r)}function Nu(t,e,n){return t&e^~t&n}function Bu(t,e,n){return t&e^t&n^e&n}var ks=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,n,r,s){this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(e),this.view=gn(this.buffer)}update(e){mn(this),pn(e);let{view:n,buffer:r,blockLen:s}=this,i=e.length,o=!1;for(let a=0;as-o&&(this.process(r,0),n.fill(0)),Gu(r,s-8,this.length*8,i),this.process(r,0),this.roundClean();let a=e===n?r:gn(e),l=this.outputLen,c=l/4,O=this.get();if(l%4||c>O.length)throw new Error("invalid outputLen");for(let u=0;u>>3,f=_e(d,17)^_e(d,19)^d>>>10;gt[u]=f+gt[u-7]+p+gt[u-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:l,G:c,H:O}=this;for(let u=0;u<64;u++){let h=_e(a,6)^_e(a,11)^_e(a,25),d=O+h+Nu(a,l,c)+Jg[u]+gt[u]|0,f=(_e(r,2)^_e(r,13)^_e(r,22))+Bu(r,s,i)|0;O=c,c=l,l=a,a=o+d|0,o=i,i=s,s=r,r=d+f|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,O=O+this.H|0,this.set(r,s,i,o,a,l,c,O)}roundClean(){ke(gt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),ke(this.buffer)}},oa=class extends ia{constructor(){super(32,Hu)}};var aa=Iu(()=>new oa,Du(1));function Fu(t,e,n,r,s,i){let o=t[e++]^n[r++],a=t[e++]^n[r++],l=t[e++]^n[r++],c=t[e++]^n[r++],O=t[e++]^n[r++],u=t[e++]^n[r++],h=t[e++]^n[r++],d=t[e++]^n[r++],p=t[e++]^n[r++],f=t[e++]^n[r++],m=t[e++]^n[r++],b=t[e++]^n[r++],g=t[e++]^n[r++],Q=t[e++]^n[r++],y=t[e++]^n[r++],k=t[e++]^n[r++],w=o,P=a,E=l,T=c,L=O,A=u,_=h,Z=d,M=p,q=f,z=m,W=b,N=g,v=Q,B=y,H=k;for(let J=0;J<8;J+=2)L^=G(w+N|0,7),M^=G(L+w|0,9),N^=G(M+L|0,13),w^=G(N+M|0,18),q^=G(A+P|0,7),v^=G(q+A|0,9),P^=G(v+q|0,13),A^=G(P+v|0,18),B^=G(z+_|0,7),E^=G(B+z|0,9),_^=G(E+B|0,13),z^=G(_+E|0,18),T^=G(H+W|0,7),Z^=G(T+H|0,9),W^=G(Z+T|0,13),H^=G(W+Z|0,18),P^=G(w+T|0,7),E^=G(P+w|0,9),T^=G(E+P|0,13),w^=G(T+E|0,18),_^=G(A+L|0,7),Z^=G(_+A|0,9),L^=G(Z+_|0,13),A^=G(L+Z|0,18),W^=G(z+q|0,7),M^=G(W+z|0,9),q^=G(M+W|0,13),z^=G(q+M|0,18),N^=G(H+B|0,7),v^=G(N+H|0,9),B^=G(v+N|0,13),H^=G(B+v|0,18);s[i++]=o+w|0,s[i++]=a+P|0,s[i++]=l+E|0,s[i++]=c+T|0,s[i++]=O+L|0,s[i++]=u+A|0,s[i++]=h+_|0,s[i++]=d+Z|0,s[i++]=p+M|0,s[i++]=f+q|0,s[i++]=m+z|0,s[i++]=b+W|0,s[i++]=g+N|0,s[i++]=Q+v|0,s[i++]=y+B|0,s[i++]=k+H|0}function la(t,e,n,r,s){let i=r+0,o=r+16*s;for(let a=0;a<16;a++)n[o+a]=t[e+(2*s-1)*16+a];for(let a=0;a0&&(o+=16),Fu(n,i,t,e+=16,n,o)}var eb=1024*(2**20+1+1);function tb(t,e,n){let r=or({dkLen:32,asyncTick:10,maxmem:eb},n),{N:s,r:i,p:o,dkLen:a,asyncTick:l,maxmem:c,onProgress:O}=r;if(de(s,"N"),de(i,"r"),de(o,"p"),de(a,"dkLen"),de(l,"asyncTick"),de(c,"maxmem"),O!==void 0&&typeof O!="function")throw new Error('"onProgress" must be a function');if(i<1)throw new Error('"r" expected integer >= 1');let u=128*i,h=u/4,d=Math.pow(2,32);if(s<=1||(s&s-1)!==0||s>d)throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');if(o<1||o>(d-1)*32/u)throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');if(a<1||a>(d-1)*32)throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32');let p=u*(s+o+1);if(p>c)throw new Error('"maxmem" limit was hit: memUsed(128*r*(N+p+1))='+p+", maxmem="+c);let f=sa(aa,t,e,{c:1,dkLen:u*o}),m=xs(f),b=xs(new Uint8Array(u*s)),g=xs(new Uint8Array(u)),Q=()=>{};if(O){let y=2*s*o,k=Math.max(Math.floor(y/1e4),1),w=0;Q=()=>{if(w++,O&&(!(w%k)||w===y))try{O(w/y)}catch(P){throw ke(f,b,g),P}}}return{N:s,r:i,p:o,dkLen:a,blockSize32:h,V:b,B32:m,B:f,tmp:g,blockMixCb:Q,asyncTick:l}}function nb(t,e,n,r,s){let i=sa(aa,t,n,{c:1,dkLen:e});return ke(n,r,s),i}async function Ku(t,e,n){let{N:r,r:s,p:i,dkLen:o,blockSize32:a,V:l,B32:c,B:O,tmp:u,blockMixCb:h,asyncTick:d}=tb(t,e,n),p=()=>ke(O,l,u);na(c);for(let f=0;f{la(l,b,l,b+=a,s),h()},p),la(l,(r-1)*a,c,m,s),h(),await Qs(r,d,()=>{let g=(c[m+a-16]&r-1)>>>0;for(let Q=0;Q=0&&(n=e.slice(s+1).trim(),e=e.slice(0,s));let i=e.indexOf("#");return i>=0&&(r=e.slice(i+1).trim(),e=e.slice(0,i)),{target:e.trim(),alias:n,heading:r}}function eh(t){return[...new Set([...t.matchAll(rb)].map(e=>e[1]))]}var th="ivy-encrypted",sb="This note is encrypted. Open it in ivyNote and enter its password.",ca="```",nh=/^\s*```ivy-encrypted[ \t]*\n([\s\S]*?)\n```[ \t]*\s*$/,rh={N:32768,r:8,p:1},ib=rh;var Yt=4,ob=10*6e4,bt=class extends Error{constructor(){super("wrong password"),this.name="WrongPasswordError"}},ar=class extends Error{constructor(e){super("broken encrypted note: "+e),this.name="BrokenEnvelopeError"}};function lr(t){return t?t.trimStart().startsWith(ca+th)&&nh.test(t):!1}function Ss(t){let e="";for(let n=0;n/^[A-Za-z0-9_-]{8,64}$/.test(o)),data:n.data}}function ih(t){return cr(t)?.hint??""}function ab(t,e,n,r){let s=[sb,"v: 1",`kdf: scrypt N=${t.N} r=${t.r} p=${t.p}`,`salt: ${e}`];return n&&s.push(`hint: ${Ss(vs.encode(n))}`),r.length&&s.push(`refs: ${r.join(" ")}`),s}function oh(t,e,n,r){return vs.encode(["ivy:note:v1",`scrypt N=${t.N} r=${t.r} p=${t.p}`,e,n,r.join(" ")].join("|"))}function lb(t){return Number.isInteger(t.N)&&t.N>=1024&&t.N<=1<<20&&(t.N&t.N-1)===0&&t.r>=1&&t.r<=16&&t.p>=1&&t.p<=4&&t.N*t.r*128<=256*1024*1024}async function ah(t,e,n=rh,r=""){if(!lb(n))throw new ar("kdf");return{bytes:await Ku(vs.encode(t.normalize("NFC")),ws(e),{...n,dkLen:32,maxmem:300*1024*1024}),salt:e,kdf:n,hint:r}}async function Oa(t,e=""){if(t.lengthDate.now();function Xs(t){bn.set(t.salt,{key:t,used:Ps()})}function cb(t){let e=cr(t);if(!e)return null;let n=bn.get(e.salt);return n?Ps()-n.used>ob?(bn.delete(e.salt),null):ch(e,n.key)?(n.used=Ps(),n.key):null:null}function uh(t){let e=bn.get(t.salt);e&&(e.used=Ps())}function ua(t){let e=cb(t);if(!e)return null;try{return{plain:Zs(t,e),key:e}}catch{return null}}function Or(t){t===void 0?bn.clear():bn.delete(typeof t=="string"?cr(t)?.salt??t:t.salt)}var Ob='';function F(t,e="",n=""){let r=document.createElement(t);return e&&(r.className=e),n&&(r.textContent=n),r}function hh(t,e,n,r={}){let s=F("div","ivy-lock");s.setAttribute("role","group"),s.setAttribute("aria-label",$("\u5DF2\u52A0\u5BC6\u7684\u7B14\u8BB0","Protected note"));let i=F("div","ivy-lock-icon");i.innerHTML=Ob;let o=F("div","ivy-lock-title",$("\u8FD9\u7BC7\u7B14\u8BB0\u5DF2\u7528\u5BC6\u7801\u4FDD\u62A4","This note is password protected")),a=F("div","ivy-lock-sub",$("\u8F93\u5165\u5BC6\u7801\u67E5\u770B\u548C\u7F16\u8F91\u3002\u5BC6\u7801\u53EA\u5728\u672C\u673A\u4F7F\u7528\uFF0C\u4E0D\u4F1A\u4E0A\u4F20\u3002","Enter its password to read and edit it. The password never leaves this device.")),l=ih(e()),c=F("div","ivy-lock-hint",l?$("\u5BC6\u7801\u63D0\u793A\uFF1A","Hint: ")+l:"");l||(c.hidden=!0);let O=F("form","ivy-lock-form"),u=F("input","ivy-lock-input");u.type="password",u.autocomplete="current-password",u.placeholder=$("\u5BC6\u7801","Password"),u.setAttribute("aria-label",$("\u5BC6\u7801","Password"));let h=F("button","ivy-lock-btn",$("\u89E3\u9501","Unlock"));h.type="submit";let d=F("div","ivy-lock-error");d.setAttribute("role","alert"),O.append(u,h),s.append(i,o,a,c,O,d),t.append(s);let p=!1;return O.addEventListener("submit",async f=>{if(f.preventDefault(),p)return;let m=u.value;if(!m){u.focus();return}p=!0,h.disabled=!0,h.textContent=$("\u6B63\u5728\u89E3\u9501\u2026","Unlocking\u2026"),d.textContent="";try{let{plain:b,key:g}=await Oh(e(),m);u.value="",n(b,g)}catch(b){d.textContent=b instanceof bt?$("\u5BC6\u7801\u4E0D\u6B63\u786E\uFF0C\u8BF7\u518D\u8BD5\u4E00\u6B21\u3002","Wrong password. Try again."):$("\u65E0\u6CD5\u6253\u5F00\u8FD9\u7BC7\u7B14\u8BB0\uFF1A\u5185\u5BB9\u5DF2\u635F\u574F\u3002","This note cannot be opened: its content is damaged."),u.select(),s.classList.remove("ivy-shake"),s.offsetWidth,s.classList.add("ivy-shake")}finally{p=!1,h.disabled=!1,h.textContent=$("\u89E3\u9501","Unlock")}}),r.autofocus!==!1&&setTimeout(()=>u.focus({preventScroll:!0}),30),()=>s.remove()}function ha(t,e,n,r=""){let s=F("label","ivy-dlg-field"),i=F("span","ivy-dlg-label",t),o=F("input","ivy-dlg-input");return o.type=e,o.autocomplete=n,r&&(o.placeholder=r),s.append(i,o),{input:o,row:s}}function fh(t){return new Promise(e=>{let n=F("div","ivy-dlg-back"),r=F("div","ivy-dlg");r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),n.append(r);let s=document.activeElement,i=!1,o=c=>{i||(i=!0,n.classList.add("ivy-dlg-out"),document.removeEventListener("keydown",a,!0),setTimeout(()=>n.remove(),160),s?.focus?.({preventScroll:!0}),e(c))},a=c=>{c.key==="Escape"&&(c.stopPropagation(),o(null))};n.addEventListener("mousedown",c=>{c.target===n&&o(null)}),document.addEventListener("keydown",a,!0);let l=t(r,o);document.body.append(n),setTimeout(()=>l?.focus({preventScroll:!0}),30)})}function dh(t,e,n=!1){let r=F("div","ivy-dlg-actions"),s=F("button","ivy-dlg-btn",$("\u53D6\u6D88","Cancel"));s.type="button",s.addEventListener("click",t);let i=F("button","ivy-dlg-btn ivy-dlg-primary"+(n?" ivy-dlg-danger":""),e);return i.type="submit",r.append(s,i),{row:r,ok:i}}function fa(t=!1){return fh((e,n)=>{let r=F("form","ivy-dlg-form"),s=F("h2","ivy-dlg-title",t?$("\u66F4\u6539\u5BC6\u7801","Change password"):$("\u4E3A\u7B14\u8BB0\u8BBE\u7F6E\u5BC6\u7801","Protect this note with a password")),i=F("ul","ivy-dlg-notes"),o=t?[$("\u65B0\u5BC6\u7801\u7ACB\u5373\u751F\u6548\uFF0C\u5176\u4ED6\u8BBE\u5907\u9700\u8981\u8F93\u5165\u65B0\u5BC6\u7801\u3002","The new password takes effect at once; other devices will ask for it.")]:[$("\u6B63\u6587\u5728\u672C\u673A\u52A0\u5BC6\u540E\u624D\u540C\u6B65\uFF0C\u670D\u52A1\u5668\u3001\u641C\u7D22\u3001\u5386\u53F2\u7248\u672C\u548C AI \u90FD\u770B\u4E0D\u5230\u5185\u5BB9\u3002","The text is encrypted on this device before it syncs: the server, search, history and AI cannot read it."),$("\u6807\u9898\u4E0D\u52A0\u5BC6\uFF0C\u4FBF\u4E8E\u5728\u5217\u8868\u4E2D\u627E\u5230\uFF1B\u9644\u4EF6\u4E0D\u968F\u6B63\u6587\u52A0\u5BC6\u3002","The title stays readable so you can find the note; attachments are not encrypted."),$("\u52A0\u5BC6\u524D\u7684\u5386\u53F2\u7248\u672C\u4F1A\u88AB\u5220\u9664\uFF0C\u516C\u5F00\u5206\u4EAB\u4F1A\u5173\u95ED\u3002","Earlier versions are deleted and public sharing is turned off.")];for(let f of o)i.append(F("li","",f));let a=ha($("\u5BC6\u7801","Password"),"password","new-password",$(`\u81F3\u5C11 ${Yt} \u4F4D`,`At least ${Yt} characters`)),l=ha($("\u518D\u8F93\u5165\u4E00\u6B21","Repeat password"),"password","new-password"),c=ha($("\u5BC6\u7801\u63D0\u793A\uFF08\u53EF\u9009\uFF0C\u4ED6\u4EBA\u4E5F\u80FD\u770B\u5230\uFF09","Hint (optional, visible to anyone)"),"text","off");c.input.maxLength=100;let O=F("label","ivy-dlg-ack"),u=F("input");u.type="checkbox",O.append(u,F("span","",$("\u6211\u660E\u767D\uFF1A\u5FD8\u8BB0\u5BC6\u7801\u540E\uFF0C\u4EFB\u4F55\u4EBA\uFF08\u5305\u62EC\u670D\u52A1\u5668\u7BA1\u7406\u5458\uFF09\u90FD\u65E0\u6CD5\u6062\u590D\u8FD9\u7BC7\u7B14\u8BB0\u3002","I understand: if I forget the password, nobody \u2014 not even the server admin \u2014 can recover this note.")));let h=F("div","ivy-dlg-error");h.setAttribute("role","alert");let{row:d,ok:p}=dh(()=>n(null),t?$("\u66F4\u6539\u5BC6\u7801","Change password"):$("\u52A0\u5BC6","Protect"));return r.append(s,i,a.row,l.row,c.row,O,h,d),r.addEventListener("submit",f=>{f.preventDefault(),h.textContent="",a.input.value.length{let n=F("form","ivy-dlg-form");n.append(F("h2","ivy-dlg-title",$("\u79FB\u9664\u5BC6\u7801\uFF1F","Remove the password?")),F("p","ivy-dlg-text",$("\u8FD9\u7BC7\u7B14\u8BB0\u5C06\u4EE5\u660E\u6587\u4FDD\u5B58\u548C\u540C\u6B65\uFF0C\u53EF\u4EE5\u88AB\u641C\u7D22\u3001\u51FA\u73B0\u5728\u65E5\u7A0B\u4E2D\uFF0C\u4E5F\u53EF\u4EE5\u5206\u4EAB\u3002","The note will be stored and synced readable again: searchable, on the agenda, and shareable.")));let{row:r,ok:s}=dh(()=>e(null),$("\u79FB\u9664\u5BC6\u7801","Remove password"),!0);return n.append(r),n.addEventListener("submit",i=>{i.preventDefault(),e(!0)}),t.append(n),s}).then(t=>t===!0)}var Ts=class{constructor(e){this.host=e}key=null;locked=!1;body="";unmount=null;get isProtected(){return!!this.key||this.locked}get isLocked(){return this.locked}report(){this.host.state({protected:this.isProtected,locked:this.locked})}showLock(){this.host.hide(),this.key=null,this.locked=!0,this.unmount?.(),this.unmount=hh(this.host.lockHost,()=>this.body,(e,n)=>{this.unmount?.(),this.unmount=null,this.locked=!1,this.key=n,this.host.show(e),this.report()},{autofocus:!1}),this.report()}clearLock(){this.unmount?.(),this.unmount=null,this.locked=!1}load(e){if(this.body=e,this.clearLock(),this.key=null,lr(e)){let n=ua(e);if(!n){this.showLock();return}this.key=n.key,this.host.show(n.plain)}else this.host.show(e);this.report()}edited(e){return this.key?(uh(this.key),this.body=lh(e,this.key),this.body):(this.body=e,e)}external(e){if(e===this.body)return!1;if(this.body=e,lr(e)){if(!this.key){let r=ua(e);return r?(this.key=r.key,this.locked?(this.clearLock(),this.host.show(r.plain)):this.host.replace(r.plain),this.report(),!0):(this.locked||this.showLock(),!0)}try{this.host.replace(Zs(e,this.key))}catch(r){r instanceof bt&&Or(this.key),this.showLock()}return!0}let n=this.isProtected;return this.locked?(this.clearLock(),this.key=null,this.host.show(e)):(this.key=null,this.host.replace(e)),n&&this.report(),!0}plain(){return this.key?this.host.text():null}async protect(){let e=this.host.text();if(e===null||this.isProtected||this.host.readonly())return!1;let n=await fa(!1);return n?(this.key=await Oa(n.password,n.hint),Xs(this.key),this.host.emit(this.edited(this.host.text()??e)),this.report(),!0):!1}async changePassword(){if(!this.key||this.host.readonly())return!1;let e=await fa(!0);if(!e||!this.key)return!1;let n=this.key;return this.key=await Oa(e.password,e.hint),Or(n),Xs(this.key),this.host.emit(this.edited(this.host.text()??"")),!0}async unprotect(){return!this.key||this.host.readonly()||!await ph()||!this.key?!1:(Or(this.key),this.key=null,this.host.emit(this.edited(this.host.text()??"")),this.report(),!0)}lock(){this.key&&(Or(this.key),this.showLock())}};function ga(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var It=ga();function Ph(t){It=t}var Ut={exec:()=>null};function zt(t){let e=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),s=e[r];return s||(s=t(r),e[r]=s),s}}function Y(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(ae.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var vh=((t="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,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,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:zt(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:zt(t=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:zt(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:zt(t=>new RegExp(`^ {0,${t}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:zt(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:zt(t=>new RegExp(`^ {0,${t}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|new RegExp(`^ {0,${t}}>`))},ub=/^(?:[ \t]*(?:\n|$))+/,hb=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fb=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,fr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,db=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ba=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Zh=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,Xh=Y(Zh).replace(/bull/g,ba).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),pb=Y(Zh).replace(/bull/g,ba).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xa=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,mb=/^[^\n]+/,Qa=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,gb=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Qa).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),bb=Y(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ba).getRegex(),dr="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",$a=/|$))/,xb=Y("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|[^\\n]*\\n*|$)||$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",$a).replace("tag",dr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Th=t=>Y(xa).replace("hr",fr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",$b).getRegex(),ka={blockquote:kb,code:hb,def:gb,fences:fb,heading:db,hr:fr,html:xb,lheading:Xh,list:bb,newline:ub,paragraph:Qb,table:Ut,text:mb},mh=Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",fr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|(?: *\\n{2,}|\\s*$)|\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",$a).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:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ut,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(xa).replace("hr",fr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",Xh).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},wb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Pb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Eh=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,vb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",vh?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ch=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Cb=Y(Ch,"u").replace(/punct/g,De).getRegex(),jb=Y(Ch,"u").replace(/punct/g,Rh).getRegex(),Lb=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Ab=Y(Lb,"u").replace(/openQuote/g,Xb).replace(/punct/g,De).getRegex(),jh="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_b=Y(jh,"gu").replace(/notPunctSpace/g,pr).replace(/punctSpace/g,$n).replace(/punct/g,De).getRegex(),Mb=Y(jh,"gu").replace(/notPunctSpace/g,Eb).replace(/punctSpace/g,Tb).replace(/punct/g,Rh).getRegex(),qb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Yb=Y(qb,"gu").replace(/notPunctSpace/g,pr).replace(/punctSpace/g,$n).replace(/punct/g,De).getRegex(),zb=Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,pr).replace(/punctSpace/g,$n).replace(/punct/g,De).getRegex(),Ub="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Wb=Y(Ub,"gu").replace(/notPunctSpace/g,pr).replace(/punctSpace/g,$n).replace(/punct/g,De).getRegex(),Ib=Y(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,De).getRegex(),Db="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Vb=Y(Db,"gu").replace(/notPunctSpace/g,pr).replace(/punctSpace/g,$n).replace(/punct/g,De).getRegex(),Gb=Y(/\\(punct)/,"gu").replace(/punct/g,De).getRegex(),Nb=Y(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,De).getRegex(),Bb=Y(/^<(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(),Hb=Y($a).replace("(?:-->|$)","-->").getRegex(),Fb=Y("^comment|^|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",Hb).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Lh=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Cs=Y(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Lh).getRegex(),Kb=Y(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",Cs).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),Jb=Y(/^!?\[(label)\]\[(ref)\]/).replace("label",Cs).replace("ref",Qa).getRegex(),e0=Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",Qa).getRegex(),gh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,t0=Y(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Lh).getRegex(),n0=Y("reflink|nolink(?!\\()","g").replace("reflink",Y(/^!?\[(label)\]\[(ref)\]/).replace("label",t0).replace("ref",gh).getRegex()).replace("nolink",Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",gh).getRegex()).getRegex(),bh=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,r0=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,s0=Y(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,r0).getRegex(),ya={_backpedal:Ut,anyPunctuation:Gb,anyPunctuationOutsideCode:Nb,autolink:Bb,blockSkip:Rb,br:Eh,code:Pb,del:Ut,delLDelim:Ut,delRDelim:Ut,emStrongLDelim:Cb,emStrongRDelimAst:_b,emStrongRDelimUnd:zb,escape:wb,link:Kb,nolink:e0,punctuation:Zb,reflink:Jb,reflinkSearch:n0,tag:Fb,text:vb,url:Ut},i0={...ya,emStrongLDelim:Ab,emStrongRDelimAst:Yb,emStrongRDelimUnd:Wb,link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",Cs).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Cs).getRegex()},da={...ya,emStrongRDelimAst:Mb,emStrongLDelim:jb,delLDelim:Ib,delRDelim:Vb,url:Y(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",s0).replace("protocol",bh).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Y(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},xh=t=>a0[t];function Te(t,e){if(e){if(ae.escapeTest.test(t))return t.replace(ae.escapeReplace,xh)}else if(ae.escapeTestNoEncode.test(t))return t.replace(ae.escapeReplaceNoEncode,xh);return t}function l0(t){return ae.numericCharacterReference.test(t)?t.replace(ae.numericCharacterReferenceOrAmpersand,(e,n,r)=>{if(n===void 0&&r===void 0)return"&";let s=n===void 0?Number.parseInt(r,16):Number.parseInt(n,10);return s===0||s>1114111||s>=55296&&s<=57343?"\uFFFD":s===38?"&":String.fromCodePoint(s)}):t}function Qh(t){try{t=encodeURI(t).replace(ae.percentDecode,"%")}catch{return null}return t}function $h(t,e){let n=t.replace(ae.findPipe,(i,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(ae.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length=0&&ae.blankLine.test(e[n]);)n--;return e.length-n<=2?t:e.slice(0,n+1).join(` +`)}function js(t){return t.trim().replace(ae.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function yh(t,e){if(t.indexOf(e[0])===-1&&t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r0?-2:-1}var Qn=new WeakMap;function Sa(t){let e={"*":-1,_:-1},n=-1,r=t.length;for(let s=0;s{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[a]=o;return i.slice(Math.min(a.length,s.length))}).join(` +`)}function wh(t,e,n,r){if(!e.includes("<"))return!1;for(let s=0;se.length-s)return!0;s+=o[0].length-1}}return!1}var xn=class{options;rules;lexer;constructor(t){this.options=t||It}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=this.options.pedantic?e[0]:kh(e[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=f0(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=it(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceTabChar.test(r))&&(n=r.trim())}return{type:"heading",raw:it(e[0],` +`),depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:it(e[0],` +`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=it(e[0],` `).split(` -`),n="",i="",s=[];for(;r.length>0;){let a=!1,o=[],l;for(l=0;ld+xr(m,d.length)).replace(this.rules.other.blockquoteSetextReplace,` - $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n} -${O}`:O,i=i?`${i} -${c}`:c;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,s,!0),this.lexer.state.top=h,r.length===0)break;let p=s.at(-1);if(p?.type==="code"||p?.type==="heading"||p?.type==="hr"||p?.type==="html"||p?.type==="table")break;if(p?.type==="blockquote"){let u=p,d=r.join(` -`),m=u.raw+` -`+d.replace(this.rules.other.blockquoteSetextReplace2,""),g=this.blockquote(m);s[s.length-1]=g;let b=m.substring(g.raw.length).replace(/^\n/,""),Q=b?b.split(` -`).length:0,k=Q?r.slice(0,-Q):r;if(k.length>0&&(n=`${n} -${k.join(` -`)}`),i=i.substring(0,i.length-u.text.length)+g.text,r=r.slice(k.length),r.length>0&&this.rules.other.blockquoteStart.test(r[0]))continue;break}else if(p?.type==="list"){let u=p,d=u.raw+` -`+r.join(` -`),m=this.list(d);s[s.length-1]=m;let g=m.raw.length>u.raw.length?d.slice(u.raw.length+1,m.raw.length).split(` -`).length:0;if(g>0){let b=r.slice(0,g).join(` -`);n=`${n} -${b}`,i=`${i} -${b}`}r=r.slice(g);continue}}return{type:"blockquote",raw:n,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=t,n=()=>r.length-t.length,i=e[1].trim(),s=i.length>1,a={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let o=this.rules.other.listItemRegex(i),l=!1;for(;t;){let c=!1,h="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;let p=n();t=t.substring(e[0].length);let u=e[2].split(` -`,1)[0],d=e[1].length,m=this.options.pedantic?xr(u,d):u.replace(this.rules.other.leadingSpaceTab,y=>xr(y,d)),g=t.split(` -`,1)[0],b=!m.trim(),Q=0;if(this.options.pedantic?(Q=2,h=m.trimStart()):b?Q=d+1:(Q=m.search(this.rules.other.nonSpaceChar),Q=Q>4?1:Q,h=m.slice(Q),Q+=d),b&&this.rules.other.blankLine.test(g)&&(t=t.substring(g.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(Q),w=this.rules.other.hrRegex(Q),_=this.rules.other.fencesBeginRegex(Q),G=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(Q):this.rules.other.headingBeginRegex(Q),Xe=this.rules.other.htmlBeginRegex(Q),At=this.rules.other.blockquoteBeginRegex(Q);for(;t;){let ct=t.split(` -`,1)[0],Ie;if(g=ct,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),Ie=g):Ie=g.replace(this.rules.other.leadingSpaceTab,jr=>xr(jr)),_.test(g)||G.test(g)||Xe.test(g)||At.test(g)||y.test(g)||w.test(g))break;if(Ie.search(this.rules.other.nonSpaceChar)>=Q||!g.trim())h+=` -`+Ie.slice(Q);else{if(b||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(m)||G.test(m)||Xe.test(m)||w.test(m))break;let jr=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(g)&&this.rules.block.lheading.test(`${m} -${g}`)?` ${Ie.replace(/^ {0,3}/,"")}`:g;h+=` -`+jr}b=!g.trim(),t=t.substring(ct.length+1),m=Ie.slice(Q)}}let k=r.slice(p,n());a.loose||(l?a.loose=!0:this.rules.other.doubleBlankLine.test(k)&&(l=!0)),a.items.push({type:"list_item",raw:k,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]})}let O=a.items.at(-1);if(O)O.raw=O.raw.trimEnd(),O.text=O.text.trimEnd();else return;a.raw=r.slice(0,n()).trimEnd();for(let c of a.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!a.loose){let h=c.tokens.filter(u=>u.type==="space"),p=h.length>0&&h.some(u=>this.rules.other.anyLine.test(u.raw));a.loose=p}for(let c of a.items){let h=c.tokens[0];if(c.task&&(h?.type==="text"||h?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let u={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=u.checked,a.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=u.raw+c.tokens[0].raw,c.tokens[0].text=u.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(u)):c.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):c.tokens.unshift(u)}}else c.task&&(c.task=!1)}if(a.loose)for(let c of a.items){c.loose=!0;for(let h of c.tokens)h.type==="text"&&(h.type="paragraph")}return a}}html(t){let e=this.rules.block.html.exec(t);if(e){let r=Sl(e[0]);return{type:"html",block:!0,raw:r,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:r}}}def(t){let e=this.rules.block.def.exec(t);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&kl(e[2],"()")!==-1)return;let r=yr(e[1]),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:me(e[0],` -`),href:n,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=bl(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(` -`):[],s={type:"table",raw:me(e[0],` -`),header:[],align:[],rows:[]};if(r.length===n.length){for(let a of n)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a({text:o,tokens:this.lexer.inline(o),header:!1,align:s.align[l]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let r=e[1].trim();return{type:"heading",raw:me(e[0],` -`),depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===` -`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(t);if(e){let r=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&xl(t,e[1],r,this.rules))return;let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=me(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=kl(e[2],"()");if(o===-2)return;if(o>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let i=me(e[0].slice(0,-1),"\\");if((e[0].length-i.length)%2===0)return;let s=e[2],a="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],a=o[3])}else a=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Pl(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let n=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&xl(t,r[1],n,this.rules))return;let i=e[yr(r[2]||r[1])];if(!i){let s=r[0].charAt(0);return{type:"text",raw:s,text:s}}return Pl(r,i,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||!n[1]&&!n[2]&&!n[3]&&!n[4])return;let i=n[0][0],s=r===i,a=e.length-t.length,o=a;for(;!this.options.pedantic&&o>0&&e[o-1]===i;)o--;let l=[...e.slice(Math.max(0,o-2),o)].at(-1)??"",O=l==="*"||l==="_"||!!this.rules.inline.punctuation.exec(l);o_);){if(u=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!u)continue;if(d=[...u].length,n[3]||n[4]){m+=d;continue}else if(n[5]||n[6]||Q){if(s&&(n[5]||n[6]))break;if(b%3&&!((b+d)%3)){g+=d;continue}}if(m-=d,m>0)continue;d=Math.min(d,d+m+g);let G=[...n[0]][0].length,Xe=t.slice(0,p+n.index+G+d);if(Math.min(p,d)%2){let ct=Xe.slice(1,-1);return{type:"em",raw:Xe,text:ct,tokens:this.lexer.inlineTokens(ct)}}let At=Xe.slice(2,-2);return{type:"strong",raw:Xe,text:At,tokens:this.lexer.inlineTokens(At)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),i=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&i&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!r||this.rules.inline.punctuation.exec(r))){let i=[...n[0]].length-1,s,a,o=i,l=this.rules.inline.delRDelim,O=tf(this,e),c=e.length-t.length+i;if(Oh);){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(a=[...s].length,a!==i))continue;if(n[3]||n[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let p=[...n[0]][0].length,u=t.slice(0,i+n.index+p+a),d=u.slice(i,-i);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,n;if(e[2]==="@")r=e[0],n="mailto:"+r;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);r=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:r,href:n,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:r?e[0]:Hp(e[0]),escaped:r}}}},re=class Ti{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ve,this.options.tokenizer=this.options.tokenizer||new ot,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let r={other:C,block:Pr.normal,inline:_t.normal};this.options.pedantic?(r.block=Pr.pedantic,r.inline=_t.pedantic):this.options.gfm&&(r.block=Pr.gfm,this.options.breaks?r.inline=_t.breaks:r.inline=_t.gfm),this.tokenizer.rules=r}static get rules(){return{block:Pr,inline:_t}}static lex(e,r){return new Ti(r).lex(e)}static lexInline(e,r){return new Ti(r).inlineTokens(e)}lex(e){e=e.replace(C.carriageReturn,` -`),this.blockTokens(e,this.tokens);for(let r=0;r(s=o.call({lexer:this},e,r))?(e=e.substring(s.raw.length),r.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=r.at(-1);s.raw.length===1&&o!==void 0?o.raw+=` -`:r.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=r.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`),r="",s="",i=[];for(;n.length>0;){let o=!1,a=[],l;for(l=0;lp+Rs(f,p.length)).replace(this.rules.other.blockquoteSetextReplace,` + $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r} +${c}`:c,s=s?`${s} +${O}`:O;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(O,i,!0),this.lexer.state.top=u,n.length===0)break;let h=i.at(-1);if(h?.type==="code"||h?.type==="heading"||h?.type==="hr"||h?.type==="html"||h?.type==="table")break;if(h?.type==="blockquote"){let d=h,p=n.join(` +`),f=d.raw+` +`+p.replace(this.rules.other.blockquoteSetextReplace2,""),m=this.blockquote(f);i[i.length-1]=m;let b=f.substring(m.raw.length).replace(/^\n/,""),g=b?b.split(` +`).length:0,Q=g?n.slice(0,-g):n;if(Q.length>0&&(r=`${r} +${Q.join(` +`)}`),s=s.substring(0,s.length-d.text.length)+m.text,n=n.slice(Q.length),n.length>0&&this.rules.other.blockquoteStart.test(n[0]))continue;break}else if(h?.type==="list"){let d=h,p=d.raw+` +`+n.join(` +`),f=this.list(p);i[i.length-1]=f;let m=f.raw.length>d.raw.length?p.slice(d.raw.length+1,f.raw.length).split(` +`).length:0;if(m>0){let b=n.slice(0,m).join(` +`);r=`${r} +${b}`,s=`${s} +${b}`}n=n.slice(m);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=t,r=()=>n.length-t.length,s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;t;){let O=!1,u="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;let h=r();t=t.substring(e[0].length);let d=e[2].split(` +`,1)[0],p=e[1].length,f=this.options.pedantic?Rs(d,p):d.replace(this.rules.other.leadingSpaceTab,y=>Rs(y,p)),m=t.split(` +`,1)[0],b=!f.trim(),g=0;if(this.options.pedantic?(g=2,u=f.trimStart()):b?g=p+1:(g=f.search(this.rules.other.nonSpaceChar),g=g>4?1:g,u=f.slice(g),g+=p),b&&this.rules.other.blankLine.test(m)&&(t=t.substring(m.length+1),O=!0),!O){let y=this.rules.other.nextBulletRegex(g),k=this.rules.other.hrRegex(g),w=this.rules.other.fencesBeginRegex(g),P=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(g):this.rules.other.headingBeginRegex(g),E=this.rules.other.htmlBeginRegex(g),T=this.rules.other.blockquoteBeginRegex(g);for(;t;){let L=t.split(` +`,1)[0],A;if(m=L,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),A=m):A=m.replace(this.rules.other.leadingSpaceTab,_=>Rs(_)),w.test(m)||P.test(m)||E.test(m)||T.test(m)||y.test(m)||k.test(m))break;if(A.search(this.rules.other.nonSpaceChar)>=g||!m.trim())u+=` +`+A.slice(g);else{if(b||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(f)||P.test(f)||E.test(f)||k.test(f))break;let _=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(m)&&this.rules.block.lheading.test(`${f} +${m}`)?` ${A.replace(/^ {0,3}/,"")}`:m;u+=` +`+_}b=!m.trim(),t=t.substring(L.length+1),f=A.slice(g)}}let Q=n.slice(h,r());o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(Q)&&(l=!0)),o.items.push({type:"list_item",raw:Q,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]})}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let O of o.items)if(this.lexer.state.top=!1,O.tokens=this.lexer.blockTokens(O.text,[]),!o.loose){let u=O.tokens.filter(d=>d.type==="space"),h=u.length>0&&u.some(d=>this.rules.other.anyLine.test(d.raw));o.loose=h}for(let O of o.items){let u=O.tokens[0];if(O.task&&(u?.type==="text"||u?.type==="paragraph")){O.text=O.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(O.raw);if(h){let d={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};O.checked=d.checked,o.loose?O.tokens[0]&&["paragraph","text"].includes(O.tokens[0].type)&&"tokens"in O.tokens[0]&&O.tokens[0].tokens?(O.tokens[0].raw=d.raw+O.tokens[0].raw,O.tokens[0].text=d.raw+O.tokens[0].text,O.tokens[0].tokens.unshift(d)):O.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):O.tokens.unshift(d)}}else O.task&&(O.task=!1)}if(o.loose)for(let O of o.items){O.loose=!0;for(let u of O.tokens)u.type==="text"&&(u.type="paragraph")}return o}}html(t){let e=this.rules.block.html.exec(t);if(e){let n=kh(e[0]);return{type:"html",block:!0,raw:n,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:n}}}def(t){let e=this.rules.block.def.exec(t);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&yh(e[2],"()")!==-1)return;let n=js(e[1]),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:it(e[0],` +`),href:r,title:s}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=$h(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(` +`):[],i={type:"table",raw:it(e[0],` +`),header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[l]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:it(e[0],` +`),depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===` +`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(t);if(e){let n=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&wh(t,e[1],n,this.rules))return;let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let a=it(r.slice(0,-1),"\\");if((r.length-a.length)%2===0)return}else{let a=yh(e[2],"()");if(a===-2)return;if(a>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let s=it(e[0].slice(0,-1),"\\");if((e[0].length-s.length)%2===0)return;let i=e[2],o="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(i);a&&(i=a[1],o=a[3])}else o=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i=i.slice(1):i=i.slice(1,-1)),Sh(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=n[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&wh(t,n[1],r,this.rules))return;let s=e[js(n[2]||n[1])];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Sh(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let s=r[0][0],i=n===s,o=e.length-t.length,a=o;for(;!this.options.pedantic&&a>0&&e[a-1]===s;)a--;let l=[...e.slice(Math.max(0,a-2),a)].at(-1)??"",c=l==="*"||l==="_"||!!this.rules.inline.punctuation.exec(l);aw);){if(d=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!d)continue;if(p=[...d].length,r[3]||r[4]){f+=p;continue}else if(r[5]||r[6]||g){if(i&&(r[5]||r[6]))break;if(b%3&&!((b+p)%3)){m+=p;continue}}if(f-=p,f>0)continue;p=Math.min(p,p+f+m);let P=[...r[0]][0].length,E=t.slice(0,h+r.index+P+p);if(Math.min(h,p)%2){let L=E.slice(1,-1);return{type:"em",raw:E,text:L,tokens:this.lexer.inlineTokens(L)}}let T=E.slice(2,-2);return{type:"strong",raw:E,text:T,tokens:this.lexer.inlineTokens(T)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=this.rules.inline.delRDelim,c=h0(this,e),O=e.length-t.length+s;if(cu);){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(o=[...i].length,o!==s))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let h=[...r[0]][0].length,d=t.slice(0,s+r.index+h+o),p=d.slice(s,-s);return{type:"del",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,autolink:!0,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:n?e[0]:l0(e[0]),escaped:n}}}},Me=class pa{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||It,this.options.tokenizer=this.options.tokenizer||new xn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let n={other:ae,block:Es.normal,inline:ur.normal};this.options.pedantic?(n.block=Es.pedantic,n.inline=ur.pedantic):this.options.gfm&&(n.block=Es.gfm,this.options.breaks?n.inline=ur.breaks:n.inline=ur.gfm),this.tokenizer.rules=n}static get rules(){return{block:Es,inline:ur}}static lex(e,n){return new pa(n).lex(e)}static lexInline(e,n){return new pa(n).inlineTokens(e)}lex(e){e=e.replace(ae.carriageReturn,` +`),this.blockTokens(e,this.tokens);for(let n=0;n(i=a.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let a=n.at(-1);i.raw.length===1&&a!==void 0?a.raw+=` +`:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(` `)?"":` -`)+s.raw,o.text+=` -`+s.text,this.inlineQueue.at(-1).src=o.text):r.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let o=r.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`)+i.raw,a.text+=` +`+i.text,this.inlineQueue.at(-1).src=a.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let a=n.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(` `)?"":` -`)+s.raw,o.text+=` -`+s.raw,this.inlineQueue.at(-1).src=o.text):(this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title}),r.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),r.push(s);continue}let a=e;if(this.options.extensions?.startBlock){let o=1/0,l=e.slice(1),O;this.options.extensions.startBlock.forEach(c=>{O=c.call({lexer:this},l),typeof O=="number"&&O>=0&&(o=Math.min(o,O))}),o<1/0&&o>=0&&(a=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(a))){let o=r.at(-1);n&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(` +`)+i.raw,a.text+=` +`+i.raw,this.inlineQueue.at(-1).src=a.text):(this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}),n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,l=e.slice(1),c;this.options.extensions.startBlock.forEach(O=>{c=O.call({lexer:this},l),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o))){let a=n.at(-1);r&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(` `)?"":` -`)+s.raw,o.text+=` -`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(s),n=a.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=r.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`)+i.raw,a.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):n.push(i),r=o.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let a=n.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(` `)?"":` -`)+s.raw,o.text+=` -`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(s);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}linkInText(e){if(!e.includes("["))return!1;let r=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=n[0],s=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,yr(i.slice(s+1,-1))))&&!(s>1&&this.linkInText(i.slice(1,s-1))))return!0}return!1}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(")");try{return this.#e(e,r)}finally{this.state.linkParenPossible=n}}#e(e,r){let n=e.includes("*")||e.includes("_")||e.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==ot.prototype.emStrong||this.tokenizer.del!==ot.prototype.del?this.#r(e):e;Kp(this.tokenizer,n);try{return this.#t(e,n,r)}finally{Jp(this.tokenizer)}}#t(e,r,n){let i=!1,s="",a=1/0;for(;e;){if(e.length(o=O.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let O=n.at(-1);o.type==="text"&&O?.type==="text"?(O.raw+=o.raw,O.text+=o.text):n.push(o);continue}if(o=this.tokenizer.emStrong(e,r,s)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.del(e,r,s)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),n.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),n.push(o);continue}let l=e;if(this.options.extensions?.startInline){let O=1/0,c=e.slice(1),h;this.options.extensions.startInline.forEach(p=>{h=p.call({lexer:this},c),typeof h=="number"&&h>=0&&(O=Math.min(O,h))}),O<1/0&&O>=0&&(l=e.substring(0,O+1))}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),i=!0;let O=n.at(-1);O?.type==="text"?(O.raw+=o.raw,O.text+=o.text):n.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#r(e){let r=e;if(this.tokens.links&&e.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,i=s=>{let a=s.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,yr(s.slice(a+1,-1))))return s;if(a>1&&s.charAt(0)!=="!"){let o=s.slice(1,a-1);if(this.linkInText(o))return"["+o.replace(n,i)+"]["+"a".repeat(s.length-a-2)+"]"}return"["+"a".repeat(s.length-2)+"]"};r=r.replace(n,i)}return r=r.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,i,s)=>s?"+".repeat(n.length):i?i+n.slice(i.length,-i.length).replace(/`/g,"+")+i:n),r=r.replace(this.tokenizer.rules.inline.blockSkip,(n,i,s)=>{let a=s?s.length:0;return n.slice(0,a)+"["+"a".repeat(n.length-a-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r,r}infiniteLoopError(e){let r="Infinite loop on byte: "+e;if(this.options.silent)console.error(r);else throw new Error(r)}},Zr=class{options;parser;constructor(t){this.options=t||Ve}space(t){return""}code({text:t,lang:e,escaped:r}){let n=(e||"").match(C.notSpaceStart)?.[0],i=t?t.replace(C.endingNewline,"")+` -`:"";return n?'