svelte-effect-runtime 4.0.0 → 4.1.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 (150) hide show
  1. package/.dist/chunks/client-DbwVAMWm.js +530 -0
  2. package/.dist/chunks/client-DbwVAMWm.js.map +1 -0
  3. package/.dist/chunks/compiler-Dpyu4Owd.js +412 -0
  4. package/.dist/chunks/compiler-Dpyu4Owd.js.map +1 -0
  5. package/.dist/chunks/descriptors-q909VWyR.js +216 -0
  6. package/.dist/chunks/descriptors-q909VWyR.js.map +1 -0
  7. package/.dist/chunks/diagnostics-DLwwrBWb.js +359 -0
  8. package/.dist/chunks/diagnostics-DLwwrBWb.js.map +1 -0
  9. package/.dist/chunks/dispatcher-CTWINW5I.js +534 -0
  10. package/.dist/chunks/dispatcher-CTWINW5I.js.map +1 -0
  11. package/.dist/chunks/dispatcher-pZPzarul.js +23 -0
  12. package/.dist/chunks/dispatcher-pZPzarul.js.map +1 -0
  13. package/.dist/chunks/{errors-IJjsUwrE.js → errors-qhcbUH6o.js} +56 -44
  14. package/.dist/chunks/errors-qhcbUH6o.js.map +1 -0
  15. package/.dist/chunks/live-BW7xZKjb.js +146 -0
  16. package/.dist/chunks/live-BW7xZKjb.js.map +1 -0
  17. package/.dist/chunks/live-CHK0RrZu.js +10 -0
  18. package/.dist/chunks/live-CHK0RrZu.js.map +1 -0
  19. package/.dist/chunks/{remote-client-CVI4t66c.js → remote-client-mkQAfP1G.js} +29 -23
  20. package/.dist/chunks/remote-client-mkQAfP1G.js.map +1 -0
  21. package/.dist/chunks/{runtime-GBQz32DZ.js → runtime-CPosEhGl.js} +3 -27
  22. package/.dist/chunks/runtime-CPosEhGl.js.map +1 -0
  23. package/.dist/chunks/{server-D1LcDnZE.js → server-yQrNoiCR.js} +15 -84
  24. package/.dist/chunks/server-yQrNoiCR.js.map +1 -0
  25. package/.dist/chunks/source-scan-cSawCvsg.js +1059 -0
  26. package/.dist/chunks/source-scan-cSawCvsg.js.map +1 -0
  27. package/.dist/chunks/{transform-jNUr65K9.js → transform-D7TTlPpK.js} +245 -371
  28. package/.dist/chunks/transform-D7TTlPpK.js.map +1 -0
  29. package/.dist/compiler/markup-identifiers.d.ts +2 -0
  30. package/.dist/compiler/remote-client.d.ts +1 -19
  31. package/.dist/compiler/source-scan.d.ts +11 -108
  32. package/.dist/compiler/sveltekit-remote-bridge.d.ts +3 -0
  33. package/.dist/compiler.d.ts +6 -0
  34. package/.dist/compiler.js +1 -1
  35. package/.dist/detect.d.ts +0 -31
  36. package/.dist/detect.js +0 -39
  37. package/.dist/detect.js.map +1 -1
  38. package/.dist/diagnostics.d.ts +0 -16
  39. package/.dist/dispatcher/deps.d.ts +3 -14
  40. package/.dist/dispatcher/fibers.d.ts +5 -46
  41. package/.dist/dispatcher/index.d.ts +42 -135
  42. package/.dist/dispatcher/scope.d.ts +36 -0
  43. package/.dist/dispatcher/types.d.ts +0 -151
  44. package/.dist/dispatcher.d.ts +2 -1
  45. package/.dist/dispatcher.js +2 -2
  46. package/.dist/errors.d.ts +44 -42
  47. package/.dist/generated/dispatcher.d.ts +6 -51
  48. package/.dist/generators.d.ts +2 -12
  49. package/.dist/internal/descriptors.d.ts +0 -16
  50. package/.dist/internal/generators.js +14 -9
  51. package/.dist/internal/generators.js.map +1 -1
  52. package/.dist/internal/live.d.ts +9 -0
  53. package/.dist/internal/remote-client.js +2 -2
  54. package/.dist/internal/remote-server.js +2 -2
  55. package/.dist/internal/schema.d.ts +0 -54
  56. package/.dist/live.d.ts +9 -26
  57. package/.dist/markup/event-attributes.d.ts +0 -32
  58. package/.dist/markup/promise.d.ts +1 -23
  59. package/.dist/markup/promise.js +2 -18
  60. package/.dist/markup/promise.js.map +1 -1
  61. package/.dist/markup/run.d.ts +1 -10
  62. package/.dist/markup/run.js +2 -11
  63. package/.dist/markup/run.js.map +1 -1
  64. package/.dist/markup/transform/apply.d.ts +5 -4
  65. package/.dist/markup/transform/classify.d.ts +2 -11
  66. package/.dist/markup/transform/constants.d.ts +2 -1
  67. package/.dist/markup/transform/effect-bindings.d.ts +2 -26
  68. package/.dist/markup/transform/effect-callbacks.d.ts +0 -20
  69. package/.dist/markup/transform/emit.d.ts +2 -11
  70. package/.dist/markup/transform/expressions.d.ts +0 -35
  71. package/.dist/markup/transform/scan.d.ts +3 -22
  72. package/.dist/markup/transform/types.d.ts +15 -127
  73. package/.dist/markup/transform.js +1 -1
  74. package/.dist/markup/value.d.ts +1 -18
  75. package/.dist/markup/value.js +2 -19
  76. package/.dist/markup/value.js.map +1 -1
  77. package/.dist/mod.d.ts +3 -8
  78. package/.dist/mod.js +5 -5
  79. package/.dist/mod.js.map +1 -1
  80. package/.dist/remote/cause-codec.d.ts +3 -37
  81. package/.dist/remote/client/command.d.ts +3 -17
  82. package/.dist/remote/client/form-data.d.ts +0 -7
  83. package/.dist/remote/client/form-enhance.d.ts +0 -7
  84. package/.dist/remote/client/form-transport.d.ts +14 -20
  85. package/.dist/remote/client/form.d.ts +4 -24
  86. package/.dist/remote/client/index.d.ts +2 -1
  87. package/.dist/remote/client/prerender.d.ts +6 -0
  88. package/.dist/remote/client/query-result.d.ts +2 -14
  89. package/.dist/remote/client/query.d.ts +8 -48
  90. package/.dist/remote/client/responses.d.ts +3 -27
  91. package/.dist/remote/client/types.d.ts +16 -110
  92. package/.dist/remote/client/utils.d.ts +0 -8
  93. package/.dist/remote/client.d.ts +2 -2
  94. package/.dist/remote/client.js +2 -2
  95. package/.dist/remote/effect.d.ts +6 -0
  96. package/.dist/remote/failures.d.ts +4 -0
  97. package/.dist/remote/query-update.d.ts +2 -0
  98. package/.dist/remote/resource.d.ts +25 -0
  99. package/.dist/remote/server.d.ts +5 -50
  100. package/.dist/remote/server.js +2 -2
  101. package/.dist/remote/shared.d.ts +6 -145
  102. package/.dist/remote/shared.js +6 -127
  103. package/.dist/remote/shared.js.map +1 -1
  104. package/.dist/runtime/transform.js +26 -31
  105. package/.dist/runtime/transform.js.map +1 -1
  106. package/.dist/script-transform/ast.d.ts +0 -46
  107. package/.dist/script-transform/imports.d.ts +3 -39
  108. package/.dist/script-transform/index.d.ts +2 -0
  109. package/.dist/script-transform/lower.d.ts +0 -9
  110. package/.dist/script-transform/runes.d.ts +0 -10
  111. package/.dist/script-transform/runtime-block.d.ts +0 -17
  112. package/.dist/script-transform/source.d.ts +0 -24
  113. package/.dist/script-transform/types.d.ts +9 -126
  114. package/.dist/server/effects.d.ts +4 -53
  115. package/.dist/server/factories.d.ts +7 -7
  116. package/.dist/server/index.d.ts +1 -1
  117. package/.dist/server/invalid.d.ts +0 -7
  118. package/.dist/server/live-snapshot.d.ts +5 -0
  119. package/.dist/server/remote-handler-context.d.ts +5 -0
  120. package/.dist/server/runtime.d.ts +6 -24
  121. package/.dist/server/schema.d.ts +0 -14
  122. package/.dist/server/transport.d.ts +2 -0
  123. package/.dist/server/types.d.ts +49 -26
  124. package/.dist/server/wrappers.d.ts +3 -40
  125. package/.dist/server.d.ts +1 -1
  126. package/.dist/server.js +200 -215
  127. package/.dist/server.js.map +1 -1
  128. package/.dist/yieldable.d.ts +1 -35
  129. package/package.json +2 -2
  130. package/.dist/chunks/client-DcZUV4rR.js +0 -653
  131. package/.dist/chunks/client-DcZUV4rR.js.map +0 -1
  132. package/.dist/chunks/compiler-BBPNyXmQ.js +0 -460
  133. package/.dist/chunks/compiler-BBPNyXmQ.js.map +0 -1
  134. package/.dist/chunks/dispatcher-DOx8iC6r.js +0 -505
  135. package/.dist/chunks/dispatcher-DOx8iC6r.js.map +0 -1
  136. package/.dist/chunks/dispatcher-H-Ia0Os4.js +0 -47
  137. package/.dist/chunks/dispatcher-H-Ia0Os4.js.map +0 -1
  138. package/.dist/chunks/errors-IJjsUwrE.js.map +0 -1
  139. package/.dist/chunks/live-BXAKre_4.js +0 -104
  140. package/.dist/chunks/live-BXAKre_4.js.map +0 -1
  141. package/.dist/chunks/remote-client-CVI4t66c.js.map +0 -1
  142. package/.dist/chunks/runtime-GBQz32DZ.js.map +0 -1
  143. package/.dist/chunks/schema-D9pct6Y5.js +0 -89
  144. package/.dist/chunks/schema-D9pct6Y5.js.map +0 -1
  145. package/.dist/chunks/server-D1LcDnZE.js.map +0 -1
  146. package/.dist/chunks/source-scan-C4PsggID.js +0 -341
  147. package/.dist/chunks/source-scan-C4PsggID.js.map +0 -1
  148. package/.dist/chunks/transform-jNUr65K9.js.map +0 -1
  149. package/.dist/remote/client/effect.d.ts +0 -29
  150. package/.dist/remote/client/failures.d.ts +0 -42
