@rednaxela101/cubing 0.63.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +120 -0
  2. package/alg/index.d.ts +1 -0
  3. package/bluetooth/index.d.ts +1 -0
  4. package/dist/bin/chunks/chunk-22VWCGBC.js +13 -0
  5. package/dist/bin/chunks/chunk-22VWCGBC.js.map +7 -0
  6. package/dist/bin/order.js +59 -0
  7. package/dist/bin/order.js.map +7 -0
  8. package/dist/bin/puzzle-geometry-bin.js +407 -0
  9. package/dist/bin/puzzle-geometry-bin.js.map +7 -0
  10. package/dist/bin/scramble.js +188 -0
  11. package/dist/bin/scramble.js.map +7 -0
  12. package/dist/bin/svg.js +56 -0
  13. package/dist/bin/svg.js.map +7 -0
  14. package/dist/lib/cubing/alg/index.d.ts +2 -0
  15. package/dist/lib/cubing/alg/index.js +43 -0
  16. package/dist/lib/cubing/alg/index.js.map +7 -0
  17. package/dist/lib/cubing/bluetooth/index.d.ts +189 -0
  18. package/dist/lib/cubing/bluetooth/index.js +2271 -0
  19. package/dist/lib/cubing/bluetooth/index.js.map +7 -0
  20. package/dist/lib/cubing/chunks/big-puzzle-orientation-BA6QHO5C.js +68 -0
  21. package/dist/lib/cubing/chunks/big-puzzle-orientation-BA6QHO5C.js.map +7 -0
  22. package/dist/lib/cubing/chunks/chunk-2VJB4TMH.js +1774 -0
  23. package/dist/lib/cubing/chunks/chunk-2VJB4TMH.js.map +7 -0
  24. package/dist/lib/cubing/chunks/chunk-52ZXJEUO.js +665 -0
  25. package/dist/lib/cubing/chunks/chunk-52ZXJEUO.js.map +7 -0
  26. package/dist/lib/cubing/chunks/chunk-56VZAEPF.js +274 -0
  27. package/dist/lib/cubing/chunks/chunk-56VZAEPF.js.map +7 -0
  28. package/dist/lib/cubing/chunks/chunk-7GUL3OBQ.js +9 -0
  29. package/dist/lib/cubing/chunks/chunk-7GUL3OBQ.js.map +7 -0
  30. package/dist/lib/cubing/chunks/chunk-7L7BJSIM.js +21 -0
  31. package/dist/lib/cubing/chunks/chunk-7L7BJSIM.js.map +7 -0
  32. package/dist/lib/cubing/chunks/chunk-AESPJKN6.js +265 -0
  33. package/dist/lib/cubing/chunks/chunk-AESPJKN6.js.map +7 -0
  34. package/dist/lib/cubing/chunks/chunk-C2Q347XS.js +89 -0
  35. package/dist/lib/cubing/chunks/chunk-C2Q347XS.js.map +7 -0
  36. package/dist/lib/cubing/chunks/chunk-CGBMJBU3.js +1195 -0
  37. package/dist/lib/cubing/chunks/chunk-CGBMJBU3.js.map +7 -0
  38. package/dist/lib/cubing/chunks/chunk-HZQONEMD.js +249 -0
  39. package/dist/lib/cubing/chunks/chunk-HZQONEMD.js.map +7 -0
  40. package/dist/lib/cubing/chunks/chunk-IAGCVPL3.js +1069 -0
  41. package/dist/lib/cubing/chunks/chunk-IAGCVPL3.js.map +7 -0
  42. package/dist/lib/cubing/chunks/chunk-NAPITA3L.js +1 -0
  43. package/dist/lib/cubing/chunks/chunk-NAPITA3L.js.map +7 -0
  44. package/dist/lib/cubing/chunks/chunk-XPDJUSZ7.js +1876 -0
  45. package/dist/lib/cubing/chunks/chunk-XPDJUSZ7.js.map +7 -0
  46. package/dist/lib/cubing/chunks/chunk-YSI6PF35.js +619 -0
  47. package/dist/lib/cubing/chunks/chunk-YSI6PF35.js.map +7 -0
  48. package/dist/lib/cubing/chunks/inside-LG2EAKCL.js +557 -0
  49. package/dist/lib/cubing/chunks/inside-LG2EAKCL.js.map +7 -0
  50. package/dist/lib/cubing/chunks/puzzles-dynamic-2x2x2-JYJJXB4V.js +142 -0
  51. package/dist/lib/cubing/chunks/puzzles-dynamic-2x2x2-JYJJXB4V.js.map +7 -0
  52. package/dist/lib/cubing/chunks/puzzles-dynamic-3x3x3-FYXD7SIU.js +365 -0
  53. package/dist/lib/cubing/chunks/puzzles-dynamic-3x3x3-FYXD7SIU.js.map +7 -0
  54. package/dist/lib/cubing/chunks/puzzles-dynamic-4x4x4-AIGABOAR.js +132 -0
  55. package/dist/lib/cubing/chunks/puzzles-dynamic-4x4x4-AIGABOAR.js.map +7 -0
  56. package/dist/lib/cubing/chunks/puzzles-dynamic-5x5x5-JUNRX27W.js +277 -0
  57. package/dist/lib/cubing/chunks/puzzles-dynamic-5x5x5-JUNRX27W.js.map +7 -0
  58. package/dist/lib/cubing/chunks/puzzles-dynamic-clock-USGQTDPO.js +836 -0
  59. package/dist/lib/cubing/chunks/puzzles-dynamic-clock-USGQTDPO.js.map +7 -0
  60. package/dist/lib/cubing/chunks/puzzles-dynamic-fto-WJHMLYCJ.js +100 -0
  61. package/dist/lib/cubing/chunks/puzzles-dynamic-fto-WJHMLYCJ.js.map +7 -0
  62. package/dist/lib/cubing/chunks/puzzles-dynamic-megaminx-2LVHIDL4.js +224 -0
  63. package/dist/lib/cubing/chunks/puzzles-dynamic-megaminx-2LVHIDL4.js.map +7 -0
  64. package/dist/lib/cubing/chunks/puzzles-dynamic-pyraminx-7UWX4HHI.js +93 -0
  65. package/dist/lib/cubing/chunks/puzzles-dynamic-pyraminx-7UWX4HHI.js.map +7 -0
  66. package/dist/lib/cubing/chunks/puzzles-dynamic-square1-PQEKBPFN.js +842 -0
  67. package/dist/lib/cubing/chunks/puzzles-dynamic-square1-PQEKBPFN.js.map +7 -0
  68. package/dist/lib/cubing/chunks/search-dynamic-sgs-2x2x2-XFKQ4VJS.js +125 -0
  69. package/dist/lib/cubing/chunks/search-dynamic-sgs-2x2x2-XFKQ4VJS.js.map +7 -0
  70. package/dist/lib/cubing/chunks/search-dynamic-sgs-megaminx-ZDOOLEDW.js +1564 -0
  71. package/dist/lib/cubing/chunks/search-dynamic-sgs-megaminx-ZDOOLEDW.js.map +7 -0
  72. package/dist/lib/cubing/chunks/search-dynamic-sgs-pyraminx-W6UJWBYY.js +108 -0
  73. package/dist/lib/cubing/chunks/search-dynamic-sgs-pyraminx-W6UJWBYY.js.map +7 -0
  74. package/dist/lib/cubing/chunks/search-dynamic-sgs-skewb-FXGKV4KD.js +125 -0
  75. package/dist/lib/cubing/chunks/search-dynamic-sgs-skewb-FXGKV4KD.js.map +7 -0
  76. package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-YK6HA7BK.js +644 -0
  77. package/dist/lib/cubing/chunks/search-dynamic-sgs-unofficial-YK6HA7BK.js.map +7 -0
  78. package/dist/lib/cubing/chunks/search-dynamic-solve-3x3x3-DLMAGPXS.js +2549 -0
  79. package/dist/lib/cubing/chunks/search-dynamic-solve-3x3x3-DLMAGPXS.js.map +7 -0
  80. package/dist/lib/cubing/chunks/search-dynamic-solve-4x4x4-NONXQHOJ.js +2923 -0
  81. package/dist/lib/cubing/chunks/search-dynamic-solve-4x4x4-NONXQHOJ.js.map +7 -0
  82. package/dist/lib/cubing/chunks/search-dynamic-solve-fto-3GQ2HLSW.js +1405 -0
  83. package/dist/lib/cubing/chunks/search-dynamic-solve-fto-3GQ2HLSW.js.map +7 -0
  84. package/dist/lib/cubing/chunks/search-worker-entry.js +19 -0
  85. package/dist/lib/cubing/chunks/search-worker-entry.js.map +7 -0
  86. package/dist/lib/cubing/chunks/square1-stickerings-W2ZLZWIN.js +73 -0
  87. package/dist/lib/cubing/chunks/square1-stickerings-W2ZLZWIN.js.map +7 -0
  88. package/dist/lib/cubing/chunks/twips-2RNTWYNZ.js +433 -0
  89. package/dist/lib/cubing/chunks/twips-2RNTWYNZ.js.map +7 -0
  90. package/dist/lib/cubing/chunks/twips_wasm_bg-TJNYGA2C-23XTPLIK.js +10 -0
  91. package/dist/lib/cubing/chunks/twips_wasm_bg-TJNYGA2C-23XTPLIK.js.map +7 -0
  92. package/dist/lib/cubing/chunks/twisty-dynamic-3d-JO6OGKOF.js +2424 -0
  93. package/dist/lib/cubing/chunks/twisty-dynamic-3d-JO6OGKOF.js.map +7 -0
  94. package/dist/lib/cubing/index-BX6f56uo.d.ts +76 -0
  95. package/dist/lib/cubing/index-CcRu94bx.d.ts +2622 -0
  96. package/dist/lib/cubing/kpuzzle/index.d.ts +2 -0
  97. package/dist/lib/cubing/kpuzzle/index.js +12 -0
  98. package/dist/lib/cubing/kpuzzle/index.js.map +7 -0
  99. package/dist/lib/cubing/notation/index.d.ts +32 -0
  100. package/dist/lib/cubing/notation/index.js +20 -0
  101. package/dist/lib/cubing/notation/index.js.map +7 -0
  102. package/dist/lib/cubing/outside-BCzgSYQ_.d.ts +38 -0
  103. package/dist/lib/cubing/protocol/index.d.ts +28 -0
  104. package/dist/lib/cubing/protocol/index.js +20 -0
  105. package/dist/lib/cubing/protocol/index.js.map +7 -0
  106. package/dist/lib/cubing/puzzle-geometry/index.d.ts +2 -0
  107. package/dist/lib/cubing/puzzle-geometry/index.js +5024 -0
  108. package/dist/lib/cubing/puzzle-geometry/index.js.map +7 -0
  109. package/dist/lib/cubing/puzzles/index.d.ts +2 -0
  110. package/dist/lib/cubing/puzzles/index.js +23 -0
  111. package/dist/lib/cubing/puzzles/index.js.map +7 -0
  112. package/dist/lib/cubing/scramble/index.d.ts +2 -0
  113. package/dist/lib/cubing/scramble/index.js +16 -0
  114. package/dist/lib/cubing/scramble/index.js.map +7 -0
  115. package/dist/lib/cubing/search/index.d.ts +7 -0
  116. package/dist/lib/cubing/search/index.js +37 -0
  117. package/dist/lib/cubing/search/index.js.map +7 -0
  118. package/dist/lib/cubing/stream/index.d.ts +2 -0
  119. package/dist/lib/cubing/stream/index.js +111 -0
  120. package/dist/lib/cubing/stream/index.js.map +7 -0
  121. package/dist/lib/cubing/twisty/index.d.ts +2 -0
  122. package/dist/lib/cubing/twisty/index.js +6236 -0
  123. package/dist/lib/cubing/twisty/index.js.map +7 -0
  124. package/experimental-json-schema/kpuzzle/KPatternData.schema.json +34 -0
  125. package/experimental-json-schema/kpuzzle/KPuzzleDefinition.schema.json +97 -0
  126. package/experimental-json-schema/kpuzzle/KTransformationData.schema.json +27 -0
  127. package/kpuzzle/index.d.ts +1 -0
  128. package/notation/index.d.ts +1 -0
  129. package/package.json +146 -0
  130. package/protocol/index.d.ts +1 -0
  131. package/puzzle-geometry/index.d.ts +1 -0
  132. package/puzzles/index.d.ts +1 -0
  133. package/scramble/index.d.ts +1 -0
  134. package/search/index.d.ts +1 -0
  135. package/stream/index.d.ts +1 -0
  136. package/twisty/index.d.ts +1 -0
