cubing 0.42.1 → 0.43.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.
Files changed (123) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/order.js +22 -0
  3. package/dist/bin/order.js.map +7 -0
  4. package/dist/bin/puzzle-geometry-bin.js +284 -0
  5. package/dist/bin/puzzle-geometry-bin.js.map +7 -0
  6. package/dist/bin/scramble.js +124 -0
  7. package/dist/bin/scramble.js.map +7 -0
  8. package/dist/{cubing/KPattern-12e23b1f.d.ts → lib/cubing/KPattern-60960997.d.ts} +1 -1
  9. package/dist/{cubing/TwizzleLink-8eaf164c.d.ts → lib/cubing/TwizzleLink-3c302469.d.ts} +1 -1
  10. package/dist/{cubing → lib/cubing}/alg/index.js +1 -1
  11. package/dist/{cubing → lib/cubing}/bluetooth/index.d.ts +3 -3
  12. package/dist/{cubing → lib/cubing}/bluetooth/index.js +48 -45
  13. package/dist/{cubing → lib/cubing}/bluetooth/index.js.map +2 -2
  14. package/dist/{cubing/bluetooth-puzzle-91e73b7f.d.ts → lib/cubing/bluetooth-puzzle-c3224834.d.ts} +1 -1
  15. package/dist/{cubing/chunk-Y6TQYMMT.js → lib/cubing/chunks/chunk-2N56G6TG.js} +5 -5
  16. package/dist/{cubing/chunk-Y6TQYMMT.js.map → lib/cubing/chunks/chunk-2N56G6TG.js.map} +2 -2
  17. package/dist/{cubing/chunk-AU3TSTCA.js → lib/cubing/chunks/chunk-32CXD7UA.js} +31 -32
  18. package/dist/{cubing/chunk-AU3TSTCA.js.map → lib/cubing/chunks/chunk-32CXD7UA.js.map} +2 -2
  19. package/dist/{cubing/chunk-7QE2OVHX.js → lib/cubing/chunks/chunk-7GUL3OBQ.js} +1 -1
  20. package/dist/{cubing/chunk-7QE2OVHX.js.map → lib/cubing/chunks/chunk-7GUL3OBQ.js.map} +1 -1
  21. package/dist/{cubing/chunk-ULQMFOA2.js → lib/cubing/chunks/chunk-7X47IY3P.js} +15 -13
  22. package/dist/{cubing/chunk-ULQMFOA2.js.map → lib/cubing/chunks/chunk-7X47IY3P.js.map} +2 -2
  23. package/dist/{cubing/chunk-VSFPWTDH.js → lib/cubing/chunks/chunk-DYHU7CO7.js} +616 -34
  24. package/dist/lib/cubing/chunks/chunk-DYHU7CO7.js.map +7 -0
  25. package/dist/{cubing/chunk-QLTH326B.js → lib/cubing/chunks/chunk-KDMCYBSC.js} +2 -2
  26. package/dist/{cubing/chunk-QLTH326B.js.map → lib/cubing/chunks/chunk-KDMCYBSC.js.map} +1 -1
  27. package/dist/lib/cubing/chunks/chunk-NAPITA3L.js +1 -0
  28. package/dist/{cubing/chunk-3ON3T3OH.js → lib/cubing/chunks/chunk-NB6OOT2E.js} +3 -3
  29. package/dist/{cubing/chunk-3ON3T3OH.js.map → lib/cubing/chunks/chunk-NB6OOT2E.js.map} +1 -1
  30. package/dist/{cubing/chunk-6OUID4YZ.js → lib/cubing/chunks/chunk-NEAVVKH5.js} +2 -2
  31. package/dist/{cubing/chunk-6OUID4YZ.js.map → lib/cubing/chunks/chunk-NEAVVKH5.js.map} +1 -1
  32. package/dist/{cubing/chunk-OLH526Y4.js → lib/cubing/chunks/chunk-QF4HTZYW.js} +11 -10
  33. package/dist/lib/cubing/chunks/chunk-QF4HTZYW.js.map +7 -0
  34. package/dist/{cubing/chunk-KF2JGMZA.js → lib/cubing/chunks/chunk-RS62HLA5.js} +21 -19
  35. package/dist/{cubing/chunk-KF2JGMZA.js.map → lib/cubing/chunks/chunk-RS62HLA5.js.map} +2 -2
  36. package/dist/{cubing/chunk-ZYCJIZDN.js → lib/cubing/chunks/chunk-VL22SFND.js} +1 -1
  37. package/dist/{cubing/chunk-ZYCJIZDN.js.map → lib/cubing/chunks/chunk-VL22SFND.js.map} +1 -1
  38. package/dist/{cubing/chunk-FCRM3RQU.js → lib/cubing/chunks/chunk-Z2CCB3XX.js} +61 -76
  39. package/dist/{cubing/chunk-FCRM3RQU.js.map → lib/cubing/chunks/chunk-Z2CCB3XX.js.map} +2 -2
  40. package/dist/{cubing/chunk-YEOYXOGB.js → lib/cubing/chunks/chunk-ZUPLJQAD.js} +3 -3
  41. package/dist/{cubing/chunk-YEOYXOGB.js.map → lib/cubing/chunks/chunk-ZUPLJQAD.js.map} +1 -1
  42. package/dist/lib/cubing/chunks/inside-7XZ5YPBP.js +16 -0
  43. package/dist/{cubing/inside-AZHBOSXQ.js.map → lib/cubing/chunks/inside-7XZ5YPBP.js.map} +2 -2
  44. package/dist/{cubing/puzzles-dynamic-3x3x3-JFZVE27C.js → lib/cubing/chunks/puzzles-dynamic-3x3x3-NSCZM77Q.js} +1 -1
  45. package/dist/{cubing/puzzles-dynamic-3x3x3-JFZVE27C.js.map → lib/cubing/chunks/puzzles-dynamic-3x3x3-NSCZM77Q.js.map} +1 -1
  46. package/dist/{cubing/puzzles-dynamic-4x4x4-DT42HVIY.js → lib/cubing/chunks/puzzles-dynamic-4x4x4-REUXFQJ4.js} +1 -1
  47. package/dist/{cubing/puzzles-dynamic-4x4x4-DT42HVIY.js.map → lib/cubing/chunks/puzzles-dynamic-4x4x4-REUXFQJ4.js.map} +1 -1
  48. package/dist/{cubing/puzzles-dynamic-megaminx-QQYC32WM.js → lib/cubing/chunks/puzzles-dynamic-megaminx-2LVHIDL4.js} +1 -1
  49. package/dist/{cubing/puzzles-dynamic-megaminx-QQYC32WM.js.map → lib/cubing/chunks/puzzles-dynamic-megaminx-2LVHIDL4.js.map} +1 -1
  50. package/dist/{cubing/puzzles-dynamic-side-events-42Q52YAB.js → lib/cubing/chunks/puzzles-dynamic-side-events-HEMWSAMQ.js} +11 -329
  51. package/dist/lib/cubing/chunks/puzzles-dynamic-side-events-HEMWSAMQ.js.map +7 -0
  52. package/dist/{cubing/puzzles-dynamic-unofficial-PCHNKY4Y.js → lib/cubing/chunks/puzzles-dynamic-unofficial-RETSTRRW.js} +1 -1
  53. package/dist/{cubing/puzzles-dynamic-unofficial-PCHNKY4Y.js.map → lib/cubing/chunks/puzzles-dynamic-unofficial-RETSTRRW.js.map} +1 -1
  54. package/dist/{cubing/search-dynamic-sgs-side-events-5U7NX34Z.js → lib/cubing/chunks/search-dynamic-sgs-side-events-67TCU227.js} +14 -14
  55. package/dist/{cubing/search-dynamic-sgs-side-events-5U7NX34Z.js.map → lib/cubing/chunks/search-dynamic-sgs-side-events-67TCU227.js.map} +2 -2
  56. package/dist/{cubing/search-dynamic-sgs-unofficial-YA6LSNFG.js → lib/cubing/chunks/search-dynamic-sgs-unofficial-OUTZD5Y2.js} +7 -7
  57. package/dist/{cubing/search-dynamic-sgs-unofficial-YA6LSNFG.js.map → lib/cubing/chunks/search-dynamic-sgs-unofficial-OUTZD5Y2.js.map} +2 -2
  58. package/dist/{cubing/search-dynamic-solve-3x3x3-HM7RKVEM.js → lib/cubing/chunks/search-dynamic-solve-3x3x3-5UOUZX2V.js} +1 -1
  59. package/dist/{cubing/search-dynamic-solve-3x3x3-HM7RKVEM.js.map → lib/cubing/chunks/search-dynamic-solve-3x3x3-5UOUZX2V.js.map} +1 -1
  60. package/dist/{cubing/search-dynamic-solve-4x4x4-Z26CIIGT.js → lib/cubing/chunks/search-dynamic-solve-4x4x4-7NWGTCEG.js} +12 -9
  61. package/dist/lib/cubing/chunks/search-dynamic-solve-4x4x4-7NWGTCEG.js.map +7 -0
  62. package/dist/{cubing/search-dynamic-solve-fto-GGEYM3K6.js → lib/cubing/chunks/search-dynamic-solve-fto-EY5ZVAGO.js} +1 -1
  63. package/dist/{cubing/search-dynamic-solve-fto-GGEYM3K6.js.map → lib/cubing/chunks/search-dynamic-solve-fto-EY5ZVAGO.js.map} +1 -1
  64. package/dist/{cubing/search-dynamic-solve-kilominx-VUT2DIRQ.js → lib/cubing/chunks/search-dynamic-solve-kilominx-WREDL6AE.js} +2 -2
  65. package/dist/{cubing/search-dynamic-solve-kilominx-VUT2DIRQ.js.map → lib/cubing/chunks/search-dynamic-solve-kilominx-WREDL6AE.js.map} +1 -1
  66. package/dist/{cubing/search-dynamic-solve-master_tetraminx-WJWLROFP.js → lib/cubing/chunks/search-dynamic-solve-master_tetraminx-3D4MBF3V.js} +1 -1
  67. package/dist/{cubing/search-dynamic-solve-master_tetraminx-WJWLROFP.js.map → lib/cubing/chunks/search-dynamic-solve-master_tetraminx-3D4MBF3V.js.map} +1 -1
  68. package/dist/{cubing/search-dynamic-solve-sq1-TO7UHE6Y.js → lib/cubing/chunks/search-dynamic-solve-sq1-INOYNRSJ.js} +1 -1
  69. package/dist/{cubing/search-dynamic-solve-sq1-TO7UHE6Y.js.map → lib/cubing/chunks/search-dynamic-solve-sq1-INOYNRSJ.js.map} +1 -1
  70. package/dist/{cubing → lib/cubing/chunks}/search-worker-entry.js +4 -4
  71. package/dist/{cubing → lib/cubing/chunks}/search-worker-entry.js.map +1 -1
  72. package/dist/{cubing/twisty-dynamic-3d-NTZMGNOB.js → lib/cubing/chunks/twisty-dynamic-3d-EKFIEPIM.js} +78 -37
  73. package/dist/{cubing/twisty-dynamic-3d-NTZMGNOB.js.map → lib/cubing/chunks/twisty-dynamic-3d-EKFIEPIM.js.map} +2 -2
  74. package/dist/{cubing/twsearch-BDAXZGZU-SJCPOVWW.js → lib/cubing/chunks/twsearch-BDAXZGZU-Q2YC2EQ6.js} +1 -1
  75. package/dist/{cubing/twsearch-BDAXZGZU-SJCPOVWW.js.map → lib/cubing/chunks/twsearch-BDAXZGZU-Q2YC2EQ6.js.map} +1 -1
  76. package/dist/{cubing/twsearch-INIYLWAM.js → lib/cubing/chunks/twsearch-SLVE4NQH.js} +3 -3
  77. package/dist/{cubing/twsearch-INIYLWAM.js.map → lib/cubing/chunks/twsearch-SLVE4NQH.js.map} +1 -1
  78. package/dist/{cubing → lib/cubing}/kpuzzle/index.d.ts +1 -1
  79. package/dist/{cubing → lib/cubing}/kpuzzle/index.js +2 -2
  80. package/dist/{cubing → lib/cubing}/notation/index.d.ts +2 -2
  81. package/dist/{cubing → lib/cubing}/notation/index.js +4 -4
  82. package/dist/{cubing/outside-deaac55d.d.ts → lib/cubing/outside-2f424d30.d.ts} +1 -1
  83. package/dist/{cubing → lib/cubing}/protocol/index.d.ts +1 -1
  84. package/dist/{cubing → lib/cubing}/protocol/index.js +4 -4
  85. package/dist/lib/cubing/puzzle-geometry/index.d.ts +7 -0
  86. package/dist/{cubing → lib/cubing}/puzzle-geometry/index.js +142 -62
  87. package/dist/lib/cubing/puzzle-geometry/index.js.map +7 -0
  88. package/dist/{cubing → lib/cubing}/puzzles/index.d.ts +3 -3
  89. package/dist/{cubing → lib/cubing}/puzzles/index.js +4 -4
  90. package/dist/lib/cubing/scramble/index.d.ts +3 -0
  91. package/dist/lib/cubing/scramble/index.js +16 -0
  92. package/dist/{cubing → lib/cubing}/search/index.d.ts +2 -2
  93. package/dist/{cubing → lib/cubing}/search/index.js +9 -10
  94. package/dist/lib/cubing/search/index.js.map +7 -0
  95. package/dist/{cubing → lib/cubing}/stream/index.d.ts +2 -2
  96. package/dist/{cubing → lib/cubing}/stream/index.js +4 -1
  97. package/dist/{cubing → lib/cubing}/stream/index.js.map +2 -2
  98. package/dist/{cubing → lib/cubing}/twisty/index.d.ts +3 -3
  99. package/dist/{cubing → lib/cubing}/twisty/index.js +310 -313
  100. package/dist/{cubing → lib/cubing}/twisty/index.js.map +3 -3
  101. package/package.json +40 -41
  102. package/dist/cubing/chunk-E4S4UDA6.js +0 -615
  103. package/dist/cubing/chunk-E4S4UDA6.js.map +0 -7
  104. package/dist/cubing/chunk-OLH526Y4.js.map +0 -7
  105. package/dist/cubing/chunk-VSFPWTDH.js.map +0 -7
  106. package/dist/cubing/inside-AZHBOSXQ.js +0 -17
  107. package/dist/cubing/puzzle-geometry/index.d.ts +0 -7
  108. package/dist/cubing/puzzle-geometry/index.js.map +0 -7
  109. package/dist/cubing/puzzles-dynamic-side-events-42Q52YAB.js.map +0 -7
  110. package/dist/cubing/scramble/index.d.ts +0 -3
  111. package/dist/cubing/scramble/index.js +0 -16
  112. package/dist/cubing/search-dynamic-solve-4x4x4-Z26CIIGT.js.map +0 -7
  113. package/src/README.md +0 -10
  114. /package/dist/{cubing → lib/cubing}/Alg-c6770822.d.ts +0 -0
  115. /package/dist/{cubing → lib/cubing}/alg/index.d.ts +0 -0
  116. /package/dist/{cubing → lib/cubing}/alg/index.js.map +0 -0
  117. /package/dist/{cubing/kpuzzle/index.js.map → lib/cubing/chunks/chunk-NAPITA3L.js.map} +0 -0
  118. /package/dist/{cubing/notation → lib/cubing/kpuzzle}/index.js.map +0 -0
  119. /package/dist/{cubing/protocol → lib/cubing/notation}/index.js.map +0 -0
  120. /package/dist/{cubing → lib/cubing}/parseAlg-d2c83795.d.ts +0 -0
  121. /package/dist/{cubing/puzzles → lib/cubing/protocol}/index.js.map +0 -0
  122. /package/dist/{cubing/scramble → lib/cubing/puzzles}/index.js.map +0 -0
  123. /package/dist/{cubing/search → lib/cubing/scramble}/index.js.map +0 -0
