cubing 0.25.11 → 0.25.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/{2x2x2.sgs.json-CLGNVWIM.js → 2x2x2.sgs.json-NLV7NA3B.js} +2 -2
- package/dist/esm/{2x2x2.sgs.json-CLGNVWIM.js.map → 2x2x2.sgs.json-NLV7NA3B.js.map} +0 -0
- package/dist/esm/{3d-dynamic-5LHE6HI6.js → 3d-dynamic-ZXCKVS2R.js} +8 -5
- package/dist/esm/{3d-dynamic-5LHE6HI6.js.map → 3d-dynamic-ZXCKVS2R.js.map} +2 -2
- package/dist/esm/{444-solver-SFZ7V6NL.js → 444-solver-XVU6Q26C.js} +3 -3
- package/dist/esm/{444-solver-SFZ7V6NL.js.map → 444-solver-XVU6Q26C.js.map} +0 -0
- package/dist/esm/bluetooth/index.js +1 -1
- package/dist/esm/{chunk-OFGQQQBY.js → chunk-AMOANNTB.js} +2 -2
- package/dist/esm/{chunk-OFGQQQBY.js.map → chunk-AMOANNTB.js.map} +0 -0
- package/dist/esm/{chunk-RREJ3MSB.js → chunk-ASJ4L4HQ.js} +2 -2
- package/dist/esm/{chunk-RREJ3MSB.js.map → chunk-ASJ4L4HQ.js.map} +0 -0
- package/dist/esm/{chunk-ODQRVWJB.js → chunk-AT7N3AOZ.js} +3 -3
- package/dist/esm/{chunk-ODQRVWJB.js.map → chunk-AT7N3AOZ.js.map} +2 -2
- package/dist/esm/{chunk-C6I4KFI2.js → chunk-KWHGWTPB.js} +2 -2
- package/dist/esm/{chunk-C6I4KFI2.js.map → chunk-KWHGWTPB.js.map} +0 -0
- package/dist/esm/{chunk-4SXK3FSU.js → chunk-RN5JA7BB.js} +2 -2
- package/dist/esm/{chunk-4SXK3FSU.js.map → chunk-RN5JA7BB.js.map} +0 -0
- package/dist/esm/{chunk-Z35CBICW.js → chunk-RPPJMADS.js} +2 -2
- package/dist/esm/{chunk-Z35CBICW.js.map → chunk-RPPJMADS.js.map} +0 -0
- package/dist/esm/{chunk-QKEGKHT5.js → chunk-YRNGJPFS.js} +1 -1
- package/dist/esm/{chunk-QKEGKHT5.js.map → chunk-YRNGJPFS.js.map} +0 -0
- package/dist/esm/{chunk-BXHL3MDG.js → chunk-Z5VAVKEV.js} +3 -3
- package/dist/esm/{chunk-BXHL3MDG.js.map → chunk-Z5VAVKEV.js.map} +0 -0
- package/dist/esm/{fto.dynamic-3MSUIE4Q.js → fto.dynamic-ZIN22CCJ.js} +2 -2
- package/dist/esm/{fto.dynamic-3MSUIE4Q.js.map → fto.dynamic-ZIN22CCJ.js.map} +0 -0
- package/dist/esm/{megaminx.sgs.json-O2B5OU3T.js → megaminx.sgs.json-4RFNTV3K.js} +3 -3
- package/dist/esm/{megaminx.sgs.json-O2B5OU3T.js.map → megaminx.sgs.json-4RFNTV3K.js.map} +0 -0
- package/dist/esm/puzzle-geometry/index.js +1 -1
- package/dist/esm/puzzles/index.js +1 -1
- package/dist/esm/{pyraminx.sgs.json-NTELD4DU.js → pyraminx.sgs.json-XWDFTFGD.js} +3 -3
- package/dist/esm/{pyraminx.sgs.json-NTELD4DU.js.map → pyraminx.sgs.json-XWDFTFGD.js.map} +0 -0
- package/dist/esm/scramble/index.js +3 -3
- package/dist/esm/search/index.js +3 -3
- package/dist/esm/{search-worker-js-entry-32MQILEZ.js → search-worker-js-entry-MQ5EKNR4.js} +13 -13
- package/dist/esm/{search-worker-js-entry-32MQILEZ.js.map → search-worker-js-entry-MQ5EKNR4.js.map} +0 -0
- package/dist/esm/{search-worker-ts-entry-IJRN7GQV.js → search-worker-ts-entry-AEZHCL75.js} +2 -2
- package/dist/esm/{search-worker-ts-entry-IJRN7GQV.js.map → search-worker-ts-entry-AEZHCL75.js.map} +0 -0
- package/dist/esm/{skewb.sgs.json-GISOONJZ.js → skewb.sgs.json-ENZWYZTX.js} +3 -3
- package/dist/esm/{skewb.sgs.json-GISOONJZ.js.map → skewb.sgs.json-ENZWYZTX.js.map} +0 -0
- package/dist/esm/twisty/index.js +2 -2
- package/dist/esm/{worker-inside-generated-string-JGML54CI.js → worker-inside-generated-string-HCFERKXI.js} +2 -2
- package/dist/esm/worker-inside-generated-string-HCFERKXI.js.map +7 -0
- package/dist/types/puzzle-geometry/PuzzleGeometry.d.ts +2 -2
- package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
- package/package.json +2 -1
- package/dist/esm/worker-inside-generated-string-JGML54CI.js.map +0 -7
|
@@ -5,7 +5,7 @@ var workerSource = `var Mp=Object.defineProperty;var U=(e,t)=>()=>(e&&(t=e(e=0))
|
|
|
5
5
|
\`)||t.includes("\\r"))throw new Error("LineComment cannot contain newline");j(this,ur,t)}get text(){return d(this,ur)}isIdentical(t){let r=t;return t.is(S0)&&d(this,ur)===d(r,ur)}invert(){return this}*experimentalExpand(t=1,r=1/0){yield this}toString(){return\`//\${d(this,ur)}\`}},At=S0;ur=new WeakMap});var Ze,yl=U(()=>{jt();Dt();Ze=class extends Oe{toString(){return\`
|
|
6
6
|
\`}isIdentical(t){return t.is(Ze)}invert(){return this}*experimentalExpand(t=1,r=1/0){yield this}}});var Xe,Ul=U(()=>{jt();Dt();Xe=class extends Oe{toString(){return"."}isIdentical(t){return t.is(Xe)}invert(){return this}*experimentalExpand(t=1,r=1/0){yield this}}});function bo(e,t){return e?parseInt(e):t}function w0(e){return new So().parseAlg(e)}function s2(e){return new So().parseMove(e)}function f2(e){return new So().parseQuantumMove(e)}function $e(e,t,r){let n=e;return n.startCharIndex=t,n.endCharIndex=r,n}function u2(e,t){return"startCharIndex"in e&&(t.startCharIndex=e.startCharIndex),"endCharIndex"in e&&(t.endCharIndex=e.endCharIndex),t}var a2,$p,em,tm,rm,nm,lt,T,So,x0=U(()=>{qt();b0();Fl();Dl();wo();Al();Vt();yl();Ul();a2=/^(\\d+)?('?)/,$p=/^[_\\dA-Za-z]/,em=/^((([1-9]\\d*)-)?([1-9]\\d*))?([_A-Za-z]+)?/,tm=/^[^\\n]*/,rm=/^(-?\\d+), ?/,nm=/^(-?\\d+)\\)/;So=class{constructor(){re(this,lt,"");re(this,T,0)}parseAlg(t){j(this,lt,t),j(this,T,0);let r=this.parseAlgWithStopping([]);return this.mustBeAtEndOfInput(),r}parseMove(t){j(this,lt,t),j(this,T,0);let r=this.parseMoveImpl();return this.mustBeAtEndOfInput(),r}parseQuantumMove(t){j(this,lt,t),j(this,T,0);let r=this.parseQuantumMoveImpl();return this.mustBeAtEndOfInput(),r}mustBeAtEndOfInput(){if(d(this,T)!==d(this,lt).length)throw new Error("parsing unexpectedly ended early")}parseAlgWithStopping(t){let r=d(this,T),n=d(this,T),l=new pt,o=!1,i=a=>{if(o)throw new Error(\`Unexpected character at index \${a}. Are you missing a space?\`)};e:for(;d(this,T)<d(this,lt).length;){let a=d(this,T);if(t.includes(d(this,lt)[d(this,T)]))return $e(l.toAlg(),r,n);if(this.tryConsumeNext(" ")){o=!1,l.experimentalNumUnits()===0&&(r=d(this,T));continue e}else if($p.test(d(this,lt)[d(this,T)])){i(a);let s=this.parseMoveImpl();l.push(s),o=!0,n=d(this,T);continue e}else if(this.tryConsumeNext("(")){i(a);let s=this.tryRegex(rm);if(s){let f=s[1],g=d(this,T),c=this.parseRegex(nm),u=$e(new B(new C("U_SQ_"),parseInt(f)),a+1,a+1+f.length),p=$e(new B(new C("D_SQ_"),parseInt(c[1])),g,d(this,T)-1),m=$e(new _([u,p]),a+1,d(this,T)-1);l.push($e(new gt(m),a,d(this,T))),o=!0,n=d(this,T);continue e}else{let f=this.parseAlgWithStopping([")"]);this.mustConsumeNext(")");let g=this.parseAmount();l.push($e(new gt(f,g),a,d(this,T))),o=!0,n=d(this,T);continue e}}else if(this.tryConsumeNext("[")){i(a);let s=this.parseAlgWithStopping([",",":"]),f=this.popNext(),g=this.parseAlgWithStopping(["]"]);switch(this.mustConsumeNext("]"),f){case":":l.push($e(new We(s,g),a,d(this,T))),o=!0,n=d(this,T);continue e;case",":l.push($e(new Ie(s,g),a,d(this,T))),o=!0,n=d(this,T);continue e;default:throw"unexpected parsing error"}}else if(this.tryConsumeNext(\`
|
|
7
7
|
\`)){l.push($e(new Ze,a,d(this,T))),o=!1,n=d(this,T);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){i(a);let[s]=this.parseRegex(tm);l.push($e(new At(s),a,d(this,T))),o=!1,n=d(this,T);continue e}else{l.push($e(new B("_SLASH_"),a,d(this,T))),o=!0,n=d(this,T);continue e}else if(this.tryConsumeNext(".")){i(a),l.push($e(new Xe,a,d(this,T))),o=!0,n=d(this,T);continue e}else throw new Error(\`Unexpected character: \${this.popNext()}\`)}if(d(this,T)!==d(this,lt).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(em);return new C(n,bo(r,void 0),bo(t,void 0))}parseMoveImpl(){let t=d(this,T);if(this.tryConsumeNext("/"))return $e(new B("_SLASH_"),t,d(this,T));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,d(this,T))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let t=d(this,T),[,r,n]=this.parseRegex(a2);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[bo(r,1)*(n==="'"?-1:1),!r]}parseAmount(){let t=d(this,T),[,r,n]=this.parseRegex(a2);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 bo(r,1)*(n==="'"?-1:1)}parseRegex(t){let r=t.exec(this.remaining());if(r===null)throw new Error("internal parsing error");return j(this,T,d(this,T)+r[0].length),r}tryRegex(t){let r=t.exec(this.remaining());return r===null?null:(j(this,T,d(this,T)+r[0].length),r)}remaining(){return d(this,lt).slice(d(this,T))}popNext(){let t=d(this,lt)[d(this,T)];return h0(this,T)._++,t}tryConsumeNext(t){return d(this,lt)[d(this,T)]===t?(h0(this,T)._++,!0):!1}mustConsumeNext(t){let r=this.popNext();if(r!==t)throw new Error(\`expected \\\`\${t}\\\` while parsing, encountered \${r}\`);return r}};lt=new WeakMap,T=new WeakMap});function xo(e){g2.has(e)||(console.warn(e),g2.add(e))}var g2,v0=U(()=>{g2=new Set});var Dn,E0=U(()=>{Dt();U0();Dn=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(\`Unit amount absolute value must be a non-negative integer from \${dn} to \${dn}.\`)}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=o2(t,this.amount<0);for(let o=0;o<n;o++)yield*this.quantum.experimentalExpand(l,r)}}});var Ht,Ke,Qe,Eo,C,Pe,An,B,Vt=U(()=>{jt();Dt();U0();x0();v0();E0();Eo=class extends Ao{constructor(t,r,n){super();re(this,Ht,void 0);re(this,Ke,void 0);re(this,Qe,void 0);if(j(this,Ht,t),j(this,Ke,r??null),j(this,Qe,n??null),Object.freeze(this),d(this,Ke)!==null&&(!Number.isInteger(d(this,Ke))||d(this,Ke)<1||d(this,Ke)>2147483647))throw new Error(\`QuantumMove inner layer must be a positive integer below \${dn}.\`);if(d(this,Qe)!==null&&(!Number.isInteger(d(this,Qe))||d(this,Qe)<1||d(this,Qe)>2147483647))throw new Error(\`QuantumMove outer layer must be a positive integer below \${dn}.\`);if(d(this,Qe)!==null&&d(this,Ke)!==null&&d(this,Ke)<=d(this,Qe))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(d(this,Qe)!==null&&d(this,Ke)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(t){return f2(t)}modified(t){return new Eo(t.family??d(this,Ht),t.innerLayer??d(this,Ke),t.outerLayer??d(this,Qe))}isIdentical(t){let r=t;return t.is(Eo)&&d(this,Ht)===d(r,Ht)&&d(this,Ke)===d(r,Ke)&&d(this,Qe)===d(r,Qe)}get family(){return d(this,Ht)}get outerLayer(){return d(this,Qe)}get innerLayer(){return d(this,Ke)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a \`QuantumMove\` directly.")}toString(){let t=d(this,Ht);return d(this,Ke)!==null&&(t=String(d(this,Ke))+t,d(this,Qe)!==null&&(t=String(d(this,Qe))+"-"+t)),t}},C=Eo;Ht=new WeakMap,Ke=new WeakMap,Qe=new WeakMap;An=class extends Oe{constructor(...t){super();re(this,Pe,void 0);if(typeof t[0]=="string")if(t[1]??null){j(this,Pe,new Dn(C.fromString(t[0]),t[1]));return}else return An.fromString(t[0]);j(this,Pe,new Dn(t[0],t[1]))}isIdentical(t){let r=t.as(An);return!!r&&d(this,Pe).isIdentical(d(r,Pe))}invert(){return u2(this,new An(d(this,Pe).quantum,-this.amount))}*experimentalExpand(t=1){t===1?yield this:yield this.modified({amount:-this.amount})}get quantum(){return d(this,Pe).quantum}modified(t){return new An(d(this,Pe).quantum.modified(t),t.amount??this.amount)}static fromString(t){return s2(t)}get amount(){return d(this,Pe).amount}get type(){return xo("deprecated: type"),"blockMove"}get family(){return d(this,Pe).quantum.family??void 0}get outerLayer(){return d(this,Pe).quantum.outerLayer??void 0}get innerLayer(){return d(this,Pe).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return d(this,Pe).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let t=Math.abs(this.amount);return d(this,Pe).quantum.toString().slice(0,-10)+(t===1?"":t)+(this.amount<0?"--":"++")}return d(this,Pe).quantum.toString()+d(this,Pe).suffix()}},B=An;Pe=new WeakMap});var p2,c2,ot,_o,gt,wo=U(()=>{qt();jt();Dt();Vt();E0();p2=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 C("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new C("D_SQ_"));let r=t.alg;if(r.experimentalNumUnits()===2){let[n,l]=r.units();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}},c2=new p2,_o=class extends Oe{constructor(t,r){super();re(this,ot,void 0);let n=sr(t);j(this,ot,new Dn(n,r))}isIdentical(t){let r=t;return t.is(_o)&&d(this,ot).isIdentical(d(r,ot))}get alg(){return d(this,ot).quantum}get amount(){return d(this,ot).amount}get experimentalRepetitionSuffix(){return d(this,ot).suffix()}invert(){return new _o(d(this,ot).quantum,-d(this,ot).amount)}*experimentalExpand(t=1,r){r??(r=1/0),r===0?yield t===1?this:this.invert():yield*d(this,ot).experimentalExpand(t,r-1)}static fromString(){throw new Error("unimplemented")}toString(){return c2.format(this)??\`(\${d(this,ot).quantum.toString()})\${d(this,ot).suffix()}\`}experimentalAsSquare1Tuple(){return c2.tuple(this)}},gt=_o;ot=new WeakMap});var ko=U(()=>{wo();Al();Fl();Dl();Vt();yl();Ul()});function yt(e,t){return e instanceof t}function m2(e){return yt(e,gt)||yt(e,At)||yt(e,Ie)||yt(e,We)||yt(e,B)||yt(e,Ze)||yt(e,Xe)}var _0=U(()=>{ko()});function B2(e,t,r){if(t.is(gt))return e.traverseGrouping(t,r);if(t.is(B))return e.traverseMove(t,r);if(t.is(Ie))return e.traverseCommutator(t,r);if(t.is(We))return e.traverseConjugate(t,r);if(t.is(Xe))return e.traversePause(t,r);if(t.is(Ze))return e.traverseNewline(t,r);if(t.is(At))return e.traverseLineComment(t,r);throw new Error("unknown unit")}function R2(e){if(e.is(gt)||e.is(B)||e.is(Ie)||e.is(We)||e.is(Xe)||e.is(Ze)||e.is(At))return e;throw"internal error: expected unit"}var yn,Un,zo,om,z0,k0,L2,d2,C0=U(()=>{wo();Fl();Vt();yl();Ul();Dl();Al();yn=class{traverseUnit(t,r){return B2(this,t,r)}traverseIntoUnit(t,r){return R2(this.traverseUnit(t,r))}},Un=class extends yn{traverseUnit(t){return B2(this,t,void 0)}traverseIntoUnit(t){return R2(this.traverseUnit(t))}},z0=class extends yn{*traverseAlg(t,r){if(r.depth===0){yield*t.units();return}let n=[],l=null,o=r?.collapseMoves??!0;function i(f,g){var p;let c=Js(p=z0,zo,om).call(p,f,g,r);if(c===0)return!1;let u=new B(f.quantum,c);return n.push(u),l=u,!0}function a(f){o&&l?.is(B)&&f.is(B)&&l.quantum.isIdentical(f.quantum)?(n.pop(),i(l,f.amount)||(l=n.slice(-1)[0])):f.is(B)?i(f,0):(n.push(f),l=f)}let s={depth:r.depth?r.depth-1:null};for(let f of t.units())for(let g of this.traverseUnit(f,s))a(g);for(let f of n)yield f}*traverseGrouping(t,r){if(r.depth===0){yield t;return}let n={depth:r.depth?r.depth-1:null};yield new gt(this.traverseAlg(t.alg,n))}*traverseMove(t,r){yield t}*traverseCommutator(t,r){if(r.depth===0){yield t;return}let n={depth:r.depth?r.depth-1:null};yield new Ie(this.traverseAlg(t.A,n),this.traverseAlg(t.B,n))}*traverseConjugate(t,r){if(r.depth===0){yield t;return}let n={depth:r.depth?r.depth-1:null};yield new We(this.traverseAlg(t.A,n),this.traverseAlg(t.B,n))}*traversePause(t,r){yield t}*traverseNewline(t,r){yield t}*traverseLineComment(t,r){yield t}},k0=z0;zo=new WeakSet,om=function(t,r,n){let l=t.amount+r;if(n?.quantumMoveOrder){let o=n.quantumMoveOrder(t.quantum),i=Math.floor(o/2)+1-o;l=(l%o+o-i)%o+i}return l},re(k0,zo);L2=new k0,d2=L2.traverseAlg.bind(L2)});function h2(e){if(!e)return[];if(yt(e,_))return e.units();if(typeof e=="string")return w0(e).units();let t=e;if(typeof t[Symbol.iterator]=="function")return t;throw"Invalid unit"}function sr(e){return yt(e,_)?e:new _(e)}function im(e,t){return e.is(Ze)||t.is(Ze)?"":e.is(At)&&!t.is(Ze)?\`
|
|
8
|
-
\`:" "}var it,Ir,_,qt=U(()=>{jt();_0();Dt();x0();C0();Al();Vt();yl();v0();Ir=class extends Oe{constructor(t){super();re(this,it,void 0);j(this,it,Array.from(h2(t)));for(let r of d(this,it))if(!m2(r))throw new Error("An alg can only contain units.")}isIdentical(t){let r=t;if(!t.is(Ir))return!1;let n=Array.from(d(this,it)),l=Array.from(d(r,it));if(n.length!==l.length)return!1;for(let o=0;o<n.length;o++)if(!n[o].isIdentical(l[o]))return!1;return!0}invert(){return new Ir(i2(Array.from(d(this,it)).map(t=>t.invert())))}*experimentalExpand(t=1,r){r??(r=1/0);for(let n of y0(d(this,it),t))yield*n.experimentalExpand(t,r)}expand(t){return new Ir(this.experimentalExpand(1,t?.depth??1/0))}*experimentalLeafMoves(){for(let t of this.experimentalExpand())t.is(B)&&(yield t)}concat(t){return new Ir(Array.from(d(this,it)).concat(Array.from(h2(t))))}experimentalIsEmpty(){for(let t of d(this,it))return!1;return!0}static fromString(t){return w0(t)}*units(){for(let t of d(this,it))yield t}experimentalNumUnits(){return Array.from(d(this,it)).length}get type(){return xo("deprecated: type"),"sequence"}toString(){let t="",r=null;for(let n of d(this,it))r&&(t+=im(r,n)),t+=n.toString(),r=n;return t}simplify(t){return new Ir(d2(this,t??{}))}},_=Ir;it=new WeakMap});var am,F2=U(()=>{qt();ko();Fl();Dl();Vt();Ul();am={Sune:new _([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 _([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 _([new Ie(new _([new B("R",1),new B("U",1),new B("R",-2)]),new _([new We(new _([new B("R",1)]),new _([new B("U",1)]))]))]),Niklas:new _([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 _([new B("x",-1),new Ie(new _([new We(new _([new B("R",1)]),new _([new B("U",-1)]))]),new _([new B("D",1)])),new Ie(new _([new We(new _([new B("R",1)]),new _([new B("U",1)]))]),new _([new B("D",1)])),new B("x",1)]),FURURFCompact:new _([new We(new _([new B("F",1)]),new _([new Ie(new _([new B("U",1)]),new _([new B("R",1)]))]))]),APermCompact:new _([new We(new _([new B("R",2)]),new _([new Ie(new _([new B("F",2)]),new _([new B("R",-1),new B("B",-1),new B("R",1)]))]))]),FURURFMoves:new _([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 _([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 _([new We(new _([new B("F",1)]),new _([new gt(new _([new Ie(new _([new B("R",1)]),new _([new B("U",1)]))]),3)]))]),TriplePause:new _([new Xe,new Xe,new Xe])}});var fA,D2=U(()=>{Vt();fA={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'")}});var A2=U(()=>{});var y2=U(()=>{qt()});var Le=U(()=>{qt();b0();C0();F2();D2();ko();Vt();A2();y2();_0();Dt()});function Sl(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(bl(o.numOrientations,a))n[l]=i;else if(bl(o.numOrientations,i))n[l]=a;else{let s=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)s[f]=i.permutation[a.permutation[f]];n[l]={permutation:s,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let g=0;g<o.numPieces;g++)f[g]=(i.orientation[a.permutation[g]]+a.orientation[g])%o.numOrientations,s[g]=i.permutation[a.permutation[g]];n[l]={permutation:s,orientation:f}}}}return n}function P0(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(bl(o.numOrientations,a))n[l]=i;else{let s=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)s[f]=i.pieces[a.permutation[f]];n[l]={pieces:s,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let g=0;g<o.numPieces;g++)f[g]=(i.orientation[a.permutation[g]]+a.orientation[g])%o.numOrientations,s[g]=i.pieces[a.permutation[g]];n[l]={pieces:s,orientation:f}}}}return n}var Co=U(()=>{wl()});function sm(e){let t=U2.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 b2&&(Object.freeze(r),Object.freeze(n),Object.freeze(l)),U2.set(e,l),l}function S2(e){let t={};for(let[r,n]of Object.entries(e.orbits))t[r]=sm(n.numPieces);return b2&&Object.freeze(t),t}function w2(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 gr(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 gr(e,o,-1);throw new Error(\`Invalid move for KPuzzle (\${e.name()}): \${t}\`)}var b2,U2,M0=U(()=>{wl();b2=!1,U2=new Map});var Be,Po=U(()=>{Co();xl();Be=class{constructor(t,r){this.kpuzzle=t;this.stateData=r}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),stateData:this.stateData}}static fromTransformation(t){let r=P0(t.kpuzzle.definition,t.kpuzzle.definition.startStateData,t.transformationData);return new Be(t.kpuzzle,r)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(t.isIdentityTransformation())return new Be(this.kpuzzle,this.stateData);let r=P0(this.kpuzzle.definition,this.stateData,t.transformationData);return new Be(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 Ut(this.kpuzzle,t)}}});var Wr,cr,Ut,xl=U(()=>{wl();Co();M0();Po();cr=class{constructor(t,r){this.kpuzzle=t;this.transformationData=r;re(this,Wr,void 0)}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),transformationData:this.transformationData}}invert(){return new cr(this.kpuzzle,N0(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return d(this,Wr)??j(this,Wr,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(t){let r=new cr(t,S2(t.definition));return j(r,Wr,!0),r}isIdentical(t){return x2(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 d(this,Wr)?new cr(this.kpuzzle,t.transformationData):d(t,Wr)?new cr(this.kpuzzle,this.transformationData):new cr(this.kpuzzle,Sl(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 Be.fromTransformation(this)}repetitionOrder(){return v2(this.kpuzzle.definition,this)}selfMultiply(t){return new cr(this.kpuzzle,gr(this.kpuzzle,this.transformationData,t))}},Ut=cr;Wr=new WeakMap});function bl(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 fm(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 x2(e,t,r){for(let[n,l]of Object.entries(e.definition.orbits))if(!fm(l,t[n],r[n]))return!1;return!0}function N0(e,t){let r={};for(let n in e.definition.orbits){let l=e.definition.orbits[n],o=t[n];if(bl(l.numOrientations,o))r[n]=o;else if(l.numOrientations===1){let i=new Array(l.numPieces);for(let a=0;a<l.numPieces;a++)i[o.permutation[a]]=a;r[n]={permutation:i,orientation:o.orientation}}else{let i=new Array(l.numPieces),a=new Array(l.numPieces);for(let s=0;s<l.numPieces;s++){let f=o.permutation[s];i[f]=s,a[f]=(l.numOrientations-o.orientation[s]+l.numOrientations)%l.numOrientations}r[n]={permutation:i,orientation:a}}}return r}function gr(e,t,r){if(r===1)return t;if(r<0)return gr(e,N0(e,t),-r);if(r===0){let{transformationData:o}=e.identityTransformation();return o}let n=t;r!==2&&(n=gr(e,t,Math.floor(r/2)));let l=Sl(e.definition,n,n);return r%2===0?l:Sl(e.definition,t,l)}function G0(e,t){return t?G0(t,e%t):e}function v2(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 a=0;a<l.numPieces;a++)if(!i[a]){let s=a,f=0,g=0;for(;i[s]=!0,f=f+o.orientation[s],g=g+1,s=o.permutation[s],s!==a;);f!==0&&(g=g*l.numOrientations/G0(l.numOrientations,f)),r=r*g/G0(r,g)}}return r}var _2,E2,k2,wl=U(()=>{Le();Co();xl();_2=class extends yn{traverseAlg(t,r){let n=null;for(let l of t.units())n?n=n.applyTransformation(this.traverseUnit(l,r)):n=this.traverseUnit(l,r);return n??r.identityTransformation()}traverseGrouping(t,r){let n=this.traverseAlg(t.alg,r);return new Ut(r,gr(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()}},E2=new _2,k2=E2.traverseAlg.bind(E2)});var bn,Mo,be,T0=U(()=>{Le();wl();M0();Po();xl();be=class{constructor(t,r){this.definition=t;re(this,bn,new Map);re(this,Mo,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return Ut.experimentalConstructIdentity(this)}moveToTransformation(t){typeof t=="string"&&(t=new B(t));let r=t.toString(),n=d(this,bn).get(r);if(n)return new Ut(this,n);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(t);if(!o)throw new Error(\`could not map to internal move: \${t}\`);return d(this,bn).set(r,o),new Ut(this,o)}let l=w2(this,t);return d(this,bn).set(r,l),new Ut(this,l)}algToTransformation(t){return typeof t=="string"&&(t=new _(t)),k2(t,this)}toTransformation(t){return typeof t=="string"?this.algToTransformation(t):t?.is?.(_)?this.algToTransformation(t):t?.is?.(B)?this.moveToTransformation(t):t}startState(){return new Be(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return d(this,Mo)??j(this,Mo,(()=>{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})())}get state(){throw new Error("KPuzzle is now a different (stateless) class.")}reset(){throw new Error("KPuzzle is now a different (stateless) class.")}applyMove(t){throw new Error("KPuzzle is now a different class. Try \`.moveToTransformation()\` to get the transformation for a move.")}applyAlg(t){throw new Error("KPuzzle is now a different class. Try \`.algToTransformation()\` to get the transformation for an alg.")}};bn=new WeakMap,Mo=new WeakMap});var Fe,z2=U(()=>{Fe={name:"3x3x3",orbits:{EDGES:{numPieces:12,numOrientations:2},CORNERS:{numPieces:8,numOrientations:3},CENTERS:{numPieces:6,numOrientations:4}},startStateData:{EDGES:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{pieces:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{pieces:[0,1,2,3,4,5],orientation:[0,0,0,0,0,0]}},moves:{U:{EDGES:{permutation:[1,2,3,0,4,5,6,7,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[1,0,0,0,0,0]}},y:{EDGES:{permutation:[1,2,3,0,5,6,7,4,10,8,11,9],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[1,2,3,0,7,4,5,6],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,2,3,4,1,5],orientation:[1,0,0,0,0,3]}},x:{EDGES:{permutation:[4,8,0,9,6,10,2,11,5,7,1,3],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[4,0,3,5,7,6,2,1],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[2,1,5,3,0,4],orientation:[0,3,0,1,2,2]}},L:{EDGES:{permutation:[0,1,2,11,4,5,6,9,8,3,10,7],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,1,0,0,0,0]}},F:{EDGES:{permutation:[9,1,2,3,8,5,6,7,0,4,10,11],orientation:[1,0,0,0,1,0,0,0,1,1,0,0]},CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,1,0,0,0]}},R:{EDGES:{permutation:[0,8,2,3,4,10,6,7,5,9,1,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,1,0,0]}},B:{EDGES:{permutation:[0,1,10,3,4,5,11,7,8,9,6,2],orientation:[0,0,1,0,0,0,1,0,0,0,1,1]},CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,1,0]}},D:{EDGES:{permutation:[0,1,2,3,7,4,5,6,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,0,1]}},z:{EDGES:{permutation:[9,3,11,7,8,1,10,5,0,4,2,6],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[3,2,6,5,0,4,7,1],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,1,1,3,1]}},M:{EDGES:{permutation:[2,1,6,3,0,5,4,7,8,9,10,11],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,0,0,0,2,0]}},E:{EDGES:{permutation:[0,1,2,3,4,5,6,7,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[0,0,0,0,0,0]}},S:{EDGES:{permutation:[0,3,2,7,4,1,6,5,8,9,10,11],orientation:[0,1,0,1,0,1,0,1,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,0,1,0,1]}},u:{EDGES:{permutation:[1,2,3,0,4,5,6,7,10,8,11,9],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,2,3,4,1,5],orientation:[1,0,0,0,0,0]}},l:{EDGES:{permutation:[2,1,6,11,0,5,4,9,8,3,10,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,0,2,0]}},f:{EDGES:{permutation:[9,3,2,7,8,1,6,5,0,4,10,11],orientation:[1,1,0,1,1,1,0,1,1,1,0,0]},CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,1,1,0,1]}},r:{EDGES:{permutation:[4,8,0,3,6,10,2,7,5,9,1,11],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]},CENTERS:{permutation:[2,1,5,3,0,4],orientation:[0,0,0,1,2,2]}},b:{EDGES:{permutation:[0,5,10,1,4,7,11,3,8,9,6,2],orientation:[0,1,1,1,0,1,1,1,0,0,1,1]},CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,0,3,1,3]}},d:{EDGES:{permutation:[0,1,2,3,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[0,0,0,0,0,1]}}}};Fe.moves.Uw=Fe.moves.u;Fe.moves.Lw=Fe.moves.l;Fe.moves.Fw=Fe.moves.f;Fe.moves.Rw=Fe.moves.r;Fe.moves.Bw=Fe.moves.b;Fe.moves.Dw=Fe.moves.d;Fe.moves.Rv=Fe.moves.x;Fe.moves.Uv=Fe.moves.y;Fe.moves.Fv=Fe.moves.z;Fe.moves.Lv={EDGES:{permutation:[2,10,6,11,0,8,4,9,1,3,5,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,3,2,0]}};Fe.moves.Dv={EDGES:{permutation:[3,0,1,2,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[3,0,0,0,0,1]}};Fe.moves.Bv={EDGES:{permutation:[8,5,10,1,9,7,11,3,4,0,6,2],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,3,3,1,3]}}});var O0,je=U(()=>{T0();Po();xl();z2();T0();O0=new be(Fe)});var C2=U(()=>{je()});var um,Ry,P2=U(()=>{um={"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"}},Ry={...um,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 Fm(e){switch(e){case"Regular":return gm;case"Dim":return Rm;case"Ignored":return cm;case"OrientationStickers":return pm;case"Invisible":return mm;case"IgnoreNonPrimary":return Lm;case"PermuteNonPrimary":return Bm;case"Ignoriented":return dm;case"OrientationWithoutPermutation":return hm}}var vl,wn,Ct,qe,Sn,No,Kr,gm,cm,pm,mm,Lm,Bm,Rm,dm,hm,El,_l,kl=U(()=>{vl=(f=>(f.Regular="Regular",f.Dim="Dim",f.Ignored="Ignored",f.OrientationStickers="OrientationStickers",f.Invisible="Invisible",f.Ignoriented="Ignoriented",f.IgnoreNonPrimary="IgnoreNonPrimary",f.PermuteNonPrimary="PermuteNonPrimary",f.OrientationWithoutPermutation="OrientationWithoutPermutation",f))(vl||{}),wn=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))}},Ct="regular",qe="ignored",Sn="oriented",No="invisible",Kr="dim",gm={facelets:[Ct,Ct,Ct,Ct,Ct]},cm={facelets:[qe,qe,qe,qe,qe]},pm={facelets:[Sn,Sn,Sn,Sn,Sn]},mm={facelets:[No,No,No,No]},Lm={facelets:[Ct,qe,qe,qe,qe]},Bm={facelets:[Kr,Ct,Ct,Ct,Ct]},Rm={facelets:[Kr,Kr,Kr,Kr,Kr]},dm={facelets:[Kr,qe,qe,qe,qe]},hm={facelets:[Sn,qe,qe,qe,qe]};El=class extends wn{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(Fm(i))}return t}},_l=class{constructor(t){this.kpuzzle=t}and(t){let r=new wn(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 wn(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 wn(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 wn(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))}}});function Dm(e){(async()=>{M2=e;let t=Array.from(document.body.querySelectorAll("twisty-player"));console.log(\`Setting the custom stickering for \${t.length} players!\`);let r=[];for(let n of t)r.push((async()=>{let l=await n.experimentalModel.twistySceneModel.stickering.get();n.experimentalStickering=l==="experimental-global-custom-1"?"experimental-global-custom-2":"experimental-global-custom-1"})());await Promise.all(r),console.log("Success!")})()}function N2(e,t){M2(e,t)}var M2,G2=U(()=>{kl();M2=()=>{};globalThis.location&&new URL(location.href).searchParams.get("global-custom-stickerer")==="true"&&(window.setGlobalCustomStickerer=Dm,window.PieceStickering=vl,console.log("Global custom stickerer enabled! (using: global-custom-stickerer=true)"),console.log("Look here for inspiration:","https://github.com/cubing/cubing.js/blob/81b5cab3e27d8defb39dd1e0a10bc9e8ba894d26/src/cubing/puzzles/stickerings/cube-stickerings.ts#L67"))});async function Pt(e,t){let r=await e.kpuzzle(),n=new El(r),l=new _l(r),o=()=>l.move("U"),i=()=>l.or(l.moves(["U","D"])),a=()=>l.not(i()),s=()=>l.or(l.moves(["L","R"])),f=()=>l.not(s()),g=()=>l.or(l.moves(["F","B"])),c=()=>l.not(g()),u=()=>l.not(o()),p=()=>l.and([o(),f(),c()]),m=()=>l.and([l.and(l.moves(["F","R"])),l.not(i())]),L=()=>l.and(l.moves(["D","R","F"])),R=()=>l.or([L(),m()]),h=()=>l.or([l.and([f(),a()]),l.and([f(),c()]),l.and([a(),c()])]),y=()=>l.or([l.and([f(),i(),g()]),l.and([a(),s(),g()]),l.and([c(),i(),s()])]),A=()=>l.not(l.or([h(),y()])),E=()=>l.or([f(),l.and([o(),y()])]);function v(){n.set(u(),"Dim")}function K(){n.set(o(),"PermuteNonPrimary"),n.set(p(),"Dim")}function Z(){n.set(o(),"IgnoreNonPrimary"),n.set(p(),"Regular")}function M(){n.set(o(),"Ignoriented"),n.set(p(),"Dim")}switch(t){case"full":break;case"PLL":v(),K();break;case"CLS":v(),n.set(l.and(l.moves(["D","R","F"])),"Regular"),n.set(o(),"Ignoriented"),n.set(l.and([o(),f(),c()]),"Dim"),n.set(l.and([o(),A()]),"IgnoreNonPrimary");break;case"OLL":v(),Z();break;case"COLL":v(),K(),n.set(l.and([o(),A()]),"Regular");break;case"OCLL":v(),M(),n.set(l.and([o(),A()]),"IgnoreNonPrimary");break;case"CLL":v(),n.set(l.not(l.and([A(),o()])),"Dim");break;case"ELL":v(),n.set(o(),"Dim"),n.set(l.and([o(),y()]),"Regular");break;case"ELS":v(),Z(),n.set(l.and([o(),A()]),"Ignored"),n.set(m(),"Regular"),n.set(L(),"Ignored");break;case"LL":v();break;case"F2L":n.set(o(),"Ignored");break;case"ZBLL":v(),n.set(o(),"PermuteNonPrimary"),n.set(p(),"Dim"),n.set(l.and([o(),A()]),"Regular");break;case"ZBLS":v(),n.set(R(),"Regular"),Z(),n.set(l.and([o(),A()]),"Ignored");break;case"WVLS":case"VLS":v(),n.set(R(),"Regular"),Z();break;case"LS":v(),n.set(R(),"Regular"),n.set(o(),"Ignored"),n.set(p(),"Dim");break;case"EO":n.set(A(),"Ignored"),n.set(y(),"OrientationWithoutPermutation");break;case"EOline":n.set(A(),"Ignored"),n.set(y(),"OrientationWithoutPermutation"),n.set(l.and(l.moves(["D","M"])),"Regular");break;case"EOcross":n.set(y(),"OrientationWithoutPermutation"),n.set(l.move("D"),"Regular"),n.set(A(),"Ignored");break;case"CMLL":n.set(u(),"Dim"),n.set(E(),"Ignored"),n.set(l.and([o(),A()]),"Regular");break;case"L6E":n.set(l.not(E()),"Dim");break;case"L6EO":n.set(l.not(E()),"Dim"),n.set(E(),"OrientationWithoutPermutation"),n.set(l.and([h(),i()]),"OrientationStickers");break;case"Daisy":n.set(l.all(),"Ignored"),n.set(h(),"Dim"),n.set(l.and([l.move("D"),h()]),"Regular"),n.set(l.and([l.move("U"),y()]),"IgnoreNonPrimary");break;case"Cross":n.set(l.all(),"Ignored"),n.set(h(),"Dim"),n.set(l.and([l.move("D"),h()]),"Regular"),n.set(l.and([l.move("D"),y()]),"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"])),h()]),"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"])),h()]),"Dim"),n.set(l.and([l.move("F"),l.not(l.or(l.moves(["U","R"])))]),"Regular");break;case"Void Cube":n.set(h(),"Invisible");break;case"picture":case"invisible":n.set(l.all(),"Invisible");break;case"centers-only":n.set(l.not(h()),"Ignored");break;case"experimental-global-custom-1":case"experimental-global-custom-2":N2(n,l);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 xn(){return["full","PLL","CLS","OLL","COLL","OCLL","ELL","ELS","LL","F2L","ZBLL","ZBLS","WVLS","VLS","LS","EO","EOline","EOcross","CMLL","L6E","L6EO","Daisy","Cross","2x2x2","2x2x3","Void Cube","picture","invisible","centers-only"]}var vn=U(()=>{kl();G2()});function de(e){let t=null;return()=>t??(t=e())}var Mt=U(()=>{});var zl,T2=U(()=>{zl=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 a=0;a<o;a++)if(n[o]===n[a])return!1;let i=!1;for(let a=0;a<l.length;a++)if(n[o]===l[a]){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 En,O2=U(()=>{En=class{notationToInternal(t){return t}notationToExternal(t){return t}}});var Go,I2=U(()=>{Le();Go=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 C("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 C("T",t.innerLayer,t.outerLayer),t.amount):this.child.notationToExternal(t)}}});var Cl,W2=U(()=>{Le();Cl=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 C(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 To,K2=U(()=>{Le();To=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 C("L",3,2),-2*t.amount);if(t.family==="R--")return new B(new C("L",3,2),2*t.amount);if(t.family==="D++")return new B(new C("U",3,2),-2*t.amount);if(t.family==="D--")return new B(new C("U",3,2),2*t.amount);if(t.family==="R_PLUSPLUS_")return new B(new C("L",3,2),-2*t.amount);if(t.family==="D_PLUSPLUS_")return new B(new C("U",3,2),-2*t.amount)}if(t.family==="y")return new B("Uv",t.amount)}return this.child.notationToInternal(t)}notationToExternal(t){return t.family==="Uv"?new B(new C("y",t.innerLayer,t.outerLayer),t.amount):t.family==="Dv"?new B("y",-t.amount):this.child.notationToExternal(t)}}});var Oo,Q2=U(()=>{Le();Oo=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 C("D",(this.slices+1)/2),t.amount):r==="M"?t=new B(new C("L",(this.slices+1)/2),t.amount):r==="S"&&(t=new B(new C("F",(this.slices+1)/2),t.amount))),this.slices>2&&(r==="e"?t=new B(new C("D",this.slices-1,2),t.amount):r==="m"?t=new B(new C("L",this.slices-1,2),t.amount):r==="s"&&(t=new B(new C("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 Am,ym,j2,q2,V2,Pl,Io,H2=U(()=>{Le();Am={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"},ym={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"},j2={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},q2=new C("y"),V2=new C("Dv"),Pl=class{constructor(t){this.child=t;this.wcaHack=!1;this.map=Am}notationToInternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){let n=j2[t.family];if(n)return new B(new C(n,t.innerLayer,t.outerLayer),t.amount)}let r=this.map[t.family];return r?new B(new C(r,t.innerLayer,t.outerLayer),t.amount):q2.isIdentical(t.quantum)?new B(V2,-t.amount):null}notationToExternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){for(let[r,n]of Object.entries(j2))if(this.child.spinmatch(t.family,n))return new B(new C(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 C(r,t.innerLayer,t.outerLayer),t.amount);return V2.isIdentical(t.quantum)?new B(q2,-t.amount):null}},Io=class extends Pl{constructor(t){super(t);this.map=ym}}});var Y2,I0,J2,Um,W0,Z2,bm,K0,X2,Sm,Wo,$2=U(()=>{Le();Y2={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"},I0=new C("x"),J2=new C("Rv"),Um=new C("Lv"),W0=new C("y"),Z2=new C("Uv"),bm=new C("Dv"),K0=new C("z"),X2=new C("Fv"),Sm=new C("Bv"),Wo=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer||t.outerLayer)return null;let r=Y2[t.family];return r?new B(new C(r,t.outerLayer,t.innerLayer),t.amount):I0.isIdentical(t.quantum)?new B(J2,t.amount):W0.isIdentical(t.quantum)?new B(Z2,t.amount):K0.isIdentical(t.quantum)?new B(X2,t.amount):null}notationToExternal(t){for(let[r,n]of Object.entries(Y2))if(this.child.spinmatchv(t.family,n))return new B(new C(r,t.innerLayer,t.outerLayer),t.amount);return J2.isIdentical(t.quantum)?new B(I0,t.amount):Um.isIdentical(t.quantum)?new B(I0,-t.amount):Z2.isIdentical(t.quantum)?new B(W0,t.amount):bm.isIdentical(t.quantum)?new B(W0,-t.amount):X2.isIdentical(t.quantum)?new B(K0,t.amount):Sm.isIdentical(t.quantum)?new B(K0,-t.amount):null}}});var Q0=U(()=>{O2();I2();W2();K2();Q2();H2();$2()});function ef(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:Ml(e.slice(t).join(" ")),options:r}}var j0,q0=U(()=>{Ko();j0=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 pr(e){if(!V0[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=0;V0[e]=t}return V0[e]}function Nt(e){if(!H0[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;H0[e]=t}return H0[e]}function tf(e){return new mt(Nt(e))}function rf(e){let t=1;for(;e>1;)t*=e,e--;return t}function wm(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 Y0(e,t){return e/wm(e,t)*t}var V0,H0,mt,Qo=U(()=>{V0=[],H0=[];mt=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 mt(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 mt(r)}inv(){let t=Array(this.n);for(let r=0;r<this.n;r++)t[this.p[r]]=r;return new mt(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=Y0(t,l)}return t}}});function Z0(e,t){let r=B.fromString(t),n=e.notationToExternal(r);return n===null||r===n?t:n.toString()}function nf(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 a=e.moveops[i];n.push(a.order());let s=0;for(let f=0;f<r;f++){if(f===i)continue;let g=e.moveops[f];a.mul(g).equal(g.mul(a))&&(s|=1<<f)}l.push(s)}let o={};o[0]=1;for(let i=0;i<100;i++){let a=0,s={},f=0;for(let g in o){let c=+g,u=o[c];a+=u,f++;for(let p=0;p<n.length;p++)if((c>>p&1)===0&&(c&l[p]&(1<<p)-1)===0){let m=c&l[p]|1<<p;s[m]===void 0&&(s[m]=0),s[m]+=(n[p]-1)*u}}t(\`\${i}: canonseq \${a} states \${f}\`),o=s}}var Nl,xm,_n,bt,Yt,X0,mr,kn,J0,lf=U(()=>{Le();Q0();Qo();Nl=class{constructor(t,r){this.size=t;this.mod=r}reassemblySize(){return rf(this.size)*Math.pow(this.mod,this.size)}},xm=0;_n=class{constructor(t,r,n,l,o){this.orbitnames=t;this.orbitdefs=r;this.solved=n;this.movenames=l;this.moveops=o}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}toKsolve(t,r=new En){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}\`);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=Z0(r,this.movenames[l]),i=!1;o[o.length-1]==="'"&&(i=!0,o=o.substring(0,o.length-1)),n.push("Move "+o);for(let a=0;a<this.orbitnames.length;a++)i?this.moveops[l].orbits[a].inv().appendDefinition(n,this.orbitnames[a],!0):this.moveops[l].orbits[a].appendDefinition(n,this.orbitnames[a],!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 #\${++xm}\`,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,a=this.orbitdefs[o].size,s=new J0(a),f=new Array(this.orbitdefs[o].size);for(let p=0;p<a;p++)f[p]=!1;for(let p=0;p<this.moveops.length;p++)for(let m=0;m<a;m++)(this.moveops[p].orbits[o].perm[m]!==m||this.moveops[p].orbits[o].ori[m]!==0)&&(f[m]=!0,s.union(m,this.moveops[p].orbits[o].perm[m]));let g=!0;if(i>1){g=!1;let p=new J0(this.orbitdefs[o].size*i);for(let m=0;m<this.moveops.length;m++)for(let L=0;L<a;L++)if(this.moveops[m].orbits[o].perm[L]!==L||this.moveops[m].orbits[o].ori[L]!==0)for(let R=0;R<i;R++)p.union(L*i+R,this.moveops[m].orbits[o].perm[L]*i+(R+this.moveops[m].orbits[o].ori[L])%i);for(let m=0;!g&&m<a;m++)for(let L=1;L<i;L++)p.find(m*i)===p.find(m*i+L)&&(g=!0);for(let m=0;!g&&m<a;m++)for(let L=0;L<m;L++)this.solved.orbits[o].perm[m]===this.solved.orbits[o].perm[L]&&(g=!0)}let c=-1,u=!1;for(let p=0;p<this.orbitdefs[o].size;p++)if(f[p]){let m=s.find(p);c<0?c=m:c!==m&&(u=!0)}for(let p=0;p<this.orbitdefs[o].size;p++){if(!f[p]||s.find(p)!==p)continue;let L=[],R=[],h=0;for(let y=0;y<this.orbitdefs[o].size;y++)s.find(y)===p&&(L[h]=y,R[y]=h,h++);if(u?t.push(\`\${this.orbitnames[o]}_p\${p}\`):t.push(this.orbitnames[o]),g){r.push(new Nl(h,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(L,h));for(let y=0;y<this.moveops.length;y++)l[y].push(this.moveops[y].orbits[o].remap(L,R,h))}else{r.push(new Nl(h,1)),n.push(this.solved.orbits[o].remapVS(L,h).killOri());for(let y=0;y<this.moveops.length;y++)l[y].push(this.moveops[y].orbits[o].remap(L,R,h).killOri())}}}return new _n(t,r,new kn(n),this.movenames,l.map(o=>new mr(o)))}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),a=Math.floor(Math.random()*this.moveops.length);r[o]=r[o].mul(r[i]).mul(this.moveops[a]),Math.random()<.1&&(r[o]=r[o].mul(this.moveops[a]))}let n=r[0];for(let l=1;l<r.length;l++)n=n.mul(r[l]);return n}reassemblySize(){let t=1;for(let r=0;r<this.orbitdefs.length;r++)t*=this.orbitdefs[r].reassemblySize();return t}},bt=class{constructor(t,r,n){this.perm=t;this.ori=r;this.orimod=n}static e(t,r){return new bt(Nt(t),pr(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 bt(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 bt(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 bt(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 mt(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 mt(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 a=l+1;a<r;a++)this.perm[a]===o&&i.push(a);n.push(i)}}return n}order(){return this.toPerm().order()}isIdentity(){let t=this.perm.length;if(this.perm===Nt(t)&&this.ori===pr(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===pr(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 bt(l,o,this.orimod)}remapVS(t,r){let n=new Array(r),l=new Array(r),o=0,i=[];for(let a=0;a<r;a++){let s=this.perm[t[a]];i[s]===void 0&&(i[s]=o++),n[a]=i[s],l[a]=this.ori[t[a]]}return new bt(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()?(bt.kcache[t]||(bt.kcache[t]={permutation:Nt(t),orientation:pr(t)}),bt.kcache[t]):{permutation:this.perm,orientation:this.ori}}},Yt=bt;Yt.kcache=[];X0=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 mt(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(a=>a*l+r));r+=l*n.perm.length}return t}order(){let t=1;for(let r of this.orbits)t=Y0(t,r.order());return t}},mr=class extends X0{constructor(t){super(t)}mul(t){return new mr(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 mr(this.internalInv())}e(){return new mr(this.orbits.map(t=>Yt.e(t.perm.length,t.orimod)))}},kn=class extends X0{constructor(t){super(t)}mul(t){return new kn(this.internalMul(t))}},J0=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 jo,of=U(()=>{jo={"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 qo(e){let t=new O(0,0,0,0);for(let r=0;r<e.length;r++)t=t.sum(e[r]);return t.smul(1/e.length)}function af(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 O,Vo=U(()=>{O=class{constructor(t,r,n,l){this.a=t;this.b=r;this.c=n;this.d=l}mul(t){return new O(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 O(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 O(this.a/t,this.b/t,this.c/t,this.d/t)}makenormal(){return new O(0,this.b,this.c,this.d).normalize()}normalizeplane(){let t=Math.hypot(this.b,this.c,this.d);return new O(this.a/t,this.b/t,this.c/t,this.d/t)}smul(t){return new O(this.a*t,this.b*t,this.c*t,this.d*t)}sum(t){return new O(this.a+t.a,this.b+t.b,this.c+t.c,this.d+t.d)}sub(t){return new O(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 O(this.a,-this.b,-this.c,-this.d)}det3x3(t,r,n,l,o,i,a,s,f){return t*(o*f-i*s)+r*(i*a-l*f)+n*(l*s-o*a)}rotateplane(t){let r=t.mul(new O(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 O(0,1,0,0)).normalize():r<t&&r<n?this.cross(new O(0,0,1,0)).normalize():this.cross(new O(0,0,0,1)).normalize()}pointrotation(t){let r=this.normalize();if(t=t.normalize(),r.sub(t).len()<1e-9)return new O(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 O(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 a=[];for(let s=0;s<t.length;s++){(o[s]===i||o[s]===0)&&a.push(t[s]);let f=(s+1)%t.length;if(o[s]+o[f]===0&&o[s]!==0){let g=t[s].dot(this)-r,c=t[f].dot(this)-r,u=g/(g-c),p=t[s].smul(1-u).sum(t[f].smul(u));a.push(p)}}l.push(a)}}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 O(t,this.b,this.c,this.d)}}});function sf(){let e=Math.sqrt(.5);return[new O(e,e,0,0),new O(e,0,e,0)]}function ff(){return[new O(.5,.5,.5,.5),new O(.5,.5,.5,-.5)]}function uf(){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 O(Math.cos(e),t*Math.sin(e),r*Math.sin(e),0),new O(.5,.5,.5,.5)]}function gf(){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 O(Math.cos(n),e*Math.sin(n),t*Math.sin(n),0),new O(Math.cos(n),-e*Math.sin(n),t*Math.sin(n),0)]}function cf(){let e=Math.sqrt(.5);return[new O(.5,.5,.5,.5),new O(e,0,0,e)]}function pf(e){let t=[new O(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 a=0;a<t.length;a++)if(l.dist(t[a])<Ho||o.dist(t[a])<Ho){i=!0;break}i||t.push(l)}return t}function $0(e,t){let r=[],n=[];for(let l=0;l<t.length;l++){let o=e.rotateplane(t[l]),i=!1;for(let a=0;a<r.length;a++)if(o.dist(r[a])<Ho){i=!0;break}i||(r.push(o),n.push(t[l]))}return n}function ea(e){let t=[];for(let r=1;r<e.length;r++)for(let n=r+1;n<e.length;n++){let l=af(0,r,n,e);if(l){let o=!1;for(let i=0;i<t.length;i++)if(l.dist(t[i])<Ho){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 Ho,mf=U(()=>{Vo();Ho=1e-9});function Yo(e,t){let r=e[0].p.length,n=tf(r),l=[],o=[],i=[],a=[],s=[];function f(p){for(let m=p.p.length-1;m>=0;m--){let L=p.p[m];if(L!==m){if(!l[m][L])return!1;p=p.mul(o[m][L])}}return!0}function g(p,m,L){a[p].push(m),s[p].push(L);for(let R=0;R<l[p].length;R++)l[p][R]&&c(p,l[p][R].mul(m),L+i[p][R])}function c(p,m,L){let R=m.p[p];if(!l[p][R]){l[p][R]=m,o[p][R]=m.inv(),i[p][R]=L;for(let y=0;y<a[p].length;y++)c(p,m.mul(a[p][y]),L+s[p][y]);return}let h=m.mul(o[p][R]);f(h)||g(p-1,h,L+i[p][R])}function u(){l=[],o=[],a=[],i=[],s=[];for(let L=0;L<r;L++)l.push([]),o.push([]),i.push([]),a.push([]),s.push([]),l[L][L]=n,o[L][L]=n,i[L][L]=0;let p=0,m=1;for(let L=0;L<e.length;L++){g(r-1,e[L],1),m=1;let R=0,h=0,y=[],A=new Lf;for(let E=0;E<r;E++){let v=0,K=0;for(let M=0;M<r;M++)l[E][M]&&(v++,K+=i[E][M],E!==M&&p++);R+=a[E].length,m*=v,v>1&&A.multiply(v);let Z=K/v;y.push(Z),h+=Z}t(\`\${L}: sz \${m} T \${R} sol \${h} none \${p} mults \${A.toString()}\`)}return m}return u()}var Lf,ta=U(()=>{Qo();Lf=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 vm(e,t){let r=[];for(let n of e)for(let l of t)r.push(l.rotate(n));return r}function km(){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 zm(){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 Cm(){return{4:["F","D","L","R"],6:["U","D","F","B","L","R"],8:["F","BB","D","U","BR","L","R","BL"],12:["L","E","F","BF","R","I","U","D","BR","A","BL","C"],20:["L","S","E","O","F","B","I","P","R","K","U","D","J","A","Q","H","G","N","M","C"]}}function Pm(){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 Jo(e,t){for(let r=0;r<e.length;r++)if(e[r][0].dist(t)<Ee)return r;throw new Error("Element not found")}function Bf(){return jo}function Rf(e){return jo[e]}function Ml(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 na(e,t={}){let r=Ml(e);if(r===null)throw new Error("Could not parse the puzzle description");let n=new Xo(r,Object.assign({},{allMoves:!0},t));return n.allstickers(),n.genperms(),n}function Cn(e,t){return na(jo[e],t)}function Mm(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\`We only support slice and outer block moves right now. \${t}\`;return[o+l,n]}function Nm(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 Zo(e,t){return[e.b/t,-e.c/t,e.d/t]}function ra(e,t){let r=[],n=e.length;for(let l=0;l<n;l++){let o=Zo(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 zn,Gl,Ee,Em,_m,Xo,Qr,Ko=U(()=>{Le();T2();Q0();q0();Qo();lf();of();mf();Vo();ta();zn=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 O(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 O(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 zn(r)}rotateforward(){let t=[];for(let r=1;r<this.length;r++)t.push(this.get(r));return t.push(this.get(0)),new zn(t)}},Gl=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 Gl(r[0]),this.right=new Gl(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 zn(this.face)):r?(this.left?.collect(t,!1),this.right?.collect(t,!0)):(this.right?.collect(t,!1),this.left?.collect(t,!0)),t}};Ee=1e-9,Em="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",_m=!1;Xo=class{constructor(t,r){this.puzzleDescription=t;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.faceorder=[];this.faceprecedence=[];this.notationMapper=new En;this.addNotationMapper="";this.setReidOrder=!1;let n="genperms";this.options=new j0(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=sf();break;case"o":l=cf();break;case"i":l=gf();break;case"t":l=ff();break;case"d":l=uf();break;default:throw new Error("Bad shape argument: "+r)}this.rotations=pf(l),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let o=l[0];this.baseplanerot=$0(o,this.rotations);let i=this.baseplanerot.map(D=>o.rotateplane(D));this.baseplanes=i,this.baseFaceCount=i.length;let a=km()[i.length];this.net=a,this.colors=zm()[i.length],this.faceorder=Cm()[i.length],this.options.verbosity>0&&console.log("# Base planes: "+i.length);let s=ea(i),f=new O(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+s.length);let g=i[0].makenormal(),c=s[0].sum(s[1]).makenormal(),u=s[0].makenormal(),p=new O(1,g.b,g.c,g.d);this.options.verbosity>0&&console.log("# Boundary is "+p);let L=$0(p,this.rotations).map(D=>p.rotateplane(D)),R=ea(L);this.edgedistance=R[0].sum(R[1]).smul(.5).dist(f),this.vertexdistance=R[0].dist(f);let h=[],y=[],A=!1,E=!1,v=!1;for(let D of n){let x=null,G=0;switch(D.cutType){case"f":x=g,G=1,A=!0;break;case"v":x=u,G=this.vertexdistance,v=!0;break;case"e":x=c,G=this.edgedistance,E=!0;break;default:throw new Error("Bad cut argument: "+D.cutType)}h.push(x.makecut(D.distance)),y.push(D.distance<G)}this.options.addRotations&&(A||h.push(g.makecut(10)),v||h.push(u.makecut(10)),E||h.push(c.makecut(10))),this.basefaces=[];for(let D of this.baseplanerot){let x=D.rotateface(R);this.basefaces.push(new zn(x))}let K=[],Z=[],M=[],ne=[],b=R.length;function k(D,x,G){for(let W of D)if(W[0].dist(x)<Ee){W.push(G);return}D.push([x,G])}for(let D=0;D<this.baseplanerot.length;D++){let x=this.baseplanerot[D].rotateface(R);for(let G=0;G<x.length;G++){let W=(G+1)%x.length,le=x[G].sum(x[W]).smul(.5);k(ne,le,D)}}let P=[];for(let D=0;D<this.baseplanerot.length;D++){let x=this.baseplanerot[D].rotateface(R),G=[];for(let W=0;W<x.length;W++){let le=(W+1)%x.length,He=x[W].sum(x[le]).smul(.5),ut=ne[Jo(ne,He)];if(D===ut[1])G.push(ut[2]);else if(D===ut[2])G.push(ut[1]);else throw new Error("Could not find edge")}P.push(G)}let S={},w=[];w.push(a[0][0]),S[a[0][0]]=0,w[P[0][0]]=a[0][1],S[a[0][1]]=P[0][0];for(let D of a){let x=D[0],G=S[x];if(G===void 0)throw new Error("Bad edge description; first edge not connected");let W=-1;for(let le=0;le<P[G].length;le++){let He=w[P[G][le]];if(He!==void 0&&He===D[1]){W=le;break}}if(W<0)throw new Error("First element of a net not known");for(let le=2;le<D.length;le++){if(D[le]==="")continue;let He=P[G][(le+W-1)%b],ut=w[He];if(ut!==void 0&&ut!==D[le])throw new Error("Face mismatch in net");w[He]=D[le],S[D[le]]=He}}for(let D=0;D<w.length;D++){let x=!1;for(let G=0;G<this.faceorder.length;G++)if(w[D]===this.faceorder[G]){this.faceprecedence[D]=G,x=!0;break}if(!x)throw new Error("Could not find face "+w[D]+" in face order list "+this.faceorder)}for(let D=0;D<this.baseplanerot.length;D++){let x=this.baseplanerot[D].rotateface(R),G=p.rotateplane(this.baseplanerot[D]),W=w[D];K.push([x,W]),Z.push([G,W])}for(let D=0;D<this.baseplanerot.length;D++){let x=this.baseplanerot[D].rotateface(R),G=w[D];for(let W=0;W<x.length;W++){let le=(W+1)%x.length,He=x[W].sum(x[le]).smul(.5),ut=(W+2)%x.length,zp=x[le].sum(x[ut]).smul(.5),Cp=Jo(ne,He),Pp=Jo(ne,zp);k(M,x[le],[G,Pp,Cp])}}this.swizzler=new zl(K.map(D=>D[1]));let z=this.swizzler.prefixFree?"":"_";for(let D=0;D<ne.length;D++){if(ne[D].length!==3)throw new Error("Bad length in edge names "+ne[D]);let x=w[ne[D][1]],G=w[ne[D][2]];this.faceprecedence[ne[D][1]]<this.faceprecedence[ne[D][2]]?x=x+z+G:x=G+z+x,ne[D]=[ne[D][0],x]}for(let D=0;D<M.length;D++){if(M[D].length<4)throw new Error("Bad length in vertex names");let x=1;for(let W=2;W<M[D].length;W++)this.faceprecedence[S[M[D][W][0]]]<this.faceprecedence[S[M[D][x][0]]]&&(x=W);let G="";for(let W=1;W<M[D].length;W++){W===1?G=M[D][x][0]:G=G+z+M[D][x][0];for(let le=1;le<M[D].length;le++)if(M[D][x][1]===M[D][le][2]){x=le;break}}M[D]=[M[D][0],G]}this.options.verbosity>1&&(console.log("# Face precedence list: "+this.faceorder.join(" ")),console.log("# Face names: "+K.map(D=>D[1]).join(" ")),console.log("# Edge names: "+ne.map(D=>D[1]).join(" ")),console.log("# Vertex names: "+M.map(D=>D[1]).join(" ")));let Q=[];for(let D of Z)Q.push([D[0].makenormal(),D[1],"f"]);for(let D of ne)Q.push([D[0].makenormal(),D[1],"e"]);for(let D of M)Q.push([D[0].makenormal(),D[1],"v"]);this.facenames=K,this.faceplanes=Z,this.edgenames=ne,this.vertexnames=M,this.geonormals=Q;let H=Q.map(D=>D[1]);this.swizzler.setGripNames(H),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let D=0;D<h.length;D++)for(let x of this.rotations){let G=h[D].rotateplane(x),W=!1;for(let le of this.moveplanes)if(G.sameplane(le)){W=!0;break}W||(this.moveplanes.push(G),y[D]&&this.moveplanes2.push(G))}let ce=new Gl(R),Re=this.moveplanes2.slice(),Ue=31;for(let D=0;D<Re.length;D++){let x=D+Math.floor((Re.length-D)*(Ue/65536));ce=ce.split(Re[x]),Re[x]=Re[D],Ue=(Ue*1657+101)%65536}let ve=ce.collect([],!0);this.faces=ve,this.options.verbosity>0&&console.log("# Faces is now "+ve.length),this.stickersperface=ve.length;let zt=[],Te=qo(R);for(let D of this.rotations){let x=D.rotateface(R);Te.dist(qo(x))<Ee&&zt.push(D)}let nt=new Array(ve.length),ze=[];for(let D=0;D<ve.length;D++){let x=ve[D].centermass();ze.push([Te.dist(x),x,D])}ze.sort((D,x)=>D[0]-x[0]);for(let D=0;D<ve.length;D++){let x=ze[D][2];if(!nt[x]){nt[x]=!0;for(let G of zt){let W=ve[x].rotate(G),le=W.centermass();for(let He=D+1;He<ve.length&&!(ze[He][0]-ze[D][0]>Ee);He++){let ut=ze[He][2];if(!nt[ut]&&le.dist(ze[He][1])<Ee){nt[ut]=!0,ve[ut]=W;break}}}}}this.shortedge=1e99;for(let D of ve)for(let x=0;x<D.length;x++){let G=(x+1)%D.length,W=D.get(x).dist(D.get(G));W<this.shortedge&&(this.shortedge=W)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),r==="c"&&A&&!E&&!v&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&v&&!A&&!E&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(v||A)&&!E&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&A&&(this.notationMapper=new Cl(this.swizzler,new zl(["F","D","L","BL","R","U","BR","B"])),!E&&!v&&(this.addNotationMapper="FTOMapper")),r==="d"&&A&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new Cl(this.swizzler,new zl(["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,a=1;for(;a*2<=l.length;)a*=2;for(;a>0;a>>=1)i+a<=l.length&&o>l[i+a-1].a&&(i+=a);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,a=1;for(;a*2<=l.length;)a*=2;for(;a>0;a>>=1)i+a<=l.length&&o>l[i+a-1].a&&(i+=a);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]))<Ee)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],a=l[o].sub(l[r]),s=a.len();a=a.normalize();let f=a.cross(i).normalize(),g=n[1].sub(n[0]),c=g.len()/s;g=g.normalize();let u=g.b,p=g.c,m=a.smul(u).sub(f.smul(p)).smul(c),L=f.smul(u).sum(a.smul(p)).smul(c),R=new O(0,n[0].b-m.dot(l[r]),n[0].c-L.dot(l[r]),0);return[m,L,R]}allstickers(){let t="allstickers";this.faces=vm(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 b=0;b<this.faces.length;b++)this.facecentermass[b]=this.faces[b].centermass();let r=[],n=[];for(let b of this.moveplanes){let k=b.makenormal(),P=!1;for(let S of n)k.sameplane(S.makenormal())&&(P=!0);P||(n.push(k),r.push([]))}for(let b of this.moveplanes2){let k=b.makenormal();for(let P=0;P<n.length;P++)if(k.sameplane(n[P])){r[P].push(b);break}}for(let b=0;b<r.length;b++){let k=r[b].map(S=>S.normalizeplane()),P=n[b];for(let S=0;S<k.length;S++)k[S].makenormal().dist(P)>Ee&&(k[S]=k[S].smul(-1));k.sort((S,w)=>S.a-w.a),r[b]=k}this.moveplanesets=r,this.moveplanenormals=n;let l=r.map(b=>b.length);this.options.verbosity>0&&console.log("# Move plane sets: "+l);let o=[];for(let b=0;b<r.length;b++)o.push([]);for(let b of this.rotations){if(Math.abs(Math.abs(b.a)-1)<Ee)continue;let k=b.makenormal();for(let P=0;P<r.length;P++)if(k.sameplane(n[P])){o[P].push(b);break}}this.moverotations=o;for(let b=0;b<o.length;b++){let k=o[b],P=k[0].makenormal();for(let S=0;S<k.length;S++)P.dist(k[S].makenormal())>Ee&&(k[S]=k[S].smul(-1));k.sort((S,w)=>S.angle()-w.angle()),o[b][0].dot(n[b])<0&&k.reverse()}let i=o.map(b=>1+b.length);this.movesetorders=i;let a=[],s="?";for(let b=0;b<r.length;b++){let k=n[b],P=null,S=null;for(let w of this.geonormals){let z=k.dot(w[0]);Math.abs(z-1)<Ee?(S=[w[1],w[2]],s=w[2]):Math.abs(z+1)<Ee&&(P=[w[1],w[2]],s=w[2])}if(S===null||P===null)throw new Error("Saw positive or negative sides as null");a.push([S[0],S[1],P[0],P[1],1+r[b].length]),this.addNotationMapper==="NxNxNCubeMapper"&&s==="f"&&(this.notationMapper=new Oo(1+r[b].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new Wo(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 Pl(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new Io(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&s==="f"&&(1+r[b].length===3&&(this.notationMapper=new To(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&s==="f"&&(1+r[b].length===3&&(this.notationMapper=new Go(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=a;let f=new Map,g=this.faces;for(let b=0;b<g.length;b++){let k=g[b],P=this.keyface(k);if(!f.get(P))f.set(P,[b]);else{let S=f.get(P);if(S.push(b),S.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let w=0;w<S.length;w++){let z=P+" "+w;f.set(z,[S[w]])}}}}this.facelisthash=f,this.options.verbosity>0&&console.log("# Cubies: "+f.size);let c=[],u=[],p=[];for(let b of f.values())if(b.length!==this.baseFaceCount){if(b.length>1){let k=b.map(z=>g[z].centermass()),P=qo(k);for(let z=0;b.length>2;z++){let Q=!1;for(let H=0;H<b.length;H++){let ce=(H+1)%b.length;if(P.dot(k[H].cross(k[ce]))<0){let Re=k[H];k[H]=k[ce],k[ce]=Re;let Ue=b[H];b[H]=b[ce],b[ce]=Ue,Q=!0}}if(!Q)break;if(z>1e3)throw new Error("Bad epsilon math; too close to border")}let S=0,w=b[S];for(let z=1;z<b.length;z++){let Q=b[z];this.faceprecedence[this.getfaceindex(Q)]<this.faceprecedence[this.getfaceindex(w)]&&(S=z,w=Q)}if(S!==0){let z=b.slice();for(let Q=0;Q<b.length;Q++)b[Q]=z[(S+Q)%b.length]}}for(let k=0;k<b.length;k++){let P=b[k];u[P]=c.length,p[P]=k}c.push(b)}this.cubies=c,this.facetocubie=u,this.facetoord=p;let m=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],L=[],R=[0,0,0,0,0,0],h=[],y=[],A=0,E=[],v=[],K=[],Z=[],M=b=>c[b].map(k=>this.getfaceindex(k)).join(" "),ne=[];for(let b=0;b<c.length;b++){if(y[b])continue;let k=c[b];if(k.length===0)continue;let P={},S=0;K.push(0),ne.push([]);let w=k.length,z=R[w]++,Q=m[w];(Q===void 0||w===this.baseFaceCount)&&(Q="CORE"),Q=Q+(z===0?"":z+1),L[A]=Q,h[A]=w;let H=[b],ce=0;for(y[b]=!0;ce<H.length;){let Re=H[ce++],Ue=M(Re);if((k.length>1||P[Ue]===void 0)&&(P[Ue]=S++),Z[Re]=P[Ue],E[Re]=A,ne[A].push(Re),v[Re]=K[A]++,H.length<this.rotations.length){let ve=this.facecentermass[c[Re][0]];for(let zt of o){let Te=this.facetocubie[this.findface(ve.rotatepoint(zt[0]))];y[Te]||(H.push(Te),y[Te]=!0)}}}A++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let b=[["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 b)for(let S=0;S<P.length;S++){let w=0;for(let z=0;z<P[S].length;z++)w|=1<<P[S].charCodeAt(z)-65;k[w]=S}for(let P of ne)for(let S of P){let w=0;for(let z of c[S])w|=1<<this.facenames[this.getfaceindex(z)][1].charCodeAt(0)-65;v[S]=k[w]}}if(this.cubiesetnums=E,this.cubieordnums=v,this.cubiesetnames=L,this.cubieords=K,this.orbitoris=h,this.cubievaluemap=Z,this.cubiesetcubies=ne,this.options.fixedPieceType!==null){for(let b=0;b<c.length;b++)if(this.options.fixedPieceType==="v"&&c[b].length>2||this.options.fixedPieceType==="e"&&c[b].length===2||this.options.fixedPieceType==="f"&&c[b].length===1){this.fixedCubie=b;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 "+K)}unswizzle(t){let r=this.notationMapper.notationToInternal(t);return r===null?"":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 a="1",s=1;return n[5]!==void 0&&(a=n[5],a[0]==="'"&&(a="-"+a.substring(1)),s=parseInt(a,10)),new B(new C(l,i,o),s)}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,a=this.swizzler.unswizzle(n),s=!1;for(let c=0;c<this.movesetgeos.length;c++){let u=this.movesetgeos[c];a===u[0]&&(s=!0,o=u,i=c),a===u[2]&&(s=!1,o=u,i=c)}let f=1,g=1;if(n.toUpperCase()!==n&&(g=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?(g=t.innerLayer,n<="Z"?f=g:f=1):g=t.innerLayer),f--,g--,l&&(f=0,g=this.moveplanesets[i].length),f<0||f>this.moveplanesets[i].length||g<0||g>this.moveplanesets[i].length)throw new Error("Bad slice spec "+f+" "+g+" vs "+this.moveplanesets[i].length);if(!_m&&f===0&&g===this.moveplanesets[i].length&&!l)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,f,g,s,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);if(this.basefaces[o].centermass().dist(this.facecentermass[l])<Ee){let i=this.basefaces[o].length;for(let a=1;a<i;a++)this.cubies[n].push(this.cubies[n][a-1]);this.duplicatedFaces[l]=i,this.duplicatedCubies[n]=i,this.orbitoris[this.cubiesetnums[n]]=i}}}for(let n=0;n<this.moveplanesets.length;n++){let l=this.moveplanesets[n],o=[],i=[l.length+1,0],a=1;for(;a*2<=l.length;)a*=2;for(let g=0;g<this.faces.length;g++){let c=0;if(l.length>0){let u=this.facecentermass[g].dot(l[0]);for(let p=a;p>0;p>>=1)c+p<=l.length&&u>l[c+p-1].a&&(c+=p);c=l.length-c}for(o.push(c);i.length<=c;)i.push(0);i[c]++}let s=new Array(i.length);for(let g=0;g<i.length;g++)s[g]=[];let f=[];for(let g=0;g<this.faces.length;g++){if(o[g]<0)continue;let c=[this.facetocubie[g],this.facetoord[g]],u=this.facecentermass[g],p=u,m=g,L=o[m];for(;;){o[m]=-1;let R=u.rotatepoint(this.moverotations[n][0]);if(R.dist(p)<Ee)break;m=this.findface(R),c.push(this.facetocubie[m],this.facetoord[m]),u=R}if(c.length>2&&this.options.orientCenters&&(this.cubies[c[0]].length===1||this.duplicatedCubies[c[0]]>1)&&this.facecentermass[g].dist(this.basefaces[this.getfaceindex(g)].centermass())<Ee){let R=this.faces[this.cubies[c[0]][0]];for(let h=0;h<c.length;h+=2){let y=this.faces[this.cubies[c[h]][0]],A=-1;for(let E=0;E<R.length;E++)if(y.get(E).dist(R.get(0))<Ee){A=E;break}if(A<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");c[h+1]=A,R=R.rotate(this.moverotations[n][0])}}if(c.length===2&&this.options.orientCenters)for(let R=1;R<this.movesetorders[n];R++)L===0?c.push(c[0],R):c.push(c[0],(this.movesetorders[n]-R)%this.movesetorders[n]);if(c.length>2&&!f[c[0]]){if(c.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let R of c)s[L].push(R)}for(let R=0;R<c.length;R+=2)f[c[R]]=!0}for(let g=0;g<s.length;g++)s[g]=s[g].slice();r.push(s)}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 a=n[i];if(l>=a[0]&&l<=a[1])if(a[0]===0)a=[a[1]+1,r];else if(r===a[1])a=[0,a[0]-1];else throw Error("fixed cubie option would disconnect move");let s=!1;for(let f=0;f<o.length;f+=2)if(o[f][0]===a[0]&&o[f][1]===a[1]&&o[f+1]===n[i+1]){s=!0;break}s||(o.push(a),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+Em+\`
|
|
8
|
+
\`:" "}var it,Ir,_,qt=U(()=>{jt();_0();Dt();x0();C0();Al();Vt();yl();v0();Ir=class extends Oe{constructor(t){super();re(this,it,void 0);j(this,it,Array.from(h2(t)));for(let r of d(this,it))if(!m2(r))throw new Error("An alg can only contain units.")}isIdentical(t){let r=t;if(!t.is(Ir))return!1;let n=Array.from(d(this,it)),l=Array.from(d(r,it));if(n.length!==l.length)return!1;for(let o=0;o<n.length;o++)if(!n[o].isIdentical(l[o]))return!1;return!0}invert(){return new Ir(i2(Array.from(d(this,it)).map(t=>t.invert())))}*experimentalExpand(t=1,r){r??(r=1/0);for(let n of y0(d(this,it),t))yield*n.experimentalExpand(t,r)}expand(t){return new Ir(this.experimentalExpand(1,t?.depth??1/0))}*experimentalLeafMoves(){for(let t of this.experimentalExpand())t.is(B)&&(yield t)}concat(t){return new Ir(Array.from(d(this,it)).concat(Array.from(h2(t))))}experimentalIsEmpty(){for(let t of d(this,it))return!1;return!0}static fromString(t){return w0(t)}*units(){for(let t of d(this,it))yield t}experimentalNumUnits(){return Array.from(d(this,it)).length}get type(){return xo("deprecated: type"),"sequence"}toString(){let t="",r=null;for(let n of d(this,it))r&&(t+=im(r,n)),t+=n.toString(),r=n;return t}simplify(t){return new Ir(d2(this,t??{}))}},_=Ir;it=new WeakMap});var am,F2=U(()=>{qt();ko();Fl();Dl();Vt();Ul();am={Sune:new _([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 _([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 _([new Ie(new _([new B("R",1),new B("U",1),new B("R",-2)]),new _([new We(new _([new B("R",1)]),new _([new B("U",1)]))]))]),Niklas:new _([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 _([new B("x",-1),new Ie(new _([new We(new _([new B("R",1)]),new _([new B("U",-1)]))]),new _([new B("D",1)])),new Ie(new _([new We(new _([new B("R",1)]),new _([new B("U",1)]))]),new _([new B("D",1)])),new B("x",1)]),FURURFCompact:new _([new We(new _([new B("F",1)]),new _([new Ie(new _([new B("U",1)]),new _([new B("R",1)]))]))]),APermCompact:new _([new We(new _([new B("R",2)]),new _([new Ie(new _([new B("F",2)]),new _([new B("R",-1),new B("B",-1),new B("R",1)]))]))]),FURURFMoves:new _([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 _([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 _([new We(new _([new B("F",1)]),new _([new gt(new _([new Ie(new _([new B("R",1)]),new _([new B("U",1)]))]),3)]))]),TriplePause:new _([new Xe,new Xe,new Xe])}});var fA,D2=U(()=>{Vt();fA={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'")}});var A2=U(()=>{});var y2=U(()=>{qt()});var Le=U(()=>{qt();b0();C0();F2();D2();ko();Vt();A2();y2();_0();Dt()});function Sl(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(bl(o.numOrientations,a))n[l]=i;else if(bl(o.numOrientations,i))n[l]=a;else{let s=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)s[f]=i.permutation[a.permutation[f]];n[l]={permutation:s,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let g=0;g<o.numPieces;g++)f[g]=(i.orientation[a.permutation[g]]+a.orientation[g])%o.numOrientations,s[g]=i.permutation[a.permutation[g]];n[l]={permutation:s,orientation:f}}}}return n}function P0(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(bl(o.numOrientations,a))n[l]=i;else{let s=new Array(o.numPieces);if(o.numOrientations===1){for(let f=0;f<o.numPieces;f++)s[f]=i.pieces[a.permutation[f]];n[l]={pieces:s,orientation:i.orientation}}else{let f=new Array(o.numPieces);for(let g=0;g<o.numPieces;g++)f[g]=(i.orientation[a.permutation[g]]+a.orientation[g])%o.numOrientations,s[g]=i.pieces[a.permutation[g]];n[l]={pieces:s,orientation:f}}}}return n}var Co=U(()=>{wl()});function sm(e){let t=U2.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 b2&&(Object.freeze(r),Object.freeze(n),Object.freeze(l)),U2.set(e,l),l}function S2(e){let t={};for(let[r,n]of Object.entries(e.orbits))t[r]=sm(n.numPieces);return b2&&Object.freeze(t),t}function w2(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 gr(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 gr(e,o,-1);throw new Error(\`Invalid move for KPuzzle (\${e.name()}): \${t}\`)}var b2,U2,M0=U(()=>{wl();b2=!1,U2=new Map});var Be,Po=U(()=>{Co();xl();Be=class{constructor(t,r){this.kpuzzle=t;this.stateData=r}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),stateData:this.stateData}}static fromTransformation(t){let r=P0(t.kpuzzle.definition,t.kpuzzle.definition.startStateData,t.transformationData);return new Be(t.kpuzzle,r)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(t.isIdentityTransformation())return new Be(this.kpuzzle,this.stateData);let r=P0(this.kpuzzle.definition,this.stateData,t.transformationData);return new Be(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 Ut(this.kpuzzle,t)}}});var Wr,cr,Ut,xl=U(()=>{wl();Co();M0();Po();cr=class{constructor(t,r){this.kpuzzle=t;this.transformationData=r;re(this,Wr,void 0)}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),transformationData:this.transformationData}}invert(){return new cr(this.kpuzzle,N0(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return d(this,Wr)??j(this,Wr,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(t){let r=new cr(t,S2(t.definition));return j(r,Wr,!0),r}isIdentical(t){return x2(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 d(this,Wr)?new cr(this.kpuzzle,t.transformationData):d(t,Wr)?new cr(this.kpuzzle,this.transformationData):new cr(this.kpuzzle,Sl(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 Be.fromTransformation(this)}repetitionOrder(){return v2(this.kpuzzle.definition,this)}selfMultiply(t){return new cr(this.kpuzzle,gr(this.kpuzzle,this.transformationData,t))}},Ut=cr;Wr=new WeakMap});function bl(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 fm(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 x2(e,t,r){for(let[n,l]of Object.entries(e.definition.orbits))if(!fm(l,t[n],r[n]))return!1;return!0}function N0(e,t){let r={};for(let n in e.definition.orbits){let l=e.definition.orbits[n],o=t[n];if(bl(l.numOrientations,o))r[n]=o;else if(l.numOrientations===1){let i=new Array(l.numPieces);for(let a=0;a<l.numPieces;a++)i[o.permutation[a]]=a;r[n]={permutation:i,orientation:o.orientation}}else{let i=new Array(l.numPieces),a=new Array(l.numPieces);for(let s=0;s<l.numPieces;s++){let f=o.permutation[s];i[f]=s,a[f]=(l.numOrientations-o.orientation[s]+l.numOrientations)%l.numOrientations}r[n]={permutation:i,orientation:a}}}return r}function gr(e,t,r){if(r===1)return t;if(r<0)return gr(e,N0(e,t),-r);if(r===0){let{transformationData:o}=e.identityTransformation();return o}let n=t;r!==2&&(n=gr(e,t,Math.floor(r/2)));let l=Sl(e.definition,n,n);return r%2===0?l:Sl(e.definition,t,l)}function G0(e,t){return t?G0(t,e%t):e}function v2(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 a=0;a<l.numPieces;a++)if(!i[a]){let s=a,f=0,g=0;for(;i[s]=!0,f=f+o.orientation[s],g=g+1,s=o.permutation[s],s!==a;);f!==0&&(g=g*l.numOrientations/G0(l.numOrientations,f)),r=r*g/G0(r,g)}}return r}var _2,E2,k2,wl=U(()=>{Le();Co();xl();_2=class extends yn{traverseAlg(t,r){let n=null;for(let l of t.units())n?n=n.applyTransformation(this.traverseUnit(l,r)):n=this.traverseUnit(l,r);return n??r.identityTransformation()}traverseGrouping(t,r){let n=this.traverseAlg(t.alg,r);return new Ut(r,gr(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()}},E2=new _2,k2=E2.traverseAlg.bind(E2)});var bn,Mo,be,T0=U(()=>{Le();wl();M0();Po();xl();be=class{constructor(t,r){this.definition=t;re(this,bn,new Map);re(this,Mo,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return Ut.experimentalConstructIdentity(this)}moveToTransformation(t){typeof t=="string"&&(t=new B(t));let r=t.toString(),n=d(this,bn).get(r);if(n)return new Ut(this,n);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(t);if(!o)throw new Error(\`could not map to internal move: \${t}\`);return d(this,bn).set(r,o),new Ut(this,o)}let l=w2(this,t);return d(this,bn).set(r,l),new Ut(this,l)}algToTransformation(t){return typeof t=="string"&&(t=new _(t)),k2(t,this)}toTransformation(t){return typeof t=="string"?this.algToTransformation(t):t?.is?.(_)?this.algToTransformation(t):t?.is?.(B)?this.moveToTransformation(t):t}startState(){return new Be(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return d(this,Mo)??j(this,Mo,(()=>{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})())}get state(){throw new Error("KPuzzle is now a different (stateless) class.")}reset(){throw new Error("KPuzzle is now a different (stateless) class.")}applyMove(t){throw new Error("KPuzzle is now a different class. Try \`.moveToTransformation()\` to get the transformation for a move.")}applyAlg(t){throw new Error("KPuzzle is now a different class. Try \`.algToTransformation()\` to get the transformation for an alg.")}};bn=new WeakMap,Mo=new WeakMap});var Fe,z2=U(()=>{Fe={name:"3x3x3",orbits:{EDGES:{numPieces:12,numOrientations:2},CORNERS:{numPieces:8,numOrientations:3},CENTERS:{numPieces:6,numOrientations:4}},startStateData:{EDGES:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{pieces:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{pieces:[0,1,2,3,4,5],orientation:[0,0,0,0,0,0]}},moves:{U:{EDGES:{permutation:[1,2,3,0,4,5,6,7,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[1,0,0,0,0,0]}},y:{EDGES:{permutation:[1,2,3,0,5,6,7,4,10,8,11,9],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[1,2,3,0,7,4,5,6],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,2,3,4,1,5],orientation:[1,0,0,0,0,3]}},x:{EDGES:{permutation:[4,8,0,9,6,10,2,11,5,7,1,3],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[4,0,3,5,7,6,2,1],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[2,1,5,3,0,4],orientation:[0,3,0,1,2,2]}},L:{EDGES:{permutation:[0,1,2,11,4,5,6,9,8,3,10,7],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,1,0,0,0,0]}},F:{EDGES:{permutation:[9,1,2,3,8,5,6,7,0,4,10,11],orientation:[1,0,0,0,1,0,0,0,1,1,0,0]},CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,1,0,0,0]}},R:{EDGES:{permutation:[0,8,2,3,4,10,6,7,5,9,1,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,1,0,0]}},B:{EDGES:{permutation:[0,1,10,3,4,5,11,7,8,9,6,2],orientation:[0,0,1,0,0,0,1,0,0,0,1,1]},CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,1,0]}},D:{EDGES:{permutation:[0,1,2,3,7,4,5,6,8,9,10,11],orientation:[0,0,0,0,0,0,0,0,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,0,1]}},z:{EDGES:{permutation:[9,3,11,7,8,1,10,5,0,4,2,6],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[3,2,6,5,0,4,7,1],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,1,1,3,1]}},M:{EDGES:{permutation:[2,1,6,3,0,5,4,7,8,9,10,11],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,0,0,0,2,0]}},E:{EDGES:{permutation:[0,1,2,3,4,5,6,7,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[0,0,0,0,0,0]}},S:{EDGES:{permutation:[0,3,2,7,4,1,6,5,8,9,10,11],orientation:[0,1,0,1,0,1,0,1,0,0,0,0]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,0,1,0,1]}},u:{EDGES:{permutation:[1,2,3,0,4,5,6,7,10,8,11,9],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,2,3,4,1,5],orientation:[1,0,0,0,0,0]}},l:{EDGES:{permutation:[2,1,6,11,0,5,4,9,8,3,10,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,0,2,0]}},f:{EDGES:{permutation:[9,3,2,7,8,1,6,5,0,4,10,11],orientation:[1,1,0,1,1,1,0,1,1,1,0,0]},CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]},CENTERS:{permutation:[1,5,2,0,4,3],orientation:[1,1,1,1,0,1]}},r:{EDGES:{permutation:[4,8,0,3,6,10,2,7,5,9,1,11],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]},CENTERS:{permutation:[2,1,5,3,0,4],orientation:[0,0,0,1,2,2]}},b:{EDGES:{permutation:[0,5,10,1,4,7,11,3,8,9,6,2],orientation:[0,1,1,1,0,1,1,1,0,0,1,1]},CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,0,3,1,3]}},d:{EDGES:{permutation:[0,1,2,3,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[0,0,0,0,0,1]}}}};Fe.moves.Uw=Fe.moves.u;Fe.moves.Lw=Fe.moves.l;Fe.moves.Fw=Fe.moves.f;Fe.moves.Rw=Fe.moves.r;Fe.moves.Bw=Fe.moves.b;Fe.moves.Dw=Fe.moves.d;Fe.moves.Rv=Fe.moves.x;Fe.moves.Uv=Fe.moves.y;Fe.moves.Fv=Fe.moves.z;Fe.moves.Lv={EDGES:{permutation:[2,10,6,11,0,8,4,9,1,3,5,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,3,2,0]}};Fe.moves.Dv={EDGES:{permutation:[3,0,1,2,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[3,0,0,0,0,1]}};Fe.moves.Bv={EDGES:{permutation:[8,5,10,1,9,7,11,3,4,0,6,2],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,3,3,1,3]}}});var O0,je=U(()=>{T0();Po();xl();z2();T0();O0=new be(Fe)});var C2=U(()=>{je()});var um,Ry,P2=U(()=>{um={"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"}},Ry={...um,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 Fm(e){switch(e){case"Regular":return gm;case"Dim":return Rm;case"Ignored":return cm;case"OrientationStickers":return pm;case"Invisible":return mm;case"IgnoreNonPrimary":return Lm;case"PermuteNonPrimary":return Bm;case"Ignoriented":return dm;case"OrientationWithoutPermutation":return hm}}var vl,wn,Ct,qe,Sn,No,Kr,gm,cm,pm,mm,Lm,Bm,Rm,dm,hm,El,_l,kl=U(()=>{vl=(f=>(f.Regular="Regular",f.Dim="Dim",f.Ignored="Ignored",f.OrientationStickers="OrientationStickers",f.Invisible="Invisible",f.Ignoriented="Ignoriented",f.IgnoreNonPrimary="IgnoreNonPrimary",f.PermuteNonPrimary="PermuteNonPrimary",f.OrientationWithoutPermutation="OrientationWithoutPermutation",f))(vl||{}),wn=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))}},Ct="regular",qe="ignored",Sn="oriented",No="invisible",Kr="dim",gm={facelets:[Ct,Ct,Ct,Ct,Ct]},cm={facelets:[qe,qe,qe,qe,qe]},pm={facelets:[Sn,Sn,Sn,Sn,Sn]},mm={facelets:[No,No,No,No]},Lm={facelets:[Ct,qe,qe,qe,qe]},Bm={facelets:[Kr,Ct,Ct,Ct,Ct]},Rm={facelets:[Kr,Kr,Kr,Kr,Kr]},dm={facelets:[Kr,qe,qe,qe,qe]},hm={facelets:[Sn,qe,qe,qe,qe]};El=class extends wn{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(Fm(i))}return t}},_l=class{constructor(t){this.kpuzzle=t}and(t){let r=new wn(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 wn(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 wn(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 wn(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))}}});function Dm(e){(async()=>{M2=e;let t=Array.from(document.body.querySelectorAll("twisty-player"));console.log(\`Setting the custom stickering for \${t.length} players!\`);let r=[];for(let n of t)r.push((async()=>{let l=await n.experimentalModel.twistySceneModel.stickering.get();n.experimentalStickering=l==="experimental-global-custom-1"?"experimental-global-custom-2":"experimental-global-custom-1"})());await Promise.all(r),console.log("Success!")})()}function N2(e,t){M2(e,t)}var M2,G2=U(()=>{kl();M2=()=>{};globalThis.location&&new URL(location.href).searchParams.get("global-custom-stickerer")==="true"&&(window.setGlobalCustomStickerer=Dm,window.PieceStickering=vl,console.log("Global custom stickerer enabled! (using: global-custom-stickerer=true)"),console.log("Look here for inspiration:","https://github.com/cubing/cubing.js/blob/81b5cab3e27d8defb39dd1e0a10bc9e8ba894d26/src/cubing/puzzles/stickerings/cube-stickerings.ts#L67"))});async function Pt(e,t){let r=await e.kpuzzle(),n=new El(r),l=new _l(r),o=()=>l.move("U"),i=()=>l.or(l.moves(["U","D"])),a=()=>l.not(i()),s=()=>l.or(l.moves(["L","R"])),f=()=>l.not(s()),g=()=>l.or(l.moves(["F","B"])),c=()=>l.not(g()),u=()=>l.not(o()),p=()=>l.and([o(),f(),c()]),m=()=>l.and([l.and(l.moves(["F","R"])),l.not(i())]),L=()=>l.and(l.moves(["D","R","F"])),R=()=>l.or([L(),m()]),h=()=>l.or([l.and([f(),a()]),l.and([f(),c()]),l.and([a(),c()])]),y=()=>l.or([l.and([f(),i(),g()]),l.and([a(),s(),g()]),l.and([c(),i(),s()])]),A=()=>l.not(l.or([h(),y()])),E=()=>l.or([f(),l.and([o(),y()])]);function v(){n.set(u(),"Dim")}function K(){n.set(o(),"PermuteNonPrimary"),n.set(p(),"Dim")}function Z(){n.set(o(),"IgnoreNonPrimary"),n.set(p(),"Regular")}function M(){n.set(o(),"Ignoriented"),n.set(p(),"Dim")}switch(t){case"full":break;case"PLL":v(),K();break;case"CLS":v(),n.set(l.and(l.moves(["D","R","F"])),"Regular"),n.set(o(),"Ignoriented"),n.set(l.and([o(),f(),c()]),"Dim"),n.set(l.and([o(),A()]),"IgnoreNonPrimary");break;case"OLL":v(),Z();break;case"COLL":v(),K(),n.set(l.and([o(),A()]),"Regular");break;case"OCLL":v(),M(),n.set(l.and([o(),A()]),"IgnoreNonPrimary");break;case"CLL":v(),n.set(l.not(l.and([A(),o()])),"Dim");break;case"ELL":v(),n.set(o(),"Dim"),n.set(l.and([o(),y()]),"Regular");break;case"ELS":v(),Z(),n.set(l.and([o(),A()]),"Ignored"),n.set(m(),"Regular"),n.set(L(),"Ignored");break;case"LL":v();break;case"F2L":n.set(o(),"Ignored");break;case"ZBLL":v(),n.set(o(),"PermuteNonPrimary"),n.set(p(),"Dim"),n.set(l.and([o(),A()]),"Regular");break;case"ZBLS":v(),n.set(R(),"Regular"),Z(),n.set(l.and([o(),A()]),"Ignored");break;case"WVLS":case"VLS":v(),n.set(R(),"Regular"),Z();break;case"LS":v(),n.set(R(),"Regular"),n.set(o(),"Ignored"),n.set(p(),"Dim");break;case"EO":n.set(A(),"Ignored"),n.set(y(),"OrientationWithoutPermutation");break;case"EOline":n.set(A(),"Ignored"),n.set(y(),"OrientationWithoutPermutation"),n.set(l.and(l.moves(["D","M"])),"Regular");break;case"EOcross":n.set(y(),"OrientationWithoutPermutation"),n.set(l.move("D"),"Regular"),n.set(A(),"Ignored");break;case"CMLL":n.set(u(),"Dim"),n.set(E(),"Ignored"),n.set(l.and([o(),A()]),"Regular");break;case"L6E":n.set(l.not(E()),"Dim");break;case"L6EO":n.set(l.not(E()),"Dim"),n.set(E(),"OrientationWithoutPermutation"),n.set(l.and([h(),i()]),"OrientationStickers");break;case"Daisy":n.set(l.all(),"Ignored"),n.set(h(),"Dim"),n.set(l.and([l.move("D"),h()]),"Regular"),n.set(l.and([l.move("U"),y()]),"IgnoreNonPrimary");break;case"Cross":n.set(l.all(),"Ignored"),n.set(h(),"Dim"),n.set(l.and([l.move("D"),h()]),"Regular"),n.set(l.and([l.move("D"),y()]),"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"])),h()]),"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"])),h()]),"Dim"),n.set(l.and([l.move("F"),l.not(l.or(l.moves(["U","R"])))]),"Regular");break;case"Void Cube":n.set(h(),"Invisible");break;case"picture":case"invisible":n.set(l.all(),"Invisible");break;case"centers-only":n.set(l.not(h()),"Ignored");break;case"experimental-global-custom-1":case"experimental-global-custom-2":N2(n,l);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 xn(){return["full","PLL","CLS","OLL","COLL","OCLL","ELL","ELS","LL","F2L","ZBLL","ZBLS","WVLS","VLS","LS","EO","EOline","EOcross","CMLL","L6E","L6EO","Daisy","Cross","2x2x2","2x2x3","Void Cube","picture","invisible","centers-only"]}var vn=U(()=>{kl();G2()});function de(e){let t=null;return()=>t??(t=e())}var Mt=U(()=>{});var zl,T2=U(()=>{zl=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 a=0;a<o;a++)if(n[o]===n[a])return!1;let i=!1;for(let a=0;a<l.length;a++)if(n[o]===l[a]){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 En,O2=U(()=>{En=class{notationToInternal(t){return t}notationToExternal(t){return t}}});var Go,I2=U(()=>{Le();Go=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 C("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 C("T",t.innerLayer,t.outerLayer),t.amount):this.child.notationToExternal(t)}}});var Cl,W2=U(()=>{Le();Cl=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 C(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 To,K2=U(()=>{Le();To=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 C("L",3,2),-2*t.amount);if(t.family==="R--")return new B(new C("L",3,2),2*t.amount);if(t.family==="D++")return new B(new C("U",3,2),-2*t.amount);if(t.family==="D--")return new B(new C("U",3,2),2*t.amount);if(t.family==="R_PLUSPLUS_")return new B(new C("L",3,2),-2*t.amount);if(t.family==="D_PLUSPLUS_")return new B(new C("U",3,2),-2*t.amount)}if(t.family==="y")return new B("Uv",t.amount)}return this.child.notationToInternal(t)}notationToExternal(t){return t.family==="Uv"?new B(new C("y",t.innerLayer,t.outerLayer),t.amount):t.family==="Dv"?new B("y",-t.amount):this.child.notationToExternal(t)}}});var Oo,Q2=U(()=>{Le();Oo=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 C("D",(this.slices+1)/2),t.amount):r==="M"?t=new B(new C("L",(this.slices+1)/2),t.amount):r==="S"&&(t=new B(new C("F",(this.slices+1)/2),t.amount))),this.slices>2&&(r==="e"?t=new B(new C("D",this.slices-1,2),t.amount):r==="m"?t=new B(new C("L",this.slices-1,2),t.amount):r==="s"&&(t=new B(new C("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 Am,ym,j2,q2,V2,Pl,Io,H2=U(()=>{Le();Am={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"},ym={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"},j2={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},q2=new C("y"),V2=new C("Dv"),Pl=class{constructor(t){this.child=t;this.wcaHack=!1;this.map=Am}notationToInternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){let n=j2[t.family];if(n)return new B(new C(n,t.innerLayer,t.outerLayer),t.amount)}let r=this.map[t.family];return r?new B(new C(r,t.innerLayer,t.outerLayer),t.amount):q2.isIdentical(t.quantum)?new B(V2,-t.amount):null}notationToExternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){for(let[r,n]of Object.entries(j2))if(this.child.spinmatch(t.family,n))return new B(new C(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 C(r,t.innerLayer,t.outerLayer),t.amount);return V2.isIdentical(t.quantum)?new B(q2,-t.amount):null}},Io=class extends Pl{constructor(t){super(t);this.map=ym}}});var Y2,I0,J2,Um,W0,Z2,bm,K0,X2,Sm,Wo,$2=U(()=>{Le();Y2={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"},I0=new C("x"),J2=new C("Rv"),Um=new C("Lv"),W0=new C("y"),Z2=new C("Uv"),bm=new C("Dv"),K0=new C("z"),X2=new C("Fv"),Sm=new C("Bv"),Wo=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer||t.outerLayer)return null;let r=Y2[t.family];return r?new B(new C(r,t.outerLayer,t.innerLayer),t.amount):I0.isIdentical(t.quantum)?new B(J2,t.amount):W0.isIdentical(t.quantum)?new B(Z2,t.amount):K0.isIdentical(t.quantum)?new B(X2,t.amount):null}notationToExternal(t){for(let[r,n]of Object.entries(Y2))if(this.child.spinmatchv(t.family,n))return new B(new C(r,t.innerLayer,t.outerLayer),t.amount);return J2.isIdentical(t.quantum)?new B(I0,t.amount):Um.isIdentical(t.quantum)?new B(I0,-t.amount):Z2.isIdentical(t.quantum)?new B(W0,t.amount):bm.isIdentical(t.quantum)?new B(W0,-t.amount):X2.isIdentical(t.quantum)?new B(K0,t.amount):Sm.isIdentical(t.quantum)?new B(K0,-t.amount):null}}});var Q0=U(()=>{O2();I2();W2();K2();Q2();H2();$2()});function ef(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:Ml(e.slice(t).join(" ")),options:r}}var j0,q0=U(()=>{Ko();j0=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 pr(e){if(!V0[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=0;V0[e]=t}return V0[e]}function Nt(e){if(!H0[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;H0[e]=t}return H0[e]}function tf(e){return new mt(Nt(e))}function rf(e){let t=1;for(;e>1;)t*=e,e--;return t}function wm(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 Y0(e,t){return e/wm(e,t)*t}var V0,H0,mt,Qo=U(()=>{V0=[],H0=[];mt=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 mt(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 mt(r)}inv(){let t=Array(this.n);for(let r=0;r<this.n;r++)t[this.p[r]]=r;return new mt(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=Y0(t,l)}return t}}});function Z0(e,t){let r=B.fromString(t),n=e.notationToExternal(r);return n===null||r===n?t:n.toString()}function nf(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 a=e.moveops[i];n.push(a.order());let s=0;for(let f=0;f<r;f++){if(f===i)continue;let g=e.moveops[f];a.mul(g).equal(g.mul(a))&&(s|=1<<f)}l.push(s)}let o={};o[0]=1;for(let i=0;i<100;i++){let a=0,s={},f=0;for(let g in o){let c=+g,u=o[c];a+=u,f++;for(let p=0;p<n.length;p++)if((c>>p&1)===0&&(c&l[p]&(1<<p)-1)===0){let m=c&l[p]|1<<p;s[m]===void 0&&(s[m]=0),s[m]+=(n[p]-1)*u}}t(\`\${i}: canonseq \${a} states \${f}\`),o=s}}var Nl,xm,_n,bt,Yt,X0,mr,kn,J0,lf=U(()=>{Le();Q0();Qo();Nl=class{constructor(t,r){this.size=t;this.mod=r}reassemblySize(){return rf(this.size)*Math.pow(this.mod,this.size)}},xm=0;_n=class{constructor(t,r,n,l,o){this.orbitnames=t;this.orbitdefs=r;this.solved=n;this.movenames=l;this.moveops=o}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}toKsolve(t,r=new En){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}\`);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=Z0(r,this.movenames[l]),i=!1;o[o.length-1]==="'"&&(i=!0,o=o.substring(0,o.length-1)),n.push("Move "+o);for(let a=0;a<this.orbitnames.length;a++)i?this.moveops[l].orbits[a].inv().appendDefinition(n,this.orbitnames[a],!0):this.moveops[l].orbits[a].appendDefinition(n,this.orbitnames[a],!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 #\${++xm}\`,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,a=this.orbitdefs[o].size,s=new J0(a),f=new Array(this.orbitdefs[o].size);for(let p=0;p<a;p++)f[p]=!1;for(let p=0;p<this.moveops.length;p++)for(let m=0;m<a;m++)(this.moveops[p].orbits[o].perm[m]!==m||this.moveops[p].orbits[o].ori[m]!==0)&&(f[m]=!0,s.union(m,this.moveops[p].orbits[o].perm[m]));let g=!0;if(i>1){g=!1;let p=new J0(this.orbitdefs[o].size*i);for(let m=0;m<this.moveops.length;m++)for(let L=0;L<a;L++)if(this.moveops[m].orbits[o].perm[L]!==L||this.moveops[m].orbits[o].ori[L]!==0)for(let R=0;R<i;R++)p.union(L*i+R,this.moveops[m].orbits[o].perm[L]*i+(R+this.moveops[m].orbits[o].ori[L])%i);for(let m=0;!g&&m<a;m++)for(let L=1;L<i;L++)p.find(m*i)===p.find(m*i+L)&&(g=!0);for(let m=0;!g&&m<a;m++)for(let L=0;L<m;L++)this.solved.orbits[o].perm[m]===this.solved.orbits[o].perm[L]&&(g=!0)}let c=-1,u=!1;for(let p=0;p<this.orbitdefs[o].size;p++)if(f[p]){let m=s.find(p);c<0?c=m:c!==m&&(u=!0)}for(let p=0;p<this.orbitdefs[o].size;p++){if(!f[p]||s.find(p)!==p)continue;let L=[],R=[],h=0;for(let y=0;y<this.orbitdefs[o].size;y++)s.find(y)===p&&(L[h]=y,R[y]=h,h++);if(u?t.push(\`\${this.orbitnames[o]}_p\${p}\`):t.push(this.orbitnames[o]),g){r.push(new Nl(h,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(L,h));for(let y=0;y<this.moveops.length;y++)l[y].push(this.moveops[y].orbits[o].remap(L,R,h))}else{r.push(new Nl(h,1)),n.push(this.solved.orbits[o].remapVS(L,h).killOri());for(let y=0;y<this.moveops.length;y++)l[y].push(this.moveops[y].orbits[o].remap(L,R,h).killOri())}}}return new _n(t,r,new kn(n),this.movenames,l.map(o=>new mr(o)))}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),a=Math.floor(Math.random()*this.moveops.length);r[o]=r[o].mul(r[i]).mul(this.moveops[a]),Math.random()<.1&&(r[o]=r[o].mul(this.moveops[a]))}let n=r[0];for(let l=1;l<r.length;l++)n=n.mul(r[l]);return n}reassemblySize(){let t=1;for(let r=0;r<this.orbitdefs.length;r++)t*=this.orbitdefs[r].reassemblySize();return t}},bt=class{constructor(t,r,n){this.perm=t;this.ori=r;this.orimod=n}static e(t,r){return new bt(Nt(t),pr(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 bt(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 bt(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 bt(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 mt(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 mt(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 a=l+1;a<r;a++)this.perm[a]===o&&i.push(a);n.push(i)}}return n}order(){return this.toPerm().order()}isIdentity(){let t=this.perm.length;if(this.perm===Nt(t)&&this.ori===pr(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===pr(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 bt(l,o,this.orimod)}remapVS(t,r){let n=new Array(r),l=new Array(r),o=0,i=[];for(let a=0;a<r;a++){let s=this.perm[t[a]];i[s]===void 0&&(i[s]=o++),n[a]=i[s],l[a]=this.ori[t[a]]}return new bt(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()?(bt.kcache[t]||(bt.kcache[t]={permutation:Nt(t),orientation:pr(t)}),bt.kcache[t]):{permutation:this.perm,orientation:this.ori}}},Yt=bt;Yt.kcache=[];X0=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 mt(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(a=>a*l+r));r+=l*n.perm.length}return t}order(){let t=1;for(let r of this.orbits)t=Y0(t,r.order());return t}},mr=class extends X0{constructor(t){super(t)}mul(t){return new mr(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 mr(this.internalInv())}e(){return new mr(this.orbits.map(t=>Yt.e(t.perm.length,t.orimod)))}},kn=class extends X0{constructor(t){super(t)}mul(t){return new kn(this.internalMul(t))}},J0=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 jo,of=U(()=>{jo={"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 qo(e){let t=new O(0,0,0,0);for(let r=0;r<e.length;r++)t=t.sum(e[r]);return t.smul(1/e.length)}function af(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 O,Vo=U(()=>{O=class{constructor(t,r,n,l){this.a=t;this.b=r;this.c=n;this.d=l}mul(t){return new O(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 O(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 O(this.a/t,this.b/t,this.c/t,this.d/t)}makenormal(){return new O(0,this.b,this.c,this.d).normalize()}normalizeplane(){let t=Math.hypot(this.b,this.c,this.d);return new O(this.a/t,this.b/t,this.c/t,this.d/t)}smul(t){return new O(this.a*t,this.b*t,this.c*t,this.d*t)}sum(t){return new O(this.a+t.a,this.b+t.b,this.c+t.c,this.d+t.d)}sub(t){return new O(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 O(this.a,-this.b,-this.c,-this.d)}det3x3(t,r,n,l,o,i,a,s,f){return t*(o*f-i*s)+r*(i*a-l*f)+n*(l*s-o*a)}rotateplane(t){let r=t.mul(new O(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 O(0,1,0,0)).normalize():r<t&&r<n?this.cross(new O(0,0,1,0)).normalize():this.cross(new O(0,0,0,1)).normalize()}pointrotation(t){let r=this.normalize();if(t=t.normalize(),r.sub(t).len()<1e-9)return new O(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 O(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 a=[];for(let s=0;s<t.length;s++){(o[s]===i||o[s]===0)&&a.push(t[s]);let f=(s+1)%t.length;if(o[s]+o[f]===0&&o[s]!==0){let g=t[s].dot(this)-r,c=t[f].dot(this)-r,u=g/(g-c),p=t[s].smul(1-u).sum(t[f].smul(u));a.push(p)}}l.push(a)}}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 O(t,this.b,this.c,this.d)}}});function sf(){let e=Math.sqrt(.5);return[new O(e,e,0,0),new O(e,0,e,0)]}function ff(){return[new O(.5,.5,.5,.5),new O(.5,.5,.5,-.5)]}function uf(){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 O(Math.cos(e),t*Math.sin(e),r*Math.sin(e),0),new O(.5,.5,.5,.5)]}function gf(){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 O(Math.cos(n),e*Math.sin(n),t*Math.sin(n),0),new O(Math.cos(n),-e*Math.sin(n),t*Math.sin(n),0)]}function cf(){let e=Math.sqrt(.5);return[new O(.5,.5,.5,.5),new O(e,0,0,e)]}function pf(e){let t=[new O(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 a=0;a<t.length;a++)if(l.dist(t[a])<Ho||o.dist(t[a])<Ho){i=!0;break}i||t.push(l)}return t}function $0(e,t){let r=[],n=[];for(let l=0;l<t.length;l++){let o=e.rotateplane(t[l]),i=!1;for(let a=0;a<r.length;a++)if(o.dist(r[a])<Ho){i=!0;break}i||(r.push(o),n.push(t[l]))}return n}function ea(e){let t=[];for(let r=1;r<e.length;r++)for(let n=r+1;n<e.length;n++){let l=af(0,r,n,e);if(l){let o=!1;for(let i=0;i<t.length;i++)if(l.dist(t[i])<Ho){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 Ho,mf=U(()=>{Vo();Ho=1e-9});function Yo(e,t){let r=e[0].p.length,n=tf(r),l=[],o=[],i=[],a=[],s=[];function f(p){for(let m=p.p.length-1;m>=0;m--){let L=p.p[m];if(L!==m){if(!l[m][L])return!1;p=p.mul(o[m][L])}}return!0}function g(p,m,L){a[p].push(m),s[p].push(L);for(let R=0;R<l[p].length;R++)l[p][R]&&c(p,l[p][R].mul(m),L+i[p][R])}function c(p,m,L){let R=m.p[p];if(!l[p][R]){l[p][R]=m,o[p][R]=m.inv(),i[p][R]=L;for(let y=0;y<a[p].length;y++)c(p,m.mul(a[p][y]),L+s[p][y]);return}let h=m.mul(o[p][R]);f(h)||g(p-1,h,L+i[p][R])}function u(){l=[],o=[],a=[],i=[],s=[];for(let L=0;L<r;L++)l.push([]),o.push([]),i.push([]),a.push([]),s.push([]),l[L][L]=n,o[L][L]=n,i[L][L]=0;let p=0,m=1;for(let L=0;L<e.length;L++){g(r-1,e[L],1),m=1;let R=0,h=0,y=[],A=new Lf;for(let E=0;E<r;E++){let v=0,K=0;for(let M=0;M<r;M++)l[E][M]&&(v++,K+=i[E][M],E!==M&&p++);R+=a[E].length,m*=v,v>1&&A.multiply(v);let Z=K/v;y.push(Z),h+=Z}t(\`\${L}: sz \${m} T \${R} sol \${h} none \${p} mults \${A.toString()}\`)}return m}return u()}var Lf,ta=U(()=>{Qo();Lf=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 vm(e,t){let r=[];for(let n of e)for(let l of t)r.push(l.rotate(n));return r}function km(){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 zm(){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 Cm(){return{4:["F","D","L","R"],6:["U","D","F","B","L","R"],8:["F","BB","D","U","BR","L","R","BL"],12:["L","E","F","BF","R","I","U","D","BR","A","BL","C"],20:["L","S","E","O","F","B","I","P","R","K","U","D","J","A","Q","H","G","N","M","C"]}}function Pm(){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 Jo(e,t){for(let r=0;r<e.length;r++)if(e[r][0].dist(t)<Ee)return r;throw new Error("Element not found")}function Bf(){return jo}function Rf(e){return jo[e]}function Ml(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 na(e,t={}){let r=Ml(e);if(r===null)throw new Error("Could not parse the puzzle description");let n=new Xo(r,Object.assign({},{allMoves:!0},t));return n.allstickers(),n.genperms(),n}function Cn(e,t){return na(jo[e],t)}function Mm(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\`We only support slice and outer block moves right now. \${t}\`;return[o+l,n]}function Nm(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 Zo(e,t){return[e.b/t,-e.c/t,e.d/t]}function ra(e,t){let r=[],n=e.length;for(let l=0;l<n;l++){let o=Zo(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 zn,Gl,Ee,Em,_m,Xo,Qr,Ko=U(()=>{Le();T2();Q0();q0();Qo();lf();of();mf();Vo();ta();zn=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 O(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 O(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 zn(r)}rotateforward(){let t=[];for(let r=1;r<this.length;r++)t.push(this.get(r));return t.push(this.get(0)),new zn(t)}},Gl=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 Gl(r[0]),this.right=new Gl(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 zn(this.face)):r?(this.left?.collect(t,!1),this.right?.collect(t,!0)):(this.right?.collect(t,!1),this.left?.collect(t,!0)),t}};Ee=1e-9,Em="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",_m=!1;Xo=class{constructor(t,r){this.puzzleDescription=t;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.faceorder=[];this.faceprecedence=[];this.notationMapper=new En;this.addNotationMapper="";this.setReidOrder=!1;let n="genperms";this.options=new j0(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=sf();break;case"o":l=cf();break;case"i":l=gf();break;case"t":l=ff();break;case"d":l=uf();break;default:throw new Error("Bad shape argument: "+r)}this.rotations=pf(l),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let o=l[0];this.baseplanerot=$0(o,this.rotations);let i=this.baseplanerot.map(D=>o.rotateplane(D));this.baseplanes=i,this.baseFaceCount=i.length;let a=km()[i.length];this.net=a,this.colors=zm()[i.length],this.faceorder=Cm()[i.length],this.options.verbosity>0&&console.log("# Base planes: "+i.length);let s=ea(i),f=new O(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+s.length);let g=i[0].makenormal(),c=s[0].sum(s[1]).makenormal(),u=s[0].makenormal(),p=new O(1,g.b,g.c,g.d);this.options.verbosity>0&&console.log("# Boundary is "+p);let L=$0(p,this.rotations).map(D=>p.rotateplane(D)),R=ea(L);this.edgedistance=R[0].sum(R[1]).smul(.5).dist(f),this.vertexdistance=R[0].dist(f);let h=[],y=[],A=!1,E=!1,v=!1;for(let D of n){let x=null,G=0;switch(D.cutType){case"f":x=g,G=1,A=!0;break;case"v":x=u,G=this.vertexdistance,v=!0;break;case"e":x=c,G=this.edgedistance,E=!0;break;default:throw new Error("Bad cut argument: "+D.cutType)}h.push(x.makecut(D.distance)),y.push(D.distance<G)}this.options.addRotations&&(A||h.push(g.makecut(10)),v||h.push(u.makecut(10)),E||h.push(c.makecut(10))),this.basefaces=[];for(let D of this.baseplanerot){let x=D.rotateface(R);this.basefaces.push(new zn(x))}let K=[],Z=[],M=[],ne=[],b=R.length;function k(D,x,G){for(let W of D)if(W[0].dist(x)<Ee){W.push(G);return}D.push([x,G])}for(let D=0;D<this.baseplanerot.length;D++){let x=this.baseplanerot[D].rotateface(R);for(let G=0;G<x.length;G++){let W=(G+1)%x.length,le=x[G].sum(x[W]).smul(.5);k(ne,le,D)}}let P=[];for(let D=0;D<this.baseplanerot.length;D++){let x=this.baseplanerot[D].rotateface(R),G=[];for(let W=0;W<x.length;W++){let le=(W+1)%x.length,He=x[W].sum(x[le]).smul(.5),ut=ne[Jo(ne,He)];if(D===ut[1])G.push(ut[2]);else if(D===ut[2])G.push(ut[1]);else throw new Error("Could not find edge")}P.push(G)}let S={},w=[];w.push(a[0][0]),S[a[0][0]]=0,w[P[0][0]]=a[0][1],S[a[0][1]]=P[0][0];for(let D of a){let x=D[0],G=S[x];if(G===void 0)throw new Error("Bad edge description; first edge not connected");let W=-1;for(let le=0;le<P[G].length;le++){let He=w[P[G][le]];if(He!==void 0&&He===D[1]){W=le;break}}if(W<0)throw new Error("First element of a net not known");for(let le=2;le<D.length;le++){if(D[le]==="")continue;let He=P[G][(le+W-1)%b],ut=w[He];if(ut!==void 0&&ut!==D[le])throw new Error("Face mismatch in net");w[He]=D[le],S[D[le]]=He}}for(let D=0;D<w.length;D++){let x=!1;for(let G=0;G<this.faceorder.length;G++)if(w[D]===this.faceorder[G]){this.faceprecedence[D]=G,x=!0;break}if(!x)throw new Error("Could not find face "+w[D]+" in face order list "+this.faceorder)}for(let D=0;D<this.baseplanerot.length;D++){let x=this.baseplanerot[D].rotateface(R),G=p.rotateplane(this.baseplanerot[D]),W=w[D];K.push([x,W]),Z.push([G,W])}for(let D=0;D<this.baseplanerot.length;D++){let x=this.baseplanerot[D].rotateface(R),G=w[D];for(let W=0;W<x.length;W++){let le=(W+1)%x.length,He=x[W].sum(x[le]).smul(.5),ut=(W+2)%x.length,zp=x[le].sum(x[ut]).smul(.5),Cp=Jo(ne,He),Pp=Jo(ne,zp);k(M,x[le],[G,Pp,Cp])}}this.swizzler=new zl(K.map(D=>D[1]));let z=this.swizzler.prefixFree?"":"_";for(let D=0;D<ne.length;D++){if(ne[D].length!==3)throw new Error("Bad length in edge names "+ne[D]);let x=w[ne[D][1]],G=w[ne[D][2]];this.faceprecedence[ne[D][1]]<this.faceprecedence[ne[D][2]]?x=x+z+G:x=G+z+x,ne[D]=[ne[D][0],x]}for(let D=0;D<M.length;D++){if(M[D].length<4)throw new Error("Bad length in vertex names");let x=1;for(let W=2;W<M[D].length;W++)this.faceprecedence[S[M[D][W][0]]]<this.faceprecedence[S[M[D][x][0]]]&&(x=W);let G="";for(let W=1;W<M[D].length;W++){W===1?G=M[D][x][0]:G=G+z+M[D][x][0];for(let le=1;le<M[D].length;le++)if(M[D][x][1]===M[D][le][2]){x=le;break}}M[D]=[M[D][0],G]}this.options.verbosity>1&&(console.log("# Face precedence list: "+this.faceorder.join(" ")),console.log("# Face names: "+K.map(D=>D[1]).join(" ")),console.log("# Edge names: "+ne.map(D=>D[1]).join(" ")),console.log("# Vertex names: "+M.map(D=>D[1]).join(" ")));let Q=[];for(let D of Z)Q.push([D[0].makenormal(),D[1],"f"]);for(let D of ne)Q.push([D[0].makenormal(),D[1],"e"]);for(let D of M)Q.push([D[0].makenormal(),D[1],"v"]);this.facenames=K,this.faceplanes=Z,this.edgenames=ne,this.vertexnames=M,this.geonormals=Q;let H=Q.map(D=>D[1]);this.swizzler.setGripNames(H),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let D=0;D<h.length;D++)for(let x of this.rotations){let G=h[D].rotateplane(x),W=!1;for(let le of this.moveplanes)if(G.sameplane(le)){W=!0;break}W||(this.moveplanes.push(G),y[D]&&this.moveplanes2.push(G))}let ce=new Gl(R),Re=this.moveplanes2.slice(),Ue=31;for(let D=0;D<Re.length;D++){let x=D+Math.floor((Re.length-D)*(Ue/65536));ce=ce.split(Re[x]),Re[x]=Re[D],Ue=(Ue*1657+101)%65536}let ve=ce.collect([],!0);this.faces=ve,this.options.verbosity>0&&console.log("# Faces is now "+ve.length),this.stickersperface=ve.length;let zt=[],Te=qo(R);for(let D of this.rotations){let x=D.rotateface(R);Te.dist(qo(x))<Ee&&zt.push(D)}let nt=new Array(ve.length),ze=[];for(let D=0;D<ve.length;D++){let x=ve[D].centermass();ze.push([Te.dist(x),x,D])}ze.sort((D,x)=>D[0]-x[0]);for(let D=0;D<ve.length;D++){let x=ze[D][2];if(!nt[x]){nt[x]=!0;for(let G of zt){let W=ve[x].rotate(G),le=W.centermass();for(let He=D+1;He<ve.length&&!(ze[He][0]-ze[D][0]>Ee);He++){let ut=ze[He][2];if(!nt[ut]&&le.dist(ze[He][1])<Ee){nt[ut]=!0,ve[ut]=W;break}}}}}this.shortedge=1e99;for(let D of ve)for(let x=0;x<D.length;x++){let G=(x+1)%D.length,W=D.get(x).dist(D.get(G));W<this.shortedge&&(this.shortedge=W)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),r==="c"&&A&&!E&&!v&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&v&&!A&&!E&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(v||A)&&!E&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&A&&(this.notationMapper=new Cl(this.swizzler,new zl(["F","D","L","BL","R","U","BR","B"])),!E&&!v&&(this.addNotationMapper="FTOMapper")),r==="d"&&A&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new Cl(this.swizzler,new zl(["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,a=1;for(;a*2<=l.length;)a*=2;for(;a>0;a>>=1)i+a<=l.length&&o>l[i+a-1].a&&(i+=a);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,a=1;for(;a*2<=l.length;)a*=2;for(;a>0;a>>=1)i+a<=l.length&&o>l[i+a-1].a&&(i+=a);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]))<Ee)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],a=l[o].sub(l[r]),s=a.len();a=a.normalize();let f=a.cross(i).normalize(),g=n[1].sub(n[0]),c=g.len()/s;g=g.normalize();let u=g.b,p=g.c,m=a.smul(u).sub(f.smul(p)).smul(c),L=f.smul(u).sum(a.smul(p)).smul(c),R=new O(0,n[0].b-m.dot(l[r]),n[0].c-L.dot(l[r]),0);return[m,L,R]}allstickers(){let t="allstickers";this.faces=vm(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 b=0;b<this.faces.length;b++)this.facecentermass[b]=this.faces[b].centermass();let r=[],n=[];for(let b of this.moveplanes){let k=b.makenormal(),P=!1;for(let S of n)k.sameplane(S.makenormal())&&(P=!0);P||(n.push(k),r.push([]))}for(let b of this.moveplanes2){let k=b.makenormal();for(let P=0;P<n.length;P++)if(k.sameplane(n[P])){r[P].push(b);break}}for(let b=0;b<r.length;b++){let k=r[b].map(S=>S.normalizeplane()),P=n[b];for(let S=0;S<k.length;S++)k[S].makenormal().dist(P)>Ee&&(k[S]=k[S].smul(-1));k.sort((S,w)=>S.a-w.a),r[b]=k}this.moveplanesets=r,this.moveplanenormals=n;let l=r.map(b=>b.length);this.options.verbosity>0&&console.log("# Move plane sets: "+l);let o=[];for(let b=0;b<r.length;b++)o.push([]);for(let b of this.rotations){if(Math.abs(Math.abs(b.a)-1)<Ee)continue;let k=b.makenormal();for(let P=0;P<r.length;P++)if(k.sameplane(n[P])){o[P].push(b);break}}this.moverotations=o;for(let b=0;b<o.length;b++){let k=o[b],P=k[0].makenormal();for(let S=0;S<k.length;S++)P.dist(k[S].makenormal())>Ee&&(k[S]=k[S].smul(-1));k.sort((S,w)=>S.angle()-w.angle()),o[b][0].dot(n[b])<0&&k.reverse()}let i=o.map(b=>1+b.length);this.movesetorders=i;let a=[],s="?";for(let b=0;b<r.length;b++){let k=n[b],P=null,S=null;for(let w of this.geonormals){let z=k.dot(w[0]);Math.abs(z-1)<Ee?(S=[w[1],w[2]],s=w[2]):Math.abs(z+1)<Ee&&(P=[w[1],w[2]],s=w[2])}if(S===null||P===null)throw new Error("Saw positive or negative sides as null");a.push([S[0],S[1],P[0],P[1],1+r[b].length]),this.addNotationMapper==="NxNxNCubeMapper"&&s==="f"&&(this.notationMapper=new Oo(1+r[b].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new Wo(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 Pl(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new Io(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&s==="f"&&(1+r[b].length===3&&(this.notationMapper=new To(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&s==="f"&&(1+r[b].length===3&&(this.notationMapper=new Go(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=a;let f=new Map,g=this.faces;for(let b=0;b<g.length;b++){let k=g[b],P=this.keyface(k);if(!f.get(P))f.set(P,[b]);else{let S=f.get(P);if(S.push(b),S.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let w=0;w<S.length;w++){let z=P+" "+w;f.set(z,[S[w]])}}}}this.facelisthash=f,this.options.verbosity>0&&console.log("# Cubies: "+f.size);let c=[],u=[],p=[];for(let b of f.values())if(b.length!==this.baseFaceCount){if(b.length>1){let k=b.map(z=>g[z].centermass()),P=qo(k);for(let z=0;b.length>2;z++){let Q=!1;for(let H=0;H<b.length;H++){let ce=(H+1)%b.length;if(P.dot(k[H].cross(k[ce]))<0){let Re=k[H];k[H]=k[ce],k[ce]=Re;let Ue=b[H];b[H]=b[ce],b[ce]=Ue,Q=!0}}if(!Q)break;if(z>1e3)throw new Error("Bad epsilon math; too close to border")}let S=0,w=b[S];for(let z=1;z<b.length;z++){let Q=b[z];this.faceprecedence[this.getfaceindex(Q)]<this.faceprecedence[this.getfaceindex(w)]&&(S=z,w=Q)}if(S!==0){let z=b.slice();for(let Q=0;Q<b.length;Q++)b[Q]=z[(S+Q)%b.length]}}for(let k=0;k<b.length;k++){let P=b[k];u[P]=c.length,p[P]=k}c.push(b)}this.cubies=c,this.facetocubie=u,this.facetoord=p;let m=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],L=[],R=[0,0,0,0,0,0],h=[],y=[],A=0,E=[],v=[],K=[],Z=[],M=b=>c[b].map(k=>this.getfaceindex(k)).join(" "),ne=[];for(let b=0;b<c.length;b++){if(y[b])continue;let k=c[b];if(k.length===0)continue;let P={},S=0;K.push(0),ne.push([]);let w=k.length,z=R[w]++,Q=m[w];(Q===void 0||w===this.baseFaceCount)&&(Q="CORE"),Q=Q+(z===0?"":z+1),L[A]=Q,h[A]=w;let H=[b],ce=0;for(y[b]=!0;ce<H.length;){let Re=H[ce++],Ue=M(Re);if((k.length>1||P[Ue]===void 0)&&(P[Ue]=S++),Z[Re]=P[Ue],E[Re]=A,ne[A].push(Re),v[Re]=K[A]++,H.length<this.rotations.length){let ve=this.facecentermass[c[Re][0]];for(let zt of o){let Te=this.facetocubie[this.findface(ve.rotatepoint(zt[0]))];y[Te]||(H.push(Te),y[Te]=!0)}}}A++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let b=[["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 b)for(let S=0;S<P.length;S++){let w=0;for(let z=0;z<P[S].length;z++)w|=1<<P[S].charCodeAt(z)-65;k[w]=S}for(let P of ne)for(let S of P){let w=0;for(let z of c[S])w|=1<<this.facenames[this.getfaceindex(z)][1].charCodeAt(0)-65;v[S]=k[w]}}if(this.cubiesetnums=E,this.cubieordnums=v,this.cubiesetnames=L,this.cubieords=K,this.orbitoris=h,this.cubievaluemap=Z,this.cubiesetcubies=ne,this.options.fixedPieceType!==null){for(let b=0;b<c.length;b++)if(this.options.fixedPieceType==="v"&&c[b].length>2||this.options.fixedPieceType==="e"&&c[b].length===2||this.options.fixedPieceType==="f"&&c[b].length===1){this.fixedCubie=b;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 "+K)}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 a="1",s=1;return n[5]!==void 0&&(a=n[5],a[0]==="'"&&(a="-"+a.substring(1)),s=parseInt(a,10)),new B(new C(l,i,o),s)}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,a=this.swizzler.unswizzle(n),s=!1;for(let c=0;c<this.movesetgeos.length;c++){let u=this.movesetgeos[c];a===u[0]&&(s=!0,o=u,i=c),a===u[2]&&(s=!1,o=u,i=c)}let f=1,g=1;if(n.toUpperCase()!==n&&(g=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?(g=t.innerLayer,n<="Z"?f=g:f=1):g=t.innerLayer),f--,g--,l&&(f=0,g=this.moveplanesets[i].length),f<0||f>this.moveplanesets[i].length||g<0||g>this.moveplanesets[i].length)throw new Error("Bad slice spec "+f+" "+g+" vs "+this.moveplanesets[i].length);if(!_m&&f===0&&g===this.moveplanesets[i].length&&!l)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,f,g,s,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);if(this.basefaces[o].centermass().dist(this.facecentermass[l])<Ee){let i=this.basefaces[o].length;for(let a=1;a<i;a++)this.cubies[n].push(this.cubies[n][a-1]);this.duplicatedFaces[l]=i,this.duplicatedCubies[n]=i,this.orbitoris[this.cubiesetnums[n]]=i}}}for(let n=0;n<this.moveplanesets.length;n++){let l=this.moveplanesets[n],o=[],i=[l.length+1,0],a=1;for(;a*2<=l.length;)a*=2;for(let g=0;g<this.faces.length;g++){let c=0;if(l.length>0){let u=this.facecentermass[g].dot(l[0]);for(let p=a;p>0;p>>=1)c+p<=l.length&&u>l[c+p-1].a&&(c+=p);c=l.length-c}for(o.push(c);i.length<=c;)i.push(0);i[c]++}let s=new Array(i.length);for(let g=0;g<i.length;g++)s[g]=[];let f=[];for(let g=0;g<this.faces.length;g++){if(o[g]<0)continue;let c=[this.facetocubie[g],this.facetoord[g]],u=this.facecentermass[g],p=u,m=g,L=o[m];for(;;){o[m]=-1;let R=u.rotatepoint(this.moverotations[n][0]);if(R.dist(p)<Ee)break;m=this.findface(R),c.push(this.facetocubie[m],this.facetoord[m]),u=R}if(c.length>2&&this.options.orientCenters&&(this.cubies[c[0]].length===1||this.duplicatedCubies[c[0]]>1)&&this.facecentermass[g].dist(this.basefaces[this.getfaceindex(g)].centermass())<Ee){let R=this.faces[this.cubies[c[0]][0]];for(let h=0;h<c.length;h+=2){let y=this.faces[this.cubies[c[h]][0]],A=-1;for(let E=0;E<R.length;E++)if(y.get(E).dist(R.get(0))<Ee){A=E;break}if(A<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");c[h+1]=A,R=R.rotate(this.moverotations[n][0])}}if(c.length===2&&this.options.orientCenters)for(let R=1;R<this.movesetorders[n];R++)L===0?c.push(c[0],R):c.push(c[0],(this.movesetorders[n]-R)%this.movesetorders[n]);if(c.length>2&&!f[c[0]]){if(c.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let R of c)s[L].push(R)}for(let R=0;R<c.length;R+=2)f[c[R]]=!0}for(let g=0;g<s.length;g++)s[g]=s[g].slice();r.push(s)}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 a=n[i];if(l>=a[0]&&l<=a[1])if(a[0]===0)a=[a[1]+1,r];else if(r===a[1])a=[0,a[0]-1];else throw Error("fixed cubie option would disconnect move");let s=!1;for(let f=0;f<o.length;f+=2)if(o[f][0]===a[0]&&o[f][1]===a[1]&&o[f+1]===n[i+1]){s=!0;break}s||(o.push(a),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+Em+\`
|
|
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_"+Z0(this.notationMapper,t.movenames[o]),a=!1;i[i.length-1]==="'"&&(i=i.substring(0,i.length-1),a=!0),n.push(i),a?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(\`
|
|
@@ -3765,4 +3765,4 @@ Alg R' U' R U B' U' B L\`)}var EF,_F,Gs=U(()=>{je();Pn();Mn();EF=null;_F=null});
|
|
|
3765
3765
|
export {
|
|
3766
3766
|
workerSource
|
|
3767
3767
|
};
|
|
3768
|
-
//# sourceMappingURL=worker-inside-generated-string-
|
|
3768
|
+
//# sourceMappingURL=worker-inside-generated-string-HCFERKXI.js.map
|