sonorance 0.1.0-beta.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +174 -0
- package/README.md +103 -0
- package/build/icon.png +0 -0
- package/package.json +86 -0
- package/skill/SKILL.md +41 -0
- package/skill/scripts/sonorance.mjs +31 -0
- package/src/azure-monitor.mjs +221 -0
- package/src/cli.mjs +315 -0
- package/src/comment-client.mjs +75 -0
- package/src/engine-default.mjs +136 -0
- package/src/feedback.mjs +151 -0
- package/src/gitignore.mjs +27 -0
- package/src/grammar.mjs +55 -0
- package/src/identity.mjs +126 -0
- package/src/otlp.mjs +166 -0
- package/src/plugins/deliberate/contribute.mjs +28 -0
- package/src/plugins/deliberate/domain.mjs +40 -0
- package/src/plugins/deliberate/frontmatter.mjs +85 -0
- package/src/plugins/deliberate/gitignore.mjs +21 -0
- package/src/plugins/deliberate/kinds.mjs +44 -0
- package/src/plugins/deliberate/markdown.mjs +42 -0
- package/src/plugins/deliberate/paths.mjs +245 -0
- package/src/plugins/deliberate/stages.mjs +27 -0
- package/src/plugins/deliberate/vault.mjs +1043 -0
- package/src/plugins.mjs +91 -0
- package/src/release-config.mjs +2 -0
- package/src/scrubber.mjs +64 -0
- package/src/server/index.mjs +993 -0
- package/src/sources.mjs +80 -0
- package/src/telemetry-schema.mjs +187 -0
- package/src/telemetry.mjs +390 -0
- package/src/ui/active-line.mjs +42 -0
- package/src/ui/app.js +3553 -0
- package/src/ui/at-mention.mjs +67 -0
- package/src/ui/comments-plugin.mjs +107 -0
- package/src/ui/diff-plugin.mjs +73 -0
- package/src/ui/editor.mjs +210 -0
- package/src/ui/index.html +1723 -0
- package/src/ui/md.mjs +233 -0
- package/src/ui/paste-md.mjs +54 -0
- package/src/ui/shell.html +1374 -0
- package/src/ui/slash.mjs +122 -0
- package/src/vault-registry.mjs +150 -0
|
@@ -0,0 +1,1723 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
6
|
+
<meta name="theme-color" content="#0a0e14">
|
|
7
|
+
<meta name="color-scheme" content="light dark">
|
|
8
|
+
<title>Sonorance</title>
|
|
9
|
+
<link rel="manifest" href="/manifest.webmanifest">
|
|
10
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23f0995a'/%3E%3Cstop offset='1' stop-color='%23c85a12'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='3' y='3' width='26' height='26' rx='8' fill='url(%23g)'/%3E%3Crect x='10.5' y='10.5' width='11' height='11' rx='3.5' fill='none' stroke='white' stroke-opacity='.94' stroke-width='2'/%3E%3C/svg%3E">
|
|
11
|
+
<style>
|
|
12
|
+
/* ============================================================================
|
|
13
|
+
Deliberate — design tokens (see DESIGN.md). Light in :root; dark is the
|
|
14
|
+
signature theme, applied on OS preference (unless overridden) and via
|
|
15
|
+
[data-theme="dark"]. "Ember at dusk": one burnt-orange accent, warm graphite
|
|
16
|
+
neutrals, Apple-grade frosted glass over a soft ember ambient.
|
|
17
|
+
========================================================================== */
|
|
18
|
+
:root{
|
|
19
|
+
/* Harbor — layered, analogous green→teal→blue→violet atmosphere. Three
|
|
20
|
+
partially-transparent gradient planes (bg1 far … bg3 near) each drift + parallax
|
|
21
|
+
at their own speed for a 3D depth effect; brightest + most saturated toward centre. */
|
|
22
|
+
--bgbase:#f1f6f6; --bg:#f1f6f6;
|
|
23
|
+
--bg1:
|
|
24
|
+
radial-gradient(1980px 1700px at 86% -18%, rgba(150,202,184,.13), transparent 78%),
|
|
25
|
+
radial-gradient(2060px 1780px at -16% 118%, rgba(160,168,224,.13), transparent 78%),
|
|
26
|
+
radial-gradient(1820px 1640px at 118% 114%, rgba(150,192,224,.12), transparent 76%),
|
|
27
|
+
radial-gradient(1720px 1560px at -12% -14%, rgba(158,210,214,.11), transparent 78%);
|
|
28
|
+
--bg2:
|
|
29
|
+
radial-gradient(1480px 1240px at 50% 36%, rgba(226,244,240,.34), transparent 72%),
|
|
30
|
+
radial-gradient(1180px 1040px at 66% 26%, rgba(168,220,220,.19), transparent 70%),
|
|
31
|
+
radial-gradient(1140px 1100px at 32% 60%, rgba(186,196,240,.18), transparent 70%),
|
|
32
|
+
radial-gradient(1080px 1000px at 78% 66%, rgba(172,206,236,.16), transparent 70%);
|
|
33
|
+
--bg3:
|
|
34
|
+
radial-gradient(1000px 880px at 46% 42%, rgba(242,250,249,.42), transparent 66%),
|
|
35
|
+
radial-gradient(820px 900px at 68% 54%, rgba(168,214,236,.19), transparent 68%),
|
|
36
|
+
radial-gradient(860px 800px at 30% 34%, rgba(198,192,240,.17), transparent 70%),
|
|
37
|
+
radial-gradient(760px 820px at 58% 24%, rgba(178,222,214,.15), transparent 70%);
|
|
38
|
+
--grain:.3; --grain-blend:soft-light;
|
|
39
|
+
--canvas:rgba(255,255,255,.6); --panel:rgba(255,255,255,.46); --tab-idle:rgba(20,38,56,.045);
|
|
40
|
+
--chrome:rgba(255,255,255,.64); --surface:rgba(246,250,253,.72); --raised:#f7fafc;
|
|
41
|
+
--glass:rgba(255,255,255,.58); --blur:saturate(150%) blur(20px);
|
|
42
|
+
--hairline:rgba(22,42,64,.12); --ink:#141b24; --ink-muted:#4a5563; --ink-faint:#5b6472;
|
|
43
|
+
--accent:#b05500; --accent-strong:#8f4400; --accent-hover:#b05500; --on-accent:#ffffff;
|
|
44
|
+
--btn-bg:#b05500; --btn-bg-hover:#8f4400;
|
|
45
|
+
--ok:#0a7d54; --warn:#8a6410; --bad:#96201f;
|
|
46
|
+
--accent-tint:rgba(176,85,0,.11); --ok-tint:rgba(10,125,84,.13);
|
|
47
|
+
--warn-tint:rgba(138,100,16,.14); --bad-tint:rgba(150,32,31,.15);
|
|
48
|
+
--hover:rgba(20,38,56,.055); --glass-brd:rgba(22,42,64,.16); --glass-top:rgba(255,255,255,.9);
|
|
49
|
+
--lit:radial-gradient(120% 110% at 18% -25%, rgba(255,255,255,.8), transparent 56%); --rimA:.95; --rimB:.5;
|
|
50
|
+
--sheen:linear-gradient(180deg,rgba(255,255,255,.5),rgba(255,255,255,0) 46%);
|
|
51
|
+
--shadow:0 30px 70px -30px rgba(24,40,60,.44), 0 3px 12px rgba(24,40,60,.15), inset 0 1px 0 rgba(255,255,255,.9), inset 0 0 0 1px var(--glass-brd);
|
|
52
|
+
--shadow-sm:0 12px 30px -18px rgba(24,40,60,.3), inset 0 1px 0 rgba(255,255,255,.85), inset 0 0 0 1px var(--glass-brd);
|
|
53
|
+
--shadow-md:0 18px 44px -22px rgba(24,40,60,.34), inset 0 1px 0 rgba(255,255,255,.85), inset 0 0 0 1px var(--glass-brd);
|
|
54
|
+
--shadow-lg:0 44px 96px -34px rgba(24,40,60,.48), inset 0 1px 0 rgba(255,255,255,.9), inset 0 0 0 1px var(--glass-brd);
|
|
55
|
+
--edge-shadow:rgba(19,45,89,.2);
|
|
56
|
+
--glow:0 0 0 1px rgba(176,85,0,.2), 0 14px 40px -16px rgba(176,85,0,.3);
|
|
57
|
+
--ring:rgba(176,85,0,.55); --sb-thumb:rgba(22,42,64,.22); --sb-thumb-h:rgba(22,42,64,.34); --guide-line:rgba(22,42,64,.16);
|
|
58
|
+
--center-glow:none; --grain-legacy:.022;
|
|
59
|
+
--ambient:none;
|
|
60
|
+
--paper-tex:none; --paper-blend:normal;
|
|
61
|
+
/* geometry */
|
|
62
|
+
--r-xs:6px; --r-sm:8px; --r-md:10px; --r-lg:14px; --r-xl:20px; --pill:999px;
|
|
63
|
+
--s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; --s7:48px;
|
|
64
|
+
--sb:288px; --toc:250px; --sb-min:220px; --sb-max:560px;
|
|
65
|
+
--doc-w:127.2ch; --tbl-mincol:7.5rem;
|
|
66
|
+
--sans:ui-sans-serif,-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,sans-serif;
|
|
67
|
+
--serif:"Iowan Old Style","Palatino Linotype","Book Antiqua",Palatino,Georgia,ui-serif,serif;
|
|
68
|
+
--mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,"JetBrains Mono",monospace;
|
|
69
|
+
--z-sticky:100; --z-dropdown:200; --z-scrim:300; --z-modal:400; --z-toast:500;
|
|
70
|
+
--dur:180ms; --ease:cubic-bezier(.22,1,.36,1);
|
|
71
|
+
}
|
|
72
|
+
@media (prefers-color-scheme:dark){ :root:not([data-theme="light"]){
|
|
73
|
+
--bgbase:#0a0e14; --bg:#0a0e14;
|
|
74
|
+
--bg1:
|
|
75
|
+
radial-gradient(1240px 1060px at 84% -6%, rgba(40,152,150,.32), transparent 58%),
|
|
76
|
+
radial-gradient(1320px 1140px at -4% 108%, rgba(98,98,204,.28), transparent 58%),
|
|
77
|
+
radial-gradient(1060px 960px at 108% 104%, rgba(60,142,192,.24), transparent 56%);
|
|
78
|
+
--bg2:
|
|
79
|
+
radial-gradient(1120px 920px at 50% 36%, rgba(92,202,182,.24), transparent 60%),
|
|
80
|
+
radial-gradient(840px 740px at 61% 28%, rgba(70,172,192,.21), transparent 60%),
|
|
81
|
+
radial-gradient(780px 740px at 39% 56%, rgba(112,122,212,.19), transparent 60%);
|
|
82
|
+
--bg3:
|
|
83
|
+
radial-gradient(560px 490px at 46% 42%, rgba(152,238,212,.17), transparent 58%),
|
|
84
|
+
radial-gradient(460px 540px at 66% 52%, rgba(92,182,222,.16), transparent 60%),
|
|
85
|
+
radial-gradient(500px 460px at 31% 36%, rgba(152,142,226,.14), transparent 60%);
|
|
86
|
+
--grain:.3; --grain-blend:soft-light;
|
|
87
|
+
--canvas:rgba(20,26,34,.5); --panel:rgba(15,20,28,.34); --tab-idle:rgba(0,0,0,.16);
|
|
88
|
+
--chrome:rgba(12,16,22,.5); --surface:rgba(28,34,44,.55); --raised:#171d26;
|
|
89
|
+
--glass:rgba(20,26,34,.44); --blur:saturate(160%) blur(22px);
|
|
90
|
+
--hairline:rgba(210,224,244,.09); --ink:#e9eef6; --ink-muted:#a4adba; --ink-faint:#8a93a0;
|
|
91
|
+
--accent:#f1944f; --accent-strong:#de742e; --accent-hover:#f6a566; --on-accent:#221812;
|
|
92
|
+
--btn-bg:#de742e; --btn-bg-hover:#cf6a26;
|
|
93
|
+
--ok:#65c89b; --warn:#e6c45a; --bad:#f28c8c;
|
|
94
|
+
--accent-tint:rgba(241,148,79,.15); --ok-tint:rgba(101,200,155,.14);
|
|
95
|
+
--warn-tint:rgba(230,196,90,.14); --bad-tint:rgba(234,106,106,.18);
|
|
96
|
+
--hover:rgba(210,224,244,.06); --glass-brd:rgba(210,224,244,.1); --glass-top:rgba(210,224,244,.1);
|
|
97
|
+
--lit:radial-gradient(120% 110% at 18% -25%, rgba(255,255,255,.14), transparent 58%); --rimA:.58; --rimB:.14;
|
|
98
|
+
--sheen:linear-gradient(180deg,rgba(224,226,245,.06),rgba(224,226,245,0) 46%);
|
|
99
|
+
--shadow:0 30px 70px -26px rgba(0,0,0,.72), 0 3px 12px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.1), inset 0 0 0 1px var(--glass-brd);
|
|
100
|
+
--shadow-sm:0 12px 30px -16px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08), inset 0 0 0 1px var(--glass-brd);
|
|
101
|
+
--shadow-md:0 18px 44px -20px rgba(0,0,0,.64), inset 0 1px 0 rgba(255,255,255,.08), inset 0 0 0 1px var(--glass-brd);
|
|
102
|
+
--shadow-lg:0 44px 96px -30px rgba(0,0,0,.76), inset 0 1px 0 rgba(255,255,255,.1), inset 0 0 0 1px var(--glass-brd);
|
|
103
|
+
--edge-shadow:rgba(0,0,0,.62);
|
|
104
|
+
--glow:0 0 0 1px rgba(241,148,79,.18), 0 14px 40px -14px rgba(241,148,79,.38);
|
|
105
|
+
--ring:rgba(241,148,79,.62); --sb-thumb:rgba(210,224,244,.16); --sb-thumb-h:rgba(210,224,244,.28); --guide-line:rgba(210,224,244,.14);
|
|
106
|
+
--center-glow:none; --ambient:none;
|
|
107
|
+
--paper-tex:none; --paper-blend:normal;
|
|
108
|
+
}}
|
|
109
|
+
:root[data-theme="dark"]{
|
|
110
|
+
--bgbase:#0a0e14; --bg:#0a0e14;
|
|
111
|
+
--bg1:
|
|
112
|
+
radial-gradient(1240px 1060px at 84% -6%, rgba(40,152,150,.32), transparent 58%),
|
|
113
|
+
radial-gradient(1320px 1140px at -4% 108%, rgba(98,98,204,.28), transparent 58%),
|
|
114
|
+
radial-gradient(1060px 960px at 108% 104%, rgba(60,142,192,.24), transparent 56%);
|
|
115
|
+
--bg2:
|
|
116
|
+
radial-gradient(1120px 920px at 50% 36%, rgba(92,202,182,.24), transparent 60%),
|
|
117
|
+
radial-gradient(840px 740px at 61% 28%, rgba(70,172,192,.21), transparent 60%),
|
|
118
|
+
radial-gradient(780px 740px at 39% 56%, rgba(112,122,212,.19), transparent 60%);
|
|
119
|
+
--bg3:
|
|
120
|
+
radial-gradient(560px 490px at 46% 42%, rgba(152,238,212,.17), transparent 58%),
|
|
121
|
+
radial-gradient(460px 540px at 66% 52%, rgba(92,182,222,.16), transparent 60%),
|
|
122
|
+
radial-gradient(500px 460px at 31% 36%, rgba(152,142,226,.14), transparent 60%);
|
|
123
|
+
--grain:.3; --grain-blend:soft-light;
|
|
124
|
+
--canvas:rgba(20,26,34,.5); --panel:rgba(15,20,28,.34); --tab-idle:rgba(0,0,0,.16);
|
|
125
|
+
--chrome:rgba(12,16,22,.5); --surface:rgba(28,34,44,.55); --raised:#171d26;
|
|
126
|
+
--glass:rgba(20,26,34,.44); --blur:saturate(160%) blur(22px);
|
|
127
|
+
--hairline:rgba(210,224,244,.09); --ink:#e9eef6; --ink-muted:#a4adba; --ink-faint:#8a93a0;
|
|
128
|
+
--accent:#f1944f; --accent-strong:#de742e; --accent-hover:#f6a566; --on-accent:#221812;
|
|
129
|
+
--btn-bg:#de742e; --btn-bg-hover:#cf6a26;
|
|
130
|
+
--ok:#65c89b; --warn:#e6c45a; --bad:#f28c8c;
|
|
131
|
+
--accent-tint:rgba(241,148,79,.15); --ok-tint:rgba(101,200,155,.14);
|
|
132
|
+
--warn-tint:rgba(230,196,90,.14); --bad-tint:rgba(234,106,106,.18);
|
|
133
|
+
--hover:rgba(210,224,244,.06); --glass-brd:rgba(210,224,244,.1); --glass-top:rgba(210,224,244,.1);
|
|
134
|
+
--lit:radial-gradient(120% 110% at 18% -25%, rgba(255,255,255,.14), transparent 58%); --rimA:.58; --rimB:.14;
|
|
135
|
+
--sheen:linear-gradient(180deg,rgba(224,226,245,.06),rgba(224,226,245,0) 46%);
|
|
136
|
+
--shadow:0 30px 70px -26px rgba(0,0,0,.72), 0 3px 12px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.1), inset 0 0 0 1px var(--glass-brd);
|
|
137
|
+
--shadow-sm:0 12px 30px -16px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08), inset 0 0 0 1px var(--glass-brd);
|
|
138
|
+
--shadow-md:0 18px 44px -20px rgba(0,0,0,.64), inset 0 1px 0 rgba(255,255,255,.08), inset 0 0 0 1px var(--glass-brd);
|
|
139
|
+
--shadow-lg:0 44px 96px -30px rgba(0,0,0,.76), inset 0 1px 0 rgba(255,255,255,.1), inset 0 0 0 1px var(--glass-brd);
|
|
140
|
+
--edge-shadow:rgba(0,0,0,.62);
|
|
141
|
+
--glow:0 0 0 1px rgba(241,148,79,.18), 0 14px 40px -14px rgba(241,148,79,.38);
|
|
142
|
+
--ring:rgba(241,148,79,.62); --sb-thumb:rgba(210,224,244,.16); --sb-thumb-h:rgba(210,224,244,.28); --guide-line:rgba(210,224,244,.14);
|
|
143
|
+
--center-glow:none; --ambient:none;
|
|
144
|
+
--paper-tex:none; --paper-blend:normal;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
*{box-sizing:border-box}
|
|
148
|
+
html,body{height:100%}
|
|
149
|
+
body{
|
|
150
|
+
margin:0; background:var(--bgbase); color:var(--ink);
|
|
151
|
+
font-family:var(--sans); font-size:16px; line-height:1.62;
|
|
152
|
+
font-feature-settings:"kern","liga","calt"; font-optical-sizing:auto;
|
|
153
|
+
-webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
|
|
154
|
+
overflow:hidden;
|
|
155
|
+
}
|
|
156
|
+
/* ── the living gradient: three fixed Harbor planes stacked over --bgbase. Each
|
|
157
|
+
plane (gl1 far → gl3 near) slowly drifts AND takes scroll parallax at its own
|
|
158
|
+
speed (--py set on #main scroll), so the atmosphere gains real 3D depth: the
|
|
159
|
+
near plane races the far one as you scroll. Brightest + most saturated toward
|
|
160
|
+
the centre, cooler/deeper at the edges, so the floating glass reads clearly. ── */
|
|
161
|
+
.living{ position:fixed; inset:-760px -60px; z-index:-2; pointer-events:none; background:var(--bgbase); }
|
|
162
|
+
.glayer{ content:""; position:absolute; inset:0; background-repeat:no-repeat; will-change:transform; }
|
|
163
|
+
.gl1{ background-image:var(--bg1); background-size:150% 150%; background-position:50% 42%;
|
|
164
|
+
transform:translate3d(0, calc(var(--py,0) * -.14px), 0); animation:drift1 66s ease-in-out infinite alternate; }
|
|
165
|
+
.gl2{ background-image:var(--bg2); background-size:150% 150%; background-position:50% 40%;
|
|
166
|
+
transform:translate3d(0, calc(var(--py,0) * -.34px), 0); animation:drift2 50s ease-in-out infinite alternate; }
|
|
167
|
+
.gl3{ background-image:var(--bg3); background-size:145% 145%; background-position:50% 40%;
|
|
168
|
+
transform:translate3d(0, calc(var(--py,0) * -.58px), 0); animation:drift3 40s ease-in-out infinite alternate; filter:saturate(108%); }
|
|
169
|
+
@keyframes drift1{ 0%{ background-position:42% 38%; } 100%{ background-position:58% 58%; } }
|
|
170
|
+
@keyframes drift2{ 0%{ background-position:60% 34%; } 50%{ background-position:40% 52%; } 100%{ background-position:56% 62%; } }
|
|
171
|
+
@keyframes drift3{ 0%{ background-position:38% 44%; } 50%{ background-position:60% 40%; } 100%{ background-position:44% 60%; } }
|
|
172
|
+
/* organic film grain so the glass reads as a real material over a real surface.
|
|
173
|
+
This is main's proven recipe: a plain grayscale fractalNoise (centred on mid-grey)
|
|
174
|
+
under soft-light, the SAME on both themes, at a restrained opacity. soft-light leaves
|
|
175
|
+
mid-grey a no-op, so grain textures the mid-tones WITHOUT washing anything toward grey.
|
|
176
|
+
Do NOT contrast-stretch the noise or raise the opacity to "make it pop": on the near-black
|
|
177
|
+
dark floor, soft-light can only lighten (darkening clips at 0), so strong grain there = a
|
|
178
|
+
lifted-black grey veil. Real film grain is quiet in deep shadow; let it live on the glass. */
|
|
179
|
+
.grain{ content:""; position:absolute; inset:0; opacity:var(--grain); mix-blend-mode:var(--grain-blend,overlay);
|
|
180
|
+
transform:translate3d(0, calc(var(--py,0) * -.20px), 0); will-change:transform;
|
|
181
|
+
background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
|
|
182
|
+
background-size:160px 160px; }
|
|
183
|
+
/* shared sharp Liquid-Glass rim: a 1px gradient ring (mask-composite trick) that
|
|
184
|
+
catches light along the top-left edge of any glass surface. */
|
|
185
|
+
.rim{ position:relative; }
|
|
186
|
+
.rim::before{ content:""; position:absolute; inset:0; border-radius:inherit; padding:1px; z-index:1;
|
|
187
|
+
background:linear-gradient(150deg, rgba(255,255,255,var(--rimA)) 0%, rgba(255,255,255,var(--rimB)) 26%, rgba(255,255,255,0) 60%);
|
|
188
|
+
-webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
|
|
189
|
+
-webkit-mask-composite:xor; mask-composite:exclude; pointer-events:none; }
|
|
190
|
+
::selection{ background:var(--accent-tint); }
|
|
191
|
+
:focus-visible{ outline:2px solid var(--ring); outline-offset:2px; border-radius:var(--r-xs); }
|
|
192
|
+
/* Themed scrollbars. Chrome/Safari/Electron get the always-visible `::-webkit-scrollbar` below;
|
|
193
|
+
they IGNORE those pseudo-elements if `scrollbar-width`/`scrollbar-color` is set on an element,
|
|
194
|
+
and on macOS the standard scrollbar auto-hides to a 0-width overlay — so a set-and-forget
|
|
195
|
+
`scrollbar-width:thin` made overflowing panes (the Explorer tree) show no scrollbar at all.
|
|
196
|
+
Restrict the standard properties to browsers WITHOUT webkit scrollbars (Firefox), so everyone
|
|
197
|
+
else falls through to the styled, persistent webkit bar. */
|
|
198
|
+
@supports not selector(::-webkit-scrollbar){
|
|
199
|
+
*{ scrollbar-width:thin; scrollbar-color:var(--sb-thumb) transparent; }
|
|
200
|
+
}
|
|
201
|
+
::-webkit-scrollbar{ width:11px; height:11px; }
|
|
202
|
+
::-webkit-scrollbar-track,::-webkit-scrollbar-corner{ background:transparent; }
|
|
203
|
+
::-webkit-scrollbar-thumb{ background:var(--sb-thumb); border-radius:8px; border:3px solid transparent; background-clip:padding-box; min-height:36px; }
|
|
204
|
+
::-webkit-scrollbar-thumb:hover{ background:var(--sb-thumb-h); background-clip:padding-box; }
|
|
205
|
+
/* While actively resizing OR scrolling, drop the expensive glass backdrop-blur so the
|
|
206
|
+
compositor stays smooth. Scrolling moves the Harbor atmosphere behind the container
|
|
207
|
+
(the scroll parallax), and re-blurring a MOVING backdrop every frame is what makes
|
|
208
|
+
scrolling stutter — so we pause the blur mid-scroll and restore it ~140ms after it
|
|
209
|
+
stops (see initAtmosphere). The parallax + drift keep animating; only the blur pauses. */
|
|
210
|
+
html.resizing *,html.resizing *::before,html.resizing *::after,
|
|
211
|
+
html.scrolling *,html.scrolling *::before,html.scrolling *::after{ backdrop-filter:none!important; -webkit-backdrop-filter:none!important; }
|
|
212
|
+
html.resizing .living .grain{ display:none; }
|
|
213
|
+
|
|
214
|
+
/* ---- app shell ------------------------------------------------------------ */
|
|
215
|
+
#app{ display:grid; grid-template-columns:var(--sb) 1fr; grid-template-rows:minmax(0,1fr);
|
|
216
|
+
grid-template-areas:"sidebar stage"; height:100vh; height:100dvh; position:relative; }
|
|
217
|
+
.sidebar{ grid-area:sidebar; }
|
|
218
|
+
/* Draggable divider between the sidebar and the stage — a wide invisible hit area that
|
|
219
|
+
sits ON the column boundary. Its affordance is a faint outward-chevron handle ‹ › at
|
|
220
|
+
rest (unmistakably "resize", never a scrollbar); on hover / focus / active drag the
|
|
221
|
+
chevrons brighten to ember and a faint ember hairline appears between them, completing
|
|
222
|
+
the ‹ | › splitter for precise edge feedback. */
|
|
223
|
+
.sb-resize{ position:absolute; top:0; bottom:0; left:var(--sb); width:12px; transform:translateX(-50%);
|
|
224
|
+
z-index:calc(var(--z-sticky) + 1); cursor:col-resize; background:transparent; border:0; padding:0;
|
|
225
|
+
touch-action:none; -webkit-user-select:none; user-select:none; }
|
|
226
|
+
/* full-height hairline — the centre "|", hidden at rest, an ember whisper on hover/drag */
|
|
227
|
+
.sb-resize::before{ content:""; position:absolute; top:0; bottom:0; left:50%; width:2px; transform:translateX(-50%);
|
|
228
|
+
border-radius:2px; background:transparent; transition:background var(--dur) var(--ease); }
|
|
229
|
+
.sb-resize:hover::before, .sb-resize:focus-visible::before, body.resizing-sb .sb-resize::before{
|
|
230
|
+
background:color-mix(in srgb, var(--accent) 50%, transparent); }
|
|
231
|
+
/* the ‹ › chevrons — faint + slightly drawn-in at rest, full + ember on interaction */
|
|
232
|
+
.sb-grip{ position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); display:flex; align-items:center; gap:3px;
|
|
233
|
+
color:var(--ink-faint); opacity:.42; pointer-events:none;
|
|
234
|
+
transition:opacity var(--dur) var(--ease), color var(--dur) var(--ease), gap var(--dur) var(--ease); }
|
|
235
|
+
.sb-grip .ico{ width:15px; height:15px; }
|
|
236
|
+
.sb-grip .ico:first-child{ margin-right:-2px; } .sb-grip .ico:last-child{ margin-left:-2px; }
|
|
237
|
+
.sb-resize:hover .sb-grip, .sb-resize:focus-visible .sb-grip, body.resizing-sb .sb-grip{
|
|
238
|
+
opacity:1; color:var(--accent); gap:6px; }
|
|
239
|
+
.sb-resize:focus-visible{ outline:none; }
|
|
240
|
+
@media (prefers-reduced-motion:reduce){ .sb-resize::before, .sb-grip{ transition:none; } }
|
|
241
|
+
body.resizing-sb{ cursor:col-resize; -webkit-user-select:none; user-select:none; }
|
|
242
|
+
body.resizing-sb *{ cursor:col-resize !important; }
|
|
243
|
+
.stage{ grid-area:stage; }
|
|
244
|
+
|
|
245
|
+
/* ── right column: the open-case tabs + the record body fused into ONE narrower,
|
|
246
|
+
partly-transparent floating glass shape, with a margin from each side. ── */
|
|
247
|
+
.stage{ min-width:0; min-height:0; display:flex; padding:14px 22px 18px; }
|
|
248
|
+
.container{ position:relative; flex:1 1 auto; min-width:0; min-height:0; width:100%; max-width:1120px; margin:0 auto;
|
|
249
|
+
display:flex; flex-direction:column; border-radius:var(--r-xl); overflow:hidden;
|
|
250
|
+
background:var(--panel); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur); box-shadow:var(--shadow); }
|
|
251
|
+
.container::after{ content:""; position:absolute; inset:0; pointer-events:none; background:var(--lit); z-index:0; border-radius:inherit; }
|
|
252
|
+
|
|
253
|
+
/* ---- top bar: open-case tabs + page controls = the top edge of the shape ---- */
|
|
254
|
+
.tabbar{ position:relative; z-index:2; display:flex; align-items:stretch; min-width:0; min-height:42px; }
|
|
255
|
+
.tabs{ display:flex; align-items:stretch; flex:0 1 auto; min-width:0; overflow-x:auto; scrollbar-width:none; scroll-behavior:smooth; }
|
|
256
|
+
.tabs::-webkit-scrollbar{ display:none; }
|
|
257
|
+
.tab{ position:relative; display:flex; align-items:center; gap:6px; max-width:200px; min-width:120px; padding:0 5px 0 11px;
|
|
258
|
+
cursor:pointer; color:var(--ink-muted); background:var(--tab-idle);
|
|
259
|
+
border-right:1px solid var(--hairline); border-bottom:1px solid var(--hairline);
|
|
260
|
+
transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
261
|
+
.tab:hover{ background:var(--hover); color:var(--ink); }
|
|
262
|
+
.tab.active{ background:transparent; color:var(--ink); border-bottom-color:transparent; }
|
|
263
|
+
.tab-ico{ display:inline-flex; }
|
|
264
|
+
.tab-ico:empty{ display:none; }
|
|
265
|
+
.tab-ico .ico{ width:14px; height:14px; color:var(--ink-faint); }
|
|
266
|
+
.tab.active .tab-ico .ico{ color:var(--accent); }
|
|
267
|
+
.tab-label{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12.5px; font-weight:500; }
|
|
268
|
+
/* the active tab carries the one ember accent on its NAME so it reads as current at a glance
|
|
269
|
+
(the file icon was removed, so the label is the only identity the tab shows). */
|
|
270
|
+
.tab.active .tab-label{ color:var(--accent); font-weight:600; }
|
|
271
|
+
.tab-close{ position:relative; display:grid; place-items:center; width:20px; height:20px; flex:none; border:0; background:transparent; cursor:pointer;
|
|
272
|
+
color:var(--ink-faint); border-radius:6px; opacity:0; transition:opacity var(--dur) var(--ease), background var(--dur) var(--ease); }
|
|
273
|
+
.tab-close::before{ content:""; position:absolute; inset:-3px; } /* ≥24px hit target without inflating the visual */
|
|
274
|
+
.tab:hover .tab-close,.tab.active .tab-close{ opacity:1; }
|
|
275
|
+
.tab:focus-visible{ outline:none; box-shadow:inset 0 0 0 2px var(--ring); }
|
|
276
|
+
.tab:focus-visible .tab-close{ opacity:1; }
|
|
277
|
+
.tab-close:hover{ background:var(--hover); color:var(--ink); }
|
|
278
|
+
.tab-close .ico{ width:13px; height:13px; }
|
|
279
|
+
/* tab-strip scroll chevrons — shown only when the open tabs overflow the strip, so many tabs
|
|
280
|
+
stay legible (each keeps a min width) and are reachable without a system scrollbar. The arrow
|
|
281
|
+
at the current scroll end dims. */
|
|
282
|
+
.tabscroll{ flex:none; align-self:stretch; width:26px; border:0; border-bottom:1px solid var(--hairline); border-right:1px solid var(--hairline);
|
|
283
|
+
background:var(--tab-idle); cursor:pointer; color:var(--ink-muted); display:none; place-items:center;
|
|
284
|
+
transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
285
|
+
.tabscroll.show{ display:grid; }
|
|
286
|
+
.tabscroll:hover{ background:var(--hover); color:var(--ink); }
|
|
287
|
+
.tabscroll:disabled{ opacity:.32; cursor:default; background:var(--tab-idle); color:var(--ink-muted); }
|
|
288
|
+
.tabscroll .ico{ width:16px; height:16px; }
|
|
289
|
+
.tab-add{ flex:none; align-self:stretch; width:34px; border:0; border-right:1px solid var(--hairline); border-bottom:1px solid var(--hairline);
|
|
290
|
+
background:var(--tab-idle); cursor:pointer; color:var(--ink-muted); font-size:17px; font-weight:400; display:grid; place-items:center;
|
|
291
|
+
transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
292
|
+
.tab-add:hover{ background:var(--hover); color:var(--ink); }
|
|
293
|
+
/* flexible gap that pushes the page controls to the far right of the bar */
|
|
294
|
+
.tabspacer{ flex:1 1 auto; min-width:16px; align-self:stretch; background:var(--tab-idle); border-bottom:1px solid var(--hairline); }
|
|
295
|
+
/* the semi-translucent brand wordmark — anchored to the CENTRE of the whole tab bar (so it
|
|
296
|
+
never shifts as tabs change), sitting on the idle strip and never intercepting a click. JS
|
|
297
|
+
hides it (`.crowded`) when a tab / the + button or the page controls come within a margin, so
|
|
298
|
+
it recedes cleanly instead of crowding a neighbour; `.hide` suppresses it on the branded home. */
|
|
299
|
+
.tabmark{ position:absolute; left:50%; top:0; bottom:0; transform:translateX(-50%); z-index:0;
|
|
300
|
+
display:flex; align-items:center; max-width:38%; overflow:hidden; white-space:nowrap;
|
|
301
|
+
pointer-events:none; font-size:12px; font-weight:600; letter-spacing:.02em; color:var(--ink-faint); opacity:.5;
|
|
302
|
+
-webkit-user-select:none; user-select:none; }
|
|
303
|
+
.tabmark.hide, .tabmark.crowded{ display:none; }
|
|
304
|
+
/* page controls, right side of the same bar (view switch, save state, prototype) */
|
|
305
|
+
.topactions{ flex:none; display:flex; align-items:center; gap:var(--s3); padding:0 var(--s4) 0 var(--s3);
|
|
306
|
+
align-self:stretch; background:var(--tab-idle); border-bottom:1px solid var(--hairline); }
|
|
307
|
+
.topactions:empty{ display:none; }
|
|
308
|
+
#navbtn{ align-self:center; margin-left:6px; }
|
|
309
|
+
|
|
310
|
+
/* context menu (tab actions, project switcher) */
|
|
311
|
+
.menu{ position:fixed; z-index:var(--z-dropdown); min-width:180px; padding:5px; border-radius:var(--r-md);
|
|
312
|
+
background:var(--raised); border:1px solid var(--glass-brd); box-shadow:var(--shadow); animation:reveal .12s var(--ease) both; }
|
|
313
|
+
.menu button{ display:flex; align-items:center; gap:9px; width:100%; text-align:left; border:0; background:transparent; cursor:pointer;
|
|
314
|
+
font:inherit; font-size:13px; color:var(--ink); padding:7px 10px; border-radius:var(--r-sm); }
|
|
315
|
+
.menu button:hover{ background:var(--hover); }
|
|
316
|
+
.menu button .ico{ width:15px; height:15px; color:var(--ink-faint); }
|
|
317
|
+
.menu button.on .ico{ color:var(--accent); }
|
|
318
|
+
.menu .sep{ height:1px; margin:5px 4px; background:var(--hairline); }
|
|
319
|
+
/* A menu row with a secondary action (e.g. Remove a vault): the main button flexes, the trailing
|
|
320
|
+
button is invisible at rest and reveals only on hover or keyboard focus — never distracting.
|
|
321
|
+
The trailing button is itself a `.menu button`, so these selectors are qualified with `button` to
|
|
322
|
+
outrank the base `.menu button` rules (which would otherwise stretch it to full width). */
|
|
323
|
+
.menu-row{ display:flex; align-items:center; gap:2px; }
|
|
324
|
+
.menu-row > button:first-child{ flex:1 1 auto; min-width:0; width:auto; }
|
|
325
|
+
.menu button.menu-trail{ flex:0 0 auto; display:grid; place-items:center; width:26px; height:26px; padding:0; gap:0;
|
|
326
|
+
border:0; border-radius:var(--r-sm); background:transparent; color:var(--ink-faint); cursor:pointer;
|
|
327
|
+
opacity:0; transition:opacity .15s var(--ease), background .15s var(--ease), color .15s var(--ease); }
|
|
328
|
+
.menu button.menu-trail .ico{ width:15px; height:15px; }
|
|
329
|
+
.menu-row:hover button.menu-trail, .menu-row:focus-within button.menu-trail, button.menu-trail:focus-visible{ opacity:1; }
|
|
330
|
+
button.menu-trail:hover, button.menu-trail:focus-visible{ background:var(--hover); }
|
|
331
|
+
button.menu-trail.danger:hover, button.menu-trail.danger:focus-visible{ background:var(--bad-tint); color:var(--bad); }
|
|
332
|
+
@media (prefers-reduced-motion: reduce){ button.menu-trail{ transition:none; } }
|
|
333
|
+
|
|
334
|
+
/* ---- sidebar: suspended on the living gradient (transparent, no chrome) ----- */
|
|
335
|
+
.sidebar{
|
|
336
|
+
position:relative; z-index:var(--z-sticky);
|
|
337
|
+
display:flex; flex-direction:column; min-height:0;
|
|
338
|
+
background:transparent; padding:2px 4px 0;
|
|
339
|
+
}
|
|
340
|
+
.sb-head{ display:flex; align-items:center; gap:7px; padding:10px 8px 8px 10px; }
|
|
341
|
+
/* project switcher — the compact header row (the ember mark moved to the favicon) */
|
|
342
|
+
.projsel{ display:flex; align-items:center; gap:6px; flex:1 1 auto; min-width:0; padding:5px 5px 5px 8px; border-radius:var(--r-sm);
|
|
343
|
+
border:0; background:transparent; box-shadow:none; cursor:pointer; font:inherit; color:var(--ink); text-align:left;
|
|
344
|
+
transition:background var(--dur) var(--ease); }
|
|
345
|
+
.projsel:hover{ background:var(--hover); }
|
|
346
|
+
.projsel .pname{ min-width:0; flex:0 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; font-size:13px; }
|
|
347
|
+
.projsel .cv{ width:14px; height:14px; flex:none; margin-left:auto; color:var(--ink-faint); }
|
|
348
|
+
/* case search (item 9) */
|
|
349
|
+
.search{ position:relative; padding:0 var(--s3) var(--s3); }
|
|
350
|
+
.search .ico{ position:absolute; left:calc(var(--s3) + 9px); top:50%; transform:translateY(-50%); width:15px; height:15px; color:var(--ink-faint); pointer-events:none; }
|
|
351
|
+
.search input{ width:100%; height:34px; padding:0 26px 0 32px; border-radius:var(--r-md); border:0;
|
|
352
|
+
background:var(--glass); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur);
|
|
353
|
+
box-shadow:inset 0 0 0 1px var(--hairline); color:var(--ink); font:inherit; font-size:13px; outline:none;
|
|
354
|
+
transition:box-shadow var(--dur) var(--ease); }
|
|
355
|
+
.search input:focus{ outline:2px solid var(--ring); outline-offset:1px; box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 55%, var(--hairline)); }
|
|
356
|
+
.search input::placeholder{ color:var(--ink-faint); }
|
|
357
|
+
.search .clr{ position:absolute; right:calc(var(--s3) + 5px); top:50%; transform:translateY(-50%); width:18px; height:18px; border:0;
|
|
358
|
+
background:transparent; cursor:pointer; color:var(--ink-faint); border-radius:5px; display:none; place-items:center; }
|
|
359
|
+
.search .clr.show{ display:grid; }
|
|
360
|
+
.search .clr:hover{ background:var(--hover); color:var(--ink); }
|
|
361
|
+
/* top-bar global utility cluster (Inbox + Feedback + Settings) — right edge of the tab bar, continuing its
|
|
362
|
+
bottom hairline. Global chrome kept OUT of the sidebar so the sidebar is a pure nav column. */
|
|
363
|
+
.topglobal{ flex:none; display:flex; align-items:center; gap:1px; padding:0 25px 0 4px; align-self:stretch;
|
|
364
|
+
background:var(--tab-idle); border-bottom:1px solid var(--hairline); }
|
|
365
|
+
.gicon{ appearance:none; border:0; background:transparent; color:var(--ink-muted); cursor:pointer;
|
|
366
|
+
width:34px; height:34px; border-radius:var(--r-sm); display:grid; place-items:center;
|
|
367
|
+
transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
368
|
+
.gicon:hover{ background:var(--hover); color:var(--ink); }
|
|
369
|
+
.gicon:focus-visible{ outline:2px solid var(--ring); outline-offset:-2px; }
|
|
370
|
+
.gicon .ico{ width:19px; height:19px; }
|
|
371
|
+
.gicon.active{ color:var(--accent); }
|
|
372
|
+
.cap{ padding:var(--s4) var(--s4) var(--s2); font-size:12px; font-weight:560; color:var(--ink-muted); }
|
|
373
|
+
.caselist{ flex:1 1 auto; min-height:0; overflow-y:scroll; overflow-x:hidden; padding:0 6px var(--s4); display:flex; flex-direction:column; gap:2px;
|
|
374
|
+
/* Always show the tree's scrollbar when it overflows (see the global `@supports` note above:
|
|
375
|
+
the standard `scrollbar-width` is left OFF for webkit browsers so this custom bar renders and
|
|
376
|
+
never auto-hides). `overflow-y:scroll` + a stable gutter keep the layout steady. */
|
|
377
|
+
scrollbar-gutter:stable; }
|
|
378
|
+
.caselist::-webkit-scrollbar{ width:10px; }
|
|
379
|
+
.caselist::-webkit-scrollbar-thumb{ background:var(--sb-thumb); border-radius:8px; border:2px solid transparent; background-clip:padding-box; min-height:36px; }
|
|
380
|
+
.caselist::-webkit-scrollbar-thumb:hover{ background:var(--sb-thumb-h); background-clip:padding-box; }
|
|
381
|
+
.caseitem{
|
|
382
|
+
position:relative; display:block; text-decoration:none; color:inherit; cursor:pointer;
|
|
383
|
+
padding:9px 11px 9px 13px; border-radius:var(--r-sm); border:0; background:transparent; text-align:left; font:inherit; width:100%;
|
|
384
|
+
transition:background var(--dur) var(--ease);
|
|
385
|
+
}
|
|
386
|
+
/* The staggered entrance is a first-paint flourish only. Re-renders (e.g. clicking a
|
|
387
|
+
case re-runs renderSidebar) must NOT replay it — that reads as every row blinking and
|
|
388
|
+
sliding. The list carries `.intro` only on its first population; see fillCaseList. */
|
|
389
|
+
.caselist.intro .caseitem{ animation:casein .34s var(--ease) both; animation-delay:calc(var(--i,0)*18ms); }
|
|
390
|
+
.caseitem:hover{ background:var(--hover); }
|
|
391
|
+
.caseitem.active{ background:color-mix(in srgb, var(--accent) 7%, var(--hover)); }
|
|
392
|
+
.caseitem.active::before{ content:""; position:absolute; left:3px; top:9px; bottom:9px; width:2px; border-radius:2px; background:var(--accent); }
|
|
393
|
+
.caseitem .st{ font-weight:560; color:var(--ink); line-height:1.35;
|
|
394
|
+
display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
|
|
395
|
+
.caseitem .sm{ display:flex; align-items:center; gap:8px; margin-top:3px; font-size:12px; color:var(--ink-muted); }
|
|
396
|
+
.caseitem.active .sm{ color:var(--ink); }
|
|
397
|
+
|
|
398
|
+
/* per-file Document ⇄ Diff toggle — mirrors the top-bar global icons (.gicon) exactly (same box,
|
|
399
|
+
size, hover) so it reads as one control vocabulary and lines up directly beneath them, with the
|
|
400
|
+
ember-tint "on" state borrowed from the sidebar's diff filter. A dot marks that THIS file has
|
|
401
|
+
uncommitted changes; pressed (ember) means its diff is showing; disabled when nothing to diff. */
|
|
402
|
+
.viewtoggle{ position:relative; appearance:none; border:0; background:transparent; cursor:pointer; color:var(--ink-muted);
|
|
403
|
+
width:34px; height:34px; border-radius:var(--r-sm); display:grid; place-items:center;
|
|
404
|
+
transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
405
|
+
.viewtoggle:hover{ background:var(--hover); color:var(--ink); }
|
|
406
|
+
.viewtoggle.on{ background:var(--accent-tint); color:var(--accent); }
|
|
407
|
+
.viewtoggle.on:hover{ background:color-mix(in srgb, var(--accent) 18%, transparent); }
|
|
408
|
+
.viewtoggle:disabled{ opacity:.42; cursor:default; background:transparent; color:var(--ink-faint); }
|
|
409
|
+
.viewtoggle:focus-visible{ outline:2px solid var(--ring); outline-offset:-2px; }
|
|
410
|
+
.viewtoggle .ico{ width:19px; height:19px; }
|
|
411
|
+
.viewtoggle .cdot{ position:absolute; top:5px; right:5px; width:6px; height:6px; border-radius:50%;
|
|
412
|
+
background:var(--warn); box-shadow:0 0 0 2px var(--canvas); }
|
|
413
|
+
/* The Document⇄Diff control floats at the top-right of the reading canvas — it acts on THIS
|
|
414
|
+
document and must stay reachable in BOTH the document and the diff view — so it lives with the
|
|
415
|
+
content, not the tab bar. Pinned (not scrolling), its right offset matches .topglobal's so the
|
|
416
|
+
toggle sits in the SAME column as the inbox/theme icons directly above it. */
|
|
417
|
+
/* A frosted background panel behind the command-bar controls so scrolling comment cards never show
|
|
418
|
+
THROUGH the gaps between the buttons (the bar reads as one solid cluster over the canvas). Roomy
|
|
419
|
+
padding keeps it from feeling crowded; the right offset + the topglobal padding are kept in step
|
|
420
|
+
(right = R, so the rightmost control lands in the SAME column as the tab-bar's rightmost icon —
|
|
421
|
+
see .topglobal). */
|
|
422
|
+
.docdiff{ position:absolute; top:46px; right:14px; z-index:var(--z-sticky);
|
|
423
|
+
display:flex; align-items:center; gap:var(--s2); padding:7px 10px; border-radius:var(--r-lg);
|
|
424
|
+
background:color-mix(in srgb, var(--bg) 88%, transparent); border:1px solid var(--glass-brd);
|
|
425
|
+
backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); box-shadow:var(--shadow-sm); }
|
|
426
|
+
.docdiff[hidden]{ display:none; }
|
|
427
|
+
@media (max-width:720px){ .docdiff{ right:var(--s2); } }
|
|
428
|
+
/* The corner cluster reads as one cohesive set of TOOL controls — not a marketing CTA floating
|
|
429
|
+
over the reading canvas. A shared 30px height and the workbench's recessed frosted vocabulary,
|
|
430
|
+
with ember kept as the ACCENT (the control icons, the pressed Diff toggle, the verdict pill),
|
|
431
|
+
so the Deliberate prototype actions match the rest of the portal's chrome instead of shouting. */
|
|
432
|
+
.docdiff .tbtn{ height:30px; padding:0 12px; font-size:12px; }
|
|
433
|
+
.docdiff .tbtn:not(.danger){ background:var(--surface); color:var(--ink); border:1px solid var(--hairline);
|
|
434
|
+
box-shadow:var(--shadow-sm); font-weight:600; }
|
|
435
|
+
.docdiff .tbtn:not(.danger):hover{ background:var(--surface); box-shadow:var(--shadow-sm); transform:translateY(-1px);
|
|
436
|
+
border-color:color-mix(in srgb, var(--accent) 42%, var(--hairline)); }
|
|
437
|
+
.docdiff .tbtn:not(.danger):active{ transform:translateY(0); box-shadow:var(--shadow-sm); }
|
|
438
|
+
.docdiff .tbtn:not(.danger) .ico{ color:var(--accent); }
|
|
439
|
+
.docdiff .viewtoggle{ width:30px; height:30px; }
|
|
440
|
+
|
|
441
|
+
/* verdict pill */
|
|
442
|
+
.pill{ display:inline-flex; align-items:center; gap:5px; height:20px; padding:0 9px; border-radius:var(--pill);
|
|
443
|
+
font-size:12px; font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; }
|
|
444
|
+
.pill::before{ content:""; width:6px; height:6px; border-radius:50%; }
|
|
445
|
+
.pill.advance{ background:var(--ok-tint); color:var(--ok); } .pill.advance::before{ background:var(--ok); }
|
|
446
|
+
.pill.shelve{ background:var(--warn-tint); color:var(--warn); } .pill.shelve::before{ background:var(--warn); }
|
|
447
|
+
.pill.reject{ background:var(--bad-tint); color:var(--bad); } .pill.reject::before{ background:var(--bad); }
|
|
448
|
+
.pill.neutral{ background:rgba(128,128,140,.14); color:var(--ink-faint); } .pill.neutral::before{ background:var(--ink-faint); }
|
|
449
|
+
/* brief pill — a cool petrol signal (a Harbor atmosphere hue), theme-adaptive via the
|
|
450
|
+
ink mix so it stays legible on both light and dark without a second brand color. */
|
|
451
|
+
.pill.brief,.pill.readout{ background:color-mix(in srgb, #3a9eb8 15%, transparent); color:color-mix(in srgb, var(--ink) 46%, #2f8299); }
|
|
452
|
+
.pill.brief::before,.pill.readout::before{ background:color-mix(in srgb, var(--ink) 34%, #2f8299); }
|
|
453
|
+
/* matchup pill — a warm clay signal, set apart from the brief's cool petrol so a head-to-head
|
|
454
|
+
reads as a distinct kind at a glance; same ink-mix approach keeps it legible in both themes. */
|
|
455
|
+
.pill.matchup{ background:color-mix(in srgb, #c2703a 15%, transparent); color:color-mix(in srgb, var(--ink) 46%, #a8582a); }
|
|
456
|
+
.pill.matchup::before{ background:color-mix(in srgb, var(--ink) 34%, #a8582a); }
|
|
457
|
+
/* ---- Explorer: the sidebar's file view --------------------------------------
|
|
458
|
+
A header row ("EXPLORER" + a Flat/Tree toggle + Collapse-all), then either a flat
|
|
459
|
+
list of the meaningful documents (typed records) or the real markdown file
|
|
460
|
+
tree with disclosure carets. */
|
|
461
|
+
.expbar{ display:flex; align-items:center; gap:0; margin:var(--s3) 24px 4px var(--s4); }
|
|
462
|
+
.expbar .exptitle{ font-size:11px; font-weight:680; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-faint); margin-right:auto; }
|
|
463
|
+
.expseg{ display:inline-flex; padding:2px; gap:2px; background:rgba(128,128,140,.10); border-radius:var(--r-sm); }
|
|
464
|
+
.expseg button{ appearance:none; border:0; background:transparent; cursor:pointer; color:var(--ink-faint); padding:4px 6px; border-radius:5px;
|
|
465
|
+
display:inline-flex; align-items:center; transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
466
|
+
.expseg button:hover{ color:var(--ink); }
|
|
467
|
+
.expseg button[aria-pressed="true"]{ background:var(--raised); color:var(--ink); box-shadow:var(--shadow-sm); }
|
|
468
|
+
.expseg .ico{ width:15px; height:15px; }
|
|
469
|
+
/* The header action icons line up with the row's right-hand icon columns: each is a 24px square
|
|
470
|
+
(matching `.rowact`/`.gitslot`), and they are a contiguous, right-aligned run — so the rightmost
|
|
471
|
+
(Collapse-all) sits over the row's git-badge / hover-action column, and each icon to its left over
|
|
472
|
+
the next column. The bar's right margin (24px on `.expbar`, wider than a row's 8px padding) is what
|
|
473
|
+
pulls the run left onto those columns — matching the row content edge past the list's own gutter;
|
|
474
|
+
keep it in sync with `.trow`/`.gitslot` if the row's right padding or the list gutter changes. */
|
|
475
|
+
.expbar .collapseall{ appearance:none; border:0; background:transparent; cursor:pointer; color:var(--ink-faint); padding:0; min-width:24px; min-height:24px; border-radius:5px; display:inline-flex; align-items:center; justify-content:center; }
|
|
476
|
+
.expbar .collapseall:hover{ background:rgba(128,128,140,.10); color:var(--ink); }
|
|
477
|
+
.expbar .collapseall .ico{ width:15px; height:15px; }
|
|
478
|
+
.segcount{ font-size:11px; font-weight:640; color:var(--ink-faint); font-variant-numeric:tabular-nums; }
|
|
479
|
+
/* Explorer header action buttons: New file + the diff-mode toggle, sitting beside Collapse-all
|
|
480
|
+
(the diff filter moved up here from a full-width bar — see the branch on the project button). */
|
|
481
|
+
.expbar .expact{ position:relative; appearance:none; border:0; background:transparent; cursor:pointer; color:var(--ink-faint); padding:0; min-width:24px; min-height:24px; border-radius:5px; display:inline-flex; align-items:center; justify-content:center;
|
|
482
|
+
transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
483
|
+
.expbar .expact:hover{ background:rgba(128,128,140,.10); color:var(--ink); }
|
|
484
|
+
.expbar .expact .ico{ width:15px; height:15px; }
|
|
485
|
+
.expbar .expact.difftoggle.on{ background:var(--accent-tint); color:var(--accent); }
|
|
486
|
+
.expbar .expact.difftoggle.on:hover{ background:color-mix(in srgb, var(--accent) 18%, transparent); }
|
|
487
|
+
/* the comments-only filter toggle — amber when active, matching the comment channel */
|
|
488
|
+
.expbar .expact.cmttoggle.on{ background:var(--accent-tint); color:var(--accent); }
|
|
489
|
+
.expbar .expact.cmttoggle.on:hover{ background:color-mix(in srgb, var(--accent) 18%, transparent); }
|
|
490
|
+
.expbar .expact .cbadge{ position:absolute; top:-3px; right:-3px; min-width:14px; height:14px; padding:0 3px; box-sizing:border-box;
|
|
491
|
+
display:grid; place-items:center; border-radius:var(--pill); background:var(--accent); color:var(--on-accent,#fff);
|
|
492
|
+
font-size:9.5px; font-weight:680; line-height:1; font-variant-numeric:tabular-nums; }
|
|
493
|
+
.expbar .expact .cbadge.amber{ background:var(--accent); }
|
|
494
|
+
/* the per-file / per-folder comment marker — an amber comment glyph + count in its OWN slot,
|
|
495
|
+
so it sits beside (never on top of) the git A/M/D badge. Folders get just a dot. */
|
|
496
|
+
.trow .cmtb{ flex:none; display:inline-flex; align-items:center; gap:1px; height:16px; padding:0 3px; margin-left:1px; border-radius:5px;
|
|
497
|
+
color:var(--accent); background:color-mix(in srgb,var(--accent) 15%, transparent); font:700 10px/1 var(--mono); font-variant-numeric:tabular-nums; }
|
|
498
|
+
.trow .cmtb .ico{ width:12px; height:12px; }
|
|
499
|
+
.trow .cmtb.dot{ width:8px; height:8px; min-width:8px; padding:0; border-radius:50%; background:var(--accent); box-shadow:0 0 0 3px var(--accent-tint); }
|
|
500
|
+
/* The current branch, shown beside the project name on the project switcher (git repos only). */
|
|
501
|
+
.projsel .pbranch{ display:inline-flex; align-items:center; gap:4px; flex:0 1 auto; min-width:0; max-width:50%; color:var(--ink-faint); font-size:11.5px; font-weight:540; }
|
|
502
|
+
.projsel .pbranch .ico{ width:13px; height:13px; flex:none; }
|
|
503
|
+
.projsel .pbranch .pbn{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
504
|
+
|
|
505
|
+
/* A row in the explorer — shared by flat leaves and tree nodes. Space is at a premium, so
|
|
506
|
+
There are no file/folder icons — just the folder caret + the name — and
|
|
507
|
+
indentation is tight. `--depth` (the nesting level) drives both the left inset and the
|
|
508
|
+
vertical indent guides: a 1px hairline is tiled once per ancestor level via a clipped
|
|
509
|
+
repeating gradient, so multi-nested folders stay legible without a wrapper per level. */
|
|
510
|
+
.trow{ --ind-pad:7px; --ind-step:14px; --ind-caret:18px;
|
|
511
|
+
position:relative; display:flex; align-items:center; gap:5px; width:100%; box-sizing:border-box;
|
|
512
|
+
padding:3px 8px; padding-left:calc(var(--ind-pad) + var(--depth,0)*var(--ind-step) + var(--lead,0px));
|
|
513
|
+
border-radius:var(--r-sm); border:0; background:transparent; text-align:left; font:inherit;
|
|
514
|
+
color:var(--ink-muted); cursor:pointer; text-decoration:none; min-height:24px;
|
|
515
|
+
background-repeat:no-repeat;
|
|
516
|
+
background-image:repeating-linear-gradient(90deg, var(--guide-line) 0 1px, transparent 1px var(--ind-step));
|
|
517
|
+
background-position:calc(var(--ind-pad) + var(--ind-caret)/2) 0;
|
|
518
|
+
background-size:calc(var(--depth,0) * var(--ind-step)) 100%;
|
|
519
|
+
transition:background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
520
|
+
.trow:hover{ background-color:var(--hover); color:var(--ink); }
|
|
521
|
+
/* the selected row's highlight reads clean — the indent guides don't run through it */
|
|
522
|
+
.trow.active{ background-color:color-mix(in srgb, var(--accent) 8%, var(--hover)); background-image:none; color:var(--ink); }
|
|
523
|
+
.trow.active::before{ content:""; position:absolute; left:2px; top:6px; bottom:6px; width:2px; border-radius:2px; background:var(--accent); }
|
|
524
|
+
.trow .tw{ width:var(--ind-caret); height:18px; flex:none; display:grid; place-items:center; color:var(--ink-faint); }
|
|
525
|
+
.trow.dir .tw{ cursor:pointer; }
|
|
526
|
+
.trow .tw .ico{ width:16px; height:16px; transition:transform 140ms var(--ease); }
|
|
527
|
+
.trow.dir.open > .tw .ico{ transform:rotate(90deg); }
|
|
528
|
+
.trow .lbl{ min-width:0; flex:1 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; font-weight:500; }
|
|
529
|
+
.trow.dir .lbl{ font-weight:560; color:var(--ink); }
|
|
530
|
+
/* Git-status name tint: a changed file or a folder containing changes colours its
|
|
531
|
+
NAME by the aggregate change. Colours reuse the git vocabulary (--ok add, --warn modified/mixed,
|
|
532
|
+
--bad deleted); all clear 4.5:1 on the sidebar. Deleted also gets a line-through so it never rests
|
|
533
|
+
on colour alone; files additionally keep their explicit A/M/D letter badge. */
|
|
534
|
+
.trow.gs-add .lbl{ color:var(--ok); }
|
|
535
|
+
.trow.gs-mod .lbl{ color:var(--warn); }
|
|
536
|
+
.trow.gs-del .lbl{ color:var(--bad); text-decoration:line-through; text-decoration-thickness:1px; text-decoration-color:color-mix(in srgb, var(--bad) 60%, transparent); }
|
|
537
|
+
.trow .meta{ flex:none; font-size:11px; color:var(--ink-faint); font-variant-numeric:tabular-nums; }
|
|
538
|
+
/* The row's right-hand icons are three even 24px columns — [action][action][status] — right
|
|
539
|
+
aligned. The status column (`.gitslot`: the git badge for files, empty for folders) is ALWAYS in
|
|
540
|
+
flow so the name width never changes. The two hover actions OVERLAY on top (absolutely positioned,
|
|
541
|
+
so revealing them never repositions the row — no layout shift); the name fades out beneath them. */
|
|
542
|
+
.trow .gitslot{ flex:none; width:24px; height:24px; display:grid; place-items:center; }
|
|
543
|
+
.trow .rowacts{ position:absolute; top:0; bottom:0; right:32px; display:inline-flex; align-items:center; gap:0;
|
|
544
|
+
opacity:0; pointer-events:none; transition:opacity var(--dur) var(--ease); }
|
|
545
|
+
.trow:hover .rowacts, .trow:focus-within .rowacts{ opacity:1; pointer-events:auto; }
|
|
546
|
+
/* On hover the name fades out BEFORE the icon zone (the two action buttons start 80px from the
|
|
547
|
+
row's right edge) with an 8px gap, so a long name is never legible under the icons and never
|
|
548
|
+
touches them. The fade spans ~16px for a soft, graceful cut-off. */
|
|
549
|
+
.trow:hover .lbl, .trow:focus-within .lbl{
|
|
550
|
+
-webkit-mask-image:linear-gradient(to right, #000 calc(100% - 104px), transparent calc(100% - 88px));
|
|
551
|
+
mask-image:linear-gradient(to right, #000 calc(100% - 104px), transparent calc(100% - 88px)); }
|
|
552
|
+
.rowact{ appearance:none; border:0; background:transparent; cursor:pointer; color:var(--ink-faint); padding:0; border-radius:5px; display:inline-grid; place-items:center; min-width:24px; min-height:24px; }
|
|
553
|
+
.rowact:hover{ background:rgba(128,128,140,.16); color:var(--ink); }
|
|
554
|
+
.rowact .ico{ width:14px; height:14px; }
|
|
555
|
+
.rowact[data-del]:hover{ color:var(--bad); background:var(--bad-tint); }
|
|
556
|
+
@media (prefers-reduced-motion:reduce){ .trow .rowacts{ transition:none; } }
|
|
557
|
+
/* Drag-and-drop move: the dragged row dims; the folder you're about to drop into
|
|
558
|
+
gets a tinted fill + inset ring; dropping on empty space targets the vault root (whole list ring). */
|
|
559
|
+
.trow[draggable]{ -webkit-user-drag:element; }
|
|
560
|
+
.trow.dragging{ opacity:.45; }
|
|
561
|
+
.trow.dir.droptarget{ background:var(--accent-tint); box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); color:var(--ink); }
|
|
562
|
+
.explorerlist.droproot{ box-shadow:inset 0 0 0 2px color-mix(in srgb, var(--accent) 42%, transparent); border-radius:8px; }
|
|
563
|
+
.tree, .flatlist{ display:flex; flex-direction:column; gap:0; }
|
|
564
|
+
/* staggered first-paint flourish (matches the old list); never replays on re-render */
|
|
565
|
+
.explorerlist.intro .trow{ animation:casein .3s var(--ease) both; animation-delay:calc(var(--i,0)*16ms); }
|
|
566
|
+
|
|
567
|
+
/* ---- main: the transparent scroll body inside the glass container ---------- */
|
|
568
|
+
.main{ position:relative; z-index:2; flex:1 1 auto; min-height:0; min-width:0; overflow:auto; overscroll-behavior:contain;
|
|
569
|
+
display:flex; flex-direction:column; background:transparent; }
|
|
570
|
+
/* control bits (now living in the top bar's .topactions) */
|
|
571
|
+
.tb-title{ font-weight:600; letter-spacing:-.01em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
|
|
572
|
+
.tb-spacer{ flex:1 1 auto; }
|
|
573
|
+
.savedot{ display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--ink-faint); }
|
|
574
|
+
.savedot i{ width:7px; height:7px; border-radius:50%; background:transparent; transition:background var(--dur) var(--ease); }
|
|
575
|
+
.savedot.dirty i{ background:var(--warn); }
|
|
576
|
+
.savedot.saving i{ background:var(--accent); animation:pulse 1s var(--ease) infinite; }
|
|
577
|
+
@keyframes pulse{ 50%{ opacity:.3; } }
|
|
578
|
+
@keyframes reveal{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }
|
|
579
|
+
@keyframes casein{ from{ opacity:0; transform:translateX(-6px); } to{ opacity:1; transform:none; } }
|
|
580
|
+
.iconbtn{ appearance:none; border:0; background:transparent; color:var(--ink-muted); cursor:pointer; padding:6px; border-radius:var(--r-sm);
|
|
581
|
+
display:none; align-items:center; }
|
|
582
|
+
.iconbtn:hover{ background:rgba(128,128,140,.10); color:var(--ink); }
|
|
583
|
+
.iconbtn .ico{ width:20px; height:20px; }
|
|
584
|
+
|
|
585
|
+
/* reading / editing canvas */
|
|
586
|
+
.canvaswrap{ flex:1 1 auto; min-width:0; display:flex; justify-content:center; position:relative; }
|
|
587
|
+
/* padding-left carries an extra ~14px "comment gutter" so the hover + handle has room to sit clear
|
|
588
|
+
of the text instead of rendering over it. */
|
|
589
|
+
.canvas{ width:100%; max-width:min(var(--doc-w),100%); padding:var(--s7) var(--s6) 22vh calc(var(--s6) + 14px); animation:reveal .42s var(--ease) both; }
|
|
590
|
+
/* long unbreakable tokens (URLs, IDs) wrap instead of forcing a horizontal scroll on narrow screens */
|
|
591
|
+
.canvas :is(p,li,h1,h2,h3,h4,h5,h6,blockquote,td,th){ overflow-wrap:anywhere; }
|
|
592
|
+
.banner{ display:flex; gap:10px; align-items:flex-start; margin-bottom:var(--s5); padding:12px 14px;
|
|
593
|
+
background:var(--surface); border:1px solid var(--hairline); border-radius:var(--r-lg); color:var(--ink-muted); font-size:14px; }
|
|
594
|
+
.banner .ico{ width:18px; height:18px; flex:none; color:var(--accent); margin-top:1px; }
|
|
595
|
+
|
|
596
|
+
/* rendered markdown */
|
|
597
|
+
/* .blk = one live-preview block wrapper (rendered by default; its raw source is
|
|
598
|
+
revealed in place when the caret enters it — see .blk.editing). The wrapper is
|
|
599
|
+
the STABLE element across the rendered↔source swap so entering edit never swaps
|
|
600
|
+
a node or reflows the block. */
|
|
601
|
+
.blk{ border-radius:var(--r-sm); margin:0 -6px; padding:1px 6px; cursor:text; transition:background 120ms var(--ease); }
|
|
602
|
+
.blk:hover:not(.editing):not(.active){ background:rgba(128,128,140,.045); }
|
|
603
|
+
/* active-line highlight: the block holding the caret (a collapsed selection). Cleared as
|
|
604
|
+
soon as text is selected or the caret leaves, so nothing lingers. Subtle, no border. */
|
|
605
|
+
.blk.active{ background:color-mix(in srgb, var(--accent) 7%, transparent); }
|
|
606
|
+
.blk > :is(h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote,pre,table,hr):first-child{ margin-top:0; }
|
|
607
|
+
.blk.empty::before{ content:attr(data-placeholder); color:var(--ink-faint); }
|
|
608
|
+
.blk-cmt{ color:var(--ink-faint); font-family:var(--mono); font-size:12px; opacity:.6; }
|
|
609
|
+
.md-h{ letter-spacing:-.014em; text-wrap:pretty; line-height:1.25; margin:0; }
|
|
610
|
+
.md-h1{ font-family:var(--serif); font-size:2rem; font-weight:600; letter-spacing:-.012em; line-height:1.14; }
|
|
611
|
+
.md-h2{ font-size:1.32rem; font-weight:640; }
|
|
612
|
+
.md-h3{ font-size:1.08rem; font-weight:640; }
|
|
613
|
+
.md-h4{ font-size:.94rem; font-weight:660; color:var(--ink-muted); letter-spacing:.005em; }
|
|
614
|
+
.md-h5,.md-h6{ font-size:.88rem; font-weight:640; color:var(--ink-muted); }
|
|
615
|
+
.md-p{ margin:0; text-wrap:pretty; }
|
|
616
|
+
.md-list{ margin:0; padding-left:1.4em; }
|
|
617
|
+
.md-list li{ margin:.15em 0; }
|
|
618
|
+
.md-list .md-list{ margin:.15em 0; }
|
|
619
|
+
/* GitHub-style task list: no bullet, a real checkbox aligned to the first text line.
|
|
620
|
+
The box carries the app accent and is clickable even inside the contenteditable canvas
|
|
621
|
+
(it's a contenteditable=false island); a done item's label reads dimmed + struck. */
|
|
622
|
+
.md-list li.md-task{ list-style:none; margin-left:-1.4em; padding-left:0; display:flex; align-items:flex-start; gap:.5em; }
|
|
623
|
+
.md-taskbox{ appearance:auto; -webkit-appearance:auto; accent-color:var(--accent); width:1em; height:1em;
|
|
624
|
+
margin:.25em 0 0; flex:0 0 auto; cursor:pointer; }
|
|
625
|
+
.md-task > .md-tasktxt{ flex:1 1 auto; }
|
|
626
|
+
.md-task > .md-taskbox:checked + .md-tasktxt{ color:var(--ink-faint); text-decoration:line-through; }
|
|
627
|
+
.md-list li.md-task .md-list{ flex-basis:100%; margin-left:1.4em; }
|
|
628
|
+
.md-bq{ margin:0; padding:2px 0 2px 16px; border-left:2px solid var(--hairline); color:var(--ink-muted); }
|
|
629
|
+
.md-hr{ border:0; border-top:1px solid var(--hairline); margin:0; }
|
|
630
|
+
.md-img{ max-width:100%; height:auto; border-radius:8px; display:block; margin:.2em 0; }
|
|
631
|
+
.md-tbl{ border-collapse:collapse; width:100%; font-size:14.5px; }
|
|
632
|
+
.md-tbl th,.md-tbl td{ text-align:left; padding:7px 12px; border-bottom:1px solid var(--hairline); vertical-align:top; min-width:var(--tbl-mincol); }
|
|
633
|
+
.md-tbl thead th{ background:var(--hover); font-weight:660; color:var(--ink); font-size:12px; letter-spacing:.02em;
|
|
634
|
+
border-bottom:1.5px solid color-mix(in srgb, var(--ink-faint) 55%, transparent); }
|
|
635
|
+
.md-tbl thead th:first-child{ border-top-left-radius:var(--r-xs); }
|
|
636
|
+
.md-tbl thead th:last-child{ border-top-right-radius:var(--r-xs); }
|
|
637
|
+
.md-tbl tbody tr:nth-child(even) td{ background:color-mix(in srgb, var(--hover) 45%, transparent); }
|
|
638
|
+
.md-tbl tbody tr:last-child td{ border-bottom:0; }
|
|
639
|
+
/* A wide table scrolls horizontally on ITS OWN (the wrapper is the only scroll
|
|
640
|
+
container) instead of pushing the record wider than its column. Columns hold a
|
|
641
|
+
minimum width (--tbl-mincol) so prose never crushes to one word per line; once the
|
|
642
|
+
min widths exceed the container, only this wrapper scrolls — the prose around it
|
|
643
|
+
stays put. In the live editor the equivalent scroll container is `.blk.t-table`. */
|
|
644
|
+
.md-tblwrap{ overflow-x:auto; overscroll-behavior-x:contain; max-width:100%; margin:0; }
|
|
645
|
+
.blk.t-table{ overflow-x:auto; overscroll-behavior-x:contain; }
|
|
646
|
+
/* Table shape controls (edit mode only): add/delete a row or column. Rendered as a floating
|
|
647
|
+
overlay pinned just under the grid's bottom-right so ENTERING edit mode never reflows the
|
|
648
|
+
document (the table stays put). The editing block drops its own overflow clip
|
|
649
|
+
and delegates horizontal scroll to an inner wrapper, so the overlay is never clipped. */
|
|
650
|
+
.blk.editing.t-table{ position:relative; overflow:visible; }
|
|
651
|
+
.ed-tblwrap{ overflow-x:auto; overscroll-behavior-x:contain; max-width:100%; }
|
|
652
|
+
.tbl-tools{ position:absolute; top:100%; right:0; margin-top:5px; z-index:2; display:flex; align-items:center; gap:4px; user-select:none;
|
|
653
|
+
flex-wrap:wrap; padding:3px; border-radius:calc(var(--r-sm) + 3px); background:color-mix(in srgb, var(--surface) 88%, transparent);
|
|
654
|
+
backdrop-filter:blur(6px); box-shadow:var(--shadow); animation:ed-tools-in .16s var(--ease) both; }
|
|
655
|
+
@keyframes ed-tools-in{ from{ opacity:0; transform:translateY(-4px); } to{ opacity:1; transform:none; } }
|
|
656
|
+
@media (prefers-reduced-motion:reduce){ .tbl-tools{ animation:none; } }
|
|
657
|
+
.tbl-tools button{ appearance:none; border:1px solid var(--hairline); background:var(--surface); color:var(--ink-muted); cursor:pointer;
|
|
658
|
+
font:inherit; font-size:11.5px; font-weight:600; padding:3px 9px; border-radius:var(--r-sm); display:inline-flex; align-items:center; gap:4px;
|
|
659
|
+
transition:background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
|
|
660
|
+
.tbl-tools button .tt-sign{ font-size:12px; line-height:1; color:var(--ink-faint); }
|
|
661
|
+
.tbl-tools button:hover{ background:var(--hover); color:var(--ink); border-color:color-mix(in srgb, var(--accent) 40%, var(--hairline)); }
|
|
662
|
+
.tbl-tools button:hover .tt-sign{ color:var(--accent); }
|
|
663
|
+
.tbl-tools button[data-tbl^="del"]:hover{ color:var(--bad); border-color:color-mix(in srgb, var(--bad) 40%, var(--hairline)); }
|
|
664
|
+
.tbl-tools button[data-tbl^="del"]:hover .tt-sign{ color:var(--bad); }
|
|
665
|
+
.tbl-tools-sep{ width:1px; height:15px; background:var(--hairline); margin:0 3px; }
|
|
666
|
+
.md-pre{ margin:0; padding:12px 14px; background:var(--surface); border:1px solid var(--hairline); border-radius:var(--r-md);
|
|
667
|
+
overflow:auto; font-family:var(--mono); font-size:13px; line-height:1.55; }
|
|
668
|
+
.md-p code,.md-list code,.md-tbl code,.md-bq code{ font-family:var(--mono); font-size:.86em; background:rgba(128,128,140,.14);
|
|
669
|
+
padding:.1em .34em; border-radius:5px; }
|
|
670
|
+
.canvas a{ color:var(--accent); text-decoration:none; cursor:pointer; border-bottom:1px solid color-mix(in srgb,var(--accent) 35%, transparent); }
|
|
671
|
+
.canvas a:hover{ border-bottom-color:var(--accent); }
|
|
672
|
+
|
|
673
|
+
/* the score pill in the top strip doubles as a jump to the score reasoning when
|
|
674
|
+
the record has one. It stays a chip (its verdict colour is the score, not an
|
|
675
|
+
action) — the hover is a NEUTRAL liquid-glass lift (a soft top highlight + a
|
|
676
|
+
quiet shadow), never a coloured ring, so clicking never reads as destructive.
|
|
677
|
+
A small arrow reveals on hover to signal "jump". Plain span when nowhere to go. */
|
|
678
|
+
button.pill.jump{ position:relative; border:0; cursor:pointer; font:inherit; -webkit-appearance:none; appearance:none;
|
|
679
|
+
padding-right:8px; -webkit-backdrop-filter:var(--blur); backdrop-filter:var(--blur);
|
|
680
|
+
transition:box-shadow .18s var(--ease), transform .18s var(--ease); }
|
|
681
|
+
button.pill.jump::after{ content:"→"; margin-left:1px; font-weight:700; opacity:0; max-width:0; overflow:hidden;
|
|
682
|
+
transition:opacity .18s var(--ease), max-width .18s var(--ease), transform .18s var(--ease); }
|
|
683
|
+
button.pill.jump:hover, button.pill.jump:focus-visible{
|
|
684
|
+
transform:translateY(-.5px);
|
|
685
|
+
box-shadow:0 2px 6px -2px rgba(18,24,30,.22), inset 0 1px 0 rgba(255,255,255,.5); }
|
|
686
|
+
button.pill.jump:hover::after, button.pill.jump:focus-visible::after{ opacity:.75; max-width:1.1em; transform:translateX(1px); }
|
|
687
|
+
button.pill.jump:active{ transform:translateY(0); box-shadow:inset 0 1px 2px rgba(18,24,30,.16); }
|
|
688
|
+
button.pill.jump:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
|
|
689
|
+
/* the combined live-preview document: one contiguous rendered article that is itself the
|
|
690
|
+
single contenteditable surface. Vertical rhythm lives on the .blk wrappers (stable across
|
|
691
|
+
the rendered↔source swap), so entering/leaving edit never shifts spacing. No focus ring on
|
|
692
|
+
the surface — the caret is the cue, not a box around the whole record. */
|
|
693
|
+
.doc{ outline:none; }
|
|
694
|
+
.doc:focus, .doc:focus-visible{ outline:none; }
|
|
695
|
+
.doc > :is(.blk, .diffdel) + :is(.blk, .diffdel){ margin-top:.72em; }
|
|
696
|
+
.doc > :is(.blk, .diffdel).t-h2{ margin-top:1.5em; }
|
|
697
|
+
.doc > :is(.blk, .diffdel).t-h1{ margin-top:0; }
|
|
698
|
+
.doc > :is(.blk, .diffdel).t-h3{ margin-top:1.1em; }
|
|
699
|
+
.doc > :is(.blk, .diffdel):first-child{ margin-top:0; }
|
|
700
|
+
/* Read-only rendered markdown (reports, matchups, plain files) is a flat sequence of .md-* elements
|
|
701
|
+
directly under .doc — it isn't wrapped in .blk blocks, so it carries its own vertical
|
|
702
|
+
rhythm here (the case editor gets its spacing from the .blk wrappers above instead).
|
|
703
|
+
`:not(:first-child)` keeps the leading title flush to the top. */
|
|
704
|
+
.doc > :is(.md-p,.md-list,.md-bq,.md-pre,.md-hr,.md-tblwrap):not(:first-child){ margin-top:.72em; }
|
|
705
|
+
.doc > .md-h1:not(:first-child){ margin-top:1.4em; }
|
|
706
|
+
.doc > .md-h2:not(:first-child){ margin-top:1.5em; }
|
|
707
|
+
.doc > .md-h3:not(:first-child){ margin-top:1.15em; }
|
|
708
|
+
.doc > :is(.md-h4,.md-h5,.md-h6):not(:first-child){ margin-top:1.05em; }
|
|
709
|
+
.doc :is(h1,h2,h3,h4,h5,h6){ scroll-margin-top:18px; }
|
|
710
|
+
/* a span the reader has left an open comment on — a quiet, legible ember underline */
|
|
711
|
+
.doc .cmark{ background:var(--accent-tint); border-radius:3px; box-shadow:0 0 0 1px color-mix(in srgb,var(--accent) 20%, transparent) inset; cursor:pointer; padding:0 1px;
|
|
712
|
+
transition:box-shadow var(--dur) var(--ease); }
|
|
713
|
+
.doc .cmark:hover{ box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 45%, transparent); }
|
|
714
|
+
.doc .cmark.hot{ background:var(--accent-tint); box-shadow:0 0 0 3px var(--accent-tint); }
|
|
715
|
+
/* the anchor whose card is currently active — a stronger, persistent amber fill + ring so it's
|
|
716
|
+
unmistakable which span the open comment applies to (cleared when another card is focused). */
|
|
717
|
+
.doc .cmark.on{ background:color-mix(in srgb,var(--accent) 30%, transparent);
|
|
718
|
+
box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 60%, transparent); }
|
|
719
|
+
/* block-level anchor: a whole-block / multi-element comment (a bullet list, table, or several
|
|
720
|
+
paragraphs the quote can't be wrapped inline). The block gets a soft amber wash + a rounded ring
|
|
721
|
+
so it still reads as "commented" and lights up when its card is clicked. */
|
|
722
|
+
.doc .cmark-blk{ cursor:pointer; border-radius:var(--r-sm); box-shadow:0 0 0 1px color-mix(in srgb,var(--accent) 22%, transparent) inset;
|
|
723
|
+
background:color-mix(in srgb,var(--accent-tint) 40%, transparent); transition:box-shadow var(--dur) var(--ease), background var(--dur) var(--ease); }
|
|
724
|
+
.doc .cmark-blk:hover{ box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 40%, transparent); }
|
|
725
|
+
.doc .cmark-blk.hot{ background:var(--accent-tint); }
|
|
726
|
+
.doc .cmark-blk.on{ background:color-mix(in srgb,var(--accent) 20%, transparent); box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 55%, transparent); }
|
|
727
|
+
|
|
728
|
+
/* markdown syntax highlight, shared by the revealed block source */
|
|
729
|
+
.ed-mk{ color:var(--ink-faint); opacity:.62; } /* markdown punctuation, dimmed */
|
|
730
|
+
.ed-cmt{ color:var(--ink-faint); opacity:.6; font-style:italic; }
|
|
731
|
+
.ed-b{ font-weight:700; }
|
|
732
|
+
.ed-i{ font-style:italic; }
|
|
733
|
+
.ed-code{ font-family:var(--mono); font-size:.88em; color:var(--accent); }
|
|
734
|
+
.ed-link{ color:var(--accent); }
|
|
735
|
+
/* Inline reveal: while editing a block, an inline token's markdown
|
|
736
|
+
markers (** * _ ` [ ]( ) ) are hidden — so **bold** simply reads as bold — and only
|
|
737
|
+
reappear when the caret is inside that token (.ed-tok.on). The markers stay in the DOM
|
|
738
|
+
(display:none, so still in textContent) → the block source round-trips losslessly. */
|
|
739
|
+
.blk.editing .ed-tok .ed-mk{ display:none; }
|
|
740
|
+
.blk.editing .ed-tok.on .ed-mk{ display:inline; }
|
|
741
|
+
/* .blk.editing = the block whose raw source is revealed. white-space:pre-wrap keeps literal
|
|
742
|
+
newlines/spaces (so the block source round-trips losslessly); a .t-* type class matches the
|
|
743
|
+
block's rendered type (size/weight/serif) so revealing the source never resizes or reflows
|
|
744
|
+
the block. No box/border: the revealed markers + native caret are
|
|
745
|
+
the only "you're here" cue, so nothing lingers when the caret leaves or a selection spans. */
|
|
746
|
+
.blk.editing{ white-space:pre-wrap; word-break:break-word; overflow-wrap:anywhere; outline:none;
|
|
747
|
+
caret-color:var(--accent); }
|
|
748
|
+
.blk.editing.t-h1{ font-family:var(--serif); font-size:2rem; font-weight:600; letter-spacing:-.012em; line-height:1.14; }
|
|
749
|
+
.blk.editing.t-h2{ font-size:1.32rem; font-weight:640; letter-spacing:-.014em; line-height:1.25; }
|
|
750
|
+
.blk.editing.t-h3{ font-size:1.08rem; font-weight:640; letter-spacing:-.014em; line-height:1.25; }
|
|
751
|
+
.blk.editing.t-h4{ font-size:.94rem; font-weight:660; color:var(--ink-muted); letter-spacing:.005em; }
|
|
752
|
+
.blk.editing.t-h5,.blk.editing.t-h6{ font-size:.88rem; font-weight:640; color:var(--ink-muted); }
|
|
753
|
+
.blk.editing.t-code{ font-family:var(--mono); font-size:13px; line-height:1.55; }
|
|
754
|
+
.blk.editing.t-table{ font-family:var(--mono); font-size:13px; line-height:1.55; }
|
|
755
|
+
/* table + list widgets edit as real cells/items, not pre-wrapped source */
|
|
756
|
+
.blk.editing.t-table, .blk.editing.t-list{ white-space:normal; }
|
|
757
|
+
.blk.editing.t-list{ font-family:var(--sans); }
|
|
758
|
+
.md-tbl .ed-cell{ outline:none; cursor:text; min-width:2ch; border-radius:4px; }
|
|
759
|
+
.md-tbl .ed-cell:focus{ box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--accent) 45%, transparent); }
|
|
760
|
+
.ed-list{ outline:none; }
|
|
761
|
+
.ed-list li{ cursor:text; }
|
|
762
|
+
|
|
763
|
+
/* the prototype button. Default = a solid ember pill (primary action, white/on-accent
|
|
764
|
+
text clears 4.5:1 on both themes). For a REJECTED case it downshifts to `.quiet` — a
|
|
765
|
+
neutral ghost link — so the build path never shouts louder than a "don't build" verdict. */
|
|
766
|
+
.tbtn{ display:inline-flex; align-items:center; gap:7px; height:34px; padding:0 15px; border-radius:var(--pill);
|
|
767
|
+
border:0; background:var(--accent); color:var(--on-accent);
|
|
768
|
+
box-shadow:var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.22);
|
|
769
|
+
font:inherit; font-size:12.5px; font-weight:640; cursor:pointer; text-decoration:none;
|
|
770
|
+
transition:background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
|
|
771
|
+
.tbtn:hover{ background:var(--accent-hover); box-shadow:var(--glow), inset 0 1px 0 rgba(255,255,255,.3); transform:translateY(-1px); }
|
|
772
|
+
.tbtn:active{ background:var(--accent-strong); box-shadow:var(--shadow-sm), inset 0 1px 2px rgba(0,0,0,.14); transform:translateY(0); }
|
|
773
|
+
.tbtn .ico{ width:14px; height:14px; color:var(--on-accent); }
|
|
774
|
+
/* Secondary (frosted) top-bar button — Build-prototype hint; the workbench default weight. */
|
|
775
|
+
.tbtn.ghost{ background:var(--surface); color:var(--ink); border:1px solid var(--hairline);
|
|
776
|
+
box-shadow:var(--shadow-sm); font-weight:600; }
|
|
777
|
+
.tbtn.ghost:hover{ background:var(--surface); border-color:color-mix(in srgb,var(--accent) 45%, var(--hairline)); box-shadow:var(--glow); transform:translateY(-1px); }
|
|
778
|
+
.tbtn.ghost:active{ transform:translateY(0); box-shadow:var(--shadow-sm); }
|
|
779
|
+
.tbtn.ghost .ico{ width:15px; height:15px; color:var(--ink-muted); }
|
|
780
|
+
/* Read-only indicator (a case being generated by the agent). */
|
|
781
|
+
.rochip{ display:inline-flex; align-items:center; gap:6px; height:26px; padding:0 11px; border-radius:var(--pill);
|
|
782
|
+
background:color-mix(in srgb,var(--accent) 12%, transparent); color:var(--accent);
|
|
783
|
+
font-size:12px; font-weight:600; white-space:nowrap; }
|
|
784
|
+
.rochip .ico{ width:14px; height:14px; }
|
|
785
|
+
/* A read-only record surface: normal text cursor, no editing chrome. */
|
|
786
|
+
.doc.ro{ cursor:default; }
|
|
787
|
+
.doc.ro .blk{ cursor:default; }
|
|
788
|
+
/* The "being generated" banner — accent-tinted, distinct from the neutral empty banner. */
|
|
789
|
+
.banner.gen{ border-color:color-mix(in srgb,var(--accent) 30%, var(--hairline)); background:color-mix(in srgb,var(--accent) 8%, var(--surface)); }
|
|
790
|
+
.banner.gen .ico{ color:var(--accent); }
|
|
791
|
+
/* Command popover (Build-prototype hint) — an opaque raised tier over the atmosphere. */
|
|
792
|
+
.cmdpop{ position:fixed; z-index:var(--z-dropdown); width:min(360px,calc(100vw - 16px)); padding:14px; border-radius:var(--r-lg);
|
|
793
|
+
background:var(--raised); border:1px solid var(--glass-brd); box-shadow:var(--shadow);
|
|
794
|
+
animation:reveal .14s var(--ease) both; }
|
|
795
|
+
.cmdpop-t{ font-weight:640; font-size:13.5px; margin-bottom:4px; }
|
|
796
|
+
.cmdpop-d{ margin:0 0 10px; font-size:12.5px; color:var(--ink-muted); line-height:1.45; }
|
|
797
|
+
.cmdpop-row{ display:flex; gap:8px; align-items:stretch; }
|
|
798
|
+
.cmdpop-c{ flex:1 1 auto; min-width:0; display:flex; align-items:center; padding:0 10px; border-radius:var(--r-sm);
|
|
799
|
+
background:var(--surface); border:1px solid var(--hairline); font:500 12.5px/1 var(--mono); color:var(--ink);
|
|
800
|
+
overflow:auto; white-space:nowrap; }
|
|
801
|
+
.cmdpop-copy{ flex:none; display:inline-flex; align-items:center; gap:6px; padding:8px 12px; border-radius:var(--r-sm);
|
|
802
|
+
border:0; background:var(--accent); color:var(--on-accent); font:inherit; font-size:12.5px; font-weight:640; cursor:pointer;
|
|
803
|
+
transition:background var(--dur) var(--ease); }
|
|
804
|
+
.cmdpop-copy:hover{ background:var(--accent-hover); }
|
|
805
|
+
.cmdpop-copy .ico{ width:14px; height:14px; color:var(--on-accent); }
|
|
806
|
+
/* Danger top-bar button (Discard changes) — quiet by default, fills on hover. */
|
|
807
|
+
.tbtn.danger{ background:transparent; color:var(--bad); border:1px solid color-mix(in srgb,var(--bad) 34%, var(--hairline)); box-shadow:none; font-weight:600; }
|
|
808
|
+
.tbtn.danger:hover{ background:color-mix(in srgb,var(--bad) 14%, transparent); border-color:var(--bad); box-shadow:none; transform:translateY(-1px); }
|
|
809
|
+
.tbtn.danger .ico{ width:15px; height:15px; color:var(--bad); }
|
|
810
|
+
/* Confirmation dialog (destructive actions) — an opaque raised sheet over a dimmed scrim. */
|
|
811
|
+
dialog.confirm{ border:0; padding:0; background:transparent; color:inherit; max-width:min(440px,calc(100vw - 32px)); }
|
|
812
|
+
dialog.confirm::backdrop{ background:rgba(6,9,14,.52); backdrop-filter:blur(2px); }
|
|
813
|
+
.confirm-in{ background:var(--raised); border:1px solid var(--glass-brd); border-radius:var(--r-xl); box-shadow:var(--shadow-lg);
|
|
814
|
+
padding:22px 22px 18px; animation:reveal .16s var(--ease) both; }
|
|
815
|
+
.confirm-in h2{ margin:0 0 8px; font-size:16px; font-weight:660; letter-spacing:-.01em; }
|
|
816
|
+
.confirm-b{ margin:0 0 20px; font-size:13.5px; line-height:1.55; color:var(--ink-muted); }
|
|
817
|
+
.confirm-b b{ color:var(--ink); font-weight:600; }
|
|
818
|
+
.confirm-actions{ display:flex; justify-content:flex-end; gap:10px; }
|
|
819
|
+
.cbtn{ appearance:none; font:inherit; font-size:13px; font-weight:600; padding:9px 16px; border-radius:var(--r-sm); cursor:pointer;
|
|
820
|
+
border:1px solid transparent; transition:background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
|
|
821
|
+
.cbtn:active{ transform:translateY(1px); }
|
|
822
|
+
.cbtn.ghost{ background:transparent; color:var(--ink-muted); border-color:var(--hairline); }
|
|
823
|
+
.cbtn.ghost:hover{ background:rgba(128,128,140,.10); color:var(--ink); }
|
|
824
|
+
.cbtn.primary{ background:var(--accent); color:var(--on-accent); }
|
|
825
|
+
.cbtn.primary:hover{ background:var(--accent-hover); }
|
|
826
|
+
.cbtn.danger{ background:var(--bad); color:#fff; }
|
|
827
|
+
.cbtn.danger:hover{ filter:brightness(1.08); }
|
|
828
|
+
.cbtn:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
|
|
829
|
+
/* the New-file / New-folder prompt: a labelled single-line input inside the same dialog shell.
|
|
830
|
+
The destination folder is shown in full ABOVE the input (wrapping, never truncated) so a
|
|
831
|
+
deeply-nested path stays legible; the dialog is a touch wider to give it room. */
|
|
832
|
+
.confirm.prompt .confirm-in{ gap:0; }
|
|
833
|
+
dialog.confirm.prompt{ max-width:min(540px, calc(100vw - 32px)); width:min(468px, calc(100vw - 32px)); }
|
|
834
|
+
.prompt-path{ display:flex; align-items:flex-start; gap:8px; margin:0 0 16px; min-width:0; }
|
|
835
|
+
.prompt-path-cap{ flex:none; margin-top:6px; font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-faint); }
|
|
836
|
+
.prompt-path-val{ flex:1 1 auto; min-width:0; font-family:var(--mono); font-size:12.5px; line-height:1.55; color:var(--ink-muted);
|
|
837
|
+
background:var(--glass); border:1px solid var(--hairline); border-radius:var(--r-sm); padding:5px 9px; word-break:break-all; }
|
|
838
|
+
.prompt-l{ display:block; margin:0 0 20px; font-size:12px; font-weight:600; letter-spacing:.02em; color:var(--ink-muted); }
|
|
839
|
+
.prompt-row{ display:flex; align-items:stretch; margin-top:8px; border:1px solid var(--hairline); border-radius:var(--r-sm); overflow:hidden;
|
|
840
|
+
background:var(--glass); transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
|
|
841
|
+
.prompt-row:focus-within{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-tint); }
|
|
842
|
+
.prompt-i{ flex:1 1 auto; min-width:0; appearance:none; border:0; background:transparent; color:var(--ink); font:inherit; font-size:13.5px; padding:10px 12px; }
|
|
843
|
+
.prompt-i:focus{ outline:none; }
|
|
844
|
+
|
|
845
|
+
/* ---- folder picker (Open folder…): a server-side directory browser ---------
|
|
846
|
+
A browser can't return an absolute path from a native dialog, so the local daemon lists
|
|
847
|
+
directories and the user drills in. Frosted-glass modal, ember accent. */
|
|
848
|
+
dialog.folderpick{ max-width:min(560px, calc(100vw - 32px)); width:560px; }
|
|
849
|
+
.fp{ gap:0; padding:0; overflow:hidden; }
|
|
850
|
+
.fp-head{ padding:20px 22px 12px; border-bottom:1px solid var(--hairline); }
|
|
851
|
+
.fp-head h2{ margin:0 0 12px; }
|
|
852
|
+
.fp-crumbs{ display:flex; align-items:center; flex-wrap:wrap; gap:1px; font-size:12.5px; min-height:22px; }
|
|
853
|
+
.fp-crumb{ appearance:none; border:0; background:transparent; color:var(--ink-muted); font:inherit; font-size:12.5px; font-weight:560;
|
|
854
|
+
padding:3px 7px; border-radius:var(--r-xs); cursor:pointer; max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
855
|
+
.fp-crumb:hover{ background:var(--hover); color:var(--ink); }
|
|
856
|
+
.fp-crumb:last-child{ color:var(--ink); cursor:default; }
|
|
857
|
+
.fp-crumb:last-child:hover{ background:transparent; }
|
|
858
|
+
.fp-crumb:focus-visible{ outline:2px solid var(--accent); outline-offset:1px; }
|
|
859
|
+
.fp-crumb .ico{ width:14px; height:14px; }
|
|
860
|
+
.fp-sep{ color:var(--ink-faint); flex:none; opacity:.6; display:inline-flex; }
|
|
861
|
+
.fp-sep .ico{ width:13px; height:13px; }
|
|
862
|
+
.fp-body{ height:min(46vh, 360px); overflow-y:auto; overscroll-behavior:contain; padding:6px; }
|
|
863
|
+
.fp-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:1px; transition:opacity .12s ease; }
|
|
864
|
+
.fp-loading .fp-list{ opacity:.4; }
|
|
865
|
+
.fp-row{ display:flex; align-items:center; gap:10px; width:100%; text-align:left; appearance:none; border:0; background:transparent;
|
|
866
|
+
color:var(--ink); font:inherit; font-size:14px; padding:9px 11px; border-radius:var(--r-sm); cursor:pointer; }
|
|
867
|
+
.fp-row:hover{ background:var(--hover); }
|
|
868
|
+
.fp-row.sel{ background:var(--accent-tint); }
|
|
869
|
+
.fp-row:focus-visible{ outline:2px solid var(--accent); outline-offset:-2px; }
|
|
870
|
+
.fp-row .fp-fico{ width:17px; height:17px; flex:none; color:var(--accent); opacity:.9; }
|
|
871
|
+
.fp-row .fp-fico .ico{ width:17px; height:17px; }
|
|
872
|
+
.fp-row .fp-name{ flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
873
|
+
.fp-row .fp-go{ width:15px; height:15px; flex:none; color:var(--ink-faint); opacity:0; transition:opacity .12s ease; }
|
|
874
|
+
.fp-row .fp-go .ico{ width:15px; height:15px; }
|
|
875
|
+
.fp-row:hover .fp-go, .fp-row.sel .fp-go, .fp-row:focus-visible .fp-go{ opacity:1; }
|
|
876
|
+
.fp-empty{ padding:26px 14px; text-align:center; color:var(--ink-faint); font-size:13px; }
|
|
877
|
+
.fp-foot{ display:flex; align-items:center; justify-content:flex-end; padding:14px 18px 16px; border-top:1px solid var(--hairline); }
|
|
878
|
+
.fp-foot .confirm-actions{ margin:0; }
|
|
879
|
+
.fp-foot .confirm-actions{ flex:none; margin:0; }
|
|
880
|
+
@media (prefers-reduced-motion: reduce){ .fp-list, .fp-row .fp-go{ transition:none; } }
|
|
881
|
+
|
|
882
|
+
/* case layout: reading canvas + a sticky rail (the table of contents).
|
|
883
|
+
flex:1 0 auto (grow, never shrink) makes .casebody grow to its content height inside
|
|
884
|
+
the flex-column .main — so the sticky rail's containing block spans the whole record
|
|
885
|
+
and the rail stays pinned for the ENTIRE scroll (not just the first viewport). */
|
|
886
|
+
.casebody{ flex:1 0 auto; display:grid; grid-template-columns:minmax(0,1fr) var(--toc); align-items:start; }
|
|
887
|
+
.casebody.wide{ grid-template-columns:minmax(0,1fr); }
|
|
888
|
+
.rail{ position:sticky; top:var(--s5); align-self:start; max-height:calc(100dvh - 40px); overflow:auto;
|
|
889
|
+
padding:6px var(--s5) var(--s6) 6px; display:flex; flex-direction:column; gap:var(--s5); }
|
|
890
|
+
.toc-h{ font-size:11.5px; font-weight:600; letter-spacing:0; color:var(--ink-muted);
|
|
891
|
+
margin:0 0 10px 13px; display:flex; align-items:center; gap:8px; }
|
|
892
|
+
.toc a{ display:block; text-decoration:none; color:var(--ink-muted); padding:5px 10px 5px 13px; border-left:2px solid transparent;
|
|
893
|
+
line-height:1.4; font-size:13.5px; transition:color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
|
|
894
|
+
overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
895
|
+
.toc a:hover{ color:var(--ink); background:var(--hover); }
|
|
896
|
+
.toc a.lvl3{ padding-left:27px; font-size:12.5px; color:var(--ink-faint); }
|
|
897
|
+
.toc a.active{ color:var(--accent); border-left-color:var(--accent); font-weight:560; }
|
|
898
|
+
.toc a.active.lvl3{ color:var(--accent); }
|
|
899
|
+
|
|
900
|
+
/* ToC: a section with open comments carries a small ember dot */
|
|
901
|
+
.toc a{ position:relative; }
|
|
902
|
+
.toc a .tdot{ position:absolute; right:8px; top:50%; transform:translateY(-50%); width:6px; height:6px; border-radius:50%;
|
|
903
|
+
background:var(--accent); box-shadow:0 0 0 3px var(--accent-tint); }
|
|
904
|
+
|
|
905
|
+
/* ---- in-record comments (amber, always-visible) ----------------------------
|
|
906
|
+
Comments are a THIRD decoration colour: amber = "a human wants a change", deliberately distinct
|
|
907
|
+
from the diff's green (added) / red (removed) — they can co-exist on screen. The anchored span
|
|
908
|
+
gets a soft amber highlight; the comment BODY is always visible as an amber card, either inline
|
|
909
|
+
in the document flow ('inline' mode) or in the right rail ('rail' mode) — never hidden behind a
|
|
910
|
+
click-to-open bubble. The single amber comment affordance appears on block-hover OR by a text
|
|
911
|
+
selection, never both. */
|
|
912
|
+
.cgutter{ position:absolute; inset:0; pointer-events:none; z-index:5; }
|
|
913
|
+
.cgutter > *{ pointer-events:auto; }
|
|
914
|
+
/* the ONE comment affordance — identical amber comment button whether in the gutter (hover) or
|
|
915
|
+
floating by a selection, so they always match. */
|
|
916
|
+
.cadd, .askbtn{ width:26px; height:26px; padding:0; align-items:center; justify-content:center; box-sizing:border-box;
|
|
917
|
+
border-radius:var(--r-sm); border:1px solid color-mix(in srgb,var(--accent) 32%, var(--glass-brd)); background:var(--raised); color:var(--accent);
|
|
918
|
+
cursor:pointer; box-shadow:var(--shadow-sm); transition:background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
|
|
919
|
+
.cadd:hover, .askbtn:hover{ background:var(--accent-tint); border-color:color-mix(in srgb,var(--accent) 58%, var(--glass-brd)); }
|
|
920
|
+
.cadd .ico, .askbtn .ico{ width:15px; height:15px; }
|
|
921
|
+
.cadd{ position:absolute; display:none; opacity:0; }
|
|
922
|
+
.cadd.show{ display:inline-flex; opacity:1; animation:cfade .14s var(--ease) both; }
|
|
923
|
+
.askbtn{ position:fixed; z-index:var(--z-dropdown); display:inline-flex; }
|
|
924
|
+
@keyframes cfade{ from{ opacity:0; transform:scale(.88); } to{ opacity:1; transform:none; } }
|
|
925
|
+
@media (prefers-reduced-motion:reduce){ .cadd.show{ animation:none; } }
|
|
926
|
+
|
|
927
|
+
/* the comment card — amber fill + border, always visible (inline island or rail column) */
|
|
928
|
+
.cnote{ display:block; width:100%; box-sizing:border-box; text-align:left; cursor:pointer;
|
|
929
|
+
border:1px solid color-mix(in srgb,var(--accent) 26%, var(--glass-brd)); border-radius:var(--r-md);
|
|
930
|
+
background:color-mix(in srgb,var(--accent-tint) 55%, var(--raised)); padding:9px 11px;
|
|
931
|
+
transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
|
|
932
|
+
.cnote + .cnote{ margin-top:8px; }
|
|
933
|
+
.cnote:hover{ border-color:color-mix(in srgb,var(--accent) 46%, var(--glass-brd)); }
|
|
934
|
+
.cnote.active{ border-color:color-mix(in srgb,var(--accent) 60%, var(--glass-brd)); box-shadow:0 0 0 3px var(--accent-tint); }
|
|
935
|
+
.cnote-q{ font-size:11.5px; color:var(--ink-faint); border-left:2px solid var(--accent); padding-left:8px; margin-bottom:7px;
|
|
936
|
+
display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
|
|
937
|
+
.cnote-b{ font-size:13px; line-height:1.5; color:var(--ink); white-space:pre-wrap; }
|
|
938
|
+
.cnote-f{ display:flex; align-items:center; gap:6px; margin-top:8px; font-size:11px; color:var(--ink-faint); }
|
|
939
|
+
.cnote-who{ font-weight:640; color:var(--ink-muted); }
|
|
940
|
+
.cnote-sp{ flex:1 1 auto; }
|
|
941
|
+
.cnote-act{ appearance:none; border:0; background:transparent; color:var(--ink-faint); cursor:pointer; width:22px; height:22px;
|
|
942
|
+
border-radius:5px; display:grid; place-items:center; transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
943
|
+
.cnote-act:hover{ background:var(--accent-tint); color:var(--accent); }
|
|
944
|
+
.cnote-del:hover{ background:color-mix(in srgb,var(--bad) 16%, transparent); color:var(--bad); }
|
|
945
|
+
.cnote-act .ico{ width:14px; height:14px; }
|
|
946
|
+
/* inline edit: the card body becomes a textarea + Save / Cancel */
|
|
947
|
+
.cnote.editing{ cursor:default; }
|
|
948
|
+
.cnote.editing .cnote-act{ display:none; } /* editing already offers Save/Cancel — hide the row's edit/delete */
|
|
949
|
+
.cnote-edit{ width:100%; box-sizing:border-box; resize:vertical; min-height:52px; font:inherit; font-size:13px; line-height:1.5;
|
|
950
|
+
color:var(--ink); background:var(--raised); border:1px solid color-mix(in srgb,var(--accent) 34%, var(--glass-brd)); border-radius:var(--r-sm);
|
|
951
|
+
padding:7px 9px; }
|
|
952
|
+
.cnote-edit:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-tint); }
|
|
953
|
+
.cnote-editrow{ display:flex; justify-content:flex-end; gap:6px; margin-top:7px; }
|
|
954
|
+
.cnote-editrow .cbtn{ appearance:none; cursor:pointer; font:inherit; font-size:12px; font-weight:600; padding:4px 12px; border-radius:var(--r-sm);
|
|
955
|
+
border:1px solid var(--hairline); background:var(--surface); color:var(--ink-muted); transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
956
|
+
.cnote-editrow .cbtn.ghost:hover{ background:var(--hover); color:var(--ink); }
|
|
957
|
+
.cnote-editrow .cbtn.primary{ border-color:transparent; background:var(--accent); color:var(--on-accent); }
|
|
958
|
+
.cnote-editrow .cbtn.primary:hover{ filter:brightness(1.04); }
|
|
959
|
+
/* inline island in the doc flow ('inline' mode): a non-editable amber card under its block.
|
|
960
|
+
white-space:normal because #doc is contenteditable (pre-wrap) and would otherwise render the
|
|
961
|
+
card template's inter-element whitespace as blank lines, inflating the card height. */
|
|
962
|
+
.cnote-island{ margin:6px 0 12px; user-select:none; white-space:normal; }
|
|
963
|
+
.doc > .cnote-island{ animation:cfade .16s var(--ease) both; }
|
|
964
|
+
@media (prefers-reduced-motion:reduce){ .doc > .cnote-island{ animation:none; } }
|
|
965
|
+
|
|
966
|
+
/* the rail comments column ('rail' mode) + its non-sticky hint (the count/nav live in the command bar) */
|
|
967
|
+
.comments{ display:flex; flex-direction:column; gap:8px; padding:0 4px 4px 13px; }
|
|
968
|
+
/* Aligned rail (Google-Docs margin notes): the rail drops its sticky/scroll behaviour and spans
|
|
969
|
+
the full document height so each card can be absolutely placed beside its anchor line. The hint
|
|
970
|
+
box and the cards share ONE horizontal geometry (--crail-l / --crail-r) so the hint lines up with
|
|
971
|
+
the cards. Rail horizontal padding is zeroed here so the hint's content box and the cards'
|
|
972
|
+
containing block (the padding box) have identical edges. Nothing here is sticky — the hint and
|
|
973
|
+
cards scroll together, below the fixed command bar (which reserveRailForControls pads clear of). */
|
|
974
|
+
.rail.cm-aligned{ --crail-l:14px; --crail-r:6px; position:relative; max-height:none; overflow:visible; align-self:stretch;
|
|
975
|
+
padding-left:0; padding-right:0; }
|
|
976
|
+
.rail.cm-aligned .crail-head{ margin:0; padding:0 var(--crail-r) 12px var(--crail-l); border:0; background:none; }
|
|
977
|
+
.comments.aligned{ position:absolute; inset:0; display:block; padding:0; }
|
|
978
|
+
/* width:auto so the absolute left/right define the card box (the base .cnote width:100% would
|
|
979
|
+
otherwise win and overflow the rail). */
|
|
980
|
+
.comments.aligned .cnote{ position:absolute; left:var(--crail-l); right:var(--crail-r); width:auto; margin:0;
|
|
981
|
+
overflow-wrap:anywhere; word-break:break-word; transition:top var(--dur) var(--ease); }
|
|
982
|
+
.comments.aligned .cnote .cnote-b{ overflow-wrap:anywhere; word-break:break-word; }
|
|
983
|
+
@media (prefers-reduced-motion:reduce){ .comments.aligned .cnote{ transition:none; } }
|
|
984
|
+
.crail-head{ display:block; }
|
|
985
|
+
/* the comment navigator in the canvas command bar (#docdiff): glyph + open count + prev/next. Kept
|
|
986
|
+
INLINE in the frosted bar — no box of its own (a box-in-box looked heavy). */
|
|
987
|
+
.cnavcmd{ display:inline-flex; align-items:center; gap:1px; }
|
|
988
|
+
.cnavcmd-count{ display:inline-flex; align-items:center; gap:5px; font-size:12.5px; font-weight:640; color:var(--ink); padding:0 5px; white-space:nowrap; }
|
|
989
|
+
.cnavcmd-count .ico{ width:14px; height:14px; color:var(--accent); }
|
|
990
|
+
.cnavcmd-step{ appearance:none; border:0; background:transparent; color:var(--ink-muted); cursor:pointer; width:22px; height:24px;
|
|
991
|
+
border-radius:var(--r-xs); display:inline-flex; align-items:center; justify-content:center; font-size:15px; line-height:1;
|
|
992
|
+
transition:background var(--dur) var(--ease), color var(--dur) var(--ease); }
|
|
993
|
+
.cnavcmd-step:hover{ background:var(--hover); color:var(--ink); }
|
|
994
|
+
/* the single global hint — prominent (not fine print) with a one-click copy of the command; sized
|
|
995
|
+
to match the comment cards (same --crail-l / --crail-r via the header padding). */
|
|
996
|
+
.crail-hint{ display:flex; align-items:flex-start; gap:8px; margin:0; font-size:12px; line-height:1.5; color:var(--ink-muted);
|
|
997
|
+
background:var(--accent-tint); border:1px solid color-mix(in srgb,var(--accent) 22%, var(--glass-brd)); border-radius:var(--r-sm); padding:8px 10px; }
|
|
998
|
+
.crail-hint-t{ flex:1 1 auto; min-width:0; }
|
|
999
|
+
.crail-hint code{ font-family:var(--mono); font-size:.9em; font-weight:600; color:var(--ink); background:color-mix(in srgb,var(--accent) 16%, transparent); padding:.1em .34em; border-radius:5px; white-space:nowrap; }
|
|
1000
|
+
.crail-copy{ appearance:none; border:0; background:transparent; color:var(--accent); cursor:pointer; width:22px; height:22px; flex:0 0 auto;
|
|
1001
|
+
border-radius:5px; display:grid; place-items:center; transition:background var(--dur) var(--ease); }
|
|
1002
|
+
.crail-copy:hover{ background:color-mix(in srgb,var(--accent) 16%, transparent); }
|
|
1003
|
+
.crail-copy .ico{ width:14px; height:14px; }
|
|
1004
|
+
/* inline mode: the hint rides at the top of the document as its own island */
|
|
1005
|
+
.cnote-hint-island{ margin:0 0 14px; }
|
|
1006
|
+
|
|
1007
|
+
/* transient "agent is addressing your comments" toast */
|
|
1008
|
+
.caddr{ position:fixed; z-index:70; left:50%; bottom:18px; transform:translateX(-50%); display:flex; align-items:center; gap:9px;
|
|
1009
|
+
padding:9px 14px; border-radius:var(--pill); background:var(--raised); border:1px solid color-mix(in srgb,var(--accent) 35%, var(--glass-brd));
|
|
1010
|
+
box-shadow:var(--shadow-lg); color:var(--ink); font-size:12.5px; font-weight:560; animation:reveal .2s var(--ease) both; }
|
|
1011
|
+
.caddr .spin{ width:12px; height:12px; border-radius:50%; border:2px solid var(--accent-tint); border-top-color:var(--accent); animation:cspin .7s linear infinite; }
|
|
1012
|
+
@keyframes cspin{ to{ transform:rotate(360deg); } }
|
|
1013
|
+
@media (prefers-reduced-motion: reduce){ .caddr .spin{ animation:none; } }
|
|
1014
|
+
|
|
1015
|
+
/* stale-server (version-skew) banner: new UI served by an out-of-date `serve` process */
|
|
1016
|
+
.stalebar{ position:fixed; z-index:80; left:50%; bottom:18px; transform:translateX(-50%); max-width:min(560px,92vw);
|
|
1017
|
+
display:flex; align-items:center; gap:12px; padding:10px 12px 10px 16px; border-radius:var(--r-lg);
|
|
1018
|
+
background:var(--raised); border:1px solid color-mix(in srgb,var(--warn) 45%, var(--glass-brd));
|
|
1019
|
+
box-shadow:var(--shadow-lg); color:var(--ink); font-size:13px; line-height:1.45; animation:reveal .2s var(--ease) both; }
|
|
1020
|
+
.stalebar code{ font-family:var(--mono); font-size:.86em; background:rgba(128,128,140,.16); padding:.1em .34em; border-radius:5px; }
|
|
1021
|
+
.stalebar .x{ appearance:none; border:0; background:transparent; color:var(--ink-muted); cursor:pointer; padding:4px; flex:none; border-radius:var(--r-sm); display:inline-flex; }
|
|
1022
|
+
.stalebar .x:hover{ background:rgba(128,128,140,.12); color:var(--ink); }
|
|
1023
|
+
.stalebar .x .ico{ width:16px; height:16px; }
|
|
1024
|
+
|
|
1025
|
+
/* the composer popover (position:fixed → never clipped). The selection button (.askbtn) shares
|
|
1026
|
+
the amber comment-button style above so it matches the gutter handle. */
|
|
1027
|
+
.askpop{ position:fixed; z-index:var(--z-dropdown); width:min(340px,86vw); background:var(--raised); border:1px solid var(--glass-brd);
|
|
1028
|
+
border-radius:var(--r-lg); box-shadow:var(--shadow-lg); padding:12px; animation:reveal .14s var(--ease) both; }
|
|
1029
|
+
/* Slash-command menu (WYSIWYG): "/" at the start of an empty block opens this block-inserter. */
|
|
1030
|
+
.slashmenu{ position:fixed; z-index:var(--z-dropdown); display:none; min-width:200px; max-height:min(320px,60vh); overflow:auto;
|
|
1031
|
+
background:var(--raised); border:1px solid var(--glass-brd); border-radius:var(--r-lg); box-shadow:var(--shadow-lg);
|
|
1032
|
+
padding:6px; animation:reveal .12s var(--ease) both; }
|
|
1033
|
+
.slashmenu.show{ display:block; }
|
|
1034
|
+
.slashmenu .slashitem{ display:block; width:100%; text-align:left; padding:7px 10px; border:0; border-radius:var(--r-sm);
|
|
1035
|
+
background:transparent; color:var(--ink); font:inherit; font-size:13px; cursor:pointer; }
|
|
1036
|
+
.slashmenu .slashitem:hover, .slashmenu .slashitem.active{ background:var(--accent-tint); color:var(--ink); }
|
|
1037
|
+
/* Selection formatting bubble (WYSIWYG edit mode): bold / italic / link / H2 + Comment. Fixed →
|
|
1038
|
+
never clipped. Carries the Comment button so the standalone .askbtn never doubles up in edit mode. */
|
|
1039
|
+
.bubblebar{ position:fixed; z-index:var(--z-dropdown); display:none; align-items:center; gap:2px; padding:4px;
|
|
1040
|
+
background:var(--raised); border:1px solid var(--glass-brd); border-radius:var(--r-md); box-shadow:var(--shadow-lg);
|
|
1041
|
+
animation:reveal .12s var(--ease) both; }
|
|
1042
|
+
.bubblebar.show{ display:inline-flex; }
|
|
1043
|
+
.bubblebar .bbtn{ appearance:none; border:0; background:transparent; cursor:pointer; color:var(--ink-muted);
|
|
1044
|
+
width:28px; height:28px; padding:0; border-radius:var(--r-sm); display:grid; place-items:center; }
|
|
1045
|
+
.bubblebar .bbtn:hover{ background:var(--hover); color:var(--ink); }
|
|
1046
|
+
.bubblebar .bbtn.on{ background:var(--accent-tint); color:var(--accent); }
|
|
1047
|
+
.bubblebar .bbtn .ico{ width:16px; height:16px; }
|
|
1048
|
+
.bubblebar .bbsep{ width:1px; align-self:stretch; margin:3px 3px; background:var(--hairline); }
|
|
1049
|
+
/* In-table toolbar (WYSIWYG edit mode): add/remove rows & columns, drop the table. */
|
|
1050
|
+
.tabletools{ position:fixed; z-index:var(--z-dropdown); display:none; align-items:center; gap:2px; padding:4px;
|
|
1051
|
+
background:var(--raised); border:1px solid var(--glass-brd); border-radius:var(--r-md); box-shadow:var(--shadow-lg);
|
|
1052
|
+
animation:reveal .12s var(--ease) both; }
|
|
1053
|
+
.tabletools.show{ display:inline-flex; }
|
|
1054
|
+
.tabletools .ttbtn{ appearance:none; border:0; background:transparent; cursor:pointer; color:var(--ink-muted);
|
|
1055
|
+
height:28px; padding:0 8px; border-radius:var(--r-sm); font:inherit; font-size:12px; font-weight:560; display:inline-flex; align-items:center; gap:4px; }
|
|
1056
|
+
.tabletools .ttbtn:hover{ background:var(--hover); color:var(--ink); }
|
|
1057
|
+
.tabletools .ttbtn.danger{ width:30px; padding:0; justify-content:center; }
|
|
1058
|
+
.tabletools .ttbtn.danger:hover{ background:var(--bad-tint); color:var(--bad); }
|
|
1059
|
+
.tabletools .ttbtn .ico{ width:15px; height:15px; }
|
|
1060
|
+
.tabletools .ttsep{ width:1px; align-self:stretch; margin:3px 3px; background:var(--hairline); }
|
|
1061
|
+
/* the composer header — states plainly that this comment is a request for the agent */
|
|
1062
|
+
.askpop .askhd{ display:flex; align-items:center; gap:7px; font-size:12.5px; font-weight:640; color:var(--ink); margin-bottom:9px; }
|
|
1063
|
+
.askpop .askhd .ico{ width:15px; height:15px; color:var(--accent); flex:0 0 auto; }
|
|
1064
|
+
.askpop .aq{ font-size:11.5px; color:var(--ink-faint); border-left:2px solid var(--accent); padding-left:8px; margin-bottom:9px;
|
|
1065
|
+
display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
|
|
1066
|
+
.askpop textarea{ width:100%; box-sizing:border-box; resize:vertical; min-height:58px; font:inherit; font-size:13px;
|
|
1067
|
+
color:var(--ink); background:var(--surface); border:1px solid var(--hairline); border-radius:var(--r-sm); padding:8px 10px; outline:none; }
|
|
1068
|
+
.askpop textarea:focus{ border-color:color-mix(in srgb,var(--accent) 50%, var(--hairline)); }
|
|
1069
|
+
.askpop .arow{ display:flex; align-items:center; gap:8px; margin-top:9px; }
|
|
1070
|
+
.askpop .arow .sp{ flex:1 1 auto; }
|
|
1071
|
+
.askpop .mic,.askpop .send,.askpop .ghost{ appearance:none; border:1px solid var(--glass-brd); background:rgba(120,124,132,.06);
|
|
1072
|
+
color:var(--ink); font:inherit; font-size:12.5px; font-weight:560; border-radius:var(--r-sm); cursor:pointer;
|
|
1073
|
+
display:inline-flex; align-items:center; gap:6px; height:30px; padding:0 12px; }
|
|
1074
|
+
.askpop .send{ background:var(--accent-strong); color:#fff; border-color:transparent; }
|
|
1075
|
+
.askpop .send:hover{ filter:brightness(1.06); }
|
|
1076
|
+
.askpop .ghost{ background:transparent; color:var(--ink-muted); }
|
|
1077
|
+
.askpop .mic{ width:34px; padding:0; justify-content:center; }
|
|
1078
|
+
.askpop .mic.rec{ color:var(--bad); border-color:color-mix(in srgb,var(--bad) 50%, var(--glass-brd)); animation:pulse 1s var(--ease) infinite; }
|
|
1079
|
+
.askpop .mic .ico,.askpop .send .ico{ width:15px; height:15px; }
|
|
1080
|
+
.askhint{ font-size:11px; color:var(--ink-faint); margin-top:8px; line-height:1.5; }
|
|
1081
|
+
.askhint code{ font-family:var(--mono); font-size:.9em; background:rgba(128,128,140,.16); padding:.1em .32em; border-radius:5px; }
|
|
1082
|
+
@media (max-width:1080px){ .casebody{ grid-template-columns:minmax(0,1fr); } .rail{ display:none; } .cadd{ display:none!important; } }
|
|
1083
|
+
|
|
1084
|
+
/* mobile section spine — when the rail (ToC) is hidden, a floating "Sections"
|
|
1085
|
+
control reopens the record's outline as a sheet, so long records stay navigable. */
|
|
1086
|
+
.secfab{ position:fixed; right:16px; bottom:calc(16px + env(safe-area-inset-bottom,0)); z-index:var(--z-sticky);
|
|
1087
|
+
display:none; align-items:center; gap:8px; height:44px; padding:0 16px; border:0; cursor:pointer;
|
|
1088
|
+
font:inherit; font-size:13px; font-weight:600; color:var(--on-accent); background:var(--btn-bg);
|
|
1089
|
+
border-radius:var(--pill); box-shadow:var(--shadow-md), var(--glow); }
|
|
1090
|
+
.secfab .ico{ width:16px; height:16px; }
|
|
1091
|
+
.secsheet{ position:fixed; right:16px; bottom:calc(70px + env(safe-area-inset-bottom,0)); z-index:var(--z-dropdown);
|
|
1092
|
+
display:none; flex-direction:column; gap:1px; width:min(74vw,320px); max-height:60vh; overflow:auto;
|
|
1093
|
+
padding:8px; border-radius:var(--r-lg); background:var(--glass); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur);
|
|
1094
|
+
box-shadow:var(--shadow-lg); animation:reveal .14s var(--ease) both; }
|
|
1095
|
+
.secsheet a{ display:block; padding:10px 12px; border-radius:var(--r-sm); text-decoration:none; color:var(--ink-muted); font-size:14px; }
|
|
1096
|
+
.secsheet a.lvl3{ padding-left:26px; font-size:13px; color:var(--ink-faint); }
|
|
1097
|
+
.secsheet a:hover,.secsheet a:focus-visible{ background:var(--hover); color:var(--ink); }
|
|
1098
|
+
@media (max-width:1080px){
|
|
1099
|
+
body.has-sections .secfab{ display:inline-flex; }
|
|
1100
|
+
body.has-sections.sec-open .secsheet{ display:flex; }
|
|
1101
|
+
}
|
|
1102
|
+
@media (min-width:1081px){ .secfab,.secsheet{ display:none !important; } }
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
/* Diff mode is the LIVE EDITOR with change decorations layered on — the SAME document, typography,
|
|
1106
|
+
layout, spacing and functionality (editing, checkboxes, comments, ToC), just washed with colour.
|
|
1107
|
+
ADDED blocks get a green highlighter wash; MODIFIED blocks the same green with their previous form
|
|
1108
|
+
shown above; REMOVED blocks appear as read-only red `.diffdel` islands inline. Crucially, the
|
|
1109
|
+
decorations use the SAME box model as `.blk` (margin/padding) and share the document's vertical
|
|
1110
|
+
rhythm rules (`.doc > :is(.blk,.diffdel) …` above, keyed by `t-<type>`), so spacing between
|
|
1111
|
+
headers/paragraphs/sections is identical to the reading view. No borders; a +/− gutter sign backs
|
|
1112
|
+
the colour (a11y); removed text is dimmed so the surviving version reads as the current one. */
|
|
1113
|
+
/* Read-only records render their Markdown directly into #doc — the top-level elements
|
|
1114
|
+
are `.md-p` / `.md-h*`, not `.blk` — so the diff wash must also target #doc's direct children,
|
|
1115
|
+
or a brand-new report would carry the `.diff-add` class with no visible highlight. */
|
|
1116
|
+
.blk.diff-add, .blk.diff-mod, #doc > .diff-add, #doc > .diff-mod{ position:relative; background:var(--ok-tint); }
|
|
1117
|
+
.diffdel{ position:relative; margin:0 -6px; padding:1px 6px; border-radius:var(--r-sm); background:var(--bad-tint); }
|
|
1118
|
+
.diffdel > *{ opacity:.7; }
|
|
1119
|
+
.diffdel > :is(h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote,pre,table,hr):first-child{ margin-top:0; }
|
|
1120
|
+
.diffdel > :is(h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote,pre,table,hr):last-child{ margin-bottom:0; }
|
|
1121
|
+
.diffdel .dempty{ color:var(--ink-faint); font-style:italic; }
|
|
1122
|
+
.blk.diff-add::before, .blk.diff-mod::before, #doc > .diff-add::before, #doc > .diff-mod::before, .diffdel::before{ position:absolute; left:calc(-1 * var(--s5)); font:700 12px/1.55 var(--mono); }
|
|
1123
|
+
.blk.diff-add::before, .blk.diff-mod::before, #doc > .diff-add::before, #doc > .diff-mod::before{ content:"+"; color:var(--ok); top:1px; }
|
|
1124
|
+
.diffdel::before{ content:"\2212"; color:var(--bad); top:1px; }
|
|
1125
|
+
.diffdel.diffanim{ animation:reveal .32s var(--ease) both; } /* only on the Document→Diff switch; edit refreshes don't re-animate */
|
|
1126
|
+
@media (prefers-reduced-motion:reduce){ .diffdel.diffanim{ animation:none; } }
|
|
1127
|
+
/* WYSIWYG (Tiptap) diff: ProseMirror renders node/widget decorations INSIDE `#doc .ProseMirror`,
|
|
1128
|
+
so the top-level blocks are `.ProseMirror > .diff-add|.diff-mod` and removed-block islands are
|
|
1129
|
+
`.ProseMirror > .diffdel-wrap > .diffdel` — mirror the reading-view wash + − gutter for them. */
|
|
1130
|
+
#doc .ProseMirror > .diff-add, #doc .ProseMirror > .diff-mod{ position:relative; background:var(--ok-tint); }
|
|
1131
|
+
#doc .ProseMirror > .diff-add::before, #doc .ProseMirror > .diff-mod::before{ content:"+"; color:var(--ok); position:absolute; left:calc(-1 * var(--s5)); top:1px; font:700 12px/1.55 var(--mono); }
|
|
1132
|
+
#doc .ProseMirror > .diffdel-wrap{ margin:0; }
|
|
1133
|
+
/* The Tiptap surface is a child contenteditable of `.doc`; the global :focus-visible outline
|
|
1134
|
+
would otherwise draw a 2px frame around the WHOLE record on focus. Suppress it — the caret and
|
|
1135
|
+
the amber active line (below) are the "you are here" cue, not a box around the file. */
|
|
1136
|
+
#doc .ProseMirror{ outline:none; }
|
|
1137
|
+
#doc .ProseMirror:focus, #doc .ProseMirror:focus-visible{ outline:none; }
|
|
1138
|
+
/* Active line: the block holding the caret gets a warm amber wash while the editor is focused
|
|
1139
|
+
(see active-line.mjs). Bleeds into the same -6px gutter the reading blocks use so it reads as a
|
|
1140
|
+
full-width line, and clears the instant focus leaves. */
|
|
1141
|
+
#doc .ProseMirror .pm-activeline{ background:var(--warn-tint); border-radius:var(--r-sm); box-shadow:0 0 0 6px var(--warn-tint); }
|
|
1142
|
+
/* Per-block placeholder (Tiptap Placeholder extension): the empty block with the caret shows its
|
|
1143
|
+
data-placeholder hint (advertising "/" for blocks and "@" to ask the agent). Shown only on the
|
|
1144
|
+
current empty block (showOnlyCurrent), so it never litters every blank line. */
|
|
1145
|
+
#doc .ProseMirror .is-empty::before{ content:attr(data-placeholder); float:left; height:0; pointer-events:none;
|
|
1146
|
+
color:var(--ink-faint); opacity:.7; }
|
|
1147
|
+
/* Live-editor tables (Tiptap TableKit). Unlike the reading renderer's `.md-tbl`, the editor emits a
|
|
1148
|
+
`.tableWrapper > table > tbody > tr > th|td` shape (no <thead> — the header row is the first <tr>
|
|
1149
|
+
of <th> cells) plus a <colgroup> for resizable columns. Give it the same visual language as the
|
|
1150
|
+
reading view — collapsed grid, a shaded header row, hairline cell borders — so it reads as a table
|
|
1151
|
+
while editing. Cells are `position:relative` so the resize handle and selection overlay anchor to
|
|
1152
|
+
them. */
|
|
1153
|
+
#doc .ProseMirror .tableWrapper{ overflow-x:auto; overscroll-behavior-x:contain; max-width:100%; margin:.2em 0; }
|
|
1154
|
+
#doc .ProseMirror table{ border-collapse:collapse; table-layout:fixed; width:100%; font-size:14.5px; margin:0; overflow:hidden; }
|
|
1155
|
+
#doc .ProseMirror table td, #doc .ProseMirror table th{ position:relative; vertical-align:top; text-align:left; box-sizing:border-box;
|
|
1156
|
+
min-width:var(--tbl-mincol); padding:7px 12px; border:1px solid var(--hairline); }
|
|
1157
|
+
#doc .ProseMirror table th{ background:var(--hover); font-weight:660; color:var(--ink);
|
|
1158
|
+
border-bottom:1.5px solid color-mix(in srgb, var(--ink-faint) 55%, transparent); }
|
|
1159
|
+
#doc .ProseMirror table td > p, #doc .ProseMirror table th > p{ margin:0; }
|
|
1160
|
+
/* Cell selection (the CellSelection plugin marks selected cells with `.selectedCell`): a soft accent
|
|
1161
|
+
wash drawn as an overlay so it never shifts text. */
|
|
1162
|
+
#doc .ProseMirror table .selectedCell::after{ content:""; position:absolute; inset:0; pointer-events:none; z-index:2;
|
|
1163
|
+
background:color-mix(in srgb, var(--accent) 16%, transparent); }
|
|
1164
|
+
/* Column resize handle + cursor (resizable:true). */
|
|
1165
|
+
#doc .ProseMirror table .column-resize-handle{ position:absolute; right:-2px; top:0; bottom:0; width:4px; z-index:3;
|
|
1166
|
+
background:var(--accent); pointer-events:none; }
|
|
1167
|
+
#doc .ProseMirror.resize-cursor{ cursor:col-resize; }
|
|
1168
|
+
@media (max-width:720px){ #doc .ProseMirror > .diff-add::before, #doc .ProseMirror > .diff-mod::before{ display:none; } }
|
|
1169
|
+
@media (max-width:720px){ .blk.diff-add::before, .blk.diff-mod::before, #doc > .diff-add::before, #doc > .diff-mod::before, .diffdel::before{ display:none; } }
|
|
1170
|
+
/* Per-line diff: a one-line change in a list/table tints only the changed item/row (green add /
|
|
1171
|
+
modified, red + struck for removed), never the whole block. Colour is paired with a strike on
|
|
1172
|
+
removed rows so it doesn't rest on hue alone. */
|
|
1173
|
+
.md-list > li.diff-add, .md-list > li.diff-mod{ background:var(--ok-tint); border-radius:var(--r-xs); }
|
|
1174
|
+
.md-list > li.d-lidel{ list-style:none; background:var(--bad-tint); border-radius:var(--r-xs); opacity:.72; text-decoration:line-through; text-decoration-color:color-mix(in srgb, var(--bad) 55%, transparent); }
|
|
1175
|
+
.md-tbl tbody tr.diff-add > td, .md-tbl tbody tr.diff-mod > td{ background:var(--ok-tint); }
|
|
1176
|
+
.md-tbl tbody tr.d-trdel > td{ background:var(--bad-tint); opacity:.72; text-decoration:line-through; text-decoration-color:color-mix(in srgb, var(--bad) 55%, transparent); font-family:var(--mono); font-size:12.5px; }
|
|
1177
|
+
.md-list > li.diffanim, .md-tbl tbody tr.diffanim{ animation:reveal .3s var(--ease) both; }
|
|
1178
|
+
@media (prefers-reduced-motion:reduce){ .md-list > li.diffanim, .md-tbl tbody tr.diffanim{ animation:none; } }
|
|
1179
|
+
|
|
1180
|
+
/* queue */
|
|
1181
|
+
.qwrap{ flex:1 1 auto; display:flex; justify-content:center; }
|
|
1182
|
+
.queue{ width:100%; max-width:760px; padding:var(--s7) var(--s5) 20vh; animation:reveal .42s var(--ease) both; }
|
|
1183
|
+
.queue h1{ font-size:1.5rem; font-weight:640; letter-spacing:-.015em; margin:0 0 4px; }
|
|
1184
|
+
.queue .sub{ color:var(--ink-muted); margin:0 0 var(--s5); }
|
|
1185
|
+
.qrow{ display:flex; align-items:center; gap:var(--s4); width:100%; text-align:left; cursor:pointer;
|
|
1186
|
+
padding:14px 16px; border:1px solid var(--hairline); border-radius:var(--r-lg); background:var(--surface);
|
|
1187
|
+
color:inherit; font:inherit; margin-bottom:10px; transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
|
|
1188
|
+
.qrow:hover{ border-color:color-mix(in srgb,var(--accent) 40%, var(--hairline)); box-shadow:var(--glow); transform:translateY(-1px); }
|
|
1189
|
+
.qrow .qmain{ min-width:0; flex:1 1 auto; display:flex; flex-direction:column; gap:2px; }
|
|
1190
|
+
.qrow .qt{ display:block; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
1191
|
+
.qrow .qr{ display:block; font-size:13px; color:var(--ink-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
|
1192
|
+
.qrow .go{ width:18px; height:18px; color:var(--ink-faint); flex:none; transition:transform var(--dur) var(--ease); }
|
|
1193
|
+
.qrow:hover .go{ transform:translateX(2px); color:var(--accent); }
|
|
1194
|
+
.qrow .qtime{ font-size:12.5px; color:var(--ink-faint); flex:none; white-space:nowrap; font-variant-numeric:tabular-nums; }
|
|
1195
|
+
.queue .qsec{ font-size:12.5px; font-weight:560; color:var(--ink-muted); letter-spacing:.01em; margin:var(--s6) 0 12px; }
|
|
1196
|
+
.queue h1 + .sub + .qsec{ margin-top:var(--s5); }
|
|
1197
|
+
/* settings */
|
|
1198
|
+
.settings-wrap{ flex:1 1 auto; display:flex; justify-content:center; overflow:auto; }
|
|
1199
|
+
.settings-page{ width:100%; max-width:780px; padding:var(--s7) var(--s5) 18vh; animation:reveal .35s var(--ease) both; }
|
|
1200
|
+
.settings-head{ margin-bottom:var(--s6); }
|
|
1201
|
+
.settings-head h1{ margin:0 0 5px; font-size:1.5rem; font-weight:640; letter-spacing:-.015em; }
|
|
1202
|
+
.settings-head p,.settings-copy p,.settings-note{ margin:0; color:var(--ink-muted); }
|
|
1203
|
+
.settings-section{ padding:var(--s5) 0; border-top:1px solid var(--hairline); }
|
|
1204
|
+
.settings-copy{ margin-bottom:var(--s4); }
|
|
1205
|
+
.settings-copy h2{ margin:0 0 4px; font-size:14px; font-weight:650; }
|
|
1206
|
+
.settings-copy p,.settings-note{ font-size:12.5px; line-height:1.5; }
|
|
1207
|
+
.theme-options{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
|
|
1208
|
+
.theme-option{ appearance:none; min-width:0; display:flex; align-items:center; gap:11px; padding:13px; text-align:left; color:var(--ink);
|
|
1209
|
+
font:inherit; border:1px solid var(--hairline); border-radius:var(--r-md); background:var(--surface); cursor:pointer;
|
|
1210
|
+
transition:border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
|
|
1211
|
+
.theme-option:hover{ border-color:color-mix(in srgb,var(--accent) 38%,var(--hairline)); }
|
|
1212
|
+
.theme-option.selected{ border-color:color-mix(in srgb,var(--accent) 62%,var(--hairline)); background:var(--accent-tint); box-shadow:0 0 0 1px color-mix(in srgb,var(--accent) 16%,transparent); }
|
|
1213
|
+
.theme-option:focus-visible,.settings-toggle input:focus-visible + i{ outline:2px solid var(--ring); outline-offset:2px; }
|
|
1214
|
+
.theme-icon{ width:32px; height:32px; flex:none; display:grid; place-items:center; border-radius:9px; color:var(--ink-muted); background:var(--hover); }
|
|
1215
|
+
.theme-icon .ico{ width:18px; height:18px; }
|
|
1216
|
+
.theme-option span:last-child{ min-width:0; display:flex; flex-direction:column; gap:2px; }
|
|
1217
|
+
.theme-option strong,.settings-toggle strong{ font-size:13px; font-weight:620; }
|
|
1218
|
+
.theme-option small,.settings-toggle small{ color:var(--ink-muted); font-size:11.5px; line-height:1.4; }
|
|
1219
|
+
.settings-toggle{ display:flex; align-items:flex-start; gap:var(--s5); padding:15px 16px; border:1px solid var(--hairline); border-radius:var(--r-md); background:var(--surface); cursor:pointer; }
|
|
1220
|
+
.settings-toggle > span{ min-width:0; flex:1; display:flex; flex-direction:column; gap:4px; }
|
|
1221
|
+
.settings-toggle input{ position:absolute; opacity:0; pointer-events:none; }
|
|
1222
|
+
.settings-toggle i{ position:relative; flex:none; width:38px; height:22px; margin-top:1px; border-radius:var(--pill); background:var(--sb-thumb-h); transition:background var(--dur) var(--ease); }
|
|
1223
|
+
.settings-toggle i::after{ content:""; position:absolute; width:16px; height:16px; left:3px; top:3px; border-radius:50%; background:white; box-shadow:0 1px 4px rgba(0,0,0,.25); transition:transform var(--dur) var(--ease); }
|
|
1224
|
+
.settings-toggle input:checked + i{ background:var(--accent); }
|
|
1225
|
+
.settings-toggle input:checked + i::after{ transform:translateX(16px); }
|
|
1226
|
+
.settings-toggle input:disabled + i{ opacity:.55; }
|
|
1227
|
+
.settings-note{ margin-top:9px; padding-left:2px; }
|
|
1228
|
+
/* Explorer git-change badge (files) — letter + tint, never colour alone; centred in its column. */
|
|
1229
|
+
.gitb{ flex:none; font:600 10px/1 var(--mono); width:16px; height:16px; display:inline-grid; place-items:center; border-radius:5px; }
|
|
1230
|
+
.gitb.mod{ color:var(--warn); background:color-mix(in srgb,var(--warn) 18%, transparent); }
|
|
1231
|
+
.gitb.add{ color:var(--ok); background:color-mix(in srgb,var(--ok) 18%, transparent); }
|
|
1232
|
+
.gitb.del{ color:var(--bad); background:color-mix(in srgb,var(--bad) 18%, transparent); }
|
|
1233
|
+
|
|
1234
|
+
/* empty states */
|
|
1235
|
+
.empty{ margin:auto; text-align:center; max-width:420px; padding:var(--s7) var(--s5); }
|
|
1236
|
+
.empty h2{ font-size:1.5rem; font-weight:600; letter-spacing:-.01em; margin:0 0 8px; }
|
|
1237
|
+
.empty p{ color:var(--ink-muted); margin:0; }
|
|
1238
|
+
.empty code{ font-family:var(--mono); font-size:.85em; background:rgba(128,128,140,.14); padding:.12em .4em; border-radius:5px; }
|
|
1239
|
+
/* branded home surface (empty state) — the ember mark + injected product name as the hero.
|
|
1240
|
+
The tab-bar wordmark is suppressed while this shows, so the brand is never doubled. */
|
|
1241
|
+
.hero{ margin:auto; display:flex; flex-direction:column; align-items:center; text-align:center; max-width:460px; padding:var(--s7) var(--s5);
|
|
1242
|
+
animation:reveal .5s var(--ease) both; }
|
|
1243
|
+
.hero-mark{ width:52px; height:52px; border-radius:14px; flex:none; margin:0 0 18px;
|
|
1244
|
+
background:linear-gradient(140deg,#f4a566,#c85a12); box-shadow:var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.4); display:grid; place-items:center; }
|
|
1245
|
+
.hero-mark i{ width:21px; height:21px; border:2.5px solid rgba(255,255,255,.92); border-radius:6px; }
|
|
1246
|
+
.hero-name{ font-size:1.9rem; font-weight:640; letter-spacing:-.02em; margin:0 0 6px; }
|
|
1247
|
+
.hero-sub{ font-size:1.05rem; color:var(--ink-muted); margin:0 0 16px; }
|
|
1248
|
+
.hero-actions{ display:flex; flex-wrap:wrap; gap:var(--s2); justify-content:center; margin:0 0 16px; }
|
|
1249
|
+
.hero-actions .tbtn code{ font-family:var(--mono); font-size:.92em; }
|
|
1250
|
+
.hero-hint{ font-size:.9rem; color:var(--ink-faint); margin:0; }
|
|
1251
|
+
.hero-hint code{ font-family:var(--mono); font-size:.9em; background:rgba(128,128,140,.14); padding:.12em .4em; border-radius:5px; }
|
|
1252
|
+
@media (prefers-reduced-motion:reduce){ .hero{ animation:none; } }
|
|
1253
|
+
|
|
1254
|
+
/* scrim for mobile drawer */
|
|
1255
|
+
.scrim{ display:none; position:fixed; inset:0; z-index:calc(var(--z-sticky) - 1); background:rgba(6,7,10,.5); backdrop-filter:blur(2px); }
|
|
1256
|
+
|
|
1257
|
+
/* responsive: collapse the sidebar to a slide-over */
|
|
1258
|
+
@media (max-width:820px){
|
|
1259
|
+
#app{ grid-template-columns:1fr; grid-template-areas:"stage"; }
|
|
1260
|
+
.stage{ padding:10px 10px 12px; }
|
|
1261
|
+
.container{ max-width:100%; }
|
|
1262
|
+
.sidebar{ position:fixed; z-index:var(--z-modal); top:0; bottom:0; left:0; width:min(84vw,var(--sb));
|
|
1263
|
+
padding:10px 12px; background:var(--glass); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur);
|
|
1264
|
+
box-shadow:var(--shadow); transform:translateX(-102%); transition:transform var(--dur) var(--ease); }
|
|
1265
|
+
body.nav-open .sidebar{ transform:none; }
|
|
1266
|
+
body.nav-open .scrim{ display:block; }
|
|
1267
|
+
.sb-resize{ display:none; }
|
|
1268
|
+
.iconbtn{ display:inline-flex; }
|
|
1269
|
+
.canvas,.queue{ padding-left:var(--s4); padding-right:var(--s4); }
|
|
1270
|
+
.settings-page{ padding-left:var(--s4); padding-right:var(--s4); }
|
|
1271
|
+
.feedback-page{ padding-left:var(--s4); padding-right:var(--s4); }
|
|
1272
|
+
.theme-options{ grid-template-columns:1fr; }
|
|
1273
|
+
.feedback-type-options{ grid-template-columns:1fr; }
|
|
1274
|
+
.tab{ min-width:112px; }
|
|
1275
|
+
.tab.active{ min-width:148px; }
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
/* touch devices: give the small chrome controls a comfortable ≥40px tap target
|
|
1279
|
+
without inflating them on the desktop pointer layout. */
|
|
1280
|
+
@media (pointer:coarse){
|
|
1281
|
+
.iconbtn{ min-width:44px; min-height:44px; }
|
|
1282
|
+
.tab-close{ width:40px; height:40px; opacity:1; }
|
|
1283
|
+
.viewtoggle{ min-height:40px; min-width:40px; }
|
|
1284
|
+
.tbtn{ height:40px; }
|
|
1285
|
+
.search input{ height:44px; }
|
|
1286
|
+
.projsel{ min-height:40px; }
|
|
1287
|
+
.navq{ min-height:44px; }
|
|
1288
|
+
.gicon{ min-width:40px; min-height:40px; }
|
|
1289
|
+
.trow{ min-height:38px; padding-top:6px; padding-bottom:6px; }
|
|
1290
|
+
.menu button{ min-height:44px; }
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
@media (prefers-reduced-motion:reduce){
|
|
1294
|
+
*{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
|
|
1295
|
+
.glayer,.grain{ transform:none !important; animation:none !important; }
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
/* ---- feedback tab + toast ---- */
|
|
1299
|
+
.feedback-wrap{ flex:1 1 auto; display:flex; justify-content:center; overflow:auto; }
|
|
1300
|
+
.feedback-page{ width:100%; max-width:780px; padding:var(--s7) var(--s5) 16vh; animation:reveal .35s var(--ease) both; }
|
|
1301
|
+
.feedback-head{ margin-bottom:var(--s6); }
|
|
1302
|
+
.feedback-head h1{ margin:0 0 5px; font-size:1.5rem; font-weight:640; letter-spacing:-.015em; }
|
|
1303
|
+
.feedback-head p{ max-width:62ch; margin:0; color:var(--ink-muted); line-height:1.5; text-wrap:pretty; }
|
|
1304
|
+
.feedback-form{ padding-top:var(--s5); border-top:1px solid var(--hairline); }
|
|
1305
|
+
.feedback-type{ margin:0 0 20px; padding:0; border:0; }
|
|
1306
|
+
.feedback-type legend,.feedback-sentiment legend{ margin:0 0 8px; color:var(--ink); font-size:13px; font-weight:600; }
|
|
1307
|
+
.feedback-type-options{ display:grid; grid-template-columns:repeat(3,1fr); gap:9px; }
|
|
1308
|
+
.feedback-type-option{ appearance:none; min-width:0; display:flex; flex-direction:column; gap:3px; padding:12px 13px; color:var(--ink); text-align:left; font:inherit; border:1px solid var(--hairline); border-radius:var(--r-md); background:var(--surface); cursor:pointer; transition:border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
|
|
1309
|
+
.feedback-type-option:hover{ border-color:color-mix(in srgb,var(--accent) 36%,var(--hairline)); }
|
|
1310
|
+
.feedback-type-option:focus-visible{ outline:2px solid var(--ring); outline-offset:2px; }
|
|
1311
|
+
.feedback-type-option.selected{ border-color:color-mix(in srgb,var(--accent) 64%,var(--hairline)); background:var(--accent-tint); box-shadow:0 0 0 1px color-mix(in srgb,var(--accent) 14%,transparent); }
|
|
1312
|
+
.feedback-type-option strong{ overflow:hidden; text-overflow:ellipsis; font-size:13px; font-weight:620; }
|
|
1313
|
+
.feedback-type-option small{ color:var(--ink-muted); font-size:11.5px; font-weight:450; line-height:1.4; }
|
|
1314
|
+
.feedback-field{ display:flex; flex-direction:column; gap:7px; margin:0 0 18px; color:var(--ink); font-size:13px; font-weight:600; }
|
|
1315
|
+
.feedback-field.compact{ max-width:360px; }
|
|
1316
|
+
.feedback-field span em{ margin-left:5px; color:var(--ink-faint); font-style:normal; font-size:11.5px; font-weight:450; }
|
|
1317
|
+
.feedback-field textarea,.feedback-field input{ width:100%; min-width:0; color:var(--ink); background:var(--surface); border:1px solid var(--hairline); border-radius:var(--r-sm); font:400 13.5px/1.5 var(--sans); padding:10px 11px; transition:border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease); }
|
|
1318
|
+
.feedback-field textarea{ min-height:74px; resize:vertical; }
|
|
1319
|
+
.feedback-field textarea::placeholder,.feedback-field input::placeholder{ color:var(--ink-muted); opacity:1; }
|
|
1320
|
+
.feedback-field textarea:hover,.feedback-field input:hover{ border-color:color-mix(in srgb,var(--ink-muted) 42%,var(--hairline)); }
|
|
1321
|
+
.feedback-field textarea:focus,.feedback-field input:focus{ outline:0; border-color:var(--accent); box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 16%,transparent); background:var(--canvas); }
|
|
1322
|
+
.feedback-field small{ color:var(--ink-muted); font-size:11.5px; font-weight:450; line-height:1.45; }
|
|
1323
|
+
.feedback-sentiment{ margin:0 0 20px; padding:0; border:0; }
|
|
1324
|
+
.feedback-sentiment legend span{ color:var(--ink-faint); font-size:11.5px; font-weight:450; }
|
|
1325
|
+
.feedback-sentiment-options{ display:flex; flex-wrap:wrap; gap:7px; }
|
|
1326
|
+
.feedback-sentiment-option{ appearance:none; display:inline-flex; align-items:center; gap:7px; min-height:36px; padding:7px 11px; border:1px solid var(--hairline); border-radius:var(--pill); color:var(--ink-muted); background:var(--surface); font:500 12px/1 var(--sans); cursor:pointer; transition:color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease); }
|
|
1327
|
+
.feedback-sentiment-option .ico{ width:16px; height:16px; }
|
|
1328
|
+
.feedback-sentiment-option:hover{ color:var(--ink); border-color:color-mix(in srgb,var(--accent) 34%,var(--hairline)); transform:translateY(-1px); }
|
|
1329
|
+
.feedback-sentiment-option:focus-visible{ outline:2px solid var(--ring); outline-offset:2px; }
|
|
1330
|
+
.feedback-sentiment-option.selected{ color:var(--accent); border-color:color-mix(in srgb,var(--accent) 58%,var(--hairline)); background:var(--accent-tint); }
|
|
1331
|
+
.feedback-trust{ display:flex; align-items:flex-start; gap:8px; margin:3px 0 var(--s4); color:var(--ink-muted); font-size:11.5px; line-height:1.45; }
|
|
1332
|
+
.feedback-trust .ico{ width:15px; height:15px; flex:none; margin-top:1px; color:var(--ok); }
|
|
1333
|
+
.fb-note{ min-height:18px; margin:0 0 8px; color:var(--ink-muted); font-size:12px; }
|
|
1334
|
+
.fb-note.warn{ color:var(--warn); }
|
|
1335
|
+
.fb-actions{ display:flex; justify-content:flex-end; padding-top:var(--s3); }
|
|
1336
|
+
.fb-send:disabled{ opacity:.6; cursor:default; }
|
|
1337
|
+
.dlb-toast{ position:fixed; left:50%; bottom:24px; transform:translate(-50%,10px); z-index:130; padding:9px 16px; font-size:13px; color:var(--fg,#e6ecf1); background:var(--panel,#12151c); border:1px solid var(--line,#232a36); border-radius:10px; box-shadow:0 12px 40px rgba(0,0,0,.45); opacity:0; transition:opacity .25s, transform .25s; pointer-events:none; }
|
|
1338
|
+
.dlb-toast.show{ opacity:1; transform:translate(-50%,0); }
|
|
1339
|
+
</style>
|
|
1340
|
+
</head>
|
|
1341
|
+
<body>
|
|
1342
|
+
<div class="living" id="living" aria-hidden="true"><div class="glayer gl1"></div><div class="glayer gl2"></div><div class="glayer gl3"></div><div class="grain"></div></div>
|
|
1343
|
+
<div id="app">
|
|
1344
|
+
<aside class="sidebar" id="sidebar"></aside>
|
|
1345
|
+
<div class="sb-resize" id="sbresize" role="separator" aria-orientation="vertical" aria-label="Resize sidebar" tabindex="0"><span class="sb-grip" aria-hidden="true"><svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M13.5 8l-4 4 4 4"/></svg><svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M10.5 8l4 4-4 4"/></svg></span></div>
|
|
1346
|
+
<section class="stage">
|
|
1347
|
+
<div class="container rim">
|
|
1348
|
+
<div class="tabbar" id="tabbar">
|
|
1349
|
+
<span class="tabmark" id="tabmark" aria-hidden="true"></span>
|
|
1350
|
+
<button class="iconbtn" id="navbtn" aria-label="Menu"><svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h16"/></svg></button>
|
|
1351
|
+
<button class="tabscroll" id="tabscrollL" type="button" aria-label="Scroll tabs left"><svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"/></svg></button>
|
|
1352
|
+
<div class="tabs" id="tabs" role="tablist" aria-label="Open records"></div>
|
|
1353
|
+
<button class="tabscroll" id="tabscrollR" type="button" aria-label="Scroll tabs right"><svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg></button>
|
|
1354
|
+
<button class="tab-add" id="tabadd" title="New tab" aria-label="New tab">+</button>
|
|
1355
|
+
<div class="tabspacer"></div>
|
|
1356
|
+
<div class="topactions" id="topactions"></div>
|
|
1357
|
+
<div class="topglobal" id="topglobal">
|
|
1358
|
+
<button class="gicon" id="inboxbtn" type="button" title="Inbox" aria-label="Inbox"><svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 13v5a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5"/><path d="M4 13l2.4-6.7A2 2 0 0 1 8.3 5h7.4a2 2 0 0 1 1.9 1.3L20 13"/><path d="M4 13h4l1.2 2.2a1 1 0 0 0 .9.5h3.8a1 1 0 0 0 .9-.5L16 13h4"/></svg></button>
|
|
1359
|
+
<button class="gicon" id="feedbackbtn" type="button" title="Send feedback" aria-label="Send feedback"><svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 11v2a2 2 0 0 0 2 2h2l3 5h3l-2.5-5H12l8 3V6l-8 3H5a2 2 0 0 0-2 2z"/><path d="M7 9v6M20 10l2-1M20 14l2 1"/></svg></button>
|
|
1360
|
+
<button class="gicon" id="settingsbtn" type="button" title="Settings" aria-label="Settings"><svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .34 1.88l.06.06-2.83 2.83-.06-.06a1.7 1.7 0 0 0-1.88-.34 1.7 1.7 0 0 0-1.03 1.56V21h-4v-.08A1.7 1.7 0 0 0 9 19.37a1.7 1.7 0 0 0-1.88.34l-.06.06-2.83-2.83.06-.06A1.7 1.7 0 0 0 4.63 15 1.7 1.7 0 0 0 3.08 14H3v-4h.08A1.7 1.7 0 0 0 4.63 9a1.7 1.7 0 0 0-.34-1.88l-.06-.06 2.83-2.83.06.06A1.7 1.7 0 0 0 9 4.63 1.7 1.7 0 0 0 10 3.08V3h4v.08A1.7 1.7 0 0 0 15 4.63a1.7 1.7 0 0 0 1.88-.34l.06-.06 2.83 2.83-.06.06A1.7 1.7 0 0 0 19.37 9 1.7 1.7 0 0 0 20.92 10H21v4h-.08A1.7 1.7 0 0 0 19.4 15z"/></svg></button>
|
|
1361
|
+
</div>
|
|
1362
|
+
</div>
|
|
1363
|
+
<main class="main" id="main" role="tabpanel" tabindex="-1" aria-label="Open record"></main>
|
|
1364
|
+
<div class="docdiff" id="docdiff" hidden></div>
|
|
1365
|
+
</div>
|
|
1366
|
+
</section>
|
|
1367
|
+
<div class="scrim" id="scrim"></div>
|
|
1368
|
+
</div>
|
|
1369
|
+
|
|
1370
|
+
<script>
|
|
1371
|
+
(()=>{var CC=Object.create;var uf=Object.defineProperty;var EC=Object.getOwnPropertyDescriptor;var TC=Object.getOwnPropertyNames;var MC=Object.getPrototypeOf,AC=Object.prototype.hasOwnProperty;var jg=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}},RC=(t,e)=>{for(var n in e)uf(t,n,{get:e[n],enumerable:!0})},IC=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of TC(e))!AC.call(t,i)&&i!==n&&uf(t,i,{get:()=>e[i],enumerable:!(r=EC(e,i))||r.enumerable});return t};var qg=(t,e,n)=>(n=t!=null?CC(MC(t)):{},IC(e||!t||!t.__esModule?uf(n,"default",{value:t,enumerable:!0}):n,t));var Ow=jg((h_,Nw)=>{"use strict";var Ic=Object.prototype.hasOwnProperty,Lw=Object.prototype.toString,Ew=Object.defineProperty,Tw=Object.getOwnPropertyDescriptor,Mw=function(e){return typeof Array.isArray=="function"?Array.isArray(e):Lw.call(e)==="[object Array]"},Aw=function(e){if(!e||Lw.call(e)!=="[object Object]")return!1;var n=Ic.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Ic.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||Ic.call(e,i)},Rw=function(e,n){Ew&&n.name==="__proto__"?Ew(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},Iw=function(e,n){if(n==="__proto__")if(Ic.call(e,n)){if(Tw)return Tw(e,n).value}else return;return e[n]};Nw.exports=function t(){var e,n,r,i,o,s,l=arguments[0],a=1,c=arguments.length,u=!1;for(typeof l=="boolean"&&(u=l,l=arguments[1]||{},a=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});a<c;++a)if(e=arguments[a],e!=null)for(n in e)r=Iw(l,n),i=Iw(e,n),l!==i&&(u&&i&&(Aw(i)||(o=Mw(i)))?(o?(o=!1,s=r&&Mw(r)?r:[]):s=r&&Aw(r)?r:{},Rw(l,{name:n,newValue:t(u,s,i)})):typeof i<"u"&&Rw(l,{name:n,newValue:i}));return l}});var fS=jg((y6,hm)=>{(function(){var t;typeof hm<"u"?t=hm.exports=r:t=(function(){return this||(0,eval)("this")})(),t.format=r,t.vsprintf=n,typeof console<"u"&&typeof console.log=="function"&&(t.printf=e);function e(){console.log(r.apply(null,arguments))}function n(i,o){return r.apply(null,[i].concat(o))}function r(i){for(var o=1,s=[].slice.call(arguments),l=0,a=i.length,c="",u,f=!1,h,m,y=!1,x,k=function(){return s[o++]},S=function(){for(var R="";/\d/.test(i[l]);)R+=i[l++],u=i[l];return R.length>0?parseInt(R):null};l<a;++l)if(u=i[l],f)switch(f=!1,u=="."?(y=!1,u=i[++l]):u=="0"&&i[l+1]=="."?(y=!0,l+=2,u=i[l]):y=!0,x=S(),u){case"b":c+=parseInt(k(),10).toString(2);break;case"c":h=k(),typeof h=="string"||h instanceof String?c+=h:c+=String.fromCharCode(parseInt(h,10));break;case"d":c+=parseInt(k(),10);break;case"f":m=String(parseFloat(k()).toFixed(x||6)),c+=y?m:m.replace(/^0/,"");break;case"j":c+=JSON.stringify(k());break;case"o":c+="0"+parseInt(k(),10).toString(8);break;case"s":c+=k();break;case"x":c+="0x"+parseInt(k(),10).toString(16);break;case"X":c+="0x"+parseInt(k(),10).toString(16).toUpperCase();break;default:c+=u;break}else u==="%"?f=!0:c+=u;return c}})()});function st(t){this.content=t}st.prototype={constructor:st,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new st(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new st(n)},addToStart:function(t,e){return new st([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new st(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new st(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=st.from(t),t.size?new st(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=st.from(t),t.size?new st(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=st.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};st.from=function(t){if(t instanceof st)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new st(e)};var ff=st;function Zg(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){let s=i.text,l=o.text,a=0;for(;s[a]==l[a];a++)n++;return a&&a<s.length&&a<l.length&&ny(s.charCodeAt(a-1))&&ty(s.charCodeAt(a))&&n--,n}if(i.content.size||o.content.size){let s=Zg(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function ey(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,f=c.length,h=u.length;for(;f>0&&h>0&&c[f-1]==u[h-1];)f--,h--,n--,r--;return f&&h&&f<c.length&&ny(c.charCodeAt(f-1))&&ty(c.charCodeAt(f))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let c=ey(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function ty(t){return t>=56320&&t<57344}function ny(t){return t>=55296&&t<56320}var F=class t{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new t(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let l=this.content[o],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),i+=l.nodeSize),s=a}return new t(r,i)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new t(i,o)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Zg(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return ey(this,e,n,r)}findIndex(e){if(e==0)return Ll(0,e);if(e==this.size)return Ll(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?Ll(n+1,o):Ll(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return t.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new t(n||e,r)}static from(e){if(!e)return t.empty;if(e instanceof t)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new t([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};F.empty=new F([],0);var df={index:0,offset:0};function Ll(t,e){return df.index=t,df.offset=e,df}function Dl(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Dl(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Dl(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}var we=class t{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Dl(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};we.none=[];var Qn=class extends Error{},q=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=iy(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(ry(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(F.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new t(e,r,i)}};q.empty=new q(F.empty,0,0);function ry(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(ry(o.content,e-i-1,n-i-1)))}function iy(t,e,n,r,i,o){let{index:s,offset:l}=t.findIndex(e),a=t.maybeChild(s);if(l==e||a.isText)return o&&r<=0&&i<=0&&!o.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=iy(a.content,e-l-1,n,s==0?r-1:0,s==t.childCount-1?i-1:0,a);return c&&t.replaceChild(s,a.copy(c))}function LC(t,e,n){if(n.openStart>t.depth)throw new Qn("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Qn("Inconsistent open depths");return oy(t,e,n,0)}function oy(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=oy(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return Sr(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=NC(n,t);return Sr(o,ly(t,s,l,e,r))}else return Sr(o,Pl(t,e,r))}function sy(t,e){if(!e.type.compatibleContent(t.type))throw new Qn("Cannot join "+e.type.name+" onto "+t.type.name)}function hf(t,e,n){let r=t.node(n);return sy(r,e.node(n)),r}function wr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Lo(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(wr(t.nodeAfter,r),o++));for(let l=o;l<s;l++)wr(i.child(l),r);e&&e.depth==n&&e.textOffset&&wr(e.nodeBefore,r)}function Sr(t,e){if(!t.type.validContent(e))throw new Qn("Invalid content for node "+t.type.name);return t.copy(e)}function ly(t,e,n,r,i){let o=t.depth>i&&hf(t,e,i+1),s=r.depth>i&&hf(n,r,i+1),l=[];return Lo(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(sy(o,s),wr(Sr(o,ly(t,e,n,r,i+1)),l)):(o&&wr(Sr(o,Pl(t,e,i+1)),l),Lo(e,n,i,l),s&&wr(Sr(s,Pl(n,r,i+1)),l)),Lo(r,null,i,l),new F(l)}function Pl(t,e,n){let r=[];if(Lo(null,t,n,r),t.depth>n){let i=hf(t,e,n+1);wr(Sr(i,Pl(t,e,n+1)),r)}return Lo(e,null,n,r),new F(r)}function NC(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(F.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var zl=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return we.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new vr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new t(n,r,o)}static resolveCached(e,n){let r=Vg.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else Vg.set(e,r=new pf);let i=r.elts[r.i]=t.resolve(e,n);return r.i=(r.i+1)%OC,i}},pf=class{constructor(){this.elts=[],this.i=0}},OC=12,Vg=new WeakMap,vr=class{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},DC=Object.create(null),Tt=class t{constructor(e,n,r,i=we.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||F.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Dl(this.attrs,n||e.defaultAttrs||DC)&&we.sameSet(this.marks,r||we.none)}copy(e=null){return e==this.content?this:new t(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return q.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new q(c,i.depth-s,o.depth-s)}replace(e,n,r){return LC(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return zl.resolveCached(this,e)}resolveNoCache(e){return zl.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ay(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=F.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=we.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!we.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=F.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};Tt.prototype.text=void 0;var mf=class t extends Tt{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ay(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function ay(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var Cr=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new gf(e,n);if(r.next==null)return t.empty;let i=cy(r);r.next&&r.err("Unexpected trailing text");let o=HC(_C(i));return jC(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return F.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:f}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=o(f,l.concat(u));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
|
|
1372
|
+
`)}};Cr.empty=new Cr(!0);var gf=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function cy(t){let e=[];do e.push(PC(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function PC(t){let e=[];do e.push(zC(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function zC(t){let e=$C(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=BC(t,e);else break;return e}function Wg(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function BC(t,e){let n=Wg(t),r=n;return t.eat(",")&&(t.next!="}"?r=Wg(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function FC(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function $C(t){if(t.eat("(")){let e=cy(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=FC(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function _C(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();i(o(s.expr,a),u),a=u}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),i(o(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function uy(t,e){return e-t}function Ug(t,e){let n=[];return r(e),n.sort(uy);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&n.indexOf(a)==-1&&r(a)}}}function HC(t){let e=Object.create(null);return n(Ug(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);Ug(t,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new Cr(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(uy);o.next.push({type:i[s][0],next:e[l.join(",")]||n(l)})}return o}}function jC(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function fy(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function dy(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function hy(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}function py(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new yf(t,r,e[r]);return n}var Bl=class t{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=py(e,r.attrs),this.defaultAttrs=fy(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Cr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:dy(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Tt(this,this.computeAttrs(e),F.from(n),we.setFrom(r))}createChecked(e=null,n,r){return n=F.from(n),this.checkContent(n),new Tt(this,this.computeAttrs(e),n,we.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=F.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(F.empty,!0);return o?new Tt(this,e,n.append(o),we.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){hy(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:we.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new t(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function qC(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}var yf=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?qC(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Oo=class t{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=py(e,i.attrs),this.excluded=null;let o=fy(this.attrs);this.instance=o?new we(this,o):null}create(e=null){return!e&&this.instance?this.instance:new we(this,dy(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new t(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){hy(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Ei=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=ff.from(e.nodes),n.marks=ff.from(e.marks||{}),this.nodes=Bl.compile(this.spec.nodes,this),this.marks=Oo.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=Cr.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?Kg(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Kg(this,s.split(" "))}this.nodeFromJSON=i=>Tt.fromJSON(this,i),this.markFromJSON=i=>we.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Bl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new mf(r,r.defaultAttrs,e,we.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function Kg(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let l in t.marks){let a=t.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function VC(t){return t.tag!=null}function WC(t){return t.style!=null}var an=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(VC(i))this.tags.push(i);else if(WC(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new Fl(this,n,!1);return r.addAll(e,we.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Fl(this,n,!0);return r.addAll(e,we.none,n.from,n.to),q.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(JC(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Gg(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=Gg(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},my={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},UC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},gy={ol:!0,ul:!0},Do=1,bf=2,No=4;function Jg(t,e,n){return e!=null?(e?Do:0)|(e==="full"?bf:0):t&&t.whitespace=="pre"?Do|bf:n&~No}var Ci=class{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=we.none,this.match=o||(s&No?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(F.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Do)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=F.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(F.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!my.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Fl=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=Jg(null,n.preserveWhitespace,0)|(r?No:0);i?o=new Ci(i.type,i.attrs,we.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new Ci(null,null,we.none,!0,null,s):o=new Ci(e.schema.topNodeType,null,we.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&bf?"full":this.localPreserveWS||(i.options&Do)>0,{schema:s}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
|
|
1373
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;gy.hasOwnProperty(s)&&this.parser.normalizeLists&&KC(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:UC.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(my.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=a&&a.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
1374
|
+
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(o,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}o&&this.sync(l)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];s!=l;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n,r){let i,o;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,o=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!i)return null;this.sync(o);for(let s=0;s<i.length;s++)n=this.enterInner(i[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=we.none;for(let l of i.concat(e.marks))(o.type?o.type.allowsMarkType(l.type):Xg(l.type,e.type))&&(s=l.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Jg(e,o,s.options);s.options&No&&s.content.length==0&&(l|=No);let a=we.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Xg(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Ci(e,n,a,i,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Do)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=o;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function KC(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&gy.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function JC(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Gg(t){let e={};for(let n in t)e[n]=t[n];return e}function Xg(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||o.indexOf(u)<0&&s(u))return!0}};if(s(i.contentMatch))return!0}}var Rn=class t{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Nl(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let l=0,a=0;for(;l<o.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)i=o.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(o.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){if(e.isText)return Nl(n).createTextNode(e.text);let{dom:r,contentDOM:i}=Ol(Nl(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Ol(Nl(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:Ol(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Yg(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Yg(e.marks)}};function Yg(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Nl(t){return t.document||window.document}var Qg=new WeakMap;function GC(t){let e=Qg.get(t);return e===void 0&&Qg.set(t,e=XC(t)),e}function XC(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Ol(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=GC(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let l,a=n?t.createElementNS(n,i):t.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):f=="style"&&a.style?a.style.cssText=c[f]:a.setAttribute(f,c[f])}}for(let f=u;f<e.length;f++){let h=e[f];if(h===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof h=="string")a.appendChild(t.createTextNode(h));else{let{dom:m,contentDOM:y}=Ol(t,h,n,r);if(a.appendChild(m),y){if(l)throw new RangeError("Multiple content holes");l=y}}}return{dom:a,contentDOM:l}}var xy=65535,ky=Math.pow(2,16);function YC(t,e){return t+e*ky}function yy(t){return t&xy}function QC(t){return(t-(t&xy))/ky}var wy=1,Sy=2,$l=4,vy=8,Bo=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&vy)>0}get deletedBefore(){return(this.delInfo&(wy|$l))>0}get deletedAfter(){return(this.delInfo&(Sy|$l))>0}get deletedAcross(){return(this.delInfo&$l)>0}},In=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=yy(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+QC(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+s],f=a+c;if(e<=f){let h=c?e==a?-1:e==f?1:n:n,m=a+i+(h<0?0:u);if(r)return m;let y=e==(n<0?a:f)?null:YC(l/3,e-a),x=e==a?Sy:e==f?wy:$l;return(n<0?e!=a:e!=f)&&(x|=vy),new Bo(m,x,y)}i+=u-c}return r?e+i:new Bo(e+i,0,null)}touches(e,n){let r=0,i=yy(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+n],u=this.ranges[i+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?t.empty:new t(e<0?[0,-e,0]:[0,0,e])}};In.empty=new In([]);var Fo=class t{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new t(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new t;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this._maps[o],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new Bo(e,i,null)}},xf=Object.create(null),Je=class{getMap(){return In.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=xf[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in xf)throw new RangeError("Duplicate use of step JSON ID "+e);return xf[e]=n,n.prototype.jsonID=e,n}},et=class t{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new t(e,null)}static fail(e){return new t(null,e)}static fromReplace(e,n,r,i){try{return t.ok(e.replace(n,r,i))}catch(o){if(o instanceof Qn)return t.fail(o.message);throw o}}};function Cf(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Cf(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return F.fromArray(r)}var $o=class t extends Je{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new q(Cf(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return et.fromReplace(e,this.from,this.to,o)}invert(){return new Ln(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};Je.jsonID("addMark",$o);var Ln=class t extends Je{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new q(Cf(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return et.fromReplace(e,this.from,this.to,r)}invert(){return new $o(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};Je.jsonID("removeMark",Ln);var _o=class t extends Je{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return et.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return et.fromReplace(e,this.pos,this.pos+1,new q(F.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new t(this.pos,n.marks[i]);return new t(this.pos,this.mark)}}return new Ti(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}};Je.jsonID("addNodeMark",_o);var Ti=class t extends Je{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return et.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return et.fromReplace(e,this.pos,this.pos+1,new q(F.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new _o(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}};Je.jsonID("removeNodeMark",Ti);var tt=class t extends Je{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Sf(e,this.from,this.to)?et.fail("Structure replace would overwrite content"):et.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new In([this.from,this.to-this.from,this.slice.size])}invert(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&t.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new t(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof t)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?q.empty:new q(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?q.empty:new q(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,q.fromJSON(e,n.slice),!!n.structure)}};tt.MAP_BIAS=1;Je.jsonID("replace",tt);var $e=class t extends Je{constructor(e,n,r,i,o,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Sf(e,this.from,this.gapFrom)||Sf(e,this.gapTo,this.to)))return et.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return et.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?et.fromReplace(e,this.from,this.to,r):et.fail("Content does not fit in gap")}getMap(){return new In([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,q.fromJSON(e,n.slice),n.insert,!!n.structure)}};Je.jsonID("replaceAround",$e);function Sf(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function ZC(t,e,n,r){let i=[],o=[],s,l;t.doc.nodesBetween(e,n,(a,c,u)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),m=Math.min(c+a.nodeSize,n),y=r.addToSet(f);for(let x=0;x<f.length;x++)f[x].isInSet(y)||(s&&s.to==h&&s.mark.eq(f[x])?s.to=m:i.push(s=new Ln(h,m,f[x])));l&&l.to==h?l.to=m:o.push(l=new $o(h,m,r))}}),i.forEach(a=>t.step(a)),o.forEach(a=>t.step(a))}function eE(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;o++;let a=null;if(r instanceof Oo){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let f=a[u],h;for(let m=0;m<i.length;m++){let y=i[m];y.step==o-1&&f.eq(i[m].style)&&(h=y)}h?(h.to=c,h.step=o):i.push({style:f,from:Math.max(l,e),to:c,step:o})}}}),i.forEach(s=>t.step(new Ln(s.from,s.to,s.style)))}function Ef(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),u=l+c.nodeSize,f=r.matchType(c.type);if(!f)s.push(new tt(l,u,q.empty));else{r=f;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new Ln(l,u,c.marks[h]));if(i&&c.isText&&n.whitespace!="pre"){let h,m=/\r?\n|\r/g,y;for(;h=m.exec(c.text);)y||(y=new q(F.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new tt(l+h.index,l+h.index+h[0].length,y))}}l=u}if(!r.validEnd){let a=r.fillBefore(F.empty,!0);t.replace(l,l,new q(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function tE(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Nn(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,o=0;;--r){let s=t.$from.node(r),l=t.$from.index(r)+i,a=t.$to.indexAfter(r)-o;if(r<t.depth&&s.canReplace(l,a,n))return r;if(r==0||s.type.spec.isolating||!tE(s,l,a))break;l&&(i=1),a<s.childCount&&(o=1)}return null}function nE(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,u=F.empty,f=0;for(let y=o,x=!1;y>n;y--)x||r.index(y)>0?(x=!0,u=F.from(r.node(y).copy(u)),f++):a--;let h=F.empty,m=0;for(let y=o,x=!1;y>n;y--)x||i.after(y+1)<i.end(y)?(x=!0,h=F.from(i.node(y).copy(h)),m++):c++;t.step(new $e(a,c,s,l,new q(u.append(h),f,m),u.size-f,!0))}function Ai(t,e,n=null,r=t){let i=rE(t,e),o=i&&iE(r,e);return o?i.map(by).concat({type:e,attrs:n}).concat(o.map(by)):null}function by(t){return{type:t,attrs:null}}function rE(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function iE(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function oE(t,e,n){let r=F.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=F.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new $e(i,o,i,o,new q(r,0,0),n.length,!0))}function sE(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,a)&&lE(t.doc,t.mapping.slice(o).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let m=r.whitespace=="pre",y=!!r.contentMatch.matchType(r.schema.linebreakReplacement);m&&!y?c=!1:!m&&y&&(c=!0)}c===!1&&Ey(t,s,l,o),Ef(t,t.mapping.slice(o).map(l,1),r,void 0,c===null);let u=t.mapping.slice(o),f=u.map(l,1),h=u.map(l+s.nodeSize,1);return t.step(new $e(f,h,f+1,h-1,new q(F.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&Cy(t,s,l,o),!1}})}function Cy(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let a=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Ey(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
1375
|
+
`))}})}function lE(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function aE(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new $e(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new q(F.from(s),0,0),1,!0))}function Nt(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=n-2;c>o;c--,u--){let f=i.node(c),h=i.index(c);if(f.type.spec.isolating)return!1;let m=f.content.cutByIndex(h,f.childCount),y=r&&r[u+1];y&&(m=m.replaceChild(0,y.type.create(y.attrs)));let x=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!x.type.validContent(m))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function cE(t,e,n=1,r){let i=t.doc.resolve(e),o=F.empty,s=F.empty;for(let l=i.depth,a=i.depth-n,c=n-1;l>a;l--,c--){o=F.from(i.node(l).copy(o));let u=r&&r[c];s=F.from(u?u.type.create(u.attrs,s):i.node(l).copy(s))}t.step(new tt(e,e,new q(o.append(s),n,n),!0))}function Ft(t,e){let n=t.resolve(e),r=n.index();return Ty(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function uE(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),s=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function Ty(t,e){return!!(t&&e&&!t.isLeaf&&uE(t,e))}function Er(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,s,l=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):n>0?(o=r.node(i+1),l++,s=r.node(i).maybeChild(l)):(o=r.node(i).maybeChild(l-1),s=r.node(i+1)),o&&!o.isTextblock&&Ty(o,s)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function fE(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),s=o.node().type;if(i&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(i);u&&!f?r=!1:!u&&f&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Ey(t,u.node(),u.before(),l)}s.inlineContent&&Ef(t,e+n-1,s,o.node().contentMatchAt(o.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new tt(c,a.map(e+n,-1),q.empty,!0)),r===!0){let u=t.doc.resolve(c);Cy(t,u.node(),u.before(),t.steps.length)}return t}function dE(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function jl(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(o==1)u=c.canReplace(a,a,i);else{let f=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=f&&c.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function Ho(t,e,n=e,r=q.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return My(i,o,r)?new tt(e,n,r):new vf(i,o,r).fit()}function My(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var vf=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=F.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=F.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,l=i.depth;for(;s&&l&&o.childCount==1;)o=o.firstChild.content,s--,l--;let a=new q(o,s,l);return e>-1?new $e(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new tt(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=kf(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,f=null;if(n==1&&(s?c.matchType(s.type)||(f=c.fillBefore(F.from(s),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:f};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=kf(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new q(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=kf(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new q(Po(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new q(Po(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let x=0;x<o.length;x++)this.openFrontierNode(o[x]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:f,type:h}=this.frontier[n];if(i){for(let x=0;x<i.childCount;x++)u.push(i.child(x));f=f.matchFragment(i)}let m=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let x=l.child(c),k=f.matchType(x.type);if(!k)break;c++,(c>1||a==0||x.content.size)&&(f=k,u.push(Ay(x.mark(h.allowedMarks(x.marks)),c==1?a:0,c==l.childCount?m:-1)))}let y=c==l.childCount;y||(m=-1),this.placed=zo(this.placed,n,F.from(u)),this.frontier[n].match=f,y&&m<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let x=0,k=l;x<m;x++){let S=k.lastChild;this.frontier.push({type:S.type,match:S.contentMatchAt(S.childCount)}),k=S.content}this.unplaced=y?e==0?q.empty:new q(Po(s.content,e-1,1),e-1,m<0?s.openEnd:e-1):new q(Po(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!wf(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=wf(e,n,i,r,o);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=wf(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=zo(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=zo(this.placed,this.depth,F.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(F.empty,!0);n.childCount&&(this.placed=zo(this.placed,this.frontier.length,n))}};function Po(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Po(t.firstChild.content,e-1,n)))}function zo(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(zo(t.lastChild.content,e-1,n)))}function kf(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ay(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Ay(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(F.empty,!0)))),t.copy(r)}function wf(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!hE(n,o.content,s)?l:null}function hE(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function pE(t){return t.spec.defining||t.spec.definingForContent}function mE(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(My(i,o,r))return t.step(new tt(e,n,r));let s=Iy(i,o);s[s.length-1]==0&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let h=i.depth,m=i.pos-1;h>0;h--,m--){let y=i.node(h).type.spec;if(y.defining||y.definingAsContext||y.isolating)break;s.indexOf(h)>-1?l=h:i.before(h)==m&&s.splice(1,0,-h)}let a=s.indexOf(l),c=[],u=r.openStart;for(let h=r.content,m=0;;m++){let y=h.firstChild;if(c.push(y),m==r.openStart)break;h=y.content}for(let h=u-1;h>=0;h--){let m=c[h],y=pE(m.type);if(y&&!m.sameMarkup(i.node(Math.abs(l)-1)))u=h;else if(y||!m.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let m=(h+u+1)%(r.openStart+1),y=c[m];if(y)for(let x=0;x<s.length;x++){let k=s[(x+a)%s.length],S=!0;k<0&&(S=!1,k=-k);let R=i.node(k-1),M=i.index(k-1);if(R.canReplaceWith(M,M,y.type,y.marks))return t.replace(i.before(k),S?o.after(k):n,new q(Ry(r.content,0,r.openStart,m),m,r.openEnd))}}let f=t.steps.length;for(let h=s.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>f));h--){let m=s[h];m<0||(e=i.before(m),n=o.after(m))}}function Ry(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(Ry(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(t).append(t);t=s.append(o.matchFragment(s).fillBefore(F.empty,!0))}return t}function gE(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=dE(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new q(F.from(r),0,0))}function yE(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let s=r.sharedDepth(n),l=!1;for(let a=r.depth;a>s;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=i.depth;a>s;a--)i.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=i.depth;a>0&&n==i.start(a);a--)n=i.before(a);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let o=Iy(r,i);for(let s=0;s<o.length;s++){let l=o[s],a=s==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return t.delete(r.before(l),i.after(l))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Iy(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}var _l=class t extends Je{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return et.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return et.fromReplace(e,this.pos,this.pos+1,new q(F.from(i),0,n.isLeaf?0:1))}getMap(){return In.empty}invert(e){return new t(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new t(n.pos,n.attr,n.value)}};Je.jsonID("attr",_l);var Hl=class t extends Je{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return et.ok(r)}getMap(){return In.empty}invert(e){return new t(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new t(n.attr,n.value)}};Je.jsonID("docAttr",Hl);var Mi=class extends Error{};Mi=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Mi.prototype=Object.create(Error.prototype);Mi.prototype.constructor=Mi;Mi.prototype.name="TransformError";var Zn=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Fo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Mi(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((o,s,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=q.empty){let i=Ho(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new q(F.from(r),0,0))}delete(e,n){return this.replace(e,n,q.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return mE(this,e,n,r),this}replaceRangeWith(e,n,r){return gE(this,e,n,r),this}deleteRange(e,n){return yE(this,e,n),this}lift(e,n){return nE(this,e,n),this}join(e,n=1){return fE(this,e,n),this}wrap(e,n){return oE(this,e,n),this}setBlockType(e,n=e,r,i=null){return sE(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return aE(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new _l(e,n,r)),this}setDocAttribute(e,n){return this.step(new Hl(e,n)),this}addNodeMark(e,n){return this.step(new _o(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof we)n.isInSet(r.marks)&&this.step(new Ti(e,n));else{let i=r.marks,o,s=[];for(;o=n.isInSet(i);)s.push(new Ti(e,o)),i=o.removeFromSet(i);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,r){return cE(this,e,n,r),this}addMark(e,n,r){return ZC(this,e,n,r),this}removeMark(e,n,r){return eE(this,e,n,r),this}clearIncompatible(e,n,r){return Ef(this,e,n,r),this}};var Tf=Object.create(null),ee=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Ii(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=q.empty){let r=n.content.lastChild,i=null;for(let l=0;l<n.openEnd;l++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(o);e.replaceRange(u.map(a.pos),u.map(c.pos),l?q.empty:n),l==0&&Oy(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:l}=i[o],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);o?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Oy(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new X(e):Ri(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=n<0?Ri(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Ri(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new gt(e.node(0))}static atStart(e){return Ri(e,e,0,0,1)||new gt(e)}static atEnd(e){return Ri(e,e,e.content.size,e.childCount,-1)||new gt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Tf[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Tf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Tf[e]=n,n.prototype.jsonID=e,n}getBookmark(){return X.between(this.$anchor,this.$head).getBookmark()}};ee.prototype.visible=!0;var Ii=class{constructor(e,n){this.$from=e,this.$to=n}},Ly=!1;function Ny(t){!Ly&&!t.parent.inlineContent&&(Ly=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var X=class t extends ee{constructor(e,n=e){Ny(e),Ny(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ee.near(r);let i=e.resolve(n.map(this.anchor));return new t(i.parent.inlineContent?i:r,r)}replace(e,n=q.empty){if(super.replace(e,n),n==q.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Vl(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=ee.findFrom(n,r,!0)||ee.findFrom(n,-r,!0);if(o)n=o.$head;else return ee.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ee.findFrom(e,-r,!0)||ee.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new t(e,n)}};ee.jsonID("text",X);var Vl=class t{constructor(e,n){this.anchor=e,this.head=n}map(e){return new t(e.map(this.anchor),e.map(this.head))}resolve(e){return X.between(e.resolve(this.anchor),e.resolve(this.head))}},Q=class t extends ee{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?ee.near(o):new t(o)}content(){return new q(F.from(this.node),0,0)}eq(e){return e instanceof t&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Af(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(e.resolve(n.anchor))}static create(e,n){return new t(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Q.prototype.visible=!1;ee.jsonID("node",Q);var Af=class t{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Vl(r,r):new t(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Q.isSelectable(r)?new Q(n):ee.near(n)}},gt=class t extends ee{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=q.empty){if(n==q.empty){e.delete(0,e.doc.content.size);let r=ee.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new t(e)}map(e){return new t(e)}eq(e){return e instanceof t}getBookmark(){return bE}};ee.jsonID("all",gt);var bE={map(){return this},resolve(t){return new gt(t)}};function Ri(t,e,n,r,i,o=!1){if(e.inlineContent)return X.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&Q.isSelectable(l))return Q.create(t,n-(i<0?l.nodeSize:0))}else{let a=Ri(t,l,n+i,i<0?l.childCount:0,i,o);if(a)return a}n+=l.nodeSize*i}return null}function Oy(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof tt||i instanceof $e))return;let o=t.mapping.maps[r],s;o.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(ee.near(t.doc.resolve(s),n))}var Dy=1,ql=2,Py=4,Rf=class extends Zn{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Dy)&~ql,this.storedMarks=null,this}get selectionSet(){return(this.updated&Dy)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ql,this}ensureMarks(e){return we.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&ql)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ql,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||we.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(n);o=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ee.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Py,this}get scrolledIntoView(){return(this.updated&Py)>0}};function zy(t,e){return!e||!t?t:t.bind(e)}var Tr=class{constructor(e,n,r){this.name=e,this.init=zy(n.init,r),this.apply=zy(n.apply,r)}},xE=[new Tr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Tr("selection",{init(t,e){return t.selection||ee.atStart(e.doc)},apply(t){return t.selection}}),new Tr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Tr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],jo=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=xE.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Tr(r.key,r.spec.state,r))})}},Wl=class t{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=i?i[s].n:0,c=i?i[s].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),o=!0}i&&(i[s]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new t(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new Rf(this)}static create(e){let n=new jo(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new t(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new jo(this.schema,e.plugins),r=n.fields,i=new t(n);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new jo(e.schema,e.plugins),o=new t(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=Tt.fromJSON(e.schema,n.doc);else if(s.name=="selection")o.selection=ee.fromJSON(o.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){o[s.name]=c.fromJSON.call(a,e,n[l],o);return}}o[s.name]=s.init(e,o)}}),o}};function By(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=By(i,e,{})),n[r]=i}return n}var Y=class{constructor(e){this.spec=e,this.props={},e.props&&By(e.props,this,this.props),this.key=e.key?e.key.key:Fy("plugin")}getState(e){return e[this.key]}},Mf=Object.create(null);function Fy(t){return t in Mf?t+"$"+ ++Mf[t]:(Mf[t]=0,t+"$")}var te=class{constructor(e="key"){this.key=Fy(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var _y=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Hy(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Lf=(t,e,n)=>{let r=Hy(t,n);if(!r)return!1;let i=Of(r);if(!i){let s=r.blockRange(),l=s&&Nn(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let o=i.nodeBefore;if(Xy(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Li(o,"end")||Q.isSelectable(o)))for(let s=r.depth;;s--){let l=Ho(t.doc,r.before(s),r.after(s),q.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(Li(o,"end")?ee.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):Q.create(a.doc,i.pos-o.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},jy=(t,e,n)=>{let r=Hy(t,n);if(!r)return!1;let i=Of(r);return i?Vy(t,i,e):!1},qy=(t,e,n)=>{let r=Wy(t,n);if(!r)return!1;let i=zf(r);return i?Vy(t,i,e):!1};function Vy(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Ho(t.doc,o,a,q.empty);if(!c||c.from!=o||c instanceof tt&&c.slice.size>=a-o)return!1;if(n){let u=t.tr.step(c);u.setSelection(X.create(u.doc,o)),n(u.scrollIntoView())}return!0}function Li(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Nf=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=Of(r)}let s=o&&o.nodeBefore;return!s||!Q.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Q.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function Of(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Wy(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}var Df=(t,e,n)=>{let r=Wy(t,n);if(!r)return!1;let i=zf(r);if(!i)return!1;let o=i.nodeAfter;if(Xy(t,i,e,1))return!0;if(r.parent.content.size==0&&(Li(o,"start")||Q.isSelectable(o))){let s=Ho(t.doc,r.before(),r.after(),q.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(Li(o,"start")?ee.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):Q.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},Pf=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=zf(r)}let s=o&&o.nodeAfter;return!s||!Q.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Q.create(t.doc,o.pos)).scrollIntoView()),!0)};function zf(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}var Uy=(t,e)=>{let n=t.selection,r=n instanceof Q,i;if(r){if(n.node.isTextblock||!Ft(t.doc,n.from))return!1;i=n.from}else if(i=Er(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(Q.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},Ky=(t,e)=>{let n=t.selection,r;if(n instanceof Q){if(n.node.isTextblock||!Ft(t.doc,n.to))return!1;r=n.to}else if(r=Er(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Jy=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&Nn(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},Bf=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
1376
|
+
`).scrollIntoView()),!0)};function Ff(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var $f=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=Ff(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(ee.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},_f=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof gt||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Ff(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=t.tr.insert(s,o.createAndFill());l.setSelection(X.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Hf=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Nt(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Nn(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function kE(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Q&&e.selection.node.isBlock)return!r.parentOffset||!Nt(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,l,a=!1,c=!1;for(let m=r.depth;;m--)if(r.node(m).isBlock){a=r.end(m)==r.pos+(r.depth-m),c=r.start(m)==r.pos-(r.depth-m),l=Ff(r.node(m-1).contentMatchAt(r.indexAfter(m-1)));let x=t&&t(i.parent,a,r);o.unshift(x||(a&&l?{type:l}:null)),s=m;break}else{if(m==1)return!1;o.unshift(null)}let u=e.tr;(e.selection instanceof X||e.selection instanceof gt)&&u.deleteSelection();let f=u.mapping.map(r.pos),h=Nt(u.doc,f,o.length,o);if(h||(o[0]=l?{type:l}:null,h=Nt(u.doc,f,o.length,o)),!h)return!1;if(u.split(f,o.length,o),!a&&c&&r.node(s).type!=l){let m=u.mapping.map(r.before(s)),y=u.doc.resolve(m);l&&r.node(s-1).canReplaceWith(y.index(),y.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}var wE=kE();var Gy=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(Q.create(t.doc,i))),!0)},SE=(t,e)=>(e&&e(t.tr.setSelection(new gt(t.doc))),!0);function vE(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||Ft(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Xy(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,s,l,a=i.type.spec.isolating||o.type.spec.isolating;if(!a&&vE(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&l.matchType(s[0]||o.type).validEnd){if(n){let m=e.pos+o.nodeSize,y=F.empty;for(let S=s.length-1;S>=0;S--)y=F.from(s[S].create(null,y));y=F.from(i.copy(y));let x=t.tr.step(new $e(e.pos-1,m,e.pos,m,new q(y,1,0),s.length,!0)),k=x.doc.resolve(m+2*s.length);k.nodeAfter&&k.nodeAfter.type==i.type&&Ft(x.doc,k.pos)&&x.join(k.pos),n(x.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:ee.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),h=f&&Nn(f);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(f,h).scrollIntoView()),!0;if(c&&Li(o,"start",!0)&&Li(i,"end")){let m=i,y=[];for(;y.push(m),!m.isTextblock;)m=m.lastChild;let x=o,k=1;for(;!x.isTextblock;x=x.firstChild)k++;if(m.canReplace(m.childCount,m.childCount,x.content)){if(n){let S=F.empty;for(let M=y.length-1;M>=0;M--)S=F.from(y[M].copy(S));let R=t.tr.step(new $e(e.pos-y.length,e.pos+o.nodeSize,e.pos+k,e.pos+o.nodeSize-k,new q(S,y.length,0),0,!0));n(R.scrollIntoView())}return!0}}return!1}function Yy(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(X.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}var jf=Yy(-1),qf=Yy(1);function Qy(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&Ai(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Vf(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[o];n.doc.nodesBetween(s,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)i=!0;else{let u=n.doc.resolve(c),f=u.index();i=u.parent.canReplaceWith(f,f+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];o.setBlockType(l,a,t,e)}r(o.scrollIntoView())}return!0}}function Wf(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}var If=Wf(_y,Lf,Nf),$y=Wf(_y,Df,Pf),er={Enter:Wf(Bf,_f,Hf,wE),"Mod-Enter":$f,Backspace:If,"Mod-Backspace":If,"Shift-Backspace":If,Delete:$y,"Mod-Delete":$y,"Mod-a":SE},CE={"Ctrl-h":er.Backspace,"Alt-Backspace":er["Mod-Backspace"],"Ctrl-d":er.Delete,"Ctrl-Alt-Backspace":er["Mod-Delete"],"Alt-Delete":er["Mod-Delete"],"Alt-d":er["Mod-Delete"],"Ctrl-a":jf,"Ctrl-e":qf};for(let t in er)CE[t]=er[t];var pz=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1;function Zy(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let l=r?n.tr:null;return EE(l,s,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function EE(t,e,n,r=null){let i=!1,o=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);o=new vr(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new vr(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=Ai(o,n,r,e);return l?(t&&TE(t,e,l,i,n),!0):!1}function TE(t,e,n,r,i){let o=F.empty;for(let u=n.length-1;u>=0;u--)o=F.from(n[u].type.create(n[u].attrs,o));t.step(new $e(e.start-(r?2:0),e.end,e.start,e.end,new q(o,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==i&&(s=u+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,f=e.endIndex,h=!0;u<f;u++,h=!1)!h&&Nt(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function eb(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?ME(e,n,t,o):AE(e,n,o):!0:!1}}function ME(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new $e(o-1,s,o,s,new q(F.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new vr(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));let l=Nn(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(o,-1)-1);return Ft(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function AE(t,e,n){let r=t.tr,i=n.parent;for(let m=n.end,y=n.endIndex-1,x=n.startIndex;y>x;y--)m-=i.child(y).nodeSize,r.delete(m-1,m+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==i.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?F.empty:F.from(i))))return!1;let f=o.pos,h=f+s.nodeSize;return r.step(new $e(f-(l?1:0),h+(a?1:0),f+1,h-1,new q((l?F.empty:F.from(i.copy(F.empty))).append(a?F.empty:F.from(i.copy(F.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function tb(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==t);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=F.from(c?t.create():null),f=new q(F.from(t.create(null,F.from(l.type.create(null,u)))),c?3:1,0),h=o.start,m=o.end;n(e.tr.step(new $e(h-(c?3:1),m,h,m,f,1,!0)).scrollIntoView())}return!0}}var nt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Pi=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},Yf=null,Dn=function(t,e,n){let r=Yf||(Yf=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},RE=function(){Yf=null},Dr=function(t,e,n,r){return n&&(nb(t,e,n,r,-1)||nb(t,e,n,r,1))},IE=/^(img|br|input|textarea|hr)$/i;function nb(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:_t(t))){let s=t.parentNode;if(!s||s.nodeType!=1||Xo(t)||IE.test(t.nodeName)||t.contentEditable=="false")return!1;e=nt(t)+(i<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(i<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((o=s.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=s,e=i<0?_t(t):0}else return!1}}function _t(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function LE(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=_t(t)}else if(t.parentNode&&!Xo(t))e=nt(t),t=t.parentNode;else return null}}function NE(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Xo(t))e=nt(t)+1,t=t.parentNode;else return null}}function OE(t,e,n){for(let r=e==0,i=e==_t(t);r||i;){if(t==n)return!0;let o=nt(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==_t(t)}}function Xo(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var ra=function(t){return t.focusNode&&Dr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Mr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function DE(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function PE(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(_t(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(_t(r.startContainer),r.startOffset)}}}var cn=typeof navigator<"u"?navigator:null,rb=typeof document<"u"?document:null,or=cn&&cn.userAgent||"",Qf=/Edge\/(\d+)/.exec(or),Ob=/MSIE \d/.exec(or),Zf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(or),Mt=!!(Ob||Zf||Qf),rr=Ob?document.documentMode:Zf?+Zf[1]:Qf?+Qf[1]:0,Ht=!Mt&&/gecko\/(\d+)/i.test(or);Ht&&+(/Firefox\/(\d+)/.exec(or)||[0,0])[1];var ed=!Mt&&/Chrome\/(\d+)/.exec(or),Ge=!!ed,Db=ed?+ed[1]:0,at=!Mt&&!!cn&&/Apple Computer/.test(cn.vendor),zi=at&&(/Mobile\/\w+/.test(or)||!!cn&&cn.maxTouchPoints>2),$t=zi||(cn?/Mac/.test(cn.platform):!1),Pb=cn?/Win/.test(cn.platform):!1,Pn=/Android \d/.test(or),Yo=!!rb&&"webkitFontSmoothing"in rb.documentElement.style,zE=Yo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function BE(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function On(t,e){return typeof t=="number"?t:t[e]}function FE(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function ib(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Pi(s);continue}let l=s,a=l==o.body,c=a?BE(o):FE(l),u=0,f=0;if(e.top<c.top+On(r,"top")?f=-(c.top-e.top+On(i,"top")):e.bottom>c.bottom-On(r,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+On(i,"top")-c.top:e.bottom-c.bottom+On(i,"bottom")),e.left<c.left+On(r,"left")?u=-(c.left-e.left+On(i,"left")):e.right>c.right-On(r,"right")&&(u=e.right-c.right+On(i,"right")),u||f)if(a)o.defaultView.scrollBy(u,f);else{let m=l.scrollLeft,y=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let x=l.scrollLeft-m,k=l.scrollTop-y;e={left:e.left-x,top:e.top-k,right:e.right-x,bottom:e.bottom-k}}let h=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s=h=="absolute"?s.offsetParent:Pi(s)}}function $E(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(o,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:zb(t.dom)}}function zb(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Pi(r));return e}function _E({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Bb(n,r==0?0:r-e)}function Bb(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}var Ni=null;function HE(t){if(t.setActive)return t.setActive();if(Ni)return t.focus(Ni);let e=zb(t);t.focus(Ni==null?{get preventScroll(){return Ni={preventScroll:!0},!0}}:void 0),Ni||(Ni=!1,Bb(e,0))}function Fb(t,e){let n,r=2e8,i,o=0,s=e.top,l=e.top,a,c;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Dn(u).getClientRects();else continue;for(let m=0;m<h.length;m++){let y=h[m];if(y.top<=s&&y.bottom>=l){s=Math.max(y.bottom,s),l=Math.min(y.top,l);let x=y.left>e.left?y.left-e.left:y.right<e.left?e.left-y.right:0;if(x<r){n=u,r=x,i=x&&n.nodeType==3?{left:y.right<e.left?y.right:y.left,top:e.top}:e,u.nodeType==1&&x&&(o=f+(e.left>=(y.left+y.right)/2?1:0));continue}}else y.top>e.top&&!a&&y.left<=e.left&&y.right>=e.left&&(a=u,c={left:Math.max(y.left,Math.min(y.right,e.left)),top:y.top});!n&&(e.left>=y.right&&e.top>=y.top||e.left>=y.left&&e.top>=y.bottom)&&(o=f+1)}}return!n&&a&&(n=a,i=c,r=0),n&&n.nodeType==3?jE(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:Fb(n,i)}function jE(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=tr(r,1);if(s.top!=s.bottom&&gd(e,s)){i={node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function gd(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function qE(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function VE(t,e,n){let{node:r,offset:i}=Fb(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function WE(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let l=t.docView.nearestDesc(o,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?i=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),s=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;o=l.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function $b(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let s=t.childNodes[o];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(gd(e,c))return $b(s,e,c)}}if((o=(o+1)%r)==i)break}return t}function UE(t,e){let n=t.dom.ownerDocument,r,i=0,o=PE(n,e.left,e.top);o&&({node:r,offset:i}=o);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!gd(e,c)||(s=$b(t.dom,e,c),!s))return null}if(at)for(let c=s;r&&c;c=Pi(c))c.draggable&&(r=void 0);if(s=qE(s,e),r){if(Ht&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;Yo&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=WE(t,r,i,e))}l==null&&(l=VE(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ob(t){return t.top<t.bottom||t.left<t.right}function tr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(ob(r))return r}return Array.prototype.find.call(n,ob)||t.getBoundingClientRect()}var KE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _b(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=Yo||Ht;if(r.nodeType==3)if(s&&(KE.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let a=tr(Dn(r,i,i),n);if(Ht&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=tr(Dn(r,i-1,i-1),-1);if(c.top==a.top){let u=tr(Dn(r,i,i+1),-1);if(u.top!=a.top)return qo(u,u.left<c.left)}}return a}else{let a=i,c=i,u=n<0?1:-1;return n<0&&!i?(c++,u=-1):n>=0&&i==r.nodeValue.length?(a--,u=1):n<0?a--:c++,qo(tr(Dn(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==_t(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Uf(a.getBoundingClientRect(),!1)}if(o==null&&i<_t(r)){let a=r.childNodes[i];if(a.nodeType==1)return Uf(a.getBoundingClientRect(),!0)}return Uf(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==_t(r))){let a=r.childNodes[i-1],c=a.nodeType==3?Dn(a,_t(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return qo(tr(c,1),!1)}if(o==null&&i<_t(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Dn(a,0,s?0:1):a.nodeType==1?a:null:null;if(c)return qo(tr(c,-1),!0)}return qo(tr(r.nodeType==3?Dn(r):r,-n),n>=0)}function qo(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Uf(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Hb(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function JE(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Hb(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let s=_b(t,i.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Dn(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}var GE=/[\u0590-\u08ac]/;function XE(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=t.domSelection();return l?!GE.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?o:s:Hb(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",n,"character");let m=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:y,focusOffset:x}=t.domSelectionRange(),k=y&&!m.contains(y.nodeType==1?y:y.parentNode)||a==y&&c==x;try{l.collapse(u,f),a&&(a!=u||c!=f)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),k}):r.pos==r.start()||r.pos==r.end()}var sb=null,lb=null,ab=!1;function YE(t,e,n){return sb==e&&lb==n?ab:(sb=e,lb=n,ab=n=="up"||n=="down"?JE(t,e,n):XE(t,e,n))}var jt=0,cb=1,Ar=2,Yt=3,Pr=class{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=jt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>nt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!n||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let s=0;s<i.children.length;s++){let l=i.children[s];if(l.size){i=l;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],l=o+s.size;if(l>e||s instanceof Jl){i=e-o;break}o=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Ul&&o.side>=0;r--);if(n<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&n&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?nt(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?nt(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(i==-1&&e<=c){let u=s+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=s;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=nt(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=nt(f.dom);break}n+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),s=Math.max(e,n);for(let m=0,y=0;m<this.children.length;m++){let x=this.children[m],k=y+x.size;if(o>y&&s<k)return x.setSelection(e-y-x.border,n-y-x.border,r,i);y=k}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((Ht||at)&&e==n){let{node:m,offset:y}=l;if(m.nodeType==3){if(f=!!(y&&m.nodeValue[y-1]==`
|
|
1377
|
+
`),f&&y==m.nodeValue.length)for(let x=m,k;x;x=x.parentNode){if(k=x.nextSibling){k.nodeName=="BR"&&(l=a={node:k.parentNode,offset:nt(k)+1});break}let S=x.pmViewDesc;if(S&&S.node&&S.node.isBlock)break}}else{let x=m.childNodes[y-1];f=x&&(x.nodeName=="BR"||x.contentEditable=="false")}}if(Ht&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let m=u.focusNode.childNodes[u.focusOffset];m&&m.contentEditable=="false"&&(i=!0)}if(!(i||f&&at)&&Dr(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Dr(a.node,a.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||e==n)&&!(f&&Ht)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(e>n){let y=l;l=a,a=y}let m=document.createRange();m.setEnd(a.node,a.offset),m.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(m)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+o.border,a=s-o.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?Ar:cb,e==l&&n==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Yt:o.markDirty(e-l,n-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Ar:Yt}r=s}this.dirty=Ar}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ar:cb;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Ul=class extends Pr{constructor(e,n,r,i){let o,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==jt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},td=class extends Pr{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},Ir=class t extends Pr{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],s=o&&o(n,i,r);return(!s||!s.dom)&&(s=Rn.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new t(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Yt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Yt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=jt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=jt}}slice(e,n,r){let i=t.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;n<s&&(o=od(o,n,s,r)),e>0&&(o=od(o,0,e,r));for(let l=0;l<o.length;l++)o[l].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},ir=class t extends Pr{constructor(e,n,r,i,o,s,l){super(e,[],o,s),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,n,r,i,o,s){let l=o.nodeViews[n.type.name],a,c=l&&l(n,o,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,f=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=Rn.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=Vb(u,r,n),c?a=new nd(e,n,r,i,u,f||null,h,c):n.isText?new Kl(e,n,r,i,u,h):new t(e,n,r,i,u,f||null,h)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>F.empty)}return e}matchesNode(e,n,r){return this.dirty==jt&&e.eq(this.node)&&Gl(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,s=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new id(this,s&&s.node,e);tT(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e,u):c.type.side>=0&&!f&&a.syncToMarks(u==this.node.childCount?we.none:this.node.child(u).marks,r,e,u),a.placeWidget(c,e,i)},(c,u,f,h)=>{a.syncToMarks(c.marks,r,e,h);let m;a.findNodeMatch(c,u,f,h)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(m=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,u,f,m,e)||a.updateNextNode(c,u,f,e,h,i)||a.addNode(c,u,f,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Ar)&&(s&&this.protectLocalComposition(e,s),jb(this.contentDOM,this.children,e),zi&&nT(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof X)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let s=o.nodeValue,l=rT(this.node.content,s,r-n,i-n);return l<0?null:{node:o,pos:l,text:s}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new td(this,o,n,i);e.input.compositionNodes.push(s),this.children=od(this.children,r,r+i.length,e,s)}update(e,n,r,i){return this.dirty==Yt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=jt}updateOuterDeco(e){if(Gl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=qb(this.dom,this.nodeDOM,rd(this.outerDeco,this.node,n),rd(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function ub(t,e,n,r,i){Vb(r,e,t);let o=new ir(void 0,t,e,n,r,r,r);return o.contentDOM&&o.updateChildren(i,0),o}var Kl=class t extends ir{constructor(e,n,r,i,o,s){super(e,n,r,i,o,null,s)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Yt||this.dirty!=jt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=jt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=jt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new t(this.parent,i,this.outerDeco,this.innerDeco,o,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Yt)}get domAtom(){return!1}isText(e){return this.node.text==e}},Jl=class extends Pr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==jt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},nd=class extends ir{constructor(e,n,r,i,o,s,l,a){super(e,n,r,i,o,s,l),this.spec=a}update(e,n,r,i){if(this.dirty==Yt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function jb(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=fb(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(s instanceof Ir){let a=r?r.previousSibling:t.lastChild;jb(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=fb(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}var Vo=function(t){t&&(this.nodeName=t)};Vo.prototype=Object.create(null);var Rr=[new Vo];function rd(t,e,n){if(t.length==0)return Rr;let r=n?Rr[0]:new Vo,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Vo(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&i.length==1&&i.push(r=new Vo(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function qb(t,e,n,r){if(n==Rr&&r==Rr)return e;let i=e;for(let o=0;o<r.length;o++){let s=r[o],l=n[o];if(o){let a;l&&l.nodeName==s.nodeName&&i!=t&&(a=i.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Rr[0]),i=a}QE(i,l||Rr[0],s)}return i}function QE(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Vb(t,e,n){return qb(t,t,Rr,rd(e,n,t.nodeType!=1))}function Gl(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function fb(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}var id=class{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=ZE(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let o=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;o<l&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=jt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;i<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof Ir&&u.dirty!=Yt&&u.mark.type==e[s].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[s])&&(u.mark=e[s],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=Ir.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))o=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let s=this.top.children[i];return s.dirty==Yt&&s.dom==s.contentDOM&&(s.dirty=Ar),s.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof ir){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)return!1;let u=a.dom,f,h=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Yt&&Gl(n,a.outerDeco));if(!h&&a.update(e,n,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(a,e,n,r,i,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Ar,f.updateChildren(i,s+1),f.dirty=jt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Gl(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=ir.create(this.top,n,r,i,o,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,i,o){let s=ir.create(this.top,e,n,r,i,o);s.contentDOM&&s.updateChildren(i,o+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Ul(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Ir;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Kl)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((at||Ge)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Jl(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function ZE(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Ir)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}function eT(t,e){return t.type.side-e.type.side}function tT(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,i,e.forChild(o,u),c),o+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,f;for(;s<i.length&&i[s].to==o;){let k=i[s++];k.widget&&(u?(f||(f=[u])).push(k):u=k)}if(u)if(f){f.sort(eT);for(let k=0;k<f.length;k++)n(f[k],c,!!a)}else n(u,c,!!a);let h,m;if(a)m=-1,h=a,a=null;else if(c<t.childCount)m=c,h=t.child(c++);else break;for(let k=0;k<l.length;k++)l[k].to<=o&&l.splice(k--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let y=o+h.nodeSize;if(h.isText){let k=y;s<i.length&&i[s].from<k&&(k=i[s].from);for(let S=0;S<l.length;S++)l[S].to<k&&(k=l[S].to);k<y&&(a=h.cut(k-o),h=h.cut(0,k-o),y=k,m=-1)}else for(;s<i.length&&i[s].to<y;)s++;let x=h.isInline&&!h.isLeaf?l.filter(k=>!k.inline):l.slice();r(h,x,e.forChild(o,h),m),o=y}}function nT(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function rT(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<t.childCount;){let c=t.child(i++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=n){if(o>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function od(t,e,n,r,i){let o=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,u=l+=a.size;c>=n||u<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),u>n&&o.push(a.slice(n-c,a.size,r)))}return o}function yd(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(ra(n)){for(a=s;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&Q.isSelectable(f)&&i.parent&&!(f.isInline&&OE(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;c=new Q(s==h?l:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,h=s;for(let m=0;m<n.rangeCount;m++){let y=n.getRangeAt(m);f=Math.min(f,t.docView.posFromDOM(y.startContainer,y.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(y.endContainer,y.endOffset,-1))}if(f<0)return null;[a,s]=h==t.state.selection.anchor?[h,f]:[f,h],l=r.resolve(s)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let f=e=="pointer"||t.state.selection.head<l.pos&&!o?1:-1;c=bd(t,u,l,f)}return c}function Wb(t){return t.editable?t.hasFocus():Kb(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Bn(t,e=!1){let n=t.state.selection;if(Ub(t,n),!Wb(t))return;let r=t.input.mouseDown;if(!e&&Ge&&r){let i=t.domSelectionRange(),o=t.domObserver.currentSelection;if(i.anchorNode&&o.anchorNode&&Dr(i.anchorNode,i.anchorOffset,o.anchorNode,o.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)oT(t);else{let{anchor:i,head:o}=n,s,l;db&&!(n instanceof X)&&(n.$from.parent.inlineContent||(s=hb(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=hb(t,n.to))),t.docView.setSelection(i,o,t,e),db&&(s&&pb(s),l&&pb(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&iT(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}var db=at||Ge&&Db<63;function hb(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(at&&i&&i.contentEditable=="false")return Kf(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return Kf(i);if(o)return Kf(o)}}function Kf(t){return t.contentEditable="true",at&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function pb(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function iT(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Wb(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function oT(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,nt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Mt&&rr<=11&&(n.disabled=!0,n.disabled=!1)}function Ub(t,e){if(e instanceof Q){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(mb(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else mb(t)}function mb(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function bd(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||X.between(e,n,r)}function gb(t){return t.editable&&!t.hasFocus()?!1:Kb(t)}function Kb(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function sT(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Dr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function sd(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&ee.findFrom(o,e)}function nr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function yb(t,e,n){let r=t.state.selection;if(r instanceof X)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let s=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return nr(t,new X(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=sd(t.state,e);return i&&i instanceof Q?nr(t,i):!1}else if(!($t&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let l=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?Q.isSelectable(o)?nr(t,new Q(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Yo?nr(t,new X(t.state.doc.resolve(e<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Q&&r.node.isInline)return nr(t,new X(e>0?r.$to:r.$from));{let i=sd(t.state,e);return i?nr(t,i):!1}}}function Xl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Wo(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Oi(t,e){return e<0?lT(t):aT(t)}function lT(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;for(Ht&&n.nodeType==1&&r<Xl(n)&&Wo(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(Wo(l,-1))i=n,o=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(Jb(n))break;{let l=n.previousSibling;for(;l&&Wo(l,-1);)i=n.parentNode,o=nt(l),l=l.previousSibling;if(l)n=l,r=Xl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?ld(t,n,r):i&&ld(t,i,o)}function aT(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Xl(n),o,s;for(;;)if(r<i){if(n.nodeType!=1)break;let l=n.childNodes[r];if(Wo(l,1))o=n,s=++r;else break}else{if(Jb(n))break;{let l=n.nextSibling;for(;l&&Wo(l,1);)o=l.parentNode,s=nt(l)+1,l=l.nextSibling;if(l)n=l,r=0,i=Xl(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&ld(t,o,s)}function Jb(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function cT(t,e){for(;t&&e==t.childNodes.length&&!Xo(t);)e=nt(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function uT(t,e){for(;t&&!e&&!Xo(t);)e=nt(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function ld(t,e,n){if(e.nodeType!=3){let o,s;(s=cT(e,n))?(e=s,n=0):(o=uT(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(ra(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Bn(t)},50)}function bb(t,e){let n=t.state.doc.resolve(e);if(!(Ge||Pb)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),s=(o.top+o.bottom)/2;if(s>i.top&&s<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function xb(t,e,n){let r=t.state.selection;if(r instanceof X&&!r.empty||n.indexOf("s")>-1||$t&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=sd(t.state,e);if(s&&s instanceof Q)return nr(t,s)}if(!i.parent.inlineContent){let s=e<0?i:o,l=r instanceof gt?ee.near(s,e):ee.findFrom(s,e);return l?nr(t,l):!1}return!1}function kb(t,e){if(!(t.state.selection instanceof X))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let s=t.state.tr;return e<0?s.delete(n.pos-o.nodeSize,n.pos):s.delete(n.pos,n.pos+o.nodeSize),t.dispatch(s),!0}return!1}function wb(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function fT(t){if(!at||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;wb(t,r,"true"),setTimeout(()=>wb(t,r,"false"),20)}return!1}function dT(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function hT(t,e){let n=e.keyCode,r=dT(e);if(n==8||$t&&n==72&&r=="c")return kb(t,-1)||Oi(t,-1);if(n==46&&!e.shiftKey||$t&&n==68&&r=="c")return kb(t,1)||Oi(t,1);if(n==13||n==27)return!0;if(n==37||$t&&n==66&&r=="c"){let i=n==37?bb(t,t.state.selection.from)=="ltr"?-1:1:-1;return yb(t,i,r)||Oi(t,i)}else if(n==39||$t&&n==70&&r=="c"){let i=n==39?bb(t,t.state.selection.from)=="ltr"?1:-1:1;return yb(t,i,r)||Oi(t,i)}else{if(n==38||$t&&n==80&&r=="c")return xb(t,-1,r)||Oi(t,-1);if(n==40||$t&&n==78&&r=="c")return fT(t)||xb(t,1,r)||Oi(t,1);if(r==($t?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function xd(t,e){t.someProp("transformCopied",m=>{e=m(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let m=r.firstChild;n.push(m.type.name,m.attrs!=m.type.defaultAttrs?m.attrs:null),r=m.content}let s=t.someProp("clipboardSerializer")||Rn.fromSchema(t.state.schema),l=ex(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=Zb[c.nodeName.toLowerCase()]);){for(let m=u.length-1;m>=0;m--){let y=l.createElement(u[m]);for(;a.firstChild;)y.appendChild(a.firstChild);a.appendChild(y),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",m=>m(e,t))||e.content.textBetween(0,e.content.size,`
|
|
1378
|
+
|
|
1379
|
+
`);return{dom:a,text:h,slice:e}}function Gb(t,e,n,r,i){let o=i.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=!!e&&(r||o||!n);if(a){if(t.someProp("transformPastedText",h=>{e=h(e,o||r,t)}),o)return l=new q(F.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
1380
|
+
`))),0,0),t.someProp("transformPasted",h=>{l=h(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(f)l=f;else{let h=i.marks(),{schema:m}=t.state,y=Rn.fromSchema(m);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(x=>{let k=s.appendChild(document.createElement("p"));x&&k.appendChild(y.serializeNode(m.text(x,h)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=yT(n),Yo&&bT(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=s.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;s=h}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||an.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!pT.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=xT(Sb(l,+u[1],+u[2]),u[4]);else if(l=q.maxOpen(mT(l.content,i),!0),l.openStart||l.openEnd){let f=0,h=0;for(let m=l.content.firstChild;f<l.openStart&&!m.type.spec.isolating;f++,m=m.firstChild);for(let m=l.content.lastChild;h<l.openEnd&&!m.type.spec.isolating;h++,m=m.lastChild);l=Sb(l,f,h)}return t.someProp("transformPasted",f=>{l=f(l,t,a)}),l}var pT=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function mT(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,s=[];if(t.forEach(l=>{if(!s)return;let a=i.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&o.length&&Yb(a,o,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Qb(s[s.length-1],o.length));let u=Xb(l,a);s.push(u),i=i.matchType(u.type),o=a}}),s)return F.from(s)}return t}function Xb(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,F.from(t));return t}function Yb(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=Yb(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(F.from(Xb(n,t,i+1))))}}function Qb(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Qb(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(F.empty,!0);return t.copy(n.append(r))}function ad(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(o=0),i<r-1&&(l=ad(l,e,n,r,i+1,o)),i>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(F.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Sb(t,e,n){return e<t.openStart&&(t=new q(ad(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new q(ad(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}var Zb={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function ex(){return document.implementation.createHTMLDocument("title")}var Jf=null;function gT(t){let e=window.trustedTypes;return e?(Jf||(Jf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Jf.createHTML(t)):t}function yT(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=ex(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),o;if((o=i&&Zb[i[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),r.innerHTML=gT(t),o)for(let s=0;s<o.length;s++)r=r.querySelector(o[s])||r;for(let s=0;s<n.styleSheets.length;s++){let l=n.styleSheets[s];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let f=0;f<u.length;f++)u[f].style.cssText+=c.style.cssText}}}return r}function bT(t){let e=t.querySelectorAll(Ge?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function xT(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:o,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=F.from(a.create(r[l+1],i)),o++,s++}return new q(i,o,s)}var yt={},bt={},kT={touchstart:!0,touchmove:!0},cd=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function wT(t){for(let e in yt){let n=yt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{vT(t,r)&&!kd(t,r)&&(t.editable||!(r.type in bt))&&n(t,r)},kT[e]?{passive:!0}:void 0)}at&&t.dom.addEventListener("input",()=>null),ud(t)}function zn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function ST(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ud(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>kd(t,r))})}function kd(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function vT(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function CT(t,e){!kd(t,e)&&yt[e.type]&&(t.editable||!(e.type in bt))&&yt[e.type](t,e)}bt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!rx(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Pn&&Ge&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),zi&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Mr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||hT(t,n)?n.preventDefault():zn(t,"key")};bt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};bt.keypress=(t,e)=>{let n=e;if(rx(t)||!n.charCode||n.ctrlKey&&!n.altKey||$t&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof X)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function Qo(t){return{left:t.clientX,top:t.clientY}}function ET(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function wd(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,l=>s>o.depth?l(t,n,o.nodeAfter,o.before(s),i,!0):l(t,n,o.node(s),o.before(s),i,!1)))return!0;return!1}function Zo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function TT(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Q.isSelectable(r)?(Zo(t,new Q(n),"pointer"),!0):!1}function MT(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Q&&(r=n.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s);if(Q.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(s);break}}return i!=null?(Zo(t,Q.create(t.state.doc,i),"pointer"),!0):!1}function AT(t,e,n,r,i){return wd(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?MT(t,n):TT(t,n))}function RT(t,e,n,r){return wd(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function IT(t,e,n,r){return wd(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||LT(t,n,r)}function LT(t,e,n){if(n.button!=0)return!1;let r=tx(t,e,!0),i=t.state.doc;return r?(Zo(t,r,"pointer"),r instanceof X&&i.eq(t.state.doc)&&(t.input.mouseDown=new dd(t,r)),!0):!1}function tx(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?X.create(r,0,r.content.size):null;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),l=i.before(o);if(s.inlineContent)return X.create(r,l+1,l+1+s.content.size);if(n&&Q.isSelectable(s))return Q.create(r,l)}return null}function Sd(t){return Ql(t)}var nx=$t?"metaKey":"ctrlKey";yt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Sd(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&ET(n,t.input.lastClick)&&!n[nx]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let s=t.posAtCoords(Qo(n));s&&(o=="singleClick"?t.input.mouseDown=new fd(t,s,n,!!r):(o=="doubleClick"?RT:IT)(t,s.pos,s.inside,n)?n.preventDefault():zn(t,"pointer"))};var Yl=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},fd=class extends Yl{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[nx],this.allowDefault=r.shiftKey;let o,s;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);o=u.parent,s=u.depth?u.before():0}let l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof Q&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ht&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),zn(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Bn(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Qo(e))),this.updateAllowDefault(e),this.allowDefault||!n?zn(this.view,"pointer"):AT(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||at&&this.mightDrag&&!this.mightDrag.node.isAtom||Ge&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Zo(this.view,ee.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):zn(this.view,"pointer")}move(e){this.updateAllowDefault(e),zn(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},dd=class extends Yl{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),zn(this.view,"pointer");let n=this.view.posAtCoords(Qo(e)),r=n&&tx(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,o=this.startSelection,[s,l]=r.from<o.from?[o.to,r.from]:[o.from,r.to];Zo(this.view,X.create(i,s,l),"pointer")}};yt.touchstart=t=>{t.input.lastTouch=Date.now(),Sd(t),zn(t,"pointer")};yt.touchmove=t=>{t.input.lastTouch=Date.now(),zn(t,"pointer")};yt.contextmenu=t=>Sd(t);function rx(t,e){return t.composing?!0:at&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var NT=Pn?5e3:-1;bt.compositionstart=bt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof X&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ge&&Pb&&OT(t)))t.markCursor=t.state.storedMarks||n.marks(),Ql(t,!0),t.markCursor=null;else if(Ql(t,!e.selection.empty),Ht&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else i=s,o=-1}}t.input.composing=!0}ix(t,NT)};function OT(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}bt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,ix(t,20))};function ix(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ql(t),e))}function ox(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function DT(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=LE(e.focusNode,e.focusOffset),r=NE(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function Ql(t,e=!1){if(!(Pn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),ox(t),e||t.docView&&t.docView.dirty){let n=yd(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function PT(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}var Uo=Mt&&rr<15||zi&&zE<604;yt.copy=bt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=Uo?null:n.clipboardData,s=r.content(),{dom:l,text:a}=xd(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):PT(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function zT(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function BT(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ko(t,r.value,null,i,e):Ko(t,r.textContent,r.innerHTML,i,e)},50)}function Ko(t,e,n,r,i){let o=Gb(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,i,o||q.empty)))return!0;if(!o)return!1;let s=zT(o),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function sx(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}bt.paste=(t,e)=>{let n=e;if(t.composing&&!Pn)return;let r=Uo?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ko(t,sx(r),r.getData("text/html"),i,n)?n.preventDefault():BT(t,n)};var Zl=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},FT=$t?"altKey":"ctrlKey";function lx(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[FT]}yt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords(Qo(n)),s;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Q?i.to-1:i.to))){if(r&&r.mightDrag)s=Q.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=Q.create(t.state.doc,f.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:u}=xd(t,l);(!n.dataTransfer.files.length||!Ge||Db>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Uo?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Uo||n.dataTransfer.setData("text/plain",c),t.dragging=new Zl(u,lx(t,n),s)};yt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};bt.dragover=bt.dragenter=(t,e)=>e.preventDefault();bt.drop=(t,e)=>{try{$T(t,e,t.dragging)}finally{t.dragging=null}};function $T(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Qo(e));if(!r)return;let i=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",m=>{o=m(o,t,!1)}):o=Gb(t,sx(e.dataTransfer),Uo?null:e.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&lx(t,e));if(t.someProp("handleDrop",m=>m(t,e,o||q.empty,s))){e.preventDefault();return}if(!o)return;e.preventDefault();let l=o?jl(t.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let a=t.state.tr;if(s){let{node:m}=n;m?m.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=a.doc;if(u?a.replaceRangeWith(c,c,o.content.firstChild):a.replaceRange(c,c,o),a.doc.eq(f))return;let h=a.doc.resolve(c);if(u&&Q.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))a.setSelection(new Q(h));else{let m=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((y,x,k,S)=>m=S),a.setSelection(bd(t,h,a.doc.resolve(m)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}yt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Bn(t)},20))};yt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};yt.beforeinput=(t,e)=>{if(Ge&&Pn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Mr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in bt)yt[t]=bt[t];function Jo(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}var ea=class t{constructor(e,n){this.toDOM=e,this.spec=n||Nr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:s}=e.mapResult(n.from+i,this.side<0?-1:1);return s?null:new Ce(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof t&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Jo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Lr=class t{constructor(e,n){this.attrs=e,this.spec=n||Nr}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new Ce(o,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof t&&Jo(this.attrs,e.attrs)&&Jo(this.spec,e.spec)}static is(e){return e.type instanceof t}destroy(){}},hd=class t{constructor(e,n){this.attrs=e,this.spec=n||Nr}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let s=e.mapResult(n.to+i,-1);return s.deleted||s.pos<=o.pos?null:new Ce(o.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof t&&Jo(this.attrs,e.attrs)&&Jo(this.spec,e.spec)}destroy(){}},Ce=class t{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new t(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new t(e,e,new ea(n,r))}static inline(e,n,r,i){return new t(e,n,new Lr(r,i))}static node(e,n,r,i){return new t(e,n,new hd(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Lr}get widget(){return this.type instanceof ea}},Di=[],Nr={},ae=class t{constructor(e,n){this.local=e.length?e:Di,this.children=n.length?n:Di}static create(e,n){return n.length?na(n,e,0,Nr):lt}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!o||o(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,i+l,o)}}map(e,n,r){return this==lt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Nr)}mapInner(e,n,r,i,o){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(n,a)?(s||(s=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?_T(this.children,s||[],e,n,r,i,o):s?new t(s.sort(Or),Di):lt}add(e,n){return n.length?this==lt?t.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((l,a)=>{let c=a+r,u;if(u=cx(n,l,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<a;)o+=3;i[o]==a?i[o+2]=i[o+2].addInner(l,u,c+1):i.splice(o,0,a,a+l.nodeSize,na(u,l,c+1,Nr)),o+=3}});let s=ax(o?ux(n):n,-r);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new t(s.length?this.local.concat(s).sort(Or):this.local,i||this.children)}remove(e){return e.length==0||this==lt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,l=r[o]+n,a=r[o+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<a&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,l+1);c!=lt?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<e.length;o++)if(s=e[o])for(let l=0;l<i.length;l++)i[l].eq(s,n)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new t(i,r):lt}forChild(e,n){if(this==lt)return this;if(n.isLeaf)return t.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let o=e+1,s=o+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>o&&a.type instanceof Lr){let c=Math.max(o,a.from)-o,u=Math.min(s,a.to)-o;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new t(i.sort(Or),Di);return r?new ta([l,r]):l}return r||lt}eq(e){if(this==e)return!0;if(!(e instanceof t)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return vd(this.localsInner(e))}localsInner(e){if(this==lt)return Di;if(e.inlineContent||!this.local.some(Lr.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Lr||n.push(this.local[r]);return n}forEachSet(e){e(this)}};ae.empty=new ae([],[]);ae.removeOverlap=vd;var lt=ae.empty,ta=class t{constructor(e){this.members=e}map(e,n){let r=this.members.map(i=>i.map(e,n,Nr));return t.from(r)}forChild(e,n){if(n.isLeaf)return ae.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=lt&&(o instanceof t?r=r.concat(o.members):r.push(o))}return t.from(r)}eq(e){if(!(e instanceof t)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let s=0;s<o.length;s++)n.push(o[s])}}return n?vd(r?n:n.sort(Or)):Di}static from(e){switch(e.length){case 0:return lt;case 1:return e[0];default:return new t(e.every(n=>n instanceof ae)?e:e.reduce((n,r)=>n.concat(r instanceof ae?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function _T(t,e,n,r,i,o,s){let l=t.slice();for(let c=0,u=o;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,m,y,x)=>{let k=x-y-(m-h);for(let S=0;S<l.length;S+=3){let R=l[S+1];if(R<0||h>R+u-f)continue;let M=l[S]+u-f;m>=M?l[S+1]=h<=M?-2:-1:h>=u&&k&&(l[S]+=k,l[S+1]+=k)}f+=k}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+o),f=u-i;if(f<0||f>=r.content.size){a=!0;continue}let h=n.map(t[c+1]+o,-1),m=h-i,{index:y,offset:x}=r.content.findIndex(f),k=r.maybeChild(y);if(k&&x==f&&x+k.nodeSize==m){let S=l[c+2].mapInner(n,k,u+1,t[c]+o+1,s);S!=lt?(l[c]=f,l[c+1]=m,l[c+2]=S):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=HT(l,t,e,n,i,o,s),u=na(c,r,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let m=u.children[f];for(;h<l.length&&l[h]<m;)h+=3;l.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ae(e.sort(Or),l)}function ax(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Ce(i.from+e,i.to+e,i.type))}return n}function HT(t,e,n,r,i,o,s){function l(a,c){for(let u=0;u<a.local.length;u++){let f=a.local[u].map(r,i,c);f?n.push(f):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+o+1);return n}function cx(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,s;o<t.length;o++)(s=t[o])&&s.from>n&&s.to<r&&((i||(i=[])).push(s),t[o]=null);return i}function ux(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function na(t,e,n,r){let i=[],o=!1;e.forEach((l,a)=>{let c=cx(t,l,a+n);if(c){o=!0;let u=na(c,l,n+a+1,r);u!=lt&&i.push(a,a+l.nodeSize,u)}});let s=ax(o?ux(t):t,-n).sort(Or);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||i.length?new ae(s,i):lt}function Or(t,e){return t.from-e.from||t.to-e.to}function vd(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),vb(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),vb(e,i,r.copy(o.from,r.to)));break}}}return e}function vb(t,e,n){for(;e<t.length&&Or(n,t[e])>0;)e++;t.splice(e,0,n)}function Gf(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=lt&&e.push(r)}),t.cursorWrapper&&e.push(ae.create(t.state.doc,[t.cursorWrapper.deco])),ta.from(e)}var jT={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},qT=Mt&&rr<=11,pd=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},md=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new pd,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Mt&&rr<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():at&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),qT&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,jT)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(gb(this.view)){if(this.suppressingSelectionUpdates)return Bn(this.view);if(Mt&&rr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Dr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=Pi(o))n.add(o);for(let o=e.anchorNode;o;o=Pi(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&gb(e)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],a);f&&(o=o<0?f.from:Math.min(f.from,o),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||Ge&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;for(;f&&f.nodeType==1;){if(f.contentEditable=="false"){u.parentNode.removeChild(u);break}f=f.firstChild}}}else if(Ht&&a.length){let u=a.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let m=h.parentNode;m&&m.nodeName=="LI"&&(!f||UT(e,f)!=m)&&h.remove()}}}let c=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ra(r)&&(c=yd(e))&&c.eq(ee.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Bn(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,s),VT(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,KT(e,a)),this.handleDOMChange(o,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Bn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(Mt&&rr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==e.target?nt(i)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=o&&o.parentNode==e.target?nt(o):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},Cb=new WeakMap,Eb=!1;function VT(t){if(!Cb.has(t)&&(Cb.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Ht,Eb)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Eb=!0}}function Tb(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Dr(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function WT(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Tb(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Tb(t,n):null}function UT(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function KT(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let o of e)if(((n=o.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=o.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(o,l.firstChild),r==o&&t.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}function JT(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:s,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),c,u=a.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],ra(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Ge&&t.input.lastKeyCode===8)for(let k=o;k>i;k--){let S=r.childNodes[k-1],R=S.pmViewDesc;if(S.nodeName=="BR"&&!R){o=k;break}if(!R||R.size)break}let f=t.state.doc,h=t.someProp("domParser")||an.fromSchema(t.state.schema),m=f.resolve(s),y=null,x=h.parse(r,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:i,to:o,preserveWhitespace:m.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:GT,context:m});if(c&&c[0].pos!=null){let k=c[0].pos,S=c[1]&&c[1].pos;S==null&&(S=k),y={anchor:k+s,head:S+s}}return{doc:x,sel:y,from:s,to:l}}function GT(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(at&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||at&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}var XT=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function YT(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let P=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,$=yd(t,P);if($&&!t.state.selection.eq($)){if(Ge&&Pn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",g=>g(t,Mr(13,"Enter"))))return;let j=t.state.tr.setSelection($);P=="pointer"?j.setMeta("pointer",!0):P=="key"&&j.scrollIntoView(),o&&j.setMeta("composition",o),t.dispatch(j)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=JT(t,e,n),u=t.state.doc,f=u.slice(c.from,c.to),h,m;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,m="end"):(h=t.state.selection.from,m="start"),t.input.lastKeyCode=null;let y=eM(f.content,c.doc.content,c.from,h,m);if(y&&t.input.domChangeCount++,(zi&&t.input.lastIOSEnter>Date.now()-225||Pn)&&i.some(P=>P.nodeType==1&&!XT.test(P.nodeName))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",P=>P(t,Mr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!y)if(r&&a instanceof X&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))y={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let P=Mb(t,t.state.doc,c.sel);if(P&&!P.eq(t.state.selection)){let $=t.state.tr.setSelection(P);o&&$.setMeta("composition",o),t.dispatch($)}}return}t.state.selection.from<t.state.selection.to&&y.start==y.endB&&t.state.selection instanceof X&&(y.start>t.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?y.start=t.state.selection.from:y.endA<t.state.selection.to&&y.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),Mt&&rr<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>c.from&&c.doc.textBetween(y.start-c.from-1,y.start-c.from+1)==" "&&(y.start--,y.endA--,y.endB--);let x=c.doc.resolveNoCache(y.start-c.from),k=c.doc.resolveNoCache(y.endB-c.from),S=u.resolve(y.start),R=x.sameParent(k)&&x.parent.inlineContent&&S.end()>=y.endA;if((zi&&t.input.lastIOSEnter>Date.now()-225&&(!R||i.some(P=>P.nodeName=="DIV"||P.nodeName=="P"))||!R&&x.pos<c.doc.content.size&&(!x.sameParent(k)||!x.parent.inlineContent)&&x.pos<k.pos&&!/\S/.test(c.doc.textBetween(x.pos,k.pos,"","")))&&t.someProp("handleKeyDown",P=>P(t,Mr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>y.start&&ZT(u,y.start,y.endA,x,k)&&t.someProp("handleKeyDown",P=>P(t,Mr(8,"Backspace")))){Pn&&Ge&&t.domObserver.suppressSelectionUpdates();return}Ge&&y.endB==y.start&&(t.input.lastChromeDelete=Date.now()),Pn&&!R&&x.start()!=k.start()&&k.parentOffset==0&&x.depth==k.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==y.endA&&(y.endB-=2,k=c.doc.resolveNoCache(y.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(P){return P(t,Mr(13,"Enter"))})},20));let M=y.start,N=y.endA,z=P=>{let $=P||t.state.tr.replace(M,N,c.doc.slice(y.start-c.from,y.endB-c.from));if(c.sel){let j=Mb(t,$.doc,c.sel);j&&!(Ge&&t.composing&&j.empty&&(y.start!=y.endB||t.input.lastChromeDelete<Date.now()-100)&&(j.head==M||j.head==$.mapping.map(N)-1)||Mt&&j.empty&&j.head==M)&&$.setSelection(j)}return o&&$.setMeta("composition",o),$.scrollIntoView()},T;if(R)if(x.pos==k.pos){Mt&&rr<=11&&x.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Bn(t),20));let P=z(t.state.tr.delete(M,N)),$=u.resolve(y.start).marksAcross(u.resolve(y.endA));$&&P.ensureMarks($),t.dispatch(P)}else if(y.endA==y.endB&&(T=QT(x.parent.content.cut(x.parentOffset,k.parentOffset),S.parent.content.cut(S.parentOffset,y.endA-S.start())))){let P=z(t.state.tr);T.type=="add"?P.addMark(M,N,T.mark):P.removeMark(M,N,T.mark),t.dispatch(P)}else if(x.parent.child(x.index()).isText&&x.index()==k.index()-(k.textOffset?0:1)){let P=x.parent.textBetween(x.parentOffset,k.parentOffset),$=()=>z(t.state.tr.insertText(P,M,N));t.someProp("handleTextInput",j=>j(t,M,N,P,$))||t.dispatch($())}else t.dispatch(z());else t.dispatch(z())}function Mb(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:bd(t,e.resolve(n.anchor),e.resolve(n.head))}function QT(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,s,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<n.length;u++)o=n[u].removeFromSet(o);if(i.length==1&&o.length==0)l=i[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&o.length==1)l=o[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(F.from(c).eq(t))return{mark:l,type:s}}function ZT(t,e,n,r,i){if(n-e<=i.pos-r.pos||Xf(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&n==e+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(Xf(o,!0,!0));return!s.parent.isTextblock||s.pos>n||Xf(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Xf(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function eM(t,e,n,r,i){let o=t.findDiffStart(e,n),s=n+t.size,l=n+e.size;if(o==null)return null;let{a,b:c}=t.findDiffEnd(e,s,l);if(i=="end"){let u=Math.max(0,o-Math.min(a,c));r-=a+u-o}if(a<o&&s<l){let u=r<=o&&r>=a?o-r:0;o-=u,c=o+(c-a),a=o}else if(c<o){let u=r<=o&&r>=c?o-r:0;o-=u,a=o+(a-c),c=o}return{start:o,endA:a,endB:c}}var Go=class{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new cd,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Nb),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ib(this),Rb(this),this.nodeViews=Lb(this),this.docView=ub(this.state.doc,Ab(this),Gf(this),this.dom,this),this.domObserver=new md(this,(r,i,o,s)=>YT(this,r,i,o,s)),this.domObserver.start(),wT(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ud(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Nb),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,s=!1;e.storedMarks&&this.composing&&(ox(this),s=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let m=Lb(this);nM(m,this.nodeViews)&&(this.nodeViews=m,o=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&ud(this),this.editable=Ib(this),Rb(this);let a=Gf(this),c=Ab(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(e.doc,c,a);(f||!e.selection.eq(i.selection))&&(s=!0);let h=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&$E(this);if(s){this.domObserver.stop();let m=f&&(Mt||Ge)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&tM(i.selection,e.selection);if(f){let x=Ge?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=DT(this)),(o||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ub(e.doc,c,a,this.dom,this)),x&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(m=!0)}let y=this.input.mouseDown;m||!(y&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&sT(this)&&y.delaySelUpdate())?Bn(this,m):(Ub(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&_E(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Q){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&ib(this,n.getBoundingClientRect(),e)}else ib(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&o<this.state.doc.content.size&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Zl(e.slice,e.move,i<0?void 0:Q.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(i=n?n(l):l))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let l=o[s].props[e];if(l!=null&&(i=n?n(l):l))return i}}hasFocus(){if(Mt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&HE(this.dom),Bn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return UE(this,e)}coordsAtPos(e,n=1){return _b(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return YE(this,n||this.state,e)}pasteHTML(e,n){return Ko(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ko(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return xd(this,e)}destroy(){this.docView&&(ST(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Gf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,RE())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return CT(this,e)}domSelectionRange(){let e=this.domSelection();return e?at&&this.root.nodeType===11&&DE(this.dom.ownerDocument)==this.dom&&WT(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Go.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Ab(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Ce.node(0,t.state.doc.content.size,e)]}function Rb(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Ce.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Ib(t){return!t.someProp("editable",e=>e(t.state)===!1)}function tM(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Lb(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function nM(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Nb(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Fn={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},oa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},rM=typeof navigator<"u"&&/Mac/.test(navigator.platform),iM=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(_e=0;_e<10;_e++)Fn[48+_e]=Fn[96+_e]=String(_e);var _e;for(_e=1;_e<=24;_e++)Fn[_e+111]="F"+_e;var _e;for(_e=65;_e<=90;_e++)Fn[_e]=String.fromCharCode(_e+32),oa[_e]=String.fromCharCode(_e);var _e;for(ia in Fn)oa.hasOwnProperty(ia)||(oa[ia]=Fn[ia]);var ia;function fx(t){var e=rM&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||iM&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?oa:Fn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}var oM=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),sM=typeof navigator<"u"&&/Win/.test(navigator.platform);function lM(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))oM?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),s&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function aM(t){let e=Object.create(null);for(let n in t)e[lM(n)]=t[n];return e}function Cd(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function dx(t){return new Y({props:{handleKeyDown:es(t)}})}function es(t){let e=aM(t);return function(n,r){let i=fx(r),o,s=e[Cd(i,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[Cd(i,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(sM&&r.ctrlKey&&r.altKey)&&(o=Fn[r.keyCode])&&o!=i){let l=e[Cd(o,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var cM=Object.defineProperty,Id=(t,e)=>{for(var n in e)cM(t,n,{get:e[n],enumerable:!0})};function ha(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var pa=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...c)=>{let u=l(...c)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],l=!!t,a=t||i.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(a),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(n).map(([f,h])=>[f,(...y)=>{let x=this.buildProps(a,e),k=h(...y)(x);return s.push(k),u}])),run:c};return u}createCan(t){let{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,o=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:t,editor:r,view:o,state:ha({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)(s)]))}};return s}},Cx={};Id(Cx,{blur:()=>uM,clearContent:()=>fM,clearNodes:()=>dM,command:()=>hM,createParagraphNear:()=>pM,cut:()=>mM,deleteCurrentNode:()=>gM,deleteNode:()=>yM,deleteRange:()=>bM,deleteSelection:()=>wM,enter:()=>SM,exitCode:()=>vM,extendMarkRange:()=>CM,first:()=>EM,focus:()=>MM,forEach:()=>AM,insertContent:()=>RM,insertContentAt:()=>NM,joinBackward:()=>PM,joinDown:()=>DM,joinForward:()=>zM,joinItemBackward:()=>BM,joinItemForward:()=>FM,joinTextblockBackward:()=>$M,joinTextblockForward:()=>_M,joinUp:()=>OM,keyboardShortcut:()=>jM,lift:()=>qM,liftEmptyBlock:()=>VM,liftListItem:()=>WM,newlineInCode:()=>UM,resetAttributes:()=>KM,scrollIntoView:()=>JM,selectAll:()=>GM,selectNodeBackward:()=>XM,selectNodeForward:()=>YM,selectParentNode:()=>QM,selectTextblockEnd:()=>ZM,selectTextblockStart:()=>eA,setContent:()=>tA,setMark:()=>yA,setMeta:()=>bA,setNode:()=>xA,setNodeSelection:()=>kA,setTextDirection:()=>wA,setTextSelection:()=>SA,sinkListItem:()=>vA,splitBlock:()=>CA,splitListItem:()=>EA,toggleList:()=>MA,toggleMark:()=>AA,toggleNode:()=>RA,toggleWrap:()=>IA,undoInputRule:()=>LA,unsetAllMarks:()=>NA,unsetMark:()=>OA,unsetTextDirection:()=>DA,updateAttributes:()=>PA,wrapIn:()=>zA,wrapInList:()=>BA});var uM=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),fM=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),dM=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:s})=>{t.doc.nodesBetween(o.pos,s.pos,(l,a)=>{if(l.type.isText)return;let{doc:c,mapping:u}=e,f=c.resolve(u.map(a)),h=c.resolve(u.map(a+l.nodeSize)),m=f.blockRange(h);if(!m)return;let y=Nn(m);if(l.type.isTextblock){let{defaultType:x}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(m.start,x)}(y||y===0)&&e.lift(m,y)})}),!0},hM=t=>e=>t(e),pM=()=>({state:t,dispatch:e})=>_f(t,e),mM=(t,e)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,o.content),r.setSelection(new X(r.doc.resolve(Math.max(s-1,0)))),!0},gM=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;let i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){let l=i.before(o),a=i.after(o);t.delete(l,a).scrollIntoView()}return!0}return!1};function Oe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var yM=t=>({tr:e,state:n,dispatch:r})=>{let i=Oe(t,n.schema),o=e.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){let a=o.before(s),c=o.after(s);e.delete(a,c).scrollIntoView()}return!0}return!1},bM=t=>({tr:e,dispatch:n})=>{let{from:r,to:i}=t;return n&&e.delete(r,i),!0},xM=t=>t.content?/^text(\*|\+)/.test(t.content):!1,hx=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;let r=e.nodes[t.parent.type.name].spec;return xM(r)?n==="left"?t.start()-1:t.end()+1:t.pos},kM=(t,e,n)=>{let r=hx(t,n,"left"),i=hx(e,n,"right");return{from:r,to:i}},wM=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){let n=t.tr,{ranges:r}=t.selection,i=n.steps.length;r.forEach(o=>{let s=n.mapping.slice(i),l=n.doc.resolve(s.map(o.$from.pos)),a=n.doc.resolve(s.map(o.$to.pos)),{from:c,to:u}=kM(l,a,t.schema);n.deleteRange(c,u)}),n.scrollIntoView(),e(n)}return!0},SM=()=>({commands:t})=>t.keyboardShortcut("Enter"),vM=()=>({state:t,dispatch:e})=>$f(t,e);function Ld(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function fa(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Ld(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Ex(t,e,n={}){return t.find(r=>r.type===e&&fa(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function px(t,e,n={}){return!!Ex(t,e,n)}function Nd(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===e))return;if(!n){let c=r.node.marks.find(u=>u.type===e);c&&(n=c.attrs)}if(!Ex([...r.node.marks],e,n))return;let o=r.index,s=t.start()+r.offset,l=o+1,a=s+r.node.nodeSize;for(;o>0&&px([...t.parent.child(o-1).marks],e,n);)o-=1,s-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&px([...t.parent.child(l).marks],e,n);)a+=t.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function $n(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var CM=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=$n(t,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(i){let f=Nd(a,o,e);if(f&&f.from<=c&&f.to>=u){let h=X.create(s,f.from,f.to);n.setSelection(h)}}return!0},EM=t=>e=>{let n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Tx(t){return t instanceof X}function zr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Mx(t,e=null){if(!e)return null;let n=ee.atStart(t),r=ee.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;let i=n.from,o=r.to;return e==="all"?X.create(t,zr(0,i,o),zr(t.content.size,i,o)):X.create(t,zr(e,i,o),zr(e,i,o))}function mx(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function da(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function TM(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var MM=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};let s=()=>{(da()||mx())&&r.dom.focus(),TM()&&!da()&&!mx()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(o&&t===null&&!Tx(n.state.selection))return s(),!0;let l=Mx(i.doc,t)||n.state.selection,a=n.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},AM=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),RM=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),Ax=t=>{let e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){let r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&Ax(r)}return t};function sa(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return Ax(n)}function is(t,e,n){if(t instanceof Tt||t instanceof F)return t;n={slice:!0,parseOptions:{},...n};let r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return F.fromArray(t.map(l=>e.nodeFromJSON(l)));let s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),is("",e,n)}if(i){if(n.errorOnInvalidContent){let s=!1,l="",a=new Ei({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?an.fromSchema(a).parseSlice(sa(t),n.parseOptions):an.fromSchema(a).parse(sa(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let o=an.fromSchema(e);return n.slice?o.parseSlice(sa(t),n.parseOptions).content:o.parse(sa(t),n.parseOptions)}return is("",e,n)}function IM(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof tt||i instanceof $e))return;let o=t.mapping.maps[r],s=0;o.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(ee.near(t.doc.resolve(s),n))}var LM=t=>!("type"in t),NM=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l,a=k=>{o.emit("contentError",{editor:o,error:k,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{is(e,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(k){a(k)}try{l=is(e,o.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:o.options.enableContentCheck})}catch(k){return a(k),!1}let{from:u,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,m=!0;if((LM(l)?l:[l]).forEach(k=>{k.check(),h=h?k.isText&&k.marks.length===0:!1,m=m?k.isBlock:!1}),u===f&&m){let{parent:k}=r.doc.resolve(u);k.isTextblock&&!k.type.spec.code&&!k.childCount&&(u-=1,f+=1)}let x;if(h){if(Array.isArray(e))x=e.map(k=>k.text||"").join("");else if(e instanceof F){let k="";e.forEach(S=>{S.text&&(k+=S.text)}),x=k}else typeof e=="object"&&e&&e.text?x=e.text:x=e;r.insertText(x,u,f)}else{x=l;let k=r.doc.resolve(u),S=k.node(),R=k.parentOffset===0,M=S.isText||S.isTextblock,N=S.content.size>0;R&&M&&N&&m&&(u=Math.max(0,u-1)),r.replaceWith(u,f,x)}n.updateSelection&&IM(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:x}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:x})}return!0},OM=()=>({state:t,dispatch:e})=>Uy(t,e),DM=()=>({state:t,dispatch:e})=>Ky(t,e),PM=()=>({state:t,dispatch:e})=>Lf(t,e),zM=()=>({state:t,dispatch:e})=>Df(t,e),BM=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Er(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},FM=()=>({state:t,dispatch:e,tr:n})=>{try{let r=Er(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},$M=()=>({state:t,dispatch:e})=>jy(t,e),_M=()=>({state:t,dispatch:e})=>qy(t,e);function Rx(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function HM(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,s;for(let l=0;l<e.length-1;l+=1){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))da()||Rx()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}var jM=t=>({editor:e,view:n,tr:r,dispatch:i})=>{let o=HM(t).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{let u=c.map(r.mapping);u&&i&&r.maybeStep(u)}),!0};function un(t,e,n={}){let{from:r,to:i,empty:o}=t.selection,s=e?Oe(e,t.schema):null,l=[];t.doc.nodesBetween(r,i,(f,h)=>{if(f.isText)return;let m=Math.max(r,h),y=Math.min(i,h+f.nodeSize);l.push({node:f,from:m,to:y})});let a=i-r,c=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>fa(f.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((f,h)=>f+h.to-h.from,0)>=a}var qM=(t,e={})=>({state:n,dispatch:r})=>{let i=Oe(t,n.schema);return un(n,i,e)?Jy(n,r):!1},VM=()=>({state:t,dispatch:e})=>Hf(t,e),WM=t=>({state:e,dispatch:n})=>{let r=Oe(t,e.schema);return eb(r)(e,n)},UM=()=>({state:t,dispatch:e})=>Bf(t,e);function ma(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function gx(t,e){let n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var KM=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=ma(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(o=Oe(t,r.schema)),l==="mark"&&(s=$n(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,f)=>{o&&o===u.type&&(a=!0,i&&n.setNodeMarkup(f,void 0,gx(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(h=>{s===h.type&&(a=!0,i&&n.addMark(f,f+u.nodeSize,s.create(gx(h.attrs,e))))})})}),a},JM=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),GM=()=>({tr:t,dispatch:e})=>{if(e){let n=new gt(t.doc);t.setSelection(n)}return!0},XM=()=>({state:t,dispatch:e})=>Nf(t,e),YM=()=>({state:t,dispatch:e})=>Pf(t,e),QM=()=>({state:t,dispatch:e})=>Gy(t,e),ZM=()=>({state:t,dispatch:e})=>qf(t,e),eA=()=>({state:t,dispatch:e})=>jf(t,e);function Ad(t,e,n={},r={}){return is(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var tA=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{let{doc:a}=o;if(r.preserveWhitespace!=="full"){let c=Ad(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return s&&o.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function Ix(t,e){let n=$n(e,t.schema),{from:r,to:i,empty:o}=t.selection,s=[];o?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,a=>{s.push(...a.marks)});let l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function Od(t,e){let n=new Zn(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function nA(t){for(let e=0;e<t.edgeCount;e+=1){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Lx(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function Dd(t,e){for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ga(t){return e=>Dd(e.$from,t)}function Z(t,e,n){return t.config[e]===void 0&&t.parent?Z(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Z(t.parent,e,n):null}):t.config[e]}function Pd(t){return t.map(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=Z(e,"addExtensions",n);return r?[e,...Pd(r())]:e}).flat(10)}function zd(t,e){let n=Rn.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function Nx(t){return typeof t=="function"}function xe(t,e=void 0,...n){return Nx(t)?e?t.bind(e)(...n):t(...n):t}function rA(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Bi(t){let e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Ox(t){let e=[],{nodeExtensions:n,markExtensions:r}=Bi(t),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...s,...l];return t.forEach(c=>{let u={name:c.name,options:c.options,storage:c.storage,extensions:i},f=Z(c,"addGlobalAttributes",u);if(!f)return;f().forEach(m=>{let y;Array.isArray(m.types)?y=m.types:m.types==="*"?y=a:m.types==="nodes"?y=s:m.types==="marks"?y=l:y=[],y.forEach(x=>{Object.entries(m.attributes).forEach(([k,S])=>{e.push({type:x,name:k,attribute:{...o,...S}})})})})}),i.forEach(c=>{let u={name:c.name,options:c.options,storage:c.storage},f=Z(c,"addAttributes",u);if(!f)return;let h=f();Object.entries(h).forEach(([m,y])=>{let x={...o,...y};typeof x?.default=="function"&&(x.default=x.default()),x?.isRequired&&x?.default===void 0&&delete x.default,e.push({type:c.name,name:m,attribute:x})})}),e}function iA(t){let e=[],n="",r=!1,i=!1,o=0,s=t.length;for(let l=0;l<s;l+=1){let a=t[l];if(a==="'"&&!i){r=!r,n+=a;continue}if(a==='"'&&!r){i=!i,n+=a;continue}if(!r&&!i){if(a==="("){o+=1,n+=a;continue}if(a===")"&&o>0){o-=1,n+=a;continue}if(a===";"&&o===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function yx(t){let e=[],n=iA(t||""),r=n.length;for(let i=0;i<r;i+=1){let o=n[i],s=o.indexOf(":");if(s===-1)continue;let l=o.slice(0,s).trim(),a=o.slice(s+1).trim();l&&a&&e.push([l,a])}return e}function ce(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){let l=o?String(o).split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(u=>!a.includes(u));r[i]=[...a,...c].join(" ")}else if(i==="style"){let l=new Map([...yx(r[i]),...yx(o)]);r[i]=Array.from(l.entries()).map(([a,c])=>`${a}: ${c}`).join("; ")}else r[i]=o}),r},{})}function Fi(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>ce(n,r),{})}function oA(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function bx(t,e){return"style"in t?t:{...t,getAttrs:n=>{let r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;let i=e.reduce((o,s)=>{let l=s.attribute.parseHTML?s.attribute.parseHTML(n):oA(n.getAttribute(s.name));return l==null?o:{...o,[s.name]:l}},{});return{...r,...i}}}}function xx(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&rA(n)?!1:n!=null))}function kx(t){var e,n;let r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function sA(t,e){var n;let r=Ox(t),{nodeExtensions:i,markExtensions:o}=Bi(t),s=(n=i.find(c=>Z(c,"topNode")))==null?void 0:n.name,l=Object.fromEntries(i.map(c=>{let u=r.filter(S=>S.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((S,R)=>{let M=Z(R,"extendNodeSchema",f);return{...S,...M?M(c):{}}},{}),m=xx({...h,content:xe(Z(c,"content",f)),marks:xe(Z(c,"marks",f)),group:xe(Z(c,"group",f)),inline:xe(Z(c,"inline",f)),atom:xe(Z(c,"atom",f)),selectable:xe(Z(c,"selectable",f)),draggable:xe(Z(c,"draggable",f)),code:xe(Z(c,"code",f)),whitespace:xe(Z(c,"whitespace",f)),linebreakReplacement:xe(Z(c,"linebreakReplacement",f)),defining:xe(Z(c,"defining",f)),isolating:xe(Z(c,"isolating",f)),attrs:Object.fromEntries(u.map(kx))}),y=xe(Z(c,"parseHTML",f));y&&(m.parseDOM=y.map(S=>bx(S,u)));let x=Z(c,"renderHTML",f);x&&(m.toDOM=S=>x({node:S,HTMLAttributes:Fi(S,u)}));let k=Z(c,"renderText",f);return k&&(m.toText=k),[c.name,m]})),a=Object.fromEntries(o.map(c=>{let u=r.filter(k=>k.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((k,S)=>{let R=Z(S,"extendMarkSchema",f);return{...k,...R?R(c):{}}},{}),m=xx({...h,inclusive:xe(Z(c,"inclusive",f)),excludes:xe(Z(c,"excludes",f)),group:xe(Z(c,"group",f)),spanning:xe(Z(c,"spanning",f)),code:xe(Z(c,"code",f)),attrs:Object.fromEntries(u.map(kx))}),y=xe(Z(c,"parseHTML",f));y&&(m.parseDOM=y.map(k=>bx(k,u)));let x=Z(c,"renderHTML",f);return x&&(m.toDOM=k=>x({mark:k,HTMLAttributes:Fi(k,u)})),[c.name,m]}));return new Ei({topNode:s,nodes:l,marks:a})}function lA(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function rs(t){return t.sort((n,r)=>{let i=Z(n,"priority")||100,o=Z(r,"priority")||100;return i>o?-1:i<o?1:0})}function Dx(t){let e=rs(Pd(t)),n=lA(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Px(t,e,n){let{from:r,to:i}=e,{blockSeparator:o=`
|
|
1381
|
+
|
|
1382
|
+
`,textSerializers:s={}}=n||{},l="";return t.nodesBetween(r,i,(a,c,u,f)=>{var h;a.isBlock&&c>r&&(l+=o);let m=s?.[a.type.name];if(m)return u&&(l+=m({node:a,pos:c,parent:u,index:f,range:e})),!1;a.isText&&(l+=(h=a?.text)==null?void 0:h.slice(Math.max(r,c)-c,i-c))}),l}function aA(t,e){let n={from:0,to:t.content.size};return Px(t,n,e)}function zx(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function cA(t,e){let n=Oe(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,l=>{o.push(l)});let s=o.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Bd(t,e){let n=ma(typeof e=="string"?e:e.name,t.schema);return n==="node"?cA(t,e):n==="mark"?Ix(t,e):{}}function uA(t,e=JSON.stringify){let n={};return t.filter(r=>{let i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function fA(t){let e=uA(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,s)=>s!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function ss(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{let s=[];if(i.ranges.length)i.forEach((l,a)=>{s.push({from:l,to:a})});else{let{from:l,to:a}=n[o];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{let c=e.slice(o).map(l,-1),u=e.slice(o).map(a),f=e.invert().map(c,-1),h=e.invert().map(u);r.push({oldRange:{from:f,to:h},newRange:{from:c,to:u}})})}),fA(r)}function ya(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(i=>{let o=n.resolve(t),s=Nd(o,i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}var Bx=(t,e,n,r=20)=>{let i=t.doc.resolve(n),o=r,s=null;for(;o>0&&s===null;){let l=i.node(o);l?.type.name===e?s=l:o-=1}return[s,o]};function ts(t,e){return e.nodes[t]||e.marks[t]||null}function ua(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}var dA=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,s,l)=>{var a,c;let u=((c=(a=i.type.spec).toText)==null?void 0:c.call(a,{node:i,pos:o,parent:s,index:l}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?u:u.slice(0,Math.max(0,r-o))}),n};function Rd(t,e,n={}){let{empty:r,ranges:i}=t.selection,o=e?$n(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>fa(f.attrs,n,{strict:!1}));let s=0,l=[];if(i.forEach(({$from:f,$to:h})=>{let m=f.pos,y=h.pos;t.doc.nodesBetween(m,y,(x,k)=>{if(o&&x.inlineContent&&!x.type.allowsMarkType(o))return!1;if(!x.isText&&!x.marks.length)return;let S=Math.max(m,k),R=Math.min(y,k+x.nodeSize),M=R-S;s+=M,l.push(...x.marks.map(N=>({mark:N,from:S,to:R})))})}),s===0)return!1;let a=l.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>fa(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),c=l.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,h)=>f+h.to-h.from,0);return(a>0?a+c:a)>=s}function hA(t,e,n={}){if(!e)return un(t,null,n)||Rd(t,null,n);let r=ma(e,t.schema);return r==="node"?un(t,e,n):r==="mark"?Rd(t,e,n):!1}var Fx=(t,e)=>{let{$from:n,$to:r,$anchor:i}=t.selection;if(e){let o=ga(l=>l.type.name===e)(t.selection);if(!o)return!1;let s=t.doc.resolve(o.pos+1);return i.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},$x=t=>{let{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function wx(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Ed(t,e){let{nodeExtensions:n}=Bi(e),r=n.find(s=>s.name===t);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=xe(Z(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function $i(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return!/\S/.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&($i(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function ba(t){return t instanceof Q}var _x=class Hx{constructor(e){this.position=e}static fromJSON(e){return new Hx(e.position)}toJSON(){return{position:this.position}}};function pA(t,e){let n=e.mapping.mapResult(t.position);return{position:new _x(n.pos),mapResult:n}}function mA(t){return new _x(t)}function gA(t,e,n){var r;let{selection:i}=e,o=null;if(Tx(i)&&(o=i.$cursor),o){let l=(r=t.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(c=>c.type.excludes(n)))}let{ranges:s}=i;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,f,h)=>{if(c)return!1;if(u.isInline){let m=!h||h.type.allowsMarkType(n),y=!!n.isInSet(u.marks)||!u.marks.some(x=>x.type.excludes(n));c=m&&y}return!c}),c})}var yA=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:l}=o,a=$n(t,r.schema);if(i)if(s){let c=Ix(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{let u=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(u,f,(h,m)=>{let y=Math.max(m,u),x=Math.min(m+h.nodeSize,f);h.marks.find(S=>S.type===a)?h.marks.forEach(S=>{a===S.type&&n.addMark(y,x,a.create({...S.attrs,...e}))}):n.addMark(y,x,a.create(e))})});return gA(r,n,a)},bA=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),xA=(t,e={})=>({state:n,dispatch:r,chain:i})=>{let o=Oe(t,n.schema),s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:l})=>Vf(o,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Vf(o,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},kA=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,i=zr(t,0,r.content.size),o=Q.create(r,i);e.setSelection(o)}return!0},wA=(t,e)=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=r,s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=o.from,l=o.to),i&&n.doc.nodesBetween(s,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},SA=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,s=X.atStart(r).from,l=X.atEnd(r).to,a=zr(i,s,l),c=zr(o,s,l),u=X.create(r,a,c);e.setSelection(u)}return!0},vA=t=>({state:e,dispatch:n})=>{let r=Oe(t,e.schema);return tb(r)(e,n)};function Sx(t,e){let n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){let r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var CA=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=e,{$from:l,$to:a}=o,c=i.extensionManager.attributes,u=ua(c,l.node().type.name,l.node().attrs);if(o instanceof Q&&o.node.isBlock)return!l.parentOffset||!Nt(s,l.pos)?!1:(r&&(t&&Sx(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let f=a.parentOffset===a.parent.content.size,h=l.depth===0?void 0:nA(l.node(-1).contentMatchAt(l.indexAfter(-1))),m=f&&h?[{type:h,attrs:u}]:void 0,y=Nt(e.doc,e.mapping.map(l.pos),1,m);if(!m&&!y&&Nt(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(y=!0,m=h?[{type:h,attrs:u}]:void 0),r){if(y&&(o instanceof X&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,m),h&&!f&&!l.parentOffset&&l.parent.type!==h)){let x=e.mapping.map(l.before()),k=e.doc.resolve(x);l.node(-1).canReplaceWith(k.index(),k.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}t&&Sx(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return y},EA=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let l=Oe(t,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;let f=a.node(-1);if(f.type!==l)return!1;let h=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let S=F.empty,R=a.index(-1)?1:a.index(-2)?2:3;for(let $=a.depth-R;$>=a.depth-3;$-=1)S=F.from(a.node($).copy(S));let M=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,N={...ua(h,a.node().type.name,a.node().attrs),...e},z=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(N))||void 0;S=S.append(F.from(l.createAndFill(null,z)||void 0));let T=a.before(a.depth-(R-1));n.replace(T,a.after(-M),new q(S,4-R,0));let P=-1;n.doc.nodesBetween(T,n.doc.content.size,($,j)=>{if(P>-1)return!1;$.isTextblock&&$.content.size===0&&(P=j+1)}),P>-1&&n.setSelection(X.near(n.doc.resolve(P))),n.scrollIntoView()}return!0}let m=c.pos===a.end()?f.contentMatchAt(0).defaultType:null,y={...ua(h,f.type.name,f.attrs),...e},x={...ua(h,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,c.pos);let k=m?[{type:l,attrs:y},{type:m,attrs:x}]:[{type:l,attrs:y}];if(!Nt(n.doc,a.pos,2))return!1;if(i){let{selection:S,storedMarks:R}=r,{splittableMarks:M}=o.extensionManager,N=R||S.$to.parentOffset&&S.$from.marks();if(n.split(a.pos,2,k).scrollIntoView(),!N||!i)return!0;let z=N.filter(T=>M.includes(T.type.name));n.ensureMarks(z)}return!0};function vx(t){return!t||t==="1"?null:t}function jx(t,e){return vx(t)===vx(e)}var Td=(t,e)=>{let n=ga(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Ft(t.doc,n.pos))||!jx(n.node.attrs.type,i?.attrs.type)||t.join(n.pos),!0},Md=(t,e)=>{let n=ga(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Ft(t.doc,r))||!jx(n.node.attrs.type,i?.attrs.type)||t.join(r),!0};function TA(t){let e=t.doc,n=e.firstChild;if(!n)return null;let r=e.resolve(1),i=e.resolve(n.nodeSize-1);return X.between(r,i)}var MA=(t,e,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:c,can:u})=>{let{extensions:f,splittableMarks:h}=i.extensionManager,m=Oe(t,s.schema),y=Oe(e,s.schema),{selection:x,storedMarks:k}=s,{$from:S,$to:R}=x,M=S.blockRange(R),N=k||x.$to.parentOffset&&x.$from.marks();if(!M)return!1;let z=ga(V=>Ed(V.type.name,f))(x),T=x.from===0&&x.to===s.doc.content.size,P=s.doc.content.content,$=P.length===1?P[0]:null,j=T&&$&&Ed($.type.name,f)?{node:$,pos:0,depth:0}:null,g=z??j,oe=!!z&&M.depth>=1&&M.depth-z.depth<=1,G=!!j;if((oe||G)&&g){if(g.node.type===m)return T&&G?a().command(({tr:V,dispatch:J})=>{let K=TA(V);return K?(V.setSelection(K),J&&J(V),!0):!1}).liftListItem(y).run():c.liftListItem(y);if(Ed(g.node.type.name,f)&&m.validContent(g.node.content))return a().command(()=>(o.setNodeMarkup(g.pos,m),!0)).command(()=>Td(o,m)).command(()=>Md(o,m)).run()}return!n||!N||!l?a().command(()=>u().wrapInList(m,r)?!0:c.clearNodes()).wrapInList(m,r).command(()=>Td(o,m)).command(()=>Md(o,m)).run():a().command(()=>{let V=u().wrapInList(m,r),J=N.filter(K=>h.includes(K.type.name));return o.ensureMarks(J),V?!0:c.clearNodes()}).wrapInList(m,r).command(()=>Td(o,m)).command(()=>Md(o,m)).run()},AA=(t,e={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=$n(t,r.schema);return Rd(r,s,e)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,e)},RA=(t,e,n={})=>({state:r,commands:i})=>{let o=Oe(t,r.schema),s=Oe(e,r.schema),l=un(r,o,n),a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(s,a):i.setNode(o,{...a,...n})},IA=(t,e={})=>({state:n,commands:r})=>{let i=Oe(t,n.schema);return un(n,i,e)?r.lift(i):r.wrapIn(i,e)},LA=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){let s=t.tr,l=o.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(o.text){let a=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,t.schema.text(o.text,a))}else s.delete(o.from,o.to)}return!0}}return!1},NA=(t={})=>({tr:e,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=t,{selection:o}=e,{empty:s,ranges:l}=o;if(s)return!0;let{nonClearableMarks:a}=r.extensionManager;if(n){let c=Object.values(r.schema.marks).filter(u=>i||!a.includes(u.name));l.forEach(u=>{for(let f of c)e.removeMark(u.$from.pos,u.$to.pos,f)})}return!0},OA=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,a=$n(t,r.schema),{$from:c,empty:u,ranges:f}=l;if(!i)return!0;if(u&&s){let{from:h,to:m}=l,y=(o=c.marks().find(k=>k.type===a))==null?void 0:o.attrs,x=Nd(c,a,y);x&&(h=x.from,m=x.to),n.removeMark(h,m,a)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,a)});return n.removeStoredMark(a),!0},DA=t=>({tr:e,state:n,dispatch:r})=>{let{selection:i}=n,o,s;return typeof t=="number"?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=i.from,s=i.to),r&&e.doc.nodesBetween(o,s,(l,a)=>{if(l.isText)return;let c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},PA=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=ma(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(o=Oe(t,r.schema)),l==="mark"&&(s=$n(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{let u=c.$from.pos,f=c.$to.pos,h,m,y,x;n.selection.empty?r.doc.nodesBetween(u,f,(k,S)=>{o&&o===k.type&&(a=!0,y=Math.max(S,u),x=Math.min(S+k.nodeSize,f),h=S,m=k)}):r.doc.nodesBetween(u,f,(k,S)=>{S<u&&o&&o===k.type&&(a=!0,y=Math.max(S,u),x=Math.min(S+k.nodeSize,f),h=S,m=k),S>=u&&S<=f&&(o&&o===k.type&&(a=!0,i&&n.setNodeMarkup(S,void 0,{...k.attrs,...e})),s&&k.marks.length&&k.marks.forEach(R=>{if(s===R.type&&(a=!0,i)){let M=Math.max(S,u),N=Math.min(S+k.nodeSize,f);n.addMark(M,N,s.create({...R.attrs,...e}))}}))}),m&&(h!==void 0&&i&&n.setNodeMarkup(h,void 0,{...m.attrs,...e}),s&&m.marks.length&&m.marks.forEach(k=>{s===k.type&&i&&n.addMark(y,x,s.create({...k.attrs,...e}))}))}),a},zA=(t,e={})=>({state:n,dispatch:r})=>{let i=Oe(t,n.schema);return Qy(i,e)(n,r)},BA=(t,e={})=>({state:n,dispatch:r})=>{let i=Oe(t,n.schema);return Zy(i,e)(n,r)},FA=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){let n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){let n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){let n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function qx(t,e){let{selection:n}=t,{$from:r}=n;if(n instanceof Q){let o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){let o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}function Fd(t,e,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}function Vx(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function $A(t){return typeof t=="number"}function _A(t){return Object.prototype.toString.call(t).slice(8,-1)}function la(t){return _A(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}var HA={};Id(HA,{createAtomBlockMarkdownSpec:()=>jA,createBlockMarkdownSpec:()=>qA,createInlineMarkdownSpec:()=>UA,parseAttributes:()=>$d,parseIndentedBlocks:()=>xa,renderNestedMarkdownContent:()=>ls,serializeAttributes:()=>_d});function $d(t){if(!t?.trim())return{};let e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([\w-]+)/g);if(i){let c=i.map(u=>u.trim().slice(1));e.class=c.join(" ")}let o=r.match(/(?:^|\s)#([\w-]+)/);o&&(e.id=o[1]);let s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(s)).forEach(([,c,u])=>{var f;let h=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),m=n[h];m&&(e[c]=m.slice(1,-1))});let a=r.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function _d(t){if(!t||Object.keys(t).length===0)return"";let e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function jA(t){let{nodeName:e,name:n,parseAttributes:r=$d,serializeAttributes:i=_d,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:l}=t,a=n||e,c=u=>{if(!l)return u;let f={};return l.forEach(h=>{h in u&&(f[h]=u[h])}),f};return{parseMarkdown:(u,f)=>{let h={...o,...u.attributes};return f.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;let h=new RegExp(`^:::${a}(?:\\s|$)`,"m"),m=(f=u.match(h))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(u,f,h){let m=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),y=u.match(m);if(!y)return;let x=y[1]||"",k=r(x);if(!s.find(R=>!(R in k)))return{type:e,raw:y[0],attributes:k}}},renderMarkdown:u=>{let f=c(u.attrs||{}),h=i(f),m=h?` {${h}}`:"";return`:::${a}${m} :::`}}}function qA(t){let{nodeName:e,name:n,getContent:r,parseAttributes:i=$d,serializeAttributes:o=_d,defaultAttributes:s={},content:l="block",allowedAttributes:a}=t,c=n||e,u=f=>{if(!a)return f;let h={};return a.forEach(m=>{m in f&&(h[m]=f[m])}),h};return{parseMarkdown:(f,h)=>{let m;if(r){let x=r(f);m=typeof x=="string"?[{type:"text",text:x}]:x}else l==="block"?m=h.parseChildren(f.tokens||[]):m=h.parseInline(f.tokens||[]);let y={...s,...f.attributes};return h.createNode(e,y,m)},markdownTokenizer:{name:e,level:"block",start(f){var h;let m=new RegExp(`^:::${c}`,"m"),y=(h=f.match(m))==null?void 0:h.index;return y!==void 0?y:-1},tokenize(f,h,m){var y;let x=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),k=f.match(x);if(!k)return;let[S,R=""]=k,M=i(R),N=1,z=S.length,T="",P=/^:::([\w-]*)(\s.*)?/gm,$=f.slice(z);for(P.lastIndex=0;;){let j=P.exec($);if(j===null)break;let g=j.index,oe=j[1];if(!((y=j[2])!=null&&y.endsWith(":::"))){if(oe)N+=1;else if(N-=1,N===0){let G=$.slice(0,g);T=G.trim();let V=f.slice(0,z+g+j[0].length),J=[];if(T)if(l==="block")for(J=m.blockTokens(G),J.forEach(K=>{K.text&&(!K.tokens||K.tokens.length===0)&&(K.tokens=m.inlineTokens(K.text))});J.length>0;){let K=J[J.length-1];if(K.type==="paragraph"&&(!K.text||K.text.trim()===""))J.pop();else break}else J=m.inlineTokens(T);return{type:e,raw:V,attributes:M,content:T,tokens:J}}}}}},renderMarkdown:(f,h)=>{let m=u(f.attrs||{}),y=o(m),x=y?` {${y}}`:"",k=h.renderChildren(f.content||[],`
|
|
1383
|
+
|
|
1384
|
+
`);return`:::${c}${x}
|
|
1385
|
+
|
|
1386
|
+
${k}
|
|
1387
|
+
|
|
1388
|
+
:::`}}}function VA(t){if(!t.trim())return{};let e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(t);for(;r!==null;){let[,i,o,s]=r;e[i]=o||s,r=n.exec(t)}return e}function WA(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function UA(t){let{nodeName:e,name:n,getContent:r,parseAttributes:i=VA,serializeAttributes:o=WA,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,u=h=>{if(!a)return h;let m={};return a.forEach(y=>{let x=typeof y=="string"?y:y.name,k=typeof y=="string"?void 0:y.skipIfDefault;if(x in h){let S=h[x];if(k!==void 0&&S===k)return;m[x]=S}}),m},f=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,m)=>{let y={...s,...h.attributes};if(l)return m.createNode(e,y);let x=r?r(h):h.content||"";return x?m.createNode(e,y,[m.createTextNode(x)]):m.createNode(e,y,[])},markdownTokenizer:{name:e,level:"inline",start(h){let m=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),y=h.match(m),x=y?.index;return x!==void 0?x:-1},tokenize(h,m,y){let x=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),k=h.match(x);if(!k)return;let S="",R="";if(l){let[,N]=k;R=N}else{let[,N,z]=k;R=N,S=z||""}let M=i(R.trim());return{type:e,raw:k[0],content:S.trim(),attributes:M}}},renderMarkdown:h=>{let m="";r?m=r(h):h.content&&h.content.length>0&&(m=h.content.filter(S=>S.type==="text").map(S=>S.text).join(""));let y=u(h.attrs||{}),x=o(y),k=x?` ${x}`:"";return l?`[${c}${k}]`:`[${c}${k}]${m}[/${c}]`}}}function xa(t,e,n){var r,i,o,s;let l=t.split(`
|
|
1389
|
+
`),a=[],c="",u=0,f=e.baseIndentSize||2;for(;u<l.length;){let h=l[u],m=h.match(e.itemPattern);if(!m){if(a.length>0)break;if(h.trim()===""){u+=1,c=`${c}${h}
|
|
1390
|
+
`;continue}else return}let y=e.extractItemData(m),{indentLevel:x,mainContent:k}=y;c=`${c}${h}
|
|
1391
|
+
`;let S=[k];for(u+=1;u<l.length;){let z=l[u];if(z.trim()===""){let P=l.slice(u+1).findIndex(g=>g.trim()!=="");if(P===-1)break;if((((i=(r=l[u+1+P].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>x){S.push(z),c=`${c}${z}
|
|
1392
|
+
`,u+=1;continue}else break}if((((s=(o=z.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:s.length)||0)>x)S.push(z),c=`${c}${z}
|
|
1393
|
+
`,u+=1;else break}let R,M=S.slice(1);if(M.length>0){let z=M.map(T=>T.slice(x+f)).join(`
|
|
1394
|
+
`);z.trim()&&(e.customNestedParser?R=e.customNestedParser(z):R=n.blockTokens(z))}let N=e.createToken(y,R);a.push(N)}if(a.length!==0)return{items:a,raw:c}}function ls(t,e,n,r){if(!t||!Array.isArray(t.content))return"";let i=typeof n=="function"?n(r):n,[o,...s]=t.content,l=e.renderChildren([o]),a=`${i}${l}`;return s&&s.length>0&&s.forEach((c,u)=>{var f,h;let m=(h=(f=e.renderChild)==null?void 0:f.call(e,c,u+1))!=null?h:e.renderChildren([c]);if(m!=null){let y=m.split(`
|
|
1395
|
+
`).map(x=>x?e.indent(x):e.indent("")).join(`
|
|
1396
|
+
`);a+=c.type==="paragraph"?`
|
|
1397
|
+
|
|
1398
|
+
${y}`:`
|
|
1399
|
+
${y}`}}),a}function Wx(t,e){let n={...t};return la(t)&&la(e)&&Object.keys(e).forEach(r=>{la(e[r])&&la(t[r])?n[r]=Wx(t[r],e[r]):n[r]=e[r]}),n}function KA(t,e,n={}){let{state:r}=e,{doc:i,tr:o}=r,s=t;i.descendants((l,a)=>{let c=o.mapping.map(a),u=o.mapping.map(a)+l.nodeSize,f=null;if(l.marks.forEach(m=>{if(m!==s)return!1;f=m}),!f)return;let h=!1;if(Object.keys(n).forEach(m=>{n[m]!==f.attrs[m]&&(h=!0)}),h){let m=t.type.create({...t.attrs,...n});o.removeMark(c,u,t.type),o.addMark(c,u,m)}}),o.docChanged&&e.view.dispatch(o)}var ka=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},JA=(t,e)=>{if(Ld(e))return e.exec(t);let n=e(t);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function aa(t){var e;let{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=t,{view:a}=n;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1,f=dA(c)+o;return s.forEach(h=>{if(u)return;let m=JA(f,h.find);if(!m)return;let y=a.state.tr,x=ha({state:a.state,transaction:y}),k={from:r-(m[0].length-o.length),to:i},{commands:S,chain:R,can:M}=new pa({editor:n,state:x});h.handler({state:x,range:k,match:m,commands:S,chain:R,can:M})===null||!y.steps.length||(h.undoable&&y.setMeta(l,{transform:y,from:r,to:i,text:o}),a.dispatch(y),u=!0)}),u}function GA(t){let{editor:e,rules:n}=t,r=new Y({state:{init(){return null},apply(i,o,s){let l=i.getMeta(r);if(l)return l;let a=i.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=zd(F.from(u),s.schema);let{from:f}=a,h=f+u.length;aa({editor:e,from:f,to:h,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,l){return aa({editor:e,from:o,to:s,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:o}=i.state.selection;o&&aa({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;let{$cursor:s}=i.state.selection;return s?aa({editor:e,from:s.pos,to:s.pos,text:`
|
|
1400
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Hd=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...xe(Z(this,"addOptions",{name:this.name}))}}get storage(){return{...xe(Z(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){let e=this.extend({...this.config,addOptions:()=>Wx(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){let e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Ot=class Ux extends Hd{constructor(){super(...arguments),this.type="mark"}static create(e={}){let n=typeof e=="function"?e():e;return new Ux(n)}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){let s=i.marks();if(!!!s.find(c=>c?.type.name===n.name))return!1;let a=s.find(c=>c?.type.name===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}},XA=class{constructor(t){this.find=t.find,this.handler=t.handler}},YA=(t,e,n)=>{if(Ld(e))return[...t.matchAll(e)];let r=e(t,n);return r?r.map(i=>{let o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function QA(t){let{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new pa({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,i,(m,y)=>{var x,k,S,R,M;if((k=(x=m.type)==null?void 0:x.spec)!=null&&k.code||!(m.isText||m.isTextblock||m.isInline))return;let N=(M=(R=(S=m.content)==null?void 0:S.size)!=null?R:m.nodeSize)!=null?M:0,z=Math.max(r,y),T=Math.min(i,y+N);if(z>=T)return;let P=m.isText?m.text||"":m.textBetween(z-y,T-y,void 0,"");YA(P,o.find,s).forEach(j=>{if(j.index===void 0)return;let g=z+j.index+1,oe=g+j[0].length,G={from:n.tr.mapping.map(g),to:n.tr.mapping.map(oe)},V=o.handler({state:n,range:G,match:j,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});f.push(V)})}),f.every(m=>m!==null)}var ca=null,ZA=t=>{var e;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function eR(t){let{editor:e,rules:n}=t,r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}let a=({state:u,from:f,to:h,rule:m,pasteEvt:y})=>{let x=u.tr,k=ha({state:u,transaction:x});if(!(!QA({editor:e,state:k,from:Math.max(f-1,0),to:h.b-1,rule:m,pasteEvent:y,dropEvent:l})||!x.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,x}};return n.map(u=>new Y({view(f){let h=y=>{var x;r=(x=f.dom.parentElement)!=null&&x.contains(y.target)?f.dom.parentElement:null,r&&(ca=e)},m=()=>{ca&&(ca=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",m),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",m)}}},props:{handleDOMEvents:{drop:(f,h)=>{if(o=r===f.dom.parentElement,l=h,!o){let m=ca;m?.isEditable&&setTimeout(()=>{let y=m.state.selection;y&&m.commands.deleteRange({from:y.from,to:y.to})},10)}return!1},paste:(f,h)=>{var m;let y=(m=h.clipboardData)==null?void 0:m.getData("text/html");return s=h,i=!!y?.includes("data-pm-slice"),!1}}},appendTransaction:(f,h,m)=>{let y=f[0],x=y.getMeta("uiEvent")==="paste"&&!i,k=y.getMeta("uiEvent")==="drop"&&!o,S=y.getMeta("applyPasteRules"),R=!!S;if(!x&&!k&&!R)return;if(R){let{text:z}=S;typeof z=="string"?z=z:z=zd(F.from(z),m.schema);let{from:T}=S,P=T+z.length,$=ZA(z);return a({rule:u,state:m,from:T,to:{b:P},pasteEvt:$})}let M=h.doc.content.findDiffStart(m.doc.content),N=h.doc.content.findDiffEnd(m.doc.content);if(!(!$A(M)||!N||M===N.b))return a({rule:u,state:m,from:M,to:N,pasteEvt:s})}}))}var wa=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Dx(t),this.schema=sA(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ts(e.name,this.schema)},r=Z(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){let{editor:t}=this;return rs([...this.extensions].reverse()).flatMap(r=>{let i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:ts(r.name,this.schema)},o=[],s=Z(r,"addKeyboardShortcuts",i),l={};if(r.type==="mark"&&Z(r,"exitable",i)&&(l.ArrowRight=()=>Ot.handleExit({editor:t,mark:r})),s){let h=Object.fromEntries(Object.entries(s()).map(([m,y])=>[m,()=>y({editor:t})]));l={...l,...h}}let a=dx(l);o.push(a);let c=Z(r,"addInputRules",i);if(wx(r,t.options.enableInputRules)&&c){let h=c();if(h&&h.length){let m=GA({editor:t,rules:h}),y=Array.isArray(m)?m:[m];o.push(...y)}}let u=Z(r,"addPasteRules",i);if(wx(r,t.options.enablePasteRules)&&u){let h=u();if(h&&h.length){let m=eR({editor:t,rules:h});o.push(...m)}}let f=Z(r,"addProseMirrorPlugins",i);if(f){let h=f();o.push(...h)}return o})}get attributes(){return Ox(this.extensions)}get nodeViews(){let{editor:t}=this,{nodeExtensions:e}=Bi(this.extensions);return Object.fromEntries(e.filter(n=>!!Z(n,"addNodeView")).map(n=>{let r=this.attributes.filter(a=>a.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Oe(n.name,this.schema)},o=Z(n,"addNodeView",i);if(!o)return[];let s=o();if(!s)return[];let l=(a,c,u,f,h)=>{let m=Fi(a,r);return s({node:a,view:c,getPos:u,decorations:f,innerDecorations:h,editor:t,extension:n,HTMLAttributes:m})};return[n.name,l]}))}dispatchTransaction(t){let{editor:e}=this;return rs([...this.extensions].reverse()).reduceRight((r,i)=>{let o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:ts(i.name,this.schema)},s=Z(i,"dispatchTransaction",o);return s?l=>{s.call(o,{transaction:l,next:r})}:r},t)}transformPastedHTML(t){let{editor:e}=this;return rs([...this.extensions]).reduce((r,i)=>{let o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:ts(i.name,this.schema)},s=Z(i,"transformPastedHTML",o);return s?(l,a)=>{let c=r(l,a);return s.call(o,c)}:r},t||(r=>r))}get markViews(){let{editor:t}=this,{markExtensions:e}=Bi(this.extensions);return Object.fromEntries(e.filter(n=>!!Z(n,"addMarkView")).map(n=>{let r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:$n(n.name,this.schema)},o=Z(n,"addMarkView",i);if(!o)return[];let s=(l,a,c)=>{let u=Fi(l,r);return o()({mark:l,view:a,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:f=>{KA(l,t,f)}})};return[n.name,s]}))}destroy(){this.extensions.forEach(t=>{let e=t;for(;e.parent;){let n=e.parent;n.child===e&&(n.child=null),e=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n,r;let i={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ts(e.name,this.schema)};e.type==="mark"&&(((n=xe(Z(e,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(e.name),(r=xe(Z(e,"clearable",i)))==null||r||this.nonClearableMarks.push(e.name));let o=Z(e,"onBeforeCreate",i),s=Z(e,"onCreate",i),l=Z(e,"onUpdate",i),a=Z(e,"onSelectionUpdate",i),c=Z(e,"onTransaction",i),u=Z(e,"onFocus",i),f=Z(e,"onBlur",i),h=Z(e,"onDestroy",i);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),f&&this.editor.on("blur",f),h&&this.editor.on("destroy",h)})}};wa.resolve=Dx;wa.sort=rs;wa.flatten=Pd;var tR={};Id(tR,{ClipboardTextSerializer:()=>Jx,Commands:()=>Gx,Delete:()=>Xx,Drop:()=>Yx,Editable:()=>Qx,FocusEvents:()=>ek,Keymap:()=>tk,Paste:()=>nk,Tabindex:()=>rk,TextDirection:()=>ik,focusEventsPluginKey:()=>Zx});var fe=class Kx extends Hd{constructor(){super(...arguments),this.type="extension"}static create(e={}){let n=typeof e=="function"?e():e;return new Kx(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}},Jx=fe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Y({key:new te("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,o=zx(n),{blockSeparator:s}=this.options,l={...s!==void 0?{blockSeparator:s}:{},textSerializers:o};return[...i.ranges].sort((c,u)=>c.$from.pos-u.$from.pos).map(({$from:c,$to:u})=>Px(r,{from:c.pos,to:u.pos},l)).join(s??`
|
|
1401
|
+
|
|
1402
|
+
`)}}})]}}),Gx=fe.create({name:"commands",addCommands(){return{...Cx}}}),Xx=fe.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;let o=()=>{var s,l,a,c;if((c=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?c:t.getMeta("y-sync$"))return;let u=Od(t.before,[t,...e]);ss(u).forEach(m=>{u.mapping.mapResult(m.oldRange.from).deletedAfter&&u.mapping.mapResult(m.oldRange.to).deletedBefore&&u.before.nodesBetween(m.oldRange.from,m.oldRange.to,(y,x)=>{let k=x+y.nodeSize-2,S=m.oldRange.from<=x&&k<=m.oldRange.to;this.editor.emit("delete",{type:"node",node:y,from:x,to:k,newFrom:u.mapping.map(x),newTo:u.mapping.map(k),deletedRange:m.oldRange,newRange:m.newRange,partial:!S,editor:this.editor,transaction:t,combinedTransform:u})})});let h=u.mapping;u.steps.forEach((m,y)=>{var x,k;if(m instanceof Ln){let S=h.slice(y).map(m.from,-1),R=h.slice(y).map(m.to),M=h.invert().map(S,-1),N=h.invert().map(R),z=S>0?(x=u.doc.nodeAt(S-1))==null?void 0:x.marks.some(P=>P.eq(m.mark)):!1,T=(k=u.doc.nodeAt(R))==null?void 0:k.marks.some(P=>P.eq(m.mark));this.editor.emit("delete",{type:"mark",mark:m.mark,from:m.from,to:m.to,deletedRange:{from:M,to:N},newRange:{from:S,to:R},partial:!!(T||z),editor:this.editor,transaction:t,combinedTransform:u})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(o,0):o()}}),Yx=fe.create({name:"drop",addProseMirrorPlugins(){return[new Y({key:new te("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Qx=fe.create({name:"editable",addProseMirrorPlugins(){return[new Y({key:new te("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Zx=new te("focusEvents"),ek=fe.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new Y({key:Zx,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;let r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;let r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),tk=fe.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{let{selection:a,doc:c}=l,{empty:u,$anchor:f}=a,{pos:h,parent:m}=f,y=f.parent.isTextblock&&h>0?l.doc.resolve(h-1):f,x=y.parent.type.spec.isolating,k=f.pos-f.parentOffset,S=x&&y.parent.childCount===1?k===f.pos:ee.atStart(c).from===h;return!u||!m.type.isTextblock||m.textContent.length||!S||S&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return da()||Rx()?o:i},addProseMirrorPlugins(){return[new Y({key:new te("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(x=>x.getMeta("composition")))return;let r=t.some(x=>x.docChanged)&&!e.doc.eq(n.doc),i=t.some(x=>x.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:l}=e.selection,a=ee.atStart(e.doc).from,c=ee.atEnd(e.doc).to;if(o||!(s===a&&l===c)||!$i(n.doc))return;let h=n.tr,m=ha({state:n,transaction:h}),{commands:y}=new pa({editor:this.editor,state:m});if(y.clearNodes(),!!h.steps.length)return h}})]}}),nk=fe.create({name:"paste",addProseMirrorPlugins(){return[new Y({key:new te("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),rk=fe.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Y({key:new te("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!=null?t:"0"}}}})]}}),ik=fe.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:t}=Bi(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Y({key:new te("textDirection"),props:{attributes:()=>{let t=this.options.direction;return t?{dir:t}:{}}}})]}}),nR=class ns{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new ns(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new ns(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new ns(e,this.editor)}get children(){let e=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+(o?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(l);if(!i&&!s&&a.depth<=this.depth)return;let c=new ns(a,this.editor,i,i||s?n:null);i&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){let o=i.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){let a=s[l];if(o[a]!==n[a])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;let o=Object.keys(n);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===e&&o.every(a=>n[a]===s.node.attrs[a])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(e,n,r))))}),i}setAttribute(e){let{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},rR=`.ProseMirror {
|
|
1403
|
+
position: relative;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
.ProseMirror {
|
|
1407
|
+
word-wrap: break-word;
|
|
1408
|
+
white-space: pre-wrap;
|
|
1409
|
+
white-space: break-spaces;
|
|
1410
|
+
-webkit-font-variant-ligatures: none;
|
|
1411
|
+
font-variant-ligatures: none;
|
|
1412
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
.ProseMirror [contenteditable="false"] {
|
|
1416
|
+
white-space: normal;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
1420
|
+
white-space: pre-wrap;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
.ProseMirror pre {
|
|
1424
|
+
white-space: pre-wrap;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
img.ProseMirror-separator {
|
|
1428
|
+
display: inline !important;
|
|
1429
|
+
border: none !important;
|
|
1430
|
+
margin: 0 !important;
|
|
1431
|
+
width: 0 !important;
|
|
1432
|
+
height: 0 !important;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
.ProseMirror-gapcursor {
|
|
1436
|
+
display: none;
|
|
1437
|
+
pointer-events: none;
|
|
1438
|
+
position: absolute;
|
|
1439
|
+
margin: 0;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
.ProseMirror-gapcursor:after {
|
|
1443
|
+
content: "";
|
|
1444
|
+
display: block;
|
|
1445
|
+
position: absolute;
|
|
1446
|
+
top: -2px;
|
|
1447
|
+
width: 20px;
|
|
1448
|
+
border-top: 1px solid black;
|
|
1449
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
@keyframes ProseMirror-cursor-blink {
|
|
1453
|
+
to {
|
|
1454
|
+
visibility: hidden;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
.ProseMirror-hideselection *::selection {
|
|
1459
|
+
background: transparent;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
1463
|
+
background: transparent;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
.ProseMirror-hideselection * {
|
|
1467
|
+
caret-color: transparent;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
1471
|
+
display: block;
|
|
1472
|
+
}`,ok=class extends FA{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:pA,createMappablePosition:mA},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:o})=>this.options.onDrop(r,i,o)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);let e=this.createDoc(),n=Mx(e,this.options.autofocus);this.editorState=Wl.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Fd(rR,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){let n=Nx(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;let e=this.state.plugins,n=e;if([].concat(t).forEach(i=>{let o=typeof i=="string"?`${i}$`:i.key;n=n.filter(s=>!s.key.startsWith(o))}),e.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e,n,r;let o=[...this.options.enableCoreExtensions?[Qx,Jx.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Gx,ek,tk,rk.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),Yx,nk,Xx,ik.configure({direction:this.options.textDirection})].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new wa(o,this)}createCommandManager(){this.commandManager=new pa({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Ad(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Ad(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){let{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,o=e.transformPastedHTML,s=this.extensionManager.transformPastedHTML(o);this.editorView=new Go(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();let a=this.view.dom;a.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;let e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}let{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});let s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=s?.getMeta("focus"),a=s?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Bd(this.state,t)}isActive(t,e){let n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return hA(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return zd(this.state.doc.content,this.schema)}getText(t){let{blockSeparator:e=`
|
|
1473
|
+
|
|
1474
|
+
`,textSerializers:n={}}=t||{};return aA(this.state.doc,{blockSeparator:e,textSerializers:{...zx(this.schema),...n}})}get isEmpty(){return $i(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){let e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText?e.nodeAfter:null;return new nR(e,this,!1,n)}get $doc(){return this.$pos(0)}};function fn(t){return new ka({find:t.find,handler:({state:e,range:n,match:r})=>{let i=xe(t.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:o}=e,s=r[r.length-1],l=r[0];if(s){let a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(ya(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(x=>x===t.type&&x!==m.mark.type)).filter(m=>m.to>c).length)return null;u<n.to&&o.delete(u,n.to),c>n.from&&o.delete(n.from+a,c);let h=n.from+a+s.length;o.addMark(n.from+a,h,t.type.create(i||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}function sk(t){return new ka({find:t.find,handler:({state:e,range:n,match:r})=>{let i=xe(t.getAttributes,void 0,r)||{},{tr:o}=e,s=n.from,l=n.to,a=t.type.create(i);if(r[1]){let c=r[0].lastIndexOf(r[1]),u=s+c;u>l?u=l:l=u+r[1].length;let f=r[0][r[0].length-1];o.insertText(f,s+r[0].length-1),o.replaceWith(u,l,a)}else if(r[0]){let c=t.type.isInline?s:s-1;o.insert(c,t.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()},undoable:t.undoable})}function as(t){return new ka({find:t.find,handler:({state:e,range:n,match:r})=>{let i=e.doc.resolve(n.from),o=xe(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)},undoable:t.undoable})}function dn(t){return new ka({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{let o=xe(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),c=a&&Ai(a,t.type,o);if(!c)return null;if(s.wrap(a,c),t.keepMarks&&t.editor){let{selection:f,storedMarks:h}=e,{splittableMarks:m}=t.editor.extensionManager,y=h||f.$to.parentOffset&&f.$from.marks();if(y){let x=y.filter(k=>m.includes(k.type.name));s.ensureMarks(x)}}if(t.keepAttributes){let f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(f,o).run()}let u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Ft(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&s.join(n.from-1)},undoable:t.undoable})}var be=class lk extends Hd{constructor(){super(...arguments),this.type="node"}static create(e={}){let n=typeof e=="function"?e():e;return new lk(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}};function qt(t){return new XA({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{let o=xe(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;let{tr:s}=e,l=r[r.length-1],a=r[0],c=n.to;if(l){let u=a.search(/\S/),f=n.from+a.indexOf(l),h=f+l.length;if(ya(n.from,n.to,e.doc).filter(x=>x.mark.type.excluded.find(S=>S===t.type&&S!==x.mark.type)).filter(x=>x.to>f).length)return null;h<n.to&&s.delete(h,n.to),f>n.from&&s.delete(n.from+u,f),c=n.from+u+l.length,s.addMark(n.from+u,c,t.type.create(o||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||s.removeStoredMark(t.type)}}})}var _i=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);let{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]};function bk(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){let s=i.text,l=o.text,a=0;for(;s[a]==l[a];a++)n++;return a&&a<s.length&&a<l.length&&wk(s.charCodeAt(a-1))&&kk(s.charCodeAt(a))&&n--,n}if(i.content.size||o.content.size){let s=bk(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function xk(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,f=c.length,h=u.length;for(;f>0&&h>0&&c[f-1]==u[h-1];)f--,h--,n--,r--;return f&&h&&f<c.length&&wk(c.charCodeAt(f-1))&&kk(c.charCodeAt(f))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let c=xk(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function kk(t){return t>=56320&&t<57344}function wk(t){return t>=55296&&t<56320}var ct=class xt{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,i+l,o||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new xt(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let l=this.content[o],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),i+=l.nodeSize),s=a}return new xt(r,i)}cutByIndex(e,n){return e==n?xt.empty:e==0&&n==this.content.length?this:new xt(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new xt(i,o)}addToStart(e){return new xt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new xt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return bk(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return xk(this,e,n,r)}findIndex(e){if(e==0)return Sa(0,e);if(e==this.size)return Sa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?Sa(n+1,o):Sa(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return xt.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return xt.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return xt.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new xt(n||e,r)}static from(e){if(!e)return xt.empty;if(e instanceof xt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new xt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};ct.empty=new ct([],0);var jd={index:0,offset:0};function Sa(t,e){return jd.index=t,jd.offset=e,jd}function Aa(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Aa(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Aa(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}var Br=class Wd{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Aa(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Wd.none;if(e instanceof Wd)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Br.none=[];var ys=class extends Error{},De=class Hi{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=vk(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new Hi(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Hi(Sk(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Hi.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Hi(ct.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new Hi(e,r,i)}};De.empty=new De(ct.empty,0,0);function Sk(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Sk(o.content,e-i-1,n-i-1)))}function vk(t,e,n,r,i,o){let{index:s,offset:l}=t.findIndex(e),a=t.maybeChild(s);if(l==e||a.isText)return o&&r<=0&&i<=0&&!o.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=vk(a.content,e-l-1,n,s==0?r-1:0,s==t.childCount-1?i-1:0,a);return c&&t.replaceChild(s,a.copy(c))}function iR(t,e,n){if(n.openStart>t.depth)throw new ys("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ys("Inconsistent open depths");return Ck(t,e,n,0)}function Ck(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=Ck(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return $r(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=oR(n,t);return $r(o,Tk(t,s,l,e,r))}else return $r(o,Ra(t,e,r))}function Ek(t,e){if(!e.type.compatibleContent(t.type))throw new ys("Cannot join "+e.type.name+" onto "+t.type.name)}function Ud(t,e,n){let r=t.node(n);return Ek(r,e.node(n)),r}function Fr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ms(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Fr(t.nodeAfter,r),o++));for(let l=o;l<s;l++)Fr(i.child(l),r);e&&e.depth==n&&e.textOffset&&Fr(e.nodeBefore,r)}function $r(t,e){if(!t.type.validContent(e))throw new ys("Invalid content for node "+t.type.name);return t.copy(e)}function Tk(t,e,n,r,i){let o=t.depth>i&&Ud(t,e,i+1),s=r.depth>i&&Ud(n,r,i+1),l=[];return ms(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(Ek(o,s),Fr($r(o,Tk(t,e,n,r,i+1)),l)):(o&&Fr($r(o,Ra(t,e,i+1)),l),ms(e,n,i,l),s&&Fr($r(s,Ra(n,r,i+1)),l)),ms(r,null,i,l),new ct(l)}function Ra(t,e,n){let r=[];if(ms(null,t,n,r),t.depth>n){let i=Ud(t,e,n+1);Fr($r(i,Ra(t,e,n+1)),r)}return ms(e,null,n,r),new ct(r)}function oR(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(ct.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}var ak=class Kd{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Br.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let l=r;r=i,i=l}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new aR(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(o),c=o-a;if(r.push(s,l,i+a),!c||(s=s.child(l),s.isText))break;o=c-1,i+=a+1}return new Kd(n,r,o)}static resolveCached(e,n){let r=ck.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else ck.set(e,r=new sR);let i=r.elts[r.i]=Kd.resolve(e,n);return r.i=(r.i+1)%lR,i}},sR=class{constructor(){this.elts=[],this.i=0}},lR=12,ck=new WeakMap,aR=class{constructor(t,e,n){this.$from=t,this.$to=e,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},cR=Object.create(null),uR=class Jd{constructor(e,n,r,i=Br.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||ct.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Aa(this.attrs,n||e.defaultAttrs||cR)&&Br.sameSet(this.marks,r||Br.none)}copy(e=null){return e==this.content?this:new Jd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Jd(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return De.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),l=i.start(s),c=i.node(s).content.cut(i.pos-l,o.pos-l);return new De(c,i.depth-s,o.depth-s)}replace(e,n,r){return iR(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ak.resolveCached(this,e)}resolveNoCache(e){return ak.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),fR(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=ct.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=i;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Br.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Br.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=ct.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};uR.prototype.text=void 0;function fR(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var Gd=class Mk{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new dR(e,n);if(r.next==null)return Mk.empty;let i=Ak(r);r.next&&r.err("Unexpected trailing text");let o=xR(bR(i));return kR(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return ct.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:f}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=o(f,l.concat(u));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let l=i;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:a}=o.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
|
|
1475
|
+
`)}};Gd.empty=new Gd(!0);var dR=class{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}};function Ak(t){let e=[];do e.push(hR(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function hR(t){let e=[];do e.push(pR(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function pR(t){let e=yR(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=mR(t,e);else break;return e}function uk(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function mR(t,e){let n=uk(t),r=n;return t.eat(",")&&(t.next!="}"?r=uk(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function gR(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function yR(t){if(t.eat("(")){let e=Ak(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=gR(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function bR(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function i(s,l){s.forEach(a=>a.to=l)}function o(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=o(s.exprs[a],l);if(a==s.exprs.length-1)return c;i(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),i(o(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return i(o(s.expr,l),a),i(o(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(o(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();i(o(s.expr,a),u),a=u}if(s.max==-1)i(o(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),i(o(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Rk(t,e){return e-t}function fk(t,e){let n=[];return r(e),n.sort(Rk);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:l,to:a}=o[s];!l&&n.indexOf(a)==-1&&r(a)}}}function xR(t){let e=Object.create(null);return n(fk(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);fk(t,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=e[r.join(",")]=new Gd(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let l=i[s][1].sort(Rk);o.next.push({type:i[s][0],next:e[l.join(",")]||n(l)})}return o}}function kR(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];s.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}var Ik=65535,Lk=Math.pow(2,16);function wR(t,e){return t+e*Lk}function dk(t){return t&Ik}function SR(t){return(t-(t&Ik))/Lk}var Nk=1,Ok=2,Ca=4,Dk=8,hk=class{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(this.delInfo&Dk)>0}get deletedBefore(){return(this.delInfo&(Nk|Ca))>0}get deletedAfter(){return(this.delInfo&(Ok|Ca))>0}get deletedAcross(){return(this.delInfo&Ca)>0}},_r=class ji{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&ji.empty)return ji.empty}recover(e){let n=0,r=dk(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+SR(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+o],u=this.ranges[l+s],f=a+c;if(e<=f){let h=c?e==a?-1:e==f?1:n:n,m=a+i+(h<0?0:u);if(r)return m;let y=e==(n<0?a:f)?null:wR(l/3,e-a),x=e==a?Ok:e==f?Nk:Ca;return(n<0?e!=a:e!=f)&&(x|=Dk),new hk(m,x,y)}i+=u-c}return r?e+i:new hk(e+i,0,null)}touches(e,n){let r=0,i=dk(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+o],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],l=s-(this.inverted?o:0),a=s+(this.inverted?0:o),c=this.ranges[i+n],u=this.ranges[i+r];e(l,l+c,a,a+u),o+=u-c}}invert(){return new ji(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?ji.empty:new ji(e<0?[0,-e,0]:[0,0,e])}};_r.empty=new _r([]);var qd=Object.create(null),ut=class{getMap(){return _r.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=qd[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in qd)throw new RangeError("Duplicate use of step JSON ID "+t);return qd[t]=e,e.prototype.jsonID=t,e}},kt=class cs{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new cs(e,null)}static fail(e){return new cs(null,e)}static fromReplace(e,n,r,i){try{return cs.ok(e.replace(n,r,i))}catch(o){if(o instanceof ys)return cs.fail(o.message);throw o}}};function Zd(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Zd(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return ct.fromArray(r)}var Pk=class us extends ut{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new De(Zd(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return kt.fromReplace(e,this.from,this.to,o)}invert(){return new zk(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new us(n.pos,r.pos,this.mark)}merge(e){return e instanceof us&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new us(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new us(n.from,n.to,e.markFromJSON(n.mark))}};ut.jsonID("addMark",Pk);var zk=class fs extends ut{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new De(Zd(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return kt.fromReplace(e,this.from,this.to,r)}invert(){return new Pk(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new fs(n.pos,r.pos,this.mark)}merge(e){return e instanceof fs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fs(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fs(n.from,n.to,e.markFromJSON(n.mark))}};ut.jsonID("removeMark",zk);var Bk=class ds extends ut{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return kt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return kt.fromReplace(e,this.pos,this.pos+1,new De(ct.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new ds(this.pos,n.marks[i]);return new ds(this.pos,this.mark)}}return new Fk(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ds(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ds(n.pos,e.markFromJSON(n.mark))}};ut.jsonID("addNodeMark",Bk);var Fk=class Xd extends ut{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return kt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return kt.fromReplace(e,this.pos,this.pos+1,new De(ct.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Bk(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Xd(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Xd(n.pos,e.markFromJSON(n.mark))}};ut.jsonID("removeNodeMark",Fk);var eh=class sr extends ut{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Yd(e,this.from,this.to)?kt.fail("Structure replace would overwrite content"):kt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new _r([this.from,this.to-this.from,this.slice.size])}invert(e){return new sr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&sr.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new sr(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof sr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?De.empty:new De(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new sr(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?De.empty:new De(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new sr(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new sr(n.from,n.to,De.fromJSON(e,n.slice),!!n.structure)}};eh.MAP_BIAS=1;ut.jsonID("replace",eh);var $k=class Ea extends ut{constructor(e,n,r,i,o,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Yd(e,this.from,this.gapFrom)||Yd(e,this.gapTo,this.to)))return kt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return kt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?kt.fromReplace(e,this.from,this.to,r):kt.fail("Content does not fit in gap")}getMap(){return new _r([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Ea(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Ea(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ea(n.from,n.to,n.gapFrom,n.gapTo,De.fromJSON(e,n.slice),n.insert,!!n.structure)}};ut.jsonID("replaceAround",$k);function Yd(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}var vR=class Ta extends ut{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return kt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return kt.fromReplace(e,this.pos,this.pos+1,new De(ct.from(i),0,n.isLeaf?0:1))}getMap(){return _r.empty}invert(e){return new Ta(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ta(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ta(n.pos,n.attr,n.value)}};ut.jsonID("attr",vR);var CR=class Qd extends ut{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return kt.ok(r)}getMap(){return _r.empty}invert(e){return new Qd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Qd(n.attr,n.value)}};ut.jsonID("docAttr",CR);var bs=class extends Error{};bs=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};bs.prototype=Object.create(Error.prototype);bs.prototype.constructor=bs;bs.prototype.name="TransformError";var Vd=Object.create(null),Xe=class{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new ER(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=De.empty){let n=e.content.lastChild,r=null;for(let s=0;s<e.openEnd;s++)r=n,n=n.lastChild;let i=t.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=t.mapping.slice(i);t.replaceRange(c.map(l.pos),c.map(a.pos),s?De.empty:e),s==0&&gk(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],l=t.mapping.slice(n),a=l.map(o.pos),c=l.map(s.pos);i?t.deleteRange(a,c):(t.replaceRangeWith(a,c,e),gk(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new Vi(t):qi(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let i=t.depth-1;i>=0;i--){let o=e<0?qi(t.node(0),t.node(i),t.before(i+1),t.index(i),e,n):qi(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,n);if(o)return o}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new gs(t.node(0))}static atStart(t){return qi(t,t,0,0,1)||new gs(t)}static atEnd(t){return qi(t,t,t.content.size,t.childCount,-1)||new gs(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Vd[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in Vd)throw new RangeError("Duplicate use of selection JSON ID "+t);return Vd[t]=e,e.prototype.jsonID=t,e}getBookmark(){return Vi.between(this.$anchor,this.$head).getBookmark()}};Xe.prototype.visible=!0;var ER=class{constructor(t,e){this.$from=t,this.$to=e}},pk=!1;function mk(t){!pk&&!t.parent.inlineContent&&(pk=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var Vi=class hs extends Xe{constructor(e,n=e){mk(e),mk(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Xe.near(r);let i=e.resolve(n.map(this.anchor));return new hs(i.parent.inlineContent?i:r,r)}replace(e,n=De.empty){if(super.replace(e,n),n==De.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof hs&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new _k(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new hs(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=Xe.findFrom(n,r,!0)||Xe.findFrom(n,-r,!0);if(o)n=o.$head;else return Xe.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(Xe.findFrom(e,-r,!0)||Xe.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new hs(e,n)}};Xe.jsonID("text",Vi);var _k=class Hk{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Hk(e.map(this.anchor),e.map(this.head))}resolve(e){return Vi.between(e.resolve(this.anchor),e.resolve(this.head))}},Wi=class ps extends Xe{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?Xe.near(o):new ps(o)}content(){return new De(ct.from(this.node),0,0)}eq(e){return e instanceof ps&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new TR(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ps(e.resolve(n.anchor))}static create(e,n){return new ps(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Wi.prototype.visible=!1;Xe.jsonID("node",Wi);var TR=class jk{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new _k(r,r):new jk(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Wi.isSelectable(r)?new Wi(n):Xe.near(n)}},gs=class Ma extends Xe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=De.empty){if(n==De.empty){e.delete(0,e.doc.content.size);let r=Xe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ma(e)}map(e){return new Ma(e)}eq(e){return e instanceof Ma}getBookmark(){return MR}};Xe.jsonID("all",gs);var MR={map(){return this},resolve(t){return new gs(t)}};function qi(t,e,n,r,i,o=!1){if(e.inlineContent)return Vi.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let l=e.child(s);if(l.isAtom){if(!o&&Wi.isSelectable(l))return Wi.create(t,n-(i<0?l.nodeSize:0))}else{let a=qi(t,l,n+i,i<0?l.childCount:0,i,o);if(a)return a}n+=l.nodeSize*i}return null}function gk(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof eh||i instanceof $k))return;let o=t.mapping.maps[r],s;o.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(Xe.near(t.doc.resolve(s),n))}function yk(t,e){return!e||!t?t:t.bind(e)}var va=class{constructor(t,e,n){this.name=t,this.init=yk(e.init,n),this.apply=yk(e.apply,n)}},sF=[new va("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new va("selection",{init(t,e){return t.selection||Xe.atStart(e.doc)},apply(t){return t.selection}}),new va("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new va("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],AR=(t,e)=>{var n;let{state:r,view:i}=t,{selection:o}=r;if(!o.empty)return!1;let{$from:s}=o;if(s.parentOffset!==0)return!1;let l=s.depth-1,a=s.node(l),c=s.index(l);if(c===0)return!1;if(a.type===e)return t.commands.lift(e.name);let u=a.child(c-1);if(u.type!==e||!((n=u.lastChild)!=null&&n.isTextblock))return!1;let f=s.before(),m=f-1-1,{tr:y}=r;return y.delete(f,s.after()).insert(m,s.parent.content),y.setSelection(Vi.create(y.doc,m)),i.dispatch(y.scrollIntoView()),!0},RR=/^\s*>\s$/,qk=be.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return _i("blockquote",{...ce(this.options.HTMLAttributes,t),children:_i("slot",{})})},parseMarkdown:(t,e)=>{var n;let r=(n=e.parseBlockChildren)!=null?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";let n=">",r=[];return t.content.forEach((i,o)=>{var s,l;let u=((l=(s=e.renderChild)==null?void 0:s.call(e,i,o))!=null?l:e.renderChildren([i])).split(`
|
|
1476
|
+
`).map(f=>f.trim()===""?n:`${n} ${f}`);r.push(u.join(`
|
|
1477
|
+
`))}),r.join(`
|
|
1478
|
+
${n}
|
|
1479
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>AR(this.editor,this.type)}},addInputRules(){return[dn({find:RR,type:this.type})]}});var IR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,LR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,NR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,OR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Vk=Ot.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return _i("strong",{...ce(this.options.HTMLAttributes,t),children:_i("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[fn({find:IR,type:this.type}),fn({find:NR,type:this.type})]},addPasteRules(){return[qt({find:LR,type:this.type}),qt({find:OR,type:this.type})]}});var DR=t=>{let e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},PR=t=>{let e=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},Wk=Ot.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ce(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[fn({find:DR,type:this.type})]},addPasteRules(){return[qt({find:PR,type:this.type})]}});var th=4,zR=/^```([a-z]+)?[\s\n]$/,BR=/^~~~([a-z]+)?[\s\n]$/,Uk=be.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:th,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;let{languageClassPrefix:n}=this.options;if(!n)return null;let o=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ce(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="",i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
|
|
1480
|
+
`):r=`\`\`\`${i}
|
|
1481
|
+
|
|
1482
|
+
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;let n=(e=this.options.tabSize)!=null?e:th,{state:r}=t,{selection:i}=r,{$from:o,empty:s}=i;if(o.parent.type!==this.type)return!1;let l=" ".repeat(n);return s?t.commands.insertContent(l):t.commands.command(({tr:a})=>{let{from:c,to:u}=i,m=r.doc.textBetween(c,u,`
|
|
1483
|
+
`,`
|
|
1484
|
+
`).split(`
|
|
1485
|
+
`).map(y=>l+y).join(`
|
|
1486
|
+
`);return a.replaceWith(c,u,r.schema.text(m)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;let n=(e=this.options.tabSize)!=null?e:th,{state:r}=t,{selection:i}=r,{$from:o,empty:s}=i;return o.parent.type!==this.type?!1:s?t.commands.command(({tr:l})=>{var a;let{pos:c}=o,u=o.start(),f=o.end(),m=r.doc.textBetween(u,f,`
|
|
1487
|
+
`,`
|
|
1488
|
+
`).split(`
|
|
1489
|
+
`),y=0,x=0,k=c-u;for(let T=0;T<m.length;T+=1){if(x+m[T].length>=k){y=T;break}x+=m[T].length+1}let R=((a=m[y].match(/^ */))==null?void 0:a[0])||"",M=Math.min(R.length,n);if(M===0)return!0;let N=u;for(let T=0;T<y;T+=1)N+=m[T].length+1;return l.delete(N,N+M),c-N<=M&&l.setSelection(X.create(l.doc,N)),!0}):t.commands.command(({tr:l})=>{let{from:a,to:c}=i,h=r.doc.textBetween(a,c,`
|
|
1490
|
+
`,`
|
|
1491
|
+
`).split(`
|
|
1492
|
+
`).map(m=>{var y;let x=((y=m.match(/^ */))==null?void 0:y[0])||"",k=Math.min(x.length,n);return m.slice(k)}).join(`
|
|
1493
|
+
`);return l.replaceWith(a,c,r.schema.text(h)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
|
|
1494
|
+
|
|
1495
|
+
`);return!o||!s?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;let l=i.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:c})=>(c.setSelection(ee.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[as({find:zR,type:this.type,getAttributes:t=>({language:t[1]})}),as({find:BR,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Y({key:new te("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;let{tr:s,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
|
|
1496
|
+
`));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(X.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});var Kk=be.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
1497
|
+
|
|
1498
|
+
`):""});var Jk=be.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ce(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
1499
|
+
`},renderMarkdown:()=>`
|
|
1500
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){let f=a.filter(h=>l.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Gk=be.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ce(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;let r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>as({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Xk=be.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ce(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!qx(e,e.schema.nodes[this.name]))return!1;let{selection:n}=e,{$to:r}=n,i=t();return ba(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:o,tr:s,dispatch:l})=>{if(l){let{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(X.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(Q.create(s.doc,a.pos)):s.setSelection(X.create(s.doc,a.pos));else{let u=o.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,f=u?.create();f&&(s.insert(c,f),s.setSelection(X.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[sk({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var FR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,$R=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,_R=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,HR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Yk=Ot.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ce(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[fn({find:FR,type:this.type}),fn({find:_R,type:this.type})]},addPasteRules(){return[qt({find:$R,type:this.type}),qt({find:HR,type:this.type})]}});var jR="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",qR="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",ah="numeric",ch="ascii",uh="alpha",ws="asciinumeric",ks="alphanumeric",fh="domain",r0="emoji",VR="scheme",WR="slashscheme",nh="whitespace";function UR(t,e){return t in e||(e[t]=[]),e[t]}function Hr(t,e,n){e[ah]&&(e[ws]=!0,e[ks]=!0),e[ch]&&(e[ws]=!0,e[uh]=!0),e[ws]&&(e[ks]=!0),e[uh]&&(e[ks]=!0),e[ks]&&(e[fh]=!0),e[r0]&&(e[fh]=!0);for(let r in e){let i=UR(r,n);i.indexOf(t)<0&&i.push(t)}}function KR(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function At(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}At.groups={};At.prototype={accepts(){return!!this.t},go(t){let e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){let i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||At.groups;let i;return e&&e.j?i=e:(i=new At(e),n&&r&&Hr(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this,o=t.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(t[s]);return i.tt(t[o-1],e,n,r)},tt(t,e,n,r){r=r||At.groups;let i=this;if(e&&e.j)return i.j[t]=e,e;let o=e,s,l=i.go(t);if(l?(s=new At,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new At,o){if(r)if(s.t&&typeof s.t=="string"){let a=Object.assign(KR(s.t,r),n);Hr(o,a,r)}else n&&Hr(o,n,r);s.t=o}return i.j[t]=s,s}};var pe=(t,e,n,r,i)=>t.ta(e,n,r,i),Pe=(t,e,n,r,i)=>t.tr(e,n,r,i),Qk=(t,e,n,r,i)=>t.ts(e,n,r,i),_=(t,e,n,r,i)=>t.tt(e,n,r,i),jn="WORD",dh="UWORD",i0="ASCIINUMERICAL",o0="ALPHANUMERICAL",Ms="LOCALHOST",hh="TLD",ph="UTLD",Oa="SCHEME",Ui="SLASH_SCHEME",gh="NUM",mh="WS",yh="NL",Ss="OPENBRACE",vs="CLOSEBRACE",Da="OPENBRACKET",Pa="CLOSEBRACKET",za="OPENPAREN",Ba="CLOSEPAREN",Fa="OPENANGLEBRACKET",$a="CLOSEANGLEBRACKET",_a="FULLWIDTHLEFTPAREN",Ha="FULLWIDTHRIGHTPAREN",ja="LEFTCORNERBRACKET",qa="RIGHTCORNERBRACKET",Va="LEFTWHITECORNERBRACKET",Wa="RIGHTWHITECORNERBRACKET",Ua="FULLWIDTHLESSTHAN",Ka="FULLWIDTHGREATERTHAN",Ja="AMPERSAND",Ga="APOSTROPHE",Xa="ASTERISK",ar="AT",Ya="BACKSLASH",Qa="BACKTICK",Za="CARET",jr="COLON",bh="COMMA",ec="DOLLAR",hn="DOT",tc="EQUALS",xh="EXCLAMATION",Wt="HYPHEN",Cs="PERCENT",nc="PIPE",rc="PLUS",ic="POUND",Es="QUERY",kh="QUOTE",s0="FULLWIDTHMIDDLEDOT",wh="SEMI",pn="SLASH",Ts="TILDE",oc="UNDERSCORE",l0="EMOJI",sc="SYM",a0=Object.freeze({__proto__:null,ALPHANUMERICAL:o0,AMPERSAND:Ja,APOSTROPHE:Ga,ASCIINUMERICAL:i0,ASTERISK:Xa,AT:ar,BACKSLASH:Ya,BACKTICK:Qa,CARET:Za,CLOSEANGLEBRACKET:$a,CLOSEBRACE:vs,CLOSEBRACKET:Pa,CLOSEPAREN:Ba,COLON:jr,COMMA:bh,DOLLAR:ec,DOT:hn,EMOJI:l0,EQUALS:tc,EXCLAMATION:xh,FULLWIDTHGREATERTHAN:Ka,FULLWIDTHLEFTPAREN:_a,FULLWIDTHLESSTHAN:Ua,FULLWIDTHMIDDLEDOT:s0,FULLWIDTHRIGHTPAREN:Ha,HYPHEN:Wt,LEFTCORNERBRACKET:ja,LEFTWHITECORNERBRACKET:Va,LOCALHOST:Ms,NL:yh,NUM:gh,OPENANGLEBRACKET:Fa,OPENBRACE:Ss,OPENBRACKET:Da,OPENPAREN:za,PERCENT:Cs,PIPE:nc,PLUS:rc,POUND:ic,QUERY:Es,QUOTE:kh,RIGHTCORNERBRACKET:qa,RIGHTWHITECORNERBRACKET:Wa,SCHEME:Oa,SEMI:wh,SLASH:pn,SLASH_SCHEME:Ui,SYM:sc,TILDE:Ts,TLD:hh,UNDERSCORE:oc,UTLD:ph,UWORD:dh,WORD:jn,WS:mh}),_n=/[a-z]/,xs=/\p{L}/u,rh=/\p{Emoji}/u;var Hn=/\d/,ih=/\s/;var Zk="\r",oh=`
|
|
1501
|
+
`,JR="️",GR="",sh="",Ia=null,La=null;function XR(t=[]){let e={};At.groups=e;let n=new At;Ia==null&&(Ia=e0(jR)),La==null&&(La=e0(qR)),_(n,"'",Ga),_(n,"{",Ss),_(n,"}",vs),_(n,"[",Da),_(n,"]",Pa),_(n,"(",za),_(n,")",Ba),_(n,"<",Fa),_(n,">",$a),_(n,"(",_a),_(n,")",Ha),_(n,"「",ja),_(n,"」",qa),_(n,"『",Va),_(n,"』",Wa),_(n,"<",Ua),_(n,">",Ka),_(n,"&",Ja),_(n,"*",Xa),_(n,"@",ar),_(n,"`",Qa),_(n,"^",Za),_(n,":",jr),_(n,",",bh),_(n,"$",ec),_(n,".",hn),_(n,"=",tc),_(n,"!",xh),_(n,"-",Wt),_(n,"%",Cs),_(n,"|",nc),_(n,"+",rc),_(n,"#",ic),_(n,"?",Es),_(n,'"',kh),_(n,"/",pn),_(n,";",wh),_(n,"~",Ts),_(n,"_",oc),_(n,"\\",Ya),_(n,"・",s0);let r=Pe(n,Hn,gh,{[ah]:!0});Pe(r,Hn,r);let i=Pe(r,_n,i0,{[ws]:!0}),o=Pe(r,xs,o0,{[ks]:!0}),s=Pe(n,_n,jn,{[ch]:!0});Pe(s,Hn,i),Pe(s,_n,s),Pe(i,Hn,i),Pe(i,_n,i);let l=Pe(n,xs,dh,{[uh]:!0});Pe(l,_n),Pe(l,Hn,o),Pe(l,xs,l),Pe(o,Hn,o),Pe(o,_n),Pe(o,xs,o);let a=_(n,oh,yh,{[nh]:!0}),c=_(n,Zk,mh,{[nh]:!0}),u=Pe(n,ih,mh,{[nh]:!0});_(n,sh,u),_(c,oh,a),_(c,sh,u),Pe(c,ih,u),_(u,Zk),_(u,oh),Pe(u,ih,u),_(u,sh,u);let f=Pe(n,rh,l0,{[r0]:!0});_(f,"#"),Pe(f,rh,f),_(f,JR,f);let h=_(f,GR);_(h,"#"),Pe(h,rh,f);let m=[[_n,s],[Hn,i]],y=[[_n,null],[xs,l],[Hn,o]];for(let x=0;x<Ia.length;x++)lr(n,Ia[x],hh,jn,m);for(let x=0;x<La.length;x++)lr(n,La[x],ph,dh,y);Hr(hh,{tld:!0,ascii:!0},e),Hr(ph,{utld:!0,alpha:!0},e),lr(n,"file",Oa,jn,m),lr(n,"mailto",Oa,jn,m),lr(n,"http",Ui,jn,m),lr(n,"https",Ui,jn,m),lr(n,"ftp",Ui,jn,m),lr(n,"ftps",Ui,jn,m),Hr(Oa,{scheme:!0,ascii:!0},e),Hr(Ui,{slashscheme:!0,ascii:!0},e),t=t.sort((x,k)=>x[0]>k[0]?1:-1);for(let x=0;x<t.length;x++){let k=t[x][0],R=t[x][1]?{[VR]:!0}:{[WR]:!0};k.indexOf("-")>=0?R[fh]=!0:_n.test(k)?Hn.test(k)?R[ws]=!0:R[ch]=!0:R[ah]=!0,Qk(n,k,k,R)}return Qk(n,"localhost",Ms,{ascii:!0}),n.jd=new At(sc),{start:n,tokens:Object.assign({groups:e},a0)}}function c0(t,e){let n=YR(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,f=-1,h=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(f=0,h=0,u=l):f>=0&&(f+=n[s].length,h++),c+=n[s].length,o+=n[s].length,s++;o-=f,s-=h,c-=f,i.push({t:u.t,v:e.slice(o-c,o),s:o-c,e:o})}return i}function YR(t){let e=[],n=t.length,r=0;for(;r<n;){let i=t.charCodeAt(r),o,s=i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function lr(t,e,n,r,i){let o,s=e.length;for(let l=0;l<s-1;l++){let a=e[l];t.j[a]?o=t.j[a]:(o=new At(r),o.jr=i.slice(),t.j[a]=o),t=o}return o=new At(n),o.jr=i.slice(),t.j[e[s-1]]=o,o}function e0(t){let e=[],n=[],r=0,i="0123456789";for(;r<t.length;){let o=0;for(;i.indexOf(t[r+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+o),10);s>0;s--)n.pop();r+=o}else n.push(t[r]),r++}return e}var As={defaultProtocol:"http",events:null,format:t0,formatHref:t0,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Sh(t,e=null){let n=Object.assign({},As);t&&(n=Object.assign(n,t instanceof Sh?t.o:t));let r=n.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}Sh.prototype={o:As,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){let r=e!=null,i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:As[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){let e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function t0(t){return t}function u0(t,e){this.t="token",this.v=t,this.tk=e}u0.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){let e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=As.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:i,attributes:s,content:o,eventListeners:f}}};function lc(t,e){class n extends u0{constructor(i,o){super(i,o),this.t=t}}for(let r in e)n.prototype[r]=e[r];return n.t=t,n}var QR=lc("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),n0=lc("text"),ZR=lc("nl"),Na=lc("url",{isLink:!0,toHref(t=As.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==Ms&&t[1].t===jr}});var Vt=t=>new At(t);function eI({groups:t}){let e=t.domain.concat([Ja,Xa,ar,Ya,Qa,Za,ec,tc,Wt,gh,Cs,nc,rc,ic,pn,sc,Ts,oc]),n=[Ga,jr,bh,hn,xh,Cs,Es,kh,wh,Fa,$a,Ss,vs,Pa,Da,za,Ba,_a,Ha,ja,qa,Va,Wa,Ua,Ka],r=[Ja,Ga,Xa,Ya,Qa,Za,ec,tc,Wt,Ss,vs,Cs,nc,rc,ic,Es,pn,sc,Ts,oc],i=Vt(),o=_(i,Ts);pe(o,r,o),pe(o,t.domain,o);let s=Vt(),l=Vt(),a=Vt();pe(i,t.domain,s),pe(i,t.scheme,l),pe(i,t.slashscheme,a),pe(s,r,o),pe(s,t.domain,s);let c=_(s,ar);_(o,ar,c),_(l,ar,c),_(a,ar,c);let u=_(o,hn);pe(u,r,o),pe(u,t.domain,o);let f=Vt();pe(c,t.domain,f),pe(f,t.domain,f);let h=_(f,hn);pe(h,t.domain,f);let m=Vt(QR);pe(h,t.tld,m),pe(h,t.utld,m),_(c,Ms,m);let y=_(f,Wt);_(y,Wt,y),pe(y,t.domain,f),pe(m,t.domain,f),_(m,hn,h),_(m,Wt,y);let x=_(s,Wt),k=_(s,hn);_(x,Wt,x),pe(x,t.domain,s),pe(k,r,o),pe(k,t.domain,s);let S=Vt(Na);pe(k,t.tld,S),pe(k,t.utld,S),pe(S,t.domain,s),pe(S,r,o),_(S,hn,k),_(S,Wt,x),_(S,ar,c);let R=_(S,jr),M=Vt(Na);pe(R,t.numeric,M);let N=Vt(Na),z=Vt();pe(N,e,N),pe(N,n,z),pe(z,e,N),pe(z,n,z),_(S,pn,N),_(M,pn,N);let T=_(l,jr),P=_(a,jr),$=_(P,pn),j=_($,pn);pe(l,t.domain,s),_(l,hn,k),_(l,Wt,x),pe(a,t.domain,s),_(a,hn,k),_(a,Wt,x),pe(T,t.domain,N),_(T,pn,N),_(T,Es,N),pe(j,t.domain,N),pe(j,e,N),_(j,pn,N);let g=[[Ss,vs],[Da,Pa],[za,Ba],[Fa,$a],[_a,Ha],[ja,qa],[Va,Wa],[Ua,Ka]];for(let oe=0;oe<g.length;oe++){let[G,V]=g[oe],J=_(N,G);_(z,G,J);let K=Vt(Na);pe(J,e,K);let se=Vt();pe(J,n,se),_(J,V,N),pe(K,e,K),pe(K,n,se),pe(se,e,K),pe(se,n,se),_(K,V,N),_(se,V,N)}return _(i,Ms,S),_(i,yh,ZR),{start:i,tokens:a0}}function tI(t,e,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let l=t,a=null,c=null,u=0,f=null,h=-1;for(;i<r&&!(a=l.go(n[i].t));)s.push(n[i++]);for(;i<r&&(c=a||l.go(n[i].t));)a=null,l=c,l.accepts()?(h=0,f=l):h>=0&&h++,i++,u++;if(h<0)i-=u,i<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(lh(n0,e,s)),s=[]),i-=h,u-=h;let m=f.t,y=n.slice(i-u,i);o.push(lh(m,e,y))}}return s.length>0&&o.push(lh(n0,e,s)),o}function lh(t,e,n){let r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}var nI=typeof console<"u"&&console&&console.warn||(()=>{}),rI="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Re={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function f0(){return At.groups={},Re.scanner=null,Re.parser=null,Re.tokenQueue=[],Re.pluginQueue=[],Re.customSchemes=[],Re.initialized=!1,Re}function vh(t,e=!1){if(Re.initialized&&nI(`linkifyjs: already initialized - will not register custom scheme "${t}" ${rI}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
1502
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
1503
|
+
2. Cannot start or end with "-"
|
|
1504
|
+
3. "-" cannot repeat`);Re.customSchemes.push([t,e])}function iI(){Re.scanner=XR(Re.customSchemes);for(let t=0;t<Re.tokenQueue.length;t++)Re.tokenQueue[t][1]({scanner:Re.scanner});Re.parser=eI(Re.scanner.tokens);for(let t=0;t<Re.pluginQueue.length;t++)Re.pluginQueue[t][1]({scanner:Re.scanner,parser:Re.parser});return Re.initialized=!0,Re}function ac(t){return Re.initialized||iI(),tI(Re.parser.start,t,c0(Re.scanner.start,t))}ac.scan=c0;function cc(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}let r=new Sh(n),i=ac(t),o=[];for(let s=0;s<i.length;s++){let l=i[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}var Ch="[\0- -\u2029 ]",oI=new RegExp(Ch),sI=new RegExp(`${Ch}$`),lI=new RegExp(Ch,"g");function aI(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function cI(t){return new Y({key:new te("autolink"),appendTransaction:(e,n,r)=>{let i=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),o=e.some(c=>c.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r,l=Od(n.doc,[...e]);if(ss(l).forEach(({newRange:c})=>{let u=Lx(r.doc,c,m=>m.isTextblock),f,h;if(u.length>1)f=u[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){let m=r.doc.textBetween(c.from,c.to," "," ");if(!sI.test(m))return;f=u[0],h=r.doc.textBetween(f.pos,c.to,void 0," ")}if(f&&h){let m=h.split(oI).filter(Boolean);if(m.length<=0)return!1;let y=m[m.length-1],x=f.pos+h.lastIndexOf(y);if(!y)return!1;let k=ac(y).map(S=>S.toObject(t.defaultProtocol));if(!aI(k))return!1;k.filter(S=>S.isLink).map(S=>({...S,from:x+S.start+1,to:x+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{ya(S.from,S.to,r.doc).some(R=>R.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function uI(t){return new Y({key:new te("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{let a=r.target;if(!a)return!1;let c=t.editor.view.dom;s=a.closest("a"),s&&!c.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let a=Bd(e.state,t.type.name),c=(i=s.href)!=null?i:a.href,u=(o=s.target)!=null?o:a.target;c&&(window.open(c,u),l=!0)}return l}}})}function fI(t){return new Y({key:new te("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{shouldAutoLink:i}=t,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});let c=cc(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||i!==void 0&&!i(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function qr(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(lI,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var uc=Ot.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){vh(t);return}vh(t.scheme,t.optionalSlashes)})},onDestroy(){f0()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qr(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;let i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!=null?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!=null?e:null},class:{default:(n=this.options.HTMLAttributes.class)!=null?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{let e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qr(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ce(this.options.HTMLAttributes,t),0]:["a",ce(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,o;let s=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",l=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"",a=e.renderChildren(t);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{let{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!qr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[qt({find:t=>{let e=[];if(t){let{protocols:n,defaultProtocol:r}=this.options,i=cc(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!qr(s,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(cI({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!qr(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(uI({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(fI({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}});var dI=Object.defineProperty,hI=(t,e)=>{for(var n in e)dI(t,n,{get:e[n],enumerable:!0})},pI="listItem",d0="textStyle",h0=/^\s*([-+*])\s$/,Ah=be.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",ce(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
1505
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(pI,this.editor.getAttributes(d0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=dn({find:h0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=dn({find:h0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(d0),editor:this.editor})),[t]}}),mI=(t,e,n)=>{let{selection:r}=t;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let o=-1;for(let m=i.depth;m>0;m-=1)if(i.node(m).type.name===e){o=m;break}if(o<0)return null;let s=i.node(o),l=i.index(o);if(l+1>=s.childCount)return null;let a=s.child(l+1);if(!n.includes(a.type.name))return null;let c=t.schema.nodes[e],u=!1;if(a.forEach(m=>{m.type===c&&m.childCount>1&&(u=!0)}),!u)return null;let f=t.doc.resolve(i.after()).nodeAfter;if(!f||!n.includes(f.type.name))return null;let h=[];return f.forEach(m=>{h.push(m)}),h.length===0?null:{listItemDepth:o,nestedList:f,nestedListPos:i.after(),insertPos:i.after(o),items:h}},gI=(t,e,n,r)=>{let i=mI(t,n,r);if(!i)return!1;let{selection:o}=t,{nestedList:s,nestedListPos:l,insertPos:a,items:c}=i,u=t.tr;u.delete(l,l+s.nodeSize);let f=u.mapping.map(a);return u.insert(f,F.from(c)),u.setSelection(o.map(u.doc,u.mapping)),e&&e(u),!0},yI=(t,e,n)=>gI(t.state,t.view.dispatch,e,n),y0=(t,e)=>fe.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>yI(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),b0=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],fc="abcdefghijklmnopqrstuvwxyz",bI="[a-zA-Z]{1,2}",Rh=String.raw`\d+|[ivxlcdmIVXLCDM]+|${bI}`;function hc(t){let e=t,n="";for(let[r,i]of b0)for(;e>=r;)n+=i,e-=r;return n}function Ih(t){return hc(t).toUpperCase()}function x0(t){let e=t.toLowerCase(),n=0,r=0;for(;n<e.length;){let i=!1;for(let[o,s]of b0)if(e.startsWith(s,n)){r+=o,n+=s.length,i=!0;break}if(!i)return 0}return r}function xI(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;let e=x0(t);return e<=0?!1:(t===t.toLowerCase()?hc(e):Ih(e))===t}function kI(t){let e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){let n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function dc(t){if(t<=26)return fc[t-1];let e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?fc[n]:fc[e]+fc[n]}function pc(t){if(!(!t||/^\d+$/.test(t))){if(xI(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function Lh(t){if(/^\d+$/.test(t))return parseInt(t,10);let e=pc(t);if(e==="i"||e==="I")return x0(t);if(e==="a"||e==="A"){let r=kI(t);return r>0?r:1}let n=parseInt(t,10);return Number.isNaN(n)?1:n}function wI(t,e){if(t==="numeric")return String(e);switch(t){case"a":return dc(e);case"A":return dc(e).toUpperCase();case"i":return hc(e);case"I":return Ih(e);default:return String(e)}}function SI(t){var e;if(t.length===0)return!1;let n=(e=pc(t[0]))!=null?e:"numeric",r=Lh(t[0]);if(r<1)return!1;for(let i=0;i<t.length;i++){let o=wI(n,r+i);if(t[i]!==o)return!1}return!0}function vI(t){return{type:pc(t),start:Lh(t)}}function CI(t){let{type:e,start:n}=vI(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function EI(t,e,n=". "){let r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${dc(r)}${n}`;case"A":return`${dc(r).toUpperCase()}${n}`;case"i":return`${hc(r)}${n}`;case"I":return`${Ih(r)}${n}`;default:return`${r}${n}`}}function TI(t){var e,n;let r=(e=t.tokens)==null?void 0:e[0];return!!(t.text&&((n=t.tokens)==null?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===t.text)}function MI(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var Nh=be.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ce(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];let r=(n=e.parseBlockChildren)!=null?n:e.parseChildren,i=[];if(t.tokens&&t.tokens.length>0){if(TI(t))return{type:"listItem",content:[{type:"paragraph",content:MI(t.text||"",e)}]};if(t.tokens.some(s=>s.type==="paragraph"))i=r(t.tokens);else{let s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(i=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){let a=t.tokens.slice(1),c=r(a);i.push(...c)}}else i=r(t.tokens)}}return i.length===0&&(i=[{type:"paragraph",content:[]}]),{type:"listItem",content:i}},renderMarkdown:(t,e,n)=>ls(t,e,r=>{var i,o,s,l;if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){let a=((o=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:o.start)||1,c=(l=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:l.type,u=a-1+(r.index||0);return EI(c,u,". ")}return"- "},n),addExtensions(){return[y0(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),AI={};hI(AI,{findListItemPos:()=>mc,getNextListDepth:()=>Oh,handleBackspace:()=>Eh,handleDelete:()=>Th,hasListBefore:()=>k0,hasListItemAfter:()=>RI,hasListItemBefore:()=>II,listItemHasSubList:()=>LI,nextListIsDeeper:()=>w0,nextListIsHigher:()=>S0});var mc=(t,e)=>{let{$from:n}=e.selection,r=Oe(t,e.schema),i=null,o=n.depth,s=n.pos,l=null;for(;o>0&&l===null;)i=n.node(o),i.type===r?l=o:(o-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Oh=(t,e)=>{let n=mc(t,e);if(!n)return!1;let[,r]=Bx(e,t,n.$pos.pos+4);return r},k0=(t,e,n)=>{let{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),o=t.doc.resolve(i).node();return!(!o||!n.includes(o.type.name))},Eh=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!un(t.state,e)&&k0(t.state,e,n)){let{$anchor:r}=t.state.selection,i=t.state.doc.resolve(r.before()-1),o=[];i.node().descendants((a,c)=>{a.type.name===e&&o.push({node:a,pos:c})});let s=o.at(-1);if(!s)return!1;let l=t.state.doc.resolve(i.start()+s.pos+1);return t.chain().cut({from:r.start()-1,to:r.end()+1},l.end()).joinForward().run()}return!un(t.state,e)||!$x(t.state)?!1:t.chain().liftListItem(e).run()},w0=(t,e)=>{let n=Oh(t,e),r=mc(t,e);return!r||!n?!1:n>r.depth},S0=(t,e)=>{let n=Oh(t,e),r=mc(t,e);return!r||!n?!1:n<r.depth},Th=(t,e)=>{if(!un(t.state,e)||!Fx(t.state,e))return!1;let{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:w0(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():S0(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},RI=(t,e)=>{var n;let{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},II=(t,e)=>{var n;let{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},LI=(t,e,n)=>{if(!n)return!1;let r=Oe(t,e.schema),i=!1;return n.descendants(o=>{o.type===r&&(i=!0)}),i},Dh=fe.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Th(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Th(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Eh(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Eh(t,n,r)&&(e=!0)}),e}}}}),Mh=new RegExp(`^(\\s*)(${Rh})([.)])\\s+(.*)$`),NI=new RegExp(`^(\\s*)(${Rh})([.)])\\s+`),OI=/^\s/,Rs={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function DI(t){return Mh.test(t.trimStart())}function PI(t){let e=t.trimStart();return Rs.bulletItem.test(e)||DI(e)||Rs.heading.test(e)||Rs.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||Rs.codeFence.test(e)}function zI(t){return Object.values(Rs).some(e=>e.test(t))}function BI(t){let e=[],n=[],r=!1;return t.forEach(i=>{if(r){n.push(i);return}if(i.trim()===""){r=!0,n.push(i);return}if(e.length>0&&PI(i)){r=!0,n.push(i);return}e.push(i)}),{paragraphLines:e,blockLines:n}}function FI(t){let e=[],n=0,r=0;for(;n<t.length;){let i=t[n],o=i.match(Mh);if(!o)break;let[,s,l,a,c]=o,u=s.length,f=parseInt(l,10),h=isNaN(f)?pc(l):void 0,m=isNaN(f)?Lh(l):f,y=[c],x=n+1,k=[i],S=!1;for(;x<t.length;){let R=t[x];if(R.match(Mh))break;if(R.trim()==="")k.push(R),y.push(""),S=!0,x+=1;else if(R.match(OI)){let N=R.length-R.trimStart().length,z=u+l.length+1;k.push(R),y.push(R.slice(Math.min(N,z))),x+=1}else{if(S||zI(R))break;k.push(R),y.push(R),x+=1}}e.push({indent:u,number:m,type:h,content:y.join(`
|
|
1506
|
+
`).trim(),contentLines:y,raw:k.join(`
|
|
1507
|
+
`)}),r=x,n=x}return[e,r]}var $I=new RegExp(`^(${Rh})([.)])\\s+(.+)$`);function _I(t){let e=t.split(`
|
|
1508
|
+
`).filter(o=>o.trim().length>0);if(e.length===0)return null;let n=[];for(let o of e){let s=o.trim().match($I);if(!s)return null;n.push({marker:s[1],content:s[3]})}let r=n.map(o=>o.marker);return SI(r)?{type:"orderedList",attrs:CI(n[0].marker),content:n.map(o=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:o.content}]}]}))}:null}function v0(t,e,n){let r=[],i=0;for(;i<t.length;){let o=t[i];if(o.indent===e){let{paragraphLines:s,blockLines:l}=BI(o.contentLines),a=s.join(`
|
|
1509
|
+
`).trim(),c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});let u=l.join(`
|
|
1510
|
+
`).trim();if(u){let m=n.blockTokens(u);c.push(...m)}let f=i+1,h=[];for(;f<t.length&&t[f].indent>e;)h.push(t[f]),f+=1;if(h.length>0){let m=Math.min(...h.map(x=>x.indent)),y=v0(h,m,n);c.push({type:"list",ordered:!0,start:h[0].number,typeMarker:h[0].type,items:y,raw:h.map(x=>x.raw).join(`
|
|
1511
|
+
`)})}r.push({type:"list_item",raw:o.raw,tokens:c}),i=f}else i+=1}return r}function HI(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];let r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){let o=e.parseChildren([i]);r.push({type:"paragraph",content:o})}else{let o=e.parseChildren([i]);o.length>0&&r.push(...o)}}),{type:"listItem",content:r}})}var jI="listItem",p0="textStyle",m0=/^(\d+)\.\s$/;function g0(t){let e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var Ph=be.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{let e=t.getAttribute("type");if(e)return e;let n=t.getAttribute("style");if(n){let i=g0(n);if(i)return i}let r=t.querySelector("li");if(r){let i=r.getAttribute("style");if(i){let o=g0(i);if(o)return o}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,type:n,...r}=t,i=ce(this.options.HTMLAttributes,r);return e!==1&&(i.start=e),n&&n!=="1"&&(i.type=n),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];let n=t.start||1,r=t.typeMarker,i=t.items?HI(t.items,e):[],o={};return n!==1&&(o.start=n),r&&(o.type=r),Object.keys(o).length>0?{type:"orderedList",attrs:o,content:i}:{type:"orderedList",content:i}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
1512
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{let e=t.match(NI),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r,i;let o=t.split(`
|
|
1513
|
+
`),[s,l]=FI(o);if(s.length===0)return;let a=v0(s,s[0].indent,n);if(a.length===0)return;let c=((r=s[0])==null?void 0:r.number)||1,u=(i=s[0])==null?void 0:i.type;return{type:"list",ordered:!0,start:c,typeMarker:u,items:a,raw:o.slice(0,l).join(`
|
|
1514
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(jI,this.editor.getAttributes(p0)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new Y({props:{handlePaste:(t,e)=>{var n,r;let i=(n=e.clipboardData)==null?void 0:n.getData("text/html");if(i?.trim())return!1;let o=(r=e.clipboardData)==null?void 0:r.getData("text/plain");if(!o)return!1;let s=_I(o);if(!s)return!1;try{let l=t.state.schema.nodeFromJSON(s),a=t.state.tr.replaceSelectionWith(l);return t.dispatch(a),!0}catch{return!1}}}})]},addInputRules(){let t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1],e=dn({find:m0,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=dn({find:m0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(p0)}),joinPredicate:t,editor:this.editor})),[e]}}),qI=/^\s*(\[([( |x])?\])\s$/,Is=be.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{let n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){let r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;let i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return ls(t,e,i)},addExtensions(){return this.options.nested?[y0(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{let i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=f=>{var h,m;l.ariaLabel=((m=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:m.call(h,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};c(t),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:h}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{let y=n();if(typeof y!="number")return!1;let x=m.doc.nodeAt(y);return m.setNodeMarkup(y,void 0,{...x?.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,h)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,h])=>{i.setAttribute(f,h)}),i.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,o.append(l,s),i.append(o,a),Object.entries(e).forEach(([f,h])=>{i.setAttribute(f,h)});let u=new Set(Object.keys(e));return{dom:i,contentDOM:a,update:f=>{if(f.type!==this.type)return!1;i.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,c(f);let h=r.extensionManager.attributes,m=Fi(f,h),y=new Set(Object.keys(m)),x=this.options.HTMLAttributes;return u.forEach(k=>{y.has(k)||(k in x?i.setAttribute(k,x[k]):i.removeAttribute(k))}),Object.entries(m).forEach(([k,S])=>{S==null?k in x?i.setAttribute(k,x[k]):i.removeAttribute(k):i.setAttribute(k,S)}),u=y,!0}}}},addInputRules(){return[dn({find:qI,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Ls=be.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",ce(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
1515
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;let n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){let r=o=>{let s=xa(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(o)},i=xa(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,s)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:s}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),u$=fe.create({name:"listKit",addExtensions(){let t=[];return this.options.bulletList!==!1&&t.push(Ah.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Nh.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Dh.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Ph.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Is.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Ls.configure(this.options.taskList)),t}});var gc=" ",zh=" ",C0=be.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ce(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{let n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);let r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===gc||n[0].text===gc||n[0].raw===zh||n[0].text===zh)&&r.length===1&&r[0].type==="text"&&(r[0].text===gc||r[0].text===zh)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{var r,i;if(!t)return"";let o=Array.isArray(t.content)?t.content:[];if(o.length===0){let s=Array.isArray((r=n?.previousNode)==null?void 0:r.content)?n.previousNode.content:[];return((i=n?.previousNode)==null?void 0:i.type)==="paragraph"&&s.length===0?gc:""}return e.renderChildren(o)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var VI=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,WI=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,E0=Ot.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",ce(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[fn({find:VI,type:this.type})]},addPasteRules(){return[qt({find:WI,type:this.type})]}});var T0=be.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});var M0=Ot.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",ce(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){let i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;let o=i[2].trim();return{type:"underline",raw:i[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function A0(t={}){return new Y({view(e){return new Bh(e,t)}})}var Bh=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),s=o.width/i.offsetWidth,l=o.height/i.offsetHeight;if(n){let f=e.nodeBefore,h=e.nodeAfter;if(f||h){let m=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(m){let y=m.getBoundingClientRect(),x=f?y.bottom:y.top;f&&h&&(x=(x+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*l;r={left:y.left,right:y.right,top:x-k,bottom:x+k}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*s;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,m=f.height/a.offsetHeight;c=f.left-a.scrollLeft*h,u=f.top-a.scrollTop*m}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(!n||o)return null;let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=jl(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}return s}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};var ft=class t extends ee{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):ee.near(r)}content(){return q.empty}eq(e){return e instanceof t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))}getBookmark(){return new Fh(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!UI(e)||!KI(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&t.valid(e))return e;let i=e.pos,o=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){o=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;i+=n;let a=e.doc.resolve(i);if(t.valid(a))return a}for(;;){let s=n>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Q.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=s,i+=n;let l=e.doc.resolve(i);if(t.valid(l))return l}return null}}};ft.prototype.visible=!1;ft.findFrom=ft.findGapCursorFrom;ee.jsonID("gapcursor",ft);var Fh=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ft.valid(n)?new ft(n):ee.near(n)}};function R0(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function UI(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||R0(i.type))return!0;if(i.inlineContent)return!1}}return!0}function KI(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||R0(i.type))return!0;if(i.inlineContent)return!1}}return!0}function I0(){return new Y({props:{decorations:YI,createSelectionBetween(t,e,n){return e.pos==n.pos&&ft.valid(n)?new ft(n):null},handleClick:GI,handleKeyDown:JI,handleDOMEvents:{beforeinput:XI}}})}var JI=es({ArrowLeft:yc("horiz",-1),ArrowRight:yc("horiz",1),ArrowUp:yc("vert",-1),ArrowDown:yc("vert",1)});function yc(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof X){if(!o.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=ft.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new ft(c))),!0):!1}}function GI(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ft.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Q.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ft(r))),!0)}function XI(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ft))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=F.empty;for(let s=r.length-1;s>=0;s--)i=F.from(r[s].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new q(i,0,0));return o.setSelection(X.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function YI(t){if(!(t.selection instanceof ft))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(t.doc,[Ce.widget(t.selection.head,e,{key:"gapcursor"})])}var bc=200,rt=function(){};rt.prototype.append=function(e){return e.length?(e=rt.from(e),!this.length&&e||e.length<bc&&this.leafAppend(e)||this.length<bc&&e.leafPrepend(this)||this.appendInner(e)):this};rt.prototype.prepend=function(e){return e.length?rt.from(e).append(this):this};rt.prototype.appendInner=function(e){return new QI(this,e)};rt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?rt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};rt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};rt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};rt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(e(o,s))},n,r),i};rt.from=function(e){return e instanceof rt?e:e&&e.length?new L0(e):rt.empty};var L0=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,s,l){for(var a=o;a<s;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,s,l){for(var a=o-1;a>=s;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=bc)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=bc)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(rt);rt.empty=new L0([]);var QI=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,s){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(o,l),s)===!1||o>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,o)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,s){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(o,l)-l,s+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(i,l),o,s)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(rt),$h=rt;var ZI=500,Wr=class t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,u.push(f);return}if(i){u.push(new mn(f.map));let m=f.step.map(i.slice(o)),y;m&&s.maybeStep(m).doc&&(y=s.mapping.maps[s.mapping.maps.length-1],c.push(new mn(y,void 0,void 0,c.length+u.length))),o--,y&&i.appendMap(y,o)}else s.maybeStep(f.step);if(f.selection)return l=i?f.selection.map(i.slice(o)):f.selection,a=new t(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,i){let o=[],s=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),h=new mn(e.mapping.maps[u],f,n),m;(m=a&&a.merge(h))&&(h=m,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),n&&(s++,n=void 0),i||(a=h)}let c=s-r.depth;return c>tL&&(l=eL(l,c),s-=c),new t(l.append(o),s)}remapping(e,n){let r=new Fo;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new mn(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=n;this.items.forEach(h=>{let m=o.getMirror(--a);if(m==null)return;s=Math.min(s,m);let y=o.maps[m];if(h.step){let x=e.steps[m].invert(e.docs[m]),k=h.selection&&h.selection.map(o.slice(a+1,m));k&&l++,r.push(new mn(y,x,k))}else r.push(new mn(y))},i);let c=[];for(let h=n;h<s;h++)c.push(new mn(o.maps[h]));let u=this.items.slice(0,i).append(c).append(r),f=new t(u,l);return f.emptyItemCount()>ZI&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((s,l)=>{if(l>=e)i.push(s),s.selection&&o++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&o++;let f=new mn(c.invert(),a,u),h,m=i.length-1;(h=i.length&&i[m].merge(f))?i[m]=h:i.push(f)}}else s.map&&r--},this.items.length,0),new t($h.from(i.reverse()),o)}};Wr.empty=new Wr($h.empty,0);function eL(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}var mn=class t{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},gn=class{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}},tL=20;function nL(t,e,n,r){let i=n.getMeta(Vr),o;if(i)return i.historyState;n.getMeta(oL)&&(t=new gn(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Vr))return s.getMeta(Vr).redo?new gn(t.done.addTransform(n,void 0,r,xc(e)),t.undone,N0(n.mapping.maps),t.prevTime,t.prevComposition):new gn(t.done,t.undone.addTransform(n,void 0,r,xc(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!rL(n,t.prevRanges)),c=s?_h(t.prevRanges,n.mapping):N0(n.mapping.maps);return new gn(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,xc(e)),Wr.empty,c,n.time,l??t.prevComposition)}else return(o=n.getMeta("rebased"))?new gn(t.done.rebased(n,o),t.undone.rebased(n,o),_h(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new gn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),_h(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function rL(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function N0(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,s)=>e.push(o,s));return e}function _h(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function iL(t,e,n){let r=xc(e),i=Vr.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),a=new gn(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(Vr,{redo:n,historyState:a})}var Hh=!1,O0=null;function xc(t){let e=t.plugins;if(O0!=e){Hh=!1,O0=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Hh=!0;break}}return Hh}var Vr=new te("history"),oL=new te("closeHistory");function D0(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Y({key:Vr,state:{init(){return new gn(Wr.empty,Wr.empty,null,0,-1)},apply(e,n,r){return nL(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?jh:r=="historyRedo"?qh:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function kc(t,e){return(n,r)=>{let i=Vr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=iL(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}var jh=kc(!1,!0),qh=kc(!0,!0),z$=kc(!1,!1),B$=kc(!0,!1);var q$=fe.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{let e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){let r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{let e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Y({key:new te("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;let i=this.options.limit,o=this.options.autoTrim;if(i==null||i===0||o===!1){t=!0;return}let s=this.storage.characters({node:r.doc});if(s>i){let l=s-i,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let u=r.tr.deleteRange(a,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{let r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;let i=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;let l=e.selection.$head.pos,a=o-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}}),B0=fe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[A0(this.options)]}}),G$=fe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Y({key:new te("focus"),props:{decorations:({doc:t,selection:e})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!n||!r)return ae.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(a.isText)return;if(!(i>=c&&i<=c+a.nodeSize-1))return!1;s+=1});let l=0;return t.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";o.push(Ce.node(c,c+a.nodeSize,{class:this.options.className}))}),ae.create(t,o)}}})]}}),F0=fe.create({name:"gapCursor",addProseMirrorPlugins(){return[I0()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=xe(Z(t,"allowGapCursor",n)))!=null?e:null}}}),$0="placeholder",P0=new te("tiptap__placeholder");function _0(t){let{editor:e,placeholder:n,dataAttribute:r,pos:i,node:o,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=t,u=[a];return s&&u.push(c),Ce.node(i,i+o.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:o,pos:i,hasAnchor:l}):n})}function H0(t,e){return typeof t=="function"?t(e):t}function j0({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:o,to:s}){let{anchor:l}=i,a=[],c=t.isEmpty;return r.nodesBetween(o,s,(u,f)=>{let h=l>=f&&l<=f+u.nodeSize,m=!u.isLeaf&&$i(u);return u.type.isTextblock&&(h||!e.showOnlyCurrent)&&m&&a.push(_0({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:H0(e.emptyNodeClass,{editor:t,node:u,pos:f,hasAnchor:h})},node:u,pos:f})),e.includeChildren}),a}function q0({editor:t,options:e,dataAttribute:n,doc:r,selection:i}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;let{anchor:s}=i,l=[],a=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){let u=r.resolve(s),f=u.depth>0?u.node(1):u.nodeAfter,h=u.depth>0?u.before(1):s;if(f&&f.type.isTextblock&&$i(f)){let m=s>=h&&s<=h+f.nodeSize;l.push(_0({editor:t,isEmptyDoc:a,dataAttribute:n,hasAnchor:m,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:H0(e.emptyNodeClass,{editor:t,node:f,pos:h,hasAnchor:m})},node:f,pos:h}))}}else l.push(...j0({editor:t,options:e,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return ae.create(r,l)}function Ns(t,e){var n;let r=t.resolve(e);if(r.depth===0){let s=(n=r.nodeAfter)!=null?n:r.nodeBefore;if(!s)return{from:e,to:e};let l=r.nodeAfter?e:e-s.nodeSize;return{from:l,to:l+s.nodeSize}}let i=r.before(1),o=r.node(1);return{from:i,to:i+o.nodeSize}}function Os(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function sL(t,e,n){let r=[];return t.forEach((i,o)=>{let s=o,l=s+i.nodeSize,a=s+1,c=l+1;a<n&&c>e&&r.push({from:s,to:l})}),r}function lL(t){if(t.length===0)return[];let e=[...t].sort((r,i)=>r.from-i.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){let i=n[n.length-1],o=e[r];o.from<=i.to?i.to=Math.max(i.to,o.to):n.push({...o})}return n}function aL(t,e){let n=sL(t,e.from,e.to);return n.push(Os(t,Ns(t,e.from))),e.to>e.from?n.push(Os(t,Ns(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(Os(t,Ns(t,Math.min(e.from+1,t.content.size)))),n}function cL(t,e,n){let r=[];if(t.docChanged){let i=ss(t);for(let o of i)r.push(...aL(n.doc,o.newRange))}return t.selectionSet&&(r.push(Os(n.doc,Ns(n.doc,t.mapping.map(e.selection.anchor)))),r.push(Os(n.doc,Ns(n.doc,n.selection.anchor)))),lL(r)}function uL(t,e,n){let r=Math.max(0,Math.min(t,n.content.size)),i=Math.max(r,Math.min(e,n.content.size));return{from:r,to:i}}function fL({decorations:t,ranges:e,editor:n,options:r,dataAttribute:i,doc:o,selection:s}){let l=t;for(let a of e){let{from:c,to:u}=uL(a.from,a.to,o),f=l.find(c,u).filter(m=>m.from>=c&&m.to<=u);f.length&&(l=l.remove(f));let h=j0({editor:n,options:r,dataAttribute:i,doc:o,selection:s,from:c,to:u});h.length&&(l=l.add(o,h))}return l}function dL({editor:t,options:e,dataAttribute:n}){return{init(r,i){let o=q0({editor:t,options:e,dataAttribute:n,doc:i.doc,selection:i.selection});return o??ae.empty},apply(r,i,o,s){if(!r.docChanged&&!r.selectionSet)return i;let l=i.map(r.mapping,r.doc),a=cL(r,o,s);return fL({decorations:l,ranges:a,editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection})}}}function hL(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function pL({editor:t,options:e}){let n=e.dataAttribute?`data-${hL(e.dataAttribute)}`:`data-${$0}`,r=e.showOnlyCurrent&&!e.includeChildren;return new Y({key:P0,...r?{}:{state:dL({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:i,selection:o})=>q0({editor:t,options:e,dataAttribute:n,doc:i,selection:o}):i=>{var o;return e.showOnlyWhenEditable&&!t.isEditable?ae.empty:(o=P0.getState(i))!=null?o:ae.empty}}})}var wc=fe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:$0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[pL({editor:this.editor,options:this.options})]}}),mL=`.ProseMirror:not(.ProseMirror-focused) *::selection {
|
|
1516
|
+
background: transparent;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
|
|
1520
|
+
background: transparent;
|
|
1521
|
+
}`,u3=fe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){let{editor:t,options:e}=this;return t.options.injectCSS&&typeof document<"u"&&Fd(mL,t.options.injectNonce,"selection"),[new Y({key:new te("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||ba(n.selection)||t.view.dragging?null:ae.create(n.doc,[Ce.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}}),gL="skipTrailingNode";function z0({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var V0=fe.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;let e=new te(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Y({key:e,appendTransaction:(i,o,s)=>{let{doc:l,tr:a,schema:c}=s,u=e.getState(s),f=l.content.size,h=c.nodes[n];if(!i.some(m=>m.getMeta(gL))&&u)return a.insert(f,h.create())},state:{init:(i,o)=>{let s=o.tr.doc.lastChild;return!z0({node:s,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;let s=i.doc.lastChild;return!z0({node:s,types:r})}}})]}}),W0=fe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>jh(t,e),redo:()=>({state:t,dispatch:e})=>qh(t,e)}},addProseMirrorPlugins(){return[D0(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});var U0=fe.create({name:"starterKit",addExtensions(){var t,e,n,r;let i=[];return this.options.bold!==!1&&i.push(Vk.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(qk.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Ah.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Wk.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Uk.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Kk.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(B0.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(F0.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(Jk.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Gk.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(W0.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(Xk.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(Yk.configure(this.options.italic)),this.options.listItem!==!1&&i.push(Nh.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(Dh.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(uc.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(Ph.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(C0.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(E0.configure(this.options.strike)),this.options.text!==!1&&i.push(T0.configure(this.options.text)),this.options.underline!==!1&&i.push(M0.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(V0.configure((r=this.options)==null?void 0:r.trailingNode)),i}});var Wh,Uh;if(typeof WeakMap<"u"){let t=new WeakMap;Wh=e=>t.get(e),Uh=(e,n)=>(t.set(e,n),n)}else{let t=[],n=0;Wh=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Uh=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var ze=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){let n=this.map[e];if(n!=t)continue;let r=e%this.width,i=e/this.width|0,o=r+1,s=i+1;for(let l=1;o<this.width&&this.map[e+l]==n;l++)o++;for(let l=1;s<this.height&&this.map[e+this.width*l]==n;l++)s++;return{left:r,top:i,right:o,bottom:s}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){let{left:r,right:i,top:o,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?o==0:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(t,e){let{left:n,right:r,top:i,bottom:o}=this.findCell(t),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(o,c)}}cellsInRect(t){let e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){let o=r*this.width+i,s=this.map[o];n[s]||(n[s]=!0,!(i==t.left&&i&&this.map[o-1]==s||r==t.top&&r&&this.map[o-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){let o=i+n.child(r).nodeSize;if(r==t){let s=e+t*this.width,l=(t+1)*this.width;for(;s<l&&this.map[s]<i;)s++;return s==l?o-1:this.map[s]}i=o}}static get(t){return Wh(t)||Uh(t,yL(t))}};function yL(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);let e=bL(t),n=t.childCount,r=[],i=0,o=null,s=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){let f=t.child(c);u++;for(let y=0;;y++){for(;i<r.length&&r[i]!=0;)i++;if(y==f.childCount)break;let x=f.child(y),{colspan:k,rowspan:S,colwidth:R}=x.attrs;for(let M=0;M<S;M++){if(M+c>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:S-M});break}let N=i+M*e;for(let z=0;z<k;z++){r[N+z]==0?r[N+z]=u:(o||(o=[])).push({type:"collision",row:c,pos:u,n:k-z});let T=R&&R[z];if(T){let P=(N+z)%e*2,$=s[P];$==null||$!=T&&s[P+1]==1?(s[P]=T,s[P+1]=1):$==T&&s[P+1]++}}}i+=k,u+=x.nodeSize}let h=(c+1)*e,m=0;for(;i<h;)r[i++]==0&&m++;m&&(o||(o=[])).push({type:"missing",row:c,n:m}),u++}(e===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});let l=new ze(e,n,r,o),a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(a=!0);return a&&xL(l,s,t),l}function bL(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){let i=t.child(r),o=0;if(n)for(let s=0;s<r;s++){let l=t.child(s);for(let a=0;a<l.childCount;a++){let c=l.child(a);s+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let s=0;s<i.childCount;s++){let l=i.child(s);o+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function xL(t,e,n){t.problems||(t.problems=[]);let r={};for(let i=0;i<t.map.length;i++){let o=t.map[i];if(r[o])continue;r[o]=!0;let s=n.nodeAt(o);if(!s)throw new RangeError(`No cell with offset ${o} found`);let l=null,a=s.attrs;for(let c=0;c<a.colspan;c++){let u=e[(i+c)%t.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=kL(a)))[c]=u)}l&&t.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function kL(t){if(t.colwidth)return t.colwidth.slice();let e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function dt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(let n in t.nodes){let r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var cr=new te("selectingCells");function Ur(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function wL(t){for(let e=t.depth;e>0;e--){let n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Qt(t){let e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Mc(t){let e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let n=Ur(e.$head)||SL(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function SL(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Kh(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function vL(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Xh(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function nw(t,e,n){let r=t.node(-1),i=ze.get(r),o=t.start(-1),s=i.nextCell(t.pos-o,e,n);return s==null?null:t.node(0).resolve(o+s)}function Kr(t,e,n=1){let r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function rw(t,e,n=1){let r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function CL(t,e,n){let r=dt(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var Te=class qn extends ee{constructor(e,n=e){let r=e.node(-1),i=ze.get(r),o=e.start(-1),s=i.rectBetween(e.pos-o,n.pos-o),l=e.node(0),a=i.cellsInRect(s).filter(u=>u!=n.pos-o);a.unshift(n.pos-o);let c=a.map(u=>{let f=r.nodeAt(u);if(!f)throw new RangeError(`No cell with offset ${u} found`);let h=o+u+1;return new Ii(l.resolve(h),l.resolve(h+f.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){let r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Kh(r)&&Kh(i)&&Xh(r,i)){let o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?qn.rowSelection(r,i):o&&this.isColSelection()?qn.colSelection(r,i):new qn(r,i)}return X.between(r,i)}content(){let e=this.$anchorCell.node(-1),n=ze.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},s=[];for(let a=i.top;a<i.bottom;a++){let c=[];for(let u=a*n.width+i.left,f=i.left;f<i.right;f++,u++){let h=n.map[u];if(o[h])continue;o[h]=!0;let m=n.findCell(h),y=e.nodeAt(h);if(!y)throw new RangeError(`No cell with offset ${h} found`);let x=i.left-m.left,k=m.right-i.right;if(x>0||k>0){let S=y.attrs;if(x>0&&(S=Kr(S,0,x)),k>0&&(S=Kr(S,S.colspan-k,k)),m.left<i.left){if(y=y.type.createAndFill(S),!y)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(S)}`)}else y=y.type.create(S,y.content)}if(m.top<i.top||m.bottom>i.bottom){let S={...y.attrs,rowspan:Math.min(m.bottom,i.bottom)-Math.max(m.top,i.top)};m.top<i.top?y=y.type.createAndFill(S):y=y.type.create(S,y.content)}c.push(y)}s.push(e.child(a).copy(F.from(c)))}let l=this.isColSelection()&&this.isRowSelection()?e:s;return new q(F.from(l),1,1)}replace(e,n=q.empty){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:a}=i[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?q.empty:n)}let o=ee.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,n){this.replace(e,new q(F.from(n),0,0))}forEachCell(e){let n=this.$anchorCell.node(-1),r=ze.get(n),i=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let s=0;s<o.length;s++)e(n.nodeAt(o[s]),i+o[s])}isColSelection(){let e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){let r=e.node(-1),i=ze.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(n.pos-o),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(o+i.map[s.left])),l.bottom<i.height&&(n=a.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(o+i.map[l.left])),s.bottom<i.height&&(e=a.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new qn(e,n)}isRowSelection(){let e=this.$anchorCell.node(-1),n=ze.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(i,o)>0)return!1;let s=i+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(e){return e instanceof qn&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=e.node(-1),i=ze.get(r),o=e.start(-1),s=i.findCell(e.pos-o),l=i.findCell(n.pos-o),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(o+i.map[s.top*i.width])),l.right<i.width&&(n=a.resolve(o+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(o+i.map[l.top*i.width])),s.right<i.width&&(e=a.resolve(o+i.map[i.width*(s.top+1)-1]))),new qn(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new qn(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new qn(e.resolve(n),e.resolve(r))}getBookmark(){return new EL(this.$anchorCell.pos,this.$headCell.pos)}};Te.prototype.visible=!1;ee.jsonID("cell",Te);var EL=class iw{constructor(e,n){this.anchor=e,this.head=n}map(e){return new iw(e.map(this.anchor),e.map(this.head))}resolve(e){let n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Xh(n,r)?new Te(n,r):ee.near(r,1)}};function TL(t){if(!(t.selection instanceof Te))return null;let e=[];return t.selection.forEachCell((n,r)=>{e.push(Ce.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ae.create(t.doc,e)}function ML({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let o=e.depth;o>=0&&!(e.before(o+1)>e.start(o));o--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function AL({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){let o=t.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let i=e.depth;i>0;i--){let o=e.node(i);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&e.parentOffset===0}function RL(t,e,n){let r=(e||t).selection,i=(e||t).doc,o,s;if(r instanceof Q&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=Te.create(i,r.from);else if(s=="row"){let l=i.resolve(r.from+1);o=Te.rowSelection(l,l)}else if(!n){let l=ze.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=Te.create(i,a+1,c)}}else r instanceof X&&ML(r)?o=X.create(i,r.from):r instanceof X&&AL(r)&&(o=X.create(i,r.$from.start(),r.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var IL=new te("fix-tables");function ow(t,e,n,r){let i=t.childCount,o=e.childCount;e:for(let s=0,l=0;s<o;s++){let a=e.child(s);for(let c=l,u=Math.min(i,s+3);c<u;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<i&&t.child(l).sameMarkup(a)?ow(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function Yh(t,e){let n,r=(i,o)=>{i.type.spec.tableRole=="table"&&(n=LL(t,i,o,n))};return e?e.doc!=t.doc&&ow(e.doc,t.doc,0,r):t.doc.descendants(r),n}function LL(t,e,n,r){let i=ze.get(e);if(!i.problems)return r;r||(r=t.tr);let o=[];for(let a=0;a<i.height;a++)o.push(0);for(let a=0;a<i.problems.length;a++){let c=i.problems[a];if(c.type=="collision"){let u=e.nodeAt(c.pos);if(!u)continue;let f=u.attrs;for(let h=0;h<f.rowspan;h++)o[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Kr(f,f.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){let u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<o.length;a++)o[a]&&(s==null&&(s=a),l=a);for(let a=0,c=n+1;a<i.height;a++){let u=e.child(a),f=c+u.nodeSize,h=o[a];if(h>0){let m="cell";u.firstChild&&(m=u.firstChild.type.spec.tableRole);let y=[];for(let k=0;k<h;k++){let S=dt(t.schema)[m].createAndFill();S&&y.push(S)}let x=(a==0||s==a-1)&&l==a?c+1:f-1;r.insert(r.mapping.map(x),y)}c=f}return r.setMeta(IL,{fixTables:!0})}function yn(t){let e=t.selection,n=Mc(t),r=n.node(-1),i=n.start(-1),o=ze.get(r);return{...e instanceof Te?o.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function sw(t,{map:e,tableStart:n,table:r},i){let o=i>0?-1:0;CL(e,r,i+o)&&(o=i==0||i==e.width?null:0);for(let s=0;s<e.height;s++){let l=s*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){let a=e.map[l],c=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,rw(c.attrs,i-e.colCount(a))),s+=c.attrs.rowspan-1}else{let a=o==null?dt(r.type.schema).cell:r.nodeAt(e.map[l+o]).type,c=e.positionAt(s,i,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function lw(t,e){if(!Qt(t))return!1;if(e){let n=yn(t);e(sw(t.tr,n,n.left))}return!0}function aw(t,e){if(!Qt(t))return!1;if(e){let n=yn(t);e(sw(t.tr,n,n.right))}return!0}function NL(t,{map:e,table:n,tableStart:r},i){let o=t.mapping.maps.length;for(let s=0;s<e.height;){let l=s*e.width+i,a=e.map[l],c=n.nodeAt(a),u=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(o).map(r+a),null,Kr(u,i-e.colCount(a)));else{let f=t.mapping.slice(o).map(r+a);t.delete(f,f+c.nodeSize)}s+=u.rowspan}}function cw(t,e){if(!Qt(t))return!1;if(e){let n=yn(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;NL(r,n,i),i!=n.left;i--){let o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=ze.get(o)}e(r)}return!0}function OL(t,e,n){var r;let i=dt(e.type.schema).header_cell;for(let o=0;o<t.width;o++)if(((r=e.nodeAt(t.map[o+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function uw(t,{map:e,tableStart:n,table:r},i){let o=n;for(let c=0;c<i;c++)o+=r.child(c).nodeSize;let s=[],l=i>0?-1:0;OL(e,r,i+l)&&(l=i==0||i==e.height?null:0);for(let c=0,u=e.width*i;c<e.width;c++,u++)if(i>0&&i<e.height&&e.map[u]==e.map[u-e.width]){let f=e.map[u],h=r.nodeAt(f).attrs;t.setNodeMarkup(n+f,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var a;let f=l==null?dt(r.type.schema).cell:(a=r.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,h=f?.createAndFill();h&&s.push(h)}return t.insert(o,dt(r.type.schema).row.create(null,s)),t}function fw(t,e){if(!Qt(t))return!1;if(e){let n=yn(t);e(uw(t.tr,n,n.top))}return!0}function dw(t,e){if(!Qt(t))return!1;if(e){let n=yn(t);e(uw(t.tr,n,n.bottom))}return!0}function DL(t,{map:e,table:n,tableStart:r},i){let o=0;for(let c=0;c<i;c++)o+=n.child(c).nodeSize;let s=o+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(o+r,s+r);let a=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){let f=e.map[u];if(!a.has(f)){if(a.add(f),i>0&&f==e.map[u-e.width]){let h=n.nodeAt(f).attrs;t.setNodeMarkup(t.mapping.slice(l).map(f+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(i<e.height&&f==e.map[u+e.width]){let h=n.nodeAt(f),m=h.attrs,y=h.type.create({...m,rowspan:h.attrs.rowspan-1},h.content),x=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+x),y),c+=m.colspan-1}}}}function hw(t,e){if(!Qt(t))return!1;if(e){let n=yn(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;DL(r,n,i),i!=n.top;i--){let o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=ze.get(n.table)}e(r)}return!0}function K0(t){let e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function PL({width:t,height:e,map:n},r){let i=r.top*t+r.left,o=i,s=(r.bottom-1)*t+r.left,l=i+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[o]==n[o-1]||r.right<t&&n[l]==n[l+1])return!0;o+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[s]==n[s+t])return!0;i++,s++}return!1}function Qh(t,e){let n=t.selection;if(!(n instanceof Te)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=yn(t),{map:i}=r;if(PL(i,r))return!1;if(e){let o=t.tr,s={},l=F.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let f=r.left;f<r.right;f++){let h=i.map[u*i.width+f],m=r.table.nodeAt(h);if(!(s[h]||!m))if(s[h]=!0,a==null)a=h,c=m;else{K0(m)||(l=l.append(m.content));let y=o.mapping.map(h+r.tableStart);o.delete(y,y+m.nodeSize)}}if(a==null||c==null)return!0;if(o.setNodeMarkup(a+r.tableStart,null,{...rw(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){let u=a+1+c.content.size,f=K0(c)?a+1:u;o.replaceWith(f+r.tableStart,u+r.tableStart,l)}o.setSelection(new Te(o.doc.resolve(a+r.tableStart))),e(o)}return!0}function Zh(t,e){let n=dt(t.schema);return zL(({node:r})=>n[r.type.spec.tableRole])(t,e)}function zL(t){return(e,n)=>{let r=e.selection,i,o;if(r instanceof Te){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,o=r.$anchorCell.pos}else{var s;if(i=wL(r.$from),!i)return!1;o=(s=Ur(r.$from))===null||s===void 0?void 0:s.pos}if(i==null||o==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let l=i.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let u=yn(e),f=e.tr;for(let m=0;m<u.right-u.left;m++)a.push(c?{...l,colwidth:c&&c[m]?[c[m]]:null}:l);let h;for(let m=u.top;m<u.bottom;m++){let y=u.map.positionAt(m,u.left,u.table);m==u.top&&(y+=i.nodeSize);for(let x=u.left,k=0;x<u.right;x++,k++)x==u.left&&m==u.top||f.insert(h=f.mapping.map(y+u.tableStart,1),t({node:i,row:m,col:x}).createAndFill(a[k]))}f.setNodeMarkup(o,t({node:i,row:u.top,col:u.left}),a[0]),r instanceof Te&&f.setSelection(new Te(f.doc.resolve(r.$anchorCell.pos),h?f.doc.resolve(h):void 0)),n(f)}return!0}}function pw(t,e){return function(n,r){if(!Qt(n))return!1;let i=Mc(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){let o=n.tr;n.selection instanceof Te?n.selection.forEachCell((s,l)=>{s.attrs[t]!==e&&o.setNodeMarkup(l,null,{...s.attrs,[t]:e})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(o)}return!0}}function BL(t){return function(e,n){if(!Qt(e))return!1;if(n){let r=dt(e.schema),i=yn(e),o=e.tr,s=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(a=>i.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[a],r.cell,l[a].attrs);if(o.steps.length===0)for(let a=0;a<s.length;a++)o.setNodeMarkup(i.tableStart+s[a],r.header_cell,l[a].attrs);n(o)}return!0}}function J0(t,e,n){let r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){let o=e.table.nodeAt(r[i]);if(o&&o.type!==n.header_cell)return!1}return!0}function Ki(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?BL(t):function(n,r){if(!Qt(n))return!1;if(r){let i=dt(n.schema),o=yn(n),s=n.tr,l=J0("row",o,i),a=J0("column",o,i),c=(t==="column"?l:t==="row"&&a)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:o.map.height}:t=="row"?{left:c,top:0,right:o.map.width,bottom:1}:o,f=t=="column"?a?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;o.map.cellsInRect(u).forEach(h=>{let m=h+o.tableStart,y=s.doc.nodeAt(m);y&&s.setNodeMarkup(m,f,y.attrs)}),r(s)}return!0}}var W3=Ki("row",{useDeprecatedLogic:!0}),U3=Ki("column",{useDeprecatedLogic:!0}),mw=Ki("cell",{useDeprecatedLogic:!0});function FL(t,e){if(e<0){let n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){let o=t.node(-1).child(r),s=o.lastChild;if(s)return i-1-s.nodeSize;i-=o.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;let n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){let o=n.child(r);if(o.childCount)return i+1;i+=o.nodeSize}}return null}function ep(t){return function(e,n){if(!Qt(e))return!1;let r=FL(Mc(e),t);if(r==null)return!1;if(n){let i=e.doc.resolve(r);n(e.tr.setSelection(X.between(i,vL(i))).scrollIntoView())}return!0}}function gw(t,e){let n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Sc(t,e){let n=t.selection;if(!(n instanceof Te))return!1;if(e){let r=t.tr,i=dt(t.schema).cell.createAndFill().content;n.forEachCell((o,s)=>{o.content.eq(i)||r.replace(r.mapping.map(s+1),r.mapping.map(s+o.nodeSize-1),new q(i,0,0))}),r.docChanged&&e(r)}return!0}function $L(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;let i=e.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if(o=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content,u=a?0:Math.max(0,n-1),f=a<e.childCount-1?0:Math.max(0,r-1);(u||f)&&(c=Jh(dt(s).row,new q(c,u,f)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(n||r?Jh(dt(s).row,new q(e,n,r)).content:e);else return null;return _L(s,l)}function _L(t,e){let n=[];for(let i=0;i<e.length;i++){let o=e[i];for(let s=o.childCount-1;s>=0;s--){let{rowspan:l,colspan:a}=o.child(s).attrs;for(let c=i;c<i+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(F.empty),n[i]<r){let o=dt(t).cell.createAndFill(),s=[];for(let l=n[i];l<r;l++)s.push(o);e[i]=e[i].append(F.from(s))}return{height:e.length,width:r,rows:e}}function Jh(t,e){let n=t.createAndFill();return new Zn(n).replace(0,n.content.size,e).doc}function HL({width:t,height:e,rows:n},r,i){if(t!=r){let o=[],s=[];for(let l=0;l<n.length;l++){let a=n[l],c=[];for(let u=o[l]||0,f=0;u<r;f++){let h=a.child(f%a.childCount);u+h.attrs.colspan>r&&(h=h.type.createChecked(Kr(h.attrs,h.attrs.colspan,u+h.attrs.colspan-r),h.content)),c.push(h),u+=h.attrs.colspan;for(let m=1;m<h.attrs.rowspan;m++)o[l+m]=(o[l+m]||0)+h.attrs.colspan}s.push(F.from(c))}n=s,t=r}if(e!=i){let o=[];for(let s=0,l=0;s<i;s++,l++){let a=[],c=n[l%e];for(let u=0;u<c.childCount;u++){let f=c.child(u);s+f.attrs.rowspan>i&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,i-f.attrs.rowspan)},f.content)),a.push(f)}o.push(F.from(a))}n=o,e=i}return{width:t,height:e,rows:n}}function jL(t,e,n,r,i,o,s){let l=t.doc.type.schema,a=dt(l),c,u;if(i>e.width)for(let f=0,h=0;f<e.height;f++){let m=n.child(f);h+=m.nodeSize;let y=[],x;m.lastChild==null||m.lastChild.type==a.cell?x=c||(c=a.cell.createAndFill()):x=u||(u=a.header_cell.createAndFill());for(let k=e.width;k<i;k++)y.push(x);t.insert(t.mapping.slice(s).map(h-1+r),y)}if(o>e.height){let f=[];for(let y=0,x=(e.height-1)*e.width;y<Math.max(e.width,i);y++){let k=y>=e.width?!1:n.nodeAt(e.map[x+y]).type==a.header_cell;f.push(k?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let h=a.row.create(null,F.from(f)),m=[];for(let y=e.height;y<o;y++)m.push(h);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),m)}return!!(c||u)}function G0(t,e,n,r,i,o,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=i;c<o;c++){let u=s*e.width+c,f=e.map[u];if(e.map[u-e.width]==f){a=!0;let h=n.nodeAt(f),{top:m,left:y}=e.findCell(f);t.setNodeMarkup(t.mapping.slice(l).map(f+r),null,{...h.attrs,rowspan:s-m}),t.insert(t.mapping.slice(l).map(e.positionAt(s,y,n)),h.type.createAndFill({...h.attrs,rowspan:m+h.attrs.rowspan-s})),c+=h.attrs.colspan-1}}return a}function X0(t,e,n,r,i,o,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=i;c<o;c++){let u=c*e.width+s,f=e.map[u];if(e.map[u-1]==f){a=!0;let h=n.nodeAt(f),m=e.colCount(f),y=t.mapping.slice(l).map(f+r);t.setNodeMarkup(y,null,Kr(h.attrs,s-m,h.attrs.colspan-(s-m))),t.insert(y+h.nodeSize,h.type.createAndFill(Kr(h.attrs,0,s-m))),c+=h.attrs.rowspan-1}}return a}function Y0(t,e,n,r,i){let o=n?t.doc.nodeAt(n-1):t.doc;if(!o)throw new Error("No table found");let s=ze.get(o),{top:l,left:a}=r,c=a+i.width,u=l+i.height,f=t.tr,h=0;function m(){if(o=n?f.doc.nodeAt(n-1):f.doc,!o)throw new Error("No table found");s=ze.get(o),h=f.mapping.maps.length}jL(f,s,o,n,c,u,h)&&m(),G0(f,s,o,n,a,c,l,h)&&m(),G0(f,s,o,n,a,c,u,h)&&m(),X0(f,s,o,n,l,u,a,h)&&m(),X0(f,s,o,n,l,u,c,h)&&m();for(let y=l;y<u;y++){let x=s.positionAt(y,a,o),k=s.positionAt(y,c,o);f.replace(f.mapping.slice(h).map(x+n),f.mapping.slice(h).map(k+n),new q(i.rows[y-l],0,0))}m(),f.setSelection(new Te(f.doc.resolve(n+s.positionAt(l,a,o)),f.doc.resolve(n+s.positionAt(u-1,c-1,o)))),e(f)}var qL=es({ArrowLeft:vc("horiz",-1),ArrowRight:vc("horiz",1),ArrowUp:vc("vert",-1),ArrowDown:vc("vert",1),"Shift-ArrowLeft":Cc("horiz",-1),"Shift-ArrowRight":Cc("horiz",1),"Shift-ArrowUp":Cc("vert",-1),"Shift-ArrowDown":Cc("vert",1),Backspace:Sc,"Mod-Backspace":Sc,Delete:Sc,"Mod-Delete":Sc});function Ec(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function vc(t,e){return(n,r,i)=>{if(!i)return!1;let o=n.selection;if(o instanceof Te)return Ec(n,r,ee.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;let s=yw(i,t,e);if(s==null)return!1;if(t=="horiz")return Ec(n,r,ee.near(n.doc.resolve(o.head+e),e));{let l=n.doc.resolve(s),a=nw(l,t,e),c;return a?c=ee.near(a,1):e<0?c=ee.near(n.doc.resolve(l.before(-1)),-1):c=ee.near(n.doc.resolve(l.after(-1)),1),Ec(n,r,c)}}}function Cc(t,e){return(n,r,i)=>{if(!i)return!1;let o=n.selection,s;if(o instanceof Te)s=o;else{let a=yw(i,t,e);if(a==null)return!1;s=new Te(n.doc.resolve(a))}let l=nw(s.$headCell,t,e);return l?Ec(n,r,new Te(s.$anchorCell,l)):!1}}function VL(t,e){let n=t.state.doc,r=Ur(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Te(r))),!0):!1}function WL(t,e,n){if(!Qt(t.state))return!1;let r=$L(n),i=t.state.selection;if(i instanceof Te){r||(r={width:1,height:1,rows:[F.from(Jh(dt(t.state.schema).cell,n))]});let o=i.$anchorCell.node(-1),s=i.$anchorCell.start(-1),l=ze.get(o).rectBetween(i.$anchorCell.pos-s,i.$headCell.pos-s);return r=HL(r,l.right-l.left,l.bottom-l.top),Y0(t.state,t.dispatch,s,l,r),!0}else if(r){let o=Mc(t.state),s=o.start(-1);return Y0(t.state,t.dispatch,s,ze.get(o.node(-1)).findCell(o.pos-s),r),!0}else return!1}function UL(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;let r=Q0(t,e.target),i;if(e.shiftKey&&t.state.selection instanceof Te)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Ur(t.state.selection.$anchor))!=null&&((n=Vh(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)o(i,e),e.preventDefault();else if(!r)return;function o(a,c){let u=Vh(t,c),f=cr.getState(t.state)==null;if(!u||!Xh(a,u))if(f)u=a;else return;let h=new Te(a,u);if(f||!t.state.selection.eq(h)){let m=t.state.tr.setSelection(h);f&&m.setMeta(cr,a.pos),t.dispatch(m)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),cr.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(cr,-1))}function l(a){let c=a,u=cr.getState(t.state),f;if(u!=null)f=t.state.doc.resolve(u);else if(Q0(t,c.target)!=r&&(f=Vh(t,e),!f))return s();f&&o(f,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function yw(t,e,n){if(!(t.state.selection instanceof X))return null;let{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){let s=r.before(i),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?s:null}}return null}function Q0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Vh(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Ur(t.state.doc.resolve(r))||Ur(t.state.doc.resolve(i))}var KL=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Gh(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,Gh(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Gh(t,e,n,r,i,o){let s=0,l=!0,a=e.firstChild,c=t.firstChild;if(c){for(let f=0,h=0;f<c.childCount;f++){let{colspan:m,colwidth:y}=c.child(f).attrs;for(let x=0;x<m;x++,h++){let k=i==h?o:y&&y[x],S=k?k+"px":"";if(s+=k||r,k||(l=!1),a)a.style.width!=S&&(a.style.width=S),a=a.nextSibling;else{let R=document.createElement("col");R.style.width=S,e.appendChild(R)}}}for(;a;){var u;let f=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=f}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}var Dt=new te("tableColumnResizing");function bw({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=KL,lastColumnResizable:i=!0}={}){let o=new Y({key:Dt,state:{init(s,l){var a;let c=(a=o.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=dt(l.schema).table.name;return r&&c&&(c[u]=(f,h)=>new r(f,n,h)),new JL(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=Dt.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{GL(s,l,t,i)},mouseleave:s=>{XL(s)},mousedown:(s,l)=>{YL(s,l,e,n)}},decorations:s=>{let l=Dt.getState(s);if(l&&l.activeHandle>-1)return nN(s,l.activeHandle)},nodeViews:{}}});return o}var JL=class Tc{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){let n=this,r=e.getMeta(Dt);if(r&&r.setHandle!=null)return new Tc(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Tc(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Kh(e.doc.resolve(i))||(i=-1),new Tc(i,n.dragging)}return n}};function GL(t,e,n,r){if(!t.editable)return;let i=Dt.getState(t.state);if(i&&!i.dragging){let o=ZL(e.target),s=-1;if(o){let{left:l,right:a}=o.getBoundingClientRect();e.clientX-l<=n?s=Z0(t,e,"left",n):a-e.clientX<=n&&(s=Z0(t,e,"right",n))}if(s!=i.activeHandle){if(!r&&s!==-1){let l=t.state.doc.resolve(s),a=l.node(-1),c=ze.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}xw(t,s)}}}function XL(t){if(!t.editable)return;let e=Dt.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&xw(t,-1)}function YL(t,e,n,r){var i;if(!t.editable)return!1;let o=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,s=Dt.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=t.state.doc.nodeAt(s.activeHandle),a=QL(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Dt,{setDragging:{startX:e.clientX,startWidth:a}}));function c(f){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);let h=Dt.getState(t.state);h?.dragging&&(eN(t,h.activeHandle,ew(h.dragging,f,n)),t.dispatch(t.state.tr.setMeta(Dt,{setDragging:null})))}function u(f){if(!f.which)return c(f);let h=Dt.getState(t.state);if(h&&h.dragging){let m=ew(h.dragging,f,n);tw(t,h.activeHandle,m,r)}}return tw(t,s.activeHandle,a,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),e.preventDefault(),!0}function QL(t,e,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=t.domAtPos(e),s=o.node.childNodes[o.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(s-=r[a],l--);return s/l}function ZL(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Z0(t,e,n,r){let i=n=="right"?-r:r,o=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!o)return-1;let{pos:s}=o,l=Ur(t.state.doc.resolve(s));if(!l)return-1;if(n=="right")return l.pos;let a=ze.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function ew(t,e,n){let r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function xw(t,e){t.dispatch(t.state.tr.setMeta(Dt,{setHandle:e}))}function eN(t,e,n){let r=t.state.doc.resolve(e),i=r.node(-1),o=ze.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<o.height;c++){let u=c*o.width+l;if(c&&o.map[u]==o.map[u-o.width])continue;let f=o.map[u],h=i.nodeAt(f).attrs,m=h.colspan==1?0:l-o.colCount(f);if(h.colwidth&&h.colwidth[m]==n)continue;let y=h.colwidth?h.colwidth.slice():tN(h.colspan);y[m]=n,a.setNodeMarkup(s+f,null,{...h,colwidth:y})}a.docChanged&&t.dispatch(a)}function tw(t,e,n,r){let i=t.state.doc.resolve(e),o=i.node(-1),s=i.start(-1),l=ze.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,a=t.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Gh(o,a.firstChild,a,r,l,n)}function tN(t){return Array(t).fill(0)}function nN(t,e){let n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ae.empty;let o=ze.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<o.height;c++){let u=l+c*o.width;if((l==o.width-1||o.map[u]!=o.map[u+1])&&(c==0||o.map[u]!=o.map[u-o.width])){var a;let f=o.map[u],h=s+f+i.nodeAt(f).nodeSize-1,m=document.createElement("div");m.className="column-resize-handle",!((a=Dt.getState(t))===null||a===void 0)&&a.dragging&&n.push(Ce.node(s+f,s+f+i.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),n.push(Ce.widget(h,m))}}return ae.create(t.doc,n)}function kw({allowTableNodeSelection:t=!1}={}){return new Y({key:cr,state:{init(){return null},apply(e,n){let r=e.getMeta(cr);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;let{deleted:i,pos:o}=e.mapping.mapResult(n);return i?null:o}},props:{decorations:TL,handleDOMEvents:{mousedown:UL},createSelectionBetween(e){return cr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:VL,handleKeyDown:qL,handlePaste:WL},appendTransaction(e,n,r){return RL(r,Yh(r,n),t)}})}function Rc(t){return t==="left"||t==="right"||t==="center"?t:null}function rN(t){let e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return Rc(e||n)}function iN(t){return Rc(t?.align)}function vw(){return{default:null,parseHTML:t=>rN(t),renderHTML:t=>t.align?{style:`text-align: ${t.align}`}:{}}}var oN=be.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;let r=t.getAttribute("colwidth"),i=r?r.split(",").map(o=>parseInt(o,10)):null;if(!i){let o=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(s&&s>-1&&o&&o[s]){let l=o[s].getAttribute("width");return l?[parseInt(l,10)]:null}}return i}},align:vw()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",ce(this.options.HTMLAttributes,t),0]}}),sN=be.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}},align:vw()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",ce(this.options.HTMLAttributes,t),0]}}),lN=be.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",ce(this.options.HTMLAttributes,t),0]}});function tp(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function ww(t,e,n,r,i,o){var s;let l=0,a=!0,c=e.firstChild,u=t.firstChild;if(u!==null)for(let h=0,m=0;h<u.childCount;h+=1){let{colspan:y,colwidth:x}=u.child(h).attrs;for(let k=0;k<y;k+=1,m+=1){let S=i===m?o:x&&x[k],R=S?`${S}px`:"";if(l+=S||r,S||(a=!1),c){if(c.style.width!==R){let[M,N]=tp(r,S);c.style.setProperty(M,N)}c=c.nextSibling}else{let M=document.createElement("col"),[N,z]=tp(r,S);M.style.setProperty(N,z),e.appendChild(M)}}}for(;c;){let h=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=h}let f=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);a&&!f?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}var aN=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(let[i,o]of Object.entries(r))o!=null&&(i==="style"?this.table.style.cssText=String(o):this.table.setAttribute(i,String(o)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ww(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,ww(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){let e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function cN(t,e,n,r){let i=0,o=!0,s=[],l=t.firstChild;if(!l)return{};for(let f=0,h=0;f<l.childCount;f+=1){let{colspan:m,colwidth:y}=l.child(f).attrs;for(let x=0;x<m;x+=1,h+=1){let k=n===h?r:y&&y[x];i+=k||e,k||(o=!1);let[S,R]=tp(e,k);s.push(["col",{style:`${S}: ${R}`}])}}let a=o?`${i}px`:"",c=o?"":`${i}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}function Sw(t,e){return e?t.createChecked(null,e):t.createAndFill()}function uN(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;let e={};return Object.keys(t.nodes).forEach(n=>{let r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function fN(t,e,n,r,i){let o=uN(t),s=[],l=[];for(let c=0;c<n;c+=1){let u=Sw(o.cell,i);if(u&&l.push(u),r){let f=Sw(o.header_cell,i);f&&s.push(f)}}let a=[];for(let c=0;c<e;c+=1)a.push(o.row.createChecked(null,r&&c===0?s:l));return o.table.createChecked(null,a)}function dN(t){return t instanceof Te}var Ac=({editor:t})=>{let{selection:e}=t.state;if(!dN(e))return!1;let n=0,r=Dd(e.ranges[0].$from,o=>o.type.name==="table");return r?.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},hN="";function pN(t){return(t||"").replace(/\s+/g," ").trim()}function mN(t,e,n={}){var r;let i=(r=n.cellLineSeparator)!=null?r:hN;if(!t||!t.content||t.content.length===0)return"";let o=[];t.content.forEach(x=>{let k=[];x.content&&x.content.forEach(S=>{let R="";S.content&&Array.isArray(S.content)&&S.content.length>1?R=S.content.map(P=>e.renderChildren(P)).join(i):R=S.content?e.renderChildren(S.content):"";let M=pN(R),N=S.type==="tableHeader",z=iN(S.attrs);k.push({text:M,isHeader:N,align:z})}),o.push(k)});let s=o.reduce((x,k)=>Math.max(x,k.length),0);if(s===0)return"";let l=Array.from({length:s}).fill(0);o.forEach(x=>{var k;for(let S=0;S<s;S+=1){let M=(((k=x[S])==null?void 0:k.text)||"").length;M>l[S]&&(l[S]=M),l[S]<3&&(l[S]=3)}});let a=(x,k)=>x+" ".repeat(Math.max(0,k-x.length)),c=o[0],u=c.some(x=>x.isHeader),f=Array.from({length:s}).fill(null);o.forEach(x=>{var k;for(let S=0;S<s;S+=1)!f[S]&&((k=x[S])!=null&&k.align)&&(f[S]=x[S].align)});let h=`
|
|
1522
|
+
`,m=Array.from({length:s}).map((x,k)=>u&&c[k]&&c[k].text||"");return h+=`| ${m.map((x,k)=>a(x,l[k])).join(" | ")} |
|
|
1523
|
+
`,h+=`| ${l.map((x,k)=>{let S=Math.max(3,x),R=f[k];return R==="left"?`:${"-".repeat(S)}`:R==="right"?`${"-".repeat(S)}:`:R==="center"?`:${"-".repeat(S)}:`:"-".repeat(S)}).join(" | ")} |
|
|
1524
|
+
`,(u?o.slice(1):o).forEach(x=>{h+=`| ${Array.from({length:s}).fill(0).map((k,S)=>a(x[S]&&x[S].text||"",l[S])).join(" | ")} |
|
|
1525
|
+
`}),h}var gN=mN,yN=be.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:aN,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=cN(t,this.options.cellMinWidth),o=e.style;function s(){return o||(r?`width: ${r}`:`min-width: ${i}`)}let l=["table",ce(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{let n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){let i=[];t.header.forEach((o,s)=>{var l;let a=Rc((l=r[s])!=null?l:o.align),c=a?{align:a}:{};i.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}return t.rows&&t.rows.forEach(i=>{let o=[];i.forEach((s,l)=>{var a;let c=Rc((a=r[l])!=null?a:s.align),u=c?{align:c}:{};o.push(e.createNode("tableCell",u,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>gN(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>{let s=fN(o.schema,t,e,n);if(i){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(X.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>lw(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>aw(t,e),deleteColumn:()=>({state:t,dispatch:e})=>cw(t,e),addRowBefore:()=>({state:t,dispatch:e})=>fw(t,e),addRowAfter:()=>({state:t,dispatch:e})=>dw(t,e),deleteRow:()=>({state:t,dispatch:e})=>hw(t,e),deleteTable:()=>({state:t,dispatch:e})=>gw(t,e),mergeCells:()=>({state:t,dispatch:e})=>Qh(t,e),splitCell:()=>({state:t,dispatch:e})=>Zh(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Ki("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Ki("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>mw(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Qh(t,e)?!0:Zh(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>pw(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>ep(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ep(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Yh(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=Te.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Ac,"Mod-Backspace":Ac,Delete:Ac,"Mod-Delete":Ac}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[bw({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],kw({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let t=this.options.resizable&&this.editor.isEditable,e=this.options.View;return t||!e?null:({node:n,view:r,HTMLAttributes:i})=>{let o=ce(this.options.HTMLAttributes,i);return new e(n,this.options.cellMinWidth,r,o)}},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:xe(Z(t,"tableRole",e))}}}),Cw=fe.create({name:"tableKit",addExtensions(){let t=[];return this.options.table!==!1&&t.push(yN.configure(this.options.table)),this.options.tableCell!==!1&&t.push(oN.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(sN.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(lN.configure(this.options.tableRow)),t}});function np(t){if(t)throw t}var Nc=qg(Ow(),1);function Ds(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function rp(){let t=[],e={run:n,use:r};return e;function n(...i){let o=-1,s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);l(null,...i);function l(a,...c){let u=t[++o],f=-1;if(a){s(a);return}for(;++f<i.length;)(c[f]===null||c[f]===void 0)&&(c[f]=i[f]);i=c,u?Dw(u,l)(...c):s(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function Dw(t,e){let n;return r;function r(...s){let l=t.length>s.length,a;l&&s.push(i);try{a=t.apply(this,s)}catch(c){let u=c;if(l&&n)throw u;return i(u)}l||(a&&a.then&&typeof a.then=="function"?a.then(o,i):a instanceof Error?i(a):o(a))}function i(s,...l){n||(n=!0,e(s,...l))}function o(s){i(null,s)}}function ur(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Pw(t.position):"start"in t||"end"in t?Pw(t):"line"in t||"column"in t?ip(t):""}function ip(t){return zw(t&&t.line)+":"+zw(t&&t.column)}function Pw(t){return ip(t&&t.start)+"-"+ip(t&&t.end)}function zw(t){return t&&typeof t=="number"?t:1}var Ye=class extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},s=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof e=="string"?i=e:!o.cause&&e&&(s=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof r=="string"){let a=r.indexOf(":");a===-1?o.ruleId=r:(o.source=r.slice(0,a),o.ruleId=r.slice(a+1))}if(!o.place&&o.ancestors&&o.ancestors){let a=o.ancestors[o.ancestors.length-1];a&&(o.place=a.position)}let l=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=ur(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Ye.prototype.file="";Ye.prototype.name="";Ye.prototype.reason="";Ye.prototype.message="";Ye.prototype.stack="";Ye.prototype.column=void 0;Ye.prototype.line=void 0;Ye.prototype.ancestors=void 0;Ye.prototype.cause=void 0;Ye.prototype.fatal=void 0;Ye.prototype.place=void 0;Ye.prototype.ruleId=void 0;Ye.prototype.source=void 0;var Zt={basename:bN,dirname:xN,extname:kN,join:wN,sep:"/"};function bN(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ps(t);let n=0,r=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let s=-1,l=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),l>-1&&(t.codePointAt(i)===e.codePointAt(l--)?l<0&&(r=i):(l=-1,r=s));return n===r?r=s:r<0&&(r=t.length),t.slice(n,r)}function xN(t){if(Ps(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function kN(t){Ps(t);let e=t.length,n=-1,r=0,i=-1,o=0,s;for(;e--;){let l=t.codePointAt(e);if(l===47){if(s){r=e+1;break}continue}n<0&&(s=!0,n=e+1),l===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function wN(...t){let e=-1,n;for(;++e<t.length;)Ps(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":SN(n)}function SN(t){Ps(t);let e=t.codePointAt(0)===47,n=vN(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function vN(t,e){let n="",r=0,i=-1,o=0,s=-1,l,a;for(;++s<=t.length;){if(s<t.length)l=t.codePointAt(s);else{if(l===47)break;l=47}if(l===47){if(!(i===s-1||o===1))if(i!==s-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",r=0):(n=n.slice(0,a),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,s):n=t.slice(i+1,s),r=s-i-1;i=s,o=0}else l===46&&o>-1?o++:o=-1}return n}function Ps(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var Bw={cwd:CN};function CN(){return"/"}function Ji(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Fw(t){if(typeof t=="string")t=new URL(t);else if(!Ji(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return EN(t)}function EN(t){if(t.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let e=t.pathname,n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){let r=e.codePointAt(n+2);if(r===70||r===102){let i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}var op=["history","path","basename","stem","extname","dirname"],zs=class{constructor(e){let n;e?Ji(e)?n={path:e}:typeof e=="string"||TN(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Bw.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<op.length;){let o=op[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)op.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Zt.basename(this.path):void 0}set basename(e){lp(e,"basename"),sp(e,"basename"),this.path=Zt.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Zt.dirname(this.path):void 0}set dirname(e){$w(this.basename,"dirname"),this.path=Zt.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Zt.extname(this.path):void 0}set extname(e){if(sp(e,"extname"),$w(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Zt.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Ji(e)&&(e=Fw(e)),lp(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Zt.basename(this.path,this.extname):void 0}set stem(e){lp(e,"stem"),sp(e,"stem"),this.path=Zt.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){let i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){let i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){let i=new Ye(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}};function sp(t,e){if(t&&t.includes(Zt.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Zt.sep+"`")}function lp(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function $w(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function TN(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var _w=(function(t){let r=this.constructor.prototype,i=r[t],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o});var MN={}.hasOwnProperty,fp=class t extends _w{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=rp()}copy(){let e=new t,n=-1;for(;++n<this.attachers.length;){let r=this.attachers[n];e.use(...r)}return e.data((0,Nc.default)(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(up("data",this.frozen),this.namespace[e]=n,this):MN.call(this.namespace,e)&&this.namespace[e]||void 0:e?(up("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);let i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let n=Lc(e),r=this.parser||this.Parser;return ap("parse",r),r(String(n),n)}process(e,n){let r=this;return this.freeze(),ap("process",this.parser||this.Parser),cp("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,s){let l=Lc(e),a=r.parse(l);r.run(a,l,function(u,f,h){if(u||!f||!h)return c(u);let m=f,y=r.stringify(m,h);RN(y)?h.value=y:h.result=y,c(u,h)});function c(u,f){u||!f?s(u):o?o(f):n(void 0,f)}}}processSync(e){let n=!1,r;return this.freeze(),ap("processSync",this.parser||this.Parser),cp("processSync",this.compiler||this.Compiler),this.process(e,i),jw("processSync","process",n),r;function i(o,s){n=!0,np(o),r=s}}run(e,n,r){Hw(e),this.freeze();let i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(s,l){let a=Lc(n);i.run(e,a,c);function c(u,f,h){let m=f||e;u?l(u):s?s(m):r(void 0,m,h)}}}runSync(e,n){let r=!1,i;return this.run(e,n,o),jw("runSync","run",r),i;function o(s,l){np(s),i=l,r=!0}}stringify(e,n){this.freeze();let r=Lc(n),i=this.compiler||this.Compiler;return cp("stringify",i),Hw(e),i(e,r)}use(e,...n){let r=this.attachers,i=this.namespace;if(up("use",this.frozen),e!=null)if(typeof e=="function")a(e,n);else if(typeof e=="object")Array.isArray(e)?l(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function o(c){if(typeof c=="function")a(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[u,...f]=c;a(u,f)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(i.settings=(0,Nc.default)(!0,i.settings,c.settings))}function l(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){let f=c[u];o(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function a(c,u){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===c){h=f;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[m,...y]=u,x=r[h][1];Ds(x)&&Ds(m)&&(m=(0,Nc.default)(!0,x,m)),r[h]=[c,m,...y]}}}},dp=new fp().freeze();function ap(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function cp(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function up(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Hw(t){if(!Ds(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function jw(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Lc(t){return AN(t)?t:new zs(t)}function AN(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function RN(t){return typeof t=="string"||IN(t)}function IN(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}var LN={};function Jr(t,e){let n=e||LN,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Vw(t,r,i)}function Vw(t,e,n){if(NN(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return qw(t.children,e,n)}return Array.isArray(t)?qw(t,e,n):""}function qw(t,e,n){let r=[],i=-1;for(;++i<t.length;)r[i]=Vw(t[i],e,n);return r.join("")}function NN(t){return!!(t&&typeof t=="object")}var Ww=document.createElement("i");function Gi(t){let e="&"+t+";";Ww.innerHTML=e;let n=Ww.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Be(t,e,n,r){let i=t.length,o=0,s;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(e,0),t.splice(...s),o+=1e4,e+=1e4}function wt(t,e){return t.length>0?(Be(t,t.length,0,e),t):e}var Uw={}.hasOwnProperty;function Oc(t){let e={},n=-1;for(;++n<t.length;)ON(e,t[n]);return e}function ON(t,e){let n;for(n in e){let i=(Uw.call(t,n)?t[n]:void 0)||(t[n]={}),o=e[n],s;if(o)for(s in o){Uw.call(i,s)||(i[s]=[]);let l=o[s];DN(i[s],Array.isArray(l)?l:l?[l]:[])}}}function DN(t,e){let n=-1,r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Be(t,0,0,r)}function Dc(t,e){let n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ht(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var qe=fr(/[A-Za-z]/),Ve=fr(/[\dA-Za-z]/),Kw=fr(/[#-'*+\--9=?A-Z^-~]/);function Gr(t){return t!==null&&(t<32||t===127)}var Bs=fr(/\d/),Jw=fr(/[\dA-Fa-f]/),Gw=fr(/[!-/:-@[-`{-~]/);function U(t){return t!==null&&t<-2}function me(t){return t!==null&&(t<0||t===32)}function ne(t){return t===-2||t===-1||t===32}var Xr=fr(/\p{P}|\p{S}/u),bn=fr(/\s/);function fr(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function re(t,e,n,r){let i=r?r-1:Number.POSITIVE_INFINITY,o=0;return s;function s(a){return ne(a)?(t.enter(n),l(a)):e(a)}function l(a){return ne(a)&&o++<i?(t.consume(a),l):(t.exit(n),e(a))}}var Xw={tokenize:PN};function PN(t){let e=t.attempt(this.parser.constructs.contentInitial,r,i),n;return e;function r(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),re(t,e,"linePrefix")}function i(l){return t.enter("paragraph"),o(l)}function o(l){let a=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,s(l)}function s(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return U(l)?(t.consume(l),t.exit("chunkText"),o):(t.consume(l),s)}}var Qw={tokenize:zN},Yw={tokenize:BN};function zN(t){let e=this,n=[],r=0,i,o,s;return l;function l(M){if(r<n.length){let N=n[r];return e.containerState=N[1],t.attempt(N[0].continuation,a,c)(M)}return c(M)}function a(M){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&R();let N=e.events.length,z=N,T;for(;z--;)if(e.events[z][0]==="exit"&&e.events[z][1].type==="chunkFlow"){T=e.events[z][1].end;break}S(r);let P=N;for(;P<e.events.length;)e.events[P][1].end={...T},P++;return Be(e.events,z+1,0,e.events.slice(N)),e.events.length=P,c(M)}return l(M)}function c(M){if(r===n.length){if(!i)return h(M);if(i.currentConstruct&&i.currentConstruct.concrete)return y(M);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Yw,u,f)(M)}function u(M){return i&&R(),S(r),h(M)}function f(M){return e.parser.lazy[e.now().line]=r!==n.length,s=e.now().offset,y(M)}function h(M){return e.containerState={},t.attempt(Yw,m,y)(M)}function m(M){return r++,n.push([e.currentConstruct,e.containerState]),h(M)}function y(M){if(M===null){i&&R(),S(0),t.consume(M);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),x(M)}function x(M){if(M===null){k(t.exit("chunkFlow"),!0),S(0),t.consume(M);return}return U(M)?(t.consume(M),k(t.exit("chunkFlow")),r=0,e.interrupt=void 0,l):(t.consume(M),x)}function k(M,N){let z=e.sliceStream(M);if(N&&z.push(null),M.previous=o,o&&(o.next=M),o=M,i.defineSkip(M.start),i.write(z),e.parser.lazy[M.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<s&&(!i.events[T][1].end||i.events[T][1].end.offset>s))return;let P=e.events.length,$=P,j,g;for(;$--;)if(e.events[$][0]==="exit"&&e.events[$][1].type==="chunkFlow"){if(j){g=e.events[$][1].end;break}j=!0}for(S(r),T=P;T<e.events.length;)e.events[T][1].end={...g},T++;Be(e.events,$+1,0,e.events.slice(P)),e.events.length=T}}function S(M){let N=n.length;for(;N-- >M;){let z=n[N];e.containerState=z[1],z[0].exit.call(e,t)}n.length=M}function R(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function BN(t,e,n){return re(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vn(t){if(t===null||me(t)||bn(t))return 1;if(Xr(t))return 2}function dr(t,e,n){let r=[],i=-1;for(;++i<t.length;){let o=t[i].resolveAll;o&&!r.includes(o)&&(e=o(e,n),r.push(o))}return e}var Fs={name:"attention",resolveAll:FN,tokenize:$N};function FN(t,e){let n=-1,r,i,o,s,l,a,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;a=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;let f={...t[r][1].end},h={...t[n][1].start};Zw(f,-a),Zw(h,a),s={type:a>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:h},o={type:a>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:a>1?"strong":"emphasis",start:{...s.start},end:{...l.end}},t[r][1].end={...s.start},t[n][1].start={...l.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=wt(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=wt(c,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",o,e]]),c=wt(c,dr(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=wt(c,[["exit",o,e],["enter",l,e],["exit",l,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=wt(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,Be(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function $N(t,e){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Vn(r),o;return s;function s(a){return o=a,t.enter("attentionSequence"),l(a)}function l(a){if(a===o)return t.consume(a),l;let c=t.exit("attentionSequence"),u=Vn(a),f=!u||u===2&&i||n.includes(a),h=!i||i===2&&u||n.includes(r);return c._open=!!(o===42?f:f&&(i||!h)),c._close=!!(o===42?h:h&&(u||!f)),e(a)}}function Zw(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}var hp={name:"autolink",tokenize:_N};function _N(t,e,n){let r=0;return i;function i(m){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),o}function o(m){return qe(m)?(t.consume(m),s):m===64?n(m):c(m)}function s(m){return m===43||m===45||m===46||Ve(m)?(r=1,l(m)):c(m)}function l(m){return m===58?(t.consume(m),r=0,a):(m===43||m===45||m===46||Ve(m))&&r++<32?(t.consume(m),l):(r=0,c(m))}function a(m){return m===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):m===null||m===32||m===60||Gr(m)?n(m):(t.consume(m),a)}function c(m){return m===64?(t.consume(m),u):Kw(m)?(t.consume(m),c):n(m)}function u(m){return Ve(m)?f(m):n(m)}function f(m){return m===46?(t.consume(m),r=0,u):m===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(m),t.exit("autolinkMarker"),t.exit("autolink"),e):h(m)}function h(m){if((m===45||Ve(m))&&r++<63){let y=m===45?h:f;return t.consume(m),y}return n(m)}}var xn={partial:!0,tokenize:HN};function HN(t,e,n){return r;function r(o){return ne(o)?re(t,i,"linePrefix")(o):i(o)}function i(o){return o===null||U(o)?e(o):n(o)}}var Pc={continuation:{tokenize:qN},exit:VN,name:"blockQuote",tokenize:jN};function jN(t,e,n){let r=this;return i;function i(s){if(s===62){let l=r.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(s),t.exit("blockQuoteMarker"),o}return n(s)}function o(s){return ne(s)?(t.enter("blockQuotePrefixWhitespace"),t.consume(s),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(s))}}function qN(t,e,n){let r=this;return i;function i(s){return ne(s)?re(t,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)}function o(s){return t.attempt(Pc,e,n)(s)}}function VN(t){t.exit("blockQuote")}var zc={name:"characterEscape",tokenize:WN};function WN(t,e,n){return r;function r(o){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(o),t.exit("escapeMarker"),i}function i(o){return Gw(o)?(t.enter("characterEscapeValue"),t.consume(o),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(o)}}var Bc={name:"characterReference",tokenize:UN};function UN(t,e,n){let r=this,i=0,o,s;return l;function l(f){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),a}function a(f){return f===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(f),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),o=31,s=Ve,u(f))}function c(f){return f===88||f===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(f),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),o=6,s=Jw,u):(t.enter("characterReferenceValue"),o=7,s=Bs,u(f))}function u(f){if(f===59&&i){let h=t.exit("characterReferenceValue");return s===Ve&&!Gi(r.sliceSerialize(h))?n(f):(t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return s(f)&&i++<o?(t.consume(f),u):n(f)}}var e1={partial:!0,tokenize:JN},Fc={concrete:!0,name:"codeFenced",tokenize:KN};function KN(t,e,n){let r=this,i={partial:!0,tokenize:z},o=0,s=0,l;return a;function a(T){return c(T)}function c(T){let P=r.events[r.events.length-1];return o=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,l=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(T)}function u(T){return T===l?(s++,t.consume(T),u):s<3?n(T):(t.exit("codeFencedFenceSequence"),ne(T)?re(t,f,"whitespace")(T):f(T))}function f(T){return T===null||U(T)?(t.exit("codeFencedFence"),r.interrupt?e(T):t.check(e1,x,N)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),h(T))}function h(T){return T===null||U(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),f(T)):ne(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),re(t,m,"whitespace")(T)):T===96&&T===l?n(T):(t.consume(T),h)}function m(T){return T===null||U(T)?f(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),y(T))}function y(T){return T===null||U(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),f(T)):T===96&&T===l?n(T):(t.consume(T),y)}function x(T){return t.attempt(i,N,k)(T)}function k(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),S}function S(T){return o>0&&ne(T)?re(t,R,"linePrefix",o+1)(T):R(T)}function R(T){return T===null||U(T)?t.check(e1,x,N)(T):(t.enter("codeFlowValue"),M(T))}function M(T){return T===null||U(T)?(t.exit("codeFlowValue"),R(T)):(t.consume(T),M)}function N(T){return t.exit("codeFenced"),e(T)}function z(T,P,$){let j=0;return g;function g(K){return T.enter("lineEnding"),T.consume(K),T.exit("lineEnding"),oe}function oe(K){return T.enter("codeFencedFence"),ne(K)?re(T,G,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):G(K)}function G(K){return K===l?(T.enter("codeFencedFenceSequence"),V(K)):$(K)}function V(K){return K===l?(j++,T.consume(K),V):j>=s?(T.exit("codeFencedFenceSequence"),ne(K)?re(T,J,"whitespace")(K):J(K)):$(K)}function J(K){return K===null||U(K)?(T.exit("codeFencedFence"),P(K)):$(K)}}}function JN(t,e,n){let r=this;return i;function i(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o)}function o(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}var $s={name:"codeIndented",tokenize:XN},GN={partial:!0,tokenize:YN};function XN(t,e,n){let r=this;return i;function i(c){return t.enter("codeIndented"),re(t,o,"linePrefix",5)(c)}function o(c){let u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?a(c):U(c)?t.attempt(GN,s,a)(c):(t.enter("codeFlowValue"),l(c))}function l(c){return c===null||U(c)?(t.exit("codeFlowValue"),s(c)):(t.consume(c),l)}function a(c){return t.exit("codeIndented"),e(c)}}function YN(t,e,n){let r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):U(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):re(t,o,"linePrefix",5)(s)}function o(s){let l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(s):U(s)?i(s):n(s)}}var pp={name:"codeText",previous:ZN,resolve:QN,tokenize:eO};function QN(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function ZN(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function eO(t,e,n){let r=this,i=0,o,s;return l;function l(h){return t.enter("codeText"),t.enter("codeTextSequence"),a(h)}function a(h){return h===96?(t.consume(h),i++,a):(t.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),c):h===96?(s=t.enter("codeTextSequence"),o=0,f(h)):U(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),c):(t.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||U(h)?(t.exit("codeTextData"),c(h)):(t.consume(h),u)}function f(h){return h===96?(t.consume(h),o++,f):o===i?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(s.type="codeTextData",u(h))}}var $c=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){let r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){let i=n||0;this.setCursor(Math.trunc(e));let o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&_s(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),_s(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),_s(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let n=this.left.splice(e,Number.POSITIVE_INFINITY);_s(this.right,n.reverse())}else{let n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);_s(this.left,n.reverse())}}};function _s(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function _c(t){let e={},n=-1,r,i,o,s,l,a,c,u=new $c(t);for(;++n<u.length;){for(;n in e;)n=e[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(a=r[1]._tokenizer.events,o=0,o<a.length&&a[o][1].type==="lineEndingBlank"&&(o+=2),o<a.length&&a[o][1].type==="content"))for(;++o<a.length&&a[o][1].type!=="content";)a[o][1].type==="chunkText"&&(a[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,tO(u,n)),n=e[n],c=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(s=u.get(o),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=o);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},l=u.slice(i,n),l.unshift(r),u.splice(i,n-i+1,l))}}return Be(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function tO(t,e){let n=t.get(e)[1],r=t.get(e)[2],i=e-1,o=[],s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));let l=s.events,a=[],c={},u,f,h=-1,m=n,y=0,x=0,k=[x];for(;m;){for(;t.get(++i)[1]!==m;);o.push(i),m._tokenizer||(u=r.sliceStream(m),m.next||u.push(null),f&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=m,m=m.next}for(m=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(x=h+1,k.push(x),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):k.pop(),h=k.length;h--;){let S=l.slice(k[h],k[h+1]),R=o.pop();a.push([R,R+S.length-1]),t.splice(R,2,S)}for(a.reverse(),h=-1;++h<a.length;)c[y+a[h][0]]=y+a[h][1],y+=a[h][1]-a[h][0]-1;return c}var mp={resolve:rO,tokenize:iO},nO={partial:!0,tokenize:oO};function rO(t){return _c(t),t}function iO(t,e){let n;return r;function r(l){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?o(l):U(l)?t.check(nO,s,o)(l):(t.consume(l),i)}function o(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function s(l){return t.consume(l),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function oO(t,e,n){let r=this;return i;function i(s){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),re(t,o,"linePrefix")}function o(s){if(s===null||U(s))return n(s);let l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(s):t.interrupt(r.parser.constructs.flow,n,e)(s)}}function Hc(t,e,n,r,i,o,s,l,a){let c=a||Number.POSITIVE_INFINITY,u=0;return f;function f(S){return S===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(S),t.exit(o),h):S===null||S===32||S===41||Gr(S)?n(S):(t.enter(r),t.enter(s),t.enter(l),t.enter("chunkString",{contentType:"string"}),x(S))}function h(S){return S===62?(t.enter(o),t.consume(S),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===62?(t.exit("chunkString"),t.exit(l),h(S)):S===null||S===60||U(S)?n(S):(t.consume(S),S===92?y:m)}function y(S){return S===60||S===62||S===92?(t.consume(S),m):m(S)}function x(S){return!u&&(S===null||S===41||me(S))?(t.exit("chunkString"),t.exit(l),t.exit(s),t.exit(r),e(S)):u<c&&S===40?(t.consume(S),u++,x):S===41?(t.consume(S),u--,x):S===null||S===32||S===40||Gr(S)?n(S):(t.consume(S),S===92?k:x)}function k(S){return S===40||S===41||S===92?(t.consume(S),x):x(S)}}function jc(t,e,n,r,i,o){let s=this,l=0,a;return c;function c(m){return t.enter(r),t.enter(i),t.consume(m),t.exit(i),t.enter(o),u}function u(m){return l>999||m===null||m===91||m===93&&!a||m===94&&!l&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(t.exit(o),t.enter(i),t.consume(m),t.exit(i),t.exit(r),e):U(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===null||m===91||m===93||U(m)||l++>999?(t.exit("chunkString"),u(m)):(t.consume(m),a||(a=!ne(m)),m===92?h:f)}function h(m){return m===91||m===92||m===93?(t.consume(m),l++,f):f(m)}}function qc(t,e,n,r,i,o){let s;return l;function l(h){return h===34||h===39||h===40?(t.enter(r),t.enter(i),t.consume(h),t.exit(i),s=h===40?41:h,a):n(h)}function a(h){return h===s?(t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):(t.enter(o),c(h))}function c(h){return h===s?(t.exit(o),a(s)):h===null?n(h):U(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),re(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||U(h)?(t.exit("chunkString"),c(h)):(t.consume(h),h===92?f:u)}function f(h){return h===s||h===92?(t.consume(h),u):u(h)}}function Yr(t,e){let n;return r;function r(i){return U(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):ne(i)?re(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}var gp={name:"definition",tokenize:lO},sO={partial:!0,tokenize:aO};function lO(t,e,n){let r=this,i;return o;function o(m){return t.enter("definition"),s(m)}function s(m){return jc.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return i=ht(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),a):n(m)}function a(m){return me(m)?Yr(t,c)(m):c(m)}function c(m){return Hc(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return t.attempt(sO,f,f)(m)}function f(m){return ne(m)?re(t,h,"whitespace")(m):h(m)}function h(m){return m===null||U(m)?(t.exit("definition"),r.parser.defined.push(i),e(m)):n(m)}}function aO(t,e,n){return r;function r(l){return me(l)?Yr(t,i)(l):n(l)}function i(l){return qc(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function o(l){return ne(l)?re(t,s,"whitespace")(l):s(l)}function s(l){return l===null||U(l)?e(l):n(l)}}var yp={name:"hardBreakEscape",tokenize:cO};function cO(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return U(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}var bp={name:"headingAtx",resolve:uO,tokenize:fO};function uO(t,e){let n=t.length-2,r=3,i,o;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},o={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Be(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function fO(t,e,n){let r=0;return i;function i(u){return t.enter("atxHeading"),o(u)}function o(u){return t.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(t.consume(u),s):u===null||me(u)?(t.exit("atxHeadingSequence"),l(u)):n(u)}function l(u){return u===35?(t.enter("atxHeadingSequence"),a(u)):u===null||U(u)?(t.exit("atxHeading"),e(u)):ne(u)?re(t,l,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function a(u){return u===35?(t.consume(u),a):(t.exit("atxHeadingSequence"),l(u))}function c(u){return u===null||u===35||me(u)?(t.exit("atxHeadingText"),l(u)):(t.consume(u),c)}}var t1=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],xp=["pre","script","style","textarea"];var kp={concrete:!0,name:"htmlFlow",resolveTo:pO,tokenize:mO},dO={partial:!0,tokenize:yO},hO={partial:!0,tokenize:gO};function pO(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function mO(t,e,n){let r=this,i,o,s,l,a;return c;function c(I){return u(I)}function u(I){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(I),f}function f(I){return I===33?(t.consume(I),h):I===47?(t.consume(I),o=!0,x):I===63?(t.consume(I),i=3,r.interrupt?e:A):qe(I)?(t.consume(I),s=String.fromCharCode(I),k):n(I)}function h(I){return I===45?(t.consume(I),i=2,m):I===91?(t.consume(I),i=5,l=0,y):qe(I)?(t.consume(I),i=4,r.interrupt?e:A):n(I)}function m(I){return I===45?(t.consume(I),r.interrupt?e:A):n(I)}function y(I){let Fe="CDATA[";return I===Fe.charCodeAt(l++)?(t.consume(I),l===Fe.length?r.interrupt?e:G:y):n(I)}function x(I){return qe(I)?(t.consume(I),s=String.fromCharCode(I),k):n(I)}function k(I){if(I===null||I===47||I===62||me(I)){let Fe=I===47,Jt=s.toLowerCase();return!Fe&&!o&&xp.includes(Jt)?(i=1,r.interrupt?e(I):G(I)):t1.includes(s.toLowerCase())?(i=6,Fe?(t.consume(I),S):r.interrupt?e(I):G(I)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):o?R(I):M(I))}return I===45||Ve(I)?(t.consume(I),s+=String.fromCharCode(I),k):n(I)}function S(I){return I===62?(t.consume(I),r.interrupt?e:G):n(I)}function R(I){return ne(I)?(t.consume(I),R):g(I)}function M(I){return I===47?(t.consume(I),g):I===58||I===95||qe(I)?(t.consume(I),N):ne(I)?(t.consume(I),M):g(I)}function N(I){return I===45||I===46||I===58||I===95||Ve(I)?(t.consume(I),N):z(I)}function z(I){return I===61?(t.consume(I),T):ne(I)?(t.consume(I),z):M(I)}function T(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(t.consume(I),a=I,P):ne(I)?(t.consume(I),T):$(I)}function P(I){return I===a?(t.consume(I),a=null,j):I===null||U(I)?n(I):(t.consume(I),P)}function $(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||me(I)?z(I):(t.consume(I),$)}function j(I){return I===47||I===62||ne(I)?M(I):n(I)}function g(I){return I===62?(t.consume(I),oe):n(I)}function oe(I){return I===null||U(I)?G(I):ne(I)?(t.consume(I),oe):n(I)}function G(I){return I===45&&i===2?(t.consume(I),se):I===60&&i===1?(t.consume(I),he):I===62&&i===4?(t.consume(I),Qe):I===63&&i===3?(t.consume(I),A):I===93&&i===5?(t.consume(I),Ae):U(I)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(dO,Ze,V)(I)):I===null||U(I)?(t.exit("htmlFlowData"),V(I)):(t.consume(I),G)}function V(I){return t.check(hO,J,Ze)(I)}function J(I){return t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),K}function K(I){return I===null||U(I)?V(I):(t.enter("htmlFlowData"),G(I))}function se(I){return I===45?(t.consume(I),A):G(I)}function he(I){return I===47?(t.consume(I),s="",Ee):G(I)}function Ee(I){if(I===62){let Fe=s.toLowerCase();return xp.includes(Fe)?(t.consume(I),Qe):G(I)}return qe(I)&&s.length<8?(t.consume(I),s+=String.fromCharCode(I),Ee):G(I)}function Ae(I){return I===93?(t.consume(I),A):G(I)}function A(I){return I===62?(t.consume(I),Qe):I===45&&i===2?(t.consume(I),A):G(I)}function Qe(I){return I===null||U(I)?(t.exit("htmlFlowData"),Ze(I)):(t.consume(I),Qe)}function Ze(I){return t.exit("htmlFlow"),e(I)}}function gO(t,e,n){let r=this;return i;function i(s){return U(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):n(s)}function o(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}function yO(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(xn,e,n)}}var wp={name:"htmlText",tokenize:bO};function bO(t,e,n){let r=this,i,o,s;return l;function l(A){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(A),a}function a(A){return A===33?(t.consume(A),c):A===47?(t.consume(A),z):A===63?(t.consume(A),M):qe(A)?(t.consume(A),$):n(A)}function c(A){return A===45?(t.consume(A),u):A===91?(t.consume(A),o=0,y):qe(A)?(t.consume(A),R):n(A)}function u(A){return A===45?(t.consume(A),m):n(A)}function f(A){return A===null?n(A):A===45?(t.consume(A),h):U(A)?(s=f,he(A)):(t.consume(A),f)}function h(A){return A===45?(t.consume(A),m):f(A)}function m(A){return A===62?se(A):A===45?h(A):f(A)}function y(A){let Qe="CDATA[";return A===Qe.charCodeAt(o++)?(t.consume(A),o===Qe.length?x:y):n(A)}function x(A){return A===null?n(A):A===93?(t.consume(A),k):U(A)?(s=x,he(A)):(t.consume(A),x)}function k(A){return A===93?(t.consume(A),S):x(A)}function S(A){return A===62?se(A):A===93?(t.consume(A),S):x(A)}function R(A){return A===null||A===62?se(A):U(A)?(s=R,he(A)):(t.consume(A),R)}function M(A){return A===null?n(A):A===63?(t.consume(A),N):U(A)?(s=M,he(A)):(t.consume(A),M)}function N(A){return A===62?se(A):M(A)}function z(A){return qe(A)?(t.consume(A),T):n(A)}function T(A){return A===45||Ve(A)?(t.consume(A),T):P(A)}function P(A){return U(A)?(s=P,he(A)):ne(A)?(t.consume(A),P):se(A)}function $(A){return A===45||Ve(A)?(t.consume(A),$):A===47||A===62||me(A)?j(A):n(A)}function j(A){return A===47?(t.consume(A),se):A===58||A===95||qe(A)?(t.consume(A),g):U(A)?(s=j,he(A)):ne(A)?(t.consume(A),j):se(A)}function g(A){return A===45||A===46||A===58||A===95||Ve(A)?(t.consume(A),g):oe(A)}function oe(A){return A===61?(t.consume(A),G):U(A)?(s=oe,he(A)):ne(A)?(t.consume(A),oe):j(A)}function G(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),i=A,V):U(A)?(s=G,he(A)):ne(A)?(t.consume(A),G):(t.consume(A),J)}function V(A){return A===i?(t.consume(A),i=void 0,K):A===null?n(A):U(A)?(s=V,he(A)):(t.consume(A),V)}function J(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||me(A)?j(A):(t.consume(A),J)}function K(A){return A===47||A===62||me(A)?j(A):n(A)}function se(A){return A===62?(t.consume(A),t.exit("htmlTextData"),t.exit("htmlText"),e):n(A)}function he(A){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),Ee}function Ee(A){return ne(A)?re(t,Ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):Ae(A)}function Ae(A){return t.enter("htmlTextData"),s(A)}}var Qr={name:"labelEnd",resolveAll:SO,resolveTo:vO,tokenize:CO},xO={tokenize:EO},kO={tokenize:TO},wO={tokenize:MO};function SO(t){let e=-1,n=[];for(;++e<t.length;){let r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){let i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&Be(t,0,t.length,n),t}function vO(t,e){let n=t.length,r=0,i,o,s,l;for(;n--;)if(i=t[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);let a={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[o][1].start},end:{...t[s][1].end}},u={type:"labelText",start:{...t[o+r+2][1].end},end:{...t[s-2][1].start}};return l=[["enter",a,e],["enter",c,e]],l=wt(l,t.slice(o+1,o+r+3)),l=wt(l,[["enter",u,e]]),l=wt(l,dr(e.parser.constructs.insideSpan.null,t.slice(o+r+4,s-3),e)),l=wt(l,[["exit",u,e],t[s-2],t[s-1],["exit",c,e]]),l=wt(l,t.slice(s+1)),l=wt(l,[["exit",a,e]]),Be(t,o,t.length,l),t}function CO(t,e,n){let r=this,i=r.events.length,o,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return l;function l(h){return o?o._inactive?f(h):(s=r.parser.defined.includes(ht(r.sliceSerialize({start:o.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),a):n(h)}function a(h){return h===40?t.attempt(xO,u,s?u:f)(h):h===91?t.attempt(kO,u,s?c:f)(h):s?u(h):f(h)}function c(h){return t.attempt(wO,u,f)(h)}function u(h){return e(h)}function f(h){return o._balanced=!0,n(h)}}function EO(t,e,n){return r;function r(f){return t.enter("resource"),t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),i}function i(f){return me(f)?Yr(t,o)(f):o(f)}function o(f){return f===41?u(f):Hc(t,s,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return me(f)?Yr(t,a)(f):u(f)}function l(f){return n(f)}function a(f){return f===34||f===39||f===40?qc(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function c(f){return me(f)?Yr(t,u)(f):u(f)}function u(f){return f===41?(t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),t.exit("resource"),e):n(f)}}function TO(t,e,n){let r=this;return i;function i(l){return jc.call(r,t,o,s,"reference","referenceMarker","referenceString")(l)}function o(l){return r.parser.defined.includes(ht(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(l):n(l)}function s(l){return n(l)}}function MO(t,e,n){return r;function r(o){return t.enter("reference"),t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),i}function i(o){return o===93?(t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),t.exit("reference"),e):n(o)}}var Sp={name:"labelStartImage",resolveAll:Qr.resolveAll,tokenize:AO};function AO(t,e,n){let r=this;return i;function i(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),o}function o(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),s):n(l)}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}var vp={name:"labelStartLink",resolveAll:Qr.resolveAll,tokenize:RO};function RO(t,e,n){let r=this;return i;function i(s){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(s),t.exit("labelMarker"),t.exit("labelLink"),o}function o(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):e(s)}}var Hs={name:"lineEnding",tokenize:IO};function IO(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),re(t,e,"linePrefix")}}var Zr={name:"thematicBreak",tokenize:LO};function LO(t,e,n){let r=0,i;return o;function o(c){return t.enter("thematicBreak"),s(c)}function s(c){return i=c,l(c)}function l(c){return c===i?(t.enter("thematicBreakSequence"),a(c)):r>=3&&(c===null||U(c))?(t.exit("thematicBreak"),e(c)):n(c)}function a(c){return c===i?(t.consume(c),r++,a):(t.exit("thematicBreakSequence"),ne(c)?re(t,l,"whitespace")(c):l(c))}}var pt={continuation:{tokenize:PO},exit:BO,name:"list",tokenize:DO},NO={partial:!0,tokenize:FO},OO={partial:!0,tokenize:zO};function DO(t,e,n){let r=this,i=r.events[r.events.length-1],o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return l;function l(m){let y=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Bs(m)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),m===42||m===45?t.check(Zr,n,c)(m):c(m);if(!r.interrupt||m===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),a(m)}return n(m)}function a(m){return Bs(m)&&++s<10?(t.consume(m),a):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(t.exit("listItemValue"),c(m)):n(m)}function c(m){return t.enter("listItemMarker"),t.consume(m),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,t.check(xn,r.interrupt?n:u,t.attempt(NO,h,f))}function u(m){return r.containerState.initialBlankLine=!0,o++,h(m)}function f(m){return ne(m)?(t.enter("listItemPrefixWhitespace"),t.consume(m),t.exit("listItemPrefixWhitespace"),h):n(m)}function h(m){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(m)}}function PO(t,e,n){let r=this;return r.containerState._closeFlow=void 0,t.check(xn,i,o);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,re(t,e,"listItemIndent",r.containerState.size+1)(l)}function o(l){return r.containerState.furtherBlankLines||!ne(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(OO,e,s)(l))}function s(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,re(t,t.attempt(pt,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function zO(t,e,n){let r=this;return re(t,i,"listItemIndent",r.containerState.size+1);function i(o){let s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(o):n(o)}}function BO(t){t.exit(this.containerState.type)}function FO(t,e,n){let r=this;return re(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){let s=r.events[r.events.length-1];return!ne(o)&&s&&s[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}var Vc={name:"setextUnderline",resolveTo:$O,tokenize:_O};function $O(t,e){let n=t.length,r,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);let s={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",s,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end={...t[o][1].end}):t[r][1]=s,t.push(["exit",s,e]),t}function _O(t,e,n){let r=this,i;return o;function o(c){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=c,s(c)):n(c)}function s(c){return t.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===i?(t.consume(c),l):(t.exit("setextHeadingLineSequence"),ne(c)?re(t,a,"lineSuffix")(c):a(c))}function a(c){return c===null||U(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}var n1={tokenize:HO};function HO(t){let e=this,n=t.attempt(xn,r,t.attempt(this.parser.constructs.flowInitial,i,re(t,t.attempt(this.parser.constructs.flow,i,t.attempt(mp,i)),"linePrefix")));return n;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}var r1={resolveAll:l1()},i1=s1("string"),o1=s1("text");function s1(t){return{resolveAll:l1(t==="text"?jO:void 0),tokenize:e};function e(n){let r=this,i=this.parser.constructs[t],o=n.attempt(i,s,l);return s;function s(u){return c(u)?o(u):l(u)}function l(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),a}function a(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),a)}function c(u){if(u===null)return!0;let f=i[u],h=-1;if(f)for(;++h<f.length;){let m=f[h];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function l1(t){return e;function e(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return t?t(n,r):n}}function jO(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){let r=t[n-1][1],i=e.sliceStream(r),o=i.length,s=-1,l=0,a;for(;o--;){let c=i[o];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)l++,s--;if(s)break;s=-1}else if(c===-2)a=!0,l++;else if(c!==-1){o++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){let c={type:n===t.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?s:r.start._bufferIndex+s,_index:r.start._index+o,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}var Cp={};RC(Cp,{attentionMarkers:()=>XO,contentInitial:()=>VO,disable:()=>YO,document:()=>qO,flow:()=>UO,flowInitial:()=>WO,insideSpan:()=>GO,string:()=>KO,text:()=>JO});var qO={42:pt,43:pt,45:pt,48:pt,49:pt,50:pt,51:pt,52:pt,53:pt,54:pt,55:pt,56:pt,57:pt,62:Pc},VO={91:gp},WO={[-2]:$s,[-1]:$s,32:$s},UO={35:bp,42:Zr,45:[Vc,Zr],60:kp,61:Vc,95:Zr,96:Fc,126:Fc},KO={38:Bc,92:zc},JO={[-5]:Hs,[-4]:Hs,[-3]:Hs,33:Sp,38:Bc,42:Fs,60:[hp,wp],91:vp,92:[yp,zc],93:Qr,95:Fs,96:pp},GO={null:[Fs,r1]},XO={null:[42,95]},YO={null:[]};function a1(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},o=[],s=[],l=[],a=!0,c={attempt:j(P),check:j($),consume:N,enter:z,exit:T,interrupt:j($,{interrupt:!0})},u={code:null,containerState:{},defineSkip:S,events:[],now:k,parser:t,previous:null,sliceSerialize:y,sliceStream:x,write:m},f=e.tokenize.call(u,c),h;return e.resolveAll&&o.push(e),u;function m(V){return s=wt(s,V),R(),s[s.length-1]!==null?[]:(g(e,0),u.events=dr(o,u.events,u),u.events)}function y(V,J){return ZO(x(V),J)}function x(V){return QO(s,V)}function k(){let{_bufferIndex:V,_index:J,line:K,column:se,offset:he}=r;return{_bufferIndex:V,_index:J,line:K,column:se,offset:he}}function S(V){i[V.line]=V.column,G()}function R(){let V;for(;r._index<s.length;){let J=s[r._index];if(typeof J=="string")for(V=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===V&&r._bufferIndex<J.length;)M(J.charCodeAt(r._bufferIndex));else M(J)}}function M(V){a=void 0,h=V,f=f(V)}function N(V){U(V)?(r.line++,r.column=1,r.offset+=V===-3?2:1,G()):V!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=V,a=!0}function z(V,J){let K=J||{};return K.type=V,K.start=k(),u.events.push(["enter",K,u]),l.push(K),K}function T(V){let J=l.pop();return J.end=k(),u.events.push(["exit",J,u]),J}function P(V,J){g(V,J.from)}function $(V,J){J.restore()}function j(V,J){return K;function K(se,he,Ee){let Ae,A,Qe,Ze;return Array.isArray(se)?Fe(se):"tokenize"in se?Fe([se]):I(se);function I(Le){return nn;function nn(Me){let rn=Me!==null&&Le[Me],Sn=Me!==null&&Le.null,oo=[...Array.isArray(rn)?rn:rn?[rn]:[],...Array.isArray(Sn)?Sn:Sn?[Sn]:[]];return Fe(oo)(Me)}}function Fe(Le){return Ae=Le,A=0,Le.length===0?Ee:Jt(Le[A])}function Jt(Le){return nn;function nn(Me){return Ze=oe(),Qe=Le,Le.partial||(u.currentConstruct=Le),Le.name&&u.parser.constructs.disable.null.includes(Le.name)?fi(Me):Le.tokenize.call(J?Object.assign(Object.create(u),J):u,c,Kn,fi)(Me)}}function Kn(Le){return a=!0,V(Qe,Ze),he}function fi(Le){return a=!0,Ze.restore(),++A<Ae.length?Jt(Ae[A]):Ee}}}function g(V,J){V.resolveAll&&!o.includes(V)&&o.push(V),V.resolve&&Be(u.events,J,u.events.length-J,V.resolve(u.events.slice(J),u)),V.resolveTo&&(u.events=V.resolveTo(u.events,u))}function oe(){let V=k(),J=u.previous,K=u.currentConstruct,se=u.events.length,he=Array.from(l);return{from:se,restore:Ee};function Ee(){r=V,u.previous=J,u.currentConstruct=K,u.events.length=se,l=he,G()}}function G(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function QO(t,e){let n=e.start._index,r=e.start._bufferIndex,i=e.end._index,o=e.end._bufferIndex,s;if(n===i)s=[t[n].slice(r,o)];else{if(s=t.slice(n,i),r>-1){let l=s[0];typeof l=="string"?s[0]=l.slice(r):s.shift()}o>0&&s.push(t[i].slice(0,o))}return s}function ZO(t,e){let n=-1,r=[],i;for(;++n<t.length;){let o=t[n],s;if(typeof o=="string")s=o;else switch(o){case-5:{s="\r";break}case-4:{s=`
|
|
1526
|
+
`;break}case-3:{s=`\r
|
|
1527
|
+
`;break}case-2:{s=e?" ":" ";break}case-1:{if(!e&&i)continue;s=" ";break}default:s=String.fromCharCode(o)}i=o===-2,r.push(s)}return r.join("")}function Ep(t){let r={constructs:Oc([Cp,...(t||{}).extensions||[]]),content:i(Xw),defined:[],document:i(Qw),flow:i(n1),lazy:{},string:i(i1),text:i(o1)};return r;function i(o){return s;function s(l){return a1(r,o,l)}}}function Tp(t){for(;!_c(t););return t}var c1=/[\0\t\n\r]/g;function Mp(){let t=1,e="",n=!0,r;return i;function i(o,s,l){let a=[],c,u,f,h,m;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(s||void 0).decode(o)),f=0,e="",n&&(o.charCodeAt(0)===65279&&f++,n=void 0);f<o.length;){if(c1.lastIndex=f,c=c1.exec(o),h=c&&c.index!==void 0?c.index:o.length,m=o.charCodeAt(h),!c){e=o.slice(f);break}if(m===10&&f===h&&r)a.push(-3),r=void 0;else switch(r&&(a.push(-5),r=void 0),f<h&&(a.push(o.slice(f,h)),t+=h-f),m){case 0:{a.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,a.push(-2);t++<u;)a.push(-1);break}case 10:{a.push(-4),t=1;break}default:r=!0,t=1}f=h+1}return l&&(r&&a.push(-5),e&&a.push(e),a.push(null)),a}}var eD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Wc(t){return t.replace(eD,tD)}function tD(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){let i=n.charCodeAt(1),o=i===120||i===88;return Dc(n.slice(o?2:1),o?16:10)}return Gi(n)||t}var f1={}.hasOwnProperty;function Ap(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),nD(n)(Tp(Ep(n).document().write(Mp()(t,e,!0))))}function nD(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(di),autolinkProtocol:j,autolinkEmail:j,atxHeading:o(on),blockQuote:o(Me),characterEscape:j,characterReference:j,codeFenced:o(rn),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(rn,s),codeText:o(Sn,s),codeTextData:j,data:j,codeFlowValue:j,definition:o(oo),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(pu),hardBreakEscape:o(so),hardBreakTrailing:o(so),htmlFlow:o(ol,s),htmlFlowData:j,htmlText:o(ol,s),htmlTextData:j,image:o(lo),label:s,link:o(di),listItem:o(vn),listItemValue:h,listOrdered:o(hi,f),listUnordered:o(hi),paragraph:o(mu),reference:I,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(on),strong:o(pi),thematicBreak:o(yu)},exit:{atxHeading:a(),atxHeadingSequence:z,autolink:a(),autolinkEmail:nn,autolinkProtocol:Le,blockQuote:a(),characterEscapeValue:g,characterReferenceMarkerHexadecimal:Jt,characterReferenceMarkerNumeric:Jt,characterReferenceValue:Kn,characterReference:fi,codeFenced:a(k),codeFencedFence:x,codeFencedFenceInfo:m,codeFencedFenceMeta:y,codeFlowValue:g,codeIndented:a(S),codeText:a(K),codeTextData:g,data:g,definition:a(),definitionDestinationString:N,definitionLabelString:R,definitionTitleString:M,emphasis:a(),hardBreakEscape:a(G),hardBreakTrailing:a(G),htmlFlow:a(V),htmlFlowData:g,htmlText:a(J),htmlTextData:g,image:a(he),label:Ae,labelText:Ee,lineEnding:oe,link:a(se),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:Fe,resourceDestinationString:A,resourceTitleString:Qe,resource:Ze,setextHeading:a($),setextHeadingLineSequence:P,setextHeadingText:T,strong:a(),thematicBreak:a()}};d1(e,(t||{}).mdastExtensions||[]);let n={};return r;function r(B){let H={type:"root",children:[]},le={stack:[H],tokenStack:[],config:e,enter:l,exit:c,buffer:s,resume:u,data:n},de=[],ke=-1;for(;++ke<B.length;)if(B[ke][1].type==="listOrdered"||B[ke][1].type==="listUnordered")if(B[ke][0]==="enter")de.push(ke);else{let We=de.pop();ke=i(B,We,ke)}for(ke=-1;++ke<B.length;){let We=e[B[ke][0]];f1.call(We,B[ke][1].type)&&We[B[ke][1].type].call(Object.assign({sliceSerialize:B[ke][2].sliceSerialize},le),B[ke][1])}if(le.tokenStack.length>0){let We=le.tokenStack[le.tokenStack.length-1];(We[1]||u1).call(le,void 0,We[0])}for(H.position={start:hr(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:hr(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<e.transforms.length;)H=e.transforms[ke](H)||H;return H}function i(B,H,le){let de=H-1,ke=-1,We=!1,sn,zt,Jn,Gn;for(;++de<=le;){let mt=B[de];switch(mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{mt[0]==="enter"?ke++:ke--,Gn=void 0;break}case"lineEndingBlank":{mt[0]==="enter"&&(sn&&!Gn&&!ke&&!Jn&&(Jn=de),Gn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Gn=void 0}if(!ke&&mt[0]==="enter"&&mt[1].type==="listItemPrefix"||ke===-1&&mt[0]==="exit"&&(mt[1].type==="listUnordered"||mt[1].type==="listOrdered")){if(sn){let St=de;for(zt=void 0;St--;){let Gt=B[St];if(Gt[1].type==="lineEnding"||Gt[1].type==="lineEndingBlank"){if(Gt[0]==="exit")continue;zt&&(B[zt][1].type="lineEndingBlank",We=!0),Gt[1].type="lineEnding",zt=St}else if(!(Gt[1].type==="linePrefix"||Gt[1].type==="blockQuotePrefix"||Gt[1].type==="blockQuotePrefixWhitespace"||Gt[1].type==="blockQuoteMarker"||Gt[1].type==="listItemIndent"))break}Jn&&(!zt||Jn<zt)&&(sn._spread=!0),sn.end=Object.assign({},zt?B[zt][1].start:mt[1].end),B.splice(zt||de,0,["exit",sn,mt[2]]),de++,le++}if(mt[1].type==="listItemPrefix"){let St={type:"listItem",_spread:!1,start:Object.assign({},mt[1].start),end:void 0};sn=St,B.splice(de,0,["enter",St,mt[2]]),de++,le++,Jn=void 0,Gn=!0}}}return B[H][1]._spread=We,le}function o(B,H){return le;function le(de){l.call(this,B(de),de),H&&H.call(this,de)}}function s(){this.stack.push({type:"fragment",children:[]})}function l(B,H,le){this.stack[this.stack.length-1].children.push(B),this.stack.push(B),this.tokenStack.push([H,le||void 0]),B.position={start:hr(H.start),end:void 0}}function a(B){return H;function H(le){B&&B.call(this,le),c.call(this,le)}}function c(B,H){let le=this.stack.pop(),de=this.tokenStack.pop();if(de)de[0].type!==B.type&&(H?H.call(this,B,de[0]):(de[1]||u1).call(this,B,de[0]));else throw new Error("Cannot close `"+B.type+"` ("+ur({start:B.start,end:B.end})+"): it’s not open");le.position.end=hr(B.end)}function u(){return Jr(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(B){if(this.data.expectingFirstListItemValue){let H=this.stack[this.stack.length-2];H.start=Number.parseInt(this.sliceSerialize(B),10),this.data.expectingFirstListItemValue=void 0}}function m(){let B=this.resume(),H=this.stack[this.stack.length-1];H.lang=B}function y(){let B=this.resume(),H=this.stack[this.stack.length-1];H.meta=B}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){let B=this.resume(),H=this.stack[this.stack.length-1];H.value=B.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){let B=this.resume(),H=this.stack[this.stack.length-1];H.value=B.replace(/(\r?\n|\r)$/g,"")}function R(B){let H=this.resume(),le=this.stack[this.stack.length-1];le.label=H,le.identifier=ht(this.sliceSerialize(B)).toLowerCase()}function M(){let B=this.resume(),H=this.stack[this.stack.length-1];H.title=B}function N(){let B=this.resume(),H=this.stack[this.stack.length-1];H.url=B}function z(B){let H=this.stack[this.stack.length-1];if(!H.depth){let le=this.sliceSerialize(B).length;H.depth=le}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function P(B){let H=this.stack[this.stack.length-1];H.depth=this.sliceSerialize(B).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function j(B){let le=this.stack[this.stack.length-1].children,de=le[le.length-1];(!de||de.type!=="text")&&(de=gu(),de.position={start:hr(B.start),end:void 0},le.push(de)),this.stack.push(de)}function g(B){let H=this.stack.pop();H.value+=this.sliceSerialize(B),H.position.end=hr(B.end)}function oe(B){let H=this.stack[this.stack.length-1];if(this.data.atHardBreak){let le=H.children[H.children.length-1];le.position.end=hr(B.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(H.type)&&(j.call(this,B),g.call(this,B))}function G(){this.data.atHardBreak=!0}function V(){let B=this.resume(),H=this.stack[this.stack.length-1];H.value=B}function J(){let B=this.resume(),H=this.stack[this.stack.length-1];H.value=B}function K(){let B=this.resume(),H=this.stack[this.stack.length-1];H.value=B}function se(){let B=this.stack[this.stack.length-1];if(this.data.inReference){let H=this.data.referenceType||"shortcut";B.type+="Reference",B.referenceType=H,delete B.url,delete B.title}else delete B.identifier,delete B.label;this.data.referenceType=void 0}function he(){let B=this.stack[this.stack.length-1];if(this.data.inReference){let H=this.data.referenceType||"shortcut";B.type+="Reference",B.referenceType=H,delete B.url,delete B.title}else delete B.identifier,delete B.label;this.data.referenceType=void 0}function Ee(B){let H=this.sliceSerialize(B),le=this.stack[this.stack.length-2];le.label=Wc(H),le.identifier=ht(H).toLowerCase()}function Ae(){let B=this.stack[this.stack.length-1],H=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){let de=B.children;le.children=de}else le.alt=H}function A(){let B=this.resume(),H=this.stack[this.stack.length-1];H.url=B}function Qe(){let B=this.resume(),H=this.stack[this.stack.length-1];H.title=B}function Ze(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function Fe(B){let H=this.resume(),le=this.stack[this.stack.length-1];le.label=H,le.identifier=ht(this.sliceSerialize(B)).toLowerCase(),this.data.referenceType="full"}function Jt(B){this.data.characterReferenceType=B.type}function Kn(B){let H=this.sliceSerialize(B),le=this.data.characterReferenceType,de;le?(de=Dc(H,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):de=Gi(H);let ke=this.stack[this.stack.length-1];ke.value+=de}function fi(B){let H=this.stack.pop();H.position.end=hr(B.end)}function Le(B){g.call(this,B);let H=this.stack[this.stack.length-1];H.url=this.sliceSerialize(B)}function nn(B){g.call(this,B);let H=this.stack[this.stack.length-1];H.url="mailto:"+this.sliceSerialize(B)}function Me(){return{type:"blockquote",children:[]}}function rn(){return{type:"code",lang:null,meta:null,value:""}}function Sn(){return{type:"inlineCode",value:""}}function oo(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pu(){return{type:"emphasis",children:[]}}function on(){return{type:"heading",depth:0,children:[]}}function so(){return{type:"break"}}function ol(){return{type:"html",value:""}}function lo(){return{type:"image",title:null,url:"",alt:null}}function di(){return{type:"link",title:null,url:"",children:[]}}function hi(B){return{type:"list",ordered:B.type==="listOrdered",start:null,spread:B._spread,children:[]}}function vn(B){return{type:"listItem",spread:B._spread,checked:null,children:[]}}function mu(){return{type:"paragraph",children:[]}}function pi(){return{type:"strong",children:[]}}function gu(){return{type:"text",value:""}}function yu(){return{type:"thematicBreak"}}}function hr(t){return{line:t.line,column:t.column,offset:t.offset}}function d1(t,e){let n=-1;for(;++n<e.length;){let r=e[n];Array.isArray(r)?d1(t,r):rD(t,r)}}function rD(t,e){let n;for(n in e)if(f1.call(e,n))switch(n){case"canContainEols":{let r=e[n];r&&t[n].push(...r);break}case"transforms":{let r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{let r=e[n];r&&Object.assign(t[n],r);break}}}function u1(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ur({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ur({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ur({start:e.start,end:e.end})+") is still open")}function Uc(t){let e=this;e.parser=n;function n(r){return Ap(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Rp(t,e){let n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}function js(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var pr=(function(t){if(t==null)return lD;if(typeof t=="function")return Kc(t);if(typeof t=="object")return Array.isArray(t)?iD(t):oD(t);if(typeof t=="string")return sD(t);throw new Error("Expected function, string, or object as test")});function iD(t){let e=[],n=-1;for(;++n<t.length;)e[n]=pr(t[n]);return Kc(r);function r(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function oD(t){let e=t;return Kc(n);function n(r){let i=r,o;for(o in t)if(i[o]!==e[o])return!1;return!0}}function sD(t){return Kc(e);function e(n){return n&&n.type===t}}function Kc(t){return e;function e(n,r,i){return!!(aD(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function lD(){return!0}function aD(t){return t!==null&&typeof t=="object"&&"type"in t}var h1=[],Jc=!0,ei=!1,Gc="skip";function qs(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;let o=pr(i),s=r?-1:1;l(t,void 0,[])();function l(a,c,u){let f=a&&typeof a=="object"?a:{};if(typeof f.type=="string"){let m=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(a.type+(m?"<"+m+">":""))+")"})}return h;function h(){let m=h1,y,x,k;if((!e||o(a,c,u[u.length-1]||void 0))&&(m=cD(n(a,u)),m[0]===ei))return m;if("children"in a&&a.children){let S=a;if(S.children&&m[0]!==Gc)for(x=(r?S.children.length:-1)+s,k=u.concat(S);x>-1&&x<S.children.length;){let R=S.children[x];if(y=l(R,x,k)(),y[0]===ei)return y;x=typeof y[1]=="number"?y[1]:x+s}}return m}}}function cD(t){return Array.isArray(t)?t:typeof t=="number"?[Jc,t]:t==null?h1:[t]}function Ip(t,e,n){let i=pr((n||{}).ignore||[]),o=uD(e),s=-1;for(;++s<o.length;)qs(t,"text",l);function l(c,u){let f=-1,h;for(;++f<u.length;){let m=u[f],y=h?h.children:void 0;if(i(m,y?y.indexOf(m):void 0,h))return;h=m}if(h)return a(c,u)}function a(c,u){let f=u[u.length-1],h=o[s][0],m=o[s][1],y=0,k=f.children.indexOf(c),S=!1,R=[];h.lastIndex=0;let M=h.exec(c.value);for(;M;){let N=M.index,z={index:M.index,input:M.input,stack:[...u,c]},T=m(...M,z);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?h.lastIndex=N+1:(y!==N&&R.push({type:"text",value:c.value.slice(y,N)}),Array.isArray(T)?R.push(...T):T&&R.push(T),y=N+M[0].length,S=!0),!h.global)break;M=h.exec(c.value)}return S?(y<c.value.length&&R.push({type:"text",value:c.value.slice(y)}),f.children.splice(k,1,...R)):R=[c],k+R.length}}function uD(t){let e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");let n=!t[0]||Array.isArray(t[0])?t:[t],r=-1;for(;++r<n.length;){let i=n[r];e.push([fD(i[0]),dD(i[1])])}return e}function fD(t){return typeof t=="string"?new RegExp(js(t),"g"):t}function dD(t){return typeof t=="function"?t:function(){return t}}var Lp="phrasing",Np=["autolink","link","image","label"];function Dp(){return{transforms:[bD],enter:{literalAutolink:hD,literalAutolinkEmail:Op,literalAutolinkHttp:Op,literalAutolinkWww:Op},exit:{literalAutolink:yD,literalAutolinkEmail:gD,literalAutolinkHttp:pD,literalAutolinkWww:mD}}}function Pp(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Lp,notInConstruct:Np},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Lp,notInConstruct:Np},{character:":",before:"[ps]",after:"\\/",inConstruct:Lp,notInConstruct:Np}]}}function hD(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Op(t){this.config.enter.autolinkProtocol.call(this,t)}function pD(t){this.config.exit.autolinkProtocol.call(this,t)}function mD(t){this.config.exit.data.call(this,t);let e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function gD(t){this.config.exit.autolinkEmail.call(this,t)}function yD(t){this.exit(t)}function bD(t){Ip(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xD],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,kD]],{ignore:["link","linkReference"]})}function xD(t,e,n,r,i){let o="";if(!p1(i)||(/^w/i.test(e)&&(n=e+n,e="",o="http://"),!wD(n)))return!1;let s=SD(n+r);if(!s[0])return!1;let l={type:"link",title:null,url:o+e+s[0],children:[{type:"text",value:e+s[0]}]};return s[1]?[l,{type:"text",value:s[1]}]:l}function kD(t,e,n,r){return!p1(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function wD(t){let e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function SD(t){let e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")"),i=Rp(t,"("),o=Rp(t,")");for(;r!==-1&&i>o;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[t,n]}function p1(t,e){let n=t.input.charCodeAt(t.index-1);return(t.index===0||bn(n)||Xr(n))&&(!e||n!==47)}m1.peek=LD;function vD(){this.buffer()}function CD(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function ED(){this.buffer()}function TD(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function MD(t){let e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ht(this.sliceSerialize(t)).toLowerCase(),n.label=e}function AD(t){this.exit(t)}function RD(t){let e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ht(this.sliceSerialize(t)).toLowerCase(),n.label=e}function ID(t){this.exit(t)}function LD(){return"["}function m1(t,e,n,r){let i=n.createTracker(r),o=i.move("[^"),s=n.enter("footnoteReference"),l=n.enter("reference");return o+=i.move(n.safe(n.associationId(t),{after:"]",before:o})),l(),s(),o+=i.move("]"),o}function zp(){return{enter:{gfmFootnoteCallString:vD,gfmFootnoteCall:CD,gfmFootnoteDefinitionLabelString:ED,gfmFootnoteDefinition:TD},exit:{gfmFootnoteCallString:MD,gfmFootnoteCall:AD,gfmFootnoteDefinitionLabelString:RD,gfmFootnoteDefinition:ID}}}function Bp(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:m1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,s){let l=o.createTracker(s),a=l.move("[^"),c=o.enter("footnoteDefinition"),u=o.enter("label");return a+=l.move(o.safe(o.associationId(r),{before:a,after:"]"})),u(),a+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),a+=l.move((e?`
|
|
1528
|
+
`:" ")+o.indentLines(o.containerFlow(r,l.current()),e?g1:ND))),c(),a}}function ND(t,e,n){return e===0?t:g1(t,e,n)}function g1(t,e,n){return(n?"":" ")+t}var OD=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];y1.peek=zD;function Fp(){return{canContainEols:["delete"],enter:{strikethrough:DD},exit:{strikethrough:PD}}}function $p(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:OD}],handlers:{delete:y1}}}function DD(t){this.enter({type:"delete",children:[]},t)}function PD(t){this.exit(t)}function y1(t,e,n,r){let i=n.createTracker(r),o=n.enter("strikethrough"),s=i.move("~~");return s+=n.containerPhrasing(t,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function zD(){return"~"}function BD(t){return t.length}function x1(t,e){let n=e||{},r=(n.align||[]).concat(),i=n.stringLength||BD,o=[],s=[],l=[],a=[],c=0,u=-1;for(;++u<t.length;){let x=[],k=[],S=-1;for(t[u].length>c&&(c=t[u].length);++S<t[u].length;){let R=FD(t[u][S]);if(n.alignDelimiters!==!1){let M=i(R);k[S]=M,(a[S]===void 0||M>a[S])&&(a[S]=M)}x.push(R)}s[u]=x,l[u]=k}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<c;)o[f]=b1(r[f]);else{let x=b1(r);for(;++f<c;)o[f]=x}f=-1;let h=[],m=[];for(;++f<c;){let x=o[f],k="",S="";x===99?(k=":",S=":"):x===108?k=":":x===114&&(S=":");let R=n.alignDelimiters===!1?1:Math.max(1,a[f]-k.length-S.length),M=k+"-".repeat(R)+S;n.alignDelimiters!==!1&&(R=k.length+R+S.length,R>a[f]&&(a[f]=R),m[f]=R),h[f]=M}s.splice(1,0,h),l.splice(1,0,m),u=-1;let y=[];for(;++u<s.length;){let x=s[u],k=l[u];f=-1;let S=[];for(;++f<c;){let R=x[f]||"",M="",N="";if(n.alignDelimiters!==!1){let z=a[f]-(k[f]||0),T=o[f];T===114?M=" ".repeat(z):T===99?z%2?(M=" ".repeat(z/2+.5),N=" ".repeat(z/2-.5)):(M=" ".repeat(z/2),N=M):N=" ".repeat(z)}n.delimiterStart!==!1&&!f&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&R==="")&&(n.delimiterStart!==!1||f)&&S.push(" "),n.alignDelimiters!==!1&&S.push(M),S.push(R),n.alignDelimiters!==!1&&S.push(N),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||f!==c-1)&&S.push("|")}y.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return y.join(`
|
|
1529
|
+
`)}function FD(t){return t==null?"":String(t)}function b1(t){let e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}var k1={}.hasOwnProperty;function w1(t,e){let n=e||{};function r(i,...o){let s=r.invalid,l=r.handlers;if(i&&k1.call(i,t)){let a=String(i[t]);s=k1.call(l,a)?l[a]:r.unknown}if(s)return s.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var $D={}.hasOwnProperty;function _p(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)_p(t,e.extensions[n]);for(r in e)if($D.call(e,r))switch(r){case"extensions":break;case"unsafe":{S1(t[r],e[r]);break}case"join":{S1(t[r],e[r]);break}case"handlers":{_D(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function S1(t,e){e&&t.push(...e)}function _D(t,e){e&&Object.assign(t,e)}function v1(t,e,n,r){let i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);let s=n.indentLines(n.containerFlow(t,o.current()),HD);return i(),s}function HD(t,e,n){return">"+(n?"":" ")+t}function Xc(t,e){return C1(t,e.inConstruct,!0)&&!C1(t,e.notInConstruct,!1)}function C1(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function Hp(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
1530
|
+
`&&Xc(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
1531
|
+
`}function E1(t,e){let n=String(t),r=n.indexOf(e),i=r,o=0,s=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>s&&(s=o):o=1,i=r+e.length,r=n.indexOf(e,i);return s}function Vs(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function T1(t){let e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function M1(t,e,n,r){let i=T1(n),o=t.value||"",s=i==="`"?"GraveAccent":"Tilde";if(Vs(t,n)){let f=n.enter("codeIndented"),h=n.indentLines(o,jD);return f(),h}let l=n.createTracker(r),a=i.repeat(Math.max(E1(o,i)+1,3)),c=n.enter("codeFenced"),u=l.move(a);if(t.lang){let f=n.enter(`codeFencedLang${s}`);u+=l.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...l.current()})),f()}if(t.lang&&t.meta){let f=n.enter(`codeFencedMeta${s}`);u+=l.move(" "),u+=l.move(n.safe(t.meta,{before:u,after:`
|
|
1532
|
+
`,encode:["`"],...l.current()})),f()}return u+=l.move(`
|
|
1533
|
+
`),o&&(u+=l.move(o+`
|
|
1534
|
+
`)),u+=l.move(a),c(),u}function jD(t,e,n){return(n?"":" ")+t}function Xi(t){let e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function A1(t,e,n,r){let i=Xi(n),o=i==='"'?"Quote":"Apostrophe",s=n.enter("definition"),l=n.enter("label"),a=n.createTracker(r),c=a.move("[");return c+=a.move(n.safe(n.associationId(t),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!t.url||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(t.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(t.url,{before:c,after:t.title?" ":`
|
|
1535
|
+
`,...a.current()}))),l(),t.title&&(l=n.enter(`title${o}`),c+=a.move(" "+i),c+=a.move(n.safe(t.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),s(),c}function R1(t){let e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Pt(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Yi(t,e,n){let r=Vn(t),i=Vn(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}jp.peek=qD;function jp(t,e,n,r){let i=R1(n),o=n.enter("emphasis"),s=n.createTracker(r),l=s.move(i),a=s.move(n.containerPhrasing(t,{after:i,before:l,...s.current()})),c=a.charCodeAt(0),u=Yi(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(a=Pt(c)+a.slice(1));let f=a.charCodeAt(a.length-1),h=Yi(r.after.charCodeAt(0),f,i);h.inside&&(a=a.slice(0,-1)+Pt(f));let m=s.move(i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+a+m}function qD(t,e,n){return n.options.emphasis||"*"}function qp(t,e,n,r){let i,o,s;typeof e=="function"&&typeof n!="function"?(o=void 0,s=e,i=n):(o=e,s=n,i=r),qs(t,o,l,i);function l(a,c){let u=c[c.length-1],f=u?u.children.indexOf(a):void 0;return s(a,f,u)}}function Yc(t,e){let n=!1;return qp(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ei}),!!((!t.depth||t.depth<3)&&Jr(t)&&(e.options.setext||n))}function I1(t,e,n,r){let i=Math.max(Math.min(6,t.depth||1),1),o=n.createTracker(r);if(Yc(t,n)){let u=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(t,{...o.current(),before:`
|
|
1536
|
+
`,after:`
|
|
1537
|
+
`});return f(),u(),h+`
|
|
1538
|
+
`+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
|
|
1539
|
+
`))+1))}let s="#".repeat(i),l=n.enter("headingAtx"),a=n.enter("phrasing");o.move(s+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
|
|
1540
|
+
`,...o.current()});return/^[\t ]/.test(c)&&(c=Pt(c.charCodeAt(0))+c.slice(1)),c=c?s+" "+c:s,n.options.closeAtx&&(c+=" "+s),a(),l(),c}Vp.peek=VD;function Vp(t){return t.value||""}function VD(){return"<"}Wp.peek=WD;function Wp(t,e,n,r){let i=Xi(n),o=i==='"'?"Quote":"Apostrophe",s=n.enter("image"),l=n.enter("label"),a=n.createTracker(r),c=a.move("![");return c+=a.move(n.safe(t.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(t.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(t.url,{before:c,after:t.title?" ":")",...a.current()}))),l(),t.title&&(l=n.enter(`title${o}`),c+=a.move(" "+i),c+=a.move(n.safe(t.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),s(),c}function WD(){return"!"}Up.peek=UD;function Up(t,e,n,r){let i=t.referenceType,o=n.enter("imageReference"),s=n.enter("label"),l=n.createTracker(r),a=l.move("!["),c=n.safe(t.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),s();let u=n.stack;n.stack=[],s=n.enter("reference");let f=n.safe(n.associationId(t),{before:a,after:"]",...l.current()});return s(),n.stack=u,o(),i==="full"||!c||c!==f?a+=l.move(f+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function UD(){return"!"}Kp.peek=KD;function Kp(t,e,n){let r=t.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){let s=n.unsafe[o],l=n.compilePattern(s),a;if(s.atBreak)for(;a=l.exec(r);){let c=a.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(a.index+1)}}return i+r+i}function KD(){return"`"}function Jp(t,e){let n=Jr(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Gp.peek=JD;function Gp(t,e,n,r){let i=Xi(n),o=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r),l,a;if(Jp(t,n)){let u=n.stack;n.stack=[],l=n.enter("autolink");let f=s.move("<");return f+=s.move(n.containerPhrasing(t,{before:f,after:">",...s.current()})),f+=s.move(">"),l(),n.stack=u,f}l=n.enter("link"),a=n.enter("label");let c=s.move("[");return c+=s.move(n.containerPhrasing(t,{before:c,after:"](",...s.current()})),c+=s.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=s.move("<"),c+=s.move(n.safe(t.url,{before:c,after:">",...s.current()})),c+=s.move(">")):(a=n.enter("destinationRaw"),c+=s.move(n.safe(t.url,{before:c,after:t.title?" ":")",...s.current()}))),a(),t.title&&(a=n.enter(`title${o}`),c+=s.move(" "+i),c+=s.move(n.safe(t.title,{before:c,after:i,...s.current()})),c+=s.move(i),a()),c+=s.move(")"),l(),c}function JD(t,e,n){return Jp(t,n)?"<":"["}Xp.peek=GD;function Xp(t,e,n,r){let i=t.referenceType,o=n.enter("linkReference"),s=n.enter("label"),l=n.createTracker(r),a=l.move("["),c=n.containerPhrasing(t,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),s();let u=n.stack;n.stack=[],s=n.enter("reference");let f=n.safe(n.associationId(t),{before:a,after:"]",...l.current()});return s(),n.stack=u,o(),i==="full"||!c||c!==f?a+=l.move(f+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function GD(){return"["}function Qi(t){let e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function L1(t){let e=Qi(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function N1(t){let e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function Qc(t){let e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function O1(t,e,n,r){let i=n.enter("list"),o=n.bulletCurrent,s=t.ordered?N1(n):Qi(n),l=t.ordered?s==="."?")":".":L1(n),a=e&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!t.ordered){let u=t.children?t.children[0]:void 0;if((s==="*"||s==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(a=!0),Qc(n)===s&&u){let f=-1;for(;++f<t.children.length;){let h=t.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(s=l),n.bulletCurrent=s;let c=n.containerFlow(t,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),c}function D1(t){let e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function P1(t,e,n,r){let i=D1(n),o=n.bulletCurrent||Qi(n);e&&e.type==="list"&&e.ordered&&(o=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+o);let s=o.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(s=Math.ceil(s/4)*4);let l=n.createTracker(r);l.move(o+" ".repeat(s-o.length)),l.shift(s);let a=n.enter("listItem"),c=n.indentLines(n.containerFlow(t,l.current()),u);return a(),c;function u(f,h,m){return h?(m?"":" ".repeat(s))+f:(m?o:o+" ".repeat(s-o.length))+f}}function z1(t,e,n,r){let i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(t,r);return o(),i(),s}var Yp=pr(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function B1(t,e,n,r){return(t.children.some(function(s){return Yp(s)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function F1(t){let e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Qp.peek=XD;function Qp(t,e,n,r){let i=F1(n),o=n.enter("strong"),s=n.createTracker(r),l=s.move(i+i),a=s.move(n.containerPhrasing(t,{after:i,before:l,...s.current()})),c=a.charCodeAt(0),u=Yi(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(a=Pt(c)+a.slice(1));let f=a.charCodeAt(a.length-1),h=Yi(r.after.charCodeAt(0),f,i);h.inside&&(a=a.slice(0,-1)+Pt(f));let m=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+a+m}function XD(t,e,n){return n.options.strong||"*"}function $1(t,e,n,r){return n.safe(t.value,r)}function _1(t){let e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function H1(t,e,n){let r=(Qc(n)+(n.options.ruleSpaces?" ":"")).repeat(_1(n));return n.options.ruleSpaces?r.slice(0,-1):r}var ti={blockquote:v1,break:Hp,code:M1,definition:A1,emphasis:jp,hardBreak:Hp,heading:I1,html:Vp,image:Wp,imageReference:Up,inlineCode:Kp,link:Gp,linkReference:Xp,list:O1,listItem:P1,paragraph:z1,root:B1,strong:Qp,text:$1,thematicBreak:H1};var j1=[YD];function YD(t,e,n,r){if(e.type==="code"&&Vs(e,r)&&(t.type==="list"||t.type===e.type&&Vs(t,r)))return!1;if("spread"in n&&typeof n.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&Yc(e,r))?void 0:n.spread?1:0}var ni=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],q1=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
|
|
1541
|
+
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:ni},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
|
1542
|
+
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:ni},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
|
1543
|
+
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:ni},{atBreak:!0,character:"+",after:`(?:[ \r
|
|
1544
|
+
])`},{atBreak:!0,character:"-",after:`(?:[ \r
|
|
1545
|
+
-])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
|
|
1546
|
+
]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:ni},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:ni},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:ni},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:ni},{atBreak:!0,character:"~"}];function V1(t){return t.label||!t.identifier?t.label||"":Wc(t.identifier)}function W1(t){if(!t._compiled){let e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}function U1(t,e,n){let r=e.indexStack,i=t.children||[],o=[],s=-1,l=n.before,a;r.push(-1);let c=e.createTracker(n);for(;++s<i.length;){let u=i[s],f;if(r[r.length-1]=s,s+1<i.length){let y=e.handle.handlers[i[s+1].type];y&&y.peek&&(y=y.peek),f=y?y(i[s+1],t,e,{before:"",after:"",...c.current()}).charAt(0):""}else f=n.after;o.length>0&&(l==="\r"||l===`
|
|
1547
|
+
`)&&u.type==="html"&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=e.createTracker(n),c.move(o.join("")));let h=e.handle(u,t,e,{...c.current(),after:f,before:l});a&&a===h.slice(0,1)&&(h=Pt(a.charCodeAt(0))+h.slice(1));let m=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,a=void 0,m&&(o.length>0&&m.before&&l===o[o.length-1].slice(-1)&&(o[o.length-1]=o[o.length-1].slice(0,-1)+Pt(l.charCodeAt(0))),m.after&&(a=f)),c.move(h),o.push(h),l=h.slice(-1)}return r.pop(),o.join("")}function K1(t,e,n){let r=e.indexStack,i=t.children||[],o=e.createTracker(n),s=[],l=-1;for(r.push(-1);++l<i.length;){let a=i[l];r[r.length-1]=l,s.push(o.move(e.handle(a,t,e,{before:`
|
|
1548
|
+
`,after:`
|
|
1549
|
+
`,...o.current()}))),a.type!=="list"&&(e.bulletLastUsed=void 0),l<i.length-1&&s.push(o.move(QD(a,i[l+1],t,e)))}return r.pop(),s.join("")}function QD(t,e,n,r){let i=r.join.length;for(;i--;){let o=r.join[i](t,e,n,r);if(o===!0||o===1)break;if(typeof o=="number")return`
|
|
1550
|
+
`.repeat(1+o);if(o===!1)return`
|
|
1551
|
+
|
|
1552
|
+
<!---->
|
|
1553
|
+
|
|
1554
|
+
`}return`
|
|
1555
|
+
|
|
1556
|
+
`}var ZD=/\r?\n|\r/g;function J1(t,e){let n=[],r=0,i=0,o;for(;o=ZD.exec(t);)s(t.slice(r,o.index)),n.push(o[0]),r=o.index+o[0].length,i++;return s(t.slice(r)),n.join("");function s(l){n.push(e(l,i,!l))}}function X1(t,e,n){let r=(n.before||"")+(e||"")+(n.after||""),i=[],o=[],s={},l=-1;for(;++l<t.unsafe.length;){let u=t.unsafe[l];if(!Xc(t.stack,u))continue;let f=t.compilePattern(u),h;for(;h=f.exec(r);){let m="before"in u||!!u.atBreak,y="after"in u,x=h.index+(m?h[1].length:0);i.includes(x)?(s[x].before&&!m&&(s[x].before=!1),s[x].after&&!y&&(s[x].after=!1)):(i.push(x),s[x]={before:m,after:y})}}i.sort(eP);let a=n.before?n.before.length:0,c=r.length-(n.after?n.after.length:0);for(l=-1;++l<i.length;){let u=i[l];u<a||u>=c||u+1<c&&i[l+1]===u+1&&s[u].after&&!s[u+1].before&&!s[u+1].after||i[l-1]===u-1&&s[u].before&&!s[u-1].before&&!s[u-1].after||(a!==u&&o.push(G1(r.slice(a,u),"\\")),a=u,/[!-/:-@[-`{-~]/.test(r.charAt(u))&&(!n.encode||!n.encode.includes(r.charAt(u)))?o.push("\\"):(o.push(Pt(r.charCodeAt(u))),a++))}return o.push(G1(r.slice(a,c),n.after)),o.join("")}function eP(t,e){return t-e}function G1(t,e){let n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],o=t+e,s=-1,l=0,a;for(;a=n.exec(o);)r.push(a.index);for(;++s<r.length;)l!==r[s]&&i.push(t.slice(l,r[s])),i.push("\\"),l=r[s];return i.push(t.slice(l)),i.join("")}function Y1(t){let e=t||{},n=e.now||{},r=e.lineShift||0,i=n.line||1,o=n.column||1;return{move:a,current:s,shift:l};function s(){return{now:{line:i,column:o},lineShift:r}}function l(c){r+=c}function a(c){let u=c||"",f=u.split(/\r?\n|\r/g),h=f[f.length-1];return i+=f.length-1,o=f.length===1?o+h.length:1+h.length+r,u}}function Zp(t,e){let n=e||{},r={associationId:V1,containerPhrasing:iP,containerFlow:oP,createTracker:Y1,compilePattern:W1,enter:o,handlers:{...ti},handle:void 0,indentLines:J1,indexStack:[],join:[...j1],options:{},safe:sP,stack:[],unsafe:[...q1]};_p(r,n),r.options.tightDefinitions&&r.join.push(rP),r.handle=w1("type",{invalid:tP,unknown:nP,handlers:r.handlers});let i=r.handle(t,void 0,r,{before:`
|
|
1557
|
+
`,after:`
|
|
1558
|
+
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
|
|
1559
|
+
`),i;function o(s){return r.stack.push(s),l;function l(){r.stack.pop()}}}function tP(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function nP(t){let e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function rP(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function iP(t,e){return U1(t,this,e)}function oP(t,e){return K1(t,this,e)}function sP(t,e){return X1(this,t,e)}function tm(){return{enter:{table:lP,tableData:Q1,tableHeader:Q1,tableRow:cP},exit:{codeText:uP,table:aP,tableData:em,tableHeader:em,tableRow:em}}}function lP(t){let e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function aP(t){this.exit(t),this.data.inTable=void 0}function cP(t){this.enter({type:"tableRow",children:[]},t)}function em(t){this.exit(t)}function Q1(t){this.enter({type:"tableCell",children:[]},t)}function uP(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,fP));let n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function fP(t,e){return e==="|"?e:t}function nm(t){let e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
1560
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:s,tableCell:a,tableRow:l}};function s(m,y,x,k){return c(u(m,x,k),m.align)}function l(m,y,x,k){let S=f(m,x,k),R=c([S]);return R.slice(0,R.indexOf(`
|
|
1561
|
+
`))}function a(m,y,x,k){let S=x.enter("tableCell"),R=x.enter("phrasing"),M=x.containerPhrasing(m,{...k,before:o,after:o});return R(),S(),M}function c(m,y){return x1(m,{align:y,alignDelimiters:r,padding:n,stringLength:i})}function u(m,y,x){let k=m.children,S=-1,R=[],M=y.enter("table");for(;++S<k.length;)R[S]=f(k[S],y,x);return M(),R}function f(m,y,x){let k=m.children,S=-1,R=[],M=y.enter("tableRow");for(;++S<k.length;)R[S]=a(k[S],m,y,x);return M(),R}function h(m,y,x){let k=ti.inlineCode(m,y,x);return x.stack.includes("tableCell")&&(k=k.replace(/\|/g,"\\$&")),k}}function rm(){return{exit:{taskListCheckValueChecked:Z1,taskListCheckValueUnchecked:Z1,paragraph:dP}}}function im(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:hP}}}function Z1(t){let e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function dP(t){let e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){let n=this.stack[this.stack.length-1];n.type;let r=n.children[0];if(r&&r.type==="text"){let i=e.children,o=-1,s;for(;++o<i.length;){let l=i[o];if(l.type==="paragraph"){s=l;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function hP(t,e,n,r){let i=t.children[0],o=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",l=n.createTracker(r);o&&l.move(s);let a=ti.listItem(t,e,n,{...r,...l.current()});return o&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(u){return u+s}}function om(){return[Dp(),zp(),Fp(),tm(),rm()]}function Ws(t){return{extensions:[Pp(),Bp(t),$p(),nm(t),im()]}}var pP={tokenize:xP,partial:!0},eS={tokenize:kP,partial:!0},tS={tokenize:wP,partial:!0},nS={tokenize:SP,partial:!0},mP={tokenize:vP,partial:!0},rS={name:"wwwAutolink",tokenize:yP,previous:oS},iS={name:"protocolAutolink",tokenize:bP,previous:sS},Wn={name:"emailAutolink",tokenize:gP,previous:lS},kn={};function lm(){return{text:kn}}var ri=48;for(;ri<123;)kn[ri]=Wn,ri++,ri===58?ri=65:ri===91&&(ri=97);kn[43]=Wn;kn[45]=Wn;kn[46]=Wn;kn[95]=Wn;kn[72]=[Wn,iS];kn[104]=[Wn,iS];kn[87]=[Wn,rS];kn[119]=[Wn,rS];function gP(t,e,n){let r=this,i,o;return s;function s(f){return!sm(f)||!lS.call(r,r.previous)||am(r.events)?n(f):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),l(f))}function l(f){return sm(f)?(t.consume(f),l):f===64?(t.consume(f),a):n(f)}function a(f){return f===46?t.check(mP,u,c)(f):f===45||f===95||Ve(f)?(o=!0,t.consume(f),a):u(f)}function c(f){return t.consume(f),i=!0,a}function u(f){return o&&i&&qe(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(f)):n(f)}}function yP(t,e,n){let r=this;return i;function i(s){return s!==87&&s!==119||!oS.call(r,r.previous)||am(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(pP,t.attempt(eS,t.attempt(tS,o),n),n)(s))}function o(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function bP(t,e,n){let r=this,i="",o=!1;return s;function s(f){return(f===72||f===104)&&sS.call(r,r.previous)&&!am(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(f),t.consume(f),l):n(f)}function l(f){if(qe(f)&&i.length<5)return i+=String.fromCodePoint(f),t.consume(f),l;if(f===58){let h=i.toLowerCase();if(h==="http"||h==="https")return t.consume(f),a}return n(f)}function a(f){return f===47?(t.consume(f),o?c:(o=!0,a)):n(f)}function c(f){return f===null||Gr(f)||me(f)||bn(f)||Xr(f)?n(f):t.attempt(eS,t.attempt(tS,u),n)(f)}function u(f){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(f)}}function xP(t,e,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,t.consume(s),i):s===46&&r===3?(t.consume(s),o):n(s)}function o(s){return s===null?n(s):e(s)}}function kP(t,e,n){let r,i,o;return s;function s(c){return c===46||c===95?t.check(nS,a,l)(c):c===null||me(c)||bn(c)||c!==45&&Xr(c)?a(c):(o=!0,t.consume(c),s)}function l(c){return c===95?r=!0:(i=r,r=void 0),t.consume(c),s}function a(c){return i||r||!o?n(c):e(c)}}function wP(t,e){let n=0,r=0;return i;function i(s){return s===40?(n++,t.consume(s),i):s===41&&r<n?o(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(nS,e,o)(s):s===null||me(s)||bn(s)?e(s):(t.consume(s),i)}function o(s){return s===41&&r++,t.consume(s),i}}function SP(t,e,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(t.consume(l),r):l===38?(t.consume(l),o):l===93?(t.consume(l),i):l===60||l===null||me(l)||bn(l)?e(l):n(l)}function i(l){return l===null||l===40||l===91||me(l)||bn(l)?e(l):r(l)}function o(l){return qe(l)?s(l):n(l)}function s(l){return l===59?(t.consume(l),r):qe(l)?(t.consume(l),s):n(l)}}function vP(t,e,n){return r;function r(o){return t.consume(o),i}function i(o){return Ve(o)?n(o):e(o)}}function oS(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||me(t)}function sS(t){return!qe(t)}function lS(t){return!(t===47||sm(t))}function sm(t){return t===43||t===45||t===46||t===95||Ve(t)}function am(t){let e=t.length,n=!1;for(;e--;){let r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var CP={tokenize:LP,partial:!0};function cm(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:AP,continuation:{tokenize:RP},exit:IP}},text:{91:{name:"gfmFootnoteCall",tokenize:MP},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:EP,resolveTo:TP}}}}function EP(t,e,n){let r=this,i=r.events.length,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),s;for(;i--;){let a=r.events[i][1];if(a.type==="labelImage"){s=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return l;function l(a){if(!s||!s._balanced)return n(a);let c=ht(r.sliceSerialize({start:s.end,end:r.now()}));return c.codePointAt(0)!==94||!o.includes(c.slice(1))?n(a):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(a),t.exit("gfmFootnoteCallLabelMarker"),e(a))}}function TP(t,e){let n=t.length,r;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){r=t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";let i={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;let s={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},t[t.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[n+1],t[n+2],["enter",i,e],t[n+3],t[n+4],["enter",o,e],["exit",o,e],["enter",s,e],["enter",l,e],["exit",l,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",i,e]];return t.splice(n,t.length-n+1,...a),t}function MP(t,e,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o=0,s;return l;function l(f){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),a}function a(f){return f!==94?n(f):(t.enter("gfmFootnoteCallMarker"),t.consume(f),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",c)}function c(f){if(o>999||f===93&&!s||f===null||f===91||me(f))return n(f);if(f===93){t.exit("chunkString");let h=t.exit("gfmFootnoteCallString");return i.includes(ht(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(f),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(f)}return me(f)||(s=!0),o++,t.consume(f),f===92?u:c}function u(f){return f===91||f===92||f===93?(t.consume(f),o++,c):c(f)}}function AP(t,e,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o,s=0,l;return a;function a(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(y)}function u(y){if(s>999||y===93&&!l||y===null||y===91||me(y))return n(y);if(y===93){t.exit("chunkString");let x=t.exit("gfmFootnoteDefinitionLabelString");return o=ht(r.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return me(y)||(l=!0),s++,t.consume(y),y===92?f:u}function f(y){return y===91||y===92||y===93?(t.consume(y),s++,u):u(y)}function h(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),i.includes(o)||i.push(o),re(t,m,"gfmFootnoteDefinitionWhitespace")):n(y)}function m(y){return e(y)}}function RP(t,e,n){return t.check(xn,e,t.attempt(CP,e,n))}function IP(t){t.exit("gfmFootnoteDefinition")}function LP(t,e,n){let r=this;return re(t,i,"gfmFootnoteDefinitionIndent",5);function i(o){let s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(o):n(o)}}function um(t){let n=(t||{}).singleTilde,r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,l){let a=-1;for(;++a<s.length;)if(s[a][0]==="enter"&&s[a][1].type==="strikethroughSequenceTemporary"&&s[a][1]._close){let c=a;for(;c--;)if(s[c][0]==="exit"&&s[c][1].type==="strikethroughSequenceTemporary"&&s[c][1]._open&&s[a][1].end.offset-s[a][1].start.offset===s[c][1].end.offset-s[c][1].start.offset){s[a][1].type="strikethroughSequence",s[c][1].type="strikethroughSequence";let u={type:"strikethrough",start:Object.assign({},s[c][1].start),end:Object.assign({},s[a][1].end)},f={type:"strikethroughText",start:Object.assign({},s[c][1].end),end:Object.assign({},s[a][1].start)},h=[["enter",u,l],["enter",s[c][1],l],["exit",s[c][1],l],["enter",f,l]],m=l.parser.constructs.insideSpan.null;m&&Be(h,h.length,0,dr(m,s.slice(c+1,a),l)),Be(h,h.length,0,[["exit",f,l],["enter",s[a][1],l],["exit",s[a][1],l],["exit",u,l]]),Be(s,c-1,a-c+3,h),a=c+h.length-2;break}}for(a=-1;++a<s.length;)s[a][1].type==="strikethroughSequenceTemporary"&&(s[a][1].type="data");return s}function o(s,l,a){let c=this.previous,u=this.events,f=0;return h;function h(y){return c===126&&u[u.length-1][1].type!=="characterEscape"?a(y):(s.enter("strikethroughSequenceTemporary"),m(y))}function m(y){let x=Vn(c);if(y===126)return f>1?a(y):(s.consume(y),f++,m);if(f<2&&!n)return a(y);let k=s.exit("strikethroughSequenceTemporary"),S=Vn(y);return k._open=!S||S===2&&!!x,k._close=!x||x===2&&!!S,l(y)}}}var Zc=class{constructor(){this.map=[]}add(e,n,r){NP(this,e,n,r)}consume(e){if(this.map.sort(function(o,s){return o[0]-s[0]}),this.map.length===0)return;let n=this.map.length,r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(let o of i)e.push(o);i=r.pop()}this.map.length=0}};function NP(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function aS(t,e){let n=!1,r=[];for(;e<t.length;){let i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){let o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function fm(){return{flow:{null:{name:"table",tokenize:OP,resolveAll:DP}}}}function OP(t,e,n){let r=this,i=0,o=0,s;return l;function l(g){let oe=r.events.length-1;for(;oe>-1;){let J=r.events[oe][1].type;if(J==="lineEnding"||J==="linePrefix")oe--;else break}let G=oe>-1?r.events[oe][1].type:null,V=G==="tableHead"||G==="tableRow"?T:a;return V===T&&r.parser.lazy[r.now().line]?n(g):V(g)}function a(g){return t.enter("tableHead"),t.enter("tableRow"),c(g)}function c(g){return g===124||(s=!0,o+=1),u(g)}function u(g){return g===null?n(g):U(g)?o>1?(o=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),m):n(g):ne(g)?re(t,u,"whitespace")(g):(o+=1,s&&(s=!1,i+=1),g===124?(t.enter("tableCellDivider"),t.consume(g),t.exit("tableCellDivider"),s=!0,u):(t.enter("data"),f(g)))}function f(g){return g===null||g===124||me(g)?(t.exit("data"),u(g)):(t.consume(g),g===92?h:f)}function h(g){return g===92||g===124?(t.consume(g),f):f(g)}function m(g){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(g):(t.enter("tableDelimiterRow"),s=!1,ne(g)?re(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):y(g))}function y(g){return g===45||g===58?k(g):g===124?(s=!0,t.enter("tableCellDivider"),t.consume(g),t.exit("tableCellDivider"),x):z(g)}function x(g){return ne(g)?re(t,k,"whitespace")(g):k(g)}function k(g){return g===58?(o+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(g),t.exit("tableDelimiterMarker"),S):g===45?(o+=1,S(g)):g===null||U(g)?N(g):z(g)}function S(g){return g===45?(t.enter("tableDelimiterFiller"),R(g)):z(g)}function R(g){return g===45?(t.consume(g),R):g===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(g),t.exit("tableDelimiterMarker"),M):(t.exit("tableDelimiterFiller"),M(g))}function M(g){return ne(g)?re(t,N,"whitespace")(g):N(g)}function N(g){return g===124?y(g):g===null||U(g)?!s||i!==o?z(g):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(g)):z(g)}function z(g){return n(g)}function T(g){return t.enter("tableRow"),P(g)}function P(g){return g===124?(t.enter("tableCellDivider"),t.consume(g),t.exit("tableCellDivider"),P):g===null||U(g)?(t.exit("tableRow"),e(g)):ne(g)?re(t,P,"whitespace")(g):(t.enter("data"),$(g))}function $(g){return g===null||g===124||me(g)?(t.exit("data"),P(g)):(t.consume(g),g===92?j:$)}function j(g){return g===92||g===124?(t.consume(g),$):$(g)}}function DP(t,e){let n=-1,r=!0,i=0,o=[0,0,0,0],s=[0,0,0,0],l=!1,a=0,c,u,f,h=new Zc;for(;++n<t.length;){let m=t[n],y=m[1];m[0]==="enter"?y.type==="tableHead"?(l=!1,a!==0&&(cS(h,e,a,c,u),u=void 0,a=0),c={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},h.add(n,0,[["enter",c,e]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(r=!0,f=void 0,o=[0,0,0,0],s=[0,n+1,0,0],l&&(l=!1,u={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},h.add(n,0,[["enter",u,e]])),i=y.type==="tableDelimiterRow"?2:u?3:1):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(o[1]!==0&&(s[0]=s[1],f=eu(h,e,o,i,void 0,f),o=[0,0,0,0]),s[2]=n)):y.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(s[0]=s[1],f=eu(h,e,o,i,void 0,f)),o=s,s=[o[1],n,0,0])):y.type==="tableHead"?(l=!0,a=n):y.type==="tableRow"||y.type==="tableDelimiterRow"?(a=n,o[1]!==0?(s[0]=s[1],f=eu(h,e,o,i,n,f)):s[1]!==0&&(f=eu(h,e,s,i,n,f)),i=0):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(s[3]=n)}for(a!==0&&cS(h,e,a,c,u),h.consume(e.events),n=-1;++n<e.events.length;){let m=e.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=aS(e.events,n))}return t}function eu(t,e,n,r,i,o){let s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(o.end=Object.assign({},Zi(e.events,n[0])),t.add(n[0],0,[["exit",o,e]]));let a=Zi(e.events,n[1]);if(o={type:s,start:Object.assign({},a),end:Object.assign({},a)},t.add(n[1],0,[["enter",o,e]]),n[2]!==0){let c=Zi(e.events,n[2]),u=Zi(e.events,n[3]),f={type:l,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(n[2],0,[["enter",f,e]]),r!==2){let h=e.events[n[2]],m=e.events[n[3]];if(h[1].end=Object.assign({},m[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){let y=n[2]+1,x=n[3]-n[2]-1;t.add(y,x,[])}}t.add(n[3]+1,0,[["exit",f,e]])}return i!==void 0&&(o.end=Object.assign({},Zi(e.events,i)),t.add(i,0,[["exit",o,e]]),o=void 0),o}function cS(t,e,n,r,i){let o=[],s=Zi(e.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,e])),r.end=Object.assign({},s),o.push(["exit",r,e]),t.add(n+1,0,o)}function Zi(t,e){let n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}var PP={name:"tasklistCheck",tokenize:zP};function dm(){return{text:{91:PP}}}function zP(t,e,n){let r=this;return i;function i(a){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(a):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(a),t.exit("taskListCheckMarker"),o)}function o(a){return me(a)?(t.enter("taskListCheckValueUnchecked"),t.consume(a),t.exit("taskListCheckValueUnchecked"),s):a===88||a===120?(t.enter("taskListCheckValueChecked"),t.consume(a),t.exit("taskListCheckValueChecked"),s):n(a)}function s(a){return a===93?(t.enter("taskListCheckMarker"),t.consume(a),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),l):n(a)}function l(a){return U(a)?e(a):ne(a)?t.check({tokenize:BP},e,n)(a):n(a)}}function BP(t,e,n){return re(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function uS(t){return Oc([lm(),cm(),um(t),fm(),dm()])}var FP={};function tu(t){let e=this,n=t||FP,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(uS(n)),o.push(om()),s.push(Ws(n))}var dS=qg(fS(),1),Us=Object.assign(ii(Error),{eval:ii(EvalError),range:ii(RangeError),reference:ii(ReferenceError),syntax:ii(SyntaxError),type:ii(TypeError),uri:ii(URIError)});function ii(t){return e.displayName=t.displayName||t.name,e;function e(n,...r){let i=n&&(0,dS.default)(n,...r);return new t(i)}}var nu={}.hasOwnProperty,hS={yaml:"-",toml:"+"};function eo(t){let e=[],n=-1,r=Array.isArray(t)?t:t?[t]:["yaml"];for(;++n<r.length;)e[n]=$P(r[n]);return e}function $P(t){let e=t;if(typeof e=="string"){if(!nu.call(hS,e))throw Us("Missing matter definition for `%s`",e);e={type:e,marker:hS[e]}}else if(typeof e!="object")throw Us("Expected matter to be an object, not `%j`",e);if(!nu.call(e,"type"))throw Us("Missing `type` in matter `%j`",e);if(!nu.call(e,"fence")&&!nu.call(e,"marker"))throw Us("Missing `marker` or `fence` in matter `%j`",e);return e}function mm(t){let e=eo(t),n={},r=-1;for(;++r<e.length;){let i=e[r],o=pm(i,"open").charCodeAt(0),s=_P(i),l=n[o];Array.isArray(l)?l.push(s):n[o]=[s]}return{flow:n}}function _P(t){let e=t.anywhere,n=t.type,r=n+"Fence",i=r+"Sequence",o=n+"Value",s={tokenize:u,partial:!0},l,a=0;return{tokenize:c,concrete:!0};function c(f,h,m){let y=this;return x;function x(P){let $=y.now();return $.column===1&&($.line===1||e)&&(l=pm(t,"open"),a=0,P===l.charCodeAt(a))?(f.enter(n),f.enter(r),f.enter(i),k(P)):m(P)}function k(P){return a===l.length?(f.exit(i),ne(P)?(f.enter("whitespace"),S(P)):R(P)):P===l.charCodeAt(a++)?(f.consume(P),k):m(P)}function S(P){return ne(P)?(f.consume(P),S):(f.exit("whitespace"),R(P))}function R(P){return U(P)?(f.exit(r),f.enter("lineEnding"),f.consume(P),f.exit("lineEnding"),l=pm(t,"close"),a=0,f.attempt(s,T,M)):m(P)}function M(P){return P===null||U(P)?z(P):(f.enter(o),N(P))}function N(P){return P===null||U(P)?(f.exit(o),z(P)):(f.consume(P),N)}function z(P){return P===null?m(P):(f.enter("lineEnding"),f.consume(P),f.exit("lineEnding"),f.attempt(s,T,M))}function T(P){return f.exit(n),h(P)}}function u(f,h,m){let y=0;return x;function x(M){return M===l.charCodeAt(y)?(f.enter(r),f.enter(i),k(M)):m(M)}function k(M){return y===l.length?(f.exit(i),ne(M)?(f.enter("whitespace"),S(M)):R(M)):M===l.charCodeAt(y++)?(f.consume(M),k):m(M)}function S(M){return ne(M)?(f.consume(M),S):(f.exit("whitespace"),R(M))}function R(M){return M===null||U(M)?(f.exit(r),h(M)):m(M)}}}function pm(t,e){return t.marker?pS(t.marker,e).repeat(3):pS(t.fence,e)}function pS(t,e){return typeof t=="string"?t:t[e]}function ym(t){let e=eo(t),n={},r={},i=-1;for(;++i<e.length;){let o=e[i];n[o.type]=HP(o),r[o.type]=jP,r[o.type+"Value"]=qP}return{enter:n,exit:r}}function HP(t){return e;function e(n){this.enter({type:t.type,value:""},n),this.buffer()}}function jP(t){let e=this.resume(),n=this.stack[this.stack.length-1];"value"in n,this.exit(t),n.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"")}function qP(t){this.config.enter.data.call(this,t),this.config.exit.data.call(this,t)}function bm(t){let e=[],n={},r=eo(t),i=-1;for(;++i<r.length;){let o=r[i];n[o.type]=VP(o);let s=gm(o,"open");e.push({atBreak:!0,character:s.charAt(0),after:js(s.charAt(1))})}return{unsafe:e,handlers:n}}function VP(t){let e=gm(t,"open"),n=gm(t,"close");return r;function r(i){return e+(i.value?`
|
|
1562
|
+
`+i.value:"")+`
|
|
1563
|
+
`+n}}function gm(t,e){return t.marker?mS(t.marker,e).repeat(3):mS(t.fence,e)}function mS(t,e){return typeof t=="string"?t:t[e]}var WP="yaml";function ru(t){let e=this,n=t||WP,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(mm(n)),o.push(ym(n)),s.push(bm(n))}var UP=dp().use(Uc).use(tu).use(ru,["yaml"]);function KP(t){let e=/^(---\n[\s\S]*?\n---)(\n|$)/.exec(t);return e?{frontmatter:e[1],body:t.slice(e[0].length)}:{frontmatter:"",body:t}}var JP={strong:"bold",emphasis:"italic",inlineCode:"code",delete:"strike"};function to(t,e=[]){let n=[];for(let r of t.children||[])n.push(...GP(r,e));return n}function GP(t,e){switch(t.type){case"text":return t.value?[{type:"text",text:t.value,...e.length?{marks:e}:{}}]:[];case"strong":case"emphasis":case"delete":return to(t,[...e,{type:JP[t.type]}]);case"inlineCode":return[{type:"text",text:t.value,marks:[...e,{type:"code"}]}];case"link":return to(t,[...e,{type:"link",attrs:{href:t.url,title:t.title||null}}]);case"image":return[{type:"image",attrs:{src:t.url,alt:t.alt||null,title:t.title||null}}];case"break":return[{type:"hardBreak"}];case"html":return t.value?[{type:"text",text:t.value}]:[];default:return t.children?to(t,e):t.value?[{type:"text",text:t.value,...e.length?{marks:e}:{}}]:[]}}function XP(t){return(t.children||[]).some(n=>n.checked===!0||n.checked===!1)?{type:"taskList",content:(t.children||[]).map(n=>({type:"taskItem",attrs:{checked:n.checked===!0},content:xm(n)}))}:{type:t.ordered?"orderedList":"bulletList",...t.ordered&&t.start!=null&&t.start!==1?{attrs:{start:t.start}}:{},content:(t.children||[]).map(n=>({type:"listItem",content:xm(n)}))}}function YP(t){let e=t.align||[];return{type:"table",content:(t.children||[]).map((r,i)=>({type:"tableRow",content:(r.children||[]).map(o=>({type:i===0?"tableHeader":"tableCell",attrs:{colspan:1,rowspan:1,colwidth:null},content:[{type:"paragraph",content:to(o)}]}))}))}}function yS(t){switch(t.type){case"heading":return{type:"heading",attrs:{level:t.depth},content:to(t)};case"paragraph":{let e=to(t);return{type:"paragraph",...e.length?{content:e}:{}}}case"blockquote":return{type:"blockquote",content:xm(t)};case"list":return XP(t);case"code":return{type:"codeBlock",attrs:{language:t.lang||null},content:t.value?[{type:"text",text:t.value}]:[]};case"thematicBreak":return{type:"horizontalRule"};case"table":return YP(t);case"html":return{type:"codeBlock",attrs:{language:"html"},content:t.value?[{type:"text",text:t.value}]:[]};default:return null}}function xm(t){let e=[];for(let n of t.children||[]){let r=yS(n);r&&e.push(r)}return e.length?e:[{type:"paragraph"}]}function Js(t){let{frontmatter:e,body:n}=KP(t),r=UP.parse(n),i=[];for(let o of r.children||[]){if(o.type==="yaml")continue;let s=yS(o);s&&i.push(s)}return{frontmatter:e,doc:{type:"doc",content:i.length?i:[{type:"paragraph"}]}}}function QP(t){let e={type:"text",value:t.text||""},n=t.marks||[];if(n.some(r=>r.type==="code")){let r={type:"inlineCode",value:t.text||""};return gS(r,n)}return gS(e,n)}function gS(t,e){let n=t;for(let r of e)r.type!=="code"&&(r.type==="bold"?n={type:"strong",children:[n]}:r.type==="italic"?n={type:"emphasis",children:[n]}:r.type==="strike"?n={type:"delete",children:[n]}:r.type==="link"&&(n={type:"link",url:r.attrs?.href||"",title:r.attrs?.title||null,children:[n]}));return n}function km(t){let e=[];for(let n of t||[])n.type==="text"?e.push(QP(n)):n.type==="hardBreak"?e.push({type:"break"}):n.type==="image"&&e.push({type:"image",url:n.attrs?.src||"",alt:n.attrs?.alt||null,title:n.attrs?.title||null});return e}function ZP(t){switch(t.type){case"heading":return{type:"heading",depth:t.attrs?.level||1,children:km(t.content)};case"paragraph":return{type:"paragraph",children:km(t.content)};case"blockquote":return{type:"blockquote",children:Ks(t.content)};case"bulletList":return{type:"list",ordered:!1,spread:!1,children:(t.content||[]).map(e=>({type:"listItem",spread:!1,children:Ks(e.content)}))};case"orderedList":return{type:"list",ordered:!0,start:t.attrs?.start||1,spread:!1,children:(t.content||[]).map(e=>({type:"listItem",spread:!1,children:Ks(e.content)}))};case"taskList":return{type:"list",ordered:!1,spread:!1,children:(t.content||[]).map(e=>({type:"listItem",checked:!!e.attrs?.checked,spread:!1,children:Ks(e.content)}))};case"codeBlock":return{type:"code",lang:t.attrs?.language||null,value:(t.content||[]).map(e=>e.text||"").join("")};case"horizontalRule":return{type:"thematicBreak"};case"table":return e2(t);default:return null}}function e2(t){return{type:"table",align:[],children:(t.content||[]).map(e=>({type:"tableRow",children:(e.content||[]).map(n=>({type:"tableCell",children:km((n.content?.[0]||{}).content)}))}))}}function Ks(t){let e=[];for(let n of t||[]){let r=ZP(n);r&&e.push(r)}return e}function iu(t,e=""){let n={type:"root",children:Ks(t.content)},r=Zp(n,{extensions:[Ws()],bullet:"-",emphasis:"_",rule:"-",fences:!0});return e&&(r=e.replace(/\n?$/,`
|
|
1564
|
+
`)+`
|
|
1565
|
+
`+r),r}var Gs=new te("sonorance-comments");function t2(t){let e="",n=[],r=[],i=null,o=-1;return t.descendants((s,l)=>{if(s.type.name==="heading"){i="",o=e.length;return}if(s.isText){let a=s.text||"";for(let c=0;c<a.length;c++)n.push(l+c);e+=a,i!==null&&(i+=a)}else s.isBlock&&e.length&&e[e.length-1]!==`
|
|
1566
|
+
`&&(e+=`
|
|
1567
|
+
`,n.push(l),i!==null&&i.trim()&&(r.push({text:i.trim(),at:o}),i=null))}),i!==null&&i.trim()&&r.push({text:i.trim(),at:o}),{text:e,posAt:n,headingStart:r}}function ou(t,e){if(!e)return null;let{text:n,posAt:r,headingStart:i}=t2(t),o=(e.quote||"").trim(),s=(e.heading||"").trim(),l=0;if(s){let a=i.find(c=>c.text===s);a&&(l=a.at)}if(o&&o.length>=2){let a=n.indexOf(o,l);if(a<0&&(a=n.indexOf(o)),a>=0&&r[a]!=null){let c=r[a],u=(r[a+o.length-1]??c)+1;return{from:c,to:u}}}if(s){let a=i.find(c=>c.text===s);if(a&&r[a.at]!=null)return{from:r[a.at],to:(r[a.at+s.length-1]??r[a.at])+1}}return null}function bS(t,e){let n=[];for(let r of e||[]){let i=ou(t,r.anchor);!i||i.to<=i.from||n.push(Ce.inline(i.from,i.to,{class:"cmark","data-comment":r.id}))}return ae.create(t,n)}function xS({onClick:t}={}){return new Y({key:Gs,state:{init:()=>({comments:[],decos:ae.empty}),apply(e,n){let r=e.getMeta(Gs);return r&&r.comments?{comments:r.comments,decos:bS(e.doc,r.comments)}:e.docChanged?{comments:n.comments,decos:bS(e.doc,n.comments)}:n}},props:{decorations(e){return Gs.getState(e)?.decos},handleClick(e,n,r){let i=r.target.closest?.(".cmark");return i&&i.dataset.comment?(t?.(i.dataset.comment),!0):!1}}})}var Xs=new te("sonorance-diff");function n2(t){let e=[];return t.forEach((n,r)=>{e.push({pos:r,size:n.nodeSize})}),e}function kS(t,e){if(!e)return ae.empty;let{nodeClasses:n=[],deletions:r=[],count:i}=e,o=n2(t);if(typeof i=="number"&&o.length!==i)return ae.empty;let s=[];for(let l=0;l<o.length;l++){let a=n[l];a&&s.push(Ce.node(o[l].pos,o[l].pos+o[l].size,{class:a}))}for(let l of r||[]){let a=l.at,c=a>=0&&a<o.length?o[a].pos:o.length?o[o.length-1].pos+o[o.length-1].size:0,u=a>=0&&a<o.length?-1:1;s.push(Ce.widget(c,()=>{let f=document.createElement("div");return f.className="diffdel-wrap",f.setAttribute("contenteditable","false"),f.innerHTML=l.html||"",f},{side:u,ignoreSelection:!0,key:"del-"+a+"-"+(l.key||"")}))}return ae.create(t,s)}function wS(){return new Y({key:Xs,state:{init:()=>({diff:null,decos:ae.empty}),apply(t,e){let n=t.getMeta(Xs);return n!==void 0?{diff:n,decos:kS(t.doc,n)}:t.docChanged?{diff:e.diff,decos:kS(t.doc,e.diff)}:e}},props:{decorations(t){return Xs.getState(t)?.decos}}})}var Ys=new te("sonorance-activeline");function r2(t,e){if(!e)return ae.empty;let{$head:n}=t.selection;if(!n||n.depth<1)return ae.empty;let r=n.before(n.depth),i=n.after(n.depth);return ae.create(t.doc,[Ce.node(r,i,{class:"pm-activeline"})])}function SS(){return new Y({key:Ys,state:{init:()=>({focused:!1,decos:ae.empty}),apply(t,e,n,r){let i=t.getMeta(Ys),o=i&&typeof i.focused=="boolean"?i.focused:e.focused;return{focused:o,decos:r2(r,o)}}},props:{decorations(t){return Ys.getState(t)?.decos},handleDOMEvents:{focus(t){return t.dispatch(t.state.tr.setMeta(Ys,{focused:!0})),!1},blur(t){return t.dispatch(t.state.tr.setMeta(Ys,{focused:!1})),!1}}}})}var Zs=Math.min,mr=Math.max,el=Math.round,tl=Math.floor,en=t=>({x:t,y:t}),i2={left:"right",right:"left",bottom:"top",top:"bottom"};function lu(t,e){return typeof t=="function"?t(e):t}function oi(t){return t.split("-")[0]}function nl(t){return t.split("-")[1]}function ES(t){return t==="x"?"y":"x"}function wm(t){return t==="y"?"height":"width"}function gr(t){let e=t[0];return e==="t"||e==="b"?"y":"x"}function Sm(t){return ES(gr(t))}function TS(t,e,n){n===void 0&&(n=!1);let r=nl(t),i=Sm(t),o=wm(i),s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Qs(s)),[s,Qs(s)]}function MS(t){let e=Qs(t);return[su(t),e,su(e)]}function su(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}var vS=["left","right"],CS=["right","left"],o2=["top","bottom"],s2=["bottom","top"];function l2(t,e,n){switch(t){case"top":case"bottom":return n?e?CS:vS:e?vS:CS;case"left":case"right":return e?o2:s2;default:return[]}}function AS(t,e,n,r){let i=nl(t),o=l2(oi(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(su)))),o}function Qs(t){let e=oi(t);return i2[e]+t.slice(e.length)}function a2(t){return{top:0,right:0,bottom:0,left:0,...t}}function RS(t){return typeof t!="number"?a2(t):{top:t,right:t,bottom:t,left:t}}function si(t){let{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function IS(t,e,n){let{reference:r,floating:i}=t,o=gr(e),s=Sm(e),l=wm(s),a=oi(e),c=o==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2,m;switch(a){case"top":m={x:u,y:r.y-i.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}switch(nl(e)){case"start":m[s]-=h*(n&&c?-1:1);break;case"end":m[s]+=h*(n&&c?-1:1);break}return m}async function LS(t,e){var n;e===void 0&&(e={});let{x:r,y:i,platform:o,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=lu(e,t),y=RS(m),k=l[h?f==="floating"?"reference":"floating":f],S=si(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(k)))==null||n?k:k.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),R=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,M=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),N=await(o.isElement==null?void 0:o.isElement(M))?await(o.getScale==null?void 0:o.getScale(M))||{x:1,y:1}:{x:1,y:1},z=si(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:M,strategy:a}):R);return{top:(S.top-z.top+y.top)/N.y,bottom:(z.bottom-S.bottom+y.bottom)/N.y,left:(S.left-z.left+y.left)/N.x,right:(z.right-S.right+y.right)/N.x}}var c2=50,NS=async(t,e,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:LS},a=await(s.isRTL==null?void 0:s.isRTL(e)),c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=IS(c,r,a),h=r,m=0,y={};for(let x=0;x<o.length;x++){let k=o[x];if(!k)continue;let{name:S,fn:R}=k,{x:M,y:N,data:z,reset:T}=await R({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:y,rects:c,platform:l,elements:{reference:t,floating:e}});u=M??u,f=N??f,y[S]={...y[S],...z},T&&m<c2&&(m++,typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(c=T.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):T.rects),{x:u,y:f}=IS(c,h,a)),x=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:y}};var OS=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;let{placement:i,middlewareData:o,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...k}=lu(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let S=oi(i),R=gr(l),M=oi(l)===l,N=await(a.isRTL==null?void 0:a.isRTL(c.floating)),z=h||(M||!x?[Qs(l)]:MS(l)),T=y!=="none";!h&&T&&z.push(...AS(l,x,y,N));let P=[l,...z],$=await a.detectOverflow(e,k),j=[],g=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&j.push($[S]),f){let J=TS(i,s,N);j.push($[J[0]],$[J[1]])}if(g=[...g,{placement:i,overflows:j}],!j.every(J=>J<=0)){var oe,G;let J=(((oe=o.flip)==null?void 0:oe.index)||0)+1,K=P[J];if(K&&(!(f==="alignment"?R!==gr(K):!1)||g.every(Ee=>gr(Ee.placement)===R?Ee.overflows[0]>0:!0)))return{data:{index:J,overflows:g},reset:{placement:K}};let se=(G=g.filter(he=>he.overflows[0]<=0).sort((he,Ee)=>he.overflows[1]-Ee.overflows[1])[0])==null?void 0:G.placement;if(!se)switch(m){case"bestFit":{var V;let he=(V=g.filter(Ee=>{if(T){let Ae=gr(Ee.placement);return Ae===R||Ae==="y"}return!0}).map(Ee=>[Ee.placement,Ee.overflows.filter(Ae=>Ae>0).reduce((Ae,A)=>Ae+A,0)]).sort((Ee,Ae)=>Ee[1]-Ae[1])[0])==null?void 0:V[0];he&&(se=he);break}case"initialPlacement":se=l;break}if(i!==se)return{reset:{placement:se}}}return{}}}};var u2=new Set(["left","top"]);async function f2(t,e){let{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=oi(n),l=nl(n),a=gr(n)==="y",c=u2.has(s)?-1:1,u=o&&a?-1:1,f=lu(e,t),{mainAxis:h,crossAxis:m,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(m=l==="end"?y*-1:y),a?{x:m*u,y:h*c}:{x:h*c,y:m*u}}var DS=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;let{x:i,y:o,placement:s,middlewareData:l}=e,a=await f2(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:o+a.y,data:{...a,placement:s}}}}};function au(){return typeof window<"u"}function ai(t){return zS(t)?(t.nodeName||"").toLowerCase():"#document"}function Rt(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function tn(t){var e;return(e=(zS(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function zS(t){return au()?t instanceof Node||t instanceof Rt(t).Node:!1}function Ut(t){return au()?t instanceof Element||t instanceof Rt(t).Element:!1}function wn(t){return au()?t instanceof HTMLElement||t instanceof Rt(t).HTMLElement:!1}function PS(t){return!au()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Rt(t).ShadowRoot}function ro(t){let{overflow:e,overflowX:n,overflowY:r,display:i}=Kt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function BS(t){return/^(table|td|th)$/.test(ai(t))}function rl(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}var d2=/transform|translate|scale|rotate|perspective|filter/,h2=/paint|layout|strict|content/,li=t=>!!t&&t!=="none",vm;function cu(t){let e=Ut(t)?Kt(t):t;return li(e.transform)||li(e.translate)||li(e.scale)||li(e.rotate)||li(e.perspective)||!uu()&&(li(e.backdropFilter)||li(e.filter))||d2.test(e.willChange||"")||h2.test(e.contain||"")}function FS(t){let e=Un(t);for(;wn(e)&&!ci(e);){if(cu(e))return e;if(rl(e))return null;e=Un(e)}return null}function uu(){return vm==null&&(vm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),vm}function ci(t){return/^(html|body|#document)$/.test(ai(t))}function Kt(t){return Rt(t).getComputedStyle(t)}function il(t){return Ut(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Un(t){if(ai(t)==="html")return t;let e=t.assignedSlot||t.parentNode||PS(t)&&t.host||tn(t);return PS(e)?e.host:e}function $S(t){let e=Un(t);return ci(e)?t.ownerDocument?t.ownerDocument.body:t.body:wn(e)&&ro(e)?e:$S(e)}function no(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=$S(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Rt(i);if(o){let l=fu(s);return e.concat(s,s.visualViewport||[],ro(i)?i:[],l&&n?no(l):[])}else return e.concat(i,no(i,[],n))}function fu(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function qS(t){let e=Kt(t),n=parseFloat(e.width)||0,r=parseFloat(e.height)||0,i=wn(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,l=el(n)!==o||el(r)!==s;return l&&(n=o,r=s),{width:n,height:r,$:l}}function Em(t){return Ut(t)?t:t.contextElement}function io(t){let e=Em(t);if(!wn(e))return en(1);let n=e.getBoundingClientRect(),{width:r,height:i,$:o}=qS(e),s=(o?el(n.width):n.width)/r,l=(o?el(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}var p2=en(0);function VS(t){let e=Rt(t);return!uu()||!e.visualViewport?p2:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function m2(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Rt(t)?!1:e}function ui(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),o=Em(t),s=en(1);e&&(r?Ut(r)&&(s=io(r)):s=io(t));let l=m2(o,n,r)?VS(o):en(0),a=(i.left+l.x)/s.x,c=(i.top+l.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){let h=Rt(o),m=r&&Ut(r)?Rt(r):r,y=h,x=fu(y);for(;x&&r&&m!==y;){let k=io(x),S=x.getBoundingClientRect(),R=Kt(x),M=S.left+(x.clientLeft+parseFloat(R.paddingLeft))*k.x,N=S.top+(x.clientTop+parseFloat(R.paddingTop))*k.y;a*=k.x,c*=k.y,u*=k.x,f*=k.y,a+=M,c+=N,y=Rt(x),x=fu(y)}}return si({width:u,height:f,x:a,y:c})}function du(t,e){let n=il(t).scrollLeft;return e?e.left+n:ui(tn(t)).left+n}function WS(t,e){let n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-du(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function g2(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t,o=i==="fixed",s=tn(r),l=e?rl(e.floating):!1;if(r===s||l&&o)return n;let a={scrollLeft:0,scrollTop:0},c=en(1),u=en(0),f=wn(r);if((f||!f&&!o)&&((ai(r)!=="body"||ro(s))&&(a=il(r)),f)){let m=ui(r);c=io(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}let h=s&&!f&&!o?WS(s,a):en(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-a.scrollTop*c.y+u.y+h.y}}function y2(t){return Array.from(t.getClientRects())}function b2(t){let e=tn(t),n=il(t),r=t.ownerDocument.body,i=mr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=mr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),s=-n.scrollLeft+du(t),l=-n.scrollTop;return Kt(r).direction==="rtl"&&(s+=mr(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:l}}var _S=25;function x2(t,e){let n=Rt(t),r=tn(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,l=0,a=0;if(i){o=i.width,s=i.height;let u=uu();(!u||u&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}let c=du(r);if(c<=0){let u=r.ownerDocument,f=u.body,h=getComputedStyle(f),m=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-m);y<=_S&&(o-=y)}else c<=_S&&(o+=c);return{width:o,height:s,x:l,y:a}}function k2(t,e){let n=ui(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=wn(t)?io(t):en(1),s=t.clientWidth*o.x,l=t.clientHeight*o.y,a=i*o.x,c=r*o.y;return{width:s,height:l,x:a,y:c}}function HS(t,e,n){let r;if(e==="viewport")r=x2(t,n);else if(e==="document")r=b2(tn(t));else if(Ut(e))r=k2(e,n);else{let i=VS(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return si(r)}function US(t,e){let n=Un(t);return n===e||!Ut(n)||ci(n)?!1:Kt(n).position==="fixed"||US(n,e)}function w2(t,e){let n=e.get(t);if(n)return n;let r=no(t,[],!1).filter(l=>Ut(l)&&ai(l)!=="body"),i=null,o=Kt(t).position==="fixed",s=o?Un(t):t;for(;Ut(s)&&!ci(s);){let l=Kt(s),a=cu(s);!a&&l.position==="fixed"&&(i=null),(o?!a&&!i:!a&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ro(s)&&!a&&US(t,s))?r=r.filter(u=>u!==s):i=l,s=Un(s)}return e.set(t,r),r}function S2(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t,s=[...n==="clippingAncestors"?rl(e)?[]:w2(e,this._c):[].concat(n),r],l=HS(e,s[0],i),a=l.top,c=l.right,u=l.bottom,f=l.left;for(let h=1;h<s.length;h++){let m=HS(e,s[h],i);a=mr(m.top,a),c=Zs(m.right,c),u=Zs(m.bottom,u),f=mr(m.left,f)}return{width:c-f,height:u-a,x:f,y:a}}function v2(t){let{width:e,height:n}=qS(t);return{width:e,height:n}}function C2(t,e,n){let r=wn(e),i=tn(e),o=n==="fixed",s=ui(t,!0,o,e),l={scrollLeft:0,scrollTop:0},a=en(0);function c(){a.x=du(i)}if(r||!r&&!o)if((ai(e)!=="body"||ro(i))&&(l=il(e)),r){let m=ui(e,!0,o,e);a.x=m.x+e.clientLeft,a.y=m.y+e.clientTop}else i&&c();o&&!r&&i&&c();let u=i&&!r&&!o?WS(i,l):en(0),f=s.left+l.scrollLeft-a.x-u.x,h=s.top+l.scrollTop-a.y-u.y;return{x:f,y:h,width:s.width,height:s.height}}function Cm(t){return Kt(t).position==="static"}function jS(t,e){if(!wn(t)||Kt(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return tn(t)===n&&(n=n.ownerDocument.body),n}function KS(t,e){let n=Rt(t);if(rl(t))return n;if(!wn(t)){let i=Un(t);for(;i&&!ci(i);){if(Ut(i)&&!Cm(i))return i;i=Un(i)}return n}let r=jS(t,e);for(;r&&BS(r)&&Cm(r);)r=jS(r,e);return r&&ci(r)&&Cm(r)&&!cu(r)?n:r||FS(t)||n}var E2=async function(t){let e=this.getOffsetParent||KS,n=this.getDimensions,r=await n(t.floating);return{reference:C2(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function T2(t){return Kt(t).direction==="rtl"}var M2={convertOffsetParentRelativeRectToViewportRelativeRect:g2,getDocumentElement:tn,getClippingRect:S2,getOffsetParent:KS,getElementRects:E2,getClientRects:y2,getDimensions:v2,getScale:io,isElement:Ut,isRTL:T2};function JS(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function A2(t,e){let n=null,r,i=tn(t);function o(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),o();let c=t.getBoundingClientRect(),{left:u,top:f,width:h,height:m}=c;if(l||e(),!h||!m)return;let y=tl(f),x=tl(i.clientWidth-(u+h)),k=tl(i.clientHeight-(f+m)),S=tl(u),M={rootMargin:-y+"px "+-x+"px "+-k+"px "+-S+"px",threshold:mr(0,Zs(1,a))||1},N=!0;function z(T){let P=T[0].intersectionRatio;if(P!==a){if(!N)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},1e3)}P===1&&!JS(c,t.getBoundingClientRect())&&s(),N=!1}try{n=new IntersectionObserver(z,{...M,root:i.ownerDocument})}catch{n=new IntersectionObserver(z,M)}n.observe(t)}return s(!0),o}function GS(t,e,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=Em(t),u=i||o?[...c?no(c):[],...e?no(e):[]]:[];u.forEach(S=>{i&&S.addEventListener("scroll",n,{passive:!0}),o&&S.addEventListener("resize",n)});let f=c&&l?A2(c,n):null,h=-1,m=null;s&&(m=new ResizeObserver(S=>{let[R]=S;R&&R.target===c&&m&&e&&(m.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var M;(M=m)==null||M.observe(e)})),n()}),c&&!a&&m.observe(c),e&&m.observe(e));let y,x=a?ui(t):null;a&&k();function k(){let S=ui(t);x&&!JS(x,S)&&n(),x=S,y=requestAnimationFrame(k)}return n(),()=>{var S;u.forEach(R=>{i&&R.removeEventListener("scroll",n),o&&R.removeEventListener("resize",n)}),f?.(),(S=m)==null||S.disconnect(),m=null,a&&cancelAnimationFrame(y)}}var XS=DS;var YS=OS;var QS=(t,e,n)=>{let r=new Map,i={platform:M2,...n},o={...i.platform,_c:r};return NS(t,e,{...i,platform:o})};function R2(t){var e;let{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,$position:l}=t,a=r&&!i,c=Vx(n),u=new RegExp(`\\s${c}$`),f=s?"^":"",h=i?"":c,m=a?new RegExp(`${f}${c}.*?(?=\\s${h}|$)`,"gm"):new RegExp(`${f}(?:^)?${c}[^\\s${h}]*`,"gm"),y=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!y)return null;let x=l.pos-y.length,k=Array.from(y.matchAll(m)).pop();if(!k||k.input===void 0||k.index===void 0)return null;let S=k.input.slice(Math.max(0,k.index-1),k.index),R=new RegExp(`^[${o?.join("")}\0]?$`).test(S);if(o!==null&&!R)return null;let M=x+k.index,N=M+k[0].length;return a&&u.test(y.slice(N-1,N+1))&&(k[0]+=" ",N+=1),M<l.pos&&N>=l.pos?{range:{from:M,to:N},query:k[0].slice(n.length),text:k[0]}:null}function I2(t){return t.docChanged?t.steps.some(e=>{let n=e.slice;if(!n?.content)return!1;let r=n.content.textBetween(0,n.content.size,`
|
|
1568
|
+
`);return/\s/.test(r)}):!1}function L2(t){return()=>{let e=t.state.selection.$anchor.pos,n=t.view.coordsAtPos(e),{top:r,right:i,bottom:o,left:s}=n;try{return new DOMRect(s,r,i-s,o-r)}catch{return null}}}function N2(t,e,n,r){return n?()=>{let i=r.getState(t.state),o=i?.decorationId,s=e.dom.querySelector(`[data-decoration-id="${o}"]`);return s?.getBoundingClientRect()||null}:L2(t)}function O2({match:t,dismissedRange:e,state:n,transaction:r,editor:i,shouldResetDismissed:o,effectiveAllowSpaces:s}){return o?.({editor:i,state:n,range:e,match:t,transaction:r,allowSpaces:s})?!1:s?t.range.from===e.from:t.range.from===e.from&&!I2(r)}function D2({view:t,pluginKeyRef:e}){let n=t.state.tr.setMeta(e,{exit:!0});t.dispatch(n)}function P2({pluginKey:t,decorationTag:e,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:o,dispatchExit:s}){return{handleKeyDown(l,a){var c,u;let f=t.getState(l.state);return f.active?a.key==="Escape"||a.key==="Esc"?((c=o?.onKeyDown)==null||c.call(o,{view:l,event:a,range:f.range}),s(l),!0):((u=o?.onKeyDown)==null?void 0:u.call(o,{view:l,event:a,range:f.range}))||!1:!1},decorations(l){let a=t.getState(l),{active:c,range:u,decorationId:f,query:h}=a;if(!c)return null;let m=!h?.length,y=[n];return m&&y.push(i),ae.create(l.doc,[Ce.inline(u.from,u.to,{nodeName:e,class:y.join(" "),"data-decoration-id":f||void 0,"data-decoration-content":r})])}}}function z2({editor:t,char:e,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:o,findSuggestionMatch:s,allow:l,shouldShow:a,shouldKeepDismissed:c,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(f,h,m,y){let{isEditable:x}=t,{composing:k}=t.view,{selection:S}=f,{empty:R,from:M}=S,N={...h},z=f.getMeta(u);if(z&&z.exit)return N.active=!1,N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null,N.dismissedRange=h.active?{...h.range}:h.dismissedRange,N;if(N.composing=k,f.docChanged&&N.dismissedRange!==null&&(N.dismissedRange={from:f.mapping.map(N.dismissedRange.from),to:f.mapping.map(N.dismissedRange.to)}),x&&(R||t.view.composing)){(M<h.range.from||M>h.range.to)&&!k&&!h.composing&&(N.active=!1);let T=s({char:e,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:o,$position:S.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;T&&l({editor:t,state:y,range:T.range,isActive:h.active})&&(!a||a({editor:t,range:T.range,query:T.query,text:T.text,transaction:f}))?(N.dismissedRange!==null&&!c({match:T,dismissedRange:N.dismissedRange,state:y,transaction:f})&&(N.dismissedRange=null),N.dismissedRange===null?(N.active=!0,N.decorationId=h.decorationId||P,N.range=T.range,N.query=T.query,N.text=T.text):N.active=!1):(T||(N.dismissedRange=null),N.active=!1)}else N.active=!1;return N.active||(N.decorationId=null,N.range={from:0,to:0},N.query=null,N.text=null),N}}}function B2({editor:t,items:e}){let n=null,r=null,i=null,o=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},s=c=>new Promise(u=>{i=u,r=setTimeout(()=>{r=null;let f=i;i=null,f?.()},c)}),l=()=>{n?.abort(),o(),n=null};return{abort:l,fetch:async(c,u)=>{l(),n=new AbortController;let f=n;if(u>0&&await s(u),n!==f||f.signal.aborted)return{status:"aborted"};try{let h=await e({editor:t,query:c,signal:f.signal});return n!==f||f.signal.aborted?{status:"aborted"}:{status:"resolved",items:h}}catch{return n!==f||f.signal.aborted?{status:"aborted"}:{status:"error"}}}}}function F2({placement:t,offset:e,flip:n,floatingUi:r}){var i,o,s,l;let a=[XS({mainAxis:(i=e.mainAxis)!=null?i:4,crossAxis:(o=e.crossAxis)!=null?o:0})];return n&&a.push(YS()),(s=r?.middleware)!=null&&s.length&&a.push(...r.middleware),{placement:t,strategy:(l=r?.strategy)!=null?l:"absolute",middleware:a}}function $2(t){if(t instanceof HTMLElement)return t;if(typeof t=="string")try{let e=document.querySelector(t);if(e)return e}catch{return document.body}return document.body}function _2({getReferenceRect:t,contextElement:e,config:n,container:r,dismissOnOutsideClick:i,dismiss:o}){return(s,l={})=>{let a={getBoundingClientRect:()=>{var y;return(y=t())!=null?y:new DOMRect},contextElement:e},c=!1,u=!s.isConnected;u&&$2(r).appendChild(s),l.onPosition||(s.style.visibility="hidden",s.style.width="max-content");let h=GS(a,s,()=>{QS(a,s,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:y,y:x,placement:k,strategy:S})=>{if(l.onPosition){l.onPosition({x:y,y:x,placement:k,strategy:S});return}Object.assign(s.style,{position:S,left:`${y}px`,top:`${x}px`}),c||(c=!0,s.style.visibility="")})},l.autoUpdate),m;return i&&(m=y=>{let x=y.target;!(x instanceof Node)||s.contains(x)||e.contains(x)||o()},document.addEventListener("pointerdown",m,!0)),()=>{h(),m&&document.removeEventListener("pointerdown",m,!0),u&&s.remove()}}}function H2({editor:t,pluginKey:e,items:n,renderer:r,minQueryLength:i,debounce:o,initialItems:s,placement:l,offset:a,container:c,flip:u,floatingUi:f,dismissOnOutsideClick:h,command:m,clientRectFor:y,dispatchExit:x}){let k,S=B2({editor:t,items:n}),R=F2({placement:l,offset:a,flip:u,floatingUi:f});function M(N,z){var T,P,$;switch(N){case"started":(T=r?.onStart)==null||T.call(r,z);break;case"updated":(P=r?.onUpdate)==null||P.call(r,z);break;case"stopped":($=r?.onExit)==null||$.call(r,z);break;default:break}}return{update:async(N,z)=>{var T,P,$,j;let g=e.getState(z),oe=e.getState(N.state);if(!g||!oe)return;let G=null,V=g.query!==oe.query,J=g.text!==oe.text,K=g.range.from!==oe.range.from||g.range.to!==oe.range.to,se=V||J||K;if(!g.active&&oe.active)G="started";else if(g.active&&!oe.active)G="stopped";else if(oe.active&&se)G="updated";else return;let he=G==="stopped"?g:oe,Ee=N.dom.querySelector(`[data-decoration-id="${he.decorationId}"]`),Ae=y(N,Ee),A=i===0||(he.query?he.query.length>=i:!1),Qe=(G==="started"||G==="updated")&&A;if(k={editor:t,range:he.range,query:he.query||"",text:he.text||"",items:s??[],command:Ze=>m({editor:t,range:he.range,props:Ze}),decorationNode:Ee,clientRect:Ae,loading:Qe,placement:l,offset:{mainAxis:(T=a.mainAxis)!=null?T:4,crossAxis:(P=a.crossAxis)!=null?P:0},container:c,flip:u,floatingUi:R,mount:_2({getReferenceRect:Ae,contextElement:N.dom,config:R,container:c,dismissOnOutsideClick:h,dismiss:()=>x(t.view)})},G==="started"&&(($=r?.onBeforeStart)==null||$.call(r,k)),G==="updated"&&((j=r?.onBeforeUpdate)==null||j.call(r,k)),G==="started"&&M(G,k),G==="started"||G==="updated")if(!Qe)S.abort(),k={...k,items:s??[],loading:!1};else{k={...k,items:s??[],loading:!0},G="updated",M(G,k);let Ze=await S.fetch(he.query||"",o);if(Ze.status==="aborted")return;let I=e.getState(N.state);if(!I?.active){S.abort();return}k=Ze.status==="resolved"?{...k,items:Ze.items,loading:!1}:{...k,loading:!1}}if(G==="stopped"){S.abort(),M(G,k),k=void 0;return}G==="updated"&&M(G,k)},destroy:()=>{var N;S.abort(),k&&((N=r?.onExit)==null||N.call(r,k))}}}var j2=new te("suggestion");function hu({pluginKey:t=j2,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:c="",decorationEmptyClass:u="is-empty",command:f=()=>null,items:h=()=>[],minQueryLength:m=0,debounce:y=0,initialItems:x,placement:k="bottom-start",offset:S={},container:R,flip:M=!0,floatingUi:N,dismissOnOutsideClick:z=!0,render:T=()=>({}),allow:P=()=>!0,findSuggestionMatch:$=R2,shouldShow:j,shouldResetDismissed:g}){let oe=T?.(),G=r&&!i,V=(se,he)=>N2(e,se,he,t);function J(se){return O2({...se,editor:e,shouldResetDismissed:g,effectiveAllowSpaces:G})}let K=se=>D2({view:se,pluginKeyRef:t});return new Y({key:t,view:()=>H2({editor:e,pluginKey:t,items:h,renderer:oe,minQueryLength:m,debounce:y,initialItems:x,placement:k,offset:S,container:R,flip:M,floatingUi:N,dismissOnOutsideClick:z,command:f,clientRectFor:V,dispatchExit:K}),state:z2({editor:e,char:n,effectiveAllowSpaces:G,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,findSuggestionMatch:$,allow:P,shouldShow:j,shouldKeepDismissed:J,pluginKey:t}),props:P2({pluginKey:t,decorationTag:l,decorationClass:a,decorationContent:c,decorationEmptyClass:u,renderer:oe,dispatchExit:K})})}var ZS=[{title:"Heading 1",keys:"h1 heading title",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).setNode("heading",{level:1}).run()},{title:"Heading 2",keys:"h2 heading subtitle",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).setNode("heading",{level:2}).run()},{title:"Heading 3",keys:"h3 heading",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).setNode("heading",{level:3}).run()},{title:"Bullet list",keys:"ul bullet unordered list",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).toggleBulletList().run()},{title:"Numbered list",keys:"ol ordered numbered list",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).toggleOrderedList().run()},{title:"Task list",keys:"todo task checkbox check",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).toggleTaskList().run()},{title:"Table",keys:"table grid",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{title:"Code block",keys:"code pre snippet",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).setCodeBlock().run()},{title:"Quote",keys:"quote blockquote",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).toggleBlockquote().run()},{title:"Divider",keys:"hr rule divider separator",run:({editor:t,range:e})=>t.chain().focus().deleteRange(e).setHorizontalRule().run()}];function q2(t){let e=(t||"").toLowerCase().trim();return e?ZS.filter(n=>(n.title+" "+n.keys).toLowerCase().includes(e)).slice(0,10):ZS.slice(0,10)}function Tm(){let t=null,e=[],n=0,r=null,i=()=>{if(t){if(t.innerHTML="",!e.length){t.classList.remove("show");return}t.classList.add("show"),e.forEach((a,c)=>{let u=document.createElement("button");u.type="button",u.className="slashitem"+(c===n?" active":""),u.textContent=a.title,u.addEventListener("mousedown",f=>{f.preventDefault(),s(c)}),t.appendChild(u)})}},o=a=>{if(!t)return;let c=null;try{c=a.clientRect&&a.clientRect()}catch{c=null}let u=window.innerWidth||1200,f=window.innerHeight||800,h=t.offsetWidth||220,m=t.offsetHeight||240,y=c?Math.min(c.left,u-h-8):40,x=c?Math.min(c.bottom+6,f-m-8):80;t.style.left=Math.max(8,y)+"px",t.style.top=Math.max(8,x)+"px"},s=a=>{let c=e[a];!c||!r||r(c)};return{onStart(a){r=a.command,e=a.items,n=0,t=document.createElement("div"),t.className="slashmenu",t.setAttribute("role","listbox"),document.body.appendChild(t),i(),o(a)},onUpdate(a){r=a.command,e=a.items,n>=e.length&&(n=0),i(),o(a)},onKeyDown(a){let c=a.event.key;return c==="Escape"?(l(),!0):e.length?c==="ArrowDown"?(n=(n+1)%e.length,i(),!0):c==="ArrowUp"?(n=(n-1+e.length)%e.length,i(),!0):c==="Enter"?(s(n),!0):!1:!1},onExit(){l()}};function l(){t&&(t.remove(),t=null),e=[]}}var ev=fe.create({name:"slashCommands",addProseMirrorPlugins(){return[hu({editor:this.editor,pluginKey:new te("slashSuggestion"),char:"/",startOfLine:!1,allowSpaces:!1,allow:({state:t,range:e})=>{let n=t.doc.resolve(e.from),r=n.parent.textBetween(0,n.parentOffset,void 0," ");return/(^|\s)\/?$/.test(r)&&n.parent.type.name==="paragraph"},items:({query:t})=>q2(t),command:({editor:t,range:e,props:n})=>n.run({editor:t,range:e}),render:Tm})]}});function V2(t){return[{title:"@agent — ask the agent",keys:"agent ai ask comment",run:({editor:e,range:n})=>{e.chain().focus().deleteRange(n).run(),setTimeout(()=>t&&t(),0)}}]}function W2(t,e){let n=(e||"").toLowerCase().trim();return n?t.filter(r=>(r.title+" "+r.keys).toLowerCase().includes(n)):t}function tv({onComment:t}={}){let e=V2(t);return fe.create({name:"atMention",addProseMirrorPlugins(){return[hu({editor:this.editor,pluginKey:new te("atSuggestion"),char:"@",startOfLine:!1,allowSpaces:!1,allow:({state:n,range:r})=>{let i=n.doc.resolve(r.from);if(i.parent.type.spec.code)return!1;let o=i.parent.textBetween(0,i.parentOffset,void 0," ");return/(^|\s)@?$/.test(o)},items:({query:n})=>W2(e,n),command:({editor:n,range:r,props:i})=>i.run({editor:n,range:r}),render:Tm})]}})}var U2=new te("sonorance-md-paste"),K2=/^\s{0,3}(#{1,6}\s|[-*+]\s|\d+[.)]\s|>\s|```|~~~|\||-{3,}\s*$|\*{3,}\s*$|_{3,}\s*$)/;function nv(){return new Y({key:U2,props:{handlePaste(t,e){let n=e.clipboardData;if(!n)return!1;let r=n.getData("text/plain");if(!r||!r.trim())return!1;let i=n.getData("text/html");if(i&&i.trim())return!1;let{$from:o}=t.state.selection;if(o.parent.type.spec.code||!/\r?\n/.test(r.trim())&&!K2.test(r))return!1;let l;try{({doc:l}=Js(r))}catch{return!1}if(!(l&&l.content||[]).length)return!1;let c;try{c=t.state.schema.nodeFromJSON(l)}catch{return!1}let u=c.slice(0);return t.dispatch(t.state.tr.replaceSelection(u).scrollIntoView()),!0}}})}function J2(t){return String(t).toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||"section"}function G2(t){let e="";return t.descendants?.(n=>{n.isText&&(e+=n.text)}),e}function rv(t){let{doc:e}=Js(t||"");return(e&&e.content||[]).map(r=>iu({type:"doc",content:[r]},"").trimEnd())}function X2({placeholder:t}={}){let e=[U0.configure({link:!1}),uc.configure({openOnClick:!1,autolink:!0}),Ls,Is.configure({nested:!0}),Cw.configure({table:{resizable:!0}}),ev];return t&&e.push(wc.configure({includeChildren:!1,showOnlyCurrent:!0,placeholder:({editor:n,node:r})=>n.isEmpty?t:r.type.name==="paragraph"?"Type “/” for blocks, “@” to ask the agent…":""})),e}function iv({element:t,editable:e=!0,placeholder:n,onChange:r,onSelectionChange:i,onCommentClick:o,onAtComment:s,onLinkClick:l,extensions:a}={}){let c="",u=fe.create({name:"sonoranceComments",addProseMirrorPlugins(){return[xS({onClick:o}),wS(),SS(),nv()]}}),f=new ok({element:t,editable:e,extensions:(a||X2({placeholder:n})).concat(u,tv({onComment:s})),content:{type:"doc",content:[{type:"paragraph"}]},editorProps:{handleClick(h,m,y){let x=y.target&&y.target.closest&&y.target.closest("a[href]");return x&&l?(l(x,y),!0):!1}},onUpdate:()=>{r?.()},onSelectionUpdate:()=>{i?.()}});return{editor:f,setMarkdown(h,{emit:m=!1}={}){let{frontmatter:y,doc:x}=Js(h||"");c=y,f.commands.setContent(x,{emitUpdate:m})},getMarkdown(){return iu(f.getJSON(),c)},frontmatter(){return c},setFrontmatter(h){c=h||""},setEditable(h){f.setEditable(!!h)},isEditable(){return f.isEditable},focus(){f.commands.focus()},hasFocus(){try{return f.view.hasFocus()}catch{return!1}},isEmpty(){return f.isEmpty},isActive(h,m){try{return f.isActive(h,m)}catch{return!1}},toggleBold(){f.chain().focus().toggleBold().run()},toggleItalic(){f.chain().focus().toggleItalic().run()},toggleHeading(h=2){f.chain().focus().toggleHeading({level:h}).run()},setLink(h){let m=(h||"").trim();m?f.chain().focus().setLink({href:m}).run():f.chain().focus().unsetLink().run()},addRow(){f.chain().focus().addRowAfter().run()},addColumn(){f.chain().focus().addColumnAfter().run()},deleteRow(){f.chain().focus().deleteRow().run()},deleteColumn(){f.chain().focus().deleteColumn().run()},deleteTable(){f.chain().focus().deleteTable().run()},setComments(h){let m=f.state.tr.setMeta(Gs,{comments:h||[]});f.view.dispatch(m)},setDiff(h){let m=f.state.tr.setMeta(Xs,h||null);f.view.dispatch(m)},blockSources(){let h=f.getJSON();return(h&&h.content||[]).map(y=>iu({type:"doc",content:[y]},"").trimEnd())},commentRange(h){return ou(f.state.doc,h)},commentRect(h){let m=ou(f.state.doc,h);if(!m)return null;try{let y=f.view.coordsAtPos(m.from);return{top:y.top,bottom:y.bottom,left:y.left}}catch{return null}},selectionAnchor(){let{from:h,to:m,empty:y}=f.state.selection;if(y||m<=h)return null;let x=f.state.doc.textBetween(h,m," ").trim();if(!x)return null;let k="";return f.state.doc.nodesBetween(0,h,(S,R)=>{S.type.name==="heading"&&R<=h&&(k=S.textContent)}),{quote:x.slice(0,2e3),heading:k.trim()}},headings(){let h=[],m=new Map;return f.state.doc.descendants(y=>{if(y.type.name!=="heading")return;let x=G2(y),k=J2(x),S=(m.get(k)||0)+1;m.set(k,S),S>1&&(k=`${k}-${S}`),h.push({level:y.attrs.level,text:x,id:k})}),h},destroy(){f.destroy()}}}(function(){"use strict";let t=(d,p=document)=>p.querySelector(d),e=d=>String(d).replace(/[&<>"]/g,p=>({"&":"&","<":"<",">":">",'"':"""})[p]),n=d=>`<svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`,r={queue:'<path d="M4 6h16M4 12h16M4 18h10"/><circle cx="19" cy="18" r="2"/>',inbox:'<path d="M4 13v5a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5"/><path d="M4 13l2.4-6.7A2 2 0 0 1 8.3 5h7.4a2 2 0 0 1 1.9 1.3L20 13"/><path d="M4 13h4l1.2 2.2a1 1 0 0 0 .9.5h3.8a1 1 0 0 0 .9-.5L16 13h4"/>',brief:'<rect x="5" y="3" width="14" height="18" rx="2"/><path d="M9 8h6M9 12h6M9 16h4"/>',readout:'<path d="M4 19V5M4 19h16"/><path d="M7 15l4-4 3 2 5-6"/><circle cx="7" cy="15" r=".8" fill="currentColor" stroke="none"/><circle cx="11" cy="11" r=".8" fill="currentColor" stroke="none"/><circle cx="14" cy="13" r=".8" fill="currentColor" stroke="none"/><circle cx="19" cy="7" r=".8" fill="currentColor" stroke="none"/>',matchup:'<rect x="3" y="4" width="7" height="16" rx="1.5"/><rect x="14" y="4" width="7" height="16" rx="1.5"/><path d="M12 3v18"/>',menu:'<path d="M4 7h16M4 12h16M4 17h16"/>',chevron:'<path d="M9 6l6 6-6 6"/>',chevrud:'<path d="M8 9l4 4 4-4"/><path d="M8 15l4-4 4 4" opacity=".45"/>',caret:'<path d="M9 6l6 6-6 6"/>',folder:'<path d="M3 7a2 2 0 0 1 2-2h3.6a2 2 0 0 1 1.4.6L11.4 7H19a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',newfolder:'<path d="M3 7a2 2 0 0 1 2-2h3.6a2 2 0 0 1 1.4.6L11.4 7H19a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="M12 11v5M9.5 13.5h5"/>',plus:'<path d="M12 5v14M5 12h14"/>',doc:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>',collapseAll:'<path d="M7 20l5-5 5 5"/><path d="M7 4l5 5 5-5"/>',expandAll:'<path d="M7 15l5 5 5-5"/><path d="M7 9l5-5 5 5"/>',x:'<path d="M6 6l12 12M18 6L6 18"/>',search:'<circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3"/>',vault:'<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 9h18"/>',check:'<path d="M20 6L9 17l-5-5"/>',external:'<path d="M14 4h6v6"/><path d="M20 4l-8.5 8.5"/><path d="M18 13.5V18a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4.5"/>',sun:'<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5L19 19M19 5l-1.5 1.5M6.5 17.5L5 19"/>',moon:'<path d="M20 14.5A8 8 0 1 1 9.5 4 6.2 6.2 0 0 0 20 14.5z"/>',auto:'<circle cx="12" cy="12" r="8"/><path d="M12 4a8 8 0 0 0 0 16z" fill="currentColor" stroke="none"/>',settings:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .34 1.88l.06.06-2.83 2.83-.06-.06a1.7 1.7 0 0 0-1.88-.34 1.7 1.7 0 0 0-1.03 1.56V21h-4v-.08A1.7 1.7 0 0 0 9 19.37a1.7 1.7 0 0 0-1.88.34l-.06.06-2.83-2.83.06-.06A1.7 1.7 0 0 0 4.63 15 1.7 1.7 0 0 0 3.08 14H3v-4h.08A1.7 1.7 0 0 0 4.63 9a1.7 1.7 0 0 0-.34-1.88l-.06-.06 2.83-2.83.06.06A1.7 1.7 0 0 0 9 4.63 1.7 1.7 0 0 0 10 3.08V3h4v.08A1.7 1.7 0 0 0 15 4.63a1.7 1.7 0 0 0 1.88-.34l.06-.06 2.83 2.83-.06.06A1.7 1.7 0 0 0 19.37 9 1.7 1.7 0 0 0 20.92 10H21v4h-.08A1.7 1.7 0 0 0 19.4 15z"/>',comment:'<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>',feedback:'<path d="M3 11v2a2 2 0 0 0 2 2h2l3 5h3l-2.5-5H12l8 3V6l-8 3H5a2 2 0 0 0-2 2z"/><path d="M7 9v6M20 10l2-1M20 14l2 1"/>',thumbUp:'<path d="M7 10v11H3V10zM7 19h9.2a2 2 0 0 0 2-1.6l1.4-7A2 2 0 0 0 17.6 8H14l.5-3.1A2.4 2.4 0 0 0 12.1 2L7 10z"/>',thumbDown:'<path d="M7 14V3H3v11zM7 5h9.2a2 2 0 0 1 2 1.6l1.4 7a2 2 0 0 1-2 2.4H14l.5 3.1a2.4 2.4 0 0 1-2.4 2.9L7 14z"/>',rocket:'<path d="M14 4c2.8-2.8 5.5-2 6-1.5s1.3 3.2-1.5 6L13 14l-3-3z"/><path d="M14 4l6 6M10 11l-4 .5-3 3 5 1.5 1.5 5 3-3 .5-4"/><path d="M5 19l-2 2M7 17l-4 4"/>',mic:'<path d="M12 2a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/><path d="M19 10v1a7 7 0 0 1-14 0v-1"/><path d="M12 18v4M8 22h8"/>',send:'<path d="M22 2L11 13"/><path d="M22 2l-7 20-4-9-9-4 20-7z"/>',more:'<circle cx="5" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.4" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1.4" fill="currentColor" stroke="none"/>',trash:'<path d="M4 7h16"/><path d="M10 11v6M14 11v6"/><path d="M6 7l1 13a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-13"/><path d="M9 7V4h6v3"/>',proto:'<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 9h18"/><path d="M6.5 6.5h.01M9 6.5h.01"/>',copy:'<rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a2 2 0 0 1 2-2h8"/>',pencil:'<path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"/>',gitbranch:'<circle cx="6" cy="6" r="2.4"/><circle cx="6" cy="18" r="2.4"/><circle cx="18" cy="8" r="2.4"/><path d="M6 8.4v7.2"/><path d="M18 10.4a6 6 0 0 1-6 6H8"/>',gitfile:'<path d="M13.5 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8.5z"/><path d="M13.5 3v5h5"/><circle cx="9.4" cy="13.6" r="1.15"/><circle cx="9.4" cy="18" r="1.15"/><circle cx="14" cy="14.9" r="1.15"/><path d="M9.4 14.75v2.1"/><path d="M14 16.05a1.9 1.9 0 0 1-1.9 1.9H9.4"/>',newfile:'<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4"/><path d="M14 3v5h5"/><path d="M17 14v6M14 17h6"/>',revert:'<path d="M9 14L4 9l5-5"/><path d="M4 9h11a5 5 0 0 1 5 5v1"/>',bold:'<path d="M7 5h6a3.4 3.4 0 0 1 0 6.8H7z"/><path d="M7 11.8h7a3.6 3.6 0 0 1 0 7.2H7z"/>',italic:'<path d="M19 4h-7M14 20H5M15 4l-6 16"/>',link:'<path d="M10 13a5 5 0 0 0 7 0l2-2a5 5 0 0 0-7-7l-1 1"/><path d="M14 11a5 5 0 0 0-7 0l-2 2a5 5 0 0 0 7 7l1-1"/>',heading:'<path d="M6 4v16M18 4v16M6 12h12"/>'},i={bold:()=>/\*\*([^*\n]+)\*\*/g,emStar:()=>/(^|[^*\w])\*([^*\n]+)\*(?!\w)/g,emUnd:()=>/(^|[^\w])_([^_\n]+)_(?![\w])/g};function o(d){return/^(https?:|mailto:|\/|\.\/|#)/i.test(d)?d:"#"}function s(){return g.file&&g.file.path||g.recFile||""}function l(d){let p=String(d||"").trim();if(!p)return"";if(/^(https?:|data:|blob:)/i.test(p))return p;let b=s().split("/").slice(0,-1),w=p.startsWith("/")?p.replace(/^\/+/,"").split("/"):b.concat(p.split("/")),v=[];for(let C of w)C===".."?v.pop():C&&C!=="."&&v.push(C);return v.length?"/api/asset?path="+encodeURIComponent(v.join("/"))+(hl()?"&project="+encodeURIComponent(g.projectSlug||g.project.id):""):""}function a(d){let p=e(d),b=[];return p=p.replace(/`([^`]+)`/g,(w,v)=>(b.push(v),"\0"+(b.length-1)+"\0")),p=p.replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^&]*")?\)/g,(w,v,C)=>{let E=l(C);return E?`<img class="md-img" src="${e(E)}" alt="${v}" loading="lazy">`:v}),p=p.replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+"[^&]*")?\)/g,(w,v,C)=>`<a href="${o(C)}" target="_blank" rel="noopener noreferrer">${v}</a>`),p=p.replace(i.bold(),"<strong>$1</strong>"),p=p.replace(i.emStar(),"$1<em>$2</em>"),p=p.replace(i.emUnd(),"$1<em>$2</em>"),p=p.replace(/\u0000(\d+)\u0000/g,(w,v)=>`<code>${b[+v]}</code>`),p}function c(d){return d.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(p=>p.trim())}function u(d){let p=c(d[0]),b='<table class="md-tbl"><thead><tr>'+p.map(w=>`<th>${a(w)}</th>`).join("")+"</tr></thead><tbody>";for(let w of d.slice(2)){let v=c(w);b+="<tr>"+p.map((C,E)=>`<td>${a(v[E]??"")}</td>`).join("")+"</tr>"}return'<div class="md-tblwrap">'+b+"</tbody></table></div>"}function f(d){let p=[];for(let E of d){let O=E.match(/^(\s*)([-*+]|\d+\.)\s+(.*)$/);O?p.push({indent:O[1].length,ordered:/\d+\./.test(O[2]),text:O[3]}):p.length&&(p[p.length-1].text+=" "+E.trim())}if(!p.length)return"";let b=Math.min(...p.map(E=>E.indent)),w=p[0].ordered,v=`<${w?"ol":"ul"} class="md-list">`,C=0;for(;C<p.length;){let E=p[C];if(E.indent<=b){let O=C+1,L=[];for(;O<p.length&&p[O].indent>b;)L.push(p[O]),O++;if(v+=m(E.text),L.length){let D=L[0].ordered;v+=`<${D?"ol":"ul"} class="md-list">`+L.map(W=>m(W.text)+"</li>").join("")+`</${D?"ol":"ul"}>`}v+="</li>",C=O}else C++}return v+`</${w?"ol":"ul"}>`}let h=/^\[([ xX])\]\s+(.*)$/s;function m(d){let p=String(d).match(h);return p?`<li class="md-task"><input type="checkbox" class="md-taskbox" contenteditable="false"${p[1].toLowerCase()==="x"?" checked":""} aria-label="Toggle task"><span class="md-tasktxt">${a(p[2])}</span>`:`<li>${a(d)}`}function y(d){let p=String(d||"").replace(/<!--[\s\S]*?-->/g,"").replace(/\r\n?/g,`
|
|
1569
|
+
`).split(`
|
|
1570
|
+
`),b=E=>/^\s*$/.test(E),w=E=>/^\s*(#{1,6}\s|>|```|[-*+]\s|\d+\.\s)/.test(E)||/^\s*(-{3,}|\*{3,}|_{3,})\s*$/.test(E),v="",C=0;for(;C<p.length;){let E=p[C];if(b(E)){C++;continue}if(/^\s*```/.test(E)){C++;let D=[];for(;C<p.length&&!/^\s*```/.test(p[C]);)D.push(p[C]),C++;C++,v+=`<pre class="md-pre"><code>${e(D.join(`
|
|
1571
|
+
`))}</code></pre>`;continue}let O=E.match(/^\s*(#{1,6})\s+(.*)$/);if(O){let D=O[1].length;v+=`<h${D} class="md-h md-h${D}">${a(O[2].trim())}</h${D}>`,C++;continue}if(/^\s*(-{3,}|\*{3,}|_{3,})\s*$/.test(E)){v+='<hr class="md-hr">',C++;continue}if(/^\s*>\s?/.test(E)){let D=[];for(;C<p.length&&/^\s*>\s?/.test(p[C]);)D.push(p[C].replace(/^\s*>\s?/,"")),C++;v+=`<blockquote class="md-bq">${y(D.join(`
|
|
1572
|
+
`))}</blockquote>`;continue}if(E.includes("|")&&C+1<p.length&&p[C+1].includes("-")&&/^\s*\|?[\s:|-]+\|?\s*$/.test(p[C+1])){let D=[];for(;C<p.length&&p[C].includes("|")&&!b(p[C]);)D.push(p[C]),C++;v+=u(D);continue}if(/^\s*([-*+]|\d+\.)\s+/.test(E)){let D=[];for(;C<p.length&&(/^\s*([-*+]|\d+\.)\s+/.test(p[C])||/^\s{2,}\S/.test(p[C]));)D.push(p[C]),C++;v+=f(D);continue}let L=[];for(;C<p.length&&!b(p[C])&&!w(p[C]);)L.push(p[C]),C++;L.length||(L.push(E),C++),v+=`<p class="md-p">${a(L.join(`
|
|
1573
|
+
`)).replace(/\n/g,"<br>")}</p>`}return v}function x(d){let p=String(d).split(`
|
|
1574
|
+
`),b=[],w=null,v=!1,C=(O,L,D)=>{(D||!w||w.kind!==O)&&(w={kind:O,lines:[]},b.push(w)),w.lines.push(L)},E=0;if(/^---\s*$/.test(p[0]||"")){let O=-1;for(let L=1;L<p.length;L++)if(/^---\s*$/.test(p[L])){O=L;break}O>0&&(b.push({kind:"block",lines:p.slice(0,O+1)}),E=O+1)}for(let O=E;O<p.length;O++){let L=p[O],D=/^\s*```/.test(L);if(v){C("block",L),D&&(v=!1);continue}if(D){C("block",L),v=!0;continue}if(/^\s*$/.test(L)){C("gap",L);continue}if(/^\s*#{1,6}\s/.test(L)){C("block",L,!0),w=null;continue}C("block",L)}return b}let k=d=>d.flatMap(p=>p.lines).join(`
|
|
1575
|
+
`);function S(d){if(d==null)return{cls:"neutral",label:"—",word:"Not yet scored"};let p=Number(d).toFixed(1);return d>=7?{cls:"advance",label:p,word:"Advance"}:d>=5?{cls:"shelve",label:p,word:"Shelve"}:{cls:"reject",label:p,word:"Reject"}}function R(){return!!(g.rec&&g.rec.exists&&/^#{2,4}\s+.*(why this score|score|verdict)\b/im.test(g.rec.text))}function M(){let d=t("#doc");if(!d)return null;let p=[...d.querySelectorAll("h2,h3,h4")];return p.find(b=>/why this score/i.test(b.textContent))||p.find(b=>/^\s*score\s*$/i.test(b.textContent))||p.find(b=>/score|score|verdict/i.test(b.textContent))||null}function N(){let d=M();d&&d.scrollIntoView({behavior:yi()?"auto":"smooth",block:"start"})}let z=d=>{if(!d)return"";let p=Math.floor((Date.now()-d)/1e3);if(p<60)return"just now";let b=Math.floor(p/60);if(b<60)return b+"m ago";let w=Math.floor(b/60);if(w<24)return w+"h ago";let v=Math.floor(w/24);return v<7?v+"d ago":new Date(d).toLocaleDateString()};async function T(d,p,b){let w={method:d,headers:{"content-type":"application/json"}};b&&(w.body=JSON.stringify(b));let v=p,C=g.projectSlug||g.project&&g.project.id;C&&p.startsWith("/api/")&&(v+=(p.includes("?")?"&":"?")+"project="+encodeURIComponent(C));let E;try{E=await fetch(v,w)}catch{return{error:"offline",netError:!0}}let O=typeof E.status=="number"?E.status:200;if(!(E.headers&&E.headers.get?E.headers.get("content-type")||"":"application/json").includes("json"))return{error:O===404?"endpoint-missing":"http-"+O,httpStatus:O};let D;try{D=await E.json()}catch{return{error:"bad-response",httpStatus:O}}return D&&typeof D=="object"&&!("error"in D)&&E.ok===!1&&(D.error="http-"+O),D}let P="Sonorance",$="sonorance serve",j="/sonorance address",g={project:null,projectSlug:null,projects:[],cases:[],briefs:[],readouts:[],matchups:[],inventory:null,kinds:[],tree:[],treeBase:"",explorer:{mode:"collapsed",ex:new Set},isGit:!1,query:"",tabs:[],activeTab:-1,feedbackDraft:null,caseId:null,rec:null,proto:null,items:[],mode:"read",brief:null,readout:null,matchup:null,file:null,comments:[],es:null,cNavIdx:-1,recFile:null,dirty:!1,saving:!1,saveTimer:null,cfgPending:{},cfgTimer:null,diffMode:!1,diffBase:null,git:{branch:"",changed:[]}};function oe(){return g.diffMode&&g.isGit?new Set((g.git.changed||[]).filter(d=>/\.md$/i.test(d.path)).map(d=>d.path)):null}async function G(){try{let d=await T("GET","/api/comments-summary");d&&!d.error&&d.counts&&(g.commentCounts=d.counts,ge.gauge("project_open_comments",K()))}catch{}}function V(d){return g.commentCounts&&g.commentCounts[d]||0}function J(d){if(!d||!g.commentCounts)return 0;let p=d+"/",b=0;for(let[w,v]of Object.entries(g.commentCounts))w.startsWith(p)&&(b+=v);return b}let K=()=>Object.values(g.commentCounts||{}).reduce((d,p)=>d+p,0);function se(){return g.commentFilter?new Set(Object.keys(g.commentCounts||{}).filter(d=>g.commentCounts[d]>0)):null}function he(d){let p=V(d);if(!p)return"";let b=`${p} open comment${p>1?"s":""}`;return`<span class="cmtb" title="${b}" aria-label="${b}">${n(r.comment)}${p>1?p:""}</span>`}function Ee(d){let p=J(d);if(!p)return"";let b=`${p} open comment${p>1?"s":""} in this folder`;return`<span class="cmtb dot" title="${b}" aria-label="${b}"></span>`}function Ae(d){let p=(g.git.changed||[]).find(b=>b.path===d);return p?p.status:""}function A(){return(g.git.changed||[]).filter(d=>/\.md$/i.test(d.path)).length}function Qe(d){let p=Ae(d);if(!p)return"";let b=p.includes("A")||p.includes("?"),w=p.includes("D"),v=b?"add":w?"del":"mod",C=b?"A":w?"D":"M",E=b?"Added — a new file not yet committed":w?"Deleted — removed since the last commit":"Modified — uncommitted changes since the last commit";return`<span class="gitb ${v}" role="img" title="${E}" aria-label="${E}">${C}</span>`}function Ze(d){let p=Ae(d);return p?p.includes("D")?"gs-del":p.includes("A")||p.includes("?")?"gs-add":"gs-mod":""}function I(d){if(!g.isGit||!d)return null;let p=d+"/",b=(g.git.changed||[]).filter(D=>/\.md$/i.test(D.path)&&D.path.startsWith(p));if(!b.length)return null;let w=!1,v=!1,C=!1;for(let D of b)D.status.includes("D")?v=!0:D.status.includes("A")||D.status.includes("?")?w=!0:C=!0;let E=b.length,[O,L]=C||w&&v?["mod","with uncommitted changes"]:w?["add","added and not yet committed"]:["del","deleted"];return{cls:O,tip:`${E} document${E>1?"s":""} ${L} in this folder`}}function Fe(){let d=t("#menu");d&&d.remove(),document.removeEventListener("mousedown",Jt,!0)}function Jt(d){d.target.closest("#menu")||Fe()}function Kn(d,p,b,w){Fe();let v=document.createElement("div");v.className="menu",v.id="menu";let C=(W,ie)=>{let Ie=`<button data-mi="${ie}" ${W.on?'class="on"':""}>${W.icon?n(r[W.icon]):""}<span>${e(W.label)}</span></button>`;if(!W.trail)return Ie;let Lt=W.trail;return`<div class="menu-row">${Ie}<button class="menu-trail${Lt.danger?" danger":""}" data-mt="${ie}" title="${e(Lt.label)}" aria-label="${e(Lt.label)}">${n(r[Lt.icon])}</button></div>`};v.innerHTML=b.map((W,ie)=>W.sep?'<div class="sep"></div>':C(W,ie)).join(""),w&&w.minWidth&&(v.style.minWidth=Math.round(w.minWidth)+"px"),document.body.appendChild(v);let E=v.offsetWidth||190,O=v.offsetHeight||40,L=window.innerWidth,D=window.innerHeight;v.style.left=Math.min(d,L-E-8)+"px",v.style.top=Math.min(p,D-O-8)+"px",v.querySelectorAll("[data-mt]").forEach(W=>W.addEventListener("click",ie=>{ie.stopPropagation();let Ie=b[+W.dataset.mt];Fe(),Ie.trail.act&&Ie.trail.act()})),v.querySelectorAll("[data-mi]").forEach(W=>W.addEventListener("click",()=>{let ie=b[+W.dataset.mi];Fe(),ie.act&&ie.act()})),setTimeout(()=>document.addEventListener("mousedown",Jt,!0),0)}function fi(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function Le(){try{return localStorage.getItem("dlb-theme")||""}catch{return""}}function nn(d){let p=document.documentElement;d?p.setAttribute("data-theme",d):p.removeAttribute("data-theme");try{localStorage.setItem("dlb-theme",d)}catch{}let b=d==="dark"||!d&&fi(),w=t("meta[name=theme-color]");w&&w.setAttribute("content",b?"#0a0e14":"#e6ecf1"),pu()}function Me(){let d=t("#sidebar");if(!d)return;d.innerHTML=`
|
|
1576
|
+
<div class="sb-head">
|
|
1577
|
+
<button class="projsel" data-projsel aria-haspopup="menu" title="${g.project?"Switch project · "+e(g.project.name):"Switch project"}">
|
|
1578
|
+
<span class="pname">${g.project?e(g.project.name):"No project"}</span>
|
|
1579
|
+
${g.isGit&&g.git.branch?`<span class="pbranch" title="Current branch">${n(r.gitbranch)}<span class="pbn">${e(g.git.branch)}</span></span>`:""}
|
|
1580
|
+
${n(r.chevrud).replace('class="ico"','class="ico cv"')}
|
|
1581
|
+
</button>
|
|
1582
|
+
</div>
|
|
1583
|
+
<div class="search">
|
|
1584
|
+
${n(r.search)}
|
|
1585
|
+
<input type="search" id="casesearch" placeholder="Search…" autocomplete="off" spellcheck="false" value="${e(g.query)}" aria-label="Search records">
|
|
1586
|
+
<button class="clr ${g.query?"show":""}" id="searchclr" aria-label="Clear search">${n(r.x)}</button>
|
|
1587
|
+
</div>
|
|
1588
|
+
<div class="expbar">
|
|
1589
|
+
<span class="exptitle">${g.diffMode?"Changes":"Explorer"}</span>
|
|
1590
|
+
<button class="expact" data-newmenu title="New file or folder" aria-label="New file or folder">${n(r.plus)}</button>
|
|
1591
|
+
${g.isGit?`<button class="expact difftoggle ${g.diffMode?"on":""}" data-diffmode aria-pressed="${g.diffMode}" title="${g.diffMode?"Show all files":"Show only files with uncommitted changes"}" aria-label="${g.diffMode?"Show all files":"Show only changed files"}">${n(r.gitbranch)}${g.diffMode&&A()?`<span class="cbadge">${A()}</span>`:""}</button>`:""}
|
|
1592
|
+
<button class="expact cmttoggle ${g.commentFilter?"on":""}" data-cfilter aria-pressed="${!!g.commentFilter}" title="${g.commentFilter?"Show all files":"Show only files with open comments"}" aria-label="${g.commentFilter?"Show all files":"Show only files with comments"}">${n(r.comment)}${!g.commentFilter&&K()?`<span class="cbadge amber">${K()}</span>`:""}</button>
|
|
1593
|
+
<button class="collapseall" data-collapseall title="${We()?"Expand all folders":"Collapse all folders"}" aria-label="${We()?"Expand all folders":"Collapse all folders"}">${n(We()?r.expandAll:r.collapseAll)}</button>
|
|
1594
|
+
</div>
|
|
1595
|
+
<div class="caselist explorerlist" id="explorerlist"></div>`,St(),d.querySelector("[data-projsel]").addEventListener("click",$m);let p=d.querySelector("#casesearch");p.addEventListener("input",()=>{let b=!g.query;g.query=p.value,b&&g.query&&(ge.count("searches",1),ge.event("ui.action",{area:"explorer",action:"search-open"})),d.querySelector("#searchclr").classList.toggle("show",!!g.query),St()}),d.querySelector("#searchclr").addEventListener("click",()=>{g.query="",d.querySelector("#searchclr").classList.remove("show");let b=d.querySelector("#casesearch");b.value="",b.focus(),St()}),d.querySelector("[data-collapseall]")?.addEventListener("click",()=>{ge.event("ui.action",{area:"explorer",action:We()?"expand-all":"collapse-all"}),Jn()}),d.querySelector("[data-newmenu]")?.addEventListener("click",b=>{let w=b.currentTarget.getBoundingClientRect();Lg(g.treeBase||"",w.left,w.bottom+4)}),d.querySelector("[data-diffmode]")?.addEventListener("click",()=>{ge.event("ui.action",{area:"explorer",action:"diff"}),so(!g.diffMode)}),d.querySelector("[data-cfilter]")?.addEventListener("click",()=>{ge.event("ui.action",{area:"explorer",action:"comments"}),ol(!g.commentFilter)}),oo()}function rn(d=g.tree){let p=0,b=0;for(let w of d||[])if(w.type==="dir"){b++;let v=rn(w.children||[]);p+=v.files,b+=v.folders}else w.type==="file"&&p++;return{files:p,folders:b}}function Sn(){let d=rn();ge.gauge("open_tabs",g.tabs.length),ge.gauge("explorer_files",d.files),ge.gauge("explorer_folders",d.folders),ge.gauge("project_cases",g.inventory?.cases??g.cases.length),ge.gauge("project_briefs",g.inventory?.briefs??g.briefs.length),ge.gauge("project_readouts",g.inventory?.readouts??g.readouts.length),ge.gauge("project_matchups",g.inventory?.matchups??g.matchups.length),ge.gauge("project_open_comments",K())}function oo(){let d=t("#inboxbtn");d&&d.classList.toggle("active",vt().name==="inbox");let p=t("#feedbackbtn");p&&p.classList.toggle("active",vt().name==="feedback");let b=t("#settingsbtn");b&&b.classList.toggle("active",vt().name==="settings")}function pu(){let d=Le();document.querySelectorAll("[data-theme-value]").forEach(p=>{let b=p.dataset.themeValue===d;p.classList.toggle("selected",b),p.setAttribute("aria-checked",String(b))})}async function on(){if(!g.isGit){g.git={branch:"",changed:[]},Mo();return}let d;try{d=await T("GET","/api/git")}catch{return}!d||d.error||(g.git={branch:d.branch||"",changed:Array.isArray(d.changed)?d.changed:[]},Mo())}async function so(d){let p=!!d&&g.isGit;p!==g.diffMode&&(g.diffMode=p,p&&(g.query="",g.commentFilter=!1,await on()),Me())}async function ol(d){let p=!!d;p!==!!g.commentFilter&&(g.commentFilter=p,p&&(g.query="",g.diffMode=!1,await G()),Me())}let lo=null,di=null,hi=!1;async function vn(){if(!(!g.project||hi)){hi=!0;try{let d;try{d=await T("GET","/api/tree")}catch{return}if(!d||d.error)return;let p=d.tree||[],b=JSON.stringify(g.inventory);d.inventory&&(g.inventory=d.inventory);let w=JSON.stringify(g.git.changed||[]);g.isGit&&await on();let v=JSON.stringify(p)!==JSON.stringify(g.tree),C=JSON.stringify(g.inventory)!==b,E=JSON.stringify(g.git.changed||[])!==w;if(typeof d.base=="string"&&(g.treeBase=d.base),!v&&!E&&!C)return;g.tree=p,Sn();let O=document.activeElement&&document.activeElement.id==="casesearch",L=t("#explorerlist")?.scrollTop||0;O?St():Me();let D=t("#explorerlist");D&&(D.scrollTop=L)}finally{hi=!1}}}function mu(){lo||(lo=setTimeout(()=>{lo=null,vn()},150))}let pi=null;function gu(){pi||!g.isGit||!(g.file||g.caseId||g.brief||g.readout||g.matchup)||(pi=setTimeout(()=>{pi=null,on().then(()=>{g.diffMode&&Me()})},250),pi.unref?.())}function yu(){di||(di=setInterval(()=>{document.visibilityState!=="hidden"&&(vn(),nf())},4e3),di.unref?.())}function B(d,p){g.cfgPending[d]=p}async function H(){if(!Object.keys(g.cfgPending).length)return;let d=g.cfgPending;g.cfgPending={};try{await T("POST","/api/config",{patch:d})}catch{for(let p in d)p in g.cfgPending||(g.cfgPending[p]=d[p])}}function le(){g.cfgTimer||(g.cfgTimer=setInterval(()=>{H()},1500),g.cfgTimer.unref?.())}function de(){B("explorer",{mode:g.explorer.mode,ex:[...g.explorer.ex]})}function ke(d){return g.explorer.mode==="expanded"?!g.explorer.ex.has(d):g.explorer.ex.has(d)}function We(){return g.explorer.mode==="collapsed"&&g.explorer.ex.size===0}function sn(){g.explorer={mode:"collapsed",ex:new Set},de(),Me()}function zt(){g.explorer={mode:"expanded",ex:new Set},de(),Me()}function Jn(){We()?zt():sn()}let Gn=!1;function mt(d,p){p?(d.classList.toggle("intro",!Gn),Gn=!0):d.classList.remove("intro")}function St(){let d=t("#explorerlist");d&&Rm(d)}function Gt(){if(!(g.diffMode&&g.isGit))return g.tree;let d=new Set;(function w(v){for(let C of v||[])C.type==="dir"?w(C.children):d.add(C.path)})(g.tree);let p=(g.git.changed||[]).filter(w=>/\.md$/i.test(w.path)&&w.status.includes("D")&&!d.has(w.path)).map(w=>w.path);if(!p.length)return g.tree;let b=Mm(g.tree);for(let w of p)ov(b,w);return Am(b),b}function Mm(d){return(d||[]).map(p=>p.type==="dir"?{...p,children:Mm(p.children)}:{...p})}function ov(d,p){let b=p.split("/"),w=b.pop(),v=d,C="";for(let E of b){C=C?`${C}/${E}`:E;let O=v.find(L=>L.type==="dir"&&L.name===E);O||(O={name:E,path:C,type:"dir",children:[]},v.push(O)),O.children||(O.children=[]),v=O.children}v.some(E=>E.type==="file"&&E.path===p)||v.push({name:w,path:p,type:"file",kind:"file",id:null,deleted:!0})}function Am(d){d.sort((p,b)=>p.type===b.type?p.name.localeCompare(b.name):p.type==="dir"?-1:1);for(let p of d)p.type==="dir"&&Am(p.children||[])}function Rm(d){let p=g.query.trim().toLowerCase(),b=oe(),w=se(),v=Gt(),C=d.scrollTop,O=p||b||w?Su(v,D=>(!b||b.has(D.path))&&(!w||w.has(D.path))&&(!p||Fm(D,p))):v;if(!O.length){d.classList.remove("intro");let D=w?"No files with open comments.":b?"No files with uncommitted changes.":p?"No files match.":"No markdown files yet.";d.innerHTML=`<div style="padding:8px 12px;color:var(--ink-faint);font-size:13px">${D}</div>`;return}let L=[];Nm(O,0,!!(p||b||w),L),d.innerHTML='<div class="tree" role="tree">'+L.join("")+"</div>",d.scrollTop=C,mt(d,!0),d.querySelectorAll("[data-dir]").forEach(D=>D.addEventListener("click",W=>{W.preventDefault(),zm(D.dataset.dir)})),cv(d),lv(d),al(d)}let yr=null;function bu(d){if(!d||!d.closest)return"";let p=d.closest(".trow.dir");if(p)return p.dataset.dir;let b=d.closest('.trow[data-open="file"]');if(b){let w=b.dataset.path||b.dataset.key||"",v=w.lastIndexOf("/");return v>=0?w.slice(0,v):""}return""}function xu(d,p){if(!d||p==null)return!1;let b=d.path.includes("/")?d.path.slice(0,d.path.lastIndexOf("/")):"";return!(p===b||d.isDir&&(p===d.path||p.startsWith(d.path+"/")))}function sl(){let d=t("#explorerlist");d&&(d.classList.remove("droproot"),d.querySelectorAll(".trow.droptarget").forEach(p=>p.classList.remove("droptarget")))}function sv(d){let p=t("#explorerlist");p&&(p.classList.toggle("droproot",d===""),p.querySelectorAll(".trow.dir").forEach(b=>b.classList.toggle("droptarget",d!==""&&b.dataset.dir===d)))}function lv(d){d.querySelectorAll('.trow[draggable="true"]').forEach(p=>{let b=p.classList.contains("dir"),w=b?p.dataset.dir:p.dataset.path;w!=null&&(p.addEventListener("dragstart",v=>{yr={path:w,isDir:b};try{v.dataTransfer.effectAllowed="move",v.dataTransfer.setData("text/plain",w)}catch{}p.classList.add("dragging")}),p.addEventListener("dragend",()=>{yr=null,sl(),d.querySelectorAll(".dragging").forEach(v=>v.classList.remove("dragging"))}))}),d.addEventListener("dragover",p=>{if(!yr)return;let b=bu(p.target);if(!xu(yr,b)){sl();return}p.preventDefault();try{p.dataTransfer.dropEffect="move"}catch{}sv(b)}),d.addEventListener("dragleave",p=>{p.target===d&&sl()}),d.addEventListener("drop",p=>{if(!yr)return;let b=bu(p.target),w=yr;yr=null,sl(),xu(w,b)&&(p.preventDefault(),Im(w.path,b))})}async function Im(d,p){let b=await T("POST","/api/move",{src:d,dest:p});if(!b||b.error){je(b&&b.error==="into-self"?"Can't move a folder into itself.":b&&b.error==="exists"?"Something with that name already exists there.":b&&b.error==="endpoint-missing"?`Editor is out of date — restart ${$}.`:"Could not move.");return}ge.event("ui.action",{area:"explorer",action:"move"}),Lm(b.from||d,b.path),p&&ll(p),await vn()}async function ku(d,p){if(!d)return;let b=ao(d),w=b.lastIndexOf("."),v=!p&&w>0?w:b.length,C=await Yu({title:p?"Rename folder":"Rename file",label:p?"Folder name":"File name",value:b,selectEnd:v,confirmLabel:"Rename"});if(C==null||C===b)return;let E=await T("POST","/api/rename",{path:d,name:C});if(!E||E.error){je(E&&E.error==="exists"?"Something with that name already exists here.":E&&E.error==="bad name"?"That name isn’t allowed.":E&&E.error==="endpoint-missing"?`Editor is out of date — restart ${$}.`:"Could not rename.");return}ge.event("ui.action",{area:"explorer",action:"rename"}),Lm(E.from||d,E.path),p&&ll(E.path),await vn()}function Lm(d,p){let b=C=>C===d?p:C.startsWith(d+"/")?p+C.slice(d.length):null,w=!1;for(let C of g.tabs){if(C.kind!=="file")continue;let E=b(C.id);E!=null&&(C.id=E,w=!0)}if(g.file&&g.file.path){let C=b(g.file.path);C!=null&&(g.file.path=C,g.recFile=C)}if(!w)return;Xt(),co();let v=g.tabs[g.activeTab];if(v&&v.kind==="file")try{history.replaceState({},"",hl()+ul(v))}catch{}}function Nm(d,p,b,w){for(let v of d)if(v.type==="dir"){let C=[v.name],E=v;for(;E.children&&E.children.length===1&&E.children[0].type==="dir";)E=E.children[0],C.push(E.name);let O=b||ke(E.path),L=I(E.path);w.push(`<div class="trow dir ${O?"open":""}${L?" gs-"+L.cls:""}" role="treeitem" aria-expanded="${O}" draggable="true" data-dir="${e(E.path)}" data-full="${e(E.path)}"${L?` data-gs-tip="${e(L.tip)}"`:""} style="--depth:${p}">
|
|
1596
|
+
<span class="tw">${n(r.caret)}</span><span class="lbl">${e(C.join("/"))}</span>${Om({newfile:E.path,del:E.path,dir:!0})}<span class="gitslot">${Ee(E.path)}</span></div>`),O&&Nm(E.children||[],p+1,b,w)}else{let C=Bm(v),E=fv(v),O=v.kind==="file"?v.path:C;w.push(av(v.kind,v.kind==="file"?v.path:v.id,C,E,p,0,"",v.path,O,Qe(v.path)))}}function av(d,p,b,w,v,C,E,O,L,D){let W=hl()+(d==="file"?"/file/"+po(O||p):"/"+d+"/"+p),ie=`--depth:${v};--lead:var(--ind-caret);`,Ie=Ze(O||p),Lt=(E?`<span class="meta">${e(E)}</span>`:"")+Om({del:O||p,ntKind:d,ntKey:p})+he(O||p)+`<span class="gitslot">${D||""}</span>`,Mn=d==="file"?' draggable="true"':"";return`<a class="trow ${d} ${Ie} ${w?"active":""}" role="treeitem" style="${ie}--i:${Math.min(C||0,14)}"${Mn} data-path="${e(O||p)}"
|
|
1597
|
+
href="${W}" data-open="${d}" data-key="${e(String(p))}" data-full="${e(L||b)}"><span class="lbl">${e(b)}</span>${Lt}</a>`}function Om({newfile:d,del:p,dir:b,ntKind:w,ntKey:v}={}){let C=w!=null?`<button type="button" class="rowact" tabindex="-1" data-newtab-kind="${e(w)}" data-newtab-key="${e(String(v))}" title="Open in new tab" aria-label="Open in new tab">${n(r.external)}</button>`:"",E=d!=null?`<button type="button" class="rowact" tabindex="-1" data-newin="${e(d)}" title="New file or folder here" aria-label="New file or folder here">${n(r.plus)}</button>`:"",O=p!=null?`<button type="button" class="rowact" tabindex="-1" data-del="${e(p)}" data-isdir="${b?"1":""}" title="${b?"Delete folder":"Delete file"}" aria-label="${b?"Delete folder":"Delete file"}">${n(r.trash)}</button>`:"";return C||E||O?`<span class="rowacts">${C}${E}${O}</span>`:""}function cv(d){d.querySelectorAll("[data-open]").forEach(p=>{p.addEventListener("click",b=>{b.preventDefault(),Ml(),wu(p.dataset.open,p.dataset.key,{newTab:!1})}),p.addEventListener("contextmenu",b=>{b.preventDefault(),b.stopPropagation(),Dm(b,{kind:p.dataset.open,key:p.dataset.key,file:p.dataset.key,path:p.dataset.path})})}),uv(d)}function uv(d){d.querySelectorAll("[data-newtab-kind]").forEach(p=>{p.addEventListener("click",b=>{b.preventDefault(),b.stopPropagation(),Ml(),wu(p.dataset.newtabKind,p.dataset.newtabKey,{newTab:!0})})}),d.querySelectorAll("[data-del]").forEach(p=>{p.tagName==="BUTTON"&&p.addEventListener("click",b=>{b.preventDefault(),b.stopPropagation(),El(p.dataset.del,p.dataset.isdir==="1")})}),d.querySelectorAll("[data-newin]").forEach(p=>{p.addEventListener("click",b=>{b.preventDefault(),b.stopPropagation();let w=p.getBoundingClientRect();Lg(p.dataset.newin,w.left,w.bottom+4)})}),d.querySelectorAll(".trow.dir[data-dir]").forEach(p=>{p.addEventListener("contextmenu",b=>{b.preventDefault(),b.stopPropagation(),Dm(b,{dir:p.dataset.dir})})})}function Dm(d,{kind:p,key:b,file:w,dir:v,path:C}={}){let E=v||C||w||b,O=[{label:"Copy relative path",icon:"copy",act:()=>Pm(E,!1)},{label:"Copy full path",icon:"copy",act:()=>Pm(E,!0)}],L=v?[{label:"New file here",icon:"newfile",act:()=>Co(v)},{label:"New folder here",icon:"newfolder",act:()=>Qu(v)},{sep:!0},{label:"Rename",icon:"pencil",act:()=>ku(v,!0)},...O,{sep:!0},{label:"Delete folder",icon:"trash",act:()=>El(v,!0)}]:[{label:"Open in new tab",icon:"external",act:()=>wu(p,b,{newTab:!0})},{sep:!0},{label:"Rename",icon:"pencil",act:()=>ku(C||w||b,!1)},...O,{sep:!0},{label:"Delete file",icon:"trash",act:()=>El(C||w||b,!1)}];Kn(d.clientX,d.clientY,L)}async function Pm(d,p){let b=String(d||""),w=g.project&&g.project.dir?String(g.project.dir).replace(/[\\/]+$/,""):"",v=p&&w?w+"/"+b:b,C=!1;try{await navigator.clipboard.writeText(v),C=!0}catch{C=Uu(v)}je(C?p?"Full path copied.":"Relative path copied.":"Could not copy the path.")}function wu(d,p,b){return d==="case"?Ru(p,b):d==="brief"?Lu(p,b):d==="readout"?Nu(p,b):d==="matchup"?Ou(p,b):Du(p,b)}function zm(d){let p=!ke(d),b=g.explorer.mode==="expanded";p===b?g.explorer.ex.delete(d):g.explorer.ex.add(d),de(),St()}function ll(d){!d||ke(d)||(g.explorer.mode==="expanded"?g.explorer.ex.delete(d):g.explorer.ex.add(d),de())}function al(d){let p=d||t("#explorerlist");p&&p.querySelectorAll(".trow").forEach(b=>{let w=b.querySelector(".lbl");if(!w)return;w.scrollWidth-w.clientWidth>1?b.title=b.dataset.full||w.textContent:b.dataset.gsTip?b.title=b.dataset.gsTip:b.removeAttribute("title")})}function Bm(d){return d.name}function fv(d){let p=vt();return d.kind==="case"?p.name==="case"&&p.id===d.id:d.kind==="brief"?p.name==="brief"&&p.id===d.id:d.kind==="readout"?p.name==="readout"&&p.id===d.id:d.kind==="matchup"?p.name==="matchup"&&p.id===d.id:p.name==="file"&&p.id===d.path}function Su(d,p){let b=[];for(let w of d)if(w.type==="dir"){let v=Su(w.children||[],p);v.length&&b.push({...w,children:v})}else p(w)&&b.push(w);return b}function Fm(d,p){return`${d.path||""} ${d.h1||""} ${Bm(d)}`.toLowerCase().includes(p)}function cl(d){if(d&&d.period_start&&d.period_end){let p=(b,w)=>new Date(b).toLocaleDateString("en-US",w?{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}:{month:"short",day:"numeric",timeZone:"UTC"});return`${p(d.period_start,!1)} – ${p(d.period_end,!0)}`}return"Brief"}function vu(d){return d?cl(d).replace(/^Brief$/,"Readout"):"Readout"}function Cu(d){return d&&d.competitor?d.competitor:"Matchup"}function $m(d){let p=d.currentTarget.getBoundingClientRect(),b=g.project&&g.project.id,w=g.projects.slice();g.project&&!w.some(C=>C.id===b)&&w.unshift(g.project);let v=w.map(C=>{if(C.exists===!1)return{label:`${C.name} — missing`,icon:"trash",act:()=>Eu(C)};let E=C.id===b,O={label:C.name,icon:E?"check":null,on:E,act:()=>Hm(C.id)};return E||(O.trail={icon:"trash",danger:!0,label:`Remove ${C.name} from the vault list`,act:()=>Eu(C)}),O});v.length&&v.push({sep:!0}),v.push({label:"Open folder…",icon:"folder",act:()=>_m()}),Kn(p.left,p.bottom+4,v,{minWidth:p.width})}async function _m(){let d=g.project&&g.project.dir?g.project.dir.replace(/[/\\][^/\\]*[/\\]?$/,""):null,p=await Ig(d);if(p==null)return;let b=String(p).trim();if(!b)return;Cn(),await H(),await ge.flush();let w=await T("POST","/api/open",{dir:b});if(!w||w.error){je(w&&w.error==="not found"?"That folder no longer exists.":w&&w.error==="unsupported"?`This build can’t open other folders — restart ${$}.`:"Could not open that folder.");return}g.tabs=[],g.activeTab=-1,g.query="",await xr()}async function Eu(d){await Xu({title:"Remove vault?",body:`Remove <b>${e(d.name)}</b> from the vault list? This only forgets it here — it never deletes the folder or anything inside it, and you can add it back anytime.`,confirmLabel:"Remove"})&&(await T("POST","/api/remove",{id:d.id}),await xr())}async function Hm(d){if(!(g.project&&d===g.project.id)){Cn(),await H(),await ge.flush();try{await T("POST","/api/switch",{id:d})}catch{}g.tabs=[],g.activeTab=-1,g.query="",history.pushState({},"","/p/"+encodeURIComponent(d)+"/"),await xr()}}let ul=d=>d.kind==="inbox"?"/inbox":d.kind==="settings"?"/settings":d.kind==="feedback"?"/feedback":d.kind==="file"?"/file/"+po(d.id):(d.kind==="brief"?"/brief/":d.kind==="readout"?"/readout/":d.kind==="matchup"?"/matchup/":"/case/")+d.id,ao=d=>String(d||"").split("/").pop()||"File";function Tu(d){if(d.kind==="inbox")return"Inbox";if(d.kind==="settings")return"Settings";if(d.kind==="feedback")return"Feedback";if(d.kind==="file")return ao(d.id);if(d.kind==="brief"){let b=g.briefs.find(w=>w.id===d.id);return b?cl(b):"Brief"}if(d.kind==="readout"){let b=g.readouts.find(w=>w.id===d.id);return b?vu(b):"Readout"}if(d.kind==="matchup"){let b=g.matchups.find(w=>w.id===d.id);return b?Cu(b):"Matchup"}let p=g.cases.find(b=>b.id===d.id);return p?p.title||"Untitled":"Case"}function dv(){let d=g.tabs[g.activeTab];return d?{kind:d.kind,id:d.id||null}:null}function Xt(){ge.gauge("open_tabs",g.tabs.length),T("POST","/api/tabs",{tabs:g.tabs.map(d=>({kind:d.kind,id:d.id||null})),active:dv()}).catch(()=>{})}function co(){let d=t("#tabs");if(!d)return;let p=b=>b.kind==="inbox"?n(r.inbox):b.kind==="settings"?n(r.settings):b.kind==="feedback"?n(r.feedback):"";d.innerHTML=g.tabs.map((b,w)=>`<div class="tab ${w===g.activeTab?"active":""} ${b.kind==="brief"?"brief":""} ${b.kind==="readout"?"readout":""} ${b.kind==="matchup"?"matchup":""} ${b.kind==="file"?"file":""}" data-tab="${w}" id="tab-${w}"
|
|
1598
|
+
role="tab" aria-selected="${w===g.activeTab}" aria-controls="main" tabindex="${w===g.activeTab?0:-1}"
|
|
1599
|
+
title="${e(Tu(b))}">
|
|
1600
|
+
<span class="tab-ico">${p(b)}</span>
|
|
1601
|
+
<span class="tab-label">${e(Tu(b))}</span>
|
|
1602
|
+
<button class="tab-close" data-close="${w}" aria-label="Close ${e(Tu(b))}" title="Close" tabindex="-1">${n(r.x)}</button>
|
|
1603
|
+
</div>`).join(""),d.querySelectorAll(".tab").forEach(b=>{let w=+b.dataset.tab;b.addEventListener("mousedown",v=>{if(!v.target.closest(".tab-close")){if(v.button===1){v.preventDefault(),br(w);return}v.button===0&&dl(w)}}),b.addEventListener("contextmenu",v=>{v.preventDefault(),mv(v,w)}),b.addEventListener("keydown",v=>pv(v,w)),b.querySelector(".tab-close").addEventListener("click",v=>{v.stopPropagation(),br(w)})}),Au(),uo(),hv()}function uo(){let d=t("#tabs"),p=t("#tabscrollL"),b=t("#tabscrollR");if(!d||!p||!b)return;let w=d.scrollWidth-d.clientWidth>1;p.classList.toggle("show",w),b.classList.toggle("show",w),w&&(p.disabled=d.scrollLeft<=1,b.disabled=d.scrollLeft+d.clientWidth>=d.scrollWidth-1)}function hv(){let d=t("#tabs");if(!d||d.scrollWidth-d.clientWidth<=1)return;let p=document.getElementById("tab-"+g.activeTab);p&&typeof p.scrollIntoView=="function"&&p.scrollIntoView({inline:"nearest",block:"nearest"})}function Mu(d){let p=t("#tabs");p&&p.scrollBy({left:d*Math.max(120,p.clientWidth*.8),behavior:"smooth"})}function Au(){let d=t("#tabmark");d&&(d.textContent=P,d.classList.toggle("hide",!!document.querySelector("#main .hero")),fo())}function fo(){let d=t("#tabmark");if(!d||d.classList.contains("hide"))return;let p=t("#tabbar");if(!p)return;d.classList.remove("crowded");let b=p.getBoundingClientRect();if(!b.width)return;let w=d.getBoundingClientRect(),v=t("#tabadd"),C=t("#topactions"),E=t("#topglobal"),O=v?v.getBoundingClientRect().right:b.left,L=C&&C.getBoundingClientRect().width?C:E,D=L?L.getBoundingClientRect().left:b.right,W=24,ie=w.left-O<W||D-w.right<W;d.classList.toggle("crowded",ie)}function pv(d,p){let b=g.tabs.length;if(!b)return;let w=v=>{let C=(v%b+b)%b;dl(C),jm(C)};switch(d.key){case"ArrowRight":case"ArrowDown":d.preventDefault(),w(p+1);break;case"ArrowLeft":case"ArrowUp":d.preventDefault(),w(p-1);break;case"Home":d.preventDefault(),w(0);break;case"End":d.preventDefault(),w(b-1);break;case"Enter":case" ":d.preventDefault(),dl(p);break;case"Delete":case"Backspace":{d.preventDefault(),br(p),g.tabs.length?jm(Math.min(p,g.tabs.length-1)):t("#tabadd")?.focus();break}}}function jm(d){setTimeout(()=>{let p=t("#tab-"+d);p&&p.focus()},0)}function mv(d,p){Kn(d.clientX,d.clientY,[{label:"Close",icon:"x",act:()=>br(p)},{label:"Close others",act:()=>Vm(p)},{label:"Close all",act:()=>Wm()}])}function ho(d,p,{newTab:b=!1}={}){let w=g.tabs.findIndex(O=>O.kind===d&&O.id===p);if(w>=0)return dl(w);d==="file"?ge.count("files_opened",1):(d==="case"||d==="brief"||d==="readout"||d==="matchup")&&ge.event("record.opened",{kind:d});let v=g.tabs[g.activeTab],C=!b&&v&&!["inbox","settings","feedback"].includes(v.kind)&&!v.pinned,E={kind:d,id:p};C?g.tabs[g.activeTab]=E:(g.tabs.push(E),g.activeTab=g.tabs.length-1),Xt(),ln(gv(d,p))}function gv(d,p){return d==="inbox"?"/inbox":d==="settings"?"/settings":d==="feedback"?"/feedback":d==="file"?"/file/"+po(p):"/"+d+"/"+p}function Ru(d,p){return ho("case",d,p||{})}function fl(){g.tabs.findIndex(d=>d.kind==="inbox")<0&&(g.tabs.push({kind:"inbox"}),Xt()),ln("/inbox")}function qm(){g.tabs.findIndex(d=>d.kind==="settings")<0&&(g.tabs.push({kind:"settings"}),Xt()),ln("/settings")}function Iu(){g.tabs.findIndex(d=>d.kind==="feedback")<0&&(g.tabs.push({kind:"feedback"}),Xt()),ge.event("ui.action",{area:"toolbar",action:"feedback-open"}),ln("/feedback")}function Lu(d,p){return ho("brief",d,p||{})}function Nu(d,p){return ho("readout",d,p||{})}function Ou(d,p){return ho("matchup",d,p||{})}function Du(d,p){return ho("file",d,p||{})}function dl(d){let p=g.tabs[d];p&&(g.activeTab=d,ln(ul(p)))}function br(d){let p=d===g.activeTab;if(g.tabs.splice(d,1),d<g.activeTab&&g.activeTab--,g.activeTab>=g.tabs.length&&(g.activeTab=g.tabs.length-1),Xt(),!g.tabs.length)return g.activeTab=-1,ln("/");p?ln(ul(g.tabs[g.activeTab])):co()}function Vm(d){let p=g.tabs[d];g.tabs=[p],g.activeTab=0,Xt(),ln(ul(p))}function Wm(){g.tabs=[],g.activeTab=-1,Xt(),ln("/")}function yv(){let d=vt(),p=d.name==="inbox"?{kind:"inbox"}:d.name==="settings"?{kind:"settings"}:d.name==="feedback"?{kind:"feedback"}:d.name==="case"?{kind:"case",id:d.id}:d.name==="brief"?{kind:"brief",id:d.id}:d.name==="readout"?{kind:"readout",id:d.id}:d.name==="matchup"?{kind:"matchup",id:d.id}:d.name==="file"?{kind:"file",id:d.id}:null;if(!p){g.activeTab!==-1&&(g.activeTab=-1,Xt()),co();return}let b=g.activeTab,w=g.tabs.findIndex(v=>v.kind===p.kind&&(["inbox","settings","feedback"].includes(p.kind)||v.id===p.id));w<0?(g.tabs.push(p),w=g.tabs.length-1,g.activeTab=w,Xt()):(g.activeTab=w,w!==b&&Xt()),co()}function hl(){let d=g.projectSlug||g.project&&g.project.id;return d?"/p/"+encodeURIComponent(d):""}let po=d=>String(d||"").split("/").map(encodeURIComponent).join("/"),Um=d=>String(d||"").split("/").map(p=>{try{return decodeURIComponent(p)}catch{return p}}).join("/");function vt(){let d=location.pathname,p=null,b=d.match(/^\/p\/([^/]+)(\/.*)?$/);b&&(p=decodeURIComponent(b[1]),d=b[2]||"/");let w;return d.startsWith("/case/")?w={name:"case",id:decodeURIComponent(d.slice(6))}:d.startsWith("/brief/")?w={name:"brief",id:decodeURIComponent(d.slice(7))}:d.startsWith("/readout/")?w={name:"readout",id:decodeURIComponent(d.slice(9))}:d.startsWith("/matchup/")?w={name:"matchup",id:decodeURIComponent(d.slice(9))}:d.startsWith("/file/")?w={name:"file",id:Um(d.slice(6))}:d==="/inbox"?w={name:"inbox"}:d==="/settings"?w={name:"settings"}:d==="/feedback"?w={name:"feedback"}:w={name:"home"},w.project=p,w}function ln(d){let p=d.startsWith("/p/")?d:hl()+d;location.pathname!==p&&history.pushState({},"",p),pl()}window.addEventListener("popstate",()=>{let d=vt().project;d&&g.project&&d!==g.project.id?(g.projectSlug=d,g.tabs=[],g.activeTab=-1,g.query="",xr()):pl()});let Pu=null;async function pl(){let d=vt();if(d.name==="home")return fl();let p=["inbox","settings","feedback"].includes(d.name)?d.name:null;if(p!==Pu&&(Pu=p,p&&ge.event("ui.page.viewed",{page:p})),Me(),yv(),d.name==="inbox")return Jm();if(d.name==="settings")return Km();if(d.name==="feedback")return sf();if(d.name==="brief")return Bu(d.id);if(d.name==="readout")return Hu(d.id);if(d.name==="matchup")return qu(d.id);if(d.name==="file")return Fu(d.id);if(d.name==="case")return Xm(d.id)}let Y2=d=>d.last_stage_at||d.updated_at||d.created_at||0;function bv(d){switch(d.state){case"done":return"Analysis complete";case"error":return"A stage needs a re-run";case"new":return"Draft — not yet analysed";default:return"Being generated…"}}function zu(d){return d.last_stage_at||d.updated_at||d.created_at||0}function xv(d,p){return d==="briefs"?cl(p):d==="readouts"?vu(p):d==="matchups"?Cu(p):p.title||"Untitled"}function kv(d,p){return d?d.startsWith("const:")?e(d.slice(6)):e(d==="state"?bv(p):String(p[d]??"")):""}function wv(d,p){if(d==="score"){let b=p.score!=null?S(p.score):null;return b?`<span class="pill ${b.cls}" title="${b.word} · ${b.label}" aria-label="Verdict ${b.word}, score ${b.label}">${b.label}</span>`:'<span class="pill neutral" title="Not scored yet" aria-label="Not scored yet">—</span>'}return d==="brief"?`<span class="pill brief" title="Landscape brief" aria-label="Landscape brief">${n(r.brief)}</span>`:d==="readout"?`<span class="pill readout" title="Product readout" aria-label="Product readout">${n(r.readout)}</span>`:d==="matchup"?`<span class="pill matchup" title="Competitor matchup" aria-label="Competitor matchup">${n(r.matchup)}</span>`:""}function Km(){Ct("");let d=Le();Et(`<div class="settings-wrap"><section class="settings-page" id="settings-page">
|
|
1604
|
+
<header class="settings-head"><h1>Settings</h1><p>Preferences apply across all projects on this device.</p></header>
|
|
1605
|
+
<section class="settings-section" aria-labelledby="appearance-title">
|
|
1606
|
+
<div class="settings-copy"><h2 id="appearance-title">Appearance</h2><p>Choose how Sonorance looks.</p></div>
|
|
1607
|
+
<div class="theme-options" role="radiogroup" aria-label="Theme">
|
|
1608
|
+
${[{value:"",label:"System",icon:"auto",note:"Follow this device"},{value:"light",label:"Light",icon:"sun",note:"Always light"},{value:"dark",label:"Dark",icon:"moon",note:"Always dark"}].map(v=>`<button type="button" class="theme-option ${d===v.value?"selected":""}" role="radio" aria-checked="${d===v.value}" tabindex="${d===v.value?0:-1}" data-theme-value="${v.value}">
|
|
1609
|
+
<span class="theme-icon">${n(r[v.icon])}</span><span><strong>${v.label}</strong><small>${v.note}</small></span>
|
|
1610
|
+
</button>`).join("")}
|
|
1611
|
+
</div>
|
|
1612
|
+
</section>
|
|
1613
|
+
<section class="settings-section" aria-labelledby="privacy-title">
|
|
1614
|
+
<div class="settings-copy"><h2 id="privacy-title">Privacy</h2><p>Privacy is foundational to Sonorance. We collect only a small amount of anonymous, content-free data—feature usage, performance, and redacted error signals—so we can understand what helps, fix issues, and keep improving the product.</p></div>
|
|
1615
|
+
<label class="settings-toggle">
|
|
1616
|
+
<span><strong>Share anonymous usage data</strong><small>Sonorance never logs your work—not even project, file, or folder names. Document contents, paths, prompts, and completions always stay private.</small></span>
|
|
1617
|
+
<input id="telemetry-setting" type="checkbox" ${g.telemetry&&g.telemetry.enabled===!1?"":"checked"}>
|
|
1618
|
+
<i aria-hidden="true"></i>
|
|
1619
|
+
</label>
|
|
1620
|
+
</section>
|
|
1621
|
+
</section></div>`);let b=[...document.querySelectorAll("[data-theme-value]")];b.forEach((v,C)=>v.addEventListener("click",()=>{let E=v.dataset.themeValue;nn(E),b.forEach(O=>{O.tabIndex=O===v?0:-1}),ge.event("ui.action",{area:"settings",action:"theme-change",value:E||"system"})})),b.forEach((v,C)=>v.addEventListener("keydown",E=>{let O=null;E.key==="ArrowRight"||E.key==="ArrowDown"?O=(C+1)%b.length:E.key==="ArrowLeft"||E.key==="ArrowUp"?O=(C-1+b.length)%b.length:E.key==="Home"?O=0:E.key==="End"&&(O=b.length-1),O!=null&&(E.preventDefault(),b[O].click(),b[O].focus())}));let w=t("#telemetry-setting");w.addEventListener("change",async()=>{let v=w.checked;w.disabled=!0;let C=await Fg(v);w.checked=C,w.disabled=!1,C!==v&&Bg("Could not update telemetry preference.")})}function Jm(){Ct("");let d=(g.kinds||[]).some(C=>C.inbox),p=(g.kinds||[]).filter(C=>C.inbox).map(C=>({spec:C.inbox,items:[...g[C.inbox.source]||[]].sort((E,O)=>zu(O)-zu(E)).slice(0,C.inbox.limit||5)}));if(!p.reduce((C,E)=>C+E.items.length,0)){let C=`<button type="button" class="tbtn" data-hero-newfile>${n(r.newfile)}New Markdown file</button>`,E=d?`<button type="button" class="tbtn ghost" data-hero-copy='/deliberate case "<idea>"' title="Copy the command to start a Case in your coding agent">${n(r.copy)}Copy <code>/deliberate case</code></button>`:"",O=Et(gC(d?"Start a Case, or draft a note.":"A calm home for your Markdown.",d?"A Case runs the frame → score → shape pipeline in your coding agent. Or draft any Markdown here.":"Create a note below, or open an existing file from the Explorer.",`${C}${E}`)),L=t("#main [data-hero-newfile]");L&&L.addEventListener("click",()=>Co(g.treeBase||""));let D=t("#main [data-hero-copy]");return D&&D.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(D.dataset.heroCopy),je("Command copied to clipboard.")}catch{je("Copy failed — the command is: "+D.dataset.heroCopy)}}),O}let w=(C,E)=>`<button class="qrow" data-open-kind="${C.source==="briefs"?"brief":C.source==="readouts"?"readout":C.source==="matchups"?"matchup":"case"}" data-open-id="${E.id}">
|
|
1622
|
+
${wv(C.badge,E)}
|
|
1623
|
+
<span class="qmain"><span class="qt">${e(xv(C.source,E))}</span><span class="qr">${kv(C.subtitle,E)}</span></span>
|
|
1624
|
+
<span class="qtime">${e(z(zu(E)))}</span>
|
|
1625
|
+
${n(r.chevron).replace('class="ico"','class="ico go"')}
|
|
1626
|
+
</button>`,v=C=>C.items.length?`<h2 class="qsec">${e(C.spec.section)}</h2>${C.items.map(E=>w(C.spec,E)).join("")}`:"";Et(`<div class="qwrap"><div class="queue">
|
|
1627
|
+
<h1>Inbox</h1><p class="sub">Your most recently updated cases and briefs.</p>
|
|
1628
|
+
${p.map(v).join("")}
|
|
1629
|
+
</div></div>`),t("#main").querySelectorAll("[data-open-kind]").forEach(C=>C.addEventListener("click",()=>{C.dataset.openKind==="brief"?Lu(C.dataset.openId):C.dataset.openKind==="readout"?Nu(C.dataset.openId):C.dataset.openKind==="matchup"?Ou(C.dataset.openId):Ru(C.dataset.openId)}))}function Gm(){return g.cases.find(d=>d.id===g.caseId)||null}let Sv=new Set(["score","shape","launch"]);function ml(){let d=Gm();return!!(d&&Sv.has(d.state))}function gl(){return!!(g.brief||g.readout||g.matchup||ml())}async function Xm(d){Cn(),g.caseId=d,g.dirty=!1,g.saving=!1,g.proto=null,g.comments=[],g.cNavIdx=-1,g.recFile=null,g.brief=null,g.readout=null,g.matchup=null,g.file=null,Me();let p;try{p=await T("GET","/api/record?id="+encodeURIComponent(d))}catch{p={error:"offline"}}if(!p||p.error)return Ct(""),Et(Ao("Case not found","This case has no record here."));g.rec=p,g.isGit=!!p.isGit,g.proto=p.proto||null,g.recFile=p.file||null,g.items=p.text?x(p.text):[{kind:"block",lines:[""]}],g.mode=To(),ng(),mi(p.file)}async function mi(d){if(!d)return;let p=await T("GET","/api/comments?file="+encodeURIComponent(d));if(g.recFile===d){if(p&&p.error==="endpoint-missing"){vo();return}!p||p.error||(g.comments=p.comments||[],Ue())}}let yl=d=>{let p=String(d||"").match(/^---\n[\s\S]*?\n---\n?/);return p?d.slice(p[0].length):d};async function Bu(d){Cn(),g.caseId=null,g.brief=null,g.readout=null,g.matchup=null,g.file=null,g.mode="doc",g.comments=[],g.cNavIdx=-1,g.recFile=null,Me();let p;try{p=await T("GET","/api/brief?id="+encodeURIComponent(d))}catch{p={error:"offline"}}let b=vt();if(!(b.name==="brief"&&b.id!==d)){if(!p||p.error)return Ct(""),Et(Ao("Brief not found","This brief has no record here."));g.brief={id:d,...p},g.recFile=p.file||null,g.isGit=!!p.isGit,g.mode=To(),_u(),mi(p.file)}}async function Fu(d){Cn(),g.caseId=null,g.brief=null,g.readout=null,g.matchup=null,g.file=null,g.mode="doc",g.comments=[],g.cNavIdx=-1,g.recFile=null,g.dirty=!1,g.saving=!1,Me();let p;try{p=await T("GET","/api/file?path="+encodeURIComponent(d))}catch{p={error:"offline"}}let b=vt();if(!(b.name==="file"&&b.id!==d)){if(!p||p.error){if(hC(d)){g.file={path:d,text:"",deleted:!0},g.recFile=d,g.isGit=!0,g.mode="diff",g.items=[{kind:"block",lines:[""]}],$u();return}return Ct(""),Et(Ao("File not found","This file isn’t in the folder."))}g.file={path:d,...p},g.recFile=p.path||null,g.isGit=!!p.isGit,g.mode=To(),g.items=p.text?x(p.text):[{kind:"block",lines:[""]}],$u(),mi(p.path)}}function vv(){return`${tg()}`}function $u(){g.file&&g.file.deleted&&(g.mode="diff"),Et(mo()),Ct(vv()),gi(),go(),Bt(),Ue(),g.mode==="diff"&&Tn().then(Xn),Yn()}function Ym(){return""}function _u(){Et(mo()),Ct(Ym()),gi();let d=t("#canvas");if(!d)return;let p=document.createElement("article");p.className="doc",p.id="doc";let b=g.brief&&g.brief.exists?yl(g.brief.text):"",w=!b.trim();p.innerHTML=w?`<div class="banner">${n(r.brief)}<div>This brief is empty. Regenerate it in your coding agent with <code>/deliberate brief</code>.</div></div>`:y(b),p.querySelectorAll(".md-taskbox").forEach(v=>{v.disabled=!0,v.style.cursor="default"}),d.innerHTML="",d.appendChild(p),yo(p),Bt(),w||(kl(p),Ue()),g.mode==="diff"&&Tn().then(Xn)}async function Hu(d){Cn(),g.caseId=null,g.brief=null,g.readout=null,g.matchup=null,g.file=null,g.mode="doc",g.comments=[],g.cNavIdx=-1,g.recFile=null,Me();let p;try{p=await T("GET","/api/readout?id="+encodeURIComponent(d))}catch{p={error:"offline"}}let b=vt();if(!(b.name==="readout"&&b.id!==d)){if(!p||p.error)return Ct(""),Et(Ao("Readout not found","This Product Readout has no record here."));g.readout={id:d,...p},g.recFile=p.file||null,g.isGit=!!p.isGit,g.mode=To(),ju(),mi(p.file)}}function Qm(){return""}function ju(){Et(mo()),Ct(Qm()),gi();let d=t("#canvas");if(!d)return;let p=document.createElement("article");p.className="doc",p.id="doc";let b=g.readout&&g.readout.exists?yl(g.readout.text):"",w=!b.trim();p.innerHTML=w?`<div class="banner">${n(r.readout)}<div>This readout is empty. Regenerate it in your coding agent with <code>/deliberate readout</code>.</div></div>`:y(b),p.querySelectorAll(".md-taskbox").forEach(v=>{v.disabled=!0,v.style.cursor="default"}),d.innerHTML="",d.appendChild(p),yo(p),Bt(),w||(kl(p),Ue()),g.mode==="diff"&&Tn().then(Xn)}async function qu(d){Cn(),g.caseId=null,g.brief=null,g.readout=null,g.matchup=null,g.file=null,g.mode="doc",g.comments=[],g.cNavIdx=-1,g.recFile=null,Me();let p;try{p=await T("GET","/api/matchup?id="+encodeURIComponent(d))}catch{p={error:"offline"}}let b=vt();if(!(b.name==="matchup"&&b.id!==d)){if(!p||p.error)return Ct(""),Et(Ao("Matchup not found","This matchup has no record here."));g.matchup={id:d,...p},g.recFile=p.file||null,g.isGit=!!p.isGit,g.mode=To(),Vu(),mi(p.file)}}function Zm(){return""}function Vu(){Et(mo()),Ct(Zm()),gi();let d=t("#canvas");if(!d)return;let p=document.createElement("article");p.className="doc",p.id="doc";let b=g.matchup&&g.matchup.exists?yl(g.matchup.text):"",w=!b.trim(),v=g.matchup&&g.matchup.competitor||"<competitor>";p.innerHTML=w?`<div class="banner">${n(r.matchup)}<div>This matchup is empty. Regenerate it in your coding agent with <code>/deliberate matchup ${e(v)}</code>.</div></div>`:y(b),p.querySelectorAll(".md-taskbox").forEach(C=>{C.disabled=!0,C.style.cursor="default"}),d.innerHTML="",d.appendChild(p),yo(p),Bt(),w||(kl(p),Ue()),g.mode==="diff"&&Tn().then(Xn)}function eg(){let d=tg();return ml()?`${d}<span class="rochip" title="Being generated by your agent — editing is disabled to avoid conflicts">${n(r.queue)}Read-only</span>`:`${d}<span class="savedot" id="savedot"><i></i><span id="savelbl"></span></span>`}function Cv(d){return d?d.cls!=="neutral"&&R()?`<button type="button" class="pill jump ${d.cls}" data-scorejump title="${d.word} · ${d.label} — jump to score reasoning" aria-label="Verdict ${d.word}, score ${d.label} — jump to score reasoning">${d.label}</button>`:`<span class="pill ${d.cls}" title="${d.word} · score ${d.label}" aria-label="Verdict ${d.word}, score ${d.label}">${d.label}</span>`:""}function Ev(){let d=g.cases.find(C=>C.id===g.caseId),p=d&&d.score!=null?S(d.score):null,b=Cv(p);if(ml())return b;let w=g.proto&&g.proto.exists?`<a class="tbtn" data-proto ${g.proto.external?`href="${e(g.proto.url)}" target="_blank" rel="noopener"`:'role="button" tabindex="0"'}>${n(r.external)}View prototype</a>`:"",v=!w&&d&&d.state==="done"?`<button type="button" class="tbtn ghost" data-buildproto title="Build an interactive prototype for this case">${n(r.proto)}Build prototype</button>`:"";return`${b}${w}${v}`}function tg(){return""}function Ct(d){let p=t("#topactions");p&&(p.innerHTML=d||"")}function mo(){return`<div class="casebody"><div class="canvaswrap"><div class="canvas" id="canvas"></div><div class="cgutter" id="cgutter" aria-hidden="true"></div></div>
|
|
1630
|
+
<aside class="rail" id="rail"><nav class="toc" id="toc" aria-label="On this page"></nav></aside>
|
|
1631
|
+
<button class="secfab" id="secfab" type="button" aria-haspopup="true" aria-expanded="false" aria-controls="secsheet"><svg class="ico" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 6h16M4 12h16M4 18h10"/></svg>Sections</button>
|
|
1632
|
+
<div class="secsheet" id="secsheet" role="menu" aria-label="Jump to section"></div></div>`}function ng(){Et(mo()),Ct(eg()),gi(),go(),Bt(),Ue(),g.mode==="diff"&&Tn().then(Xn),Yn()}function gi(){Pg()}async function Tv(){let d=rf();if(!d||!await Xu({title:"Discard changes?",body:`This permanently discards all uncommitted changes in <b>${e(ao(d))}</b> and restores it to the last commit. This can’t be undone.`,confirmLabel:"Discard changes",danger:!0}))return;let b=await T("POST","/api/discard",{path:d});if(!b||b.error){je(b&&b.error==="endpoint-missing"?`Editor is out of date — restart ${$}.`:"Could not discard changes.");return}await on(),je("Changes discarded — file restored to the last commit."),g.caseId?(await ef(),!Eo()&&g.mode==="diff"?bl("doc"):pC()):(!Eo()&&g.mode==="diff"&&(g.mode="doc"),g.brief?await Bu(g.brief.id):g.readout?await Hu(g.readout.id):g.matchup?await qu(g.matchup.id):g.file&&await Fu(g.file.path)),Me()}function bl(d){let p=d==="diff"?"diff":"doc";if(p===g.mode)return;Cn(),So(),g.mode=p,ge.event("ui.action",{area:"editor",action:"mode-change",value:p}),Pg();let b=w=>{vi(w),Bt(),bi(),(g.file||g.caseId||g.brief||g.readout||g.matchup)&&Ue()};p==="diff"?Tn().then(()=>b(!0)):b(!1)}function rg(d){let p=g.projectSlug||g.project&&g.project.id,b=p?"&project="+encodeURIComponent(p):"",w=d?"&surface="+encodeURIComponent(d):"";return!d&&g.proto&&g.proto.external&&g.proto.url?g.proto.url:"/api/proto?id="+encodeURIComponent(g.caseId)+b+w}function Wu(d){ge.event("ui.action",{area:"editor",action:"proto-open"});try{window.open(rg(d),"_blank","noopener")}catch{}}function Mv(d){let p=Gm(),w=`/deliberate case ${p&&p.id!=null?String(p.id):""} prototype`.replace(/\s+/g," ").trim();Av(d,{title:"Build the prototype",desc:"Prototyping is an explicit step your coding agent runs. Paste this into your agent:",command:w})}function Av(d,{title:p,desc:b,command:w}){Fe();let v=document.createElement("div");v.className="cmdpop",v.id="menu",v.setAttribute("role","dialog"),v.setAttribute("aria-label",p),v.innerHTML=`<div class="cmdpop-t">${e(p)}</div><p class="cmdpop-d">${e(b)}</p>
|
|
1633
|
+
<div class="cmdpop-row"><code class="cmdpop-c">${e(w)}</code>
|
|
1634
|
+
<button class="cmdpop-copy" type="button" aria-label="Copy command">${n(r.copy)}<span>Copy</span></button></div>`,document.body.appendChild(v);let C=d.getBoundingClientRect(),E=v.offsetWidth||340,O=window.innerWidth;v.style.left=Math.max(8,Math.min(C.right-E,O-E-8))+"px",v.style.top=C.bottom+8+"px";let L=v.querySelector(".cmdpop-copy");L.addEventListener("click",async()=>{let D=!1;try{await navigator.clipboard.writeText(w),D=!0}catch{D=Uu(w)}je(D?"Copied — paste it into your coding agent.":"Select the command and copy it manually."),Fe()}),L.focus(),setTimeout(()=>document.addEventListener("mousedown",Jt,!0),0)}function Uu(d){try{let p=document.createElement("textarea");p.value=d,p.style.position="fixed",p.style.opacity="0",document.body.appendChild(p),p.select();let b=document.execCommand("copy");return p.remove(),b}catch{return!1}}function Q2(d){d.querySelectorAll("a[href]").forEach(p=>{let b=p.getAttribute("href")||"",w=b.match(/(?:^|\/)prototype\/(?:([^/]+)\/)?index\.html\/?$/)||(/(?:^|\/)prototype\/?$/.test(b)?[]:null);if(w){let v=w&&w[1]||null,C=!v&&g.proto&&g.proto.external;p.setAttribute("href",rg(v)),p.setAttribute("target","_blank"),p.setAttribute("rel","noopener"),C||(p.dataset.protoLocal="1",p.addEventListener("click",E=>{E.preventDefault(),Wu(v)}))}})}function ig(d){let p=d.getAttribute("href")||"";if(!(!p||p==="#")){if(p.charAt(0)==="#"){let b=document.getElementById(p.slice(1));b&&b.scrollIntoView({behavior:yi()?"auto":"smooth",block:"start"});return}try{window.open(d.href,"_blank","noopener,noreferrer")}catch{}}}let Rv=d=>d.trim()!==""&&y(d).trim()==="",ye=null;function og(){return!!(ye&&ye.hasFocus())}function go(){let d=t("#canvas");if(!d)return;let p=gl();if(So(),Cl(),ye){try{ye.destroy()}catch{}ye=null}if(d.innerHTML="",ml()){let w=document.createElement("div");w.className="banner gen",w.setAttribute("contenteditable","false"),w.innerHTML=`${n(r.queue)}<div><strong>Being generated by your agent.</strong> Editing is disabled here while the analysis is written, to avoid conflicts — it unlocks when the case is complete. You can still add comments.</div>`,d.appendChild(w)}else if(g.rec&&!g.rec.exists){let w=document.createElement("div");w.className="banner",w.setAttribute("contenteditable","false"),w.innerHTML=`${n(r.queue)}<div>No analysis has run yet — start typing to draft this record, or run the funnel in your coding agent (<code>/deliberate case</code>).${g.rec.idea?`<div style="margin-top:8px;color:var(--ink-faint)">Case: ${e(g.rec.idea)}</div>`:""}</div>`,d.appendChild(w)}let b=document.createElement("article");b.className="doc"+(p?" ro":""),b.id="doc",d.appendChild(b),ye=iv({element:b,editable:!p,placeholder:"Start writing…",onChange:Iv,onCommentClick:w=>wi(w),onAtComment:Sg,onLinkClick:(w,v)=>{v&&v.preventDefault(),ig(w)}}),ye.setMarkdown(k(g.items)),yo(b),Bt(),Ue(),kl(b),g.mode==="diff"&&vi()}function Iv(){gl()||(g.dirty=!0,Yn(),mC(),Mo(),Lv())}let xl=null;function Lv(){clearTimeout(xl),xl=setTimeout(Nv,150)}function Nv(){if(clearTimeout(xl),xl=null,!ye)return;let d=t("#doc");d&&yo(d),Bt(),g.mode==="diff"&&vi()}function yo(d){let p=0;d.querySelectorAll(":is(h1,h2,h3,h4,h5,h6)").forEach(b=>{b.id="sec-"+p++})}function kl(d){let p=()=>setTimeout(()=>{xg(d),vl()},0);d.addEventListener("mouseup",p),d.addEventListener("keyup",p),d.addEventListener("mousemove",Gv);let b=d.closest(".canvaswrap");b&&!b._cleave&&(b._cleave=!0,b.addEventListener("mouseleave",pg))}function Ov(){if(It||(vl(),!Ke&&!He))return;let d=window.getSelection&&window.getSelection();d&&!d.isCollapsed&&d.toString().trim()||Si()}function wl(){return ye?ye.getMarkdown():k(g.items)}function Cn(){g.saveTimer&&(clearTimeout(g.saveTimer),g.saveTimer=null),g.dirty&&of()}function yi(){try{return window.matchMedia("(prefers-reduced-motion:reduce)").matches}catch{return!1}}function bo(){let d=t("#doc");return d?[...d.querySelectorAll("h2,h3")].filter(p=>!p.closest(".diffdel")):[]}function Bt(){let d=t("#toc");if(!d)return;let p=bo();if(Dv(p),p.length<2){d.innerHTML="";return}let b=p.map((C,E)=>E),w=(window.innerHeight||800)-130;if(p.length*27+26>w){let C=b.filter(E=>p[E].tagName==="H2");C.length>=2&&(b=C)}let v=sg();d.innerHTML='<div class="toc-h">On this page</div>'+b.map((C,E)=>{let O=p[C];return`<a href="#${O.id}" data-idx="${E}" data-hidx="${C}" class="lvl${O.tagName==="H3"?3:2}">${e(O.textContent)}${v.has(O)?'<span class="tdot" aria-label="has comments"></span>':""}</a>`}).join(""),d.querySelectorAll("a").forEach(C=>C.addEventListener("click",E=>{E.preventDefault(),ge.event("ui.action",{area:"toc",action:"toc-nav"});let O=bo()[+C.dataset.hidx];O&&O.scrollIntoView({behavior:yi()?"auto":"smooth",block:"start"})})),Pv(b),bi()}function bi(){let d=t("#rail"),p=t("#docdiff");if(!d)return;if(!p||p.hidden){d.style.paddingTop="";return}let b=d.getBoundingClientRect(),v=p.getBoundingClientRect().bottom-b.top;d.style.paddingTop=v>0?`${Math.ceil(v)+12}px`:""}function Dv(d){let p=t("#secfab"),b=t("#secsheet");if(document.body.classList.remove("sec-open"),document.body.classList.toggle("has-sections",d.length>=2),p&&p.setAttribute("aria-expanded","false"),!b)return;if(d.length<2){b.innerHTML="";return}b.innerHTML=d.map((v,C)=>`<a href="#${v.id}" data-idx="${C}" data-hidx="${C}" class="lvl${v.tagName==="H3"?3:2}" role="menuitem">${e(v.textContent)}</a>`).join("");let w=()=>{document.body.classList.remove("sec-open"),p&&p.setAttribute("aria-expanded","false")};p&&(p.onclick=v=>{v.stopPropagation();let C=document.body.classList.toggle("sec-open");p.setAttribute("aria-expanded",C?"true":"false")}),b.querySelectorAll("a").forEach(v=>v.addEventListener("click",C=>{C.preventDefault();let E=bo()[+v.dataset.hidx];E&&E.scrollIntoView({behavior:yi()?"auto":"smooth",block:"start"}),w()})),g._secOutsideWired||(g._secOutsideWired=!0,document.addEventListener("click",v=>{document.body.classList.contains("sec-open")&&(v.target.closest("#secsheet")||v.target.closest("#secfab")||w())}),document.addEventListener("keydown",v=>{v.key==="Escape"&&w()}))}let xo=null;function Pv(d){let p=t("#main"),b=t("#toc");if(!p||!b)return;xo&&(p.removeEventListener("scroll",xo),xo=null);let w=E=>b.querySelectorAll("a").forEach(O=>O.classList.toggle("active",+O.dataset.idx===E)),v=!1,C=()=>{v=!1;let E=bo(),O=p.getBoundingClientRect().top,L=0;for(let D=0;D<d.length;D++){let W=E[d[D]];if(W)if(W.getBoundingClientRect().top-O<=60)L=D;else break}w(L)};xo=()=>{v||(v=!0,(window.requestAnimationFrame||setTimeout)(C))},p.addEventListener("scroll",xo,{passive:!0}),C()}let ko=()=>(g.comments||[]).filter(d=>d.status==="open");function xi(d){let p=t("#doc");if(!p||!d)return null;let b=p.querySelector(".ProseMirror")||p,w=d.nodeType===3?d.parentElement:d;if(!w||!b.contains(w))return null;for(;w&&w.parentElement&&w.parentElement!==b;)w=w.parentElement;return w&&w.parentElement===b?w:null}function ki(d){let p=t("#doc");if(!p)return null;let b=p.querySelector(`.cmark[data-comment="${d.id}"]`);if(b)return{el:b,blk:xi(b)};let w=$v(d)||p.querySelector(`.cmark-blk[data-comment="${d.id}"]`);if(w)return{el:w,blk:w};let v=d.anchor&&d.anchor.heading&&d.anchor.heading.trim();if(v){let C=[...p.querySelectorAll("h1,h2,h3,h4,h5,h6")].find(E=>E.textContent.trim()===v);if(C)return{el:C,blk:xi(C)}}return null}function zv(d){let p=t("#doc");if(!p||!d)return null;let b=null;for(let w of p.querySelectorAll("h1,h2,h3,h4,h5,h6"))if(w===d||w.compareDocumentPosition(d)&Node.DOCUMENT_POSITION_FOLLOWING)b=w;else break;return b}function sg(){let d=new Set;for(let p of ko()){let b=ki(p);if(!b)continue;let w=zv(b.el);w&&d.add(w)}return d}function Bv(d){let p=0;for(let b=0;b<d&&b<g.items.length;b++)p+=(g.items[b].lines||[]).length;return p}function Fv(d){let p=0;for(let b=0;b<g.items.length;b++){let w=(g.items[b].lines||[]).length;if(d>=p&&d<p+w)return b;p+=w}return-1}function $v(d){let p=t("#doc");if(!p)return null;let b=d.anchor&&typeof d.anchor.line=="number"?d.anchor.line:-1;if(b>=0){if(g.caseId||g.file){let w=Fv(b);if(w>=0){let v=p.querySelector(`.blk[data-i="${w}"]`);if(v)return v}}else if(g.brief||g.readout||g.matchup){let w=iC(b);if(w>=0){let v=Cg()[w];if(v)return v}}}return null}function lg(){return _v()?"rail":"inline"}function _v(){try{return window.innerWidth>1080}catch{return!0}}function Ue(){let d=t("#doc");if(!d)return;d.querySelectorAll(".cnote-island").forEach(b=>b.remove()),ye&&ye.setComments(ko());let p=ko();Jv(t("#cgutter")),qv(p),lg()==="inline"&&p.length&&(Hv(),Wv(p)),Kv(),Uv(),g.mode==="diff"&&vi()}function Hv(){let d=t("#doc");if(!d)return;let p=document.createElement("div");p.className="cnote-island cnote-hint-island",p.contentEditable="false",p.innerHTML=cg(),d.insertBefore(p,d.firstChild),ug(p)}function ag(d){return`<article class="cnote" data-comment="${e(d.id)}" tabindex="0" role="button" aria-label="Comment — ${e(String(d.body||"").slice(0,60))}">
|
|
1635
|
+
<div class="cnote-b">${e(d.body)}</div>
|
|
1636
|
+
<footer class="cnote-f"><span class="cnote-who">You</span><span class="cnote-t">${e(z(d.ts))}</span><span class="cnote-sp"></span>
|
|
1637
|
+
<button type="button" class="cnote-act" data-edit="${e(d.id)}" title="Edit comment" aria-label="Edit comment">${n(r.pencil)}</button>
|
|
1638
|
+
<button type="button" class="cnote-act cnote-del" data-del="${e(d.id)}" title="Delete comment" aria-label="Delete comment">${n(r.trash)}</button></footer>
|
|
1639
|
+
</article>`}function jv(d){return d.map(p=>({c:p,a:ki(p)})).sort((p,b)=>p.a?b.a?p.a.el.compareDocumentPosition(b.a.el)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1:-1:1).map(p=>p.c)}function qv(d){let p=t("#rail");if(!p)return;let b=p.querySelector("#toc"),w=p.querySelector(".crail-head"),v=p.querySelector("#comments");if(!d.length){w&&w.remove(),v&&v.remove(),p.classList.remove("cm-aligned"),b&&(b.style.display="");return}lg()==="rail"?(w||(w=document.createElement("div"),w.className="crail-head",p.insertBefore(w,p.firstChild)),w.innerHTML=cg(),ug(w),b&&(b.style.display="none"),v||(v=document.createElement("div"),v.id="comments",v.className="comments",p.appendChild(v)),v.classList.add("aligned"),p.classList.add("cm-aligned"),v.innerHTML=jv(d).map(E=>ag(E)).join(""),fg(v),wo(),requestAnimationFrame(wo)):(w&&w.remove(),p.classList.remove("cm-aligned"),v&&v.remove(),b&&(b.style.display=""))}function cg(){return`<div class="crail-hint"><span class="crail-hint-t">Run <code>${e(j)}</code> in your agent to resolve comments.</span>
|
|
1640
|
+
<button type="button" class="crail-copy" data-copyaddr title="Copy “${e(j)}”" aria-label="Copy the command">${n(r.copy)}</button></div>`}function ug(d){d.querySelector("[data-copyaddr]")?.addEventListener("click",async()=>{let p=!1;try{await navigator.clipboard.writeText(j),p=!0}catch{p=Uu(j)}je(p?"Command copied.":"Could not copy.")})}function Vv(){let d=ko().length;if(!d)return"";let p=`${d} open comment${d>1?"s":""}`;return`<span class="cnavcmd" role="group" aria-label="${p}">
|
|
1641
|
+
<button type="button" class="cnavcmd-step" data-cnav="prev" title="Previous comment" aria-label="Previous comment">‹</button>
|
|
1642
|
+
<span class="cnavcmd-count" title="${p}">${n(r.comment)}${d}</span>
|
|
1643
|
+
<button type="button" class="cnavcmd-step" data-cnav="next" title="Next comment" aria-label="Next comment">›</button>
|
|
1644
|
+
</span>`}function wo(){let d=t("#comments");if(!d||!d.classList.contains("aligned"))return;let p=t("#rail"),b=p&&p.querySelector(".crail-head"),w=d.getBoundingClientRect(),v=10,C=b?b.getBoundingClientRect().bottom-w.top+8:0;for(let E of d.querySelectorAll(".cnote")){let O=(g.comments||[]).find(W=>W.id===E.dataset.comment),L=O&&ki(O),D=L&&L.el?L.el.getBoundingClientRect().top-w.top:C;D=Math.max(D,C),E.style.top=D+"px",C=D+E.getBoundingClientRect().height+v}}function Wv(d){if(!t("#doc"))return;let b=new Map;for(let w of d){let v=ki(w);!v||!v.blk||(b.has(v.blk)||b.set(v.blk,[]),b.get(v.blk).push(w))}for(let[w,v]of b){let C=document.createElement("div");C.className="cnote-island",C.contentEditable="false",C.innerHTML=v.map(E=>ag(E)).join(""),w.insertAdjacentElement("afterend",C),fg(C)}}function fg(d){d.querySelectorAll("[data-del]").forEach(p=>p.addEventListener("click",b=>{b.stopPropagation(),mg(p.dataset.del)})),d.querySelectorAll("[data-edit]").forEach(p=>p.addEventListener("click",b=>{b.stopPropagation(),dg(p.dataset.edit)})),d.querySelectorAll(".cnote").forEach(p=>{p.addEventListener("click",b=>{!b.target.closest(".cnote-act")&&!p.classList.contains("editing")&&wi(p.dataset.comment)}),p.addEventListener("keydown",b=>{(b.key==="Enter"||b.key===" ")&&!p.classList.contains("editing")&&b.target===p&&(b.preventDefault(),wi(p.dataset.comment))})})}function dg(d){let p=(g.comments||[]).find(L=>L.id===d);if(!p)return;let b=[...document.querySelectorAll(".cnote")].find(L=>L.dataset.comment===d);if(!b||b.classList.contains("editing"))return;b.classList.add("editing");let w=b.querySelector(".cnote-b"),v=p.body;w.innerHTML=`<textarea class="cnote-edit" rows="2">${e(v)}</textarea>
|
|
1645
|
+
<div class="cnote-editrow"><button type="button" class="cbtn ghost" data-cedit="cancel">Cancel</button><button type="button" class="cbtn primary" data-cedit="save">Save</button></div>`;let C=w.querySelector("textarea");C.focus(),C.setSelectionRange(C.value.length,C.value.length),wo(),C.addEventListener("input",wo);let E=()=>Ue();C.addEventListener("keydown",L=>{L.stopPropagation(),L.key==="Escape"&&(L.preventDefault(),E()),L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),O())}),w.querySelector('[data-cedit="cancel"]').addEventListener("click",L=>{L.stopPropagation(),E()}),w.querySelector('[data-cedit="save"]').addEventListener("click",L=>{L.stopPropagation(),O()});async function O(){let L=C.value.trim();if(!L||L===v){E();return}p.body=L,E();let D=g.recFile,W=await T("POST","/api/comment-edit",{commentId:d,body:L});g.recFile===D&&(!W||W.error)&&(p.body=v,Ue(),je(W&&W.error==="endpoint-missing"?`Editor is out of date — restart ${$}.`:"Could not save the edit."))}}function wi(d){let p=(g.comments||[]).find(v=>v.id===d);if(!p)return;document.querySelectorAll(".cmark.on, .cmark-blk.on").forEach(v=>v.classList.remove("on"));let b=ki(p);if(b&&b.el){try{b.el.scrollIntoView({behavior:yi()?"auto":"smooth",block:"center"})}catch{}b.el.classList&&b.el.classList.add("on","hot"),setTimeout(()=>b.el.classList&&b.el.classList.remove("hot"),1400)}document.querySelectorAll(".cnote.active").forEach(v=>v.classList.remove("active"));let w=[...document.querySelectorAll(".cnote")].find(v=>v.dataset.comment===d);if(w){w.classList.add("active");try{w.scrollIntoView({block:"nearest"})}catch{}}}let hg=wi;function Uv(){Ct(g.brief?Ym():g.readout?Qm():g.matchup?Zm():eg()),gi(),!g.brief&&!g.readout&&!g.matchup&&Yn()}function Kv(){let d=t("#toc");if(!d)return;let p=sg(),b=bo();d.querySelectorAll("a").forEach(w=>{let v=p.has(b[+w.dataset.hidx]),C=w.querySelector(".tdot");v&&!C?(C=document.createElement("span"),C.className="tdot",C.setAttribute("aria-label","has comments"),w.appendChild(C)):!v&&C&&C.remove()})}let Ne=null;function Jv(d){Ne&&Ne.isConnected||(Ne=document.createElement("button"),Ne.className="cadd",Ne.type="button",Ne.title="Comment on this block",Ne.setAttribute("aria-label","Comment on this block"),Ne.innerHTML=n(r.comment),Ne.addEventListener("mousedown",p=>p.preventDefault()),Ne.addEventListener("click",p=>{p.stopPropagation(),Ne._blk&&Ku(Ne._blk)}),d.appendChild(Ne))}function Gv(d){if(!Ne)return;let p=window.getSelection&&window.getSelection();if(p&&!p.isCollapsed){Ne.classList.remove("show");return}let b=xi(d.target),w=t("#cgutter")&&t("#cgutter").parentElement;if(!b||!w||b.classList.contains("cnote-island")){Ne.classList.remove("show");return}let v=b.getBoundingClientRect(),C=w.getBoundingClientRect();Ne._blk=b;let E=26,O=12,L=2,D=v.left-C.left,W=Math.max(L,D-O-E);W+E>D-4&&(W=Math.max(0,D-4-E)),Ne.style.top=Math.max(0,v.top-C.top+(v.height-E)/2)+"px",Ne.style.left=W+"px",Ne.classList.add("show")}function pg(){Ne&&Ne.classList.remove("show")}function Ku(d){if(!d)return;let p=(d.textContent||"").replace(/\s+/g," ").trim().slice(0,300);if(!p)return;let b;try{b=d.getBoundingClientRect()}catch{b={left:40,top:80,bottom:96}}En={quote:p,heading:bg(d),rect:b,blk:d,endBlk:d,whole:!0},Ju()}async function mg(d){let p=g.recFile,b=await T("DELETE","/api/comment",{commentId:d});g.recFile===p&&(b&&b.ok?Sl(d):b&&b.error==="endpoint-missing"?vo():je(Mg(b)))}let gg=new Set;function Sl(d){gg.add(d),g.comments=(g.comments||[]).filter(v=>v.id!==d);let p=t("#doc"),b=p&&p.querySelector(`.cmark[data-comment="${d}"]`);if(b){let v=b.parentNode;for(;b.firstChild;)v.insertBefore(b.firstChild,b);v.removeChild(b),v.normalize&&v.normalize()}let w=p&&p.querySelector(`.cmark-blk[data-comment="${d}"]`);w&&(w.classList.remove("cmark-blk","on","hot"),delete w.dataset.comment),Ue()}function yg(d){if(!t("#doc"))return;let b=ko().map(v=>({c:v,a:ki(v)})).filter(v=>v.a).sort((v,C)=>v.a.el.compareDocumentPosition(C.a.el)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);if(!b.length)return;g.cNavIdx=((g.cNavIdx+d)%b.length+b.length)%b.length;let w=b[g.cNavIdx];w.a.el.scrollIntoView&&w.a.el.scrollIntoView({behavior:yi()?"auto":"smooth",block:"center"}),hg(w.c.id)}let Ke=null,It=null,En=null,it=null;function So(){Si(),Xv()}function Xv(){if(it){try{it.stop()}catch{}it=null}It&&(It.remove(),It=null)}function bg(d){let p=d.nodeType===3?d.parentElement:d,b=t("#doc");if(!b||!p)return"";let w=[...b.querySelectorAll("h1,h2,h3,h4,h5,h6")],v="";for(let C of w)if(C.compareDocumentPosition(p)&Node.DOCUMENT_POSITION_FOLLOWING)v=C.textContent.trim();else break;return v}function xg(d){if(It)return;let p=window.getSelection&&window.getSelection();if(!p||p.isCollapsed||!p.rangeCount){Si();return}let b=p.getRangeAt(0),w=t("#doc")||d;if(!w||!w.contains(b.commonAncestorContainer)){Si();return}let v=p.toString().replace(/\s+/g," ").trim();if(v.length<2){Si();return}let C;try{C=b.getBoundingClientRect()}catch{C={left:40,top:80,bottom:96}}En={quote:v,heading:bg(b.startContainer),rect:C,blk:xi(b.startContainer),endBlk:xi(b.endContainer)},pg(),ye&&ye.isEditable()?Qv(C):Yv(C)}function Si(){Ke&&(Ke.remove(),Ke=null),wg()}function Yv(d){wg(),Ke||(Ke=document.createElement("button"),Ke.className="askbtn",Ke.innerHTML=n(r.comment),Ke.title="Comment",Ke.setAttribute("aria-label","Comment on selection"),Ke.addEventListener("mousedown",b=>b.preventDefault()),Ke.addEventListener("click",Ju),document.body.appendChild(Ke));let p=window.innerWidth||1200;Ke.style.left=Math.max(8,Math.min(d.left,p-40))+"px",Ke.style.top=Math.max(8,(d.top||0)-36)+"px"}let He=null;function Qv(d){if(Ke&&(Ke.remove(),Ke=null),!ye)return;if(!He){He=document.createElement("div"),He.className="bubblebar",He.setAttribute("role","toolbar"),He.setAttribute("aria-label","Format selection");let v=(C,E,O)=>`<button type="button" data-bb="${C}" class="bbtn" title="${O}" aria-label="${O}">${n(E)}</button>`;He.innerHTML=v("bold",r.bold,"Bold")+v("italic",r.italic,"Italic")+v("link",r.link,"Link")+v("h2",r.heading,"Heading")+'<span class="bbsep"></span>'+v("comment",r.comment,"Comment"),He.addEventListener("mousedown",C=>C.preventDefault()),He.addEventListener("click",Zv),document.body.appendChild(He)}kg();let b=window.innerWidth||1200,w=He.offsetWidth||200;He.style.left=Math.max(8,Math.min(d.left||40,b-w-8))+"px",He.style.top=Math.max(8,(d.top||0)-42)+"px",He.classList.add("show")}function kg(){if(!He||!ye)return;let d=(p,b)=>{let w=He.querySelector(`[data-bb="${p}"]`);w&&w.classList.toggle("on",!!b)};d("bold",ye.isActive("bold")),d("italic",ye.isActive("italic")),d("link",ye.isActive("link")),d("h2",ye.isActive("heading",{level:2}))}function Zv(d){let p=d.target.closest&&d.target.closest("[data-bb]");if(!p||!ye)return;let b=p.dataset.bb;if(b==="comment"){Ju();return}if(b==="bold")ye.toggleBold();else if(b==="italic")ye.toggleItalic();else if(b==="h2")ye.toggleHeading(2);else if(b==="link"){let v=ye.isActive("link")?"":window.prompt&&window.prompt("Link URL");if(v==null)return;ye.setLink(v)}kg()}function wg(){He&&(He.remove(),He=null)}function Sg(){let d=window.getSelection&&window.getSelection(),p=d&&d.rangeCount?d.anchorNode||d.getRangeAt(0).startContainer:null,b=p?xi(p):null;b&&Ku(b)}let ot=null;function vl(){let d=ye;if(!d||!d.isEditable()||!d.isActive("table")){Cl();return}let p=window.getSelection&&window.getSelection(),b=p&&p.rangeCount?p.anchorNode||p.getRangeAt(0).startContainer:null,w=b?b.nodeType===3?b.parentElement:b:null,v=w&&w.closest?w.closest("#doc .ProseMirror table"):null;if(!v){Cl();return}eC(v)}function eC(d){if(!ot){ot=document.createElement("div"),ot.className="tabletools",ot.setAttribute("role","toolbar"),ot.setAttribute("aria-label","Edit table");let v=(C,E)=>`<button type="button" data-tt="${C}" class="ttbtn" title="${E}" aria-label="${E}">${E}</button>`;ot.innerHTML=v("row+","+ Row")+v("col+","+ Col")+v("row-","- Row")+v("col-","- Col")+`<span class="ttsep"></span><button type="button" data-tt="del" class="ttbtn danger" title="Delete table" aria-label="Delete table">${n(r.trash)}</button>`,ot.addEventListener("mousedown",C=>C.preventDefault()),ot.addEventListener("click",tC),document.body.appendChild(ot)}let p;try{p=d.getBoundingClientRect()}catch{p={left:40,top:80}}let b=window.innerWidth||1200,w=ot.offsetWidth||220;ot.style.left=Math.max(8,Math.min(p.left||40,b-w-8))+"px",ot.style.top=Math.max(8,(p.top||0)-40)+"px",ot.classList.add("show")}function tC(d){let p=d.target.closest&&d.target.closest("[data-tt]");if(!p||!ye)return;let b=p.dataset.tt;if(b==="row+")ye.addRow();else if(b==="col+")ye.addColumn();else if(b==="row-")ye.deleteRow();else if(b==="col-")ye.deleteColumn();else if(b==="del"){ye.deleteTable(),Cl();return}requestAnimationFrame(vl)}function Cl(){ot&&(ot.remove(),ot=null)}function Ju(){if(!En)return;Si(),It=document.createElement("div"),It.className="askpop";let d=oC()?`<button class="mic" id="askmic" title="Dictate" aria-label="Dictate">${n(r.mic)}</button>`:"";It.innerHTML=`
|
|
1646
|
+
<div class="askhd">${n(r.comment)}<span>Leave a comment for the agent to address</span></div>
|
|
1647
|
+
<div class="aq">${e(En.quote)}</div>
|
|
1648
|
+
<textarea id="askta" rows="3" placeholder="A question or a change to make…"></textarea>
|
|
1649
|
+
<div class="arow">${d}<span class="sp"></span>
|
|
1650
|
+
<button class="ghost" id="askcancel">Cancel</button>
|
|
1651
|
+
<button class="send" id="asksend">${n(r.send)}Comment</button>
|
|
1652
|
+
</div>`,document.body.appendChild(It);let p=window.innerWidth||1200,b=window.innerHeight||800,w=It.offsetWidth||340,v=It.offsetHeight||160,C=En.rect;It.style.left=Math.max(8,Math.min(C.left||40,p-w-8))+"px",It.style.top=Math.min((C.bottom||96)+8,b-v-8)+"px",t("#askcancel").addEventListener("click",So),t("#asksend").addEventListener("click",Gu);let E=t("#askta");E.addEventListener("keydown",L=>{L.key==="Escape"&&(L.preventDefault(),So()),L.key==="Enter"&&(L.metaKey||L.ctrlKey)&&(L.preventDefault(),Gu())});let O=t("#askmic");O&&O.addEventListener("click",sC),E.focus()}async function Gu(){let d=t("#askta"),p=(d&&d.value||"").trim();if(!p||!En)return;let{line:b,endLine:w}=nC(En),v={quote:En.quote.slice(0,300),heading:En.heading,line:b,endLine:w};So();try{let C=window.getSelection&&window.getSelection();C&&C.removeAllRanges()}catch{}await Tg(v.quote,v.heading,p,b,w)}function nC(d){let p=d&&d.blk?vg(d.blk):null,b=d&&d.endBlk?vg(d.endBlk):null;if(!p&&!b)return{line:-1,endLine:-1};let w=p||b,v=b||p;return{line:w.line,endLine:Math.max(w.endLine,v.endLine)}}function vg(d){if(!d)return null;if(d.dataset&&d.dataset.i!=null&&g.items&&g.items.length){let p=+d.dataset.i,b=(g.items[p]&&g.items[p].lines||[""]).length,w=Bv(p);return{line:w,endLine:w+Math.max(0,b-1)}}if(g.brief||g.readout||g.matchup){let p=Eg(),b=rC(d);return p&&b>=0&&b<p.length?p[b]:null}return null}function Cg(){let d=t("#doc");return d?[...d.children].filter(p=>p.nodeType===1&&!p.classList.contains("diffdel")&&!p.classList.contains("banner")&&!p.classList.contains("cnote-island")):[]}function rC(d){return Cg().indexOf(d)}function Eg(){let d=g.brief||g.readout||g.matchup;if(!d)return null;let p=x(yl(d.text||"")),b=[],w=0;for(let v of p){let C=(v.lines||[]).join(`
|
|
1653
|
+
`);v.kind==="block"&&!Rv(C)&&b.push({line:w,endLine:w+Math.max(0,(v.lines||[]).length-1)}),w+=(v.lines||[]).length}return b}function iC(d){let p=Eg();if(!p)return-1;for(let b=0;b<p.length;b++)if(d>=p[b].line&&d<=p[b].endLine)return b;return-1}async function Tg(d,p,b,w,v){let C=g.recFile;if(!C)return;let E=await T("POST","/api/comment",{file:C,quote:d,heading:p,body:b,line:w,endLine:v});g.recFile===C&&(E&&E.ok&&E.commentId?((g.comments||[]).some(O=>O.id===E.commentId)||(g.comments=[...g.comments||[],{id:E.commentId,file:E.file,anchor:{quote:d,heading:p,line:w,endLine:v},body:b,status:"open",ts:Date.now()}]),Ue(),requestAnimationFrame(()=>{wo(),wi(E.commentId)})):E&&E.error==="endpoint-missing"?vo():je(Mg(E)))}function Mg(d){return!d||d.netError?"Couldn’t reach the workbench — is it still running?":d.error==="invalid file"||d.error==="no file"?"Couldn’t save — this file can’t be annotated.":d.error==="no project"?"Couldn’t save — no project is open.":d.error?"Couldn’t save — "+d.error+".":"Couldn’t save the comment."}function oC(){return!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function sC(){let d=window.SpeechRecognition||window.webkitSpeechRecognition;if(!d)return;let p=t("#askmic"),b=t("#askta");if(it){try{it.stop()}catch{}it=null,p&&p.classList.remove("rec");return}it=new d,it.lang="en-US",it.interimResults=!1,it.onresult=w=>{let v=[...w.results].map(C=>C[0].transcript).join(" ").trim();b&&v&&(b.value=(b.value?b.value+" ":"")+v)},it.onend=()=>{p&&p.classList.remove("rec"),it=null},it.onerror=()=>{p&&p.classList.remove("rec"),it=null};try{it.start(),p&&p.classList.add("rec")}catch{it=null}}let Ag=!1;function vo(){Ag||(Ag=!0,lC())}function lC(){if(t("#stalebar"))return;let d=document.createElement("div");d.id="stalebar",d.className="stalebar",d.innerHTML=`<span>This editor is out of date — restart <code>${e($)}</code> to reconnect the comment bridge.</span><button class="x" aria-label="Dismiss">${n(r.x)}</button>`,document.body.appendChild(d),d.querySelector(".x").addEventListener("click",()=>d.remove())}let Rg=null;function je(d,p){let b=t("#dlbtoast");b||(b=document.createElement("div"),b.id="dlbtoast",b.className="caddr",document.body.appendChild(b)),b.innerHTML=(p&&p.spin?'<span class="spin"></span>':"")+`<span>${e(d)}</span>`,clearTimeout(Rg),Rg=setTimeout(()=>{b.remove()},p&&p.ms||3600)}function Xu({title:d,body:p,confirmLabel:b="Confirm",cancelLabel:w="Cancel",danger:v=!1}){return new Promise(C=>{let E=document.createElement("dialog");E.className="confirm",E.innerHTML=`<form method="dialog" class="confirm-in">
|
|
1654
|
+
<h2>${e(d)}</h2>
|
|
1655
|
+
<div class="confirm-b">${p}</div>
|
|
1656
|
+
<div class="confirm-actions">
|
|
1657
|
+
<button type="button" class="cbtn ghost" data-x="0">${e(w)}</button>
|
|
1658
|
+
<button type="submit" class="cbtn ${v?"danger":"primary"}" data-x="1">${e(b)}</button>
|
|
1659
|
+
</div>
|
|
1660
|
+
</form>`,document.body.appendChild(E);let O=!1,L=D=>{if(!O){O=!0;try{E.close()}catch{}E.remove(),C(D)}};E.querySelector('[data-x="0"]').addEventListener("click",()=>L(!1)),E.querySelector("form").addEventListener("submit",D=>{D.preventDefault(),L(!0)}),E.addEventListener("cancel",D=>{D.preventDefault(),L(!1)}),E.addEventListener("click",D=>{D.target===E&&L(!1)});try{E.showModal()}catch{E.setAttribute("open","")}(E.querySelector('[data-x="1"]')||E).focus()})}function Yu({title:d,label:p,placeholder:b="",value:w="",prefix:v="",confirmLabel:C="Create",selectEnd:E=null}){return new Promise(O=>{let L=document.createElement("dialog");L.className="confirm prompt",L.innerHTML=`<form method="dialog" class="confirm-in">
|
|
1661
|
+
<h2>${e(d)}</h2>
|
|
1662
|
+
${v?`<div class="prompt-path"><span class="prompt-path-cap">In</span><span class="prompt-path-val">${e(v.replace(/\/$/,""))}/</span></div>`:""}
|
|
1663
|
+
<label class="prompt-l">${e(p)}
|
|
1664
|
+
<span class="prompt-row"><input class="prompt-i" type="text" value="${e(w)}" placeholder="${e(b)}" autocomplete="off" spellcheck="false"></span>
|
|
1665
|
+
</label>
|
|
1666
|
+
<div class="confirm-actions">
|
|
1667
|
+
<button type="button" class="cbtn ghost" data-x="0">Cancel</button>
|
|
1668
|
+
<button type="submit" class="cbtn primary" data-x="1">${e(C)}</button>
|
|
1669
|
+
</div>
|
|
1670
|
+
</form>`,document.body.appendChild(L);let D=L.querySelector(".prompt-i"),W=!1,ie=Ie=>{if(!W){W=!0;try{L.close()}catch{}L.remove(),O(Ie)}};L.querySelector('[data-x="0"]').addEventListener("click",()=>ie(null)),L.querySelector("form").addEventListener("submit",Ie=>{Ie.preventDefault();let Lt=D.value.trim();ie(Lt||null)}),L.addEventListener("cancel",Ie=>{Ie.preventDefault(),ie(null)}),L.addEventListener("click",Ie=>{Ie.target===L&&ie(null)});try{L.showModal()}catch{L.setAttribute("open","")}setTimeout(()=>{try{D.focus(),E!=null&&D.setSelectionRange(0,E)}catch{}},0)})}function Ig(d){return new Promise(p=>{let b=document.activeElement,w=document.createElement("dialog");w.className="confirm folderpick",w.innerHTML=`<div class="confirm-in fp">
|
|
1671
|
+
<div class="fp-head">
|
|
1672
|
+
<h2>Open folder</h2>
|
|
1673
|
+
<nav class="fp-crumbs" aria-label="Folder path"></nav>
|
|
1674
|
+
</div>
|
|
1675
|
+
<div class="fp-body"><ul class="fp-list" aria-label="Sub-folders"></ul></div>
|
|
1676
|
+
<div class="fp-foot">
|
|
1677
|
+
<div class="confirm-actions">
|
|
1678
|
+
<button type="button" class="cbtn ghost" data-x="0">Cancel</button>
|
|
1679
|
+
<button type="button" class="cbtn primary" data-x="1">Open this folder</button>
|
|
1680
|
+
</div>
|
|
1681
|
+
</div>
|
|
1682
|
+
</div>`,document.body.appendChild(w);let v=w.querySelector(".fp-crumbs"),C=w.querySelector(".fp-list"),E=w.querySelector(".fp-body"),O=w.querySelector('[data-x="1"]'),L=null,D=null,W=null,ie=-1,Ie=[],Lt=!1,Mn=ue=>{if(!Lt){Lt=!0;try{w.close()}catch{}w.remove();try{b&&b.focus()}catch{}p(ue)}},af=()=>`<span class="fp-sep">${n(r.chevron)}</span>`;function cf(ue){let ve=ue.split("/").filter(Boolean),An="",Rl=[`<button type="button" class="fp-crumb" data-path="${e(D||"")}">Home</button>`];ve.forEach((Io,Il)=>{An+="/"+Io,Rl.push(af(),`<button type="button" class="fp-crumb" data-path="${e(An)}"${Il===ve.length-1?' aria-current="true"':""}>${e(Io)}</button>`)}),v.innerHTML=Rl.join(""),v.querySelectorAll(".fp-crumb").forEach(Io=>Io.addEventListener("click",()=>{let Il=Io.dataset.path||null;Il!==L&&Se(Il)}))}function Al(ue){if(Ie=ue,ie=-1,!ue.length){C.innerHTML='<li class="fp-empty">No sub-folders here. Open this folder, or go up.</li>';return}C.innerHTML=ue.map((ve,An)=>`<li><button type="button" class="fp-row" data-i="${An}" title="${e(ve.name)}">
|
|
1683
|
+
<span class="fp-fico">${n(r.folder)}</span><span class="fp-name">${e(ve.name)}</span><span class="fp-go">${n(r.chevron)}</span>
|
|
1684
|
+
</button></li>`).join(""),C.querySelectorAll(".fp-row").forEach(ve=>ve.addEventListener("click",()=>Se(ue[+ve.dataset.i].path)))}async function Se(ue){w.classList.add("fp-loading");let ve;try{ve=await T("GET","/api/browse"+(ue?"?path="+encodeURIComponent(ue):""))}catch{ve={error:"offline"}}if(w.classList.remove("fp-loading"),!ve||ve.error){L==null?(v.innerHTML="",C.innerHTML='<li class="fp-empty">Couldn’t read that folder.</li>'):je("Couldn’t open that folder.");return}L=ve.path,D=ve.home||D,W=ve.parent||null,cf(L),Al(ve.entries),E.scrollTop=0}w.addEventListener("keydown",ue=>{if(ue.key==="Escape")return ue.preventDefault(),Mn(null);if(ue.key==="Backspace"){ue.preventDefault(),W&&Se(W);return}if(ue.key==="ArrowDown"||ue.key==="ArrowUp"){if(ue.preventDefault(),!Ie.length)return;ie=ue.key==="ArrowDown"?Math.min(Ie.length-1,ie+1):Math.max(0,ie<0?0:ie-1);let ve=C.querySelectorAll(".fp-row");ve.forEach(Rl=>Rl.classList.remove("sel"));let An=ve[ie];An&&(An.classList.add("sel"),An.scrollIntoView({block:"nearest"}),An.focus());return}ue.key==="Enter"&&ie>=0&&Ie[ie]&&(ue.preventDefault(),Se(Ie[ie].path))}),w.querySelector('[data-x="0"]').addEventListener("click",()=>Mn(null)),O.addEventListener("click",()=>Mn(L)),w.addEventListener("cancel",ue=>{ue.preventDefault(),Mn(null)}),w.addEventListener("click",ue=>{ue.target===w&&Mn(null)});try{w.showModal()}catch{w.setAttribute("open","")}Se(d||null),setTimeout(()=>{try{O.focus()}catch{}},0)})}function Lg(d,p,b){Kn(p,b,[{label:"New file…",icon:"newfile",act:()=>Co(d)},{label:"New folder…",icon:"newfolder",act:()=>Qu(d)}])}async function Co(d){let p=d?d.replace(/\/?$/,"/"):"",b=await Yu({title:"New file",label:"File name",placeholder:"notes.md",prefix:p});if(b==null)return;let w=(p+b).replace(/\/{2,}/g,"/").replace(/^\//,"").trim();if(!w)return;/\.md$/i.test(w)||(w+=".md");let v=await T("POST","/api/create",{path:w,text:""});if(!v||v.error){je(v&&v.error==="exists"?"A file with that name already exists.":v&&v.error==="endpoint-missing"?`Editor is out of date — restart ${$}.`:"Could not create the file.");return}ge.event("ui.action",{area:"explorer",action:"create-file"}),await vn(),Du(v.path,{newTab:!0})}async function Qu(d){let p=d?d.replace(/\/?$/,"/"):"",b=await Yu({title:"New folder",label:"Folder name",placeholder:"ideas",prefix:p});if(b==null)return;let w=(p+b).replace(/\/{2,}/g,"/").replace(/^\//,"").replace(/\/$/,"").trim();if(!w)return;let v=await T("POST","/api/mkdir",{path:w});if(!v||v.error){je(v&&v.error==="exists"?"A folder with that name already exists.":v&&v.error==="endpoint-missing"?`Editor is out of date — restart ${$}.`:"Could not create the folder.");return}ge.event("ui.action",{area:"explorer",action:"create-folder"}),d&&ll(d),ll(v.path),await Co(v.path)}async function El(d,p){if(!d||!await Xu({title:p?"Delete folder?":"Delete file?",body:p?`This permanently deletes the folder <b>${e(ao(d))}</b> and everything inside it. This can’t be undone.`:`This permanently deletes <b>${e(ao(d))}</b>. This can’t be undone.`,confirmLabel:"Delete",danger:!0}))return;let w=await T("DELETE","/api/file",{path:d});if(!w||w.error){je(w&&w.error==="endpoint-missing"?`Editor is out of date — restart ${$}.`:"Could not delete.");return}ge.event("ui.action",{area:"explorer",action:p?"delete-folder":"delete-file"}),aC(v=>v===d||v.startsWith(d+"/")),await vn(),je(p?"Folder deleted.":"File deleted.")}function aC(d){for(let p=g.tabs.length-1;p>=0;p--){let b=g.tabs[p];b.kind==="file"&&d(b.id)&&br(p)}}let Zu=null;function cC(){Zu||(Zu=setTimeout(async()=>{Zu=null,await G(),St(),g.commentFilter&&Me()},300))}function uC(){if(window.EventSource){try{g.es&&g.es.close()}catch{}try{g.es=new EventSource("/api/events")}catch{g.es=null;return}g.es.onmessage=d=>{let p;try{p=JSON.parse(d.data)}catch{return}Ng(p)},g.es.onerror=()=>{}}}function Ng(d){if(!(!d||!d.type)){if(d.type==="fs"){mu(),gu(),Og();return}if(d.type==="addressing"){je("Agent is working through your comments…",{spin:!0,ms:8e3});return}if((d.type==="comment"||d.type==="resolve"||d.type==="delete")&&cC(),!(d.file&&d.file!==g.recFile)){if(d.type==="resolve")Sl(d.commentId),d.revised&&ef();else if(d.type==="delete")Sl(d.commentId);else if(d.type==="comment"){if(gg.has(d.comment.id))return;let p=(g.comments||[]).findIndex(b=>b.id===d.comment.id);p>=0?(g.comments[p]=d.comment,Ue()):(g.comments=[...g.comments||[],d.comment],Ue())}}}}async function ef(){if(og())return;let d=g.caseId,p;try{p=await T("GET","/api/record?id="+encodeURIComponent(d))}catch{return}if(!(g.caseId!==d||!p||p.error)){if(p.text===k(g.items)){g.rec=p;return}g.rec=p,p.text&&(g.items=x(p.text)),go(),Bt(),Ue(),g.mode==="diff"&&Tn().then(Xn),g.isGit&&(await on(),g.diffMode&&Me())}}let tf=null;function Og(){tf||(tf=setTimeout(()=>{tf=null,nf()},200))}async function nf(){if(!(g.dirty||g.saving||og())){if(g.caseId)return ef();if(g.brief){let d=g.brief.id,p;try{p=await T("GET","/api/brief?id="+encodeURIComponent(d))}catch{return}g.brief?.id===d&&p&&!p.error&&p.text!==(g.brief.text||"")&&(g.brief={id:d,...p},_u());return}if(g.readout){let d=g.readout.id,p;try{p=await T("GET","/api/readout?id="+encodeURIComponent(d))}catch{return}g.readout?.id===d&&p&&!p.error&&p.text!==(g.readout.text||"")&&(g.readout={id:d,...p},ju());return}if(g.matchup){let d=g.matchup.id,p;try{p=await T("GET","/api/matchup?id="+encodeURIComponent(d))}catch{return}g.matchup?.id===d&&p&&!p.error&&p.text!==(g.matchup.text||"")&&(g.matchup={id:d,...p},Vu());return}if(g.file&&!g.file.deleted){let d=g.file.path,p;try{p=await T("GET","/api/file?path="+encodeURIComponent(d))}catch{return}if(!p||p.error||!g.file||g.file.path!==d||(g.isGit=!!p.isGit,p.text===k(g.items)))return;g.file={path:d,...p},g.recFile=p.path||d,g.items=p.text?x(p.text):[{kind:"block",lines:[""]}],go(),Bt(),Ue(),g.mode==="diff"&&Tn().then(Xn)}}}function rf(){return g.caseId?g.rec&&g.rec.file:g.recFile}function Eo(){let d=rf();return!!(d&&(g.git.changed||[]).some(p=>p.path===d))}async function Tn(){g.diffBase=null;let d=g.caseId?"id="+encodeURIComponent(g.caseId):"path="+encodeURIComponent(rf()||""),p;try{p=await T("GET","/api/diff?"+d)}catch{p=null}p&&p.isGit&&typeof p.base=="string"&&(g.diffBase=p.base.replace(/\r\n?/g,`
|
|
1685
|
+
`))}function vi(d){let p=ye;if(!p)return;if(g.mode!=="diff"||g.diffBase==null){p.setDiff(null);return}let b=rv(g.diffBase),w=p.blockSources(),v=fC(b,w),C=new Array(w.length).fill(""),E=[],O=0,L=[],D=()=>{if(!L.length)return;let W=L.map(ie=>`<div class="diffdel" role="note" aria-label="Removed since the last commit">${y(ie)||'<p class="dempty">(removed blank line)</p>'}</div>`).join("");E.push({at:O<w.length?O:-1,html:W,key:String(E.length)}),L=[]};for(let W of v){if(W.op==="del"){L.push(W.a);continue}let ie=L.length>0;D(),W.op==="add"&&(C[O]=ie?"diff-mod":"diff-add"),O++}D(),p.setDiff({nodeClasses:C,deletions:E,count:w.length})}function Xn(){g.mode==="diff"&&(vi(!0),Bt(),bi())}function fC(d,p){let b=d.length,w=p.length;if(b*w>4e6)return[...d.map(L=>({op:"del",a:L})),...p.map(L=>({op:"add",b:L}))];let v=Array.from({length:b+1},()=>new Int32Array(w+1));for(let L=b-1;L>=0;L--)for(let D=w-1;D>=0;D--)v[L][D]=d[L]===p[D]?v[L+1][D+1]+1:Math.max(v[L+1][D],v[L][D+1]);let C=[],E=0,O=0;for(;E<b&&O<w;)d[E]===p[O]?(C.push({op:"eq",a:d[E],b:p[O]}),E++,O++):v[E+1][O]>=v[E][O+1]?(C.push({op:"del",a:d[E]}),E++):(C.push({op:"add",b:p[O]}),O++);for(;E<b;)C.push({op:"del",a:d[E]}),E++;for(;O<w;)C.push({op:"add",b:p[O]}),O++;return C}function dC(){if(!g.isGit)return"";let d=!!(g.file&&g.file.deleted),p=(g.mode==="diff"||d)&&Eo()?`<button type="button" class="tbtn danger" data-discard title="${d?"Restore this file from the last commit":"Discard all uncommitted changes in this file"}">${n(r.revert)}${d?"Restore file":"Discard changes"}</button>`:"";if(d)return`${p}<span class="rochip" title="This file was deleted — reviewing its removal">${n(r.trash)}Deleted</span>`;let b=g.mode==="diff",w=Eo()||!!g.dirty,v=w?b?"Show the document":"Show changes in this file":"No uncommitted changes in this file",C=w&&!b?'<span class="cdot" aria-hidden="true"></span>':"";return`${p}<button type="button" class="viewtoggle ${b?"on":""}" data-view="${b?"doc":"diff"}"
|
|
1686
|
+
aria-pressed="${b}" ${w?"":"disabled"} title="${v}" aria-label="${v}">${n(r.gitbranch)}${C}</button>`}function hC(d){return(g.git.changed||[]).some(p=>p.path===d&&p.status.includes("D"))}function pC(){g.caseId?ng():g.brief?_u():g.readout?ju():g.matchup?Vu():g.file&&$u()}function To(){return g.diffMode&&g.isGit?"diff":"doc"}function mC(){clearTimeout(g.saveTimer),g.saveTimer=setTimeout(of,600)}async function of(){if(!g.dirty||gl())return;let d=wl();if(g.caseId){let p=g.caseId;g.saving=!0,Yn();try{await T("POST","/api/record",{id:p,text:d}),g.caseId===p&&(g.dirty=!1,g.items=x(d),g.rec&&(g.rec.exists=!0)),ge.count("autosaves",1)}catch{}g.caseId===p&&(g.saving=!1,Yn(),await Dg());return}if(g.file){let p=g.file.path;g.saving=!0,Yn();try{await T("POST","/api/file",{path:p,text:d}),g.file&&g.file.path===p&&(g.dirty=!1,g.file.text=d,g.items=x(d)),ge.count("autosaves",1)}catch{}g.file&&g.file.path===p&&(g.saving=!1,Yn(),await Dg())}}async function Dg(){if(g.isGit)try{await on()}catch{}Mo()}function Tl(){if(ge.beacon(),Object.keys(g.cfgPending).length)try{let p=g.cfgPending;g.cfgPending={};let b=JSON.stringify({patch:p});if(navigator.sendBeacon)navigator.sendBeacon("/api/config",new Blob([b],{type:"application/json"}));else{let w=new XMLHttpRequest;w.open("POST","/api/config",!1),w.setRequestHeader("content-type","application/json"),w.send(b)}}catch{}if(g.saveTimer&&(clearTimeout(g.saveTimer),g.saveTimer=null),!g.dirty||gl())return;let d=g.caseId?{url:"/api/record",body:{id:g.caseId,text:wl()}}:g.file?{url:"/api/file",body:{path:g.file.path,text:wl()}}:null;if(d)try{let p=JSON.stringify(d.body);if(navigator.sendBeacon)navigator.sendBeacon(d.url,new Blob([p],{type:"application/json"}));else{let b=new XMLHttpRequest;b.open("POST",d.url,!1),b.setRequestHeader("content-type","application/json"),b.send(p)}g.dirty=!1}catch{}}function Yn(){let d=t("#savedot"),p=t("#savelbl");d&&(d.classList.toggle("dirty",g.dirty&&!g.saving),d.classList.toggle("saving",g.saving),p&&(p.textContent=g.saving?"Saving…":g.dirty?"Unsaved":""))}function Et(d){let p=t("#main");p&&(p.innerHTML=d);let b=t("#docdiff");b&&(b.hidden=!0,b.innerHTML=""),Au()}function Pg(){let d=t("#docdiff");if(!d)return;let p=g.caseId?Ev():"",b=g.isGit&&(g.file||g.brief||g.readout||g.matchup||g.caseId)?dC():"",w=Vv(),v=p+w+b;if(d.innerHTML=v,d.hidden=!v,!v)return;d.querySelectorAll("[data-view]").forEach(D=>D.addEventListener("click",()=>bl(D.dataset.view))),d.querySelectorAll("[data-cnav]").forEach(D=>D.addEventListener("click",()=>yg(D.dataset.cnav==="prev"?-1:1)));let C=d.querySelector("[data-discard]");C&&C.addEventListener("click",()=>Tv());let E=d.querySelector("[data-scorejump]");E&&E.addEventListener("click",N);let O=d.querySelector("[data-proto]");O&&!(g.proto&&g.proto.external)&&(O.addEventListener("click",()=>Wu()),O.addEventListener("keydown",D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),Wu())}));let L=d.querySelector("[data-buildproto]");L&&L.addEventListener("click",()=>Mv(L)),bi()}function Mo(){let d=Eo()||!!g.dirty;if(!d&&g.mode==="diff"&&(g.file||g.caseId||g.brief||g.readout||g.matchup)){bl("doc");return}let p=t("#docdiff");if(!p||p.hidden)return;let b=p.querySelector(".viewtoggle");if(!b)return;let w=g.mode==="diff";b.disabled=!d&&!w;let v=d?w?"Show the document":"Show changes in this file":"No uncommitted changes in this file";b.title=v,b.setAttribute("aria-label",v);let C=b.querySelector(".cdot");d&&!w?C||(C=document.createElement("span"),C.className="cdot",C.setAttribute("aria-hidden","true"),b.appendChild(C)):C&&C.remove()}function Ao(d,p){return`<div class="canvaswrap"><div class="empty"><h2>${e(d)}</h2><p>${p}</p></div></div>`}function gC(d,p,b){return`<div class="canvaswrap"><div class="hero">
|
|
1687
|
+
<span class="hero-mark" aria-hidden="true"><i></i></span>
|
|
1688
|
+
<h1 class="hero-name">${e(P)}</h1>
|
|
1689
|
+
${d?`<p class="hero-sub">${e(d)}</p>`:""}
|
|
1690
|
+
${b?`<div class="hero-actions">${b}</div>`:""}
|
|
1691
|
+
${p?`<p class="hero-hint">${p}</p>`:""}
|
|
1692
|
+
</div></div>`}function yC(){document.body.classList.add("nav-open")}function Ml(){document.body.classList.remove("nav-open")}let ge=(()=>{let d=!1,p=[],b=null,w=new Set,v=Object.create(null),C=Object.create(null),E=Object.create(null),O=()=>{p=[];for(let Se of Object.keys(v))delete v[Se];for(let Se of Object.keys(C))delete C[Se];for(let Se of Object.keys(E))delete E[Se]},L=()=>p.length||Object.keys(v).length||Object.keys(C).length||Object.keys(E).length,D=()=>{!d||b||(b=setTimeout(()=>{b=null,ie()},1e4),b&&b.unref&&b.unref())},W=()=>{let Se={events:p,counters:{...v},gauges:{...C},histograms:{...E}};return O(),Se};async function ie(){if(d&&L()){let Se=W();try{let ue;ue=T("POST","/api/telemetry",Se).catch(()=>{}).finally(()=>w.delete(ue)),w.add(ue)}catch{}}w.size&&await Promise.all([...w])}function Ie(){if(!d||!L())return;let Se=W();try{navigator.sendBeacon?navigator.sendBeacon("/api/telemetry",new Blob([JSON.stringify(Se)],{type:"application/json"})):T("POST","/api/telemetry",Se)}catch{}}let Lt=()=>{if(typeof PerformanceObserver=="function")try{new PerformanceObserver(ue=>{for(let ve of ue.getEntries())ve.duration&&Al("inp_ms",Math.round(ve.duration))}).observe({type:"event",buffered:!0,durationThreshold:40})}catch{}};function Mn(Se,ue){d&&(p.push({name:Se,props:ue||{}}),p.length>=40?ie():D())}function af(Se,ue){d&&(v[Se]=(v[Se]||0)+(Number(ue)||0),D())}function cf(Se,ue){if(!d)return;let ve=Number(ue);!Number.isFinite(ve)||ve<0||(C[Se]=ve,D())}function Al(Se,ue){if(!d)return;let ve=Number(ue);Number.isFinite(ve)&&((E[Se]||(E[Se]=[])).push(ve),D())}return{setEnabled(Se){let ue=d;d=!!Se,d?ue||Lt():O()},isEnabled(){return d},event:Mn,count:af,gauge:cf,observe:Al,flush:ie,beacon:Ie,_buffers(){return{queue:p,counters:v,gauges:C,histos:E,inFlight:w}}}})();function sf(){Ct("");let d=g.feedbackDraft||{category:"other",message:"",sentiment:null,contact:""},p={other:"Tell us what is working, what is not, or anything else you want us to know.",idea:"What are you trying to achieve, and what gets in the way today? Describe the problem—not the solution you think should be built.",bug:"What happened? Describe what you expected, what happened instead, and the precise steps to reproduce it."},b=[{value:"other",label:"General",note:"Thoughts, questions, or praise"},{value:"idea",label:"Feature request",note:"A problem you cannot solve today"},{value:"bug",label:"Bug report",note:"Something is not working"}],w=[{value:"up",label:"Positive",icon:"thumbUp"},{value:"down",label:"Could be better",icon:"thumbDown"},{value:"excited",label:"Excited",icon:"rocket"}];Et(`<div class="feedback-wrap"><form class="feedback-page" id="feedback-page" novalidate>
|
|
1693
|
+
<header class="feedback-head">
|
|
1694
|
+
<h1>Send feedback</h1><p>Tell us what would make Sonorance more useful.</p>
|
|
1695
|
+
</header>
|
|
1696
|
+
<div class="feedback-form">
|
|
1697
|
+
<fieldset class="feedback-type"><legend>What kind of feedback?</legend>
|
|
1698
|
+
<div class="feedback-type-options" role="radiogroup" aria-label="Feedback type">
|
|
1699
|
+
${b.map(L=>`<button type="button" class="feedback-type-option ${d.category===L.value?"selected":""}" role="radio" aria-checked="${d.category===L.value}" tabindex="${d.category===L.value?0:-1}" data-feedback-category="${L.value}">
|
|
1700
|
+
<strong>${L.label}</strong><small>${L.note}</small>
|
|
1701
|
+
</button>`).join("")}
|
|
1702
|
+
</div>
|
|
1703
|
+
</fieldset>
|
|
1704
|
+
<label class="feedback-field" id="fbmsgl"><span>${d.category==="bug"?"What went wrong?":"Your feedback"}</span>
|
|
1705
|
+
<textarea id="fbmsg" rows="6" placeholder="${e(p[d.category]||p.other)}">${e(d.message)}</textarea>
|
|
1706
|
+
</label>
|
|
1707
|
+
<label class="feedback-field compact"><span>Email <em>Optional, for a reply</em></span>
|
|
1708
|
+
<input type="email" id="fbcontact" value="${e(d.contact)}" placeholder="you@example.com" autocomplete="email">
|
|
1709
|
+
</label>
|
|
1710
|
+
<fieldset class="feedback-sentiment"><legend>Sentiment <span>Optional</span></legend>
|
|
1711
|
+
<div class="feedback-sentiment-options" role="group" aria-label="Sentiment">
|
|
1712
|
+
${w.map(L=>`<button type="button" class="feedback-sentiment-option ${d.sentiment===L.value?"selected":""}" data-sentiment="${L.value}" aria-label="${L.label}" aria-pressed="${d.sentiment===L.value}" title="${L.label}">${n(r[L.icon])}<span>${L.label}</span></button>`).join("")}
|
|
1713
|
+
</div>
|
|
1714
|
+
</fieldset>
|
|
1715
|
+
<div class="feedback-trust">${n(r.check)}<span>Only this form is submitted. Sonorance never reads your documents to create feedback.</span></div>
|
|
1716
|
+
<p class="fb-note" id="fbhint" role="status"></p>
|
|
1717
|
+
<div class="fb-actions"><button class="fb-send tbtn" id="fbsend" type="submit">${n(r.send)}Send feedback</button></div>
|
|
1718
|
+
</div>
|
|
1719
|
+
</form></div>`);let v=t("#feedback-page"),C=[...v.querySelectorAll("[data-feedback-category]")],E=()=>{g.feedbackDraft={category:v.dataset.category,message:v.querySelector("#fbmsg").value,sentiment:v.dataset.sentiment||null,contact:v.querySelector("#fbcontact").value}},O=L=>{let D=L.dataset.feedbackCategory;v.dataset.category=D,C.forEach(W=>{let ie=W===L;W.classList.toggle("selected",ie),W.setAttribute("aria-checked",String(ie)),W.tabIndex=ie?0:-1}),v.querySelector("#fbmsgl span").textContent=D==="bug"?"What went wrong?":"Your feedback",v.querySelector("#fbmsg").placeholder=p[D]||p.other,E()};v.dataset.category=d.category,v.dataset.sentiment=d.sentiment||"",C.forEach((L,D)=>{L.addEventListener("click",()=>O(L)),L.addEventListener("keydown",W=>{let ie=null;W.key==="ArrowRight"||W.key==="ArrowDown"?ie=(D+1)%C.length:W.key==="ArrowLeft"||W.key==="ArrowUp"?ie=(D-1+C.length)%C.length:W.key==="Home"?ie=0:W.key==="End"&&(ie=C.length-1),ie!=null&&(W.preventDefault(),O(C[ie]),C[ie].focus())})}),v.querySelectorAll('textarea,input[type="email"]').forEach(L=>L.addEventListener("input",E)),v.querySelectorAll("[data-sentiment]").forEach(L=>L.addEventListener("click",()=>{let D=v.dataset.sentiment===L.dataset.sentiment?"":L.dataset.sentiment;v.dataset.sentiment=D,v.querySelectorAll("[data-sentiment]").forEach(W=>{let ie=W.dataset.sentiment===D;W.classList.toggle("selected",ie),W.setAttribute("aria-pressed",String(ie))}),E()})),v.addEventListener("submit",L=>{L.preventDefault(),E(),zg(v,v.dataset.sentiment||null)})}function bC(){Iu()}function xC(){let d=g.tabs.findIndex(p=>p.kind==="feedback");d>=0&&br(d)}async function zg(d,p){let b=d.dataset.category,w=d.querySelector("#fbmsg").value.trim(),v=d.querySelector("#fbhint");if(!w){v.textContent="Please add a few words before sending.",v.classList.add("warn");return}let C={category:b,message:w,rating:p,contact:d.querySelector("#fbcontact").value.trim()||null},E=d.querySelector("#fbsend");E.disabled=!0,E.textContent="Sending…";let O=await T("POST","/api/feedback",C);O&&O.ok?(g.feedbackDraft=null,sf(),Bg("Thanks — your feedback was sent.")):(E.disabled=!1,E.innerHTML=`${n(r.send)}Send feedback`,v.textContent="Could not send right now — it was saved locally and you can try again.",v.classList.add("warn"))}function Bg(d){let p=t("#dlbtoast");p&&p.remove(),p=document.createElement("div"),p.id="dlbtoast",p.className="dlb-toast",p.textContent=d,document.body.appendChild(p),requestAnimationFrame(()=>p.classList.add("show")),setTimeout(()=>{p.classList.remove("show"),setTimeout(()=>p.remove(),300)},2600)}async function Fg(d){let p=!(g.telemetry&&g.telemetry.enabled===!1),b=await T("POST","/api/consent",{enabled:!!d});if(!b||!b.ok)return p;let w=b.enabled!==!1;return g.telemetry={enabled:w},ge.setEnabled(w),w}async function xr(){Pu=null,nn(Le()),vC(),Hg(),t("#scrim")&&t("#scrim").addEventListener("click",Ml);let d=t("#tabadd");d&&!d.__wired&&(d.__wired=!0,d.addEventListener("click",fl));let p=t("#tabscrollL");p&&!p.__wired&&(p.__wired=!0,p.addEventListener("click",()=>Mu(-1)));let b=t("#tabscrollR");b&&!b.__wired&&(b.__wired=!0,b.addEventListener("click",()=>Mu(1)));let w=t("#tabs");w&&!w.__wired&&(w.__wired=!0,w.addEventListener("scroll",uo,{passive:!0}));let v=t("#navbtn");v&&!v.__wired&&(v.__wired=!0,v.addEventListener("click",yC));let C=t("#inboxbtn");C&&!C.__wired&&(C.__wired=!0,C.addEventListener("click",()=>{Ml(),fl()}));let E=t("#settingsbtn");E&&!E.__wired&&(E.__wired=!0,E.addEventListener("click",qm));let O=t("#feedbackbtn");O&&!O.__wired&&(O.__wired=!0,O.addEventListener("click",Iu)),document.__selWired||(document.__selWired=!0,document.addEventListener("selectionchange",Ov)),window.__saveGuardWired||(window.__saveGuardWired=!0,window.addEventListener("pagehide",Tl),window.addEventListener("beforeunload",Tl),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Tl()})),SC();{g.projectSlug=vt().project||null;let L=await T("GET","/api/state");if(L&&(L.error==="endpoint-missing"||!L.error&&!L.netError&&L.bridge!==!0)&&vo(),L&&!L.error){Object.assign(g,{project:L.project,projects:L.projects||[],cases:L.cases||[],briefs:L.briefs||[],readouts:L.readouts||[],matchups:L.matchups||[],kinds:L.kinds||[],isGit:!!L.isGit}),g.telemetry=L.telemetry||{enabled:!0},ge.setEnabled(g.telemetry.enabled!==!1),g.projectSlug=L.project?L.project.id:null;try{document.title=P}catch{}g.tabs=(L.tabs||[]).filter(D=>D&&(D.kind==="inbox"||D.kind==="settings"||D.kind==="feedback"||D.kind==="file"||(D.kind==="brief"?g.briefs.some(W=>W.id===D.id):D.kind==="readout"?g.readouts.some(W=>W.id===D.id):D.kind==="matchup"?g.matchups.some(W=>W.id===D.id):g.cases.some(W=>W.id===D.id)))).map(D=>({kind:D.kind,id:D.id||void 0})),g.activeTab=-1,g._bootActive=L.activeTab||null,g.explorer=L.explorer&&L.explorer.mode?{mode:L.explorer.mode==="expanded"?"expanded":"collapsed",ex:new Set(Array.isArray(L.explorer.ex)?L.explorer.ex:[])}:{mode:"collapsed",ex:new Set};try{let D=await T("GET","/api/tree");g.tree=D&&!D.error&&D.tree||[],g.treeBase=D&&typeof D.base=="string"?D.base:"",g.inventory=D&&D.inventory||{cases:g.cases.length,briefs:g.briefs.length,readouts:g.readouts.length,matchups:g.matchups.length}}catch{g.tree=[],g.treeBase="",g.inventory={cases:g.cases.length,briefs:g.briefs.length,readouts:g.readouts.length,matchups:g.matchups.length}}await on(),await G()}else g.cases=[],g.briefs=[],g.readouts=[],g.matchups=[],g.inventory=null,g.kinds=[],g.tree=[],g.projects=[],g.tabs=[],g._bootActive=null,g.explorer={mode:"collapsed",ex:new Set}}uC(),yu(),le(),Me(),co(),wC(),await pl(),Sn()}function lf(d){return d.kind==="inbox"?"/inbox":d.kind==="settings"?"/settings":d.kind==="feedback"?"/feedback":d.kind==="file"?"/file/"+po(d.id):(d.kind==="brief"?"/brief/":d.kind==="readout"?"/readout/":d.kind==="matchup"?"/matchup/":"/case/")+d.id}function kC(d){return d?d.kind==="inbox"?g.tabs.some(p=>p.kind==="inbox"):d.kind==="settings"?g.tabs.some(p=>p.kind==="settings"):d.kind==="feedback"?g.tabs.some(p=>p.kind==="feedback"):d.kind==="file"?g.tabs.some(p=>p.kind==="file"&&p.id===d.id):d.kind==="brief"?g.briefs.some(p=>p.id===d.id)&&g.tabs.some(p=>p.kind==="brief"&&p.id===d.id):d.kind==="readout"?g.readouts.some(p=>p.id===d.id)&&g.tabs.some(p=>p.kind==="readout"&&p.id===d.id):d.kind==="matchup"?g.matchups.some(p=>p.id===d.id)&&g.tabs.some(p=>p.kind==="matchup"&&p.id===d.id):g.cases.some(p=>p.id===d.id)&&g.tabs.some(p=>p.kind==="case"&&p.id===d.id):!1}function wC(){let d=g.project?"/p/"+encodeURIComponent(g.project.id):"",p=vt(),b=p.name==="case"&&g.cases.some(C=>C.id===p.id)||p.name==="brief"&&g.briefs.some(C=>C.id===p.id)||p.name==="readout"&&g.readouts.some(C=>C.id===p.id)||p.name==="matchup"&&g.matchups.some(C=>C.id===p.id)||p.name==="file"&&g.tabs.some(C=>C.kind==="file"&&C.id===p.id)||p.name==="inbox"&&g.tabs.some(C=>C.kind==="inbox")||p.name==="settings"||p.name==="feedback",w=null;b?w=lf({kind:p.name,id:p.id}):kC(g._bootActive)?w=lf(g._bootActive):g.tabs.length&&(w=lf({kind:g.tabs[0].kind,id:g.tabs[0].id}));let v=d+(w||"/");location.pathname!==v&&history.replaceState({},"",v)}function SC(){let d=!1;try{d=window.matchMedia("(prefers-reduced-motion:reduce)").matches}catch{}let p=document.documentElement;if(!d){let w=!1,v=null,C=t("#main"),E=()=>{p.classList.contains("scrolling")||p.classList.add("scrolling"),clearTimeout(v),v=setTimeout(()=>p.classList.remove("scrolling"),140),!w&&(w=!0,requestAnimationFrame(()=>{let O=C?C.scrollTop:0;p.style.setProperty("--py",String(Math.min(O*.46,720))),w=!1}))};C&&C.addEventListener("scroll",E,{passive:!0})}let b;window.addEventListener("resize",()=>{p.classList.add("resizing"),fo(),uo(),clearTimeout(b),b=setTimeout(()=>{p.classList.remove("resizing"),al(),fo(),uo(),bi(),(g.file||g.caseId||g.brief||g.readout||g.matchup)&&Ue()},180)},{passive:!0})}let $g=288;function _g(d){let p=getComputedStyle(document.documentElement),b=parseInt(p.getPropertyValue("--sb-min"))||220,w=parseInt(p.getPropertyValue("--sb-max"))||560;return Math.max(b,Math.min(w,Math.round(d)))}function Ro(){return parseInt(getComputedStyle(document.documentElement).getPropertyValue("--sb"))||$g}function kr(d,p){let b=_g(d);if(document.documentElement.style.setProperty("--sb",b+"px"),p)try{localStorage.setItem("dlb-sb",String(b))}catch{}return al(),fo(),b}function vC(){let d;try{d=parseInt(localStorage.getItem("dlb-sb")||"",10)}catch{}d&&document.documentElement.style.setProperty("--sb",_g(d)+"px")}function Hg(){let d=t("#sbresize");if(!d||d.__wired)return;d.__wired=!0;let p=0,b=0,w=!1,v=E=>{w&&kr(b+(E.clientX-p),!1)},C=()=>{if(w){w=!1,document.body.classList.remove("resizing-sb"),window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",C);try{localStorage.setItem("dlb-sb",String(Ro()))}catch{}}};d.addEventListener("pointerdown",E=>{E.button===0&&(E.preventDefault(),w=!0,p=E.clientX,b=Ro(),document.body.classList.add("resizing-sb"),window.addEventListener("pointermove",v),window.addEventListener("pointerup",C))}),d.addEventListener("dblclick",()=>kr($g,!0)),d.addEventListener("keydown",E=>{let O=E.key;O==="ArrowLeft"?(E.preventDefault(),kr(Ro()-16,!0)):O==="ArrowRight"?(E.preventDefault(),kr(Ro()+16,!0)):O==="Home"?(E.preventDefault(),kr(0,!0)):O==="End"&&(E.preventDefault(),kr(9999,!0))})}try{window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{Le()||nn("")})}catch{}window.DLB={renderMarkdown:y,inline:a,segment:x,reconstruct:k,verdict:S,boot:xr,render:pl,navigate:ln,resolveAssetSrc:l,openDocLink:ig,openCase:Xm,openBrief:Bu,openReadout:Hu,openMatchup:qu,renderInbox:Jm,renderSettings:Km,renderFeedback:sf,applyTheme:nn,openCaseTab:Ru,openBriefTab:Lu,openReadoutTab:Nu,openMatchupTab:Ou,openInboxTab:fl,openSettingsTab:qm,openFeedbackTab:Iu,closeTab:br,closeOthers:Vm,closeAll:Wm,switchProject:Hm,projMenu:$m,openFolderPrompt:_m,folderDialog:Ig,removeVault:Eu,briefLabel:cl,readoutLabel:vu,matchupLabel:Cu,fillExplorer:St,renderTree:Rm,pruneTree:Su,matchFileNode:Fm,toggleFolder:zm,folderOpen:ke,collapseAllFolders:sn,expandAllFolders:zt,toggleCollapseAll:Jn,allTopCollapsed:We,queueConfig:B,flushConfig:H,queueExplorer:de,openFile:Fu,openFileTab:Du,renderLive:go,renderComments:Ue,submitComment:Gu,createComment:Tg,maybeStale:vo,handleBridgeEvent:Ng,loadComments:mi,openCommentPop:hg,focusComment:wi,deleteCommentUI:mg,dropComment:Sl,stepComment:yg,startEditComment:dg,commentOnBlock:Ku,currentSource:wl,reloadOpenDoc:nf,scheduleDocReload:Og,flushSave:Cn,flushOnUnload:Tl,saveNow:of,applyTrimTitles:al,setSidebarWidth:kr,initSidebarResize:Hg,curSb:Ro,setDiffMode:so,refreshTree:vn,promptNewFile:Co,promptNewFolder:Qu,confirmDeleteEntry:El,moveEntry:Im,renameEntry:ku,validDrop:xu,dropDirFor:bu,route:vt,encFilePath:po,decFilePath:Um,updateTabMark:Au,measureTabMark:fo,updateTabScroll:uo,nudgeTabs:Mu,syncDocDiff:Mo,reserveRailForControls:bi,dirGitStatus:I,loadDiffBase:Tn,applyDiffDecorations:vi,refreshDiffDecorations:Xn,buildToc:Bt,maybeShowAsk:()=>xg(t("#doc")),maybeShowTableTools:vl,openAtComment:Sg,openFeedback:bC,closeFeedback:xC,submitFeedbackUI:zg,setTelemetryConsent:Fg,tel:()=>ge,wysiwyg:()=>ye,setMode:bl,state:()=>g},window.__DLB_NO_AUTOBOOT||(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",xr):xr())})();})();
|
|
1720
|
+
|
|
1721
|
+
</script>
|
|
1722
|
+
</body>
|
|
1723
|
+
</html>
|