cubing 0.29.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/esm/bluetooth/index.js +3 -3
  2. package/dist/esm/{chunk-TGPS3CXW.js → chunk-2JDBIQSV.js} +3 -3
  3. package/dist/esm/{chunk-TGPS3CXW.js.map → chunk-2JDBIQSV.js.map} +0 -0
  4. package/dist/esm/{chunk-LSCTPPWV.js → chunk-AHEXXC6V.js} +2 -2
  5. package/dist/esm/{chunk-LSCTPPWV.js.map → chunk-AHEXXC6V.js.map} +0 -0
  6. package/dist/esm/{chunk-PYWGREIP.js → chunk-U2ONHTIX.js} +1 -1
  7. package/dist/esm/{chunk-PYWGREIP.js.map → chunk-U2ONHTIX.js.map} +0 -0
  8. package/dist/esm/{chunk-Q4W5ZR4U.js → chunk-WYKXX2XY.js} +2 -2
  9. package/dist/esm/{chunk-Q4W5ZR4U.js.map → chunk-WYKXX2XY.js.map} +0 -0
  10. package/dist/esm/{chunk-DZGFGBKT.js → chunk-XRZBPKES.js} +2 -2
  11. package/dist/esm/{chunk-DZGFGBKT.js.map → chunk-XRZBPKES.js.map} +0 -0
  12. package/dist/esm/{chunk-LV7IKG36.js → chunk-XT3R2ENM.js} +2 -2
  13. package/dist/esm/{chunk-LV7IKG36.js.map → chunk-XT3R2ENM.js.map} +0 -0
  14. package/dist/esm/protocol/index.js +2 -2
  15. package/dist/esm/puzzle-geometry/index.js +4 -4
  16. package/dist/esm/puzzle-geometry/index.js.map +2 -2
  17. package/dist/esm/puzzles/index.js +2 -2
  18. package/dist/esm/scramble/index.js +1 -1
  19. package/dist/esm/search/index.js +4 -4
  20. package/dist/esm/{search-dynamic-sgs-side-events-AYX7MZO7.js → search-dynamic-sgs-side-events-4H3X5HLH.js} +3 -3
  21. package/dist/esm/{search-dynamic-sgs-side-events-AYX7MZO7.js.map → search-dynamic-sgs-side-events-4H3X5HLH.js.map} +0 -0
  22. package/dist/esm/{search-dynamic-sgs-unofficial-DLJOJFJL.js → search-dynamic-sgs-unofficial-7IRW4LVD.js} +3 -3
  23. package/dist/esm/{search-dynamic-sgs-unofficial-DLJOJFJL.js.map → search-dynamic-sgs-unofficial-7IRW4LVD.js.map} +0 -0
  24. package/dist/esm/{search-dynamic-solve-4x4x4-CWWTFKMR.js → search-dynamic-solve-4x4x4-7JTJCCSY.js} +4 -4
  25. package/dist/esm/{search-dynamic-solve-4x4x4-CWWTFKMR.js.map → search-dynamic-solve-4x4x4-7JTJCCSY.js.map} +0 -0
  26. package/dist/esm/{search-worker-inside-generated-string-AMEXYCKK.js → search-worker-inside-generated-string-ZEY77HTF.js} +2 -2
  27. package/dist/esm/search-worker-inside-generated-string-ZEY77HTF.js.map +7 -0
  28. package/dist/esm/{search-worker-js-entry-TP2T3NUL.js → search-worker-js-entry-T6YIT7YD.js} +8 -8
  29. package/dist/esm/{search-worker-js-entry-TP2T3NUL.js.map → search-worker-js-entry-T6YIT7YD.js.map} +0 -0
  30. package/dist/esm/{search-worker-ts-entry-NEH77S4I.js → search-worker-ts-entry-OUEC4L5I.js} +2 -2
  31. package/dist/esm/{search-worker-ts-entry-NEH77S4I.js.map → search-worker-ts-entry-OUEC4L5I.js.map} +0 -0
  32. package/dist/esm/twisty/index.js +3 -3
  33. package/dist/esm/{twisty-dynamic-3d-D3ZDBJUH.js → twisty-dynamic-3d-AZUSXQ5S.js} +4 -4
  34. package/dist/esm/{twisty-dynamic-3d-D3ZDBJUH.js.map → twisty-dynamic-3d-AZUSXQ5S.js.map} +0 -0
  35. package/package.json +1 -1
  36. package/dist/esm/search-worker-inside-generated-string-AMEXYCKK.js.map +0 -7
@@ -4,8 +4,8 @@ import {
4
4
  eventInfo,
5
5
  puzzles,
6
6
  wcaEventInfo
7
- } from "../chunk-DZGFGBKT.js";
8
- import "../chunk-PYWGREIP.js";
7
+ } from "../chunk-XRZBPKES.js";
8
+ import "../chunk-U2ONHTIX.js";
9
9
  import "../chunk-XU5ILFX5.js";
10
10
  import "../chunk-NI7U4XAZ.js";
11
11
  import "../chunk-SBZRVSPK.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  randomScrambleForEvent
3
- } from "../chunk-TGPS3CXW.js";
3
+ } from "../chunk-2JDBIQSV.js";
4
4
  import "../chunk-RHC3DIN3.js";
5
5
  import "../chunk-ZB3P5AZN.js";
6
6
  import "../chunk-WXCNEGW3.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  random333State
3
- } from "../chunk-Q4W5ZR4U.js";
3
+ } from "../chunk-WYKXX2XY.js";
4
4
  import "../chunk-OX6O2ZO5.js";
5
- import "../chunk-DZGFGBKT.js";
6
- import "../chunk-PYWGREIP.js";
5
+ import "../chunk-XRZBPKES.js";
6
+ import "../chunk-U2ONHTIX.js";
7
7
  import "../chunk-XU5ILFX5.js";
8
8
  import {
9
9
  experimentalSolve2x2x2,
@@ -12,7 +12,7 @@ import {
12
12
  solveMegaminx,
13
13
  solvePyraminx,
14
14
  solveSkewb
15
- } from "../chunk-TGPS3CXW.js";
15
+ } from "../chunk-2JDBIQSV.js";
16
16
  import "../chunk-RHC3DIN3.js";
17
17
  import "../chunk-ZB3P5AZN.js";
18
18
  import "../chunk-WXCNEGW3.js";
@@ -4,8 +4,8 @@ import {
4
4
  import {
5
5
  cube2x2x2,
6
6
  puzzles
7
- } from "./chunk-DZGFGBKT.js";
8
- import "./chunk-PYWGREIP.js";
7
+ } from "./chunk-XRZBPKES.js";
8
+ import "./chunk-U2ONHTIX.js";
9
9
  import {
10
10
  KPuzzle
11
11
  } from "./chunk-XU5ILFX5.js";
@@ -1889,4 +1889,4 @@ export {
1889
1889
  sgsDataSkewbFixedCorner,
1890
1890
  skewbKPuzzleWithoutMOCached
1891
1891
  };
1892
- //# sourceMappingURL=search-dynamic-sgs-side-events-AYX7MZO7.js.map
1892
+ //# sourceMappingURL=search-dynamic-sgs-side-events-4H3X5HLH.js.map
@@ -3,8 +3,8 @@ import {
3
3
  } from "./chunk-GW4FGG42.js";
4
4
  import {
5
5
  puzzles
6
- } from "./chunk-DZGFGBKT.js";
7
- import "./chunk-PYWGREIP.js";
6
+ } from "./chunk-XRZBPKES.js";
7
+ import "./chunk-U2ONHTIX.js";
8
8
  import "./chunk-XU5ILFX5.js";
9
9
  import {
10
10
  randomUIntBelowFactory
@@ -1218,4 +1218,4 @@ export {
1218
1218
  getRandomRediCubeScramble,
1219
1219
  sgsDataFTO
1220
1220
  };
1221
- //# sourceMappingURL=search-dynamic-sgs-unofficial-DLJOJFJL.js.map
1221
+ //# sourceMappingURL=search-dynamic-sgs-unofficial-7IRW4LVD.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  mustBeInsideWorker,
3
3
  random333Scramble
4
- } from "./chunk-Q4W5ZR4U.js";
4
+ } from "./chunk-WYKXX2XY.js";
5
5
  import "./chunk-OX6O2ZO5.js";
6
- import "./chunk-DZGFGBKT.js";
7
- import "./chunk-PYWGREIP.js";
6
+ import "./chunk-XRZBPKES.js";
7
+ import "./chunk-U2ONHTIX.js";
8
8
  import "./chunk-XU5ILFX5.js";