@@ -1,341 +0,0 @@
1
- //#region src/compiler/source-scan.ts
2
- /**
3
- * Scans a Svelte component once for shared lexical facts used by transforms,
4
- * diagnostics, and editor projections.
5
- *
6
- * @example
7
- * ```ts
8
- * const scan = scan_svelte_effect_source(`<script effect>yield* run()<\/script>`);
9
- * scan.effect_script?.has_effect;
10
- * ```
11
- *
12
- * @since 4.0.0
13
- * @param source - Full Svelte component source to scan.
14
- * @param filename - Optional filename associated with the source.
15
- * @returns Shared source facts for SER consumers.
16
- */
17
- function scan_svelte_effect_source(source, filename = "unknown.svelte") {
18
- const scripts = collect_script_regions(source);
19
- const styles = collect_tag_regions(source, "style").map(({ start, end }) => ({
20
- start,
21
- end
22
- }));
23
- const comments = collect_html_comment_ranges(source);
24
- const excluded_ranges = merge_ranges([
25
- ...scripts.map(({ start, end }) => ({
26
- start,
27
- end
28
- })),
29
- ...styles,
30
- ...comments
31
- ]);
32
- const markup_expressions = collect_markup_expressions(source, excluded_ranges);
33
- return {
34
- filename,
35
- source,
36
- scripts,
37
- styles,
38
- comments,
39
- excluded_ranges,
40
- markup_expressions,
41
- bare_const_tags: markup_expressions.flatMap((expression) => make_bare_const_tag(expression)),
42
- instance_script: scripts.find((script) => !script.is_module),
43
- effect_script: scripts.find((script) => !script.is_module && script.has_effect)
44
- };
45
- }
46
- function collect_script_regions(source) {
47
- return collect_tag_regions(source, "script").map((region) => {
48
- const lang = get_attribute(region.attributes, "lang")?.value?.toLowerCase();
49
- const context = get_attribute(region.attributes, "context")?.value?.toLowerCase();
50
- const effect_attribute = get_attribute(region.attributes, "effect");
51
- const is_module = has_attribute(region.attributes, "module") || context === "module";
52
- return {
53
- ...region,
54
- is_module,
55
- has_lang: has_attribute(region.attributes, "lang"),
56
- lang,
57
- is_typescript: lang === "ts" || lang === "typescript",
58
- has_effect: effect_attribute !== void 0,
59
- effect_attribute: effect_attribute ? {
60
- start: effect_attribute.start,
61
- end: effect_attribute.end
62
- } : void 0
63
- };
64
- });
65
- }
66
- function collect_tag_regions(source, tag_name) {
67
- const lower_source = source.toLowerCase();
68
- const ranges = [];
69
- let cursor = 0;
70
- while (cursor < source.length) {
71
- const opening_tag_start = find_next_tag_start(lower_source, tag_name, cursor);
72
- if (opening_tag_start === -1) break;
73
- const opening_tag_close = find_tag_close(source, opening_tag_start);
74
- if (opening_tag_close === -1) break;
75
- const content_start = opening_tag_close + 1;
76
- const closing_tag_start = find_next_closing_tag_start(lower_source, tag_name, content_start);
77
- if (closing_tag_start === -1) {
78
- cursor = content_start;
79
- continue;
80
- }
81
- const closing_tag_close = find_tag_close(source, closing_tag_start);
82
- if (closing_tag_close === -1) break;
83
- const tag_name_end = opening_tag_start + 1 + tag_name.length;
84
- const opening_tag_end = opening_tag_close + 1;
85
- const closing_tag_end = closing_tag_close + 1;
86
- const attributes = collect_attributes(source, tag_name_end, opening_tag_close);
87
- ranges.push({
88
- start: opening_tag_start,
89
- end: closing_tag_end,
90
- opening_tag_start,
91
- opening_tag_end,
92
- tag_name_end,
93
- content_start,
94
- content_end: closing_tag_start,
95
- closing_tag_start,
96
- closing_tag_end,
97
- attributes_text: source.slice(tag_name_end, opening_tag_close),
98
- attributes,
99
- text: source.slice(content_start, closing_tag_start)
100
- });
101
- cursor = closing_tag_end;
102
- }
103
- return ranges;
104
- }
105
- function collect_attributes(source, start, end) {
106
- const attributes = [];
107
- let cursor = start;
108
- while (cursor < end) {
109
- const attribute_start = cursor;
110
- while (cursor < end && /\s/.test(source[cursor] ?? "")) cursor += 1;
111
- if (cursor >= end || source[cursor] === "/") break;
112
- const name_start = cursor;
113
- while (cursor < end && !/[\s=/>]/.test(source[cursor] ?? "")) cursor += 1;
114
- const name_end = cursor;
115
- const name = source.slice(name_start, name_end);
116
- while (cursor < end && /\s/.test(source[cursor] ?? "")) cursor += 1;
117
- if (source[cursor] !== "=") {
118
- attributes.push({
119
- name,
120
- start: attribute_start,
121
- end: name_end,
122
- name_start,
123
- name_end
124
- });
125
- continue;
126
- }
127
- cursor += 1;
128
- while (cursor < end && /\s/.test(source[cursor] ?? "")) cursor += 1;
129
- const value = read_attribute_value(source, cursor, end);
130
- attributes.push({
131
- name,
132
- start: attribute_start,
133
- end: value.end,
134
- name_start,
135
- name_end,
136
- value: value.text
137
- });
138
- cursor = value.end;
139
- }
140
- return attributes;
141
- }
142
- function read_attribute_value(source, start, end) {
143
- const quote = source[start];
144
- if (quote === "\"" || quote === "'") {
145
- let cursor = start + 1;
146
- while (cursor < end && source[cursor] !== quote) cursor += 1;
147
- return {
148
- text: source.slice(start + 1, cursor),
149
- end: Math.min(cursor + 1, end)
150
- };
151
- }
152
- let cursor = start;
153
- while (cursor < end && !/\s/.test(source[cursor] ?? "")) cursor += 1;
154
- return {
155
- text: source.slice(start, cursor),
156
- end: cursor
157
- };
158
- }
159
- function collect_html_comment_ranges(source) {
160
- const ranges = [];
161
- let cursor = 0;
162
- while (cursor < source.length) {
163
- const start = source.indexOf("<!--", cursor);
164
- if (start === -1) break;
165
- const close = source.indexOf("-->", start + 4);
166
- const end = close === -1 ? source.length : close + 3;
167
- ranges.push({
168
- start,
169
- end
170
- });
171
- cursor = end;
172
- }
173
- return ranges;
174
- }
175
- function collect_markup_expressions(source, excluded_ranges) {
176
- const expressions = [];
177
- let cursor = 0;
178
- while (cursor < source.length) {
179
- const open = source.indexOf("{", cursor);
180
- if (open === -1) break;
181
- const excluded_range = find_range_containing(excluded_ranges, open);
182
- if (excluded_range) {
183
- cursor = excluded_range.end;
184
- continue;
185
- }
186
- const close = find_closing_brace(source, open + 1);
187
- if (close === -1) {
188
- cursor = open + 1;
189
- continue;
190
- }
191
- const inner_start = open + 1;
192
- const inner_end = close;
193
- const inner = source.slice(inner_start, inner_end);
194
- expressions.push({
195
- open,
196
- close,
197
- inner_start,
198
- inner_end,
199
- inner,
200
- expression_text: inner.trim(),
201
- attribute_name: find_attribute_name_before_expression(source, open, close)
202
- });
203
- cursor = close + 1;
204
- }
205
- return expressions;
206
- }
207
- function make_bare_const_tag(expression) {
208
- if (!/^(\s*)const\s/.test(expression.inner)) return [];
209
- return [{
210
- open: expression.open,
211
- insert_position: expression.open + 1,
212
- expression
213
- }];
214
- }
215
- function find_attribute_name_before_expression(source, open, close) {
216
- const tag_start = source.lastIndexOf("<", open);
217
- const last_tag_end = source.lastIndexOf(">", open);
218
- if (tag_start === -1 || tag_start < last_tag_end) return;
219
- const match = source.slice(tag_start + 1, open).match(/(?:^|\s)([A-Za-z_$:][\w$:-]*)\s*=\s*(["']?)$/);
220
- const quote = match?.[2];
221
- if (quote && source[close + 1] !== quote) return;
222
- return match?.[1];
223
- }
224
- function find_range_containing(ranges, position) {
225
- let low = 0;
226
- let high = ranges.length - 1;
227
- while (low <= high) {
228
- const mid = Math.floor((low + high) / 2);
229
- const range = ranges[mid];
230
- if (position < range.start) {
231
- high = mid - 1;
232
- continue;
233
- }
234
- if (position >= range.end) {
235
- low = mid + 1;
236
- continue;
237
- }
238
- return range;
239
- }
240
- }
241
- function merge_ranges(ranges) {
242
- const sorted = [...ranges].sort((a, b) => a.start - b.start);
243
- const merged = [];
244
- for (const range of sorted) {
245
- const previous = merged.at(-1);
246
- if (!previous || range.start > previous.end) {
247
- merged.push({ ...range });
248
- continue;
249
- }
250
- previous.end = Math.max(previous.end, range.end);
251
- }
252
- return merged;
253
- }
254
- function get_attribute(attributes, name) {
255
- const normalized_name = name.toLowerCase();
256
- return attributes.find((attribute) => attribute.name.toLowerCase() === normalized_name);
257
- }
258
- function has_attribute(attributes, name) {
259
- return get_attribute(attributes, name) !== void 0;
260
- }
261
- function find_next_tag_start(lower_source, tag_name, start) {
262
- const needle = `<${tag_name}`;
263
- let cursor = start;
264
- while (cursor < lower_source.length) {
265
- const tag_start = lower_source.indexOf(needle, cursor);
266
- if (tag_start === -1) return -1;
267
- const boundary = lower_source[tag_start + needle.length];
268
- if (boundary === void 0 || boundary === ">" || boundary === "/" || /\s/.test(boundary)) return tag_start;
269
- cursor = tag_start + needle.length;
270
- }
271
- return -1;
272
- }
273
- function find_next_closing_tag_start(lower_source, tag_name, start) {
274
- const needle = `</${tag_name}`;
275
- let cursor = start;
276
- while (cursor < lower_source.length) {
277
- const tag_start = lower_source.indexOf(needle, cursor);
278
- if (tag_start === -1) return -1;
279
- const boundary = lower_source[tag_start + needle.length];
280
- if (boundary === void 0 || boundary === ">" || /\s/.test(boundary)) return tag_start;
281
- cursor = tag_start + needle.length;
282
- }
283
- return -1;
284
- }
285
- function find_tag_close(source, start) {
286
- let quote;
287
- for (let cursor = start; cursor < source.length; cursor += 1) {
288
- const char = source[cursor];
289
- if (quote) {
290
- if (char === quote) quote = void 0;
291
- continue;
292
- }
293
- if (char === "\"" || char === "'") {
294
- quote = char;
295
- continue;
296
- }
297
- if (char === ">") return cursor;
298
- }
299
- return -1;
300
- }
301
- function find_closing_brace(source, start) {
302
- let depth = 0;
303
- for (let cursor = start; cursor < source.length; cursor += 1) {
304
- const char = source[cursor];
305
- if (char === "{" && source[cursor - 1] !== "$") depth += 1;
306
- else if (char === "}") {
307
- if (depth === 0) return cursor;
308
- depth -= 1;
309
- } else if (char === "'" || char === "\"" || char === "`") {
310
- cursor = skip_string(source, cursor, char);
311
- if (cursor === -1) return -1;
312
- } else if (char === "/" && source[cursor + 1] === "/") cursor = skip_line_comment(source, cursor);
313
- else if (char === "/" && source[cursor + 1] === "*") {
314
- cursor = skip_block_comment(source, cursor);
315
- if (cursor === -1) return -1;
316
- }
317
- }
318
- return -1;
319
- }
320
- function skip_string(source, start, quote) {
321
- for (let cursor = start + 1; cursor < source.length; cursor += 1) {
322
- if (source[cursor] === "\\") {
323
- cursor += 1;
324
- continue;
325
- }
326
- if (source[cursor] === quote) return cursor;
327
- }
328
- return -1;
329
- }
330
- function skip_line_comment(source, start) {
331
- for (let cursor = start + 2; cursor < source.length; cursor += 1) if (source[cursor] === "\n") return cursor;
332
- return source.length;
333
- }
334
- function skip_block_comment(source, start) {
335
- for (let cursor = start + 2; cursor < source.length; cursor += 1) if (source[cursor] === "*" && source[cursor + 1] === "/") return cursor + 1;
336
- return -1;
337
- }
338
- //#endregion
339
- export { scan_svelte_effect_source as t };
340
-
341
- //# sourceMappingURL=source-scan-C4PsggID.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-scan-C4PsggID.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/compiler/source-scan.ts"],"sourcesContent":["/**\n * Half-open source range in a Svelte component.\n *\n * @example\n * ```ts\n * const range: SourceRange = { start: 0, end: 10 };\n * ```\n *\n * @since 4.0.0\n */\nexport interface SourceRange {\n\t/** Inclusive start offset. */\n\tstart: number;\n\t/** Exclusive end offset. */\n\tend: number;\n}\n\n/**\n * Attribute found in a Svelte opening tag.\n *\n * @example\n * ```ts\n * const attribute: SourceAttribute = {\n * name: \"lang\",\n * start: 8,\n * end: 17,\n * name_start: 9,\n * name_end: 13,\n * value: \"ts\",\n * };\n * ```\n *\n * @since 4.0.0\n */\nexport interface SourceAttribute extends SourceRange {\n\t/** Attribute name exactly as written in source. */\n\tname: string;\n\t/** Inclusive offset where the attribute name starts. */\n\tname_start: number;\n\t/** Exclusive offset where the attribute name ends. */\n\tname_end: number;\n\t/** Parsed string value when the attribute has one. */\n\tvalue?: string;\n}\n\n/**\n * Complete `<script>` region discovered by the shared source scanner.\n *\n * @example\n * ```ts\n * const script = scan_svelte_effect_source(source).effect_script;\n * script?.text;\n * ```\n *\n * @since 4.0.0\n */\nexport interface ScriptRegion extends SourceRange {\n\t/** Offset where the opening `<script` tag starts. */\n\topening_tag_start: number;\n\t/** Offset immediately after the opening tag's `>` character. */\n\topening_tag_end: number;\n\t/** Offset immediately after the `script` tag name. */\n\ttag_name_end: number;\n\t/** Offset where script content starts. */\n\tcontent_start: number;\n\t/** Offset where script content ends. */\n\tcontent_end: number;\n\t/** Offset where the closing `</script>` tag starts. */\n\tclosing_tag_start: number;\n\t/** Offset immediately after the closing `</script>` tag. */\n\tclosing_tag_end: number;\n\t/** Raw attribute text between `script` and `>`. */\n\tattributes_text: string;\n\t/** Parsed opening tag attributes. */\n\tattributes: readonly SourceAttribute[];\n\t/** Script content between the opening and closing tags. */\n\ttext: string;\n\t/** Whether this is a module script. */\n\tis_module: boolean;\n\t/** Whether the script has a `lang` attribute. */\n\thas_lang: boolean;\n\t/** Parsed `lang` value when present. */\n\tlang?: string;\n\t/** Whether this script should be parsed as TypeScript. */\n\tis_typescript: boolean;\n\t/** Whether this script has SER's `effect` attribute. */\n\thas_effect: boolean;\n\t/** Range of the `effect` attribute, including leading whitespace. */\n\teffect_attribute?: SourceRange;\n}\n\n/**\n * Markup brace expression outside scripts, styles, and HTML comments.\n *\n * @example\n * ```ts\n * const [expression] = scan_svelte_effect_source(`<p>{name}</p>`).markup_expressions;\n * expression.expression_text;\n * ```\n *\n * @since 4.0.0\n */\nexport interface MarkupBraceExpression {\n\t/** Offset of the opening `{`. */\n\topen: number;\n\t/** Offset of the closing `}`. */\n\tclose: number;\n\t/** Offset where the expression body starts. */\n\tinner_start: number;\n\t/** Offset where the expression body ends. */\n\tinner_end: number;\n\t/** Raw expression body between braces. */\n\tinner: string;\n\t/** Trimmed expression body. */\n\texpression_text: string;\n\t/** Attribute name when the expression is an attribute value. */\n\tattribute_name?: string;\n}\n\n/**\n * Bare declaration tag that the editor projection should normalize.\n *\n * @example\n * ```ts\n * const tags = scan_svelte_effect_source(`{const value = 1}`).bare_const_tags;\n * tags[0]?.insert_position;\n * ```\n *\n * @since 4.0.0\n */\nexport interface BareConstDeclarationTag {\n\t/** Offset of the opening `{`. */\n\topen: number;\n\t/** Offset after `{` where `@` should be inserted. */\n\tinsert_position: number;\n\t/** Brace expression that contains the bare declaration. */\n\texpression: MarkupBraceExpression;\n}\n\n/**\n * Shared lexical facts for a Svelte source document.\n *\n * @example\n * ```ts\n * const scan = scan_svelte_effect_source(source, \"App.svelte\");\n * scan.effect_script?.text;\n * ```\n *\n * @since 4.0.0\n */\nexport interface SvelteEffectSourceScan {\n\t/** Source filename used for diagnostics and debugging. */\n\tfilename: string;\n\t/** Full component source that was scanned. */\n\tsource: string;\n\t/** All complete script regions in source order. */\n\tscripts: readonly ScriptRegion[];\n\t/** Complete style tag ranges in source order. */\n\tstyles: readonly SourceRange[];\n\t/** HTML comment ranges in source order. */\n\tcomments: readonly SourceRange[];\n\t/** Merged ranges where markup brace scanning should not enter. */\n\texcluded_ranges: readonly SourceRange[];\n\t/** Markup brace expressions outside excluded ranges. */\n\tmarkup_expressions: readonly MarkupBraceExpression[];\n\t/** Bare `{const ...}` tags outside excluded ranges. */\n\tbare_const_tags: readonly BareConstDeclarationTag[];\n\t/** First non-module script, if present. */\n\tinstance_script?: ScriptRegion;\n\t/** First non-module script with SER's `effect` attribute, if present. */\n\teffect_script?: ScriptRegion;\n}\n\ninterface TagRegion extends SourceRange {\n\topening_tag_start: number;\n\topening_tag_end: number;\n\ttag_name_end: number;\n\tcontent_start: number;\n\tcontent_end: number;\n\tclosing_tag_start: number;\n\tclosing_tag_end: number;\n\tattributes_text: string;\n\tattributes: readonly SourceAttribute[];\n\ttext: string;\n}\n\n/**\n * Scans a Svelte component once for shared lexical facts used by transforms,\n * diagnostics, and editor projections.\n *\n * @example\n * ```ts\n * const scan = scan_svelte_effect_source(`<script effect>yield* run()</script>`);\n * scan.effect_script?.has_effect;\n * ```\n *\n * @since 4.0.0\n * @param source - Full Svelte component source to scan.\n * @param filename - Optional filename associated with the source.\n * @returns Shared source facts for SER consumers.\n */\nexport function scan_svelte_effect_source(\n\tsource: string,\n\tfilename = \"unknown.svelte\",\n): SvelteEffectSourceScan {\n\tconst scripts = collect_script_regions(source);\n\tconst styles = collect_tag_regions(source, \"style\").map(({ start, end }) => ({ start, end }));\n\tconst comments = collect_html_comment_ranges(source);\n\tconst excluded_ranges = merge_ranges([\n\t\t...scripts.map(({ start, end }) => ({ start, end })),\n\t\t...styles,\n\t\t...comments,\n\t]);\n\tconst markup_expressions = collect_markup_expressions(source, excluded_ranges);\n\tconst bare_const_tags = markup_expressions.flatMap((expression) =>\n\t\tmake_bare_const_tag(expression),\n\t);\n\tconst instance_script = scripts.find((script) => !script.is_module);\n\tconst effect_script = scripts.find((script) => !script.is_module && script.has_effect);\n\n\treturn {\n\t\tfilename,\n\t\tsource,\n\t\tscripts,\n\t\tstyles,\n\t\tcomments,\n\t\texcluded_ranges,\n\t\tmarkup_expressions,\n\t\tbare_const_tags,\n\t\tinstance_script,\n\t\teffect_script,\n\t};\n}\n\n/**\n * Reuses a source scan after bare-const normalization inserts `@` characters.\n *\n * @example\n * ```ts\n * const shifted = shift_scan_after_at_insertions(scan, normalized, [tag.insert_position]);\n * ```\n *\n * @since 4.0.0\n * @param scan - Scan produced from the pre-normalization source.\n * @param normalized_source - Source after `@` insertions.\n * @param insert_positions - Offsets where `@` was inserted.\n * @returns A scan aligned to the normalized source without rescanning markup.\n */\nexport function shift_scan_after_at_insertions(\n\tscan: SvelteEffectSourceScan,\n\tnormalized_source: string,\n\tinsert_positions: readonly number[],\n): SvelteEffectSourceScan {\n\tconst inserts = [...insert_positions].sort((left, right) => left - right);\n\tconst shift = (offset: number) =>\n\t\toffset + inserts.filter((position) => position <= offset).length;\n\n\tconst shift_range = <T extends SourceRange>(range: T): T => ({\n\t\t...range,\n\t\tstart: shift(range.start),\n\t\tend: shift(range.end),\n\t});\n\n\tconst shift_attribute = (attribute: SourceAttribute): SourceAttribute => ({\n\t\t...shift_range(attribute),\n\t\tname: attribute.name,\n\t\tname_start: shift(attribute.name_start),\n\t\tname_end: shift(attribute.name_end),\n\t\tvalue: attribute.value,\n\t});\n\n\tconst shift_script = (script: ScriptRegion): ScriptRegion => {\n\t\tconst shifted = {\n\t\t\t...shift_range(script),\n\t\t\topening_tag_start: shift(script.opening_tag_start),\n\t\t\topening_tag_end: shift(script.opening_tag_end),\n\t\t\ttag_name_end: shift(script.tag_name_end),\n\t\t\tcontent_start: shift(script.content_start),\n\t\t\tcontent_end: shift(script.content_end),\n\t\t\tclosing_tag_start: shift(script.closing_tag_start),\n\t\t\tclosing_tag_end: shift(script.closing_tag_end),\n\t\t\tattributes_text: normalized_source.slice(\n\t\t\t\tshift(script.opening_tag_end),\n\t\t\t\tshift(script.content_start),\n\t\t\t),\n\t\t\tattributes: script.attributes.map(shift_attribute),\n\t\t\ttext: normalized_source.slice(shift(script.content_start), shift(script.content_end)),\n\t\t\tis_module: script.is_module,\n\t\t\thas_lang: script.has_lang,\n\t\t\tlang: script.lang,\n\t\t\tis_typescript: script.is_typescript,\n\t\t\thas_effect: script.has_effect,\n\t\t\teffect_attribute: script.effect_attribute\n\t\t\t\t? shift_range(script.effect_attribute)\n\t\t\t\t: undefined,\n\t\t};\n\n\t\treturn shifted;\n\t};\n\n\tconst shift_expression = (expression: MarkupBraceExpression): MarkupBraceExpression => {\n\t\tconst open = shift(expression.open);\n\t\tconst close = shift(expression.close);\n\t\tconst inner_start = shift(expression.inner_start);\n\t\tconst inner_end = shift(expression.inner_end);\n\t\tconst inner = normalized_source.slice(inner_start, inner_end);\n\n\t\treturn {\n\t\t\topen,\n\t\t\tclose,\n\t\t\tinner_start,\n\t\t\tinner_end,\n\t\t\tinner,\n\t\t\texpression_text: inner.trim(),\n\t\t\tattribute_name: expression.attribute_name,\n\t\t};\n\t};\n\n\tconst scripts = scan.scripts.map(shift_script);\n\n\treturn {\n\t\tfilename: scan.filename,\n\t\tsource: normalized_source,\n\t\tscripts,\n\t\tstyles: scan.styles.map(shift_range),\n\t\tcomments: scan.comments.map(shift_range),\n\t\texcluded_ranges: scan.excluded_ranges.map(shift_range),\n\t\tmarkup_expressions: scan.markup_expressions.map(shift_expression),\n\t\tbare_const_tags: [],\n\t\tinstance_script: scan.instance_script ? shift_script(scan.instance_script) : undefined,\n\t\teffect_script: scan.effect_script ? shift_script(scan.effect_script) : undefined,\n\t};\n}\n\nfunction collect_script_regions(source: string): ScriptRegion[] {\n\treturn collect_tag_regions(source, \"script\").map((region) => {\n\t\tconst lang = get_attribute(region.attributes, \"lang\")?.value?.toLowerCase();\n\t\tconst context = get_attribute(region.attributes, \"context\")?.value?.toLowerCase();\n\t\tconst effect_attribute = get_attribute(region.attributes, \"effect\");\n\t\tconst is_module = has_attribute(region.attributes, \"module\") || context === \"module\";\n\n\t\treturn {\n\t\t\t...region,\n\t\t\tis_module,\n\t\t\thas_lang: has_attribute(region.attributes, \"lang\"),\n\t\t\tlang,\n\t\t\tis_typescript: lang === \"ts\" || lang === \"typescript\",\n\t\t\thas_effect: effect_attribute !== undefined,\n\t\t\teffect_attribute: effect_attribute\n\t\t\t\t? { start: effect_attribute.start, end: effect_attribute.end }\n\t\t\t\t: undefined,\n\t\t};\n\t});\n}\n\nfunction collect_tag_regions(source: string, tag_name: \"script\" | \"style\"): TagRegion[] {\n\tconst lower_source = source.toLowerCase();\n\tconst ranges: TagRegion[] = [];\n\tlet cursor = 0;\n\n\twhile (cursor < source.length) {\n\t\tconst opening_tag_start = find_next_tag_start(lower_source, tag_name, cursor);\n\n\t\tif (opening_tag_start === -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst opening_tag_close = find_tag_close(source, opening_tag_start);\n\n\t\tif (opening_tag_close === -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst content_start = opening_tag_close + 1;\n\t\tconst closing_tag_start = find_next_closing_tag_start(\n\t\t\tlower_source,\n\t\t\ttag_name,\n\t\t\tcontent_start,\n\t\t);\n\n\t\tif (closing_tag_start === -1) {\n\t\t\tcursor = content_start;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst closing_tag_close = find_tag_close(source, closing_tag_start);\n\n\t\tif (closing_tag_close === -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst tag_name_end = opening_tag_start + 1 + tag_name.length;\n\t\tconst opening_tag_end = opening_tag_close + 1;\n\t\tconst closing_tag_end = closing_tag_close + 1;\n\t\tconst attributes = collect_attributes(source, tag_name_end, opening_tag_close);\n\n\t\tranges.push({\n\t\t\tstart: opening_tag_start,\n\t\t\tend: closing_tag_end,\n\t\t\topening_tag_start,\n\t\t\topening_tag_end,\n\t\t\ttag_name_end,\n\t\t\tcontent_start,\n\t\t\tcontent_end: closing_tag_start,\n\t\t\tclosing_tag_start,\n\t\t\tclosing_tag_end,\n\t\t\tattributes_text: source.slice(tag_name_end, opening_tag_close),\n\t\t\tattributes,\n\t\t\ttext: source.slice(content_start, closing_tag_start),\n\t\t});\n\n\t\tcursor = closing_tag_end;\n\t}\n\n\treturn ranges;\n}\n\nfunction collect_attributes(source: string, start: number, end: number): SourceAttribute[] {\n\tconst attributes: SourceAttribute[] = [];\n\tlet cursor = start;\n\n\twhile (cursor < end) {\n\t\tconst attribute_start = cursor;\n\n\t\twhile (cursor < end && /\\s/.test(source[cursor] ?? \"\")) {\n\t\t\tcursor += 1;\n\t\t}\n\n\t\tif (cursor >= end || source[cursor] === \"/\") {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst name_start = cursor;\n\n\t\twhile (cursor < end && !/[\\s=/>]/.test(source[cursor] ?? \"\")) {\n\t\t\tcursor += 1;\n\t\t}\n\n\t\tconst name_end = cursor;\n\t\tconst name = source.slice(name_start, name_end);\n\n\t\twhile (cursor < end && /\\s/.test(source[cursor] ?? \"\")) {\n\t\t\tcursor += 1;\n\t\t}\n\n\t\tif (source[cursor] !== \"=\") {\n\t\t\tattributes.push({\n\t\t\t\tname,\n\t\t\t\tstart: attribute_start,\n\t\t\t\tend: name_end,\n\t\t\t\tname_start,\n\t\t\t\tname_end,\n\t\t\t});\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tcursor += 1;\n\n\t\twhile (cursor < end && /\\s/.test(source[cursor] ?? \"\")) {\n\t\t\tcursor += 1;\n\t\t}\n\n\t\tconst value = read_attribute_value(source, cursor, end);\n\n\t\tattributes.push({\n\t\t\tname,\n\t\t\tstart: attribute_start,\n\t\t\tend: value.end,\n\t\t\tname_start,\n\t\t\tname_end,\n\t\t\tvalue: value.text,\n\t\t});\n\n\t\tcursor = value.end;\n\t}\n\n\treturn attributes;\n}\n\nfunction read_attribute_value(\n\tsource: string,\n\tstart: number,\n\tend: number,\n): { text: string; end: number } {\n\tconst quote = source[start];\n\n\tif (quote === '\"' || quote === \"'\") {\n\t\tlet cursor = start + 1;\n\n\t\twhile (cursor < end && source[cursor] !== quote) {\n\t\t\tcursor += 1;\n\t\t}\n\n\t\treturn {\n\t\t\ttext: source.slice(start + 1, cursor),\n\t\t\tend: Math.min(cursor + 1, end),\n\t\t};\n\t}\n\n\tlet cursor = start;\n\n\twhile (cursor < end && !/\\s/.test(source[cursor] ?? \"\")) {\n\t\tcursor += 1;\n\t}\n\n\treturn {\n\t\ttext: source.slice(start, cursor),\n\t\tend: cursor,\n\t};\n}\n\nfunction collect_html_comment_ranges(source: string): SourceRange[] {\n\tconst ranges: SourceRange[] = [];\n\tlet cursor = 0;\n\n\twhile (cursor < source.length) {\n\t\tconst start = source.indexOf(\"<!--\", cursor);\n\n\t\tif (start === -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst close = source.indexOf(\"-->\", start + \"<!--\".length);\n\t\tconst end = close === -1 ? source.length : close + \"-->\".length;\n\n\t\tranges.push({ start, end });\n\n\t\tcursor = end;\n\t}\n\n\treturn ranges;\n}\n\nfunction collect_markup_expressions(\n\tsource: string,\n\texcluded_ranges: readonly SourceRange[],\n): MarkupBraceExpression[] {\n\tconst expressions: MarkupBraceExpression[] = [];\n\tlet cursor = 0;\n\n\twhile (cursor < source.length) {\n\t\tconst open = source.indexOf(\"{\", cursor);\n\n\t\tif (open === -1) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst excluded_range = find_range_containing(excluded_ranges, open);\n\n\t\tif (excluded_range) {\n\t\t\tcursor = excluded_range.end;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst close = find_closing_brace(source, open + 1);\n\n\t\tif (close === -1) {\n\t\t\tcursor = open + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst inner_start = open + 1;\n\t\tconst inner_end = close;\n\t\tconst inner = source.slice(inner_start, inner_end);\n\n\t\texpressions.push({\n\t\t\topen,\n\t\t\tclose,\n\t\t\tinner_start,\n\t\t\tinner_end,\n\t\t\tinner,\n\t\t\texpression_text: inner.trim(),\n\t\t\tattribute_name: find_attribute_name_before_expression(source, open, close),\n\t\t});\n\n\t\tcursor = close + 1;\n\t}\n\n\treturn expressions;\n}\n\nfunction make_bare_const_tag(\n\texpression: MarkupBraceExpression,\n): readonly BareConstDeclarationTag[] {\n\tif (!/^(\\s*)const\\s/.test(expression.inner)) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\t{\n\t\t\topen: expression.open,\n\t\t\tinsert_position: expression.open + 1,\n\t\t\texpression,\n\t\t},\n\t];\n}\n\nfunction find_attribute_name_before_expression(\n\tsource: string,\n\topen: number,\n\tclose: number,\n): string | undefined {\n\tconst tag_start = source.lastIndexOf(\"<\", open);\n\tconst last_tag_end = source.lastIndexOf(\">\", open);\n\n\tif (tag_start === -1 || tag_start < last_tag_end) {\n\t\treturn undefined;\n\t}\n\n\tconst before_expression = source.slice(tag_start + 1, open);\n\tconst match = before_expression.match(/(?:^|\\s)([A-Za-z_$:][\\w$:-]*)\\s*=\\s*([\"']?)$/);\n\tconst quote = match?.[2];\n\n\tif (quote && source[close + 1] !== quote) {\n\t\treturn undefined;\n\t}\n\n\treturn match?.[1];\n}\n\nfunction find_range_containing(\n\tranges: readonly SourceRange[],\n\tposition: number,\n): SourceRange | undefined {\n\tlet low = 0;\n\tlet high = ranges.length - 1;\n\n\twhile (low <= high) {\n\t\tconst mid = Math.floor((low + high) / 2);\n\t\tconst range = ranges[mid];\n\n\t\tif (position < range.start) {\n\t\t\thigh = mid - 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (position >= range.end) {\n\t\t\tlow = mid + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn range;\n\t}\n\n\treturn undefined;\n}\n\nfunction merge_ranges(ranges: SourceRange[]): SourceRange[] {\n\tconst sorted = [...ranges].sort((a, b) => a.start - b.start);\n\tconst merged: SourceRange[] = [];\n\n\tfor (const range of sorted) {\n\t\tconst previous = merged.at(-1);\n\n\t\tif (!previous || range.start > previous.end) {\n\t\t\tmerged.push({ ...range });\n\t\t\tcontinue;\n\t\t}\n\n\t\tprevious.end = Math.max(previous.end, range.end);\n\t}\n\n\treturn merged;\n}\n\nfunction get_attribute(\n\tattributes: readonly SourceAttribute[],\n\tname: string,\n): SourceAttribute | undefined {\n\tconst normalized_name = name.toLowerCase();\n\n\treturn attributes.find((attribute) => attribute.name.toLowerCase() === normalized_name);\n}\n\nfunction has_attribute(attributes: readonly SourceAttribute[], name: string): boolean {\n\treturn get_attribute(attributes, name) !== undefined;\n}\n\nfunction find_next_tag_start(\n\tlower_source: string,\n\ttag_name: \"script\" | \"style\",\n\tstart: number,\n): number {\n\tconst needle = `<${tag_name}`;\n\tlet cursor = start;\n\n\twhile (cursor < lower_source.length) {\n\t\tconst tag_start = lower_source.indexOf(needle, cursor);\n\n\t\tif (tag_start === -1) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tconst boundary = lower_source[tag_start + needle.length];\n\n\t\tif (boundary === undefined || boundary === \">\" || boundary === \"/\" || /\\s/.test(boundary)) {\n\t\t\treturn tag_start;\n\t\t}\n\n\t\tcursor = tag_start + needle.length;\n\t}\n\n\treturn -1;\n}\n\nfunction find_next_closing_tag_start(\n\tlower_source: string,\n\ttag_name: \"script\" | \"style\",\n\tstart: number,\n): number {\n\tconst needle = `</${tag_name}`;\n\tlet cursor = start;\n\n\twhile (cursor < lower_source.length) {\n\t\tconst tag_start = lower_source.indexOf(needle, cursor);\n\n\t\tif (tag_start === -1) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tconst boundary = lower_source[tag_start + needle.length];\n\n\t\tif (boundary === undefined || boundary === \">\" || /\\s/.test(boundary)) {\n\t\t\treturn tag_start;\n\t\t}\n\n\t\tcursor = tag_start + needle.length;\n\t}\n\n\treturn -1;\n}\n\nfunction find_tag_close(source: string, start: number): number {\n\tlet quote: string | undefined;\n\n\tfor (let cursor = start; cursor < source.length; cursor += 1) {\n\t\tconst char = source[cursor];\n\n\t\tif (quote) {\n\t\t\tif (char === quote) {\n\t\t\t\tquote = undefined;\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === '\"' || char === \"'\") {\n\t\t\tquote = char;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === \">\") {\n\t\t\treturn cursor;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\nfunction find_closing_brace(source: string, start: number): number {\n\tlet depth = 0;\n\n\tfor (let cursor = start; cursor < source.length; cursor += 1) {\n\t\tconst char = source[cursor];\n\n\t\tif (char === \"{\" && source[cursor - 1] !== \"$\") {\n\t\t\tdepth += 1;\n\t\t} else if (char === \"}\") {\n\t\t\tif (depth === 0) {\n\t\t\t\treturn cursor;\n\t\t\t}\n\n\t\t\tdepth -= 1;\n\t\t} else if (char === \"'\" || char === '\"' || char === \"`\") {\n\t\t\tcursor = skip_string(source, cursor, char);\n\n\t\t\tif (cursor === -1) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t} else if (char === \"/\" && source[cursor + 1] === \"/\") {\n\t\t\tcursor = skip_line_comment(source, cursor);\n\t\t} else if (char === \"/\" && source[cursor + 1] === \"*\") {\n\t\t\tcursor = skip_block_comment(source, cursor);\n\n\t\t\tif (cursor === -1) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1;\n}\n\nfunction skip_string(source: string, start: number, quote: string): number {\n\tfor (let cursor = start + 1; cursor < source.length; cursor += 1) {\n\t\tif (source[cursor] === \"\\\\\") {\n\t\t\tcursor += 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (source[cursor] === quote) {\n\t\t\treturn cursor;\n\t\t}\n\t}\n\n\treturn -1;\n}\n\nfunction skip_line_comment(source: string, start: number): number {\n\tfor (let cursor = start + 2; cursor < source.length; cursor += 1) {\n\t\tif (source[cursor] === \"\\n\") {\n\t\t\treturn cursor;\n\t\t}\n\t}\n\n\treturn source.length;\n}\n\nfunction skip_block_comment(source: string, start: number): number {\n\tfor (let cursor = start + 2; cursor < source.length; cursor += 1) {\n\t\tif (source[cursor] === \"*\" && source[cursor + 1] === \"/\") {\n\t\t\treturn cursor + 1;\n\t\t}\n\t}\n\n\treturn -1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyMA,SAAgB,0BACf,QACA,WAAW,kBACc;CACzB,MAAM,UAAU,uBAAuB,MAAM;CAC7C,MAAM,SAAS,oBAAoB,QAAQ,OAAO,CAAC,CAAC,KAAK,EAAE,OAAO,WAAW;EAAE;EAAO;CAAI,EAAE;CAC5F,MAAM,WAAW,4BAA4B,MAAM;CACnD,MAAM,kBAAkB,aAAa;EACpC,GAAG,QAAQ,KAAK,EAAE,OAAO,WAAW;GAAE;GAAO;EAAI,EAAE;EACnD,GAAG;EACH,GAAG;CACJ,CAAC;CACD,MAAM,qBAAqB,2BAA2B,QAAQ,eAAe;CAO7E,OAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAduB,mBAAmB,SAAS,eACnD,oBAAoB,UAAU,CAahB;EACd,iBAZuB,QAAQ,MAAM,WAAW,CAAC,OAAO,SAY1C;EACd,eAZqB,QAAQ,MAAM,WAAW,CAAC,OAAO,aAAa,OAAO,UAY9D;CACb;AACD;AAsGA,SAAS,uBAAuB,QAAgC;CAC/D,OAAO,oBAAoB,QAAQ,QAAQ,CAAC,CAAC,KAAK,WAAW;EAC5D,MAAM,OAAO,cAAc,OAAO,YAAY,MAAM,CAAC,EAAE,OAAO,YAAY;EA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