cubing 0.31.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/alg/index.js +3 -1
- package/dist/esm/bluetooth/index.js +5 -5
- package/dist/esm/{chunk-JQLCWEVU.js → chunk-52L7V4XF.js} +2 -2
- package/dist/esm/{chunk-JQLCWEVU.js.map → chunk-52L7V4XF.js.map} +0 -0
- package/dist/esm/{chunk-7LJHXZJM.js → chunk-55WSHQFP.js} +4 -4
- package/dist/esm/{chunk-7LJHXZJM.js.map → chunk-55WSHQFP.js.map} +0 -0
- package/dist/esm/{chunk-V67YQOIN.js → chunk-A3PA5E45.js} +4 -4
- package/dist/esm/{chunk-V67YQOIN.js.map → chunk-A3PA5E45.js.map} +0 -0
- package/dist/esm/{chunk-J5IQUWXC.js → chunk-G6MFOXW4.js} +10 -11
- package/dist/esm/chunk-G6MFOXW4.js.map +7 -0
- package/dist/esm/{chunk-SYSXHJ4V.js → chunk-JCIUBLD5.js} +4 -3
- package/dist/esm/{chunk-SYSXHJ4V.js.map → chunk-JCIUBLD5.js.map} +2 -2
- package/dist/esm/{chunk-5QXVR3FK.js → chunk-JW5R6EBK.js} +2 -2
- package/dist/esm/{chunk-5QXVR3FK.js.map → chunk-JW5R6EBK.js.map} +0 -0
- package/dist/esm/{chunk-UAHLC2BK.js → chunk-MHP4YJE7.js} +6 -6
- package/dist/esm/chunk-MHP4YJE7.js.map +7 -0
- package/dist/esm/{chunk-RBZINRTT.js → chunk-PVI43RDV.js} +14 -6
- package/dist/esm/{chunk-RBZINRTT.js.map → chunk-PVI43RDV.js.map} +2 -2
- package/dist/esm/{chunk-SNLVO6OQ.js → chunk-VTO7WPWK.js} +15 -6
- package/dist/esm/chunk-VTO7WPWK.js.map +7 -0
- package/dist/esm/{chunk-CUIME76I.js → chunk-XNPPG3BV.js} +3 -3
- package/dist/esm/{chunk-CUIME76I.js.map → chunk-XNPPG3BV.js.map} +0 -0
- package/dist/esm/kpuzzle/index.js +2 -2
- package/dist/esm/notation/index.js +2 -2
- package/dist/esm/protocol/index.js +4 -4
- package/dist/esm/puzzle-geometry/index.js +1 -1
- package/dist/esm/puzzles/index.js +4 -4
- package/dist/esm/scramble/index.js +2 -2
- package/dist/esm/search/index.js +6 -6
- package/dist/esm/{search-dynamic-sgs-side-events-KVUAIBGE.js → search-dynamic-sgs-side-events-UIAYYZRR.js} +6 -6
- package/dist/esm/{search-dynamic-sgs-side-events-KVUAIBGE.js.map → search-dynamic-sgs-side-events-UIAYYZRR.js.map} +0 -0
- package/dist/esm/{search-dynamic-sgs-unofficial-7ICOL4T7.js → search-dynamic-sgs-unofficial-7XRXANEX.js} +6 -6
- package/dist/esm/{search-dynamic-sgs-unofficial-7ICOL4T7.js.map → search-dynamic-sgs-unofficial-7XRXANEX.js.map} +0 -0
- package/dist/esm/{search-dynamic-solve-4x4x4-GGDX7YYZ.js → search-dynamic-solve-4x4x4-K5LUSS2B.js} +6 -6
- package/dist/esm/{search-dynamic-solve-4x4x4-GGDX7YYZ.js.map → search-dynamic-solve-4x4x4-K5LUSS2B.js.map} +0 -0
- package/dist/esm/{search-dynamic-solve-kilominx-TVKK4KDH.js → search-dynamic-solve-kilominx-XDOKK3ZV.js} +2 -2
- package/dist/esm/{search-dynamic-solve-kilominx-TVKK4KDH.js.map → search-dynamic-solve-kilominx-XDOKK3ZV.js.map} +0 -0
- package/dist/esm/{search-worker-inside-generated-string-I4T4KADX.js → search-worker-inside-generated-string-LBOAERDX.js} +27 -27
- package/dist/esm/search-worker-inside-generated-string-LBOAERDX.js.map +7 -0
- package/dist/esm/{search-worker-js-entry-KWGCJXGS.js → search-worker-js-entry-4MMPUMST.js} +12 -12
- package/dist/esm/{search-worker-js-entry-KWGCJXGS.js.map → search-worker-js-entry-4MMPUMST.js.map} +0 -0
- package/dist/esm/{search-worker-ts-entry-J533AM5E.js → search-worker-ts-entry-LBKZYRBU.js} +2 -2
- package/dist/esm/{search-worker-ts-entry-J533AM5E.js.map → search-worker-ts-entry-LBKZYRBU.js.map} +0 -0
- package/dist/esm/stream/index.js +1 -1
- package/dist/esm/twisty/index.js +20 -31
- package/dist/esm/twisty/index.js.map +2 -2
- package/dist/esm/{twisty-dynamic-3d-OAYMJ6OD.js → twisty-dynamic-3d-TFI45NMX.js} +6 -6
- package/dist/esm/{twisty-dynamic-3d-OAYMJ6OD.js.map → twisty-dynamic-3d-TFI45NMX.js.map} +0 -0
- package/dist/types/{Alg-60b374e8.d.ts → Alg-d3ac9660.d.ts} +52 -3
- package/dist/types/{KState-958b873c.d.ts → KState-0a9388d0.d.ts} +1 -1
- package/dist/types/{TwizzleLink-e873f6e5.d.ts → TwizzleLink-79b17516.d.ts} +3 -3
- package/dist/types/alg/index.d.ts +7 -4
- package/dist/types/bluetooth/index.d.ts +4 -4
- package/dist/types/{bluetooth-puzzle-cc8eeaae.d.ts → bluetooth-puzzle-83ade5b5.d.ts} +2 -2
- package/dist/types/kpuzzle/index.d.ts +2 -2
- package/dist/types/notation/index.d.ts +1 -1
- package/dist/types/{outside-15f39b79.d.ts → outside-6a613add.d.ts} +2 -2
- package/dist/types/{parseAlg-3c77c4b3.d.ts → parseAlg-3bb4dddb.d.ts} +1 -1
- package/dist/types/protocol/index.d.ts +2 -2
- package/dist/types/puzzle-geometry/index.d.ts +3 -3
- package/dist/types/puzzles/index.d.ts +5 -5
- package/dist/types/scramble/index.d.ts +3 -3
- package/dist/types/search/index.d.ts +3 -3
- package/dist/types/stream/index.d.ts +3 -3
- package/dist/types/twisty/index.d.ts +5 -5
- package/package.json +9 -4
- package/dist/esm/chunk-J5IQUWXC.js.map +0 -7
- package/dist/esm/chunk-SNLVO6OQ.js.map +0 -7
- package/dist/esm/chunk-UAHLC2BK.js.map +0 -7
- package/dist/esm/search-worker-inside-generated-string-I4T4KADX.js.map +0 -7
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
// src/cubing/search/search-worker-inside-generated-string.js
|
|
2
|
-
var workerSource = `"use strict";var
|
|
3
|
-
\`)||r.includes("\\r"))throw new Error("LineComment cannot contain newline");V(this,
|
|
4
|
-
\`}isIdentical(t){return t.is(Ye)}invert(){return this}*experimentalExpand(t=1,r=1/0){yield this}}});var De,
|
|
5
|
-
\`)){l.push($e(new Ye,a,R(this,G))),o=!1,n=R(this,G);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){i(a);let[s]=this.parseRegex(aL);l.push($e(new Ft(s),a,R(this,G))),o=!1,n=R(this,G);continue e}else{l.push($e(new B("_SLASH_"),a,R(this,G))),o=!0,n=R(this,G);continue e}else if(this.tryConsumeNext(".")){i(a),l.push($e(new De,a,R(this,G))),o=!0,n=R(this,G);continue e}else throw new Error(\`Unexpected character: \${this.popNext()}\`)}if(R(this,G)!==R(this,it).length)throw new Error("did not finish parsing?");if(t.length>0)throw new Error("expected stopping");return $e(l.toAlg(),r,n)}parseQuantumMoveImpl(){let[,,,t,r,n]=this.parseRegex(iL);return new _(n,Yo(r,void 0),Yo(t,void 0))}parseMoveImpl(){let t=R(this,G);if(this.tryConsumeNext("/"))return $e(new B("_SLASH_"),t,R(this,G));let r=this.parseQuantumMoveImpl(),[n,l]=this.parseAmountAndTrackEmptyAbsAmount(),o=this.parseMoveSuffix();if(o){if(n<0)throw new Error("uh-oh");if((o==="++"||o==="--")&&n!==1)throw new Error("Pochmann ++ or -- moves cannot have an amount other than 1.");if((o==="++"||o==="--")&&!l)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((o==="+"||o==="-")&&l)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");o.startsWith("+")&&(r=r.modified({family:\`\${r.family}_\${o==="+"?"PLUS":"PLUSPLUS"}_\`})),o.startsWith("-")&&(r=r.modified({family:\`\${r.family}_\${o==="-"?"PLUS":"PLUSPLUS"}_\`}),n*=-1)}return $e(new B(r,n),t,R(this,G))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let t=R(this,G),[,r,n]=this.parseRegex(Z2);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[Yo(r,1)*(n==="'"?-1:1),!r]}parseAmount(){let t=R(this,G),[,r,n]=this.parseRegex(Z2);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 Yo(r,1)*(n==="'"?-1:1)}parseRegex(t){let r=t.exec(this.remaining());if(r===null)throw new Error("internal parsing error");return V(this,G,R(this,G)+r[0].length),r}tryRegex(t){let r=t.exec(this.remaining());return r===null?null:(V(this,G,R(this,G)+r[0].length),r)}remaining(){return R(this,it).slice(R(this,G))}popNext(){let t=R(this,it)[R(this,G)];return Ga(this,G)._++,t}tryConsumeNext(t){return R(this,it)[R(this,G)]===t?(Ga(this,G)._++,!0):!1}mustConsumeNext(t){let r=this.popNext();if(r!==t)throw new Error(\`expected \\\`\${t}\\\` while parsing, encountered \${r}\`);return r}};it=new WeakMap,G=new WeakMap,Gn=new WeakMap});function $o(e){ef.has(e)||(console.warn(e),ef.add(e))}var ef,Ja=y(()=>{"use strict";ef=new Set});var $r,Ya=y(()=>{"use strict";Tt();ja();$r=class{constructor(t,r=1){if(this.quantum=t,this.amount=r,!Number.isInteger(this.amount)||this.amount<-2147483648||this.amount>2147483647)throw new Error(\`AlgNode amount absolute value must be a non-negative integer below \${Wl}.\`)}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=q2(t,this.amount<0);for(let o=0;o<n;o++)yield*this.quantum.experimentalExpand(l,r)}}});var er,qe,Ve,ti,_,Te,Wn,B,Wt=y(()=>{"use strict";$t();Tt();ja();Za();Ja();Ya();ti=class extends Gl{constructor(r,n,l){super();J(this,er,void 0);J(this,qe,void 0);J(this,Ve,void 0);if(V(this,er,r),V(this,qe,n??null),V(this,Ve,l??null),Object.freeze(this),R(this,qe)!==null&&(!Number.isInteger(R(this,qe))||R(this,qe)<1||R(this,qe)>2147483647))throw new Error(\`QuantumMove inner layer must be a positive integer below \${Wl}.\`);if(R(this,Ve)!==null&&(!Number.isInteger(R(this,Ve))||R(this,Ve)<1||R(this,Ve)>2147483647))throw new Error(\`QuantumMove outer layer must be a positive integer below \${Wl}.\`);if(R(this,Ve)!==null&&R(this,qe)!==null&&R(this,qe)<=R(this,Ve))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(R(this,Ve)!==null&&R(this,qe)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(r){return Y2(r)}modified(r){return new ti(r.family??R(this,er),r.innerLayer??R(this,qe),r.outerLayer??R(this,Ve))}isIdentical(r){let n=r;return r.is(ti)&&R(this,er)===R(n,er)&&R(this,qe)===R(n,qe)&&R(this,Ve)===R(n,Ve)}get family(){return R(this,er)}get outerLayer(){return R(this,Ve)}get innerLayer(){return R(this,qe)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a \`QuantumMove\` directly.")}toString(){let r=R(this,er);return R(this,qe)!==null&&(r=String(R(this,qe))+r,R(this,Ve)!==null&&(r=\`\${String(R(this,Ve))}-\${r}\`)),r}},_=ti;er=new WeakMap,qe=new WeakMap,Ve=new WeakMap;Wn=class extends Oe{constructor(...r){super();J(this,Te,void 0);if(typeof r[0]=="string")if(r[1]??null){V(this,Te,new $r(_.fromString(r[0]),r[1]));return}else return Wn.fromString(r[0]);V(this,Te,new $r(r[0],r[1]))}isIdentical(r){let n=r.as(Wn);return!!n&&R(this,Te).isIdentical(R(n,Te))}invert(){return $2(this,new Wn(R(this,Te).quantum,-this.amount))}*experimentalExpand(r=1){r===1?yield this:yield this.modified({amount:-this.amount})}get quantum(){return R(this,Te).quantum}modified(r){return new Wn(R(this,Te).quantum.modified(r),r.amount??this.amount)}static fromString(r){return J2(r)}get amount(){return R(this,Te).amount}get type(){return $o("deprecated: type"),"blockMove"}get family(){return R(this,Te).quantum.family??void 0}get outerLayer(){return R(this,Te).quantum.outerLayer??void 0}get innerLayer(){return R(this,Te).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return R(this,Te).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let r=Math.abs(this.amount);return R(this,Te).quantum.toString().slice(0,-10)+(r===1?"":r)+(this.amount<0?"--":"++")}return R(this,Te).quantum.toString()+R(this,Te).suffix()}},B=Wn;Te=new WeakMap});var $a,tf,at,ri,Pe,ql=y(()=>{"use strict";Gt();$t();Tt();Wt();Ya();$a=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 _("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new _("D_SQ_"));let r=t.alg;if(r.experimentalNumChildAlgNodes()===2){let[n,l]=r.childAlgNodes();if(n.as(B)?.quantum.isIdentical(this.quantumU_SQ_)&&l.as(B)?.quantum.isIdentical(this.quantumD_SQ_)){if(t.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[n,l]}}return null}},tf=new $a,ri=class extends Oe{constructor(r,n){super();J(this,at,void 0);let l=Rr(r);V(this,at,new $r(l,n))}isIdentical(r){let n=r;return r.is(ri)&&R(this,at).isIdentical(R(n,at))}get alg(){return R(this,at).quantum}get amount(){return R(this,at).amount}get experimentalRepetitionSuffix(){return R(this,at).suffix()}invert(){return new ri(R(this,at).quantum,-R(this,at).amount)}*experimentalExpand(r=1,n){n??(n=1/0),n===0?yield r===1?this:this.invert():yield*R(this,at).experimentalExpand(r,n-1)}static fromString(){throw new Error("unimplemented")}toString(){return tf.format(this)??\`(\${R(this,at).quantum.toString()})\${R(this,at).suffix()}\`}experimentalAsSquare1Tuple(){return tf.tuple(this)}},Pe=ri;at=new WeakMap});var Kn=y(()=>{"use strict";ql();Kl();Pn();On();Wt();Ql();Tn()});function bt(e,t){return e instanceof t}function rf(e){return bt(e,Pe)||bt(e,Ft)||bt(e,Ce)||bt(e,Ne)||bt(e,B)||bt(e,Ye)||bt(e,De)}var es=y(()=>{"use strict";Kn()});function nf(e,t,r){if(t.is(Pe))return e.traverseGrouping(t,r);if(t.is(B))return e.traverseMove(t,r);if(t.is(Ce))return e.traverseCommutator(t,r);if(t.is(Ne))return e.traverseConjugate(t,r);if(t.is(De))return e.traversePause(t,r);if(t.is(Ye))return e.traverseNewline(t,r);if(t.is(Ft))return e.traverseLineComment(t,r);throw new Error("unknown AlgNode")}function lf(e){if(e.is(Pe)||e.is(B)||e.is(Ce)||e.is(Ne)||e.is(De)||e.is(Ye)||e.is(Ft))return e;throw new Error("internal error: expected AlgNode")}var Fr,en,ts=y(()=>{"use strict";Pn();On();ql();Kl();Wt();Ql();Tn();Fr=class{traverseAlgNode(t,r){return nf(this,t,r)}traverseIntoAlgNode(t,r){return lf(this.traverseAlgNode(t,r))}},en=class extends Fr{traverseAlgNode(t){return nf(this,t,void 0)}traverseIntoAlgNode(t){return lf(this.traverseAlgNode(t))}}});var gL,of,Qn,rs=y(()=>{"use strict";gL="any-direction",of="canonical-centered",Qn=class{constructor(t={}){this.config=t}cancelQuantum(){let{cancel:t}=this.config;return t===!0?gL:t===!1?"none":t?.directional??"none"}cancelAny(){return this.config.cancel&&this.cancelQuantum()!=="none"}cancelPuzzleSpecificModWrap(){let{cancel:t}=this.config;return t===!0||t===!1?of:t?.puzzleSpecificModWrap??of}puzzleSpecificSimplifyOptions(){return this.config.puzzleLoader?.puzzleSpecificSimplifyOptions??this.config.puzzleSpecificSimplifyOptions}}});function cL(e,t){return e*Math.sign(t.amount)>=0}function pL(e,t,r){return((e-r)%t+t)%t+r}function ns(e,t,r){let n=new Qn(r),l=Array.from(e.childAlgNodes()),o=[t];function i(){return new w([...l,...o])}function a(s){if(n.cancelPuzzleSpecificModWrap()==="none")return s;let f=n.puzzleSpecificSimplifyOptions()?.quantumMoveOrder;if(!f)return s;let u=f(t.quantum),g;switch(n.cancelPuzzleSpecificModWrap()){case"gravity":{g=-Math.floor((u-(s.amount<0?0:1))/2);break}case"canonical-centered":{g=-Math.floor((u-1)/2);break}case"canonical-positive":{g=0;break}case"preserve-sign":{g=s.amount<0?1-u:0;break}default:throw new Error("Unknown mod wrap")}let c=pL(s.amount,u,g);return s.modified({amount:c})}if(n.cancelAny()){let s,f=n.puzzleSpecificSimplifyOptions()?.axis;if(f)s=L=>f.areQuantumMovesSameAxis(t.quantum,L.quantum);else{let L=t.quantum.toString();s=m=>m.quantum.toString()===L}let u=n.cancelQuantum()==="same-direction",g=new Map;g.set(t.quantum.toString(),Math.sign(t.amount));let c;for(c=l.length-1;c>=0;c--){let L=l[c].as(B);if(!L||!s(L))break;let m=L.quantum.toString();if(u){let d=g.get(m);if(d&&!cL(d,L))break;g.set(m,Math.sign(L.amount))}}let p=[...l.splice(c+1),t];if(f)o=f.simplifySameAxisMoves(p,n.cancelPuzzleSpecificModWrap()!=="none");else{let L=p.reduce((m,d)=>m+d.amount,0);if(g.size!==1)throw new Error("Internal error: multiple quantums when one was expected");o=[new B(t.quantum,L)]}}return o=o.map(s=>a(s)).filter(s=>s.amount!==0),i()}function ls(e,t,r){let n=t.as(B);return n?ns(e,n,r):new w([...e.childAlgNodes(),t])}var os=y(()=>{"use strict";Gt();Wt();rs()});var ni,Hl,as,tn,Vl,Xl,ss,is,af,fs,sf=y(()=>{"use strict";Gt();Pn();On();ql();Wt();Tn();ts();os();rs();is=class extends Fr{constructor(){super(...arguments);J(this,Hl);J(this,tn);J(this,Xl);J(this,ni,void 0)}*traverseAlg(r,n){if(n.depth===0){yield*r.childAlgNodes();return}let l=[],o=Yt(this,tn,Vl).call(this,n);for(let i of r.childAlgNodes())for(let a of this.traverseAlgNode(i,o))l=Array.from(ls(new w(l),a,o).childAlgNodes());for(let i of l)yield i}*traverseGrouping(r,n){if(n.depth===0){yield r;return}if(r.amount===0)return;let l=new Pe(this.traverseAlg(r.alg,Yt(this,tn,Vl).call(this,n)),r.amount);if(l.alg.experimentalIsEmpty())return;let o=Yt(this,Hl,as).call(this).get(r);o&&(l.experimentalNISSPlaceholder=o,o.experimentalNISSGrouping=l),yield l}*traverseMove(r,n){yield r}*traverseCommutator(r,n){if(n.depth===0){yield r;return}let l=Yt(this,tn,Vl).call(this,n),o=new Ce(this.traverseAlg(r.A,l),this.traverseAlg(r.B,l));o.A.experimentalIsEmpty()||o.B.experimentalIsEmpty()||o.A.isIdentical(o.B)||o.A.isIdentical(o.B.invert())||Yt(this,Xl,ss).call(this,o.A,o.B,n)||(yield o)}*traverseConjugate(r,n){if(n.depth===0){yield r;return}let l=Yt(this,tn,Vl).call(this,n),o=new Ne(this.traverseAlg(r.A,l),this.traverseAlg(r.B,l));if(!o.B.experimentalIsEmpty()){if(o.A.experimentalIsEmpty()||o.A.isIdentical(o.B)||o.A.isIdentical(o.B.invert())||Yt(this,Xl,ss).call(this,o.A,o.B,n)){yield*r.B.childAlgNodes();return}yield o}}*traversePause(r,n){if(r.experimentalNISSGrouping){let l=new De;Yt(this,Hl,as).call(this).set(r.experimentalNISSGrouping,l),yield l}else yield r}*traverseNewline(r,n){yield r}*traverseLineComment(r,n){yield r}};ni=new WeakMap,Hl=new WeakSet,as=function(){return R(this,ni)??V(this,ni,new Map)},tn=new WeakSet,Vl=function(r){return{...r,depth:r.depth?r.depth-1:null}},Xl=new WeakSet,ss=function(r,n,l){if(r.experimentalNumChildAlgNodes()===1&&n.experimentalNumChildAlgNodes()===1){let o=Array.from(r.childAlgNodes())[0]?.as(B),i=Array.from(n.childAlgNodes())[0]?.as(B);if(!(o&&i))return!1;if(i.quantum.isIdentical(o.quantum)||new Qn(l).puzzleSpecificSimplifyOptions()?.axis?.areQuantumMovesSameAxis(o.quantum,i.quantum))return!0}return!1};af=new is,fs=af.traverseAlg.bind(af)});var us=y(()=>{"use strict";sf();os()});function ff(e){if(!e)return[];if(bt(e,w))return e.childAlgNodes();if(typeof e=="string")return Xa(e).childAlgNodes();let t=e;if(typeof t[Symbol.iterator]=="function")return t;throw new Error("Invalid AlgNode")}function Rr(e){return bt(e,w)?e:new w(e)}function mL(e,t){return e.is(Ye)||t.is(Ye)||t.as(Pe)?.experimentalNISSPlaceholder?"":e.is(Ft)&&!t.is(Ye)?\`
|
|
6
|
-
\`:" "}var st,rn,w,Gt=y(()=>{"use strict";$t();es();Tt();Za();us();Kn();Kl();Wt();Ql();Ja();rn=class extends Oe{constructor(r){super();J(this,st,void 0);V(this,st,Array.from(ff(r)));for(let n of R(this,st))if(!rf(n))throw new Error("An alg can only contain alg nodes.")}isIdentical(r){let n=r;if(!r.is(rn))return!1;let l=Array.from(R(this,st)),o=Array.from(R(n,st));if(l.length!==o.length)return!1;for(let i=0;i<l.length;i++)if(!l[i].isIdentical(o[i]))return!1;return!0}invert(){return new rn(H2(Array.from(R(this,st)).map(r=>r.invert())))}*experimentalExpand(r=1,n){n??(n=1/0);for(let l of V2(R(this,st),r))yield*l.experimentalExpand(r,n)}expand(r){return new rn(this.experimentalExpand(1,r?.depth??1/0))}*experimentalLeafMoves(){for(let r of this.experimentalExpand())r.is(B)&&(yield r)}concat(r){return new rn(Array.from(R(this,st)).concat(Array.from(ff(r))))}experimentalIsEmpty(){for(let r of R(this,st))return!1;return!0}static fromString(r){return Xa(r)}units(){return this.childAlgNodes()}*childAlgNodes(){for(let r of R(this,st))yield r}experimentalNumUnits(){return this.experimentalNumChildAlgNodes()}experimentalNumChildAlgNodes(){return Array.from(R(this,st)).length}get type(){return $o("deprecated: type"),"sequence"}toString(){let r="",n=null;for(let l of R(this,st)){n&&(r+=mL(n,l));let o=l.as(De)?.experimentalNISSGrouping;if(o){if(o.amount!==-1)throw new Error("Invalid NISS Grouping amount!");r+=\`^(\${o.alg.toString()})\`}else l.as(Pe)?.experimentalNISSPlaceholder||(r+=l.toString());n=l}return r}experimentalSimplify(r){return new rn(fs(this,r??{}))}simplify(r){return this.experimentalSimplify(r)}},w=rn;st=new WeakMap});var LL,uf=y(()=>{"use strict";Gt();Kn();Pn();On();Wt();Tn();LL={Sune:new w([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 w([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 w([new Ce(new w([new B("R",1),new B("U",1),new B("R",-2)]),new w([new Ne(new w([new B("R",1)]),new w([new B("U",1)]))]))]),Niklas:new w([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 w([new B("x",-1),new Ce(new w([new Ne(new w([new B("R",1)]),new w([new B("U",-1)]))]),new w([new B("D",1)])),new Ce(new w([new Ne(new w([new B("R",1)]),new w([new B("U",1)]))]),new w([new B("D",1)])),new B("x",1)]),FURURFCompact:new w([new Ne(new w([new B("F",1)]),new w([new Ce(new w([new B("U",1)]),new w([new B("R",1)]))]))]),APermCompact:new w([new Ne(new w([new B("R",2)]),new w([new Ce(new w([new B("F",2)]),new w([new B("R",-1),new B("B",-1),new B("R",1)]))]))]),FURURFMoves:new w([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 w([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 w([new Ne(new w([new B("F",1)]),new w([new Pe(new w([new Ce(new w([new B("R",1)]),new w([new B("U",1)]))]),3)]))]),TriplePause:new w([new De,new De,new De])}});var Dy,gf=y(()=>{"use strict";Kn();Wt();Dy={73:new B("R"),75:new B("R'"),87:new B("B"),79:new B("B'"),83:new B("D"),76:new B("D'"),68:new B("L"),69:new B("L'"),74:new B("U"),70:new B("U'"),72:new B("F"),71:new B("F'"),78:new B("x'"),67:new B("l"),82:new B("l'"),85:new B("r"),77:new B("r'"),88:new B("d"),188:new B("d'"),84:new B("x"),89:new B("x"),66:new B("x'"),186:new B("y"),59:new B("y"),65:new B("y'"),80:new B("z"),81:new B("z'"),90:new B("M'"),190:new B("M'"),192:new De}});var cf=y(()=>{"use strict"});var me=y(()=>{"use strict";Gt();qa();ts();uf();gf();Kn();cf();us();es();Va()});function Jl(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(Zl(o.numOrientations,a))n[l]=i;else if(Zl(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 u=0;u<o.numPieces;u++)f[u]=(i.orientation[a.permutation[u]]+a.orientation[u])%o.numOrientations,s[u]=i.permutation[a.permutation[u]];n[l]={permutation:s,orientation:f}}}}return n}function gs(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(Zl(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 u=0;u<o.numPieces;u++)f[u]=(i.orientation[a.permutation[u]]+a.orientation[u])%o.numOrientations,s[u]=i.pieces[a.permutation[u]];n[l]={pieces:s,orientation:f}}}}return n}var li=y(()=>{"use strict";Yl()});function BL(e){let t=pf.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 mf&&(Object.freeze(r),Object.freeze(n),Object.freeze(l)),pf.set(e,l),l}function Lf(e){let t={};for(let[r,n]of Object.entries(e.orbits))t[r]=BL(n.numPieces);return mf&&Object.freeze(t),t}function Bf(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 Dr(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 Dr(e,o,-1);throw new Error(\`Invalid move for KPuzzle (\${e.name()}): \${t}\`)}var mf,pf,cs=y(()=>{"use strict";Yl();mf=!1,pf=new Map});var ge,oi=y(()=>{"use strict";li();$l();ge=class{constructor(t,r){this.kpuzzle=t;this.stateData=r}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),stateData:this.stateData}}static fromTransformation(t){let r=gs(t.kpuzzle.definition,t.kpuzzle.definition.startStateData,t.transformationData);return new ge(t.kpuzzle,r)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(t.isIdentityTransformation())return new ge(this.kpuzzle,this.stateData);let r=gs(this.kpuzzle.definition,this.stateData,t.transformationData);return new ge(this.kpuzzle,r)}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let t={};for(let[r,n]of Object.entries(this.stateData)){let l={permutation:n.pieces,orientation:n.orientation};t[r]=l}return new Dt(this.kpuzzle,t)}experimentalIsSolved(t){if(!this.kpuzzle.definition.experimentalIsStateSolved)throw new Error("\`KState.experimentalIsSolved()\` is not supported for this puzzle at the moment.");return this.kpuzzle.definition.experimentalIsStateSolved(this,t)}}});var nn,Ar,Dt,$l=y(()=>{"use strict";Yl();li();cs();oi();Ar=class{constructor(t,r){this.kpuzzle=t;this.transformationData=r;J(this,nn,void 0)}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),transformationData:this.transformationData}}invert(){return new Ar(this.kpuzzle,ps(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return R(this,nn)??V(this,nn,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(t){let r=new Ar(t,Lf(t.definition));return V(r,nn,!0),r}isIdentical(t){return df(this.kpuzzle,this.transformationData,t.transformationData)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(this.kpuzzle!==t.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${t.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return R(this,nn)?new Ar(this.kpuzzle,t.transformationData):R(t,nn)?new Ar(this.kpuzzle,this.transformationData):new Ar(this.kpuzzle,Jl(this.kpuzzle.definition,this.transformationData,t.transformationData))}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}toKState(){return ge.fromTransformation(this)}repetitionOrder(){return Rf(this.kpuzzle.definition,this)}selfMultiply(t){return new Ar(this.kpuzzle,Dr(this.kpuzzle,this.transformationData,t))}},Dt=Ar;nn=new WeakMap});function Zl(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 dL(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 df(e,t,r){for(let[n,l]of Object.entries(e.definition.orbits))if(!dL(l,t[n],r[n]))return!1;return!0}function ps(e,t){let r={};for(let n in e.definition.orbits){let l=e.definition.orbits[n],o=t[n];if(Zl(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 Dr(e,t,r){if(r===1)return t;if(r<0)return Dr(e,ps(e,t),-r);if(r===0){let{transformationData:o}=e.identityTransformation();return o}let n=t;r!==2&&(n=Dr(e,t,Math.floor(r/2)));let l=Jl(e.definition,n,n);return r%2===0?l:Jl(e.definition,t,l)}function Ls(e,t){return t?Ls(t,e%t):e}function Rf(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,u=0;for(;i[s]=!0,f=f+o.orientation[s],u=u+1,s=o.permutation[s],s!==a;);f!==0&&(u=u*l.numOrientations/Ls(l.numOrientations,Math.abs(f))),r=r*u/Ls(r,u)}}return r}var ms,hf,Ff,Yl=y(()=>{"use strict";me();li();$l();ms=class extends Fr{traverseAlg(t,r){let n=null;for(let l of t.childAlgNodes())n?n=n.applyTransformation(this.traverseAlgNode(l,r)):n=this.traverseAlgNode(l,r);return n??r.identityTransformation()}traverseGrouping(t,r){let n=this.traverseAlg(t.alg,r);return new Dt(r,Dr(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()}},hf=new ms,Ff=hf.traverseAlg.bind(hf)});var jn,ii,Ae,Df=y(()=>{"use strict";me();Yl();cs();oi();$l();Ae=class{constructor(t,r){this.definition=t;J(this,jn,new Map);J(this,ii,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return Dt.experimentalConstructIdentity(this)}moveToTransformation(t){typeof t=="string"&&(t=new B(t));let r=t.toString(),n=R(this,jn).get(r);if(n)return new Dt(this,n);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(t);if(!o)throw new Error(\`could not map to internal move: \${t}\`);return R(this,jn).set(r,o),new Dt(this,o)}let l=Bf(this,t);return R(this,jn).set(r,l),new Dt(this,l)}algToTransformation(t){return typeof t=="string"&&(t=new w(t)),Ff(t,this)}toTransformation(t){return typeof t=="string"?this.algToTransformation(t):t?.is?.(w)?this.algToTransformation(t):t?.is?.(B)?this.moveToTransformation(t):t}startState(){return new ge(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return R(this,ii)??V(this,ii,(()=>{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})())}};jn=new WeakMap,ii=new WeakMap});var He=y(()=>{"use strict";Df();oi();$l()});var Af,RL,yf=y(()=>{"use strict";Af={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"}},RL={...Af,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 Sf(e){return hL[e]}var tr,Kt,Xe,qn,ai,ln,hL,Vn,Hn,eo=y(()=>{"use strict";tr=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))}},Kt="regular",Xe="ignored",qn="oriented",ai="invisible",ln="dim",hL={["Regular"]:{facelets:[Kt,Kt,Kt,Kt,Kt]},["Ignored"]:{facelets:[Xe,Xe,Xe,Xe,Xe]},["OrientationStickers"]:{facelets:[qn,qn,qn,qn,qn]},["IgnoreNonPrimary"]:{facelets:[Kt,Xe,Xe,Xe,Xe]},["Invisible"]:{facelets:[ai,ai,ai,ai]},["PermuteNonPrimary"]:{facelets:[ln,Kt,Kt,Kt,Kt]},["Dim"]:{facelets:[ln,ln,ln,ln,ln]},["Ignoriented"]:{facelets:[ln,Xe,Xe,Xe,Xe]},["OrientationWithoutPermutation"]:{facelets:[qn,Xe,Xe,Xe,Xe]}};Vn=class extends tr{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}toStickeringMask(){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(Sf(i))}return t}},Hn=class{constructor(t){this.kpuzzle=t}and(t){let r=new tr(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 tr(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 tr(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 tr(this.kpuzzle,!1);for(let[l,o]of Object.entries(this.kpuzzle.definition.orbits))for(let i=0;i<o.numPieces;i++)(r.transformationData[l].permutation[i]!==i||r.transformationData[l].orientation[i]!==0)&&(n.stickerings.get(l)[i]=!0);return n}moves(t){return t.map(r=>this.move(r))}orbits(t){let r=new tr(this.kpuzzle,!1);for(let n of t)r.stickerings.get(n).fill(!0);return r}orbitPrefix(t){let r=new tr(this.kpuzzle,!1);for(let n in this.kpuzzle.definition.orbits)n.startsWith(t)&&r.stickerings.get(n).fill(!0);return r}}});var Bs,ds=y(()=>{"use strict";Bs={full:{groups:{"3x3x3":"Stickering"}},OLL:{groups:{"3x3x3":"Last Layer"}},PLL:{groups:{"3x3x3":"Last Layer"}},LL:{groups:{"3x3x3":"Last Layer"}},COLL:{groups:{"3x3x3":"Last Layer"}},OCLL:{groups:{"3x3x3":"Last Layer"}},CLL:{groups:{"3x3x3":"Last Layer"}},ELL:{groups:{"3x3x3":"Last Layer"}},ZBLL:{groups:{"3x3x3":"Last Layer"}},LS:{groups:{"3x3x3":"Last Slot"}},ELS:{groups:{"3x3x3":"Last Slot"}},CLS:{groups:{"3x3x3":"Last Slot"}},ZBLS:{groups:{"3x3x3":"Last Slot"}},VLS:{groups:{"3x3x3":"Last Slot"}},WVLS:{groups:{"3x3x3":"Last Slot"}},F2L:{groups:{"3x3x3":"CFOP (Fridrich)"}},Daisy:{groups:{"3x3x3":"CFOP (Fridrich)"}},Cross:{groups:{"3x3x3":"CFOP (Fridrich)"}},EO:{groups:{"3x3x3":"ZZ"}},EOline:{groups:{"3x3x3":"ZZ"}},EOcross:{groups:{"3x3x3":"ZZ"}},CMLL:{groups:{"3x3x3":"Roux"}},L10P:{groups:{"3x3x3":"Roux"}},L6E:{groups:{"3x3x3":"Roux"}},L6EO:{groups:{"3x3x3":"Roux"}},"2x2x2":{groups:{"3x3x3":"Petrus"}},"2x2x3":{groups:{"3x3x3":"Petrus"}},"Void Cube":{groups:{"3x3x3":"Miscellaneous"}},invisible:{groups:{"3x3x3":"Miscellaneous"}},picture:{groups:{"3x3x3":"Miscellaneous"}},"centers-only":{groups:{"3x3x3":"Miscellaneous"}},"experimental-centers-U":{},"experimental-centers-U-D":{},"experimental-centers-U-L-D":{},"experimental-centers-U-L-B-D":{},"experimental-centers":{},"experimental-fto-fc":{groups:{fto:"Bencisco"}},"experimental-fto-f2t":{groups:{fto:"Bencisco"}},"experimental-fto-sc":{groups:{fto:"Bencisco"}},"experimental-fto-l2c":{groups:{fto:"Bencisco"}},"experimental-fto-lbt":{groups:{fto:"Bencisco"}},"experimental-fto-l3t":{groups:{fto:"Bencisco"}}}});async function rr(e,t){let r=await e.kpuzzle(),n=new Vn(r),l=new Hn(r),o=()=>l.move("U"),i=()=>l.or(l.moves(["U","D"])),a=()=>l.or(l.moves(["L","R"])),s=()=>l.not(a()),f=()=>l.not(o()),u=()=>l.orbitPrefix("CENTER"),g=()=>l.orbitPrefix("EDGE"),c=()=>l.or([l.orbitPrefix("CORNER"),l.orbitPrefix("C4RNER"),l.orbitPrefix("C5RNER")]),p=()=>l.or([s(),l.and([o(),g()])]),L=()=>l.and([o(),u()]),m=()=>l.and([l.and(l.moves(["F","R"])),g()]),d=()=>l.and([l.and(l.moves(["F","R"])),c(),l.not(o())]),F=()=>l.or([d(),m()]);function A(){n.set(f(),"Dim")}function S(){n.set(o(),"PermuteNonPrimary"),n.set(L(),"Dim")}function x(){n.set(o(),"IgnoreNonPrimary"),n.set(L(),"Regular")}function U(){n.set(o(),"Ignoriented"),n.set(L(),"Dim")}switch(t){case"full":break;case"PLL":{A(),S();break}case"CLS":{A(),n.set(d(),"Regular"),n.set(o(),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),c()]),"IgnoreNonPrimary");break}case"OLL":{A(),x();break}case"COLL":{A(),n.set(l.and([o(),g()]),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),c()]),"Regular");break}case"OCLL":{A(),U(),n.set(l.and([o(),c()]),"IgnoreNonPrimary");break}case"CLL":{A(),n.set(l.not(l.and([c(),o()])),"Dim");break}case"ELL":{A(),n.set(o(),"Dim"),n.set(l.and([o(),g()]),"Regular");break}case"ELS":{A(),x(),n.set(l.and([o(),c()]),"Ignored"),n.set(m(),"Regular"),n.set(d(),"Ignored");break}case"LL":{A();break}case"F2L":{n.set(o(),"Ignored");break}case"ZBLL":{A(),n.set(o(),"PermuteNonPrimary"),n.set(L(),"Dim"),n.set(l.and([o(),c()]),"Regular");break}case"ZBLS":{A(),n.set(F(),"Regular"),x(),n.set(l.and([o(),c()]),"Ignored");break}case"VLS":{A(),n.set(F(),"Regular"),x();break}case"WVLS":{A(),n.set(F(),"Regular"),n.set(l.and([o(),g()]),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),c()]),"IgnoreNonPrimary");break}case"LS":{A(),n.set(F(),"Regular"),n.set(o(),"Ignored"),n.set(L(),"Dim");break}case"EO":{n.set(c(),"Ignored"),n.set(g(),"OrientationWithoutPermutation");break}case"EOline":{n.set(c(),"Ignored"),n.set(g(),"OrientationWithoutPermutation"),n.set(l.and(l.moves(["D","M"])),"Regular");break}case"EOcross":{n.set(g(),"OrientationWithoutPermutation"),n.set(l.move("D"),"Regular"),n.set(c(),"Ignored");break}case"CMLL":{n.set(f(),"Dim"),n.set(p(),"Ignored"),n.set(l.and([o(),c()]),"Regular");break}case"L10P":{n.set(l.not(p()),"Dim"),n.set(l.and([c(),o()]),"Regular");break}case"L6E":{n.set(l.not(p()),"Dim");break}case"L6EO":{n.set(l.not(p()),"Dim"),n.set(p(),"OrientationWithoutPermutation"),n.set(l.and([u(),i()]),"OrientationStickers");break}case"Daisy":{n.set(l.all(),"Ignored"),n.set(u(),"Dim"),n.set(l.and([l.move("D"),u()]),"Regular"),n.set(l.and([l.move("U"),g()]),"IgnoreNonPrimary");break}case"Cross":{n.set(l.all(),"Ignored"),n.set(u(),"Dim"),n.set(l.and([l.move("D"),u()]),"Regular"),n.set(l.and([l.move("D"),g()]),"Regular");break}case"2x2x2":{n.set(l.or(l.moves(["U","F","R"])),"Ignored"),n.set(l.and([l.or(l.moves(["U","F","R"])),u()]),"Dim");break}case"2x2x3":{n.set(l.all(),"Dim"),n.set(l.or(l.moves(["U","F","R"])),"Ignored"),n.set(l.and([l.or(l.moves(["U","F","R"])),u()]),"Dim"),n.set(l.and([l.move("F"),l.not(l.or(l.moves(["U","R"])))]),"Regular");break}case"Void Cube":{n.set(u(),"Invisible");break}case"picture":case"invisible":{n.set(l.all(),"Invisible");break}case"centers-only":{n.set(l.not(u()),"Ignored");break}default:console.warn(\`Unsupported stickering for \${e.id}: \${t}. Setting all pieces to dim.\`),n.set(l.and(l.moves([])),"Dim")}return n.toStickeringMask()}async function Xn(){let e=[];for(let[t,r]of Object.entries(Bs))r.groups&&"3x3x3"in r.groups&&e.push(t);return e}var to=y(()=>{"use strict";eo();ds()});function de(e){let t=null;return()=>t??(t=e())}var wt=y(()=>{"use strict"});var Zn,xf=y(()=>{"use strict";Zn=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 on,Uf=y(()=>{"use strict";on=class{notationToInternal(t){return t}notationToExternal(t){return t}}});var ro,bf=y(()=>{"use strict";me();ro=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 _("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 _("T",t.innerLayer,t.outerLayer),t.amount):this.child.notationToExternal(t)}}});var Jn,wf=y(()=>{"use strict";me();Jn=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 _(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 no,Ef=y(()=>{"use strict";me();no=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 _("L",3,2),-2*t.amount);if(t.family==="R--")return new B(new _("L",3,2),2*t.amount);if(t.family==="D++")return new B(new _("U",3,2),-2*t.amount);if(t.family==="D--")return new B(new _("U",3,2),2*t.amount);if(t.family==="R_PLUSPLUS_")return new B(new _("L",3,2),-2*t.amount);if(t.family==="D_PLUSPLUS_")return new B(new _("U",3,2),-2*t.amount)}if(t.family==="y")return new B("Uv",t.amount);if(t.family==="x"&&Math.abs(t.amount)===2)return new B("ERv",t.amount/2)}return this.child.notationToInternal(t)}notationToExternal(t){return t.family==="ERv"&&Math.abs(t.amount)===1?new B(new _("x",t.innerLayer,t.outerLayer),t.amount*2):t.family==="ILv"&&Math.abs(t.amount)===1?new B(new _("x",t.innerLayer,t.outerLayer),-t.amount*2):t.family==="Uv"?new B(new _("y",t.innerLayer,t.outerLayer),t.amount):t.family==="Dv"?new B("y",-t.amount):this.child.notationToExternal(t)}}});var lo,kf=y(()=>{"use strict";me();lo=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 _("D",(this.slices+1)/2),t.amount):r==="M"?t=new B(new _("L",(this.slices+1)/2),t.amount):r==="S"&&(t=new B(new _("F",(this.slices+1)/2),t.amount))),this.slices>2&&(r==="e"?t=new B(new _("D",this.slices-1,2),t.amount):r==="m"?t=new B(new _("L",this.slices-1,2),t.amount):r==="s"&&(t=new B(new _("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 FL,DL,_f,zf,Cf,Yn,oo,Nf=y(()=>{"use strict";me();FL={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"},DL={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"},_f={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},zf=new _("y"),Cf=new _("Dv"),Yn=class{constructor(t){this.child=t;this.wcaHack=!1;this.map=FL}notationToInternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){let n=_f[t.family];if(n)return new B(new _(n,t.innerLayer,t.outerLayer),t.amount)}let r=this.map[t.family];return r?new B(new _(r,t.innerLayer,t.outerLayer),t.amount):zf.isIdentical(t.quantum)?new B(Cf,-t.amount):null}notationToExternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){for(let[r,n]of Object.entries(_f))if(this.child.spinmatch(t.family,n))return new B(new _(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 _(r,t.innerLayer,t.outerLayer),t.amount);return Cf.isIdentical(t.quantum)?new B(zf,-t.amount):null}},oo=class extends Yn{constructor(r){super(r);this.wcaHack=!0;this.map=DL}}});var Pf,Rs,Mf,AL,hs,If,yL,Fs,Of,SL,io,Tf=y(()=>{"use strict";me();Pf={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"},Rs=new _("x"),Mf=new _("Rv"),AL=new _("Lv"),hs=new _("y"),If=new _("Uv"),yL=new _("Dv"),Fs=new _("z"),Of=new _("Fv"),SL=new _("Bv"),io=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer||t.outerLayer)return null;let r=Pf[t.family];return r?new B(new _(r,t.outerLayer,t.innerLayer),t.amount):Rs.isIdentical(t.quantum)?new B(Mf,t.amount):hs.isIdentical(t.quantum)?new B(If,t.amount):Fs.isIdentical(t.quantum)?new B(Of,t.amount):null}notationToExternal(t){for(let[r,n]of Object.entries(Pf))if(this.child.spinmatchv(t.family,n))return new B(new _(r,t.innerLayer,t.outerLayer),t.amount);return Mf.isIdentical(t.quantum)?new B(Rs,t.amount):AL.isIdentical(t.quantum)?new B(Rs,-t.amount):If.isIdentical(t.quantum)?new B(hs,t.amount):yL.isIdentical(t.quantum)?new B(hs,-t.amount):Of.isIdentical(t.quantum)?new B(Fs,t.amount):SL.isIdentical(t.quantum)?new B(Fs,-t.amount):null}}});var Ds=y(()=>{"use strict";Uf();bf();wf();Ef();kf();Nf();Tf()});function Gf(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:ao(e.slice(t).join(" ")),options:r}}var si,As=y(()=>{"use strict";so();si=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 yr(e){if(!ys[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=0;ys[e]=t}return ys[e]}function Qt(e){if(!Ss[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;Ss[e]=t}return Ss[e]}function Wf(e){return new Bt(Qt(e))}function Kf(e){let t=BigInt(1);for(;e>1;)t*=BigInt(e),e--;return t}function vL(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 vs(e,t){return e/vL(e,t)*t}var ys,Ss,Bt,fi=y(()=>{"use strict";ys=[],Ss=[];Bt=class{constructor(t){this.n=t.length,this.p=t}toString(){return\`Perm[\${this.p.join(" ")}]\`}mul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=t.p[this.p[n]];return new Bt(r)}rmul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=this.p[t.p[n]];return new Bt(r)}inv(){let t=Array(this.n);for(let r=0;r<this.n;r++)t[this.p[r]]=r;return new Bt(t)}compareTo(t){for(let r=0;r<this.n;r++)if(this.p[r]!==t.p[r])return this.p[r]-t.p[r];return 0}toGap(){let t=new Array,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=new Array;for(let o=n;!r[o];o=this.p[o])l.push(1+o),r[o]=!0;t.push(\`(\${l.join(",")})\`)}return t.join("")}order(){let t=1,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=0;for(let o=n;!r[o];o=this.p[o])l++,r[o]=!0;t=vs(t,l)}return t}}});function ui(e,t){let r=B.fromString(t),n=e.notationToExternal(r);return n===null||r===n?t:n.toString()}function Qf(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 u=e.moveops[f];a.mul(u).equal(u.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 u in o){let g=+u,c=o[g];a+=c,f++;for(let p=0;p<n.length;p++)if((g>>p&1)===0&&(g&l[p]&(1<<p)-1)===0){let L=g&l[p]|1<<p;s[L]===void 0&&(s[L]=0),s[L]+=(n[p]-1)*c}}t(\`\${i}: canonseq \${a} states \${f}\`),o=s}}var $n,xL,an,Et,jt,gi,nr,sn,ci,jf=y(()=>{"use strict";me();Ds();fi();$n=class{constructor(t,r){this.size=t;this.mod=r}reassemblySize(){return Kf(this.size)*BigInt(this.mod)**BigInt(this.size)}},xL=0;an=class{constructor(t,r,n,l,o,i,a){this.orbitnames=t;this.orbitdefs=r;this.solved=n;this.movenames=l;this.moveops=o;this.isRotation=i;this.forcenames=a}transformToKTransformationData(t){let r={};for(let n=0;n<this.orbitnames.length;n++)r[this.orbitnames[n]]=t.orbits[n].toKPuzzle();return r}static transformToKTransformationData(t,r){let n={};for(let l=0;l<t.length;l++)n[t[l]]=r.orbits[l].toKPuzzle();return n}describeSet(t,r,n){let l=this.orbitdefs[t].size,o=new Array(l);for(let i=0;i<l;i++)o[i]=[];for(let i=0;i<this.movenames.length;i++){if(this.isRotation[i])continue;let a=this.movenames[i];this.forcenames[i]||(a=ui(n,a),a[a.length-1]==="'"&&(a=a.substring(0,a.length-1)));let s=this.moveops[i].orbits[t];for(let f=0;f<l;f++)(s.perm[f]!==f||s.ori[f]!==0)&&o[f].push(a)}for(let i=0;i<l;i++)r.push(\`# \${i+1} \${o[i].join(" ")}\`)}toKsolve(t,r=new on){let n=[];n.push(\`Name \${t}\`),n.push("");for(let l=0;l<this.orbitnames.length;l++)n.push(\`Set \${this.orbitnames[l]} \${this.orbitdefs[l].size} \${this.orbitdefs[l].mod}\`),this.describeSet(l,n,r);n.push(""),n.push("Solved");for(let l=0;l<this.orbitnames.length;l++)this.solved.orbits[l].appendDefinition(n,this.orbitnames[l],!1,!1);n.push("End");for(let l=0;l<this.movenames.length;l++){n.push("");let o=this.movenames[l];this.forcenames[l]||(o=ui(r,this.movenames[l]));let i=!1;o[o.length-1]==="'"&&(i=!0,o=o.substring(0,o.length-1)),n.push(\`Move \${o}\`);for(let 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 #\${++xL}\`,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 ci(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++)if(!this.isRotation[p])for(let L=0;L<a;L++)(this.moveops[p].orbits[o].perm[L]!==L||this.moveops[p].orbits[o].ori[L]!==0)&&(f[L]=!0,s.union(L,this.moveops[p].orbits[o].perm[L]));let u=!0;if(i>1){u=!1;let p=new ci(this.orbitdefs[o].size*i);for(let L=0;L<this.moveops.length;L++)for(let m=0;m<a;m++)if(this.moveops[L].orbits[o].perm[m]!==m||this.moveops[L].orbits[o].ori[m]!==0)for(let d=0;d<i;d++)p.union(m*i+d,this.moveops[L].orbits[o].perm[m]*i+(d+this.moveops[L].orbits[o].ori[m])%i);for(let L=0;!u&&L<a;L++)for(let m=1;m<i;m++)p.find(L*i)===p.find(L*i+m)&&(u=!0);for(let L=0;!u&&L<a;L++)for(let m=0;m<L;m++)this.solved.orbits[o].perm[L]===this.solved.orbits[o].perm[m]&&(u=!0)}let g=-1,c=!1;for(let p=0;p<this.orbitdefs[o].size;p++)if(f[p]){let L=s.find(p);g<0?g=L:g!==L&&(c=!0)}for(let p=0;p<this.orbitdefs[o].size;p++){if(!f[p]||s.find(p)!==p)continue;let m=[],d=[],F=0;for(let A=0;A<this.orbitdefs[o].size;A++)s.find(A)===p&&(m[F]=A,d[A]=F,F++);if(c?t.push(\`\${this.orbitnames[o]}_p\${p}\`):t.push(this.orbitnames[o]),u){r.push(new $n(F,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(m,F));for(let A=0;A<this.moveops.length;A++)l[A].push(this.moveops[A].orbits[o].remap(m,d,F))}else{r.push(new $n(F,1)),n.push(this.solved.orbits[o].remapVS(m,F).killOri());for(let A=0;A<this.moveops.length;A++)l[A].push(this.moveops[A].orbits[o].remap(m,d,F).killOri())}}}return new an(t,r,new sn(n),this.movenames,l.map(o=>new nr(o)),this.isRotation,this.forcenames)}scramble(t){this.solved=this.solved.mul(this.getScrambleTransformation(t))}getScrambleTransformation(t){t<100&&(t=100);let r=[];for(let l=0;l<this.moveops.length;l++)r[l]=this.moveops[l];for(let l=0;l<r.length;l++){let o=Math.floor(Math.random()*r.length),i=r[l];r[l]=r[o],r[o]=i}t<r.length&&(t=r.length);for(let l=0;l<t;l++){let o=Math.floor(Math.random()*r.length),i=Math.floor(Math.random()*r.length),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=BigInt(1);for(let r=0;r<this.orbitdefs.length;r++)t*=this.orbitdefs[r].reassemblySize();return t}},Et=class{constructor(t,r,n){this.perm=t;this.ori=r;this.orimod=n}static e(t,r){return new Et(Qt(t),yr(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 Et(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 Et(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 Et(r,n,this.orimod)}equal(t){let r=this.perm.length;for(let n=0;n<r;n++)if(this.perm[n]!==t.perm[n]||this.ori[n]!==t.ori[n])return!1;return!0}killOri(){let t=this.perm.length;for(let r=0;r<t;r++)this.ori[r]=0;return this.orimod=1,this}toPerm(){let t=this.orimod;if(t===1)return new Bt(this.perm);let r=this.perm.length,n=new Array(r*t);for(let l=0;l<r;l++)for(let o=0;o<t;o++)n[l*t+o]=t*this.perm[l]+(this.ori[l]+o)%t;return new Bt(n)}identicalPieces(){let t=[],r=this.perm.length,n=[];for(let l=0;l<r;l++){let o=this.perm[l];if(t[o]===void 0){let i=[l];t[o]=!0;for(let 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===Qt(t)&&this.ori===yr(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===yr(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 Et(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 Et(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()?(Et.kcache[t]||(Et.kcache[t]={permutation:Qt(t),orientation:yr(t)}),Et.kcache[t]):{permutation:this.perm,orientation:this.ori}}},jt=Et;jt.kcache=[];gi=class{constructor(t){this.orbits=t}internalMul(t){let r=[];for(let n=0;n<this.orbits.length;n++)r.push(this.orbits[n].mul(t.orbits[n]));return r}internalInv(){let t=[];for(let r of this.orbits)t.push(r.inv());return t}equal(t){for(let r=0;r<this.orbits.length;r++)if(!this.orbits[r].equal(t.orbits[r]))return!1;return!0}killOri(){for(let t of this.orbits)t.killOri();return this}toPerm(){let t=new Array,r=0;for(let l of this.orbits){let o=l.toPerm();t.push(o),r+=o.n}let n=new Array(r);r=0;for(let l of t){for(let o=0;o<l.n;o++)n[r+o]=r+l.p[o];r+=l.n}return new Bt(n)}identicalPieces(){let t=[],r=0;for(let n of this.orbits){let l=n.orimod,o=n.identicalPieces();for(let i=0;i<o.length;i++)t.push(o[i].map(a=>a*l+r));r+=l*n.perm.length}return t}order(){let t=1;for(let r of this.orbits)t=vs(t,r.order());return t}},nr=class extends gi{constructor(t){super(t)}mul(t){return new nr(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 nr(this.internalInv())}e(){return new nr(this.orbits.map(t=>jt.e(t.perm.length,t.orimod)))}},sn=class extends gi{constructor(t){super(t)}mul(t){return new sn(this.internalMul(t))}},ci=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 pi,qf=y(()=>{"use strict";pi={"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 mi(e){let t=new W(0,0,0,0);for(let r=0;r<e.length;r++)t=t.sum(e[r]);return t.smul(1/e.length)}function Vf(e,t,r,n){let l=n[e].intersect3(n[t],n[r]);if(!l)return l;for(let o=0;o<n.length;o++)if(o!==e&&o!==t&&o!==r){let i=n[o].b*l.b+n[o].c*l.c+n[o].d*l.d;if(n[o].a>0&&i>n[o].a||n[o].a<0&&i<n[o].a)return!1}return l}var W,Li=y(()=>{"use strict";W=class{constructor(t,r,n,l){this.a=t;this.b=r;this.c=n;this.d=l}mul(t){return new W(this.a*t.a-this.b*t.b-this.c*t.c-this.d*t.d,this.a*t.b+this.b*t.a+this.c*t.d-this.d*t.c,this.a*t.c-this.b*t.d+this.c*t.a+this.d*t.b,this.a*t.d+this.b*t.c-this.c*t.b+this.d*t.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(t){return Math.hypot(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(t){return new W(0,this.c*t.d-this.d*t.c,this.d*t.b-this.b*t.d,this.b*t.c-this.c*t.b)}dot(t){return this.b*t.b+this.c*t.c+this.d*t.d}normalize(){let t=Math.sqrt(this.dot(this));return new W(this.a/t,this.b/t,this.c/t,this.d/t)}makenormal(){return new W(0,this.b,this.c,this.d).normalize()}normalizeplane(){let t=Math.hypot(this.b,this.c,this.d);return new W(this.a/t,this.b/t,this.c/t,this.d/t)}smul(t){return new W(this.a*t,this.b*t,this.c*t,this.d*t)}sum(t){return new W(this.a+t.a,this.b+t.b,this.c+t.c,this.d+t.d)}sub(t){return new W(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new W(this.a,-this.b,-this.c,-this.d)}det3x3(t,r,n,l,o,i,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 W(0,this.b,this.c,this.d)).mul(t.invrot());return r.a=this.a,r}orthogonal(){let t=Math.abs(this.b),r=Math.abs(this.c),n=Math.abs(this.d);return t<r&&t<n?this.cross(new W(0,1,0,0)).normalize():r<t&&r<n?this.cross(new W(0,0,1,0)).normalize():this.cross(new W(0,0,0,1)).normalize()}pointrotation(t){let r=this.normalize();if(t=t.normalize(),r.sub(t).len()<1e-9)return new W(1,0,0,0);let n=r.sum(t);n.len()<1e-9?n=n.orthogonal():n=n.normalize();let l=r.cross(n);return l.a=r.dot(n),l}unproject(t){return this.sum(t.smul(-this.dot(t)/(this.len()*t.len())))}rotatepoint(t){return t.mul(this).mul(t.invrot())}rotateface(t){return t.map(r=>r.rotatepoint(this))}intersect3(t,r){let n=this.det3x3(this.b,this.c,this.d,t.b,t.c,t.d,r.b,r.c,r.d);return Math.abs(n)<1e-9?!1:new W(0,this.det3x3(this.a,this.c,this.d,t.a,t.c,t.d,r.a,r.c,r.d)/n,this.det3x3(this.b,this.a,this.d,t.b,t.a,t.d,r.b,r.a,r.d)/n,this.det3x3(this.b,this.c,this.a,t.b,t.c,t.a,r.b,r.c,r.a)/n)}side(t){return t>1e-9?1:t<-1e-9?-1:0}cutface(t){let r=this.a,n=0,l=null;for(let o=0;o<t.length;o++)n|=1<<this.side(t[o].dot(this)-r)+1;if((n&5)===5){l=[];let o=t.map(i=>this.side(i.dot(this)-r));for(let i=-1;i<=1;i+=2){let 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 u=t[s].dot(this)-r,g=t[f].dot(this)-r,c=u/(u-g),p=t[s].smul(1-c).sum(t[f].smul(c));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 W(t,this.b,this.c,this.d)}}});function Hf(){let e=Math.sqrt(.5);return[new W(e,e,0,0),new W(e,0,e,0)]}function Xf(){return[new W(.5,.5,.5,.5),new W(.5,.5,.5,-.5)]}function Zf(){let e=2*Math.PI/10,t=.5+.3*Math.sqrt(5),r=.5+.1*Math.sqrt(5),n=Math.sqrt(t*t+r*r);return t/=n,r/=n,[new W(Math.cos(e),t*Math.sin(e),r*Math.sin(e),0),new W(.5,.5,.5,.5)]}function Jf(){let e=.16666666666666666+Math.sqrt(5)/6,t=2/3+Math.sqrt(5)/3,r=Math.sqrt(e*e+t*t);e/=r,t/=r;let n=2*Math.PI/6;return[new W(Math.cos(n),e*Math.sin(n),t*Math.sin(n),0),new W(Math.cos(n),-e*Math.sin(n),t*Math.sin(n),0)]}function Yf(){let e=Math.sqrt(.5);return[new W(.5,.5,.5,.5),new W(e,0,0,e)]}function $f(e){let t=[new W(1,0,0,0)];for(let r=0;r<t.length;r++)for(let n=0;n<e.length;n++){let l=e[n].mul(t[r]),o=l.smul(-1),i=!1;for(let a=0;a<t.length;a++)if(l.dist(t[a])<Bi||o.dist(t[a])<Bi){i=!0;break}i||t.push(l)}return t}function xs(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])<Bi){i=!0;break}i||(r.push(o),n.push(t[l]))}return n}function Us(e){let t=[];for(let r=1;r<e.length;r++)for(let n=r+1;n<e.length;n++){let l=Vf(0,r,n,e);if(l){let o=!1;for(let i=0;i<t.length;i++)if(l.dist(t[i])<Bi){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 Bi,e1=y(()=>{"use strict";Li();Bi=1e-9});function di(e,t){let r=e[0].p.length,n=Wf(r),l=[],o=[],i=[],a=[],s=[];function f(p){for(let L=p.p.length-1;L>=0;L--){let m=p.p[L];if(m!==L){if(!l[L][m])return!1;p=p.mul(o[L][m])}}return!0}function u(p,L,m){a[p].push(L),s[p].push(m);for(let d=0;d<l[p].length;d++)l[p][d]&&g(p,l[p][d].mul(L),m+i[p][d])}function g(p,L,m){let d=L.p[p];if(!l[p][d]){l[p][d]=L,o[p][d]=L.inv(),i[p][d]=m;for(let A=0;A<a[p].length;A++)g(p,L.mul(a[p][A]),m+s[p][A]);return}let F=L.mul(o[p][d]);f(F)||u(p-1,F,m+i[p][d])}function c(){l=[],o=[],a=[],i=[],s=[];for(let m=0;m<r;m++)l.push([]),o.push([]),i.push([]),a.push([]),s.push([]),l[m][m]=n,o[m][m]=n,i[m][m]=0;let p=0,L=BigInt(1);for(let m=0;m<e.length;m++){u(r-1,e[m],1),L=BigInt(1);let d=0,F=0,A=[],S=new bs;for(let x=0;x<r;x++){let U=0,P=0;for(let C=0;C<r;C++)l[x][C]&&(U++,P+=i[x][C],x!==C&&p++);d+=a[x].length,L*=BigInt(U),U>1&&S.multiply(U);let Z=P/U;A.push(Z),F+=Z}t(\`\${m}: sz \${L} T \${d} sol \${F} none \${p} mults \${S.toString()}\`)}return L}return c()}var bs,ws=y(()=>{"use strict";fi();bs=class{constructor(){this.mult=[]}multiply(t){for(let r=2;r*r<=t;r++)for(;t%r===0;)this.mult[r]!==void 0?this.mult[r]++:this.mult[r]=1,t/=r;t>1&&(this.mult[t]!==void 0?this.mult[t]++:this.mult[t]=1)}toString(){let t="";for(let r=0;r<this.mult.length;r++)this.mult[r]!==void 0&&(t!==""&&(t+="*"),t+=r,this.mult[r]>1&&(t+=\`^\${this.mult[r]}\`));return t}}});function UL(e,t){let r=[];for(let n of e)for(let l of t)r.push(l.rotate(n));return r}function EL(){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 kL(){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 zL(){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 Ri(e,t){for(let r=0;r<e.length;r++)if(e[r][0].dist(t)<Ue)return r;throw new Error("Element not found")}function t1(){return pi}function r1(e){return pi[e]}function ao(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 ks(e,t={}){let r=ao(e);if(r===null)throw new Error("Could not parse the puzzle description");let n=new fo(r,Object.assign({},{allMoves:!0},t));return n.allstickers(),n.genperms(),n}function o1(e,t){return ks(pi[e],t)}function CL(e,t,r){let n=!1;r-t[1]<t[0]&&(e=[e[2],e[3],e[0],e[1]],t=[r-t[1],r-t[0]],n=!0);let l=e[0],o="";if(t[0]===0&&t[1]===r)l=\`\${l}v\`;else if(t[0]===t[1])t[1]>0&&(o=String(t[1]+1));else if(t[0]===0)l=l.toLowerCase(),t[1]>1&&(o=String(t[1]+1));else throw new Error(\`We only support slice and outer block moves right now. \${t}\`);return[o+l,n]}function NL(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 hi(e,t){return[e.b/t,-e.c/t,e.d/t]}function Es(e,t){let r=[],n=e.length;for(let l=0;l<n;l++){let o=hi(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 Sr,el,Ue,bL,wL,_L,n1,l1,fo,Fi,so=y(()=>{"use strict";me();xf();Ds();As();fi();jf();qf();e1();Li();ws();Sr=class{constructor(t){this.coords=new Array(t.length*3);for(let r=0;r<t.length;r++)this.coords[3*r]=t[r].b,this.coords[3*r+1]=t[r].c,this.coords[3*r+2]=t[r].d;this.length=t.length}get(t){return new W(0,this.coords[3*t],this.coords[3*t+1],this.coords[3*t+2])}centermass(){let t=0,r=0,n=0;for(let l=0;l<this.length;l++)t+=this.coords[3*l],r+=this.coords[3*l+1],n+=this.coords[3*l+2];return new W(0,t/this.length,r/this.length,n/this.length)}rotate(t){let r=[];for(let n=0;n<this.length;n++)r.push(this.get(n).rotatepoint(t));return new Sr(r)}rotateforward(){let t=[];for(let r=1;r<this.length;r++)t.push(this.get(r));return t.push(this.get(0)),new Sr(t)}},el=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 el(r[0]),this.right=new el(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 Sr(this.face)):r?(this.left?.collect(t,!1),this.right?.collect(t,!0)):(this.right?.collect(t,!1),this.left?.collect(t,!0)),t}};Ue=1e-9,bL="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",wL=!1;_L={4:{v:["DFR","DLF","DRL","FLR"],e:["FR","LF","DF","DL","RD","RL"],c:["DF","FD","RL","LR"]},6:{v:["URF","UBR","ULB","UFL","DFR","DRB","DBL","DLF"],e:["UF","UR","UB","UL","DF","DR","DB","DL","FR","FL","BR","BL"],c:["UB","LU","FU","RU","BU","DF"]},8:{v:["UBBBRR","URFL","ULBLBB","DBRBBBL","DBLLF","DFRBR"],e:["UL","UBB","UR","BRD","BLD","FD","BRR","FR","FL","BLL","BLBB","BRBB"],c:["BBU","LU","RU","BRD","FD","BLD","DF","UBB"]},12:{v:["URF","UFL","ULBL","UBLBR","UBRR","DEBF","DBFI","DIA","DAC","DCE","LAI","ALF","FCA","CFR","REC","ERBR","BRBFE","BFBRBL","BLIBF","IBLL"],e:["UF","UR","UBR","UBL","UL","ER","EBR","EBF","ED","EC","IBF","IBL","IL","IA","ID","AC","CF","FA","BFBR","BRBL","BLBF","CD","AD","AL","FL","FR","CR","BFD","BRR","BLL"],c:["UF","FU","DBF","BFD","AD","CD","BRU","BLU","LA","RA","EBR","IBL"]},20:{v:["FLPQU","FUGER","FRCAL","HCREI","ISBDH","JSIEG","BSJMK","MQPOK","ONDBK","NOPLA","UQMJG","DNACH"],e:["FU","FL","FR","EG","ER","EI","SJ","SI","SB","KM","KB","KO","PQ","PO","PL","UG","JG","MQ","UQ","HC","HD","ND","NA","JM","CA","AL","CR","HI","DB","NO"],c:["FU","UF","GE","EG","JS","SJ","MK","KM","QP","PQ","LA","AL","RC","CR","IH","HI","BD","DB","ON","NO"]}};n1=["c","t","o","d","i"],l1=["f","v","e"];fo=class{constructor(t,r){this.puzzleDescription=t;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.notationMapper=new on;this.addNotationMapper="";this.setReidOrder=!1;let n="genperms";this.options=new si(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=Hf();break}case"o":{l=Yf();break}case"i":{l=Jf();break}case"t":{l=Xf();break}case"d":{l=Zf();break}default:throw new Error(\`Bad shape argument: \${r}\`)}this.rotations=$f(l),this.options.verbosity&&console.log(\`# Rotations: \${this.rotations.length}\`);let o=l[0];this.baseplanerot=xs(o,this.rotations);let i=this.baseplanerot.map(D=>o.rotateplane(D));this.baseplanes=i,this.baseFaceCount=i.length;let a=EL()[i.length];this.net=a,this.colors=kL()[i.length],this.options.verbosity>0&&console.log(\`# Base planes: \${i.length}\`);let s=Us(i),f=new W(0,0,0,0);this.options.verbosity>0&&console.log(\`# Face vertices: \${s.length}\`);let u=i[0].makenormal(),g=s[0].sum(s[1]).makenormal(),c=s[0].makenormal(),p=new W(1,u.b,u.c,u.d);this.options.verbosity>0&&console.log(\`# Boundary is \${p}\`);let m=xs(p,this.rotations).map(D=>p.rotateplane(D)),d=Us(m);this.edgedistance=d[0].sum(d[1]).smul(.5).dist(f),this.vertexdistance=d[0].dist(f);let F=[],A=[],S=!1,x=!1,U=!1;for(let D of n){let k=null,T=0;switch(D.cutType){case"f":{k=u,T=1,S=!0;break}case"v":{k=c,T=this.vertexdistance,U=!0;break}case"e":{k=g,T=this.edgedistance,x=!0;break}default:throw new Error(\`Bad cut argument: \${D.cutType}\`)}F.push(k.makecut(D.distance)),A.push(D.distance<T)}this.options.addRotations&&(S||F.push(u.makecut(10)),U||F.push(c.makecut(10)),x||F.push(g.makecut(10))),this.basefaces=[];for(let D of this.baseplanerot){let k=D.rotateface(d);this.basefaces.push(new Sr(k))}let P=[],Z=[],C=[],Q=[],v=d.length;function z(D,k,T){for(let I of D)if(I[0].dist(k)<Ue){I.push(T);return}D.push([k,T])}for(let D=0;D<this.baseplanerot.length;D++){let k=this.baseplanerot[D].rotateface(d);for(let T=0;T<k.length;T++){let I=(T+1)%k.length,ee=k[T].sum(k[I]).smul(.5);z(Q,ee,D)}}let N=[];for(let D=0;D<this.baseplanerot.length;D++){let k=this.baseplanerot[D].rotateface(d),T=[];for(let I=0;I<k.length;I++){let ee=(I+1)%k.length,ae=k[I].sum(k[ee]).smul(.5),Ie=Q[Ri(Q,ae)];if(D===Ie[1])T.push(Ie[2]);else if(D===Ie[2])T.push(Ie[1]);else throw new Error("Could not find edge")}N.push(T)}let b={},E=[];E.push(a[0][0]),b[a[0][0]]=0,E[N[0][0]]=a[0][1],b[a[0][1]]=N[0][0];for(let D of a){let k=D[0],T=b[k];if(T===void 0)throw new Error("Bad edge description; first edge not connected");let I=-1;for(let ee=0;ee<N[T].length;ee++){let ae=E[N[T][ee]];if(ae!==void 0&&ae===D[1]){I=ee;break}}if(I<0)throw new Error("First element of a net not known");for(let ee=2;ee<D.length;ee++){if(D[ee]==="")continue;let ae=N[T][(ee+I-1)%v],Ie=E[ae];if(Ie!==void 0&&Ie!==D[ee])throw new Error("Face mismatch in net");E[ae]=D[ee],b[D[ee]]=ae}}for(let D=0;D<this.baseplanerot.length;D++){let k=this.baseplanerot[D].rotateface(d),T=p.rotateplane(this.baseplanerot[D]),I=E[D];P.push([k,I]),Z.push([T,I])}for(let D=0;D<this.baseplanerot.length;D++){let k=this.baseplanerot[D].rotateface(d),T=E[D];for(let I=0;I<k.length;I++){let ee=(I+1)%k.length,ae=k[I].sum(k[ee]).smul(.5),Ie=(I+2)%k.length,Om=k[ee].sum(k[Ie]).smul(.5),Tm=Ri(Q,ae),Gm=Ri(Q,Om);z(C,k[ee],[T,Gm,Tm])}}this.swizzler=new Zn(P.map(D=>D[1]));let M=this.swizzler.prefixFree?"":"_",j=_L[this.baseFaceCount],q=[];for(let D=0;D<this.baseFaceCount;D++)q[1<<D]=D;{let D=j.v;for(let k of D){let T=this.swizzler.splitByFaceNames(k),I=0;for(let ee of T)I|=1<<ee;q[I]=T[0]}}{let D=j.e;for(let k of D){let T=this.swizzler.splitByFaceNames(k),I=0;for(let ee of T)I|=1<<ee;q[I]=T[0]}}{let D=j.c;for(let k of D){let T=this.swizzler.splitByFaceNames(k),I=1<<T[0]|1<<this.baseFaceCount;q[I]=T[1]}}for(let D=0;D<Q.length;D++){if(Q[D].length!==3)throw new Error(\`Bad length in edge names \${Q[D]}\`);let k=Q[D][1],T=Q[D][2],I=E[k],ee=E[T],ae=1<<k|1<<T;q[ae]===k?I=I+M+ee:I=ee+M+I,Q[D]=[Q[D][0],I]}for(let D=0;D<C.length;D++){let k=0;if(C[D].length<4)throw new Error("Bad length in vertex names");for(let ae=1;ae<C[D].length;ae++)k|=1<<b[C[D][ae][0]];let T=q[k],I=-1;for(let ae=1;ae<C[D].length;ae++)T===b[C[D][ae][0]]&&(I=ae);if(I<0)throw new Error("Internal error; couldn't find face name when fixing corners");let ee="";for(let ae=1;ae<C[D].length;ae++){ae===1?ee=C[D][I][0]:ee=ee+M+C[D][I][0];for(let Ie=1;Ie<C[D].length;Ie++)if(C[D][I][1]===C[D][Ie][2]){I=Ie;break}}C[D]=[C[D][0],ee]}this.markedface=q,this.options.verbosity>1&&(console.log(\`# Face names: \${P.map(D=>D[1]).join(" ")}\`),console.log(\`# Edge names: \${Q.map(D=>D[1]).join(" ")}\`),console.log(\`# Vertex names: \${C.map(D=>D[1]).join(" ")}\`));let ie=[];for(let D of Z)ie.push([D[0].makenormal(),D[1],"f"]);for(let D of Q)ie.push([D[0].makenormal(),D[1],"e"]);for(let D of C)ie.push([D[0].makenormal(),D[1],"v"]);this.facenames=P,this.faceplanes=Z,this.edgenames=Q,this.vertexnames=C,this.geonormals=ie;let he=ie.map(D=>D[1]);this.swizzler.setGripNames(he),this.options.verbosity>0&&console.log(\`# Distances: face \${1} edge \${this.edgedistance} vertex \${this.vertexdistance}\`);for(let D=0;D<F.length;D++)for(let k of this.rotations){let T=F[D].rotateplane(k),I=!1;for(let ee of this.moveplanes)if(T.sameplane(ee)){I=!0;break}I||(this.moveplanes.push(T),A[D]&&this.moveplanes2.push(T))}let xe=new el(d),Je=this.moveplanes2.slice(),Ut=31;for(let D=0;D<Je.length;D++){let k=D+Math.floor((Je.length-D)*(Ut/65536));xe=xe.split(Je[k]),Je[k]=Je[D],Ut=(Ut*1657+101)%65536}let Be=xe.collect([],!0);this.faces=Be,this.options.verbosity>0&&console.log(\`# Faces is now \${Be.length}\`),this.stickersperface=Be.length;let ht=[],ot=mi(d);for(let D of this.rotations){let k=D.rotateface(d);ot.dist(mi(k))<Ue&&ht.push(D)}let pt=new Array(Be.length),ze=[];for(let D=0;D<Be.length;D++){let k=Be[D].centermass();ze.push([ot.dist(k),k,D])}ze.sort((D,k)=>D[0]-k[0]);for(let D=0;D<Be.length;D++){let k=ze[D][2];if(!pt[k]){pt[k]=!0;for(let T of ht){let I=Be[k].rotate(T),ee=I.centermass();for(let ae=D+1;ae<Be.length&&!(ze[ae][0]-ze[D][0]>Ue);ae++){let Ie=ze[ae][2];if(!pt[Ie]&&ee.dist(ze[ae][1])<Ue){pt[Ie]=!0,Be[Ie]=I;break}}}}}this.shortedge=1e99;for(let D of Be)for(let k=0;k<D.length;k++){let T=(k+1)%D.length,I=D.get(k).dist(D.get(T));I<this.shortedge&&(this.shortedge=I)}this.options.verbosity>0&&console.log(\`# Short edge is \${this.shortedge}\`),r==="c"&&S&&!x&&!U&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&U&&!S&&!x&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(U||S)&&!x&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&S&&(this.notationMapper=new Jn(this.swizzler,new Zn(["F","D","L","BL","R","U","BR","B"])),x||U||(this.addNotationMapper="FTOMapper")),r==="d"&&S&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new Jn(this.swizzler,new Zn(["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]))<Ue)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(),u=n[1].sub(n[0]),g=u.len()/s;u=u.normalize();let c=u.b,p=u.c,L=a.smul(c).sub(f.smul(p)).smul(g),m=f.smul(c).sum(a.smul(p)).smul(g),d=new W(0,n[0].b-L.dot(l[r]),n[0].c-m.dot(l[r]),0);return[L,m,d]}allstickers(){let t="allstickers";this.faces=UL(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 v=0;v<this.faces.length;v++)this.facecentermass[v]=this.faces[v].centermass();let r=[],n=[];for(let v of this.moveplanes){let z=v.makenormal(),N=!1;for(let b of n)z.sameplane(b.makenormal())&&(N=!0);N||(n.push(z),r.push([]))}for(let v of this.moveplanes2){let z=v.makenormal();for(let N=0;N<n.length;N++)if(z.sameplane(n[N])){r[N].push(v);break}}for(let v=0;v<r.length;v++){let z=r[v].map(b=>b.normalizeplane()),N=n[v];for(let b=0;b<z.length;b++)z[b].makenormal().dist(N)>Ue&&(z[b]=z[b].smul(-1));z.sort((b,E)=>b.a-E.a),r[v]=z}this.moveplanesets=r,this.moveplanenormals=n;let l=r.map(v=>v.length);this.options.verbosity>0&&console.log(\`# Move plane sets: \${l}\`);let o=[];for(let v=0;v<r.length;v++)o.push([]);for(let v of this.rotations){if(Math.abs(Math.abs(v.a)-1)<Ue)continue;let z=v.makenormal();for(let N=0;N<r.length;N++)if(z.sameplane(n[N])){o[N].push(v);break}}this.moverotations=o;for(let v=0;v<o.length;v++){let z=o[v],N=z[0].makenormal();for(let b=0;b<z.length;b++)N.dist(z[b].makenormal())>Ue&&(z[b]=z[b].smul(-1));z.sort((b,E)=>b.angle()-E.angle()),o[v][0].dot(n[v])<0&&z.reverse()}let i=o.map(v=>1+v.length);this.movesetorders=i;let a=[],s="?";for(let v=0;v<r.length;v++){let z=n[v],N=null,b=null;for(let E of this.geonormals){let M=z.dot(E[0]);Math.abs(M-1)<Ue?(b=[E[1],E[2]],s=E[2]):Math.abs(M+1)<Ue&&(N=[E[1],E[2]],s=E[2])}if(b===null||N===null)throw new Error("Saw positive or negative sides as null");a.push([b[0],b[1],N[0],N[1],1+r[v].length]),this.addNotationMapper==="NxNxNCubeMapper"&&s==="f"&&(this.notationMapper=new lo(1+r[v].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new io(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 Yn(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new oo(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&s==="f"&&(1+r[v].length===3&&(this.notationMapper=new no(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&s==="f"&&(1+r[v].length===3&&(this.notationMapper=new ro(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=a;let f=new Map,u=this.faces;for(let v=0;v<u.length;v++){let z=u[v],N=this.keyface(z);if(!f.get(N))f.set(N,[v]);else{let b=f.get(N);if(b.push(v),b.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let E=0;E<b.length;E++){let M=\`\${N} \${E}\`;f.set(M,[b[E]])}}}}this.facelisthash=f,this.options.verbosity>0&&console.log(\`# Cubies: \${f.size}\`);let g=[],c=[],p=[];for(let v of f.values())if(v.length!==this.baseFaceCount){if(v.length>1){let z=v.map(j=>u[j].centermass()),N=mi(z);for(let j=0;v.length>2;j++){let q=!1;for(let ie=0;ie<v.length;ie++){let he=(ie+1)%v.length;if(N.dot(z[ie].cross(z[he]))<0){let xe=z[ie];z[ie]=z[he],z[he]=xe;let Je=v[ie];v[ie]=v[he],v[he]=Je,q=!0}}if(!q)break;if(j>1e3)throw new Error("Bad epsilon math; too close to border")}let b=0;for(let j of v)b|=1<<Math.floor(j/this.stickersperface);let E=this.markedface[b],M=-1;for(let j=0;j<v.length;j++)Math.floor(v[j]/this.stickersperface)===E&&(M=j);if(M<0)throw new Error("Could not find marked face in list");if(M!==0){let j=v.slice();for(let q=0;q<v.length;q++)v[q]=j[(M+q)%v.length]}}for(let z=0;z<v.length;z++){let N=v[z];c[N]=g.length,p[N]=z}g.push(v)}this.cubies=g,this.facetocubie=c,this.facetoord=p;let L=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],m=[],d=[0,0,0,0,0,0],F=[],A=[],S=0,x=[],U=[],P=[],Z=[],C=v=>g[v].map(z=>this.getfaceindex(z)).join(" "),Q=[];for(let v=0;v<g.length;v++){let z=g[v];if(z.length===0||A[v])continue;let N={},b=0;P.push(0),Q.push([]);let E=z.length,M=d[E]++,j=L[E];(j===void 0||E===this.baseFaceCount)&&(j="CORE"),j=j+(M===0?"":M+1),m[S]=j,F[S]=E;let q=[v],ie=0;for(A[v]=!0;ie<q.length;){let he=q[ie++],xe=C(he);if((z.length>1||N[xe]===void 0)&&(N[xe]=b++),Z[he]=N[xe],x[he]=S,Q[S].push(he),U[he]=P[S]++,q.length<this.rotations.length){let Je=this.facecentermass[g[he][0]];for(let Ut of o){let Be=this.facetocubie[this.findface(Je.rotatepoint(Ut[0]))];A[Be]||(q.push(Be),A[Be]=!0)}}}S++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let v=[["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"]],z={};for(let N of v)for(let b=0;b<N.length;b++){let E=0;for(let M=0;M<N[b].length;M++)E|=1<<N[b].charCodeAt(M)-65;z[E]=b}for(let N of Q)for(let b of N){let E=0;for(let M of g[b])E|=1<<this.facenames[this.getfaceindex(M)][1].charCodeAt(0)-65;U[b]=z[E]}}if(this.cubiesetnums=x,this.cubieordnums=U,this.cubiesetnames=m,this.cubieords=P,this.orbitoris=F,this.cubievaluemap=Z,this.cubiesetcubies=Q,this.options.fixedPieceType!==null){for(let v=0;v<g.length;v++)if(this.options.fixedPieceType==="v"&&g[v].length>2||this.options.fixedPieceType==="e"&&g[v].length===2||this.options.fixedPieceType==="f"&&g[v].length===1){this.fixedCubie=v;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 \${P}\`)}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 _(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 g=0;g<this.movesetgeos.length;g++){let c=this.movesetgeos[g];a===c[0]&&(s=!0,o=c,i=g),a===c[2]&&(s=!1,o=c,i=g)}let f=1,u=1;if(n.toUpperCase()!==n&&(u=2),o===void 0)throw new Error(\`Bad grip in move \${t.family}\`);if(t.outerLayer!==void 0&&(f=t.outerLayer),t.innerLayer!==void 0&&(t.outerLayer===void 0?(u=t.innerLayer,n<="Z"?f=u:f=1):u=t.innerLayer),f--,u--,l&&(f=0,u=this.moveplanesets[i].length),f<0||f>this.moveplanesets[i].length||u<0||u>this.moveplanesets[i].length)throw new Error(\`Bad slice spec \${f} \${u} vs \${this.moveplanesets[i].length}\`);if(!wL&&f===0&&u===this.moveplanesets[i].length&&!l)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,f,u,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),i=this.basefaces[o].centermass();if(i.dist(this.facecentermass[l])<Ue){let a=1<<o|1<<this.baseFaceCount,s=this.markedface[a],f=this.baseplanes[s].makenormal(),u=-1,g=-1;for(let L=0;L<this.faces[l].length;L++){let m=this.faces[l].get(L),d=f.dot(m.sub(i));d>u&&(u=d,g=L)}let c=(g+1)%this.faces[l].length;if(Math.abs(f.dot(this.faces[l].get(c).sub(i))-u)<Ue&&(g=c),g!==0){let L=[];for(let m=0;m<this.faces[l].length;m++)L.push(this.faces[l].get((m+g)%this.faces[l].length));this.faces[l]=new Sr(L)}let p=this.basefaces[o].length;for(let L=1;L<p;L++)this.cubies[n].push(this.cubies[n][L-1]);this.duplicatedFaces[l]=p,this.duplicatedCubies[n]=p,this.orbitoris[this.cubiesetnums[n]]=p}}}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 u=0;u<this.faces.length;u++){let g=0;if(l.length>0){let c=this.facecentermass[u].dot(l[0]);for(let p=a;p>0;p>>=1)g+p<=l.length&&c>l[g+p-1].a&&(g+=p);g=l.length-g}for(o.push(g);i.length<=g;)i.push(0);i[g]++}let s=new Array(i.length);for(let u=0;u<i.length;u++)s[u]=[];let f=[];for(let u=0;u<this.faces.length;u++){if(o[u]<0)continue;let g=[this.facetocubie[u],this.facetoord[u]],c=this.facecentermass[u],p=c,L=u,m=o[L];for(;;){o[L]=-1;let d=c.rotatepoint(this.moverotations[n][0]);if(d.dist(p)<Ue)break;L=this.findface(d),g.push(this.facetocubie[L],this.facetoord[L]),c=d}if(g.length>2&&this.options.orientCenters&&(this.cubies[g[0]].length===1||this.duplicatedCubies[g[0]]>1)&&this.facecentermass[u].dist(this.basefaces[this.getfaceindex(u)].centermass())<Ue){let d=this.faces[this.cubies[g[0]][0]];for(let F=0;F<g.length;F+=2){let A=this.faces[this.cubies[g[F]][0]],S=-1;for(let x=0;x<d.length;x++)if(A.get(x).dist(d.get(0))<Ue){S=x;break}if(S<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");g[F+1]=S,d=d.rotate(this.moverotations[n][0])}}if(g.length===2&&this.options.orientCenters)for(let d=1;d<this.movesetorders[n];d++)m===0?g.push(g[0],d):g.push(g[0],(this.movesetorders[n]-d)%this.movesetorders[n]);if(g.length>2&&!f[g[0]]){if(g.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let d of g)s[m].push(d)}for(let d=0;d<g.length;d+=2)f[g[d]]=!0}for(let u=0;u<s.length;u++)s[u]=s[u].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+bL+\`
|
|
2
|
+
var workerSource = `"use strict";var Mm=Object.defineProperty;var y=(e,t)=>()=>(e&&(t=e(e=0)),t);var mt=(e,t)=>{for(var r in t)Mm(e,r,{get:t[r],enumerable:!0})};var Ga=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var R=(e,t,r)=>(Ga(e,t,"read from private field"),r?r.call(e):t.get(e)),J=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},V=(e,t,r,n)=>(Ga(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Wa=(e,t,r,n)=>({set _(l){V(e,t,l,r)},get _(){return R(e,t,n)}}),$t=(e,t,r)=>(Ga(e,t,"access private method"),r);var $m,Wl,Oe,er=y(()=>{"use strict";$m=!1,Wl=class{is(t){return this instanceof t}as(t){return this instanceof t?this:null}},Oe=class extends Wl{constructor(){super(),$m&&Object.defineProperty(this,"_debugStr",{get:()=>this.toString()})}get log(){return console.log.bind(console,this,this.toString())}}});function q2(e,t=!0){if(!t)return e;switch(e){case 1:return-1;case-1:return 1}}function V2(e,t){return t===-1?Array.from(e).reverse():e}function H2(e){return Array.from(e).reverse()}var Gt=y(()=>{"use strict"});var Kl,qa=y(()=>{"use strict";Kl="2^31 - 1"});var Zr,Lt,Va=y(()=>{"use strict";Wt();Lt=class{constructor(){J(this,Zr,[])}push(t){R(this,Zr).push(t)}experimentalPushAlg(t){for(let r of t.childAlgNodes())this.push(r)}experimentalNumAlgNodes(){return R(this,Zr).length}toAlg(){return new w(R(this,Zr))}reset(){V(this,Zr,[])}};Zr=new WeakMap});var X2,Ha=y(()=>{"use strict";X2={caratNISSNotationEnabled:!1}});var Jr,Yr,Jo,Ce,Mn=y(()=>{"use strict";Wt();er();Gt();Jo=class extends Oe{constructor(r,n){super();J(this,Jr,void 0);J(this,Yr,void 0);V(this,Jr,hr(r)),V(this,Yr,hr(n))}get A(){return R(this,Jr)}get B(){return R(this,Yr)}isIdentical(r){let n=r.as(Jo);return!!(n?.A.isIdentical(this.A)&&n?.B.isIdentical(this.B))}invert(){return new Jo(R(this,Yr),R(this,Jr))}*experimentalExpand(r=1,n){n??(n=1/0),n===0?yield r===1?this:this.invert():r===1?(yield*this.A.experimentalExpand(1,n-1),yield*this.B.experimentalExpand(1,n-1),yield*this.A.experimentalExpand(-1,n-1),yield*this.B.experimentalExpand(-1,n-1)):(yield*this.B.experimentalExpand(1,n-1),yield*this.A.experimentalExpand(1,n-1),yield*this.B.experimentalExpand(-1,n-1),yield*this.A.experimentalExpand(-1,n-1))}toString(){return\`[\${R(this,Jr).toString()}, \${R(this,Yr).toString()}]\`}},Ce=Jo;Jr=new WeakMap,Yr=new WeakMap});var In,On,Yo,Ne,Tn=y(()=>{"use strict";Wt();er();Gt();Yo=class extends Oe{constructor(r,n){super();J(this,In,void 0);J(this,On,void 0);V(this,In,hr(r)),V(this,On,hr(n))}get A(){return R(this,In)}get B(){return R(this,On)}isIdentical(r){let n=r.as(Yo);return!!(n?.A.isIdentical(this.A)&&n?.B.isIdentical(this.B))}invert(){return new Yo(R(this,In),R(this,On).invert())}*experimentalExpand(r,n){n??(n=1/0),n===0?yield r===1?this:this.invert():(yield*this.A.experimentalExpand(1,n-1),yield*this.B.experimentalExpand(r,n-1),yield*this.A.experimentalExpand(-1,n-1))}toString(){return\`[\${this.A}: \${this.B}]\`}},Ne=Yo;In=new WeakMap,On=new WeakMap});var Fr,Xa,Ft,Ql=y(()=>{"use strict";er();Gt();Xa=class extends Oe{constructor(r){super();J(this,Fr,void 0);if(r.includes(\`
|
|
3
|
+
\`)||r.includes("\\r"))throw new Error("LineComment cannot contain newline");V(this,Fr,r)}get text(){return R(this,Fr)}isIdentical(r){let n=r;return r.is(Xa)&&R(this,Fr)===R(n,Fr)}invert(){return this}*experimentalExpand(r=1,n=1/0){yield this}toString(){return\`//\${R(this,Fr)}\`}},Ft=Xa;Fr=new WeakMap});var Ye,jl=y(()=>{"use strict";er();Gt();Ye=class extends Oe{toString(){return\`
|
|
4
|
+
\`}isIdentical(t){return t.is(Ye)}invert(){return this}*experimentalExpand(t=1,r=1/0){yield this}}});var De,Gn=y(()=>{"use strict";er();Gt();De=class extends Oe{toString(){return"."}isIdentical(r){return r.is(De)}invert(){return this}*experimentalExpand(r=1,n=1/0){yield this}}});function $o(e,t){return e?parseInt(e):t}function Za(e){return new ql().parseAlg(e)}function J2(e){return new ql().parseMove(e)}function Y2(e){return new ql().parseQuantumMove(e)}function $e(e,t,r){let n=e;return n.startCharIndex=t,n.endCharIndex=r,n}function $2(e,t){return"startCharIndex"in e&&(t.startCharIndex=e.startCharIndex),"endCharIndex"in e&&(t.endCharIndex=e.endCharIndex),t}var Z2,eL,tL,rL,nL,lL,it,G,Wn,ql,Ja=y(()=>{"use strict";Wt();Va();Ha();Mn();Tn();Vl();Ql();Kt();jl();Gn();Z2=/^(\\d+)?('?)/,eL=/^[_\\dA-Za-z]/,tL=/^((([1-9]\\d*)-)?([1-9]\\d*))?([_A-Za-z]+)?/,rL=/^[^\\n]*/,nL=/^(-?\\d+), ?/,lL=/^(-?\\d+)\\)/;ql=class{constructor(){J(this,it,"");J(this,G,0);J(this,Wn,[])}parseAlg(t){V(this,it,t),V(this,G,0);let r=this.parseAlgWithStopping([]);this.mustBeAtEndOfInput();let n=Array.from(r.childAlgNodes());if(R(this,Wn).length>0)for(let a of R(this,Wn).reverse())n.push(a);let l=new w(n),{startCharIndex:o,endCharIndex:i}=r;return $e(l,o,i),l}parseMove(t){V(this,it,t),V(this,G,0);let r=this.parseMoveImpl();return this.mustBeAtEndOfInput(),r}parseQuantumMove(t){V(this,it,t),V(this,G,0);let r=this.parseQuantumMoveImpl();return this.mustBeAtEndOfInput(),r}mustBeAtEndOfInput(){if(R(this,G)!==R(this,it).length)throw new Error("parsing unexpectedly ended early")}parseAlgWithStopping(t){let r=R(this,G),n=R(this,G),l=new Lt,o=!1,i=a=>{if(o)throw new Error(\`Unexpected character at index \${a}. Are you missing a space?\`)};e:for(;R(this,G)<R(this,it).length;){let a=R(this,G);if(t.includes(R(this,it)[R(this,G)]))return $e(l.toAlg(),r,n);if(this.tryConsumeNext(" ")){o=!1,l.experimentalNumAlgNodes()===0&&(r=R(this,G));continue e}else if(eL.test(R(this,it)[R(this,G)])){i(a);let s=this.parseMoveImpl();l.push(s),o=!0,n=R(this,G);continue e}else if(this.tryConsumeNext("(")){i(a);let s=this.tryRegex(nL);if(s){let f=s[1],u=R(this,G),g=this.parseRegex(lL),c=$e(new B(new _("U_SQ_"),parseInt(f)),a+1,a+1+f.length),p=$e(new B(new _("D_SQ_"),parseInt(g[1])),u,R(this,G)-1),L=$e(new w([c,p]),a+1,R(this,G)-1);l.push($e(new Pe(L),a,R(this,G))),o=!0,n=R(this,G);continue e}else{let f=this.parseAlgWithStopping([")"]);this.mustConsumeNext(")");let u=this.parseAmount();l.push($e(new Pe(f,u),a,R(this,G))),o=!0,n=R(this,G);continue e}}else if(this.tryConsumeNext("^")){if(!X2.caratNISSNotationEnabled)throw new Error("Alg contained a carat but carat NISS notation is not enabled.");this.mustConsumeNext("(");let s=this.parseAlgWithStopping([")"]);this.popNext();let f=new Pe(s,-1),u=new De;f.experimentalNISSPlaceholder=u,u.experimentalNISSGrouping=f,R(this,Wn).push(f),l.push(u)}else if(this.tryConsumeNext("[")){i(a);let s=this.parseAlgWithStopping([",",":"]),f=this.popNext(),u=this.parseAlgWithStopping(["]"]);switch(this.mustConsumeNext("]"),f){case":":{l.push($e(new Ne(s,u),a,R(this,G))),o=!0,n=R(this,G);continue e}case",":{l.push($e(new Ce(s,u),a,R(this,G))),o=!0,n=R(this,G);continue e}default:throw new Error("unexpected parsing error")}}else if(this.tryConsumeNext(\`
|
|
5
|
+
\`)){l.push($e(new Ye,a,R(this,G))),o=!1,n=R(this,G);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){i(a);let[s]=this.parseRegex(rL);l.push($e(new Ft(s),a,R(this,G))),o=!1,n=R(this,G);continue e}else{l.push($e(new B("_SLASH_"),a,R(this,G))),o=!0,n=R(this,G);continue e}else if(this.tryConsumeNext(".")){i(a),l.push($e(new De,a,R(this,G))),o=!0,n=R(this,G);continue e}else throw new Error(\`Unexpected character: \${this.popNext()}\`)}if(R(this,G)!==R(this,it).length)throw new Error("did not finish parsing?");if(t.length>0)throw new Error("expected stopping");return $e(l.toAlg(),r,n)}parseQuantumMoveImpl(){let[,,,t,r,n]=this.parseRegex(tL);return new _(n,$o(r,void 0),$o(t,void 0))}parseMoveImpl(){let t=R(this,G);if(this.tryConsumeNext("/"))return $e(new B("_SLASH_"),t,R(this,G));let r=this.parseQuantumMoveImpl(),[n,l]=this.parseAmountAndTrackEmptyAbsAmount(),o=this.parseMoveSuffix();if(o){if(n<0)throw new Error("uh-oh");if((o==="++"||o==="--")&&n!==1)throw new Error("Pochmann ++ or -- moves cannot have an amount other than 1.");if((o==="++"||o==="--")&&!l)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((o==="+"||o==="-")&&l)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");o.startsWith("+")&&(r=r.modified({family:\`\${r.family}_\${o==="+"?"PLUS":"PLUSPLUS"}_\`})),o.startsWith("-")&&(r=r.modified({family:\`\${r.family}_\${o==="-"?"PLUS":"PLUSPLUS"}_\`}),n*=-1)}return $e(new B(r,n),t,R(this,G))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let t=R(this,G),[,r,n]=this.parseRegex(Z2);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[$o(r,1)*(n==="'"?-1:1),!r]}parseAmount(){let t=R(this,G),[,r,n]=this.parseRegex(Z2);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 $o(r,1)*(n==="'"?-1:1)}parseRegex(t){let r=t.exec(this.remaining());if(r===null)throw new Error("internal parsing error");return V(this,G,R(this,G)+r[0].length),r}tryRegex(t){let r=t.exec(this.remaining());return r===null?null:(V(this,G,R(this,G)+r[0].length),r)}remaining(){return R(this,it).slice(R(this,G))}popNext(){let t=R(this,it)[R(this,G)];return Wa(this,G)._++,t}tryConsumeNext(t){return R(this,it)[R(this,G)]===t?(Wa(this,G)._++,!0):!1}mustConsumeNext(t){let r=this.popNext();if(r!==t)throw new Error(\`expected \\\`\${t}\\\` while parsing, encountered \${r}\`);return r}};it=new WeakMap,G=new WeakMap,Wn=new WeakMap});function ei(e){ef.has(e)||(console.warn(e),ef.add(e))}var ef,Ya=y(()=>{"use strict";ef=new Set});var en,$a=y(()=>{"use strict";Gt();qa();en=class{constructor(t,r=1){if(this.quantum=t,this.amount=r,!Number.isInteger(this.amount)||this.amount<-2147483648||this.amount>2147483647)throw new Error(\`AlgNode amount absolute value must be a non-negative integer below \${Kl}.\`)}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=q2(t,this.amount<0);for(let o=0;o<n;o++)yield*this.quantum.experimentalExpand(l,r)}}});var tr,qe,Ve,ri,_,Te,Kn,B,Kt=y(()=>{"use strict";er();Gt();qa();Ja();Ya();$a();ri=class extends Wl{constructor(r,n,l){super();J(this,tr,void 0);J(this,qe,void 0);J(this,Ve,void 0);if(V(this,tr,r),V(this,qe,n??null),V(this,Ve,l??null),Object.freeze(this),R(this,qe)!==null&&(!Number.isInteger(R(this,qe))||R(this,qe)<1||R(this,qe)>2147483647))throw new Error(\`QuantumMove inner layer must be a positive integer below \${Kl}.\`);if(R(this,Ve)!==null&&(!Number.isInteger(R(this,Ve))||R(this,Ve)<1||R(this,Ve)>2147483647))throw new Error(\`QuantumMove outer layer must be a positive integer below \${Kl}.\`);if(R(this,Ve)!==null&&R(this,qe)!==null&&R(this,qe)<=R(this,Ve))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(R(this,Ve)!==null&&R(this,qe)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(r){return Y2(r)}modified(r){return new ri(r.family??R(this,tr),r.innerLayer??R(this,qe),r.outerLayer??R(this,Ve))}isIdentical(r){let n=r;return r.is(ri)&&R(this,tr)===R(n,tr)&&R(this,qe)===R(n,qe)&&R(this,Ve)===R(n,Ve)}get family(){return R(this,tr)}get outerLayer(){return R(this,Ve)}get innerLayer(){return R(this,qe)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a \`QuantumMove\` directly.")}toString(){let r=R(this,tr);return R(this,qe)!==null&&(r=String(R(this,qe))+r,R(this,Ve)!==null&&(r=\`\${String(R(this,Ve))}-\${r}\`)),r}},_=ri;tr=new WeakMap,qe=new WeakMap,Ve=new WeakMap;Kn=class extends Oe{constructor(...r){super();J(this,Te,void 0);if(typeof r[0]=="string")if(r[1]??null){V(this,Te,new en(_.fromString(r[0]),r[1]));return}else return Kn.fromString(r[0]);V(this,Te,new en(r[0],r[1]))}isIdentical(r){let n=r.as(Kn);return!!n&&R(this,Te).isIdentical(R(n,Te))}invert(){return $2(this,new Kn(R(this,Te).quantum,-this.amount))}*experimentalExpand(r=1){r===1?yield this:yield this.modified({amount:-this.amount})}get quantum(){return R(this,Te).quantum}modified(r){return new Kn(R(this,Te).quantum.modified(r),r.amount??this.amount)}static fromString(r){return J2(r)}get amount(){return R(this,Te).amount}get type(){return ei("deprecated: type"),"blockMove"}get family(){return R(this,Te).quantum.family??void 0}get outerLayer(){return R(this,Te).quantum.outerLayer??void 0}get innerLayer(){return R(this,Te).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return R(this,Te).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let r=Math.abs(this.amount);return R(this,Te).quantum.toString().slice(0,-10)+(r===1?"":r)+(this.amount<0?"--":"++")}return R(this,Te).quantum.toString()+R(this,Te).suffix()}},B=Kn;Te=new WeakMap});var es,tf,at,ni,Pe,Vl=y(()=>{"use strict";Wt();er();Gt();Kt();$a();es=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 _("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new _("D_SQ_"));let r=t.alg;if(r.experimentalNumChildAlgNodes()===2){let[n,l]=r.childAlgNodes();if(n.as(B)?.quantum.isIdentical(this.quantumU_SQ_)&&l.as(B)?.quantum.isIdentical(this.quantumD_SQ_)){if(t.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[n,l]}}return null}},tf=new es,ni=class extends Oe{constructor(r,n){super();J(this,at,void 0);let l=hr(r);V(this,at,new en(l,n))}isIdentical(r){let n=r;return r.is(ni)&&R(this,at).isIdentical(R(n,at))}get alg(){return R(this,at).quantum}get amount(){return R(this,at).amount}get experimentalRepetitionSuffix(){return R(this,at).suffix()}invert(){return new ni(R(this,at).quantum,-R(this,at).amount)}*experimentalExpand(r=1,n){n??(n=1/0),n===0?yield r===1?this:this.invert():yield*R(this,at).experimentalExpand(r,n-1)}static fromString(){throw new Error("unimplemented")}toString(){return tf.format(this)??\`(\${R(this,at).quantum.toString()})\${R(this,at).suffix()}\`}experimentalAsSquare1Tuple(){return tf.tuple(this)}},Pe=ni;at=new WeakMap});var Qn=y(()=>{"use strict";Vl();Ql();Mn();Tn();Kt();jl();Gn()});function bt(e,t){return e instanceof t}function rf(e){return bt(e,Pe)||bt(e,Ft)||bt(e,Ce)||bt(e,Ne)||bt(e,B)||bt(e,Ye)||bt(e,De)}var ts=y(()=>{"use strict";Qn()});function nf(e,t,r){if(t.is(Pe))return e.traverseGrouping(t,r);if(t.is(B))return e.traverseMove(t,r);if(t.is(Ce))return e.traverseCommutator(t,r);if(t.is(Ne))return e.traverseConjugate(t,r);if(t.is(De))return e.traversePause(t,r);if(t.is(Ye))return e.traverseNewline(t,r);if(t.is(Ft))return e.traverseLineComment(t,r);throw new Error("unknown AlgNode")}function lf(e){if(e.is(Pe)||e.is(B)||e.is(Ce)||e.is(Ne)||e.is(De)||e.is(Ye)||e.is(Ft))return e;throw new Error("internal error: expected AlgNode")}function wt(e,t){let r=new e(...t??[]);return r.traverseAlg.bind(r)}var Dr,tn,rs=y(()=>{"use strict";Mn();Tn();Vl();Ql();Kt();jl();Gn();Dr=class{traverseAlgNode(t,r){return nf(this,t,r)}traverseIntoAlgNode(t,r){return lf(this.traverseAlgNode(t,r))}},tn=class extends Dr{traverseAlgNode(t){return nf(this,t,void 0)}traverseIntoAlgNode(t){return lf(this.traverseAlgNode(t))}}});var iL,jn,ns=y(()=>{"use strict";iL="any-direction",jn=class{constructor(t={}){this.config=t}cancelQuantum(){let{cancel:t}=this.config;return t===!0?iL:t===!1?"none":t?.directional??"none"}cancelAny(){return this.config.cancel&&this.cancelQuantum()!=="none"}cancelPuzzleSpecificModWrap(){let{cancel:t}=this.config;return t===!0||t===!1?"canonical-centered":t?.puzzleSpecificModWrap?t?.puzzleSpecificModWrap:t?.directional==="same-direction"?"preserve-sign":"canonical-centered"}puzzleSpecificSimplifyOptions(){return this.config.puzzleLoader?.puzzleSpecificSimplifyOptions??this.config.puzzleSpecificSimplifyOptions}}});function aL(e,t){return e*Math.sign(t.amount)>=0}function sL(e,t,r){return((e-r)%t+t)%t+r}function ls(e,t,r){let n=new jn(r),l=Array.from(e.childAlgNodes()),o=[t];function i(){return new w([...l,...o])}function a(s){if(n.cancelPuzzleSpecificModWrap()==="none")return s;let f=n.puzzleSpecificSimplifyOptions()?.quantumMoveOrder;if(!f)return s;let u=f(t.quantum),g;switch(n.cancelPuzzleSpecificModWrap()){case"gravity":{g=-Math.floor((u-(s.amount<0?0:1))/2);break}case"canonical-centered":{g=-Math.floor((u-1)/2);break}case"canonical-positive":{g=0;break}case"preserve-sign":{g=s.amount<0?1-u:0;break}default:throw new Error("Unknown mod wrap")}let c=sL(s.amount,u,g);return s.modified({amount:c})}if(n.cancelAny()){let s,f=n.puzzleSpecificSimplifyOptions()?.axis;if(f)s=L=>f.areQuantumMovesSameAxis(t.quantum,L.quantum);else{let L=t.quantum.toString();s=m=>m.quantum.toString()===L}let u=n.cancelQuantum()==="same-direction",g=new Map;g.set(t.quantum.toString(),Math.sign(t.amount));let c;for(c=l.length-1;c>=0;c--){let L=l[c].as(B);if(!L||!s(L))break;let m=L.quantum.toString();if(u){let d=g.get(m);if(d&&!aL(d,L))break;g.set(m,Math.sign(L.amount))}}let p=[...l.splice(c+1),t];if(f)o=f.simplifySameAxisMoves(p,n.cancelPuzzleSpecificModWrap()!=="none");else{let L=p.reduce((m,d)=>m+d.amount,0);if(g.size!==1)throw new Error("Internal error: multiple quantums when one was expected");o=[new B(t.quantum,L)]}}return o=o.map(s=>a(s)).filter(s=>s.amount!==0),i()}function os(e,t,r){let n=t.as(B);return n?ls(e,n,r):new w([...e.childAlgNodes(),t])}var is=y(()=>{"use strict";Wt();Kt();ns()});var li,Xl,ss,rn,Hl,Zl,fs,as,us,of=y(()=>{"use strict";Wt();Mn();Tn();Vl();Kt();Gn();rs();is();ns();as=class extends Dr{constructor(){super(...arguments);J(this,Xl);J(this,rn);J(this,Zl);J(this,li,void 0)}*traverseAlg(r,n){if(n.depth===0){yield*r.childAlgNodes();return}let l=[],o=$t(this,rn,Hl).call(this,n);for(let i of r.childAlgNodes())for(let a of this.traverseAlgNode(i,o))l=Array.from(os(new w(l),a,o).childAlgNodes());for(let i of l)yield i}*traverseGrouping(r,n){if(n.depth===0){yield r;return}if(r.amount===0)return;let l=new Pe(this.traverseAlg(r.alg,$t(this,rn,Hl).call(this,n)),r.amount);if(l.alg.experimentalIsEmpty())return;let o=$t(this,Xl,ss).call(this).get(r);o&&(l.experimentalNISSPlaceholder=o,o.experimentalNISSGrouping=l),yield l}*traverseMove(r,n){yield r}*traverseCommutator(r,n){if(n.depth===0){yield r;return}let l=$t(this,rn,Hl).call(this,n),o=new Ce(this.traverseAlg(r.A,l),this.traverseAlg(r.B,l));o.A.experimentalIsEmpty()||o.B.experimentalIsEmpty()||o.A.isIdentical(o.B)||o.A.isIdentical(o.B.invert())||$t(this,Zl,fs).call(this,o.A,o.B,n)||(yield o)}*traverseConjugate(r,n){if(n.depth===0){yield r;return}let l=$t(this,rn,Hl).call(this,n),o=new Ne(this.traverseAlg(r.A,l),this.traverseAlg(r.B,l));if(!o.B.experimentalIsEmpty()){if(o.A.experimentalIsEmpty()||o.A.isIdentical(o.B)||o.A.isIdentical(o.B.invert())||$t(this,Zl,fs).call(this,o.A,o.B,n)){yield*r.B.childAlgNodes();return}yield o}}*traversePause(r,n){if(r.experimentalNISSGrouping){let l=new De;$t(this,Xl,ss).call(this).set(r.experimentalNISSGrouping,l),yield l}else yield r}*traverseNewline(r,n){yield r}*traverseLineComment(r,n){yield r}};li=new WeakMap,Xl=new WeakSet,ss=function(){return R(this,li)??V(this,li,new Map)},rn=new WeakSet,Hl=function(r){return{...r,depth:r.depth?r.depth-1:null}},Zl=new WeakSet,fs=function(r,n,l){if(r.experimentalNumChildAlgNodes()===1&&n.experimentalNumChildAlgNodes()===1){let o=Array.from(r.childAlgNodes())[0]?.as(B),i=Array.from(n.childAlgNodes())[0]?.as(B);if(!(o&&i))return!1;if(i.quantum.isIdentical(o.quantum)||new jn(l).puzzleSpecificSimplifyOptions()?.axis?.areQuantumMovesSameAxis(o.quantum,i.quantum))return!0}return!1};us=wt(as)});var gs=y(()=>{"use strict";of();is()});function af(e){if(!e)return[];if(bt(e,w))return e.childAlgNodes();if(typeof e=="string")return Za(e).childAlgNodes();let t=e;if(typeof t[Symbol.iterator]=="function")return t;throw new Error("Invalid AlgNode")}function hr(e){return bt(e,w)?e:new w(e)}function fL(e,t){return e.is(Ye)||t.is(Ye)||t.as(Pe)?.experimentalNISSPlaceholder?"":e.is(Ft)&&!t.is(Ye)?\`
|
|
6
|
+
\`:" "}var st,nn,w,Wt=y(()=>{"use strict";er();ts();Gt();Ja();gs();Qn();Ql();Kt();jl();Ya();nn=class extends Oe{constructor(r){super();J(this,st,void 0);V(this,st,Array.from(af(r)));for(let n of R(this,st))if(!rf(n))throw new Error("An alg can only contain alg nodes.")}isIdentical(r){let n=r;if(!r.is(nn))return!1;let l=Array.from(R(this,st)),o=Array.from(R(n,st));if(l.length!==o.length)return!1;for(let i=0;i<l.length;i++)if(!l[i].isIdentical(o[i]))return!1;return!0}invert(){return new nn(H2(Array.from(R(this,st)).map(r=>r.invert())))}*experimentalExpand(r=1,n){n??(n=1/0);for(let l of V2(R(this,st),r))yield*l.experimentalExpand(r,n)}expand(r){return new nn(this.experimentalExpand(1,r?.depth??1/0))}*experimentalLeafMoves(){for(let r of this.experimentalExpand())r.is(B)&&(yield r)}concat(r){return new nn(Array.from(R(this,st)).concat(Array.from(af(r))))}experimentalIsEmpty(){for(let r of R(this,st))return!1;return!0}static fromString(r){return Za(r)}units(){return this.childAlgNodes()}*childAlgNodes(){for(let r of R(this,st))yield r}experimentalNumUnits(){return this.experimentalNumChildAlgNodes()}experimentalNumChildAlgNodes(){return Array.from(R(this,st)).length}get type(){return ei("deprecated: type"),"sequence"}toString(){let r="",n=null;for(let l of R(this,st)){n&&(r+=fL(n,l));let o=l.as(De)?.experimentalNISSGrouping;if(o){if(o.amount!==-1)throw new Error("Invalid NISS Grouping amount!");r+=\`^(\${o.alg.toString()})\`}else l.as(Pe)?.experimentalNISSPlaceholder||(r+=l.toString());n=l}return r}experimentalSimplify(r){return new nn(us(this,r??{}))}simplify(r){return this.experimentalSimplify(r)}},w=nn;st=new WeakMap});var uL,sf=y(()=>{"use strict";Wt();Qn();Mn();Tn();Kt();Gn();uL={Sune:new w([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 w([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 w([new Ce(new w([new B("R",1),new B("U",1),new B("R",-2)]),new w([new Ne(new w([new B("R",1)]),new w([new B("U",1)]))]))]),Niklas:new w([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 w([new B("x",-1),new Ce(new w([new Ne(new w([new B("R",1)]),new w([new B("U",-1)]))]),new w([new B("D",1)])),new Ce(new w([new Ne(new w([new B("R",1)]),new w([new B("U",1)]))]),new w([new B("D",1)])),new B("x",1)]),FURURFCompact:new w([new Ne(new w([new B("F",1)]),new w([new Ce(new w([new B("U",1)]),new w([new B("R",1)]))]))]),APermCompact:new w([new Ne(new w([new B("R",2)]),new w([new Ce(new w([new B("F",2)]),new w([new B("R",-1),new B("B",-1),new B("R",1)]))]))]),FURURFMoves:new w([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 w([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 w([new Ne(new w([new B("F",1)]),new w([new Pe(new w([new Ce(new w([new B("R",1)]),new w([new B("U",1)]))]),3)]))]),TriplePause:new w([new De,new De,new De])}});var Ly,ff=y(()=>{"use strict";Qn();Kt();Ly={73:new B("R"),75:new B("R'"),87:new B("B"),79:new B("B'"),83:new B("D"),76:new B("D'"),68:new B("L"),69:new B("L'"),74:new B("U"),70:new B("U'"),72:new B("F"),71:new B("F'"),78:new B("x'"),67:new B("l"),82:new B("l'"),85:new B("r"),77:new B("r'"),88:new B("d"),188:new B("d'"),84:new B("x"),89:new B("x"),66:new B("x'"),186:new B("y"),59:new B("y"),65:new B("y'"),80:new B("z"),81:new B("z'"),90:new B("M'"),190:new B("M'"),192:new De}});var uf=y(()=>{"use strict"});var fe=y(()=>{"use strict";Wt();Va();rs();sf();ff();Qn();uf();gs();ts();Ha()});function Yl(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(Jl(o.numOrientations,a))n[l]=i;else if(Jl(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 u=0;u<o.numPieces;u++)f[u]=(i.orientation[a.permutation[u]]+a.orientation[u])%o.numOrientations,s[u]=i.permutation[a.permutation[u]];n[l]={permutation:s,orientation:f}}}}return n}function cs(e,t,r){let n={};for(let l in e.orbits){let o=e.orbits[l],i=t[l],a=r[l];if(Jl(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 u=0;u<o.numPieces;u++)f[u]=(i.orientation[a.permutation[u]]+a.orientation[u])%o.numOrientations,s[u]=i.pieces[a.permutation[u]];n[l]={pieces:s,orientation:f}}}}return n}var oi=y(()=>{"use strict";$l()});function gL(e){let t=gf.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 cf&&(Object.freeze(r),Object.freeze(n),Object.freeze(l)),gf.set(e,l),l}function pf(e){let t={};for(let[r,n]of Object.entries(e.orbits))t[r]=gL(n.numPieces);return cf&&Object.freeze(t),t}function mf(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 Ar(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 Ar(e,o,-1);throw new Error(\`Invalid move for KPuzzle (\${e.name()}): \${t}\`)}var cf,gf,ps=y(()=>{"use strict";$l();cf=!1,gf=new Map});var ce,ii=y(()=>{"use strict";oi();eo();ce=class{constructor(t,r){this.kpuzzle=t;this.stateData=r}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),stateData:this.stateData}}static fromTransformation(t){let r=cs(t.kpuzzle.definition,t.kpuzzle.definition.startStateData,t.transformationData);return new ce(t.kpuzzle,r)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(t.isIdentityTransformation())return new ce(this.kpuzzle,this.stateData);let r=cs(this.kpuzzle.definition,this.stateData,t.transformationData);return new ce(this.kpuzzle,r)}applyMove(t){return this.applyTransformation(this.kpuzzle.moveToTransformation(t))}applyAlg(t){return this.applyTransformation(this.kpuzzle.algToTransformation(t))}experimentalToTransformation(){if(!this.kpuzzle.canConvertStateToUniqueTransformation())return null;let t={};for(let[r,n]of Object.entries(this.stateData)){let l={permutation:n.pieces,orientation:n.orientation};t[r]=l}return new Dt(this.kpuzzle,t)}experimentalIsSolved(t){if(!this.kpuzzle.definition.experimentalIsStateSolved)throw new Error("\`KState.experimentalIsSolved()\` is not supported for this puzzle at the moment.");return this.kpuzzle.definition.experimentalIsStateSolved(this,t)}}});var ln,yr,Dt,eo=y(()=>{"use strict";$l();oi();ps();ii();yr=class{constructor(t,r){this.kpuzzle=t;this.transformationData=r;J(this,ln,void 0)}toJSON(){return{experimentalPuzzleName:this.kpuzzle.name(),transformationData:this.transformationData}}invert(){return new yr(this.kpuzzle,ms(this.kpuzzle,this.transformationData))}isIdentityTransformation(){return R(this,ln)??V(this,ln,this.isIdentical(this.kpuzzle.identityTransformation()))}static experimentalConstructIdentity(t){let r=new yr(t,pf(t.definition));return V(r,ln,!0),r}isIdentical(t){return Lf(this.kpuzzle,this.transformationData,t.transformationData)}apply(t){return this.applyTransformation(this.kpuzzle.toTransformation(t))}applyTransformation(t){if(this.kpuzzle!==t.kpuzzle)throw new Error(\`Tried to apply a transformation for a KPuzzle (\${t.kpuzzle.name()}) to a different KPuzzle (\${this.kpuzzle.name()}).\`);return R(this,ln)?new yr(this.kpuzzle,t.transformationData):R(t,ln)?new yr(this.kpuzzle,this.transformationData):new yr(this.kpuzzle,Yl(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 ce.fromTransformation(this)}repetitionOrder(){return Bf(this.kpuzzle.definition,this)}selfMultiply(t){return new yr(this.kpuzzle,Ar(this.kpuzzle,this.transformationData,t))}},Dt=yr;ln=new WeakMap});function Jl(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 cL(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 Lf(e,t,r){for(let[n,l]of Object.entries(e.definition.orbits))if(!cL(l,t[n],r[n]))return!1;return!0}function ms(e,t){let r={};for(let n in e.definition.orbits){let l=e.definition.orbits[n],o=t[n];if(Jl(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 Ar(e,t,r){if(r===1)return t;if(r<0)return Ar(e,ms(e,t),-r);if(r===0){let{transformationData:o}=e.identityTransformation();return o}let n=t;r!==2&&(n=Ar(e,t,Math.floor(r/2)));let l=Yl(e.definition,n,n);return r%2===0?l:Yl(e.definition,t,l)}function Bs(e,t){return t?Bs(t,e%t):e}function Bf(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,u=0;for(;i[s]=!0,f=f+o.orientation[s],u=u+1,s=o.permutation[s],s!==a;);f!==0&&(u=u*l.numOrientations/Bs(l.numOrientations,Math.abs(f))),r=r*u/Bs(r,u)}}return r}var Ls,df,$l=y(()=>{"use strict";fe();fe();oi();eo();Ls=class extends Dr{traverseAlg(t,r){let n=null;for(let l of t.childAlgNodes())n?n=n.applyTransformation(this.traverseAlgNode(l,r)):n=this.traverseAlgNode(l,r);return n??r.identityTransformation()}traverseGrouping(t,r){let n=this.traverseAlg(t.alg,r);return new Dt(r,Ar(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()}},df=wt(Ls)});var qn,ai,Ae,Rf=y(()=>{"use strict";fe();$l();ps();ii();eo();Ae=class{constructor(t,r){this.definition=t;J(this,qn,new Map);J(this,ai,void 0);this.experimentalPGNotation=r?.experimentalPGNotation}name(){return this.definition.name}identityTransformation(){return Dt.experimentalConstructIdentity(this)}moveToTransformation(t){typeof t=="string"&&(t=new B(t));let r=t.toString(),n=R(this,qn).get(r);if(n)return new Dt(this,n);if(this.experimentalPGNotation){let o=this.experimentalPGNotation.lookupMove(t);if(!o)throw new Error(\`could not map to internal move: \${t}\`);return R(this,qn).set(r,o),new Dt(this,o)}let l=mf(this,t);return R(this,qn).set(r,l),new Dt(this,l)}algToTransformation(t){return typeof t=="string"&&(t=new w(t)),df(t,this)}toTransformation(t){return typeof t=="string"?this.algToTransformation(t):t?.is?.(w)?this.algToTransformation(t):t?.is?.(B)?this.moveToTransformation(t):t}startState(){return new ce(this,this.definition.startStateData)}canConvertStateToUniqueTransformation(){return R(this,ai)??V(this,ai,(()=>{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})())}};qn=new WeakMap,ai=new WeakMap});var He=y(()=>{"use strict";Rf();ii();eo()});var hf,pL,Ff=y(()=>{"use strict";hf={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"}},pL={...hf,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 Df(e){return mL[e]}var rr,Qt,Xe,Vn,si,on,mL,Hn,Xn,to=y(()=>{"use strict";rr=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))}},Qt="regular",Xe="ignored",Vn="oriented",si="invisible",on="dim",mL={["Regular"]:{facelets:[Qt,Qt,Qt,Qt,Qt]},["Ignored"]:{facelets:[Xe,Xe,Xe,Xe,Xe]},["OrientationStickers"]:{facelets:[Vn,Vn,Vn,Vn,Vn]},["IgnoreNonPrimary"]:{facelets:[Qt,Xe,Xe,Xe,Xe]},["Invisible"]:{facelets:[si,si,si,si]},["PermuteNonPrimary"]:{facelets:[on,Qt,Qt,Qt,Qt]},["Dim"]:{facelets:[on,on,on,on,on]},["Ignoriented"]:{facelets:[on,Xe,Xe,Xe,Xe]},["OrientationWithoutPermutation"]:{facelets:[Vn,Xe,Xe,Xe,Xe]}};Hn=class extends rr{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}toStickeringMask(){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(Df(i))}return t}},Xn=class{constructor(t){this.kpuzzle=t}and(t){let r=new rr(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 rr(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 rr(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 rr(this.kpuzzle,!1);for(let[l,o]of Object.entries(this.kpuzzle.definition.orbits))for(let i=0;i<o.numPieces;i++)(r.transformationData[l].permutation[i]!==i||r.transformationData[l].orientation[i]!==0)&&(n.stickerings.get(l)[i]=!0);return n}moves(t){return t.map(r=>this.move(r))}orbits(t){let r=new rr(this.kpuzzle,!1);for(let n of t)r.stickerings.get(n).fill(!0);return r}orbitPrefix(t){let r=new rr(this.kpuzzle,!1);for(let n in this.kpuzzle.definition.orbits)n.startsWith(t)&&r.stickerings.get(n).fill(!0);return r}}});var ds,Rs=y(()=>{"use strict";ds={full:{groups:{"3x3x3":"Stickering"}},OLL:{groups:{"3x3x3":"Last Layer"}},PLL:{groups:{"3x3x3":"Last Layer"}},LL:{groups:{"3x3x3":"Last Layer"}},EOLL:{groups:{"3x3x3":"Last Layer"}},COLL:{groups:{"3x3x3":"Last Layer"}},OCLL:{groups:{"3x3x3":"Last Layer"}},CLL:{groups:{"3x3x3":"Last Layer"}},ELL:{groups:{"3x3x3":"Last Layer"}},ZBLL:{groups:{"3x3x3":"Last Layer"}},LS:{groups:{"3x3x3":"Last Slot"}},ELS:{groups:{"3x3x3":"Last Slot"}},CLS:{groups:{"3x3x3":"Last Slot"}},ZBLS:{groups:{"3x3x3":"Last Slot"}},VLS:{groups:{"3x3x3":"Last Slot"}},WVLS:{groups:{"3x3x3":"Last Slot"}},F2L:{groups:{"3x3x3":"CFOP (Fridrich)"}},Daisy:{groups:{"3x3x3":"CFOP (Fridrich)"}},Cross:{groups:{"3x3x3":"CFOP (Fridrich)"}},EO:{groups:{"3x3x3":"ZZ"}},EOline:{groups:{"3x3x3":"ZZ"}},EOcross:{groups:{"3x3x3":"ZZ"}},CMLL:{groups:{"3x3x3":"Roux"}},L10P:{groups:{"3x3x3":"Roux"}},L6E:{groups:{"3x3x3":"Roux"}},L6EO:{groups:{"3x3x3":"Roux"}},"2x2x2":{groups:{"3x3x3":"Petrus"}},"2x2x3":{groups:{"3x3x3":"Petrus"}},"Void Cube":{groups:{"3x3x3":"Miscellaneous"}},invisible:{groups:{"3x3x3":"Miscellaneous"}},picture:{groups:{"3x3x3":"Miscellaneous"}},"centers-only":{groups:{"3x3x3":"Miscellaneous"}},"experimental-centers-U":{},"experimental-centers-U-D":{},"experimental-centers-U-L-D":{},"experimental-centers-U-L-B-D":{},"experimental-centers":{},"experimental-fto-fc":{groups:{fto:"Bencisco"}},"experimental-fto-f2t":{groups:{fto:"Bencisco"}},"experimental-fto-sc":{groups:{fto:"Bencisco"}},"experimental-fto-l2c":{groups:{fto:"Bencisco"}},"experimental-fto-lbt":{groups:{fto:"Bencisco"}},"experimental-fto-l3t":{groups:{fto:"Bencisco"}}}});async function nr(e,t){let r=await e.kpuzzle(),n=new Hn(r),l=new Xn(r),o=()=>l.move("U"),i=()=>l.or(l.moves(["U","D"])),a=()=>l.or(l.moves(["L","R"])),s=()=>l.not(a()),f=()=>l.not(o()),u=()=>l.orbitPrefix("CENTER"),g=()=>l.orbitPrefix("EDGE"),c=()=>l.or([l.orbitPrefix("CORNER"),l.orbitPrefix("C4RNER"),l.orbitPrefix("C5RNER")]),p=()=>l.or([s(),l.and([o(),g()])]),L=()=>l.and([o(),u()]),m=()=>l.and([l.and(l.moves(["F","R"])),g()]),d=()=>l.and([l.and(l.moves(["F","R"])),c(),l.not(o())]),F=()=>l.or([d(),m()]);function D(){n.set(f(),"Dim")}function S(){n.set(o(),"PermuteNonPrimary"),n.set(L(),"Dim")}function x(){n.set(o(),"IgnoreNonPrimary"),n.set(L(),"Regular")}function U(){n.set(o(),"Ignoriented"),n.set(L(),"Dim")}switch(t){case"full":break;case"PLL":{D(),S();break}case"CLS":{D(),n.set(d(),"Regular"),n.set(o(),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),c()]),"IgnoreNonPrimary");break}case"OLL":{D(),x();break}case"EOLL":{D(),x(),n.set(l.and([o(),c()]),"Ignored");break}case"COLL":{D(),n.set(l.and([o(),g()]),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),c()]),"Regular");break}case"OCLL":{D(),U(),n.set(l.and([o(),c()]),"IgnoreNonPrimary");break}case"CLL":{D(),n.set(l.not(l.and([c(),o()])),"Dim");break}case"ELL":{D(),n.set(o(),"Dim"),n.set(l.and([o(),g()]),"Regular");break}case"ELS":{D(),x(),n.set(l.and([o(),c()]),"Ignored"),n.set(m(),"Regular"),n.set(d(),"Ignored");break}case"LL":{D();break}case"F2L":{n.set(o(),"Ignored");break}case"ZBLL":{D(),n.set(o(),"PermuteNonPrimary"),n.set(L(),"Dim"),n.set(l.and([o(),c()]),"Regular");break}case"ZBLS":{D(),n.set(F(),"Regular"),x(),n.set(l.and([o(),c()]),"Ignored");break}case"VLS":{D(),n.set(F(),"Regular"),x();break}case"WVLS":{D(),n.set(F(),"Regular"),n.set(l.and([o(),g()]),"Ignoriented"),n.set(l.and([o(),u()]),"Dim"),n.set(l.and([o(),c()]),"IgnoreNonPrimary");break}case"LS":{D(),n.set(F(),"Regular"),n.set(o(),"Ignored"),n.set(L(),"Dim");break}case"EO":{n.set(c(),"Ignored"),n.set(g(),"OrientationWithoutPermutation");break}case"EOline":{n.set(c(),"Ignored"),n.set(g(),"OrientationWithoutPermutation"),n.set(l.and(l.moves(["D","M"])),"Regular");break}case"EOcross":{n.set(g(),"OrientationWithoutPermutation"),n.set(l.move("D"),"Regular"),n.set(c(),"Ignored");break}case"CMLL":{n.set(f(),"Dim"),n.set(p(),"Ignored"),n.set(l.and([o(),c()]),"Regular");break}case"L10P":{n.set(l.not(p()),"Dim"),n.set(l.and([c(),o()]),"Regular");break}case"L6E":{n.set(l.not(p()),"Dim");break}case"L6EO":{n.set(l.not(p()),"Dim"),n.set(p(),"OrientationWithoutPermutation"),n.set(l.and([u(),i()]),"OrientationStickers");break}case"Daisy":{n.set(l.all(),"Ignored"),n.set(u(),"Dim"),n.set(l.and([l.move("D"),u()]),"Regular"),n.set(l.and([l.move("U"),g()]),"IgnoreNonPrimary");break}case"Cross":{n.set(l.all(),"Ignored"),n.set(u(),"Dim"),n.set(l.and([l.move("D"),u()]),"Regular"),n.set(l.and([l.move("D"),g()]),"Regular");break}case"2x2x2":{n.set(l.or(l.moves(["U","F","R"])),"Ignored"),n.set(l.and([l.or(l.moves(["U","F","R"])),u()]),"Dim");break}case"2x2x3":{n.set(l.all(),"Dim"),n.set(l.or(l.moves(["U","F","R"])),"Ignored"),n.set(l.and([l.or(l.moves(["U","F","R"])),u()]),"Dim"),n.set(l.and([l.move("F"),l.not(l.or(l.moves(["U","R"])))]),"Regular");break}case"Void Cube":{n.set(u(),"Invisible");break}case"picture":case"invisible":{n.set(l.all(),"Invisible");break}case"centers-only":{n.set(l.not(u()),"Ignored");break}default:console.warn(\`Unsupported stickering for \${e.id}: \${t}. Setting all pieces to dim.\`),n.set(l.and(l.moves([])),"Dim")}return n.toStickeringMask()}async function Zn(){let e=[];for(let[t,r]of Object.entries(ds))r.groups&&"3x3x3"in r.groups&&e.push(t);return e}var ro=y(()=>{"use strict";to();Rs()});function de(e){let t=null;return()=>t??(t=e())}var Et=y(()=>{"use strict"});var Jn,yf=y(()=>{"use strict";Jn=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 an,Sf=y(()=>{"use strict";an=class{notationToInternal(t){return t}notationToExternal(t){return t}}});var no,vf=y(()=>{"use strict";fe();no=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 _("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 _("T",t.innerLayer,t.outerLayer),t.amount):this.child.notationToExternal(t)}}});var Yn,xf=y(()=>{"use strict";fe();Yn=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 _(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 lo,Uf=y(()=>{"use strict";fe();lo=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 _("L",3,2),-2*t.amount);if(t.family==="R--")return new B(new _("L",3,2),2*t.amount);if(t.family==="D++")return new B(new _("U",3,2),-2*t.amount);if(t.family==="D--")return new B(new _("U",3,2),2*t.amount);if(t.family==="R_PLUSPLUS_")return new B(new _("L",3,2),-2*t.amount);if(t.family==="D_PLUSPLUS_")return new B(new _("U",3,2),-2*t.amount)}if(t.family==="y")return new B("Uv",t.amount);if(t.family==="x"&&Math.abs(t.amount)===2)return new B("ERv",t.amount/2)}return this.child.notationToInternal(t)}notationToExternal(t){return t.family==="ERv"&&Math.abs(t.amount)===1?new B(new _("x",t.innerLayer,t.outerLayer),t.amount*2):t.family==="ILv"&&Math.abs(t.amount)===1?new B(new _("x",t.innerLayer,t.outerLayer),-t.amount*2):t.family==="Uv"?new B(new _("y",t.innerLayer,t.outerLayer),t.amount):t.family==="Dv"?new B("y",-t.amount):this.child.notationToExternal(t)}}});var oo,bf=y(()=>{"use strict";fe();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 _("D",(this.slices+1)/2),t.amount):r==="M"?t=new B(new _("L",(this.slices+1)/2),t.amount):r==="S"&&(t=new B(new _("F",(this.slices+1)/2),t.amount))),this.slices>2&&(r==="e"?t=new B(new _("D",this.slices-1,2),t.amount):r==="m"?t=new B(new _("L",this.slices-1,2),t.amount):r==="s"&&(t=new B(new _("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 LL,BL,wf,Ef,kf,$n,io,_f=y(()=>{"use strict";fe();LL={U:"frl",L:"fld",R:"fdr",B:"dlr",u:"FRL",l:"FLD",r:"FDR",b:"DLR",Uv:"FRLv",Lv:"FLDv",Rv:"FDRv",Bv:"DLRv",D:"D",F:"F",BL:"L",BR:"R"},BL={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"},wf={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},Ef=new _("y"),kf=new _("Dv"),$n=class{constructor(t){this.child=t;this.wcaHack=!1;this.map=LL}notationToInternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){let n=wf[t.family];if(n)return new B(new _(n,t.innerLayer,t.outerLayer),t.amount)}let r=this.map[t.family];return r?new B(new _(r,t.innerLayer,t.outerLayer),t.amount):Ef.isIdentical(t.quantum)?new B(kf,-t.amount):null}notationToExternal(t){if(this.wcaHack&&t.innerLayer===2&&t.outerLayer===null){for(let[r,n]of Object.entries(wf))if(this.child.spinmatch(t.family,n))return new B(new _(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 _(r,t.innerLayer,t.outerLayer),t.amount);return kf.isIdentical(t.quantum)?new B(Ef,-t.amount):null}},io=class extends $n{constructor(r){super(r);this.wcaHack=!0;this.map=BL}}});var zf,hs,Cf,dL,Fs,Nf,RL,Ds,Pf,hL,ao,Mf=y(()=>{"use strict";fe();zf={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"},hs=new _("x"),Cf=new _("Rv"),dL=new _("Lv"),Fs=new _("y"),Nf=new _("Uv"),RL=new _("Dv"),Ds=new _("z"),Pf=new _("Fv"),hL=new _("Bv"),ao=class{constructor(t){this.child=t}notationToInternal(t){if(t.innerLayer||t.outerLayer)return null;let r=zf[t.family];return r?new B(new _(r,t.outerLayer,t.innerLayer),t.amount):hs.isIdentical(t.quantum)?new B(Cf,t.amount):Fs.isIdentical(t.quantum)?new B(Nf,t.amount):Ds.isIdentical(t.quantum)?new B(Pf,t.amount):null}notationToExternal(t){for(let[r,n]of Object.entries(zf))if(this.child.spinmatchv(t.family,n))return new B(new _(r,t.innerLayer,t.outerLayer),t.amount);return Cf.isIdentical(t.quantum)?new B(hs,t.amount):dL.isIdentical(t.quantum)?new B(hs,-t.amount):Nf.isIdentical(t.quantum)?new B(Fs,t.amount):RL.isIdentical(t.quantum)?new B(Fs,-t.amount):Pf.isIdentical(t.quantum)?new B(Ds,t.amount):hL.isIdentical(t.quantum)?new B(Ds,-t.amount):null}}});var As=y(()=>{"use strict";Sf();vf();xf();Uf();bf();_f();Mf()});function If(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:so(e.slice(t).join(" ")),options:r}}var fi,ys=y(()=>{"use strict";fo();fi=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 Sr(e){if(!Ss[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=0;Ss[e]=t}return Ss[e]}function jt(e){if(!vs[e]){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;vs[e]=t}return vs[e]}function Of(e){return new Bt(jt(e))}function Tf(e){let t=BigInt(1);for(;e>1;)t*=BigInt(e),e--;return t}function FL(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 xs(e,t){return e/FL(e,t)*t}var Ss,vs,Bt,ui=y(()=>{"use strict";Ss=[],vs=[];Bt=class{constructor(t){this.n=t.length,this.p=t}toString(){return\`Perm[\${this.p.join(" ")}]\`}mul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=t.p[this.p[n]];return new Bt(r)}rmul(t){let r=Array(this.n);for(let n=0;n<this.n;n++)r[n]=this.p[t.p[n]];return new Bt(r)}inv(){let t=Array(this.n);for(let r=0;r<this.n;r++)t[this.p[r]]=r;return new Bt(t)}compareTo(t){for(let r=0;r<this.n;r++)if(this.p[r]!==t.p[r])return this.p[r]-t.p[r];return 0}toGap(){let t=new Array,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=new Array;for(let o=n;!r[o];o=this.p[o])l.push(1+o),r[o]=!0;t.push(\`(\${l.join(",")})\`)}return t.join("")}order(){let t=1,r=new Array(this.n);for(let n=0;n<this.p.length;n++){if(r[n]||this.p[n]===n)continue;let l=0;for(let o=n;!r[o];o=this.p[o])l++,r[o]=!0;t=xs(t,l)}return t}}});function gi(e,t){let r=B.fromString(t),n=e.notationToExternal(r);return n===null||r===n?t:n.toString()}function Gf(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 u=e.moveops[f];a.mul(u).equal(u.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 u in o){let g=+u,c=o[g];a+=c,f++;for(let p=0;p<n.length;p++)if((g>>p&1)===0&&(g&l[p]&(1<<p)-1)===0){let L=g&l[p]|1<<p;s[L]===void 0&&(s[L]=0),s[L]+=(n[p]-1)*c}}t(\`\${i}: canonseq \${a} states \${f}\`),o=s}}var el,DL,sn,kt,qt,ci,lr,fn,pi,Wf=y(()=>{"use strict";fe();As();ui();el=class{constructor(t,r){this.size=t;this.mod=r}reassemblySize(){return Tf(this.size)*BigInt(this.mod)**BigInt(this.size)}},DL=0;sn=class{constructor(t,r,n,l,o,i,a){this.orbitnames=t;this.orbitdefs=r;this.solved=n;this.movenames=l;this.moveops=o;this.isRotation=i;this.forcenames=a}transformToKTransformationData(t){let r={};for(let n=0;n<this.orbitnames.length;n++)r[this.orbitnames[n]]=t.orbits[n].toKPuzzle();return r}static transformToKTransformationData(t,r){let n={};for(let l=0;l<t.length;l++)n[t[l]]=r.orbits[l].toKPuzzle();return n}describeSet(t,r,n){let l=this.orbitdefs[t].size,o=new Array(l);for(let i=0;i<l;i++)o[i]=[];for(let i=0;i<this.movenames.length;i++){if(this.isRotation[i])continue;let a=this.movenames[i];this.forcenames[i]||(a=gi(n,a),a[a.length-1]==="'"&&(a=a.substring(0,a.length-1)));let s=this.moveops[i].orbits[t];for(let f=0;f<l;f++)(s.perm[f]!==f||s.ori[f]!==0)&&o[f].push(a)}for(let i=0;i<l;i++)r.push(\`# \${i+1} \${o[i].join(" ")}\`)}toKsolve(t,r=new an){let n=[];n.push(\`Name \${t}\`),n.push("");for(let l=0;l<this.orbitnames.length;l++)n.push(\`Set \${this.orbitnames[l]} \${this.orbitdefs[l].size} \${this.orbitdefs[l].mod}\`),this.describeSet(l,n,r);n.push(""),n.push("Solved");for(let l=0;l<this.orbitnames.length;l++)this.solved.orbits[l].appendDefinition(n,this.orbitnames[l],!1,!1);n.push("End");for(let l=0;l<this.movenames.length;l++){n.push("");let o=this.movenames[l];this.forcenames[l]||(o=gi(r,this.movenames[l]));let i=!1;o[o.length-1]==="'"&&(i=!0,o=o.substring(0,o.length-1)),n.push(\`Move \${o}\`);for(let 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 #\${++DL}\`,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 pi(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++)if(!this.isRotation[p])for(let L=0;L<a;L++)(this.moveops[p].orbits[o].perm[L]!==L||this.moveops[p].orbits[o].ori[L]!==0)&&(f[L]=!0,s.union(L,this.moveops[p].orbits[o].perm[L]));let u=!0;if(i>1){u=!1;let p=new pi(this.orbitdefs[o].size*i);for(let L=0;L<this.moveops.length;L++)for(let m=0;m<a;m++)if(this.moveops[L].orbits[o].perm[m]!==m||this.moveops[L].orbits[o].ori[m]!==0)for(let d=0;d<i;d++)p.union(m*i+d,this.moveops[L].orbits[o].perm[m]*i+(d+this.moveops[L].orbits[o].ori[m])%i);for(let L=0;!u&&L<a;L++)for(let m=1;m<i;m++)p.find(L*i)===p.find(L*i+m)&&(u=!0);for(let L=0;!u&&L<a;L++)for(let m=0;m<L;m++)this.solved.orbits[o].perm[L]===this.solved.orbits[o].perm[m]&&(u=!0)}let g=-1,c=!1;for(let p=0;p<this.orbitdefs[o].size;p++)if(f[p]){let L=s.find(p);g<0?g=L:g!==L&&(c=!0)}for(let p=0;p<this.orbitdefs[o].size;p++){if(!f[p]||s.find(p)!==p)continue;let m=[],d=[],F=0;for(let D=0;D<this.orbitdefs[o].size;D++)s.find(D)===p&&(m[F]=D,d[D]=F,F++);if(c?t.push(\`\${this.orbitnames[o]}_p\${p}\`):t.push(this.orbitnames[o]),u){r.push(new el(F,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(m,F));for(let D=0;D<this.moveops.length;D++)l[D].push(this.moveops[D].orbits[o].remap(m,d,F))}else{r.push(new el(F,1)),n.push(this.solved.orbits[o].remapVS(m,F).killOri());for(let D=0;D<this.moveops.length;D++)l[D].push(this.moveops[D].orbits[o].remap(m,d,F).killOri())}}}return new sn(t,r,new fn(n),this.movenames,l.map(o=>new lr(o)),this.isRotation,this.forcenames)}scramble(t){this.solved=this.solved.mul(this.getScrambleTransformation(t))}getScrambleTransformation(t){t<100&&(t=100);let r=[];for(let l=0;l<this.moveops.length;l++)r[l]=this.moveops[l];for(let l=0;l<r.length;l++){let o=Math.floor(Math.random()*r.length),i=r[l];r[l]=r[o],r[o]=i}t<r.length&&(t=r.length);for(let l=0;l<t;l++){let o=Math.floor(Math.random()*r.length),i=Math.floor(Math.random()*r.length),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=BigInt(1);for(let r=0;r<this.orbitdefs.length;r++)t*=this.orbitdefs[r].reassemblySize();return t}},kt=class{constructor(t,r,n){this.perm=t;this.ori=r;this.orimod=n}static e(t,r){return new kt(jt(t),Sr(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 kt(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 kt(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 kt(r,n,this.orimod)}equal(t){let r=this.perm.length;for(let n=0;n<r;n++)if(this.perm[n]!==t.perm[n]||this.ori[n]!==t.ori[n])return!1;return!0}killOri(){let t=this.perm.length;for(let r=0;r<t;r++)this.ori[r]=0;return this.orimod=1,this}toPerm(){let t=this.orimod;if(t===1)return new Bt(this.perm);let r=this.perm.length,n=new Array(r*t);for(let l=0;l<r;l++)for(let o=0;o<t;o++)n[l*t+o]=t*this.perm[l]+(this.ori[l]+o)%t;return new Bt(n)}identicalPieces(){let t=[],r=this.perm.length,n=[];for(let l=0;l<r;l++){let o=this.perm[l];if(t[o]===void 0){let i=[l];t[o]=!0;for(let 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===jt(t)&&this.ori===Sr(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===Sr(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 kt(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 kt(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()?(kt.kcache[t]||(kt.kcache[t]={permutation:jt(t),orientation:Sr(t)}),kt.kcache[t]):{permutation:this.perm,orientation:this.ori}}},qt=kt;qt.kcache=[];ci=class{constructor(t){this.orbits=t}internalMul(t){let r=[];for(let n=0;n<this.orbits.length;n++)r.push(this.orbits[n].mul(t.orbits[n]));return r}internalInv(){let t=[];for(let r of this.orbits)t.push(r.inv());return t}equal(t){for(let r=0;r<this.orbits.length;r++)if(!this.orbits[r].equal(t.orbits[r]))return!1;return!0}killOri(){for(let t of this.orbits)t.killOri();return this}toPerm(){let t=new Array,r=0;for(let l of this.orbits){let o=l.toPerm();t.push(o),r+=o.n}let n=new Array(r);r=0;for(let l of t){for(let o=0;o<l.n;o++)n[r+o]=r+l.p[o];r+=l.n}return new Bt(n)}identicalPieces(){let t=[],r=0;for(let n of this.orbits){let l=n.orimod,o=n.identicalPieces();for(let i=0;i<o.length;i++)t.push(o[i].map(a=>a*l+r));r+=l*n.perm.length}return t}order(){let t=1;for(let r of this.orbits)t=xs(t,r.order());return t}},lr=class extends ci{constructor(t){super(t)}mul(t){return new lr(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 lr(this.internalInv())}e(){return new lr(this.orbits.map(t=>qt.e(t.perm.length,t.orimod)))}},fn=class extends ci{constructor(t){super(t)}mul(t){return new fn(this.internalMul(t))}},pi=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 mi,Kf=y(()=>{"use strict";mi={"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 Li(e){let t=new W(0,0,0,0);for(let r=0;r<e.length;r++)t=t.sum(e[r]);return t.smul(1/e.length)}function Qf(e,t,r,n){let l=n[e].intersect3(n[t],n[r]);if(!l)return l;for(let o=0;o<n.length;o++)if(o!==e&&o!==t&&o!==r){let i=n[o].b*l.b+n[o].c*l.c+n[o].d*l.d;if(n[o].a>0&&i>n[o].a||n[o].a<0&&i<n[o].a)return!1}return l}var W,Bi=y(()=>{"use strict";W=class{constructor(t,r,n,l){this.a=t;this.b=r;this.c=n;this.d=l}mul(t){return new W(this.a*t.a-this.b*t.b-this.c*t.c-this.d*t.d,this.a*t.b+this.b*t.a+this.c*t.d-this.d*t.c,this.a*t.c-this.b*t.d+this.c*t.a+this.d*t.b,this.a*t.d+this.b*t.c-this.c*t.b+this.d*t.a)}toString(){return\`Q[\${this.a},\${this.b},\${this.c},\${this.d}]\`}dist(t){return Math.hypot(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(t){return new W(0,this.c*t.d-this.d*t.c,this.d*t.b-this.b*t.d,this.b*t.c-this.c*t.b)}dot(t){return this.b*t.b+this.c*t.c+this.d*t.d}normalize(){let t=Math.sqrt(this.dot(this));return new W(this.a/t,this.b/t,this.c/t,this.d/t)}makenormal(){return new W(0,this.b,this.c,this.d).normalize()}normalizeplane(){let t=Math.hypot(this.b,this.c,this.d);return new W(this.a/t,this.b/t,this.c/t,this.d/t)}smul(t){return new W(this.a*t,this.b*t,this.c*t,this.d*t)}sum(t){return new W(this.a+t.a,this.b+t.b,this.c+t.c,this.d+t.d)}sub(t){return new W(this.a-t.a,this.b-t.b,this.c-t.c,this.d-t.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new W(this.a,-this.b,-this.c,-this.d)}det3x3(t,r,n,l,o,i,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 W(0,this.b,this.c,this.d)).mul(t.invrot());return r.a=this.a,r}orthogonal(){let t=Math.abs(this.b),r=Math.abs(this.c),n=Math.abs(this.d);return t<r&&t<n?this.cross(new W(0,1,0,0)).normalize():r<t&&r<n?this.cross(new W(0,0,1,0)).normalize():this.cross(new W(0,0,0,1)).normalize()}pointrotation(t){let r=this.normalize();if(t=t.normalize(),r.sub(t).len()<1e-9)return new W(1,0,0,0);let n=r.sum(t);n.len()<1e-9?n=n.orthogonal():n=n.normalize();let l=r.cross(n);return l.a=r.dot(n),l}unproject(t){return this.sum(t.smul(-this.dot(t)/(this.len()*t.len())))}rotatepoint(t){return t.mul(this).mul(t.invrot())}rotateface(t){return t.map(r=>r.rotatepoint(this))}intersect3(t,r){let n=this.det3x3(this.b,this.c,this.d,t.b,t.c,t.d,r.b,r.c,r.d);return Math.abs(n)<1e-9?!1:new W(0,this.det3x3(this.a,this.c,this.d,t.a,t.c,t.d,r.a,r.c,r.d)/n,this.det3x3(this.b,this.a,this.d,t.b,t.a,t.d,r.b,r.a,r.d)/n,this.det3x3(this.b,this.c,this.a,t.b,t.c,t.a,r.b,r.c,r.a)/n)}side(t){return t>1e-9?1:t<-1e-9?-1:0}cutface(t){let r=this.a,n=0,l=null;for(let o=0;o<t.length;o++)n|=1<<this.side(t[o].dot(this)-r)+1;if((n&5)===5){l=[];let o=t.map(i=>this.side(i.dot(this)-r));for(let i=-1;i<=1;i+=2){let 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 u=t[s].dot(this)-r,g=t[f].dot(this)-r,c=u/(u-g),p=t[s].smul(1-c).sum(t[f].smul(c));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 W(t,this.b,this.c,this.d)}}});function jf(){let e=Math.sqrt(.5);return[new W(e,e,0,0),new W(e,0,e,0)]}function qf(){return[new W(.5,.5,.5,.5),new W(.5,.5,.5,-.5)]}function Vf(){let e=2*Math.PI/10,t=.5+.3*Math.sqrt(5),r=.5+.1*Math.sqrt(5),n=Math.sqrt(t*t+r*r);return t/=n,r/=n,[new W(Math.cos(e),t*Math.sin(e),r*Math.sin(e),0),new W(.5,.5,.5,.5)]}function Hf(){let e=.16666666666666666+Math.sqrt(5)/6,t=2/3+Math.sqrt(5)/3,r=Math.sqrt(e*e+t*t);e/=r,t/=r;let n=2*Math.PI/6;return[new W(Math.cos(n),e*Math.sin(n),t*Math.sin(n),0),new W(Math.cos(n),-e*Math.sin(n),t*Math.sin(n),0)]}function Xf(){let e=Math.sqrt(.5);return[new W(.5,.5,.5,.5),new W(e,0,0,e)]}function Zf(e){let t=[new W(1,0,0,0)];for(let r=0;r<t.length;r++)for(let n=0;n<e.length;n++){let l=e[n].mul(t[r]),o=l.smul(-1),i=!1;for(let a=0;a<t.length;a++)if(l.dist(t[a])<di||o.dist(t[a])<di){i=!0;break}i||t.push(l)}return t}function Us(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])<di){i=!0;break}i||(r.push(o),n.push(t[l]))}return n}function bs(e){let t=[];for(let r=1;r<e.length;r++)for(let n=r+1;n<e.length;n++){let l=Qf(0,r,n,e);if(l){let o=!1;for(let i=0;i<t.length;i++)if(l.dist(t[i])<di){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 di,Jf=y(()=>{"use strict";Bi();di=1e-9});function Ri(e,t){let r=e[0].p.length,n=Of(r),l=[],o=[],i=[],a=[],s=[];function f(p){for(let L=p.p.length-1;L>=0;L--){let m=p.p[L];if(m!==L){if(!l[L][m])return!1;p=p.mul(o[L][m])}}return!0}function u(p,L,m){a[p].push(L),s[p].push(m);for(let d=0;d<l[p].length;d++)l[p][d]&&g(p,l[p][d].mul(L),m+i[p][d])}function g(p,L,m){let d=L.p[p];if(!l[p][d]){l[p][d]=L,o[p][d]=L.inv(),i[p][d]=m;for(let D=0;D<a[p].length;D++)g(p,L.mul(a[p][D]),m+s[p][D]);return}let F=L.mul(o[p][d]);f(F)||u(p-1,F,m+i[p][d])}function c(){l=[],o=[],a=[],i=[],s=[];for(let m=0;m<r;m++)l.push([]),o.push([]),i.push([]),a.push([]),s.push([]),l[m][m]=n,o[m][m]=n,i[m][m]=0;let p=0,L=BigInt(1);for(let m=0;m<e.length;m++){u(r-1,e[m],1),L=BigInt(1);let d=0,F=0,D=[],S=new ws;for(let x=0;x<r;x++){let U=0,P=0;for(let C=0;C<r;C++)l[x][C]&&(U++,P+=i[x][C],x!==C&&p++);d+=a[x].length,L*=BigInt(U),U>1&&S.multiply(U);let Z=P/U;D.push(Z),F+=Z}t(\`\${m}: sz \${L} T \${d} sol \${F} none \${p} mults \${S.toString()}\`)}return L}return c()}var ws,Es=y(()=>{"use strict";ui();ws=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 AL(e,t){let r=[];for(let n of e)for(let l of t)r.push(l.rotate(n));return r}function vL(){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 xL(){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 bL(){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 hi(e,t){for(let r=0;r<e.length;r++)if(e[r][0].dist(t)<Ue)return r;throw new Error("Element not found")}function Yf(){return mi}function $f(e){return mi[e]}function so(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 _s(e,t={}){let r=so(e);if(r===null)throw new Error("Could not parse the puzzle description");let n=new uo(r,Object.assign({},{allMoves:!0},t));return n.allstickers(),n.genperms(),n}function r1(e,t){return _s(mi[e],t)}function wL(e,t,r){let n=!1;r-t[1]<t[0]&&(e=[e[2],e[3],e[0],e[1]],t=[r-t[1],r-t[0]],n=!0);let l=e[0],o="";if(t[0]===0&&t[1]===r)l=\`\${l}v\`;else if(t[0]===t[1])t[1]>0&&(o=String(t[1]+1));else if(t[0]===0)l=l.toLowerCase(),t[1]>1&&(o=String(t[1]+1));else throw new Error(\`We only support slice and outer block moves right now. \${t}\`);return[o+l,n]}function EL(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 Fi(e,t){return[e.b/t,-e.c/t,e.d/t]}function ks(e,t){let r=[],n=e.length;for(let l=0;l<n;l++){let o=Fi(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 vr,tl,Ue,yL,SL,UL,e1,t1,uo,Di,fo=y(()=>{"use strict";fe();yf();As();ys();ui();Wf();Kf();Jf();Bi();Es();vr=class{constructor(t){this.coords=new Array(t.length*3);for(let r=0;r<t.length;r++)this.coords[3*r]=t[r].b,this.coords[3*r+1]=t[r].c,this.coords[3*r+2]=t[r].d;this.length=t.length}get(t){return new W(0,this.coords[3*t],this.coords[3*t+1],this.coords[3*t+2])}centermass(){let t=0,r=0,n=0;for(let l=0;l<this.length;l++)t+=this.coords[3*l],r+=this.coords[3*l+1],n+=this.coords[3*l+2];return new W(0,t/this.length,r/this.length,n/this.length)}rotate(t){let r=[];for(let n=0;n<this.length;n++)r.push(this.get(n).rotatepoint(t));return new vr(r)}rotateforward(){let t=[];for(let r=1;r<this.length;r++)t.push(this.get(r));return t.push(this.get(0)),new vr(t)}},tl=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 tl(r[0]),this.right=new tl(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 vr(this.face)):r?(this.left?.collect(t,!1),this.right?.collect(t,!0)):(this.right?.collect(t,!1),this.left?.collect(t,!0)),t}};Ue=1e-9,yL="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",SL=!1;UL={4:{v:["DFR","DLF","DRL","FLR"],e:["FR","LF","DF","DL","RD","RL"],c:["DF","FD","RL","LR"]},6:{v:["URF","UBR","ULB","UFL","DFR","DRB","DBL","DLF"],e:["UF","UR","UB","UL","DF","DR","DB","DL","FR","FL","BR","BL"],c:["UB","LU","FU","RU","BU","DF"]},8:{v:["UBBBRR","URFL","ULBLBB","DBRBBBL","DBLLF","DFRBR"],e:["UL","UBB","UR","BRD","BLD","FD","BRR","FR","FL","BLL","BLBB","BRBB"],c:["BBU","LU","RU","BRD","FD","BLD","DF","UBB"]},12:{v:["URF","UFL","ULBL","UBLBR","UBRR","DEBF","DBFI","DIA","DAC","DCE","LAI","ALF","FCA","CFR","REC","ERBR","BRBFE","BFBRBL","BLIBF","IBLL"],e:["UF","UR","UBR","UBL","UL","ER","EBR","EBF","ED","EC","IBF","IBL","IL","IA","ID","AC","CF","FA","BFBR","BRBL","BLBF","CD","AD","AL","FL","FR","CR","BFD","BRR","BLL"],c:["UF","FU","DBF","BFD","AD","CD","BRU","BLU","LA","RA","EBR","IBL"]},20:{v:["FLPQU","FUGER","FRCAL","HCREI","ISBDH","JSIEG","BSJMK","MQPOK","ONDBK","NOPLA","UQMJG","DNACH"],e:["FU","FL","FR","EG","ER","EI","SJ","SI","SB","KM","KB","KO","PQ","PO","PL","UG","JG","MQ","UQ","HC","HD","ND","NA","JM","CA","AL","CR","HI","DB","NO"],c:["FU","UF","GE","EG","JS","SJ","MK","KM","QP","PQ","LA","AL","RC","CR","IH","HI","BD","DB","ON","NO"]}};e1=["c","t","o","d","i"],t1=["f","v","e"];uo=class{constructor(t,r){this.puzzleDescription=t;this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.notationMapper=new an;this.addNotationMapper="";this.setReidOrder=!1;let n="genperms";this.options=new fi(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=jf();break}case"o":{l=Xf();break}case"i":{l=Hf();break}case"t":{l=qf();break}case"d":{l=Vf();break}default:throw new Error(\`Bad shape argument: \${r}\`)}this.rotations=Zf(l),this.options.verbosity&&console.log(\`# Rotations: \${this.rotations.length}\`);let o=l[0];this.baseplanerot=Us(o,this.rotations);let i=this.baseplanerot.map(A=>o.rotateplane(A));this.baseplanes=i,this.baseFaceCount=i.length;let a=vL()[i.length];this.net=a,this.colors=xL()[i.length],this.options.verbosity>0&&console.log(\`# Base planes: \${i.length}\`);let s=bs(i),f=new W(0,0,0,0);this.options.verbosity>0&&console.log(\`# Face vertices: \${s.length}\`);let u=i[0].makenormal(),g=s[0].sum(s[1]).makenormal(),c=s[0].makenormal(),p=new W(1,u.b,u.c,u.d);this.options.verbosity>0&&console.log(\`# Boundary is \${p}\`);let m=Us(p,this.rotations).map(A=>p.rotateplane(A)),d=bs(m);this.edgedistance=d[0].sum(d[1]).smul(.5).dist(f),this.vertexdistance=d[0].dist(f);let F=[],D=[],S=!1,x=!1,U=!1;for(let A of n){let k=null,T=0;switch(A.cutType){case"f":{k=u,T=1,S=!0;break}case"v":{k=c,T=this.vertexdistance,U=!0;break}case"e":{k=g,T=this.edgedistance,x=!0;break}default:throw new Error(\`Bad cut argument: \${A.cutType}\`)}F.push(k.makecut(A.distance)),D.push(A.distance<T)}this.options.addRotations&&(S||F.push(u.makecut(10)),U||F.push(c.makecut(10)),x||F.push(g.makecut(10))),this.basefaces=[];for(let A of this.baseplanerot){let k=A.rotateface(d);this.basefaces.push(new vr(k))}let P=[],Z=[],C=[],Q=[],v=d.length;function z(A,k,T){for(let I of A)if(I[0].dist(k)<Ue){I.push(T);return}A.push([k,T])}for(let A=0;A<this.baseplanerot.length;A++){let k=this.baseplanerot[A].rotateface(d);for(let T=0;T<k.length;T++){let I=(T+1)%k.length,ee=k[T].sum(k[I]).smul(.5);z(Q,ee,A)}}let N=[];for(let A=0;A<this.baseplanerot.length;A++){let k=this.baseplanerot[A].rotateface(d),T=[];for(let I=0;I<k.length;I++){let ee=(I+1)%k.length,ae=k[I].sum(k[ee]).smul(.5),Ie=Q[hi(Q,ae)];if(A===Ie[1])T.push(Ie[2]);else if(A===Ie[2])T.push(Ie[1]);else throw new Error("Could not find edge")}N.push(T)}let b={},E=[];E.push(a[0][0]),b[a[0][0]]=0,E[N[0][0]]=a[0][1],b[a[0][1]]=N[0][0];for(let A of a){let k=A[0],T=b[k];if(T===void 0)throw new Error("Bad edge description; first edge not connected");let I=-1;for(let ee=0;ee<N[T].length;ee++){let ae=E[N[T][ee]];if(ae!==void 0&&ae===A[1]){I=ee;break}}if(I<0)throw new Error("First element of a net not known");for(let ee=2;ee<A.length;ee++){if(A[ee]==="")continue;let ae=N[T][(ee+I-1)%v],Ie=E[ae];if(Ie!==void 0&&Ie!==A[ee])throw new Error("Face mismatch in net");E[ae]=A[ee],b[A[ee]]=ae}}for(let A=0;A<this.baseplanerot.length;A++){let k=this.baseplanerot[A].rotateface(d),T=p.rotateplane(this.baseplanerot[A]),I=E[A];P.push([k,I]),Z.push([T,I])}for(let A=0;A<this.baseplanerot.length;A++){let k=this.baseplanerot[A].rotateface(d),T=E[A];for(let I=0;I<k.length;I++){let ee=(I+1)%k.length,ae=k[I].sum(k[ee]).smul(.5),Ie=(I+2)%k.length,Cm=k[ee].sum(k[Ie]).smul(.5),Nm=hi(Q,ae),Pm=hi(Q,Cm);z(C,k[ee],[T,Pm,Nm])}}this.swizzler=new Jn(P.map(A=>A[1]));let M=this.swizzler.prefixFree?"":"_",j=UL[this.baseFaceCount],q=[];for(let A=0;A<this.baseFaceCount;A++)q[1<<A]=A;{let A=j.v;for(let k of A){let T=this.swizzler.splitByFaceNames(k),I=0;for(let ee of T)I|=1<<ee;q[I]=T[0]}}{let A=j.e;for(let k of A){let T=this.swizzler.splitByFaceNames(k),I=0;for(let ee of T)I|=1<<ee;q[I]=T[0]}}{let A=j.c;for(let k of A){let T=this.swizzler.splitByFaceNames(k),I=1<<T[0]|1<<this.baseFaceCount;q[I]=T[1]}}for(let A=0;A<Q.length;A++){if(Q[A].length!==3)throw new Error(\`Bad length in edge names \${Q[A]}\`);let k=Q[A][1],T=Q[A][2],I=E[k],ee=E[T],ae=1<<k|1<<T;q[ae]===k?I=I+M+ee:I=ee+M+I,Q[A]=[Q[A][0],I]}for(let A=0;A<C.length;A++){let k=0;if(C[A].length<4)throw new Error("Bad length in vertex names");for(let ae=1;ae<C[A].length;ae++)k|=1<<b[C[A][ae][0]];let T=q[k],I=-1;for(let ae=1;ae<C[A].length;ae++)T===b[C[A][ae][0]]&&(I=ae);if(I<0)throw new Error("Internal error; couldn't find face name when fixing corners");let ee="";for(let ae=1;ae<C[A].length;ae++){ae===1?ee=C[A][I][0]:ee=ee+M+C[A][I][0];for(let Ie=1;Ie<C[A].length;Ie++)if(C[A][I][1]===C[A][Ie][2]){I=Ie;break}}C[A]=[C[A][0],ee]}this.markedface=q,this.options.verbosity>1&&(console.log(\`# Face names: \${P.map(A=>A[1]).join(" ")}\`),console.log(\`# Edge names: \${Q.map(A=>A[1]).join(" ")}\`),console.log(\`# Vertex names: \${C.map(A=>A[1]).join(" ")}\`));let ie=[];for(let A of Z)ie.push([A[0].makenormal(),A[1],"f"]);for(let A of Q)ie.push([A[0].makenormal(),A[1],"e"]);for(let A of C)ie.push([A[0].makenormal(),A[1],"v"]);this.facenames=P,this.faceplanes=Z,this.edgenames=Q,this.vertexnames=C,this.geonormals=ie;let he=ie.map(A=>A[1]);this.swizzler.setGripNames(he),this.options.verbosity>0&&console.log(\`# Distances: face \${1} edge \${this.edgedistance} vertex \${this.vertexdistance}\`);for(let A=0;A<F.length;A++)for(let k of this.rotations){let T=F[A].rotateplane(k),I=!1;for(let ee of this.moveplanes)if(T.sameplane(ee)){I=!0;break}I||(this.moveplanes.push(T),D[A]&&this.moveplanes2.push(T))}let xe=new tl(d),Je=this.moveplanes2.slice(),Ut=31;for(let A=0;A<Je.length;A++){let k=A+Math.floor((Je.length-A)*(Ut/65536));xe=xe.split(Je[k]),Je[k]=Je[A],Ut=(Ut*1657+101)%65536}let Be=xe.collect([],!0);this.faces=Be,this.options.verbosity>0&&console.log(\`# Faces is now \${Be.length}\`),this.stickersperface=Be.length;let ht=[],ot=Li(d);for(let A of this.rotations){let k=A.rotateface(d);ot.dist(Li(k))<Ue&&ht.push(A)}let pt=new Array(Be.length),ze=[];for(let A=0;A<Be.length;A++){let k=Be[A].centermass();ze.push([ot.dist(k),k,A])}ze.sort((A,k)=>A[0]-k[0]);for(let A=0;A<Be.length;A++){let k=ze[A][2];if(!pt[k]){pt[k]=!0;for(let T of ht){let I=Be[k].rotate(T),ee=I.centermass();for(let ae=A+1;ae<Be.length&&!(ze[ae][0]-ze[A][0]>Ue);ae++){let Ie=ze[ae][2];if(!pt[Ie]&&ee.dist(ze[ae][1])<Ue){pt[Ie]=!0,Be[Ie]=I;break}}}}}this.shortedge=1e99;for(let A of Be)for(let k=0;k<A.length;k++){let T=(k+1)%A.length,I=A.get(k).dist(A.get(T));I<this.shortedge&&(this.shortedge=I)}this.options.verbosity>0&&console.log(\`# Short edge is \${this.shortedge}\`),r==="c"&&S&&!x&&!U&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),r==="c"&&U&&!S&&!x&&(this.addNotationMapper="SkewbMapper"),r==="t"&&(U||S)&&!x&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),r==="o"&&S&&(this.notationMapper=new Yn(this.swizzler,new Jn(["F","D","L","BL","R","U","BR","B"])),x||U||(this.addNotationMapper="FTOMapper")),r==="d"&&S&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new Yn(this.swizzler,new Jn(["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]))<Ue)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(),u=n[1].sub(n[0]),g=u.len()/s;u=u.normalize();let c=u.b,p=u.c,L=a.smul(c).sub(f.smul(p)).smul(g),m=f.smul(c).sum(a.smul(p)).smul(g),d=new W(0,n[0].b-L.dot(l[r]),n[0].c-m.dot(l[r]),0);return[L,m,d]}allstickers(){let t="allstickers";this.faces=AL(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 v=0;v<this.faces.length;v++)this.facecentermass[v]=this.faces[v].centermass();let r=[],n=[];for(let v of this.moveplanes){let z=v.makenormal(),N=!1;for(let b of n)z.sameplane(b.makenormal())&&(N=!0);N||(n.push(z),r.push([]))}for(let v of this.moveplanes2){let z=v.makenormal();for(let N=0;N<n.length;N++)if(z.sameplane(n[N])){r[N].push(v);break}}for(let v=0;v<r.length;v++){let z=r[v].map(b=>b.normalizeplane()),N=n[v];for(let b=0;b<z.length;b++)z[b].makenormal().dist(N)>Ue&&(z[b]=z[b].smul(-1));z.sort((b,E)=>b.a-E.a),r[v]=z}this.moveplanesets=r,this.moveplanenormals=n;let l=r.map(v=>v.length);this.options.verbosity>0&&console.log(\`# Move plane sets: \${l}\`);let o=[];for(let v=0;v<r.length;v++)o.push([]);for(let v of this.rotations){if(Math.abs(Math.abs(v.a)-1)<Ue)continue;let z=v.makenormal();for(let N=0;N<r.length;N++)if(z.sameplane(n[N])){o[N].push(v);break}}this.moverotations=o;for(let v=0;v<o.length;v++){let z=o[v],N=z[0].makenormal();for(let b=0;b<z.length;b++)N.dist(z[b].makenormal())>Ue&&(z[b]=z[b].smul(-1));z.sort((b,E)=>b.angle()-E.angle()),o[v][0].dot(n[v])<0&&z.reverse()}let i=o.map(v=>1+v.length);this.movesetorders=i;let a=[],s="?";for(let v=0;v<r.length;v++){let z=n[v],N=null,b=null;for(let E of this.geonormals){let M=z.dot(E[0]);Math.abs(M-1)<Ue?(b=[E[1],E[2]],s=E[2]):Math.abs(M+1)<Ue&&(N=[E[1],E[2]],s=E[2])}if(b===null||N===null)throw new Error("Saw positive or negative sides as null");a.push([b[0],b[1],N[0],N[1],1+r[v].length]),this.addNotationMapper==="NxNxNCubeMapper"&&s==="f"&&(this.notationMapper=new oo(1+r[v].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&r[0].length===1&&(this.notationMapper=new ao(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 $n(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new io(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&s==="f"&&(1+r[v].length===3&&(this.notationMapper=new lo(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&s==="f"&&(1+r[v].length===3&&(this.notationMapper=new no(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=a;let f=new Map,u=this.faces;for(let v=0;v<u.length;v++){let z=u[v],N=this.keyface(z);if(!f.get(N))f.set(N,[v]);else{let b=f.get(N);if(b.push(v),b.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let E=0;E<b.length;E++){let M=\`\${N} \${E}\`;f.set(M,[b[E]])}}}}this.facelisthash=f,this.options.verbosity>0&&console.log(\`# Cubies: \${f.size}\`);let g=[],c=[],p=[];for(let v of f.values())if(v.length!==this.baseFaceCount){if(v.length>1){let z=v.map(j=>u[j].centermass()),N=Li(z);for(let j=0;v.length>2;j++){let q=!1;for(let ie=0;ie<v.length;ie++){let he=(ie+1)%v.length;if(N.dot(z[ie].cross(z[he]))<0){let xe=z[ie];z[ie]=z[he],z[he]=xe;let Je=v[ie];v[ie]=v[he],v[he]=Je,q=!0}}if(!q)break;if(j>1e3)throw new Error("Bad epsilon math; too close to border")}let b=0;for(let j of v)b|=1<<Math.floor(j/this.stickersperface);let E=this.markedface[b],M=-1;for(let j=0;j<v.length;j++)Math.floor(v[j]/this.stickersperface)===E&&(M=j);if(M<0)throw new Error("Could not find marked face in list");if(M!==0){let j=v.slice();for(let q=0;q<v.length;q++)v[q]=j[(M+q)%v.length]}}for(let z=0;z<v.length;z++){let N=v[z];c[N]=g.length,p[N]=z}g.push(v)}this.cubies=g,this.facetocubie=c,this.facetoord=p;let L=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],m=[],d=[0,0,0,0,0,0],F=[],D=[],S=0,x=[],U=[],P=[],Z=[],C=v=>g[v].map(z=>this.getfaceindex(z)).join(" "),Q=[];for(let v=0;v<g.length;v++){let z=g[v];if(z.length===0||D[v])continue;let N={},b=0;P.push(0),Q.push([]);let E=z.length,M=d[E]++,j=L[E];(j===void 0||E===this.baseFaceCount)&&(j="CORE"),j=j+(M===0?"":M+1),m[S]=j,F[S]=E;let q=[v],ie=0;for(D[v]=!0;ie<q.length;){let he=q[ie++],xe=C(he);if((z.length>1||N[xe]===void 0)&&(N[xe]=b++),Z[he]=N[xe],x[he]=S,Q[S].push(he),U[he]=P[S]++,q.length<this.rotations.length){let Je=this.facecentermass[g[he][0]];for(let Ut of o){let Be=this.facetocubie[this.findface(Je.rotatepoint(Ut[0]))];D[Be]||(q.push(Be),D[Be]=!0)}}}S++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let v=[["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"]],z={};for(let N of v)for(let b=0;b<N.length;b++){let E=0;for(let M=0;M<N[b].length;M++)E|=1<<N[b].charCodeAt(M)-65;z[E]=b}for(let N of Q)for(let b of N){let E=0;for(let M of g[b])E|=1<<this.facenames[this.getfaceindex(M)][1].charCodeAt(0)-65;U[b]=z[E]}}if(this.cubiesetnums=x,this.cubieordnums=U,this.cubiesetnames=m,this.cubieords=P,this.orbitoris=F,this.cubievaluemap=Z,this.cubiesetcubies=Q,this.options.fixedPieceType!==null){for(let v=0;v<g.length;v++)if(this.options.fixedPieceType==="v"&&g[v].length>2||this.options.fixedPieceType==="e"&&g[v].length===2||this.options.fixedPieceType==="f"&&g[v].length===1){this.fixedCubie=v;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 \${P}\`)}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 _(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 g=0;g<this.movesetgeos.length;g++){let c=this.movesetgeos[g];a===c[0]&&(s=!0,o=c,i=g),a===c[2]&&(s=!1,o=c,i=g)}let f=1,u=1;if(n.toUpperCase()!==n&&(u=2),o===void 0)throw new Error(\`Bad grip in move \${t.family}\`);if(t.outerLayer!==void 0&&(f=t.outerLayer),t.innerLayer!==void 0&&(t.outerLayer===void 0?(u=t.innerLayer,n<="Z"?f=u:f=1):u=t.innerLayer),f--,u--,l&&(f=0,u=this.moveplanesets[i].length),f<0||f>this.moveplanesets[i].length||u<0||u>this.moveplanesets[i].length)throw new Error(\`Bad slice spec \${f} \${u} vs \${this.moveplanesets[i].length}\`);if(!SL&&f===0&&u===this.moveplanesets[i].length&&!l)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,i,f,u,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),i=this.basefaces[o].centermass();if(i.dist(this.facecentermass[l])<Ue){let a=1<<o|1<<this.baseFaceCount,s=this.markedface[a],f=this.baseplanes[s].makenormal(),u=-1,g=-1;for(let L=0;L<this.faces[l].length;L++){let m=this.faces[l].get(L),d=f.dot(m.sub(i));d>u&&(u=d,g=L)}let c=(g+1)%this.faces[l].length;if(Math.abs(f.dot(this.faces[l].get(c).sub(i))-u)<Ue&&(g=c),g!==0){let L=[];for(let m=0;m<this.faces[l].length;m++)L.push(this.faces[l].get((m+g)%this.faces[l].length));this.faces[l]=new vr(L)}let p=this.basefaces[o].length;for(let L=1;L<p;L++)this.cubies[n].push(this.cubies[n][L-1]);this.duplicatedFaces[l]=p,this.duplicatedCubies[n]=p,this.orbitoris[this.cubiesetnums[n]]=p}}}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 u=0;u<this.faces.length;u++){let g=0;if(l.length>0){let c=this.facecentermass[u].dot(l[0]);for(let p=a;p>0;p>>=1)g+p<=l.length&&c>l[g+p-1].a&&(g+=p);g=l.length-g}for(o.push(g);i.length<=g;)i.push(0);i[g]++}let s=new Array(i.length);for(let u=0;u<i.length;u++)s[u]=[];let f=[];for(let u=0;u<this.faces.length;u++){if(o[u]<0)continue;let g=[this.facetocubie[u],this.facetoord[u]],c=this.facecentermass[u],p=c,L=u,m=o[L];for(;;){o[L]=-1;let d=c.rotatepoint(this.moverotations[n][0]);if(d.dist(p)<Ue)break;L=this.findface(d),g.push(this.facetocubie[L],this.facetoord[L]),c=d}if(g.length>2&&this.options.orientCenters&&(this.cubies[g[0]].length===1||this.duplicatedCubies[g[0]]>1)&&this.facecentermass[u].dist(this.basefaces[this.getfaceindex(u)].centermass())<Ue){let d=this.faces[this.cubies[g[0]][0]];for(let F=0;F<g.length;F+=2){let D=this.faces[this.cubies[g[F]][0]],S=-1;for(let x=0;x<d.length;x++)if(D.get(x).dist(d.get(0))<Ue){S=x;break}if(S<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");g[F+1]=S,d=d.rotate(this.moverotations[n][0])}}if(g.length===2&&this.options.orientCenters)for(let d=1;d<this.movesetorders[n];d++)m===0?g.push(g[0],d):g.push(g[0],(this.movesetorders[n]-d)%this.movesetorders[n]);if(g.length>2&&!f[g[0]]){if(g.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let d of g)s[m].push(d)}for(let d=0;d<g.length;d+=2)f[g[d]]=!0}for(let u=0;u<s.length;u++)s[u]=s[u].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+yL+\`
|
|
7
7
|
\`+t+\`
|
|
8
|
-
\`}writegap(){let t=this.getOrbitsDef(!1),r=[],n=[];for(let o=0;o<t.moveops.length;o++){let i=\`M_\${
|
|
8
|
+
\`}writegap(){let t=this.getOrbitsDef(!1),r=[],n=[];for(let o=0;o<t.moveops.length;o++){let i=\`M_\${gi(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(\`
|
|
9
9
|
\`)}writeksolve(t="PuzzleGeometryPuzzle"){let r=this.getOrbitsDef(!1);return this.header("# ")+r.toKsolve(t,this.notationMapper).join(\`
|
|
10
|
-
\`)}getKPuzzleDefinition(t=!0,r=!0){let l=this.getOrbitsDef(t,r).toKPuzzleDefinition(r);if(l.experimentalPuzzleDescription=this.puzzleDescription,!l)throw new Error("Missing definition!");return l}getMoveFromBits(t,r,n,l,o,i){let a=[],s=[],f=[];for(let c of this.cubieords)s.push(
|
|
10
|
+
\`)}getKPuzzleDefinition(t=!0,r=!0){let l=this.getOrbitsDef(t,r).toKPuzzleDefinition(r);if(l.experimentalPuzzleDescription=this.puzzleDescription,!l)throw new Error("Missing definition!");return l}getMoveFromBits(t,r,n,l,o,i){let a=[],s=[],f=[];for(let c of this.cubieords)s.push(jt(c)),f.push(Sr(c));for(let c=t[0];c<=t[1];c++){let p=l[c];for(let L=0;L<p.length;L+=2*i){let m=p.slice(L,L+2*i),d=this.cubiesetnums[m[0]];for(let S=0;S<m.length;S+=2)m[S]=this.cubieordnums[m[S]];let F=2,D=3;n&&(F=m.length-2,D=m.length-1),s[d]===jt(this.cubieords[d])&&(s[d]=s[d].slice(),this.orbitoris[d]>1&&!this.options.fixedOrientation&&(f[d]=f[d].slice()));for(let S=0;S<m.length;S+=2)s[d][m[(S+F)%m.length]]=m[S],this.orbitoris[d]>1&&!this.options.fixedOrientation&&(f[d][m[S]]=(m[(S+D)%m.length]-m[(S+1)%m.length]+2*this.orbitoris[d])%this.orbitoris[d])}}let u=new qt(jt(24),Sr(24),1);for(let c=0;c<this.cubiesetnames.length;c++)if(!(o&&!o[c]))if(this.orbitoris[c]===1||this.options.fixedOrientation)s[c]===jt(u.perm.length)?(s[c]!==u.perm&&(u=new qt(s[c],f[c],1)),a.push(u)):a.push(new qt(s[c],f[c],1));else{let p=new Array(f[c].length);for(let L=0;L<s[c].length;L++)p[L]=f[c][s[c][L]];a.push(new qt(s[c],p,this.orbitoris[c]))}let g=new lr(a);return r!==1&&(g=g.mulScalar(r)),g}omitSet(t){for(let r of this.options.excludeOrbits)if(r===t)return!0;return!1}diffmvsets(t,r,n,l){for(let o=0;o<t.length;o+=2){let i=!1;for(let a=0;!i&&a<r.length;a+=2)l?t[o][0]+r[a][1]===n&&t[o][1]+r[a][0]===n&&t[o+1]===r[a+1]&&(i=!0):t[o][0]===r[a][0]&&t[o][1]===r[a][1]&&t[o+1]===r[a+1]&&(i=!0);if(!i)return!0}return!1}getOrbitsDef(t,r=!0){let n=[];if(t)for(let m=0;m<this.cubiesetnames.length;m++)n.push(1);let l=[],o=[],i=[],a=[];for(let m=0;m<this.moveplanesets.length;m++){let d=this.getmovesets(m);i.push(d),this.options.addRotations?a.push(1):a.push(0)}let s=[];for(let m=0;m<this.moveplanesets.length;m++){let d=this.moveplanesets[m].length,F=!1,D=i[m];for(let S=0;S<D.length;S+=2)D[S][0]===0&&D[S][1]===d&&(F=!0);s[m]=F}if(this.options.addRotations&&(this.options.moveList||this.options.fixedPieceType!==null)){for(let m=0;m<this.moverotations.length;m++)a[m]=0;for(let m=0;m<this.moveplanesets.length;m++){if(s[m]){a[m]=3;continue}for(let d=0;d<this.moverotations.length;d++){let F=this.moveplanenormals[m];for(let D=1;D*2<=this.movesetorders[d];D++){if(F=F.rotatepoint(this.moverotations[d][0]),a[d]&D)continue;let S=-1,x=!1;for(let P=0;P<this.moveplanenormals.length;P++)if(F.dist(this.moveplanenormals[P])<Ue){S=P;break}else if(F.dist(this.moveplanenormals[P].smul(-1))<Ue){S=P,x=!0;break}if(S<0)throw new Error("Could not find rotation");let U=i[S];(U.length!==i[m].length||this.moveplanesets[m].length!==this.moveplanesets[S].length||this.diffmvsets(U,i[m],this.moveplanesets[S].length,x))&&(a[d]|=D)}}}for(let m=0;m<this.moverotations.length;m++)if(a[m]===0)a[m]=1;else if(a[m]===1)this.movesetorders[m]>3?a[m]=2:a[m]=0;else if(a[m]===3)a[m]=0;else throw new Error("Impossible addrot val")}for(let m=0;m<this.moveplanesets.length;m++)a[m]!==0&&!s[m]&&(i[m].push([0,this.moveplanesets[m].length]),i[m].push(a[m]));for(let m=0;m<this.moveplanesets.length;m++){let d=i[m],F=this.movesetorders[m];for(let x=0;x<d.length;x+=2)for(let U=0;U<x;U+=2)if(d[x][0]===d[U][0]&&d[x][1]===d[U][1])throw new Error("Redundant moves in moveset.");let D=[];for(let x=0;x<d.length;x+=2)for(let U=d[x][0];U<=d[x][1];U++)D[U]=1;let S=this.cmovesbyslice[m];for(let x=0;x<S.length;x++){if(D[x]!==1)continue;let U=S[x];for(let P=0;P<U.length;P+=2*F){if(this.skipcubie(U[P]))continue;let Z=this.cubiesetnums[U[P]];n[Z]=1}}}for(let m=0;m<this.cubiesetnames.length;m++)if(!!n[m]){if(this.omitSet(this.cubiesetnames[m])){n[m]=0;continue}l.push(this.cubiesetnames[m]),o.push(new el(this.cubieords[m],this.options.fixedOrientation?1:this.orbitoris[m]))}let f=[];for(let m=0;m<this.cubiesetnames.length;m++){if(!n[m]||this.omitSet(this.cubiesetnames[m]))continue;let d=[],F=[];for(let D=0;D<this.cubieords[m];D++){if(t)d.push(D);else{let S=this.cubiesetcubies[m][D];d.push(this.cubievaluemap[S])}F.push(0)}f.push(new qt(d,F,this.options.fixedOrientation?1:this.orbitoris[m]))}let u=[],g=[],c=[],p=[];if(r)for(let m=0;m<this.moveplanesets.length;m++){let F=this.moveplanesets[m].length,D=i[m],S=this.movesetgeos[m];for(let x=0;x<D.length;x+=2){let U=D[x],P,Z=!1;if(this.parsedmovelist!==void 0)for(let Q of this.parsedmovelist){if(Q[1]!==m)continue;let v=[];Q[4]?v=[Q[2],Q[3]]:v=[F-Q[3],F-Q[2]],v[0]===U[0]&&v[1]===U[1]&&(P=Q[0],Z=!Q[4])}if(P)u.push(P),g.push(!0);else{let Q=wL(S,U,F);Z=Q[1];let v=Q[0];D[x+1]===1?u.push(v):u.push(v+D[x+1]),g.push(!1)}p.push(U[0]===0&&U[1]===F);let C=this.getMoveFromBits(U,D[x+1],Z,this.cmovesbyslice[m],n,this.movesetorders[m]);c.push(C)}}let L=new sn(l,o,new fn(f),u,c,p,g);return this.options.optimizeOrbits&&(L=L.optimize()),this.options.scrambleAmount!==0&&L.scramble(this.options.scrambleAmount),L}getScramble(t=0){let r=this.getOrbitsDef(!1);return r.transformToKTransformationData(r.getScrambleTransformation(t))}getMovesAsPerms(){return this.getOrbitsDef(!1).moveops.map(t=>t.toPerm())}showcanon(t){Gf(this.getOrbitsDef(!1),t)}getsolved(){let t=[];for(let r=0;r<this.baseFaceCount;r++)for(let n=0;n<this.stickersperface;n++)t.push(r);return new Bt(t)}getOrientationRotation(t){let[r,[n,l,o]]=t[0],i=new W(0,n,-l,o),[a,[s,f,u]]=t[1],g=new W(0,s,-f,u),c=null,p=null,L=this.swizzler.unswizzle(r),m=this.swizzler.unswizzle(a);for(let S of this.geonormals)L===S[1]&&(c=S[0]),m===S[1]&&(p=S[0]);if(!c)throw new Error(\`Could not find feature \${r}\`);if(!p)throw new Error(\`Could not find feature \${a}\`);let d=c.pointrotation(i);return p.rotatepoint(d).unproject(i).pointrotation(g.unproject(i)).mul(d)}getInitial3DRotation(){let t=this.baseFaceCount,r=null;if(this.options.puzzleOrientation?r=this.options.puzzleOrientation:this.options.puzzleOrientations&&(r=this.options.puzzleOrientations[t]),r||(r=bL()[t]),!r)throw new Error("No default orientation?");return this.getOrientationRotation(r)}generate2dmapping(t=800,r=500,n=10,l=!1,o=.92){t-=2*n,r-=2*n;function i(b,E){let M=b[1][0]-b[0][0],j=b[1][1]-b[0][1],q=2*Math.PI/E,ie=Math.cos(q),he=Math.sin(q);for(let xe=2;xe<E;xe++){let Je=M*ie+j*he;j=j*ie-M*he,M=Je,b.push([b[xe-1][0]+M,b[xe-1][1]+j])}}this.genperms();let f=this.getboundarygeometry().facenames[0][0].length,u=this.net;if(u===null)throw new Error("No net?");let g={},c=0,p=0,L=1,m=0;g[u[0][0]]=[[1,0],[0,0]],i(g[u[0][0]],f);for(let b of u){let E=b[0];if(!g[E])throw new Error("Bad edge description; first edge not connected.");for(let M=1;M<b.length;M++){let j=b[M];j===""||g[j]||(g[j]=[g[E][M%f],g[E][(M+f-1)%f]],i(g[j],f))}}for(let b in g){let E=g[b];for(let M of E)c=Math.min(c,M[0]),L=Math.max(L,M[0]),p=Math.min(p,M[1]),m=Math.max(m,M[1])}let d=Math.min(t/(L-c),r/(m-p)),F=.5*(t-d*(L+c)),D=.5*(r-d*(m+p)),S={},x=this.getboundarygeometry(),U={},P=[[d+F,D],[F,D]];U[u[0][0]]=P,i(U[u[0][0]],f),S[this.facenames[0][1]]=this.project2d(0,0,[new W(0,P[0][0],P[0][1],0),new W(0,P[1][0],P[1][1],0)]);let Z=[];Z[0]=0;for(let b of u){let E=b[0];if(!U[E])throw new Error("Bad edge description; first edge not connected.");let M=-1;for(let q=0;q<x.facenames.length;q++)if(E===x.facenames[q][1]){M=q;break}if(M<0)throw new Error(\`Could not find first face name \${E}\`);let j=x.facenames[M][0];for(let q=1;q<b.length;q++){let ie=b[q];if(ie===""||U[ie])continue;U[ie]=[U[E][q%f],U[E][(q+f-1)%f]],i(U[ie],f);let he=Z[M],xe=j[(he+q)%f].sum(j[(he+q+f-1)%f]).smul(.5),Je=hi(x.edgenames,xe),Ut=x.edgenames[Je][1],Be=EL(Ut,this.facenames),ht=Be[E===Be[0]?1:0],ot=-1;for(let ze=0;ze<x.facenames.length;ze++)if(ht===x.facenames[ze][1]){ot=ze;break}if(ot<0)throw new Error("Could not find second face name");let pt=x.facenames[ot][0];for(let ze=0;ze<pt.length;ze++)if(pt[ze].sum(pt[(ze+1)%f]).smul(.5).dist(xe)<=Ue){let k=U[E][(q+f-1)%f],T=U[E][q%f];Z[ot]=ze,S[ht]=this.project2d(ot,ze,[new W(0,T[0],T[1],0),new W(0,k[0],k[1],0)]);break}}}let C=0,Q=0,v=this.getInitial3DRotation();for(let b of this.faces){l&&(b=b.rotate(v));for(let E=0;E<b.length;E++)C=Math.max(C,Math.abs(b.get(E).b)),Q=Math.max(Q,Math.abs(b.get(E).c))}let z=Math.min(r/Q/2,(t-n)/C/4);return(b,E)=>{if(l){E=E.rotatepoint(v);let M=.5*n+.25*t,j=this.baseplanes[b].rotateplane(v).d<0?1:-1;return[n+t*.5+j*(M-E.b*z),n+r*.5+E.c*z]}else{let M=S[this.facenames[b][1]];return[n+o*E.dot(M[0])+M[2].b,n+r-o*E.dot(M[1])-M[2].c]}}}generatesvg(t=800,r=500,n=10,l=!1){let o=this.generate2dmapping(t,r,n,l);function i(c,p,L){return\`<polygon id="\${c}" class="sticker" style="fill: \${L}" points="\${p.map(m=>\`\${m[0]} \${m[1]}\`).join(" ")}"/>
|
|
11
11
|
\`}let a=this.getsolved(),s=[],f=[];for(let c=0;c<this.baseFaceCount;c++)s[c]=this.colors[this.facenames[c][1]];for(let c=0;c<this.faces.length;c++){let p=this.faces[c],L=Math.floor(c/this.stickersperface),m=[];for(let d=0;d<p.length;d++)m.push(o(L,p.get(d)));f.push(m)}let u=[];for(let c=0;c<this.baseFaceCount;c++){u.push("<g>"),u.push(\`<title>\${this.facenames[c][1]}</title>
|
|
12
|
-
\`);for(let p=0;p<this.stickersperface;p++){let L=c*this.stickersperface+p,m=this.facetocubie[L],d=this.facetoord[L],F=this.cubiesetnums[m],
|
|
12
|
+
\`);for(let p=0;p<this.stickersperface;p++){let L=c*this.stickersperface+p,m=this.facetocubie[L],d=this.facetoord[L],F=this.cubiesetnums[m],D=this.cubieordnums[m],S=this.graybyori(m)?"#808080":s[a.p[L]],x=\`\${this.cubiesetnames[F]}-l\${D}-o\${d}\`;if(u.push(i(x,f[L],S)),this.duplicatedFaces[L])for(let U=1;U<this.duplicatedFaces[L];U++)x=\`\${this.cubiesetnames[F]}-l\${D}-o\${U}\`,u.push(i(x,f[L],S))}u.push("</g>")}return\`<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 800 500">
|
|
13
13
|
<style type="text/css"><![CDATA[.sticker { stroke: #000000; stroke-width: 1px; }]]></style>
|
|
14
|
-
\${u.join("")}</svg>\`}get3d(t){let r=[],n=this.getInitial3DRotation(),l=[],o=.52*this.basefaces[0].get(0).len();for(let f=0;f<this.basefaces.length;f++){let u=this.basefaces[f].rotate(n),g=this.facenames[f][1];l.push({coords:
|
|
14
|
+
\${u.join("")}</svg>\`}get3d(t){let r=[],n=this.getInitial3DRotation(),l=[],o=.52*this.basefaces[0].get(0).len();for(let f=0;f<this.basefaces.length;f++){let u=this.basefaces[f].rotate(n),g=this.facenames[f][1];l.push({coords:ks(u,o),name:g})}for(let f=0;f<this.faces.length;f++){let u=Math.floor(f/this.stickersperface),g=this.facetocubie[f],c=this.facetoord[f],p=this.cubiesetnums[g],L=this.cubieordnums[g],m=this.graybyori(g)?"#808080":this.colors[this.facenames[u][1]];t?.stickerColors&&(m=t.stickerColors[f]);let d=this.faces[f].rotate(n);r.push({coords:ks(d,o),color:m,orbit:this.cubiesetnames[p],ord:L,ori:c,face:u});let F=d;if(this.duplicatedFaces[f]){let D=F.length/this.duplicatedFaces[f];for(let S=1;S<this.duplicatedFaces[f];S++){for(let x=0;x<D;x++)F=F.rotateforward();r.push({coords:ks(F,o),color:m,orbit:this.cubiesetnames[p],ord:L,ori:S,face:u,isDup:!0})}}}let i=[];for(let f=0;f<this.movesetgeos.length;f++){let u=this.movesetgeos[f],g=this.movesetorders[f];for(let c of this.geonormals)u[0]===c[1]&&u[1]===c[2]&&(i.push({coordinates:Fi(c[0].rotatepoint(n),1),quantumMove:new B(u[0]),order:g}),i.push({coordinates:Fi(c[0].rotatepoint(n).smul(-1),1),quantumMove:new B(u[2]),order:g}))}let a=this.generate2dmapping(2880,2160,0,!1,1),s=function(){let f=n.invrot();return function(u,g){let c=new W(0,g[0]*o,-g[1]*o,g[2]*o);c=c.rotatepoint(f);let p=a(u,c);return p[0]/=2880,p[1]=1-p[1]/2160,p}}().bind(this);return{stickers:r,faces:l,axis:i,unswizzle:this.unswizzle.bind(this),notationMapper:this.notationMapper,textureMapper:{getuv:s}}}getGeoNormal(t){let r=this.getInitial3DRotation(),n=this.swizzler.unswizzle(t);for(let l of this.geonormals)if(n===l[1]){let o=Fi(l[0].rotatepoint(r),1);return Math.abs(o[0])<Ue&&Math.abs(o[2])<Ue&&(o[0]=0,o[2]=1e-6),o}}getfaceindex(t){let r=this.stickersperface;return Math.floor(t/r)}textForTwizzleExplorer(){return\`Faces \${this.baseplanerot.length}
|
|
15
15
|
Stickers per face \${this.stickersperface}
|
|
16
16
|
Short edge \${this.shortedge}
|
|
17
17
|
Cubies \${this.cubies.length}
|
|
18
18
|
Edge distance \${this.edgedistance}
|
|
19
|
-
Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrbitsDef(!1).reassemblySize();t(\`Reassembly size is \${n}\`);let l=
|
|
19
|
+
Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrbitsDef(!1).reassemblySize();t(\`Reassembly size is \${n}\`);let l=Ri(this.getMovesAsPerms(),t),o=n/l;t(\`Ratio is \${o}\`)}},Di=class{constructor(t,r){this.pg=t;this.orbitNames=r.orbitnames}lookupMove(t){let r=this.pg.parseMove(t);if(this.pg.parsedmovelist){let i=!1;for(let a of this.pg.parsedmovelist)a[1]===r[1]&&a[2]===r[2]&&a[3]===r[3]&&a[4]===r[4]&&(i=!0);if(!i)return null}let n=[r[2],r[3]];if(!r[4]){let i=this.pg.moveplanesets[r[1]].length;n=[i-r[3],i-r[2]]}let l=this.pg.getMoveFromBits(n,r[5],!r[4],this.pg.cmovesbyslice[r[1]],void 0,this.pg.movesetorders[r[1]]);return sn.transformToKTransformationData(this.orbitNames,l)}}});var rl={};mt(rl,{EXPERIMENTAL_PUZZLE_BASE_SHAPES:()=>e1,EXPERIMENTAL_PUZZLE_CUT_TYPES:()=>t1,ExperimentalPGNotation:()=>Di,PuzzleGeometry:()=>uo,Quat:()=>W,getPG3DNamedPuzzles:()=>Yf,getPuzzleDescriptionString:()=>$f,getPuzzleGeometryByDesc:()=>_s,getPuzzleGeometryByName:()=>r1,parseOptions:()=>If,parsePuzzleDescription:()=>so,schreierSims:()=>Ri});var nl=y(()=>{"use strict";fo();ys();Bi();Es();fo();fo()});async function un(e){return(await Promise.resolve().then(()=>(nl(),rl))).getPuzzleGeometryByName(e,{allMoves:!0,orientCenters:!0,addRotations:!0})}async function kL(e,t){let r=await e,n=r.getKPuzzleDefinition(!0);n.name=t;let l=await Promise.resolve().then(()=>(nl(),rl)),o=new l.ExperimentalPGNotation(r,r.getOrbitsDef(!0));return new Ae(n,{experimentalPGNotation:o})}var Ai,yi,Si,dt,or,ir=y(()=>{"use strict";He();ro();Et();dt=class{constructor(t){J(this,Ai,void 0);J(this,yi,void 0);J(this,Si,void 0);this.pgId=t.pgID,this.id=t.id,this.fullName=t.fullName,this.inventedBy=t.inventedBy,this.inventionYear=t.inventionYear}pg(){return R(this,Ai)??V(this,Ai,un(this.pgId??this.id))}kpuzzle(){return R(this,yi)??V(this,yi,kL(this.pg(),this.id))}svg(){return R(this,Si)??V(this,Si,(async()=>(await this.pg()).generatesvg())())}};Ai=new WeakMap,yi=new WeakMap,Si=new WeakMap;or=class extends dt{constructor(){super(...arguments);this.stickerings=Zn}stickeringMask(r){return nr(this,r)}}});var _t,n1=y(()=>{"use strict";_t={name:"2x2x2",orbits:{CORNERS:{numPieces:8,numOrientations:3}},startStateData:{CORNERS:{pieces:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]}},moves:{U:{CORNERS:{permutation:[1,2,3,0,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]}},y:{CORNERS:{permutation:[1,2,3,0,7,4,5,6],orientation:[0,0,0,0,0,0,0,0]}},x:{CORNERS:{permutation:[4,0,3,5,7,6,2,1],orientation:[2,1,2,1,1,2,1,2]}},L:{CORNERS:{permutation:[0,1,6,2,4,3,5,7],orientation:[0,0,2,1,0,2,1,0]}},F:{CORNERS:{permutation:[3,1,2,5,0,4,6,7],orientation:[1,0,0,2,2,1,0,0]}},R:{CORNERS:{permutation:[4,0,2,3,7,5,6,1],orientation:[2,1,0,0,1,0,0,2]}},B:{CORNERS:{permutation:[0,7,1,3,4,5,2,6],orientation:[0,2,1,0,0,0,2,1]}},D:{CORNERS:{permutation:[0,1,2,3,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]}},z:{CORNERS:{permutation:[3,2,6,5,0,4,7,1],orientation:[1,2,1,2,2,1,2,1]}}}};_t.moves.Rv=_t.moves.x;_t.moves.Uv=_t.moves.y;_t.moves.Fv=_t.moves.z;_t.moves.Lv={CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]}};_t.moves.Dv={CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]}};_t.moves.Bv={CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]}}});var l1,o1=y(()=>{"use strict";l1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
20
20
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
|
21
21
|
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd">
|
|
22
22
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 520 394" preserveAspectRatio="xMidYMid meet">
|
|
@@ -60,7 +60,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
60
60
|
<use id="CORNERS-l7-o2" xlink:href="#sticker" transform="translate(6.6, 3.2)" style="fill: #26f"/>
|
|
61
61
|
</g>
|
|
62
62
|
|
|
63
|
-
</svg>\`});var
|
|
63
|
+
</svg>\`});var i1,a1=y(()=>{"use strict";i1={name:"clock",orbits:{DIALS:{numPieces:18,numOrientations:12},FACES:{numPieces:18,numOrientations:1},FRAME:{numPieces:1,numOrientations:2}},startStateData:{DIALS:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{pieces:[0],orientation:[0]}},moves:{UR_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,1,1,0,1,1,0,0,0,-1,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},DR_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,-1,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},DL_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,-1]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},UL_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[1,1,0,1,1,0,0,0,0,0,0,-1,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},U_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[1,1,1,1,1,1,0,0,0,-1,0,-1,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},R_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,1,1,0,1,1,0,1,1,-1,0,0,0,0,0,-1,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},D_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,-1,0,-1]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},L_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[1,1,0,1,1,0,1,1,0,0,0,-1,0,0,0,0,0,-1]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},ALL_PLUS_:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[1,1,1,1,1,1,1,1,1,-1,0,-1,0,0,0,-1,0,-1]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},y2:{DIALS:{permutation:[9,10,11,12,13,14,15,16,17,0,1,2,3,4,5,6,7,8],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[9,10,11,12,13,14,15,16,17,0,1,2,3,4,5,6,7,8],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[1]}},UL:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},UR:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},DL:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}},DR:{DIALS:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FACES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},FRAME:{permutation:[0],orientation:[0]}}}}});var s1,f1=y(()=>{"use strict";s1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
64
64
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 480 240" preserveAspectRatio="xMidYMid meet">
|
|
65
65
|
<title>clock</title>
|
|
66
66
|
<defs>
|
|
@@ -428,7 +428,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
428
428
|
</g>
|
|
429
429
|
</g>
|
|
430
430
|
</g>
|
|
431
|
-
</svg>\`});var
|
|
431
|
+
</svg>\`});var u1,g1=y(()=>{"use strict";u1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
432
432
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
|
433
433
|
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd">
|
|
434
434
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-20 -20 546 480" preserveAspectRatio="xMidYMid meet">
|
|
@@ -515,7 +515,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
515
515
|
<use id="EDGES-l4-o1" xlink:href="#stickerV" transform="translate(1, 1)" style="fill: red"/>
|
|
516
516
|
</g>
|
|
517
517
|
|
|
518
|
-
</svg>\`});var
|
|
518
|
+
</svg>\`});var c1,p1=y(()=>{"use strict";c1={name:"Square-1",orbits:{WEDGES:{numPieces:24,numOrientations:9},EQUATOR:{numPieces:2,numOrientations:6}},startStateData:{WEDGES:{pieces:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},EQUATOR:{pieces:[0,1],orientation:[0,0]}},moves:{U_SQ_:{WEDGES:{permutation:[11,0,1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},EQUATOR:{permutation:[0,1],orientation:[0,0]}},D_SQ_:{WEDGES:{permutation:[0,1,2,3,4,5,6,7,8,9,10,11,23,12,13,14,15,16,17,18,19,20,21,22],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},EQUATOR:{permutation:[0,1],orientation:[0,0]}},_SLASH_:{WEDGES:{permutation:[0,1,2,3,4,5,12,13,14,15,16,17,6,7,8,9,10,11,18,19,20,21,22,23],orientation:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},EQUATOR:{permutation:[0,1],orientation:[0,3]}}}}});var m1,L1=y(()=>{"use strict";m1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
519
519
|
<svg width="360px" height="552px" viewBox="0 0 360 552" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
520
520
|
<!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
|
|
521
521
|
<title>sq1-fancy</title>
|
|
@@ -809,7 +809,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
809
809
|
<line x1="0.15767665" y1="262.276878" x2="70.4345542" y2="2.27488928e-16" id="TOP"></line>
|
|
810
810
|
</g>
|
|
811
811
|
</g>
|
|
812
|
-
</svg>\`});var
|
|
812
|
+
</svg>\`});var xr={};mt(xr,{clockJSON:()=>i1,clockSVG:()=>s1,cube2x2x2JSON:()=>_t,cube2x2x2SVG:()=>l1,pyraminxSVG:()=>u1,sq1HyperOrbitJSON:()=>c1,sq1HyperOrbitSVG:()=>m1});var Ur=y(()=>{"use strict";n1();o1();a1();f1();g1();p1();L1()});var go,B1=y(()=>{"use strict";He();ir();Et();ro();go={id:"2x2x2",fullName:"2\\xD72\\xD72 Cube",kpuzzle:de(async()=>new Ae((await Promise.resolve().then(()=>(Ur(),xr))).cube2x2x2JSON)),svg:async()=>(await Promise.resolve().then(()=>(Ur(),xr))).cube2x2x2SVG,pg:de(async()=>un("2x2x2")),stickeringMask:e=>nr(go,e),stickerings:Zn}});var vi,d1=y(()=>{"use strict";vi={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]}}}};vi.experimentalDerivedMoves={Uw:"u",Lw:"l",Fw:"f",Rw:"r",Bw:"b",Dw:"d",Uv:"y",Lv:"x'",Fv:"z",Rv:"x",Bv:"z'",Dv:"y'","2U":"u U'","2L":"l L'","2F":"f F'","2R":"r R'","2B":"b B'","2D":"d D'"}});function zs(e){let t=e.stateData.CENTERS.pieces[0],r=e.stateData.CENTERS.pieces[5],n=e.stateData.CENTERS.pieces[1],l=n;return t<n&&l--,r<n&&l--,[t,l]}function h1(){if(!_L){let e=["","z","x","z'","x'","x2"].map(r=>w.fromString(r)),t=new w("y");for(let r of e){let n=xi.algToTransformation(r);for(let l=0;l<4;l++){n=n.applyAlg(t);let[o,i]=zs(n.toKState());R1[o][i]=n.invert()}}}return R1}function F1(e){let[t,r]=zs(e),n=h1()[t][r];return e.applyTransformation(n)}function Cs(e,t){return t.ignorePuzzleOrientation&&(e=F1(e)),t.ignoreCenterOrientation&&(e=new ce(e.kpuzzle,{EDGES:e.stateData.EDGES,CORNERS:e.stateData.CORNERS,CENTERS:{pieces:e.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}})),!!e.experimentalToTransformation()?.isIdentityTransformation()}var R1,_L,Ns=y(()=>{"use strict";fe();He();Ps();R1=new Array(6).fill(0).map(()=>new Array(6)),_L=!1});var D1=y(()=>{"use strict";He()});var xi,Ps=y(()=>{"use strict";He();d1();Ns();Ns();Rs();D1();to();to();xi=new Ae(vi);vi.experimentalIsStateSolved=Cs});function Ge(e,t,r,n){let l=[];for(let o of e){let i=B.fromString(o),{family:a,amount:s}=i;if(![-1,1].includes(s))throw new Error("Invalid config move");l.push({family:a,direction:s,type:t,from:r,to:n})}return l}function A1(e,t){let r=S1[e][t]?.[0];if(!r)throw new Error(\`Could not find a reference move (axis: \${e}, move source type: \${t})\`);return r}function CL(e,t,r,n){if(t+1===r){let c=v1[e].get(t);if(c)return new B(new _(c.family),n*c.direction)}let l=gn[e],{sliceDiameter:o}=l;if(t===0&&r===o){let c=A1(e,5);return new B(new _(c.family),n*c.direction)}let i=t+r>o;i&&([t,r]=[o-r,o-t]);let a=t+1,s=r,f=a===s;f&&(s=null),a===1&&(a=null),f&&a===1&&(s=null),!f&&s===2&&(s=null);let g=A1(e,f?i?1:0:i?3:2);return new B(new _(g.family,s,a),n*g.direction)}function NL(e,t=!0){if(e.length===0)return[];let r=co[e[0].family].axis,n=gn[r],{sliceDiameter:l}=n,o=new Map,i=null;function a(c,p){let L=(o.get(c)??0)+p;t&&(L=L%4+5%4-1),L===0?o.delete(c):o.set(c,L)}let s=0;for(let c of Array.from(e).reverse()){s++;let{moveSourceInfo:p}=co[c.family],L=c.amount*p.direction;switch(p.type){case 0:{let m=(c.innerLayer??1)-1;a(m,L),a(m+1,-L);break}case 1:{let m=l-(c.innerLayer??1);a(m,L),a(m+1,-L);break}case 2:{a((c.outerLayer??1)-1,L),a(c.innerLayer??2,-L);break}case 3:{a(l-(c.innerLayer??2),L),a(l-((c.outerLayer??1)-1),-L);break}case 4:{a(p.from,L),a(p.to,-L);break}case 5:{a(0,L),a(l,-L);break}}[0,2].includes(o.size)&&(i={suffixLength:s,sliceDeltas:new Map(o)})}if(o.size===0)return[];if(!i)return e;let[f,u]=i.sliceDeltas.keys();f>u&&([f,u]=[u,f]);let g=i.sliceDeltas.get(f);return[...e.slice(0,-i.suffixLength),...g!==0?[CL(r,f,u,g)]:[]]}var gn,co,S1,y1,v1,zL,x1,U1=y(()=>{"use strict";fe();gn={["x axis"]:{sliceDiameter:3,extendsThroughEntirePuzzle:!0,moveSourceInfos:[...Ge(["R"],0,0,3),...Ge(["L'"],1,0,3),...Ge(["r","Rw"],2,0,2),...Ge(["l'","Lw'"],3,0,2),...Ge(["M'"],4,1,2),...Ge(["x","Uv","Dv'"],5,0,3)]},["y axis"]:{sliceDiameter:3,extendsThroughEntirePuzzle:!0,moveSourceInfos:[...Ge(["U"],0,0,3),...Ge(["D'"],1,0,3),...Ge(["u","Uw"],2,0,2),...Ge(["d'","Dw'"],3,0,2),...Ge(["E'"],4,1,2),...Ge(["y","Uv","Dv'"],5,0,3)]},["z axis"]:{sliceDiameter:3,extendsThroughEntirePuzzle:!0,moveSourceInfos:[...Ge(["F"],0,0,3),...Ge(["B'"],1,0,3),...Ge(["f","Fw"],2,0,3),...Ge(["b'","Bw'"],3,0,3),...Ge(["S"],4,1,2),...Ge(["z","Fv","Bv'"],5,0,3)]}},co={};for(let[e,t]of Object.entries(gn))for(let r of t.moveSourceInfos)co[r.family]={axis:e,moveSourceInfo:r};S1={};for(let e of Object.keys(gn)){let t={};S1[e]=t;for(let r of gn[e].moveSourceInfos)(t[y1=r.type]??(t[y1]=[])).push(r)}v1={};for(let e of Object.keys(gn)){let t=new Map;v1[e]=t;for(let r of gn[e].moveSourceInfos)t.get(r.from)||t.set(r.from,r)}zL=(e,t)=>co[e.family].axis===co[t.family].axis;x1={quantumMoveOrder:()=>4,axis:{areQuantumMovesSameAxis:zL,simplifySameAxisMoves:NL}}});var PL,b1=y(()=>{"use strict";PL=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
813
813
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
|
814
814
|
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd">
|
|
815
815
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 518 392" preserveAspectRatio="xMidYMid meet">
|
|
@@ -936,7 +936,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
936
936
|
<use id="CENTERS-l5-o3" xlink:href="#sticker" transform="translate(4.3,7.5)" style="fill: yellow"/>
|
|
937
937
|
</g>
|
|
938
938
|
|
|
939
|
-
</svg>\`});var
|
|
939
|
+
</svg>\`});var ML,w1=y(()=>{"use strict";ML=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
940
940
|
<svg width="288px" height="288px" viewBox="-16 -16 288 288" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
941
941
|
<title>3x3x3 LL</title>
|
|
942
942
|
<defs>
|
|
@@ -1043,7 +1043,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
1043
1043
|
<use id="CENTERS-l5-o2" xlink:href="#sticker" style="fill: yellow"/>
|
|
1044
1044
|
<use id="CENTERS-l5-o3" xlink:href="#sticker" style="fill: yellow"/>
|
|
1045
1045
|
</g>
|
|
1046
|
-
</svg>\`});var
|
|
1046
|
+
</svg>\`});var Ms={};mt(Ms,{cube3x3x3LLSVG:()=>ML,cube3x3x3SVG:()=>PL});var Is=y(()=>{"use strict";b1();w1()});var Os,E1=y(()=>{"use strict";ir();Et();Ps();ro();U1();Os={id:"3x3x3",fullName:"3\\xD73\\xD73 Cube",inventedBy:["Ern\\u0151 Rubik"],inventionYear:1974,kpuzzle:de(async()=>xi),svg:de(async()=>(await Promise.resolve().then(()=>(Is(),Ms))).cube3x3x3SVG),llSVG:de(async()=>(await Promise.resolve().then(()=>(Is(),Ms))).cube3x3x3LLSVG),pg:de(async()=>un("3x3x3")),stickeringMask:e=>nr(Os,e),stickerings:Zn,puzzleSpecificSimplifyOptions:x1}});var k1,_1=y(()=>{"use strict";He();Et();k1={id:"clock",fullName:"Clock",inventedBy:["Christopher C. Wiggs","Christopher J. Taylor"],inventionYear:1988,kpuzzle:de(async()=>new Ae((await Promise.resolve().then(()=>(Ur(),xr))).clockJSON)),svg:de(async()=>(await Promise.resolve().then(()=>(Ur(),xr))).clockSVG)}});async function z1(e,t){let r=await e.kpuzzle(),n=new Hn(r),l=new Xn(r),o=()=>l.and([l.move("U"),l.not(l.or(l.moves(["F","BL","BR"])))]),i=()=>l.and([l.move("U"),l.not(l.move("F"))]),a=()=>l.or([i(),l.and([l.move("F"),l.not(l.or(l.moves(["U","BL","BR"])))])]),s=()=>l.not(l.or([l.and([l.move("U"),l.move("F")]),l.and([l.move("F"),l.move("BL")]),l.and([l.move("F"),l.move("BR")]),l.and([l.move("BL"),l.move("BR")])])),f=()=>l.not(l.or([l.and([l.move("F"),l.move("BL")]),l.and([l.move("F"),l.move("BR")]),l.and([l.move("BL"),l.move("BR")])]));switch(t){case"full":break;case"experimental-fto-fc":{n.set(l.not(o()),"Ignored");break}case"experimental-fto-f2t":{n.set(l.not(i()),"Ignored"),n.set(o(),"Dim");break}case"experimental-fto-sc":{n.set(l.not(a()),"Ignored"),n.set(i(),"Dim");break}case"experimental-fto-l2c":{n.set(l.not(s()),"Ignored"),n.set(a(),"Dim");break}case"experimental-fto-lbt":{n.set(l.not(f()),"Ignored"),n.set(s(),"Dim");break}case"experimental-fto-l3t":{n.set(f(),"Dim");break}default:console.warn(\`Unsupported stickering for \${e.id}: \${t}. Setting all pieces to dim.\`),n.set(l.and(l.moves([])),"Dim")}return n.toStickeringMask()}async function C1(){return["full","experimental-fto-fc","experimental-fto-f2t","experimental-fto-sc","experimental-fto-l2c","experimental-fto-lbt","experimental-fto-l3t"]}var N1=y(()=>{"use strict";to()});var P1,M1=y(()=>{"use strict";P1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
1047
1047
|
<svg width="2368px" height="1216px" viewBox="0 0 2368 1216" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
1048
1048
|
<title>fto</title>
|
|
1049
1049
|
<g id="fto" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linejoin="round">
|
|
@@ -1137,7 +1137,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
1137
1137
|
</g>
|
|
1138
1138
|
</g>
|
|
1139
1139
|
</svg>
|
|
1140
|
-
\`});var
|
|
1140
|
+
\`});var I1,O1=y(()=>{"use strict";I1=\`<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 800 500">
|
|
1141
1141
|
<style type="text/css"><![CDATA[.sticker { stroke: #000000; stroke-width: 1px; }]]></style>
|
|
1142
1142
|
<g><title>U</title>
|
|
1143
1143
|
<polygon id="CORNERS-l0-o0" class="sticker" style="fill: #ffffff" points="247.941 89.861 283.500 115.696 269.918 157.499 212.382 138.805"/>
|
|
@@ -1212,7 +1212,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
1212
1212
|
<polygon id="CORNERS-l17-o0" class="sticker" style="fill: #999999" points="623.177 410.138 587.618 435.974 552.058 410.138 587.618 361.195"/>
|
|
1213
1213
|
<polygon id="CORNERS-l14-o0" class="sticker" style="fill: #999999" points="645.154 342.500 658.736 384.303 623.177 410.138 587.618 361.195"/>
|
|
1214
1214
|
</g></svg>
|
|
1215
|
-
\`});var
|
|
1215
|
+
\`});var T1,G1=y(()=>{"use strict";T1={name:"redi_cube",orbits:{EDGES:{numPieces:12,numOrientations:2},CORNERS:{numPieces:8,numOrientations:3}},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]}},moves:{F:{EDGES:{permutation:[8,0,2,3,4,5,6,7,1,9,10,11],orientation:[0,1,0,0,0,0,0,0,1,0,0,0]},CORNERS:{permutation:[0,1,2,3,4,5,6,7],orientation:[1,0,0,0,0,0,0,0]}},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]}},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]}}},experimentalDerivedMoves:{z:"[x: y]",UR:"[y: F]",U:"[y2: F]",UL:"[y': F]",D:"[x: F]",L:"[z2: F]",R:"[x2: F]",B:"[y2 x: F]"}}});var W1,K1=y(()=>{"use strict";W1=\`<?xml version="1.0" encoding="UTF-8"?>
|
|
1216
1216
|
<svg width="546px" height="418px" viewBox="-20 -20 546 418" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
1217
1217
|
<title>redi-cube</title>
|
|
1218
1218
|
<g istroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
@@ -1364,7 +1364,7 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
1364
1364
|
</g>
|
|
1365
1365
|
</g>
|
|
1366
1366
|
</svg>
|
|
1367
|
-
\`});var
|
|
1367
|
+
\`});var po={};mt(po,{ftoSVG:()=>P1,kilominxSVG:()=>I1,rediCubeJSON:()=>T1,rediCubeSVG:()=>W1});var mo=y(()=>{"use strict";M1();O1();G1();K1()});var Ts,Q1,j1=y(()=>{"use strict";ir();Et();N1();Ts=class extends dt{constructor(){super({pgID:"FTO",id:"fto",fullName:"Face-Turning Octahedron",inventedBy:["Karl Rohrbach","David Pitcher"],inventionYear:1983});this.stickerings=C1;this.svg=de(async()=>(await Promise.resolve().then(()=>(mo(),po))).ftoSVG)}stickeringMask(r){return z1(this,r)}},Q1=new Ts});async function q1(e,t){switch(console.log(e,t),t){case"full":case"F2L":case"LL":case"OLL":case"EOLL":case"OCLL":case"PLL":case"ELS":case"CLS":return nr(e,t);default:console.warn(\`Unsupported stickering for \${e.id}: \${t}. Setting all pieces to dim.\`)}return nr(e,"full")}async function V1(){return["full","F2L","LL","OLL","EOLL","OCLL","PLL","ELS","CLS"]}var H1=y(()=>{"use strict";ro()});var Gs,X1,Z1=y(()=>{"use strict";ir();H1();Gs=class extends dt{constructor(){super({id:"megaminx",fullName:"Megaminx",inventionYear:1981});this.stickerings=V1}stickeringMask(r){return q1(this,r)}},X1=new Gs});var Ws,J1,Y1=y(()=>{"use strict";ir();Et();Ws=class extends dt{constructor(){super({id:"pyraminx",fullName:"Pyraminx",inventedBy:["Uwe Meffert"]});this.svg=de(async()=>(await Promise.resolve().then(()=>(Ur(),xr))).pyraminxSVG)}},J1=new Ws});var $1,eu=y(()=>{"use strict";He();Et();$1={id:"square1",fullName:"Square-1",inventedBy:["Karel Hr\\u0161el","Vojtech Kopsk\\xFD"],inventionYear:1990,kpuzzle:de(async()=>new Ae((await Promise.resolve().then(()=>(Ur(),xr))).sq1HyperOrbitJSON)),svg:de(async()=>(await Promise.resolve().then(()=>(Ur(),xr))).sq1HyperOrbitSVG)}});var tu,ru=y(()=>{"use strict";He();ir();Et();tu={id:"kilominx",fullName:"Kilominx",kpuzzle:de(async()=>{let e=await un("megaminx + chopasaurus"),t=JSON.parse(JSON.stringify(e.getKPuzzleDefinition(!0)));delete t.orbits.CENTERS,delete t.orbits.CENTERS2,delete t.startStateData.CENTERS,delete t.startStateData.CENTERS2;for(let i of Object.values(t.moves))delete i.CENTERS,delete i.CENTERS2;t.name="kilominx",delete t.experimentalPuzzleDescription;let r=await Promise.resolve().then(()=>(nl(),rl)),n=new r.ExperimentalPGNotation(e,e.getOrbitsDef(!0)),l=new Ae(t,{experimentalPGNotation:{lookupMove:i=>i.toString()==="x2"||i.toString()==="x2'"?o.transformationData:n.lookupMove(i)}}),o=l.algToTransformation("Rv2 Fv Uv'");return t.moves.x2=o,l}),svg:de(async()=>(await Promise.resolve().then(()=>(mo(),po))).kilominxSVG)}});var nu,lu=y(()=>{"use strict";He();Et();nu={id:"redi_cube",fullName:"Redi Cube",inventedBy:["Oskar van Deventer"],inventionYear:2009,kpuzzle:de(async()=>new Ae((await Promise.resolve().then(()=>(mo(),po))).rediCubeJSON)),svg:async()=>(await Promise.resolve().then(()=>(mo(),po))).rediCubeSVG}});var IL,ou=y(()=>{"use strict";IL=\`<svg
|
|
1368
1368
|
height="256"
|
|
1369
1369
|
viewBox="0 0 256 256"
|
|
1370
1370
|
width="256"
|
|
@@ -1482,8 +1482,8 @@ Vertex distance \${this.vertexdistance}\`}writeSchreierSims(t){let n=this.getOrb
|
|
|
1482
1482
|
<path id="CORNERS-l5-o1" d="m18 3v1h-1v-1z" style="fill: red" />
|
|
1483
1483
|
</g>
|
|
1484
1484
|
</g>
|
|
1485
|
-
</svg>\`});var
|
|
1486
|
-
\`)){let g=u.split(" ");if(!u.startsWith("SetOrder ")){if(u.startsWith("Alg ")){let c=w.fromString(u.substring(4));n.push({alg:c,transformation:e.algToTransformation(c)})}else if(u.startsWith("SubgroupSizes "))for(let c=1;c<g.length;c++)r.push(parseInt(g[c]))}}let l={ordering:new Array(r.length)},o=[],i=0;o.push(0);let a=w.fromString(""),s=e.identityTransformation();for(let u=0;u<r.length;u++)i+=r[u],o.push(i),n.splice(i-1,0,{alg:a,transformation:s});if(n.length!==i)throw Error(\`Bad sgs; expected \${i-r.length} algs but saw \${n.length-r.length}\`);let f={};for(let u in e.definition.orbits){let g=e.definition.orbits[u];f[u]=new Array(g.numPieces).fill(!1)}for(let u=r.length-1;u>=0;u--){let g=[];for(let p=o[u];p<o[u+1];p++){let L=n[p].transformation;for(let m in e.definition.orbits){let d=e.definition.orbits[m];for(let F=0;F<d.numPieces;F++)(L.transformationData[m].permutation[F]!==F||L.transformationData[m].orientation[F]!==0)&&(f[m][F]||(g.push({orbitName:m,permutationIdx:F}),f[m][F]=!0))}}let c={};for(let p=o[u];p<o[u+1];p++){let L=n[p].transformation.invert(),m="";for(let d=0;d<g.length;d++){let F=g[d];m=\`\${m} \${L.transformationData[F.orbitName].permutation[F.permutationIdx]} \${L.transformationData[F.orbitName].orientation[F.permutationIdx]}\`}c[m]=n[p],n[p].alg=n[p].alg.invert(),n[p].transformation=n[p].transformation.invert()}l.ordering[u]={pieceOrdering:g,lookup:c}}return l}var
|
|
1485
|
+
</svg>\`});var iu={};mt(iu,{cube4x4x4LLSVG:()=>IL});var au=y(()=>{"use strict";ou()});var Ks,su=y(()=>{"use strict";ir();Et();Ks=new or({id:"4x4x4",fullName:"4\\xD74\\xD74 Cube"});Ks.llSVG=de(async()=>(await Promise.resolve().then(()=>(au(),iu))).cube4x4x4LLSVG)});var Me,ar=y(()=>{"use strict";Ff();ir();B1();E1();_1();j1();Z1();Y1();eu();ru();lu();su();Me={"3x3x3":Os,"2x2x2":go,"4x4x4":Ks,"5x5x5":new or({id:"5x5x5",fullName:"5\\xD75\\xD75 Cube"}),"6x6x6":new or({id:"6x6x6",fullName:"6\\xD76\\xD76 Cube"}),"7x7x7":new or({id:"7x7x7",fullName:"7\\xD77\\xD77 Cube"}),"40x40x40":new or({id:"40x40x40",fullName:"40\\xD740\\xD740 Cube"}),clock:k1,megaminx:X1,pyraminx:J1,skewb:new dt({id:"skewb",fullName:"Skewb",inventedBy:["Tony Durham"]}),square1:$1,fto:Q1,gigaminx:new dt({id:"gigaminx",fullName:"Gigaminx",inventedBy:["Tyler Fox"],inventionYear:2006}),master_tetraminx:new dt({pgID:"master tetraminx",id:"master_tetraminx",fullName:"Master Tetraminx",inventedBy:["Katsuhiko Okamoto"],inventionYear:2002}),kilominx:tu,redi_cube:nu}});function uu(e){fu=e}function be(){if(!fu)throw new Error("Must be called from inside a worker, to avoid impact on page performance. Try importing from the top level of \`cubing/solve\`?")}var fu,At=y(()=>{"use strict";fu=!1});async function gu(){if(globalThis?.crypto?.getRandomValues)return crypto.getRandomValues.bind(crypto);{let e=(await(OL??(OL=import(GL())))).webcrypto;return e.getRandomValues.bind(e)}}var OL,TL,GL,cu=y(()=>{"use strict";OL=null,TL="cr-yp-to",GL=()=>TL.replace(/-/g,"")});function QL(e){let t=new Uint32Array(2);e(t);let r=t[0],n=t[1];return Math.floor(r*WL)+Math.floor(n/KL)}function jL(e){if(typeof e!="number"||e<0||Math.floor(e)!==e)throw new Error("randomInt.below() not called with a positive integer value.");if(e>pu)throw new Error(\`Called randomInt.below() with max === \${e}, which is larger than JavaScript can handle with integer precision.\`)}async function we(){let e=await gu(),t=r=>{jL(r);let n=QL(e),l=Math.floor(pu/r)*r;return n<l?n%r:t(r)};return t}var pu,WL,KL,Ui=y(()=>{"use strict";cu();pu=9007199254740992,WL=2097152,KL=2048});async function sr(){let e=await we();return t=>t[e(t.length)]}var mu=y(()=>{"use strict";Ui()});async function Lu(e){for(let t=1;t<e.length;t++){let r=(await qL)(t);[e[t],e[r]]=[e[r],e[t]]}}var qL,yt=y(()=>{"use strict";mu();Ui();Ui();qL=we()});function We(e){return new cn(t=>{t(e())})}var cn,Vt=y(()=>{"use strict";cn=class extends Promise{constructor(t){super(r=>{r()}),this._executor=t}static from(t){return new cn(r=>{r(t())})}static resolve(t){return new cn(r=>{r(t)})}static reject(t){return new cn((r,n)=>{n(t)})}then(t,r){return this._promise=this._promise||new Promise(this._executor),this._promise.then(t,r)}catch(t){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(t)}}});function Ht(e,t){let r=[],n=[];for(let u of t.split(\`
|
|
1486
|
+
\`)){let g=u.split(" ");if(!u.startsWith("SetOrder ")){if(u.startsWith("Alg ")){let c=w.fromString(u.substring(4));n.push({alg:c,transformation:e.algToTransformation(c)})}else if(u.startsWith("SubgroupSizes "))for(let c=1;c<g.length;c++)r.push(parseInt(g[c]))}}let l={ordering:new Array(r.length)},o=[],i=0;o.push(0);let a=w.fromString(""),s=e.identityTransformation();for(let u=0;u<r.length;u++)i+=r[u],o.push(i),n.splice(i-1,0,{alg:a,transformation:s});if(n.length!==i)throw Error(\`Bad sgs; expected \${i-r.length} algs but saw \${n.length-r.length}\`);let f={};for(let u in e.definition.orbits){let g=e.definition.orbits[u];f[u]=new Array(g.numPieces).fill(!1)}for(let u=r.length-1;u>=0;u--){let g=[];for(let p=o[u];p<o[u+1];p++){let L=n[p].transformation;for(let m in e.definition.orbits){let d=e.definition.orbits[m];for(let F=0;F<d.numPieces;F++)(L.transformationData[m].permutation[F]!==F||L.transformationData[m].orientation[F]!==0)&&(f[m][F]||(g.push({orbitName:m,permutationIdx:F}),f[m][F]=!0))}}let c={};for(let p=o[u];p<o[u+1];p++){let L=n[p].transformation.invert(),m="";for(let d=0;d<g.length;d++){let F=g[d];m=\`\${m} \${L.transformationData[F.orbitName].permutation[F.permutationIdx]} \${L.transformationData[F.orbitName].orientation[F.permutationIdx]}\`}c[m]=n[p],n[p].alg=n[p].alg.invert(),n[p].transformation=n[p].transformation.invert()}l.ordering[u]={pieceOrdering:g,lookup:c}}return l}var ll=y(()=>{"use strict";fe()});async function du(){return nB??(nB=lB())}async function lB(){return Ht(await go.kpuzzle(),\`SubgroupSizes 24 21 18 15 12 9 6
|
|
1487
1487
|
|
|
1488
1488
|
Alg F
|
|
1489
1489
|
Alg F2
|
|
@@ -1582,7 +1582,7 @@ Alg F D' F L' D F R2 U2 F' U'
|
|
|
1582
1582
|
Alg F D' L D' L F D2 L2 B' R'
|
|
1583
1583
|
Alg F L' D F R2 D2 L D F' U2
|
|
1584
1584
|
Alg F L' D F2 D' L F L2 F2 U
|
|
1585
|
-
Alg F D F' D L2 F R' F' D' B2 U'\`)}var
|
|
1585
|
+
Alg F D F' D L2 F R' F' D' B2 U'\`)}var nB,Ru=y(()=>{"use strict";ar();ll();nB=null});async function oB(){let{getPuzzleGeometryByName:e,ExperimentalPGNotation:t}=await Promise.resolve().then(()=>(nl(),rl)),r=e("megaminx",{allMoves:!0,addRotations:!0}),n=new Ae(r.getKPuzzleDefinition(!0),{experimentalPGNotation:new t(r,r.getOrbitsDef(!0))});return n.definition.name="megaminx",n}async function qs(){return iB??(iB=oB())}async function hu(){return aB??(aB=sB())}async function sB(){return Ht(await qs(),\`SubgroupSizes 12 5 60 58 60 56 54 57 52 50 54 48 46 51 44 42 48 40 45 38 36 42 34 32 39 30 36 28 26 33 24 30 22 20 27 18 24 16 14 21 12 18 10 15 8 6 2 12 9 3
|
|
1586
1586
|
|
|
1587
1587
|
Alg Rv
|
|
1588
1588
|
Alg Rv2
|
|
@@ -3102,7 +3102,7 @@ Alg L' BL2 L2' F' L2 BL2' L2' F L2'
|
|
|
3102
3102
|
Alg U BL2' U R U' BL2 U' L U2 R' U2' L'
|
|
3103
3103
|
Alg U BR U' L2 F L' U BR' U' L F' L2'
|
|
3104
3104
|
Alg U L' BL2 L' FL' L BL2' L U' L2' FL L2
|
|
3105
|
-
Alg U BR2' U R' U2' L U2 R U' BR2 U' L'\`)}var
|
|
3105
|
+
Alg U BR2' U R' U2' L U2 R U' BR2 U' L'\`)}var iB,aB,Fu=y(()=>{"use strict";He();ll();iB=null;aB=null});async function Vs(){return fB??(fB=uB())}async function Du(){return{ordering:(await Vs()).ordering.slice(2)}}async function uB(){return Ht(await Me.pyraminx.kpuzzle(),\`SubgroupSizes 12 9 12 3 10 3 8 6 2 3 3 3 3
|
|
3106
3106
|
|
|
3107
3107
|
Alg B
|
|
3108
3108
|
Alg B'
|
|
@@ -3179,7 +3179,7 @@ Alg r
|
|
|
3179
3179
|
Alg r'
|
|
3180
3180
|
|
|
3181
3181
|
Alg u
|
|
3182
|
-
Alg u'\`)}var
|
|
3182
|
+
Alg u'\`)}var fB,Au=y(()=>{"use strict";ar();ll();fB=null});async function gB(){let{getPuzzleGeometryByName:e,ExperimentalPGNotation:t}=await Promise.resolve().then(()=>(nl(),rl)),r=e("skewb",{allMoves:!0,addRotations:!0});return new Ae(r.getKPuzzleDefinition(!0),{experimentalPGNotation:new t(r,r.getOrbitsDef(!0))})}async function Hs(){return cB??(cB=gB())}async function Xs(){return pB??(pB=mB())}async function yu(){return{ordering:(await Xs()).ordering.slice(1)}}async function mB(){return Ht(await Hs(),\`SubgroupSizes 24 6 5 12 9 3 4 9 3 3
|
|
3183
3183
|
|
|
3184
3184
|
Alg y
|
|
3185
3185
|
Alg y2
|
|
@@ -3257,7 +3257,7 @@ Alg U L U' B' U L' U' B
|
|
|
3257
3257
|
Alg U' B L U L B' U' L'
|
|
3258
3258
|
|
|
3259
3259
|
Alg U R' U' L B R' B' R
|
|
3260
|
-
Alg R' U' R U B' U' B L\`)}var RB,hB,wu=y(()=>{"use strict";He();nl();RB=null;hB=null});var Eu={};mt(Eu,{cachedData222:()=>Au,cachedMegaminxKPuzzleWithoutMO:()=>qs,cachedSGSDataMegaminx:()=>Su,sgsDataPyraminx:()=>Vs,sgsDataPyraminxFixedOrientation:()=>xu,sgsDataSkewb:()=>Xs,sgsDataSkewbFixedCorner:()=>bu,skewbKPuzzleWithoutMOCached:()=>Hs});var ku=y(()=>{"use strict";yu();vu();Uu();wu()});async function ll(e,t){let r=new Lt;r.experimentalPushAlg(e);for(let n of t){let l=(await ar())(n);l!==null&&r.push(B.fromString(l))}return r.toAlg()}var bi=y(()=>{"use strict";me();yt()});function ju(){}function vB(e){function t(){}return t.prototype=e||{},new t}function xB(e){return e instanceof Array?e[0]:null}function yo(e,t,r){var n=Ki,l=UB,o=xB,i=n[e],a=o(i);i&&!a?H=i:(H=n[e]=t?l(t):{},H.castableTypeMap$=r,H.constructor=H,!t&&(H.typeMarker$=ju));for(var s=3;s<arguments.length;++s)arguments[s].prototype=H;a&&(H.___clazz$=a)}function UB(e){var t=Ki;return vB(t[e])}function bB(){}function zi(e){return e<<24>>24}function f0(){this.typeName=null,this.simpleName=null,this.packageName=null,this.compoundName=null,this.canonicalName=null,this.typeId=null,this.arrayLiterals=null}function u0(e,t){var r;return r=new f0,r.packageName=e,r.compoundName=t,r}function Nr(e,t,r){var n;return n=u0(e,t),kB(r,n),n}function wB(e,t){var r;return r=u0(e,t),r.modifiers=2,r}function Qi(e,t){var r;return r=u0("",e),r.typeId=t,r.modifiers=1,r}function qu(e,t){var r=e.arrayLiterals=e.arrayLiterals||[];return r[t]||(r[t]=e.createClassLiteralForArray(t))}function EB(e){if(e.isPrimitive())return null;var t=e.typeId,r=Ki[t];return r}function kB(e,t){if(!!e){t.typeId=e;var r=EB(t);if(!r){Ki[e]=[t];return}r.___clazz$=t}}function te(e,t){return qu(e,t)}function Y(e,t,r,n,l,o){var i;return i=Hu(l,n),re(te(e,o),t,r,l,i),i}function rt(e,t,r,n,l,o){return Vu(e,t,r,n,l,0,o)}function Vu(e,t,r,n,l,o,i){var a,s,f,u,g;if(u=l[o],f=o===i-1,a=f?n:0,g=Hu(a,u),re(te(e,i-o),t[o],r[o],a,g),!f)for(++o,s=0;s<u;++s)g[s]=Vu(e,t,r,n,l,o,i);return g}function re(e,t,r,n,l){return l.___clazz$=e,l.castableTypeMap$=t,l.typeMarker$=ju,l.__elementTypeId$=r,l.__elementTypeCategory$=n,l}function Hu(e,t){var r=new Array(t),n;switch(e){case 6:{n={l:0,m:0,h:0};break}case 7:{n=0;break}case 8:{n=!1;break}default:return r}for(var l=0;l<t;++l)r[l]=n;return r}function Pu(e){var t,r,n;return t=e&nt,r=e>>22&nt,n=e<0?Er:0,_B(t,r,n)}function _B(e,t,r){return{l:e,m:t,h:r}}function zB(e,t){var r,n,l;return r=e.l+t.l,n=e.m+t.m+(r>>22),l=e.h+t.h+(n>>22),{l:r&nt,m:n&nt,h:l&Er}}function Ht(e,t){return{l:e.l&t.l,m:e.m&t.m,h:e.h&t.h}}function g0(e){var t,r;return e>-129&&e<128?(t=e+128,wi==null&&(wi=Y(gd,fe,293,256,0,1)),r=wi[t],!r&&(r=wi[t]=Pu(e)),r):Pu(e)}function Xu(e,t){var r,n;return r=e.h>>19,n=t.h>>19,r===0?n!==0||e.h>t.h||e.h===t.h&&e.m>t.m||e.h===t.h&&e.m===t.m&&e.l>=t.l:!(n===0||e.h<t.h||e.h===t.h&&e.m<t.m||e.h===t.h&&e.m===t.m&&e.l<t.l)}function Js(e,t){return e.l!==t.l||e.m!==t.m||e.h!==t.h}function e0(e,t){return{l:e.l|t.l,m:e.m|t.m,h:e.h|t.h}}function Ci(e,t){var r,n,l;return t&=63,t<22?(r=e.l<<t,n=e.m<<t|e.l>>22-t,l=e.h<<t|e.m>>22-t):t<44?(r=0,n=e.l<<t-22,l=e.m<<t-22|e.l>>44-t):(r=0,n=0,l=e.l<<t-44),{l:r&nt,m:n&nt,h:l&Er}}function pn(e,t){var r,n,l,o,i;return t&=63,r=e.h,n=(r&SB)!==0,n&&(r|=-1048576),t<22?(i=r>>t,o=e.m>>t|r<<22-t,l=e.l>>t|e.m<<22-t):t<44?(i=n?Er:0,o=r>>t-22,l=e.m>>t-22|r<<44-t):(i=n?Er:0,o=n?nt:0,l=r>>t-44),{l:l&nt,m:o&nt,h:i&Er}}function Zu(e,t){var r,n,l;return r=e.l-t.l,n=e.m-t.m+(r>>22),l=e.h-t.h+(n>>22),{l:r&nt,m:n&nt,h:l&Er}}function mn(e){return e.l|e.m<<22}function CB(e){this.string=e}function kr(e,t){return e>t?e:t}function c0(e,t){return e<t?e:t}function NB(e,t){return e.indexOf(t)}function PB(e){return MB(e,0,e.length)}function MB(e,t,r){for(var n="",l=t;l<r;){var o=Math.min(l+1e4,r);n+=String.fromCharCode.apply(null,e.slice(l,o)),l=o}return n}function IB(e){return String.fromCharCode(e&Ze)}function Mu(e){return e.string+=" ",e}function Iu(e,t){return e.string+=t,e}function TB(){CB.call(this,"")}function Ni(e,t){var r;if(e===t)return!0;if(e.length!==t.length)return!1;for(r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}function Ln(){Ou||(Ou=!0,br=rt(Se,[fe,ye],[11,0],7,[495,18],2),gl=rt(Se,[fe,ye],[11,0],7,[324,18],2),Ll=rt(Se,[fe,ye],[11,0],7,[336,18],2),_r=rt(Se,[fe,ye],[11,0],7,[495,8],2),Vi=Y(Qe,Ke,0,20048,7,1),qi=Y(Qe,Ke,0,20791,7,1),ul=Y(Qe,Ke,0,82945,7,1),il=rt(Se,[fe,ye],[11,0],7,[2768,10],2),sl=rt(Se,[fe,ye],[11,0],7,[2768,10],2),fl=rt(Se,[fe,ye],[11,0],7,[24,10],2),So=rt(Se,[fe,ye],[11,0],7,[24,16],2),Bn=rt(Se,[fe,ye],[11,0],7,[140,16],2),ji=Y(Qe,Ke,0,8305,7,1),al=Y(Qe,Ke,0,48441,7,1))}function GB(e,t,r){return e.slice_0=br[t.slice_0][r],e.flip=Ll[t.flip][($(),Rn)[r<<3|t.fsym]],e.fsym=e.flip&7^t.fsym,e.flip>>=3,e.twist=gl[t.twist][Rn[r<<3|t.tsym]],e.tsym=e.twist&7^t.tsym,e.twist>>=3,e.prun=kr(kr(ut(Vi,e.twist*495+_r[e.slice_0][e.tsym]),ut(qi,e.flip*495+_r[e.slice_0][e.fsym])),ut(ul,e.twist<<11|Cr[e.flip<<3|e.fsym^e.tsym])),e.prun}function WB(e,t,r){return r=($(),Fo)[3][r],e.flipc=Ll[t.flipc>>3][Rn[r<<3|t.flipc&7]]^t.flipc&7,e.twistc=gl[t.twistc>>3][Rn[r<<3|t.twistc&7]]^t.twistc&7,ut(ul,e.twistc>>3<<11|Cr[e.flipc^e.twistc&7])}function Ju(e,t,r){var n;return e.twist=($(),Ao)[Mi(t)],e.flip=dn[Pi(t)],e.tsym=e.twist&7,e.twist=e.twist>>3,e.prun=ut(ul,e.twist<<11|Cr[e.flip^e.tsym]),e.prun>r||(e.fsym=e.flip&7,e.flip=e.flip>>3,e.slice_0=494-pl(t.ea,8,!0),e.prun=kr(e.prun,kr(ut(Vi,e.twist*495+_r[e.slice_0][e.tsym]),ut(qi,e.flip*495+_r[e.slice_0][e.fsym]))),e.prun>r)?!1:(n=new pe,vo(t,1,n),xo(t,1,n),e.twistc=Ao[Mi(n)],e.flipc=dn[Pi(n)],e.prun=kr(e.prun,ut(ul,e.twistc>>3<<11|Cr[e.flipc^e.twistc&7])),e.prun<=r)}function Ro(){Ln()}function ut(e,t){return Ln(),e[t>>3]>>(t<<2)&15}function Yu(e){Ln(),!(Ei===2||Ei===1&&!e)&&(Ei===0&&(td(),KB(),jB(),VB(),QB(),$(),r0(2048,d0,dn,Gu=Y(Se,ye,0,336,7,1),0),r0(2187,h0,Ao,Ys=Y(Se,ye,0,324,7,1),1),qB(),HB(),XB()),Bo(ji,fl,So,il,($(),n0),584244,e),Bo(al,t0,Bn,sl,n0,514084,e),Bo(Vi,br,_r,gl,Ys,431619,e),Bo(qi,br,_r,Ll,Gu,431619,e),Bo(ul,null,null,gl,Ys,103939,e),Ei=e?2:1)}function KB(){var e,t,r,n;for(e=new pe,t=new pe,r=0;r<2768;r++)for(YB(e,($(),ol)[r]),n=0;n<10;n++)zr(e,ce[(et(),Ct)[n]],t),il[r][n]=Oi(cr[ct(t.ca,8,!1)])&Ze}function QB(){var e,t,r,n,l;for(e=new pe,t=new pe,t0=rt(Se,[fe,ye],[11,0],7,[140,10],2),r=0;r<140;r++){for(gg(e.ca,r%70,0,!1),l=0;l<10;l++)zr(e,($(),ce)[(et(),Ct)[l]],t),t0[r][l]=pl(t.ca,0,!1)+70*(165>>l&1^~~(r/70))&Ze;for(n=0;n<16;n++)vo(e,($(),gt)[0][n],t),Bn[r][n]=pl(t.ca,0,!1)+70*~~(r/70)&Ze}}function jB(){var e,t,r,n;for(e=new pe,t=new pe,r=0;r<2768;r++)for(tg(e,($(),ol)[r]),n=0;n<10;n++)St(e,ce[(et(),Ct)[n]],t),sl[r][n]=cr[ct(t.ea,8,!0)]}function qB(){var e,t,r,n;for(e=new pe,t=new pe,r=0;r<336;r++)for(L0(e,($(),d0)[r]),n=0;n<18;n++)St(e,ce[n],t),Ll[r][n]=dn[Pi(t)]}function VB(){var e,t,r,n,l;for(e=new pe,t=new pe,r=0;r<24;r++){for(hn(e.ea,r,12,!0),l=0;l<10;l++)St(e,($(),ce)[(et(),Ct)[l]],t),fl[r][l]=ct(t.ea,12,!0)%24&Ze;for(n=0;n<16;n++)xo(e,($(),gt)[0][n],t),So[r][n]=ct(t.ea,12,!0)%24&Ze}}function Bo(e,t,r,n,l,o,i){var a,s,f,u,g,c,p,L,m,d,F,A,S,x,U,P,Z,C,Q,v,z,N,b,E,M,j,q,ie,he,xe,Je,Ut,Be,ht,ot,pt;if(S=o&15,F=(o>>4&1)===1?s0:0,f=(o>>5&1)===1,a=o>>8&15,u=o>>12&15,g=o>>16&15,d=i?u:g,A=(1<<S)-1,s=t===null,L=s?2048:t.length,m=L*n.length,p=f?10:18,c=p===10?66:599186,U=(e[m>>3]>>(m<<2)&15)-1,U===-1){for(C=0;C<~~(m/8)+1;C++)e[C]=Lo;e[0]^=1,U=0}for(;U<d;){for(M=(U+1)*Lo^-1,Q=0;Q<e.length;Q++)ot=e[Q]^M,ot&=ot>>1,e[Q]+=ot&ot>>2&Lo;for(N=U>a,xe=N?U+2:U,he=xe*Lo,x=N?U:U+2,++U,pt=U^U+1,ht=0,C=0;C<m;++C,ht>>=4){if((C&7)===0&&(ht=e[C>>3],((ht^he)-Lo&~(ht^he)&-2004318072)===0)){C+=7;continue}if((ht&15)===xe)for(q=C%L,Je=~~(C/L),P=0,Z=0,s&&(P=($(),dn)[q],Z=P&7,P>>=3),E=0;E<p;E++){if(Be=n[Je][E],s?ie=($(),Cr)[Ll[P][Rn[E<<3|Z]]^Z^Be&A]:ie=r[t[q][E]][Be&A],Be>>=S,v=Be*L+ie,j=e[v>>3]>>(v<<2)&15,j!==x){j<U-1&&(E+=c>>E&3);continue}if(N){e[C>>3]^=pt<<(C<<2);break}for(e[v>>3]^=pt<<(v<<2),b=1,Ut=l[Be];(Ut>>=1)!==0;b++)(Ut&1)===1&&(z=Be*L,s?z+=($(),Cr)[dn[ie]^b]:z+=r[ie][b^F>>(b<<1)&3],(e[z>>3]>>(z<<2)&15)===x&&(e[z>>3]^=pt<<(z<<2)))}}}}function HB(){var e,t,r,n;for(e=new pe,t=new pe,r=0;r<324;r++)for(B0(e,($(),h0)[r]),n=0;n<18;n++)zr(e,ce[n],t),gl[r][n]=Ao[Mi(t)]}function XB(){var e,t,r,n,l,o,i,a;for(e=new pe,t=new pe,n=0;n<495;n++){for(gg(e.ea,494-n,8,!0),o=0;o<18;o+=3)St(e,($(),ce)[o],t),br[n][o]=494-pl(t.ea,8,!0)&Ze;for(l=0;l<16;l+=2)xo(e,($(),gt)[0][l],t),_r[n][l>>1]=494-pl(t.ea,8,!0)&Ze}for(r=0;r<495;r++)for(l=0;l<18;l+=3)for(a=br[r][l],i=1;i<3;i++)a=br[a][l],br[r][l+i]=a&Ze}function $(){Tu||(Tu=!0,ur=Y(Do,fe,7,16,0,1),ce=Y(Do,fe,7,18,0,1),Hi=Y(cd,fe,0,18,6,1),lg=Y(Qe,Ke,0,48,7,1),gr=rt(Qe,[fe,Ke],[17,0],7,[16,16],2),gt=rt(Qe,[fe,Ke],[17,0],7,[16,16],2),Fo=rt(Qe,[fe,Ke],[17,0],7,[16,18],2),Rn=Y(Qe,Ke,0,144,7,1),wr=rt(Qe,[fe,Ke],[17,0],7,[16,18],2),d0=Y(Se,ye,0,336,7,1),h0=Y(Se,ye,0,324,7,1),ol=Y(Se,ye,0,2768,7,1),cl=Y(ne,se,0,2768,7,1),R0=Y(Se,ye,0,2768,7,1),Ti=Y(ne,se,0,24,7,1),dn=Y(Se,ye,0,2048,7,1),Ao=Y(Se,ye,0,2187,7,1),cr=Y(Se,ye,0,40320,7,1),Cr=Y(Se,ye,0,2688,7,1),l0=new zt(2531,1373,67026819,1367),o0=new zt(2089,1906,322752913,2040),Gi=re(te(ne,2),fe,10,0,[re(te(ne,1),se,0,7,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),re(te(ne,1),se,0,7,[6,7,8,0,1,2,3,4,5,15,16,17,9,10,11,12,13,14]),re(te(ne,1),se,0,7,[3,4,5,6,7,8,0,1,2,12,13,14,15,16,17,9,10,11]),re(te(ne,1),se,0,7,[2,1,0,5,4,3,8,7,6,11,10,9,14,13,12,17,16,15]),re(te(ne,1),se,0,7,[8,7,6,2,1,0,5,4,3,17,16,15,11,10,9,14,13,12]),re(te(ne,1),se,0,7,[5,4,3,8,7,6,2,1,0,14,13,12,17,16,15,11,10,9])]),ed(),rd())}function p0(e){e.ca=re(te(ne,1),se,0,7,[0,1,2,3,4,5,6,7]),e.ea=re(te(ne,1),se,0,7,[0,2,4,6,8,10,12,14,16,18,20,22])}function $u(e){!e.temps&&(e.temps=new pe),zr(o0,e,e.temps),zr(e.temps,l0,e),St(o0,e,e.temps),St(e.temps,l0,e)}function m0(e,t){var r,n;for(n=0;n<8;n++)e.ca[n]=t.ca[n];for(r=0;r<12;r++)e.ea[r]=t.ea[r]}function ZB(e){return Oi(cr[ct(e.ca,8,!1)])}function JB(e){return cr[ct(e.ea,8,!0)]}function Pi(e){var t,r;for(r=0,t=0;t<11;t++)r=r<<1|e.ea[t]&1;return r}function Mi(e){var t,r;for(r=0,t=0;t<7;t++)r+=(r<<1)+(e.ca[t]>>3);return r}function Ii(e){var t,r;for(!e.temps&&(e.temps=new pe),r=0;r<12;r++)e.temps.ea[e.ea[r]>>1]=(r<<1|e.ea[r]&1)<<24>>24;for(t=0;t<8;t++)e.temps.ca[e.ca[t]&7]=(t|32>>(e.ca[t]>>3)&24)<<24>>24;m0(e,e.temps)}function eg(e){var t,r,n,l,o,i,a;for(t=new rg(e),l=new pe,r=Oi(cr[ct(t.ca,8,!1)])>>4,i={l:0,m:0,h:0},a=0;a<6;a++){if(n=Oi(cr[ct(t.ca,8,!1)])>>4,r===n)for(o=0;o<16;o++)vo(t,gt[0][o],l),Ni(l.ca,e.ca)&&(xo(t,gt[0][o],l),Ni(l.ea,e.ea)&&(i=e0(i,Ci({l:1,m:0,h:0},(a<<4|o)<48?a<<4|o:48))));$u(t),a%3===2&&Ii(t)}return i}function YB(e,t){hn(e.ca,t,8,!1)}function tg(e,t){hn(e.ea,t,8,!0)}function L0(e,t){var r,n,l;for(n=0,r=10;r>=0;--r,t>>=1)n^=l=t&1,e.ea[r]=(e.ea[r]&-2|l)<<24>>24;e.ea[11]=(e.ea[11]&-2|n)<<24>>24}function B0(e,t){var r,n,l;for(n=15,r=6;r>=0;--r,t=~~(t/3))n-=l=t%3,e.ca[r]=(e.ca[r]&7|l<<3)<<24>>24;e.ca[7]=(e.ca[7]&7|n%3<<3)<<24>>24}function $B(e){var t,r,n,l,o;for(o=0,l=0,n=0;n<12;n++)l|=1<<(e.ea[n]>>1),o^=e.ea[n]&1;if(l!==4095)return-2;if(o!==0)return-3;for(r=0,o=0,t=0;t<8;t++)r|=1<<(e.ca[t]&7),o+=e.ca[t]>>3;return r!==255?-4:o%3!==0?-5:(i0(ct(e.ea,12,!0),12)^i0(ct(e.ca,8,!1),8))!==0?-6:0}function vo(e,t,r){$();var n,l,o,i,a,s;for(s=ur[gt[0][t]],a=ur[t],n=0;n<8;n++)o=s.ca[e.ca[a.ca[n]&7]&7]>>3,i=e.ca[a.ca[n]&7]>>3,l=o<3?i:(3-i)%3,r.ca[n]=(s.ca[e.ca[a.ca[n]&7]&7]&7|l<<3)<<24>>24}function zr(e,t,r){$();var n,l,o;for(n=0;n<8;n++)l=e.ca[t.ca[n]&7]>>3,o=t.ca[n]>>3,r.ca[n]=(e.ca[t.ca[n]&7]&7|(l+o)%3<<3)<<24>>24}function _i(e,t,r){var n,l,o,i;for(n=0;n<8;n++)o=e.ca[t.ca[n]&7]>>3,i=t.ca[n]>>3,l=o+(o<3?i:6-i),l=l%3+(o<3==i<3?0:3),r.ca[n]=(e.ca[t.ca[n]&7]&7|l<<3)<<24>>24}function pe(){$(),p0(this)}function zt(e,t,r,n){p0(this),hn(this.ca,e,8,!1),B0(this,t),hn(this.ea,r,12,!0),L0(this,n)}function rg(e){p0(this),m0(this,e)}function Oi(e){return $(),e^s0>>((e&15)<<1)&3}function xo(e,t,r){$();var n,l,o;for(o=ur[gt[0][t]],l=ur[t],n=0;n<12;n++)r.ea[n]=(o.ea[e.ea[l.ea[n]>>1]>>1]^e.ea[l.ea[n]>>1]&1^l.ea[n]&1)<<24>>24}function St(e,t,r){$();var n;for(n=0;n<12;n++)r.ea[n]=(e.ea[t.ea[n]>>1]^t.ea[n]&1)<<24>>24}function Ur(e,t,r){$();var n;return n=R0[e],r&&(n=n^s0>>((n&15)<<1)&3),n&65520|gr[n&15][t]}function ng(){return $(),0}function ed(){var e,t;for(ce[0]=new zt(15120,0,119750400,0),ce[3]=new zt(21021,1494,323403417,0),ce[6]=new zt(8064,1236,29441808,550),ce[9]=new zt(9,0,5880,0),ce[12]=new zt(1230,412,2949660,0),ce[15]=new zt(224,137,328552,137),e=0;e<18;e+=3)for(t=0;t<2;t++)ce[e+t+1]=new pe,St(ce[e+t],ce[e],ce[e+t+1]),zr(ce[e+t],ce[e],ce[e+t+1])}function td(){$();var e,t,r;for(r0(40320,ol,cr,n0=Y(Se,ye,0,2768,7,1),2),e=new pe,r=0;r<2768;r++)tg(e,ol[r]),cl[r]=pl(e.ea,0,!0)+i0(ol[r],8)*70<<24>>24,Ii(e),R0[r]=cr[ct(e.ea,8,!0)];for(t=0;t<24;t++)hn(e.ea,t,12,!0),Ii(e),Ti[t]=ct(e.ea,12,!0)%24<<24>>24}function rd(){var e,t,r,n,l,o,i,a,s,f,u,g,c,p,L,m;for(e=new pe,t=new pe,r=new zt(28783,0,259268407,0),m=new zt(15138,0,119765538,7),g=new zt(5167,0,83473207,0),l=0;l<8;l++)g.ca[l]=zi(g.ca[l]|24);for(o=0;o<16;o++)ur[o]=new rg(e),_i(e,m,t),St(e,m,t),L=t,t=e,e=L,o%4===3&&(_i(L,g,t),St(L,g,t),L=t,t=e,e=L),o%8===7&&(_i(L,r,t),St(L,r,t),L=t,t=e,e=L);for(i=0;i<16;i++)for(s=0;s<16;s++)for(_i(ur[i],ur[s],e),u=0;u<16;u++)if(Ni(ur[u].ca,e.ca)){gr[i][s]=u,gt[u][s]=i;break}for(f=0;f<18;f++)for(p=0;p<16;p++){for(vo(ce[f],gt[0][p],e),c=0;c<18;c++)if(Ni(ce[c].ca,e.ca)){Fo[p][f]=c,wr[p][(et(),ml)[f]]=ml[c];break}p%2===0&&(Rn[f<<3|p>>1]=Fo[p][f])}for(n=0;n<18;n++)for(Hi[n]=eg(ce[n]),a=n,p=0;p<48;p++)Fo[p%16][a]<n&&(lg[p]|=1<<n),p%16===15&&(a=Gi[2][a])}function r0(e,t,r,n,l){$();var o,i,a,s,f,u,g,c,p;for(o=new pe,a=new pe,i=0,f=0,p=l>=2?1:2,u=l!==1,s=0;s<e;s++)if(r[s]===0){switch(l){case 0:{L0(o,s);break}case 1:{B0(o,s);break}case 2:hn(o.ea,s,8,!0)}for(g=0;g<16;g+=p){switch(u?xo(o,g,a):vo(o,g,a),l){case 0:{f=Pi(a);break}case 1:{f=Mi(a);break}case 2:f=ct(a.ea,8,!0)}l===0&&(Cr[i<<3|g>>1]=f&Ze),f===s&&(n[i]=(n[i]|1<<~~(g/p))&Ze),c=~~((i<<4|g)/p),r[f]=c&Ze}t[i++]=s&Ze}return i}function nd(e,t,r,n,l,o,i,a){var s,f,u,g,c;if(g=kr(ut((Ln(),al),(i>>4)*140+Bn[($(),cl)[a>>4]&255][gt[i&15][a&15]]),kr(ut(al,n*140+Bn[cl[t]&255][gt[l][r]]),ut(ji,t*24+So[o][r]))),g>e.maxDep2)return g-e.maxDep2;for(s=e.maxDep2;s>=g&&(c=ag(e,n,l,t,r,o,s,e.depth1,10),!(c<0));s--){for(s-=c,e.solLen=0,e.solution=new cg,ud(e.solution,e.verbose,e.urfIdx,e.depth1),u=0;u<e.depth1+s;u++)Ku(e.solution,e.move[u]);for(f=e.preMoveLen-1;f>=0;f--)Ku(e.solution,e.preMoves[f]);e.solLen=e.solution.length_0}return s!==e.maxDep2?(e.maxDep2=c0(fg,e.solLen-e.length1-1),Xu(e.probe,e.probeMin)?0:1):1}function ld(e){var t,r,n,l,o,i,a,s,f,u,g,c,p,L,m;if(e.isRec=!1,Xu(e.probe,e.solution?e.probeMin:e.probeMax))return 0;for(e.probe=zB(e.probe,{l:1,m:0,h:0}),n=e.valid1;n<e.depth1;n++)zr(e.phase1Cubie[n],($(),ce)[e.move[n]],e.phase1Cubie[n+1]),St(e.phase1Cubie[n],ce[e.move[n]],e.phase1Cubie[n+1]);for(e.valid1=e.depth1,a=ZB(e.phase1Cubie[e.depth1]),s=a&15,a>>=4,f=JB(e.phase1Cubie[e.depth1]),u=f&15,f>>=4,g=ct(e.phase1Cubie[e.depth1].ea,12,!0)%24,r=Ur(f,u,!1),t=Ur(a,s,!0),l=e.depth1===0?-1:e.move[e.depth1-1],o=e.preMoveLen===0?-1:e.preMoves[e.preMoveLen-1],m=0,L=(e.preMoveLen===0?1:2)*(e.depth1===0?1:2),c=0,p=(1<<L)-1;c<L;c++){if((p>>c&1)!==0){if(p&=~(1<<c),m=nd(e,a,s,f,u,g,r,t),m===0||m>2)break;m===2&&(p&=4<<c)}if(p===0)break;(c&1)===0&&e.depth1>0?(i=(et(),ml)[~~(l/3)*3+1],e.move[e.depth1-1]=Ct[i]*2-e.move[e.depth1-1],g=(Ln(),fl)[g][i],a=il[a][($(),wr)[s][i]],s=gr[a&15][s],a>>=4,f=sl[f][wr[u][i]],u=gr[f&15][u],f>>=4,t=Ur(a,s,!0),r=Ur(f,u,!1)):e.preMoveLen>0&&(i=(et(),ml)[~~(o/3)*3+1],e.preMoves[e.preMoveLen-1]=Ct[i]*2-e.preMoves[e.preMoveLen-1],g=($(),Ti)[(Ln(),fl)[Ti[g]][i]],a=il[t>>4][wr[t&15][i]],t=a&-16|gr[a&15][t&15],a=Ur(t>>4,t&15,!0),s=a&15,a>>=4,f=sl[r>>4][wr[r&15][i]],r=f&-16|gr[f&15][r&15],f=Ur(r>>4,r&15,!1),u=f&15,f>>=4)}return e.depth1>0&&(e.move[e.depth1-1]=l),e.preMoveLen>0&&(e.preMoves[e.preMoveLen-1]=o),m===0?0:2}function od(e){var t;for(e.conjMask=0,e.selfSym=eg(e.cc),e.conjMask|=Js(Ht(pn(e.selfSym,16),{l:Ze,m:0,h:0}),{l:0,m:0,h:0})?18:0,e.conjMask|=Js(Ht(pn(e.selfSym,32),{l:Ze,m:0,h:0}),{l:0,m:0,h:0})?36:0,e.conjMask|=Js(Ht(pn(e.selfSym,48),{l:Ze,m:0,h:0}),{l:0,m:0,h:0})?56:0,e.selfSym=Ht(e.selfSym,{l:nt,m:nt,h:15}),e.maxPreMoves=e.conjMask>7?0:20,t=0;t<6;t++)m0(e.urfCubieCube[t],e.cc),Ju(e.urfCoordCube[t],e.urfCubieCube[t],20),$u(e.cc),t%3===2&&Ii(e.cc)}function og(e,t,r,n,l){var o,i,a,s,f,u;if(t.prun===0&&n<5)return e.allowShorter||n===0?(e.depth1-=n,f=ld(e),e.depth1+=n,f):1;for(u=ng(g0(r)),o=0;o<18;o+=3)if(!(o===l||o===l-9)){for(a=0;a<3;a++)if(i=o+a,!(e.isRec&&i!==e.move[e.depth1-n]||u!==0&&(u&1<<i)!==0)){if(s=GB(e.nodeUD[n],t,i),s>n)break;if(s===n)continue;if(s=WB(e.nodeUD[n],t,i),s>n)break;if(s===n)continue;if(e.move[e.depth1-n]=i,e.valid1=c0(e.valid1,e.depth1-n),f=og(e,e.nodeUD[n],r&mn(($(),Hi)[i]),n-1,o),f===0)return 0;if(f>=2)break}}return 1}function ig(e,t,r,n,l){var o,i,a;if(e.preMoveLen=e.maxPreMoves-t,(e.isRec?e.depth1===e.length1-e.preMoveLen:e.preMoveLen===0||(225207>>r&1)===0)&&(e.depth1=e.length1-e.preMoveLen,e.phase1Cubie[0]=n,e.allowShorter=e.depth1===$s&&e.preMoveLen!==0,Ju(e.nodeUD[e.depth1+1],n,e.depth1)&&og(e,e.nodeUD[e.depth1+1],l,e.depth1,-1)===0))return 0;if(t===0||e.preMoveLen+$s>=e.length1)return 1;for(a=ng(g0(l)),(t===1||e.preMoveLen+1+$s>=e.length1)&&(a|=225207),r=~~(r/3)*3,o=0;o<18;o++){if(o===r||o===r-9||o===r+9){o+=2;continue}if(!(e.isRec&&o!==e.preMoves[e.maxPreMoves-t]||(a&1<<o)!==0)&&(zr(($(),ce)[o],n,e.preMoveCubes[t]),St(ce[o],n,e.preMoveCubes[t]),e.preMoves[e.maxPreMoves-t]=o,i=ig(e,t-1,o,e.preMoveCubes[t],l&mn(Hi[o])),i===0))return 0}return 1}function ag(e,t,r,n,l,o,i,a,s){var f,u,g,c,p,L,m,d,F,A,S;if(t===0&&n===0&&o===0)return i;for(F=(et(),ho)[s],m=0;m<10;m++){if((F>>m&1)!==0){m+=66>>m&3;continue}if(d=(Ln(),fl)[o][m],u=il[n][($(),wr)[l][m]],g=gr[u&15][l],u>>=4,p=sl[t][wr[r][m]],L=gr[p&15][r],p>>=4,c=Ur(p,L,!1),f=Ur(u,g,!0),A=ut(al,(c>>4)*140+Bn[cl[f>>4]&255][gt[c&15][f&15]]),A>i+1)return i-A+1;if(A>=i){m+=66>>m&3&i-A;continue}if(A=kr(ut(ji,u*24+So[d][g]),ut(al,p*140+Bn[cl[u]&255][gt[L][g]])),A>=i){m+=66>>m&3&i-A;continue}if(S=ag(e,p,L,u,g,d,i-1,a+1,m),S>=0)return e.move[a]=Ct[m],S;if(S<-2)break;S<-1&&(m+=66>>m&3)}return-1}function id(e){for(e.length1=e.isRec?e.length1:0;e.length1<e.solLen;e.length1++)for(e.maxDep2=c0(fg,e.solLen-e.length1-1),e.urfIdx=e.isRec?e.urfIdx:0;e.urfIdx<6;e.urfIdx++)if((e.conjMask&1<<e.urfIdx)===0&&ig(e,e.maxPreMoves,-30,e.urfCubieCube[e.urfIdx],mn(Ht(e.selfSym,{l:Ze,m:0,h:0})))===0)return e.solution?Qu(e.solution):"Error 8";return e.solution?Qu(e.solution):"Error 7"}function ad(e,t){var r;return r=sd(e,t),r!==0?\`Error \${r<0?-r:r}\`:(e.solLen=22,e.probe={l:0,m:0,h:0},e.probeMax={l:3531008,m:23,h:0},e.probeMin={l:0,m:0,h:0},e.verbose=0,e.solution=null,e.isRec=!1,Yu(!1),od(e),id(e))}function sd(e,t){var r,n,l,o;for(n=0,l=Y(ne,se,0,54,7,1),r=PB(re(te(Se,1),ye,0,7,[t.charCodeAt(4),t.charCodeAt(13),t.charCodeAt(22),t.charCodeAt(31),t.charCodeAt(40),t.charCodeAt(49)])),o=0;o<54;o++){if(l[o]=NB(r,IB(t.charCodeAt(o)))<<24>>24,l[o]===-1)return-1;n+=1<<(l[o]<<2)}return n!==10066329?-1:(fd(l,e.cc),$B(e.cc))}function sg(){var e,t,r;for(this.move=Y(Qe,Ke,0,31,7,1),this.nodeUD=Y(ki,fe,31,21,0,1),this.nodeRL=Y(ki,fe,31,21,0,1),this.nodeFB=Y(ki,fe,31,21,0,1),this.cc=new pe,this.urfCubieCube=Y(Do,fe,7,6,0,1),this.urfCoordCube=Y(ki,fe,31,6,0,1),this.phase1Cubie=Y(Do,fe,7,21,0,1),this.preMoveCubes=Y(Do,fe,7,21,0,1),this.preMoves=Y(Qe,Ke,0,20,7,1),t=0;t<21;t++)this.nodeUD[t]=new Ro,this.nodeRL[t]=new Ro,this.nodeFB[t]=new Ro,this.phase1Cubie[t]=new pe;for(r=0;r<6;r++)this.urfCubieCube[r]=new pe,this.urfCoordCube[r]=new Ro;for(e=0;e<20;e++)this.preMoveCubes[e+1]=new pe}function et(){if(!Wu){Wu=!0;var e,t,r,n,l,o;for(cn=re(te(ne,2),fe,10,0,[re(te(ne,1),se,0,7,[8,9,20]),re(te(ne,1),se,0,7,[6,18,38]),re(te(ne,1),se,0,7,[0,36,47]),re(te(ne,1),se,0,7,[2,45,11]),re(te(ne,1),se,0,7,[29,26,15]),re(te(ne,1),se,0,7,[27,44,24]),re(te(ne,1),se,0,7,[33,53,42]),re(te(ne,1),se,0,7,[35,17,51])]),sr=re(te(ne,2),fe,10,0,[re(te(ne,1),se,0,7,[5,10]),re(te(ne,1),se,0,7,[7,19]),re(te(ne,1),se,0,7,[3,37]),re(te(ne,1),se,0,7,[1,46]),re(te(ne,1),se,0,7,[32,16]),re(te(ne,1),se,0,7,[28,25]),re(te(ne,1),se,0,7,[30,43]),re(te(ne,1),se,0,7,[34,52]),re(te(ne,1),se,0,7,[23,12]),re(te(ne,1),se,0,7,[21,41]),re(te(ne,1),se,0,7,[50,39]),re(te(ne,1),se,0,7,[48,14])]),fr=rt(Qe,[fe,Ke],[17,0],7,[13,13],2),a0=re(te(OB,1),fe,2,4,["U ","U2","U'","R ","R2","R'","F ","F2","F'","D ","D2","D'","L ","L2","L'","B ","B2","B'"]),Ct=re(te(Qe,1),Ke,0,7,[0,1,2,4,7,9,10,11,13,16,3,5,6,8,12,14,15,17]),ml=Y(Qe,Ke,0,18,7,1),ho=Y(Qe,Ke,0,11,7,1),t=0;t<18;t++)ml[Ct[t]]=t;for(r=0;r<10;r++)for(n=~~(Ct[r]/3),ho[r]=0,l=0;l<10;l++)o=~~(Ct[l]/3),ho[r]|=(n===o||n%3===o%3&&n>=o?1:0)<<l;for(ho[10]=0,e=0;e<13;e++)for(fr[e][0]=fr[e][e]=1,l=1;l<e;l++)fr[e][l]=fr[e-1][l-1]+fr[e-1][l]}}function pl(e,t,r){et();var n,l,o,i,a;for(n=e.length-1,o=0,a=4,l=n;l>=0;l--)i=ug(e[l],r),(i&12)===t&&(o+=fr[l][a--]);return o}function i0(e,t){et();var r,n;for(n=0,r=t-2;r>=0;r--)n^=e%(t-r),e=~~(e/(t-r));return n&1}function ct(e,t,r){et();var n,l,o,i;for(l=0,i={l:1323536,m:2777561,h:1043915},n=0;n<t-1;n++)o=ug(e[n],r)<<2,l=(t-n)*l+mn(Ht(pn(i,o),{l:15,m:0,h:0})),i=Zu(i,Ci({l:1118480,m:279620,h:69905},o));return l}function ug(e,t){return t?e>>1:e&7}function gg(e,t,r,n){et();var l,o,i,a;for(l=e.length-1,a=4,o=l,i=l;i>=0;i--)t>=fr[i][a]?(t-=fr[i][a--],e[i]=Wi(e[i],a|r,n)):((o&12)===r&&(o-=4),e[i]=Wi(e[i],o--,n))}function hn(e,t,r,n){et();var l,o,i,a,s,f;for(f={l:1323536,m:2777561,h:1043915},l={l:0,m:0,h:0},a=2;a<=r;a++)l=e0(Ci(l,4),g0(t%a)),t=~~(t/a);for(o=0;o<r-1;o++)s=(mn(l)&15)<<2,l=pn(l,4),e[o]=Wi(e[o],mn(Ht(pn(f,s),{l:15,m:0,h:0})),n),i=Zu(Ci({l:1,m:0,h:0},s),{l:1,m:0,h:0}),f=e0(Ht(f,i),Ht(pn(f,4),{l:~i.l&nt,m:~i.m&nt,h:~i.h&Er}));e[r-1]=Wi(e[r-1],mn(Ht(f,{l:15,m:0,h:0})),n)}function Wi(e,t,r){return(r?t<<1|e&1:t|e&-8)<<24>>24}function fd(e,t){et();var r,n,l,o,i,a,s,f;for(o=0;o<8;o++)t.ca[o]=0;for(i=0;i<12;i++)t.ea[i]=0;for(a=0;a<8;a++){for(f=0;f<3&&!(e[cn[a][f]]===0||e[cn[a][f]]===3);f++);for(r=e[cn[a][(f+1)%3]],n=e[cn[a][(f+2)%3]],s=0;s<8;s++)if(r===~~(cn[s][1]/9)&&n===~~(cn[s][2]/9)){t.ca[a]=zi(f%3<<3|s);break}}for(l=0;l<12;l++)for(s=0;s<12;s++){if(e[sr[l][0]]===~~(sr[s][0]/9)&&e[sr[l][1]]===~~(sr[s][1]/9)){t.ea[l]=zi(s<<1);break}if(e[sr[l][0]]===~~(sr[s][1]/9)&&e[sr[l][1]]===~~(sr[s][0]/9)){t.ea[l]=zi(s<<1|1);break}}}function Ku(e,t){var r,n,l;if(e.length_0===0){e.moves[e.length_0++]=t;return}if(r=~~(t/3),n=~~(e.moves[e.length_0-1]/3),r===n){l=(t%3+e.moves[e.length_0-1]%3+1)%4,l===3?--e.length_0:e.moves[e.length_0-1]=r*3+l;return}if(e.length_0>1&&r%3===n%3&&r===~~(e.moves[e.length_0-2]/3)){l=(t%3+e.moves[e.length_0-2]%3+1)%4,l===3?(e.moves[e.length_0-2]=e.moves[e.length_0-1],--e.length_0):e.moves[e.length_0-2]=r*3+l;return}e.moves[e.length_0++]=t}function ud(e,t,r,n){e.verbose=t,e.urfIdx=r,e.depth1=n}function Qu(e){var t,r,n;if(r=new TB,n=(e.verbose&2)!==0?(e.urfIdx+3)%6:e.urfIdx,n<3)for(t=0;t<e.length_0;t++)(e.verbose&1)!==0&&t===e.depth1&&(r.string+=". "),Mu(Iu(r,(et(),a0)[($(),Gi)[n][e.moves[t]]]));else for(t=e.length_0-1;t>=0;t--)Mu(Iu(r,(et(),a0)[($(),Gi)[n][e.moves[t]]])),(e.verbose&1)!==0&&t===e.depth1&&(r.string+=". ");return r.string}function cg(){this.moves=Y(Qe,Ke,0,31,7,1)}var fe,nt,Er,SB,Ze,ye,Ke,s0,Lo,se,H,Ki,wi,OB,Ou,Bn,t0,il,al,sl,Ll,ji,So,fl,ul,gl,_r,qi,br,Vi,Ei,ki,Tu,ur,cr,ol,dn,d0,Cr,Ti,cl,R0,Rn,Fo,wr,gr,gt,Gu,n0,Ys,Ao,h0,lg,ce,Hi,l0,o0,Gi,Do,fg,$s,Wu,fr,ho,cn,sr,a0,ml,Ct,Qe,gd,ne,cd,Se,pd,md,pg=y(()=>{"use strict";fe={3:1},nt=4194303,Er=1048575,SB=524288,Ze=65535,ye={11:1,3:1},Ke={17:1,3:1},s0=14540032,Lo=286331153,se={10:1,3:1},Ki={};yo(1,null,{},bB);yo(79,1,{},f0);H.createClassLiteralForArray=function(t){var r;return r=new f0,r.modifiers=4,t>1?r.componentType=qu(this,t-1):r.componentType=this,r};H.isPrimitive=function(){return(this.modifiers&1)!==0};OB=Nr("java.lang","String",2);Ou=!1;yo(31,1,{31:1},Ro);H.flip=0;H.flipc=0;H.fsym=0;H.prun=0;H.slice_0=0;H.tsym=0;H.twist=0;H.twistc=0;Ei=0,ki=Nr("org.cubing.min2phase.client","CoordCube",31),Tu=!1;Do=Nr("org.cubing.min2phase.client","CubieCube",7);yo(72,1,{},sg);H.allowShorter=!1;H.conjMask=0;H.depth1=0;H.isRec=!1;H.length1=0;H.maxDep2=0;H.maxPreMoves=0;H.preMoveLen=0;H.probe={l:0,m:0,h:0};H.probeMax={l:0,m:0,h:0};H.probeMin={l:0,m:0,h:0};H.selfSym={l:0,m:0,h:0};H.solLen=0;H.urfIdx=0;H.valid1=0;H.verbose=0;fg=12,$s=7,Wu=!1;yo(150,1,{},cg);H.depth1=0;H.length_0=0;H.urfIdx=0;H.verbose=0;Qe=Qi("int","I");Nr("com.google.gwt.lang","CollapsedPropertyHolder",252);Nr("com.google.gwt.lang","JavaClassHierarchySetupUtil",254);gd=Nr("com.google.gwt.lang","LongLibBase/LongEmul",null);Nr("com.google.gwt.lang","ModuleUtils",257);ne=Qi("byte","B"),cd=Qi("long","J"),Se=Qi("char","C");Nr("com.google.gwt.user.client.rpc","XsrfToken",null),wB("java.util","Map/Entry");pd=function(){Yu(!1)},md=function(e){return ad(new sg,e)}});var mg={};mt(mg,{initialize:()=>pd,solveState:()=>md});var Lg=y(()=>{"use strict";pg()});var F0,Bg=y(()=>{"use strict";qt();F0=We(()=>Promise.resolve().then(()=>(Lg(),mg)))});function dg(e,t){return e.slice(t)+e.slice(0,t)}function hd(e){let t=[[],[]];for(let r=0;r<6;r++)if(e.stateData.CENTERS.pieces[r]!==r)throw new Error("non-oriented puzzles are not supported");for(let r=0;r<12;r++)t[0].push(dg(Ld[e.stateData.EDGES.pieces[r]],e.stateData.EDGES.orientation[r]));for(let r=0;r<8;r++)t[1].push(dg(Bd[e.stateData.CORNERS.pieces[r]],e.stateData.CORNERS.orientation[r]));return t.push(dd),t}function Rg(e){let t=hd(e);return Rd.map(([r,n,l])=>t[r][n][l]).join("")}var Ld,Bd,dd,Rd,hg=y(()=>{"use strict";Ld="UF UR UB UL DF DR DB DL FR FL BR BL".split(" "),Bd="UFR URB UBL ULF DRF DFL DLB DBR".split(" "),dd="U L F R B D".split(" "),Rd=[[1,2,0],[0,2,0],[1,1,0],[0,3,0],[2,0,0],[0,1,0],[1,3,0],[0,0,0],[1,0,0],[1,0,2],[0,1,1],[1,1,1],[0,8,1],[2,3,0],[0,10,1],[1,4,1],[0,5,1],[1,7,2],[1,3,2],[0,0,1],[1,0,1],[0,9,0],[2,2,0],[0,8,0],[1,5,1],[0,4,1],[1,4,2],[1,5,0],[0,4,0],[1,4,0],[0,7,0],[2,5,0],[0,5,0],[1,6,0],[0,6,0],[1,7,0],[1,2,2],[0,3,1],[1,3,1],[0,11,1],[2,1,0],[0,9,1],[1,6,1],[0,7,1],[1,5,2],[1,1,2],[0,2,1],[1,2,1],[0,10,0],[2,4,0],[0,11,0],[1,7,1],[0,6,1],[1,6,2]]});function Fg(e,t){let r=new ge(e.kpuzzle,{EDGES:e.stateData.EDGES,CORNERS:e.stateData.CORNERS,CENTERS:{pieces:e.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}}).experimentalToTransformation(),n=new ge(t.kpuzzle,{EDGES:t.stateData.EDGES,CORNERS:t.stateData.CORNERS,CENTERS:{pieces:t.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}}).experimentalToTransformation();return r.isIdentical(n)}function Dg(e,t){if(Fg(e.startState(),t))return!1;for(let r of"ULFRBD")for(let n=1;n<4;n++){let l=e.moveToTransformation(new B(r,n)).toKState();if(Fg(l,t))return!1}return!0}var Ag=y(()=>{"use strict";me();He()});var yg,Sg=y(()=>{"use strict";yg=[["R U'","R2 B","D2 B2","D' L B'","R' U'","B","D B2","R' B","L' U","L2 B'","B2","D L B'","L U","B'","U'","R B","D' B2","L B'","U2","U L' B'","","U' L' B'","U","L' B'"],["F2 L2","F' L'","R' F L2","D' L2","F L2","F2 L'","R' F' L'","R2 F L2","R2 F2 L'","L2","F L'","D' L","D2 L2","R2 F' L'","D L","","L2 F L'","L F' L2","L F L'","F' L2","L'","D L2","D F L'","L"],["R B U2 B'","R2 B U' B'","F2 B U B'","F B2 L' B2","B2 L B2","B U' B'","R2 B U2 B'","R' B U' B'","B2 L' B2","F B U B'","B2 U' B2","B' L B","L F' B D' B'","B' U' B2 D B'","B U2 B'","R B U' B'","B2 L2 B2","D' B' L B","B U B'","F' B2 L' B2","","B2 L' B' U' B'"],["U F2 L2 U'","F' U L' U'","F2 U L' U'","U F L2 U'","U2 B2 U2","R' U' B U","D2 U L U'","D U2 B' U2","U L2 U'","F U L' U'","D U L U'","U2 B' U2","","U2 B' U' L' U'","U2 L' U2","U' B U","U L U'","D' U2 B' U2","U L' U'","U2 B U2"],["R' D' F2","F'","F2","D R F'","R D' F2","R2 F'","D' F2","R F'","F2 R' D' F2","F","D2 F2","D' R F'","R2 D' F2","R' F'","D F2","D2 R F'","","F R' D' F2"],["R' D2 F' D F","R F2 R2 F2","R2 F' D2 F","F' R2 D2 F","L D' L'","D F' D2 F","F2 R2 F2","R F' D2 F","F' R2 D' F","F' R' D2 F","F2 R' F2","L D L'","F' R D' F","F2 R F2","F' D2 F","","L D2 R D' L'","F' D2 F' R F2","D2 R2 F2 R2 F2","D F' D' F","F' D F"],["U F2 U'","R U F' U'","D R U F2 U'","U F U'","R2 U F2 U'","R' U F' U'","R U F2 U'","R2 U F' U'","","U L D L' F U'","F2 D' R D F2","D2 U F U'","R' U F2 U'","U F' U'","F2 D2 R D2 F2","D U F U'"],["R2","R' B' D B","D R'","F' R2 F","","R B' D B","R'","B' D B","D' R'","D2 F' R2 F","R","R2 B' D B","D2 R'","B' D' B"],["R2 D' R2","F' R' F R","R D' R2 D R'","D2 R2 D2 R2","R' D' F' R F","U F D F' U'","","R2 D2 B R' B' R'","R' F D' F2 R F","R2 D R2","F2 U F U' F","R' D F' R F","D R2 D2 R2","U F D' F' U'","D R' D2 F' R F","R2 D2 R2","U F D2 F' U'","R' D2 F' R F"],["B R B'","F D F' B R2 B'","D B R2 B'","D2 B R' B'","B R2 B'","D B R' B'","D' B R2 B'","B R' B'","","B R2 B' D B R' B'","D2 B R2 B'","D' B R' B'"],["","R' D R F D2 F'","R' D R","D F D' F'","R F' R' F","F D' F'","R' D' R","F D2 F'","R' D2 R","F D F'"],["","F2 D2 R F' R' D2 F' D2 F'","F2 D2 F' D' F D' F' D2 F'","F2 D F2 D F2 D2 F2","D2 F L D2 L' D2 F'","D F D2 L D2 L' F'","R' D B' D2 B D' R","R' D2 B' D2 B R","F D2 F' D F D F'","F D' L D2 L' D F'","B D' F D B' D' F'","F D2 L D2 L' F'","F D' L D L' D F'","F L D2 L' D2 F'","R' B' D2 B D2 R"],["D'","F L D L' D' F'","D2","L B D B' D' L'","D","B' L' D' L D B","","D F L D L' D' F'"],["F' D2 F D F' D F","F' D' R' D R F","F' R' D' R D F","B D R D' R' B'","","D B' D' L' D L B"],["D F D F' D F D2 F'","F' U2 B' R' B U2 F' L F' L' F'","","D2 L D L2 F L F2 D F"],["L B' L' F L B L' F'","F2 U F' D2 F U' F' D2 F'","D' F' D B D' F D B'","F L2 F R2 F' L2 F R2 F2","D B D' F' D B' D' F","R F L F' R' F L' F'","","D2 B L' U2 L B' D2 B L' U2 L B'","D2 F R' U2 R F' D2 F R' U2 R F'","R F L' F' R' F L F'","D F D' B' D F' D' B","L2 F2 L' B2 L F2 L' B2 L'"],["L B R' B' L' B R B'","R' B R F' R' B' R F","L D2 L U L' D2 L U' L2","","D2 B' D2 F D' L2 F L2 F' D2 B D' F'","D2 F' R' F R2 B' D2 B D2 R' F D2 F'","L B L' F L B' L' F'","F' D2 F' U' F D2 F' U F2","D' B' D F D' B D F'"],["","D2 F' L U2 L' F D2 F' L U2 L' F","D2 B' R U2 R' B D2 B' R U2 R' B"]]});async function xg(){let e=await Me["3x3x3"].kpuzzle(),t=e.startState();for(let r of yg)t=t.applyAlg(w.fromString((await ar())(r)));return Dg(e,t)?t:xg()}async function D0(e){return be(),w.fromString((await F0).solveState(Rg(e)))}async function Bl(){return D0(await xg())}async function Ug(){(await F0).initialize()}async function bg(){return ll(await Bl(),Fd)}async function wg(){let e=new Lt,t=await Bl();return e.experimentalPushAlg(vg),e.experimentalPushAlg(t),e.experimentalPushAlg(vg),e.toAlg()}var Fd,vg,A0=y(()=>{"use strict";me();ir();yt();At();bi();Bg();hg();Ag();Sg();Fd=[[null,"Rw","Rw2","Rw'","Fw","Fw'"],[null,"Dw","Dw2","Dw'"]];vg=new w("R' U' F")});function ue(e,...t){let r=t.length,n=e[t[r-1]];for(let l=r;l>0;l--)e[t[l]]=e[t[l-1]];return e[t[0]]=n,ue}function Eg(e,t,r,n){r=(r||8)-1;let l=1985229328,o=0;n??(n=0),n<0&&(t<<=1);for(let i=0;i<r;++i){let a=y0[r-i],s=~~(t/a);o^=s,t%=a,s<<=2,e[i]=l>>s&7;let f=(1<<s)-1;l=(l&f)+(l>>4&~f)}return n<0&&(o&1)!==0?(e[r]=e[r-1],e[r-1]=l&7):e[r]=l&7,e}var Re,y0,kg=y(()=>{"use strict";Re=[],y0=[1];for(let e=0;e<32;++e){Re[e]=[];for(let t=0;t<32;++t)Re[e][t]=0}for(let e=0;e<32;++e){Re[e][0]=Re[e][e]=1,y0[e+1]=y0[e]*(e+1);for(let t=1;t<e;++t)Re[e][t]=Re[e-1][t-1]+Re[e-1][t]}});function O(e,t){let r=new Array(e);if(t!==void 0)for(let n=0;n<e;n++)r[n]=new Array(t);return r}function Ud(e){return new ko[e]}function Rt(e,t,r,...n){let l=ko[e];l&&!l.___clazz$?X=l.prototype:(!l&&(l=ko[e]=function(){}),X=l.prototype=t<0?{}:Ud(t),X.castableTypeMap$=r);for(let o of n)o.prototype=X;l.___clazz$&&(X.___clazz$=l.___clazz$,l.___clazz$=null)}function Tr(e){let t={};for(let r=0,n=e.length;r<n;++r)t[e[r]]=1;return t}function ec(){}function bd(e,t){let r=tc(0,t);return rc(e.___clazz$,e.castableTypeMap$,e.queryId$,r),r}function tc(e,t){let r=new Array(t);if(e===3)for(let n=0;n<t;++n){let l={m:0,l:0,h:0};l.l=l.m=l.h=0,r[n]=l}else if(e>0){let n=[null,0,!1][e];for(let l=0;l<t;++l)r[l]=n}return r}function z0(e,t,r,n,l){let o=tc(l,n);return rc(e,t,r,o),o}function rc(e,t,r,n){return nc(),Ed(n,x0,U0),n.___clazz$=e,n.castableTypeMap$=t,n.queryId$=r,n}function ra(e,t,r){return e[t]=r}function nc(){_g||(_g=!0,x0=[],U0=[],wd(new ec,x0,U0))}function wd(e,t,r){let n=0,l;for(let o in e)(l=e[o])&&(t[n]=o,r[n]=l,++n)}function Ed(e,t,r){nc();for(let n=0,l=t.length;n<l;++n)e[t[n]]=r[n]}function kd(e,t){return e.castableTypeMap$&&!!e.castableTypeMap$[t]}function _d(e,t){return e!==null&&kd(e,t)}function zd(){if(zg)return!1;zg=!0,ma=O(15582,36),La=O(15582),It=O(15582),Al=O(48,48),Pt=O(48,36),Dl=O(48),P0=O(48)}function C0(e){e.ct=O(24)}function Cg(e,t){let r,n;if(_d(t,Yg)){for(r=t,n=0;n<24;++n)if(e.ct[n]!==r.ct[n])return!1;return!0}return!1}function na(e){let t,r,n;for(r=0,n=8,t=23;t>=0;--t)e.ct[t]===1&&(r+=Re[t][n--]);return r}function Zi(e){let t,r;if(xl!==null)return xl[na(e)];for(r=0;r<48;++r){if(t=Od(na(e)),t!==-1)return t*64+r;oe(e,0),r%2===1&&oe(e,1),r%8===7&&oe(e,2),r%16===15&&oe(e,3)}}function Nt(e,t){let r=t%3;switch(t=~~(t/3),t){case 0:{h(e.ct,0,1,2,3,r);break}case 1:{h(e.ct,16,17,18,19,r);break}case 2:{h(e.ct,8,9,10,11,r);break}case 3:{h(e.ct,4,5,6,7,r);break}case 4:{h(e.ct,20,21,22,23,r);break}case 5:{h(e.ct,12,13,14,15,r);break}case 6:{h(e.ct,0,1,2,3,r),h(e.ct,8,20,12,16,r),h(e.ct,9,21,13,17,r);break}case 7:{h(e.ct,16,17,18,19,r),h(e.ct,1,15,5,9,r),h(e.ct,2,12,6,10,r);break}case 8:{h(e.ct,8,9,10,11,r),h(e.ct,2,19,4,21,r),h(e.ct,3,16,5,22,r);break}case 9:{h(e.ct,4,5,6,7,r),h(e.ct,10,18,14,22,r),h(e.ct,11,19,15,23,r);break}case 10:{h(e.ct,20,21,22,23,r),h(e.ct,0,8,4,14,r),h(e.ct,3,11,7,13,r);break}case 11:h(e.ct,12,13,14,15,r),h(e.ct,1,20,7,18,r),h(e.ct,0,23,6,17,r)}}function oe(e,t){switch(t){case 0:{Nt(e,19),Nt(e,28);break}case 1:{Nt(e,21),Nt(e,32);break}case 2:{h(e.ct,0,3,1,2,1),h(e.ct,8,11,9,10,1),h(e.ct,4,7,5,6,1),h(e.ct,12,15,13,14,1),h(e.ct,16,19,21,22,1),h(e.ct,17,18,20,23,1);break}case 3:Nt(e,18),Nt(e,29),Nt(e,24),Nt(e,35)}}function Ng(e,t){let r;for(r=0;r<t;++r)oe(e,0),r%2===1&&oe(e,1),r%8===7&&oe(e,2),r%16===15&&oe(e,3)}function N0(e,t){let r,n;for(n=8,r=23;r>=0;--r)e.ct[r]=0,t>=Re[r][n]&&(t-=Re[r][n--],e.ct[r]=1)}function Ji(e,t){let r;for(r=0;r<24;++r)e.ct[r]=t.ct[r]}function _o(){let e;for(C0(this),e=0;e<8;++e)this.ct[e]=1;for(e=8;e<24;++e)this.ct[e]=0}function Yi(e,t){let r;for(C0(this),r=0;r<24;++r)this.ct[r]=~~(e.ct[r]/2)===t?1:0}function bo(e){let t;for(C0(this),t=0;t<24;++t)this.ct[t]=e[t]}function Cd(){let e,t,r=new _o,n=new _o;for(e=0;e<15582;++e)for(N0(n,La[e]),t=0;t<36;++t)Ji(r,n),Nt(r,t),ma[e][t]=Zi(r)}function Nd(){let e,t,r,n,l,o,i,a;for(ha(It),It[0]=0,t=0,r=1;r!==15582;)for(o=t>4,a=o?-1:t,e=o?t:-1,++t,n=0;n<15582;++n)if(It[n]===a){for(i=0;i<27;++i)if(l=~~ma[n][i]>>>6,It[l]===e)if(++r,o){It[n]=t;break}else It[l]=t}}function Pd(e){let t,r,n,l=new bo(e.ct);for(n=0;n<48;++n){for(t=!0,r=0;r<24;++r)if(l.ct[r]!==~~(r/4)){t=!1;break}if(t)return n;oe(l,0),n%2===1&&oe(l,1),n%8===7&&oe(l,2),n%16===15&&oe(l,3)}return-1}function Md(){let e,t,r,n=new _o;for(e=0;e<24;++e)n.ct[e]=e;let l=new bo(n.ct),o=new bo(n.ct),i=new bo(n.ct);for(e=0;e<48;++e){for(t=0;t<48;++t){for(r=0;r<48;++r)Cg(n,l)&&(Al[e][t]=r,r===0&&(Dl[e]=t)),oe(l,0),r%2===1&&oe(l,1),r%8===7&&oe(l,2),r%16===15&&oe(l,3);oe(n,0),t%2===1&&oe(n,1),t%8===7&&oe(n,2),t%16===15&&oe(n,3)}oe(n,0),e%2===1&&oe(n,1),e%8===7&&oe(n,2),e%16===15&&oe(n,3)}for(e=0;e<48;++e)for(Ji(n,o),Ng(n,Dl[e]),t=0;t<36;++t)for(Ji(l,n),Nt(l,t),Ng(l,e),r=0;r<36;++r)if(Ji(i,o),Nt(i,r),Cg(i,l)){Pt[e][t]=r;break}for(N0(n,0),e=0;e<48;++e)P0[Dl[e]]=na(n),oe(n,0),e%2===1&&oe(n,1),e%8===7&&oe(n,2),e%16===15&&oe(n,3)}function Id(){let e,t,r,n,l=new _o,o=O(22984);for(t=0;t<22984;t++)o[t]=0;for(e=0,t=0;t<735471;++t)if((o[~~t>>>5]&1<<(t&31))===0){for(N0(l,t),n=0;n<48;++n)r=na(l),o[~~r>>>5]|=1<<(r&31),xl!==null&&(xl[r]=e<<6|Dl[n]),oe(l,0),n%2===1&&oe(l,1),n%8===7&&oe(l,2),n%16===15&&oe(l,3);La[e++]=t}}function Od(e){let t=xR(La,e);return t>=0?t:-1}function Td(){Pg||(Pg=!0,aa=O(70,28),ia=O(6435,28),ac=O(70,16),oc=O(6435,16),lt=O(450450),ic=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0])}function la(e){let t,r,n;for(r=0,n=8,t=14;t>=0;--t)e.ct[t]!==e.ct[15]&&(r+=Re[t][n--]);return r}function oa(e){let t,r,n;for(r=0,n=4,t=6;t>=0;--t)e.rl[t]!==e.rl[7]&&(r+=Re[t][n--]);return r*2+e.parity}function Fl(e,t){e.parity^=ic[t];let r=t%3;switch(t=~~(t/3),t){case 0:{h(e.ct,0,1,2,3,r);break}case 1:{h(e.rl,0,1,2,3,r);break}case 2:{h(e.ct,8,9,10,11,r);break}case 3:{h(e.ct,4,5,6,7,r);break}case 4:{h(e.rl,4,5,6,7,r);break}case 5:{h(e.ct,12,13,14,15,r);break}case 6:{h(e.ct,0,1,2,3,r),h(e.rl,0,5,4,1,r),h(e.ct,8,9,12,13,r);break}case 7:{h(e.rl,0,1,2,3,r),h(e.ct,1,15,5,9,r),h(e.ct,2,12,6,10,r);break}case 8:{h(e.ct,8,9,10,11,r),h(e.rl,0,3,6,5,r),h(e.ct,3,2,5,4,r);break}case 9:{h(e.ct,4,5,6,7,r),h(e.rl,3,2,7,6,r),h(e.ct,11,10,15,14,r);break}case 10:{h(e.rl,4,5,6,7,r),h(e.ct,0,8,4,14,r),h(e.ct,3,11,7,13,r);break}case 11:h(e.ct,12,13,14,15,r),h(e.rl,1,4,7,2,r),h(e.ct,1,0,7,6,r)}}function dl(e,t){switch(t){case 0:{Fl(e,19),Fl(e,28);break}case 1:{Fl(e,21),Fl(e,32);break}case 2:h(e.ct,0,3,1,2,1),h(e.ct,8,11,9,10,1),h(e.ct,4,7,5,6,1),h(e.ct,12,15,13,14,1),h(e.rl,0,3,5,6,1),h(e.rl,1,2,4,7,1)}}function lc(e,t,r){let n;for(n=0;n<16;++n)e.ct[n]=~~(t.ct[n]/2);for(n=0;n<8;++n)e.rl[n]=t.ct[n+16];e.parity=r}function Mg(e,t){let r,n;for(n=8,e.ct[15]=0,r=14;r>=0;--r)t>=Re[r][n]?(t-=Re[r][n--],e.ct[r]=1):e.ct[r]=0}function Ig(e,t){let r,n;for(e.parity=t&1,t>>>=1,n=4,e.rl[7]=0,r=6;r>=0;--r)t>=Re[r][n]?(t-=Re[r][n--],e.rl[r]=1):e.rl[r]=0}function M0(){this.rl=O(8),this.ct=O(16)}function Gd(){let e,t,r,n,l,o,i,a,s,f,u=new M0;for(l=0;l<70;++l)for(a=0;a<28;++a)Ig(u,l),Fl(u,Dn[a]),aa[l][a]=oa(u);for(l=0;l<70;++l)for(Ig(u,l),i=0;i<16;++i)ac[l][i]=oa(u),dl(u,0),i%2===1&&dl(u,1),i%8===7&&dl(u,2);for(l=0;l<6435;++l)for(Mg(u,l),i=0;i<16;++i)oc[l][i]=la(u)&65535,dl(u,0),i%2===1&&dl(u,1),i%8===7&&dl(u,2);for(l=0;l<6435;++l)for(a=0;a<28;++a)Mg(u,l),Fl(u,Dn[a]),ia[l][a]=la(u)&65535;for(ha(lt),lt[0]=lt[18]=lt[28]=lt[46]=lt[54]=lt[56]=0,r=0,n=6;n!==450450;){let g=r>6,c=g?-1:r,p=g?r:-1;for(++r,l=0;l<450450;++l)if(lt[l]===c){for(e=~~(l/70),s=l%70,a=0;a<23;++a)if(t=ia[e][a],f=aa[s][a],o=t*70+f,lt[o]===p)if(++n,g){lt[l]=r;break}else lt[o]=r}}}function Wd(){Og||(Og=!0,wo=O(29400,20),fc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1],Mr=O(29400),T0=[0,9,14,23,27,28,41,42,46,55,60,69],G0=O(70))}function I0(e){let t,r,n,l;for(r=0,l=4,t=6;t>=0;--t)e.ud[t]!==e.ud[7]&&(r+=Re[t][l--]);for(r*=35,l=4,t=6;t>=0;--t)e.fb[t]!==e.fb[7]&&(r+=Re[t][l--]);r*=12;let o=e.fb[7]^e.ud[7];for(n=0,l=4,t=7;t>=0;--t)e.rl[t]!==o&&(n+=Re[t][l--]);return e.parity+2*(r+G0[n])}function Kd(e,t){switch(e.parity^=fc[t],t){case 0:case 1:case 2:{h(e.ud,0,1,2,3,t%3);break}case 3:{h(e.rl,0,1,2,3,1);break}case 4:case 5:case 6:{h(e.fb,0,1,2,3,(t-1)%3);break}case 7:case 8:case 9:{h(e.ud,4,5,6,7,(t-1)%3);break}case 10:{h(e.rl,4,5,6,7,1);break}case 11:case 12:case 13:{h(e.fb,4,5,6,7,(t+1)%3);break}case 14:{h(e.ud,0,1,2,3,1),h(e.rl,0,5,4,1,1),h(e.fb,0,5,4,1,1);break}case 15:{h(e.rl,0,1,2,3,1),h(e.fb,1,4,7,2,1),h(e.ud,1,6,5,2,1);break}case 16:{h(e.fb,0,1,2,3,1),h(e.ud,3,2,5,4,1),h(e.rl,0,3,6,5,1);break}case 17:{h(e.ud,4,5,6,7,1),h(e.rl,3,2,7,6,1),h(e.fb,3,2,7,6,1);break}case 18:{h(e.rl,4,5,6,7,1),h(e.fb,0,3,6,5,1),h(e.ud,0,3,4,7,1);break}case 19:h(e.fb,4,5,6,7,1),h(e.ud,0,7,6,1,1),h(e.rl,1,4,7,2,1)}}function sc(e,t,r){let n,l=(t.ct[0]>t.ct[8]?1:0)^(t.ct[8]>t.ct[16]?1:0)^(t.ct[0]>t.ct[16]?1:0)?1:0;for(n=0;n<8;++n)e.ud[n]=t.ct[n]&1^1,e.fb[n]=t.ct[n+8]&1^1,e.rl[n]=t.ct[n+16]&1^1^l;e.parity=l^r}function Qd(e,t){let r,n,l,o;for(e.parity=t&1,t>>>=1,l=T0[t%12],t=~~(t/12),o=4,r=7;r>=0;--r)e.rl[r]=0,l>=Re[r][o]&&(l-=Re[r][o--],e.rl[r]=1);for(n=t%35,t=~~(t/35),o=4,e.fb[7]=0,r=6;r>=0;--r)n>=Re[r][o]?(n-=Re[r][o--],e.fb[r]=1):e.fb[r]=0;for(o=4,e.ud[7]=0,r=6;r>=0;--r)t>=Re[r][o]?(t-=Re[r][o--],e.ud[r]=1):e.ud[r]=0}function O0(){this.ud=O(8),this.rl=O(8),this.fb=O(8)}function jd(){let e,t,r,n;for(r=0;r<12;++r)G0[T0[r]]=r;let l=new O0;for(r=0;r<29400;++r)for(n=0;n<20;++n)Qd(l,r),Kd(l,n),wo[r][n]=I0(l)&65535;for(ha(Mr),Mr[0]=0,e=0,t=1;t!==29400;){for(r=0;r<29400;++r)if(Mr[r]===e)for(n=0;n<17;++n)Mr[wo[r][n]]===-1&&(Mr[wo[r][n]]=e+1,++t);++e}}function qd(e,t){let r;for(r=0;r<24;++r)e.ct[r]=t.ct[r]}function Vd(e,t){let r=t%3;switch(t=~~(t/3),t){case 0:{h(e.ct,0,1,2,3,r);break}case 1:{h(e.ct,16,17,18,19,r);break}case 2:{h(e.ct,8,9,10,11,r);break}case 3:{h(e.ct,4,5,6,7,r);break}case 4:{h(e.ct,20,21,22,23,r);break}case 5:{h(e.ct,12,13,14,15,r);break}case 6:{h(e.ct,0,1,2,3,r),h(e.ct,8,20,12,16,r),h(e.ct,9,21,13,17,r);break}case 7:{h(e.ct,16,17,18,19,r),h(e.ct,1,15,5,9,r),h(e.ct,2,12,6,10,r);break}case 8:{h(e.ct,8,9,10,11,r),h(e.ct,2,19,4,21,r),h(e.ct,3,16,5,22,r);break}case 9:{h(e.ct,4,5,6,7,r),h(e.ct,10,18,14,22,r),h(e.ct,11,19,15,23,r);break}case 10:{h(e.ct,20,21,22,23,r),h(e.ct,0,8,4,14,r),h(e.ct,3,11,7,13,r);break}case 11:h(e.ct,12,13,14,15,r),h(e.ct,1,20,7,18,r),h(e.ct,0,23,6,17,r)}}function W0(){let e;for(this.ct=O(24),e=0;e<24;++e)this.ct[e]=~~(e/4)}function uc(e){let t,r,n;for(W0.call(this),t=0;t<23;++t)n=t+e(24-t),this.ct[n]!==this.ct[t]&&(r=this.ct[t],this.ct[t]=this.ct[n],this.ct[n]=r)}function Hd(){Tg||(Tg=!0,xt=O(18),Jd())}function gc(e){e.cp=[0,1,2,3,4,5,6,7],e.co=[0,0,0,0,0,0,0,0]}function cc(e,t){let r;for(r=0;r<8;++r)e.cp[r]=t.cp[r],e.co[r]=t.co[r]}function Xd(e,t){!e.temps&&(e.temps=new Ba),pc(e,xt[t],e.temps),cc(e,e.temps)}function Zd(e,t){let r,n;for(n=0,r=6;r>=0;--r)n+=e.co[r]=t%3,t=~~(t/3);e.co[7]=(15-n)%3}function pc(e,t,r){let n,l,o,i;for(n=0;n<8;++n)r.cp[n]=e.cp[t.cp[n]],o=e.co[t.cp[n]],i=t.co[n],l=o,l=l+(o<3?i:6-i),l=l%3,(o>=3?1:0)^(i>=3?1:0)&&(l=l+3),r.co[n]=l}function Ba(){gc(this)}function Pr(e,t){gc(this),Eg(this.cp,e),Zd(this,t)}function mc(e){Pr.call(this,e(40320),e(2187))}function Jd(){let e,t;for(xt[0]=new Pr(15120,0),xt[3]=new Pr(21021,1494),xt[6]=new Pr(8064,1236),xt[9]=new Pr(9,0),xt[12]=new Pr(1230,412),xt[15]=new Pr(224,137),e=0;e<18;e+=3)for(t=0;t<2;++t)xt[e+t+1]=new Ba,pc(xt[e+t],xt[e],xt[e+t+1])}function Yd(){Gg||(Gg=!0,Mt=O(1937880),da=O(1538),ua=O(1538),El=O(11880),hc=[0,1,6,3,4,5,2,7],Q0=O(160,12),j0=O(160,12),K0=[1,1,1,3,12,60,360,2520,20160,181440,1814400,19958400,239500800],b0=[0,2,4,6,1,3,7,5,8,9,10,11])}function Rl(e,t,r,n,l){let o=e.edgeo[l];e.edgeo[l]=e.edge[n],e.edge[n]=e.edgeo[r],e.edgeo[r]=e.edge[t],e.edge[t]=o}function Ul(e,t){let r,n,l,o,i;for(e.isStd||dc(e),n=0,i=1985229328,o=47768,r=0;r<t;++r)l=e.edge[r]<<2,n*=12-r,l>=32?(n+=o>>l-32&15,o-=4368<<l-32):(n+=i>>l&15,o-=4369,i-=286331152<<l);return n}function Lc(e){let t,r=Ul(e,4);t=El[r];let n=t&7;t>>=3,fa(e,n);let l=Ul(e,10)%20160;return t*20160+l}function sa(e,t){switch(e.isStd=!1,t){case 0:{ue(e.edge,0,4,1,5),ue(e.edgeo,0,4,1,5);break}case 1:{Fe(e.edge,0,4,1,5),Fe(e.edgeo,0,4,1,5);break}case 2:{ue(e.edge,0,5,1,4),ue(e.edgeo,0,5,1,4);break}case 3:{Fe(e.edge,5,10,6,11),Fe(e.edgeo,5,10,6,11);break}case 4:{ue(e.edge,0,11,3,8),ue(e.edgeo,0,11,3,8);break}case 5:{Fe(e.edge,0,11,3,8),Fe(e.edgeo,0,11,3,8);break}case 6:{ue(e.edge,0,8,3,11),ue(e.edgeo,0,8,3,11);break}case 7:{ue(e.edge,2,7,3,6),ue(e.edgeo,2,7,3,6);break}case 8:{Fe(e.edge,2,7,3,6),Fe(e.edgeo,2,7,3,6);break}case 9:{ue(e.edge,2,6,3,7),ue(e.edgeo,2,6,3,7);break}case 10:{Fe(e.edge,4,8,7,9),Fe(e.edgeo,4,8,7,9);break}case 11:{ue(e.edge,1,9,2,10),ue(e.edgeo,1,9,2,10);break}case 12:{Fe(e.edge,1,9,2,10),Fe(e.edgeo,1,9,2,10);break}case 13:{ue(e.edge,1,10,2,9),ue(e.edgeo,1,10,2,9);break}case 14:{Fe(e.edge,0,4,1,5),Fe(e.edgeo,0,4,1,5),ue(e.edge,9,11),ue(e.edgeo,8,10);break}case 15:{Fe(e.edge,5,10,6,11),Fe(e.edgeo,5,10,6,11),ue(e.edge,1,3),ue(e.edgeo,0,2);break}case 16:{Fe(e.edge,0,11,3,8),Fe(e.edgeo,0,11,3,8),ue(e.edge,5,7),ue(e.edgeo,4,6);break}case 17:{Fe(e.edge,2,7,3,6),Fe(e.edgeo,2,7,3,6),ue(e.edge,8,10),ue(e.edgeo,9,11);break}case 18:{Fe(e.edge,4,8,7,9),Fe(e.edgeo,4,8,7,9),ue(e.edge,0,2),ue(e.edgeo,1,3);break}case 19:Fe(e.edge,1,9,2,10),Fe(e.edgeo,1,9,2,10),ue(e.edge,4,6),ue(e.edgeo,5,7)}}function yl(e,t){switch(e.isStd=!1,t){case 0:{sa(e,14),sa(e,17);break}case 1:{Rl(e,11,5,10,6),Rl(e,5,10,6,11),Rl(e,1,2,3,0),Rl(e,4,9,7,8),Rl(e,8,4,9,7),Rl(e,0,1,2,3);break}case 2:vt(e,4,5),vt(e,5,4),vt(e,11,8),vt(e,8,11),vt(e,7,6),vt(e,6,7),vt(e,9,10),vt(e,10,9),vt(e,1,1),vt(e,0,0),vt(e,3,3),vt(e,2,2)}}function fa(e,t){for(;t>=2;)t-=2,yl(e,1),yl(e,2);t!==0&&yl(e,0)}function No(e,t){let r,n,l,o,i,a;for(i=1985229328,a=47768,l=0,r=0;r<11;++r)if(n=K0[11-r],o=~~(t/n),t=t%n,l^=o,o<<=2,o>=32){o=o-32,e.edge[r]=a>>o&15;let s=(1<<o)-1;a=(a&s)+(a>>4&~s)}else{e.edge[r]=i>>o&15;let s=(1<<o)-1;i=(i&s)+(i>>>4&~s)+(a<<28),a=a>>4}for((l&1)===0?e.edge[11]=i:(e.edge[11]=e.edge[10],e.edge[10]=i),r=0;r<12;++r)e.edgeo[r]=r;e.isStd=!0}function Wg(e,t){let r;for(r=0;r<12;++r)e.edge[r]=t.edge[r],e.edgeo[r]=t.edgeo[r];e.isStd=t.isStd}function Bc(e,t){let r,n,l,o;for(e.temp===null&&(e.temp=O(12)),r=0;r<12;++r)e.temp[r]=r,e.edge[r]=t.ep[b0[r]+12]%12;for(n=1,r=0;r<12;++r)for(;e.edge[r]!==r;)o=e.edge[r],e.edge[r]=e.edge[o],e.edge[o]=o,l=e.temp[r],e.temp[r]=e.temp[o],e.temp[o]=l,n^=1;for(r=0;r<12;++r)e.edge[r]=e.temp[t.ep[b0[r]]%12];return n}function dc(e){let t;for(e.temp===null&&(e.temp=O(12)),t=0;t<12;++t)e.temp[e.edgeo[t]]=t;for(t=0;t<12;++t)e.edge[t]=e.temp[e.edge[t]],e.edgeo[t]=t;e.isStd=!0}function Fe(e,t,r,n,l){let o;o=e[t],e[t]=e[n],e[n]=o,o=e[r],e[r]=e[l],e[l]=o}function vt(e,t,r){let n=e.edge[t];e.edge[t]=e.edgeo[r],e.edgeo[r]=n}function pr(){this.edge=O(12),this.edgeo=O(12)}function $d(){let e,t,r,n,l,o,i,a,s,f,u,g,c,p,L,m,d,F,A,S,x,U,P=new pr,Z=new pr,C=new pr;for(ha(Mt),a=0,Xi=1,S0(Mt,0,0);Xi!==31006080&&(L=a>9,i=a%3,o=(a+1)%3,f=L?3:i,e=L?i:3,!(a>=9));){for(g=0;g<31006080;g+=16)if(U=Mt[~~g>>4],!(!L&&U===-1)){for(u=g,s=g+16;u<s;++u,U>>=2)if((U&3)===f){for(A=~~(u/20160),t=da[A],n=u%20160,No(P,t*20160+n),d=0;d<17;++d)if(r=bl(P.edge,d<<3,4),S=El[r],x=S&7,S>>=3,l=bl(P.edge,d<<3|x,10)%20160,c=S*20160+l,zo(Mt,c)===e){if(S0(Mt,L?u:c,o),++Xi,L)break;if(F=ua[S],F!==1)for(Wg(Z,P),sa(Z,d),fa(Z,x),m=1;(F=~~F>>1&65535)!==0;++m)(F&1)===1&&(Wg(C,Z),fa(C,m),p=S*20160+Ul(C,10)%20160,zo(Mt,p)===e&&(S0(Mt,p,o),++Xi))}}}++a}}function zo(e,t){return e[t>>4]>>((t&15)<<1)&3}function bl(e,t,r){let n,l,o,i,a,s=j0[t],f=Q0[t];for(l=0,a=1985229328,i=47768,n=0;n<r;++n)o=s[e[f[n]]]<<2,l*=12-n,o>=32?(l+=i>>o-32&15,i-=4368<<o-32):(l+=a>>o&15,i-=4369,a-=286331152<<o);return l}function Rc(e){let t,r,n,l,o,i,a,s,f,u,g,c=new pr;if(i=0,o=zo(Mt,e),o===3)return 10;for(;e!==0;)for(o===0?o=2:--o,f=~~(e/20160),t=da[f],n=e%20160,No(c,t*20160+n),s=0;s<17;++s)if(r=bl(c.edge,s<<3,4),u=El[r],g=u&7,u>>=3,l=bl(c.edge,s<<3|g,10)%20160,a=u*20160+l,zo(Mt,a)===o){++i,e=a;break}return i}function eR(e,t){let r=zo(Mt,e);return r===3?10:(1227133513<<r>>t&3)+t-1}function tR(){let e,t,r,n=new pr;for(t=0;t<20;++t)for(r=0;r<8;++r){for(No(n,0),sa(n,t),fa(n,r),e=0;e<12;++e)Q0[t<<3|r][e]=n.edge[e];for(dc(n),e=0;e<12;++e)j0[t<<3|r][e]=n.temp[e]}}function rR(){let e,t,r,n,l=new pr,o=O(1485);for(t=0;t<1485;t++)o[t]=0;for(e=0,t=0;t<11880;++t)if((o[~~t>>>3]&1<<(t&7))===0){for(No(l,t*K0[8]),n=0;n<8;++n)r=Ul(l,4),r===t&&(ua[e]=(ua[e]|1<<n)&65535),o[~~r>>3]=o[~~r>>3]|1<<(r&7),El[r]=e<<3|hc[n],yl(l,0),n%2===1&&(yl(l,1),yl(l,2));da[e++]=t}}function S0(e,t,r){e[t>>4]^=(3^r)<<((t&15)<<1)}function nR(){Kg||(Kg=!0)}function lR(e){let t,r,n;for(t=0,n=!1,r=0;r<12;++r)t|=1<<e.ep[r],n=n!==e.ep[r]>=12;return t&=~~t>>12,t===0&&!n}function oR(e,t){let r;for(r=0;r<24;++r)e.ep[r]=t.ep[r]}function iR(e,t){let r=t%3;switch(t=~~(t/3),t){case 0:{h(e.ep,0,1,2,3,r),h(e.ep,12,13,14,15,r);break}case 1:{h(e.ep,11,15,10,19,r),h(e.ep,23,3,22,7,r);break}case 2:{h(e.ep,0,11,6,8,r),h(e.ep,12,23,18,20,r);break}case 3:{h(e.ep,4,5,6,7,r),h(e.ep,16,17,18,19,r);break}case 4:{h(e.ep,1,20,5,21,r),h(e.ep,13,8,17,9,r);break}case 5:{h(e.ep,2,9,4,10,r),h(e.ep,14,21,16,22,r);break}case 6:{h(e.ep,0,1,2,3,r),h(e.ep,12,13,14,15,r),h(e.ep,9,22,11,20,r);break}case 7:{h(e.ep,11,15,10,19,r),h(e.ep,23,3,22,7,r),h(e.ep,2,16,6,12,r);break}case 8:{h(e.ep,0,11,6,8,r),h(e.ep,12,23,18,20,r),h(e.ep,3,19,5,13,r);break}case 9:{h(e.ep,4,5,6,7,r),h(e.ep,16,17,18,19,r),h(e.ep,8,23,10,21,r);break}case 10:{h(e.ep,1,20,5,21,r),h(e.ep,13,8,17,9,r),h(e.ep,14,0,18,4,r);break}case 11:h(e.ep,2,9,4,10,r),h(e.ep,14,21,16,22,r),h(e.ep,7,15,1,17,r)}}function q0(){let e;for(this.ep=O(24),e=0;e<24;++e)this.ep[e]=e}function Fc(e){let t,r,n;for(q0.call(this),t=0;t<23;++t)n=t+e(24-t),n!==t&&(r=this.ep[t],this.ep[t]=this.ep[n],this.ep[n]=r)}function aR(){Qg||(Qg=!0,w0=[35,1,34,2,4,6,22,5,19])}function Dc(e){e.moveBuffer=O(60)}function sR(e,t){return e.value-t.value}function wl(e,t){let r;for(oR(e.edge,t.edge),qd(e.center,t.center),cc(e.corner,t.corner),e.value=t.value,e.add1=t.add1,e.length1=t.length1,e.length2=t.length2,e.length3=t.length3,e.sym=t.sym,r=0;r<60;++r)e.moveBuffer[r]=t.moveBuffer[r];e.moveLength=t.moveLength,e.edgeAvail=t.edgeAvail,e.centerAvail=t.centerAvail,e.cornerAvail=t.cornerAvail}function Ir(e){for(;e.centerAvail<e.moveLength;)Vd(e.center,e.moveBuffer[e.centerAvail++]);return e.center}function Ac(e){for(;e.cornerAvail<e.moveLength;)Xd(e.corner,e.moveBuffer[e.cornerAvail++]%18);return e.corner}function Co(e){for(;e.edgeAvail<e.moveLength;)iR(e.edge,e.moveBuffer[e.edgeAvail++]);return e.edge}function fR(e){let t,r,n,l,o,i,a=new Array(e.moveLength-(e.add1?2:0));for(r=0,t=0;t<e.length1;++t)a[r++]=e.moveBuffer[t];for(i=e.sym,t=e.length1+(e.add1?2:0);t<e.moveLength;++t)Pt[i][e.moveBuffer[t]]>=27?(a[r++]=Pt[i][e.moveBuffer[t]]-9,l=w0[Pt[i][e.moveBuffer[t]]-27],i=Al[i][l]):a[r++]=Pt[i][e.moveBuffer[t]];let s=Al[Dl[i]][Pd(Ir(e))];for(o="",i=s,t=r-1;t>=0;--t)n=a[t],n=~~(n/3)*3+(2-n%3),Pt[i][n]>=27?(o=\`\${o}\${E0[Pt[i][n]-9]} \`,l=w0[Pt[i][n]-27],i=Al[i][l]):o=\`\${o}\${E0[Pt[i][n]]} \`;return o}function Fn(e,t){e.moveBuffer[e.moveLength++]=t}function ga(){Dc(this),this.edge=new q0,this.center=new W0,this.corner=new Ba}function Ra(e){ga.call(this),wl(this,e)}function yc(e){Dc(this),this.edge=new Fc(e),this.center=new uc(e),this.corner=new mc(e)}function uR(e,t){return t.value-e.value}function ca(e,t){return uR(e,t)}function Sc(){}function gR(){if(jg)return;jg=!0;let e,t;for(E0=["U ","U2 ","U' ","R ","R2 ","R' ","F ","F2 ","F' ","D ","D2 ","D' ","L ","L2 ","L' ","B ","B2 ","B' ","Uw ","Uw2","Uw'","Rw ","Rw2","Rw'","Fw ","Fw2","Fw'","Dw ","Dw2","Dw'","Lw ","Lw2","Lw'","Bw ","Bw2","Bw'"],Dn=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,21,22,23,25,28,30,31,32,34,36],Uo=[0,1,2,4,6,7,8,9,10,11,13,15,16,17,19,22,25,28,31,34,36],qg=O(37),Vg=O(37),hl=O(37,36),$i=O(29,28),ea=O(21,20),v0=O(36),Eo=O(28),Sl=O(20),e=0;e<29;++e)qg[Dn[e]]=e;for(e=0;e<21;++e)Vg[Uo[e]]=e;for(e=0;e<36;++e){for(t=0;t<36;++t)hl[e][t]=~~(e/3)===~~(t/3)||~~(e/3)%3===~~(t/3)%3&&e>t;hl[36][e]=!1}for(e=0;e<29;++e)for(t=0;t<28;++t)$i[e][t]=hl[Dn[e]][Dn[t]];for(e=0;e<21;++e)for(t=0;t<20;++t)ea[e][t]=hl[Uo[e]][Uo[t]];for(e=0;e<36;++e)for(v0[e]=36,t=e;t<36;++t)if(!hl[e][t]){v0[e]=t-1;break}for(e=0;e<28;++e)for(Eo[e]=28,t=e;t<28;++t)if(!$i[e][t]){Eo[e]=t-1;break}for(e=0;e<20;++e)for(Sl[e]=20,t=e;t<20;++t)if(!ea[e][t]){Sl[e]=t-1;break}}function cR(e){let t,r,n,l,o,i,a,s,f,u,g,c;e.solution="";let p=Zi(new Yi(Ir(e.c),0)),L=Zi(new Yi(Ir(e.c),1)),m=Zi(new Yi(Ir(e.c),2)),d=It[~~p>>6],F=It[~~L>>6],A=It[~~m>>6];for(e.p1SolsCnt=0,e.arr2idx=0,DR(e.p1sols.heap),e.length1=(d<F?d:F)<A?d<F?d:F:A;e.length1<100&&!(A<=e.length1&&ta(e,~~m>>>6,m&63,e.length1,-1,0)||d<=e.length1&&ta(e,~~p>>>6,p&63,e.length1,-1,0)||F<=e.length1&&ta(e,~~L>>>6,L&63,e.length1,-1,0));++e.length1);let S=_R(e.p1sols,z0(CR,Tr([Sd,k0,_0]),$g,0,0));S.sort(function(P,Z){return P.value-Z.value}),t=9;do{e:for(s=S[0].value;s<100;++s)for(i=0;i<S.length&&!(S[i].value>s);++i)if(!(s-S[i].length1>t)&&(wl(e.c1,S[i]),lc(e.ct2,Ir(e.c1),pa(Co(e.c1).ep)),g=la(e.ct2),c=oa(e.ct2),e.length1=S[i].length1,e.length2=s-S[i].length1,vc(e,g,c,e.length2,28,0)))break e;++t}while(s===100);e.arr2.sort(function(P,Z){return P.value-Z.value}),a=0,r=13;do{e:for(f=e.arr2[0].value;f<100;++f)for(i=0;i<Math.min(e.arr2idx,100)&&!(e.arr2[i].value>f);++i)if(!(f-e.arr2[i].length1-e.arr2[i].length2>r)&&(o=Bc(e.e12,Co(e.arr2[i])),sc(e.ct3,Ir(e.arr2[i]),o^pa(Ac(e.arr2[i]).cp)),n=I0(e.ct3),l=Ul(e.e12,10),u=Rc(Lc(e.e12)),u<=f-e.arr2[i].length1-e.arr2[i].length2&&xc(e,l,n,u,f-e.arr2[i].length1-e.arr2[i].length2,20,0))){a=i;break e}++r}while(f===100);let x=new Ra(e.arr2[a]);e.length1=x.length1,e.length2=x.length2;let U=f-e.length1-e.length2;for(i=0;i<U;++i)Fn(x,Uo[e.move3[i]]);e.solution=fR(x)}function pR(e,t){let r,n;for(wl(e.c1,e.c),r=0;r<e.length1;++r)Fn(e.c1,e.move1[r]);switch(P0[t]){case 0:{Fn(e.c1,24),Fn(e.c1,35),e.move1[e.length1]=24,e.move1[e.length1+1]=35,e.add1=!0,t=19;break}case 12869:{Fn(e.c1,18),Fn(e.c1,29),e.move1[e.length1]=18,e.move1[e.length1+1]=29,e.add1=!0,t=34;break}case 735470:e.add1=!1,t=0}lc(e.ct2,Ir(e.c1),pa(Co(e.c1).ep));let l=la(e.ct2),o=oa(e.ct2),i=lt[l*70+o];return e.c1.value=i+e.length1,e.c1.length1=e.length1,e.c1.add1=e.add1,e.c1.sym=t,++e.p1SolsCnt,e.p1sols.heap.size<500?n=new Ra(e.c1):(n=ER(e.p1sols),n.value>e.c1.value&&wl(n,e.c1)),RR(e.p1sols,n),e.p1SolsCnt===1e4}function mR(e){let t;for(wl(e.c2,e.c1),t=0;t<e.length2;++t)Fn(e.c2,e.move2[t]);if(!lR(Co(e.c2)))return!1;let r=Bc(e.e12,Co(e.c2));sc(e.ct3,Ir(e.c2),r^pa(Ac(e.c2).cp));let n=I0(e.ct3);Ul(e.e12,10);let l=Rc(Lc(e.e12));return e.arr2[e.arr2idx]?wl(e.arr2[e.arr2idx],e.c2):e.arr2[e.arr2idx]=new Ra(e.c2),e.arr2[e.arr2idx].value=e.length1+e.length2+Math.max(l,Mr[n]),e.arr2[e.arr2idx].length2=e.length2,++e.arr2idx,e.arr2idx===e.arr2.length}function LR(e,t){return bc(),e.c=new yc(t),cR(e),e.solution}function ta(e,t,r,n,l,o){let i,a,s,f,u,g;if(t===0)return n===0&&pR(e,r);for(i=0;i<27;i+=3)if(!(i===l||i===l-9||i===l-18))for(f=0;f<3;++f){if(s=i+f,a=ma[t][Pt[r][s]],u=It[~~a>>>6],u>=n){if(u>n)break;continue}if(g=Al[r][a&63],a>>>=6,e.move1[o]=s,ta(e,a,g,n-1,i,o+1))return!0}return!1}function vc(e,t,r,n,l,o){let i,a,s,f;if(t===0&<[r]===0)return n===0&&mR(e);for(a=0;a<23;++a){if($i[l][a]){a=Eo[a];continue}if(i=ia[t][a],f=aa[r][a],s=lt[i*70+f],s>=n){s>n&&(a=Eo[a]);continue}if(e.move2[o]=Dn[a],vc(e,i,f,n-1,a,o+1))return!0}return!1}function xc(e,t,r,n,l,o,i){let a,s,f,u,g,c,p,L,m;if(l===0)return t===0&&r===0;for(No(e.tempe[i],t),g=0;g<17;++g){if(ea[o][g]){g=Sl[g];continue}if(f=wo[r][g],c=Mr[f],c>=l){c>l&&g<14&&(g=Sl[g]);continue}if(u=bl(e.tempe[i].edge,g<<3,10),a=~~(u/20160),L=El[a],m=L&7,L>>=3,s=bl(e.tempe[i].edge,g<<3|m,10)%20160,p=eR(L*20160+s,n),p>=l){p>l&&g<14&&(g=Sl[g]);continue}if(xc(e,u,f,p,l-1,g,i+1))return e.move3[i]=g,!0}return!1}function Uc(){let e;for(this.p1sols=new Cc(new Sc),this.move1=O(15),this.move2=O(20),this.move3=O(20),this.c1=new ga,this.c2=new ga,this.ct2=new M0,this.ct3=new O0,this.e12=new pr,this.tempe=O(20),this.arr2=O(100),e=0;e<20;++e)this.tempe[e]=new pr}function bc(){Hg||(Md(),xl=O(735471),Id(),Cd(),xl=null,Nd(),Gd(),jd(),tR(),rR(),$d(),Hg=!0)}function BR(){Xg||(Xg=!0)}function pa(e){let t,r,n,l;for(l=0,t=0,n=e.length;t<n;++t)for(r=t;r<n;++r)e[t]>e[r]&&(l^=1);return l}function h(e,t,r,n,l,o){let i;switch(o){case 0:{i=e[l],e[l]=e[n],e[n]=e[r],e[r]=e[t],e[t]=i;return}case 1:{i=e[t],e[t]=e[n],e[n]=i,i=e[r],e[r]=e[l],e[l]=i;return}case 2:{i=e[t],e[t]=e[r],e[r]=e[n],e[n]=e[l],e[l]=i;return}}}function wc(){}function Ec(e,t,r,n){let l=new wc;return l.typeName=e+t,_c(r!==0?-r:0)&&zc(r!==0?-r:0,l),l.modifiers=4,l.superclass=V0,l.componentType=n,l}function kc(e,t,r,n){let l=new wc;return l.typeName=e+t,_c(r)&&zc(r,l),l.superclass=n,l}function dR(e){let t=ko[e.seedId];return e=null,t}function _c(e){return typeof e=="number"&&e>0}function zc(e,t){let r;if(t.seedId=e,e===2)r=String.prototype;else if(e>0){let n=dR(t);if(n)r=n.prototype;else{n=ko[e]=function(){},n.___clazz$=t;return}}else return;r.___clazz$=t}function RR(e,t){if(wR(e,t))return!0}function hR(e){e.array=z0(Nc,Tr([k0,_0]),Jg,0,0)}function FR(e,t){return ra(e.array,e.size++,t),!0}function DR(e){e.array=z0(Nc,Tr([k0,_0]),Jg,0,0),e.size=0}function Or(e,t){return e.array[t]}function AR(e,t){let r=e.array[t];return vR(e.array,t,1),--e.size,r}function vl(e,t,r){let n=e.array[t];return ra(e.array,t,r),n}function yR(e,t){let r;for(t.length<e.size&&(t=bd(t,e.size)),r=0;r<e.size;++r)ra(t,r,e.array[r]);return t.length>e.size&&ra(t,e.size,null),t}function SR(){hR(this),this.array.length=500}function vR(e,t,r){e.splice(t,r)}function xR(e,t){let r,n,l,o;for(n=0,r=e.length-1;n<=r;)if(l=n+(~~(r-n)>>1),o=e[l],o<t)n=l+1;else if(o>t)r=l-1;else return l;return-n-1}function ha(e){UR(e,e.length)}function UR(e,t){let r;for(r=0;r<t;++r)e[r]=-1}function bR(e,t){let r,n,l,o,i=e.heap.size,a=Or(e.heap,t);for(;t*2+1<i&&(r=(n=2*t+1,l=n+1,o=n,l<i&&ca(Or(e.heap,l),Or(e.heap,n))<0&&(o=l),o),!(ca(a,Or(e.heap,r))<0));)vl(e.heap,t,Or(e.heap,r)),t=r;vl(e.heap,t,a)}function wR(e,t){let r,n;for(n=e.heap.size,FR(e.heap,t);n>0;){if(r=n,n=~~((n-1)/2),ca(Or(e.heap,n),t)<=0)return vl(e.heap,r,t),!0;vl(e.heap,r,Or(e.heap,n))}return vl(e.heap,n,t),!0}function ER(e){if(e.heap.size===0)return null;let t=Or(e.heap,0);return kR(e),t}function kR(e){let t=AR(e.heap,e.heap.size-1);0<e.heap.size&&(vl(e.heap,0,t),bR(e,0))}function _R(e,t){return yR(e.heap,t)}function Cc(e){this.heap=new SR,this.cmp=e}function Mc(){Zg||(Zg=!0,gR(),BR(),zd(),Td(),Wd(),Yd(),Hd(),nR(),aR(),Pc=new Uc)}function NR(){Mc(),bc()}async function PR(){be(),Mc();let e=w.fromString(LR(Pc,await we()));return(await Bl()).concat(e)}var X,ko,Dd,Jg,k0,Yg,Ad,yd,$g,Sd,vd,xd,_0,_g,x0,U0,zg,It,ma,P0,xl,La,Dl,Pt,Al,Pg,ia,lt,oc,ic,aa,ac,Og,wo,fc,Mr,T0,G0,Tg,xt,Gg,b0,Xi,Mt,K0,Q0,j0,El,da,hc,ua,Kg,Qg,w0,jg,hl,$i,ea,Dn,E0,Uo,v0,Eo,Sl,qg,Vg,Hg,Xg,V0,Nc,zR,CR,Pc,Zg,Ic=y(()=>{"use strict";me();A0();kg();yt();At();ko={},Dd={},Jg=0,k0=30,Yg=21,Ad=22,yd=23,$g=24,Sd=25,vd=34,xd=26,_0=40;Rt(1,-1,Dd);X.value=null;Rt(73,1,{},ec);X.queryId$=0;_g=!1;zg=!1;Rt(153,1,Tr([Yg]),_o,Yi,bo);xl=null,Pg=!1;Rt(154,1,{},M0);X.parity=0;Og=!1;Rt(155,1,{},O0);X.parity=0;Rt(156,1,{},W0,uc);Tg=!1;Rt(157,1,Tr([Ad]),Ba,Pr,mc);X.temps=null;Gg=!1;Rt(158,1,Tr([yd]),pr);X.isStd=!0;X.temp=null;Xi=0,Kg=!1;Rt(159,1,{},q0,Fc);Qg=!1;Rt(160,1,Tr([$g,vd]),ga,Ra,yc);X.compareTo$=function(t){return sR(this,t)};X.add1=!1;X.center=null;X.centerAvail=0;X.corner=null;X.cornerAvail=0;X.edge=null;X.edgeAvail=0;X.length1=0;X.length2=0;X.length3=0;X.moveLength=0;X.sym=0;X.value=0;Rt(161,1,{},Sc);X.compare=function(t,r){return ca(t,r)};jg=!1;Rt(163,1,Tr([xd]),Uc);X.add1=!1;X.arr2idx=0;X.c=null;X.length1=0;X.length2=0;X.p1SolsCnt=0;X.solution="";Hg=!1,Xg=!1;X.val$outerIter=null;X.size=0;Rt(239,1,{},Cc);X.cmp=null;X.heap=null;V0=kc("java.lang.","Object",1,null),Nc=Ec("[Ljava.lang.","Object;",356,V0),zR=kc("cs.threephase.","FullCube",160,V0),CR=Ec("[Lcs.threephase.","FullCube;",381,zR),Zg=!1});var Oc={};mt(Oc,{initialize:()=>NR,random444Scramble:()=>PR});var Tc=y(()=>{"use strict";Ic()});function Mo(e){if(e<2)return e;let t=1;for(let r=2;r<=e;r++)t*=r;return t}function Fa(e,t){if(t<0||t>e)return 0;if(t===0||t===e)return 1;let r=1;for(let n=0;n<t;n++)r=r*(e-n)/(n+1)|0;return r}function Yc(e,t,r,n,l=e-t-r-n){return Fa(e,t+r)*Fa(t+r,t)*Fa(n+l,n)}function WR(e){e=e.slice();let t=e.length,r=Mo(t-1),n=0;for(;t>1;){t--;let l=e[0];n+=l*r;for(let o=0;o<t;o++){let i=e[o+1];e[o]=i-(i>l)}r/=t}return n}function KR(e){let t=e.length,r=0;for(let n=0;n<t-1;n++)for(let l=n;l<t;l++)e[n]>e[l]&&(r^=1);return r}function l2(e,t){let r=[],n=Mo(t-1)/2,l=0;for(let o=0;o<t-1;o++)r[o]=e/n|0,e%=n,n/=t-1-o;r[t-1]=0;for(let o=t-2;o>=0;o--)for(let i=o+1;i<t;i++)r[i]>=r[o]?r[i]++:l^=1;return l===1&&([r[t-2],r[t-1]]=[r[t-1],r[t-2]]),r}function An(e){return WR(e)>>1}function t2(e,t){let r=[0];for(let n=1;n<e;n++){let l=t(n+1);r[n]=r[l],r[l]=n}return r}function jc(e,t){let r=t2(e,t);return KR(r)===1&&([r[0],r[1]]=[r[1],r[0]]),r}function QR(e){return e|=0,31-Math.clz32(e^e-1)}function qc(e,t){e|=0,t|=0;let r=\`\${e} \${t}\`;if(Z0[r])return Z0[r];let n=Fa(e,t),l=new Uint32Array(n),o=new Uint32Array(1<<e).fill(-1);for(let i=0,a=(1<<t)-1;i<n;i++){l[i]=a,o[a]=i;let s=a|a-1;a=s+1|(~s&-~s)-1>>QR(a)+1}return Z0[r]=[l,o]}function jR(e){e|=0;let t=0;for(;e!==0;)e&=e-1,t++;return t}function Vc(e){return e&=65535,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,e}function qR(e,t){return Vc(e)|Vc(t)<<1}function Cl(e,t,r,n,l){if(e|=0,t|=0,r|=0,n|=0,l|=0,e!==t+r+n+l)throw new Error("generate_comb4_lookup_tables: invalid parameters");let o=[e,t,r,n,l].join(" ");if(J0[o])return J0[o];let[i,a]=qc(e,r+l),[s,f]=qc(e,n+l),u=Yc(e,t,r,n,l),g=new Uint32Array(u),c=new Uint32Array(4**e).fill(-1);for(let p=0,L=0;p<s.length;p++){let m=s[p];for(let d=0;d<i.length;d++){let F=i[d];if(jR(F&m)===l){let A=qR(F,m);g[L]=A,c[A]=L,L++}}}return J0[o]=[g,c]}function tt(e,t){let r=[];for(let n=0;n<t.length;n++)r[n]=e[t[n]];return r}function Nl(e,t,r){let n=[];for(let l=0;l<r.length;l++)n[l]=e[t[r[l]]];return n}function o2(e,t){let r=[];for(let n=0;n<t;n++)r[n]=n;for(let n of e)for(let l=0;l<n.length;l++)r[n[l]]=n[(l+1)%n.length];return r}function yn(e,t){let r=e.length,n=Array(r).fill(0);for(let i=1;i<r;i++)n[i]=n[i-1]+t[i-1];let l=n[r-1]+t[r-1],o=Array(l);for(let i=0;i<r;i++)t[i]&&(o[n[i]]=n[e[i]]);return o}function i2(e){let t=e.length,r=Array(t);for(let n=0;n<t;n++)r[e[n]]=n;return r}function VR(e,t){for(;e&&t;)[e,t]=[t%e,e];return Math.abs(e+t)}function HR(e,t){return e*t/VR(e,t)}function XR(e){let t=1,r=e.length,n=Array(r).fill(!1),l=-1;for(;l=n.indexOf(!1,l+1),l!==-1;){let o=0,i=l;for(;!n[i];)n[i]=!0,i=e[i],o++;t=HR(t,o)}return t}function nh(e,t){for(let r=0;r<6;r++){if(e===Ot[Gr[r][0]]&&t===Ot[Gr[r][2]])return[r,0];if(e===Ot[Gr[r][2]]&&t===Ot[Gr[r][0]])return[r,1]}throw new Error("unknown corner piece")}function lh(e,t){for(let r=0;r<12;r++)if(e===Ot[Wr[r][0]]&&t===Ot[Wr[r][1]]||t===Ot[Wr[r][0]]&&e===Ot[Wr[r][1]])return r;throw new Error("unknown edge piece")}function a2(e,t){return nh(e[Gr[t][0]],e[Gr[t][2]])}function xa(e,t){return lh(e[Wr[t][0]],e[Wr[t][1]])}function oh(e,t,r,n){let l=Gr[t],o=Gr[r].map(i=>Ot[i]);n%2!==0&&(o=[o[2],o[3],o[0],o[1]]);for(let i=0;i<4;i++)e[l[i]]=o[i]}function ih(e,t,r){let n=Wr[t],l=Wr[r].map(o=>Ot[o]);for(let o=0;o<2;o++)e[n[o]]=l[o]}function tp(e){let t=e.map(s=>Ot[s]),n=Array(6).fill().map((s,f)=>a2(t,f)).map(([s,f])=>s+6*f),l=n.concat(n.map(s=>(s+6)%12)),o=Array(12).fill().map((s,f)=>xa(t,f)),i=Array(12).fill().map((s,f)=>Sn.indexOf(e[Sn[f]])),a=Array(12).fill().map((s,f)=>kl.indexOf(e[kl[f]]));return{cp:l,ep:o,ap:i,bp:a}}function sh(e){let t=Array(72),r=jc(5,e);r.push(5);let n=Array(4).fill().map(a=>e(2));n.push(n.reduce((a,s)=>a^s)),n.push(0);for(let a=0;a<6;a++)oh(t,a,r[a],n[a]);let l=jc(12,e);for(let a=0;a<12;a++)ih(t,a,l[a]);let o=t2(12,e).map(a=>a/3|0),i=t2(12,e).map(a=>4+(a/3|0));for(let a=0;a<12;a++)t[Sn[a]]=o[a],t[kl[a]]=i[a];return t}function np(e,t=!1){if(t){e=e.map(m=>m.slice());let p=[0,1,2,3,4,5,6,7],L=[[0,3,5,6,4,7,1,2],[7,1,0,6,3,5,4,2],[7,4,2,1,3,0,6,5],[2,4,5,3,6,0,1,7]];L=L.concat(L.map(m=>i2(m)));for(let m=0;m<e.length;m++)if(e[m][0]<4)e[m][0]=p[e[m][0]];else{let d=p[e[m][0]],F=e[m][1];e[m][0]=d,p=tt(F===1?L[d^4]:L[d],p)}}let r=t?"U L F R D BR B BL".split(" "):ah,n=["0","","'"];return e.map(([o,i])=>r[o]+n[i]).join(" ")}function Kr(e,t){for(let[r,n]of t)for(let l=0;l<n;l++)e=tt(e,rp[r]);return e}function lp(e){return e.map(([t,r])=>[t,(3-r)%3]).reverse()}function ya(e,t=!1){if(e.length===0)return[];let r=[],n;for(let[l,o]of e)n&&n[0]===l?(n[1]+=o,n[1]%=3,n[1]===0&&(r.pop(),n=r.length===0?void 0:r[r.length-1])):r.length>=2&&(n[0]^l)===4&&r[r.length-2][0]===l?(r[r.length-2][1]+=o,r[r.length-2][1]%=3,r[r.length-2][1]===0&&r.splice(r.length-2,1)):(n=[l,o],r.push(n));return t&&\`\${e}\`!=\`\${r}\`&&console.log(\`simplified \${e} to \${r}\`),r}function fh(e){return np(lp(ch(sh(e),!0)),!0)}function _l(e,t,r,n,l,o){let i=Yc(e,t,r,n,l),a=o.length,[s,f]=Cl(e,t,r,n,l),u=Array(a).fill().map(()=>new Uint32Array(i));for(let g=0;g<i;g++){let c=s[g],p=Array(e);for(let L=0;L<e;L++)p[L]=c>>2*L&3;for(let L=0;L<a;L++){let d=tt(p,o[L]).reduce((F,A,S)=>F|A<<2*S,0);u[L][g]=f[d]}}return u}function op(e){let t=e[0].length,r=e.length,n=Array(r).fill().map(()=>new Uint32Array(t));for(let l=0;l<t;l++)for(let o=0;o<r;o++)n[o][e[o][l]]=l;return n}function xn(e,t){let r=e[0].length,n=t[0].length,l=e.length,o=Array(l).fill().map(()=>new Uint32Array(r*n));for(let i=0;i<n;i++)for(let a=0;a<r;a++){let s=a+r*i;for(let f=0;f<l;f++)o[f][s]=e[f][a]+r*t[f][i]}return o}function uh(e,t){let r=e.length,n=e[0].length,l=new Uint8Array(n);l[t]=1;let o=!1;for(;!o;){o=!0;for(let a=0;a<n;a++)if(!!l[a])for(let s=0;s<r;s++)l[e[s][a]]||(l[e[s][a]]=1,o=!1)}let i=new Int32Array(n).fill(-1);for(let a=0,s=0;a<n;a++)!l[a]||(i[a]=s,s++);return[e.map(a=>yn(a,l)),i]}function gh(e,t){let r=e.length,n=e[0].length,l=new Int32Array(n).fill(-1);t.forEach(s=>{l[s]=0});let o=[t];for(let s=0;s<o.length;s++){let f=o[s];for(let u=0;u<r;u++){let g=e[u][f[0]];if(l[g]!==-1)continue;let c=f.map(L=>e[u][L]),p=o.length;o.push(c);for(let L of c){if(l[L]!==-1)throw new Error("quotienting failed");l[L]=p}}}let i=o.length,a=Array(r).fill().map(()=>new Int32Array(i));for(let s=0;s<r;s++)for(let f=0;f<i;f++)a[s][f]=l[e[s][o[f][0]]];return[a,l]}function ip(e,t,r){let n=e[0].length,l=e.length,o=new Int32Array(n).fill(-1);o[t]=r,o[r]=t;let i=!1;for(;!i;){i=!0;for(let a=0;a<n;a++){if(o[a]===-1)continue;let s=o[a];for(let f=0;f<l;f++){let u=f^1,g=e[f][a],c=e[u][e[u][s]];if(o[g]===-1)i=!1,o[g]=c,o[c]=g;else if(o[g]!==c)throw new Error("mirroring failed - is the initial map correct?")}}}return o}function ap(e,t){let r=e[0].length,n=e.length,l=new Int8Array(r).fill(-1);for(let a of t)l[a]=0;let o=0,i=!1;for(;!i;){i=!0;for(let a=0;a<r;a++)if(l[a]===o)for(let s=0;s<n;s++){let f=e[s][a];for(;f!==a;)l[f]===-1&&(i=!1,l[f]=o+1),f=e[s][f]}o++}return l}function ch(e,t=!1){let r=dh(e).next().value,n=Kr(e,r),l=(t?zh:_h)(n),o=ya(r.concat(l),!1);return Kr(e,o).join("")!==Io.join("")&&(console.log("solving failed!"),console.log(e),console.log(r),console.log(n),console.log(l),console.log(Kr(e,o))),o}function mh(e){let[t,r]=Cl(12,6,0,3,3),n=Array(12).fill().map((a,s)=>xa(e,s)),l=n.indexOf(8)+12*n.indexOf(9)+12**2*n.indexOf(10)+12**3*n.indexOf(11),[o,i]=[Sn,kl].map(a=>{let s=a.map(f=>ph[e[f]]);return r[s.reduce((f,u,g)=>f|u<<2*g,0)]});return[l,o,i]}function sp(){if(K.phase1_edge)return K.phase1_edge;let e=op(vn.map(n=>n.ep)),t=xn(e,e),r=xn(t,t);return K.phase1_edge=r}function Lh(){return Lr.phase1_edge?Lr.phase1_edge:Lr.phase1_edge=ap(sp(),[8+12*9+12**2*10+12**3*11])}function Bh(){return K.phase1_centreA?K.phase1_centreA:K.phase1_centreA=_l(12,6,0,3,3,vn.map(e=>e.ap))}function fp(){return K.phase1_centreB?K.phase1_centreB:K.phase1_centreB=_l(12,6,0,3,3,vn.map(e=>e.bp))}function Hc(){if(Lr.phase1_centre)return Lr.phase1_centre;let[e,t]=Cl(12,6,0,3,3),r=e.filter(n=>{let l=n>>12&3,o=n>>18&3;return l===2&&o===3}).map(n=>t[n]);return Lr.phase1_centre=ap(fp(),r)}function*dh(e){let t=[sp(),Bh(),fp()],r=[Lh(),Hc(),Hc()];yield*Rh(mh(e),t,r,15)}function*Rh(e,t,r,n){let l=e.length,o=0;for(let i=0;i<l;i++)o=Math.max(o,r[i][e[i]]);for(;o<=n;)yield*up(e,t,r,o,-1),o++}function*up(e,t,r,n,l){let o=3,i=8,a=Math.max(r[0][e[0]],r[1][e[1]],r[2][e[2]]);if(!(a>n)){if(n===0){yield[];return}if(!(a===0&&n===1))for(let s=0;s<i;s++){if(s===l||s===l-4)continue;let f=[];f[0]=t[0][s][e[0]],f[1]=t[1][s][e[1]],f[2]=t[2][s][e[2]];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=up(f,t,r,n-1,s);for(;;){let{value:c,done:p}=g.next();if(p)break;yield[[s,u]].concat(c)}f[0]=t[0][s][f[0]],f[1]=t[1][s][f[1]],f[2]=t[2][s][f[2]],u++}}}}function s2(e){let[t,r]=Cl(10,5,3,2,0),n=Array(8).fill().map((c,p)=>xa(e,p)),l=n.indexOf(5)+8*n.indexOf(6)+8**2*n.indexOf(7),o=Array(5).fill().map((c,p)=>a2(e,p)),i=i2(o.map(([c,p])=>c+5*p).concat(o.map(([c,p])=>c+5*(p^1)))),a=i.slice(0,5).map(c=>c%5),s=i.slice(0,5).map(c=>c/5|0),f=An(a)*8+(s[0]^s[2])+2*(s[0]^s[3])+4*s[4],[u,g]=[Sn,kl].map(c=>{let p=tt(c,Fh).map(L=>hh[e[L]]);return r[p.reduce((L,m,d)=>L|m<<2*d,0)]});return pp(),Bp(),[u,g,Lp[f]+40*cp[l]]}function*Sa(e){yield*vh(s2(e),30)}function gp(){if(K.phase2_centre)return K.phase2_centre;let e=_l(10,5,3,2,0,vn.slice(0,4).map(r=>yn(r.ap,Xc))),t=_l(10,5,3,2,0,vn.slice(0,4).map(r=>yn(r.bp,Xc)));return K.phase2_centre=[e,t]}function pp(){if(K.phase2_edge)return K.phase2_edge;let e=op(vn.slice(0,4).map(n=>n.ep.slice(0,8))),t=xn(e,xn(e,e)),r;return[r,cp]=uh(t,501),K.phase2_edge=r}function mp(){if(K.phase2_corner)return K.phase2_corner;let t=Mo(5)/2*8,r=[!0,!0,!0,!0,!0,!1,!0,!0,!0,!0,!0,!1],n=Array(4).fill().map(()=>new Uint32Array(t)),l=vn.slice(0,4).map(o=>i2(yn(o.cp,r)));for(let o=0;o<t;o++){let i=l2(o>>3,5),a=[0,0,o&1,o>>1&1,o>>2&1];a[1]=a[2]^a[3]^a[4];let s=Array(10);for(let f=0;f<5;f++)s[f]=i[f]+5*a[f],s[f+5]=i[f]+5*(a[f]^1);for(let f=0;f<4;f++){let u=tt(l[f],s),g=u.slice(0,5).map(L=>L%5),c=u.slice(0,5).map(L=>L/5|0),p=(c[0]^c[2])+2*(c[0]^c[3])+4*c[4];n[f][o]=An(g)*8+p}}return K.phase2_corner=n}function Bp(){return K.phase2_corner_compact||([K.phase2_corner_compact,Lp]=gh(mp(),yh())),K.phase2_corner_compact}function f2(){if(K.phase2_ce)return K.phase2_ce;let e=Bp(),t=pp();return K.phase2_ce=xn(e,t)}function Dh(){if(Y0)return Y0;let e=s2(Io)[2];return Y0=ip(f2(),e,e)}function Ah(){let[e,t]=Cl(10,5,3,2,0);return e.filter(r=>(r>>10&63)===41).map(r=>t[r])}function yh(){let e=mp(),t=e[0].length,r=Array(t).fill(!1);r[0]=!0;let n=!1;for(;!n;){n=!0;for(let l=0;l<t;l++)r[l]&&(r[e[0][l]]||(n=!1,r[e[0][l]]=!0),r[e[1][l]]||(n=!1,r[e[1][l]]=!0))}return r.map((l,o)=>o).filter(l=>r[l])}function Sh(){if(Lr.phase2_ace)return Lr.phase2_ace;let[e,t]=gp(),r=f2(),n=2520,l=40*336,o=n*l,i=s2(Io)[2],a=9,s=new Int8Array(o).fill(a);for(let f of Ah())s[f+n*i]=0;for(let f=0;f<a-1;f++)for(let u=s.indexOf(f);u!==-1;u=s.indexOf(f,u+1)){let g=u%n,c=u/n|0;for(let p=0;p<4;p++){let L=e[p][g],m=r[p][c],d=L+n*m;s[d]===a&&(s[d]=f+1),L=e[p][L],m=r[p][m],d=L+n*m,s[d]===a&&(s[d]=f+1)}}return Lr.phase2_ace=s}function*vh(e,t){let[r,n]=gp(),l=f2(),o=Sh(),i=Dh(),[a,s,f]=e,u=i[f],g=Math.max(o[a+2520*f],o[s+2520*u]);for(;g<=t;)yield*dp(a,s,f,r,n,l,o,i,g,-1),g++}function*dp(e,t,r,n,l,o,i,a,s,f){let u=Math.max(i[e+2520*r],i[t+2520*a[r]]);if(!(u>s)){if(s===0){yield[];return}else if(u===0)return;for(let g=0;g<4;g++){if(g===f)continue;let c=e,p=t,L=r;for(let m=1;m<=2;m++){c=n[g][c],p=l[g][p],L=o[g][L];let d=dp(c,p,L,n,l,o,i,a,s-1,g);for(;;){let{value:F,done:A}=d.next();if(A)break;yield[[g,m]].concat(F)}}}}}function Ua(e){let[t,r]=Cl(7,3,2,0,2),n=Array(5).fill().map((f,u)=>xa(e,u)),l=An(n),o=Array(4).fill().map((f,u)=>a2(e,u)),i=An(o.map(f=>f[0]))*2+o.find(f=>f[0]===0)[1],[a,s]=[Sn,kl].map(f=>{let u=tt(f,xh).map(g=>e[g]%4);return r[u.reduce((g,c,p)=>g|c<<2*p,0)]});return[a+210*s,i+24*l]}function bh(){if(K.phase3_2gen_edge)return K.phase3_2gen_edge;let e=Mo(5)/2,t=Array(zl).fill().map(()=>new Uint32Array(e)),r=va.map(n=>n.ep.slice(0,5));for(let n=0;n<e;n++){let l=l2(n,5);for(let o=0;o<zl;o++)t[o][n]=An(tt(l,r[o]))}return K.phase3_2gen_edge=t}function wh(){if(K.phase3_2gen_corner)return K.phase3_2gen_corner;let t=Mo(4)/2*2,r=[!0,!0,!0,!0,!1,!1,!0,!0,!0,!0,!1,!1],n=Array(zl).fill().map(()=>new Uint32Array(t)),l=va.map(o=>yn(o.cp,r).slice(0,4));for(let o=0;o<t;o+=2){let i=l2(o>>1,4),a=i.concat(i.map(s=>s+4));for(let s=0;s<zl;s++){let f=tt(a,l[s]),u=f.map(c=>c%4),g=f.find(c=>c%4===0)>>2;n[s][o]=An(u)*2+g,n[s][o+1]=An(u)*2+(g^1)}}return K.phase3_2gen_corner=n}function ba(){return K.phase3_2gen_corneredge?K.phase3_2gen_corneredge:K.phase3_2gen_corneredge=xn(wh(),bh())}function u2(){if(K.phase3_2gen_centre)return K.phase3_2gen_centre;let e=_l(7,3,2,0,2,va.map(r=>yn(r.ap,Zc))),t=_l(7,3,2,0,2,va.map(r=>yn(r.bp,Zc)));return K.phase3_2gen_centreA=e,K.phase3_2gen_centreB=t,K.phase3_2gen_centre=xn(e,t)}function hp(){if($0)return $0;let e=u2(),t=K.phase3_2gen_centreA,r=ba(),n=t[0].length,l=r[0].length,o=n*l,i=25,a=Br.map(c=>c.length),s=new Int8Array(o).fill(i),f=Ua(Io);s[f[0]%n+n*f[1]]=0;let u=0,g=!1;for(;!g&&u<i-1;){g=!0;let c=Array(zl).fill().map((F,A)=>A).filter(F=>a[F]+u<i);c.sort((F,A)=>a[F]-a[A]);let p=tt(a,c),L=tt(t,c),m=tt(r,c),d=c.length;for(let F=s.indexOf(u);F!==-1;F=s.indexOf(u,F+1)){let A=F%n,S=F/n|0;for(let x=0;x<d;x++){let U=p[x],P=L[x][A],Z=m[x][S],C=P+n*Z;s[C]>u+U&&(g=!1,s[C]=u+U)}}u++}return $0=s}function Fp(){if(e2)return e2;let e=ba().slice(0,2),t=Ua(Io);return e2=ip(e,t[1],t[1])}function r2(e,t=Ua(e)){let[r,n]=t,l=r%210,o=Math.floor(r/210),i=u2(),a=K.phase3_2gen_centreA,s=K.phase3_2gen_centreB,f=ba(),u=hp(),g=Fp(),c=0;for(;;){let p=g2(l,o,n,a,s,f,u,g,c);for(let L of p)return L.map(m=>Br[m]).flat();c++}}function Jc(e,t=Ua(e)){let[r,n]=t,l=r%210,o=Math.floor(r/210),i=u2(),a=K.phase3_2gen_centreA,s=K.phase3_2gen_centreB,f=ba(),u=hp(),g=Fp(),c=r2(e).length,p=1/0,L;for(let m=c;m<=c+0;m++){let d=g2(l,o,n,a,s,f,u,g,m);for(let F of d){let A=F.map(U=>Br[U]).flat(),S=ya(A),x=n2(S);x<p&&(p=x,L=S)}}return L}function Eh(e){return(e-1)*(e-2)/2}function n2(e){let t=np(e,!0).replace(/'/g,"").split(" ");return e.length+kh(t).map(Eh).reduce((r,n)=>r+n,0)}function kh(e){if(e.length<3)return[];let t=e.length,r=[];for(let o=0;o<t-2;o++)r[o]=e[o]===e[o+2];r.push(!1);let n=-1,l=[];for(;n<t-2&&(n=r.indexOf(!0,n+1),n!==-1);){let o=r.indexOf(!1,n+1);l.push(o-n),n=o}return l}function*g2(e,t,r,n,l,o,i,a,s,f=-1){let u=i[e+210*r],g=i[t+210*a[r]],c=Math.max(u,g);if(!(c>s)){if(s===0){yield[];return}if(c!==0)for(let p=0;p<zl;p++){if(p===f&&Uh[p]<=3)continue;let L=n[p][e],m=l[p][t],d=o[p][r],F=s-Br[p].length;if(F<0)continue;let A=g2(L,m,d,n,l,o,i,a,F,p);for(;;){let{value:S,done:x}=A.next();if(x)break;yield[p].concat(S)}}}}function _h(e,t=200,r=24){let n=[],l=Sa(e),o=tt(e,Xt).map(s=>s^1),i=Sa(o),a=Array(1e3);for(let s=0;s<t;s++){{let{value:f,done:u}=l.next();if(!u){let g=Kr(e,f),c=f.concat(r2(g));if(c.length<=r)return c;c.length<a.length&&(a=c)}}{let{value:f,done:u}=i.next();if(!u){let g=Kr(o,f),c=f.concat(r2(g)).map(([p,L])=>[p^2,L]);if(c.length<=r)return c;c.length<a.length&&(a=c)}}}return a}function zh(e,t=20,r=30){let n=[],l=Sa(e),o=tt(e,Xt).map(f=>f^1),i=Sa(o),a,s=1/0;for(let f=0;f<t;f++){{let{value:u,done:g}=l.next();if(!g){let c=Kr(e,u),p=ya(u.concat(Jc(c))),L=n2(p);if(L<=r)return p;L<s&&(a=p,s=L)}}{let{value:u,done:g}=i.next();if(!g){let c=Kr(o,u),p=ya(u.concat(Jc(c)));p=p.map(([m,d])=>[m^2,d]);let L=n2(p);if(L<=r)return p;L<s&&(a=p,s=L)}}}return a}async function Nh(){return fh(await Ch)}var VS,HS,Z0,J0,Io,Po,ZR,Xt,XS,Da,$c,JR,YR,$R,Aa,eh,ep,th,rh,Ot,Gr,Wr,Sn,kl,rp,ah,vn,K,Lr,ph,hh,Fh,Xc,cp,Lp,Y0,xh,Zc,Br,zl,Rp,va,Uh,$0,e2,Ch,Dp=y(()=>{"use strict";yt();[VS,HS]=(()=>{let e=new Int8Array(2048),t=new Int8Array(256*8);for(let l=0;l<256;l++)for(let o=0,i=0;o<8;o++)(l>>>o&1)!==0&&(e[o<<8|l]=i,t[i<<8|l]=o,i++);function r(l){let o=255,i=2520,a=0;for(let s=0;s<6;s++){let f=l[s];a+=e[o|f<<8]*i,o&=~(1<<f),i/=7-s}return a}function n(l,o){let i=255,a=2520,s=0;for(let f=0;f<6;f++){let u=l/a|0;l-=u*a,s^=u&1;let g=t[i|u<<8];o[f]=g,i&=~(1<<g),a/=7-f}return o[6]=t[i|s<<8],o[7]=t[i|(s^1)<<8],o}return[r,n]})();Z0={};J0={};Io=Array(72).fill().map((e,t)=>t/9|0),Po=o2([[0,4,8],[1,6,3],[2,5,7],[9,22,35],[45,67,44],[47,68,43],[46,69,39],[50,70,38],[49,71,36]],72),ZR=tt(Po,Po),Xt=Array(72).fill().map((e,t)=>(t/18|0)*18+(t+9)%18),XS=Array(72).fill().map((e,t)=>(t/36|0)*36+(t+18)%36),Da=Array(72).fill().map((e,t)=>(t+36)%72),$c=Nl(Da,ZR,Da),JR=Nl(Xt,Po,Xt),YR=Nl(Xt,$c,Xt),$R=o2([[10,24,30],[11,23,34],[12,19,33],[42,48,64],[41,52,65],[37,51,66]],72),Aa=tt(Po,$R),eh=tt(Aa,Aa),ep=Nl(Da,eh,Da),th=Nl(Xt,Aa,Xt),rh=Nl(Xt,ep,Xt),Ot=Array(72).fill().map((e,t)=>t/9|0),Gr=[[0,45,9,36],[4,67,22,49],[8,44,35,71],[13,58,31,40],[17,53,26,62],[18,63,27,54]],Wr=[[1,46],[3,39],[6,69],[10,37],[33,42],[12,48],[15,60],[24,51],[19,64],[28,55],[30,66],[21,57]],Sn=Array(12).fill().map((e,t)=>(t/3|0)*9+[2,5,7][t%3]),kl=Sn.map(e=>e+36);rp=[Po,$c,JR,YR,Aa,ep,th,rh],ah=["U","L","F","R","u","l","f","r"],vn=rp.map(tp);K={},Lr={},ph=[0,0,2,3,0,0,2,3];hh=[0,1,2,0,0,1,2,0],Fh=[0,1,2,3,4,5,7,8,10,11],Xc=[!0,!0,!0,!0,!0,!0,!1,!0,!0,!1,!0,!0];xh=[0,1,2,3,4,10,11],Zc=[!0,!0,!0,!0,!0,!1,!1,!1,!1,!1,!0,!0],Br=[[[0,1]],[[1,1]],[[2,1],[0,1],[3,1],[0,2],[3,2],[2,2]],[[3,2],[1,2],[2,2],[1,1],[2,1],[3,1]],[[6,1],[0,1],[3,1],[0,2],[3,2],[6,2]],[[7,2],[1,2],[2,2],[1,1],[2,1],[7,1]],[[2,1],[0,1],[2,2],[0,1],[2,1],[0,1],[2,2]],[[3,2],[1,1],[3,1],[1,1],[3,2],[1,1],[3,1]],[[2,1],[3,1],[2,2],[1,2],[0,2],[2,1],[3,1],[2,2]],[[3,2],[2,2],[3,1],[0,1],[1,1],[3,2],[2,2],[3,1]],[[6,1],[0,1],[6,2],[0,2],[1,2],[6,1],[0,1],[6,2]],[[7,2],[1,2],[7,1],[1,1],[0,1],[7,2],[1,2],[7,1]],[[2,1],[3,2],[2,2],[3,1],[0,1],[2,2],[1,1],[2,1]],[[3,2],[2,1],[3,1],[2,2],[1,2],[3,1],[0,2],[3,2]],[[6,1],[0,2],[6,2],[7,1],[6,1],[1,2],[7,1],[6,1]],[[7,2],[1,1],[7,1],[6,2],[7,2],[0,1],[6,2],[7,2]],[[2,2],[1,2],[2,2],[3,2],[2,2],[3,2],[0,2],[3,2]],[[6,2],[7,2],[1,2],[0,2],[1,2],[0,2],[6,2],[7,2]]];Br=Br.concat(Br.map(e=>lp(e)));zl=Br.length,Rp=Br.map(e=>Kr(o2([],72),e)),va=Rp.map(tp),Uh=Rp.map(XR);Ch=we()});var Ap={};mt(Ap,{randomFTOScrambleString:()=>Nh});var yp=y(()=>{"use strict";Dp()});async function vp(){return Ph??(Ph=Mh())}async function Mh(){return Vt(await Me.fto.kpuzzle(),\`SubgroupSizes 24 12 11 12 12 11 10 9 11 8 10 9 7 8 10 10 6 9 8 5 7 6 5 4 4 8 7 3 6 6 360
|
|
3260
|
+
Alg R' U' R U B' U' B L\`)}var cB,pB,Su=y(()=>{"use strict";He();ll();cB=null;pB=null});var vu={};mt(vu,{cachedData222:()=>du,cachedMegaminxKPuzzleWithoutMO:()=>qs,cachedSGSDataMegaminx:()=>hu,sgsDataPyraminx:()=>Vs,sgsDataPyraminxFixedOrientation:()=>Du,sgsDataSkewb:()=>Xs,sgsDataSkewbFixedCorner:()=>yu,skewbKPuzzleWithoutMOCached:()=>Hs});var xu=y(()=>{"use strict";Ru();Fu();Au();Su()});async function ol(e,t){let r=new Lt;r.experimentalPushAlg(e);for(let n of t){let l=(await sr())(n);l!==null&&r.push(B.fromString(l))}return r.toAlg()}var wi=y(()=>{"use strict";fe();yt()});function Tu(){}function hB(e){function t(){}return t.prototype=e||{},new t}function FB(e){return e instanceof Array?e[0]:null}function So(e,t,r){var n=Qi,l=DB,o=FB,i=n[e],a=o(i);i&&!a?H=i:(H=n[e]=t?l(t):{},H.castableTypeMap$=r,H.constructor=H,!t&&(H.typeMarker$=Tu));for(var s=3;s<arguments.length;++s)arguments[s].prototype=H;a&&(H.___clazz$=a)}function DB(e){var t=Qi;return hB(t[e])}function AB(){}function Ci(e){return e<<24>>24}function f0(){this.typeName=null,this.simpleName=null,this.packageName=null,this.compoundName=null,this.canonicalName=null,this.typeId=null,this.arrayLiterals=null}function u0(e,t){var r;return r=new f0,r.packageName=e,r.compoundName=t,r}function Pr(e,t,r){var n;return n=u0(e,t),vB(r,n),n}function yB(e,t){var r;return r=u0(e,t),r.modifiers=2,r}function ji(e,t){var r;return r=u0("",e),r.typeId=t,r.modifiers=1,r}function Gu(e,t){var r=e.arrayLiterals=e.arrayLiterals||[];return r[t]||(r[t]=e.createClassLiteralForArray(t))}function SB(e){if(e.isPrimitive())return null;var t=e.typeId,r=Qi[t];return r}function vB(e,t){if(!!e){t.typeId=e;var r=SB(t);if(!r){Qi[e]=[t];return}r.___clazz$=t}}function te(e,t){return Gu(e,t)}function Y(e,t,r,n,l,o){var i;return i=Ku(l,n),re(te(e,o),t,r,l,i),i}function rt(e,t,r,n,l,o){return Wu(e,t,r,n,l,0,o)}function Wu(e,t,r,n,l,o,i){var a,s,f,u,g;if(u=l[o],f=o===i-1,a=f?n:0,g=Ku(a,u),re(te(e,i-o),t[o],r[o],a,g),!f)for(++o,s=0;s<u;++s)g[s]=Wu(e,t,r,n,l,o,i);return g}function re(e,t,r,n,l){return l.___clazz$=e,l.castableTypeMap$=t,l.typeMarker$=Tu,l.__elementTypeId$=r,l.__elementTypeCategory$=n,l}function Ku(e,t){var r=new Array(t),n;switch(e){case 6:{n={l:0,m:0,h:0};break}case 7:{n=0;break}case 8:{n=!1;break}default:return r}for(var l=0;l<t;++l)r[l]=n;return r}function ku(e){var t,r,n;return t=e&nt,r=e>>22&nt,n=e<0?kr:0,xB(t,r,n)}function xB(e,t,r){return{l:e,m:t,h:r}}function UB(e,t){var r,n,l;return r=e.l+t.l,n=e.m+t.m+(r>>22),l=e.h+t.h+(n>>22),{l:r&nt,m:n&nt,h:l&kr}}function Xt(e,t){return{l:e.l&t.l,m:e.m&t.m,h:e.h&t.h}}function g0(e){var t,r;return e>-129&&e<128?(t=e+128,Ei==null&&(Ei=Y(od,ue,293,256,0,1)),r=Ei[t],!r&&(r=Ei[t]=ku(e)),r):ku(e)}function Qu(e,t){var r,n;return r=e.h>>19,n=t.h>>19,r===0?n!==0||e.h>t.h||e.h===t.h&&e.m>t.m||e.h===t.h&&e.m===t.m&&e.l>=t.l:!(n===0||e.h<t.h||e.h===t.h&&e.m<t.m||e.h===t.h&&e.m===t.m&&e.l<t.l)}function Js(e,t){return e.l!==t.l||e.m!==t.m||e.h!==t.h}function e0(e,t){return{l:e.l|t.l,m:e.m|t.m,h:e.h|t.h}}function Ni(e,t){var r,n,l;return t&=63,t<22?(r=e.l<<t,n=e.m<<t|e.l>>22-t,l=e.h<<t|e.m>>22-t):t<44?(r=0,n=e.l<<t-22,l=e.m<<t-22|e.l>>44-t):(r=0,n=0,l=e.l<<t-44),{l:r&nt,m:n&nt,h:l&kr}}function mn(e,t){var r,n,l,o,i;return t&=63,r=e.h,n=(r&RB)!==0,n&&(r|=-1048576),t<22?(i=r>>t,o=e.m>>t|r<<22-t,l=e.l>>t|e.m<<22-t):t<44?(i=n?kr:0,o=r>>t-22,l=e.m>>t-22|r<<44-t):(i=n?kr:0,o=n?nt:0,l=r>>t-44),{l:l&nt,m:o&nt,h:i&kr}}function ju(e,t){var r,n,l;return r=e.l-t.l,n=e.m-t.m+(r>>22),l=e.h-t.h+(n>>22),{l:r&nt,m:n&nt,h:l&kr}}function Ln(e){return e.l|e.m<<22}function bB(e){this.string=e}function _r(e,t){return e>t?e:t}function c0(e,t){return e<t?e:t}function wB(e,t){return e.indexOf(t)}function EB(e){return kB(e,0,e.length)}function kB(e,t,r){for(var n="",l=t;l<r;){var o=Math.min(l+1e4,r);n+=String.fromCharCode.apply(null,e.slice(l,o)),l=o}return n}function _B(e){return String.fromCharCode(e&Ze)}function _u(e){return e.string+=" ",e}function zu(e,t){return e.string+=t,e}function CB(){bB.call(this,"")}function Pi(e,t){var r;if(e===t)return!0;if(e.length!==t.length)return!1;for(r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}function Bn(){Cu||(Cu=!0,wr=rt(Se,[ue,ye],[11,0],7,[495,18],2),cl=rt(Se,[ue,ye],[11,0],7,[324,18],2),Bl=rt(Se,[ue,ye],[11,0],7,[336,18],2),zr=rt(Se,[ue,ye],[11,0],7,[495,8],2),Hi=Y(Qe,Ke,0,20048,7,1),Vi=Y(Qe,Ke,0,20791,7,1),gl=Y(Qe,Ke,0,82945,7,1),al=rt(Se,[ue,ye],[11,0],7,[2768,10],2),fl=rt(Se,[ue,ye],[11,0],7,[2768,10],2),ul=rt(Se,[ue,ye],[11,0],7,[24,10],2),vo=rt(Se,[ue,ye],[11,0],7,[24,16],2),dn=rt(Se,[ue,ye],[11,0],7,[140,16],2),qi=Y(Qe,Ke,0,8305,7,1),sl=Y(Qe,Ke,0,48441,7,1))}function NB(e,t,r){return e.slice_0=wr[t.slice_0][r],e.flip=Bl[t.flip][($(),hn)[r<<3|t.fsym]],e.fsym=e.flip&7^t.fsym,e.flip>>=3,e.twist=cl[t.twist][hn[r<<3|t.tsym]],e.tsym=e.twist&7^t.tsym,e.twist>>=3,e.prun=_r(_r(ut(Hi,e.twist*495+zr[e.slice_0][e.tsym]),ut(Vi,e.flip*495+zr[e.slice_0][e.fsym])),ut(gl,e.twist<<11|Nr[e.flip<<3|e.fsym^e.tsym])),e.prun}function PB(e,t,r){return r=($(),Do)[3][r],e.flipc=Bl[t.flipc>>3][hn[r<<3|t.flipc&7]]^t.flipc&7,e.twistc=cl[t.twistc>>3][hn[r<<3|t.twistc&7]]^t.twistc&7,ut(gl,e.twistc>>3<<11|Nr[e.flipc^e.twistc&7])}function qu(e,t,r){var n;return e.twist=($(),yo)[Ii(t)],e.flip=Rn[Mi(t)],e.tsym=e.twist&7,e.twist=e.twist>>3,e.prun=ut(gl,e.twist<<11|Nr[e.flip^e.tsym]),e.prun>r||(e.fsym=e.flip&7,e.flip=e.flip>>3,e.slice_0=494-ml(t.ea,8,!0),e.prun=_r(e.prun,_r(ut(Hi,e.twist*495+zr[e.slice_0][e.tsym]),ut(Vi,e.flip*495+zr[e.slice_0][e.fsym]))),e.prun>r)?!1:(n=new me,xo(t,1,n),Uo(t,1,n),e.twistc=yo[Ii(n)],e.flipc=Rn[Mi(n)],e.prun=_r(e.prun,ut(gl,e.twistc>>3<<11|Nr[e.flipc^e.twistc&7])),e.prun<=r)}function ho(){Bn()}function ut(e,t){return Bn(),e[t>>3]>>(t<<2)&15}function Vu(e){Bn(),!(ki===2||ki===1&&!e)&&(ki===0&&(XB(),MB(),OB(),GB(),IB(),$(),r0(2048,d0,Rn,Pu=Y(Se,ye,0,336,7,1),0),r0(2187,h0,yo,Ys=Y(Se,ye,0,324,7,1),1),TB(),WB(),KB()),Ro(qi,ul,vo,al,($(),n0),584244,e),Ro(sl,t0,dn,fl,n0,514084,e),Ro(Hi,wr,zr,cl,Ys,431619,e),Ro(Vi,wr,zr,Bl,Pu,431619,e),Ro(gl,null,null,cl,Ys,103939,e),ki=e?2:1)}function MB(){var e,t,r,n;for(e=new me,t=new me,r=0;r<2768;r++)for(qB(e,($(),il)[r]),n=0;n<10;n++)Cr(e,pe[(et(),Nt)[n]],t),al[r][n]=Ti(pr[ct(t.ca,8,!1)])&Ze}function IB(){var e,t,r,n,l;for(e=new me,t=new me,t0=rt(Se,[ue,ye],[11,0],7,[140,10],2),r=0;r<140;r++){for(ig(e.ca,r%70,0,!1),l=0;l<10;l++)Cr(e,($(),pe)[(et(),Nt)[l]],t),t0[r][l]=ml(t.ca,0,!1)+70*(165>>l&1^~~(r/70))&Ze;for(n=0;n<16;n++)xo(e,($(),gt)[0][n],t),dn[r][n]=ml(t.ca,0,!1)+70*~~(r/70)&Ze}}function OB(){var e,t,r,n;for(e=new me,t=new me,r=0;r<2768;r++)for(Zu(e,($(),il)[r]),n=0;n<10;n++)St(e,pe[(et(),Nt)[n]],t),fl[r][n]=pr[ct(t.ea,8,!0)]}function TB(){var e,t,r,n;for(e=new me,t=new me,r=0;r<336;r++)for(L0(e,($(),d0)[r]),n=0;n<18;n++)St(e,pe[n],t),Bl[r][n]=Rn[Mi(t)]}function GB(){var e,t,r,n,l;for(e=new me,t=new me,r=0;r<24;r++){for(Fn(e.ea,r,12,!0),l=0;l<10;l++)St(e,($(),pe)[(et(),Nt)[l]],t),ul[r][l]=ct(t.ea,12,!0)%24&Ze;for(n=0;n<16;n++)Uo(e,($(),gt)[0][n],t),vo[r][n]=ct(t.ea,12,!0)%24&Ze}}function Ro(e,t,r,n,l,o,i){var a,s,f,u,g,c,p,L,m,d,F,D,S,x,U,P,Z,C,Q,v,z,N,b,E,M,j,q,ie,he,xe,Je,Ut,Be,ht,ot,pt;if(S=o&15,F=(o>>4&1)===1?s0:0,f=(o>>5&1)===1,a=o>>8&15,u=o>>12&15,g=o>>16&15,d=i?u:g,D=(1<<S)-1,s=t===null,L=s?2048:t.length,m=L*n.length,p=f?10:18,c=p===10?66:599186,U=(e[m>>3]>>(m<<2)&15)-1,U===-1){for(C=0;C<~~(m/8)+1;C++)e[C]=Bo;e[0]^=1,U=0}for(;U<d;){for(M=(U+1)*Bo^-1,Q=0;Q<e.length;Q++)ot=e[Q]^M,ot&=ot>>1,e[Q]+=ot&ot>>2&Bo;for(N=U>a,xe=N?U+2:U,he=xe*Bo,x=N?U:U+2,++U,pt=U^U+1,ht=0,C=0;C<m;++C,ht>>=4){if((C&7)===0&&(ht=e[C>>3],((ht^he)-Bo&~(ht^he)&-2004318072)===0)){C+=7;continue}if((ht&15)===xe)for(q=C%L,Je=~~(C/L),P=0,Z=0,s&&(P=($(),Rn)[q],Z=P&7,P>>=3),E=0;E<p;E++){if(Be=n[Je][E],s?ie=($(),Nr)[Bl[P][hn[E<<3|Z]]^Z^Be&D]:ie=r[t[q][E]][Be&D],Be>>=S,v=Be*L+ie,j=e[v>>3]>>(v<<2)&15,j!==x){j<U-1&&(E+=c>>E&3);continue}if(N){e[C>>3]^=pt<<(C<<2);break}for(e[v>>3]^=pt<<(v<<2),b=1,Ut=l[Be];(Ut>>=1)!==0;b++)(Ut&1)===1&&(z=Be*L,s?z+=($(),Nr)[Rn[ie]^b]:z+=r[ie][b^F>>(b<<1)&3],(e[z>>3]>>(z<<2)&15)===x&&(e[z>>3]^=pt<<(z<<2)))}}}}function WB(){var e,t,r,n;for(e=new me,t=new me,r=0;r<324;r++)for(B0(e,($(),h0)[r]),n=0;n<18;n++)Cr(e,pe[n],t),cl[r][n]=yo[Ii(t)]}function KB(){var e,t,r,n,l,o,i,a;for(e=new me,t=new me,n=0;n<495;n++){for(ig(e.ea,494-n,8,!0),o=0;o<18;o+=3)St(e,($(),pe)[o],t),wr[n][o]=494-ml(t.ea,8,!0)&Ze;for(l=0;l<16;l+=2)Uo(e,($(),gt)[0][l],t),zr[n][l>>1]=494-ml(t.ea,8,!0)&Ze}for(r=0;r<495;r++)for(l=0;l<18;l+=3)for(a=wr[r][l],i=1;i<3;i++)a=wr[a][l],wr[r][l+i]=a&Ze}function $(){Nu||(Nu=!0,gr=Y(Ao,ue,7,16,0,1),pe=Y(Ao,ue,7,18,0,1),Xi=Y(id,ue,0,18,6,1),$u=Y(Qe,Ke,0,48,7,1),cr=rt(Qe,[ue,Ke],[17,0],7,[16,16],2),gt=rt(Qe,[ue,Ke],[17,0],7,[16,16],2),Do=rt(Qe,[ue,Ke],[17,0],7,[16,18],2),hn=Y(Qe,Ke,0,144,7,1),Er=rt(Qe,[ue,Ke],[17,0],7,[16,18],2),d0=Y(Se,ye,0,336,7,1),h0=Y(Se,ye,0,324,7,1),il=Y(Se,ye,0,2768,7,1),pl=Y(ne,se,0,2768,7,1),R0=Y(Se,ye,0,2768,7,1),Gi=Y(ne,se,0,24,7,1),Rn=Y(Se,ye,0,2048,7,1),yo=Y(Se,ye,0,2187,7,1),pr=Y(Se,ye,0,40320,7,1),Nr=Y(Se,ye,0,2688,7,1),l0=new Ct(2531,1373,67026819,1367),o0=new Ct(2089,1906,322752913,2040),Wi=re(te(ne,2),ue,10,0,[re(te(ne,1),se,0,7,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),re(te(ne,1),se,0,7,[6,7,8,0,1,2,3,4,5,15,16,17,9,10,11,12,13,14]),re(te(ne,1),se,0,7,[3,4,5,6,7,8,0,1,2,12,13,14,15,16,17,9,10,11]),re(te(ne,1),se,0,7,[2,1,0,5,4,3,8,7,6,11,10,9,14,13,12,17,16,15]),re(te(ne,1),se,0,7,[8,7,6,2,1,0,5,4,3,17,16,15,11,10,9,14,13,12]),re(te(ne,1),se,0,7,[5,4,3,8,7,6,2,1,0,14,13,12,17,16,15,11,10,9])]),HB(),ZB())}function p0(e){e.ca=re(te(ne,1),se,0,7,[0,1,2,3,4,5,6,7]),e.ea=re(te(ne,1),se,0,7,[0,2,4,6,8,10,12,14,16,18,20,22])}function Hu(e){!e.temps&&(e.temps=new me),Cr(o0,e,e.temps),Cr(e.temps,l0,e),St(o0,e,e.temps),St(e.temps,l0,e)}function m0(e,t){var r,n;for(n=0;n<8;n++)e.ca[n]=t.ca[n];for(r=0;r<12;r++)e.ea[r]=t.ea[r]}function QB(e){return Ti(pr[ct(e.ca,8,!1)])}function jB(e){return pr[ct(e.ea,8,!0)]}function Mi(e){var t,r;for(r=0,t=0;t<11;t++)r=r<<1|e.ea[t]&1;return r}function Ii(e){var t,r;for(r=0,t=0;t<7;t++)r+=(r<<1)+(e.ca[t]>>3);return r}function Oi(e){var t,r;for(!e.temps&&(e.temps=new me),r=0;r<12;r++)e.temps.ea[e.ea[r]>>1]=(r<<1|e.ea[r]&1)<<24>>24;for(t=0;t<8;t++)e.temps.ca[e.ca[t]&7]=(t|32>>(e.ca[t]>>3)&24)<<24>>24;m0(e,e.temps)}function Xu(e){var t,r,n,l,o,i,a;for(t=new Ju(e),l=new me,r=Ti(pr[ct(t.ca,8,!1)])>>4,i={l:0,m:0,h:0},a=0;a<6;a++){if(n=Ti(pr[ct(t.ca,8,!1)])>>4,r===n)for(o=0;o<16;o++)xo(t,gt[0][o],l),Pi(l.ca,e.ca)&&(Uo(t,gt[0][o],l),Pi(l.ea,e.ea)&&(i=e0(i,Ni({l:1,m:0,h:0},(a<<4|o)<48?a<<4|o:48))));Hu(t),a%3===2&&Oi(t)}return i}function qB(e,t){Fn(e.ca,t,8,!1)}function Zu(e,t){Fn(e.ea,t,8,!0)}function L0(e,t){var r,n,l;for(n=0,r=10;r>=0;--r,t>>=1)n^=l=t&1,e.ea[r]=(e.ea[r]&-2|l)<<24>>24;e.ea[11]=(e.ea[11]&-2|n)<<24>>24}function B0(e,t){var r,n,l;for(n=15,r=6;r>=0;--r,t=~~(t/3))n-=l=t%3,e.ca[r]=(e.ca[r]&7|l<<3)<<24>>24;e.ca[7]=(e.ca[7]&7|n%3<<3)<<24>>24}function VB(e){var t,r,n,l,o;for(o=0,l=0,n=0;n<12;n++)l|=1<<(e.ea[n]>>1),o^=e.ea[n]&1;if(l!==4095)return-2;if(o!==0)return-3;for(r=0,o=0,t=0;t<8;t++)r|=1<<(e.ca[t]&7),o+=e.ca[t]>>3;return r!==255?-4:o%3!==0?-5:(i0(ct(e.ea,12,!0),12)^i0(ct(e.ca,8,!1),8))!==0?-6:0}function xo(e,t,r){$();var n,l,o,i,a,s;for(s=gr[gt[0][t]],a=gr[t],n=0;n<8;n++)o=s.ca[e.ca[a.ca[n]&7]&7]>>3,i=e.ca[a.ca[n]&7]>>3,l=o<3?i:(3-i)%3,r.ca[n]=(s.ca[e.ca[a.ca[n]&7]&7]&7|l<<3)<<24>>24}function Cr(e,t,r){$();var n,l,o;for(n=0;n<8;n++)l=e.ca[t.ca[n]&7]>>3,o=t.ca[n]>>3,r.ca[n]=(e.ca[t.ca[n]&7]&7|(l+o)%3<<3)<<24>>24}function zi(e,t,r){var n,l,o,i;for(n=0;n<8;n++)o=e.ca[t.ca[n]&7]>>3,i=t.ca[n]>>3,l=o+(o<3?i:6-i),l=l%3+(o<3==i<3?0:3),r.ca[n]=(e.ca[t.ca[n]&7]&7|l<<3)<<24>>24}function me(){$(),p0(this)}function Ct(e,t,r,n){p0(this),Fn(this.ca,e,8,!1),B0(this,t),Fn(this.ea,r,12,!0),L0(this,n)}function Ju(e){p0(this),m0(this,e)}function Ti(e){return $(),e^s0>>((e&15)<<1)&3}function Uo(e,t,r){$();var n,l,o;for(o=gr[gt[0][t]],l=gr[t],n=0;n<12;n++)r.ea[n]=(o.ea[e.ea[l.ea[n]>>1]>>1]^e.ea[l.ea[n]>>1]&1^l.ea[n]&1)<<24>>24}function St(e,t,r){$();var n;for(n=0;n<12;n++)r.ea[n]=(e.ea[t.ea[n]>>1]^t.ea[n]&1)<<24>>24}function br(e,t,r){$();var n;return n=R0[e],r&&(n=n^s0>>((n&15)<<1)&3),n&65520|cr[n&15][t]}function Yu(){return $(),0}function HB(){var e,t;for(pe[0]=new Ct(15120,0,119750400,0),pe[3]=new Ct(21021,1494,323403417,0),pe[6]=new Ct(8064,1236,29441808,550),pe[9]=new Ct(9,0,5880,0),pe[12]=new Ct(1230,412,2949660,0),pe[15]=new Ct(224,137,328552,137),e=0;e<18;e+=3)for(t=0;t<2;t++)pe[e+t+1]=new me,St(pe[e+t],pe[e],pe[e+t+1]),Cr(pe[e+t],pe[e],pe[e+t+1])}function XB(){$();var e,t,r;for(r0(40320,il,pr,n0=Y(Se,ye,0,2768,7,1),2),e=new me,r=0;r<2768;r++)Zu(e,il[r]),pl[r]=ml(e.ea,0,!0)+i0(il[r],8)*70<<24>>24,Oi(e),R0[r]=pr[ct(e.ea,8,!0)];for(t=0;t<24;t++)Fn(e.ea,t,12,!0),Oi(e),Gi[t]=ct(e.ea,12,!0)%24<<24>>24}function ZB(){var e,t,r,n,l,o,i,a,s,f,u,g,c,p,L,m;for(e=new me,t=new me,r=new Ct(28783,0,259268407,0),m=new Ct(15138,0,119765538,7),g=new Ct(5167,0,83473207,0),l=0;l<8;l++)g.ca[l]=Ci(g.ca[l]|24);for(o=0;o<16;o++)gr[o]=new Ju(e),zi(e,m,t),St(e,m,t),L=t,t=e,e=L,o%4===3&&(zi(L,g,t),St(L,g,t),L=t,t=e,e=L),o%8===7&&(zi(L,r,t),St(L,r,t),L=t,t=e,e=L);for(i=0;i<16;i++)for(s=0;s<16;s++)for(zi(gr[i],gr[s],e),u=0;u<16;u++)if(Pi(gr[u].ca,e.ca)){cr[i][s]=u,gt[u][s]=i;break}for(f=0;f<18;f++)for(p=0;p<16;p++){for(xo(pe[f],gt[0][p],e),c=0;c<18;c++)if(Pi(pe[c].ca,e.ca)){Do[p][f]=c,Er[p][(et(),Ll)[f]]=Ll[c];break}p%2===0&&(hn[f<<3|p>>1]=Do[p][f])}for(n=0;n<18;n++)for(Xi[n]=Xu(pe[n]),a=n,p=0;p<48;p++)Do[p%16][a]<n&&($u[p]|=1<<n),p%16===15&&(a=Wi[2][a])}function r0(e,t,r,n,l){$();var o,i,a,s,f,u,g,c,p;for(o=new me,a=new me,i=0,f=0,p=l>=2?1:2,u=l!==1,s=0;s<e;s++)if(r[s]===0){switch(l){case 0:{L0(o,s);break}case 1:{B0(o,s);break}case 2:Fn(o.ea,s,8,!0)}for(g=0;g<16;g+=p){switch(u?Uo(o,g,a):xo(o,g,a),l){case 0:{f=Mi(a);break}case 1:{f=Ii(a);break}case 2:f=ct(a.ea,8,!0)}l===0&&(Nr[i<<3|g>>1]=f&Ze),f===s&&(n[i]=(n[i]|1<<~~(g/p))&Ze),c=~~((i<<4|g)/p),r[f]=c&Ze}t[i++]=s&Ze}return i}function JB(e,t,r,n,l,o,i,a){var s,f,u,g,c;if(g=_r(ut((Bn(),sl),(i>>4)*140+dn[($(),pl)[a>>4]&255][gt[i&15][a&15]]),_r(ut(sl,n*140+dn[pl[t]&255][gt[l][r]]),ut(qi,t*24+vo[o][r]))),g>e.maxDep2)return g-e.maxDep2;for(s=e.maxDep2;s>=g&&(c=rg(e,n,l,t,r,o,s,e.depth1,10),!(c<0));s--){for(s-=c,e.solLen=0,e.solution=new ag,ld(e.solution,e.verbose,e.urfIdx,e.depth1),u=0;u<e.depth1+s;u++)Iu(e.solution,e.move[u]);for(f=e.preMoveLen-1;f>=0;f--)Iu(e.solution,e.preMoves[f]);e.solLen=e.solution.length_0}return s!==e.maxDep2?(e.maxDep2=c0(lg,e.solLen-e.length1-1),Qu(e.probe,e.probeMin)?0:1):1}function YB(e){var t,r,n,l,o,i,a,s,f,u,g,c,p,L,m;if(e.isRec=!1,Qu(e.probe,e.solution?e.probeMin:e.probeMax))return 0;for(e.probe=UB(e.probe,{l:1,m:0,h:0}),n=e.valid1;n<e.depth1;n++)Cr(e.phase1Cubie[n],($(),pe)[e.move[n]],e.phase1Cubie[n+1]),St(e.phase1Cubie[n],pe[e.move[n]],e.phase1Cubie[n+1]);for(e.valid1=e.depth1,a=QB(e.phase1Cubie[e.depth1]),s=a&15,a>>=4,f=jB(e.phase1Cubie[e.depth1]),u=f&15,f>>=4,g=ct(e.phase1Cubie[e.depth1].ea,12,!0)%24,r=br(f,u,!1),t=br(a,s,!0),l=e.depth1===0?-1:e.move[e.depth1-1],o=e.preMoveLen===0?-1:e.preMoves[e.preMoveLen-1],m=0,L=(e.preMoveLen===0?1:2)*(e.depth1===0?1:2),c=0,p=(1<<L)-1;c<L;c++){if((p>>c&1)!==0){if(p&=~(1<<c),m=JB(e,a,s,f,u,g,r,t),m===0||m>2)break;m===2&&(p&=4<<c)}if(p===0)break;(c&1)===0&&e.depth1>0?(i=(et(),Ll)[~~(l/3)*3+1],e.move[e.depth1-1]=Nt[i]*2-e.move[e.depth1-1],g=(Bn(),ul)[g][i],a=al[a][($(),Er)[s][i]],s=cr[a&15][s],a>>=4,f=fl[f][Er[u][i]],u=cr[f&15][u],f>>=4,t=br(a,s,!0),r=br(f,u,!1)):e.preMoveLen>0&&(i=(et(),Ll)[~~(o/3)*3+1],e.preMoves[e.preMoveLen-1]=Nt[i]*2-e.preMoves[e.preMoveLen-1],g=($(),Gi)[(Bn(),ul)[Gi[g]][i]],a=al[t>>4][Er[t&15][i]],t=a&-16|cr[a&15][t&15],a=br(t>>4,t&15,!0),s=a&15,a>>=4,f=fl[r>>4][Er[r&15][i]],r=f&-16|cr[f&15][r&15],f=br(r>>4,r&15,!1),u=f&15,f>>=4)}return e.depth1>0&&(e.move[e.depth1-1]=l),e.preMoveLen>0&&(e.preMoves[e.preMoveLen-1]=o),m===0?0:2}function $B(e){var t;for(e.conjMask=0,e.selfSym=Xu(e.cc),e.conjMask|=Js(Xt(mn(e.selfSym,16),{l:Ze,m:0,h:0}),{l:0,m:0,h:0})?18:0,e.conjMask|=Js(Xt(mn(e.selfSym,32),{l:Ze,m:0,h:0}),{l:0,m:0,h:0})?36:0,e.conjMask|=Js(Xt(mn(e.selfSym,48),{l:Ze,m:0,h:0}),{l:0,m:0,h:0})?56:0,e.selfSym=Xt(e.selfSym,{l:nt,m:nt,h:15}),e.maxPreMoves=e.conjMask>7?0:20,t=0;t<6;t++)m0(e.urfCubieCube[t],e.cc),qu(e.urfCoordCube[t],e.urfCubieCube[t],20),Hu(e.cc),t%3===2&&Oi(e.cc)}function eg(e,t,r,n,l){var o,i,a,s,f,u;if(t.prun===0&&n<5)return e.allowShorter||n===0?(e.depth1-=n,f=YB(e),e.depth1+=n,f):1;for(u=Yu(g0(r)),o=0;o<18;o+=3)if(!(o===l||o===l-9)){for(a=0;a<3;a++)if(i=o+a,!(e.isRec&&i!==e.move[e.depth1-n]||u!==0&&(u&1<<i)!==0)){if(s=NB(e.nodeUD[n],t,i),s>n)break;if(s===n)continue;if(s=PB(e.nodeUD[n],t,i),s>n)break;if(s===n)continue;if(e.move[e.depth1-n]=i,e.valid1=c0(e.valid1,e.depth1-n),f=eg(e,e.nodeUD[n],r&Ln(($(),Xi)[i]),n-1,o),f===0)return 0;if(f>=2)break}}return 1}function tg(e,t,r,n,l){var o,i,a;if(e.preMoveLen=e.maxPreMoves-t,(e.isRec?e.depth1===e.length1-e.preMoveLen:e.preMoveLen===0||(225207>>r&1)===0)&&(e.depth1=e.length1-e.preMoveLen,e.phase1Cubie[0]=n,e.allowShorter=e.depth1===$s&&e.preMoveLen!==0,qu(e.nodeUD[e.depth1+1],n,e.depth1)&&eg(e,e.nodeUD[e.depth1+1],l,e.depth1,-1)===0))return 0;if(t===0||e.preMoveLen+$s>=e.length1)return 1;for(a=Yu(g0(l)),(t===1||e.preMoveLen+1+$s>=e.length1)&&(a|=225207),r=~~(r/3)*3,o=0;o<18;o++){if(o===r||o===r-9||o===r+9){o+=2;continue}if(!(e.isRec&&o!==e.preMoves[e.maxPreMoves-t]||(a&1<<o)!==0)&&(Cr(($(),pe)[o],n,e.preMoveCubes[t]),St(pe[o],n,e.preMoveCubes[t]),e.preMoves[e.maxPreMoves-t]=o,i=tg(e,t-1,o,e.preMoveCubes[t],l&Ln(Xi[o])),i===0))return 0}return 1}function rg(e,t,r,n,l,o,i,a,s){var f,u,g,c,p,L,m,d,F,D,S;if(t===0&&n===0&&o===0)return i;for(F=(et(),Fo)[s],m=0;m<10;m++){if((F>>m&1)!==0){m+=66>>m&3;continue}if(d=(Bn(),ul)[o][m],u=al[n][($(),Er)[l][m]],g=cr[u&15][l],u>>=4,p=fl[t][Er[r][m]],L=cr[p&15][r],p>>=4,c=br(p,L,!1),f=br(u,g,!0),D=ut(sl,(c>>4)*140+dn[pl[f>>4]&255][gt[c&15][f&15]]),D>i+1)return i-D+1;if(D>=i){m+=66>>m&3&i-D;continue}if(D=_r(ut(qi,u*24+vo[d][g]),ut(sl,p*140+dn[pl[u]&255][gt[L][g]])),D>=i){m+=66>>m&3&i-D;continue}if(S=rg(e,p,L,u,g,d,i-1,a+1,m),S>=0)return e.move[a]=Nt[m],S;if(S<-2)break;S<-1&&(m+=66>>m&3)}return-1}function ed(e){for(e.length1=e.isRec?e.length1:0;e.length1<e.solLen;e.length1++)for(e.maxDep2=c0(lg,e.solLen-e.length1-1),e.urfIdx=e.isRec?e.urfIdx:0;e.urfIdx<6;e.urfIdx++)if((e.conjMask&1<<e.urfIdx)===0&&tg(e,e.maxPreMoves,-30,e.urfCubieCube[e.urfIdx],Ln(Xt(e.selfSym,{l:Ze,m:0,h:0})))===0)return e.solution?Ou(e.solution):"Error 8";return e.solution?Ou(e.solution):"Error 7"}function td(e,t){var r;return r=rd(e,t),r!==0?\`Error \${r<0?-r:r}\`:(e.solLen=22,e.probe={l:0,m:0,h:0},e.probeMax={l:3531008,m:23,h:0},e.probeMin={l:0,m:0,h:0},e.verbose=0,e.solution=null,e.isRec=!1,Vu(!1),$B(e),ed(e))}function rd(e,t){var r,n,l,o;for(n=0,l=Y(ne,se,0,54,7,1),r=EB(re(te(Se,1),ye,0,7,[t.charCodeAt(4),t.charCodeAt(13),t.charCodeAt(22),t.charCodeAt(31),t.charCodeAt(40),t.charCodeAt(49)])),o=0;o<54;o++){if(l[o]=wB(r,_B(t.charCodeAt(o)))<<24>>24,l[o]===-1)return-1;n+=1<<(l[o]<<2)}return n!==10066329?-1:(nd(l,e.cc),VB(e.cc))}function ng(){var e,t,r;for(this.move=Y(Qe,Ke,0,31,7,1),this.nodeUD=Y(_i,ue,31,21,0,1),this.nodeRL=Y(_i,ue,31,21,0,1),this.nodeFB=Y(_i,ue,31,21,0,1),this.cc=new me,this.urfCubieCube=Y(Ao,ue,7,6,0,1),this.urfCoordCube=Y(_i,ue,31,6,0,1),this.phase1Cubie=Y(Ao,ue,7,21,0,1),this.preMoveCubes=Y(Ao,ue,7,21,0,1),this.preMoves=Y(Qe,Ke,0,20,7,1),t=0;t<21;t++)this.nodeUD[t]=new ho,this.nodeRL[t]=new ho,this.nodeFB[t]=new ho,this.phase1Cubie[t]=new me;for(r=0;r<6;r++)this.urfCubieCube[r]=new me,this.urfCoordCube[r]=new ho;for(e=0;e<20;e++)this.preMoveCubes[e+1]=new me}function et(){if(!Mu){Mu=!0;var e,t,r,n,l,o;for(pn=re(te(ne,2),ue,10,0,[re(te(ne,1),se,0,7,[8,9,20]),re(te(ne,1),se,0,7,[6,18,38]),re(te(ne,1),se,0,7,[0,36,47]),re(te(ne,1),se,0,7,[2,45,11]),re(te(ne,1),se,0,7,[29,26,15]),re(te(ne,1),se,0,7,[27,44,24]),re(te(ne,1),se,0,7,[33,53,42]),re(te(ne,1),se,0,7,[35,17,51])]),fr=re(te(ne,2),ue,10,0,[re(te(ne,1),se,0,7,[5,10]),re(te(ne,1),se,0,7,[7,19]),re(te(ne,1),se,0,7,[3,37]),re(te(ne,1),se,0,7,[1,46]),re(te(ne,1),se,0,7,[32,16]),re(te(ne,1),se,0,7,[28,25]),re(te(ne,1),se,0,7,[30,43]),re(te(ne,1),se,0,7,[34,52]),re(te(ne,1),se,0,7,[23,12]),re(te(ne,1),se,0,7,[21,41]),re(te(ne,1),se,0,7,[50,39]),re(te(ne,1),se,0,7,[48,14])]),ur=rt(Qe,[ue,Ke],[17,0],7,[13,13],2),a0=re(te(zB,1),ue,2,4,["U ","U2","U'","R ","R2","R'","F ","F2","F'","D ","D2","D'","L ","L2","L'","B ","B2","B'"]),Nt=re(te(Qe,1),Ke,0,7,[0,1,2,4,7,9,10,11,13,16,3,5,6,8,12,14,15,17]),Ll=Y(Qe,Ke,0,18,7,1),Fo=Y(Qe,Ke,0,11,7,1),t=0;t<18;t++)Ll[Nt[t]]=t;for(r=0;r<10;r++)for(n=~~(Nt[r]/3),Fo[r]=0,l=0;l<10;l++)o=~~(Nt[l]/3),Fo[r]|=(n===o||n%3===o%3&&n>=o?1:0)<<l;for(Fo[10]=0,e=0;e<13;e++)for(ur[e][0]=ur[e][e]=1,l=1;l<e;l++)ur[e][l]=ur[e-1][l-1]+ur[e-1][l]}}function ml(e,t,r){et();var n,l,o,i,a;for(n=e.length-1,o=0,a=4,l=n;l>=0;l--)i=og(e[l],r),(i&12)===t&&(o+=ur[l][a--]);return o}function i0(e,t){et();var r,n;for(n=0,r=t-2;r>=0;r--)n^=e%(t-r),e=~~(e/(t-r));return n&1}function ct(e,t,r){et();var n,l,o,i;for(l=0,i={l:1323536,m:2777561,h:1043915},n=0;n<t-1;n++)o=og(e[n],r)<<2,l=(t-n)*l+Ln(Xt(mn(i,o),{l:15,m:0,h:0})),i=ju(i,Ni({l:1118480,m:279620,h:69905},o));return l}function og(e,t){return t?e>>1:e&7}function ig(e,t,r,n){et();var l,o,i,a;for(l=e.length-1,a=4,o=l,i=l;i>=0;i--)t>=ur[i][a]?(t-=ur[i][a--],e[i]=Ki(e[i],a|r,n)):((o&12)===r&&(o-=4),e[i]=Ki(e[i],o--,n))}function Fn(e,t,r,n){et();var l,o,i,a,s,f;for(f={l:1323536,m:2777561,h:1043915},l={l:0,m:0,h:0},a=2;a<=r;a++)l=e0(Ni(l,4),g0(t%a)),t=~~(t/a);for(o=0;o<r-1;o++)s=(Ln(l)&15)<<2,l=mn(l,4),e[o]=Ki(e[o],Ln(Xt(mn(f,s),{l:15,m:0,h:0})),n),i=ju(Ni({l:1,m:0,h:0},s),{l:1,m:0,h:0}),f=e0(Xt(f,i),Xt(mn(f,4),{l:~i.l&nt,m:~i.m&nt,h:~i.h&kr}));e[r-1]=Ki(e[r-1],Ln(Xt(f,{l:15,m:0,h:0})),n)}function Ki(e,t,r){return(r?t<<1|e&1:t|e&-8)<<24>>24}function nd(e,t){et();var r,n,l,o,i,a,s,f;for(o=0;o<8;o++)t.ca[o]=0;for(i=0;i<12;i++)t.ea[i]=0;for(a=0;a<8;a++){for(f=0;f<3&&!(e[pn[a][f]]===0||e[pn[a][f]]===3);f++);for(r=e[pn[a][(f+1)%3]],n=e[pn[a][(f+2)%3]],s=0;s<8;s++)if(r===~~(pn[s][1]/9)&&n===~~(pn[s][2]/9)){t.ca[a]=Ci(f%3<<3|s);break}}for(l=0;l<12;l++)for(s=0;s<12;s++){if(e[fr[l][0]]===~~(fr[s][0]/9)&&e[fr[l][1]]===~~(fr[s][1]/9)){t.ea[l]=Ci(s<<1);break}if(e[fr[l][0]]===~~(fr[s][1]/9)&&e[fr[l][1]]===~~(fr[s][0]/9)){t.ea[l]=Ci(s<<1|1);break}}}function Iu(e,t){var r,n,l;if(e.length_0===0){e.moves[e.length_0++]=t;return}if(r=~~(t/3),n=~~(e.moves[e.length_0-1]/3),r===n){l=(t%3+e.moves[e.length_0-1]%3+1)%4,l===3?--e.length_0:e.moves[e.length_0-1]=r*3+l;return}if(e.length_0>1&&r%3===n%3&&r===~~(e.moves[e.length_0-2]/3)){l=(t%3+e.moves[e.length_0-2]%3+1)%4,l===3?(e.moves[e.length_0-2]=e.moves[e.length_0-1],--e.length_0):e.moves[e.length_0-2]=r*3+l;return}e.moves[e.length_0++]=t}function ld(e,t,r,n){e.verbose=t,e.urfIdx=r,e.depth1=n}function Ou(e){var t,r,n;if(r=new CB,n=(e.verbose&2)!==0?(e.urfIdx+3)%6:e.urfIdx,n<3)for(t=0;t<e.length_0;t++)(e.verbose&1)!==0&&t===e.depth1&&(r.string+=". "),_u(zu(r,(et(),a0)[($(),Wi)[n][e.moves[t]]]));else for(t=e.length_0-1;t>=0;t--)_u(zu(r,(et(),a0)[($(),Wi)[n][e.moves[t]]])),(e.verbose&1)!==0&&t===e.depth1&&(r.string+=". ");return r.string}function ag(){this.moves=Y(Qe,Ke,0,31,7,1)}var ue,nt,kr,RB,Ze,ye,Ke,s0,Bo,se,H,Qi,Ei,zB,Cu,dn,t0,al,sl,fl,Bl,qi,vo,ul,gl,cl,zr,Vi,wr,Hi,ki,_i,Nu,gr,pr,il,Rn,d0,Nr,Gi,pl,R0,hn,Do,Er,cr,gt,Pu,n0,Ys,yo,h0,$u,pe,Xi,l0,o0,Wi,Ao,lg,$s,Mu,ur,Fo,pn,fr,a0,Ll,Nt,Qe,od,ne,id,Se,ad,sd,sg=y(()=>{"use strict";ue={3:1},nt=4194303,kr=1048575,RB=524288,Ze=65535,ye={11:1,3:1},Ke={17:1,3:1},s0=14540032,Bo=286331153,se={10:1,3:1},Qi={};So(1,null,{},AB);So(79,1,{},f0);H.createClassLiteralForArray=function(t){var r;return r=new f0,r.modifiers=4,t>1?r.componentType=Gu(this,t-1):r.componentType=this,r};H.isPrimitive=function(){return(this.modifiers&1)!==0};zB=Pr("java.lang","String",2);Cu=!1;So(31,1,{31:1},ho);H.flip=0;H.flipc=0;H.fsym=0;H.prun=0;H.slice_0=0;H.tsym=0;H.twist=0;H.twistc=0;ki=0,_i=Pr("org.cubing.min2phase.client","CoordCube",31),Nu=!1;Ao=Pr("org.cubing.min2phase.client","CubieCube",7);So(72,1,{},ng);H.allowShorter=!1;H.conjMask=0;H.depth1=0;H.isRec=!1;H.length1=0;H.maxDep2=0;H.maxPreMoves=0;H.preMoveLen=0;H.probe={l:0,m:0,h:0};H.probeMax={l:0,m:0,h:0};H.probeMin={l:0,m:0,h:0};H.selfSym={l:0,m:0,h:0};H.solLen=0;H.urfIdx=0;H.valid1=0;H.verbose=0;lg=12,$s=7,Mu=!1;So(150,1,{},ag);H.depth1=0;H.length_0=0;H.urfIdx=0;H.verbose=0;Qe=ji("int","I");Pr("com.google.gwt.lang","CollapsedPropertyHolder",252);Pr("com.google.gwt.lang","JavaClassHierarchySetupUtil",254);od=Pr("com.google.gwt.lang","LongLibBase/LongEmul",null);Pr("com.google.gwt.lang","ModuleUtils",257);ne=ji("byte","B"),id=ji("long","J"),Se=ji("char","C");Pr("com.google.gwt.user.client.rpc","XsrfToken",null),yB("java.util","Map/Entry");ad=function(){Vu(!1)},sd=function(e){return td(new ng,e)}});var fg={};mt(fg,{initialize:()=>ad,solveState:()=>sd});var ug=y(()=>{"use strict";sg()});var F0,gg=y(()=>{"use strict";Vt();F0=We(()=>Promise.resolve().then(()=>(ug(),fg)))});function cg(e,t){return e.slice(t)+e.slice(0,t)}function pd(e){let t=[[],[]];for(let r=0;r<6;r++)if(e.stateData.CENTERS.pieces[r]!==r)throw new Error("non-oriented puzzles are not supported");for(let r=0;r<12;r++)t[0].push(cg(fd[e.stateData.EDGES.pieces[r]],e.stateData.EDGES.orientation[r]));for(let r=0;r<8;r++)t[1].push(cg(ud[e.stateData.CORNERS.pieces[r]],e.stateData.CORNERS.orientation[r]));return t.push(gd),t}function pg(e){let t=pd(e);return cd.map(([r,n,l])=>t[r][n][l]).join("")}var fd,ud,gd,cd,mg=y(()=>{"use strict";fd="UF UR UB UL DF DR DB DL FR FL BR BL".split(" "),ud="UFR URB UBL ULF DRF DFL DLB DBR".split(" "),gd="U L F R B D".split(" "),cd=[[1,2,0],[0,2,0],[1,1,0],[0,3,0],[2,0,0],[0,1,0],[1,3,0],[0,0,0],[1,0,0],[1,0,2],[0,1,1],[1,1,1],[0,8,1],[2,3,0],[0,10,1],[1,4,1],[0,5,1],[1,7,2],[1,3,2],[0,0,1],[1,0,1],[0,9,0],[2,2,0],[0,8,0],[1,5,1],[0,4,1],[1,4,2],[1,5,0],[0,4,0],[1,4,0],[0,7,0],[2,5,0],[0,5,0],[1,6,0],[0,6,0],[1,7,0],[1,2,2],[0,3,1],[1,3,1],[0,11,1],[2,1,0],[0,9,1],[1,6,1],[0,7,1],[1,5,2],[1,1,2],[0,2,1],[1,2,1],[0,10,0],[2,4,0],[0,11,0],[1,7,1],[0,6,1],[1,6,2]]});function Lg(e,t){let r=new ce(e.kpuzzle,{EDGES:e.stateData.EDGES,CORNERS:e.stateData.CORNERS,CENTERS:{pieces:e.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}}).experimentalToTransformation(),n=new ce(t.kpuzzle,{EDGES:t.stateData.EDGES,CORNERS:t.stateData.CORNERS,CENTERS:{pieces:t.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}}).experimentalToTransformation();return r.isIdentical(n)}function Bg(e,t){if(Lg(e.startState(),t))return!1;for(let r of"ULFRBD")for(let n=1;n<4;n++){let l=e.moveToTransformation(new B(r,n)).toKState();if(Lg(l,t))return!1}return!0}var dg=y(()=>{"use strict";fe();He()});var Rg,hg=y(()=>{"use strict";Rg=[["R U'","R2 B","D2 B2","D' L B'","R' U'","B","D B2","R' B","L' U","L2 B'","B2","D L B'","L U","B'","U'","R B","D' B2","L B'","U2","U L' B'","","U' L' B'","U","L' B'"],["F2 L2","F' L'","R' F L2","D' L2","F L2","F2 L'","R' F' L'","R2 F L2","R2 F2 L'","L2","F L'","D' L","D2 L2","R2 F' L'","D L","","L2 F L'","L F' L2","L F L'","F' L2","L'","D L2","D F L'","L"],["R B U2 B'","R2 B U' B'","F2 B U B'","F B2 L' B2","B2 L B2","B U' B'","R2 B U2 B'","R' B U' B'","B2 L' B2","F B U B'","B2 U' B2","B' L B","L F' B D' B'","B' U' B2 D B'","B U2 B'","R B U' B'","B2 L2 B2","D' B' L B","B U B'","F' B2 L' B2","","B2 L' B' U' B'"],["U F2 L2 U'","F' U L' U'","F2 U L' U'","U F L2 U'","U2 B2 U2","R' U' B U","D2 U L U'","D U2 B' U2","U L2 U'","F U L' U'","D U L U'","U2 B' U2","","U2 B' U' L' U'","U2 L' U2","U' B U","U L U'","D' U2 B' U2","U L' U'","U2 B U2"],["R' D' F2","F'","F2","D R F'","R D' F2","R2 F'","D' F2","R F'","F2 R' D' F2","F","D2 F2","D' R F'","R2 D' F2","R' F'","D F2","D2 R F'","","F R' D' F2"],["R' D2 F' D F","R F2 R2 F2","R2 F' D2 F","F' R2 D2 F","L D' L'","D F' D2 F","F2 R2 F2","R F' D2 F","F' R2 D' F","F' R' D2 F","F2 R' F2","L D L'","F' R D' F","F2 R F2","F' D2 F","","L D2 R D' L'","F' D2 F' R F2","D2 R2 F2 R2 F2","D F' D' F","F' D F"],["U F2 U'","R U F' U'","D R U F2 U'","U F U'","R2 U F2 U'","R' U F' U'","R U F2 U'","R2 U F' U'","","U L D L' F U'","F2 D' R D F2","D2 U F U'","R' U F2 U'","U F' U'","F2 D2 R D2 F2","D U F U'"],["R2","R' B' D B","D R'","F' R2 F","","R B' D B","R'","B' D B","D' R'","D2 F' R2 F","R","R2 B' D B","D2 R'","B' D' B"],["R2 D' R2","F' R' F R","R D' R2 D R'","D2 R2 D2 R2","R' D' F' R F","U F D F' U'","","R2 D2 B R' B' R'","R' F D' F2 R F","R2 D R2","F2 U F U' F","R' D F' R F","D R2 D2 R2","U F D' F' U'","D R' D2 F' R F","R2 D2 R2","U F D2 F' U'","R' D2 F' R F"],["B R B'","F D F' B R2 B'","D B R2 B'","D2 B R' B'","B R2 B'","D B R' B'","D' B R2 B'","B R' B'","","B R2 B' D B R' B'","D2 B R2 B'","D' B R' B'"],["","R' D R F D2 F'","R' D R","D F D' F'","R F' R' F","F D' F'","R' D' R","F D2 F'","R' D2 R","F D F'"],["","F2 D2 R F' R' D2 F' D2 F'","F2 D2 F' D' F D' F' D2 F'","F2 D F2 D F2 D2 F2","D2 F L D2 L' D2 F'","D F D2 L D2 L' F'","R' D B' D2 B D' R","R' D2 B' D2 B R","F D2 F' D F D F'","F D' L D2 L' D F'","B D' F D B' D' F'","F D2 L D2 L' F'","F D' L D L' D F'","F L D2 L' D2 F'","R' B' D2 B D2 R"],["D'","F L D L' D' F'","D2","L B D B' D' L'","D","B' L' D' L D B","","D F L D L' D' F'"],["F' D2 F D F' D F","F' D' R' D R F","F' R' D' R D F","B D R D' R' B'","","D B' D' L' D L B"],["D F D F' D F D2 F'","F' U2 B' R' B U2 F' L F' L' F'","","D2 L D L2 F L F2 D F"],["L B' L' F L B L' F'","F2 U F' D2 F U' F' D2 F'","D' F' D B D' F D B'","F L2 F R2 F' L2 F R2 F2","D B D' F' D B' D' F","R F L F' R' F L' F'","","D2 B L' U2 L B' D2 B L' U2 L B'","D2 F R' U2 R F' D2 F R' U2 R F'","R F L' F' R' F L F'","D F D' B' D F' D' B","L2 F2 L' B2 L F2 L' B2 L'"],["L B R' B' L' B R B'","R' B R F' R' B' R F","L D2 L U L' D2 L U' L2","","D2 B' D2 F D' L2 F L2 F' D2 B D' F'","D2 F' R' F R2 B' D2 B D2 R' F D2 F'","L B L' F L B' L' F'","F' D2 F' U' F D2 F' U F2","D' B' D F D' B D F'"],["","D2 F' L U2 L' F D2 F' L U2 L' F","D2 B' R U2 R' B D2 B' R U2 R' B"]]});async function Dg(){let e=await Me["3x3x3"].kpuzzle(),t=e.startState();for(let r of Rg)t=t.applyAlg(w.fromString((await sr())(r)));return Bg(e,t)?t:Dg()}async function D0(e){return be(),w.fromString((await F0).solveState(pg(e)))}async function dl(){return D0(await Dg())}async function Ag(){(await F0).initialize()}async function yg(){return ol(await dl(),md)}async function Sg(){let e=new Lt,t=await dl();return e.experimentalPushAlg(Fg),e.experimentalPushAlg(t),e.experimentalPushAlg(Fg),e.toAlg()}var md,Fg,A0=y(()=>{"use strict";fe();ar();yt();At();wi();gg();mg();dg();hg();md=[[null,"Rw","Rw2","Rw'","Fw","Fw'"],[null,"Dw","Dw2","Dw'"]];Fg=new w("R' U' F")});function ge(e,...t){let r=t.length,n=e[t[r-1]];for(let l=r;l>0;l--)e[t[l]]=e[t[l-1]];return e[t[0]]=n,ge}function vg(e,t,r,n){r=(r||8)-1;let l=1985229328,o=0;n??(n=0),n<0&&(t<<=1);for(let i=0;i<r;++i){let a=y0[r-i],s=~~(t/a);o^=s,t%=a,s<<=2,e[i]=l>>s&7;let f=(1<<s)-1;l=(l&f)+(l>>4&~f)}return n<0&&(o&1)!==0?(e[r]=e[r-1],e[r-1]=l&7):e[r]=l&7,e}var Re,y0,xg=y(()=>{"use strict";Re=[],y0=[1];for(let e=0;e<32;++e){Re[e]=[];for(let t=0;t<32;++t)Re[e][t]=0}for(let e=0;e<32;++e){Re[e][0]=Re[e][e]=1,y0[e+1]=y0[e]*(e+1);for(let t=1;t<e;++t)Re[e][t]=Re[e-1][t-1]+Re[e-1][t]}});function O(e,t){let r=new Array(e);if(t!==void 0)for(let n=0;n<e;n++)r[n]=new Array(t);return r}function Dd(e){return new _o[e]}function Rt(e,t,r,...n){let l=_o[e];l&&!l.___clazz$?X=l.prototype:(!l&&(l=_o[e]=function(){}),X=l.prototype=t<0?{}:Dd(t),X.castableTypeMap$=r);for(let o of n)o.prototype=X;l.___clazz$&&(X.___clazz$=l.___clazz$,l.___clazz$=null)}function Gr(e){let t={};for(let r=0,n=e.length;r<n;++r)t[e[r]]=1;return t}function Xg(){}function Ad(e,t){let r=Zg(0,t);return Jg(e.___clazz$,e.castableTypeMap$,e.queryId$,r),r}function Zg(e,t){let r=new Array(t);if(e===3)for(let n=0;n<t;++n){let l={m:0,l:0,h:0};l.l=l.m=l.h=0,r[n]=l}else if(e>0){let n=[null,0,!1][e];for(let l=0;l<t;++l)r[l]=n}return r}function z0(e,t,r,n,l){let o=Zg(l,n);return Jg(e,t,r,o),o}function Jg(e,t,r,n){return Yg(),Sd(n,x0,U0),n.___clazz$=e,n.castableTypeMap$=t,n.queryId$=r,n}function na(e,t,r){return e[t]=r}function Yg(){Ug||(Ug=!0,x0=[],U0=[],yd(new Xg,x0,U0))}function yd(e,t,r){let n=0,l;for(let o in e)(l=e[o])&&(t[n]=o,r[n]=l,++n)}function Sd(e,t,r){Yg();for(let n=0,l=t.length;n<l;++n)e[t[n]]=r[n]}function vd(e,t){return e.castableTypeMap$&&!!e.castableTypeMap$[t]}function xd(e,t){return e!==null&&vd(e,t)}function Ud(){if(bg)return!1;bg=!0,La=O(15582,36),Ba=O(15582),Ot=O(15582),yl=O(48,48),Mt=O(48,36),Al=O(48),P0=O(48)}function C0(e){e.ct=O(24)}function wg(e,t){let r,n;if(xd(t,Vg)){for(r=t,n=0;n<24;++n)if(e.ct[n]!==r.ct[n])return!1;return!0}return!1}function la(e){let t,r,n;for(r=0,n=8,t=23;t>=0;--t)e.ct[t]===1&&(r+=Re[t][n--]);return r}function Ji(e){let t,r;if(Ul!==null)return Ul[la(e)];for(r=0;r<48;++r){if(t=zd(la(e)),t!==-1)return t*64+r;oe(e,0),r%2===1&&oe(e,1),r%8===7&&oe(e,2),r%16===15&&oe(e,3)}}function Pt(e,t){let r=t%3;switch(t=~~(t/3),t){case 0:{h(e.ct,0,1,2,3,r);break}case 1:{h(e.ct,16,17,18,19,r);break}case 2:{h(e.ct,8,9,10,11,r);break}case 3:{h(e.ct,4,5,6,7,r);break}case 4:{h(e.ct,20,21,22,23,r);break}case 5:{h(e.ct,12,13,14,15,r);break}case 6:{h(e.ct,0,1,2,3,r),h(e.ct,8,20,12,16,r),h(e.ct,9,21,13,17,r);break}case 7:{h(e.ct,16,17,18,19,r),h(e.ct,1,15,5,9,r),h(e.ct,2,12,6,10,r);break}case 8:{h(e.ct,8,9,10,11,r),h(e.ct,2,19,4,21,r),h(e.ct,3,16,5,22,r);break}case 9:{h(e.ct,4,5,6,7,r),h(e.ct,10,18,14,22,r),h(e.ct,11,19,15,23,r);break}case 10:{h(e.ct,20,21,22,23,r),h(e.ct,0,8,4,14,r),h(e.ct,3,11,7,13,r);break}case 11:h(e.ct,12,13,14,15,r),h(e.ct,1,20,7,18,r),h(e.ct,0,23,6,17,r)}}function oe(e,t){switch(t){case 0:{Pt(e,19),Pt(e,28);break}case 1:{Pt(e,21),Pt(e,32);break}case 2:{h(e.ct,0,3,1,2,1),h(e.ct,8,11,9,10,1),h(e.ct,4,7,5,6,1),h(e.ct,12,15,13,14,1),h(e.ct,16,19,21,22,1),h(e.ct,17,18,20,23,1);break}case 3:Pt(e,18),Pt(e,29),Pt(e,24),Pt(e,35)}}function Eg(e,t){let r;for(r=0;r<t;++r)oe(e,0),r%2===1&&oe(e,1),r%8===7&&oe(e,2),r%16===15&&oe(e,3)}function N0(e,t){let r,n;for(n=8,r=23;r>=0;--r)e.ct[r]=0,t>=Re[r][n]&&(t-=Re[r][n--],e.ct[r]=1)}function Yi(e,t){let r;for(r=0;r<24;++r)e.ct[r]=t.ct[r]}function zo(){let e;for(C0(this),e=0;e<8;++e)this.ct[e]=1;for(e=8;e<24;++e)this.ct[e]=0}function $i(e,t){let r;for(C0(this),r=0;r<24;++r)this.ct[r]=~~(e.ct[r]/2)===t?1:0}function wo(e){let t;for(C0(this),t=0;t<24;++t)this.ct[t]=e[t]}function bd(){let e,t,r=new zo,n=new zo;for(e=0;e<15582;++e)for(N0(n,Ba[e]),t=0;t<36;++t)Yi(r,n),Pt(r,t),La[e][t]=Ji(r)}function wd(){let e,t,r,n,l,o,i,a;for(Fa(Ot),Ot[0]=0,t=0,r=1;r!==15582;)for(o=t>4,a=o?-1:t,e=o?t:-1,++t,n=0;n<15582;++n)if(Ot[n]===a){for(i=0;i<27;++i)if(l=~~La[n][i]>>>6,Ot[l]===e)if(++r,o){Ot[n]=t;break}else Ot[l]=t}}function Ed(e){let t,r,n,l=new wo(e.ct);for(n=0;n<48;++n){for(t=!0,r=0;r<24;++r)if(l.ct[r]!==~~(r/4)){t=!1;break}if(t)return n;oe(l,0),n%2===1&&oe(l,1),n%8===7&&oe(l,2),n%16===15&&oe(l,3)}return-1}function kd(){let e,t,r,n=new zo;for(e=0;e<24;++e)n.ct[e]=e;let l=new wo(n.ct),o=new wo(n.ct),i=new wo(n.ct);for(e=0;e<48;++e){for(t=0;t<48;++t){for(r=0;r<48;++r)wg(n,l)&&(yl[e][t]=r,r===0&&(Al[e]=t)),oe(l,0),r%2===1&&oe(l,1),r%8===7&&oe(l,2),r%16===15&&oe(l,3);oe(n,0),t%2===1&&oe(n,1),t%8===7&&oe(n,2),t%16===15&&oe(n,3)}oe(n,0),e%2===1&&oe(n,1),e%8===7&&oe(n,2),e%16===15&&oe(n,3)}for(e=0;e<48;++e)for(Yi(n,o),Eg(n,Al[e]),t=0;t<36;++t)for(Yi(l,n),Pt(l,t),Eg(l,e),r=0;r<36;++r)if(Yi(i,o),Pt(i,r),wg(i,l)){Mt[e][t]=r;break}for(N0(n,0),e=0;e<48;++e)P0[Al[e]]=la(n),oe(n,0),e%2===1&&oe(n,1),e%8===7&&oe(n,2),e%16===15&&oe(n,3)}function _d(){let e,t,r,n,l=new zo,o=O(22984);for(t=0;t<22984;t++)o[t]=0;for(e=0,t=0;t<735471;++t)if((o[~~t>>>5]&1<<(t&31))===0){for(N0(l,t),n=0;n<48;++n)r=la(l),o[~~r>>>5]|=1<<(r&31),Ul!==null&&(Ul[r]=e<<6|Al[n]),oe(l,0),n%2===1&&oe(l,1),n%8===7&&oe(l,2),n%16===15&&oe(l,3);Ba[e++]=t}}function zd(e){let t=FR(Ba,e);return t>=0?t:-1}function Cd(){kg||(kg=!0,sa=O(70,28),aa=O(6435,28),rc=O(70,16),ec=O(6435,16),lt=O(450450),tc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0])}function oa(e){let t,r,n;for(r=0,n=8,t=14;t>=0;--t)e.ct[t]!==e.ct[15]&&(r+=Re[t][n--]);return r}function ia(e){let t,r,n;for(r=0,n=4,t=6;t>=0;--t)e.rl[t]!==e.rl[7]&&(r+=Re[t][n--]);return r*2+e.parity}function Dl(e,t){e.parity^=tc[t];let r=t%3;switch(t=~~(t/3),t){case 0:{h(e.ct,0,1,2,3,r);break}case 1:{h(e.rl,0,1,2,3,r);break}case 2:{h(e.ct,8,9,10,11,r);break}case 3:{h(e.ct,4,5,6,7,r);break}case 4:{h(e.rl,4,5,6,7,r);break}case 5:{h(e.ct,12,13,14,15,r);break}case 6:{h(e.ct,0,1,2,3,r),h(e.rl,0,5,4,1,r),h(e.ct,8,9,12,13,r);break}case 7:{h(e.rl,0,1,2,3,r),h(e.ct,1,15,5,9,r),h(e.ct,2,12,6,10,r);break}case 8:{h(e.ct,8,9,10,11,r),h(e.rl,0,3,6,5,r),h(e.ct,3,2,5,4,r);break}case 9:{h(e.ct,4,5,6,7,r),h(e.rl,3,2,7,6,r),h(e.ct,11,10,15,14,r);break}case 10:{h(e.rl,4,5,6,7,r),h(e.ct,0,8,4,14,r),h(e.ct,3,11,7,13,r);break}case 11:h(e.ct,12,13,14,15,r),h(e.rl,1,4,7,2,r),h(e.ct,1,0,7,6,r)}}function Rl(e,t){switch(t){case 0:{Dl(e,19),Dl(e,28);break}case 1:{Dl(e,21),Dl(e,32);break}case 2:h(e.ct,0,3,1,2,1),h(e.ct,8,11,9,10,1),h(e.ct,4,7,5,6,1),h(e.ct,12,15,13,14,1),h(e.rl,0,3,5,6,1),h(e.rl,1,2,4,7,1)}}function $g(e,t,r){let n;for(n=0;n<16;++n)e.ct[n]=~~(t.ct[n]/2);for(n=0;n<8;++n)e.rl[n]=t.ct[n+16];e.parity=r}function _g(e,t){let r,n;for(n=8,e.ct[15]=0,r=14;r>=0;--r)t>=Re[r][n]?(t-=Re[r][n--],e.ct[r]=1):e.ct[r]=0}function zg(e,t){let r,n;for(e.parity=t&1,t>>>=1,n=4,e.rl[7]=0,r=6;r>=0;--r)t>=Re[r][n]?(t-=Re[r][n--],e.rl[r]=1):e.rl[r]=0}function M0(){this.rl=O(8),this.ct=O(16)}function Nd(){let e,t,r,n,l,o,i,a,s,f,u=new M0;for(l=0;l<70;++l)for(a=0;a<28;++a)zg(u,l),Dl(u,An[a]),sa[l][a]=ia(u);for(l=0;l<70;++l)for(zg(u,l),i=0;i<16;++i)rc[l][i]=ia(u),Rl(u,0),i%2===1&&Rl(u,1),i%8===7&&Rl(u,2);for(l=0;l<6435;++l)for(_g(u,l),i=0;i<16;++i)ec[l][i]=oa(u)&65535,Rl(u,0),i%2===1&&Rl(u,1),i%8===7&&Rl(u,2);for(l=0;l<6435;++l)for(a=0;a<28;++a)_g(u,l),Dl(u,An[a]),aa[l][a]=oa(u)&65535;for(Fa(lt),lt[0]=lt[18]=lt[28]=lt[46]=lt[54]=lt[56]=0,r=0,n=6;n!==450450;){let g=r>6,c=g?-1:r,p=g?r:-1;for(++r,l=0;l<450450;++l)if(lt[l]===c){for(e=~~(l/70),s=l%70,a=0;a<23;++a)if(t=aa[e][a],f=sa[s][a],o=t*70+f,lt[o]===p)if(++n,g){lt[l]=r;break}else lt[o]=r}}}function Pd(){Cg||(Cg=!0,Eo=O(29400,20),lc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1],Ir=O(29400),T0=[0,9,14,23,27,28,41,42,46,55,60,69],G0=O(70))}function I0(e){let t,r,n,l;for(r=0,l=4,t=6;t>=0;--t)e.ud[t]!==e.ud[7]&&(r+=Re[t][l--]);for(r*=35,l=4,t=6;t>=0;--t)e.fb[t]!==e.fb[7]&&(r+=Re[t][l--]);r*=12;let o=e.fb[7]^e.ud[7];for(n=0,l=4,t=7;t>=0;--t)e.rl[t]!==o&&(n+=Re[t][l--]);return e.parity+2*(r+G0[n])}function Md(e,t){switch(e.parity^=lc[t],t){case 0:case 1:case 2:{h(e.ud,0,1,2,3,t%3);break}case 3:{h(e.rl,0,1,2,3,1);break}case 4:case 5:case 6:{h(e.fb,0,1,2,3,(t-1)%3);break}case 7:case 8:case 9:{h(e.ud,4,5,6,7,(t-1)%3);break}case 10:{h(e.rl,4,5,6,7,1);break}case 11:case 12:case 13:{h(e.fb,4,5,6,7,(t+1)%3);break}case 14:{h(e.ud,0,1,2,3,1),h(e.rl,0,5,4,1,1),h(e.fb,0,5,4,1,1);break}case 15:{h(e.rl,0,1,2,3,1),h(e.fb,1,4,7,2,1),h(e.ud,1,6,5,2,1);break}case 16:{h(e.fb,0,1,2,3,1),h(e.ud,3,2,5,4,1),h(e.rl,0,3,6,5,1);break}case 17:{h(e.ud,4,5,6,7,1),h(e.rl,3,2,7,6,1),h(e.fb,3,2,7,6,1);break}case 18:{h(e.rl,4,5,6,7,1),h(e.fb,0,3,6,5,1),h(e.ud,0,3,4,7,1);break}case 19:h(e.fb,4,5,6,7,1),h(e.ud,0,7,6,1,1),h(e.rl,1,4,7,2,1)}}function nc(e,t,r){let n,l=(t.ct[0]>t.ct[8]?1:0)^(t.ct[8]>t.ct[16]?1:0)^(t.ct[0]>t.ct[16]?1:0)?1:0;for(n=0;n<8;++n)e.ud[n]=t.ct[n]&1^1,e.fb[n]=t.ct[n+8]&1^1,e.rl[n]=t.ct[n+16]&1^1^l;e.parity=l^r}function Id(e,t){let r,n,l,o;for(e.parity=t&1,t>>>=1,l=T0[t%12],t=~~(t/12),o=4,r=7;r>=0;--r)e.rl[r]=0,l>=Re[r][o]&&(l-=Re[r][o--],e.rl[r]=1);for(n=t%35,t=~~(t/35),o=4,e.fb[7]=0,r=6;r>=0;--r)n>=Re[r][o]?(n-=Re[r][o--],e.fb[r]=1):e.fb[r]=0;for(o=4,e.ud[7]=0,r=6;r>=0;--r)t>=Re[r][o]?(t-=Re[r][o--],e.ud[r]=1):e.ud[r]=0}function O0(){this.ud=O(8),this.rl=O(8),this.fb=O(8)}function Od(){let e,t,r,n;for(r=0;r<12;++r)G0[T0[r]]=r;let l=new O0;for(r=0;r<29400;++r)for(n=0;n<20;++n)Id(l,r),Md(l,n),Eo[r][n]=I0(l)&65535;for(Fa(Ir),Ir[0]=0,e=0,t=1;t!==29400;){for(r=0;r<29400;++r)if(Ir[r]===e)for(n=0;n<17;++n)Ir[Eo[r][n]]===-1&&(Ir[Eo[r][n]]=e+1,++t);++e}}function Td(e,t){let r;for(r=0;r<24;++r)e.ct[r]=t.ct[r]}function Gd(e,t){let r=t%3;switch(t=~~(t/3),t){case 0:{h(e.ct,0,1,2,3,r);break}case 1:{h(e.ct,16,17,18,19,r);break}case 2:{h(e.ct,8,9,10,11,r);break}case 3:{h(e.ct,4,5,6,7,r);break}case 4:{h(e.ct,20,21,22,23,r);break}case 5:{h(e.ct,12,13,14,15,r);break}case 6:{h(e.ct,0,1,2,3,r),h(e.ct,8,20,12,16,r),h(e.ct,9,21,13,17,r);break}case 7:{h(e.ct,16,17,18,19,r),h(e.ct,1,15,5,9,r),h(e.ct,2,12,6,10,r);break}case 8:{h(e.ct,8,9,10,11,r),h(e.ct,2,19,4,21,r),h(e.ct,3,16,5,22,r);break}case 9:{h(e.ct,4,5,6,7,r),h(e.ct,10,18,14,22,r),h(e.ct,11,19,15,23,r);break}case 10:{h(e.ct,20,21,22,23,r),h(e.ct,0,8,4,14,r),h(e.ct,3,11,7,13,r);break}case 11:h(e.ct,12,13,14,15,r),h(e.ct,1,20,7,18,r),h(e.ct,0,23,6,17,r)}}function W0(){let e;for(this.ct=O(24),e=0;e<24;++e)this.ct[e]=~~(e/4)}function oc(e){let t,r,n;for(W0.call(this),t=0;t<23;++t)n=t+e(24-t),this.ct[n]!==this.ct[t]&&(r=this.ct[t],this.ct[t]=this.ct[n],this.ct[n]=r)}function Wd(){Ng||(Ng=!0,xt=O(18),jd())}function ic(e){e.cp=[0,1,2,3,4,5,6,7],e.co=[0,0,0,0,0,0,0,0]}function ac(e,t){let r;for(r=0;r<8;++r)e.cp[r]=t.cp[r],e.co[r]=t.co[r]}function Kd(e,t){!e.temps&&(e.temps=new da),sc(e,xt[t],e.temps),ac(e,e.temps)}function Qd(e,t){let r,n;for(n=0,r=6;r>=0;--r)n+=e.co[r]=t%3,t=~~(t/3);e.co[7]=(15-n)%3}function sc(e,t,r){let n,l,o,i;for(n=0;n<8;++n)r.cp[n]=e.cp[t.cp[n]],o=e.co[t.cp[n]],i=t.co[n],l=o,l=l+(o<3?i:6-i),l=l%3,(o>=3?1:0)^(i>=3?1:0)&&(l=l+3),r.co[n]=l}function da(){ic(this)}function Mr(e,t){ic(this),vg(this.cp,e),Qd(this,t)}function fc(e){Mr.call(this,e(40320),e(2187))}function jd(){let e,t;for(xt[0]=new Mr(15120,0),xt[3]=new Mr(21021,1494),xt[6]=new Mr(8064,1236),xt[9]=new Mr(9,0),xt[12]=new Mr(1230,412),xt[15]=new Mr(224,137),e=0;e<18;e+=3)for(t=0;t<2;++t)xt[e+t+1]=new da,sc(xt[e+t],xt[e],xt[e+t+1])}function qd(){Pg||(Pg=!0,It=O(1937880),Ra=O(1538),ga=O(1538),kl=O(11880),mc=[0,1,6,3,4,5,2,7],Q0=O(160,12),j0=O(160,12),K0=[1,1,1,3,12,60,360,2520,20160,181440,1814400,19958400,239500800],b0=[0,2,4,6,1,3,7,5,8,9,10,11])}function hl(e,t,r,n,l){let o=e.edgeo[l];e.edgeo[l]=e.edge[n],e.edge[n]=e.edgeo[r],e.edgeo[r]=e.edge[t],e.edge[t]=o}function bl(e,t){let r,n,l,o,i;for(e.isStd||cc(e),n=0,i=1985229328,o=47768,r=0;r<t;++r)l=e.edge[r]<<2,n*=12-r,l>=32?(n+=o>>l-32&15,o-=4368<<l-32):(n+=i>>l&15,o-=4369,i-=286331152<<l);return n}function uc(e){let t,r=bl(e,4);t=kl[r];let n=t&7;t>>=3,ua(e,n);let l=bl(e,10)%20160;return t*20160+l}function fa(e,t){switch(e.isStd=!1,t){case 0:{ge(e.edge,0,4,1,5),ge(e.edgeo,0,4,1,5);break}case 1:{Fe(e.edge,0,4,1,5),Fe(e.edgeo,0,4,1,5);break}case 2:{ge(e.edge,0,5,1,4),ge(e.edgeo,0,5,1,4);break}case 3:{Fe(e.edge,5,10,6,11),Fe(e.edgeo,5,10,6,11);break}case 4:{ge(e.edge,0,11,3,8),ge(e.edgeo,0,11,3,8);break}case 5:{Fe(e.edge,0,11,3,8),Fe(e.edgeo,0,11,3,8);break}case 6:{ge(e.edge,0,8,3,11),ge(e.edgeo,0,8,3,11);break}case 7:{ge(e.edge,2,7,3,6),ge(e.edgeo,2,7,3,6);break}case 8:{Fe(e.edge,2,7,3,6),Fe(e.edgeo,2,7,3,6);break}case 9:{ge(e.edge,2,6,3,7),ge(e.edgeo,2,6,3,7);break}case 10:{Fe(e.edge,4,8,7,9),Fe(e.edgeo,4,8,7,9);break}case 11:{ge(e.edge,1,9,2,10),ge(e.edgeo,1,9,2,10);break}case 12:{Fe(e.edge,1,9,2,10),Fe(e.edgeo,1,9,2,10);break}case 13:{ge(e.edge,1,10,2,9),ge(e.edgeo,1,10,2,9);break}case 14:{Fe(e.edge,0,4,1,5),Fe(e.edgeo,0,4,1,5),ge(e.edge,9,11),ge(e.edgeo,8,10);break}case 15:{Fe(e.edge,5,10,6,11),Fe(e.edgeo,5,10,6,11),ge(e.edge,1,3),ge(e.edgeo,0,2);break}case 16:{Fe(e.edge,0,11,3,8),Fe(e.edgeo,0,11,3,8),ge(e.edge,5,7),ge(e.edgeo,4,6);break}case 17:{Fe(e.edge,2,7,3,6),Fe(e.edgeo,2,7,3,6),ge(e.edge,8,10),ge(e.edgeo,9,11);break}case 18:{Fe(e.edge,4,8,7,9),Fe(e.edgeo,4,8,7,9),ge(e.edge,0,2),ge(e.edgeo,1,3);break}case 19:Fe(e.edge,1,9,2,10),Fe(e.edgeo,1,9,2,10),ge(e.edge,4,6),ge(e.edgeo,5,7)}}function Sl(e,t){switch(e.isStd=!1,t){case 0:{fa(e,14),fa(e,17);break}case 1:{hl(e,11,5,10,6),hl(e,5,10,6,11),hl(e,1,2,3,0),hl(e,4,9,7,8),hl(e,8,4,9,7),hl(e,0,1,2,3);break}case 2:vt(e,4,5),vt(e,5,4),vt(e,11,8),vt(e,8,11),vt(e,7,6),vt(e,6,7),vt(e,9,10),vt(e,10,9),vt(e,1,1),vt(e,0,0),vt(e,3,3),vt(e,2,2)}}function ua(e,t){for(;t>=2;)t-=2,Sl(e,1),Sl(e,2);t!==0&&Sl(e,0)}function Po(e,t){let r,n,l,o,i,a;for(i=1985229328,a=47768,l=0,r=0;r<11;++r)if(n=K0[11-r],o=~~(t/n),t=t%n,l^=o,o<<=2,o>=32){o=o-32,e.edge[r]=a>>o&15;let s=(1<<o)-1;a=(a&s)+(a>>4&~s)}else{e.edge[r]=i>>o&15;let s=(1<<o)-1;i=(i&s)+(i>>>4&~s)+(a<<28),a=a>>4}for((l&1)===0?e.edge[11]=i:(e.edge[11]=e.edge[10],e.edge[10]=i),r=0;r<12;++r)e.edgeo[r]=r;e.isStd=!0}function Mg(e,t){let r;for(r=0;r<12;++r)e.edge[r]=t.edge[r],e.edgeo[r]=t.edgeo[r];e.isStd=t.isStd}function gc(e,t){let r,n,l,o;for(e.temp===null&&(e.temp=O(12)),r=0;r<12;++r)e.temp[r]=r,e.edge[r]=t.ep[b0[r]+12]%12;for(n=1,r=0;r<12;++r)for(;e.edge[r]!==r;)o=e.edge[r],e.edge[r]=e.edge[o],e.edge[o]=o,l=e.temp[r],e.temp[r]=e.temp[o],e.temp[o]=l,n^=1;for(r=0;r<12;++r)e.edge[r]=e.temp[t.ep[b0[r]]%12];return n}function cc(e){let t;for(e.temp===null&&(e.temp=O(12)),t=0;t<12;++t)e.temp[e.edgeo[t]]=t;for(t=0;t<12;++t)e.edge[t]=e.temp[e.edge[t]],e.edgeo[t]=t;e.isStd=!0}function Fe(e,t,r,n,l){let o;o=e[t],e[t]=e[n],e[n]=o,o=e[r],e[r]=e[l],e[l]=o}function vt(e,t,r){let n=e.edge[t];e.edge[t]=e.edgeo[r],e.edgeo[r]=n}function mr(){this.edge=O(12),this.edgeo=O(12)}function Vd(){let e,t,r,n,l,o,i,a,s,f,u,g,c,p,L,m,d,F,D,S,x,U,P=new mr,Z=new mr,C=new mr;for(Fa(It),a=0,Zi=1,S0(It,0,0);Zi!==31006080&&(L=a>9,i=a%3,o=(a+1)%3,f=L?3:i,e=L?i:3,!(a>=9));){for(g=0;g<31006080;g+=16)if(U=It[~~g>>4],!(!L&&U===-1)){for(u=g,s=g+16;u<s;++u,U>>=2)if((U&3)===f){for(D=~~(u/20160),t=Ra[D],n=u%20160,Po(P,t*20160+n),d=0;d<17;++d)if(r=wl(P.edge,d<<3,4),S=kl[r],x=S&7,S>>=3,l=wl(P.edge,d<<3|x,10)%20160,c=S*20160+l,Co(It,c)===e){if(S0(It,L?u:c,o),++Zi,L)break;if(F=ga[S],F!==1)for(Mg(Z,P),fa(Z,d),ua(Z,x),m=1;(F=~~F>>1&65535)!==0;++m)(F&1)===1&&(Mg(C,Z),ua(C,m),p=S*20160+bl(C,10)%20160,Co(It,p)===e&&(S0(It,p,o),++Zi))}}}++a}}function Co(e,t){return e[t>>4]>>((t&15)<<1)&3}function wl(e,t,r){let n,l,o,i,a,s=j0[t],f=Q0[t];for(l=0,a=1985229328,i=47768,n=0;n<r;++n)o=s[e[f[n]]]<<2,l*=12-n,o>=32?(l+=i>>o-32&15,i-=4368<<o-32):(l+=a>>o&15,i-=4369,a-=286331152<<o);return l}function pc(e){let t,r,n,l,o,i,a,s,f,u,g,c=new mr;if(i=0,o=Co(It,e),o===3)return 10;for(;e!==0;)for(o===0?o=2:--o,f=~~(e/20160),t=Ra[f],n=e%20160,Po(c,t*20160+n),s=0;s<17;++s)if(r=wl(c.edge,s<<3,4),u=kl[r],g=u&7,u>>=3,l=wl(c.edge,s<<3|g,10)%20160,a=u*20160+l,Co(It,a)===o){++i,e=a;break}return i}function Hd(e,t){let r=Co(It,e);return r===3?10:(1227133513<<r>>t&3)+t-1}function Xd(){let e,t,r,n=new mr;for(t=0;t<20;++t)for(r=0;r<8;++r){for(Po(n,0),fa(n,t),ua(n,r),e=0;e<12;++e)Q0[t<<3|r][e]=n.edge[e];for(cc(n),e=0;e<12;++e)j0[t<<3|r][e]=n.temp[e]}}function Zd(){let e,t,r,n,l=new mr,o=O(1485);for(t=0;t<1485;t++)o[t]=0;for(e=0,t=0;t<11880;++t)if((o[~~t>>>3]&1<<(t&7))===0){for(Po(l,t*K0[8]),n=0;n<8;++n)r=bl(l,4),r===t&&(ga[e]=(ga[e]|1<<n)&65535),o[~~r>>3]=o[~~r>>3]|1<<(r&7),kl[r]=e<<3|mc[n],Sl(l,0),n%2===1&&(Sl(l,1),Sl(l,2));Ra[e++]=t}}function S0(e,t,r){e[t>>4]^=(3^r)<<((t&15)<<1)}function Jd(){Ig||(Ig=!0)}function Yd(e){let t,r,n;for(t=0,n=!1,r=0;r<12;++r)t|=1<<e.ep[r],n=n!==e.ep[r]>=12;return t&=~~t>>12,t===0&&!n}function $d(e,t){let r;for(r=0;r<24;++r)e.ep[r]=t.ep[r]}function eR(e,t){let r=t%3;switch(t=~~(t/3),t){case 0:{h(e.ep,0,1,2,3,r),h(e.ep,12,13,14,15,r);break}case 1:{h(e.ep,11,15,10,19,r),h(e.ep,23,3,22,7,r);break}case 2:{h(e.ep,0,11,6,8,r),h(e.ep,12,23,18,20,r);break}case 3:{h(e.ep,4,5,6,7,r),h(e.ep,16,17,18,19,r);break}case 4:{h(e.ep,1,20,5,21,r),h(e.ep,13,8,17,9,r);break}case 5:{h(e.ep,2,9,4,10,r),h(e.ep,14,21,16,22,r);break}case 6:{h(e.ep,0,1,2,3,r),h(e.ep,12,13,14,15,r),h(e.ep,9,22,11,20,r);break}case 7:{h(e.ep,11,15,10,19,r),h(e.ep,23,3,22,7,r),h(e.ep,2,16,6,12,r);break}case 8:{h(e.ep,0,11,6,8,r),h(e.ep,12,23,18,20,r),h(e.ep,3,19,5,13,r);break}case 9:{h(e.ep,4,5,6,7,r),h(e.ep,16,17,18,19,r),h(e.ep,8,23,10,21,r);break}case 10:{h(e.ep,1,20,5,21,r),h(e.ep,13,8,17,9,r),h(e.ep,14,0,18,4,r);break}case 11:h(e.ep,2,9,4,10,r),h(e.ep,14,21,16,22,r),h(e.ep,7,15,1,17,r)}}function q0(){let e;for(this.ep=O(24),e=0;e<24;++e)this.ep[e]=e}function Lc(e){let t,r,n;for(q0.call(this),t=0;t<23;++t)n=t+e(24-t),n!==t&&(r=this.ep[t],this.ep[t]=this.ep[n],this.ep[n]=r)}function tR(){Og||(Og=!0,w0=[35,1,34,2,4,6,22,5,19])}function Bc(e){e.moveBuffer=O(60)}function rR(e,t){return e.value-t.value}function El(e,t){let r;for($d(e.edge,t.edge),Td(e.center,t.center),ac(e.corner,t.corner),e.value=t.value,e.add1=t.add1,e.length1=t.length1,e.length2=t.length2,e.length3=t.length3,e.sym=t.sym,r=0;r<60;++r)e.moveBuffer[r]=t.moveBuffer[r];e.moveLength=t.moveLength,e.edgeAvail=t.edgeAvail,e.centerAvail=t.centerAvail,e.cornerAvail=t.cornerAvail}function Or(e){for(;e.centerAvail<e.moveLength;)Gd(e.center,e.moveBuffer[e.centerAvail++]);return e.center}function dc(e){for(;e.cornerAvail<e.moveLength;)Kd(e.corner,e.moveBuffer[e.cornerAvail++]%18);return e.corner}function No(e){for(;e.edgeAvail<e.moveLength;)eR(e.edge,e.moveBuffer[e.edgeAvail++]);return e.edge}function nR(e){let t,r,n,l,o,i,a=new Array(e.moveLength-(e.add1?2:0));for(r=0,t=0;t<e.length1;++t)a[r++]=e.moveBuffer[t];for(i=e.sym,t=e.length1+(e.add1?2:0);t<e.moveLength;++t)Mt[i][e.moveBuffer[t]]>=27?(a[r++]=Mt[i][e.moveBuffer[t]]-9,l=w0[Mt[i][e.moveBuffer[t]]-27],i=yl[i][l]):a[r++]=Mt[i][e.moveBuffer[t]];let s=yl[Al[i]][Ed(Or(e))];for(o="",i=s,t=r-1;t>=0;--t)n=a[t],n=~~(n/3)*3+(2-n%3),Mt[i][n]>=27?(o=\`\${o}\${E0[Mt[i][n]-9]} \`,l=w0[Mt[i][n]-27],i=yl[i][l]):o=\`\${o}\${E0[Mt[i][n]]} \`;return o}function Dn(e,t){e.moveBuffer[e.moveLength++]=t}function ca(){Bc(this),this.edge=new q0,this.center=new W0,this.corner=new da}function ha(e){ca.call(this),El(this,e)}function Rc(e){Bc(this),this.edge=new Lc(e),this.center=new oc(e),this.corner=new fc(e)}function lR(e,t){return t.value-e.value}function pa(e,t){return lR(e,t)}function hc(){}function oR(){if(Tg)return;Tg=!0;let e,t;for(E0=["U ","U2 ","U' ","R ","R2 ","R' ","F ","F2 ","F' ","D ","D2 ","D' ","L ","L2 ","L' ","B ","B2 ","B' ","Uw ","Uw2","Uw'","Rw ","Rw2","Rw'","Fw ","Fw2","Fw'","Dw ","Dw2","Dw'","Lw ","Lw2","Lw'","Bw ","Bw2","Bw'"],An=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,21,22,23,25,28,30,31,32,34,36],bo=[0,1,2,4,6,7,8,9,10,11,13,15,16,17,19,22,25,28,31,34,36],Gg=O(37),Wg=O(37),Fl=O(37,36),ea=O(29,28),ta=O(21,20),v0=O(36),ko=O(28),vl=O(20),e=0;e<29;++e)Gg[An[e]]=e;for(e=0;e<21;++e)Wg[bo[e]]=e;for(e=0;e<36;++e){for(t=0;t<36;++t)Fl[e][t]=~~(e/3)===~~(t/3)||~~(e/3)%3===~~(t/3)%3&&e>t;Fl[36][e]=!1}for(e=0;e<29;++e)for(t=0;t<28;++t)ea[e][t]=Fl[An[e]][An[t]];for(e=0;e<21;++e)for(t=0;t<20;++t)ta[e][t]=Fl[bo[e]][bo[t]];for(e=0;e<36;++e)for(v0[e]=36,t=e;t<36;++t)if(!Fl[e][t]){v0[e]=t-1;break}for(e=0;e<28;++e)for(ko[e]=28,t=e;t<28;++t)if(!ea[e][t]){ko[e]=t-1;break}for(e=0;e<20;++e)for(vl[e]=20,t=e;t<20;++t)if(!ta[e][t]){vl[e]=t-1;break}}function iR(e){let t,r,n,l,o,i,a,s,f,u,g,c;e.solution="";let p=Ji(new $i(Or(e.c),0)),L=Ji(new $i(Or(e.c),1)),m=Ji(new $i(Or(e.c),2)),d=Ot[~~p>>6],F=Ot[~~L>>6],D=Ot[~~m>>6];for(e.p1SolsCnt=0,e.arr2idx=0,LR(e.p1sols.heap),e.length1=(d<F?d:F)<D?d<F?d:F:D;e.length1<100&&!(D<=e.length1&&ra(e,~~m>>>6,m&63,e.length1,-1,0)||d<=e.length1&&ra(e,~~p>>>6,p&63,e.length1,-1,0)||F<=e.length1&&ra(e,~~L>>>6,L&63,e.length1,-1,0));++e.length1);let S=xR(e.p1sols,z0(bR,Gr([Rd,k0,_0]),Hg,0,0));S.sort(function(P,Z){return P.value-Z.value}),t=9;do{e:for(s=S[0].value;s<100;++s)for(i=0;i<S.length&&!(S[i].value>s);++i)if(!(s-S[i].length1>t)&&(El(e.c1,S[i]),$g(e.ct2,Or(e.c1),ma(No(e.c1).ep)),g=oa(e.ct2),c=ia(e.ct2),e.length1=S[i].length1,e.length2=s-S[i].length1,Fc(e,g,c,e.length2,28,0)))break e;++t}while(s===100);e.arr2.sort(function(P,Z){return P.value-Z.value}),a=0,r=13;do{e:for(f=e.arr2[0].value;f<100;++f)for(i=0;i<Math.min(e.arr2idx,100)&&!(e.arr2[i].value>f);++i)if(!(f-e.arr2[i].length1-e.arr2[i].length2>r)&&(o=gc(e.e12,No(e.arr2[i])),nc(e.ct3,Or(e.arr2[i]),o^ma(dc(e.arr2[i]).cp)),n=I0(e.ct3),l=bl(e.e12,10),u=pc(uc(e.e12)),u<=f-e.arr2[i].length1-e.arr2[i].length2&&Dc(e,l,n,u,f-e.arr2[i].length1-e.arr2[i].length2,20,0))){a=i;break e}++r}while(f===100);let x=new ha(e.arr2[a]);e.length1=x.length1,e.length2=x.length2;let U=f-e.length1-e.length2;for(i=0;i<U;++i)Dn(x,bo[e.move3[i]]);e.solution=nR(x)}function aR(e,t){let r,n;for(El(e.c1,e.c),r=0;r<e.length1;++r)Dn(e.c1,e.move1[r]);switch(P0[t]){case 0:{Dn(e.c1,24),Dn(e.c1,35),e.move1[e.length1]=24,e.move1[e.length1+1]=35,e.add1=!0,t=19;break}case 12869:{Dn(e.c1,18),Dn(e.c1,29),e.move1[e.length1]=18,e.move1[e.length1+1]=29,e.add1=!0,t=34;break}case 735470:e.add1=!1,t=0}$g(e.ct2,Or(e.c1),ma(No(e.c1).ep));let l=oa(e.ct2),o=ia(e.ct2),i=lt[l*70+o];return e.c1.value=i+e.length1,e.c1.length1=e.length1,e.c1.add1=e.add1,e.c1.sym=t,++e.p1SolsCnt,e.p1sols.heap.size<500?n=new ha(e.c1):(n=SR(e.p1sols),n.value>e.c1.value&&El(n,e.c1)),cR(e.p1sols,n),e.p1SolsCnt===1e4}function sR(e){let t;for(El(e.c2,e.c1),t=0;t<e.length2;++t)Dn(e.c2,e.move2[t]);if(!Yd(No(e.c2)))return!1;let r=gc(e.e12,No(e.c2));nc(e.ct3,Or(e.c2),r^ma(dc(e.c2).cp));let n=I0(e.ct3);bl(e.e12,10);let l=pc(uc(e.e12));return e.arr2[e.arr2idx]?El(e.arr2[e.arr2idx],e.c2):e.arr2[e.arr2idx]=new ha(e.c2),e.arr2[e.arr2idx].value=e.length1+e.length2+Math.max(l,Ir[n]),e.arr2[e.arr2idx].length2=e.length2,++e.arr2idx,e.arr2idx===e.arr2.length}function fR(e,t){return yc(),e.c=new Rc(t),iR(e),e.solution}function ra(e,t,r,n,l,o){let i,a,s,f,u,g;if(t===0)return n===0&&aR(e,r);for(i=0;i<27;i+=3)if(!(i===l||i===l-9||i===l-18))for(f=0;f<3;++f){if(s=i+f,a=La[t][Mt[r][s]],u=Ot[~~a>>>6],u>=n){if(u>n)break;continue}if(g=yl[r][a&63],a>>>=6,e.move1[o]=s,ra(e,a,g,n-1,i,o+1))return!0}return!1}function Fc(e,t,r,n,l,o){let i,a,s,f;if(t===0&<[r]===0)return n===0&&sR(e);for(a=0;a<23;++a){if(ea[l][a]){a=ko[a];continue}if(i=aa[t][a],f=sa[r][a],s=lt[i*70+f],s>=n){s>n&&(a=ko[a]);continue}if(e.move2[o]=An[a],Fc(e,i,f,n-1,a,o+1))return!0}return!1}function Dc(e,t,r,n,l,o,i){let a,s,f,u,g,c,p,L,m;if(l===0)return t===0&&r===0;for(Po(e.tempe[i],t),g=0;g<17;++g){if(ta[o][g]){g=vl[g];continue}if(f=Eo[r][g],c=Ir[f],c>=l){c>l&&g<14&&(g=vl[g]);continue}if(u=wl(e.tempe[i].edge,g<<3,10),a=~~(u/20160),L=kl[a],m=L&7,L>>=3,s=wl(e.tempe[i].edge,g<<3|m,10)%20160,p=Hd(L*20160+s,n),p>=l){p>l&&g<14&&(g=vl[g]);continue}if(Dc(e,u,f,p,l-1,g,i+1))return e.move3[i]=g,!0}return!1}function Ac(){let e;for(this.p1sols=new wc(new hc),this.move1=O(15),this.move2=O(20),this.move3=O(20),this.c1=new ca,this.c2=new ca,this.ct2=new M0,this.ct3=new O0,this.e12=new mr,this.tempe=O(20),this.arr2=O(100),e=0;e<20;++e)this.tempe[e]=new mr}function yc(){Kg||(kd(),Ul=O(735471),_d(),bd(),Ul=null,wd(),Nd(),Od(),Xd(),Zd(),Vd(),Kg=!0)}function uR(){Qg||(Qg=!0)}function ma(e){let t,r,n,l;for(l=0,t=0,n=e.length;t<n;++t)for(r=t;r<n;++r)e[t]>e[r]&&(l^=1);return l}function h(e,t,r,n,l,o){let i;switch(o){case 0:{i=e[l],e[l]=e[n],e[n]=e[r],e[r]=e[t],e[t]=i;return}case 1:{i=e[t],e[t]=e[n],e[n]=i,i=e[r],e[r]=e[l],e[l]=i;return}case 2:{i=e[t],e[t]=e[r],e[r]=e[n],e[n]=e[l],e[l]=i;return}}}function Sc(){}function vc(e,t,r,n){let l=new Sc;return l.typeName=e+t,Uc(r!==0?-r:0)&&bc(r!==0?-r:0,l),l.modifiers=4,l.superclass=V0,l.componentType=n,l}function xc(e,t,r,n){let l=new Sc;return l.typeName=e+t,Uc(r)&&bc(r,l),l.superclass=n,l}function gR(e){let t=_o[e.seedId];return e=null,t}function Uc(e){return typeof e=="number"&&e>0}function bc(e,t){let r;if(t.seedId=e,e===2)r=String.prototype;else if(e>0){let n=gR(t);if(n)r=n.prototype;else{n=_o[e]=function(){},n.___clazz$=t;return}}else return;r.___clazz$=t}function cR(e,t){if(yR(e,t))return!0}function pR(e){e.array=z0(Ec,Gr([k0,_0]),qg,0,0)}function mR(e,t){return na(e.array,e.size++,t),!0}function LR(e){e.array=z0(Ec,Gr([k0,_0]),qg,0,0),e.size=0}function Tr(e,t){return e.array[t]}function BR(e,t){let r=e.array[t];return hR(e.array,t,1),--e.size,r}function xl(e,t,r){let n=e.array[t];return na(e.array,t,r),n}function dR(e,t){let r;for(t.length<e.size&&(t=Ad(t,e.size)),r=0;r<e.size;++r)na(t,r,e.array[r]);return t.length>e.size&&na(t,e.size,null),t}function RR(){pR(this),this.array.length=500}function hR(e,t,r){e.splice(t,r)}function FR(e,t){let r,n,l,o;for(n=0,r=e.length-1;n<=r;)if(l=n+(~~(r-n)>>1),o=e[l],o<t)n=l+1;else if(o>t)r=l-1;else return l;return-n-1}function Fa(e){DR(e,e.length)}function DR(e,t){let r;for(r=0;r<t;++r)e[r]=-1}function AR(e,t){let r,n,l,o,i=e.heap.size,a=Tr(e.heap,t);for(;t*2+1<i&&(r=(n=2*t+1,l=n+1,o=n,l<i&&pa(Tr(e.heap,l),Tr(e.heap,n))<0&&(o=l),o),!(pa(a,Tr(e.heap,r))<0));)xl(e.heap,t,Tr(e.heap,r)),t=r;xl(e.heap,t,a)}function yR(e,t){let r,n;for(n=e.heap.size,mR(e.heap,t);n>0;){if(r=n,n=~~((n-1)/2),pa(Tr(e.heap,n),t)<=0)return xl(e.heap,r,t),!0;xl(e.heap,r,Tr(e.heap,n))}return xl(e.heap,n,t),!0}function SR(e){if(e.heap.size===0)return null;let t=Tr(e.heap,0);return vR(e),t}function vR(e){let t=BR(e.heap,e.heap.size-1);0<e.heap.size&&(xl(e.heap,0,t),AR(e,0))}function xR(e,t){return dR(e.heap,t)}function wc(e){this.heap=new RR,this.cmp=e}function _c(){jg||(jg=!0,oR(),uR(),Ud(),Cd(),Pd(),qd(),Wd(),Jd(),tR(),kc=new Ac)}function wR(){_c(),yc()}async function ER(){be(),_c();let e=w.fromString(fR(kc,await we()));return(await dl()).concat(e)}var X,_o,Ld,qg,k0,Vg,Bd,dd,Hg,Rd,hd,Fd,_0,Ug,x0,U0,bg,Ot,La,P0,Ul,Ba,Al,Mt,yl,kg,aa,lt,ec,tc,sa,rc,Cg,Eo,lc,Ir,T0,G0,Ng,xt,Pg,b0,Zi,It,K0,Q0,j0,kl,Ra,mc,ga,Ig,Og,w0,Tg,Fl,ea,ta,An,E0,bo,v0,ko,vl,Gg,Wg,Kg,Qg,V0,Ec,UR,bR,kc,jg,zc=y(()=>{"use strict";fe();A0();xg();yt();At();_o={},Ld={},qg=0,k0=30,Vg=21,Bd=22,dd=23,Hg=24,Rd=25,hd=34,Fd=26,_0=40;Rt(1,-1,Ld);X.value=null;Rt(73,1,{},Xg);X.queryId$=0;Ug=!1;bg=!1;Rt(153,1,Gr([Vg]),zo,$i,wo);Ul=null,kg=!1;Rt(154,1,{},M0);X.parity=0;Cg=!1;Rt(155,1,{},O0);X.parity=0;Rt(156,1,{},W0,oc);Ng=!1;Rt(157,1,Gr([Bd]),da,Mr,fc);X.temps=null;Pg=!1;Rt(158,1,Gr([dd]),mr);X.isStd=!0;X.temp=null;Zi=0,Ig=!1;Rt(159,1,{},q0,Lc);Og=!1;Rt(160,1,Gr([Hg,hd]),ca,ha,Rc);X.compareTo$=function(t){return rR(this,t)};X.add1=!1;X.center=null;X.centerAvail=0;X.corner=null;X.cornerAvail=0;X.edge=null;X.edgeAvail=0;X.length1=0;X.length2=0;X.length3=0;X.moveLength=0;X.sym=0;X.value=0;Rt(161,1,{},hc);X.compare=function(t,r){return pa(t,r)};Tg=!1;Rt(163,1,Gr([Fd]),Ac);X.add1=!1;X.arr2idx=0;X.c=null;X.length1=0;X.length2=0;X.p1SolsCnt=0;X.solution="";Kg=!1,Qg=!1;X.val$outerIter=null;X.size=0;Rt(239,1,{},wc);X.cmp=null;X.heap=null;V0=xc("java.lang.","Object",1,null),Ec=vc("[Ljava.lang.","Object;",356,V0),UR=xc("cs.threephase.","FullCube",160,V0),bR=vc("[Lcs.threephase.","FullCube;",381,UR),jg=!1});var Cc={};mt(Cc,{initialize:()=>wR,random444Scramble:()=>ER});var Nc=y(()=>{"use strict";zc()});function Io(e){if(e<2)return e;let t=1;for(let r=2;r<=e;r++)t*=r;return t}function Da(e,t){if(t<0||t>e)return 0;if(t===0||t===e)return 1;let r=1;for(let n=0;n<t;n++)r=r*(e-n)/(n+1)|0;return r}function Vc(e,t,r,n,l=e-t-r-n){return Da(e,t+r)*Da(t+r,t)*Da(n+l,n)}function PR(e){e=e.slice();let t=e.length,r=Io(t-1),n=0;for(;t>1;){t--;let l=e[0];n+=l*r;for(let o=0;o<t;o++){let i=e[o+1];e[o]=i-(i>l)}r/=t}return n}function MR(e){let t=e.length,r=0;for(let n=0;n<t-1;n++)for(let l=n;l<t;l++)e[n]>e[l]&&(r^=1);return r}function l2(e,t){let r=[],n=Io(t-1)/2,l=0;for(let o=0;o<t-1;o++)r[o]=e/n|0,e%=n,n/=t-1-o;r[t-1]=0;for(let o=t-2;o>=0;o--)for(let i=o+1;i<t;i++)r[i]>=r[o]?r[i]++:l^=1;return l===1&&([r[t-2],r[t-1]]=[r[t-1],r[t-2]]),r}function yn(e){return PR(e)>>1}function t2(e,t){let r=[0];for(let n=1;n<e;n++){let l=t(n+1);r[n]=r[l],r[l]=n}return r}function Tc(e,t){let r=t2(e,t);return MR(r)===1&&([r[0],r[1]]=[r[1],r[0]]),r}function IR(e){return e|=0,31-Math.clz32(e^e-1)}function Gc(e,t){e|=0,t|=0;let r=\`\${e} \${t}\`;if(Z0[r])return Z0[r];let n=Da(e,t),l=new Uint32Array(n),o=new Uint32Array(1<<e).fill(-1);for(let i=0,a=(1<<t)-1;i<n;i++){l[i]=a,o[a]=i;let s=a|a-1;a=s+1|(~s&-~s)-1>>IR(a)+1}return Z0[r]=[l,o]}function OR(e){e|=0;let t=0;for(;e!==0;)e&=e-1,t++;return t}function Wc(e){return e&=65535,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,e}function TR(e,t){return Wc(e)|Wc(t)<<1}function Nl(e,t,r,n,l){if(e|=0,t|=0,r|=0,n|=0,l|=0,e!==t+r+n+l)throw new Error("generate_comb4_lookup_tables: invalid parameters");let o=[e,t,r,n,l].join(" ");if(J0[o])return J0[o];let[i,a]=Gc(e,r+l),[s,f]=Gc(e,n+l),u=Vc(e,t,r,n,l),g=new Uint32Array(u),c=new Uint32Array(4**e).fill(-1);for(let p=0,L=0;p<s.length;p++){let m=s[p];for(let d=0;d<i.length;d++){let F=i[d];if(OR(F&m)===l){let D=TR(F,m);g[L]=D,c[D]=L,L++}}}return J0[o]=[g,c]}function tt(e,t){let r=[];for(let n=0;n<t.length;n++)r[n]=e[t[n]];return r}function Pl(e,t,r){let n=[];for(let l=0;l<r.length;l++)n[l]=e[t[r[l]]];return n}function o2(e,t){let r=[];for(let n=0;n<t;n++)r[n]=n;for(let n of e)for(let l=0;l<n.length;l++)r[n[l]]=n[(l+1)%n.length];return r}function Sn(e,t){let r=e.length,n=Array(r).fill(0);for(let i=1;i<r;i++)n[i]=n[i-1]+t[i-1];let l=n[r-1]+t[r-1],o=Array(l);for(let i=0;i<r;i++)t[i]&&(o[n[i]]=n[e[i]]);return o}function i2(e){let t=e.length,r=Array(t);for(let n=0;n<t;n++)r[e[n]]=n;return r}function GR(e,t){for(;e&&t;)[e,t]=[t%e,e];return Math.abs(e+t)}function WR(e,t){return e*t/GR(e,t)}function KR(e){let t=1,r=e.length,n=Array(r).fill(!1),l=-1;for(;l=n.indexOf(!1,l+1),l!==-1;){let o=0,i=l;for(;!n[i];)n[i]=!0,i=e[i],o++;t=WR(t,o)}return t}function JR(e,t){for(let r=0;r<6;r++){if(e===Tt[Wr[r][0]]&&t===Tt[Wr[r][2]])return[r,0];if(e===Tt[Wr[r][2]]&&t===Tt[Wr[r][0]])return[r,1]}throw new Error("unknown corner piece")}function YR(e,t){for(let r=0;r<12;r++)if(e===Tt[Kr[r][0]]&&t===Tt[Kr[r][1]]||t===Tt[Kr[r][0]]&&e===Tt[Kr[r][1]])return r;throw new Error("unknown edge piece")}function a2(e,t){return JR(e[Wr[t][0]],e[Wr[t][2]])}function Ua(e,t){return YR(e[Kr[t][0]],e[Kr[t][1]])}function $R(e,t,r,n){let l=Wr[t],o=Wr[r].map(i=>Tt[i]);n%2!==0&&(o=[o[2],o[3],o[0],o[1]]);for(let i=0;i<4;i++)e[l[i]]=o[i]}function eh(e,t,r){let n=Kr[t],l=Kr[r].map(o=>Tt[o]);for(let o=0;o<2;o++)e[n[o]]=l[o]}function Zc(e){let t=e.map(s=>Tt[s]),n=Array(6).fill().map((s,f)=>a2(t,f)).map(([s,f])=>s+6*f),l=n.concat(n.map(s=>(s+6)%12)),o=Array(12).fill().map((s,f)=>Ua(t,f)),i=Array(12).fill().map((s,f)=>vn.indexOf(e[vn[f]])),a=Array(12).fill().map((s,f)=>_l.indexOf(e[_l[f]]));return{cp:l,ep:o,ap:i,bp:a}}function rh(e){let t=Array(72),r=Tc(5,e);r.push(5);let n=Array(4).fill().map(a=>e(2));n.push(n.reduce((a,s)=>a^s)),n.push(0);for(let a=0;a<6;a++)$R(t,a,r[a],n[a]);let l=Tc(12,e);for(let a=0;a<12;a++)eh(t,a,l[a]);let o=t2(12,e).map(a=>a/3|0),i=t2(12,e).map(a=>4+(a/3|0));for(let a=0;a<12;a++)t[vn[a]]=o[a],t[_l[a]]=i[a];return t}function Yc(e,t=!1){if(t){e=e.map(m=>m.slice());let p=[0,1,2,3,4,5,6,7],L=[[0,3,5,6,4,7,1,2],[7,1,0,6,3,5,4,2],[7,4,2,1,3,0,6,5],[2,4,5,3,6,0,1,7]];L=L.concat(L.map(m=>i2(m)));for(let m=0;m<e.length;m++)if(e[m][0]<4)e[m][0]=p[e[m][0]];else{let d=p[e[m][0]],F=e[m][1];e[m][0]=d,p=tt(F===1?L[d^4]:L[d],p)}}let r=t?"U L F R D BR B BL".split(" "):th,n=["0","","'"];return e.map(([o,i])=>r[o]+n[i]).join(" ")}function Qr(e,t){for(let[r,n]of t)for(let l=0;l<n;l++)e=tt(e,Jc[r]);return e}function $c(e){return e.map(([t,r])=>[t,(3-r)%3]).reverse()}function Sa(e,t=!1){if(e.length===0)return[];let r=[],n;for(let[l,o]of e)n&&n[0]===l?(n[1]+=o,n[1]%=3,n[1]===0&&(r.pop(),n=r.length===0?void 0:r[r.length-1])):r.length>=2&&(n[0]^l)===4&&r[r.length-2][0]===l?(r[r.length-2][1]+=o,r[r.length-2][1]%=3,r[r.length-2][1]===0&&r.splice(r.length-2,1)):(n=[l,o],r.push(n));return t&&\`\${e}\`!=\`\${r}\`&&console.log(\`simplified \${e} to \${r}\`),r}function nh(e){return Yc($c(ih(rh(e),!0)),!0)}function zl(e,t,r,n,l,o){let i=Vc(e,t,r,n,l),a=o.length,[s,f]=Nl(e,t,r,n,l),u=Array(a).fill().map(()=>new Uint32Array(i));for(let g=0;g<i;g++){let c=s[g],p=Array(e);for(let L=0;L<e;L++)p[L]=c>>2*L&3;for(let L=0;L<a;L++){let d=tt(p,o[L]).reduce((F,D,S)=>F|D<<2*S,0);u[L][g]=f[d]}}return u}function ep(e){let t=e[0].length,r=e.length,n=Array(r).fill().map(()=>new Uint32Array(t));for(let l=0;l<t;l++)for(let o=0;o<r;o++)n[o][e[o][l]]=l;return n}function Un(e,t){let r=e[0].length,n=t[0].length,l=e.length,o=Array(l).fill().map(()=>new Uint32Array(r*n));for(let i=0;i<n;i++)for(let a=0;a<r;a++){let s=a+r*i;for(let f=0;f<l;f++)o[f][s]=e[f][a]+r*t[f][i]}return o}function lh(e,t){let r=e.length,n=e[0].length,l=new Uint8Array(n);l[t]=1;let o=!1;for(;!o;){o=!0;for(let a=0;a<n;a++)if(!!l[a])for(let s=0;s<r;s++)l[e[s][a]]||(l[e[s][a]]=1,o=!1)}let i=new Int32Array(n).fill(-1);for(let a=0,s=0;a<n;a++)!l[a]||(i[a]=s,s++);return[e.map(a=>Sn(a,l)),i]}function oh(e,t){let r=e.length,n=e[0].length,l=new Int32Array(n).fill(-1);t.forEach(s=>{l[s]=0});let o=[t];for(let s=0;s<o.length;s++){let f=o[s];for(let u=0;u<r;u++){let g=e[u][f[0]];if(l[g]!==-1)continue;let c=f.map(L=>e[u][L]),p=o.length;o.push(c);for(let L of c){if(l[L]!==-1)throw new Error("quotienting failed");l[L]=p}}}let i=o.length,a=Array(r).fill().map(()=>new Int32Array(i));for(let s=0;s<r;s++)for(let f=0;f<i;f++)a[s][f]=l[e[s][o[f][0]]];return[a,l]}function tp(e,t,r){let n=e[0].length,l=e.length,o=new Int32Array(n).fill(-1);o[t]=r,o[r]=t;let i=!1;for(;!i;){i=!0;for(let a=0;a<n;a++){if(o[a]===-1)continue;let s=o[a];for(let f=0;f<l;f++){let u=f^1,g=e[f][a],c=e[u][e[u][s]];if(o[g]===-1)i=!1,o[g]=c,o[c]=g;else if(o[g]!==c)throw new Error("mirroring failed - is the initial map correct?")}}}return o}function rp(e,t){let r=e[0].length,n=e.length,l=new Int8Array(r).fill(-1);for(let a of t)l[a]=0;let o=0,i=!1;for(;!i;){i=!0;for(let a=0;a<r;a++)if(l[a]===o)for(let s=0;s<n;s++){let f=e[s][a];for(;f!==a;)l[f]===-1&&(i=!1,l[f]=o+1),f=e[s][f]}o++}return l}function ih(e,t=!1){let r=gh(e).next().value,n=Qr(e,r),l=(t?Uh:xh)(n),o=Sa(r.concat(l),!1);return Qr(e,o).join("")!==Oo.join("")&&(console.log("solving failed!"),console.log(e),console.log(r),console.log(n),console.log(l),console.log(Qr(e,o))),o}function sh(e){let[t,r]=Nl(12,6,0,3,3),n=Array(12).fill().map((a,s)=>Ua(e,s)),l=n.indexOf(8)+12*n.indexOf(9)+12**2*n.indexOf(10)+12**3*n.indexOf(11),[o,i]=[vn,_l].map(a=>{let s=a.map(f=>ah[e[f]]);return r[s.reduce((f,u,g)=>f|u<<2*g,0)]});return[l,o,i]}function np(){if(K.phase1_edge)return K.phase1_edge;let e=ep(xn.map(n=>n.ep)),t=Un(e,e),r=Un(t,t);return K.phase1_edge=r}function fh(){return Br.phase1_edge?Br.phase1_edge:Br.phase1_edge=rp(np(),[8+12*9+12**2*10+12**3*11])}function uh(){return K.phase1_centreA?K.phase1_centreA:K.phase1_centreA=zl(12,6,0,3,3,xn.map(e=>e.ap))}function lp(){return K.phase1_centreB?K.phase1_centreB:K.phase1_centreB=zl(12,6,0,3,3,xn.map(e=>e.bp))}function Kc(){if(Br.phase1_centre)return Br.phase1_centre;let[e,t]=Nl(12,6,0,3,3),r=e.filter(n=>{let l=n>>12&3,o=n>>18&3;return l===2&&o===3}).map(n=>t[n]);return Br.phase1_centre=rp(lp(),r)}function*gh(e){let t=[np(),uh(),lp()],r=[fh(),Kc(),Kc()];yield*ch(sh(e),t,r,15)}function*ch(e,t,r,n){let l=e.length,o=0;for(let i=0;i<l;i++)o=Math.max(o,r[i][e[i]]);for(;o<=n;)yield*op(e,t,r,o,-1),o++}function*op(e,t,r,n,l){let o=3,i=8,a=Math.max(r[0][e[0]],r[1][e[1]],r[2][e[2]]);if(!(a>n)){if(n===0){yield[];return}if(!(a===0&&n===1))for(let s=0;s<i;s++){if(s===l||s===l-4)continue;let f=[];f[0]=t[0][s][e[0]],f[1]=t[1][s][e[1]],f[2]=t[2][s][e[2]];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=op(f,t,r,n-1,s);for(;;){let{value:c,done:p}=g.next();if(p)break;yield[[s,u]].concat(c)}f[0]=t[0][s][f[0]],f[1]=t[1][s][f[1]],f[2]=t[2][s][f[2]],u++}}}}function s2(e){let[t,r]=Nl(10,5,3,2,0),n=Array(8).fill().map((c,p)=>Ua(e,p)),l=n.indexOf(5)+8*n.indexOf(6)+8**2*n.indexOf(7),o=Array(5).fill().map((c,p)=>a2(e,p)),i=i2(o.map(([c,p])=>c+5*p).concat(o.map(([c,p])=>c+5*(p^1)))),a=i.slice(0,5).map(c=>c%5),s=i.slice(0,5).map(c=>c/5|0),f=yn(a)*8+(s[0]^s[2])+2*(s[0]^s[3])+4*s[4],[u,g]=[vn,_l].map(c=>{let p=tt(c,mh).map(L=>ph[e[L]]);return r[p.reduce((L,m,d)=>L|m<<2*d,0)]});return sp(),gp(),[u,g,up[f]+40*ap[l]]}function*va(e){yield*hh(s2(e),30)}function ip(){if(K.phase2_centre)return K.phase2_centre;let e=zl(10,5,3,2,0,xn.slice(0,4).map(r=>Sn(r.ap,Qc))),t=zl(10,5,3,2,0,xn.slice(0,4).map(r=>Sn(r.bp,Qc)));return K.phase2_centre=[e,t]}function sp(){if(K.phase2_edge)return K.phase2_edge;let e=ep(xn.slice(0,4).map(n=>n.ep.slice(0,8))),t=Un(e,Un(e,e)),r;return[r,ap]=lh(t,501),K.phase2_edge=r}function fp(){if(K.phase2_corner)return K.phase2_corner;let t=Io(5)/2*8,r=[!0,!0,!0,!0,!0,!1,!0,!0,!0,!0,!0,!1],n=Array(4).fill().map(()=>new Uint32Array(t)),l=xn.slice(0,4).map(o=>i2(Sn(o.cp,r)));for(let o=0;o<t;o++){let i=l2(o>>3,5),a=[0,0,o&1,o>>1&1,o>>2&1];a[1]=a[2]^a[3]^a[4];let s=Array(10);for(let f=0;f<5;f++)s[f]=i[f]+5*a[f],s[f+5]=i[f]+5*(a[f]^1);for(let f=0;f<4;f++){let u=tt(l[f],s),g=u.slice(0,5).map(L=>L%5),c=u.slice(0,5).map(L=>L/5|0),p=(c[0]^c[2])+2*(c[0]^c[3])+4*c[4];n[f][o]=yn(g)*8+p}}return K.phase2_corner=n}function gp(){return K.phase2_corner_compact||([K.phase2_corner_compact,up]=oh(fp(),dh())),K.phase2_corner_compact}function f2(){if(K.phase2_ce)return K.phase2_ce;let e=gp(),t=sp();return K.phase2_ce=Un(e,t)}function Lh(){if(Y0)return Y0;let e=s2(Oo)[2];return Y0=tp(f2(),e,e)}function Bh(){let[e,t]=Nl(10,5,3,2,0);return e.filter(r=>(r>>10&63)===41).map(r=>t[r])}function dh(){let e=fp(),t=e[0].length,r=Array(t).fill(!1);r[0]=!0;let n=!1;for(;!n;){n=!0;for(let l=0;l<t;l++)r[l]&&(r[e[0][l]]||(n=!1,r[e[0][l]]=!0),r[e[1][l]]||(n=!1,r[e[1][l]]=!0))}return r.map((l,o)=>o).filter(l=>r[l])}function Rh(){if(Br.phase2_ace)return Br.phase2_ace;let[e,t]=ip(),r=f2(),n=2520,l=40*336,o=n*l,i=s2(Oo)[2],a=9,s=new Int8Array(o).fill(a);for(let f of Bh())s[f+n*i]=0;for(let f=0;f<a-1;f++)for(let u=s.indexOf(f);u!==-1;u=s.indexOf(f,u+1)){let g=u%n,c=u/n|0;for(let p=0;p<4;p++){let L=e[p][g],m=r[p][c],d=L+n*m;s[d]===a&&(s[d]=f+1),L=e[p][L],m=r[p][m],d=L+n*m,s[d]===a&&(s[d]=f+1)}}return Br.phase2_ace=s}function*hh(e,t){let[r,n]=ip(),l=f2(),o=Rh(),i=Lh(),[a,s,f]=e,u=i[f],g=Math.max(o[a+2520*f],o[s+2520*u]);for(;g<=t;)yield*cp(a,s,f,r,n,l,o,i,g,-1),g++}function*cp(e,t,r,n,l,o,i,a,s,f){let u=Math.max(i[e+2520*r],i[t+2520*a[r]]);if(!(u>s)){if(s===0){yield[];return}else if(u===0)return;for(let g=0;g<4;g++){if(g===f)continue;let c=e,p=t,L=r;for(let m=1;m<=2;m++){c=n[g][c],p=l[g][p],L=o[g][L];let d=cp(c,p,L,n,l,o,i,a,s-1,g);for(;;){let{value:F,done:D}=d.next();if(D)break;yield[[g,m]].concat(F)}}}}}function ba(e){let[t,r]=Nl(7,3,2,0,2),n=Array(5).fill().map((f,u)=>Ua(e,u)),l=yn(n),o=Array(4).fill().map((f,u)=>a2(e,u)),i=yn(o.map(f=>f[0]))*2+o.find(f=>f[0]===0)[1],[a,s]=[vn,_l].map(f=>{let u=tt(f,Fh).map(g=>e[g]%4);return r[u.reduce((g,c,p)=>g|c<<2*p,0)]});return[a+210*s,i+24*l]}function Ah(){if(K.phase3_2gen_edge)return K.phase3_2gen_edge;let e=Io(5)/2,t=Array(Cl).fill().map(()=>new Uint32Array(e)),r=xa.map(n=>n.ep.slice(0,5));for(let n=0;n<e;n++){let l=l2(n,5);for(let o=0;o<Cl;o++)t[o][n]=yn(tt(l,r[o]))}return K.phase3_2gen_edge=t}function yh(){if(K.phase3_2gen_corner)return K.phase3_2gen_corner;let t=Io(4)/2*2,r=[!0,!0,!0,!0,!1,!1,!0,!0,!0,!0,!1,!1],n=Array(Cl).fill().map(()=>new Uint32Array(t)),l=xa.map(o=>Sn(o.cp,r).slice(0,4));for(let o=0;o<t;o+=2){let i=l2(o>>1,4),a=i.concat(i.map(s=>s+4));for(let s=0;s<Cl;s++){let f=tt(a,l[s]),u=f.map(c=>c%4),g=f.find(c=>c%4===0)>>2;n[s][o]=yn(u)*2+g,n[s][o+1]=yn(u)*2+(g^1)}}return K.phase3_2gen_corner=n}function wa(){return K.phase3_2gen_corneredge?K.phase3_2gen_corneredge:K.phase3_2gen_corneredge=Un(yh(),Ah())}function u2(){if(K.phase3_2gen_centre)return K.phase3_2gen_centre;let e=zl(7,3,2,0,2,xa.map(r=>Sn(r.ap,jc))),t=zl(7,3,2,0,2,xa.map(r=>Sn(r.bp,jc)));return K.phase3_2gen_centreA=e,K.phase3_2gen_centreB=t,K.phase3_2gen_centre=Un(e,t)}function mp(){if($0)return $0;let e=u2(),t=K.phase3_2gen_centreA,r=wa(),n=t[0].length,l=r[0].length,o=n*l,i=25,a=dr.map(c=>c.length),s=new Int8Array(o).fill(i),f=ba(Oo);s[f[0]%n+n*f[1]]=0;let u=0,g=!1;for(;!g&&u<i-1;){g=!0;let c=Array(Cl).fill().map((F,D)=>D).filter(F=>a[F]+u<i);c.sort((F,D)=>a[F]-a[D]);let p=tt(a,c),L=tt(t,c),m=tt(r,c),d=c.length;for(let F=s.indexOf(u);F!==-1;F=s.indexOf(u,F+1)){let D=F%n,S=F/n|0;for(let x=0;x<d;x++){let U=p[x],P=L[x][D],Z=m[x][S],C=P+n*Z;s[C]>u+U&&(g=!1,s[C]=u+U)}}u++}return $0=s}function Lp(){if(e2)return e2;let e=wa().slice(0,2),t=ba(Oo);return e2=tp(e,t[1],t[1])}function r2(e,t=ba(e)){let[r,n]=t,l=r%210,o=Math.floor(r/210),i=u2(),a=K.phase3_2gen_centreA,s=K.phase3_2gen_centreB,f=wa(),u=mp(),g=Lp(),c=0;for(;;){let p=g2(l,o,n,a,s,f,u,g,c);for(let L of p)return L.map(m=>dr[m]).flat();c++}}function qc(e,t=ba(e)){let[r,n]=t,l=r%210,o=Math.floor(r/210),i=u2(),a=K.phase3_2gen_centreA,s=K.phase3_2gen_centreB,f=wa(),u=mp(),g=Lp(),c=r2(e).length,p=1/0,L;for(let m=c;m<=c+0;m++){let d=g2(l,o,n,a,s,f,u,g,m);for(let F of d){let D=F.map(U=>dr[U]).flat(),S=Sa(D),x=n2(S);x<p&&(p=x,L=S)}}return L}function Sh(e){return(e-1)*(e-2)/2}function n2(e){let t=Yc(e,!0).replace(/'/g,"").split(" ");return e.length+vh(t).map(Sh).reduce((r,n)=>r+n,0)}function vh(e){if(e.length<3)return[];let t=e.length,r=[];for(let o=0;o<t-2;o++)r[o]=e[o]===e[o+2];r.push(!1);let n=-1,l=[];for(;n<t-2&&(n=r.indexOf(!0,n+1),n!==-1);){let o=r.indexOf(!1,n+1);l.push(o-n),n=o}return l}function*g2(e,t,r,n,l,o,i,a,s,f=-1){let u=i[e+210*r],g=i[t+210*a[r]],c=Math.max(u,g);if(!(c>s)){if(s===0){yield[];return}if(c!==0)for(let p=0;p<Cl;p++){if(p===f&&Dh[p]<=3)continue;let L=n[p][e],m=l[p][t],d=o[p][r],F=s-dr[p].length;if(F<0)continue;let D=g2(L,m,d,n,l,o,i,a,F,p);for(;;){let{value:S,done:x}=D.next();if(x)break;yield[p].concat(S)}}}}function xh(e,t=200,r=24){let n=[],l=va(e),o=tt(e,Zt).map(s=>s^1),i=va(o),a=Array(1e3);for(let s=0;s<t;s++){{let{value:f,done:u}=l.next();if(!u){let g=Qr(e,f),c=f.concat(r2(g));if(c.length<=r)return c;c.length<a.length&&(a=c)}}{let{value:f,done:u}=i.next();if(!u){let g=Qr(o,f),c=f.concat(r2(g)).map(([p,L])=>[p^2,L]);if(c.length<=r)return c;c.length<a.length&&(a=c)}}}return a}function Uh(e,t=20,r=30){let n=[],l=va(e),o=tt(e,Zt).map(f=>f^1),i=va(o),a,s=1/0;for(let f=0;f<t;f++){{let{value:u,done:g}=l.next();if(!g){let c=Qr(e,u),p=Sa(u.concat(qc(c))),L=n2(p);if(L<=r)return p;L<s&&(a=p,s=L)}}{let{value:u,done:g}=i.next();if(!g){let c=Qr(o,u),p=Sa(u.concat(qc(c)));p=p.map(([m,d])=>[m^2,d]);let L=n2(p);if(L<=r)return p;L<s&&(a=p,s=L)}}}return a}async function wh(){return nh(await bh)}var QS,jS,Z0,J0,Oo,Mo,QR,Zt,qS,Aa,Hc,jR,qR,VR,ya,HR,Xc,XR,ZR,Tt,Wr,Kr,vn,_l,Jc,th,xn,K,Br,ah,ph,mh,Qc,ap,up,Y0,Fh,jc,dr,Cl,pp,xa,Dh,$0,e2,bh,Bp=y(()=>{"use strict";yt();[QS,jS]=(()=>{let e=new Int8Array(2048),t=new Int8Array(256*8);for(let l=0;l<256;l++)for(let o=0,i=0;o<8;o++)(l>>>o&1)!==0&&(e[o<<8|l]=i,t[i<<8|l]=o,i++);function r(l){let o=255,i=2520,a=0;for(let s=0;s<6;s++){let f=l[s];a+=e[o|f<<8]*i,o&=~(1<<f),i/=7-s}return a}function n(l,o){let i=255,a=2520,s=0;for(let f=0;f<6;f++){let u=l/a|0;l-=u*a,s^=u&1;let g=t[i|u<<8];o[f]=g,i&=~(1<<g),a/=7-f}return o[6]=t[i|s<<8],o[7]=t[i|(s^1)<<8],o}return[r,n]})();Z0={};J0={};Oo=Array(72).fill().map((e,t)=>t/9|0),Mo=o2([[0,4,8],[1,6,3],[2,5,7],[9,22,35],[45,67,44],[47,68,43],[46,69,39],[50,70,38],[49,71,36]],72),QR=tt(Mo,Mo),Zt=Array(72).fill().map((e,t)=>(t/18|0)*18+(t+9)%18),qS=Array(72).fill().map((e,t)=>(t/36|0)*36+(t+18)%36),Aa=Array(72).fill().map((e,t)=>(t+36)%72),Hc=Pl(Aa,QR,Aa),jR=Pl(Zt,Mo,Zt),qR=Pl(Zt,Hc,Zt),VR=o2([[10,24,30],[11,23,34],[12,19,33],[42,48,64],[41,52,65],[37,51,66]],72),ya=tt(Mo,VR),HR=tt(ya,ya),Xc=Pl(Aa,HR,Aa),XR=Pl(Zt,ya,Zt),ZR=Pl(Zt,Xc,Zt),Tt=Array(72).fill().map((e,t)=>t/9|0),Wr=[[0,45,9,36],[4,67,22,49],[8,44,35,71],[13,58,31,40],[17,53,26,62],[18,63,27,54]],Kr=[[1,46],[3,39],[6,69],[10,37],[33,42],[12,48],[15,60],[24,51],[19,64],[28,55],[30,66],[21,57]],vn=Array(12).fill().map((e,t)=>(t/3|0)*9+[2,5,7][t%3]),_l=vn.map(e=>e+36);Jc=[Mo,Hc,jR,qR,ya,Xc,XR,ZR],th=["U","L","F","R","u","l","f","r"],xn=Jc.map(Zc);K={},Br={},ah=[0,0,2,3,0,0,2,3];ph=[0,1,2,0,0,1,2,0],mh=[0,1,2,3,4,5,7,8,10,11],Qc=[!0,!0,!0,!0,!0,!0,!1,!0,!0,!1,!0,!0];Fh=[0,1,2,3,4,10,11],jc=[!0,!0,!0,!0,!0,!1,!1,!1,!1,!1,!0,!0],dr=[[[0,1]],[[1,1]],[[2,1],[0,1],[3,1],[0,2],[3,2],[2,2]],[[3,2],[1,2],[2,2],[1,1],[2,1],[3,1]],[[6,1],[0,1],[3,1],[0,2],[3,2],[6,2]],[[7,2],[1,2],[2,2],[1,1],[2,1],[7,1]],[[2,1],[0,1],[2,2],[0,1],[2,1],[0,1],[2,2]],[[3,2],[1,1],[3,1],[1,1],[3,2],[1,1],[3,1]],[[2,1],[3,1],[2,2],[1,2],[0,2],[2,1],[3,1],[2,2]],[[3,2],[2,2],[3,1],[0,1],[1,1],[3,2],[2,2],[3,1]],[[6,1],[0,1],[6,2],[0,2],[1,2],[6,1],[0,1],[6,2]],[[7,2],[1,2],[7,1],[1,1],[0,1],[7,2],[1,2],[7,1]],[[2,1],[3,2],[2,2],[3,1],[0,1],[2,2],[1,1],[2,1]],[[3,2],[2,1],[3,1],[2,2],[1,2],[3,1],[0,2],[3,2]],[[6,1],[0,2],[6,2],[7,1],[6,1],[1,2],[7,1],[6,1]],[[7,2],[1,1],[7,1],[6,2],[7,2],[0,1],[6,2],[7,2]],[[2,2],[1,2],[2,2],[3,2],[2,2],[3,2],[0,2],[3,2]],[[6,2],[7,2],[1,2],[0,2],[1,2],[0,2],[6,2],[7,2]]];dr=dr.concat(dr.map(e=>$c(e)));Cl=dr.length,pp=dr.map(e=>Qr(o2([],72),e)),xa=pp.map(Zc),Dh=pp.map(KR);bh=we()});var dp={};mt(dp,{randomFTOScrambleString:()=>wh});var Rp=y(()=>{"use strict";Bp()});async function Fp(){return Eh??(Eh=kh())}async function kh(){return Ht(await Me.fto.kpuzzle(),\`SubgroupSizes 24 12 11 12 12 11 10 9 11 8 10 9 7 8 10 10 6 9 8 5 7 6 5 4 4 8 7 3 6 6 360
|
|
3261
3261
|
|
|
3262
3262
|
Alg T
|
|
3263
3263
|
Alg B
|
|
@@ -3876,9 +3876,9 @@ Alg BR' B U BR' R BR R' U' BR B'
|
|
|
3876
3876
|
Alg F' BL' BR R' BR BL BR' R BR' F
|
|
3877
3877
|
Alg BR L' BL BR' BL' BR' L U BR U'
|
|
3878
3878
|
Alg U BR' U' BR BL' BR BL BR'
|
|
3879
|
-
\`)}var Ph,xp=y(()=>{"use strict";ir();nl();Ph=null});function To(e){if(e<2)return e;let t=1;for(let r=2;r<=e;r++)t*=r;return t}function c2(e,t){if(t<0||t>e)return 0;if(t===0||t===e)return 1;let r=1;for(let n=0;n<t;n++)r=r*(e-n)/(n+1)|0;return r}function Ih(e){e=e.slice();let t=e.length,r=To(t-1),n=0;for(;t>1;){t--;let l=e[0];n+=l*r;for(let o=0;o<t;o++){let i=e[o+1];e[o]=i-(i>l)}r/=t}return n}function Oh(e,t){let r=[],n=To(t-1);for(let l=0;l<t;l++)r[l]=e/n|0,e%=n,n/=t-1-l;for(let l=t-2;l>=0;l--)for(let o=l+1;o<t;o++)r[o]+=+(r[o]>=r[l]);return r}function Up(e){let t=e.length,r=0;for(let n=0;n<t-1;n++)for(let l=n;l<t;l++)e[n]>e[l]&&(r^=1);return r}function Th(e,t){let r=[],n=To(t-1)/2,l=0;for(let o=0;o<t-1;o++)r[o]=e/n|0,e%=n,n/=t-1-o;r[t-1]=0;for(let o=t-2;o>=0;o--)for(let i=o+1;i<t;i++)r[i]>=r[o]?r[i]++:l^=1;return l===1&&([r[t-2],r[t-1]]=[r[t-1],r[t-2]]),r}function bp(e){return Ih(e)>>1}function wp(e){let t=e.length,r=0;for(let i=0;i<t;i++)r+=+(e[i]===1);let n=t-r;if(n===0||r===0||t===1)return 0;let l=c2(t-1,r),o=0;for(let i=0;n>0&&r>0&&t>1;i++)t--,e[i]===0?l=l*--n/t:(o+=l,l=l*r--/t);return o}function Gh(e,t,r){let n=r-t,l=c2(r-1,t),o=[],i=r-1;for(let a=0;a<i;a++)r--,e<l?(o.push(0),l=l*--n/r):(o.push(1),e-=l,l=l*t--/r);return o.push(t),o}function wa(e,t){let r=[];for(let n=0;n<t.length;n++)r[n]=e[t[n]];return r}function Qr(e,t){let r=[];for(let n=0;n<t;n++)r[n]=n;for(let n=0;n<e.length;n++)r[e[n]]=e[(n+1)%e.length];return r}function jr(e,t){let r=Array(t).fill(0);for(let n in e)r[n]=e[n];return r}function Wh(e,t){let r=Array(8).fill(0);for(let n=0;n<8;n++)r[n]=(e[1][n]+t[1][n])%3;return[wa(e[0],t[0]),r]}function Yh(e){let t=["0","","'"];return e.map(([n,l])=>Jh[n]+t[l]).join(" ")}function $h(e){let t=Th(Math.floor(e(To(12))/2),12),r=Array(8);for(let n=0;n<8;n++)r[n]=e(3);return[t,r]}function e3(e){return t3($h(e))}function t3(e){let t=r3(e),r=[kp(),_p()],n=[l3(),o3()],l=[zp(),i3()],o=[a3(),n3()],i=f3(t,r,n),a,s=new Set,f=+new Date;for(let u=0;u<25;u++){let{value:g,done:c}=i.next(),p=e;for(let[S,x]of g)for(let U=0;U<x;U++)p=Wh(p,Oo[S]);if(s.has(p.toString()))continue;s.add(p.toString());let L=bp(p[0].slice(0,8)),m=0;for(let S=0;S<4;S++)m+=p[1][S]*3**S;let d=[L,m],F=a?a.length-g.length-1:999999,A=s3(d,l,o,F);if(A!==void 0&&((a===void 0||a.length>g.length+A.length)&&(a=g.concat(A)),new Date-f>300))break}return a}function r3(e){let t=0;for(let o=0;o<4;o++)t+=e[0].indexOf(o+8)*12**o;let r=0;for(let o=0;o<4;o++)r+=e[1][o+4]*3**o;let n=e[0].map(o=>Math.max(-1,o-8)),l=wp(n.map(o=>+(o>=0)))*2+Up(n.filter(o=>o>=0));return[t,r+81*l]}function Ep(){if(Le.phase1cm)return Le.phase1cm;let e=[];for(let t=0;t<81;t++){e[t]=Array(8);let r=[t%3,Math.floor(t/3)%3,Math.floor(t/9)%3,Math.floor(t/27)];e[t][0]=e[t][1]=e[t][2]=e[t][3]=t;for(let n=0;n<4;n++)r[n]=(r[n]+2)%3,e[t][4+n]=r[0]+r[1]*3+r[2]*9+r[3]*27,r[n]=(r[n]+1)%3}return Le.phase1cm=e}function n3(){if(Le.phase1cp)return Le.phase1cp;let e=Array(81);for(let t=0;t<81;t++){let r=[t%3,Math.floor(t/3)%3,Math.floor(t/9)%3,Math.floor(t/27)];e[t]=(r[0]!==0)+(r[1]!==0)+(r[2]!==0)+(r[3]!==0)}return Le.phase1cp=e}function kp(){if(Le.phase1em)return Le.phase1em;let e=[];for(let r=0;r<12;r++){e[r]=[];for(let n=0;n<8;n++)e[r][n]=Oo[n][0].indexOf(r)}let t=Array(12**4);for(let r=0;r<12**4;r++){t[r]=Array(8);for(let n=0;n<8;n++){let l=0;for(let o=0;o<4;o++)l+=e[Math.floor(r/12**o)%12][n]*12**o;t[r][n]=l}}return Le.phase1em=t}function l3(){return Le.phase1ep?Le.phase1ep:Le.phase1ep=p2(kp(),[8+12*(9+12*(10+12*11))])}function _p(){if(Le.phase1sm)return Le.phase1sm;let e=c2(12,4),t=[];for(let l=0;l<e;l++){t[l]=[];let o=Gh(l,4,12),i=[];for(let a=0,s=0;a<12;a++)o[a]===0?i[a]=-1:i[a]=s++;for(let a=0;a<8;a++){let s=wa(i,Oo[a][0]),f=wa(o,Oo[a][0]),u=Up(s.filter(g=>g>=0));t[l][a]=wp(f)*2+u}}let r=Ep(),n=[];for(let l=0;l<e;l++)for(let o=0;o<81;o++){let i=n[o+81*(2*l)]=[],a=n[o+81*(2*l+1)]=[];for(let s=0;s<8;s++)i[s]=r[o][s]+81*t[l][s],a[s]=r[o][s]+81*(t[l][s]^1)}return Le.phase1sm=n}function o3(){return Le.phase1sp?Le.phase1sp:Le.phase1sp=p2(_p(),[0])}function i3(){if(Le.phase2cm)return Le.phase2cm;let e=Ep(),t=Array(81);for(let r=0;r<81;r++)t[r]=e[r].slice(4,8);return Le.phase2cm=t}function zp(){if(Le.phase2em)return Le.phase2em;let e=8,t=To(e)/2,r=Array(t),n=[0,1,2,3,4,5,6,7];for(let l=0;l<t;l++){r[l]=Array(4);for(let i=0;i<4;i++){let a=wa(n,Oo[i][0].slice(0,8));r[l][i]=bp(a)}if(l===t-1)break;let o=0;do for(let i=e-2;i>=0;i--){if(n[i]>n[i+1])continue;let a=i+1;for(let s=a;s<e;s++)n[s]>n[i]&&(a=s);[n[i],n[a]]=[n[a],n[i]],o^=1;for(let s=0;i+1+s<e-1-s;s++,o^=1)[n[i+1+s],n[e-1-s]]=[n[e-1-s],n[i+1+s]];break}while(o!==0)}return Le.phase2em=r}function a3(){return Le.phase2ep?Le.phase2ep:Le.phase2ep=p2(zp(),[0])}function p2(e,t){let r=e.length,n=e[0].length,l=Array(r).fill(-1),o=t.slice(),i=[],a=0;for(;o.length>0;){i.length=0;for(let s of o)if(l[s]===-1){l[s]=a;for(let f=0;f<n;f++){let u=e[s][f];for(;u!==s;)i.push(u),u=e[u][f]}}[o,i]=[i,o],a+=1}return l}function s3(e,t,r,n){n=n||999999;let l=e.length,o=0;for(let i=0;i<l;i++)o=Math.max(o,r[i][e[i]]);for(;o<=n;){let i=Cp(e,t,r,o,-1);if(i!==void 0)return i;o++}}function Cp(e,t,r,n,l){let o=e.length,i=t[0][0].length,a=0;for(let s=0;s<o;s++)a=Math.max(a,r[s][e[s]]);if(!(a>n)){if(n===0)return[];if(!(a===0&&n===1))for(let s=0;s<i;s++){if(s===l||s<l&&Ea[s]===Ea[l])continue;let f=e.slice();for(let g=0;g<o;g++)f[g]=t[g][e[g]][s];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=Cp(f,t,r,n-1,s);if(g!==void 0)return[[s,u]].concat(g);for(let c=0;c<o;c++)f[c]=t[c][f[c]][s];u++}}}}function*f3(e,t,r){let n=e.length,l=0;for(let o=0;o<n;o++)l=Math.max(l,r[o][e[o]]);for(;;)yield*Np(e,t,r,l,-1),l++}function*Np(e,t,r,n,l){let o=e.length,i=t[0][0].length,a=0;for(let s=0;s<o;s++)a=Math.max(a,r[s][e[s]]);if(!(a>n)){if(n===0){yield[];return}if(!(a===0&&n===1))for(let s=0;s<i;s++){if(s===l||s<l&&Ea[s]===Ea[l])continue;let f=e.slice();for(let g=0;g<o;g++)f[g]=t[g][e[g]][s];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=Np(f,t,r,n-1,s);for(;;){let{value:c,done:p}=g.next();if(p)break;yield[[s,u]].concat(c)}for(let c=0;c<o;c++)f[c]=t[c][f[c]][s];u++}}}}async function Pp(){return new w(Yh(e3(await u3)))}var Kh,Qh,jh,qh,Vh,Hh,Xh,Zh,iv,Oo,Jh,Ea,Le,u3,Mp=y(()=>{"use strict";me();yt();Kh=[Qr([0,1,4],12),jr({0:2},8)],Qh=[Qr([1,2,5],12),jr({1:2},8)],jh=[Qr([2,3,6],12),jr({2:2},8)],qh=[Qr([3,0,7],12),jr({3:2},8)],Vh=[Qr([9,8,4],12),jr({4:2},8)],Hh=[Qr([10,9,5],12),jr({5:2},8)],Xh=[Qr([11,10,6],12),jr({6:2},8)],Zh=[Qr([8,11,7],12),jr({7:2},8)],iv=[Oh(0,12),Array(8).fill(0)],Oo=[Kh,Qh,jh,qh,Vh,Hh,Xh,Zh],Jh=["UL","U","UR","F","L","B","R","D"],Ea=[0,1,0,1,1,0,1,0];Le={};u3=we()});var m2={};mt(m2,{getRandomRediCubeScramble:()=>Pp,sgsDataFTO:()=>vp});var L2=y(()=>{"use strict";xp();Mp()});function Op(e){if(e<2)return e;let t=1;for(let r=2;r<=e;r++)t*=r;return t}function _a(e,t){if(t<0||t>e)return 0;if(t===0||t===e)return 1;let r=1;for(let n=0;n<t;n++)r=r*(e-n)/(n+1)|0;return r}function g3(e){e=e.slice();let t=e.length,r=Op(t-1),n=0;for(;t>1;){t--;let l=e[0];n+=l*r;for(let o=0;o<t;o++){let i=e[o+1];e[o]=i-(i>l)}r/=t}return n}function c3(e){let t=e.length,r=0;for(let n=0;n<t-1;n++)for(let l=n;l<t;l++)e[n]>e[l]&&(r^=1);return r}function p3(e){return g3(e)>>1}function R2(e){let t=e.length,r=0;for(let i=0;i<t;i++)r+=+(e[i]===1);let n=t-r;if(n===0||r===0||t===1)return 0;let l=_a(t-1,r),o=0;for(let i=0;n>0&&r>0&&t>1;i++)t--,e[i]===0?l=l*--n/t:(o+=l,l=l*r--/t);return o}function B3(e,t,r){let n=r-t,l=_a(r-1,t),o=[],i=r-1;for(let a=0;a<i;a++)r--,e<l?(o.push(0),l=l*--n/r):(o.push(1),e-=l,l=l*t--/r);return o.push(t),o}function Zt(e,t){let r=[];for(let n=0;n<t.length;n++)r[n]=e[t[n]];return r}function h2(e,t){let r=Zt(e[0],t[0]),n=[],l=t[0].length;for(let o=0;o<l;o++)n[o]=(e[1][t[0][o]]+t[1][o])%3;return[r,n]}function Pl(e,t){let r=[];for(let n=0;n<t;n++)r[n]=n;for(let n=0;n<e.length;n++)r[e[n]]=e[(n+1)%e.length];return r}function qr(e,t){let r=Array(t).fill(0);for(let n in e)r[n]=e[n];return r}function A3(e){let t=[0];for(let n=1;n<20;n++){let l=e(n+1);t[n]=t[l],t[l]=n}c3(t)===1&&([t[0],t[1]]=[t[1],t[0]]);let r=Array(20).fill(0);for(let n=0;n<19;n++)r[n]=e(3),r[19]+=3-r[n];return r[19]%=3,[t,r]}function y3(e){let t=["0","","2","2'","'"];return e.map(([n,l])=>F3[n]+t[l]).join(" ")}function S3(e,t){for(let[r,n]of t)for(let l=0;l<n;l++)e=h2(e,Un[r]);return e}function v3(e){return C3(A3(e))}function U3(e){let t=e[0];if(t.slice(15,20).every(o=>o<15))return[];if(t.slice(0,5).every(o=>o<15))return[[6,1]];let r=t.map(o=>o>=15),n=0,l;for(;l===void 0;)n++,l=Kp(r,n,-1);return l.push([6,1]),l}function Kp(e,t,r){if(t===0)return e.slice(0,5).some(n=>n)?void 0:[];for(let n=0;n<6;n++)if(n!==r)for(let l=1;l<5;l++){let o=Zt(e,ka[n][l][0]),i=Kp(o,t-1,n);if(i!==void 0)return[[n,l]].concat(i)}}function b3(e){let t=e[0].slice(0,15),r=e[1],n=R2(t.map(i=>+(i>=15))),l=243*n;for(let i=0,a=0;i<15;i++)t[i]<15||(l+=r[i]*Math.pow(3,a),a++);let o=0;for(let i=0;i<5;i++)o+=t.indexOf(15+i)*Math.pow(15,i);return[l,o]}function w3(e){let t=[za(),Ca()],r=[N3(),M3()];return Qp(b3(e),t,r).concat([[6,1]])}function E3(e){let t=[5,6,7,8,14],r=e[0].slice(0,15),n=e[1],l=R2(r.map(a=>+(t.indexOf(a)!==-1))),o=243*l;for(let a=0,s=0;a<15;a++)t.indexOf(r[a])!==-1&&(o+=n[a]*Math.pow(3,s),s++);let i=0;for(let a=0;a<5;a++)i+=r.indexOf(t[a])*Math.pow(15,a);return[o,i]}function k3(e){let t=[za(),Ca()],r=[P3(),I3()];return Qp(E3(e),t,r)}function _3(e){let t=e[0].slice(0,14),r=e[1],n=0,l=[],o=0;for(let i of[0,1,2,3,4,9,10,11,12,13])i!==13&&(n+=r[i]*Math.pow(3,o)),l[o]=t[i]<5?t[i]:t[i]-4,o++;return[n,p3(l)]}function z3(e){return K3(_3(e))}function C3(e){let t=[];for(let r of[U3,w3,k3,z3]){let n=r(e);e=S3(e,n),t=t.concat(n)}return t}function za(){if(le.phase23om)return le.phase23om;let e=_a(15,5),t=[1,3,9,27,81,243],r=Array(_a(15,5)*t[5]);le.phase23om=r;for(let n=0;n<e;n++){let l=B3(n,5,15).concat(Array(5).fill(0)),o=[];for(let i=0;i<6;i++){let a=Zt(l,Un[i][0]).slice(0,15);o[i]=R2(a)}for(let i=0;i<t[5];i++){r[i+243*n]=[];let a=[];for(let s=0,f=0;s<20;s++)l[s]===1?(a[s]=(i/t[f]|0)%3,f++):a[s]=99;for(let s=0;s<6;s++){let f=Un[s],u=[];for(let p=0;p<15;p++)u[p]=a[f[0][p]]+f[1][p];let g=u.filter(p=>p<10),c=0;for(let p=0;p<5;p++)c+=g[p]%3*t[p];r[i+243*n][s]=c+243*o[s]}}}return r}function N3(){if(le.phase2op)return le.phase2op;let e=za();return le.phase2op=Ml(e,[243*3002])}function P3(){if(le.phase3op)return le.phase3op;let e=za();return le.phase3op=Ml(e,[243*246])}function Ca(){if(le.phase23pm)return le.phase23pm;let e=[1,15,225,Math.pow(15,3),Math.pow(15,4),Math.pow(15,5)],t=Array(e[5]),r=Array(15);for(let l=0;l<15;l++){r[l]=Array(6);for(let o=0;o<6;o++)r[l][o]=Un[o][0].indexOf(l)}let n=[0,0,0,0,0];for(let l=0;l<e[5];l++){t[l]=Array(6);for(let o=0;o<6;o++){let i=0;for(let a=0;a<5;a++)i+=r[n[a]][o]*e[a];t[l][o]=i}n[0]++;for(let o=0;o<4;o++)n[o]===15&&(n[o]=0,n[o+1]++)}return le.phase23pm=t}function M3(){if(le.phase2pp)return le.phase2pp;let e=Ca();return le.phase2pp=Ml(e,[213090])}function I3(){if(le.phase3pp)return le.phase3pp;let e=Ca();return le.phase3pp=Ml(e,[737420])}function F2(){if(le.phase4om)return le.phase4om;let e=[1,3,9,27,81,243,729,2187,6561,19683,59049],t=Array(e[9]);for(let r=0;r<e[9];r++){let n=Array(14).fill(0);for(let l=0;l<9;l++){let o=l<5?l:l+4;n[o]=(r/e[l]|0)%3,n[13]-=n[o]}n[13]=(n[13]+999)%3,t[r]=[];for(let l=0;l<3;l++){let o=Un[l],i=[0,1,2,3,4,9,10,11,12,13].map(s=>n[o[0][s]]+o[1][s]),a=0;for(let s=0;s<9;s++)a+=i[s]%3*e[s];t[r][l]=a}}return le.phase4om=t}function D2(){if(le.phase4pm)return le.phase4pm;let e=Op(10)/2,t=10,r=[0,1,2,3,4,-1,-1,-1,-1,5,6,7,8,9],n=[0,1,2,3,4,9,10,11,12,13],l=[Zt(r,Zt(Tp[0],n)),Zt(r,Zt(Gp[0],n)),Zt(r,Zt(Wp[0],n))],o=Array(e),i=Array(10);for(let a=0;a<e;a++){L3(a,i),o[a]=[];for(let s=0;s<3;s++){let f=Zt(i,l[s]);o[a][s]=m3(f)}}return le.phase4pm=o}function O3(){if(le.phase4op)return le.phase4op;let e=F2();return le.phase4op=Ml(e,[0])}function T3(){if(le.phase4pp)return le.phase4pp;let e=D2();return le.phase4pp=Ml(e,[0])}function G3(e){if(le.phase4np_list&&le.phase4np_list.threshold===e)return le.phase4np_list;let t=[F2(),D2()],r=Math.pow(3,9),n=[0];l(e,[0,0],-1);function l(a,s,f){if(n.push(s[0]+r*s[1]),a===0)return;let u=[];for(let g=0;g<3;g++)if(g!==f){u[0]=s[0],u[1]=s[1];for(let c=1;c<5;c++)u[0]=t[0][u[0]][g],u[1]=t[1][u[1]][g],l(a-1,u,g)}}n.sort((a,s)=>a-s);let o=[],i=-1;for(let a of n)a!==i&&o.push(i=a);return o.threshold=e,le.phase4np_list=o}function W3(e,t){let r=0,n=e.length-1;for(;n-r>1;){let l=r+n>>1;t>e[l]?r=l+1:n=l}return t===e[r]||t===e[n]}function Ml(e,t){let r=e.length,n=e[0].length,l=Array(r).fill(-1);for(let a of t)l[a]=0;let o=0,i=!1;for(;!i;){i=!0;for(let a=0;a<r;a++)if(l[a]===o)for(let s=0;s<n;s++){let f=e[a][s];for(;f!==a;)l[f]===-1&&(i=!1,l[f]=o+1),f=e[f][s]}o++}return l}function Qp(e,t,r){let n=e.length,l=0;for(let o=0;o<n;o++)l=Math.max(l,r[o][e[o]]);for(;;){let o=jp(e,t,r,l,-1);if(o!==void 0)return o;l++}}function jp(e,t,r,n,l){let o=e.length,i=t[0][0].length,a=0;for(let s=0;s<o;s++)a=Math.max(a,r[s][e[s]]);if(!(a>n)){if(n===0||a===0)return[];for(let s=0;s<i;s++){if(s===l)continue;let f=e.slice();for(let g=0;g<o;g++)f[g]=t[g][e[g]][s];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=jp(f,t,r,n-1,s);if(g!==void 0)return[[s,u]].concat(g);for(let c=0;c<o;c++)f[c]=t[c][f[c]][s];u++}}}}function K3(e){let t=F2(),r=D2(),n=O3(),l=T3(),o=G3(B2),i=Math.max(n[e[0]],l[e[1]]);for(;;){let a=qp(e,i,-1,t,r,n,l,o);if(a!==void 0)return a;i++}}function qp(e,t,r,n,l,o,i,a){let s=Math.max(o[e[0]],i[e[1]]);if(!(s>t)&&(s<=B2&&!W3(a,e[0]+19683*e[1])&&(s=B2+1),!(s>t))){if(t===0||s===0)return[];for(let f=0;f<3;f++){if(f===r)continue;let u=e.slice();for(let g=1;g<5;g++){u[0]=n[u[0]][f],u[1]=l[u[1]][f];let c=qp(u,t-1,f,n,l,o,i,a);if(c!==void 0)return[[f,g]].concat(c)}}}}async function Vp(){return new w(y3(v3(await Q3)))}var B2,m3,L3,Tp,Gp,Wp,d3,R3,h3,d2,Fv,Un,F3,D3,ka,x3,le,Q3,Hp=y(()=>{"use strict";me();yt();B2=7;[m3,L3]=(()=>{let e=new Int8Array(10240),t=new Int8Array(1024*10);for(let l=0;l<1024;l++)for(let o=0,i=0;o<10;o++)(l>>>o&1)!==0&&(e[o<<10|l]=i,t[i<<10|l]=o,i++);function r(l){let o=1023,i=181440,a=0;for(let s=0;s<8;s++){let f=l[s];a+=e[o|f<<10]*i,o&=~(1<<f),i/=9-s}return a}function n(l,o){let i=1023,a=181440,s=0;for(let f=0;f<8;f++){let u=l/a|0;l-=u*a,s^=u&1;let g=t[i|u<<10];o[f]=g,i&=~(1<<g),a/=9-f}return o[8]=t[i|s<<10],o[9]=t[i|(s^1)<<10],o}return[r,n]})();Tp=[Pl([0,1,2,3,4],20),qr({},20)],Gp=[Pl([4,3,11,12,13],20),qr({4:2,3:1,11:1,12:1,13:1},20)],Wp=[Pl([3,2,9,10,11],20),qr({3:2,2:1,9:1,10:1,11:1},20)],d3=[Pl([2,1,7,8,9],20),qr({2:2,1:1,7:1,8:1,9:1},20)],R3=[Pl([1,0,5,6,7],20),qr({1:2,0:1,5:1,6:1,7:1},20)],h3=[Pl([0,4,13,14,5],20),qr({0:2,4:1,13:1,14:1,5:1},20)],d2=[[15,16,17,18,19,10,9,8,7,6,5,14,13,12,11,0,1,2,3,4],qr({},20)],Fv=[[1,2,3,4,0,7,8,9,10,11,12,13,14,5,6,19,15,16,17,18],qr({},20)],Un=[Tp,Gp,Wp,d3,R3,h3,d2],F3=["U","R","F","L","BL","BR","x2"],D3=h2(d2,d2),ka=[];for(let e=0;e<Un.length;e++){ka[e]=[D3];for(let t=1;t<5;t++)ka[e][t]=h2(ka[e][t-1],Un[e])}{let e=Math.sin(Math.PI/5),t=Math.cos(Math.PI/10),r=Math.cos(Math.PI/5),n=Math.sin(Math.PI/10);x3={U:[0,0],L:[-e-t,r-n],F:[0,2*r],R:[e+t,r-n],BR:[t,-1-n],BL:[-t,-1-n],DBR:[2*e+2*t,0],DB:[3*e+3*t,-r-n],DBL:[4*e+4*t,0],DFL:[3*e+4*t,1+r],DFR:[3*e+2*t,1+r],D:[3*e+3*t,r-n]}}le={};Q3=we();Vp().then(e=>e.log())});var Xp={};mt(Xp,{getRandomKilominxScramble:()=>Vp});var Zp=y(()=>{"use strict";Hp()});function Go(e){if(e<2)return e;let t=1;for(let r=2;r<=e;r++)t*=r;return t}function wn(e){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;return t}function j3(e){e=e.slice();let t=e.length,r=Go(t-1),n=0;for(;t>1;){t--;let l=e[0];n+=l*r;for(let o=0;o<t;o++){let i=e[o+1];e[o]=i-(i>l)}r/=t}return n}function Na(e,t){let r=[],n=Go(t-1)/2,l=0;for(let o=0;o<t-1;o++)r[o]=e/n|0,e%=n,n/=t-1-o;r[t-1]=0;for(let o=t-2;o>=0;o--)for(let i=o+1;i<t;i++)r[i]>=r[o]?r[i]++:l^=1;return l===1&&([r[t-2],r[t-1]]=[r[t-1],r[t-2]]),r}function em(e){return j3(e)>>1}function bn(e,t){let r=[];for(let n=0;n<t.length;n++)r[n]=e[t[n]];return r}function y2(e){let t=[];for(let r=0;r<e.length;r++)t[e[r]]=r;return t}function Wo(e,t){let r=[];for(let n=0;n<t;n++)r[n]=n;for(let n=0;n<e.length;n++)r[e[n]]=e[(n+1)%e.length];return r}function Vr(e,t){return e.length===0?wn(t):e.map(r=>Wo(r,t)).reduce(bn)}function q3(e,t){let r=Array(4);for(let i=0;i<4;i++)r[i]=(e.co[i]+t.co[i])%3;let n=bn(e.mp,t.mp),l=bn(e.wp,t.wp),o=bn(e.cp,t.cp);return{co:r,mp:n,wp:l,cp:o}}function tm(e,t){return e>=4&&t>=4?!0:e<4&&t<4?e===t:(e^t)===4}function rF(e){let t=["0","","'"];return e.map(([n,l])=>tF[n]+t[l]).join(" ")}function nF(e){let t=Array(4);for(let o=0;o<4;o++)t[o]=e(3);let r=Na(e(Go(6)/2),6);for(let o=0,i=0;o<6;o++){let a=o===5?i:e(2);i^=a,r[o]+=a*6,r[o+6]=(r[o]+6)%12}let n=Na(e(Go(12)/2),12),l=Na(e(Go(4)/2),4);return{co:t,mp:r,wp:n,cp:l}}function lF(e){return iF(nF(e))}function oF(e,t=!0,r=!1){let n=rF(lF(e));if(!t)return n;let l=["u","l","r","b"],o=["0","","'"];if(!r){for(let c=0;c<4;c++){let p=e(3);p!==0&&(n+=\` \${l[c]}\${o[p]}\`)}return n.trim()}let i=[],a=[],s=[];for(let c=0;c<4;c++)i[c]=e(3),a[c]=e(3),s[c]=(i[c]-a[c]+3)%3;let f=c=>c.filter(p=>p!==0).length;for(;!(f(a)>=1&&f(s)>=1&&f(a)+f(s)>=4);)for(let c=0;c<4;c++)a[c]=e(3),s[c]=(i[c]-a[c]+3)%3;let u=a.map((c,p)=>c!==0?\`\${l[p]}\${o[c]} \`:"").join(""),g=s.map((c,p)=>c!==0?\` \${l[p]}\${o[c]}\`:"").join("");return u+n+g}function iF(e){let t=sF(e),r=[im(),am()],n=[mF(),LF()],l=gF(t),o,i=new Set,a=performance.now();for(let s=0;s<22;s++){let{value:f,done:u}=l.next(),g=e;for(let[d,F]of f)for(let A=0;A<F;A++)g=q3(g,Il[d]);let c=JSON.stringify(g);if(i.has(c))continue;i.add(c);let p=cF(g),L=o?o.length-f.length-1:999999,m=BF(p,r,n,L).next().value;if(m!==void 0&&((o===void 0||o.length>f.length+m.length)&&(o=f.concat(m)),performance.now()-a>300))break}return o}function aF(e){return e[3^e.indexOf(3)]}function sF(e){let t=bn(y2(e.mp),e.wp),r=(e.co.reduce((n,l)=>n+l)-aF(e.cp)+3)%3;return[0,1,2,3,4,5].map(n=>n+6*t.indexOf(n)+72*t.indexOf(n+6)+864*r)}function*gF(e){let t=0,r=om(),n=pF();for(;;)yield*nm(...e,r,n,t,-1),t++}function*nm(e,t,r,n,l,o,i,a,s,f){let u=En,g=dr[e]+dr[t]+dr[r]+dr[n]+dr[l]+dr[o],c=Math.max(a[e%864+t*864],a[r%864+t*864],a[l%864+t*864],a[e%864+n*864],a[r%864+n*864],a[l%864+n*864],a[e%864+o*864],a[r%864+o*864],a[l%864+o*864],a[e%864+r*864],a[e%864+l*864],a[r%864+l*864],a[t%864+n*864],a[t%864+o*864],a[n%864+o*864],v2[g]);if(!(c>s)){if(s===0){yield[];return}if(!(c===0&&s===1))for(let p=0;p<u;p++){if(p===f||p<f&&tm(p,f))continue;let L=e,m=t,d=r,F=n,A=l,S=o;for(let x=1;x<=2;x++){L=i[L][p],m=i[m][p],d=i[d][p],F=i[F][p],A=i[A][p],S=i[S][p];let U=nm(L,m,d,F,A,S,i,a,s-1,p);for(;;){let{value:P,done:Z}=U.next();if(Z)break;yield[[p,x]].concat(P)}}}}}function cF(e){let t=e.mp,r=em(t.slice(0,6).map(i=>i%6)),n=t.slice(0,5).map((i,a)=>(i>=6)*2**a).reduce((i,a)=>i+a),l=e.co.map((i,a)=>i*3**a).reduce((i,a)=>i+a),o=e.cp.indexOf(0);return[r+360*o,n+32*l]}function lm(){if(Ee.phase1pm)return Ee.phase1pm;let e=Array(6*12*12).fill().map(()=>Array(En).fill(-1));for(let t=0;t<6;t++)for(let r=0;r<12;r++)for(let n=0;n<12;n++){if(r===n)continue;let l=t+6*r+72*n;for(let o=0;o<En;o++){let i=rm[o][t],a=S2[o][r],s=S2[o][n];i<6?e[l][o]=i+6*a+72*s:e[l][o]=i-6+6*s+72*a}}return Ee.phase1pm=e}function om(){if(Ee.phase1pcm)return Ee.phase1pcm;let e=lm(),t=Array(e.length*3).fill().map(()=>Array(En).fill(-1));for(let r=0;r<e.length;r++)for(let n=0;n<En;n++){let l=e[r][n];t[r][n]=l+6*12*12*A2[n],t[r+6*12*12][n]=l+6*12*12*((A2[n]+1)%3),t[r+2*6*12*12][n]=l+6*12*12*((A2[n]+2)%3)}return Ee.phase1pcm=t}function pF(){if(Ee.phase1p2cp)return Ee.phase1p2cp;let e=lm(),t=om(),r=new Int8Array((6*12*12)**2*3);r.fill(-1);let n=[0,1,2,3,4,5].map(o=>o+6*o+72*(o+6));for(let o=0;o<6;o++)for(let i=0;i<6;i++)o!==i&&(r[n[o]+864*n[i]]=0);let l=0;for(;;){let o=!1;for(let i=0;i<r.length;i++){if(r[i]!==l)continue;let a=i%864,s=Math.floor(i/864);for(let f=0;f<En;f++){let u=a,g=s;for(let c=1;c<=2;c++){u=e[u][f],g=t[g][f];let p=u+864*g;r[p]===-1&&(o=!0,r[p]=l+1)}}}if(!o)break;l++}return Ee.phase1p2cp=r}function im(){if(Ee.phase2pm)return Ee.phase2pm;let e=Array(1440).fill().map(()=>Array(Pa));for(let t=0;t<360;t++){let r=Na(t,6);for(let n=0;n<6;n++)r[n+6]=r[n]+6;for(let n=0;n<Pa;n++){let l=bn(r,Il[n].mp),o=em(l.slice(0,6).map(i=>i%6));for(let i=0;i<4;i++){let a=Il[n].cp[i];e[t+360*a][n]=o+360*i}}}return Ee.phase2pm=e}function am(){if(Ee.phase2om)return Ee.phase2om;let e=Array(32*81).fill().map(()=>Array(Pa));for(let t=0;t<32;t++){let r=[0,1,2,3,4].map(l=>t>>l&1);r[5]=r.reduce((l,o)=>l^o);let n=[];for(let l=0;l<6;l++)n[l]=l+6*r[l],n[l+6]=l+6*(r[l]^1);for(let l=0;l<81;l++){let o=[0,1,2,3].map(i=>Math.floor(l/3**i)%3);for(let i=0;i<Pa;i++){let s=bn(n,Il[i].mp).slice(0,5).map(c=>+(c>=6)),f=0;for(let c=0;c<5;c++)f+=s[c]<<c;let u=o.map((c,p)=>(c+Il[i].co[p])%3),g=0;for(let c=0;c<4;c++)g+=u[c]*3**c;e[t+32*l][i]=f+32*g}}}return Ee.phase2om=e}function mF(){return Ee.phase2pp?Ee.phase2pp:Ee.phase2pp=sm(im(),[0])}function LF(){return Ee.phase2op?Ee.phase2op:Ee.phase2op=sm(am(),[0])}function sm(e,t){let r=e.length,n=e[0].length,l=Array(r).fill(-1),o=t.slice(),i=[],a=0;for(;o.length>0;){i.length=0;for(let s of o)if(l[s]===-1){l[s]=a;for(let f=0;f<n;f++){let u=e[s][f];for(;u!==s;)i.push(u),u=e[u][f]}}[o,i]=[i,o],a+=1}return l}function*BF(e,t,r,n){let l=e.length,o=0;for(let i=0;i<l;i++)o=Math.max(o,r[i][e[i]]);for(;o<=n;)yield*fm(e,t,r,o,-1),o++}function*fm(e,t,r,n,l){let o=e.length,i=t[0][0].length,a=0;for(let s=0;s<o;s++)a=Math.max(a,r[s][e[s]]);if(!(a>n)){if(n===0){yield[];return}if(!(a===0&&n===1))for(let s=0;s<i;s++){if(s===l||s<l&&tm(s,l))continue;let f=e.slice();for(let g=0;g<o;g++)f[g]=t[g][e[g]][s];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=fm(f,t,r,n-1,s);for(;;){let{value:c,done:p}=g.next();if(p)break;yield[[s,u]].concat(c)}for(let c=0;c<o;c++)f[c]=t[c][f[c]][s];u++}}}}async function RF(){return oF(await dF,!1)}var wv,Ev,kv,V3,H3,X3,Z3,J3,Y3,$3,eF,Il,tF,En,Pa,fF,rm,uF,S2,A2,$p,v2,dr,Ee,dF,um=y(()=>{"use strict";yt();[wv,Ev]=(()=>{let e=new Int8Array(49152),t=new Int8Array(4096*12);for(let l=0;l<4096;l++)for(let o=0,i=0;o<12;o++)(l>>>o&1)!==0&&(e[o<<12|l]=i,t[i<<12|l]=o,i++);function r(l){let o=4095,i=19958400,a=0;for(let s=0;s<10;s++){let f=l[s];a+=e[o|f<<12]*i,o&=~(1<<f),i/=11-s}return a}function n(l,o){let i=4095,a=19958400,s=0;for(let f=0;f<10;f++){let u=l/a|0;l-=u*a,s^=u&1;let g=t[i|u<<12];o[f]=g,i&=~(1<<g),a/=11-f}return o[10]=t[i|s<<12],o[11]=t[i|(s^1)<<12],o}return[r,n]})();kv={co:[0,0,0,0],mp:wn(12),wp:wn(12),cp:[0,1,2,3]},V3={co:[2,0,0,0],mp:wn(12),wp:Wo([1,9,11],12),cp:[0,1,2,3]},H3={co:[0,2,0,0],mp:wn(12),wp:Wo([0,7,2],12),cp:[0,1,2,3]},X3={co:[0,0,2,0],mp:wn(12),wp:Wo([3,6,10],12),cp:[0,1,2,3]},Z3={co:[0,0,0,2],mp:wn(12),wp:Wo([4,8,5],12),cp:[0,1,2,3]},J3={co:[2,0,0,0],mp:Vr([[1,9,11],[7,3,5]],12),wp:Vr([[1,9,11],[7,3,5]],12),cp:[0,2,3,1]},Y3={co:[0,2,0,0],mp:Vr([[0,7,2],[6,1,8]],12),wp:Vr([[0,7,2],[6,1,8]],12),cp:[3,1,0,2]},$3={co:[0,0,2,0],mp:Vr([[3,6,10],[9,0,4]],12),wp:Vr([[3,6,10],[9,0,4]],12),cp:[1,3,2,0]},eF={co:[0,0,0,2],mp:Vr([[4,8,5],[10,2,11]],12),wp:Vr([[4,8,5],[10,2,11]],12),cp:[2,0,1,3]},Il=[J3,Y3,$3,eF,V3,H3,X3,Z3],tF=["u","l","r","b","U","L","R","B"],En=8,Pa=4;fF=[],rm=[],uF=[],S2=[];for(let e=0;e<En;e++){let t=Il[e];fF[e]=t.mp,rm[e]=y2(t.mp),uF[e]=t.wp,S2[e]=y2(t.wp)}A2=[0,0,0,0,2,2,2,2],$p=[[14,-1,-1,11,11,10,9,8,8,7,7,6,4,5,5,3,4,4,2,3,4,3,-1,-1,0],[13,-1,-1,11,10,10,9,8,8,7,7,6,4,5,5,3,4,4,2,3,3,1,-1,-1,6]],v2=new Int8Array(55);for(let e=0;e<25;e++)v2[e]=$p[0][e],v2[e+30]=$p[1][e];dr=new Int8Array(6*12*12*3);for(let e=0;e<6;e++)for(let t=0;t<12;t++)for(let r=0;r<12;r++){let n=e+6*t+72*r,l=2;t===e?l++:t===(e+6)%12&&l--,r===(e+6)%12?l++:r===e&&l--,dr[n]=l,dr[n+6*12*12]=dr[n+2*6*12*12]=l+5}Ee={};dF=we()});var gm={};mt(gm,{randomMasterTetraminxScrambleString:()=>RF});var cm=y(()=>{"use strict";um()});function bF(e,t){e.ul=t.ul,e.ur=t.ur,e.dl=t.dl,e.dr=t.dr,e.ml=t.ml}function ym(e,t){var r;t<<=2,t>24?(t=48-t,r=e.ul,e.ul=(~~e.ul>>t|e.ur<<24-t)&16777215,e.ur=(~~e.ur>>t|r<<24-t)&16777215):t>0?(r=e.ul,e.ul=(e.ul<<t|~~e.ur>>24-t)&16777215,e.ur=(e.ur<<t|~~r>>24-t)&16777215):t===0?(r=e.ur,e.ur=e.dl,e.dl=r,e.ml=1-e.ml):t>=-24?(t=-t,r=e.dl,e.dl=(e.dl<<t|~~e.dr>>24-t)&16777215,e.dr=(e.dr<<t|~~r>>24-t)&16777215):t<-24&&(t=48+t,r=e.dl,e.dl=(~~e.dl>>t|e.dr<<24-t)&16777215,e.dr=(~~e.dr>>t|r<<24-t)&16777215)}function wF(e){var t,r,n,l,o;for(n=0,e.arr[0]=Jt(e,0),l=1;l<24;++l)Jt(e,l)!==e.arr[n]&&(e.arr[++n]=Jt(e,l));for(o=0,t=0;t<16;++t)for(r=t+1;r<16;++r)e.arr[t]>e.arr[r]&&(o^=1);return o}function EF(e){var t,r,n,l;return l=e.ur&1118481,l|=~~l>>3,l|=~~l>>6,l=l&15|~~l>>12&48,n=e.ul&1118481,n|=~~n>>3,n|=~~n>>6,n=n&15|~~n>>12&48,r=e.dr&1118481,r|=~~r>>3,r|=~~r>>6,r=r&15|~~r>>12&48,t=e.dl&1118481,t|=~~t>>3,t|=~~t>>6,t=t&15|~~t>>12&48,Ko(wF(e)<<24|n<<18|l<<12|t<<6|r)}function kF(e,t){var r,n;for(r=0;r<8;++r)e.prm[r]=~~(~~Jt(e,r*3+1)>>1<<24)>>24;for(t.cornperm=Vo(e.prm),t.topEdgeFirst=Jt(e,0)===Jt(e,1),r=t.topEdgeFirst?2:0,n=0;n<4;r+=3,++n)e.prm[n]=~~(~~Jt(e,r)>>1<<24)>>24;for(t.botEdgeFirst=Jt(e,12)===Jt(e,13),r=t.botEdgeFirst?14:12;n<8;r+=3,++n)e.prm[n]=~~(~~Jt(e,r)>>1<<24)>>24;t.edgeperm=Vo(e.prm),t.ml=e.ml}function Jt(e,t){var r;return t<6?r=~~e.ul>>(5-t<<2):t<12?r=~~e.ur>>(11-t<<2):t<18?r=~~e.dl>>(17-t<<2):r=~~e.dr>>(23-t<<2),~~((r&15)<<24)>>24}function b2(e,t,r){t<6?(e.ul&=~(15<<(5-t<<2)),e.ul|=r<<(5-t<<2)):t<12?(e.ur&=~(15<<(11-t<<2)),e.ur|=r<<(11-t<<2)):t<18?(e.dl&=~(15<<(17-t<<2)),e.dl|=r<<(17-t<<2)):(e.dr&=~(15<<(23-t<<2)),e.dr|=r<<(23-t<<2))}function z2(){this.arr=[],this.prm=[]}async function _F(){let e=await we();var t,r,n,l,o,i,a,s,f;for(t=new z2,n=Ol[e(3678)],o=19088743<<1|286331153,l=19088743<<1,a=i=8,r=0;r<24;r++)(n>>r&1)===0?(s=e(i)<<2,b2(t,23-r,l>>s&15),f=(1<<s)-1,l=(l&f)+(l>>4&~f),--i):(s=e(a)<<2,b2(t,23-r,o>>s&15),b2(t,22-r,o>>s&15),f=(1<<s)-1,o=(o&f)+(o>>4&~f),--a,++r);return t.ml=e(2),t}function zF(){}function CF(e){var t,r,n,l,o,i;for(bF(e.Search_d,e.Search_c),n=0;n<e.Search_length1;++n)ym(e.Search_d,e.Search_move[n]);for(kF(e.Search_d,e.Search_sq),r=e.Search_sq.edgeperm,t=e.Search_sq.cornperm,o=e.Search_sq.ml,i=Math.max(ve[e.Search_sq.edgeperm<<1|o],ve[e.Search_sq.cornperm<<1|o]),n=i;n<e.Search_maxlen2;++n)if(Ia(e,r,t,e.Search_sq.topEdgeFirst,e.Search_sq.botEdgeFirst,o,n,e.Search_length1,0)){for(l=0;l<n;++l)ym(e.Search_d,e.Search_move[e.Search_length1+l]);return e.Search_sol_string=NF(e,n+e.Search_length1),!0}return!1}function NF(e,t){for(var r="",n=0,l=0,o=t-1;o>=0;o--){var i=e.Search_move[o];i>0?(i=12-i,n=i>6?i-12:i):i<0?(i=12+i,l=i>6?i-12:i):(n===0&&l===0?r+=" / ":r+=\`(\${n}, \${l}) / \`,n=l=0)}return(n!==0||l!==0)&&(r+=\`(\${n}, \${l})\`),r}function Ma(e,t,r,n,l,o){var i,a,s;if(r===0&&n<4)return n===0&&CF(e);if(o!==0&&(s=Oa[t],a=je[s],a<n&&(e.Search_move[l]=0,Ma(e,s,a,n-1,l+1,0))))return!0;if(s=t,o<=0){for(i=0;i+=qo[s],s=~~i>>4,i&=15,!(i>=12||(a=je[s],a>n));)if(a<n&&(e.Search_move[l]=i,Ma(e,s,a,n-1,l+1,1)))return!0}if(s=t,o<=1){for(i=0;i+=jo[s],s=~~i>>4,i&=15,!(i>=6||(a=je[s],a>n));)if(a<n&&(e.Search_move[l]=-i,Ma(e,s,a,n-1,l+1,2)))return!0}return!1}function Ia(e,t,r,n,l,o,i,a,s){var f,u,g,c,p,L,m;if(i===0&&!n&&l||s!==0&&n===l&&(g=Ho[t],u=Ho[r],ve[g<<1|1-o]<i&&ve[u<<1|1-o]<i&&(e.Search_move[a]=0,Ia(e,g,u,n,l,1-o,i-1,a+1,0))))return!0;if(s<=0)for(m=!n,g=m?zn[t]:t,u=m?r:zn[r],c=m?1:2,p=ve[g<<1|o],L=ve[u<<1|o];c<12&&p<=i&&p<=i;){if(p<i&&L<i&&(e.Search_move[a]=c,Ia(e,g,u,m,l,o,i-1,a+1,1)))return!0;m=!m,m?(g=zn[g],p=ve[g<<1|o],c+=1):(u=zn[u],L=ve[u<<1|o],c+=2)}if(s<=1)for(f=!l,g=f?_n[t]:t,u=f?r:_n[r],c=f?1:2,p=ve[g<<1|o],L=ve[u<<1|o];c<(i>3?6:12)&&p<=i&&p<=i;){if(p<i&&L<i&&(e.Search_move[a]=-c,Ia(e,g,u,n,f,o,i-1,a+1,2)))return!0;f=!f,f?(g=_n[g],p=ve[g<<1|o],c+=1):(u=_n[u],L=ve[u<<1|o],c+=2)}return!1}function PF(e,t){var r;for(e.Search_c=t,r=EF(t),e.Search_length1=je[r];e.Search_length1<100&&(e.Search_maxlen2=Math.min(31-e.Search_length1,17),!Ma(e,r,je[r],e.Search_length1,0,-1));++e.Search_length1);return e.Search_sol_string}function xm(){this.Search_move=[],this.Search_d=new z2,this.Search_sq=new bm}function MF(){}function IF(){Sm||(Sm=!0,Qo=[0,3,6,12,15,24,27,30,48,51,54,60,63],Ol=[],je=[],qo=[],jo=[],Oa=[],GF())}function OF(e){var t,r;t=0,r=0;do(e.bottom&2048)===0?(t+=1,e.bottom=e.bottom<<1):(t+=2,e.bottom=e.bottom<<2^12291),r=1-r;while((Cn(e.bottom&63)&1)!==0);return(Cn(e.bottom)&2)===0&&(e.Shape_parity^=r),t}function w2(e){var t;return t=Em(Ol,e.top<<12|e.bottom)<<1|e.Shape_parity,t}function E2(e,t){e.Shape_parity=t&1,e.top=Ol[~~t>>1],e.bottom=e.top&4095,e.top>>=12}function TF(e){var t,r;t=0,r=0;do(e.top&2048)===0?(t+=1,e.top=e.top<<1):(t+=2,e.top=e.top<<2^12291),r=1-r;while((Cn(e.top&63)&1)!==0);return(Cn(e.top)&2)===0&&(e.Shape_parity^=r),t}function Um(){}function Ko(e){var t;return t=Em(Ol,e&16777215)<<1|~~e>>24,t}function GF(){var e,t,r,n,l,o,i,a,s,f,u,g,c,p,L,m;for(e=0,i=0;i<28561;++i)o=Qo[i%13],r=Qo[~~(i/13)%13],g=Qo[~~(~~(i/13)/13)%13],u=Qo[~~(~~(~~(i/13)/13)/13)],c=u<<18|g<<12|r<<6|o,Cn(c)===16&&(Ol[e++]=c);for(f=new Um,i=0;i<7356;++i)E2(f,i),qo[i]=TF(f),qo[i]|=w2(f)<<4,E2(f,i),jo[i]=OF(f),jo[i]|=w2(f)<<4,E2(f,i),m=f.top&63,p=Cn(m),L=Cn(f.bottom&4032),f.Shape_parity^=1&~~(p&L)>>1,f.top=f.top&4032|~~f.bottom>>6&63,f.bottom=f.bottom&63|m<<6,Oa[i]=w2(f);for(i=0;i<7536;++i)je[i]=-1;for(je[Ko(14378715)]=0,je[Ko(31157686)]=0,je[Ko(23967451)]=0,je[Ko(7191990)]=0,n=4,l=0,t=-1;n!==l;)for(l=n,++t,i=0;i<7536;++i)if(je[i]===t){s=0,a=i;do a=qo[a],s+=a&15,a>>=4,je[a]===-1&&(++n,je[a]=t+1);while(s!==12);s=0,a=i;do a=jo[a],s+=a&15,a>>=4,je[a]===-1&&(++n,je[a]=t+1);while(s!==12);a=Oa[i],je[a]===-1&&(++n,je[a]=t+1)}}function WF(){}function KF(){if(!vm){vm=!0,ve=[],Ho=[],zn=[],_n=[],wm=[1,1,2,6,24,120,720,5040],kn=[];for(var e=0;e<12;++e)kn[e]=[];QF()}}function bm(){}function Vo(e){var t,r,n,l;for(r=0,l=1985229328,t=0;t<7;++t)n=e[t]<<2,r=(8-t)*r+(~~l>>n&7),l-=286331152<<n;return r&65535}function QF(){var e,t,r,n,l,o,i,a,s,f,u,g,c;for(l=0;l<12;++l)for(kn[l][0]=1,kn[l][l]=1,s=1;s<l;++s)kn[l][s]=kn[l-1][s-1]+kn[l-1][s];for(g=[],l=0;l<40320;++l)k2(g,l),c=g[2],g[2]=g[4],g[4]=c,c=g[3],g[3]=g[5],g[5]=c,Ho[l]=Vo(g),k2(g,l),c=g[0],g[0]=g[1],g[1]=g[2],g[2]=g[3],g[3]=c,zn[l]=Vo(g),k2(g,l),c=g[4],g[4]=g[5],g[5]=g[6],g[6]=g[7],g[7]=c,_n[l]=Vo(g);for(l=0;l<80640;++l)ve[l]=-1;for(ve[0]=0,t=0,r=1;r<80640;){a=t>=11,n=a?-1:t,e=a?t:-1,++t;e:for(l=0;l<80640;++l)if(ve[l]===n){if(o=~~l>>1,u=l&1,i=Ho[o]<<1|1-u,ve[i]===e&&(++r,ve[a?l:i]=~~(t<<24)>>24,a))continue e;for(i=o,f=0;f<4;++f)if(i=zn[i],ve[i<<1|u]===e&&(++r,ve[a?l:i<<1|u]=~~(t<<24)>>24,a))continue e;for(f=0;f<4;++f)if(i=_n[i],ve[i<<1|u]===e&&(++r,ve[a?l:i<<1|u]=~~(t<<24)>>24,a))continue e}}}function k2(e,t){var r,n,l,o,i;for(i=1985229328,r=0;r<7;++r)l=wm[7-r],o=~~(t/l),t-=o*l,o<<=2,e[r]=~~((~~i>>o&7)<<24)>>24,n=(1<<o)-1,i=(i&n)+(~~i>>4&~n);e[7]=~~(i<<24)>>24}function jF(){}function Cn(e){return e-=~~e>>1&1431655765,e=(~~e>>2&858993459)+(e&858993459),e=(~~e>>4)+e&252645135,e+=~~e>>8,e+=~~e>>16,e&63}function Em(e,t){var r,n,l,o;for(n=0,r=e.length-1;n<=r;)if(l=n+(~~(r-n)>>1),o=e[l],o<t)n=l+1;else if(o>t)r=l-1;else return l;return-n-1}async function ZF(){return(await XF()).scramble_string}var ke,Sm,jo,Ol,je,qo,Oa,Qo,vm,_n,kn,ve,zn,Ho,wm,_2,qF,VF,HF,XF,km=y(()=>{"use strict";yt();ke=z2.prototype=zF.prototype;ke.dl=10062778;ke.dr=14536702;ke.ml=0;ke.ul=70195;ke.ur=4544119;ke=xm.prototype=MF.prototype;ke.Search_c=null;ke.Search_length1=0;ke.Search_maxlen2=0;ke.Search_sol_string=null;Sm=!1;ke=Um.prototype=WF.prototype;ke.bottom=0;ke.Shape_parity=0;ke.top=0;vm=!1;ke=bm.prototype=jF.prototype;ke.botEdgeFirst=!1;ke.cornperm=0;ke.edgeperm=0;ke.ml=0;ke.topEdgeFirst=!1;_2=!1,qF=function(e,t,r){_2||(IF(),KF()),r&&r("Done initializing Square-1."),_2=!0,e?.()},VF=async function(){return _2||qF(),_F()},HF=function(e){var t=new xm;return PF(t,e)},XF=async function(){var e=await VF(),t=HF(e);return{state:e,scramble_string:t}}});var _m={};mt(_m,{getRandomSquare1ScrambleString:()=>ZF});var zm=y(()=>{"use strict";km()});var O2=Symbol("Comlink.proxy"),Km=Symbol("Comlink.endpoint"),Qm=Symbol("Comlink.releaseProxy"),Wa=Symbol("Comlink.thrown"),T2=e=>typeof e=="object"&&e!==null||typeof e=="function",jm={canHandle:e=>T2(e)&&e[O2],serialize(e){let{port1:t,port2:r}=new MessageChannel;return Tl(e,t),[r,[r]]},deserialize(e){return e.start(),Hm(e)}},qm={canHandle:e=>T2(e)&&Wa in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},G2=new Map([["proxy",jm],["throw",qm]]);function Tl(e,t=self){t.addEventListener("message",function r(n){if(!n||!n.data)return;let{id:l,type:o,path:i}=Object.assign({path:[]},n.data),a=(n.data.argumentList||[]).map(Hr),s;try{let f=i.slice(0,-1).reduce((g,c)=>g[c],e),u=i.reduce((g,c)=>g[c],e);switch(o){case"GET":s=u;break;case"SET":f[i.slice(-1)[0]]=Hr(n.data.value),s=!0;break;case"APPLY":s=u.apply(f,a);break;case"CONSTRUCT":{let g=new u(...a);s=Jm(g)}break;case"ENDPOINT":{let{port1:g,port2:c}=new MessageChannel;Tl(e,c),s=Zm(g,[g])}break;case"RELEASE":s=void 0;break;default:return}}catch(f){s={value:f,[Wa]:0}}Promise.resolve(s).catch(f=>({value:f,[Wa]:0})).then(f=>{let[u,g]=Qa(f);t.postMessage(Object.assign(Object.assign({},u),{id:l}),g),o==="RELEASE"&&(t.removeEventListener("message",r),W2(t))})}),t.start&&t.start()}function Vm(e){return e.constructor.name==="MessagePort"}function W2(e){Vm(e)&&e.close()}function Hm(e,t){return Ka(e,[],t)}function Xo(e){if(e)throw new Error("Proxy has been released and is not useable")}function Ka(e,t=[],r=function(){}){let n=!1,l=new Proxy(r,{get(o,i){if(Xo(n),i===Qm)return()=>Nn(e,{type:"RELEASE",path:t.map(a=>a.toString())}).then(()=>{W2(e),n=!0});if(i==="then"){if(t.length===0)return{then:()=>l};let a=Nn(e,{type:"GET",path:t.map(s=>s.toString())}).then(Hr);return a.then.bind(a)}return Ka(e,[...t,i])},set(o,i,a){Xo(n);let[s,f]=Qa(a);return Nn(e,{type:"SET",path:[...t,i].map(u=>u.toString()),value:s},f).then(Hr)},apply(o,i,a){Xo(n);let s=t[t.length-1];if(s===Km)return Nn(e,{type:"ENDPOINT"}).then(Hr);if(s==="bind")return Ka(e,t.slice(0,-1));let[f,u]=I2(a);return Nn(e,{type:"APPLY",path:t.map(g=>g.toString()),argumentList:f},u).then(Hr)},construct(o,i){Xo(n);let[a,s]=I2(i);return Nn(e,{type:"CONSTRUCT",path:t.map(f=>f.toString()),argumentList:a},s).then(Hr)}});return l}function Xm(e){return Array.prototype.concat.apply([],e)}function I2(e){let t=e.map(Qa);return[t.map(r=>r[0]),Xm(t.map(r=>r[1]))]}var K2=new WeakMap;function Zm(e,t){return K2.set(e,t),e}function Jm(e){return Object.assign(e,{[O2]:!0})}function Qa(e){for(let[t,r]of G2)if(r.canHandle(e)){let[n,l]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},l]}return[{type:"RAW",value:e},K2.get(e)||[]]}function Hr(e){switch(e.type){case"HANDLER":return G2.get(e.name).deserialize(e.value);case"RAW":return e.value}}function Nn(e,t,r){return new Promise(n=>{let l=Ym();e.addEventListener("message",function o(i){!i.data||!i.data.id||i.data.id!==l||(e.removeEventListener("message",o),n(i.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:l},t),r)})}function Ym(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function $m(e){let t=new WeakMap;return{postMessage:e.postMessage.bind(e),addEventListener:(r,n)=>{let l=o=>{"handleEvent"in n?n.handleEvent({data:o}):n({data:o})};e.on("message",l),t.set(n,l)},removeEventListener:(r,n)=>{let l=t.get(n);!l||(e.off("message",l),t.delete(n))},nodeWorker:e}}var Q2=$m;var eL=typeof globalThis.Worker>"u"&&typeof globalThis.WorkerNavigator>"u",tL="node:w-orker-_threa-ds",rL=()=>tL.replace(/-/g,"");async function nL(){let{parentPort:e}=await import(rL()).catch();return Q2(e)}function j2(e){eL?(async()=>Tl(e,await nL()))():Tl(e)}He();ir();At();He();ir();yt();At();me();me();var mo=class extends en{constructor(r){super();this.metric=r}traverseAlg(r){let n=0;for(let l of r.childAlgNodes())n+=this.traverseAlgNode(l);return n}traverseGrouping(r){let n=r.alg;return this.traverseAlg(n)*Math.abs(r.amount)}traverseMove(r){return this.metric(r)}traverseCommutator(r){return 2*(this.traverseAlg(r.A)+this.traverseAlg(r.B))}traverseConjugate(r){return 2*this.traverseAlg(r.A)+this.traverseAlg(r.B)}traversePause(r){return 0}traverseNewline(r){return 0}traverseLineComment(r){return 0}};function Fu(e){return"A"<=e&&e<="Z"}function YL(e){let t=e.family;return Fu(t[0])&&t[t.length-1]==="v"||t==="x"||t==="y"||t==="z"||t==="T"?0:1}function $L(e){return 1}function eB(e){let t=e.family;return Fu(t[0])&&t[t.length-1]==="v"||t==="x"||t==="y"||t==="z"||t==="T"?0:Math.abs(e.amount)}var Ks=new mo(YL),Qs=Ks.traverseAlg.bind(Ks),tB=new mo($L),rB=Ks.traverseAlg.bind(tB),hu=new mo(eB),nB=hu.traverseAlg.bind(hu);me();var js=class extends en{traverseAlg(t){let r=0;for(let n of t.childAlgNodes())r+=this.traverseAlgNode(n);return r}traverseGrouping(t){return this.traverseAlg(t.alg)*Math.abs(t.amount)}traverseMove(t){return 1}traverseCommutator(t){return 2*(this.traverseAlg(t.A)+this.traverseAlg(t.B))}traverseConjugate(t){return 2*this.traverseAlg(t.A)+this.traverseAlg(t.B)}traversePause(t){return 1}traverseNewline(t){return 0}traverseLineComment(t){return 0}},Du=new js,lB=Du.traverseAlg.bind(Du);yt();var oB=2,iB=!0,aB=!1;function sB(e,t){let r=[];return t.forEach(function(n){let l=new B(n);if(l.amount!==1)throw new Error("SGS cannot handle def moves with an amount other than 1 yet.");let o=e.identityTransformation();for(let i=1;o=o.applyMove(l),!o.isIdentityTransformation();i++)r.push({move:l.modified({amount:i}),transformation:o})}),r}var _t=class{constructor(t,r,n){this.kpuzzle=t;this.sgs=r;this.searchMoves=sB(this.kpuzzle,n??Object.keys(this.kpuzzle.definition.moves))}async solve(t,r=oB,n){let l=t.experimentalToTransformation();if(!l)throw new Error("distinguishable pieces are not supported in tremble solver yt");let o=null,i=1e6,a=(s,f,u)=>{if(f===0){let g=this.sgsPhaseSolve(s,i);if(!g)return;let c=u.concat(g).experimentalSimplify({cancel:{puzzleSpecificModWrap:"canonical-centered"},puzzleSpecificSimplifyOptions:{quantumMoveOrder:n}}),p=Qs(c);(o===null||p<i)&&(aB&&(console.log(\`New best (\${p} moves): \${c.toString()}\`),console.log(\`Tremble moves are: \${u.toString()}\`)),o=c,i=p);return}for(let g of this.searchMoves)a(s.applyTransformation(g.transformation),f-1,u.concat([g.move]))};for(let s=0;s<=r;s++)a(l,s,new w);if(o===null)throw new Error("SGS search failed.");return o}sgsPhaseSolve(t,r){let n=new Lt,l=t;for(let o of this.sgs.ordering){let i=o.pieceOrdering,a="",s=l.invert();for(let u=0;u<i.length;u++){let g=i[u],c=g.orbitName,p=g.permutationIdx;a+=\` \${s.transformationData[c].permutation[p]} \${s.transformationData[c].orientation[p]}\`}let f=o.lookup[a];if(!f)throw new Error("Missing algorithm in sgs or esgs?");if(n.experimentalPushAlg(f.alg),n.experimentalNumAlgNodes()>=r)return null;if(l=l.applyTransformation(f.transformation),iB)for(let u=0;u<i.length;u++){let g=i[u],c=g.orbitName,p=g.permutationIdx;if(l.transformationData[c].permutation[p]!==p||l.transformationData[c].orientation[p]!==0)throw new Error("bad SGS :-(")}}return n.toAlg()}};async function Ui(e,t){let r=await ar(),n=e.identityTransformation();for(let l of t.ordering){let o=r(Object.values(l.lookup));n=n.applyTransformation(o.transformation)}return n.toKState()}qt();var ft=We(()=>Promise.resolve().then(()=>(ku(),Eu)));var DB=3,_u=null;async function zu(){return _u||(_u=(async()=>{let e=await(await ft).cachedData222();return new _t(await Me["2x2x2"].kpuzzle(),e,"URFLBD".split(""))})())}async function Cu(){await zu()}async function Zs(e){return be(),await(await zu()).solve(e,DB,()=>4)}async function AB(e,t,r,n){let l=await we();await Ru(r.stateData[t].pieces);let o=e.definition.orbits[t],i=r.stateData[t].orientation,a=0;for(let s=0;s<o.numPieces;s++){let f=l(o.numOrientations);i[s]=f,a+=f}n&&"orientationSum"in n&&(i[0]=((i[0]+n.orientationSum-a)%o.numOrientations+o.numOrientations)%o.numOrientations)}async function yB(){let e=await Me["2x2x2"].kpuzzle(),t=new ge(e,JSON.parse(JSON.stringify(e.startState().stateData)));return await AB(e,"CORNERS",t,{orientationSum:0}),t}async function Nu(){return await Zs(await yB())}A0();bi();qt();var H0=We(()=>Promise.resolve().then(()=>(Tc(),Oc)));var MR=[[null,"x","x2","x'","z","z'"],[null,"y","y2","y'"]];async function Gc(){return(await H0).initialize()}async function X0(){return(await H0).random444Scramble()}async function Wc(){return ll(await X0(),MR)}bi();me();yt();function IR(e){switch(e){case 5:return 60;case 6:return 80;default:return 100}}var OR=[["U","D"],["L","R"],["F","B"]],Kc=new Map;function TR(e){let t=Kc.get(e);if(t)return t;let r=[];for(let n of OR){let l=[];r.push(l);for(let o of n){l.push(new _(o)),e>3&&l.push(new _(\`\${o}w\`));for(let i=3;i<=e/2;i++)l.push(new _(\`\${o}w\`,i))}}return Kc.set(e,r),r}async function mr(e){let t=await we(),r=await ar(),n=r,l=TR(e),o=IR(e),i=new Lt,a=0,s=new Set;for(;i.experimentalNumAlgNodes()<o;){let f=t(3);f!==a&&s.clear(),a=f;let u=r(l[a]),g=u.toString();s.has(g)||(s.add(g),i.push(new B(u,n([1,2,-1]))))}return i.toAlg()}var GR=[[null,"3Rw","3Rw2","3Rw'","3Fw","3Fw'"],[null,"3Dw","3Dw2","3Dw'"]];async function Qc(){return ll(await mr(5),GR)}me();ir();qt();At();qt();var Sp=We(()=>Promise.resolve().then(()=>(yp(),Ap)));var Bv=We(()=>Promise.resolve().then(()=>(L2(),m2)));async function Ip(){return be(),new w(await(await Sp).randomFTOScrambleString())}At();qt();var Jp=We(()=>Promise.resolve().then(()=>(Zp(),Xp)));async function Yp(){return be(),(await Jp).getRandomKilominxScramble()}me();At();qt();var pm=We(()=>Promise.resolve().then(()=>(cm(),gm)));async function mm(){return be(),new w(await(await pm).randomMasterTetraminxScrambleString())}He();At();var hF=2,Lm=null;async function FF(){return Lm||(Lm=(async()=>{let e=await(await ft).cachedSGSDataMegaminx();return new _t(await(await ft).cachedMegaminxKPuzzleWithoutMO(),e,["U","R","F","L","BR","BL","FR","FL","DR","DL","B","D"])})())}async function Bm(e){be();let t=await FF(),r=JSON.parse(JSON.stringify(e.stateData));r.CENTERS.orientation=new Array(12).fill(0);let n=new ge(await(await ft).cachedMegaminxKPuzzleWithoutMO(),r);return await t.solve(n,hF,()=>5)}ir();At();var DF=3,dm=null;async function AF(){return dm||(dm=(async()=>{let e=await(await ft).sgsDataPyraminx();return new _t(await Me.pyraminx.kpuzzle(),e,"RLUB".split(""))})())}async function x2(e){return be(),await(await AF()).solve(e,DF,()=>3)}async function yF(){return be(),Ui(await Me.pyraminx.kpuzzle(),await(await ft).sgsDataPyraminxFixedOrientation())}async function Rm(){return x2(await yF())}At();qt();var hm=We(()=>Promise.resolve().then(()=>(L2(),m2)));async function Fm(){return be(),(await hm).getRandomRediCubeScramble()}He();At();var SF=3,Dm=null;async function vF(){return Dm||(Dm=(async()=>{let e=await(await ft).sgsDataSkewb();return new _t(await(await ft).skewbKPuzzleWithoutMOCached(),e,"RLUB".split(""))})())}function xF(e){return new ge(e.kpuzzle,{CORNERS:e.stateData.CORNERS,CENTERS:{pieces:e.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}})}async function U2(e){return be(),await(await vF()).solve(xF(e),SF,n=>n.family==="y"?4:3)}async function UF(){return Ui(await(await ft).skewbKPuzzleWithoutMOCached(),await(await ft).sgsDataSkewbFixedCorner())}async function Am(){return U2(await UF())}me();qt();var Cm=We(()=>Promise.resolve().then(()=>(zm(),_m)));async function Nm(){return w.fromString(await(await Cm).getRandomSquare1ScrambleString())}var JF=1e3;pu(!0);var Im=!0;function YF(e){Im=e}function Pm(){return(typeof performance>"u"?Date:performance).now()}async function _e(e,t,r){if(!Im)return t();let n=Pm(),l=t();l?.then&&await l;let o=Pm();return console.warn(\`\${e}\${r?.isPrefetch?" (prefetched)":""}: \${Math.round(o-n)}ms\`),l}var C2=new Map,N2=null;async function Mm(e,t){switch(e){case"222":return _e("random222Scramble",Nu,{isPrefetch:t?.isPrefetch});case"333":case"333oh":case"333ft":return _e("random333Scramble",Bl,{isPrefetch:t?.isPrefetch});case"333fm":return _e("random333FewestMovesScramble",wg);case"333bf":case"333mb":return _e("random333OrientedScramble",bg);case"444":return _e("random444Scramble",X0,{isPrefetch:t?.isPrefetch});case"444bf":return _e("random444OrientedScramble",Wc);case"555":return _e("bigCubeScramble(5)",mr.bind(mr,5));case"555bf":return _e("oriented555RandomMoves",Qc);case"666":return _e("bigCubeScramble(6)",mr.bind(mr,6));case"777":return _e("bigCubeScramble(7)",mr.bind(mr,7));case"skewb":return _e("randomSkewbFixedCornerScramble",Am);case"pyram":return _e("randomPyraminxScrambleFixedOrientation",Rm);case"sq1":return _e("getRandomSquare1Scramble",Nm,{isPrefetch:t?.isPrefetch});case"fto":return _e("randomFTOScramble",Ip,{isPrefetch:t?.isPrefetch});case"master_tetraminx":return _e("randomMasterTetraminxScramble",mm);case"kilominx":return _e("randomKilominxScramble",Yp,{isPrefetch:t?.isPrefetch});case"redi_cube":return _e("randomRediCubeScramble",Fm,{isPrefetch:t?.isPrefetch});default:throw new Error(\`unsupported event: \${e}\`)}}var P2="auto",M2={initialize:async e=>{switch(e){case"222":return _e("preInitialize222",Cu);case"333":case"333oh":case"333ft":return _e("initialize333",Ug);case"444":return _e("initialize444",Gc);default:throw new Error(\`unsupported event: \${e}\`)}},setScramblePrefetchLevel(e){P2=e},randomScrambleForEvent:async e=>{let t=C2.get(e);return t?C2.delete(e):t=Mm(e),P2!=="none"&&t.then(()=>{N2&&clearTimeout(N2),N2=setTimeout(()=>{C2.set(e,Mm(e,{isPrefetch:!0}))},P2==="immediate"?0:JF)}),t},randomScrambleStringForEvent:async e=>(await M2.randomScrambleForEvent(e)).toString(),solve333ToString:async e=>{let t=new ge(await Me["3x3x3"].kpuzzle(),e);return(await D0(t)).toString()},solve222ToString:async e=>{let t=new ge(await Me["2x2x2"].kpuzzle(),e);return(await Zs(t)).toString()},solveSkewbToString:async e=>{let t=new ge(await Me.skewb.kpuzzle(),e);return(await U2(t)).toString()},solvePyraminxToString:async e=>{let t=new ge(await Me.pyraminx.kpuzzle(),e);return(await x2(t)).toString()},solveMegaminxToString:async e=>{let t=new ge(await Me.megaminx.kpuzzle(),e);return(await Bm(t)).toString()},setDebugMeasurePerf:async e=>{YF(e)}};j2(M2);
|
|
3879
|
+
\`)}var Eh,Dp=y(()=>{"use strict";ar();ll();Eh=null});function Go(e){if(e<2)return e;let t=1;for(let r=2;r<=e;r++)t*=r;return t}function c2(e,t){if(t<0||t>e)return 0;if(t===0||t===e)return 1;let r=1;for(let n=0;n<t;n++)r=r*(e-n)/(n+1)|0;return r}function _h(e){e=e.slice();let t=e.length,r=Go(t-1),n=0;for(;t>1;){t--;let l=e[0];n+=l*r;for(let o=0;o<t;o++){let i=e[o+1];e[o]=i-(i>l)}r/=t}return n}function zh(e,t){let r=[],n=Go(t-1);for(let l=0;l<t;l++)r[l]=e/n|0,e%=n,n/=t-1-l;for(let l=t-2;l>=0;l--)for(let o=l+1;o<t;o++)r[o]+=+(r[o]>=r[l]);return r}function Ap(e){let t=e.length,r=0;for(let n=0;n<t-1;n++)for(let l=n;l<t;l++)e[n]>e[l]&&(r^=1);return r}function Ch(e,t){let r=[],n=Go(t-1)/2,l=0;for(let o=0;o<t-1;o++)r[o]=e/n|0,e%=n,n/=t-1-o;r[t-1]=0;for(let o=t-2;o>=0;o--)for(let i=o+1;i<t;i++)r[i]>=r[o]?r[i]++:l^=1;return l===1&&([r[t-2],r[t-1]]=[r[t-1],r[t-2]]),r}function yp(e){return _h(e)>>1}function Sp(e){let t=e.length,r=0;for(let i=0;i<t;i++)r+=+(e[i]===1);let n=t-r;if(n===0||r===0||t===1)return 0;let l=c2(t-1,r),o=0;for(let i=0;n>0&&r>0&&t>1;i++)t--,e[i]===0?l=l*--n/t:(o+=l,l=l*r--/t);return o}function Nh(e,t,r){let n=r-t,l=c2(r-1,t),o=[],i=r-1;for(let a=0;a<i;a++)r--,e<l?(o.push(0),l=l*--n/r):(o.push(1),e-=l,l=l*t--/r);return o.push(t),o}function Ea(e,t){let r=[];for(let n=0;n<t.length;n++)r[n]=e[t[n]];return r}function jr(e,t){let r=[];for(let n=0;n<t;n++)r[n]=n;for(let n=0;n<e.length;n++)r[e[n]]=e[(n+1)%e.length];return r}function qr(e,t){let r=Array(t).fill(0);for(let n in e)r[n]=e[n];return r}function Ph(e,t){let r=Array(8).fill(0);for(let n=0;n<8;n++)r[n]=(e[1][n]+t[1][n])%3;return[Ea(e[0],t[0]),r]}function qh(e){let t=["0","","'"];return e.map(([n,l])=>jh[n]+t[l]).join(" ")}function Vh(e){let t=Ch(Math.floor(e(Go(12))/2),12),r=Array(8);for(let n=0;n<8;n++)r[n]=e(3);return[t,r]}function Hh(e){return Xh(Vh(e))}function Xh(e){let t=Zh(e),r=[xp(),Up()],n=[Yh(),$h()],l=[bp(),e3()],o=[t3(),Jh()],i=n3(t,r,n),a,s=new Set,f=+new Date;for(let u=0;u<25;u++){let{value:g,done:c}=i.next(),p=e;for(let[S,x]of g)for(let U=0;U<x;U++)p=Ph(p,To[S]);if(s.has(p.toString()))continue;s.add(p.toString());let L=yp(p[0].slice(0,8)),m=0;for(let S=0;S<4;S++)m+=p[1][S]*3**S;let d=[L,m],F=a?a.length-g.length-1:999999,D=r3(d,l,o,F);if(D!==void 0&&((a===void 0||a.length>g.length+D.length)&&(a=g.concat(D)),new Date-f>300))break}return a}function Zh(e){let t=0;for(let o=0;o<4;o++)t+=e[0].indexOf(o+8)*12**o;let r=0;for(let o=0;o<4;o++)r+=e[1][o+4]*3**o;let n=e[0].map(o=>Math.max(-1,o-8)),l=Sp(n.map(o=>+(o>=0)))*2+Ap(n.filter(o=>o>=0));return[t,r+81*l]}function vp(){if(Le.phase1cm)return Le.phase1cm;let e=[];for(let t=0;t<81;t++){e[t]=Array(8);let r=[t%3,Math.floor(t/3)%3,Math.floor(t/9)%3,Math.floor(t/27)];e[t][0]=e[t][1]=e[t][2]=e[t][3]=t;for(let n=0;n<4;n++)r[n]=(r[n]+2)%3,e[t][4+n]=r[0]+r[1]*3+r[2]*9+r[3]*27,r[n]=(r[n]+1)%3}return Le.phase1cm=e}function Jh(){if(Le.phase1cp)return Le.phase1cp;let e=Array(81);for(let t=0;t<81;t++){let r=[t%3,Math.floor(t/3)%3,Math.floor(t/9)%3,Math.floor(t/27)];e[t]=(r[0]!==0)+(r[1]!==0)+(r[2]!==0)+(r[3]!==0)}return Le.phase1cp=e}function xp(){if(Le.phase1em)return Le.phase1em;let e=[];for(let r=0;r<12;r++){e[r]=[];for(let n=0;n<8;n++)e[r][n]=To[n][0].indexOf(r)}let t=Array(12**4);for(let r=0;r<12**4;r++){t[r]=Array(8);for(let n=0;n<8;n++){let l=0;for(let o=0;o<4;o++)l+=e[Math.floor(r/12**o)%12][n]*12**o;t[r][n]=l}}return Le.phase1em=t}function Yh(){return Le.phase1ep?Le.phase1ep:Le.phase1ep=p2(xp(),[8+12*(9+12*(10+12*11))])}function Up(){if(Le.phase1sm)return Le.phase1sm;let e=c2(12,4),t=[];for(let l=0;l<e;l++){t[l]=[];let o=Nh(l,4,12),i=[];for(let a=0,s=0;a<12;a++)o[a]===0?i[a]=-1:i[a]=s++;for(let a=0;a<8;a++){let s=Ea(i,To[a][0]),f=Ea(o,To[a][0]),u=Ap(s.filter(g=>g>=0));t[l][a]=Sp(f)*2+u}}let r=vp(),n=[];for(let l=0;l<e;l++)for(let o=0;o<81;o++){let i=n[o+81*(2*l)]=[],a=n[o+81*(2*l+1)]=[];for(let s=0;s<8;s++)i[s]=r[o][s]+81*t[l][s],a[s]=r[o][s]+81*(t[l][s]^1)}return Le.phase1sm=n}function $h(){return Le.phase1sp?Le.phase1sp:Le.phase1sp=p2(Up(),[0])}function e3(){if(Le.phase2cm)return Le.phase2cm;let e=vp(),t=Array(81);for(let r=0;r<81;r++)t[r]=e[r].slice(4,8);return Le.phase2cm=t}function bp(){if(Le.phase2em)return Le.phase2em;let e=8,t=Go(e)/2,r=Array(t),n=[0,1,2,3,4,5,6,7];for(let l=0;l<t;l++){r[l]=Array(4);for(let i=0;i<4;i++){let a=Ea(n,To[i][0].slice(0,8));r[l][i]=yp(a)}if(l===t-1)break;let o=0;do for(let i=e-2;i>=0;i--){if(n[i]>n[i+1])continue;let a=i+1;for(let s=a;s<e;s++)n[s]>n[i]&&(a=s);[n[i],n[a]]=[n[a],n[i]],o^=1;for(let s=0;i+1+s<e-1-s;s++,o^=1)[n[i+1+s],n[e-1-s]]=[n[e-1-s],n[i+1+s]];break}while(o!==0)}return Le.phase2em=r}function t3(){return Le.phase2ep?Le.phase2ep:Le.phase2ep=p2(bp(),[0])}function p2(e,t){let r=e.length,n=e[0].length,l=Array(r).fill(-1),o=t.slice(),i=[],a=0;for(;o.length>0;){i.length=0;for(let s of o)if(l[s]===-1){l[s]=a;for(let f=0;f<n;f++){let u=e[s][f];for(;u!==s;)i.push(u),u=e[u][f]}}[o,i]=[i,o],a+=1}return l}function r3(e,t,r,n){n=n||999999;let l=e.length,o=0;for(let i=0;i<l;i++)o=Math.max(o,r[i][e[i]]);for(;o<=n;){let i=wp(e,t,r,o,-1);if(i!==void 0)return i;o++}}function wp(e,t,r,n,l){let o=e.length,i=t[0][0].length,a=0;for(let s=0;s<o;s++)a=Math.max(a,r[s][e[s]]);if(!(a>n)){if(n===0)return[];if(!(a===0&&n===1))for(let s=0;s<i;s++){if(s===l||s<l&&ka[s]===ka[l])continue;let f=e.slice();for(let g=0;g<o;g++)f[g]=t[g][e[g]][s];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=wp(f,t,r,n-1,s);if(g!==void 0)return[[s,u]].concat(g);for(let c=0;c<o;c++)f[c]=t[c][f[c]][s];u++}}}}function*n3(e,t,r){let n=e.length,l=0;for(let o=0;o<n;o++)l=Math.max(l,r[o][e[o]]);for(;;)yield*Ep(e,t,r,l,-1),l++}function*Ep(e,t,r,n,l){let o=e.length,i=t[0][0].length,a=0;for(let s=0;s<o;s++)a=Math.max(a,r[s][e[s]]);if(!(a>n)){if(n===0){yield[];return}if(!(a===0&&n===1))for(let s=0;s<i;s++){if(s===l||s<l&&ka[s]===ka[l])continue;let f=e.slice();for(let g=0;g<o;g++)f[g]=t[g][e[g]][s];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=Ep(f,t,r,n-1,s);for(;;){let{value:c,done:p}=g.next();if(p)break;yield[[s,u]].concat(c)}for(let c=0;c<o;c++)f[c]=t[c][f[c]][s];u++}}}}async function kp(){return new w(qh(Hh(await l3)))}var Mh,Ih,Oh,Th,Gh,Wh,Kh,Qh,nv,To,jh,ka,Le,l3,_p=y(()=>{"use strict";fe();yt();Mh=[jr([0,1,4],12),qr({0:2},8)],Ih=[jr([1,2,5],12),qr({1:2},8)],Oh=[jr([2,3,6],12),qr({2:2},8)],Th=[jr([3,0,7],12),qr({3:2},8)],Gh=[jr([9,8,4],12),qr({4:2},8)],Wh=[jr([10,9,5],12),qr({5:2},8)],Kh=[jr([11,10,6],12),qr({6:2},8)],Qh=[jr([8,11,7],12),qr({7:2},8)],nv=[zh(0,12),Array(8).fill(0)],To=[Mh,Ih,Oh,Th,Gh,Wh,Kh,Qh],jh=["UL","U","UR","F","L","B","R","D"],ka=[0,1,0,1,1,0,1,0];Le={};l3=we()});var m2={};mt(m2,{getRandomRediCubeScramble:()=>kp,sgsDataFTO:()=>Fp});var L2=y(()=>{"use strict";Dp();_p()});function Cp(e){if(e<2)return e;let t=1;for(let r=2;r<=e;r++)t*=r;return t}function za(e,t){if(t<0||t>e)return 0;if(t===0||t===e)return 1;let r=1;for(let n=0;n<t;n++)r=r*(e-n)/(n+1)|0;return r}function o3(e){e=e.slice();let t=e.length,r=Cp(t-1),n=0;for(;t>1;){t--;let l=e[0];n+=l*r;for(let o=0;o<t;o++){let i=e[o+1];e[o]=i-(i>l)}r/=t}return n}function i3(e){let t=e.length,r=0;for(let n=0;n<t-1;n++)for(let l=n;l<t;l++)e[n]>e[l]&&(r^=1);return r}function a3(e){return o3(e)>>1}function R2(e){let t=e.length,r=0;for(let i=0;i<t;i++)r+=+(e[i]===1);let n=t-r;if(n===0||r===0||t===1)return 0;let l=za(t-1,r),o=0;for(let i=0;n>0&&r>0&&t>1;i++)t--,e[i]===0?l=l*--n/t:(o+=l,l=l*r--/t);return o}function u3(e,t,r){let n=r-t,l=za(r-1,t),o=[],i=r-1;for(let a=0;a<i;a++)r--,e<l?(o.push(0),l=l*--n/r):(o.push(1),e-=l,l=l*t--/r);return o.push(t),o}function Jt(e,t){let r=[];for(let n=0;n<t.length;n++)r[n]=e[t[n]];return r}function h2(e,t){let r=Jt(e[0],t[0]),n=[],l=t[0].length;for(let o=0;o<l;o++)n[o]=(e[1][t[0][o]]+t[1][o])%3;return[r,n]}function Ml(e,t){let r=[];for(let n=0;n<t;n++)r[n]=n;for(let n=0;n<e.length;n++)r[e[n]]=e[(n+1)%e.length];return r}function Vr(e,t){let r=Array(t).fill(0);for(let n in e)r[n]=e[n];return r}function B3(e){let t=[0];for(let n=1;n<20;n++){let l=e(n+1);t[n]=t[l],t[l]=n}i3(t)===1&&([t[0],t[1]]=[t[1],t[0]]);let r=Array(20).fill(0);for(let n=0;n<19;n++)r[n]=e(3),r[19]+=3-r[n];return r[19]%=3,[t,r]}function d3(e){let t=["0","","2","2'","'"];return e.map(([n,l])=>m3[n]+t[l]).join(" ")}function R3(e,t){for(let[r,n]of t)for(let l=0;l<n;l++)e=h2(e,bn[r]);return e}function h3(e){return b3(B3(e))}function D3(e){let t=e[0];if(t.slice(15,20).every(o=>o<15))return[];if(t.slice(0,5).every(o=>o<15))return[[6,1]];let r=t.map(o=>o>=15),n=0,l;for(;l===void 0;)n++,l=Ip(r,n,-1);return l.push([6,1]),l}function Ip(e,t,r){if(t===0)return e.slice(0,5).some(n=>n)?void 0:[];for(let n=0;n<6;n++)if(n!==r)for(let l=1;l<5;l++){let o=Jt(e,_a[n][l][0]),i=Ip(o,t-1,n);if(i!==void 0)return[[n,l]].concat(i)}}function A3(e){let t=e[0].slice(0,15),r=e[1],n=R2(t.map(i=>+(i>=15))),l=243*n;for(let i=0,a=0;i<15;i++)t[i]<15||(l+=r[i]*Math.pow(3,a),a++);let o=0;for(let i=0;i<5;i++)o+=t.indexOf(15+i)*Math.pow(15,i);return[l,o]}function y3(e){let t=[Ca(),Na()],r=[w3(),k3()];return Op(A3(e),t,r).concat([[6,1]])}function S3(e){let t=[5,6,7,8,14],r=e[0].slice(0,15),n=e[1],l=R2(r.map(a=>+(t.indexOf(a)!==-1))),o=243*l;for(let a=0,s=0;a<15;a++)t.indexOf(r[a])!==-1&&(o+=n[a]*Math.pow(3,s),s++);let i=0;for(let a=0;a<5;a++)i+=r.indexOf(t[a])*Math.pow(15,a);return[o,i]}function v3(e){let t=[Ca(),Na()],r=[E3(),_3()];return Op(S3(e),t,r)}function x3(e){let t=e[0].slice(0,14),r=e[1],n=0,l=[],o=0;for(let i of[0,1,2,3,4,9,10,11,12,13])i!==13&&(n+=r[i]*Math.pow(3,o)),l[o]=t[i]<5?t[i]:t[i]-4,o++;return[n,a3(l)]}function U3(e){return M3(x3(e))}function b3(e){let t=[];for(let r of[D3,y3,v3,U3]){let n=r(e);e=R3(e,n),t=t.concat(n)}return t}function Ca(){if(le.phase23om)return le.phase23om;let e=za(15,5),t=[1,3,9,27,81,243],r=Array(za(15,5)*t[5]);le.phase23om=r;for(let n=0;n<e;n++){let l=u3(n,5,15).concat(Array(5).fill(0)),o=[];for(let i=0;i<6;i++){let a=Jt(l,bn[i][0]).slice(0,15);o[i]=R2(a)}for(let i=0;i<t[5];i++){r[i+243*n]=[];let a=[];for(let s=0,f=0;s<20;s++)l[s]===1?(a[s]=(i/t[f]|0)%3,f++):a[s]=99;for(let s=0;s<6;s++){let f=bn[s],u=[];for(let p=0;p<15;p++)u[p]=a[f[0][p]]+f[1][p];let g=u.filter(p=>p<10),c=0;for(let p=0;p<5;p++)c+=g[p]%3*t[p];r[i+243*n][s]=c+243*o[s]}}}return r}function w3(){if(le.phase2op)return le.phase2op;let e=Ca();return le.phase2op=Il(e,[243*3002])}function E3(){if(le.phase3op)return le.phase3op;let e=Ca();return le.phase3op=Il(e,[243*246])}function Na(){if(le.phase23pm)return le.phase23pm;let e=[1,15,225,Math.pow(15,3),Math.pow(15,4),Math.pow(15,5)],t=Array(e[5]),r=Array(15);for(let l=0;l<15;l++){r[l]=Array(6);for(let o=0;o<6;o++)r[l][o]=bn[o][0].indexOf(l)}let n=[0,0,0,0,0];for(let l=0;l<e[5];l++){t[l]=Array(6);for(let o=0;o<6;o++){let i=0;for(let a=0;a<5;a++)i+=r[n[a]][o]*e[a];t[l][o]=i}n[0]++;for(let o=0;o<4;o++)n[o]===15&&(n[o]=0,n[o+1]++)}return le.phase23pm=t}function k3(){if(le.phase2pp)return le.phase2pp;let e=Na();return le.phase2pp=Il(e,[213090])}function _3(){if(le.phase3pp)return le.phase3pp;let e=Na();return le.phase3pp=Il(e,[737420])}function F2(){if(le.phase4om)return le.phase4om;let e=[1,3,9,27,81,243,729,2187,6561,19683,59049],t=Array(e[9]);for(let r=0;r<e[9];r++){let n=Array(14).fill(0);for(let l=0;l<9;l++){let o=l<5?l:l+4;n[o]=(r/e[l]|0)%3,n[13]-=n[o]}n[13]=(n[13]+999)%3,t[r]=[];for(let l=0;l<3;l++){let o=bn[l],i=[0,1,2,3,4,9,10,11,12,13].map(s=>n[o[0][s]]+o[1][s]),a=0;for(let s=0;s<9;s++)a+=i[s]%3*e[s];t[r][l]=a}}return le.phase4om=t}function D2(){if(le.phase4pm)return le.phase4pm;let e=Cp(10)/2,t=10,r=[0,1,2,3,4,-1,-1,-1,-1,5,6,7,8,9],n=[0,1,2,3,4,9,10,11,12,13],l=[Jt(r,Jt(Np[0],n)),Jt(r,Jt(Pp[0],n)),Jt(r,Jt(Mp[0],n))],o=Array(e),i=Array(10);for(let a=0;a<e;a++){f3(a,i),o[a]=[];for(let s=0;s<3;s++){let f=Jt(i,l[s]);o[a][s]=s3(f)}}return le.phase4pm=o}function z3(){if(le.phase4op)return le.phase4op;let e=F2();return le.phase4op=Il(e,[0])}function C3(){if(le.phase4pp)return le.phase4pp;let e=D2();return le.phase4pp=Il(e,[0])}function N3(e){if(le.phase4np_list&&le.phase4np_list.threshold===e)return le.phase4np_list;let t=[F2(),D2()],r=Math.pow(3,9),n=[0];l(e,[0,0],-1);function l(a,s,f){if(n.push(s[0]+r*s[1]),a===0)return;let u=[];for(let g=0;g<3;g++)if(g!==f){u[0]=s[0],u[1]=s[1];for(let c=1;c<5;c++)u[0]=t[0][u[0]][g],u[1]=t[1][u[1]][g],l(a-1,u,g)}}n.sort((a,s)=>a-s);let o=[],i=-1;for(let a of n)a!==i&&o.push(i=a);return o.threshold=e,le.phase4np_list=o}function P3(e,t){let r=0,n=e.length-1;for(;n-r>1;){let l=r+n>>1;t>e[l]?r=l+1:n=l}return t===e[r]||t===e[n]}function Il(e,t){let r=e.length,n=e[0].length,l=Array(r).fill(-1);for(let a of t)l[a]=0;let o=0,i=!1;for(;!i;){i=!0;for(let a=0;a<r;a++)if(l[a]===o)for(let s=0;s<n;s++){let f=e[a][s];for(;f!==a;)l[f]===-1&&(i=!1,l[f]=o+1),f=e[f][s]}o++}return l}function Op(e,t,r){let n=e.length,l=0;for(let o=0;o<n;o++)l=Math.max(l,r[o][e[o]]);for(;;){let o=Tp(e,t,r,l,-1);if(o!==void 0)return o;l++}}function Tp(e,t,r,n,l){let o=e.length,i=t[0][0].length,a=0;for(let s=0;s<o;s++)a=Math.max(a,r[s][e[s]]);if(!(a>n)){if(n===0||a===0)return[];for(let s=0;s<i;s++){if(s===l)continue;let f=e.slice();for(let g=0;g<o;g++)f[g]=t[g][e[g]][s];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=Tp(f,t,r,n-1,s);if(g!==void 0)return[[s,u]].concat(g);for(let c=0;c<o;c++)f[c]=t[c][f[c]][s];u++}}}}function M3(e){let t=F2(),r=D2(),n=z3(),l=C3(),o=N3(B2),i=Math.max(n[e[0]],l[e[1]]);for(;;){let a=Gp(e,i,-1,t,r,n,l,o);if(a!==void 0)return a;i++}}function Gp(e,t,r,n,l,o,i,a){let s=Math.max(o[e[0]],i[e[1]]);if(!(s>t)&&(s<=B2&&!P3(a,e[0]+19683*e[1])&&(s=B2+1),!(s>t))){if(t===0||s===0)return[];for(let f=0;f<3;f++){if(f===r)continue;let u=e.slice();for(let g=1;g<5;g++){u[0]=n[u[0]][f],u[1]=l[u[1]][f];let c=Gp(u,t-1,f,n,l,o,i,a);if(c!==void 0)return[[f,g]].concat(c)}}}}async function Wp(){return new w(d3(h3(await I3)))}var B2,s3,f3,Np,Pp,Mp,g3,c3,p3,d2,dv,bn,m3,L3,_a,F3,le,I3,Kp=y(()=>{"use strict";fe();yt();B2=7;[s3,f3]=(()=>{let e=new Int8Array(10240),t=new Int8Array(1024*10);for(let l=0;l<1024;l++)for(let o=0,i=0;o<10;o++)(l>>>o&1)!==0&&(e[o<<10|l]=i,t[i<<10|l]=o,i++);function r(l){let o=1023,i=181440,a=0;for(let s=0;s<8;s++){let f=l[s];a+=e[o|f<<10]*i,o&=~(1<<f),i/=9-s}return a}function n(l,o){let i=1023,a=181440,s=0;for(let f=0;f<8;f++){let u=l/a|0;l-=u*a,s^=u&1;let g=t[i|u<<10];o[f]=g,i&=~(1<<g),a/=9-f}return o[8]=t[i|s<<10],o[9]=t[i|(s^1)<<10],o}return[r,n]})();Np=[Ml([0,1,2,3,4],20),Vr({},20)],Pp=[Ml([4,3,11,12,13],20),Vr({4:2,3:1,11:1,12:1,13:1},20)],Mp=[Ml([3,2,9,10,11],20),Vr({3:2,2:1,9:1,10:1,11:1},20)],g3=[Ml([2,1,7,8,9],20),Vr({2:2,1:1,7:1,8:1,9:1},20)],c3=[Ml([1,0,5,6,7],20),Vr({1:2,0:1,5:1,6:1,7:1},20)],p3=[Ml([0,4,13,14,5],20),Vr({0:2,4:1,13:1,14:1,5:1},20)],d2=[[15,16,17,18,19,10,9,8,7,6,5,14,13,12,11,0,1,2,3,4],Vr({},20)],dv=[[1,2,3,4,0,7,8,9,10,11,12,13,14,5,6,19,15,16,17,18],Vr({},20)],bn=[Np,Pp,Mp,g3,c3,p3,d2],m3=["U","R","F","L","BL","BR","x2"],L3=h2(d2,d2),_a=[];for(let e=0;e<bn.length;e++){_a[e]=[L3];for(let t=1;t<5;t++)_a[e][t]=h2(_a[e][t-1],bn[e])}{let e=Math.sin(Math.PI/5),t=Math.cos(Math.PI/10),r=Math.cos(Math.PI/5),n=Math.sin(Math.PI/10);F3={U:[0,0],L:[-e-t,r-n],F:[0,2*r],R:[e+t,r-n],BR:[t,-1-n],BL:[-t,-1-n],DBR:[2*e+2*t,0],DB:[3*e+3*t,-r-n],DBL:[4*e+4*t,0],DFL:[3*e+4*t,1+r],DFR:[3*e+2*t,1+r],D:[3*e+3*t,r-n]}}le={};I3=we();Wp().then(e=>e.log())});var Qp={};mt(Qp,{getRandomKilominxScramble:()=>Wp});var jp=y(()=>{"use strict";Kp()});function Wo(e){if(e<2)return e;let t=1;for(let r=2;r<=e;r++)t*=r;return t}function En(e){let t=Array(e);for(let r=0;r<e;r++)t[r]=r;return t}function O3(e){e=e.slice();let t=e.length,r=Wo(t-1),n=0;for(;t>1;){t--;let l=e[0];n+=l*r;for(let o=0;o<t;o++){let i=e[o+1];e[o]=i-(i>l)}r/=t}return n}function Pa(e,t){let r=[],n=Wo(t-1)/2,l=0;for(let o=0;o<t-1;o++)r[o]=e/n|0,e%=n,n/=t-1-o;r[t-1]=0;for(let o=t-2;o>=0;o--)for(let i=o+1;i<t;i++)r[i]>=r[o]?r[i]++:l^=1;return l===1&&([r[t-2],r[t-1]]=[r[t-1],r[t-2]]),r}function Xp(e){return O3(e)>>1}function wn(e,t){let r=[];for(let n=0;n<t.length;n++)r[n]=e[t[n]];return r}function y2(e){let t=[];for(let r=0;r<e.length;r++)t[e[r]]=r;return t}function Ko(e,t){let r=[];for(let n=0;n<t;n++)r[n]=n;for(let n=0;n<e.length;n++)r[e[n]]=e[(n+1)%e.length];return r}function Hr(e,t){return e.length===0?En(t):e.map(r=>Ko(r,t)).reduce(wn)}function T3(e,t){let r=Array(4);for(let i=0;i<4;i++)r[i]=(e.co[i]+t.co[i])%3;let n=wn(e.mp,t.mp),l=wn(e.wp,t.wp),o=wn(e.cp,t.cp);return{co:r,mp:n,wp:l,cp:o}}function Zp(e,t){return e>=4&&t>=4?!0:e<4&&t<4?e===t:(e^t)===4}function Z3(e){let t=["0","","'"];return e.map(([n,l])=>X3[n]+t[l]).join(" ")}function J3(e){let t=Array(4);for(let o=0;o<4;o++)t[o]=e(3);let r=Pa(e(Wo(6)/2),6);for(let o=0,i=0;o<6;o++){let a=o===5?i:e(2);i^=a,r[o]+=a*6,r[o+6]=(r[o]+6)%12}let n=Pa(e(Wo(12)/2),12),l=Pa(e(Wo(4)/2),4);return{co:t,mp:r,wp:n,cp:l}}function Y3(e){return eF(J3(e))}function $3(e,t=!0,r=!1){let n=Z3(Y3(e));if(!t)return n;let l=["u","l","r","b"],o=["0","","'"];if(!r){for(let c=0;c<4;c++){let p=e(3);p!==0&&(n+=\` \${l[c]}\${o[p]}\`)}return n.trim()}let i=[],a=[],s=[];for(let c=0;c<4;c++)i[c]=e(3),a[c]=e(3),s[c]=(i[c]-a[c]+3)%3;let f=c=>c.filter(p=>p!==0).length;for(;!(f(a)>=1&&f(s)>=1&&f(a)+f(s)>=4);)for(let c=0;c<4;c++)a[c]=e(3),s[c]=(i[c]-a[c]+3)%3;let u=a.map((c,p)=>c!==0?\`\${l[p]}\${o[c]} \`:"").join(""),g=s.map((c,p)=>c!==0?\` \${l[p]}\${o[c]}\`:"").join("");return u+n+g}function eF(e){let t=rF(e),r=[tm(),rm()],n=[sF(),fF()],l=oF(t),o,i=new Set,a=performance.now();for(let s=0;s<22;s++){let{value:f,done:u}=l.next(),g=e;for(let[d,F]of f)for(let D=0;D<F;D++)g=T3(g,Ol[d]);let c=JSON.stringify(g);if(i.has(c))continue;i.add(c);let p=iF(g),L=o?o.length-f.length-1:999999,m=uF(p,r,n,L).next().value;if(m!==void 0&&((o===void 0||o.length>f.length+m.length)&&(o=f.concat(m)),performance.now()-a>300))break}return o}function tF(e){return e[3^e.indexOf(3)]}function rF(e){let t=wn(y2(e.mp),e.wp),r=(e.co.reduce((n,l)=>n+l)-tF(e.cp)+3)%3;return[0,1,2,3,4,5].map(n=>n+6*t.indexOf(n)+72*t.indexOf(n+6)+864*r)}function*oF(e){let t=0,r=em(),n=aF();for(;;)yield*Yp(...e,r,n,t,-1),t++}function*Yp(e,t,r,n,l,o,i,a,s,f){let u=kn,g=Rr[e]+Rr[t]+Rr[r]+Rr[n]+Rr[l]+Rr[o],c=Math.max(a[e%864+t*864],a[r%864+t*864],a[l%864+t*864],a[e%864+n*864],a[r%864+n*864],a[l%864+n*864],a[e%864+o*864],a[r%864+o*864],a[l%864+o*864],a[e%864+r*864],a[e%864+l*864],a[r%864+l*864],a[t%864+n*864],a[t%864+o*864],a[n%864+o*864],v2[g]);if(!(c>s)){if(s===0){yield[];return}if(!(c===0&&s===1))for(let p=0;p<u;p++){if(p===f||p<f&&Zp(p,f))continue;let L=e,m=t,d=r,F=n,D=l,S=o;for(let x=1;x<=2;x++){L=i[L][p],m=i[m][p],d=i[d][p],F=i[F][p],D=i[D][p],S=i[S][p];let U=Yp(L,m,d,F,D,S,i,a,s-1,p);for(;;){let{value:P,done:Z}=U.next();if(Z)break;yield[[p,x]].concat(P)}}}}}function iF(e){let t=e.mp,r=Xp(t.slice(0,6).map(i=>i%6)),n=t.slice(0,5).map((i,a)=>(i>=6)*2**a).reduce((i,a)=>i+a),l=e.co.map((i,a)=>i*3**a).reduce((i,a)=>i+a),o=e.cp.indexOf(0);return[r+360*o,n+32*l]}function $p(){if(Ee.phase1pm)return Ee.phase1pm;let e=Array(6*12*12).fill().map(()=>Array(kn).fill(-1));for(let t=0;t<6;t++)for(let r=0;r<12;r++)for(let n=0;n<12;n++){if(r===n)continue;let l=t+6*r+72*n;for(let o=0;o<kn;o++){let i=Jp[o][t],a=S2[o][r],s=S2[o][n];i<6?e[l][o]=i+6*a+72*s:e[l][o]=i-6+6*s+72*a}}return Ee.phase1pm=e}function em(){if(Ee.phase1pcm)return Ee.phase1pcm;let e=$p(),t=Array(e.length*3).fill().map(()=>Array(kn).fill(-1));for(let r=0;r<e.length;r++)for(let n=0;n<kn;n++){let l=e[r][n];t[r][n]=l+6*12*12*A2[n],t[r+6*12*12][n]=l+6*12*12*((A2[n]+1)%3),t[r+2*6*12*12][n]=l+6*12*12*((A2[n]+2)%3)}return Ee.phase1pcm=t}function aF(){if(Ee.phase1p2cp)return Ee.phase1p2cp;let e=$p(),t=em(),r=new Int8Array((6*12*12)**2*3);r.fill(-1);let n=[0,1,2,3,4,5].map(o=>o+6*o+72*(o+6));for(let o=0;o<6;o++)for(let i=0;i<6;i++)o!==i&&(r[n[o]+864*n[i]]=0);let l=0;for(;;){let o=!1;for(let i=0;i<r.length;i++){if(r[i]!==l)continue;let a=i%864,s=Math.floor(i/864);for(let f=0;f<kn;f++){let u=a,g=s;for(let c=1;c<=2;c++){u=e[u][f],g=t[g][f];let p=u+864*g;r[p]===-1&&(o=!0,r[p]=l+1)}}}if(!o)break;l++}return Ee.phase1p2cp=r}function tm(){if(Ee.phase2pm)return Ee.phase2pm;let e=Array(1440).fill().map(()=>Array(Ma));for(let t=0;t<360;t++){let r=Pa(t,6);for(let n=0;n<6;n++)r[n+6]=r[n]+6;for(let n=0;n<Ma;n++){let l=wn(r,Ol[n].mp),o=Xp(l.slice(0,6).map(i=>i%6));for(let i=0;i<4;i++){let a=Ol[n].cp[i];e[t+360*a][n]=o+360*i}}}return Ee.phase2pm=e}function rm(){if(Ee.phase2om)return Ee.phase2om;let e=Array(32*81).fill().map(()=>Array(Ma));for(let t=0;t<32;t++){let r=[0,1,2,3,4].map(l=>t>>l&1);r[5]=r.reduce((l,o)=>l^o);let n=[];for(let l=0;l<6;l++)n[l]=l+6*r[l],n[l+6]=l+6*(r[l]^1);for(let l=0;l<81;l++){let o=[0,1,2,3].map(i=>Math.floor(l/3**i)%3);for(let i=0;i<Ma;i++){let s=wn(n,Ol[i].mp).slice(0,5).map(c=>+(c>=6)),f=0;for(let c=0;c<5;c++)f+=s[c]<<c;let u=o.map((c,p)=>(c+Ol[i].co[p])%3),g=0;for(let c=0;c<4;c++)g+=u[c]*3**c;e[t+32*l][i]=f+32*g}}}return Ee.phase2om=e}function sF(){return Ee.phase2pp?Ee.phase2pp:Ee.phase2pp=nm(tm(),[0])}function fF(){return Ee.phase2op?Ee.phase2op:Ee.phase2op=nm(rm(),[0])}function nm(e,t){let r=e.length,n=e[0].length,l=Array(r).fill(-1),o=t.slice(),i=[],a=0;for(;o.length>0;){i.length=0;for(let s of o)if(l[s]===-1){l[s]=a;for(let f=0;f<n;f++){let u=e[s][f];for(;u!==s;)i.push(u),u=e[u][f]}}[o,i]=[i,o],a+=1}return l}function*uF(e,t,r,n){let l=e.length,o=0;for(let i=0;i<l;i++)o=Math.max(o,r[i][e[i]]);for(;o<=n;)yield*lm(e,t,r,o,-1),o++}function*lm(e,t,r,n,l){let o=e.length,i=t[0][0].length,a=0;for(let s=0;s<o;s++)a=Math.max(a,r[s][e[s]]);if(!(a>n)){if(n===0){yield[];return}if(!(a===0&&n===1))for(let s=0;s<i;s++){if(s===l||s<l&&Zp(s,l))continue;let f=e.slice();for(let g=0;g<o;g++)f[g]=t[g][e[g]][s];let u=1;for(;e.some((g,c)=>e[c]!==f[c]);){let g=lm(f,t,r,n-1,s);for(;;){let{value:c,done:p}=g.next();if(p)break;yield[[s,u]].concat(c)}for(let c=0;c<o;c++)f[c]=t[c][f[c]][s];u++}}}}async function cF(){return $3(await gF,!1)}var xv,Uv,bv,G3,W3,K3,Q3,j3,q3,V3,H3,Ol,X3,kn,Ma,nF,Jp,lF,S2,A2,Hp,v2,Rr,Ee,gF,om=y(()=>{"use strict";yt();[xv,Uv]=(()=>{let e=new Int8Array(49152),t=new Int8Array(4096*12);for(let l=0;l<4096;l++)for(let o=0,i=0;o<12;o++)(l>>>o&1)!==0&&(e[o<<12|l]=i,t[i<<12|l]=o,i++);function r(l){let o=4095,i=19958400,a=0;for(let s=0;s<10;s++){let f=l[s];a+=e[o|f<<12]*i,o&=~(1<<f),i/=11-s}return a}function n(l,o){let i=4095,a=19958400,s=0;for(let f=0;f<10;f++){let u=l/a|0;l-=u*a,s^=u&1;let g=t[i|u<<12];o[f]=g,i&=~(1<<g),a/=11-f}return o[10]=t[i|s<<12],o[11]=t[i|(s^1)<<12],o}return[r,n]})();bv={co:[0,0,0,0],mp:En(12),wp:En(12),cp:[0,1,2,3]},G3={co:[2,0,0,0],mp:En(12),wp:Ko([1,9,11],12),cp:[0,1,2,3]},W3={co:[0,2,0,0],mp:En(12),wp:Ko([0,7,2],12),cp:[0,1,2,3]},K3={co:[0,0,2,0],mp:En(12),wp:Ko([3,6,10],12),cp:[0,1,2,3]},Q3={co:[0,0,0,2],mp:En(12),wp:Ko([4,8,5],12),cp:[0,1,2,3]},j3={co:[2,0,0,0],mp:Hr([[1,9,11],[7,3,5]],12),wp:Hr([[1,9,11],[7,3,5]],12),cp:[0,2,3,1]},q3={co:[0,2,0,0],mp:Hr([[0,7,2],[6,1,8]],12),wp:Hr([[0,7,2],[6,1,8]],12),cp:[3,1,0,2]},V3={co:[0,0,2,0],mp:Hr([[3,6,10],[9,0,4]],12),wp:Hr([[3,6,10],[9,0,4]],12),cp:[1,3,2,0]},H3={co:[0,0,0,2],mp:Hr([[4,8,5],[10,2,11]],12),wp:Hr([[4,8,5],[10,2,11]],12),cp:[2,0,1,3]},Ol=[j3,q3,V3,H3,G3,W3,K3,Q3],X3=["u","l","r","b","U","L","R","B"],kn=8,Ma=4;nF=[],Jp=[],lF=[],S2=[];for(let e=0;e<kn;e++){let t=Ol[e];nF[e]=t.mp,Jp[e]=y2(t.mp),lF[e]=t.wp,S2[e]=y2(t.wp)}A2=[0,0,0,0,2,2,2,2],Hp=[[14,-1,-1,11,11,10,9,8,8,7,7,6,4,5,5,3,4,4,2,3,4,3,-1,-1,0],[13,-1,-1,11,10,10,9,8,8,7,7,6,4,5,5,3,4,4,2,3,3,1,-1,-1,6]],v2=new Int8Array(55);for(let e=0;e<25;e++)v2[e]=Hp[0][e],v2[e+30]=Hp[1][e];Rr=new Int8Array(6*12*12*3);for(let e=0;e<6;e++)for(let t=0;t<12;t++)for(let r=0;r<12;r++){let n=e+6*t+72*r,l=2;t===e?l++:t===(e+6)%12&&l--,r===(e+6)%12?l++:r===e&&l--,Rr[n]=l,Rr[n+6*12*12]=Rr[n+2*6*12*12]=l+5}Ee={};gF=we()});var im={};mt(im,{randomMasterTetraminxScrambleString:()=>cF});var am=y(()=>{"use strict";om()});function AF(e,t){e.ul=t.ul,e.ur=t.ur,e.dl=t.dl,e.dr=t.dr,e.ml=t.ml}function Rm(e,t){var r;t<<=2,t>24?(t=48-t,r=e.ul,e.ul=(~~e.ul>>t|e.ur<<24-t)&16777215,e.ur=(~~e.ur>>t|r<<24-t)&16777215):t>0?(r=e.ul,e.ul=(e.ul<<t|~~e.ur>>24-t)&16777215,e.ur=(e.ur<<t|~~r>>24-t)&16777215):t===0?(r=e.ur,e.ur=e.dl,e.dl=r,e.ml=1-e.ml):t>=-24?(t=-t,r=e.dl,e.dl=(e.dl<<t|~~e.dr>>24-t)&16777215,e.dr=(e.dr<<t|~~r>>24-t)&16777215):t<-24&&(t=48+t,r=e.dl,e.dl=(~~e.dl>>t|e.dr<<24-t)&16777215,e.dr=(~~e.dr>>t|r<<24-t)&16777215)}function yF(e){var t,r,n,l,o;for(n=0,e.arr[0]=Yt(e,0),l=1;l<24;++l)Yt(e,l)!==e.arr[n]&&(e.arr[++n]=Yt(e,l));for(o=0,t=0;t<16;++t)for(r=t+1;r<16;++r)e.arr[t]>e.arr[r]&&(o^=1);return o}function SF(e){var t,r,n,l;return l=e.ur&1118481,l|=~~l>>3,l|=~~l>>6,l=l&15|~~l>>12&48,n=e.ul&1118481,n|=~~n>>3,n|=~~n>>6,n=n&15|~~n>>12&48,r=e.dr&1118481,r|=~~r>>3,r|=~~r>>6,r=r&15|~~r>>12&48,t=e.dl&1118481,t|=~~t>>3,t|=~~t>>6,t=t&15|~~t>>12&48,Qo(yF(e)<<24|n<<18|l<<12|t<<6|r)}function vF(e,t){var r,n;for(r=0;r<8;++r)e.prm[r]=~~(~~Yt(e,r*3+1)>>1<<24)>>24;for(t.cornperm=Ho(e.prm),t.topEdgeFirst=Yt(e,0)===Yt(e,1),r=t.topEdgeFirst?2:0,n=0;n<4;r+=3,++n)e.prm[n]=~~(~~Yt(e,r)>>1<<24)>>24;for(t.botEdgeFirst=Yt(e,12)===Yt(e,13),r=t.botEdgeFirst?14:12;n<8;r+=3,++n)e.prm[n]=~~(~~Yt(e,r)>>1<<24)>>24;t.edgeperm=Ho(e.prm),t.ml=e.ml}function Yt(e,t){var r;return t<6?r=~~e.ul>>(5-t<<2):t<12?r=~~e.ur>>(11-t<<2):t<18?r=~~e.dl>>(17-t<<2):r=~~e.dr>>(23-t<<2),~~((r&15)<<24)>>24}function b2(e,t,r){t<6?(e.ul&=~(15<<(5-t<<2)),e.ul|=r<<(5-t<<2)):t<12?(e.ur&=~(15<<(11-t<<2)),e.ur|=r<<(11-t<<2)):t<18?(e.dl&=~(15<<(17-t<<2)),e.dl|=r<<(17-t<<2)):(e.dr&=~(15<<(23-t<<2)),e.dr|=r<<(23-t<<2))}function z2(){this.arr=[],this.prm=[]}async function xF(){let e=await we();var t,r,n,l,o,i,a,s,f;for(t=new z2,n=Tl[e(3678)],o=19088743<<1|286331153,l=19088743<<1,a=i=8,r=0;r<24;r++)(n>>r&1)===0?(s=e(i)<<2,b2(t,23-r,l>>s&15),f=(1<<s)-1,l=(l&f)+(l>>4&~f),--i):(s=e(a)<<2,b2(t,23-r,o>>s&15),b2(t,22-r,o>>s&15),f=(1<<s)-1,o=(o&f)+(o>>4&~f),--a,++r);return t.ml=e(2),t}function UF(){}function bF(e){var t,r,n,l,o,i;for(AF(e.Search_d,e.Search_c),n=0;n<e.Search_length1;++n)Rm(e.Search_d,e.Search_move[n]);for(vF(e.Search_d,e.Search_sq),r=e.Search_sq.edgeperm,t=e.Search_sq.cornperm,o=e.Search_sq.ml,i=Math.max(ve[e.Search_sq.edgeperm<<1|o],ve[e.Search_sq.cornperm<<1|o]),n=i;n<e.Search_maxlen2;++n)if(Oa(e,r,t,e.Search_sq.topEdgeFirst,e.Search_sq.botEdgeFirst,o,n,e.Search_length1,0)){for(l=0;l<n;++l)Rm(e.Search_d,e.Search_move[e.Search_length1+l]);return e.Search_sol_string=wF(e,n+e.Search_length1),!0}return!1}function wF(e,t){for(var r="",n=0,l=0,o=t-1;o>=0;o--){var i=e.Search_move[o];i>0?(i=12-i,n=i>6?i-12:i):i<0?(i=12+i,l=i>6?i-12:i):(n===0&&l===0?r+=" / ":r+=\`(\${n}, \${l}) / \`,n=l=0)}return(n!==0||l!==0)&&(r+=\`(\${n}, \${l})\`),r}function Ia(e,t,r,n,l,o){var i,a,s;if(r===0&&n<4)return n===0&&bF(e);if(o!==0&&(s=Ta[t],a=je[s],a<n&&(e.Search_move[l]=0,Ia(e,s,a,n-1,l+1,0))))return!0;if(s=t,o<=0){for(i=0;i+=Vo[s],s=~~i>>4,i&=15,!(i>=12||(a=je[s],a>n));)if(a<n&&(e.Search_move[l]=i,Ia(e,s,a,n-1,l+1,1)))return!0}if(s=t,o<=1){for(i=0;i+=qo[s],s=~~i>>4,i&=15,!(i>=6||(a=je[s],a>n));)if(a<n&&(e.Search_move[l]=-i,Ia(e,s,a,n-1,l+1,2)))return!0}return!1}function Oa(e,t,r,n,l,o,i,a,s){var f,u,g,c,p,L,m;if(i===0&&!n&&l||s!==0&&n===l&&(g=Xo[t],u=Xo[r],ve[g<<1|1-o]<i&&ve[u<<1|1-o]<i&&(e.Search_move[a]=0,Oa(e,g,u,n,l,1-o,i-1,a+1,0))))return!0;if(s<=0)for(m=!n,g=m?Cn[t]:t,u=m?r:Cn[r],c=m?1:2,p=ve[g<<1|o],L=ve[u<<1|o];c<12&&p<=i&&p<=i;){if(p<i&&L<i&&(e.Search_move[a]=c,Oa(e,g,u,m,l,o,i-1,a+1,1)))return!0;m=!m,m?(g=Cn[g],p=ve[g<<1|o],c+=1):(u=Cn[u],L=ve[u<<1|o],c+=2)}if(s<=1)for(f=!l,g=f?zn[t]:t,u=f?r:zn[r],c=f?1:2,p=ve[g<<1|o],L=ve[u<<1|o];c<(i>3?6:12)&&p<=i&&p<=i;){if(p<i&&L<i&&(e.Search_move[a]=-c,Oa(e,g,u,n,f,o,i-1,a+1,2)))return!0;f=!f,f?(g=zn[g],p=ve[g<<1|o],c+=1):(u=zn[u],L=ve[u<<1|o],c+=2)}return!1}function EF(e,t){var r;for(e.Search_c=t,r=SF(t),e.Search_length1=je[r];e.Search_length1<100&&(e.Search_maxlen2=Math.min(31-e.Search_length1,17),!Ia(e,r,je[r],e.Search_length1,0,-1));++e.Search_length1);return e.Search_sol_string}function Dm(){this.Search_move=[],this.Search_d=new z2,this.Search_sq=new ym}function kF(){}function _F(){hm||(hm=!0,jo=[0,3,6,12,15,24,27,30,48,51,54,60,63],Tl=[],je=[],Vo=[],qo=[],Ta=[],NF())}function zF(e){var t,r;t=0,r=0;do(e.bottom&2048)===0?(t+=1,e.bottom=e.bottom<<1):(t+=2,e.bottom=e.bottom<<2^12291),r=1-r;while((Nn(e.bottom&63)&1)!==0);return(Nn(e.bottom)&2)===0&&(e.Shape_parity^=r),t}function w2(e){var t;return t=vm(Tl,e.top<<12|e.bottom)<<1|e.Shape_parity,t}function E2(e,t){e.Shape_parity=t&1,e.top=Tl[~~t>>1],e.bottom=e.top&4095,e.top>>=12}function CF(e){var t,r;t=0,r=0;do(e.top&2048)===0?(t+=1,e.top=e.top<<1):(t+=2,e.top=e.top<<2^12291),r=1-r;while((Nn(e.top&63)&1)!==0);return(Nn(e.top)&2)===0&&(e.Shape_parity^=r),t}function Am(){}function Qo(e){var t;return t=vm(Tl,e&16777215)<<1|~~e>>24,t}function NF(){var e,t,r,n,l,o,i,a,s,f,u,g,c,p,L,m;for(e=0,i=0;i<28561;++i)o=jo[i%13],r=jo[~~(i/13)%13],g=jo[~~(~~(i/13)/13)%13],u=jo[~~(~~(~~(i/13)/13)/13)],c=u<<18|g<<12|r<<6|o,Nn(c)===16&&(Tl[e++]=c);for(f=new Am,i=0;i<7356;++i)E2(f,i),Vo[i]=CF(f),Vo[i]|=w2(f)<<4,E2(f,i),qo[i]=zF(f),qo[i]|=w2(f)<<4,E2(f,i),m=f.top&63,p=Nn(m),L=Nn(f.bottom&4032),f.Shape_parity^=1&~~(p&L)>>1,f.top=f.top&4032|~~f.bottom>>6&63,f.bottom=f.bottom&63|m<<6,Ta[i]=w2(f);for(i=0;i<7536;++i)je[i]=-1;for(je[Qo(14378715)]=0,je[Qo(31157686)]=0,je[Qo(23967451)]=0,je[Qo(7191990)]=0,n=4,l=0,t=-1;n!==l;)for(l=n,++t,i=0;i<7536;++i)if(je[i]===t){s=0,a=i;do a=Vo[a],s+=a&15,a>>=4,je[a]===-1&&(++n,je[a]=t+1);while(s!==12);s=0,a=i;do a=qo[a],s+=a&15,a>>=4,je[a]===-1&&(++n,je[a]=t+1);while(s!==12);a=Ta[i],je[a]===-1&&(++n,je[a]=t+1)}}function PF(){}function MF(){if(!Fm){Fm=!0,ve=[],Xo=[],Cn=[],zn=[],Sm=[1,1,2,6,24,120,720,5040],_n=[];for(var e=0;e<12;++e)_n[e]=[];IF()}}function ym(){}function Ho(e){var t,r,n,l;for(r=0,l=1985229328,t=0;t<7;++t)n=e[t]<<2,r=(8-t)*r+(~~l>>n&7),l-=286331152<<n;return r&65535}function IF(){var e,t,r,n,l,o,i,a,s,f,u,g,c;for(l=0;l<12;++l)for(_n[l][0]=1,_n[l][l]=1,s=1;s<l;++s)_n[l][s]=_n[l-1][s-1]+_n[l-1][s];for(g=[],l=0;l<40320;++l)k2(g,l),c=g[2],g[2]=g[4],g[4]=c,c=g[3],g[3]=g[5],g[5]=c,Xo[l]=Ho(g),k2(g,l),c=g[0],g[0]=g[1],g[1]=g[2],g[2]=g[3],g[3]=c,Cn[l]=Ho(g),k2(g,l),c=g[4],g[4]=g[5],g[5]=g[6],g[6]=g[7],g[7]=c,zn[l]=Ho(g);for(l=0;l<80640;++l)ve[l]=-1;for(ve[0]=0,t=0,r=1;r<80640;){a=t>=11,n=a?-1:t,e=a?t:-1,++t;e:for(l=0;l<80640;++l)if(ve[l]===n){if(o=~~l>>1,u=l&1,i=Xo[o]<<1|1-u,ve[i]===e&&(++r,ve[a?l:i]=~~(t<<24)>>24,a))continue e;for(i=o,f=0;f<4;++f)if(i=Cn[i],ve[i<<1|u]===e&&(++r,ve[a?l:i<<1|u]=~~(t<<24)>>24,a))continue e;for(f=0;f<4;++f)if(i=zn[i],ve[i<<1|u]===e&&(++r,ve[a?l:i<<1|u]=~~(t<<24)>>24,a))continue e}}}function k2(e,t){var r,n,l,o,i;for(i=1985229328,r=0;r<7;++r)l=Sm[7-r],o=~~(t/l),t-=o*l,o<<=2,e[r]=~~((~~i>>o&7)<<24)>>24,n=(1<<o)-1,i=(i&n)+(~~i>>4&~n);e[7]=~~(i<<24)>>24}function OF(){}function Nn(e){return e-=~~e>>1&1431655765,e=(~~e>>2&858993459)+(e&858993459),e=(~~e>>4)+e&252645135,e+=~~e>>8,e+=~~e>>16,e&63}function vm(e,t){var r,n,l,o;for(n=0,r=e.length-1;n<=r;)if(l=n+(~~(r-n)>>1),o=e[l],o<t)n=l+1;else if(o>t)r=l-1;else return l;return-n-1}async function QF(){return(await KF()).scramble_string}var ke,hm,qo,Tl,je,Vo,Ta,jo,Fm,zn,_n,ve,Cn,Xo,Sm,_2,TF,GF,WF,KF,xm=y(()=>{"use strict";yt();ke=z2.prototype=UF.prototype;ke.dl=10062778;ke.dr=14536702;ke.ml=0;ke.ul=70195;ke.ur=4544119;ke=Dm.prototype=kF.prototype;ke.Search_c=null;ke.Search_length1=0;ke.Search_maxlen2=0;ke.Search_sol_string=null;hm=!1;ke=Am.prototype=PF.prototype;ke.bottom=0;ke.Shape_parity=0;ke.top=0;Fm=!1;ke=ym.prototype=OF.prototype;ke.botEdgeFirst=!1;ke.cornperm=0;ke.edgeperm=0;ke.ml=0;ke.topEdgeFirst=!1;_2=!1,TF=function(e,t,r){_2||(_F(),MF()),r&&r("Done initializing Square-1."),_2=!0,e?.()},GF=async function(){return _2||TF(),xF()},WF=function(e){var t=new Dm;return EF(t,e)},KF=async function(){var e=await GF(),t=WF(e);return{state:e,scramble_string:t}}});var Um={};mt(Um,{getRandomSquare1ScrambleString:()=>QF});var bm=y(()=>{"use strict";xm()});var O2=Symbol("Comlink.proxy"),Im=Symbol("Comlink.endpoint"),Om=Symbol("Comlink.releaseProxy"),Ka=Symbol("Comlink.thrown"),T2=e=>typeof e=="object"&&e!==null||typeof e=="function",Tm={canHandle:e=>T2(e)&&e[O2],serialize(e){let{port1:t,port2:r}=new MessageChannel;return Gl(e,t),[r,[r]]},deserialize(e){return e.start(),Km(e)}},Gm={canHandle:e=>T2(e)&&Ka in e,serialize({value:e}){let t;return e instanceof Error?t={isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:t={isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}},G2=new Map([["proxy",Tm],["throw",Gm]]);function Gl(e,t=self){t.addEventListener("message",function r(n){if(!n||!n.data)return;let{id:l,type:o,path:i}=Object.assign({path:[]},n.data),a=(n.data.argumentList||[]).map(Xr),s;try{let f=i.slice(0,-1).reduce((g,c)=>g[c],e),u=i.reduce((g,c)=>g[c],e);switch(o){case"GET":s=u;break;case"SET":f[i.slice(-1)[0]]=Xr(n.data.value),s=!0;break;case"APPLY":s=u.apply(f,a);break;case"CONSTRUCT":{let g=new u(...a);s=qm(g)}break;case"ENDPOINT":{let{port1:g,port2:c}=new MessageChannel;Gl(e,c),s=jm(g,[g])}break;case"RELEASE":s=void 0;break;default:return}}catch(f){s={value:f,[Ka]:0}}Promise.resolve(s).catch(f=>({value:f,[Ka]:0})).then(f=>{let[u,g]=ja(f);t.postMessage(Object.assign(Object.assign({},u),{id:l}),g),o==="RELEASE"&&(t.removeEventListener("message",r),W2(t))})}),t.start&&t.start()}function Wm(e){return e.constructor.name==="MessagePort"}function W2(e){Wm(e)&&e.close()}function Km(e,t){return Qa(e,[],t)}function Zo(e){if(e)throw new Error("Proxy has been released and is not useable")}function Qa(e,t=[],r=function(){}){let n=!1,l=new Proxy(r,{get(o,i){if(Zo(n),i===Om)return()=>Pn(e,{type:"RELEASE",path:t.map(a=>a.toString())}).then(()=>{W2(e),n=!0});if(i==="then"){if(t.length===0)return{then:()=>l};let a=Pn(e,{type:"GET",path:t.map(s=>s.toString())}).then(Xr);return a.then.bind(a)}return Qa(e,[...t,i])},set(o,i,a){Zo(n);let[s,f]=ja(a);return Pn(e,{type:"SET",path:[...t,i].map(u=>u.toString()),value:s},f).then(Xr)},apply(o,i,a){Zo(n);let s=t[t.length-1];if(s===Im)return Pn(e,{type:"ENDPOINT"}).then(Xr);if(s==="bind")return Qa(e,t.slice(0,-1));let[f,u]=I2(a);return Pn(e,{type:"APPLY",path:t.map(g=>g.toString()),argumentList:f},u).then(Xr)},construct(o,i){Zo(n);let[a,s]=I2(i);return Pn(e,{type:"CONSTRUCT",path:t.map(f=>f.toString()),argumentList:a},s).then(Xr)}});return l}function Qm(e){return Array.prototype.concat.apply([],e)}function I2(e){let t=e.map(ja);return[t.map(r=>r[0]),Qm(t.map(r=>r[1]))]}var K2=new WeakMap;function jm(e,t){return K2.set(e,t),e}function qm(e){return Object.assign(e,{[O2]:!0})}function ja(e){for(let[t,r]of G2)if(r.canHandle(e)){let[n,l]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},l]}return[{type:"RAW",value:e},K2.get(e)||[]]}function Xr(e){switch(e.type){case"HANDLER":return G2.get(e.name).deserialize(e.value);case"RAW":return e.value}}function Pn(e,t,r){return new Promise(n=>{let l=Vm();e.addEventListener("message",function o(i){!i.data||!i.data.id||i.data.id!==l||(e.removeEventListener("message",o),n(i.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:l},t),r)})}function Vm(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function Hm(e){let t=new WeakMap;return{postMessage:e.postMessage.bind(e),addEventListener:(r,n)=>{let l=o=>{"handleEvent"in n?n.handleEvent({data:o}):n({data:o})};e.on("message",l),t.set(n,l)},removeEventListener:(r,n)=>{let l=t.get(n);!l||(e.off("message",l),t.delete(n))},nodeWorker:e}}var Q2=Hm;var Xm=typeof globalThis.Worker>"u"&&typeof globalThis.WorkerNavigator>"u",Zm="node:w-orker-_threa-ds",Jm=()=>Zm.replace(/-/g,"");async function Ym(){let{parentPort:e}=await import(Jm()).catch();return Q2(e)}function j2(e){Xm?(async()=>Gl(e,await Ym()))():Gl(e)}He();ar();At();He();ar();yt();At();fe();fe();fe();var Lo=class extends tn{constructor(r){super();this.metric=r}traverseAlg(r){let n=0;for(let l of r.childAlgNodes())n+=this.traverseAlgNode(l);return n}traverseGrouping(r){let n=r.alg;return this.traverseAlg(n)*Math.abs(r.amount)}traverseMove(r){return this.metric(r)}traverseCommutator(r){return 2*(this.traverseAlg(r.A)+this.traverseAlg(r.B))}traverseConjugate(r){return 2*this.traverseAlg(r.A)+this.traverseAlg(r.B)}traversePause(r){return 0}traverseNewline(r){return 0}traverseLineComment(r){return 0}};function Bu(e){return"A"<=e&&e<="Z"}function VL(e){let t=e.family;return Bu(t[0])&&t[t.length-1]==="v"||t==="x"||t==="y"||t==="z"||t==="T"?0:1}function HL(e){return 1}function XL(e){let t=e.family;return Bu(t[0])&&t[t.length-1]==="v"||t==="x"||t==="y"||t==="z"||t==="T"?0:Math.abs(e.amount)}var Qs=wt(Lo,[VL]),ZL=wt(Lo,[HL]),JL=wt(Lo,[XL]);fe();fe();var js=class extends tn{traverseAlg(t){let r=0;for(let n of t.childAlgNodes())r+=this.traverseAlgNode(n);return r}traverseGrouping(t){return this.traverseAlg(t.alg)*Math.abs(t.amount)}traverseMove(t){return 1}traverseCommutator(t){return 2*(this.traverseAlg(t.A)+this.traverseAlg(t.B))}traverseConjugate(t){return 2*this.traverseAlg(t.A)+this.traverseAlg(t.B)}traversePause(t){return 1}traverseNewline(t){return 0}traverseLineComment(t){return 0}},YL=wt(js);yt();var $L=2,eB=!0,tB=!1;function rB(e,t){let r=[];return t.forEach(function(n){let l=new B(n);if(l.amount!==1)throw new Error("SGS cannot handle def moves with an amount other than 1 yet.");let o=e.identityTransformation();for(let i=1;o=o.applyMove(l),!o.isIdentityTransformation();i++)r.push({move:l.modified({amount:i}),transformation:o})}),r}var zt=class{constructor(t,r,n){this.kpuzzle=t;this.sgs=r;this.searchMoves=rB(this.kpuzzle,n??Object.keys(this.kpuzzle.definition.moves))}async solve(t,r=$L,n){let l=t.experimentalToTransformation();if(!l)throw new Error("distinguishable pieces are not supported in tremble solver yt");let o=null,i=1e6,a=(s,f,u)=>{if(f===0){let g=this.sgsPhaseSolve(s,i);if(!g)return;let c=u.concat(g).experimentalSimplify({cancel:{puzzleSpecificModWrap:"canonical-centered"},puzzleSpecificSimplifyOptions:{quantumMoveOrder:n}}),p=Qs(c);(o===null||p<i)&&(tB&&(console.log(\`New best (\${p} moves): \${c.toString()}\`),console.log(\`Tremble moves are: \${u.toString()}\`)),o=c,i=p);return}for(let g of this.searchMoves)a(s.applyTransformation(g.transformation),f-1,u.concat([g.move]))};for(let s=0;s<=r;s++)a(l,s,new w);if(o===null)throw new Error("SGS search failed.");return o}sgsPhaseSolve(t,r){let n=new Lt,l=t;for(let o of this.sgs.ordering){let i=o.pieceOrdering,a="",s=l.invert();for(let u=0;u<i.length;u++){let g=i[u],c=g.orbitName,p=g.permutationIdx;a+=\` \${s.transformationData[c].permutation[p]} \${s.transformationData[c].orientation[p]}\`}let f=o.lookup[a];if(!f)throw new Error("Missing algorithm in sgs or esgs?");if(n.experimentalPushAlg(f.alg),n.experimentalNumAlgNodes()>=r)return null;if(l=l.applyTransformation(f.transformation),eB)for(let u=0;u<i.length;u++){let g=i[u],c=g.orbitName,p=g.permutationIdx;if(l.transformationData[c].permutation[p]!==p||l.transformationData[c].orientation[p]!==0)throw new Error("bad SGS :-(")}}return n.toAlg()}};async function bi(e,t){let r=await sr(),n=e.identityTransformation();for(let l of t.ordering){let o=r(Object.values(l.lookup));n=n.applyTransformation(o.transformation)}return n.toKState()}Vt();var ft=We(()=>Promise.resolve().then(()=>(xu(),vu)));var LB=3,Uu=null;async function bu(){return Uu||(Uu=(async()=>{let e=await(await ft).cachedData222();return new zt(await Me["2x2x2"].kpuzzle(),e,"URFLBD".split(""))})())}async function wu(){await bu()}async function Zs(e){return be(),await(await bu()).solve(e,LB,()=>4)}async function BB(e,t,r,n){let l=await we();await Lu(r.stateData[t].pieces);let o=e.definition.orbits[t],i=r.stateData[t].orientation,a=0;for(let s=0;s<o.numPieces;s++){let f=l(o.numOrientations);i[s]=f,a+=f}n&&"orientationSum"in n&&(i[0]=((i[0]+n.orientationSum-a)%o.numOrientations+o.numOrientations)%o.numOrientations)}async function dB(){let e=await Me["2x2x2"].kpuzzle(),t=new ce(e,JSON.parse(JSON.stringify(e.startState().stateData)));return await BB(e,"CORNERS",t,{orientationSum:0}),t}async function Eu(){return await Zs(await dB())}A0();wi();Vt();var H0=We(()=>Promise.resolve().then(()=>(Nc(),Cc)));var kR=[[null,"x","x2","x'","z","z'"],[null,"y","y2","y'"]];async function Pc(){return(await H0).initialize()}async function X0(){return(await H0).random444Scramble()}async function Mc(){return ol(await X0(),kR)}wi();fe();yt();function _R(e){switch(e){case 5:return 60;case 6:return 80;default:return 100}}var zR=[["U","D"],["L","R"],["F","B"]],Ic=new Map;function CR(e){let t=Ic.get(e);if(t)return t;let r=[];for(let n of zR){let l=[];r.push(l);for(let o of n){l.push(new _(o)),e>3&&l.push(new _(\`\${o}w\`));for(let i=3;i<=e/2;i++)l.push(new _(\`\${o}w\`,i))}}return Ic.set(e,r),r}async function Lr(e){let t=await we(),r=await sr(),n=r,l=CR(e),o=_R(e),i=new Lt,a=0,s=new Set;for(;i.experimentalNumAlgNodes()<o;){let f=t(3);f!==a&&s.clear(),a=f;let u=r(l[a]),g=u.toString();s.has(g)||(s.add(g),i.push(new B(u,n([1,2,-1]))))}return i.toAlg()}var NR=[[null,"3Rw","3Rw2","3Rw'","3Fw","3Fw'"],[null,"3Dw","3Dw2","3Dw'"]];async function Oc(){return ol(await Lr(5),NR)}fe();ar();Vt();At();Vt();var hp=We(()=>Promise.resolve().then(()=>(Rp(),dp)));var pv=We(()=>Promise.resolve().then(()=>(L2(),m2)));async function zp(){return be(),new w(await(await hp).randomFTOScrambleString())}At();Vt();var qp=We(()=>Promise.resolve().then(()=>(jp(),Qp)));async function Vp(){return be(),(await qp).getRandomKilominxScramble()}fe();At();Vt();var sm=We(()=>Promise.resolve().then(()=>(am(),im)));async function fm(){return be(),new w(await(await sm).randomMasterTetraminxScrambleString())}He();At();var pF=2,um=null;async function mF(){return um||(um=(async()=>{let e=await(await ft).cachedSGSDataMegaminx();return new zt(await(await ft).cachedMegaminxKPuzzleWithoutMO(),e,["U","R","F","L","BR","BL","FR","FL","DR","DL","B","D"])})())}async function gm(e){be();let t=await mF(),r=JSON.parse(JSON.stringify(e.stateData));r.CENTERS.orientation=new Array(12).fill(0);let n=new ce(await(await ft).cachedMegaminxKPuzzleWithoutMO(),r);return await t.solve(n,pF,()=>5)}ar();At();var LF=3,cm=null;async function BF(){return cm||(cm=(async()=>{let e=await(await ft).sgsDataPyraminx();return new zt(await Me.pyraminx.kpuzzle(),e,"RLUB".split(""))})())}async function x2(e){return be(),await(await BF()).solve(e,LF,()=>3)}async function dF(){return be(),bi(await Me.pyraminx.kpuzzle(),await(await ft).sgsDataPyraminxFixedOrientation())}async function pm(){return x2(await dF())}At();Vt();var mm=We(()=>Promise.resolve().then(()=>(L2(),m2)));async function Lm(){return be(),(await mm).getRandomRediCubeScramble()}He();At();var RF=3,Bm=null;async function hF(){return Bm||(Bm=(async()=>{let e=await(await ft).sgsDataSkewb();return new zt(await(await ft).skewbKPuzzleWithoutMOCached(),e,"RLUB".split(""))})())}function FF(e){return new ce(e.kpuzzle,{CORNERS:e.stateData.CORNERS,CENTERS:{pieces:e.stateData.CENTERS.pieces,orientation:new Array(6).fill(0)}})}async function U2(e){return be(),await(await hF()).solve(FF(e),RF,n=>n.family==="y"?4:3)}async function DF(){return bi(await(await ft).skewbKPuzzleWithoutMOCached(),await(await ft).sgsDataSkewbFixedCorner())}async function dm(){return U2(await DF())}fe();Vt();var wm=We(()=>Promise.resolve().then(()=>(bm(),Um)));async function Em(){return w.fromString(await(await wm).getRandomSquare1ScrambleString())}var jF=1e3;uu(!0);var zm=!0;function qF(e){zm=e}function km(){return(typeof performance>"u"?Date:performance).now()}async function _e(e,t,r){if(!zm)return t();let n=km(),l=t();l?.then&&await l;let o=km();return console.warn(\`\${e}\${r?.isPrefetch?" (prefetched)":""}: \${Math.round(o-n)}ms\`),l}var C2=new Map,N2=null;async function _m(e,t){switch(e){case"222":return _e("random222Scramble",Eu,{isPrefetch:t?.isPrefetch});case"333":case"333oh":case"333ft":return _e("random333Scramble",dl,{isPrefetch:t?.isPrefetch});case"333fm":return _e("random333FewestMovesScramble",Sg);case"333bf":case"333mb":return _e("random333OrientedScramble",yg);case"444":return _e("random444Scramble",X0,{isPrefetch:t?.isPrefetch});case"444bf":return _e("random444OrientedScramble",Mc);case"555":return _e("bigCubeScramble(5)",Lr.bind(Lr,5));case"555bf":return _e("oriented555RandomMoves",Oc);case"666":return _e("bigCubeScramble(6)",Lr.bind(Lr,6));case"777":return _e("bigCubeScramble(7)",Lr.bind(Lr,7));case"skewb":return _e("randomSkewbFixedCornerScramble",dm);case"pyram":return _e("randomPyraminxScrambleFixedOrientation",pm);case"sq1":return _e("getRandomSquare1Scramble",Em,{isPrefetch:t?.isPrefetch});case"fto":return _e("randomFTOScramble",zp,{isPrefetch:t?.isPrefetch});case"master_tetraminx":return _e("randomMasterTetraminxScramble",fm);case"kilominx":return _e("randomKilominxScramble",Vp,{isPrefetch:t?.isPrefetch});case"redi_cube":return _e("randomRediCubeScramble",Lm,{isPrefetch:t?.isPrefetch});default:throw new Error(\`unsupported event: \${e}\`)}}var P2="auto",M2={initialize:async e=>{switch(e){case"222":return _e("preInitialize222",wu);case"333":case"333oh":case"333ft":return _e("initialize333",Ag);case"444":return _e("initialize444",Pc);default:throw new Error(\`unsupported event: \${e}\`)}},setScramblePrefetchLevel(e){P2=e},randomScrambleForEvent:async e=>{let t=C2.get(e);return t?C2.delete(e):t=_m(e),P2!=="none"&&t.then(()=>{N2&&clearTimeout(N2),N2=setTimeout(()=>{C2.set(e,_m(e,{isPrefetch:!0}))},P2==="immediate"?0:jF)}),t},randomScrambleStringForEvent:async e=>(await M2.randomScrambleForEvent(e)).toString(),solve333ToString:async e=>{let t=new ce(await Me["3x3x3"].kpuzzle(),e);return(await D0(t)).toString()},solve222ToString:async e=>{let t=new ce(await Me["2x2x2"].kpuzzle(),e);return(await Zs(t)).toString()},solveSkewbToString:async e=>{let t=new ce(await Me.skewb.kpuzzle(),e);return(await U2(t)).toString()},solvePyraminxToString:async e=>{let t=new ce(await Me.pyraminx.kpuzzle(),e);return(await x2(t)).toString()},solveMegaminxToString:async e=>{let t=new ce(await Me.megaminx.kpuzzle(),e);return(await gm(t)).toString()},setDebugMeasurePerf:async e=>{qF(e)}};j2(M2);
|
|
3880
3880
|
`;
|
|
3881
3881
|
export {
|
|
3882
3882
|
workerSource
|
|
3883
3883
|
};
|
|
3884
|
-
//# sourceMappingURL=search-worker-inside-generated-string-
|
|
3884
|
+
//# sourceMappingURL=search-worker-inside-generated-string-LBOAERDX.js.map
|