9
9
  import {
10
10
  randomUIntBelowFactory
@@ -2678,4 +2678,4 @@ export {
2678
2678
  initialize,
2679
2679
  random444Scramble
2680
2680
  };
2681
- //# sourceMappingURL=search-dynamic-solve-4x4x4-CWWTFKMR.js.map
2681
+ //# sourceMappingURL=search-dynamic-solve-4x4x4-7JTJCCSY.js.map
@@ -5,7 +5,7 @@ var workerSource = `"use strict";var Am=Object.defineProperty;var y=(e,t)=>()=>(
5
5
  \`)||r.includes("\\r"))throw new Error("LineComment cannot contain newline");V(this,dr,r)}get text(){return R(this,dr)}isIdentical(r){let n=r;return r.is(K0)&&R(this,dr)===R(n,dr)}invert(){return this}*experimentalExpand(r=1,n=1/0){yield this}toString(){return\`//\${R(this,dr)}\`}},Ft=K0;dr=new WeakMap});var Xe,Ol=y(()=>{"use strict";Jt();Tt();Xe=class extends Me{toString(){return\`
6
6
  \`}isIdentical(t){return t.is(Xe)}invert(){return this}*experimentalExpand(t=1,r=1/0){yield this}}});var Ae,Tl=y(()=>{"use strict";Jt();Tt();Ae=class extends Me{toString(){return"."}isIdentical(r){return r.is(Ae)}invert(){return this}*experimentalExpand(r=1,n=1/0){yield this}}});function Qo(e,t){return e?parseInt(e):t}function Q0(e){return new Il().parseAlg(e)}function O2(e){return new Il().parseMove(e)}function T2(e){return new Il().parseQuantumMove(e)}function $e(e,t,r){let n=e;return n.startCharIndex=t,n.endCharIndex=r,n}function I2(e,t){return"startCharIndex"in e&&(t.startCharIndex=e.startCharIndex),"endCharIndex"in e&&(t.endCharIndex=e.endCharIndex),t}var G2,Om,Tm,Im,Wm,Km,it,I,Pn,Il,j0=y(()=>{"use strict";Yt();I0();W0();Nl();Ml();jo();Gl();Rr();Ol();Tl();G2=/^(\\d+)?('?)/,Om=/^[_\\dA-Za-z]/,Tm=/^((([1-9]\\d*)-)?([1-9]\\d*))?([_A-Za-z]+)?/,Im=/^[^\\n]*/,Wm=/^(-?\\d+), ?/,Km=/^(-?\\d+)\\)/;Il=class{constructor(){ee(this,it,"");ee(this,I,0);ee(this,Pn,[])}parseAlg(t){V(this,it,t),V(this,I,0);let r=this.parseAlgWithStopping([]);this.mustBeAtEndOfInput();let n=Array.from(r.childAlgNodes());if(R(this,Pn).length>0)for(let s of R(this,Pn).reverse())n.push(s);let l=new v(n),{startCharIndex:o,endCharIndex:i}=r;return $e(l,o,i),l}parseMove(t){V(this,it,t),V(this,I,0);let r=this.parseMoveImpl();return this.mustBeAtEndOfInput(),r}parseQuantumMove(t){V(this,it,t),V(this,I,0);let r=this.parseQuantumMoveImpl();return this.mustBeAtEndOfInput(),r}mustBeAtEndOfInput(){if(R(this,I)!==R(this,it).length)throw new Error("parsing unexpectedly ended early")}parseAlgWithStopping(t){let r=R(this,I),n=R(this,I),l=new Lt,o=!1,i=s=>{if(o)throw new Error(\`Unexpected character at index \${s}. Are you missing a space?\`)};e:for(;R(this,I)<R(this,it).length;){let s=R(this,I);if(t.includes(R(this,it)[R(this,I)]))return $e(l.toAlg(),r,n);if(this.tryConsumeNext(" ")){o=!1,l.experimentalNumAlgNodes()===0&&(r=R(this,I));continue e}else if(Om.test(R(this,it)[R(this,I)])){i(s);let a=this.parseMoveImpl();l.push(a),o=!0,n=R(this,I);continue e}else if(this.tryConsumeNext("(")){i(s);let a=this.tryRegex(Wm);if(a){let f=a[1],u=R(this,I),g=this.parseRegex(Km),p=$e(new B(new z("U_SQ_"),parseInt(f)),s+1,s+1+f.length),c=$e(new B(new z("D_SQ_"),parseInt(g[1])),u,R(this,I)-1),L=$e(new v([p,c]),s+1,R(this,I)-1);l.push($e(new Te(L),s,R(this,I))),o=!0,n=R(this,I);continue e}else{let f=this.parseAlgWithStopping([")"]);this.mustConsumeNext(")");let u=this.parseAmount();l.push($e(new Te(f,u),s,R(this,I))),o=!0,n=R(this,I);continue e}}else if(this.tryConsumeNext("^")){if(!M2.caratNISSNotationEnabled)throw new Error("Alg contained a carat but carat NISS notation is not enabled.");this.mustConsumeNext("(");let a=this.parseAlgWithStopping([")"]);this.popNext();let f=new Te(a,-1),u=new Ae;f.experimentalNISSPlaceholder=u,u.experimentalNISSGrouping=f,R(this,Pn).push(f),l.push(u)}else if(this.tryConsumeNext("[")){i(s);let a=this.parseAlgWithStopping([",",":"]),f=this.popNext(),u=this.parseAlgWithStopping(["]"]);switch(this.mustConsumeNext("]"),f){case":":l.push($e(new Oe(a,u),s,R(this,I))),o=!0,n=R(this,I);continue e;case",":l.push($e(new Ge(a,u),s,R(this,I))),o=!0,n=R(this,I);continue e;default:throw new Error("unexpected parsing error")}}else if(this.tryConsumeNext(\`
7
7
  \`)){l.push($e(new Xe,s,R(this,I))),o=!1,n=R(this,I);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){i(s);let[a]=this.parseRegex(Im);l.push($e(new Ft(a),s,R(this,I))),o=!1,n=R(this,I);continue e}else{l.push($e(new B("_SLASH_"),s,R(this,I))),o=!0,n=R(this,I);continue e}else if(this.tryConsumeNext(".")){i(s),l.push($e(new Ae,s,R(this,I))),o=!0,n=R(this,I);continue e}else throw new Error(\`Unexpected character: \${this.popNext()}\`)}if(R(this,I)!==R(this,it).length)throw new Error("did not finish parsing?");if(t.length>0)throw new Error("expected stopping");return $e(l.toAlg(),r,n)}parseQuantumMoveImpl(){let[,,,t,r,n]=this.parseRegex(Tm);return new z(n,Qo(r,void 0),Qo(t,void 0))}parseMoveImpl(){let t=R(this,I);if(this.tryConsumeNext("/"))return $e(new B("_SLASH_"),t,R(this,I));let r=this.parseQuantumMoveImpl(),[n,l]=this.parseAmountAndTrackEmptyAbsAmount(),o=this.parseMoveSuffix();if(o){if(n<0)throw new Error("uh-oh");if((o==="++"||o==="--")&&n!==1)throw new Error("Pochmann ++ or -- moves cannot have an amount other than 1.");if((o==="++"||o==="--")&&!l)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((o==="+"||o==="-")&&l)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");o.startsWith("+")&&(r=r.modified({family:\`\${r.family}_\${o==="+"?"PLUS":"PLUSPLUS"}_\`})),o.startsWith("-")&&(r=r.modified({family:\`\${r.family}_\${o==="-"?"PLUS":"PLUSPLUS"}_\`}),n*=-1)}return $e(new B(r,n),t,R(this,I))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let t=R(this,I),[,r,n]=this.parseRegex(G2);if(r?.startsWith("0")&&r!=="0")throw new Error(\`Error at char index \${t}: An amount can only start with 0 if it's exactly the digit 0.\`);return[Qo(r,1)*(n==="'"?-1:1),!r]}parseAmount(){let t=R(this,I),[,r,n]=this.parseRegex(G2);if(r?.startsWith("0")&&r!=="0")throw new Error(\`Error at char index \${t}: An amount number can only start with 0 if it's exactly the digit 0.\`);return Qo(r,1)*(n==="'"?-1:1)}parseRegex(t){let r=t.exec(this.remaining());if(r===null)throw new Error("internal parsing error");return V(this,I,R(this,I)+r[0].length),r}tryRegex(t){let r=t.exec(this.remaining());return r===null?null:(V(this,I,R(this,I)+r[0].length),r)}remaining(){return R(this,it).slice(R(this,I))}popNext(){let t=R(this,it)[R(this,I)];return N0(this,I)._++,t}tryConsumeNext(t){return R(this,it)[R(this,I)]===t?(N0(this,I)._++,!0):!1}mustConsumeNext(t){let r=this.popNext();if(r!==t)throw new Error(\`expected \\\`\${t}\\\` while parsing, encountered \${r}\`);return r}};it=new WeakMap,I=new WeakMap,Pn=new WeakMap});function qo(e){W2.has(e)||(console.warn(e),W2.add(e))}var W2,q0=y(()=>{"use strict";W2=new Set});var Yr,V0=y(()=>{"use strict";Tt();T0();Yr=class{constructor(t,r=1){if(this.quantum=t,this.amount=r,!Number.isInteger(this.amount)||this.amount<-2147483648||this.amount>2147483647)throw new Error(\`AlgNode amount absolute value must be a non-negative integer below \${Pl}.\`)}suffix(){let t="",r=Math.abs(this.amount);return r!==1&&(t+=r),this.amount<0&&(t+="'"),t}isIdentical(t){return this.quantum.isIdentical(t.quantum)&&this.amount===t.amount}*experimentalExpand(t,r){let n=Math.abs(this.amount),l=C2(t,this.amount<0);for(let o=0;o<n;o++)yield*this.quantum.experimentalExpand(l,r)}}});var Xt,qe,Ve,Ho,z,Ie,Nn,B,Rr=y(()=>{"use strict";Jt();Tt();T0();j0();q0();V0();Ho=class extends Cl{constructor(r,n,l){super();ee(this,Xt,void 0);ee(this,qe,void 0);ee(this,Ve,void 0);if(V(this,Xt,r),V(this,qe,n??null),V(this,Ve,l??null),Object.freeze(this),R(this,qe)!==null&&(!Number.isInteger(R(this,qe))||R(this,qe)<1||R(this,qe)>2147483647))throw new Error(\`QuantumMove inner layer must be a positive integer below \${Pl}.\`);if(R(this,Ve)!==null&&(!Number.isInteger(R(this,Ve))||R(this,Ve)<1||R(this,Ve)>2147483647))throw new Error(\`QuantumMove outer layer must be a positive integer below \${Pl}.\`);if(R(this,Ve)!==null&&R(this,qe)!==null&&R(this,qe)<=R(this,Ve))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(R(this,Ve)!==null&&R(this,qe)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(r){return T2(r)}modified(r){return new Ho(r.family??R(this,Xt),r.innerLayer??R(this,qe),r.outerLayer??R(this,Ve))}isIdentical(r){let n=r;return r.is(Ho)&&R(this,Xt)===R(n,Xt)&&R(this,qe)===R(n,qe)&&R(this,Ve)===R(n,Ve)}get family(){return R(this,Xt)}get outerLayer(){return R(this,Ve)}get innerLayer(){return R(this,qe)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a \`QuantumMove\` directly.")}toString(){let r=R(this,Xt);return R(this,qe)!==null&&(r=String(R(this,qe))+r,R(this,Ve)!==null&&(r=String(R(this,Ve))+"-"+r)),r}},z=Ho;Xt=new WeakMap,qe=new WeakMap,Ve=new WeakMap;Nn=class extends Me{constructor(...r){super();ee(this,Ie,void 0);if(typeof r[0]=="string")if(r[1]??null){V(this,Ie,new Yr(z.fromString(r[0]),r[1]));return}else return Nn.fromString(r[0]);V(this,Ie,new Yr(r[0],r[1]))}isIdentical(r){let n=r.as(Nn);return!!n&&R(this,Ie).isIdentical(R(n,Ie))}invert(){return I2(this,new Nn(R(this,Ie).quantum,-this.amount))}*experimentalExpand(r=1){r===1?yield this:yield this.modified({amount:-this.amount})}get quantum(){return R(this,Ie).quantum}modified(r){return new Nn(R(this,Ie).quantum.modified(r),r.amount??this.amount)}static fromString(r){return O2(r)}get amount(){return R(this,Ie).amount}get type(){return qo("deprecated: type"),"blockMove"}get family(){return R(this,Ie).quantum.family??void 0}get outerLayer(){return R(this,Ie).quantum.outerLayer??void 0}get innerLayer(){return R(this,Ie).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return R(this,Ie).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let r=Math.abs(this.amount);return R(this,Ie).quantum.toString().slice(0,-10)+(r===1?"":r)+(this.amount<0?"--":"++")}return R(this,Ie).quantum.toString()+R(this,Ie).suffix()}},B=Nn;Ie=new WeakMap});var H0,K2,st,Zo,Te,jo=y(()=>{"use strict";Yt();Jt();Tt();Rr();V0();H0=class{constructor(){this.quantumU_SQ_=null;this.quantumD_SQ_=null}format(t){let r=this.tuple(t);return r?\`(\${r.map(n=>n.amount).join(", ")})\`:null}tuple(t){this.quantumU_SQ_||(this.quantumU_SQ_=new z("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new z("D_SQ_"));let r=t.alg;if(r.experimentalNumChildAlgNodes()===2){let[n,l]=r.childAlgNodes();if(n.as(B)?.quantum.isIdentical(this.quantumU_SQ_)&&l.as(B)?.quantum.isIdentical(this.quantumD_SQ_)){if(t.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[n,l]}}return null}},K2=new H0,Zo=class extends Me{constructor(r,n){super();ee(this,st,void 0);let l=Br(r);V(this,st,new Yr(l,n))}isIdentical(r){let n=r;return r.is(Zo)&&R(this,st).isIdentical(R(n,st))}get alg(){return R(this,st).quantum}get amount(){return R(this,st).amount}get experimentalRepetitionSuffix(){return R(this,st).suffix()}invert(){return new Zo(R(this,st).quantum,-R(this,st).amount)}*experimentalExpand(r=1,n){n??(n=1/0),n===0?yield r===1?this:this.invert():yield*R(this,st).experimentalExpand(r,n-1)}static fromString(){throw new Error("unimplemented")}toString(){return K2.format(this)??\`(\${R(this,st).quantum.toString()})\${R(this,st).suffix()}\`}experimentalAsSquare1Tuple(){return K2.tuple(this)}},Te=Zo;st=new WeakMap});var Mn=y(()=>{"use strict";jo();Gl();Nl();Ml();Rr();Ol();Tl()});function wt(e,t){return e instanceof t}function Q2(e){return wt(e,Te)||wt(e,Ft)||wt(e,Ge)||wt(e,Oe)||wt(e,B)||wt(e,Xe)||wt(e,Ae)}var Z0=y(()=>{"use strict";Mn()});function q2(e,t,r){if(t.is(Te))return e.traverseGrouping(t,r);if(t.is(B))return e.traverseMove(t,r);if(t.is(Ge))return e.traverseCommutator(t,r);if(t.is(Oe))return e.traverseConjugate(t,r);if(t.is(Ae))return e.traversePause(t,r);if(t.is(Xe))return e.traverseNewline(t,r);if(t.is(Ft))return e.traverseLineComment(t,r);throw new Error("unknown AlgNode")}function V2(e){if(e.is(Te)||e.is(B)||e.is(Ge)||e.is(Oe)||e.is(Ae)||e.is(Xe)||e.is(Ft))return e;throw new Error("internal error: expected AlgNode")}var Xr,$r,Yo,Wl,J0,Xo,H2,Y0,Jo,j2,Z2,X0=y(()=>{"use strict";jo();Nl();Rr();Ol();Tl();Ml();Gl();Xr=class{traverseAlgNode(t,r){return q2(this,t,r)}traverseIntoAlgNode(t,r){return V2(this.traverseAlgNode(t,r))}},$r=class extends Xr{traverseAlgNode(t){return q2(this,t,void 0)}traverseIntoAlgNode(t){return V2(this.traverseAlgNode(t))}},Y0=class extends Xr{constructor(){super(...arguments);ee(this,Wl);ee(this,Yo,void 0)}*traverseAlg(r,n){if(n.depth===0){yield*r.childAlgNodes();return}let l=[],o=null,i=n?.collapseMoves??!0;function s(u,g){var L;let p=To(L=Y0,Xo,H2).call(L,u,g,n);if(p===0)return!1;let c=new B(u.quantum,p);return l.push(c),o=c,!0}function a(u){i&&o?.is(B)&&u.is(B)&&o.quantum.isIdentical(u.quantum)?(l.pop(),s(o,u.amount)||(o=l.slice(-1)[0])):u.is(B)?s(u,0):(l.push(u),o=u)}let f={depth:n.depth?n.depth-1:null};for(let u of r.childAlgNodes())for(let g of this.traverseAlgNode(u,f))a(g);for(let u of l)yield u}*traverseGrouping(r,n){if(n.depth===0){yield r;return}let l={depth:n.depth?n.depth-1:null},o=new Te(this.traverseAlg(r.alg,l),r.amount),i=To(this,Wl,J0).call(this).get(r);i&&(o.experimentalNISSPlaceholder=i,i.experimentalNISSGrouping=o),yield o}*traverseMove(r,n){yield r}*traverseCommutator(r,n){if(n.depth===0){yield r;return}let l={depth:n.depth?n.depth-1:null};yield new Ge(this.traverseAlg(r.A,l),this.traverseAlg(r.B,l))}*traverseConjugate(r,n){if(n.depth===0){yield r;return}let l={depth:n.depth?n.depth-1:null};yield new Oe(this.traverseAlg(r.A,l),this.traverseAlg(r.B,l))}*traversePause(r,n){if(r.experimentalNISSGrouping){let l=new Ae;To(this,Wl,J0).call(this).set(r.experimentalNISSGrouping,l),yield l}else yield r}*traverseNewline(r,n){yield r}*traverseLineComment(r,n){yield r}},Jo=Y0;Yo=new WeakMap,Wl=new WeakSet,J0=function(){return R(this,Yo)??V(this,Yo,new Map)},Xo=new WeakSet,H2=function(r,n,l){let o=r.amount+n;if(l?.quantumMoveOrder){let i=l.quantumMoveOrder(r.quantum),s=Math.floor(i/2)+1-i;o=(o%i+i-s)%i+s}return o},ee(Jo,Xo);j2=new Jo,Z2=j2.traverseAlg.bind(j2)});function J2(e){if(!e)return[];if(wt(e,v))return e.childAlgNodes();if(typeof e=="string")return Q0(e).childAlgNodes();let t=e;if(typeof t[Symbol.iterator]=="function")return t;throw new Error("Invalid AlgNode")}function Br(e){return wt(e,v)?e:new v(e)}function jm(e,t){return e.is(Xe)||t.is(Xe)||t.as(Te)?.experimentalNISSPlaceholder?"":e.is(Ft)&&!t.is(Xe)?\`
8
- \`:" "}var at,en,v,Yt=y(()=>{"use strict";Jt();Z0();Tt();j0();X0();Mn();Gl();Rr();Ol();q0();en=class extends Me{constructor(r){super();ee(this,at,void 0);V(this,at,Array.from(J2(r)));for(let n of R(this,at))if(!Q2(n))throw new Error("An alg can only contain alg nodes.")}isIdentical(r){let n=r;if(!r.is(en))return!1;let l=Array.from(R(this,at)),o=Array.from(R(n,at));if(l.length!==o.length)return!1;for(let i=0;i<l.length;i++)if(!l[i].isIdentical(o[i]))return!1;return!0}invert(){return new en(N2(Array.from(R(this,at)).map(r=>r.invert())))}*experimentalExpand(r=1,n){n??(n=1/0);for(let l of P2(R(this,at),r))yield*l.experimentalExpand(r,n)}expand(r){return new en(this.experimentalExpand(1,r?.depth??1/0))}*experimentalLeafMoves(){for(let r of this.experimentalExpand())r.is(B)&&(yield r)}concat(r){return new en(Array.from(R(this,at)).concat(Array.from(J2(r))))}experimentalIsEmpty(){for(let r of R(this,at))return!1;return!0}static fromString(r){return Q0(r)}units(){return this.childAlgNodes()}*childAlgNodes(){for(let r of R(this,at))yield r}experimentalNumUnits(){return this.experimentalNumChildAlgNodes()}experimentalNumChildAlgNodes(){return Array.from(R(this,at)).length}get type(){return qo("deprecated: type"),"sequence"}toString(){let r="",n=null;for(let l of R(this,at)){n&&(r+=jm(n,l));let o=l.as(Ae)?.experimentalNISSGrouping;if(o){if(o.amount!==-1)throw new Error("Invalid NISS Grouping amount!");r+=\`^(\${o.alg.toString()})\`}else l.as(Te)?.experimentalNISSPlaceholder||(r+=l.toString());n=l}return r}simplify(r){return new en(Z2(this,r??{}))}},v=en;at=new WeakMap});var qm,Y2=y(()=>{"use strict";Yt();Mn();Nl();Ml();Rr();Tl();qm={Sune:new v([new B("R",1),new B("U",1),new B("R",-1),new B("U",1),new B("R",1),new B("U",-2),new B("R",-1)]),AntiSune:new v([new B("R",1),new B("U",2),new B("R",-1),new B("U",-1),new B("R",1),new B("U",-1),new B("R",-1)]),SuneCommutator:new v([new Ge(new v([new B("R",1),new B("U",1),new B("R",-2)]),new v([new Oe(new v([new B("R",1)]),new v([new B("U",1)]))]))]),Niklas:new v([new B("R",1),new B("U",-1),new B("L",-1),new B("U",1),new B("R",-1),new B("U",-1),new B("L",1),new B("U",1)]),EPerm:new v([new B("x",-1),new Ge(new v([new Oe(new v([new B("R",1)]),new v([new B("U",-1)]))]),new v([new B("D",1)])),new Ge(new v([new Oe(new v([new B("R",1)]),new v([new B("U",1)]))]),new v([new B("D",1)])),new B("x",1)]),FURURFCompact:new v([new Oe(new v([new B("F",1)]),new v([new Ge(new v([new B("U",1)]),new v([new B("R",1)]))]))]),APermCompact:new v([new Oe(new v([new B("R",2)]),new v([new Ge(new v([new B("F",2)]),new v([new B("R",-1),new B("B",-1),new B("R",1)]))]))]),FURURFMoves:new v([new B("F",1),new B("U",1),new B("R",1),new B("U",-1),new B("R",-1),new B("F",-1)]),TPerm:new v([new B("R",1),new B("U",1),new B("R",-1),new B("U",-1),new B("R",-1),new B("F",1),new B("R",2),new B("U",-1),new B("R",-1),new B("U",-1),new B("R",1),new B("U",1),new B("R",-1),new B("F",-1)]),HeadlightSwaps:new v([new Oe(new v([new B("F",1)]),new v([new Te(new v([new Ge(new v([new B("R",1)]),new v([new B("U",1)]))]),3)]))]),TriplePause:new v([new Ae,new Ae,new Ae])}});var TA,X2=y(()=>{"use strict";Mn();Rr();TA={73:new B("R"),75:new B("R'"),87:new B("B"),79:new B("B'"),83:new B("D"),76:new B("D'"),68:new B("L"),69:new B("L'"),74:new B("U"),70:new B("U'"),72:new B("F"),71:new B("F'"),78:new B("x'"),67:new B("l"),82:new B("l'"),85:new B("r"),77:new B("r'"),88:new B("d"),188:new B("d'"),84:new B("x"),89:new B("x"),66:new B("x'"),186:new B("y"),59:new B("y"),65:new B("y'"),80:new B("z"),81:new B("z'"),90:new B("M'"),190:new B("M'"),192:new Ae}});var $2=y(()=>{"use strict"});var ef=y(()=>{"use strict";Yt()});var Be=y(()=>{"use strict";Yt();I0();X0();Y2();X2();Mn();$2();ef();Z0();W0()});function Ql(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],s=r[l];if(Kl(o.numOrientations,s))n[l]=i;else if(Kl(o.numOrientations,i))n[l]=s;else{let a=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)a[f]=i.permutation[s.permutation[f]];n[l]={permutation:a,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let u=0;u<o.numPieces;u++)f[u]=(i.orientation[s.permutation[u]]+s.orientation[u])%o.numOrientations,a[u]=i.permutation[s.permutation[u]];n[l]={permutation:a,orientation:f}}}}return n}function $0(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],s=r[l];if(Kl(o.numOrientations,s))n[l]=i;else{let a=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)a[f]=i.pieces[s.permutation[f]];n[l]={pieces:a,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let u=0;u<o.numPieces;u++)f[u]=(i.orientation[s.permutation[u]]+s.orientation[u])%o.numOrientations,a[u]=i.pieces[s.permutation[u]];n[l]={pieces:a,orientation:f}}}}return n}var $o=y(()=>{"use strict";jl()});function Vm(e){let t=tf.get(e);if(t)return t;let r=new Array(e),n=new Array(e);for(let o=0;o<e;o++)r[o]=o,n[o]=0;let l={permutation:r,orientation:n};return rf&&(Object.freeze(r),Object.freeze(n),Object.freeze(l)),tf.set(e,l),l}function nf(e){let t={};for(let[r,n]of Object.entries(e.orbits))t[r]=Vm(n.numPieces);return rf&&Object.freeze(t),t}function lf(e,t){let r=t.quantum.toString(),n=e.definition.moves[r];if(!n){let i=e.definition.experimentalDerivedMoves?.[r];i&&(n=e.algToTransformation(i).transformationData)}if(n)return hr(e,n,t.amount);let l=e.definition.moves[t.toString()];if(l)return l;let o=e.definition.moves[t.invert().toString()];if(o)return hr(e,o,-1);throw new Error(\`Invalid move for KPuzzle (\${e.name()}): \${t}\`)}var rf,tf,es=y(()=>{"use strict";jl();rf=!1,tf=new Map});var ge,ei=y(()=>{"use strict";$o();ql();ge=class{constructor(t,r){this.kpuzzle=t;this.stateData=r}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),stateData:this.stateData}}static fromTransformation(t){let r=$0(t.kpuzzle.definition,t.kpuzzle.definition.startStateData,t.transformationData);return new ge(t.kpuzzle,r)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(t.isIdentityTransformation())return new ge(this.kpuzzle,this.stateData);let r=$0(this.kpuzzle.definition,this.stateData,t.transformationData);return new ge(this.kpuzzle,r)}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let t={};for(let[r,n]of Object.entries(this.stateData)){let l={permutation:n.pieces,orientation:n.orientation};t[r]=l}return new Dt(this.kpuzzle,t)}experimentalIsSolved(t){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,t)}}});var tn,Fr,Dt,ql=y(()=>{"use strict";jl();$o();es();ei();Fr=class{constructor(t,r){this.kpuzzle=t;this.transformationData=r;ee(this,tn,void 0)}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),transformationData:this.transformationData}}invert(){return new Fr(this.kpuzzle,ts(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return R(this,tn)??V(this,tn,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(t){let r=new Fr(t,nf(t.definition));return V(r,tn,!0),r}isIdentical(t){return of(this.kpuzzle,this.transformationData,t.transformationData)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(this.kpuzzle!==t.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${t.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return R(this,tn)?new Fr(this.kpuzzle,t.transformationData):R(t,tn)?new Fr(this.kpuzzle,this.transformationData):new Fr(this.kpuzzle,Ql(this.kpuzzle.definition,this.transformationData,t.transformationData))}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}toKState(){return ge.fromTransformation(this)}repetitionOrder(){return sf(this.kpuzzle.definition,this)}selfMultiply(t){return new Fr(this.kpuzzle,hr(this.kpuzzle,this.transformationData,t))}},Dt=Fr;tn=new WeakMap});function Kl(e,t){let{permutation:r}=t,n=r.length;for(let l=0;l<n;l++)if(r[l]!==l)return!1;if(e>1){let{orientation:l}=t;for(let o=0;o<n;o++)if(l[o]!==0)return!1}return!0}function Hm(e,t,r,n={}){for(let l=0;l<e.numPieces;l++)if(!n?.ignoreOrientation&&t.orientation[l]!==r.orientation[l]||!n?.ignorePermutation&&t.permutation[l]!==r.permutation[l])return!1;return!0}function of(e,t,r){for(let[n,l]of Object.entries(e.definition.orbits))if(!Hm(l,t[n],r[n]))return!1;return!0}function ts(e,t){let r={};for(let n in e.definition.orbits){let l=e.definition.orbits[n],o=t[n];if(Kl(l.numOrientations,o))r[n]=o;else if(l.numOrientations===1){let i=new Array(l.numPieces);for(let s=0;s<l.numPieces;s++)i[o.permutation[s]]=s;r[n]={permutation:i,orientation:o.orientation}}else{let i=new Array(l.numPieces),s=new Array(l.numPieces);for(let a=0;a<l.numPieces;a++){let f=o.permutation[a];i[f]=a,s[f]=(l.numOrientations-o.orientation[a]+l.numOrientations)%l.numOrientations}r[n]={permutation:i,orientation:s}}}return r}function hr(e,t,r){if(r===1)return t;if(r<0)return hr(e,ts(e,t),-r);if(r===0){let{transformationData:o}=e.identityTransformation();return o}let n=t;r!==2&&(n=hr(e,t,Math.floor(r/2)));let l=Ql(e.definition,n,n);return r%2===0?l:Ql(e.definition,t,l)}function ns(e,t){return t?ns(t,e%t):e}function sf(e,t){let r=1;for(let n in e.orbits){let l=e.orbits[n],o=t.transformationData[n],i=new Array(l.numPieces);for(let s=0;s<l.numPieces;s++)if(!i[s]){let a=s,f=0,u=0;for(;i[a]=!0,f=f+o.orientation[a],u=u+1,a=o.permutation[a],a!==s;);f!==0&&(u=u*l.numOrientations/ns(l.numOrientations,f)),r=r*u/ns(r,u)}}return r}var rs,af,ff,jl=y(()=>{"use strict";Be();$o();ql();rs=class extends Xr{traverseAlg(t,r){let n=null;for(let l of t.childAlgNodes())n?n=n.applyTransformation(this.traverseAlgNode(l,r)):n=this.traverseAlgNode(l,r);return n??r.identityTransformation()}traverseGrouping(t,r){let n=this.traverseAlg(t.alg,r);return new Dt(r,hr(r,n.transformationData,t.amount))}traverseMove(t,r){return r.moveToTransformation(t)}traverseCommutator(t,r){let n=this.traverseAlg(t.A,r),l=this.traverseAlg(t.B,r);return n.applyTransformation(l).applyTransformation(n.invert()).applyTransformation(l.invert())}traverseConjugate(t,r){let n=this.traverseAlg(t.A,r),l=this.traverseAlg(t.B,r);return n.applyTransformation(l).applyTransformation(n.invert())}traversePause(t,r){return r.identityTransformation()}traverseNewline(t,r){return r.identityTransformation()}traverseLineComment(t,r){return r.identityTransformation()}},af=new rs,ff=af.traverseAlg.bind(af)});var Gn,ti,ye,uf=y(()=>{"use strict";Be();jl();es();ei();ql();ye=class{constructor(t,r){this.definition=t;ee(this,Gn,new Map);ee(this,ti,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return Dt.experimentalConstructIdentity(this)}moveToTransformation(t){typeof t=="string"&&(t=new B(t));let r=t.toString(),n=R(this,Gn).get(r);if(n)return new Dt(this,n);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(t);if(!o)throw new Error(\`could not map to internal move: \${t}\`);return R(this,Gn).set(r,o),new Dt(this,o)}let l=lf(this,t);return R(this,Gn).set(r,l),new Dt(this,l)}algToTransformation(t){return typeof t=="string"&&(t=new v(t)),ff(t,this)}toTransformation(t){return typeof t=="string"?this.algToTransformation(t):t?.is?.(v)?this.algToTransformation(t):t?.is?.(B)?this.moveToTransformation(t):t}startState(){return new ge(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return R(this,ti)??V(this,ti,(()=>{for(let[t,r]of Object.entries(this.definition.orbits)){let n=new Array(r.numPieces).fill(!1);for(let l of this.definition.startStateData[t].pieces)n[l]=!0;for(let l of n)if(!l)return!1}return!0})())}};Gn=new WeakMap,ti=new WeakMap});var He=y(()=>{"use strict";uf();ei();ql()});var Zm,Ty,gf=y(()=>{"use strict";Zm={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"}},Ty={...Zm,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 oL(e){switch(e){case"Regular":return Jm;case"Dim":return rL;case"Ignored":return Ym;case"OrientationStickers":return Xm;case"Invisible":return $m;case"IgnoreNonPrimary":return eL;case"PermuteNonPrimary":return tL;case"Ignoriented":return nL;case"OrientationWithoutPermutation":return lL}}var $t,It,Ze,On,ri,rn,Jm,Ym,Xm,$m,eL,tL,rL,nL,lL,Tn,In,ni=y(()=>{"use strict";$t=class{constructor(t,r){this.stickerings=new Map;for(let[n,l]of Object.entries(t.definition.orbits))this.stickerings.set(n,new Array(l.numPieces).fill(r))}},It="regular",Ze="ignored",On="oriented",ri="invisible",rn="dim",Jm={facelets:[It,It,It,It,It]},Ym={facelets:[Ze,Ze,Ze,Ze,Ze]},Xm={facelets:[On,On,On,On,On]},$m={facelets:[ri,ri,ri,ri]},eL={facelets:[It,Ze,Ze,Ze,Ze]},tL={facelets:[rn,It,It,It,It]},rL={facelets:[rn,rn,rn,rn,rn]},nL={facelets:[rn,Ze,Ze,Ze,Ze]},lL={facelets:[On,Ze,Ze,Ze,Ze]};Tn=class extends $t{constructor(t){super(t,"Regular")}set(t,r){for(let[n,l]of this.stickerings.entries())for(let o=0;o<l.length;o++)t.stickerings.get(n)[o]&&(l[o]=r);return this}toAppearance(){let t={orbits:{}};for(let[r,n]of this.stickerings.entries()){let l=[],o={pieces:l};t.orbits[r]=o;for(let i of n)l.push(oL(i))}return t}},In=class{constructor(t){this.kpuzzle=t}and(t){let r=new $t(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let o=0;o<l.numPieces;o++){r.stickerings.get(n)[o]=!0;for(let i of t)if(!i.stickerings.get(n)[o]){r.stickerings.get(n)[o]=!1;continue e}}}return r}or(t){let r=new $t(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let o=0;o<l.numPieces;o++){r.stickerings.get(n)[o]=!1;for(let i of t)if(i.stickerings.get(n)[o]){r.stickerings.get(n)[o]=!0;continue e}}}return r}not(t){let r=new $t(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits))for(let o=0;o<l.numPieces;o++)r.stickerings.get(n)[o]=!t.stickerings.get(n)[o];return r}all(){return this.and(this.moves([]))}move(t){let r=this.kpuzzle.moveToTransformation(t),n=new $t(this.kpuzzle,!1);for(let[l,o]of Object.entries(this.kpuzzle.definition.orbits))for(let i=0;i<o.numPieces;i++)(r.transformationData[l].permutation[i]!==i||r.transformationData[l].orientation[i]!==0)&&(n.stickerings.get(l)[i]=!0);return n}moves(t){return t.map(r=>this.move(r))}orbits(t){let r=new $t(this.kpuzzle,!1);for(let n of t)r.stickerings.get(n).fill(!0);return r}orbitPrefix(t){let r=new $t(this.kpuzzle,!1);for(let n in this.kpuzzle.definition.orbits)n.startsWith(t)&&r.stickerings.get(n).fill(!0);return r}}});var ls,os=y(()=>{"use strict";ls={full:{groups:{"3x3x3":"Stickering"}},OLL:{groups:{"3x3x3":"Last Layer"}},PLL:{groups:{"3x3x3":"Last Layer"}},LL:{groups:{"3x3x3":"Last Layer"}},COLL:{groups:{"3x3x3":"Last Layer"}},OCLL:{groups:{"3x3x3":"Last Layer"}},CLL:{groups:{"3x3x3":"Last Layer"}},ELL:{groups:{"3x3x3":"Last Layer"}},ZBLL:{groups:{"3x3x3":"Last Layer"}},LS:{groups:{"3x3x3":"Last Slot"}},ELS:{groups:{"3x3x3":"Last Slot"}},CLS:{groups:{"3x3x3":"Last Slot"}},ZBLS:{groups:{"3x3x3":"Last Slot"}},VLS:{groups:{"3x3x3":"Last Slot"}},WVLS:{groups:{"3x3x3":"Last Slot"}},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"}},"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 er(e,t){let r=await e.kpuzzle(),n=new Tn(r),l=new In(r),o=()=>l.move("U"),i=()=>l.or(l.moves(["U","D"])),s=()=>l.or(l.moves(["L","R"])),a=()=>l.not(s()),f=()=>l.not(o()),u=()=>l.orbitPrefix("CENTER"),g=()=>l.orbitPrefix("EDGE"),p=()=>l.or([l.orbitPrefix("CORNER"),l.orbitPrefix("C4RNER"),l.orbitPrefix("C5RNER")]),c=()=>l.or([a(),l.and([o(),g()])]),L=()=>l.and([o(),u()]),m=()=>l.and([l.and(l.moves(["F","R"])),g()]),d=()=>l.and([l.and(l.moves(["F","R"])),p(),l.not(o())]),F=()=>l.or([d(),m()]);function A(){n.set(f(),"Dim")}function U(){n.set(o(),"PermuteNonPrimary"),n.set(L(),"Dim")}function x(){n.set(o(),"IgnoreNonPrimary"),n.set(L(),"Regular")}function b(){n.set(o(),"Ignoriented"),n.set(L(),"Dim")}switch(t){case"full":break;case"PLL":A(),U();break;case"CLS":A(),n.set(d(),"Regular"),n.set(o(),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),p()]),"IgnoreNonPrimary");break;case"OLL":A(),x();break;case"COLL":A(),n.set(l.and([o(),g()]),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),p()]),"Regular");break;case"OCLL":A(),b(),n.set(l.and([o(),p()]),"IgnoreNonPrimary");break;case"CLL":A(),n.set(l.not(l.and([p(),o()])),"Dim");break;case"ELL":A(),n.set(o(),"Dim"),n.set(l.and([o(),g()]),"Regular");break;case"ELS":A(),x(),n.set(l.and([o(),p()]),"Ignored"),n.set(m(),"Regular"),n.set(d(),"Ignored");break;case"LL":A();break;case"F2L":n.set(o(),"Ignored");break;case"ZBLL":A(),n.set(o(),"PermuteNonPrimary"),n.set(L(),"Dim"),n.set(l.and([o(),p()]),"Regular");break;case"ZBLS":A(),n.set(F(),"Regular"),x(),n.set(l.and([o(),p()]),"Ignored");break;case"VLS":A(),n.set(F(),"Regular"),x();break;case"WVLS":A(),n.set(F(),"Regular"),n.set(l.and([o(),g()]),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),p()]),"IgnoreNonPrimary");break;case"LS":A(),n.set(F(),"Regular"),n.set(o(),"Ignored"),n.set(L(),"Dim");break;case"EO":n.set(p(),"Ignored"),n.set(g(),"OrientationWithoutPermutation");break;case"EOline":n.set(p(),"Ignored"),n.set(g(),"OrientationWithoutPermutation"),n.set(l.and(l.moves(["D","M"])),"Regular");break;case"EOcross":n.set(g(),"OrientationWithoutPermutation"),n.set(l.move("D"),"Regular"),n.set(p(),"Ignored");break;case"CMLL":n.set(f(),"Dim"),n.set(c(),"Ignored"),n.set(l.and([o(),p()]),"Regular");break;case"L10P":n.set(l.not(c()),"Dim"),n.set(l.and([p(),o()]),"Regular");break;case"L6E":n.set(l.not(c()),"Dim");break;case"L6EO":n.set(l.not(c()),"Dim"),n.set(c(),"OrientationWithoutPermutation"),n.set(l.and([u(),i()]),"OrientationStickers");break;case"Daisy":n.set(l.all(),"Ignored"),n.set(u(),"Dim"),n.set(l.and([l.move("D"),u()]),"Regular"),n.set(l.and([l.move("U"),g()]),"IgnoreNonPrimary");break;case"Cross":n.set(l.all(),"Ignored"),n.set(u(),"Dim"),n.set(l.and([l.move("D"),u()]),"Regular"),n.set(l.and([l.move("D"),g()]),"Regular");break;case"2x2x2":n.set(l.or(l.moves(["U","F","R"])),"Ignored"),n.set(l.and([l.or(l.moves(["U","F","R"])),u()]),"Dim");break;case"2x2x3":n.set(l.all(),"Dim"),n.set(l.or(l.moves(["U","F","R"])),"Ignored"),n.set(l.and([l.or(l.moves(["U","F","R"])),u()]),"Dim"),n.set(l.and([l.move("F"),l.not(l.or(l.moves(["U","R"])))]),"Regular");break;case"Void Cube":n.set(u(),"Invisible");break;case"picture":case"invisible":n.set(l.all(),"Invisible");break;case"centers-only":n.set(l.not(u()),"Ignored");break;default:console.warn(\`Unsupported stickering for \${e.id}: \${t}. Setting all pieces to dim.\`),n.set(l.and(l.moves([])),"Dim")}return n.toAppearance()}async function Wn(){let e=[];for(let[t,r]of Object.entries(ls))r.groups&&"3x3x3"in r.groups&&e.push(t);return e}var Vl=y(()=>{"use strict";ni();os()});function de(e){let t=null;return()=>t??(t=e())}var Et=y(()=>{"use strict"});var Kn,pf=y(()=>{"use strict";Kn=class{constructor(t,r){this.facenames=t;this.prefixFree=!0;this.gripnames=[];r&&(this.gripnames=r);for(let n=0;this.prefixFree&&n<t.length;n++)for(let l=0;this.prefixFree&&l<t.length;l++)n!==l&&t[n].startsWith(t[l])&&(this.prefixFree=!1)}setGripNames(t){this.gripnames=t}splitByFaceNames(t){let r=[],n=0;for(;n<t.length;){n>0&&n<t.length&&t[n]==="_"&&n++;let l=-1;for(let o=0;o<this.facenames.length;o++)t.substr(n).startsWith(this.facenames[o])&&(l<0||this.facenames[o].length>this.facenames[l].length)&&(l=o);if(l>=0)r.push(l),n+=this.facenames[l].length;else throw new Error("Could not split "+t+" into face names.")}return r}joinByFaceIndices(t){let r="",n=[];for(let l=0;l<t.length;l++)n.push(r),n.push(this.facenames[t[l]]),this.prefixFree||(r="_");return n.join("")}spinmatch(t,r){if(t===r)return!0;try{let n=this.splitByFaceNames(t),l=this.splitByFaceNames(r);if(n.length!==l.length&&n.length<3)return!1;for(let o=0;o<n.length;o++){for(let s=0;s<o;s++)if(n[o]===n[s])return!1;let i=!1;for(let s=0;s<l.length;s++)if(n[o]===l[s]){i=!0;break}if(!i)return!1}return!0}catch{return!1}}spinmatchv(t,r){return t.endsWith("v")&&r.endsWith("v")?this.spinmatch(t.slice(0,t.length-1),r.slice(0,r.length-1)):this.spinmatch(t,r)}unswizzle(t){(t.endsWith("v")||t.endsWith("w"))&&t[0]<="Z"&&(t=t.slice(0,t.length-1));let r=t.toUpperCase();for(let n=0;n<this.gripnames.length;n++){let l=this.gripnames[n];if(this.spinmatch(r,l))return l}return t}}});var nn,cf=y(()=>{"use strict";nn=class{notationToInternal(t){return t}notationToExternal(t){return t}}});var Hl,mf=y(()=>{"use strict";Be();Hl=class{constructor(t,r){this.child=t;this.sw=r}notationToInternal(t){return t.family==="T"&&t.innerLayer===void 0&&t.outerLayer===void 0?new B(new z("FLRv",t.innerLayer,t.outerLayer),t.amount):this.child.notationToInternal(t)}notationToExternal(t){let r=t.family;return r.length>0&&r[r.length-1]==="v"&&(r=r.substring(0,r.length-1)),this.sw.spinmatch(r,"FLUR")?new B(new z("T",t.innerLayer,t.outerLayer),t.amount):this.child.notationToExternal(t)}}});var Qn,Lf=y(()=>{"use strict";Be();Qn=class{constructor(t,r){this.internalNames=t;this.externalNames=r}convertString(t,r,n){let l="";(t.endsWith("v")||t.endsWith("v"))&&t<="_"&&(l=t.slice(t.length-1),t=t.slice(0,t.length-1));let o=t.toUpperCase(),i=!1;return t!==o&&(i=!0,t=o),t=n.joinByFaceIndices(r.splitByFaceNames(t)),i&&(t=t.toLowerCase()),t+l}convert(t,r,n){let l=t.family,o=this.convertString(l,r,n);return l===o?t:new B(new z(o,t.innerLayer,t.outerLayer),t.amount)}notationToInternal(t){return this.convert(t,this.externalNames,this.internalNames)}notationToExternal(t){return this.convert(t,this.internalNames,this.externalNames)}}});var Zl,Bf=y(()=>{"use strict";Be();Zl=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer===void 0&&t.outerLayer===void 0){if(Math.abs(t.amount)===1){if(t.family==="R++")return new B(new z("L",3,2),-2*t.amount);if(t.family==="R--")return new B(new z("L",3,2),2*t.amount);if(t.family==="D++")return new B(new z("U",3,2),-2*t.amount);if(t.family==="D--")return new B(new z("U",3,2),2*t.amount);if(t.family==="R_PLUSPLUS_")return new B(new z("L",3,2),-2*t.amount);if(t.family==="D_PLUSPLUS_")return new B(new z("U",3,2),-2*t.amount)}if(t.family==="y")return new B("Uv",t.amount);if(t.family==="x"&&Math.abs(t.amount)===2)return new B("ERv",t.amount/2)}return this.child.notationToInternal(t)}notationToExternal(t){return t.family==="ERv"&&Math.abs(t.amount)===1?new B(new z("x",t.innerLayer,t.outerLayer),t.amount*2):t.family==="ILv"&&Math.abs(t.amount)===1?new B(new z("x",t.innerLayer,t.outerLayer),-t.amount*2):t.family==="Uv"?new B(new z("y",t.innerLayer,t.outerLayer),t.amount):t.family==="Dv"?new B("y",-t.amount):this.child.notationToExternal(t)}}});var Jl,df=y(()=>{"use strict";Be();Jl=class{constructor(t){this.slices=t}notationToInternal(t){let r=t.family;return!t.innerLayer&&!t.outerLayer&&(r==="x"?t=new B("Rv",t.amount):r==="y"?t=new B("Uv",t.amount):r==="z"&&(t=new B("Fv",t.amount)),(this.slices&1)===1&&(r==="E"?t=new B(new z("D",(this.slices+1)/2),t.amount):r==="M"?t=new B(new z("L",(this.slices+1)/2),t.amount):r==="S"&&(t=new B(new z("F",(this.slices+1)/2),t.amount))),this.slices>2&&(r==="e"?t=new B(new z("D",this.slices-1,2),t.amount):r==="m"?t=new B(new z("L",this.slices-1,2),t.amount):r==="s"&&(t=new B(new z("F",this.slices-1,2),t.amount)))),t}notationToExternal(t){let r=t.family;if(!t.innerLayer&&!t.outerLayer){if(r==="Rv")return new B("x",t.amount);if(r==="Uv")return new B("y",t.amount);if(r==="Fv")return new B("z",t.amount);if(r==="Lv")return new B("x",-t.amount);if(r==="Dv")return new B("y",-t.amount);if(r==="Bv")return new B("z",-t.amount)}return t}}});var sL,aL,Rf,hf,Ff,jn,Yl,Df=y(()=>{"use strict";Be();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"},aL={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"},Rf={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},hf=new z("y"),Ff=new z("Dv"),jn=class{constructor(t){this.child=t;this.wcaHack=!1;this.map=sL}notationToInternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){let n=Rf[t.family];if(n)return new B(new z(n,t.innerLayer,t.outerLayer),t.amount)}let r=this.map[t.family];return r?new B(new z(r,t.innerLayer,t.outerLayer),t.amount):hf.isIdentical(t.quantum)?new B(Ff,-t.amount):null}notationToExternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){for(let[r,n]of Object.entries(Rf))if(this.child.spinmatch(t.family,n))return new B(new z(r,t.innerLayer,t.outerLayer),t.amount)}for(let[r,n]of Object.entries(this.map))if(this.child.spinmatch(t.family,n))return new B(new z(r,t.innerLayer,t.outerLayer),t.amount);return Ff.isIdentical(t.quantum)?new B(hf,-t.amount):null}},Yl=class extends jn{constructor(r){super(r);this.wcaHack=!0;this.map=aL}}});var Af,is,yf,fL,ss,Uf,uL,as,Sf,gL,Xl,xf=y(()=>{"use strict";Be();Af={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"},is=new z("x"),yf=new z("Rv"),fL=new z("Lv"),ss=new z("y"),Uf=new z("Uv"),uL=new z("Dv"),as=new z("z"),Sf=new z("Fv"),gL=new z("Bv"),Xl=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer||t.outerLayer)return null;let r=Af[t.family];return r?new B(new z(r,t.outerLayer,t.innerLayer),t.amount):is.isIdentical(t.quantum)?new B(yf,t.amount):ss.isIdentical(t.quantum)?new B(Uf,t.amount):as.isIdentical(t.quantum)?new B(Sf,t.amount):null}notationToExternal(t){for(let[r,n]of Object.entries(Af))if(this.child.spinmatchv(t.family,n))return new B(new z(r,t.innerLayer,t.outerLayer),t.amount);return yf.isIdentical(t.quantum)?new B(is,t.amount):fL.isIdentical(t.quantum)?new B(is,-t.amount):Uf.isIdentical(t.quantum)?new B(ss,t.amount):uL.isIdentical(t.quantum)?new B(ss,-t.amount):Sf.isIdentical(t.quantum)?new B(as,t.amount):gL.isIdentical(t.quantum)?new B(as,-t.amount):null}}});var fs=y(()=>{"use strict";cf();mf();Lf();Bf();df();Df();xf()});function bf(e){let t=0,r={};for(;t<e.length&&e[t][0]==="-";){let l=e[t++];if(l==="--rotations")r.addRotations=!0;else if(l==="--allmoves")r.allMoves=!0;else if(l==="--outerblockmoves")r.outerBlockMoves=!0;else if(l==="--vertexmoves")r.vertexMoves=!0;else if(l==="--nocorners")r.includeCornerOrbits=!1;else if(l==="--noedges")r.includeEdgeOrbits=!1;else if(l==="--noorientation")r.fixedOrientation=!0;else if(l==="--nocenters")r.includeCenterOrbits=!1;else if(l==="--omit")r.excludeOrbits=e[t].split(","),t++;else if(l==="--moves")r.moveList=e[t].split(","),t++;else if(l==="--optimize")r.optimizeOrbits=!0;else if(l==="--scramble")r.scrambleAmount=100;else if(l==="--fixcorner")r.fixedPieceType="v";else if(l==="--fixedge")r.fixedPieceType="e";else if(l==="--fixcenter")r.fixedPieceType="f";else if(l==="--orientcenters")r.orientCenters=!0;else if(l==="--puzzleorientation")r.puzzleOrientation=JSON.parse(e[t]),t++;else throw new Error("Bad option: "+l)}return{puzzleDescription:$l(e.slice(t).join(" ")),options:r}}var li,us=y(()=>{"use strict";eo();li=class{constructor(t={}){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,t)}}});function Dr(e){if(!gs[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=0;gs[e]=t}return gs[e]}function Wt(e){if(!ps[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;ps[e]=t}return ps[e]}function wf(e){return new Bt(Wt(e))}function Ef(e){let t=1n;for(;e>1;)t*=BigInt(e),e--;return t}function pL(e,t){if(e>t){let r=e;e=t,t=r}for(;e>0;){let r=t%e;t=e,e=r}return t}function cs(e,t){return e/pL(e,t)*t}var gs,ps,Bt,oi=y(()=>{"use strict";gs=[],ps=[];Bt=class{constructor(t){this.n=t.length,this.p=t}toString(){return"Perm["+this.p.join(" ")+"]"}mul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=t.p[this.p[n]];return new Bt(r)}rmul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=this.p[t.p[n]];return new Bt(r)}inv(){let t=Array(this.n);for(let r=0;r<this.n;r++)t[this.p[r]]=r;return new Bt(t)}compareTo(t){for(let r=0;r<this.n;r++)if(this.p[r]!==t.p[r])return this.p[r]-t.p[r];return 0}toGap(){let t=new Array,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=new Array;for(let o=n;!r[o];o=this.p[o])l.push(1+o),r[o]=!0;t.push("("+l.join(",")+")")}return t.join("")}order(){let t=1,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=0;for(let o=n;!r[o];o=this.p[o])l++,r[o]=!0;t=cs(t,l)}return t}}});function ii(e,t){let r=B.fromString(t),n=e.notationToExternal(r);return n===null||r===n?t:n.toString()}function vf(e,t){let r=e.moveops.length;if(r>30)throw new Error("Canon info too big for bitmask");let n=[],l=[];for(let i=0;i<r;i++){let s=e.moveops[i];n.push(s.order());let a=0;for(let f=0;f<r;f++){if(f===i)continue;let u=e.moveops[f];s.mul(u).equal(u.mul(s))&&(a|=1<<f)}l.push(a)}let o={};o[0]=1;for(let i=0;i<100;i++){let s=0,a={},f=0;for(let u in o){let g=+u,p=o[g];s+=p,f++;for(let c=0;c<n.length;c++)if((g>>c&1)===0&&(g&l[c]&(1<<c)-1)===0){let L=g&l[c]|1<<c;a[L]===void 0&&(a[L]=0),a[L]+=(n[c]-1)*p}}t(\`\${i}: canonseq \${s} states \${f}\`),o=a}}var qn,cL,ln,vt,Kt,si,tr,on,ai,_f=y(()=>{"use strict";Be();fs();oi();qn=class{constructor(t,r){this.size=t;this.mod=r}reassemblySize(){return Ef(this.size)*BigInt(this.mod)**BigInt(this.size)}},cL=0;ln=class{constructor(t,r,n,l,o,i,s){this.orbitnames=t;this.orbitdefs=r;this.solved=n;this.movenames=l;this.moveops=o;this.isRotation=i;this.forcenames=s}transformToKTransformationData(t){let r={};for(let n=0;n<this.orbitnames.length;n++)r[this.orbitnames[n]]=t.orbits[n].toKPuzzle();return r}static transformToKTransformationData(t,r){let n={};for(let l=0;l<t.length;l++)n[t[l]]=r.orbits[l].toKPuzzle();return n}describeSet(t,r,n){let l=this.orbitdefs[t].size,o=new Array(l);for(let i=0;i<l;i++)o[i]=[];for(let i=0;i<this.movenames.length;i++){if(this.isRotation[i])continue;let s=this.movenames[i];this.forcenames[i]||(s=ii(n,s),s[s.length-1]==="'"&&(s=s.substring(0,s.length-1)));let a=this.moveops[i].orbits[t];for(let f=0;f<l;f++)(a.perm[f]!=f||a.ori[f]!=0)&&o[f].push(s)}for(let i=0;i<l;i++)r.push("# "+(i+1)+" "+o[i].join(" "))}toKsolve(t,r=new nn){let n=[];n.push("Name "+t),n.push("");for(let l=0;l<this.orbitnames.length;l++)n.push(\`Set \${this.orbitnames[l]} \${this.orbitdefs[l].size} \${this.orbitdefs[l].mod}\`),this.describeSet(l,n,r);n.push(""),n.push("Solved");for(let l=0;l<this.orbitnames.length;l++)this.solved.orbits[l].appendDefinition(n,this.orbitnames[l],!1,!1);n.push("End");for(let l=0;l<this.movenames.length;l++){n.push("");let o=this.movenames[l];this.forcenames[l]||(o=ii(r,this.movenames[l]));let i=!1;o[o.length-1]==="'"&&(i=!0,o=o.substring(0,o.length-1)),n.push("Move "+o);for(let s=0;s<this.orbitnames.length;s++)i?this.moveops[l].orbits[s].inv().appendDefinition(n,this.orbitnames[s],!0):this.moveops[l].orbits[s].appendDefinition(n,this.orbitnames[s],!0);n.push("End")}return n}toKPuzzleDefinition(t){let r={},n={};for(let o=0;o<this.orbitnames.length;o++){r[this.orbitnames[o]]={numPieces:this.orbitdefs[o].size,numOrientations:this.orbitdefs[o].mod};let i=this.solved.orbits[o].toKPuzzle();n[this.orbitnames[o]]={pieces:i.permutation,orientation:i.orientation}}let l={};if(t)for(let o=0;o<this.movenames.length;o++)l[this.movenames[o]]=this.transformToKTransformationData(this.moveops[o]);return{name:\`PG3D #\${++cL}\`,orbits:r,startStateData:n,moves:l}}optimize(){let t=[],r=[],n=[],l=[];for(let o=0;o<this.moveops.length;o++)l.push([]);for(let o=0;o<this.orbitdefs.length;o++){let i=this.orbitdefs[o].mod,s=this.orbitdefs[o].size,a=new ai(s),f=new Array(this.orbitdefs[o].size);for(let c=0;c<s;c++)f[c]=!1;for(let c=0;c<this.moveops.length;c++)if(!this.isRotation[c])for(let L=0;L<s;L++)(this.moveops[c].orbits[o].perm[L]!==L||this.moveops[c].orbits[o].ori[L]!==0)&&(f[L]=!0,a.union(L,this.moveops[c].orbits[o].perm[L]));let u=!0;if(i>1){u=!1;let c=new ai(this.orbitdefs[o].size*i);for(let L=0;L<this.moveops.length;L++)for(let m=0;m<s;m++)if(this.moveops[L].orbits[o].perm[m]!==m||this.moveops[L].orbits[o].ori[m]!==0)for(let d=0;d<i;d++)c.union(m*i+d,this.moveops[L].orbits[o].perm[m]*i+(d+this.moveops[L].orbits[o].ori[m])%i);for(let L=0;!u&&L<s;L++)for(let m=1;m<i;m++)c.find(L*i)===c.find(L*i+m)&&(u=!0);for(let L=0;!u&&L<s;L++)for(let m=0;m<L;m++)this.solved.orbits[o].perm[L]===this.solved.orbits[o].perm[m]&&(u=!0)}let g=-1,p=!1;for(let c=0;c<this.orbitdefs[o].size;c++)if(f[c]){let L=a.find(c);g<0?g=L:g!==L&&(p=!0)}for(let c=0;c<this.orbitdefs[o].size;c++){if(!f[c]||a.find(c)!==c)continue;let m=[],d=[],F=0;for(let A=0;A<this.orbitdefs[o].size;A++)a.find(A)===c&&(m[F]=A,d[A]=F,F++);if(p?t.push(\`\${this.orbitnames[o]}_p\${c}\`):t.push(this.orbitnames[o]),u){r.push(new qn(F,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(m,F));for(let A=0;A<this.moveops.length;A++)l[A].push(this.moveops[A].orbits[o].remap(m,d,F))}else{r.push(new qn(F,1)),n.push(this.solved.orbits[o].remapVS(m,F).killOri());for(let A=0;A<this.moveops.length;A++)l[A].push(this.moveops[A].orbits[o].remap(m,d,F).killOri())}}}return new ln(t,r,new on(n),this.movenames,l.map(o=>new tr(o)),this.isRotation,this.forcenames)}scramble(t){this.solved=this.solved.mul(this.getScrambleTransformation(t))}getScrambleTransformation(t){t<100&&(t=100);let r=[];for(let l=0;l<this.moveops.length;l++)r[l]=this.moveops[l];for(let l=0;l<r.length;l++){let o=Math.floor(Math.random()*r.length),i=r[l];r[l]=r[o],r[o]=i}t<r.length&&(t=r.length);for(let l=0;l<t;l++){let o=Math.floor(Math.random()*r.length),i=Math.floor(Math.random()*r.length),s=Math.floor(Math.random()*this.moveops.length);r[o]=r[o].mul(r[i]).mul(this.moveops[s]),Math.random()<.1&&(r[o]=r[o].mul(this.moveops[s]))}let n=r[0];for(let l=1;l<r.length;l++)n=n.mul(r[l]);return n}reassemblySize(){let t=1n;for(let r=0;r<this.orbitdefs.length;r++)t*=this.orbitdefs[r].reassemblySize();return t}},vt=class{constructor(t,r,n){this.perm=t;this.ori=r;this.orimod=n}static e(t,r){return new vt(Wt(t),Dr(t),r)}mul(t){let r=this.perm.length,n=new Array(r);if(this.orimod===1){for(let l=0;l<r;l++)n[l]=this.perm[t.perm[l]];return new vt(n,this.ori,this.orimod)}else{let l=new Array(r);for(let o=0;o<r;o++)n[o]=this.perm[t.perm[o]],l[o]=(this.ori[t.perm[o]]+t.ori[o])%this.orimod;return new vt(n,l,this.orimod)}}inv(){let t=this.perm.length,r=new Array(t),n=new Array(t);for(let l=0;l<t;l++)r[this.perm[l]]=l,n[this.perm[l]]=(this.orimod-this.ori[l])%this.orimod;return new vt(r,n,this.orimod)}equal(t){let r=this.perm.length;for(let n=0;n<r;n++)if(this.perm[n]!==t.perm[n]||this.ori[n]!==t.ori[n])return!1;return!0}killOri(){let t=this.perm.length;for(let r=0;r<t;r++)this.ori[r]=0;return this.orimod=1,this}toPerm(){let t=this.orimod;if(t===1)return new Bt(this.perm);let r=this.perm.length,n=new Array(r*t);for(let l=0;l<r;l++)for(let o=0;o<t;o++)n[l*t+o]=t*this.perm[l]+(this.ori[l]+o)%t;return new Bt(n)}identicalPieces(){let t=[],r=this.perm.length,n=[];for(let l=0;l<r;l++){let o=this.perm[l];if(t[o]===void 0){let i=[l];t[o]=!0;for(let s=l+1;s<r;s++)this.perm[s]===o&&i.push(s);n.push(i)}}return n}order(){return this.toPerm().order()}isIdentity(){let t=this.perm.length;if(this.perm===Wt(t)&&this.ori===Dr(t))return!0;for(let r=0;r<t;r++)if(this.perm[r]!==r||this.ori[r]!==0)return!1;return!0}zeroOris(){let t=this.perm.length;if(this.ori===Dr(t))return!0;for(let r=0;r<t;r++)if(this.ori[r]!==0)return!1;return!0}remap(t,r,n){let l=new Array(n),o=new Array(n);for(let i=0;i<n;i++)l[i]=r[this.perm[t[i]]],o[i]=this.ori[t[i]];return new vt(l,o,this.orimod)}remapVS(t,r){let n=new Array(r),l=new Array(r),o=0,i=[];for(let s=0;s<r;s++){let a=this.perm[t[s]];i[a]===void 0&&(i[a]=o++),n[s]=i[a],l[s]=this.ori[t[s]]}return new vt(n,l,this.orimod)}appendDefinition(t,r,n,l=!0){if(!(l&&this.isIdentity())&&(t.push(r),t.push(this.perm.map(o=>o+1).join(" ")),!this.zeroOris()))if(n){let o=new Array(this.ori.length);for(let i=0;i<o.length;i++)o[this.perm[i]]=this.ori[i];t.push(o.join(" "))}else t.push(this.ori.join(" "))}toKPuzzle(){let t=this.perm.length;return this.isIdentity()?(vt.kcache[t]||(vt.kcache[t]={permutation:Wt(t),orientation:Dr(t)}),vt.kcache[t]):{permutation:this.perm,orientation:this.ori}}},Kt=vt;Kt.kcache=[];si=class{constructor(t){this.orbits=t}internalMul(t){let r=[];for(let n=0;n<this.orbits.length;n++)r.push(this.orbits[n].mul(t.orbits[n]));return r}internalInv(){let t=[];for(let r of this.orbits)t.push(r.inv());return t}equal(t){for(let r=0;r<this.orbits.length;r++)if(!this.orbits[r].equal(t.orbits[r]))return!1;return!0}killOri(){for(let t of this.orbits)t.killOri();return this}toPerm(){let t=new Array,r=0;for(let l of this.orbits){let o=l.toPerm();t.push(o),r+=o.n}let n=new Array(r);r=0;for(let l of t){for(let o=0;o<l.n;o++)n[r+o]=r+l.p[o];r+=l.n}return new Bt(n)}identicalPieces(){let t=[],r=0;for(let n of this.orbits){let l=n.orimod,o=n.identicalPieces();for(let i=0;i<o.length;i++)t.push(o[i].map(s=>s*l+r));r+=l*n.perm.length}return t}order(){let t=1;for(let r of this.orbits)t=cs(t,r.order());return t}},tr=class extends si{constructor(t){super(t)}mul(t){return new tr(this.internalMul(t))}mulScalar(t){if(t===0)return this.e();let r=this;for(t<0&&(r=r.inv(),t=-t);(t&1)===0;)r=r.mul(r),t>>=1;if(t===1)return r;let n=r,l=this.e();for(;t>0;)t&1&&(l=l.mul(n)),t>1&&(n=n.mul(n)),t>>=1;return l}inv(){return new tr(this.internalInv())}e(){return new tr(this.orbits.map(t=>Kt.e(t.perm.length,t.orimod)))}},on=class extends si{constructor(t){super(t)}mul(t){return new on(this.internalMul(t))}},ai=class{constructor(t){this.n=t;this.heads=new Array(t);for(let r=0;r<t;r++)this.heads[r]=r}find(t){let r=this.heads[t];return this.heads[r]===r||(r=this.find(this.heads[r]),this.heads[t]=r),r}union(t,r){let n=this.find(t),l=this.find(r);n<l?this.heads[l]=n:n>l&&(this.heads[n]=l)}}});var fi,kf=y(()=>{"use strict";fi={"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 ui(e){let t=new W(0,0,0,0);for(let r=0;r<e.length;r++)t=t.sum(e[r]);return t.smul(1/e.length)}function zf(e,t,r,n){let l=n[e].intersect3(n[t],n[r]);if(!l)return l;for(let o=0;o<n.length;o++)if(o!==e&&o!==t&&o!==r){let i=n[o].b*l.b+n[o].c*l.c+n[o].d*l.d;if(n[o].a>0&&i>n[o].a||n[o].a<0&&i<n[o].a)return!1}return l}var W,gi=y(()=>{"use strict";W=class{constructor(t,r,n,l){this.a=t;this.b=r;this.c=n;this.d=l}mul(t){return new W(this.a*t.a-this.b*t.b-this.c*t.c-this.d*t.d,this.a*t.b+this.b*t.a+this.c*t.d-this.d*t.c,this.a*t.c-this.b*t.d+this.c*t.a+this.d*t.b,this.a*t.d+this.b*t.c-this.c*t.b+this.d*t.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(t){return Math.hypot(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(t){return new W(0,this.c*t.d-this.d*t.c,this.d*t.b-this.b*t.d,this.b*t.c-this.c*t.b)}dot(t){return this.b*t.b+this.c*t.c+this.d*t.d}normalize(){let t=Math.sqrt(this.dot(this));return new W(this.a/t,this.b/t,this.c/t,this.d/t)}makenormal(){return new W(0,this.b,this.c,this.d).normalize()}normalizeplane(){let t=Math.hypot(this.b,this.c,this.d);return new W(this.a/t,this.b/t,this.c/t,this.d/t)}smul(t){return new W(this.a*t,this.b*t,this.c*t,this.d*t)}sum(t){return new W(this.a+t.a,this.b+t.b,this.c+t.c,this.d+t.d)}sub(t){return new W(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new W(this.a,-this.b,-this.c,-this.d)}det3x3(t,r,n,l,o,i,s,a,f){return t*(o*f-i*a)+r*(i*s-l*f)+n*(l*a-o*s)}rotateplane(t){let r=t.mul(new W(0,this.b,this.c,this.d)).mul(t.invrot());return r.a=this.a,r}orthogonal(){let t=Math.abs(this.b),r=Math.abs(this.c),n=Math.abs(this.d);return t<r&&t<n?this.cross(new W(0,1,0,0)).normalize():r<t&&r<n?this.cross(new W(0,0,1,0)).normalize():this.cross(new W(0,0,0,1)).normalize()}pointrotation(t){let r=this.normalize();if(t=t.normalize(),r.sub(t).len()<1e-9)return new W(1,0,0,0);let n=r.sum(t);n.len()<1e-9?n=n.orthogonal():n=n.normalize();let l=r.cross(n);return l.a=r.dot(n),l}unproject(t){return this.sum(t.smul(-this.dot(t)/(this.len()*t.len())))}rotatepoint(t){return t.mul(this).mul(t.invrot())}rotateface(t){return t.map(r=>r.rotatepoint(this))}intersect3(t,r){let n=this.det3x3(this.b,this.c,this.d,t.b,t.c,t.d,r.b,r.c,r.d);return Math.abs(n)<1e-9?!1:new W(0,this.det3x3(this.a,this.c,this.d,t.a,t.c,t.d,r.a,r.c,r.d)/n,this.det3x3(this.b,this.a,this.d,t.b,t.a,t.d,r.b,r.a,r.d)/n,this.det3x3(this.b,this.c,this.a,t.b,t.c,t.a,r.b,r.c,r.a)/n)}side(t){return t>1e-9?1:t<-1e-9?-1:0}cutface(t){let r=this.a,n=0,l=null;for(let o=0;o<t.length;o++)n|=1<<this.side(t[o].dot(this)-r)+1;if((n&5)===5){l=[];let o=t.map(i=>this.side(i.dot(this)-r));for(let i=-1;i<=1;i+=2){let s=[];for(let a=0;a<t.length;a++){(o[a]===i||o[a]===0)&&s.push(t[a]);let f=(a+1)%t.length;if(o[a]+o[f]===0&&o[a]!==0){let u=t[a].dot(this)-r,g=t[f].dot(this)-r,p=u/(u-g),c=t[a].smul(1-p).sum(t[f].smul(p));s.push(c)}}l.push(s)}}return l}cutfaces(t){let r=[];for(let n=0;n<t.length;n++){let l=t[n],o=this.cutface(l);o?(r.push(o[0]),r.push(o[1])):r.push(l)}return r}faceside(t){let r=this.a;for(let n=0;n<t.length;n++){let l=this.side(t[n].dot(this)-r);if(l!==0)return l}throw new Error("Could not determine side of plane in faceside")}sameplane(t){let r=this.normalize(),n=t.normalize();return r.dist(n)<1e-9||r.dist(n.smul(-1))<1e-9}makecut(t){return new W(t,this.b,this.c,this.d)}}});function Cf(){let e=Math.sqrt(.5);return[new W(e,e,0,0),new W(e,0,e,0)]}function Pf(){return[new W(.5,.5,.5,.5),new W(.5,.5,.5,-.5)]}function Nf(){let e=2*Math.PI/10,t=.5+.3*Math.sqrt(5),r=.5+.1*Math.sqrt(5),n=Math.sqrt(t*t+r*r);return t/=n,r/=n,[new W(Math.cos(e),t*Math.sin(e),r*Math.sin(e),0),new W(.5,.5,.5,.5)]}function Mf(){let e=.16666666666666666+Math.sqrt(5)/6,t=2/3+Math.sqrt(5)/3,r=Math.sqrt(e*e+t*t);e/=r,t/=r;let n=2*Math.PI/6;return[new W(Math.cos(n),e*Math.sin(n),t*Math.sin(n),0),new W(Math.cos(n),-e*Math.sin(n),t*Math.sin(n),0)]}function Gf(){let e=Math.sqrt(.5);return[new W(.5,.5,.5,.5),new W(e,0,0,e)]}function Of(e){let t=[new W(1,0,0,0)];for(let r=0;r<t.length;r++)for(let n=0;n<e.length;n++){let l=e[n].mul(t[r]),o=l.smul(-1),i=!1;for(let s=0;s<t.length;s++)if(l.dist(t[s])<pi||o.dist(t[s])<pi){i=!0;break}i||t.push(l)}return t}function ms(e,t){let r=[],n=[];for(let l=0;l<t.length;l++){let o=e.rotateplane(t[l]),i=!1;for(let s=0;s<r.length;s++)if(o.dist(r[s])<pi){i=!0;break}i||(r.push(o),n.push(t[l]))}return n}function Ls(e){let t=[];for(let r=1;r<e.length;r++)for(let n=r+1;n<e.length;n++){let l=zf(0,r,n,e);if(l){let o=!1;for(let i=0;i<t.length;i++)if(l.dist(t[i])<pi){o=!0;break}o||t.push(l)}}for(;;){let r=!1;for(let n=0;n<t.length;n++){let l=(n+1)%t.length;if(e[0].dot(t[n].cross(t[l]))<0){let o=t[n];t[n]=t[l],t[l]=o,r=!0}}if(!r)break}return t}var pi,Tf=y(()=>{"use strict";gi();pi=1e-9});function ci(e,t){let r=e[0].p.length,n=wf(r),l=[],o=[],i=[],s=[],a=[];function f(c){for(let L=c.p.length-1;L>=0;L--){let m=c.p[L];if(m!==L){if(!l[L][m])return!1;c=c.mul(o[L][m])}}return!0}function u(c,L,m){s[c].push(L),a[c].push(m);for(let d=0;d<l[c].length;d++)l[c][d]&&g(c,l[c][d].mul(L),m+i[c][d])}function g(c,L,m){let d=L.p[c];if(!l[c][d]){l[c][d]=L,o[c][d]=L.inv(),i[c][d]=m;for(let A=0;A<s[c].length;A++)g(c,L.mul(s[c][A]),m+a[c][A]);return}let F=L.mul(o[c][d]);f(F)||u(c-1,F,m+i[c][d])}function p(){l=[],o=[],s=[],i=[],a=[];for(let m=0;m<r;m++)l.push([]),o.push([]),i.push([]),s.push([]),a.push([]),l[m][m]=n,o[m][m]=n,i[m][m]=0;let c=0,L=1n;for(let m=0;m<e.length;m++){u(r-1,e[m],1),L=1n;let d=0,F=0,A=[],U=new Bs;for(let x=0;x<r;x++){let b=0,N=0;for(let C=0;C<r;C++)l[x][C]&&(b++,N+=i[x][C],x!==C&&c++);d+=s[x].length,L*=BigInt(b),b>1&&U.multiply(b);let J=N/b;A.push(J),F+=J}t(\`\${m}: sz \${L} T \${d} sol \${F} none \${c} mults \${U.toString()}\`)}return L}return p()}var Bs,ds=y(()=>{"use strict";oi();Bs=class{constructor(){this.mult=[]}multiply(t){for(let r=2;r*r<=t;r++)for(;t%r===0;)this.mult[r]!==void 0?this.mult[r]++:this.mult[r]=1,t/=r;t>1&&(this.mult[t]!==void 0?this.mult[t]++:this.mult[t]=1)}toString(){let t="";for(let r=0;r<this.mult.length;r++)this.mult[r]!==void 0&&(t!==""&&(t+="*"),t+=r,this.mult[r]>1&&(t+=\`^\${this.mult[r]}\`));return t}}});function mL(e,t){let r=[];for(let n of e)for(let l of t)r.push(l.rotate(n));return r}function dL(){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 RL(){return{4:{F:"#00ff00",D:"#ffff00",L:"#ff0000",R:"#0000ff"},6:{U:"#ffffff",F:"#00ff00",R:"#ff0000",D:"#ffff00",B:"#0000ff",L:"#ff8000"},8:{U:"#ffffff",F:"#ff0000",R:"#00bb00",D:"#ffff00",BB:"#1122ff",L:"#9524c5",BL:"#ff8800",BR:"#aaaaaa"},12:{U:"#ffffff",F:"#006633",R:"#ff0000",C:"#ffffd0",A:"#3399ff",L:"#660099",E:"#ff66cc",BF:"#99ff00",BR:"#0000ff",BL:"#ffff00",I:"#ff6633",D:"#999999"},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 FL(){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 mi(e,t){for(let r=0;r<e.length;r++)if(e[r][0].dist(t)<we)return r;throw new Error("Element not found")}function If(){return fi}function Wf(e){return fi[e]}function $l(e){let t=e.split(/ /).filter(Boolean);if(t.length%2===0)return null;let r=t[0];if(r!=="o"&&r!=="c"&&r!=="i"&&r!=="d"&&r!=="t")return null;let n=[];for(let l=1;l<t.length;l+=2){if(t[l]!=="f"&&t[l]!=="v"&&t[l]!=="e")return null;n.push({cutType:t[l],distance:parseFloat(t[l+1])})}return{shape:r,cuts:n}}function hs(e,t={}){let r=$l(e);if(r===null)throw new Error("Could not parse the puzzle description");let n=new to(r,Object.assign({},{allMoves:!0},t));return n.allstickers(),n.genperms(),n}function jf(e,t){return hs(fi[e],t)}function DL(e,t,r){let n=!1;r-t[1]<t[0]&&(e=[e[2],e[3],e[0],e[1]],t=[r-t[1],r-t[0]],n=!0);let l=e[0],o="";if(t[0]===0&&t[1]===r)l=l+"v";else if(t[0]===t[1])t[1]>0&&(o=String(t[1]+1));else if(t[0]===0)l=l.toLowerCase(),t[1]>1&&(o=String(t[1]+1));else throw new Error(\`We only support slice and outer block moves right now. \${t}\`);return[o+l,n]}function AL(e,t){let r=[],n=0;for(;n<e.length;){n>0&&n<e.length&&e[n]==="_"&&n++;let l="";for(let o of t)e.substr(n).startsWith(o[1])&&o[1].length>l.length&&(l=o[1]);if(l!=="")r.push(l),n+=l.length;else throw new Error("Could not split "+e+" into face names.")}return r}function Li(e,t){return[e.b/t,-e.c/t,e.d/t]}function Rs(e,t){let r=[],n=e.length;for(let l=0;l<n;l++){let o=Li(e.get(n-l-1),t);r[3*l]=o[0],r[3*l+1]=o[1],r[3*l+2]=o[2]}return r}var Ar,Vn,we,LL,BL,hL,Kf,Qf,to,Bi,eo=y(()=>{"use strict";Be();pf();fs();us();oi();_f();kf();Tf();gi();ds();Ar=class{constructor(t){this.coords=new Array(t.length*3);for(let r=0;r<t.length;r++)this.coords[3*r]=t[r].b,this.coords[3*r+1]=t[r].c,this.coords[3*r+2]=t[r].d;this.length=t.length}get(t){return new W(0,this.coords[3*t],this.coords[3*t+1],this.coords[3*t+2])}centermass(){let t=0,r=0,n=0;for(let l=0;l<this.length;l++)t+=this.coords[3*l],r+=this.coords[3*l+1],n+=this.coords[3*l+2];return new W(0,t/this.length,r/this.length,n/this.length)}rotate(t){let r=[];for(let n=0;n<this.length;n++)r.push(this.get(n).rotatepoint(t));return new Ar(r)}rotateforward(){let t=[];for(let r=1;r<this.length;r++)t.push(this.get(r));return t.push(this.get(0)),new Ar(t)}},Vn=class{constructor(t,r,n){this.face=t;this.left=r;this.right=n}split(t){let r=t.cutface(this.face);return r!==null&&(this.left===void 0?(this.left=new Vn(r[0]),this.right=new Vn(r[1])):(this.left=this.left?.split(t),this.right=this.right?.split(t))),this}collect(t,r){return this.left===void 0?t.push(new Ar(this.face)):r?(this.left?.collect(t,!1),this.right?.collect(t,!0)):(this.right?.collect(t,!1),this.left?.collect(t,!0)),t}};we=1e-9,LL="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",BL=!1;hL={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"]}};Kf=["c","t","o","d","i"],Qf=["f","v","e"];to=class{constructor(t,r){this.puzzleDescription=t;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.notationMapper=new nn;this.addNotationMapper="";this.setReidOrder=!1;let n="genperms";this.options=new li(r),this.options.verbosity>0&&console.log(this.header("# ")),this.create(t)}create(t){let{shape:r,cuts:n}=t;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let l=null;switch(r){case"c":l=Cf();break;case"o":l=Gf();break;case"i":l=Mf();break;case"t":l=Pf();break;case"d":l=Nf();break;default:throw new Error("Bad shape argument: "+r)}this.rotations=Of(l),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let o=l[0];this.baseplanerot=ms(o,this.rotations);let i=this.baseplanerot.map(D=>o.rotateplane(D));this.baseplanes=i,this.baseFaceCount=i.length;let s=dL()[i.length];this.net=s,this.colors=RL()[i.length],this.options.verbosity>0&&console.log("# Base planes: "+i.length);let a=Ls(i),f=new W(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+a.length);let u=i[0].makenormal(),g=a[0].sum(a[1]).makenormal(),p=a[0].makenormal(),c=new W(1,u.b,u.c,u.d);this.options.verbosity>0&&console.log("# Boundary is "+c);let m=ms(c,this.rotations).map(D=>c.rotateplane(D)),d=Ls(m);this.edgedistance=d[0].sum(d[1]).smul(.5).dist(f),this.vertexdistance=d[0].dist(f);let F=[],A=[],U=!1,x=!1,b=!1;for(let D of n){let _=null,T=0;switch(D.cutType){case"f":_=u,T=1,U=!0;break;case"v":_=p,T=this.vertexdistance,b=!0;break;case"e":_=g,T=this.edgedistance,x=!0;break;default:throw new Error("Bad cut argument: "+D.cutType)}F.push(_.makecut(D.distance)),A.push(D.distance<T)}this.options.addRotations&&(U||F.push(u.makecut(10)),b||F.push(p.makecut(10)),x||F.push(g.makecut(10))),this.basefaces=[];for(let D of this.baseplanerot){let _=D.rotateface(d);this.basefaces.push(new Ar(_))}let N=[],J=[],C=[],Q=[],S=d.length;function k(D,_,T){for(let G of D)if(G[0].dist(_)<we){G.push(T);return}D.push([_,T])}for(let D=0;D<this.baseplanerot.length;D++){let _=this.baseplanerot[D].rotateface(d);for(let T=0;T<_.length;T++){let G=(T+1)%_.length,$=_[T].sum(_[G]).smul(.5);k(Q,$,D)}}let P=[];for(let D=0;D<this.baseplanerot.length;D++){let _=this.baseplanerot[D].rotateface(d),T=[];for(let G=0;G<_.length;G++){let $=(G+1)%_.length,se=_[G].sum(_[$]).smul(.5),Ne=Q[mi(Q,se)];if(D===Ne[1])T.push(Ne[2]);else if(D===Ne[2])T.push(Ne[1]);else throw new Error("Could not find edge")}P.push(T)}let w={},E=[];E.push(s[0][0]),w[s[0][0]]=0,E[P[0][0]]=s[0][1],w[s[0][1]]=P[0][0];for(let D of s){let _=D[0],T=w[_];if(T===void 0)throw new Error("Bad edge description; first edge not connected");let G=-1;for(let $=0;$<P[T].length;$++){let se=E[P[T][$]];if(se!==void 0&&se===D[1]){G=$;break}}if(G<0)throw new Error("First element of a net not known");for(let $=2;$<D.length;$++){if(D[$]==="")continue;let se=P[T][($+G-1)%S],Ne=E[se];if(Ne!==void 0&&Ne!==D[$])throw new Error("Face mismatch in net");E[se]=D[$],w[D[$]]=se}}for(let D=0;D<this.baseplanerot.length;D++){let _=this.baseplanerot[D].rotateface(d),T=c.rotateplane(this.baseplanerot[D]),G=E[D];N.push([_,G]),J.push([T,G])}for(let D=0;D<this.baseplanerot.length;D++){let _=this.baseplanerot[D].rotateface(d),T=E[D];for(let G=0;G<_.length;G++){let $=(G+1)%_.length,se=_[G].sum(_[$]).smul(.5),Ne=(G+2)%_.length,hm=_[$].sum(_[Ne]).smul(.5),Fm=mi(Q,se),Dm=mi(Q,hm);k(C,_[$],[T,Dm,Fm])}}this.swizzler=new Kn(N.map(D=>D[1]));let M=this.swizzler.prefixFree?"":"_",j=hL[this.baseFaceCount],q=[];for(let D=0;D<this.baseFaceCount;D++)q[1<<D]=D;{let D=j.v;for(let _ of D){let T=this.swizzler.splitByFaceNames(_),G=0;for(let $ of T)G|=1<<$;q[G]=T[0]}}{let D=j.e;for(let _ of D){let T=this.swizzler.splitByFaceNames(_),G=0;for(let $ of T)G|=1<<$;q[G]=T[0]}}{let D=j.c;for(let _ of D){let T=this.swizzler.splitByFaceNames(_),G=1<<T[0]|1<<this.baseFaceCount;q[G]=T[1]}}for(let D=0;D<Q.length;D++){if(Q[D].length!==3)throw new Error("Bad length in edge names "+Q[D]);let _=Q[D][1],T=Q[D][2],G=E[_],$=E[T],se=1<<_|1<<T;q[se]==_?G=G+M+$:G=$+M+G,Q[D]=[Q[D][0],G]}for(let D=0;D<C.length;D++){let _=0;if(C[D].length<4)throw new Error("Bad length in vertex names");for(let se=1;se<C[D].length;se++)_|=1<<w[C[D][se][0]];let T=q[_],G=-1;for(let se=1;se<C[D].length;se++)T===w[C[D][se][0]]&&(G=se);if(G<0)throw new Error("Internal error; couldn't find face name when fixing corners");let $="";for(let se=1;se<C[D].length;se++){se===1?$=C[D][G][0]:$=$+M+C[D][G][0];for(let Ne=1;Ne<C[D].length;Ne++)if(C[D][G][1]===C[D][Ne][2]){G=Ne;break}}C[D]=[C[D][0],$]}this.markedface=q,this.options.verbosity>1&&(console.log("# Face names: "+N.map(D=>D[1]).join(" ")),console.log("# Edge names: "+Q.map(D=>D[1]).join(" ")),console.log("# Vertex names: "+C.map(D=>D[1]).join(" ")));let ie=[];for(let D of J)ie.push([D[0].makenormal(),D[1],"f"]);for(let D of Q)ie.push([D[0].makenormal(),D[1],"e"]);for(let D of C)ie.push([D[0].makenormal(),D[1],"v"]);this.facenames=N,this.faceplanes=J,this.edgenames=Q,this.vertexnames=C,this.geonormals=ie;let he=ie.map(D=>D[1]);this.swizzler.setGripNames(he),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let D=0;D<F.length;D++)for(let _ of this.rotations){let T=F[D].rotateplane(_),G=!1;for(let $ of this.moveplanes)if(T.sameplane($)){G=!0;break}G||(this.moveplanes.push(T),A[D]&&this.moveplanes2.push(T))}let be=new Vn(d),Ye=this.moveplanes2.slice(),bt=31;for(let D=0;D<Ye.length;D++){let _=D+Math.floor((Ye.length-D)*(bt/65536));be=be.split(Ye[_]),Ye[_]=Ye[D],bt=(bt*1657+101)%65536}let Le=be.collect([],!0);this.faces=Le,this.options.verbosity>0&&console.log("# Faces is now "+Le.length),this.stickersperface=Le.length;let ht=[],ot=ui(d);for(let D of this.rotations){let _=D.rotateface(d);ot.dist(ui(_))<we&&ht.push(D)}let ct=new Array(Le.length),Ce=[];for(let D=0;D<Le.length;D++){let _=Le[D].centermass();Ce.push([ot.dist(_),_,D])}Ce.sort((D,_)=>D[0]-_[0]);for(let D=0;D<Le.length;D++){let _=Ce[D][2];if(!ct[_]){ct[_]=!0;for(let T of ht){let G=Le[_].rotate(T),$=G.centermass();for(let se=D+1;se<Le.length&&!(Ce[se][0]-Ce[D][0]>we);se++){let Ne=Ce[se][2];if(!ct[Ne]&&$.dist(Ce[se][1])<we){ct[Ne]=!0,Le[Ne]=G;break}}}}}this.shortedge=1e99;for(let D of Le)for(let _=0;_<D.length;_++){let T=(_+1)%D.length,G=D.get(_).dist(D.get(T));G<this.shortedge&&(this.shortedge=G)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),r==="c"&&U&&!x&&!b&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&b&&!U&&!x&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(b||U)&&!x&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&U&&(this.notationMapper=new Qn(this.swizzler,new Kn(["F","D","L","BL","R","U","BR","B"])),!x&&!b&&(this.addNotationMapper="FTOMapper")),r==="d"&&U&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new Qn(this.swizzler,new Kn(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(t){return this.keyface2(t.centermass())}keyface2(t){let r="",n=String.fromCharCode;for(let l of this.moveplanesets)if(l.length>0){let o=t.dot(l[0]),i=0,s=1;for(;s*2<=l.length;)s*=2;for(;s>0;s>>=1)i+s<=l.length&&o>l[i+s-1].a&&(i+=s);if(i<47)r=r+n(33+i);else if(i<47+47*47)r=r+n(33+47+Math.floor(i/47)-1)+n(33+i%47);else if(i<47+47*47+47*47*47)r=r+n(33+47+Math.floor((i-47)/(47*47)-1))+n(33+47+Math.floor((i-47)/47)%47)+n(33+i%47);else throw Error("Too many slices for cubie encoding")}return r}keyface3(t){let r=t.centermass(),n=[];for(let l of this.moveplanesets)if(l.length>0){let o=r.dot(l[0]),i=0,s=1;for(;s*2<=l.length;)s*=2;for(;s>0;s>>=1)i+s<=l.length&&o>l[i+s-1].a&&(i+=s);n.push(i)}return n}findface(t){let r=this.keyface2(t),n=this.facelisthash.get(r);if(n.length===1)return n[0];for(let l=0;l+1<n.length;l++){let o=this.facelisthash.get(r)[l];if(Math.abs(t.dist(this.facecentermass[o]))<we)return o}return n[n.length-1]}project2d(t,r,n){let l=this.facenames[t][0],o=(r+1)%l.length,i=this.baseplanes[t],s=l[o].sub(l[r]),a=s.len();s=s.normalize();let f=s.cross(i).normalize(),u=n[1].sub(n[0]),g=u.len()/a;u=u.normalize();let p=u.b,c=u.c,L=s.smul(p).sub(f.smul(c)).smul(g),m=f.smul(p).sum(s.smul(c)).smul(g),d=new W(0,n[0].b-L.dot(l[r]),n[0].c-m.dot(l[r]),0);return[L,m,d]}allstickers(){let t="allstickers";this.faces=mL(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 S=0;S<this.faces.length;S++)this.facecentermass[S]=this.faces[S].centermass();let r=[],n=[];for(let S of this.moveplanes){let k=S.makenormal(),P=!1;for(let w of n)k.sameplane(w.makenormal())&&(P=!0);P||(n.push(k),r.push([]))}for(let S of this.moveplanes2){let k=S.makenormal();for(let P=0;P<n.length;P++)if(k.sameplane(n[P])){r[P].push(S);break}}for(let S=0;S<r.length;S++){let k=r[S].map(w=>w.normalizeplane()),P=n[S];for(let w=0;w<k.length;w++)k[w].makenormal().dist(P)>we&&(k[w]=k[w].smul(-1));k.sort((w,E)=>w.a-E.a),r[S]=k}this.moveplanesets=r,this.moveplanenormals=n;let l=r.map(S=>S.length);this.options.verbosity>0&&console.log("# Move plane sets: "+l);let o=[];for(let S=0;S<r.length;S++)o.push([]);for(let S of this.rotations){if(Math.abs(Math.abs(S.a)-1)<we)continue;let k=S.makenormal();for(let P=0;P<r.length;P++)if(k.sameplane(n[P])){o[P].push(S);break}}this.moverotations=o;for(let S=0;S<o.length;S++){let k=o[S],P=k[0].makenormal();for(let w=0;w<k.length;w++)P.dist(k[w].makenormal())>we&&(k[w]=k[w].smul(-1));k.sort((w,E)=>w.angle()-E.angle()),o[S][0].dot(n[S])<0&&k.reverse()}let i=o.map(S=>1+S.length);this.movesetorders=i;let s=[],a="?";for(let S=0;S<r.length;S++){let k=n[S],P=null,w=null;for(let E of this.geonormals){let M=k.dot(E[0]);Math.abs(M-1)<we?(w=[E[1],E[2]],a=E[2]):Math.abs(M+1)<we&&(P=[E[1],E[2]],a=E[2])}if(w===null||P===null)throw new Error("Saw positive or negative sides as null");s.push([w[0],w[1],P[0],P[1],1+r[S].length]),this.addNotationMapper==="NxNxNCubeMapper"&&a==="f"&&(this.notationMapper=new Jl(1+r[S].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new Xl(this.swizzler),this.addNotationMapper=""),this.addNotationMapper==="PyraminxOrTetraminxMapper"&&(r[0].length===2&&r[0][0].a===.333333333333333&&r[0][1].a===1.66666666666667?(this.notationMapper=new jn(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new Yl(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&a==="f"&&(1+r[S].length===3&&(this.notationMapper=new Zl(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&a==="f"&&(1+r[S].length===3&&(this.notationMapper=new Hl(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=s;let f=new Map,u=this.faces;for(let S=0;S<u.length;S++){let k=u[S],P=this.keyface(k);if(!f.get(P))f.set(P,[S]);else{let w=f.get(P);if(w.push(S),w.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let E=0;E<w.length;E++){let M=P+" "+E;f.set(M,[w[E]])}}}}this.facelisthash=f,this.options.verbosity>0&&console.log("# Cubies: "+f.size);let g=[],p=[],c=[];for(let S of f.values())if(S.length!==this.baseFaceCount){if(S.length>1){let k=S.map(j=>u[j].centermass()),P=ui(k);for(let j=0;S.length>2;j++){let q=!1;for(let ie=0;ie<S.length;ie++){let he=(ie+1)%S.length;if(P.dot(k[ie].cross(k[he]))<0){let be=k[ie];k[ie]=k[he],k[he]=be;let Ye=S[ie];S[ie]=S[he],S[he]=Ye,q=!0}}if(!q)break;if(j>1e3)throw new Error("Bad epsilon math; too close to border")}let w=0;for(let j of S)w|=1<<Math.floor(j/this.stickersperface);let E=this.markedface[w],M=-1;for(let j=0;j<S.length;j++)Math.floor(S[j]/this.stickersperface)===E&&(M=j);if(M<0)throw new Error("Could not find marked face in list");if(M!==0){let j=S.slice();for(let q=0;q<S.length;q++)S[q]=j[(M+q)%S.length]}}for(let k=0;k<S.length;k++){let P=S[k];p[P]=g.length,c[P]=k}g.push(S)}this.cubies=g,this.facetocubie=p,this.facetoord=c;let L=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],m=[],d=[0,0,0,0,0,0],F=[],A=[],U=0,x=[],b=[],N=[],J=[],C=S=>g[S].map(k=>this.getfaceindex(k)).join(" "),Q=[];for(let S=0;S<g.length;S++){let k=g[S];if(k.length===0||A[S])continue;let P={},w=0;N.push(0),Q.push([]);let E=k.length,M=d[E]++,j=L[E];(j===void 0||E===this.baseFaceCount)&&(j="CORE"),j=j+(M===0?"":M+1),m[U]=j,F[U]=E;let q=[S],ie=0;for(A[S]=!0;ie<q.length;){let he=q[ie++],be=C(he);if((k.length>1||P[be]===void 0)&&(P[be]=w++),J[he]=P[be],x[he]=U,Q[U].push(he),b[he]=N[U]++,q.length<this.rotations.length){let Ye=this.facecentermass[g[he][0]];for(let bt of o){let Le=this.facetocubie[this.findface(Ye.rotatepoint(bt[0]))];A[Le]||(q.push(Le),A[Le]=!0)}}}U++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let S=[["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"]],k={};for(let P of S)for(let w=0;w<P.length;w++){let E=0;for(let M=0;M<P[w].length;M++)E|=1<<P[w].charCodeAt(M)-65;k[E]=w}for(let P of Q)for(let w of P){let E=0;for(let M of g[w])E|=1<<this.facenames[this.getfaceindex(M)][1].charCodeAt(0)-65;b[w]=k[E]}}if(this.cubiesetnums=x,this.cubieordnums=b,this.cubiesetnames=m,this.cubieords=N,this.orbitoris=F,this.cubievaluemap=J,this.cubiesetcubies=Q,this.options.fixedPieceType!==null){for(let S=0;S<g.length;S++)if(this.options.fixedPieceType==="v"&&g[S].length>2||this.options.fixedPieceType==="e"&&g[S].length===2||this.options.fixedPieceType==="f"&&g[S].length===1){this.fixedCubie=S;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 "+N)}unswizzle(t){let r=this.notationMapper.notationToInternal(t);return r===null?null:r.modified({family:this.swizzler.unswizzle(r.family)})}stringToBlockMove(t){let r=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),n=t.match(r);if(n===null)throw new Error("Bad move passed "+t);let l=n[4],o,i;if(n[2]!==void 0){if(n[3]===void 0)throw new Error("Missing second number in range");o=parseInt(n[2],10)}n[3]!==void 0&&(i=parseInt(n[3],10));let s="1",a=1;return n[5]!==void 0&&(s=n[5],s[0]==="'"&&(s="-"+s.substring(1)),a=parseInt(s,10)),new B(new z(l,i,o),a)}parseMove(t){let r=this.notationMapper.notationToInternal(t);if(r===null)throw new Error("Bad move "+t.family);t=r;let n=t.family,l=!1;if(n.endsWith("v")&&n[0]<="Z"){if(t.innerLayer!==void 0||t.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");n=n.slice(0,-1),l=!0}n.endsWith("w")&&n[0]<="Z"&&(n=n.slice(0,-1).toLowerCase());let o,i=-1,s=this.swizzler.unswizzle(n),a=!1;for(let g=0;g<this.movesetgeos.length;g++){let p=this.movesetgeos[g];s===p[0]&&(a=!0,o=p,i=g),s===p[2]&&(a=!1,o=p,i=g)}let f=1,u=1;if(n.toUpperCase()!==n&&(u=2),o===void 0)throw new Error("Bad grip in move "+t.family);if(t.outerLayer!==void 0&&(f=t.outerLayer),t.innerLayer!==void 0&&(t.outerLayer===void 0?(u=t.innerLayer,n<="Z"?f=u:f=1):u=t.innerLayer),f--,u--,l&&(f=0,u=this.moveplanesets[i].length),f<0||f>this.moveplanesets[i].length||u<0||u>this.moveplanesets[i].length)throw new Error("Bad slice spec "+f+" "+u+" vs "+this.moveplanesets[i].length);if(!BL&&f===0&&u===this.moveplanesets[i].length&&!l)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,f,u,a,t.amount]}parsemove(t){let r=this.parseMove(this.stringToBlockMove(t));return r[0]=t,r}genperms(){let t="genperms";if(this.cmovesbyslice.length>0)return;let r=[];if(this.options.orientCenters){for(let n=0;n<this.cubies.length;n++)if(this.cubies[n].length===1){let l=this.cubies[n][0],o=this.getfaceindex(l),i=this.basefaces[o].centermass();if(i.dist(this.facecentermass[l])<we){let s=1<<o|1<<this.baseFaceCount,a=this.markedface[s],f=this.baseplanes[a].makenormal(),u=-1,g=-1;for(let L=0;L<this.faces[l].length;L++){let m=this.faces[l].get(L),d=f.dot(m.sub(i));d>u&&(u=d,g=L)}let p=(g+1)%this.faces[l].length;if(Math.abs(f.dot(this.faces[l].get(p).sub(i))-u)<we&&(g=p),g!=0){let L=[];for(let m=0;m<this.faces[l].length;m++)L.push(this.faces[l].get((m+g)%this.faces[l].length));this.faces[l]=new Ar(L)}let c=this.basefaces[o].length;for(let L=1;L<c;L++)this.cubies[n].push(this.cubies[n][L-1]);this.duplicatedFaces[l]=c,this.duplicatedCubies[n]=c,this.orbitoris[this.cubiesetnums[n]]=c}}}for(let n=0;n<this.moveplanesets.length;n++){let l=this.moveplanesets[n],o=[],i=[l.length+1,0],s=1;for(;s*2<=l.length;)s*=2;for(let u=0;u<this.faces.length;u++){let g=0;if(l.length>0){let p=this.facecentermass[u].dot(l[0]);for(let c=s;c>0;c>>=1)g+c<=l.length&&p>l[g+c-1].a&&(g+=c);g=l.length-g}for(o.push(g);i.length<=g;)i.push(0);i[g]++}let a=new Array(i.length);for(let u=0;u<i.length;u++)a[u]=[];let f=[];for(let u=0;u<this.faces.length;u++){if(o[u]<0)continue;let g=[this.facetocubie[u],this.facetoord[u]],p=this.facecentermass[u],c=p,L=u,m=o[L];for(;;){o[L]=-1;let d=p.rotatepoint(this.moverotations[n][0]);if(d.dist(c)<we)break;L=this.findface(d),g.push(this.facetocubie[L],this.facetoord[L]),p=d}if(g.length>2&&this.options.orientCenters&&(this.cubies[g[0]].length===1||this.duplicatedCubies[g[0]]>1)&&this.facecentermass[u].dist(this.basefaces[this.getfaceindex(u)].centermass())<we){let d=this.faces[this.cubies[g[0]][0]];for(let F=0;F<g.length;F+=2){let A=this.faces[this.cubies[g[F]][0]],U=-1;for(let x=0;x<d.length;x++)if(A.get(x).dist(d.get(0))<we){U=x;break}if(U<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");g[F+1]=U,d=d.rotate(this.moverotations[n][0])}}if(g.length===2&&this.options.orientCenters)for(let d=1;d<this.movesetorders[n];d++)m===0?g.push(g[0],d):g.push(g[0],(this.movesetorders[n]-d)%this.movesetorders[n]);if(g.length>2&&!f[g[0]]){if(g.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let d of g)a[m].push(d)}for(let d=0;d<g.length;d+=2)f[g[d]]=!0}for(let u=0;u<a.length;u++)a[u]=a[u].slice();r.push(a)}if(this.cmovesbyslice=r,this.options.moveList){let n=[];for(let l of this.options.moveList)n.push(this.parsemove(l));this.parsedmovelist=n}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(t){let r=this.moveplanesets[t].length,n=[];if(this.parsedmovelist!==void 0)for(let l of this.parsedmovelist)l[1]===t&&(l[4]?n.push([l[2],l[3]]):n.push([r-l[3],r-l[2]]),n.push(l[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let l=this.movesetgeos[t];if(l[1]!==l[3])for(let o=0;o<r;o++)l[1]!=="v"?(this.options.outerBlockMoves?n.push([o+1,r]):n.push([o+1]),n.push(1)):(this.options.outerBlockMoves?n.push([0,o]):n.push([o,o]),n.push(1))}else for(let l=0;l<=r;l++)!this.options.allMoves&&l+l===r||(this.options.outerBlockMoves?l+l>r?n.push([l,r]):n.push([0,l]):n.push([l,l]),n.push(1));if(this.fixedCubie>=0){let l=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[t],o=[];for(let i=0;i<n.length;i+=2){let s=n[i];if(l>=s[0]&&l<=s[1])if(s[0]===0)s=[s[1]+1,r];else if(r===s[1])s=[0,s[0]-1];else throw Error("fixed cubie option would disconnect move");let a=!1;for(let f=0;f<o.length;f+=2)if(o[f][0]===s[0]&&o[f][1]===s[1]&&o[f+1]===n[i+1]){a=!0;break}a||(o.push(s),o.push(n[i+1]))}n=o}return n}graybyori(t){let r=this.cubies[t].length;return this.duplicatedCubies[t]&&(r=1),r===1&&(this.options.grayCenters||!this.options.includeCenterOrbits)||r===2&&(this.options.grayEdges||!this.options.includeEdgeOrbits)||r>2&&(this.options.grayCorners||!this.options.includeCornerOrbits)}skipbyori(t){let r=this.cubies[t].length;return this.duplicatedCubies[t]&&(r=1),r===1&&!this.options.includeCenterOrbits||r===2&&!this.options.includeEdgeOrbits||r>2&&!this.options.includeCornerOrbits}skipcubie(t){return this.skipbyori(t)}header(t){return t+LL+\`
8
+ \`:" "}var at,en,v,Yt=y(()=>{"use strict";Jt();Z0();Tt();j0();X0();Mn();Gl();Rr();Ol();q0();en=class extends Me{constructor(r){super();ee(this,at,void 0);V(this,at,Array.from(J2(r)));for(let n of R(this,at))if(!Q2(n))throw new Error("An alg can only contain alg nodes.")}isIdentical(r){let n=r;if(!r.is(en))return!1;let l=Array.from(R(this,at)),o=Array.from(R(n,at));if(l.length!==o.length)return!1;for(let i=0;i<l.length;i++)if(!l[i].isIdentical(o[i]))return!1;return!0}invert(){return new en(N2(Array.from(R(this,at)).map(r=>r.invert())))}*experimentalExpand(r=1,n){n??(n=1/0);for(let l of P2(R(this,at),r))yield*l.experimentalExpand(r,n)}expand(r){return new en(this.experimentalExpand(1,r?.depth??1/0))}*experimentalLeafMoves(){for(let r of this.experimentalExpand())r.is(B)&&(yield r)}concat(r){return new en(Array.from(R(this,at)).concat(Array.from(J2(r))))}experimentalIsEmpty(){for(let r of R(this,at))return!1;return!0}static fromString(r){return Q0(r)}units(){return this.childAlgNodes()}*childAlgNodes(){for(let r of R(this,at))yield r}experimentalNumUnits(){return this.experimentalNumChildAlgNodes()}experimentalNumChildAlgNodes(){return Array.from(R(this,at)).length}get type(){return qo("deprecated: type"),"sequence"}toString(){let r="",n=null;for(let l of R(this,at)){n&&(r+=jm(n,l));let o=l.as(Ae)?.experimentalNISSGrouping;if(o){if(o.amount!==-1)throw new Error("Invalid NISS Grouping amount!");r+=\`^(\${o.alg.toString()})\`}else l.as(Te)?.experimentalNISSPlaceholder||(r+=l.toString());n=l}return r}simplify(r){return new en(Z2(this,r??{}))}},v=en;at=new WeakMap});var qm,Y2=y(()=>{"use strict";Yt();Mn();Nl();Ml();Rr();Tl();qm={Sune:new v([new B("R",1),new B("U",1),new B("R",-1),new B("U",1),new B("R",1),new B("U",-2),new B("R",-1)]),AntiSune:new v([new B("R",1),new B("U",2),new B("R",-1),new B("U",-1),new B("R",1),new B("U",-1),new B("R",-1)]),SuneCommutator:new v([new Ge(new v([new B("R",1),new B("U",1),new B("R",-2)]),new v([new Oe(new v([new B("R",1)]),new v([new B("U",1)]))]))]),Niklas:new v([new B("R",1),new B("U",-1),new B("L",-1),new B("U",1),new B("R",-1),new B("U",-1),new B("L",1),new B("U",1)]),EPerm:new v([new B("x",-1),new Ge(new v([new Oe(new v([new B("R",1)]),new v([new B("U",-1)]))]),new v([new B("D",1)])),new Ge(new v([new Oe(new v([new B("R",1)]),new v([new B("U",1)]))]),new v([new B("D",1)])),new B("x",1)]),FURURFCompact:new v([new Oe(new v([new B("F",1)]),new v([new Ge(new v([new B("U",1)]),new v([new B("R",1)]))]))]),APermCompact:new v([new Oe(new v([new B("R",2)]),new v([new Ge(new v([new B("F",2)]),new v([new B("R",-1),new B("B",-1),new B("R",1)]))]))]),FURURFMoves:new v([new B("F",1),new B("U",1),new B("R",1),new B("U",-1),new B("R",-1),new B("F",-1)]),TPerm:new v([new B("R",1),new B("U",1),new B("R",-1),new B("U",-1),new B("R",-1),new B("F",1),new B("R",2),new B("U",-1),new B("R",-1),new B("U",-1),new B("R",1),new B("U",1),new B("R",-1),new B("F",-1)]),HeadlightSwaps:new v([new Oe(new v([new B("F",1)]),new v([new Te(new v([new Ge(new v([new B("R",1)]),new v([new B("U",1)]))]),3)]))]),TriplePause:new v([new Ae,new Ae,new Ae])}});var TA,X2=y(()=>{"use strict";Mn();Rr();TA={73:new B("R"),75:new B("R'"),87:new B("B"),79:new B("B'"),83:new B("D"),76:new B("D'"),68:new B("L"),69:new B("L'"),74:new B("U"),70:new B("U'"),72:new B("F"),71:new B("F'"),78:new B("x'"),67:new B("l"),82:new B("l'"),85:new B("r"),77:new B("r'"),88:new B("d"),188:new B("d'"),84:new B("x"),89:new B("x"),66:new B("x'"),186:new B("y"),59:new B("y"),65:new B("y'"),80:new B("z"),81:new B("z'"),90:new B("M'"),190:new B("M'"),192:new Ae}});var $2=y(()=>{"use strict"});var ef=y(()=>{"use strict";Yt()});var Be=y(()=>{"use strict";Yt();I0();X0();Y2();X2();Mn();$2();ef();Z0();W0()});function Ql(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],s=r[l];if(Kl(o.numOrientations,s))n[l]=i;else if(Kl(o.numOrientations,i))n[l]=s;else{let a=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)a[f]=i.permutation[s.permutation[f]];n[l]={permutation:a,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let u=0;u<o.numPieces;u++)f[u]=(i.orientation[s.permutation[u]]+s.orientation[u])%o.numOrientations,a[u]=i.permutation[s.permutation[u]];n[l]={permutation:a,orientation:f}}}}return n}function $0(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],s=r[l];if(Kl(o.numOrientations,s))n[l]=i;else{let a=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)a[f]=i.pieces[s.permutation[f]];n[l]={pieces:a,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let u=0;u<o.numPieces;u++)f[u]=(i.orientation[s.permutation[u]]+s.orientation[u])%o.numOrientations,a[u]=i.pieces[s.permutation[u]];n[l]={pieces:a,orientation:f}}}}return n}var $o=y(()=>{"use strict";jl()});function Vm(e){let t=tf.get(e);if(t)return t;let r=new Array(e),n=new Array(e);for(let o=0;o<e;o++)r[o]=o,n[o]=0;let l={permutation:r,orientation:n};return rf&&(Object.freeze(r),Object.freeze(n),Object.freeze(l)),tf.set(e,l),l}function nf(e){let t={};for(let[r,n]of Object.entries(e.orbits))t[r]=Vm(n.numPieces);return rf&&Object.freeze(t),t}function lf(e,t){let r=t.quantum.toString(),n=e.definition.moves[r];if(!n){let i=e.definition.experimentalDerivedMoves?.[r];i&&(n=e.algToTransformation(i).transformationData)}if(n)return hr(e,n,t.amount);let l=e.definition.moves[t.toString()];if(l)return l;let o=e.definition.moves[t.invert().toString()];if(o)return hr(e,o,-1);throw new Error(\`Invalid move for KPuzzle (\${e.name()}): \${t}\`)}var rf,tf,es=y(()=>{"use strict";jl();rf=!1,tf=new Map});var ge,ei=y(()=>{"use strict";$o();ql();ge=class{constructor(t,r){this.kpuzzle=t;this.stateData=r}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),stateData:this.stateData}}static fromTransformation(t){let r=$0(t.kpuzzle.definition,t.kpuzzle.definition.startStateData,t.transformationData);return new ge(t.kpuzzle,r)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(t.isIdentityTransformation())return new ge(this.kpuzzle,this.stateData);let r=$0(this.kpuzzle.definition,this.stateData,t.transformationData);return new ge(this.kpuzzle,r)}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let t={};for(let[r,n]of Object.entries(this.stateData)){let l={permutation:n.pieces,orientation:n.orientation};t[r]=l}return new Dt(this.kpuzzle,t)}experimentalIsSolved(t){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,t)}}});var tn,Fr,Dt,ql=y(()=>{"use strict";jl();$o();es();ei();Fr=class{constructor(t,r){this.kpuzzle=t;this.transformationData=r;ee(this,tn,void 0)}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),transformationData:this.transformationData}}invert(){return new Fr(this.kpuzzle,ts(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return R(this,tn)??V(this,tn,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(t){let r=new Fr(t,nf(t.definition));return V(r,tn,!0),r}isIdentical(t){return of(this.kpuzzle,this.transformationData,t.transformationData)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(this.kpuzzle!==t.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${t.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return R(this,tn)?new Fr(this.kpuzzle,t.transformationData):R(t,tn)?new Fr(this.kpuzzle,this.transformationData):new Fr(this.kpuzzle,Ql(this.kpuzzle.definition,this.transformationData,t.transformationData))}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}toKState(){return ge.fromTransformation(this)}repetitionOrder(){return sf(this.kpuzzle.definition,this)}selfMultiply(t){return new Fr(this.kpuzzle,hr(this.kpuzzle,this.transformationData,t))}},Dt=Fr;tn=new WeakMap});function Kl(e,t){let{permutation:r}=t,n=r.length;for(let l=0;l<n;l++)if(r[l]!==l)return!1;if(e>1){let{orientation:l}=t;for(let o=0;o<n;o++)if(l[o]!==0)return!1}return!0}function Hm(e,t,r,n={}){for(let l=0;l<e.numPieces;l++)if(!n?.ignoreOrientation&&t.orientation[l]!==r.orientation[l]||!n?.ignorePermutation&&t.permutation[l]!==r.permutation[l])return!1;return!0}function of(e,t,r){for(let[n,l]of Object.entries(e.definition.orbits))if(!Hm(l,t[n],r[n]))return!1;return!0}function ts(e,t){let r={};for(let n in e.definition.orbits){let l=e.definition.orbits[n],o=t[n];if(Kl(l.numOrientations,o))r[n]=o;else if(l.numOrientations===1){let i=new Array(l.numPieces);for(let s=0;s<l.numPieces;s++)i[o.permutation[s]]=s;r[n]={permutation:i,orientation:o.orientation}}else{let i=new Array(l.numPieces),s=new Array(l.numPieces);for(let a=0;a<l.numPieces;a++){let f=o.permutation[a];i[f]=a,s[f]=(l.numOrientations-o.orientation[a]+l.numOrientations)%l.numOrientations}r[n]={permutation:i,orientation:s}}}return r}function hr(e,t,r){if(r===1)return t;if(r<0)return hr(e,ts(e,t),-r);if(r===0){let{transformationData:o}=e.identityTransformation();return o}let n=t;r!==2&&(n=hr(e,t,Math.floor(r/2)));let l=Ql(e.definition,n,n);return r%2===0?l:Ql(e.definition,t,l)}function ns(e,t){return t?ns(t,e%t):e}function sf(e,t){let r=1;for(let n in e.orbits){let l=e.orbits[n],o=t.transformationData[n],i=new Array(l.numPieces);for(let s=0;s<l.numPieces;s++)if(!i[s]){let a=s,f=0,u=0;for(;i[a]=!0,f=f+o.orientation[a],u=u+1,a=o.permutation[a],a!==s;);f!==0&&(u=u*l.numOrientations/ns(l.numOrientations,f)),r=r*u/ns(r,u)}}return r}var rs,af,ff,jl=y(()=>{"use strict";Be();$o();ql();rs=class extends Xr{traverseAlg(t,r){let n=null;for(let l of t.childAlgNodes())n?n=n.applyTransformation(this.traverseAlgNode(l,r)):n=this.traverseAlgNode(l,r);return n??r.identityTransformation()}traverseGrouping(t,r){let n=this.traverseAlg(t.alg,r);return new Dt(r,hr(r,n.transformationData,t.amount))}traverseMove(t,r){return r.moveToTransformation(t)}traverseCommutator(t,r){let n=this.traverseAlg(t.A,r),l=this.traverseAlg(t.B,r);return n.applyTransformation(l).applyTransformation(n.invert()).applyTransformation(l.invert())}traverseConjugate(t,r){let n=this.traverseAlg(t.A,r),l=this.traverseAlg(t.B,r);return n.applyTransformation(l).applyTransformation(n.invert())}traversePause(t,r){return r.identityTransformation()}traverseNewline(t,r){return r.identityTransformation()}traverseLineComment(t,r){return r.identityTransformation()}},af=new rs,ff=af.traverseAlg.bind(af)});var Gn,ti,ye,uf=y(()=>{"use strict";Be();jl();es();ei();ql();ye=class{constructor(t,r){this.definition=t;ee(this,Gn,new Map);ee(this,ti,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return Dt.experimentalConstructIdentity(this)}moveToTransformation(t){typeof t=="string"&&(t=new B(t));let r=t.toString(),n=R(this,Gn).get(r);if(n)return new Dt(this,n);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(t);if(!o)throw new Error(\`could not map to internal move: \${t}\`);return R(this,Gn).set(r,o),new Dt(this,o)}let l=lf(this,t);return R(this,Gn).set(r,l),new Dt(this,l)}algToTransformation(t){return typeof t=="string"&&(t=new v(t)),ff(t,this)}toTransformation(t){return typeof t=="string"?this.algToTransformation(t):t?.is?.(v)?this.algToTransformation(t):t?.is?.(B)?this.moveToTransformation(t):t}startState(){return new ge(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return R(this,ti)??V(this,ti,(()=>{for(let[t,r]of Object.entries(this.definition.orbits)){let n=new Array(r.numPieces).fill(!1);for(let l of this.definition.startStateData[t].pieces)n[l]=!0;for(let l of n)if(!l)return!1}return!0})())}};Gn=new WeakMap,ti=new WeakMap});var He=y(()=>{"use strict";uf();ei();ql()});var Zm,Ty,gf=y(()=>{"use strict";Zm={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"}},Ty={...Zm,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 oL(e){switch(e){case"Regular":return Jm;case"Dim":return rL;case"Ignored":return Ym;case"OrientationStickers":return Xm;case"Invisible":return $m;case"IgnoreNonPrimary":return eL;case"PermuteNonPrimary":return tL;case"Ignoriented":return nL;case"OrientationWithoutPermutation":return lL}}var $t,It,Ze,On,ri,rn,Jm,Ym,Xm,$m,eL,tL,rL,nL,lL,Tn,In,ni=y(()=>{"use strict";$t=class{constructor(t,r){this.stickerings=new Map;for(let[n,l]of Object.entries(t.definition.orbits))this.stickerings.set(n,new Array(l.numPieces).fill(r))}},It="regular",Ze="ignored",On="oriented",ri="invisible",rn="dim",Jm={facelets:[It,It,It,It,It]},Ym={facelets:[Ze,Ze,Ze,Ze,Ze]},Xm={facelets:[On,On,On,On,On]},$m={facelets:[ri,ri,ri,ri]},eL={facelets:[It,Ze,Ze,Ze,Ze]},tL={facelets:[rn,It,It,It,It]},rL={facelets:[rn,rn,rn,rn,rn]},nL={facelets:[rn,Ze,Ze,Ze,Ze]},lL={facelets:[On,Ze,Ze,Ze,Ze]};Tn=class extends $t{constructor(t){super(t,"Regular")}set(t,r){for(let[n,l]of this.stickerings.entries())for(let o=0;o<l.length;o++)t.stickerings.get(n)[o]&&(l[o]=r);return this}toAppearance(){let t={orbits:{}};for(let[r,n]of this.stickerings.entries()){let l=[],o={pieces:l};t.orbits[r]=o;for(let i of n)l.push(oL(i))}return t}},In=class{constructor(t){this.kpuzzle=t}and(t){let r=new $t(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let o=0;o<l.numPieces;o++){r.stickerings.get(n)[o]=!0;for(let i of t)if(!i.stickerings.get(n)[o]){r.stickerings.get(n)[o]=!1;continue e}}}return r}or(t){let r=new $t(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits)){e:for(let o=0;o<l.numPieces;o++){r.stickerings.get(n)[o]=!1;for(let i of t)if(i.stickerings.get(n)[o]){r.stickerings.get(n)[o]=!0;continue e}}}return r}not(t){let r=new $t(this.kpuzzle,!1);for(let[n,l]of Object.entries(this.kpuzzle.definition.orbits))for(let o=0;o<l.numPieces;o++)r.stickerings.get(n)[o]=!t.stickerings.get(n)[o];return r}all(){return this.and(this.moves([]))}move(t){let r=this.kpuzzle.moveToTransformation(t),n=new $t(this.kpuzzle,!1);for(let[l,o]of Object.entries(this.kpuzzle.definition.orbits))for(let i=0;i<o.numPieces;i++)(r.transformationData[l].permutation[i]!==i||r.transformationData[l].orientation[i]!==0)&&(n.stickerings.get(l)[i]=!0);return n}moves(t){return t.map(r=>this.move(r))}orbits(t){let r=new $t(this.kpuzzle,!1);for(let n of t)r.stickerings.get(n).fill(!0);return r}orbitPrefix(t){let r=new $t(this.kpuzzle,!1);for(let n in this.kpuzzle.definition.orbits)n.startsWith(t)&&r.stickerings.get(n).fill(!0);return r}}});var ls,os=y(()=>{"use strict";ls={full:{groups:{"3x3x3":"Stickering"}},OLL:{groups:{"3x3x3":"Last Layer"}},PLL:{groups:{"3x3x3":"Last Layer"}},LL:{groups:{"3x3x3":"Last Layer"}},COLL:{groups:{"3x3x3":"Last Layer"}},OCLL:{groups:{"3x3x3":"Last Layer"}},CLL:{groups:{"3x3x3":"Last Layer"}},ELL:{groups:{"3x3x3":"Last Layer"}},ZBLL:{groups:{"3x3x3":"Last Layer"}},LS:{groups:{"3x3x3":"Last Slot"}},ELS:{groups:{"3x3x3":"Last Slot"}},CLS:{groups:{"3x3x3":"Last Slot"}},ZBLS:{groups:{"3x3x3":"Last Slot"}},VLS:{groups:{"3x3x3":"Last Slot"}},WVLS:{groups:{"3x3x3":"Last Slot"}},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"}},"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 er(e,t){let r=await e.kpuzzle(),n=new Tn(r),l=new In(r),o=()=>l.move("U"),i=()=>l.or(l.moves(["U","D"])),s=()=>l.or(l.moves(["L","R"])),a=()=>l.not(s()),f=()=>l.not(o()),u=()=>l.orbitPrefix("CENTER"),g=()=>l.orbitPrefix("EDGE"),p=()=>l.or([l.orbitPrefix("CORNER"),l.orbitPrefix("C4RNER"),l.orbitPrefix("C5RNER")]),c=()=>l.or([a(),l.and([o(),g()])]),L=()=>l.and([o(),u()]),m=()=>l.and([l.and(l.moves(["F","R"])),g()]),d=()=>l.and([l.and(l.moves(["F","R"])),p(),l.not(o())]),F=()=>l.or([d(),m()]);function A(){n.set(f(),"Dim")}function U(){n.set(o(),"PermuteNonPrimary"),n.set(L(),"Dim")}function x(){n.set(o(),"IgnoreNonPrimary"),n.set(L(),"Regular")}function b(){n.set(o(),"Ignoriented"),n.set(L(),"Dim")}switch(t){case"full":break;case"PLL":A(),U();break;case"CLS":A(),n.set(d(),"Regular"),n.set(o(),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),p()]),"IgnoreNonPrimary");break;case"OLL":A(),x();break;case"COLL":A(),n.set(l.and([o(),g()]),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),p()]),"Regular");break;case"OCLL":A(),b(),n.set(l.and([o(),p()]),"IgnoreNonPrimary");break;case"CLL":A(),n.set(l.not(l.and([p(),o()])),"Dim");break;case"ELL":A(),n.set(o(),"Dim"),n.set(l.and([o(),g()]),"Regular");break;case"ELS":A(),x(),n.set(l.and([o(),p()]),"Ignored"),n.set(m(),"Regular"),n.set(d(),"Ignored");break;case"LL":A();break;case"F2L":n.set(o(),"Ignored");break;case"ZBLL":A(),n.set(o(),"PermuteNonPrimary"),n.set(L(),"Dim"),n.set(l.and([o(),p()]),"Regular");break;case"ZBLS":A(),n.set(F(),"Regular"),x(),n.set(l.and([o(),p()]),"Ignored");break;case"VLS":A(),n.set(F(),"Regular"),x();break;case"WVLS":A(),n.set(F(),"Regular"),n.set(l.and([o(),g()]),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),p()]),"IgnoreNonPrimary");break;case"LS":A(),n.set(F(),"Regular"),n.set(o(),"Ignored"),n.set(L(),"Dim");break;case"EO":n.set(p(),"Ignored"),n.set(g(),"OrientationWithoutPermutation");break;case"EOline":n.set(p(),"Ignored"),n.set(g(),"OrientationWithoutPermutation"),n.set(l.and(l.moves(["D","M"])),"Regular");break;case"EOcross":n.set(g(),"OrientationWithoutPermutation"),n.set(l.move("D"),"Regular"),n.set(p(),"Ignored");break;case"CMLL":n.set(f(),"Dim"),n.set(c(),"Ignored"),n.set(l.and([o(),p()]),"Regular");break;case"L10P":n.set(l.not(c()),"Dim"),n.set(l.and([p(),o()]),"Regular");break;case"L6E":n.set(l.not(c()),"Dim");break;case"L6EO":n.set(l.not(c()),"Dim"),n.set(c(),"OrientationWithoutPermutation"),n.set(l.and([u(),i()]),"OrientationStickers");break;case"Daisy":n.set(l.all(),"Ignored"),n.set(u(),"Dim"),n.set(l.and([l.move("D"),u()]),"Regular"),n.set(l.and([l.move("U"),g()]),"IgnoreNonPrimary");break;case"Cross":n.set(l.all(),"Ignored"),n.set(u(),"Dim"),n.set(l.and([l.move("D"),u()]),"Regular"),n.set(l.and([l.move("D"),g()]),"Regular");break;case"2x2x2":n.set(l.or(l.moves(["U","F","R"])),"Ignored"),n.set(l.and([l.or(l.moves(["U","F","R"])),u()]),"Dim");break;case"2x2x3":n.set(l.all(),"Dim"),n.set(l.or(l.moves(["U","F","R"])),"Ignored"),n.set(l.and([l.or(l.moves(["U","F","R"])),u()]),"Dim"),n.set(l.and([l.move("F"),l.not(l.or(l.moves(["U","R"])))]),"Regular");break;case"Void Cube":n.set(u(),"Invisible");break;case"picture":case"invisible":n.set(l.all(),"Invisible");break;case"centers-only":n.set(l.not(u()),"Ignored");break;default:console.warn(\`Unsupported stickering for \${e.id}: \${t}. Setting all pieces to dim.\`),n.set(l.and(l.moves([])),"Dim")}return n.toAppearance()}async function Wn(){let e=[];for(let[t,r]of Object.entries(ls))r.groups&&"3x3x3"in r.groups&&e.push(t);return e}var Vl=y(()=>{"use strict";ni();os()});function de(e){let t=null;return()=>t??(t=e())}var Et=y(()=>{"use strict"});var Kn,pf=y(()=>{"use strict";Kn=class{constructor(t,r){this.facenames=t;this.prefixFree=!0;this.gripnames=[];r&&(this.gripnames=r);for(let n=0;this.prefixFree&&n<t.length;n++)for(let l=0;this.prefixFree&&l<t.length;l++)n!==l&&t[n].startsWith(t[l])&&(this.prefixFree=!1)}setGripNames(t){this.gripnames=t}splitByFaceNames(t){let r=[],n=0;for(;n<t.length;){n>0&&n<t.length&&t[n]==="_"&&n++;let l=-1;for(let o=0;o<this.facenames.length;o++)t.substr(n).startsWith(this.facenames[o])&&(l<0||this.facenames[o].length>this.facenames[l].length)&&(l=o);if(l>=0)r.push(l),n+=this.facenames[l].length;else throw new Error("Could not split "+t+" into face names.")}return r}joinByFaceIndices(t){let r="",n=[];for(let l=0;l<t.length;l++)n.push(r),n.push(this.facenames[t[l]]),this.prefixFree||(r="_");return n.join("")}spinmatch(t,r){if(t===r)return!0;try{let n=this.splitByFaceNames(t),l=this.splitByFaceNames(r);if(n.length!==l.length&&n.length<3)return!1;for(let o=0;o<n.length;o++){for(let s=0;s<o;s++)if(n[o]===n[s])return!1;let i=!1;for(let s=0;s<l.length;s++)if(n[o]===l[s]){i=!0;break}if(!i)return!1}return!0}catch{return!1}}spinmatchv(t,r){return t.endsWith("v")&&r.endsWith("v")?this.spinmatch(t.slice(0,t.length-1),r.slice(0,r.length-1)):this.spinmatch(t,r)}unswizzle(t){(t.endsWith("v")||t.endsWith("w"))&&t[0]<="Z"&&(t=t.slice(0,t.length-1));let r=t.toUpperCase();for(let n=0;n<this.gripnames.length;n++){let l=this.gripnames[n];if(this.spinmatch(r,l))return l}return t}}});var nn,cf=y(()=>{"use strict";nn=class{notationToInternal(t){return t}notationToExternal(t){return t}}});var Hl,mf=y(()=>{"use strict";Be();Hl=class{constructor(t,r){this.child=t;this.sw=r}notationToInternal(t){return t.family==="T"&&t.innerLayer===void 0&&t.outerLayer===void 0?new B(new z("FLRv",t.innerLayer,t.outerLayer),t.amount):this.child.notationToInternal(t)}notationToExternal(t){let r=t.family;return r.length>0&&r[r.length-1]==="v"&&(r=r.substring(0,r.length-1)),this.sw.spinmatch(r,"FLUR")?new B(new z("T",t.innerLayer,t.outerLayer),t.amount):this.child.notationToExternal(t)}}});var Qn,Lf=y(()=>{"use strict";Be();Qn=class{constructor(t,r){this.internalNames=t;this.externalNames=r}convertString(t,r,n){let l="";(t.endsWith("v")||t.endsWith("v"))&&t<="_"&&(l=t.slice(t.length-1),t=t.slice(0,t.length-1));let o=t.toUpperCase(),i=!1;return t!==o&&(i=!0,t=o),t=n.joinByFaceIndices(r.splitByFaceNames(t)),i&&(t=t.toLowerCase()),t+l}convert(t,r,n){let l=t.family,o=this.convertString(l,r,n);return l===o?t:new B(new z(o,t.innerLayer,t.outerLayer),t.amount)}notationToInternal(t){return this.convert(t,this.externalNames,this.internalNames)}notationToExternal(t){return this.convert(t,this.internalNames,this.externalNames)}}});var Zl,Bf=y(()=>{"use strict";Be();Zl=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer===void 0&&t.outerLayer===void 0){if(Math.abs(t.amount)===1){if(t.family==="R++")return new B(new z("L",3,2),-2*t.amount);if(t.family==="R--")return new B(new z("L",3,2),2*t.amount);if(t.family==="D++")return new B(new z("U",3,2),-2*t.amount);if(t.family==="D--")return new B(new z("U",3,2),2*t.amount);if(t.family==="R_PLUSPLUS_")return new B(new z("L",3,2),-2*t.amount);if(t.family==="D_PLUSPLUS_")return new B(new z("U",3,2),-2*t.amount)}if(t.family==="y")return new B("Uv",t.amount);if(t.family==="x"&&Math.abs(t.amount)===2)return new B("ERv",t.amount/2)}return this.child.notationToInternal(t)}notationToExternal(t){return t.family==="ERv"&&Math.abs(t.amount)===1?new B(new z("x",t.innerLayer,t.outerLayer),t.amount*2):t.family==="ILv"&&Math.abs(t.amount)===1?new B(new z("x",t.innerLayer,t.outerLayer),-t.amount*2):t.family==="Uv"?new B(new z("y",t.innerLayer,t.outerLayer),t.amount):t.family==="Dv"?new B("y",-t.amount):this.child.notationToExternal(t)}}});var Jl,df=y(()=>{"use strict";Be();Jl=class{constructor(t){this.slices=t}notationToInternal(t){let r=t.family;return!t.innerLayer&&!t.outerLayer&&(r==="x"?t=new B("Rv",t.amount):r==="y"?t=new B("Uv",t.amount):r==="z"&&(t=new B("Fv",t.amount)),(this.slices&1)===1&&(r==="E"?t=new B(new z("D",(this.slices+1)/2),t.amount):r==="M"?t=new B(new z("L",(this.slices+1)/2),t.amount):r==="S"&&(t=new B(new z("F",(this.slices+1)/2),t.amount))),this.slices>2&&(r==="e"?t=new B(new z("D",this.slices-1,2),t.amount):r==="m"?t=new B(new z("L",this.slices-1,2),t.amount):r==="s"&&(t=new B(new z("F",this.slices-1,2),t.amount)))),t}notationToExternal(t){let r=t.family;if(!t.innerLayer&&!t.outerLayer){if(r==="Rv")return new B("x",t.amount);if(r==="Uv")return new B("y",t.amount);if(r==="Fv")return new B("z",t.amount);if(r==="Lv")return new B("x",-t.amount);if(r==="Dv")return new B("y",-t.amount);if(r==="Bv")return new B("z",-t.amount)}return t}}});var sL,aL,Rf,hf,Ff,jn,Yl,Df=y(()=>{"use strict";Be();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"},aL={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"},Rf={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},hf=new z("y"),Ff=new z("Dv"),jn=class{constructor(t){this.child=t;this.wcaHack=!1;this.map=sL}notationToInternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){let n=Rf[t.family];if(n)return new B(new z(n,t.innerLayer,t.outerLayer),t.amount)}let r=this.map[t.family];return r?new B(new z(r,t.innerLayer,t.outerLayer),t.amount):hf.isIdentical(t.quantum)?new B(Ff,-t.amount):null}notationToExternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){for(let[r,n]of Object.entries(Rf))if(this.child.spinmatch(t.family,n))return new B(new z(r,t.innerLayer,t.outerLayer),t.amount)}for(let[r,n]of Object.entries(this.map))if(this.child.spinmatch(t.family,n))return new B(new z(r,t.innerLayer,t.outerLayer),t.amount);return Ff.isIdentical(t.quantum)?new B(hf,-t.amount):null}},Yl=class extends jn{constructor(r){super(r);this.wcaHack=!0;this.map=aL}}});var Af,is,yf,fL,ss,Uf,uL,as,Sf,gL,Xl,xf=y(()=>{"use strict";Be();Af={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"},is=new z("x"),yf=new z("Rv"),fL=new z("Lv"),ss=new z("y"),Uf=new z("Uv"),uL=new z("Dv"),as=new z("z"),Sf=new z("Fv"),gL=new z("Bv"),Xl=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer||t.outerLayer)return null;let r=Af[t.family];return r?new B(new z(r,t.outerLayer,t.innerLayer),t.amount):is.isIdentical(t.quantum)?new B(yf,t.amount):ss.isIdentical(t.quantum)?new B(Uf,t.amount):as.isIdentical(t.quantum)?new B(Sf,t.amount):null}notationToExternal(t){for(let[r,n]of Object.entries(Af))if(this.child.spinmatchv(t.family,n))return new B(new z(r,t.innerLayer,t.outerLayer),t.amount);return yf.isIdentical(t.quantum)?new B(is,t.amount):fL.isIdentical(t.quantum)?new B(is,-t.amount):Uf.isIdentical(t.quantum)?new B(ss,t.amount):uL.isIdentical(t.quantum)?new B(ss,-t.amount):Sf.isIdentical(t.quantum)?new B(as,t.amount):gL.isIdentical(t.quantum)?new B(as,-t.amount):null}}});var fs=y(()=>{"use strict";cf();mf();Lf();Bf();df();Df();xf()});function bf(e){let t=0,r={};for(;t<e.length&&e[t][0]==="-";){let l=e[t++];if(l==="--rotations")r.addRotations=!0;else if(l==="--allmoves")r.allMoves=!0;else if(l==="--outerblockmoves")r.outerBlockMoves=!0;else if(l==="--vertexmoves")r.vertexMoves=!0;else if(l==="--nocorners")r.includeCornerOrbits=!1;else if(l==="--noedges")r.includeEdgeOrbits=!1;else if(l==="--noorientation")r.fixedOrientation=!0;else if(l==="--nocenters")r.includeCenterOrbits=!1;else if(l==="--omit")r.excludeOrbits=e[t].split(","),t++;else if(l==="--moves")r.moveList=e[t].split(","),t++;else if(l==="--optimize")r.optimizeOrbits=!0;else if(l==="--scramble")r.scrambleAmount=100;else if(l==="--fixcorner")r.fixedPieceType="v";else if(l==="--fixedge")r.fixedPieceType="e";else if(l==="--fixcenter")r.fixedPieceType="f";else if(l==="--orientcenters")r.orientCenters=!0;else if(l==="--puzzleorientation")r.puzzleOrientation=JSON.parse(e[t]),t++;else throw new Error("Bad option: "+l)}return{puzzleDescription:$l(e.slice(t).join(" ")),options:r}}var li,us=y(()=>{"use strict";eo();li=class{constructor(t={}){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,t)}}});function Dr(e){if(!gs[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=0;gs[e]=t}return gs[e]}function Wt(e){if(!ps[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;ps[e]=t}return ps[e]}function wf(e){return new Bt(Wt(e))}function Ef(e){let t=BigInt(1);for(;e>1;)t*=BigInt(e),e--;return t}function pL(e,t){if(e>t){let r=e;e=t,t=r}for(;e>0;){let r=t%e;t=e,e=r}return t}function cs(e,t){return e/pL(e,t)*t}var gs,ps,Bt,oi=y(()=>{"use strict";gs=[],ps=[];Bt=class{constructor(t){this.n=t.length,this.p=t}toString(){return"Perm["+this.p.join(" ")+"]"}mul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=t.p[this.p[n]];return new Bt(r)}rmul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=this.p[t.p[n]];return new Bt(r)}inv(){let t=Array(this.n);for(let r=0;r<this.n;r++)t[this.p[r]]=r;return new Bt(t)}compareTo(t){for(let r=0;r<this.n;r++)if(this.p[r]!==t.p[r])return this.p[r]-t.p[r];return 0}toGap(){let t=new Array,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=new Array;for(let o=n;!r[o];o=this.p[o])l.push(1+o),r[o]=!0;t.push("("+l.join(",")+")")}return t.join("")}order(){let t=1,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=0;for(let o=n;!r[o];o=this.p[o])l++,r[o]=!0;t=cs(t,l)}return t}}});function ii(e,t){let r=B.fromString(t),n=e.notationToExternal(r);return n===null||r===n?t:n.toString()}function vf(e,t){let r=e.moveops.length;if(r>30)throw new Error("Canon info too big for bitmask");let n=[],l=[];for(let i=0;i<r;i++){let s=e.moveops[i];n.push(s.order());let a=0;for(let f=0;f<r;f++){if(f===i)continue;let u=e.moveops[f];s.mul(u).equal(u.mul(s))&&(a|=1<<f)}l.push(a)}let o={};o[0]=1;for(let i=0;i<100;i++){let s=0,a={},f=0;for(let u in o){let g=+u,p=o[g];s+=p,f++;for(let c=0;c<n.length;c++)if((g>>c&1)===0&&(g&l[c]&(1<<c)-1)===0){let L=g&l[c]|1<<c;a[L]===void 0&&(a[L]=0),a[L]+=(n[c]-1)*p}}t(\`\${i}: canonseq \${s} states \${f}\`),o=a}}var qn,cL,ln,vt,Kt,si,tr,on,ai,_f=y(()=>{"use strict";Be();fs();oi();qn=class{constructor(t,r){this.size=t;this.mod=r}reassemblySize(){return Ef(this.size)*BigInt(this.mod)**BigInt(this.size)}},cL=0;ln=class{constructor(t,r,n,l,o,i,s){this.orbitnames=t;this.orbitdefs=r;this.solved=n;this.movenames=l;this.moveops=o;this.isRotation=i;this.forcenames=s}transformToKTransformationData(t){let r={};for(let n=0;n<this.orbitnames.length;n++)r[this.orbitnames[n]]=t.orbits[n].toKPuzzle();return r}static transformToKTransformationData(t,r){let n={};for(let l=0;l<t.length;l++)n[t[l]]=r.orbits[l].toKPuzzle();return n}describeSet(t,r,n){let l=this.orbitdefs[t].size,o=new Array(l);for(let i=0;i<l;i++)o[i]=[];for(let i=0;i<this.movenames.length;i++){if(this.isRotation[i])continue;let s=this.movenames[i];this.forcenames[i]||(s=ii(n,s),s[s.length-1]==="'"&&(s=s.substring(0,s.length-1)));let a=this.moveops[i].orbits[t];for(let f=0;f<l;f++)(a.perm[f]!=f||a.ori[f]!=0)&&o[f].push(s)}for(let i=0;i<l;i++)r.push("# "+(i+1)+" "+o[i].join(" "))}toKsolve(t,r=new nn){let n=[];n.push("Name "+t),n.push("");for(let l=0;l<this.orbitnames.length;l++)n.push(\`Set \${this.orbitnames[l]} \${this.orbitdefs[l].size} \${this.orbitdefs[l].mod}\`),this.describeSet(l,n,r);n.push(""),n.push("Solved");for(let l=0;l<this.orbitnames.length;l++)this.solved.orbits[l].appendDefinition(n,this.orbitnames[l],!1,!1);n.push("End");for(let l=0;l<this.movenames.length;l++){n.push("");let o=this.movenames[l];this.forcenames[l]||(o=ii(r,this.movenames[l]));let i=!1;o[o.length-1]==="'"&&(i=!0,o=o.substring(0,o.length-1)),n.push("Move "+o);for(let s=0;s<this.orbitnames.length;s++)i?this.moveops[l].orbits[s].inv().appendDefinition(n,this.orbitnames[s],!0):this.moveops[l].orbits[s].appendDefinition(n,this.orbitnames[s],!0);n.push("End")}return n}toKPuzzleDefinition(t){let r={},n={};for(let o=0;o<this.orbitnames.length;o++){r[this.orbitnames[o]]={numPieces:this.orbitdefs[o].size,numOrientations:this.orbitdefs[o].mod};let i=this.solved.orbits[o].toKPuzzle();n[this.orbitnames[o]]={pieces:i.permutation,orientation:i.orientation}}let l={};if(t)for(let o=0;o<this.movenames.length;o++)l[this.movenames[o]]=this.transformToKTransformationData(this.moveops[o]);return{name:\`PG3D #\${++cL}\`,orbits:r,startStateData:n,moves:l}}optimize(){let t=[],r=[],n=[],l=[];for(let o=0;o<this.moveops.length;o++)l.push([]);for(let o=0;o<this.orbitdefs.length;o++){let i=this.orbitdefs[o].mod,s=this.orbitdefs[o].size,a=new ai(s),f=new Array(this.orbitdefs[o].size);for(let c=0;c<s;c++)f[c]=!1;for(let c=0;c<this.moveops.length;c++)if(!this.isRotation[c])for(let L=0;L<s;L++)(this.moveops[c].orbits[o].perm[L]!==L||this.moveops[c].orbits[o].ori[L]!==0)&&(f[L]=!0,a.union(L,this.moveops[c].orbits[o].perm[L]));let u=!0;if(i>1){u=!1;let c=new ai(this.orbitdefs[o].size*i);for(let L=0;L<this.moveops.length;L++)for(let m=0;m<s;m++)if(this.moveops[L].orbits[o].perm[m]!==m||this.moveops[L].orbits[o].ori[m]!==0)for(let d=0;d<i;d++)c.union(m*i+d,this.moveops[L].orbits[o].perm[m]*i+(d+this.moveops[L].orbits[o].ori[m])%i);for(let L=0;!u&&L<s;L++)for(let m=1;m<i;m++)c.find(L*i)===c.find(L*i+m)&&(u=!0);for(let L=0;!u&&L<s;L++)for(let m=0;m<L;m++)this.solved.orbits[o].perm[L]===this.solved.orbits[o].perm[m]&&(u=!0)}let g=-1,p=!1;for(let c=0;c<this.orbitdefs[o].size;c++)if(f[c]){let L=a.find(c);g<0?g=L:g!==L&&(p=!0)}for(let c=0;c<this.orbitdefs[o].size;c++){if(!f[c]||a.find(c)!==c)continue;let m=[],d=[],F=0;for(let A=0;A<this.orbitdefs[o].size;A++)a.find(A)===c&&(m[F]=A,d[A]=F,F++);if(p?t.push(\`\${this.orbitnames[o]}_p\${c}\`):t.push(this.orbitnames[o]),u){r.push(new qn(F,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(m,F));for(let A=0;A<this.moveops.length;A++)l[A].push(this.moveops[A].orbits[o].remap(m,d,F))}else{r.push(new qn(F,1)),n.push(this.solved.orbits[o].remapVS(m,F).killOri());for(let A=0;A<this.moveops.length;A++)l[A].push(this.moveops[A].orbits[o].remap(m,d,F).killOri())}}}return new ln(t,r,new on(n),this.movenames,l.map(o=>new tr(o)),this.isRotation,this.forcenames)}scramble(t){this.solved=this.solved.mul(this.getScrambleTransformation(t))}getScrambleTransformation(t){t<100&&(t=100);let r=[];for(let l=0;l<this.moveops.length;l++)r[l]=this.moveops[l];for(let l=0;l<r.length;l++){let o=Math.floor(Math.random()*r.length),i=r[l];r[l]=r[o],r[o]=i}t<r.length&&(t=r.length);for(let l=0;l<t;l++){let o=Math.floor(Math.random()*r.length),i=Math.floor(Math.random()*r.length),s=Math.floor(Math.random()*this.moveops.length);r[o]=r[o].mul(r[i]).mul(this.moveops[s]),Math.random()<.1&&(r[o]=r[o].mul(this.moveops[s]))}let n=r[0];for(let l=1;l<r.length;l++)n=n.mul(r[l]);return n}reassemblySize(){let t=BigInt(1);for(let r=0;r<this.orbitdefs.length;r++)t*=this.orbitdefs[r].reassemblySize();return t}},vt=class{constructor(t,r,n){this.perm=t;this.ori=r;this.orimod=n}static e(t,r){return new vt(Wt(t),Dr(t),r)}mul(t){let r=this.perm.length,n=new Array(r);if(this.orimod===1){for(let l=0;l<r;l++)n[l]=this.perm[t.perm[l]];return new vt(n,this.ori,this.orimod)}else{let l=new Array(r);for(let o=0;o<r;o++)n[o]=this.perm[t.perm[o]],l[o]=(this.ori[t.perm[o]]+t.ori[o])%this.orimod;return new vt(n,l,this.orimod)}}inv(){let t=this.perm.length,r=new Array(t),n=new Array(t);for(let l=0;l<t;l++)r[this.perm[l]]=l,n[this.perm[l]]=(this.orimod-this.ori[l])%this.orimod;return new vt(r,n,this.orimod)}equal(t){let r=this.perm.length;for(let n=0;n<r;n++)if(this.perm[n]!==t.perm[n]||this.ori[n]!==t.ori[n])return!1;return!0}killOri(){let t=this.perm.length;for(let r=0;r<t;r++)this.ori[r]=0;return this.orimod=1,this}toPerm(){let t=this.orimod;if(t===1)return new Bt(this.perm);let r=this.perm.length,n=new Array(r*t);for(let l=0;l<r;l++)for(let o=0;o<t;o++)n[l*t+o]=t*this.perm[l]+(this.ori[l]+o)%t;return new Bt(n)}identicalPieces(){let t=[],r=this.perm.length,n=[];for(let l=0;l<r;l++){let o=this.perm[l];if(t[o]===void 0){let i=[l];t[o]=!0;for(let s=l+1;s<r;s++)this.perm[s]===o&&i.push(s);n.push(i)}}return n}order(){return this.toPerm().order()}isIdentity(){let t=this.perm.length;if(this.perm===Wt(t)&&this.ori===Dr(t))return!0;for(let r=0;r<t;r++)if(this.perm[r]!==r||this.ori[r]!==0)return!1;return!0}zeroOris(){let t=this.perm.length;if(this.ori===Dr(t))return!0;for(let r=0;r<t;r++)if(this.ori[r]!==0)return!1;return!0}remap(t,r,n){let l=new Array(n),o=new Array(n);for(let i=0;i<n;i++)l[i]=r[this.perm[t[i]]],o[i]=this.ori[t[i]];return new vt(l,o,this.orimod)}remapVS(t,r){let n=new Array(r),l=new Array(r),o=0,i=[];for(let s=0;s<r;s++){let a=this.perm[t[s]];i[a]===void 0&&(i[a]=o++),n[s]=i[a],l[s]=this.ori[t[s]]}return new vt(n,l,this.orimod)}appendDefinition(t,r,n,l=!0){if(!(l&&this.isIdentity())&&(t.push(r),t.push(this.perm.map(o=>o+1).join(" ")),!this.zeroOris()))if(n){let o=new Array(this.ori.length);for(let i=0;i<o.length;i++)o[this.perm[i]]=this.ori[i];t.push(o.join(" "))}else t.push(this.ori.join(" "))}toKPuzzle(){let t=this.perm.length;return this.isIdentity()?(vt.kcache[t]||(vt.kcache[t]={permutation:Wt(t),orientation:Dr(t)}),vt.kcache[t]):{permutation:this.perm,orientation:this.ori}}},Kt=vt;Kt.kcache=[];si=class{constructor(t){this.orbits=t}internalMul(t){let r=[];for(let n=0;n<this.orbits.length;n++)r.push(this.orbits[n].mul(t.orbits[n]));return r}internalInv(){let t=[];for(let r of this.orbits)t.push(r.inv());return t}equal(t){for(let r=0;r<this.orbits.length;r++)if(!this.orbits[r].equal(t.orbits[r]))return!1;return!0}killOri(){for(let t of this.orbits)t.killOri();return this}toPerm(){let t=new Array,r=0;for(let l of this.orbits){let o=l.toPerm();t.push(o),r+=o.n}let n=new Array(r);r=0;for(let l of t){for(let o=0;o<l.n;o++)n[r+o]=r+l.p[o];r+=l.n}return new Bt(n)}identicalPieces(){let t=[],r=0;for(let n of this.orbits){let l=n.orimod,o=n.identicalPieces();for(let i=0;i<o.length;i++)t.push(o[i].map(s=>s*l+r));r+=l*n.perm.length}return t}order(){let t=1;for(let r of this.orbits)t=cs(t,r.order());return t}},tr=class extends si{constructor(t){super(t)}mul(t){return new tr(this.internalMul(t))}mulScalar(t){if(t===0)return this.e();let r=this;for(t<0&&(r=r.inv(),t=-t);(t&1)===0;)r=r.mul(r),t>>=1;if(t===1)return r;let n=r,l=this.e();for(;t>0;)t&1&&(l=l.mul(n)),t>1&&(n=n.mul(n)),t>>=1;return l}inv(){return new tr(this.internalInv())}e(){return new tr(this.orbits.map(t=>Kt.e(t.perm.length,t.orimod)))}},on=class extends si{constructor(t){super(t)}mul(t){return new on(this.internalMul(t))}},ai=class{constructor(t){this.n=t;this.heads=new Array(t);for(let r=0;r<t;r++)this.heads[r]=r}find(t){let r=this.heads[t];return this.heads[r]===r||(r=this.find(this.heads[r]),this.heads[t]=r),r}union(t,r){let n=this.find(t),l=this.find(r);n<l?this.heads[l]=n:n>l&&(this.heads[n]=l)}}});var fi,kf=y(()=>{"use strict";fi={"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 ui(e){let t=new W(0,0,0,0);for(let r=0;r<e.length;r++)t=t.sum(e[r]);return t.smul(1/e.length)}function zf(e,t,r,n){let l=n[e].intersect3(n[t],n[r]);if(!l)return l;for(let o=0;o<n.length;o++)if(o!==e&&o!==t&&o!==r){let i=n[o].b*l.b+n[o].c*l.c+n[o].d*l.d;if(n[o].a>0&&i>n[o].a||n[o].a<0&&i<n[o].a)return!1}return l}var W,gi=y(()=>{"use strict";W=class{constructor(t,r,n,l){this.a=t;this.b=r;this.c=n;this.d=l}mul(t){return new W(this.a*t.a-this.b*t.b-this.c*t.c-this.d*t.d,this.a*t.b+this.b*t.a+this.c*t.d-this.d*t.c,this.a*t.c-this.b*t.d+this.c*t.a+this.d*t.b,this.a*t.d+this.b*t.c-this.c*t.b+this.d*t.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(t){return Math.hypot(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(t){return new W(0,this.c*t.d-this.d*t.c,this.d*t.b-this.b*t.d,this.b*t.c-this.c*t.b)}dot(t){return this.b*t.b+this.c*t.c+this.d*t.d}normalize(){let t=Math.sqrt(this.dot(this));return new W(this.a/t,this.b/t,this.c/t,this.d/t)}makenormal(){return new W(0,this.b,this.c,this.d).normalize()}normalizeplane(){let t=Math.hypot(this.b,this.c,this.d);return new W(this.a/t,this.b/t,this.c/t,this.d/t)}smul(t){return new W(this.a*t,this.b*t,this.c*t,this.d*t)}sum(t){return new W(this.a+t.a,this.b+t.b,this.c+t.c,this.d+t.d)}sub(t){return new W(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new W(this.a,-this.b,-this.c,-this.d)}det3x3(t,r,n,l,o,i,s,a,f){return t*(o*f-i*a)+r*(i*s-l*f)+n*(l*a-o*s)}rotateplane(t){let r=t.mul(new W(0,this.b,this.c,this.d)).mul(t.invrot());return r.a=this.a,r}orthogonal(){let t=Math.abs(this.b),r=Math.abs(this.c),n=Math.abs(this.d);return t<r&&t<n?this.cross(new W(0,1,0,0)).normalize():r<t&&r<n?this.cross(new W(0,0,1,0)).normalize():this.cross(new W(0,0,0,1)).normalize()}pointrotation(t){let r=this.normalize();if(t=t.normalize(),r.sub(t).len()<1e-9)return new W(1,0,0,0);let n=r.sum(t);n.len()<1e-9?n=n.orthogonal():n=n.normalize();let l=r.cross(n);return l.a=r.dot(n),l}unproject(t){return this.sum(t.smul(-this.dot(t)/(this.len()*t.len())))}rotatepoint(t){return t.mul(this).mul(t.invrot())}rotateface(t){return t.map(r=>r.rotatepoint(this))}intersect3(t,r){let n=this.det3x3(this.b,this.c,this.d,t.b,t.c,t.d,r.b,r.c,r.d);return Math.abs(n)<1e-9?!1:new W(0,this.det3x3(this.a,this.c,this.d,t.a,t.c,t.d,r.a,r.c,r.d)/n,this.det3x3(this.b,this.a,this.d,t.b,t.a,t.d,r.b,r.a,r.d)/n,this.det3x3(this.b,this.c,this.a,t.b,t.c,t.a,r.b,r.c,r.a)/n)}side(t){return t>1e-9?1:t<-1e-9?-1:0}cutface(t){let r=this.a,n=0,l=null;for(let o=0;o<t.length;o++)n|=1<<this.side(t[o].dot(this)-r)+1;if((n&5)===5){l=[];let o=t.map(i=>this.side(i.dot(this)-r));for(let i=-1;i<=1;i+=2){let s=[];for(let a=0;a<t.length;a++){(o[a]===i||o[a]===0)&&s.push(t[a]);let f=(a+1)%t.length;if(o[a]+o[f]===0&&o[a]!==0){let u=t[a].dot(this)-r,g=t[f].dot(this)-r,p=u/(u-g),c=t[a].smul(1-p).sum(t[f].smul(p));s.push(c)}}l.push(s)}}return l}cutfaces(t){let r=[];for(let n=0;n<t.length;n++){let l=t[n],o=this.cutface(l);o?(r.push(o[0]),r.push(o[1])):r.push(l)}return r}faceside(t){let r=this.a;for(let n=0;n<t.length;n++){let l=this.side(t[n].dot(this)-r);if(l!==0)return l}throw new Error("Could not determine side of plane in faceside")}sameplane(t){let r=this.normalize(),n=t.normalize();return r.dist(n)<1e-9||r.dist(n.smul(-1))<1e-9}makecut(t){return new W(t,this.b,this.c,this.d)}}});function Cf(){let e=Math.sqrt(.5);return[new W(e,e,0,0),new W(e,0,e,0)]}function Pf(){return[new W(.5,.5,.5,.5),new W(.5,.5,.5,-.5)]}function Nf(){let e=2*Math.PI/10,t=.5+.3*Math.sqrt(5),r=.5+.1*Math.sqrt(5),n=Math.sqrt(t*t+r*r);return t/=n,r/=n,[new W(Math.cos(e),t*Math.sin(e),r*Math.sin(e),0),new W(.5,.5,.5,.5)]}function Mf(){let e=.16666666666666666+Math.sqrt(5)/6,t=2/3+Math.sqrt(5)/3,r=Math.sqrt(e*e+t*t);e/=r,t/=r;let n=2*Math.PI/6;return[new W(Math.cos(n),e*Math.sin(n),t*Math.sin(n),0),new W(Math.cos(n),-e*Math.sin(n),t*Math.sin(n),0)]}function Gf(){let e=Math.sqrt(.5);return[new W(.5,.5,.5,.5),new W(e,0,0,e)]}function Of(e){let t=[new W(1,0,0,0)];for(let r=0;r<t.length;r++)for(let n=0;n<e.length;n++){let l=e[n].mul(t[r]),o=l.smul(-1),i=!1;for(let s=0;s<t.length;s++)if(l.dist(t[s])<pi||o.dist(t[s])<pi){i=!0;break}i||t.push(l)}return t}function ms(e,t){let r=[],n=[];for(let l=0;l<t.length;l++){let o=e.rotateplane(t[l]),i=!1;for(let s=0;s<r.length;s++)if(o.dist(r[s])<pi){i=!0;break}i||(r.push(o),n.push(t[l]))}return n}function Ls(e){let t=[];for(let r=1;r<e.length;r++)for(let n=r+1;n<e.length;n++){let l=zf(0,r,n,e);if(l){let o=!1;for(let i=0;i<t.length;i++)if(l.dist(t[i])<pi){o=!0;break}o||t.push(l)}}for(;;){let r=!1;for(let n=0;n<t.length;n++){let l=(n+1)%t.length;if(e[0].dot(t[n].cross(t[l]))<0){let o=t[n];t[n]=t[l],t[l]=o,r=!0}}if(!r)break}return t}var pi,Tf=y(()=>{"use strict";gi();pi=1e-9});function ci(e,t){let r=e[0].p.length,n=wf(r),l=[],o=[],i=[],s=[],a=[];function f(c){for(let L=c.p.length-1;L>=0;L--){let m=c.p[L];if(m!==L){if(!l[L][m])return!1;c=c.mul(o[L][m])}}return!0}function u(c,L,m){s[c].push(L),a[c].push(m);for(let d=0;d<l[c].length;d++)l[c][d]&&g(c,l[c][d].mul(L),m+i[c][d])}function g(c,L,m){let d=L.p[c];if(!l[c][d]){l[c][d]=L,o[c][d]=L.inv(),i[c][d]=m;for(let A=0;A<s[c].length;A++)g(c,L.mul(s[c][A]),m+a[c][A]);return}let F=L.mul(o[c][d]);f(F)||u(c-1,F,m+i[c][d])}function p(){l=[],o=[],s=[],i=[],a=[];for(let m=0;m<r;m++)l.push([]),o.push([]),i.push([]),s.push([]),a.push([]),l[m][m]=n,o[m][m]=n,i[m][m]=0;let c=0,L=BigInt(1);for(let m=0;m<e.length;m++){u(r-1,e[m],1),L=BigInt(1);let d=0,F=0,A=[],U=new Bs;for(let x=0;x<r;x++){let b=0,N=0;for(let C=0;C<r;C++)l[x][C]&&(b++,N+=i[x][C],x!==C&&c++);d+=s[x].length,L*=BigInt(b),b>1&&U.multiply(b);let J=N/b;A.push(J),F+=J}t(\`\${m}: sz \${L} T \${d} sol \${F} none \${c} mults \${U.toString()}\`)}return L}return p()}var Bs,ds=y(()=>{"use strict";oi();Bs=class{constructor(){this.mult=[]}multiply(t){for(let r=2;r*r<=t;r++)for(;t%r===0;)this.mult[r]!==void 0?this.mult[r]++:this.mult[r]=1,t/=r;t>1&&(this.mult[t]!==void 0?this.mult[t]++:this.mult[t]=1)}toString(){let t="";for(let r=0;r<this.mult.length;r++)this.mult[r]!==void 0&&(t!==""&&(t+="*"),t+=r,this.mult[r]>1&&(t+=\`^\${this.mult[r]}\`));return t}}});function mL(e,t){let r=[];for(let n of e)for(let l of t)r.push(l.rotate(n));return r}function dL(){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 RL(){return{4:{F:"#00ff00",D:"#ffff00",L:"#ff0000",R:"#0000ff"},6:{U:"#ffffff",F:"#00ff00",R:"#ff0000",D:"#ffff00",B:"#0000ff",L:"#ff8000"},8:{U:"#ffffff",F:"#ff0000",R:"#00bb00",D:"#ffff00",BB:"#1122ff",L:"#9524c5",BL:"#ff8800",BR:"#aaaaaa"},12:{U:"#ffffff",F:"#006633",R:"#ff0000",C:"#ffffd0",A:"#3399ff",L:"#660099",E:"#ff66cc",BF:"#99ff00",BR:"#0000ff",BL:"#ffff00",I:"#ff6633",D:"#999999"},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 FL(){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 mi(e,t){for(let r=0;r<e.length;r++)if(e[r][0].dist(t)<we)return r;throw new Error("Element not found")}function If(){return fi}function Wf(e){return fi[e]}function $l(e){let t=e.split(/ /).filter(Boolean);if(t.length%2===0)return null;let r=t[0];if(r!=="o"&&r!=="c"&&r!=="i"&&r!=="d"&&r!=="t")return null;let n=[];for(let l=1;l<t.length;l+=2){if(t[l]!=="f"&&t[l]!=="v"&&t[l]!=="e")return null;n.push({cutType:t[l],distance:parseFloat(t[l+1])})}return{shape:r,cuts:n}}function hs(e,t={}){let r=$l(e);if(r===null)throw new Error("Could not parse the puzzle description");let n=new to(r,Object.assign({},{allMoves:!0},t));return n.allstickers(),n.genperms(),n}function jf(e,t){return hs(fi[e],t)}function DL(e,t,r){let n=!1;r-t[1]<t[0]&&(e=[e[2],e[3],e[0],e[1]],t=[r-t[1],r-t[0]],n=!0);let l=e[0],o="";if(t[0]===0&&t[1]===r)l=l+"v";else if(t[0]===t[1])t[1]>0&&(o=String(t[1]+1));else if(t[0]===0)l=l.toLowerCase(),t[1]>1&&(o=String(t[1]+1));else throw new Error(\`We only support slice and outer block moves right now. \${t}\`);return[o+l,n]}function AL(e,t){let r=[],n=0;for(;n<e.length;){n>0&&n<e.length&&e[n]==="_"&&n++;let l="";for(let o of t)e.substr(n).startsWith(o[1])&&o[1].length>l.length&&(l=o[1]);if(l!=="")r.push(l),n+=l.length;else throw new Error("Could not split "+e+" into face names.")}return r}function Li(e,t){return[e.b/t,-e.c/t,e.d/t]}function Rs(e,t){let r=[],n=e.length;for(let l=0;l<n;l++){let o=Li(e.get(n-l-1),t);r[3*l]=o[0],r[3*l+1]=o[1],r[3*l+2]=o[2]}return r}var Ar,Vn,we,LL,BL,hL,Kf,Qf,to,Bi,eo=y(()=>{"use strict";Be();pf();fs();us();oi();_f();kf();Tf();gi();ds();Ar=class{constructor(t){this.coords=new Array(t.length*3);for(let r=0;r<t.length;r++)this.coords[3*r]=t[r].b,this.coords[3*r+1]=t[r].c,this.coords[3*r+2]=t[r].d;this.length=t.length}get(t){return new W(0,this.coords[3*t],this.coords[3*t+1],this.coords[3*t+2])}centermass(){let t=0,r=0,n=0;for(let l=0;l<this.length;l++)t+=this.coords[3*l],r+=this.coords[3*l+1],n+=this.coords[3*l+2];return new W(0,t/this.length,r/this.length,n/this.length)}rotate(t){let r=[];for(let n=0;n<this.length;n++)r.push(this.get(n).rotatepoint(t));return new Ar(r)}rotateforward(){let t=[];for(let r=1;r<this.length;r++)t.push(this.get(r));return t.push(this.get(0)),new Ar(t)}},Vn=class{constructor(t,r,n){this.face=t;this.left=r;this.right=n}split(t){let r=t.cutface(this.face);return r!==null&&(this.left===void 0?(this.left=new Vn(r[0]),this.right=new Vn(r[1])):(this.left=this.left?.split(t),this.right=this.right?.split(t))),this}collect(t,r){return this.left===void 0?t.push(new Ar(this.face)):r?(this.left?.collect(t,!1),this.right?.collect(t,!0)):(this.right?.collect(t,!1),this.left?.collect(t,!0)),t}};we=1e-9,LL="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",BL=!1;hL={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"]}};Kf=["c","t","o","d","i"],Qf=["f","v","e"];to=class{constructor(t,r){this.puzzleDescription=t;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.notationMapper=new nn;this.addNotationMapper="";this.setReidOrder=!1;let n="genperms";this.options=new li(r),this.options.verbosity>0&&console.log(this.header("# ")),this.create(t)}create(t){let{shape:r,cuts:n}=t;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let l=null;switch(r){case"c":l=Cf();break;case"o":l=Gf();break;case"i":l=Mf();break;case"t":l=Pf();break;case"d":l=Nf();break;default:throw new Error("Bad shape argument: "+r)}this.rotations=Of(l),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let o=l[0];this.baseplanerot=ms(o,this.rotations);let i=this.baseplanerot.map(D=>o.rotateplane(D));this.baseplanes=i,this.baseFaceCount=i.length;let s=dL()[i.length];this.net=s,this.colors=RL()[i.length],this.options.verbosity>0&&console.log("# Base planes: "+i.length);let a=Ls(i),f=new W(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+a.length);let u=i[0].makenormal(),g=a[0].sum(a[1]).makenormal(),p=a[0].makenormal(),c=new W(1,u.b,u.c,u.d);this.options.verbosity>0&&console.log("# Boundary is "+c);let m=ms(c,this.rotations).map(D=>c.rotateplane(D)),d=Ls(m);this.edgedistance=d[0].sum(d[1]).smul(.5).dist(f),this.vertexdistance=d[0].dist(f);let F=[],A=[],U=!1,x=!1,b=!1;for(let D of n){let _=null,T=0;switch(D.cutType){case"f":_=u,T=1,U=!0;break;case"v":_=p,T=this.vertexdistance,b=!0;break;case"e":_=g,T=this.edgedistance,x=!0;break;default:throw new Error("Bad cut argument: "+D.cutType)}F.push(_.makecut(D.distance)),A.push(D.distance<T)}this.options.addRotations&&(U||F.push(u.makecut(10)),b||F.push(p.makecut(10)),x||F.push(g.makecut(10))),this.basefaces=[];for(let D of this.baseplanerot){let _=D.rotateface(d);this.basefaces.push(new Ar(_))}let N=[],J=[],C=[],Q=[],S=d.length;function k(D,_,T){for(let G of D)if(G[0].dist(_)<we){G.push(T);return}D.push([_,T])}for(let D=0;D<this.baseplanerot.length;D++){let _=this.baseplanerot[D].rotateface(d);for(let T=0;T<_.length;T++){let G=(T+1)%_.length,$=_[T].sum(_[G]).smul(.5);k(Q,$,D)}}let P=[];for(let D=0;D<this.baseplanerot.length;D++){let _=this.baseplanerot[D].rotateface(d),T=[];for(let G=0;G<_.length;G++){let $=(G+1)%_.length,se=_[G].sum(_[$]).smul(.5),Ne=Q[mi(Q,se)];if(D===Ne[1])T.push(Ne[2]);else if(D===Ne[2])T.push(Ne[1]);else throw new Error("Could not find edge")}P.push(T)}let w={},E=[];E.push(s[0][0]),w[s[0][0]]=0,E[P[0][0]]=s[0][1],w[s[0][1]]=P[0][0];for(let D of s){let _=D[0],T=w[_];if(T===void 0)throw new Error("Bad edge description; first edge not connected");let G=-1;for(let $=0;$<P[T].length;$++){let se=E[P[T][$]];if(se!==void 0&&se===D[1]){G=$;break}}if(G<0)throw new Error("First element of a net not known");for(let $=2;$<D.length;$++){if(D[$]==="")continue;let se=P[T][($+G-1)%S],Ne=E[se];if(Ne!==void 0&&Ne!==D[$])throw new Error("Face mismatch in net");E[se]=D[$],w[D[$]]=se}}for(let D=0;D<this.baseplanerot.length;D++){let _=this.baseplanerot[D].rotateface(d),T=c.rotateplane(this.baseplanerot[D]),G=E[D];N.push([_,G]),J.push([T,G])}for(let D=0;D<this.baseplanerot.length;D++){let _=this.baseplanerot[D].rotateface(d),T=E[D];for(let G=0;G<_.length;G++){let $=(G+1)%_.length,se=_[G].sum(_[$]).smul(.5),Ne=(G+2)%_.length,hm=_[$].sum(_[Ne]).smul(.5),Fm=mi(Q,se),Dm=mi(Q,hm);k(C,_[$],[T,Dm,Fm])}}this.swizzler=new Kn(N.map(D=>D[1]));let M=this.swizzler.prefixFree?"":"_",j=hL[this.baseFaceCount],q=[];for(let D=0;D<this.baseFaceCount;D++)q[1<<D]=D;{let D=j.v;for(let _ of D){let T=this.swizzler.splitByFaceNames(_),G=0;for(let $ of T)G|=1<<$;q[G]=T[0]}}{let D=j.e;for(let _ of D){let T=this.swizzler.splitByFaceNames(_),G=0;for(let $ of T)G|=1<<$;q[G]=T[0]}}{let D=j.c;for(let _ of D){let T=this.swizzler.splitByFaceNames(_),G=1<<T[0]|1<<this.baseFaceCount;q[G]=T[1]}}for(let D=0;D<Q.length;D++){if(Q[D].length!==3)throw new Error("Bad length in edge names "+Q[D]);let _=Q[D][1],T=Q[D][2],G=E[_],$=E[T],se=1<<_|1<<T;q[se]==_?G=G+M+$:G=$+M+G,Q[D]=[Q[D][0],G]}for(let D=0;D<C.length;D++){let _=0;if(C[D].length<4)throw new Error("Bad length in vertex names");for(let se=1;se<C[D].length;se++)_|=1<<w[C[D][se][0]];let T=q[_],G=-1;for(let se=1;se<C[D].length;se++)T===w[C[D][se][0]]&&(G=se);if(G<0)throw new Error("Internal error; couldn't find face name when fixing corners");let $="";for(let se=1;se<C[D].length;se++){se===1?$=C[D][G][0]:$=$+M+C[D][G][0];for(let Ne=1;Ne<C[D].length;Ne++)if(C[D][G][1]===C[D][Ne][2]){G=Ne;break}}C[D]=[C[D][0],$]}this.markedface=q,this.options.verbosity>1&&(console.log("# Face names: "+N.map(D=>D[1]).join(" ")),console.log("# Edge names: "+Q.map(D=>D[1]).join(" ")),console.log("# Vertex names: "+C.map(D=>D[1]).join(" ")));let ie=[];for(let D of J)ie.push([D[0].makenormal(),D[1],"f"]);for(let D of Q)ie.push([D[0].makenormal(),D[1],"e"]);for(let D of C)ie.push([D[0].makenormal(),D[1],"v"]);this.facenames=N,this.faceplanes=J,this.edgenames=Q,this.vertexnames=C,this.geonormals=ie;let he=ie.map(D=>D[1]);this.swizzler.setGripNames(he),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let D=0;D<F.length;D++)for(let _ of this.rotations){let T=F[D].rotateplane(_),G=!1;for(let $ of this.moveplanes)if(T.sameplane($)){G=!0;break}G||(this.moveplanes.push(T),A[D]&&this.moveplanes2.push(T))}let be=new Vn(d),Ye=this.moveplanes2.slice(),bt=31;for(let D=0;D<Ye.length;D++){let _=D+Math.floor((Ye.length-D)*(bt/65536));be=be.split(Ye[_]),Ye[_]=Ye[D],bt=(bt*1657+101)%65536}let Le=be.collect([],!0);this.faces=Le,this.options.verbosity>0&&console.log("# Faces is now "+Le.length),this.stickersperface=Le.length;let ht=[],ot=ui(d);for(let D of this.rotations){let _=D.rotateface(d);ot.dist(ui(_))<we&&ht.push(D)}let ct=new Array(Le.length),Ce=[];for(let D=0;D<Le.length;D++){let _=Le[D].centermass();Ce.push([ot.dist(_),_,D])}Ce.sort((D,_)=>D[0]-_[0]);for(let D=0;D<Le.length;D++){let _=Ce[D][2];if(!ct[_]){ct[_]=!0;for(let T of ht){let G=Le[_].rotate(T),$=G.centermass();for(let se=D+1;se<Le.length&&!(Ce[se][0]-Ce[D][0]>we);se++){let Ne=Ce[se][2];if(!ct[Ne]&&$.dist(Ce[se][1])<we){ct[Ne]=!0,Le[Ne]=G;break}}}}}this.shortedge=1e99;for(let D of Le)for(let _=0;_<D.length;_++){let T=(_+1)%D.length,G=D.get(_).dist(D.get(T));G<this.shortedge&&(this.shortedge=G)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),r==="c"&&U&&!x&&!b&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&b&&!U&&!x&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(b||U)&&!x&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&U&&(this.notationMapper=new Qn(this.swizzler,new Kn(["F","D","L","BL","R","U","BR","B"])),!x&&!b&&(this.addNotationMapper="FTOMapper")),r==="d"&&U&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new Qn(this.swizzler,new Kn(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(t){return this.keyface2(t.centermass())}keyface2(t){let r="",n=String.fromCharCode;for(let l of this.moveplanesets)if(l.length>0){let o=t.dot(l[0]),i=0,s=1;for(;s*2<=l.length;)s*=2;for(;s>0;s>>=1)i+s<=l.length&&o>l[i+s-1].a&&(i+=s);if(i<47)r=r+n(33+i);else if(i<47+47*47)r=r+n(33+47+Math.floor(i/47)-1)+n(33+i%47);else if(i<47+47*47+47*47*47)r=r+n(33+47+Math.floor((i-47)/(47*47)-1))+n(33+47+Math.floor((i-47)/47)%47)+n(33+i%47);else throw Error("Too many slices for cubie encoding")}return r}keyface3(t){let r=t.centermass(),n=[];for(let l of this.moveplanesets)if(l.length>0){let o=r.dot(l[0]),i=0,s=1;for(;s*2<=l.length;)s*=2;for(;s>0;s>>=1)i+s<=l.length&&o>l[i+s-1].a&&(i+=s);n.push(i)}return n}findface(t){let r=this.keyface2(t),n=this.facelisthash.get(r);if(n.length===1)return n[0];for(let l=0;l+1<n.length;l++){let o=this.facelisthash.get(r)[l];if(Math.abs(t.dist(this.facecentermass[o]))<we)return o}return n[n.length-1]}project2d(t,r,n){let l=this.facenames[t][0],o=(r+1)%l.length,i=this.baseplanes[t],s=l[o].sub(l[r]),a=s.len();s=s.normalize();let f=s.cross(i).normalize(),u=n[1].sub(n[0]),g=u.len()/a;u=u.normalize();let p=u.b,c=u.c,L=s.smul(p).sub(f.smul(c)).smul(g),m=f.smul(p).sum(s.smul(c)).smul(g),d=new W(0,n[0].b-L.dot(l[r]),n[0].c-m.dot(l[r]),0);return[L,m,d]}allstickers(){let t="allstickers";this.faces=mL(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 S=0;S<this.faces.length;S++)this.facecentermass[S]=this.faces[S].centermass();let r=[],n=[];for(let S of this.moveplanes){let k=S.makenormal(),P=!1;for(let w of n)k.sameplane(w.makenormal())&&(P=!0);P||(n.push(k),r.push([]))}for(let S of this.moveplanes2){let k=S.makenormal();for(let P=0;P<n.length;P++)if(k.sameplane(n[P])){r[P].push(S);break}}for(let S=0;S<r.length;S++){let k=r[S].map(w=>w.normalizeplane()),P=n[S];for(let w=0;w<k.length;w++)k[w].makenormal().dist(P)>we&&(k[w]=k[w].smul(-1));k.sort((w,E)=>w.a-E.a),r[S]=k}this.moveplanesets=r,this.moveplanenormals=n;let l=r.map(S=>S.length);this.options.verbosity>0&&console.log("# Move plane sets: "+l);let o=[];for(let S=0;S<r.length;S++)o.push([]);for(let S of this.rotations){if(Math.abs(Math.abs(S.a)-1)<we)continue;let k=S.makenormal();for(let P=0;P<r.length;P++)if(k.sameplane(n[P])){o[P].push(S);break}}this.moverotations=o;for(let S=0;S<o.length;S++){let k=o[S],P=k[0].makenormal();for(let w=0;w<k.length;w++)P.dist(k[w].makenormal())>we&&(k[w]=k[w].smul(-1));k.sort((w,E)=>w.angle()-E.angle()),o[S][0].dot(n[S])<0&&k.reverse()}let i=o.map(S=>1+S.length);this.movesetorders=i;let s=[],a="?";for(let S=0;S<r.length;S++){let k=n[S],P=null,w=null;for(let E of this.geonormals){let M=k.dot(E[0]);Math.abs(M-1)<we?(w=[E[1],E[2]],a=E[2]):Math.abs(M+1)<we&&(P=[E[1],E[2]],a=E[2])}if(w===null||P===null)throw new Error("Saw positive or negative sides as null");s.push([w[0],w[1],P[0],P[1],1+r[S].length]),this.addNotationMapper==="NxNxNCubeMapper"&&a==="f"&&(this.notationMapper=new Jl(1+r[S].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new Xl(this.swizzler),this.addNotationMapper=""),this.addNotationMapper==="PyraminxOrTetraminxMapper"&&(r[0].length===2&&r[0][0].a===.333333333333333&&r[0][1].a===1.66666666666667?(this.notationMapper=new jn(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new Yl(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&a==="f"&&(1+r[S].length===3&&(this.notationMapper=new Zl(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&a==="f"&&(1+r[S].length===3&&(this.notationMapper=new Hl(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=s;let f=new Map,u=this.faces;for(let S=0;S<u.length;S++){let k=u[S],P=this.keyface(k);if(!f.get(P))f.set(P,[S]);else{let w=f.get(P);if(w.push(S),w.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let E=0;E<w.length;E++){let M=P+" "+E;f.set(M,[w[E]])}}}}this.facelisthash=f,this.options.verbosity>0&&console.log("# Cubies: "+f.size);let g=[],p=[],c=[];for(let S of f.values())if(S.length!==this.baseFaceCount){if(S.length>1){let k=S.map(j=>u[j].centermass()),P=ui(k);for(let j=0;S.length>2;j++){let q=!1;for(let ie=0;ie<S.length;ie++){let he=(ie+1)%S.length;if(P.dot(k[ie].cross(k[he]))<0){let be=k[ie];k[ie]=k[he],k[he]=be;let Ye=S[ie];S[ie]=S[he],S[he]=Ye,q=!0}}if(!q)break;if(j>1e3)throw new Error("Bad epsilon math; too close to border")}let w=0;for(let j of S)w|=1<<Math.floor(j/this.stickersperface);let E=this.markedface[w],M=-1;for(let j=0;j<S.length;j++)Math.floor(S[j]/this.stickersperface)===E&&(M=j);if(M<0)throw new Error("Could not find marked face in list");if(M!==0){let j=S.slice();for(let q=0;q<S.length;q++)S[q]=j[(M+q)%S.length]}}for(let k=0;k<S.length;k++){let P=S[k];p[P]=g.length,c[P]=k}g.push(S)}this.cubies=g,this.facetocubie=p,this.facetoord=c;let L=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],m=[],d=[0,0,0,0,0,0],F=[],A=[],U=0,x=[],b=[],N=[],J=[],C=S=>g[S].map(k=>this.getfaceindex(k)).join(" "),Q=[];for(let S=0;S<g.length;S++){let k=g[S];if(k.length===0||A[S])continue;let P={},w=0;N.push(0),Q.push([]);let E=k.length,M=d[E]++,j=L[E];(j===void 0||E===this.baseFaceCount)&&(j="CORE"),j=j+(M===0?"":M+1),m[U]=j,F[U]=E;let q=[S],ie=0;for(A[S]=!0;ie<q.length;){let he=q[ie++],be=C(he);if((k.length>1||P[be]===void 0)&&(P[be]=w++),J[he]=P[be],x[he]=U,Q[U].push(he),b[he]=N[U]++,q.length<this.rotations.length){let Ye=this.facecentermass[g[he][0]];for(let bt of o){let Le=this.facetocubie[this.findface(Ye.rotatepoint(bt[0]))];A[Le]||(q.push(Le),A[Le]=!0)}}}U++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let S=[["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"]],k={};for(let P of S)for(let w=0;w<P.length;w++){let E=0;for(let M=0;M<P[w].length;M++)E|=1<<P[w].charCodeAt(M)-65;k[E]=w}for(let P of Q)for(let w of P){let E=0;for(let M of g[w])E|=1<<this.facenames[this.getfaceindex(M)][1].charCodeAt(0)-65;b[w]=k[E]}}if(this.cubiesetnums=x,this.cubieordnums=b,this.cubiesetnames=m,this.cubieords=N,this.orbitoris=F,this.cubievaluemap=J,this.cubiesetcubies=Q,this.options.fixedPieceType!==null){for(let S=0;S<g.length;S++)if(this.options.fixedPieceType==="v"&&g[S].length>2||this.options.fixedPieceType==="e"&&g[S].length===2||this.options.fixedPieceType==="f"&&g[S].length===1){this.fixedCubie=S;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 "+N)}unswizzle(t){let r=this.notationMapper.notationToInternal(t);return r===null?null:r.modified({family:this.swizzler.unswizzle(r.family)})}stringToBlockMove(t){let r=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),n=t.match(r);if(n===null)throw new Error("Bad move passed "+t);let l=n[4],o,i;if(n[2]!==void 0){if(n[3]===void 0)throw new Error("Missing second number in range");o=parseInt(n[2],10)}n[3]!==void 0&&(i=parseInt(n[3],10));let s="1",a=1;return n[5]!==void 0&&(s=n[5],s[0]==="'"&&(s="-"+s.substring(1)),a=parseInt(s,10)),new B(new z(l,i,o),a)}parseMove(t){let r=this.notationMapper.notationToInternal(t);if(r===null)throw new Error("Bad move "+t.family);t=r;let n=t.family,l=!1;if(n.endsWith("v")&&n[0]<="Z"){if(t.innerLayer!==void 0||t.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");n=n.slice(0,-1),l=!0}n.endsWith("w")&&n[0]<="Z"&&(n=n.slice(0,-1).toLowerCase());let o,i=-1,s=this.swizzler.unswizzle(n),a=!1;for(let g=0;g<this.movesetgeos.length;g++){let p=this.movesetgeos[g];s===p[0]&&(a=!0,o=p,i=g),s===p[2]&&(a=!1,o=p,i=g)}let f=1,u=1;if(n.toUpperCase()!==n&&(u=2),o===void 0)throw new Error("Bad grip in move "+t.family);if(t.outerLayer!==void 0&&(f=t.outerLayer),t.innerLayer!==void 0&&(t.outerLayer===void 0?(u=t.innerLayer,n<="Z"?f=u:f=1):u=t.innerLayer),f--,u--,l&&(f=0,u=this.moveplanesets[i].length),f<0||f>this.moveplanesets[i].length||u<0||u>this.moveplanesets[i].length)throw new Error("Bad slice spec "+f+" "+u+" vs "+this.moveplanesets[i].length);if(!BL&&f===0&&u===this.moveplanesets[i].length&&!l)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,f,u,a,t.amount]}parsemove(t){let r=this.parseMove(this.stringToBlockMove(t));return r[0]=t,r}genperms(){let t="genperms";if(this.cmovesbyslice.length>0)return;let r=[];if(this.options.orientCenters){for(let n=0;n<this.cubies.length;n++)if(this.cubies[n].length===1){let l=this.cubies[n][0],o=this.getfaceindex(l),i=this.basefaces[o].centermass();if(i.dist(this.facecentermass[l])<we){let s=1<<o|1<<this.baseFaceCount,a=this.markedface[s],f=this.baseplanes[a].makenormal(),u=-1,g=-1;for(let L=0;L<this.faces[l].length;L++){let m=this.faces[l].get(L),d=f.dot(m.sub(i));d>u&&(u=d,g=L)}let p=(g+1)%this.faces[l].length;if(Math.abs(f.dot(this.faces[l].get(p).sub(i))-u)<we&&(g=p),g!=0){let L=[];for(let m=0;m<this.faces[l].length;m++)L.push(this.faces[l].get((m+g)%this.faces[l].length));this.faces[l]=new Ar(L)}let c=this.basefaces[o].length;for(let L=1;L<c;L++)this.cubies[n].push(this.cubies[n][L-1]);this.duplicatedFaces[l]=c,this.duplicatedCubies[n]=c,this.orbitoris[this.cubiesetnums[n]]=c}}}for(let n=0;n<this.moveplanesets.length;n++){let l=this.moveplanesets[n],o=[],i=[l.length+1,0],s=1;for(;s*2<=l.length;)s*=2;for(let u=0;u<this.faces.length;u++){let g=0;if(l.length>0){let p=this.facecentermass[u].dot(l[0]);for(let c=s;c>0;c>>=1)g+c<=l.length&&p>l[g+c-1].a&&(g+=c);g=l.length-g}for(o.push(g);i.length<=g;)i.push(0);i[g]++}let a=new Array(i.length);for(let u=0;u<i.length;u++)a[u]=[];let f=[];for(let u=0;u<this.faces.length;u++){if(o[u]<0)continue;let g=[this.facetocubie[u],this.facetoord[u]],p=this.facecentermass[u],c=p,L=u,m=o[L];for(;;){o[L]=-1;let d=p.rotatepoint(this.moverotations[n][0]);if(d.dist(c)<we)break;L=this.findface(d),g.push(this.facetocubie[L],this.facetoord[L]),p=d}if(g.length>2&&this.options.orientCenters&&(this.cubies[g[0]].length===1||this.duplicatedCubies[g[0]]>1)&&this.facecentermass[u].dist(this.basefaces[this.getfaceindex(u)].centermass())<we){let d=this.faces[this.cubies[g[0]][0]];for(let F=0;F<g.length;F+=2){let A=this.faces[this.cubies[g[F]][0]],U=-1;for(let x=0;x<d.length;x++)if(A.get(x).dist(d.get(0))<we){U=x;break}if(U<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");g[F+1]=U,d=d.rotate(this.moverotations[n][0])}}if(g.length===2&&this.options.orientCenters)for(let d=1;d<this.movesetorders[n];d++)m===0?g.push(g[0],d):g.push(g[0],(this.movesetorders[n]-d)%this.movesetorders[n]);if(g.length>2&&!f[g[0]]){if(g.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let d of g)a[m].push(d)}for(let d=0;d<g.length;d+=2)f[g[d]]=!0}for(let u=0;u<a.length;u++)a[u]=a[u].slice();r.push(a)}if(this.cmovesbyslice=r,this.options.moveList){let n=[];for(let l of this.options.moveList)n.push(this.parsemove(l));this.parsedmovelist=n}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(t){let r=this.moveplanesets[t].length,n=[];if(this.parsedmovelist!==void 0)for(let l of this.parsedmovelist)l[1]===t&&(l[4]?n.push([l[2],l[3]]):n.push([r-l[3],r-l[2]]),n.push(l[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let l=this.movesetgeos[t];if(l[1]!==l[3])for(let o=0;o<r;o++)l[1]!=="v"?(this.options.outerBlockMoves?n.push([o+1,r]):n.push([o+1]),n.push(1)):(this.options.outerBlockMoves?n.push([0,o]):n.push([o,o]),n.push(1))}else for(let l=0;l<=r;l++)!this.options.allMoves&&l+l===r||(this.options.outerBlockMoves?l+l>r?n.push([l,r]):n.push([0,l]):n.push([l,l]),n.push(1));if(this.fixedCubie>=0){let l=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[t],o=[];for(let i=0;i<n.length;i+=2){let s=n[i];if(l>=s[0]&&l<=s[1])if(s[0]===0)s=[s[1]+1,r];else if(r===s[1])s=[0,s[0]-1];else throw Error("fixed cubie option would disconnect move");let a=!1;for(let f=0;f<o.length;f+=2)if(o[f][0]===s[0]&&o[f][1]===s[1]&&o[f+1]===n[i+1]){a=!0;break}a||(o.push(s),o.push(n[i+1]))}n=o}return n}graybyori(t){let r=this.cubies[t].length;return this.duplicatedCubies[t]&&(r=1),r===1&&(this.options.grayCenters||!this.options.includeCenterOrbits)||r===2&&(this.options.grayEdges||!this.options.includeEdgeOrbits)||r>2&&(this.options.grayCorners||!this.options.includeCornerOrbits)}skipbyori(t){let r=this.cubies[t].length;return this.duplicatedCubies[t]&&(r=1),r===1&&!this.options.includeCenterOrbits||r===2&&!this.options.includeEdgeOrbits||r>2&&!this.options.includeCornerOrbits}skipcubie(t){return this.skipbyori(t)}header(t){return t+LL+\`
9
9
  \`+t+\`
10
10
  \`}writegap(){let t=this.getOrbitsDef(!1),r=[],n=[];for(let o=0;o<t.moveops.length;o++){let i="M_"+ii(this.notationMapper,t.movenames[o]),s=!1;i[i.length-1]==="'"&&(i=i.substring(0,i.length-1),s=!0),n.push(i),s?r.push(i+":="+t.moveops[o].toPerm().inv().toGap()+";"):r.push(i+":="+t.moveops[o].toPerm().toGap()+";")}r.push("Gen:=["),r.push(n.join(",")),r.push("];");let l=t.solved.identicalPieces();return r.push("ip:=["+l.map(o=>"["+o.map(i=>i+1).join(",")+"]").join(",")+"];"),r.push("# Size(Group(Gen));"),r.push("# Size(Stabilizer(Group(Gen), ip, OnTuplesSets));"),r.push(""),this.header("# ")+r.join(\`
11
11
  \`)}writeksolve(t="PuzzleGeometryPuzzle"){let r=this.getOrbitsDef(!1);return this.header("# ")+r.toKsolve(t,this.notationMapper).join(\`
@@ -3883,4 +3883,4 @@ Alg U BR' U' BR BL' BR BL BR'
3883
3883
  export {
3884
3884
  workerSource
3885
3885
  };
3886
- //# sourceMappingURL=search-worker-inside-generated-string-AMEXYCKK.js.map
3886
+ //# sourceMappingURL=search-worker-inside-generated-string-ZEY77HTF.js.map