@oomol-lab/open-flow 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +47 -0
  3. package/README.md +18 -0
  4. package/dist/browser/_virtual_open-flow-twemoji-DJwKsM_w.js +5067 -0
  5. package/dist/browser/addNodeOptions-DqoIueCR.js +33746 -0
  6. package/dist/browser/assets/font-00b26ac825e20950.woff2 +0 -0
  7. package/dist/browser/assets/font-036d4e95149b69ff.woff2 +0 -0
  8. package/dist/browser/assets/font-07d8e303ce4fc12b.ttf +0 -0
  9. package/dist/browser/assets/font-08ce98e51b04d589.ttf +0 -0
  10. package/dist/browser/assets/font-0cdd387c9590a1a9.woff2 +0 -0
  11. package/dist/browser/assets/font-0d85ae7cc30f2379.ttf +0 -0
  12. package/dist/browser/assets/font-0f60d1b897938ec9.woff2 +0 -0
  13. package/dist/browser/assets/font-11e4dc8a6471ff6d.woff +0 -0
  14. package/dist/browser/assets/font-138ac28d1663b303.ttf +0 -0
  15. package/dist/browser/assets/font-1ae6bd7475590e97.woff +0 -0
  16. package/dist/browser/assets/font-1c67f068fea8bb09.ttf +0 -0
  17. package/dist/browser/assets/font-1e6f9579e90e2cac.ttf +0 -0
  18. package/dist/browser/assets/font-1ece03f79f95277d.ttf +0 -0
  19. package/dist/browser/assets/font-2014c523c3210bcc.woff +0 -0
  20. package/dist/browser/assets/font-30da91e84c893f87.woff +0 -0
  21. package/dist/browser/assets/font-3398dd02302557a7.woff +0 -0
  22. package/dist/browser/assets/font-3931dd81faed86ba.ttf +0 -0
  23. package/dist/browser/assets/font-500e04d54f0d5166.ttf +0 -0
  24. package/dist/browser/assets/font-51814d270d06ff02.woff2 +0 -0
  25. package/dist/browser/assets/font-5d53e70ad607c235.woff2 +0 -0
  26. package/dist/browser/assets/font-5e28753be717dac9.woff +0 -0
  27. package/dist/browser/assets/font-68534840bcfdd2bf.ttf +0 -0
  28. package/dist/browser/assets/font-68e8c73ef42afd3c.woff2 +0 -0
  29. package/dist/browser/assets/font-6ab6b62e9b62dae2.woff +0 -0
  30. package/dist/browser/assets/font-6b47c40166b6dbe2.woff2 +0 -0
  31. package/dist/browser/assets/font-70ee1f64a20f2048.ttf +0 -0
  32. package/dist/browser/assets/font-71d517d67827787c.woff2 +0 -0
  33. package/dist/browser/assets/font-73d591271b160496.woff2 +0 -0
  34. package/dist/browser/assets/font-74444efd593c005e.woff2 +0 -0
  35. package/dist/browser/assets/font-7af58c5ec8f132a2.woff2 +0 -0
  36. package/dist/browser/assets/font-850c0af5c2238497.woff +0 -0
  37. package/dist/browser/assets/font-8a8d244581371912.woff +0 -0
  38. package/dist/browser/assets/font-9163df9c7122432e.ttf +0 -0
  39. package/dist/browser/assets/font-91ee67500cc0129a.woff +0 -0
  40. package/dist/browser/assets/font-95b6d2f1a50173bf.ttf +0 -0
  41. package/dist/browser/assets/font-97479ca6cce906ab.woff2 +0 -0
  42. package/dist/browser/assets/font-99cd42a3c072d918.woff2 +0 -0
  43. package/dist/browser/assets/font-99f9c6750b489c94.woff +0 -0
  44. package/dist/browser/assets/font-9be7ceb88004ab8a.woff +0 -0
  45. package/dist/browser/assets/font-a4af7d414440a1c1.woff2 +0 -0
  46. package/dist/browser/assets/font-a6b2099fb555c60e.ttf +0 -0
  47. package/dist/browser/assets/font-a6f7ec0d846ac7ad.woff +0 -0
  48. package/dist/browser/assets/font-c2342cd8b869e017.woff2 +0 -0
  49. package/dist/browser/assets/font-c6368d87e8a1a3a5.woff +0 -0
  50. package/dist/browser/assets/font-c647367d1dd4e162.ttf +0 -0
  51. package/dist/browser/assets/font-c76c5d696297d51b.woff +0 -0
  52. package/dist/browser/assets/font-c943cc986384f59e.woff +0 -0
  53. package/dist/browser/assets/font-d0332f52868370fd.ttf +0 -0
  54. package/dist/browser/assets/font-d04c54219f9eaec6.woff2 +0 -0
  55. package/dist/browser/assets/font-d96cdf2b3bdd4d64.woff +0 -0
  56. package/dist/browser/assets/font-dc47344dbb6cb5b6.woff2 +0 -0
  57. package/dist/browser/assets/font-de7701e42cf1f4cf.woff2 +0 -0
  58. package/dist/browser/assets/font-e14fed02b1aba7ce.woff +0 -0
  59. package/dist/browser/assets/font-e99ae51144bf1232.woff2 +0 -0
  60. package/dist/browser/assets/font-ece03cfd83e22c21.woff +0 -0
  61. package/dist/browser/assets/font-ed0b74372feefcbb.ttf +0 -0
  62. package/dist/browser/assets/font-f01f3e87d9c6a61c.ttf +0 -0
  63. package/dist/browser/assets/font-f1d6ef86f3b11a52.woff +0 -0
  64. package/dist/browser/assets/font-f36ea897e19f4a2e.ttf +0 -0
  65. package/dist/browser/assets/font-f9377ab0271cda59.ttf +0 -0
  66. package/dist/browser/carbon-nMY84Amv.js +53 -0
  67. package/dist/browser/composite-7VwgfnXx.js +6088 -0
  68. package/dist/browser/createResourceDialog-ByuJWdSL.js +439 -0
  69. package/dist/browser/dist-7oZK9QXZ.js +50088 -0
  70. package/dist/browser/dist-B9OV3YTx.js +881 -0
  71. package/dist/browser/dist-BLk5M0uK.js +1816 -0
  72. package/dist/browser/dist-BbyiRq3c.js +3285 -0
  73. package/dist/browser/dist-CIq6ue3I.js +6646 -0
  74. package/dist/browser/dist-CLZJNoWB.js +89 -0
  75. package/dist/browser/dist-CvcmLAMW.js +1620 -0
  76. package/dist/browser/dist-DL0SDskM.js +2327 -0
  77. package/dist/browser/dist-Djd02JSy.js +1247 -0
  78. package/dist/browser/dist-aWSZx4q1.js +850 -0
  79. package/dist/browser/dist-n-z5HtaO.js +4 -0
  80. package/dist/browser/dist-o4dBuwiG.js +320 -0
  81. package/dist/browser/dist-zyY--HOV.js +1543 -0
  82. package/dist/browser/esm-DXw7EADW.js +218 -0
  83. package/dist/browser/favicon.svg +7 -0
  84. package/dist/browser/flowWorkspace-DwVMpcar.js +22092 -0
  85. package/dist/browser/lib-S4ccuMeT.js +7857 -0
  86. package/dist/browser/licenses.md +4973 -0
  87. package/dist/browser/markdownContent-ZZFfSRqO.js +44545 -0
  88. package/dist/browser/project-change.d.ts +311 -0
  89. package/dist/browser/project-change.js +259 -0
  90. package/dist/browser/project-notifications.d.ts +12 -0
  91. package/dist/browser/rolldown-runtime-CEFd7nDs.js +30 -0
  92. package/dist/browser/workbench-contract.d.ts +28 -0
  93. package/dist/browser/workbench.css +2 -0
  94. package/dist/browser/workbench.css.d.ts +1 -0
  95. package/dist/browser/workbench.d.ts +14 -0
  96. package/dist/browser/workbench.js +3364 -0
  97. package/dist/common/connector-action.d.ts +20 -0
  98. package/dist/common/connector-action.js +106 -0
  99. package/dist/common/connector-proxy.d.ts +14 -0
  100. package/dist/common/connector-proxy.js +0 -0
  101. package/dist/common/control-api-conformance.d.ts +13 -0
  102. package/dist/common/control-api-conformance.js +518 -0
  103. package/dist/common/control-api-errors.d.ts +121 -0
  104. package/dist/common/control-api.d.ts +349 -0
  105. package/dist/common/control-api.js +884 -0
  106. package/dist/common/cron-trigger.d.ts +21 -0
  107. package/dist/common/cron-trigger.js +834 -0
  108. package/dist/common/engine-contract.d.ts +7 -0
  109. package/dist/common/favicon.svg +7 -0
  110. package/dist/common/integration-trigger.d.ts +111 -0
  111. package/dist/common/integration-trigger.js +290 -0
  112. package/dist/common/licenses.md +27 -0
  113. package/dist/common/poll-trigger.d.ts +69 -0
  114. package/dist/common/poll-trigger.js +155 -0
  115. package/dist/common/project-encoding.d.ts +11 -0
  116. package/dist/common/project-encoding.js +242 -0
  117. package/dist/common/project-notifications.d.ts +12 -0
  118. package/dist/common/project-semantics.d.ts +55 -0
  119. package/dist/common/project-semantics.js +8687 -0
  120. package/dist/common/provider-triggers.d.ts +6 -0
  121. package/dist/common/provider-triggers.js +4614 -0
  122. package/dist/common/run-events.d.ts +9 -0
  123. package/dist/common/run-events.js +192 -0
  124. package/dist/common/run-lifecycle.d.ts +69 -0
  125. package/dist/common/run-lifecycle.js +169 -0
  126. package/dist/common/runtime-contract.d.ts +53 -0
  127. package/dist/common/runtime-contract.js +151 -0
  128. package/dist/common/scheduler.d.ts +99 -0
  129. package/dist/common/scheduler.js +379 -0
  130. package/dist/common/webhook-trigger.d.ts +22 -0
  131. package/dist/common/webhook-trigger.js +270 -0
  132. package/dist/index.d.ts +66 -0
  133. package/package.json +102 -0
