cubing 0.35.14 → 0.35.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/bluetooth/index.js +4 -4
- package/dist/esm/{chunk-FYVNXGW7.js → chunk-45K2CYFE.js} +4 -4
- package/dist/esm/{chunk-KFIVGLQW.js → chunk-6VTHSEOW.js} +2 -2
- package/dist/esm/{chunk-M3R3E72W.js → chunk-DMCZUU73.js} +3 -3
- package/dist/esm/{chunk-KLI2E737.js → chunk-HFSPQPHF.js} +1 -1
- package/dist/esm/{chunk-KLI2E737.js.map → chunk-HFSPQPHF.js.map} +1 -1
- package/dist/esm/{chunk-KVV6QRVS.js → chunk-JUQ3IMBL.js} +2 -2
- package/dist/esm/{chunk-H5V6PE7W.js → chunk-LWPS6YCY.js} +4 -4
- package/dist/esm/{chunk-3446SRBQ.js → chunk-P6UFJHYS.js} +3 -3
- package/dist/esm/{chunk-ASZGP3LG.js → chunk-SHPUPQXF.js} +3 -3
- package/dist/esm/{chunk-ARK3O2ML.js → chunk-Z7HNUB4Z.js} +10 -10
- package/dist/esm/kpuzzle/index.js +1 -1
- package/dist/esm/notation/index.js +3 -3
- package/dist/esm/protocol/index.js +3 -3
- package/dist/esm/puzzle-geometry/index.js +74 -69
- package/dist/esm/puzzle-geometry/index.js.map +2 -2
- package/dist/esm/puzzles/index.js +3 -3
- package/dist/esm/scramble/index.js +7 -7
- package/dist/esm/search/index.js +7 -7
- package/dist/esm/{search-dynamic-sgs-side-events-UFZFWRKV.js → search-dynamic-sgs-side-events-2ECZCNHG.js} +4 -4
- package/dist/esm/{search-dynamic-sgs-unofficial-5DWOGMT7.js → search-dynamic-sgs-unofficial-5C77Q7DX.js} +4 -4
- package/dist/esm/{search-dynamic-solve-4x4x4-2GF6SJJV.js → search-dynamic-solve-4x4x4-7CHOLNFP.js} +5 -5
- package/dist/esm/{search-worker-inside-generated-string-BDTSOVM2.js → search-worker-inside-generated-string-UR6QHHVC.js} +2 -2
- package/dist/esm/search-worker-inside-generated-string-UR6QHHVC.js.map +7 -0
- package/dist/esm/search-worker-js-entry-WMBGZURE.js +17 -0
- package/dist/esm/{search-worker-ts-entry-7AOWIER3.js → search-worker-ts-entry-BGM22QXI.js} +2 -2
- package/dist/esm/twisty/index.js +5 -16
- package/dist/esm/twisty/index.js.map +3 -3
- package/dist/esm/{twisty-dynamic-3d-WFA6QUCM.js → twisty-dynamic-3d-AE6H6NWK.js} +5 -5
- package/dist/types/{KState-02f3c493.d.ts → KState-8f0d81ea.d.ts} +2 -2
- package/dist/types/{TwizzleLink-3eb6b5c9.d.ts → TwizzleLink-9f92123d.d.ts} +1 -9
- package/dist/types/bluetooth/index.d.ts +3 -3
- package/dist/types/{bluetooth-puzzle-cea33c88.d.ts → bluetooth-puzzle-baa8d9f1.d.ts} +1 -1
- package/dist/types/kpuzzle/index.d.ts +1 -1
- package/dist/types/notation/index.d.ts +2 -2
- package/dist/types/{outside-d15f1468.d.ts → outside-ef4dd4d1.d.ts} +1 -1
- package/dist/types/protocol/index.d.ts +1 -1
- package/dist/types/puzzle-geometry/index.d.ts +2 -2
- package/dist/types/puzzles/index.d.ts +3 -3
- package/dist/types/scramble/index.d.ts +2 -2
- package/dist/types/search/index.d.ts +2 -2
- package/dist/types/stream/index.d.ts +2 -2
- package/dist/types/twisty/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/esm/search-worker-inside-generated-string-BDTSOVM2.js.map +0 -7
- package/dist/esm/search-worker-js-entry-C4A2BDRQ.js +0 -17
- /package/dist/esm/{chunk-FYVNXGW7.js.map → chunk-45K2CYFE.js.map} +0 -0
- /package/dist/esm/{chunk-KFIVGLQW.js.map → chunk-6VTHSEOW.js.map} +0 -0
- /package/dist/esm/{chunk-M3R3E72W.js.map → chunk-DMCZUU73.js.map} +0 -0
- /package/dist/esm/{chunk-KVV6QRVS.js.map → chunk-JUQ3IMBL.js.map} +0 -0
- /package/dist/esm/{chunk-H5V6PE7W.js.map → chunk-LWPS6YCY.js.map} +0 -0
- /package/dist/esm/{chunk-3446SRBQ.js.map → chunk-P6UFJHYS.js.map} +0 -0
- /package/dist/esm/{chunk-ASZGP3LG.js.map → chunk-SHPUPQXF.js.map} +0 -0
- /package/dist/esm/{chunk-ARK3O2ML.js.map → chunk-Z7HNUB4Z.js.map} +0 -0
- /package/dist/esm/{search-dynamic-sgs-side-events-UFZFWRKV.js.map → search-dynamic-sgs-side-events-2ECZCNHG.js.map} +0 -0
- /package/dist/esm/{search-dynamic-sgs-unofficial-5DWOGMT7.js.map → search-dynamic-sgs-unofficial-5C77Q7DX.js.map} +0 -0
- /package/dist/esm/{search-dynamic-solve-4x4x4-2GF6SJJV.js.map → search-dynamic-solve-4x4x4-7CHOLNFP.js.map} +0 -0
- /package/dist/esm/{search-worker-js-entry-C4A2BDRQ.js.map → search-worker-js-entry-WMBGZURE.js.map} +0 -0
- /package/dist/esm/{search-worker-ts-entry-7AOWIER3.js.map → search-worker-ts-entry-BGM22QXI.js.map} +0 -0
- /package/dist/esm/{twisty-dynamic-3d-WFA6QUCM.js.map → twisty-dynamic-3d-AE6H6NWK.js.map} +0 -0
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
twizzleEvents,
|
|
7
7
|
wcaEventInfo,
|
|
8
8
|
wcaEvents
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-P6UFJHYS.js";
|
|
10
|
+
import "../chunk-6VTHSEOW.js";
|
|
11
|
+
import "../chunk-HFSPQPHF.js";
|
|
12
12
|
import "../chunk-VZP3KFTU.js";
|
|
13
13
|
export {
|
|
14
14
|
cube2x2x2,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
randomScrambleForEvent
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-LWPS6YCY.js";
|
|
4
|
+
import "../chunk-Z7HNUB4Z.js";
|
|
5
5
|
import "../chunk-RHC3DIN3.js";
|
|
6
6
|
import "../chunk-EV25IJFC.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-45K2CYFE.js";
|
|
8
|
+
import "../chunk-JUQ3IMBL.js";
|
|
9
|
+
import "../chunk-P6UFJHYS.js";
|
|
10
|
+
import "../chunk-6VTHSEOW.js";
|
|
11
|
+
import "../chunk-HFSPQPHF.js";
|
|
12
12
|
import "../chunk-VZP3KFTU.js";
|
|
13
13
|
export {
|
|
14
14
|
randomScrambleForEvent
|
package/dist/esm/search/index.js
CHANGED
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
solvePyraminx,
|
|
7
7
|
solveSkewb,
|
|
8
8
|
solveTwsearch
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-LWPS6YCY.js";
|
|
10
|
+
import "../chunk-Z7HNUB4Z.js";
|
|
11
11
|
import "../chunk-RHC3DIN3.js";
|
|
12
12
|
import "../chunk-EV25IJFC.js";
|
|
13
13
|
import {
|
|
14
14
|
random333State
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
15
|
+
} from "../chunk-45K2CYFE.js";
|
|
16
|
+
import "../chunk-JUQ3IMBL.js";
|
|
17
|
+
import "../chunk-P6UFJHYS.js";
|
|
18
|
+
import "../chunk-6VTHSEOW.js";
|
|
19
|
+
import "../chunk-HFSPQPHF.js";
|
|
20
20
|
import "../chunk-VZP3KFTU.js";
|
|
21
21
|
export {
|
|
22
22
|
experimentalSolve2x2x2,
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
cube2x2x2,
|
|
6
6
|
puzzles
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-P6UFJHYS.js";
|
|
8
|
+
import "./chunk-6VTHSEOW.js";
|
|
9
9
|
import {
|
|
10
10
|
KPuzzle
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HFSPQPHF.js";
|
|
12
12
|
import "./chunk-VZP3KFTU.js";
|
|
13
13
|
|
|
14
14
|
// src/cubing/search/inside/solve/puzzles/dynamic/sgs-side-events/2x2x2.sgs.ts
|
|
@@ -1888,4 +1888,4 @@ export {
|
|
|
1888
1888
|
sgsDataSkewbFixedCorner,
|
|
1889
1889
|
skewbKPuzzleWithoutMOCached
|
|
1890
1890
|
};
|
|
1891
|
-
//# sourceMappingURL=search-dynamic-sgs-side-events-
|
|
1891
|
+
//# sourceMappingURL=search-dynamic-sgs-side-events-2ECZCNHG.js.map
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
} from "./chunk-UMKR43AG.js";
|
|
4
4
|
import {
|
|
5
5
|
puzzles
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-P6UFJHYS.js";
|
|
7
|
+
import "./chunk-6VTHSEOW.js";
|
|
8
|
+
import "./chunk-HFSPQPHF.js";
|
|
9
9
|
import {
|
|
10
10
|
Alg
|
|
11
11
|
} from "./chunk-VZP3KFTU.js";
|
|
@@ -1265,4 +1265,4 @@ export {
|
|
|
1265
1265
|
getRandomRediCubeScramble,
|
|
1266
1266
|
sgsDataFTO
|
|
1267
1267
|
};
|
|
1268
|
-
//# sourceMappingURL=search-dynamic-sgs-unofficial-
|
|
1268
|
+
//# sourceMappingURL=search-dynamic-sgs-unofficial-5C77Q7DX.js.map
|
package/dist/esm/{search-dynamic-solve-4x4x4-2GF6SJJV.js → search-dynamic-solve-4x4x4-7CHOLNFP.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mustBeInsideWorker,
|
|
3
3
|
random333Scramble
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-45K2CYFE.js";
|
|
5
|
+
import "./chunk-P6UFJHYS.js";
|
|
6
|
+
import "./chunk-6VTHSEOW.js";
|
|
7
|
+
import "./chunk-HFSPQPHF.js";
|
|
8
8
|
import {
|
|
9
9
|
Alg
|
|
10
10
|
} from "./chunk-VZP3KFTU.js";
|
|
@@ -2921,4 +2921,4 @@ export {
|
|
|
2921
2921
|
initialize,
|
|
2922
2922
|
random444Scramble
|
|
2923
2923
|
};
|
|
2924
|
-
//# sourceMappingURL=search-dynamic-solve-4x4x4-
|
|
2924
|
+
//# sourceMappingURL=search-dynamic-solve-4x4x4-7CHOLNFP.js.map
|
|
@@ -3,7 +3,7 @@ var workerSource = `"use strict";var dc=Object.defineProperty;var U=(A,g)=>()=>(
|
|
|
3
3
|
\`)||e.includes("\\r"))throw new Error("LineComment cannot contain newline");lA(this,IB,e)}get text(){return w(this,IB)}isIdentical(e){let B=e;return e.is(er)&&w(this,IB)===w(B,IB)}invert(){return this}*experimentalExpand(e=1,B=1/0){yield this}toString(){return\`//\${w(this,IB)}\`}},Ae=er;IB=new WeakMap});var Sg,No=U(()=>{"use strict";Ke();he();Sg=class extends fg{toString(){return\`
|
|
4
4
|
\`}isIdentical(g){return g.is(Sg)}invert(){return this}*experimentalExpand(g=1,e=1/0){yield this}}});var jA,mI=U(()=>{"use strict";Ke();he();jA=class extends fg{toString(){return"."}isIdentical(e){return e.is(jA)}invert(){return this}*experimentalExpand(e=1,B=1/0){yield this}}});function Xt(A,g){return A?parseInt(A):g}function Br(A){return new Mo().parseAlg(A)}function FQ(A){return new Mo().parseMove(A)}function wQ(A){return new Mo().parseQuantumMove(A)}function kg(A,g,e){let B=A;return B.startCharIndex=g,B.endCharIndex=e,B}function mQ(A,g){return"startCharIndex"in A&&(g.startCharIndex=A.startCharIndex),"endCharIndex"in A&&(g.endCharIndex=A.endCharIndex),g}var pQ,zc,Oc,_c,Wc,jc,Pg,tA,dI,Mo,Ir=U(()=>{"use strict";ye();Ar();gr();yI();wI();Ko();Go();pe();No();mI();pQ=/^(\\d+)?('?)/,zc=/^[_\\dA-Za-z]/,Oc=/^((([1-9]\\d*)-)?([1-9]\\d*))?([_A-Za-z]+)?/,_c=/^[^\\n]*/,Wc=/^(-?\\d+), ?/,jc=/^(-?\\d+)\\)/;Mo=class{constructor(){cA(this,Pg,"");cA(this,tA,0);cA(this,dI,[])}parseAlg(g){lA(this,Pg,g),lA(this,tA,0);let e=this.parseAlgWithStopping([]);this.mustBeAtEndOfInput();let B=Array.from(e.childAlgNodes());if(w(this,dI).length>0)for(let i of w(this,dI).reverse())B.push(i);let I=new J(B),{startCharIndex:o,endCharIndex:t}=e;return kg(I,o,t),I}parseMove(g){lA(this,Pg,g),lA(this,tA,0);let e=this.parseMoveImpl();return this.mustBeAtEndOfInput(),e}parseQuantumMove(g){lA(this,Pg,g),lA(this,tA,0);let e=this.parseQuantumMoveImpl();return this.mustBeAtEndOfInput(),e}mustBeAtEndOfInput(){if(w(this,tA)!==w(this,Pg).length)throw new Error("parsing unexpectedly ended early")}parseAlgWithStopping(g){let e=w(this,tA),B=w(this,tA),I=new Wg,o=!1,t=i=>{if(o)throw new Error(\`Unexpected character at index \${i}. Are you missing a space?\`)};A:for(;w(this,tA)<w(this,Pg).length;){let i=w(this,tA);if(g.includes(w(this,Pg)[w(this,tA)]))return kg(I.toAlg(),e,B);if(this.tryConsumeNext(" ")){o=!1,I.experimentalNumAlgNodes()===0&&(e=w(this,tA));continue A}else if(zc.test(w(this,Pg)[w(this,tA)])){t(i);let r=this.parseMoveImpl();I.push(r),o=!0,B=w(this,tA);continue A}else if(this.tryConsumeNext("(")){t(i);let r=this.tryRegex(Wc);if(r){let n=r[1],l=w(this,tA),Q=this.parseRegex(jc),f=kg(new h(new T("U_SQ_"),parseInt(n)),i+1,i+1+n.length),c=kg(new h(new T("D_SQ_"),parseInt(Q[1])),l,w(this,tA)-1),R=kg(new J([f,c]),i+1,w(this,tA)-1);I.push(kg(new Qg(R),i,w(this,tA))),o=!0,B=w(this,tA);continue A}else{let n=this.parseAlgWithStopping([")"]);this.mustConsumeNext(")");let l=this.parseAmount();I.push(kg(new Qg(n,l),i,w(this,tA))),o=!0,B=w(this,tA);continue A}}else if(this.tryConsumeNext("^")){if(!yQ.caretNISSNotationEnabled)throw new Error("Alg contained a caret but caret NISS notation is not enabled.");this.mustConsumeNext("(");let r=this.parseAlgWithStopping([")"]);this.popNext();let n=new Qg(r,-1),l=new jA;n.experimentalNISSPlaceholder=l,l.experimentalNISSGrouping=n,w(this,dI).push(n),I.push(l)}else if(this.tryConsumeNext("[")){t(i);let r=this.parseAlgWithStopping([",",":"]),n=this.popNext(),l=this.parseAlgWithStopping(["]"]);switch(this.mustConsumeNext("]"),n){case":":{I.push(kg(new Eg(r,l),i,w(this,tA))),o=!0,B=w(this,tA);continue A}case",":{I.push(kg(new ng(r,l),i,w(this,tA))),o=!0,B=w(this,tA);continue A}default:throw new Error("unexpected parsing error")}}else if(this.tryConsumeNext(\`
|
|
5
5
|
\`)){I.push(kg(new Sg,i,w(this,tA))),o=!1,B=w(this,tA);continue A}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){t(i);let[r]=this.parseRegex(_c);I.push(kg(new Ae(r),i,w(this,tA))),o=!1,B=w(this,tA);continue A}else{I.push(kg(new h("_SLASH_"),i,w(this,tA))),o=!0,B=w(this,tA);continue A}else if(this.tryConsumeNext(".")){t(i),I.push(kg(new jA,i,w(this,tA))),o=!0,B=w(this,tA);continue A}else throw new Error(\`Unexpected character: \${this.popNext()}\`)}if(w(this,tA)!==w(this,Pg).length)throw new Error("did not finish parsing?");if(g.length>0)throw new Error("expected stopping");return kg(I.toAlg(),e,B)}parseQuantumMoveImpl(){let[,,,g,e,B]=this.parseRegex(Oc);return new T(B,Xt(e,void 0),Xt(g,void 0))}parseMoveImpl(){let g=w(this,tA);if(this.tryConsumeNext("/"))return kg(new h("_SLASH_"),g,w(this,tA));let e=this.parseQuantumMoveImpl(),[B,I]=this.parseAmountAndTrackEmptyAbsAmount(),o=this.parseMoveSuffix();if(o){if(B<0)throw new Error("uh-oh");if((o==="++"||o==="--")&&B!==1)throw new Error("Pochmann ++ or -- moves cannot have an amount other than 1.");if((o==="++"||o==="--")&&!I)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((o==="+"||o==="-")&&I)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");o.startsWith("+")&&(e=e.modified({family:\`\${e.family}_\${o==="+"?"PLUS":"PLUSPLUS"}_\`})),o.startsWith("-")&&(e=e.modified({family:\`\${e.family}_\${o==="-"?"PLUS":"PLUSPLUS"}_\`}),B*=-1)}return kg(new h(e,B),g,w(this,tA))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let g=w(this,tA),[,e,B]=this.parseRegex(pQ);if(e?.startsWith("0")&&e!=="0")throw new Error(\`Error at char index \${g}: An amount can only start with 0 if it's exactly the digit 0.\`);return[Xt(e,1)*(B==="'"?-1:1),!e]}parseAmount(){let g=w(this,tA),[,e,B]=this.parseRegex(pQ);if(e?.startsWith("0")&&e!=="0")throw new Error(\`Error at char index \${g}: An amount number can only start with 0 if it's exactly the digit 0.\`);return Xt(e,1)*(B==="'"?-1:1)}parseRegex(g){let e=g.exec(this.remaining());if(e===null)throw new Error("internal parsing error");return lA(this,tA,w(this,tA)+e[0].length),e}tryRegex(g){let e=g.exec(this.remaining());return e===null?null:(lA(this,tA,w(this,tA)+e[0].length),e)}remaining(){return w(this,Pg).slice(w(this,tA))}popNext(){let g=w(this,Pg)[w(this,tA)];return jC(this,tA)._++,g}tryConsumeNext(g){return w(this,Pg)[w(this,tA)]===g?(jC(this,tA)._++,!0):!1}mustConsumeNext(g){let e=this.popNext();if(e!==g)throw new Error(\`expected \\\`\${g}\\\` while parsing, encountered \${e}\`);return e}};Pg=new WeakMap,tA=new WeakMap,dI=new WeakMap});function Zt(A){dQ.has(A)||(console.warn(A),dQ.add(A))}var dQ,or=U(()=>{"use strict";dQ=new Set});var vB,tr=U(()=>{"use strict";he();$C();vB=class{constructor(g,e=1){if(this.quantum=g,this.amount=e,!Number.isInteger(this.amount)||this.amount<-2147483648||this.amount>2147483647)throw new Error(\`AlgNode amount absolute value must be a non-negative integer below \${Uo}.\`)}suffix(){let g="",e=Math.abs(this.amount);return e!==1&&(g+=e),this.amount<0&&(g+="'"),g}isIdentical(g){return this.quantum.isIdentical(g.quantum)&&this.amount===g.amount}*experimentalExpand(g,e){let B=Math.abs(this.amount),I=RQ(g,this.amount<0);for(let o=0;o<B;o++)yield*this.quantum.experimentalExpand(I,e)}}});var xe,pg,Fg,Ai,T,Dg,SI,h,pe=U(()=>{"use strict";Ke();he();$C();Ir();or();tr();Ai=class extends ko{constructor(e,B,I){super();cA(this,xe,void 0);cA(this,pg,void 0);cA(this,Fg,void 0);if(lA(this,xe,e),lA(this,pg,B??null),lA(this,Fg,I??null),Object.freeze(this),w(this,pg)!==null&&(!Number.isInteger(w(this,pg))||w(this,pg)<1||w(this,pg)>2147483647))throw new Error(\`QuantumMove inner layer must be a positive integer below \${Uo}.\`);if(w(this,Fg)!==null&&(!Number.isInteger(w(this,Fg))||w(this,Fg)<1||w(this,Fg)>2147483647))throw new Error(\`QuantumMove outer layer must be a positive integer below \${Uo}.\`);if(w(this,Fg)!==null&&w(this,pg)!==null&&w(this,pg)<=w(this,Fg))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(w(this,Fg)!==null&&w(this,pg)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(e){return wQ(e)}modified(e){return new Ai(e.family??w(this,xe),e.innerLayer??w(this,pg),e.outerLayer??w(this,Fg))}isIdentical(e){let B=e;return e.is(Ai)&&w(this,xe)===w(B,xe)&&w(this,pg)===w(B,pg)&&w(this,Fg)===w(B,Fg)}get family(){return w(this,xe)}get outerLayer(){return w(this,Fg)}get innerLayer(){return w(this,pg)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a \`QuantumMove\` directly.")}toString(){let e=w(this,xe);return w(this,pg)!==null&&(e=String(w(this,pg))+e,w(this,Fg)!==null&&(e=\`\${String(w(this,Fg))}-\${e}\`)),e}},T=Ai;xe=new WeakMap,pg=new WeakMap,Fg=new WeakMap;SI=class extends fg{constructor(...e){super();cA(this,Dg,void 0);if(typeof e[0]=="string")if(e[1]??null){lA(this,Dg,new vB(T.fromString(e[0]),e[1]));return}else return SI.fromString(e[0]);lA(this,Dg,new vB(e[0],e[1]))}isIdentical(e){let B=e.as(SI);return!!B&&w(this,Dg).isIdentical(w(B,Dg))}invert(){return mQ(this,new SI(w(this,Dg).quantum,-this.amount))}*experimentalExpand(e=1){e===1?yield this:yield this.modified({amount:-this.amount})}get quantum(){return w(this,Dg).quantum}modified(e){return new SI(w(this,Dg).quantum.modified(e),e.amount??this.amount)}static fromString(e){return FQ(e)}get amount(){return w(this,Dg).amount}get type(){return Zt("deprecated: type"),"blockMove"}get family(){return w(this,Dg).quantum.family??void 0}get outerLayer(){return w(this,Dg).quantum.outerLayer??void 0}get innerLayer(){return w(this,Dg).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return w(this,Dg).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let e=Math.abs(this.amount);return w(this,Dg).quantum.toString().slice(0,-10)+(e===1?"":e)+(this.amount<0?"--":"++")}return w(this,Dg).quantum.toString()+w(this,Dg).suffix()}},h=SI;Dg=new WeakMap});var ir,SQ,qg,gi,Qg,Ko=U(()=>{"use strict";ye();Ke();he();pe();tr();ir=class{constructor(){this.quantumU_SQ_=null;this.quantumD_SQ_=null}format(g){let e=this.tuple(g);return e?\`(\${e.map(B=>B.amount).join(", ")})\`:null}tuple(g){this.quantumU_SQ_||(this.quantumU_SQ_=new T("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new T("D_SQ_"));let e=g.alg;if(e.experimentalNumChildAlgNodes()===2){let[B,I]=e.childAlgNodes();if(B.as(h)?.quantum.isIdentical(this.quantumU_SQ_)&&I.as(h)?.quantum.isIdentical(this.quantumD_SQ_)){if(g.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[B,I]}}return null}},SQ=new ir,gi=class extends fg{constructor(e,B){super();cA(this,qg,void 0);let I=BB(e);lA(this,qg,new vB(I,B))}isIdentical(e){let B=e;return e.is(gi)&&w(this,qg).isIdentical(w(B,qg))}get alg(){return w(this,qg).quantum}get amount(){return w(this,qg).amount}get experimentalRepetitionSuffix(){return w(this,qg).suffix()}invert(){return new gi(w(this,qg).quantum,-w(this,qg).amount)}*experimentalExpand(e=1,B){B??(B=1/0),B===0?yield e===1?this:this.invert():yield*w(this,qg).experimentalExpand(e,B-1)}static fromString(){throw new Error("unimplemented")}toString(){return SQ.format(this)??\`(\${w(this,qg).quantum.toString()})\${w(this,qg).suffix()}\`}experimentalAsSquare1Tuple(){return SQ.tuple(this)}},Qg=gi;qg=new WeakMap});var kI=U(()=>{"use strict";Ko();Go();yI();wI();pe();No();mI()});function Ce(A,g){return A instanceof g}function kQ(A){return Ce(A,Qg)||Ce(A,Ae)||Ce(A,ng)||Ce(A,Eg)||Ce(A,h)||Ce(A,Sg)||Ce(A,jA)}var Cr=U(()=>{"use strict";kI()});function UQ(A,g,e){if(g.is(Qg))return A.traverseGrouping(g,e);if(g.is(h))return A.traverseMove(g,e);if(g.is(ng))return A.traverseCommutator(g,e);if(g.is(Eg))return A.traverseConjugate(g,e);if(g.is(jA))return A.traversePause(g,e);if(g.is(Sg))return A.traverseNewline(g,e);if(g.is(Ae))return A.traverseLineComment(g,e);throw new Error("unknown AlgNode")}function GQ(A){if(A.is(Qg)||A.is(h)||A.is(ng)||A.is(Eg)||A.is(jA)||A.is(Sg)||A.is(Ae))return A;throw new Error("internal error: expected AlgNode")}function re(A,g){let e=new A(...g??[]);return e.traverseAlg.bind(e)}var oB,JB,rr=U(()=>{"use strict";yI();wI();Ko();Go();pe();No();mI();oB=class{traverseAlgNode(g,e){return UQ(this,g,e)}traverseIntoAlgNode(g,e){return GQ(this.traverseAlgNode(g,e))}},JB=class extends oB{traverseAlgNode(g){return UQ(this,g,void 0)}traverseIntoAlgNode(g){return GQ(this.traverseAlgNode(g))}}});var Xc,UI,nr=U(()=>{"use strict";Xc="any-direction",UI=class{constructor(g={}){this.config=g}cancelQuantum(){let{cancel:g}=this.config;return g===!0?Xc:g===!1?"none":g?.directional??"none"}cancelAny(){return this.config.cancel&&this.cancelQuantum()!=="none"}cancelPuzzleSpecificModWrap(){let{cancel:g}=this.config;return g===!0||g===!1?"canonical-centered":g?.puzzleSpecificModWrap?g?.puzzleSpecificModWrap:g?.directional==="same-direction"?"preserve-sign":"canonical-centered"}puzzleSpecificSimplifyOptions(){return this.config.puzzleLoader?.puzzleSpecificSimplifyOptions??this.config.puzzleSpecificSimplifyOptions}}});function Zc(A,g){return A*Math.sign(g.amount)>=0}function $c(A,g,e){return((A-e)%g+g)%g+e}function Er(A,g,e){let B=new UI(e),I=Array.from(A.childAlgNodes()),o=[g];function t(){return new J([...I,...o])}function i(r){if(B.cancelPuzzleSpecificModWrap()==="none")return r;let n=B.puzzleSpecificSimplifyOptions()?.quantumMoveOrder;if(!n)return r;let l=n(g.quantum),Q;switch(B.cancelPuzzleSpecificModWrap()){case"gravity":{Q=-Math.floor((l-(r.amount<0?0:1))/2);break}case"canonical-centered":{Q=-Math.floor((l-1)/2);break}case"canonical-positive":{Q=0;break}case"preserve-sign":{Q=r.amount<0?1-l:0;break}default:throw new Error("Unknown mod wrap")}let f=$c(r.amount,l,Q);return r.modified({amount:f})}if(B.cancelAny()){let r,n=B.puzzleSpecificSimplifyOptions()?.axis;if(n)r=R=>n.areQuantumMovesSameAxis(g.quantum,R.quantum);else{let R=g.quantum.toString();r=L=>L.quantum.toString()===R}let l=B.cancelQuantum()==="same-direction",Q=new Map;Q.set(g.quantum.toString(),Math.sign(g.amount));let f;for(f=I.length-1;f>=0;f--){let R=I[f].as(h);if(!R||!r(R))break;let L=R.quantum.toString();if(l){let p=Q.get(L);if(p&&!Zc(p,R))break;Q.set(L,Math.sign(R.amount))}}let c=[...I.splice(f+1),g];if(n)o=n.simplifySameAxisMoves(c,B.cancelPuzzleSpecificModWrap()!=="none");else{let R=c.reduce((L,p)=>L+p.amount,0);if(Q.size!==1)throw new Error("Internal error: multiple quantums when one was expected");o=[new h(g.quantum,R)]}}return o=o.map(r=>i(r)).filter(r=>r.amount!==0),t()}function Qr(A,g,e){let B=g.as(h);return B?Er(A,B,e):new J([...A.childAlgNodes(),g])}var lr=U(()=>{"use strict";ye();pe();nr()});var ei,Yo,ar,HB,xo,bo,fr,sr,Dr,NQ=U(()=>{"use strict";ye();yI();wI();Ko();pe();mI();rr();lr();nr();sr=class extends oB{constructor(){super(...arguments);cA(this,Yo);cA(this,HB);cA(this,bo);cA(this,ei,void 0)}*traverseAlg(e,B){if(B.depth===0){yield*e.childAlgNodes();return}let I=[],o=Me(this,HB,xo).call(this,B);for(let t of e.childAlgNodes())for(let i of this.traverseAlgNode(t,o))I=Array.from(Qr(new J(I),i,o).childAlgNodes());for(let t of I)yield t}*traverseGrouping(e,B){if(B.depth===0){yield e;return}if(e.amount===0)return;let I=new Qg(this.traverseAlg(e.alg,Me(this,HB,xo).call(this,B)),e.amount);if(I.alg.experimentalIsEmpty())return;let o=Me(this,Yo,ar).call(this).get(e);o&&(I.experimentalNISSPlaceholder=o,o.experimentalNISSGrouping=I),yield I}*traverseMove(e,B){yield e}*traverseCommutator(e,B){if(B.depth===0){yield e;return}let I=Me(this,HB,xo).call(this,B),o=new ng(this.traverseAlg(e.A,I),this.traverseAlg(e.B,I));o.A.experimentalIsEmpty()||o.B.experimentalIsEmpty()||o.A.isIdentical(o.B)||o.A.isIdentical(o.B.invert())||Me(this,bo,fr).call(this,o.A,o.B,B)||(yield o)}*traverseConjugate(e,B){if(B.depth===0){yield e;return}let I=Me(this,HB,xo).call(this,B),o=new Eg(this.traverseAlg(e.A,I),this.traverseAlg(e.B,I));if(!o.B.experimentalIsEmpty()){if(o.A.experimentalIsEmpty()||o.A.isIdentical(o.B)||o.A.isIdentical(o.B.invert())||Me(this,bo,fr).call(this,o.A,o.B,B)){yield*e.B.childAlgNodes();return}yield o}}*traversePause(e,B){if(e.experimentalNISSGrouping){let I=new jA;Me(this,Yo,ar).call(this).set(e.experimentalNISSGrouping,I),yield I}else yield e}*traverseNewline(e,B){yield e}*traverseLineComment(e,B){yield e}};ei=new WeakMap,Yo=new WeakSet,ar=function(){return w(this,ei)??lA(this,ei,new Map)},HB=new WeakSet,xo=function(e){return{...e,depth:e.depth?e.depth-1:null}},bo=new WeakSet,fr=function(e,B,I){if(e.experimentalNumChildAlgNodes()===1&&B.experimentalNumChildAlgNodes()===1){let o=Array.from(e.childAlgNodes())[0]?.as(h),t=Array.from(B.childAlgNodes())[0]?.as(h);if(!(o&&t))return!1;if(t.quantum.isIdentical(o.quantum)||new UI(I).puzzleSpecificSimplifyOptions()?.axis?.areQuantumMovesSameAxis(o.quantum,t.quantum))return!0}return!1};Dr=re(sr)});var cr=U(()=>{"use strict";NQ();lr()});function MQ(A){if(!A)return[];if(Ce(A,J))return A.childAlgNodes();if(typeof A=="string")return Br(A).childAlgNodes();let g=A;if(typeof g[Symbol.iterator]=="function")return g;throw new Error("Invalid AlgNode")}function BB(A){return Ce(A,J)?A:new J(A)}function AL(A,g){return A.is(Sg)||g.is(Sg)||g.as(Qg)?.experimentalNISSPlaceholder?"":A.is(Ae)&&!g.is(Sg)?\`
|
|
6
|
-
\`:" "}var Tg,PB,J,ye=U(()=>{"use strict";Ke();Cr();he();Ir();cr();kI();Go();pe();No();or();PB=class extends fg{constructor(e){super();cA(this,Tg,void 0);lA(this,Tg,Array.from(MQ(e)));for(let B of w(this,Tg))if(!kQ(B))throw new Error("An alg can only contain alg nodes.")}isIdentical(e){let B=e;if(!e.is(PB))return!1;let I=Array.from(w(this,Tg)),o=Array.from(w(B,Tg));if(I.length!==o.length)return!1;for(let t=0;t<I.length;t++)if(!I[t].isIdentical(o[t]))return!1;return!0}invert(){return new PB(hQ(Array.from(w(this,Tg)).map(e=>e.invert())))}*experimentalExpand(e=1,B){B??(B=1/0);for(let I of uQ(w(this,Tg),e))yield*I.experimentalExpand(e,B)}expand(e){return new PB(this.experimentalExpand(1,e?.depth??1/0))}*experimentalLeafMoves(){for(let e of this.experimentalExpand())e.is(h)&&(yield e)}concat(e){return new PB(Array.from(w(this,Tg)).concat(Array.from(MQ(e))))}experimentalIsEmpty(){for(let e of w(this,Tg))return!1;return!0}static fromString(e){return Br(e)}units(){return this.childAlgNodes()}*childAlgNodes(){for(let e of w(this,Tg))yield e}experimentalNumUnits(){return this.experimentalNumChildAlgNodes()}experimentalNumChildAlgNodes(){return Array.from(w(this,Tg)).length}get type(){return Zt("deprecated: type"),"sequence"}toString(){let e="",B=null;for(let I of w(this,Tg)){B&&(e+=AL(B,I));let o=I.as(jA)?.experimentalNISSGrouping;if(o){if(o.amount!==-1)throw new Error("Invalid NISS Grouping amount!");e+=\`^(\${o.alg.toString()})\`}else I.as(Qg)?.experimentalNISSPlaceholder||(e+=I.toString());B=I}return e}experimentalSimplify(e){return new PB(Dr(this,e??{}))}simplify(e){return this.experimentalSimplify(e)}},J=PB;Tg=new WeakMap});var gL,KQ=U(()=>{"use strict";ye();kI();yI();wI();pe();mI();gL={Sune:new J([new h("R",1),new h("U",1),new h("R",-1),new h("U",1),new h("R",1),new h("U",-2),new h("R",-1)]),AntiSune:new J([new h("R",1),new h("U",2),new h("R",-1),new h("U",-1),new h("R",1),new h("U",-1),new h("R",-1)]),SuneCommutator:new J([new ng(new J([new h("R",1),new h("U",1),new h("R",-2)]),new J([new Eg(new J([new h("R",1)]),new J([new h("U",1)]))]))]),Niklas:new J([new h("R",1),new h("U",-1),new h("L",-1),new h("U",1),new h("R",-1),new h("U",-1),new h("L",1),new h("U",1)]),EPerm:new J([new h("x",-1),new ng(new J([new Eg(new J([new h("R",1)]),new J([new h("U",-1)]))]),new J([new h("D",1)])),new ng(new J([new Eg(new J([new h("R",1)]),new J([new h("U",1)]))]),new J([new h("D",1)])),new h("x",1)]),FURURFCompact:new J([new Eg(new J([new h("F",1)]),new J([new ng(new J([new h("U",1)]),new J([new h("R",1)]))]))]),APermCompact:new J([new Eg(new J([new h("R",2)]),new J([new ng(new J([new h("F",2)]),new J([new h("R",-1),new h("B",-1),new h("R",1)]))]))]),FURURFMoves:new J([new h("F",1),new h("U",1),new h("R",1),new h("U",-1),new h("R",-1),new h("F",-1)]),TPerm:new J([new h("R",1),new h("U",1),new h("R",-1),new h("U",-1),new h("R",-1),new h("F",1),new h("R",2),new h("U",-1),new h("R",-1),new h("U",-1),new h("R",1),new h("U",1),new h("R",-1),new h("F",-1)]),HeadlightSwaps:new J([new Eg(new J([new h("F",1)]),new J([new Qg(new J([new ng(new J([new h("R",1)]),new J([new h("U",1)]))]),3)]))]),TriplePause:new J([new jA,new jA,new jA])}});var wm,xQ=U(()=>{"use strict";kI();pe();wm={73:new h("R"),75:new h("R'"),87:new h("B"),79:new h("B'"),83:new h("D"),76:new h("D'"),68:new h("L"),69:new h("L'"),74:new h("U"),70:new h("U'"),72:new h("F"),71:new h("F'"),78:new h("x'"),67:new h("l"),82:new h("l'"),85:new h("r"),77:new h("r'"),88:new h("d"),188:new h("d'"),84:new h("x"),89:new h("x"),66:new h("x'"),186:new h("y"),59:new h("y"),65:new h("y'"),80:new h("z"),81:new h("z'"),90:new h("M'"),190:new h("M'"),192:new jA}});var YQ=U(()=>{"use strict"});var SA=U(()=>{"use strict";ye();Ar();rr();KQ();xQ();kI();YQ();cr();Cr();gr()});function Jo(A,g,e){let B={};for(let I in A.orbits){let o=A.orbits[I],t=g[I],i=e[I];if(vo(o.numOrientations,i))B[I]=t;else if(vo(o.numOrientations,t))B[I]=i;else{let r=new Array(o.numPieces);if(o.numOrientations===1){for(let n=0;n<o.numPieces;n++)r[n]=t.permutation[i.permutation[n]];B[I]={permutation:r,orientation:t.orientation}}else{let n=new Array(o.numPieces);for(let l=0;l<o.numPieces;l++)n[l]=(t.orientation[i.permutation[l]]+i.orientation[l])%o.numOrientations,r[l]=t.permutation[i.permutation[l]];B[I]={permutation:r,orientation:n}}}}return B}function Lr(A,g,e){let B={};for(let I in A.orbits){let o=A.orbits[I],t=g[I],i=e[I];if(vo(o.numOrientations,i))B[I]=t;else{let r=new Array(o.numPieces);if(o.numOrientations===1){for(let n=0;n<o.numPieces;n++)r[n]=t.pieces[i.permutation[n]];B[I]={pieces:r,orientation:t.orientation}}else{let n=new Array(o.numPieces);for(let l=0;l<o.numPieces;l++)n[l]=(t.orientation[i.permutation[l]]+i.orientation[l])%o.numOrientations,r[l]=t.pieces[i.permutation[l]];B[I]={pieces:r,orientation:n}}}}return B}var Bi=U(()=>{"use strict";Ho()});function eL(A){let g=bQ.get(A);if(g)return g;let e=new Array(A),B=new Array(A);for(let o=0;o<A;o++)e[o]=o,B[o]=0;let I={permutation:e,orientation:B};return vQ&&(Object.freeze(e),Object.freeze(B),Object.freeze(I)),bQ.set(A,I),I}function JQ(A){let g={};for(let[e,B]of Object.entries(A.orbits))g[e]=eL(B.numPieces);return vQ&&Object.freeze(g),g}function HQ(A,g){let e=g.quantum.toString(),B=A.definition.moves[e];if(!B){let t=A.definition.experimentalDerivedMoves?.[e];t&&(B=A.algToTransformation(t).transformationData)}if(B)return tB(A,B,g.amount);let I=A.definition.moves[g.toString()];if(I)return I;let o=A.definition.moves[g.invert().toString()];if(o)return tB(A,o,-1);throw new Error(\`Invalid move for KPuzzle (\${A.name()}): \${g}\`)}var vQ,bQ,Rr=U(()=>{"use strict";Ho();vQ=!1,bQ=new Map});var YA,Ii=U(()=>{"use strict";Bi();Po();YA=class{constructor(g,e){this.kpuzzle=g;this.stateData=e}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),stateData:this.stateData}}static fromTransformation(g){let e=Lr(g.kpuzzle.definition,g.kpuzzle.definition.startStateData,g.transformationData);return new YA(g.kpuzzle,e)}apply(g){return this.applyTransformation(this.kpuzzle.toTransformation(g))}applyTransformation(g){if(g.isIdentityTransformation())return new YA(this.kpuzzle,this.stateData);let e=Lr(this.kpuzzle.definition,this.stateData,g.transformationData);return new YA(this.kpuzzle,e)}applyMove(g){return this.applyTransformation(this.kpuzzle.moveToTransformation(g))}applyAlg(g){return this.applyTransformation(this.kpuzzle.algToTransformation(g))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let g={};for(let[e,B]of Object.entries(this.stateData)){let I={permutation:B.pieces,orientation:B.orientation};g[e]=I}return new ge(this.kpuzzle,g)}experimentalIsSolved(g){if(!this.kpuzzle.definition.experimentalIsStateSolved)throw new Error("\`KState.experimentalIsSolved()\` is not supported for this puzzle at the moment.");return this.kpuzzle.definition.experimentalIsStateSolved(this,g)}}});var qB,iB,ge,Po=U(()=>{"use strict";Ho();Bi();Rr();Ii();iB=class{constructor(g,e){this.kpuzzle=g;this.transformationData=e;cA(this,qB,void 0)}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),transformationData:this.transformationData}}invert(){return new iB(this.kpuzzle,ur(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return w(this,qB)??lA(this,qB,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(g){let e=new iB(g,JQ(g.definition));return lA(e,qB,!0),e}isIdentical(g){return PQ(this.kpuzzle,this.transformationData,g.transformationData)}apply(g){return this.applyTransformation(this.kpuzzle.toTransformation(g))}applyTransformation(g){if(this.kpuzzle!==g.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${g.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return w(this,qB)?new iB(this.kpuzzle,g.transformationData):w(g,qB)?new iB(this.kpuzzle,this.transformationData):new iB(this.kpuzzle,Jo(this.kpuzzle.definition,this.transformationData,g.transformationData))}applyMove(g){return this.applyTransformation(this.kpuzzle.moveToTransformation(g))}applyAlg(g){return this.applyTransformation(this.kpuzzle.algToTransformation(g))}toKState(){return YA.fromTransformation(this)}repetitionOrder(){return qQ(this.kpuzzle.definition,this)}selfMultiply(g){return new iB(this.kpuzzle,tB(this.kpuzzle,this.transformationData,g))}},ge=iB;qB=new WeakMap});function vo(A,g){let{permutation:e}=g,B=e.length;for(let I=0;I<B;I++)if(e[I]!==I)return!1;if(A>1){let{orientation:I}=g;for(let o=0;o<B;o++)if(I[o]!==0)return!1}return!0}function BL(A,g,e,B={}){for(let I=0;I<A.numPieces;I++)if(!B?.ignoreOrientation&&g.orientation[I]!==e.orientation[I]||!B?.ignorePermutation&&g.permutation[I]!==e.permutation[I])return!1;return!0}function PQ(A,g,e){for(let[B,I]of Object.entries(A.definition.orbits))if(!BL(I,g[B],e[B]))return!1;return!0}function ur(A,g){let e={};for(let B in A.definition.orbits){let I=A.definition.orbits[B],o=g[B];if(vo(I.numOrientations,o))e[B]=o;else if(I.numOrientations===1){let t=new Array(I.numPieces);for(let i=0;i<I.numPieces;i++)t[o.permutation[i]]=i;e[B]={permutation:t,orientation:o.orientation}}else{let t=new Array(I.numPieces),i=new Array(I.numPieces);for(let r=0;r<I.numPieces;r++){let n=o.permutation[r];t[n]=r,i[n]=(I.numOrientations-o.orientation[r]+I.numOrientations)%I.numOrientations}e[B]={permutation:t,orientation:i}}}return e}function tB(A,g,e){if(e===1)return g;if(e<0)return tB(A,ur(A,g),-e);if(e===0){let{transformationData:o}=A.identityTransformation();return o}let B=g;e!==2&&(B=tB(A,g,Math.floor(e/2)));let I=Jo(A.definition,B,B);return e%2===0?I:Jo(A.definition,g,I)}function yr(A,g){return g?yr(g,A%g):A}function qQ(A,g){let e=1;for(let B in A.orbits){let I=A.orbits[B],o=g.transformationData[B],t=new Array(I.numPieces);for(let i=0;i<I.numPieces;i++)if(!t[i]){let r=i,n=0,l=0;for(;t[r]=!0,n=n+o.orientation[r],l=l+1,r=o.permutation[r],r!==i;);n!==0&&(l=l*I.numOrientations/yr(I.numOrientations,Math.abs(n))),e=e*l/yr(e,l)}}return e}var hr,TQ,Ho=U(()=>{"use strict";SA();SA();Bi();Po();hr=class extends oB{traverseAlg(g,e){let B=null;for(let I of g.childAlgNodes())B?B=B.applyTransformation(this.traverseAlgNode(I,e)):B=this.traverseAlgNode(I,e);return B??e.identityTransformation()}traverseGrouping(g,e){let B=this.traverseAlg(g.alg,e);return new ge(e,tB(e,B.transformationData,g.amount))}traverseMove(g,e){return e.moveToTransformation(g)}traverseCommutator(g,e){let B=this.traverseAlg(g.A,e),I=this.traverseAlg(g.B,e);return B.applyTransformation(I).applyTransformation(B.invert()).applyTransformation(I.invert())}traverseConjugate(g,e){let B=this.traverseAlg(g.A,e),I=this.traverseAlg(g.B,e);return B.applyTransformation(I).applyTransformation(B.invert())}traversePause(g,e){return e.identityTransformation()}traverseNewline(g,e){return e.identityTransformation()}traverseLineComment(g,e){return e.identityTransformation()}},TQ=re(hr)});var GI,oi,zA,zQ=U(()=>{"use strict";SA();Ho();Rr();Ii();Po();zA=class{constructor(g,e){this.definition=g;cA(this,GI,new Map);cA(this,oi,void 0);this.experimentalPGNotation=e?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return ge.experimentalConstructIdentity(this)}moveToTransformation(g){typeof g=="string"&&(g=new h(g));let e=g.toString(),B=w(this,GI).get(e);if(B)return new ge(this,B);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(g);if(!o)throw new Error(\`could not map to internal move: \${g}\`);return w(this,GI).set(e,o),new ge(this,o)}let I=HQ(this,g);return w(this,GI).set(e,I),new ge(this,I)}algToTransformation(g){return typeof g=="string"&&(g=new J(g)),TQ(g,this)}toTransformation(g){return typeof g=="string"?this.algToTransformation(g):g?.is?.(J)?this.algToTransformation(g):g?.is?.(h)?this.moveToTransformation(g):g}startState(){return new YA(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return w(this,oi)??lA(this,oi,(()=>{for(let[g,e]of Object.entries(this.definition.orbits)){let B=new Array(e.numPieces).fill(!1);for(let I of this.definition.startStateData[g].pieces)B[I]=!0;for(let I of B)if(!I)return!1}return!0})())}};GI=new WeakMap,oi=new WeakMap});var cg=U(()=>{"use strict";zQ();Ii();Po()});var OQ,IL,_Q=U(()=>{"use strict";OQ={333:{puzzleID:"3x3x3",eventName:"3x3x3 Cube"},222:{puzzleID:"2x2x2",eventName:"2x2x2 Cube"},444:{puzzleID:"4x4x4",eventName:"4x4x4 Cube"},555:{puzzleID:"5x5x5",eventName:"5x5x5 Cube"},666:{puzzleID:"6x6x6",eventName:"6x6x6 Cube"},777:{puzzleID:"7x7x7",eventName:"7x7x7 Cube"},"333bf":{puzzleID:"3x3x3",eventName:"3x3x3 Blindfolded"},"333fm":{puzzleID:"3x3x3",eventName:"3x3x3 Fewest Moves"},"333oh":{puzzleID:"3x3x3",eventName:"3x3x3 One-Handed"},clock:{puzzleID:"clock",eventName:"Clock"},minx:{puzzleID:"megaminx",eventName:"Megaminx"},pyram:{puzzleID:"pyraminx",eventName:"Pyraminx"},skewb:{puzzleID:"skewb",eventName:"Skewb"},sq1:{puzzleID:"square1",eventName:"Square-1"},"444bf":{puzzleID:"4x4x4",eventName:"4x4x4 Blindfolded"},"555bf":{puzzleID:"5x5x5",eventName:"5x5x5 Blindfolded"},"333mb":{puzzleID:"3x3x3",eventName:"3x3x3 Multi-Blind"}},IL={...OQ,fto:{puzzleID:"fto",eventName:"Face-Turning Octahedron"},master_tetraminx:{puzzleID:"master_tetraminx",eventName:"Master Tetraminx"},kilominx:{puzzleID:"kilominx",eventName:"Kilominx"},redi_cube:{puzzleID:"redi_cube",eventName:"Redi Cube"}}});function WQ(A){return oL[A]}var Ye,Fe,wg,NI,qo,TB,oL,MI,KI,To=U(()=>{"use strict";Ye=class{constructor(g,e){this.stickerings=new Map;for(let[B,I]of Object.entries(g.definition.orbits))this.stickerings.set(B,new Array(I.numPieces).fill(e))}},Fe="regular",wg="ignored",NI="oriented",qo="invisible",TB="dim",oL={["Regular"]:{facelets:[Fe,Fe,Fe,Fe,Fe]},["Ignored"]:{facelets:[wg,wg,wg,wg,wg]},["OrientationStickers"]:{facelets:[NI,NI,NI,NI,NI]},["IgnoreNonPrimary"]:{facelets:[Fe,wg,wg,wg,wg]},["Invisible"]:{facelets:[qo,qo,qo,qo,qo]},["PermuteNonPrimary"]:{facelets:[TB,Fe,Fe,Fe,Fe]},["Dim"]:{facelets:[TB,TB,TB,TB,TB]},["Ignoriented"]:{facelets:[TB,wg,wg,wg,wg]},["OrientationWithoutPermutation"]:{facelets:[NI,wg,wg,wg,wg]}};MI=class extends Ye{constructor(g){super(g,"Regular")}set(g,e){for(let[B,I]of this.stickerings.entries())for(let o=0;o<I.length;o++)g.stickerings.get(B)[o]&&(I[o]=e);return this}toStickeringMask(){let g={orbits:{}};for(let[e,B]of this.stickerings.entries()){let I=[],o={pieces:I};g.orbits[e]=o;for(let t of B)I.push(WQ(t))}return g}},KI=class{constructor(g){this.kpuzzle=g}and(g){let e=new Ye(this.kpuzzle,!1);for(let[B,I]of Object.entries(this.kpuzzle.definition.orbits)){A:for(let o=0;o<I.numPieces;o++){e.stickerings.get(B)[o]=!0;for(let t of g)if(!t.stickerings.get(B)[o]){e.stickerings.get(B)[o]=!1;continue A}}}return e}or(g){let e=new Ye(this.kpuzzle,!1);for(let[B,I]of Object.entries(this.kpuzzle.definition.orbits)){A:for(let o=0;o<I.numPieces;o++){e.stickerings.get(B)[o]=!1;for(let t of g)if(t.stickerings.get(B)[o]){e.stickerings.get(B)[o]=!0;continue A}}}return e}not(g){let e=new Ye(this.kpuzzle,!1);for(let[B,I]of Object.entries(this.kpuzzle.definition.orbits))for(let o=0;o<I.numPieces;o++)e.stickerings.get(B)[o]=!g.stickerings.get(B)[o];return e}all(){return this.and(this.moves([]))}move(g){let e=this.kpuzzle.moveToTransformation(g),B=new Ye(this.kpuzzle,!1);for(let[I,o]of Object.entries(this.kpuzzle.definition.orbits))for(let t=0;t<o.numPieces;t++)(e.transformationData[I].permutation[t]!==t||e.transformationData[I].orientation[t]!==0)&&(B.stickerings.get(I)[t]=!0);return B}moves(g){return g.map(e=>this.move(e))}orbits(g){let e=new Ye(this.kpuzzle,!1);for(let B of g)e.stickerings.get(B).fill(!0);return e}orbitPrefix(g){let e=new Ye(this.kpuzzle,!1);for(let B in this.kpuzzle.definition.orbits)B.startsWith(g)&&e.stickerings.get(B).fill(!0);return e}}});var jQ,VQ,ne,xI,pr,Fr=U(()=>{"use strict";jQ="Last Layer",VQ="Last Slot",ne={"3x3x3":jQ,megaminx:jQ},xI={"3x3x3":VQ,megaminx:VQ},pr={full:{groups:{"3x3x3":"Stickering",megaminx:"Stickering"}},OLL:{groups:ne},PLL:{groups:ne},LL:{groups:ne},EOLL:{groups:ne},COLL:{groups:ne},OCLL:{groups:ne},CPLL:{groups:ne},CLL:{groups:ne},EPLL:{groups:ne},ELL:{groups:ne},ZBLL:{groups:ne},LS:{groups:xI},ELS:{groups:xI},CLS:{groups:xI},ZBLS:{groups:xI},VLS:{groups:xI},WVLS:{groups:xI},F2L:{groups:{"3x3x3":"CFOP (Fridrich)"}},Daisy:{groups:{"3x3x3":"CFOP (Fridrich)"}},Cross:{groups:{"3x3x3":"CFOP (Fridrich)"}},EO:{groups:{"3x3x3":"ZZ"}},EOline:{groups:{"3x3x3":"ZZ"}},EOcross:{groups:{"3x3x3":"ZZ"}},CMLL:{groups:{"3x3x3":"Roux"}},L10P:{groups:{"3x3x3":"Roux"}},L6E:{groups:{"3x3x3":"Roux"}},L6EO:{groups:{"3x3x3":"Roux"}},"2x2x2":{groups:{"3x3x3":"Petrus"}},"2x2x3":{groups:{"3x3x3":"Petrus"}},L2C:{groups:{"4x4x4":"Reduction","5x5x5":"Reduction","6x6x6":"Reduction"}},PBL:{groups:{"2x2x2":"Ortega"}},"Void Cube":{groups:{"3x3x3":"Miscellaneous"}},invisible:{groups:{"3x3x3":"Miscellaneous"}},picture:{groups:{"3x3x3":"Miscellaneous"}},"centers-only":{groups:{"3x3x3":"Miscellaneous"}},"experimental-centers-U":{},"experimental-centers-U-D":{},"experimental-centers-U-L-D":{},"experimental-centers-U-L-B-D":{},"experimental-centers":{},"experimental-fto-fc":{groups:{fto:"Bencisco"}},"experimental-fto-f2t":{groups:{fto:"Bencisco"}},"experimental-fto-sc":{groups:{fto:"Bencisco"}},"experimental-fto-l2c":{groups:{fto:"Bencisco"}},"experimental-fto-lbt":{groups:{fto:"Bencisco"}},"experimental-fto-l3t":{groups:{fto:"Bencisco"}}}});async function be(A,g){let e=await A.kpuzzle(),B=new MI(e),I=new KI(e),o=()=>I.move("U"),t=()=>I.or(I.moves(["U","D"])),i=()=>I.or(I.moves(["L","R"])),r=()=>I.not(i()),n=()=>I.not(o()),l=()=>I.orbitPrefix("CENTER"),Q=()=>I.orbitPrefix("EDGE"),f=()=>I.or([I.orbitPrefix("CORNER"),I.orbitPrefix("C4RNER"),I.orbitPrefix("C5RNER")]),c=()=>I.or([r(),I.and([o(),Q()])]),R=()=>I.and([o(),l()]),L=()=>I.and([I.and(I.moves(["F","R"])),Q()]),p=()=>I.and([I.and(I.moves(["F","R"])),f(),I.not(o())]),k=()=>I.or([p(),L()]);function d(){B.set(n(),"Dim")}function N(){B.set(o(),"PermuteNonPrimary"),B.set(R(),"Dim")}function K(){B.set(o(),"IgnoreNonPrimary"),B.set(R(),"Regular")}function Y(){B.set(o(),"Ignoriented"),B.set(R(),"Dim")}switch(g){case"full":break;case"PLL":{d(),N();break}case"CLS":{d(),B.set(p(),"Regular"),B.set(o(),"Ignoriented"),B.set(I.and([o(),l()]),"Dim"),B.set(I.and([o(),f()]),"IgnoreNonPrimary");break}case"OLL":{d(),K();break}case"EOLL":{d(),K(),B.set(I.and([o(),f()]),"Ignored");break}case"COLL":{d(),B.set(I.and([o(),Q()]),"Ignoriented"),B.set(I.and([o(),l()]),"Dim"),B.set(I.and([o(),f()]),"Regular");break}case"OCLL":{d(),Y(),B.set(I.and([o(),f()]),"IgnoreNonPrimary");break}case"CPLL":{d(),B.set(I.and([f(),o()]),"PermuteNonPrimary"),B.set(I.and([I.not(f()),o()]),"Dim");break}case"CLL":{d(),B.set(I.not(I.and([f(),o()])),"Dim");break}case"EPLL":{d(),B.set(o(),"Dim"),B.set(I.and([o(),Q()]),"PermuteNonPrimary");break}case"ELL":{d(),B.set(o(),"Dim"),B.set(I.and([o(),Q()]),"Regular");break}case"ELS":{d(),K(),B.set(I.and([o(),f()]),"Ignored"),B.set(L(),"Regular"),B.set(p(),"Ignored");break}case"LL":{d();break}case"F2L":{B.set(o(),"Ignored");break}case"ZBLL":{d(),B.set(o(),"PermuteNonPrimary"),B.set(R(),"Dim"),B.set(I.and([o(),f()]),"Regular");break}case"ZBLS":{d(),B.set(k(),"Regular"),K(),B.set(I.and([o(),f()]),"Ignored");break}case"VLS":{d(),B.set(k(),"Regular"),K();break}case"WVLS":{d(),B.set(k(),"Regular"),B.set(I.and([o(),Q()]),"Ignoriented"),B.set(I.and([o(),l()]),"Dim"),B.set(I.and([o(),f()]),"IgnoreNonPrimary");break}case"LS":{d(),B.set(k(),"Regular"),B.set(o(),"Ignored"),B.set(R(),"Dim");break}case"EO":{B.set(f(),"Ignored"),B.set(Q(),"OrientationWithoutPermutation");break}case"EOline":{B.set(f(),"Ignored"),B.set(Q(),"OrientationWithoutPermutation"),B.set(I.and(I.moves(["D","M"])),"Regular");break}case"EOcross":{B.set(Q(),"OrientationWithoutPermutation"),B.set(I.move("D"),"Regular"),B.set(f(),"Ignored");break}case"CMLL":{B.set(n(),"Dim"),B.set(c(),"Ignored"),B.set(I.and([o(),f()]),"Regular");break}case"L10P":{B.set(I.not(c()),"Dim"),B.set(I.and([f(),o()]),"Regular");break}case"L6E":{B.set(I.not(c()),"Dim");break}case"L6EO":{B.set(I.not(c()),"Dim"),B.set(c(),"OrientationWithoutPermutation"),B.set(I.and([l(),t()]),"OrientationStickers");break}case"Daisy":{B.set(I.all(),"Ignored"),B.set(l(),"Dim"),B.set(I.and([I.move("D"),l()]),"Regular"),B.set(I.and([I.move("U"),Q()]),"IgnoreNonPrimary");break}case"Cross":{B.set(I.all(),"Ignored"),B.set(l(),"Dim"),B.set(I.and([I.move("D"),l()]),"Regular"),B.set(I.and([I.move("D"),Q()]),"Regular");break}case"2x2x2":{B.set(I.or(I.moves(["U","F","R"])),"Ignored"),B.set(I.and([I.or(I.moves(["U","F","R"])),l()]),"Dim");break}case"2x2x3":{B.set(I.all(),"Dim"),B.set(I.or(I.moves(["U","F","R"])),"Ignored"),B.set(I.and([I.or(I.moves(["U","F","R"])),l()]),"Dim"),B.set(I.and([I.move("F"),I.not(I.or(I.moves(["U","R"])))]),"Regular");break}case"L2C":{B.set(I.or(I.moves(["L","R","B","D"])),"Dim"),B.set(I.not(l()),"Ignored");break}case"PBL":{B.set(I.all(),"Ignored"),B.set(I.or(I.moves(["U","D"])),"PermuteNonPrimary");break}case"Void Cube":{B.set(l(),"Invisible");break}case"picture":case"invisible":{B.set(I.all(),"Invisible");break}case"centers-only":{B.set(I.not(l()),"Ignored");break}default:console.warn(\`Unsupported stickering for \${A.id}: \${g}. Setting all pieces to dim.\`),B.set(I.and(I.moves([])),"Dim")}return B.toStickeringMask()}async function CB(A,g){let e=[],B=[];for(let[I,o]of Object.entries(pr))o.groups&&(A in o.groups?e.push(I):g?.use3x3x3Fallbacks&&"3x3x3"in o.groups&&B.push(I));return e.concat(B)}var zo=U(()=>{"use strict";To();Fr()});function kA(A){let g=null;return()=>g??(g=A())}var jg=U(()=>{"use strict"});function XA(A){return new ve(g=>{g(A())})}var ve,Vg=U(()=>{"use strict";ve=class extends Promise{constructor(g){super(e=>{e()}),this._executor=g}static from(g){return new ve(e=>{e(g())})}static resolve(g){return new ve(e=>{e(g)})}static reject(g){return new ve((e,B)=>{B(g)})}then(g,e){return this._promise=this._promise||new Promise(this._executor),this._promise.then(g,e)}catch(g){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(g)}}});var YI,ZQ=U(()=>{"use strict";YI=class{constructor(g,e){this.facenames=g;this.prefixFree=!0;this.gripnames=[];e&&(this.gripnames=e);for(let B=0;this.prefixFree&&B<g.length;B++)for(let I=0;this.prefixFree&&I<g.length;I++)B!==I&&g[B].startsWith(g[I])&&(this.prefixFree=!1)}setGripNames(g){this.gripnames=g}splitByFaceNames(g){let e=[],B=0;for(;B<g.length;){B>0&&B<g.length&&g[B]==="_"&&B++;let I=-1;for(let o=0;o<this.facenames.length;o++)g.substr(B).startsWith(this.facenames[o])&&(I<0||this.facenames[o].length>this.facenames[I].length)&&(I=o);if(I>=0)e.push(I),B+=this.facenames[I].length;else throw new Error(\`Could not split \${g} into face names.\`)}return e}joinByFaceIndices(g){let e="",B=[];for(let I=0;I<g.length;I++)B.push(e),B.push(this.facenames[g[I]]),this.prefixFree||(e="_");return B.join("")}spinmatch(g,e){if(g===e)return!0;try{let B=this.splitByFaceNames(g),I=this.splitByFaceNames(e);if(B.length!==I.length&&B.length<3)return!1;for(let o=0;o<B.length;o++){for(let i=0;i<o;i++)if(B[o]===B[i])return!1;let t=!1;for(let i=0;i<I.length;i++)if(B[o]===I[i]){t=!0;break}if(!t)return!1}return!0}catch{return!1}}spinmatchv(g,e){return g.endsWith("v")&&e.endsWith("v")?this.spinmatch(g.slice(0,g.length-1),e.slice(0,e.length-1)):this.spinmatch(g,e)}unswizzle(g){(g.endsWith("v")||g.endsWith("w"))&&g[0]<="Z"&&(g=g.slice(0,g.length-1));let e=g.toUpperCase();for(let B=0;B<this.gripnames.length;B++){let I=this.gripnames[B];if(this.spinmatch(e,I))return I}return g}}});var zB,$Q=U(()=>{"use strict";zB=class{notationToInternal(g){return g}notationToExternal(g){return g}}});var Oo,Al=U(()=>{"use strict";SA();Oo=class{constructor(g,e){this.child=g;this.sw=e}notationToInternal(g){return g.family==="T"&&g.innerLayer===void 0&&g.outerLayer===void 0?new h(new T("FLRv",g.innerLayer,g.outerLayer),g.amount):this.child.notationToInternal(g)}notationToExternal(g){let e=g.family;return e.length>0&&e[e.length-1]==="v"&&(e=e.substring(0,e.length-1)),this.sw.spinmatch(e,"FLUR")?new h(new T("T",g.innerLayer,g.outerLayer),g.amount):this.child.notationToExternal(g)}}});var bI,gl=U(()=>{"use strict";SA();bI=class{constructor(g,e){this.internalNames=g;this.externalNames=e}convertString(g,e,B){let I="";(g.endsWith("v")||g.endsWith("v"))&&g<="_"&&(I=g.slice(g.length-1),g=g.slice(0,g.length-1));let o=g.toUpperCase(),t=!1;return g!==o&&(t=!0,g=o),g=B.joinByFaceIndices(e.splitByFaceNames(g)),t&&(g=g.toLowerCase()),g+I}convert(g,e,B){let I=g.family,o=this.convertString(I,e,B);return I===o?g:new h(new T(o,g.innerLayer,g.outerLayer),g.amount)}notationToInternal(g){return this.convert(g,this.externalNames,this.internalNames)}notationToExternal(g){return this.convert(g,this.internalNames,this.externalNames)}}});var _o,el=U(()=>{"use strict";SA();_o=class{constructor(g){this.child=g}notationToInternal(g){if(g.innerLayer===void 0&&g.outerLayer===void 0){if(Math.abs(g.amount)===1){if(g.family==="R++")return new h(new T("L",3,2),-2*g.amount);if(g.family==="R--")return new h(new T("L",3,2),2*g.amount);if(g.family==="D++")return new h(new T("U",3,2),-2*g.amount);if(g.family==="D--")return new h(new T("U",3,2),2*g.amount);if(g.family==="R_PLUSPLUS_")return new h(new T("L",3,2),-2*g.amount);if(g.family==="D_PLUSPLUS_")return new h(new T("U",3,2),-2*g.amount)}if(g.family==="y")return new h("Uv",g.amount);if(g.family==="x"&&Math.abs(g.amount)===2)return new h("ERv",g.amount/2)}return this.child.notationToInternal(g)}notationToExternal(g){return g.family==="ERv"&&Math.abs(g.amount)===1?new h(new T("x",g.innerLayer,g.outerLayer),g.amount*2):g.family==="ILv"&&Math.abs(g.amount)===1?new h(new T("x",g.innerLayer,g.outerLayer),-g.amount*2):g.family==="Uv"?new h(new T("y",g.innerLayer,g.outerLayer),g.amount):g.family==="Dv"?new h("y",-g.amount):this.child.notationToExternal(g)}}});var Wo,Bl=U(()=>{"use strict";SA();Wo=class{constructor(g){this.slices=g}notationToInternal(g){let e=g.family;return g.innerLayer||g.outerLayer||(e==="x"?g=new h("Rv",g.amount):e==="y"?g=new h("Uv",g.amount):e==="z"&&(g=new h("Fv",g.amount)),(this.slices&1)===1&&(e==="E"?g=new h(new T("D",(this.slices+1)/2),g.amount):e==="M"?g=new h(new T("L",(this.slices+1)/2),g.amount):e==="S"&&(g=new h(new T("F",(this.slices+1)/2),g.amount))),this.slices>2&&(e==="e"?g=new h(new T("D",this.slices-1,2),g.amount):e==="m"?g=new h(new T("L",this.slices-1,2),g.amount):e==="s"&&(g=new h(new T("F",this.slices-1,2),g.amount)))),g}notationToExternal(g){let e=g.family;if(!(g.innerLayer||g.outerLayer)){if(e==="Rv")return new h("x",g.amount);if(e==="Uv")return new h("y",g.amount);if(e==="Fv")return new h("z",g.amount);if(e==="Lv")return new h("x",-g.amount);if(e==="Dv")return new h("y",-g.amount);if(e==="Bv")return new h("z",-g.amount)}return g}}});var tL,iL,Il,ol,tl,vI,jo,il=U(()=>{"use strict";SA();tL={U:"frl",L:"fld",R:"fdr",B:"dlr",u:"FRL",l:"FLD",r:"FDR",b:"DLR",Uv:"FRLv",Lv:"FLDv",Rv:"FDRv",Bv:"DLRv",D:"D",F:"F",BL:"L",BR:"R"},iL={U:"FRL",L:"FLD",R:"FDR",B:"DLR",u:"frl",l:"fld",r:"fdr",b:"dlr",Uv:"FRLv",Lv:"FLDv",Rv:"FDRv",Bv:"DLRv",D:"D",F:"F",BL:"L",BR:"R",d:"d",f:"f",bl:"l",br:"r"},Il={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},ol=new T("y"),tl=new T("Dv"),vI=class{constructor(g){this.child=g;this.wcaHack=!1;this.map=tL}notationToInternal(g){if(this.wcaHack&&g.innerLayer===2&&g.outerLayer===null){let B=Il[g.family];if(B)return new h(new T(B,g.innerLayer,g.outerLayer),g.amount)}let e=this.map[g.family];return e?new h(new T(e,g.innerLayer,g.outerLayer),g.amount):ol.isIdentical(g.quantum)?new h(tl,-g.amount):null}notationToExternal(g){if(this.wcaHack&&g.innerLayer===2&&g.outerLayer===null){for(let[e,B]of Object.entries(Il))if(this.child.spinmatch(g.family,B))return new h(new T(e,g.innerLayer,g.outerLayer),g.amount)}for(let[e,B]of Object.entries(this.map))if(this.child.spinmatch(g.family,B))return new h(new T(e,g.innerLayer,g.outerLayer),g.amount);return tl.isIdentical(g.quantum)?new h(ol,-g.amount):null}},jo=class extends vI{constructor(e){super(e);this.wcaHack=!0;this.map=iL}}});var Cl,wr,rl,CL,mr,nl,rL,dr,El,nL,Vo,Ql=U(()=>{"use strict";SA();Cl={U:"UBL",UL:"ULF",F:"UFR",UR:"URB",B:"DBL",D:"DFR",L:"DLF",R:"DRB",Uv:"UBLv",ULv:"ULFv",Fv:"UFRv",URv:"URBv",Bv:"DBLv",Dv:"DFRv",Lv:"DLFv",Rv:"DRBv"},wr=new T("x"),rl=new T("Rv"),CL=new T("Lv"),mr=new T("y"),nl=new T("Uv"),rL=new T("Dv"),dr=new T("z"),El=new T("Fv"),nL=new T("Bv"),Vo=class{constructor(g){this.child=g}notationToInternal(g){if(g.innerLayer||g.outerLayer)return null;let e=Cl[g.family];return e?new h(new T(e,g.outerLayer,g.innerLayer),g.amount):wr.isIdentical(g.quantum)?new h(rl,g.amount):mr.isIdentical(g.quantum)?new h(nl,g.amount):dr.isIdentical(g.quantum)?new h(El,g.amount):null}notationToExternal(g){for(let[e,B]of Object.entries(Cl))if(this.child.spinmatchv(g.family,B))return new h(new T(e,g.innerLayer,g.outerLayer),g.amount);return rl.isIdentical(g.quantum)?new h(wr,g.amount):CL.isIdentical(g.quantum)?new h(wr,-g.amount):nl.isIdentical(g.quantum)?new h(mr,g.amount):rL.isIdentical(g.quantum)?new h(mr,-g.amount):El.isIdentical(g.quantum)?new h(dr,g.amount):nL.isIdentical(g.quantum)?new h(dr,-g.amount):null}}});var Sr=U(()=>{"use strict";$Q();Al();gl();el();Bl();il();Ql()});function ll(A){let g=0,e={};for(;g<A.length&&A[g][0]==="-";){let I=A[g++];if(I==="--rotations")e.addRotations=!0;else if(I==="--allmoves")e.allMoves=!0;else if(I==="--outerblockmoves")e.outerBlockMoves=!0;else if(I==="--vertexmoves")e.vertexMoves=!0;else if(I==="--nocorners")e.includeCornerOrbits=!1;else if(I==="--noedges")e.includeEdgeOrbits=!1;else if(I==="--noorientation")e.fixedOrientation=!0;else if(I==="--nocenters")e.includeCenterOrbits=!1;else if(I==="--omit")e.excludeOrbits=A[g].split(","),g++;else if(I==="--moves")e.moveList=A[g].split(","),g++;else if(I==="--optimize")e.optimizeOrbits=!0;else if(I==="--scramble")e.scrambleAmount=100;else if(I==="--fixcorner")e.fixedPieceType="v";else if(I==="--fixedge")e.fixedPieceType="e";else if(I==="--fixcenter")e.fixedPieceType="f";else if(I==="--orientcenters")e.orientCenters=!0;else if(I==="--puzzleorientation")e.puzzleOrientation=JSON.parse(A[g]),g++;else throw new Error(\`Bad option: \${I}\`)}return{puzzleDescription:Xo(A.slice(g).join(" ")),options:e}}var ti,kr=U(()=>{"use strict";Zo();ti=class{constructor(g={}){this.verbosity=0;this.allMoves=!1;this.vertexMoves=!1;this.addRotations=!1;this.moveList=null;this.fixedOrientation=!1;this.fixedPieceType=null;this.orientCenters=!1;this.includeCornerOrbits=!0;this.includeCenterOrbits=!0;this.includeEdgeOrbits=!0;this.excludeOrbits=[];this.optimizeOrbits=!1;this.grayCorners=!1;this.grayCenters=!1;this.grayEdges=!1;this.puzzleOrientation=null;this.puzzleOrientations=null;this.scrambleAmount=0;Object.assign(this,g)}}});function rB(A){if(!Ur[A]){let g=Array(A);for(let e=0;e<A;e++)g[e]=0;Ur[A]=g}return Ur[A]}function we(A){if(!Gr[A]){let g=Array(A);for(let e=0;e<A;e++)g[e]=e;Gr[A]=g}return Gr[A]}function sl(A){return new Xg(we(A))}function al(A){let g=BigInt(1);for(;A>1;)g*=BigInt(A),A--;return g}function EL(A,g){if(A>g){let e=A;A=g,g=e}for(;A>0;){let e=g%A;g=A,A=e}return g}function Nr(A,g){return A/EL(A,g)*g}var Ur,Gr,Xg,ii=U(()=>{"use strict";Ur=[],Gr=[];Xg=class{constructor(g){this.n=g.length,this.p=g}toString(){return\`Perm[\${this.p.join(" ")}]\`}mul(g){let e=Array(this.n);for(let B=0;B<this.n;B++)e[B]=g.p[this.p[B]];return new Xg(e)}rmul(g){let e=Array(this.n);for(let B=0;B<this.n;B++)e[B]=this.p[g.p[B]];return new Xg(e)}inv(){let g=Array(this.n);for(let e=0;e<this.n;e++)g[this.p[e]]=e;return new Xg(g)}compareTo(g){for(let e=0;e<this.n;e++)if(this.p[e]!==g.p[e])return this.p[e]-g.p[e];return 0}toGap(){let g=new Array,e=new Array(this.n);for(let B=0;B<this.p.length;B++){if(e[B]||this.p[B]===B)continue;let I=new Array;for(let o=B;!e[o];o=this.p[o])I.push(1+o),e[o]=!0;g.push(\`(\${I.join(",")})\`)}return g.join("")}order(){let g=1,e=new Array(this.n);for(let B=0;B<this.p.length;B++){if(e[B]||this.p[B]===B)continue;let I=0;for(let o=B;!e[o];o=this.p[o])I++,e[o]=!0;g=Nr(g,I)}return g}}});function Ci(A,g){let e=h.fromString(g),B=A.notationToExternal(e);return B===null||e===B?g:B.toString()}function fl(A,g){let e=A.moveops.length;if(e>30)throw new Error("Canon info too big for bitmask");let B=[],I=[];for(let t=0;t<e;t++){let i=A.moveops[t];B.push(i.order());let r=0;for(let n=0;n<e;n++){if(n===t)continue;let l=A.moveops[n];i.mul(l).equal(l.mul(i))&&(r|=1<<n)}I.push(r)}let o={};o[0]=1;for(let t=0;t<100;t++){let i=0,r={},n=0;for(let l in o){let Q=+l,f=o[Q];i+=f,n++;for(let c=0;c<B.length;c++)if((Q>>c&1)===0&&(Q&I[c]&(1<<c)-1)===0){let R=Q&I[c]|1<<c;r[R]===void 0&&(r[R]=0),r[R]+=(B[c]-1)*f}}g(\`\${t}: canonseq \${i} states \${n}\`),o=r}}var JI,QL,OB,Ee,me,ri,Je,_B,ni,Dl=U(()=>{"use strict";SA();Sr();ii();JI=class{constructor(g,e){this.size=g;this.mod=e}reassemblySize(){return al(this.size)*BigInt(this.mod)**BigInt(this.size)}},QL=0;OB=class{constructor(g,e,B,I,o,t,i){this.orbitnames=g;this.orbitdefs=e;this.solved=B;this.movenames=I;this.moveops=o;this.isRotation=t;this.forcenames=i}transformToKTransformationData(g){let e={};for(let B=0;B<this.orbitnames.length;B++)e[this.orbitnames[B]]=g.orbits[B].toKPuzzle();return e}static transformToKTransformationData(g,e){let B={};for(let I=0;I<g.length;I++)B[g[I]]=e.orbits[I].toKPuzzle();return B}describeSet(g,e,B){let I=this.orbitdefs[g].size,o=new Array(I);for(let t=0;t<I;t++)o[t]=[];for(let t=0;t<this.movenames.length;t++){if(this.isRotation[t])continue;let i=this.movenames[t];this.forcenames[t]||(i=Ci(B,i),i[i.length-1]==="'"&&(i=i.substring(0,i.length-1)));let r=this.moveops[t].orbits[g];for(let n=0;n<I;n++)(r.perm[n]!==n||r.ori[n]!==0)&&o[n].push(i)}for(let t=0;t<I;t++)e.push(\`# \${t+1} \${o[t].join(" ")}\`)}toKsolve(g,e=new zB){let B=[];B.push(\`Name \${g}\`),B.push("");for(let I=0;I<this.orbitnames.length;I++)B.push(\`Set \${this.orbitnames[I]} \${this.orbitdefs[I].size} \${this.orbitdefs[I].mod}\`),this.describeSet(I,B,e);B.push(""),B.push("Solved");for(let I=0;I<this.orbitnames.length;I++)this.solved.orbits[I].appendDefinition(B,this.orbitnames[I],!1,!1);B.push("End");for(let I=0;I<this.movenames.length;I++){B.push("");let o=this.movenames[I];this.forcenames[I]||(o=Ci(e,this.movenames[I]));let t=!1;o[o.length-1]==="'"&&(t=!0,o=o.substring(0,o.length-1)),B.push(\`Move \${o}\`);for(let i=0;i<this.orbitnames.length;i++)t?this.moveops[I].orbits[i].inv().appendDefinition(B,this.orbitnames[i],!0):this.moveops[I].orbits[i].appendDefinition(B,this.orbitnames[i],!0);B.push("End")}return B}toKPuzzleDefinition(g){let e={},B={};for(let o=0;o<this.orbitnames.length;o++){e[this.orbitnames[o]]={numPieces:this.orbitdefs[o].size,numOrientations:this.orbitdefs[o].mod};let t=this.solved.orbits[o].toKPuzzle();B[this.orbitnames[o]]={pieces:t.permutation,orientation:t.orientation}}let I={};if(g)for(let o=0;o<this.movenames.length;o++)I[this.movenames[o]]=this.transformToKTransformationData(this.moveops[o]);return{name:\`PG3D #\${++QL}\`,orbits:e,startStateData:B,moves:I}}optimize(){let g=[],e=[],B=[],I=[];for(let o=0;o<this.moveops.length;o++)I.push([]);for(let o=0;o<this.orbitdefs.length;o++){let t=this.orbitdefs[o].mod,i=this.orbitdefs[o].size,r=new ni(i),n=new Array(this.orbitdefs[o].size);for(let c=0;c<i;c++)n[c]=!1;for(let c=0;c<this.moveops.length;c++)for(let R=0;R<i;R++)(this.moveops[c].orbits[o].perm[R]!==R||this.moveops[c].orbits[o].ori[R]!==0)&&(this.isRotation[c]||(n[R]=!0),r.union(R,this.moveops[c].orbits[o].perm[R]));let l=!0;if(t>1){l=!1;let c=new ni(this.orbitdefs[o].size*t);for(let R=0;R<this.moveops.length;R++)for(let L=0;L<i;L++)if(this.moveops[R].orbits[o].perm[L]!==L||this.moveops[R].orbits[o].ori[L]!==0)for(let p=0;p<t;p++)c.union(L*t+p,this.moveops[R].orbits[o].perm[L]*t+(p+this.moveops[R].orbits[o].ori[L])%t);for(let R=0;!l&&R<i;R++)for(let L=1;L<t;L++)c.find(R*t)===c.find(R*t+L)&&(l=!0);for(let R=0;!l&&R<i;R++)for(let L=0;L<R;L++)this.solved.orbits[o].perm[R]===this.solved.orbits[o].perm[L]&&(l=!0)}let Q=-1,f=!1;for(let c=0;c<this.orbitdefs[o].size;c++)if(n[c]){let R=r.find(c);Q<0?Q=R:Q!==R&&(f=!0)}for(let c=0;c<this.orbitdefs[o].size;c++){if(!n[c]||r.find(c)!==c)continue;let L=[],p=[],k=0;for(let d=0;d<this.orbitdefs[o].size;d++)r.find(d)===c&&(L[k]=d,p[d]=k,k++);if(f?g.push(\`\${this.orbitnames[o]}_p\${c}\`):g.push(this.orbitnames[o]),l){e.push(new JI(k,this.orbitdefs[o].mod)),B.push(this.solved.orbits[o].remapVS(L,k));for(let d=0;d<this.moveops.length;d++)I[d].push(this.moveops[d].orbits[o].remap(L,p,k))}else{e.push(new JI(k,1)),B.push(this.solved.orbits[o].remapVS(L,k).killOri());for(let d=0;d<this.moveops.length;d++)I[d].push(this.moveops[d].orbits[o].remap(L,p,k).killOri())}}}return new OB(g,e,new _B(B),this.movenames,I.map(o=>new Je(o)),this.isRotation,this.forcenames)}scramble(g){this.solved=this.solved.mul(this.getScrambleTransformation(g))}getScrambleTransformation(g){g<100&&(g=100);let e=[];for(let I=0;I<this.moveops.length;I++)e[I]=this.moveops[I];for(let I=0;I<e.length;I++){let o=Math.floor(Math.random()*e.length),t=e[I];e[I]=e[o],e[o]=t}g<e.length&&(g=e.length);for(let I=0;I<g;I++){let o=Math.floor(Math.random()*e.length),t=Math.floor(Math.random()*e.length),i=Math.floor(Math.random()*this.moveops.length);e[o]=e[o].mul(e[t]).mul(this.moveops[i]),Math.random()<.1&&(e[o]=e[o].mul(this.moveops[i]))}let B=e[0];for(let I=1;I<e.length;I++)B=B.mul(e[I]);return B}reassemblySize(){let g=BigInt(1);for(let e=0;e<this.orbitdefs.length;e++)g*=this.orbitdefs[e].reassemblySize();return g}},Ee=class{constructor(g,e,B){this.perm=g;this.ori=e;this.orimod=B}static e(g,e){return new Ee(we(g),rB(g),e)}mul(g){let e=this.perm.length,B=new Array(e);if(this.orimod===1){for(let I=0;I<e;I++)B[I]=this.perm[g.perm[I]];return new Ee(B,this.ori,this.orimod)}else{let I=new Array(e);for(let o=0;o<e;o++)B[o]=this.perm[g.perm[o]],I[o]=(this.ori[g.perm[o]]+g.ori[o])%this.orimod;return new Ee(B,I,this.orimod)}}inv(){let g=this.perm.length,e=new Array(g),B=new Array(g);for(let I=0;I<g;I++)e[this.perm[I]]=I,B[this.perm[I]]=(this.orimod-this.ori[I])%this.orimod;return new Ee(e,B,this.orimod)}equal(g){let e=this.perm.length;for(let B=0;B<e;B++)if(this.perm[B]!==g.perm[B]||this.ori[B]!==g.ori[B])return!1;return!0}killOri(){let g=this.perm.length;for(let e=0;e<g;e++)this.ori[e]=0;return this.orimod=1,this}toPerm(){let g=this.orimod;if(g===1)return new Xg(this.perm);let e=this.perm.length,B=new Array(e*g);for(let I=0;I<e;I++)for(let o=0;o<g;o++)B[I*g+o]=g*this.perm[I]+(this.ori[I]+o)%g;return new Xg(B)}identicalPieces(){let g=[],e=this.perm.length,B=[];for(let I=0;I<e;I++){let o=this.perm[I];if(g[o]===void 0){let t=[I];g[o]=!0;for(let i=I+1;i<e;i++)this.perm[i]===o&&t.push(i);B.push(t)}}return B}order(){return this.toPerm().order()}isIdentity(){let g=this.perm.length;if(this.perm===we(g)&&this.ori===rB(g))return!0;for(let e=0;e<g;e++)if(this.perm[e]!==e||this.ori[e]!==0)return!1;return!0}zeroOris(){let g=this.perm.length;if(this.ori===rB(g))return!0;for(let e=0;e<g;e++)if(this.ori[e]!==0)return!1;return!0}remap(g,e,B){let I=new Array(B),o=new Array(B);for(let t=0;t<B;t++)I[t]=e[this.perm[g[t]]],o[t]=this.ori[g[t]];return new Ee(I,o,this.orimod)}remapVS(g,e){let B=new Array(e),I=new Array(e),o=0,t=[];for(let i=0;i<e;i++){let r=this.perm[g[i]];t[r]===void 0&&(t[r]=o++),B[i]=t[r],I[i]=this.ori[g[i]]}return new Ee(B,I,this.orimod)}appendDefinition(g,e,B,I=!0){if(!(I&&this.isIdentity())&&(g.push(e),g.push(this.perm.map(o=>o+1).join(" ")),!this.zeroOris()))if(B){let o=new Array(this.ori.length);for(let t=0;t<o.length;t++)o[this.perm[t]]=this.ori[t];g.push(o.join(" "))}else g.push(this.ori.join(" "))}toKPuzzle(){let g=this.perm.length;return this.isIdentity()?(Ee.kcache[g]||(Ee.kcache[g]={permutation:we(g),orientation:rB(g)}),Ee.kcache[g]):{permutation:this.perm,orientation:this.ori}}},me=Ee;me.kcache=[];ri=class{constructor(g){this.orbits=g}internalMul(g){let e=[];for(let B=0;B<this.orbits.length;B++)e.push(this.orbits[B].mul(g.orbits[B]));return e}internalInv(){let g=[];for(let e of this.orbits)g.push(e.inv());return g}equal(g){for(let e=0;e<this.orbits.length;e++)if(!this.orbits[e].equal(g.orbits[e]))return!1;return!0}killOri(){for(let g of this.orbits)g.killOri();return this}toPerm(){let g=new Array,e=0;for(let I of this.orbits){let o=I.toPerm();g.push(o),e+=o.n}let B=new Array(e);e=0;for(let I of g){for(let o=0;o<I.n;o++)B[e+o]=e+I.p[o];e+=I.n}return new Xg(B)}identicalPieces(){let g=[],e=0;for(let B of this.orbits){let I=B.orimod,o=B.identicalPieces();for(let t=0;t<o.length;t++)g.push(o[t].map(i=>i*I+e));e+=I*B.perm.length}return g}order(){let g=1;for(let e of this.orbits)g=Nr(g,e.order());return g}},Je=class extends ri{constructor(g){super(g)}mul(g){return new Je(this.internalMul(g))}mulScalar(g){if(g===0)return this.e();let e=this;for(g<0&&(e=e.inv(),g=-g);(g&1)===0;)e=e.mul(e),g>>=1;if(g===1)return e;let B=e,I=this.e();for(;g>0;)g&1&&(I=I.mul(B)),g>1&&(B=B.mul(B)),g>>=1;return I}inv(){return new Je(this.internalInv())}e(){return new Je(this.orbits.map(g=>me.e(g.perm.length,g.orimod)))}},_B=class extends ri{constructor(g){super(g)}mul(g){return new _B(this.internalMul(g))}},ni=class{constructor(g){this.n=g;this.heads=new Array(g);for(let e=0;e<g;e++)this.heads[e]=e}find(g){let e=this.heads[g];return this.heads[e]===e||(e=this.find(this.heads[e]),this.heads[g]=e),e}union(g,e){let B=this.find(g),I=this.find(e);B<I?this.heads[I]=B:B>I&&(this.heads[B]=I)}}});var Ei,cl=U(()=>{"use strict";Ei={"2x2x2":"c f 0","3x3x3":"c f 0.333333333333333","4x4x4":"c f 0.5 f 0","5x5x5":"c f 0.6 f 0.2","6x6x6":"c f 0.666666666666667 f 0.333333333333333 f 0","7x7x7":"c f 0.714285714285714 f 0.428571428571429 f 0.142857142857143","8x8x8":"c f 0.75 f 0.5 f 0.25 f 0","9x9x9":"c f 0.777777777777778 f 0.555555555555556 f 0.333333333333333 f 0.111111111111111","10x10x10":"c f 0.8 f 0.6 f 0.4 f 0.2 f 0","11x11x11":"c f 0.818181818181818 f 0.636363636363636 f 0.454545454545455 f 0.272727272727273 f 0.0909090909090909","12x12x12":"c f 0.833333333333333 f 0.666666666666667 f 0.5 f 0.333333333333333 f 0.166666666666667 f 0","13x13x13":"c f 0.846153846153846 f 0.692307692307692 f 0.538461538461538 f 0.384615384615385 f 0.230769230769231 f 0.0769230769230769","20x20x20":"c f 0 f .1 f .2 f .3 f .4 f .5 f .6 f .7 f .8 f .9","30x30x30":"c f 0 f .066667 f .133333 f .2 f .266667 f .333333 f .4 f .466667 f .533333 f .6 f .666667 f .733333 f .8 f .866667 f .933333","40x40x40":"c f 0 f .05 f .1 f .15 f .2 f .25 f .3 f .35 f .4 f .45 f .5 f .55 f .6 f .65 f .7 f .75 f .8 f .85 f .9 f .95",skewb:"c v 0","master skewb":"c v 0.275","professor skewb":"c v 0 v 0.38","compy cube":"c v 0.915641442663986",helicopter:"c e 0.707106781186547","curvy copter":"c e 0.83",dino:"c v 0.577350269189626","little chop":"c e 0",pyramorphix:"t e 0",mastermorphix:"t e 0.346184634065199",pyraminx:"t v 0.333333333333333 v 1.66666666666667",tetraminx:"t v 0.333333333333333","master pyraminx":"t v 0 v 1 v 2","master tetraminx":"t v 0 v 1","professor pyraminx":"t v -0.2 v 0.6 v 1.4 v 2.2","professor tetraminx":"t v -0.2 v 0.6 v 1.4","Jing pyraminx":"t f 0","master pyramorphix":"t e 0.866025403784437",megaminx:"d f 0.7",gigaminx:"d f 0.64 f 0.82",teraminx:"d f 0.64 f 0.76 f 0.88",petaminx:"d f 0.64 f 0.73 f 0.82 f 0.91",examinx:"d f 0.64 f 0.712 f 0.784 f 0.856 f 0.928",zetaminx:"d f 0.64 f 0.7 f 0.76 f 0.82 f 0.88 f 0.94",yottaminx:"d f 0.64 f 0.6914 f 0.7429 f 0.7943 f 0.8457 f 0.8971 f 0.9486",pentultimate:"d f 0","master pentultimate":"d f 0.1","elite pentultimate":"d f 0 f 0.145905",starminx:"d v 0.937962370425399","starminx 2":"d f 0.23606797749979","pyraminx crystal":"d f 0.447213595499989",chopasaurus:"d v 0","big chop":"d e 0","skewb diamond":"o f 0",FTO:"o f 0.333333333333333","master FTO":"o f 0.5 f 0","Christopher's jewel":"o v 0.577350269189626",octastar:"o e 0","Trajber's octahedron":"o v 0.433012701892219","radio chop":"i f 0",icosamate:"i v 0","icosahedron 2":"i v 0.18759247376021","icosahedron 3":"i v 0.18759247376021 e 0","icosahedron static faces":"i v 0.84","icosahedron moving faces":"i v 0.73","Eitan's star":"i f 0.61803398874989","2x2x2 + dino":"c f 0 v 0.577350269189626","2x2x2 + little chop":"c f 0 e 0","dino + little chop":"c v 0.577350269189626 e 0","2x2x2 + dino + little chop":"c f 0 v 0.577350269189626 e 0","megaminx + chopasaurus":"d f 0.61803398875 v 0","starminx combo":"d f 0.23606797749979 v 0.937962370425399"}});function Qi(A){let g=new iA(0,0,0,0);for(let e=0;e<A.length;e++)g=g.sum(A[e]);return g.smul(1/A.length)}function Ll(A,g,e,B){let I=B[A].intersect3(B[g],B[e]);if(!I)return I;for(let o=0;o<B.length;o++)if(o!==A&&o!==g&&o!==e){let t=B[o].b*I.b+B[o].c*I.c+B[o].d*I.d;if(B[o].a>0&&t>B[o].a||B[o].a<0&&t<B[o].a)return!1}return I}var iA,li=U(()=>{"use strict";iA=class{constructor(g,e,B,I){this.a=g;this.b=e;this.c=B;this.d=I}mul(g){return new iA(this.a*g.a-this.b*g.b-this.c*g.c-this.d*g.d,this.a*g.b+this.b*g.a+this.c*g.d-this.d*g.c,this.a*g.c-this.b*g.d+this.c*g.a+this.d*g.b,this.a*g.d+this.b*g.c-this.c*g.b+this.d*g.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(g){return Math.hypot(this.a-g.a,this.b-g.b,this.c-g.c,this.d-g.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(g){return new iA(0,this.c*g.d-this.d*g.c,this.d*g.b-this.b*g.d,this.b*g.c-this.c*g.b)}dot(g){return this.b*g.b+this.c*g.c+this.d*g.d}normalize(){let g=Math.sqrt(this.dot(this));return new iA(this.a/g,this.b/g,this.c/g,this.d/g)}makenormal(){return new iA(0,this.b,this.c,this.d).normalize()}normalizeplane(){let g=Math.hypot(this.b,this.c,this.d);return new iA(this.a/g,this.b/g,this.c/g,this.d/g)}smul(g){return new iA(this.a*g,this.b*g,this.c*g,this.d*g)}sum(g){return new iA(this.a+g.a,this.b+g.b,this.c+g.c,this.d+g.d)}sub(g){return new iA(this.a-g.a,this.b-g.b,this.c-g.c,this.d-g.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new iA(this.a,-this.b,-this.c,-this.d)}det3x3(g,e,B,I,o,t,i,r,n){return g*(o*n-t*r)+e*(t*i-I*n)+B*(I*r-o*i)}rotateplane(g){let e=g.mul(new iA(0,this.b,this.c,this.d)).mul(g.invrot());return e.a=this.a,e}orthogonal(){let g=Math.abs(this.b),e=Math.abs(this.c),B=Math.abs(this.d);return g<e&&g<B?this.cross(new iA(0,1,0,0)).normalize():e<g&&e<B?this.cross(new iA(0,0,1,0)).normalize():this.cross(new iA(0,0,0,1)).normalize()}pointrotation(g){let e=this.normalize();if(g=g.normalize(),e.sub(g).len()<1e-9)return new iA(1,0,0,0);let B=e.sum(g);B.len()<1e-9?B=B.orthogonal():B=B.normalize();let I=e.cross(B);return I.a=e.dot(B),I}unproject(g){return this.sum(g.smul(-this.dot(g)/(this.len()*g.len())))}rotatepoint(g){return g.mul(this).mul(g.invrot())}rotateface(g){return g.map(e=>e.rotatepoint(this))}intersect3(g,e){let B=this.det3x3(this.b,this.c,this.d,g.b,g.c,g.d,e.b,e.c,e.d);return Math.abs(B)<1e-9?!1:new iA(0,this.det3x3(this.a,this.c,this.d,g.a,g.c,g.d,e.a,e.c,e.d)/B,this.det3x3(this.b,this.a,this.d,g.b,g.a,g.d,e.b,e.a,e.d)/B,this.det3x3(this.b,this.c,this.a,g.b,g.c,g.a,e.b,e.c,e.a)/B)}side(g){return g>1e-9?1:g<-1e-9?-1:0}cutface(g){let e=this.a,B=0,I=null;for(let o=0;o<g.length;o++)B|=1<<this.side(g[o].dot(this)-e)+1;if((B&5)===5){I=[];let o=g.map(t=>this.side(t.dot(this)-e));for(let t=-1;t<=1;t+=2){let i=[];for(let r=0;r<g.length;r++){(o[r]===t||o[r]===0)&&i.push(g[r]);let n=(r+1)%g.length;if(o[r]+o[n]===0&&o[r]!==0){let l=g[r].dot(this)-e,Q=g[n].dot(this)-e,f=l/(l-Q),c=g[r].smul(1-f).sum(g[n].smul(f));i.push(c)}}I.push(i)}}return I}cutfaces(g){let e=[];for(let B=0;B<g.length;B++){let I=g[B],o=this.cutface(I);o?(e.push(o[0]),e.push(o[1])):e.push(I)}return e}faceside(g){let e=this.a;for(let B=0;B<g.length;B++){let I=this.side(g[B].dot(this)-e);if(I!==0)return I}throw new Error("Could not determine side of plane in faceside")}sameplane(g){let e=this.normalize(),B=g.normalize();return e.dist(B)<1e-9||e.dist(B.smul(-1))<1e-9}makecut(g){return new iA(g,this.b,this.c,this.d)}}});function Rl(){let A=Math.sqrt(.5);return[new iA(A,A,0,0),new iA(A,0,A,0)]}function ul(){return[new iA(.5,.5,.5,.5),new iA(.5,.5,.5,-.5)]}function hl(){let A=2*Math.PI/10,g=.5+.3*Math.sqrt(5),e=.5+.1*Math.sqrt(5),B=Math.sqrt(g*g+e*e);return g/=B,e/=B,[new iA(Math.cos(A),g*Math.sin(A),e*Math.sin(A),0),new iA(.5,.5,.5,.5)]}function yl(){let A=.16666666666666666+Math.sqrt(5)/6,g=2/3+Math.sqrt(5)/3,e=Math.sqrt(A*A+g*g);A/=e,g/=e;let B=2*Math.PI/6;return[new iA(Math.cos(B),A*Math.sin(B),g*Math.sin(B),0),new iA(Math.cos(B),-A*Math.sin(B),g*Math.sin(B),0)]}function pl(){let A=Math.sqrt(.5);return[new iA(.5,.5,.5,.5),new iA(A,0,0,A)]}function Fl(A){let g=[new iA(1,0,0,0)];for(let e=0;e<g.length;e++)for(let B=0;B<A.length;B++){let I=A[B].mul(g[e]),o=I.smul(-1),t=!1;for(let i=0;i<g.length;i++)if(I.dist(g[i])<si||o.dist(g[i])<si){t=!0;break}t||g.push(I)}return g}function Mr(A,g){let e=[],B=[];for(let I=0;I<g.length;I++){let o=A.rotateplane(g[I]),t=!1;for(let i=0;i<e.length;i++)if(o.dist(e[i])<si){t=!0;break}t||(e.push(o),B.push(g[I]))}return B}function Kr(A){let g=[];for(let e=1;e<A.length;e++)for(let B=e+1;B<A.length;B++){let I=Ll(0,e,B,A);if(I){let o=!1;for(let t=0;t<g.length;t++)if(I.dist(g[t])<si){o=!0;break}o||g.push(I)}}for(;;){let e=!1;for(let B=0;B<g.length;B++){let I=(B+1)%g.length;if(A[0].dot(g[B].cross(g[I]))<0){let o=g[B];g[B]=g[I],g[I]=o,e=!0}}if(!e)break}return g}var si,wl=U(()=>{"use strict";li();si=1e-9});function ai(A,g){let e=A[0].p.length,B=sl(e),I=[],o=[],t=[],i=[],r=[];function n(c){for(let R=c.p.length-1;R>=0;R--){let L=c.p[R];if(L!==R){if(!I[R][L])return!1;c=c.mul(o[R][L])}}return!0}function l(c,R,L){i[c].push(R),r[c].push(L);for(let p=0;p<I[c].length;p++)I[c][p]&&Q(c,I[c][p].mul(R),L+t[c][p])}function Q(c,R,L){let p=R.p[c];if(!I[c][p]){I[c][p]=R,o[c][p]=R.inv(),t[c][p]=L;for(let d=0;d<i[c].length;d++)Q(c,R.mul(i[c][d]),L+r[c][d]);return}let k=R.mul(o[c][p]);n(k)||l(c-1,k,L+t[c][p])}function f(){I=[],o=[],i=[],t=[],r=[];for(let L=0;L<e;L++)I.push([]),o.push([]),t.push([]),i.push([]),r.push([]),I[L][L]=B,o[L][L]=B,t[L][L]=0;let c=0,R=BigInt(1);for(let L=0;L<A.length;L++){l(e-1,A[L],1),R=BigInt(1);let p=0,k=0,d=[],N=new xr;for(let K=0;K<e;K++){let Y=0,O=0;for(let _=0;_<e;_++)I[K][_]&&(Y++,O+=t[K][_],K!==_&&c++);p+=i[K].length,R*=BigInt(Y),Y>1&&N.multiply(Y);let QA=O/Y;d.push(QA),k+=QA}g(\`\${L}: sz \${R} T \${p} sol \${k} none \${c} mults \${N.toString()}\`)}return R}return f()}var xr,Yr=U(()=>{"use strict";ii();xr=class{constructor(){this.mult=[]}multiply(g){for(let e=2;e*e<=g;e++)for(;g%e===0;)this.mult[e]!==void 0?this.mult[e]++:this.mult[e]=1,g/=e;g>1&&(this.mult[g]!==void 0?this.mult[g]++:this.mult[g]=1)}toString(){let g="";for(let e=0;e<this.mult.length;e++)this.mult[e]!==void 0&&(g!==""&&(g+="*"),g+=e,this.mult[e]>1&&(g+=\`^\${this.mult[e]}\`));return g}}});function lL(A,g){let e=[];for(let B of A)for(let I of g)e.push(I.rotate(B));return e}function fL(){return{4:[["F","D","L","R"]],6:[["F","D","L","U","R"],["R","F","","B",""]],8:[["F","D","L","R"],["D","F","BR",""],["BR","D","","BB"],["BB","BR","U","BL"]],12:[["U","F","","","",""],["F","U","R","C","A","L"],["R","F","","","E",""],["E","R","","BF","",""],["BF","E","BR","BL","I","D"]],20:[["R","C","F","E"],["F","R","L","U"],["L","F","A",""],["E","R","G","I"],["I","E","S","H"],["S","I","J","B"],["B","S","K","D"],["K","B","M","O"],["O","K","P","N"],["P","O","Q",""]]}}function DL(){return{4:{F:"#00ff00",D:"#ffff00",L:"#ff0000",R:"#2266ff"},6:{U:"#ffffff",F:"#44ee00",R:"#ff0000",D:"#ffff00",B:"#2266ff",L:"#ff8000"},8:{U:"#ffffff",F:"#ff0000",R:"#44ee00",D:"#ffff00",BB:"#2266ff",L:"#8800dd",BL:"#ff8000",BR:"#aaaaaa "},12:{U:"#ffffff",F:"#008800",R:"#ff0000",C:"#ffffd0",A:"#3399ff",L:"#8800dd",E:"#ff66cc",BF:"#99ff00",BR:"#0000ff",BL:"#ffff00",I:"#ff8000",D:"#aaaaaa "},20:{R:"#db69f0",C:"#178fde",F:"#23238b",E:"#9cc726",L:"#2c212d",U:"#177fa7",A:"#e0de7f",G:"#2b57c0",I:"#41126b",S:"#4b8c28",H:"#7c098d",J:"#7fe7b4",B:"#85fb74",K:"#3f4bc3",D:"#0ff555",M:"#f1c2c8",O:"#58d340",P:"#c514f2",N:"#14494e",Q:"#8b1be1"}}}function LL(){return{4:[["FLR",[0,1,0]],["F",[0,0,1]]],6:[["U",[0,1,0]],["F",[0,0,1]]],8:[["U",[0,1,0]],["F",[0,0,1]]],12:[["U",[0,1,0]],["F",[0,0,1]]],20:[["GUQMJ",[0,1,0]],["F",[0,0,1]]]}}function fi(A,g){for(let e=0;e<A.length;e++)if(A[e][0].dist(g)<eg)return e;throw new Error("Element not found")}function ml(){return Ei}function dl(A){return Ei[A]}function Xo(A){let g=A.split(/ /).filter(Boolean);if(g.length%2===0)return null;let e=g[0];if(e!=="o"&&e!=="c"&&e!=="i"&&e!=="d"&&e!=="t")return null;let B=[];for(let I=1;I<g.length;I+=2){if(g[I]!=="f"&&g[I]!=="v"&&g[I]!=="e")return null;B.push({cutType:g[I],distance:parseFloat(g[I+1])})}return{shape:e,cuts:B}}function vr(A,g={}){let e=Xo(A);if(e===null)throw new Error("Could not parse the puzzle description");let B=new $o(e,Object.assign({},{allMoves:!0},g));return B.allstickers(),B.genperms(),B}function Ul(A,g){return vr(Ei[A],g)}function RL(A,g,e){let B=!1;e-g[1]<g[0]&&(A=[A[2],A[3],A[0],A[1]],g=[e-g[1],e-g[0]],B=!0);let I=A[0],o="";if(g[0]===0&&g[1]===e)I=\`\${I}v\`;else if(g[0]===g[1])g[1]>0&&(o=String(g[1]+1));else if(g[0]===0)I=I.toLowerCase(),g[1]>1&&(o=String(g[1]+1));else throw new Error(\`We only support slice and outer block moves right now. \${g}\`);return[o+I,B]}function uL(A,g){let e=[],B=0;for(;B<A.length;){B>0&&B<A.length&&A[B]==="_"&&B++;let I="";for(let o of g)A.substr(B).startsWith(o[1])&&o[1].length>I.length&&(I=o[1]);if(I!=="")e.push(I),B+=I.length;else throw new Error(\`Could not split \${A} into face names.\`)}return e}function Di(A,g){return[A.b/g,-A.c/g,A.d/g]}function br(A,g){let e=[],B=A.length;for(let I=0;I<B;I++){let o=Di(A.get(B-I-1),g);e[3*I]=o[0],e[3*I+1]=o[1],e[3*I+2]=o[2]}return e}var nB,HI,eg,sL,aL,cL,Sl,kl,$o,ci,Zo=U(()=>{"use strict";SA();ZQ();Sr();kr();ii();Dl();cl();wl();li();Yr();nB=class{constructor(g){this.coords=new Array(g.length*3);for(let e=0;e<g.length;e++)this.coords[3*e]=g[e].b,this.coords[3*e+1]=g[e].c,this.coords[3*e+2]=g[e].d;this.length=g.length}get(g){return new iA(0,this.coords[3*g],this.coords[3*g+1],this.coords[3*g+2])}centermass(){let g=0,e=0,B=0;for(let I=0;I<this.length;I++)g+=this.coords[3*I],e+=this.coords[3*I+1],B+=this.coords[3*I+2];return new iA(0,g/this.length,e/this.length,B/this.length)}rotate(g){let e=[];for(let B=0;B<this.length;B++)e.push(this.get(B).rotatepoint(g));return new nB(e)}rotateforward(){let g=[];for(let e=1;e<this.length;e++)g.push(this.get(e));return g.push(this.get(0)),new nB(g)}},HI=class{constructor(g,e,B){this.face=g;this.left=e;this.right=B}split(g){let e=g.cutface(this.face);return e!==null&&(this.left===void 0?(this.left=new HI(e[0]),this.right=new HI(e[1])):(this.left=this.left?.split(g),this.right=this.right?.split(g))),this}collect(g,e){return this.left===void 0?g.push(new nB(this.face)):e?(this.left?.collect(g,!1),this.right?.collect(g,!0)):(this.right?.collect(g,!1),this.left?.collect(g,!0)),g}};eg=1e-9,sL="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",aL=!1;cL={4:{v:["DFR","DLF","DRL","FLR"],e:["FR","LF","DF","DL","RD","RL"],c:["DF","FD","RL","LR"]},6:{v:["URF","UBR","ULB","UFL","DFR","DRB","DBL","DLF"],e:["UF","UR","UB","UL","DF","DR","DB","DL","FR","FL","BR","BL"],c:["UB","LU","FU","RU","BU","DF"]},8:{v:["UBBBRR","URFL","ULBLBB","DBRBBBL","DBLLF","DFRBR"],e:["UL","UBB","UR","BRD","BLD","FD","BRR","FR","FL","BLL","BLBB","BRBB"],c:["BBU","LU","RU","BRD","FD","BLD","DF","UBB"]},12:{v:["URF","UFL","ULBL","UBLBR","UBRR","DEBF","DBFI","DIA","DAC","DCE","LAI","ALF","FCA","CFR","REC","ERBR","BRBFE","BFBRBL","BLIBF","IBLL"],e:["UF","UR","UBR","UBL","UL","ER","EBR","EBF","ED","EC","IBF","IBL","IL","IA","ID","AC","CF","FA","BFBR","BRBL","BLBF","CD","AD","AL","FL","FR","CR","BFD","BRR","BLL"],c:["UF","FU","DBF","BFD","AD","CD","BRU","BLU","LA","RA","EBR","IBL"]},20:{v:["FLPQU","FUGER","FRCAL","HCREI","ISBDH","JSIEG","BSJMK","MQPOK","ONDBK","NOPLA","UQMJG","DNACH"],e:["FU","FL","FR","EG","ER","EI","SJ","SI","SB","KM","KB","KO","PQ","PO","PL","UG","JG","MQ","UQ","HC","HD","ND","NA","JM","CA","AL","CR","HI","DB","NO"],c:["FU","UF","GE","EG","JS","SJ","MK","KM","QP","PQ","LA","AL","RC","CR","IH","HI","BD","DB","ON","NO"]}};Sl=["c","t","o","d","i"],kl=["f","v","e"];$o=class{constructor(g,e){this.puzzleDescription=g;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.notationMapper=new zB;this.addNotationMapper="";this.setReidOrder=!1;let B="genperms";this.options=new ti(e),this.options.verbosity>0&&console.log(this.header("# ")),this.create(g)}create(g){let{shape:e,cuts:B}=g;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let I=null;switch(e){case"c":{I=Rl();break}case"o":{I=pl();break}case"i":{I=yl();break}case"t":{I=ul();break}case"d":{I=hl();break}default:throw new Error(\`Bad shape argument: \${e}\`)}this.rotations=Fl(I),this.options.verbosity&&console.log(\`# Rotations: \${this.rotations.length}\`);let o=I[0];this.baseplanerot=Mr(o,this.rotations);let t=this.baseplanerot.map(G=>o.rotateplane(G));this.baseplanes=t,this.baseFaceCount=t.length;let i=fL()[t.length];this.net=i,this.colors=DL()[t.length],this.options.verbosity>0&&console.log(\`# Base planes: \${t.length}\`);let r=Kr(t),n=new iA(0,0,0,0);this.options.verbosity>0&&console.log(\`# Face vertices: \${r.length}\`);let l=t[0].makenormal(),Q=r[0].sum(r[1]).makenormal(),f=r[0].makenormal(),c=new iA(1,l.b,l.c,l.d);this.options.verbosity>0&&console.log(\`# Boundary is \${c}\`);let L=Mr(c,this.rotations).map(G=>c.rotateplane(G)),p=Kr(L);this.edgedistance=p[0].sum(p[1]).smul(.5).dist(n),this.vertexdistance=p[0].dist(n);let k=[],d=[],N=!1,K=!1,Y=!1;for(let G of B){let P=null,AA=0;switch(G.cutType){case"f":{P=l,AA=1,N=!0;break}case"v":{P=f,AA=this.vertexdistance,Y=!0;break}case"e":{P=Q,AA=this.edgedistance,K=!0;break}default:throw new Error(\`Bad cut argument: \${G.cutType}\`)}k.push(P.makecut(G.distance)),d.push(G.distance<AA)}this.options.addRotations&&(N||k.push(l.makecut(10)),Y||k.push(f.makecut(10)),K||k.push(Q.makecut(10))),this.basefaces=[];for(let G of this.baseplanerot){let P=G.rotateface(p);this.basefaces.push(new nB(P))}let O=[],QA=[],_=[],rA=[],M=p.length;function q(G,P,AA){for(let $ of G)if($[0].dist(P)<eg){$.push(AA);return}G.push([P,AA])}for(let G=0;G<this.baseplanerot.length;G++){let P=this.baseplanerot[G].rotateface(p);for(let AA=0;AA<P.length;AA++){let $=(AA+1)%P.length,sA=P[AA].sum(P[$]).smul(.5);q(rA,sA,G)}}let z=[];for(let G=0;G<this.baseplanerot.length;G++){let P=this.baseplanerot[G].rotateface(p),AA=[];for(let $=0;$<P.length;$++){let sA=($+1)%P.length,dA=P[$].sum(P[sA]).smul(.5),Ig=rA[fi(rA,dA)];if(G===Ig[1])AA.push(Ig[2]);else if(G===Ig[2])AA.push(Ig[1]);else throw new Error("Could not find edge")}z.push(AA)}let v={},H=[];H.push(i[0][0]),v[i[0][0]]=0,H[z[0][0]]=i[0][1],v[i[0][1]]=z[0][0];for(let G of i){let P=G[0],AA=v[P];if(AA===void 0)throw new Error("Bad edge description; first edge not connected");let $=-1;for(let sA=0;sA<z[AA].length;sA++){let dA=H[z[AA][sA]];if(dA!==void 0&&dA===G[1]){$=sA;break}}if($<0)throw new Error("First element of a net not known");for(let sA=2;sA<G.length;sA++){if(G[sA]==="")continue;let dA=z[AA][(sA+$-1)%M],Ig=H[dA];if(Ig!==void 0&&Ig!==G[sA])throw new Error("Face mismatch in net");H[dA]=G[sA],v[G[sA]]=dA}}for(let G=0;G<this.baseplanerot.length;G++){let P=this.baseplanerot[G].rotateface(p),AA=c.rotateplane(this.baseplanerot[G]),$=H[G];O.push([P,$]),QA.push([AA,$])}for(let G=0;G<this.baseplanerot.length;G++){let P=this.baseplanerot[G].rotateface(p),AA=H[G];for(let $=0;$<P.length;$++){let sA=($+1)%P.length,dA=P[$].sum(P[sA]).smul(.5),Ig=($+2)%P.length,bC=P[sA].sum(P[Ig]).smul(.5),vC=fi(rA,dA),JC=fi(rA,bC);q(_,P[sA],[AA,JC,vC])}}this.swizzler=new YI(O.map(G=>G[1]));let X=this.swizzler.prefixFree?"":"_",CA=cL[this.baseFaceCount],gA=[];for(let G=0;G<this.baseFaceCount;G++)gA[1<<G]=G;{let G=CA.v;for(let P of G){let AA=this.swizzler.splitByFaceNames(P),$=0;for(let sA of AA)$|=1<<sA;gA[$]=AA[0]}}{let G=CA.e;for(let P of G){let AA=this.swizzler.splitByFaceNames(P),$=0;for(let sA of AA)$|=1<<sA;gA[$]=AA[0]}}{let G=CA.c;for(let P of G){let AA=this.swizzler.splitByFaceNames(P),$=1<<AA[0]|1<<this.baseFaceCount;gA[$]=AA[1]}}for(let G=0;G<rA.length;G++){if(rA[G].length!==3)throw new Error(\`Bad length in edge names \${rA[G]}\`);let P=rA[G][1],AA=rA[G][2],$=H[P],sA=H[AA],dA=1<<P|1<<AA;gA[dA]===P?$=$+X+sA:$=sA+X+$,rA[G]=[rA[G][0],$]}for(let G=0;G<_.length;G++){let P=0;if(_[G].length<4)throw new Error("Bad length in vertex names");for(let dA=1;dA<_[G].length;dA++)P|=1<<v[_[G][dA][0]];let AA=gA[P],$=-1;for(let dA=1;dA<_[G].length;dA++)AA===v[_[G][dA][0]]&&($=dA);if($<0)throw new Error("Internal error; couldn't find face name when fixing corners");let sA="";for(let dA=1;dA<_[G].length;dA++){dA===1?sA=_[G][$][0]:sA=sA+X+_[G][$][0];for(let Ig=1;Ig<_[G].length;Ig++)if(_[G][$][1]===_[G][Ig][2]){$=Ig;break}}_[G]=[_[G][0],sA]}this.markedface=gA,this.options.verbosity>1&&(console.log(\`# Face names: \${O.map(G=>G[1]).join(" ")}\`),console.log(\`# Edge names: \${rA.map(G=>G[1]).join(" ")}\`),console.log(\`# Vertex names: \${_.map(G=>G[1]).join(" ")}\`));let aA=[];for(let G of QA)aA.push([G[0].makenormal(),G[1],"f"]);for(let G of rA)aA.push([G[0].makenormal(),G[1],"e"]);for(let G of _)aA.push([G[0].makenormal(),G[1],"v"]);this.facenames=O,this.faceplanes=QA,this.edgenames=rA,this.vertexnames=_,this.geonormals=aA;let JA=aA.map(G=>G[1]);this.swizzler.setGripNames(JA),this.options.verbosity>0&&console.log(\`# Distances: face \${1} edge \${this.edgedistance} vertex \${this.vertexdistance}\`);for(let G=0;G<k.length;G++)for(let P of this.rotations){let AA=k[G].rotateplane(P),$=!1;for(let sA of this.moveplanes)if(AA.sameplane(sA)){$=!0;break}$||(this.moveplanes.push(AA),d[G]&&this.moveplanes2.push(AA))}let WA=new HI(p),eA=this.moveplanes2.slice(),PA=31;for(let G=0;G<eA.length;G++){let P=G+Math.floor((eA.length-G)*(PA/65536));WA=WA.split(eA[P]),eA[P]=eA[G],PA=(PA*1657+101)%65536}let xA=WA.collect([],!0);this.faces=xA,this.options.verbosity>0&&console.log(\`# Faces is now \${xA.length}\`),this.stickersperface=xA.length;let vg=[],yg=Qi(p);for(let G of this.rotations){let P=G.rotateface(p);yg.dist(Qi(P))<eg&&vg.push(G)}let Jg=new Array(xA.length),gg=[];for(let G=0;G<xA.length;G++){let P=xA[G].centermass();gg.push([yg.dist(P),P,G])}gg.sort((G,P)=>G[0]-P[0]);for(let G=0;G<xA.length;G++){let P=gg[G][2];if(!Jg[P]){Jg[P]=!0;for(let AA of vg){let $=xA[P].rotate(AA),sA=$.centermass();for(let dA=G+1;dA<xA.length&&!(gg[dA][0]-gg[G][0]>eg);dA++){let Ig=gg[dA][2];if(!Jg[Ig]&&sA.dist(gg[dA][1])<eg){Jg[Ig]=!0,xA[Ig]=$;break}}}}}this.shortedge=1e99;for(let G of xA)for(let P=0;P<G.length;P++){let AA=(P+1)%G.length,$=G.get(P).dist(G.get(AA));$<this.shortedge&&(this.shortedge=$)}this.options.verbosity>0&&console.log(\`# Short edge is \${this.shortedge}\`),e==="c"&&N&&!K&&!Y&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),e==="c"&&Y&&!N&&!K&&(this.addNotationMapper="SkewbMapper"),e==="t"&&(Y||N)&&!K&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),e==="o"&&N&&(this.notationMapper=new bI(this.swizzler,new YI(["F","D","L","BL","R","U","BR","B"])),K||Y||(this.addNotationMapper="FTOMapper")),e==="d"&&N&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new bI(this.swizzler,new YI(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(g){return this.keyface2(g.centermass())}keyface2(g){let e="",B=String.fromCharCode;for(let I of this.moveplanesets)if(I.length>0){let o=g.dot(I[0]),t=0,i=1;for(;i*2<=I.length;)i*=2;for(;i>0;i>>=1)t+i<=I.length&&o>I[t+i-1].a&&(t+=i);if(t<47)e=e+B(33+t);else if(t<47+47*47)e=e+B(33+47+Math.floor(t/47)-1)+B(33+t%47);else if(t<47+47*47+47*47*47)e=e+B(33+47+Math.floor((t-47)/(47*47)-1))+B(33+47+Math.floor((t-47)/47)%47)+B(33+t%47);else throw Error("Too many slices for cubie encoding")}return e}keyface3(g){let e=g.centermass(),B=[];for(let I of this.moveplanesets)if(I.length>0){let o=e.dot(I[0]),t=0,i=1;for(;i*2<=I.length;)i*=2;for(;i>0;i>>=1)t+i<=I.length&&o>I[t+i-1].a&&(t+=i);B.push(t)}return B}findface(g){let e=this.keyface2(g),B=this.facelisthash.get(e);if(B.length===1)return B[0];for(let I=0;I+1<B.length;I++){let o=this.facelisthash.get(e)[I];if(Math.abs(g.dist(this.facecentermass[o]))<eg)return o}return B[B.length-1]}project2d(g,e,B){let I=this.facenames[g][0],o=(e+1)%I.length,t=this.baseplanes[g],i=I[o].sub(I[e]),r=i.len();i=i.normalize();let n=i.cross(t).normalize(),l=B[1].sub(B[0]),Q=l.len()/r;l=l.normalize();let f=l.b,c=l.c,R=i.smul(f).sub(n.smul(c)).smul(Q),L=n.smul(f).sum(i.smul(c)).smul(Q),p=new iA(0,B[0].b-R.dot(I[e]),B[0].c-L.dot(I[e]),0);return[R,L,p]}allstickers(){let g="allstickers";this.faces=lL(this.baseplanerot,this.faces),this.options.verbosity>0&&console.log(\`# Total stickers is now \${this.faces.length}\`),this.facecentermass=new Array(this.faces.length);for(let M=0;M<this.faces.length;M++)this.facecentermass[M]=this.faces[M].centermass();let e=[],B=[];for(let M of this.moveplanes){let q=M.makenormal(),z=!1;for(let v of B)q.sameplane(v.makenormal())&&(z=!0);z||(B.push(q),e.push([]))}for(let M of this.moveplanes2){let q=M.makenormal();for(let z=0;z<B.length;z++)if(q.sameplane(B[z])){e[z].push(M);break}}for(let M=0;M<e.length;M++){let q=e[M].map(v=>v.normalizeplane()),z=B[M];for(let v=0;v<q.length;v++)q[v].makenormal().dist(z)>eg&&(q[v]=q[v].smul(-1));q.sort((v,H)=>v.a-H.a),e[M]=q}this.moveplanesets=e,this.moveplanenormals=B;let I=e.map(M=>M.length);this.options.verbosity>0&&console.log(\`# Move plane sets: \${I}\`);let o=[];for(let M=0;M<e.length;M++)o.push([]);for(let M of this.rotations){if(Math.abs(Math.abs(M.a)-1)<eg)continue;let q=M.makenormal();for(let z=0;z<e.length;z++)if(q.sameplane(B[z])){o[z].push(M);break}}this.moverotations=o;for(let M=0;M<o.length;M++){let q=o[M],z=q[0].makenormal();for(let v=0;v<q.length;v++)z.dist(q[v].makenormal())>eg&&(q[v]=q[v].smul(-1));q.sort((v,H)=>v.angle()-H.angle()),o[M][0].dot(B[M])<0&&q.reverse()}let t=o.map(M=>1+M.length);this.movesetorders=t;let i=[],r="?";for(let M=0;M<e.length;M++){let q=B[M],z=null,v=null;for(let H of this.geonormals){let X=q.dot(H[0]);Math.abs(X-1)<eg?(v=[H[1],H[2]],r=H[2]):Math.abs(X+1)<eg&&(z=[H[1],H[2]],r=H[2])}if(v===null||z===null)throw new Error("Saw positive or negative sides as null");i.push([v[0],v[1],z[0],z[1],1+e[M].length]),this.addNotationMapper==="NxNxNCubeMapper"&&r==="f"&&(this.notationMapper=new Wo(1+e[M].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&e[0].length===1&&(this.notationMapper=new Vo(this.swizzler),this.addNotationMapper=""),this.addNotationMapper==="PyraminxOrTetraminxMapper"&&(e[0].length===2&&e[0][0].a===.333333333333333&&e[0][1].a===1.66666666666667?(this.notationMapper=new vI(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new jo(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&r==="f"&&(1+e[M].length===3&&(this.notationMapper=new _o(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&r==="f"&&(1+e[M].length===3&&(this.notationMapper=new Oo(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=i;let n=new Map,l=this.faces;for(let M=0;M<l.length;M++){let q=l[M],z=this.keyface(q);if(!n.get(z))n.set(z,[M]);else{let v=n.get(z);if(v.push(M),v.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let H=0;H<v.length;H++){let X=\`\${z} \${H}\`;n.set(X,[v[H]])}}}}this.facelisthash=n,this.options.verbosity>0&&console.log(\`# Cubies: \${n.size}\`);let Q=[],f=[],c=[];for(let M of n.values())if(M.length!==this.baseFaceCount){if(M.length>1){let q=M.map(CA=>l[CA].centermass()),z=Qi(q);for(let CA=0;M.length>2;CA++){let gA=!1;for(let aA=0;aA<M.length;aA++){let JA=(aA+1)%M.length;if(z.dot(q[aA].cross(q[JA]))<0){let WA=q[aA];q[aA]=q[JA],q[JA]=WA;let eA=M[aA];M[aA]=M[JA],M[JA]=eA,gA=!0}}if(!gA)break;if(CA>1e3)throw new Error("Bad epsilon math; too close to border")}let v=0;for(let CA of M)v|=1<<Math.floor(CA/this.stickersperface);let H=this.markedface[v],X=-1;for(let CA=0;CA<M.length;CA++)Math.floor(M[CA]/this.stickersperface)===H&&(X=CA);if(X<0)throw new Error("Could not find marked face in list");if(X!==0){let CA=M.slice();for(let gA=0;gA<M.length;gA++)M[gA]=CA[(X+gA)%M.length]}}for(let q=0;q<M.length;q++){let z=M[q];f[z]=Q.length,c[z]=q}Q.push(M)}this.cubies=Q,this.facetocubie=f,this.facetoord=c;let R=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],L=[],p=[0,0,0,0,0,0],k=[],d=[],N=0,K=[],Y=[],O=[],QA=[],_=M=>Q[M].map(q=>this.getfaceindex(q)).join(" "),rA=[];for(let M=0;M<Q.length;M++){let q=Q[M];if(q.length===0||d[M])continue;let z={},v=0;O.push(0),rA.push([]);let H=q.length,X=p[H]++,CA=R[H];(CA===void 0||H===this.baseFaceCount)&&(CA="CORE"),CA=CA+(X===0?"":X+1),L[N]=CA,k[N]=H;let gA=[M],aA=0;for(d[M]=!0;aA<gA.length;){let JA=gA[aA++],WA=_(JA);if((q.length>1||z[WA]===void 0)&&(z[WA]=v++),QA[JA]=z[WA],K[JA]=N,rA[N].push(JA),Y[JA]=O[N]++,gA.length<this.rotations.length){let eA=this.facecentermass[Q[JA][0]];for(let PA of o){let xA=this.facetocubie[this.findface(eA.rotatepoint(PA[0]))];d[xA]||(gA.push(xA),d[xA]=!0)}}}N++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let M=[["UF","UR","UB","UL","DF","DR","DB","DL","FR","FL","BR","BL"],["UFR","URB","UBL","ULF","DRF","DFL","DLB","DBR"],["U","L","F","R","B","D"]],q={};for(let z of M)for(let v=0;v<z.length;v++){let H=0;for(let X=0;X<z[v].length;X++)H|=1<<z[v].charCodeAt(X)-65;q[H]=v}for(let z of rA)for(let v of z){let H=0;for(let X of Q[v])H|=1<<this.facenames[this.getfaceindex(X)][1].charCodeAt(0)-65;Y[v]=q[H]}}if(this.cubiesetnums=K,this.cubieordnums=Y,this.cubiesetnames=L,this.cubieords=O,this.orbitoris=k,this.cubievaluemap=QA,this.cubiesetcubies=rA,this.options.fixedPieceType!==null){for(let M=0;M<Q.length;M++)if(this.options.fixedPieceType==="v"&&Q[M].length>2||this.options.fixedPieceType==="e"&&Q[M].length===2||this.options.fixedPieceType==="f"&&Q[M].length===1){this.fixedCubie=M;break}if(this.fixedCubie<0)throw new Error(\`Could not find a cubie of type \${this.options.fixedPieceType} to fix.\`)}this.options.verbosity>0&&console.log(\`# Cubie orbit sizes \${O}\`)}unswizzle(g){let e=this.notationMapper.notationToInternal(g);return e===null?null:e.modified({family:this.swizzler.unswizzle(e.family)})}stringToBlockMove(g){let e=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),B=g.match(e);if(B===null)throw new Error(\`Bad move passed \${g}\`);let I=B[4],o,t;if(B[2]!==void 0){if(B[3]===void 0)throw new Error("Missing second number in range");o=parseInt(B[2],10)}B[3]!==void 0&&(t=parseInt(B[3],10));let i="1",r=1;return B[5]!==void 0&&(i=B[5],i[0]==="'"&&(i=\`-\${i.substring(1)}\`),r=parseInt(i,10)),new h(new T(I,t,o),r)}parseMove(g){let e=this.notationMapper.notationToInternal(g);if(e===null)throw new Error(\`Bad move \${g.family}\`);g=e;let B=g.family,I=!1;if(B.endsWith("v")&&B[0]<="Z"){if(g.innerLayer!==void 0||g.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");B=B.slice(0,-1),I=!0}B.endsWith("w")&&B[0]<="Z"&&(B=B.slice(0,-1).toLowerCase());let o,t=-1,i=this.swizzler.unswizzle(B),r=!1;for(let Q=0;Q<this.movesetgeos.length;Q++){let f=this.movesetgeos[Q];i===f[0]&&(r=!0,o=f,t=Q),i===f[2]&&(r=!1,o=f,t=Q)}let n=1,l=1;if(B.toUpperCase()!==B&&(l=2),o===void 0)throw new Error(\`Bad grip in move \${g.family}\`);if(g.outerLayer!==void 0&&(n=g.outerLayer),g.innerLayer!==void 0&&(g.outerLayer===void 0?(l=g.innerLayer,B<="Z"?n=l:n=1):l=g.innerLayer),n--,l--,I&&(n=0,l=this.moveplanesets[t].length),n<0||n>this.moveplanesets[t].length||l<0||l>this.moveplanesets[t].length)throw new Error(\`Bad slice spec \${n} \${l} vs \${this.moveplanesets[t].length}\`);if(!aL&&n===0&&l===this.moveplanesets[t].length&&!I)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,t,n,l,r,g.amount]}parsemove(g){let e=this.parseMove(this.stringToBlockMove(g));return e[0]=g,e}genperms(){let g="genperms";if(this.cmovesbyslice.length>0)return;let e=[];if(this.options.orientCenters){for(let B=0;B<this.cubies.length;B++)if(this.cubies[B].length===1){let I=this.cubies[B][0],o=this.getfaceindex(I),t=this.basefaces[o].centermass();if(t.dist(this.facecentermass[I])<eg){let i=1<<o|1<<this.baseFaceCount,r=this.markedface[i],n=this.baseplanes[r].makenormal(),l=-1,Q=-1;for(let R=0;R<this.faces[I].length;R++){let L=this.faces[I].get(R),p=n.dot(L.sub(t));p>l&&(l=p,Q=R)}let f=(Q+1)%this.faces[I].length;if(Math.abs(n.dot(this.faces[I].get(f).sub(t))-l)<eg&&(Q=f),Q!==0){let R=[];for(let L=0;L<this.faces[I].length;L++)R.push(this.faces[I].get((L+Q)%this.faces[I].length));this.faces[I]=new nB(R)}let c=this.basefaces[o].length;for(let R=1;R<c;R++)this.cubies[B].push(this.cubies[B][R-1]);this.duplicatedFaces[I]=c,this.duplicatedCubies[B]=c,this.orbitoris[this.cubiesetnums[B]]=c}}}for(let B=0;B<this.moveplanesets.length;B++){let I=this.moveplanesets[B],o=[],t=[I.length+1,0],i=1;for(;i*2<=I.length;)i*=2;for(let l=0;l<this.faces.length;l++){let Q=0;if(I.length>0){let f=this.facecentermass[l].dot(I[0]);for(let c=i;c>0;c>>=1)Q+c<=I.length&&f>I[Q+c-1].a&&(Q+=c);Q=I.length-Q}for(o.push(Q);t.length<=Q;)t.push(0);t[Q]++}let r=new Array(t.length);for(let l=0;l<t.length;l++)r[l]=[];let n=[];for(let l=0;l<this.faces.length;l++){if(o[l]<0)continue;let Q=[this.facetocubie[l],this.facetoord[l]],f=this.facecentermass[l],c=f,R=l,L=o[R];for(;;){o[R]=-1;let p=f.rotatepoint(this.moverotations[B][0]);if(p.dist(c)<eg)break;R=this.findface(p),Q.push(this.facetocubie[R],this.facetoord[R]),f=p}if(Q.length>2&&this.options.orientCenters&&(this.cubies[Q[0]].length===1||this.duplicatedCubies[Q[0]]>1)&&this.facecentermass[l].dist(this.basefaces[this.getfaceindex(l)].centermass())<eg){let p=this.faces[this.cubies[Q[0]][0]];for(let k=0;k<Q.length;k+=2){let d=this.faces[this.cubies[Q[k]][0]],N=-1;for(let K=0;K<p.length;K++)if(d.get(K).dist(p.get(0))<eg){N=K;break}if(N<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");Q[k+1]=N,p=p.rotate(this.moverotations[B][0])}}if(Q.length===2&&this.options.orientCenters)for(let p=1;p<this.movesetorders[B];p++)L===0?Q.push(Q[0],p):Q.push(Q[0],(this.movesetorders[B]-p)%this.movesetorders[B]);if(Q.length>2&&!n[Q[0]]){if(Q.length!==2*this.movesetorders[B])throw new Error("Bad length in perm gen");for(let p of Q)r[L].push(p)}for(let p=0;p<Q.length;p+=2)n[Q[p]]=!0}for(let l=0;l<r.length;l++)r[l]=r[l].slice();e.push(r)}if(this.cmovesbyslice=e,this.options.moveList){let B=[];for(let I of this.options.moveList)B.push(this.parsemove(I));this.parsedmovelist=B}this.facelisthash.clear(),this.facecentermass=[]}getboundarygeometry(){return{baseplanes:this.baseplanes,facenames:this.facenames,faceplanes:this.faceplanes,vertexnames:this.vertexnames,edgenames:this.edgenames,geonormals:this.geonormals}}getmovesets(g){let e=this.moveplanesets[g].length,B=[];if(this.parsedmovelist!==void 0)for(let I of this.parsedmovelist)I[1]===g&&(I[4]?B.push([I[2],I[3]]):B.push([e-I[3],e-I[2]]),B.push(I[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let I=this.movesetgeos[g];if(I[1]!==I[3])for(let o=0;o<e;o++)I[1]!=="v"?(this.options.outerBlockMoves?B.push([o+1,e]):B.push([o+1]),B.push(1)):(this.options.outerBlockMoves?B.push([0,o]):B.push([o,o]),B.push(1))}else for(let I=0;I<=e;I++)!this.options.allMoves&&I+I===e||(this.options.outerBlockMoves?I+I>e?B.push([I,e]):B.push([0,I]):B.push([I,I]),B.push(1));if(this.fixedCubie>=0){let I=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[g],o=[];for(let t=0;t<B.length;t+=2){let i=B[t];if(I>=i[0]&&I<=i[1])if(i[0]===0)i=[i[1]+1,e];else if(e===i[1])i=[0,i[0]-1];else throw Error("fixed cubie option would disconnect move");let r=!1;for(let n=0;n<o.length;n+=2)if(o[n][0]===i[0]&&o[n][1]===i[1]&&o[n+1]===B[t+1]){r=!0;break}r||(o.push(i),o.push(B[t+1]))}B=o}return B}graybyori(g){let e=this.cubies[g].length;return this.duplicatedCubies[g]&&(e=1),e===1&&(this.options.grayCenters||!this.options.includeCenterOrbits)||e===2&&(this.options.grayEdges||!this.options.includeEdgeOrbits)||e>2&&(this.options.grayCorners||!this.options.includeCornerOrbits)}skipbyori(g){let e=this.cubies[g].length;return this.duplicatedCubies[g]&&(e=1),e===1&&!this.options.includeCenterOrbits||e===2&&!this.options.includeEdgeOrbits||e>2&&!this.options.includeCornerOrbits}skipcubie(g){return this.skipbyori(g)}header(g){return g+sL+\`
|
|
6
|
+
\`:" "}var Tg,PB,J,ye=U(()=>{"use strict";Ke();Cr();he();Ir();cr();kI();Go();pe();No();or();PB=class extends fg{constructor(e){super();cA(this,Tg,void 0);lA(this,Tg,Array.from(MQ(e)));for(let B of w(this,Tg))if(!kQ(B))throw new Error("An alg can only contain alg nodes.")}isIdentical(e){let B=e;if(!e.is(PB))return!1;let I=Array.from(w(this,Tg)),o=Array.from(w(B,Tg));if(I.length!==o.length)return!1;for(let t=0;t<I.length;t++)if(!I[t].isIdentical(o[t]))return!1;return!0}invert(){return new PB(hQ(Array.from(w(this,Tg)).map(e=>e.invert())))}*experimentalExpand(e=1,B){B??(B=1/0);for(let I of uQ(w(this,Tg),e))yield*I.experimentalExpand(e,B)}expand(e){return new PB(this.experimentalExpand(1,e?.depth??1/0))}*experimentalLeafMoves(){for(let e of this.experimentalExpand())e.is(h)&&(yield e)}concat(e){return new PB(Array.from(w(this,Tg)).concat(Array.from(MQ(e))))}experimentalIsEmpty(){for(let e of w(this,Tg))return!1;return!0}static fromString(e){return Br(e)}units(){return this.childAlgNodes()}*childAlgNodes(){for(let e of w(this,Tg))yield e}experimentalNumUnits(){return this.experimentalNumChildAlgNodes()}experimentalNumChildAlgNodes(){return Array.from(w(this,Tg)).length}get type(){return Zt("deprecated: type"),"sequence"}toString(){let e="",B=null;for(let I of w(this,Tg)){B&&(e+=AL(B,I));let o=I.as(jA)?.experimentalNISSGrouping;if(o){if(o.amount!==-1)throw new Error("Invalid NISS Grouping amount!");e+=\`^(\${o.alg.toString()})\`}else I.as(Qg)?.experimentalNISSPlaceholder||(e+=I.toString());B=I}return e}experimentalSimplify(e){return new PB(Dr(this,e??{}))}simplify(e){return this.experimentalSimplify(e)}},J=PB;Tg=new WeakMap});var gL,KQ=U(()=>{"use strict";ye();kI();yI();wI();pe();mI();gL={Sune:new J([new h("R",1),new h("U",1),new h("R",-1),new h("U",1),new h("R",1),new h("U",-2),new h("R",-1)]),AntiSune:new J([new h("R",1),new h("U",2),new h("R",-1),new h("U",-1),new h("R",1),new h("U",-1),new h("R",-1)]),SuneCommutator:new J([new ng(new J([new h("R",1),new h("U",1),new h("R",-2)]),new J([new Eg(new J([new h("R",1)]),new J([new h("U",1)]))]))]),Niklas:new J([new h("R",1),new h("U",-1),new h("L",-1),new h("U",1),new h("R",-1),new h("U",-1),new h("L",1),new h("U",1)]),EPerm:new J([new h("x",-1),new ng(new J([new Eg(new J([new h("R",1)]),new J([new h("U",-1)]))]),new J([new h("D",1)])),new ng(new J([new Eg(new J([new h("R",1)]),new J([new h("U",1)]))]),new J([new h("D",1)])),new h("x",1)]),FURURFCompact:new J([new Eg(new J([new h("F",1)]),new J([new ng(new J([new h("U",1)]),new J([new h("R",1)]))]))]),APermCompact:new J([new Eg(new J([new h("R",2)]),new J([new ng(new J([new h("F",2)]),new J([new h("R",-1),new h("B",-1),new h("R",1)]))]))]),FURURFMoves:new J([new h("F",1),new h("U",1),new h("R",1),new h("U",-1),new h("R",-1),new h("F",-1)]),TPerm:new J([new h("R",1),new h("U",1),new h("R",-1),new h("U",-1),new h("R",-1),new h("F",1),new h("R",2),new h("U",-1),new h("R",-1),new h("U",-1),new h("R",1),new h("U",1),new h("R",-1),new h("F",-1)]),HeadlightSwaps:new J([new Eg(new J([new h("F",1)]),new J([new Qg(new J([new ng(new J([new h("R",1)]),new J([new h("U",1)]))]),3)]))]),TriplePause:new J([new jA,new jA,new jA])}});var wm,xQ=U(()=>{"use strict";kI();pe();wm={73:new h("R"),75:new h("R'"),87:new h("B"),79:new h("B'"),83:new h("D"),76:new h("D'"),68:new h("L"),69:new h("L'"),74:new h("U"),70:new h("U'"),72:new h("F"),71:new h("F'"),78:new h("x'"),67:new h("l"),82:new h("l'"),85:new h("r"),77:new h("r'"),88:new h("d"),188:new h("d'"),84:new h("x"),89:new h("x"),66:new h("x'"),186:new h("y"),59:new h("y"),65:new h("y'"),80:new h("z"),81:new h("z'"),90:new h("M'"),190:new h("M'"),192:new jA}});var YQ=U(()=>{"use strict"});var SA=U(()=>{"use strict";ye();Ar();rr();KQ();xQ();kI();YQ();cr();Cr();gr()});function Jo(A,g,e){let B={};for(let I in A.orbits){let o=A.orbits[I],t=g[I],i=e[I];if(vo(o.numOrientations,i))B[I]=t;else if(vo(o.numOrientations,t))B[I]=i;else{let r=new Array(o.numPieces);if(o.numOrientations===1){for(let n=0;n<o.numPieces;n++)r[n]=t.permutation[i.permutation[n]];B[I]={permutation:r,orientation:t.orientation}}else{let n=new Array(o.numPieces);for(let l=0;l<o.numPieces;l++)n[l]=(t.orientation[i.permutation[l]]+i.orientation[l])%o.numOrientations,r[l]=t.permutation[i.permutation[l]];B[I]={permutation:r,orientation:n}}}}return B}function Lr(A,g,e){let B={};for(let I in A.orbits){let o=A.orbits[I],t=g[I],i=e[I];if(vo(o.numOrientations,i))B[I]=t;else{let r=new Array(o.numPieces);if(o.numOrientations===1){for(let n=0;n<o.numPieces;n++)r[n]=t.pieces[i.permutation[n]];B[I]={pieces:r,orientation:t.orientation}}else{let n=new Array(o.numPieces);for(let l=0;l<o.numPieces;l++)n[l]=(t.orientation[i.permutation[l]]+i.orientation[l])%o.numOrientations,r[l]=t.pieces[i.permutation[l]];B[I]={pieces:r,orientation:n}}}}return B}var Bi=U(()=>{"use strict";Ho()});function eL(A){let g=bQ.get(A);if(g)return g;let e=new Array(A),B=new Array(A);for(let o=0;o<A;o++)e[o]=o,B[o]=0;let I={permutation:e,orientation:B};return vQ&&(Object.freeze(e),Object.freeze(B),Object.freeze(I)),bQ.set(A,I),I}function JQ(A){let g={};for(let[e,B]of Object.entries(A.orbits))g[e]=eL(B.numPieces);return vQ&&Object.freeze(g),g}function HQ(A,g){let e=g.quantum.toString(),B=A.definition.moves[e];if(!B){let t=A.definition.experimentalDerivedMoves?.[e];t&&(B=A.algToTransformation(t).transformationData)}if(B)return tB(A,B,g.amount);let I=A.definition.moves[g.toString()];if(I)return I;let o=A.definition.moves[g.invert().toString()];if(o)return tB(A,o,-1);throw new Error(\`Invalid move for KPuzzle (\${A.name()}): \${g}\`)}var vQ,bQ,Rr=U(()=>{"use strict";Ho();vQ=!1,bQ=new Map});var YA,Ii=U(()=>{"use strict";Bi();Po();YA=class{constructor(g,e){this.kpuzzle=g;this.stateData=e}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),stateData:this.stateData}}static fromTransformation(g){let e=Lr(g.kpuzzle.definition,g.kpuzzle.definition.startStateData,g.transformationData);return new YA(g.kpuzzle,e)}apply(g){return this.applyTransformation(this.kpuzzle.toTransformation(g))}applyTransformation(g){if(g.isIdentityTransformation())return new YA(this.kpuzzle,this.stateData);let e=Lr(this.kpuzzle.definition,this.stateData,g.transformationData);return new YA(this.kpuzzle,e)}applyMove(g){return this.applyTransformation(this.kpuzzle.moveToTransformation(g))}applyAlg(g){return this.applyTransformation(this.kpuzzle.algToTransformation(g))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let g={};for(let[e,B]of Object.entries(this.stateData)){let I={permutation:B.pieces,orientation:B.orientation};g[e]=I}return new ge(this.kpuzzle,g)}experimentalIsSolved(g){if(!this.kpuzzle.definition.experimentalIsStateSolved)throw new Error("\`KState.experimentalIsSolved()\` is not supported for this puzzle at the moment.");return this.kpuzzle.definition.experimentalIsStateSolved(this,g)}}});var qB,iB,ge,Po=U(()=>{"use strict";Ho();Bi();Rr();Ii();iB=class{constructor(g,e){this.kpuzzle=g;this.transformationData=e;cA(this,qB,void 0)}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),transformationData:this.transformationData}}invert(){return new iB(this.kpuzzle,ur(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return w(this,qB)??lA(this,qB,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(g){let e=new iB(g,JQ(g.definition));return lA(e,qB,!0),e}isIdentical(g){return PQ(this.kpuzzle,this.transformationData,g.transformationData)}apply(g){return this.applyTransformation(this.kpuzzle.toTransformation(g))}applyTransformation(g){if(this.kpuzzle!==g.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${g.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return w(this,qB)?new iB(this.kpuzzle,g.transformationData):w(g,qB)?new iB(this.kpuzzle,this.transformationData):new iB(this.kpuzzle,Jo(this.kpuzzle.definition,this.transformationData,g.transformationData))}applyMove(g){return this.applyTransformation(this.kpuzzle.moveToTransformation(g))}applyAlg(g){return this.applyTransformation(this.kpuzzle.algToTransformation(g))}toKState(){return YA.fromTransformation(this)}repetitionOrder(){return qQ(this.kpuzzle.definition,this)}selfMultiply(g){return new iB(this.kpuzzle,tB(this.kpuzzle,this.transformationData,g))}},ge=iB;qB=new WeakMap});function vo(A,g){let{permutation:e}=g,B=e.length;for(let I=0;I<B;I++)if(e[I]!==I)return!1;if(A>1){let{orientation:I}=g;for(let o=0;o<B;o++)if(I[o]!==0)return!1}return!0}function BL(A,g,e,B={}){for(let I=0;I<A.numPieces;I++)if(!B?.ignoreOrientation&&g.orientation[I]!==e.orientation[I]||!B?.ignorePermutation&&g.permutation[I]!==e.permutation[I])return!1;return!0}function PQ(A,g,e){for(let[B,I]of Object.entries(A.definition.orbits))if(!BL(I,g[B],e[B]))return!1;return!0}function ur(A,g){let e={};for(let B in A.definition.orbits){let I=A.definition.orbits[B],o=g[B];if(vo(I.numOrientations,o))e[B]=o;else if(I.numOrientations===1){let t=new Array(I.numPieces);for(let i=0;i<I.numPieces;i++)t[o.permutation[i]]=i;e[B]={permutation:t,orientation:o.orientation}}else{let t=new Array(I.numPieces),i=new Array(I.numPieces);for(let r=0;r<I.numPieces;r++){let n=o.permutation[r];t[n]=r,i[n]=(I.numOrientations-o.orientation[r]+I.numOrientations)%I.numOrientations}e[B]={permutation:t,orientation:i}}}return e}function tB(A,g,e){if(e===1)return g;if(e<0)return tB(A,ur(A,g),-e);if(e===0){let{transformationData:o}=A.identityTransformation();return o}let B=g;e!==2&&(B=tB(A,g,Math.floor(e/2)));let I=Jo(A.definition,B,B);return e%2===0?I:Jo(A.definition,g,I)}function yr(A,g){return g?yr(g,A%g):A}function qQ(A,g){let e=1;for(let B in A.orbits){let I=A.orbits[B],o=g.transformationData[B],t=new Array(I.numPieces);for(let i=0;i<I.numPieces;i++)if(!t[i]){let r=i,n=0,l=0;for(;t[r]=!0,n=n+o.orientation[r],l=l+1,r=o.permutation[r],r!==i;);n!==0&&(l=l*I.numOrientations/yr(I.numOrientations,Math.abs(n))),e=e*l/yr(e,l)}}return e}var hr,TQ,Ho=U(()=>{"use strict";SA();SA();Bi();Po();hr=class extends oB{traverseAlg(g,e){let B=null;for(let I of g.childAlgNodes())B?B=B.applyTransformation(this.traverseAlgNode(I,e)):B=this.traverseAlgNode(I,e);return B??e.identityTransformation()}traverseGrouping(g,e){let B=this.traverseAlg(g.alg,e);return new ge(e,tB(e,B.transformationData,g.amount))}traverseMove(g,e){return e.moveToTransformation(g)}traverseCommutator(g,e){let B=this.traverseAlg(g.A,e),I=this.traverseAlg(g.B,e);return B.applyTransformation(I).applyTransformation(B.invert()).applyTransformation(I.invert())}traverseConjugate(g,e){let B=this.traverseAlg(g.A,e),I=this.traverseAlg(g.B,e);return B.applyTransformation(I).applyTransformation(B.invert())}traversePause(g,e){return e.identityTransformation()}traverseNewline(g,e){return e.identityTransformation()}traverseLineComment(g,e){return e.identityTransformation()}},TQ=re(hr)});var GI,oi,zA,zQ=U(()=>{"use strict";SA();Ho();Rr();Ii();Po();zA=class{constructor(g,e){this.definition=g;cA(this,GI,new Map);cA(this,oi,void 0);this.experimentalPGNotation=e?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return ge.experimentalConstructIdentity(this)}moveToTransformation(g){typeof g=="string"&&(g=new h(g));let e=g.toString(),B=w(this,GI).get(e);if(B)return new ge(this,B);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(g);if(!o)throw new Error(\`could not map to internal move: \${g}\`);return w(this,GI).set(e,o),new ge(this,o)}let I=HQ(this,g);return w(this,GI).set(e,I),new ge(this,I)}algToTransformation(g){return typeof g=="string"&&(g=new J(g)),TQ(g,this)}toTransformation(g){return typeof g=="string"?this.algToTransformation(g):g?.is?.(J)?this.algToTransformation(g):g?.is?.(h)?this.moveToTransformation(g):g}startState(){return new YA(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return w(this,oi)??lA(this,oi,(()=>{for(let[g,e]of Object.entries(this.definition.orbits)){let B=new Array(e.numPieces).fill(!1);for(let I of this.definition.startStateData[g].pieces)B[I]=!0;for(let I of B)if(!I)return!1}return!0})())}};GI=new WeakMap,oi=new WeakMap});var cg=U(()=>{"use strict";zQ();Ii();Po()});var OQ,IL,_Q=U(()=>{"use strict";OQ={333:{puzzleID:"3x3x3",eventName:"3x3x3 Cube"},222:{puzzleID:"2x2x2",eventName:"2x2x2 Cube"},444:{puzzleID:"4x4x4",eventName:"4x4x4 Cube"},555:{puzzleID:"5x5x5",eventName:"5x5x5 Cube"},666:{puzzleID:"6x6x6",eventName:"6x6x6 Cube"},777:{puzzleID:"7x7x7",eventName:"7x7x7 Cube"},"333bf":{puzzleID:"3x3x3",eventName:"3x3x3 Blindfolded"},"333fm":{puzzleID:"3x3x3",eventName:"3x3x3 Fewest Moves"},"333oh":{puzzleID:"3x3x3",eventName:"3x3x3 One-Handed"},clock:{puzzleID:"clock",eventName:"Clock"},minx:{puzzleID:"megaminx",eventName:"Megaminx"},pyram:{puzzleID:"pyraminx",eventName:"Pyraminx"},skewb:{puzzleID:"skewb",eventName:"Skewb"},sq1:{puzzleID:"square1",eventName:"Square-1"},"444bf":{puzzleID:"4x4x4",eventName:"4x4x4 Blindfolded"},"555bf":{puzzleID:"5x5x5",eventName:"5x5x5 Blindfolded"},"333mb":{puzzleID:"3x3x3",eventName:"3x3x3 Multi-Blind"}},IL={...OQ,fto:{puzzleID:"fto",eventName:"Face-Turning Octahedron"},master_tetraminx:{puzzleID:"master_tetraminx",eventName:"Master Tetraminx"},kilominx:{puzzleID:"kilominx",eventName:"Kilominx"},redi_cube:{puzzleID:"redi_cube",eventName:"Redi Cube"}}});function WQ(A){return oL[A]}var Ye,Fe,wg,NI,qo,TB,oL,MI,KI,To=U(()=>{"use strict";Ye=class{constructor(g,e){this.stickerings=new Map;for(let[B,I]of Object.entries(g.definition.orbits))this.stickerings.set(B,new Array(I.numPieces).fill(e))}},Fe="regular",wg="ignored",NI="oriented",qo="invisible",TB="dim",oL={["Regular"]:{facelets:[Fe,Fe,Fe,Fe,Fe]},["Ignored"]:{facelets:[wg,wg,wg,wg,wg]},["OrientationStickers"]:{facelets:[NI,NI,NI,NI,NI]},["IgnoreNonPrimary"]:{facelets:[Fe,wg,wg,wg,wg]},["Invisible"]:{facelets:[qo,qo,qo,qo,qo]},["PermuteNonPrimary"]:{facelets:[TB,Fe,Fe,Fe,Fe]},["Dim"]:{facelets:[TB,TB,TB,TB,TB]},["Ignoriented"]:{facelets:[TB,wg,wg,wg,wg]},["OrientationWithoutPermutation"]:{facelets:[NI,wg,wg,wg,wg]}};MI=class extends Ye{constructor(g){super(g,"Regular")}set(g,e){for(let[B,I]of this.stickerings.entries())for(let o=0;o<I.length;o++)g.stickerings.get(B)[o]&&(I[o]=e);return this}toStickeringMask(){let g={orbits:{}};for(let[e,B]of this.stickerings.entries()){let I=[],o={pieces:I};g.orbits[e]=o;for(let t of B)I.push(WQ(t))}return g}},KI=class{constructor(g){this.kpuzzle=g}and(g){let e=new Ye(this.kpuzzle,!1);for(let[B,I]of Object.entries(this.kpuzzle.definition.orbits)){A:for(let o=0;o<I.numPieces;o++){e.stickerings.get(B)[o]=!0;for(let t of g)if(!t.stickerings.get(B)[o]){e.stickerings.get(B)[o]=!1;continue A}}}return e}or(g){let e=new Ye(this.kpuzzle,!1);for(let[B,I]of Object.entries(this.kpuzzle.definition.orbits)){A:for(let o=0;o<I.numPieces;o++){e.stickerings.get(B)[o]=!1;for(let t of g)if(t.stickerings.get(B)[o]){e.stickerings.get(B)[o]=!0;continue A}}}return e}not(g){let e=new Ye(this.kpuzzle,!1);for(let[B,I]of Object.entries(this.kpuzzle.definition.orbits))for(let o=0;o<I.numPieces;o++)e.stickerings.get(B)[o]=!g.stickerings.get(B)[o];return e}all(){return this.and(this.moves([]))}move(g){let e=this.kpuzzle.moveToTransformation(g),B=new Ye(this.kpuzzle,!1);for(let[I,o]of Object.entries(this.kpuzzle.definition.orbits))for(let t=0;t<o.numPieces;t++)(e.transformationData[I].permutation[t]!==t||e.transformationData[I].orientation[t]!==0)&&(B.stickerings.get(I)[t]=!0);return B}moves(g){return g.map(e=>this.move(e))}orbits(g){let e=new Ye(this.kpuzzle,!1);for(let B of g)e.stickerings.get(B).fill(!0);return e}orbitPrefix(g){let e=new Ye(this.kpuzzle,!1);for(let B in this.kpuzzle.definition.orbits)B.startsWith(g)&&e.stickerings.get(B).fill(!0);return e}}});var jQ,VQ,ne,xI,pr,Fr=U(()=>{"use strict";jQ="Last Layer",VQ="Last Slot",ne={"3x3x3":jQ,megaminx:jQ},xI={"3x3x3":VQ,megaminx:VQ},pr={full:{groups:{"3x3x3":"Stickering",megaminx:"Stickering"}},OLL:{groups:ne},PLL:{groups:ne},LL:{groups:ne},EOLL:{groups:ne},COLL:{groups:ne},OCLL:{groups:ne},CPLL:{groups:ne},CLL:{groups:ne},EPLL:{groups:ne},ELL:{groups:ne},ZBLL:{groups:ne},LS:{groups:xI},ELS:{groups:xI},CLS:{groups:xI},ZBLS:{groups:xI},VLS:{groups:xI},WVLS:{groups:xI},F2L:{groups:{"3x3x3":"CFOP (Fridrich)"}},Daisy:{groups:{"3x3x3":"CFOP (Fridrich)"}},Cross:{groups:{"3x3x3":"CFOP (Fridrich)"}},EO:{groups:{"3x3x3":"ZZ"}},EOline:{groups:{"3x3x3":"ZZ"}},EOcross:{groups:{"3x3x3":"ZZ"}},CMLL:{groups:{"3x3x3":"Roux"}},L10P:{groups:{"3x3x3":"Roux"}},L6E:{groups:{"3x3x3":"Roux"}},L6EO:{groups:{"3x3x3":"Roux"}},"2x2x2":{groups:{"3x3x3":"Petrus"}},"2x2x3":{groups:{"3x3x3":"Petrus"}},L2C:{groups:{"4x4x4":"Reduction","5x5x5":"Reduction","6x6x6":"Reduction"}},PBL:{groups:{"2x2x2":"Ortega"}},"Void Cube":{groups:{"3x3x3":"Miscellaneous"}},invisible:{groups:{"3x3x3":"Miscellaneous"}},picture:{groups:{"3x3x3":"Miscellaneous"}},"centers-only":{groups:{"3x3x3":"Miscellaneous"}},"experimental-centers-U":{},"experimental-centers-U-D":{},"experimental-centers-U-L-D":{},"experimental-centers-U-L-B-D":{},"experimental-centers":{},"experimental-fto-fc":{groups:{fto:"Bencisco"}},"experimental-fto-f2t":{groups:{fto:"Bencisco"}},"experimental-fto-sc":{groups:{fto:"Bencisco"}},"experimental-fto-l2c":{groups:{fto:"Bencisco"}},"experimental-fto-lbt":{groups:{fto:"Bencisco"}},"experimental-fto-l3t":{groups:{fto:"Bencisco"}}}});async function be(A,g){let e=await A.kpuzzle(),B=new MI(e),I=new KI(e),o=()=>I.move("U"),t=()=>I.or(I.moves(["U","D"])),i=()=>I.or(I.moves(["L","R"])),r=()=>I.not(i()),n=()=>I.not(o()),l=()=>I.orbitPrefix("CENTER"),Q=()=>I.orbitPrefix("EDGE"),f=()=>I.or([I.orbitPrefix("CORNER"),I.orbitPrefix("C4RNER"),I.orbitPrefix("C5RNER")]),c=()=>I.or([r(),I.and([o(),Q()])]),R=()=>I.and([o(),l()]),L=()=>I.and([I.and(I.moves(["F","R"])),Q()]),p=()=>I.and([I.and(I.moves(["F","R"])),f(),I.not(o())]),k=()=>I.or([p(),L()]);function d(){B.set(n(),"Dim")}function N(){B.set(o(),"PermuteNonPrimary"),B.set(R(),"Dim")}function K(){B.set(o(),"IgnoreNonPrimary"),B.set(R(),"Regular")}function Y(){B.set(o(),"Ignoriented"),B.set(R(),"Dim")}switch(g){case"full":break;case"PLL":{d(),N();break}case"CLS":{d(),B.set(p(),"Regular"),B.set(o(),"Ignoriented"),B.set(I.and([o(),l()]),"Dim"),B.set(I.and([o(),f()]),"IgnoreNonPrimary");break}case"OLL":{d(),K();break}case"EOLL":{d(),K(),B.set(I.and([o(),f()]),"Ignored");break}case"COLL":{d(),B.set(I.and([o(),Q()]),"Ignoriented"),B.set(I.and([o(),l()]),"Dim"),B.set(I.and([o(),f()]),"Regular");break}case"OCLL":{d(),Y(),B.set(I.and([o(),f()]),"IgnoreNonPrimary");break}case"CPLL":{d(),B.set(I.and([f(),o()]),"PermuteNonPrimary"),B.set(I.and([I.not(f()),o()]),"Dim");break}case"CLL":{d(),B.set(I.not(I.and([f(),o()])),"Dim");break}case"EPLL":{d(),B.set(o(),"Dim"),B.set(I.and([o(),Q()]),"PermuteNonPrimary");break}case"ELL":{d(),B.set(o(),"Dim"),B.set(I.and([o(),Q()]),"Regular");break}case"ELS":{d(),K(),B.set(I.and([o(),f()]),"Ignored"),B.set(L(),"Regular"),B.set(p(),"Ignored");break}case"LL":{d();break}case"F2L":{B.set(o(),"Ignored");break}case"ZBLL":{d(),B.set(o(),"PermuteNonPrimary"),B.set(R(),"Dim"),B.set(I.and([o(),f()]),"Regular");break}case"ZBLS":{d(),B.set(k(),"Regular"),K(),B.set(I.and([o(),f()]),"Ignored");break}case"VLS":{d(),B.set(k(),"Regular"),K();break}case"WVLS":{d(),B.set(k(),"Regular"),B.set(I.and([o(),Q()]),"Ignoriented"),B.set(I.and([o(),l()]),"Dim"),B.set(I.and([o(),f()]),"IgnoreNonPrimary");break}case"LS":{d(),B.set(k(),"Regular"),B.set(o(),"Ignored"),B.set(R(),"Dim");break}case"EO":{B.set(f(),"Ignored"),B.set(Q(),"OrientationWithoutPermutation");break}case"EOline":{B.set(f(),"Ignored"),B.set(Q(),"OrientationWithoutPermutation"),B.set(I.and(I.moves(["D","M"])),"Regular");break}case"EOcross":{B.set(Q(),"OrientationWithoutPermutation"),B.set(I.move("D"),"Regular"),B.set(f(),"Ignored");break}case"CMLL":{B.set(n(),"Dim"),B.set(c(),"Ignored"),B.set(I.and([o(),f()]),"Regular");break}case"L10P":{B.set(I.not(c()),"Dim"),B.set(I.and([f(),o()]),"Regular");break}case"L6E":{B.set(I.not(c()),"Dim");break}case"L6EO":{B.set(I.not(c()),"Dim"),B.set(c(),"OrientationWithoutPermutation"),B.set(I.and([l(),t()]),"OrientationStickers");break}case"Daisy":{B.set(I.all(),"Ignored"),B.set(l(),"Dim"),B.set(I.and([I.move("D"),l()]),"Regular"),B.set(I.and([I.move("U"),Q()]),"IgnoreNonPrimary");break}case"Cross":{B.set(I.all(),"Ignored"),B.set(l(),"Dim"),B.set(I.and([I.move("D"),l()]),"Regular"),B.set(I.and([I.move("D"),Q()]),"Regular");break}case"2x2x2":{B.set(I.or(I.moves(["U","F","R"])),"Ignored"),B.set(I.and([I.or(I.moves(["U","F","R"])),l()]),"Dim");break}case"2x2x3":{B.set(I.all(),"Dim"),B.set(I.or(I.moves(["U","F","R"])),"Ignored"),B.set(I.and([I.or(I.moves(["U","F","R"])),l()]),"Dim"),B.set(I.and([I.move("F"),I.not(I.or(I.moves(["U","R"])))]),"Regular");break}case"L2C":{B.set(I.or(I.moves(["L","R","B","D"])),"Dim"),B.set(I.not(l()),"Ignored");break}case"PBL":{B.set(I.all(),"Ignored"),B.set(I.or(I.moves(["U","D"])),"PermuteNonPrimary");break}case"Void Cube":{B.set(l(),"Invisible");break}case"picture":case"invisible":{B.set(I.all(),"Invisible");break}case"centers-only":{B.set(I.not(l()),"Ignored");break}default:console.warn(\`Unsupported stickering for \${A.id}: \${g}. Setting all pieces to dim.\`),B.set(I.and(I.moves([])),"Dim")}return B.toStickeringMask()}async function CB(A,g){let e=[],B=[];for(let[I,o]of Object.entries(pr))o.groups&&(A in o.groups?e.push(I):g?.use3x3x3Fallbacks&&"3x3x3"in o.groups&&B.push(I));return e.concat(B)}var zo=U(()=>{"use strict";To();Fr()});function kA(A){let g=null;return()=>g??(g=A())}var jg=U(()=>{"use strict"});function XA(A){return new ve(g=>{g(A())})}var ve,Vg=U(()=>{"use strict";ve=class extends Promise{constructor(g){super(e=>{e()}),this._executor=g}static from(g){return new ve(e=>{e(g())})}static resolve(g){return new ve(e=>{e(g)})}static reject(g){return new ve((e,B)=>{B(g)})}then(g,e){return this._promise=this._promise||new Promise(this._executor),this._promise.then(g,e)}catch(g){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(g)}}});var YI,ZQ=U(()=>{"use strict";YI=class{constructor(g,e){this.facenames=g;this.prefixFree=!0;this.gripnames=[];e&&(this.gripnames=e);for(let B=0;this.prefixFree&&B<g.length;B++)for(let I=0;this.prefixFree&&I<g.length;I++)B!==I&&g[B].startsWith(g[I])&&(this.prefixFree=!1)}setGripNames(g){this.gripnames=g}splitByFaceNames(g){let e=[],B=0;for(;B<g.length;){B>0&&B<g.length&&g[B]==="_"&&B++;let I=-1;for(let o=0;o<this.facenames.length;o++)g.substr(B).startsWith(this.facenames[o])&&(I<0||this.facenames[o].length>this.facenames[I].length)&&(I=o);if(I>=0)e.push(I),B+=this.facenames[I].length;else throw new Error(\`Could not split \${g} into face names.\`)}return e}joinByFaceIndices(g){let e="",B=[];for(let I=0;I<g.length;I++)B.push(e),B.push(this.facenames[g[I]]),this.prefixFree||(e="_");return B.join("")}spinmatch(g,e){if(g===e)return!0;try{let B=this.splitByFaceNames(g),I=this.splitByFaceNames(e);if(B.length!==I.length&&B.length<3)return!1;for(let o=0;o<B.length;o++){for(let i=0;i<o;i++)if(B[o]===B[i])return!1;let t=!1;for(let i=0;i<I.length;i++)if(B[o]===I[i]){t=!0;break}if(!t)return!1}return!0}catch{return!1}}spinmatchv(g,e){return g.endsWith("v")&&e.endsWith("v")?this.spinmatch(g.slice(0,g.length-1),e.slice(0,e.length-1)):this.spinmatch(g,e)}unswizzle(g){(g.endsWith("v")||g.endsWith("w"))&&g[0]<="Z"&&(g=g.slice(0,g.length-1));let e=g.toUpperCase();for(let B=0;B<this.gripnames.length;B++){let I=this.gripnames[B];if(this.spinmatch(e,I))return I}return g}}});var zB,$Q=U(()=>{"use strict";zB=class{notationToInternal(g){return g}notationToExternal(g){return g}}});var Oo,Al=U(()=>{"use strict";SA();Oo=class{constructor(g,e){this.child=g;this.sw=e}notationToInternal(g){return g.family==="T"&&g.innerLayer===void 0&&g.outerLayer===void 0?new h(new T("FLRv",g.innerLayer,g.outerLayer),g.amount):this.child.notationToInternal(g)}notationToExternal(g){let e=g.family;return e.length>0&&e[e.length-1]==="v"&&(e=e.substring(0,e.length-1)),this.sw.spinmatch(e,"FLUR")?new h(new T("T",g.innerLayer,g.outerLayer),g.amount):this.child.notationToExternal(g)}}});var bI,gl=U(()=>{"use strict";SA();bI=class{constructor(g,e){this.internalNames=g;this.externalNames=e}convertString(g,e,B){let I="";(g.endsWith("v")||g.endsWith("v"))&&g<="_"&&(I=g.slice(g.length-1),g=g.slice(0,g.length-1));let o=g.toUpperCase(),t=!1;return g!==o&&(t=!0,g=o),g=B.joinByFaceIndices(e.splitByFaceNames(g)),t&&(g=g.toLowerCase()),g+I}convert(g,e,B){let I=g.family,o=this.convertString(I,e,B);return I===o?g:new h(new T(o,g.innerLayer,g.outerLayer),g.amount)}notationToInternal(g){return this.convert(g,this.externalNames,this.internalNames)}notationToExternal(g){return this.convert(g,this.internalNames,this.externalNames)}}});var _o,el=U(()=>{"use strict";SA();_o=class{constructor(g){this.child=g}notationToInternal(g){if(g.innerLayer===void 0&&g.outerLayer===void 0){if(Math.abs(g.amount)===1){if(g.family==="R++")return new h(new T("L",3,2),-2*g.amount);if(g.family==="R--")return new h(new T("L",3,2),2*g.amount);if(g.family==="D++")return new h(new T("U",3,2),-2*g.amount);if(g.family==="D--")return new h(new T("U",3,2),2*g.amount);if(g.family==="R_PLUSPLUS_")return new h(new T("L",3,2),-2*g.amount);if(g.family==="D_PLUSPLUS_")return new h(new T("U",3,2),-2*g.amount)}if(g.family==="y")return new h("Uv",g.amount);if(g.family==="x"&&Math.abs(g.amount)===2)return new h("DRRv",g.amount/2)}return this.child.notationToInternal(g)}notationToExternal(g){return g.family==="DRRv"&&Math.abs(g.amount)===1?new h(new T("x",g.innerLayer,g.outerLayer),g.amount*2):g.family==="DLLv"&&Math.abs(g.amount)===1?new h(new T("x",g.innerLayer,g.outerLayer),-g.amount*2):g.family==="Uv"?new h(new T("y",g.innerLayer,g.outerLayer),g.amount):g.family==="DDv"?new h("y",-g.amount):this.child.notationToExternal(g)}}});var Wo,Bl=U(()=>{"use strict";SA();Wo=class{constructor(g){this.slices=g}notationToInternal(g){let e=g.family;return g.innerLayer||g.outerLayer||(e==="x"?g=new h("Rv",g.amount):e==="y"?g=new h("Uv",g.amount):e==="z"&&(g=new h("Fv",g.amount)),(this.slices&1)===1&&(e==="E"?g=new h(new T("D",(this.slices+1)/2),g.amount):e==="M"?g=new h(new T("L",(this.slices+1)/2),g.amount):e==="S"&&(g=new h(new T("F",(this.slices+1)/2),g.amount))),this.slices>2&&(e==="e"?g=new h(new T("D",this.slices-1,2),g.amount):e==="m"?g=new h(new T("L",this.slices-1,2),g.amount):e==="s"&&(g=new h(new T("F",this.slices-1,2),g.amount)))),g}notationToExternal(g){let e=g.family;if(!(g.innerLayer||g.outerLayer)){if(e==="Rv")return new h("x",g.amount);if(e==="Uv")return new h("y",g.amount);if(e==="Fv")return new h("z",g.amount);if(e==="Lv")return new h("x",-g.amount);if(e==="Dv")return new h("y",-g.amount);if(e==="Bv")return new h("z",-g.amount)}return g}}});var tL,iL,Il,ol,tl,vI,jo,il=U(()=>{"use strict";SA();tL={U:"frl",L:"fld",R:"fdr",B:"dlr",u:"FRL",l:"FLD",r:"FDR",b:"DLR",Uv:"FRLv",Lv:"FLDv",Rv:"FDRv",Bv:"DLRv",D:"D",F:"F",BL:"L",BR:"R"},iL={U:"FRL",L:"FLD",R:"FDR",B:"DLR",u:"frl",l:"fld",r:"fdr",b:"dlr",Uv:"FRLv",Lv:"FLDv",Rv:"FDRv",Bv:"DLRv",D:"D",F:"F",BL:"L",BR:"R",d:"d",f:"f",bl:"l",br:"r"},Il={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},ol=new T("y"),tl=new T("Dv"),vI=class{constructor(g){this.child=g;this.wcaHack=!1;this.map=tL}notationToInternal(g){if(this.wcaHack&&g.innerLayer===2&&g.outerLayer===null){let B=Il[g.family];if(B)return new h(new T(B,g.innerLayer,g.outerLayer),g.amount)}let e=this.map[g.family];return e?new h(new T(e,g.innerLayer,g.outerLayer),g.amount):ol.isIdentical(g.quantum)?new h(tl,-g.amount):null}notationToExternal(g){if(this.wcaHack&&g.innerLayer===2&&g.outerLayer===null){for(let[e,B]of Object.entries(Il))if(this.child.spinmatch(g.family,B))return new h(new T(e,g.innerLayer,g.outerLayer),g.amount)}for(let[e,B]of Object.entries(this.map))if(this.child.spinmatch(g.family,B))return new h(new T(e,g.innerLayer,g.outerLayer),g.amount);return tl.isIdentical(g.quantum)?new h(ol,-g.amount):null}},jo=class extends vI{constructor(e){super(e);this.wcaHack=!0;this.map=iL}}});var Cl,wr,rl,CL,mr,nl,rL,dr,El,nL,Vo,Ql=U(()=>{"use strict";SA();Cl={U:"UBL",UL:"ULF",F:"UFR",UR:"URB",B:"DBL",D:"DFR",L:"DLF",R:"DRB",Uv:"UBLv",ULv:"ULFv",Fv:"UFRv",URv:"URBv",Bv:"DBLv",Dv:"DFRv",Lv:"DLFv",Rv:"DRBv"},wr=new T("x"),rl=new T("Rv"),CL=new T("Lv"),mr=new T("y"),nl=new T("Uv"),rL=new T("Dv"),dr=new T("z"),El=new T("Fv"),nL=new T("Bv"),Vo=class{constructor(g){this.child=g}notationToInternal(g){if(g.innerLayer||g.outerLayer)return null;let e=Cl[g.family];return e?new h(new T(e,g.outerLayer,g.innerLayer),g.amount):wr.isIdentical(g.quantum)?new h(rl,g.amount):mr.isIdentical(g.quantum)?new h(nl,g.amount):dr.isIdentical(g.quantum)?new h(El,g.amount):null}notationToExternal(g){for(let[e,B]of Object.entries(Cl))if(this.child.spinmatchv(g.family,B))return new h(new T(e,g.innerLayer,g.outerLayer),g.amount);return rl.isIdentical(g.quantum)?new h(wr,g.amount):CL.isIdentical(g.quantum)?new h(wr,-g.amount):nl.isIdentical(g.quantum)?new h(mr,g.amount):rL.isIdentical(g.quantum)?new h(mr,-g.amount):El.isIdentical(g.quantum)?new h(dr,g.amount):nL.isIdentical(g.quantum)?new h(dr,-g.amount):null}}});var Sr=U(()=>{"use strict";$Q();Al();gl();el();Bl();il();Ql()});function ll(A){let g=0,e={};for(;g<A.length&&A[g][0]==="-";){let I=A[g++];if(I==="--rotations")e.addRotations=!0;else if(I==="--allmoves")e.allMoves=!0;else if(I==="--outerblockmoves")e.outerBlockMoves=!0;else if(I==="--vertexmoves")e.vertexMoves=!0;else if(I==="--nocorners")e.includeCornerOrbits=!1;else if(I==="--noedges")e.includeEdgeOrbits=!1;else if(I==="--noorientation")e.fixedOrientation=!0;else if(I==="--nocenters")e.includeCenterOrbits=!1;else if(I==="--omit")e.excludeOrbits=A[g].split(","),g++;else if(I==="--moves")e.moveList=A[g].split(","),g++;else if(I==="--optimize")e.optimizeOrbits=!0;else if(I==="--scramble")e.scrambleAmount=100;else if(I==="--fixcorner")e.fixedPieceType="v";else if(I==="--fixedge")e.fixedPieceType="e";else if(I==="--fixcenter")e.fixedPieceType="f";else if(I==="--orientcenters")e.orientCenters=!0;else if(I==="--puzzleorientation")e.puzzleOrientation=JSON.parse(A[g]),g++;else throw new Error(\`Bad option: \${I}\`)}return{puzzleDescription:Xo(A.slice(g).join(" ")),options:e}}var ti,kr=U(()=>{"use strict";Zo();ti=class{constructor(g={}){this.verbosity=0;this.allMoves=!1;this.vertexMoves=!1;this.addRotations=!1;this.moveList=null;this.fixedOrientation=!1;this.fixedPieceType=null;this.orientCenters=!1;this.includeCornerOrbits=!0;this.includeCenterOrbits=!0;this.includeEdgeOrbits=!0;this.excludeOrbits=[];this.optimizeOrbits=!1;this.grayCorners=!1;this.grayCenters=!1;this.grayEdges=!1;this.puzzleOrientation=null;this.puzzleOrientations=null;this.scrambleAmount=0;Object.assign(this,g)}}});function rB(A){if(!Ur[A]){let g=Array(A);for(let e=0;e<A;e++)g[e]=0;Ur[A]=g}return Ur[A]}function we(A){if(!Gr[A]){let g=Array(A);for(let e=0;e<A;e++)g[e]=e;Gr[A]=g}return Gr[A]}function sl(A){return new Xg(we(A))}function al(A){let g=BigInt(1);for(;A>1;)g*=BigInt(A),A--;return g}function EL(A,g){if(A>g){let e=A;A=g,g=e}for(;A>0;){let e=g%A;g=A,A=e}return g}function Nr(A,g){return A/EL(A,g)*g}var Ur,Gr,Xg,ii=U(()=>{"use strict";Ur=[],Gr=[];Xg=class{constructor(g){this.n=g.length,this.p=g}toString(){return\`Perm[\${this.p.join(" ")}]\`}mul(g){let e=Array(this.n);for(let B=0;B<this.n;B++)e[B]=g.p[this.p[B]];return new Xg(e)}rmul(g){let e=Array(this.n);for(let B=0;B<this.n;B++)e[B]=this.p[g.p[B]];return new Xg(e)}inv(){let g=Array(this.n);for(let e=0;e<this.n;e++)g[this.p[e]]=e;return new Xg(g)}compareTo(g){for(let e=0;e<this.n;e++)if(this.p[e]!==g.p[e])return this.p[e]-g.p[e];return 0}toGap(){let g=new Array,e=new Array(this.n);for(let B=0;B<this.p.length;B++){if(e[B]||this.p[B]===B)continue;let I=new Array;for(let o=B;!e[o];o=this.p[o])I.push(1+o),e[o]=!0;g.push(\`(\${I.join(",")})\`)}return g.join("")}order(){let g=1,e=new Array(this.n);for(let B=0;B<this.p.length;B++){if(e[B]||this.p[B]===B)continue;let I=0;for(let o=B;!e[o];o=this.p[o])I++,e[o]=!0;g=Nr(g,I)}return g}}});function Ci(A,g){let e=h.fromString(g),B=A.notationToExternal(e);return B===null||e===B?g:B.toString()}function fl(A,g){let e=A.moveops.length;if(e>30)throw new Error("Canon info too big for bitmask");let B=[],I=[];for(let t=0;t<e;t++){let i=A.moveops[t];B.push(i.order());let r=0;for(let n=0;n<e;n++){if(n===t)continue;let l=A.moveops[n];i.mul(l).equal(l.mul(i))&&(r|=1<<n)}I.push(r)}let o={};o[0]=1;for(let t=0;t<100;t++){let i=0,r={},n=0;for(let l in o){let Q=+l,f=o[Q];i+=f,n++;for(let c=0;c<B.length;c++)if((Q>>c&1)===0&&(Q&I[c]&(1<<c)-1)===0){let R=Q&I[c]|1<<c;r[R]===void 0&&(r[R]=0),r[R]+=(B[c]-1)*f}}g(\`\${t}: canonseq \${i} states \${n}\`),o=r}}var JI,QL,OB,Ee,me,ri,Je,_B,ni,Dl=U(()=>{"use strict";SA();Sr();ii();JI=class{constructor(g,e){this.size=g;this.mod=e}reassemblySize(){return al(this.size)*BigInt(this.mod)**BigInt(this.size)}},QL=0;OB=class{constructor(g,e,B,I,o,t,i){this.orbitnames=g;this.orbitdefs=e;this.solved=B;this.movenames=I;this.moveops=o;this.isRotation=t;this.forcenames=i}transformToKTransformationData(g){let e={};for(let B=0;B<this.orbitnames.length;B++)e[this.orbitnames[B]]=g.orbits[B].toKPuzzle();return e}static transformToKTransformationData(g,e){let B={};for(let I=0;I<g.length;I++)B[g[I]]=e.orbits[I].toKPuzzle();return B}describeSet(g,e,B){let I=this.orbitdefs[g].size,o=new Array(I);for(let t=0;t<I;t++)o[t]=[];for(let t=0;t<this.movenames.length;t++){if(this.isRotation[t])continue;let i=this.movenames[t];this.forcenames[t]||(i=Ci(B,i),i[i.length-1]==="'"&&(i=i.substring(0,i.length-1)));let r=this.moveops[t].orbits[g];for(let n=0;n<I;n++)(r.perm[n]!==n||r.ori[n]!==0)&&o[n].push(i)}for(let t=0;t<I;t++)e.push(\`# \${t+1} \${o[t].join(" ")}\`)}toKsolve(g,e=new zB){let B=[];B.push(\`Name \${g}\`),B.push("");for(let I=0;I<this.orbitnames.length;I++)B.push(\`Set \${this.orbitnames[I]} \${this.orbitdefs[I].size} \${this.orbitdefs[I].mod}\`),this.describeSet(I,B,e);B.push(""),B.push("Solved");for(let I=0;I<this.orbitnames.length;I++)this.solved.orbits[I].appendDefinition(B,this.orbitnames[I],!1,!1);B.push("End");for(let I=0;I<this.movenames.length;I++){B.push("");let o=this.movenames[I];this.forcenames[I]||(o=Ci(e,this.movenames[I]));let t=!1;o[o.length-1]==="'"&&(t=!0,o=o.substring(0,o.length-1)),B.push(\`Move \${o}\`);for(let i=0;i<this.orbitnames.length;i++)t?this.moveops[I].orbits[i].inv().appendDefinition(B,this.orbitnames[i],!0):this.moveops[I].orbits[i].appendDefinition(B,this.orbitnames[i],!0);B.push("End")}return B}toKPuzzleDefinition(g){let e={},B={};for(let o=0;o<this.orbitnames.length;o++){e[this.orbitnames[o]]={numPieces:this.orbitdefs[o].size,numOrientations:this.orbitdefs[o].mod};let t=this.solved.orbits[o].toKPuzzle();B[this.orbitnames[o]]={pieces:t.permutation,orientation:t.orientation}}let I={};if(g)for(let o=0;o<this.movenames.length;o++)I[this.movenames[o]]=this.transformToKTransformationData(this.moveops[o]);return{name:\`PG3D #\${++QL}\`,orbits:e,startStateData:B,moves:I}}optimize(){let g=[],e=[],B=[],I=[];for(let o=0;o<this.moveops.length;o++)I.push([]);for(let o=0;o<this.orbitdefs.length;o++){let t=this.orbitdefs[o].mod,i=this.orbitdefs[o].size,r=new ni(i),n=new Array(this.orbitdefs[o].size);for(let c=0;c<i;c++)n[c]=!1;for(let c=0;c<this.moveops.length;c++)for(let R=0;R<i;R++)(this.moveops[c].orbits[o].perm[R]!==R||this.moveops[c].orbits[o].ori[R]!==0)&&(this.isRotation[c]||(n[R]=!0),r.union(R,this.moveops[c].orbits[o].perm[R]));let l=!0;if(t>1){l=!1;let c=new ni(this.orbitdefs[o].size*t);for(let R=0;R<this.moveops.length;R++)for(let L=0;L<i;L++)if(this.moveops[R].orbits[o].perm[L]!==L||this.moveops[R].orbits[o].ori[L]!==0)for(let p=0;p<t;p++)c.union(L*t+p,this.moveops[R].orbits[o].perm[L]*t+(p+this.moveops[R].orbits[o].ori[L])%t);for(let R=0;!l&&R<i;R++)for(let L=1;L<t;L++)c.find(R*t)===c.find(R*t+L)&&(l=!0);for(let R=0;!l&&R<i;R++)for(let L=0;L<R;L++)this.solved.orbits[o].perm[R]===this.solved.orbits[o].perm[L]&&(l=!0)}let Q=-1,f=!1;for(let c=0;c<this.orbitdefs[o].size;c++)if(n[c]){let R=r.find(c);Q<0?Q=R:Q!==R&&(f=!0)}for(let c=0;c<this.orbitdefs[o].size;c++){if(!n[c]||r.find(c)!==c)continue;let L=[],p=[],k=0;for(let d=0;d<this.orbitdefs[o].size;d++)r.find(d)===c&&(L[k]=d,p[d]=k,k++);if(f?g.push(\`\${this.orbitnames[o]}_p\${c}\`):g.push(this.orbitnames[o]),l){e.push(new JI(k,this.orbitdefs[o].mod)),B.push(this.solved.orbits[o].remapVS(L,k));for(let d=0;d<this.moveops.length;d++)I[d].push(this.moveops[d].orbits[o].remap(L,p,k))}else{e.push(new JI(k,1)),B.push(this.solved.orbits[o].remapVS(L,k).killOri());for(let d=0;d<this.moveops.length;d++)I[d].push(this.moveops[d].orbits[o].remap(L,p,k).killOri())}}}return new OB(g,e,new _B(B),this.movenames,I.map(o=>new Je(o)),this.isRotation,this.forcenames)}scramble(g){this.solved=this.solved.mul(this.getScrambleTransformation(g))}getScrambleTransformation(g){g<100&&(g=100);let e=[];for(let I=0;I<this.moveops.length;I++)e[I]=this.moveops[I];for(let I=0;I<e.length;I++){let o=Math.floor(Math.random()*e.length),t=e[I];e[I]=e[o],e[o]=t}g<e.length&&(g=e.length);for(let I=0;I<g;I++){let o=Math.floor(Math.random()*e.length),t=Math.floor(Math.random()*e.length),i=Math.floor(Math.random()*this.moveops.length);e[o]=e[o].mul(e[t]).mul(this.moveops[i]),Math.random()<.1&&(e[o]=e[o].mul(this.moveops[i]))}let B=e[0];for(let I=1;I<e.length;I++)B=B.mul(e[I]);return B}reassemblySize(){let g=BigInt(1);for(let e=0;e<this.orbitdefs.length;e++)g*=this.orbitdefs[e].reassemblySize();return g}},Ee=class{constructor(g,e,B){this.perm=g;this.ori=e;this.orimod=B}static e(g,e){return new Ee(we(g),rB(g),e)}mul(g){let e=this.perm.length,B=new Array(e);if(this.orimod===1){for(let I=0;I<e;I++)B[I]=this.perm[g.perm[I]];return new Ee(B,this.ori,this.orimod)}else{let I=new Array(e);for(let o=0;o<e;o++)B[o]=this.perm[g.perm[o]],I[o]=(this.ori[g.perm[o]]+g.ori[o])%this.orimod;return new Ee(B,I,this.orimod)}}inv(){let g=this.perm.length,e=new Array(g),B=new Array(g);for(let I=0;I<g;I++)e[this.perm[I]]=I,B[this.perm[I]]=(this.orimod-this.ori[I])%this.orimod;return new Ee(e,B,this.orimod)}equal(g){let e=this.perm.length;for(let B=0;B<e;B++)if(this.perm[B]!==g.perm[B]||this.ori[B]!==g.ori[B])return!1;return!0}killOri(){let g=this.perm.length;for(let e=0;e<g;e++)this.ori[e]=0;return this.orimod=1,this}toPerm(){let g=this.orimod;if(g===1)return new Xg(this.perm);let e=this.perm.length,B=new Array(e*g);for(let I=0;I<e;I++)for(let o=0;o<g;o++)B[I*g+o]=g*this.perm[I]+(this.ori[I]+o)%g;return new Xg(B)}identicalPieces(){let g=[],e=this.perm.length,B=[];for(let I=0;I<e;I++){let o=this.perm[I];if(g[o]===void 0){let t=[I];g[o]=!0;for(let i=I+1;i<e;i++)this.perm[i]===o&&t.push(i);B.push(t)}}return B}order(){return this.toPerm().order()}isIdentity(){let g=this.perm.length;if(this.perm===we(g)&&this.ori===rB(g))return!0;for(let e=0;e<g;e++)if(this.perm[e]!==e||this.ori[e]!==0)return!1;return!0}zeroOris(){let g=this.perm.length;if(this.ori===rB(g))return!0;for(let e=0;e<g;e++)if(this.ori[e]!==0)return!1;return!0}remap(g,e,B){let I=new Array(B),o=new Array(B);for(let t=0;t<B;t++)I[t]=e[this.perm[g[t]]],o[t]=this.ori[g[t]];return new Ee(I,o,this.orimod)}remapVS(g,e){let B=new Array(e),I=new Array(e),o=0,t=[];for(let i=0;i<e;i++){let r=this.perm[g[i]];t[r]===void 0&&(t[r]=o++),B[i]=t[r],I[i]=this.ori[g[i]]}return new Ee(B,I,this.orimod)}appendDefinition(g,e,B,I=!0){if(!(I&&this.isIdentity())&&(g.push(e),g.push(this.perm.map(o=>o+1).join(" ")),!this.zeroOris()))if(B){let o=new Array(this.ori.length);for(let t=0;t<o.length;t++)o[this.perm[t]]=this.ori[t];g.push(o.join(" "))}else g.push(this.ori.join(" "))}toKPuzzle(){let g=this.perm.length;return this.isIdentity()?(Ee.kcache[g]||(Ee.kcache[g]={permutation:we(g),orientation:rB(g)}),Ee.kcache[g]):{permutation:this.perm,orientation:this.ori}}},me=Ee;me.kcache=[];ri=class{constructor(g){this.orbits=g}internalMul(g){let e=[];for(let B=0;B<this.orbits.length;B++)e.push(this.orbits[B].mul(g.orbits[B]));return e}internalInv(){let g=[];for(let e of this.orbits)g.push(e.inv());return g}equal(g){for(let e=0;e<this.orbits.length;e++)if(!this.orbits[e].equal(g.orbits[e]))return!1;return!0}killOri(){for(let g of this.orbits)g.killOri();return this}toPerm(){let g=new Array,e=0;for(let I of this.orbits){let o=I.toPerm();g.push(o),e+=o.n}let B=new Array(e);e=0;for(let I of g){for(let o=0;o<I.n;o++)B[e+o]=e+I.p[o];e+=I.n}return new Xg(B)}identicalPieces(){let g=[],e=0;for(let B of this.orbits){let I=B.orimod,o=B.identicalPieces();for(let t=0;t<o.length;t++)g.push(o[t].map(i=>i*I+e));e+=I*B.perm.length}return g}order(){let g=1;for(let e of this.orbits)g=Nr(g,e.order());return g}},Je=class extends ri{constructor(g){super(g)}mul(g){return new Je(this.internalMul(g))}mulScalar(g){if(g===0)return this.e();let e=this;for(g<0&&(e=e.inv(),g=-g);(g&1)===0;)e=e.mul(e),g>>=1;if(g===1)return e;let B=e,I=this.e();for(;g>0;)g&1&&(I=I.mul(B)),g>1&&(B=B.mul(B)),g>>=1;return I}inv(){return new Je(this.internalInv())}e(){return new Je(this.orbits.map(g=>me.e(g.perm.length,g.orimod)))}},_B=class extends ri{constructor(g){super(g)}mul(g){return new _B(this.internalMul(g))}},ni=class{constructor(g){this.n=g;this.heads=new Array(g);for(let e=0;e<g;e++)this.heads[e]=e}find(g){let e=this.heads[g];return this.heads[e]===e||(e=this.find(this.heads[e]),this.heads[g]=e),e}union(g,e){let B=this.find(g),I=this.find(e);B<I?this.heads[I]=B:B>I&&(this.heads[B]=I)}}});var Ei,cl=U(()=>{"use strict";Ei={"2x2x2":"c f 0","3x3x3":"c f 0.333333333333333","4x4x4":"c f 0.5 f 0","5x5x5":"c f 0.6 f 0.2","6x6x6":"c f 0.666666666666667 f 0.333333333333333 f 0","7x7x7":"c f 0.714285714285714 f 0.428571428571429 f 0.142857142857143","8x8x8":"c f 0.75 f 0.5 f 0.25 f 0","9x9x9":"c f 0.777777777777778 f 0.555555555555556 f 0.333333333333333 f 0.111111111111111","10x10x10":"c f 0.8 f 0.6 f 0.4 f 0.2 f 0","11x11x11":"c f 0.818181818181818 f 0.636363636363636 f 0.454545454545455 f 0.272727272727273 f 0.0909090909090909","12x12x12":"c f 0.833333333333333 f 0.666666666666667 f 0.5 f 0.333333333333333 f 0.166666666666667 f 0","13x13x13":"c f 0.846153846153846 f 0.692307692307692 f 0.538461538461538 f 0.384615384615385 f 0.230769230769231 f 0.0769230769230769","20x20x20":"c f 0 f .1 f .2 f .3 f .4 f .5 f .6 f .7 f .8 f .9","30x30x30":"c f 0 f .066667 f .133333 f .2 f .266667 f .333333 f .4 f .466667 f .533333 f .6 f .666667 f .733333 f .8 f .866667 f .933333","40x40x40":"c f 0 f .05 f .1 f .15 f .2 f .25 f .3 f .35 f .4 f .45 f .5 f .55 f .6 f .65 f .7 f .75 f .8 f .85 f .9 f .95",skewb:"c v 0","master skewb":"c v 0.275","professor skewb":"c v 0 v 0.38","compy cube":"c v 0.915641442663986",helicopter:"c e 0.707106781186547","curvy copter":"c e 0.83",dino:"c v 0.577350269189626","little chop":"c e 0",pyramorphix:"t e 0",mastermorphix:"t e 0.346184634065199",pyraminx:"t v 0.333333333333333 v 1.66666666666667",tetraminx:"t v 0.333333333333333","master pyraminx":"t v 0 v 1 v 2","master tetraminx":"t v 0 v 1","professor pyraminx":"t v -0.2 v 0.6 v 1.4 v 2.2","professor tetraminx":"t v -0.2 v 0.6 v 1.4","Jing pyraminx":"t f 0","master pyramorphix":"t e 0.866025403784437",megaminx:"d f 0.7",gigaminx:"d f 0.64 f 0.82",teraminx:"d f 0.64 f 0.76 f 0.88",petaminx:"d f 0.64 f 0.73 f 0.82 f 0.91",examinx:"d f 0.64 f 0.712 f 0.784 f 0.856 f 0.928",zetaminx:"d f 0.64 f 0.7 f 0.76 f 0.82 f 0.88 f 0.94",yottaminx:"d f 0.64 f 0.6914 f 0.7429 f 0.7943 f 0.8457 f 0.8971 f 0.9486",pentultimate:"d f 0","master pentultimate":"d f 0.1","elite pentultimate":"d f 0 f 0.145905",starminx:"d v 0.937962370425399","starminx 2":"d f 0.23606797749979","pyraminx crystal":"d f 0.447213595499989",chopasaurus:"d v 0","big chop":"d e 0","skewb diamond":"o f 0",FTO:"o f 0.333333333333333","master FTO":"o f 0.5 f 0","Christopher's jewel":"o v 0.577350269189626",octastar:"o e 0","Trajber's octahedron":"o v 0.433012701892219","radio chop":"i f 0",icosamate:"i v 0","icosahedron 2":"i v 0.18759247376021","icosahedron 3":"i v 0.18759247376021 e 0","icosahedron static faces":"i v 0.84","icosahedron moving faces":"i v 0.73","Eitan's star":"i f 0.61803398874989","2x2x2 + dino":"c f 0 v 0.577350269189626","2x2x2 + little chop":"c f 0 e 0","dino + little chop":"c v 0.577350269189626 e 0","2x2x2 + dino + little chop":"c f 0 v 0.577350269189626 e 0","megaminx + chopasaurus":"d f 0.61803398875 v 0","starminx combo":"d f 0.23606797749979 v 0.937962370425399"}});function Qi(A){let g=new iA(0,0,0,0);for(let e=0;e<A.length;e++)g=g.sum(A[e]);return g.smul(1/A.length)}function Ll(A,g,e,B){let I=B[A].intersect3(B[g],B[e]);if(!I)return I;for(let o=0;o<B.length;o++)if(o!==A&&o!==g&&o!==e){let t=B[o].b*I.b+B[o].c*I.c+B[o].d*I.d;if(B[o].a>0&&t>B[o].a||B[o].a<0&&t<B[o].a)return!1}return I}var iA,li=U(()=>{"use strict";iA=class{constructor(g,e,B,I){this.a=g;this.b=e;this.c=B;this.d=I}mul(g){return new iA(this.a*g.a-this.b*g.b-this.c*g.c-this.d*g.d,this.a*g.b+this.b*g.a+this.c*g.d-this.d*g.c,this.a*g.c-this.b*g.d+this.c*g.a+this.d*g.b,this.a*g.d+this.b*g.c-this.c*g.b+this.d*g.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(g){return Math.hypot(this.a-g.a,this.b-g.b,this.c-g.c,this.d-g.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(g){return new iA(0,this.c*g.d-this.d*g.c,this.d*g.b-this.b*g.d,this.b*g.c-this.c*g.b)}dot(g){return this.b*g.b+this.c*g.c+this.d*g.d}normalize(){let g=Math.sqrt(this.dot(this));return new iA(this.a/g,this.b/g,this.c/g,this.d/g)}makenormal(){return new iA(0,this.b,this.c,this.d).normalize()}normalizeplane(){let g=Math.hypot(this.b,this.c,this.d);return new iA(this.a/g,this.b/g,this.c/g,this.d/g)}smul(g){return new iA(this.a*g,this.b*g,this.c*g,this.d*g)}sum(g){return new iA(this.a+g.a,this.b+g.b,this.c+g.c,this.d+g.d)}sub(g){return new iA(this.a-g.a,this.b-g.b,this.c-g.c,this.d-g.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new iA(this.a,-this.b,-this.c,-this.d)}det3x3(g,e,B,I,o,t,i,r,n){return g*(o*n-t*r)+e*(t*i-I*n)+B*(I*r-o*i)}rotateplane(g){let e=g.mul(new iA(0,this.b,this.c,this.d)).mul(g.invrot());return e.a=this.a,e}orthogonal(){let g=Math.abs(this.b),e=Math.abs(this.c),B=Math.abs(this.d);return g<e&&g<B?this.cross(new iA(0,1,0,0)).normalize():e<g&&e<B?this.cross(new iA(0,0,1,0)).normalize():this.cross(new iA(0,0,0,1)).normalize()}pointrotation(g){let e=this.normalize();if(g=g.normalize(),e.sub(g).len()<1e-9)return new iA(1,0,0,0);let B=e.sum(g);B.len()<1e-9?B=B.orthogonal():B=B.normalize();let I=e.cross(B);return I.a=e.dot(B),I}unproject(g){return this.sum(g.smul(-this.dot(g)/(this.len()*g.len())))}rotatepoint(g){return g.mul(this).mul(g.invrot())}rotateface(g){return g.map(e=>e.rotatepoint(this))}intersect3(g,e){let B=this.det3x3(this.b,this.c,this.d,g.b,g.c,g.d,e.b,e.c,e.d);return Math.abs(B)<1e-9?!1:new iA(0,this.det3x3(this.a,this.c,this.d,g.a,g.c,g.d,e.a,e.c,e.d)/B,this.det3x3(this.b,this.a,this.d,g.b,g.a,g.d,e.b,e.a,e.d)/B,this.det3x3(this.b,this.c,this.a,g.b,g.c,g.a,e.b,e.c,e.a)/B)}side(g){return g>1e-9?1:g<-1e-9?-1:0}cutface(g){let e=this.a,B=0,I=null;for(let o=0;o<g.length;o++)B|=1<<this.side(g[o].dot(this)-e)+1;if((B&5)===5){I=[];let o=g.map(t=>this.side(t.dot(this)-e));for(let t=-1;t<=1;t+=2){let i=[];for(let r=0;r<g.length;r++){(o[r]===t||o[r]===0)&&i.push(g[r]);let n=(r+1)%g.length;if(o[r]+o[n]===0&&o[r]!==0){let l=g[r].dot(this)-e,Q=g[n].dot(this)-e,f=l/(l-Q),c=g[r].smul(1-f).sum(g[n].smul(f));i.push(c)}}I.push(i)}}return I}cutfaces(g){let e=[];for(let B=0;B<g.length;B++){let I=g[B],o=this.cutface(I);o?(e.push(o[0]),e.push(o[1])):e.push(I)}return e}faceside(g){let e=this.a;for(let B=0;B<g.length;B++){let I=this.side(g[B].dot(this)-e);if(I!==0)return I}throw new Error("Could not determine side of plane in faceside")}sameplane(g){let e=this.normalize(),B=g.normalize();return e.dist(B)<1e-9||e.dist(B.smul(-1))<1e-9}makecut(g){return new iA(g,this.b,this.c,this.d)}}});function Rl(){let A=Math.sqrt(.5);return[new iA(A,A,0,0),new iA(A,0,A,0)]}function ul(){return[new iA(.5,.5,.5,.5),new iA(.5,.5,.5,-.5)]}function hl(){let A=2*Math.PI/10,g=.5+.3*Math.sqrt(5),e=.5+.1*Math.sqrt(5),B=Math.sqrt(g*g+e*e);return g/=B,e/=B,[new iA(Math.cos(A),g*Math.sin(A),e*Math.sin(A),0),new iA(.5,.5,.5,.5)]}function yl(){let A=.16666666666666666+Math.sqrt(5)/6,g=2/3+Math.sqrt(5)/3,e=Math.sqrt(A*A+g*g);A/=e,g/=e;let B=2*Math.PI/6;return[new iA(Math.cos(B),A*Math.sin(B),g*Math.sin(B),0),new iA(Math.cos(B),-A*Math.sin(B),g*Math.sin(B),0)]}function pl(){let A=Math.sqrt(.5);return[new iA(.5,.5,.5,.5),new iA(A,0,0,A)]}function Fl(A){let g=[new iA(1,0,0,0)];for(let e=0;e<g.length;e++)for(let B=0;B<A.length;B++){let I=A[B].mul(g[e]),o=I.smul(-1),t=!1;for(let i=0;i<g.length;i++)if(I.dist(g[i])<si||o.dist(g[i])<si){t=!0;break}t||g.push(I)}return g}function Mr(A,g){let e=[],B=[];for(let I=0;I<g.length;I++){let o=A.rotateplane(g[I]),t=!1;for(let i=0;i<e.length;i++)if(o.dist(e[i])<si){t=!0;break}t||(e.push(o),B.push(g[I]))}return B}function Kr(A){let g=[];for(let e=1;e<A.length;e++)for(let B=e+1;B<A.length;B++){let I=Ll(0,e,B,A);if(I){let o=!1;for(let t=0;t<g.length;t++)if(I.dist(g[t])<si){o=!0;break}o||g.push(I)}}for(;;){let e=!1;for(let B=0;B<g.length;B++){let I=(B+1)%g.length;if(A[0].dot(g[B].cross(g[I]))<0){let o=g[B];g[B]=g[I],g[I]=o,e=!0}}if(!e)break}return g}var si,wl=U(()=>{"use strict";li();si=1e-9});function ai(A,g){let e=A[0].p.length,B=sl(e),I=[],o=[],t=[],i=[],r=[];function n(c){for(let R=c.p.length-1;R>=0;R--){let L=c.p[R];if(L!==R){if(!I[R][L])return!1;c=c.mul(o[R][L])}}return!0}function l(c,R,L){i[c].push(R),r[c].push(L);for(let p=0;p<I[c].length;p++)I[c][p]&&Q(c,I[c][p].mul(R),L+t[c][p])}function Q(c,R,L){let p=R.p[c];if(!I[c][p]){I[c][p]=R,o[c][p]=R.inv(),t[c][p]=L;for(let d=0;d<i[c].length;d++)Q(c,R.mul(i[c][d]),L+r[c][d]);return}let k=R.mul(o[c][p]);n(k)||l(c-1,k,L+t[c][p])}function f(){I=[],o=[],i=[],t=[],r=[];for(let L=0;L<e;L++)I.push([]),o.push([]),t.push([]),i.push([]),r.push([]),I[L][L]=B,o[L][L]=B,t[L][L]=0;let c=0,R=BigInt(1);for(let L=0;L<A.length;L++){l(e-1,A[L],1),R=BigInt(1);let p=0,k=0,d=[],N=new xr;for(let K=0;K<e;K++){let Y=0,O=0;for(let _=0;_<e;_++)I[K][_]&&(Y++,O+=t[K][_],K!==_&&c++);p+=i[K].length,R*=BigInt(Y),Y>1&&N.multiply(Y);let QA=O/Y;d.push(QA),k+=QA}g(\`\${L}: sz \${R} T \${p} sol \${k} none \${c} mults \${N.toString()}\`)}return R}return f()}var xr,Yr=U(()=>{"use strict";ii();xr=class{constructor(){this.mult=[]}multiply(g){for(let e=2;e*e<=g;e++)for(;g%e===0;)this.mult[e]!==void 0?this.mult[e]++:this.mult[e]=1,g/=e;g>1&&(this.mult[g]!==void 0?this.mult[g]++:this.mult[g]=1)}toString(){let g="";for(let e=0;e<this.mult.length;e++)this.mult[e]!==void 0&&(g!==""&&(g+="*"),g+=e,this.mult[e]>1&&(g+=\`^\${this.mult[e]}\`));return g}}});function lL(A,g){let e=[];for(let B of A)for(let I of g)e.push(I.rotate(B));return e}function fL(){return{4:[["F","D","L","R"]],6:[["F","D","L","U","R"],["R","F","","B",""]],8:[["F","D","L","R"],["D","F","BR",""],["BR","D","","BB"],["BB","BR","U","BL"]],12:[["U","FF","","","",""],["FF","U","R","FR","FL","L"],["R","FF","","","DR",""],["DR","R","","BB","",""],["BB","DR","BR","BL","DL","DD"]],20:[["R","C","F","E"],["F","R","L","U"],["L","F","A",""],["E","R","G","I"],["I","E","S","H"],["S","I","J","B"],["B","S","K","D"],["K","B","M","O"],["O","K","P","N"],["P","O","Q",""]]}}function DL(){return{4:{F:"#44ee00",D:"#ffff00",L:"#ff0000",R:"#2266ff"},6:{U:"#ffffff",F:"#44ee00",R:"#ff0000",D:"#ffff00",B:"#2266ff",L:"#ff8000"},8:{U:"#ffffff",F:"#ff0000",R:"#44ee00",D:"#ffff00",BB:"#2266ff",L:"#8800dd",BL:"#ff8000",BR:"#aaaaaa"},12:{U:"#ffffff",FF:"#008800",R:"#ff0000",FR:"#ffffd0",FL:"#3399ff",L:"#8800dd",DR:"#ff66cc",BB:"#99ff00",BR:"#0000ff",BL:"#ffff00",DL:"#ff8000",DD:"#aaaaaa"},20:{R:"#db69f0",C:"#178fde",F:"#23238b",E:"#9cc726",L:"#2c212d",U:"#177fa7",A:"#e0de7f",G:"#2b57c0",I:"#41126b",S:"#4b8c28",H:"#7c098d",J:"#7fe7b4",B:"#85fb74",K:"#3f4bc3",D:"#0ff555",M:"#f1c2c8",O:"#58d340",P:"#c514f2",N:"#14494e",Q:"#8b1be1"}}}function LL(){return{4:[["FLR",[0,1,0]],["F",[0,0,1]]],6:[["U",[0,1,0]],["F",[0,0,1]]],8:[["U",[0,1,0]],["F",[0,0,1]]],12:[["U",[0,1,0]],["FF",[0,0,1]]],20:[["GUQMJ",[0,1,0]],["F",[0,0,1]]]}}function fi(A,g){for(let e=0;e<A.length;e++)if(A[e][0].dist(g)<eg)return e;throw new Error("Element not found")}function ml(){return Ei}function dl(A){return Ei[A]}function Xo(A){let g=A.split(/ /).filter(Boolean);if(g.length%2===0)return null;let e=g[0];if(e!=="o"&&e!=="c"&&e!=="i"&&e!=="d"&&e!=="t")return null;let B=[];for(let I=1;I<g.length;I+=2){if(g[I]!=="f"&&g[I]!=="v"&&g[I]!=="e")return null;B.push({cutType:g[I],distance:parseFloat(g[I+1])})}return{shape:e,cuts:B}}function vr(A,g={}){let e=Xo(A);if(e===null)throw new Error("Could not parse the puzzle description");let B=new $o(e,Object.assign({},{allMoves:!0},g));return B.allstickers(),B.genperms(),B}function Ul(A,g){return vr(Ei[A],g)}function RL(A,g,e){let B=!1;e-g[1]<g[0]&&(A=[A[2],A[3],A[0],A[1]],g=[e-g[1],e-g[0]],B=!0);let I=A[0],o="";if(g[0]===0&&g[1]===e)I=\`\${I}v\`;else if(g[0]===g[1])g[1]>0&&(o=String(g[1]+1));else if(g[0]===0)I=I.toLowerCase(),g[1]>1&&(o=String(g[1]+1));else throw new Error(\`We only support slice and outer block moves right now. \${g}\`);return[o+I,B]}function uL(A,g){let e=[],B=0;for(;B<A.length;){B>0&&B<A.length&&A[B]==="_"&&B++;let I="";for(let o of g)A.substr(B).startsWith(o[1])&&o[1].length>I.length&&(I=o[1]);if(I!=="")e.push(I),B+=I.length;else throw new Error(\`Could not split \${A} into face names.\`)}return e}function Di(A,g){return[A.b/g,-A.c/g,A.d/g]}function br(A,g){let e=[],B=A.length;for(let I=0;I<B;I++){let o=Di(A.get(B-I-1),g);e[3*I]=o[0],e[3*I+1]=o[1],e[3*I+2]=o[2]}return e}var nB,HI,eg,sL,aL,cL,Sl,kl,$o,ci,Zo=U(()=>{"use strict";SA();ZQ();Sr();kr();ii();Dl();cl();wl();li();Yr();nB=class{constructor(g){this.coords=new Array(g.length*3);for(let e=0;e<g.length;e++)this.coords[3*e]=g[e].b,this.coords[3*e+1]=g[e].c,this.coords[3*e+2]=g[e].d;this.length=g.length}get(g){return new iA(0,this.coords[3*g],this.coords[3*g+1],this.coords[3*g+2])}centermass(){let g=0,e=0,B=0;for(let I=0;I<this.length;I++)g+=this.coords[3*I],e+=this.coords[3*I+1],B+=this.coords[3*I+2];return new iA(0,g/this.length,e/this.length,B/this.length)}rotate(g){let e=[];for(let B=0;B<this.length;B++)e.push(this.get(B).rotatepoint(g));return new nB(e)}rotateforward(){let g=[];for(let e=1;e<this.length;e++)g.push(this.get(e));return g.push(this.get(0)),new nB(g)}},HI=class{constructor(g,e,B){this.face=g;this.left=e;this.right=B}split(g){let e=g.cutface(this.face);return e!==null&&(this.left===void 0?(this.left=new HI(e[0]),this.right=new HI(e[1])):(this.left=this.left?.split(g),this.right=this.right?.split(g))),this}collect(g,e){return this.left===void 0?g.push(new nB(this.face)):e?(this.left?.collect(g,!1),this.right?.collect(g,!0)):(this.right?.collect(g,!1),this.left?.collect(g,!0)),g}};eg=1e-9,sL="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",aL=!1;cL={4:{v:["DFR","DLF","DRL","FLR"],e:["FR","LF","DF","DL","RD","RL"],c:["DF","FD","RL","LR"]},6:{v:["URF","UBR","ULB","UFL","DFR","DRB","DBL","DLF"],e:["UF","UR","UB","UL","DF","DR","DB","DL","FR","FL","BR","BL"],c:["UB","LU","FU","RU","BU","DF"]},8:{v:["UBBBRR","URFL","ULBLBB","DBRBBBL","DBLLF","DFRBR"],e:["UL","UBB","UR","BRD","BLD","FD","BRR","FR","FL","BLL","BLBB","BRBB"],c:["BBU","LU","RU","BRD","FD","BLD","DF","UBB"]},12:{v:["URFF","UFFL","ULBL","UBLBR","UBRR","DDDRBB","DDBBDL","DDDLFL","DDFLFR","DDFRDR","LFLDL","FLLFF","FFFRFL","FRFFR","RDRFR","DRRBR","BRBBDR","BBBRBL","BLDLBB","DLBLL"],e:["UFF","UR","UBR","UBL","UL","DRR","DRBR","DRBB","DRDD","DRFR","DLBB","DLBL","DLL","DLFL","DLDD","FLFR","FRFF","FFFL","BBBR","BRBL","BLBB","FRDD","FLDD","FLL","FFL","FFR","FRR","BBDD","BRR","BLL"],c:["UFF","FFU","DDBB","BBDD","FLDD","FRDD","BRU","BLU","LFL","RFL","DRBR","DLBL"]},20:{v:["FLPQU","FUGER","FRCAL","HCREI","ISBDH","JSIEG","BSJMK","MQPOK","ONDBK","NOPLA","UQMJG","DNACH"],e:["FU","FL","FR","EG","ER","EI","SJ","SI","SB","KM","KB","KO","PQ","PO","PL","UG","JG","MQ","UQ","HC","HD","ND","NA","JM","CA","AL","CR","HI","DB","NO"],c:["FU","UF","GE","EG","JS","SJ","MK","KM","QP","PQ","LA","AL","RC","CR","IH","HI","BD","DB","ON","NO"]}};Sl=["c","t","o","d","i"],kl=["f","v","e"];$o=class{constructor(g,e){this.puzzleDescription=g;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.notationMapper=new zB;this.addNotationMapper="";this.setReidOrder=!1;let B="genperms";this.options=new ti(e),this.options.verbosity>0&&console.log(this.header("# ")),this.create(g)}create(g){let{shape:e,cuts:B}=g;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let I=null;switch(e){case"c":{I=Rl();break}case"o":{I=pl();break}case"i":{I=yl();break}case"t":{I=ul();break}case"d":{I=hl();break}default:throw new Error(\`Bad shape argument: \${e}\`)}this.rotations=Fl(I),this.options.verbosity&&console.log(\`# Rotations: \${this.rotations.length}\`);let o=I[0];this.baseplanerot=Mr(o,this.rotations);let t=this.baseplanerot.map(G=>o.rotateplane(G));this.baseplanes=t,this.baseFaceCount=t.length;let i=fL()[t.length];this.net=i,this.colors=DL()[t.length],this.options.verbosity>0&&console.log(\`# Base planes: \${t.length}\`);let r=Kr(t),n=new iA(0,0,0,0);this.options.verbosity>0&&console.log(\`# Face vertices: \${r.length}\`);let l=t[0].makenormal(),Q=r[0].sum(r[1]).makenormal(),f=r[0].makenormal(),c=new iA(1,l.b,l.c,l.d);this.options.verbosity>0&&console.log(\`# Boundary is \${c}\`);let L=Mr(c,this.rotations).map(G=>c.rotateplane(G)),p=Kr(L);this.edgedistance=p[0].sum(p[1]).smul(.5).dist(n),this.vertexdistance=p[0].dist(n);let k=[],d=[],N=!1,K=!1,Y=!1;for(let G of B){let P=null,AA=0;switch(G.cutType){case"f":{P=l,AA=1,N=!0;break}case"v":{P=f,AA=this.vertexdistance,Y=!0;break}case"e":{P=Q,AA=this.edgedistance,K=!0;break}default:throw new Error(\`Bad cut argument: \${G.cutType}\`)}k.push(P.makecut(G.distance)),d.push(G.distance<AA)}this.options.addRotations&&(N||k.push(l.makecut(10)),Y||k.push(f.makecut(10)),K||k.push(Q.makecut(10))),this.basefaces=[];for(let G of this.baseplanerot){let P=G.rotateface(p);this.basefaces.push(new nB(P))}let O=[],QA=[],_=[],rA=[],M=p.length;function q(G,P,AA){for(let $ of G)if($[0].dist(P)<eg){$.push(AA);return}G.push([P,AA])}for(let G=0;G<this.baseplanerot.length;G++){let P=this.baseplanerot[G].rotateface(p);for(let AA=0;AA<P.length;AA++){let $=(AA+1)%P.length,sA=P[AA].sum(P[$]).smul(.5);q(rA,sA,G)}}let z=[];for(let G=0;G<this.baseplanerot.length;G++){let P=this.baseplanerot[G].rotateface(p),AA=[];for(let $=0;$<P.length;$++){let sA=($+1)%P.length,dA=P[$].sum(P[sA]).smul(.5),Ig=rA[fi(rA,dA)];if(G===Ig[1])AA.push(Ig[2]);else if(G===Ig[2])AA.push(Ig[1]);else throw new Error("Could not find edge")}z.push(AA)}let v={},H=[];H.push(i[0][0]),v[i[0][0]]=0,H[z[0][0]]=i[0][1],v[i[0][1]]=z[0][0];for(let G of i){let P=G[0],AA=v[P];if(AA===void 0)throw new Error("Bad edge description; first edge not connected");let $=-1;for(let sA=0;sA<z[AA].length;sA++){let dA=H[z[AA][sA]];if(dA!==void 0&&dA===G[1]){$=sA;break}}if($<0)throw new Error("First element of a net not known");for(let sA=2;sA<G.length;sA++){if(G[sA]==="")continue;let dA=z[AA][(sA+$-1)%M],Ig=H[dA];if(Ig!==void 0&&Ig!==G[sA])throw new Error("Face mismatch in net");H[dA]=G[sA],v[G[sA]]=dA}}for(let G=0;G<this.baseplanerot.length;G++){let P=this.baseplanerot[G].rotateface(p),AA=c.rotateplane(this.baseplanerot[G]),$=H[G];O.push([P,$]),QA.push([AA,$])}for(let G=0;G<this.baseplanerot.length;G++){let P=this.baseplanerot[G].rotateface(p),AA=H[G];for(let $=0;$<P.length;$++){let sA=($+1)%P.length,dA=P[$].sum(P[sA]).smul(.5),Ig=($+2)%P.length,bC=P[sA].sum(P[Ig]).smul(.5),vC=fi(rA,dA),JC=fi(rA,bC);q(_,P[sA],[AA,JC,vC])}}this.swizzler=new YI(O.map(G=>G[1]));let X=this.swizzler.prefixFree?"":"_",CA=cL[this.baseFaceCount],gA=[];for(let G=0;G<this.baseFaceCount;G++)gA[1<<G]=G;{let G=CA.v;for(let P of G){let AA=this.swizzler.splitByFaceNames(P),$=0;for(let sA of AA)$|=1<<sA;gA[$]=AA[0]}}{let G=CA.e;for(let P of G){let AA=this.swizzler.splitByFaceNames(P),$=0;for(let sA of AA)$|=1<<sA;gA[$]=AA[0]}}{let G=CA.c;for(let P of G){let AA=this.swizzler.splitByFaceNames(P),$=1<<AA[0]|1<<this.baseFaceCount;gA[$]=AA[1]}}for(let G=0;G<rA.length;G++){if(rA[G].length!==3)throw new Error(\`Bad length in edge names \${rA[G]}\`);let P=rA[G][1],AA=rA[G][2],$=H[P],sA=H[AA],dA=1<<P|1<<AA;gA[dA]===P?$=$+X+sA:$=sA+X+$,rA[G]=[rA[G][0],$]}for(let G=0;G<_.length;G++){let P=0;if(_[G].length<4)throw new Error("Bad length in vertex names");for(let dA=1;dA<_[G].length;dA++)P|=1<<v[_[G][dA][0]];let AA=gA[P],$=-1;for(let dA=1;dA<_[G].length;dA++)AA===v[_[G][dA][0]]&&($=dA);if($<0)throw new Error("Internal error; couldn't find face name when fixing corners");let sA="";for(let dA=1;dA<_[G].length;dA++){dA===1?sA=_[G][$][0]:sA=sA+X+_[G][$][0];for(let Ig=1;Ig<_[G].length;Ig++)if(_[G][$][1]===_[G][Ig][2]){$=Ig;break}}_[G]=[_[G][0],sA]}this.markedface=gA,this.options.verbosity>1&&(console.log(\`# Face names: \${O.map(G=>G[1]).join(" ")}\`),console.log(\`# Edge names: \${rA.map(G=>G[1]).join(" ")}\`),console.log(\`# Vertex names: \${_.map(G=>G[1]).join(" ")}\`));let aA=[];for(let G of QA)aA.push([G[0].makenormal(),G[1],"f"]);for(let G of rA)aA.push([G[0].makenormal(),G[1],"e"]);for(let G of _)aA.push([G[0].makenormal(),G[1],"v"]);this.facenames=O,this.faceplanes=QA,this.edgenames=rA,this.vertexnames=_,this.geonormals=aA;let JA=aA.map(G=>G[1]);this.swizzler.setGripNames(JA),this.options.verbosity>0&&console.log(\`# Distances: face \${1} edge \${this.edgedistance} vertex \${this.vertexdistance}\`);for(let G=0;G<k.length;G++)for(let P of this.rotations){let AA=k[G].rotateplane(P),$=!1;for(let sA of this.moveplanes)if(AA.sameplane(sA)){$=!0;break}$||(this.moveplanes.push(AA),d[G]&&this.moveplanes2.push(AA))}let WA=new HI(p),eA=this.moveplanes2.slice(),PA=31;for(let G=0;G<eA.length;G++){let P=G+Math.floor((eA.length-G)*(PA/65536));WA=WA.split(eA[P]),eA[P]=eA[G],PA=(PA*1657+101)%65536}let xA=WA.collect([],!0);this.faces=xA,this.options.verbosity>0&&console.log(\`# Faces is now \${xA.length}\`),this.stickersperface=xA.length;let vg=[],yg=Qi(p);for(let G of this.rotations){let P=G.rotateface(p);yg.dist(Qi(P))<eg&&vg.push(G)}let Jg=new Array(xA.length),gg=[];for(let G=0;G<xA.length;G++){let P=xA[G].centermass();gg.push([yg.dist(P),P,G])}gg.sort((G,P)=>G[0]-P[0]);for(let G=0;G<xA.length;G++){let P=gg[G][2];if(!Jg[P]){Jg[P]=!0;for(let AA of vg){let $=xA[P].rotate(AA),sA=$.centermass();for(let dA=G+1;dA<xA.length&&!(gg[dA][0]-gg[G][0]>eg);dA++){let Ig=gg[dA][2];if(!Jg[Ig]&&sA.dist(gg[dA][1])<eg){Jg[Ig]=!0,xA[Ig]=$;break}}}}}this.shortedge=1e99;for(let G of xA)for(let P=0;P<G.length;P++){let AA=(P+1)%G.length,$=G.get(P).dist(G.get(AA));$<this.shortedge&&(this.shortedge=$)}this.options.verbosity>0&&console.log(\`# Short edge is \${this.shortedge}\`),e==="c"&&N&&!K&&!Y&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),e==="c"&&Y&&!N&&!K&&(this.addNotationMapper="SkewbMapper"),e==="t"&&(Y||N)&&!K&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),e==="o"&&N&&(this.notationMapper=new bI(this.swizzler,new YI(["F","D","L","BL","R","U","BR","B"])),K||Y||(this.addNotationMapper="FTOMapper")),e==="d"&&N&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new bI(this.swizzler,new YI(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(g){return this.keyface2(g.centermass())}keyface2(g){let e="",B=String.fromCharCode;for(let I of this.moveplanesets)if(I.length>0){let o=g.dot(I[0]),t=0,i=1;for(;i*2<=I.length;)i*=2;for(;i>0;i>>=1)t+i<=I.length&&o>I[t+i-1].a&&(t+=i);if(t<47)e=e+B(33+t);else if(t<47+47*47)e=e+B(33+47+Math.floor(t/47)-1)+B(33+t%47);else if(t<47+47*47+47*47*47)e=e+B(33+47+Math.floor((t-47)/(47*47)-1))+B(33+47+Math.floor((t-47)/47)%47)+B(33+t%47);else throw Error("Too many slices for cubie encoding")}return e}keyface3(g){let e=g.centermass(),B=[];for(let I of this.moveplanesets)if(I.length>0){let o=e.dot(I[0]),t=0,i=1;for(;i*2<=I.length;)i*=2;for(;i>0;i>>=1)t+i<=I.length&&o>I[t+i-1].a&&(t+=i);B.push(t)}return B}findface(g){let e=this.keyface2(g),B=this.facelisthash.get(e);if(B.length===1)return B[0];for(let I=0;I+1<B.length;I++){let o=this.facelisthash.get(e)[I];if(Math.abs(g.dist(this.facecentermass[o]))<eg)return o}return B[B.length-1]}project2d(g,e,B){let I=this.facenames[g][0],o=(e+1)%I.length,t=this.baseplanes[g],i=I[o].sub(I[e]),r=i.len();i=i.normalize();let n=i.cross(t).normalize(),l=B[1].sub(B[0]),Q=l.len()/r;l=l.normalize();let f=l.b,c=l.c,R=i.smul(f).sub(n.smul(c)).smul(Q),L=n.smul(f).sum(i.smul(c)).smul(Q),p=new iA(0,B[0].b-R.dot(I[e]),B[0].c-L.dot(I[e]),0);return[R,L,p]}allstickers(){let g="allstickers";this.faces=lL(this.baseplanerot,this.faces),this.options.verbosity>0&&console.log(\`# Total stickers is now \${this.faces.length}\`),this.facecentermass=new Array(this.faces.length);for(let M=0;M<this.faces.length;M++)this.facecentermass[M]=this.faces[M].centermass();let e=[],B=[];for(let M of this.moveplanes){let q=M.makenormal(),z=!1;for(let v of B)q.sameplane(v.makenormal())&&(z=!0);z||(B.push(q),e.push([]))}for(let M of this.moveplanes2){let q=M.makenormal();for(let z=0;z<B.length;z++)if(q.sameplane(B[z])){e[z].push(M);break}}for(let M=0;M<e.length;M++){let q=e[M].map(v=>v.normalizeplane()),z=B[M];for(let v=0;v<q.length;v++)q[v].makenormal().dist(z)>eg&&(q[v]=q[v].smul(-1));q.sort((v,H)=>v.a-H.a),e[M]=q}this.moveplanesets=e,this.moveplanenormals=B;let I=e.map(M=>M.length);this.options.verbosity>0&&console.log(\`# Move plane sets: \${I}\`);let o=[];for(let M=0;M<e.length;M++)o.push([]);for(let M of this.rotations){if(Math.abs(Math.abs(M.a)-1)<eg)continue;let q=M.makenormal();for(let z=0;z<e.length;z++)if(q.sameplane(B[z])){o[z].push(M);break}}this.moverotations=o;for(let M=0;M<o.length;M++){let q=o[M],z=q[0].makenormal();for(let v=0;v<q.length;v++)z.dist(q[v].makenormal())>eg&&(q[v]=q[v].smul(-1));q.sort((v,H)=>v.angle()-H.angle()),o[M][0].dot(B[M])<0&&q.reverse()}let t=o.map(M=>1+M.length);this.movesetorders=t;let i=[],r="?";for(let M=0;M<e.length;M++){let q=B[M],z=null,v=null;for(let H of this.geonormals){let X=q.dot(H[0]);Math.abs(X-1)<eg?(v=[H[1],H[2]],r=H[2]):Math.abs(X+1)<eg&&(z=[H[1],H[2]],r=H[2])}if(v===null||z===null)throw new Error("Saw positive or negative sides as null");i.push([v[0],v[1],z[0],z[1],1+e[M].length]),this.addNotationMapper==="NxNxNCubeMapper"&&r==="f"&&(this.notationMapper=new Wo(1+e[M].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&e[0].length===1&&(this.notationMapper=new Vo(this.swizzler),this.addNotationMapper=""),this.addNotationMapper==="PyraminxOrTetraminxMapper"&&(e[0].length===2&&e[0][0].a===.333333333333333&&e[0][1].a===1.66666666666667?(this.notationMapper=new vI(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new jo(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&r==="f"&&(1+e[M].length===3&&(this.notationMapper=new _o(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&r==="f"&&(1+e[M].length===3&&(this.notationMapper=new Oo(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=i;let n=new Map,l=this.faces;for(let M=0;M<l.length;M++){let q=l[M],z=this.keyface(q);if(!n.get(z))n.set(z,[M]);else{let v=n.get(z);if(v.push(M),v.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let H=0;H<v.length;H++){let X=\`\${z} \${H}\`;n.set(X,[v[H]])}}}}this.facelisthash=n,this.options.verbosity>0&&console.log(\`# Cubies: \${n.size}\`);let Q=[],f=[],c=[];for(let M of n.values())if(M.length!==this.baseFaceCount){if(M.length>1){let q=M.map(CA=>l[CA].centermass()),z=Qi(q);for(let CA=0;M.length>2;CA++){let gA=!1;for(let aA=0;aA<M.length;aA++){let JA=(aA+1)%M.length;if(z.dot(q[aA].cross(q[JA]))<0){let WA=q[aA];q[aA]=q[JA],q[JA]=WA;let eA=M[aA];M[aA]=M[JA],M[JA]=eA,gA=!0}}if(!gA)break;if(CA>1e3)throw new Error("Bad epsilon math; too close to border")}let v=0;for(let CA of M)v|=1<<Math.floor(CA/this.stickersperface);let H=this.markedface[v],X=-1;for(let CA=0;CA<M.length;CA++)Math.floor(M[CA]/this.stickersperface)===H&&(X=CA);if(X<0)throw new Error("Could not find marked face in list");if(X!==0){let CA=M.slice();for(let gA=0;gA<M.length;gA++)M[gA]=CA[(X+gA)%M.length]}}for(let q=0;q<M.length;q++){let z=M[q];f[z]=Q.length,c[z]=q}Q.push(M)}this.cubies=Q,this.facetocubie=f,this.facetoord=c;let R=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],L=[],p=[0,0,0,0,0,0],k=[],d=[],N=0,K=[],Y=[],O=[],QA=[],_=M=>Q[M].map(q=>this.getfaceindex(q)).join(" "),rA=[];for(let M=0;M<Q.length;M++){let q=Q[M];if(q.length===0||d[M])continue;let z={},v=0;O.push(0),rA.push([]);let H=q.length,X=p[H]++,CA=R[H];(CA===void 0||H===this.baseFaceCount)&&(CA="CORE"),CA=CA+(X===0?"":X+1),L[N]=CA,k[N]=H;let gA=[M],aA=0;for(d[M]=!0;aA<gA.length;){let JA=gA[aA++],WA=_(JA);if((q.length>1||z[WA]===void 0)&&(z[WA]=v++),QA[JA]=z[WA],K[JA]=N,rA[N].push(JA),Y[JA]=O[N]++,gA.length<this.rotations.length){let eA=this.facecentermass[Q[JA][0]];for(let PA of o){let xA=this.facetocubie[this.findface(eA.rotatepoint(PA[0]))];d[xA]||(gA.push(xA),d[xA]=!0)}}}N++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let M=[["UF","UR","UB","UL","DF","DR","DB","DL","FR","FL","BR","BL"],["UFR","URB","UBL","ULF","DRF","DFL","DLB","DBR"],["U","L","F","R","B","D"]],q={};for(let z of M)for(let v=0;v<z.length;v++){let H=0;for(let X=0;X<z[v].length;X++)H|=1<<z[v].charCodeAt(X)-65;q[H]=v}for(let z of rA)for(let v of z){let H=0;for(let X of Q[v])H|=1<<this.facenames[this.getfaceindex(X)][1].charCodeAt(0)-65;Y[v]=q[H]}}if(this.cubiesetnums=K,this.cubieordnums=Y,this.cubiesetnames=L,this.cubieords=O,this.orbitoris=k,this.cubievaluemap=QA,this.cubiesetcubies=rA,this.options.fixedPieceType!==null){for(let M=0;M<Q.length;M++)if(this.options.fixedPieceType==="v"&&Q[M].length>2||this.options.fixedPieceType==="e"&&Q[M].length===2||this.options.fixedPieceType==="f"&&Q[M].length===1){this.fixedCubie=M;break}if(this.fixedCubie<0)throw new Error(\`Could not find a cubie of type \${this.options.fixedPieceType} to fix.\`)}this.options.verbosity>0&&console.log(\`# Cubie orbit sizes \${O}\`)}unswizzle(g){let e=this.notationMapper.notationToInternal(g);return e===null?null:e.modified({family:this.swizzler.unswizzle(e.family)})}stringToBlockMove(g){let e=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),B=g.match(e);if(B===null)throw new Error(\`Bad move passed \${g}\`);let I=B[4],o,t;if(B[2]!==void 0){if(B[3]===void 0)throw new Error("Missing second number in range");o=parseInt(B[2],10)}B[3]!==void 0&&(t=parseInt(B[3],10));let i="1",r=1;return B[5]!==void 0&&(i=B[5],i[0]==="'"&&(i=\`-\${i.substring(1)}\`),r=parseInt(i,10)),new h(new T(I,t,o),r)}parseMove(g){let e=this.notationMapper.notationToInternal(g);if(e===null)throw new Error(\`Bad move \${g.family}\`);g=e;let B=g.family,I=!1;if(B.endsWith("v")&&B[0]<="Z"){if(g.innerLayer!==void 0||g.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");B=B.slice(0,-1),I=!0}B.endsWith("w")&&B[0]<="Z"&&(B=B.slice(0,-1).toLowerCase());let o,t=-1,i=this.swizzler.unswizzle(B),r=!1;for(let Q=0;Q<this.movesetgeos.length;Q++){let f=this.movesetgeos[Q];i===f[0]&&(r=!0,o=f,t=Q),i===f[2]&&(r=!1,o=f,t=Q)}let n=1,l=1;if(B.toUpperCase()!==B&&(l=2),o===void 0)throw new Error(\`Bad grip in move \${g.family}\`);if(g.outerLayer!==void 0&&(n=g.outerLayer),g.innerLayer!==void 0&&(g.outerLayer===void 0?(l=g.innerLayer,B<="Z"?n=l:n=1):l=g.innerLayer),n--,l--,I&&(n=0,l=this.moveplanesets[t].length),n<0||n>this.moveplanesets[t].length||l<0||l>this.moveplanesets[t].length)throw new Error(\`Bad slice spec \${n} \${l} vs \${this.moveplanesets[t].length}\`);if(!aL&&n===0&&l===this.moveplanesets[t].length&&!I)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,t,n,l,r,g.amount]}parsemove(g){let e=this.parseMove(this.stringToBlockMove(g));return e[0]=g,e}genperms(){let g="genperms";if(this.cmovesbyslice.length>0)return;let e=[];if(this.options.orientCenters){for(let B=0;B<this.cubies.length;B++)if(this.cubies[B].length===1){let I=this.cubies[B][0],o=this.getfaceindex(I),t=this.basefaces[o].centermass();if(t.dist(this.facecentermass[I])<eg){let i=1<<o|1<<this.baseFaceCount,r=this.markedface[i],n=this.baseplanes[r].makenormal(),l=-1,Q=-1;for(let R=0;R<this.faces[I].length;R++){let L=this.faces[I].get(R),p=n.dot(L.sub(t));p>l&&(l=p,Q=R)}let f=(Q+1)%this.faces[I].length;if(Math.abs(n.dot(this.faces[I].get(f).sub(t))-l)<eg&&(Q=f),Q!==0){let R=[];for(let L=0;L<this.faces[I].length;L++)R.push(this.faces[I].get((L+Q)%this.faces[I].length));this.faces[I]=new nB(R)}let c=this.basefaces[o].length;for(let R=1;R<c;R++)this.cubies[B].push(this.cubies[B][R-1]);this.duplicatedFaces[I]=c,this.duplicatedCubies[B]=c,this.orbitoris[this.cubiesetnums[B]]=c}}}for(let B=0;B<this.moveplanesets.length;B++){let I=this.moveplanesets[B],o=[],t=[I.length+1,0],i=1;for(;i*2<=I.length;)i*=2;for(let l=0;l<this.faces.length;l++){let Q=0;if(I.length>0){let f=this.facecentermass[l].dot(I[0]);for(let c=i;c>0;c>>=1)Q+c<=I.length&&f>I[Q+c-1].a&&(Q+=c);Q=I.length-Q}for(o.push(Q);t.length<=Q;)t.push(0);t[Q]++}let r=new Array(t.length);for(let l=0;l<t.length;l++)r[l]=[];let n=[];for(let l=0;l<this.faces.length;l++){if(o[l]<0)continue;let Q=[this.facetocubie[l],this.facetoord[l]],f=this.facecentermass[l],c=f,R=l,L=o[R];for(;;){o[R]=-1;let p=f.rotatepoint(this.moverotations[B][0]);if(p.dist(c)<eg)break;R=this.findface(p),Q.push(this.facetocubie[R],this.facetoord[R]),f=p}if(Q.length>2&&this.options.orientCenters&&(this.cubies[Q[0]].length===1||this.duplicatedCubies[Q[0]]>1)&&this.facecentermass[l].dist(this.basefaces[this.getfaceindex(l)].centermass())<eg){let p=this.faces[this.cubies[Q[0]][0]];for(let k=0;k<Q.length;k+=2){let d=this.faces[this.cubies[Q[k]][0]],N=-1;for(let K=0;K<p.length;K++)if(d.get(K).dist(p.get(0))<eg){N=K;break}if(N<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");Q[k+1]=N,p=p.rotate(this.moverotations[B][0])}}if(Q.length===2&&this.options.orientCenters)for(let p=1;p<this.movesetorders[B];p++)L===0?Q.push(Q[0],p):Q.push(Q[0],(this.movesetorders[B]-p)%this.movesetorders[B]);if(Q.length>2&&!n[Q[0]]){if(Q.length!==2*this.movesetorders[B])throw new Error("Bad length in perm gen");for(let p of Q)r[L].push(p)}for(let p=0;p<Q.length;p+=2)n[Q[p]]=!0}for(let l=0;l<r.length;l++)r[l]=r[l].slice();e.push(r)}if(this.cmovesbyslice=e,this.options.moveList){let B=[];for(let I of this.options.moveList)B.push(this.parsemove(I));this.parsedmovelist=B}this.facelisthash.clear(),this.facecentermass=[]}getboundarygeometry(){return{baseplanes:this.baseplanes,facenames:this.facenames,faceplanes:this.faceplanes,vertexnames:this.vertexnames,edgenames:this.edgenames,geonormals:this.geonormals}}getmovesets(g){let e=this.moveplanesets[g].length,B=[];if(this.parsedmovelist!==void 0)for(let I of this.parsedmovelist)I[1]===g&&(I[4]?B.push([I[2],I[3]]):B.push([e-I[3],e-I[2]]),B.push(I[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let I=this.movesetgeos[g];if(I[1]!==I[3])for(let o=0;o<e;o++)I[1]!=="v"?(this.options.outerBlockMoves?B.push([o+1,e]):B.push([o+1]),B.push(1)):(this.options.outerBlockMoves?B.push([0,o]):B.push([o,o]),B.push(1))}else for(let I=0;I<=e;I++)!this.options.allMoves&&I+I===e||(this.options.outerBlockMoves?I+I>e?B.push([I,e]):B.push([0,I]):B.push([I,I]),B.push(1));if(this.fixedCubie>=0){let I=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[g],o=[];for(let t=0;t<B.length;t+=2){let i=B[t];if(I>=i[0]&&I<=i[1])if(i[0]===0)i=[i[1]+1,e];else if(e===i[1])i=[0,i[0]-1];else throw Error("fixed cubie option would disconnect move");let r=!1;for(let n=0;n<o.length;n+=2)if(o[n][0]===i[0]&&o[n][1]===i[1]&&o[n+1]===B[t+1]){r=!0;break}r||(o.push(i),o.push(B[t+1]))}B=o}return B}graybyori(g){let e=this.cubies[g].length;return this.duplicatedCubies[g]&&(e=1),e===1&&(this.options.grayCenters||!this.options.includeCenterOrbits)||e===2&&(this.options.grayEdges||!this.options.includeEdgeOrbits)||e>2&&(this.options.grayCorners||!this.options.includeCornerOrbits)}skipbyori(g){let e=this.cubies[g].length;return this.duplicatedCubies[g]&&(e=1),e===1&&!this.options.includeCenterOrbits||e===2&&!this.options.includeEdgeOrbits||e>2&&!this.options.includeCornerOrbits}skipcubie(g){return this.skipbyori(g)}header(g){return g+sL+\`
|
|
7
7
|
\`+g+\`
|
|
8
8
|
\`}writegap(){let g=this.getOrbitsDef(!1),e=[],B=[];for(let o=0;o<g.moveops.length;o++){let t=\`M_\${Ci(this.notationMapper,g.movenames[o])}\`,i=!1;t[t.length-1]==="'"&&(t=t.substring(0,t.length-1),i=!0),B.push(t),i?e.push(\`\${t}:=\${g.moveops[o].toPerm().inv().toGap()};\`):e.push(\`\${t}:=\${g.moveops[o].toPerm().toGap()};\`)}e.push("Gen:=["),e.push(B.join(",")),e.push("];");let I=g.solved.identicalPieces();return e.push(\`ip:=[\${I.map(o=>\`[\${o.map(t=>t+1).join(",")}]\`).join(",")}];\`),e.push("# Size(Group(Gen));"),e.push("# Size(Stabilizer(Group(Gen), ip, OnTuplesSets));"),e.push(""),this.header("# ")+e.join(\`
|
|
9
9
|
\`)}writeksolve(g="PuzzleGeometryPuzzle"){let e=this.getOrbitsDef(!1);return this.header("# ")+e.toKsolve(g,this.notationMapper).join(\`
|
|
@@ -4325,4 +4325,4 @@ Alg U BR' U' BR BL' BR BL BR'
|
|
|
4325
4325
|
export {
|
|
4326
4326
|
workerSource
|
|
4327
4327
|
};
|
|
4328
|
-
//# sourceMappingURL=search-worker-inside-generated-string-
|
|
4328
|
+
//# sourceMappingURL=search-worker-inside-generated-string-UR6QHHVC.js.map
|