@joystyk/cards-ui 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1508 @@
1
+ import { DEFAULT_OPTIONS } from "./layout.js";
2
+ import { CardTable } from "./table.js";
3
+ import { workerSetup } from "./worker-setup.js";
4
+ import { child, command, css, define, defineDriver, focus, intentsOf, nothing, subscription } from "@gyral/core";
5
+ import { compiled } from "@gyral/core/compiled";
6
+ import { isJson } from "@joystyk/contracts";
7
+ //#region src/solitaire.ts
8
+ var _gyral$t0 = {
9
+ "id": "150g4ed5j5k",
10
+ "html": "<p>Dealing the cards…</p>",
11
+ "parts": [],
12
+ "segments": ["<p>Dealing the cards…</p>"]
13
+ };
14
+ var _gyral$t1 = {
15
+ "id": "nkq41otpf3",
16
+ "html": "<section><div><header><h2></h2><dl><div><dt>Time</dt><dd></dd></div></dl><p></p></header><jy-card-table></jy-card-table><p class=\"message\" aria-hidden=\"true\"></p><div class=\"actions\"><button type=\"button\">New game</button><button type=\"button\">Undo</button><button type=\"button\">Hint</button><button type=\"button\" aria-haspopup=\"dialog\">Keys</button></div><details><summary>Settings and deal number</summary><form aria-label=\"Settings\"><fieldset><legend>Choose before the first move</legend><button type=\"submit\">Deal</button></fieldset></form><label><input type=\"checkbox\"> Four-color deck (blue diamonds, green clubs)</label><label><input type=\"checkbox\"> Soft card sounds</label></details><details><summary>Records on this device</summary><dl><div><dt>Played</dt><dd></dd></div><div><dt>Won</dt><dd></dd></div><div><dt>Best score</dt><dd></dd></div><div><dt>Fewest moves in a win</dt><dd></dd></div><div><dt>Best time</dt><dd></dd></div><div><dt>Best run</dt><dd></dd></div><div><dt>Cleared</dt><dd></dd></div><div><dt>Wins without help</dt><dd></dd></div><div><dt>Win streak (best)</dt><dd><!----> (<!---->)</dd></div></dl></details></div></section>",
17
+ "parts": [
18
+ [
19
+ 4,
20
+ [0],
21
+ "class",
22
+ [
23
+ "slate ",
24
+ " ",
25
+ ""
26
+ ]
27
+ ],
28
+ [
29
+ 3,
30
+ [0],
31
+ "aria-label"
32
+ ],
33
+ [
34
+ 3,
35
+ [0],
36
+ "data-intent-keydown"
37
+ ],
38
+ [
39
+ 5,
40
+ [0, 0],
41
+ "inert"
42
+ ],
43
+ [1, [
44
+ 0,
45
+ 0,
46
+ 0,
47
+ 0
48
+ ]],
49
+ [
50
+ 2,
51
+ [
52
+ 0,
53
+ 0,
54
+ 0,
55
+ 1
56
+ ],
57
+ 0
58
+ ],
59
+ [1, [
60
+ 0,
61
+ 0,
62
+ 0,
63
+ 1,
64
+ 0,
65
+ 1
66
+ ]],
67
+ [1, [
68
+ 0,
69
+ 0,
70
+ 0,
71
+ 2
72
+ ]],
73
+ [
74
+ 6,
75
+ [
76
+ 0,
77
+ 0,
78
+ 1
79
+ ],
80
+ "layout"
81
+ ],
82
+ [
83
+ 6,
84
+ [
85
+ 0,
86
+ 0,
87
+ 1
88
+ ],
89
+ "options"
90
+ ],
91
+ [
92
+ 3,
93
+ [
94
+ 0,
95
+ 0,
96
+ 1
97
+ ],
98
+ "data-intent"
99
+ ],
100
+ [1, [
101
+ 0,
102
+ 0,
103
+ 2
104
+ ]],
105
+ [
106
+ 5,
107
+ [
108
+ 0,
109
+ 0,
110
+ 3,
111
+ 0
112
+ ],
113
+ "disabled"
114
+ ],
115
+ [
116
+ 3,
117
+ [
118
+ 0,
119
+ 0,
120
+ 3,
121
+ 0
122
+ ],
123
+ "data-intent"
124
+ ],
125
+ [
126
+ 5,
127
+ [
128
+ 0,
129
+ 0,
130
+ 3,
131
+ 1
132
+ ],
133
+ "disabled"
134
+ ],
135
+ [
136
+ 3,
137
+ [
138
+ 0,
139
+ 0,
140
+ 3,
141
+ 1
142
+ ],
143
+ "data-intent"
144
+ ],
145
+ [
146
+ 5,
147
+ [
148
+ 0,
149
+ 0,
150
+ 3,
151
+ 2
152
+ ],
153
+ "disabled"
154
+ ],
155
+ [
156
+ 3,
157
+ [
158
+ 0,
159
+ 0,
160
+ 3,
161
+ 2
162
+ ],
163
+ "data-intent"
164
+ ],
165
+ [
166
+ 2,
167
+ [
168
+ 0,
169
+ 0,
170
+ 3
171
+ ],
172
+ 3
173
+ ],
174
+ [
175
+ 3,
176
+ [
177
+ 0,
178
+ 0,
179
+ 3,
180
+ 3
181
+ ],
182
+ "data-intent"
183
+ ],
184
+ [
185
+ 2,
186
+ [0, 0],
187
+ 4
188
+ ],
189
+ [
190
+ 3,
191
+ [
192
+ 0,
193
+ 0,
194
+ 4,
195
+ 1
196
+ ],
197
+ "data-intent"
198
+ ],
199
+ [
200
+ 5,
201
+ [
202
+ 0,
203
+ 0,
204
+ 4,
205
+ 1,
206
+ 0
207
+ ],
208
+ "disabled"
209
+ ],
210
+ [
211
+ 2,
212
+ [
213
+ 0,
214
+ 0,
215
+ 4,
216
+ 1,
217
+ 0
218
+ ],
219
+ 1
220
+ ],
221
+ [
222
+ 5,
223
+ [
224
+ 0,
225
+ 0,
226
+ 4,
227
+ 2,
228
+ 0
229
+ ],
230
+ "checked"
231
+ ],
232
+ [
233
+ 3,
234
+ [
235
+ 0,
236
+ 0,
237
+ 4,
238
+ 2,
239
+ 0
240
+ ],
241
+ "data-intent"
242
+ ],
243
+ [
244
+ 5,
245
+ [
246
+ 0,
247
+ 0,
248
+ 4,
249
+ 3,
250
+ 0
251
+ ],
252
+ "checked"
253
+ ],
254
+ [
255
+ 3,
256
+ [
257
+ 0,
258
+ 0,
259
+ 4,
260
+ 3,
261
+ 0
262
+ ],
263
+ "data-intent"
264
+ ],
265
+ [
266
+ 2,
267
+ [0, 0],
268
+ 5
269
+ ],
270
+ [
271
+ 2,
272
+ [
273
+ 0,
274
+ 0,
275
+ 5,
276
+ 1
277
+ ],
278
+ 0
279
+ ],
280
+ [1, [
281
+ 0,
282
+ 0,
283
+ 5,
284
+ 1,
285
+ 0,
286
+ 1
287
+ ]],
288
+ [1, [
289
+ 0,
290
+ 0,
291
+ 5,
292
+ 1,
293
+ 1,
294
+ 1
295
+ ]],
296
+ [1, [
297
+ 0,
298
+ 0,
299
+ 5,
300
+ 1,
301
+ 2,
302
+ 1
303
+ ]],
304
+ [1, [
305
+ 0,
306
+ 0,
307
+ 5,
308
+ 1,
309
+ 3,
310
+ 1
311
+ ]],
312
+ [1, [
313
+ 0,
314
+ 0,
315
+ 5,
316
+ 1,
317
+ 4,
318
+ 1
319
+ ]],
320
+ [1, [
321
+ 0,
322
+ 0,
323
+ 5,
324
+ 1,
325
+ 5,
326
+ 1
327
+ ]],
328
+ [1, [
329
+ 0,
330
+ 0,
331
+ 5,
332
+ 1,
333
+ 6,
334
+ 1
335
+ ]],
336
+ [1, [
337
+ 0,
338
+ 0,
339
+ 5,
340
+ 1,
341
+ 7,
342
+ 1
343
+ ]],
344
+ [
345
+ 2,
346
+ [
347
+ 0,
348
+ 0,
349
+ 5,
350
+ 1,
351
+ 8,
352
+ 1
353
+ ],
354
+ 0
355
+ ],
356
+ [
357
+ 2,
358
+ [
359
+ 0,
360
+ 0,
361
+ 5,
362
+ 1,
363
+ 8,
364
+ 1
365
+ ],
366
+ 2
367
+ ],
368
+ [0, [0]]
369
+ ],
370
+ "segments": [
371
+ "<section",
372
+ {
373
+ "k": "attr",
374
+ "name": "class",
375
+ "strings": [
376
+ "slate ",
377
+ " ",
378
+ ""
379
+ ]
380
+ },
381
+ {
382
+ "k": "attr",
383
+ "name": "aria-label"
384
+ },
385
+ {
386
+ "k": "attr",
387
+ "name": "data-intent-keydown"
388
+ },
389
+ "><div",
390
+ {
391
+ "k": "bool",
392
+ "name": "inert"
393
+ },
394
+ "><header><h2>",
395
+ {
396
+ "k": "child",
397
+ "in": "h2"
398
+ },
399
+ "</h2><dl>",
400
+ {
401
+ "k": "child",
402
+ "in": "dl"
403
+ },
404
+ "<div><dt>Time</dt><dd>",
405
+ {
406
+ "k": "child",
407
+ "in": "dd"
408
+ },
409
+ "</dd></div></dl><p>",
410
+ {
411
+ "k": "child",
412
+ "in": "p"
413
+ },
414
+ "</p></header>",
415
+ {
416
+ "k": "open",
417
+ "tag": "jy-card-table",
418
+ "html": "<jy-card-table",
419
+ "attrs": []
420
+ },
421
+ {
422
+ "k": "prop",
423
+ "name": "layout"
424
+ },
425
+ {
426
+ "k": "prop",
427
+ "name": "options"
428
+ },
429
+ {
430
+ "k": "attr",
431
+ "name": "data-intent"
432
+ },
433
+ { "k": "openEnd" },
434
+ {
435
+ "k": "close",
436
+ "tag": "jy-card-table"
437
+ },
438
+ "<p class=\"message\" aria-hidden=\"true\">",
439
+ {
440
+ "k": "child",
441
+ "in": "p"
442
+ },
443
+ "</p><div class=\"actions\"><button type=\"button\"",
444
+ {
445
+ "k": "bool",
446
+ "name": "disabled"
447
+ },
448
+ {
449
+ "k": "attr",
450
+ "name": "data-intent"
451
+ },
452
+ ">New game</button><button type=\"button\"",
453
+ {
454
+ "k": "bool",
455
+ "name": "disabled"
456
+ },
457
+ {
458
+ "k": "attr",
459
+ "name": "data-intent"
460
+ },
461
+ ">Undo</button><button type=\"button\"",
462
+ {
463
+ "k": "bool",
464
+ "name": "disabled"
465
+ },
466
+ {
467
+ "k": "attr",
468
+ "name": "data-intent"
469
+ },
470
+ ">Hint</button>",
471
+ {
472
+ "k": "child",
473
+ "in": "div"
474
+ },
475
+ "<button type=\"button\" aria-haspopup=\"dialog\"",
476
+ {
477
+ "k": "attr",
478
+ "name": "data-intent"
479
+ },
480
+ ">Keys</button></div>",
481
+ {
482
+ "k": "child",
483
+ "in": "div"
484
+ },
485
+ "<details><summary>Settings and deal number</summary><form aria-label=\"Settings\"",
486
+ {
487
+ "k": "attr",
488
+ "name": "data-intent"
489
+ },
490
+ "><fieldset",
491
+ {
492
+ "k": "bool",
493
+ "name": "disabled"
494
+ },
495
+ "><legend>Choose before the first move</legend>",
496
+ {
497
+ "k": "child",
498
+ "in": "fieldset"
499
+ },
500
+ "<button type=\"submit\">Deal</button></fieldset></form><label><input type=\"checkbox\"",
501
+ {
502
+ "k": "bool",
503
+ "name": "checked"
504
+ },
505
+ {
506
+ "k": "attr",
507
+ "name": "data-intent"
508
+ },
509
+ "> Four-color deck (blue diamonds, green clubs)</label><label><input type=\"checkbox\"",
510
+ {
511
+ "k": "bool",
512
+ "name": "checked"
513
+ },
514
+ {
515
+ "k": "attr",
516
+ "name": "data-intent"
517
+ },
518
+ "> Soft card sounds</label></details>",
519
+ {
520
+ "k": "child",
521
+ "in": "div"
522
+ },
523
+ "<details><summary>Records on this device</summary><dl>",
524
+ {
525
+ "k": "child",
526
+ "in": "dl"
527
+ },
528
+ "<div><dt>Played</dt><dd>",
529
+ {
530
+ "k": "child",
531
+ "in": "dd"
532
+ },
533
+ "</dd></div><div><dt>Won</dt><dd>",
534
+ {
535
+ "k": "child",
536
+ "in": "dd"
537
+ },
538
+ "</dd></div><div><dt>Best score</dt><dd>",
539
+ {
540
+ "k": "child",
541
+ "in": "dd"
542
+ },
543
+ "</dd></div><div><dt>Fewest moves in a win</dt><dd>",
544
+ {
545
+ "k": "child",
546
+ "in": "dd"
547
+ },
548
+ "</dd></div><div><dt>Best time</dt><dd>",
549
+ {
550
+ "k": "child",
551
+ "in": "dd"
552
+ },
553
+ "</dd></div><div><dt>Best run</dt><dd>",
554
+ {
555
+ "k": "child",
556
+ "in": "dd"
557
+ },
558
+ "</dd></div><div><dt>Cleared</dt><dd>",
559
+ {
560
+ "k": "child",
561
+ "in": "dd"
562
+ },
563
+ "</dd></div><div><dt>Wins without help</dt><dd>",
564
+ {
565
+ "k": "child",
566
+ "in": "dd"
567
+ },
568
+ "</dd></div><div><dt>Win streak (best)</dt><dd>",
569
+ {
570
+ "k": "child",
571
+ "in": "dd"
572
+ },
573
+ "<!----> (",
574
+ {
575
+ "k": "child",
576
+ "in": "dd"
577
+ },
578
+ "<!---->)</dd></div></dl></details></div>",
579
+ {
580
+ "k": "child",
581
+ "in": "section"
582
+ },
583
+ "</section>"
584
+ ]
585
+ };
586
+ var _gyral$t2 = {
587
+ "id": "15h47s4kd6o",
588
+ "html": "<div><dt></dt><dd></dd></div>",
589
+ "parts": [[1, [0, 0]], [1, [0, 1]]],
590
+ "segments": [
591
+ "<div><dt>",
592
+ {
593
+ "k": "child",
594
+ "in": "dt"
595
+ },
596
+ "</dt><dd>",
597
+ {
598
+ "k": "child",
599
+ "in": "dd"
600
+ },
601
+ "</dd></div>"
602
+ ]
603
+ };
604
+ var _gyral$t3 = {
605
+ "id": "22dvwpiecj6",
606
+ "html": "<button type=\"button\"></button>",
607
+ "parts": [
608
+ [
609
+ 3,
610
+ [0],
611
+ "class"
612
+ ],
613
+ [
614
+ 5,
615
+ [0],
616
+ "disabled"
617
+ ],
618
+ [
619
+ 3,
620
+ [0],
621
+ "value"
622
+ ],
623
+ [
624
+ 3,
625
+ [0],
626
+ "data-intent"
627
+ ],
628
+ [1, [0]]
629
+ ],
630
+ "segments": [
631
+ "<button type=\"button\"",
632
+ {
633
+ "k": "attr",
634
+ "name": "class"
635
+ },
636
+ {
637
+ "k": "bool",
638
+ "name": "disabled"
639
+ },
640
+ {
641
+ "k": "attr",
642
+ "name": "value"
643
+ },
644
+ {
645
+ "k": "attr",
646
+ "name": "data-intent"
647
+ },
648
+ ">",
649
+ {
650
+ "k": "child",
651
+ "in": "button"
652
+ },
653
+ "</button>"
654
+ ]
655
+ };
656
+ var _gyral$t4 = {
657
+ "id": "1z5f15jk251",
658
+ "html": "<div class=\"scorecard\"><table><caption>Round scorecard</caption><thead><tr><th scope=\"col\">Hole</th><th scope=\"col\">Strokes</th><th scope=\"col\">Running total</th><th scope=\"col\">Par</th></tr></thead><tbody></tbody></table></div>",
659
+ "parts": [[1, [
660
+ 0,
661
+ 0,
662
+ 2
663
+ ]]],
664
+ "segments": [
665
+ "<div class=\"scorecard\"><table><caption>Round scorecard</caption><thead><tr><th scope=\"col\">Hole</th><th scope=\"col\">Strokes</th><th scope=\"col\">Running total</th><th scope=\"col\">Par</th></tr></thead><tbody>",
666
+ {
667
+ "k": "child",
668
+ "in": "tbody"
669
+ },
670
+ "</tbody></table></div>"
671
+ ]
672
+ };
673
+ var _gyral$t5 = {
674
+ "id": "1erwo2fd8e3",
675
+ "html": "<tr><th scope=\"row\"></th><td><!----> </td><td></td><td></td></tr>",
676
+ "parts": [
677
+ [1, [0, 0]],
678
+ [
679
+ 2,
680
+ [0, 1],
681
+ 0
682
+ ],
683
+ [0, [0, 1]],
684
+ [1, [0, 2]],
685
+ [1, [0, 3]]
686
+ ],
687
+ "segments": [
688
+ "<tr><th scope=\"row\">",
689
+ {
690
+ "k": "child",
691
+ "in": "th"
692
+ },
693
+ "</th><td>",
694
+ {
695
+ "k": "child",
696
+ "in": "td"
697
+ },
698
+ "<!----> ",
699
+ {
700
+ "k": "child",
701
+ "in": "td"
702
+ },
703
+ "</td><td>",
704
+ {
705
+ "k": "child",
706
+ "in": "td"
707
+ },
708
+ "</td><td>",
709
+ {
710
+ "k": "child",
711
+ "in": "td"
712
+ },
713
+ "</td></tr>"
714
+ ]
715
+ };
716
+ var _gyral$t6 = {
717
+ "id": "28rumymo09q",
718
+ "html": "<label><!----></label>",
719
+ "parts": [[
720
+ 2,
721
+ [0],
722
+ 0
723
+ ], [0, [0]]],
724
+ "segments": [
725
+ "<label>",
726
+ {
727
+ "k": "child",
728
+ "in": "label"
729
+ },
730
+ "<!---->",
731
+ {
732
+ "k": "child",
733
+ "in": "label"
734
+ },
735
+ "</label>"
736
+ ]
737
+ };
738
+ var _gyral$t7 = {
739
+ "id": "hrsvpey5h8",
740
+ "html": "<input type=\"number\" min=\"1\" max=\"1000000\" required>",
741
+ "parts": [[
742
+ 3,
743
+ [0],
744
+ "name"
745
+ ], [
746
+ 3,
747
+ [0],
748
+ "value"
749
+ ]],
750
+ "segments": [
751
+ "<input type=\"number\" min=\"1\" max=\"1000000\" required",
752
+ {
753
+ "k": "attr",
754
+ "name": "name"
755
+ },
756
+ {
757
+ "k": "attr",
758
+ "name": "value"
759
+ },
760
+ ">"
761
+ ]
762
+ };
763
+ var _gyral$t8 = {
764
+ "id": "1n6iv48mn9q",
765
+ "html": "<select></select>",
766
+ "parts": [[
767
+ 3,
768
+ [0],
769
+ "name"
770
+ ], [1, [0]]],
771
+ "segments": [
772
+ "<select",
773
+ {
774
+ "k": "attr",
775
+ "name": "name"
776
+ },
777
+ ">",
778
+ {
779
+ "k": "child",
780
+ "in": "select"
781
+ },
782
+ "</select>"
783
+ ]
784
+ };
785
+ var _gyral$t9 = {
786
+ "id": "qobqqeiasp",
787
+ "html": "<option></option>",
788
+ "parts": [
789
+ [
790
+ 3,
791
+ [0],
792
+ "value"
793
+ ],
794
+ [
795
+ 5,
796
+ [0],
797
+ "selected"
798
+ ],
799
+ [1, [0]]
800
+ ],
801
+ "segments": [
802
+ "<option",
803
+ {
804
+ "k": "attr",
805
+ "name": "value"
806
+ },
807
+ {
808
+ "k": "bool",
809
+ "name": "selected"
810
+ },
811
+ ">",
812
+ {
813
+ "k": "child",
814
+ "in": "option"
815
+ },
816
+ "</option>"
817
+ ]
818
+ };
819
+ var _gyral$t10 = {
820
+ "id": "1xol9sxyvv8",
821
+ "html": "<details><summary>Removed cards</summary><ul></ul></details>",
822
+ "parts": [[1, [0, 1]]],
823
+ "segments": [
824
+ "<details><summary>Removed cards</summary><ul>",
825
+ {
826
+ "k": "child",
827
+ "in": "ul"
828
+ },
829
+ "</ul></details>"
830
+ ]
831
+ };
832
+ var _gyral$t11 = {
833
+ "id": "2crefdy4szm",
834
+ "html": "<li></li>",
835
+ "parts": [[1, [0]]],
836
+ "segments": [
837
+ "<li>",
838
+ {
839
+ "k": "child",
840
+ "in": "li"
841
+ },
842
+ "</li>"
843
+ ]
844
+ };
845
+ var _gyral$t12 = {
846
+ "id": "3ectna8zd0",
847
+ "html": "<div><dt>Rounds completed</dt><dd></dd></div><div><dt>Best round</dt><dd></dd></div><div><dt>Average round</dt><dd></dd></div><div><dt>Best hole</dt><dd></dd></div><div><dt>Rounds at or under par</dt><dd></dd></div>",
848
+ "parts": [
849
+ [1, [0, 1]],
850
+ [1, [1, 1]],
851
+ [1, [2, 1]],
852
+ [1, [3, 1]],
853
+ [1, [4, 1]]
854
+ ],
855
+ "segments": [
856
+ "<div><dt>Rounds completed</dt><dd>",
857
+ {
858
+ "k": "child",
859
+ "in": "dd"
860
+ },
861
+ "</dd></div><div><dt>Best round</dt><dd>",
862
+ {
863
+ "k": "child",
864
+ "in": "dd"
865
+ },
866
+ "</dd></div><div><dt>Average round</dt><dd>",
867
+ {
868
+ "k": "child",
869
+ "in": "dd"
870
+ },
871
+ "</dd></div><div><dt>Best hole</dt><dd>",
872
+ {
873
+ "k": "child",
874
+ "in": "dd"
875
+ },
876
+ "</dd></div><div><dt>Rounds at or under par</dt><dd>",
877
+ {
878
+ "k": "child",
879
+ "in": "dd"
880
+ },
881
+ "</dd></div>"
882
+ ]
883
+ };
884
+ var _gyral$t13 = {
885
+ "id": "50etz2mfdl",
886
+ "html": "<dialog class=\"panel\"><h3></h3><p></p><button type=\"button\"></button></dialog>",
887
+ "parts": [
888
+ [
889
+ 5,
890
+ [0],
891
+ "modal"
892
+ ],
893
+ [
894
+ 3,
895
+ [0],
896
+ "aria-label"
897
+ ],
898
+ [
899
+ 3,
900
+ [0],
901
+ "data-intent-keydown"
902
+ ],
903
+ [
904
+ 3,
905
+ [0],
906
+ "data-intent-close"
907
+ ],
908
+ [1, [0, 0]],
909
+ [1, [0, 1]],
910
+ [
911
+ 2,
912
+ [0],
913
+ 2
914
+ ],
915
+ [
916
+ 3,
917
+ [0, 2],
918
+ "data-intent"
919
+ ],
920
+ [1, [0, 2]]
921
+ ],
922
+ "segments": [
923
+ "<dialog class=\"panel\"",
924
+ {
925
+ "k": "bool",
926
+ "name": "modal"
927
+ },
928
+ {
929
+ "k": "attr",
930
+ "name": "aria-label"
931
+ },
932
+ {
933
+ "k": "attr",
934
+ "name": "data-intent-keydown"
935
+ },
936
+ {
937
+ "k": "attr",
938
+ "name": "data-intent-close"
939
+ },
940
+ "><h3>",
941
+ {
942
+ "k": "child",
943
+ "in": "h3"
944
+ },
945
+ "</h3><p>",
946
+ {
947
+ "k": "child",
948
+ "in": "p"
949
+ },
950
+ "</p>",
951
+ {
952
+ "k": "child",
953
+ "in": "dialog"
954
+ },
955
+ "<button type=\"button\"",
956
+ {
957
+ "k": "attr",
958
+ "name": "data-intent"
959
+ },
960
+ ">",
961
+ {
962
+ "k": "child",
963
+ "in": "button"
964
+ },
965
+ "</button></dialog>"
966
+ ]
967
+ };
968
+ var _gyral$t14 = {
969
+ "id": "1wffdwrdm09",
970
+ "html": "<button type=\"button\">End and start again</button>",
971
+ "parts": [[
972
+ 3,
973
+ [0],
974
+ "data-intent"
975
+ ]],
976
+ "segments": [
977
+ "<button type=\"button\"",
978
+ {
979
+ "k": "attr",
980
+ "name": "data-intent"
981
+ },
982
+ ">End and start again</button>"
983
+ ]
984
+ };
985
+ var EMPTY_ROW = {
986
+ played: 0,
987
+ won: 0,
988
+ bestScore: null,
989
+ fewestMoves: null,
990
+ bestMs: null,
991
+ bestRun: 0,
992
+ cleared: 0,
993
+ cleanWins: 0,
994
+ streak: 0,
995
+ longestStreak: 0,
996
+ completed: 0,
997
+ totalStrokes: 0,
998
+ bestRound: null,
999
+ bestHole: null,
1000
+ underPar: 0
1001
+ };
1002
+ var record = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
1003
+ var count = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0;
1004
+ var recordSchema = { "~standard": {
1005
+ version: 1,
1006
+ vendor: "joystyk",
1007
+ validate: (v) => {
1008
+ if (!record(v)) return { issues: [{ message: "Expected solitaire records." }] };
1009
+ const rows = {};
1010
+ for (const [key, raw] of Object.entries(v)) {
1011
+ if (!record(raw) || ![
1012
+ "played",
1013
+ "won",
1014
+ "bestRun",
1015
+ "cleared",
1016
+ "cleanWins",
1017
+ "streak",
1018
+ "longestStreak",
1019
+ "completed",
1020
+ "underPar"
1021
+ ].every((field) => count(raw[field])) || typeof raw["totalStrokes"] !== "number" || !Number.isFinite(raw["totalStrokes"]) || ![
1022
+ "bestScore",
1023
+ "fewestMoves",
1024
+ "bestMs",
1025
+ "bestRound",
1026
+ "bestHole"
1027
+ ].every((field) => raw[field] === null || typeof raw[field] === "number" && Number.isFinite(raw[field]))) return { issues: [{ message: "Invalid solitaire record." }] };
1028
+ rows[key] = raw;
1029
+ }
1030
+ return { value: rows };
1031
+ }
1032
+ } };
1033
+ var decode = (schema, raw) => {
1034
+ const result = schema["~standard"].validate(raw);
1035
+ return result instanceof Promise || result.issues !== void 0 ? null : result.value;
1036
+ };
1037
+ var metaSchema = { "~standard": {
1038
+ version: 1,
1039
+ vendor: "joystyk",
1040
+ validate: (raw) => {
1041
+ if (!record(raw) || !record(raw["meta"]) || !count(raw["meta"]["revision"])) return { issues: [{ message: "Invalid solitaire snapshot." }] };
1042
+ const m = raw["meta"];
1043
+ const outcome = m["outcome"];
1044
+ const notice = m["notice"];
1045
+ if (outcome !== null && (!record(outcome) || typeof outcome["result"] !== "string" || ![
1046
+ "won",
1047
+ "lost",
1048
+ "draw",
1049
+ "completed",
1050
+ "abandoned"
1051
+ ].includes(outcome["result"]) || typeof outcome["summary"] !== "string")) return { issues: [{ message: "Invalid result." }] };
1052
+ return { value: {
1053
+ revision: m["revision"],
1054
+ result: record(outcome) ? String(outcome["result"]) : null,
1055
+ summary: record(outcome) ? String(outcome["summary"]) : "",
1056
+ notice: record(notice) && typeof notice["message"] === "string" ? notice["message"] : "",
1057
+ elapsedMs: count(raw["elapsedMs"]) ? raw["elapsedMs"] : record(outcome) && count(outcome["elapsedMs"]) ? outcome["elapsedMs"] : 0,
1058
+ undosUsed: count(m["undosUsed"]) ? m["undosUsed"] : record(outcome) && count(outcome["undosUsed"]) ? outcome["undosUsed"] : 0,
1059
+ assisted: record(outcome) && Array.isArray(outcome["assists"]) && outcome["assists"].length > 0,
1060
+ canUndo: record(raw["undo"]) && raw["undo"]["available"] === true,
1061
+ paused: raw["paused"] === true
1062
+ } };
1063
+ }
1064
+ } };
1065
+ var feed = defineDriver("solitaire-session");
1066
+ var prefs = defineDriver("solitaire-preferences");
1067
+ var timer = defineDriver("solitaire-timer");
1068
+ var sending = defineDriver("solitaire-send");
1069
+ var speaking = defineDriver("solitaire-speak");
1070
+ var reading = defineDriver("solitaire-read");
1071
+ var writing = defineDriver("solitaire-write");
1072
+ var color = defineDriver("solitaire-color");
1073
+ var sounding = defineDriver("solitaire-sound");
1074
+ var jsonSchema = { "~standard": {
1075
+ version: 1,
1076
+ vendor: "joystyk",
1077
+ validate: (raw) => isJson(raw) ? { value: raw } : { issues: [{ message: "Expected JSON." }] }
1078
+ } };
1079
+ var booleanSchema = { "~standard": {
1080
+ version: 1,
1081
+ vendor: "joystyk",
1082
+ validate: (raw) => typeof raw === "boolean" ? { value: raw } : { issues: [{ message: "Expected a boolean." }] }
1083
+ } };
1084
+ var say = (line) => command(speaking, line);
1085
+ var send = (action) => command(sending, action, {
1086
+ concurrency: "queue",
1087
+ onSuccess: (message) => message === "" ? void 0 : {
1088
+ _tag: "Message",
1089
+ message
1090
+ },
1091
+ onFailure: () => ({
1092
+ _tag: "Message",
1093
+ message: "The deal could not be prepared. Try again."
1094
+ })
1095
+ });
1096
+ var i = intentsOf();
1097
+ var timeText = (ms) => `${Math.floor(ms / 6e4)}:${String(Math.floor(ms / 1e3) % 60).padStart(2, "0")}`;
1098
+ var SolitaireBoard = define()("jy-solitaire-board", {
1099
+ init: () => [{
1100
+ snapshot: null,
1101
+ options: DEFAULT_OPTIONS,
1102
+ dark: true,
1103
+ message: "",
1104
+ dialog: "none",
1105
+ elapsedMs: 0,
1106
+ records: {},
1107
+ sound: false
1108
+ }, [command(reading, "records", { onSuccess: (v) => ({
1109
+ _tag: "Records",
1110
+ records: decode(recordSchema, v) ?? {}
1111
+ }) }), command(reading, "fourColor", {
1112
+ key: "four-color",
1113
+ onSuccess: (v) => ({
1114
+ _tag: "Color",
1115
+ on: decode(booleanSchema, v) ?? false
1116
+ })
1117
+ })]],
1118
+ subscriptions: () => [
1119
+ command(feed, void 0, { onSuccess: (snapshot) => ({
1120
+ _tag: "Snapshot",
1121
+ snapshot
1122
+ }) }),
1123
+ command(prefs, void 0, { onSuccess: (p) => ({
1124
+ _tag: "Preferences",
1125
+ p
1126
+ }) }),
1127
+ command(timer, void 0, { onSuccess: (ms) => ({
1128
+ _tag: "Tick",
1129
+ ms
1130
+ }) })
1131
+ ],
1132
+ intent: {
1133
+ Table: child(CardTable, (out) => ({
1134
+ _tag: "Table",
1135
+ out
1136
+ })),
1137
+ Action: ({ value }) => {
1138
+ if (value === void 0) return void 0;
1139
+ try {
1140
+ const c = decode(jsonSchema, JSON.parse(value));
1141
+ return c === null ? void 0 : {
1142
+ _tag: "Action",
1143
+ action: {
1144
+ kind: "command",
1145
+ command: c
1146
+ }
1147
+ };
1148
+ } catch {
1149
+ return;
1150
+ }
1151
+ },
1152
+ Undo: () => ({
1153
+ _tag: "Action",
1154
+ action: { kind: "undo" }
1155
+ }),
1156
+ Hint: () => ({
1157
+ _tag: "Action",
1158
+ action: {
1159
+ kind: "command",
1160
+ command: { type: "hint" }
1161
+ }
1162
+ }),
1163
+ New: () => ({
1164
+ _tag: "Dialog",
1165
+ dialog: "confirm"
1166
+ }),
1167
+ Keys: () => ({
1168
+ _tag: "Dialog",
1169
+ dialog: "keys"
1170
+ }),
1171
+ Cancel: ({ key, event }) => event instanceof KeyboardEvent && key !== "Escape" ? void 0 : {
1172
+ _tag: "Dialog",
1173
+ dialog: "none"
1174
+ },
1175
+ Confirm: () => ({
1176
+ _tag: "Action",
1177
+ action: { kind: "resign" }
1178
+ }),
1179
+ Color: ({ checked }) => ({
1180
+ _tag: "Color",
1181
+ on: checked === true
1182
+ }),
1183
+ Sound: ({ checked }) => ({
1184
+ _tag: "Sound",
1185
+ on: checked === true
1186
+ }),
1187
+ Setup: ({ formData }) => formData === void 0 ? void 0 : {
1188
+ _tag: "Action",
1189
+ action: {
1190
+ kind: "setup",
1191
+ values: Object.fromEntries(Array.from(formData.entries(), ([key, v]) => [key, String(v)]))
1192
+ }
1193
+ },
1194
+ Key: ({ key, event }) => {
1195
+ if (!(event instanceof KeyboardEvent) || event.defaultPrevented || event.repeat || key === void 0 || event.altKey || event.target instanceof Element && event.target.closest("input,select,textarea,dialog") !== null) return void 0;
1196
+ const ctrl = event.ctrlKey || event.metaKey;
1197
+ if (ctrl && key.toLowerCase() !== "z") return void 0;
1198
+ if ([
1199
+ "u",
1200
+ "d",
1201
+ "h",
1202
+ "n",
1203
+ "t",
1204
+ "w",
1205
+ "?"
1206
+ ].includes(key.toLowerCase()) || ctrl) event.preventDefault();
1207
+ return {
1208
+ _tag: "Key",
1209
+ key,
1210
+ ctrl
1211
+ };
1212
+ }
1213
+ },
1214
+ update: {
1215
+ Snapshot: (s, { snapshot: next }) => {
1216
+ const changed = s.snapshot?.revision !== next.revision;
1217
+ const commands = [];
1218
+ if (changed && next.data.line !== "") commands.push(say(next.data.line));
1219
+ if (changed && s.snapshot !== null && s.sound && next.data.line !== "") commands.push(command(sounding, next.result === "won" || next.data.round !== void 0 && next.data.round.bestHole < 0 ? "clear" : "card"));
1220
+ if (s.snapshot === null) commands.push(say(next.data.status));
1221
+ if (next.notice !== "" && next.notice !== s.snapshot?.notice) commands.push(say(next.notice));
1222
+ if (next.data.actions.some((a) => a.label === "Next hole" || a.label === "Finish round") && !s.snapshot?.data.actions.some((a) => a.label === "Next hole" || a.label === "Finish round")) commands.push(focus(".advance"));
1223
+ let records = s.records;
1224
+ if (s.snapshot !== null && s.snapshot.result === null && next.result !== null) {
1225
+ const old = records[next.data.recordGroup] ?? EMPTY_ROW;
1226
+ const won = next.result === "won";
1227
+ const streak = won ? old.streak + 1 : 0;
1228
+ const round = next.result === "completed" ? next.data.round : void 0;
1229
+ const row = {
1230
+ played: old.played + 1,
1231
+ won: old.won + Number(won),
1232
+ bestScore: Math.max(old.bestScore ?? -Infinity, next.data.score),
1233
+ fewestMoves: won ? Math.min(old.fewestMoves ?? Infinity, next.data.moves) : old.fewestMoves,
1234
+ bestMs: won ? Math.min(old.bestMs ?? Infinity, next.elapsedMs) : old.bestMs,
1235
+ bestRun: Math.max(old.bestRun, next.data.bestRun),
1236
+ cleared: old.cleared + next.data.cleared,
1237
+ cleanWins: old.cleanWins + Number(won && next.undosUsed === 0 && !next.assisted),
1238
+ streak,
1239
+ longestStreak: Math.max(old.longestStreak, streak),
1240
+ completed: old.completed + Number(round !== void 0),
1241
+ totalStrokes: old.totalStrokes + (round?.strokes ?? 0),
1242
+ bestRound: round === void 0 ? old.bestRound : Math.min(old.bestRound ?? Infinity, round.strokes),
1243
+ bestHole: round === void 0 ? old.bestHole : Math.min(old.bestHole ?? Infinity, round.bestHole),
1244
+ underPar: old.underPar + Number(round !== void 0 && round.strokes <= round.par)
1245
+ };
1246
+ records = {
1247
+ ...records,
1248
+ [next.data.recordGroup]: row
1249
+ };
1250
+ commands.push(command(writing, records));
1251
+ commands.push(say(next.summary));
1252
+ }
1253
+ return [{
1254
+ ...s,
1255
+ snapshot: next,
1256
+ records,
1257
+ options: {
1258
+ ...s.options,
1259
+ back: next.data.back
1260
+ },
1261
+ message: next.notice || (changed ? next.data.line : s.message),
1262
+ dialog: next.result !== null ? "none" : s.dialog
1263
+ }, commands];
1264
+ },
1265
+ Preferences: (s, { p }) => ({
1266
+ ...s,
1267
+ dark: p.colorScheme === "dark",
1268
+ options: {
1269
+ ...s.options,
1270
+ calm: p.reducedMotion,
1271
+ singleKeys: p.singleKeyShortcuts
1272
+ }
1273
+ }),
1274
+ Records: (s, m) => ({
1275
+ ...s,
1276
+ records: m.records
1277
+ }),
1278
+ Tick: (s, m) => ({
1279
+ ...s,
1280
+ elapsedMs: m.ms
1281
+ }),
1282
+ Message: (s, m) => [{
1283
+ ...s,
1284
+ message: m.message
1285
+ }, [say(m.message)]],
1286
+ Table: (s, { out }) => out._tag === "Announce" ? [s, [say(out.message)]] : s.snapshot?.result === null && !s.snapshot.paused ? [s, [send({
1287
+ kind: "table",
1288
+ out
1289
+ })]] : s,
1290
+ Action: (s, m) => s.snapshot?.result === null && !s.snapshot.paused ? [{
1291
+ ...s,
1292
+ dialog: "none"
1293
+ }, [send(m.action)]] : s,
1294
+ Dialog: (s, m) => [{
1295
+ ...s,
1296
+ dialog: m.dialog
1297
+ }, m.dialog === "none" ? [focus(".actions button")] : [focus(".panel button")]],
1298
+ Color: (s, m) => [{
1299
+ ...s,
1300
+ options: {
1301
+ ...s.options,
1302
+ fourColor: m.on
1303
+ }
1304
+ }, [command(color, m.on)]],
1305
+ Sound: (s, m) => ({
1306
+ ...s,
1307
+ sound: m.on
1308
+ }),
1309
+ Key: (s, m) => {
1310
+ if (m.key === "?") return s.options.singleKeys ? [{
1311
+ ...s,
1312
+ dialog: "keys"
1313
+ }, [focus(".panel button")]] : s;
1314
+ if (m.ctrl && m.key.toLowerCase() === "z" || s.options.singleKeys && m.key.toLowerCase() === "u") return s.snapshot?.canUndo ? [s, [send({ kind: "undo" })]] : s;
1315
+ return s.options.singleKeys && s.snapshot?.result === null ? [s, [send({
1316
+ kind: "key",
1317
+ key: m.key.toLowerCase()
1318
+ })]] : s;
1319
+ }
1320
+ },
1321
+ view: (s) => {
1322
+ const snap = s.snapshot;
1323
+ if (snap === null) return compiled(_gyral$t0, []);
1324
+ const d = snap.data;
1325
+ const records = s.records[d.recordGroup] ?? EMPTY_ROW;
1326
+ return compiled(_gyral$t1, [
1327
+ d.theme,
1328
+ s.dark ? "dark" : "light",
1329
+ d.title,
1330
+ i.Key,
1331
+ s.dialog !== "none",
1332
+ d.title,
1333
+ d.meters.map((meter) => compiled(_gyral$t2, [meter.label, meter.value])),
1334
+ timeText(snap.result === null ? Math.max(s.elapsedMs, snap.elapsedMs) : snap.elapsedMs),
1335
+ snap.summary || d.status,
1336
+ d.layout,
1337
+ s.options,
1338
+ i.Table,
1339
+ s.message,
1340
+ snap.result !== null,
1341
+ i.New,
1342
+ !snap.canUndo,
1343
+ i.Undo,
1344
+ snap.result !== null,
1345
+ i.Hint,
1346
+ d.actions.map((a) => compiled(_gyral$t3, [
1347
+ a.label === "Next hole" || a.label === "Finish round" ? "advance" : "",
1348
+ a.disabled || snap.result !== null,
1349
+ JSON.stringify(a.command),
1350
+ i.Action,
1351
+ a.label
1352
+ ])),
1353
+ i.Keys,
1354
+ d.scorecard === void 0 ? nothing : compiled(_gyral$t4, [d.scorecard.map((row) => compiled(_gyral$t5, [
1355
+ row.hole,
1356
+ row.strokes ?? "–",
1357
+ row.cleared ? "⚑ Cleared" : "",
1358
+ row.total ?? "–",
1359
+ row.par
1360
+ ]))]),
1361
+ i.Setup,
1362
+ !d.setupAllowed || snap.result !== null,
1363
+ d.fields.map((field) => compiled(_gyral$t6, [field.label, field.choices === void 0 ? compiled(_gyral$t7, [field.name, field.value]) : compiled(_gyral$t8, [field.name, field.choices.map((choice) => compiled(_gyral$t9, [
1364
+ choice.value,
1365
+ field.value === choice.value,
1366
+ choice.label
1367
+ ]))])])),
1368
+ s.options.fourColor,
1369
+ i.Color,
1370
+ s.sound,
1371
+ i.Sound,
1372
+ d.history === void 0 ? nothing : compiled(_gyral$t10, [d.history.map((card) => compiled(_gyral$t11, [card]))]),
1373
+ d.round === void 0 ? nothing : compiled(_gyral$t12, [
1374
+ records.completed,
1375
+ records.bestRound ?? "–",
1376
+ records.completed === 0 ? "–" : (records.totalStrokes / records.completed).toFixed(1),
1377
+ records.bestHole ?? "–",
1378
+ records.underPar
1379
+ ]),
1380
+ records.played,
1381
+ records.won,
1382
+ records.bestScore ?? "–",
1383
+ records.fewestMoves ?? "–",
1384
+ records.bestMs === null ? "–" : timeText(records.bestMs),
1385
+ records.bestRun,
1386
+ records.cleared,
1387
+ records.cleanWins,
1388
+ records.streak,
1389
+ records.longestStreak,
1390
+ s.dialog === "none" ? nothing : compiled(_gyral$t13, [
1391
+ true,
1392
+ s.dialog === "keys" ? "Keyboard controls" : "End this deal?",
1393
+ i.Cancel,
1394
+ i.Cancel,
1395
+ s.dialog === "keys" ? "Keyboard controls" : "End this deal?",
1396
+ s.dialog === "keys" ? `${d.keys} Single-key shortcuts ${s.options.singleKeys ? "are on" : "are off"}.` : "This game ends now and counts as played. Play again offers a fresh deal.",
1397
+ s.dialog === "confirm" ? compiled(_gyral$t14, [i.Confirm]) : nothing,
1398
+ i.Cancel,
1399
+ s.dialog === "keys" ? "Close" : "Keep playing"
1400
+ ])
1401
+ ]);
1402
+ },
1403
+ styles: css`@layer components {
1404
+ :host { display:block; container-type:inline-size; font: 1rem/1.5 system-ui; }
1405
+ .slate { --ink:oklch(23% 0.03 70); --paper:oklch(93% 0.04 80); color:var(--ink); background:var(--paper); padding:clamp(.25rem,1cqi,1rem); border-radius:1rem; }
1406
+ .noon { --paper:oklch(94% 0.04 80); --back-a:oklch(45% 0.1 65); --back-b:oklch(72% 0.08 80); --back-c:oklch(93% 0.03 85); }
1407
+ .dawn { --paper:oklch(94% 0.018 245); --back-a:oklch(38% 0.08 255); --back-b:oklch(68% 0.08 250); --back-c:oklch(88% 0.08 80); }
1408
+ .dusk { --paper:oklch(91% 0.03 110); --back-a:oklch(38% 0.035 170); --back-b:oklch(65% 0.05 130); --back-c:oklch(85% 0.07 80); }
1409
+ .dark { --paper:oklch(24% 0.035 170); --ink:oklch(95% 0.012 110); }
1410
+ .noon.dark { --paper:oklch(25% 0.035 65); } .dawn.dark { --paper:oklch(25% 0.04 260); }
1411
+ jy-card-table { --table-ink:var(--ink); --table-slot:color-mix(in oklch,var(--ink) 45%,transparent); --table-felt:var(--paper); --table-focus:oklch(68% 0.16 255); --table-target:oklch(55% 0.16 140); --table-hint:oklch(62% 0.15 45); }
1412
+ h2,p { margin-block:.35rem; } dl { display:flex; flex-wrap:wrap; gap:.4rem 1.25rem; margin-block:.4rem; } dt { font-size:.8rem; } dd { margin:0; font-variant-numeric:tabular-nums; font-weight:700; }
1413
+ button,input,select,summary { min-block-size:44px; } button,input,select { font:inherit; color:inherit; border:1px solid currentColor; border-radius:.4rem; background:var(--paper); padding:.35rem .6rem; } button { cursor:pointer; } button:disabled { opacity:.6; cursor:default; } :focus-visible { outline:3px solid var(--ink); outline-offset:3px; }
1414
+ .actions,fieldset { display:flex; flex-wrap:wrap; gap:.5rem; } label { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem; } fieldset { border:0; margin:0; padding:.5rem 0; } legend { padding:0; } input[type=number] { inline-size:10ch; } input[type=checkbox] { min-inline-size:24px; }
1415
+ details { border-block-start:1px solid color-mix(in oklch,var(--ink) 35%,transparent); margin-block:.65rem; padding-block:.35rem; } summary { cursor:pointer; } .message { min-block-size:1.5em; } .scorecard { overflow:auto; } table { border-collapse:collapse; inline-size:100%; font-variant-numeric:tabular-nums; } th,td { padding:.35rem; border-block-end:1px solid currentColor; text-align:start; } caption { text-align:start; font-weight:700; }
1416
+ .panel { position:fixed; inset:0; margin:auto; max-inline-size:min(36rem,calc(100vi - 2rem)); border:2px solid var(--ink); border-radius:1rem; background:var(--paper); color:var(--ink); padding:1rem; box-shadow:0 0 0 100vmax oklch(0% 0 0 / .5); z-index:30; } .panel button { margin:.25rem; }
1417
+ @media (forced-colors:active) { .slate,.panel { background:Canvas; color:CanvasText; } button,input,select { border:1px solid ButtonText; } }
1418
+ }`
1419
+ });
1420
+ var mountSolitaire = (slot, session, platform, adapter) => {
1421
+ const board = new SolitaireBoard();
1422
+ let latest = null;
1423
+ let disposed = false;
1424
+ board.drivers = {
1425
+ "solitaire-session": subscription("solitaire-session", (emit) => session.subscribe((raw) => {
1426
+ const meta = decode(metaSchema, raw);
1427
+ if (meta === null || !record(raw)) return;
1428
+ const view = decode(adapter.view, raw["view"]);
1429
+ if (view === null) return;
1430
+ const events = [];
1431
+ for (const beat of Array.isArray(raw["beats"]) ? raw["beats"] : []) {
1432
+ const event = record(beat) ? decode(adapter.event, beat["event"]) : null;
1433
+ if (event === null) return;
1434
+ events.push(event);
1435
+ }
1436
+ latest = view;
1437
+ emit({
1438
+ ...meta,
1439
+ data: adapter.describe(view, events, meta.revision)
1440
+ });
1441
+ })),
1442
+ "solitaire-preferences": subscription("solitaire-preferences", (emit) => {
1443
+ emit(platform.preferences.get());
1444
+ return platform.preferences.subscribe(emit);
1445
+ }),
1446
+ "solitaire-timer": subscription("solitaire-timer", (emit) => {
1447
+ const clock = session;
1448
+ if (clock.elapsedMs === void 0) return () => {};
1449
+ const id = setInterval(() => emit(clock.elapsedMs()), 250);
1450
+ return () => clearInterval(id);
1451
+ }),
1452
+ "solitaire-speak": defineDriver({
1453
+ name: "solitaire-speak",
1454
+ run: (line) => platform.announce(line, "polite")
1455
+ }),
1456
+ "solitaire-read": defineDriver({
1457
+ name: "solitaire-read",
1458
+ run: (key) => platform.storage.get(key)
1459
+ }),
1460
+ "solitaire-write": defineDriver({
1461
+ name: "solitaire-write",
1462
+ run: (rows) => platform.storage.set("records", rows)
1463
+ }),
1464
+ "solitaire-sound": defineDriver({
1465
+ name: "solitaire-sound",
1466
+ run: (kind) => {
1467
+ if (!disposed) platform.audio?.play(kind);
1468
+ }
1469
+ }),
1470
+ "solitaire-color": defineDriver({
1471
+ name: "solitaire-color",
1472
+ run: (on) => platform.storage.set("fourColor", on)
1473
+ }),
1474
+ "solitaire-send": defineDriver({
1475
+ name: "solitaire-send",
1476
+ run: async (a) => {
1477
+ if (latest === null || disposed) return "";
1478
+ if (a.kind === "undo" || a.kind === "resign") {
1479
+ session.dispatch({ kind: a.kind });
1480
+ return "";
1481
+ }
1482
+ if (a.kind === "table" && a.out._tag === "Announce") {
1483
+ platform.announce(a.out.message, "polite");
1484
+ return "";
1485
+ }
1486
+ const c = a.kind === "command" ? a.command : a.kind === "table" ? adapter.table(latest, a.out) : a.kind === "key" ? adapter.shortcut(latest, a.key) : a.kind === "setup" ? adapter.setup(latest, a.values) : null;
1487
+ if (c === null) return a.kind === "setup" ? "Choose valid settings and a deal number from 1 to 1,000,000." : "";
1488
+ const command = a.kind === "setup" && adapter.prepareSetup !== void 0 ? await adapter.prepareSetup(c) : c;
1489
+ if (!disposed) session.dispatch({
1490
+ kind: "command",
1491
+ command
1492
+ });
1493
+ return "";
1494
+ }
1495
+ })
1496
+ };
1497
+ slot.append(board);
1498
+ return { dispose: () => {
1499
+ if (disposed) return;
1500
+ disposed = true;
1501
+ board.remove();
1502
+ adapter.dispose?.();
1503
+ } };
1504
+ };
1505
+ //#endregion
1506
+ export { SolitaireBoard, decode, mountSolitaire, workerSetup };
1507
+
1508
+ //# sourceMappingURL=solitaire.js.map