@brett_lamy/ui 5.15.0 → 5.16.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 (121) hide show
  1. package/dist/components/call-stack.d.ts +26 -0
  2. package/dist/components/call-stack.d.ts.map +1 -0
  3. package/dist/components/call-stack.js +236 -0
  4. package/dist/components/code-editor-window.d.ts +191 -0
  5. package/dist/components/code-editor-window.d.ts.map +1 -0
  6. package/dist/components/code-editor-window.js +1474 -0
  7. package/dist/components/code-editor.d.ts +213 -0
  8. package/dist/components/code-editor.d.ts.map +1 -0
  9. package/dist/components/code-editor.js +484 -0
  10. package/dist/components/debug-toolbar.d.ts +13 -0
  11. package/dist/components/debug-toolbar.d.ts.map +1 -0
  12. package/dist/components/debug-toolbar.js +85 -0
  13. package/dist/components/file-upload.d.ts +1 -1
  14. package/dist/components/file-upload.d.ts.map +1 -1
  15. package/dist/components/file-upload.js +1 -1
  16. package/dist/components/filter-input.d.ts +1 -1
  17. package/dist/components/filter-input.d.ts.map +1 -1
  18. package/dist/components/filter-input.js +1 -1
  19. package/dist/components/filter.d.ts +1 -1
  20. package/dist/components/filter.d.ts.map +1 -1
  21. package/dist/components/filter.js +1 -1
  22. package/dist/components/log-list.d.ts +95 -0
  23. package/dist/components/log-list.d.ts.map +1 -0
  24. package/dist/components/log-list.js +549 -0
  25. package/dist/components/object-tree.d.ts +30 -0
  26. package/dist/components/object-tree.d.ts.map +1 -0
  27. package/dist/components/object-tree.js +415 -0
  28. package/dist/components/object-value.d.ts +13 -0
  29. package/dist/components/object-value.d.ts.map +1 -0
  30. package/dist/components/object-value.js +69 -0
  31. package/dist/components/request-table.d.ts +78 -0
  32. package/dist/components/request-table.d.ts.map +1 -0
  33. package/dist/components/request-table.js +697 -0
  34. package/dist/components/spreadsheet.d.ts +1 -1
  35. package/dist/components/spreadsheet.d.ts.map +1 -1
  36. package/dist/components/spreadsheet.js +1 -1
  37. package/dist/components/syntax-highlighting.d.ts +45 -77
  38. package/dist/components/syntax-highlighting.d.ts.map +1 -1
  39. package/dist/components/syntax-highlighting.js +36 -275
  40. package/dist/components/terminal.d.ts +62 -0
  41. package/dist/components/terminal.d.ts.map +1 -0
  42. package/dist/components/terminal.js +172 -0
  43. package/dist/components/trace-timeline.d.ts +97 -0
  44. package/dist/components/trace-timeline.d.ts.map +1 -0
  45. package/dist/components/trace-timeline.js +850 -0
  46. package/dist/components/tree.d.ts.map +1 -1
  47. package/dist/components/tree.js +99 -91
  48. package/dist/components/video-preview.d.ts +1 -1
  49. package/dist/components/video-preview.d.ts.map +1 -1
  50. package/dist/components/video-preview.js +1 -1
  51. package/dist/components/video-timeline.d.ts +1 -1
  52. package/dist/components/video-timeline.d.ts.map +1 -1
  53. package/dist/components/video-timeline.js +1 -1
  54. package/dist/components/workspace.d.ts.map +1 -1
  55. package/dist/components/workspace.js +1 -1
  56. package/dist/index.css +1 -1
  57. package/dist/index.d.ts +47 -11
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +120 -100
  60. package/dist/lib/call-stack-model.d.ts +75 -0
  61. package/dist/lib/call-stack-model.d.ts.map +1 -0
  62. package/dist/lib/call-stack-model.js +114 -0
  63. package/dist/lib/code-document.d.ts +229 -0
  64. package/dist/lib/code-document.d.ts.map +1 -0
  65. package/dist/lib/code-document.js +727 -0
  66. package/dist/lib/code-editor-gpu.d.ts +9 -0
  67. package/dist/lib/code-editor-gpu.d.ts.map +1 -0
  68. package/dist/lib/code-editor-gpu.js +23 -0
  69. package/dist/lib/code-editor-model.d.ts +371 -0
  70. package/dist/lib/code-editor-model.d.ts.map +1 -0
  71. package/dist/lib/code-editor-model.js +1105 -0
  72. package/dist/lib/{file-upload.d.ts → file-upload-model.d.ts} +1 -1
  73. package/dist/lib/file-upload-model.d.ts.map +1 -0
  74. package/dist/lib/{file-upload.js → file-upload-model.js} +1 -1
  75. package/dist/lib/{filter.d.ts → filter-model.d.ts} +1 -1
  76. package/dist/lib/filter-model.d.ts.map +1 -0
  77. package/dist/lib/{filter.js → filter-model.js} +1 -1
  78. package/dist/lib/filter-query.d.ts +1 -1
  79. package/dist/lib/filter-query.d.ts.map +1 -1
  80. package/dist/lib/filter-query.js +1 -1
  81. package/dist/lib/log-list-model.d.ts +132 -0
  82. package/dist/lib/log-list-model.d.ts.map +1 -0
  83. package/dist/lib/log-list-model.js +214 -0
  84. package/dist/lib/log-list-window.d.ts +121 -0
  85. package/dist/lib/log-list-window.d.ts.map +1 -0
  86. package/dist/lib/log-list-window.js +245 -0
  87. package/dist/lib/object-tree-model.d.ts +162 -0
  88. package/dist/lib/object-tree-model.d.ts.map +1 -0
  89. package/dist/lib/object-tree-model.js +347 -0
  90. package/dist/lib/object-tree-value.d.ts +139 -0
  91. package/dist/lib/object-tree-value.d.ts.map +1 -0
  92. package/dist/lib/object-tree-value.js +410 -0
  93. package/dist/lib/request-table-model.d.ts +85 -0
  94. package/dist/lib/request-table-model.d.ts.map +1 -0
  95. package/dist/lib/request-table-model.js +105 -0
  96. package/dist/lib/{spreadsheet.d.ts → spreadsheet-model.d.ts} +1 -1
  97. package/dist/lib/spreadsheet-model.d.ts.map +1 -0
  98. package/dist/lib/{spreadsheet.js → spreadsheet-model.js} +1 -1
  99. package/dist/lib/syntax.d.ts +19 -7
  100. package/dist/lib/syntax.d.ts.map +1 -1
  101. package/dist/lib/syntax.js +54 -50
  102. package/dist/lib/terminal-line.d.ts +155 -0
  103. package/dist/lib/terminal-line.d.ts.map +1 -0
  104. package/dist/lib/terminal-line.js +463 -0
  105. package/dist/lib/trace-timeline-draw.d.ts +109 -0
  106. package/dist/lib/trace-timeline-draw.d.ts.map +1 -0
  107. package/dist/lib/trace-timeline-draw.js +252 -0
  108. package/dist/lib/trace-timeline-model.d.ts +324 -0
  109. package/dist/lib/trace-timeline-model.d.ts.map +1 -0
  110. package/dist/lib/trace-timeline-model.js +510 -0
  111. package/dist/lib/video-render.d.ts +1 -1
  112. package/dist/lib/video-render.d.ts.map +1 -1
  113. package/dist/lib/video-render.js +1 -1
  114. package/dist/lib/{video-timeline.d.ts → video-timeline-model.d.ts} +1 -1
  115. package/dist/lib/video-timeline-model.d.ts.map +1 -0
  116. package/dist/lib/{video-timeline.js → video-timeline-model.js} +1 -1
  117. package/package.json +5 -1
  118. package/dist/lib/file-upload.d.ts.map +0 -1
  119. package/dist/lib/filter.d.ts.map +0 -1
  120. package/dist/lib/spreadsheet.d.ts.map +0 -1
  121. package/dist/lib/video-timeline.d.ts.map +0 -1
