cubing 0.36.1 → 0.36.2
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 +3 -3
- package/dist/esm/{chunk-PY6UOVLX.js → chunk-BT4N5EGX.js} +3 -3
- package/dist/esm/{chunk-XVAB7A2O.js → chunk-CS3NN22U.js} +7 -5
- package/dist/esm/chunk-CS3NN22U.js.map +7 -0
- package/dist/esm/{chunk-RZEN653J.js → chunk-EODSL4J7.js} +3 -3
- package/dist/esm/{chunk-MHS6WQK3.js → chunk-HNCNLZCQ.js} +2 -2
- package/dist/esm/{chunk-U45QP7V5.js → chunk-IKK6NEES.js} +2 -2
- package/dist/esm/{chunk-P6BKQJQU.js → chunk-KPYYHLXC.js} +2 -2
- package/dist/esm/{chunk-PRIRJZQ6.js → chunk-QWQ3WKAJ.js} +1 -1
- package/dist/esm/{chunk-GNCANY6Y.js → chunk-Z4KB5H3Q.js} +9 -9
- package/dist/esm/notation/index.js +2 -2
- package/dist/esm/protocol/index.js +2 -2
- package/dist/esm/puzzle-geometry/index.js +67 -67
- package/dist/esm/puzzle-geometry/index.js.map +2 -2
- package/dist/esm/puzzles/index.js +2 -2
- package/dist/esm/scramble/index.js +6 -6
- package/dist/esm/search/index.js +6 -6
- package/dist/esm/{search-dynamic-sgs-side-events-UBB6BCFU.js → search-dynamic-sgs-side-events-X3HJIH2M.js} +3 -3
- package/dist/esm/{search-dynamic-sgs-unofficial-BTJQTYIB.js → search-dynamic-sgs-unofficial-4DTLRYXW.js} +3 -3
- package/dist/esm/{search-dynamic-solve-4x4x4-AJIQM7XH.js → search-dynamic-solve-4x4x4-KOSBPTFL.js} +4 -4
- package/dist/esm/{search-worker-inside-generated-string-S4N5JFZV.js → search-worker-inside-generated-string-EFAMJBWG.js} +2 -2
- package/dist/esm/search-worker-inside-generated-string-EFAMJBWG.js.map +7 -0
- package/dist/esm/{search-worker-js-entry-DMVNDNGG.js → search-worker-js-entry-Z7ZJHXOP.js} +6 -6
- package/dist/esm/{search-worker-ts-entry-CSGPRXKH.js → search-worker-ts-entry-7OR7E6EC.js} +2 -2
- package/dist/esm/twisty/index.js +8 -5
- package/dist/esm/twisty/index.js.map +2 -2
- package/dist/esm/{twisty-dynamic-3d-SGTMU2OZ.js → twisty-dynamic-3d-XRLWOI7Y.js} +4 -4
- package/package.json +2 -2
- package/dist/esm/chunk-XVAB7A2O.js.map +0 -7
- package/dist/esm/search-worker-inside-generated-string-S4N5JFZV.js.map +0 -7
- /package/dist/esm/{chunk-PY6UOVLX.js.map → chunk-BT4N5EGX.js.map} +0 -0
- /package/dist/esm/{chunk-RZEN653J.js.map → chunk-EODSL4J7.js.map} +0 -0
- /package/dist/esm/{chunk-MHS6WQK3.js.map → chunk-HNCNLZCQ.js.map} +0 -0
- /package/dist/esm/{chunk-U45QP7V5.js.map → chunk-IKK6NEES.js.map} +0 -0
- /package/dist/esm/{chunk-P6BKQJQU.js.map → chunk-KPYYHLXC.js.map} +0 -0
- /package/dist/esm/{chunk-PRIRJZQ6.js.map → chunk-QWQ3WKAJ.js.map} +0 -0
- /package/dist/esm/{chunk-GNCANY6Y.js.map → chunk-Z4KB5H3Q.js.map} +0 -0
- /package/dist/esm/{search-dynamic-sgs-side-events-UBB6BCFU.js.map → search-dynamic-sgs-side-events-X3HJIH2M.js.map} +0 -0
- /package/dist/esm/{search-dynamic-sgs-unofficial-BTJQTYIB.js.map → search-dynamic-sgs-unofficial-4DTLRYXW.js.map} +0 -0
- /package/dist/esm/{search-dynamic-solve-4x4x4-AJIQM7XH.js.map → search-dynamic-solve-4x4x4-KOSBPTFL.js.map} +0 -0
- /package/dist/esm/{search-worker-js-entry-DMVNDNGG.js.map → search-worker-js-entry-Z7ZJHXOP.js.map} +0 -0
- /package/dist/esm/{search-worker-ts-entry-CSGPRXKH.js.map → search-worker-ts-entry-7OR7E6EC.js.map} +0 -0
- /package/dist/esm/{twisty-dynamic-3d-SGTMU2OZ.js.map → twisty-dynamic-3d-XRLWOI7Y.js.map} +0 -0
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
twizzleEvents,
|
|
7
7
|
wcaEventInfo,
|
|
8
8
|
wcaEvents
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-KPYYHLXC.js";
|
|
10
|
+
import "../chunk-QWQ3WKAJ.js";
|
|
11
11
|
import "../chunk-UIGRNWPE.js";
|
|
12
12
|
import "../chunk-2OZSC5I6.js";
|
|
13
13
|
export {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
randomScrambleForEvent
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-CS3NN22U.js";
|
|
4
|
+
import "../chunk-Z4KB5H3Q.js";
|
|
5
5
|
import "../chunk-RHC3DIN3.js";
|
|
6
6
|
import "../chunk-ZYCJIZDN.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-EODSL4J7.js";
|
|
8
|
+
import "../chunk-HNCNLZCQ.js";
|
|
9
|
+
import "../chunk-KPYYHLXC.js";
|
|
10
|
+
import "../chunk-QWQ3WKAJ.js";
|
|
11
11
|
import "../chunk-UIGRNWPE.js";
|
|
12
12
|
import "../chunk-2OZSC5I6.js";
|
|
13
13
|
export {
|
package/dist/esm/search/index.js
CHANGED
|
@@ -6,16 +6,16 @@ import {
|
|
|
6
6
|
solvePyraminx,
|
|
7
7
|
solveSkewb,
|
|
8
8
|
solveTwsearch
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-CS3NN22U.js";
|
|
10
|
+
import "../chunk-Z4KB5H3Q.js";
|
|
11
11
|
import "../chunk-RHC3DIN3.js";
|
|
12
12
|
import "../chunk-ZYCJIZDN.js";
|
|
13
13
|
import {
|
|
14
14
|
random333State
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
15
|
+
} from "../chunk-EODSL4J7.js";
|
|
16
|
+
import "../chunk-HNCNLZCQ.js";
|
|
17
|
+
import "../chunk-KPYYHLXC.js";
|
|
18
|
+
import "../chunk-QWQ3WKAJ.js";
|
|
19
19
|
import "../chunk-UIGRNWPE.js";
|
|
20
20
|
import "../chunk-2OZSC5I6.js";
|
|
21
21
|
export {
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
cube2x2x2,
|
|
6
6
|
puzzles
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-KPYYHLXC.js";
|
|
8
|
+
import "./chunk-QWQ3WKAJ.js";
|
|
9
9
|
import {
|
|
10
10
|
KPuzzle
|
|
11
11
|
} from "./chunk-UIGRNWPE.js";
|
|
@@ -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-X3HJIH2M.js.map
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
} from "./chunk-HPHL232Y.js";
|
|
4
4
|
import {
|
|
5
5
|
puzzles
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-KPYYHLXC.js";
|
|
7
|
+
import "./chunk-QWQ3WKAJ.js";
|
|
8
8
|
import "./chunk-UIGRNWPE.js";
|
|
9
9
|
import {
|
|
10
10
|
Alg
|
|
@@ -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-4DTLRYXW.js.map
|
package/dist/esm/{search-dynamic-solve-4x4x4-AJIQM7XH.js → search-dynamic-solve-4x4x4-KOSBPTFL.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mustBeInsideWorker,
|
|
3
3
|
random333Scramble
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-EODSL4J7.js";
|
|
5
|
+
import "./chunk-KPYYHLXC.js";
|
|
6
|
+
import "./chunk-QWQ3WKAJ.js";
|
|
7
7
|
import "./chunk-UIGRNWPE.js";
|
|
8
8
|
import {
|
|
9
9
|
Alg
|
|
@@ -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-KOSBPTFL.js.map
|
|
@@ -3,7 +3,7 @@ var workerSource = `"use strict";var Gc=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(or)&&w(this,IB)===w(B,IB)}invert(){return this}*experimentalExpand(e=1,B=1/0){yield this}toString(){return\`//\${w(this,IB)}\`}},Ae=or;IB=new WeakMap});var Sg,No=U(()=>{"use strict";Ke();ye();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();ye();jA=class extends fg{toString(){return"."}isIdentical(e){return e.is(jA)}invert(){return this}*experimentalExpand(e=1,B=1/0){yield this}}});function gi(A,g){return A?parseInt(A):g}function tr(A){return new Mo().parseAlg(A)}function kQ(A){return new Mo().parseMove(A)}function UQ(A){return new Mo().parseQuantumMove(A)}function kg(A,g,e){let B=A;return B.startCharIndex=g,B.endCharIndex=e,B}function GQ(A,g){return"startCharIndex"in A&&(g.startCharIndex=A.startCharIndex),"endCharIndex"in A&&(g.endCharIndex=A.endCharIndex),g}var SQ,Zc,$c,AL,gL,eL,Pg,tA,dI,Mo,ir=U(()=>{"use strict";he();Br();Ir();hI();wI();Ko();Go();pe();No();mI();SQ=/^(\\d+)?('?)/,Zc=/^[_\\dA-Za-z]/,$c=/^((([1-9]\\d*)-)?([1-9]\\d*))?([_A-Za-z]+)?/,AL=/^[^\\n]*/,gL=/^(-?\\d+), ?/,eL=/^(-?\\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(gL);if(r){let n=r[1],l=w(this,tA),Q=this.parseRegex(eL),a=kg(new y(new T("U_SQ_"),parseInt(n)),i+1,i+1+n.length),D=kg(new y(new T("D_SQ_"),parseInt(Q[1])),l,w(this,tA)-1),R=kg(new J([a,D]),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(!dQ.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(AL);I.push(kg(new Ae(r),i,w(this,tA))),o=!1,B=w(this,tA);continue A}else{I.push(kg(new y("_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($c);return new T(B,gi(e,void 0),gi(g,void 0))}parseMoveImpl(){let g=w(this,tA);if(this.tryConsumeNext("/"))return kg(new y("_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 y(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(SQ);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[gi(e,1)*(B==="'"?-1:1),!e]}parseAmount(){let g=w(this,tA),[,e,B]=this.parseRegex(SQ);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 gi(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 $C(this,tA)._++,g}tryConsumeNext(g){return w(this,Pg)[w(this,tA)]===g?($C(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 ei(A){NQ.has(A)||(console.warn(A),NQ.add(A))}var NQ,Cr=U(()=>{"use strict";NQ=new Set});var vB,rr=U(()=>{"use strict";ye();er();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=FQ(g,this.amount<0);for(let o=0;o<B;o++)yield*this.quantum.experimentalExpand(I,e)}}});var xe,pg,Fg,Ii,T,Dg,SI,y,pe=U(()=>{"use strict";Ke();ye();er();ir();Cr();rr();Ii=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 UQ(e)}modified(e){return new Ii(e.family??w(this,xe),e.innerLayer??w(this,pg),e.outerLayer??w(this,Fg))}isIdentical(e){let B=e;return e.is(Ii)&&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=Ii;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 GQ(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 kQ(e)}get amount(){return w(this,Dg).amount}get type(){return ei("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()}},y=SI;Dg=new WeakMap});var Er,nr,qg,xo,Qg,Ko=U(()=>{"use strict";he();Ke();ye();pe();rr();Er=class{constructor(){this.quantumU_SQ_=null;this.quantumD_SQ_=null}format(g){if(g.amount!==1)return null;let e=this.tuple(g);return e?\`(\${e.map(B=>B.amount).join(", ")})\`:null}tuple(g){if(g.amount!==1)return null;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(y)?.quantum.isIdentical(this.quantumU_SQ_)&&I.as(y)?.quantum.isIdentical(this.quantumD_SQ_))return[B,I]}return null}},nr=new Er,xo=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(xo)&&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(){let e=nr.tuple(this);if(e){let[B,I]=e;return new xo(new J([B.invert(),I.invert()]))}return new xo(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 nr.format(this)??\`(\${w(this,qg).quantum.toString()})\${w(this,qg).suffix()}\`}experimentalAsSquare1Tuple(){return nr.tuple(this)}},Qg=xo;qg=new WeakMap});var kI=U(()=>{"use strict";Ko();Go();hI();wI();pe();No();mI()});function Ce(A,g){return A instanceof g}function MQ(A){return Ce(A,Qg)||Ce(A,Ae)||Ce(A,ng)||Ce(A,Eg)||Ce(A,y)||Ce(A,Sg)||Ce(A,jA)}var Qr=U(()=>{"use strict";kI()});function KQ(A,g,e){if(g.is(Qg))return A.traverseGrouping(g,e);if(g.is(y))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 xQ(A){if(A.is(Qg)||A.is(y)||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,lr=U(()=>{"use strict";hI();wI();Ko();Go();pe();No();mI();oB=class{traverseAlgNode(g,e){return KQ(this,g,e)}traverseIntoAlgNode(g,e){return xQ(this.traverseAlgNode(g,e))}},JB=class extends oB{traverseAlgNode(g){return KQ(this,g,void 0)}traverseIntoAlgNode(g){return xQ(this.traverseAlgNode(g))}}});var IL,UI,sr=U(()=>{"use strict";IL="any-direction",UI=class{constructor(g={}){this.config=g}cancelQuantum(){let{cancel:g}=this.config;return g===!0?IL: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 oL(A,g){return A*Math.sign(g.amount)>=0}function tL(A,g,e){return((A-e)%g+g)%g+e}function ar(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 a=tL(r.amount,l,Q);return r.modified({amount:a})}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 a;for(a=I.length-1;a>=0;a--){let R=I[a].as(y);if(!R||!r(R))break;let L=R.quantum.toString();if(l){let p=Q.get(L);if(p&&!oL(p,R))break;Q.set(L,Math.sign(R.amount))}}let D=[...I.splice(a+1),g];if(n)o=n.simplifySameAxisMoves(D,B.cancelPuzzleSpecificModWrap()!=="none");else{let R=D.reduce((L,p)=>L+p.amount,0);if(Q.size!==1)throw new Error("Internal error: multiple quantums when one was expected");o=[new y(g.quantum,R)]}}return o=o.map(r=>i(r)).filter(r=>r.amount!==0),t()}function fr(A,g,e){let B=g.as(y);return B?ar(A,B,e):new J([...A.childAlgNodes(),g])}var Dr=U(()=>{"use strict";he();pe();sr()});var oi,bo,Lr,HB,Yo,vo,Rr,cr,ur,YQ=U(()=>{"use strict";he();hI();wI();Ko();pe();mI();lr();Dr();sr();cr=class extends oB{constructor(){super(...arguments);cA(this,bo);cA(this,HB);cA(this,vo);cA(this,oi,void 0)}*traverseAlg(e,B){if(B.depth===0){yield*e.childAlgNodes();return}let I=[],o=Me(this,HB,Yo).call(this,B);for(let t of e.childAlgNodes())for(let i of this.traverseAlgNode(t,o))I=Array.from(fr(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,Yo).call(this,B)),e.amount);if(I.alg.experimentalIsEmpty())return;let o=Me(this,bo,Lr).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,Yo).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,vo,Rr).call(this,o.A,o.B,B)||(yield o)}*traverseConjugate(e,B){if(B.depth===0){yield e;return}let I=Me(this,HB,Yo).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,vo,Rr).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,bo,Lr).call(this).set(e.experimentalNISSGrouping,I),yield I}else yield e}*traverseNewline(e,B){yield e}*traverseLineComment(e,B){yield e}};oi=new WeakMap,bo=new WeakSet,Lr=function(){return w(this,oi)??lA(this,oi,new Map)},HB=new WeakSet,Yo=function(e){return{...e,depth:e.depth?e.depth-1:null}},vo=new WeakSet,Rr=function(e,B,I){if(e.experimentalNumChildAlgNodes()===1&&B.experimentalNumChildAlgNodes()===1){let o=Array.from(e.childAlgNodes())[0]?.as(y),t=Array.from(B.childAlgNodes())[0]?.as(y);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};ur=re(cr)});var yr=U(()=>{"use strict";YQ();Dr()});function bQ(A){if(!A)return[];if(Ce(A,J))return A.childAlgNodes();if(typeof A=="string")return tr(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 iL(A,g){return A.is(Sg)||g.is(Sg)||g.as(Qg)?.experimentalNISSPlaceholder?"":A.is(Ae)&&!g.is(Sg)?\`
|
|
6
|
-
\`:" "}var Tg,PB,J,he=U(()=>{"use strict";Ke();Qr();ye();ir();yr();kI();Go();pe();No();Cr();PB=class extends fg{constructor(e){super();cA(this,Tg,void 0);lA(this,Tg,Array.from(bQ(e)));for(let B of w(this,Tg))if(!MQ(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(mQ(Array.from(w(this,Tg)).map(e=>e.invert())))}*experimentalExpand(e=1,B){B??(B=1/0);for(let I of wQ(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(y)&&(yield e)}concat(e){return new PB(Array.from(w(this,Tg)).concat(Array.from(bQ(e))))}experimentalIsEmpty(){for(let e of w(this,Tg))return!1;return!0}static fromString(e){return tr(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 ei("deprecated: type"),"sequence"}toString(){let e="",B=null;for(let I of w(this,Tg)){B&&(e+=iL(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(ur(this,e??{}))}simplify(e){return this.experimentalSimplify(e)}},J=PB;Tg=new WeakMap});var CL,vQ=U(()=>{"use strict";he();kI();hI();wI();pe();mI();CL={Sune:new J([new y("R",1),new y("U",1),new y("R",-1),new y("U",1),new y("R",1),new y("U",-2),new y("R",-1)]),AntiSune:new J([new y("R",1),new y("U",2),new y("R",-1),new y("U",-1),new y("R",1),new y("U",-1),new y("R",-1)]),SuneCommutator:new J([new ng(new J([new y("R",1),new y("U",1),new y("R",-2)]),new J([new Eg(new J([new y("R",1)]),new J([new y("U",1)]))]))]),Niklas:new J([new y("R",1),new y("U",-1),new y("L",-1),new y("U",1),new y("R",-1),new y("U",-1),new y("L",1),new y("U",1)]),EPerm:new J([new y("x",-1),new ng(new J([new Eg(new J([new y("R",1)]),new J([new y("U",-1)]))]),new J([new y("D",1)])),new ng(new J([new Eg(new J([new y("R",1)]),new J([new y("U",1)]))]),new J([new y("D",1)])),new y("x",1)]),FURURFCompact:new J([new Eg(new J([new y("F",1)]),new J([new ng(new J([new y("U",1)]),new J([new y("R",1)]))]))]),APermCompact:new J([new Eg(new J([new y("R",2)]),new J([new ng(new J([new y("F",2)]),new J([new y("R",-1),new y("B",-1),new y("R",1)]))]))]),FURURFMoves:new J([new y("F",1),new y("U",1),new y("R",1),new y("U",-1),new y("R",-1),new y("F",-1)]),TPerm:new J([new y("R",1),new y("U",1),new y("R",-1),new y("U",-1),new y("R",-1),new y("F",1),new y("R",2),new y("U",-1),new y("R",-1),new y("U",-1),new y("R",1),new y("U",1),new y("R",-1),new y("F",-1)]),HeadlightSwaps:new J([new Eg(new J([new y("F",1)]),new J([new Qg(new J([new ng(new J([new y("R",1)]),new J([new y("U",1)]))]),3)]))]),TriplePause:new J([new jA,new jA,new jA])}});var wm,JQ=U(()=>{"use strict";kI();pe();wm={73:new y("R"),75:new y("R'"),87:new y("B"),79:new y("B'"),83:new y("D"),76:new y("D'"),68:new y("L"),69:new y("L'"),74:new y("U"),70:new y("U'"),72:new y("F"),71:new y("F'"),78:new y("x'"),67:new y("l"),82:new y("l'"),85:new y("r"),77:new y("r'"),88:new y("d"),188:new y("d'"),84:new y("x"),89:new y("x"),66:new y("x'"),186:new y("y"),59:new y("y"),65:new y("y'"),80:new y("z"),81:new y("z'"),90:new y("M'"),190:new y("M'"),192:new jA}});var HQ=U(()=>{"use strict"});var SA=U(()=>{"use strict";he();Br();lr();vQ();JQ();kI();HQ();yr();Qr();Ir()});function Ho(A,g,e){let B={};for(let I in A.orbits){let o=A.orbits[I],t=g[I],i=e[I];if(Jo(o.numOrientations,i))B[I]=t;else if(Jo(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 hr(A,g,e){let B={};for(let I in A.orbits){let o=A.orbits[I],t=g[I],i=e[I];if(Jo(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 ti=U(()=>{"use strict";Po()});function rL(A){let g=PQ.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 qQ&&(Object.freeze(e),Object.freeze(B),Object.freeze(I)),PQ.set(A,I),I}function TQ(A){let g={};for(let[e,B]of Object.entries(A.orbits))g[e]=rL(B.numPieces);return qQ&&Object.freeze(g),g}function zQ(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 qQ,PQ,pr=U(()=>{"use strict";Po();qQ=!1,PQ=new Map});var YA,ii=U(()=>{"use strict";ti();qo();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=hr(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=hr(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,qo=U(()=>{"use strict";Po();ti();pr();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,Fr(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,TQ(g.definition));return lA(e,qB,!0),e}isIdentical(g){return OQ(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,Ho(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 _Q(this.kpuzzle.definition,this)}selfMultiply(g){return new iB(this.kpuzzle,tB(this.kpuzzle,this.transformationData,g))}},ge=iB;qB=new WeakMap});function Jo(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 nL(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 OQ(A,g,e){for(let[B,I]of Object.entries(A.definition.orbits))if(!nL(I,g[B],e[B]))return!1;return!0}function Fr(A,g){let e={};for(let B in A.definition.orbits){let I=A.definition.orbits[B],o=g[B];if(Jo(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,Fr(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=Ho(A.definition,B,B);return e%2===0?I:Ho(A.definition,g,I)}function mr(A,g){return g?mr(g,A%g):A}function _Q(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/mr(I.numOrientations,Math.abs(n))),e=e*l/mr(e,l)}}return e}var wr,WQ,Po=U(()=>{"use strict";SA();SA();ti();qo();wr=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()}},WQ=re(wr)});var GI,Ci,zA,jQ=U(()=>{"use strict";SA();Po();pr();ii();qo();zA=class{constructor(g,e){this.definition=g;cA(this,GI,new Map);cA(this,Ci,void 0);this.experimentalPGNotation=e?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return ge.experimentalConstructIdentity(this)}moveToTransformation(g){typeof g=="string"&&(g=new y(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=zQ(this,g);return w(this,GI).set(e,I),new ge(this,I)}algToTransformation(g){return typeof g=="string"&&(g=new J(g)),WQ(g,this)}toTransformation(g){return typeof g=="string"?this.algToTransformation(g):g?.is?.(J)?this.algToTransformation(g):g?.is?.(y)?this.moveToTransformation(g):g}startState(){return new YA(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return w(this,Ci)??lA(this,Ci,(()=>{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,Ci=new WeakMap});var cg=U(()=>{"use strict";jQ();ii();qo()});var VQ,EL,XQ=U(()=>{"use strict";VQ={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"}},EL={...VQ,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 ZQ(A){return QL[A]}var Ye,Fe,wg,NI,To,TB,QL,MI,KI,zo=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",To="invisible",TB="dim",QL={["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:[To,To,To,To,To]},["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(ZQ(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 $Q,Al,ne,xI,dr,Sr=U(()=>{"use strict";$Q="Last Layer",Al="Last Slot",ne={"3x3x3":$Q,megaminx:$Q},xI={"3x3x3":Al,megaminx:Al},dr={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"),a=()=>I.or([I.orbitPrefix("CORNER"),I.orbitPrefix("C4RNER"),I.orbitPrefix("C5RNER")]),D=()=>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"])),a(),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(),a()]),"IgnoreNonPrimary");break}case"OLL":{d(),K();break}case"EOLL":{d(),K(),B.set(I.and([o(),a()]),"Ignored");break}case"COLL":{d(),B.set(I.and([o(),Q()]),"Ignoriented"),B.set(I.and([o(),l()]),"Dim"),B.set(I.and([o(),a()]),"Regular");break}case"OCLL":{d(),Y(),B.set(I.and([o(),a()]),"IgnoreNonPrimary");break}case"CPLL":{d(),B.set(I.and([a(),o()]),"PermuteNonPrimary"),B.set(I.and([I.not(a()),o()]),"Dim");break}case"CLL":{d(),B.set(I.not(I.and([a(),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(),a()]),"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(),a()]),"Regular");break}case"ZBLS":{d(),B.set(k(),"Regular"),K(),B.set(I.and([o(),a()]),"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(),a()]),"IgnoreNonPrimary");break}case"LS":{d(),B.set(k(),"Regular"),B.set(o(),"Ignored"),B.set(R(),"Dim");break}case"EO":{B.set(a(),"Ignored"),B.set(Q(),"OrientationWithoutPermutation");break}case"EOline":{B.set(a(),"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(a(),"Ignored");break}case"CMLL":{B.set(n(),"Dim"),B.set(D(),"Ignored"),B.set(I.and([o(),a()]),"Regular");break}case"L10P":{B.set(I.not(D()),"Dim"),B.set(I.and([a(),o()]),"Regular");break}case"L6E":{B.set(I.not(D()),"Dim");break}case"L6EO":{B.set(I.not(D()),"Dim"),B.set(D(),"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(dr))o.groups&&(A in o.groups?e.push(I):g?.use3x3x3Fallbacks&&"3x3x3"in o.groups&&B.push(I));return e.concat(B)}var Oo=U(()=>{"use strict";zo();Sr()});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,el=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,Bl=U(()=>{"use strict";zB=class{notationToInternal(g){return g}notationToExternal(g){return g}}});var _o,Il=U(()=>{"use strict";SA();_o=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 y(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 y(new T("T",g.innerLayer,g.outerLayer),g.amount):this.child.notationToExternal(g)}}});var bI,ol=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 y(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 Wo,tl=U(()=>{"use strict";SA();Wo=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 y(new T("L",3,2),-2*g.amount);if(g.family==="R--")return new y(new T("L",3,2),2*g.amount);if(g.family==="D++")return new y(new T("U",3,2),-2*g.amount);if(g.family==="D--")return new y(new T("U",3,2),2*g.amount);if(g.family==="R_PLUSPLUS_")return new y(new T("L",3,2),-2*g.amount);if(g.family==="D_PLUSPLUS_")return new y(new T("U",3,2),-2*g.amount)}if(g.family==="y")return new y("Uv",g.amount);if(g.family==="x"&&Math.abs(g.amount)===2)return new y("DRRv",g.amount/2)}return this.child.notationToInternal(g)}notationToExternal(g){return g.family==="DRRv"&&Math.abs(g.amount)===1?new y(new T("x",g.innerLayer,g.outerLayer),g.amount*2):g.family==="DLLv"&&Math.abs(g.amount)===1?new y(new T("x",g.innerLayer,g.outerLayer),-g.amount*2):g.family==="Uv"?new y(new T("y",g.innerLayer,g.outerLayer),g.amount):g.family==="DDv"?new y("y",-g.amount):this.child.notationToExternal(g)}}});var jo,il=U(()=>{"use strict";SA();jo=class{constructor(g){this.slices=g}notationToInternal(g){let e=g.family;return g.innerLayer||g.outerLayer||(e==="x"?g=new y("Rv",g.amount):e==="y"?g=new y("Uv",g.amount):e==="z"&&(g=new y("Fv",g.amount)),(this.slices&1)===1&&(e==="E"?g=new y(new T("D",(this.slices+1)/2),g.amount):e==="M"?g=new y(new T("L",(this.slices+1)/2),g.amount):e==="S"&&(g=new y(new T("F",(this.slices+1)/2),g.amount))),this.slices>2&&(e==="e"?g=new y(new T("D",this.slices-1,2),g.amount):e==="m"?g=new y(new T("L",this.slices-1,2),g.amount):e==="s"&&(g=new y(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 y("x",g.amount);if(e==="Uv")return new y("y",g.amount);if(e==="Fv")return new y("z",g.amount);if(e==="Lv")return new y("x",-g.amount);if(e==="Dv")return new y("y",-g.amount);if(e==="Bv")return new y("z",-g.amount)}return g}}});var lL,sL,Cl,rl,nl,vI,Vo,El=U(()=>{"use strict";SA();lL={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"},sL={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"},Cl={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},rl=new T("y"),nl=new T("Dv"),vI=class{constructor(g){this.child=g;this.wcaHack=!1;this.map=lL}notationToInternal(g){if(this.wcaHack&&g.innerLayer===2&&g.outerLayer===null){let B=Cl[g.family];if(B)return new y(new T(B,g.innerLayer,g.outerLayer),g.amount)}let e=this.map[g.family];return e?new y(new T(e,g.innerLayer,g.outerLayer),g.amount):rl.isIdentical(g.quantum)?new y(nl,-g.amount):null}notationToExternal(g){if(this.wcaHack&&g.innerLayer===2&&g.outerLayer===null){for(let[e,B]of Object.entries(Cl))if(this.child.spinmatch(g.family,B))return new y(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 y(new T(e,g.innerLayer,g.outerLayer),g.amount);return nl.isIdentical(g.quantum)?new y(rl,-g.amount):null}},Vo=class extends vI{constructor(e){super(e);this.wcaHack=!0;this.map=sL}}});var Ql,kr,ll,aL,Ur,sl,fL,Gr,al,DL,Xo,fl=U(()=>{"use strict";SA();Ql={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"},kr=new T("x"),ll=new T("Rv"),aL=new T("Lv"),Ur=new T("y"),sl=new T("Uv"),fL=new T("Dv"),Gr=new T("z"),al=new T("Fv"),DL=new T("Bv"),Xo=class{constructor(g){this.child=g}notationToInternal(g){if(g.innerLayer||g.outerLayer)return null;let e=Ql[g.family];return e?new y(new T(e,g.outerLayer,g.innerLayer),g.amount):kr.isIdentical(g.quantum)?new y(ll,g.amount):Ur.isIdentical(g.quantum)?new y(sl,g.amount):Gr.isIdentical(g.quantum)?new y(al,g.amount):null}notationToExternal(g){for(let[e,B]of Object.entries(Ql))if(this.child.spinmatchv(g.family,B))return new y(new T(e,g.innerLayer,g.outerLayer),g.amount);return ll.isIdentical(g.quantum)?new y(kr,g.amount):aL.isIdentical(g.quantum)?new y(kr,-g.amount):sl.isIdentical(g.quantum)?new y(Ur,g.amount):fL.isIdentical(g.quantum)?new y(Ur,-g.amount):al.isIdentical(g.quantum)?new y(Gr,g.amount):DL.isIdentical(g.quantum)?new y(Gr,-g.amount):null}}});var Nr=U(()=>{"use strict";Bl();Il();ol();tl();il();El();fl()});function Dl(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:Zo(A.slice(g).join(" ")),options:e}}var ri,Mr=U(()=>{"use strict";$o();ri=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(!Kr[A]){let g=Array(A);for(let e=0;e<A;e++)g[e]=0;Kr[A]=g}return Kr[A]}function we(A){if(!xr[A]){let g=Array(A);for(let e=0;e<A;e++)g[e]=e;xr[A]=g}return xr[A]}function cl(A){return new Xg(we(A))}function Ll(A){let g=BigInt(1);for(;A>1;)g*=BigInt(A),A--;return g}function cL(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 Yr(A,g){return A/cL(A,g)*g}var Kr,xr,Xg,ni=U(()=>{"use strict";Kr=[],xr=[];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=Yr(g,I)}return g}}});function Ei(A,g){let e=y.fromString(g),B=A.notationToExternal(e);return B===null||e===B?g:B.toString()}function Rl(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,a=o[Q];i+=a,n++;for(let D=0;D<B.length;D++)if(!(Q>>D&1)&&!(Q&I[D]&(1<<D)-1)){let R=Q&I[D]|1<<D;r[R]===void 0&&(r[R]=0),r[R]+=(B[D]-1)*a}}g(\`\${t}: canonseq \${i} states \${n}\`),o=r}}var JI,LL,OB,Ee,me,Qi,Je,_B,li,ul=U(()=>{"use strict";SA();Nr();ni();JI=class{constructor(g,e){this.size=g;this.mod=e}reassemblySize(){return Ll(this.size)*BigInt(this.mod)**BigInt(this.size)}},LL=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=Ei(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=Ei(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 #\${++LL}\`,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 li(i),n=new Array(this.orbitdefs[o].size);for(let D=0;D<i;D++)n[D]=!1;for(let D=0;D<this.moveops.length;D++)for(let R=0;R<i;R++)(this.moveops[D].orbits[o].perm[R]!==R||this.moveops[D].orbits[o].ori[R]!==0)&&(this.isRotation[D]||(n[R]=!0),r.union(R,this.moveops[D].orbits[o].perm[R]));let l=!0;if(t>1){l=!1;let D=new li(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++)D.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++)D.find(R*t)===D.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,a=!1;for(let D=0;D<this.orbitdefs[o].size;D++)if(n[D]){let R=r.find(D);Q<0?Q=R:Q!==R&&(a=!0)}for(let D=0;D<this.orbitdefs[o].size;D++){if(!n[D]||r.find(D)!==D)continue;let L=[],p=[],k=0;for(let d=0;d<this.orbitdefs[o].size;d++)r.find(d)===D&&(L[k]=d,p[d]=k,k++);if(a?g.push(\`\${this.orbitnames[o]}_p\${D}\`):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=[];Qi=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=Yr(g,e.order());return g}},Je=class extends Qi{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);)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 Qi{constructor(g){super(g)}mul(g){return new _B(this.internalMul(g))}},li=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 si,yl=U(()=>{"use strict";si={"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 ai(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 hl(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,fi=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,a=l/(l-Q),D=g[r].smul(1-a).sum(g[n].smul(a));i.push(D)}}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 pl(){let A=Math.sqrt(.5);return[new iA(A,A,0,0),new iA(A,0,A,0)]}function Fl(){return[new iA(.5,.5,.5,.5),new iA(.5,.5,.5,-.5)]}function wl(){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 ml(){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 dl(){let A=Math.sqrt(.5);return[new iA(.5,.5,.5,.5),new iA(A,0,0,A)]}function Sl(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])<Di||o.dist(g[i])<Di){t=!0;break}t||g.push(I)}return g}function br(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])<Di){t=!0;break}t||(e.push(o),B.push(g[I]))}return B}function vr(A){let g=[];for(let e=1;e<A.length;e++)for(let B=e+1;B<A.length;B++){let I=hl(0,e,B,A);if(I){let o=!1;for(let t=0;t<g.length;t++)if(I.dist(g[t])<Di){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 Di,kl=U(()=>{"use strict";fi();Di=1e-9});function ci(A,g){let e=A[0].p.length,B=cl(e),I=[],o=[],t=[],i=[],r=[];function n(D){for(let R=D.p.length-1;R>=0;R--){let L=D.p[R];if(L!==R){if(!I[R][L])return!1;D=D.mul(o[R][L])}}return!0}function l(D,R,L){i[D].push(R),r[D].push(L);for(let p=0;p<I[D].length;p++)I[D][p]&&Q(D,I[D][p].mul(R),L+t[D][p])}function Q(D,R,L){let p=R.p[D];if(!I[D][p]){I[D][p]=R,o[D][p]=R.inv(),t[D][p]=L;for(let d=0;d<i[D].length;d++)Q(D,R.mul(i[D][d]),L+r[D][d]);return}let k=R.mul(o[D][p]);n(k)||l(D-1,k,L+t[D][p])}function a(){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 D=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 Jr;for(let K=0;K<e;K++){let Y=0,O=0;for(let _=0;_<e;_++)I[K][_]&&(Y++,O+=t[K][_],K!==_&&D++);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 \${D} mults \${N.toString()}\`)}return R}return a()}var Jr,Hr=U(()=>{"use strict";ni();Jr=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 RL(A,g){let e=[];for(let B of A)for(let I of g)e.push(I.rotate(B));return e}function hL(){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 pL(){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 wL(){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 Li(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 Ul(){return si}function Gl(A){return si[A]}function Zo(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 qr(A,g={}){let e=Zo(A);if(e===null)throw new Error("Could not parse the puzzle description");let B=new At(e,Object.assign({},{allMoves:!0},g));return B.allstickers(),B.genperms(),B}function Kl(A,g){return qr(si[A],g)}function mL(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 dL(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 Ri(A,g){return[A.b/g,-A.c/g,A.d/g]}function Pr(A,g){let e=[],B=A.length;for(let I=0;I<B;I++){let o=Ri(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,uL,yL,FL,Nl,Ml,At,ui,$o=U(()=>{"use strict";SA();el();Nr();Mr();ni();ul();yl();kl();fi();Hr();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,uL="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",yL=!1;FL={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"]}};Nl=["c","t","o","d","i"],Ml=["f","v","e"];At=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 ri(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=pl();break}case"o":{I=dl();break}case"i":{I=ml();break}case"t":{I=Fl();break}case"d":{I=wl();break}default:throw new Error(\`Bad shape argument: \${e}\`)}this.rotations=Sl(I),this.options.verbosity&&console.log(\`# Rotations: \${this.rotations.length}\`);let o=I[0];this.baseplanerot=br(o,this.rotations);let t=this.baseplanerot.map(G=>o.rotateplane(G));this.baseplanes=t,this.baseFaceCount=t.length;let i=hL()[t.length];this.net=i,this.colors=pL()[t.length],this.options.verbosity>0&&console.log(\`# Base planes: \${t.length}\`);let r=vr(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(),a=r[0].makenormal(),D=new iA(1,l.b,l.c,l.d);this.options.verbosity>0&&console.log(\`# Boundary is \${D}\`);let L=br(D,this.rotations).map(G=>D.rotateplane(G)),p=vr(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=a,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(a.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[Li(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=D.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,PC=P[sA].sum(P[Ig]).smul(.5),qC=Li(rA,dA),TC=Li(rA,PC);q(_,P[sA],[AA,TC,qC])}}this.swizzler=new YI(O.map(G=>G[1]));let X=this.swizzler.prefixFree?"":"_",CA=FL[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=[],hg=ai(p);for(let G of this.rotations){let P=G.rotateface(p);hg.dist(ai(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([hg.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 a=l.b,D=l.c,R=i.smul(a).sub(n.smul(D)).smul(Q),L=n.smul(a).sum(i.smul(D)).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=RL(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 jo(1+e[M].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&e[0].length===1&&(this.notationMapper=new Xo(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 Vo(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&r==="f"&&(1+e[M].length===3&&(this.notationMapper=new Wo(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&r==="f"&&(1+e[M].length===3&&(this.notationMapper=new _o(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=[],a=[],D=[];for(let M of n.values())if(M.length!==this.baseFaceCount){if(M.length>1){let q=M.map(CA=>l[CA].centermass()),z=ai(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];a[z]=Q.length,D[z]=q}Q.push(M)}this.cubies=Q,this.facetocubie=a,this.facetoord=D;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 y(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 a=this.movesetgeos[Q];i===a[0]&&(r=!0,o=a,t=Q),i===a[2]&&(r=!1,o=a,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(!yL&&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 a=(Q+1)%this.faces[I].length;if(Math.abs(n.dot(this.faces[I].get(a).sub(t))-l)<eg&&(Q=a),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 D=this.basefaces[o].length;for(let R=1;R<D;R++)this.cubies[B].push(this.cubies[B][R-1]);this.duplicatedFaces[I]=D,this.duplicatedCubies[B]=D,this.orbitoris[this.cubiesetnums[B]]=D}}}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 a=this.facecentermass[l].dot(I[0]);for(let D=i;D>0;D>>=1)Q+D<=I.length&&a>I[Q+D-1].a&&(Q+=D);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]],a=this.facecentermass[l],D=a,R=l,L=o[R];for(;;){o[R]=-1;let p=a.rotatepoint(this.moverotations[B][0]);if(p.dist(D)<eg)break;R=this.findface(p),Q.push(this.facetocubie[R],this.facetoord[R]),a=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+uL+\`
|
|
6
|
+
\`:" "}var Tg,PB,J,he=U(()=>{"use strict";Ke();Qr();ye();ir();yr();kI();Go();pe();No();Cr();PB=class extends fg{constructor(e){super();cA(this,Tg,void 0);lA(this,Tg,Array.from(bQ(e)));for(let B of w(this,Tg))if(!MQ(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(mQ(Array.from(w(this,Tg)).map(e=>e.invert())))}*experimentalExpand(e=1,B){B??(B=1/0);for(let I of wQ(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(y)&&(yield e)}concat(e){return new PB(Array.from(w(this,Tg)).concat(Array.from(bQ(e))))}experimentalIsEmpty(){for(let e of w(this,Tg))return!1;return!0}static fromString(e){return tr(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 ei("deprecated: type"),"sequence"}toString(){let e="",B=null;for(let I of w(this,Tg)){B&&(e+=iL(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(ur(this,e??{}))}simplify(e){return this.experimentalSimplify(e)}},J=PB;Tg=new WeakMap});var CL,vQ=U(()=>{"use strict";he();kI();hI();wI();pe();mI();CL={Sune:new J([new y("R",1),new y("U",1),new y("R",-1),new y("U",1),new y("R",1),new y("U",-2),new y("R",-1)]),AntiSune:new J([new y("R",1),new y("U",2),new y("R",-1),new y("U",-1),new y("R",1),new y("U",-1),new y("R",-1)]),SuneCommutator:new J([new ng(new J([new y("R",1),new y("U",1),new y("R",-2)]),new J([new Eg(new J([new y("R",1)]),new J([new y("U",1)]))]))]),Niklas:new J([new y("R",1),new y("U",-1),new y("L",-1),new y("U",1),new y("R",-1),new y("U",-1),new y("L",1),new y("U",1)]),EPerm:new J([new y("x",-1),new ng(new J([new Eg(new J([new y("R",1)]),new J([new y("U",-1)]))]),new J([new y("D",1)])),new ng(new J([new Eg(new J([new y("R",1)]),new J([new y("U",1)]))]),new J([new y("D",1)])),new y("x",1)]),FURURFCompact:new J([new Eg(new J([new y("F",1)]),new J([new ng(new J([new y("U",1)]),new J([new y("R",1)]))]))]),APermCompact:new J([new Eg(new J([new y("R",2)]),new J([new ng(new J([new y("F",2)]),new J([new y("R",-1),new y("B",-1),new y("R",1)]))]))]),FURURFMoves:new J([new y("F",1),new y("U",1),new y("R",1),new y("U",-1),new y("R",-1),new y("F",-1)]),TPerm:new J([new y("R",1),new y("U",1),new y("R",-1),new y("U",-1),new y("R",-1),new y("F",1),new y("R",2),new y("U",-1),new y("R",-1),new y("U",-1),new y("R",1),new y("U",1),new y("R",-1),new y("F",-1)]),HeadlightSwaps:new J([new Eg(new J([new y("F",1)]),new J([new Qg(new J([new ng(new J([new y("R",1)]),new J([new y("U",1)]))]),3)]))]),TriplePause:new J([new jA,new jA,new jA])}});var wm,JQ=U(()=>{"use strict";kI();pe();wm={73:new y("R"),75:new y("R'"),87:new y("B"),79:new y("B'"),83:new y("D"),76:new y("D'"),68:new y("L"),69:new y("L'"),74:new y("U"),70:new y("U'"),72:new y("F"),71:new y("F'"),78:new y("x'"),67:new y("l"),82:new y("l'"),85:new y("r"),77:new y("r'"),88:new y("d"),188:new y("d'"),84:new y("x"),89:new y("x"),66:new y("x'"),186:new y("y"),59:new y("y"),65:new y("y'"),80:new y("z"),81:new y("z'"),90:new y("M'"),190:new y("M'"),192:new jA}});var HQ=U(()=>{"use strict"});var SA=U(()=>{"use strict";he();Br();lr();vQ();JQ();kI();HQ();yr();Qr();Ir()});function Ho(A,g,e){let B={};for(let I in A.orbits){let o=A.orbits[I],t=g[I],i=e[I];if(Jo(o.numOrientations,i))B[I]=t;else if(Jo(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 hr(A,g,e){let B={};for(let I in A.orbits){let o=A.orbits[I],t=g[I],i=e[I];if(Jo(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 ti=U(()=>{"use strict";Po()});function rL(A){let g=PQ.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 qQ&&(Object.freeze(e),Object.freeze(B),Object.freeze(I)),PQ.set(A,I),I}function TQ(A){let g={};for(let[e,B]of Object.entries(A.orbits))g[e]=rL(B.numPieces);return qQ&&Object.freeze(g),g}function zQ(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 qQ,PQ,pr=U(()=>{"use strict";Po();qQ=!1,PQ=new Map});var YA,ii=U(()=>{"use strict";ti();qo();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=hr(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=hr(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,qo=U(()=>{"use strict";Po();ti();pr();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,Fr(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,TQ(g.definition));return lA(e,qB,!0),e}isIdentical(g){return OQ(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,Ho(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 _Q(this.kpuzzle.definition,this)}selfMultiply(g){return new iB(this.kpuzzle,tB(this.kpuzzle,this.transformationData,g))}},ge=iB;qB=new WeakMap});function Jo(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 nL(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 OQ(A,g,e){for(let[B,I]of Object.entries(A.definition.orbits))if(!nL(I,g[B],e[B]))return!1;return!0}function Fr(A,g){let e={};for(let B in A.definition.orbits){let I=A.definition.orbits[B],o=g[B];if(Jo(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,Fr(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=Ho(A.definition,B,B);return e%2===0?I:Ho(A.definition,g,I)}function mr(A,g){return g?mr(g,A%g):A}function _Q(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/mr(I.numOrientations,Math.abs(n))),e=e*l/mr(e,l)}}return e}var wr,WQ,Po=U(()=>{"use strict";SA();SA();ti();qo();wr=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()}},WQ=re(wr)});var GI,Ci,zA,jQ=U(()=>{"use strict";SA();Po();pr();ii();qo();zA=class{constructor(g,e){this.definition=g;cA(this,GI,new Map);cA(this,Ci,void 0);this.experimentalPGNotation=e?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return ge.experimentalConstructIdentity(this)}moveToTransformation(g){typeof g=="string"&&(g=new y(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=zQ(this,g);return w(this,GI).set(e,I),new ge(this,I)}algToTransformation(g){return typeof g=="string"&&(g=new J(g)),WQ(g,this)}toTransformation(g){return typeof g=="string"?this.algToTransformation(g):g?.is?.(J)?this.algToTransformation(g):g?.is?.(y)?this.moveToTransformation(g):g}startState(){return new YA(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return w(this,Ci)??lA(this,Ci,(()=>{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,Ci=new WeakMap});var cg=U(()=>{"use strict";jQ();ii();qo()});var VQ,EL,XQ=U(()=>{"use strict";VQ={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"}},EL={...VQ,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 ZQ(A){return QL[A]}var Ye,Fe,wg,NI,To,TB,QL,MI,KI,zo=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",To="invisible",TB="dim",QL={["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:[To,To,To,To,To]},["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(ZQ(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 $Q,Al,ne,xI,dr,Sr=U(()=>{"use strict";$Q="Last Layer",Al="Last Slot",ne={"3x3x3":$Q,megaminx:$Q},xI={"3x3x3":Al,megaminx:Al},dr={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"),a=()=>I.or([I.orbitPrefix("CORNER"),I.orbitPrefix("C4RNER"),I.orbitPrefix("C5RNER")]),D=()=>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"])),a(),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(),a()]),"IgnoreNonPrimary");break}case"OLL":{d(),K();break}case"EOLL":{d(),K(),B.set(I.and([o(),a()]),"Ignored");break}case"COLL":{d(),B.set(I.and([o(),Q()]),"Ignoriented"),B.set(I.and([o(),l()]),"Dim"),B.set(I.and([o(),a()]),"Regular");break}case"OCLL":{d(),Y(),B.set(I.and([o(),a()]),"IgnoreNonPrimary");break}case"CPLL":{d(),B.set(I.and([a(),o()]),"PermuteNonPrimary"),B.set(I.and([I.not(a()),o()]),"Dim");break}case"CLL":{d(),B.set(I.not(I.and([a(),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(),a()]),"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(),a()]),"Regular");break}case"ZBLS":{d(),B.set(k(),"Regular"),K(),B.set(I.and([o(),a()]),"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(),a()]),"IgnoreNonPrimary");break}case"LS":{d(),B.set(k(),"Regular"),B.set(o(),"Ignored"),B.set(R(),"Dim");break}case"EO":{B.set(a(),"Ignored"),B.set(Q(),"OrientationWithoutPermutation");break}case"EOline":{B.set(a(),"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(a(),"Ignored");break}case"CMLL":{B.set(n(),"Dim"),B.set(D(),"Ignored"),B.set(I.and([o(),a()]),"Regular");break}case"L10P":{B.set(I.not(D()),"Dim"),B.set(I.and([a(),o()]),"Regular");break}case"L6E":{B.set(I.not(D()),"Dim");break}case"L6EO":{B.set(I.not(D()),"Dim"),B.set(D(),"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(dr))o.groups&&(A in o.groups?e.push(I):g?.use3x3x3Fallbacks&&"3x3x3"in o.groups&&B.push(I));return e.concat(B)}var Oo=U(()=>{"use strict";zo();Sr()});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,el=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,Bl=U(()=>{"use strict";zB=class{notationToInternal(g){return g}notationToExternal(g){return g}}});var _o,Il=U(()=>{"use strict";SA();_o=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 y(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 y(new T("T",g.innerLayer,g.outerLayer),g.amount):this.child.notationToExternal(g)}}});var bI,ol=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 y(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 Wo,tl=U(()=>{"use strict";SA();Wo=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 y(new T("L",3,2),-2*g.amount);if(g.family==="R--")return new y(new T("L",3,2),2*g.amount);if(g.family==="D++")return new y(new T("U",3,2),-2*g.amount);if(g.family==="D--")return new y(new T("U",3,2),2*g.amount);if(g.family==="R_PLUSPLUS_")return new y(new T("L",3,2),-2*g.amount);if(g.family==="D_PLUSPLUS_")return new y(new T("U",3,2),-2*g.amount)}if(g.family==="y")return new y("Uv",g.amount);if(g.family==="x"&&Math.abs(g.amount)===2)return new y("ERv",g.amount/2)}return this.child.notationToInternal(g)}notationToExternal(g){return g.family==="ERv"&&Math.abs(g.amount)===1?new y(new T("x",g.innerLayer,g.outerLayer),g.amount*2):g.family==="ILv"&&Math.abs(g.amount)===1?new y(new T("x",g.innerLayer,g.outerLayer),-g.amount*2):g.family==="Uv"?new y(new T("y",g.innerLayer,g.outerLayer),g.amount):g.family==="Dv"?new y("y",-g.amount):this.child.notationToExternal(g)}}});var jo,il=U(()=>{"use strict";SA();jo=class{constructor(g){this.slices=g}notationToInternal(g){let e=g.family;return g.innerLayer||g.outerLayer||(e==="x"?g=new y("Rv",g.amount):e==="y"?g=new y("Uv",g.amount):e==="z"&&(g=new y("Fv",g.amount)),(this.slices&1)===1&&(e==="E"?g=new y(new T("D",(this.slices+1)/2),g.amount):e==="M"?g=new y(new T("L",(this.slices+1)/2),g.amount):e==="S"&&(g=new y(new T("F",(this.slices+1)/2),g.amount))),this.slices>2&&(e==="e"?g=new y(new T("D",this.slices-1,2),g.amount):e==="m"?g=new y(new T("L",this.slices-1,2),g.amount):e==="s"&&(g=new y(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 y("x",g.amount);if(e==="Uv")return new y("y",g.amount);if(e==="Fv")return new y("z",g.amount);if(e==="Lv")return new y("x",-g.amount);if(e==="Dv")return new y("y",-g.amount);if(e==="Bv")return new y("z",-g.amount)}return g}}});var lL,sL,Cl,rl,nl,vI,Vo,El=U(()=>{"use strict";SA();lL={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"},sL={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"},Cl={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},rl=new T("y"),nl=new T("Dv"),vI=class{constructor(g){this.child=g;this.wcaHack=!1;this.map=lL}notationToInternal(g){if(this.wcaHack&&g.innerLayer===2&&g.outerLayer===null){let B=Cl[g.family];if(B)return new y(new T(B,g.innerLayer,g.outerLayer),g.amount)}let e=this.map[g.family];return e?new y(new T(e,g.innerLayer,g.outerLayer),g.amount):rl.isIdentical(g.quantum)?new y(nl,-g.amount):null}notationToExternal(g){if(this.wcaHack&&g.innerLayer===2&&g.outerLayer===null){for(let[e,B]of Object.entries(Cl))if(this.child.spinmatch(g.family,B))return new y(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 y(new T(e,g.innerLayer,g.outerLayer),g.amount);return nl.isIdentical(g.quantum)?new y(rl,-g.amount):null}},Vo=class extends vI{constructor(e){super(e);this.wcaHack=!0;this.map=sL}}});var Ql,kr,ll,aL,Ur,sl,fL,Gr,al,DL,Xo,fl=U(()=>{"use strict";SA();Ql={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"},kr=new T("x"),ll=new T("Rv"),aL=new T("Lv"),Ur=new T("y"),sl=new T("Uv"),fL=new T("Dv"),Gr=new T("z"),al=new T("Fv"),DL=new T("Bv"),Xo=class{constructor(g){this.child=g}notationToInternal(g){if(g.innerLayer||g.outerLayer)return null;let e=Ql[g.family];return e?new y(new T(e,g.outerLayer,g.innerLayer),g.amount):kr.isIdentical(g.quantum)?new y(ll,g.amount):Ur.isIdentical(g.quantum)?new y(sl,g.amount):Gr.isIdentical(g.quantum)?new y(al,g.amount):null}notationToExternal(g){for(let[e,B]of Object.entries(Ql))if(this.child.spinmatchv(g.family,B))return new y(new T(e,g.innerLayer,g.outerLayer),g.amount);return ll.isIdentical(g.quantum)?new y(kr,g.amount):aL.isIdentical(g.quantum)?new y(kr,-g.amount):sl.isIdentical(g.quantum)?new y(Ur,g.amount):fL.isIdentical(g.quantum)?new y(Ur,-g.amount):al.isIdentical(g.quantum)?new y(Gr,g.amount):DL.isIdentical(g.quantum)?new y(Gr,-g.amount):null}}});var Nr=U(()=>{"use strict";Bl();Il();ol();tl();il();El();fl()});function Dl(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:Zo(A.slice(g).join(" ")),options:e}}var ri,Mr=U(()=>{"use strict";$o();ri=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(!Kr[A]){let g=Array(A);for(let e=0;e<A;e++)g[e]=0;Kr[A]=g}return Kr[A]}function we(A){if(!xr[A]){let g=Array(A);for(let e=0;e<A;e++)g[e]=e;xr[A]=g}return xr[A]}function cl(A){return new Xg(we(A))}function Ll(A){let g=BigInt(1);for(;A>1;)g*=BigInt(A),A--;return g}function cL(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 Yr(A,g){return A/cL(A,g)*g}var Kr,xr,Xg,ni=U(()=>{"use strict";Kr=[],xr=[];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=Yr(g,I)}return g}}});function Ei(A,g){let e=y.fromString(g),B=A.notationToExternal(e);return B===null||e===B?g:B.toString()}function Rl(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,a=o[Q];i+=a,n++;for(let D=0;D<B.length;D++)if(!(Q>>D&1)&&!(Q&I[D]&(1<<D)-1)){let R=Q&I[D]|1<<D;r[R]===void 0&&(r[R]=0),r[R]+=(B[D]-1)*a}}g(\`\${t}: canonseq \${i} states \${n}\`),o=r}}var JI,LL,OB,Ee,me,Qi,Je,_B,li,ul=U(()=>{"use strict";SA();Nr();ni();JI=class{constructor(g,e){this.size=g;this.mod=e}reassemblySize(){return Ll(this.size)*BigInt(this.mod)**BigInt(this.size)}},LL=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=Ei(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=Ei(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 #\${++LL}\`,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 li(i),n=new Array(this.orbitdefs[o].size);for(let D=0;D<i;D++)n[D]=!1;for(let D=0;D<this.moveops.length;D++)for(let R=0;R<i;R++)(this.moveops[D].orbits[o].perm[R]!==R||this.moveops[D].orbits[o].ori[R]!==0)&&(this.isRotation[D]||(n[R]=!0),r.union(R,this.moveops[D].orbits[o].perm[R]));let l=!0;if(t>1){l=!1;let D=new li(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++)D.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++)D.find(R*t)===D.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,a=!1;for(let D=0;D<this.orbitdefs[o].size;D++)if(n[D]){let R=r.find(D);Q<0?Q=R:Q!==R&&(a=!0)}for(let D=0;D<this.orbitdefs[o].size;D++){if(!n[D]||r.find(D)!==D)continue;let L=[],p=[],k=0;for(let d=0;d<this.orbitdefs[o].size;d++)r.find(d)===D&&(L[k]=d,p[d]=k,k++);if(a?g.push(\`\${this.orbitnames[o]}_p\${D}\`):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=[];Qi=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=Yr(g,e.order());return g}},Je=class extends Qi{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);)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 Qi{constructor(g){super(g)}mul(g){return new _B(this.internalMul(g))}},li=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 si,yl=U(()=>{"use strict";si={"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 ai(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 hl(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,fi=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,a=l/(l-Q),D=g[r].smul(1-a).sum(g[n].smul(a));i.push(D)}}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 pl(){let A=Math.sqrt(.5);return[new iA(A,A,0,0),new iA(A,0,A,0)]}function Fl(){return[new iA(.5,.5,.5,.5),new iA(.5,.5,.5,-.5)]}function wl(){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 ml(){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 dl(){let A=Math.sqrt(.5);return[new iA(.5,.5,.5,.5),new iA(A,0,0,A)]}function Sl(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])<Di||o.dist(g[i])<Di){t=!0;break}t||g.push(I)}return g}function br(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])<Di){t=!0;break}t||(e.push(o),B.push(g[I]))}return B}function vr(A){let g=[];for(let e=1;e<A.length;e++)for(let B=e+1;B<A.length;B++){let I=hl(0,e,B,A);if(I){let o=!1;for(let t=0;t<g.length;t++)if(I.dist(g[t])<Di){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 Di,kl=U(()=>{"use strict";fi();Di=1e-9});function ci(A,g){let e=A[0].p.length,B=cl(e),I=[],o=[],t=[],i=[],r=[];function n(D){for(let R=D.p.length-1;R>=0;R--){let L=D.p[R];if(L!==R){if(!I[R][L])return!1;D=D.mul(o[R][L])}}return!0}function l(D,R,L){i[D].push(R),r[D].push(L);for(let p=0;p<I[D].length;p++)I[D][p]&&Q(D,I[D][p].mul(R),L+t[D][p])}function Q(D,R,L){let p=R.p[D];if(!I[D][p]){I[D][p]=R,o[D][p]=R.inv(),t[D][p]=L;for(let d=0;d<i[D].length;d++)Q(D,R.mul(i[D][d]),L+r[D][d]);return}let k=R.mul(o[D][p]);n(k)||l(D-1,k,L+t[D][p])}function a(){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 D=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 Jr;for(let K=0;K<e;K++){let Y=0,O=0;for(let _=0;_<e;_++)I[K][_]&&(Y++,O+=t[K][_],K!==_&&D++);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 \${D} mults \${N.toString()}\`)}return R}return a()}var Jr,Hr=U(()=>{"use strict";ni();Jr=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 RL(A,g){let e=[];for(let B of A)for(let I of g)e.push(I.rotate(B));return e}function hL(){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 pL(){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",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 wL(){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 Li(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 Ul(){return si}function Gl(A){return si[A]}function Zo(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 qr(A,g={}){let e=Zo(A);if(e===null)throw new Error("Could not parse the puzzle description");let B=new At(e,Object.assign({},{allMoves:!0},g));return B.allstickers(),B.genperms(),B}function Kl(A,g){return qr(si[A],g)}function mL(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 dL(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 Ri(A,g){return[A.b/g,-A.c/g,A.d/g]}function Pr(A,g){let e=[],B=A.length;for(let I=0;I<B;I++){let o=Ri(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,uL,yL,FL,Nl,Ml,At,ui,$o=U(()=>{"use strict";SA();el();Nr();Mr();ni();ul();yl();kl();fi();Hr();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,uL="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",yL=!1;FL={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"]}};Nl=["c","t","o","d","i"],Ml=["f","v","e"];At=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 ri(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=pl();break}case"o":{I=dl();break}case"i":{I=ml();break}case"t":{I=Fl();break}case"d":{I=wl();break}default:throw new Error(\`Bad shape argument: \${e}\`)}this.rotations=Sl(I),this.options.verbosity&&console.log(\`# Rotations: \${this.rotations.length}\`);let o=I[0];this.baseplanerot=br(o,this.rotations);let t=this.baseplanerot.map(G=>o.rotateplane(G));this.baseplanes=t,this.baseFaceCount=t.length;let i=hL()[t.length];this.net=i,this.colors=pL()[t.length],this.options.verbosity>0&&console.log(\`# Base planes: \${t.length}\`);let r=vr(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(),a=r[0].makenormal(),D=new iA(1,l.b,l.c,l.d);this.options.verbosity>0&&console.log(\`# Boundary is \${D}\`);let L=br(D,this.rotations).map(G=>D.rotateplane(G)),p=vr(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=a,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(a.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[Li(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=D.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,PC=P[sA].sum(P[Ig]).smul(.5),qC=Li(rA,dA),TC=Li(rA,PC);q(_,P[sA],[AA,TC,qC])}}this.swizzler=new YI(O.map(G=>G[1]));let X=this.swizzler.prefixFree?"":"_",CA=FL[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=[],hg=ai(p);for(let G of this.rotations){let P=G.rotateface(p);hg.dist(ai(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([hg.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 a=l.b,D=l.c,R=i.smul(a).sub(n.smul(D)).smul(Q),L=n.smul(a).sum(i.smul(D)).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=RL(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 jo(1+e[M].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&e[0].length===1&&(this.notationMapper=new Xo(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 Vo(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&r==="f"&&(1+e[M].length===3&&(this.notationMapper=new Wo(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&r==="f"&&(1+e[M].length===3&&(this.notationMapper=new _o(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=[],a=[],D=[];for(let M of n.values())if(M.length!==this.baseFaceCount){if(M.length>1){let q=M.map(CA=>l[CA].centermass()),z=ai(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];a[z]=Q.length,D[z]=q}Q.push(M)}this.cubies=Q,this.facetocubie=a,this.facetoord=D;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 y(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 a=this.movesetgeos[Q];i===a[0]&&(r=!0,o=a,t=Q),i===a[2]&&(r=!1,o=a,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(!yL&&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 a=(Q+1)%this.faces[I].length;if(Math.abs(n.dot(this.faces[I].get(a).sub(t))-l)<eg&&(Q=a),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 D=this.basefaces[o].length;for(let R=1;R<D;R++)this.cubies[B].push(this.cubies[B][R-1]);this.duplicatedFaces[I]=D,this.duplicatedCubies[B]=D,this.orbitoris[this.cubiesetnums[B]]=D}}}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 a=this.facecentermass[l].dot(I[0]);for(let D=i;D>0;D>>=1)Q+D<=I.length&&a>I[Q+D-1].a&&(Q+=D);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]],a=this.facecentermass[l],D=a,R=l,L=o[R];for(;;){o[R]=-1;let p=a.rotatepoint(this.moverotations[B][0]);if(p.dist(D)<eg)break;R=this.findface(p),Q.push(this.facetocubie[R],this.facetoord[R]),a=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+uL+\`
|
|
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_\${Ei(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(\`
|
|
@@ -4334,4 +4334,4 @@ comlink/dist/esm/comlink.mjs:
|
|
|
4334
4334
|
export {
|
|
4335
4335
|
workerSource
|
|
4336
4336
|
};
|
|
4337
|
-
//# sourceMappingURL=search-worker-inside-generated-string-
|
|
4337
|
+
//# sourceMappingURL=search-worker-inside-generated-string-EFAMJBWG.js.map
|