@motionscript/code 0.1.0-alpha.3 → 0.1.0-alpha.5

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 (59) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/LICENSE +201 -201
  3. package/NOTICE +48 -0
  4. package/README.md +161 -108
  5. package/dist/browser/THIRD_PARTY_LICENSES.txt +431 -0
  6. package/dist/browser/index.js +7 -6
  7. package/dist/browser/index.js.map +3 -3
  8. package/dist/browser/manifest.json +84 -2
  9. package/dist/code-range.d.ts +6 -0
  10. package/dist/code-range.d.ts.map +1 -1
  11. package/dist/code-range.js +8 -0
  12. package/dist/code-range.js.map +1 -1
  13. package/dist/diff.d.ts +14 -0
  14. package/dist/diff.d.ts.map +1 -1
  15. package/dist/diff.js +134 -2
  16. package/dist/diff.js.map +1 -1
  17. package/dist/engine.d.ts +1 -1
  18. package/dist/engine.d.ts.map +1 -1
  19. package/dist/engine.js +1 -1
  20. package/dist/engine.js.map +1 -1
  21. package/dist/highlight.d.ts +10 -2
  22. package/dist/highlight.d.ts.map +1 -1
  23. package/dist/highlight.js +40 -6
  24. package/dist/highlight.js.map +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/layout.js.map +1 -1
  27. package/dist/node.d.ts +42 -7
  28. package/dist/node.d.ts.map +1 -1
  29. package/dist/node.js +174 -47
  30. package/dist/node.js.map +1 -1
  31. package/dist/nodes.js.map +1 -1
  32. package/dist/render.d.ts +6 -1
  33. package/dist/render.d.ts.map +1 -1
  34. package/dist/render.js +59 -0
  35. package/dist/render.js.map +1 -1
  36. package/dist/style.d.ts +3 -3
  37. package/dist/style.d.ts.map +1 -1
  38. package/dist/style.js +10 -6
  39. package/dist/style.js.map +1 -1
  40. package/dist/tokens.d.ts.map +1 -1
  41. package/dist/tokens.js +5 -1
  42. package/dist/tokens.js.map +1 -1
  43. package/dist/transitions.d.ts +19 -1
  44. package/dist/transitions.d.ts.map +1 -1
  45. package/dist/transitions.js.map +1 -1
  46. package/package.json +7 -5
  47. package/registry.json +6 -6
  48. package/src/code-range.ts +165 -156
  49. package/src/diff.ts +351 -216
  50. package/src/engine.ts +21 -21
  51. package/src/highlight.ts +340 -291
  52. package/src/index.ts +3 -3
  53. package/src/layout.ts +157 -157
  54. package/src/node.ts +1038 -904
  55. package/src/nodes.ts +18 -18
  56. package/src/render.ts +312 -247
  57. package/src/style.ts +255 -251
  58. package/src/tokens.ts +79 -75
  59. package/src/transitions.ts +204 -184