@@ -0,0 +1,1105 @@
1
+ //#region src/lib/code-editor-model.ts
2
+ var e = /^[\x20-\x7e\xa0-\xac\xae-\u02ff\u0370-\u0482\u048a-\u052f]*$/, t = /[\p{Emoji_Presentation}\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}\p{Script=Yi}\u2e80-\u303e\u3200-\u33ff\ufe10-\ufe19\ufe30-\ufe6f\uff01-\uff60\uffe0-\uffe6]/u, n = /[\p{Mn}\p{Me}\p{Emoji_Modifier}\u200c\u200d]/u, r = (e) => e >= 127462 && e <= 127487, i = /* @__PURE__ */ new Map();
3
+ function a(e) {
4
+ if (e < 768) return 1;
5
+ if (e >= 19968 && e <= 40959) return 2;
6
+ let r = i.get(e);
7
+ if (r === void 0) {
8
+ let a = String.fromCodePoint(e);
9
+ r = n.test(a) ? 0 : t.test(a) ? 2 : 1, i.set(e, r);
10
+ }
11
+ return r;
12
+ }
13
+ function o(e, t) {
14
+ let n = e.charCodeAt(t);
15
+ if (n >= 55296 && n <= 56319 && t + 1 < e.length) {
16
+ let r = e.charCodeAt(t + 1);
17
+ if (r >= 56320 && r <= 57343) return (n - 55296 << 10) + (r - 56320) + 65536;
18
+ }
19
+ return n;
20
+ }
21
+ function s(e, t) {
22
+ let n = o(e, t), i = t + (n > 65535 ? 2 : 1), s = e.length;
23
+ for (r(n) && i < s && r(o(e, i)) && (i += 2); i < s && !(e.charCodeAt(i) < 768);) {
24
+ let t = o(e, i);
25
+ if (a(t) !== 0) break;
26
+ i += t > 65535 ? 2 : 1, t === 8205 && i < s && (i += o(e, i) > 65535 ? 2 : 1);
27
+ }
28
+ return i;
29
+ }
30
+ function c(e, t, n, i) {
31
+ let s = e.charCodeAt(t);
32
+ if (s === 9) return i - n % i;
33
+ if (s < 768) return 1;
34
+ let c = o(e, t);
35
+ return r(c) ? 2 : a(c) || 1;
36
+ }
37
+ var l = 1024, u = 16384, d = class t {
38
+ text;
39
+ tabSize;
40
+ plain;
41
+ cells;
42
+ marks = null;
43
+ markCount = 0;
44
+ constructor(t, n = 2, r) {
45
+ if (this.text = t, this.tabSize = n, r) {
46
+ this.plain = r.plain, this.cells = r.cells, this.marks = r.marks, this.markCount = r.markCount;
47
+ return;
48
+ }
49
+ if (this.plain = e.test(t), this.plain) {
50
+ this.cells = t.length;
51
+ return;
52
+ }
53
+ let i = new Int32Array(2 * (Math.floor(t.length / l) + 2)), a = 0, o = 0, u = 0, d = 0, f = t.length;
54
+ for (; o < f;) o >= d && (i[a * 2] = o, i[a * 2 + 1] = u, a++, d = o + l), u += c(t, o, u, n), o = s(t, o);
55
+ this.marks = i, this.markCount = a, this.cells = u;
56
+ }
57
+ edited(n, r, i, a) {
58
+ let { tabSize: o } = this;
59
+ if (n.length < u) return new t(n, o);
60
+ let d = e.test(a);
61
+ if (this.plain && d) return new t(n, o, {
62
+ plain: !0,
63
+ cells: n.length,
64
+ marks: null,
65
+ markCount: 0
66
+ });
67
+ let f = (e) => this.marks ? this.marks[e * 2] : e * l, p = (e) => this.marks ? this.marks[e * 2 + 1] : e * l, m = this.marks ? this.markCount : Math.ceil(this.text.length / l), h = a.length - i, g = r + a.length, _ = 0, v = 0, y = m;
68
+ for (; v < y;) {
69
+ let e = v + y >> 1;
70
+ f(e) < r ? v = e + 1 : y = e;
71
+ }
72
+ _ = v;
73
+ let b = [], x = _ ? f(_ - 1) : 0, S = _ ? p(_ - 1) : 0, C = _ ? x + l : 0;
74
+ _ && (b.push(x, S), _--);
75
+ let w = v, T = n.length, E = -1;
76
+ for (; x < T;) {
77
+ if (x >= g) {
78
+ for (; w < m && f(w) + h < x;) w++;
79
+ if (w < m && f(w) + h === x) {
80
+ E = w;
81
+ break;
82
+ }
83
+ }
84
+ x >= C && ((!b.length || b[b.length - 2] !== x) && b.push(x, S), C = x + l), S += c(n, x, S, o), x = s(n, x);
85
+ }
86
+ let D, O = 0, k = 0, A = 0, j = -1;
87
+ if (E >= 0) {
88
+ if (k = S - p(E), A = k, k % o !== 0 && (j = n.indexOf(" ", x), j >= 0)) {
89
+ let e = E;
90
+ for (; e + 1 < m && f(e + 1) + h <= j;) e++;
91
+ let t = f(e) + h, r = p(e) + k;
92
+ for (; t < j;) r += c(n, t, r, o), t = s(n, t);
93
+ let i = r + (o - r % o), a = r - k;
94
+ A = i - (a + (o - a % o));
95
+ }
96
+ D = this.cells + A, O = m - E;
97
+ } else D = S;
98
+ let M = _ + b.length / 2 + O, N = new Int32Array(Math.max(2, M * 2)), P = 0;
99
+ for (let e = 0; e < _; e++) N[P++] = f(e), N[P++] = p(e);
100
+ for (let e = 0; e < b.length; e++) N[P++] = b[e];
101
+ if (E >= 0) for (let e = E; e < m; e++) {
102
+ let t = f(e) + h;
103
+ N[P++] = t, N[P++] = p(e) + (j >= 0 && t > j ? A : k);
104
+ }
105
+ return new t(n, o, {
106
+ plain: !1,
107
+ cells: D,
108
+ marks: N,
109
+ markCount: M
110
+ });
111
+ }
112
+ markBefore(e, t) {
113
+ let n = this.marks, r = 0, i = this.markCount - 1;
114
+ for (; r < i;) {
115
+ let a = r + i + 1 >> 1;
116
+ n[a * 2 + t] <= e ? r = a : i = a - 1;
117
+ }
118
+ return r;
119
+ }
120
+ cellAt(e) {
121
+ if (e <= 0) return 0;
122
+ if (this.plain) return Math.min(e, this.text.length);
123
+ if (e >= this.text.length) return this.cells;
124
+ let t = this.marks, n = this.markBefore(e, 0), r = t[n * 2], i = t[n * 2 + 1];
125
+ for (;;) {
126
+ let t = s(this.text, r);
127
+ if (t > e) return i;
128
+ i += c(this.text, r, i, this.tabSize), r = t;
129
+ }
130
+ }
131
+ offsetAt(e) {
132
+ if (e <= 0) return 0;
133
+ if (this.plain) return Math.min(e, this.text.length);
134
+ if (e >= this.cells) return this.text.length;
135
+ let t = this.marks, n = this.markBefore(e, 1), r = t[n * 2], i = t[n * 2 + 1];
136
+ for (;;) {
137
+ let t = c(this.text, r, i, this.tabSize);
138
+ if (i + t > e) return r;
139
+ i += t, r = s(this.text, r);
140
+ }
141
+ }
142
+ nearest(e) {
143
+ if (e <= 0) return 0;
144
+ if (this.plain) return Math.min(Math.round(e), this.text.length);
145
+ if (e >= this.cells) return this.text.length;
146
+ let t = this.offsetAt(Math.floor(e)), n = s(this.text, t), r = this.cellAt(t), i = this.cellAt(n);
147
+ return e - r < (i - r) / 2 ? t : n;
148
+ }
149
+ after(e) {
150
+ return e >= this.text.length ? this.text.length : this.plain ? e + 1 : s(this.text, this.offsetAt(this.cellAt(e)));
151
+ }
152
+ before(e) {
153
+ if (e <= 0) return 0;
154
+ if (this.plain) return e - 1;
155
+ let t = this.cellAt(Math.min(e, this.text.length)), n = this.offsetAt(t);
156
+ return n < e ? n : this.offsetAt(t - 1);
157
+ }
158
+ };
159
+ function f(e) {
160
+ return e < 32 ? String.fromCharCode(9216 + e) : e === 127 ? "␡" : "·";
161
+ }
162
+ var p = (e) => e < 32 || e >= 127 && e < 160 || e === 173 || e >= 8203 && e <= 8207 || e >= 8232 && e <= 8238 || e >= 8288 && e <= 8303 || e === 65279, m = /[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Adlam}]/u, h = /* @__PURE__ */ new Map();
163
+ function g(e) {
164
+ if (e < 1424) return !1;
165
+ let t = h.get(e);
166
+ return t === void 0 && (t = m.test(String.fromCodePoint(e)), h.set(e, t)), t;
167
+ }
168
+ function _(e, t, n) {
169
+ let r = s(e, t), i = r;
170
+ for (; i < n;) {
171
+ let t = e.charCodeAt(i);
172
+ if (t === 32 || t === 44 || t === 46 || t === 58 || t === 33 || t === 63 || t === 45 || t === 1548 || t === 1563 || t === 1567) {
173
+ i++;
174
+ continue;
175
+ }
176
+ if (!g(o(e, i))) break;
177
+ i = s(e, i), r = i;
178
+ }
179
+ return Math.min(r, n);
180
+ }
181
+ function v(e, t, n) {
182
+ let { text: r, tabSize: i } = e;
183
+ if (t >= n) return [];
184
+ if (e.plain) return [r.slice(t, n)];
185
+ let a = [], l = n, u = "", d = t, m = e.cellAt(t);
186
+ for (; d < n;) {
187
+ let t = r.charCodeAt(d);
188
+ if (t >= 1424 && g(o(r, d))) {
189
+ u && a.push(u), u = "";
190
+ let t = _(r, d, l), n = e.cellAt(t) - m;
191
+ a.push({
192
+ text: r.slice(d, t),
193
+ cells: n,
194
+ rtl: !0
195
+ }), m += n, d = t;
196
+ continue;
197
+ }
198
+ let n = s(r, d), h = c(r, d, m, i);
199
+ t === 9 ? u += " ".repeat(h) : p(t) ? (u && a.push(u), u = "", a.push({
200
+ text: f(t),
201
+ cells: h,
202
+ control: !0
203
+ })) : t < 1328 && !(t >= 768 && t < 880) ? u += r.slice(d, n) : (u && a.push(u), u = "", a.push({
204
+ text: r.slice(d, n),
205
+ cells: h
206
+ })), m += h, d = n;
207
+ }
208
+ return u && a.push(u), a;
209
+ }
210
+ var y = 32;
211
+ function b(e, t, n, r) {
212
+ let i = Math.max(0, Math.min(r, Math.floor(e / n)));
213
+ return {
214
+ start: i,
215
+ end: Math.max(i, Math.min(r, Math.ceil((e + t) / n)))
216
+ };
217
+ }
218
+ function x(e, t, n, r = 8) {
219
+ return e && t.start >= e.start && t.end <= e.end && e.end <= n ? e : {
220
+ start: Math.max(0, t.start - r),
221
+ end: Math.min(n, t.end + r)
222
+ };
223
+ }
224
+ function S(e, t, n) {
225
+ let r = Math.max(0, Math.floor(e / n));
226
+ return {
227
+ start: r,
228
+ end: r + Math.max(1, Math.ceil(t / n) + 1)
229
+ };
230
+ }
231
+ function C(e, t) {
232
+ return e && t.start >= e.start && t.end <= e.end ? e : {
233
+ start: Math.max(0, Math.floor((t.start - y) / 128) * 128),
234
+ end: Math.ceil((t.end + y) / 128) * 128
235
+ };
236
+ }
237
+ var w = (e, t) => Math.floor(e / t) * t, T = 16e6, E = (e) => Math.min(e, T);
238
+ function D(e, t, n) {
239
+ if (t <= 16e6) return e;
240
+ let r = T - n;
241
+ return r > 0 ? e / r * (t - n) : 0;
242
+ }
243
+ function O(e, t, n) {
244
+ if (t <= 16e6) return e;
245
+ let r = t - n;
246
+ return r > 0 ? e / r * (T - n) : 0;
247
+ }
248
+ function k(e, t, n, r, i, a = 0) {
249
+ switch (i) {
250
+ case "start": return e;
251
+ case "end": return e + t - n;
252
+ case "center": return e + t / 2 - n / 2;
253
+ default: return e - a < r ? e - a : e + t + a > r + n ? e + t + a - n : r;
254
+ }
255
+ }
256
+ function A(e, t, n, r, i) {
257
+ return e >= r + i && e + t <= r + n - i ? r : e - n / 3;
258
+ }
259
+ function j(e) {
260
+ return {
261
+ rowCount: e,
262
+ rowOfLine: (e) => e,
263
+ locate: (e) => ({
264
+ line: e,
265
+ part: 0
266
+ })
267
+ };
268
+ }
269
+ function M(e, t) {
270
+ let n = Math.max(1, t), r = e.length, i = new Float64Array(r + 1);
271
+ for (let t = 0; t < r; t++) i[t + 1] = i[t] + Math.max(1, Math.ceil(e[t] / n));
272
+ return {
273
+ rowCount: i[r],
274
+ rowOfLine: (e) => i[Math.max(0, Math.min(r, e))],
275
+ locate(e) {
276
+ let t = 0, n = Math.max(0, r - 1);
277
+ for (; t < n;) {
278
+ let r = t + n + 1 >> 1;
279
+ i[r] <= e ? t = r : n = r - 1;
280
+ }
281
+ return {
282
+ line: t,
283
+ part: Math.max(0, e - i[t])
284
+ };
285
+ }
286
+ };
287
+ }
288
+ function N(e, t, n) {
289
+ let r = (t) => {
290
+ let n = e.offsetAt(t);
291
+ return e.cellAt(n) < t ? e.after(n) : n;
292
+ };
293
+ return {
294
+ start: r(t * n),
295
+ end: r((t + 1) * n)
296
+ };
297
+ }
298
+ var P = (e, t) => e.line - t.line || e.offset - t.offset;
299
+ function F(e) {
300
+ return P(e.anchor, e.focus) <= 0 ? {
301
+ from: e.anchor,
302
+ to: e.focus
303
+ } : {
304
+ from: e.focus,
305
+ to: e.anchor
306
+ };
307
+ }
308
+ var ee = (e) => P(e.anchor, e.focus) === 0, te = 67108864;
309
+ function ne(e, t, n = te) {
310
+ let { from: r, to: i } = F(e);
311
+ if (r.line === i.line) {
312
+ let e = t(r.line).slice(r.offset, i.offset);
313
+ return e.length > n ? {
314
+ text: e.slice(0, n),
315
+ truncated: !0
316
+ } : {
317
+ text: e,
318
+ truncated: !1
319
+ };
320
+ }
321
+ let a = [], o = 0;
322
+ for (let e = r.line; e <= i.line; e++) {
323
+ let s = t(e), c = e === r.line ? s.slice(r.offset) : e === i.line ? s.slice(0, i.offset) : s;
324
+ if (o + c.length > n) return a.push(c.slice(0, Math.max(0, n - o))), {
325
+ text: a.join("\n"),
326
+ truncated: !0
327
+ };
328
+ a.push(c), o += c.length + 1;
329
+ }
330
+ return {
331
+ text: a.join("\n"),
332
+ truncated: !1
333
+ };
334
+ }
335
+ function re(e, t, n, r) {
336
+ let { line: i, offset: a } = e, o = n(i);
337
+ switch (t) {
338
+ case "Home": return {
339
+ line: i,
340
+ offset: 0
341
+ };
342
+ case "End": return {
343
+ line: i,
344
+ offset: o.text.length
345
+ };
346
+ case "ArrowLeft": return a > 0 ? {
347
+ line: i,
348
+ offset: o.before(a)
349
+ } : i > 0 ? {
350
+ line: i - 1,
351
+ offset: n(i - 1).text.length
352
+ } : e;
353
+ case "ArrowRight": return a < o.text.length ? {
354
+ line: i,
355
+ offset: o.after(a)
356
+ } : i < r - 1 ? {
357
+ line: i + 1,
358
+ offset: 0
359
+ } : e;
360
+ case "ArrowUp": return i > 0 ? {
361
+ line: i - 1,
362
+ offset: n(i - 1).nearest(o.cellAt(a))
363
+ } : {
364
+ line: i,
365
+ offset: 0
366
+ };
367
+ default: return i < r - 1 ? {
368
+ line: i + 1,
369
+ offset: n(i + 1).nearest(o.cellAt(a))
370
+ } : {
371
+ line: i,
372
+ offset: o.text.length
373
+ };
374
+ }
375
+ }
376
+ function ie(e, t, n) {
377
+ let { from: r, to: i } = e;
378
+ if (t < r.line || t > i.line) return null;
379
+ let a = t === r.line ? n.cellAt(r.offset) : 0, o = t === i.line ? n.cellAt(i.offset) : n.cells + 1;
380
+ return o > a ? {
381
+ start: a,
382
+ end: o
383
+ } : null;
384
+ }
385
+ function ae(e, t, n, r, i) {
386
+ if (n === "char") return {
387
+ anchor: e.anchor,
388
+ focus: t
389
+ };
390
+ let { from: a, to: o } = F(e), s = P(t, a) < 0;
391
+ if (!s && P(t, o) <= 0) return {
392
+ anchor: a,
393
+ focus: o
394
+ };
395
+ if (n === "word") {
396
+ let e = L(r(t.line), t.offset);
397
+ return s ? {
398
+ anchor: o,
399
+ focus: {
400
+ line: t.line,
401
+ offset: e.start
402
+ }
403
+ } : {
404
+ anchor: a,
405
+ focus: {
406
+ line: t.line,
407
+ offset: e.end
408
+ }
409
+ };
410
+ }
411
+ return s ? {
412
+ anchor: o,
413
+ focus: {
414
+ line: t.line,
415
+ offset: 0
416
+ }
417
+ } : {
418
+ anchor: a,
419
+ focus: t.line >= i - 1 ? {
420
+ line: t.line,
421
+ offset: r(t.line).length
422
+ } : {
423
+ line: t.line + 1,
424
+ offset: 0
425
+ }
426
+ };
427
+ }
428
+ var I = (e) => e >= 48 && e <= 57 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e === 95 || e === 36 || e >= 128;
429
+ function L(e, t) {
430
+ if (!e.length) return {
431
+ start: 0,
432
+ end: 0
433
+ };
434
+ let n = Math.min(t, e.length - 1), r = e.charCodeAt(n), i = r === 32 || r === 9 ? (e) => e === 32 || e === 9 : I(r) ? I : null;
435
+ if (!i) return {
436
+ start: n,
437
+ end: n + 1
438
+ };
439
+ let a = n, o = n + 1;
440
+ for (; a > 0 && i(e.charCodeAt(a - 1));) a--;
441
+ for (; o < e.length && i(e.charCodeAt(o));) o++;
442
+ return {
443
+ start: a,
444
+ end: o
445
+ };
446
+ }
447
+ var R = /* @__PURE__ */ new WeakMap();
448
+ function oe(e, t, n) {
449
+ if (!e.length) return e;
450
+ let r = R.get(e);
451
+ r || (r = e.every((t, n) => n === 0 || e[n - 1].column <= t.column) ? e : [...e].sort((e, t) => e.column - t.column), R.set(e, r));
452
+ let i = (e) => {
453
+ let t = 0, n = r.length;
454
+ for (; t < n;) {
455
+ let i = t + n >> 1;
456
+ r[i].column < e ? t = i + 1 : n = i;
457
+ }
458
+ return t;
459
+ }, a = i(t), o = i(n);
460
+ return a === 0 && o === r.length ? r : r.slice(a, o);
461
+ }
462
+ function z(e, t, n, r) {
463
+ let i = [], a = t;
464
+ for (let t of e) {
465
+ let e = a + t.text.length;
466
+ if (e > n && a < r && i.push(a >= n && e <= r ? t : {
467
+ ...t,
468
+ text: t.text.slice(Math.max(0, n - a), r - a)
469
+ }), a = e, a >= r) break;
470
+ }
471
+ return i;
472
+ }
473
+ var B = 0, V = 1, H = 2, U = 3, W = 4, se = 5, G = {
474
+ mode: B,
475
+ regexAllowed: !0,
476
+ templates: [],
477
+ depth: 0
478
+ }, K = (e) => e.mode === B && e.templates.length === 0, ce = new Set("as async await break case catch class const continue debugger def default delete do elif else enum export extends finally fn for from func function go if impl implements import in instanceof interface let match mod module mut new of package pass private protected pub public raise readonly return static struct super switch then this throw trait try type typeof use var void where while with yield fi done esac local echo".split(" ")), le = new Set("true false null undefined nil None True False NaN Infinity self".split(" ")), ue = new Set("return typeof instanceof in of new delete void throw case do else yield await".split(" ")), de = 10, q = (e) => e >= 48 && e <= 57, fe = (e) => e >= 65 && e <= 90 || e >= 97 && e <= 122 || e === 95 || e === 36 || e >= 128, J = (e) => fe(e) || q(e), pe = (e) => e === 61 || e === 60 || e === 62 || e === 33 || e === 43 || e === 45 || e === 42 || e === 37 || e === 38 || e === 124 || e === 94 || e === 126 || e === 63 || e === 58, me = 1024;
479
+ function he(e, t) {
480
+ let n = Math.min(e.length, t + me), r = !1;
481
+ for (let i = t + 1; i < n; i++) {
482
+ let t = e.charCodeAt(i);
483
+ if (t === 92) i++;
484
+ else if (t === 91) r = !0;
485
+ else if (t === 93) r = !1;
486
+ else if (t === 47 && !r) {
487
+ let t = i + 1;
488
+ for (; t < e.length && J(e.charCodeAt(t));) t++;
489
+ return t;
490
+ }
491
+ }
492
+ return -1;
493
+ }
494
+ function ge(e, t, n, r) {
495
+ let i = t;
496
+ for (; i < e.length;) {
497
+ let t = e.charCodeAt(i);
498
+ if (t === 92) i += 2;
499
+ else if (t === r) return i + 1;
500
+ else if (i >= n) return ~i;
501
+ else i++;
502
+ }
503
+ return ~Math.min(i, e.length);
504
+ }
505
+ function Y(e, t, n, r, i) {
506
+ let a = e.length, o = t, s = r.mode, c = r.regexAllowed, l = r.templates, u = r.depth;
507
+ for (; o < n && o < a;) if (s === B) {
508
+ let t = e.charCodeAt(o);
509
+ if (t === 32 || t === 9) o++;
510
+ else if (fe(t)) {
511
+ let n = o + 1;
512
+ for (; n < a && J(e.charCodeAt(n));) n++;
513
+ let r = e.charCodeAt(o - 1) === 46, s = "plain", l = n - o <= de, u = l ? e.slice(o, n) : "";
514
+ if (c = l && !r && ue.has(u), l && !r && ce.has(u)) s = "keyword";
515
+ else if (l && !r && le.has(u)) s = "constant";
516
+ else {
517
+ let r = n;
518
+ for (; r < a && r < n + 4 && e.charCodeAt(r) === 32;) r++;
519
+ if (e.charCodeAt(r) === 40) s = "function";
520
+ else {
521
+ let n = e.charCodeAt(o + 1);
522
+ t >= 65 && t <= 90 && n >= 97 && n <= 122 && (s = "type");
523
+ }
524
+ }
525
+ s !== "plain" && i?.(o, n, s), o = n;
526
+ } else if (q(t) || t === 46 && q(e.charCodeAt(o + 1))) {
527
+ let n = o + 1, r = t === 48 && e.charCodeAt(o + 1) | 32;
528
+ if (r === 120 || r === 111 || r === 98) for (n = o + 2; n < a && J(e.charCodeAt(n));) n++;
529
+ else for (; n < a;) {
530
+ let t = e.charCodeAt(n);
531
+ if (J(t) || t === 46) {
532
+ if ((t | 32) == 101) {
533
+ let t = e.charCodeAt(n + 1);
534
+ (t === 43 || t === 45) && q(e.charCodeAt(n + 2)) && (n += 2);
535
+ }
536
+ if (t === 46 && !q(e.charCodeAt(n + 1))) break;
537
+ n++;
538
+ } else break;
539
+ }
540
+ i?.(o, n, "number"), c = !1, o = n;
541
+ } else if (t === 34 || t === 39) {
542
+ let r = ge(e, o + 1, n, t);
543
+ s = r < 0 ? t === 34 ? W : U : B, i?.(o, r < 0 ? ~r : r, "string"), c = !1, o = r < 0 ? ~r : r;
544
+ } else if (t === 96) s = se, i?.(o, o + 1, "string"), o++;
545
+ else if (t === 47) {
546
+ let t = e.charCodeAt(o + 1);
547
+ if (t === 47) i?.(o, a, "comment"), o = a;
548
+ else if (t === 42) s = V, i?.(o, o + 2, "comment"), o += 2;
549
+ else {
550
+ let n = c && e.charCodeAt(o - 1) !== 60 ? he(e, o) : -1;
551
+ if (n > 0) i?.(o, n, "string"), c = !1, o = n;
552
+ else {
553
+ let e = t === 61 ? 2 : 1;
554
+ i?.(o, o + e, "operator"), c = !0, o += e;
555
+ }
556
+ }
557
+ } else if (t === 35) {
558
+ let t = e.charCodeAt(o + 1);
559
+ o + 1 >= a || t === 32 || t === 9 || t === 33 ? (i?.(o, a, "comment"), o = a) : o++;
560
+ } else if (t === 60 && e.startsWith("<!--", o)) s = H, i?.(o, o + 4, "comment"), o += 4;
561
+ else if (pe(t)) {
562
+ let n = o + 1;
563
+ for (; n < a && pe(e.charCodeAt(n));) n++;
564
+ e.charCodeAt(n - 1) === 63 && e.charCodeAt(n) === 46 && !q(e.charCodeAt(n + 1)) && n++, (n !== o + 1 || t !== 58) && i?.(o, n, "operator"), c = n !== o + 2 || t !== 43 && t !== 45 || e.charCodeAt(o + 1) !== t, o = n;
565
+ } else if (t === 46) {
566
+ let t = o + 1;
567
+ for (; t < a && t < o + 3 && e.charCodeAt(t) === 46;) t++;
568
+ t > o + 1 && i?.(o, t, "operator"), c = t > o + 1, o = t;
569
+ } else t === 123 ? (l.length && u++, c = !0, o++) : t === 125 ? (l.length && u === 0 ? (u = l[l.length - 1], l = l.slice(0, -1), i?.(o, o + 1, "operator"), s = se) : (l.length && u--, c = !1), o++) : (c = t === 40 || t === 91 || t === 44 || t === 59, o++);
570
+ } else if (s === V || s === H) {
571
+ let t = s === V ? "*/" : "-->", r = e.indexOf(t, o);
572
+ if (r >= 0 && r < n) i?.(o, r + t.length, "comment"), o = r + t.length, s = B, c = !0;
573
+ else {
574
+ let e = Math.min(n, a);
575
+ i?.(o, e, "comment"), o = e;
576
+ }
577
+ } else if (s === U || s === W) {
578
+ let t = ge(e, o, n, s === U ? 39 : 34);
579
+ t >= 0 && (s = B), i?.(o, t < 0 ? ~t : t, "string"), c = !1, o = t < 0 ? ~t : t;
580
+ } else {
581
+ let t = o, r = !1;
582
+ for (; t < a && t < n;) {
583
+ let n = e.charCodeAt(t);
584
+ if (n === 92) t += 2;
585
+ else if (n === 96) {
586
+ t++, s = B, c = !1;
587
+ break;
588
+ } else if (n === 36 && e.charCodeAt(t + 1) === 123) {
589
+ r = !0;
590
+ break;
591
+ } else t++;
592
+ }
593
+ t = Math.min(t, a), t > o && i?.(o, t, "string"), o = t, r && (i?.(o, o + 2, "operator"), l = [...l, u], u = 0, s = B, c = !0, o += 2);
594
+ }
595
+ return {
596
+ offset: Math.max(o, t),
597
+ state: {
598
+ mode: s,
599
+ regexAllowed: c,
600
+ templates: l,
601
+ depth: u
602
+ }
603
+ };
604
+ }
605
+ var _e = 4096, ve = 67108864;
606
+ function ye(e) {
607
+ let t = e.mode === U || e.mode === W ? B : e.mode;
608
+ return t === B && e.templates.length === 0 ? G : {
609
+ ...e,
610
+ mode: t,
611
+ regexAllowed: !0
612
+ };
613
+ }
614
+ function be(e, t) {
615
+ return K(t) && !e.includes("/*") && !e.includes("`") && !e.includes("<!--") ? G : ye(Y(e, 0, e.length, t, null).state);
616
+ }
617
+ function X(e, t) {
618
+ return e.mode === t.mode && e.depth === t.depth && e.templates.length === t.templates.length && e.templates.every((e, n) => e === t.templates[n]);
619
+ }
620
+ function xe(e, t, n, r, i) {
621
+ let a = [], o = r;
622
+ for (let s = 0; s < n.length; s++) {
623
+ let c = Math.max(t[s * 2], r), l = Math.min(t[s * 2 + 1], i);
624
+ l <= c || (c > o && a.push({
625
+ text: e.slice(o, c),
626
+ type: "plain"
627
+ }), a.push({
628
+ text: e.slice(c, l),
629
+ type: n[s]
630
+ }), o = l);
631
+ }
632
+ return o < i && a.push({
633
+ text: e.slice(o, i),
634
+ type: "plain"
635
+ }), a;
636
+ }
637
+ function Se(e, t = G) {
638
+ let n = [], r = [];
639
+ return Y(e, 0, e.length, t, (e, t, i) => {
640
+ n.push(e, t), r.push(i);
641
+ }), xe(e, n, r, 0, e.length);
642
+ }
643
+ var Ce = 4096, we = 64, Te = (e, t) => e.regexAllowed === t.regexAllowed && X(e, t);
644
+ function Z(e, t, n) {
645
+ for (; e.frontier < t;) {
646
+ let r = Math.min(t, e.frontier + Ce), i = e.ahead;
647
+ if (i) {
648
+ for (; i.index < i.offsets.length && i.offsets[i.index] <= e.frontier;) i.index++;
649
+ i.index < i.offsets.length ? r = Math.min(r + Ce, i.offsets[i.index]) : e.ahead = null;
650
+ }
651
+ let a = Y(e.text, e.frontier, r, e.frontierState, null);
652
+ if (e.frontier = a.offset, e.frontierState = a.state, e.offsets.push(a.offset), e.states.push(a.state), i && e.ahead && i.offsets[i.index] === a.offset && Te(i.states[i.index], a.state)) {
653
+ let t = i.offsets.length - 1;
654
+ for (let n = i.index + 1; n <= t; n++) e.offsets.push(i.offsets[n]), e.states.push(i.states[n]);
655
+ e.frontier = i.offsets[t], e.frontierState = i.states[t], e.ahead = null;
656
+ }
657
+ if (e.frontier < t && n()) return !1;
658
+ }
659
+ return !0;
660
+ }
661
+ function Ee(e, t, n, r, i) {
662
+ let { offsets: a, states: o } = e, s = n - me - 1, c = 1;
663
+ for (let e = 1, t = a.length; e < t;) {
664
+ let n = e + t >> 1;
665
+ a[n] <= s ? (c = n + 1, e = n + 1) : t = n;
666
+ }
667
+ let l = i - r, u = null;
668
+ if (!e.ahead) {
669
+ let e = c;
670
+ for (; e < a.length && a[e] <= r;) e++;
671
+ e < a.length && (u = {
672
+ offsets: a.slice(e).map((e) => e + l),
673
+ states: o.slice(e),
674
+ index: 0
675
+ });
676
+ }
677
+ if (a.length = c, o.length = c, e.text = t, e.frontier = a[c - 1], e.frontierState = o[c - 1], e.ahead = u, u) {
678
+ let t = u.offsets[Math.min(u.offsets.length - 1, 2)];
679
+ Z(e, t, () => !1);
680
+ }
681
+ }
682
+ var De = class {
683
+ lineCount;
684
+ getLine;
685
+ onInvalidate;
686
+ runStarts = [0];
687
+ runStates = [G];
688
+ scanned = 0;
689
+ scannedChars = 0;
690
+ scanState = G;
691
+ pendingRun = -1;
692
+ longLines = /* @__PURE__ */ new Map();
693
+ aheadStarts = [];
694
+ aheadStates = [];
695
+ aheadEnd = -1;
696
+ aheadEndState = G;
697
+ convergeFrom = 0;
698
+ dirtyFrom = -1;
699
+ dirtyTo = -1;
700
+ constructor({ lineCount: e, getLine: t, onInvalidate: n }) {
701
+ this.lineCount = e, this.getLine = t, this.onInvalidate = n;
702
+ }
703
+ scan(e) {
704
+ let t = 0;
705
+ for (; this.scanned < this.lineCount && this.scannedChars < ve;) {
706
+ let n = this.scanned, r = this.getLine(n), i;
707
+ if (r.length > 4096) {
708
+ let t = this.longLine(n, r);
709
+ if (!Z(t, r.length, e)) return this.flushDirty(), !0;
710
+ i = ye(t.frontierState);
711
+ } else {
712
+ if (++t % 64 == 0 && e()) return this.flushDirty(), !0;
713
+ i = be(r, this.scanState);
714
+ }
715
+ this.scannedChars += r.length, this.scanned = n + 1;
716
+ let a = this.aheadStarts.length ? this.aheadAt(n + 1) : null;
717
+ if (a && n + 1 >= this.convergeFrom && X(i, a)) {
718
+ this.pushRun(n + 1, i), this.rejoin(n + 1);
719
+ continue;
720
+ }
721
+ if (a) {
722
+ this.dirtyFrom < 0 && (this.dirtyFrom = n + 1), this.dirtyTo = n + 2, this.pushRun(n + 1, i);
723
+ continue;
724
+ }
725
+ this.aheadStarts.length && n + 1 > this.aheadEnd && this.dropAhead(), X(i, this.scanState) || (this.pushRun(n + 1, i), K(i) ? this.closeRun(n + 1) : this.pendingRun < 0 && (this.pendingRun = n + 1));
726
+ }
727
+ return this.dropAhead(), this.closeRun(this.lineCount), this.flushDirty(), !1;
728
+ }
729
+ pushRun(e, t) {
730
+ X(t, this.scanState) || (this.scanState = t, this.runStarts.push(e), this.runStates.push(t));
731
+ }
732
+ aheadAt(e) {
733
+ let t = this.aheadStarts;
734
+ if (!t.length || e < t[0] || e > this.aheadEnd) return null;
735
+ let n = 0, r = t.length - 1;
736
+ for (; n < r;) {
737
+ let i = n + r + 1 >> 1;
738
+ t[i] <= e ? n = i : r = i - 1;
739
+ }
740
+ return this.aheadStates[n];
741
+ }
742
+ rejoin(e) {
743
+ let t = this.aheadStarts;
744
+ for (let n = 0; n < t.length; n++) t[n] > e && (this.runStarts.push(t[n]), this.runStates.push(this.aheadStates[n]));
745
+ this.scanned = this.aheadEnd, this.scanState = this.aheadEndState, this.pendingRun = K(this.scanState) ? -1 : this.scanned, this.dropAhead();
746
+ }
747
+ dropAhead() {
748
+ this.aheadStarts.length && (this.aheadStarts = [], this.aheadStates = [], this.aheadEnd = -1, this.convergeFrom = 0);
749
+ }
750
+ closeRun(e) {
751
+ this.pendingRun < 0 || (this.onInvalidate?.(this.pendingRun, e), this.pendingRun = -1);
752
+ }
753
+ flushDirty() {
754
+ this.dirtyFrom < 0 || (this.onInvalidate?.(this.dirtyFrom, this.dirtyTo), this.dirtyFrom = -1, this.dirtyTo = -1);
755
+ }
756
+ edit({ fromLine: e, oldEndLine: t, newEndLine: n, fromOffset: r, oldEndOffset: i, newEndOffset: a }) {
757
+ let o = n - t;
758
+ this.lineCount += o, this.scannedChars = 0;
759
+ let s = e === t && e === n ? this.longLines.get(e) : void 0;
760
+ if (o !== 0 || e !== t || s || this.longLines.has(e)) {
761
+ let n = /* @__PURE__ */ new Map();
762
+ for (let [r, i] of this.longLines) r < e ? n.set(r, i) : r > t && n.set(r + o, i);
763
+ if (s) {
764
+ let t = this.getLine(e);
765
+ t.length > 4096 && (Ee(s, t, r, i, a), n.set(e, s));
766
+ }
767
+ this.longLines = n;
768
+ }
769
+ if (e > this.scanned) {
770
+ if (this.aheadStarts.length && this.aheadEnd > e) {
771
+ let t = this.aheadAt(e);
772
+ if (t) for (this.aheadEndState = t, this.aheadEnd = e; this.aheadStarts.length && this.aheadStarts[this.aheadStarts.length - 1] > e;) this.aheadStarts.pop(), this.aheadStates.pop();
773
+ else this.dropAhead();
774
+ }
775
+ return;
776
+ }
777
+ let c = this.aheadStarts.length > 0, l = this.scanned, u = c ? this.aheadEnd : this.scanned, d = c ? this.aheadEndState : this.scanState, f = t + 1, p = f > u ? null : f <= l ? this.stateAtLine(f) : this.aheadAt(f), m = [], h = [];
778
+ if (p) {
779
+ let e = (e, t) => {
780
+ m.push(e + o), h.push(t);
781
+ };
782
+ e(f, p);
783
+ for (let t = 0; t < this.runStarts.length; t++) this.runStarts[t] > f && e(this.runStarts[t], this.runStates[t]);
784
+ if (c) {
785
+ let t = this.aheadAt(l + 1);
786
+ t && l + 1 > f && e(l + 1, t);
787
+ for (let t = 0; t < this.aheadStarts.length; t++) {
788
+ let n = this.aheadStarts[t];
789
+ n > f && n > l + 1 && e(n, this.aheadStates[t]);
790
+ }
791
+ }
792
+ }
793
+ let g = this.runStarts.length;
794
+ for (; g > 1 && this.runStarts[g - 1] > e;) g--;
795
+ this.runStarts.length = g, this.runStates.length = g, this.scanned = e, this.scanState = this.runStates[g - 1], this.pendingRun = -1, this.aheadStarts = m, this.aheadStates = h, this.aheadEnd = p ? u + o : -1, this.aheadEndState = d, this.convergeFrom = c ? Math.max(n + 1, l + o + 1, this.convergeFrom + o) : n + 1;
796
+ }
797
+ stateAtLine(e) {
798
+ if (e > this.scanned) return this.aheadAt(e) ?? G;
799
+ let t = this.runStarts, n = 0, r = t.length - 1;
800
+ for (; n < r;) {
801
+ let i = n + r + 1 >> 1;
802
+ t[i] <= e ? n = i : r = i - 1;
803
+ }
804
+ return this.runStates[n];
805
+ }
806
+ lineTokens(e, t) {
807
+ return Se(t, this.stateAtLine(e));
808
+ }
809
+ longLine(e, t) {
810
+ let n = this.stateAtLine(e), r = this.longLines.get(e);
811
+ return !r || r.text !== t || !X(r.states[0], n) ? r = {
812
+ text: t,
813
+ offsets: [0],
814
+ states: [n],
815
+ frontier: 0,
816
+ frontierState: n,
817
+ ahead: null
818
+ } : this.longLines.delete(e), this.longLines.set(e, r), this.longLines.size > we && this.longLines.delete(this.longLines.keys().next().value), r;
819
+ }
820
+ rangeTokens(e, t, n, r, i) {
821
+ let a = this.longLine(e, t);
822
+ if (!Z(a, n, i)) return null;
823
+ let { offsets: o, states: s } = a, c = 0, l = o.length - 1;
824
+ for (; c < l;) {
825
+ let e = c + l + 1 >> 1;
826
+ o[e] <= n ? c = e : l = e - 1;
827
+ }
828
+ let u = [], d = [];
829
+ return Y(t, o[c], r, s[c], (e, t, i) => {
830
+ t > n && e < r && (u.push(e, t), d.push(i));
831
+ }), xe(t, u, d, n, r);
832
+ }
833
+ }, Q = class {
834
+ key;
835
+ line;
836
+ constructor(e, t) {
837
+ this.key = e, this.line = t;
838
+ }
839
+ }, Oe = 4096;
840
+ function ke(e) {
841
+ return (t, n, r, i) => {
842
+ let a = r > 0 || i < n.length;
843
+ return e(a ? n.slice(r, i) : n, t, {
844
+ offset: r,
845
+ line: n,
846
+ partial: a
847
+ }) ?? null;
848
+ };
849
+ }
850
+ function Ae(e) {
851
+ return (t, n, r, i, a) => n.length > 4096 ? e.rangeTokens(t, n, r, i, a) ?? void 0 : e.lineTokens(t, n);
852
+ }
853
+ var je = class {
854
+ produce;
855
+ getText;
856
+ schedule;
857
+ now;
858
+ cache = /* @__PURE__ */ new Map();
859
+ versions = /* @__PURE__ */ new Map();
860
+ listeners = /* @__PURE__ */ new Set();
861
+ queue = /* @__PURE__ */ new Map();
862
+ inflight = 0;
863
+ scheduled = !1;
864
+ notifying = !1;
865
+ dirty = !1;
866
+ budget = Infinity;
867
+ workStart = 0;
868
+ working = !1;
869
+ keepFrom = 0;
870
+ keepTo = Infinity;
871
+ constructor({ produce: e, getText: t, schedule: n, now: r }) {
872
+ this.produce = e, this.getText = t, this.schedule = n, this.now = r ?? (() => performance.now());
873
+ }
874
+ get pending() {
875
+ return this.queue.size + this.inflight;
876
+ }
877
+ beginFrame(e, t, n = 6) {
878
+ this.budget = n, this.keepFrom = e, this.keepTo = t;
879
+ }
880
+ outOfTime = () => (this.working ? this.now() - this.workStart : 0) >= this.budget;
881
+ subscribe = (e) => (this.listeners.add(e), () => {
882
+ this.listeners.delete(e);
883
+ });
884
+ version = (e) => this.versions.get(e) ?? 0;
885
+ bump(e) {
886
+ this.versions.set(e, this.version(e) + 1), this.dirty = !0, this.versions.size > Oe * 2 && this.versions.delete(this.versions.keys().next().value);
887
+ }
888
+ flushSoon() {
889
+ this.notifying || (this.notifying = !0, this.schedule(() => {
890
+ if (this.notifying = !1, this.dirty) {
891
+ this.dirty = !1;
892
+ for (let e of this.listeners) e();
893
+ }
894
+ }));
895
+ }
896
+ remember(e, t) {
897
+ this.cache.delete(e), this.cache.set(e, t), this.cache.size > Oe && this.cache.delete(this.cache.keys().next().value);
898
+ }
899
+ fill(e, t, n, r, i) {
900
+ this.workStart = this.now(), this.working = !0;
901
+ let a = this.produce(t, n, r, i, this.outOfTime);
902
+ if (this.working = !1, this.budget -= this.now() - this.workStart, a === void 0) return;
903
+ if (a && "then" in a) {
904
+ let n = new Q(e, t);
905
+ this.remember(e, n), this.inflight++;
906
+ let r = (e) => {
907
+ this.inflight--, this.dirty = !0, this.cache.get(n.key) === n && (this.remember(n.key, e), this.bump(n.line)), this.flushSoon();
908
+ };
909
+ return a.then((e) => r(e ?? null), () => r(null)), n;
910
+ }
911
+ let o = a ?? null;
912
+ return this.remember(e, o), o;
913
+ }
914
+ read(e, t, n, r) {
915
+ let i = t.length > _e, a = i ? `${e}:${n}:${r}` : e, o = this.cache.get(a);
916
+ if (o === void 0) {
917
+ let s = i ? n : 0, c = i ? r : t.length;
918
+ if (this.budget > 0 && (o = this.fill(a, e, t, s, c)), o === void 0) return this.queue.set(`${e}:${s}:${c}`, {
919
+ line: e,
920
+ start: s,
921
+ end: c
922
+ }), this.pumpSoon(), null;
923
+ }
924
+ return o instanceof Q || o === null ? null : i || n === 0 && r >= t.length ? o : z(o, 0, n, r);
925
+ }
926
+ pumpSoon() {
927
+ this.scheduled || (this.scheduled = !0, this.schedule(() => {
928
+ this.scheduled = !1, this.pump();
929
+ }));
930
+ }
931
+ pump(e = 6) {
932
+ this.budget = e;
933
+ for (let [e, { line: t, start: n, end: r }] of this.queue) {
934
+ if (t < this.keepFrom || t >= this.keepTo) {
935
+ this.queue.delete(e);
936
+ continue;
937
+ }
938
+ if (this.budget <= 0) break;
939
+ let i = this.getText(t), a = i.length > 4096 ? `${t}:${n}:${r}` : t;
940
+ if (this.cache.get(a) === void 0) {
941
+ let e = this.fill(a, t, i, n, r);
942
+ if (e === void 0) break;
943
+ e instanceof Q || this.bump(t);
944
+ }
945
+ this.queue.delete(e);
946
+ }
947
+ this.dirty = !0, this.flushSoon(), this.queue.size && this.pumpSoon();
948
+ }
949
+ edit({ fromLine: e, oldEndLine: t, newEndLine: n }) {
950
+ let r = n - t, i = (e) => typeof e == "number" ? e : Number(e.slice(0, e.indexOf(":")));
951
+ if (r === 0) for (let n of [...this.cache.keys()]) {
952
+ let r = i(n);
953
+ r >= e && r <= t && this.cache.delete(n);
954
+ }
955
+ else {
956
+ let n = /* @__PURE__ */ new Map();
957
+ for (let [a, o] of this.cache) {
958
+ let s = i(a);
959
+ if (s < e) n.set(a, o);
960
+ else if (s > t) {
961
+ let e = typeof a == "number" ? a + r : `${s + r}${a.slice(a.indexOf(":"))}`;
962
+ o instanceof Q && (o.key = e, o.line = s + r), n.set(e, o);
963
+ }
964
+ }
965
+ this.cache = n;
966
+ }
967
+ let a = /* @__PURE__ */ new Map();
968
+ for (let [n, i] of this.queue) if (i.line < e) a.set(n, i);
969
+ else if (i.line > t) {
970
+ let e = i.line + r;
971
+ a.set(`${e}:${i.start}:${i.end}`, {
972
+ ...i,
973
+ line: e
974
+ });
975
+ }
976
+ this.queue = a;
977
+ }
978
+ flushNow() {
979
+ if (this.dirty) {
980
+ this.dirty = !1;
981
+ for (let e of this.listeners) e();
982
+ }
983
+ }
984
+ invalidate(e, t) {
985
+ for (let n of [...this.cache.keys()]) {
986
+ let r = typeof n == "number" ? n : Number(n.slice(0, n.indexOf(":")));
987
+ r >= e && r < t && this.cache.delete(n);
988
+ }
989
+ let n = Math.max(e, this.keepFrom), r = Math.min(t, this.keepTo);
990
+ for (let e = n; e < r; e++) this.bump(e);
991
+ this.flushSoon();
992
+ }
993
+ }, Me = 2048, Ne = class {
994
+ source;
995
+ tabSize;
996
+ metrics = /* @__PURE__ */ new Map();
997
+ constructor(e, t) {
998
+ this.source = e, this.tabSize = t;
999
+ }
1000
+ text(e) {
1001
+ return this.get(e).text;
1002
+ }
1003
+ peek(e) {
1004
+ return this.metrics.get(e);
1005
+ }
1006
+ get(e) {
1007
+ let t = this.metrics.get(e);
1008
+ if (t) return this.metrics.delete(e), this.metrics.set(e, t), t;
1009
+ let n = new d(this.source.get(e) ?? "", this.tabSize);
1010
+ return this.metrics.set(e, n), this.metrics.size > Me && this.metrics.delete(this.metrics.keys().next().value), n;
1011
+ }
1012
+ edit({ fromLine: e, oldEndLine: t, newEndLine: n, fromOffset: r, oldEndOffset: i, newEndOffset: a }) {
1013
+ let o = n - t, s = e === t && o === 0 ? this.metrics.get(e) : void 0;
1014
+ if (o === 0) for (let n = e; n <= t; n++) this.metrics.delete(n);
1015
+ else {
1016
+ let n = /* @__PURE__ */ new Map();
1017
+ for (let [r, i] of this.metrics) r < e ? n.set(r, i) : r > t && n.set(r + o, i);
1018
+ this.metrics = n;
1019
+ }
1020
+ if (s) {
1021
+ let t = this.source.get(e) ?? "";
1022
+ this.metrics.set(e, s.edited(t, r, i - r, t.slice(r, a)));
1023
+ }
1024
+ }
1025
+ };
1026
+ function $(t, n) {
1027
+ return e.test(t) ? t.length : new d(t, n).cells;
1028
+ }
1029
+ function Pe(e) {
1030
+ return /[\r\u2028\u2029]/.test(e) ? e.split(/\r\n?|\n|\u2028|\u2029/) : e.split("\n");
1031
+ }
1032
+ var Fe = class {
1033
+ source;
1034
+ tabSize;
1035
+ counts;
1036
+ next = 0;
1037
+ chars = 0;
1038
+ maxCells = 0;
1039
+ constructor(e, t, n) {
1040
+ this.source = e, this.tabSize = t, this.counts = n ? new Uint32Array(e.count) : null;
1041
+ }
1042
+ get reached() {
1043
+ return this.next;
1044
+ }
1045
+ get cellCounts() {
1046
+ return this.counts && this.counts.subarray(0, this.source.count);
1047
+ }
1048
+ edit({ fromLine: e, oldEndLine: t, newEndLine: n }) {
1049
+ let r = n - t, { count: i } = this.source, a = this.counts;
1050
+ if (a && r !== 0) {
1051
+ let o = t + 1;
1052
+ if (i > a.length) {
1053
+ let t = new Uint32Array(Math.floor(i * 1.25) + 64);
1054
+ t.set(a.subarray(0, e)), t.set(a.subarray(o, i - r), n + 1), a = this.counts = t;
1055
+ } else a.copyWithin(n + 1, o, i - r);
1056
+ }
1057
+ let o = this.next;
1058
+ if (e < o) {
1059
+ this.next = Math.max(o + r, n + 1);
1060
+ for (let t = e; t <= n; t++) {
1061
+ let e = $(this.source.get(t) ?? "", this.tabSize);
1062
+ e > this.maxCells && (this.maxCells = e), a && (a[t] = e);
1063
+ }
1064
+ } else if (a) for (let t = e; t <= n; t++) a[t] = 0;
1065
+ }
1066
+ run(e) {
1067
+ let { count: t } = this.source, n = 0;
1068
+ for (; this.next < t;) {
1069
+ if (++n % 64 == 0 && e()) return !0;
1070
+ let t = this.source.get(this.next) ?? "";
1071
+ if (!this.counts && this.chars > ve * 4) return !1;
1072
+ this.chars += t.length;
1073
+ let r = $(t, this.tabSize);
1074
+ r > this.maxCells && (this.maxCells = r), this.counts && (this.counts[this.next] = r), this.next++;
1075
+ }
1076
+ return !1;
1077
+ }
1078
+ }, Ie = 5e3, Le = 32768, Re = 262144;
1079
+ function ze(e) {
1080
+ if (e.length > 262144) return !0;
1081
+ if (e.length <= 5e3) return !1;
1082
+ let t = 1, n = 0;
1083
+ for (let r = e.indexOf("\n"); r >= 0; r = e.indexOf("\n", n)) {
1084
+ if (r - n > 32768 || ++t > 5e3) return !0;
1085
+ n = r + 1;
1086
+ }
1087
+ return e.length - n > Le;
1088
+ }
1089
+ function Be(e) {
1090
+ let t = /* @__PURE__ */ new Set();
1091
+ for (let n of e ?? []) {
1092
+ let e, r;
1093
+ if (typeof n == "number") e = r = n;
1094
+ else if (typeof n == "string") {
1095
+ let [t, i] = n.split(/\s*[-–:]\s*/).map(Number);
1096
+ e = t, r = Number.isFinite(i) ? i : t;
1097
+ } else [e, r] = n;
1098
+ if (!Number.isFinite(e) || !Number.isFinite(r)) continue;
1099
+ let i = Math.min(e, r), a = Math.min(Math.max(e, r), i + 1e5);
1100
+ for (let e = i; e <= a; e++) t.add(e);
1101
+ }
1102
+ return t;
1103
+ }
1104
+ //#endregion
1105
+ export { De as CodeLexer, je as CodeTokenStore, G as LEX_START, _e as LONG_LINE, Ne as LineCache, d as LineMetrics, Fe as LineScanner, te as MAX_COPY_LENGTH, Re as MAX_PAGE_CHARS, Ie as MAX_PAGE_LINES, Le as MAX_PAGE_LINE_LENGTH, T as MAX_SCROLL_SIZE, k as alignedScroll, z as clipTokens, a as codePointCells, P as comparePositions, v as displayPieces, ae as extendSelection, ke as hostProducer, j as identityRowMap, ee as isCollapsed, I as isWordCode, Se as lexCodeLine, Y as lexRange, Ae as lexerProducer, $ as lineCells, Be as lineSet, oe as markersInRange, re as movePosition, C as nextCellWindow, be as nextLineState, x as nextRowWindow, F as orderedSelection, w as originOf, E as physicalSize, A as revealScroll, ie as selectionCells, ne as selectionText, Pe as splitCodeLines, O as toPhysicalScroll, D as toVirtualScroll, ze as tooBigForPage, S as visibleCells, b as visibleRows, L as wordAt, M as wrapRowMap, N as wrappedSpan };