@@ -18,22 +18,22 @@ import {
18
18
  rawRenderPooled,
19
19
  setCameraFromOrbitCoordinates,
20
20
  setTwistyDebug
21
- } from "../chunk-FCRM3RQU.js";
21
+ } from "../chunks/chunk-Z2CCB3XX.js";
22
22
  import {
23
23
  countAnimatedLeaves,
24
24
  countMetricMoves,
25
25
  countMoves
26
- } from "../chunk-YEOYXOGB.js";
26
+ } from "../chunks/chunk-ZUPLJQAD.js";
27
27
  import {
28
28
  cube3x3x3,
29
29
  puzzles
30
- } from "../chunk-AU3TSTCA.js";
30
+ } from "../chunks/chunk-32CXD7UA.js";
31
31
  import {
32
32
  customPGPuzzleLoader,
33
33
  getPartialAppendOptionsForPuzzleSpecificSimplifyOptions,
34
34
  getPieceStickeringMask
35
- } from "../chunk-KF2JGMZA.js";
36
- import "../chunk-OLH526Y4.js";
35
+ } from "../chunks/chunk-RS62HLA5.js";
36
+ import "../chunks/chunk-QF4HTZYW.js";
37
37
  import {
38
38
  Alg,
39
39
  AlgBuilder,
@@ -48,7 +48,7 @@ import {
48
48
  experimentalAppendMove,
49
49
  functionFromTraversal,
50
50
  offsetMod
51
- } from "../chunk-ULQMFOA2.js";
51
+ } from "../chunks/chunk-7X47IY3P.js";
52
52
 