@@ -0,0 +1,1816 @@
1
+ import { r as e } from "./rolldown-runtime-CEFd7nDs.js";
2
+ //#region ../../node_modules/@marijn/find-cluster-break/src/index.js
3
+ var t = [], n = [];
4
+ (() => {
5
+ let e = "lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e) => e ? parseInt(e, 36) : 1);
6
+ for (let r = 0, i = 0; r < e.length; r++) (r % 2 ? n : t).push(i += e[r]);
7
+ })();
8
+ function r(e) {
9
+ if (e < 768) return !1;
10
+ for (let r = 0, i = t.length;;) {
11
+ let a = r + i >> 1;
12
+ if (e < t[a]) i = a;
13
+ else if (e >= n[a]) r = a + 1;
14
+ else return !0;
15
+ if (r == i) return !1;
16
+ }
17
+ }
18
+ function i(e) {
19
+ return e >= 127462 && e <= 127487;
20
+ }
21
+ var a = 8205;
22
+ function o(e, t, n = !0, r = !0) {
23
+ return (n ? s : c)(e, t, r);
24
+ }
25
+ function s(e, t, n) {
26
+ if (t == e.length) return t;
27
+ t && u(e.charCodeAt(t)) && d(e.charCodeAt(t - 1)) && t--;
28
+ let o = l(e, t);
29
+ for (t += f(o); t < e.length;) {
30
+ let s = l(e, t);
31
+ if (o == a || s == a || n && r(s)) t += f(s), o = s;
32
+ else if (i(s)) {
33
+ let n = 0, r = t - 2;
34
+ for (; r >= 0 && i(l(e, r));) n++, r -= 2;
35
+ if (n % 2 == 0) break;
36
+ t += 2;
37
+ } else break;
38
+ }
39
+ return t;
40
+ }
41
+ function c(e, t, n) {
42
+ for (; t > 1;) {
43
+ let r = s(e, t - 2, n);
44
+ if (r < t) return r;
45
+ t--;
46
+ }
47
+ return 0;
48
+ }
49
+ function l(e, t) {
50
+ let n = e.charCodeAt(t);
51
+ if (!d(n) || t + 1 == e.length) return n;
52
+ let r = e.charCodeAt(t + 1);
53
+ return u(r) ? (n - 55296 << 10) + (r - 56320) + 65536 : n;
54
+ }
55
+ function u(e) {
56
+ return e >= 56320 && e < 57344;
57
+ }
58
+ function d(e) {
59
+ return e >= 55296 && e < 56320;
60
+ }
61
+ function f(e) {
62
+ return e < 65536 ? 1 : 2;
63
+ }
64
+ //#endregion
65
+ //#region ../../node_modules/@codemirror/state/dist/index.js
66
+ var ee = /* @__PURE__ */ e({
67
+ Annotation: () => B,
68
+ AnnotationType: () => Ae,
69
+ ChangeDesc: () => S,
70
+ ChangeSet: () => C,
71
+ CharCategory: () => W,
72
+ Compartment: () => I,
73
+ EditorSelection: () => O,
74
+ EditorState: () => G,
75
+ Facet: () => k,
76
+ Line: () => ae,
77
+ MapMode: () => x,
78
+ Prec: () => ye,
79
+ Range: () => J,
80
+ RangeSet: () => Y,
81
+ RangeSetBuilder: () => X,
82
+ RangeValue: () => K,
83
+ SelectionRange: () => D,
84
+ StateEffect: () => V,
85
+ StateEffectType: () => je,
86
+ StateField: () => N,
87
+ Text: () => p,
88
+ Transaction: () => H,
89
+ codePointAt: () => ce,
90
+ codePointSize: () => ue,
91
+ combineConfig: () => Ue,
92
+ countColumn: () => et,
93
+ findClusterBreak: () => y,
94
+ findColumn: () => tt,
95
+ fromCodePoint: () => le
96
+ }), p = class e {
97
+ lineAt(e) {
98
+ if (e < 0 || e > this.length) throw RangeError(`Invalid position ${e} in document of length ${this.length}`);
99
+ return this.lineInner(e, !1, 1, 0);
100
+ }
101
+ line(e) {
102
+ if (e < 1 || e > this.lines) throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);
103
+ return this.lineInner(e, !0, 1, 0);
104
+ }
105
+ replace(e, t, n) {
106
+ [e, t] = v(this, e, t);
107
+ let r = [];
108
+ return this.decompose(0, e, r, 2), n.length && n.decompose(0, n.length, r, 3), this.decompose(t, this.length, r, 1), h.from(r, this.length - (t - e) + n.length);
109
+ }
110
+ append(e) {
111
+ return this.replace(this.length, this.length, e);
112
+ }
113
+ slice(e, t = this.length) {
114
+ [e, t] = v(this, e, t);
115
+ let n = [];
116
+ return this.decompose(e, t, n, 0), h.from(n, t - e);
117
+ }
118
+ eq(e) {
119
+ if (e == this) return !0;
120
+ if (e.length != this.length || e.lines != this.lines) return !1;
121
+ let t = this.scanIdentical(e, 1), n = this.length - this.scanIdentical(e, -1), r = new _(this), i = new _(e);
122
+ for (let e = t, a = t;;) {
123
+ if (r.next(e), i.next(e), e = 0, r.lineBreak != i.lineBreak || r.done != i.done || r.value != i.value) return !1;
124
+ if (a += r.value.length, r.done || a >= n) return !0;
125
+ }
126
+ }
127
+ iter(e = 1) {
128
+ return new _(this, e);
129
+ }
130
+ iterRange(e, t = this.length) {
131
+ return new re(this, e, t);
132
+ }
133
+ iterLines(e, t) {
134
+ let n;
135
+ if (e == null) n = this.iter();
136
+ else {
137
+ t ??= this.lines + 1;
138
+ let r = this.line(e).from;
139
+ n = this.iterRange(r, Math.max(r, t == this.lines + 1 ? this.length : t <= 1 ? 0 : this.line(t - 1).to));
140
+ }
141
+ return new ie(n);
142
+ }
143
+ toString() {
144
+ return this.sliceString(0);
145
+ }
146
+ toJSON() {
147
+ let e = [];
148
+ return this.flatten(e), e;
149
+ }
150
+ constructor() {}
151
+ static of(t) {
152
+ if (t.length == 0) throw RangeError("A document must have at least one line");
153
+ return t.length == 1 && !t[0] ? e.empty : t.length <= 32 ? new m(t) : h.from(m.split(t, []));
154
+ }
155
+ }, m = class e extends p {
156
+ constructor(e, t = te(e)) {
157
+ super(), this.text = e, this.length = t;
158
+ }
159
+ get lines() {
160
+ return this.text.length;
161
+ }
162
+ get children() {
163
+ return null;
164
+ }
165
+ lineInner(e, t, n, r) {
166
+ for (let i = 0;; i++) {
167
+ let a = this.text[i], o = r + a.length;
168
+ if ((t ? n : o) >= e) return new ae(r, o, n, a);
169
+ r = o + 1, n++;
170
+ }
171
+ }
172
+ decompose(t, n, r, i) {
173
+ let a = t <= 0 && n >= this.length ? this : new e(ne(this.text, t, n), Math.min(n, this.length) - Math.max(0, t));
174
+ if (i & 1) {
175
+ let t = r.pop(), n = g(a.text, t.text.slice(), 0, a.length);
176
+ if (n.length <= 32) r.push(new e(n, t.length + a.length));
177
+ else {
178
+ let t = n.length >> 1;
179
+ r.push(new e(n.slice(0, t)), new e(n.slice(t)));
180
+ }
181
+ } else r.push(a);
182
+ }
183
+ replace(t, n, r) {
184
+ if (!(r instanceof e)) return super.replace(t, n, r);
185
+ [t, n] = v(this, t, n);
186
+ let i = g(this.text, g(r.text, ne(this.text, 0, t)), n), a = this.length + r.length - (n - t);
187
+ return i.length <= 32 ? new e(i, a) : h.from(e.split(i, []), a);
188
+ }
189
+ sliceString(e, t = this.length, n = "\n") {
190
+ [e, t] = v(this, e, t);
191
+ let r = "";
192
+ for (let i = 0, a = 0; i <= t && a < this.text.length; a++) {
193
+ let o = this.text[a], s = i + o.length;
194
+ i > e && a && (r += n), e < s && t > i && (r += o.slice(Math.max(0, e - i), t - i)), i = s + 1;
195
+ }
196
+ return r;
197
+ }
198
+ flatten(e) {
199
+ for (let t of this.text) e.push(t);
200
+ }
201
+ scanIdentical() {
202
+ return 0;
203
+ }
204
+ static split(t, n) {
205
+ let r = [], i = -1;
206
+ for (let a of t) r.push(a), i += a.length + 1, r.length == 32 && (n.push(new e(r, i)), r = [], i = -1);
207
+ return i > -1 && n.push(new e(r, i)), n;
208
+ }
209
+ }, h = class e extends p {
210
+ constructor(e, t) {
211
+ super(), this.children = e, this.length = t, this.lines = 0;
212
+ for (let t of e) this.lines += t.lines;
213
+ }
214
+ lineInner(e, t, n, r) {
215
+ for (let i = 0;; i++) {
216
+ let a = this.children[i], o = r + a.length, s = n + a.lines - 1;
217
+ if ((t ? s : o) >= e) return a.lineInner(e, t, n, r);
218
+ r = o + 1, n = s + 1;
219
+ }
220
+ }
221
+ decompose(e, t, n, r) {
222
+ for (let i = 0, a = 0; a <= t && i < this.children.length; i++) {
223
+ let o = this.children[i], s = a + o.length;
224
+ if (e <= s && t >= a) {
225
+ let i = r & (a <= e | (s >= t ? 2 : 0));
226
+ a >= e && s <= t && !i ? n.push(o) : o.decompose(e - a, t - a, n, i);
227
+ }
228
+ a = s + 1;
229
+ }
230
+ }
231
+ replace(t, n, r) {
232
+ if ([t, n] = v(this, t, n), r.lines < this.lines) for (let i = 0, a = 0; i < this.children.length; i++) {
233
+ let o = this.children[i], s = a + o.length;
234
+ if (t >= a && n <= s) {
235
+ let c = o.replace(t - a, n - a, r), l = this.lines - o.lines + c.lines;
236
+ if (c.lines < l >> 4 && c.lines > l >> 6) {
237
+ let a = this.children.slice();
238
+ return a[i] = c, new e(a, this.length - (n - t) + r.length);
239
+ }
240
+ return super.replace(a, s, c);
241
+ }
242
+ a = s + 1;
243
+ }
244
+ return super.replace(t, n, r);
245
+ }
246
+ sliceString(e, t = this.length, n = "\n") {
247
+ [e, t] = v(this, e, t);
248
+ let r = "";
249
+ for (let i = 0, a = 0; i < this.children.length && a <= t; i++) {
250
+ let o = this.children[i], s = a + o.length;
251
+ a > e && i && (r += n), e < s && t > a && (r += o.sliceString(e - a, t - a, n)), a = s + 1;
252
+ }
253
+ return r;
254
+ }
255
+ flatten(e) {
256
+ for (let t of this.children) t.flatten(e);
257
+ }
258
+ scanIdentical(t, n) {
259
+ if (!(t instanceof e)) return 0;
260
+ let r = 0, [i, a, o, s] = n > 0 ? [
261
+ 0,
262
+ 0,
263
+ this.children.length,
264
+ t.children.length
265
+ ] : [
266
+ this.children.length - 1,
267
+ t.children.length - 1,
268
+ -1,
269
+ -1
270
+ ];
271
+ for (;; i += n, a += n) {
272
+ if (i == o || a == s) return r;
273
+ let e = this.children[i], c = t.children[a];
274
+ if (e != c) return r + e.scanIdentical(c, n);
275
+ r += e.length + 1;
276
+ }
277
+ }
278
+ static from(t, n = t.reduce((e, t) => e + t.length + 1, -1)) {
279
+ let r = 0;
280
+ for (let e of t) r += e.lines;
281
+ if (r < 32) {
282
+ let e = [];
283
+ for (let n of t) n.flatten(e);
284
+ return new m(e, n);
285
+ }
286
+ let i = Math.max(32, r >> 5), a = i << 1, o = i >> 1, s = [], c = 0, l = -1, u = [];
287
+ function d(t) {
288
+ let n;
289
+ if (t.lines > a && t instanceof e) for (let e of t.children) d(e);
290
+ else t.lines > o && (c > o || !c) ? (f(), s.push(t)) : t instanceof m && c && (n = u[u.length - 1]) instanceof m && t.lines + n.lines <= 32 ? (c += t.lines, l += t.length + 1, u[u.length - 1] = new m(n.text.concat(t.text), n.length + 1 + t.length)) : (c + t.lines > i && f(), c += t.lines, l += t.length + 1, u.push(t));
291
+ }
292
+ function f() {
293
+ c != 0 && (s.push(u.length == 1 ? u[0] : e.from(u, l)), l = -1, c = u.length = 0);
294
+ }
295
+ for (let e of t) d(e);
296
+ return f(), s.length == 1 ? s[0] : new e(s, n);
297
+ }
298
+ };
299
+ p.empty = /*@__PURE__*/ new m([""], 0);
300
+ function te(e) {
301
+ let t = -1;
302
+ for (let n of e) t += n.length + 1;
303
+ return t;
304
+ }
305
+ function g(e, t, n = 0, r = 1e9) {
306
+ for (let i = 0, a = 0, o = !0; a < e.length && i <= r; a++) {
307
+ let s = e[a], c = i + s.length;
308
+ c >= n && (c > r && (s = s.slice(0, r - i)), i < n && (s = s.slice(n - i)), o ? (t[t.length - 1] += s, o = !1) : t.push(s)), i = c + 1;
309
+ }
310
+ return t;
311
+ }
312
+ function ne(e, t, n) {
313
+ return g(e, [""], t, n);
314
+ }
315
+ var _ = class {
316
+ constructor(e, t = 1) {
317
+ this.dir = t, this.done = !1, this.lineBreak = !1, this.value = "", this.nodes = [e], this.offsets = [t > 0 ? 1 : (e instanceof m ? e.text.length : e.children.length) << 1];
318
+ }
319
+ nextInner(e, t) {
320
+ for (this.done = this.lineBreak = !1;;) {
321
+ let n = this.nodes.length - 1, r = this.nodes[n], i = this.offsets[n], a = i >> 1, o = r instanceof m ? r.text.length : r.children.length;
322
+ if (a == (t > 0 ? o : 0)) {
323
+ if (n == 0) return this.done = !0, this.value = "", this;
324
+ t > 0 && this.offsets[n - 1]++, this.nodes.pop(), this.offsets.pop();
325
+ } else if ((i & 1) == (t > 0 ? 0 : 1)) {
326
+ if (this.offsets[n] += t, e == 0) return this.lineBreak = !0, this.value = "\n", this;
327
+ e--;
328
+ } else if (r instanceof m) {
329
+ let i = r.text[a + (t < 0 ? -1 : 0)];
330
+ if (this.offsets[n] += t, i.length > Math.max(0, e)) return this.value = e == 0 ? i : t > 0 ? i.slice(e) : i.slice(0, i.length - e), this;
331
+ e -= i.length;
332
+ } else {
333
+ let i = r.children[a + (t < 0 ? -1 : 0)];
334
+ e > i.length ? (e -= i.length, this.offsets[n] += t) : (t < 0 && this.offsets[n]--, this.nodes.push(i), this.offsets.push(t > 0 ? 1 : (i instanceof m ? i.text.length : i.children.length) << 1));
335
+ }
336
+ }
337
+ }
338
+ next(e = 0) {
339
+ return e < 0 && (this.nextInner(-e, -this.dir), e = this.value.length), this.nextInner(e, this.dir);
340
+ }
341
+ }, re = class {
342
+ constructor(e, t, n) {
343
+ this.value = "", this.done = !1, this.cursor = new _(e, t > n ? -1 : 1), this.pos = t > n ? e.length : 0, this.from = Math.min(t, n), this.to = Math.max(t, n);
344
+ }
345
+ nextInner(e, t) {
346
+ if (t < 0 ? this.pos <= this.from : this.pos >= this.to) return this.value = "", this.done = !0, this;
347
+ e += Math.max(0, t < 0 ? this.pos - this.to : this.from - this.pos);
348
+ let n = t < 0 ? this.pos - this.from : this.to - this.pos;
349
+ e > n && (e = n), n -= e;
350
+ let { value: r } = this.cursor.next(e);
351
+ return this.pos += (r.length + e) * t, this.value = r.length <= n ? r : t < 0 ? r.slice(r.length - n) : r.slice(0, n), this.done = !this.value, this;
352
+ }
353
+ next(e = 0) {
354
+ return e < 0 ? e = Math.max(e, this.from - this.pos) : e > 0 && (e = Math.min(e, this.to - this.pos)), this.nextInner(e, this.cursor.dir);
355
+ }
356
+ get lineBreak() {
357
+ return this.cursor.lineBreak && this.value != "";
358
+ }
359
+ }, ie = class {
360
+ constructor(e) {
361
+ this.inner = e, this.afterBreak = !0, this.value = "", this.done = !1;
362
+ }
363
+ next(e = 0) {
364
+ let { done: t, lineBreak: n, value: r } = this.inner.next(e);
365
+ return t && this.afterBreak ? (this.value = "", this.afterBreak = !1) : t ? (this.done = !0, this.value = "") : n ? this.afterBreak ? this.value = "" : (this.afterBreak = !0, this.next()) : (this.value = r, this.afterBreak = !1), this;
366
+ }
367
+ get lineBreak() {
368
+ return !1;
369
+ }
370
+ };
371
+ typeof Symbol < "u" && (p.prototype[Symbol.iterator] = function() {
372
+ return this.iter();
373
+ }, _.prototype[Symbol.iterator] = re.prototype[Symbol.iterator] = ie.prototype[Symbol.iterator] = function() {
374
+ return this;
375
+ });
376
+ var ae = class {
377
+ constructor(e, t, n, r) {
378
+ this.from = e, this.to = t, this.number = n, this.text = r;
379
+ }
380
+ get length() {
381
+ return this.to - this.from;
382
+ }
383
+ };
384
+ function v(e, t, n) {
385
+ return t = Math.max(0, Math.min(e.length, t)), [t, Math.max(t, Math.min(e.length, n))];
386
+ }
387
+ function y(e, t, n = !0, r = !0) {
388
+ return o(e, t, n, r);
389
+ }
390
+ function oe(e) {
391
+ return e >= 56320 && e < 57344;
392
+ }
393
+ function se(e) {
394
+ return e >= 55296 && e < 56320;
395
+ }
396
+ function ce(e, t) {
397
+ let n = e.charCodeAt(t);
398
+ if (!se(n) || t + 1 == e.length) return n;
399
+ let r = e.charCodeAt(t + 1);
400
+ return oe(r) ? (n - 55296 << 10) + (r - 56320) + 65536 : n;
401
+ }
402
+ function le(e) {
403
+ return e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10) + 55296, (e & 1023) + 56320));
404
+ }
405
+ function ue(e) {
406
+ return e < 65536 ? 1 : 2;
407
+ }
408
+ var b = /\r\n?|\n/, x = /*@__PURE__*/ (function(e) {
409
+ return e[e.Simple = 0] = "Simple", e[e.TrackDel = 1] = "TrackDel", e[e.TrackBefore = 2] = "TrackBefore", e[e.TrackAfter = 3] = "TrackAfter", e;
410
+ })(x ||= {}), S = class e {
411
+ constructor(e) {
412
+ this.sections = e;
413
+ }
414
+ get length() {
415
+ let e = 0;
416
+ for (let t = 0; t < this.sections.length; t += 2) e += this.sections[t];
417
+ return e;
418
+ }
419
+ get newLength() {
420
+ let e = 0;
421
+ for (let t = 0; t < this.sections.length; t += 2) {
422
+ let n = this.sections[t + 1];
423
+ e += n < 0 ? this.sections[t] : n;
424
+ }
425
+ return e;
426
+ }
427
+ get empty() {
428
+ return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0;
429
+ }
430
+ iterGaps(e) {
431
+ for (let t = 0, n = 0, r = 0; t < this.sections.length;) {
432
+ let i = this.sections[t++], a = this.sections[t++];
433
+ a < 0 ? (e(n, r, i), r += i) : r += a, n += i;
434
+ }
435
+ }
436
+ iterChangedRanges(e, t = !1) {
437
+ de(this, e, t);
438
+ }
439
+ get invertedDesc() {
440
+ let t = [];
441
+ for (let e = 0; e < this.sections.length;) {
442
+ let n = this.sections[e++], r = this.sections[e++];
443
+ r < 0 ? t.push(n, r) : t.push(r, n);
444
+ }
445
+ return new e(t);
446
+ }
447
+ composeDesc(e) {
448
+ return this.empty ? e : e.empty ? this : pe(this, e);
449
+ }
450
+ mapDesc(e, t = !1) {
451
+ return e.empty ? this : fe(this, e, t);
452
+ }
453
+ mapPos(e, t = -1, n = x.Simple) {
454
+ let r = 0, i = 0;
455
+ for (let a = 0; a < this.sections.length;) {
456
+ let o = this.sections[a++], s = this.sections[a++], c = r + o;
457
+ if (s < 0) {
458
+ if (c > e) return i + (e - r);
459
+ i += o;
460
+ } else {
461
+ if (n != x.Simple && c >= e && (n == x.TrackDel && r < e && c > e || n == x.TrackBefore && r < e || n == x.TrackAfter && c > e)) return null;
462
+ if (c > e || c == e && t < 0 && !o) return e == r || t < 0 ? i : i + s;
463
+ i += s;
464
+ }
465
+ r = c;
466
+ }
467
+ if (e > r) throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);
468
+ return i;
469
+ }
470
+ touchesRange(e, t = e) {
471
+ for (let n = 0, r = 0; n < this.sections.length && r <= t;) {
472
+ let i = this.sections[n++], a = this.sections[n++], o = r + i;
473
+ if (a >= 0 && r <= t && o >= e) return r < e && o > t ? "cover" : !0;
474
+ r = o;
475
+ }
476
+ return !1;
477
+ }
478
+ toString() {
479
+ let e = "";
480
+ for (let t = 0; t < this.sections.length;) {
481
+ let n = this.sections[t++], r = this.sections[t++];
482
+ e += (e ? " " : "") + n + (r >= 0 ? ":" + r : "");
483
+ }
484
+ return e;
485
+ }
486
+ toJSON() {
487
+ return this.sections;
488
+ }
489
+ static fromJSON(t) {
490
+ if (!Array.isArray(t) || t.length % 2 || t.some((e) => typeof e != "number")) throw RangeError("Invalid JSON representation of ChangeDesc");
491
+ return new e(t);
492
+ }
493
+ static create(t) {
494
+ return new e(t);
495
+ }
496
+ }, C = class e extends S {
497
+ constructor(e, t) {
498
+ super(e), this.inserted = t;
499
+ }
500
+ apply(e) {
501
+ if (this.length != e.length) throw RangeError("Applying change set to a document with the wrong length");
502
+ return de(this, (t, n, r, i, a) => e = e.replace(r, r + (n - t), a), !1), e;
503
+ }
504
+ mapDesc(e, t = !1) {
505
+ return fe(this, e, t, !0);
506
+ }
507
+ invert(t) {
508
+ let n = this.sections.slice(), r = [];
509
+ for (let e = 0, i = 0; e < n.length; e += 2) {
510
+ let a = n[e], o = n[e + 1];
511
+ if (o >= 0) {
512
+ n[e] = o, n[e + 1] = a;
513
+ let s = e >> 1;
514
+ for (; r.length < s;) r.push(p.empty);
515
+ r.push(a ? t.slice(i, i + a) : p.empty);
516
+ }
517
+ i += a;
518
+ }
519
+ return new e(n, r);
520
+ }
521
+ compose(e) {
522
+ return this.empty ? e : e.empty ? this : pe(this, e, !0);
523
+ }
524
+ map(e, t = !1) {
525
+ return e.empty ? this : fe(this, e, t, !0);
526
+ }
527
+ iterChanges(e, t = !1) {
528
+ de(this, e, t);
529
+ }
530
+ get desc() {
531
+ return S.create(this.sections);
532
+ }
533
+ filter(t) {
534
+ let n = [], r = [], i = [], a = new E(this);
535
+ done: for (let e = 0, o = 0;;) {
536
+ let s = e == t.length ? 1e9 : t[e++];
537
+ for (; o < s || o == s && a.len == 0;) {
538
+ if (a.done) break done;
539
+ let e = Math.min(a.len, s - o);
540
+ w(i, e, -1);
541
+ let t = a.ins == -1 ? -1 : a.off == 0 ? a.ins : 0;
542
+ w(n, e, t), t > 0 && T(r, n, a.text), a.forward(e), o += e;
543
+ }
544
+ let c = t[e++];
545
+ for (; o < c;) {
546
+ if (a.done) break done;
547
+ let e = Math.min(a.len, c - o);
548
+ w(n, e, -1), w(i, e, a.ins == -1 ? -1 : a.off == 0 ? a.ins : 0), a.forward(e), o += e;
549
+ }
550
+ }
551
+ return {
552
+ changes: new e(n, r),
553
+ filtered: S.create(i)
554
+ };
555
+ }
556
+ toJSON() {
557
+ let e = [];
558
+ for (let t = 0; t < this.sections.length; t += 2) {
559
+ let n = this.sections[t], r = this.sections[t + 1];
560
+ r < 0 ? e.push(n) : r == 0 ? e.push([n]) : e.push([n].concat(this.inserted[t >> 1].toJSON()));
561
+ }
562
+ return e;
563
+ }
564
+ static of(t, n, r) {
565
+ let i = [], a = [], o = 0, s = null;
566
+ function c(t = !1) {
567
+ if (!t && !i.length) return;
568
+ o < n && w(i, n - o, -1);
569
+ let r = new e(i, a);
570
+ s = s ? s.compose(r.map(s)) : r, i = [], a = [], o = 0;
571
+ }
572
+ function l(t) {
573
+ if (Array.isArray(t)) for (let e of t) l(e);
574
+ else if (t instanceof e) {
575
+ if (t.length != n) throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);
576
+ c(), s = s ? s.compose(t.map(s)) : t;
577
+ } else {
578
+ let { from: e, to: s = e, insert: l } = t;
579
+ if (e > s || e < 0 || s > n) throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);
580
+ let u = l ? typeof l == "string" ? p.of(l.split(r || b)) : l : p.empty, d = u.length;
581
+ if (e == s && d == 0) return;
582
+ e < o && c(), e > o && w(i, e - o, -1), w(i, s - e, d), T(a, i, u), o = s;
583
+ }
584
+ }
585
+ return l(t), c(!s), s;
586
+ }
587
+ static empty(t) {
588
+ return new e(t ? [t, -1] : [], []);
589
+ }
590
+ static fromJSON(t) {
591
+ if (!Array.isArray(t)) throw RangeError("Invalid JSON representation of ChangeSet");
592
+ let n = [], r = [];
593
+ for (let e = 0; e < t.length; e++) {
594
+ let i = t[e];
595
+ if (typeof i == "number") n.push(i, -1);
596
+ else if (!Array.isArray(i) || typeof i[0] != "number" || i.some((e, t) => t && typeof e != "string")) throw RangeError("Invalid JSON representation of ChangeSet");
597
+ else if (i.length == 1) n.push(i[0], 0);
598
+ else {
599
+ for (; r.length < e;) r.push(p.empty);
600
+ r[e] = p.of(i.slice(1)), n.push(i[0], r[e].length);
601
+ }
602
+ }
603
+ return new e(n, r);
604
+ }
605
+ static createSet(t, n) {
606
+ return new e(t, n);
607
+ }
608
+ };
609
+ function w(e, t, n, r = !1) {
610
+ if (t == 0 && n <= 0) return;
611
+ let i = e.length - 2;
612
+ i >= 0 && n <= 0 && n == e[i + 1] ? e[i] += t : i >= 0 && t == 0 && e[i] == 0 ? e[i + 1] += n : r ? (e[i] += t, e[i + 1] += n) : e.push(t, n);
613
+ }
614
+ function T(e, t, n) {
615
+ if (n.length == 0) return;
616
+ let r = t.length - 2 >> 1;
617
+ if (r < e.length) e[e.length - 1] = e[e.length - 1].append(n);
618
+ else {
619
+ for (; e.length < r;) e.push(p.empty);
620
+ e.push(n);
621
+ }
622
+ }
623
+ function de(e, t, n) {
624
+ let r = e.inserted;
625
+ for (let i = 0, a = 0, o = 0; o < e.sections.length;) {
626
+ let s = e.sections[o++], c = e.sections[o++];
627
+ if (c < 0) i += s, a += s;
628
+ else {
629
+ let l = i, u = a, d = p.empty;
630
+ for (; l += s, u += c, c && r && (d = d.append(r[o - 2 >> 1])), !(n || o == e.sections.length || e.sections[o + 1] < 0);) s = e.sections[o++], c = e.sections[o++];
631
+ t(i, l, a, u, d), i = l, a = u;
632
+ }
633
+ }
634
+ }
635
+ function fe(e, t, n, r = !1) {
636
+ let i = [], a = r ? [] : null, o = new E(e), s = new E(t);
637
+ for (let e = -1;;) if (o.done && s.len || s.done && o.len) throw Error("Mismatched change set lengths");
638
+ else if (o.ins == -1 && s.ins == -1) {
639
+ let e = Math.min(o.len, s.len);
640
+ w(i, e, -1), o.forward(e), s.forward(e);
641
+ } else if (s.ins >= 0 && (o.ins < 0 || e == o.i || o.off == 0 && (s.len < o.len || s.len == o.len && !n))) {
642
+ let t = s.len;
643
+ for (w(i, s.ins, -1); t;) {
644
+ let n = Math.min(o.len, t);
645
+ o.ins >= 0 && e < o.i && o.len <= n && (w(i, 0, o.ins), a && T(a, i, o.text), e = o.i), o.forward(n), t -= n;
646
+ }
647
+ s.next();
648
+ } else if (o.ins >= 0) {
649
+ let t = 0, n = o.len;
650
+ for (; n;) if (s.ins == -1) {
651
+ let e = Math.min(n, s.len);
652
+ t += e, n -= e, s.forward(e);
653
+ } else if (s.ins == 0 && s.len < n) n -= s.len, s.next();
654
+ else break;
655
+ w(i, t, e < o.i ? o.ins : 0), a && e < o.i && T(a, i, o.text), e = o.i, o.forward(o.len - n);
656
+ } else if (o.done && s.done) return a ? C.createSet(i, a) : S.create(i);
657
+ else throw Error("Mismatched change set lengths");
658
+ }
659
+ function pe(e, t, n = !1) {
660
+ let r = [], i = n ? [] : null, a = new E(e), o = new E(t);
661
+ for (let e = !1;;) if (a.done && o.done) return i ? C.createSet(r, i) : S.create(r);
662
+ else if (a.ins == 0) w(r, a.len, 0, e), a.next();
663
+ else if (o.len == 0 && !o.done) w(r, 0, o.ins, e), i && T(i, r, o.text), o.next();
664
+ else if (a.done || o.done) throw Error("Mismatched change set lengths");
665
+ else {
666
+ let t = Math.min(a.len2, o.len), n = r.length;
667
+ if (a.ins == -1) {
668
+ let n = o.ins == -1 ? -1 : o.off ? 0 : o.ins;
669
+ w(r, t, n, e), i && n && T(i, r, o.text);
670
+ } else o.ins == -1 ? (w(r, a.off ? 0 : a.len, t, e), i && T(i, r, a.textBit(t))) : (w(r, a.off ? 0 : a.len, o.off ? 0 : o.ins, e), i && !o.off && T(i, r, o.text));
671
+ e = (a.ins > t || o.ins >= 0 && o.len > t) && (e || r.length > n), a.forward2(t), o.forward(t);
672
+ }
673
+ }
674
+ var E = class {
675
+ constructor(e) {
676
+ this.set = e, this.i = 0, this.next();
677
+ }
678
+ next() {
679
+ let { sections: e } = this.set;
680
+ this.i < e.length ? (this.len = e[this.i++], this.ins = e[this.i++]) : (this.len = 0, this.ins = -2), this.off = 0;
681
+ }
682
+ get done() {
683
+ return this.ins == -2;
684
+ }
685
+ get len2() {
686
+ return this.ins < 0 ? this.len : this.ins;
687
+ }
688
+ get text() {
689
+ let { inserted: e } = this.set, t = this.i - 2 >> 1;
690
+ return t >= e.length ? p.empty : e[t];
691
+ }
692
+ textBit(e) {
693
+ let { inserted: t } = this.set, n = this.i - 2 >> 1;
694
+ return n >= t.length && !e ? p.empty : t[n].slice(this.off, e == null ? void 0 : this.off + e);
695
+ }
696
+ forward(e) {
697
+ e == this.len ? this.next() : (this.len -= e, this.off += e);
698
+ }
699
+ forward2(e) {
700
+ this.ins == -1 ? this.forward(e) : e == this.ins ? this.next() : (this.ins -= e, this.off += e);
701
+ }
702
+ }, D = class e {
703
+ constructor(e, t, n, r) {
704
+ this.from = e, this.to = t, this.flags = n, this.goalColumn = r;
705
+ }
706
+ get anchor() {
707
+ return this.flags & 32 ? this.to : this.from;
708
+ }
709
+ get head() {
710
+ return this.flags & 32 ? this.from : this.to;
711
+ }
712
+ get empty() {
713
+ return this.from == this.to;
714
+ }
715
+ get assoc() {
716
+ return this.flags & 8 ? -1 : this.flags & 16 ? 1 : 0;
717
+ }
718
+ get undirectional() {
719
+ return (this.flags & 64) > 0;
720
+ }
721
+ get bidiLevel() {
722
+ let e = this.flags & 7;
723
+ return e == 7 ? null : e;
724
+ }
725
+ map(t, n = -1) {
726
+ let r, i;
727
+ return this.empty ? r = i = t.mapPos(this.from, n) : (r = t.mapPos(this.from, 1), i = t.mapPos(this.to, -1)), r == this.from && i == this.to ? this : new e(r, i, this.flags, this.goalColumn);
728
+ }
729
+ extend(e, t = e, n = 0) {
730
+ if (e <= this.anchor && t >= this.anchor) return O.range(e, t, void 0, void 0, n);
731
+ let r = Math.abs(e - this.anchor) > Math.abs(t - this.anchor) ? e : t;
732
+ return O.range(this.anchor, r, void 0, void 0, n);
733
+ }
734
+ eq(e, t = !1) {
735
+ return this.anchor == e.anchor && this.head == e.head && this.goalColumn == e.goalColumn && (!t || !this.empty || this.assoc == e.assoc);
736
+ }
737
+ toJSON() {
738
+ return {
739
+ anchor: this.anchor,
740
+ head: this.head
741
+ };
742
+ }
743
+ static fromJSON(e) {
744
+ if (!e || typeof e.anchor != "number" || typeof e.head != "number") throw RangeError("Invalid JSON representation for SelectionRange");
745
+ return O.range(e.anchor, e.head);
746
+ }
747
+ static create(t, n, r, i) {
748
+ return new e(t, n, r, i);
749
+ }
750
+ }, O = class e {
751
+ constructor(e, t) {
752
+ this.ranges = e, this.mainIndex = t;
753
+ }
754
+ map(t, n = -1) {
755
+ return t.empty ? this : e.create(this.ranges.map((e) => e.map(t, n)), this.mainIndex);
756
+ }
757
+ eq(e, t = !1) {
758
+ if (this.ranges.length != e.ranges.length || this.mainIndex != e.mainIndex) return !1;
759
+ for (let n = 0; n < this.ranges.length; n++) if (!this.ranges[n].eq(e.ranges[n], t)) return !1;
760
+ return !0;
761
+ }
762
+ get main() {
763
+ return this.ranges[this.mainIndex];
764
+ }
765
+ asSingle() {
766
+ return this.ranges.length == 1 ? this : new e([this.main], 0);
767
+ }
768
+ addRange(t, n = !0) {
769
+ return e.create([t].concat(this.ranges), n ? 0 : this.mainIndex + 1);
770
+ }
771
+ replaceRange(t, n = this.mainIndex) {
772
+ let r = this.ranges.slice();
773
+ return r[n] = t, e.create(r, this.mainIndex);
774
+ }
775
+ toJSON() {
776
+ return {
777
+ ranges: this.ranges.map((e) => e.toJSON()),
778
+ main: this.mainIndex
779
+ };
780
+ }
781
+ static fromJSON(t) {
782
+ if (!t || !Array.isArray(t.ranges) || typeof t.main != "number" || t.main >= t.ranges.length) throw RangeError("Invalid JSON representation for EditorSelection");
783
+ return new e(t.ranges.map((e) => D.fromJSON(e)), t.main);
784
+ }
785
+ static single(t, n = t) {
786
+ return new e([e.range(t, n)], 0);
787
+ }
788
+ static create(t, n = 0) {
789
+ if (t.length == 0) throw RangeError("A selection needs at least one range");
790
+ for (let r = 0, i = 0; i < t.length; i++) {
791
+ let a = t[i];
792
+ if (a.empty ? a.from <= r : a.from < r) return e.normalized(t.slice(), n);
793
+ r = a.to;
794
+ }
795
+ return new e(t, n);
796
+ }
797
+ static cursor(e, t = 0, n, r) {
798
+ return D.create(e, e, (t == 0 ? 0 : t < 0 ? 8 : 16) | (n == null ? 7 : Math.min(6, n)), r);
799
+ }
800
+ static range(e, t, n, r, i) {
801
+ let a = r == null ? 7 : Math.min(6, r);
802
+ return !i && e != t && (i = t < e ? 1 : -1), i && (a |= i < 0 ? 8 : 16), t < e ? D.create(t, e, a | 32, n) : D.create(e, t, a, n);
803
+ }
804
+ static undirectionalRange(e, t) {
805
+ return D.create(e, t, 64, void 0);
806
+ }
807
+ static normalized(t, n = 0) {
808
+ let r = t[n];
809
+ t.sort((e, t) => e.from - t.from), n = t.indexOf(r);
810
+ for (let r = 1; r < t.length; r++) {
811
+ let i = t[r], a = t[r - 1];
812
+ if (i.empty ? i.from <= a.to : i.from < a.to) {
813
+ let o = a.from, s = Math.max(i.to, a.to);
814
+ r <= n && n--, t.splice(--r, 2, i.anchor > i.head ? e.range(s, o) : e.range(o, s));
815
+ }
816
+ }
817
+ return new e(t, n);
818
+ }
819
+ };
820
+ function me(e, t) {
821
+ for (let n of e.ranges) if (n.to > t) throw RangeError("Selection points outside of document");
822
+ }
823
+ var he = 0, k = class e {
824
+ constructor(e, t, n, r, i) {
825
+ this.combine = e, this.compareInput = t, this.compare = n, this.isStatic = r, this.id = he++, this.default = e([]), this.extensions = typeof i == "function" ? i(this) : i;
826
+ }
827
+ get reader() {
828
+ return this;
829
+ }
830
+ static define(t = {}) {
831
+ return new e(t.combine || ((e) => e), t.compareInput || ((e, t) => e === t), t.compare || (t.combine ? (e, t) => e === t : ge), !!t.static, t.enables);
832
+ }
833
+ of(e) {
834
+ return new A([], this, 0, e);
835
+ }
836
+ compute(e, t) {
837
+ if (this.isStatic) throw Error("Can't compute a static facet");
838
+ return new A(e, this, 1, t);
839
+ }
840
+ computeN(e, t) {
841
+ if (this.isStatic) throw Error("Can't compute a static facet");
842
+ return new A(e, this, 2, t);
843
+ }
844
+ from(e, t) {
845
+ return t ||= (e) => e, this.compute([e], (n) => t(n.field(e)));
846
+ }
847
+ };
848
+ function ge(e, t) {
849
+ return e == t || e.length == t.length && e.every((e, n) => e === t[n]);
850
+ }
851
+ var A = class {
852
+ constructor(e, t, n, r) {
853
+ this.dependencies = e, this.facet = t, this.type = n, this.value = r, this.id = he++;
854
+ }
855
+ dynamicSlot(e) {
856
+ let t = this.value, n = this.facet.compareInput, r = this.id, i = e[r] >> 1, a = this.type == 2, o = !1, s = !1, c = [];
857
+ for (let t of this.dependencies) t == "doc" ? o = !0 : t == "selection" ? s = !0 : (e[t.id] ?? 1) & 1 || c.push(e[t.id]);
858
+ return {
859
+ create(e) {
860
+ return e.values[i] = t(e), 1;
861
+ },
862
+ update(e, r) {
863
+ if (o && r.docChanged || s && (r.docChanged || r.selection) || j(e, c)) {
864
+ let r = t(e);
865
+ if (a ? !_e(r, e.values[i], n) : !n(r, e.values[i])) return e.values[i] = r, 1;
866
+ }
867
+ return 0;
868
+ },
869
+ reconfigure: (e, o) => {
870
+ let s, c = o.config.address[r];
871
+ if (c != null) {
872
+ let r = z(o, c);
873
+ if (this.dependencies.every((t) => t instanceof k ? o.facet(t) === e.facet(t) : t instanceof N ? o.field(t, !1) == e.field(t, !1) : !0) || (a ? _e(s = t(e), r, n) : n(s = t(e), r))) return e.values[i] = r, 0;
874
+ } else s = t(e);
875
+ return e.values[i] = s, 1;
876
+ }
877
+ };
878
+ }
879
+ get extension() {
880
+ return this;
881
+ }
882
+ };
883
+ function _e(e, t, n) {
884
+ if (e.length != t.length) return !1;
885
+ for (let r = 0; r < e.length; r++) if (!n(e[r], t[r])) return !1;
886
+ return !0;
887
+ }
888
+ function j(e, t) {
889
+ let n = !1;
890
+ for (let r of t) R(e, r) & 1 && (n = !0);
891
+ return n;
892
+ }
893
+ function ve(e, t, n) {
894
+ let r = n.map((t) => e[t.id]), i = n.map((e) => e.type), a = r.filter((e) => !(e & 1)), o = e[t.id] >> 1;
895
+ function s(e) {
896
+ let n = [];
897
+ for (let t = 0; t < r.length; t++) {
898
+ let a = z(e, r[t]);
899
+ if (i[t] == 2) for (let e of a) n.push(e);
900
+ else n.push(a);
901
+ }
902
+ return t.combine(n);
903
+ }
904
+ return {
905
+ create(e) {
906
+ for (let t of r) R(e, t);
907
+ return e.values[o] = s(e), 1;
908
+ },
909
+ update(e, n) {
910
+ if (!j(e, a)) return 0;
911
+ let r = s(e);
912
+ return t.compare(r, e.values[o]) ? 0 : (e.values[o] = r, 1);
913
+ },
914
+ reconfigure(e, i) {
915
+ let a = j(e, r), c = i.config.facets[t.id], l = i.facet(t);
916
+ if (c && !a && ge(n, c)) return e.values[o] = l, 0;
917
+ let u = s(e);
918
+ return t.compare(u, l) ? (e.values[o] = l, 0) : (e.values[o] = u, 1);
919
+ }
920
+ };
921
+ }
922
+ var M = /*@__PURE__*/ k.define({ static: !0 }), N = class e {
923
+ constructor(e, t, n, r, i) {
924
+ this.id = e, this.createF = t, this.updateF = n, this.compareF = r, this.spec = i, this.provides = void 0;
925
+ }
926
+ static define(t) {
927
+ let n = new e(he++, t.create, t.update, t.compare || ((e, t) => e === t), t);
928
+ return t.provide && (n.provides = t.provide(n)), n;
929
+ }
930
+ create(e) {
931
+ return (e.facet(M).find((e) => e.field == this)?.create || this.createF)(e);
932
+ }
933
+ slot(e) {
934
+ let t = e[this.id] >> 1;
935
+ return {
936
+ create: (e) => (e.values[t] = this.create(e), 1),
937
+ update: (e, n) => {
938
+ let r = e.values[t], i = this.updateF(r, n);
939
+ return this.compareF(r, i) ? 0 : (e.values[t] = i, 1);
940
+ },
941
+ reconfigure: (e, n) => {
942
+ let r = e.facet(M), i = n.facet(M), a;
943
+ return (a = r.find((e) => e.field == this)) && a != i.find((e) => e.field == this) ? (e.values[t] = a.create(e), 1) : n.config.address[this.id] == null ? (e.values[t] = this.create(e), 1) : (e.values[t] = n.field(this), 0);
944
+ }
945
+ };
946
+ }
947
+ init(e) {
948
+ return [this, M.of({
949
+ field: this,
950
+ create: e
951
+ })];
952
+ }
953
+ get extension() {
954
+ return this;
955
+ }
956
+ }, P = {
957
+ lowest: 4,
958
+ low: 3,
959
+ default: 2,
960
+ high: 1,
961
+ highest: 0
962
+ };
963
+ function F(e) {
964
+ return (t) => new be(t, e);
965
+ }
966
+ var ye = {
967
+ highest: /*@__PURE__*/ F(P.highest),
968
+ high: /*@__PURE__*/ F(P.high),
969
+ default: /*@__PURE__*/ F(P.default),
970
+ low: /*@__PURE__*/ F(P.low),
971
+ lowest: /*@__PURE__*/ F(P.lowest)
972
+ }, be = class {
973
+ constructor(e, t) {
974
+ this.inner = e, this.prec = t;
975
+ }
976
+ get extension() {
977
+ return this;
978
+ }
979
+ }, I = class e {
980
+ of(e) {
981
+ return new L(this, e);
982
+ }
983
+ reconfigure(t) {
984
+ return e.reconfigure.of({
985
+ compartment: this,
986
+ extension: t
987
+ });
988
+ }
989
+ get(e) {
990
+ return e.config.compartments.get(this);
991
+ }
992
+ }, L = class {
993
+ constructor(e, t) {
994
+ this.compartment = e, this.inner = t;
995
+ }
996
+ get extension() {
997
+ return this;
998
+ }
999
+ }, xe = class e {
1000
+ constructor(e, t, n, r, i, a) {
1001
+ for (this.base = e, this.compartments = t, this.dynamicSlots = n, this.address = r, this.staticValues = i, this.facets = a, this.statusTemplate = []; this.statusTemplate.length < n.length;) this.statusTemplate.push(0);
1002
+ }
1003
+ staticFacet(e) {
1004
+ let t = this.address[e.id];
1005
+ return t == null ? e.default : this.staticValues[t >> 1];
1006
+ }
1007
+ static resolve(t, n, r) {
1008
+ let i = [], a = Object.create(null), o = /* @__PURE__ */ new Map();
1009
+ for (let e of Se(t, n, o)) e instanceof N ? i.push(e) : (a[e.facet.id] || (a[e.facet.id] = [])).push(e);
1010
+ let s = Object.create(null), c = [], l = [];
1011
+ for (let e of i) s[e.id] = l.length << 1, l.push((t) => e.slot(t));
1012
+ let u = r?.config.facets;
1013
+ for (let e in a) {
1014
+ let t = a[e], n = t[0].facet, i = u && u[e] || [];
1015
+ if (t.every((e) => e.type == 0)) {
1016
+ if (s[n.id] = c.length << 1 | 1, ge(i, t)) c.push(r.facet(n));
1017
+ else {
1018
+ let e = n.combine(t.map((e) => e.value));
1019
+ c.push(r && n.compare(e, r.facet(n)) ? r.facet(n) : e);
1020
+ }
1021
+ } else {
1022
+ for (let e of t) e.type == 0 ? (s[e.id] = c.length << 1 | 1, c.push(e.value)) : (s[e.id] = l.length << 1, l.push((t) => e.dynamicSlot(t)));
1023
+ s[n.id] = l.length << 1, l.push((e) => ve(e, n, t));
1024
+ }
1025
+ }
1026
+ let d = l.map((e) => e(s));
1027
+ return new e(t, o, d, s, c, a);
1028
+ }
1029
+ };
1030
+ function Se(e, t, n) {
1031
+ let r = [
1032
+ [],
1033
+ [],
1034
+ [],
1035
+ [],
1036
+ []
1037
+ ], i = /* @__PURE__ */ new Map();
1038
+ function a(e, o) {
1039
+ let s = i.get(e);
1040
+ if (s != null) {
1041
+ if (s <= o) return;
1042
+ let t = r[s].indexOf(e);
1043
+ t > -1 && r[s].splice(t, 1), e instanceof L && n.delete(e.compartment);
1044
+ }
1045
+ if (i.set(e, o), Array.isArray(e)) for (let t of e) a(t, o);
1046
+ else if (e instanceof L) {
1047
+ if (n.has(e.compartment)) throw RangeError("Duplicate use of compartment in extensions");
1048
+ let r = t.get(e.compartment) || e.inner;
1049
+ n.set(e.compartment, r), a(r, o);
1050
+ } else if (e instanceof be) a(e.inner, e.prec);
1051
+ else if (e instanceof N) r[o].push(e), e.provides && a(e.provides, o);
1052
+ else if (e instanceof A) r[o].push(e), e.facet.extensions && a(e.facet.extensions, P.default);
1053
+ else {
1054
+ let t = e.extension;
1055
+ if (!t) throw Error(`Unrecognized extension value in extension set (${e}).`);
1056
+ if (t == e) throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);
1057
+ a(t, o);
1058
+ }
1059
+ }
1060
+ return a(e, P.default), r.reduce((e, t) => e.concat(t));
1061
+ }
1062
+ function R(e, t) {
1063
+ if (t & 1) return 2;
1064
+ let n = t >> 1, r = e.status[n];
1065
+ if (r == 4) throw Error("Cyclic dependency between fields and/or facets");
1066
+ if (r & 2) return r;
1067
+ e.status[n] = 4;
1068
+ let i = e.computeSlot(e, e.config.dynamicSlots[n]);
1069
+ return e.status[n] = 2 | i;
1070
+ }
1071
+ function z(e, t) {
1072
+ return t & 1 ? e.config.staticValues[t >> 1] : e.values[t >> 1];
1073
+ }
1074
+ var Ce = /*@__PURE__*/ k.define(), we = /*@__PURE__*/ k.define({
1075
+ combine: (e) => e.some((e) => e),
1076
+ static: !0
1077
+ }), Te = /*@__PURE__*/ k.define({
1078
+ combine: (e) => e.length ? e[0] : void 0,
1079
+ static: !0
1080
+ }), Ee = /*@__PURE__*/ k.define(), De = /*@__PURE__*/ k.define(), Oe = /*@__PURE__*/ k.define(), ke = /*@__PURE__*/ k.define({ combine: (e) => e.length ? e[0] : !1 }), B = class {
1081
+ constructor(e, t) {
1082
+ this.type = e, this.value = t;
1083
+ }
1084
+ static define() {
1085
+ return new Ae();
1086
+ }
1087
+ }, Ae = class {
1088
+ of(e) {
1089
+ return new B(this, e);
1090
+ }
1091
+ }, je = class {
1092
+ constructor(e) {
1093
+ this.map = e;
1094
+ }
1095
+ of(e) {
1096
+ return new V(this, e);
1097
+ }
1098
+ }, V = class e {
1099
+ constructor(e, t) {
1100
+ this.type = e, this.value = t;
1101
+ }
1102
+ map(t) {
1103
+ let n = this.type.map(this.value, t);
1104
+ return n === void 0 ? void 0 : n == this.value ? this : new e(this.type, n);
1105
+ }
1106
+ is(e) {
1107
+ return this.type == e;
1108
+ }
1109
+ static define(e = {}) {
1110
+ return new je(e.map || ((e) => e));
1111
+ }
1112
+ static mapEffects(e, t) {
1113
+ if (!e.length) return e;
1114
+ let n = [];
1115
+ for (let r of e) {
1116
+ let e = r.map(t);
1117
+ e && n.push(e);
1118
+ }
1119
+ return n;
1120
+ }
1121
+ };
1122
+ V.reconfigure = /*@__PURE__*/ V.define(), V.appendConfig = /*@__PURE__*/ V.define();
1123
+ var H = class e {
1124
+ constructor(t, n, r, i, a, o) {
1125
+ this.startState = t, this.changes = n, this.selection = r, this.effects = i, this.annotations = a, this.scrollIntoView = o, this._doc = null, this._state = null, r && me(r, n.newLength), a.some((t) => t.type == e.time) || (this.annotations = a.concat(e.time.of(Date.now())));
1126
+ }
1127
+ static create(t, n, r, i, a, o) {
1128
+ return new e(t, n, r, i, a, o);
1129
+ }
1130
+ get newDoc() {
1131
+ return this._doc ||= this.changes.apply(this.startState.doc);
1132
+ }
1133
+ get newSelection() {
1134
+ return this.selection || this.startState.selection.map(this.changes);
1135
+ }
1136
+ get state() {
1137
+ return this._state || this.startState.applyTransaction(this), this._state;
1138
+ }
1139
+ annotation(e) {
1140
+ for (let t of this.annotations) if (t.type == e) return t.value;
1141
+ }
1142
+ get docChanged() {
1143
+ return !this.changes.empty;
1144
+ }
1145
+ get reconfigured() {
1146
+ return this.startState.config != this.state.config;
1147
+ }
1148
+ isUserEvent(t) {
1149
+ let n = this.annotation(e.userEvent);
1150
+ return !!(n && (n == t || n.length > t.length && n.slice(0, t.length) == t && n[t.length] == "."));
1151
+ }
1152
+ };
1153
+ H.time = /*@__PURE__*/ B.define(), H.userEvent = /*@__PURE__*/ B.define(), H.addToHistory = /*@__PURE__*/ B.define(), H.remote = /*@__PURE__*/ B.define();
1154
+ function Me(e, t) {
1155
+ let n = [];
1156
+ for (let r = 0, i = 0;;) {
1157
+ let a, o;
1158
+ if (r < e.length && (i == t.length || t[i] >= e[r])) a = e[r++], o = e[r++];
1159
+ else if (i < t.length) a = t[i++], o = t[i++];
1160
+ else return n;
1161
+ !n.length || n[n.length - 1] < a ? n.push(a, o) : n[n.length - 1] < o && (n[n.length - 1] = o);
1162
+ }
1163
+ }
1164
+ function Ne(e, t, n) {
1165
+ let r, i, a;
1166
+ return n ? (r = t.changes, i = C.empty(t.changes.length), a = e.changes.compose(t.changes)) : (r = t.changes.map(e.changes), i = e.changes.mapDesc(t.changes, !0), a = e.changes.compose(r)), {
1167
+ changes: a,
1168
+ selection: t.selection ? t.selection.map(i) : e.selection?.map(r),
1169
+ effects: V.mapEffects(e.effects, r).concat(V.mapEffects(t.effects, i)),
1170
+ annotations: e.annotations.length ? e.annotations.concat(t.annotations) : t.annotations,
1171
+ scrollIntoView: e.scrollIntoView || t.scrollIntoView
1172
+ };
1173
+ }
1174
+ function Pe(e, t, n) {
1175
+ let r = t.selection, i = U(t.annotations);
1176
+ return t.userEvent && (i = i.concat(H.userEvent.of(t.userEvent))), {
1177
+ changes: t.changes instanceof C ? t.changes : C.of(t.changes || [], n, e.facet(Te)),
1178
+ selection: r && (r instanceof O ? r : O.single(r.anchor, r.head)),
1179
+ effects: U(t.effects),
1180
+ annotations: i,
1181
+ scrollIntoView: !!t.scrollIntoView
1182
+ };
1183
+ }
1184
+ function Fe(e, t, n) {
1185
+ let r = Pe(e, t.length ? t[0] : {}, e.doc.length);
1186
+ t.length && t[0].filter === !1 && (n = !1);
1187
+ for (let i = 1; i < t.length; i++) {
1188
+ t[i].filter === !1 && (n = !1);
1189
+ let a = !!t[i].sequential;
1190
+ r = Ne(r, Pe(e, t[i], a ? r.changes.newLength : e.doc.length), a);
1191
+ }
1192
+ let i = H.create(e, r.changes, r.selection, r.effects, r.annotations, r.scrollIntoView);
1193
+ return Le(n ? Ie(i) : i);
1194
+ }
1195
+ function Ie(e) {
1196
+ let t = e.startState, n = !0;
1197
+ for (let r of t.facet(Ee)) {
1198
+ let t = r(e);
1199
+ if (t === !1) {
1200
+ n = !1;
1201
+ break;
1202
+ }
1203
+ Array.isArray(t) && (n = n === !0 ? t : Me(n, t));
1204
+ }
1205
+ if (n !== !0) {
1206
+ let r, i;
1207
+ if (n === !1) i = e.changes.invertedDesc, r = C.empty(t.doc.length);
1208
+ else {
1209
+ let t = e.changes.filter(n);
1210
+ r = t.changes, i = t.filtered.mapDesc(t.changes).invertedDesc;
1211
+ }
1212
+ e = H.create(t, r, e.selection && e.selection.map(i), V.mapEffects(e.effects, i), e.annotations, e.scrollIntoView);
1213
+ }
1214
+ let r = t.facet(De);
1215
+ for (let n = r.length - 1; n >= 0; n--) {
1216
+ let i = r[n](e);
1217
+ e = i instanceof H ? i : Array.isArray(i) && i.length == 1 && i[0] instanceof H ? i[0] : Fe(t, U(i), !1);
1218
+ }
1219
+ return e;
1220
+ }
1221
+ function Le(e) {
1222
+ let t = e.startState, n = t.facet(Oe), r = e;
1223
+ for (let i = n.length - 1; i >= 0; i--) {
1224
+ let a = n[i](e);
1225
+ a && Object.keys(a).length && (r = Ne(r, Pe(t, a, e.changes.newLength), !0));
1226
+ }
1227
+ return r == e ? e : H.create(t, e.changes, e.selection, r.effects, r.annotations, r.scrollIntoView);
1228
+ }
1229
+ var Re = [];
1230
+ function U(e) {
1231
+ return e == null ? Re : Array.isArray(e) ? e : [e];
1232
+ }
1233
+ var W = /*@__PURE__*/ (function(e) {
1234
+ return e[e.Word = 0] = "Word", e[e.Space = 1] = "Space", e[e.Other = 2] = "Other", e;
1235
+ })(W ||= {}), ze = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/, Be;
1236
+ try {
1237
+ Be = /*@__PURE__*/ RegExp("[\\p{Alphabetic}\\p{Number}_]", "u");
1238
+ } catch {}
1239
+ function Ve(e) {
1240
+ if (Be) return Be.test(e);
1241
+ for (let t = 0; t < e.length; t++) {
1242
+ let n = e[t];
1243
+ if (/\w/.test(n) || n > "€" && (n.toUpperCase() != n.toLowerCase() || ze.test(n))) return !0;
1244
+ }
1245
+ return !1;
1246
+ }
1247
+ function He(e) {
1248
+ return (t) => {
1249
+ if (!/\S/.test(t)) return W.Space;
1250
+ if (Ve(t)) return W.Word;
1251
+ for (let n = 0; n < e.length; n++) if (t.indexOf(e[n]) > -1) return W.Word;
1252
+ return W.Other;
1253
+ };
1254
+ }
1255
+ var G = class e {
1256
+ constructor(e, t, n, r, i, a) {
1257
+ this.config = e, this.doc = t, this.selection = n, this.values = r, this.status = e.statusTemplate.slice(), this.computeSlot = i, a && (a._state = this);
1258
+ for (let e = 0; e < this.config.dynamicSlots.length; e++) R(this, e << 1);
1259
+ this.computeSlot = null;
1260
+ }
1261
+ field(e, t = !0) {
1262
+ let n = this.config.address[e.id];
1263
+ if (n == null) {
1264
+ if (t) throw RangeError("Field is not present in this state");
1265
+ return;
1266
+ }
1267
+ return R(this, n), z(this, n);
1268
+ }
1269
+ update(...e) {
1270
+ return Fe(this, e, !0);
1271
+ }
1272
+ applyTransaction(t) {
1273
+ let n = this.config, { base: r, compartments: i } = n;
1274
+ for (let e of t.effects) e.is(I.reconfigure) ? (n &&= (i = /* @__PURE__ */ new Map(), n.compartments.forEach((e, t) => i.set(t, e)), null), i.set(e.value.compartment, e.value.extension)) : e.is(V.reconfigure) ? (n = null, r = e.value) : e.is(V.appendConfig) && (n = null, r = U(r).concat(e.value));
1275
+ let a;
1276
+ n ? a = t.startState.values.slice() : (n = xe.resolve(r, i, this), a = new e(n, this.doc, this.selection, n.dynamicSlots.map(() => null), (e, t) => t.reconfigure(e, this), null).values);
1277
+ let o = t.startState.facet(we) ? t.newSelection : t.newSelection.asSingle();
1278
+ new e(n, t.newDoc, o, a, (e, n) => n.update(e, t), t);
1279
+ }
1280
+ replaceSelection(e) {
1281
+ return typeof e == "string" && (e = this.toText(e)), this.changeByRange((t) => ({
1282
+ changes: {
1283
+ from: t.from,
1284
+ to: t.to,
1285
+ insert: e
1286
+ },
1287
+ range: O.cursor(t.from + e.length)
1288
+ }));
1289
+ }
1290
+ changeByRange(e) {
1291
+ let t = this.selection, n = e(t.ranges[0]), r = this.changes(n.changes), i = [n.range], a = U(n.effects);
1292
+ for (let n = 1; n < t.ranges.length; n++) {
1293
+ let o = e(t.ranges[n]), s = this.changes(o.changes), c = s.map(r);
1294
+ for (let e = 0; e < n; e++) i[e] = i[e].map(c);
1295
+ let l = r.mapDesc(s, !0);
1296
+ i.push(o.range.map(l)), r = r.compose(c), a = V.mapEffects(a, c).concat(V.mapEffects(U(o.effects), l));
1297
+ }
1298
+ return {
1299
+ changes: r,
1300
+ selection: O.create(i, t.mainIndex),
1301
+ effects: a
1302
+ };
1303
+ }
1304
+ changes(t = []) {
1305
+ return t instanceof C ? t : C.of(t, this.doc.length, this.facet(e.lineSeparator));
1306
+ }
1307
+ toText(t) {
1308
+ return p.of(t.split(this.facet(e.lineSeparator) || b));
1309
+ }
1310
+ sliceDoc(e = 0, t = this.doc.length) {
1311
+ return this.doc.sliceString(e, t, this.lineBreak);
1312
+ }
1313
+ facet(e) {
1314
+ let t = this.config.address[e.id];
1315
+ return t == null ? e.default : (R(this, t), z(this, t));
1316
+ }
1317
+ toJSON(e) {
1318
+ let t = {
1319
+ doc: this.sliceDoc(),
1320
+ selection: this.selection.toJSON()
1321
+ };
1322
+ if (e) for (let n in e) {
1323
+ let r = e[n];
1324
+ r instanceof N && this.config.address[r.id] != null && (t[n] = r.spec.toJSON(this.field(e[n]), this));
1325
+ }
1326
+ return t;
1327
+ }
1328
+ static fromJSON(t, n = {}, r) {
1329
+ if (!t || typeof t.doc != "string") throw RangeError("Invalid JSON representation for EditorState");
1330
+ let i = [];
1331
+ if (r) {
1332
+ for (let e in r) if (Object.prototype.hasOwnProperty.call(t, e)) {
1333
+ let n = r[e], a = t[e];
1334
+ i.push(n.init((e) => n.spec.fromJSON(a, e)));
1335
+ }
1336
+ }
1337
+ return e.create({
1338
+ doc: t.doc,
1339
+ selection: O.fromJSON(t.selection),
1340
+ extensions: n.extensions ? i.concat([n.extensions]) : i
1341
+ });
1342
+ }
1343
+ static create(t = {}) {
1344
+ let n = xe.resolve(t.extensions || [], /* @__PURE__ */ new Map()), r = t.doc instanceof p ? t.doc : p.of((t.doc || "").split(n.staticFacet(e.lineSeparator) || b)), i = t.selection ? t.selection instanceof O ? t.selection : O.single(t.selection.anchor, t.selection.head) : O.single(0);
1345
+ return me(i, r.length), n.staticFacet(we) || (i = i.asSingle()), new e(n, r, i, n.dynamicSlots.map(() => null), (e, t) => t.create(e), null);
1346
+ }
1347
+ get tabSize() {
1348
+ return this.facet(e.tabSize);
1349
+ }
1350
+ get lineBreak() {
1351
+ return this.facet(e.lineSeparator) || "\n";
1352
+ }
1353
+ get readOnly() {
1354
+ return this.facet(ke);
1355
+ }
1356
+ phrase(t, ...n) {
1357
+ for (let n of this.facet(e.phrases)) if (Object.prototype.hasOwnProperty.call(n, t)) {
1358
+ t = n[t];
1359
+ break;
1360
+ }
1361
+ return n.length && (t = t.replace(/\$(\$|\d*)/g, (e, t) => {
1362
+ if (t == "$") return "$";
1363
+ let r = +(t || 1);
1364
+ return !r || r > n.length ? e : n[r - 1];
1365
+ })), t;
1366
+ }
1367
+ languageDataAt(e, t, n = -1) {
1368
+ let r = [];
1369
+ for (let i of this.facet(Ce)) for (let a of i(this, t, n)) Object.prototype.hasOwnProperty.call(a, e) && r.push(a[e]);
1370
+ return r;
1371
+ }
1372
+ charCategorizer(e) {
1373
+ let t = this.languageDataAt("wordChars", e);
1374
+ return He(t.length ? t[0] : "");
1375
+ }
1376
+ wordAt(e) {
1377
+ let { text: t, from: n, length: r } = this.doc.lineAt(e), i = this.charCategorizer(e), a = e - n, o = e - n;
1378
+ for (; a > 0;) {
1379
+ let e = y(t, a, !1);
1380
+ if (i(t.slice(e, a)) != W.Word) break;
1381
+ a = e;
1382
+ }
1383
+ for (; o < r;) {
1384
+ let e = y(t, o);
1385
+ if (i(t.slice(o, e)) != W.Word) break;
1386
+ o = e;
1387
+ }
1388
+ return a == o ? null : O.range(a + n, o + n);
1389
+ }
1390
+ };
1391
+ G.allowMultipleSelections = we, G.tabSize = /*@__PURE__*/ k.define({ combine: (e) => e.length ? e[0] : 4 }), G.lineSeparator = Te, G.readOnly = ke, G.phrases = /*@__PURE__*/ k.define({ compare(e, t) {
1392
+ let n = Object.keys(e), r = Object.keys(t);
1393
+ return n.length == r.length && n.every((n) => e[n] == t[n]);
1394
+ } }), G.languageData = Ce, G.changeFilter = Ee, G.transactionFilter = De, G.transactionExtender = Oe, I.reconfigure = /*@__PURE__*/ V.define();
1395
+ function Ue(e, t, n = {}) {
1396
+ let r = {};
1397
+ for (let t of e) for (let e of Object.keys(t)) {
1398
+ let i = t[e], a = r[e];
1399
+ if (a === void 0) r[e] = i;
1400
+ else if (a !== i && i !== void 0) {
1401
+ if (Object.hasOwnProperty.call(n, e)) r[e] = n[e](a, i);
1402
+ else throw Error("Config merge conflict for field " + e);
1403
+ }
1404
+ }
1405
+ for (let e in t) r[e] === void 0 && (r[e] = t[e]);
1406
+ return r;
1407
+ }
1408
+ var K = class {
1409
+ eq(e) {
1410
+ return this == e;
1411
+ }
1412
+ range(e, t = e) {
1413
+ return J.create(e, t, this);
1414
+ }
1415
+ };
1416
+ K.prototype.startSide = K.prototype.endSide = 0, K.prototype.point = !1, K.prototype.mapMode = x.TrackDel;
1417
+ function q(e, t) {
1418
+ return e == t || e.constructor == t.constructor && e.eq(t);
1419
+ }
1420
+ var J = class e {
1421
+ constructor(e, t, n) {
1422
+ this.from = e, this.to = t, this.value = n;
1423
+ }
1424
+ static create(t, n, r) {
1425
+ return new e(t, n, r);
1426
+ }
1427
+ };
1428
+ function We(e, t) {
1429
+ return e.from - t.from || e.value.startSide - t.value.startSide;
1430
+ }
1431
+ var Ge = class e {
1432
+ constructor(e, t, n, r) {
1433
+ this.from = e, this.to = t, this.value = n, this.maxPoint = r;
1434
+ }
1435
+ get length() {
1436
+ return this.to[this.to.length - 1];
1437
+ }
1438
+ findIndex(e, t, n, r = 0) {
1439
+ let i = n ? this.to : this.from;
1440
+ for (let a = r, o = i.length;;) {
1441
+ if (a == o) return a;
1442
+ let r = a + o >> 1, s = i[r] - e || (n ? this.value[r].endSide : this.value[r].startSide) - t;
1443
+ if (r == a) return s >= 0 ? a : o;
1444
+ s >= 0 ? o = r : a = r + 1;
1445
+ }
1446
+ }
1447
+ between(e, t, n, r) {
1448
+ for (let i = this.findIndex(t, -1e9, !0), a = this.findIndex(n, 1e9, !1, i); i < a; i++) if (r(this.from[i] + e, this.to[i] + e, this.value[i]) === !1) return !1;
1449
+ }
1450
+ map(t, n) {
1451
+ let r = [], i = [], a = [], o = -1, s = -1;
1452
+ for (let e = 0; e < this.value.length; e++) {
1453
+ let c = this.value[e], l = this.from[e] + t, u = this.to[e] + t, d, f;
1454
+ if (l == u) {
1455
+ let e = n.mapPos(l, c.startSide, c.mapMode);
1456
+ if (e == null || (d = f = e, c.startSide != c.endSide && (f = n.mapPos(l, c.endSide), f < d))) continue;
1457
+ } else if (d = n.mapPos(l, c.startSide), f = n.mapPos(u, c.endSide), d > f || d == f && c.startSide > 0 && c.endSide <= 0) continue;
1458
+ (f - d || c.endSide - c.startSide) < 0 || (o < 0 && (o = d), c.point && (s = Math.max(s, f - d)), r.push(c), i.push(d - o), a.push(f - o));
1459
+ }
1460
+ return {
1461
+ mapped: r.length ? new e(i, a, r, s) : null,
1462
+ pos: o
1463
+ };
1464
+ }
1465
+ }, Y = class e {
1466
+ constructor(e, t, n, r) {
1467
+ this.chunkPos = e, this.chunk = t, this.nextLayer = n, this.maxPoint = r;
1468
+ }
1469
+ static create(t, n, r, i) {
1470
+ return new e(t, n, r, i);
1471
+ }
1472
+ get length() {
1473
+ let e = this.chunk.length - 1;
1474
+ return e < 0 ? 0 : Math.max(this.chunkEnd(e), this.nextLayer.length);
1475
+ }
1476
+ get size() {
1477
+ if (this.isEmpty) return 0;
1478
+ let e = this.nextLayer.size;
1479
+ for (let t of this.chunk) e += t.value.length;
1480
+ return e;
1481
+ }
1482
+ chunkEnd(e) {
1483
+ return this.chunkPos[e] + this.chunk[e].length;
1484
+ }
1485
+ update(t) {
1486
+ let { add: n = [], sort: r = !1, filterFrom: i = 0, filterTo: a = this.length } = t, o = t.filter;
1487
+ if (n.length == 0 && !o) return this;
1488
+ if (r && (n = n.slice().sort(We)), this.isEmpty) return n.length ? e.of(n) : this;
1489
+ let s = new Je(this, null, -1).goto(0), c = 0, l = [], u = new X();
1490
+ for (; s.value || c < n.length;) if (c < n.length && (s.from - n[c].from || s.startSide - n[c].value.startSide) >= 0) {
1491
+ let e = n[c++];
1492
+ u.addInner(e.from, e.to, e.value) || l.push(e);
1493
+ } else s.rangeIndex == 1 && s.chunkIndex < this.chunk.length && (c == n.length || this.chunkEnd(s.chunkIndex) < n[c].from) && (!o || i > this.chunkEnd(s.chunkIndex) || a < this.chunkPos[s.chunkIndex]) && u.addChunk(this.chunkPos[s.chunkIndex], this.chunk[s.chunkIndex]) ? s.nextChunk() : ((!o || i > s.to || a < s.from || o(s.from, s.to, s.value)) && (u.addInner(s.from, s.to, s.value) || l.push(J.create(s.from, s.to, s.value))), s.next());
1494
+ return u.finishInner(this.nextLayer.isEmpty && !l.length ? e.empty : this.nextLayer.update({
1495
+ add: l,
1496
+ filter: o,
1497
+ filterFrom: i,
1498
+ filterTo: a
1499
+ }));
1500
+ }
1501
+ map(t) {
1502
+ if (t.empty || this.isEmpty) return this;
1503
+ let n = [], r = [], i = -1;
1504
+ for (let e = 0; e < this.chunk.length; e++) {
1505
+ let a = this.chunkPos[e], o = this.chunk[e], s = t.touchesRange(a, a + o.length);
1506
+ if (s === !1) i = Math.max(i, o.maxPoint), n.push(o), r.push(t.mapPos(a));
1507
+ else if (s === !0) {
1508
+ let { mapped: e, pos: s } = o.map(a, t);
1509
+ e && (i = Math.max(i, e.maxPoint), n.push(e), r.push(s));
1510
+ }
1511
+ }
1512
+ let a = this.nextLayer.map(t);
1513
+ return n.length == 0 ? a : new e(r, n, a || e.empty, i);
1514
+ }
1515
+ between(e, t, n) {
1516
+ if (!this.isEmpty) {
1517
+ for (let r = 0; r < this.chunk.length; r++) {
1518
+ let i = this.chunkPos[r], a = this.chunk[r];
1519
+ if (t >= i && e <= i + a.length && a.between(i, e - i, t - i, n) === !1) return;
1520
+ }
1521
+ this.nextLayer.between(e, t, n);
1522
+ }
1523
+ }
1524
+ iter(e = 0) {
1525
+ return Ye.from([this]).goto(e);
1526
+ }
1527
+ get isEmpty() {
1528
+ return this.nextLayer == this;
1529
+ }
1530
+ static iter(e, t = 0) {
1531
+ return Ye.from(e).goto(t);
1532
+ }
1533
+ static compare(e, t, n, r, i = -1) {
1534
+ let a = e.filter((e) => e.maxPoint > 0 || !e.isEmpty && e.maxPoint >= i), o = t.filter((e) => e.maxPoint > 0 || !e.isEmpty && e.maxPoint >= i), s = qe(a, o, n), c = new Z(a, s, i), l = new Z(o, s, i);
1535
+ n.iterGaps((e, t, n) => Ze(c, e, l, t, n, r)), n.empty && n.length == 0 && Ze(c, 0, l, 0, 0, r);
1536
+ }
1537
+ static eq(e, t, n = 0, r) {
1538
+ r ??= 1e9 - 1;
1539
+ let i = e.filter((e) => !e.isEmpty && t.indexOf(e) < 0), a = t.filter((t) => !t.isEmpty && e.indexOf(t) < 0);
1540
+ if (i.length != a.length) return !1;
1541
+ if (!i.length) return !0;
1542
+ let o = qe(i, a), s = new Z(i, o, 0).goto(n), c = new Z(a, o, 0).goto(n);
1543
+ for (;;) {
1544
+ if (s.to != c.to || !Qe(s.active, c.active) || s.point && (!c.point || !q(s.point, c.point))) return !1;
1545
+ if (s.to > r) return !0;
1546
+ s.next(), c.next();
1547
+ }
1548
+ }
1549
+ static spans(e, t, n, r, i = -1) {
1550
+ let a = new Z(e, null, i).goto(t), o = t, s = a.openStart;
1551
+ for (;;) {
1552
+ let e = Math.min(a.to, n);
1553
+ if (a.point) {
1554
+ let n = a.activeForPoint(a.to), i = a.pointFrom < t ? n.length + 1 : a.point.startSide < 0 ? n.length : Math.min(n.length, s);
1555
+ r.point(o, e, a.point, n, i, a.pointRank), s = Math.min(a.openEnd(e), n.length);
1556
+ } else e > o && (r.span(o, e, a.active, s), s = a.openEnd(e));
1557
+ if (a.to > n) return s + (a.point && a.to > n ? 1 : 0);
1558
+ o = a.to, a.next();
1559
+ }
1560
+ }
1561
+ static of(e, t = !1) {
1562
+ let n = new X();
1563
+ for (let r of e instanceof J ? [e] : t ? Ke(e) : e) n.add(r.from, r.to, r.value);
1564
+ return n.finish();
1565
+ }
1566
+ static join(t) {
1567
+ if (!t.length) return e.empty;
1568
+ let n = t[t.length - 1];
1569
+ for (let r = t.length - 2; r >= 0; r--) for (let i = t[r]; i != e.empty; i = i.nextLayer) n = new e(i.chunkPos, i.chunk, n, Math.max(i.maxPoint, n.maxPoint));
1570
+ return n;
1571
+ }
1572
+ };
1573
+ Y.empty = /*@__PURE__*/ new Y([], [], null, -1);
1574
+ function Ke(e) {
1575
+ if (e.length > 1) for (let t = e[0], n = 1; n < e.length; n++) {
1576
+ let r = e[n];
1577
+ if (We(t, r) > 0) return e.slice().sort(We);
1578
+ t = r;
1579
+ }
1580
+ return e;
1581
+ }
1582
+ Y.empty.nextLayer = Y.empty;
1583
+ var X = class e {
1584
+ finishChunk(e) {
1585
+ this.chunks.push(new Ge(this.from, this.to, this.value, this.maxPoint)), this.chunkPos.push(this.chunkStart), this.chunkStart = -1, this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint), this.maxPoint = -1, e && (this.from = [], this.to = [], this.value = []);
1586
+ }
1587
+ constructor() {
1588
+ this.chunks = [], this.chunkPos = [], this.chunkStart = -1, this.last = null, this.lastFrom = -1e9, this.lastTo = -1e9, this.from = [], this.to = [], this.value = [], this.maxPoint = -1, this.setMaxPoint = -1, this.nextLayer = null;
1589
+ }
1590
+ add(t, n, r) {
1591
+ this.addInner(t, n, r) || (this.nextLayer ||= new e()).add(t, n, r);
1592
+ }
1593
+ addInner(e, t, n) {
1594
+ let r = e - this.lastTo || n.startSide - this.last.endSide;
1595
+ if (r <= 0 && (e - this.lastFrom || n.startSide - this.last.startSide) < 0) throw Error("Ranges must be added sorted by `from` position and `startSide`");
1596
+ return r < 0 ? !1 : (this.from.length == 250 && this.finishChunk(!0), this.chunkStart < 0 && (this.chunkStart = e), this.from.push(e - this.chunkStart), this.to.push(t - this.chunkStart), this.last = n, this.lastFrom = e, this.lastTo = t, this.value.push(n), n.point && (this.maxPoint = Math.max(this.maxPoint, t - e)), !0);
1597
+ }
1598
+ addChunk(e, t) {
1599
+ if ((e - this.lastTo || t.value[0].startSide - this.last.endSide) < 0) return !1;
1600
+ this.from.length && this.finishChunk(!0), this.setMaxPoint = Math.max(this.setMaxPoint, t.maxPoint), this.chunks.push(t), this.chunkPos.push(e);
1601
+ let n = t.value.length - 1;
1602
+ return this.last = t.value[n], this.lastFrom = t.from[n] + e, this.lastTo = t.to[n] + e, !0;
1603
+ }
1604
+ finish() {
1605
+ return this.finishInner(Y.empty);
1606
+ }
1607
+ finishInner(e) {
1608
+ if (this.from.length && this.finishChunk(!1), this.chunks.length == 0) return e;
1609
+ let t = Y.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(e) : e, this.setMaxPoint);
1610
+ return this.from = null, t;
1611
+ }
1612
+ };
1613
+ function qe(e, t, n) {
1614
+ let r = /* @__PURE__ */ new Map();
1615
+ for (let t of e) for (let e = 0; e < t.chunk.length; e++) t.chunk[e].maxPoint <= 0 && r.set(t.chunk[e], t.chunkPos[e]);
1616
+ let i = /* @__PURE__ */ new Set();
1617
+ for (let e of t) for (let t = 0; t < e.chunk.length; t++) {
1618
+ let a = r.get(e.chunk[t]);
1619
+ a != null && (n ? n.mapPos(a) : a) == e.chunkPos[t] && !n?.touchesRange(a, a + e.chunk[t].length) && i.add(e.chunk[t]);
1620
+ }
1621
+ return i;
1622
+ }
1623
+ var Je = class {
1624
+ constructor(e, t, n, r = 0) {
1625
+ this.layer = e, this.skip = t, this.minPoint = n, this.rank = r;
1626
+ }
1627
+ get startSide() {
1628
+ return this.value ? this.value.startSide : 0;
1629
+ }
1630
+ get endSide() {
1631
+ return this.value ? this.value.endSide : 0;
1632
+ }
1633
+ goto(e, t = -1e9) {
1634
+ return this.chunkIndex = this.rangeIndex = 0, this.gotoInner(e, t, !1), this;
1635
+ }
1636
+ gotoInner(e, t, n) {
1637
+ for (; this.chunkIndex < this.layer.chunk.length;) {
1638
+ let t = this.layer.chunk[this.chunkIndex];
1639
+ if (!(this.skip && this.skip.has(t) || this.layer.chunkEnd(this.chunkIndex) < e || t.maxPoint < this.minPoint)) break;
1640
+ this.chunkIndex++, n = !1;
1641
+ }
1642
+ if (this.chunkIndex < this.layer.chunk.length) {
1643
+ let r = this.layer.chunk[this.chunkIndex].findIndex(e - this.layer.chunkPos[this.chunkIndex], t, !0);
1644
+ (!n || this.rangeIndex < r) && this.setRangeIndex(r);
1645
+ }
1646
+ this.next();
1647
+ }
1648
+ forward(e, t) {
1649
+ (this.to - e || this.endSide - t) < 0 && this.gotoInner(e, t, !0);
1650
+ }
1651
+ next() {
1652
+ for (;;) if (this.chunkIndex == this.layer.chunk.length) {
1653
+ this.from = this.to = 1e9, this.value = null;
1654
+ break;
1655
+ } else {
1656
+ let e = this.layer.chunkPos[this.chunkIndex], t = this.layer.chunk[this.chunkIndex], n = e + t.from[this.rangeIndex];
1657
+ if (this.from = n, this.to = e + t.to[this.rangeIndex], this.value = t.value[this.rangeIndex], this.setRangeIndex(this.rangeIndex + 1), this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) break;
1658
+ }
1659
+ }
1660
+ setRangeIndex(e) {
1661
+ if (e == this.layer.chunk[this.chunkIndex].value.length) {
1662
+ if (this.chunkIndex++, this.skip) for (; this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]);) this.chunkIndex++;
1663
+ this.rangeIndex = 0;
1664
+ } else this.rangeIndex = e;
1665
+ }
1666
+ nextChunk() {
1667
+ this.chunkIndex++, this.rangeIndex = 0, this.next();
1668
+ }
1669
+ compare(e) {
1670
+ return this.from - e.from || this.startSide - e.startSide || this.rank - e.rank || this.to - e.to || this.endSide - e.endSide;
1671
+ }
1672
+ }, Ye = class e {
1673
+ constructor(e) {
1674
+ this.heap = e;
1675
+ }
1676
+ static from(t, n = null, r = -1) {
1677
+ let i = [];
1678
+ for (let e = 0; e < t.length; e++) for (let a = t[e]; !a.isEmpty; a = a.nextLayer) a.maxPoint >= r && i.push(new Je(a, n, r, e));
1679
+ return i.length == 1 ? i[0] : new e(i);
1680
+ }
1681
+ get startSide() {
1682
+ return this.value ? this.value.startSide : 0;
1683
+ }
1684
+ goto(e, t = -1e9) {
1685
+ for (let n of this.heap) n.goto(e, t);
1686
+ for (let e = this.heap.length >> 1; e >= 0; e--) Xe(this.heap, e);
1687
+ return this.next(), this;
1688
+ }
1689
+ forward(e, t) {
1690
+ for (let n of this.heap) n.forward(e, t);
1691
+ for (let e = this.heap.length >> 1; e >= 0; e--) Xe(this.heap, e);
1692
+ (this.to - e || this.value.endSide - t) < 0 && this.next();
1693
+ }
1694
+ next() {
1695
+ if (this.heap.length == 0) this.from = this.to = 1e9, this.value = null, this.rank = -1;
1696
+ else {
1697
+ let e = this.heap[0];
1698
+ this.from = e.from, this.to = e.to, this.value = e.value, this.rank = e.rank, e.value && e.next(), Xe(this.heap, 0);
1699
+ }
1700
+ }
1701
+ };
1702
+ function Xe(e, t) {
1703
+ for (let n = e[t];;) {
1704
+ let r = (t << 1) + 1;
1705
+ if (r >= e.length) break;
1706
+ let i = e[r];
1707
+ if (r + 1 < e.length && i.compare(e[r + 1]) >= 0 && (i = e[r + 1], r++), n.compare(i) < 0) break;
1708
+ e[r] = n, e[t] = i, t = r;
1709
+ }
1710
+ }
1711
+ var Z = class {
1712
+ constructor(e, t, n) {
1713
+ this.minPoint = n, this.active = [], this.activeTo = [], this.activeRank = [], this.minActive = -1, this.point = null, this.pointFrom = 0, this.pointRank = 0, this.to = -1e9, this.endSide = 0, this.openStart = -1, this.cursor = Ye.from(e, t, n);
1714
+ }
1715
+ goto(e, t = -1e9) {
1716
+ return this.cursor.goto(e, t), this.active.length = this.activeTo.length = this.activeRank.length = 0, this.minActive = -1, this.to = e, this.endSide = t, this.openStart = -1, this.next(), this;
1717
+ }
1718
+ forward(e, t) {
1719
+ for (; this.minActive > -1 && (this.activeTo[this.minActive] - e || this.active[this.minActive].endSide - t) < 0;) this.removeActive(this.minActive);
1720
+ this.cursor.forward(e, t);
1721
+ }
1722
+ removeActive(e) {
1723
+ Q(this.active, e), Q(this.activeTo, e), Q(this.activeRank, e), this.minActive = $e(this.active, this.activeTo);
1724
+ }
1725
+ addActive(e) {
1726
+ let t = 0, { value: n, to: r, rank: i } = this.cursor;
1727
+ for (; t < this.activeRank.length && (i - this.activeRank[t] || r - this.activeTo[t]) > 0;) t++;
1728
+ $(this.active, t, n), $(this.activeTo, t, r), $(this.activeRank, t, i), e && $(e, t, this.cursor.from), this.minActive = $e(this.active, this.activeTo);
1729
+ }
1730
+ next() {
1731
+ let e = this.to, t = this.point;
1732
+ this.point = null;
1733
+ let n = this.openStart < 0 ? [] : null;
1734
+ for (;;) {
1735
+ let r = this.minActive;
1736
+ if (r > -1 && (this.activeTo[r] - this.cursor.from || this.active[r].endSide - this.cursor.startSide) < 0) {
1737
+ if (this.activeTo[r] > e) {
1738
+ this.to = this.activeTo[r], this.endSide = this.active[r].endSide;
1739
+ break;
1740
+ }
1741
+ this.removeActive(r), n && Q(n, r);
1742
+ } else if (!this.cursor.value) {
1743
+ this.to = this.endSide = 1e9;
1744
+ break;
1745
+ } else if (this.cursor.from > e) {
1746
+ this.to = this.cursor.from, this.endSide = this.cursor.startSide;
1747
+ break;
1748
+ } else {
1749
+ let e = this.cursor.value;
1750
+ if (!e.point) this.addActive(n), this.cursor.next();
1751
+ else if (t && this.cursor.to == this.to && this.cursor.from < this.cursor.to) this.cursor.next();
1752
+ else {
1753
+ this.point = e, this.pointFrom = this.cursor.from, this.pointRank = this.cursor.rank, this.to = this.cursor.to, this.endSide = e.endSide, this.cursor.next(), this.forward(this.to, this.endSide);
1754
+ break;
1755
+ }
1756
+ }
1757
+ }
1758
+ if (n) {
1759
+ this.openStart = 0;
1760
+ for (let t = n.length - 1; t >= 0 && n[t] < e; t--) this.openStart++;
1761
+ }
1762
+ }
1763
+ activeForPoint(e) {
1764
+ if (!this.active.length) return this.active;
1765
+ let t = [];
1766
+ for (let n = this.active.length - 1; n >= 0 && !(this.activeRank[n] < this.pointRank); n--) (this.activeTo[n] > e || this.activeTo[n] == e && this.active[n].endSide >= this.point.endSide) && t.push(this.active[n]);
1767
+ return t.reverse();
1768
+ }
1769
+ openEnd(e) {
1770
+ let t = 0;
1771
+ for (let n = this.activeTo.length - 1; n >= 0 && this.activeTo[n] > e; n--) t++;
1772
+ return t;
1773
+ }
1774
+ };
1775
+ function Ze(e, t, n, r, i, a) {
1776
+ e.goto(t), n.goto(r);
1777
+ let o = r + i, s = r, c = r - t, l = !!a.boundChange;
1778
+ for (let t = !1;;) {
1779
+ let r = e.to + c - n.to, i = r || e.endSide - n.endSide, u = i < 0 ? e.to + c : n.to, d = Math.min(u, o);
1780
+ if (e.point || n.point ? (e.point && n.point && q(e.point, n.point) && Qe(e.activeForPoint(e.to), n.activeForPoint(n.to)) || a.comparePoint(s, d, e.point, n.point), t = !1) : (t && a.boundChange(s), d > s && !Qe(e.active, n.active) && a.compareRange(s, d, e.active, n.active), l && d < o && (r || e.openEnd(u) != n.openEnd(u)) && (t = !0)), u > o) break;
1781
+ s = u, i <= 0 && e.next(), i >= 0 && n.next();
1782
+ }
1783
+ }
1784
+ function Qe(e, t) {
1785
+ if (e.length != t.length) return !1;
1786
+ for (let n = 0; n < e.length; n++) if (e[n] != t[n] && !q(e[n], t[n])) return !1;
1787
+ return !0;
1788
+ }
1789
+ function Q(e, t) {
1790
+ for (let n = t, r = e.length - 1; n < r; n++) e[n] = e[n + 1];
1791
+ e.pop();
1792
+ }
1793
+ function $(e, t, n) {
1794
+ for (let n = e.length - 1; n >= t; n--) e[n + 1] = e[n];
1795
+ e[t] = n;
1796
+ }
1797
+ function $e(e, t) {
1798
+ let n = -1, r = 1e9;
1799
+ for (let i = 0; i < t.length; i++) (t[i] - r || e[i].endSide - e[n].endSide) < 0 && (n = i, r = t[i]);
1800
+ return n;
1801
+ }
1802
+ function et(e, t, n = e.length) {
1803
+ let r = 0;
1804
+ for (let i = 0; i < n && i < e.length;) e.charCodeAt(i) == 9 ? (r += t - r % t, i++) : (r++, i = y(e, i));
1805
+ return r;
1806
+ }
1807
+ function tt(e, t, n, r) {
1808
+ for (let r = 0, i = 0;;) {
1809
+ if (i >= t) return r;
1810
+ if (r == e.length) break;
1811
+ i += e.charCodeAt(r) == 9 ? n - i % n : 1, r = y(e, r);
1812
+ }
1813
+ return r === !0 ? -1 : e.length;
1814
+ }
1815
+ //#endregion
1816
+ export { tt as C, y as S, ce as _, O as a, et as b, x as c, X as d, K as f, H as g, p as h, W as i, ye as l, N as m, S as n, G as o, V as p, C as r, k as s, B as t, Y as u, ue as v, le as w, ee as x, Ue as y };