cubing 0.41.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/{types/KPattern-85fd8579.d.ts → cubing/KPattern-12e23b1f.d.ts} +8 -8
  2. package/dist/{types/TwizzleLink-7d147be8.d.ts → cubing/TwizzleLink-8eaf164c.d.ts} +9 -9
  3. package/dist/{types → cubing}/bluetooth/index.d.ts +8 -8
  4. package/dist/{esm → cubing}/bluetooth/index.js +40 -40
  5. package/dist/cubing/bluetooth/index.js.map +7 -0
  6. package/dist/{types/bluetooth-puzzle-da601f13.d.ts → cubing/bluetooth-puzzle-91e73b7f.d.ts} +3 -3
  7. package/dist/{esm/chunk-2MAPPPWG.js → cubing/chunk-3B5ND2Z3.js} +24 -22
  8. package/dist/cubing/chunk-3B5ND2Z3.js.map +7 -0
  9. package/dist/{esm/chunk-UOO5TXR6.js → cubing/chunk-3RHBVKV2.js} +88 -79
  10. package/dist/cubing/chunk-3RHBVKV2.js.map +7 -0
  11. package/dist/{esm/chunk-QFJEREMI.js → cubing/chunk-5ZUKQHAY.js} +25 -22
  12. package/dist/cubing/chunk-5ZUKQHAY.js.map +7 -0
  13. package/dist/{esm/chunk-VRFVPBCT.js → cubing/chunk-6FC7BO5U.js} +2 -2
  14. package/dist/{esm/chunk-LWPMAFQX.js → cubing/chunk-GXXHRHE5.js} +31 -31
  15. package/dist/cubing/chunk-GXXHRHE5.js.map +7 -0
  16. package/dist/{esm/chunk-SNYTAYI2.js → cubing/chunk-H66X47MG.js} +23 -23
  17. package/dist/{esm/chunk-SNYTAYI2.js.map → cubing/chunk-H66X47MG.js.map} +2 -2
  18. package/dist/{esm/chunk-DNOZJX34.js → cubing/chunk-LRYMCZVI.js} +3 -3
  19. package/dist/{esm/chunk-BTVDGT5H.js → cubing/chunk-Q7UVEISQ.js} +3 -3
  20. package/dist/{esm/chunk-F72PPD54.js → cubing/chunk-V4YTFIKT.js} +38 -36
  21. package/dist/cubing/chunk-V4YTFIKT.js.map +7 -0
  22. package/dist/cubing/inside-GPSEWHK7.js +17 -0
  23. package/dist/{types → cubing}/kpuzzle/index.d.ts +1 -1
  24. package/dist/{esm → cubing}/kpuzzle/index.js +1 -1
  25. package/dist/{types → cubing}/notation/index.d.ts +2 -2
  26. package/dist/{esm → cubing}/notation/index.js +3 -3
  27. package/dist/{types/outside-51ce651a.d.ts → cubing/outside-deaac55d.d.ts} +8 -8
  28. package/dist/{types → cubing}/protocol/index.d.ts +3 -3
  29. package/dist/{esm → cubing}/protocol/index.js +3 -3
  30. package/dist/{types → cubing}/puzzle-geometry/index.d.ts +2 -2
  31. package/dist/{types → cubing}/puzzles/index.d.ts +3 -3
  32. package/dist/{esm → cubing}/puzzles/index.js +3 -3
  33. package/dist/cubing/scramble/index.d.ts +3 -0
  34. package/dist/cubing/scramble/index.js +16 -0
  35. package/dist/{types → cubing}/search/index.d.ts +4 -4
  36. package/dist/{esm → cubing}/search/index.js +9 -9
  37. package/dist/{esm/search-dynamic-sgs-side-events-7RLPMUUQ.js → cubing/search-dynamic-sgs-side-events-4ZHROANX.js} +4 -4
  38. package/dist/{esm/search-dynamic-sgs-unofficial-IXO75L3Y.js → cubing/search-dynamic-sgs-unofficial-VKBYULK5.js} +4 -4
  39. package/dist/{esm/search-dynamic-solve-3x3x3-7EEK52SV.js → cubing/search-dynamic-solve-3x3x3-NULYS7OL.js} +3 -3
  40. package/dist/{esm/search-dynamic-solve-3x3x3-7EEK52SV.js.map → cubing/search-dynamic-solve-3x3x3-NULYS7OL.js.map} +2 -2
  41. package/dist/{esm/search-dynamic-solve-4x4x4-IP6UC7HF.js → cubing/search-dynamic-solve-4x4x4-KASG5V7K.js} +5 -5
  42. package/dist/{esm/search-dynamic-solve-sq1-CWJPRQVZ.js → cubing/search-dynamic-solve-sq1-TO7UHE6Y.js} +6 -6
  43. package/dist/{esm/search-dynamic-solve-sq1-CWJPRQVZ.js.map → cubing/search-dynamic-solve-sq1-TO7UHE6Y.js.map} +2 -2
  44. package/dist/{esm → cubing}/search-worker-entry.js.js +1 -1
  45. package/dist/{types → cubing}/stream/index.d.ts +2 -2
  46. package/dist/{types → cubing}/twisty/index.d.ts +7 -7
  47. package/dist/{esm → cubing}/twisty/index.js +54 -52
  48. package/dist/cubing/twisty/index.js.map +7 -0
  49. package/dist/{esm/twisty-dynamic-3d-6SRUMP27.js → cubing/twisty-dynamic-3d-5VC2L2WS.js} +11 -11
  50. package/dist/{esm/twisty-dynamic-3d-6SRUMP27.js.map → cubing/twisty-dynamic-3d-5VC2L2WS.js.map} +2 -2
  51. package/dist/{esm/twsearch-D6TM63UU.js → cubing/twsearch-OMTTOVJO.js} +8 -8
  52. package/dist/cubing/twsearch-OMTTOVJO.js.map +7 -0
  53. package/package.json +25 -25
  54. package/alg/package.json +0 -4
  55. package/bluetooth/package.json +0 -4
  56. package/dist/esm/alg/index.d.ts +0 -1
  57. package/dist/esm/bluetooth/index.d.ts +0 -1
  58. package/dist/esm/bluetooth/index.js.map +0 -7
  59. package/dist/esm/chunk-2MAPPPWG.js.map +0 -7
  60. package/dist/esm/chunk-F72PPD54.js.map +0 -7
  61. package/dist/esm/chunk-LWPMAFQX.js.map +0 -7
  62. package/dist/esm/chunk-QFJEREMI.js.map +0 -7
  63. package/dist/esm/chunk-UOO5TXR6.js.map +0 -7
  64. package/dist/esm/inside-DLVM67HZ.js +0 -17
  65. package/dist/esm/kpuzzle/index.d.ts +0 -1
  66. package/dist/esm/notation/index.d.ts +0 -1
  67. package/dist/esm/protocol/index.d.ts +0 -1
  68. package/dist/esm/puzzle-geometry/index.d.ts +0 -1
  69. package/dist/esm/puzzles/index.d.ts +0 -1
  70. package/dist/esm/scramble/index.d.ts +0 -1
  71. package/dist/esm/scramble/index.js +0 -16
  72. package/dist/esm/search/index.d.ts +0 -1
  73. package/dist/esm/stream/index.d.ts +0 -1
  74. package/dist/esm/twisty/index.d.ts +0 -1
  75. package/dist/esm/twisty/index.js.map +0 -7
  76. package/dist/esm/twsearch-D6TM63UU.js.map +0 -7
  77. package/dist/types/scramble/index.d.ts +0 -3
  78. package/kpuzzle/package.json +0 -4
  79. package/notation/package.json +0 -4
  80. package/protocol/package.json +0 -4
  81. package/puzzle-geometry/package.json +0 -4
  82. package/puzzles/package.json +0 -4
  83. package/scramble/package.json +0 -4
  84. package/search/package.json +0 -4
  85. package/stream/package.json +0 -4
  86. package/twisty/package.json +0 -4
  87. /package/dist/{types → cubing}/Alg-c6770822.d.ts +0 -0
  88. /package/dist/{types → cubing}/alg/index.d.ts +0 -0
  89. /package/dist/{esm → cubing}/alg/index.js +0 -0
  90. /package/dist/{esm → cubing}/alg/index.js.map +0 -0
  91. /package/dist/{esm → cubing}/chunk-5J7SUMXR.js +0 -0
  92. /package/dist/{esm → cubing}/chunk-5J7SUMXR.js.map +0 -0
  93. /package/dist/{esm/chunk-VRFVPBCT.js.map → cubing/chunk-6FC7BO5U.js.map} +0 -0
  94. /package/dist/{esm → cubing}/chunk-6OUID4YZ.js +0 -0
  95. /package/dist/{esm → cubing}/chunk-6OUID4YZ.js.map +0 -0
  96. /package/dist/{esm → cubing}/chunk-7QE2OVHX.js +0 -0
  97. /package/dist/{esm → cubing}/chunk-7QE2OVHX.js.map +0 -0
  98. /package/dist/{esm/chunk-DNOZJX34.js.map → cubing/chunk-LRYMCZVI.js.map} +0 -0
  99. /package/dist/{esm/chunk-BTVDGT5H.js.map → cubing/chunk-Q7UVEISQ.js.map} +0 -0
  100. /package/dist/{esm → cubing}/chunk-RYRRMKVS.js +0 -0
  101. /package/dist/{esm → cubing}/chunk-RYRRMKVS.js.map +0 -0
  102. /package/dist/{esm → cubing}/chunk-ZYCJIZDN.js +0 -0
  103. /package/dist/{esm → cubing}/chunk-ZYCJIZDN.js.map +0 -0
  104. /package/dist/{esm/inside-DLVM67HZ.js.map → cubing/inside-GPSEWHK7.js.map} +0 -0
  105. /package/dist/{esm → cubing}/kpuzzle/index.js.map +0 -0
  106. /package/dist/{esm → cubing}/notation/index.js.map +0 -0
  107. /package/dist/{types → cubing}/parseAlg-d2c83795.d.ts +0 -0
  108. /package/dist/{esm → cubing}/protocol/index.js.map +0 -0
  109. /package/dist/{esm → cubing}/puzzle-geometry/index.js +0 -0
  110. /package/dist/{esm → cubing}/puzzle-geometry/index.js.map +0 -0
  111. /package/dist/{esm → cubing}/puzzles/index.js.map +0 -0
  112. /package/dist/{esm → cubing}/puzzles-dynamic-3x3x3-JFZVE27C.js +0 -0
  113. /package/dist/{esm → cubing}/puzzles-dynamic-3x3x3-JFZVE27C.js.map +0 -0
  114. /package/dist/{esm → cubing}/puzzles-dynamic-4x4x4-DT42HVIY.js +0 -0
  115. /package/dist/{esm → cubing}/puzzles-dynamic-4x4x4-DT42HVIY.js.map +0 -0
  116. /package/dist/{esm → cubing}/puzzles-dynamic-megaminx-QQYC32WM.js +0 -0
  117. /package/dist/{esm → cubing}/puzzles-dynamic-megaminx-QQYC32WM.js.map +0 -0
  118. /package/dist/{esm → cubing}/puzzles-dynamic-side-events-42Q52YAB.js +0 -0
  119. /package/dist/{esm → cubing}/puzzles-dynamic-side-events-42Q52YAB.js.map +0 -0
  120. /package/dist/{esm → cubing}/puzzles-dynamic-unofficial-PCHNKY4Y.js +0 -0
  121. /package/dist/{esm → cubing}/puzzles-dynamic-unofficial-PCHNKY4Y.js.map +0 -0
  122. /package/dist/{esm → cubing}/scramble/index.js.map +0 -0
  123. /package/dist/{esm → cubing}/search/index.js.map +0 -0
  124. /package/dist/{esm/search-dynamic-sgs-side-events-7RLPMUUQ.js.map → cubing/search-dynamic-sgs-side-events-4ZHROANX.js.map} +0 -0
  125. /package/dist/{esm/search-dynamic-sgs-unofficial-IXO75L3Y.js.map → cubing/search-dynamic-sgs-unofficial-VKBYULK5.js.map} +0 -0
  126. /package/dist/{esm/search-dynamic-solve-4x4x4-IP6UC7HF.js.map → cubing/search-dynamic-solve-4x4x4-KASG5V7K.js.map} +0 -0
  127. /package/dist/{esm → cubing}/search-dynamic-solve-fto-GGEYM3K6.js +0 -0
  128. /package/dist/{esm → cubing}/search-dynamic-solve-fto-GGEYM3K6.js.map +0 -0
  129. /package/dist/{esm → cubing}/search-dynamic-solve-kilominx-SH5K4OMH.js +0 -0
  130. /package/dist/{esm → cubing}/search-dynamic-solve-kilominx-SH5K4OMH.js.map +0 -0
  131. /package/dist/{esm → cubing}/search-dynamic-solve-master_tetraminx-WJWLROFP.js +0 -0
  132. /package/dist/{esm → cubing}/search-dynamic-solve-master_tetraminx-WJWLROFP.js.map +0 -0
  133. /package/dist/{esm → cubing}/search-worker-entry.js.js.map +0 -0
  134. /package/dist/{esm → cubing}/stream/index.js +0 -0
  135. /package/dist/{esm → cubing}/stream/index.js.map +0 -0
  136. /package/dist/{esm → cubing}/twsearch-BDAXZGZU-SJCPOVWW.js +0 -0
  137. /package/dist/{esm → cubing}/twsearch-BDAXZGZU-SJCPOVWW.js.map +0 -0
