svg-jww-viewer 2025.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,3876 @@
1
+
2
+ //#region target/js/release/build/svg_jww_ui/svg_jww_ui.js
3
+ const $1L = {
4
+ hi: 0,
5
+ lo: 1
6
+ };
7
+ const $2305843009213693952L = {
8
+ hi: 536870912,
9
+ lo: 0
10
+ };
11
+ const $5955668970331000884L = {
12
+ hi: 1386662239,
13
+ lo: -1067102156
14
+ };
15
+ const $1784059615882449851L = {
16
+ hi: 415383748,
17
+ lo: -1362422853
18
+ };
19
+ const $8982663654677661702L = {
20
+ hi: 2091439360,
21
+ lo: 1910491142
22
+ };
23
+ const $1380349269358112757L = {
24
+ hi: 321387608,
25
+ lo: -636522507
26
+ };
27
+ const $7286864317269821294L = {
28
+ hi: 1696605309,
29
+ lo: 894846830
30
+ };
31
+ const $2135987035920910082L = {
32
+ hi: 497323236,
33
+ lo: 1760020226
34
+ };
35
+ const $7005857020398200553L = {
36
+ hi: 1631178199,
37
+ lo: 1745020649
38
+ };
39
+ const $1652639921975621497L = {
40
+ hi: 384785216,
41
+ lo: -1023641735
42
+ };
43
+ const $_481418970354774919L = {
44
+ hi: -112089089,
45
+ lo: 1138658425
46
+ };
47
+ const $1278668206209430417L = {
48
+ hi: 297713141,
49
+ lo: 2024993681
50
+ };
51
+ const $8928596168509315048L = {
52
+ hi: 2078850792,
53
+ lo: -689350680
54
+ };
55
+ const $1978643211784836272L = {
56
+ hi: 460688772,
57
+ lo: -1884531536
58
+ };
59
+ const $_8371072500651252758L = {
60
+ hi: -1949042199,
61
+ lo: -1717296150
62
+ };
63
+ const $1530901034580419511L = {
64
+ hi: 356440673,
65
+ lo: 1081189303
66
+ };
67
+ const $597001226353042382L = {
68
+ hi: 139000179,
69
+ lo: -885070898
70
+ };
71
+ const $1184477304306571148L = {
72
+ hi: 275782613,
73
+ lo: 666146700
74
+ };
75
+ const $1527430471115325346L = {
76
+ hi: 355632619,
77
+ lo: -1175470174
78
+ };
79
+ const $1832889850782397517L = {
80
+ hi: 426752923,
81
+ lo: -1269975987
82
+ };
83
+ const $_5913534206540532074L = {
84
+ hi: -1376851976,
85
+ lo: 1812444822
86
+ };
87
+ const $1418129833677084982L = {
88
+ hi: 330184081,
89
+ lo: -172697290
90
+ };
91
+ const $5577825024675947042L = {
92
+ hi: 1298688590,
93
+ lo: -1357372894
94
+ };
95
+ const $2194449627517475473L = {
96
+ hi: 510935119,
97
+ lo: 1034607249
98
+ };
99
+ const $_7439769533505684065L = {
100
+ hi: -1732206330,
101
+ lo: -526467681
102
+ };
103
+ const $1697873161311732311L = {
104
+ hi: 395316900,
105
+ lo: -39337385
106
+ };
107
+ const $_8133250842069730034L = {
108
+ hi: -1893670029,
109
+ lo: 1900641550
110
+ };
111
+ const $1313665730009899186L = {
112
+ hi: 305861637,
113
+ lo: 1993875634
114
+ };
115
+ const $_5745727253942878843L = {
116
+ hi: -1337781375,
117
+ lo: 880033157
118
+ };
119
+ const $2032799256770390445L = {
120
+ hi: 473297959,
121
+ lo: 1601841581
122
+ };
123
+ const $0L = {
124
+ hi: 0,
125
+ lo: 0
126
+ };
127
+ const $1152921504606846976L = {
128
+ hi: 268435456,
129
+ lo: 0
130
+ };
131
+ const $1490116119384765625L = {
132
+ hi: 346944695,
133
+ lo: 839070905
134
+ };
135
+ const $1032610780636961552L = {
136
+ hi: 240423432,
137
+ lo: -1290085616
138
+ };
139
+ const $1925929944387235853L = {
140
+ hi: 448415508,
141
+ lo: -1786957811
142
+ };
143
+ const $7910200175544436838L = {
144
+ hi: 1841736998,
145
+ lo: 1301219430
146
+ };
147
+ const $1244603055572228341L = {
148
+ hi: 289781730,
149
+ lo: -2051041035
150
+ };
151
+ const $_1504838264676837686L = {
152
+ hi: -350372462,
153
+ lo: 1032165066
154
+ };
155
+ const $1608611746708759036L = {
156
+ hi: 374534108,
157
+ lo: 1612227068
158
+ };
159
+ const $_5421850118411349444L = {
160
+ hi: -1262372853,
161
+ lo: 581866044
162
+ };
163
+ const $2079081953128979843L = {
164
+ hi: 484073989,
165
+ lo: 1529716099
166
+ };
167
+ const $6607496772837067824L = {
168
+ hi: 1538427726,
169
+ lo: -1887548368
170
+ };
171
+ const $1343575221513417750L = {
172
+ hi: 312825483,
173
+ lo: -1621953514
174
+ };
175
+ const $_1113817083813899013L = {
176
+ hi: -259330749,
177
+ lo: 1988285691
178
+ };
179
+ const $1736530273035216783L = {
180
+ hi: 404317461,
181
+ lo: 838461327
182
+ };
183
+ const $_5409364890226003632L = {
184
+ hi: -1259465910,
185
+ lo: -644091568
186
+ };
187
+ const $2244412773384604712L = {
188
+ hi: 522568070,
189
+ lo: -1494201304
190
+ };
191
+ const $1605989338741628675L = {
192
+ hi: 373923531,
193
+ lo: 1891786499
194
+ };
195
+ const $1450417759929778918L = {
196
+ hi: 337701700,
197
+ lo: -1668791578
198
+ };
199
+ const $_8816519005292960336L = {
200
+ hi: -2052755795,
201
+ lo: 906519984
202
+ };
203
+ const $1874621017369538693L = {
204
+ hi: 436469218,
205
+ lo: 348844165
206
+ };
207
+ const $665883850346957067L = {
208
+ hi: 155038165,
209
+ lo: 2040105227
210
+ };
211
+ const $1211445438634777304L = {
212
+ hi: 282061621,
213
+ lo: 983030488
214
+ };
215
+ const $_3514853404985837908L = {
216
+ hi: -818365581,
217
+ lo: 1581201068
218
+ };
219
+ const $1565756531257009982L = {
220
+ hi: 364556100,
221
+ lo: -95262914
222
+ };
223
+ const $5L = {
224
+ hi: 0,
225
+ lo: 5
226
+ };
227
+ const $25L = {
228
+ hi: 0,
229
+ lo: 25
230
+ };
231
+ const $125L = {
232
+ hi: 0,
233
+ lo: 125
234
+ };
235
+ const $625L = {
236
+ hi: 0,
237
+ lo: 625
238
+ };
239
+ const $3125L = {
240
+ hi: 0,
241
+ lo: 3125
242
+ };
243
+ const $15625L = {
244
+ hi: 0,
245
+ lo: 15625
246
+ };
247
+ const $78125L = {
248
+ hi: 0,
249
+ lo: 78125
250
+ };
251
+ const $390625L = {
252
+ hi: 0,
253
+ lo: 390625
254
+ };
255
+ const $1953125L = {
256
+ hi: 0,
257
+ lo: 1953125
258
+ };
259
+ const $9765625L = {
260
+ hi: 0,
261
+ lo: 9765625
262
+ };
263
+ const $48828125L = {
264
+ hi: 0,
265
+ lo: 48828125
266
+ };
267
+ const $244140625L = {
268
+ hi: 0,
269
+ lo: 244140625
270
+ };
271
+ const $1220703125L = {
272
+ hi: 0,
273
+ lo: 1220703125
274
+ };
275
+ const $6103515625L = {
276
+ hi: 1,
277
+ lo: 1808548329
278
+ };
279
+ const $30517578125L = {
280
+ hi: 7,
281
+ lo: 452807053
282
+ };
283
+ const $152587890625L = {
284
+ hi: 35,
285
+ lo: -2030932031
286
+ };
287
+ const $762939453125L = {
288
+ hi: 177,
289
+ lo: -1564725563
290
+ };
291
+ const $3814697265625L = {
292
+ hi: 888,
293
+ lo: 766306777
294
+ };
295
+ const $19073486328125L = {
296
+ hi: 4440,
297
+ lo: -463433411
298
+ };
299
+ const $95367431640625L = {
300
+ hi: 22204,
301
+ lo: 1977800241
302
+ };
303
+ const $476837158203125L = {
304
+ hi: 111022,
305
+ lo: 1299066613
306
+ };
307
+ const $2384185791015625L = {
308
+ hi: 555111,
309
+ lo: -2094601527
310
+ };
311
+ const $11920928955078125L = {
312
+ hi: 2775557,
313
+ lo: -1883073043
314
+ };
315
+ const $59604644775390625L = {
316
+ hi: 13877787,
317
+ lo: -825430623
318
+ };
319
+ const $298023223876953125L = {
320
+ hi: 69388939,
321
+ lo: 167814181
322
+ };
323
+ const Option$None$0$ = { $tag: 0 };
324
+ function Option$Some$0$(param0) {
325
+ this._0 = param0;
326
+ }
327
+ Option$Some$0$.prototype.$tag = 1;
328
+ var $PanicError = class extends Error {};
329
+ function $panic() {
330
+ throw new $PanicError();
331
+ }
332
+ function $bound_check(arr, index) {
333
+ if (index < 0 || index >= arr.length) throw new Error("Index out of bounds");
334
+ }
335
+ function $make_array_len_and_init(a, b) {
336
+ const arr = new Array(a);
337
+ arr.fill(b);
338
+ return arr;
339
+ }
340
+ function Result$Err$1$(param0) {
341
+ this._0 = param0;
342
+ }
343
+ Result$Err$1$.prototype.$tag = 0;
344
+ function Result$Ok$1$(param0) {
345
+ this._0 = param0;
346
+ }
347
+ Result$Ok$1$.prototype.$tag = 1;
348
+ const Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$IndexOutOfBounds = { $tag: 1 };
349
+ const Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$InvalidIndex = { $tag: 0 };
350
+ const moonbitlang$core$builtin$$int_to_string_js = (x, radix) => {
351
+ return x.toString(radix);
352
+ };
353
+ const moonbitlang$core$builtin$$uint_to_string_js = (x, radix) => {
354
+ return (x >>> 0).toString(radix);
355
+ };
356
+ const moonbitlang$core$builtin$$uint64_to_string_js = (num, radix) => {
357
+ return (BigInt(num.hi >>> 0) << 32n | BigInt(num.lo >>> 0)).toString(radix);
358
+ };
359
+ function $makebytes(a, b) {
360
+ const arr = new Uint8Array(a);
361
+ if (b !== 0) arr.fill(b);
362
+ return arr;
363
+ }
364
+ const moonbitlang$core$builtin$$JSArray$push = (arr, val) => {
365
+ arr.push(val);
366
+ };
367
+ const $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Continue$2$ = { $tag: 0 };
368
+ function $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Break$2$(param0) {
369
+ this._0 = param0;
370
+ }
371
+ $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Break$2$.prototype.$tag = 1;
372
+ function $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Return$2$(param0) {
373
+ this._0 = param0;
374
+ }
375
+ $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Return$2$.prototype.$tag = 2;
376
+ function $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Error$2$(param0) {
377
+ this._0 = param0;
378
+ }
379
+ $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Error$2$.prototype.$tag = 3;
380
+ function $64$moonbitlang$47$core$47$builtin$46$ForeachResult$JumpOuter$2$(param0) {
381
+ this._0 = param0;
382
+ }
383
+ $64$moonbitlang$47$core$47$builtin$46$ForeachResult$JumpOuter$2$.prototype.$tag = 4;
384
+ const moonbitlang$core$builtin$$try_init_wasm_helper = function() {
385
+ try {
386
+ return new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
387
+ 0,
388
+ 97,
389
+ 115,
390
+ 109,
391
+ 1,
392
+ 0,
393
+ 0,
394
+ 0,
395
+ 1,
396
+ 13,
397
+ 2,
398
+ 96,
399
+ 0,
400
+ 1,
401
+ 127,
402
+ 96,
403
+ 4,
404
+ 127,
405
+ 127,
406
+ 127,
407
+ 127,
408
+ 1,
409
+ 127,
410
+ 3,
411
+ 7,
412
+ 6,
413
+ 0,
414
+ 1,
415
+ 1,
416
+ 1,
417
+ 1,
418
+ 1,
419
+ 6,
420
+ 6,
421
+ 1,
422
+ 127,
423
+ 1,
424
+ 65,
425
+ 0,
426
+ 11,
427
+ 7,
428
+ 50,
429
+ 6,
430
+ 3,
431
+ 109,
432
+ 117,
433
+ 108,
434
+ 0,
435
+ 1,
436
+ 5,
437
+ 100,
438
+ 105,
439
+ 118,
440
+ 95,
441
+ 115,
442
+ 0,
443
+ 2,
444
+ 5,
445
+ 100,
446
+ 105,
447
+ 118,
448
+ 95,
449
+ 117,
450
+ 0,
451
+ 3,
452
+ 5,
453
+ 114,
454
+ 101,
455
+ 109,
456
+ 95,
457
+ 115,
458
+ 0,
459
+ 4,
460
+ 5,
461
+ 114,
462
+ 101,
463
+ 109,
464
+ 95,
465
+ 117,
466
+ 0,
467
+ 5,
468
+ 8,
469
+ 103,
470
+ 101,
471
+ 116,
472
+ 95,
473
+ 104,
474
+ 105,
475
+ 103,
476
+ 104,
477
+ 0,
478
+ 0,
479
+ 10,
480
+ 191,
481
+ 1,
482
+ 6,
483
+ 4,
484
+ 0,
485
+ 35,
486
+ 0,
487
+ 11,
488
+ 36,
489
+ 1,
490
+ 1,
491
+ 126,
492
+ 32,
493
+ 0,
494
+ 173,
495
+ 32,
496
+ 1,
497
+ 173,
498
+ 66,
499
+ 32,
500
+ 134,
501
+ 132,
502
+ 32,
503
+ 2,
504
+ 173,
505
+ 32,
506
+ 3,
507
+ 173,
508
+ 66,
509
+ 32,
510
+ 134,
511
+ 132,
512
+ 126,
513
+ 34,
514
+ 4,
515
+ 66,
516
+ 32,
517
+ 135,
518
+ 167,
519
+ 36,
520
+ 0,
521
+ 32,
522
+ 4,
523
+ 167,
524
+ 11,
525
+ 36,
526
+ 1,
527
+ 1,
528
+ 126,
529
+ 32,
530
+ 0,
531
+ 173,
532
+ 32,
533
+ 1,
534
+ 173,
535
+ 66,
536
+ 32,
537
+ 134,
538
+ 132,
539
+ 32,
540
+ 2,
541
+ 173,
542
+ 32,
543
+ 3,
544
+ 173,
545
+ 66,
546
+ 32,
547
+ 134,
548
+ 132,
549
+ 127,
550
+ 34,
551
+ 4,
552
+ 66,
553
+ 32,
554
+ 135,
555
+ 167,
556
+ 36,
557
+ 0,
558
+ 32,
559
+ 4,
560
+ 167,
561
+ 11,
562
+ 36,
563
+ 1,
564
+ 1,
565
+ 126,
566
+ 32,
567
+ 0,
568
+ 173,
569
+ 32,
570
+ 1,
571
+ 173,
572
+ 66,
573
+ 32,
574
+ 134,
575
+ 132,
576
+ 32,
577
+ 2,
578
+ 173,
579
+ 32,
580
+ 3,
581
+ 173,
582
+ 66,
583
+ 32,
584
+ 134,
585
+ 132,
586
+ 128,
587
+ 34,
588
+ 4,
589
+ 66,
590
+ 32,
591
+ 135,
592
+ 167,
593
+ 36,
594
+ 0,
595
+ 32,
596
+ 4,
597
+ 167,
598
+ 11,
599
+ 36,
600
+ 1,
601
+ 1,
602
+ 126,
603
+ 32,
604
+ 0,
605
+ 173,
606
+ 32,
607
+ 1,
608
+ 173,
609
+ 66,
610
+ 32,
611
+ 134,
612
+ 132,
613
+ 32,
614
+ 2,
615
+ 173,
616
+ 32,
617
+ 3,
618
+ 173,
619
+ 66,
620
+ 32,
621
+ 134,
622
+ 132,
623
+ 129,
624
+ 34,
625
+ 4,
626
+ 66,
627
+ 32,
628
+ 135,
629
+ 167,
630
+ 36,
631
+ 0,
632
+ 32,
633
+ 4,
634
+ 167,
635
+ 11,
636
+ 36,
637
+ 1,
638
+ 1,
639
+ 126,
640
+ 32,
641
+ 0,
642
+ 173,
643
+ 32,
644
+ 1,
645
+ 173,
646
+ 66,
647
+ 32,
648
+ 134,
649
+ 132,
650
+ 32,
651
+ 2,
652
+ 173,
653
+ 32,
654
+ 3,
655
+ 173,
656
+ 66,
657
+ 32,
658
+ 134,
659
+ 132,
660
+ 130,
661
+ 34,
662
+ 4,
663
+ 66,
664
+ 32,
665
+ 135,
666
+ 167,
667
+ 36,
668
+ 0,
669
+ 32,
670
+ 4,
671
+ 167,
672
+ 11
673
+ ])), {}).exports;
674
+ } catch (e) {
675
+ return;
676
+ }
677
+ };
678
+ const moonbitlang$core$builtin$$MyInt64$div_u_bigint = (a, b) => {
679
+ const result = (BigInt(a.hi >>> 0) << 32n | BigInt(a.lo >>> 0)) / (BigInt(b.hi >>> 0) << 32n | BigInt(b.lo >>> 0));
680
+ const lo = Number(result & 4294967295n);
681
+ return {
682
+ hi: Number(result >> 32n & 4294967295n) | 0,
683
+ lo: lo | 0
684
+ };
685
+ };
686
+ const moonbitlang$core$builtin$$MyInt64$mod_u_bigint = (a, b) => {
687
+ const result = (BigInt(a.hi >>> 0) << 32n | BigInt(a.lo >>> 0)) % (BigInt(b.hi >>> 0) << 32n | BigInt(b.lo >>> 0));
688
+ const lo = Number(result & 4294967295n);
689
+ return {
690
+ hi: Number(result >> 32n & 4294967295n) | 0,
691
+ lo: lo | 0
692
+ };
693
+ };
694
+ const moonbitlang$core$builtin$$MyInt64$compare_u = (a, b) => {
695
+ const ahi = a.hi >>> 0;
696
+ const bhi = b.hi >>> 0;
697
+ if (ahi < bhi) return -1;
698
+ if (ahi > bhi) return 1;
699
+ const alo = a.lo >>> 0;
700
+ const blo = b.lo >>> 0;
701
+ if (alo < blo) return -1;
702
+ if (alo > blo) return 1;
703
+ return 0;
704
+ };
705
+ const moonbitlang$core$builtin$$MyInt64$reinterpret_double = function f(a) {
706
+ let view = f._view;
707
+ if (view === void 0) view = f._view = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
708
+ view.setFloat64(0, a);
709
+ return {
710
+ hi: view.getInt32(0),
711
+ lo: view.getInt32(4)
712
+ };
713
+ };
714
+ const $4294967295L = {
715
+ hi: 0,
716
+ lo: -1
717
+ };
718
+ const $10000000000000000L = {
719
+ hi: 2328306,
720
+ lo: 1874919424
721
+ };
722
+ const $1000000000000000L = {
723
+ hi: 232830,
724
+ lo: -1530494976
725
+ };
726
+ const $100000000000000L = {
727
+ hi: 23283,
728
+ lo: 276447232
729
+ };
730
+ const $10000000000000L = {
731
+ hi: 2328,
732
+ lo: 1316134912
733
+ };
734
+ const $1000000000000L = {
735
+ hi: 232,
736
+ lo: -727379968
737
+ };
738
+ const $100000000000L = {
739
+ hi: 23,
740
+ lo: 1215752192
741
+ };
742
+ const $10000000000L = {
743
+ hi: 2,
744
+ lo: 1410065408
745
+ };
746
+ const $1000000000L = {
747
+ hi: 0,
748
+ lo: 1e9
749
+ };
750
+ const $100000000L = {
751
+ hi: 0,
752
+ lo: 1e8
753
+ };
754
+ const $10000000L = {
755
+ hi: 0,
756
+ lo: 1e7
757
+ };
758
+ const $1000000L = {
759
+ hi: 0,
760
+ lo: 1e6
761
+ };
762
+ const $100000L = {
763
+ hi: 0,
764
+ lo: 1e5
765
+ };
766
+ const $10000L = {
767
+ hi: 0,
768
+ lo: 1e4
769
+ };
770
+ const $1000L = {
771
+ hi: 0,
772
+ lo: 1e3
773
+ };
774
+ const $100L = {
775
+ hi: 0,
776
+ lo: 100
777
+ };
778
+ const $10L = {
779
+ hi: 0,
780
+ lo: 10
781
+ };
782
+ const $4L = {
783
+ hi: 0,
784
+ lo: 4
785
+ };
786
+ const $2L = {
787
+ hi: 0,
788
+ lo: 2
789
+ };
790
+ function $64$mizchi$47$luna$47$luna$46$Node$Element$3$(param0) {
791
+ this._0 = param0;
792
+ }
793
+ $64$mizchi$47$luna$47$luna$46$Node$Element$3$.prototype.$tag = 0;
794
+ function $64$mizchi$47$luna$47$luna$46$Node$Text$3$(param0) {
795
+ this._0 = param0;
796
+ }
797
+ $64$mizchi$47$luna$47$luna$46$Node$Text$3$.prototype.$tag = 1;
798
+ function $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(param0) {
799
+ this._0 = param0;
800
+ }
801
+ $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$.prototype.$tag = 2;
802
+ function $64$mizchi$47$luna$47$luna$46$Node$Fragment$3$(param0) {
803
+ this._0 = param0;
804
+ }
805
+ $64$mizchi$47$luna$47$luna$46$Node$Fragment$3$.prototype.$tag = 3;
806
+ function $64$mizchi$47$luna$47$luna$46$Node$Show$3$(param0, param1) {
807
+ this._0 = param0;
808
+ this._1 = param1;
809
+ }
810
+ $64$mizchi$47$luna$47$luna$46$Node$Show$3$.prototype.$tag = 4;
811
+ function $64$mizchi$47$luna$47$luna$46$Node$For$3$(param0) {
812
+ this._0 = param0;
813
+ }
814
+ $64$mizchi$47$luna$47$luna$46$Node$For$3$.prototype.$tag = 5;
815
+ function $64$mizchi$47$luna$47$luna$46$Node$Component$3$(param0) {
816
+ this._0 = param0;
817
+ }
818
+ $64$mizchi$47$luna$47$luna$46$Node$Component$3$.prototype.$tag = 6;
819
+ function $64$mizchi$47$luna$47$luna$46$Node$Island$3$(param0) {
820
+ this._0 = param0;
821
+ }
822
+ $64$mizchi$47$luna$47$luna$46$Node$Island$3$.prototype.$tag = 7;
823
+ function $64$mizchi$47$luna$47$luna$46$Node$WcIsland$3$(param0) {
824
+ this._0 = param0;
825
+ }
826
+ $64$mizchi$47$luna$47$luna$46$Node$WcIsland$3$.prototype.$tag = 8;
827
+ function $64$mizchi$47$luna$47$luna$46$Node$Async$3$(param0) {
828
+ this._0 = param0;
829
+ }
830
+ $64$mizchi$47$luna$47$luna$46$Node$Async$3$.prototype.$tag = 9;
831
+ function $64$mizchi$47$luna$47$luna$46$Node$ErrorBoundary$3$(param0) {
832
+ this._0 = param0;
833
+ }
834
+ $64$mizchi$47$luna$47$luna$46$Node$ErrorBoundary$3$.prototype.$tag = 10;
835
+ function $64$mizchi$47$luna$47$luna$46$Node$Switch$3$(param0) {
836
+ this._0 = param0;
837
+ }
838
+ $64$mizchi$47$luna$47$luna$46$Node$Switch$3$.prototype.$tag = 11;
839
+ function $64$mizchi$47$luna$47$luna$46$Node$InternalRef$3$(param0) {
840
+ this._0 = param0;
841
+ }
842
+ $64$mizchi$47$luna$47$luna$46$Node$InternalRef$3$.prototype.$tag = 12;
843
+ function $64$mizchi$47$luna$47$luna$46$Node$RawHtml$3$(param0) {
844
+ this._0 = param0;
845
+ }
846
+ $64$mizchi$47$luna$47$luna$46$Node$RawHtml$3$.prototype.$tag = 13;
847
+ function $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$(param0) {
848
+ this._0 = param0;
849
+ }
850
+ $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$.prototype.$tag = 0;
851
+ function $64$mizchi$47$luna$47$luna$46$Attr$VDynamic$3$(param0) {
852
+ this._0 = param0;
853
+ }
854
+ $64$mizchi$47$luna$47$luna$46$Attr$VDynamic$3$.prototype.$tag = 1;
855
+ function $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(param0) {
856
+ this._0 = param0;
857
+ }
858
+ $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$.prototype.$tag = 2;
859
+ function $64$mizchi$47$luna$47$luna$46$Attr$VAction$3$(param0) {
860
+ this._0 = param0;
861
+ }
862
+ $64$mizchi$47$luna$47$luna$46$Attr$VAction$3$.prototype.$tag = 3;
863
+ const $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger = {
864
+ method_0: moonbitlang$core$builtin$$Logger$write_string$0$,
865
+ method_1: moonbitlang$core$builtin$$Logger$write_substring$1$,
866
+ method_2: moonbitlang$core$builtin$$Logger$write_view$0$,
867
+ method_3: moonbitlang$core$builtin$$Logger$write_char$0$
868
+ };
869
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5354 = ":";
870
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5393 = ":";
871
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5387 = "-";
872
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5374 = ":";
873
+ const moonbitlang$core$builtin$$parse$46$42$bind$124$5368 = ":";
874
+ const moonbitlang$core$builtin$$wasm_helper_cache = {
875
+ tried: false,
876
+ exports: void 0
877
+ };
878
+ const moonbitlang$core$builtin$$output$46$42$bind$124$8198 = "/";
879
+ const moonbitlang$core$builtin$$output$46$42$bind$124$8192 = "/";
880
+ const moonbitlang$core$builtin$$boyer_moore_horspool_find$46$constr$47$37 = 0;
881
+ const moonbitlang$core$builtin$$brute_force_find$46$constr$47$51 = 0;
882
+ const moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2 = [
883
+ $1L,
884
+ $2305843009213693952L,
885
+ $5955668970331000884L,
886
+ $1784059615882449851L,
887
+ $8982663654677661702L,
888
+ $1380349269358112757L,
889
+ $7286864317269821294L,
890
+ $2135987035920910082L,
891
+ $7005857020398200553L,
892
+ $1652639921975621497L,
893
+ $_481418970354774919L,
894
+ $1278668206209430417L,
895
+ $8928596168509315048L,
896
+ $1978643211784836272L,
897
+ $_8371072500651252758L,
898
+ $1530901034580419511L,
899
+ $597001226353042382L,
900
+ $1184477304306571148L,
901
+ $1527430471115325346L,
902
+ $1832889850782397517L,
903
+ $_5913534206540532074L,
904
+ $1418129833677084982L,
905
+ $5577825024675947042L,
906
+ $2194449627517475473L,
907
+ $_7439769533505684065L,
908
+ $1697873161311732311L,
909
+ $_8133250842069730034L,
910
+ $1313665730009899186L,
911
+ $_5745727253942878843L,
912
+ $2032799256770390445L
913
+ ];
914
+ const moonbitlang$core$double$internal$ryu$$gPOW5_INV_OFFSETS = [
915
+ 1414808916,
916
+ 67458373,
917
+ 268701696,
918
+ 4195348,
919
+ 1073807360,
920
+ 1091917141,
921
+ 1108,
922
+ 65604,
923
+ 1073741824,
924
+ 1140850753,
925
+ 1346716752,
926
+ 1431634004,
927
+ 1365595476,
928
+ 1073758208,
929
+ 16777217,
930
+ 66816,
931
+ 1364284433,
932
+ 89478484,
933
+ 0
934
+ ];
935
+ const moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2 = [
936
+ $0L,
937
+ $1152921504606846976L,
938
+ $0L,
939
+ $1490116119384765625L,
940
+ $1032610780636961552L,
941
+ $1925929944387235853L,
942
+ $7910200175544436838L,
943
+ $1244603055572228341L,
944
+ $_1504838264676837686L,
945
+ $1608611746708759036L,
946
+ $_5421850118411349444L,
947
+ $2079081953128979843L,
948
+ $6607496772837067824L,
949
+ $1343575221513417750L,
950
+ $_1113817083813899013L,
951
+ $1736530273035216783L,
952
+ $_5409364890226003632L,
953
+ $2244412773384604712L,
954
+ $1605989338741628675L,
955
+ $1450417759929778918L,
956
+ $_8816519005292960336L,
957
+ $1874621017369538693L,
958
+ $665883850346957067L,
959
+ $1211445438634777304L,
960
+ $_3514853404985837908L,
961
+ $1565756531257009982L
962
+ ];
963
+ const moonbitlang$core$double$internal$ryu$$gPOW5_OFFSETS = [
964
+ 0,
965
+ 0,
966
+ 0,
967
+ 0,
968
+ 1073741824,
969
+ 1500076437,
970
+ 1431590229,
971
+ 1448432917,
972
+ 1091896580,
973
+ 1079333904,
974
+ 1146442053,
975
+ 1146111296,
976
+ 1163220304,
977
+ 1073758208,
978
+ -1773927360,
979
+ 1431721317,
980
+ 1413824581,
981
+ 1075134801,
982
+ 1431671125,
983
+ 1363170645,
984
+ 261
985
+ ];
986
+ const moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE = [
987
+ $1L,
988
+ $5L,
989
+ $25L,
990
+ $125L,
991
+ $625L,
992
+ $3125L,
993
+ $15625L,
994
+ $78125L,
995
+ $390625L,
996
+ $1953125L,
997
+ $9765625L,
998
+ $48828125L,
999
+ $244140625L,
1000
+ $1220703125L,
1001
+ $6103515625L,
1002
+ $30517578125L,
1003
+ $152587890625L,
1004
+ $762939453125L,
1005
+ $3814697265625L,
1006
+ $19073486328125L,
1007
+ $95367431640625L,
1008
+ $476837158203125L,
1009
+ $2384185791015625L,
1010
+ $11920928955078125L,
1011
+ $59604644775390625L,
1012
+ $298023223876953125L
1013
+ ];
1014
+ const moonbitlang$core$double$internal$ryu$$ryu_to_string$46$record$47$728 = {
1015
+ mantissa: $0L,
1016
+ exponent: 0
1017
+ };
1018
+ const mizchi$luna$luna$signal$$reactive_context = {
1019
+ current_subscriber: void 0,
1020
+ current_owner: void 0,
1021
+ current_cleanups: Option$None$0$,
1022
+ batch_depth: 0,
1023
+ pending_effects: [],
1024
+ pending_ids: []
1025
+ };
1026
+ const mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$39 = "/";
1027
+ const mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$35 = ".js";
1028
+ const mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$33 = "_";
1029
+ const mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$34 = "-";
1030
+ const mizchi$luna$luna$render$$render_attrs_to$46$42$bind$124$630 = "on";
1031
+ const mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$915 = "/";
1032
+ const mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$916 = "_";
1033
+ const mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$917 = ".";
1034
+ const mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$918 = "_";
1035
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$780 = "&amp;";
1036
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$781 = "&lt;";
1037
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$782 = "&gt;";
1038
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$783 = "&quot;";
1039
+ const mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$784 = "&#39;";
1040
+ const mizchi$luna$luna$render$$escape_attr_to_internal$46$constr$47$803 = "&amp;";
1041
+ const mizchi$luna$luna$render$$escape_attr_to_internal$46$constr$47$804 = "&quot;";
1042
+ function moonbitlang$core$abort$$abort$2$(msg) {
1043
+ return $panic();
1044
+ }
1045
+ function moonbitlang$core$abort$$abort$3$(msg) {
1046
+ return $panic();
1047
+ }
1048
+ function moonbitlang$core$abort$$abort$4$(msg) {
1049
+ $panic();
1050
+ }
1051
+ function moonbitlang$core$abort$$abort$5$(msg) {
1052
+ return $panic();
1053
+ }
1054
+ function moonbitlang$core$builtin$$Eq$equal$6$(_x_5248, _x_5249) {
1055
+ if (_x_5248 === 0) if (_x_5249 === 0) return true;
1056
+ else return false;
1057
+ else if (_x_5249 === 1) return true;
1058
+ else return false;
1059
+ }
1060
+ function moonbitlang$core$builtin$$abort$2$(string, loc) {
1061
+ return moonbitlang$core$abort$$abort$2$(`${string}\n at ${moonbitlang$core$builtin$$Show$to_string$7$(loc)}\n`);
1062
+ }
1063
+ function moonbitlang$core$builtin$$abort$3$(string, loc) {
1064
+ return moonbitlang$core$abort$$abort$3$(`${string}\n at ${moonbitlang$core$builtin$$Show$to_string$7$(loc)}\n`);
1065
+ }
1066
+ function moonbitlang$core$builtin$$abort$4$(string, loc) {
1067
+ moonbitlang$core$abort$$abort$4$(`${string}\n at ${moonbitlang$core$builtin$$Show$to_string$7$(loc)}\n`);
1068
+ }
1069
+ function moonbitlang$core$builtin$$abort$5$(string, loc) {
1070
+ return moonbitlang$core$abort$$abort$5$(`${string}\n at ${moonbitlang$core$builtin$$Show$to_string$7$(loc)}\n`);
1071
+ }
1072
+ function moonbitlang$core$builtin$$StringBuilder$new$46$inner(size_hint) {
1073
+ return { val: "" };
1074
+ }
1075
+ function moonbitlang$core$builtin$$Logger$write_char$0$(self, ch) {
1076
+ const _bind = self;
1077
+ _bind.val = `${_bind.val}${String.fromCodePoint(ch)}`;
1078
+ }
1079
+ function moonbitlang$core$builtin$$code_point_of_surrogate_pair(leading, trailing) {
1080
+ return (((Math.imul(leading - 55296 | 0, 1024) | 0) + trailing | 0) - 56320 | 0) + 65536 | 0;
1081
+ }
1082
+ function moonbitlang$core$builtin$$op_notequal$6$(x, y) {
1083
+ return !moonbitlang$core$builtin$$Eq$equal$6$(x, y);
1084
+ }
1085
+ function moonbitlang$core$builtin$$op_notequal$8$(x, y) {
1086
+ return !moonbitlang$core$builtin$$Eq$equal$8$(x, y);
1087
+ }
1088
+ function moonbitlang$core$array$$Array$at$3$(self, index) {
1089
+ const len = self.length;
1090
+ if (index >= 0 && index < len) {
1091
+ $bound_check(self, index);
1092
+ return self[index];
1093
+ } else return $panic();
1094
+ }
1095
+ function moonbitlang$core$builtin$$boyer_moore_horspool_find(haystack, needle) {
1096
+ const haystack_len = haystack.end - haystack.start | 0;
1097
+ const needle_len = needle.end - needle.start | 0;
1098
+ if (needle_len > 0) if (haystack_len >= needle_len) {
1099
+ const skip_table = $make_array_len_and_init(256, needle_len);
1100
+ const _end4418 = needle_len - 1 | 0;
1101
+ let _tmp = 0;
1102
+ while (true) {
1103
+ const i = _tmp;
1104
+ if (i < _end4418) {
1105
+ const _tmp$2$1 = needle.str;
1106
+ const _tmp$3 = needle.start + i | 0;
1107
+ const _tmp$4 = _tmp$2$1.charCodeAt(_tmp$3) & 255;
1108
+ $bound_check(skip_table, _tmp$4);
1109
+ skip_table[_tmp$4] = (needle_len - 1 | 0) - i | 0;
1110
+ _tmp = i + 1 | 0;
1111
+ continue;
1112
+ } else break;
1113
+ }
1114
+ let _tmp$2 = 0;
1115
+ while (true) {
1116
+ const i = _tmp$2;
1117
+ if (i <= (haystack_len - needle_len | 0)) {
1118
+ const _end4424 = needle_len - 1 | 0;
1119
+ let _tmp$3 = 0;
1120
+ while (true) {
1121
+ const j = _tmp$3;
1122
+ if (j <= _end4424) {
1123
+ const _p$1 = i + j | 0;
1124
+ const _tmp$4$1 = haystack.str;
1125
+ const _tmp$5$1 = haystack.start + _p$1 | 0;
1126
+ const _tmp$6$1 = _tmp$4$1.charCodeAt(_tmp$5$1);
1127
+ const _tmp$7 = needle.str;
1128
+ const _tmp$8 = needle.start + j | 0;
1129
+ if (_tmp$6$1 !== _tmp$7.charCodeAt(_tmp$8)) break;
1130
+ _tmp$3 = j + 1 | 0;
1131
+ continue;
1132
+ } else return i;
1133
+ }
1134
+ const _p = (i + needle_len | 0) - 1 | 0;
1135
+ const _tmp$4 = haystack.str;
1136
+ const _tmp$5 = haystack.start + _p | 0;
1137
+ const _tmp$6 = _tmp$4.charCodeAt(_tmp$5) & 255;
1138
+ $bound_check(skip_table, _tmp$6);
1139
+ _tmp$2 = i + skip_table[_tmp$6] | 0;
1140
+ continue;
1141
+ } else break;
1142
+ }
1143
+ return;
1144
+ } else return;
1145
+ else return moonbitlang$core$builtin$$boyer_moore_horspool_find$46$constr$47$37;
1146
+ }
1147
+ function moonbitlang$core$builtin$$brute_force_find(haystack, needle) {
1148
+ const haystack_len = haystack.end - haystack.start | 0;
1149
+ const needle_len = needle.end - needle.start | 0;
1150
+ if (needle_len > 0) if (haystack_len >= needle_len) {
1151
+ const _p = 0;
1152
+ const _tmp = needle.str;
1153
+ const _tmp$2 = needle.start + _p | 0;
1154
+ const needle_first = _tmp.charCodeAt(_tmp$2);
1155
+ const forward_len = haystack_len - needle_len | 0;
1156
+ let i = 0;
1157
+ while (true) if (i <= forward_len) {
1158
+ while (true) {
1159
+ let _tmp$3;
1160
+ if (i <= forward_len) {
1161
+ const _p$2 = i;
1162
+ const _tmp$4 = haystack.str;
1163
+ const _tmp$5 = haystack.start + _p$2 | 0;
1164
+ _tmp$3 = _tmp$4.charCodeAt(_tmp$5) !== needle_first;
1165
+ } else _tmp$3 = false;
1166
+ if (_tmp$3) {
1167
+ i = i + 1 | 0;
1168
+ continue;
1169
+ } else break;
1170
+ }
1171
+ if (i <= forward_len) {
1172
+ let _tmp$3 = 1;
1173
+ while (true) {
1174
+ const j = _tmp$3;
1175
+ if (j < needle_len) {
1176
+ const _p$2 = i + j | 0;
1177
+ const _tmp$4 = haystack.str;
1178
+ const _tmp$5 = haystack.start + _p$2 | 0;
1179
+ const _tmp$6 = _tmp$4.charCodeAt(_tmp$5);
1180
+ const _tmp$7 = needle.str;
1181
+ const _tmp$8 = needle.start + j | 0;
1182
+ if (_tmp$6 !== _tmp$7.charCodeAt(_tmp$8)) break;
1183
+ _tmp$3 = j + 1 | 0;
1184
+ continue;
1185
+ } else return i;
1186
+ }
1187
+ i = i + 1 | 0;
1188
+ }
1189
+ continue;
1190
+ } else break;
1191
+ return;
1192
+ } else return;
1193
+ else return moonbitlang$core$builtin$$brute_force_find$46$constr$47$51;
1194
+ }
1195
+ function moonbitlang$core$string$$StringView$find(self, str) {
1196
+ return (str.end - str.start | 0) <= 4 ? moonbitlang$core$builtin$$brute_force_find(self, str) : moonbitlang$core$builtin$$boyer_moore_horspool_find(self, str);
1197
+ }
1198
+ function moonbitlang$core$builtin$$boyer_moore_horspool_rev_find(haystack, needle) {
1199
+ const haystack_len = haystack.end - haystack.start | 0;
1200
+ const needle_len = needle.end - needle.start | 0;
1201
+ if (needle_len > 0) if (haystack_len >= needle_len) {
1202
+ const skip_table = $make_array_len_and_init(256, needle_len);
1203
+ let _tmp = needle_len - 1 | 0;
1204
+ while (true) {
1205
+ const i = _tmp;
1206
+ if (i > 0) {
1207
+ const _tmp$2$1 = needle.str;
1208
+ const _tmp$3 = needle.start + i | 0;
1209
+ const _tmp$4 = _tmp$2$1.charCodeAt(_tmp$3) & 255;
1210
+ $bound_check(skip_table, _tmp$4);
1211
+ skip_table[_tmp$4] = i;
1212
+ _tmp = i - 1 | 0;
1213
+ continue;
1214
+ } else break;
1215
+ }
1216
+ let _tmp$2 = haystack_len - needle_len | 0;
1217
+ while (true) {
1218
+ const i = _tmp$2;
1219
+ if (i >= 0) {
1220
+ let _tmp$3 = 0;
1221
+ while (true) {
1222
+ const j = _tmp$3;
1223
+ if (j < needle_len) {
1224
+ const _p = i + j | 0;
1225
+ const _tmp$4$1 = haystack.str;
1226
+ const _tmp$5$1 = haystack.start + _p | 0;
1227
+ const _tmp$6$1 = _tmp$4$1.charCodeAt(_tmp$5$1);
1228
+ const _tmp$7 = needle.str;
1229
+ const _tmp$8 = needle.start + j | 0;
1230
+ if (_tmp$6$1 !== _tmp$7.charCodeAt(_tmp$8)) break;
1231
+ _tmp$3 = j + 1 | 0;
1232
+ continue;
1233
+ } else return i;
1234
+ }
1235
+ const _tmp$4 = haystack.str;
1236
+ const _tmp$5 = haystack.start + i | 0;
1237
+ const _tmp$6 = _tmp$4.charCodeAt(_tmp$5) & 255;
1238
+ $bound_check(skip_table, _tmp$6);
1239
+ _tmp$2 = i - skip_table[_tmp$6] | 0;
1240
+ continue;
1241
+ } else break;
1242
+ }
1243
+ return;
1244
+ } else return;
1245
+ else return haystack_len;
1246
+ }
1247
+ function moonbitlang$core$builtin$$brute_force_rev_find(haystack, needle) {
1248
+ const haystack_len = haystack.end - haystack.start | 0;
1249
+ const needle_len = needle.end - needle.start | 0;
1250
+ if (needle_len > 0) if (haystack_len >= needle_len) {
1251
+ const _p = 0;
1252
+ const _tmp = needle.str;
1253
+ const _tmp$2 = needle.start + _p | 0;
1254
+ const needle_first = _tmp.charCodeAt(_tmp$2);
1255
+ let i = haystack_len - needle_len | 0;
1256
+ while (true) if (i >= 0) {
1257
+ while (true) {
1258
+ let _tmp$3;
1259
+ if (i >= 0) {
1260
+ const _p$2 = i;
1261
+ const _tmp$4 = haystack.str;
1262
+ const _tmp$5 = haystack.start + _p$2 | 0;
1263
+ _tmp$3 = _tmp$4.charCodeAt(_tmp$5) !== needle_first;
1264
+ } else _tmp$3 = false;
1265
+ if (_tmp$3) {
1266
+ i = i - 1 | 0;
1267
+ continue;
1268
+ } else break;
1269
+ }
1270
+ if (i >= 0) {
1271
+ let _tmp$3 = 1;
1272
+ while (true) {
1273
+ const j = _tmp$3;
1274
+ if (j < needle_len) {
1275
+ const _p$2 = i + j | 0;
1276
+ const _tmp$4 = haystack.str;
1277
+ const _tmp$5 = haystack.start + _p$2 | 0;
1278
+ const _tmp$6 = _tmp$4.charCodeAt(_tmp$5);
1279
+ const _tmp$7 = needle.str;
1280
+ const _tmp$8 = needle.start + j | 0;
1281
+ if (_tmp$6 !== _tmp$7.charCodeAt(_tmp$8)) break;
1282
+ _tmp$3 = j + 1 | 0;
1283
+ continue;
1284
+ } else return i;
1285
+ }
1286
+ i = i - 1 | 0;
1287
+ }
1288
+ continue;
1289
+ } else break;
1290
+ return;
1291
+ } else return;
1292
+ else return haystack_len;
1293
+ }
1294
+ function moonbitlang$core$string$$StringView$rev_find(self, str) {
1295
+ return (str.end - str.start | 0) <= 4 ? moonbitlang$core$builtin$$brute_force_rev_find(self, str) : moonbitlang$core$builtin$$boyer_moore_horspool_rev_find(self, str);
1296
+ }
1297
+ function moonbitlang$core$string$$StringView$view$46$inner(self, start_offset, end_offset) {
1298
+ let end_offset$2;
1299
+ if (end_offset === void 0) end_offset$2 = self.end - self.start | 0;
1300
+ else end_offset$2 = end_offset;
1301
+ return start_offset >= 0 && start_offset <= end_offset$2 && end_offset$2 <= (self.end - self.start | 0) ? {
1302
+ str: self.str,
1303
+ start: self.start + start_offset | 0,
1304
+ end: self.start + end_offset$2 | 0
1305
+ } : moonbitlang$core$builtin$$abort$3$("Invalid index for View", "@moonbitlang/core/builtin:stringview.mbt:111:5-111:36");
1306
+ }
1307
+ function moonbitlang$core$builtin$$parse$46$parse_loc$124$1093(view) {
1308
+ const _bind = moonbitlang$core$string$$StringView$find(view, {
1309
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5354,
1310
+ start: 0,
1311
+ end: 1
1312
+ });
1313
+ if (_bind === void 0) return;
1314
+ else {
1315
+ const _i = _bind;
1316
+ return _i > 0 && (_i + 1 | 0) < (view.end - view.start | 0) ? {
1317
+ _0: moonbitlang$core$string$$StringView$view$46$inner(view, 0, _i),
1318
+ _1: moonbitlang$core$string$$StringView$view$46$inner(view, _i + 1 | 0, void 0)
1319
+ } : void 0;
1320
+ }
1321
+ }
1322
+ function moonbitlang$core$builtin$$SourceLocRepr$parse(repr) {
1323
+ _L: if (moonbitlang$core$string$$String$char_length_ge$46$inner(repr, 1, 0, repr.length)) if (repr.charCodeAt(0) === 64) {
1324
+ const _bind = moonbitlang$core$string$$String$offset_of_nth_char$46$inner(repr, 1, 0, repr.length);
1325
+ let _tmp;
1326
+ if (_bind === void 0) _tmp = repr.length;
1327
+ else _tmp = _bind;
1328
+ const _x$2 = {
1329
+ str: repr,
1330
+ start: _tmp,
1331
+ end: repr.length
1332
+ };
1333
+ const _bind$2 = moonbitlang$core$string$$StringView$find(_x$2, {
1334
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5393,
1335
+ start: 0,
1336
+ end: 1
1337
+ });
1338
+ if (_bind$2 === void 0) return $panic();
1339
+ else {
1340
+ const _pkg_end = _bind$2;
1341
+ const pkg = moonbitlang$core$string$$StringView$view$46$inner(_x$2, 0, _pkg_end);
1342
+ const _bind$3 = moonbitlang$core$string$$StringView$rev_find(_x$2, {
1343
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5387,
1344
+ start: 0,
1345
+ end: 1
1346
+ });
1347
+ if (_bind$3 === void 0) return $panic();
1348
+ else {
1349
+ const _start_loc_end = _bind$3;
1350
+ if ((_start_loc_end + 1 | 0) < (_x$2.end - _x$2.start | 0)) {
1351
+ const _bind$4 = moonbitlang$core$builtin$$parse$46$parse_loc$124$1093(moonbitlang$core$string$$StringView$view$46$inner(_x$2, _start_loc_end + 1 | 0, void 0));
1352
+ if (_bind$4 === void 0) return $panic();
1353
+ else {
1354
+ const _x$3 = _bind$4;
1355
+ const _end_line = _x$3._0;
1356
+ const _end_column = _x$3._1;
1357
+ const rest = moonbitlang$core$string$$StringView$view$46$inner(_x$2, 0, _start_loc_end);
1358
+ _L$2: {
1359
+ const _bind$5 = moonbitlang$core$string$$StringView$rev_find(rest, {
1360
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5374,
1361
+ start: 0,
1362
+ end: 1
1363
+ });
1364
+ if (_bind$5 === void 0) break _L$2;
1365
+ else {
1366
+ const _bind$6 = moonbitlang$core$string$$StringView$rev_find(moonbitlang$core$string$$StringView$view$46$inner(rest, 0, _bind$5), {
1367
+ str: moonbitlang$core$builtin$$parse$46$42$bind$124$5368,
1368
+ start: 0,
1369
+ end: 1
1370
+ });
1371
+ if (_bind$6 === void 0) break _L$2;
1372
+ else {
1373
+ const _filename_end = _bind$6;
1374
+ if ((_filename_end + 1 | 0) < (rest.end - rest.start | 0)) {
1375
+ const _bind$7 = moonbitlang$core$builtin$$parse$46$parse_loc$124$1093(moonbitlang$core$string$$StringView$view$46$inner(rest, _filename_end + 1 | 0, void 0));
1376
+ if (_bind$7 === void 0) return $panic();
1377
+ else {
1378
+ const _x$4 = _bind$7;
1379
+ const _start_line = _x$4._0;
1380
+ const _start_column = _x$4._1;
1381
+ if (_filename_end > (_pkg_end + 1 | 0)) return {
1382
+ pkg,
1383
+ filename: moonbitlang$core$string$$StringView$view$46$inner(rest, _pkg_end + 1 | 0, _filename_end),
1384
+ start_line: _start_line,
1385
+ start_column: _start_column,
1386
+ end_line: _end_line,
1387
+ end_column: _end_column
1388
+ };
1389
+ else return $panic();
1390
+ }
1391
+ } else return $panic();
1392
+ }
1393
+ }
1394
+ }
1395
+ return $panic();
1396
+ }
1397
+ } else return $panic();
1398
+ }
1399
+ }
1400
+ } else break _L;
1401
+ else break _L;
1402
+ return $panic();
1403
+ }
1404
+ function moonbitlang$core$builtin$$StringBuilder$write_object$2$(self, obj) {
1405
+ moonbitlang$core$builtin$$Show$output$2$(obj, {
1406
+ self,
1407
+ method_table: $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger
1408
+ });
1409
+ }
1410
+ function moonbitlang$core$builtin$$Logger$write_string$0$(self, str) {
1411
+ const _bind = self;
1412
+ _bind.val = `${_bind.val}${str}`;
1413
+ }
1414
+ function moonbitlang$core$builtin$$Compare$op_lt$9$(x, y) {
1415
+ return moonbitlang$core$builtin$$Compare$compare$8$(x, y) < 0;
1416
+ }
1417
+ function moonbitlang$core$builtin$$Compare$op_gt$9$(x, y) {
1418
+ return moonbitlang$core$builtin$$Compare$compare$8$(x, y) > 0;
1419
+ }
1420
+ function moonbitlang$core$builtin$$Compare$op_le$9$(x, y) {
1421
+ return moonbitlang$core$builtin$$Compare$compare$8$(x, y) <= 0;
1422
+ }
1423
+ function moonbitlang$core$builtin$$Compare$op_ge$9$(x, y) {
1424
+ return moonbitlang$core$builtin$$Compare$compare$8$(x, y) >= 0;
1425
+ }
1426
+ function moonbitlang$core$string$$String$sub$46$inner(self, start, end) {
1427
+ const len = self.length;
1428
+ let end$2;
1429
+ if (end === void 0) end$2 = len;
1430
+ else {
1431
+ const _end = end;
1432
+ end$2 = _end < 0 ? len + _end | 0 : _end;
1433
+ }
1434
+ const start$2 = start < 0 ? len + start | 0 : start;
1435
+ if (start$2 >= 0 && start$2 <= end$2 && end$2 <= len) {
1436
+ let _tmp;
1437
+ if (start$2 < len) {
1438
+ const _p = self.charCodeAt(start$2);
1439
+ _tmp = 56320 <= _p && _p <= 57343;
1440
+ } else _tmp = false;
1441
+ if (_tmp) return new Result$Err$1$(Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$InvalidIndex);
1442
+ let _tmp$2;
1443
+ if (end$2 < len) {
1444
+ const _p = self.charCodeAt(end$2);
1445
+ _tmp$2 = 56320 <= _p && _p <= 57343;
1446
+ } else _tmp$2 = false;
1447
+ if (_tmp$2) return new Result$Err$1$(Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$InvalidIndex);
1448
+ return new Result$Ok$1$({
1449
+ str: self,
1450
+ start: start$2,
1451
+ end: end$2
1452
+ });
1453
+ } else return new Result$Err$1$(Error$moonbitlang$47$core$47$builtin$46$CreatingViewError$46$IndexOutOfBounds);
1454
+ }
1455
+ function moonbitlang$core$builtin$$Logger$write_substring$1$(self, value, start, len) {
1456
+ let _tmp;
1457
+ _L: {
1458
+ _L$2: {
1459
+ const _bind = moonbitlang$core$string$$String$sub$46$inner(value, start, start + len | 0);
1460
+ if (_bind.$tag === 1) _tmp = _bind._0;
1461
+ else {
1462
+ _bind._0;
1463
+ break _L$2;
1464
+ }
1465
+ break _L;
1466
+ }
1467
+ _tmp = $panic();
1468
+ }
1469
+ moonbitlang$core$builtin$$Logger$write_view$0$(self, _tmp);
1470
+ }
1471
+ function moonbitlang$core$builtin$$Show$to_string$9$(self) {
1472
+ const logger = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1473
+ moonbitlang$core$builtin$$Show$output$8$(self, {
1474
+ self: logger,
1475
+ method_table: $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger
1476
+ });
1477
+ return logger.val;
1478
+ }
1479
+ function moonbitlang$core$builtin$$Show$to_string$7$(self) {
1480
+ const logger = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1481
+ moonbitlang$core$builtin$$Show$output$10$(self, {
1482
+ self: logger,
1483
+ method_table: $$$64$moonbitlang$47$core$47$builtin$46$StringBuilder$36$as$36$64$moonbitlang$47$core$47$builtin$46$Logger
1484
+ });
1485
+ return logger.val;
1486
+ }
1487
+ function moonbitlang$core$int$$Int$to_string$46$inner(self, radix) {
1488
+ return moonbitlang$core$builtin$$int_to_string_js(self, radix);
1489
+ }
1490
+ function moonbitlang$core$uint$$UInt$to_string$46$inner(self, radix) {
1491
+ return moonbitlang$core$builtin$$uint_to_string_js(self, radix);
1492
+ }
1493
+ function moonbitlang$core$uint64$$UInt64$to_string$46$inner(self, radix) {
1494
+ return moonbitlang$core$builtin$$uint64_to_string_js(self, radix);
1495
+ }
1496
+ function moonbitlang$core$builtin$$Show$to_string$3$(self) {
1497
+ return self.str.substring(self.start, self.end);
1498
+ }
1499
+ function moonbitlang$core$builtin$$Iterator$next$11$(self) {
1500
+ return self();
1501
+ }
1502
+ function moonbitlang$core$builtin$$Iterator$next$12$(self) {
1503
+ return self();
1504
+ }
1505
+ function moonbitlang$core$builtin$$Iterator$next$3$(self) {
1506
+ return self();
1507
+ }
1508
+ function moonbitlang$core$builtin$$Iterator$iter$11$(self) {
1509
+ return (yield_) => {
1510
+ while (true) {
1511
+ const _bind = moonbitlang$core$builtin$$Iterator$next$11$(self);
1512
+ if (_bind === void 0) return 1;
1513
+ else {
1514
+ if (yield_(_bind) === 1) {} else return 0;
1515
+ continue;
1516
+ }
1517
+ }
1518
+ };
1519
+ }
1520
+ function moonbitlang$core$builtin$$Iterator$iter$12$(self) {
1521
+ return (yield_) => {
1522
+ while (true) {
1523
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(self);
1524
+ if (_bind === -1) return 1;
1525
+ else {
1526
+ if (yield_(_bind) === 1) {} else return 0;
1527
+ continue;
1528
+ }
1529
+ }
1530
+ };
1531
+ }
1532
+ function moonbitlang$core$builtin$$Iterator$iter$3$(self) {
1533
+ return (yield_) => {
1534
+ while (true) {
1535
+ const _bind = moonbitlang$core$builtin$$Iterator$next$3$(self);
1536
+ if (_bind === void 0) return 1;
1537
+ else {
1538
+ if (yield_(_bind) === 1) {} else return 0;
1539
+ continue;
1540
+ }
1541
+ }
1542
+ };
1543
+ }
1544
+ function moonbitlang$core$string$$StringView$iterator(self) {
1545
+ const start = self.start;
1546
+ const end = self.end;
1547
+ const index = { val: start };
1548
+ const _p = () => {
1549
+ if (index.val < end) {
1550
+ const _tmp = self.str;
1551
+ const _tmp$2 = index.val;
1552
+ const c1 = _tmp.charCodeAt(_tmp$2);
1553
+ if (55296 <= c1 && c1 <= 56319 && (index.val + 1 | 0) < self.end) {
1554
+ const _tmp$3 = self.str;
1555
+ const _tmp$4 = index.val + 1 | 0;
1556
+ const c2 = _tmp$3.charCodeAt(_tmp$4);
1557
+ if (56320 <= c2 && c2 <= 57343) {
1558
+ index.val = index.val + 2 | 0;
1559
+ return moonbitlang$core$builtin$$code_point_of_surrogate_pair(c1, c2);
1560
+ }
1561
+ }
1562
+ index.val = index.val + 1 | 0;
1563
+ return c1;
1564
+ } else return -1;
1565
+ };
1566
+ return _p;
1567
+ }
1568
+ function moonbitlang$core$string$$StringView$iter(self) {
1569
+ return moonbitlang$core$builtin$$Iterator$iter$12$(moonbitlang$core$string$$StringView$iterator(self));
1570
+ }
1571
+ function moonbitlang$core$string$$String$view$46$inner(self, start_offset, end_offset) {
1572
+ let end_offset$2;
1573
+ if (end_offset === void 0) end_offset$2 = self.length;
1574
+ else end_offset$2 = end_offset;
1575
+ return start_offset >= 0 && start_offset <= end_offset$2 && end_offset$2 <= self.length ? {
1576
+ str: self,
1577
+ start: start_offset,
1578
+ end: end_offset$2
1579
+ } : moonbitlang$core$builtin$$abort$3$("Invalid index for View", "@moonbitlang/core/builtin:stringview.mbt:374:5-374:36");
1580
+ }
1581
+ function moonbitlang$core$string$$String$char_length_ge$46$inner(self, len, start_offset, end_offset) {
1582
+ let end_offset$2;
1583
+ if (end_offset === void 0) end_offset$2 = self.length;
1584
+ else end_offset$2 = end_offset;
1585
+ let _tmp = start_offset;
1586
+ let _tmp$2 = 0;
1587
+ while (true) {
1588
+ const index = _tmp;
1589
+ const count = _tmp$2;
1590
+ if (index < end_offset$2 && count < len) {
1591
+ const c1 = self.charCodeAt(index);
1592
+ if (55296 <= c1 && c1 <= 56319 && (index + 1 | 0) < end_offset$2) {
1593
+ const _tmp$3 = index + 1 | 0;
1594
+ const c2 = self.charCodeAt(_tmp$3);
1595
+ if (56320 <= c2 && c2 <= 57343) {
1596
+ _tmp = index + 2 | 0;
1597
+ _tmp$2 = count + 1 | 0;
1598
+ continue;
1599
+ } else moonbitlang$core$builtin$$abort$4$("invalid surrogate pair", "@moonbitlang/core/builtin:string.mbt:491:9-491:40");
1600
+ }
1601
+ _tmp = index + 1 | 0;
1602
+ _tmp$2 = count + 1 | 0;
1603
+ continue;
1604
+ } else return count >= len;
1605
+ }
1606
+ }
1607
+ function moonbitlang$core$string$$String$offset_of_nth_char_backward(self, n, start_offset, end_offset) {
1608
+ let char_count = 0;
1609
+ let utf16_offset = end_offset;
1610
+ while (true) if ((utf16_offset - 1 | 0) >= start_offset && char_count < n) {
1611
+ const _tmp = utf16_offset - 1 | 0;
1612
+ const c = self.charCodeAt(_tmp);
1613
+ if (56320 <= c && c <= 57343) utf16_offset = utf16_offset - 2 | 0;
1614
+ else utf16_offset = utf16_offset - 1 | 0;
1615
+ char_count = char_count + 1 | 0;
1616
+ continue;
1617
+ } else break;
1618
+ return char_count < n || utf16_offset < start_offset ? void 0 : utf16_offset;
1619
+ }
1620
+ function moonbitlang$core$string$$String$offset_of_nth_char_forward(self, n, start_offset, end_offset) {
1621
+ if (start_offset >= 0 && start_offset <= end_offset) {
1622
+ let utf16_offset = start_offset;
1623
+ let char_count = 0;
1624
+ while (true) if (utf16_offset < end_offset && char_count < n) {
1625
+ const _tmp = utf16_offset;
1626
+ const c = self.charCodeAt(_tmp);
1627
+ if (55296 <= c && c <= 56319) utf16_offset = utf16_offset + 2 | 0;
1628
+ else utf16_offset = utf16_offset + 1 | 0;
1629
+ char_count = char_count + 1 | 0;
1630
+ continue;
1631
+ } else break;
1632
+ return char_count < n || utf16_offset >= end_offset ? void 0 : utf16_offset;
1633
+ } else return moonbitlang$core$builtin$$abort$5$("Invalid start index", "@moonbitlang/core/builtin:string.mbt:366:5-366:33");
1634
+ }
1635
+ function moonbitlang$core$string$$String$offset_of_nth_char$46$inner(self, i, start_offset, end_offset) {
1636
+ let end_offset$2;
1637
+ if (end_offset === void 0) end_offset$2 = self.length;
1638
+ else end_offset$2 = end_offset;
1639
+ return i >= 0 ? moonbitlang$core$string$$String$offset_of_nth_char_forward(self, i, start_offset, end_offset$2) : moonbitlang$core$string$$String$offset_of_nth_char_backward(self, -i | 0, start_offset, end_offset$2);
1640
+ }
1641
+ function moonbitlang$core$builtin$$StringBuilder$write_iter(self, iter) {
1642
+ iter((ch) => {
1643
+ moonbitlang$core$builtin$$Logger$write_char$0$(self, ch);
1644
+ return 1;
1645
+ });
1646
+ }
1647
+ function moonbitlang$core$builtin$$Logger$write_view$0$(self, str) {
1648
+ const _bind = self;
1649
+ _bind.val = `${_bind.val}${moonbitlang$core$builtin$$Show$to_string$3$(str)}`;
1650
+ }
1651
+ function moonbitlang$core$string$$String$find(self, str) {
1652
+ return moonbitlang$core$string$$StringView$find({
1653
+ str: self,
1654
+ start: 0,
1655
+ end: self.length
1656
+ }, str);
1657
+ }
1658
+ function moonbitlang$core$string$$StringView$has_suffix(self, str) {
1659
+ const _bind = moonbitlang$core$string$$StringView$rev_find(self, str);
1660
+ if (_bind === void 0) return false;
1661
+ else return _bind === ((self.end - self.start | 0) - (str.end - str.start | 0) | 0);
1662
+ }
1663
+ function moonbitlang$core$string$$String$has_suffix(self, str) {
1664
+ return moonbitlang$core$string$$StringView$has_suffix({
1665
+ str: self,
1666
+ start: 0,
1667
+ end: self.length
1668
+ }, str);
1669
+ }
1670
+ function moonbitlang$core$string$$StringView$has_prefix(self, str) {
1671
+ const _bind = moonbitlang$core$string$$StringView$find(self, str);
1672
+ if (_bind === void 0) return false;
1673
+ else return _bind === 0;
1674
+ }
1675
+ function moonbitlang$core$string$$String$has_prefix(self, str) {
1676
+ return moonbitlang$core$string$$StringView$has_prefix({
1677
+ str: self,
1678
+ start: 0,
1679
+ end: self.length
1680
+ }, str);
1681
+ }
1682
+ function moonbitlang$core$array$$Array$push$11$(self, value) {
1683
+ moonbitlang$core$builtin$$JSArray$push(self, value);
1684
+ }
1685
+ function moonbitlang$core$array$$Array$push$13$(self, value) {
1686
+ moonbitlang$core$builtin$$JSArray$push(self, value);
1687
+ }
1688
+ function moonbitlang$core$array$$Array$push$3$(self, value) {
1689
+ moonbitlang$core$builtin$$JSArray$push(self, value);
1690
+ }
1691
+ function moonbitlang$core$string$$String$iterator(self) {
1692
+ const len = self.length;
1693
+ const index = { val: 0 };
1694
+ const _p = () => {
1695
+ if (index.val < len) {
1696
+ const _tmp = index.val;
1697
+ const c1 = self.charCodeAt(_tmp);
1698
+ if (55296 <= c1 && c1 <= 56319 && (index.val + 1 | 0) < len) {
1699
+ const _tmp$2 = index.val + 1 | 0;
1700
+ const c2 = self.charCodeAt(_tmp$2);
1701
+ if (56320 <= c2 && c2 <= 57343) {
1702
+ const c = moonbitlang$core$builtin$$code_point_of_surrogate_pair(c1, c2);
1703
+ index.val = index.val + 2 | 0;
1704
+ return c;
1705
+ }
1706
+ }
1707
+ index.val = index.val + 1 | 0;
1708
+ return c1;
1709
+ } else return -1;
1710
+ };
1711
+ return _p;
1712
+ }
1713
+ function moonbitlang$core$builtin$$Iter$run$11$(self, f) {
1714
+ return self(f);
1715
+ }
1716
+ function moonbitlang$core$builtin$$Show$to_string$12$(self) {
1717
+ return String.fromCodePoint(self);
1718
+ }
1719
+ function moonbitlang$core$string$$StringView$split(self, sep) {
1720
+ const sep_len = sep.end - sep.start | 0;
1721
+ if (sep_len === 0) {
1722
+ const _bind = moonbitlang$core$string$$StringView$iter(self);
1723
+ return (_p$1) => _bind((_p$2) => _p$1(moonbitlang$core$string$$String$view$46$inner(moonbitlang$core$builtin$$Show$to_string$12$(_p$2), 0, void 0)));
1724
+ }
1725
+ const remaining = { val: self };
1726
+ const _p = () => {
1727
+ const _bind = remaining.val;
1728
+ if (_bind === void 0) return;
1729
+ else {
1730
+ const _view = _bind;
1731
+ const _bind$2 = moonbitlang$core$string$$StringView$find(_view, sep);
1732
+ if (_bind$2 === void 0) {
1733
+ remaining.val = void 0;
1734
+ return _view;
1735
+ } else {
1736
+ const _end = _bind$2;
1737
+ remaining.val = moonbitlang$core$string$$StringView$view$46$inner(_view, _end + sep_len | 0, void 0);
1738
+ return moonbitlang$core$string$$StringView$view$46$inner(_view, 0, _end);
1739
+ }
1740
+ }
1741
+ };
1742
+ return moonbitlang$core$builtin$$Iterator$iter$3$(_p);
1743
+ }
1744
+ function moonbitlang$core$string$$String$split(self, sep) {
1745
+ return moonbitlang$core$string$$StringView$split({
1746
+ str: self,
1747
+ start: 0,
1748
+ end: self.length
1749
+ }, sep);
1750
+ }
1751
+ function moonbitlang$core$builtin$$Iter$each$14$(self, f) {
1752
+ const _foreach_result = { val: $64$moonbitlang$47$core$47$builtin$46$ForeachResult$Continue$2$ };
1753
+ self((a) => {
1754
+ f(a);
1755
+ return 1;
1756
+ });
1757
+ const _tmp = _foreach_result.val;
1758
+ switch (_tmp.$tag) {
1759
+ case 0: return;
1760
+ case 1:
1761
+ _tmp._0;
1762
+ return;
1763
+ case 2: return _tmp._0;
1764
+ case 3:
1765
+ $panic();
1766
+ return;
1767
+ default:
1768
+ $panic();
1769
+ return;
1770
+ }
1771
+ }
1772
+ function moonbitlang$core$builtin$$Iter$collect$3$(self) {
1773
+ const result = [];
1774
+ moonbitlang$core$builtin$$Iter$each$14$(self, (e) => {
1775
+ moonbitlang$core$array$$Array$push$3$(result, e);
1776
+ });
1777
+ return result;
1778
+ }
1779
+ function moonbitlang$core$string$$String$replace(self, old, new_) {
1780
+ const _bind = moonbitlang$core$string$$String$find(self, old);
1781
+ if (_bind === void 0) return self;
1782
+ else {
1783
+ const _end = _bind;
1784
+ const _self = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
1785
+ moonbitlang$core$builtin$$StringBuilder$write_iter(_self, moonbitlang$core$string$$StringView$iter(moonbitlang$core$string$$String$view$46$inner(self, 0, _end)));
1786
+ moonbitlang$core$builtin$$StringBuilder$write_iter(_self, moonbitlang$core$string$$StringView$iter(new_));
1787
+ moonbitlang$core$builtin$$StringBuilder$write_iter(_self, moonbitlang$core$string$$StringView$iter(moonbitlang$core$string$$String$view$46$inner(self, _end + (old.end - old.start | 0) | 0, void 0)));
1788
+ return _self.val;
1789
+ }
1790
+ }
1791
+ function moonbitlang$core$builtin$$Show$output$2$(self, logger) {
1792
+ logger.method_table.method_0(logger.self, moonbitlang$core$int$$Int$to_string$46$inner(self, 10));
1793
+ }
1794
+ function moonbitlang$core$builtin$$Show$output$8$(self, logger) {
1795
+ logger.method_table.method_0(logger.self, moonbitlang$core$uint64$$UInt64$to_string$46$inner(self, 10));
1796
+ }
1797
+ function moonbitlang$core$array$$ArrayView$iterator$11$(self) {
1798
+ const i = { val: 0 };
1799
+ const _p = () => {
1800
+ if (i.val < (self.end - self.start | 0)) {
1801
+ const elem = self.buf[self.start + i.val | 0];
1802
+ i.val = i.val + 1 | 0;
1803
+ return elem;
1804
+ } else return;
1805
+ };
1806
+ return _p;
1807
+ }
1808
+ function moonbitlang$core$array$$Array$iterator$11$(self) {
1809
+ return moonbitlang$core$array$$ArrayView$iterator$11$({
1810
+ buf: self,
1811
+ start: 0,
1812
+ end: self.length
1813
+ });
1814
+ }
1815
+ function moonbitlang$core$array$$Array$iter$11$(self) {
1816
+ return moonbitlang$core$builtin$$Iterator$iter$11$(moonbitlang$core$array$$Array$iterator$11$(self));
1817
+ }
1818
+ function moonbitlang$core$builtin$$MyInt64$extend_i32_u(value) {
1819
+ return {
1820
+ hi: 0,
1821
+ lo: value
1822
+ };
1823
+ }
1824
+ function moonbitlang$core$uint64$$UInt64$extend_uint(value) {
1825
+ return moonbitlang$core$builtin$$MyInt64$extend_i32_u(value);
1826
+ }
1827
+ function moonbitlang$core$uint$$UInt$to_uint64(self) {
1828
+ return moonbitlang$core$uint64$$UInt64$extend_uint(self);
1829
+ }
1830
+ function moonbitlang$core$builtin$$Iter$any$11$(self, f) {
1831
+ return moonbitlang$core$builtin$$op_notequal$6$(moonbitlang$core$builtin$$Iter$run$11$(self, (k) => f(k) ? 0 : 1), 1);
1832
+ }
1833
+ function moonbitlang$core$uint64$$UInt64$to_int(self) {
1834
+ return self.lo;
1835
+ }
1836
+ function moonbitlang$core$builtin$$MyInt64$add_hi_lo(self, bhi, blo) {
1837
+ const _ahi = self.hi;
1838
+ const _alo = self.lo;
1839
+ const lo = _alo + blo | 0;
1840
+ const s = lo >> 31;
1841
+ const as_ = _alo >> 31;
1842
+ const bs = blo >> 31;
1843
+ const c = (as_ & bs | ~s & (as_ ^ bs)) & 1;
1844
+ return {
1845
+ hi: (_ahi + bhi | 0) + c | 0,
1846
+ lo
1847
+ };
1848
+ }
1849
+ function moonbitlang$core$builtin$$Add$add$15$(self, other) {
1850
+ return moonbitlang$core$builtin$$MyInt64$add_hi_lo(self, other.hi, other.lo);
1851
+ }
1852
+ function moonbitlang$core$builtin$$Sub$sub$15$(self, other) {
1853
+ return other.lo === 0 ? {
1854
+ hi: self.hi - other.hi | 0,
1855
+ lo: self.lo
1856
+ } : moonbitlang$core$builtin$$MyInt64$add_hi_lo(self, ~other.hi, ~other.lo + 1 | 0);
1857
+ }
1858
+ function moonbitlang$core$builtin$$Mul$mul$15$(self, other) {
1859
+ const _ahi = self.hi;
1860
+ const _alo = self.lo;
1861
+ const _bhi = other.hi;
1862
+ const _blo = other.lo;
1863
+ const ahi = _ahi;
1864
+ const alo = _alo;
1865
+ const bhi = _bhi;
1866
+ const blo = _blo;
1867
+ const a48 = ahi >>> 16 | 0;
1868
+ const a32 = ahi & 65535;
1869
+ const a16 = alo >>> 16 | 0;
1870
+ const a00 = alo & 65535;
1871
+ const b48 = bhi >>> 16 | 0;
1872
+ const b32 = bhi & 65535;
1873
+ const b16 = blo >>> 16 | 0;
1874
+ const b00 = blo & 65535;
1875
+ const c00 = Math.imul(a00, b00) | 0;
1876
+ const c16 = c00 >>> 16 | 0;
1877
+ const c00$2 = c00 & 65535;
1878
+ const c16$2 = (c16 >>> 0) + ((Math.imul(a16, b00) | 0) >>> 0) | 0;
1879
+ const c32 = c16$2 >>> 16 | 0;
1880
+ const c16$4 = ((c16$2 & 65535) >>> 0) + ((Math.imul(a00, b16) | 0) >>> 0) | 0;
1881
+ const c32$2 = (c32 >>> 0) + ((c16$4 >>> 16 | 0) >>> 0) | 0;
1882
+ const c16$5 = c16$4 & 65535;
1883
+ const c32$3 = (c32$2 >>> 0) + ((Math.imul(a32, b00) | 0) >>> 0) | 0;
1884
+ const c48 = c32$3 >>> 16 | 0;
1885
+ const c32$5 = ((c32$3 & 65535) >>> 0) + ((Math.imul(a16, b16) | 0) >>> 0) | 0;
1886
+ const c48$2 = (c48 >>> 0) + ((c32$5 >>> 16 | 0) >>> 0) | 0;
1887
+ const c32$7 = ((c32$5 & 65535) >>> 0) + ((Math.imul(a00, b32) | 0) >>> 0) | 0;
1888
+ const c48$3 = (c48$2 >>> 0) + ((c32$7 >>> 16 | 0) >>> 0) | 0;
1889
+ const c32$8 = c32$7 & 65535;
1890
+ return {
1891
+ hi: (((((((((c48$3 >>> 0) + ((Math.imul(a48, b00) | 0) >>> 0) | 0) >>> 0) + ((Math.imul(a32, b16) | 0) >>> 0) | 0) >>> 0) + ((Math.imul(a16, b32) | 0) >>> 0) | 0) >>> 0) + ((Math.imul(a00, b48) | 0) >>> 0) | 0) & 65535) << 16 | c32$8,
1892
+ lo: c16$5 << 16 | c00$2
1893
+ };
1894
+ }
1895
+ function moonbitlang$core$builtin$$try_get_int64_wasm_helper() {
1896
+ if (moonbitlang$core$builtin$$wasm_helper_cache.tried) return !(moonbitlang$core$builtin$$wasm_helper_cache.exports === void 0);
1897
+ moonbitlang$core$builtin$$wasm_helper_cache.tried = true;
1898
+ moonbitlang$core$builtin$$wasm_helper_cache.exports = moonbitlang$core$builtin$$try_init_wasm_helper();
1899
+ return !(moonbitlang$core$builtin$$wasm_helper_cache.exports === void 0);
1900
+ }
1901
+ function moonbitlang$core$builtin$$MyInt64$div_u(self, other) {
1902
+ if (!(other.hi === 0 && other.lo === 0)) {
1903
+ if (!moonbitlang$core$builtin$$try_get_int64_wasm_helper()) return moonbitlang$core$builtin$$MyInt64$div_u_bigint(self, other);
1904
+ const _bind = moonbitlang$core$builtin$$wasm_helper_cache.exports;
1905
+ if (_bind === void 0) return $panic();
1906
+ else {
1907
+ const _exports = _bind;
1908
+ const _ahi = self.hi;
1909
+ const _alo = self.lo;
1910
+ const _bhi = other.hi;
1911
+ const _blo = other.lo;
1912
+ const _func = _exports.div_u;
1913
+ const lo = _func(_alo, _ahi, _blo, _bhi);
1914
+ const _func$2 = _exports.get_high;
1915
+ return {
1916
+ hi: _func$2(),
1917
+ lo
1918
+ };
1919
+ }
1920
+ } else return $panic();
1921
+ }
1922
+ function moonbitlang$core$builtin$$MyInt64$mod_u(self, other) {
1923
+ if (!(other.hi === 0 && other.lo === 0)) {
1924
+ if (!moonbitlang$core$builtin$$try_get_int64_wasm_helper()) return moonbitlang$core$builtin$$MyInt64$mod_u_bigint(self, other);
1925
+ const _bind = moonbitlang$core$builtin$$wasm_helper_cache.exports;
1926
+ if (_bind === void 0) return $panic();
1927
+ else {
1928
+ const _exports = _bind;
1929
+ const _ahi = self.hi;
1930
+ const _alo = self.lo;
1931
+ const _bhi = other.hi;
1932
+ const _blo = other.lo;
1933
+ const _func = _exports.rem_u;
1934
+ const lo = _func(_alo, _ahi, _blo, _bhi);
1935
+ const _func$2 = _exports.get_high;
1936
+ return {
1937
+ hi: _func$2(),
1938
+ lo
1939
+ };
1940
+ }
1941
+ } else return $panic();
1942
+ }
1943
+ function moonbitlang$core$builtin$$MyInt64$land(self, other) {
1944
+ return {
1945
+ hi: self.hi & other.hi,
1946
+ lo: self.lo & other.lo
1947
+ };
1948
+ }
1949
+ function moonbitlang$core$builtin$$MyInt64$lor(self, other) {
1950
+ return {
1951
+ hi: self.hi | other.hi,
1952
+ lo: self.lo | other.lo
1953
+ };
1954
+ }
1955
+ function moonbitlang$core$builtin$$MyInt64$lsl(self, shift) {
1956
+ const shift$2 = shift & 63;
1957
+ if (shift$2 === 0) return self;
1958
+ else if (shift$2 < 32) {
1959
+ const _hi = self.hi;
1960
+ const _lo = self.lo;
1961
+ const hi = _hi;
1962
+ const lo = _lo;
1963
+ return {
1964
+ hi: hi << shift$2 | (lo >>> (32 - shift$2 | 0) | 0),
1965
+ lo: lo << shift$2
1966
+ };
1967
+ } else return {
1968
+ hi: self.lo << (shift$2 - 32 | 0),
1969
+ lo: 0
1970
+ };
1971
+ }
1972
+ function moonbitlang$core$builtin$$MyInt64$lsr(self, shift) {
1973
+ const shift$2 = shift & 63;
1974
+ return shift$2 === 0 ? self : shift$2 < 32 ? {
1975
+ hi: self.hi >>> shift$2 | 0,
1976
+ lo: self.lo >>> shift$2 | self.hi << (32 - shift$2 | 0)
1977
+ } : {
1978
+ hi: 0,
1979
+ lo: self.hi >>> (shift$2 - 32 | 0) | 0
1980
+ };
1981
+ }
1982
+ function moonbitlang$core$double$$Double$reinterpret_as_uint64(self) {
1983
+ return moonbitlang$core$builtin$$MyInt64$reinterpret_double(self);
1984
+ }
1985
+ function moonbitlang$core$builtin$$Add$add$8$(self, other) {
1986
+ return moonbitlang$core$builtin$$Add$add$15$(self, other);
1987
+ }
1988
+ function moonbitlang$core$builtin$$Sub$sub$8$(self, other) {
1989
+ return moonbitlang$core$builtin$$Sub$sub$15$(self, other);
1990
+ }
1991
+ function moonbitlang$core$builtin$$Mul$mul$8$(self, other) {
1992
+ return moonbitlang$core$builtin$$Mul$mul$15$(self, other);
1993
+ }
1994
+ function moonbitlang$core$builtin$$Div$div$8$(self, other) {
1995
+ return moonbitlang$core$builtin$$MyInt64$div_u(self, other);
1996
+ }
1997
+ function moonbitlang$core$builtin$$Mod$mod$8$(self, other) {
1998
+ return moonbitlang$core$builtin$$MyInt64$mod_u(self, other);
1999
+ }
2000
+ function moonbitlang$core$builtin$$Compare$compare$8$(self, other) {
2001
+ return moonbitlang$core$builtin$$MyInt64$compare_u(self, other);
2002
+ }
2003
+ function moonbitlang$core$builtin$$Eq$equal$8$(self, other) {
2004
+ const _p = self;
2005
+ const _p$2 = other;
2006
+ return _p.hi === _p$2.hi && _p.lo === _p$2.lo;
2007
+ }
2008
+ function moonbitlang$core$builtin$$BitAnd$land$8$(self, other) {
2009
+ return moonbitlang$core$builtin$$MyInt64$land(self, other);
2010
+ }
2011
+ function moonbitlang$core$builtin$$BitOr$lor$8$(self, other) {
2012
+ return moonbitlang$core$builtin$$MyInt64$lor(self, other);
2013
+ }
2014
+ function moonbitlang$core$builtin$$Shl$shl$8$(self, shift) {
2015
+ return moonbitlang$core$builtin$$MyInt64$lsl(self, shift);
2016
+ }
2017
+ function moonbitlang$core$builtin$$Shr$shr$8$(self, shift) {
2018
+ return moonbitlang$core$builtin$$MyInt64$lsr(self, shift);
2019
+ }
2020
+ function moonbitlang$core$double$$Double$to_int(self) {
2021
+ return self !== self ? 0 : self >= 2147483647 ? 2147483647 : self <= -2147483648 ? -2147483648 : self | 0;
2022
+ }
2023
+ function moonbitlang$core$builtin$$Show$output$16$(self, logger) {
2024
+ const pkg = self.pkg;
2025
+ const _bind = moonbitlang$core$string$$StringView$find(pkg, {
2026
+ str: moonbitlang$core$builtin$$output$46$42$bind$124$8198,
2027
+ start: 0,
2028
+ end: 1
2029
+ });
2030
+ let _bind$2;
2031
+ if (_bind === void 0) _bind$2 = {
2032
+ _0: pkg,
2033
+ _1: void 0
2034
+ };
2035
+ else {
2036
+ const _first_slash = _bind;
2037
+ const _bind$3 = moonbitlang$core$string$$StringView$find(moonbitlang$core$string$$StringView$view$46$inner(pkg, _first_slash + 1 | 0, void 0), {
2038
+ str: moonbitlang$core$builtin$$output$46$42$bind$124$8192,
2039
+ start: 0,
2040
+ end: 1
2041
+ });
2042
+ if (_bind$3 === void 0) _bind$2 = {
2043
+ _0: pkg,
2044
+ _1: void 0
2045
+ };
2046
+ else {
2047
+ const _second_slash = _bind$3;
2048
+ const module_name_end = (_first_slash + 1 | 0) + _second_slash | 0;
2049
+ _bind$2 = {
2050
+ _0: moonbitlang$core$string$$StringView$view$46$inner(pkg, 0, module_name_end),
2051
+ _1: moonbitlang$core$string$$StringView$view$46$inner(pkg, module_name_end + 1 | 0, void 0)
2052
+ };
2053
+ }
2054
+ }
2055
+ const _module_name = _bind$2._0;
2056
+ const _package_name = _bind$2._1;
2057
+ if (_package_name === void 0) {} else {
2058
+ const _pkg_name = _package_name;
2059
+ logger.method_table.method_2(logger.self, _pkg_name);
2060
+ logger.method_table.method_3(logger.self, 47);
2061
+ }
2062
+ logger.method_table.method_2(logger.self, self.filename);
2063
+ logger.method_table.method_3(logger.self, 58);
2064
+ logger.method_table.method_2(logger.self, self.start_line);
2065
+ logger.method_table.method_3(logger.self, 58);
2066
+ logger.method_table.method_2(logger.self, self.start_column);
2067
+ logger.method_table.method_3(logger.self, 45);
2068
+ logger.method_table.method_2(logger.self, self.end_line);
2069
+ logger.method_table.method_3(logger.self, 58);
2070
+ logger.method_table.method_2(logger.self, self.end_column);
2071
+ logger.method_table.method_3(logger.self, 64);
2072
+ logger.method_table.method_2(logger.self, _module_name);
2073
+ }
2074
+ function moonbitlang$core$builtin$$Show$output$10$(self, logger) {
2075
+ moonbitlang$core$builtin$$Show$output$16$(moonbitlang$core$builtin$$SourceLocRepr$parse(self), logger);
2076
+ }
2077
+ function moonbitlang$core$double$internal$ryu$$copy_special_str(sign, exponent, mantissa) {
2078
+ if (mantissa) return "NaN";
2079
+ const s = sign ? "-" : "";
2080
+ if (exponent) return `${s}Infinity`;
2081
+ return `${s}0.0`;
2082
+ }
2083
+ function moonbitlang$core$double$internal$ryu$$string_from_bytes(bytes, from, to) {
2084
+ const buf = moonbitlang$core$builtin$$StringBuilder$new$46$inner(bytes.length);
2085
+ let _tmp = from;
2086
+ while (true) {
2087
+ const i = _tmp;
2088
+ if (i < to) {
2089
+ $bound_check(bytes, i);
2090
+ const _p = bytes[i];
2091
+ moonbitlang$core$builtin$$Logger$write_char$0$(buf, _p);
2092
+ _tmp = i + 1 | 0;
2093
+ continue;
2094
+ } else break;
2095
+ }
2096
+ return buf.val;
2097
+ }
2098
+ function moonbitlang$core$double$internal$ryu$$umul128(a, b) {
2099
+ const aLo = moonbitlang$core$builtin$$BitAnd$land$8$(a, $4294967295L);
2100
+ const aHi = moonbitlang$core$builtin$$Shr$shr$8$(a, 32);
2101
+ const bLo = moonbitlang$core$builtin$$BitAnd$land$8$(b, $4294967295L);
2102
+ const bHi = moonbitlang$core$builtin$$Shr$shr$8$(b, 32);
2103
+ const x = moonbitlang$core$builtin$$Mul$mul$8$(aLo, bLo);
2104
+ const y = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Mul$mul$8$(aHi, bLo), moonbitlang$core$builtin$$Shr$shr$8$(x, 32));
2105
+ const z = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Mul$mul$8$(aLo, bHi), moonbitlang$core$builtin$$BitAnd$land$8$(y, $4294967295L));
2106
+ const w = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Mul$mul$8$(aHi, bHi), moonbitlang$core$builtin$$Shr$shr$8$(y, 32)), moonbitlang$core$builtin$$Shr$shr$8$(z, 32));
2107
+ return {
2108
+ _0: moonbitlang$core$builtin$$Mul$mul$8$(a, b),
2109
+ _1: w
2110
+ };
2111
+ }
2112
+ function moonbitlang$core$double$internal$ryu$$shiftright128(lo, hi, dist) {
2113
+ return moonbitlang$core$builtin$$BitOr$lor$8$(moonbitlang$core$builtin$$Shl$shl$8$(hi, 64 - dist | 0), moonbitlang$core$builtin$$Shr$shr$8$(lo, dist));
2114
+ }
2115
+ function moonbitlang$core$double$internal$ryu$$pow5Factor(value) {
2116
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value, $5L), $0L)) return 0;
2117
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value, $25L), $0L)) return 1;
2118
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value, $125L), $0L)) return 2;
2119
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value, $625L), $0L)) return 3;
2120
+ let count = 4;
2121
+ let value$2 = moonbitlang$core$builtin$$Div$div$8$(value, $625L);
2122
+ while (true) if (moonbitlang$core$builtin$$Compare$op_gt$9$(value$2, $0L)) {
2123
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Mod$mod$8$(value$2, $5L), $0L)) return count;
2124
+ value$2 = moonbitlang$core$builtin$$Div$div$8$(value$2, $5L);
2125
+ count = count + 1 | 0;
2126
+ continue;
2127
+ } else break;
2128
+ return moonbitlang$core$builtin$$abort$2$(`IllegalArgumentException ${moonbitlang$core$builtin$$Show$to_string$9$(value$2)}`, "@moonbitlang/core/double/internal/ryu:ryu.mbt:116:3-116:45");
2129
+ }
2130
+ function moonbitlang$core$double$internal$ryu$$multipleOfPowerOf5(value, p) {
2131
+ return moonbitlang$core$double$internal$ryu$$pow5Factor(value) >= p;
2132
+ }
2133
+ function moonbitlang$core$double$internal$ryu$$multipleOfPowerOf2(value, p) {
2134
+ return moonbitlang$core$builtin$$Eq$equal$8$(moonbitlang$core$builtin$$BitAnd$land$8$(value, moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, p), $1L)), $0L);
2135
+ }
2136
+ function moonbitlang$core$double$internal$ryu$$mulShiftAll64(m, mul, j, mmShift) {
2137
+ const _mul0 = mul._0;
2138
+ const _mul1 = mul._1;
2139
+ const m$2 = moonbitlang$core$builtin$$Shl$shl$8$(m, 1);
2140
+ const _bind = moonbitlang$core$double$internal$ryu$$umul128(m$2, _mul0);
2141
+ const _lo = _bind._0;
2142
+ const _tmp = _bind._1;
2143
+ const _bind$2 = moonbitlang$core$double$internal$ryu$$umul128(m$2, _mul1);
2144
+ const _lo2 = _bind$2._0;
2145
+ const _hi2 = _bind$2._1;
2146
+ const mid = moonbitlang$core$builtin$$Add$add$8$(_tmp, _lo2);
2147
+ const hi = moonbitlang$core$builtin$$Add$add$8$(_hi2, moonbitlang$core$builtin$$Compare$op_lt$9$(mid, _tmp) ? $1L : $0L);
2148
+ const lo2 = moonbitlang$core$builtin$$Add$add$8$(_lo, _mul0);
2149
+ const mid2 = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Add$add$8$(mid, _mul1), moonbitlang$core$builtin$$Compare$op_lt$9$(lo2, _lo) ? $1L : $0L);
2150
+ const vp = moonbitlang$core$double$internal$ryu$$shiftright128(mid2, moonbitlang$core$builtin$$Add$add$8$(hi, moonbitlang$core$builtin$$Compare$op_lt$9$(mid2, mid) ? $1L : $0L), (j - 64 | 0) - 1 | 0);
2151
+ let vm = $0L;
2152
+ if (mmShift) {
2153
+ const lo3 = moonbitlang$core$builtin$$Sub$sub$8$(_lo, _mul0);
2154
+ const mid3 = moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Sub$sub$8$(mid, _mul1), moonbitlang$core$builtin$$Compare$op_lt$9$(_lo, lo3) ? $1L : $0L);
2155
+ vm = moonbitlang$core$double$internal$ryu$$shiftright128(mid3, moonbitlang$core$builtin$$Sub$sub$8$(hi, moonbitlang$core$builtin$$Compare$op_lt$9$(mid, mid3) ? $1L : $0L), (j - 64 | 0) - 1 | 0);
2156
+ } else {
2157
+ const lo3 = moonbitlang$core$builtin$$Add$add$8$(_lo, _lo);
2158
+ const mid3 = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Add$add$8$(mid, mid), moonbitlang$core$builtin$$Compare$op_lt$9$(lo3, _lo) ? $1L : $0L);
2159
+ const hi3 = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$builtin$$Add$add$8$(hi, hi), moonbitlang$core$builtin$$Compare$op_lt$9$(mid3, mid) ? $1L : $0L);
2160
+ const lo4 = moonbitlang$core$builtin$$Sub$sub$8$(lo3, _mul0);
2161
+ const mid4 = moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Sub$sub$8$(mid3, _mul1), moonbitlang$core$builtin$$Compare$op_lt$9$(lo3, lo4) ? $1L : $0L);
2162
+ vm = moonbitlang$core$double$internal$ryu$$shiftright128(mid4, moonbitlang$core$builtin$$Sub$sub$8$(hi3, moonbitlang$core$builtin$$Compare$op_lt$9$(mid3, mid4) ? $1L : $0L), j - 64 | 0);
2163
+ }
2164
+ return {
2165
+ _0: moonbitlang$core$double$internal$ryu$$shiftright128(mid, hi, (j - 64 | 0) - 1 | 0),
2166
+ _1: vp,
2167
+ _2: vm
2168
+ };
2169
+ }
2170
+ function moonbitlang$core$double$internal$ryu$$double_computePow5(i) {
2171
+ const base = i / 26 | 0;
2172
+ const base2 = Math.imul(base, 26) | 0;
2173
+ const offset = i - base2 | 0;
2174
+ const _p = Math.imul(base, 2) | 0;
2175
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2, _p);
2176
+ const mul0 = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2[_p];
2177
+ const _p$2 = (Math.imul(base, 2) | 0) + 1 | 0;
2178
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2, _p$2);
2179
+ const mul1 = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_SPLIT2[_p$2];
2180
+ if (offset === 0) return {
2181
+ _0: mul0,
2182
+ _1: mul1
2183
+ };
2184
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE, offset);
2185
+ const m = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE[offset];
2186
+ const _bind = moonbitlang$core$double$internal$ryu$$umul128(m, mul1);
2187
+ const _low1 = _bind._0;
2188
+ const _high1 = _bind._1;
2189
+ const _bind$2 = moonbitlang$core$double$internal$ryu$$umul128(m, mul0);
2190
+ const _low0 = _bind$2._0;
2191
+ const _high0 = _bind$2._1;
2192
+ const sum = moonbitlang$core$builtin$$Add$add$8$(_high0, _low1);
2193
+ let high1 = _high1;
2194
+ if (moonbitlang$core$builtin$$Compare$op_lt$9$(sum, _high0)) high1 = moonbitlang$core$builtin$$Add$add$8$(high1, $1L);
2195
+ const delta = (((Math.imul(i, 1217359) | 0) >>> 19 | 0) + 1 | 0) - (((Math.imul(base2, 1217359) | 0) >>> 19 | 0) + 1 | 0) | 0;
2196
+ const _tmp = moonbitlang$core$double$internal$ryu$$shiftright128(_low0, sum, delta);
2197
+ const _p$3 = i / 16 | 0;
2198
+ $bound_check(moonbitlang$core$double$internal$ryu$$gPOW5_OFFSETS, _p$3);
2199
+ return {
2200
+ _0: moonbitlang$core$builtin$$Add$add$8$(_tmp, moonbitlang$core$uint$$UInt$to_uint64(moonbitlang$core$double$internal$ryu$$gPOW5_OFFSETS[_p$3] >>> (i % 16 << 1) & 3)),
2201
+ _1: moonbitlang$core$double$internal$ryu$$shiftright128(sum, high1, delta)
2202
+ };
2203
+ }
2204
+ function moonbitlang$core$double$internal$ryu$$double_computeInvPow5(i) {
2205
+ const base = ((i + 26 | 0) - 1 | 0) / 26 | 0;
2206
+ const base2 = Math.imul(base, 26) | 0;
2207
+ const offset = base2 - i | 0;
2208
+ const _p = Math.imul(base, 2) | 0;
2209
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2, _p);
2210
+ const mul0 = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2[_p];
2211
+ const _p$2 = (Math.imul(base, 2) | 0) + 1 | 0;
2212
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2, _p$2);
2213
+ const mul1 = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_INV_SPLIT2[_p$2];
2214
+ if (offset === 0) return {
2215
+ _0: mul0,
2216
+ _1: mul1
2217
+ };
2218
+ $bound_check(moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE, offset);
2219
+ const m = moonbitlang$core$double$internal$ryu$$gDOUBLE_POW5_TABLE[offset];
2220
+ const _bind = moonbitlang$core$double$internal$ryu$$umul128(m, mul1);
2221
+ const _low1 = _bind._0;
2222
+ const _high1 = _bind._1;
2223
+ const _bind$2 = moonbitlang$core$double$internal$ryu$$umul128(m, mul0);
2224
+ const _low0 = _bind$2._0;
2225
+ const _high0 = _bind$2._1;
2226
+ const sum = moonbitlang$core$builtin$$Add$add$8$(_high0, _low1);
2227
+ let high1 = _high1;
2228
+ if (moonbitlang$core$builtin$$Compare$op_lt$9$(sum, _high0)) high1 = moonbitlang$core$builtin$$Add$add$8$(high1, $1L);
2229
+ const delta = (((Math.imul(base2, 1217359) | 0) >>> 19 | 0) + 1 | 0) - (((Math.imul(i, 1217359) | 0) >>> 19 | 0) + 1 | 0) | 0;
2230
+ const _tmp = moonbitlang$core$builtin$$Add$add$8$(moonbitlang$core$double$internal$ryu$$shiftright128(_low0, sum, delta), $1L);
2231
+ const _p$3 = i / 16 | 0;
2232
+ $bound_check(moonbitlang$core$double$internal$ryu$$gPOW5_INV_OFFSETS, _p$3);
2233
+ return {
2234
+ _0: moonbitlang$core$builtin$$Add$add$8$(_tmp, moonbitlang$core$uint$$UInt$to_uint64(moonbitlang$core$double$internal$ryu$$gPOW5_INV_OFFSETS[_p$3] >>> (i % 16 << 1) & 3)),
2235
+ _1: moonbitlang$core$double$internal$ryu$$shiftright128(sum, high1, delta)
2236
+ };
2237
+ }
2238
+ function moonbitlang$core$double$internal$ryu$$decimal_length17(v) {
2239
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000000000000000L)) return 17;
2240
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000000000000000L)) return 16;
2241
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100000000000000L)) return 15;
2242
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000000000000L)) return 14;
2243
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000000000000L)) return 13;
2244
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100000000000L)) return 12;
2245
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000000000L)) return 11;
2246
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000000000L)) return 10;
2247
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100000000L)) return 9;
2248
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000000L)) return 8;
2249
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000000L)) return 7;
2250
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100000L)) return 6;
2251
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10000L)) return 5;
2252
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $1000L)) return 4;
2253
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $100L)) return 3;
2254
+ if (moonbitlang$core$builtin$$Compare$op_ge$9$(v, $10L)) return 2;
2255
+ return 1;
2256
+ }
2257
+ function moonbitlang$core$double$internal$ryu$$d2d(ieeeMantissa, ieeeExponent) {
2258
+ let e2 = 0;
2259
+ let m2 = $0L;
2260
+ if (ieeeExponent === 0) {
2261
+ e2 = -1076;
2262
+ m2 = ieeeMantissa;
2263
+ } else {
2264
+ e2 = ((ieeeExponent - 1023 | 0) - 52 | 0) - 2 | 0;
2265
+ m2 = moonbitlang$core$builtin$$BitOr$lor$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, 52), ieeeMantissa);
2266
+ }
2267
+ const even = moonbitlang$core$builtin$$Eq$equal$8$(moonbitlang$core$builtin$$BitAnd$land$8$(m2, $1L), $0L);
2268
+ const mv = moonbitlang$core$builtin$$Mul$mul$8$($4L, m2);
2269
+ const mmShift = moonbitlang$core$builtin$$op_notequal$8$(ieeeMantissa, $0L) || ieeeExponent >>> 0 <= 1;
2270
+ let vr = $0L;
2271
+ let vp = $0L;
2272
+ let vm = $0L;
2273
+ let e10 = 0;
2274
+ let vmIsTrailingZeros = false;
2275
+ let vrIsTrailingZeros = false;
2276
+ if (e2 >= 0) {
2277
+ const _p = e2;
2278
+ const q = ((Math.imul(_p, 78913) | 0) >>> 18 | 0) - (e2 > 3 ? 1 : 0) | 0;
2279
+ e10 = q;
2280
+ const k = (125 + (((Math.imul(q, 1217359) | 0) >>> 19 | 0) + 1 | 0) | 0) - 1 | 0;
2281
+ const i = ((-e2 | 0) + q | 0) + k | 0;
2282
+ const pow5 = moonbitlang$core$double$internal$ryu$$double_computeInvPow5(q);
2283
+ const _bind = moonbitlang$core$double$internal$ryu$$mulShiftAll64(m2, pow5, i, mmShift);
2284
+ const _vrOut = _bind._0;
2285
+ const _vpOut = _bind._1;
2286
+ const _vmOut = _bind._2;
2287
+ vr = _vrOut;
2288
+ vp = _vpOut;
2289
+ vm = _vmOut;
2290
+ if (q <= 21) if ((moonbitlang$core$uint64$$UInt64$to_int(mv) - (Math.imul(5, moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$Div$div$8$(mv, $5L))) | 0) | 0) === 0) vrIsTrailingZeros = moonbitlang$core$double$internal$ryu$$multipleOfPowerOf5(mv, q);
2291
+ else if (even) vmIsTrailingZeros = moonbitlang$core$double$internal$ryu$$multipleOfPowerOf5(moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Sub$sub$8$(mv, $1L), mmShift ? $1L : $0L), q);
2292
+ else vp = moonbitlang$core$builtin$$Sub$sub$8$(vp, moonbitlang$core$double$internal$ryu$$multipleOfPowerOf5(moonbitlang$core$builtin$$Add$add$8$(mv, $2L), q) ? $1L : $0L);
2293
+ } else {
2294
+ const _p = -e2 | 0;
2295
+ const q = ((Math.imul(_p, 732923) | 0) >>> 20 | 0) - ((-e2 | 0) > 1 ? 1 : 0) | 0;
2296
+ e10 = q + e2 | 0;
2297
+ const i = (-e2 | 0) - q | 0;
2298
+ const j = q - ((((Math.imul(i, 1217359) | 0) >>> 19 | 0) + 1 | 0) - 125 | 0) | 0;
2299
+ const pow5 = moonbitlang$core$double$internal$ryu$$double_computePow5(i);
2300
+ const _bind = moonbitlang$core$double$internal$ryu$$mulShiftAll64(m2, pow5, j, mmShift);
2301
+ const _vrOut = _bind._0;
2302
+ const _vpOut = _bind._1;
2303
+ const _vmOut = _bind._2;
2304
+ vr = _vrOut;
2305
+ vp = _vpOut;
2306
+ vm = _vmOut;
2307
+ if (q <= 1) {
2308
+ vrIsTrailingZeros = true;
2309
+ if (even) vmIsTrailingZeros = (mmShift ? 1 : 0) === 1;
2310
+ else vp = moonbitlang$core$builtin$$Sub$sub$8$(vp, $1L);
2311
+ } else if (q < 63) vrIsTrailingZeros = moonbitlang$core$double$internal$ryu$$multipleOfPowerOf2(mv, q);
2312
+ }
2313
+ let removed = 0;
2314
+ let lastRemovedDigit = 0;
2315
+ let output = $0L;
2316
+ if (vmIsTrailingZeros || vrIsTrailingZeros) {
2317
+ while (true) {
2318
+ const vpDiv10 = moonbitlang$core$builtin$$Div$div$8$(vp, $10L);
2319
+ const vmDiv10 = moonbitlang$core$builtin$$Div$div$8$(vm, $10L);
2320
+ if (moonbitlang$core$builtin$$Compare$op_le$9$(vpDiv10, vmDiv10)) break;
2321
+ const vmMod10 = moonbitlang$core$uint64$$UInt64$to_int(vm) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vmDiv10)) | 0) | 0;
2322
+ const vrDiv10 = moonbitlang$core$builtin$$Div$div$8$(vr, $10L);
2323
+ const vrMod10 = moonbitlang$core$uint64$$UInt64$to_int(vr) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vrDiv10)) | 0) | 0;
2324
+ vmIsTrailingZeros = vmIsTrailingZeros && vmMod10 === 0;
2325
+ vrIsTrailingZeros = vrIsTrailingZeros && lastRemovedDigit === 0;
2326
+ lastRemovedDigit = vrMod10;
2327
+ vr = vrDiv10;
2328
+ vp = vpDiv10;
2329
+ vm = vmDiv10;
2330
+ removed = removed + 1 | 0;
2331
+ continue;
2332
+ }
2333
+ if (vmIsTrailingZeros) while (true) {
2334
+ const vmDiv10 = moonbitlang$core$builtin$$Div$div$8$(vm, $10L);
2335
+ if ((moonbitlang$core$uint64$$UInt64$to_int(vm) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vmDiv10)) | 0) | 0) !== 0) break;
2336
+ const vpDiv10 = moonbitlang$core$builtin$$Div$div$8$(vp, $10L);
2337
+ const vrDiv10 = moonbitlang$core$builtin$$Div$div$8$(vr, $10L);
2338
+ const vrMod10 = moonbitlang$core$uint64$$UInt64$to_int(vr) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vrDiv10)) | 0) | 0;
2339
+ vrIsTrailingZeros = vrIsTrailingZeros && lastRemovedDigit === 0;
2340
+ lastRemovedDigit = vrMod10;
2341
+ vr = vrDiv10;
2342
+ vp = vpDiv10;
2343
+ vm = vmDiv10;
2344
+ removed = removed + 1 | 0;
2345
+ continue;
2346
+ }
2347
+ if (vrIsTrailingZeros && lastRemovedDigit === 5 && moonbitlang$core$builtin$$Eq$equal$8$(moonbitlang$core$builtin$$Mod$mod$8$(vr, $2L), $0L)) lastRemovedDigit = 4;
2348
+ output = moonbitlang$core$builtin$$Add$add$8$(vr, moonbitlang$core$builtin$$Eq$equal$8$(vr, vm) && (!even || !vmIsTrailingZeros) || lastRemovedDigit >= 5 ? $1L : $0L);
2349
+ } else {
2350
+ let roundUp = false;
2351
+ const vpDiv100 = moonbitlang$core$builtin$$Div$div$8$(vp, $100L);
2352
+ const vmDiv100 = moonbitlang$core$builtin$$Div$div$8$(vm, $100L);
2353
+ if (moonbitlang$core$builtin$$Compare$op_gt$9$(vpDiv100, vmDiv100)) {
2354
+ const vrDiv100 = moonbitlang$core$builtin$$Div$div$8$(vr, $100L);
2355
+ roundUp = (moonbitlang$core$uint64$$UInt64$to_int(vr) - (Math.imul(100, moonbitlang$core$uint64$$UInt64$to_int(vrDiv100)) | 0) | 0) >= 50;
2356
+ vr = vrDiv100;
2357
+ vp = vpDiv100;
2358
+ vm = vmDiv100;
2359
+ removed = removed + 2 | 0;
2360
+ }
2361
+ while (true) {
2362
+ const vpDiv10 = moonbitlang$core$builtin$$Div$div$8$(vp, $10L);
2363
+ const vmDiv10 = moonbitlang$core$builtin$$Div$div$8$(vm, $10L);
2364
+ if (moonbitlang$core$builtin$$Compare$op_le$9$(vpDiv10, vmDiv10)) break;
2365
+ const vrDiv10 = moonbitlang$core$builtin$$Div$div$8$(vr, $10L);
2366
+ roundUp = (moonbitlang$core$uint64$$UInt64$to_int(vr) - (Math.imul(10, moonbitlang$core$uint64$$UInt64$to_int(vrDiv10)) | 0) | 0) >= 5;
2367
+ vr = vrDiv10;
2368
+ vp = vpDiv10;
2369
+ vm = vmDiv10;
2370
+ removed = removed + 1 | 0;
2371
+ continue;
2372
+ }
2373
+ output = moonbitlang$core$builtin$$Add$add$8$(vr, moonbitlang$core$builtin$$Eq$equal$8$(vr, vm) || roundUp ? $1L : $0L);
2374
+ }
2375
+ const exp = e10 + removed | 0;
2376
+ return {
2377
+ mantissa: output,
2378
+ exponent: exp
2379
+ };
2380
+ }
2381
+ function moonbitlang$core$double$internal$ryu$$to_chars(v, sign) {
2382
+ const result = $makebytes(25, 0);
2383
+ let index = 0;
2384
+ if (sign) {
2385
+ const _tmp = index;
2386
+ $bound_check(result, _tmp);
2387
+ result[_tmp] = 45;
2388
+ index = index + 1 | 0;
2389
+ }
2390
+ let output = v.mantissa;
2391
+ const olength = moonbitlang$core$double$internal$ryu$$decimal_length17(output);
2392
+ let exp = (v.exponent + olength | 0) - 1 | 0;
2393
+ if (!(exp >= -6 && exp < 21)) {
2394
+ const _end41 = olength - 1 | 0;
2395
+ let _tmp = 0;
2396
+ while (true) {
2397
+ const i = _tmp;
2398
+ if (i < _end41) {
2399
+ const c = moonbitlang$core$builtin$$Mod$mod$8$(output, $10L);
2400
+ output = moonbitlang$core$builtin$$Div$div$8$(output, $10L);
2401
+ const _tmp$2$1 = (index + olength | 0) - i | 0;
2402
+ $bound_check(result, _tmp$2$1);
2403
+ result[_tmp$2$1] = (48 + moonbitlang$core$uint64$$UInt64$to_int(c) | 0) & 255;
2404
+ _tmp = i + 1 | 0;
2405
+ continue;
2406
+ } else break;
2407
+ }
2408
+ const _tmp$2 = index;
2409
+ $bound_check(result, _tmp$2);
2410
+ result[_tmp$2] = (48 + (moonbitlang$core$uint64$$UInt64$to_int(output) % 10 | 0) | 0) & 255;
2411
+ if (olength > 1) {
2412
+ const _tmp$3$1 = index + 1 | 0;
2413
+ $bound_check(result, _tmp$3$1);
2414
+ result[_tmp$3$1] = 46;
2415
+ } else index = index - 1 | 0;
2416
+ index = index + (olength + 1 | 0) | 0;
2417
+ const _tmp$3 = index;
2418
+ $bound_check(result, _tmp$3);
2419
+ result[_tmp$3] = 101;
2420
+ index = index + 1 | 0;
2421
+ if (exp < 0) {
2422
+ const _tmp$4 = index;
2423
+ $bound_check(result, _tmp$4);
2424
+ result[_tmp$4] = 45;
2425
+ index = index + 1 | 0;
2426
+ exp = -exp | 0;
2427
+ } else {
2428
+ const _tmp$4 = index;
2429
+ $bound_check(result, _tmp$4);
2430
+ result[_tmp$4] = 43;
2431
+ index = index + 1 | 0;
2432
+ }
2433
+ if (exp >= 100) {
2434
+ const a = exp / 100 | 0;
2435
+ const b = (exp / 10 | 0) % 10 | 0;
2436
+ const c = exp % 10 | 0;
2437
+ const _tmp$4 = index;
2438
+ $bound_check(result, _tmp$4);
2439
+ result[_tmp$4] = (48 + a | 0) & 255;
2440
+ const _tmp$5 = index + 1 | 0;
2441
+ $bound_check(result, _tmp$5);
2442
+ result[_tmp$5] = (48 + b | 0) & 255;
2443
+ const _tmp$6 = index + 2 | 0;
2444
+ $bound_check(result, _tmp$6);
2445
+ result[_tmp$6] = (48 + c | 0) & 255;
2446
+ index = index + 3 | 0;
2447
+ } else if (exp >= 10) {
2448
+ const a = exp / 10 | 0;
2449
+ const b = exp % 10 | 0;
2450
+ const _tmp$4 = index;
2451
+ $bound_check(result, _tmp$4);
2452
+ result[_tmp$4] = (48 + a | 0) & 255;
2453
+ const _tmp$5 = index + 1 | 0;
2454
+ $bound_check(result, _tmp$5);
2455
+ result[_tmp$5] = (48 + b | 0) & 255;
2456
+ index = index + 2 | 0;
2457
+ } else {
2458
+ const _tmp$4 = index;
2459
+ $bound_check(result, _tmp$4);
2460
+ result[_tmp$4] = (48 + exp | 0) & 255;
2461
+ index = index + 1 | 0;
2462
+ }
2463
+ return moonbitlang$core$double$internal$ryu$$string_from_bytes(result, 0, index);
2464
+ } else {
2465
+ if (exp < 0) {
2466
+ const _tmp = index;
2467
+ $bound_check(result, _tmp);
2468
+ result[_tmp] = 48;
2469
+ index = index + 1 | 0;
2470
+ const _tmp$2 = index;
2471
+ $bound_check(result, _tmp$2);
2472
+ result[_tmp$2] = 46;
2473
+ index = index + 1 | 0;
2474
+ let _tmp$3 = -1;
2475
+ while (true) {
2476
+ const i = _tmp$3;
2477
+ if (i > exp) {
2478
+ const _tmp$4$1 = index;
2479
+ $bound_check(result, _tmp$4$1);
2480
+ result[_tmp$4$1] = 48;
2481
+ index = index + 1 | 0;
2482
+ _tmp$3 = i - 1 | 0;
2483
+ continue;
2484
+ } else break;
2485
+ }
2486
+ const current = index;
2487
+ let _tmp$4 = 0;
2488
+ while (true) {
2489
+ const i = _tmp$4;
2490
+ if (i < olength) {
2491
+ const _tmp$5 = ((current + olength | 0) - i | 0) - 1 | 0;
2492
+ $bound_check(result, _tmp$5);
2493
+ result[_tmp$5] = (48 + moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$Mod$mod$8$(output, $10L)) | 0) & 255;
2494
+ output = moonbitlang$core$builtin$$Div$div$8$(output, $10L);
2495
+ index = index + 1 | 0;
2496
+ _tmp$4 = i + 1 | 0;
2497
+ continue;
2498
+ } else break;
2499
+ }
2500
+ } else if ((exp + 1 | 0) >= olength) {
2501
+ let _tmp = 0;
2502
+ while (true) {
2503
+ const i = _tmp;
2504
+ if (i < olength) {
2505
+ const _tmp$2$1 = ((index + olength | 0) - i | 0) - 1 | 0;
2506
+ $bound_check(result, _tmp$2$1);
2507
+ result[_tmp$2$1] = (48 + moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$Mod$mod$8$(output, $10L)) | 0) & 255;
2508
+ output = moonbitlang$core$builtin$$Div$div$8$(output, $10L);
2509
+ _tmp = i + 1 | 0;
2510
+ continue;
2511
+ } else break;
2512
+ }
2513
+ index = index + olength | 0;
2514
+ const _end64 = exp + 1 | 0;
2515
+ let _tmp$2 = olength;
2516
+ while (true) {
2517
+ const i = _tmp$2;
2518
+ if (i < _end64) {
2519
+ const _tmp$3 = index;
2520
+ $bound_check(result, _tmp$3);
2521
+ result[_tmp$3] = 48;
2522
+ index = index + 1 | 0;
2523
+ _tmp$2 = i + 1 | 0;
2524
+ continue;
2525
+ } else break;
2526
+ }
2527
+ } else {
2528
+ let current = index + 1 | 0;
2529
+ let _tmp = 0;
2530
+ while (true) {
2531
+ const i = _tmp;
2532
+ if (i < olength) {
2533
+ if (((olength - i | 0) - 1 | 0) === exp) {
2534
+ const _tmp$2$1 = ((current + olength | 0) - i | 0) - 1 | 0;
2535
+ $bound_check(result, _tmp$2$1);
2536
+ result[_tmp$2$1] = 46;
2537
+ current = current - 1 | 0;
2538
+ }
2539
+ const _tmp$2 = ((current + olength | 0) - i | 0) - 1 | 0;
2540
+ $bound_check(result, _tmp$2);
2541
+ result[_tmp$2] = (48 + moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$Mod$mod$8$(output, $10L)) | 0) & 255;
2542
+ output = moonbitlang$core$builtin$$Div$div$8$(output, $10L);
2543
+ _tmp = i + 1 | 0;
2544
+ continue;
2545
+ } else break;
2546
+ }
2547
+ index = index + (olength + 1 | 0) | 0;
2548
+ }
2549
+ return moonbitlang$core$double$internal$ryu$$string_from_bytes(result, 0, index);
2550
+ }
2551
+ }
2552
+ function moonbitlang$core$double$internal$ryu$$d2d_small_int(ieeeMantissa, ieeeExponent) {
2553
+ const m2 = moonbitlang$core$builtin$$BitOr$lor$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, 52), ieeeMantissa);
2554
+ const e2 = (ieeeExponent - 1023 | 0) - 52 | 0;
2555
+ if (e2 > 0) return;
2556
+ if (e2 < -52) return;
2557
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$BitAnd$land$8$(m2, moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, -e2 | 0), $1L)), $0L)) return;
2558
+ return {
2559
+ mantissa: moonbitlang$core$builtin$$Shr$shr$8$(m2, -e2 | 0),
2560
+ exponent: 0
2561
+ };
2562
+ }
2563
+ function moonbitlang$core$double$internal$ryu$$ryu_to_string(val) {
2564
+ if (val === 0) return "0";
2565
+ const bits = moonbitlang$core$double$$Double$reinterpret_as_uint64(val);
2566
+ const ieeeSign = moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$BitAnd$land$8$(moonbitlang$core$builtin$$Shr$shr$8$(bits, 63), $1L), $0L);
2567
+ const ieeeMantissa = moonbitlang$core$builtin$$BitAnd$land$8$(bits, moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, 52), $1L));
2568
+ const ieeeExponent = moonbitlang$core$uint64$$UInt64$to_int(moonbitlang$core$builtin$$BitAnd$land$8$(moonbitlang$core$builtin$$Shr$shr$8$(bits, 52), moonbitlang$core$builtin$$Sub$sub$8$(moonbitlang$core$builtin$$Shl$shl$8$($1L, 11), $1L)));
2569
+ if (ieeeExponent === 2047 || ieeeExponent === 0 && moonbitlang$core$builtin$$Eq$equal$8$(ieeeMantissa, $0L)) return moonbitlang$core$double$internal$ryu$$copy_special_str(ieeeSign, ieeeExponent !== 0, moonbitlang$core$builtin$$op_notequal$8$(ieeeMantissa, $0L));
2570
+ let v = moonbitlang$core$double$internal$ryu$$ryu_to_string$46$record$47$728;
2571
+ const small = moonbitlang$core$double$internal$ryu$$d2d_small_int(ieeeMantissa, ieeeExponent);
2572
+ if (small === void 0) v = moonbitlang$core$double$internal$ryu$$d2d(ieeeMantissa, ieeeExponent);
2573
+ else {
2574
+ let x = small;
2575
+ while (true) {
2576
+ const q = moonbitlang$core$builtin$$Div$div$8$(x.mantissa, $10L);
2577
+ if (moonbitlang$core$builtin$$op_notequal$8$(moonbitlang$core$builtin$$Sub$sub$8$(x.mantissa, moonbitlang$core$builtin$$Mul$mul$8$($10L, q)), $0L)) break;
2578
+ x = {
2579
+ mantissa: q,
2580
+ exponent: x.exponent + 1 | 0
2581
+ };
2582
+ continue;
2583
+ }
2584
+ v = x;
2585
+ }
2586
+ return moonbitlang$core$double$internal$ryu$$to_chars(v, ieeeSign);
2587
+ }
2588
+ function moonbitlang$core$double$$Double$to_string(self) {
2589
+ return moonbitlang$core$double$internal$ryu$$ryu_to_string(self);
2590
+ }
2591
+ function mizchi$luna$luna$signal$$Signal$get$17$(self) {
2592
+ const _bind = mizchi$luna$luna$signal$$reactive_context.current_subscriber;
2593
+ if (_bind === void 0) {} else {
2594
+ const _subscriber = _bind;
2595
+ if (!moonbitlang$core$builtin$$Iter$any$11$(moonbitlang$core$array$$Array$iter$11$(self.subscribers), (s) => s.id === _subscriber.id)) moonbitlang$core$array$$Array$push$11$(self.subscribers, _subscriber);
2596
+ }
2597
+ return self.value;
2598
+ }
2599
+ function mizchi$luna$luna$signal$$Signal$get$18$(self) {
2600
+ const _bind = mizchi$luna$luna$signal$$reactive_context.current_subscriber;
2601
+ if (_bind === void 0) {} else {
2602
+ const _subscriber = _bind;
2603
+ if (!moonbitlang$core$builtin$$Iter$any$11$(moonbitlang$core$array$$Array$iter$11$(self.subscribers), (s) => s.id === _subscriber.id)) moonbitlang$core$array$$Array$push$11$(self.subscribers, _subscriber);
2604
+ }
2605
+ return self.value;
2606
+ }
2607
+ function mizchi$luna$luna$signal$$Signal$new$17$(initial) {
2608
+ return {
2609
+ value: initial,
2610
+ subscribers: []
2611
+ };
2612
+ }
2613
+ function mizchi$luna$luna$signal$$Signal$new$18$(initial) {
2614
+ return {
2615
+ value: initial,
2616
+ subscribers: []
2617
+ };
2618
+ }
2619
+ function mizchi$luna$luna$signal$$signal$17$(initial) {
2620
+ return mizchi$luna$luna$signal$$Signal$new$17$(initial);
2621
+ }
2622
+ function mizchi$luna$luna$signal$$signal$18$(initial) {
2623
+ return mizchi$luna$luna$signal$$Signal$new$18$(initial);
2624
+ }
2625
+ function mizchi$luna$luna$$handler$4$(f) {
2626
+ return { callback: f };
2627
+ }
2628
+ function mizchi$luna$luna$$h$4$(tag, attrs, children) {
2629
+ return new $64$mizchi$47$luna$47$luna$46$Node$Element$3$({
2630
+ tag,
2631
+ attrs,
2632
+ children
2633
+ });
2634
+ }
2635
+ function mizchi$luna$luna$$TriggerType$to_string(self) {
2636
+ switch (self.$tag) {
2637
+ case 0: return "load";
2638
+ case 1: return "idle";
2639
+ case 2: return "visible";
2640
+ case 3: return `media:${self._0}`;
2641
+ default: return "none";
2642
+ }
2643
+ }
2644
+ function mizchi$luna$luna$$event_handler() {
2645
+ return { callback: (_discard_) => {} };
2646
+ }
2647
+ function mizchi$luna$internal$utils$$extract_wc_name_from_url(url) {
2648
+ const parts = moonbitlang$core$builtin$$Iter$collect$3$(moonbitlang$core$string$$String$split(url, {
2649
+ str: mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$39,
2650
+ start: 0,
2651
+ end: 1
2652
+ }));
2653
+ const filename = moonbitlang$core$builtin$$Show$to_string$3$(parts.length > 0 ? moonbitlang$core$array$$Array$at$3$(parts, parts.length - 1 | 0) : moonbitlang$core$string$$String$view$46$inner("", 0, void 0));
2654
+ let name;
2655
+ if (moonbitlang$core$string$$String$has_suffix(filename, {
2656
+ str: mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$35,
2657
+ start: 0,
2658
+ end: 3
2659
+ }) && filename.length > 3) _L: {
2660
+ _L$2: {
2661
+ const _bind = moonbitlang$core$string$$String$sub$46$inner(filename, 0, filename.length - 3 | 0);
2662
+ let _tmp;
2663
+ if (_bind.$tag === 1) _tmp = _bind._0;
2664
+ else {
2665
+ _bind._0;
2666
+ break _L$2;
2667
+ }
2668
+ name = moonbitlang$core$builtin$$Show$to_string$3$(_tmp);
2669
+ break _L;
2670
+ }
2671
+ name = filename;
2672
+ }
2673
+ else name = filename;
2674
+ return moonbitlang$core$string$$String$replace(name, {
2675
+ str: mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$33,
2676
+ start: 0,
2677
+ end: 1
2678
+ }, {
2679
+ str: mizchi$luna$internal$utils$$extract_wc_name_from_url$46$42$bind$124$34,
2680
+ start: 0,
2681
+ end: 1
2682
+ });
2683
+ }
2684
+ function mizchi$luna$luna$render$$escape_html_to_internal(sb, s) {
2685
+ const len = s.length;
2686
+ if (len === 0) return;
2687
+ let start = 0;
2688
+ let i = 0;
2689
+ const _it = moonbitlang$core$string$$String$iterator(s);
2690
+ while (true) {
2691
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(_it);
2692
+ if (_bind === -1) break;
2693
+ else {
2694
+ const code = _bind;
2695
+ let escape_seq;
2696
+ switch (code) {
2697
+ case 38:
2698
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$780;
2699
+ break;
2700
+ case 60:
2701
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$781;
2702
+ break;
2703
+ case 62:
2704
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$782;
2705
+ break;
2706
+ case 34:
2707
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$783;
2708
+ break;
2709
+ case 39:
2710
+ escape_seq = mizchi$luna$luna$render$$escape_html_to_internal$46$constr$47$784;
2711
+ break;
2712
+ default: escape_seq = void 0;
2713
+ }
2714
+ if (escape_seq === void 0) {} else {
2715
+ const _seq = escape_seq;
2716
+ if (i > start) moonbitlang$core$builtin$$Logger$write_string$0$(sb, s.substring(start, i));
2717
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, _seq);
2718
+ start = i + 1 | 0;
2719
+ }
2720
+ i = i + 1 | 0;
2721
+ continue;
2722
+ }
2723
+ }
2724
+ if (start < len) if (start === 0) {
2725
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, s);
2726
+ return;
2727
+ } else {
2728
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, s.substring(start, len));
2729
+ return;
2730
+ }
2731
+ else return;
2732
+ }
2733
+ function mizchi$luna$luna$render$$escape_html_to(sb, s) {
2734
+ mizchi$luna$luna$render$$escape_html_to_internal(sb, s);
2735
+ }
2736
+ function mizchi$luna$luna$render$$is_void_element(tag) {
2737
+ const len = tag.length;
2738
+ if (len < 2 || len > 6) return false;
2739
+ switch (len) {
2740
+ case 2: return tag === "br" || tag === "hr";
2741
+ case 3: return tag === "img" || tag === "col" || tag === "wbr";
2742
+ case 4: return tag === "area" || tag === "base" || tag === "link" || tag === "meta";
2743
+ case 5: return tag === "embed" || tag === "input" || tag === "track" || tag === "param";
2744
+ case 6: return tag === "source" || tag === "keygen";
2745
+ default: return false;
2746
+ }
2747
+ }
2748
+ function mizchi$luna$luna$render$$escape_attr_to_internal(sb, s) {
2749
+ const len = s.length;
2750
+ if (len === 0) return;
2751
+ let start = 0;
2752
+ let i = 0;
2753
+ const _it = moonbitlang$core$string$$String$iterator(s);
2754
+ while (true) {
2755
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(_it);
2756
+ if (_bind === -1) break;
2757
+ else {
2758
+ const code = _bind;
2759
+ let escape_seq;
2760
+ switch (code) {
2761
+ case 38:
2762
+ escape_seq = mizchi$luna$luna$render$$escape_attr_to_internal$46$constr$47$803;
2763
+ break;
2764
+ case 34:
2765
+ escape_seq = mizchi$luna$luna$render$$escape_attr_to_internal$46$constr$47$804;
2766
+ break;
2767
+ default: escape_seq = void 0;
2768
+ }
2769
+ if (escape_seq === void 0) {} else {
2770
+ const _seq = escape_seq;
2771
+ if (i > start) moonbitlang$core$builtin$$Logger$write_string$0$(sb, s.substring(start, i));
2772
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, _seq);
2773
+ start = i + 1 | 0;
2774
+ }
2775
+ i = i + 1 | 0;
2776
+ continue;
2777
+ }
2778
+ }
2779
+ if (start < len) if (start === 0) {
2780
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, s);
2781
+ return;
2782
+ } else {
2783
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, s.substring(start, len));
2784
+ return;
2785
+ }
2786
+ else return;
2787
+ }
2788
+ function mizchi$luna$luna$render$$escape_attr_to(sb, s) {
2789
+ mizchi$luna$luna$render$$escape_attr_to_internal(sb, s);
2790
+ }
2791
+ function mizchi$luna$luna$render$$render_attr_value(sb, name, s) {
2792
+ switch (s) {
2793
+ case "__remove__": return;
2794
+ case "":
2795
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 32);
2796
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, name);
2797
+ return;
2798
+ default:
2799
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 32);
2800
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, name);
2801
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "=\"");
2802
+ mizchi$luna$luna$render$$escape_attr_to(sb, s);
2803
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2804
+ return;
2805
+ }
2806
+ }
2807
+ function mizchi$luna$luna$render$$render_attrs_to$4$(sb, attrs) {
2808
+ const _len = attrs.length;
2809
+ let _tmp = 0;
2810
+ while (true) {
2811
+ const _i = _tmp;
2812
+ if (_i < _len) {
2813
+ const attr = attrs[_i];
2814
+ const _name = attr._0;
2815
+ const _value = attr._1;
2816
+ switch (_value.$tag) {
2817
+ case 0: {
2818
+ const _s = _value._0;
2819
+ mizchi$luna$luna$render$$render_attr_value(sb, _name, _s);
2820
+ break;
2821
+ }
2822
+ case 1: {
2823
+ const _getter = _value._0;
2824
+ mizchi$luna$luna$render$$render_attr_value(sb, _name, _getter());
2825
+ break;
2826
+ }
2827
+ case 2: break;
2828
+ default: {
2829
+ const _action_name = _value._0;
2830
+ let event_name;
2831
+ if (moonbitlang$core$string$$String$has_prefix(_name, {
2832
+ str: mizchi$luna$luna$render$$render_attrs_to$46$42$bind$124$630,
2833
+ start: 0,
2834
+ end: 2
2835
+ })) _L: {
2836
+ _L$2: {
2837
+ const _bind = moonbitlang$core$string$$String$sub$46$inner(_name, 2, void 0);
2838
+ let _tmp$2;
2839
+ if (_bind.$tag === 1) _tmp$2 = _bind._0;
2840
+ else {
2841
+ _bind._0;
2842
+ break _L$2;
2843
+ }
2844
+ event_name = moonbitlang$core$builtin$$Show$to_string$3$(_tmp$2);
2845
+ break _L;
2846
+ }
2847
+ event_name = _name;
2848
+ }
2849
+ else event_name = _name;
2850
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " data-action-");
2851
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, event_name);
2852
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "=\"");
2853
+ mizchi$luna$luna$render$$escape_attr_to(sb, _action_name);
2854
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2855
+ }
2856
+ }
2857
+ _tmp = _i + 1 | 0;
2858
+ continue;
2859
+ } else return;
2860
+ }
2861
+ }
2862
+ function mizchi$luna$luna$render$$write_wc_close_tag(sb, name) {
2863
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</template></");
2864
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, name);
2865
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 62);
2866
+ }
2867
+ function mizchi$luna$luna$render$$hash_css(css) {
2868
+ let hash = 5381;
2869
+ const _it = moonbitlang$core$string$$String$iterator(css);
2870
+ while (true) {
2871
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(_it);
2872
+ if (_bind === -1) break;
2873
+ else {
2874
+ const _c = _bind;
2875
+ hash = (((hash << 5 >>> 0) + (hash >>> 0) | 0) >>> 0) + (_c >>> 0) | 0;
2876
+ continue;
2877
+ }
2878
+ }
2879
+ return moonbitlang$core$uint$$UInt$to_string$46$inner(hash, 10);
2880
+ }
2881
+ function mizchi$luna$luna$render$$minify_css(css) {
2882
+ const sb = moonbitlang$core$builtin$$StringBuilder$new$46$inner(css.length);
2883
+ let prev_char = 32;
2884
+ let in_space = false;
2885
+ const _it = moonbitlang$core$string$$String$iterator(css);
2886
+ while (true) {
2887
+ const _bind = moonbitlang$core$builtin$$Iterator$next$12$(_it);
2888
+ if (_bind === -1) break;
2889
+ else {
2890
+ const _c = _bind;
2891
+ _L: {
2892
+ _L$2: {
2893
+ _L$3: {
2894
+ _L$4: {
2895
+ switch (_c) {
2896
+ case 10: break _L$4;
2897
+ case 13: break _L$4;
2898
+ case 9: break _L$4;
2899
+ case 32:
2900
+ if (!in_space) in_space = true;
2901
+ break;
2902
+ case 123: break _L$2;
2903
+ case 125: break _L$2;
2904
+ case 58: break _L$2;
2905
+ case 59: break _L$2;
2906
+ case 44: break _L$2;
2907
+ default:
2908
+ if (in_space && prev_char !== 123 && prev_char !== 125 && prev_char !== 58 && prev_char !== 59 && prev_char !== 44 && prev_char !== 32) moonbitlang$core$builtin$$Logger$write_char$0$(sb, 32);
2909
+ in_space = false;
2910
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, _c);
2911
+ prev_char = _c;
2912
+ }
2913
+ break _L$3;
2914
+ }
2915
+ if (!in_space) in_space = true;
2916
+ }
2917
+ break _L;
2918
+ }
2919
+ in_space = false;
2920
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, _c);
2921
+ prev_char = _c;
2922
+ }
2923
+ continue;
2924
+ }
2925
+ }
2926
+ return sb.val;
2927
+ }
2928
+ function mizchi$luna$luna$render$$write_style_tag(sb, styles) {
2929
+ if (styles.length > 0) {
2930
+ const minified = mizchi$luna$luna$render$$minify_css(styles);
2931
+ const hash = mizchi$luna$luna$render$$hash_css(minified);
2932
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<style id=\"style-");
2933
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, hash);
2934
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\">");
2935
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, minified);
2936
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</style>");
2937
+ return;
2938
+ } else return;
2939
+ }
2940
+ function mizchi$luna$luna$render$$write_wc_open_tag(sb, name, url, state, trigger, styles) {
2941
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 60);
2942
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, name);
2943
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " luna:wc-url=\"");
2944
+ mizchi$luna$luna$render$$escape_attr_to(sb, url);
2945
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2946
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " luna:wc-state=\"");
2947
+ mizchi$luna$luna$render$$escape_attr_to(sb, state);
2948
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2949
+ let _tmp;
2950
+ if (trigger.$tag === 0) _tmp = true;
2951
+ else _tmp = false;
2952
+ if (!_tmp) {
2953
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " luna:wc-trigger=\"");
2954
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(trigger));
2955
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
2956
+ }
2957
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 62);
2958
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<template shadowrootmode=\"open\">");
2959
+ mizchi$luna$luna$render$$write_style_tag(sb, styles);
2960
+ }
2961
+ function mizchi$luna$luna$render$$render_island_close_to$4$(sb, island) {
2962
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</div>");
2963
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/luna:island:");
2964
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.id);
2965
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
2966
+ }
2967
+ function mizchi$luna$luna$render$$render_island_open_to$4$(sb, island) {
2968
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--luna:island:");
2969
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.id);
2970
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " url=");
2971
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.url);
2972
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " trigger=");
2973
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(island.trigger));
2974
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
2975
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<div luna:id=\"");
2976
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.id);
2977
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:url=\"");
2978
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island.url);
2979
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:state=\"");
2980
+ mizchi$luna$luna$render$$escape_attr_to(sb, island.state);
2981
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:client-trigger=\"");
2982
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(island.trigger));
2983
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\">");
2984
+ }
2985
+ function mizchi$luna$luna$render$$has_dynamic_content$4$(attrs) {
2986
+ const _len = attrs.length;
2987
+ let _tmp = 0;
2988
+ while (true) {
2989
+ const _i = _tmp;
2990
+ if (_i < _len) {
2991
+ const _value = attrs[_i]._1;
2992
+ _L: {
2993
+ _L$2: {
2994
+ switch (_value.$tag) {
2995
+ case 1: break _L$2;
2996
+ case 2: break _L$2;
2997
+ case 3: break _L$2;
2998
+ }
2999
+ break _L;
3000
+ }
3001
+ return true;
3002
+ }
3003
+ _tmp = _i + 1 | 0;
3004
+ continue;
3005
+ } else break;
3006
+ }
3007
+ return false;
3008
+ }
3009
+ function mizchi$luna$luna$render$$render_wc_island_with_id_to$4$(sb, island, id_counter) {
3010
+ const id = id_counter.val;
3011
+ id_counter.val = id + 1 | 0;
3012
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--wc:");
3013
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id);
3014
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3015
+ mizchi$luna$luna$render$$write_wc_open_tag(sb, island.name, island.url, island.state, island.trigger, island.styles);
3016
+ const _arr = island.children;
3017
+ const _len = _arr.length;
3018
+ let _tmp = 0;
3019
+ while (true) {
3020
+ const _i = _tmp;
3021
+ if (_i < _len) {
3022
+ const child = _arr[_i];
3023
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3024
+ _tmp = _i + 1 | 0;
3025
+ continue;
3026
+ } else break;
3027
+ }
3028
+ mizchi$luna$luna$render$$write_wc_close_tag(sb, island.name);
3029
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/wc-->");
3030
+ }
3031
+ function mizchi$luna$luna$render$$render_with_id_to$46$reset$47$891() {}
3032
+ function mizchi$luna$luna$render$$render_with_id_to$4$(sb, node, id_counter) {
3033
+ let _tmp = node;
3034
+ _L: while (true) {
3035
+ const node$2 = _tmp;
3036
+ switch (node$2.$tag) {
3037
+ case 1: {
3038
+ const _content = node$2._0;
3039
+ mizchi$luna$luna$render$$escape_html_to(sb, _content);
3040
+ return;
3041
+ }
3042
+ case 13: {
3043
+ const _html = node$2._0;
3044
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, _html);
3045
+ return;
3046
+ }
3047
+ case 2: {
3048
+ const _getter = node$2._0;
3049
+ const id = id_counter.val;
3050
+ id_counter.val = id + 1 | 0;
3051
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--t:");
3052
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id);
3053
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3054
+ mizchi$luna$luna$render$$escape_html_to(sb, _getter());
3055
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/t-->");
3056
+ return;
3057
+ }
3058
+ case 3: {
3059
+ const _children = node$2._0;
3060
+ const _len = _children.length;
3061
+ let _tmp$2 = 0;
3062
+ while (true) {
3063
+ const _i = _tmp$2;
3064
+ if (_i < _len) {
3065
+ const child = _children[_i];
3066
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3067
+ _tmp$2 = _i + 1 | 0;
3068
+ continue;
3069
+ } else return;
3070
+ }
3071
+ }
3072
+ case 0: {
3073
+ const _elem = node$2._0;
3074
+ const tag = _elem.tag;
3075
+ const id$2 = id_counter.val;
3076
+ id_counter.val = id$2 + 1 | 0;
3077
+ const needs_hydration = mizchi$luna$luna$render$$has_dynamic_content$4$(_elem.attrs);
3078
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 60);
3079
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, tag);
3080
+ mizchi$luna$luna$render$$render_attrs_to$4$(sb, _elem.attrs);
3081
+ if (needs_hydration) {
3082
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " sol:hk=\"");
3083
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$2);
3084
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 34);
3085
+ }
3086
+ if (mizchi$luna$luna$render$$is_void_element(tag)) {
3087
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " />");
3088
+ return;
3089
+ } else {
3090
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 62);
3091
+ const _arr = _elem.children;
3092
+ const _len$2 = _arr.length;
3093
+ let _tmp$3 = 0;
3094
+ while (true) {
3095
+ const _i = _tmp$3;
3096
+ if (_i < _len$2) {
3097
+ const child = _arr[_i];
3098
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3099
+ _tmp$3 = _i + 1 | 0;
3100
+ continue;
3101
+ } else break;
3102
+ }
3103
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</");
3104
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, tag);
3105
+ moonbitlang$core$builtin$$Logger$write_char$0$(sb, 62);
3106
+ return;
3107
+ }
3108
+ }
3109
+ case 4: {
3110
+ const _Show = node$2;
3111
+ const _condition = _Show._0;
3112
+ const _child = _Show._1;
3113
+ const id$3 = id_counter.val;
3114
+ id_counter.val = id$3 + 1 | 0;
3115
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--s:");
3116
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$3);
3117
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3118
+ if (_condition()) mizchi$luna$luna$render$$render_with_id_to$4$(sb, _child(), id_counter);
3119
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/s-->");
3120
+ return;
3121
+ }
3122
+ case 5: {
3123
+ const _render = node$2._0;
3124
+ const id$4 = id_counter.val;
3125
+ id_counter.val = id$4 + 1 | 0;
3126
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--f:");
3127
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$4);
3128
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3129
+ const _arr = _render();
3130
+ const _len$2 = _arr.length;
3131
+ let _tmp$3 = 0;
3132
+ while (true) {
3133
+ const _i = _tmp$3;
3134
+ if (_i < _len$2) {
3135
+ const item = _arr[_i];
3136
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, item, id_counter);
3137
+ _tmp$3 = _i + 1 | 0;
3138
+ continue;
3139
+ } else break;
3140
+ }
3141
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/f-->");
3142
+ return;
3143
+ }
3144
+ case 6: {
3145
+ const _render$2 = node$2._0;
3146
+ _tmp = _render$2();
3147
+ continue _L;
3148
+ }
3149
+ case 7: {
3150
+ const _island = node$2._0;
3151
+ mizchi$luna$luna$render$$render_island_with_id_to$4$(sb, _island, id_counter);
3152
+ return;
3153
+ }
3154
+ case 8: {
3155
+ const _wc_island = node$2._0;
3156
+ mizchi$luna$luna$render$$render_wc_island_with_id_to$4$(sb, _wc_island, id_counter);
3157
+ return;
3158
+ }
3159
+ case 12: {
3160
+ const _iref = node$2._0;
3161
+ mizchi$luna$luna$render$$render_internal_ref_with_id_to$4$(sb, _iref, id_counter);
3162
+ return;
3163
+ }
3164
+ case 9: {
3165
+ const _async_node = node$2._0;
3166
+ const id$5 = id_counter.val;
3167
+ id_counter.val = id$5 + 1 | 0;
3168
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--a:");
3169
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$5);
3170
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3171
+ const _func = _async_node.fallback;
3172
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, _func(), id_counter);
3173
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/a-->");
3174
+ return;
3175
+ }
3176
+ case 10: {
3177
+ const _boundary = node$2._0;
3178
+ const id$6 = id_counter.val;
3179
+ id_counter.val = id$6 + 1 | 0;
3180
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--eb:");
3181
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$6);
3182
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3183
+ let _try_err;
3184
+ _L$2: {
3185
+ _L$3: {
3186
+ const _func$2 = _boundary.children;
3187
+ const _bind = _func$2();
3188
+ let _tmp$4;
3189
+ if (_bind.$tag === 1) _tmp$4 = _bind._0;
3190
+ else {
3191
+ _try_err = _bind._0;
3192
+ break _L$3;
3193
+ }
3194
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, _tmp$4, id_counter);
3195
+ break _L$2;
3196
+ }
3197
+ _L$4: _L$5: {
3198
+ const _func$2 = _boundary.fallback;
3199
+ const _bind = _func$2(_try_err, mizchi$luna$luna$render$$render_with_id_to$46$reset$47$891);
3200
+ let _tmp$4;
3201
+ if (_bind.$tag === 1) _tmp$4 = _bind._0;
3202
+ else {
3203
+ _bind._0;
3204
+ break _L$5;
3205
+ }
3206
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, _tmp$4, id_counter);
3207
+ break _L$4;
3208
+ }
3209
+ }
3210
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/eb-->");
3211
+ return;
3212
+ }
3213
+ default: {
3214
+ const _switch_node = node$2._0;
3215
+ const id$7 = id_counter.val;
3216
+ id_counter.val = id$7 + 1 | 0;
3217
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--sw:");
3218
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id$7);
3219
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3220
+ const _arr$2 = _switch_node.cases;
3221
+ const _len$3 = _arr$2.length;
3222
+ let _tmp$4 = 0;
3223
+ while (true) {
3224
+ const _i = _tmp$4;
3225
+ if (_i < _len$3) {
3226
+ const case_ = _arr$2[_i];
3227
+ const _func$2 = case_.when;
3228
+ if (_func$2()) {
3229
+ const _func$3 = case_.render;
3230
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, _func$3(), id_counter);
3231
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/sw-->");
3232
+ return;
3233
+ }
3234
+ _tmp$4 = _i + 1 | 0;
3235
+ continue;
3236
+ } else break;
3237
+ }
3238
+ const _bind = _switch_node.fallback;
3239
+ if (_bind === void 0) {} else mizchi$luna$luna$render$$render_with_id_to$4$(sb, _bind(), id_counter);
3240
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/sw-->");
3241
+ return;
3242
+ }
3243
+ }
3244
+ }
3245
+ }
3246
+ function mizchi$luna$luna$render$$render_internal_ref_with_id_to$4$(sb, iref, id_counter) {
3247
+ if (iref.wc) {
3248
+ mizchi$luna$luna$render$$render_internal_ref_wc_with_id_to$4$(sb, iref, id_counter);
3249
+ return;
3250
+ } else {
3251
+ mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$4$(sb, iref, id_counter);
3252
+ return;
3253
+ }
3254
+ }
3255
+ function mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$4$(sb, iref, id_counter) {
3256
+ const id = id_counter.val;
3257
+ id_counter.val = id + 1 | 0;
3258
+ const island_id = moonbitlang$core$string$$String$replace(moonbitlang$core$string$$String$replace(iref.url, {
3259
+ str: mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$915,
3260
+ start: 0,
3261
+ end: 1
3262
+ }, {
3263
+ str: mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$916,
3264
+ start: 0,
3265
+ end: 1
3266
+ }), {
3267
+ str: mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$917,
3268
+ start: 0,
3269
+ end: 1
3270
+ }, {
3271
+ str: mizchi$luna$luna$render$$render_internal_ref_island_with_id_to$46$42$bind$124$918,
3272
+ start: 0,
3273
+ end: 1
3274
+ });
3275
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--i:");
3276
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id);
3277
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3278
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--luna:island:");
3279
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island_id);
3280
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " url=");
3281
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, iref.url);
3282
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, " trigger=");
3283
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(iref.trigger));
3284
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3285
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<div luna:id=\"");
3286
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island_id);
3287
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:url=\"");
3288
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, iref.url);
3289
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:state=\"");
3290
+ mizchi$luna$luna$render$$escape_attr_to(sb, iref.state);
3291
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\" luna:client-trigger=\"");
3292
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, mizchi$luna$luna$$TriggerType$to_string(iref.trigger));
3293
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "\">");
3294
+ const _arr = iref.children;
3295
+ const _len = _arr.length;
3296
+ let _tmp = 0;
3297
+ while (true) {
3298
+ const _i = _tmp;
3299
+ if (_i < _len) {
3300
+ const child = _arr[_i];
3301
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3302
+ _tmp = _i + 1 | 0;
3303
+ continue;
3304
+ } else break;
3305
+ }
3306
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "</div>");
3307
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/luna:island:");
3308
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, island_id);
3309
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3310
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/i-->");
3311
+ }
3312
+ function mizchi$luna$luna$render$$render_internal_ref_wc_with_id_to$4$(sb, iref, id_counter) {
3313
+ const id = id_counter.val;
3314
+ id_counter.val = id + 1 | 0;
3315
+ const name = mizchi$luna$internal$utils$$extract_wc_name_from_url(iref.url);
3316
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--wc:");
3317
+ moonbitlang$core$builtin$$StringBuilder$write_object$2$(sb, id);
3318
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "-->");
3319
+ mizchi$luna$luna$render$$write_wc_open_tag(sb, name, iref.url, iref.state, iref.trigger, iref.styles);
3320
+ const _arr = iref.children;
3321
+ const _len = _arr.length;
3322
+ let _tmp = 0;
3323
+ while (true) {
3324
+ const _i = _tmp;
3325
+ if (_i < _len) {
3326
+ const child = _arr[_i];
3327
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3328
+ _tmp = _i + 1 | 0;
3329
+ continue;
3330
+ } else break;
3331
+ }
3332
+ mizchi$luna$luna$render$$write_wc_close_tag(sb, name);
3333
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "<!--/wc-->");
3334
+ }
3335
+ function mizchi$luna$luna$render$$render_island_with_id_to$4$(sb, island, id_counter) {
3336
+ mizchi$luna$luna$render$$render_island_open_to$4$(sb, island);
3337
+ const _arr = island.children;
3338
+ const _len = _arr.length;
3339
+ let _tmp = 0;
3340
+ while (true) {
3341
+ const _i = _tmp;
3342
+ if (_i < _len) {
3343
+ const child = _arr[_i];
3344
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, child, id_counter);
3345
+ _tmp = _i + 1 | 0;
3346
+ continue;
3347
+ } else break;
3348
+ }
3349
+ mizchi$luna$luna$render$$render_island_close_to$4$(sb, island);
3350
+ }
3351
+ function mizchi$luna$luna$render$$render_to_string_with_hydration$4$(node) {
3352
+ const sb = moonbitlang$core$builtin$$StringBuilder$new$46$inner(256);
3353
+ mizchi$luna$luna$render$$render_with_id_to$4$(sb, node, { val: 0 });
3354
+ return sb.val;
3355
+ }
3356
+ function f4ah6o$svg_jww$svg_jww_ui$$render_layer_item(layer, on_toggle_visibility, on_toggle_lock, on_select) {
3357
+ const visibility_icon = layer.visible ? "👁" : "○";
3358
+ const lock_icon = layer.locked ? "🔒" : "🔓";
3359
+ const opacity = layer.visible ? "1.0" : "0.5";
3360
+ const _tmp$3 = [
3361
+ {
3362
+ _0: "class",
3363
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-item")
3364
+ },
3365
+ {
3366
+ _0: "data-layer-id",
3367
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$(moonbitlang$core$int$$Int$to_string$46$inner(layer.layer_id, 10))
3368
+ },
3369
+ {
3370
+ _0: "style",
3371
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$(`display: flex; align-items: center; gap: 8px; padding: 4px 8px; cursor: pointer; opacity: ${opacity}`)
3372
+ },
3373
+ {
3374
+ _0: "onClick",
3375
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_select)
3376
+ }
3377
+ ];
3378
+ const _tmp$7 = mizchi$luna$luna$$h$4$("button", [
3379
+ {
3380
+ _0: "class",
3381
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-visibility")
3382
+ },
3383
+ {
3384
+ _0: "title",
3385
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Toggle Visibility")
3386
+ },
3387
+ {
3388
+ _0: "onClick",
3389
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_toggle_visibility)
3390
+ },
3391
+ {
3392
+ _0: "style",
3393
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 20px; height: 20px; border: none; background: transparent; cursor: pointer; font-size: 14px;")
3394
+ }
3395
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$(visibility_icon)]);
3396
+ const _tmp$11 = mizchi$luna$luna$$h$4$("button", [
3397
+ {
3398
+ _0: "class",
3399
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-lock")
3400
+ },
3401
+ {
3402
+ _0: "title",
3403
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Toggle Lock")
3404
+ },
3405
+ {
3406
+ _0: "onClick",
3407
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_toggle_lock)
3408
+ },
3409
+ {
3410
+ _0: "style",
3411
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 20px; height: 20px; border: none; background: transparent; cursor: pointer; font-size: 14px;")
3412
+ }
3413
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$(lock_icon)]);
3414
+ const _tmp$13 = [{
3415
+ _0: "class",
3416
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-name")
3417
+ }, {
3418
+ _0: "style",
3419
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("flex: 1; font-size: 13px;")
3420
+ }];
3421
+ const _p$12 = layer.name;
3422
+ return mizchi$luna$luna$$h$4$("div", _tmp$3, [
3423
+ _tmp$7,
3424
+ _tmp$11,
3425
+ mizchi$luna$luna$$h$4$("span", _tmp$13, [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$(_p$12)])
3426
+ ]);
3427
+ }
3428
+ function f4ah6o$svg_jww$svg_jww_ui$$render_layer_panel(state_sig, on_toggle_visibility, on_toggle_lock, on_select_layer) {
3429
+ const layers = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).layers;
3430
+ const _tmp$2 = [{
3431
+ _0: "class",
3432
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel")
3433
+ }, {
3434
+ _0: "style",
3435
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("border: 1px solid #ccc; border-radius: 4px; overflow: hidden;")
3436
+ }];
3437
+ const _tmp$5 = mizchi$luna$luna$$h$4$("div", [{
3438
+ _0: "class",
3439
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel-header")
3440
+ }, {
3441
+ _0: "style",
3442
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 8px 12px; background: #f5f5f5; border-bottom: 1px solid #ccc; font-weight: bold; font-size: 14px;")
3443
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Layers")]);
3444
+ const _tmp$7 = [{
3445
+ _0: "class",
3446
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-list")
3447
+ }, {
3448
+ _0: "style",
3449
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("max-height: 300px; overflow-y: auto;")
3450
+ }];
3451
+ const _p$8 = new Array(layers.length);
3452
+ const _p$9 = layers.length;
3453
+ let _tmp$8 = 0;
3454
+ while (true) {
3455
+ const _p$10 = _tmp$8;
3456
+ if (_p$10 < _p$9) {
3457
+ const _p$11 = layers[_p$10];
3458
+ _p$8[_p$10] = f4ah6o$svg_jww$svg_jww_ui$$render_layer_item(_p$11, on_toggle_visibility, on_toggle_lock, on_select_layer);
3459
+ _tmp$8 = _p$10 + 1 | 0;
3460
+ continue;
3461
+ } else break;
3462
+ }
3463
+ const _tmp$9 = mizchi$luna$luna$$h$4$("div", _tmp$7, _p$8);
3464
+ const _tmp$11 = [{
3465
+ _0: "class",
3466
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel-footer")
3467
+ }, {
3468
+ _0: "style",
3469
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 6px 12px; background: #f5f5f5; border-top: 1px solid #ccc; font-size: 12px; color: #666;")
3470
+ }];
3471
+ const _p$12 = () => {
3472
+ const layers$2 = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).layers;
3473
+ return `${moonbitlang$core$int$$Int$to_string$46$inner(layers$2.length, 10)} layers`;
3474
+ };
3475
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [
3476
+ _tmp$5,
3477
+ _tmp$9,
3478
+ mizchi$luna$luna$$h$4$("div", _tmp$11, [new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$12)])
3479
+ ]);
3480
+ }
3481
+ function f4ah6o$svg_jww$svg_jww_ui$$render_collapsible_layer_panel(state_sig, on_toggle_visibility, on_toggle_lock, on_select_layer, on_toggle_panel) {
3482
+ return mizchi$luna$luna$$h$4$("div", [{
3483
+ _0: "class",
3484
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel-wrapper")
3485
+ }, {
3486
+ _0: "style",
3487
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("border: 1px solid #ccc; border-radius: 4px;")
3488
+ }], [mizchi$luna$luna$$h$4$("div", [
3489
+ {
3490
+ _0: "class",
3491
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-layer-panel-toggle")
3492
+ },
3493
+ {
3494
+ _0: "style",
3495
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 8px 12px; background: #f5f5f5; cursor: pointer; display: flex; justify-content: space-between; align-items: center;")
3496
+ },
3497
+ {
3498
+ _0: "onClick",
3499
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_toggle_panel)
3500
+ }
3501
+ ], [mizchi$luna$luna$$h$4$("span", [{
3502
+ _0: "style",
3503
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-weight: bold; font-size: 14px;")
3504
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Layers")]), mizchi$luna$luna$$h$4$("span", [{
3505
+ _0: "style",
3506
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-size: 12px;")
3507
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("▼")])]), mizchi$luna$luna$$h$4$("div", [], [f4ah6o$svg_jww$svg_jww_ui$$render_layer_panel(state_sig, on_toggle_visibility, on_toggle_lock, on_select_layer)])]);
3508
+ }
3509
+ function f4ah6o$svg_jww$svg_jww_ui$$render_canvas(state_sig, svg_content_sig, on_pan, on_wheel) {
3510
+ const svg_content = mizchi$luna$luna$signal$$Signal$get$18$(svg_content_sig);
3511
+ const _tmp$2 = [{
3512
+ _0: "class",
3513
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-canvas")
3514
+ }, {
3515
+ _0: "style",
3516
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("position: relative; overflow: hidden;")
3517
+ }];
3518
+ const _tmp$3 = {
3519
+ _0: "class",
3520
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-canvas-content")
3521
+ };
3522
+ const _p$4 = () => {
3523
+ const vp = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport;
3524
+ return `transform: translate(${moonbitlang$core$double$$Double$to_string(vp.offset_x)}px, ${moonbitlang$core$double$$Double$to_string(vp.offset_y)}px) scale(${moonbitlang$core$double$$Double$to_string(vp.scale)}); transform-origin: 0 0;`;
3525
+ };
3526
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [mizchi$luna$luna$$h$4$("div", [
3527
+ _tmp$3,
3528
+ {
3529
+ _0: "style",
3530
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VDynamic$3$(_p$4)
3531
+ },
3532
+ {
3533
+ _0: "onWheel",
3534
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_wheel)
3535
+ }
3536
+ ], [mizchi$luna$luna$$h$4$("div", [{
3537
+ _0: "class",
3538
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-svg-wrapper")
3539
+ }, {
3540
+ _0: "style",
3541
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("pointer-events: none;")
3542
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$RawHtml$3$(svg_content)])]), mizchi$luna$luna$$h$4$("div", [
3543
+ {
3544
+ _0: "class",
3545
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-pan-overlay")
3546
+ },
3547
+ {
3548
+ _0: "style",
3549
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("position: absolute; inset: 0; cursor: grab;")
3550
+ },
3551
+ {
3552
+ _0: "onMouseDown",
3553
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_pan)
3554
+ }
3555
+ ], [])]);
3556
+ }
3557
+ function f4ah6o$svg_jww$svg_jww_ui$$render_canvas_with_controls(state_sig, svg_content_sig, on_pan, on_wheel, on_zoom_in, on_zoom_out, on_fit, on_reset) {
3558
+ const _tmp$2 = [{
3559
+ _0: "class",
3560
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-viewer")
3561
+ }, {
3562
+ _0: "style",
3563
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("position: relative;")
3564
+ }];
3565
+ const _tmp$3 = f4ah6o$svg_jww$svg_jww_ui$$render_canvas(state_sig, svg_content_sig, on_pan, on_wheel);
3566
+ const _tmp$5 = [{
3567
+ _0: "class",
3568
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-controls")
3569
+ }, {
3570
+ _0: "style",
3571
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("position: absolute; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 4px;")
3572
+ }];
3573
+ const _tmp$10 = mizchi$luna$luna$$h$4$("button", [
3574
+ {
3575
+ _0: "class",
3576
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-btn")
3577
+ },
3578
+ {
3579
+ _0: "title",
3580
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Zoom In")
3581
+ },
3582
+ {
3583
+ _0: "onClick",
3584
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_zoom_in)
3585
+ },
3586
+ {
3587
+ _0: "style",
3588
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 32px; height: 32px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 4px;")
3589
+ }
3590
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("+")]);
3591
+ const _tmp$12 = [{
3592
+ _0: "class",
3593
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-level")
3594
+ }, {
3595
+ _0: "style",
3596
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("text-align: center; font-size: 12px; color: #666; min-width: 50px;")
3597
+ }];
3598
+ const _p$11 = () => {
3599
+ const vp = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport;
3600
+ return `${moonbitlang$core$int$$Int$to_string$46$inner(moonbitlang$core$double$$Double$to_int(vp.scale * 100), 10)}%`;
3601
+ };
3602
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [_tmp$3, mizchi$luna$luna$$h$4$("div", _tmp$5, [
3603
+ _tmp$10,
3604
+ mizchi$luna$luna$$h$4$("div", _tmp$12, [new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$11)]),
3605
+ mizchi$luna$luna$$h$4$("button", [
3606
+ {
3607
+ _0: "class",
3608
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-btn")
3609
+ },
3610
+ {
3611
+ _0: "title",
3612
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Zoom Out")
3613
+ },
3614
+ {
3615
+ _0: "onClick",
3616
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_zoom_out)
3617
+ },
3618
+ {
3619
+ _0: "style",
3620
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 32px; height: 32px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 4px;")
3621
+ }
3622
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("-")]),
3623
+ mizchi$luna$luna$$h$4$("div", [{
3624
+ _0: "style",
3625
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("height: 1px; background: #ccc;")
3626
+ }], []),
3627
+ mizchi$luna$luna$$h$4$("button", [
3628
+ {
3629
+ _0: "class",
3630
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-btn")
3631
+ },
3632
+ {
3633
+ _0: "title",
3634
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Fit to View")
3635
+ },
3636
+ {
3637
+ _0: "onClick",
3638
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_fit)
3639
+ },
3640
+ {
3641
+ _0: "style",
3642
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 32px; height: 32px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 4px;")
3643
+ }
3644
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("⛶")]),
3645
+ mizchi$luna$luna$$h$4$("button", [
3646
+ {
3647
+ _0: "class",
3648
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-zoom-btn")
3649
+ },
3650
+ {
3651
+ _0: "title",
3652
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Reset View")
3653
+ },
3654
+ {
3655
+ _0: "onClick",
3656
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_reset)
3657
+ },
3658
+ {
3659
+ _0: "style",
3660
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 32px; height: 32px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 4px;")
3661
+ }
3662
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("⟲")])
3663
+ ])]);
3664
+ }
3665
+ function f4ah6o$svg_jww$svg_jww_ui$$render_info_panel(state_sig) {
3666
+ const _tmp$2 = [{
3667
+ _0: "class",
3668
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-info-panel")
3669
+ }, {
3670
+ _0: "style",
3671
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("border-top: 1px solid #ccc; padding: 12px;")
3672
+ }];
3673
+ const _tmp$4 = mizchi$luna$luna$$h$4$("h3", [{
3674
+ _0: "style",
3675
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("margin: 0 0 8px 0; font-size: 14px;")
3676
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Document Info")]);
3677
+ const _tmp$5 = [{
3678
+ _0: "style",
3679
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-size: 12px; color: #666; display: flex; flex-direction: column; gap: 4px;")
3680
+ }];
3681
+ const _tmp$6 = [];
3682
+ const _tmp$7 = new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Viewport:");
3683
+ const _p$7 = () => {
3684
+ const vp = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport;
3685
+ return `${moonbitlang$core$double$$Double$to_string(vp.width)}x${moonbitlang$core$double$$Double$to_string(vp.height)}`;
3686
+ };
3687
+ const _tmp$8 = mizchi$luna$luna$$h$4$("div", _tmp$6, [_tmp$7, new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$7)]);
3688
+ const _tmp$9 = [];
3689
+ const _tmp$10 = new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Scale:");
3690
+ const _p$9 = () => {
3691
+ const vp = mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport;
3692
+ return `${moonbitlang$core$int$$Int$to_string$46$inner(moonbitlang$core$double$$Double$to_int(vp.scale * 100), 10)}%`;
3693
+ };
3694
+ const _tmp$11 = mizchi$luna$luna$$h$4$("div", _tmp$9, [_tmp$10, new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$9)]);
3695
+ const _tmp$12 = [];
3696
+ const _tmp$13 = new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Layers:");
3697
+ const _p$11 = () => {
3698
+ const state = mizchi$luna$luna$signal$$Signal$get$17$(state_sig);
3699
+ const _p$12 = state.layers;
3700
+ const _p$13 = [];
3701
+ const _p$14 = _p$12.length;
3702
+ let _tmp$14 = 0;
3703
+ while (true) {
3704
+ const _p$15 = _tmp$14;
3705
+ if (_p$15 < _p$14) {
3706
+ const _p$16 = _p$12[_p$15];
3707
+ if (_p$16.visible) moonbitlang$core$array$$Array$push$13$(_p$13, _p$16);
3708
+ _tmp$14 = _p$15 + 1 | 0;
3709
+ continue;
3710
+ } else break;
3711
+ }
3712
+ const visible = _p$13.length;
3713
+ return `${moonbitlang$core$int$$Int$to_string$46$inner(visible, 10)} / ${moonbitlang$core$int$$Int$to_string$46$inner(state.layers.length, 10)}`;
3714
+ };
3715
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [_tmp$4, mizchi$luna$luna$$h$4$("div", _tmp$5, [
3716
+ _tmp$8,
3717
+ _tmp$11,
3718
+ mizchi$luna$luna$$h$4$("div", _tmp$12, [_tmp$13, new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$11)])
3719
+ ])]);
3720
+ }
3721
+ function f4ah6o$svg_jww$svg_jww_ui$$render_toolbar(state_sig, on_zoom_in, on_zoom_out, on_fit, on_reset, on_toggle_layer_panel) {
3722
+ const _tmp$2 = [{
3723
+ _0: "class",
3724
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-toolbar")
3725
+ }, {
3726
+ _0: "style",
3727
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f5f5f5; border-bottom: 1px solid #ccc;")
3728
+ }];
3729
+ const _tmp$4 = mizchi$luna$luna$$h$4$("span", [{
3730
+ _0: "style",
3731
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-weight: bold; font-size: 16px;")
3732
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("JWW Viewer")]);
3733
+ const _tmp$6 = mizchi$luna$luna$$h$4$("span", [{
3734
+ _0: "style",
3735
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("color: #999;")
3736
+ }], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("|")]);
3737
+ const _tmp$10 = mizchi$luna$luna$$h$4$("button", [
3738
+ {
3739
+ _0: "title",
3740
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Zoom In (Ctrl+)")
3741
+ },
3742
+ {
3743
+ _0: "onClick",
3744
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_zoom_in)
3745
+ },
3746
+ {
3747
+ _0: "style",
3748
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 4px 8px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 3px;")
3749
+ }
3750
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Zoom In")]);
3751
+ const _tmp$14 = mizchi$luna$luna$$h$4$("button", [
3752
+ {
3753
+ _0: "title",
3754
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Zoom Out (Ctrl-)")
3755
+ },
3756
+ {
3757
+ _0: "onClick",
3758
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_zoom_out)
3759
+ },
3760
+ {
3761
+ _0: "style",
3762
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 4px 8px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 3px;")
3763
+ }
3764
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Zoom Out")]);
3765
+ const _tmp$18 = mizchi$luna$luna$$h$4$("button", [
3766
+ {
3767
+ _0: "title",
3768
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Fit to View (Ctrl+F)")
3769
+ },
3770
+ {
3771
+ _0: "onClick",
3772
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_fit)
3773
+ },
3774
+ {
3775
+ _0: "style",
3776
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 4px 8px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 3px;")
3777
+ }
3778
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Fit")]);
3779
+ const _tmp$22 = mizchi$luna$luna$$h$4$("button", [
3780
+ {
3781
+ _0: "title",
3782
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("Reset View (Ctrl+R)")
3783
+ },
3784
+ {
3785
+ _0: "onClick",
3786
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VHandler$3$(on_reset)
3787
+ },
3788
+ {
3789
+ _0: "style",
3790
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("padding: 4px 8px; border: 1px solid #ccc; background: white; cursor: pointer; border-radius: 3px;")
3791
+ }
3792
+ ], [new $64$mizchi$47$luna$47$luna$46$Node$Text$3$("Reset")]);
3793
+ const _tmp$23 = mizchi$luna$luna$$h$4$("div", [{
3794
+ _0: "style",
3795
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("flex: 1;")
3796
+ }], []);
3797
+ const _tmp$25 = [{
3798
+ _0: "class",
3799
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-toolbar-info")
3800
+ }, {
3801
+ _0: "style",
3802
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("font-size: 12px; color: #666;")
3803
+ }];
3804
+ const _p$22 = () => {
3805
+ return `Scale: ${moonbitlang$core$int$$Int$to_string$46$inner(moonbitlang$core$double$$Double$to_int(mizchi$luna$luna$signal$$Signal$get$17$(state_sig).viewport.scale * 100), 10)}%`;
3806
+ };
3807
+ return mizchi$luna$luna$$h$4$("div", _tmp$2, [
3808
+ _tmp$4,
3809
+ _tmp$6,
3810
+ _tmp$10,
3811
+ _tmp$14,
3812
+ _tmp$18,
3813
+ _tmp$22,
3814
+ _tmp$23,
3815
+ mizchi$luna$luna$$h$4$("span", _tmp$25, [new $64$mizchi$47$luna$47$luna$46$Node$DynamicText$3$(_p$22)])
3816
+ ]);
3817
+ }
3818
+ function f4ah6o$svg_jww$svg_jww_ui$$render_app(state_sig, svg_content_sig, on_zoom_in, on_zoom_out, on_fit, on_reset, on_pan, on_toggle_layer_visibility, on_toggle_layer_lock, on_select_layer, on_toggle_layer_panel) {
3819
+ const _tmp = {
3820
+ _0: "class",
3821
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-viewer-app")
3822
+ };
3823
+ const _p$2 = () => {
3824
+ return `display: flex; height: 100vh; background-color: ${mizchi$luna$luna$signal$$Signal$get$17$(state_sig).background_color};`;
3825
+ };
3826
+ return mizchi$luna$luna$$h$4$("div", [_tmp, {
3827
+ _0: "style",
3828
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VDynamic$3$(_p$2)
3829
+ }], [mizchi$luna$luna$$h$4$("div", [{
3830
+ _0: "class",
3831
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-main-content")
3832
+ }, {
3833
+ _0: "style",
3834
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("flex: 1; display: flex; flex-direction: column;")
3835
+ }], [f4ah6o$svg_jww$svg_jww_ui$$render_toolbar(state_sig, on_zoom_in, on_zoom_out, on_fit, on_reset, on_toggle_layer_panel), mizchi$luna$luna$$h$4$("div", [{
3836
+ _0: "class",
3837
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-canvas-container")
3838
+ }, {
3839
+ _0: "style",
3840
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("flex: 1; position: relative; overflow: hidden;")
3841
+ }], [f4ah6o$svg_jww$svg_jww_ui$$render_canvas_with_controls(state_sig, svg_content_sig, on_pan, mizchi$luna$luna$$event_handler(), on_zoom_in, on_zoom_out, on_fit, on_reset)])]), mizchi$luna$luna$$h$4$("div", [{
3842
+ _0: "class",
3843
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("jww-sidebar")
3844
+ }, {
3845
+ _0: "style",
3846
+ _1: new $64$mizchi$47$luna$47$luna$46$Attr$VStatic$3$("width: 200px; border-left: 1px solid #ccc; display: flex; flex-direction: column;")
3847
+ }], [f4ah6o$svg_jww$svg_jww_ui$$render_collapsible_layer_panel(state_sig, on_toggle_layer_visibility, on_toggle_layer_lock, on_select_layer, on_toggle_layer_panel), f4ah6o$svg_jww$svg_jww_ui$$render_info_panel(state_sig)])]);
3848
+ }
3849
+ function f4ah6o$svg_jww$svg_jww_ui$$render_app_html(app_state, svg_content) {
3850
+ const state_sig = mizchi$luna$luna$signal$$signal$17$(app_state);
3851
+ const svg_sig = mizchi$luna$luna$signal$$signal$18$(svg_content);
3852
+ const noop = mizchi$luna$luna$$handler$4$((_x) => {});
3853
+ return mizchi$luna$luna$render$$render_to_string_with_hydration$4$(f4ah6o$svg_jww$svg_jww_ui$$render_app(state_sig, svg_sig, noop, noop, noop, noop, noop, noop, noop, noop, noop));
3854
+ }
3855
+ function f4ah6o$svg_jww$svg_jww_ui$$serialize_state(state) {
3856
+ const vp = state.viewport;
3857
+ const sb = moonbitlang$core$builtin$$StringBuilder$new$46$inner(0);
3858
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "{\"viewport\":{\"scale\":");
3859
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.scale));
3860
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, ",\"offset_x\":");
3861
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.offset_x));
3862
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, ",\"offset_y\":");
3863
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.offset_y));
3864
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, ",\"width\":");
3865
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.width));
3866
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, ",\"height\":");
3867
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, moonbitlang$core$double$$Double$to_string(vp.height));
3868
+ moonbitlang$core$builtin$$Logger$write_string$0$(sb, "}}");
3869
+ return sb.val;
3870
+ }
3871
+
3872
+ //#endregion
3873
+ exports.render_app = f4ah6o$svg_jww$svg_jww_ui$$render_app;
3874
+ exports.render_app_html = f4ah6o$svg_jww$svg_jww_ui$$render_app_html;
3875
+ exports.serialize_state = f4ah6o$svg_jww$svg_jww_ui$$serialize_state;
3876
+ //# sourceMappingURL=index.cjs.map