@@ -0,0 +1,431 @@
1
+ Third-party software bundled into @motionscript/code's browser build (dist/browser/).
2
+
3
+ @lezer/common 1.5.2
4
+ License: MIT
5
+
6
+ MIT License
7
+
8
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.
27
+
28
+ ------------------------------------------------------------------------------
29
+
30
+ @lezer/cpp 1.1.6
31
+ License: MIT
32
+
33
+ MIT License
34
+
35
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining a copy
38
+ of this software and associated documentation files (the "Software"), to deal
39
+ in the Software without restriction, including without limitation the rights
40
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41
+ copies of the Software, and to permit persons to whom the Software is
42
+ furnished to do so, subject to the following conditions:
43
+
44
+ The above copyright notice and this permission notice shall be included in
45
+ all copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
50
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
51
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
52
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
53
+ THE SOFTWARE.
54
+
55
+ ------------------------------------------------------------------------------
56
+
57
+ @lezer/css 1.3.3
58
+ License: MIT
59
+
60
+ MIT License
61
+
62
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
63
+
64
+ Permission is hereby granted, free of charge, to any person obtaining a copy
65
+ of this software and associated documentation files (the "Software"), to deal
66
+ in the Software without restriction, including without limitation the rights
67
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
68
+ copies of the Software, and to permit persons to whom the Software is
69
+ furnished to do so, subject to the following conditions:
70
+
71
+ The above copyright notice and this permission notice shall be included in
72
+ all copies or substantial portions of the Software.
73
+
74
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
75
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
76
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
77
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
78
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
79
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
80
+ THE SOFTWARE.
81
+
82
+ ------------------------------------------------------------------------------
83
+
84
+ @lezer/go 1.0.1
85
+ License: MIT
86
+
87
+ MIT License
88
+
89
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
90
+
91
+ Permission is hereby granted, free of charge, to any person obtaining a copy
92
+ of this software and associated documentation files (the "Software"), to deal
93
+ in the Software without restriction, including without limitation the rights
94
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
95
+ copies of the Software, and to permit persons to whom the Software is
96
+ furnished to do so, subject to the following conditions:
97
+
98
+ The above copyright notice and this permission notice shall be included in
99
+ all copies or substantial portions of the Software.
100
+
101
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
102
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
103
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
104
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
105
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
106
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
107
+ THE SOFTWARE.
108
+
109
+ ------------------------------------------------------------------------------
110
+
111
+ @lezer/highlight 1.2.3
112
+ License: MIT
113
+
114
+ MIT License
115
+
116
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
117
+
118
+ Permission is hereby granted, free of charge, to any person obtaining a copy
119
+ of this software and associated documentation files (the "Software"), to deal
120
+ in the Software without restriction, including without limitation the rights
121
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
122
+ copies of the Software, and to permit persons to whom the Software is
123
+ furnished to do so, subject to the following conditions:
124
+
125
+ The above copyright notice and this permission notice shall be included in
126
+ all copies or substantial portions of the Software.
127
+
128
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
129
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
130
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
131
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
133
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
134
+ THE SOFTWARE.
135
+
136
+ ------------------------------------------------------------------------------
137
+
138
+ @lezer/html 1.3.13
139
+ License: MIT
140
+
141
+ MIT License
142
+
143
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
144
+
145
+ Permission is hereby granted, free of charge, to any person obtaining a copy
146
+ of this software and associated documentation files (the "Software"), to deal
147
+ in the Software without restriction, including without limitation the rights
148
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
149
+ copies of the Software, and to permit persons to whom the Software is
150
+ furnished to do so, subject to the following conditions:
151
+
152
+ The above copyright notice and this permission notice shall be included in
153
+ all copies or substantial portions of the Software.
154
+
155
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
156
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
157
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
158
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
159
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
160
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
161
+ THE SOFTWARE.
162
+
163
+ ------------------------------------------------------------------------------
164
+
165
+ @lezer/java 1.1.3
166
+ License: MIT
167
+
168
+ MIT License
169
+
170
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
171
+
172
+ Permission is hereby granted, free of charge, to any person obtaining a copy
173
+ of this software and associated documentation files (the "Software"), to deal
174
+ in the Software without restriction, including without limitation the rights
175
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
176
+ copies of the Software, and to permit persons to whom the Software is
177
+ furnished to do so, subject to the following conditions:
178
+
179
+ The above copyright notice and this permission notice shall be included in
180
+ all copies or substantial portions of the Software.
181
+
182
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
183
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
184
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
185
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
186
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
187
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
188
+ THE SOFTWARE.
189
+
190
+ ------------------------------------------------------------------------------
191
+
192
+ @lezer/javascript 1.5.4
193
+ License: MIT
194
+
195
+ MIT License
196
+
197
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
198
+
199
+ Permission is hereby granted, free of charge, to any person obtaining a copy
200
+ of this software and associated documentation files (the "Software"), to deal
201
+ in the Software without restriction, including without limitation the rights
202
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
203
+ copies of the Software, and to permit persons to whom the Software is
204
+ furnished to do so, subject to the following conditions:
205
+
206
+ The above copyright notice and this permission notice shall be included in
207
+ all copies or substantial portions of the Software.
208
+
209
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
210
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
211
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
212
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
213
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
214
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
215
+ THE SOFTWARE.
216
+
217
+ ------------------------------------------------------------------------------
218
+
219
+ @lezer/json 1.0.3
220
+ License: MIT
221
+
222
+ MIT License
223
+
224
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin>, Arun Srinivasan <rulfzid@gmail.com>, and others
225
+
226
+ Permission is hereby granted, free of charge, to any person obtaining a copy
227
+ of this software and associated documentation files (the "Software"), to deal
228
+ in the Software without restriction, including without limitation the rights
229
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
230
+ copies of the Software, and to permit persons to whom the Software is
231
+ furnished to do so, subject to the following conditions:
232
+
233
+ The above copyright notice and this permission notice shall be included in
234
+ all copies or substantial portions of the Software.
235
+
236
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
237
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
238
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
239
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
240
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
241
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
242
+ THE SOFTWARE.
243
+
244
+ ------------------------------------------------------------------------------
245
+
246
+ @lezer/lr 1.4.10
247
+ License: MIT
248
+
249
+ MIT License
250
+
251
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
252
+
253
+ Permission is hereby granted, free of charge, to any person obtaining a copy
254
+ of this software and associated documentation files (the "Software"), to deal
255
+ in the Software without restriction, including without limitation the rights
256
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
257
+ copies of the Software, and to permit persons to whom the Software is
258
+ furnished to do so, subject to the following conditions:
259
+
260
+ The above copyright notice and this permission notice shall be included in
261
+ all copies or substantial portions of the Software.
262
+
263
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
264
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
265
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
266
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
267
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
268
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
269
+ THE SOFTWARE.
270
+
271
+ ------------------------------------------------------------------------------
272
+
273
+ @lezer/markdown 1.6.4
274
+ License: MIT
275
+
276
+ MIT License
277
+
278
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
279
+
280
+ Permission is hereby granted, free of charge, to any person obtaining a copy
281
+ of this software and associated documentation files (the "Software"), to deal
282
+ in the Software without restriction, including without limitation the rights
283
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
284
+ copies of the Software, and to permit persons to whom the Software is
285
+ furnished to do so, subject to the following conditions:
286
+
287
+ The above copyright notice and this permission notice shall be included in
288
+ all copies or substantial portions of the Software.
289
+
290
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
291
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
292
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
293
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
294
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
295
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
296
+ THE SOFTWARE.
297
+
298
+ ------------------------------------------------------------------------------
299
+
300
+ @lezer/php 1.0.5
301
+ License: MIT
302
+
303
+ MIT License
304
+
305
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
306
+
307
+ Permission is hereby granted, free of charge, to any person obtaining a copy
308
+ of this software and associated documentation files (the "Software"), to deal
309
+ in the Software without restriction, including without limitation the rights
310
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
311
+ copies of the Software, and to permit persons to whom the Software is
312
+ furnished to do so, subject to the following conditions:
313
+
314
+ The above copyright notice and this permission notice shall be included in
315
+ all copies or substantial portions of the Software.
316
+
317
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
318
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
319
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
320
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
321
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
322
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
323
+ THE SOFTWARE.
324
+
325
+ ------------------------------------------------------------------------------
326
+
327
+ @lezer/python 1.1.19
328
+ License: MIT
329
+
330
+ MIT License
331
+
332
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
333
+
334
+ Permission is hereby granted, free of charge, to any person obtaining a copy
335
+ of this software and associated documentation files (the "Software"), to deal
336
+ in the Software without restriction, including without limitation the rights
337
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
338
+ copies of the Software, and to permit persons to whom the Software is
339
+ furnished to do so, subject to the following conditions:
340
+
341
+ The above copyright notice and this permission notice shall be included in
342
+ all copies or substantial portions of the Software.
343
+
344
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
345
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
346
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
347
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
348
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
349
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
350
+ THE SOFTWARE.
351
+
352
+ ------------------------------------------------------------------------------
353
+
354
+ @lezer/rust 1.0.2
355
+ License: MIT
356
+
357
+ MIT License
358
+
359
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
360
+
361
+ Permission is hereby granted, free of charge, to any person obtaining a copy
362
+ of this software and associated documentation files (the "Software"), to deal
363
+ in the Software without restriction, including without limitation the rights
364
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
365
+ copies of the Software, and to permit persons to whom the Software is
366
+ furnished to do so, subject to the following conditions:
367
+
368
+ The above copyright notice and this permission notice shall be included in
369
+ all copies or substantial portions of the Software.
370
+
371
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
372
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
373
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
374
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
375
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
376
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
377
+ THE SOFTWARE.
378
+
379
+ ------------------------------------------------------------------------------
380
+
381
+ @lezer/xml 1.0.6
382
+ License: MIT
383
+
384
+ MIT License
385
+
386
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
387
+
388
+ Permission is hereby granted, free of charge, to any person obtaining a copy
389
+ of this software and associated documentation files (the "Software"), to deal
390
+ in the Software without restriction, including without limitation the rights
391
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
392
+ copies of the Software, and to permit persons to whom the Software is
393
+ furnished to do so, subject to the following conditions:
394
+
395
+ The above copyright notice and this permission notice shall be included in
396
+ all copies or substantial portions of the Software.
397
+
398
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
399
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
400
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
401
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
402
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
403
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
404
+ THE SOFTWARE.
405
+
406
+ ------------------------------------------------------------------------------
407
+
408
+ @lezer/yaml 1.0.4
409
+ License: MIT
410
+
411
+ MIT License
412
+
413
+ Copyright (C) 2024 by Marijn Haverbeke <marijnh@gmail.com> and others
414
+
415
+ Permission is hereby granted, free of charge, to any person obtaining a copy
416
+ of this software and associated documentation files (the "Software"), to deal
417
+ in the Software without restriction, including without limitation the rights
418
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
419
+ copies of the Software, and to permit persons to whom the Software is
420
+ furnished to do so, subject to the following conditions:
421
+
422
+ The above copyright notice and this permission notice shall be included in
423
+ all copies or substantial portions of the Software.
424
+
425
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
426
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
427
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
428
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
429
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
430
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
431
+ THE SOFTWARE.
@@ -1,7 +1,8 @@
1
- import{j as ct,k as lt,l as e}from"./chunks/chunk-SYZUZB3M.js";import{node as oe,Clip as ie,Node2D as re,property as _,insetsProperty as se,lerpNumber as Ht,command as O,driveCommand as F}from"@motionscript/sdk";function Ft(n,t,i){if(i<=n[0])return t[0];if(i>=n[n.length-1])return t[t.length-1];for(let o=0;o<n.length-1;o++)if(i<=n[o+1]){let s=n[o+1]-n[o],a=s===0?0:(i-n[o])/s;return t[o]+(t[o+1]-t[o])*a}return t[t.length-1]}function G(n,t){if(!n)return 1;let[i,o]=n;return t<=i?0:t>=o||o===i?1:(t-i)/(o-i)}function Ot(n){return n*n*(3-2*n)}function X(n,t){return{id:n,opacity:t.values,opacityKeys:t.keys}}function At(n,t){return n&&t?{out:[0,.38],move:[.1,.68],in:[.52,1]}:n?{out:[0,.45],move:[.22,1],in:null}:t?{out:null,move:[0,.55],in:[.38,1]}:{out:null,move:[0,1],in:null}}var ht=At;function P(n){return n?Ot(G(n.phases.move,n.progress)):1}function dt(n,t,i,o){let s=new Map;if(i!==null){let a=i;for(let r of n)for(let c of r.tokens)s.set(c.id,{opacity:o.has(c.id)?1:a})}for(let a of t)if(a.kind==="dim")for(let r of a.tokens)s.set(r.id,{opacity:Ft(r.opacityKeys,r.opacity,a.progress)});return s}function K(n){let t=n.padding;return[n.fontSize,n.fontFamily,n.lineHeight,n.letterSpacing,t.left,t.right,t.top,t.bottom,n.showLineNumbers?1:0,n.lineNumberGap].join("|")}function Et(n,t,i){return i.advance(n," ",t.fontSize,t.fontFamily,0)*t.lineNumberGap}function zt(n,t,i,o,s){if(!t.showLineNumbers)return 0;let a=String(Math.max(1,o));return i.advance(n,a,t.fontSize,t.fontFamily,0)+s}function W(n,t,i,o){let s=t.fontSize*t.lineHeight,a=t.showLineNumbers?Et(o,t,i):0,r=zt(o,t,i,n.length,a),c=new Array(n.length),l=0;for(let b=0;b<n.length;b++){let m=0;for(let x of n[b].tokens)m+=i.advance(o,x.content,t.fontSize,t.fontFamily,t.letterSpacing);c[b]=m,m>l&&(l=m)}let h=l+r,d=n.length*s,f=h+t.padding.left+t.padding.right,u=d+t.padding.top+t.padding.bottom,g=-f/2+t.padding.left+r,k=u/2-t.padding.top,S=new Map,p=new Array(n.length),v=new Map;for(let b=0;b<n.length;b++){let m=k-b*s-s/2;p[b]=m,v.set(n[b].id,b);let x=g;for(let C of n[b].tokens)S.set(C.id,{x,y:m}),x+=i.advance(o,C.content,t.fontSize,t.fontFamily,t.letterSpacing)}return{tokens:S,lineY:p,lineW:c,lineIndex:v,gutter:r,gutterGap:a,innerW:h,innerH:d,blockW:f,blockH:u,startX:g}}import{Graphics2D as ft,parseColor as Dt,lerpNumber as A}from"@motionscript/sdk";var jt=[.82,.84,.86,1],Rt=[.45,.5,.55,1],ut=new Map;function J(n){if(!n)return jt;let t=ut.get(n);return t||(t=Dt(n),ut.set(n,t)),t}function Gt(n,t,i){return i<=0?n:i>=1?t:[n[0]+(t[0]-n[0])*i,n[1]+(t[1]-n[1])*i,n[2]+(t[2]-n[2])*i,n[3]+(t[3]-n[3])*i]}function Pt(n,t,i){if(!i)return 1;let o=1;for(let s of n.tokens){if(s.content.length===0)continue;let a=t.get(s.id)?.opacity??1;a<o&&(o=a)}return o}function Q(n,t){let{tokenLines:i,metrics:o,advanceCache:s,from:a,to:r,edit:c,tokenStates:l}=t,h=c?c.progress:1,d=c?G(c.phases.out,h):1,f=P(c),u=c?G(c.phases.in,h):1,g=c?A(a.blockW,r.blockW,f):r.blockW,k=c?A(a.gutter,r.gutter,f):r.gutter,S=r.gutterGap||a.gutterGap,p=-g/2+o.padding.left+k-S,v=(m,x,C)=>{if(C<=0)return;let N=s.advance(n,m,o.fontSize,o.fontFamily,0);n.draw(new ft().text({text:m,fontSize:o.fontSize,fontFamily:o.fontFamily,lineHeight:o.lineHeight,x:p-N/2,y:x,textAlign:"left"}).fill([{type:"solid",color:Rt,opacity:C}]))},b=(m,x,C,N,M)=>{if(M<=0||m.length===0)return;let I=s.advance(n,m,o.fontSize,o.fontFamily,o.letterSpacing);n.draw(new ft().text({text:m,fontSize:o.fontSize,fontFamily:o.fontFamily,lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,x:x+I/2,y:C,textAlign:"left"}).fill([{type:"solid",color:N,opacity:M}]))};for(let m=0;m<i.length;m++){let x=i[m],C=r.lineIndex.get(x.id);if(C===void 0)continue;let N=r.lineY[C],M=c?.enteringLineIds.has(x.id)??!1,I=N,z=1;if(c&&M)z=u;else if(c){let L=a.lineIndex.get(x.id);L!==void 0&&(I=A(a.lineY[L],N,f))}for(let L of x.tokens){let V=r.tokens.get(L.id);if(!V)continue;let rt=V.x,st=z,q=J(L.color);if(c&&!M)if(c.addedIds.has(L.id))st=u;else{let at=a.tokens.get(L.id);at&&(rt=A(at.x,V.x,f)),c.fromColorById.has(L.id)&&(q=Gt(J(c.fromColorById.get(L.id)),q,f))}b(L.content,rt,I,q,st*(l.get(L.id)?.opacity??1))}}if(c&&d<1)for(let m=0;m<c.from.length;m++){let x=c.from[m],C=a.lineIndex.get(x.id);if(C===void 0)continue;let N=r.lineIndex.get(x.id),M=N===void 0?a.lineY[C]:A(a.lineY[C],r.lineY[N],f);for(let I of x.tokens){if(!c.removedIds.has(I.id))continue;let z=a.tokens.get(I.id);z&&b(I.content,z.x,M,J(I.color),1-d)}}o.showLineNumbers&&Kt(t,v,f,u,d)}function Kt(n,t,i,o,s){let{tokenLines:a,from:r,to:c,edit:l,tokenStates:h,highlightActive:d}=n,f=a.length,u=l?l.from.length:f;for(let g=0;g<Math.max(u,f);g++){let k=g<u,S=g<f,p=S?a[g]:l?.from[g],v=p?Pt(p,h,d):1;l?k&&S?t(String(g+1),A(r.lineY[g],c.lineY[g],i),v):S?t(String(g+1),c.lineY[g],o*v):t(String(g+1),r.lineY[g],(1-s)*v):t(String(g+1),c.lineY[g],v)}}function B(n){return n.content.trim().length}function gt(n){let t=0;for(let i of n.tokens)t+=B(i);return t}function Wt(n,t){let i=gt(n),o=gt(t);if(i===0&&o===0)return 1;if(i===0||o===0)return 0;let s=new Map;for(let r of n.tokens)B(r)!==0&&s.set(r.content,(s.get(r.content)??0)+1);let a=0;for(let r of t.tokens){let c=B(r);if(c===0)continue;let l=s.get(r.content)??0;l>0&&(s.set(r.content,l-1),a+=c)}return 2*a/(i+o)}function pt(n,t,i){let o=t+1,s=new Float64Array((n+1)*o),a=new Float64Array(n*t);for(let h=1;h<=n;h++)for(let d=1;d<=t;d++){let f=i(h-1,d-1);a[(h-1)*t+(d-1)]=f;let u=s[(h-1)*o+d],g=s[h*o+(d-1)],k=u>g?u:g;if(f>0){let S=s[(h-1)*o+(d-1)]+f;S>k&&(k=S)}s[h*o+d]=k}let r=[],c=n,l=t;for(;c>0&&l>0;){let h=a[(c-1)*t+(l-1)];h>0&&s[c*o+l]===s[(c-1)*o+(l-1)]+h?(r.push([c-1,l-1]),c--,l--):s[(c-1)*o+l]>=s[c*o+(l-1)]?c--:l--}return r.reverse(),r}function Bt(n,t){return pt(n.length,t.length,(i,o)=>n[i].content!==t[o].content?0:B(t[o])||.25)}function Z(n,t){let i=new Set,o=new Set,s=new Set,a=new Map,r=pt(n.length,t.length,(h,d)=>Wt(n[h],t[d])-.45),c=new Set,l=new Set;for(let[h,d]of r){l.add(h),c.add(d);let f=n[h],u=t[d];u.id=f.id;let g=Bt(f.tokens,u.tokens),k=new Set,S=new Set;for(let[p,v]of g){k.add(p),S.add(v);let b=f.tokens[p],m=u.tokens[v];m.id=b.id,b.color!==m.color&&a.set(b.id,b.color)}for(let p=0;p<f.tokens.length;p++)k.has(p)||i.add(f.tokens[p].id);for(let p=0;p<u.tokens.length;p++)S.has(p)||o.add(u.tokens[p].id)}for(let h=0;h<n.length;h++)if(!l.has(h))for(let d of n[h].tokens)i.add(d.id);for(let h=0;h<t.length;h++)if(!c.has(h)){s.add(t[h].id);for(let d of t[h].tokens)o.add(d.id)}return{lines:t,removedIds:i,addedIds:o,newLineIds:s,fromColorById:a}}var T={name:"motion-canvas-default",defaultColor:"#d8dee9",rules:[{tag:e.keyword,color:"#5e81ac"},{tag:[e.name,e.deleted,e.character,e.propertyName,e.macroName],color:"#88c0d0"},{tag:[e.variableName],color:"#8fbcbb"},{tag:[e.function(e.variableName)],color:"#8fbcbb"},{tag:[e.labelName],color:"#81a1c1"},{tag:[e.color,e.constant(e.name),e.standard(e.name)],color:"#5e81ac"},{tag:[e.definition(e.name),e.separator],color:"#a3be8c"},{tag:[e.brace],color:"#8fbcbb"},{tag:[e.annotation],color:"#d30102"},{tag:[e.number,e.changed,e.annotation,e.modifier,e.self,e.namespace],color:"#b48ead"},{tag:[e.typeName,e.className],color:"#ECEFF4"},{tag:[e.operator,e.operatorKeyword],color:"#a3be8c"},{tag:[e.tagName],color:"#b48ead"},{tag:[e.squareBracket],color:"#ECEFF4"},{tag:[e.angleBracket],color:"#ECEFF4"},{tag:[e.attributeName],color:"#eceff4"},{tag:[e.regexp],color:"#5e81ac"},{tag:[e.quote],color:"#b48ead"},{tag:[e.string],color:"#a3be8c"},{tag:e.link,color:"#a3be8c"},{tag:[e.url,e.escape,e.special(e.string)],color:"#8fbcbb"},{tag:[e.meta],color:"#88c0d0"},{tag:[e.monospace],color:"#d8dee9"},{tag:[e.comment],color:"#4c566a"},{tag:e.strong,color:"#5e81ac"},{tag:e.emphasis,color:"#5e81ac"},{tag:e.heading,color:"#5e81ac"},{tag:e.special(e.heading1),color:"#5e81ac"},{tag:e.heading1,color:"#5e81ac"},{tag:[e.heading2,e.heading3,e.heading4],color:"#5e81ac"},{tag:[e.heading5,e.heading6],color:"#5e81ac"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#d08770"},{tag:[e.processingInstruction,e.inserted],color:"#8fbcbb"},{tag:[e.contentSeparator],color:"#ebcb8b"},{tag:e.invalid,color:"#434c5e"}]},yt={name:"github-dark",defaultColor:"#c9d1d9",rules:[{tag:[e.standard(e.tagName),e.tagName],color:"#7ee787"},{tag:[e.comment,e.bracket],color:"#8b949e"},{tag:[e.className,e.propertyName],color:"#d2a8ff"},{tag:[e.variableName,e.attributeName,e.number,e.operator],color:"#79c0ff"},{tag:[e.keyword,e.typeName,e.typeOperator],color:"#ff7b72"},{tag:[e.string,e.meta,e.regexp],color:"#a5d6ff"},{tag:[e.name,e.quote],color:"#7ee787"},{tag:[e.heading,e.strong],color:"#d2a8ff"},{tag:[e.emphasis],color:"#d2a8ff"},{tag:[e.deleted],color:"#ffdcd7"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#ffab70"},{tag:e.invalid,color:"#f97583"}]},kt={name:"github-light",defaultColor:"#24292e",rules:[{tag:[e.standard(e.tagName),e.tagName],color:"#116329"},{tag:[e.comment,e.bracket],color:"#6a737d"},{tag:[e.className,e.propertyName],color:"#6f42c1"},{tag:[e.variableName,e.attributeName,e.number,e.operator],color:"#005cc5"},{tag:[e.keyword,e.typeName,e.typeOperator],color:"#d73a49"},{tag:[e.string,e.meta,e.regexp],color:"#032f62"},{tag:[e.name,e.quote],color:"#22863a"},{tag:[e.heading,e.strong],color:"#24292e"},{tag:[e.emphasis],color:"#24292e"},{tag:[e.deleted],color:"#b31d28"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#e36209"},{tag:[e.url,e.escape,e.regexp,e.link],color:"#032f62"},{tag:e.invalid,color:"#cb2431"}]},bt={name:"vscode-dark",defaultColor:"#9cdcfe",rules:[{tag:[e.keyword,e.operatorKeyword,e.modifier,e.color,e.constant(e.name),e.standard(e.name),e.standard(e.tagName),e.special(e.brace),e.atom,e.bool,e.special(e.variableName)],color:"#569cd6"},{tag:[e.controlKeyword,e.moduleKeyword],color:"#c586c0"},{tag:[e.name,e.deleted,e.character,e.macroName,e.propertyName,e.variableName,e.labelName,e.definition(e.name)],color:"#9cdcfe"},{tag:e.heading,color:"#9cdcfe"},{tag:[e.typeName,e.className,e.tagName,e.changed,e.annotation,e.self,e.namespace],color:"#4ec9b0"},{tag:[e.function(e.variableName),e.function(e.propertyName)],color:"#dcdcaa"},{tag:[e.number],color:"#b5cea8"},{tag:[e.operator,e.punctuation,e.separator,e.url,e.escape],color:"#d4d4d4"},{tag:[e.regexp],color:"#d16969"},{tag:[e.special(e.string),e.processingInstruction,e.string,e.inserted],color:"#ce9178"},{tag:[e.angleBracket],color:"#808080"},{tag:[e.meta,e.comment],color:"#6a9955"},{tag:e.link,color:"#6a9955"},{tag:e.invalid,color:"#ff0000"}]},St={name:"vscode-light",defaultColor:"#383a42",rules:[{tag:[e.keyword,e.operatorKeyword,e.modifier,e.color,e.constant(e.name),e.standard(e.name),e.standard(e.tagName),e.special(e.brace),e.atom,e.bool,e.special(e.variableName)],color:"#0000ff"},{tag:[e.moduleKeyword,e.controlKeyword],color:"#af00db"},{tag:[e.name,e.deleted,e.character,e.macroName,e.propertyName,e.variableName,e.labelName,e.definition(e.name)],color:"#0070c1"},{tag:e.heading,color:"#0070c1"},{tag:[e.typeName,e.className,e.tagName,e.changed,e.annotation,e.self,e.namespace],color:"#267f99"},{tag:[e.function(e.variableName),e.function(e.propertyName)],color:"#795e26"},{tag:[e.number],color:"#098658"},{tag:[e.operator,e.punctuation,e.separator,e.url,e.escape],color:"#383a42"},{tag:[e.regexp],color:"#af00db"},{tag:[e.special(e.string),e.processingInstruction,e.string,e.inserted],color:"#a31515"},{tag:[e.angleBracket],color:"#383a42"},{tag:[e.meta,e.comment],color:"#008000"},{tag:e.link,color:"#4078f2"},{tag:e.invalid,color:"#e45649"}]},tt={"motion-canvas-default":T,"github-dark":yt,"github-light":kt,"vscode-dark":bt,"vscode-light":St},mt=new Map;function et(n){let t=mt.get(n.name);if(t)return t;let i=ct(n.rules.map(o=>({tag:o.tag,class:o.color})));return mt.set(n.name,i),i}var Yt={typescript:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"ts"}),tsx:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"ts jsx"}),javascript:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser,jsx:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"jsx"}),python:async()=>(await import("./chunks/dist-W5ZXIMV7.js")).parser,json:async()=>(await import("./chunks/dist-3F5TQHM6.js")).parser,html:async()=>(await import("./chunks/dist-OXJDTPQ6.js")).parser,css:async()=>(await import("./chunks/dist-N4CNBNHL.js")).parser,rust:async()=>(await import("./chunks/dist-GPNEVCJI.js")).parser,go:async()=>(await import("./chunks/dist-FQDUBZKU.js")).parser,java:async()=>(await import("./chunks/dist-AQRNACF3.js")).parser,cpp:async()=>(await import("./chunks/dist-3SIR23P4.js")).parser,php:async()=>(await import("./chunks/dist-LRSXSDHT.js")).parser,markdown:async()=>(await import("./chunks/dist-FH6BHJ6A.js")).parser,xml:async()=>(await import("./chunks/dist-SH7H4MRK.js")).parser,yaml:async()=>(await import("./chunks/dist-UG3NTKWL.js")).parser},$t={ts:"typescript",js:"javascript",py:"python","c++":"cpp",md:"markdown",yml:"yaml",shell:"javascript"};function Y(n){let t=n.toLowerCase();return $t[t]??t}var D=new Map,nt=new Map,ot=[T.name],wt=["typescript","javascript","json","python"],xt=new Map(Object.entries(tt));function Ut(n){xt.set(n.name,n)}function vt(n){return typeof n!="string"?n:xt.get(n)??T}function Vt(n){return D.has(Y(n))}function E(n=ot,t=wt){let i=[];for(let o of t){let s=Y(o);if(D.has(s))continue;let a=Yt[s];if(!a)continue;let r=nt.get(s);r||(r=a().then(c=>(D.set(s,c),c)).catch(()=>null).finally(()=>nt.delete(s)),nt.set(s,r)),i.push(r)}return i.length===0?Promise.resolve():Promise.all(i).then(()=>{})}async function qt(n,t){await E(ot,[n])}async function Xt(n=ot,t=wt){await E(n,t)}function H(n,t){return Vt(n)}function Ct(n,t){return`${n}:${t}`}function Jt(n,t,i){let o=D.get(Y(t));if(!o)return null;let s=o.parse(n),a=et(i),r=new Map;return lt(s,a,(c,l,h)=>{let d=h;if(!d)return;let f=s.cursorAt(c,1);do r.set(Ct(f.from,f.to),d);while(f.next()&&f.to<=l)}),{tree:s,code:n,colorLookup:r}}function Qt(n,t){let i=t.tree.resolveInner(n,1),o=t.colorLookup.get(Ct(i.from,i.to));return o?{color:o,skipAhead:i.to-n}:{color:null,skipAhead:i.firstChild?0:i.to-n}}function Zt(n,t){let i=D.get(Y(t));if(!i)return[n];let s=i.parse(n).cursor(),a=[],r=0;do s.node.firstChild||(s.from>r&&a.push(n.slice(r,s.from)),s.from<s.to&&a.push(n.slice(s.from,s.to)),r=s.to);while(s.next());return r<n.length&&a.push(n.slice(r)),a}function Lt(n,t,i=T){let o=vt(i),s=Jt(n,t,o),a=[[]],r=()=>a.push([]);if(!s)return n.split(`
2
- `).map(l=>[{content:l,color:o.defaultColor}]);let c=0;for(let l of Zt(n,t)){let h=0;for(;h<l.length;){let{color:d,skipAhead:f}=Qt(c+h,s),u=h+Math.max(f,1);u>l.length&&(u=l.length);let g=l.indexOf(`
3
- `,h);g!==-1&&g<u&&(u=g);let k=l.slice(h,u);k.length>0&&a[a.length-1].push({content:k,color:d??o.defaultColor}),g===u&&(r(),u+=1),h=u}c+=l.length}return a}var te=1,ee=1;function Nt(n,t){return{id:te++,content:n,color:t}}function It(n){return{id:ee++,tokens:n}}function $(n,t,i){return H(t,i)?Lt(n,t,i).map(o=>It(o.map(s=>Nt(s.content,s.color)))):n.split(`
4
- `).map(o=>It([Nt(o,"#d1d5db")]))}var j=class{cache=new Map;sig="";signature(t,i){return`${t}|${i}`}sync(t){t!==this.sig&&(this.cache.clear(),this.sig=t)}advance(t,i,o,s,a){if(i.length===0)return 0;let r=`${i}\0${a}`,c=this.cache.get(r);if(c!==void 0)return c;let{width:l}=t.measureText(i,o,s,void 0,a);return this.cache.set(r,l),l}};function _t(n,t,i){return{startLine:n,startCol:t,endLine:n,endCol:i===void 0?1/0:t+i}}function Tt(n,t){return{startLine:n,startCol:1,endLine:t??n,endCol:1/0}}var U=class n{list;constructor(t=[]){this.list=t}lines(t,i){return new n([...this.list,Tt(t,i)])}word(t,i,o){return new n([...this.list,_t(t,i,o)])}*[Symbol.iterator](){yield*this.list}},ne=new U;function R(n,t){if(t.length===0)return{start:0,end:0};let i=new Array(t.length),o=0;for(let p=0;p<t.length;p++)i[p]=o,o+=t[p]+1;let s=o>0?o-1:0,a=p=>Math.max(0,Math.min(t.length-1,p-1)),r=n.endLine??1/0,c=n.endCol??1/0,l=a(n.startLine),h=a(r),d=t[l],f=t[h],u=Math.max(0,Math.min(d,n.startCol-1)),g=c===1/0?f:Math.max(0,Math.min(f,c-1)),k=Math.min(s,i[l]+u),S=Math.min(s,i[h]+g);return{start:Math.min(k,S),end:Math.max(k,S)}}function it(n,t,i){let o=0,s=1,a=1,r=1,c=1,l=!1;for(let h=0;h<i.length;h++){let d=o,f=o+i[h];if(!l&&n>=d&&n<=f&&(s=h+1,a=n-d+1,l=!0),t>=d&&t<=f){r=h+1,c=t-d+1;break}o=f+1}return{startLine:s,startCol:a,endLine:r,endCol:c}}var w=function(n,t,i,o){var s=arguments.length,a=s<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,i):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,t,i,o);else for(var c=n.length-1;c>=0;c--)(r=n[c])&&(a=(s<3?r(a):s>3?r(t,i,a):r(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a},y=class extends re{tokenLines=[];tokenized=!1;_linesSource="";transitions=[];advanceCache=new j;structureVersion=0;layoutCacheKey=null;layoutCache=null;highlightDimOpacity=null;highlightedIds=new Set;diffStrategy;phaseStrategy;constructor(t){super(t),this.diffStrategy=t.diffStrategy??Z,this.phaseStrategy=t.phaseStrategy??ht,this.applyProp("width",t.width??"hug"),this.applyProp("height",t.height??"hug"),this.applyProp("_driven",!1),E(void 0,[this.language]).catch(()=>{}),this.tokenize()}set(t){super.set(t),(t.code!==void 0||t.language!==void 0||t.theme!==void 0)&&(this.tokenized=!1)}tokenize(){this.setLines(this._structureFor(this.code),this.code),this.tokenized=H(this.language,this.theme)}setLines(t,i){this.tokenLines!==t&&(this.tokenLines=t,this._linesSource=i,this.structureVersion++,this.layoutCache=null,this.layoutCacheKey=null)}declareAssets(t){super.declareAssets(t),t.font(this.fontFamily),t.loader(`shiki:lang:${this.language}`,le(this.language),{gate:"layout"})}metrics(){return{fontSize:this.fontSize,fontFamily:this.fontFamily,lineHeight:this.lineHeight,letterSpacing:this.letterSpacing,padding:this.padding,showLineNumbers:this.showLineNumbers,lineNumberGap:this.lineNumberGap}}activeEdit(){for(let t=this.transitions.length-1;t>=0;t--){let i=this.transitions[t];if(i.kind==="structural")return i}return null}settledLayout(t,i){let o=`${this.structureVersion}|${K(t)}|${this.advanceCache.signature(t.fontSize,t.fontFamily)}`;if(this.layoutCache&&this.layoutCacheKey===o)return this.layoutCache;let s=W(this.tokenLines,t,this.advanceCache,i);return this.layoutCache=s,this.layoutCacheKey=o,s}frameLayout(t){let i=this.metrics(),o=this.activeEdit();if(!o){let a=this.settledLayout(i,t);return{from:a,to:a,edit:null}}let s=`${K(i)}|${this.advanceCache.signature(i.fontSize,i.fontFamily)}`;return(o.layoutKey!==s||!o.fromLayout||!o.toLayout)&&(o.fromLayout=W(o.from,i,this.advanceCache,t),o.toLayout=W(o.to,i,this.advanceCache,t),o.layoutKey=s),{from:o.fromLayout,to:o.toLayout,edit:o}}measure(t,i){this._sync(),this.advanceCache.sync(this.advanceCache.signature(this.fontSize,this.fontFamily));let o=this.width,s=this.height,{from:a,to:r,edit:c}=this.frameLayout(i),l=P(c),h=c?Ht(a.innerW,r.innerW,l):r.innerW,d=c?Ht(a.innerH,r.innerH,l):r.innerH,f=typeof o=="number"?o:o==="hug"?h+this.padding.left+this.padding.right:t.maxWidth??0,u=typeof s=="number"?s:s==="hug"?d+this.padding.top+this.padding.bottom:t.maxHeight??0;return{width:f,height:u}}renderContent(t){t.pushTextStyle(null);try{this._sync(),!this.tokenized&&!this.activeEdit()&&H(this.language,this.theme)&&this.tokenize(),super.renderContent(t)}finally{t.popTextStyle()}}renderSelf(t){this.drawSelf(t)}acceptsChild(t){return!1}clipSelf(){return new ie().rect({width:this.layoutBounds.width,height:this.layoutBounds.height})}hitTestSelf(t,i){this._sync();let o=this.hitLayout();if(!o)return super.hitTestSelf(t,i);if(!super.hitTestSelf(t,i))return!1;let s=this.fontSize*this.lineHeight/2,a=this.showLineNumbers?o.gutter:0,r=o.startX-a-i;for(let c=0;c<o.lineY.length;c++)if(!((o.lineW[c]??0)+a<=0)&&!(Math.abs(t.y-o.lineY[c])>s+i)&&t.x>=r&&t.x<=o.startX+(o.lineW[c]??0)+i)return!0;return!1}hitLayout(){if(!this.layoutCache||this.activeEdit())return null;let t=this.metrics(),i=`${this.structureVersion}|${K(t)}|${this.advanceCache.signature(t.fontSize,t.fontFamily)}`;return this.layoutCacheKey===i?this.layoutCache:null}append(t){this._sync();let{code:i}=t.data;return this.editTo(this.joinedSource()+i,t.duration,t.easing)}prepend(t){this._sync();let{code:i}=t.data;return this.editTo(i+this.joinedSource(),t.duration,t.easing)}insert(t){this._sync();let{position:i,code:o}=t.data,s=this.joinedSource(),a=this.offsetAt(i);return this.editTo(s.slice(0,a)+o+s.slice(a),t.duration,t.easing)}erase(t){this._sync();let{target:i}=t.data,{duration:o,easing:s}=t,a=this.joinedSource(),{start:r,end:c}=R(i,this.lineLengths()),l=r===0||a[r-1]===`
5
- `,h=c===a.length||a[c]===`
6
- `;if(l&&h)c<a.length?c+=1:r>0&&(r-=1);else if(c<=r)return F(o,()=>{});return c<=r?F(o,()=>{}):this.editTo(a.slice(0,r)+a.slice(c),o,s)}replace(t){this._sync();let{target:i,replacement:o}=t.data,s=this.joinedSource(),{start:a,end:r}=R(i,this.lineLengths());return this.editTo(s.slice(0,a)+o+s.slice(r),t.duration,t.easing)}highlight(t){this._sync();let{target:i,dim:o}=t.data,{duration:s,easing:a}=t,r=o??.4,c=this.tokenIdsInRanges(ce(i));if(c.size===0)return F(s,()=>{});let l=this.highlightDimOpacity??1,h=this.highlightedIds.size>0,d=this.highlightedIds,f=[];for(let u of this.tokenLines)for(let g of u.tokens){let k=!h||d.has(g.id),S=c.has(g.id),p=k?1:l,v=S?1:r;p!==v&&f.push(X(g.id,{keys:[0,1],values:[p,v]}))}return this.runDim(f,s,a,u=>{this.highlightDimOpacity=u?r:h?l:null,this.highlightedIds=u?c:d})}resetHighlight(t){this._sync();let{duration:i,easing:o}=t;if(this.highlightDimOpacity===null)return F(i,()=>{});let s=this.highlightDimOpacity,a=this.highlightedIds,r=[];for(let c of this.tokenLines)for(let l of c.tokens){let h=a.has(l.id)?1:s;h!==1&&r.push(X(l.id,{keys:[0,1],values:[h,1]}))}return this.runDim(r,i,o,c=>{this.highlightDimOpacity=c?null:s,this.highlightedIds=c?new Set:a})}editTo(t,i,o){let s=this.tokenLines,a=this.joinedSource();if(t===a)return F(i,()=>{});let r=this.diffStrategy(s,$(t,this.language,this.theme)),c={kind:"structural",from:s,to:r.lines,removedIds:r.removedIds,addedIds:r.addedIds,enteringLineIds:r.newLineIds,fromColorById:r.fromColorById,phases:this.phaseStrategy(r.removedIds.size>0,r.addedIds.size>0),progress:0,layoutKey:null,fromLayout:null,toLayout:null};return this.tokenized=H(this.language,this.theme),F(i,l=>{this._drive();let h=l>0&&l<1,d=this.transitions.indexOf(c);h&&d<0?this.transitions.push(c):!h&&d>=0&&this.transitions.splice(d,1),c.progress=o?o(l):l,l<=0?(this.setLines(s,a),this._writeProp("code",a)):(this.setLines(r.lines,t),this._writeProp("code",t))})}runDim(t,i,o,s){let a={kind:"dim",tokens:t,progress:0};return F(i,r=>{this._drive();let c=r>0&&r<1,l=this.transitions.indexOf(a);c&&l<0?this.transitions.push(a):!c&&l>=0&&this.transitions.splice(l,1),a.progress=o?o(r):r,s?.(r>=1)})}_prepareStep(t,i,o){this._sync();let s=t.code;if(typeof s!="string"||s===this.joinedSource())return super._prepareStep(t,i,o);let a={...t};delete a.code;let r=super._prepareStep(a,i,o),c=this.editTo(s,i,o)._stepper();return{seek:l=>{r.seek(l),c.seek(l)},advance:l=>{let h=r.advance(l),d=c.advance(l);return h&&d}}}findAllRanges(t){let i=[];if(!t)return i;this._sync();let o=this.joinedSource(),s=this.lineLengths(),a=0;for(;;){let r=o.indexOf(t,a);if(r===-1)break;i.push(it(r,r+t.length,s)),a=r+Math.max(1,t.length)}return i}findRangeAt(t,i){return this.findAllRanges(t)[i]??null}findFirstRange(t){return this.findRangeAt(t,0)}joinedSource(){return this._linesSource}lineLengths(){return this.tokenLines.map(t=>t.tokens.reduce((i,o)=>i+o.content.length,0))}offsetAt(t){let i=this.lineLengths();if(i.length===0)return 0;let[o,s]=t,a=Math.max(0,Math.min(i.length-1,o-1)),r=0;for(let c=0;c<a;c++)r+=i[c]+1;return r+Math.max(0,Math.min(i[a],s-1))}tokenIdsInRanges(t){let i=new Set,o=this.lineLengths();if(o.length===0)return i;let s=t.map(r=>R(r,o)).filter(({start:r,end:c})=>c>r);if(s.length===0)return i;let a=0;for(let r=0;r<this.tokenLines.length;r++){let c=this.tokenLines[r];for(let l of c.tokens){let h=a,d=a+l.content.length;s.some(({start:f,end:u})=>d>f&&h<u)&&i.add(l.id),a=d}r<this.tokenLines.length-1&&(a+=1)}return i}drawSelf(t){this.advanceCache.sync(this.advanceCache.signature(this.fontSize,this.fontFamily)),Q(t,{tokenLines:this.tokenLines,metrics:this.metrics(),advanceCache:this.advanceCache,...this.frameLayout(t),tokenStates:dt(this.tokenLines,this.transitions,this.highlightDimOpacity,this.highlightedIds),highlightActive:this.highlightDimOpacity!==null||this.transitions.some(i=>i.kind==="dim")})}_derived=new Map;_drive(){this._sync(),this._writeProp("_driven",!0)}_sync(){this._driven?this._linesSource!==this.code&&!this.activeEdit()&&this.setLines(this._structureFor(this.code),this.code):(this.transitions.length=0,this.highlightDimOpacity=null,this.highlightedIds.size>0&&(this.highlightedIds=new Set),this.setLines(this._structureFor(this.code),this.code))}_structureFor(t){let i=H(this.language,this.theme),o=this._derived.get(t);return(!o||o.language!==this.language||o.theme!==this.theme||o.highlighted!==i)&&(o={language:this.language,theme:this.theme,highlighted:i,lines:$(t,this.language,this.theme)},this._derived.delete(t),this._derived.set(t,o),this._derived.size>ae&&this._derived.delete(this._derived.keys().next().value)),o.lines}};w([_({default:""})],y.prototype,"code",void 0);w([_({default:"typescript"})],y.prototype,"language",void 0);w([_({default:"Fira Mono"})],y.prototype,"fontFamily",void 0);w([_({default:T.name})],y.prototype,"theme",void 0);w([_({default:16})],y.prototype,"fontSize",void 0);w([_({default:1.6})],y.prototype,"lineHeight",void 0);w([_({default:1.1})],y.prototype,"letterSpacing",void 0);w([_({default:!1})],y.prototype,"showLineNumbers",void 0);w([_({default:2})],y.prototype,"lineNumberGap",void 0);w([se()],y.prototype,"padding",void 0);w([O({args:[{key:"code",kind:"text",multiline:!0}]})],y.prototype,"append",null);w([O({args:[{key:"code",kind:"text",multiline:!0}]})],y.prototype,"prepend",null);w([O({args:[{key:"position",kind:"point",properties:{line:{kind:"number",default:1,min:1,step:1},col:{kind:"number",default:1,min:1,step:1}}},{key:"code",kind:"text",default:"",multiline:!0}]})],y.prototype,"insert",null);w([O({key:"remove",args:[{key:"target",kind:"selector"}]})],y.prototype,"erase",null);w([O({args:[{key:"target",kind:"selector"},{key:"replacement",kind:"text",default:"",multiline:!0}]})],y.prototype,"replace",null);w([O({args:[{key:"target",kind:"selector"},{key:"dim",kind:"number",default:.4,min:0,max:1,step:.01,scale:100,unit:"%"}]})],y.prototype,"highlight",null);w([O()],y.prototype,"resetHighlight",null);y=w([oe({key:"code",parentKey:"node",forkable:!0,layout:{defaultWidthMode:"hug",defaultHeightMode:"hug",acceptsChildren:!1}})],y);var ae=16;function ce(n){return typeof n[Symbol.iterator]=="function"?[...n]:[n]}var Mt=new Map;function le(n){let t=Mt.get(n);return t===void 0&&(t=()=>E(void 0,[n]),Mt.set(n,t)),t}var he=[y];export{tt as BUILTIN_THEMES,y as Code,U as CodeRangeChain,ne as CodeRanges,T as DefaultHighlightStyle,yt as GithubDarkStyle,kt as GithubLightStyle,he as NODES,j as TokenAdvanceCache,bt as VscodeDarkStyle,St as VscodeLightStyle,H as canHighlight,it as charOffsetsToRange,et as compileStyle,Z as defaultCodeDiff,ht as defaultCodePhases,Q as drawCode,E as ensureHighlighter,Xt as initSyntaxHighlighter,W as layoutCode,Tt as lines,qt as loadCodeLanguage,X as makeAnim,K as metricsSignature,P as moveProgress,At as phasesFor,R as rangeToCharOffsets,Ut as registerCodeTheme,vt as resolveTheme,dt as resolveTokenStates,Ft as sampleCurve,Ot as smoothstep,$ as tokenizeCodeToIdLines,G as windowProgress,_t as word};
1
+ import{j as ft,k as gt,l as e}from"./chunks/chunk-SYZUZB3M.js";import{node as me,Clip as ye,Node2D as ke,property as O,insetsProperty as we,lerpNumber as Bt,colorOps as be,command as E,driveCommand as _}from"@motionscript/sdk";function Wt(o,t,n){if(n<=o[0])return t[0];if(n>=o[o.length-1])return t[t.length-1];for(let i=0;i<o.length-1;i++)if(n<=o[i+1]){let s=o[i+1]-o[i],r=s===0?0:(n-o[i])/s;return t[i]+(t[i+1]-t[i])*r}return t[t.length-1]}function G(o,t){if(!o)return 1;let[n,i]=o;return t<=n?0:t>=i||i===n?1:(t-n)/(i-n)}function Pt(o){return o*o*(3-2*o)}function Z(o,t){return{id:o,opacity:t.values,opacityKeys:t.keys}}function Yt(o,t){return o&&t?{out:[0,.38],move:[.1,.68],in:[.52,1]}:o?{out:[0,.45],move:[.22,1],in:null}:t?{out:null,move:[0,.55],in:[.38,1]}:{out:null,move:[0,1],in:null}}var pt=Yt;function $(o){return o?Pt(G(o.phases.move,o.progress)):1}function mt(o,t,n,i){let s=new Map;if(n!==null){let r=n;for(let a of o)for(let l of a.tokens)s.set(l.id,{opacity:i.has(l.id)?1:r})}for(let r of t)if(r.kind==="dim")for(let a of r.tokens)s.set(a.id,{opacity:Wt(a.opacityKeys,a.opacity,r.progress)});return s}function W(o){let t=o.padding;return[o.fontSize,o.fontFamily,o.lineHeight,o.letterSpacing,t.left,t.right,t.top,t.bottom,o.showLineNumbers?1:0,o.lineNumberGap].join("|")}function Kt(o,t,n){return n.advance(o," ",t.fontSize,t.fontFamily,0)*t.lineNumberGap}function Ut(o,t,n,i,s){if(!t.showLineNumbers)return 0;let r=String(Math.max(1,i));return n.advance(o,r,t.fontSize,t.fontFamily,0)+s}function P(o,t,n,i){let s=t.fontSize*t.lineHeight,r=t.showLineNumbers?Kt(i,t,n):0,a=Ut(i,t,n,o.length,r),l=new Array(o.length),c=0;for(let S=0;S<o.length;S++){let k=0;for(let L of o[S].tokens)k+=n.advance(i,L.content,t.fontSize,t.fontFamily,t.letterSpacing);l[S]=k,k>c&&(c=k)}let h=c+a,u=o.length*s,d=h+t.padding.left+t.padding.right,f=u+t.padding.top+t.padding.bottom,m=-d/2+t.padding.left+a,g=f/2-t.padding.top,p=new Map,y=new Array(o.length),w=new Map;for(let S=0;S<o.length;S++){let k=g-S*s-s/2;y[S]=k,w.set(o[S].id,S);let L=m;for(let C of o[S].tokens)p.set(C.id,{x:L,y:k}),L+=n.advance(i,C.content,t.fontSize,t.fontFamily,t.letterSpacing)}return{tokens:p,lineY:y,lineW:l,lineIndex:w,gutter:a,gutterGap:r,innerW:h,innerH:u,blockW:d,blockH:f,startX:m}}import{Graphics2D as nt,parseColor as Vt,lerpNumber as I}from"@motionscript/sdk";var qt=[.82,.84,.86,1],Xt=[.45,.5,.55,1],yt=new Map;function tt(o){if(!o)return qt;let t=yt.get(o);return t||(t=Vt(o),yt.set(o,t)),t}function kt(o,t,n){return n<=0?o:n>=1?t:[o[0]+(t[0]-o[0])*n,o[1]+(t[1]-o[1])*n,o[2]+(t[2]-o[2])*n,o[3]+(t[3]-o[3])*n]}function Jt(o,t,n){if(!n)return 1;let i=1;for(let s of o.tokens){if(s.content.length===0)continue;let r=t.get(s.id)?.opacity??1;r<i&&(i=r)}return i}function ot(o,t){let{tokenLines:n,metrics:i,advanceCache:s,from:r,to:a,edit:l,tokenStates:c}=t,h=l?l.progress:1,u=l?G(l.phases.out,h):1,d=$(l),f=l?G(l.phases.in,h):1,m=l?I(r.blockW,a.blockW,d):a.blockW,g=l?I(r.gutter,a.gutter,d):a.gutter,p=a.gutterGap||r.gutterGap,y=-m/2+i.padding.left+g-p;Qt(o,t,Math.max(m,t.boxW??0),d);let w=(k,L,C)=>{if(C<=0)return;let N=s.advance(o,k,i.fontSize,i.fontFamily,0);o.draw(new nt().text({text:k,fontSize:i.fontSize,fontFamily:i.fontFamily,lineHeight:i.lineHeight,x:y-N/2,y:L,textAlign:"left"}).fill([{type:"solid",color:Xt,opacity:C}]))},S=(k,L,C,N,H)=>{if(H<=0||k.length===0)return;let T=s.advance(o,k,i.fontSize,i.fontFamily,i.letterSpacing);o.draw(new nt().text({text:k,fontSize:i.fontSize,fontFamily:i.fontFamily,lineHeight:i.lineHeight,letterSpacing:i.letterSpacing,x:L+T/2,y:C,textAlign:"left"}).fill([{type:"solid",color:N,opacity:H}]))};for(let k=0;k<n.length;k++){let L=n[k],C=a.lineIndex.get(L.id);if(C===void 0)continue;let N=a.lineY[C],H=l?.enteringLineIds.has(L.id)??!1,T=N,D=1;if(l&&H)D=f;else if(l){let v=r.lineIndex.get(L.id);v!==void 0&&(T=I(r.lineY[v],N,d))}for(let v of L.tokens){let J=a.tokens.get(v.id);if(!J)continue;let ht=J.x,dt=D,Q=tt(v.color);if(l&&!H)if(l.addedIds.has(v.id))dt=f;else{let ut=r.tokens.get(v.id);ut&&(ht=I(ut.x,J.x,d)),l.fromColorById.has(v.id)&&(Q=kt(tt(l.fromColorById.get(v.id)),Q,d))}S(v.content,ht,T,Q,dt*(c.get(v.id)?.opacity??1))}}if(l&&u<1)for(let k=0;k<l.from.length;k++){let L=l.from[k],C=r.lineIndex.get(L.id);if(C===void 0)continue;let N=a.lineIndex.get(L.id),H=N===void 0?r.lineY[C]:I(r.lineY[C],a.lineY[N],d);for(let T of L.tokens){if(!l.removedIds.has(T.id))continue;let D=r.tokens.get(T.id);D&&S(T.content,D.x,H,tt(T.color),1-u)}}i.showLineNumbers&&Zt(t,w,d,f,u)}function et(o,t,n){let{from:i,to:s,metrics:r}=t,a=r.fontSize*r.lineHeight/2,l=u=>{let d=s.lineIndex.get(u),f=i.lineIndex.get(u);return d!==void 0&&f!==void 0?I(i.lineY[f],s.lineY[d],n):d!==void 0?s.lineY[d]:f===void 0?null:i.lineY[f]},c=l(o.startId),h=l(o.endId);return c===null&&h===null?null:{top:(c??h)+a,bottom:(h??c)-a}}function Qt(o,t,n,i){let{rowBands:s=[],rowsEdit:r=null}=t,a=(c,h,u,d,f)=>{f<=0||c<=h||o.draw(new nt().rect({x:0,y:(c+h)/2,width:n,height:c-h,cornerRadius:d}).fill([{type:"solid",color:u,opacity:f}]))};if(!r){for(let c of s){let h=et(c,t,i);h&&a(h.top,h.bottom,c.color,c.radius,1)}return}let l=r.progress;for(let c=0;c<Math.max(r.from.length,r.to.length);c++){let h=r.from[c],u=r.to[c],d=h?et(h,t,i):null,f=u?et(u,t,i):null;d&&f?a(I(d.top,f.top,l),I(d.bottom,f.bottom,l),kt(h.color,u.color,l),I(h.radius,u.radius,l),1):d?a(d.top,d.bottom,h.color,h.radius,1-l):f&&a(f.top,f.bottom,u.color,u.radius,l)}}function Zt(o,t,n,i,s){let{tokenLines:r,from:a,to:l,edit:c,tokenStates:h,highlightActive:u}=o,d=r.length,f=c?c.from.length:d;for(let m=0;m<Math.max(f,d);m++){let g=m<f,p=m<d,y=p?r[m]:c?.from[m],w=y?Jt(y,h,u):1;c?g&&p?t(String(m+1),I(a.lineY[m],l.lineY[m],n),w):p?t(String(m+1),l.lineY[m],i*w):t(String(m+1),a.lineY[m],(1-s)*w):t(String(m+1),l.lineY[m],w)}}function Y(o){return o.content.trim().length}function wt(o){let t=0;for(let n of o.tokens)t+=Y(n);return t}function te(o,t){let n=wt(o),i=wt(t);if(n===0&&i===0)return 1;if(n===0||i===0)return 0;let s=new Map;for(let a of o.tokens)Y(a)!==0&&s.set(a.content,(s.get(a.content)??0)+1);let r=0;for(let a of t.tokens){let l=Y(a);if(l===0)continue;let c=s.get(a.content)??0;c>0&&(s.set(a.content,c-1),r+=l)}return 2*r/(n+i)}function St(o,t,n){let i=t+1,s=new Float64Array((o+1)*i),r=new Float64Array(o*t);for(let h=1;h<=o;h++)for(let u=1;u<=t;u++){let d=n(h-1,u-1);r[(h-1)*t+(u-1)]=d;let f=s[(h-1)*i+u],m=s[h*i+(u-1)],g=f>m?f:m;if(d>0){let p=s[(h-1)*i+(u-1)]+d;p>g&&(g=p)}s[h*i+u]=g}let a=[],l=o,c=t;for(;l>0&&c>0;){let h=r[(l-1)*t+(c-1)];h>0&&s[l*i+c]===s[(l-1)*i+(c-1)]+h?(a.push([l-1,c-1]),l--,c--):s[(l-1)*i+c]>=s[l*i+(c-1)]?l--:c--}return a.reverse(),a}function ee(o,t){return St(o.length,t.length,(n,i)=>o[n].content!==t[i].content?0:Y(t[i])||.25)}function ne(o,t){if(o.tokens.length!==t.tokens.length)return!1;for(let n=0;n<o.tokens.length;n++)if(o.tokens[n].content!==t.tokens[n].content)return!1;return!0}function bt(o){let t="";for(let n of o.tokens)t+=n.content+"";return t}function oe(o,t){let n=o.map(bt),i=t.map(bt),s=[],r=0;for(;r<o.length&&r<t.length&&n[r]===i[r];)s.push([r,r]),r++;let a=0;for(;a<o.length-r&&a<t.length-r&&n[o.length-1-a]===i[t.length-1-a];)a++;let l=ie(n,i,r,o.length-a,r,t.length-a),c=16e4,h=r,u=r;for(let[d,f]of[...l,[o.length-a,t.length-a]]){let m=d-h,g=f-u,p=m*g;if(p>0&&p<=4e4&&p<=c){c-=p;for(let[y,w]of St(m,g,(S,k)=>te(o[h+S],t[u+k])-.45))s.push([h+y,u+w])}d<o.length-a&&s.push([d,f]),h=d+1,u=f+1}for(let d=a;d>0;d--)s.push([o.length-d,t.length-d]);return s}function ie(o,t,n,i,s,r){let a=new Map,l=new Set;for(let g=n;g<i;g++){let p=o[g];l.has(p)?a.delete(p):a.set(p,g),l.add(p)}let c=new Map,h=new Set;for(let g=s;g<r;g++){let p=t[g];h.has(p)?c.delete(p):c.set(p,g),h.add(p)}let u=[];for(let g=s;g<r;g++){let p=a.get(t[g]);p!==void 0&&c.get(t[g])===g&&t[g].replaceAll("","").trim()!==""&&u.push([p,g])}let d=[],f=new Array(u.length).fill(-1);for(let g=0;g<u.length;g++){let p=0,y=d.length;for(;p<y;){let w=p+y>>1;u[d[w]][0]<u[g][0]?p=w+1:y=w}p>0&&(f[g]=d[p-1]),d[p]=g}let m=[];for(let g=d.length>0?d[d.length-1]:-1;g>=0;g=f[g])m.push(u[g]);return m.reverse()}function it(o,t){let n=new Set,i=new Set,s=new Set,r=new Map,a=oe(o,t),l=new Set,c=new Set;for(let[h,u]of a){c.add(h),l.add(u);let d=o[h],f=t[u];f.id=d.id;let m=ne(d,f)?d.tokens.map((y,w)=>[w,w]):ee(d.tokens,f.tokens),g=new Set,p=new Set;for(let[y,w]of m){g.add(y),p.add(w);let S=d.tokens[y],k=f.tokens[w];k.id=S.id,S.color!==k.color&&r.set(S.id,S.color)}for(let y=0;y<d.tokens.length;y++)g.has(y)||n.add(d.tokens[y].id);for(let y=0;y<f.tokens.length;y++)p.has(y)||i.add(f.tokens[y].id)}for(let h=0;h<o.length;h++)if(!c.has(h))for(let u of o[h].tokens)n.add(u.id);for(let h=0;h<t.length;h++)if(!l.has(h)){s.add(t[h].id);for(let u of t[h].tokens)i.add(u.id)}return{lines:t,removedIds:n,addedIds:i,newLineIds:s,fromColorById:r}}var A={name:"motion-canvas-default",defaultColor:"#d8dee9",rules:[{tag:e.keyword,color:"#5e81ac"},{tag:[e.name,e.deleted,e.character,e.propertyName,e.macroName],color:"#88c0d0"},{tag:[e.variableName],color:"#8fbcbb"},{tag:[e.function(e.variableName)],color:"#8fbcbb"},{tag:[e.labelName],color:"#81a1c1"},{tag:[e.color,e.constant(e.name),e.standard(e.name)],color:"#5e81ac"},{tag:[e.definition(e.name),e.separator],color:"#a3be8c"},{tag:[e.brace],color:"#8fbcbb"},{tag:[e.annotation],color:"#d30102"},{tag:[e.number,e.changed,e.annotation,e.modifier,e.self,e.namespace],color:"#b48ead"},{tag:[e.typeName,e.className],color:"#ECEFF4"},{tag:[e.operator,e.operatorKeyword],color:"#a3be8c"},{tag:[e.tagName],color:"#b48ead"},{tag:[e.squareBracket],color:"#ECEFF4"},{tag:[e.angleBracket],color:"#ECEFF4"},{tag:[e.attributeName],color:"#eceff4"},{tag:[e.regexp],color:"#5e81ac"},{tag:[e.quote],color:"#b48ead"},{tag:[e.string],color:"#a3be8c"},{tag:e.link,color:"#a3be8c"},{tag:[e.url,e.escape,e.special(e.string)],color:"#8fbcbb"},{tag:[e.meta],color:"#88c0d0"},{tag:[e.monospace],color:"#d8dee9"},{tag:[e.comment],color:"#4c566a"},{tag:e.strong,color:"#5e81ac"},{tag:e.emphasis,color:"#5e81ac"},{tag:e.heading,color:"#5e81ac"},{tag:e.special(e.heading1),color:"#5e81ac"},{tag:e.heading1,color:"#5e81ac"},{tag:[e.heading2,e.heading3,e.heading4],color:"#5e81ac"},{tag:[e.heading5,e.heading6],color:"#5e81ac"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#d08770"},{tag:[e.processingInstruction,e.inserted],color:"#8fbcbb"},{tag:[e.contentSeparator],color:"#ebcb8b"},{tag:e.invalid,color:"#434c5e"}]},Lt={name:"github-dark",defaultColor:"#c9d1d9",rules:[{tag:[e.standard(e.tagName),e.tagName],color:"#7ee787"},{tag:[e.comment,e.bracket],color:"#8b949e"},{tag:[e.className,e.propertyName],color:"#d2a8ff"},{tag:[e.variableName,e.attributeName,e.number,e.operator],color:"#79c0ff"},{tag:[e.keyword,e.typeName,e.typeOperator],color:"#ff7b72"},{tag:[e.string,e.meta,e.regexp],color:"#a5d6ff"},{tag:[e.name,e.quote],color:"#7ee787"},{tag:[e.heading,e.strong],color:"#d2a8ff"},{tag:[e.emphasis],color:"#d2a8ff"},{tag:[e.deleted],color:"#ffdcd7"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#ffab70"},{tag:e.invalid,color:"#f97583"}]},Ct={name:"github-light",defaultColor:"#24292e",rules:[{tag:[e.standard(e.tagName),e.tagName],color:"#116329"},{tag:[e.comment,e.bracket],color:"#6a737d"},{tag:[e.className,e.propertyName],color:"#6f42c1"},{tag:[e.variableName,e.attributeName,e.number,e.operator],color:"#005cc5"},{tag:[e.keyword,e.typeName,e.typeOperator],color:"#d73a49"},{tag:[e.string,e.meta,e.regexp],color:"#032f62"},{tag:[e.name,e.quote],color:"#22863a"},{tag:[e.heading,e.strong],color:"#24292e"},{tag:[e.emphasis],color:"#24292e"},{tag:[e.deleted],color:"#b31d28"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#e36209"},{tag:[e.url,e.escape,e.regexp,e.link],color:"#032f62"},{tag:e.invalid,color:"#cb2431"}]},vt={name:"vscode-dark",defaultColor:"#9cdcfe",rules:[{tag:[e.keyword,e.operatorKeyword,e.modifier,e.color,e.constant(e.name),e.standard(e.name),e.standard(e.tagName),e.special(e.brace),e.atom,e.bool,e.special(e.variableName)],color:"#569cd6"},{tag:[e.controlKeyword,e.moduleKeyword],color:"#c586c0"},{tag:[e.name,e.deleted,e.character,e.macroName,e.propertyName,e.variableName,e.labelName,e.definition(e.name)],color:"#9cdcfe"},{tag:e.heading,color:"#9cdcfe"},{tag:[e.typeName,e.className,e.tagName,e.changed,e.annotation,e.self,e.namespace],color:"#4ec9b0"},{tag:[e.function(e.variableName),e.function(e.propertyName)],color:"#dcdcaa"},{tag:[e.number],color:"#b5cea8"},{tag:[e.operator,e.punctuation,e.separator,e.url,e.escape],color:"#d4d4d4"},{tag:[e.regexp],color:"#d16969"},{tag:[e.special(e.string),e.processingInstruction,e.string,e.inserted],color:"#ce9178"},{tag:[e.angleBracket],color:"#808080"},{tag:[e.meta,e.comment],color:"#6a9955"},{tag:e.link,color:"#6a9955"},{tag:e.invalid,color:"#ff0000"}]},_t={name:"vscode-light",defaultColor:"#383a42",rules:[{tag:[e.keyword,e.operatorKeyword,e.modifier,e.color,e.constant(e.name),e.standard(e.name),e.standard(e.tagName),e.special(e.brace),e.atom,e.bool,e.special(e.variableName)],color:"#0000ff"},{tag:[e.moduleKeyword,e.controlKeyword],color:"#af00db"},{tag:[e.name,e.deleted,e.character,e.macroName,e.propertyName,e.variableName,e.labelName,e.definition(e.name)],color:"#0070c1"},{tag:e.heading,color:"#0070c1"},{tag:[e.typeName,e.className,e.tagName,e.changed,e.annotation,e.self,e.namespace],color:"#267f99"},{tag:[e.function(e.variableName),e.function(e.propertyName)],color:"#795e26"},{tag:[e.number],color:"#098658"},{tag:[e.operator,e.punctuation,e.separator,e.url,e.escape],color:"#383a42"},{tag:[e.regexp],color:"#af00db"},{tag:[e.special(e.string),e.processingInstruction,e.string,e.inserted],color:"#a31515"},{tag:[e.angleBracket],color:"#383a42"},{tag:[e.meta,e.comment],color:"#008000"},{tag:e.link,color:"#4078f2"},{tag:e.invalid,color:"#e45649"}]},K={"motion-canvas-default":A,"github-dark":Lt,"github-light":Ct,"vscode-dark":vt,"vscode-light":_t},xt=new WeakMap;function rt(o){let t=xt.get(o);if(t)return t;let n=ft(o.rules.map(i=>({tag:i.tag,class:i.color})));return xt.set(o,n),n}var It={typescript:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"ts"}),tsx:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"ts jsx"}),javascript:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser,jsx:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"jsx"}),python:async()=>(await import("./chunks/dist-W5ZXIMV7.js")).parser,json:async()=>(await import("./chunks/dist-3F5TQHM6.js")).parser,html:async()=>(await import("./chunks/dist-OXJDTPQ6.js")).parser,css:async()=>(await import("./chunks/dist-N4CNBNHL.js")).parser,rust:async()=>(await import("./chunks/dist-GPNEVCJI.js")).parser,go:async()=>(await import("./chunks/dist-FQDUBZKU.js")).parser,java:async()=>(await import("./chunks/dist-AQRNACF3.js")).parser,cpp:async()=>(await import("./chunks/dist-3SIR23P4.js")).parser,php:async()=>(await import("./chunks/dist-LRSXSDHT.js")).parser,markdown:async()=>(await import("./chunks/dist-FH6BHJ6A.js")).parser,xml:async()=>(await import("./chunks/dist-SH7H4MRK.js")).parser,yaml:async()=>(await import("./chunks/dist-UG3NTKWL.js")).parser},Tt={ts:"typescript",js:"javascript",py:"python","c++":"cpp",md:"markdown",yml:"yaml",shell:"javascript"},re=new Set(["","text","plaintext"]),Nt=new Set;function at(o,t,n){let i=`${o}:${t}`;Nt.has(i)||(Nt.add(i),console.warn(`[Code] ${n}`))}function M(o){return o.indexOf("\r")===-1?o:o.replace(/\r\n?/g,`
2
+ `)}function U(o){let t=o.toLowerCase();return Tt[t]??t}var j=new Map,st=new Map,lt=[A.name],At=["typescript","javascript","json","python"],Ot=new Map(Object.entries(K));function se(o){Ot.set(o.name,o)}function V(o){if(typeof o!="string")return o;let t=Ot.get(o);return t||(at("theme",o,`unknown theme "${o}"; using "${A.name}". Built-in themes: ${Object.keys(K).join(", ")}; register others with registerCodeTheme.`),A)}function ae(o){return j.has(U(o))}function F(o=lt,t=At){let n=[];for(let i of t){let s=U(i);if(j.has(s))continue;let r=It[s];if(!r){re.has(s)||at("language",s,`no grammar for language "${i}"; drawing it as plain text. Supported: ${Object.keys(It).join(", ")} (aliases: ${Object.keys(Tt).join(", ")}).`);continue}let a=st.get(s);a||(a=r().then(l=>(j.set(s,l),l)).catch(l=>(at("load",s,`could not load the "${i}" grammar; drawing it as plain text: ${l instanceof Error?l.message:String(l)}`),null)).finally(()=>st.delete(s)),st.set(s,a)),n.push(a)}return n.length===0?Promise.resolve():Promise.all(n).then(()=>{})}async function le(o,t){await F(lt,[o])}async function ce(o=lt,t=At){await F(o,t)}function B(o,t){return ae(o)}function Et(o,t){return`${o}:${t}`}function he(o,t,n){let i=j.get(U(t));if(!i)return null;let s=i.parse(o),r=rt(n),a=new Map;return gt(s,r,(l,c,h)=>{let u=h;if(!u)return;let d=s.cursorAt(l,1);do a.set(Et(d.from,d.to),u);while(d.next()&&d.to<=c)}),{tree:s,code:o,colorLookup:a}}function de(o,t){let n=t.tree.resolveInner(o,1),i=t.colorLookup.get(Et(n.from,n.to));return i?{color:i,skipAhead:n.to-o}:{color:null,skipAhead:n.firstChild?0:n.to-o}}function ue(o,t){let n=j.get(U(t));if(!n)return[o];let s=n.parse(o).cursor(),r=[],a=0;do s.node.firstChild||(s.from>a&&r.push(o.slice(a,s.from)),s.from<s.to&&r.push(o.slice(s.from,s.to)),a=s.to);while(s.next());return a<o.length&&r.push(o.slice(a)),r}function Mt(o,t,n=A){o=M(o);let i=V(n),s=he(o,t,i),r=[[]],a=()=>r.push([]);if(!s)return o.split(`
3
+ `).map(c=>[{content:c,color:i.defaultColor}]);let l=0;for(let c of ue(o,t)){let h=0;for(;h<c.length;){let{color:u,skipAhead:d}=de(l+h,s),f=h+Math.max(d,1);f>c.length&&(f=c.length);let m=c.indexOf(`
4
+ `,h);m!==-1&&m<f&&(f=m);let g=c.slice(h,f);g.length>0&&r[r.length-1].push({content:g,color:u??i.defaultColor}),m===f&&(a(),f+=1),h=f}l+=c.length}return r}var fe=1,ge=1;function Ht(o,t){return{id:fe++,content:o,color:t}}function Ft(o){return{id:ge++,tokens:o}}function q(o,t,n){return o=M(o),B(t,n)?Mt(o,t,n).map(i=>Ft(i.map(s=>Ht(s.content,s.color)))):(V(n),o.split(`
5
+ `).map(i=>Ft([Ht(i,"#d1d5db")])))}var R=class{cache=new Map;sig="";signature(t,n){return`${t}|${n}`}sync(t){t!==this.sig&&(this.cache.clear(),this.sig=t)}advance(t,n,i,s,r){if(n.length===0)return 0;let a=`${n}\0${r}`,l=this.cache.get(a);if(l!==void 0)return l;let{width:c}=t.measureText(n,i,s,void 0,r);return this.cache.set(a,c),c}};function Dt(o,t,n){return{startLine:o,startCol:t,endLine:o,endCol:n===void 0?1/0:t+n}}function jt(o,t){return{startLine:o,startCol:1,endLine:t??o,endCol:1/0}}var X=class o{list;constructor(t=[]){this.list=t}lines(t,n){return new o([...this.list,jt(t,n)])}word(t,n,i){return new o([...this.list,Dt(t,n,i)])}*[Symbol.iterator](){yield*this.list}toJSON(){return this.list}},pe=new X;function z(o,t){if(t.length===0)return{start:0,end:0};let n=new Array(t.length),i=0;for(let y=0;y<t.length;y++)n[y]=i,i+=t[y]+1;let s=i>0?i-1:0,r=y=>Math.max(0,Math.min(t.length-1,y-1)),a=o.endLine??1/0,l=o.endCol??1/0,c=r(o.startLine),h=r(a),u=t[c],d=t[h],f=Math.max(0,Math.min(u,o.startCol-1)),m=l===1/0?d:Math.max(0,Math.min(d,l-1)),g=Math.min(s,n[c]+f),p=Math.min(s,n[h]+m);return{start:Math.min(g,p),end:Math.max(g,p)}}function ct(o,t,n){let i=0,s=1,r=1,a=1,l=1,c=!1;for(let h=0;h<n.length;h++){let u=i,d=i+n[h];if(!c&&o>=u&&o<=d&&(s=h+1,r=o-u+1,c=!0),t>=u&&t<=d){a=h+1,l=t-u+1;break}i=d+1}return{startLine:s,startCol:r,endLine:a,endCol:l}}var x=function(o,t,n,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,n):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,n,i);else for(var l=o.length-1;l>=0;l--)(a=o[l])&&(r=(s<3?a(r):s>3?a(t,n,r):a(t,n))||r);return s>3&&r&&Object.defineProperty(t,n,r),r},Gt="rgba(255, 255, 255, 0.12)",$t=6,b=class extends ke{tokenLines=[];_linesSource="";_linesBasis={language:"",theme:"",highlighted:!1};_rawCode=null;_normalCode="";transitions=[];advanceCache=new R;structureVersion=0;layoutCacheKey=null;layoutCache=null;highlightDimOpacity=null;highlightedIds=new Set;rowBands=[];diffStrategy;phaseStrategy;constructor(t){super(t),this.diffStrategy=t?.diffStrategy??it,this.phaseStrategy=t?.phaseStrategy??pt,this.applyProp("width",t?.width??"hug"),this.applyProp("height",t?.height??"hug"),this.applyProp("_driven",!1),F(void 0,[this.language]).catch(()=>{}),this._sync()}setLines(t,n,i=this._basis()){this.tokenLines!==t&&(this.tokenLines=t,this._linesSource=n,this._linesBasis=i,this.structureVersion++,this.layoutCache=null,this.layoutCacheKey=null)}declareAssets(t){super.declareAssets(t),t.font(this.fontFamily),t.loader(`shiki:lang:${this.language}`,Le(this.language),{gate:"layout"})}metrics(){return{fontSize:this.fontSize,fontFamily:this.fontFamily,lineHeight:this.lineHeight,letterSpacing:this.letterSpacing,padding:this.padding,showLineNumbers:this.showLineNumbers,lineNumberGap:this.lineNumberGap}}activeEdit(){for(let t=this.transitions.length-1;t>=0;t--){let n=this.transitions[t];if(n.kind==="structural")return n}return null}activeRows(){for(let t=this.transitions.length-1;t>=0;t--){let n=this.transitions[t];if(n.kind==="rows")return n}return null}settledLayout(t,n){let i=`${this.structureVersion}|${W(t)}|${this.advanceCache.signature(t.fontSize,t.fontFamily)}`;if(this.layoutCache&&this.layoutCacheKey===i)return this.layoutCache;let s=P(this.tokenLines,t,this.advanceCache,n);return this.layoutCache=s,this.layoutCacheKey=i,s}frameLayout(t){let n=this.metrics(),i=this.activeEdit();if(!i){let r=this.settledLayout(n,t);return{from:r,to:r,edit:null}}let s=`${W(n)}|${this.advanceCache.signature(n.fontSize,n.fontFamily)}`;return(i.layoutKey!==s||!i.fromLayout||!i.toLayout)&&(i.fromLayout=P(i.from,n,this.advanceCache,t),i.toLayout=P(i.to,n,this.advanceCache,t),i.layoutKey=s),{from:i.fromLayout,to:i.toLayout,edit:i}}measure(t,n){this._sync(),this.advanceCache.sync(this.advanceCache.signature(this.fontSize,this.fontFamily));let i=this.width,s=this.height,{from:r,to:a,edit:l}=this.frameLayout(n),c=$(l),h=l?Bt(r.innerW,a.innerW,c):a.innerW,u=l?Bt(r.innerH,a.innerH,c):a.innerH,d=typeof i=="number"?i:i==="hug"?h+this.padding.left+this.padding.right:t.maxWidth??0,f=typeof s=="number"?s:s==="hug"?u+this.padding.top+this.padding.bottom:t.maxHeight??0;return{width:d,height:f}}renderContent(t){t.pushTextStyle(null);try{this._sync(),super.renderContent(t)}finally{t.popTextStyle()}}renderSelf(t){this.drawSelf(t)}acceptsChild(t){return!1}clipSelf(){return new ye().rect({width:this.layoutBounds.width,height:this.layoutBounds.height})}hitTestSelf(t,n){this._sync();let i=this.hitLayout();if(!i)return super.hitTestSelf(t,n);if(!super.hitTestSelf(t,n))return!1;let s=this.fontSize*this.lineHeight/2,r=this.showLineNumbers?i.gutter:0,a=i.startX-r-n;for(let l=0;l<i.lineY.length;l++)if(!((i.lineW[l]??0)+r<=0)&&!(Math.abs(t.y-i.lineY[l])>s+n)&&t.x>=a&&t.x<=i.startX+(i.lineW[l]??0)+n)return!0;return!1}hitLayout(){if(!this.layoutCache||this.activeEdit())return null;let t=this.metrics(),n=`${this.structureVersion}|${W(t)}|${this.advanceCache.signature(t.fontSize,t.fontFamily)}`;return this.layoutCacheKey===n?this.layoutCache:null}append(t){this._sync();let{code:n}=t.data;return this.editTo(this.joinedSource()+n,t.duration,t.easing)}prepend(t){this._sync();let{code:n}=t.data;return this.editTo(n+this.joinedSource(),t.duration,t.easing)}insert(t){this._sync();let{position:n,code:i}=t.data,s=this.joinedSource(),r=this.offsetAt(n);return this.editTo(s.slice(0,r)+i+s.slice(r),t.duration,t.easing)}erase(t){this._sync();let{target:n}=t.data,{duration:i,easing:s}=t,r=this.joinedSource(),{start:a,end:l}=z(n,this.lineLengths()),c=a===0||r[a-1]===`
6
+ `,h=l===r.length||r[l]===`
7
+ `;if(c&&h)l<r.length?l+=1:a>0&&(a-=1);else if(l<=a)return _(i,()=>{});return l<=a?_(i,()=>{}):this.editTo(r.slice(0,a)+r.slice(l),i,s)}replace(t){this._sync();let{target:n,replacement:i}=t.data,s=this.joinedSource(),{start:r,end:a}=z(n,this.lineLengths());return this.editTo(s.slice(0,r)+i+s.slice(a),t.duration,t.easing)}highlight(t){this._sync();let{target:n,dim:i}=t.data,{duration:s,easing:r}=t,a=i??.4,l=this.tokenIdsInRanges(Rt(n));if(l.size===0)return _(s,()=>{});let c=this.highlightDimOpacity??1,h=this.highlightedIds.size>0,u=this.highlightedIds,d=[];for(let f of this.tokenLines)for(let m of f.tokens){let g=!h||u.has(m.id),p=l.has(m.id),y=g?1:c,w=p?1:a;y!==w&&d.push(Z(m.id,{keys:[0,1],values:[y,w]}))}return this.runDim(d,s,r,f=>{this.highlightDimOpacity=f?a:h?c:null,this.highlightedIds=f?l:u})}resetHighlight(t){this._sync();let{duration:n,easing:i}=t;if(this.highlightDimOpacity===null)return _(n,()=>{});let s=this.highlightDimOpacity,r=this.highlightedIds,a=[];for(let l of this.tokenLines)for(let c of l.tokens){let h=r.has(c.id)?1:s;h!==1&&a.push(Z(c.id,{keys:[0,1],values:[h,1]}))}return this.runDim(a,n,i,l=>{this.highlightDimOpacity=l?null:s,this.highlightedIds=l?new Set:r})}highlightRows(t){this._sync();let{target:n,color:i,radius:s}=t.data,r=be.resolve(i??Gt),a=this.rowBandsIn(Rt(n),r,Math.max(0,s??$t));return this.runRows(this.rowBands,a,t.duration,t.easing)}resetRowHighlight(t){return this._sync(),this.runRows(this.rowBands,[],t.duration,t.easing)}editTo(t,n,i){if(!this.mounted)return _(n,()=>{});t=M(t);let s=this.tokenLines,r=this.joinedSource();if(t===r)return _(n,()=>{});let a=this._linesBasis,l=this._basis(),c=this.diffStrategy(s,q(t,this.language,this.theme)),h={kind:"structural",from:s,to:c.lines,removedIds:c.removedIds,addedIds:c.addedIds,enteringLineIds:c.newLineIds,fromColorById:c.fromColorById,phases:this.phaseStrategy(c.removedIds.size>0,c.addedIds.size>0),progress:0,layoutKey:null,fromLayout:null,toLayout:null};return _(n,u=>{this._drive();let d=u>0&&u<1,f=this.transitions.indexOf(h);d&&f<0?this.transitions.push(h):!d&&f>=0&&this.transitions.splice(f,1),h.progress=i?i(u):u,u<=0?(this.setLines(s,r,a),this._writeProp("code",r)):(this.setLines(c.lines,t,l),this._writeProp("code",t))})}runDim(t,n,i,s){if(!this.mounted)return _(n,()=>{});let r={kind:"dim",tokens:t,progress:0};return _(n,a=>{this._drive();let l=a>0&&a<1,c=this.transitions.indexOf(r);l&&c<0?this.transitions.push(r):!l&&c>=0&&this.transitions.splice(c,1),r.progress=i?i(a):a,s?.(a>=1)})}runRows(t,n,i,s){if(!this.mounted||t.length===0&&n.length===0)return _(i,()=>{});let r={kind:"rows",from:t,to:n,progress:0};return _(i,a=>{this._drive();let l=a>0&&a<1,c=this.transitions.indexOf(r);l&&c<0?this.transitions.push(r):!l&&c>=0&&this.transitions.splice(c,1),r.progress=s?s(a):a,this.rowBands=a>=1?n:t})}_prepareStep(t,n,i){if(!this.mounted)return super._prepareStep(t,n,i);this._sync();let s=typeof t.code=="string"?M(t.code):void 0;if(s===void 0||s===this.joinedSource())return super._prepareStep(t,n,i);let r={...t};delete r.code;let a=super._prepareStep(r,n,i),l=this.editTo(s,n,i)._stepper();return{seek:c=>{a.seek(c),l.seek(c)},advance:c=>{let h=a.advance(c),u=l.advance(c);return h&&u}}}findAllRanges(t){let n=[];if(!t)return n;this._sync();let i=this.joinedSource(),s=this.lineLengths(),r=0;for(;;){let a=i.indexOf(t,r);if(a===-1)break;n.push(ct(a,a+t.length,s)),r=a+Math.max(1,t.length)}return n}findRangeAt(t,n){return this.findAllRanges(t)[n]??null}findFirstRange(t){return this.findRangeAt(t,0)}joinedSource(){return this._linesSource}lineLengths(){return this.tokenLines.map(t=>t.tokens.reduce((n,i)=>n+i.content.length,0))}offsetAt(t){let n=this.lineLengths();if(n.length===0)return 0;let[i,s]=t,r=Math.max(0,Math.min(n.length-1,i-1)),a=0;for(let l=0;l<r;l++)a+=n[l]+1;return a+Math.max(0,Math.min(n[r],s-1))}tokenIdsInRanges(t){let n=new Set,i=this.lineLengths();if(i.length===0)return n;let s=t.map(a=>z(a,i)).filter(({start:a,end:l})=>l>a);if(s.length===0)return n;let r=0;for(let a=0;a<this.tokenLines.length;a++){let l=this.tokenLines[a];for(let c of l.tokens){let h=r,u=r+c.content.length;s.some(({start:d,end:f})=>u>d&&h<f)&&n.add(c.id),r=u}a<this.tokenLines.length-1&&(r+=1)}return n}rowBandsIn(t,n,i){let s=this.tokenLines.length,r=[];for(let a of t){let l=Math.max(1,Math.round(a.startLine??1)),c=Math.min(s,a.endLine==null||a.endLine===1/0?s:Math.round(a.endLine));l>c||r.push({startId:this.tokenLines[l-1].id,endId:this.tokenLines[c-1].id,color:n,radius:i})}return r}drawSelf(t){this.advanceCache.sync(this.advanceCache.signature(this.fontSize,this.fontFamily)),ot(t,{tokenLines:this.tokenLines,metrics:this.metrics(),advanceCache:this.advanceCache,...this.frameLayout(t),tokenStates:mt(this.tokenLines,this.transitions,this.highlightDimOpacity,this.highlightedIds),highlightActive:this.highlightDimOpacity!==null||this.transitions.some(n=>n.kind==="dim"),rowBands:this.rowBands,rowsEdit:this.activeRows(),boxW:this.layoutBounds.width})}_derived=new Map;_drive(){this._sync(),this._writeProp("_driven",!0)}_sync(){let t=this._normalised();if(!this._driven)this.transitions.length=0,this.highlightDimOpacity=null,this.highlightedIds.size>0&&(this.highlightedIds=new Set),this.rowBands.length>0&&(this.rowBands=[]),this.setLines(this._structureFor(t),t);else if(!this.activeEdit()){let n=this._basis(),i=this._linesBasis;if(this._linesSource===t&&i.language===n.language&&i.theme===n.theme&&i.highlighted===n.highlighted)return;let s=this._structureFor(t);this._linesSource===t&&i.language===n.language&&i.highlighted===n.highlighted&&Se(this.tokenLines,s),this.setLines(s,t,n)}}_normalised(){let t=this.code;return t!==this._rawCode&&(this._rawCode=t,this._normalCode=M(t)),this._normalCode}_basis(){return{language:this.language,theme:this.theme,highlighted:B(this.language,this.theme)}}_structureFor(t){let{language:n,theme:i,highlighted:s}=this._basis(),r=this._derived.get(t);return(!r||r.language!==n||r.theme!==i||r.highlighted!==s)&&(r={language:n,theme:i,highlighted:s,lines:q(t,n,i)},this._derived.delete(t),this._derived.set(t,r),this._derived.size>xe&&this._derived.delete(this._derived.keys().next().value)),r.lines}};x([O({default:""})],b.prototype,"code",void 0);x([O({default:"typescript"})],b.prototype,"language",void 0);x([O({default:"Fira Mono"})],b.prototype,"fontFamily",void 0);x([O({default:A.name})],b.prototype,"theme",void 0);x([O({default:16})],b.prototype,"fontSize",void 0);x([O({default:1.6})],b.prototype,"lineHeight",void 0);x([O({default:1.1})],b.prototype,"letterSpacing",void 0);x([O({default:!1})],b.prototype,"showLineNumbers",void 0);x([O({default:2})],b.prototype,"lineNumberGap",void 0);x([we()],b.prototype,"padding",void 0);x([E({args:[{key:"code",kind:"text",multiline:!0}]})],b.prototype,"append",null);x([E({args:[{key:"code",kind:"text",multiline:!0}]})],b.prototype,"prepend",null);x([E({args:[{key:"position",kind:"point",properties:{line:{kind:"number",default:1,min:1,step:1},col:{kind:"number",default:1,min:1,step:1}}},{key:"code",kind:"text",default:"",multiline:!0}]})],b.prototype,"insert",null);x([E({key:"remove",args:[{key:"target",kind:"selector"}]})],b.prototype,"erase",null);x([E({args:[{key:"target",kind:"selector"},{key:"replacement",kind:"text",default:"",multiline:!0}]})],b.prototype,"replace",null);x([E({args:[{key:"target",kind:"selector"},{key:"dim",kind:"number",default:.4,min:0,max:1,step:.01,scale:100,unit:"%"}]})],b.prototype,"highlight",null);x([E()],b.prototype,"resetHighlight",null);x([E({args:[{key:"target",kind:"selector"},{key:"color",kind:"color",default:Gt},{key:"radius",kind:"number",default:$t,min:0,step:1}]})],b.prototype,"highlightRows",null);x([E()],b.prototype,"resetRowHighlight",null);b=x([me({key:"code",parentKey:"node",forkable:!0,layout:{defaultWidthMode:"hug",defaultHeightMode:"hug",acceptsChildren:!1}})],b);function Se(o,t){if(o.length===t.length){for(let n=0;n<o.length;n++){let i=o[n].tokens,s=t[n].tokens;if(i.length!==s.length)return;for(let r=0;r<i.length;r++)if(i[r].content!==s[r].content)return}for(let n=0;n<o.length;n++){t[n].id=o[n].id;for(let i=0;i<o[n].tokens.length;i++)t[n].tokens[i].id=o[n].tokens[i].id}}}var xe=16;function Rt(o){if(typeof o[Symbol.iterator]=="function")return[...o];let n=o.list;return Array.isArray(n)?[...n]:[o]}var zt=new Map;function Le(o){let t=zt.get(o);return t===void 0&&(t=()=>F(void 0,[o]),zt.set(o,t)),t}var Ce=[b];export{K as BUILTIN_THEMES,b as Code,X as CodeRangeChain,pe as CodeRanges,A as DefaultHighlightStyle,Lt as GithubDarkStyle,Ct as GithubLightStyle,Ce as NODES,R as TokenAdvanceCache,vt as VscodeDarkStyle,_t as VscodeLightStyle,B as canHighlight,ct as charOffsetsToRange,rt as compileStyle,it as defaultCodeDiff,pt as defaultCodePhases,ot as drawCode,F as ensureHighlighter,ce as initSyntaxHighlighter,P as layoutCode,jt as lines,le as loadCodeLanguage,Z as makeAnim,W as metricsSignature,$ as moveProgress,M as normalizeSource,Yt as phasesFor,z as rangeToCharOffsets,se as registerCodeTheme,V as resolveTheme,mt as resolveTokenStates,Wt as sampleCurve,Pt as smoothstep,q as tokenizeCodeToIdLines,G as windowProgress,Dt as word};
7
8
  //# sourceMappingURL=index.js.map