@@ -18,7 +18,7 @@ interface KPatternOrbitData {
18
18
  * - This indicates that the orientation of a piece is fully known, i.e.
19
19
  * that its "orientation mod" is the default value (N). However, such a
20
20
  * value is recorded as 0 instead of N, in order to make it simpler to
21
- * implement and debug state logic involving the default value.
21
+ * implement and debug pattern logic involving the default value.
22
22
  * - If `.orientationMod[i]` is a proper divisor of N (i.e. not 0), then
23
23
  * `.orientation[i]` must be less than `.orientationMod[i]`. That is, the
24
24
  * orientation values must be individually "normalized" for each piece.
@@ -37,7 +37,7 @@ interface KPatternOrbitData {
37
37
  * imagine a 24-hour clock with 24 hour marks around the dial, but where the
38
38
  * hour hand is symmetric and points equally at the current hour as well as
39
39
  * its diametic opposite (like a compass needle but painted all in one color).
40
- * This has the same set of "valid states" as a normal 12-hour clock. Such a
40
+ * This has the same set of "valid patterns" as a normal 12-hour clock. Such a
41
41
  * clock also has an "orientation mod" of 12, but where the multiples of the
42
42
  * modulus have been "unfolded" to show their full symmetry instead of being
43
43
  * implicit.
@@ -84,7 +84,7 @@ interface KPatternOrbitData {
84
84
  *
85
85
  * For those with a mathematical background, you may notice a relationship to
86
86
  * the concept of a coset (https://en.wikipedia.org/wiki/Coset). For example,
87
- * consider the group of states of a `KPuzzle` (without indistinguishable
87
+ * consider the group of patterns of a `KPuzzle` (without indistinguishable
88
88
  * pieces) generated by a set of transformations. We can assign each set of
89
89
  * piece orbits an orientation mod value (which must be identical for all
90
90
  * constituent pieces of the same orbit). Each such choice generates a set of
@@ -145,7 +145,7 @@ interface KPuzzleDefinition {
145
145
  defaultPattern: KPatternData;
146
146
  moves: Record<string, KTransformationData>;
147
147
  derivedMoves?: Record<string, string>;
148
- experimentalIsStateSolved?: (kpattern: KPattern, options: {
148
+ experimentalIsPatternSolved?: (kpattern: KPattern, options: {
149
149
  ignorePuzzleOrientation: boolean;
150
150
  ignoreCenterOrientation: boolean;
151
151
  }) => boolean;
@@ -522,14 +522,14 @@ declare class KPuzzle {
522
522
  algToTransformation(alg: Alg | string): KTransformation;
523
523
  /** @deprecated */
524
524
  toTransformation(source: KTransformationSource): KTransformation;
525
- startState(): KPattern;
526
- canConvertStateToUniqueTransformation(): boolean;
525
+ defaultPattern(): KPattern;
526
+ canConvertDefaultPatternToUniqueTransformation(): boolean;
527
527
  }
528
528
 
529
529
  declare class KPattern {
530
530
  readonly kpuzzle: KPuzzle;
531
- readonly stateData: KPatternData;
532
- constructor(kpuzzle: KPuzzle, stateData: KPatternData);
531
+ readonly patternData: KPatternData;
532
+ constructor(kpuzzle: KPuzzle, patternData: KPatternData);
533
533
  toJSON(): any;
534
534
  static fromTransformation(transformation: KTransformation): KPattern;
535
535
  /** @deprecated */
@@ -1,7 +1,7 @@
1
1
  import { Texture, Object3D, Raycaster, PerspectiveCamera, Scene, WebGLRenderer } from 'three';
2
2
  import { g as PuzzleSpecificSimplifyOptions, M as Move, a as Alg, P as Pause, h as AppendCancelOptions, d as AlgLeaf, b as AppendOptions, A as AlgNode, I as IterationDirection } from './Alg-c6770822.js';
3
3
  import { P as Parsed } from './parseAlg-d2c83795.js';
4
- import { a as KPuzzle, P as PuzzleGeometry, K as KPattern, g as KTransformation, h as PuzzleDescriptionString } from './KPattern-85fd8579.js';
4
+ import { a as KPuzzle, P as PuzzleGeometry, K as KPattern, g as KTransformation, h as PuzzleDescriptionString } from './KPattern-12e23b1f.js';
5
5
 
6
6
  type FaceletMeshStickeringMask = "regular" | "dim" | "oriented" | "ignored" | "invisible";
7
7
  type FaceletStickeringMask = {
@@ -55,7 +55,7 @@ interface MoveInProgress {
55
55
  fraction: number;
56
56
  }
57
57
  type PuzzlePosition = {
58
- state: KPattern;
58
+ pattern: KPattern;
59
59
  movesInProgress: MoveInProgress[];
60
60
  };
61
61
  declare enum BoundaryType {
@@ -192,7 +192,7 @@ interface CurrentMove {
192
192
  endTimestamp: MillisecondTimestamp;
193
193
  }
194
194
  interface CurrentMoveInfo {
195
- stateIndex: number;
195
+ patternIndex: number;
196
196
  currentMoves: CurrentMove[];
197
197
  movesFinishing: CurrentMove[];
198
198
  movesFinished: CurrentMove[];
@@ -203,13 +203,13 @@ interface CurrentMoveInfo {
203
203
  interface AlgIndexer {
204
204
  getAnimLeaf(index: number): AnimatedLeafAlgNode | null;
205
205
  indexToMoveStartTimestamp(index: number): Timestamp;
206
- stateAtIndex(index: number, startSTate?: KPattern): KPattern;
206
+ patternAtIndex(index: number, startPattern?: KPattern): KPattern;
207
207
  transformationAtIndex(index: number): KTransformation;
208
208
  numAnimatedLeaves(): number;
209
209
  timestampToIndex(timestamp: Timestamp): number;
210
210
  algDuration(): Duration;
211
211
  moveDuration(index: number): number;
212
- timestampToPosition?: (timestamp: Timestamp, startState?: KPattern) => PuzzlePosition;
212
+ timestampToPosition?: (timestamp: Timestamp, startPattern?: KPattern) => PuzzlePosition;
213
213
  currentMoveInfo?: (timestamp: Timestamp) => CurrentMoveInfo;
214
214
  }
215
215
 
@@ -245,7 +245,7 @@ interface CurrentLeavesSimplifiedPropInputs {
245
245
  currentMoveInfo: CurrentMoveInfo;
246
246
  }
247
247
  interface CurrentLeavesSimplified {
248
- stateIndex: number;
248
+ patternIndex: number;
249
249
  movesFinishing: Move[];
250
250
  movesFinished: Move[];
251
251
  }
@@ -300,7 +300,7 @@ interface CurrentTransformationPropInputs {
300
300
  currentLeavesSimplified: CurrentLeavesSimplified;
301
301
  indexer: AlgIndexer;
302
302
  }
303
- declare class CurrentStateProp extends TwistyPropDerived<CurrentTransformationPropInputs, KPattern> {
303
+ declare class CurrentPatternProp extends TwistyPropDerived<CurrentTransformationPropInputs, KPattern> {
304
304
  derive(inputs: CurrentTransformationPropInputs): KPattern;
305
305
  }
306
306
 
@@ -384,7 +384,7 @@ declare class IndexerProp extends TwistyPropDerived<IndexerPropInputs, AlgIndexe
384
384
 
385
385
  interface LegacyPositionPropInputs {
386
386
  currentMoveInfo: CurrentMoveInfo;
387
- state: KPattern;
387
+ currentPattern: KPattern;
388
388
  }
389
389
  declare class LegacyPositionProp extends TwistyPropDerived<LegacyPositionPropInputs, PuzzlePosition> {
390
390
  derive(inputs: LegacyPositionPropInputs): PuzzlePosition;
@@ -771,7 +771,7 @@ declare class TwistyPlayerModel {
771
771
  currentMoveInfo: CurrentMoveInfoProp;
772
772
  buttonAppearance: ButtonAppearanceProp;
773
773
  currentLeavesSimplified: CurrentLeavesSimplifiedProp;
774
- currentState: CurrentStateProp;
774
+ currentPattern: CurrentPatternProp;
775
775
  legacyPosition: LegacyPositionProp;
776
776
  twistySceneModel: TwistySceneModel;
777
777
  twizzleLink(): Promise<string>;
@@ -1,6 +1,6 @@
1
- import { K as KPattern } from '../KPattern-85fd8579.js';
2
- import { B as BluetoothPuzzle } from '../bluetooth-puzzle-da601f13.js';
3
- export { B as BluetoothPuzzle, A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle-da601f13.js';
1
+ import { K as KPattern } from '../KPattern-12e23b1f.js';
2
+ import { B as BluetoothPuzzle } from '../bluetooth-puzzle-91e73b7f.js';
3
+ export { B as BluetoothPuzzle, A as MoveEvent, O as OrientationEvent } from '../bluetooth-puzzle-91e73b7f.js';
4
4
  import { a as Alg, M as Move } from '../Alg-c6770822.js';
5
5
 
6
6
  declare function enableDebugLogging(enable: boolean): void;
@@ -9,12 +9,12 @@ declare function enableDebugLogging(enable: boolean): void;
9
9
  declare class KeyboardPuzzle extends BluetoothPuzzle {
10
10
  private target;
11
11
  private puzzle;
12
- private state;
12
+ private pattern;
13
13
  listener: (e: KeyboardEvent) => Promise<void>;
14
14
  constructor(target: Element);
15
15
  name(): string | undefined;
16
16
  disconnect(): void;
17
- getState(): Promise<KPattern>;
17
+ getPattern(): Promise<KPattern>;
18
18
  private onKeyDown;
19
19
  }
20
20
  /** @category Keyboard Puzzles */
@@ -39,7 +39,7 @@ declare class GanCube extends BluetoothPuzzle {
39
39
  static connect(server: BluetoothRemoteGATTServer): Promise<GanCube>;
40
40
  INTERVAL_MS: number;
41
41
  private intervalHandle;
42
- private state;
42
+ private pattern;
43
43
  private cachedFaceletStatus1Characteristic;
44
44
  private cachedFaceletStatus2Characteristic;
45
45
  private cachedActualAngleAndBatteryCharacteristic;
@@ -50,7 +50,7 @@ declare class GanCube extends BluetoothPuzzle {
50
50
  stopTrackingMoves(): void;
51
51
  intervalHandler(): Promise<void>;
52
52
  getBattery(): Promise<number>;
53
- getState(): Promise<KPattern>;
53
+ getPattern(): Promise<KPattern>;
54
54
  faceletStatus1Characteristic(): Promise<BluetoothRemoteGATTCharacteristic>;
55
55
  faceletStatus2Characteristic(): Promise<BluetoothRemoteGATTCharacteristic>;
56
56
  actualAngleAndBatteryCharacteristic(): Promise<BluetoothRemoteGATTCharacteristic>;
@@ -69,7 +69,7 @@ declare class GiiKERCube extends BluetoothPuzzle {
69
69
  private constructor();
70
70
  name(): string | undefined;
71
71
  disconnect(): void;
72
- getState(): Promise<KPattern>;
72
+ getPattern(): Promise<KPattern>;
73
73
  private getBit;
74
74
  private toReid333;
75
75
  private onCubeCharacteristicChanged;
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  binaryComponentsToReid3x3x3,
3
3
  twizzleBinaryToBinaryComponents
4
- } from "../chunk-2MAPPPWG.js";
4
+ } from "../chunk-3B5ND2Z3.js";
5
5
  import {
6
6
  cube3x3x3,
7
7
  puzzles
8
- } from "../chunk-BTVDGT5H.js";
8
+ } from "../chunk-Q7UVEISQ.js";
9
9
  import {
10
10
  experimental3x3x3KPuzzle
11
- } from "../chunk-SNYTAYI2.js";
11
+ } from "../chunk-H66X47MG.js";
12
12
  import {
13
13
  KPattern
14
- } from "../chunk-F72PPD54.js";
14
+ } from "../chunk-V4YTFIKT.js";
15
15
  import {
16
16
  Alg,
17
17
  Move,
@@ -95,8 +95,8 @@ var BluetoothPuzzle = class extends EventTarget {
95
95
  }
96
96
  // TODO: Can we make this reutrn (async) on success?
97
97
  // TODO: require subclasses to implement this?
98
- async getState() {
99
- throw new Error("cannot get state");
98
+ async getPattern() {
99
+ throw new Error("cannot get pattern");
100
100
  }
101
101
  addAlgLeafListener(listener) {
102
102
  this.listeners.push(listener);
@@ -139,7 +139,7 @@ var KeyboardPuzzle = class extends BluetoothPuzzle {
139
139
  super();
140
140
  this.target = target;
141
141
  this.puzzle = puzzles["3x3x3"].kpuzzle();
142
- this.state = (async () => (await this.puzzle).startState())();
142
+ this.pattern = (async () => (await this.puzzle).defaultPattern())();
143
143
  this.listener = this.onKeyDown.bind(this);
144
144
  target.addEventListener("keydown", this.listener);
145
145
  }
@@ -149,8 +149,8 @@ var KeyboardPuzzle = class extends BluetoothPuzzle {
149
149
  disconnect() {
150
150
  this.target.removeEventListener("keydown", this.listener);
151
151
  }
152
- async getState() {
153
- return this.state;
152
+ async getPattern() {
153
+ return this.pattern;
154
154
  }
155
155
  async onKeyDown(e) {
156
156
  if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
@@ -158,12 +158,12 @@ var KeyboardPuzzle = class extends BluetoothPuzzle {
158
158
  }
159
159
  const algLeaf = keyToMove(e);
160
160
  if (algLeaf) {
161
- const newState = (await this.state).applyAlg(new Alg([algLeaf]));
162
- this.state = Promise.resolve(newState);
161
+ const newPattern = (await this.pattern).applyAlg(new Alg([algLeaf]));
162
+ this.pattern = Promise.resolve(newPattern);
163
163
  this.dispatchAlgLeaf({
164
164
  latestAlgLeaf: algLeaf,
165
165
  timeStamp: e.timeStamp,
166
- state: newState
166
+ pattern: newPattern
167
167
  });
168
168
  e.preventDefault();
169
169
  }
@@ -335,7 +335,7 @@ var key11 = new Uint8Array([
335
335
  1,
336
336
  241
337
337
  ]);
338
- async function decryptState(data, aesKey) {
338
+ async function decryptPattern(data, aesKey) {
339
339
  if (aesKey === null) {
340
340
  return data;
341
341
  }
@@ -348,7 +348,7 @@ async function decryptState(data, aesKey) {
348
348
  if (probablyDecodedCorrectly(copy)) {
349
349
  return copy;
350
350
  }
351
- throw new Error("Invalid Gan cube state");
351
+ throw new Error("Invalid Gan cube pattern");
352
352
  }
353
353
  var PhysicalState = class _PhysicalState {
354
354
  constructor(dataView, timeStamp) {
@@ -361,7 +361,7 @@ var PhysicalState = class _PhysicalState {
361
361
  }
362
362
  }
363
363
  static async read(characteristic, aesKey) {
364
- const value = await decryptState(
364
+ const value = await decryptPattern(
365
365
  new Uint8Array((await characteristic.readValue()).buffer),
366
366
  aesKey
367
367
  );
@@ -520,7 +520,7 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
520
520
  this.aesKey = aesKey;
521
521
  this.INTERVAL_MS = DEFAULT_INTERVAL_MS;
522
522
  this.intervalHandle = null;
523
- this.state = kpuzzle.startState();
523
+ this.pattern = kpuzzle.defaultPattern();
524
524
  this.startTrackingMoves();
525
525
  }
526
526
  // We have to perform async operations before we call the constructor.
@@ -577,12 +577,12 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
577
577
  numInterveningMoves = MAX_LATEST_MOVES;
578
578
  }
579
579
  for (const move of physicalState.latestMoves(numInterveningMoves)) {
580
- this.state = this.state.applyMove(move);
580
+ this.pattern = this.pattern.applyMove(move);
581
581
  this.dispatchAlgLeaf({
582
582
  latestAlgLeaf: move,
583
583
  timeStamp: physicalState.timeStamp,
584
584
  debug: physicalState.debugInfo(),
585
- state: this.state
585
+ pattern: this.pattern
586
586
  // quaternion: physicalState.rotQuat(),
587
587
  });
588
588
  }
@@ -597,8 +597,8 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
597
597
  await this.readActualAngleAndBatteryCharacteristic()
598
598
  )[7];
599
599
  }
600
- async getState() {
601
- const arr = await decryptState(
600
+ async getPattern() {
601
+ const arr = await decryptPattern(
602
602
  new Uint8Array(await this.readFaceletStatus1Characteristic()),
603
603
  this.aesKey
604
604
  );
@@ -610,7 +610,7 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
610
610
  v >>= 3;
611
611
  }
612
612
  }
613
- const stateData = {
613
+ const patternData = {
614
614
  CORNERS: {
615
615
  pieces: [],
616
616
  orientation: []
@@ -628,15 +628,15 @@ var GanCube = class _GanCube extends BluetoothPuzzle {
628
628
  };
629
629
  for (const cornerMapping of gan356iCornerMappings) {
630
630
  const pieceInfo = pieceMap[cornerMapping.map((i) => faceOrder[stickers[i]]).join("")];
631
- stateData.CORNERS.pieces.push(pieceInfo.piece);
632
- stateData.CORNERS.orientation.push(pieceInfo.orientation);
631
+ patternData.CORNERS.pieces.push(pieceInfo.piece);
632
+ patternData.CORNERS.orientation.push(pieceInfo.orientation);
633
633
  }
634
634
  for (const edgeMapping of gan356iEdgeMappings) {
635
635
  const pieceInfo = pieceMap[edgeMapping.map((i) => faceOrder[stickers[i]]).join("")];
636
- stateData.EDGES.pieces.push(pieceInfo.piece);
637
- stateData.EDGES.orientation.push(pieceInfo.orientation);
636
+ patternData.EDGES.pieces.push(pieceInfo.piece);
637
+ patternData.EDGES.orientation.push(pieceInfo.orientation);
638
638
  }
639
- return new KPattern(this.kpuzzle, stateData);
639
+ return new KPattern(this.kpuzzle, patternData);
640
640
  }
641
641
  async faceletStatus1Characteristic() {
642
642
  this.cachedFaceletStatus1Characteristic = this.cachedFaceletStatus1Characteristic || this.service.getCharacteristic(UUIDs.faceletStatus1Characteristic);
@@ -775,7 +775,7 @@ var lookup = [
775
775
  171,
776
776
  41
777
777
  ];
778
- function decryptState2(data) {
778
+ function decryptState(data) {
779
779
  const offset1 = getNibble(data, 38);
780
780
  const offset2 = getNibble(data, 39);
781
781
  const output = new Uint8Array(MESSAGE_LENGTH);
@@ -788,7 +788,7 @@ async function decodeState(data) {
788
788
  if (!probablyEncrypted(data)) {
789
789
  return data;
790
790
  }
791
- return decryptState2(data);
791
+ return decryptState(data);
792
792
  }
793
793
  var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
794
794
  constructor(server, cubeCharacteristic, originalValue) {
@@ -822,7 +822,7 @@ var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
822
822
  disconnect() {
823
823
  this.server.disconnect();
824
824
  }
825
- async getState() {
825
+ async getPattern() {
826
826
  return this.toReid333(
827
827
  new Uint8Array((await this.cubeCharacteristic.readValue()).buffer)
828
828
  );
@@ -833,7 +833,7 @@ var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
833
833
  return val[n] >> shift & 1;
834
834
  }
835
835
  toReid333(val) {
836
- const state = {
836
+ const patternData = {
837
837
  EDGES: {
838
838
  pieces: new Array(12),
839
839
  orientation: new Array(12)
@@ -846,15 +846,15 @@ var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
846
846
  };
847
847
  for (let i = 0; i < 12; i++) {
848
848
  const gi = epReid333toGiiKER[i];
849
- state.EDGES.pieces[i] = epGiiKERtoReid333[getNibble(val, gi + 16) - 1];
850
- state.EDGES.orientation[i] = this.getBit(val, gi + 112) ^ preEO[state.EDGES.pieces[i]] ^ postEO[i];
849
+ patternData.EDGES.pieces[i] = epGiiKERtoReid333[getNibble(val, gi + 16) - 1];
850
+ patternData.EDGES.orientation[i] = this.getBit(val, gi + 112) ^ preEO[patternData.EDGES.pieces[i]] ^ postEO[i];
851
851
  }
852
852
  for (let i = 0; i < 8; i++) {
853
853
  const gi = cpReid333toGiiKER[i];
854
- state.CORNERS.pieces[i] = cpGiiKERtoReid333[getNibble(val, gi) - 1];
855
- state.CORNERS.orientation[i] = (getNibble(val, gi + 8) * coFlip[gi] + preCO[state.CORNERS.pieces[i]] + postCO[i]) % 3;
854
+ patternData.CORNERS.pieces[i] = cpGiiKERtoReid333[getNibble(val, gi) - 1];
855
+ patternData.CORNERS.orientation[i] = (getNibble(val, gi + 8) * coFlip[gi] + preCO[patternData.CORNERS.pieces[i]] + postCO[i]) % 3;
856
856
  }
857
- return new KPattern(experimental3x3x3KPuzzle, state);
857
+ return new KPattern(experimental3x3x3KPuzzle, patternData);
858
858
  }
859
859
  async onCubeCharacteristicChanged(event) {
860
860
  const val = await decodeState(new Uint8Array(event.target.value.buffer));
@@ -878,7 +878,7 @@ var GiiKERCube = class _GiiKERCube extends BluetoothPuzzle {
878
878
  debug: {
879
879
  stateStr: str
880
880
  },
881
- state: this.toReid333(val)
881
+ pattern: this.toReid333(val)
882
882
  });
883
883
  }
884
884
  isRepeatedInitialValue(val) {
@@ -1124,7 +1124,7 @@ var HeykubeCube = class _HeykubeCube extends BluetoothPuzzle {
1124
1124
  this.dispatchAlgLeaf({
1125
1125
  latestAlgLeaf: state.latestMove,
1126
1126
  timeStamp: event.timeStamp,
1127
- state: state.state
1127
+ pattern: state.pattern
1128
1128
  });
1129
1129
  }
1130
1130
  decodeState(dv) {
@@ -1165,13 +1165,13 @@ var HeykubeCube = class _HeykubeCube extends BluetoothPuzzle {
1165
1165
  moMask: 0
1166
1166
  };
1167
1167
  return {
1168
- state: binaryComponentsToReid3x3x3(components2),
1168
+ pattern: binaryComponentsToReid3x3x3(components2),
1169
1169
  latestMove: moves[b2[20] & 15]
1170
1170
  };
1171
1171
  }
1172
- async getState() {
1172
+ async getPattern() {
1173
1173
  const b1 = await this.stateCharacteristic.readValue();
1174
- return this.decodeState(b1).state;
1174
+ return this.decodeState(b1).pattern;
1175
1175
  }
1176
1176
  };
1177
1177
  var heykubeConfig = {