53
53
  // src/cubing/twisty/controllers/AnimationTypes.ts
54
54
  function directionScalar(direction) {
@@ -92,17 +92,16 @@ function modIntoRange(v, rangeMin, rangeMax) {
92
92
  var CatchUpHelper = class {
93
93
  constructor(model) {
94
94
  this.model = model;
95
- this.catchingUp = false;
96
- this.pendingFrame = false;
97
- this.scheduler = new RenderScheduler(
98
- this.animFrame.bind(this)
99
- );
100
- this.catchUpMs = 500;
101
- this.lastTimestamp = 0;
102
95
  model.tempoScale.addFreshListener((tempoScale) => {
103
96
  this.tempoScale = tempoScale;
104
97
  });
105
98
  }
99
+ catchingUp = false;
100
+ pendingFrame = false;
101
+ tempoScale;
102
+ scheduler = new RenderScheduler(
103
+ this.animFrame.bind(this)
104
+ );
106
105
  start() {
107
106
  if (!this.catchingUp) {
108
107
  this.lastTimestamp = performance.now();
@@ -115,6 +114,8 @@ var CatchUpHelper = class {
115
114
  this.catchingUp = false;
116
115
  this.scheduler.cancelAnimFrame();
117
116
  }
117
+ catchUpMs = 500;
118
+ lastTimestamp = 0;
118
119
  animFrame(timestamp) {
119
120
  this.scheduler.requestAnimFrame();
120
121
  const delta = this.tempoScale * (timestamp - this.lastTimestamp) / this.catchUpMs;
@@ -147,20 +148,22 @@ var CatchUpHelper = class {
147
148
  var TwistyAnimationController = class {
148
149
  constructor(model, delegate) {
149
150
  this.delegate = delegate;
150
- // TODO: #private?
151
- this.playing = false;
152
- this.direction = 1 /* Forwards */;
153
- this.lastDatestamp = 0;
154
- this.scheduler = new RenderScheduler(
155
- this.animFrame.bind(this)
156
- );
157
- this.#animFrameEffectiveTimestampStaleDropper = new StaleDropper();
158
151
  this.model = model;
159
152
  this.lastTimestampPromise = this.#effectiveTimestampMilliseconds();
160
153
  this.model.playingInfo.addFreshListener(this.onPlayingProp.bind(this));
161
154
  this.catchUpHelper = new CatchUpHelper(this.model);
162
155
  this.model.catchUpMove.addFreshListener(this.onCatchUpMoveProp.bind(this));
163
156
  }
157
+ // TODO: #private?
158
+ playing = false;
159
+ direction = 1 /* Forwards */;
160
+ catchUpHelper;
161
+ model;
162
+ lastDatestamp = 0;
163
+ lastTimestampPromise;
164
+ scheduler = new RenderScheduler(
165
+ this.animFrame.bind(this)
166
+ );
164
167
  // TODO: Do we need this?
165
168
  async onPlayingProp(playingInfo) {
166
169
  if (playingInfo.playing !== this.playing) {
@@ -235,7 +238,7 @@ var TwistyAnimationController = class {
235
238
  untilBoundary: "entire-timeline" /* EntireTimeline */
236
239
  });
237
240
  }
238
- #animFrameEffectiveTimestampStaleDropper;
241
+ #animFrameEffectiveTimestampStaleDropper = new StaleDropper();
239
242
  async animFrame(frameDatestamp) {
240
243
  if (this.playing) {
241
244
  this.scheduler.requestAnimFrame();
@@ -317,6 +320,7 @@ var TwistyPlayerController = class {
317
320
  this.model = model;
318
321
  this.animationController = new TwistyAnimationController(model, delegate);
319
322
  }
323
+ animationController;
320
324
  jumpToStart(options) {
321
325
  this.animationController.jumpToStart(options);
322
326
  }
@@ -420,8 +424,6 @@ var TwistyAnimatedSVG = class {
420
424
  constructor(kpuzzle, svgSource, experimentalStickeringMask, showUnknownOrientations = false) {
421
425
  this.kpuzzle = kpuzzle;
422
426
  this.showUnknownOrientations = showUnknownOrientations;
423
- this.originalColors = {};
424
- this.gradients = {};
425
427
  if (!svgSource) {
426
428
  throw new Error(`No SVG definition for puzzle type: ${kpuzzle.name()}`);
427
429
  }
@@ -497,6 +499,12 @@ var TwistyAnimatedSVG = class {
497
499
  this.drawPattern(this.kpuzzle.defaultPattern());
498
500
  }
499
501
  }
502
+ wrapperElement;
503
+ svgElement;
504
+ gradientDefs;
505
+ originalColors = {};
506
+ gradients = {};
507
+ svgID;
500
508
  drawPattern(pattern, nextPattern, fraction) {
501
509
  this.draw(pattern, nextPattern, fraction);
502
510
  }
@@ -662,9 +670,6 @@ var Twisty2DPuzzle = class extends ManagedCustomElement {
662
670
  this.svgSource = svgSource;
663
671
  this.options = options;
664
672
  this.puzzleLoader = puzzleLoader;
665
- this.scheduler = new RenderScheduler(this.render.bind(this));
666
- this.#cachedPosition = null;
667
- this.#freshListenerManager = new FreshListenerManager();
668
673
  this.addCSS(twisty2DSVGCSS);
669
674
  this.resetSVG();
670
675
  this.#freshListenerManager.addListener(
@@ -685,8 +690,10 @@ var Twisty2DPuzzle = class extends ManagedCustomElement {
685
690
  );
686
691
  }
687
692
  }
688
- #cachedPosition;
689
- #freshListenerManager;
693
+ svgWrapper;
694
+ scheduler = new RenderScheduler(this.render.bind(this));
695
+ #cachedPosition = null;
696
+ #freshListenerManager = new FreshListenerManager();
690
697
  disconnect() {
691
698
  this.#freshListenerManager.disconnect();
692
699
  }
@@ -773,7 +780,7 @@ var Twisty2DPuzzleWrapper = class {
773
780
  #cachedTwisty2DPuzzle = null;
774
781
  // TODO: Stale dropper?
775
782
  async twisty2DPuzzle() {
776
- return this.#cachedTwisty2DPuzzle ?? (this.#cachedTwisty2DPuzzle = (async () => {
783
+ return this.#cachedTwisty2DPuzzle ??= (async () => {
777
784
  const svgPromise = this.effectiveVisualization === "experimental-2D-LL" ? this.puzzleLoader.llSVG() : this.puzzleLoader.svg();
778
785
  return new Twisty2DPuzzle(
779
786
  this.model,
@@ -782,7 +789,7 @@ var Twisty2DPuzzleWrapper = class {
782
789
  {},
783
790
  this.puzzleLoader
784
791
  );
785
- })());
792
+ })();
786
793
  }
787
794
  };
788
795
 
@@ -808,7 +815,7 @@ var Twisty2DSceneWrapper = class extends ManagedCustomElement {
808
815
  }
809
816
  #cachedScene;
810
817
  async scene() {
811
- return this.#cachedScene ?? (this.#cachedScene = (async () => new (await THREEJS).Scene())());
818
+ return this.#cachedScene ??= (async () => new (await THREEJS).Scene())();
812
819
  }
813
820
  scheduleRender() {
814
821
  this.#currentTwisty2DPuzzleWrapper?.scheduleRender();
@@ -873,14 +880,13 @@ var ClassListManager = class {
873
880
 
874
881
  // src/cubing/twisty/views/InitialValueTracker.ts
875
882
  var InitialValueTracker = class {
876
- constructor() {
877
- // TODO: AbortController?
878
- this.promise = new Promise((resolve, reject) => {
879
- this.#resolve = resolve;
880
- this.reject = reject;
881
- });
882
- }
883
883
  #resolve;
884
+ reject;
885
+ // TODO: AbortController?
886
+ promise = new Promise((resolve, reject) => {
887
+ this.#resolve = resolve;
888
+ this.reject = reject;
889
+ });
884
890
  handleNewValue(t) {
885
891
  this.#resolve(t);
886
892
  }
@@ -977,7 +983,7 @@ var Twisty3DPuzzleWrapper = class extends EventTarget {
977
983
  }
978
984
  #cachedTwisty3DPuzzle = null;
979
985
  async twisty3DPuzzle() {
980
- return this.#cachedTwisty3DPuzzle ?? (this.#cachedTwisty3DPuzzle = (async () => {
986
+ return this.#cachedTwisty3DPuzzle ??= (async () => {
981
987
  const proxyPromise = proxy3D();
982
988
  if (this.puzzleLoader.id === "3x3x3" && this.visualizationStrategy === "Cube3D") {
983
989
  const [
@@ -1024,7 +1030,7 @@ var Twisty3DPuzzleWrapper = class extends EventTarget {
1024
1030
  );
1025
1031
  return pg3d;
1026
1032
  }
1027
- })());
1033
+ })();
1028
1034
  }
1029
1035
  async raycastMove(raycasterPromise, transformations) {
1030
1036
  const puzzle = await this.twisty3DPuzzle();
@@ -1135,7 +1141,7 @@ var Twisty3DSceneWrapper = class extends ManagedCustomElement {
1135
1141
  }
1136
1142
  #cachedScene;
1137
1143
  async scene() {
1138
- return this.#cachedScene ?? (this.#cachedScene = (async () => new (await THREEJS).Scene())());
1144
+ return this.#cachedScene ??= (async () => new (await THREEJS).Scene())();
1139
1145
  }
1140
1146
  #vantages = /* @__PURE__ */ new Set();
1141
1147
  addVantage(vantage) {
@@ -1434,8 +1440,8 @@ var TwistyButtons = class extends ManagedCustomElement {
1434
1440
  this.model = model;
1435
1441
  this.controller = controller;
1436
1442
  this.defaultFullscreenElement = defaultFullscreenElement;
1437
- this.buttons = null;
1438
1443
  }
1444
+ buttons = null;
1439
1445
  connectedCallback() {
1440
1446
  this.addCSS(buttonGridCSS);
1441
1447
  const buttons = {};
@@ -1534,15 +1540,7 @@ var TwistyButtons = class extends ManagedCustomElement {
1534
1540
  };
1535
1541
  customElementsShim.define("twisty-buttons", TwistyButtons);
1536
1542
  var TwistyButton = class extends ManagedCustomElement {
1537
- constructor() {
1538
- super(...arguments);
1539
- this.htmlButton = document.createElement("button");
1540
- this.#iconManager = new ClassListManager(
1541
- this,
1542
- "svg-",
1543
- buttonIcons
1544
- );
1545
- }
1543
+ htmlButton = document.createElement("button");
1546
1544
  // TODO: async?
1547
1545
  updateColorScheme(colorScheme) {
1548
1546
  this.contentWrapper.classList.toggle("dark-mode", colorScheme === "dark");
@@ -1551,7 +1549,11 @@ var TwistyButton = class extends ManagedCustomElement {
1551
1549
  this.addCSS(buttonCSS);
1552
1550
  this.addElement(this.htmlButton);
1553
1551
  }
1554
- #iconManager;
1552
+ #iconManager = new ClassListManager(
1553
+ this,
1554
+ "svg-",
1555
+ buttonIcons
1556
+ );
1555
1557
  setIcon(iconName) {
1556
1558
  this.#iconManager.setValue(iconName);
1557
1559
  }
@@ -1651,7 +1653,7 @@ var TwistyScrubber = class extends ManagedCustomElement {
1651
1653
  }
1652
1654
  #inputElem = null;
1653
1655
  async inputElem() {
1654
- return this.#inputElem ?? (this.#inputElem = (async () => {
1656
+ return this.#inputElem ??= (async () => {
1655
1657
  const elem = document.createElement("input");
1656
1658
  elem.type = "range";
1657
1659
  elem.disabled = true;
@@ -1661,7 +1663,7 @@ var TwistyScrubber = class extends ManagedCustomElement {
1661
1663
  elem.addEventListener("input", this.onInput.bind(this));
1662
1664
  elem.addEventListener("keydown", this.onKeypress.bind(this));
1663
1665
  return elem;
1664
- })());
1666
+ })();
1665
1667
  }
1666
1668
  async onInput(e) {
1667
1669
  if (scaling) {
@@ -1750,9 +1752,9 @@ async function screenshot(model, options) {
1750
1752
  const width = options?.width ?? 2048;
1751
1753
  const height = options?.height ?? 2048;
1752
1754
  const aspectRatio = width / height;
1753
- const camera = cachedCamera ?? (cachedCamera = await (async () => {
1755
+ const camera = cachedCamera ??= await (async () => {
1754
1756
  return new PerspectiveCamera(20, aspectRatio, 0.1, 20);
1755
- })());
1757
+ })();
1756
1758
  const scene = new Scene();
1757
1759
  const twisty3DWrapper = new Twisty3DPuzzleWrapper(
1758
1760
  model,
@@ -1897,6 +1899,9 @@ var URLProp = class extends TwistyPropSource {
1897
1899
 
1898
1900
  // src/cubing/twisty/model/props/puzzle/state/AlgProp.ts
1899
1901
  var AlgIssues = class _AlgIssues {
1902
+ // TODO: (string | Error)[]
1903
+ warnings;
1904
+ errors;
1900
1905
  constructor(issues) {
1901
1906
  this.warnings = Object.freeze(issues?.warnings ?? []);
1902
1907
  this.errors = Object.freeze(issues?.errors ?? []);
@@ -2169,12 +2174,13 @@ var AlgDuration = class extends TraversalUp {
2169
2174
  var SimpleAlgIndexer = class {
2170
2175
  constructor(kpuzzle, alg) {
2171
2176
  this.kpuzzle = kpuzzle;
2172
- // TODO: Allow custom `durationFn`.
2173
- this.durationFn = new AlgDuration(
2174
- defaultDurationForAmount
2175
- );
2176
2177
  this.moves = new Alg(alg.experimentalExpand());
2177
2178
  }
2179
+ moves;
2180
+ // TODO: Allow custom `durationFn`.
2181
+ durationFn = new AlgDuration(
2182
+ defaultDurationForAmount
2183
+ );
2178
2184
  getAnimLeaf(index) {
2179
2185
  return Array.from(this.moves.childAlgNodes())[index];
2180
2186
  }
@@ -2408,6 +2414,7 @@ var SimultaneousMoveIndexer = class {
2408
2414
  this.kpuzzle = kpuzzle;
2409
2415
  this.animLeaves = demos[alg.toString()] ?? simulMoves(alg);
2410
2416
  }
2417
+ animLeaves;
2411
2418
  getAnimLeaf(index) {
2412
2419
  return this.animLeaves[Math.min(index, this.animLeaves.length - 1)]?.animLeaf ?? null;
2413
2420
  }
@@ -2570,10 +2577,6 @@ var DecoratorConstructor = class extends TraversalUp {
2570
2577
  constructor(kpuzzle) {
2571
2578
  super();
2572
2579
  this.kpuzzle = kpuzzle;
2573
- this.durationFn = new AlgDuration(
2574
- defaultDurationForAmount
2575
- );
2576
- this.cache = {};
2577
2580
  this.identity = kpuzzle.identityTransformation();
2578
2581
  this.dummyLeaf = new AlgWalkerDecoration(
2579
2582
  0,
@@ -2583,6 +2586,12 @@ var DecoratorConstructor = class extends TraversalUp {
2583
2586
  []
2584
2587
  );
2585
2588
  }
2589
+ identity;
2590
+ dummyLeaf;
2591
+ durationFn = new AlgDuration(
2592
+ defaultDurationForAmount
2593
+ );
2594
+ cache = {};
2586
2595
  traverseAlg(alg) {
2587
2596
  let moveCount = 0;
2588
2597
  let duration = 0;
@@ -2707,6 +2716,15 @@ var AlgWalker = class extends TraversalDownUp {
2707
2716
  this.st = this.kpuzzle.identityTransformation();
2708
2717
  this.root = new WalkerDown(this.apd, false);
2709
2718
  }
2719
+ move;
2720
+ moveDuration;
2721
+ back;
2722
+ st;
2723
+ root;
2724
+ i;
2725
+ dur;
2726
+ goali;
2727
+ goaldur;
2710
2728
  moveByIndex(loc) {
2711
2729
  if (this.i >= 0 && this.i === loc) {
2712
2730
  return this.move !== void 0;
@@ -2952,6 +2970,8 @@ var TreeAlgIndexer = class {
2952
2970
  this.decoration = deccon.traverseAlg(chunkedAlg);
2953
2971
  this.walker = new AlgWalker(this.kpuzzle, chunkedAlg, this.decoration);
2954
2972
  }
2973
+ decoration;
2974
+ walker;
2955
2975
  getAnimLeaf(index) {
2956
2976
  if (this.walker.moveByIndex(index)) {
2957
2977
  if (!this.walker.move) {
@@ -3350,7 +3370,7 @@ var InitialHintFaceletsAnimationProp = class extends SimpleTwistyPropSource {
3350
3370
  // src/cubing/twisty/model/props/puzzle/display/SpriteProp.ts
3351
3371
  var cachedLoader = null;
3352
3372
  async function loader() {
3353
- return cachedLoader ?? (cachedLoader = new (await THREEJS).TextureLoader());
3373
+ return cachedLoader ??= new (await THREEJS).TextureLoader();
3354
3374
  }
3355
3375
  var SpriteProp = class extends TwistyPropDerived {
3356
3376
  async derive(inputs) {
@@ -3643,34 +3663,6 @@ function defaultCameraOrbitCoordinates(puzzleID, strategy) {
3643
3663
  var TwistySceneModel = class {
3644
3664
  constructor(twistyPlayerModel) {
3645
3665
  this.twistyPlayerModel = twistyPlayerModel;
3646
- // Depth 0
3647
- this.background = new BackgroundProp();
3648
- this.colorSchemeRequest = new ColorSchemeRequestProp();
3649
- this.dragInput = new DragInputProp();
3650
- this.foundationDisplay = new FoundationDisplayProp();
3651
- this.foundationStickerSpriteURL = new URLProp();
3652
- this.fullscreenElement = new DOMElementReferenceProp();
3653
- this.hintFacelet = new HintFaceletProp();
3654
- this.hintStickerSpriteURL = new URLProp();
3655
- this.initialHintFaceletsAnimation = new InitialHintFaceletsAnimationProp();
3656
- this.latitudeLimit = new LatitudeLimitProp();
3657
- this.movePressInput = new MovePressInputProp();
3658
- this.movePressCancelOptions = new MovePressCancelOptions();
3659
- this.orbitCoordinatesRequest = new OrbitCoordinatesRequestProp();
3660
- // `stickeringMaskRequest` takes priority over `stickeringRequest`
3661
- this.stickeringMaskRequest = new StickeringMaskRequestProp();
3662
- this.stickeringRequest = new StickeringRequestProp();
3663
- this.faceletScale = new FaceletScaleProp();
3664
- // Depth 1
3665
- this.colorScheme = new ColorSchemeProp({
3666
- colorSchemeRequest: this.colorSchemeRequest
3667
- });
3668
- this.foundationStickerSprite = new SpriteProp({
3669
- spriteURL: this.foundationStickerSpriteURL
3670
- });
3671
- this.hintStickerSprite = new SpriteProp({
3672
- spriteURL: this.hintStickerSpriteURL
3673
- });
3674
3666
  this.orbitCoordinates = new OrbitCoordinatesProp({
3675
3667
  orbitCoordinatesRequest: this.orbitCoordinatesRequest,
3676
3668
  latitudeLimit: this.latitudeLimit,
@@ -3683,6 +3675,37 @@ var TwistySceneModel = class {
3683
3675
  puzzleLoader: twistyPlayerModel.puzzleLoader
3684
3676
  });
3685
3677
  }
3678
+ // Depth 0
3679
+ background = new BackgroundProp();
3680
+ colorSchemeRequest = new ColorSchemeRequestProp();
3681
+ dragInput = new DragInputProp();
3682
+ foundationDisplay = new FoundationDisplayProp();
3683
+ foundationStickerSpriteURL = new URLProp();
3684
+ fullscreenElement = new DOMElementReferenceProp();
3685
+ hintFacelet = new HintFaceletProp();
3686
+ hintStickerSpriteURL = new URLProp();
3687
+ initialHintFaceletsAnimation = new InitialHintFaceletsAnimationProp();
3688
+ latitudeLimit = new LatitudeLimitProp();
3689
+ movePressInput = new MovePressInputProp();
3690
+ movePressCancelOptions = new MovePressCancelOptions();
3691
+ orbitCoordinatesRequest = new OrbitCoordinatesRequestProp();
3692
+ // `stickeringMaskRequest` takes priority over `stickeringRequest`
3693
+ stickeringMaskRequest = new StickeringMaskRequestProp();
3694
+ stickeringRequest = new StickeringRequestProp();
3695
+ faceletScale = new FaceletScaleProp();
3696
+ // Depth 1
3697
+ colorScheme = new ColorSchemeProp({
3698
+ colorSchemeRequest: this.colorSchemeRequest
3699
+ });
3700
+ foundationStickerSprite = new SpriteProp({
3701
+ spriteURL: this.foundationStickerSpriteURL
3702
+ });
3703
+ hintStickerSprite = new SpriteProp({
3704
+ spriteURL: this.hintStickerSpriteURL
3705
+ });
3706
+ // Dependence on TwistyPlayerModel
3707
+ orbitCoordinates;
3708
+ stickeringMask;
3686
3709
  };
3687
3710
 
3688
3711
  // src/cubing/twisty/model/UserVisibleErrorTracker.ts
@@ -3701,123 +3724,121 @@ var UserVisibleErrorTracker = class extends SimpleTwistyPropSource {
3701
3724
 
3702
3725
  // src/cubing/twisty/model/TwistyPlayerModel.ts
3703
3726
  var TwistyPlayerModel = class {
3704
- constructor() {
3705
- // TODO: incorporate error handling into the entire prop graph.
3706
- // TODO: Make this something that can't get confused with normal props?
3707
- this.userVisibleErrorTracker = new UserVisibleErrorTracker();
3708
- // TODO: Redistribute and group props with controllers.
3709
- // Depth 0
3710
- this.alg = new AlgProp();
3711
- this.backView = new BackViewProp();
3712
- this.controlPanel = new ControlPanelProp();
3713
- this.catchUpMove = new CatchUpMoveProp();
3714
- this.indexerConstructorRequest = new IndexerConstructorRequestProp();
3715
- this.playingInfo = new PlayingInfoProp();
3716
- this.puzzleDescriptionRequest = new PGPuzzleDescriptionStringProp();
3717
- this.puzzleIDRequest = new PuzzleIDRequestProp();
3718
- this.setupAnchor = new SetupAnchorProp();
3719
- this.setupAlg = new AlgProp();
3720
- this.setupTransformation = new SetupTransformationProp();
3721
- this.tempoScale = new TempoScaleProp();
3722
- this.timestampRequest = new TimestampRequestProp();
3723
- this.viewerLink = new ViewerLinkProp();
3724
- this.visualizationFormat = new VisualizationFormatProp();
3725
- // Metadata
3726
- this.title = new ArbitraryStringProp();
3727
- this.videoURL = new URLProp();
3728
- this.competitionID = new ArbitraryStringProp();
3729
- // Depth 1
3730
- this.puzzleLoader = new PuzzleLoaderProp(
3731
- {
3732
- puzzleIDRequest: this.puzzleIDRequest,
3733
- puzzleDescriptionRequest: this.puzzleDescriptionRequest
3734
- },
3735
- this.userVisibleErrorTracker
3736
- );
3737
- // Depth 2
3738
- this.kpuzzle = new KPuzzleProp({ puzzleLoader: this.puzzleLoader });
3739
- this.puzzleID = new PuzzleIDProp({ puzzleLoader: this.puzzleLoader });
3740
- // Depth 3
3741
- this.puzzleAlg = new PuzzleAlgProp({
3742
- algWithIssues: this.alg,
3743
- kpuzzle: this.kpuzzle
3744
- });
3745
- this.puzzleSetupAlg = new PuzzleAlgProp({
3746
- algWithIssues: this.setupAlg,
3747
- kpuzzle: this.kpuzzle
3748
- });
3749
- this.visualizationStrategy = new VisualizationStrategyProp({
3750
- visualizationRequest: this.visualizationFormat,
3751
- puzzleID: this.puzzleID
3752
- });
3753
- // Depth 4
3754
- this.indexerConstructor = new IndexerConstructorProp({
3755
- alg: this.alg,
3756
- puzzle: this.puzzleID,
3757
- visualizationStrategy: this.visualizationStrategy,
3758
- indexerConstructorRequest: this.indexerConstructorRequest
3759
- });
3760
- this.setupAlgTransformation = new AlgTransformationProp({
3761
- setupAlg: this.puzzleSetupAlg,
3762
- kpuzzle: this.kpuzzle
3763
- });
3764
- // Depth 5
3765
- this.indexer = new IndexerProp({
3766
- indexerConstructor: this.indexerConstructor,
3767
- algWithIssues: this.puzzleAlg,
3768
- kpuzzle: this.kpuzzle
3769
- });
3770
- // Depth 6
3771
- this.anchorTransformation = new AnchorTransformationProp({
3772
- setupTransformation: this.setupTransformation,
3727
+ // TODO: incorporate error handling into the entire prop graph.
3728
+ // TODO: Make this something that can't get confused with normal props?
3729
+ userVisibleErrorTracker = new UserVisibleErrorTracker();
3730
+ // TODO: Redistribute and group props with controllers.
3731
+ // Depth 0
3732
+ alg = new AlgProp();
3733
+ backView = new BackViewProp();
3734
+ controlPanel = new ControlPanelProp();
3735
+ catchUpMove = new CatchUpMoveProp();
3736
+ indexerConstructorRequest = new IndexerConstructorRequestProp();
3737
+ playingInfo = new PlayingInfoProp();
3738
+ puzzleDescriptionRequest = new PGPuzzleDescriptionStringProp();
3739
+ puzzleIDRequest = new PuzzleIDRequestProp();
3740
+ setupAnchor = new SetupAnchorProp();
3741
+ setupAlg = new AlgProp();
3742
+ setupTransformation = new SetupTransformationProp();
3743
+ tempoScale = new TempoScaleProp();
3744
+ timestampRequest = new TimestampRequestProp();
3745
+ viewerLink = new ViewerLinkProp();
3746
+ visualizationFormat = new VisualizationFormatProp();
3747
+ // Metadata
3748
+ title = new ArbitraryStringProp();
3749
+ videoURL = new URLProp();
3750
+ competitionID = new ArbitraryStringProp();
3751
+ // Depth 1
3752
+ puzzleLoader = new PuzzleLoaderProp(
3753
+ {
3754
+ puzzleIDRequest: this.puzzleIDRequest,
3755
+ puzzleDescriptionRequest: this.puzzleDescriptionRequest
3756
+ },
3757
+ this.userVisibleErrorTracker
3758
+ );
3759
+ // Depth 2
3760
+ kpuzzle = new KPuzzleProp({ puzzleLoader: this.puzzleLoader });
3761
+ puzzleID = new PuzzleIDProp({ puzzleLoader: this.puzzleLoader });
3762
+ // Depth 3
3763
+ puzzleAlg = new PuzzleAlgProp({
3764
+ algWithIssues: this.alg,
3765
+ kpuzzle: this.kpuzzle
3766
+ });
3767
+ puzzleSetupAlg = new PuzzleAlgProp({
3768
+ algWithIssues: this.setupAlg,
3769
+ kpuzzle: this.kpuzzle
3770
+ });
3771
+ visualizationStrategy = new VisualizationStrategyProp({
3772
+ visualizationRequest: this.visualizationFormat,
3773
+ puzzleID: this.puzzleID
3774
+ });
3775
+ // Depth 4
3776
+ indexerConstructor = new IndexerConstructorProp({
3777
+ alg: this.alg,
3778
+ puzzle: this.puzzleID,
3779
+ visualizationStrategy: this.visualizationStrategy,
3780
+ indexerConstructorRequest: this.indexerConstructorRequest
3781
+ });
3782
+ setupAlgTransformation = new AlgTransformationProp({
3783
+ setupAlg: this.puzzleSetupAlg,
3784
+ kpuzzle: this.kpuzzle
3785
+ });
3786
+ // Depth 5
3787
+ indexer = new IndexerProp({
3788
+ indexerConstructor: this.indexerConstructor,
3789
+ algWithIssues: this.puzzleAlg,
3790
+ kpuzzle: this.kpuzzle
3791
+ });
3792
+ // Depth 6
3793
+ anchorTransformation = new AnchorTransformationProp({
3794
+ setupTransformation: this.setupTransformation,
3795
+ setupAnchor: this.setupAnchor,
3796
+ setupAlgTransformation: this.setupAlgTransformation,
3797
+ indexer: this.indexer
3798
+ });
3799
+ timeRange = new TimeRangeProp({
3800
+ indexer: this.indexer
3801
+ });
3802
+ // Depth 7
3803
+ detailedTimelineInfo = new DetailedTimelineInfoProp(
3804
+ {
3805
+ timestampRequest: this.timestampRequest,
3806
+ timeRange: this.timeRange,
3773
3807
  setupAnchor: this.setupAnchor,
3774
- setupAlgTransformation: this.setupAlgTransformation,
3775
- indexer: this.indexer
3776
- });
3777
- this.timeRange = new TimeRangeProp({
3778
- indexer: this.indexer
3779
- });
3780
- // Depth 7
3781
- this.detailedTimelineInfo = new DetailedTimelineInfoProp(
3782
- {
3783
- timestampRequest: this.timestampRequest,
3784
- timeRange: this.timeRange,
3785
- setupAnchor: this.setupAnchor,
3786
- setupAlg: this.setupAlg
3787
- }
3788
- );
3789
- // Depth 8
3790
- this.coarseTimelineInfo = new CoarseTimelineInfoProp({
3791
- detailedTimelineInfo: this.detailedTimelineInfo,
3792
- playingInfo: this.playingInfo
3793
- });
3794
- this.currentMoveInfo = new CurrentMoveInfoProp({
3795
- indexer: this.indexer,
3796
- detailedTimelineInfo: this.detailedTimelineInfo,
3797
- catchUpMove: this.catchUpMove
3798
- });
3799
- // Depth 9
3800
- // TODO: Inline Twisty3D management.
3801
- this.buttonAppearance = new ButtonAppearanceProp({
3802
- coarseTimelineInfo: this.coarseTimelineInfo,
3803
- viewerLink: this.viewerLink
3804
- });
3805
- this.currentLeavesSimplified = new CurrentLeavesSimplifiedProp({
3806
- currentMoveInfo: this.currentMoveInfo
3807
- });
3808
- // Depth 10
3809
- this.currentPattern = new CurrentPatternProp({
3810
- anchoredStart: this.anchorTransformation,
3811
- currentLeavesSimplified: this.currentLeavesSimplified,
3812
- indexer: this.indexer
3813
- });
3814
- // Depth 11
3815
- this.legacyPosition = new LegacyPositionProp({
3816
- currentMoveInfo: this.currentMoveInfo,
3817
- currentPattern: this.currentPattern
3818
- });
3819
- this.twistySceneModel = new TwistySceneModel(this);
3820
- }
3808
+ setupAlg: this.setupAlg
3809
+ }
3810
+ );
3811
+ // Depth 8
3812
+ coarseTimelineInfo = new CoarseTimelineInfoProp({
3813
+ detailedTimelineInfo: this.detailedTimelineInfo,
3814
+ playingInfo: this.playingInfo
3815
+ });
3816
+ currentMoveInfo = new CurrentMoveInfoProp({
3817
+ indexer: this.indexer,
3818
+ detailedTimelineInfo: this.detailedTimelineInfo,
3819
+ catchUpMove: this.catchUpMove
3820
+ });
3821
+ // Depth 9
3822
+ // TODO: Inline Twisty3D management.
3823
+ buttonAppearance = new ButtonAppearanceProp({
3824
+ coarseTimelineInfo: this.coarseTimelineInfo,
3825
+ viewerLink: this.viewerLink
3826
+ });
3827
+ currentLeavesSimplified = new CurrentLeavesSimplifiedProp({
3828
+ currentMoveInfo: this.currentMoveInfo
3829
+ });
3830
+ // Depth 10
3831
+ currentPattern = new CurrentPatternProp({
3832
+ anchoredStart: this.anchorTransformation,
3833
+ currentLeavesSimplified: this.currentLeavesSimplified,
3834
+ indexer: this.indexer
3835
+ });
3836
+ // Depth 11
3837
+ legacyPosition = new LegacyPositionProp({
3838
+ currentMoveInfo: this.currentMoveInfo,
3839
+ currentPattern: this.currentPattern
3840
+ });
3841
+ twistySceneModel = new TwistySceneModel(this);
3821
3842
  async twizzleLink() {
3822
3843
  const [
3823
3844
  viewerLink,
@@ -3937,11 +3958,7 @@ function err(propName) {
3937
3958
  );
3938
3959
  }
3939
3960
  var TwistyPlayerSettable = class extends ManagedCustomElement {
3940
- constructor() {
3941
- super(...arguments);
3942
- this.experimentalModel = new TwistyPlayerModel();
3943
- this.experimentalGet = new ExperimentalGetters(this.experimentalModel);
3944
- }
3961
+ experimentalModel = new TwistyPlayerModel();
3945
3962
  set alg(newAlg) {
3946
3963
  this.experimentalModel.alg.set(newAlg);
3947
3964
  }
@@ -4146,6 +4163,7 @@ var TwistyPlayerSettable = class extends ManagedCustomElement {
4146
4163
  get experimentalDragInput() {
4147
4164
  throw err("experimentalDragInput");
4148
4165
  }
4166
+ experimentalGet = new ExperimentalGetters(this.experimentalModel);
4149
4167
  };
4150
4168
  var ExperimentalGetters = class {
4151
4169
  constructor(model) {
@@ -4213,32 +4231,17 @@ var propOnly = {
4213
4231
  experimentalMovePressCancelOptions: true
4214
4232
  };
4215
4233
  var TwistyPlayer = class extends TwistyPlayerSettable {
4234
+ controller = new TwistyPlayerController(
4235
+ this.experimentalModel,
4236
+ this
4237
+ );
4238
+ buttons;
4239
+ experimentalCanvasClickCallback = () => {
4240
+ };
4216
4241
  // #onCanvasClick() {
4217
4242
  // }
4218
4243
  constructor(config = {}) {
4219
4244
  super();
4220
- this.controller = new TwistyPlayerController(
4221
- this.experimentalModel,
4222
- this
4223
- );
4224
- this.experimentalCanvasClickCallback = () => {
4225
- };
4226
- this.#controlsManager = new ClassListManager(
4227
- this,
4228
- "controls-",
4229
- ["auto"].concat(
4230
- Object.keys(controlsLocations)
4231
- )
4232
- );
4233
- this.#visualizationWrapperElem = document.createElement("div");
4234
- // TODO: Better pattern.
4235
- this.#errorElem = document.createElement("div");
4236
- // TODO: Better pattern.
4237
- this.#alreadyConnected = false;
4238
- this.#flashLevel = "auto";
4239
- this.#visualizationWrapper = null;
4240
- this.#initial3DVisualizationWrapper = new InitialValueTracker();
4241
- this.#visualizationStrategy = null;
4242
4245
  for (const [propName, value] of Object.entries(config)) {
4243
4246
  if (!(configKeys[propName] || propOnly[propName])) {
4244
4247
  console.warn(`Invalid config passed to TwistyPlayer: ${propName}`);
@@ -4247,10 +4250,18 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
4247
4250
  this[propName] = value;
4248
4251
  }
4249
4252
  }
4250
- #controlsManager;
4251
- #visualizationWrapperElem;
4252
- #errorElem;
4253
- #alreadyConnected;
4253
+ #controlsManager = new ClassListManager(
4254
+ this,
4255
+ "controls-",
4256
+ ["auto"].concat(
4257
+ Object.keys(controlsLocations)
4258
+ )
4259
+ );
4260
+ #visualizationWrapperElem = document.createElement("div");
4261
+ // TODO: Better pattern.
4262
+ #errorElem = document.createElement("div");
4263
+ // TODO: Better pattern.
4264
+ #alreadyConnected = false;
4254
4265
  // TODO: support resetting
4255
4266
  async connectedCallback() {
4256
4267
  if (this.#alreadyConnected) {
@@ -4313,7 +4324,7 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
4313
4324
  );
4314
4325
  this.experimentalModel.puzzleID.addFreshListener(this.flash.bind(this));
4315
4326
  }
4316
- #flashLevel;
4327
+ #flashLevel = "auto";
4317
4328
  /** @deprecated */
4318
4329
  experimentalSetFlashLevel(newLevel) {
4319
4330
  this.#flashLevel = newLevel;
@@ -4326,9 +4337,9 @@ var TwistyPlayer = class extends TwistyPlayerSettable {
4326
4337
  });
4327
4338
  }
4328
4339
  }
4329
- #visualizationWrapper;
4330
- #initial3DVisualizationWrapper;
4331
- #visualizationStrategy;
4340
+ #visualizationWrapper = null;
4341
+ #initial3DVisualizationWrapper = new InitialValueTracker();
4342
+ #visualizationStrategy = null;
4332
4343
  #setVisualizationWrapper(strategy) {
4333
4344
  if (strategy !== this.#visualizationStrategy) {
4334
4345
  this.#visualizationWrapper?.remove();
@@ -4587,9 +4598,9 @@ var TwistyAlgWrapperElem = class extends HTMLElementShim {
4587
4598
  constructor(className, algOrAlgNode) {
4588
4599
  super();
4589
4600
  this.algOrAlgNode = algOrAlgNode;
4590
- this.queue = [];
4591
4601
  this.classList.add(className);
4592
4602
  }
4603
+ queue = [];
4593
4604
  addString(str) {
4594
4605
  this.queue.push(document.createTextNode(str));
4595
4606
  }
@@ -4828,10 +4839,8 @@ var AlgToDOMTree = class extends TraversalDownUp {
4828
4839
  };
4829
4840
  var algToDOMTree = functionFromTraversal(AlgToDOMTree);
4830
4841
  var MoveHighlighter = class {
4831
- constructor() {
4832
- this.moveCharIndexMap = /* @__PURE__ */ new Map();
4833
- this.currentElem = null;
4834
- }
4842
+ moveCharIndexMap = /* @__PURE__ */ new Map();
4843
+ currentElem = null;
4835
4844
  addMove(charIndex, elem) {
4836
4845
  this.moveCharIndexMap.set(charIndex, elem);
4837
4846
  }
@@ -4848,17 +4857,16 @@ var MoveHighlighter = class {
4848
4857
  }
4849
4858
  };
4850
4859
  var TwistyAlgViewer = class extends HTMLElementShim {
4860
+ highlighter = new MoveHighlighter();
4861
+ #domTree;
4862
+ #twistyPlayer = null;
4863
+ lastClickTimestamp = null;
4851
4864
  constructor(options) {
4852
4865
  super();
4853
- this.highlighter = new MoveHighlighter();
4854
- this.#twistyPlayer = null;
4855
- this.lastClickTimestamp = null;
4856
4866
  if (options?.twistyPlayer) {
4857
4867
  this.twistyPlayer = options?.twistyPlayer;
4858
4868
  }
4859
4869
  }
4860
- #domTree;
4861
- #twistyPlayer;
4862
4870
  connectedCallback() {
4863
4871
  }
4864
4872
  setAlg(alg) {
@@ -4896,8 +4904,8 @@ var TwistyAlgViewer = class extends HTMLElementShim {
4896
4904
  twistyPlayer.experimentalModel.currentMoveInfo.addFreshListener(
4897
4905
  (currentMoveInfo) => {
4898
4906
  let moveInfo = currentMoveInfo.currentMoves[0];
4899
- moveInfo ?? (moveInfo = currentMoveInfo.movesStarting[0]);
4900
- moveInfo ?? (moveInfo = currentMoveInfo.movesFinishing[0]);
4907
+ moveInfo ??= currentMoveInfo.movesStarting[0];
4908
+ moveInfo ??= currentMoveInfo.movesFinishing[0];
4901
4909
  if (!moveInfo) {
4902
4910
  this.highlighter.set(null);
4903
4911
  } else {
@@ -5107,21 +5115,19 @@ var LeafToHighlightProp = class extends TwistyPropDerived {
5107
5115
  }
5108
5116
  };
5109
5117
  var TwistyAlgEditorModel = class {
5110
- constructor() {
5111
- this.valueProp = new TwistyAlgEditorValueProp();
5112
- this.selectionProp = new TwistyAlgEditorSelectionProp();
5113
- this.targetCharProp = new TargetCharProp({ selectionInfo: this.selectionProp });
5114
- this.algEditorAlgWithIssues = new AlgEditorAlgWithIssuesProp({
5115
- value: this.valueProp
5116
- });
5117
- this.leafTokensProp = new LeafTokensProp({
5118
- algWithIssues: this.algEditorAlgWithIssues
5119
- });
5120
- this.leafToHighlight = new LeafToHighlightProp({
5121
- leafTokens: this.leafTokensProp,
5122
- targetChar: this.targetCharProp
5123
- });
5124
- }
5118
+ valueProp = new TwistyAlgEditorValueProp();
5119
+ selectionProp = new TwistyAlgEditorSelectionProp();
5120
+ targetCharProp = new TargetCharProp({ selectionInfo: this.selectionProp });
5121
+ algEditorAlgWithIssues = new AlgEditorAlgWithIssuesProp({
5122
+ value: this.valueProp
5123
+ });
5124
+ leafTokensProp = new LeafTokensProp({
5125
+ algWithIssues: this.algEditorAlgWithIssues
5126
+ });
5127
+ leafToHighlight = new LeafToHighlightProp({
5128
+ leafTokens: this.leafTokensProp,
5129
+ targetChar: this.targetCharProp
5130
+ });
5125
5131
  };
5126
5132
 
5127
5133
  // src/cubing/twisty/views/TwistyAlgEditor/paste.ts
@@ -5133,7 +5139,7 @@ function maybeParse(str) {
5133
5139
  return null;
5134
5140
  }
5135
5141
  }
5136
- function splitBeforeOnFirstOccurrence(str, delimiter) {
5142
+ function sliceBeforeFirstOccurrence(str, delimiter) {
5137
5143
  const idx = str.indexOf(delimiter);
5138
5144
  if (idx === -1) {
5139
5145
  return [str, ""];
@@ -5143,7 +5149,7 @@ function splitBeforeOnFirstOccurrence(str, delimiter) {
5143
5149
  function replaceSmartQuotesOutsideComments(str) {
5144
5150
  const linesOut = [];
5145
5151
  for (const line of str.split("\n")) {
5146
- let [before, after] = splitBeforeOnFirstOccurrence(line, COMMENT_DELIMITER);
5152
+ let [before, after] = sliceBeforeFirstOccurrence(line, COMMENT_DELIMITER);
5147
5153
  before = before.replaceAll("\u2019", "'");
5148
5154
  linesOut.push(before + after);
5149
5155
  }
@@ -5160,7 +5166,7 @@ function pasteIntoTextArea(textArea, pastedText) {
5160
5166
  const pasteEndsWithComment = pastedText.match(/\/\/[^\n]*$/);
5161
5167
  let replacement = pastedText;
5162
5168
  if (pasteStartsWithCommentText) {
5163
- const [before, after] = splitBeforeOnFirstOccurrence(pastedText, "\n");
5169
+ const [before, after] = sliceBeforeFirstOccurrence(pastedText, "\n");
5164
5170
  replacement = before + replaceSmartQuotesOutsideComments(after);
5165
5171
  } else {
5166
5172
  replacement = replaceSmartQuotesOutsideComments(pastedText);
@@ -5271,27 +5277,33 @@ var ATTRIBUTE_FOR_TWISTY_PLAYER = "for-twisty-player";
5271
5277
  var ATTRIBUTE_PLACEHOLDER = "placeholder";
5272
5278
  var ATTRIBUTE_TWISTY_PLAYER_PROP = "twisty-player-prop";
5273
5279
  var TwistyAlgEditor = class extends ManagedCustomElement {
5280
+ model = new TwistyAlgEditorModel();
5281
+ // #alg: Alg = new Alg();
5282
+ #textarea = document.createElement("textarea");
5283
+ #carbonCopy = document.createElement("div");
5284
+ #carbonCopyPrefix = document.createElement("span");
5285
+ #carbonCopyHighlight = document.createElement("span");
5286
+ #carbonCopySuffix = document.createElement("span");
5287
+ // #textareaClassListManager: ClassListManager<"none" | "warning" | "error"> =
5288
+ // new ClassListManager(this, "issue-", ["none", "warning", "error"]);
5289
+ #textareaClassListValidForPuzzleManager = new ClassListManager(this, "valid-for-puzzle-", [
5290
+ "none",
5291
+ "warning",
5292
+ "error"
5293
+ ]);
5294
+ #twistyPlayer = null;
5295
+ #twistyPlayerProp;
5296
+ get #algProp() {
5297
+ if (this.#twistyPlayer === null) {
5298
+ return null;
5299
+ } else {
5300
+ return this.#twistyPlayer.experimentalModel[this.#twistyPlayerProp];
5301
+ }
5302
+ }
5303
+ // Temporary Workaround for Twizzle Explorer
5304
+ debugNeverRequestTimestamp = false;
5274
5305
  constructor(options) {
5275
5306
  super();
5276
- this.model = new TwistyAlgEditorModel();
5277
- // #alg: Alg = new Alg();
5278
- this.#textarea = document.createElement("textarea");
5279
- this.#carbonCopy = document.createElement("div");
5280
- this.#carbonCopyPrefix = document.createElement("span");
5281
- this.#carbonCopyHighlight = document.createElement("span");
5282
- this.#carbonCopySuffix = document.createElement("span");
5283
- // #textareaClassListManager: ClassListManager<"none" | "warning" | "error"> =
5284
- // new ClassListManager(this, "issue-", ["none", "warning", "error"]);
5285
- this.#textareaClassListValidForPuzzleManager = new ClassListManager(this, "valid-for-puzzle-", [
5286
- "none",
5287
- "warning",
5288
- "error"
5289
- ]);
5290
- this.#twistyPlayer = null;
5291
- // Temporary Workaround for Twizzle Explorer
5292
- this.debugNeverRequestTimestamp = false;
5293
- this.#onInputHasFired = false;
5294
- this.#highlightedLeaf = null;
5295
5307
  this.#carbonCopy.classList.add("carbon-copy");
5296
5308
  this.addElement(this.#carbonCopy);
5297
5309
  this.#textarea.rows = 1;
@@ -5328,21 +5340,6 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
5328
5340
  );
5329
5341
  }
5330
5342
  }
5331
- #textarea;
5332
- #carbonCopy;
5333
- #carbonCopyPrefix;
5334
- #carbonCopyHighlight;
5335
- #carbonCopySuffix;
5336
- #textareaClassListValidForPuzzleManager;
5337
- #twistyPlayer;
5338
- #twistyPlayerProp;
5339
- get #algProp() {
5340
- if (this.#twistyPlayer === null) {
5341
- return null;
5342
- } else {
5343
- return this.#twistyPlayer.experimentalModel[this.#twistyPlayerProp];
5344
- }
5345
- }
5346
5343
  connectedCallback() {
5347
5344
  this.#textarea.addEventListener("paste", (e) => {
5348
5345
  const text = e.clipboardData?.getData("text");
@@ -5366,7 +5363,7 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
5366
5363
  set placeholder(placeholderText) {
5367
5364
  this.#textarea.placeholder = placeholderText;
5368
5365
  }
5369
- #onInputHasFired;
5366
+ #onInputHasFired = false;
5370
5367
  onInput() {
5371
5368
  this.#carbonCopyHighlight.hidden = true;
5372
5369
  this.highlightLeaf(null);
@@ -5397,7 +5394,7 @@ var TwistyAlgEditor = class extends ManagedCustomElement {
5397
5394
  #padSuffix(s) {
5398
5395
  return s.endsWith("\n") ? `${s} ` : s;
5399
5396
  }
5400
- #highlightedLeaf;
5397
+ #highlightedLeaf = null;
5401
5398
  // TODO: support a primary highlighted move and secondary ones.
5402
5399
  highlightLeaf(leaf) {
5403
5400
  if (this.#twistyPlayerProp !== "alg") {
@@ -5780,9 +5777,9 @@ var TwizzleLink = class extends ManagedCustomElement {
5780
5777
  constructor(options) {
5781
5778
  super({ mode: "open" });
5782
5779
  this.options = options;
5783
- this.twistyPlayer = null;
5784
- this.a = null;
5785
5780
  }
5781
+ twistyPlayer = null;
5782
+ a = null;
5786
5783
  fallback() {
5787
5784
  this.contentWrapper.textContent = "";
5788
5785
  if (this.a) {