@@ -0,0 +1,1774 @@
1
+ import {
2
+ KPattern,
3
+ KPuzzle
4
+ } from "./chunk-52ZXJEUO.js";
5
+ import {
6
+ Alg,
7
+ Commutator,
8
+ Conjugate,
9
+ Move,
10
+ Pause,
11
+ QuantumMove,
12
+ TraversalDownUp,
13
+ functionFromTraversal
14
+ } from "./chunk-XPDJUSZ7.js";
15
+
16
+ // node_modules/.bun/@cubing+lazy-promise@0.1.1/node_modules/@cubing/lazy-promise/src/LazyPromise.ts
17
+ var LazyPromise = class {
18
+ #executor;
19
+ constructor(executor) {
20
+ this.#executor = executor;
21
+ }
22
+ #cached;
23
+ async #getCached() {
24
+ return this.#cached ??= Promise.resolve(this.#executor());
25
+ }
26
+ // Type signature from TypeScript
27
+ // biome-ignore lint/suspicious/noThenProperty: We're implementing the `Promise` API!
28
+ async then(onfulfilled, onrejected) {
29
+ return this.#getCached().then(onfulfilled, onrejected);
30
+ }
31
+ // Type signature from TypeScript
32
+ catch(onrejected) {
33
+ return this.#getCached().catch(onrejected);
34
+ }
35
+ // Type signature from TypeScript
36
+ async finally(onfinally) {
37
+ return this.#getCached().finally(onfinally);
38
+ }
39
+ get [Symbol.toStringTag]() {
40
+ return "LazyPromise";
41
+ }
42
+ };
43
+
44
+ // src/cubing/puzzles/stickerings/mask.ts
45
+ function getFaceletStickeringMask(stickeringMask, orbitName, pieceIdx, faceletIdx, hint) {
46
+ const orbitStickeringMask = stickeringMask.orbits[orbitName];
47
+ const pieceStickeringMask = orbitStickeringMask.pieces[pieceIdx];
48
+ if (pieceStickeringMask === null) {
49
+ return regular;
50
+ }
51
+ const faceletStickeringMask = pieceStickeringMask.facelets?.[faceletIdx];
52
+ if (faceletStickeringMask === null) {
53
+ return regular;
54
+ }
55
+ if (typeof faceletStickeringMask === "string") {
56
+ return faceletStickeringMask;
57
+ }
58
+ if (hint) {
59
+ return faceletStickeringMask.hintMask ?? faceletStickeringMask.mask;
60
+ }
61
+ console.log(faceletStickeringMask);
62
+ return faceletStickeringMask.mask;
63
+ }
64
+ var PieceAnnotation = class {
65
+ stickerings = /* @__PURE__ */ new Map();
66
+ constructor(kpuzzle, defaultValue) {
67
+ for (const orbitDefinition of kpuzzle.definition.orbits) {
68
+ this.stickerings.set(
69
+ orbitDefinition.orbitName,
70
+ new Array(orbitDefinition.numPieces).fill(defaultValue)
71
+ );
72
+ }
73
+ }
74
+ };
75
+ var regular = "regular";
76
+ var ignored = "ignored";
77
+ var oriented = "oriented";
78
+ var experimentalOriented2 = "experimentalOriented2";
79
+ var invisible = "invisible";
80
+ var dim = "dim";
81
+ var mystery = "mystery";
82
+ var pieceStickerings = {
83
+ // regular
84
+ ["Regular" /* Regular */]: {
85
+ // r
86
+ facelets: [regular, regular, regular, regular, regular]
87
+ },
88
+ // ignored
89
+ ["Ignored" /* Ignored */]: {
90
+ // i
91
+ facelets: [ignored, ignored, ignored, ignored, ignored]
92
+ },
93
+ // oriented stickers
94
+ ["OrientationStickers" /* OrientationStickers */]: {
95
+ // o
96
+ facelets: [oriented, oriented, oriented, oriented, oriented]
97
+ },
98
+ // "OLL"
99
+ ["IgnoreNonPrimary" /* IgnoreNonPrimary */]: {
100
+ // riiii
101
+ facelets: [regular, ignored, ignored, ignored, ignored]
102
+ },
103
+ // invisible
104
+ ["Invisible" /* Invisible */]: {
105
+ // invisiblePiece
106
+ facelets: [invisible, invisible, invisible, invisible, invisible]
107
+ },
108
+ // "PLL"
109
+ ["PermuteNonPrimary" /* PermuteNonPrimary */]: {
110
+ // drrrr
111
+ facelets: [dim, regular, regular, regular, regular]
112
+ },
113
+ // ignored
114
+ ["Dim" /* Dim */]: {
115
+ // d
116
+ facelets: [dim, dim, dim, dim, dim]
117
+ },
118
+ // "OLL"
119
+ ["Ignoriented" /* Ignoriented */]: {
120
+ // diiii
121
+ facelets: [dim, ignored, ignored, ignored, ignored]
122
+ },
123
+ ["OrientationWithoutPermutation" /* OrientationWithoutPermutation */]: {
124
+ // oiiii
125
+ facelets: [oriented, ignored, ignored, ignored, ignored]
126
+ },
127
+ ["ExperimentalOrientationWithoutPermutation2" /* ExperimentalOrientationWithoutPermutation2 */]: {
128
+ // oiiii
129
+ facelets: [experimentalOriented2, ignored, ignored, ignored, ignored]
130
+ },
131
+ ["Mystery" /* Mystery */]: {
132
+ // oiiii
133
+ facelets: [mystery, mystery, mystery, mystery, mystery]
134
+ }
135
+ };
136
+ function getPieceStickeringMask(pieceStickering) {
137
+ return pieceStickerings[pieceStickering];
138
+ }
139
+ var PuzzleStickering = class extends PieceAnnotation {
140
+ constructor(kpuzzle) {
141
+ super(kpuzzle, "Regular" /* Regular */);
142
+ }
143
+ set(pieceSet, pieceStickering) {
144
+ for (const [orbitName, pieces] of this.stickerings.entries()) {
145
+ for (let i = 0; i < pieces.length; i++) {
146
+ if (pieceSet.stickerings.get(orbitName)[i]) {
147
+ pieces[i] = pieceStickering;
148
+ }
149
+ }
150
+ }
151
+ return this;
152
+ }
153
+ toStickeringMask() {
154
+ const stickeringMask = { orbits: {} };
155
+ for (const [orbitName, pieceStickerings2] of this.stickerings.entries()) {
156
+ const pieces = [];
157
+ const orbitStickeringMask = {
158
+ pieces
159
+ };
160
+ stickeringMask.orbits[orbitName] = orbitStickeringMask;
161
+ for (const pieceStickering of pieceStickerings2) {
162
+ pieces.push(getPieceStickeringMask(pieceStickering));
163
+ }
164
+ }
165
+ return stickeringMask;
166
+ }
167
+ };
168
+ var StickeringManager = class {
169
+ constructor(kpuzzle) {
170
+ this.kpuzzle = kpuzzle;
171
+ }
172
+ kpuzzle;
173
+ and(pieceSets) {
174
+ const newPieceSet = new PieceAnnotation(this.kpuzzle, false);
175
+ for (const orbitDefinition of this.kpuzzle.definition.orbits) {
176
+ pieceLoop: for (let i = 0; i < orbitDefinition.numPieces; i++) {
177
+ newPieceSet.stickerings.get(orbitDefinition.orbitName)[i] = true;
178
+ for (const pieceSet of pieceSets) {
179
+ if (!pieceSet.stickerings.get(orbitDefinition.orbitName)[i]) {
180
+ newPieceSet.stickerings.get(orbitDefinition.orbitName)[i] = false;
181
+ continue pieceLoop;
182
+ }
183
+ }
184
+ }
185
+ }
186
+ return newPieceSet;
187
+ }
188
+ or(pieceSets) {
189
+ const newPieceSet = new PieceAnnotation(this.kpuzzle, false);
190
+ for (const orbitDefinition of this.kpuzzle.definition.orbits) {
191
+ pieceLoop: for (let i = 0; i < orbitDefinition.numPieces; i++) {
192
+ newPieceSet.stickerings.get(orbitDefinition.orbitName)[i] = false;
193
+ for (const pieceSet of pieceSets) {
194
+ if (pieceSet.stickerings.get(orbitDefinition.orbitName)[i]) {
195
+ newPieceSet.stickerings.get(orbitDefinition.orbitName)[i] = true;
196
+ continue pieceLoop;
197
+ }
198
+ }
199
+ }
200
+ }
201
+ return newPieceSet;
202
+ }
203
+ not(pieceSet) {
204
+ const newPieceSet = new PieceAnnotation(this.kpuzzle, false);
205
+ for (const orbitDefinition of this.kpuzzle.definition.orbits) {
206
+ for (let i = 0; i < orbitDefinition.numPieces; i++) {
207
+ newPieceSet.stickerings.get(orbitDefinition.orbitName)[i] = !pieceSet.stickerings.get(orbitDefinition.orbitName)[i];
208
+ }
209
+ }
210
+ return newPieceSet;
211
+ }
212
+ all() {
213
+ return this.and(this.moves([]));
214
+ }
215
+ move(moveSource) {
216
+ const transformation = this.kpuzzle.moveToTransformation(moveSource);
217
+ const newPieceSet = new PieceAnnotation(this.kpuzzle, false);
218
+ for (const orbitDefinition of this.kpuzzle.definition.orbits) {
219
+ for (let i = 0; i < orbitDefinition.numPieces; i++) {
220
+ if (transformation.transformationData[orbitDefinition.orbitName].permutation[i] !== i || transformation.transformationData[orbitDefinition.orbitName].orientationDelta[i] !== 0) {
221
+ newPieceSet.stickerings.get(orbitDefinition.orbitName)[i] = true;
222
+ }
223
+ }
224
+ }
225
+ return newPieceSet;
226
+ }
227
+ moves(moveSources) {
228
+ return moveSources.map((moveSource) => this.move(moveSource));
229
+ }
230
+ orbits(orbitNames) {
231
+ const pieceSet = new PieceAnnotation(this.kpuzzle, false);
232
+ for (const orbitName of orbitNames) {
233
+ pieceSet.stickerings.get(orbitName).fill(true);
234
+ }
235
+ return pieceSet;
236
+ }
237
+ orbitPrefix(orbitPrefix) {
238
+ const pieceSet = new PieceAnnotation(this.kpuzzle, false);
239
+ for (const orbitDefinition of this.kpuzzle.definition.orbits) {
240
+ if (orbitDefinition.orbitName.startsWith(orbitPrefix)) {
241
+ pieceSet.stickerings.get(orbitDefinition.orbitName).fill(true);
242
+ }
243
+ }
244
+ return pieceSet;
245
+ }
246
+ // trueCounts(pieceSet: PieceSet): Record<string, number> {
247
+ // const counts: Record<string, number> = {};
248
+ // for (const orbitDefinition of this.def.orbits) {
249
+ // let count = 0;
250
+ // for (let i = 0; i < orbitDefinition.numPieces; i++) {
251
+ // if (pieceSet.stickerings.get(orbitDefinition.orbitName)![i]) {
252
+ // count++;
253
+ // }
254
+ // }
255
+ // counts[orbitName] = count;
256
+ // }
257
+ // return counts;
258
+ // }
259
+ };
260
+
261
+ // src/cubing/puzzles/stickerings/puzzle-stickerings.ts
262
+ var LL = "Last Layer";
263
+ var LS = "Last Slot";
264
+ var megaAnd3x3x3LL = {
265
+ "3x3x3": LL,
266
+ megaminx: LL
267
+ };
268
+ var megaAnd3x3x3AndSquare1LL = {
269
+ ...megaAnd3x3x3LL,
270
+ square1: LL
271
+ };
272
+ var megaAnd3x3x3LS = {
273
+ "3x3x3": LS,
274
+ megaminx: LS
275
+ };
276
+ var experimentalStickerings = {
277
+ full: {
278
+ groups: {
279
+ "3x3x3": "Stickering",
280
+ megaminx: "Stickering",
281
+ square1: "Stickering"
282
+ }
283
+ },
284
+ // default
285
+ OLL: { groups: megaAnd3x3x3AndSquare1LL },
286
+ PLL: { groups: megaAnd3x3x3AndSquare1LL },
287
+ LL: { groups: megaAnd3x3x3LL },
288
+ EOLL: { groups: megaAnd3x3x3LL },
289
+ COLL: { groups: megaAnd3x3x3LL },
290
+ OCLL: { groups: megaAnd3x3x3LL },
291
+ CPLL: { groups: megaAnd3x3x3LL },
292
+ CLL: { groups: megaAnd3x3x3LL },
293
+ EPLL: { groups: megaAnd3x3x3LL },
294
+ ELL: { groups: megaAnd3x3x3LL },
295
+ ZBLL: { groups: megaAnd3x3x3LL },
296
+ LS: { groups: megaAnd3x3x3LS },
297
+ LSOLL: { groups: megaAnd3x3x3LS },
298
+ LSOCLL: { groups: megaAnd3x3x3LS },
299
+ ELS: { groups: megaAnd3x3x3LS },
300
+ CLS: { groups: megaAnd3x3x3LS },
301
+ ZBLS: { groups: megaAnd3x3x3LS },
302
+ VLS: { groups: megaAnd3x3x3LS },
303
+ WVLS: { groups: megaAnd3x3x3LS },
304
+ F2L: { groups: { "3x3x3": "CFOP (Fridrich)" } },
305
+ Daisy: { groups: { "3x3x3": "CFOP (Fridrich)" } },
306
+ Cross: { groups: { "3x3x3": "CFOP (Fridrich)" } },
307
+ EO: { groups: { "3x3x3": "ZZ" } },
308
+ EOline: { groups: { "3x3x3": "ZZ" } },
309
+ EOcross: { groups: { "3x3x3": "ZZ" } },
310
+ FirstBlock: { groups: { "3x3x3": "Roux" } },
311
+ SecondBlock: { groups: { "3x3x3": "Roux" } },
312
+ CMLL: { groups: { "3x3x3": "Roux" } },
313
+ L10P: { groups: { "3x3x3": "Roux" } },
314
+ L6E: { groups: { "3x3x3": "Roux" } },
315
+ L6EO: { groups: { "3x3x3": "Roux" } },
316
+ "2x2x2": { groups: { "3x3x3": "Petrus" } },
317
+ "2x2x3": { groups: { "3x3x3": "Petrus" } },
318
+ EODF: { groups: { "3x3x3": "Nautilus" } },
319
+ G1: { groups: { "3x3x3": "FMC" } },
320
+ L2C: {
321
+ groups: {
322
+ "4x4x4": "Reduction",
323
+ "5x5x5": "Reduction",
324
+ "6x6x6": "Reduction"
325
+ }
326
+ },
327
+ L2E: {
328
+ groups: {
329
+ "4x4x4": "Reduction",
330
+ "5x5x5": "Reduction",
331
+ "6x6x6": "Reduction"
332
+ }
333
+ },
334
+ OBL: { groups: { "2x2x2": "General" } },
335
+ PBL: {
336
+ groups: {
337
+ "2x2x2": "Ortega"
338
+ }
339
+ },
340
+ "Void Cube": { groups: { "3x3x3": "Miscellaneous" } },
341
+ invisible: { groups: { "3x3x3": "Miscellaneous" } },
342
+ picture: { groups: { "3x3x3": "Miscellaneous" } },
343
+ "centers-only": { groups: { "3x3x3": "Miscellaneous" } },
344
+ // TODO
345
+ "opposite-centers": { groups: { "4x4x4": "Reduction" } },
346
+ // TODO
347
+ "experimental-centers-U": {},
348
+ "experimental-centers-U-D": {},
349
+ "experimental-centers-U-L-D": {},
350
+ "experimental-centers-U-L-B-D": {},
351
+ "experimental-centers": {},
352
+ "experimental-fto-fc": { groups: { fto: "Bencisco" } },
353
+ "experimental-fto-f2t": { groups: { fto: "Bencisco" } },
354
+ "experimental-fto-sc": { groups: { fto: "Bencisco" } },
355
+ "experimental-fto-l2c": { groups: { fto: "Bencisco" } },
356
+ "experimental-fto-lbt": { groups: { fto: "Bencisco" } },
357
+ "experimental-fto-l3t": { groups: { fto: "Bencisco" } }
358
+ };
359
+
360
+ // src/cubing/puzzles/stickerings/cube-like-stickerings.ts
361
+ async function cubeLikeStickeringMask(puzzleLoader, stickering) {
362
+ return (await cubeLikePuzzleStickering(puzzleLoader, stickering)).toStickeringMask();
363
+ }
364
+ async function cubeLikePuzzleStickering(puzzleLoader, stickering) {
365
+ const kpuzzle = await puzzleLoader.kpuzzle();
366
+ const puzzleStickering = new PuzzleStickering(kpuzzle);
367
+ const m = new StickeringManager(kpuzzle);
368
+ const LL2 = () => m.move("U");
369
+ const orUD = () => m.or(m.moves(["U", "D"]));
370
+ const orLR = () => m.or(m.moves(["L", "R"]));
371
+ const M = () => m.not(orLR());
372
+ const F2L = () => m.not(LL2());
373
+ const CENTERS = () => m.orbitPrefix("CENTER");
374
+ const CENTER = (faceMove) => m.and([m.move(faceMove), CENTERS()]);
375
+ const EDGES = () => m.orbitPrefix("EDGE");
376
+ const EDGE = (faceMoves) => m.and([m.and(m.moves(faceMoves)), EDGES()]);
377
+ const CORNERS = () => m.or([
378
+ m.orbitPrefix("CORNER"),
379
+ m.orbitPrefix("C4RNER"),
380
+ m.orbitPrefix("C5RNER")
381
+ ]);
382
+ const L6E = () => m.or([M(), m.and([LL2(), EDGES()])]);
383
+ const centerLL = () => m.and([LL2(), CENTERS()]);
384
+ const edgeFR = () => m.and([m.and(m.moves(["F", "R"])), EDGES()]);
385
+ const cornerDFR = () => m.and([m.and(m.moves(["F", "R"])), CORNERS(), m.not(LL2())]);
386
+ const slotFR = () => m.or([cornerDFR(), edgeFR()]);
387
+ function dimF2L() {
388
+ puzzleStickering.set(F2L(), "Dim" /* Dim */);
389
+ }
390
+ function setPLL() {
391
+ puzzleStickering.set(LL2(), "PermuteNonPrimary" /* PermuteNonPrimary */);
392
+ puzzleStickering.set(centerLL(), "Dim" /* Dim */);
393
+ }
394
+ function setOLL() {
395
+ puzzleStickering.set(LL2(), "IgnoreNonPrimary" /* IgnoreNonPrimary */);
396
+ puzzleStickering.set(centerLL(), "Regular" /* Regular */);
397
+ }
398
+ function dimOLL() {
399
+ puzzleStickering.set(LL2(), "Ignoriented" /* Ignoriented */);
400
+ puzzleStickering.set(centerLL(), "Dim" /* Dim */);
401
+ }
402
+ switch (stickering) {
403
+ case "full":
404
+ break;
405
+ case "PLL": {
406
+ dimF2L();
407
+ setPLL();
408
+ break;
409
+ }
410
+ case "CLS": {
411
+ dimF2L();
412
+ puzzleStickering.set(cornerDFR(), "Regular" /* Regular */);
413
+ puzzleStickering.set(LL2(), "Ignoriented" /* Ignoriented */);
414
+ puzzleStickering.set(m.and([LL2(), CENTERS()]), "Dim" /* Dim */);
415
+ puzzleStickering.set(
416
+ m.and([LL2(), CORNERS()]),
417
+ "IgnoreNonPrimary" /* IgnoreNonPrimary */
418
+ );
419
+ break;
420
+ }
421
+ case "OLL": {
422
+ dimF2L();
423
+ setOLL();
424
+ break;
425
+ }
426
+ case "EOLL": {
427
+ dimF2L();
428
+ setOLL();
429
+ puzzleStickering.set(m.and([LL2(), CORNERS()]), "Ignored" /* Ignored */);
430
+ break;
431
+ }
432
+ case "COLL": {
433
+ dimF2L();
434
+ puzzleStickering.set(m.and([LL2(), EDGES()]), "Ignoriented" /* Ignoriented */);
435
+ puzzleStickering.set(m.and([LL2(), CENTERS()]), "Dim" /* Dim */);
436
+ puzzleStickering.set(m.and([LL2(), CORNERS()]), "Regular" /* Regular */);
437
+ break;
438
+ }
439
+ case "OCLL": {
440
+ dimF2L();
441
+ dimOLL();
442
+ puzzleStickering.set(
443
+ m.and([LL2(), CORNERS()]),
444
+ "IgnoreNonPrimary" /* IgnoreNonPrimary */
445
+ );
446
+ break;
447
+ }
448
+ case "CPLL": {
449
+ dimF2L();
450
+ puzzleStickering.set(
451
+ m.and([CORNERS(), LL2()]),
452
+ "PermuteNonPrimary" /* PermuteNonPrimary */
453
+ );
454
+ puzzleStickering.set(
455
+ m.and([m.not(CORNERS()), LL2()]),
456
+ "Dim" /* Dim */
457
+ );
458
+ break;
459
+ }
460
+ case "CLL": {
461
+ dimF2L();
462
+ puzzleStickering.set(
463
+ m.not(m.and([CORNERS(), LL2()])),
464
+ "Dim" /* Dim */
465
+ );
466
+ break;
467
+ }
468
+ case "EPLL": {
469
+ dimF2L();
470
+ puzzleStickering.set(LL2(), "Dim" /* Dim */);
471
+ puzzleStickering.set(
472
+ m.and([LL2(), EDGES()]),
473
+ "PermuteNonPrimary" /* PermuteNonPrimary */
474
+ );
475
+ break;
476
+ }
477
+ case "ELL": {
478
+ dimF2L();
479
+ puzzleStickering.set(LL2(), "Dim" /* Dim */);
480
+ puzzleStickering.set(m.and([LL2(), EDGES()]), "Regular" /* Regular */);
481
+ break;
482
+ }
483
+ case "ELS": {
484
+ dimF2L();
485
+ setOLL();
486
+ puzzleStickering.set(m.and([LL2(), CORNERS()]), "Ignored" /* Ignored */);
487
+ puzzleStickering.set(edgeFR(), "Regular" /* Regular */);
488
+ puzzleStickering.set(cornerDFR(), "Ignored" /* Ignored */);
489
+ break;
490
+ }
491
+ case "LL": {
492
+ dimF2L();
493
+ break;
494
+ }
495
+ case "F2L": {
496
+ puzzleStickering.set(LL2(), "Ignored" /* Ignored */);
497
+ break;
498
+ }
499
+ case "ZBLL": {
500
+ dimF2L();
501
+ puzzleStickering.set(LL2(), "PermuteNonPrimary" /* PermuteNonPrimary */);
502
+ puzzleStickering.set(centerLL(), "Dim" /* Dim */);
503
+ puzzleStickering.set(m.and([LL2(), CORNERS()]), "Regular" /* Regular */);
504
+ break;
505
+ }
506
+ case "ZBLS": {
507
+ dimF2L();
508
+ puzzleStickering.set(slotFR(), "Regular" /* Regular */);
509
+ setOLL();
510
+ puzzleStickering.set(m.and([LL2(), CORNERS()]), "Ignored" /* Ignored */);
511
+ break;
512
+ }
513
+ case "VLS": {
514
+ dimF2L();
515
+ puzzleStickering.set(slotFR(), "Regular" /* Regular */);
516
+ setOLL();
517
+ break;
518
+ }
519
+ case "WVLS": {
520
+ dimF2L();
521
+ puzzleStickering.set(slotFR(), "Regular" /* Regular */);
522
+ puzzleStickering.set(m.and([LL2(), EDGES()]), "Ignoriented" /* Ignoriented */);
523
+ puzzleStickering.set(m.and([LL2(), CENTERS()]), "Dim" /* Dim */);
524
+ puzzleStickering.set(
525
+ m.and([LL2(), CORNERS()]),
526
+ "IgnoreNonPrimary" /* IgnoreNonPrimary */
527
+ );
528
+ break;
529
+ }
530
+ case "LS": {
531
+ dimF2L();
532
+ puzzleStickering.set(slotFR(), "Regular" /* Regular */);
533
+ puzzleStickering.set(LL2(), "Ignored" /* Ignored */);
534
+ puzzleStickering.set(centerLL(), "Dim" /* Dim */);
535
+ break;
536
+ }
537
+ case "LSOLL": {
538
+ dimF2L();
539
+ setOLL();
540
+ puzzleStickering.set(slotFR(), "Regular" /* Regular */);
541
+ break;
542
+ }
543
+ case "LSOCLL": {
544
+ dimF2L();
545
+ dimOLL();
546
+ puzzleStickering.set(
547
+ m.and([LL2(), CORNERS()]),
548
+ "IgnoreNonPrimary" /* IgnoreNonPrimary */
549
+ );
550
+ puzzleStickering.set(slotFR(), "Regular" /* Regular */);
551
+ break;
552
+ }
553
+ case "EO": {
554
+ puzzleStickering.set(CORNERS(), "Ignored" /* Ignored */);
555
+ puzzleStickering.set(
556
+ EDGES(),
557
+ "OrientationWithoutPermutation" /* OrientationWithoutPermutation */
558
+ );
559
+ break;
560
+ }
561
+ case "EOline": {
562
+ puzzleStickering.set(CORNERS(), "Ignored" /* Ignored */);
563
+ puzzleStickering.set(
564
+ EDGES(),
565
+ "OrientationWithoutPermutation" /* OrientationWithoutPermutation */
566
+ );
567
+ puzzleStickering.set(m.and(m.moves(["D", "M"])), "Regular" /* Regular */);
568
+ break;
569
+ }
570
+ case "EOcross": {
571
+ puzzleStickering.set(
572
+ EDGES(),
573
+ "OrientationWithoutPermutation" /* OrientationWithoutPermutation */
574
+ );
575
+ puzzleStickering.set(m.move("D"), "Regular" /* Regular */);
576
+ puzzleStickering.set(CORNERS(), "Ignored" /* Ignored */);
577
+ break;
578
+ }
579
+ case "CMLL": {
580
+ puzzleStickering.set(F2L(), "Dim" /* Dim */);
581
+ puzzleStickering.set(L6E(), "Ignored" /* Ignored */);
582
+ puzzleStickering.set(m.and([LL2(), CORNERS()]), "Regular" /* Regular */);
583
+ break;
584
+ }
585
+ case "L10P": {
586
+ puzzleStickering.set(m.not(L6E()), "Dim" /* Dim */);
587
+ puzzleStickering.set(m.and([CORNERS(), LL2()]), "Regular" /* Regular */);
588
+ break;
589
+ }
590
+ case "L6E": {
591
+ puzzleStickering.set(m.not(L6E()), "Dim" /* Dim */);
592
+ break;
593
+ }
594
+ case "L6EO": {
595
+ puzzleStickering.set(m.not(L6E()), "Dim" /* Dim */);
596
+ puzzleStickering.set(
597
+ L6E(),
598
+ "ExperimentalOrientationWithoutPermutation2" /* ExperimentalOrientationWithoutPermutation2 */
599
+ );
600
+ puzzleStickering.set(
601
+ m.and([CENTERS(), orUD()]),
602
+ "ExperimentalOrientationWithoutPermutation2" /* ExperimentalOrientationWithoutPermutation2 */
603
+ );
604
+ puzzleStickering.set(
605
+ m.and([m.move("M"), m.move("E")]),
606
+ "Ignored" /* Ignored */
607
+ );
608
+ break;
609
+ }
610
+ case "Daisy": {
611
+ puzzleStickering.set(m.all(), "Ignored" /* Ignored */);
612
+ puzzleStickering.set(CENTERS(), "Dim" /* Dim */);
613
+ puzzleStickering.set(
614
+ m.and([m.move("D"), CENTERS()]),
615
+ "Regular" /* Regular */
616
+ );
617
+ puzzleStickering.set(
618
+ m.and([m.move("U"), EDGES()]),
619
+ "IgnoreNonPrimary" /* IgnoreNonPrimary */
620
+ );
621
+ break;
622
+ }
623
+ case "Cross": {
624
+ puzzleStickering.set(m.all(), "Ignored" /* Ignored */);
625
+ puzzleStickering.set(CENTERS(), "Dim" /* Dim */);
626
+ puzzleStickering.set(
627
+ m.and([m.move("D"), CENTERS()]),
628
+ "Regular" /* Regular */
629
+ );
630
+ puzzleStickering.set(
631
+ m.and([m.move("D"), EDGES()]),
632
+ "Regular" /* Regular */
633
+ );
634
+ break;
635
+ }
636
+ case "2x2x2": {
637
+ puzzleStickering.set(
638
+ m.or(m.moves(["U", "F", "R"])),
639
+ "Ignored" /* Ignored */
640
+ );
641
+ puzzleStickering.set(
642
+ m.and([m.or(m.moves(["U", "F", "R"])), CENTERS()]),
643
+ "Dim" /* Dim */
644
+ );
645
+ break;
646
+ }
647
+ case "2x2x3": {
648
+ puzzleStickering.set(m.all(), "Dim" /* Dim */);
649
+ puzzleStickering.set(
650
+ m.or(m.moves(["U", "F", "R"])),
651
+ "Ignored" /* Ignored */
652
+ );
653
+ puzzleStickering.set(
654
+ m.and([m.or(m.moves(["U", "F", "R"])), CENTERS()]),
655
+ "Dim" /* Dim */
656
+ );
657
+ puzzleStickering.set(
658
+ m.and([m.move("F"), m.not(m.or(m.moves(["U", "R"])))]),
659
+ "Regular" /* Regular */
660
+ );
661
+ break;
662
+ }
663
+ case "G1": {
664
+ puzzleStickering.set(
665
+ m.all(),
666
+ "ExperimentalOrientationWithoutPermutation2" /* ExperimentalOrientationWithoutPermutation2 */
667
+ );
668
+ puzzleStickering.set(
669
+ m.or(m.moves(["E"])),
670
+ "OrientationWithoutPermutation" /* OrientationWithoutPermutation */
671
+ );
672
+ puzzleStickering.set(m.and(m.moves(["E", "S"])), "Ignored" /* Ignored */);
673
+ break;
674
+ }
675
+ case "L2C": {
676
+ puzzleStickering.set(
677
+ m.or(m.moves(["L", "R", "B", "D"])),
678
+ "Dim" /* Dim */
679
+ );
680
+ puzzleStickering.set(m.not(CENTERS()), "Ignored" /* Ignored */);
681
+ break;
682
+ }
683
+ case "L2E": {
684
+ puzzleStickering.set(m.all(), "Ignored" /* Ignored */);
685
+ puzzleStickering.set(
686
+ m.or([EDGE(["U", "F"]), EDGE(["U", "B"])]),
687
+ "Regular" /* Regular */
688
+ );
689
+ break;
690
+ }
691
+ case "PBL": {
692
+ puzzleStickering.set(m.all(), "Ignored" /* Ignored */);
693
+ puzzleStickering.set(
694
+ m.or(m.moves(["U", "D"])),
695
+ "PermuteNonPrimary" /* PermuteNonPrimary */
696
+ );
697
+ break;
698
+ }
699
+ case "FirstBlock": {
700
+ puzzleStickering.set(
701
+ m.not(m.and([m.and(m.moves(["L"])), m.not(LL2())])),
702
+ "Ignored" /* Ignored */
703
+ );
704
+ puzzleStickering.set(CENTER("R"), "Dim" /* Dim */);
705
+ break;
706
+ }
707
+ case "SecondBlock": {
708
+ puzzleStickering.set(
709
+ m.not(m.and([m.and(m.moves(["L"])), m.not(LL2())])),
710
+ "Ignored" /* Ignored */
711
+ );
712
+ puzzleStickering.set(
713
+ m.and([m.and(m.moves(["L"])), m.not(LL2())]),
714
+ "Dim" /* Dim */
715
+ );
716
+ puzzleStickering.set(
717
+ m.and([m.and(m.moves(["R"])), m.not(LL2())]),
718
+ "Regular" /* Regular */
719
+ );
720
+ break;
721
+ }
722
+ case "EODF": {
723
+ dimF2L();
724
+ puzzleStickering.set(
725
+ m.or([cornerDFR(), m.and([LL2(), CORNERS()])]),
726
+ "Ignored" /* Ignored */
727
+ );
728
+ puzzleStickering.set(
729
+ m.or([m.and([LL2(), EDGES()]), edgeFR()]),
730
+ "OrientationWithoutPermutation" /* OrientationWithoutPermutation */
731
+ );
732
+ puzzleStickering.set(EDGE(["D", "F"]), "Regular" /* Regular */);
733
+ puzzleStickering.set(CENTER("F"), "Regular" /* Regular */);
734
+ break;
735
+ }
736
+ case "Void Cube": {
737
+ puzzleStickering.set(CENTERS(), "Invisible" /* Invisible */);
738
+ break;
739
+ }
740
+ case "picture":
741
+ // fallthrough
742
+ case "invisible": {
743
+ puzzleStickering.set(m.all(), "Invisible" /* Invisible */);
744
+ break;
745
+ }
746
+ case "centers-only": {
747
+ puzzleStickering.set(m.not(CENTERS()), "Ignored" /* Ignored */);
748
+ break;
749
+ }
750
+ case "opposite-centers": {
751
+ puzzleStickering.set(
752
+ m.not(m.and([CENTERS(), m.or(m.moves(["U", "D"]))])),
753
+ "Ignored" /* Ignored */
754
+ );
755
+ break;
756
+ }
757
+ case "OBL": {
758
+ puzzleStickering.set(
759
+ m.or(m.moves(["U", "D"])),
760
+ "IgnoreNonPrimary" /* IgnoreNonPrimary */
761
+ );
762
+ break;
763
+ }
764
+ default:
765
+ console.warn(
766
+ `Unsupported stickering for ${puzzleLoader.id}: ${stickering}. Setting all pieces to dim.`
767
+ );
768
+ puzzleStickering.set(m.and(m.moves([])), "Dim" /* Dim */);
769
+ }
770
+ return puzzleStickering;
771
+ }
772
+ async function cubeLikeStickeringList(puzzleID, options) {
773
+ const stickerings = [];
774
+ const stickeringsFallback = [];
775
+ for (const [name, info] of Object.entries(experimentalStickerings)) {
776
+ if (info.groups) {
777
+ if (puzzleID in info.groups) {
778
+ stickerings.push(name);
779
+ } else if (options?.use3x3x3Fallbacks && "3x3x3" in info.groups) {
780
+ stickeringsFallback.push(name);
781
+ }
782
+ }
783
+ }
784
+ return stickerings.concat(stickeringsFallback);
785
+ }
786
+
787
+ // src/cubing/puzzles/async/lazy-cached.ts
788
+ function getCached(getValue) {
789
+ const lazyPromise = new LazyPromise(getValue);
790
+ return () => lazyPromise;
791
+ }
792
+
793
+ // src/cubing/puzzles/async/async-pg3d.ts
794
+ async function asyncGetPuzzleGeometry(puzzleName) {
795
+ const puzzleGeometry = await import("../puzzle-geometry/index.js");
796
+ return puzzleGeometry.getPuzzleGeometryByName(puzzleName, {
797
+ allMoves: true,
798
+ orientCenters: true,
799
+ addRotations: true
800
+ });
801
+ }
802
+ async function asyncGetBasePuzzleGeometry(puzzleName) {
803
+ const puzzleGeometry = await import("../puzzle-geometry/index.js");
804
+ return puzzleGeometry.getPuzzleGeometryByName(puzzleName);
805
+ }
806
+ async function asyncGetKPuzzle(pgPromise, puzzleName, setOrientationModTo1ForPiecesOfOrbits) {
807
+ const pg = await pgPromise;
808
+ const kpuzzleDefinition = pg.getKPuzzleDefinition(true);
809
+ kpuzzleDefinition.name = puzzleName;
810
+ const puzzleGeometry = await import("../puzzle-geometry/index.js");
811
+ const pgNotation = new puzzleGeometry.ExperimentalPGNotation(
812
+ pg,
813
+ pg.getOrbitsDef(true)
814
+ );
815
+ if (setOrientationModTo1ForPiecesOfOrbits) {
816
+ const setOrientationModTo1ForPiecesOfOrbitsSet = new Set(
817
+ setOrientationModTo1ForPiecesOfOrbits
818
+ );
819
+ for (const [orbitName, orbitData] of Object.entries(
820
+ kpuzzleDefinition.defaultPattern
821
+ )) {
822
+ if (setOrientationModTo1ForPiecesOfOrbitsSet.has(orbitName)) {
823
+ orbitData.orientationMod = new Array(
824
+ orbitData.pieces.length
825
+ // TODO: get this from the orbit definition, especially once we allow empty entries.
826
+ ).fill(1);
827
+ }
828
+ }
829
+ }
830
+ return new KPuzzle(pgNotation.remapKPuzzleDefinition(kpuzzleDefinition), {
831
+ experimentalPGNotation: pgNotation
832
+ });
833
+ }
834
+ var PGPuzzleLoader = class {
835
+ pgId;
836
+ id;
837
+ fullName;
838
+ inventedBy;
839
+ inventionYear;
840
+ #setOrientationModTo1ForPiecesOfOrbits;
841
+ // // TODO: make this unhacky
842
+ constructor(info) {
843
+ this.pgId = info.pgID;
844
+ this.id = info.id;
845
+ this.fullName = info.fullName;
846
+ this.inventedBy = info.inventedBy;
847
+ this.inventionYear = info.inventionYear;
848
+ this.#setOrientationModTo1ForPiecesOfOrbits = info.setOrientationModTo1ForPiecesOfOrbits;
849
+ }
850
+ #cachedPG;
851
+ pg() {
852
+ return this.#cachedPG ??= asyncGetPuzzleGeometry(this.pgId ?? this.id);
853
+ }
854
+ #cachedBasePG;
855
+ basePG() {
856
+ return this.#cachedBasePG ??= asyncGetBasePuzzleGeometry(
857
+ this.pgId ?? this.id
858
+ );
859
+ }
860
+ #cachedKPuzzle;
861
+ kpuzzle() {
862
+ return this.#cachedKPuzzle ??= asyncGetKPuzzle(
863
+ this.pg(),
864
+ this.id,
865
+ this.#setOrientationModTo1ForPiecesOfOrbits
866
+ );
867
+ }
868
+ #cachedSVG;
869
+ svg() {
870
+ return this.#cachedSVG ??= (async () => (await this.pg()).generatesvg())();
871
+ }
872
+ puzzleSpecificSimplifyOptionsPromise = puzzleSpecificSimplifyOptionsPromise(
873
+ this.kpuzzle.bind(this)
874
+ );
875
+ };
876
+ var CubePGPuzzleLoader = class extends PGPuzzleLoader {
877
+ stickeringMask(stickering) {
878
+ return cubeLikeStickeringMask(this, stickering);
879
+ }
880
+ stickerings = () => cubeLikeStickeringList(this.id, { use3x3x3Fallbacks: true });
881
+ algTransformData = cubeMirrorTransforms;
882
+ };
883
+ function puzzleSpecificSimplifyOptionsPromise(kpuzzlePromiseFn) {
884
+ return new LazyPromise(async () => {
885
+ const kpuzzle = await kpuzzlePromiseFn();
886
+ return {
887
+ quantumMoveOrder: (m) => {
888
+ return kpuzzle.moveToTransformation(new Move(m)).repetitionOrder();
889
+ }
890
+ };
891
+ });
892
+ }
893
+
894
+ // src/cubing/puzzles/implementations/dynamic/3x3x3/3x3x3.kpuzzle.json.ts
895
+ var cube3x3x3KPuzzleDefinition = {
896
+ name: "3x3x3",
897
+ orbits: [
898
+ { orbitName: "EDGES", numPieces: 12, numOrientations: 2 },
899
+ { orbitName: "CORNERS", numPieces: 8, numOrientations: 3 },
900
+ { orbitName: "CENTERS", numPieces: 6, numOrientations: 4 }
901
+ ],
902
+ defaultPattern: {
903
+ EDGES: {
904
+ pieces: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
905
+ orientation: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
906
+ },
907
+ CORNERS: {
908
+ pieces: [0, 1, 2, 3, 4, 5, 6, 7],
909
+ orientation: [0, 0, 0, 0, 0, 0, 0, 0]
910
+ },
911
+ CENTERS: {
912
+ pieces: [0, 1, 2, 3, 4, 5],
913
+ orientation: [0, 0, 0, 0, 0, 0],
914
+ orientationMod: [1, 1, 1, 1, 1, 1]
915
+ }
916
+ },
917
+ moves: {
918
+ U: {
919
+ EDGES: {
920
+ permutation: [1, 2, 3, 0, 4, 5, 6, 7, 8, 9, 10, 11],
921
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
922
+ },
923
+ CORNERS: {
924
+ permutation: [1, 2, 3, 0, 4, 5, 6, 7],
925
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0]
926
+ },
927
+ CENTERS: {
928
+ permutation: [0, 1, 2, 3, 4, 5],
929
+ orientationDelta: [1, 0, 0, 0, 0, 0]
930
+ }
931
+ },
932
+ y: {
933
+ EDGES: {
934
+ permutation: [1, 2, 3, 0, 5, 6, 7, 4, 10, 8, 11, 9],
935
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]
936
+ },
937
+ CORNERS: {
938
+ permutation: [1, 2, 3, 0, 7, 4, 5, 6],
939
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0]
940
+ },
941
+ CENTERS: {
942
+ permutation: [0, 2, 3, 4, 1, 5],
943
+ orientationDelta: [1, 0, 0, 0, 0, 3]
944
+ }
945
+ },
946
+ x: {
947
+ EDGES: {
948
+ permutation: [4, 8, 0, 9, 6, 10, 2, 11, 5, 7, 1, 3],
949
+ orientationDelta: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]
950
+ },
951
+ CORNERS: {
952
+ permutation: [4, 0, 3, 5, 7, 6, 2, 1],
953
+ orientationDelta: [2, 1, 2, 1, 1, 2, 1, 2]
954
+ },
955
+ CENTERS: {
956
+ permutation: [2, 1, 5, 3, 0, 4],
957
+ orientationDelta: [0, 3, 0, 1, 2, 2]
958
+ }
959
+ },
960
+ L: {
961
+ EDGES: {
962
+ permutation: [0, 1, 2, 11, 4, 5, 6, 9, 8, 3, 10, 7],
963
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
964
+ },
965
+ CORNERS: {
966
+ permutation: [0, 1, 6, 2, 4, 3, 5, 7],
967
+ orientationDelta: [0, 0, 2, 1, 0, 2, 1, 0]
968
+ },
969
+ CENTERS: {
970
+ permutation: [0, 1, 2, 3, 4, 5],
971
+ orientationDelta: [0, 1, 0, 0, 0, 0]
972
+ }
973
+ },
974
+ F: {
975
+ EDGES: {
976
+ permutation: [9, 1, 2, 3, 8, 5, 6, 7, 0, 4, 10, 11],
977
+ orientationDelta: [1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0]
978
+ },
979
+ CORNERS: {
980
+ permutation: [3, 1, 2, 5, 0, 4, 6, 7],
981
+ orientationDelta: [1, 0, 0, 2, 2, 1, 0, 0]
982
+ },
983
+ CENTERS: {
984
+ permutation: [0, 1, 2, 3, 4, 5],
985
+ orientationDelta: [0, 0, 1, 0, 0, 0]
986
+ }
987
+ },
988
+ R: {
989
+ EDGES: {
990
+ permutation: [0, 8, 2, 3, 4, 10, 6, 7, 5, 9, 1, 11],
991
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
992
+ },
993
+ CORNERS: {
994
+ permutation: [4, 0, 2, 3, 7, 5, 6, 1],
995
+ orientationDelta: [2, 1, 0, 0, 1, 0, 0, 2]
996
+ },
997
+ CENTERS: {
998
+ permutation: [0, 1, 2, 3, 4, 5],
999
+ orientationDelta: [0, 0, 0, 1, 0, 0]
1000
+ }
1001
+ },
1002
+ B: {
1003
+ EDGES: {
1004
+ permutation: [0, 1, 10, 3, 4, 5, 11, 7, 8, 9, 6, 2],
1005
+ orientationDelta: [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1]
1006
+ },
1007
+ CORNERS: {
1008
+ permutation: [0, 7, 1, 3, 4, 5, 2, 6],
1009
+ orientationDelta: [0, 2, 1, 0, 0, 0, 2, 1]
1010
+ },
1011
+ CENTERS: {
1012
+ permutation: [0, 1, 2, 3, 4, 5],
1013
+ orientationDelta: [0, 0, 0, 0, 1, 0]
1014
+ }
1015
+ },
1016
+ D: {
1017
+ EDGES: {
1018
+ permutation: [0, 1, 2, 3, 7, 4, 5, 6, 8, 9, 10, 11],
1019
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
1020
+ },
1021
+ CORNERS: {
1022
+ permutation: [0, 1, 2, 3, 5, 6, 7, 4],
1023
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0]
1024
+ },
1025
+ CENTERS: {
1026
+ permutation: [0, 1, 2, 3, 4, 5],
1027
+ orientationDelta: [0, 0, 0, 0, 0, 1]
1028
+ }
1029
+ },
1030
+ z: {
1031
+ EDGES: {
1032
+ permutation: [9, 3, 11, 7, 8, 1, 10, 5, 0, 4, 2, 6],
1033
+ orientationDelta: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
1034
+ },
1035
+ CORNERS: {
1036
+ permutation: [3, 2, 6, 5, 0, 4, 7, 1],
1037
+ orientationDelta: [1, 2, 1, 2, 2, 1, 2, 1]
1038
+ },
1039
+ CENTERS: {
1040
+ permutation: [1, 5, 2, 0, 4, 3],
1041
+ orientationDelta: [1, 1, 1, 1, 3, 1]
1042
+ }
1043
+ },
1044
+ M: {
1045
+ EDGES: {
1046
+ permutation: [2, 1, 6, 3, 0, 5, 4, 7, 8, 9, 10, 11],
1047
+ orientationDelta: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]
1048
+ },
1049
+ CORNERS: {
1050
+ permutation: [0, 1, 2, 3, 4, 5, 6, 7],
1051
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0]
1052
+ },
1053
+ CENTERS: {
1054
+ permutation: [4, 1, 0, 3, 5, 2],
1055
+ orientationDelta: [2, 0, 0, 0, 2, 0]
1056
+ }
1057
+ },
1058
+ E: {
1059
+ EDGES: {
1060
+ permutation: [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 8, 10],
1061
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]
1062
+ },
1063
+ CORNERS: {
1064
+ permutation: [0, 1, 2, 3, 4, 5, 6, 7],
1065
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0]
1066
+ },
1067
+ CENTERS: {
1068
+ permutation: [0, 4, 1, 2, 3, 5],
1069
+ orientationDelta: [0, 0, 0, 0, 0, 0]
1070
+ }
1071
+ },
1072
+ S: {
1073
+ EDGES: {
1074
+ permutation: [0, 3, 2, 7, 4, 1, 6, 5, 8, 9, 10, 11],
1075
+ orientationDelta: [0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0]
1076
+ },
1077
+ CORNERS: {
1078
+ permutation: [0, 1, 2, 3, 4, 5, 6, 7],
1079
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0]
1080
+ },
1081
+ CENTERS: {
1082
+ permutation: [1, 5, 2, 0, 4, 3],
1083
+ orientationDelta: [1, 1, 0, 1, 0, 1]
1084
+ }
1085
+ },
1086
+ u: {
1087
+ EDGES: {
1088
+ permutation: [1, 2, 3, 0, 4, 5, 6, 7, 10, 8, 11, 9],
1089
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]
1090
+ },
1091
+ CORNERS: {
1092
+ permutation: [1, 2, 3, 0, 4, 5, 6, 7],
1093
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0]
1094
+ },
1095
+ CENTERS: {
1096
+ permutation: [0, 2, 3, 4, 1, 5],
1097
+ orientationDelta: [1, 0, 0, 0, 0, 0]
1098
+ }
1099
+ },
1100
+ l: {
1101
+ EDGES: {
1102
+ permutation: [2, 1, 6, 11, 0, 5, 4, 9, 8, 3, 10, 7],
1103
+ orientationDelta: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]
1104
+ },
1105
+ CORNERS: {
1106
+ permutation: [0, 1, 6, 2, 4, 3, 5, 7],
1107
+ orientationDelta: [0, 0, 2, 1, 0, 2, 1, 0]
1108
+ },
1109
+ CENTERS: {
1110
+ permutation: [4, 1, 0, 3, 5, 2],
1111
+ orientationDelta: [2, 1, 0, 0, 2, 0]
1112
+ }
1113
+ },
1114
+ f: {
1115
+ EDGES: {
1116
+ permutation: [9, 3, 2, 7, 8, 1, 6, 5, 0, 4, 10, 11],
1117
+ orientationDelta: [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0]
1118
+ },
1119
+ CORNERS: {
1120
+ permutation: [3, 1, 2, 5, 0, 4, 6, 7],
1121
+ orientationDelta: [1, 0, 0, 2, 2, 1, 0, 0]
1122
+ },
1123
+ CENTERS: {
1124
+ permutation: [1, 5, 2, 0, 4, 3],
1125
+ orientationDelta: [1, 1, 1, 1, 0, 1]
1126
+ }
1127
+ },
1128
+ r: {
1129
+ EDGES: {
1130
+ permutation: [4, 8, 0, 3, 6, 10, 2, 7, 5, 9, 1, 11],
1131
+ orientationDelta: [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]
1132
+ },
1133
+ CORNERS: {
1134
+ permutation: [4, 0, 2, 3, 7, 5, 6, 1],
1135
+ orientationDelta: [2, 1, 0, 0, 1, 0, 0, 2]
1136
+ },
1137
+ CENTERS: {
1138
+ permutation: [2, 1, 5, 3, 0, 4],
1139
+ orientationDelta: [0, 0, 0, 1, 2, 2]
1140
+ }
1141
+ },
1142
+ b: {
1143
+ EDGES: {
1144
+ permutation: [0, 5, 10, 1, 4, 7, 11, 3, 8, 9, 6, 2],
1145
+ orientationDelta: [0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1]
1146
+ },
1147
+ CORNERS: {
1148
+ permutation: [0, 7, 1, 3, 4, 5, 2, 6],
1149
+ orientationDelta: [0, 2, 1, 0, 0, 0, 2, 1]
1150
+ },
1151
+ CENTERS: {
1152
+ permutation: [3, 0, 2, 5, 4, 1],
1153
+ orientationDelta: [3, 3, 0, 3, 1, 3]
1154
+ }
1155
+ },
1156
+ d: {
1157
+ EDGES: {
1158
+ permutation: [0, 1, 2, 3, 7, 4, 5, 6, 9, 11, 8, 10],
1159
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]
1160
+ },
1161
+ CORNERS: {
1162
+ permutation: [0, 1, 2, 3, 5, 6, 7, 4],
1163
+ orientationDelta: [0, 0, 0, 0, 0, 0, 0, 0]
1164
+ },
1165
+ CENTERS: {
1166
+ permutation: [0, 4, 1, 2, 3, 5],
1167
+ orientationDelta: [0, 0, 0, 0, 0, 1]
1168
+ }
1169
+ }
1170
+ },
1171
+ derivedMoves: {
1172
+ Uw: "u",
1173
+ Lw: "l",
1174
+ Fw: "f",
1175
+ Rw: "r",
1176
+ Bw: "b",
1177
+ Dw: "d",
1178
+ Uv: "y",
1179
+ Lv: "x'",
1180
+ Fv: "z",
1181
+ Rv: "x",
1182
+ Bv: "z'",
1183
+ Dv: "y'",
1184
+ "2U": "u U'",
1185
+ "2L": "l L'",
1186
+ "2F": "f F'",
1187
+ "2R": "r R'",
1188
+ "2B": "b B'",
1189
+ "2D": "d D'"
1190
+ }
1191
+ };
1192
+
1193
+ // src/cubing/puzzles/implementations/dynamic/3x3x3/puzzle-orientation.ts
1194
+ function puzzleOrientation3x3x3Idx(pattern) {
1195
+ const idxU = pattern.patternData["CENTERS"].pieces[0];
1196
+ const idxD = pattern.patternData["CENTERS"].pieces[5];
1197
+ const unadjustedIdxL = pattern.patternData["CENTERS"].pieces[1];
1198
+ let idxL = unadjustedIdxL;
1199
+ if (idxU < unadjustedIdxL) {
1200
+ idxL--;
1201
+ }
1202
+ if (idxD < unadjustedIdxL) {
1203
+ idxL--;
1204
+ }
1205
+ return [idxU, idxL];
1206
+ }
1207
+ var puzzleOrientationCacheRaw = new Array(6).fill(0).map(() => {
1208
+ return new Array(6);
1209
+ });
1210
+ var puzzleOrientationCacheInitialized = false;
1211
+ function puzzleOrientation3x3x3Cache() {
1212
+ if (!puzzleOrientationCacheInitialized) {
1213
+ {
1214
+ const uAlgs = ["", "z", "x", "z'", "x'", "x2"].map(
1215
+ (s) => Alg.fromString(s)
1216
+ );
1217
+ const yAlg = new Alg("y");
1218
+ for (const uAlg of uAlgs) {
1219
+ let transformation = experimental3x3x3KPuzzle.algToTransformation(uAlg);
1220
+ for (let i = 0; i < 4; i++) {
1221
+ transformation = transformation.applyAlg(yAlg);
1222
+ const [idxU, idxL] = puzzleOrientation3x3x3Idx(
1223
+ transformation.toKPattern()
1224
+ );
1225
+ puzzleOrientationCacheRaw[idxU][idxL] = transformation.invert();
1226
+ }
1227
+ }
1228
+ }
1229
+ }
1230
+ return puzzleOrientationCacheRaw;
1231
+ }
1232
+ function normalize3x3x3Orientation(pattern) {
1233
+ const [idxU, idxL] = puzzleOrientation3x3x3Idx(pattern);
1234
+ const orientationTransformation = puzzleOrientation3x3x3Cache()[idxU][idxL];
1235
+ return pattern.applyTransformation(orientationTransformation);
1236
+ }
1237
+ function experimentalIs3x3x3Solved(pattern, options) {
1238
+ if (options.ignorePuzzleOrientation) {
1239
+ pattern = normalize3x3x3Orientation(pattern);
1240
+ }
1241
+ if (options.ignoreCenterOrientation) {
1242
+ pattern = new KPattern(pattern.kpuzzle, {
1243
+ EDGES: pattern.patternData["EDGES"],
1244
+ CORNERS: pattern.patternData["CORNERS"],
1245
+ CENTERS: {
1246
+ pieces: pattern.patternData["CENTERS"].pieces,
1247
+ orientation: new Array(6).fill(0)
1248
+ }
1249
+ });
1250
+ }
1251
+ return !!pattern.experimentalToTransformation()?.isIdentityTransformation();
1252
+ }
1253
+
1254
+ // src/cubing/puzzles/PuzzleLoader.ts
1255
+ async function getPartialAppendOptionsForPuzzleSpecificSimplifyOptions(puzzleLoader) {
1256
+ const puzzleSpecificSimplifyOptions = await (puzzleLoader.puzzleSpecificSimplifyOptions ?? puzzleLoader.puzzleSpecificSimplifyOptionsPromise);
1257
+ if (!puzzleSpecificSimplifyOptions) {
1258
+ return {};
1259
+ }
1260
+ return { puzzleLoader: { puzzleSpecificSimplifyOptions } };
1261
+ }
1262
+
1263
+ // src/cubing/puzzles/transformAlg.ts
1264
+ var TransformAlg = class extends TraversalDownUp {
1265
+ traverseAlg(alg, dataDown) {
1266
+ const algNodes = [];
1267
+ for (const algNode of alg.childAlgNodes()) {
1268
+ algNodes.push(this.traverseAlgNode(algNode, dataDown));
1269
+ }
1270
+ return new Alg(algNodes);
1271
+ }
1272
+ traverseGrouping(grouping, dataDown) {
1273
+ return grouping.modified({ alg: this.traverseAlg(grouping.alg, dataDown) });
1274
+ }
1275
+ traverseMove(move, dataDown) {
1276
+ const invert = (() => {
1277
+ const { invertExceptByFamily } = dataDown;
1278
+ if (!invertExceptByFamily) {
1279
+ return false;
1280
+ }
1281
+ return !invertExceptByFamily.has(move.family);
1282
+ })();
1283
+ return move.modified({
1284
+ amount: invert ? -move.amount : move.amount,
1285
+ family: dataDown.replaceMovesByFamily[move.family] ?? move.family
1286
+ });
1287
+ }
1288
+ traverseCommutator(commutator, dataDown) {
1289
+ return new Commutator(
1290
+ this.traverseAlg(commutator.A, dataDown),
1291
+ this.traverseAlg(commutator.B, dataDown)
1292
+ );
1293
+ }
1294
+ traverseConjugate(conjugate, dataDown) {
1295
+ return new Conjugate(
1296
+ this.traverseAlg(conjugate.A, dataDown),
1297
+ this.traverseAlg(conjugate.B, dataDown)
1298
+ );
1299
+ }
1300
+ // TODO: Remove spaces between repeated pauses (in traverseSequence)
1301
+ traversePause(pause, _dataDown) {
1302
+ return pause;
1303
+ }
1304
+ traverseNewline(newLine, _dataDown) {
1305
+ return newLine;
1306
+ }
1307
+ // TODO: Enforce being followed by a newline (or the end of the alg)?
1308
+ traverseLineComment(comment, _dataDown) {
1309
+ return comment;
1310
+ }
1311
+ };
1312
+ var transformAlg = functionFromTraversal(TransformAlg);
1313
+
1314
+ // src/cubing/puzzles/customPGPuzzleLoader.ts
1315
+ async function descAsyncGetPuzzleGeometry(desc, options) {
1316
+ const puzzleGeometry = await import("../puzzle-geometry/index.js");
1317
+ return puzzleGeometry.getPuzzleGeometryByDesc(desc, {
1318
+ allMoves: options?.allMoves ?? true,
1319
+ orientCenters: options?.orientCenters ?? true,
1320
+ addRotations: options?.addRotations ?? true,
1321
+ ...options
1322
+ });
1323
+ }
1324
+ async function asyncGetKPuzzleByDesc(desc, options) {
1325
+ const pgPromise = descAsyncGetPuzzleGeometry(desc, options);
1326
+ return asyncGetKPuzzle(pgPromise, `description: ${desc}`);
1327
+ }
1328
+ var nextCustomID = 1;
1329
+ function customPGPuzzleLoader(desc, info) {
1330
+ const customID = nextCustomID++;
1331
+ let cachedKPuzzle = null;
1332
+ const kpuzzlePromiseFn = async () => {
1333
+ return cachedKPuzzle ??= asyncGetKPuzzleByDesc(desc);
1334
+ };
1335
+ const puzzleLoader = {
1336
+ id: `custom-${customID}`,
1337
+ fullName: info?.fullName ?? `Custom Puzzle (instance #${customID})`,
1338
+ kpuzzle: kpuzzlePromiseFn,
1339
+ svg: async () => {
1340
+ const pg = await descAsyncGetPuzzleGeometry(desc);
1341
+ return pg.generatesvg();
1342
+ },
1343
+ pg: async () => {
1344
+ return descAsyncGetPuzzleGeometry(desc);
1345
+ },
1346
+ basePG: async () => {
1347
+ return descAsyncGetPuzzleGeometry(desc, {
1348
+ allMoves: false,
1349
+ orientCenters: false,
1350
+ addRotations: false
1351
+ });
1352
+ },
1353
+ puzzleSpecificSimplifyOptionsPromise: puzzleSpecificSimplifyOptionsPromise(kpuzzlePromiseFn)
1354
+ };
1355
+ if (info?.inventedBy) {
1356
+ puzzleLoader.inventedBy = info.inventedBy;
1357
+ }
1358
+ if (info?.inventionYear) {
1359
+ puzzleLoader.inventionYear = info.inventionYear;
1360
+ }
1361
+ return puzzleLoader;
1362
+ }
1363
+
1364
+ // src/cubing/puzzles/implementations/dynamic/2x2x2/puzzle-orientation.ts
1365
+ function puzzleOrientation2x2x2Idx(pattern) {
1366
+ const inverse = pattern.experimentalToTransformation().invert();
1367
+ const inverseDFL = inverse.transformationData["CORNERS"];
1368
+ return inverseDFL.permutation[6] * 3 + inverseDFL.orientationDelta[6];
1369
+ }
1370
+ var puzzleOrientationCacheRaw2 = new Array(24);
1371
+ var puzzleOrientationCacheInitialized2 = false;
1372
+ function puzzleOrientation2x2x2Cache(kpuzzle) {
1373
+ if (!puzzleOrientationCacheInitialized2) {
1374
+ {
1375
+ const uAlgs = ["", "z", "x", "z'", "x'", "x2"].map(
1376
+ (s) => Alg.fromString(s)
1377
+ );
1378
+ const yAlg = new Alg("y");
1379
+ for (const uAlg of uAlgs) {
1380
+ let transformation = kpuzzle.algToTransformation(uAlg);
1381
+ for (let i = 0; i < 4; i++) {
1382
+ transformation = transformation.applyAlg(yAlg);
1383
+ const idx = puzzleOrientation2x2x2Idx(transformation.toKPattern());
1384
+ puzzleOrientationCacheRaw2[idx] = {
1385
+ transformation: transformation.invert(),
1386
+ alg: uAlg.concat(yAlg)
1387
+ };
1388
+ }
1389
+ }
1390
+ }
1391
+ }
1392
+ return puzzleOrientationCacheRaw2;
1393
+ }
1394
+ function normalize2x2x2Orientation(pattern) {
1395
+ const idx = puzzleOrientation2x2x2Idx(pattern);
1396
+ const { transformation, alg } = puzzleOrientation2x2x2Cache(pattern.kpuzzle)[idx];
1397
+ return {
1398
+ normalizedPattern: pattern.applyTransformation(transformation),
1399
+ normalizationAlg: alg.invert()
1400
+ };
1401
+ }
1402
+ function experimentalIs2x2x2Solved(pattern, options) {
1403
+ if (options.ignorePuzzleOrientation) {
1404
+ pattern = normalize2x2x2Orientation(pattern).normalizedPattern;
1405
+ }
1406
+ return !!pattern.experimentalToTransformation().isIdentityTransformation();
1407
+ }
1408
+
1409
+ // src/cubing/puzzles/cubing-private/index.ts
1410
+ var experimental3x3x3KPuzzle = new KPuzzle(
1411
+ cube3x3x3KPuzzleDefinition
1412
+ );
1413
+ cube3x3x3KPuzzleDefinition.experimentalIsPatternSolved = experimentalIs3x3x3Solved;
1414
+ var bigCubePuzzleOrientation = getCached(
1415
+ () => import("./big-puzzle-orientation-BA6QHO5C.js")
1416
+ );
1417
+
1418
+ // src/cubing/puzzles/implementations/3x3x3/cube3x3x3KeyMapping.ts
1419
+ var cube3x3x3KeyMapping = {
1420
+ KeyI: new Move("R"),
1421
+ KeyK: new Move("R'"),
1422
+ KeyW: new Move("B"),
1423
+ KeyO: new Move("B'"),
1424
+ KeyS: new Move("D"),
1425
+ KeyL: new Move("D'"),
1426
+ KeyD: new Move("L"),
1427
+ KeyE: new Move("L'"),
1428
+ KeyJ: new Move("U"),
1429
+ KeyF: new Move("U'"),
1430
+ KeyH: new Move("F"),
1431
+ KeyG: new Move("F'"),
1432
+ KeyC: new Move("l"),
1433
+ KeyR: new Move("l'"),
1434
+ KeyU: new Move("r"),
1435
+ KeyM: new Move("r'"),
1436
+ KeyX: new Move("d"),
1437
+ Comma: new Move("d'"),
1438
+ KeyT: new Move("x"),
1439
+ KeyY: new Move("x"),
1440
+ KeyV: new Move("x'"),
1441
+ KeyN: new Move("x'"),
1442
+ Semicolon: new Move("y"),
1443
+ KeyA: new Move("y'"),
1444
+ KeyP: new Move("z"),
1445
+ KeyQ: new Move("z'"),
1446
+ KeyZ: new Move("M'"),
1447
+ KeyB: new Move("M"),
1448
+ Period: new Move("M'"),
1449
+ Backquote: new Pause()
1450
+ };
1451
+
1452
+ // src/cubing/puzzles/implementations/3x3x3/puzzle-specific-simplifications.ts
1453
+ function makeSourceInfo(moveStrings, type, from, to) {
1454
+ const output = [];
1455
+ for (const moveString of moveStrings) {
1456
+ const move = Move.fromString(moveString);
1457
+ const { family, amount: direction } = move;
1458
+ if (![-1, 1].includes(direction)) {
1459
+ throw new Error("Invalid config move");
1460
+ }
1461
+ output.push({ family, direction, type, from, to });
1462
+ }
1463
+ return output;
1464
+ }
1465
+ var axisInfos = {
1466
+ ["x axis" /* X */]: {
1467
+ sliceDiameter: 3,
1468
+ extendsThroughEntirePuzzle: true,
1469
+ moveSourceInfos: [
1470
+ ...makeSourceInfo(["R"], 0 /* INDEXABLE_SLICE_NEAR */, 0, 3),
1471
+ ...makeSourceInfo(["L'"], 1 /* INDEXABLE_SLICE_FAR */, 0, 3),
1472
+ ...makeSourceInfo(["r", "Rw"], 2 /* INDEXABLE_WIDE_NEAR */, 0, 2),
1473
+ ...makeSourceInfo(["l'", "Lw'"], 3 /* INDEXABLE_WIDE_FAR */, 0, 2),
1474
+ ...makeSourceInfo(["M'"], 4 /* SPECIFIC_SLICE */, 1, 2),
1475
+ // TODO: remove some indices?
1476
+ ...makeSourceInfo(["x", "Uv", "Dv'"], 5 /* ROTATION */, 0, 3)
1477
+ // TODO: remove some indices?
1478
+ ]
1479
+ },
1480
+ ["y axis" /* Y */]: {
1481
+ sliceDiameter: 3,
1482
+ extendsThroughEntirePuzzle: true,
1483
+ moveSourceInfos: [
1484
+ ...makeSourceInfo(["U"], 0 /* INDEXABLE_SLICE_NEAR */, 0, 3),
1485
+ ...makeSourceInfo(["D'"], 1 /* INDEXABLE_SLICE_FAR */, 0, 3),
1486
+ ...makeSourceInfo(["u", "Uw"], 2 /* INDEXABLE_WIDE_NEAR */, 0, 2),
1487
+ ...makeSourceInfo(["d'", "Dw'"], 3 /* INDEXABLE_WIDE_FAR */, 0, 2),
1488
+ ...makeSourceInfo(["E'"], 4 /* SPECIFIC_SLICE */, 1, 2),
1489
+ // TODO: remove some indices?
1490
+ ...makeSourceInfo(["y", "Uv", "Dv'"], 5 /* ROTATION */, 0, 3)
1491
+ // TODO: remove some indices?
1492
+ ]
1493
+ },
1494
+ ["z axis" /* Z */]: {
1495
+ sliceDiameter: 3,
1496
+ extendsThroughEntirePuzzle: true,
1497
+ moveSourceInfos: [
1498
+ ...makeSourceInfo(["F"], 0 /* INDEXABLE_SLICE_NEAR */, 0, 3),
1499
+ ...makeSourceInfo(["B'"], 1 /* INDEXABLE_SLICE_FAR */, 0, 3),
1500
+ ...makeSourceInfo(["f", "Fw"], 2 /* INDEXABLE_WIDE_NEAR */, 0, 3),
1501
+ ...makeSourceInfo(["b'", "Bw'"], 3 /* INDEXABLE_WIDE_FAR */, 0, 3),
1502
+ ...makeSourceInfo(["S"], 4 /* SPECIFIC_SLICE */, 1, 2),
1503
+ // TODO: remove some indices?
1504
+ ...makeSourceInfo(["z", "Fv", "Bv'"], 5 /* ROTATION */, 0, 3)
1505
+ // TODO: remove some indices?
1506
+ ]
1507
+ }
1508
+ };
1509
+ var byFamily = {};
1510
+ for (const [axis, info] of Object.entries(axisInfos)) {
1511
+ for (const moveSourceInfo of info.moveSourceInfos) {
1512
+ byFamily[moveSourceInfo.family] = { axis, moveSourceInfo };
1513
+ }
1514
+ }
1515
+ var byAxisThenType = {};
1516
+ for (const axis of Object.keys(axisInfos)) {
1517
+ const entry = {};
1518
+ byAxisThenType[axis] = entry;
1519
+ for (const moveSourceInfo of axisInfos[axis].moveSourceInfos) {
1520
+ (entry[moveSourceInfo.type] ??= []).push(moveSourceInfo);
1521
+ }
1522
+ }
1523
+ var byAxisThenSpecificSlices = {};
1524
+ for (const axis of Object.keys(axisInfos)) {
1525
+ const entry = /* @__PURE__ */ new Map();
1526
+ byAxisThenSpecificSlices[axis] = entry;
1527
+ for (const moveSourceInfo of axisInfos[axis].moveSourceInfos) {
1528
+ if (!entry.get(moveSourceInfo.from)) {
1529
+ entry.set(moveSourceInfo.from, moveSourceInfo);
1530
+ }
1531
+ }
1532
+ }
1533
+ function firstOfType(axis, moveSourceType) {
1534
+ const entry = byAxisThenType[axis][moveSourceType]?.[0];
1535
+ if (!entry) {
1536
+ throw new Error(
1537
+ `Could not find a reference move (axis: ${axis}, move source type: ${moveSourceType})`
1538
+ );
1539
+ }
1540
+ return entry;
1541
+ }
1542
+ var areQuantumMovesSameAxis = (quantumMove1, quantumMove2) => {
1543
+ return byFamily[quantumMove1.family].axis === byFamily[quantumMove2.family].axis;
1544
+ };
1545
+ function simplestMove(axis, from, to, directedAmount) {
1546
+ if (from + 1 === to) {
1547
+ const sliceSpecificInfo = byAxisThenSpecificSlices[axis].get(from);
1548
+ if (sliceSpecificInfo) {
1549
+ return new Move(
1550
+ new QuantumMove(sliceSpecificInfo.family),
1551
+ directedAmount * sliceSpecificInfo.direction
1552
+ );
1553
+ }
1554
+ }
1555
+ const axisInfo = axisInfos[axis];
1556
+ const { sliceDiameter } = axisInfo;
1557
+ if (from === 0 && to === sliceDiameter) {
1558
+ const moveSourceInfo2 = firstOfType(axis, 5 /* ROTATION */);
1559
+ return new Move(
1560
+ new QuantumMove(moveSourceInfo2.family),
1561
+ directedAmount * moveSourceInfo2.direction
1562
+ );
1563
+ }
1564
+ const far = from + to > sliceDiameter;
1565
+ if (far) {
1566
+ [from, to] = [sliceDiameter - to, sliceDiameter - from];
1567
+ }
1568
+ let outerLayer = from + 1;
1569
+ let innerLayer = to;
1570
+ const slice = outerLayer === innerLayer;
1571
+ if (slice) {
1572
+ innerLayer = null;
1573
+ }
1574
+ if (outerLayer === 1) {
1575
+ outerLayer = null;
1576
+ }
1577
+ if (slice && outerLayer === 1) {
1578
+ innerLayer = null;
1579
+ }
1580
+ if (!slice && innerLayer === 2) {
1581
+ innerLayer = null;
1582
+ }
1583
+ const moveSourceType = slice ? far ? 1 /* INDEXABLE_SLICE_FAR */ : 0 /* INDEXABLE_SLICE_NEAR */ : far ? 3 /* INDEXABLE_WIDE_FAR */ : 2 /* INDEXABLE_WIDE_NEAR */;
1584
+ const moveSourceInfo = firstOfType(axis, moveSourceType);
1585
+ return new Move(
1586
+ new QuantumMove(moveSourceInfo.family, innerLayer, outerLayer),
1587
+ directedAmount * moveSourceInfo.direction
1588
+ );
1589
+ }
1590
+ function simplifySameAxisMoves(moves, quantumMod = true) {
1591
+ if (moves.length === 0) {
1592
+ return [];
1593
+ }
1594
+ const axis = byFamily[moves[0].family].axis;
1595
+ const axisInfo = axisInfos[axis];
1596
+ const { sliceDiameter } = axisInfo;
1597
+ const sliceDeltas = /* @__PURE__ */ new Map();
1598
+ let lastCandidateRange = null;
1599
+ function adjustValue(idx, relativeDelta) {
1600
+ let newDelta = (sliceDeltas.get(idx) ?? 0) + relativeDelta;
1601
+ if (quantumMod) {
1602
+ newDelta = newDelta % 4 + 5 % 4 - 1;
1603
+ }
1604
+ if (newDelta === 0) {
1605
+ sliceDeltas.delete(idx);
1606
+ } else {
1607
+ sliceDeltas.set(idx, newDelta);
1608
+ }
1609
+ }
1610
+ let suffixLength = 0;
1611
+ for (const move of Array.from(moves).reverse()) {
1612
+ suffixLength++;
1613
+ const { moveSourceInfo } = byFamily[move.family];
1614
+ const directedAmount2 = move.amount * moveSourceInfo.direction;
1615
+ switch (moveSourceInfo.type) {
1616
+ case 0 /* INDEXABLE_SLICE_NEAR */: {
1617
+ const idx = (move.innerLayer ?? 1) - 1;
1618
+ adjustValue(idx, directedAmount2);
1619
+ adjustValue(idx + 1, -directedAmount2);
1620
+ break;
1621
+ }
1622
+ case 1 /* INDEXABLE_SLICE_FAR */: {
1623
+ const idx = sliceDiameter - (move.innerLayer ?? 1);
1624
+ adjustValue(idx, directedAmount2);
1625
+ adjustValue(idx + 1, -directedAmount2);
1626
+ break;
1627
+ }
1628
+ case 2 /* INDEXABLE_WIDE_NEAR */: {
1629
+ adjustValue((move.outerLayer ?? 1) - 1, directedAmount2);
1630
+ adjustValue(move.innerLayer ?? 2, -directedAmount2);
1631
+ break;
1632
+ }
1633
+ case 3 /* INDEXABLE_WIDE_FAR */: {
1634
+ adjustValue(sliceDiameter - (move.innerLayer ?? 2), directedAmount2);
1635
+ adjustValue(
1636
+ sliceDiameter - ((move.outerLayer ?? 1) - 1),
1637
+ -directedAmount2
1638
+ );
1639
+ break;
1640
+ }
1641
+ case 4 /* SPECIFIC_SLICE */: {
1642
+ adjustValue(moveSourceInfo.from, directedAmount2);
1643
+ adjustValue(moveSourceInfo.to, -directedAmount2);
1644
+ break;
1645
+ }
1646
+ case 5 /* ROTATION */: {
1647
+ adjustValue(0, directedAmount2);
1648
+ adjustValue(sliceDiameter, -directedAmount2);
1649
+ break;
1650
+ }
1651
+ }
1652
+ if ([0, 2].includes(sliceDeltas.size)) {
1653
+ lastCandidateRange = { suffixLength, sliceDeltas: new Map(sliceDeltas) };
1654
+ }
1655
+ }
1656
+ if (sliceDeltas.size === 0) {
1657
+ return [];
1658
+ }
1659
+ if (!lastCandidateRange) {
1660
+ return moves;
1661
+ }
1662
+ let [from, to] = lastCandidateRange.sliceDeltas.keys();
1663
+ if (from > to) {
1664
+ [from, to] = [to, from];
1665
+ }
1666
+ const directedAmount = lastCandidateRange.sliceDeltas.get(from);
1667
+ return [
1668
+ ...moves.slice(0, -lastCandidateRange.suffixLength),
1669
+ ...directedAmount !== 0 ? [simplestMove(axis, from, to, directedAmount)] : []
1670
+ ];
1671
+ }
1672
+ var puzzleSpecificSimplifyOptions333 = {
1673
+ quantumMoveOrder: () => 4,
1674
+ // doQuantumMovesCommute: areQuantumMovesSameAxis,
1675
+ axis: { areQuantumMovesSameAxis, simplifySameAxisMoves }
1676
+ };
1677
+
1678
+ // src/cubing/puzzles/implementations/3x3x3/index.ts
1679
+ var cubeMirrorTransforms = {
1680
+ "\u2194 Mirror (M)": {
1681
+ replaceMovesByFamily: {
1682
+ L: "R",
1683
+ R: "L",
1684
+ l: "r",
1685
+ r: "l",
1686
+ Lw: "Rw",
1687
+ Rw: "Lw",
1688
+ Lv: "Rv",
1689
+ Rv: "Lv"
1690
+ },
1691
+ invertExceptByFamily: /* @__PURE__ */ new Set(["x", "M", "m"])
1692
+ },
1693
+ "\u2922 Mirror (S)": {
1694
+ replaceMovesByFamily: {
1695
+ F: "B",
1696
+ B: "F",
1697
+ f: "b",
1698
+ b: "f",
1699
+ Fw: "Bw",
1700
+ Bw: "Fw",
1701
+ Fv: "Bv",
1702
+ Bv: "Fv"
1703
+ },
1704
+ invertExceptByFamily: /* @__PURE__ */ new Set(["z", "S", "s"])
1705
+ },
1706
+ "\u2195 Mirror (E)": {
1707
+ replaceMovesByFamily: {
1708
+ U: "D",
1709
+ D: "U",
1710
+ u: "d",
1711
+ d: "u",
1712
+ Uw: "Dw",
1713
+ Dw: "Uw",
1714
+ Uv: "Dv",
1715
+ Dv: "Uv"
1716
+ },
1717
+ invertExceptByFamily: /* @__PURE__ */ new Set(["y", "E", "e"])
1718
+ }
1719
+ };
1720
+ var cube3x3x3 = {
1721
+ id: "3x3x3",
1722
+ fullName: "3\xD73\xD73 Cube",
1723
+ inventedBy: ["Ern\u0151 Rubik"],
1724
+ inventionYear: 1974,
1725
+ // https://en.wikipedia.org/wiki/Rubik%27s_Cube#Conception_and_development
1726
+ kpuzzle: getCached(async () => {
1727
+ return experimental3x3x3KPuzzle;
1728
+ }),
1729
+ svg: getCached(async () => {
1730
+ return (await import("./puzzles-dynamic-3x3x3-FYXD7SIU.js")).cube3x3x3SVG;
1731
+ }),
1732
+ llSVG: getCached(async () => {
1733
+ return (await import("./puzzles-dynamic-3x3x3-FYXD7SIU.js")).cube3x3x3LLSVG;
1734
+ }),
1735
+ llFaceSVG: getCached(async () => {
1736
+ return (await import("./puzzles-dynamic-3x3x3-FYXD7SIU.js")).cube3x3x3LLFaceSVG;
1737
+ }),
1738
+ pg: getCached(async () => {
1739
+ return asyncGetPuzzleGeometry("3x3x3");
1740
+ }),
1741
+ stickeringMask: (stickering) => cubeLikeStickeringMask(cube3x3x3, stickering),
1742
+ stickerings: () => cubeLikeStickeringList("3x3x3"),
1743
+ puzzleSpecificSimplifyOptions: puzzleSpecificSimplifyOptions333,
1744
+ keyMapping: async () => cube3x3x3KeyMapping,
1745
+ // TODO: async loading
1746
+ algTransformData: cubeMirrorTransforms
1747
+ };
1748
+
1749
+ export {
1750
+ LazyPromise,
1751
+ getCached,
1752
+ cube3x3x3KPuzzleDefinition,
1753
+ puzzleOrientation3x3x3Idx,
1754
+ puzzleOrientation3x3x3Cache,
1755
+ normalize3x3x3Orientation,
1756
+ getPartialAppendOptionsForPuzzleSpecificSimplifyOptions,
1757
+ customPGPuzzleLoader,
1758
+ experimentalIs2x2x2Solved,
1759
+ getFaceletStickeringMask,
1760
+ getPieceStickeringMask,
1761
+ PuzzleStickering,
1762
+ StickeringManager,
1763
+ experimental3x3x3KPuzzle,
1764
+ bigCubePuzzleOrientation,
1765
+ cubeLikeStickeringMask,
1766
+ cubeLikeStickeringList,
1767
+ cube3x3x3KeyMapping,
1768
+ cubeMirrorTransforms,
1769
+ cube3x3x3,
1770
+ asyncGetPuzzleGeometry,
1771
+ PGPuzzleLoader,
1772
+ CubePGPuzzleLoader
1773
+ };
1774
+ //# sourceMappingURL=chunk-2VJB4TMH.js.map