cubing 0.21.1 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{src/cubing/search → dist}/.DS_Store +0 -0
- package/dist/bundle-global/cubing.bundle-global.js +52 -52
- package/dist/esm/twisty/index.js +11 -6
- package/dist/esm/twisty/index.js.map +2 -2
- package/{src/cubing/kpuzzle → dist/types}/.DS_Store +0 -0
- package/dist/types/cubing.bundle-global.d.ts +1 -24
- package/dist/types/cubing.bundle-global.d.ts.map +1 -1
- package/dist/types/twisty/index.d.ts +1 -1
- package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts +1 -1
- package/dist/types/twisty/views/3D/Twisty3DVantage.d.ts.map +1 -1
- package/docs/.DS_Store +0 -0
- package/docs/cubing/.DS_Store +0 -0
- package/package.json +1 -1
- package/src/cubing/.DS_Store +0 -0
- package/src/cubing/cubing.bundle-global.ts +5 -1
- package/src/cubing/twisty/.DS_Store +0 -0
- package/src/cubing/twisty/index.ts +1 -1
- package/src/cubing/twisty/views/.DS_Store +0 -0
- package/src/cubing/twisty/{model → views/3D}/.DS_Store +0 -0
- package/src/cubing/twisty/views/3D/Twisty3DVantage.ts +15 -5
- package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts +0 -9
- package/dist/types/twisty/views/3D/puzzles/TwistyTestBox.d.ts.map +0 -1
- package/src/cubing/alg/.DS_Store +0 -0
- package/src/cubing/alg/units/.DS_Store +0 -0
- package/src/cubing/bluetooth/.DS_Store +0 -0
- package/src/cubing/puzzles/.DS_Store +0 -0
- package/src/cubing/puzzles/implementations/.DS_Store +0 -0
- package/src/cubing/stream/.DS_Store +0 -0
- package/src/cubing/twisty/model/props/.DS_Store +0 -0
- package/src/cubing/twisty/model/props/puzzle/.DS_Store +0 -0
- package/src/cubing/twisty/old/.DS_Store +0 -0
- package/src/cubing/twisty/old/animation/.DS_Store +0 -0
- package/src/cubing/twisty/old/animation/indexer/.DS_Store +0 -0
- package/src/cubing/twisty/old/dom/.DS_Store +0 -0
- package/src/cubing/twisty/views/3D/puzzles/TwistyTestBox.ts +0 -22
- package/src/cubing/vendor/.DS_Store +0 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
var SE=Object.create;var Ph=Object.defineProperty;var LE=Object.getOwnPropertyDescriptor;var AE=Object.getOwnPropertyNames;var DE=Object.getPrototypeOf,EE=Object.prototype.hasOwnProperty;var
|
|
2
|
-
`)||e.includes("\r"))throw new Error("LineComment cannot contain newline");$(this,Kr,e)}get text(){return S(this,Kr)}isIdentical(e){let t=e;return e.is(
|
|
3
|
-
`}isIdentical(e){return e.is(Ln)}invert(){return this}*experimentalExpand(e=Ce.Forwards,t=1/0){yield this}}});var An,pu=oe(()=>{ur();Si();An=class extends cn{toString(){return"."}isIdentical(e){return e.is(An)}invert(){return this}*experimentalExpand(e=Ce.Forwards,t=1/0){yield this}}});function Uh(r,e){return r?parseInt(r):e}function
|
|
4
|
-
`)){i.push(_n(new Ln,a,S(this,Ne))),o=!1,n=S(this,Ne);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){s(a);let[l]=this.parseRegex(CE);i.push(_n(new hi(l),a,S(this,Ne))),o=!1,n=S(this,Ne);continue e}else{i.push(_n(new E("_SLASH_"),a,S(this,Ne))),o=!0,n=S(this,Ne);continue e}else if(this.tryConsumeNext(".")){s(a),i.push(_n(new An,a,S(this,Ne))),o=!0,n=S(this,Ne);continue e}else throw new Error(`Unexpected character: ${this.popNext()}`)}if(S(this,Ne)!==S(this,On).length)throw new Error("did not finish parsing?");if(e.length>0)throw new Error("expected stopping");return _n(i.toAlg(),t,n)}parseQuantumMoveImpl(){let[,,,e,t,n]=this.parseRegex(_E);return new ze(n,Uh(t,void 0),Uh(e,void 0))}parseMoveImpl(){let e=S(this,Ne);if(this.tryConsumeNext("/"))return _n(new E("_SLASH_"),e,S(this,Ne));let t=this.parseQuantumMoveImpl(),[n,i]=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==="--")&&!i)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((o==="+"||o==="-")&&i)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");o.startsWith("+")&&(t=t.modified({family:`${t.family}_${o==="+"?"PLUS":"PLUSPLUS"}_`})),o.startsWith("-")&&(t=t.modified({family:`${t.family}_${o==="-"?"PLUS":"PLUSPLUS"}_`}),n*=-1)}return _n(new E(t,n),e,S(this,Ne))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let e=S(this,Ne),[,t,n]=this.parseRegex(hv);if(t?.startsWith("0")&&t!=="0")throw new Error(`Error at char index ${e}: An amount can only start with 0 if it's exactly the digit 0.`);return[Uh(t,1)*(n==="'"?-1:1),!t]}parseAmount(){let e=S(this,Ne),[,t,n]=this.parseRegex(hv);if(t?.startsWith("0")&&t!=="0")throw new Error(`Error at char index ${e}: An amount number can only start with 0 if it's exactly the digit 0.`);return Uh(t,1)*(n==="'"?-1:1)}parseRegex(e){let t=e.exec(this.remaining());if(t===null)throw new Error("internal parsing error");return $(this,Ne,S(this,Ne)+t[0].length),t}tryRegex(e){let t=e.exec(this.remaining());return t===null?null:($(this,Ne,S(this,Ne)+t[0].length),t)}remaining(){return S(this,On).slice(S(this,Ne))}popNext(){let e=S(this,On)[S(this,Ne)];return sa(this,Ne)._++,e}tryConsumeNext(e){return S(this,On)[S(this,Ne)]===e?(sa(this,Ne)._++,!0):!1}mustConsumeNext(e){let t=this.popNext();if(t!==e)throw new Error(`expected \`${e}\` while parsing, encountered ${t}`);return t}};On=new WeakMap,Ne=new WeakMap});function Gh(r){mv.has(r)||(console.warn(r),mv.add(r))}var mv,Qm=oe(()=>{mv=new Set});var ca,Ym=oe(()=>{Si();Wm();ca=class{constructor(e,t=1){if(this.quantum=e,this.amount=t,!Number.isInteger(this.amount)||this.amount<cv||this.amount>lu)throw new Error(`Unit amount absolute value must be a non-negative integer from ${aa} to ${aa}.`)}suffix(){let e="",t=Math.abs(this.amount);return t!==1&&(e+=t),this.amount<0&&(e+="'"),e}isIdentical(e){return this.quantum.isIdentical(e.quantum)&&this.amount===e.amount}*experimentalExpand(e,t){let n=Math.abs(this.amount),i=lv(e,this.amount<0);for(let o=0;o<n;o++)yield*this.quantum.experimentalExpand(i,t)}}});var hr,hn,fn,Wh,ze,rn,ha,E,Zr=oe(()=>{ur();Si();Wm();jm();Qm();Ym();Wh=class extends kh{constructor(e,t,n){super();H(this,hr,void 0);H(this,hn,void 0);H(this,fn,void 0);if($(this,hr,e),$(this,hn,t??null),$(this,fn,n??null),Object.freeze(this),S(this,hn)!==null&&(!Number.isInteger(S(this,hn))||S(this,hn)<1||S(this,hn)>lu))throw new Error(`QuantumMove inner layer must be a positive integer below ${aa}.`);if(S(this,fn)!==null&&(!Number.isInteger(S(this,fn))||S(this,fn)<1||S(this,fn)>lu))throw new Error(`QuantumMove outer layer must be a positive integer below ${aa}.`);if(S(this,fn)!==null&&S(this,hn)!==null&&S(this,hn)<=S(this,fn))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(S(this,fn)!==null&&S(this,hn)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(e){return pv(e)}modified(e){return new Wh(e.family??S(this,hr),e.innerLayer??S(this,hn),e.outerLayer??S(this,fn))}isIdentical(e){let t=e;return e.is(Wh)&&S(this,hr)===S(t,hr)&&S(this,hn)===S(t,hn)&&S(this,fn)===S(t,fn)}get family(){return S(this,hr)}get outerLayer(){return S(this,fn)}get innerLayer(){return S(this,hn)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a `QuantumMove` directly.")}toString(){let e=S(this,hr);return S(this,hn)!==null&&(e=String(S(this,hn))+e,S(this,fn)!==null&&(e=String(S(this,fn))+"-"+e)),e}},ze=Wh;hr=new WeakMap,hn=new WeakMap,fn=new WeakMap;ha=class extends cn{constructor(...e){super();H(this,rn,void 0);if(typeof e[0]=="string")if(e[1]??null){$(this,rn,new ca(ze.fromString(e[0]),e[1]));return}else return ha.fromString(e[0]);$(this,rn,new ca(e[0],e[1]))}isIdentical(e){let t=e.as(ha);return!!t&&S(this,rn).isIdentical(S(t,rn))}invert(){return dv(this,new ha(S(this,rn).quantum,-this.amount))}*experimentalExpand(e=Ce.Forwards){e===Ce.Forwards?yield this:yield this.modified({amount:-this.amount})}get quantum(){return S(this,rn).quantum}modified(e){return new ha(S(this,rn).quantum.modified(e),e.amount??this.amount)}static fromString(e){return fv(e)}get amount(){return S(this,rn).amount}get type(){return Gh("deprecated: type"),"blockMove"}get family(){return S(this,rn).quantum.family??void 0}get outerLayer(){return S(this,rn).quantum.outerLayer??void 0}get innerLayer(){return S(this,rn).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return S(this,rn).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let e=Math.abs(this.amount);return S(this,rn).quantum.toString().slice(0,-10)+(e===1?"":e)+(this.amount<0?"--":"++")}return S(this,rn).quantum.toString()+S(this,rn).suffix()}},E=ha;rn=new WeakMap});var gv,yv,Gn,Vh,nn,Oh=oe(()=>{cr();ur();Si();Zr();Ym();gv=class{constructor(){this.quantumU_SQ_=null;this.quantumD_SQ_=null}format(e){let t=this.tuple(e);return t?`(${t.map(n=>n.amount).join(", ")})`:null}tuple(e){this.quantumU_SQ_||(this.quantumU_SQ_=new ze("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new ze("D_SQ_"));let t=e.alg;if(t.experimentalNumUnits()===2){let[n,i]=t.units();if(n.as(E)?.quantum.isIdentical(this.quantumU_SQ_)&&i.as(E)?.quantum.isIdentical(this.quantumD_SQ_)){if(e.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[n,i]}}return null}},yv=new gv,Vh=class extends cn{constructor(e,t){super();H(this,Gn,void 0);let n=Xr(e);$(this,Gn,new ca(n,t))}isIdentical(e){let t=e;return e.is(Vh)&&S(this,Gn).isIdentical(S(t,Gn))}get alg(){return S(this,Gn).quantum}get amount(){return S(this,Gn).amount}get experimentalRepetitionSuffix(){return S(this,Gn).suffix()}invert(){return new Vh(S(this,Gn).quantum,-S(this,Gn).amount)}*experimentalExpand(e=Ce.Forwards,t){t??(t=1/0),t===0?yield e===Ce.Forwards?this:this.invert():yield*S(this,Gn).experimentalExpand(e,t-1)}static fromString(){throw new Error("unimplemented")}toString(){return yv.format(this)??`(${S(this,Gn).quantum.toString()})${S(this,Gn).suffix()}`}experimentalAsSquare1Tuple(){return yv.tuple(this)}},nn=Vh;Gn=new WeakMap});var Hh=oe(()=>{Oh();hu();uu();cu();Zr();fu();pu()});function Wn(r,e){return r instanceof e}function vv(r){return Wn(r,nn)||Wn(r,hi)||Wn(r,tn)||Wn(r,Nt)||Wn(r,E)||Wn(r,Ln)||Wn(r,An)}var Xm=oe(()=>{Hh()});function xv(r,e,t){if(e.is(nn))return r.traverseGrouping(e,t);if(e.is(E))return r.traverseMove(e,t);if(e.is(tn))return r.traverseCommutator(e,t);if(e.is(Nt))return r.traverseConjugate(e,t);if(e.is(An))return r.traversePause(e,t);if(e.is(Ln))return r.traverseNewline(e,t);if(e.is(hi))return r.traverseLineComment(e,t);throw new Error("unknown unit")}function wv(r){if(r.is(nn)||r.is(E)||r.is(tn)||r.is(Nt)||r.is(An)||r.is(Ln)||r.is(hi))return r;throw"internal error: expected unit"}var ri,Cn,qh,BE,Zm,Km,bv,Sv,Jm=oe(()=>{Oh();uu();Zr();fu();pu();cu();hu();ri=class{traverseUnit(e,t){return xv(this,e,t)}traverseIntoUnit(e,t){return wv(this.traverseUnit(e,t))}},Cn=class extends ri{traverseUnit(e){return xv(this,e,void 0)}traverseIntoUnit(e){return wv(this.traverseUnit(e))}},Zm=class extends ri{*traverseAlg(e,t){if(t.depth===0){yield*e.units();return}let n=[],i=null,o=t?.collapseMoves??!0;function s(u,c){var p;let f=ye(p=Zm,qh,BE).call(p,u,c,t);if(f===0)return!1;let h=new E(u.quantum,f);return n.push(h),i=h,!0}function a(u){o&&i?.is(E)&&u.is(E)&&i.quantum.isIdentical(u.quantum)?(n.pop(),s(i,u.amount)||(i=n.slice(-1)[0])):u.is(E)?s(u,0):(n.push(u),i=u)}let l={depth:t.depth?t.depth-1:null};for(let u of e.units())for(let c of this.traverseUnit(u,l))a(c);for(let u of n)yield u}*traverseGrouping(e,t){if(t.depth===0){yield e;return}let n={depth:t.depth?t.depth-1:null};yield new nn(this.traverseAlg(e.alg,n))}*traverseMove(e,t){yield e}*traverseCommutator(e,t){if(t.depth===0){yield e;return}let n={depth:t.depth?t.depth-1:null};yield new tn(this.traverseAlg(e.A,n),this.traverseAlg(e.B,n))}*traverseConjugate(e,t){if(t.depth===0){yield e;return}let n={depth:t.depth?t.depth-1:null};yield new Nt(this.traverseAlg(e.A,n),this.traverseAlg(e.B,n))}*traversePause(e,t){yield e}*traverseNewline(e,t){yield e}*traverseLineComment(e,t){yield e}},Km=Zm;qh=new WeakSet,BE=function(e,t,n){let i=e.amount+t;if(n?.quantumMoveOrder){let o=n.quantumMoveOrder(e.quantum),s=Math.floor(o/2)+1-o;i=(i%o+o-s)%o+s}return i},H(Km,qh);bv=new Km,Sv=bv.traverseAlg.bind(bv)});function Lv(r){if(!r)return[];if(Wn(r,re))return r.units();if(typeof r=="string")return qm(r).units();let e=r;if(typeof e[Symbol.iterator]=="function")return e;throw"Invalid unit"}function Xr(r){return Wn(r,re)?r:new re(r)}function zE(r,e){return r.is(Ln)||e.is(Ln)?"":r.is(hi)&&!e.is(Ln)?`
|
|
5
|
-
`:" "}var Vn,Qo,re,cr=oe(()=>{ur();
|
|
1
|
+
var SE=Object.create;var Ph=Object.defineProperty;var LE=Object.getOwnPropertyDescriptor;var AE=Object.getOwnPropertyNames;var DE=Object.getPrototypeOf,EE=Object.prototype.hasOwnProperty;var av=r=>Ph(r,"__esModule",{value:!0});var oe=(r,e)=>()=>(r&&(e=r(r=0)),e);var _t=(r,e)=>{av(r);for(var t in e)Ph(r,t,{get:e[t],enumerable:!0})},ME=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of AE(e))!EE.call(r,n)&&n!=="default"&&Ph(r,n,{get:()=>e[n],enumerable:!(t=LE(e,n))||t.enumerable});return r},lv=r=>ME(av(Ph(r!=null?SE(DE(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var Wm=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var S=(r,e,t)=>(Wm(r,e,"read from private field"),t?t.call(r):e.get(r)),H=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)},$=(r,e,t,n)=>(Wm(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),sa=(r,e,t,n)=>({set _(i){$(r,e,i,t)},get _(){return S(r,e,n)}}),ye=(r,e,t)=>(Wm(r,e,"access private method"),t);var RE,kh,cn,ur=oe(()=>{RE=!1,kh=class{is(e){return this instanceof e}as(e){return this instanceof e?this:null}},cn=class extends kh{constructor(){super();RE&&Object.defineProperty(this,"_debugStr",{get:()=>this.toString()})}get log(){return console.log.bind(console,this,this.toString())}}});function uv(r,e=!0){if(!e)return r;switch(r){case 1:return-1;case-1:return 1}}function Yr(r,e){return e===-1?Array.from(r).reverse():r}function cv(r){return Array.from(r).reverse()}function*Bh(r,e){e===-1?yield*TE(r):yield*r}function*TE(r){for(let e of Array.from(r).reverse())yield e}var Ce,Si=oe(()=>{(function(t){t[t.Forwards=1]="Forwards",t[t.Backwards=-1]="Backwards"})(Ce||(Ce={}))});var lu,aa,hv,Vm=oe(()=>{lu=2147483647,aa="2^31 - 1",hv=-2147483648});var Ho,Gi,Hm=oe(()=>{cr();Gi=class{constructor(){H(this,Ho,[])}push(e){S(this,Ho).push(e)}experimentalPushAlg(e){for(let t of e.units())this.push(t)}experimentalNumUnits(){return S(this,Ho).length}toAlg(){return new re(S(this,Ho))}reset(){$(this,Ho,[])}};Ho=new WeakMap});var qo,jo,zh,tn,uu=oe(()=>{cr();ur();Si();zh=class extends cn{constructor(e,t){super();H(this,qo,void 0);H(this,jo,void 0);$(this,qo,Xr(e)),$(this,jo,Xr(t))}get A(){return S(this,qo)}get B(){return S(this,jo)}isIdentical(e){let t=e.as(zh);return!!(t?.A.isIdentical(this.A)&&t?.B.isIdentical(this.B))}invert(){return new zh(S(this,jo),S(this,qo))}*experimentalExpand(e=Ce.Forwards,t){t??(t=1/0),t===0?yield e===Ce.Forwards?this:this.invert():e===Ce.Forwards?(yield*this.A.experimentalExpand(Ce.Forwards,t-1),yield*this.B.experimentalExpand(Ce.Forwards,t-1),yield*this.A.experimentalExpand(Ce.Backwards,t-1),yield*this.B.experimentalExpand(Ce.Backwards,t-1)):(yield*this.B.experimentalExpand(Ce.Forwards,t-1),yield*this.A.experimentalExpand(Ce.Forwards,t-1),yield*this.B.experimentalExpand(Ce.Backwards,t-1),yield*this.A.experimentalExpand(Ce.Backwards,t-1))}toString(){return`[${S(this,qo).toString()}, ${S(this,jo).toString()}]`}},tn=zh;qo=new WeakMap,jo=new WeakMap});var la,ua,Ih,Nt,cu=oe(()=>{cr();ur();Si();Ih=class extends cn{constructor(e,t){super();H(this,la,void 0);H(this,ua,void 0);$(this,la,Xr(e)),$(this,ua,Xr(t))}get A(){return S(this,la)}get B(){return S(this,ua)}isIdentical(e){let t=e.as(Ih);return!!(t?.A.isIdentical(this.A)&&t?.B.isIdentical(this.B))}invert(){return new Ih(S(this,la),S(this,ua).invert())}*experimentalExpand(e,t){t??(t=1/0),t===0?yield e===Ce.Forwards?this:this.invert():(yield*this.A.experimentalExpand(Ce.Forwards,t-1),yield*this.B.experimentalExpand(e,t-1),yield*this.A.experimentalExpand(Ce.Backwards,t-1))}toString(){return`[${this.A}: ${this.B}]`}},Nt=Ih;la=new WeakMap,ua=new WeakMap});var Kr,qm,hi,hu=oe(()=>{ur();Si();qm=class extends cn{constructor(e){super();H(this,Kr,void 0);if(e.includes(`
|
|
2
|
+
`)||e.includes("\r"))throw new Error("LineComment cannot contain newline");$(this,Kr,e)}get text(){return S(this,Kr)}isIdentical(e){let t=e;return e.is(qm)&&S(this,Kr)===S(t,Kr)}invert(){return this}*experimentalExpand(e=Ce.Forwards,t=1/0){yield this}toString(){return`//${S(this,Kr)}`}},hi=qm;Kr=new WeakMap});var Ln,fu=oe(()=>{ur();Si();Ln=class extends cn{toString(){return`
|
|
3
|
+
`}isIdentical(e){return e.is(Ln)}invert(){return this}*experimentalExpand(e=Ce.Forwards,t=1/0){yield this}}});var An,pu=oe(()=>{ur();Si();An=class extends cn{toString(){return"."}isIdentical(e){return e.is(An)}invert(){return this}*experimentalExpand(e=Ce.Forwards,t=1/0){yield this}}});function Uh(r,e){return r?parseInt(r):e}function jm(r){return new Nh().parseAlg(r)}function pv(r){return new Nh().parseMove(r)}function dv(r){return new Nh().parseQuantumMove(r)}function _n(r,e,t){let n=r;return n.startCharIndex=e,n.endCharIndex=t,n}function mv(r,e){return"startCharIndex"in r&&(e.startCharIndex=r.startCharIndex),"endCharIndex"in r&&(e.endCharIndex=r.endCharIndex),e}var fv,FE,_E,CE,PE,kE,On,Ne,Nh,Qm=oe(()=>{cr();Hm();uu();cu();Oh();hu();Zr();fu();pu();fv=/^(\d+)?('?)/,FE=/^[_\dA-Za-z]/,_E=/^((([1-9]\d*)-)?([1-9]\d*))?([_A-Za-z]+)?/,CE=/^[^\n]*/,PE=/^(-?\d+), ?/,kE=/^(-?\d+)\)/;Nh=class{constructor(){H(this,On,"");H(this,Ne,0)}parseAlg(e){$(this,On,e),$(this,Ne,0);let t=this.parseAlgWithStopping([]);return this.mustBeAtEndOfInput(),t}parseMove(e){$(this,On,e),$(this,Ne,0);let t=this.parseMoveImpl();return this.mustBeAtEndOfInput(),t}parseQuantumMove(e){$(this,On,e),$(this,Ne,0);let t=this.parseQuantumMoveImpl();return this.mustBeAtEndOfInput(),t}mustBeAtEndOfInput(){if(S(this,Ne)!==S(this,On).length)throw new Error("parsing unexpectedly ended early")}parseAlgWithStopping(e){let t=S(this,Ne),n=S(this,Ne),i=new Gi,o=!1,s=a=>{if(o)throw new Error(`Unexpected character at index ${a}. Are you missing a space?`)};e:for(;S(this,Ne)<S(this,On).length;){let a=S(this,Ne);if(e.includes(S(this,On)[S(this,Ne)]))return _n(i.toAlg(),t,n);if(this.tryConsumeNext(" ")){o=!1,i.experimentalNumUnits()===0&&(t=S(this,Ne));continue e}else if(FE.test(S(this,On)[S(this,Ne)])){s(a);let l=this.parseMoveImpl();i.push(l),o=!0,n=S(this,Ne);continue e}else if(this.tryConsumeNext("(")){s(a);let l=this.tryRegex(PE);if(l){let u=l[1],c=S(this,Ne),f=this.parseRegex(kE),h=_n(new E(new ze("U_SQ_"),parseInt(u)),a+1,a+1+u.length),p=_n(new E(new ze("D_SQ_"),parseInt(f[1])),c,S(this,Ne)-1),d=_n(new re([h,p]),a+1,S(this,Ne)-1);i.push(_n(new nn(d),a,S(this,Ne))),o=!0,n=S(this,Ne);continue e}else{let u=this.parseAlgWithStopping([")"]);this.mustConsumeNext(")");let c=this.parseAmount();i.push(_n(new nn(u,c),a,S(this,Ne))),o=!0,n=S(this,Ne);continue e}}else if(this.tryConsumeNext("[")){s(a);let l=this.parseAlgWithStopping([",",":"]),u=this.popNext(),c=this.parseAlgWithStopping(["]"]);switch(this.mustConsumeNext("]"),u){case":":i.push(_n(new Nt(l,c),a,S(this,Ne))),o=!0,n=S(this,Ne);continue e;case",":i.push(_n(new tn(l,c),a,S(this,Ne))),o=!0,n=S(this,Ne);continue e;default:throw"unexpected parsing error"}}else if(this.tryConsumeNext(`
|
|
4
|
+
`)){i.push(_n(new Ln,a,S(this,Ne))),o=!1,n=S(this,Ne);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){s(a);let[l]=this.parseRegex(CE);i.push(_n(new hi(l),a,S(this,Ne))),o=!1,n=S(this,Ne);continue e}else{i.push(_n(new E("_SLASH_"),a,S(this,Ne))),o=!0,n=S(this,Ne);continue e}else if(this.tryConsumeNext(".")){s(a),i.push(_n(new An,a,S(this,Ne))),o=!0,n=S(this,Ne);continue e}else throw new Error(`Unexpected character: ${this.popNext()}`)}if(S(this,Ne)!==S(this,On).length)throw new Error("did not finish parsing?");if(e.length>0)throw new Error("expected stopping");return _n(i.toAlg(),t,n)}parseQuantumMoveImpl(){let[,,,e,t,n]=this.parseRegex(_E);return new ze(n,Uh(t,void 0),Uh(e,void 0))}parseMoveImpl(){let e=S(this,Ne);if(this.tryConsumeNext("/"))return _n(new E("_SLASH_"),e,S(this,Ne));let t=this.parseQuantumMoveImpl(),[n,i]=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==="--")&&!i)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((o==="+"||o==="-")&&i)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");o.startsWith("+")&&(t=t.modified({family:`${t.family}_${o==="+"?"PLUS":"PLUSPLUS"}_`})),o.startsWith("-")&&(t=t.modified({family:`${t.family}_${o==="-"?"PLUS":"PLUSPLUS"}_`}),n*=-1)}return _n(new E(t,n),e,S(this,Ne))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let e=S(this,Ne),[,t,n]=this.parseRegex(fv);if(t?.startsWith("0")&&t!=="0")throw new Error(`Error at char index ${e}: An amount can only start with 0 if it's exactly the digit 0.`);return[Uh(t,1)*(n==="'"?-1:1),!t]}parseAmount(){let e=S(this,Ne),[,t,n]=this.parseRegex(fv);if(t?.startsWith("0")&&t!=="0")throw new Error(`Error at char index ${e}: An amount number can only start with 0 if it's exactly the digit 0.`);return Uh(t,1)*(n==="'"?-1:1)}parseRegex(e){let t=e.exec(this.remaining());if(t===null)throw new Error("internal parsing error");return $(this,Ne,S(this,Ne)+t[0].length),t}tryRegex(e){let t=e.exec(this.remaining());return t===null?null:($(this,Ne,S(this,Ne)+t[0].length),t)}remaining(){return S(this,On).slice(S(this,Ne))}popNext(){let e=S(this,On)[S(this,Ne)];return sa(this,Ne)._++,e}tryConsumeNext(e){return S(this,On)[S(this,Ne)]===e?(sa(this,Ne)._++,!0):!1}mustConsumeNext(e){let t=this.popNext();if(t!==e)throw new Error(`expected \`${e}\` while parsing, encountered ${t}`);return t}};On=new WeakMap,Ne=new WeakMap});function Gh(r){gv.has(r)||(console.warn(r),gv.add(r))}var gv,Ym=oe(()=>{gv=new Set});var ca,Xm=oe(()=>{Si();Vm();ca=class{constructor(e,t=1){if(this.quantum=e,this.amount=t,!Number.isInteger(this.amount)||this.amount<hv||this.amount>lu)throw new Error(`Unit amount absolute value must be a non-negative integer from ${aa} to ${aa}.`)}suffix(){let e="",t=Math.abs(this.amount);return t!==1&&(e+=t),this.amount<0&&(e+="'"),e}isIdentical(e){return this.quantum.isIdentical(e.quantum)&&this.amount===e.amount}*experimentalExpand(e,t){let n=Math.abs(this.amount),i=uv(e,this.amount<0);for(let o=0;o<n;o++)yield*this.quantum.experimentalExpand(i,t)}}});var hr,hn,fn,Wh,ze,rn,ha,E,Zr=oe(()=>{ur();Si();Vm();Qm();Ym();Xm();Wh=class extends kh{constructor(e,t,n){super();H(this,hr,void 0);H(this,hn,void 0);H(this,fn,void 0);if($(this,hr,e),$(this,hn,t??null),$(this,fn,n??null),Object.freeze(this),S(this,hn)!==null&&(!Number.isInteger(S(this,hn))||S(this,hn)<1||S(this,hn)>lu))throw new Error(`QuantumMove inner layer must be a positive integer below ${aa}.`);if(S(this,fn)!==null&&(!Number.isInteger(S(this,fn))||S(this,fn)<1||S(this,fn)>lu))throw new Error(`QuantumMove outer layer must be a positive integer below ${aa}.`);if(S(this,fn)!==null&&S(this,hn)!==null&&S(this,hn)<=S(this,fn))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(S(this,fn)!==null&&S(this,hn)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(e){return dv(e)}modified(e){return new Wh(e.family??S(this,hr),e.innerLayer??S(this,hn),e.outerLayer??S(this,fn))}isIdentical(e){let t=e;return e.is(Wh)&&S(this,hr)===S(t,hr)&&S(this,hn)===S(t,hn)&&S(this,fn)===S(t,fn)}get family(){return S(this,hr)}get outerLayer(){return S(this,fn)}get innerLayer(){return S(this,hn)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a `QuantumMove` directly.")}toString(){let e=S(this,hr);return S(this,hn)!==null&&(e=String(S(this,hn))+e,S(this,fn)!==null&&(e=String(S(this,fn))+"-"+e)),e}},ze=Wh;hr=new WeakMap,hn=new WeakMap,fn=new WeakMap;ha=class extends cn{constructor(...e){super();H(this,rn,void 0);if(typeof e[0]=="string")if(e[1]??null){$(this,rn,new ca(ze.fromString(e[0]),e[1]));return}else return ha.fromString(e[0]);$(this,rn,new ca(e[0],e[1]))}isIdentical(e){let t=e.as(ha);return!!t&&S(this,rn).isIdentical(S(t,rn))}invert(){return mv(this,new ha(S(this,rn).quantum,-this.amount))}*experimentalExpand(e=Ce.Forwards){e===Ce.Forwards?yield this:yield this.modified({amount:-this.amount})}get quantum(){return S(this,rn).quantum}modified(e){return new ha(S(this,rn).quantum.modified(e),e.amount??this.amount)}static fromString(e){return pv(e)}get amount(){return S(this,rn).amount}get type(){return Gh("deprecated: type"),"blockMove"}get family(){return S(this,rn).quantum.family??void 0}get outerLayer(){return S(this,rn).quantum.outerLayer??void 0}get innerLayer(){return S(this,rn).quantum.innerLayer??void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return S(this,rn).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let e=Math.abs(this.amount);return S(this,rn).quantum.toString().slice(0,-10)+(e===1?"":e)+(this.amount<0?"--":"++")}return S(this,rn).quantum.toString()+S(this,rn).suffix()}},E=ha;rn=new WeakMap});var yv,vv,Gn,Vh,nn,Oh=oe(()=>{cr();ur();Si();Zr();Xm();yv=class{constructor(){this.quantumU_SQ_=null;this.quantumD_SQ_=null}format(e){let t=this.tuple(e);return t?`(${t.map(n=>n.amount).join(", ")})`:null}tuple(e){this.quantumU_SQ_||(this.quantumU_SQ_=new ze("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new ze("D_SQ_"));let t=e.alg;if(t.experimentalNumUnits()===2){let[n,i]=t.units();if(n.as(E)?.quantum.isIdentical(this.quantumU_SQ_)&&i.as(E)?.quantum.isIdentical(this.quantumD_SQ_)){if(e.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[n,i]}}return null}},vv=new yv,Vh=class extends cn{constructor(e,t){super();H(this,Gn,void 0);let n=Xr(e);$(this,Gn,new ca(n,t))}isIdentical(e){let t=e;return e.is(Vh)&&S(this,Gn).isIdentical(S(t,Gn))}get alg(){return S(this,Gn).quantum}get amount(){return S(this,Gn).amount}get experimentalRepetitionSuffix(){return S(this,Gn).suffix()}invert(){return new Vh(S(this,Gn).quantum,-S(this,Gn).amount)}*experimentalExpand(e=Ce.Forwards,t){t??(t=1/0),t===0?yield e===Ce.Forwards?this:this.invert():yield*S(this,Gn).experimentalExpand(e,t-1)}static fromString(){throw new Error("unimplemented")}toString(){return vv.format(this)??`(${S(this,Gn).quantum.toString()})${S(this,Gn).suffix()}`}experimentalAsSquare1Tuple(){return vv.tuple(this)}},nn=Vh;Gn=new WeakMap});var Hh=oe(()=>{Oh();hu();uu();cu();Zr();fu();pu()});function Wn(r,e){return r instanceof e}function xv(r){return Wn(r,nn)||Wn(r,hi)||Wn(r,tn)||Wn(r,Nt)||Wn(r,E)||Wn(r,Ln)||Wn(r,An)}var Km=oe(()=>{Hh()});function wv(r,e,t){if(e.is(nn))return r.traverseGrouping(e,t);if(e.is(E))return r.traverseMove(e,t);if(e.is(tn))return r.traverseCommutator(e,t);if(e.is(Nt))return r.traverseConjugate(e,t);if(e.is(An))return r.traversePause(e,t);if(e.is(Ln))return r.traverseNewline(e,t);if(e.is(hi))return r.traverseLineComment(e,t);throw new Error("unknown unit")}function bv(r){if(r.is(nn)||r.is(E)||r.is(tn)||r.is(Nt)||r.is(An)||r.is(Ln)||r.is(hi))return r;throw"internal error: expected unit"}var ri,Cn,qh,BE,Jm,Zm,Sv,Lv,$m=oe(()=>{Oh();uu();Zr();fu();pu();cu();hu();ri=class{traverseUnit(e,t){return wv(this,e,t)}traverseIntoUnit(e,t){return bv(this.traverseUnit(e,t))}},Cn=class extends ri{traverseUnit(e){return wv(this,e,void 0)}traverseIntoUnit(e){return bv(this.traverseUnit(e))}},Jm=class extends ri{*traverseAlg(e,t){if(t.depth===0){yield*e.units();return}let n=[],i=null,o=t?.collapseMoves??!0;function s(u,c){var p;let f=ye(p=Jm,qh,BE).call(p,u,c,t);if(f===0)return!1;let h=new E(u.quantum,f);return n.push(h),i=h,!0}function a(u){o&&i?.is(E)&&u.is(E)&&i.quantum.isIdentical(u.quantum)?(n.pop(),s(i,u.amount)||(i=n.slice(-1)[0])):u.is(E)?s(u,0):(n.push(u),i=u)}let l={depth:t.depth?t.depth-1:null};for(let u of e.units())for(let c of this.traverseUnit(u,l))a(c);for(let u of n)yield u}*traverseGrouping(e,t){if(t.depth===0){yield e;return}let n={depth:t.depth?t.depth-1:null};yield new nn(this.traverseAlg(e.alg,n))}*traverseMove(e,t){yield e}*traverseCommutator(e,t){if(t.depth===0){yield e;return}let n={depth:t.depth?t.depth-1:null};yield new tn(this.traverseAlg(e.A,n),this.traverseAlg(e.B,n))}*traverseConjugate(e,t){if(t.depth===0){yield e;return}let n={depth:t.depth?t.depth-1:null};yield new Nt(this.traverseAlg(e.A,n),this.traverseAlg(e.B,n))}*traversePause(e,t){yield e}*traverseNewline(e,t){yield e}*traverseLineComment(e,t){yield e}},Zm=Jm;qh=new WeakSet,BE=function(e,t,n){let i=e.amount+t;if(n?.quantumMoveOrder){let o=n.quantumMoveOrder(e.quantum),s=Math.floor(o/2)+1-o;i=(i%o+o-s)%o+s}return i},H(Zm,qh);Sv=new Zm,Lv=Sv.traverseAlg.bind(Sv)});function Av(r){if(!r)return[];if(Wn(r,re))return r.units();if(typeof r=="string")return jm(r).units();let e=r;if(typeof e[Symbol.iterator]=="function")return e;throw"Invalid unit"}function Xr(r){return Wn(r,re)?r:new re(r)}function zE(r,e){return r.is(Ln)||e.is(Ln)?"":r.is(hi)&&!e.is(Ln)?`
|
|
5
|
+
`:" "}var Vn,Qo,re,cr=oe(()=>{ur();Km();Si();Qm();$m();hu();Zr();fu();Ym();Qo=class extends cn{constructor(e){super();H(this,Vn,void 0);$(this,Vn,Array.from(Av(e)));for(let t of S(this,Vn))if(!xv(t))throw new Error("An alg can only contain units.")}isIdentical(e){let t=e;if(!e.is(Qo))return!1;let n=Array.from(S(this,Vn)),i=Array.from(S(t,Vn));if(n.length!==i.length)return!1;for(let o=0;o<n.length;o++)if(!n[o].isIdentical(i[o]))return!1;return!0}invert(){return new Qo(cv(Array.from(S(this,Vn)).map(e=>e.invert())))}*experimentalExpand(e=Ce.Forwards,t){t??(t=1/0);for(let n of Yr(S(this,Vn),e))yield*n.experimentalExpand(e,t)}expand(e){return new Qo(this.experimentalExpand(Ce.Forwards,e?.depth??1/0))}*experimentalLeafMoves(){for(let e of this.experimentalExpand())e.is(E)&&(yield e)}concat(e){return new Qo(Array.from(S(this,Vn)).concat(Array.from(Av(e))))}experimentalIsEmpty(){for(let e of S(this,Vn))return!1;return!0}static fromString(e){return jm(e)}*units(){for(let e of S(this,Vn))yield e}experimentalNumUnits(){return Array.from(S(this,Vn)).length}get type(){return Gh("deprecated: type"),"sequence"}toString(){let e="",t=null;for(let n of S(this,Vn))t&&(e+=zE(t,n)),e+=n.toString(),t=n;return e}simplify(e){return new Qo(Lv(this,e??{}))}},re=Qo;Vn=new WeakMap});var Dv,Ev=oe(()=>{cr();Hh();uu();cu();Zr();pu();Dv={Sune:new re([new E("R",1),new E("U",1),new E("R",-1),new E("U",1),new E("R",1),new E("U",-2),new E("R",-1)]),AntiSune:new re([new E("R",1),new E("U",2),new E("R",-1),new E("U",-1),new E("R",1),new E("U",-1),new E("R",-1)]),SuneCommutator:new re([new tn(new re([new E("R",1),new E("U",1),new E("R",-2)]),new re([new Nt(new re([new E("R",1)]),new re([new E("U",1)]))]))]),Niklas:new re([new E("R",1),new E("U",-1),new E("L",-1),new E("U",1),new E("R",-1),new E("U",-1),new E("L",1),new E("U",1)]),EPerm:new re([new E("x",-1),new tn(new re([new Nt(new re([new E("R",1)]),new re([new E("U",-1)]))]),new re([new E("D",1)])),new tn(new re([new Nt(new re([new E("R",1)]),new re([new E("U",1)]))]),new re([new E("D",1)])),new E("x",1)]),FURURFCompact:new re([new Nt(new re([new E("F",1)]),new re([new tn(new re([new E("U",1)]),new re([new E("R",1)]))]))]),APermCompact:new re([new Nt(new re([new E("R",2)]),new re([new tn(new re([new E("F",2)]),new re([new E("R",-1),new E("B",-1),new E("R",1)]))]))]),FURURFMoves:new re([new E("F",1),new E("U",1),new E("R",1),new E("U",-1),new E("R",-1),new E("F",-1)]),TPerm:new re([new E("R",1),new E("U",1),new E("R",-1),new E("U",-1),new E("R",-1),new E("F",1),new E("R",2),new E("U",-1),new E("R",-1),new E("U",-1),new E("R",1),new E("U",1),new E("R",-1),new E("F",-1)]),HeadlightSwaps:new re([new Nt(new re([new E("F",1)]),new re([new nn(new re([new tn(new re([new E("R",1)]),new re([new E("U",1)]))]),3)]))]),TriplePause:new re([new An,new An,new An])}});function jh(r){return r.altKey||r.ctrlKey?null:IE[r.keyCode]||null}var IE,Mv=oe(()=>{Zr();IE={73:new E("R"),75:new E("R'"),87:new E("B"),79:new E("B'"),83:new E("D"),76:new E("D'"),68:new E("L"),69:new E("L'"),74:new E("U"),70:new E("U'"),72:new E("F"),71:new E("F'"),78:new E("x'"),67:new E("l"),82:new E("l'"),85:new E("r"),77:new E("r'"),88:new E("d"),188:new E("d'"),84:new E("x"),89:new E("x"),66:new E("x'"),186:new E("y"),59:new E("y"),65:new E("y'"),80:new E("z"),81:new E("z'"),90:new E("M'"),190:new E("M'")}});function Rv(r){let e=r.toString();return e=e.replace(/_/g,"_").replace(/ /g,"_"),e=e.replace(/\+/g,"b;"),e=e.replace(/-/g,"-").replace(/'/g,"-"),e}function Tv(r){let e=new URL("https://alg.cubing.net");if(!r.alg)throw new Error("An alg parameter is required.");if(e.searchParams.set("alg",Rv(r.alg)),r.setup&&e.searchParams.set("setup",Rv(r.setup)),r.title&&e.searchParams.set("title",r.title),r.puzzle){if(!["1x1x1","2x2x2","3x3x3","4x4x4","5x5x5","6x6x6","7x7x7","8x8x8","9x9x9","10x10x10","11x11x11","12x12x12","13x13x13","14x14x14","16x16x16","17x17x17"].includes(r.puzzle))throw new Error(`Invalid puzzle parameter: ${r.puzzle}`);e.searchParams.set("puzzle",r.puzzle)}if(r.stage){if(!["full","cross","F2L","LL","OLL","PLL","CLS","ELS","L6E","CMLL","WV","ZBLL","void"].includes(r.stage))throw new Error(`Invalid stage parameter: ${r.stage}`);e.searchParams.set("stage",r.stage)}if(r.view){if(!["editor","playback","fullscreen"].includes(r.view))throw new Error(`Invalid view parameter: ${r.view}`);e.searchParams.set("view",r.view)}if(r.type){if(!["moves","reconstruction","alg","reconstruction-end-with-setup"].includes(r.type))throw new Error(`Invalid type parameter: ${r.type}`);e.searchParams.set("type",r.type)}return e.toString()}var Fv=oe(()=>{});function fr(r,e,t){let n=Array.from(r.units()),i=n[n.length-1];if(t?.coalesce&&i&&i.quantum&&i.quantum.isIdentical(e.quantum)){let o=n.slice(0,n.length-1),s=i.amount+e.amount,a=t?.mod;return a&&(s=(s%a+a)%a,s*2>a&&(s-=a)),s!==0&&o.push(i.modified({amount:s})),new re(o)}else return new re([...n,e])}var _v=oe(()=>{cr()});var e0={};_t(e0,{Alg:()=>re,AlgBuilder:()=>Gi,Commutator:()=>tn,Conjugate:()=>Nt,Example:()=>Dv,ExperimentalIterationDirection:()=>Ce,Grouping:()=>nn,LineComment:()=>hi,Move:()=>E,Newline:()=>Ln,Pause:()=>An,QuantumMove:()=>ze,TraversalDownUp:()=>ri,TraversalUp:()=>Cn,algCubingNetLink:()=>Tv,experimentalAppendMove:()=>fr,experimentalDirect:()=>Yr,experimentalDirectedGenerator:()=>Bh,experimentalIs:()=>Wn,keyToMove:()=>jh});var Oe=oe(()=>{cr();Hm();$m();Ev();Mv();Hh();Fv();_v();Km();Si()});function t0(r,e){if(e===fa)return!0;let t=e.permutation,n=t.length;for(let i=0;i<n;i++)if(t[i]!==i)return!1;if(r>1){let i=e.orientation;for(let o=0;o<n;o++)if(i[o]!==0)return!1}return fa=e,!0}function gt(r,e,t){let n={};for(let i in r.orbits){let o=r.orbits[i],s=e[i],a=t[i];if(t0(o.orientations,a))n[i]=s;else if(t0(o.orientations,s))n[i]=a;else{let l=new Array(o.numPieces);if(o.orientations===1){for(let u=0;u<o.numPieces;u++)l[u]=s.permutation[a.permutation[u]];n[i]={permutation:l,orientation:s.orientation}}else{let u=new Array(o.numPieces);for(let c=0;c<o.numPieces;c++)u[c]=(s.orientation[a.permutation[c]]+a.orientation[c])%o.orientations,l[c]=s.permutation[a.permutation[c]];n[i]={permutation:l,orientation:u}}}}return n}function Yo(r,e,t){if(t<0)return Yo(r,Wi(r,e),-t);if(t===0)return Li(r);if(t===1)return e;let n=e;t!==2&&(n=Yo(r,e,Math.floor(t/2)));let i=gt(r,n,n);return t%2==0?i:gt(r,e,i)}function Li(r){let e={};for(let t in r.orbits){let n=r.orbits[t];if(!fa||fa.permutation.length!==n.numPieces){let i=new Array(n.numPieces),o=new Array(n.numPieces);for(let a=0;a<n.numPieces;a++)i[a]=a,o[a]=0;fa={permutation:i,orientation:o}}e[t]=fa}return e}function Wi(r,e){let t={};for(let n in r.orbits){let i=r.orbits[n],o=e[n];if(t0(i.orientations,o))t[n]=o;else if(i.orientations===1){let s=new Array(i.numPieces);for(let a=0;a<i.numPieces;a++)s[o.permutation[a]]=a;t[n]={permutation:s,orientation:o.orientation}}else{let s=new Array(i.numPieces),a=new Array(i.numPieces);for(let l=0;l<i.numPieces;l++){let u=o.permutation[l];s[u]=l,a[u]=(i.orientations-o.orientation[l]+i.orientations)%i.orientations}t[n]={permutation:s,orientation:a}}}return t}function n0(r,e){return e?n0(e,r%e):r}function kv(r,e){let t=1;for(let n in r.orbits){let i=r.orbits[n],o=e[n],s=new Array(i.numPieces);for(let a=0;a<i.numPieces;a++)if(!s[a]){let l=a,u=0,c=0;for(;s[l]=!0,u=u+o.orientation[l],c=c+1,l=o.permutation[l],l!==a;);u!==0&&(c=c*i.orientations/n0(i.orientations,u)),t=t*c/n0(t,c)}}return t}function Jr(r,e,t,n,i={}){let o=r.orbits[e],s=t[e],a=n[e];for(let l=0;l<o.numPieces;l++)if(!i?.ignoreOrientation&&s.orientation[l]!==a.orientation[l]||!i?.ignorePermutation&&s.permutation[l]!==a.permutation[l])return!1;return!0}function Vi(r,e,t){for(let n in r.orbits)if(!Jr(r,n,e,t))return!1;return!0}function Qh(r,e,t){return Vi(r,gt(r,r.startPieces,e),gt(r,r.startPieces,t))}var fa,du=oe(()=>{});function Yh(r,e){let t=Bv(r).lookupMove(new E(e));if(!t)throw new Error("Unknown move: "+e.toString());return t}function Ai(r,e){let t=Bv(r).lookupMove(e);if(!t)throw new Error("Unknown move: "+e.toString());return t}function Bv(r){return r.moveNotation||(r.moveNotation=new zv(r)),r.moveNotation}var zv,pn,i0=oe(()=>{Oe();du();zv=class{constructor(e){this.def=e;this.cache={}}lookupMove(e){let t=e.toString(),n=this.cache[t];if(n)return n;let i=e.quantum.toString();return n=this.def.moves[i],n?(n=Yo(this.def,n,e.amount),this.cache[t]=n):(n=this.def.moves[e.toString()],n?this.cache[t]=n:(n=this.def.moves[e.invert().toString()],n&&(n=Yo(this.def,n,-1),this.cache[t]=n))),n}},pn=class{constructor(e){this.definition=e;this.state=Li(e)}reset(){this.state=Li(this.definition)}serialize(){let e="";for(let t in this.definition.orbits)e+=t+`
|
|
6
6
|
`,e+=this.state[t].permutation.join(" ")+`
|
|
7
7
|
`,e+=this.state[t].orientation.join(" ")+`
|
|
8
|
-
`;return e=e.slice(0,e.length-1),e}applyMove(e){this.state=gt(this.definition,this.state,Ai(this.definition,e))}applyAlg(e){for(let t of e.experimentalLeafMoves())this.applyMove(t)}}});var pa,
|
|
8
|
+
`;return e=e.slice(0,e.length-1),e}applyMove(e){this.state=gt(this.definition,this.state,Ai(this.definition,e))}applyAlg(e){for(let t of e.experimentalLeafMoves())this.applyMove(t)}}});var pa,r0,$r,o0,Iv=oe(()=>{du();pa=class{constructor(e,t){this.base=e;this.twist=t}getTransformation(e){return e.transforms[this.base][this.twist]}asString(e){let t=e.moveorder[this.base],n=this.twist%t;for(;n+n>t;)n-=t;for(;n+n<=-t;)n+=t;let i=e.movenames[this.base];if(n===1)return i;if(n===-1)return i+"'";if(n>0)return i+n;if(n<0)return i+-n+"'";throw new Error("Stringifying null move?")}},r0=class{constructor(e){this.def=e;this.commutes=[];this.moveorder=[];this.movenames=[];this.transforms=[];this.moveindex={};let t=e.moves,n=Li(e);for(let i in t)this.moveindex[i]=this.movenames.length,this.movenames.push(i),this.transforms.push([n,t[i]]);this.baseMoveCount=this.movenames.length;for(let i=0;i<this.baseMoveCount;i++){this.commutes.push([]);let o=this.transforms[i][1];for(let s=0;s<this.baseMoveCount;s++){let a=this.transforms[s][1],l=gt(e,o,a),u=gt(e,a,o);this.commutes[i][s]=Vi(e,l,u)}}for(let i=0;i<this.baseMoveCount;i++){let o=this.transforms[i][1],s=o,a=1;for(let l=2;!Vi(e,n,s);l++)a++,s=gt(e,s,o),this.transforms[i].push(s);this.moveorder[i]=a}}blockMoveToInternalMove(e){let t=e.quantum.toString();if(!(t in this.def.moves))throw new Error("! move "+t+" not in def.");let n=this.moveindex[t],i=this.moveorder[n],o=e.amount%i;return o<0&&(o=(o+i)%i),new pa(n,o)}sequenceToSearchSequence(e,t){let n=new $r(this,t);for(let i of e.experimentalLeafMoves())n.appendOneMove(this.blockMoveToInternalMove(i));return n}mergeSequenceToSearchSequence(e,t){let n=new $r(this,t);for(let i of e.experimentalLeafMoves())n.mergeOneMove(this.blockMoveToInternalMove(i));return n}},$r=class{constructor(e,t){this.canon=e;this.moveseq=[];t?this.trans=t:this.trans=Li(e.def)}clone(){let e=new $r(this.canon,this.trans);return e.moveseq=[...this.moveseq],e}mergeOneMove(e){let t=this.onlyMergeOneMove(e);return this.trans=gt(this.canon.def,this.trans,e.getTransformation(this.canon)),t}appendOneMove(e){return this.moveseq.push(e),this.trans=gt(this.canon.def,this.trans,e.getTransformation(this.canon)),1}popMove(){let e=this.moveseq.pop();if(!e)throw new Error("Can't pop an empty sequence");return this.trans=gt(this.canon.def,this.trans,this.canon.transforms[e.base][this.canon.moveorder[e.base]-e.twist]),1}oneMoreTwist(){let e=this.moveseq[this.moveseq.length-1];return this.trans=gt(this.canon.def,this.trans,this.canon.transforms[e.base][1]),this.moveseq[this.moveseq.length-1]=new pa(e.base,e.twist+1),0}onlyMergeOneMove(e){let t=this.moveseq.length-1;for(;t>=0;)if(e.base===this.moveseq[t].base){let n=this.canon.moveorder[e.base],i=(e.twist+this.moveseq[t].twist)%n;return i<0&&(i=(i+n)%n),i===0?(this.moveseq.splice(t,1),-1):(this.moveseq[t]=new pa(e.base,i),0)}else if(this.canon.commutes[e.base][this.moveseq[t].base])t--;else break;return this.moveseq.push(e),1}mergeSequence(e){let t=this.moveseq.length;for(let n=0;n<e.moveseq.length;n++){let i=e.moveseq[n];t+=this.onlyMergeOneMove(i)}return this.trans=gt(this.canon.def,this.trans,e.trans),t}getSequenceAsString(){let e=[];for(let t of this.moveseq)e.push(t.asString(this.canon));return e.join(" ")}},o0=class{constructor(e,t){this.canon=e;this.ss=new $r(e,t),this.targetLength=0}nextState(e,t){let n=[];for(let i of t){if(i===e)return null;if(this.canon.commutes[i][e]){if(e<i)return null;n.push(i)}}return n}*genSequence(e,t){if(e===0)yield this.ss;else for(let n=0;n<this.canon.baseMoveCount;n++){let i=this.nextState(n,t);if(i){i.push(n);for(let o=1;o<this.canon.moveorder[n];o++)this.ss.appendOneMove(new pa(n,o)),yield*this.genSequence(e-1,i),this.ss.popMove()}}return null}*generator(){for(let e=0;;e++)yield*this.genSequence(e,[])}*genSequenceTree(e){if((yield this.ss)>0)return null;for(let n=0;n<this.canon.baseMoveCount;n++){let i=this.nextState(n,e);if(i){i.push(n);for(let o=1;o<this.canon.moveorder[n];o++)this.ss.appendOneMove(new pa(n,o)),yield*this.genSequenceTree(i),this.ss.popMove()}}return null}}});function UE(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function da(r,e,t,n){this.message=r,this.expected=e,this.found=t,this.location=n,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,da)}function Uv(r,e){e=e!==void 0?e:{};var t={},n={start:Ee},i=Ee,o=function(v){return Gm(v)},s=/^[A-Za-z0-9<>]/,a=te([["A","Z"],["a","z"],["0","9"],"<",">"],!1,!1),l=function(v){return v.join("")},u=/^[A-Za-z]/,c=te([["A","Z"],["a","z"]],!1,!1),f=/^[A-Za-z0-9]/,h=te([["A","Z"],["a","z"],["0","9"]],!1,!1),p=function(v,A){return[v].concat(A).join("")},d=/^[0-9]/,g=te([["0","9"]],!1,!1),x=function(v){return parseInt(v.join(""),10)},y=" ",m=_(" ",!1),b="Name",w=_("Name",!1),D=function(v){return v},R="Set",L=_("Set",!1),T=function(v,A,I){return[v,{numPieces:A,orientations:I}]},U=function(v,A){return A[v[0]]=v[1],A},F=function(v){let A={};return A[v[0]]=v[1],A},C=`
|
|
9
9
|
`,j=_(`
|
|
10
|
-
`,!1),B=function(v,A){return[v].concat(A)},z=function(v){return[v]},O=function(v){return Nm(v)},V=function(v,A,I){return[v,{permutation:A,orientation:I}]},q=function(v,A){return[v,{permutation:A,orientation:new Array(A.length).fill(0)}]},se=function(v,A){return A[v[0]]=v[1],A},he=function(v){let A={};return A[v[0]]=v[1],A},Y="Solved",X=_("Solved",!1),ve="End",pe=_("End",!1),Le=function(v){return v},Ie="Move",P=_("Move",!1),Z=function(v,A){return[v,A]},ae=function(v,A){return A[v[0]]=v[1],A},ne=function(v){let A={};return A[v[0]]=v[1],A},fe=function(v,A,I,N){return{name:v,orbits:A,moves:N,startPieces:I}},W=0,Q=0,le=[{line:1,column:1}],ue=0,Se=[],ce=0,Ue;if("startRule"in e){if(!(e.startRule in n))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');i=n[e.startRule]}function We(){return r.substring(Q,W)}function nt(){return de(Q,W)}function Et(v,A){throw A=A!==void 0?A:de(Q,W),ge([Me(v)],r.substring(Q,W),A)}function k(v,A){throw A=A!==void 0?A:de(Q,W),be(v,A)}function _(v,A){return{type:"literal",text:v,ignoreCase:A}}function te(v,A,I){return{type:"class",parts:v,inverted:A,ignoreCase:I}}function ie(){return{type:"any"}}function Fe(){return{type:"end"}}function Me(v){return{type:"other",description:v}}function G(v){var A=le[v],I;if(A)return A;for(I=v-1;!le[I];)I--;for(A=le[I],A={line:A.line,column:A.column};I<v;)r.charCodeAt(I)===10?(A.line++,A.column=1):A.column++,I++;return le[v]=A,A}function de(v,A){var I=G(v),N=G(A);return{start:{offset:v,line:I.line,column:I.column},end:{offset:A,line:N.line,column:N.column}}}function J(v){W<ue||(W>ue&&(ue=W,Se=[]),Se.push(v))}function be(v,A){return new da(v,null,null,A)}function ge(v,A,I){return new da(da.buildMessage(v,A),v,A,I)}function Ee(){var v,A;return v=W,A=Um(),A!==t&&(Q=v,A=o(A)),v=A,v}function Re(){var v,A,I;if(v=W,A=[],s.test(r.charAt(W))?(I=r.charAt(W),W++):(I=t,ce===0&&J(a)),I!==t)for(;I!==t;)A.push(I),s.test(r.charAt(W))?(I=r.charAt(W),W++):(I=t,ce===0&&J(a));else A=t;return A!==t&&(Q=v,A=l(A)),v=A,v}function Ve(){var v,A,I,N;if(v=W,u.test(r.charAt(W))?(A=r.charAt(W),W++):(A=t,ce===0&&J(c)),A!==t){for(I=[],f.test(r.charAt(W))?(N=r.charAt(W),W++):(N=t,ce===0&&J(h));N!==t;)I.push(N),f.test(r.charAt(W))?(N=r.charAt(W),W++):(N=t,ce===0&&J(h));I!==t?(Q=v,A=p(A,I),v=A):(W=v,v=t)}else W=v,v=t;return v}function Mt(){var v,A,I;if(v=W,A=[],d.test(r.charAt(W))?(I=r.charAt(W),W++):(I=t,ce===0&&J(g)),I!==t)for(;I!==t;)A.push(I),d.test(r.charAt(W))?(I=r.charAt(W),W++):(I=t,ce===0&&J(g));else A=t;return A!==t&&(Q=v,A=x(A)),v=A,v}function Ze(){var v;return r.charCodeAt(W)===32?(v=y,W++):(v=t,ce===0&&J(m)),v}function ii(){var v,A,I,N;return v=W,r.substr(W,4)===b?(A=b,W+=4):(A=t,ce===0&&J(w)),A!==t?(I=Ze(),I!==t?(N=Re(),N!==t?(Q=v,A=D(N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function Nn(){var v,A,I,N,K,De,_e,ke;return v=W,r.substr(W,3)===R?(A=R,W+=3):(A=t,ce===0&&J(L)),A!==t?(I=Ze(),I!==t?(N=Ve(),N!==t?(K=Ze(),K!==t?(De=Mt(),De!==t?(_e=Ze(),_e!==t?(ke=Mt(),ke!==t?(Q=v,A=T(N,De,ke),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function _h(){var v,A,I,N;return v=W,A=Nn(),A!==t?(I=ci(),I!==t?(N=_h(),N!==t?(Q=v,A=U(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=Nn(),A!==t&&(Q=v,A=F(A)),v=A),v}function ci(){var v;return r.charCodeAt(W)===10?(v=C,W++):(v=t,ce===0&&J(j)),v}function No(){var v,A;if(v=[],r.charCodeAt(W)===10?(A=C,W++):(A=t,ce===0&&J(j)),A!==t)for(;A!==t;)v.push(A),r.charCodeAt(W)===10?(A=C,W++):(A=t,ce===0&&J(j));else v=t;return v}function lr(){var v,A;for(v=[],r.charCodeAt(W)===10?(A=C,W++):(A=t,ce===0&&J(j));A!==t;)v.push(A),r.charCodeAt(W)===10?(A=C,W++):(A=t,ce===0&&J(j));return v}function ra(){var v,A,I,N;return v=W,A=Mt(),A!==t?(I=Ze(),I!==t?(N=ra(),N!==t?(Q=v,A=B(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=Mt(),A!==t&&(Q=v,A=z(A)),v=A),v}function ru(){var v,A;return v=W,A=ra(),A!==t&&(Q=v,A=O(A)),v=A,v}function Ch(){var v,A,I,N,K,De;return v=W,A=Ve(),A!==t?(I=ci(),I!==t?(N=ru(),N!==t?(K=ci(),K!==t?(De=ra(),De!==t?(Q=v,A=V(A,N,De),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=Ve(),A!==t?(I=ci(),I!==t?(N=ru(),N!==t?(Q=v,A=q(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)),v}function jr(){var v,A,I,N;return v=W,A=Ch(),A!==t?(I=ci(),I!==t?(N=jr(),N!==t?(Q=v,A=se(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=Ch(),A!==t&&(Q=v,A=he(A)),v=A),v}function Im(){var v,A,I,N,K,De;return v=W,r.substr(W,6)===Y?(A=Y,W+=6):(A=t,ce===0&&J(X)),A!==t?(I=ci(),I!==t?(N=jr(),N!==t?(K=ci(),K!==t?(r.substr(W,3)===ve?(De=ve,W+=3):(De=t,ce===0&&J(pe)),De!==t?(Q=v,A=Le(N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function oa(){var v,A,I,N,K,De,_e,ke;return v=W,r.substr(W,4)===Ie?(A=Ie,W+=4):(A=t,ce===0&&J(P)),A!==t?(I=Ze(),I!==t?(N=Re(),N!==t?(K=ci(),K!==t?(De=jr(),De!==t?(_e=ci(),_e!==t?(r.substr(W,3)===ve?(ke=ve,W+=3):(ke=t,ce===0&&J(pe)),ke!==t?(Q=v,A=Z(N,De),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function ou(){var v,A,I,N;return v=W,A=oa(),A!==t?(I=No(),I!==t?(N=ou(),N!==t?(Q=v,A=ae(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=oa(),A!==t&&(Q=v,A=ne(A)),v=A),v}function Um(){var v,A,I,N,K,De,_e,ke,Be;return v=W,A=ii(),A!==t?(I=No(),I!==t?(N=_h(),N!==t?(K=No(),K!==t?(De=Im(),De!==t?(_e=No(),_e!==t?(ke=ou(),ke!==t?(Be=lr(),Be!==t?(Q=v,A=fe(A,N,De,ke),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function Nm(v){return v.map(A=>A-1)}function Om(v){for(let A in v.moves){let I=v.moves[A];for(let N in v.orbits){let K=I[N],De=K.orientation,_e=K.permutation,ke=new Array(De.length);for(let Be=0;Be<_e.length;Be++)ke[Be]=De[_e[Be]];K.orientation=ke}}return v}if(Ue=i(),Ue!==t&&W===r.length)return Ue;throw Ue!==t&&W<r.length&&J(Fe()),ge(Se,ue<r.length?r.charAt(ue):null,ue<r.length?de(ue,ue+1):de(ue,ue))}var Uv=oe(()=>{UE(da,Error);da.buildMessage=function(r,e){var t={literal:function(u){return'"'+i(u.text)+'"'},class:function(u){var c=u.parts.map(function(f){return Array.isArray(f)?o(f[0])+"-"+o(f[1]):o(f)});return"["+(u.inverted?"^":"")+c+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(u){return u.description}};function n(u){return u.charCodeAt(0).toString(16).toUpperCase()}function i(u){return u.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(c){return"\\x0"+n(c)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(c){return"\\x"+n(c)})}function o(u){return u.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(c){return"\\x0"+n(c)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(c){return"\\x"+n(c)})}function s(u){return t[u.type](u)}function a(u){var c=u.map(s),f,h;if(c.sort(),c.length>0){for(f=1,h=1;f<c.length;f++)c[f-1]!==c[f]&&(c[h]=c[f],h++);c.length=h}switch(c.length){case 1:return c[0];case 2:return c[0]+" or "+c[1];default:return c.slice(0,-1).join(", ")+", or "+c[c.length-1]}}function l(u){return u?'"'+i(u)+'"':"end of input"}return"Expected "+a(r)+" but "+l(e)+" found."}});var o0,Nv=oe(()=>{Uv();o0=Iv});var Ov=oe(()=>{Nv()});function NE(){return Gv+=1,"svg"+Gv.toString()}var Xh,Gv,OE,Xo,Wv=oe(()=>{Xh="http://www.w3.org/2000/svg",Gv=0;OE={dim:{white:"#dddddd",orange:"#884400",limegreen:"#008800",red:"#660000","rgb(34, 102, 255)":"#000088",yellow:"#888800"},oriented:{white:"#ff88ff",orange:"#ff88ff",limegreen:"#ff88ff",red:"#ff88ff","rgb(34, 102, 255)":"#ff88ff",yellow:"#ff88ff"},ignored:{white:"#444444",orange:"#444444",limegreen:"#444444",red:"#444444","rgb(34, 102, 255)":"#444444",yellow:"#444444"},invisible:{white:"#00000000",orange:"#00000000",limegreen:"#00000000",red:"#00000000","rgb(34, 102, 255)":"#00000000",yellow:"#00000000"}},Xo=class{constructor(e,t,n){this.kPuzzleDefinition=e;this.originalColors={};this.gradients={};if(!t)throw new Error(`No SVG definition for puzzle type: ${e.name}`);this.svgID=NE(),this.element=document.createElement("div"),this.element.classList.add("svg-wrapper"),this.element.innerHTML=t;let i=this.element.querySelector("svg");if(!i)throw new Error("Could not get SVG element");if(Xh!==i.namespaceURI)throw new Error("Unexpected XML namespace");i.style.maxWidth="100%",i.style.maxHeight="100%",this.gradientDefs=document.createElementNS(Xh,"defs"),i.insertBefore(this.gradientDefs,i.firstChild);for(let o in e.orbits){let s=e.orbits[o];for(let a=0;a<s.numPieces;a++)for(let l=0;l<s.orientations;l++){let u=this.elementID(o,a,l),c=this.elementByID(u),f=c.style.fill;n?(()=>{let h=n.orbits;if(!h)return;let p=h[o];if(!p)return;let d=p.pieces[a];if(!d)return;let g=d.facelets[l];if(!g)return;let x=typeof g=="string"?g:g?.appearance,y=OE[x];y&&(f=y[f])})():f=c.style.fill,this.originalColors[u]=f,this.gradients[u]=this.newGradient(u,f),this.gradientDefs.appendChild(this.gradients[u]),c.setAttribute("style",`fill: url(#grad-${this.svgID}-${u})`)}}}drawKPuzzle(e,t,n){this.draw(e.definition,e.state,t,n)}draw(e,t,n,i){for(let o in e.orbits){let s=e.orbits[o],a=t[o],l=n?n[o]:null;for(let u=0;u<s.numPieces;u++)for(let c=0;c<s.orientations;c++){let f=this.elementID(o,u,c),h=this.elementID(o,a.permutation[u],(s.orientations-a.orientation[u]+c)%s.orientations),p=!1;if(l){let d=this.elementID(o,l.permutation[u],(s.orientations-l.orientation[u]+c)%s.orientations);h===d&&(p=!0),i=i||0;let g=100*(1-i*i*(2-i*i));this.gradients[f].children[0].setAttribute("stop-color",this.originalColors[h]),this.gradients[f].children[1].setAttribute("stop-color",this.originalColors[h]),this.gradients[f].children[1].setAttribute("offset",`${Math.max(g-5,0)}%`),this.gradients[f].children[2].setAttribute("offset",`${Math.max(g-5,0)}%`),this.gradients[f].children[3].setAttribute("offset",`${g}%`),this.gradients[f].children[4].setAttribute("offset",`${g}%`),this.gradients[f].children[4].setAttribute("stop-color",this.originalColors[d]),this.gradients[f].children[5].setAttribute("stop-color",this.originalColors[d])}else p=!0;p&&(this.gradients[f].children[0].setAttribute("stop-color",this.originalColors[h]),this.gradients[f].children[1].setAttribute("stop-color",this.originalColors[h]),this.gradients[f].children[1].setAttribute("offset","100%"),this.gradients[f].children[2].setAttribute("offset","100%"),this.gradients[f].children[3].setAttribute("offset","100%"),this.gradients[f].children[4].setAttribute("offset","100%"))}}}newGradient(e,t){let n=document.createElementNS(Xh,"radialGradient");n.setAttribute("id",`grad-${this.svgID}-${e}`),n.setAttribute("r","70.7107%");let i=[{offset:0,color:t},{offset:0,color:t},{offset:0,color:"black"},{offset:0,color:"black"},{offset:0,color:t},{offset:100,color:t}];for(let o of i){let s=document.createElementNS(Xh,"stop");s.setAttribute("offset",`${o.offset}%`),s.setAttribute("stop-color",o.color),s.setAttribute("stop-opacity","1"),n.appendChild(s)}return n}elementID(e,t,n){return e+"-l"+t+"-o"+n}elementByID(e){return this.element.querySelector("#"+e)}}});var Ye,s0=oe(()=>{Ye={name:"3x3x3",orbits:{EDGES:{numPieces:12,orientations:2},CORNERS:{numPieces:8,orientations:3},CENTERS:{numPieces:6,orientations:4}},startPieces:{EDGES:{permutation:[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:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[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]}}}};Ye.moves.Uw=Ye.moves.u;Ye.moves.Lw=Ye.moves.l;Ye.moves.Fw=Ye.moves.f;Ye.moves.Rw=Ye.moves.r;Ye.moves.Bw=Ye.moves.b;Ye.moves.Dw=Ye.moves.d;Ye.moves.Rv=Ye.moves.x;Ye.moves.Uv=Ye.moves.y;Ye.moves.Fv=Ye.moves.z;Ye.moves.Lv={EDGES:{permutation:[2,10,6,11,0,8,4,9,1,3,5,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,3,2,0]}};Ye.moves.Dv={EDGES:{permutation:[3,0,1,2,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[3,0,0,0,0,1]}};Ye.moves.Bv={EDGES:{permutation:[8,5,10,1,9,7,11,3,4,0,6,2],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,3,3,1,3]}}});function Vv(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=t;return e}function Kh(r,e){let t=0;for(let n of e)t*=r,t+=n;return t}function Zh(r,e,t){let n=[];for(;t>0;)n.push(t%r),t=Math.floor(t/r);return new Array(e-n.length).fill(0).concat(n.reverse())}function a0(r){let e=r.length,t=0;for(let n=0;n<e-1;n++){t=t*(e-n);for(let i=n+1;i<e;i++)r[n]>r[i]&&(t+=1)}return t}function l0(r,e){let t=new Array(r);t[r-1]=0;for(let n=r-2;n>=0;n--){t[n]=e%(r-n),e=Math.floor(e/(r-n));for(let i=n+1;i<r;i++)t[i]>=t[n]&&(t[i]=t[i]+1)}return t}var Hv=oe(()=>{});function Jh(r){let e=r.CENTERS.permutation[0],t=r.CENTERS.permutation[5],n=r.CENTERS.permutation[1],i=n;return e<n&&i--,t<n&&i--,[e,i]}function ma(r){let[e,t]=Jh(r),n=u0[e][t];return gt(Ye,r,n)}function qv(r,e,t){let n=Wi(Ye,u0[e][t]);return gt(Ye,r,n)}var u0,c0=oe(()=>{Oe();Ht();Ht();u0=new Array(6).fill(0).map(()=>new Array(6));{let r=new pn(Ye),e=["","z","x","z'","x'","x2"].map(n=>re.fromString(n)),t=new re("y");for(let n of e){r.reset(),r.applyAlg(n);for(let i=0;i<4;i++){r.applyAlg(t);let[o,s]=Jh(r.state);u0[o][s]=Wi(Ye,r.state)}}}});function GE(r){let e=0;for(let t of r)e+=t;return e}function WE(r,e){let t=new Uint8Array(e),n=0,i=0,o=0,s=[];for(let a of r){for(;i<a;)o=o<<8|t[n++],i+=8;s.push(o>>i-a&(1<<a)-1),i-=a}return s}function VE(r,e){let t=new Uint8Array(Math.ceil(GE(r)/8)),n=0,i=0,o=0;for(let s=0;s<r.length;s++)for(o=o<<r[s]|e[s],i+=r[s];i>=8;)t[n++]=o>>i-8,i-=8;return i>0&&(t[n++]=o<<8-i),t}function Qv(r){return r.poIdxU!==7}function HE(r){let e=ma(r),t=a0(e.EDGES.permutation),n=Kh(2,e.EDGES.orientation),i=a0(e.CORNERS.permutation),o=Kh(3,e.CORNERS.orientation),[s,a]=Jh(r),l=1,u=Kh(4,e.CENTERS.orientation);return{epLex:t,eoMask:n,cpLex:i,coMask:o,poIdxU:s,poIdxL:a,moSupport:l,moMask:u}}function qE(r){let{epLex:e,eoMask:t,cpLex:n,coMask:i,poIdxU:o,poIdxL:s,moSupport:a,moMask:l}=r;return VE(jv,[e,t,n,i,o,s,a,l])}function Yv(r){let e=HE(r);return qE(e)}function mu(r){let[e,t,n,i,o,s,a,l]=WE(jv,r);return{epLex:e,eoMask:t,cpLex:n,coMask:i,poIdxU:o,poIdxL:s,moSupport:a,moMask:l}}function gu(r){if(r.moSupport!==1)throw new Error("Must support center orientation.");let e={EDGES:{permutation:l0(12,r.epLex),orientation:Zh(2,12,r.eoMask)},CORNERS:{permutation:l0(8,r.cpLex),orientation:Zh(3,8,r.coMask)},CENTERS:{permutation:Vv(6),orientation:Zh(4,6,r.moMask)}};return Qv(r)?qv(e,r.poIdxU,r.poIdxL):e}function jE(r){let e=[];return(r.epLex<0||r.epLex>=479001600)&&e.push(`epLex (${r.epLex}) out of range`),(r.cpLex<0||r.cpLex>=40320)&&e.push(`cpLex (${r.cpLex}) out of range`),(r.coMask<0||r.coMask>=6561)&&e.push(`coMask (${r.coMask}) out of range`),(r.poIdxU<0||r.poIdxU>=6)&&Qv(r)&&e.push(`poIdxU (${r.poIdxU}) out of range`),(r.eoMask<0||r.eoMask>=4096)&&e.push(`eoMask (${r.eoMask}) out of range`),(r.moMask<0||r.moMask>=4096)&&e.push(`moMask (${r.moMask}) out of range`),(r.poIdxL<0||r.poIdxL>=4)&&e.push(`poIdxL (${r.poIdxL}) out of range`),(r.moSupport<0||r.moSupport>=2)&&e.push(`moSupport (${r.moSupport}) out of range`),e}function Xv(r){let e=mu(r),t=jE(e);if(t.length!==0)throw new Error(`Invalid binary state components: ${t.join(", ")}`);return gu(e)}var jv,h0=oe(()=>{Hv();c0();jv=[29,12,16,13,3,2,1,12]});function Kv(r){return Array.prototype.map.call(new Uint8Array(r),e=>("00"+e.toString(16)).slice(-2)).join(" ")}function Zv(r){return new Uint8Array(r.split(" ").map(e=>parseInt(e,16)))}var Jv=oe(()=>{});var f0={};Rt(f0,{bufferToSpacedHex:()=>Kv,experimentalBinaryComponentsToReid3x3x3:()=>gu,experimentalNormalizePuzzleOrientation:()=>ma,experimentalTwizzleBinaryToBinaryComponents:()=>mu,reid3x3x3ToTwizzleBinary:()=>Yv,spacedHexToBuffer:()=>Zv,twizzleBinaryToReid3x3x3:()=>Xv});var $h=oe(()=>{h0();Jv();c0();h0()});function $v(r,e){let t=ma(r);return e.ignoreCenterOrientation?Jr(Ye,"EDGES",t,Ye.startPieces)&&Jr(Ye,"CORNERS",t,Ye.startPieces):Vi(Ye,t,Ye.startPieces)}var ex=oe(()=>{$h();s0();du()});var p0={};Rt(p0,{CanonicalSequenceIterator:()=>r0,Canonicalizer:()=>i0,KPuzzle:()=>pn,KPuzzleSVGWrapper:()=>Xo,SearchSequence:()=>$r,areOrbitTransformationsEquivalent:()=>Jr,areStatesEquivalent:()=>Qh,areTransformationsEquivalent:()=>Vi,combineTransformations:()=>gt,experimentalCube3x3x3KPuzzle:()=>Ye,experimentalIs3x3x3Solved:()=>$v,experimentalTransformationForQuantumMove:()=>Yh,identityTransformation:()=>Li,invertTransformation:()=>Wi,multiplyTransformations:()=>Yo,parseKPuzzleDefinition:()=>o0,transformationForMove:()=>Ai,transformationOrder:()=>Pv});var Ht=oe(()=>{n0();zv();du();Ov();Wv();s0();ex();n0()});var yu,tx=oe(()=>{yu=class{constructor(e,t){this.facenames=e;this.prefixFree=!0;this.gripnames=[];t&&(this.gripnames=t);for(let n=0;this.prefixFree&&n<e.length;n++)for(let i=0;this.prefixFree&&i<e.length;i++)n!==i&&e[n].startsWith(e[i])&&(this.prefixFree=!1)}setGripNames(e){this.gripnames=e}splitByFaceNames(e){let t=[],n=0;for(;n<e.length;){n>0&&n<e.length&&e[n]==="_"&&n++;let i=-1;for(let o=0;o<this.facenames.length;o++)e.substr(n).startsWith(this.facenames[o])&&(i<0||this.facenames[o].length>this.facenames[i].length)&&(i=o);if(i>=0)t.push(i),n+=this.facenames[i].length;else throw new Error("Could not split "+e+" into face names.")}return t}joinByFaceIndices(e){let t="",n=[];for(let i=0;i<e.length;i++)n.push(t),n.push(this.facenames[e[i]]),this.prefixFree||(t="_");return n.join("")}spinmatch(e,t){if(e===t)return!0;try{let n=this.splitByFaceNames(e),i=this.splitByFaceNames(t);if(n.length!==i.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 s=!1;for(let a=0;a<i.length;a++)if(n[o]===i[a]){s=!0;break}if(!s)return!1}return!0}catch(n){return!1}}unswizzle(e){(e.endsWith("v")||e.endsWith("w"))&&e[0]<="Z"&&(e=e.slice(0,e.length-1));let t=e.toUpperCase();for(let n=0;n<this.gripnames.length;n++){let i=this.gripnames[n];if(this.spinmatch(t,i))return i}return e}}});var ga,nx=oe(()=>{ga=class{notationToInternal(e){return e}notationToExternal(e){return e}}});var ef,ix=oe(()=>{Oe();ef=class{constructor(e,t){this.child=e;this.sw=t}notationToInternal(e){return e.family==="T"&&e.innerLayer===void 0&&e.outerLayer===void 0?new E(new ze("FLRv",e.innerLayer,e.outerLayer),e.amount):this.child.notationToInternal(e)}notationToExternal(e){let t=e.family;return t.length>0&&t[t.length-1]==="v"&&(t=t.substring(0,t.length-1)),this.sw.spinmatch(t,"FLUR")?new E(new ze("T",e.innerLayer,e.outerLayer),e.amount):this.child.notationToExternal(e)}}});var vu,rx=oe(()=>{Oe();vu=class{constructor(e,t){this.internalNames=e;this.externalNames=t}convertString(e,t,n){let i="";(e.endsWith("v")||e.endsWith("v"))&&e<="_"&&(i=e.slice(e.length-1),e=e.slice(0,e.length-1));let o=e.toUpperCase(),s=!1;return e!==o&&(s=!0,e=o),e=n.joinByFaceIndices(t.splitByFaceNames(e)),s&&(e=e.toLowerCase()),e+i}convert(e,t,n){let i=e.family,o=this.convertString(i,t,n);return i===o?e:new E(new ze(o,e.innerLayer,e.outerLayer),e.amount)}notationToInternal(e){return this.convert(e,this.externalNames,this.internalNames)}notationToExternal(e){return this.convert(e,this.internalNames,this.externalNames)}}});var tf,ox=oe(()=>{Oe();tf=class{constructor(e){this.child=e}notationToInternal(e){if(e.innerLayer===void 0&&e.outerLayer===void 0){if(Math.abs(e.amount)===1){if(e.family==="R++")return new E(new ze("L",3,2),-2*e.amount);if(e.family==="R--")return new E(new ze("L",3,2),2*e.amount);if(e.family==="D++")return new E(new ze("U",3,2),-2*e.amount);if(e.family==="D--")return new E(new ze("U",3,2),2*e.amount);if(e.family==="R_PLUSPLUS_")return new E(new ze("L",3,2),-2*e.amount);if(e.family==="D_PLUSPLUS_")return new E(new ze("U",3,2),-2*e.amount)}if(e.family==="y")return new E("Uv",e.amount)}return this.child.notationToInternal(e)}notationToExternal(e){return e.family==="Uv"?new E(new ze("y",e.innerLayer,e.outerLayer),e.amount):e.family==="Dv"?new E("y",-e.amount):this.child.notationToExternal(e)}}});var nf,sx=oe(()=>{Oe();nf=class{constructor(e){this.slices=e}notationToInternal(e){let t=e.family;return!e.innerLayer&&!e.outerLayer&&(t==="x"?e=new E("Rv",e.amount):t==="y"?e=new E("Uv",e.amount):t==="z"&&(e=new E("Fv",e.amount)),(this.slices&1)==1&&(t==="E"?e=new E(new ze("D",(this.slices+1)/2),e.amount):t==="M"?e=new E(new ze("L",(this.slices+1)/2),e.amount):t==="S"&&(e=new E(new ze("F",(this.slices+1)/2),e.amount))),this.slices>2&&(t==="e"?e=new E(new ze("D",this.slices-1,2),e.amount):t==="m"?e=new E(new ze("L",this.slices-1,2),e.amount):t==="s"&&(e=new E(new ze("F",this.slices-1,2),e.amount)))),e}notationToExternal(e){let t=e.family;if(!e.innerLayer&&!e.outerLayer){if(t==="Rv")return new E("x",e.amount);if(t==="Uv")return new E("y",e.amount);if(t==="Fv")return new E("z",e.amount);if(t==="Lv")return new E("x",-e.amount);if(t==="Dv")return new E("y",-e.amount);if(t==="Bv")return new E("z",-e.amount)}return e}}});var QE,YE,ax,lx,ux,xu,rf,cx=oe(()=>{Oe();QE={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"},YE={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"},ax={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},lx=new ze("y"),ux=new ze("Dv"),xu=class{constructor(e){this.child=e;this.wcaHack=!1;this.map=QE}notationToInternal(e){if(this.wcaHack&&e.innerLayer===2&&e.outerLayer===null){let n=ax[e.family];if(n)return new E(new ze(n,e.innerLayer,e.outerLayer),e.amount)}let t=this.map[e.family];return t?new E(new ze(t,e.innerLayer,e.outerLayer),e.amount):lx.isIdentical(e.quantum)?new E(ux,-e.amount):null}notationToExternal(e){if(this.wcaHack&&e.innerLayer===2&&e.outerLayer===null){for(let[t,n]of Object.entries(ax))if(this.child.spinmatch(e.family,n))return new E(new ze(t,e.innerLayer,e.outerLayer),e.amount)}for(let[t,n]of Object.entries(this.map))if(this.child.spinmatch(e.family,n))return new E(new ze(t,e.innerLayer,e.outerLayer),e.amount);return ux.isIdentical(e.quantum)?new E(lx,-e.amount):null}},rf=class extends xu{constructor(e){super(e);this.map=YE}}});var hx,fx,px,dx,mx,gx,yx,of,vx=oe(()=>{Oe();hx={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"},fx=new ze("x"),px=new ze("Rv"),dx=new ze("y"),mx=new ze("Uv"),gx=new ze("z"),yx=new ze("Fv"),of=class{constructor(e){this.child=e}notationToInternal(e){if(e.innerLayer||e.outerLayer)return null;let t=hx[e.family];return t?new E(new ze(t,e.outerLayer,e.innerLayer),e.amount):fx.isIdentical(e.quantum)?new E(px,e.amount):dx.isIdentical(e.quantum)?new E(mx,e.amount):gx.isIdentical(e.quantum)?new E(yx,e.amount):null}notationToExternal(e){for(let[t,n]of Object.entries(hx))if(this.child.spinmatch(e.family,n))return new E(new ze(t,e.innerLayer,e.outerLayer),e.amount);return px.isIdentical(e.quantum)?new E(fx,e.amount):mx.isIdentical(e.quantum)?new E(dx,e.amount):yx.isIdentical(e.quantum)?new E(gx,e.amount):null}}});var d0=oe(()=>{nx();ix();rx();ox();sx();cx();vx()});function xx(r){let e=0,t={};for(;e<r.length&&r[e][0]==="-";){let i=r[e++];if(i==="--rotations")t.addRotations=!0;else if(i==="--allmoves")t.allMoves=!0;else if(i==="--outerblockmoves")t.outerBlockMoves=!0;else if(i==="--vertexmoves")t.vertexMoves=!0;else if(i==="--nocorners")t.includeCornerOrbits=!1;else if(i==="--noedges")t.includeEdgeOrbits=!1;else if(i==="--noorientation")t.fixedOrientation=!0;else if(i==="--nocenters")t.includeCenterOrbits=!1;else if(i==="--omit")t.excludeOrbits=r[e].split(","),e++;else if(i==="--moves")t.moveList=r[e].split(","),e++;else if(i==="--optimize")t.optimizeOrbits=!0;else if(i==="--scramble")t.scrambleAmount=100;else if(i==="--fixcorner")t.fixedPieceType="v";else if(i==="--fixedge")t.fixedPieceType="e";else if(i==="--fixcenter")t.fixedPieceType="f";else if(i==="--orientcenters")t.orientCenters=!0;else if(i==="--puzzleorientation")t.puzzleOrientation=JSON.parse(r[e]),e++;else throw new Error("Bad option: "+i)}return{puzzleDescription:wu(r.slice(e).join(" ")),options:t}}var m0,g0=oe(()=>{y0();m0=class{constructor(e={}){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,e)}}});function eo(r){if(!v0[r]){let e=Array(r);for(let t=0;t<r;t++)e[t]=0;v0[r]=e}return v0[r]}function Hi(r){if(!x0[r]){let e=Array(r);for(let t=0;t<r;t++)e[t]=t;x0[r]=e}return x0[r]}function wx(r){return new fi(Hi(r))}function bx(r){let e=1;for(;r>1;)e*=r,r--;return e}function XE(r,e){if(r>e){let t=r;r=e,e=t}for(;r>0;){let t=e%r;e=r,r=t}return e}function w0(r,e){return r/XE(r,e)*e}var v0,x0,fi,sf=oe(()=>{v0=[],x0=[];fi=class{constructor(e){this.n=e.length,this.p=e}toString(){return"Perm["+this.p.join(" ")+"]"}mul(e){let t=Array(this.n);for(let n=0;n<this.n;n++)t[n]=e.p[this.p[n]];return new fi(t)}rmul(e){let t=Array(this.n);for(let n=0;n<this.n;n++)t[n]=this.p[e.p[n]];return new fi(t)}inv(){let e=Array(this.n);for(let t=0;t<this.n;t++)e[this.p[t]]=t;return new fi(e)}compareTo(e){for(let t=0;t<this.n;t++)if(this.p[t]!==e.p[t])return this.p[t]-e.p[t];return 0}toGap(){let e=new Array,t=new Array(this.n);for(let n=0;n<this.p.length;n++){if(t[n]||this.p[n]===n)continue;let i=new Array;for(let o=n;!t[o];o=this.p[o])i.push(1+o),t[o]=!0;e.push("("+i.join(",")+")")}return e.join("")}order(){let e=1,t=new Array(this.n);for(let n=0;n<this.p.length;n++){if(t[n]||this.p[n]===n)continue;let i=0;for(let o=n;!t[o];o=this.p[o])i++,t[o]=!0;e=w0(e,i)}return e}}});function b0(r,e){let t=E.fromString(e),n=r.notationToExternal(t);return n===null||t===n?e:n.toString()}function Sx(r,e){let t=r.moveops.length;if(t>30)throw new Error("Canon info too big for bitmask");let n=[],i=[];for(let s=0;s<t;s++){let a=r.moveops[s];n.push(a.order());let l=0;for(let u=0;u<t;u++){if(u===s)continue;let c=r.moveops[u];a.mul(c).equal(c.mul(a))&&(l|=1<<u)}i.push(l)}let o={};o[0]=1;for(let s=0;s<100;s++){let a=0,l={},u=0;for(let c in o){let f=+c,h=o[f];a+=h,u++;for(let p=0;p<n.length;p++)if((f>>p&1)==0&&(f&i[p]&(1<<p)-1)==0){let d=f&i[p]|1<<p;l[d]===void 0&&(l[d]=0),l[d]+=(n[p]-1)*h}}e(`${s}: canonseq ${a} states ${u}`),o=l}}var bu,ya,Di,pr,S0,to,va,L0,Lx=oe(()=>{Oe();d0();sf();bu=class{constructor(e,t){this.size=e;this.mod=t}reassemblySize(){return bx(this.size)*Math.pow(this.mod,this.size)}};ya=class{constructor(e,t,n,i,o){this.orbitnames=e;this.orbitdefs=t;this.solved=n;this.movenames=i;this.moveops=o}transformToKPuzzle(e){let t={};for(let n=0;n<this.orbitnames.length;n++)t[this.orbitnames[n]]=e.orbits[n].toKPuzzle();return t}static transformToKPuzzle(e,t){let n={};for(let i=0;i<e.length;i++)n[e[i]]=t.orbits[i].toKPuzzle();return n}toKsolve(e,t=new ga){let n=[];n.push("Name "+e),n.push("");for(let i=0;i<this.orbitnames.length;i++)n.push(`Set ${this.orbitnames[i]} ${this.orbitdefs[i].size} ${this.orbitdefs[i].mod}`);n.push(""),n.push("Solved");for(let i=0;i<this.orbitnames.length;i++)this.solved.orbits[i].appendDefinition(n,this.orbitnames[i],!1,!1);n.push("End");for(let i=0;i<this.movenames.length;i++){n.push("");let o=b0(t,this.movenames[i]),s=!1;o[o.length-1]==="'"&&(s=!0,o=o.substring(0,o.length-1)),n.push("Move "+o);for(let a=0;a<this.orbitnames.length;a++)s?this.moveops[i].orbits[a].inv().appendDefinition(n,this.orbitnames[a],!0):this.moveops[i].orbits[a].appendDefinition(n,this.orbitnames[a],!0);n.push("End")}return n}toKPuzzle(e){let t={},n={};for(let o=0;o<this.orbitnames.length;o++)t[this.orbitnames[o]]={numPieces:this.orbitdefs[o].size,orientations:this.orbitdefs[o].mod},n[this.orbitnames[o]]=this.solved.orbits[o].toKPuzzle();let i={};if(e)for(let o=0;o<this.movenames.length;o++)i[this.movenames[o]]=this.transformToKPuzzle(this.moveops[o]);return{name:"PG3D",orbits:t,startPieces:n,moves:i}}optimize(){let e=[],t=[],n=[],i=[];for(let o=0;o<this.moveops.length;o++)i.push([]);for(let o=0;o<this.orbitdefs.length;o++){let s=this.orbitdefs[o].mod,a=this.orbitdefs[o].size,l=new L0(a),u=new Array(this.orbitdefs[o].size);for(let p=0;p<a;p++)u[p]=!1;for(let p=0;p<this.moveops.length;p++)for(let d=0;d<a;d++)(this.moveops[p].orbits[o].perm[d]!==d||this.moveops[p].orbits[o].ori[d]!==0)&&(u[d]=!0,l.union(d,this.moveops[p].orbits[o].perm[d]));let c=!0;if(s>1){c=!1;let p=new L0(this.orbitdefs[o].size*s);for(let d=0;d<this.moveops.length;d++)for(let g=0;g<a;g++)if(this.moveops[d].orbits[o].perm[g]!==g||this.moveops[d].orbits[o].ori[g]!==0)for(let x=0;x<s;x++)p.union(g*s+x,this.moveops[d].orbits[o].perm[g]*s+(x+this.moveops[d].orbits[o].ori[g])%s);for(let d=0;!c&&d<a;d++)for(let g=1;g<s;g++)p.find(d*s)===p.find(d*s+g)&&(c=!0);for(let d=0;!c&&d<a;d++)for(let g=0;g<d;g++)this.solved.orbits[o].perm[d]===this.solved.orbits[o].perm[g]&&(c=!0)}let f=-1,h=!1;for(let p=0;p<this.orbitdefs[o].size;p++)if(u[p]){let d=l.find(p);f<0?f=d:f!==d&&(h=!0)}for(let p=0;p<this.orbitdefs[o].size;p++){if(!u[p]||l.find(p)!==p)continue;let g=[],x=[],y=0;for(let m=0;m<this.orbitdefs[o].size;m++)l.find(m)===p&&(g[y]=m,x[m]=y,y++);if(h?e.push(`${this.orbitnames[o]}_p${p}`):e.push(this.orbitnames[o]),c){t.push(new bu(y,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(g,y));for(let m=0;m<this.moveops.length;m++)i[m].push(this.moveops[m].orbits[o].remap(g,x,y))}else{t.push(new bu(y,1)),n.push(this.solved.orbits[o].remapVS(g,y).killOri());for(let m=0;m<this.moveops.length;m++)i[m].push(this.moveops[m].orbits[o].remap(g,x,y).killOri())}}}return new ya(e,t,new va(n),this.movenames,i.map(o=>new to(o)))}scramble(e){let t=[];for(let i=0;i<this.moveops.length;i++)t[i]=this.moveops[i];for(let i=0;i<t.length;i++){let o=Math.floor(Math.random()*t.length),s=t[i];t[i]=t[o],t[o]=s}e<t.length&&(e=t.length);for(let i=0;i<e;i++){let o=Math.floor(Math.random()*t.length),s=Math.floor(Math.random()*t.length),a=Math.floor(Math.random()*this.moveops.length);t[o]=t[o].mul(t[s]).mul(this.moveops[a]),Math.random()<.1&&(t[o]=t[o].mul(this.moveops[a]))}let n=t[0];for(let i=1;i<t.length;i++)n=n.mul(t[i]);this.solved=this.solved.mul(n)}reassemblySize(){let e=1;for(let t=0;t<this.orbitdefs.length;t++)e*=this.orbitdefs[t].reassemblySize();return e}},Di=class{constructor(e,t,n){this.perm=e;this.ori=t;this.orimod=n}static e(e,t){return new Di(Hi(e),eo(e),t)}mul(e){let t=this.perm.length,n=new Array(t);if(this.orimod===1){for(let i=0;i<t;i++)n[i]=this.perm[e.perm[i]];return new Di(n,this.ori,this.orimod)}else{let i=new Array(t);for(let o=0;o<t;o++)n[o]=this.perm[e.perm[o]],i[o]=(this.ori[e.perm[o]]+e.ori[o])%this.orimod;return new Di(n,i,this.orimod)}}inv(){let e=this.perm.length,t=new Array(e),n=new Array(e);for(let i=0;i<e;i++)t[this.perm[i]]=i,n[this.perm[i]]=(this.orimod-this.ori[i])%this.orimod;return new Di(t,n,this.orimod)}equal(e){let t=this.perm.length;for(let n=0;n<t;n++)if(this.perm[n]!==e.perm[n]||this.ori[n]!==e.ori[n])return!1;return!0}killOri(){let e=this.perm.length;for(let t=0;t<e;t++)this.ori[t]=0;return this.orimod=1,this}toPerm(){let e=this.orimod;if(e===1)return new fi(this.perm);let t=this.perm.length,n=new Array(t*e);for(let i=0;i<t;i++)for(let o=0;o<e;o++)n[i*e+o]=e*this.perm[i]+(this.ori[i]+o)%e;return new fi(n)}identicalPieces(){let e=[],t=this.perm.length,n=[];for(let i=0;i<t;i++){let o=this.perm[i];if(e[o]===void 0){let s=[i];e[o]=!0;for(let a=i+1;a<t;a++)this.perm[a]===o&&s.push(a);n.push(s)}}return n}order(){return this.toPerm().order()}isIdentity(){let e=this.perm.length;if(this.perm===Hi(e)&&this.ori===eo(e))return!0;for(let t=0;t<e;t++)if(this.perm[t]!==t||this.ori[t]!==0)return!1;return!0}zeroOris(){let e=this.perm.length;if(this.ori===eo(e))return!0;for(let t=0;t<e;t++)if(this.ori[t]!==0)return!1;return!0}remap(e,t,n){let i=new Array(n),o=new Array(n);for(let s=0;s<n;s++)i[s]=t[this.perm[e[s]]],o[s]=this.ori[e[s]];return new Di(i,o,this.orimod)}remapVS(e,t){let n=new Array(t),i=new Array(t),o=0,s=[];for(let a=0;a<t;a++){let l=this.perm[e[a]];s[l]===void 0&&(s[l]=o++),n[a]=s[l],i[a]=this.ori[e[a]]}return new Di(n,i,this.orimod)}appendDefinition(e,t,n,i=!0){if(!(i&&this.isIdentity())&&(e.push(t),e.push(this.perm.map(o=>o+1).join(" ")),!this.zeroOris()))if(n){let o=new Array(this.ori.length);for(let s=0;s<o.length;s++)o[this.perm[s]]=this.ori[s];e.push(o.join(" "))}else e.push(this.ori.join(" "))}toKPuzzle(){let e=this.perm.length;return this.isIdentity()?(Di.kcache[e]||(Di.kcache[e]={permutation:Hi(e),orientation:eo(e)}),Di.kcache[e]):{permutation:this.perm,orientation:this.ori}}},pr=Di;pr.kcache=[];S0=class{constructor(e){this.orbits=e}internalMul(e){let t=[];for(let n=0;n<this.orbits.length;n++)t.push(this.orbits[n].mul(e.orbits[n]));return t}internalInv(){let e=[];for(let t of this.orbits)e.push(t.inv());return e}equal(e){for(let t=0;t<this.orbits.length;t++)if(!this.orbits[t].equal(e.orbits[t]))return!1;return!0}killOri(){for(let e of this.orbits)e.killOri();return this}toPerm(){let e=new Array,t=0;for(let i of this.orbits){let o=i.toPerm();e.push(o),t+=o.n}let n=new Array(t);t=0;for(let i of e){for(let o=0;o<i.n;o++)n[t+o]=t+i.p[o];t+=i.n}return new fi(n)}identicalPieces(){let e=[],t=0;for(let n of this.orbits){let i=n.orimod,o=n.identicalPieces();for(let s=0;s<o.length;s++)e.push(o[s].map(a=>a*i+t));t+=i*n.perm.length}return e}order(){let e=1;for(let t of this.orbits)e=w0(e,t.order());return e}},to=class extends S0{constructor(e){super(e)}mul(e){return new to(this.internalMul(e))}mulScalar(e){if(e===0)return this.e();let t=this;for(e<0&&(t=t.inv(),e=-e);(e&1)==0;)t=t.mul(t),e>>=1;if(e===1)return t;let n=t,i=this.e();for(;e>0;)e&1&&(i=i.mul(n)),e>1&&(n=n.mul(n)),e>>=1;return i}inv(){return new to(this.internalInv())}e(){return new to(this.orbits.map(e=>pr.e(e.perm.length,e.orimod)))}},va=class extends S0{constructor(e){super(e)}mul(e){return new va(this.internalMul(e))}},L0=class{constructor(e){this.n=e;this.heads=new Array(e);for(let t=0;t<e;t++)this.heads[t]=t}find(e){let t=this.heads[e];return this.heads[t]===t||(t=this.find(this.heads[t]),this.heads[e]=t),t}union(e,t){let n=this.find(e),i=this.find(t);n<i?this.heads[i]=n:n>i&&(this.heads[n]=i)}}});var af,Ax=oe(()=>{af={"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 lf(r){let e=new Ge(0,0,0,0);for(let t=0;t<r.length;t++)e=e.sum(r[t]);return e.smul(1/r.length)}function Dx(r,e,t,n){let i=n[r].intersect3(n[e],n[t]);if(!i)return i;for(let o=0;o<n.length;o++)if(o!==r&&o!==e&&o!==t){let s=n[o].b*i.b+n[o].c*i.c+n[o].d*i.d;if(n[o].a>0&&s>n[o].a||n[o].a<0&&s<n[o].a)return!1}return i}var Ko,Ge,uf=oe(()=>{Ko=1e-9;Ge=class{constructor(e,t,n,i){this.a=e;this.b=t;this.c=n;this.d=i}mul(e){return new Ge(this.a*e.a-this.b*e.b-this.c*e.c-this.d*e.d,this.a*e.b+this.b*e.a+this.c*e.d-this.d*e.c,this.a*e.c-this.b*e.d+this.c*e.a+this.d*e.b,this.a*e.d+this.b*e.c-this.c*e.b+this.d*e.a)}toString(){return`Q[${this.a},${this.b},${this.c},${this.d}]`}dist(e){return Math.hypot(this.a-e.a,this.b-e.b,this.c-e.c,this.d-e.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(e){return new Ge(0,this.c*e.d-this.d*e.c,this.d*e.b-this.b*e.d,this.b*e.c-this.c*e.b)}dot(e){return this.b*e.b+this.c*e.c+this.d*e.d}normalize(){let e=Math.sqrt(this.dot(this));return new Ge(this.a/e,this.b/e,this.c/e,this.d/e)}makenormal(){return new Ge(0,this.b,this.c,this.d).normalize()}normalizeplane(){let e=Math.hypot(this.b,this.c,this.d);return new Ge(this.a/e,this.b/e,this.c/e,this.d/e)}smul(e){return new Ge(this.a*e,this.b*e,this.c*e,this.d*e)}sum(e){return new Ge(this.a+e.a,this.b+e.b,this.c+e.c,this.d+e.d)}sub(e){return new Ge(this.a-e.a,this.b-e.b,this.c-e.c,this.d-e.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new Ge(this.a,-this.b,-this.c,-this.d)}det3x3(e,t,n,i,o,s,a,l,u){return e*(o*u-s*l)+t*(s*a-i*u)+n*(i*l-o*a)}rotateplane(e){let t=e.mul(new Ge(0,this.b,this.c,this.d)).mul(e.invrot());return t.a=this.a,t}orthogonal(){let e=Math.abs(this.b),t=Math.abs(this.c),n=Math.abs(this.d);return e<t&&e<n?this.cross(new Ge(0,1,0,0)).normalize():t<e&&t<n?this.cross(new Ge(0,0,1,0)).normalize():this.cross(new Ge(0,0,0,1)).normalize()}pointrotation(e){let t=this.normalize();if(e=e.normalize(),t.sub(e).len()<Ko)return new Ge(1,0,0,0);let n=t.sum(e);n.len()<Ko?n=n.orthogonal():n=n.normalize();let i=t.cross(n);return i.a=t.dot(n),i}unproject(e){return this.sum(e.smul(-this.dot(e)/(this.len()*e.len())))}rotatepoint(e){return e.mul(this).mul(e.invrot())}rotateface(e){return e.map(t=>t.rotatepoint(this))}intersect3(e,t){let n=this.det3x3(this.b,this.c,this.d,e.b,e.c,e.d,t.b,t.c,t.d);return Math.abs(n)<Ko?!1:new Ge(0,this.det3x3(this.a,this.c,this.d,e.a,e.c,e.d,t.a,t.c,t.d)/n,this.det3x3(this.b,this.a,this.d,e.b,e.a,e.d,t.b,t.a,t.d)/n,this.det3x3(this.b,this.c,this.a,e.b,e.c,e.a,t.b,t.c,t.a)/n)}side(e){return e>Ko?1:e<-Ko?-1:0}cutface(e){let t=this.a,n=0,i=null;for(let o=0;o<e.length;o++)n|=1<<this.side(e[o].dot(this)-t)+1;if((n&5)==5){i=[];let o=e.map(s=>this.side(s.dot(this)-t));for(let s=-1;s<=1;s+=2){let a=[];for(let l=0;l<e.length;l++){(o[l]===s||o[l]===0)&&a.push(e[l]);let u=(l+1)%e.length;if(o[l]+o[u]===0&&o[l]!==0){let c=e[l].dot(this)-t,f=e[u].dot(this)-t,h=c/(c-f),p=e[l].smul(1-h).sum(e[u].smul(h));a.push(p)}}i.push(a)}}return i}cutfaces(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],o=this.cutface(i);o?(t.push(o[0]),t.push(o[1])):t.push(i)}return t}faceside(e){let t=this.a;for(let n=0;n<e.length;n++){let i=this.side(e[n].dot(this)-t);if(i!==0)return i}throw new Error("Could not determine side of plane in faceside")}sameplane(e){let t=this.normalize(),n=e.normalize();return t.dist(n)<Ko||t.dist(n.smul(-1))<Ko}makecut(e){return new Ge(e,this.b,this.c,this.d)}}});function Ex(){let r=Math.sqrt(.5);return[new Ge(r,r,0,0),new Ge(r,0,r,0)]}function Mx(){return[new Ge(.5,.5,.5,.5),new Ge(.5,.5,.5,-.5)]}function Rx(){let r=2*Math.PI/10,e=.5+.3*Math.sqrt(5),t=.5+.1*Math.sqrt(5),n=Math.sqrt(e*e+t*t);return e/=n,t/=n,[new Ge(Math.cos(r),e*Math.sin(r),t*Math.sin(r),0),new Ge(.5,.5,.5,.5)]}function Tx(){let r=1/6+Math.sqrt(5)/6,e=2/3+Math.sqrt(5)/3,t=Math.sqrt(r*r+e*e);r/=t,e/=t;let n=2*Math.PI/6;return[new Ge(Math.cos(n),r*Math.sin(n),e*Math.sin(n),0),new Ge(Math.cos(n),-r*Math.sin(n),e*Math.sin(n),0)]}function Fx(){let r=Math.sqrt(.5);return[new Ge(.5,.5,.5,.5),new Ge(r,0,0,r)]}function _x(r){let e=[new Ge(1,0,0,0)];for(let t=0;t<e.length;t++)for(let n=0;n<r.length;n++){let i=r[n].mul(e[t]),o=i.smul(-1),s=!1;for(let a=0;a<e.length;a++)if(i.dist(e[a])<cf||o.dist(e[a])<cf){s=!0;break}s||e.push(i)}return e}function A0(r,e){let t=[],n=[];for(let i=0;i<e.length;i++){let o=r.rotateplane(e[i]),s=!1;for(let a=0;a<t.length;a++)if(o.dist(t[a])<cf){s=!0;break}s||(t.push(o),n.push(e[i]))}return n}function D0(r){let e=[];for(let t=1;t<r.length;t++)for(let n=t+1;n<r.length;n++){let i=Dx(0,t,n,r);if(i){let o=!1;for(let s=0;s<e.length;s++)if(i.dist(e[s])<cf){o=!0;break}o||e.push(i)}}for(;;){let t=!1;for(let n=0;n<e.length;n++){let i=(n+1)%e.length;if(r[0].dot(e[n].cross(e[i]))<0){let o=e[n];e[n]=e[i],e[i]=o,t=!0}}if(!t)break}return e}var cf,Cx=oe(()=>{uf();cf=1e-9});function hf(r,e){let t=r[0].p.length,n=wx(t),i=[],o=[],s=[],a=[],l=[];function u(p){for(let d=p.p.length-1;d>=0;d--){let g=p.p[d];if(g!==d){if(!i[d][g])return!1;p=p.mul(o[d][g])}}return!0}function c(p,d,g){a[p].push(d),l[p].push(g);for(let x=0;x<i[p].length;x++)i[p][x]&&f(p,i[p][x].mul(d),g+s[p][x])}function f(p,d,g){let x=d.p[p];if(!i[p][x]){i[p][x]=d,o[p][x]=d.inv(),s[p][x]=g;for(let m=0;m<a[p].length;m++)f(p,d.mul(a[p][m]),g+l[p][m]);return}let y=d.mul(o[p][x]);u(y)||c(p-1,y,g+s[p][x])}function h(){i=[],o=[],a=[],s=[],l=[];for(let g=0;g<t;g++)i.push([]),o.push([]),s.push([]),a.push([]),l.push([]),i[g][g]=n,o[g][g]=n,s[g][g]=0;let p=0,d=1;for(let g=0;g<r.length;g++){c(t-1,r[g],1),d=1;let x=0,y=0,m=[],b=new Px;for(let w=0;w<t;w++){let D=0,R=0;for(let T=0;T<t;T++)i[w][T]&&(D++,R+=s[w][T],w!==T&&p++);x+=a[w].length,d*=D,D>1&&b.multiply(D);let L=R/D;m.push(L),y+=L}e(`${g}: sz ${d} T ${x} sol ${y} none ${p} mults ${b.toString()}`)}return d}return h()}var Px,E0=oe(()=>{sf();Px=class{constructor(){this.mult=[]}multiply(e){for(let t=2;t*t<=e;t++)for(;e%t==0;)this.mult[t]!==void 0?this.mult[t]++:this.mult[t]=1,e/=t;e>1&&(this.mult[e]!==void 0?this.mult[e]++:this.mult[e]=1)}toString(){let e="";for(let t=0;t<this.mult.length;t++)this.mult[t]!==void 0&&(e!==""&&(e+="*"),e+=t,this.mult[t]>1&&(e+=`^${this.mult[t]}`));return e}}});function M0(r){return r}function R0(r){}function KE(r,e){let t=[];for(let n of r)for(let i of e)t.push(i.rotate(n));return t}function $E(){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 eM(){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 tM(){return{4:["F","D","L","R"],6:["U","D","F","B","L","R"],8:["F","BB","D","U","BR","L","R","BL"],12:["L","E","F","BF","R","I","U","D","BR","A","BL","C"],20:["L","S","E","O","F","B","I","P","R","K","U","D","J","A","Q","H","G","N","M","C"]}}function nM(){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 ff(r,e){for(let t=0;t<r.length;t++)if(r[t][0].dist(e)<qt)return t;throw new Error("Element not found")}function kx(){return af}function Bx(r){return af[r]}function wu(r){let e=r.split(/ /).filter(Boolean);if(e.length%2==0)return null;let t=e[0];if(t!=="o"&&t!=="c"&&t!=="i"&&t!=="d"&&t!=="t")return null;let n=[];for(let i=1;i<e.length;i+=2){if(e[i]!=="f"&&e[i]!=="v"&&e[i]!=="e")return null;n.push({cutType:e[i],distance:parseFloat(e[i+1])})}return{shape:t,cuts:n}}function T0(r,e={}){let t=wu(r);if(t===null)throw new Error("Could not parse the puzzle description");let n=new df(t,Object.assign({},{allMoves:!0},e));return n.allstickers(),n.genperms(),n}function zx(r,e){return T0(af[r],e)}function iM(r,e,t){let n=!1;t-e[1]<e[0]&&(r=[r[2],r[3],r[0],r[1]],e=[t-e[1],t-e[0]],n=!0);let i=r[0],o="";if(e[0]===0&&e[1]===t)i=i+"v";else if(e[0]===e[1])e[1]>0&&(o=String(e[1]+1));else if(e[0]===0)i=i.toLowerCase(),e[1]>1&&(o=String(e[1]+1));else throw`We only support slice and outer block moves right now. ${e}`;return[o+i,n]}function rM(r,e){let t=[],n=0;for(;n<r.length;){n>0&&n<r.length&&r[n]==="_"&&n++;let i="";for(let o of e)r.substr(n).startsWith(o[1])&&o[1].length>i.length&&(i=o[1]);if(i!=="")t.push(i),n+=i.length;else throw new Error("Could not split "+r+" into face names.")}return t}function pf(r,e){return[r.b/e,-r.c/e,r.d/e]}function F0(r,e){let t=[],n=r.length;for(let i=0;i<n;i++){let o=pf(r.get(n-i-1),e);t[3*i]=o[0],t[3*i+1]=o[1],t[3*i+2]=o[2]}return t}var xa,Su,qt,ZE,JE,df,Ix,y0=oe(()=>{Oe();tx();d0();g0();sf();Lx();Ax();Cx();uf();E0();xa=class{constructor(e){this.coords=new Array(e.length*3);for(let t=0;t<e.length;t++)this.coords[3*t]=e[t].b,this.coords[3*t+1]=e[t].c,this.coords[3*t+2]=e[t].d;this.length=e.length}get(e){return new Ge(0,this.coords[3*e],this.coords[3*e+1],this.coords[3*e+2])}centermass(){let e=0,t=0,n=0;for(let i=0;i<this.length;i++)e+=this.coords[3*i],t+=this.coords[3*i+1],n+=this.coords[3*i+2];return new Ge(0,e/this.length,t/this.length,n/this.length)}rotate(e){let t=[];for(let n=0;n<this.length;n++)t.push(this.get(n).rotatepoint(e));return new xa(t)}rotateforward(){let e=[];for(let t=1;t<this.length;t++)e.push(this.get(t));return e.push(this.get(0)),new xa(e)}},Su=class{constructor(e,t,n){this.face=e;this.left=t;this.right=n}split(e){let t=e.cutface(this.face);return t!==null&&(this.left===void 0?(this.left=new Su(t[0]),this.right=new Su(t[1])):(this.left=this.left?.split(e),this.right=this.right?.split(e))),this}collect(e,t){return this.left===void 0?e.push(new xa(this.face)):t?(this.left?.collect(e,!1),this.right?.collect(e,!0)):(this.right?.collect(e,!1),this.left?.collect(e,!0)),e}};qt=1e-9,ZE="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",JE=!1;df=class{constructor(e,t){this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.faceorder=[];this.faceprecedence=[];this.notationMapper=new ga;this.addNotationMapper="";this.setReidOrder=!1;let n=M0("genperms");this.options=new m0(t),this.options.verbosity>0&&console.log(this.header("# ")),this.create(e),R0(n)}create(e){let{shape:t,cuts:n}=e;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let i=null;switch(t){case"c":i=Ex();break;case"o":i=Fx();break;case"i":i=Tx();break;case"t":i=Mx();break;case"d":i=Rx();break;default:throw new Error("Bad shape argument: "+t)}this.rotations=_x(i),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let o=i[0];this.baseplanerot=A0(o,this.rotations);let s=this.baseplanerot.map(P=>o.rotateplane(P));this.baseplanes=s,this.baseFaceCount=s.length;let a=$E()[s.length];this.net=a,this.colors=eM()[s.length],this.faceorder=tM()[s.length],this.options.verbosity>0&&console.log("# Base planes: "+s.length);let l=D0(s),u=new Ge(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+l.length);let c=s[0].makenormal(),f=l[0].sum(l[1]).makenormal(),h=l[0].makenormal(),p=new Ge(1,c.b,c.c,c.d);this.options.verbosity>0&&console.log("# Boundary is "+p);let g=A0(p,this.rotations).map(P=>p.rotateplane(P)),x=D0(g);this.edgedistance=x[0].sum(x[1]).smul(.5).dist(u),this.vertexdistance=x[0].dist(u);let y=[],m=[],b=!1,w=!1,D=!1;for(let P of n){let Z=null,ae=0;switch(P.cutType){case"f":Z=c,ae=1,b=!0;break;case"v":Z=h,ae=this.vertexdistance,D=!0;break;case"e":Z=f,ae=this.edgedistance,w=!0;break;default:throw new Error("Bad cut argument: "+P.cutType)}y.push(Z.makecut(P.distance)),m.push(P.distance<ae)}this.options.addRotations&&(b||y.push(c.makecut(10)),D||y.push(h.makecut(10)),w||y.push(f.makecut(10))),this.basefaces=[];for(let P of this.baseplanerot){let Z=P.rotateface(x);this.basefaces.push(new xa(Z))}let R=[],L=[],T=[],U=[],F=x.length;function C(P,Z,ae){for(let ne of P)if(ne[0].dist(Z)<qt){ne.push(ae);return}P.push([Z,ae])}for(let P=0;P<this.baseplanerot.length;P++){let Z=this.baseplanerot[P].rotateface(x);for(let ae=0;ae<Z.length;ae++){let ne=(ae+1)%Z.length,fe=Z[ae].sum(Z[ne]).smul(.5);C(U,fe,P)}}let j=[];for(let P=0;P<this.baseplanerot.length;P++){let Z=this.baseplanerot[P].rotateface(x),ae=[];for(let ne=0;ne<Z.length;ne++){let fe=(ne+1)%Z.length,W=Z[ne].sum(Z[fe]).smul(.5),Q=U[ff(U,W)];if(P===Q[1])ae.push(Q[2]);else if(P===Q[2])ae.push(Q[1]);else throw new Error("Could not find edge")}j.push(ae)}let B={},z=[];z.push(a[0][0]),B[a[0][0]]=0,z[j[0][0]]=a[0][1],B[a[0][1]]=j[0][0];for(let P of a){let Z=P[0],ae=B[Z];if(ae===void 0)throw new Error("Bad edge description; first edge not connected");let ne=-1;for(let fe=0;fe<j[ae].length;fe++){let W=z[j[ae][fe]];if(W!==void 0&&W===P[1]){ne=fe;break}}if(ne<0)throw new Error("First element of a net not known");for(let fe=2;fe<P.length;fe++){if(P[fe]==="")continue;let W=j[ae][(fe+ne-1)%F],Q=z[W];if(Q!==void 0&&Q!==P[fe])throw new Error("Face mismatch in net");z[W]=P[fe],B[P[fe]]=W}}for(let P=0;P<z.length;P++){let Z=!1;for(let ae=0;ae<this.faceorder.length;ae++)if(z[P]===this.faceorder[ae]){this.faceprecedence[P]=ae,Z=!0;break}if(!Z)throw new Error("Could not find face "+z[P]+" in face order list "+this.faceorder)}for(let P=0;P<this.baseplanerot.length;P++){let Z=this.baseplanerot[P].rotateface(x),ae=p.rotateplane(this.baseplanerot[P]),ne=z[P];R.push([Z,ne]),L.push([ae,ne])}for(let P=0;P<this.baseplanerot.length;P++){let Z=this.baseplanerot[P].rotateface(x),ae=z[P];for(let ne=0;ne<Z.length;ne++){let fe=(ne+1)%Z.length,W=Z[ne].sum(Z[fe]).smul(.5),Q=(ne+2)%Z.length,le=Z[fe].sum(Z[Q]).smul(.5),ue=ff(U,W),Se=ff(U,le);C(T,Z[fe],[ae,Se,ue])}}this.swizzler=new yu(R.map(P=>P[1]));let O=this.swizzler.prefixFree?"":"_";for(let P=0;P<U.length;P++){if(U[P].length!==3)throw new Error("Bad length in edge names "+U[P]);let Z=z[U[P][1]],ae=z[U[P][2]];this.faceprecedence[U[P][1]]<this.faceprecedence[U[P][2]]?Z=Z+O+ae:Z=ae+O+Z,U[P]=[U[P][0],Z]}for(let P=0;P<T.length;P++){if(T[P].length<4)throw new Error("Bad length in vertex names");let Z=1;for(let ne=2;ne<T[P].length;ne++)this.faceprecedence[B[T[P][ne][0]]]<this.faceprecedence[B[T[P][Z][0]]]&&(Z=ne);let ae="";for(let ne=1;ne<T[P].length;ne++){ne===1?ae=T[P][Z][0]:ae=ae+O+T[P][Z][0];for(let fe=1;fe<T[P].length;fe++)if(T[P][Z][1]===T[P][fe][2]){Z=fe;break}}T[P]=[T[P][0],ae]}this.options.verbosity>1&&(console.log("# Face precedence list: "+this.faceorder.join(" ")),console.log("# Face names: "+R.map(P=>P[1]).join(" ")),console.log("# Edge names: "+U.map(P=>P[1]).join(" ")),console.log("# Vertex names: "+T.map(P=>P[1]).join(" ")));let V=[];for(let P of L)V.push([P[0].makenormal(),P[1],"f"]);for(let P of U)V.push([P[0].makenormal(),P[1],"e"]);for(let P of T)V.push([P[0].makenormal(),P[1],"v"]);this.facenames=R,this.faceplanes=L,this.edgenames=U,this.vertexnames=T,this.geonormals=V;let q=V.map(P=>P[1]);this.swizzler.setGripNames(q),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let P=0;P<y.length;P++)for(let Z of this.rotations){let ae=y[P].rotateplane(Z),ne=!1;for(let fe of this.moveplanes)if(ae.sameplane(fe)){ne=!0;break}ne||(this.moveplanes.push(ae),m[P]&&this.moveplanes2.push(ae))}let se=new Su(x),he=this.moveplanes2.slice(),Y=31;for(let P=0;P<he.length;P++){let Z=P+Math.floor((he.length-P)*(Y/65536));se=se.split(he[Z]),he[Z]=he[P],Y=(Y*1657+101)%65536}let X=se.collect([],!0);this.faces=X,this.options.verbosity>0&&console.log("# Faces is now "+X.length),this.stickersperface=X.length;let ve=[],pe=lf(x);for(let P of this.rotations){let Z=P.rotateface(x);pe.dist(lf(Z))<qt&&ve.push(P)}let Le=new Array(X.length),Ie=[];for(let P=0;P<X.length;P++){let Z=X[P].centermass();Ie.push([pe.dist(Z),Z,P])}Ie.sort((P,Z)=>P[0]-Z[0]);for(let P=0;P<X.length;P++){let Z=Ie[P][2];if(!Le[Z]){Le[Z]=!0;for(let ae of ve){let ne=X[Z].rotate(ae),fe=ne.centermass();for(let W=P+1;W<X.length&&!(Ie[W][0]-Ie[P][0]>qt);W++){let Q=Ie[W][2];if(!Le[Q]&&fe.dist(Ie[W][1])<qt){Le[Q]=!0,X[Q]=ne;break}}}}}this.shortedge=1e99;for(let P of X)for(let Z=0;Z<P.length;Z++){let ae=(Z+1)%P.length,ne=P.get(Z).dist(P.get(ae));ne<this.shortedge&&(this.shortedge=ne)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),t==="c"&&b&&!w&&!D&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),t==="c"&&D&&!b&&!w&&(this.addNotationMapper="SkewbMapper"),t==="t"&&(D||b)&&!w&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),t==="o"&&b&&(this.notationMapper=new vu(this.swizzler,new yu(["F","D","L","BL","R","U","BR","B"])),!w&&!D&&(this.addNotationMapper="FTOMapper")),t==="d"&&b&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new vu(this.swizzler,new yu(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(e){return this.keyface2(e.centermass())}keyface2(e){let t="",n=String.fromCharCode;for(let i of this.moveplanesets)if(i.length>0){let o=e.dot(i[0]),s=0,a=1;for(;a*2<=i.length;)a*=2;for(;a>0;a>>=1)s+a<=i.length&&o>i[s+a-1].a&&(s+=a);if(s<47)t=t+n(33+s);else if(s<47+47*47)t=t+n(33+47+Math.floor(s/47)-1)+n(33+s%47);else if(s<47+47*47+47*47*47)t=t+n(33+47+Math.floor((s-47)/(47*47)-1))+n(33+47+Math.floor((s-47)/47)%47)+n(33+s%47);else throw Error("Too many slices for cubie encoding")}return t}keyface3(e){let t=e.centermass(),n=[];for(let i of this.moveplanesets)if(i.length>0){let o=t.dot(i[0]),s=0,a=1;for(;a*2<=i.length;)a*=2;for(;a>0;a>>=1)s+a<=i.length&&o>i[s+a-1].a&&(s+=a);n.push(s)}return n}findface(e){let t=this.keyface2(e),n=this.facelisthash.get(t);if(n.length===1)return n[0];for(let i=0;i+1<n.length;i++){let o=this.facelisthash.get(t)[i];if(Math.abs(e.dist(this.facecentermass[o]))<qt)return o}return n[n.length-1]}project2d(e,t,n){let i=this.facenames[e][0],o=(t+1)%i.length,s=this.baseplanes[e],a=i[o].sub(i[t]),l=a.len();a=a.normalize();let u=a.cross(s).normalize(),c=n[1].sub(n[0]),f=c.len()/l;c=c.normalize();let h=c.b,p=c.c,d=a.smul(h).sub(u.smul(p)).smul(f),g=u.smul(h).sum(a.smul(p)).smul(f),x=new Ge(0,n[0].b-d.dot(i[t]),n[0].c-g.dot(i[t]),0);return[d,g,x]}allstickers(){let e=M0("allstickers");this.faces=KE(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 F=0;F<this.faces.length;F++)this.facecentermass[F]=this.faces[F].centermass();let t=[],n=[];for(let F of this.moveplanes){let C=F.makenormal(),j=!1;for(let B of n)C.sameplane(B.makenormal())&&(j=!0);j||(n.push(C),t.push([]))}for(let F of this.moveplanes2){let C=F.makenormal();for(let j=0;j<n.length;j++)if(C.sameplane(n[j])){t[j].push(F);break}}for(let F=0;F<t.length;F++){let C=t[F].map(B=>B.normalizeplane()),j=n[F];for(let B=0;B<C.length;B++)C[B].makenormal().dist(j)>qt&&(C[B]=C[B].smul(-1));C.sort((B,z)=>B.a-z.a),t[F]=C}this.moveplanesets=t,this.moveplanenormals=n;let i=t.map(F=>F.length);this.options.verbosity>0&&console.log("# Move plane sets: "+i);let o=[];for(let F=0;F<t.length;F++)o.push([]);for(let F of this.rotations){if(Math.abs(Math.abs(F.a)-1)<qt)continue;let C=F.makenormal();for(let j=0;j<t.length;j++)if(C.sameplane(n[j])){o[j].push(F);break}}this.moverotations=o;for(let F=0;F<o.length;F++){let C=o[F],j=C[0].makenormal();for(let B=0;B<C.length;B++)j.dist(C[B].makenormal())>qt&&(C[B]=C[B].smul(-1));C.sort((B,z)=>B.angle()-z.angle()),o[F][0].dot(n[F])<0&&C.reverse()}let s=o.map(F=>1+F.length);this.movesetorders=s;let a=[],l="?";for(let F=0;F<t.length;F++){let C=n[F],j=null,B=null;for(let z of this.geonormals){let O=C.dot(z[0]);Math.abs(O-1)<qt?(B=[z[1],z[2]],l=z[2]):Math.abs(O+1)<qt&&(j=[z[1],z[2]],l=z[2])}if(B===null||j===null)throw new Error("Saw positive or negative sides as null");a.push([B[0],B[1],j[0],j[1],1+t[F].length]),this.addNotationMapper==="NxNxNCubeMapper"&&l==="f"&&(this.notationMapper=new nf(1+t[F].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&t[0].length===1&&(this.notationMapper=new of(this.swizzler),this.addNotationMapper=""),this.addNotationMapper==="PyraminxOrTetraminxMapper"&&(t[0].length===2&&t[0][0].a===.333333333333333&&t[0][1].a===1.66666666666667?(this.notationMapper=new xu(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new rf(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&l==="f"&&(1+t[F].length===3&&(this.notationMapper=new tf(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&l==="f"&&(1+t[F].length===3&&(this.notationMapper=new ef(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=a;let u=new Map,c=this.faces;for(let F=0;F<c.length;F++){let C=c[F],j=this.keyface(C);if(!u.get(j))u.set(j,[F]);else{let B=u.get(j);if(B.push(F),B.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let z=0;z<B.length;z++){let O=j+" "+z;u.set(O,[B[z]])}}}}this.facelisthash=u,this.options.verbosity>0&&console.log("# Cubies: "+u.size);let f=[],h=[],p=[];for(let F of u.values())if(F.length!==this.baseFaceCount){if(F.length>1){let C=F.map(O=>c[O].centermass()),j=lf(C);for(let O=0;F.length>2;O++){let V=!1;for(let q=0;q<F.length;q++){let se=(q+1)%F.length;if(j.dot(C[q].cross(C[se]))<0){let he=C[q];C[q]=C[se],C[se]=he;let Y=F[q];F[q]=F[se],F[se]=Y,V=!0}}if(!V)break;if(O>1e3)throw new Error("Bad epsilon math; too close to border")}let B=0,z=F[B];for(let O=1;O<F.length;O++){let V=F[O];this.faceprecedence[this.getfaceindex(V)]<this.faceprecedence[this.getfaceindex(z)]&&(B=O,z=V)}if(B!==0){let O=F.slice();for(let V=0;V<F.length;V++)F[V]=O[(B+V)%F.length]}}for(let C=0;C<F.length;C++){let j=F[C];h[j]=f.length,p[j]=C}f.push(F)}this.cubies=f,this.facetocubie=h,this.facetoord=p;let d=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],g=[],x=[0,0,0,0,0,0],y=[],m=[],b=0,w=[],D=[],R=[],L=[],T=F=>f[F].map(C=>this.getfaceindex(C)).join(" "),U=[];for(let F=0;F<f.length;F++){if(m[F])continue;let C=f[F];if(C.length===0)continue;let j={},B=0;R.push(0),U.push([]);let z=C.length,O=x[z]++,V=d[z];(V===void 0||z===this.baseFaceCount)&&(V="CORE"),V=V+(O===0?"":O+1),g[b]=V,y[b]=z;let q=[F],se=0;for(m[F]=!0;se<q.length;){let he=q[se++],Y=T(he);if((C.length>1||j[Y]===void 0)&&(j[Y]=B++),L[he]=j[Y],w[he]=b,U[b].push(he),D[he]=R[b]++,q.length<this.rotations.length){let X=this.facecentermass[f[he][0]];for(let ve of o){let pe=this.facetocubie[this.findface(X.rotatepoint(ve[0]))];m[pe]||(q.push(pe),m[pe]=!0)}}}b++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let F=[["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"]],C={};for(let j of F)for(let B=0;B<j.length;B++){let z=0;for(let O=0;O<j[B].length;O++)z|=1<<j[B].charCodeAt(O)-65;C[z]=B}for(let j of U)for(let B of j){let z=0;for(let O of f[B])z|=1<<this.facenames[this.getfaceindex(O)][1].charCodeAt(0)-65;D[B]=C[z]}}if(this.cubiesetnums=w,this.cubieordnums=D,this.cubiesetnames=g,this.cubieords=R,this.orbitoris=y,this.cubievaluemap=L,this.cubiesetcubies=U,this.options.fixedPieceType!==null){for(let F=0;F<f.length;F++)if(this.options.fixedPieceType==="v"&&f[F].length>2||this.options.fixedPieceType==="e"&&f[F].length===2||this.options.fixedPieceType==="f"&&f[F].length===1){this.fixedCubie=F;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 "+R),R0(e)}unswizzle(e){let t=this.notationMapper.notationToInternal(e);return t===null?"":this.swizzler.unswizzle(t.family)}stringToBlockMove(e){let t=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),n=e.match(t);if(n===null)throw new Error("Bad move passed "+e);let i=n[4],o,s;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&&(s=parseInt(n[3],10));let a="1",l=1;return n[5]!==void 0&&(a=n[5],a[0]==="'"&&(a="-"+a.substring(1)),l=parseInt(a,10)),new E(new ze(i,s,o),l)}parseMove(e){let t=this.notationMapper.notationToInternal(e);if(t===null)throw new Error("Bad move "+e.family);e=t;let n=e.family,i=!1;if(n.endsWith("v")&&n[0]<="Z"){if(e.innerLayer!==void 0||e.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");n=n.slice(0,-1),i=!0}n.endsWith("w")&&n[0]<="Z"&&(n=n.slice(0,-1).toLowerCase());let o,s=-1,a=this.swizzler.unswizzle(n),l=!1;for(let f=0;f<this.movesetgeos.length;f++){let h=this.movesetgeos[f];a===h[0]&&(l=!0,o=h,s=f),a===h[2]&&(l=!1,o=h,s=f)}let u=1,c=1;if(n.toUpperCase()!==n&&(c=2),o===void 0)throw new Error("Bad grip in move "+e.family);if(e.outerLayer!==void 0&&(u=e.outerLayer),e.innerLayer!==void 0&&(e.outerLayer===void 0?(c=e.innerLayer,n<="Z"?u=c:u=1):c=e.innerLayer),u--,c--,i&&(u=0,c=this.moveplanesets[s].length),u<0||u>this.moveplanesets[s].length||c<0||c>this.moveplanesets[s].length)throw new Error("Bad slice spec "+u+" "+c+" vs "+this.moveplanesets[s].length);if(!JE&&u===0&&c===this.moveplanesets[s].length&&!i)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,s,u,c,l,e.amount]}parsemove(e){let t=this.parseMove(this.stringToBlockMove(e));return t[0]=e,t}genperms(){let e=M0("genperms");if(this.cmovesbyslice.length>0)return;let t=[];if(this.options.orientCenters){for(let n=0;n<this.cubies.length;n++)if(this.cubies[n].length===1){let i=this.cubies[n][0],o=this.getfaceindex(i);if(this.basefaces[o].centermass().dist(this.facecentermass[i])<qt){let s=this.basefaces[o].length;for(let a=1;a<s;a++)this.cubies[n].push(this.cubies[n][a-1]);this.duplicatedFaces[i]=s,this.duplicatedCubies[n]=s,this.orbitoris[this.cubiesetnums[n]]=s}}}for(let n=0;n<this.moveplanesets.length;n++){let i=this.moveplanesets[n],o=[],s=[i.length+1,0],a=1;for(;a*2<=i.length;)a*=2;for(let c=0;c<this.faces.length;c++){let f=0;if(i.length>0){let h=this.facecentermass[c].dot(i[0]);for(let p=a;p>0;p>>=1)f+p<=i.length&&h>i[f+p-1].a&&(f+=p);f=i.length-f}for(o.push(f);s.length<=f;)s.push(0);s[f]++}let l=new Array(s.length);for(let c=0;c<s.length;c++)l[c]=[];let u=[];for(let c=0;c<this.faces.length;c++){if(o[c]<0)continue;let f=[this.facetocubie[c],this.facetoord[c]],h=this.facecentermass[c],p=h,d=c,g=o[d];for(;;){o[d]=-1;let x=h.rotatepoint(this.moverotations[n][0]);if(x.dist(p)<qt)break;d=this.findface(x),f.push(this.facetocubie[d],this.facetoord[d]),h=x}if(f.length>2&&this.options.orientCenters&&(this.cubies[f[0]].length===1||this.duplicatedCubies[f[0]]>1)&&this.facecentermass[c].dist(this.basefaces[this.getfaceindex(c)].centermass())<qt){let x=this.faces[this.cubies[f[0]][0]];for(let y=0;y<f.length;y+=2){let m=this.faces[this.cubies[f[y]][0]],b=-1;for(let w=0;w<x.length;w++)if(m.get(w).dist(x.get(0))<qt){b=w;break}if(b<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");f[y+1]=b,x=x.rotate(this.moverotations[n][0])}}if(f.length===2&&this.options.orientCenters)for(let x=1;x<this.movesetorders[n];x++)g===0?f.push(f[0],x):f.push(f[0],(this.movesetorders[n]-x)%this.movesetorders[n]);if(f.length>2&&!u[f[0]]){if(f.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let x of f)l[g].push(x)}for(let x=0;x<f.length;x+=2)u[f[x]]=!0}for(let c=0;c<l.length;c++)l[c]=l[c].slice();t.push(l)}if(this.cmovesbyslice=t,this.options.moveList){let n=[];for(let i of this.options.moveList)n.push(this.parsemove(i));this.parsedmovelist=n}this.facelisthash.clear(),this.facecentermass=[],R0(e)}getboundarygeometry(){return{baseplanes:this.baseplanes,facenames:this.facenames,faceplanes:this.faceplanes,vertexnames:this.vertexnames,edgenames:this.edgenames,geonormals:this.geonormals}}getmovesets(e){let t=this.moveplanesets[e].length,n=[];if(this.parsedmovelist!==void 0)for(let i of this.parsedmovelist)i[1]===e&&(i[4]?n.push([i[2],i[3]]):n.push([t-i[3],t-i[2]]),n.push(i[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let i=this.movesetgeos[e];if(i[1]!==i[3])for(let o=0;o<t;o++)i[1]!=="v"?(this.options.outerBlockMoves?n.push([o+1,t]):n.push([o+1]),n.push(1)):(this.options.outerBlockMoves?n.push([0,o]):n.push([o,o]),n.push(1))}else for(let i=0;i<=t;i++)!this.options.allMoves&&i+i===t||(this.options.outerBlockMoves?i+i>t?n.push([i,t]):n.push([0,i]):n.push([i,i]),n.push(1));if(this.fixedCubie>=0){let i=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[e],o=[];for(let s=0;s<n.length;s+=2){let a=n[s];if(i>=a[0]&&i<=a[1])if(a[0]===0)a=[a[1]+1,t];else if(t===a[1])a=[0,a[0]-1];else throw Error("fixed cubie option would disconnect move");let l=!1;for(let u=0;u<o.length;u+=2)if(o[u][0]===a[0]&&o[u][1]===a[1]&&o[u+1]===n[s+1]){l=!0;break}l||(o.push(a),o.push(n[s+1]))}n=o}return n}graybyori(e){let t=this.cubies[e].length;return this.duplicatedCubies[e]&&(t=1),t===1&&(this.options.grayCenters||!this.options.includeCenterOrbits)||t===2&&(this.options.grayEdges||!this.options.includeEdgeOrbits)||t>2&&(this.options.grayCorners||!this.options.includeCornerOrbits)}skipbyori(e){let t=this.cubies[e].length;return this.duplicatedCubies[e]&&(t=1),t===1&&!this.options.includeCenterOrbits||t===2&&!this.options.includeEdgeOrbits||t>2&&!this.options.includeCornerOrbits}skipcubie(e){return this.skipbyori(e)}header(e){return e+ZE+`
|
|
10
|
+
`,!1),B=function(v,A){return[v].concat(A)},z=function(v){return[v]},O=function(v){return Om(v)},V=function(v,A,I){return[v,{permutation:A,orientation:I}]},q=function(v,A){return[v,{permutation:A,orientation:new Array(A.length).fill(0)}]},se=function(v,A){return A[v[0]]=v[1],A},he=function(v){let A={};return A[v[0]]=v[1],A},Y="Solved",X=_("Solved",!1),ve="End",pe=_("End",!1),Le=function(v){return v},Ie="Move",P=_("Move",!1),Z=function(v,A){return[v,A]},ae=function(v,A){return A[v[0]]=v[1],A},ne=function(v){let A={};return A[v[0]]=v[1],A},fe=function(v,A,I,N){return{name:v,orbits:A,moves:N,startPieces:I}},W=0,Q=0,le=[{line:1,column:1}],ue=0,Se=[],ce=0,Ue;if("startRule"in e){if(!(e.startRule in n))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');i=n[e.startRule]}function We(){return r.substring(Q,W)}function nt(){return de(Q,W)}function Et(v,A){throw A=A!==void 0?A:de(Q,W),ge([Me(v)],r.substring(Q,W),A)}function k(v,A){throw A=A!==void 0?A:de(Q,W),be(v,A)}function _(v,A){return{type:"literal",text:v,ignoreCase:A}}function te(v,A,I){return{type:"class",parts:v,inverted:A,ignoreCase:I}}function ie(){return{type:"any"}}function Fe(){return{type:"end"}}function Me(v){return{type:"other",description:v}}function G(v){var A=le[v],I;if(A)return A;for(I=v-1;!le[I];)I--;for(A=le[I],A={line:A.line,column:A.column};I<v;)r.charCodeAt(I)===10?(A.line++,A.column=1):A.column++,I++;return le[v]=A,A}function de(v,A){var I=G(v),N=G(A);return{start:{offset:v,line:I.line,column:I.column},end:{offset:A,line:N.line,column:N.column}}}function J(v){W<ue||(W>ue&&(ue=W,Se=[]),Se.push(v))}function be(v,A){return new da(v,null,null,A)}function ge(v,A,I){return new da(da.buildMessage(v,A),v,A,I)}function Ee(){var v,A;return v=W,A=Nm(),A!==t&&(Q=v,A=o(A)),v=A,v}function Re(){var v,A,I;if(v=W,A=[],s.test(r.charAt(W))?(I=r.charAt(W),W++):(I=t,ce===0&&J(a)),I!==t)for(;I!==t;)A.push(I),s.test(r.charAt(W))?(I=r.charAt(W),W++):(I=t,ce===0&&J(a));else A=t;return A!==t&&(Q=v,A=l(A)),v=A,v}function Ve(){var v,A,I,N;if(v=W,u.test(r.charAt(W))?(A=r.charAt(W),W++):(A=t,ce===0&&J(c)),A!==t){for(I=[],f.test(r.charAt(W))?(N=r.charAt(W),W++):(N=t,ce===0&&J(h));N!==t;)I.push(N),f.test(r.charAt(W))?(N=r.charAt(W),W++):(N=t,ce===0&&J(h));I!==t?(Q=v,A=p(A,I),v=A):(W=v,v=t)}else W=v,v=t;return v}function Mt(){var v,A,I;if(v=W,A=[],d.test(r.charAt(W))?(I=r.charAt(W),W++):(I=t,ce===0&&J(g)),I!==t)for(;I!==t;)A.push(I),d.test(r.charAt(W))?(I=r.charAt(W),W++):(I=t,ce===0&&J(g));else A=t;return A!==t&&(Q=v,A=x(A)),v=A,v}function Ze(){var v;return r.charCodeAt(W)===32?(v=y,W++):(v=t,ce===0&&J(m)),v}function ii(){var v,A,I,N;return v=W,r.substr(W,4)===b?(A=b,W+=4):(A=t,ce===0&&J(w)),A!==t?(I=Ze(),I!==t?(N=Re(),N!==t?(Q=v,A=D(N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function Nn(){var v,A,I,N,K,De,_e,ke;return v=W,r.substr(W,3)===R?(A=R,W+=3):(A=t,ce===0&&J(L)),A!==t?(I=Ze(),I!==t?(N=Ve(),N!==t?(K=Ze(),K!==t?(De=Mt(),De!==t?(_e=Ze(),_e!==t?(ke=Mt(),ke!==t?(Q=v,A=T(N,De,ke),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function _h(){var v,A,I,N;return v=W,A=Nn(),A!==t?(I=ci(),I!==t?(N=_h(),N!==t?(Q=v,A=U(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=Nn(),A!==t&&(Q=v,A=F(A)),v=A),v}function ci(){var v;return r.charCodeAt(W)===10?(v=C,W++):(v=t,ce===0&&J(j)),v}function No(){var v,A;if(v=[],r.charCodeAt(W)===10?(A=C,W++):(A=t,ce===0&&J(j)),A!==t)for(;A!==t;)v.push(A),r.charCodeAt(W)===10?(A=C,W++):(A=t,ce===0&&J(j));else v=t;return v}function lr(){var v,A;for(v=[],r.charCodeAt(W)===10?(A=C,W++):(A=t,ce===0&&J(j));A!==t;)v.push(A),r.charCodeAt(W)===10?(A=C,W++):(A=t,ce===0&&J(j));return v}function ra(){var v,A,I,N;return v=W,A=Mt(),A!==t?(I=Ze(),I!==t?(N=ra(),N!==t?(Q=v,A=B(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=Mt(),A!==t&&(Q=v,A=z(A)),v=A),v}function ru(){var v,A;return v=W,A=ra(),A!==t&&(Q=v,A=O(A)),v=A,v}function Ch(){var v,A,I,N,K,De;return v=W,A=Ve(),A!==t?(I=ci(),I!==t?(N=ru(),N!==t?(K=ci(),K!==t?(De=ra(),De!==t?(Q=v,A=V(A,N,De),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=Ve(),A!==t?(I=ci(),I!==t?(N=ru(),N!==t?(Q=v,A=q(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)),v}function jr(){var v,A,I,N;return v=W,A=Ch(),A!==t?(I=ci(),I!==t?(N=jr(),N!==t?(Q=v,A=se(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=Ch(),A!==t&&(Q=v,A=he(A)),v=A),v}function Um(){var v,A,I,N,K,De;return v=W,r.substr(W,6)===Y?(A=Y,W+=6):(A=t,ce===0&&J(X)),A!==t?(I=ci(),I!==t?(N=jr(),N!==t?(K=ci(),K!==t?(r.substr(W,3)===ve?(De=ve,W+=3):(De=t,ce===0&&J(pe)),De!==t?(Q=v,A=Le(N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function oa(){var v,A,I,N,K,De,_e,ke;return v=W,r.substr(W,4)===Ie?(A=Ie,W+=4):(A=t,ce===0&&J(P)),A!==t?(I=Ze(),I!==t?(N=Re(),N!==t?(K=ci(),K!==t?(De=jr(),De!==t?(_e=ci(),_e!==t?(r.substr(W,3)===ve?(ke=ve,W+=3):(ke=t,ce===0&&J(pe)),ke!==t?(Q=v,A=Z(N,De),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function ou(){var v,A,I,N;return v=W,A=oa(),A!==t?(I=No(),I!==t?(N=ou(),N!==t?(Q=v,A=ae(A,N),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v===t&&(v=W,A=oa(),A!==t&&(Q=v,A=ne(A)),v=A),v}function Nm(){var v,A,I,N,K,De,_e,ke,Be;return v=W,A=ii(),A!==t?(I=No(),I!==t?(N=_h(),N!==t?(K=No(),K!==t?(De=Um(),De!==t?(_e=No(),_e!==t?(ke=ou(),ke!==t?(Be=lr(),Be!==t?(Q=v,A=fe(A,N,De,ke),v=A):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t)):(W=v,v=t),v}function Om(v){return v.map(A=>A-1)}function Gm(v){for(let A in v.moves){let I=v.moves[A];for(let N in v.orbits){let K=I[N],De=K.orientation,_e=K.permutation,ke=new Array(De.length);for(let Be=0;Be<_e.length;Be++)ke[Be]=De[_e[Be]];K.orientation=ke}}return v}if(Ue=i(),Ue!==t&&W===r.length)return Ue;throw Ue!==t&&W<r.length&&J(Fe()),ge(Se,ue<r.length?r.charAt(ue):null,ue<r.length?de(ue,ue+1):de(ue,ue))}var Nv=oe(()=>{UE(da,Error);da.buildMessage=function(r,e){var t={literal:function(u){return'"'+i(u.text)+'"'},class:function(u){var c=u.parts.map(function(f){return Array.isArray(f)?o(f[0])+"-"+o(f[1]):o(f)});return"["+(u.inverted?"^":"")+c+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(u){return u.description}};function n(u){return u.charCodeAt(0).toString(16).toUpperCase()}function i(u){return u.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(c){return"\\x0"+n(c)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(c){return"\\x"+n(c)})}function o(u){return u.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(c){return"\\x0"+n(c)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(c){return"\\x"+n(c)})}function s(u){return t[u.type](u)}function a(u){var c=u.map(s),f,h;if(c.sort(),c.length>0){for(f=1,h=1;f<c.length;f++)c[f-1]!==c[f]&&(c[h]=c[f],h++);c.length=h}switch(c.length){case 1:return c[0];case 2:return c[0]+" or "+c[1];default:return c.slice(0,-1).join(", ")+", or "+c[c.length-1]}}function l(u){return u?'"'+i(u)+'"':"end of input"}return"Expected "+a(r)+" but "+l(e)+" found."}});var s0,Ov=oe(()=>{Nv();s0=Uv});var Gv=oe(()=>{Ov()});function NE(){return Wv+=1,"svg"+Wv.toString()}var Xh,Wv,OE,Xo,Vv=oe(()=>{Xh="http://www.w3.org/2000/svg",Wv=0;OE={dim:{white:"#dddddd",orange:"#884400",limegreen:"#008800",red:"#660000","rgb(34, 102, 255)":"#000088",yellow:"#888800"},oriented:{white:"#ff88ff",orange:"#ff88ff",limegreen:"#ff88ff",red:"#ff88ff","rgb(34, 102, 255)":"#ff88ff",yellow:"#ff88ff"},ignored:{white:"#444444",orange:"#444444",limegreen:"#444444",red:"#444444","rgb(34, 102, 255)":"#444444",yellow:"#444444"},invisible:{white:"#00000000",orange:"#00000000",limegreen:"#00000000",red:"#00000000","rgb(34, 102, 255)":"#00000000",yellow:"#00000000"}},Xo=class{constructor(e,t,n){this.kPuzzleDefinition=e;this.originalColors={};this.gradients={};if(!t)throw new Error(`No SVG definition for puzzle type: ${e.name}`);this.svgID=NE(),this.element=document.createElement("div"),this.element.classList.add("svg-wrapper"),this.element.innerHTML=t;let i=this.element.querySelector("svg");if(!i)throw new Error("Could not get SVG element");if(Xh!==i.namespaceURI)throw new Error("Unexpected XML namespace");i.style.maxWidth="100%",i.style.maxHeight="100%",this.gradientDefs=document.createElementNS(Xh,"defs"),i.insertBefore(this.gradientDefs,i.firstChild);for(let o in e.orbits){let s=e.orbits[o];for(let a=0;a<s.numPieces;a++)for(let l=0;l<s.orientations;l++){let u=this.elementID(o,a,l),c=this.elementByID(u),f=c.style.fill;n?(()=>{let h=n.orbits;if(!h)return;let p=h[o];if(!p)return;let d=p.pieces[a];if(!d)return;let g=d.facelets[l];if(!g)return;let x=typeof g=="string"?g:g?.appearance,y=OE[x];y&&(f=y[f])})():f=c.style.fill,this.originalColors[u]=f,this.gradients[u]=this.newGradient(u,f),this.gradientDefs.appendChild(this.gradients[u]),c.setAttribute("style",`fill: url(#grad-${this.svgID}-${u})`)}}}drawKPuzzle(e,t,n){this.draw(e.definition,e.state,t,n)}draw(e,t,n,i){for(let o in e.orbits){let s=e.orbits[o],a=t[o],l=n?n[o]:null;for(let u=0;u<s.numPieces;u++)for(let c=0;c<s.orientations;c++){let f=this.elementID(o,u,c),h=this.elementID(o,a.permutation[u],(s.orientations-a.orientation[u]+c)%s.orientations),p=!1;if(l){let d=this.elementID(o,l.permutation[u],(s.orientations-l.orientation[u]+c)%s.orientations);h===d&&(p=!0),i=i||0;let g=100*(1-i*i*(2-i*i));this.gradients[f].children[0].setAttribute("stop-color",this.originalColors[h]),this.gradients[f].children[1].setAttribute("stop-color",this.originalColors[h]),this.gradients[f].children[1].setAttribute("offset",`${Math.max(g-5,0)}%`),this.gradients[f].children[2].setAttribute("offset",`${Math.max(g-5,0)}%`),this.gradients[f].children[3].setAttribute("offset",`${g}%`),this.gradients[f].children[4].setAttribute("offset",`${g}%`),this.gradients[f].children[4].setAttribute("stop-color",this.originalColors[d]),this.gradients[f].children[5].setAttribute("stop-color",this.originalColors[d])}else p=!0;p&&(this.gradients[f].children[0].setAttribute("stop-color",this.originalColors[h]),this.gradients[f].children[1].setAttribute("stop-color",this.originalColors[h]),this.gradients[f].children[1].setAttribute("offset","100%"),this.gradients[f].children[2].setAttribute("offset","100%"),this.gradients[f].children[3].setAttribute("offset","100%"),this.gradients[f].children[4].setAttribute("offset","100%"))}}}newGradient(e,t){let n=document.createElementNS(Xh,"radialGradient");n.setAttribute("id",`grad-${this.svgID}-${e}`),n.setAttribute("r","70.7107%");let i=[{offset:0,color:t},{offset:0,color:t},{offset:0,color:"black"},{offset:0,color:"black"},{offset:0,color:t},{offset:100,color:t}];for(let o of i){let s=document.createElementNS(Xh,"stop");s.setAttribute("offset",`${o.offset}%`),s.setAttribute("stop-color",o.color),s.setAttribute("stop-opacity","1"),n.appendChild(s)}return n}elementID(e,t,n){return e+"-l"+t+"-o"+n}elementByID(e){return this.element.querySelector("#"+e)}}});var Ye,a0=oe(()=>{Ye={name:"3x3x3",orbits:{EDGES:{numPieces:12,orientations:2},CORNERS:{numPieces:8,orientations:3},CENTERS:{numPieces:6,orientations:4}},startPieces:{EDGES:{permutation:[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:{permutation:[0,1,2,3,4,5,6,7],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[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]}}}};Ye.moves.Uw=Ye.moves.u;Ye.moves.Lw=Ye.moves.l;Ye.moves.Fw=Ye.moves.f;Ye.moves.Rw=Ye.moves.r;Ye.moves.Bw=Ye.moves.b;Ye.moves.Dw=Ye.moves.d;Ye.moves.Rv=Ye.moves.x;Ye.moves.Uv=Ye.moves.y;Ye.moves.Fv=Ye.moves.z;Ye.moves.Lv={EDGES:{permutation:[2,10,6,11,0,8,4,9,1,3,5,7],orientation:[1,0,1,0,1,0,1,0,0,0,0,0]},CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]},CENTERS:{permutation:[4,1,0,3,5,2],orientation:[2,1,0,3,2,0]}};Ye.moves.Dv={EDGES:{permutation:[3,0,1,2,7,4,5,6,9,11,8,10],orientation:[0,0,0,0,0,0,0,0,1,1,1,1]},CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]},CENTERS:{permutation:[0,4,1,2,3,5],orientation:[3,0,0,0,0,1]}};Ye.moves.Bv={EDGES:{permutation:[8,5,10,1,9,7,11,3,4,0,6,2],orientation:[1,1,1,1,1,1,1,1,1,1,1,1]},CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]},CENTERS:{permutation:[3,0,2,5,4,1],orientation:[3,3,3,3,1,3]}}});function Hv(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=t;return e}function Kh(r,e){let t=0;for(let n of e)t*=r,t+=n;return t}function Zh(r,e,t){let n=[];for(;t>0;)n.push(t%r),t=Math.floor(t/r);return new Array(e-n.length).fill(0).concat(n.reverse())}function l0(r){let e=r.length,t=0;for(let n=0;n<e-1;n++){t=t*(e-n);for(let i=n+1;i<e;i++)r[n]>r[i]&&(t+=1)}return t}function u0(r,e){let t=new Array(r);t[r-1]=0;for(let n=r-2;n>=0;n--){t[n]=e%(r-n),e=Math.floor(e/(r-n));for(let i=n+1;i<r;i++)t[i]>=t[n]&&(t[i]=t[i]+1)}return t}var qv=oe(()=>{});function Jh(r){let e=r.CENTERS.permutation[0],t=r.CENTERS.permutation[5],n=r.CENTERS.permutation[1],i=n;return e<n&&i--,t<n&&i--,[e,i]}function ma(r){let[e,t]=Jh(r),n=c0[e][t];return gt(Ye,r,n)}function jv(r,e,t){let n=Wi(Ye,c0[e][t]);return gt(Ye,r,n)}var c0,h0=oe(()=>{Oe();Ht();Ht();c0=new Array(6).fill(0).map(()=>new Array(6));{let r=new pn(Ye),e=["","z","x","z'","x'","x2"].map(n=>re.fromString(n)),t=new re("y");for(let n of e){r.reset(),r.applyAlg(n);for(let i=0;i<4;i++){r.applyAlg(t);let[o,s]=Jh(r.state);c0[o][s]=Wi(Ye,r.state)}}}});function GE(r){let e=0;for(let t of r)e+=t;return e}function WE(r,e){let t=new Uint8Array(e),n=0,i=0,o=0,s=[];for(let a of r){for(;i<a;)o=o<<8|t[n++],i+=8;s.push(o>>i-a&(1<<a)-1),i-=a}return s}function VE(r,e){let t=new Uint8Array(Math.ceil(GE(r)/8)),n=0,i=0,o=0;for(let s=0;s<r.length;s++)for(o=o<<r[s]|e[s],i+=r[s];i>=8;)t[n++]=o>>i-8,i-=8;return i>0&&(t[n++]=o<<8-i),t}function Yv(r){return r.poIdxU!==7}function HE(r){let e=ma(r),t=l0(e.EDGES.permutation),n=Kh(2,e.EDGES.orientation),i=l0(e.CORNERS.permutation),o=Kh(3,e.CORNERS.orientation),[s,a]=Jh(r),l=1,u=Kh(4,e.CENTERS.orientation);return{epLex:t,eoMask:n,cpLex:i,coMask:o,poIdxU:s,poIdxL:a,moSupport:l,moMask:u}}function qE(r){let{epLex:e,eoMask:t,cpLex:n,coMask:i,poIdxU:o,poIdxL:s,moSupport:a,moMask:l}=r;return VE(Qv,[e,t,n,i,o,s,a,l])}function Xv(r){let e=HE(r);return qE(e)}function mu(r){let[e,t,n,i,o,s,a,l]=WE(Qv,r);return{epLex:e,eoMask:t,cpLex:n,coMask:i,poIdxU:o,poIdxL:s,moSupport:a,moMask:l}}function gu(r){if(r.moSupport!==1)throw new Error("Must support center orientation.");let e={EDGES:{permutation:u0(12,r.epLex),orientation:Zh(2,12,r.eoMask)},CORNERS:{permutation:u0(8,r.cpLex),orientation:Zh(3,8,r.coMask)},CENTERS:{permutation:Hv(6),orientation:Zh(4,6,r.moMask)}};return Yv(r)?jv(e,r.poIdxU,r.poIdxL):e}function jE(r){let e=[];return(r.epLex<0||r.epLex>=479001600)&&e.push(`epLex (${r.epLex}) out of range`),(r.cpLex<0||r.cpLex>=40320)&&e.push(`cpLex (${r.cpLex}) out of range`),(r.coMask<0||r.coMask>=6561)&&e.push(`coMask (${r.coMask}) out of range`),(r.poIdxU<0||r.poIdxU>=6)&&Yv(r)&&e.push(`poIdxU (${r.poIdxU}) out of range`),(r.eoMask<0||r.eoMask>=4096)&&e.push(`eoMask (${r.eoMask}) out of range`),(r.moMask<0||r.moMask>=4096)&&e.push(`moMask (${r.moMask}) out of range`),(r.poIdxL<0||r.poIdxL>=4)&&e.push(`poIdxL (${r.poIdxL}) out of range`),(r.moSupport<0||r.moSupport>=2)&&e.push(`moSupport (${r.moSupport}) out of range`),e}function Kv(r){let e=mu(r),t=jE(e);if(t.length!==0)throw new Error(`Invalid binary state components: ${t.join(", ")}`);return gu(e)}var Qv,f0=oe(()=>{qv();h0();Qv=[29,12,16,13,3,2,1,12]});function Zv(r){return Array.prototype.map.call(new Uint8Array(r),e=>("00"+e.toString(16)).slice(-2)).join(" ")}function Jv(r){return new Uint8Array(r.split(" ").map(e=>parseInt(e,16)))}var $v=oe(()=>{});var p0={};_t(p0,{bufferToSpacedHex:()=>Zv,experimentalBinaryComponentsToReid3x3x3:()=>gu,experimentalNormalizePuzzleOrientation:()=>ma,experimentalTwizzleBinaryToBinaryComponents:()=>mu,reid3x3x3ToTwizzleBinary:()=>Xv,spacedHexToBuffer:()=>Jv,twizzleBinaryToReid3x3x3:()=>Kv});var $h=oe(()=>{f0();$v();h0();f0()});function ex(r,e){let t=ma(r);return e.ignoreCenterOrientation?Jr(Ye,"EDGES",t,Ye.startPieces)&&Jr(Ye,"CORNERS",t,Ye.startPieces):Vi(Ye,t,Ye.startPieces)}var tx=oe(()=>{$h();a0();du()});var d0={};_t(d0,{CanonicalSequenceIterator:()=>o0,Canonicalizer:()=>r0,KPuzzle:()=>pn,KPuzzleSVGWrapper:()=>Xo,SearchSequence:()=>$r,areOrbitTransformationsEquivalent:()=>Jr,areStatesEquivalent:()=>Qh,areTransformationsEquivalent:()=>Vi,combineTransformations:()=>gt,experimentalCube3x3x3KPuzzle:()=>Ye,experimentalIs3x3x3Solved:()=>ex,experimentalTransformationForQuantumMove:()=>Yh,identityTransformation:()=>Li,invertTransformation:()=>Wi,multiplyTransformations:()=>Yo,parseKPuzzleDefinition:()=>s0,transformationForMove:()=>Ai,transformationOrder:()=>kv});var Ht=oe(()=>{i0();Iv();du();Gv();Vv();a0();tx();i0()});var yu,nx=oe(()=>{yu=class{constructor(e,t){this.facenames=e;this.prefixFree=!0;this.gripnames=[];t&&(this.gripnames=t);for(let n=0;this.prefixFree&&n<e.length;n++)for(let i=0;this.prefixFree&&i<e.length;i++)n!==i&&e[n].startsWith(e[i])&&(this.prefixFree=!1)}setGripNames(e){this.gripnames=e}splitByFaceNames(e){let t=[],n=0;for(;n<e.length;){n>0&&n<e.length&&e[n]==="_"&&n++;let i=-1;for(let o=0;o<this.facenames.length;o++)e.substr(n).startsWith(this.facenames[o])&&(i<0||this.facenames[o].length>this.facenames[i].length)&&(i=o);if(i>=0)t.push(i),n+=this.facenames[i].length;else throw new Error("Could not split "+e+" into face names.")}return t}joinByFaceIndices(e){let t="",n=[];for(let i=0;i<e.length;i++)n.push(t),n.push(this.facenames[e[i]]),this.prefixFree||(t="_");return n.join("")}spinmatch(e,t){if(e===t)return!0;try{let n=this.splitByFaceNames(e),i=this.splitByFaceNames(t);if(n.length!==i.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 s=!1;for(let a=0;a<i.length;a++)if(n[o]===i[a]){s=!0;break}if(!s)return!1}return!0}catch(n){return!1}}unswizzle(e){(e.endsWith("v")||e.endsWith("w"))&&e[0]<="Z"&&(e=e.slice(0,e.length-1));let t=e.toUpperCase();for(let n=0;n<this.gripnames.length;n++){let i=this.gripnames[n];if(this.spinmatch(t,i))return i}return e}}});var ga,ix=oe(()=>{ga=class{notationToInternal(e){return e}notationToExternal(e){return e}}});var ef,rx=oe(()=>{Oe();ef=class{constructor(e,t){this.child=e;this.sw=t}notationToInternal(e){return e.family==="T"&&e.innerLayer===void 0&&e.outerLayer===void 0?new E(new ze("FLRv",e.innerLayer,e.outerLayer),e.amount):this.child.notationToInternal(e)}notationToExternal(e){let t=e.family;return t.length>0&&t[t.length-1]==="v"&&(t=t.substring(0,t.length-1)),this.sw.spinmatch(t,"FLUR")?new E(new ze("T",e.innerLayer,e.outerLayer),e.amount):this.child.notationToExternal(e)}}});var vu,ox=oe(()=>{Oe();vu=class{constructor(e,t){this.internalNames=e;this.externalNames=t}convertString(e,t,n){let i="";(e.endsWith("v")||e.endsWith("v"))&&e<="_"&&(i=e.slice(e.length-1),e=e.slice(0,e.length-1));let o=e.toUpperCase(),s=!1;return e!==o&&(s=!0,e=o),e=n.joinByFaceIndices(t.splitByFaceNames(e)),s&&(e=e.toLowerCase()),e+i}convert(e,t,n){let i=e.family,o=this.convertString(i,t,n);return i===o?e:new E(new ze(o,e.innerLayer,e.outerLayer),e.amount)}notationToInternal(e){return this.convert(e,this.externalNames,this.internalNames)}notationToExternal(e){return this.convert(e,this.internalNames,this.externalNames)}}});var tf,sx=oe(()=>{Oe();tf=class{constructor(e){this.child=e}notationToInternal(e){if(e.innerLayer===void 0&&e.outerLayer===void 0){if(Math.abs(e.amount)===1){if(e.family==="R++")return new E(new ze("L",3,2),-2*e.amount);if(e.family==="R--")return new E(new ze("L",3,2),2*e.amount);if(e.family==="D++")return new E(new ze("U",3,2),-2*e.amount);if(e.family==="D--")return new E(new ze("U",3,2),2*e.amount);if(e.family==="R_PLUSPLUS_")return new E(new ze("L",3,2),-2*e.amount);if(e.family==="D_PLUSPLUS_")return new E(new ze("U",3,2),-2*e.amount)}if(e.family==="y")return new E("Uv",e.amount)}return this.child.notationToInternal(e)}notationToExternal(e){return e.family==="Uv"?new E(new ze("y",e.innerLayer,e.outerLayer),e.amount):e.family==="Dv"?new E("y",-e.amount):this.child.notationToExternal(e)}}});var nf,ax=oe(()=>{Oe();nf=class{constructor(e){this.slices=e}notationToInternal(e){let t=e.family;return!e.innerLayer&&!e.outerLayer&&(t==="x"?e=new E("Rv",e.amount):t==="y"?e=new E("Uv",e.amount):t==="z"&&(e=new E("Fv",e.amount)),(this.slices&1)==1&&(t==="E"?e=new E(new ze("D",(this.slices+1)/2),e.amount):t==="M"?e=new E(new ze("L",(this.slices+1)/2),e.amount):t==="S"&&(e=new E(new ze("F",(this.slices+1)/2),e.amount))),this.slices>2&&(t==="e"?e=new E(new ze("D",this.slices-1,2),e.amount):t==="m"?e=new E(new ze("L",this.slices-1,2),e.amount):t==="s"&&(e=new E(new ze("F",this.slices-1,2),e.amount)))),e}notationToExternal(e){let t=e.family;if(!e.innerLayer&&!e.outerLayer){if(t==="Rv")return new E("x",e.amount);if(t==="Uv")return new E("y",e.amount);if(t==="Fv")return new E("z",e.amount);if(t==="Lv")return new E("x",-e.amount);if(t==="Dv")return new E("y",-e.amount);if(t==="Bv")return new E("z",-e.amount)}return e}}});var QE,YE,lx,ux,cx,xu,rf,hx=oe(()=>{Oe();QE={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"},YE={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"},lx={U:"FRL",L:"FLD",R:"FDR",B:"DLR"},ux=new ze("y"),cx=new ze("Dv"),xu=class{constructor(e){this.child=e;this.wcaHack=!1;this.map=QE}notationToInternal(e){if(this.wcaHack&&e.innerLayer===2&&e.outerLayer===null){let n=lx[e.family];if(n)return new E(new ze(n,e.innerLayer,e.outerLayer),e.amount)}let t=this.map[e.family];return t?new E(new ze(t,e.innerLayer,e.outerLayer),e.amount):ux.isIdentical(e.quantum)?new E(cx,-e.amount):null}notationToExternal(e){if(this.wcaHack&&e.innerLayer===2&&e.outerLayer===null){for(let[t,n]of Object.entries(lx))if(this.child.spinmatch(e.family,n))return new E(new ze(t,e.innerLayer,e.outerLayer),e.amount)}for(let[t,n]of Object.entries(this.map))if(this.child.spinmatch(e.family,n))return new E(new ze(t,e.innerLayer,e.outerLayer),e.amount);return cx.isIdentical(e.quantum)?new E(ux,-e.amount):null}},rf=class extends xu{constructor(e){super(e);this.map=YE}}});var fx,px,dx,mx,gx,yx,vx,of,xx=oe(()=>{Oe();fx={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"},px=new ze("x"),dx=new ze("Rv"),mx=new ze("y"),gx=new ze("Uv"),yx=new ze("z"),vx=new ze("Fv"),of=class{constructor(e){this.child=e}notationToInternal(e){if(e.innerLayer||e.outerLayer)return null;let t=fx[e.family];return t?new E(new ze(t,e.outerLayer,e.innerLayer),e.amount):px.isIdentical(e.quantum)?new E(dx,e.amount):mx.isIdentical(e.quantum)?new E(gx,e.amount):yx.isIdentical(e.quantum)?new E(vx,e.amount):null}notationToExternal(e){for(let[t,n]of Object.entries(fx))if(this.child.spinmatch(e.family,n))return new E(new ze(t,e.innerLayer,e.outerLayer),e.amount);return dx.isIdentical(e.quantum)?new E(px,e.amount):gx.isIdentical(e.quantum)?new E(mx,e.amount):vx.isIdentical(e.quantum)?new E(yx,e.amount):null}}});var m0=oe(()=>{ix();rx();ox();sx();ax();hx();xx()});function wx(r){let e=0,t={};for(;e<r.length&&r[e][0]==="-";){let i=r[e++];if(i==="--rotations")t.addRotations=!0;else if(i==="--allmoves")t.allMoves=!0;else if(i==="--outerblockmoves")t.outerBlockMoves=!0;else if(i==="--vertexmoves")t.vertexMoves=!0;else if(i==="--nocorners")t.includeCornerOrbits=!1;else if(i==="--noedges")t.includeEdgeOrbits=!1;else if(i==="--noorientation")t.fixedOrientation=!0;else if(i==="--nocenters")t.includeCenterOrbits=!1;else if(i==="--omit")t.excludeOrbits=r[e].split(","),e++;else if(i==="--moves")t.moveList=r[e].split(","),e++;else if(i==="--optimize")t.optimizeOrbits=!0;else if(i==="--scramble")t.scrambleAmount=100;else if(i==="--fixcorner")t.fixedPieceType="v";else if(i==="--fixedge")t.fixedPieceType="e";else if(i==="--fixcenter")t.fixedPieceType="f";else if(i==="--orientcenters")t.orientCenters=!0;else if(i==="--puzzleorientation")t.puzzleOrientation=JSON.parse(r[e]),e++;else throw new Error("Bad option: "+i)}return{puzzleDescription:wu(r.slice(e).join(" ")),options:t}}var g0,y0=oe(()=>{v0();g0=class{constructor(e={}){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,e)}}});function eo(r){if(!x0[r]){let e=Array(r);for(let t=0;t<r;t++)e[t]=0;x0[r]=e}return x0[r]}function Hi(r){if(!w0[r]){let e=Array(r);for(let t=0;t<r;t++)e[t]=t;w0[r]=e}return w0[r]}function bx(r){return new fi(Hi(r))}function Sx(r){let e=1;for(;r>1;)e*=r,r--;return e}function XE(r,e){if(r>e){let t=r;r=e,e=t}for(;r>0;){let t=e%r;e=r,r=t}return e}function b0(r,e){return r/XE(r,e)*e}var x0,w0,fi,sf=oe(()=>{x0=[],w0=[];fi=class{constructor(e){this.n=e.length,this.p=e}toString(){return"Perm["+this.p.join(" ")+"]"}mul(e){let t=Array(this.n);for(let n=0;n<this.n;n++)t[n]=e.p[this.p[n]];return new fi(t)}rmul(e){let t=Array(this.n);for(let n=0;n<this.n;n++)t[n]=this.p[e.p[n]];return new fi(t)}inv(){let e=Array(this.n);for(let t=0;t<this.n;t++)e[this.p[t]]=t;return new fi(e)}compareTo(e){for(let t=0;t<this.n;t++)if(this.p[t]!==e.p[t])return this.p[t]-e.p[t];return 0}toGap(){let e=new Array,t=new Array(this.n);for(let n=0;n<this.p.length;n++){if(t[n]||this.p[n]===n)continue;let i=new Array;for(let o=n;!t[o];o=this.p[o])i.push(1+o),t[o]=!0;e.push("("+i.join(",")+")")}return e.join("")}order(){let e=1,t=new Array(this.n);for(let n=0;n<this.p.length;n++){if(t[n]||this.p[n]===n)continue;let i=0;for(let o=n;!t[o];o=this.p[o])i++,t[o]=!0;e=b0(e,i)}return e}}});function S0(r,e){let t=E.fromString(e),n=r.notationToExternal(t);return n===null||t===n?e:n.toString()}function Lx(r,e){let t=r.moveops.length;if(t>30)throw new Error("Canon info too big for bitmask");let n=[],i=[];for(let s=0;s<t;s++){let a=r.moveops[s];n.push(a.order());let l=0;for(let u=0;u<t;u++){if(u===s)continue;let c=r.moveops[u];a.mul(c).equal(c.mul(a))&&(l|=1<<u)}i.push(l)}let o={};o[0]=1;for(let s=0;s<100;s++){let a=0,l={},u=0;for(let c in o){let f=+c,h=o[f];a+=h,u++;for(let p=0;p<n.length;p++)if((f>>p&1)==0&&(f&i[p]&(1<<p)-1)==0){let d=f&i[p]|1<<p;l[d]===void 0&&(l[d]=0),l[d]+=(n[p]-1)*h}}e(`${s}: canonseq ${a} states ${u}`),o=l}}var bu,ya,Di,pr,L0,to,va,A0,Ax=oe(()=>{Oe();m0();sf();bu=class{constructor(e,t){this.size=e;this.mod=t}reassemblySize(){return Sx(this.size)*Math.pow(this.mod,this.size)}};ya=class{constructor(e,t,n,i,o){this.orbitnames=e;this.orbitdefs=t;this.solved=n;this.movenames=i;this.moveops=o}transformToKPuzzle(e){let t={};for(let n=0;n<this.orbitnames.length;n++)t[this.orbitnames[n]]=e.orbits[n].toKPuzzle();return t}static transformToKPuzzle(e,t){let n={};for(let i=0;i<e.length;i++)n[e[i]]=t.orbits[i].toKPuzzle();return n}toKsolve(e,t=new ga){let n=[];n.push("Name "+e),n.push("");for(let i=0;i<this.orbitnames.length;i++)n.push(`Set ${this.orbitnames[i]} ${this.orbitdefs[i].size} ${this.orbitdefs[i].mod}`);n.push(""),n.push("Solved");for(let i=0;i<this.orbitnames.length;i++)this.solved.orbits[i].appendDefinition(n,this.orbitnames[i],!1,!1);n.push("End");for(let i=0;i<this.movenames.length;i++){n.push("");let o=S0(t,this.movenames[i]),s=!1;o[o.length-1]==="'"&&(s=!0,o=o.substring(0,o.length-1)),n.push("Move "+o);for(let a=0;a<this.orbitnames.length;a++)s?this.moveops[i].orbits[a].inv().appendDefinition(n,this.orbitnames[a],!0):this.moveops[i].orbits[a].appendDefinition(n,this.orbitnames[a],!0);n.push("End")}return n}toKPuzzle(e){let t={},n={};for(let o=0;o<this.orbitnames.length;o++)t[this.orbitnames[o]]={numPieces:this.orbitdefs[o].size,orientations:this.orbitdefs[o].mod},n[this.orbitnames[o]]=this.solved.orbits[o].toKPuzzle();let i={};if(e)for(let o=0;o<this.movenames.length;o++)i[this.movenames[o]]=this.transformToKPuzzle(this.moveops[o]);return{name:"PG3D",orbits:t,startPieces:n,moves:i}}optimize(){let e=[],t=[],n=[],i=[];for(let o=0;o<this.moveops.length;o++)i.push([]);for(let o=0;o<this.orbitdefs.length;o++){let s=this.orbitdefs[o].mod,a=this.orbitdefs[o].size,l=new A0(a),u=new Array(this.orbitdefs[o].size);for(let p=0;p<a;p++)u[p]=!1;for(let p=0;p<this.moveops.length;p++)for(let d=0;d<a;d++)(this.moveops[p].orbits[o].perm[d]!==d||this.moveops[p].orbits[o].ori[d]!==0)&&(u[d]=!0,l.union(d,this.moveops[p].orbits[o].perm[d]));let c=!0;if(s>1){c=!1;let p=new A0(this.orbitdefs[o].size*s);for(let d=0;d<this.moveops.length;d++)for(let g=0;g<a;g++)if(this.moveops[d].orbits[o].perm[g]!==g||this.moveops[d].orbits[o].ori[g]!==0)for(let x=0;x<s;x++)p.union(g*s+x,this.moveops[d].orbits[o].perm[g]*s+(x+this.moveops[d].orbits[o].ori[g])%s);for(let d=0;!c&&d<a;d++)for(let g=1;g<s;g++)p.find(d*s)===p.find(d*s+g)&&(c=!0);for(let d=0;!c&&d<a;d++)for(let g=0;g<d;g++)this.solved.orbits[o].perm[d]===this.solved.orbits[o].perm[g]&&(c=!0)}let f=-1,h=!1;for(let p=0;p<this.orbitdefs[o].size;p++)if(u[p]){let d=l.find(p);f<0?f=d:f!==d&&(h=!0)}for(let p=0;p<this.orbitdefs[o].size;p++){if(!u[p]||l.find(p)!==p)continue;let g=[],x=[],y=0;for(let m=0;m<this.orbitdefs[o].size;m++)l.find(m)===p&&(g[y]=m,x[m]=y,y++);if(h?e.push(`${this.orbitnames[o]}_p${p}`):e.push(this.orbitnames[o]),c){t.push(new bu(y,this.orbitdefs[o].mod)),n.push(this.solved.orbits[o].remapVS(g,y));for(let m=0;m<this.moveops.length;m++)i[m].push(this.moveops[m].orbits[o].remap(g,x,y))}else{t.push(new bu(y,1)),n.push(this.solved.orbits[o].remapVS(g,y).killOri());for(let m=0;m<this.moveops.length;m++)i[m].push(this.moveops[m].orbits[o].remap(g,x,y).killOri())}}}return new ya(e,t,new va(n),this.movenames,i.map(o=>new to(o)))}scramble(e){let t=[];for(let i=0;i<this.moveops.length;i++)t[i]=this.moveops[i];for(let i=0;i<t.length;i++){let o=Math.floor(Math.random()*t.length),s=t[i];t[i]=t[o],t[o]=s}e<t.length&&(e=t.length);for(let i=0;i<e;i++){let o=Math.floor(Math.random()*t.length),s=Math.floor(Math.random()*t.length),a=Math.floor(Math.random()*this.moveops.length);t[o]=t[o].mul(t[s]).mul(this.moveops[a]),Math.random()<.1&&(t[o]=t[o].mul(this.moveops[a]))}let n=t[0];for(let i=1;i<t.length;i++)n=n.mul(t[i]);this.solved=this.solved.mul(n)}reassemblySize(){let e=1;for(let t=0;t<this.orbitdefs.length;t++)e*=this.orbitdefs[t].reassemblySize();return e}},Di=class{constructor(e,t,n){this.perm=e;this.ori=t;this.orimod=n}static e(e,t){return new Di(Hi(e),eo(e),t)}mul(e){let t=this.perm.length,n=new Array(t);if(this.orimod===1){for(let i=0;i<t;i++)n[i]=this.perm[e.perm[i]];return new Di(n,this.ori,this.orimod)}else{let i=new Array(t);for(let o=0;o<t;o++)n[o]=this.perm[e.perm[o]],i[o]=(this.ori[e.perm[o]]+e.ori[o])%this.orimod;return new Di(n,i,this.orimod)}}inv(){let e=this.perm.length,t=new Array(e),n=new Array(e);for(let i=0;i<e;i++)t[this.perm[i]]=i,n[this.perm[i]]=(this.orimod-this.ori[i])%this.orimod;return new Di(t,n,this.orimod)}equal(e){let t=this.perm.length;for(let n=0;n<t;n++)if(this.perm[n]!==e.perm[n]||this.ori[n]!==e.ori[n])return!1;return!0}killOri(){let e=this.perm.length;for(let t=0;t<e;t++)this.ori[t]=0;return this.orimod=1,this}toPerm(){let e=this.orimod;if(e===1)return new fi(this.perm);let t=this.perm.length,n=new Array(t*e);for(let i=0;i<t;i++)for(let o=0;o<e;o++)n[i*e+o]=e*this.perm[i]+(this.ori[i]+o)%e;return new fi(n)}identicalPieces(){let e=[],t=this.perm.length,n=[];for(let i=0;i<t;i++){let o=this.perm[i];if(e[o]===void 0){let s=[i];e[o]=!0;for(let a=i+1;a<t;a++)this.perm[a]===o&&s.push(a);n.push(s)}}return n}order(){return this.toPerm().order()}isIdentity(){let e=this.perm.length;if(this.perm===Hi(e)&&this.ori===eo(e))return!0;for(let t=0;t<e;t++)if(this.perm[t]!==t||this.ori[t]!==0)return!1;return!0}zeroOris(){let e=this.perm.length;if(this.ori===eo(e))return!0;for(let t=0;t<e;t++)if(this.ori[t]!==0)return!1;return!0}remap(e,t,n){let i=new Array(n),o=new Array(n);for(let s=0;s<n;s++)i[s]=t[this.perm[e[s]]],o[s]=this.ori[e[s]];return new Di(i,o,this.orimod)}remapVS(e,t){let n=new Array(t),i=new Array(t),o=0,s=[];for(let a=0;a<t;a++){let l=this.perm[e[a]];s[l]===void 0&&(s[l]=o++),n[a]=s[l],i[a]=this.ori[e[a]]}return new Di(n,i,this.orimod)}appendDefinition(e,t,n,i=!0){if(!(i&&this.isIdentity())&&(e.push(t),e.push(this.perm.map(o=>o+1).join(" ")),!this.zeroOris()))if(n){let o=new Array(this.ori.length);for(let s=0;s<o.length;s++)o[this.perm[s]]=this.ori[s];e.push(o.join(" "))}else e.push(this.ori.join(" "))}toKPuzzle(){let e=this.perm.length;return this.isIdentity()?(Di.kcache[e]||(Di.kcache[e]={permutation:Hi(e),orientation:eo(e)}),Di.kcache[e]):{permutation:this.perm,orientation:this.ori}}},pr=Di;pr.kcache=[];L0=class{constructor(e){this.orbits=e}internalMul(e){let t=[];for(let n=0;n<this.orbits.length;n++)t.push(this.orbits[n].mul(e.orbits[n]));return t}internalInv(){let e=[];for(let t of this.orbits)e.push(t.inv());return e}equal(e){for(let t=0;t<this.orbits.length;t++)if(!this.orbits[t].equal(e.orbits[t]))return!1;return!0}killOri(){for(let e of this.orbits)e.killOri();return this}toPerm(){let e=new Array,t=0;for(let i of this.orbits){let o=i.toPerm();e.push(o),t+=o.n}let n=new Array(t);t=0;for(let i of e){for(let o=0;o<i.n;o++)n[t+o]=t+i.p[o];t+=i.n}return new fi(n)}identicalPieces(){let e=[],t=0;for(let n of this.orbits){let i=n.orimod,o=n.identicalPieces();for(let s=0;s<o.length;s++)e.push(o[s].map(a=>a*i+t));t+=i*n.perm.length}return e}order(){let e=1;for(let t of this.orbits)e=b0(e,t.order());return e}},to=class extends L0{constructor(e){super(e)}mul(e){return new to(this.internalMul(e))}mulScalar(e){if(e===0)return this.e();let t=this;for(e<0&&(t=t.inv(),e=-e);(e&1)==0;)t=t.mul(t),e>>=1;if(e===1)return t;let n=t,i=this.e();for(;e>0;)e&1&&(i=i.mul(n)),e>1&&(n=n.mul(n)),e>>=1;return i}inv(){return new to(this.internalInv())}e(){return new to(this.orbits.map(e=>pr.e(e.perm.length,e.orimod)))}},va=class extends L0{constructor(e){super(e)}mul(e){return new va(this.internalMul(e))}},A0=class{constructor(e){this.n=e;this.heads=new Array(e);for(let t=0;t<e;t++)this.heads[t]=t}find(e){let t=this.heads[e];return this.heads[t]===t||(t=this.find(this.heads[t]),this.heads[e]=t),t}union(e,t){let n=this.find(e),i=this.find(t);n<i?this.heads[i]=n:n>i&&(this.heads[n]=i)}}});var af,Dx=oe(()=>{af={"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 lf(r){let e=new Ge(0,0,0,0);for(let t=0;t<r.length;t++)e=e.sum(r[t]);return e.smul(1/r.length)}function Ex(r,e,t,n){let i=n[r].intersect3(n[e],n[t]);if(!i)return i;for(let o=0;o<n.length;o++)if(o!==r&&o!==e&&o!==t){let s=n[o].b*i.b+n[o].c*i.c+n[o].d*i.d;if(n[o].a>0&&s>n[o].a||n[o].a<0&&s<n[o].a)return!1}return i}var Ko,Ge,uf=oe(()=>{Ko=1e-9;Ge=class{constructor(e,t,n,i){this.a=e;this.b=t;this.c=n;this.d=i}mul(e){return new Ge(this.a*e.a-this.b*e.b-this.c*e.c-this.d*e.d,this.a*e.b+this.b*e.a+this.c*e.d-this.d*e.c,this.a*e.c-this.b*e.d+this.c*e.a+this.d*e.b,this.a*e.d+this.b*e.c-this.c*e.b+this.d*e.a)}toString(){return`Q[${this.a},${this.b},${this.c},${this.d}]`}dist(e){return Math.hypot(this.a-e.a,this.b-e.b,this.c-e.c,this.d-e.d)}len(){return Math.hypot(this.a,this.b,this.c,this.d)}cross(e){return new Ge(0,this.c*e.d-this.d*e.c,this.d*e.b-this.b*e.d,this.b*e.c-this.c*e.b)}dot(e){return this.b*e.b+this.c*e.c+this.d*e.d}normalize(){let e=Math.sqrt(this.dot(this));return new Ge(this.a/e,this.b/e,this.c/e,this.d/e)}makenormal(){return new Ge(0,this.b,this.c,this.d).normalize()}normalizeplane(){let e=Math.hypot(this.b,this.c,this.d);return new Ge(this.a/e,this.b/e,this.c/e,this.d/e)}smul(e){return new Ge(this.a*e,this.b*e,this.c*e,this.d*e)}sum(e){return new Ge(this.a+e.a,this.b+e.b,this.c+e.c,this.d+e.d)}sub(e){return new Ge(this.a-e.a,this.b-e.b,this.c-e.c,this.d-e.d)}angle(){return 2*Math.acos(this.a)}invrot(){return new Ge(this.a,-this.b,-this.c,-this.d)}det3x3(e,t,n,i,o,s,a,l,u){return e*(o*u-s*l)+t*(s*a-i*u)+n*(i*l-o*a)}rotateplane(e){let t=e.mul(new Ge(0,this.b,this.c,this.d)).mul(e.invrot());return t.a=this.a,t}orthogonal(){let e=Math.abs(this.b),t=Math.abs(this.c),n=Math.abs(this.d);return e<t&&e<n?this.cross(new Ge(0,1,0,0)).normalize():t<e&&t<n?this.cross(new Ge(0,0,1,0)).normalize():this.cross(new Ge(0,0,0,1)).normalize()}pointrotation(e){let t=this.normalize();if(e=e.normalize(),t.sub(e).len()<Ko)return new Ge(1,0,0,0);let n=t.sum(e);n.len()<Ko?n=n.orthogonal():n=n.normalize();let i=t.cross(n);return i.a=t.dot(n),i}unproject(e){return this.sum(e.smul(-this.dot(e)/(this.len()*e.len())))}rotatepoint(e){return e.mul(this).mul(e.invrot())}rotateface(e){return e.map(t=>t.rotatepoint(this))}intersect3(e,t){let n=this.det3x3(this.b,this.c,this.d,e.b,e.c,e.d,t.b,t.c,t.d);return Math.abs(n)<Ko?!1:new Ge(0,this.det3x3(this.a,this.c,this.d,e.a,e.c,e.d,t.a,t.c,t.d)/n,this.det3x3(this.b,this.a,this.d,e.b,e.a,e.d,t.b,t.a,t.d)/n,this.det3x3(this.b,this.c,this.a,e.b,e.c,e.a,t.b,t.c,t.a)/n)}side(e){return e>Ko?1:e<-Ko?-1:0}cutface(e){let t=this.a,n=0,i=null;for(let o=0;o<e.length;o++)n|=1<<this.side(e[o].dot(this)-t)+1;if((n&5)==5){i=[];let o=e.map(s=>this.side(s.dot(this)-t));for(let s=-1;s<=1;s+=2){let a=[];for(let l=0;l<e.length;l++){(o[l]===s||o[l]===0)&&a.push(e[l]);let u=(l+1)%e.length;if(o[l]+o[u]===0&&o[l]!==0){let c=e[l].dot(this)-t,f=e[u].dot(this)-t,h=c/(c-f),p=e[l].smul(1-h).sum(e[u].smul(h));a.push(p)}}i.push(a)}}return i}cutfaces(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],o=this.cutface(i);o?(t.push(o[0]),t.push(o[1])):t.push(i)}return t}faceside(e){let t=this.a;for(let n=0;n<e.length;n++){let i=this.side(e[n].dot(this)-t);if(i!==0)return i}throw new Error("Could not determine side of plane in faceside")}sameplane(e){let t=this.normalize(),n=e.normalize();return t.dist(n)<Ko||t.dist(n.smul(-1))<Ko}makecut(e){return new Ge(e,this.b,this.c,this.d)}}});function Mx(){let r=Math.sqrt(.5);return[new Ge(r,r,0,0),new Ge(r,0,r,0)]}function Rx(){return[new Ge(.5,.5,.5,.5),new Ge(.5,.5,.5,-.5)]}function Tx(){let r=2*Math.PI/10,e=.5+.3*Math.sqrt(5),t=.5+.1*Math.sqrt(5),n=Math.sqrt(e*e+t*t);return e/=n,t/=n,[new Ge(Math.cos(r),e*Math.sin(r),t*Math.sin(r),0),new Ge(.5,.5,.5,.5)]}function Fx(){let r=1/6+Math.sqrt(5)/6,e=2/3+Math.sqrt(5)/3,t=Math.sqrt(r*r+e*e);r/=t,e/=t;let n=2*Math.PI/6;return[new Ge(Math.cos(n),r*Math.sin(n),e*Math.sin(n),0),new Ge(Math.cos(n),-r*Math.sin(n),e*Math.sin(n),0)]}function _x(){let r=Math.sqrt(.5);return[new Ge(.5,.5,.5,.5),new Ge(r,0,0,r)]}function Cx(r){let e=[new Ge(1,0,0,0)];for(let t=0;t<e.length;t++)for(let n=0;n<r.length;n++){let i=r[n].mul(e[t]),o=i.smul(-1),s=!1;for(let a=0;a<e.length;a++)if(i.dist(e[a])<cf||o.dist(e[a])<cf){s=!0;break}s||e.push(i)}return e}function D0(r,e){let t=[],n=[];for(let i=0;i<e.length;i++){let o=r.rotateplane(e[i]),s=!1;for(let a=0;a<t.length;a++)if(o.dist(t[a])<cf){s=!0;break}s||(t.push(o),n.push(e[i]))}return n}function E0(r){let e=[];for(let t=1;t<r.length;t++)for(let n=t+1;n<r.length;n++){let i=Ex(0,t,n,r);if(i){let o=!1;for(let s=0;s<e.length;s++)if(i.dist(e[s])<cf){o=!0;break}o||e.push(i)}}for(;;){let t=!1;for(let n=0;n<e.length;n++){let i=(n+1)%e.length;if(r[0].dot(e[n].cross(e[i]))<0){let o=e[n];e[n]=e[i],e[i]=o,t=!0}}if(!t)break}return e}var cf,Px=oe(()=>{uf();cf=1e-9});function hf(r,e){let t=r[0].p.length,n=bx(t),i=[],o=[],s=[],a=[],l=[];function u(p){for(let d=p.p.length-1;d>=0;d--){let g=p.p[d];if(g!==d){if(!i[d][g])return!1;p=p.mul(o[d][g])}}return!0}function c(p,d,g){a[p].push(d),l[p].push(g);for(let x=0;x<i[p].length;x++)i[p][x]&&f(p,i[p][x].mul(d),g+s[p][x])}function f(p,d,g){let x=d.p[p];if(!i[p][x]){i[p][x]=d,o[p][x]=d.inv(),s[p][x]=g;for(let m=0;m<a[p].length;m++)f(p,d.mul(a[p][m]),g+l[p][m]);return}let y=d.mul(o[p][x]);u(y)||c(p-1,y,g+s[p][x])}function h(){i=[],o=[],a=[],s=[],l=[];for(let g=0;g<t;g++)i.push([]),o.push([]),s.push([]),a.push([]),l.push([]),i[g][g]=n,o[g][g]=n,s[g][g]=0;let p=0,d=1;for(let g=0;g<r.length;g++){c(t-1,r[g],1),d=1;let x=0,y=0,m=[],b=new kx;for(let w=0;w<t;w++){let D=0,R=0;for(let T=0;T<t;T++)i[w][T]&&(D++,R+=s[w][T],w!==T&&p++);x+=a[w].length,d*=D,D>1&&b.multiply(D);let L=R/D;m.push(L),y+=L}e(`${g}: sz ${d} T ${x} sol ${y} none ${p} mults ${b.toString()}`)}return d}return h()}var kx,M0=oe(()=>{sf();kx=class{constructor(){this.mult=[]}multiply(e){for(let t=2;t*t<=e;t++)for(;e%t==0;)this.mult[t]!==void 0?this.mult[t]++:this.mult[t]=1,e/=t;e>1&&(this.mult[e]!==void 0?this.mult[e]++:this.mult[e]=1)}toString(){let e="";for(let t=0;t<this.mult.length;t++)this.mult[t]!==void 0&&(e!==""&&(e+="*"),e+=t,this.mult[t]>1&&(e+=`^${this.mult[t]}`));return e}}});function R0(r){return r}function T0(r){}function KE(r,e){let t=[];for(let n of r)for(let i of e)t.push(i.rotate(n));return t}function $E(){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 eM(){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 tM(){return{4:["F","D","L","R"],6:["U","D","F","B","L","R"],8:["F","BB","D","U","BR","L","R","BL"],12:["L","E","F","BF","R","I","U","D","BR","A","BL","C"],20:["L","S","E","O","F","B","I","P","R","K","U","D","J","A","Q","H","G","N","M","C"]}}function nM(){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 ff(r,e){for(let t=0;t<r.length;t++)if(r[t][0].dist(e)<qt)return t;throw new Error("Element not found")}function Bx(){return af}function zx(r){return af[r]}function wu(r){let e=r.split(/ /).filter(Boolean);if(e.length%2==0)return null;let t=e[0];if(t!=="o"&&t!=="c"&&t!=="i"&&t!=="d"&&t!=="t")return null;let n=[];for(let i=1;i<e.length;i+=2){if(e[i]!=="f"&&e[i]!=="v"&&e[i]!=="e")return null;n.push({cutType:e[i],distance:parseFloat(e[i+1])})}return{shape:t,cuts:n}}function F0(r,e={}){let t=wu(r);if(t===null)throw new Error("Could not parse the puzzle description");let n=new df(t,Object.assign({},{allMoves:!0},e));return n.allstickers(),n.genperms(),n}function Ix(r,e){return F0(af[r],e)}function iM(r,e,t){let n=!1;t-e[1]<e[0]&&(r=[r[2],r[3],r[0],r[1]],e=[t-e[1],t-e[0]],n=!0);let i=r[0],o="";if(e[0]===0&&e[1]===t)i=i+"v";else if(e[0]===e[1])e[1]>0&&(o=String(e[1]+1));else if(e[0]===0)i=i.toLowerCase(),e[1]>1&&(o=String(e[1]+1));else throw`We only support slice and outer block moves right now. ${e}`;return[o+i,n]}function rM(r,e){let t=[],n=0;for(;n<r.length;){n>0&&n<r.length&&r[n]==="_"&&n++;let i="";for(let o of e)r.substr(n).startsWith(o[1])&&o[1].length>i.length&&(i=o[1]);if(i!=="")t.push(i),n+=i.length;else throw new Error("Could not split "+r+" into face names.")}return t}function pf(r,e){return[r.b/e,-r.c/e,r.d/e]}function _0(r,e){let t=[],n=r.length;for(let i=0;i<n;i++){let o=pf(r.get(n-i-1),e);t[3*i]=o[0],t[3*i+1]=o[1],t[3*i+2]=o[2]}return t}var xa,Su,qt,ZE,JE,df,Ux,v0=oe(()=>{Oe();nx();m0();y0();sf();Ax();Dx();Px();uf();M0();xa=class{constructor(e){this.coords=new Array(e.length*3);for(let t=0;t<e.length;t++)this.coords[3*t]=e[t].b,this.coords[3*t+1]=e[t].c,this.coords[3*t+2]=e[t].d;this.length=e.length}get(e){return new Ge(0,this.coords[3*e],this.coords[3*e+1],this.coords[3*e+2])}centermass(){let e=0,t=0,n=0;for(let i=0;i<this.length;i++)e+=this.coords[3*i],t+=this.coords[3*i+1],n+=this.coords[3*i+2];return new Ge(0,e/this.length,t/this.length,n/this.length)}rotate(e){let t=[];for(let n=0;n<this.length;n++)t.push(this.get(n).rotatepoint(e));return new xa(t)}rotateforward(){let e=[];for(let t=1;t<this.length;t++)e.push(this.get(t));return e.push(this.get(0)),new xa(e)}},Su=class{constructor(e,t,n){this.face=e;this.left=t;this.right=n}split(e){let t=e.cutface(this.face);return t!==null&&(this.left===void 0?(this.left=new Su(t[0]),this.right=new Su(t[1])):(this.left=this.left?.split(e),this.right=this.right?.split(e))),this}collect(e,t){return this.left===void 0?e.push(new xa(this.face)):t?(this.left?.collect(e,!1),this.right?.collect(e,!0)):(this.right?.collect(e,!1),this.left?.collect(e,!0)),e}};qt=1e-9,ZE="PuzzleGeometry 0.1 Copyright 2018 Tomas Rokicki.",JE=!1;df=class{constructor(e,t){this.cmovesbyslice=[];this.duplicatedFaces=[];this.duplicatedCubies=[];this.fixedCubie=-1;this.net=[];this.colors=[];this.faceorder=[];this.faceprecedence=[];this.notationMapper=new ga;this.addNotationMapper="";this.setReidOrder=!1;let n=R0("genperms");this.options=new g0(t),this.options.verbosity>0&&console.log(this.header("# ")),this.create(e),T0(n)}create(e){let{shape:t,cuts:n}=e;this.moveplanes=[],this.moveplanes2=[],this.faces=[],this.cubies=[];let i=null;switch(t){case"c":i=Mx();break;case"o":i=_x();break;case"i":i=Fx();break;case"t":i=Rx();break;case"d":i=Tx();break;default:throw new Error("Bad shape argument: "+t)}this.rotations=Cx(i),this.options.verbosity&&console.log("# Rotations: "+this.rotations.length);let o=i[0];this.baseplanerot=D0(o,this.rotations);let s=this.baseplanerot.map(P=>o.rotateplane(P));this.baseplanes=s,this.baseFaceCount=s.length;let a=$E()[s.length];this.net=a,this.colors=eM()[s.length],this.faceorder=tM()[s.length],this.options.verbosity>0&&console.log("# Base planes: "+s.length);let l=E0(s),u=new Ge(0,0,0,0);this.options.verbosity>0&&console.log("# Face vertices: "+l.length);let c=s[0].makenormal(),f=l[0].sum(l[1]).makenormal(),h=l[0].makenormal(),p=new Ge(1,c.b,c.c,c.d);this.options.verbosity>0&&console.log("# Boundary is "+p);let g=D0(p,this.rotations).map(P=>p.rotateplane(P)),x=E0(g);this.edgedistance=x[0].sum(x[1]).smul(.5).dist(u),this.vertexdistance=x[0].dist(u);let y=[],m=[],b=!1,w=!1,D=!1;for(let P of n){let Z=null,ae=0;switch(P.cutType){case"f":Z=c,ae=1,b=!0;break;case"v":Z=h,ae=this.vertexdistance,D=!0;break;case"e":Z=f,ae=this.edgedistance,w=!0;break;default:throw new Error("Bad cut argument: "+P.cutType)}y.push(Z.makecut(P.distance)),m.push(P.distance<ae)}this.options.addRotations&&(b||y.push(c.makecut(10)),D||y.push(h.makecut(10)),w||y.push(f.makecut(10))),this.basefaces=[];for(let P of this.baseplanerot){let Z=P.rotateface(x);this.basefaces.push(new xa(Z))}let R=[],L=[],T=[],U=[],F=x.length;function C(P,Z,ae){for(let ne of P)if(ne[0].dist(Z)<qt){ne.push(ae);return}P.push([Z,ae])}for(let P=0;P<this.baseplanerot.length;P++){let Z=this.baseplanerot[P].rotateface(x);for(let ae=0;ae<Z.length;ae++){let ne=(ae+1)%Z.length,fe=Z[ae].sum(Z[ne]).smul(.5);C(U,fe,P)}}let j=[];for(let P=0;P<this.baseplanerot.length;P++){let Z=this.baseplanerot[P].rotateface(x),ae=[];for(let ne=0;ne<Z.length;ne++){let fe=(ne+1)%Z.length,W=Z[ne].sum(Z[fe]).smul(.5),Q=U[ff(U,W)];if(P===Q[1])ae.push(Q[2]);else if(P===Q[2])ae.push(Q[1]);else throw new Error("Could not find edge")}j.push(ae)}let B={},z=[];z.push(a[0][0]),B[a[0][0]]=0,z[j[0][0]]=a[0][1],B[a[0][1]]=j[0][0];for(let P of a){let Z=P[0],ae=B[Z];if(ae===void 0)throw new Error("Bad edge description; first edge not connected");let ne=-1;for(let fe=0;fe<j[ae].length;fe++){let W=z[j[ae][fe]];if(W!==void 0&&W===P[1]){ne=fe;break}}if(ne<0)throw new Error("First element of a net not known");for(let fe=2;fe<P.length;fe++){if(P[fe]==="")continue;let W=j[ae][(fe+ne-1)%F],Q=z[W];if(Q!==void 0&&Q!==P[fe])throw new Error("Face mismatch in net");z[W]=P[fe],B[P[fe]]=W}}for(let P=0;P<z.length;P++){let Z=!1;for(let ae=0;ae<this.faceorder.length;ae++)if(z[P]===this.faceorder[ae]){this.faceprecedence[P]=ae,Z=!0;break}if(!Z)throw new Error("Could not find face "+z[P]+" in face order list "+this.faceorder)}for(let P=0;P<this.baseplanerot.length;P++){let Z=this.baseplanerot[P].rotateface(x),ae=p.rotateplane(this.baseplanerot[P]),ne=z[P];R.push([Z,ne]),L.push([ae,ne])}for(let P=0;P<this.baseplanerot.length;P++){let Z=this.baseplanerot[P].rotateface(x),ae=z[P];for(let ne=0;ne<Z.length;ne++){let fe=(ne+1)%Z.length,W=Z[ne].sum(Z[fe]).smul(.5),Q=(ne+2)%Z.length,le=Z[fe].sum(Z[Q]).smul(.5),ue=ff(U,W),Se=ff(U,le);C(T,Z[fe],[ae,Se,ue])}}this.swizzler=new yu(R.map(P=>P[1]));let O=this.swizzler.prefixFree?"":"_";for(let P=0;P<U.length;P++){if(U[P].length!==3)throw new Error("Bad length in edge names "+U[P]);let Z=z[U[P][1]],ae=z[U[P][2]];this.faceprecedence[U[P][1]]<this.faceprecedence[U[P][2]]?Z=Z+O+ae:Z=ae+O+Z,U[P]=[U[P][0],Z]}for(let P=0;P<T.length;P++){if(T[P].length<4)throw new Error("Bad length in vertex names");let Z=1;for(let ne=2;ne<T[P].length;ne++)this.faceprecedence[B[T[P][ne][0]]]<this.faceprecedence[B[T[P][Z][0]]]&&(Z=ne);let ae="";for(let ne=1;ne<T[P].length;ne++){ne===1?ae=T[P][Z][0]:ae=ae+O+T[P][Z][0];for(let fe=1;fe<T[P].length;fe++)if(T[P][Z][1]===T[P][fe][2]){Z=fe;break}}T[P]=[T[P][0],ae]}this.options.verbosity>1&&(console.log("# Face precedence list: "+this.faceorder.join(" ")),console.log("# Face names: "+R.map(P=>P[1]).join(" ")),console.log("# Edge names: "+U.map(P=>P[1]).join(" ")),console.log("# Vertex names: "+T.map(P=>P[1]).join(" ")));let V=[];for(let P of L)V.push([P[0].makenormal(),P[1],"f"]);for(let P of U)V.push([P[0].makenormal(),P[1],"e"]);for(let P of T)V.push([P[0].makenormal(),P[1],"v"]);this.facenames=R,this.faceplanes=L,this.edgenames=U,this.vertexnames=T,this.geonormals=V;let q=V.map(P=>P[1]);this.swizzler.setGripNames(q),this.options.verbosity>0&&console.log("# Distances: face "+1+" edge "+this.edgedistance+" vertex "+this.vertexdistance);for(let P=0;P<y.length;P++)for(let Z of this.rotations){let ae=y[P].rotateplane(Z),ne=!1;for(let fe of this.moveplanes)if(ae.sameplane(fe)){ne=!0;break}ne||(this.moveplanes.push(ae),m[P]&&this.moveplanes2.push(ae))}let se=new Su(x),he=this.moveplanes2.slice(),Y=31;for(let P=0;P<he.length;P++){let Z=P+Math.floor((he.length-P)*(Y/65536));se=se.split(he[Z]),he[Z]=he[P],Y=(Y*1657+101)%65536}let X=se.collect([],!0);this.faces=X,this.options.verbosity>0&&console.log("# Faces is now "+X.length),this.stickersperface=X.length;let ve=[],pe=lf(x);for(let P of this.rotations){let Z=P.rotateface(x);pe.dist(lf(Z))<qt&&ve.push(P)}let Le=new Array(X.length),Ie=[];for(let P=0;P<X.length;P++){let Z=X[P].centermass();Ie.push([pe.dist(Z),Z,P])}Ie.sort((P,Z)=>P[0]-Z[0]);for(let P=0;P<X.length;P++){let Z=Ie[P][2];if(!Le[Z]){Le[Z]=!0;for(let ae of ve){let ne=X[Z].rotate(ae),fe=ne.centermass();for(let W=P+1;W<X.length&&!(Ie[W][0]-Ie[P][0]>qt);W++){let Q=Ie[W][2];if(!Le[Q]&&fe.dist(Ie[W][1])<qt){Le[Q]=!0,X[Q]=ne;break}}}}}this.shortedge=1e99;for(let P of X)for(let Z=0;Z<P.length;Z++){let ae=(Z+1)%P.length,ne=P.get(Z).dist(P.get(ae));ne<this.shortedge&&(this.shortedge=ne)}this.options.verbosity>0&&console.log("# Short edge is "+this.shortedge),t==="c"&&b&&!w&&!D&&(this.addNotationMapper="NxNxNCubeMapper",this.setReidOrder=!0),t==="c"&&D&&!b&&!w&&(this.addNotationMapper="SkewbMapper"),t==="t"&&(D||b)&&!w&&(this.addNotationMapper="PyraminxOrTetraminxMapper"),t==="o"&&b&&(this.notationMapper=new vu(this.swizzler,new yu(["F","D","L","BL","R","U","BR","B"])),!w&&!D&&(this.addNotationMapper="FTOMapper")),t==="d"&&b&&(this.addNotationMapper="MegaminxMapper",this.notationMapper=new vu(this.swizzler,new yu(["U","F","L","BL","BR","R","FR","FL","DL","B","DR","D"])))}keyface(e){return this.keyface2(e.centermass())}keyface2(e){let t="",n=String.fromCharCode;for(let i of this.moveplanesets)if(i.length>0){let o=e.dot(i[0]),s=0,a=1;for(;a*2<=i.length;)a*=2;for(;a>0;a>>=1)s+a<=i.length&&o>i[s+a-1].a&&(s+=a);if(s<47)t=t+n(33+s);else if(s<47+47*47)t=t+n(33+47+Math.floor(s/47)-1)+n(33+s%47);else if(s<47+47*47+47*47*47)t=t+n(33+47+Math.floor((s-47)/(47*47)-1))+n(33+47+Math.floor((s-47)/47)%47)+n(33+s%47);else throw Error("Too many slices for cubie encoding")}return t}keyface3(e){let t=e.centermass(),n=[];for(let i of this.moveplanesets)if(i.length>0){let o=t.dot(i[0]),s=0,a=1;for(;a*2<=i.length;)a*=2;for(;a>0;a>>=1)s+a<=i.length&&o>i[s+a-1].a&&(s+=a);n.push(s)}return n}findface(e){let t=this.keyface2(e),n=this.facelisthash.get(t);if(n.length===1)return n[0];for(let i=0;i+1<n.length;i++){let o=this.facelisthash.get(t)[i];if(Math.abs(e.dist(this.facecentermass[o]))<qt)return o}return n[n.length-1]}project2d(e,t,n){let i=this.facenames[e][0],o=(t+1)%i.length,s=this.baseplanes[e],a=i[o].sub(i[t]),l=a.len();a=a.normalize();let u=a.cross(s).normalize(),c=n[1].sub(n[0]),f=c.len()/l;c=c.normalize();let h=c.b,p=c.c,d=a.smul(h).sub(u.smul(p)).smul(f),g=u.smul(h).sum(a.smul(p)).smul(f),x=new Ge(0,n[0].b-d.dot(i[t]),n[0].c-g.dot(i[t]),0);return[d,g,x]}allstickers(){let e=R0("allstickers");this.faces=KE(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 F=0;F<this.faces.length;F++)this.facecentermass[F]=this.faces[F].centermass();let t=[],n=[];for(let F of this.moveplanes){let C=F.makenormal(),j=!1;for(let B of n)C.sameplane(B.makenormal())&&(j=!0);j||(n.push(C),t.push([]))}for(let F of this.moveplanes2){let C=F.makenormal();for(let j=0;j<n.length;j++)if(C.sameplane(n[j])){t[j].push(F);break}}for(let F=0;F<t.length;F++){let C=t[F].map(B=>B.normalizeplane()),j=n[F];for(let B=0;B<C.length;B++)C[B].makenormal().dist(j)>qt&&(C[B]=C[B].smul(-1));C.sort((B,z)=>B.a-z.a),t[F]=C}this.moveplanesets=t,this.moveplanenormals=n;let i=t.map(F=>F.length);this.options.verbosity>0&&console.log("# Move plane sets: "+i);let o=[];for(let F=0;F<t.length;F++)o.push([]);for(let F of this.rotations){if(Math.abs(Math.abs(F.a)-1)<qt)continue;let C=F.makenormal();for(let j=0;j<t.length;j++)if(C.sameplane(n[j])){o[j].push(F);break}}this.moverotations=o;for(let F=0;F<o.length;F++){let C=o[F],j=C[0].makenormal();for(let B=0;B<C.length;B++)j.dist(C[B].makenormal())>qt&&(C[B]=C[B].smul(-1));C.sort((B,z)=>B.angle()-z.angle()),o[F][0].dot(n[F])<0&&C.reverse()}let s=o.map(F=>1+F.length);this.movesetorders=s;let a=[],l="?";for(let F=0;F<t.length;F++){let C=n[F],j=null,B=null;for(let z of this.geonormals){let O=C.dot(z[0]);Math.abs(O-1)<qt?(B=[z[1],z[2]],l=z[2]):Math.abs(O+1)<qt&&(j=[z[1],z[2]],l=z[2])}if(B===null||j===null)throw new Error("Saw positive or negative sides as null");a.push([B[0],B[1],j[0],j[1],1+t[F].length]),this.addNotationMapper==="NxNxNCubeMapper"&&l==="f"&&(this.notationMapper=new nf(1+t[F].length),this.addNotationMapper=""),this.addNotationMapper==="SkewbMapper"&&t[0].length===1&&(this.notationMapper=new of(this.swizzler),this.addNotationMapper=""),this.addNotationMapper==="PyraminxOrTetraminxMapper"&&(t[0].length===2&&t[0][0].a===.333333333333333&&t[0][1].a===1.66666666666667?(this.notationMapper=new xu(this.swizzler),this.addNotationMapper=""):(this.notationMapper=new rf(this.swizzler),this.addNotationMapper="")),this.addNotationMapper==="MegaminxMapper"&&l==="f"&&(1+t[F].length===3&&(this.notationMapper=new tf(this.notationMapper)),this.addNotationMapper=""),this.addNotationMapper==="FTOMapper"&&l==="f"&&(1+t[F].length===3&&(this.notationMapper=new ef(this.notationMapper,this.swizzler)),this.addNotationMapper="")}this.movesetgeos=a;let u=new Map,c=this.faces;for(let F=0;F<c.length;F++){let C=c[F],j=this.keyface(C);if(!u.get(j))u.set(j,[F]);else{let B=u.get(j);if(B.push(F),B.length===this.baseFaceCount){this.options.verbosity>0&&console.log("# Splitting core.");for(let z=0;z<B.length;z++){let O=j+" "+z;u.set(O,[B[z]])}}}}this.facelisthash=u,this.options.verbosity>0&&console.log("# Cubies: "+u.size);let f=[],h=[],p=[];for(let F of u.values())if(F.length!==this.baseFaceCount){if(F.length>1){let C=F.map(O=>c[O].centermass()),j=lf(C);for(let O=0;F.length>2;O++){let V=!1;for(let q=0;q<F.length;q++){let se=(q+1)%F.length;if(j.dot(C[q].cross(C[se]))<0){let he=C[q];C[q]=C[se],C[se]=he;let Y=F[q];F[q]=F[se],F[se]=Y,V=!0}}if(!V)break;if(O>1e3)throw new Error("Bad epsilon math; too close to border")}let B=0,z=F[B];for(let O=1;O<F.length;O++){let V=F[O];this.faceprecedence[this.getfaceindex(V)]<this.faceprecedence[this.getfaceindex(z)]&&(B=O,z=V)}if(B!==0){let O=F.slice();for(let V=0;V<F.length;V++)F[V]=O[(B+V)%F.length]}}for(let C=0;C<F.length;C++){let j=F[C];h[j]=f.length,p[j]=C}f.push(F)}this.cubies=f,this.facetocubie=h,this.facetoord=p;let d=["?","CENTERS","EDGES","CORNERS","C4RNER","C5RNER"],g=[],x=[0,0,0,0,0,0],y=[],m=[],b=0,w=[],D=[],R=[],L=[],T=F=>f[F].map(C=>this.getfaceindex(C)).join(" "),U=[];for(let F=0;F<f.length;F++){if(m[F])continue;let C=f[F];if(C.length===0)continue;let j={},B=0;R.push(0),U.push([]);let z=C.length,O=x[z]++,V=d[z];(V===void 0||z===this.baseFaceCount)&&(V="CORE"),V=V+(O===0?"":O+1),g[b]=V,y[b]=z;let q=[F],se=0;for(m[F]=!0;se<q.length;){let he=q[se++],Y=T(he);if((C.length>1||j[Y]===void 0)&&(j[Y]=B++),L[he]=j[Y],w[he]=b,U[b].push(he),D[he]=R[b]++,q.length<this.rotations.length){let X=this.facecentermass[f[he][0]];for(let ve of o){let pe=this.facetocubie[this.findface(X.rotatepoint(ve[0]))];m[pe]||(q.push(pe),m[pe]=!0)}}}b++}if(this.setReidOrder&&4<=this.stickersperface&&this.stickersperface<=9){let F=[["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"]],C={};for(let j of F)for(let B=0;B<j.length;B++){let z=0;for(let O=0;O<j[B].length;O++)z|=1<<j[B].charCodeAt(O)-65;C[z]=B}for(let j of U)for(let B of j){let z=0;for(let O of f[B])z|=1<<this.facenames[this.getfaceindex(O)][1].charCodeAt(0)-65;D[B]=C[z]}}if(this.cubiesetnums=w,this.cubieordnums=D,this.cubiesetnames=g,this.cubieords=R,this.orbitoris=y,this.cubievaluemap=L,this.cubiesetcubies=U,this.options.fixedPieceType!==null){for(let F=0;F<f.length;F++)if(this.options.fixedPieceType==="v"&&f[F].length>2||this.options.fixedPieceType==="e"&&f[F].length===2||this.options.fixedPieceType==="f"&&f[F].length===1){this.fixedCubie=F;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 "+R),T0(e)}unswizzle(e){let t=this.notationMapper.notationToInternal(e);return t===null?"":this.swizzler.unswizzle(t.family)}stringToBlockMove(e){let t=RegExp("^(([0-9]+)-)?([0-9]+)?([^0-9]+)([0-9]+'?)?$"),n=e.match(t);if(n===null)throw new Error("Bad move passed "+e);let i=n[4],o,s;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&&(s=parseInt(n[3],10));let a="1",l=1;return n[5]!==void 0&&(a=n[5],a[0]==="'"&&(a="-"+a.substring(1)),l=parseInt(a,10)),new E(new ze(i,s,o),l)}parseMove(e){let t=this.notationMapper.notationToInternal(e);if(t===null)throw new Error("Bad move "+e.family);e=t;let n=e.family,i=!1;if(n.endsWith("v")&&n[0]<="Z"){if(e.innerLayer!==void 0||e.outerLayer!==void 0)throw new Error("Cannot use a prefix with full cube rotations");n=n.slice(0,-1),i=!0}n.endsWith("w")&&n[0]<="Z"&&(n=n.slice(0,-1).toLowerCase());let o,s=-1,a=this.swizzler.unswizzle(n),l=!1;for(let f=0;f<this.movesetgeos.length;f++){let h=this.movesetgeos[f];a===h[0]&&(l=!0,o=h,s=f),a===h[2]&&(l=!1,o=h,s=f)}let u=1,c=1;if(n.toUpperCase()!==n&&(c=2),o===void 0)throw new Error("Bad grip in move "+e.family);if(e.outerLayer!==void 0&&(u=e.outerLayer),e.innerLayer!==void 0&&(e.outerLayer===void 0?(c=e.innerLayer,n<="Z"?u=c:u=1):c=e.innerLayer),u--,c--,i&&(u=0,c=this.moveplanesets[s].length),u<0||u>this.moveplanesets[s].length||c<0||c>this.moveplanesets[s].length)throw new Error("Bad slice spec "+u+" "+c+" vs "+this.moveplanesets[s].length);if(!JE&&u===0&&c===this.moveplanesets[s].length&&!i)throw new Error("! full puzzle rotations must be specified with v suffix.");return[void 0,s,u,c,l,e.amount]}parsemove(e){let t=this.parseMove(this.stringToBlockMove(e));return t[0]=e,t}genperms(){let e=R0("genperms");if(this.cmovesbyslice.length>0)return;let t=[];if(this.options.orientCenters){for(let n=0;n<this.cubies.length;n++)if(this.cubies[n].length===1){let i=this.cubies[n][0],o=this.getfaceindex(i);if(this.basefaces[o].centermass().dist(this.facecentermass[i])<qt){let s=this.basefaces[o].length;for(let a=1;a<s;a++)this.cubies[n].push(this.cubies[n][a-1]);this.duplicatedFaces[i]=s,this.duplicatedCubies[n]=s,this.orbitoris[this.cubiesetnums[n]]=s}}}for(let n=0;n<this.moveplanesets.length;n++){let i=this.moveplanesets[n],o=[],s=[i.length+1,0],a=1;for(;a*2<=i.length;)a*=2;for(let c=0;c<this.faces.length;c++){let f=0;if(i.length>0){let h=this.facecentermass[c].dot(i[0]);for(let p=a;p>0;p>>=1)f+p<=i.length&&h>i[f+p-1].a&&(f+=p);f=i.length-f}for(o.push(f);s.length<=f;)s.push(0);s[f]++}let l=new Array(s.length);for(let c=0;c<s.length;c++)l[c]=[];let u=[];for(let c=0;c<this.faces.length;c++){if(o[c]<0)continue;let f=[this.facetocubie[c],this.facetoord[c]],h=this.facecentermass[c],p=h,d=c,g=o[d];for(;;){o[d]=-1;let x=h.rotatepoint(this.moverotations[n][0]);if(x.dist(p)<qt)break;d=this.findface(x),f.push(this.facetocubie[d],this.facetoord[d]),h=x}if(f.length>2&&this.options.orientCenters&&(this.cubies[f[0]].length===1||this.duplicatedCubies[f[0]]>1)&&this.facecentermass[c].dist(this.basefaces[this.getfaceindex(c)].centermass())<qt){let x=this.faces[this.cubies[f[0]][0]];for(let y=0;y<f.length;y+=2){let m=this.faces[this.cubies[f[y]][0]],b=-1;for(let w=0;w<x.length;w++)if(m.get(w).dist(x.get(0))<qt){b=w;break}if(b<0)throw new Error("Couldn't find rotation of center faces; ignoring for now.");f[y+1]=b,x=x.rotate(this.moverotations[n][0])}}if(f.length===2&&this.options.orientCenters)for(let x=1;x<this.movesetorders[n];x++)g===0?f.push(f[0],x):f.push(f[0],(this.movesetorders[n]-x)%this.movesetorders[n]);if(f.length>2&&!u[f[0]]){if(f.length!==2*this.movesetorders[n])throw new Error("Bad length in perm gen");for(let x of f)l[g].push(x)}for(let x=0;x<f.length;x+=2)u[f[x]]=!0}for(let c=0;c<l.length;c++)l[c]=l[c].slice();t.push(l)}if(this.cmovesbyslice=t,this.options.moveList){let n=[];for(let i of this.options.moveList)n.push(this.parsemove(i));this.parsedmovelist=n}this.facelisthash.clear(),this.facecentermass=[],T0(e)}getboundarygeometry(){return{baseplanes:this.baseplanes,facenames:this.facenames,faceplanes:this.faceplanes,vertexnames:this.vertexnames,edgenames:this.edgenames,geonormals:this.geonormals}}getmovesets(e){let t=this.moveplanesets[e].length,n=[];if(this.parsedmovelist!==void 0)for(let i of this.parsedmovelist)i[1]===e&&(i[4]?n.push([i[2],i[3]]):n.push([t-i[3],t-i[2]]),n.push(i[5]));else if(this.options.vertexMoves&&!this.options.allMoves){let i=this.movesetgeos[e];if(i[1]!==i[3])for(let o=0;o<t;o++)i[1]!=="v"?(this.options.outerBlockMoves?n.push([o+1,t]):n.push([o+1]),n.push(1)):(this.options.outerBlockMoves?n.push([0,o]):n.push([o,o]),n.push(1))}else for(let i=0;i<=t;i++)!this.options.allMoves&&i+i===t||(this.options.outerBlockMoves?i+i>t?n.push([i,t]):n.push([0,i]):n.push([i,i]),n.push(1));if(this.fixedCubie>=0){let i=this.keyface3(this.faces[this.cubies[this.fixedCubie][0]])[e],o=[];for(let s=0;s<n.length;s+=2){let a=n[s];if(i>=a[0]&&i<=a[1])if(a[0]===0)a=[a[1]+1,t];else if(t===a[1])a=[0,a[0]-1];else throw Error("fixed cubie option would disconnect move");let l=!1;for(let u=0;u<o.length;u+=2)if(o[u][0]===a[0]&&o[u][1]===a[1]&&o[u+1]===n[s+1]){l=!0;break}l||(o.push(a),o.push(n[s+1]))}n=o}return n}graybyori(e){let t=this.cubies[e].length;return this.duplicatedCubies[e]&&(t=1),t===1&&(this.options.grayCenters||!this.options.includeCenterOrbits)||t===2&&(this.options.grayEdges||!this.options.includeEdgeOrbits)||t>2&&(this.options.grayCorners||!this.options.includeCornerOrbits)}skipbyori(e){let t=this.cubies[e].length;return this.duplicatedCubies[e]&&(t=1),t===1&&!this.options.includeCenterOrbits||t===2&&!this.options.includeEdgeOrbits||t>2&&!this.options.includeCornerOrbits}skipcubie(e){return this.skipbyori(e)}header(e){return e+ZE+`
|
|
11
11
|
`+e+`
|
|
12
|
-
`}writegap(){let e=this.getOrbitsDef(!1),t=[],n=[];for(let o=0;o<e.moveops.length;o++){let s="M_"+
|
|
12
|
+
`}writegap(){let e=this.getOrbitsDef(!1),t=[],n=[];for(let o=0;o<e.moveops.length;o++){let s="M_"+S0(this.notationMapper,e.movenames[o]),a=!1;s[s.length-1]==="'"&&(s=s.substring(0,s.length-1),a=!0),n.push(s),a?t.push(s+":="+e.moveops[o].toPerm().inv().toGap()+";"):t.push(s+":="+e.moveops[o].toPerm().toGap()+";")}t.push("Gen:=["),t.push(n.join(",")),t.push("];");let i=e.solved.identicalPieces();return t.push("ip:=["+i.map(o=>"["+o.map(s=>s+1).join(",")+"]").join(",")+"];"),t.push("# Size(Group(Gen));"),t.push("# Size(Stabilizer(Group(Gen), ip, OnTuplesSets));"),t.push(""),this.header("# ")+t.join(`
|
|
13
13
|
`)}writeksolve(e="PuzzleGeometryPuzzle"){let t=this.getOrbitsDef(!1);return this.header("# ")+t.toKsolve(e,this.notationMapper).join(`
|
|
14
|
-
`)}writekpuzzle(e=!0,t=!0){let n=this.getOrbitsDef(e,t),i=n.toKPuzzle(t);if(!i)throw new Error("Missing definition!");return i.moveNotation=new
|
|
14
|
+
`)}writekpuzzle(e=!0,t=!0){let n=this.getOrbitsDef(e,t),i=n.toKPuzzle(t);if(!i)throw new Error("Missing definition!");return i.moveNotation=new Ux(this,n),i}getMoveFromBits(e,t,n,i,o,s){let a=[],l=[],u=[];for(let h of this.cubieords)l.push(Hi(h)),u.push(eo(h));for(let h=e[0];h<=e[1];h++){let p=i[h];for(let d=0;d<p.length;d+=2*s){let g=p.slice(d,d+2*s),x=this.cubiesetnums[g[0]];for(let b=0;b<g.length;b+=2)g[b]=this.cubieordnums[g[b]];let y=2,m=3;n&&(y=g.length-2,m=g.length-1),l[x]===Hi(this.cubieords[x])&&(l[x]=l[x].slice(),this.orbitoris[x]>1&&!this.options.fixedOrientation&&(u[x]=u[x].slice()));for(let b=0;b<g.length;b+=2)l[x][g[(b+y)%g.length]]=g[b],this.orbitoris[x]>1&&!this.options.fixedOrientation&&(u[x][g[b]]=(g[(b+m)%g.length]-g[(b+1)%g.length]+2*this.orbitoris[x])%this.orbitoris[x])}}let c=new pr(Hi(24),eo(24),1);for(let h=0;h<this.cubiesetnames.length;h++)if(!(o&&!o[h]))if(this.orbitoris[h]===1||this.options.fixedOrientation)l[h]===Hi(c.perm.length)?(l[h]!==c.perm&&(c=new pr(l[h],u[h],1)),a.push(c)):a.push(new pr(l[h],u[h],1));else{let p=new Array(u[h].length);for(let d=0;d<l[h].length;d++)p[d]=u[h][l[h][d]];a.push(new pr(l[h],p,this.orbitoris[h]))}let f=new to(a);return t!==1&&(f=f.mulScalar(t)),f}omitSet(e){for(let t of this.options.excludeOrbits)if(t===e)return!0;return!1}diffmvsets(e,t,n,i){for(let o=0;o<e.length;o+=2){let s=!1;for(let a=0;!s&&a<t.length;a+=2)i?e[o][0]+t[a][1]===n&&e[o][1]+t[a][0]===n&&e[o+1]===t[a+1]&&(s=!0):e[o][0]===t[a][0]&&e[o][1]===t[a][1]&&e[o+1]===t[a+1]&&(s=!0);if(!s)return!0}return!1}getOrbitsDef(e,t=!0){let n=[];if(e)for(let h=0;h<this.cubiesetnames.length;h++)n.push(1);let i=[],o=[],s=[],a=[];for(let h=0;h<this.moveplanesets.length;h++){let p=this.getmovesets(h);s.push(p),this.options.addRotations?a.push(1):a.push(0)}if(this.options.moveList&&this.options.addRotations){for(let h=0;h<this.moverotations.length;h++)a[h]=0;for(let h=0;h<this.moveplanesets.length;h++)for(let p=0;p<this.moverotations.length;p++){let d=this.moveplanenormals[h];for(let g=1;g*2<=this.movesetorders[p];g++){if(d=d.rotatepoint(this.moverotations[p][0]),a[p]&g)continue;let x=-1,y=!1;for(let b=0;b<this.moveplanenormals.length;b++)if(d.dist(this.moveplanenormals[b])<qt){x=b;break}else if(d.dist(this.moveplanenormals[b].smul(-1))<qt){x=b,y=!0;break}if(x<0)throw new Error("Could not find rotation");let m=s[x];(m.length!==s[h].length||this.moveplanesets[h].length!==this.moveplanesets[x].length||this.diffmvsets(m,s[h],this.moveplanesets[x].length,y))&&(a[p]|=g)}}for(let h=0;h<this.moverotations.length;h++)if(a[h]===0)a[h]=1;else if(a[h]===1)this.movesetorders[h]>3?a[h]=2:a[h]=0;else if(a[h]===3)a[h]=0;else throw new Error("Impossible addrot val")}for(let h=0;h<this.moveplanesets.length;h++)a[h]!==0&&(s[h].push([0,this.moveplanesets[h].length]),s[h].push(a[h]));for(let h=0;h<this.moveplanesets.length;h++){let p=s[h],d=this.movesetorders[h];for(let y=0;y<p.length;y+=2)for(let m=0;m<y;m+=2)if(p[y]===p[m]&&p[y+1]===p[m+1])throw new Error("Redundant moves in moveset.");let g=[];for(let y=0;y<p.length;y+=2)for(let m=p[y][0];m<=p[y][1];m++)g[m]=1;let x=this.cmovesbyslice[h];for(let y=0;y<x.length;y++){if(g[y]!==1)continue;let m=x[y];for(let b=0;b<m.length;b+=2*d){if(this.skipcubie(m[b]))continue;let w=this.cubiesetnums[m[b]];n[w]=1}}}for(let h=0;h<this.cubiesetnames.length;h++)if(!!n[h]){if(this.omitSet(this.cubiesetnames[h])){n[h]=0;continue}i.push(this.cubiesetnames[h]),o.push(new bu(this.cubieords[h],this.options.fixedOrientation?1:this.orbitoris[h]))}let l=[];for(let h=0;h<this.cubiesetnames.length;h++){if(!n[h]||this.omitSet(this.cubiesetnames[h]))continue;let p=[],d=[];for(let g=0;g<this.cubieords[h];g++){if(e)p.push(g);else{let x=this.cubiesetcubies[h][g];p.push(this.cubievaluemap[x])}d.push(0)}l.push(new pr(p,d,this.options.fixedOrientation?1:this.orbitoris[h]))}let u=[],c=[];if(t)for(let h=0;h<this.moveplanesets.length;h++){let d=this.moveplanesets[h].length,g=s[h],x=this.movesetgeos[h];for(let y=0;y<g.length;y+=2){let m=g[y],b=iM(x,m,d),w=b[0],D=b[1];g[y+1]===1?u.push(w):u.push(w+g[y+1]);let R=this.getMoveFromBits(m,g[y+1],D,this.cmovesbyslice[h],n,this.movesetorders[h]);c.push(R)}}let f=new ya(i,o,new va(l),u,c);return this.options.optimizeOrbits&&(f=f.optimize()),this.options.scrambleAmount!==0&&f.scramble(this.options.scrambleAmount),f}getMovesAsPerms(){return this.getOrbitsDef(!1).moveops.map(e=>e.toPerm())}showcanon(e){Lx(this.getOrbitsDef(!1),e)}getsolved(){let e=[];for(let t=0;t<this.baseFaceCount;t++)for(let n=0;n<this.stickersperface;n++)e.push(t);return new fi(e)}getOrientationRotation(e){let[t,[n,i,o]]=e[0],s=new Ge(0,n,-i,o),[a,[l,u,c]]=e[1],f=new Ge(0,l,-u,c),h=null,p=null,d=this.swizzler.unswizzle(t),g=this.swizzler.unswizzle(a);for(let b of this.geonormals)d===b[1]&&(h=b[0]),g===b[1]&&(p=b[0]);if(!h)throw new Error("Could not find feature "+t);if(!p)throw new Error("Could not find feature "+a);let x=h.pointrotation(s);return p.rotatepoint(x).unproject(s).pointrotation(f.unproject(s)).mul(x)}getInitial3DRotation(){let e=this.baseFaceCount,t=null;if(this.options.puzzleOrientation?t=this.options.puzzleOrientation:this.options.puzzleOrientations&&(t=this.options.puzzleOrientations[e]),t||(t=nM()[e]),!t)throw new Error("No default orientation?");return this.getOrientationRotation(t)}generate2dmapping(e=800,t=500,n=10,i=!1,o=.92){e-=2*n,t-=2*n;function s(B,z){let O=B[1][0]-B[0][0],V=B[1][1]-B[0][1],q=2*Math.PI/z,se=Math.cos(q),he=Math.sin(q);for(let Y=2;Y<z;Y++){let X=O*se+V*he;V=V*se-O*he,O=X,B.push([B[Y-1][0]+O,B[Y-1][1]+V])}}this.genperms();let u=this.getboundarygeometry().facenames[0][0].length,c=this.net;if(c===null)throw new Error("No net?");let f={},h=0,p=0,d=1,g=0;f[c[0][0]]=[[1,0],[0,0]],s(f[c[0][0]],u);for(let B of c){let z=B[0];if(!f[z])throw new Error("Bad edge description; first edge not connected.");for(let O=1;O<B.length;O++){let V=B[O];V===""||f[V]||(f[V]=[f[z][O%u],f[z][(O+u-1)%u]],s(f[V],u))}}for(let B in f){let z=f[B];for(let O of z)h=Math.min(h,O[0]),d=Math.max(d,O[0]),p=Math.min(p,O[1]),g=Math.max(g,O[1])}let x=Math.min(e/(d-h),t/(g-p)),y=.5*(e-x*(d+h)),m=.5*(t-x*(g+p)),b={},w=this.getboundarygeometry(),D={},R=[[x+y,m],[y,m]];D[c[0][0]]=R,s(D[c[0][0]],u),b[this.facenames[0][1]]=this.project2d(0,0,[new Ge(0,R[0][0],R[0][1],0),new Ge(0,R[1][0],R[1][1],0)]);let L=[];L[0]=0;for(let B of c){let z=B[0];if(!D[z])throw new Error("Bad edge description; first edge not connected.");let O=-1;for(let q=0;q<w.facenames.length;q++)if(z===w.facenames[q][1]){O=q;break}if(O<0)throw new Error("Could not find first face name "+z);let V=w.facenames[O][0];for(let q=1;q<B.length;q++){let se=B[q];if(se===""||D[se])continue;D[se]=[D[z][q%u],D[z][(q+u-1)%u]],s(D[se],u);let he=L[O],Y=V[(he+q)%u].sum(V[(he+q+u-1)%u]).smul(.5),X=ff(w.edgenames,Y),ve=w.edgenames[X][1],pe=rM(ve,this.facenames),Le=pe[z===pe[0]?1:0],Ie=-1;for(let Z=0;Z<w.facenames.length;Z++)if(Le===w.facenames[Z][1]){Ie=Z;break}if(Ie<0)throw new Error("Could not find second face name");let P=w.facenames[Ie][0];for(let Z=0;Z<P.length;Z++)if(P[Z].sum(P[(Z+1)%u]).smul(.5).dist(Y)<=qt){let ne=D[z][(q+u-1)%u],fe=D[z][q%u];L[Ie]=Z,b[Le]=this.project2d(Ie,Z,[new Ge(0,fe[0],fe[1],0),new Ge(0,ne[0],ne[1],0)]);break}}}let T=0,U=0,F=this.getInitial3DRotation();for(let B of this.faces){i&&(B=B.rotate(F));for(let z=0;z<B.length;z++)T=Math.max(T,Math.abs(B.get(z).b)),U=Math.max(U,Math.abs(B.get(z).c))}let C=Math.min(t/U/2,(e-n)/T/4);return(B,z)=>{if(i){z=z.rotatepoint(F);let O=.5*n+.25*e,V=this.baseplanes[B].rotateplane(F).d<0?1:-1;return[n+e*.5+V*(O-z.b*C),n+t*.5+z.c*C]}else{let O=b[this.facenames[B][1]];return[n+o*z.dot(O[0])+O[2].b,n+t-o*z.dot(O[1])-O[2].c]}}}generatesvg(e=800,t=500,n=10,i=!1){let o=this.generate2dmapping(e,t,n,i);function s(h,p,d){return'<polygon id="'+h+'" class="sticker" style="fill: '+d+'" points="'+p.map(g=>g[0]+" "+g[1]).join(" ")+`"/>
|
|
15
15
|
`}let a=this.getsolved(),l=[],u=[];for(let h=0;h<this.baseFaceCount;h++)l[h]=this.colors[this.facenames[h][1]];for(let h=0;h<this.faces.length;h++){let p=this.faces[h],d=Math.floor(h/this.stickersperface),g=[];for(let x=0;x<p.length;x++)g.push(o(d,p.get(x)));u.push(g)}let c=[];for(let h=0;h<this.baseFaceCount;h++){c.push("<g>"),c.push("<title>"+this.facenames[h][1]+`</title>
|
|
16
16
|
`);for(let p=0;p<this.stickersperface;p++){let d=h*this.stickersperface+p,g=this.facetocubie[d],x=this.facetoord[d],y=this.cubiesetnums[g],m=this.cubieordnums[g],b=this.graybyori(g)?"#808080":l[a.p[d]],w=this.cubiesetnames[y]+"-l"+m+"-o"+x;if(c.push(s(w,u[d],b)),this.duplicatedFaces[d])for(let D=1;D<this.duplicatedFaces[d];D++)w=this.cubiesetnames[y]+"-l"+m+"-o"+D,c.push(s(w,u[d],b))}c.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">
|
|
17
17
|
<style type="text/css"><![CDATA[.sticker { stroke: #000000; stroke-width: 1px; }]]></style>
|
|
18
|
-
`+c.join("")+"</svg>"}get3d(e){let t=[],n=this.getInitial3DRotation(),i=[],o=.52*this.basefaces[0].get(0).len();for(let u=0;u<this.basefaces.length;u++){let c=this.basefaces[u].rotate(n),f=this.facenames[u][1];i.push({coords:
|
|
18
|
+
`+c.join("")+"</svg>"}get3d(e){let t=[],n=this.getInitial3DRotation(),i=[],o=.52*this.basefaces[0].get(0).len();for(let u=0;u<this.basefaces.length;u++){let c=this.basefaces[u].rotate(n),f=this.facenames[u][1];i.push({coords:_0(c,o),name:f})}for(let u=0;u<this.faces.length;u++){let c=Math.floor(u/this.stickersperface),f=this.facetocubie[u],h=this.facetoord[u],p=this.cubiesetnums[f],d=this.cubieordnums[f],g=this.graybyori(f)?"#808080":this.colors[this.facenames[c][1]];e?.stickerColors&&(g=e.stickerColors[u]);let x=this.faces[u].rotate(n);t.push({coords:_0(x,o),color:g,orbit:this.cubiesetnames[p],ord:d,ori:h,face:c});let y=x;if(this.duplicatedFaces[u]){let m=y.length/this.duplicatedFaces[u];for(let b=1;b<this.duplicatedFaces[u];b++){for(let w=0;w<m;w++)y=y.rotateforward();t.push({coords:_0(y,o),color:g,orbit:this.cubiesetnames[p],ord:d,ori:b,face:c,isDup:!0})}}}let s=[];for(let u=0;u<this.movesetgeos.length;u++){let c=this.movesetgeos[u],f=this.movesetorders[u];for(let h of this.geonormals)c[0]===h[1]&&c[1]===h[2]&&(s.push([pf(h[0].rotatepoint(n),1),c[0],f]),s.push([pf(h[0].rotatepoint(n).smul(-1),1),c[2],f]))}let a=this.generate2dmapping(2880,2160,0,!1,1),l=function(){let u=n.invrot();return function(c,f){let h=new Ge(0,f[0]*o,-f[1]*o,f[2]*o);h=h.rotatepoint(u);let p=a(c,h);return p[0]/=2880,p[1]=1-p[1]/2160,p}}().bind(this);return{stickers:t,faces:i,axis:s,unswizzle:this.unswizzle.bind(this),notationMapper:this.notationMapper,textureMapper:{getuv:l}}}getGeoNormal(e){let t=this.getInitial3DRotation(),n=this.swizzler.unswizzle(e);for(let i of this.geonormals)if(n===i[1]){let o=pf(i[0].rotatepoint(t),1);return Math.abs(o[0])<qt&&Math.abs(o[2])<qt&&(o[0]=0,o[2]=1e-6),o}}getfaceindex(e){let t=this.stickersperface;return Math.floor(e/t)}textForTwizzleExplorer(){return`Faces ${this.baseplanerot.length}
|
|
19
19
|
Stickers per face ${this.stickersperface}
|
|
20
20
|
Short edge ${this.shortedge}
|
|
21
21
|
Cubies ${this.cubies.length}
|
|
22
22
|
Edge distance ${this.edgedistance}
|
|
23
|
-
Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbitsDef(!1).reassemblySize();e(`Reassembly size is ${n}`);let i=hf(this.getMovesAsPerms(),e),o=n/i;e(`Ratio is ${o}`)}},Ix=class{constructor(e,t){this.pg=e;this.cache={};this.orbitNames=t.orbitnames}lookupMove(e){let t=this.moveToKeyString(e);if(t in this.cache)return this.cache[t];let n=this.pg.parseMove(e);if(this.pg.parsedmovelist){let a=!1;for(let l of this.pg.parsedmovelist)l[1]===n[1]&&l[2]===n[2]&&l[3]===n[3]&&l[4]===n[4]&&(a=!0);if(!a)return}let i=[n[2],n[3]];if(!n[4]){let a=this.pg.moveplanesets[n[1]].length;i=[a-n[3],a-n[2]]}let o=this.pg.getMoveFromBits(i,n[5],!n[4],this.pg.cmovesbyslice[n[1]],void 0,this.pg.movesetorders[n[1]]),s=ya.transformToKPuzzle(this.orbitNames,o);return this.cache[t]=s,s}moveToKeyString(e){let t="";return e.outerLayer&&(t=t+e.outerLayer+","),e.innerLayer&&(t=t+e.innerLayer+","),t=t+e.family+","+e.amount,t}}});var Lu={};Rt(Lu,{PuzzleGeometry:()=>df,Quat:()=>Ge,getPuzzleGeometryByDesc:()=>T0,getPuzzleGeometryByName:()=>zx,getpuzzle:()=>Bx,getpuzzles:()=>kx,parseOptions:()=>xx,parsePuzzleDescription:()=>wu,schreierSims:()=>hf});var mf=oe(()=>{y0();g0();uf();E0()});async function _0(r){return(await Promise.resolve().then(()=>(mf(),Lu))).getPuzzleGeometryByDesc(r,{allMoves:!0,orientCenters:!0,addRotations:!0})}async function oM(r){return(await _0(r)).writekpuzzle(!0)}function gf(r,e){let t=sM++,n={id:`custom-${t}`,fullName:e?.fullName??`Custom Puzzle (instance #${t})`,def:async()=>oM(r),svg:async()=>(await _0(r)).generatesvg(),pg:async()=>_0(r)};return e?.inventedBy&&(n.inventedBy=e.inventedBy),e?.inventionYear&&(n.inventionYear=e.inventionYear),n}var sM,Ux=oe(()=>{sM=1});function Au(r,e,t,n,i){let s=r.orbits[e].pieces[t];if(s===null)return pi;let a=s.facelets[n];return a===null?pi:typeof a=="string"?a:i?a.hintAppearance??a.appearance:a.appearance}function gM(r){switch(r){case me.Regular:return aM;case me.Dim:return pM;case me.Ignored:return lM;case me.OrientationStickers:return uM;case me.Invisible:return cM;case me.IgnoreNonPrimary:return hM;case me.PermuteNonPrimary:return fM;case me.Ignoriented:return dM;case me.OrientationWithoutPermutation:return mM}}var me,wa,pi,dn,ba,yf,Zo,aM,lM,uM,cM,hM,fM,pM,dM,mM,Du,Eu,Mu=oe(()=>{Oe();Oe();Ht();(function(u){u.Regular="Regular",u.Dim="Dim",u.Ignored="Ignored",u.OrientationStickers="OrientationStickers",u.Invisible="Invisible",u.Ignoriented="Ignoriented",u.IgnoreNonPrimary="IgnoreNonPrimary",u.PermuteNonPrimary="PermuteNonPrimary",u.OrientationWithoutPermutation="OrientationWithoutPermutation"})(me||(me={}));wa=class{constructor(e,t){this.stickerings=new Map;for(let[n,i]of Object.entries(e.orbits))this.stickerings.set(n,new Array(i.numPieces).fill(t))}},pi="regular",dn="ignored",ba="oriented",yf="invisible",Zo="dim",aM={facelets:[pi,pi,pi,pi,pi]},lM={facelets:[dn,dn,dn,dn,dn]},uM={facelets:[ba,ba,ba,ba,ba]},cM={facelets:[yf,yf,yf,yf]},hM={facelets:[pi,dn,dn,dn,dn]},fM={facelets:[Zo,pi,pi,pi,pi]},pM={facelets:[Zo,Zo,Zo,Zo,Zo]},dM={facelets:[Zo,dn,dn,dn,dn]},mM={facelets:[ba,dn,dn,dn,dn]};Du=class extends wa{constructor(e){super(e,me.Regular)}set(e,t){for(let[n,i]of this.stickerings.entries())for(let o=0;o<i.length;o++)e.stickerings.get(n)[o]&&(i[o]=t);return this}toAppearance(){let e={orbits:{}};for(let[t,n]of this.stickerings.entries()){let i=[],o={pieces:i};e.orbits[t]=o;for(let s of n)i.push(gM(s))}return e}},Eu=class{constructor(e){this.def=e}and(e){let t=new wa(this.def,!1);for(let[n,i]of Object.entries(this.def.orbits)){e:for(let o=0;o<i.numPieces;o++){t.stickerings.get(n)[o]=!0;for(let s of e)if(!s.stickerings.get(n)[o]){t.stickerings.get(n)[o]=!1;continue e}}}return t}or(e){let t=new wa(this.def,!1);for(let[n,i]of Object.entries(this.def.orbits)){e:for(let o=0;o<i.numPieces;o++){t.stickerings.get(n)[o]=!1;for(let s of e)if(s.stickerings.get(n)[o]){t.stickerings.get(n)[o]=!0;continue e}}}return t}not(e){let t=new wa(this.def,!1);for(let[n,i]of Object.entries(this.def.orbits))for(let o=0;o<i.numPieces;o++)t.stickerings.get(n)[o]=!e.stickerings.get(n)[o];return t}all(){return this.and(this.moves([]))}move(e){let t=Ai(this.def,Wn(e,E)?e:E.fromString(e)),n=new wa(this.def,!1);for(let[i,o]of Object.entries(this.def.orbits))for(let s=0;s<o.numPieces;s++)(t[i].permutation[s]!==s||t[i].orientation[s]!==0)&&(n.stickerings.get(i)[s]=!0);return n}moves(e){return e.map(t=>this.move(t))}}});function yM(r){(async()=>{Nx=r;let e=Array.from(document.body.querySelectorAll("twisty-player"));console.log(`Setting the custom stickering for ${e.length} players!`);let t=[];for(let n of e)t.push((async()=>{let i=await n.experimentalModel.stickeringProp.get();n.experimentalStickering=i==="experimental-global-custom-1"?"experimental-global-custom-2":"experimental-global-custom-1"})());await Promise.all(t),console.log("Success!")})()}function Ox(r,e){Nx(r,e)}var Nx,Gx=oe(()=>{Mu();Nx=()=>{};typeof location!="undefined"&&new URL(location.href).searchParams.get("global-custom-stickerer")==="true"&&(window.setGlobalCustomStickerer=yM,window.PieceStickering=me,console.log("Global custom stickerer enabled! (using: global-custom-stickerer=true)"),console.log("Look here for inspiration:","https://github.com/cubing/cubing.js/blob/81b5cab3e27d8defb39dd1e0a10bc9e8ba894d26/src/cubing/puzzles/stickerings/cube-stickerings.ts#L67"))});async function Hn(r,e){let t=await r.def(),n=new Du(t),i=new Eu(t),o=()=>i.move("U"),s=()=>i.or(i.moves(["U","D"])),a=()=>i.not(s()),l=()=>i.or(i.moves(["L","R"])),u=()=>i.not(l()),c=()=>i.or(i.moves(["F","B"])),f=()=>i.not(c()),h=()=>i.not(o()),p=()=>i.and([o(),u(),f()]),d=()=>i.and([i.and(i.moves(["F","R"])),i.not(s())]),g=()=>i.and(i.moves(["D","R","F"])),x=()=>i.or([g(),d()]),y=()=>i.or([i.and([u(),a()]),i.and([u(),f()]),i.and([a(),f()])]),m=()=>i.or([i.and([u(),s(),c()]),i.and([a(),l(),c()]),i.and([f(),s(),l()])]),b=()=>i.not(i.or([y(),m()])),w=()=>i.or([u(),i.and([o(),m()])]);function D(){n.set(h(),me.Dim)}function R(){n.set(o(),me.PermuteNonPrimary),n.set(p(),me.Dim)}function L(){n.set(o(),me.IgnoreNonPrimary),n.set(p(),me.Regular)}function T(){n.set(o(),me.Ignoriented),n.set(p(),me.Dim)}switch(e){case"full":break;case"PLL":D(),R();break;case"CLS":D(),n.set(i.and(i.moves(["D","R","F"])),me.Regular),n.set(o(),me.Ignoriented),n.set(i.and([o(),b()]),me.IgnoreNonPrimary);break;case"OLL":D(),L();break;case"COLL":D(),R(),n.set(i.and([o(),b()]),me.Regular);break;case"OCLL":D(),T(),n.set(i.and([o(),b()]),me.IgnoreNonPrimary);break;case"CLL":D(),n.set(i.not(i.and([b(),o()])),me.Dim);break;case"ELL":D(),n.set(o(),me.Dim),n.set(i.and([o(),m()]),me.Regular);break;case"ELS":D(),L(),n.set(i.and([o(),b()]),me.Ignored),n.set(d(),me.Regular),n.set(g(),me.Ignored);break;case"LL":D();break;case"F2L":n.set(o(),me.Ignored);break;case"ZBLL":D(),n.set(o(),me.PermuteNonPrimary),n.set(p(),me.Dim),n.set(i.and([o(),b()]),me.Regular);break;case"ZBLS":D(),n.set(x(),me.Regular),L(),n.set(i.and([o(),b()]),me.Ignored);break;case"WVLS":case"VLS":D(),n.set(x(),me.Regular),L();break;case"LS":D(),n.set(x(),me.Regular),n.set(o(),me.Ignored),n.set(p(),me.Dim);break;case"EO":n.set(b(),me.Ignored),n.set(m(),me.OrientationWithoutPermutation);break;case"CMLL":n.set(h(),me.Dim),n.set(w(),me.Ignored),n.set(i.and([o(),b()]),me.Regular);break;case"L6E":n.set(i.not(w()),me.Dim);break;case"L6EO":n.set(i.not(w()),me.Dim),n.set(w(),me.OrientationWithoutPermutation),n.set(i.and([y(),s()]),me.OrientationStickers);break;case"Daisy":n.set(i.all(),me.Ignored),n.set(y(),me.Dim),n.set(i.and([i.move("D"),y()]),me.Regular),n.set(i.and([i.move("U"),m()]),me.IgnoreNonPrimary);break;case"Cross":n.set(i.all(),me.Ignored),n.set(y(),me.Dim),n.set(i.and([i.move("D"),y()]),me.Regular),n.set(i.and([i.move("D"),m()]),me.Regular);break;case"2x2x2":n.set(i.or(i.moves(["U","F","R"])),me.Ignored),n.set(i.and([i.or(i.moves(["U","F","R"])),y()]),me.Dim);break;case"2x2x3":n.set(i.all(),me.Dim),n.set(i.or(i.moves(["U","F","R"])),me.Ignored),n.set(i.and([i.or(i.moves(["U","F","R"])),y()]),me.Dim),n.set(i.and([i.move("F"),i.not(i.or(i.moves(["U","R"])))]),me.Regular);break;case"Void Cube":n.set(y(),me.Invisible);break;case"picture":case"invisible":n.set(i.all(),me.Invisible);break;case"centers-only":n.set(i.not(y()),me.Ignored);break;case"experimental-global-custom-1":case"experimental-global-custom-2":Ox(n,i);break;default:console.warn(`Unsupported stickering for ${r.id}: ${e}. Setting all pieces to dim.`),n.set(i.and(i.moves([])),me.Dim)}return n.toAppearance()}async function Sa(){return["full","PLL","CLS","OLL","COLL","OCLL","ELL","ELS","LL","F2L","ZBLL","ZBLS","WVLS","VLS","LS","EO","CMLL","L6E","L6EO","Daisy","Cross","2x2x2","2x2x3","Void Cube","picture","invisible","centers-only","experimental-global-custom-1","experimental-global-custom-2"]}var La=oe(()=>{Mu();Gx()});async function di(r){return(await Promise.resolve().then(()=>(mf(),Lu))).getPuzzleGeometryByName(r,{allMoves:!0,orientCenters:!0,addRotations:!0})}async function Ru(r){return(await di(r)).writekpuzzle(!0)}function Jo(r,e,t){let n={id:r,fullName:e,def:async()=>Ru(r),svg:async()=>(await di(r)).generatesvg(),pg:async()=>di(r)};return t?.inventedBy&&(n.inventedBy=t.inventedBy),t?.inventionYear&&(n.inventionYear=t.inventionYear),n}function Aa(r,e,t){let n=Jo(r,e,t);return n.appearance=Hn.bind(Hn,n),n.stickerings=Sa,n}var $o=oe(()=>{La()});var Wx={};Rt(Wx,{cube2x2x2KPuzzle:()=>qi});var qi,Vx=oe(()=>{qi={name:"2x2x2",orbits:{CORNERS:{numPieces:8,orientations:3}},startPieces:{CORNERS:{permutation:[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]}}}};qi.moves.Rv=qi.moves.x;qi.moves.Uv=qi.moves.y;qi.moves.Fv=qi.moves.z;qi.moves.Lv={CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]}};qi.moves.Dv={CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]}};qi.moves.Bv={CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]}}});var Hx={};Rt(Hx,{default:()=>vM});var vM,qx=oe(()=>{vM=`<?xml version="1.0" encoding="UTF-8"?>
|
|
23
|
+
Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbitsDef(!1).reassemblySize();e(`Reassembly size is ${n}`);let i=hf(this.getMovesAsPerms(),e),o=n/i;e(`Ratio is ${o}`)}},Ux=class{constructor(e,t){this.pg=e;this.cache={};this.orbitNames=t.orbitnames}lookupMove(e){let t=this.moveToKeyString(e);if(t in this.cache)return this.cache[t];let n=this.pg.parseMove(e);if(this.pg.parsedmovelist){let a=!1;for(let l of this.pg.parsedmovelist)l[1]===n[1]&&l[2]===n[2]&&l[3]===n[3]&&l[4]===n[4]&&(a=!0);if(!a)return}let i=[n[2],n[3]];if(!n[4]){let a=this.pg.moveplanesets[n[1]].length;i=[a-n[3],a-n[2]]}let o=this.pg.getMoveFromBits(i,n[5],!n[4],this.pg.cmovesbyslice[n[1]],void 0,this.pg.movesetorders[n[1]]),s=ya.transformToKPuzzle(this.orbitNames,o);return this.cache[t]=s,s}moveToKeyString(e){let t="";return e.outerLayer&&(t=t+e.outerLayer+","),e.innerLayer&&(t=t+e.innerLayer+","),t=t+e.family+","+e.amount,t}}});var Lu={};_t(Lu,{PuzzleGeometry:()=>df,Quat:()=>Ge,getPuzzleGeometryByDesc:()=>F0,getPuzzleGeometryByName:()=>Ix,getpuzzle:()=>zx,getpuzzles:()=>Bx,parseOptions:()=>wx,parsePuzzleDescription:()=>wu,schreierSims:()=>hf});var mf=oe(()=>{v0();y0();uf();M0()});async function C0(r){return(await Promise.resolve().then(()=>(mf(),Lu))).getPuzzleGeometryByDesc(r,{allMoves:!0,orientCenters:!0,addRotations:!0})}async function oM(r){return(await C0(r)).writekpuzzle(!0)}function gf(r,e){let t=sM++,n={id:`custom-${t}`,fullName:e?.fullName??`Custom Puzzle (instance #${t})`,def:async()=>oM(r),svg:async()=>(await C0(r)).generatesvg(),pg:async()=>C0(r)};return e?.inventedBy&&(n.inventedBy=e.inventedBy),e?.inventionYear&&(n.inventionYear=e.inventionYear),n}var sM,Nx=oe(()=>{sM=1});function Au(r,e,t,n,i){let s=r.orbits[e].pieces[t];if(s===null)return pi;let a=s.facelets[n];return a===null?pi:typeof a=="string"?a:i?a.hintAppearance??a.appearance:a.appearance}function gM(r){switch(r){case me.Regular:return aM;case me.Dim:return pM;case me.Ignored:return lM;case me.OrientationStickers:return uM;case me.Invisible:return cM;case me.IgnoreNonPrimary:return hM;case me.PermuteNonPrimary:return fM;case me.Ignoriented:return dM;case me.OrientationWithoutPermutation:return mM}}var me,wa,pi,dn,ba,yf,Zo,aM,lM,uM,cM,hM,fM,pM,dM,mM,Du,Eu,Mu=oe(()=>{Oe();Oe();Ht();(function(u){u.Regular="Regular",u.Dim="Dim",u.Ignored="Ignored",u.OrientationStickers="OrientationStickers",u.Invisible="Invisible",u.Ignoriented="Ignoriented",u.IgnoreNonPrimary="IgnoreNonPrimary",u.PermuteNonPrimary="PermuteNonPrimary",u.OrientationWithoutPermutation="OrientationWithoutPermutation"})(me||(me={}));wa=class{constructor(e,t){this.stickerings=new Map;for(let[n,i]of Object.entries(e.orbits))this.stickerings.set(n,new Array(i.numPieces).fill(t))}},pi="regular",dn="ignored",ba="oriented",yf="invisible",Zo="dim",aM={facelets:[pi,pi,pi,pi,pi]},lM={facelets:[dn,dn,dn,dn,dn]},uM={facelets:[ba,ba,ba,ba,ba]},cM={facelets:[yf,yf,yf,yf]},hM={facelets:[pi,dn,dn,dn,dn]},fM={facelets:[Zo,pi,pi,pi,pi]},pM={facelets:[Zo,Zo,Zo,Zo,Zo]},dM={facelets:[Zo,dn,dn,dn,dn]},mM={facelets:[ba,dn,dn,dn,dn]};Du=class extends wa{constructor(e){super(e,me.Regular)}set(e,t){for(let[n,i]of this.stickerings.entries())for(let o=0;o<i.length;o++)e.stickerings.get(n)[o]&&(i[o]=t);return this}toAppearance(){let e={orbits:{}};for(let[t,n]of this.stickerings.entries()){let i=[],o={pieces:i};e.orbits[t]=o;for(let s of n)i.push(gM(s))}return e}},Eu=class{constructor(e){this.def=e}and(e){let t=new wa(this.def,!1);for(let[n,i]of Object.entries(this.def.orbits)){e:for(let o=0;o<i.numPieces;o++){t.stickerings.get(n)[o]=!0;for(let s of e)if(!s.stickerings.get(n)[o]){t.stickerings.get(n)[o]=!1;continue e}}}return t}or(e){let t=new wa(this.def,!1);for(let[n,i]of Object.entries(this.def.orbits)){e:for(let o=0;o<i.numPieces;o++){t.stickerings.get(n)[o]=!1;for(let s of e)if(s.stickerings.get(n)[o]){t.stickerings.get(n)[o]=!0;continue e}}}return t}not(e){let t=new wa(this.def,!1);for(let[n,i]of Object.entries(this.def.orbits))for(let o=0;o<i.numPieces;o++)t.stickerings.get(n)[o]=!e.stickerings.get(n)[o];return t}all(){return this.and(this.moves([]))}move(e){let t=Ai(this.def,Wn(e,E)?e:E.fromString(e)),n=new wa(this.def,!1);for(let[i,o]of Object.entries(this.def.orbits))for(let s=0;s<o.numPieces;s++)(t[i].permutation[s]!==s||t[i].orientation[s]!==0)&&(n.stickerings.get(i)[s]=!0);return n}moves(e){return e.map(t=>this.move(t))}}});function yM(r){(async()=>{Ox=r;let e=Array.from(document.body.querySelectorAll("twisty-player"));console.log(`Setting the custom stickering for ${e.length} players!`);let t=[];for(let n of e)t.push((async()=>{let i=await n.experimentalModel.stickeringProp.get();n.experimentalStickering=i==="experimental-global-custom-1"?"experimental-global-custom-2":"experimental-global-custom-1"})());await Promise.all(t),console.log("Success!")})()}function Gx(r,e){Ox(r,e)}var Ox,Wx=oe(()=>{Mu();Ox=()=>{};typeof location!="undefined"&&new URL(location.href).searchParams.get("global-custom-stickerer")==="true"&&(window.setGlobalCustomStickerer=yM,window.PieceStickering=me,console.log("Global custom stickerer enabled! (using: global-custom-stickerer=true)"),console.log("Look here for inspiration:","https://github.com/cubing/cubing.js/blob/81b5cab3e27d8defb39dd1e0a10bc9e8ba894d26/src/cubing/puzzles/stickerings/cube-stickerings.ts#L67"))});async function Hn(r,e){let t=await r.def(),n=new Du(t),i=new Eu(t),o=()=>i.move("U"),s=()=>i.or(i.moves(["U","D"])),a=()=>i.not(s()),l=()=>i.or(i.moves(["L","R"])),u=()=>i.not(l()),c=()=>i.or(i.moves(["F","B"])),f=()=>i.not(c()),h=()=>i.not(o()),p=()=>i.and([o(),u(),f()]),d=()=>i.and([i.and(i.moves(["F","R"])),i.not(s())]),g=()=>i.and(i.moves(["D","R","F"])),x=()=>i.or([g(),d()]),y=()=>i.or([i.and([u(),a()]),i.and([u(),f()]),i.and([a(),f()])]),m=()=>i.or([i.and([u(),s(),c()]),i.and([a(),l(),c()]),i.and([f(),s(),l()])]),b=()=>i.not(i.or([y(),m()])),w=()=>i.or([u(),i.and([o(),m()])]);function D(){n.set(h(),me.Dim)}function R(){n.set(o(),me.PermuteNonPrimary),n.set(p(),me.Dim)}function L(){n.set(o(),me.IgnoreNonPrimary),n.set(p(),me.Regular)}function T(){n.set(o(),me.Ignoriented),n.set(p(),me.Dim)}switch(e){case"full":break;case"PLL":D(),R();break;case"CLS":D(),n.set(i.and(i.moves(["D","R","F"])),me.Regular),n.set(o(),me.Ignoriented),n.set(i.and([o(),b()]),me.IgnoreNonPrimary);break;case"OLL":D(),L();break;case"COLL":D(),R(),n.set(i.and([o(),b()]),me.Regular);break;case"OCLL":D(),T(),n.set(i.and([o(),b()]),me.IgnoreNonPrimary);break;case"CLL":D(),n.set(i.not(i.and([b(),o()])),me.Dim);break;case"ELL":D(),n.set(o(),me.Dim),n.set(i.and([o(),m()]),me.Regular);break;case"ELS":D(),L(),n.set(i.and([o(),b()]),me.Ignored),n.set(d(),me.Regular),n.set(g(),me.Ignored);break;case"LL":D();break;case"F2L":n.set(o(),me.Ignored);break;case"ZBLL":D(),n.set(o(),me.PermuteNonPrimary),n.set(p(),me.Dim),n.set(i.and([o(),b()]),me.Regular);break;case"ZBLS":D(),n.set(x(),me.Regular),L(),n.set(i.and([o(),b()]),me.Ignored);break;case"WVLS":case"VLS":D(),n.set(x(),me.Regular),L();break;case"LS":D(),n.set(x(),me.Regular),n.set(o(),me.Ignored),n.set(p(),me.Dim);break;case"EO":n.set(b(),me.Ignored),n.set(m(),me.OrientationWithoutPermutation);break;case"CMLL":n.set(h(),me.Dim),n.set(w(),me.Ignored),n.set(i.and([o(),b()]),me.Regular);break;case"L6E":n.set(i.not(w()),me.Dim);break;case"L6EO":n.set(i.not(w()),me.Dim),n.set(w(),me.OrientationWithoutPermutation),n.set(i.and([y(),s()]),me.OrientationStickers);break;case"Daisy":n.set(i.all(),me.Ignored),n.set(y(),me.Dim),n.set(i.and([i.move("D"),y()]),me.Regular),n.set(i.and([i.move("U"),m()]),me.IgnoreNonPrimary);break;case"Cross":n.set(i.all(),me.Ignored),n.set(y(),me.Dim),n.set(i.and([i.move("D"),y()]),me.Regular),n.set(i.and([i.move("D"),m()]),me.Regular);break;case"2x2x2":n.set(i.or(i.moves(["U","F","R"])),me.Ignored),n.set(i.and([i.or(i.moves(["U","F","R"])),y()]),me.Dim);break;case"2x2x3":n.set(i.all(),me.Dim),n.set(i.or(i.moves(["U","F","R"])),me.Ignored),n.set(i.and([i.or(i.moves(["U","F","R"])),y()]),me.Dim),n.set(i.and([i.move("F"),i.not(i.or(i.moves(["U","R"])))]),me.Regular);break;case"Void Cube":n.set(y(),me.Invisible);break;case"picture":case"invisible":n.set(i.all(),me.Invisible);break;case"centers-only":n.set(i.not(y()),me.Ignored);break;case"experimental-global-custom-1":case"experimental-global-custom-2":Gx(n,i);break;default:console.warn(`Unsupported stickering for ${r.id}: ${e}. Setting all pieces to dim.`),n.set(i.and(i.moves([])),me.Dim)}return n.toAppearance()}async function Sa(){return["full","PLL","CLS","OLL","COLL","OCLL","ELL","ELS","LL","F2L","ZBLL","ZBLS","WVLS","VLS","LS","EO","CMLL","L6E","L6EO","Daisy","Cross","2x2x2","2x2x3","Void Cube","picture","invisible","centers-only","experimental-global-custom-1","experimental-global-custom-2"]}var La=oe(()=>{Mu();Wx()});async function di(r){return(await Promise.resolve().then(()=>(mf(),Lu))).getPuzzleGeometryByName(r,{allMoves:!0,orientCenters:!0,addRotations:!0})}async function Ru(r){return(await di(r)).writekpuzzle(!0)}function Jo(r,e,t){let n={id:r,fullName:e,def:async()=>Ru(r),svg:async()=>(await di(r)).generatesvg(),pg:async()=>di(r)};return t?.inventedBy&&(n.inventedBy=t.inventedBy),t?.inventionYear&&(n.inventionYear=t.inventionYear),n}function Aa(r,e,t){let n=Jo(r,e,t);return n.appearance=Hn.bind(Hn,n),n.stickerings=Sa,n}var $o=oe(()=>{La()});var Vx={};_t(Vx,{cube2x2x2KPuzzle:()=>qi});var qi,Hx=oe(()=>{qi={name:"2x2x2",orbits:{CORNERS:{numPieces:8,orientations:3}},startPieces:{CORNERS:{permutation:[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]}}}};qi.moves.Rv=qi.moves.x;qi.moves.Uv=qi.moves.y;qi.moves.Fv=qi.moves.z;qi.moves.Lv={CORNERS:{permutation:[1,7,6,2,0,3,5,4],orientation:[2,1,2,1,1,2,1,2]}};qi.moves.Dv={CORNERS:{permutation:[3,0,1,2,5,6,7,4],orientation:[0,0,0,0,0,0,0,0]}};qi.moves.Bv={CORNERS:{permutation:[4,7,1,0,5,3,2,6],orientation:[1,2,1,2,2,1,2,1]}}});var qx={};_t(qx,{default:()=>vM});var vM,jx=oe(()=>{vM=`<?xml version="1.0" encoding="UTF-8"?>
|
|
24
24
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
|
25
25
|
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd">
|
|
26
26
|
<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">
|
|
@@ -64,7 +64,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
64
64
|
<use id="CORNERS-l7-o2" xlink:href="#sticker" transform="translate(6.6, 3.2)" style="fill: #26f"/>
|
|
65
65
|
</g>
|
|
66
66
|
|
|
67
|
-
</svg>`});var vf,
|
|
67
|
+
</svg>`});var vf,Qx=oe(()=>{$o();La();vf={id:"2x2x2",fullName:"2\xD72\xD72 Cube",def:async()=>(await Promise.resolve().then(()=>(Hx(),Vx))).cube2x2x2KPuzzle,svg:async()=>(await Promise.resolve().then(()=>(jx(),qx))).default,pg:async()=>di("2x2x2"),appearance:r=>Hn(vf,r),stickerings:Sa}});var Yx={};_t(Yx,{default:()=>xM});var xM,Xx=oe(()=>{xM=`<?xml version="1.0" encoding="UTF-8"?>
|
|
68
68
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
|
69
69
|
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd">
|
|
70
70
|
<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">
|
|
@@ -191,7 +191,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
191
191
|
<use id="CENTERS-l5-o3" xlink:href="#sticker" transform="translate(4.3,7.5)" style="fill: yellow"/>
|
|
192
192
|
</g>
|
|
193
193
|
|
|
194
|
-
</svg>`});var
|
|
194
|
+
</svg>`});var Kx={};_t(Kx,{default:()=>wM});var wM,Zx=oe(()=>{wM=`<?xml version="1.0" encoding="UTF-8"?>
|
|
195
195
|
<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">
|
|
196
196
|
<title>3x3x3 LL</title>
|
|
197
197
|
<defs>
|
|
@@ -298,7 +298,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
298
298
|
<use id="CENTERS-l5-o2" xlink:href="#sticker" style="fill: yellow"/>
|
|
299
299
|
<use id="CENTERS-l5-o3" xlink:href="#sticker" style="fill: yellow"/>
|
|
300
300
|
</g>
|
|
301
|
-
</svg>`});var no,
|
|
301
|
+
</svg>`});var no,Jx=oe(()=>{Ht();$o();La();no={id:"3x3x3",fullName:"3\xD73\xD73 Cube",inventedBy:["Ern\u0151 Rubik"],inventionYear:1974,def:async()=>Ye,svg:async()=>(await Promise.resolve().then(()=>(Xx(),Yx))).default,llSVG:async()=>(await Promise.resolve().then(()=>(Zx(),Kx))).default,pg:async()=>di("3x3x3"),appearance:r=>Hn(no,r),stickerings:Sa}});var $x={};_t($x,{clockKPuzzle:()=>bM});var bM,ew=oe(()=>{bM={name:"Clock",orbits:{DIALS:{numPieces:18,orientations:12},FACES:{numPieces:18,orientations:1},FRAME:{numPieces:1,orientations:2}},startPieces:{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]}},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 tw={};_t(tw,{default:()=>SM});var SM,nw=oe(()=>{SM=`<?xml version="1.0" encoding="UTF-8"?>
|
|
302
302
|
<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">
|
|
303
303
|
<title>clock</title>
|
|
304
304
|
<defs>
|
|
@@ -666,7 +666,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
666
666
|
</g>
|
|
667
667
|
</g>
|
|
668
668
|
</g>
|
|
669
|
-
</svg>`});var
|
|
669
|
+
</svg>`});var iw,rw=oe(()=>{iw={id:"clock",fullName:"Clock",inventedBy:["Christopher C. Wiggs","Christopher J. Taylor"],inventionYear:1988,def:async()=>(await Promise.resolve().then(()=>(ew(),$x))).clockKPuzzle,svg:async()=>(await Promise.resolve().then(()=>(nw(),tw))).default}});async function ow(r,e){let t=await r.def(),n=new Du(t),i=new Eu(t),o=()=>i.and([i.move("U"),i.not(i.or(i.moves(["F","BL","BR"])))]),s=()=>i.and([i.move("U"),i.not(i.move("F"))]),a=()=>i.or([s(),i.and([i.move("F"),i.not(i.or(i.moves(["U","BL","BR"])))])]),l=()=>i.not(i.or([i.and([i.move("U"),i.move("F")]),i.and([i.move("F"),i.move("BL")]),i.and([i.move("F"),i.move("BR")]),i.and([i.move("BL"),i.move("BR")])])),u=()=>i.not(i.or([i.and([i.move("F"),i.move("BL")]),i.and([i.move("F"),i.move("BR")]),i.and([i.move("BL"),i.move("BR")])]));switch(e){case"full":break;case"experimental-fto-fc":n.set(i.not(o()),me.Ignored);break;case"experimental-fto-f2t":n.set(i.not(s()),me.Ignored),n.set(o(),me.Dim);break;case"experimental-fto-sc":n.set(i.not(a()),me.Ignored),n.set(s(),me.Dim);break;case"experimental-fto-l2c":n.set(i.not(l()),me.Ignored),n.set(a(),me.Dim);break;case"experimental-fto-lbt":n.set(i.not(u()),me.Ignored),n.set(l(),me.Dim);break;case"experimental-fto-l3t":n.set(u(),me.Dim);break;default:console.warn(`Unsupported stickering for ${r.id}: ${e}. Setting all pieces to dim.`),n.set(i.and(i.moves([])),me.Dim)}return n.toAppearance()}async function sw(){return["full","experimental-fto-fc","experimental-fto-f2t","experimental-fto-sc","experimental-fto-l2c","experimental-fto-lbt","experimental-fto-l3t"]}var aw=oe(()=>{Mu()});var P0,lw=oe(()=>{$o();aw();P0={id:"fto",fullName:"Face-Turning Octahedron",inventedBy:["Karl Rohrbach","David Pitcher"],inventionYear:1983,def:async()=>Ru("FTO"),svg:async()=>(await di("FTO")).generatesvg(),pg:async()=>di("FTO"),appearance:r=>ow(P0,r),stickerings:sw}});async function uw(r,e){switch(e){case"full":case"F2L":case"LL":return Hn(r,e);default:console.warn(`Unsupported stickering for ${r.id}: ${e}. Setting all pieces to dim.`)}return Hn(r,"full")}async function cw(){return["full","F2L","LL"]}var hw=oe(()=>{La()});var Tu,fw=oe(()=>{$o();hw();Tu=Jo("megaminx","Megaminx",{inventionYear:1981});Tu.appearance=r=>uw(Tu,r);Tu.stickerings=cw});var pw={};_t(pw,{default:()=>LM});var LM,dw=oe(()=>{LM=`<?xml version="1.0" encoding="UTF-8"?>
|
|
670
670
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
|
671
671
|
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg11.dtd">
|
|
672
672
|
<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">
|
|
@@ -753,7 +753,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
753
753
|
<use id="EDGES-l4-o1" xlink:href="#stickerV" transform="translate(1, 1)" style="fill: red"/>
|
|
754
754
|
</g>
|
|
755
755
|
|
|
756
|
-
</svg>`});var
|
|
756
|
+
</svg>`});var mw,gw=oe(()=>{$o();mw={id:"pyraminx",fullName:"Pyraminx",inventedBy:["Uwe Meffert"],inventionYear:1970,def:async()=>Ru("pyraminx"),svg:async()=>(await Promise.resolve().then(()=>(dw(),pw))).default,pg:async()=>di("pyraminx")}});var yw={};_t(yw,{sq1HyperOrbitKPuzzle:()=>AM});var AM,vw=oe(()=>{AM={name:"Square-1",orbits:{WEDGES:{numPieces:24,orientations:9},EQUATOR:{numPieces:2,orientations:6}},startPieces:{WEDGES:{permutation:[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:{permutation:[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 xw={};_t(xw,{default:()=>DM});var DM,ww=oe(()=>{DM=`<?xml version="1.0" encoding="UTF-8"?>
|
|
757
757
|
<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">
|
|
758
758
|
<!-- Generator: Sketch 59.1 (86144) - https://sketch.com -->
|
|
759
759
|
<title>sq1-fancy</title>
|
|
@@ -1047,7 +1047,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
1047
1047
|
<line x1="0.15767665" y1="262.276878" x2="70.4345542" y2="2.27488928e-16" id="TOP"></line>
|
|
1048
1048
|
</g>
|
|
1049
1049
|
</g>
|
|
1050
|
-
</svg>`});var ww,bw=oe(()=>{ww={id:"square1",fullName:"Square-1",inventedBy:["Karel Hr\u0161el","Vojtech Kopsk\xFD"],inventionYear:1990,def:async()=>(await Promise.resolve().then(()=>(yw(),gw))).sq1HyperOrbitKPuzzle,svg:async()=>(await Promise.resolve().then(()=>(xw(),vw))).default}});var P0={};Rt(P0,{cube2x2x2:()=>vf,cube3x3x3:()=>no,experimentalCube3x3x3KPuzzle:()=>Ye,experimentalCubeAppearance:()=>Hn,experimentalCustomPGPuzzleLoader:()=>gf,experimentalGetFaceletAppearance:()=>Au,puzzles:()=>Ot,wcaEventInfo:()=>MM});function MM(r){return EM[r]??null}var Ot,EM,qn=oe(()=>{Ux();Ht();La();$o();jx();Zx();iw();aw();hw();mw();bw();Mu();Ot={"3x3x3":no,"2x2x2":vf,"4x4x4":Aa("4x4x4","4\xD74\xD74 Cube"),"5x5x5":Aa("5x5x5","5\xD75\xD75 Cube"),"6x6x6":Aa("6x6x6","6\xD76\xD76 Cube"),"7x7x7":Aa("7x7x7","7\xD77\xD77 Cube"),"40x40x40":Aa("40x40x40","40\xD740\xD740 Cube"),clock:nw,megaminx:Tu,pyraminx:dw,skewb:Jo("skewb","Skewb",{inventedBy:["Tony Durham"]}),square1:ww,fto:C0,gigaminx:Jo("gigaminx","Gigaminx",{inventedBy:["Tyler Fox"],inventionYear:2006}),master_tetraminx:Jo("master tetraminx","Master Tetraminx",{inventedBy:["Katsuhiko Okamoto"],inventionYear:2002})},EM={"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"}}});var W1={};Rt(W1,{ACESFilmicToneMapping:()=>Xw,AddEquation:()=>es,AddOperation:()=>qw,AdditiveAnimationBlendMode:()=>tg,AdditiveBlending:()=>I0,AlphaFormat:()=>ib,AlwaysDepth:()=>Uw,AlwaysStencilFunc:()=>Kb,AmbientLight:()=>Op,AmbientLightProbe:()=>A1,AnimationClip:()=>Sl,AnimationLoader:()=>AS,AnimationMixer:()=>_1,AnimationObjectGroup:()=>F1,AnimationUtils:()=>Ct,ArcCurve:()=>gp,ArrayCamera:()=>$f,ArrowHelper:()=>uL,Audio:()=>qp,AudioAnalyser:()=>E1,AudioContext:()=>b1,AudioListener:()=>US,AudioLoader:()=>S1,AxesHelper:()=>G1,AxisHelper:()=>h_,BackSide:()=>At,BasicDepthPacking:()=>Qb,BasicShadowMap:()=>_M,BinaryTextureLoader:()=>g_,Bone:()=>cc,BooleanKeyframeTrack:()=>Lo,BoundingBoxHelper:()=>f_,Box2:()=>Fs,Box3:()=>Yn,Box3Helper:()=>sL,BoxBufferGeometry:()=>Ti,BoxGeometry:()=>Ti,BoxHelper:()=>N1,BufferAttribute:()=>qe,BufferGeometry:()=>Pe,BufferGeometryLoader:()=>x1,ByteType:()=>Zw,Cache:()=>As,Camera:()=>Va,CameraHelper:()=>oL,CanvasRenderer:()=>v_,CanvasTexture:()=>Jg,CatmullRomCurve3:()=>vp,CineonToneMapping:()=>Yw,CircleBufferGeometry:()=>sl,CircleGeometry:()=>sl,ClampToEdgeWrapping:()=>mn,Clock:()=>D1,Color:()=>xe,ColorKeyframeTrack:()=>Pp,CompressedTexture:()=>hp,CompressedTextureLoader:()=>DS,ConeBufferGeometry:()=>al,ConeGeometry:()=>al,CubeCamera:()=>Ku,CubeReflectionMapping:()=>ts,CubeRefractionMapping:()=>ns,CubeTexture:()=>ps,CubeTextureLoader:()=>f1,CubeUVReflectionMapping:()=>Ma,CubeUVRefractionMapping:()=>Pu,CubicBezierCurve:()=>mc,CubicBezierCurve3:()=>xp,CubicInterpolant:()=>u1,CullFaceBack:()=>k0,CullFaceFront:()=>Lw,CullFaceFrontBack:()=>FM,CullFaceNone:()=>Sw,Curve:()=>Xn,CurvePath:()=>s1,CustomBlending:()=>Dw,CustomToneMapping:()=>Kw,CylinderBufferGeometry:()=>bo,CylinderGeometry:()=>bo,Cylindrical:()=>qS,DataTexture:()=>vo,DataTexture2DArray:()=>$u,DataTexture3D:()=>Zf,DataTextureLoader:()=>p1,DataUtils:()=>fL,DecrementStencilOp:()=>WM,DecrementWrapStencilOp:()=>HM,DefaultLoadingManager:()=>LS,DepthFormat:()=>oo,DepthStencilFormat:()=>ss,DepthTexture:()=>ic,DirectionalLight:()=>Np,DirectionalLightHelper:()=>rL,DiscreteInterpolant:()=>c1,DodecahedronBufferGeometry:()=>ll,DodecahedronGeometry:()=>ll,DoubleSide:()=>jn,DstAlphaFactor:()=>Cw,DstColorFactor:()=>kw,DynamicBufferAttribute:()=>t_,DynamicCopyUsage:()=>rR,DynamicDrawUsage:()=>Fa,DynamicReadUsage:()=>tR,EdgesGeometry:()=>mp,EdgesHelper:()=>p_,EllipseCurve:()=>ul,EqualDepth:()=>Ow,EqualStencilFunc:()=>YM,EquirectangularReflectionMapping:()=>_u,EquirectangularRefractionMapping:()=>Cu,Euler:()=>xn,EventDispatcher:()=>gr,ExtrudeBufferGeometry:()=>Ji,ExtrudeGeometry:()=>Ji,FaceColors:()=>HF,FileLoader:()=>ki,FlatShading:()=>z0,Float16BufferAttribute:()=>Fg,Float32Attribute:()=>u_,Float32BufferAttribute:()=>Te,Float64Attribute:()=>c_,Float64BufferAttribute:()=>_g,FloatType:()=>Qi,Fog:()=>el,FogExp2:()=>$a,Font:()=>D_,FontLoader:()=>A_,FrontSide:()=>ji,Frustum:()=>Qa,GLBufferAttribute:()=>P1,GLSL1:()=>sR,GLSL3:()=>og,GammaEncoding:()=>Ef,GreaterDepth:()=>Ww,GreaterEqualDepth:()=>Gw,GreaterEqualStencilFunc:()=>JM,GreaterStencilFunc:()=>KM,GridHelper:()=>U1,Group:()=>gi,HalfFloatType:()=>rs,HemisphereLight:()=>Bp,HemisphereLightHelper:()=>eL,HemisphereLightProbe:()=>L1,IcosahedronBufferGeometry:()=>pl,IcosahedronGeometry:()=>pl,ImageBitmapLoader:()=>w1,ImageLoader:()=>Ll,ImageUtils:()=>so,ImmediateRenderObject:()=>E_,IncrementStencilOp:()=>GM,IncrementWrapStencilOp:()=>VM,InstancedBufferAttribute:()=>xo,InstancedBufferGeometry:()=>Vp,InstancedInterleavedBuffer:()=>C1,InstancedMesh:()=>sp,Int16Attribute:()=>o_,Int16BufferAttribute:()=>Rg,Int32Attribute:()=>a_,Int32BufferAttribute:()=>Tg,Int8Attribute:()=>n_,Int8BufferAttribute:()=>Dg,IntType:()=>$w,InterleavedBuffer:()=>yo,InterleavedBufferAttribute:()=>Ar,Interpolant:()=>$i,InterpolateDiscrete:()=>Iu,InterpolateLinear:()=>Uu,InterpolateSmooth:()=>Af,InvertStencilOp:()=>qM,JSONLoader:()=>x_,KeepStencilOp:()=>Rf,KeyframeTrack:()=>yi,LOD:()=>Yg,LatheBufferGeometry:()=>dl,LatheGeometry:()=>dl,Layers:()=>zf,LensFlare:()=>b_,LessDepth:()=>Nw,LessEqualDepth:()=>wf,LessEqualStencilFunc:()=>XM,LessStencilFunc:()=>QM,Light:()=>vi,LightProbe:()=>Al,Line:()=>Ki,Line3:()=>B1,LineBasicMaterial:()=>Jt,LineCurve:()=>cl,LineCurve3:()=>r1,LineDashedMaterial:()=>_p,LineLoop:()=>lp,LinePieces:()=>WF,LineSegments:()=>Bn,LineStrip:()=>GF,LinearEncoding:()=>Pn,LinearFilter:()=>Kt,LinearInterpolant:()=>Cp,LinearMipMapLinearFilter:()=>zM,LinearMipMapNearestFilter:()=>BM,LinearMipmapLinearFilter:()=>is,LinearMipmapNearestFilter:()=>H0,LinearToneMapping:()=>jw,Loader:()=>Mn,LoaderUtils:()=>Dc,LoadingManager:()=>kp,LoopOnce:()=>Vb,LoopPingPong:()=>qb,LoopRepeat:()=>Hb,LuminanceAlphaFormat:()=>ob,LuminanceFormat:()=>rb,MOUSE:()=>RM,Material:()=>Zt,MaterialLoader:()=>v1,Math:()=>wR,MathUtils:()=>wR,Matrix3:()=>Qt,Matrix4:()=>Ae,MaxEquation:()=>G0,Mesh:()=>Lt,MeshBasicMaterial:()=>vt,MeshDepthMaterial:()=>tc,MeshDistanceMaterial:()=>nc,MeshFaceMaterial:()=>jF,MeshLambertMaterial:()=>Tp,MeshMatcapMaterial:()=>Fp,MeshNormalMaterial:()=>Rp,MeshPhongMaterial:()=>Ep,MeshPhysicalMaterial:()=>Dp,MeshStandardMaterial:()=>Sc,MeshToonMaterial:()=>Mp,MinEquation:()=>O0,MirroredRepeatWrapping:()=>Bu,MixOperation:()=>Hw,MultiMaterial:()=>QF,MultiplyBlending:()=>N0,MultiplyOperation:()=>Fu,NearestFilter:()=>jt,NearestMipMapLinearFilter:()=>kM,NearestMipMapNearestFilter:()=>PM,NearestMipmapLinearFilter:()=>Lf,NearestMipmapNearestFilter:()=>Sf,NeverDepth:()=>Iw,NeverStencilFunc:()=>jM,NoBlending:()=>dr,NoColors:()=>VF,NoToneMapping:()=>io,NormalAnimationBlendMode:()=>Df,NormalBlending:()=>Ea,NotEqualDepth:()=>Vw,NotEqualStencilFunc:()=>ZM,NumberKeyframeTrack:()=>wl,Object3D:()=>je,ObjectLoader:()=>FS,ObjectSpaceNormalMap:()=>Xb,OctahedronBufferGeometry:()=>ws,OctahedronGeometry:()=>ws,OneFactor:()=>Tw,OneMinusDstAlphaFactor:()=>Pw,OneMinusDstColorFactor:()=>Bw,OneMinusSrcAlphaFactor:()=>V0,OneMinusSrcColorFactor:()=>_w,OrthographicCamera:()=>Ya,PCFShadowMap:()=>B0,PCFSoftShadowMap:()=>Aw,PMREMGenerator:()=>Gg,ParametricGeometry:()=>S_,Particle:()=>XF,ParticleBasicMaterial:()=>JF,ParticleSystem:()=>KF,ParticleSystemMaterial:()=>$F,Path:()=>hl,PerspectiveCamera:()=>Gt,Plane:()=>Fi,PlaneBufferGeometry:()=>ds,PlaneGeometry:()=>ds,PlaneHelper:()=>aL,PointCloud:()=>YF,PointCloudMaterial:()=>ZF,PointLight:()=>Up,PointLightHelper:()=>ZS,Points:()=>ol,PointsMaterial:()=>wo,PolarGridHelper:()=>tL,PolyhedronBufferGeometry:()=>Zi,PolyhedronGeometry:()=>Zi,PositionalAudio:()=>OS,PropertyBinding:()=>ut,PropertyMixer:()=>M1,QuadraticBezierCurve:()=>gc,QuadraticBezierCurve3:()=>yc,Quaternion:()=>ot,QuaternionKeyframeTrack:()=>Ls,QuaternionLinearInterpolant:()=>h1,REVISION:()=>xf,RGBADepthPacking:()=>Yb,RGBAFormat:()=>gn,RGBAIntegerFormat:()=>fb,RGBA_ASTC_10x10_Format:()=>Db,RGBA_ASTC_10x5_Format:()=>Sb,RGBA_ASTC_10x6_Format:()=>Lb,RGBA_ASTC_10x8_Format:()=>Ab,RGBA_ASTC_12x10_Format:()=>Eb,RGBA_ASTC_12x12_Format:()=>Mb,RGBA_ASTC_4x4_Format:()=>db,RGBA_ASTC_5x4_Format:()=>mb,RGBA_ASTC_5x5_Format:()=>gb,RGBA_ASTC_6x5_Format:()=>yb,RGBA_ASTC_6x6_Format:()=>vb,RGBA_ASTC_8x5_Format:()=>xb,RGBA_ASTC_8x6_Format:()=>wb,RGBA_ASTC_8x8_Format:()=>bb,RGBA_BPTC_Format:()=>Rb,RGBA_ETC2_EAC_Format:()=>eg,RGBA_PVRTC_2BPPV1_Format:()=>J0,RGBA_PVRTC_4BPPV1_Format:()=>Z0,RGBA_S3TC_DXT1_Format:()=>j0,RGBA_S3TC_DXT3_Format:()=>Q0,RGBA_S3TC_DXT5_Format:()=>Y0,RGBDEncoding:()=>rg,RGBEEncoding:()=>Mf,RGBEFormat:()=>sb,RGBFormat:()=>ro,RGBIntegerFormat:()=>hb,RGBM16Encoding:()=>ig,RGBM7Encoding:()=>ng,RGB_ETC1_Format:()=>pb,RGB_ETC2_Format:()=>$0,RGB_PVRTC_2BPPV1_Format:()=>K0,RGB_PVRTC_4BPPV1_Format:()=>X0,RGB_S3TC_DXT1_Format:()=>q0,RGFormat:()=>ub,RGIntegerFormat:()=>cb,RawShaderMaterial:()=>ms,Ray:()=>wr,Raycaster:()=>VS,RectAreaLight:()=>Gp,RedFormat:()=>ab,RedIntegerFormat:()=>lb,ReinhardToneMapping:()=>Qw,RepeatWrapping:()=>ku,ReplaceStencilOp:()=>OM,ReverseSubtractEquation:()=>Mw,RingBufferGeometry:()=>ml,RingGeometry:()=>ml,SRGB8_ALPHA8_ASTC_10x10_Format:()=>Ob,SRGB8_ALPHA8_ASTC_10x5_Format:()=>Ib,SRGB8_ALPHA8_ASTC_10x6_Format:()=>Ub,SRGB8_ALPHA8_ASTC_10x8_Format:()=>Nb,SRGB8_ALPHA8_ASTC_12x10_Format:()=>Gb,SRGB8_ALPHA8_ASTC_12x12_Format:()=>Wb,SRGB8_ALPHA8_ASTC_4x4_Format:()=>Tb,SRGB8_ALPHA8_ASTC_5x4_Format:()=>Fb,SRGB8_ALPHA8_ASTC_5x5_Format:()=>_b,SRGB8_ALPHA8_ASTC_6x5_Format:()=>Cb,SRGB8_ALPHA8_ASTC_6x6_Format:()=>Pb,SRGB8_ALPHA8_ASTC_8x5_Format:()=>kb,SRGB8_ALPHA8_ASTC_8x6_Format:()=>Bb,SRGB8_ALPHA8_ASTC_8x8_Format:()=>zb,Scene:()=>xs,SceneUtils:()=>w_,ShaderChunk:()=>$e,ShaderLib:()=>_i,ShaderMaterial:()=>Yi,ShadowMaterial:()=>Ap,Shape:()=>Ci,ShapeBufferGeometry:()=>bs,ShapeGeometry:()=>bs,ShapePath:()=>cL,ShapeUtils:()=>Pi,ShortType:()=>Jw,Skeleton:()=>hc,SkeletonHelper:()=>I1,SkinnedMesh:()=>uc,SmoothShading:()=>CM,Sphere:()=>vr,SphereBufferGeometry:()=>Ss,SphereGeometry:()=>Ss,Spherical:()=>Mc,SphericalHarmonics3:()=>Wp,SplineCurve:()=>vc,SpotLight:()=>Ip,SpotLightHelper:()=>XS,Sprite:()=>lc,SpriteMaterial:()=>rc,SrcAlphaFactor:()=>W0,SrcAlphaSaturateFactor:()=>zw,SrcColorFactor:()=>Fw,StaticCopyUsage:()=>iR,StaticDrawUsage:()=>Ta,StaticReadUsage:()=>eR,StereoCamera:()=>BS,StreamCopyUsage:()=>oR,StreamDrawUsage:()=>$M,StreamReadUsage:()=>nR,StringKeyframeTrack:()=>Ao,SubtractEquation:()=>Ew,SubtractiveBlending:()=>U0,TOUCH:()=>TM,TangentSpaceNormalMap:()=>us,TetrahedronBufferGeometry:()=>gl,TetrahedronGeometry:()=>gl,TextGeometry:()=>L_,Texture:()=>Yt,TextureLoader:()=>Lc,TorusBufferGeometry:()=>yl,TorusGeometry:()=>yl,TorusKnotBufferGeometry:()=>vl,TorusKnotGeometry:()=>vl,Triangle:()=>It,TriangleFanDrawMode:()=>UM,TriangleStripDrawMode:()=>IM,TrianglesDrawMode:()=>jb,TubeBufferGeometry:()=>xl,TubeGeometry:()=>xl,UVMapping:()=>bf,Uint16Attribute:()=>s_,Uint16BufferAttribute:()=>Qu,Uint32Attribute:()=>l_,Uint32BufferAttribute:()=>Yu,Uint8Attribute:()=>i_,Uint8BufferAttribute:()=>Eg,Uint8ClampedAttribute:()=>r_,Uint8ClampedBufferAttribute:()=>Mg,Uniform:()=>Ec,UniformsLib:()=>we,UniformsUtils:()=>p3,UnsignedByteType:()=>mr,UnsignedInt248Type:()=>os,UnsignedIntType:()=>zu,UnsignedShort4444Type:()=>eb,UnsignedShort5551Type:()=>tb,UnsignedShort565Type:()=>nb,UnsignedShortType:()=>Ra,VSMShadowMap:()=>Da,Vector2:()=>ee,Vector3:()=>M,Vector4:()=>xt,VectorKeyframeTrack:()=>bl,Vertex:()=>e_,VertexColors:()=>qF,VideoTexture:()=>Zg,WebGL1Renderer:()=>jg,WebGLCubeRenderTarget:()=>Zu,WebGLMultipleRenderTargets:()=>ug,WebGLMultisampleRenderTarget:()=>Vu,WebGLRenderTarget:()=>Qn,WebGLRenderTargetCube:()=>y_,WebGLRenderer:()=>ft,WebGLUtils:()=>Y3,WireframeGeometry:()=>Lp,WireframeHelper:()=>d_,WrapAroundEnding:()=>Nu,XHRLoader:()=>m_,ZeroCurvatureEnding:()=>as,ZeroFactor:()=>Rw,ZeroSlopeEnding:()=>ls,ZeroStencilOp:()=>NM,sRGBEncoding:()=>Ou});function oi(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(yn[r&255]+yn[r>>8&255]+yn[r>>16&255]+yn[r>>24&255]+"-"+yn[e&255]+yn[e>>8&255]+"-"+yn[e>>16&15|64]+yn[e>>24&255]+"-"+yn[t&63|128]+yn[t>>8&255]+"-"+yn[t>>16&255]+yn[t>>24&255]+yn[n&255]+yn[n>>8&255]+yn[n>>16&255]+yn[n>>24&255]).toUpperCase()}function vn(r,e,t){return Math.max(e,Math.min(t,r))}function sg(r,e){return(r%e+e)%e}function aR(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function lR(r,e,t){return r!==e?(t-r)/(e-r):0}function Wu(r,e,t){return(1-t)*r+t*e}function uR(r,e,t,n){return Wu(r,e,1-Math.exp(-t*n))}function cR(r,e=1){return e-Math.abs(sg(r,e*2)-e)}function hR(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function fR(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function pR(r,e){return r+Math.floor(Math.random()*(e-r+1))}function dR(r,e){return r+Math.random()*(e-r)}function mR(r){return r*(.5-Math.random())}function gR(r){return r!==void 0&&(Tf=r%2147483647),Tf=Tf*16807%2147483647,(Tf-1)/2147483646}function yR(r){return r*cs}function vR(r){return r*Gu}function ag(r){return(r&r-1)==0&&r!==0}function Zb(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Jb(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function xR(r,e,t,n,i){let o=Math.cos,s=Math.sin,a=o(t/2),l=s(t/2),u=o((e+n)/2),c=s((e+n)/2),f=o((e-n)/2),h=s((e-n)/2),p=o((n-e)/2),d=s((n-e)/2);switch(i){case"XYX":r.set(a*c,l*f,l*h,a*u);break;case"YZY":r.set(l*h,a*c,l*f,a*u);break;case"ZXZ":r.set(l*f,l*h,a*c,a*u);break;case"XZX":r.set(a*c,l*d,l*p,a*u);break;case"YXY":r.set(l*p,a*c,l*d,a*u);break;case"ZYZ":r.set(l*d,l*p,a*c,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function $b(r){if(r.length===0)return-1/0;let e=r[0];for(let t=1,n=r.length;t<n;++t)r[t]>e&&(e=r[t]);return e}function _a(r,e){return new bR[r](e)}function Ff(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function e3(r,e=0){let t=3735928559^e,n=1103547991^e;for(let i=0,o;i<r.length;i++)o=r.charCodeAt(i),t=Math.imul(t^o,2654435761),n=Math.imul(n^o,1597334677);return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}function lg(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?so.getDataURL(r):r.data?{data:Array.prototype.slice.call(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}function fg(r,e,t,n,i){for(let o=0,s=r.length-3;o<=s;o+=3){fs.fromArray(r,o);let a=i.x*Math.abs(fs.x)+i.y*Math.abs(fs.y)+i.z*Math.abs(fs.z),l=e.dot(fs),u=t.dot(fs),c=n.dot(fs);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>a)return!1}return!0}function Sg(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}function Lg(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Ag(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}function CR(r,e,t,n,i,o,s,a){let l;if(e.side===At?l=n.intersectTriangle(s,o,i,!0,a):l=n.intersectTriangle(i,o,s,e.side!==jn,a),l===null)return null;jf.copy(a),jf.applyMatrix4(r.matrixWorld);let u=t.ray.origin.distanceTo(jf);return u<t.near||u>t.far?null:{distance:u,point:jf.clone(),object:r}}function Qf(r,e,t,n,i,o,s,a,l,u,c,f){ho.fromBufferAttribute(i,u),fo.fromBufferAttribute(i,c),po.fromBufferAttribute(i,f);let h=r.morphTargetInfluences;if(o&&h){Of.set(0,0,0),Gf.set(0,0,0),Wf.set(0,0,0);for(let d=0,g=o.length;d<g;d++){let x=h[d],y=o[d];x!==0&&(kg.fromBufferAttribute(y,u),Bg.fromBufferAttribute(y,c),zg.fromBufferAttribute(y,f),s?(Of.addScaledVector(kg,x),Gf.addScaledVector(Bg,x),Wf.addScaledVector(zg,x)):(Of.addScaledVector(kg.sub(ho),x),Gf.addScaledVector(Bg.sub(fo),x),Wf.addScaledVector(zg.sub(po),x)))}ho.add(Of),fo.add(Gf),po.add(Wf)}r.isSkinnedMesh&&(r.boneTransform(u,ho),r.boneTransform(c,fo),r.boneTransform(f,po));let p=CR(r,e,t,n,ho,fo,po,Ig);if(p){a&&(Vf.fromBufferAttribute(a,u),Hf.fromBufferAttribute(a,c),qf.fromBufferAttribute(a,f),p.uv=It.getUV(Ig,ho,fo,po,Vf,Hf,qf,new ee)),l&&(Vf.fromBufferAttribute(l,u),Hf.fromBufferAttribute(l,c),qf.fromBufferAttribute(l,f),p.uv2=It.getUV(Ig,ho,fo,po,Vf,Hf,qf,new ee));let d={a:u,b:c,c:f,normal:new M,materialIndex:0};It.getNormal(ho,fo,po,d.normal),p.face=d}return p}function Wa(r){let e={};for(let t in r){e[t]={};for(let n in r[t]){let i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Dn(r){let e={};for(let t=0;t<r.length;t++){let n=Wa(r[t]);for(let i in n)e[i]=n[i]}return e}function d3(){let r=null,e=!1,t=null,n=null;function i(o,s){t(o,s),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function IR(r,e){let t=e.isWebGL2,n=new WeakMap;function i(u,c){let f=u.array,h=u.usage,p=r.createBuffer();r.bindBuffer(c,p),r.bufferData(c,f,h),u.onUploadCallback();let d=5126;return f instanceof Float32Array?d=5126:f instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):f instanceof Uint16Array?u.isFloat16BufferAttribute?t?d=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):d=5123:f instanceof Int16Array?d=5122:f instanceof Uint32Array?d=5125:f instanceof Int32Array?d=5124:f instanceof Int8Array?d=5120:(f instanceof Uint8Array||f instanceof Uint8ClampedArray)&&(d=5121),{buffer:p,type:d,bytesPerElement:f.BYTES_PER_ELEMENT,version:u.version}}function o(u,c,f){let h=c.array,p=c.updateRange;r.bindBuffer(f,u),p.count===-1?r.bufferSubData(f,0,h):(t?r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count):r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h.subarray(p.offset,p.offset+p.count)),p.count=-1)}function s(u){return u.isInterleavedBufferAttribute&&(u=u.data),n.get(u)}function a(u){u.isInterleavedBufferAttribute&&(u=u.data);let c=n.get(u);c&&(r.deleteBuffer(c.buffer),n.delete(u))}function l(u,c){if(u.isGLBufferAttribute){let h=n.get(u);(!h||h.version<u.version)&&n.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}u.isInterleavedBufferAttribute&&(u=u.data);let f=n.get(u);f===void 0?n.set(u,i(u,c)):f.version<u.version&&(o(f.buffer,u,c),f.version=u.version)}return{get:s,remove:a,update:l}}function c5(r,e,t,n,i){let o=new xe(0),s=0,a,l,u=null,c=0,f=null;function h(d,g){let x=!1,y=g.isScene===!0?g.background:null;y&&y.isTexture&&(y=e.get(y));let m=r.xr,b=m.getSession&&m.getSession();b&&b.environmentBlendMode==="additive"&&(y=null),y===null?p(o,s):y&&y.isColor&&(p(y,1),x=!0),(r.autoClear||x)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),y&&(y.isCubeTexture||y.mapping===Ma)?(l===void 0&&(l=new Lt(new Ti(1,1,1),new Yi({name:"BackgroundCubeMaterial",uniforms:Wa(_i.cube.uniforms),vertexShader:_i.cube.vertexShader,fragmentShader:_i.cube.fragmentShader,side:At,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(w,D,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=y,l.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,(u!==y||c!==y.version||f!==r.toneMapping)&&(l.material.needsUpdate=!0,u=y,c=y.version,f=r.toneMapping),d.unshift(l,l.geometry,l.material,0,0,null)):y&&y.isTexture&&(a===void 0&&(a=new Lt(new ds(2,2),new Yi({name:"BackgroundMaterial",uniforms:Wa(_i.background.uniforms),vertexShader:_i.background.vertexShader,fragmentShader:_i.background.fragmentShader,side:ji,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(a)),a.material.uniforms.t2D.value=y,y.matrixAutoUpdate===!0&&y.updateMatrix(),a.material.uniforms.uvTransform.value.copy(y.matrix),(u!==y||c!==y.version||f!==r.toneMapping)&&(a.material.needsUpdate=!0,u=y,c=y.version,f=r.toneMapping),d.unshift(a,a.geometry,a.material,0,0,null))}function p(d,g){t.buffers.color.setClear(d.r,d.g,d.b,g,i)}return{getClearColor:function(){return o},setClearColor:function(d,g=1){o.set(d),s=g,p(o,s)},getClearAlpha:function(){return s},setClearAlpha:function(d){s=d,p(o,s)},render:h}}function h5(r,e,t,n){let i=r.getParameter(34921),o=n.isWebGL2?null:e.get("OES_vertex_array_object"),s=n.isWebGL2||o!==null,a={},l=g(null),u=l;function c(B,z,O,V,q){let se=!1;if(s){let he=d(V,O,z);u!==he&&(u=he,h(u.object)),se=x(V,q),se&&y(V,q)}else{let he=z.wireframe===!0;(u.geometry!==V.id||u.program!==O.id||u.wireframe!==he)&&(u.geometry=V.id,u.program=O.id,u.wireframe=he,se=!0)}B.isInstancedMesh===!0&&(se=!0),q!==null&&t.update(q,34963),se&&(L(B,z,O,V),q!==null&&r.bindBuffer(34963,t.get(q).buffer))}function f(){return n.isWebGL2?r.createVertexArray():o.createVertexArrayOES()}function h(B){return n.isWebGL2?r.bindVertexArray(B):o.bindVertexArrayOES(B)}function p(B){return n.isWebGL2?r.deleteVertexArray(B):o.deleteVertexArrayOES(B)}function d(B,z,O){let V=O.wireframe===!0,q=a[B.id];q===void 0&&(q={},a[B.id]=q);let se=q[z.id];se===void 0&&(se={},q[z.id]=se);let he=se[V];return he===void 0&&(he=g(f()),se[V]=he),he}function g(B){let z=[],O=[],V=[];for(let q=0;q<i;q++)z[q]=0,O[q]=0,V[q]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:O,attributeDivisors:V,object:B,attributes:{},index:null}}function x(B,z){let O=u.attributes,V=B.attributes,q=0;for(let se in V){let he=O[se],Y=V[se];if(he===void 0||he.attribute!==Y||he.data!==Y.data)return!0;q++}return u.attributesNum!==q||u.index!==z}function y(B,z){let O={},V=B.attributes,q=0;for(let se in V){let he=V[se],Y={};Y.attribute=he,he.data&&(Y.data=he.data),O[se]=Y,q++}u.attributes=O,u.attributesNum=q,u.index=z}function m(){let B=u.newAttributes;for(let z=0,O=B.length;z<O;z++)B[z]=0}function b(B){w(B,0)}function w(B,z){let O=u.newAttributes,V=u.enabledAttributes,q=u.attributeDivisors;O[B]=1,V[B]===0&&(r.enableVertexAttribArray(B),V[B]=1),q[B]!==z&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](B,z),q[B]=z)}function D(){let B=u.newAttributes,z=u.enabledAttributes;for(let O=0,V=z.length;O<V;O++)z[O]!==B[O]&&(r.disableVertexAttribArray(O),z[O]=0)}function R(B,z,O,V,q,se){n.isWebGL2===!0&&(O===5124||O===5125)?r.vertexAttribIPointer(B,z,O,q,se):r.vertexAttribPointer(B,z,O,V,q,se)}function L(B,z,O,V){if(n.isWebGL2===!1&&(B.isInstancedMesh||V.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;m();let q=V.attributes,se=O.getAttributes(),he=z.defaultAttributeValues;for(let Y in se){let X=se[Y];if(X.location>=0){let ve=q[Y];if(ve===void 0&&(Y==="instanceMatrix"&&B.instanceMatrix&&(ve=B.instanceMatrix),Y==="instanceColor"&&B.instanceColor&&(ve=B.instanceColor)),ve!==void 0){let pe=ve.normalized,Le=ve.itemSize,Ie=t.get(ve);if(Ie===void 0)continue;let P=Ie.buffer,Z=Ie.type,ae=Ie.bytesPerElement;if(ve.isInterleavedBufferAttribute){let ne=ve.data,fe=ne.stride,W=ve.offset;if(ne&&ne.isInstancedInterleavedBuffer){for(let Q=0;Q<X.locationSize;Q++)w(X.location+Q,ne.meshPerAttribute);B.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Q=0;Q<X.locationSize;Q++)b(X.location+Q);r.bindBuffer(34962,P);for(let Q=0;Q<X.locationSize;Q++)R(X.location+Q,Le/X.locationSize,Z,pe,fe*ae,(W+Le/X.locationSize*Q)*ae)}else{if(ve.isInstancedBufferAttribute){for(let ne=0;ne<X.locationSize;ne++)w(X.location+ne,ve.meshPerAttribute);B.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=ve.meshPerAttribute*ve.count)}else for(let ne=0;ne<X.locationSize;ne++)b(X.location+ne);r.bindBuffer(34962,P);for(let ne=0;ne<X.locationSize;ne++)R(X.location+ne,Le/X.locationSize,Z,pe,Le*ae,Le/X.locationSize*ne*ae)}}else if(he!==void 0){let pe=he[Y];if(pe!==void 0)switch(pe.length){case 2:r.vertexAttrib2fv(X.location,pe);break;case 3:r.vertexAttrib3fv(X.location,pe);break;case 4:r.vertexAttrib4fv(X.location,pe);break;default:r.vertexAttrib1fv(X.location,pe)}}}}D()}function T(){C();for(let B in a){let z=a[B];for(let O in z){let V=z[O];for(let q in V)p(V[q].object),delete V[q];delete z[O]}delete a[B]}}function U(B){if(a[B.id]===void 0)return;let z=a[B.id];for(let O in z){let V=z[O];for(let q in V)p(V[q].object),delete V[q];delete z[O]}delete a[B.id]}function F(B){for(let z in a){let O=a[z];if(O[B.id]===void 0)continue;let V=O[B.id];for(let q in V)p(V[q].object),delete V[q];delete O[B.id]}}function C(){j(),u!==l&&(u=l,h(u.object))}function j(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:c,reset:C,resetDefaultState:j,dispose:T,releaseStatesOfGeometry:U,releaseStatesOfProgram:F,initAttributes:m,enableAttribute:b,disableUnusedAttributes:D}}function f5(r,e,t,n){let i=n.isWebGL2,o;function s(u){o=u}function a(u,c){r.drawArrays(o,u,c),t.update(c,o,1)}function l(u,c,f){if(f===0)return;let h,p;if(i)h=r,p="drawArraysInstanced";else if(h=e.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",h===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}h[p](o,u,c,f),t.update(c,o,f)}this.setMode=s,this.render=a,this.renderInstances=l}function p5(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){let L=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function o(L){if(L==="highp"){if(r.getShaderPrecisionFormat(35633,36338).precision>0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";L="mediump"}return L==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let s=typeof WebGL2RenderingContext!="undefined"&&r instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&r instanceof WebGL2ComputeRenderingContext,a=t.precision!==void 0?t.precision:"highp",l=o(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);let u=s||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,f=r.getParameter(34930),h=r.getParameter(35660),p=r.getParameter(3379),d=r.getParameter(34076),g=r.getParameter(34921),x=r.getParameter(36347),y=r.getParameter(36348),m=r.getParameter(36349),b=h>0,w=s||e.has("OES_texture_float"),D=b&&w,R=s?r.getParameter(36183):0;return{isWebGL2:s,drawBuffers:u,getMaxAnisotropy:i,getMaxPrecision:o,precision:a,logarithmicDepthBuffer:c,maxTextures:f,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:d,maxAttributes:g,maxVertexUniforms:x,maxVaryings:y,maxFragmentUniforms:m,vertexTextures:b,floatFragmentTextures:w,floatVertexTextures:D,maxSamples:R}}function d5(r){let e=this,t=null,n=0,i=!1,o=!1,s=new Fi,a=new Qt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h,p){let d=f.length!==0||h||n!==0||i;return i=h,t=c(f,p,0),n=f.length,d},this.beginShadows=function(){o=!0,c(null)},this.endShadows=function(){o=!1,u()},this.setState=function(f,h,p){let d=f.clippingPlanes,g=f.clipIntersection,x=f.clipShadows,y=r.get(f);if(!i||d===null||d.length===0||o&&!x)o?c(null):u();else{let m=o?0:n,b=m*4,w=y.clippingState||null;l.value=w,w=c(d,h,b,p);for(let D=0;D!==b;++D)w[D]=t[D];y.clippingState=w,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=m}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(f,h,p,d){let g=f!==null?f.length:0,x=null;if(g!==0){if(x=l.value,d!==!0||x===null){let y=p+g*4,m=h.matrixWorldInverse;a.getNormalMatrix(m),(x===null||x.length<y)&&(x=new Float32Array(y));for(let b=0,w=p;b!==g;++b,w+=4)s.copy(f[b]).applyMatrix4(m,a),s.normal.toArray(x,w),x[w+3]=s.constant}l.value=x,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,x}}function m5(r){let e=new WeakMap;function t(s,a){return a===_u?s.mapping=ts:a===Cu&&(s.mapping=ns),s}function n(s){if(s&&s.isTexture&&s.isRenderTargetTexture===!1){let a=s.mapping;if(a===_u||a===Cu)if(e.has(s)){let l=e.get(s).texture;return t(l,s.mapping)}else{let l=s.image;if(l&&l.height>0){let u=r.getRenderTarget(),c=new Zu(l.height/2);return c.fromEquirectangularTexture(r,s),e.set(s,c),r.setRenderTarget(u),s.addEventListener("dispose",i),t(c.texture,s.mapping)}else return null}}return s}function i(s){let a=s.target;a.removeEventListener("dispose",i);let l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function o(){e=new WeakMap}return{get:n,dispose:o}}function g5(r){return r===void 0||r.type!==mr?!1:r.encoding===Pn||r.encoding===Ou||r.encoding===Ef}function y5(){let r=[],e=[],t=[],n=mo;for(let i=0;i<g3;i++){let o=Math.pow(2,n);e.push(o);let s=1/o;i>mo-Xa?s=m3[i-mo+Xa-1]:i==0&&(s=0),t.push(s);let a=1/(o-1),l=-a/2,u=1+a/2,c=[l,l,u,l,u,u,l,l,u,u,l,u],f=6,h=6,p=3,d=2,g=1,x=new Float32Array(p*h*f),y=new Float32Array(d*h*f),m=new Float32Array(g*h*f);for(let w=0;w<f;w++){let D=w%3*2/3-1,R=w>2?0:-1,L=[D,R,0,D+2/3,R,0,D+2/3,R+1,0,D,R,0,D+2/3,R+1,0,D,R+1,0];x.set(L,p*h*w),y.set(c,d*h*w);let T=[w,w,w,w,w,w];m.set(T,g*h*w)}let b=new Pe;b.setAttribute("position",new qe(x,p)),b.setAttribute("uv",new qe(y,d)),b.setAttribute("faceIndex",new qe(m,g)),r.push(b),n>Xa&&n--}return{_lodPlanes:r,_sizeLods:e,_sigmas:t}}function w3(r){let e=new Qn(3*Xi,3*Xi,r);return e.texture.mapping=Ma,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Kf(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function v5(r){let e=new Float32Array(r),t=new M(0,1,0);return new ms({name:"SphericalGaussianBlur",defines:{n:r},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t},inputEncoding:{value:gs[Pn]},outputEncoding:{value:gs[Pn]}},vertexShader:Wg(),fragmentShader:`
|
|
1050
|
+
</svg>`});var bw,Sw=oe(()=>{bw={id:"square1",fullName:"Square-1",inventedBy:["Karel Hr\u0161el","Vojtech Kopsk\xFD"],inventionYear:1990,def:async()=>(await Promise.resolve().then(()=>(vw(),yw))).sq1HyperOrbitKPuzzle,svg:async()=>(await Promise.resolve().then(()=>(ww(),xw))).default}});var k0={};_t(k0,{cube2x2x2:()=>vf,cube3x3x3:()=>no,experimentalCube3x3x3KPuzzle:()=>Ye,experimentalCubeAppearance:()=>Hn,experimentalCustomPGPuzzleLoader:()=>gf,experimentalGetFaceletAppearance:()=>Au,puzzles:()=>Ot,wcaEventInfo:()=>MM});function MM(r){return EM[r]??null}var Ot,EM,qn=oe(()=>{Nx();Ht();La();$o();Qx();Jx();rw();lw();fw();gw();Sw();Mu();Ot={"3x3x3":no,"2x2x2":vf,"4x4x4":Aa("4x4x4","4\xD74\xD74 Cube"),"5x5x5":Aa("5x5x5","5\xD75\xD75 Cube"),"6x6x6":Aa("6x6x6","6\xD76\xD76 Cube"),"7x7x7":Aa("7x7x7","7\xD77\xD77 Cube"),"40x40x40":Aa("40x40x40","40\xD740\xD740 Cube"),clock:iw,megaminx:Tu,pyraminx:mw,skewb:Jo("skewb","Skewb",{inventedBy:["Tony Durham"]}),square1:bw,fto:P0,gigaminx:Jo("gigaminx","Gigaminx",{inventedBy:["Tyler Fox"],inventionYear:2006}),master_tetraminx:Jo("master tetraminx","Master Tetraminx",{inventedBy:["Katsuhiko Okamoto"],inventionYear:2002})},EM={"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"}}});var V1={};_t(V1,{ACESFilmicToneMapping:()=>Kw,AddEquation:()=>es,AddOperation:()=>jw,AdditiveAnimationBlendMode:()=>ng,AdditiveBlending:()=>U0,AlphaFormat:()=>rb,AlwaysDepth:()=>Nw,AlwaysStencilFunc:()=>Zb,AmbientLight:()=>Op,AmbientLightProbe:()=>D1,AnimationClip:()=>Sl,AnimationLoader:()=>DS,AnimationMixer:()=>C1,AnimationObjectGroup:()=>_1,AnimationUtils:()=>Ct,ArcCurve:()=>gp,ArrayCamera:()=>$f,ArrowHelper:()=>cL,Audio:()=>qp,AudioAnalyser:()=>M1,AudioContext:()=>S1,AudioListener:()=>NS,AudioLoader:()=>L1,AxesHelper:()=>W1,AxisHelper:()=>h_,BackSide:()=>At,BasicDepthPacking:()=>Yb,BasicShadowMap:()=>_M,BinaryTextureLoader:()=>g_,Bone:()=>cc,BooleanKeyframeTrack:()=>Lo,BoundingBoxHelper:()=>f_,Box2:()=>Fs,Box3:()=>Yn,Box3Helper:()=>aL,BoxBufferGeometry:()=>Ti,BoxGeometry:()=>Ti,BoxHelper:()=>O1,BufferAttribute:()=>qe,BufferGeometry:()=>Pe,BufferGeometryLoader:()=>w1,ByteType:()=>Jw,Cache:()=>As,Camera:()=>Va,CameraHelper:()=>sL,CanvasRenderer:()=>v_,CanvasTexture:()=>$g,CatmullRomCurve3:()=>vp,CineonToneMapping:()=>Xw,CircleBufferGeometry:()=>sl,CircleGeometry:()=>sl,ClampToEdgeWrapping:()=>mn,Clock:()=>E1,Color:()=>xe,ColorKeyframeTrack:()=>Pp,CompressedTexture:()=>hp,CompressedTextureLoader:()=>ES,ConeBufferGeometry:()=>al,ConeGeometry:()=>al,CubeCamera:()=>Ku,CubeReflectionMapping:()=>ts,CubeRefractionMapping:()=>ns,CubeTexture:()=>ps,CubeTextureLoader:()=>p1,CubeUVReflectionMapping:()=>Ma,CubeUVRefractionMapping:()=>Pu,CubicBezierCurve:()=>mc,CubicBezierCurve3:()=>xp,CubicInterpolant:()=>c1,CullFaceBack:()=>B0,CullFaceFront:()=>Aw,CullFaceFrontBack:()=>FM,CullFaceNone:()=>Lw,Curve:()=>Xn,CurvePath:()=>a1,CustomBlending:()=>Ew,CustomToneMapping:()=>Zw,CylinderBufferGeometry:()=>bo,CylinderGeometry:()=>bo,Cylindrical:()=>jS,DataTexture:()=>vo,DataTexture2DArray:()=>$u,DataTexture3D:()=>Zf,DataTextureLoader:()=>d1,DataUtils:()=>pL,DecrementStencilOp:()=>WM,DecrementWrapStencilOp:()=>HM,DefaultLoadingManager:()=>AS,DepthFormat:()=>oo,DepthStencilFormat:()=>ss,DepthTexture:()=>ic,DirectionalLight:()=>Np,DirectionalLightHelper:()=>oL,DiscreteInterpolant:()=>h1,DodecahedronBufferGeometry:()=>ll,DodecahedronGeometry:()=>ll,DoubleSide:()=>jn,DstAlphaFactor:()=>Pw,DstColorFactor:()=>Bw,DynamicBufferAttribute:()=>t_,DynamicCopyUsage:()=>rR,DynamicDrawUsage:()=>Fa,DynamicReadUsage:()=>tR,EdgesGeometry:()=>mp,EdgesHelper:()=>p_,EllipseCurve:()=>ul,EqualDepth:()=>Gw,EqualStencilFunc:()=>YM,EquirectangularReflectionMapping:()=>_u,EquirectangularRefractionMapping:()=>Cu,Euler:()=>xn,EventDispatcher:()=>gr,ExtrudeBufferGeometry:()=>Ji,ExtrudeGeometry:()=>Ji,FaceColors:()=>HF,FileLoader:()=>ki,FlatShading:()=>I0,Float16BufferAttribute:()=>_g,Float32Attribute:()=>u_,Float32BufferAttribute:()=>Te,Float64Attribute:()=>c_,Float64BufferAttribute:()=>Cg,FloatType:()=>Qi,Fog:()=>el,FogExp2:()=>$a,Font:()=>D_,FontLoader:()=>A_,FrontSide:()=>ji,Frustum:()=>Qa,GLBufferAttribute:()=>k1,GLSL1:()=>sR,GLSL3:()=>sg,GammaEncoding:()=>Ef,GreaterDepth:()=>Vw,GreaterEqualDepth:()=>Ww,GreaterEqualStencilFunc:()=>JM,GreaterStencilFunc:()=>KM,GridHelper:()=>N1,Group:()=>gi,HalfFloatType:()=>rs,HemisphereLight:()=>Bp,HemisphereLightHelper:()=>tL,HemisphereLightProbe:()=>A1,IcosahedronBufferGeometry:()=>pl,IcosahedronGeometry:()=>pl,ImageBitmapLoader:()=>b1,ImageLoader:()=>Ll,ImageUtils:()=>so,ImmediateRenderObject:()=>E_,IncrementStencilOp:()=>GM,IncrementWrapStencilOp:()=>VM,InstancedBufferAttribute:()=>xo,InstancedBufferGeometry:()=>Vp,InstancedInterleavedBuffer:()=>P1,InstancedMesh:()=>sp,Int16Attribute:()=>o_,Int16BufferAttribute:()=>Tg,Int32Attribute:()=>a_,Int32BufferAttribute:()=>Fg,Int8Attribute:()=>n_,Int8BufferAttribute:()=>Eg,IntType:()=>eb,InterleavedBuffer:()=>yo,InterleavedBufferAttribute:()=>Ar,Interpolant:()=>$i,InterpolateDiscrete:()=>Iu,InterpolateLinear:()=>Uu,InterpolateSmooth:()=>Af,InvertStencilOp:()=>qM,JSONLoader:()=>x_,KeepStencilOp:()=>Rf,KeyframeTrack:()=>yi,LOD:()=>Xg,LatheBufferGeometry:()=>dl,LatheGeometry:()=>dl,Layers:()=>zf,LensFlare:()=>b_,LessDepth:()=>Ow,LessEqualDepth:()=>wf,LessEqualStencilFunc:()=>XM,LessStencilFunc:()=>QM,Light:()=>vi,LightProbe:()=>Al,Line:()=>Ki,Line3:()=>z1,LineBasicMaterial:()=>Jt,LineCurve:()=>cl,LineCurve3:()=>o1,LineDashedMaterial:()=>_p,LineLoop:()=>lp,LinePieces:()=>WF,LineSegments:()=>Bn,LineStrip:()=>GF,LinearEncoding:()=>Pn,LinearFilter:()=>Kt,LinearInterpolant:()=>Cp,LinearMipMapLinearFilter:()=>zM,LinearMipMapNearestFilter:()=>BM,LinearMipmapLinearFilter:()=>is,LinearMipmapNearestFilter:()=>q0,LinearToneMapping:()=>Qw,Loader:()=>Mn,LoaderUtils:()=>Dc,LoadingManager:()=>kp,LoopOnce:()=>Hb,LoopPingPong:()=>jb,LoopRepeat:()=>qb,LuminanceAlphaFormat:()=>sb,LuminanceFormat:()=>ob,MOUSE:()=>RM,Material:()=>Zt,MaterialLoader:()=>x1,Math:()=>wR,MathUtils:()=>wR,Matrix3:()=>Qt,Matrix4:()=>Ae,MaxEquation:()=>W0,Mesh:()=>Lt,MeshBasicMaterial:()=>vt,MeshDepthMaterial:()=>tc,MeshDistanceMaterial:()=>nc,MeshFaceMaterial:()=>jF,MeshLambertMaterial:()=>Tp,MeshMatcapMaterial:()=>Fp,MeshNormalMaterial:()=>Rp,MeshPhongMaterial:()=>Ep,MeshPhysicalMaterial:()=>Dp,MeshStandardMaterial:()=>Sc,MeshToonMaterial:()=>Mp,MinEquation:()=>G0,MirroredRepeatWrapping:()=>Bu,MixOperation:()=>qw,MultiMaterial:()=>QF,MultiplyBlending:()=>O0,MultiplyOperation:()=>Fu,NearestFilter:()=>jt,NearestMipMapLinearFilter:()=>kM,NearestMipMapNearestFilter:()=>PM,NearestMipmapLinearFilter:()=>Lf,NearestMipmapNearestFilter:()=>Sf,NeverDepth:()=>Uw,NeverStencilFunc:()=>jM,NoBlending:()=>dr,NoColors:()=>VF,NoToneMapping:()=>io,NormalAnimationBlendMode:()=>Df,NormalBlending:()=>Ea,NotEqualDepth:()=>Hw,NotEqualStencilFunc:()=>ZM,NumberKeyframeTrack:()=>wl,Object3D:()=>je,ObjectLoader:()=>_S,ObjectSpaceNormalMap:()=>Kb,OctahedronBufferGeometry:()=>ws,OctahedronGeometry:()=>ws,OneFactor:()=>Fw,OneMinusDstAlphaFactor:()=>kw,OneMinusDstColorFactor:()=>zw,OneMinusSrcAlphaFactor:()=>H0,OneMinusSrcColorFactor:()=>Cw,OrthographicCamera:()=>Ya,PCFShadowMap:()=>z0,PCFSoftShadowMap:()=>Dw,PMREMGenerator:()=>Wg,ParametricGeometry:()=>S_,Particle:()=>XF,ParticleBasicMaterial:()=>JF,ParticleSystem:()=>KF,ParticleSystemMaterial:()=>$F,Path:()=>hl,PerspectiveCamera:()=>Gt,Plane:()=>Fi,PlaneBufferGeometry:()=>ds,PlaneGeometry:()=>ds,PlaneHelper:()=>lL,PointCloud:()=>YF,PointCloudMaterial:()=>ZF,PointLight:()=>Up,PointLightHelper:()=>JS,Points:()=>ol,PointsMaterial:()=>wo,PolarGridHelper:()=>nL,PolyhedronBufferGeometry:()=>Zi,PolyhedronGeometry:()=>Zi,PositionalAudio:()=>GS,PropertyBinding:()=>ut,PropertyMixer:()=>R1,QuadraticBezierCurve:()=>gc,QuadraticBezierCurve3:()=>yc,Quaternion:()=>ot,QuaternionKeyframeTrack:()=>Ls,QuaternionLinearInterpolant:()=>f1,REVISION:()=>xf,RGBADepthPacking:()=>Xb,RGBAFormat:()=>gn,RGBAIntegerFormat:()=>pb,RGBA_ASTC_10x10_Format:()=>Eb,RGBA_ASTC_10x5_Format:()=>Lb,RGBA_ASTC_10x6_Format:()=>Ab,RGBA_ASTC_10x8_Format:()=>Db,RGBA_ASTC_12x10_Format:()=>Mb,RGBA_ASTC_12x12_Format:()=>Rb,RGBA_ASTC_4x4_Format:()=>mb,RGBA_ASTC_5x4_Format:()=>gb,RGBA_ASTC_5x5_Format:()=>yb,RGBA_ASTC_6x5_Format:()=>vb,RGBA_ASTC_6x6_Format:()=>xb,RGBA_ASTC_8x5_Format:()=>wb,RGBA_ASTC_8x6_Format:()=>bb,RGBA_ASTC_8x8_Format:()=>Sb,RGBA_BPTC_Format:()=>Tb,RGBA_ETC2_EAC_Format:()=>tg,RGBA_PVRTC_2BPPV1_Format:()=>$0,RGBA_PVRTC_4BPPV1_Format:()=>J0,RGBA_S3TC_DXT1_Format:()=>Q0,RGBA_S3TC_DXT3_Format:()=>Y0,RGBA_S3TC_DXT5_Format:()=>X0,RGBDEncoding:()=>og,RGBEEncoding:()=>Mf,RGBEFormat:()=>ab,RGBFormat:()=>ro,RGBIntegerFormat:()=>fb,RGBM16Encoding:()=>rg,RGBM7Encoding:()=>ig,RGB_ETC1_Format:()=>db,RGB_ETC2_Format:()=>eg,RGB_PVRTC_2BPPV1_Format:()=>Z0,RGB_PVRTC_4BPPV1_Format:()=>K0,RGB_S3TC_DXT1_Format:()=>j0,RGFormat:()=>cb,RGIntegerFormat:()=>hb,RawShaderMaterial:()=>ms,Ray:()=>wr,Raycaster:()=>HS,RectAreaLight:()=>Gp,RedFormat:()=>lb,RedIntegerFormat:()=>ub,ReinhardToneMapping:()=>Yw,RepeatWrapping:()=>ku,ReplaceStencilOp:()=>OM,ReverseSubtractEquation:()=>Rw,RingBufferGeometry:()=>ml,RingGeometry:()=>ml,SRGB8_ALPHA8_ASTC_10x10_Format:()=>Gb,SRGB8_ALPHA8_ASTC_10x5_Format:()=>Ub,SRGB8_ALPHA8_ASTC_10x6_Format:()=>Nb,SRGB8_ALPHA8_ASTC_10x8_Format:()=>Ob,SRGB8_ALPHA8_ASTC_12x10_Format:()=>Wb,SRGB8_ALPHA8_ASTC_12x12_Format:()=>Vb,SRGB8_ALPHA8_ASTC_4x4_Format:()=>Fb,SRGB8_ALPHA8_ASTC_5x4_Format:()=>_b,SRGB8_ALPHA8_ASTC_5x5_Format:()=>Cb,SRGB8_ALPHA8_ASTC_6x5_Format:()=>Pb,SRGB8_ALPHA8_ASTC_6x6_Format:()=>kb,SRGB8_ALPHA8_ASTC_8x5_Format:()=>Bb,SRGB8_ALPHA8_ASTC_8x6_Format:()=>zb,SRGB8_ALPHA8_ASTC_8x8_Format:()=>Ib,Scene:()=>xs,SceneUtils:()=>w_,ShaderChunk:()=>$e,ShaderLib:()=>_i,ShaderMaterial:()=>Yi,ShadowMaterial:()=>Ap,Shape:()=>Ci,ShapeBufferGeometry:()=>bs,ShapeGeometry:()=>bs,ShapePath:()=>hL,ShapeUtils:()=>Pi,ShortType:()=>$w,Skeleton:()=>hc,SkeletonHelper:()=>U1,SkinnedMesh:()=>uc,SmoothShading:()=>CM,Sphere:()=>vr,SphereBufferGeometry:()=>Ss,SphereGeometry:()=>Ss,Spherical:()=>Mc,SphericalHarmonics3:()=>Wp,SplineCurve:()=>vc,SpotLight:()=>Ip,SpotLightHelper:()=>KS,Sprite:()=>lc,SpriteMaterial:()=>rc,SrcAlphaFactor:()=>V0,SrcAlphaSaturateFactor:()=>Iw,SrcColorFactor:()=>_w,StaticCopyUsage:()=>iR,StaticDrawUsage:()=>Ta,StaticReadUsage:()=>eR,StereoCamera:()=>zS,StreamCopyUsage:()=>oR,StreamDrawUsage:()=>$M,StreamReadUsage:()=>nR,StringKeyframeTrack:()=>Ao,SubtractEquation:()=>Mw,SubtractiveBlending:()=>N0,TOUCH:()=>TM,TangentSpaceNormalMap:()=>us,TetrahedronBufferGeometry:()=>gl,TetrahedronGeometry:()=>gl,TextGeometry:()=>L_,Texture:()=>Yt,TextureLoader:()=>Lc,TorusBufferGeometry:()=>yl,TorusGeometry:()=>yl,TorusKnotBufferGeometry:()=>vl,TorusKnotGeometry:()=>vl,Triangle:()=>It,TriangleFanDrawMode:()=>UM,TriangleStripDrawMode:()=>IM,TrianglesDrawMode:()=>Qb,TubeBufferGeometry:()=>xl,TubeGeometry:()=>xl,UVMapping:()=>bf,Uint16Attribute:()=>s_,Uint16BufferAttribute:()=>Qu,Uint32Attribute:()=>l_,Uint32BufferAttribute:()=>Yu,Uint8Attribute:()=>i_,Uint8BufferAttribute:()=>Mg,Uint8ClampedAttribute:()=>r_,Uint8ClampedBufferAttribute:()=>Rg,Uniform:()=>Ec,UniformsLib:()=>we,UniformsUtils:()=>d3,UnsignedByteType:()=>mr,UnsignedInt248Type:()=>os,UnsignedIntType:()=>zu,UnsignedShort4444Type:()=>tb,UnsignedShort5551Type:()=>nb,UnsignedShort565Type:()=>ib,UnsignedShortType:()=>Ra,VSMShadowMap:()=>Da,Vector2:()=>ee,Vector3:()=>M,Vector4:()=>xt,VectorKeyframeTrack:()=>bl,Vertex:()=>e_,VertexColors:()=>qF,VideoTexture:()=>Jg,WebGL1Renderer:()=>Qg,WebGLCubeRenderTarget:()=>Zu,WebGLMultipleRenderTargets:()=>cg,WebGLMultisampleRenderTarget:()=>Vu,WebGLRenderTarget:()=>Qn,WebGLRenderTargetCube:()=>y_,WebGLRenderer:()=>ft,WebGLUtils:()=>X3,WireframeGeometry:()=>Lp,WireframeHelper:()=>d_,WrapAroundEnding:()=>Nu,XHRLoader:()=>m_,ZeroCurvatureEnding:()=>as,ZeroFactor:()=>Tw,ZeroSlopeEnding:()=>ls,ZeroStencilOp:()=>NM,sRGBEncoding:()=>Ou});function oi(){let r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(yn[r&255]+yn[r>>8&255]+yn[r>>16&255]+yn[r>>24&255]+"-"+yn[e&255]+yn[e>>8&255]+"-"+yn[e>>16&15|64]+yn[e>>24&255]+"-"+yn[t&63|128]+yn[t>>8&255]+"-"+yn[t>>16&255]+yn[t>>24&255]+yn[n&255]+yn[n>>8&255]+yn[n>>16&255]+yn[n>>24&255]).toUpperCase()}function vn(r,e,t){return Math.max(e,Math.min(t,r))}function ag(r,e){return(r%e+e)%e}function aR(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function lR(r,e,t){return r!==e?(t-r)/(e-r):0}function Wu(r,e,t){return(1-t)*r+t*e}function uR(r,e,t,n){return Wu(r,e,1-Math.exp(-t*n))}function cR(r,e=1){return e-Math.abs(ag(r,e*2)-e)}function hR(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function fR(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function pR(r,e){return r+Math.floor(Math.random()*(e-r+1))}function dR(r,e){return r+Math.random()*(e-r)}function mR(r){return r*(.5-Math.random())}function gR(r){return r!==void 0&&(Tf=r%2147483647),Tf=Tf*16807%2147483647,(Tf-1)/2147483646}function yR(r){return r*cs}function vR(r){return r*Gu}function lg(r){return(r&r-1)==0&&r!==0}function Jb(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function $b(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function xR(r,e,t,n,i){let o=Math.cos,s=Math.sin,a=o(t/2),l=s(t/2),u=o((e+n)/2),c=s((e+n)/2),f=o((e-n)/2),h=s((e-n)/2),p=o((n-e)/2),d=s((n-e)/2);switch(i){case"XYX":r.set(a*c,l*f,l*h,a*u);break;case"YZY":r.set(l*h,a*c,l*f,a*u);break;case"ZXZ":r.set(l*f,l*h,a*c,a*u);break;case"XZX":r.set(a*c,l*d,l*p,a*u);break;case"YXY":r.set(l*p,a*c,l*d,a*u);break;case"ZYZ":r.set(l*d,l*p,a*c,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function e3(r){if(r.length===0)return-1/0;let e=r[0];for(let t=1,n=r.length;t<n;++t)r[t]>e&&(e=r[t]);return e}function _a(r,e){return new bR[r](e)}function Ff(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function t3(r,e=0){let t=3735928559^e,n=1103547991^e;for(let i=0,o;i<r.length;i++)o=r.charCodeAt(i),t=Math.imul(t^o,2654435761),n=Math.imul(n^o,1597334677);return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}function ug(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?so.getDataURL(r):r.data?{data:Array.prototype.slice.call(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}function pg(r,e,t,n,i){for(let o=0,s=r.length-3;o<=s;o+=3){fs.fromArray(r,o);let a=i.x*Math.abs(fs.x)+i.y*Math.abs(fs.y)+i.z*Math.abs(fs.z),l=e.dot(fs),u=t.dot(fs),c=n.dot(fs);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>a)return!1}return!0}function Lg(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}function Ag(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Dg(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}function CR(r,e,t,n,i,o,s,a){let l;if(e.side===At?l=n.intersectTriangle(s,o,i,!0,a):l=n.intersectTriangle(i,o,s,e.side!==jn,a),l===null)return null;jf.copy(a),jf.applyMatrix4(r.matrixWorld);let u=t.ray.origin.distanceTo(jf);return u<t.near||u>t.far?null:{distance:u,point:jf.clone(),object:r}}function Qf(r,e,t,n,i,o,s,a,l,u,c,f){ho.fromBufferAttribute(i,u),fo.fromBufferAttribute(i,c),po.fromBufferAttribute(i,f);let h=r.morphTargetInfluences;if(o&&h){Of.set(0,0,0),Gf.set(0,0,0),Wf.set(0,0,0);for(let d=0,g=o.length;d<g;d++){let x=h[d],y=o[d];x!==0&&(Bg.fromBufferAttribute(y,u),zg.fromBufferAttribute(y,c),Ig.fromBufferAttribute(y,f),s?(Of.addScaledVector(Bg,x),Gf.addScaledVector(zg,x),Wf.addScaledVector(Ig,x)):(Of.addScaledVector(Bg.sub(ho),x),Gf.addScaledVector(zg.sub(fo),x),Wf.addScaledVector(Ig.sub(po),x)))}ho.add(Of),fo.add(Gf),po.add(Wf)}r.isSkinnedMesh&&(r.boneTransform(u,ho),r.boneTransform(c,fo),r.boneTransform(f,po));let p=CR(r,e,t,n,ho,fo,po,Ug);if(p){a&&(Vf.fromBufferAttribute(a,u),Hf.fromBufferAttribute(a,c),qf.fromBufferAttribute(a,f),p.uv=It.getUV(Ug,ho,fo,po,Vf,Hf,qf,new ee)),l&&(Vf.fromBufferAttribute(l,u),Hf.fromBufferAttribute(l,c),qf.fromBufferAttribute(l,f),p.uv2=It.getUV(Ug,ho,fo,po,Vf,Hf,qf,new ee));let d={a:u,b:c,c:f,normal:new M,materialIndex:0};It.getNormal(ho,fo,po,d.normal),p.face=d}return p}function Wa(r){let e={};for(let t in r){e[t]={};for(let n in r[t]){let i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function Dn(r){let e={};for(let t=0;t<r.length;t++){let n=Wa(r[t]);for(let i in n)e[i]=n[i]}return e}function m3(){let r=null,e=!1,t=null,n=null;function i(o,s){t(o,s),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){r=o}}}function IR(r,e){let t=e.isWebGL2,n=new WeakMap;function i(u,c){let f=u.array,h=u.usage,p=r.createBuffer();r.bindBuffer(c,p),r.bufferData(c,f,h),u.onUploadCallback();let d=5126;return f instanceof Float32Array?d=5126:f instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):f instanceof Uint16Array?u.isFloat16BufferAttribute?t?d=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):d=5123:f instanceof Int16Array?d=5122:f instanceof Uint32Array?d=5125:f instanceof Int32Array?d=5124:f instanceof Int8Array?d=5120:(f instanceof Uint8Array||f instanceof Uint8ClampedArray)&&(d=5121),{buffer:p,type:d,bytesPerElement:f.BYTES_PER_ELEMENT,version:u.version}}function o(u,c,f){let h=c.array,p=c.updateRange;r.bindBuffer(f,u),p.count===-1?r.bufferSubData(f,0,h):(t?r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count):r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h.subarray(p.offset,p.offset+p.count)),p.count=-1)}function s(u){return u.isInterleavedBufferAttribute&&(u=u.data),n.get(u)}function a(u){u.isInterleavedBufferAttribute&&(u=u.data);let c=n.get(u);c&&(r.deleteBuffer(c.buffer),n.delete(u))}function l(u,c){if(u.isGLBufferAttribute){let h=n.get(u);(!h||h.version<u.version)&&n.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}u.isInterleavedBufferAttribute&&(u=u.data);let f=n.get(u);f===void 0?n.set(u,i(u,c)):f.version<u.version&&(o(f.buffer,u,c),f.version=u.version)}return{get:s,remove:a,update:l}}function c5(r,e,t,n,i){let o=new xe(0),s=0,a,l,u=null,c=0,f=null;function h(d,g){let x=!1,y=g.isScene===!0?g.background:null;y&&y.isTexture&&(y=e.get(y));let m=r.xr,b=m.getSession&&m.getSession();b&&b.environmentBlendMode==="additive"&&(y=null),y===null?p(o,s):y&&y.isColor&&(p(y,1),x=!0),(r.autoClear||x)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),y&&(y.isCubeTexture||y.mapping===Ma)?(l===void 0&&(l=new Lt(new Ti(1,1,1),new Yi({name:"BackgroundCubeMaterial",uniforms:Wa(_i.cube.uniforms),vertexShader:_i.cube.vertexShader,fragmentShader:_i.cube.fragmentShader,side:At,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(w,D,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=y,l.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,(u!==y||c!==y.version||f!==r.toneMapping)&&(l.material.needsUpdate=!0,u=y,c=y.version,f=r.toneMapping),d.unshift(l,l.geometry,l.material,0,0,null)):y&&y.isTexture&&(a===void 0&&(a=new Lt(new ds(2,2),new Yi({name:"BackgroundMaterial",uniforms:Wa(_i.background.uniforms),vertexShader:_i.background.vertexShader,fragmentShader:_i.background.fragmentShader,side:ji,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(a)),a.material.uniforms.t2D.value=y,y.matrixAutoUpdate===!0&&y.updateMatrix(),a.material.uniforms.uvTransform.value.copy(y.matrix),(u!==y||c!==y.version||f!==r.toneMapping)&&(a.material.needsUpdate=!0,u=y,c=y.version,f=r.toneMapping),d.unshift(a,a.geometry,a.material,0,0,null))}function p(d,g){t.buffers.color.setClear(d.r,d.g,d.b,g,i)}return{getClearColor:function(){return o},setClearColor:function(d,g=1){o.set(d),s=g,p(o,s)},getClearAlpha:function(){return s},setClearAlpha:function(d){s=d,p(o,s)},render:h}}function h5(r,e,t,n){let i=r.getParameter(34921),o=n.isWebGL2?null:e.get("OES_vertex_array_object"),s=n.isWebGL2||o!==null,a={},l=g(null),u=l;function c(B,z,O,V,q){let se=!1;if(s){let he=d(V,O,z);u!==he&&(u=he,h(u.object)),se=x(V,q),se&&y(V,q)}else{let he=z.wireframe===!0;(u.geometry!==V.id||u.program!==O.id||u.wireframe!==he)&&(u.geometry=V.id,u.program=O.id,u.wireframe=he,se=!0)}B.isInstancedMesh===!0&&(se=!0),q!==null&&t.update(q,34963),se&&(L(B,z,O,V),q!==null&&r.bindBuffer(34963,t.get(q).buffer))}function f(){return n.isWebGL2?r.createVertexArray():o.createVertexArrayOES()}function h(B){return n.isWebGL2?r.bindVertexArray(B):o.bindVertexArrayOES(B)}function p(B){return n.isWebGL2?r.deleteVertexArray(B):o.deleteVertexArrayOES(B)}function d(B,z,O){let V=O.wireframe===!0,q=a[B.id];q===void 0&&(q={},a[B.id]=q);let se=q[z.id];se===void 0&&(se={},q[z.id]=se);let he=se[V];return he===void 0&&(he=g(f()),se[V]=he),he}function g(B){let z=[],O=[],V=[];for(let q=0;q<i;q++)z[q]=0,O[q]=0,V[q]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:z,enabledAttributes:O,attributeDivisors:V,object:B,attributes:{},index:null}}function x(B,z){let O=u.attributes,V=B.attributes,q=0;for(let se in V){let he=O[se],Y=V[se];if(he===void 0||he.attribute!==Y||he.data!==Y.data)return!0;q++}return u.attributesNum!==q||u.index!==z}function y(B,z){let O={},V=B.attributes,q=0;for(let se in V){let he=V[se],Y={};Y.attribute=he,he.data&&(Y.data=he.data),O[se]=Y,q++}u.attributes=O,u.attributesNum=q,u.index=z}function m(){let B=u.newAttributes;for(let z=0,O=B.length;z<O;z++)B[z]=0}function b(B){w(B,0)}function w(B,z){let O=u.newAttributes,V=u.enabledAttributes,q=u.attributeDivisors;O[B]=1,V[B]===0&&(r.enableVertexAttribArray(B),V[B]=1),q[B]!==z&&((n.isWebGL2?r:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](B,z),q[B]=z)}function D(){let B=u.newAttributes,z=u.enabledAttributes;for(let O=0,V=z.length;O<V;O++)z[O]!==B[O]&&(r.disableVertexAttribArray(O),z[O]=0)}function R(B,z,O,V,q,se){n.isWebGL2===!0&&(O===5124||O===5125)?r.vertexAttribIPointer(B,z,O,q,se):r.vertexAttribPointer(B,z,O,V,q,se)}function L(B,z,O,V){if(n.isWebGL2===!1&&(B.isInstancedMesh||V.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;m();let q=V.attributes,se=O.getAttributes(),he=z.defaultAttributeValues;for(let Y in se){let X=se[Y];if(X.location>=0){let ve=q[Y];if(ve===void 0&&(Y==="instanceMatrix"&&B.instanceMatrix&&(ve=B.instanceMatrix),Y==="instanceColor"&&B.instanceColor&&(ve=B.instanceColor)),ve!==void 0){let pe=ve.normalized,Le=ve.itemSize,Ie=t.get(ve);if(Ie===void 0)continue;let P=Ie.buffer,Z=Ie.type,ae=Ie.bytesPerElement;if(ve.isInterleavedBufferAttribute){let ne=ve.data,fe=ne.stride,W=ve.offset;if(ne&&ne.isInstancedInterleavedBuffer){for(let Q=0;Q<X.locationSize;Q++)w(X.location+Q,ne.meshPerAttribute);B.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=ne.meshPerAttribute*ne.count)}else for(let Q=0;Q<X.locationSize;Q++)b(X.location+Q);r.bindBuffer(34962,P);for(let Q=0;Q<X.locationSize;Q++)R(X.location+Q,Le/X.locationSize,Z,pe,fe*ae,(W+Le/X.locationSize*Q)*ae)}else{if(ve.isInstancedBufferAttribute){for(let ne=0;ne<X.locationSize;ne++)w(X.location+ne,ve.meshPerAttribute);B.isInstancedMesh!==!0&&V._maxInstanceCount===void 0&&(V._maxInstanceCount=ve.meshPerAttribute*ve.count)}else for(let ne=0;ne<X.locationSize;ne++)b(X.location+ne);r.bindBuffer(34962,P);for(let ne=0;ne<X.locationSize;ne++)R(X.location+ne,Le/X.locationSize,Z,pe,Le*ae,Le/X.locationSize*ne*ae)}}else if(he!==void 0){let pe=he[Y];if(pe!==void 0)switch(pe.length){case 2:r.vertexAttrib2fv(X.location,pe);break;case 3:r.vertexAttrib3fv(X.location,pe);break;case 4:r.vertexAttrib4fv(X.location,pe);break;default:r.vertexAttrib1fv(X.location,pe)}}}}D()}function T(){C();for(let B in a){let z=a[B];for(let O in z){let V=z[O];for(let q in V)p(V[q].object),delete V[q];delete z[O]}delete a[B]}}function U(B){if(a[B.id]===void 0)return;let z=a[B.id];for(let O in z){let V=z[O];for(let q in V)p(V[q].object),delete V[q];delete z[O]}delete a[B.id]}function F(B){for(let z in a){let O=a[z];if(O[B.id]===void 0)continue;let V=O[B.id];for(let q in V)p(V[q].object),delete V[q];delete O[B.id]}}function C(){j(),u!==l&&(u=l,h(u.object))}function j(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:c,reset:C,resetDefaultState:j,dispose:T,releaseStatesOfGeometry:U,releaseStatesOfProgram:F,initAttributes:m,enableAttribute:b,disableUnusedAttributes:D}}function f5(r,e,t,n){let i=n.isWebGL2,o;function s(u){o=u}function a(u,c){r.drawArrays(o,u,c),t.update(c,o,1)}function l(u,c,f){if(f===0)return;let h,p;if(i)h=r,p="drawArraysInstanced";else if(h=e.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",h===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}h[p](o,u,c,f),t.update(c,o,f)}this.setMode=s,this.render=a,this.renderInstances=l}function p5(r,e,t){let n;function i(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){let L=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function o(L){if(L==="highp"){if(r.getShaderPrecisionFormat(35633,36338).precision>0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";L="mediump"}return L==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let s=typeof WebGL2RenderingContext!="undefined"&&r instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&r instanceof WebGL2ComputeRenderingContext,a=t.precision!==void 0?t.precision:"highp",l=o(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);let u=s||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,f=r.getParameter(34930),h=r.getParameter(35660),p=r.getParameter(3379),d=r.getParameter(34076),g=r.getParameter(34921),x=r.getParameter(36347),y=r.getParameter(36348),m=r.getParameter(36349),b=h>0,w=s||e.has("OES_texture_float"),D=b&&w,R=s?r.getParameter(36183):0;return{isWebGL2:s,drawBuffers:u,getMaxAnisotropy:i,getMaxPrecision:o,precision:a,logarithmicDepthBuffer:c,maxTextures:f,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:d,maxAttributes:g,maxVertexUniforms:x,maxVaryings:y,maxFragmentUniforms:m,vertexTextures:b,floatFragmentTextures:w,floatVertexTextures:D,maxSamples:R}}function d5(r){let e=this,t=null,n=0,i=!1,o=!1,s=new Fi,a=new Qt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h,p){let d=f.length!==0||h||n!==0||i;return i=h,t=c(f,p,0),n=f.length,d},this.beginShadows=function(){o=!0,c(null)},this.endShadows=function(){o=!1,u()},this.setState=function(f,h,p){let d=f.clippingPlanes,g=f.clipIntersection,x=f.clipShadows,y=r.get(f);if(!i||d===null||d.length===0||o&&!x)o?c(null):u();else{let m=o?0:n,b=m*4,w=y.clippingState||null;l.value=w,w=c(d,h,b,p);for(let D=0;D!==b;++D)w[D]=t[D];y.clippingState=w,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=m}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(f,h,p,d){let g=f!==null?f.length:0,x=null;if(g!==0){if(x=l.value,d!==!0||x===null){let y=p+g*4,m=h.matrixWorldInverse;a.getNormalMatrix(m),(x===null||x.length<y)&&(x=new Float32Array(y));for(let b=0,w=p;b!==g;++b,w+=4)s.copy(f[b]).applyMatrix4(m,a),s.normal.toArray(x,w),x[w+3]=s.constant}l.value=x,l.needsUpdate=!0}return e.numPlanes=g,e.numIntersection=0,x}}function m5(r){let e=new WeakMap;function t(s,a){return a===_u?s.mapping=ts:a===Cu&&(s.mapping=ns),s}function n(s){if(s&&s.isTexture&&s.isRenderTargetTexture===!1){let a=s.mapping;if(a===_u||a===Cu)if(e.has(s)){let l=e.get(s).texture;return t(l,s.mapping)}else{let l=s.image;if(l&&l.height>0){let u=r.getRenderTarget(),c=new Zu(l.height/2);return c.fromEquirectangularTexture(r,s),e.set(s,c),r.setRenderTarget(u),s.addEventListener("dispose",i),t(c.texture,s.mapping)}else return null}}return s}function i(s){let a=s.target;a.removeEventListener("dispose",i);let l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function o(){e=new WeakMap}return{get:n,dispose:o}}function g5(r){return r===void 0||r.type!==mr?!1:r.encoding===Pn||r.encoding===Ou||r.encoding===Ef}function y5(){let r=[],e=[],t=[],n=mo;for(let i=0;i<y3;i++){let o=Math.pow(2,n);e.push(o);let s=1/o;i>mo-Xa?s=g3[i-mo+Xa-1]:i==0&&(s=0),t.push(s);let a=1/(o-1),l=-a/2,u=1+a/2,c=[l,l,u,l,u,u,l,l,u,u,l,u],f=6,h=6,p=3,d=2,g=1,x=new Float32Array(p*h*f),y=new Float32Array(d*h*f),m=new Float32Array(g*h*f);for(let w=0;w<f;w++){let D=w%3*2/3-1,R=w>2?0:-1,L=[D,R,0,D+2/3,R,0,D+2/3,R+1,0,D,R,0,D+2/3,R+1,0,D,R+1,0];x.set(L,p*h*w),y.set(c,d*h*w);let T=[w,w,w,w,w,w];m.set(T,g*h*w)}let b=new Pe;b.setAttribute("position",new qe(x,p)),b.setAttribute("uv",new qe(y,d)),b.setAttribute("faceIndex",new qe(m,g)),r.push(b),n>Xa&&n--}return{_lodPlanes:r,_sizeLods:e,_sigmas:t}}function b3(r){let e=new Qn(3*Xi,3*Xi,r);return e.texture.mapping=Ma,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Kf(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function v5(r){let e=new Float32Array(r),t=new M(0,1,0);return new ms({name:"SphericalGaussianBlur",defines:{n:r},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t},inputEncoding:{value:gs[Pn]},outputEncoding:{value:gs[Pn]}},vertexShader:Vg(),fragmentShader:`
|
|
1051
1051
|
|
|
1052
1052
|
precision mediump float;
|
|
1053
1053
|
precision mediump int;
|
|
@@ -1062,7 +1062,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
1062
1062
|
uniform float mipInt;
|
|
1063
1063
|
uniform vec3 poleAxis;
|
|
1064
1064
|
|
|
1065
|
-
${
|
|
1065
|
+
${Hg()}
|
|
1066
1066
|
|
|
1067
1067
|
#define ENVMAP_TYPE_CUBE_UV
|
|
1068
1068
|
#include <cube_uv_reflection_fragment>
|
|
@@ -1111,7 +1111,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
1111
1111
|
gl_FragColor = linearToOutputTexel( gl_FragColor );
|
|
1112
1112
|
|
|
1113
1113
|
}
|
|
1114
|
-
`,blending:dr,depthTest:!1,depthWrite:!1})}function
|
|
1114
|
+
`,blending:dr,depthTest:!1,depthWrite:!1})}function S3(){let r=new ee(1,1);return new ms({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:r},inputEncoding:{value:gs[Pn]},outputEncoding:{value:gs[Pn]}},vertexShader:Vg(),fragmentShader:`
|
|
1115
1115
|
|
|
1116
1116
|
precision mediump float;
|
|
1117
1117
|
precision mediump int;
|
|
@@ -1121,7 +1121,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
1121
1121
|
uniform sampler2D envMap;
|
|
1122
1122
|
uniform vec2 texelSize;
|
|
1123
1123
|
|
|
1124
|
-
${
|
|
1124
|
+
${Hg()}
|
|
1125
1125
|
|
|
1126
1126
|
#include <common>
|
|
1127
1127
|
|
|
@@ -1149,7 +1149,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
1149
1149
|
gl_FragColor = linearToOutputTexel( gl_FragColor );
|
|
1150
1150
|
|
|
1151
1151
|
}
|
|
1152
|
-
`,blending:dr,depthTest:!1,depthWrite:!1})}function
|
|
1152
|
+
`,blending:dr,depthTest:!1,depthWrite:!1})}function L3(){return new ms({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:gs[Pn]},outputEncoding:{value:gs[Pn]}},vertexShader:Vg(),fragmentShader:`
|
|
1153
1153
|
|
|
1154
1154
|
precision mediump float;
|
|
1155
1155
|
precision mediump int;
|
|
@@ -1158,7 +1158,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
1158
1158
|
|
|
1159
1159
|
uniform samplerCube envMap;
|
|
1160
1160
|
|
|
1161
|
-
${
|
|
1161
|
+
${Hg()}
|
|
1162
1162
|
|
|
1163
1163
|
void main() {
|
|
1164
1164
|
|
|
@@ -1167,7 +1167,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
1167
1167
|
gl_FragColor = linearToOutputTexel( gl_FragColor );
|
|
1168
1168
|
|
|
1169
1169
|
}
|
|
1170
|
-
`,blending:dr,depthTest:!1,depthWrite:!1})}function
|
|
1170
|
+
`,blending:dr,depthTest:!1,depthWrite:!1})}function Vg(){return`
|
|
1171
1171
|
|
|
1172
1172
|
precision mediump float;
|
|
1173
1173
|
precision mediump int;
|
|
@@ -1224,7 +1224,7 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
1224
1224
|
gl_Position = vec4( position, 1.0 );
|
|
1225
1225
|
|
|
1226
1226
|
}
|
|
1227
|
-
`}function
|
|
1227
|
+
`}function Hg(){return`
|
|
1228
1228
|
|
|
1229
1229
|
uniform int inputEncoding;
|
|
1230
1230
|
uniform int outputEncoding;
|
|
@@ -1304,37 +1304,37 @@ Vertex distance ${this.vertexdistance}`}writeSchreierSims(e){let n=this.getOrbit
|
|
|
1304
1304
|
return inputTexelToLinear( color );
|
|
1305
1305
|
|
|
1306
1306
|
}
|
|
1307
|
-
`}function x5(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){let l=a.mapping,u=l===_u||l===Cu,c=l===ts||l===ns;if(u||c){if(e.has(a))return e.get(a).texture;{let f=a.image;if(u&&f&&f.height>0||c&&f&&i(f)){let h=r.getRenderTarget();t===null&&(t=new Gg(r));let p=u?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,p),r.setRenderTarget(h),a.addEventListener("dispose",o),p.texture}else return null}}}return a}function i(a){let l=0,u=6;for(let c=0;c<u;c++)a[c]!==void 0&&l++;return l===u}function o(a){let l=a.target;l.removeEventListener("dispose",o);let u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function s(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:s}}function w5(r){let e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){let i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function b5(r,e,t,n){let i={},o=new WeakMap;function s(f){let h=f.target;h.index!==null&&e.remove(h.index);for(let d in h.attributes)e.remove(h.attributes[d]);h.removeEventListener("dispose",s),delete i[h.id];let p=o.get(h);p&&(e.remove(p),o.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function a(f,h){return i[h.id]===!0||(h.addEventListener("dispose",s),i[h.id]=!0,t.memory.geometries++),h}function l(f){let h=f.attributes;for(let d in h)e.update(h[d],34962);let p=f.morphAttributes;for(let d in p){let g=p[d];for(let x=0,y=g.length;x<y;x++)e.update(g[x],34962)}}function u(f){let h=[],p=f.index,d=f.attributes.position,g=0;if(p!==null){let m=p.array;g=p.version;for(let b=0,w=m.length;b<w;b+=3){let D=m[b+0],R=m[b+1],L=m[b+2];h.push(D,R,R,L,L,D)}}else{let m=d.array;g=d.version;for(let b=0,w=m.length/3-1;b<w;b+=3){let D=b+0,R=b+1,L=b+2;h.push(D,R,R,L,L,D)}}let x=new($b(h)>65535?Yu:Qu)(h,1);x.version=g;let y=o.get(f);y&&e.remove(y),o.set(f,x)}function c(f){let h=o.get(f);if(h){let p=f.index;p!==null&&h.version<p.version&&u(f)}else u(f);return o.get(f)}return{get:a,update:l,getWireframeAttribute:c}}function S5(r,e,t,n){let i=n.isWebGL2,o;function s(h){o=h}let a,l;function u(h){a=h.type,l=h.bytesPerElement}function c(h,p){r.drawElements(o,p,a,h*l),t.update(p,o,1)}function f(h,p,d){if(d===0)return;let g,x;if(i)g=r,x="drawElementsInstanced";else if(g=e.get("ANGLE_instanced_arrays"),x="drawElementsInstancedANGLE",g===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}g[x](o,p,a,h*l,d),t.update(p,o,d)}this.setMode=s,this.setIndex=u,this.render=c,this.renderInstances=f}function L5(r){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(o,s,a){switch(t.calls++,s){case 4:t.triangles+=a*(o/3);break;case 1:t.lines+=a*(o/2);break;case 3:t.lines+=a*(o-1);break;case 2:t.lines+=a*o;break;case 0:t.points+=a*o;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",s);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function A5(r,e){return r[0]-e[0]}function D5(r,e){return Math.abs(e[1])-Math.abs(r[1])}function L3(r,e){let t=1,n=e.isInterleavedBufferAttribute?e.data.array:e.array;n instanceof Int8Array?t=127:n instanceof Int16Array?t=32767:n instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),r.divideScalar(t)}function E5(r,e,t){let n={},i=new Float32Array(8),o=new WeakMap,s=new M,a=[];for(let u=0;u<8;u++)a[u]=[u,0];function l(u,c,f,h){let p=u.morphTargetInfluences;if(e.isWebGL2===!0){let d=c.morphAttributes.position.length,g=o.get(c);if(g===void 0||g.count!==d){g!==void 0&&g.texture.dispose();let m=c.morphAttributes.normal!==void 0,b=c.morphAttributes.position,w=c.morphAttributes.normal||[],D=c.attributes.position.count,R=m===!0?2:1,L=D*R,T=1;L>e.maxTextureSize&&(T=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);let U=new Float32Array(L*T*4*d),F=new $u(U,L,T,d);F.format=gn,F.type=Qi;let C=R*4;for(let j=0;j<d;j++){let B=b[j],z=w[j],O=L*T*4*j;for(let V=0;V<B.count;V++){s.fromBufferAttribute(B,V),B.normalized===!0&&L3(s,B);let q=V*C;U[O+q+0]=s.x,U[O+q+1]=s.y,U[O+q+2]=s.z,U[O+q+3]=0,m===!0&&(s.fromBufferAttribute(z,V),z.normalized===!0&&L3(s,z),U[O+q+4]=s.x,U[O+q+5]=s.y,U[O+q+6]=s.z,U[O+q+7]=0)}}g={count:d,texture:F,size:new ee(L,T)},o.set(c,g)}let x=0;for(let m=0;m<p.length;m++)x+=p[m];let y=c.morphTargetsRelative?1:1-x;h.getUniforms().setValue(r,"morphTargetBaseInfluence",y),h.getUniforms().setValue(r,"morphTargetInfluences",p),h.getUniforms().setValue(r,"morphTargetsTexture",g.texture,t),h.getUniforms().setValue(r,"morphTargetsTextureSize",g.size)}else{let d=p===void 0?0:p.length,g=n[c.id];if(g===void 0||g.length!==d){g=[];for(let w=0;w<d;w++)g[w]=[w,0];n[c.id]=g}for(let w=0;w<d;w++){let D=g[w];D[0]=w,D[1]=p[w]}g.sort(D5);for(let w=0;w<8;w++)w<d&&g[w][1]?(a[w][0]=g[w][0],a[w][1]=g[w][1]):(a[w][0]=Number.MAX_SAFE_INTEGER,a[w][1]=0);a.sort(A5);let x=c.morphAttributes.position,y=c.morphAttributes.normal,m=0;for(let w=0;w<8;w++){let D=a[w],R=D[0],L=D[1];R!==Number.MAX_SAFE_INTEGER&&L?(x&&c.getAttribute("morphTarget"+w)!==x[R]&&c.setAttribute("morphTarget"+w,x[R]),y&&c.getAttribute("morphNormal"+w)!==y[R]&&c.setAttribute("morphNormal"+w,y[R]),i[w]=L,m+=L):(x&&c.hasAttribute("morphTarget"+w)===!0&&c.deleteAttribute("morphTarget"+w),y&&c.hasAttribute("morphNormal"+w)===!0&&c.deleteAttribute("morphNormal"+w),i[w]=0)}let b=c.morphTargetsRelative?1:1-m;h.getUniforms().setValue(r,"morphTargetBaseInfluence",b),h.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:l}}function M5(r,e,t,n){let i=new WeakMap;function o(l){let u=n.render.frame,c=l.geometry,f=e.get(l,c);return i.get(f)!==u&&(e.update(f),i.set(f,u)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),f}function s(){i=new WeakMap}function a(l){let u=l.target;u.removeEventListener("dispose",a),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:s}}function Ja(r,e,t){let n=r[0];if(n<=0||n>0)return r;let i=e*t,o=R3[i];if(o===void 0&&(o=new Float32Array(i),R3[i]=o),e!==0){n.toArray(o,0);for(let s=1,a=0;s!==e;++s)a+=t,r[s].toArray(o,a)}return o}function kn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function En(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Jf(r,e){let t=T3[e];t===void 0&&(t=new Int32Array(e),T3[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function R5(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function T5(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(kn(t,e))return;r.uniform2fv(this.addr,e),En(t,e)}}function F5(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(kn(t,e))return;r.uniform3fv(this.addr,e),En(t,e)}}function _5(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(kn(t,e))return;r.uniform4fv(this.addr,e),En(t,e)}}function C5(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(kn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),En(t,e)}else{if(kn(t,n))return;C3.set(n),r.uniformMatrix2fv(this.addr,!1,C3),En(t,n)}}function P5(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(kn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),En(t,e)}else{if(kn(t,n))return;_3.set(n),r.uniformMatrix3fv(this.addr,!1,_3),En(t,n)}}function k5(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(kn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),En(t,e)}else{if(kn(t,n))return;F3.set(n),r.uniformMatrix4fv(this.addr,!1,F3),En(t,n)}}function B5(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function z5(r,e){let t=this.cache;kn(t,e)||(r.uniform2iv(this.addr,e),En(t,e))}function I5(r,e){let t=this.cache;kn(t,e)||(r.uniform3iv(this.addr,e),En(t,e))}function U5(r,e){let t=this.cache;kn(t,e)||(r.uniform4iv(this.addr,e),En(t,e))}function N5(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function O5(r,e){let t=this.cache;kn(t,e)||(r.uniform2uiv(this.addr,e),En(t,e))}function G5(r,e){let t=this.cache;kn(t,e)||(r.uniform3uiv(this.addr,e),En(t,e))}function W5(r,e){let t=this.cache;kn(t,e)||(r.uniform4uiv(this.addr,e),En(t,e))}function V5(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTexture2D(e||A3,i)}function H5(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||E3,i)}function q5(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTextureCube(e||M3,i)}function j5(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||D3,i)}function Q5(r){switch(r){case 5126:return R5;case 35664:return T5;case 35665:return F5;case 35666:return _5;case 35674:return C5;case 35675:return P5;case 35676:return k5;case 5124:case 35670:return B5;case 35667:case 35671:return z5;case 35668:case 35672:return I5;case 35669:case 35673:return U5;case 5125:return N5;case 36294:return O5;case 36295:return G5;case 36296:return W5;case 35678:case 36198:case 36298:case 36306:case 35682:return V5;case 35679:case 36299:case 36307:return H5;case 35680:case 36300:case 36308:case 36293:return q5;case 36289:case 36303:case 36311:case 36292:return j5}}function Y5(r,e){r.uniform1fv(this.addr,e)}function X5(r,e){let t=Ja(e,this.size,2);r.uniform2fv(this.addr,t)}function K5(r,e){let t=Ja(e,this.size,3);r.uniform3fv(this.addr,t)}function Z5(r,e){let t=Ja(e,this.size,4);r.uniform4fv(this.addr,t)}function J5(r,e){let t=Ja(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function $5(r,e){let t=Ja(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function e4(r,e){let t=Ja(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function t4(r,e){r.uniform1iv(this.addr,e)}function n4(r,e){r.uniform2iv(this.addr,e)}function i4(r,e){r.uniform3iv(this.addr,e)}function r4(r,e){r.uniform4iv(this.addr,e)}function o4(r,e){r.uniform1uiv(this.addr,e)}function s4(r,e){r.uniform2uiv(this.addr,e)}function a4(r,e){r.uniform3uiv(this.addr,e)}function l4(r,e){r.uniform4uiv(this.addr,e)}function u4(r,e,t){let n=e.length,i=Jf(t,n);r.uniform1iv(this.addr,i);for(let o=0;o!==n;++o)t.safeSetTexture2D(e[o]||A3,i[o])}function c4(r,e,t){let n=e.length,i=Jf(t,n);r.uniform1iv(this.addr,i);for(let o=0;o!==n;++o)t.setTexture3D(e[o]||E3,i[o])}function h4(r,e,t){let n=e.length,i=Jf(t,n);r.uniform1iv(this.addr,i);for(let o=0;o!==n;++o)t.safeSetTextureCube(e[o]||M3,i[o])}function f4(r,e,t){let n=e.length,i=Jf(t,n);r.uniform1iv(this.addr,i);for(let o=0;o!==n;++o)t.setTexture2DArray(e[o]||D3,i[o])}function p4(r){switch(r){case 5126:return Y5;case 35664:return X5;case 35665:return K5;case 35666:return Z5;case 35674:return J5;case 35675:return $5;case 35676:return e4;case 5124:case 35670:return t4;case 35667:case 35671:return n4;case 35668:case 35672:return i4;case 35669:case 35673:return r4;case 5125:return o4;case 36294:return s4;case 36295:return a4;case 36296:return l4;case 35678:case 36198:case 36298:case 36306:case 35682:return u4;case 35679:case 36299:case 36307:return c4;case 35680:case 36300:case 36308:case 36293:return h4;case 36289:case 36303:case 36311:case 36292:return f4}}function d4(r,e,t){this.id=r,this.addr=t,this.cache=[],this.setValue=Q5(e.type)}function P3(r,e,t){this.id=r,this.addr=t,this.cache=[],this.size=e.size,this.setValue=p4(e.type)}function k3(r){this.id=r,this.seq=[],this.map={}}function B3(r,e){r.seq.push(e),r.map[e.id]=e}function m4(r,e,t){let n=r.name,i=n.length;for(Hg.lastIndex=0;;){let o=Hg.exec(n),s=Hg.lastIndex,a=o[1],l=o[2]==="]",u=o[3];if(l&&(a=a|0),u===void 0||u==="["&&s+2===i){B3(t,u===void 0?new d4(a,r,e):new P3(a,r,e));break}else{let f=t.map[a];f===void 0&&(f=new k3(a),B3(t,f)),t=f}}}function go(r,e){this.seq=[],this.map={};let t=r.getProgramParameter(e,35718);for(let n=0;n<t;++n){let i=r.getActiveUniform(e,n),o=r.getUniformLocation(e,i.name);m4(i,o,this)}}function z3(r,e,t){let n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}function y4(r){let e=r.split(`
|
|
1307
|
+
`}function x5(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture&&a.isRenderTargetTexture===!1){let l=a.mapping,u=l===_u||l===Cu,c=l===ts||l===ns;if(u||c){if(e.has(a))return e.get(a).texture;{let f=a.image;if(u&&f&&f.height>0||c&&f&&i(f)){let h=r.getRenderTarget();t===null&&(t=new Wg(r));let p=u?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,p),r.setRenderTarget(h),a.addEventListener("dispose",o),p.texture}else return null}}}return a}function i(a){let l=0,u=6;for(let c=0;c<u;c++)a[c]!==void 0&&l++;return l===u}function o(a){let l=a.target;l.removeEventListener("dispose",o);let u=e.get(l);u!==void 0&&(e.delete(l),u.dispose())}function s(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:s}}function w5(r){let e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){let i=t(n);return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function b5(r,e,t,n){let i={},o=new WeakMap;function s(f){let h=f.target;h.index!==null&&e.remove(h.index);for(let d in h.attributes)e.remove(h.attributes[d]);h.removeEventListener("dispose",s),delete i[h.id];let p=o.get(h);p&&(e.remove(p),o.delete(h)),n.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function a(f,h){return i[h.id]===!0||(h.addEventListener("dispose",s),i[h.id]=!0,t.memory.geometries++),h}function l(f){let h=f.attributes;for(let d in h)e.update(h[d],34962);let p=f.morphAttributes;for(let d in p){let g=p[d];for(let x=0,y=g.length;x<y;x++)e.update(g[x],34962)}}function u(f){let h=[],p=f.index,d=f.attributes.position,g=0;if(p!==null){let m=p.array;g=p.version;for(let b=0,w=m.length;b<w;b+=3){let D=m[b+0],R=m[b+1],L=m[b+2];h.push(D,R,R,L,L,D)}}else{let m=d.array;g=d.version;for(let b=0,w=m.length/3-1;b<w;b+=3){let D=b+0,R=b+1,L=b+2;h.push(D,R,R,L,L,D)}}let x=new(e3(h)>65535?Yu:Qu)(h,1);x.version=g;let y=o.get(f);y&&e.remove(y),o.set(f,x)}function c(f){let h=o.get(f);if(h){let p=f.index;p!==null&&h.version<p.version&&u(f)}else u(f);return o.get(f)}return{get:a,update:l,getWireframeAttribute:c}}function S5(r,e,t,n){let i=n.isWebGL2,o;function s(h){o=h}let a,l;function u(h){a=h.type,l=h.bytesPerElement}function c(h,p){r.drawElements(o,p,a,h*l),t.update(p,o,1)}function f(h,p,d){if(d===0)return;let g,x;if(i)g=r,x="drawElementsInstanced";else if(g=e.get("ANGLE_instanced_arrays"),x="drawElementsInstancedANGLE",g===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}g[x](o,p,a,h*l,d),t.update(p,o,d)}this.setMode=s,this.setIndex=u,this.render=c,this.renderInstances=f}function L5(r){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(o,s,a){switch(t.calls++,s){case 4:t.triangles+=a*(o/3);break;case 1:t.lines+=a*(o/2);break;case 3:t.lines+=a*(o-1);break;case 2:t.lines+=a*o;break;case 0:t.points+=a*o;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",s);break}}function i(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function A5(r,e){return r[0]-e[0]}function D5(r,e){return Math.abs(e[1])-Math.abs(r[1])}function A3(r,e){let t=1,n=e.isInterleavedBufferAttribute?e.data.array:e.array;n instanceof Int8Array?t=127:n instanceof Int16Array?t=32767:n instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),r.divideScalar(t)}function E5(r,e,t){let n={},i=new Float32Array(8),o=new WeakMap,s=new M,a=[];for(let u=0;u<8;u++)a[u]=[u,0];function l(u,c,f,h){let p=u.morphTargetInfluences;if(e.isWebGL2===!0){let d=c.morphAttributes.position.length,g=o.get(c);if(g===void 0||g.count!==d){g!==void 0&&g.texture.dispose();let m=c.morphAttributes.normal!==void 0,b=c.morphAttributes.position,w=c.morphAttributes.normal||[],D=c.attributes.position.count,R=m===!0?2:1,L=D*R,T=1;L>e.maxTextureSize&&(T=Math.ceil(L/e.maxTextureSize),L=e.maxTextureSize);let U=new Float32Array(L*T*4*d),F=new $u(U,L,T,d);F.format=gn,F.type=Qi;let C=R*4;for(let j=0;j<d;j++){let B=b[j],z=w[j],O=L*T*4*j;for(let V=0;V<B.count;V++){s.fromBufferAttribute(B,V),B.normalized===!0&&A3(s,B);let q=V*C;U[O+q+0]=s.x,U[O+q+1]=s.y,U[O+q+2]=s.z,U[O+q+3]=0,m===!0&&(s.fromBufferAttribute(z,V),z.normalized===!0&&A3(s,z),U[O+q+4]=s.x,U[O+q+5]=s.y,U[O+q+6]=s.z,U[O+q+7]=0)}}g={count:d,texture:F,size:new ee(L,T)},o.set(c,g)}let x=0;for(let m=0;m<p.length;m++)x+=p[m];let y=c.morphTargetsRelative?1:1-x;h.getUniforms().setValue(r,"morphTargetBaseInfluence",y),h.getUniforms().setValue(r,"morphTargetInfluences",p),h.getUniforms().setValue(r,"morphTargetsTexture",g.texture,t),h.getUniforms().setValue(r,"morphTargetsTextureSize",g.size)}else{let d=p===void 0?0:p.length,g=n[c.id];if(g===void 0||g.length!==d){g=[];for(let w=0;w<d;w++)g[w]=[w,0];n[c.id]=g}for(let w=0;w<d;w++){let D=g[w];D[0]=w,D[1]=p[w]}g.sort(D5);for(let w=0;w<8;w++)w<d&&g[w][1]?(a[w][0]=g[w][0],a[w][1]=g[w][1]):(a[w][0]=Number.MAX_SAFE_INTEGER,a[w][1]=0);a.sort(A5);let x=c.morphAttributes.position,y=c.morphAttributes.normal,m=0;for(let w=0;w<8;w++){let D=a[w],R=D[0],L=D[1];R!==Number.MAX_SAFE_INTEGER&&L?(x&&c.getAttribute("morphTarget"+w)!==x[R]&&c.setAttribute("morphTarget"+w,x[R]),y&&c.getAttribute("morphNormal"+w)!==y[R]&&c.setAttribute("morphNormal"+w,y[R]),i[w]=L,m+=L):(x&&c.hasAttribute("morphTarget"+w)===!0&&c.deleteAttribute("morphTarget"+w),y&&c.hasAttribute("morphNormal"+w)===!0&&c.deleteAttribute("morphNormal"+w),i[w]=0)}let b=c.morphTargetsRelative?1:1-m;h.getUniforms().setValue(r,"morphTargetBaseInfluence",b),h.getUniforms().setValue(r,"morphTargetInfluences",i)}}return{update:l}}function M5(r,e,t,n){let i=new WeakMap;function o(l){let u=n.render.frame,c=l.geometry,f=e.get(l,c);return i.get(f)!==u&&(e.update(f),i.set(f,u)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),t.update(l.instanceMatrix,34962),l.instanceColor!==null&&t.update(l.instanceColor,34962)),f}function s(){i=new WeakMap}function a(l){let u=l.target;u.removeEventListener("dispose",a),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:s}}function Ja(r,e,t){let n=r[0];if(n<=0||n>0)return r;let i=e*t,o=T3[i];if(o===void 0&&(o=new Float32Array(i),T3[i]=o),e!==0){n.toArray(o,0);for(let s=1,a=0;s!==e;++s)a+=t,r[s].toArray(o,a)}return o}function kn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function En(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Jf(r,e){let t=F3[e];t===void 0&&(t=new Int32Array(e),F3[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function R5(r,e){let t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function T5(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(kn(t,e))return;r.uniform2fv(this.addr,e),En(t,e)}}function F5(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(kn(t,e))return;r.uniform3fv(this.addr,e),En(t,e)}}function _5(r,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(kn(t,e))return;r.uniform4fv(this.addr,e),En(t,e)}}function C5(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(kn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),En(t,e)}else{if(kn(t,n))return;P3.set(n),r.uniformMatrix2fv(this.addr,!1,P3),En(t,n)}}function P5(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(kn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),En(t,e)}else{if(kn(t,n))return;C3.set(n),r.uniformMatrix3fv(this.addr,!1,C3),En(t,n)}}function k5(r,e){let t=this.cache,n=e.elements;if(n===void 0){if(kn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),En(t,e)}else{if(kn(t,n))return;_3.set(n),r.uniformMatrix4fv(this.addr,!1,_3),En(t,n)}}function B5(r,e){let t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function z5(r,e){let t=this.cache;kn(t,e)||(r.uniform2iv(this.addr,e),En(t,e))}function I5(r,e){let t=this.cache;kn(t,e)||(r.uniform3iv(this.addr,e),En(t,e))}function U5(r,e){let t=this.cache;kn(t,e)||(r.uniform4iv(this.addr,e),En(t,e))}function N5(r,e){let t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function O5(r,e){let t=this.cache;kn(t,e)||(r.uniform2uiv(this.addr,e),En(t,e))}function G5(r,e){let t=this.cache;kn(t,e)||(r.uniform3uiv(this.addr,e),En(t,e))}function W5(r,e){let t=this.cache;kn(t,e)||(r.uniform4uiv(this.addr,e),En(t,e))}function V5(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTexture2D(e||D3,i)}function H5(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||M3,i)}function q5(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.safeSetTextureCube(e||R3,i)}function j5(r,e,t){let n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||E3,i)}function Q5(r){switch(r){case 5126:return R5;case 35664:return T5;case 35665:return F5;case 35666:return _5;case 35674:return C5;case 35675:return P5;case 35676:return k5;case 5124:case 35670:return B5;case 35667:case 35671:return z5;case 35668:case 35672:return I5;case 35669:case 35673:return U5;case 5125:return N5;case 36294:return O5;case 36295:return G5;case 36296:return W5;case 35678:case 36198:case 36298:case 36306:case 35682:return V5;case 35679:case 36299:case 36307:return H5;case 35680:case 36300:case 36308:case 36293:return q5;case 36289:case 36303:case 36311:case 36292:return j5}}function Y5(r,e){r.uniform1fv(this.addr,e)}function X5(r,e){let t=Ja(e,this.size,2);r.uniform2fv(this.addr,t)}function K5(r,e){let t=Ja(e,this.size,3);r.uniform3fv(this.addr,t)}function Z5(r,e){let t=Ja(e,this.size,4);r.uniform4fv(this.addr,t)}function J5(r,e){let t=Ja(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function $5(r,e){let t=Ja(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function e4(r,e){let t=Ja(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function t4(r,e){r.uniform1iv(this.addr,e)}function n4(r,e){r.uniform2iv(this.addr,e)}function i4(r,e){r.uniform3iv(this.addr,e)}function r4(r,e){r.uniform4iv(this.addr,e)}function o4(r,e){r.uniform1uiv(this.addr,e)}function s4(r,e){r.uniform2uiv(this.addr,e)}function a4(r,e){r.uniform3uiv(this.addr,e)}function l4(r,e){r.uniform4uiv(this.addr,e)}function u4(r,e,t){let n=e.length,i=Jf(t,n);r.uniform1iv(this.addr,i);for(let o=0;o!==n;++o)t.safeSetTexture2D(e[o]||D3,i[o])}function c4(r,e,t){let n=e.length,i=Jf(t,n);r.uniform1iv(this.addr,i);for(let o=0;o!==n;++o)t.setTexture3D(e[o]||M3,i[o])}function h4(r,e,t){let n=e.length,i=Jf(t,n);r.uniform1iv(this.addr,i);for(let o=0;o!==n;++o)t.safeSetTextureCube(e[o]||R3,i[o])}function f4(r,e,t){let n=e.length,i=Jf(t,n);r.uniform1iv(this.addr,i);for(let o=0;o!==n;++o)t.setTexture2DArray(e[o]||E3,i[o])}function p4(r){switch(r){case 5126:return Y5;case 35664:return X5;case 35665:return K5;case 35666:return Z5;case 35674:return J5;case 35675:return $5;case 35676:return e4;case 5124:case 35670:return t4;case 35667:case 35671:return n4;case 35668:case 35672:return i4;case 35669:case 35673:return r4;case 5125:return o4;case 36294:return s4;case 36295:return a4;case 36296:return l4;case 35678:case 36198:case 36298:case 36306:case 35682:return u4;case 35679:case 36299:case 36307:return c4;case 35680:case 36300:case 36308:case 36293:return h4;case 36289:case 36303:case 36311:case 36292:return f4}}function d4(r,e,t){this.id=r,this.addr=t,this.cache=[],this.setValue=Q5(e.type)}function k3(r,e,t){this.id=r,this.addr=t,this.cache=[],this.size=e.size,this.setValue=p4(e.type)}function B3(r){this.id=r,this.seq=[],this.map={}}function z3(r,e){r.seq.push(e),r.map[e.id]=e}function m4(r,e,t){let n=r.name,i=n.length;for(qg.lastIndex=0;;){let o=qg.exec(n),s=qg.lastIndex,a=o[1],l=o[2]==="]",u=o[3];if(l&&(a=a|0),u===void 0||u==="["&&s+2===i){z3(t,u===void 0?new d4(a,r,e):new k3(a,r,e));break}else{let f=t.map[a];f===void 0&&(f=new B3(a),z3(t,f)),t=f}}}function go(r,e){this.seq=[],this.map={};let t=r.getProgramParameter(e,35718);for(let n=0;n<t;++n){let i=r.getActiveUniform(e,n),o=r.getUniformLocation(e,i.name);m4(i,o,this)}}function I3(r,e,t){let n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}function y4(r){let e=r.split(`
|
|
1308
1308
|
`);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
|
|
1309
|
-
`)}function
|
|
1309
|
+
`)}function U3(r){switch(r){case Pn:return["Linear","( value )"];case Ou:return["sRGB","( value )"];case Mf:return["RGBE","( value )"];case ig:return["RGBM","( value, 7.0 )"];case rg:return["RGBM","( value, 16.0 )"];case og:return["RGBD","( value, 256.0 )"];case Ef:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",r),["Linear","( value )"]}}function N3(r,e,t){let n=r.getShaderParameter(e,35713),i=r.getShaderInfoLog(e).trim();return n&&i===""?"":t.toUpperCase()+`
|
|
1310
1310
|
|
|
1311
1311
|
`+i+`
|
|
1312
1312
|
|
|
1313
|
-
`+y4(r.getShaderSource(e))}function vs(r,e){let t=
|
|
1313
|
+
`+y4(r.getShaderSource(e))}function vs(r,e){let t=U3(e);return"vec4 "+r+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function v4(r,e){let t=U3(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function x4(r,e){let t;switch(e){case Qw:t="Linear";break;case Yw:t="Reinhard";break;case Xw:t="OptimizedCineon";break;case Kw:t="ACESFilmic";break;case Zw:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function w4(r){return[r.extensionDerivatives||r.envMapCubeUV||r.bumpMap||r.tangentSpaceNormalMap||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ec).join(`
|
|
1314
1314
|
`)}function b4(r){let e=[];for(let t in r){let n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
|
1315
|
-
`)}function S4(r,e){let t={},n=r.getProgramParameter(e,35721);for(let i=0;i<n;i++){let o=r.getActiveAttrib(e,i),s=o.name,a=1;o.type===35674&&(a=2),o.type===35675&&(a=3),o.type===35676&&(a=4),t[s]={type:o.type,location:r.getAttribLocation(e,s),locationSize:a}}return t}function ec(r){return r!==""}function
|
|
1315
|
+
`)}function S4(r,e){let t={},n=r.getProgramParameter(e,35721);for(let i=0;i<n;i++){let o=r.getActiveAttrib(e,i),s=o.name,a=1;o.type===35674&&(a=2),o.type===35675&&(a=3),o.type===35676&&(a=4),t[s]={type:o.type,location:r.getAttribLocation(e,s),locationSize:a}}return t}function ec(r){return r!==""}function O3(r,e){return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function G3(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}function jg(r){return r.replace(L4,A4)}function A4(r,e){let t=$e[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return jg(t)}function W3(r){return r.replace(E4,V3).replace(D4,M4)}function M4(r,e,t,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),V3(r,e,t,n)}function V3(r,e,t,n){let i="";for(let o=parseInt(e);o<parseInt(t);o++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return i}function H3(r){let e="precision "+r.precision+` float;
|
|
1316
1316
|
precision `+r.precision+" int;";return r.precision==="highp"?e+=`
|
|
1317
1317
|
#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
|
|
1318
1318
|
#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
|
|
1319
|
-
#define LOW_PRECISION`),e}function R4(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===
|
|
1319
|
+
#define LOW_PRECISION`),e}function R4(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===z0?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===Dw?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===Da&&(e="SHADOWMAP_TYPE_VSM"),e}function T4(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case ts:case ns:e="ENVMAP_TYPE_CUBE";break;case Ma:case Pu:e="ENVMAP_TYPE_CUBE_UV";break}return e}function F4(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case ns:case Pu:e="ENVMAP_MODE_REFRACTION";break}return e}function _4(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case Fu:e="ENVMAP_BLENDING_MULTIPLY";break;case qw:e="ENVMAP_BLENDING_MIX";break;case jw:e="ENVMAP_BLENDING_ADD";break}return e}function C4(r,e,t,n){let i=r.getContext(),o=t.defines,s=t.vertexShader,a=t.fragmentShader,l=R4(t),u=T4(t),c=F4(t),f=_4(t),h=r.gammaFactor>0?r.gammaFactor:1,p=t.isWebGL2?"":w4(t),d=b4(o),g=i.createProgram(),x,y,m=t.glslVersion?"#version "+t.glslVersion+`
|
|
1320
1320
|
`:"";t.isRawShaderMaterial?(x=[d].filter(ec).join(`
|
|
1321
1321
|
`),x.length>0&&(x+=`
|
|
1322
1322
|
`),y=[p,d].filter(ec).join(`
|
|
1323
1323
|
`),y.length>0&&(y+=`
|
|
1324
|
-
`)):(x=[
|
|
1324
|
+
`)):(x=[H3(t),"#define SHADER_NAME "+t.shaderName,d,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+h,"#define MAX_BONES "+t.maxBones,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphTargets&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargets&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
|
1325
1325
|
`].filter(ec).join(`
|
|
1326
|
-
`),y=[p,
|
|
1326
|
+
`),y=[p,H3(t),"#define SHADER_NAME "+t.shaderName,d,"#define GAMMA_FACTOR "+h,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+c:"",t.envMap?"#define "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==io?"#define TONE_MAPPING":"",t.toneMapping!==io?$e.tonemapping_pars_fragment:"",t.toneMapping!==io?x4("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.format===ro?"#define OPAQUE":"",$e.encodings_pars_fragment,t.map?vs("mapTexelToLinear",t.mapEncoding):"",t.matcap?vs("matcapTexelToLinear",t.matcapEncoding):"",t.envMap?vs("envMapTexelToLinear",t.envMapEncoding):"",t.emissiveMap?vs("emissiveMapTexelToLinear",t.emissiveMapEncoding):"",t.specularColorMap?vs("specularColorMapTexelToLinear",t.specularColorMapEncoding):"",t.sheenColorMap?vs("sheenColorMapTexelToLinear",t.sheenColorMapEncoding):"",t.lightMap?vs("lightMapTexelToLinear",t.lightMapEncoding):"",v4("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
|
1327
1327
|
`].filter(ec).join(`
|
|
1328
|
-
`)),s=
|
|
1328
|
+
`)),s=jg(s),s=O3(s,t),s=G3(s,t),a=jg(a),a=O3(a,t),a=G3(a,t),s=W3(s),a=W3(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(m=`#version 300 es
|
|
1329
1329
|
`,x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
|
|
1330
1330
|
`)+`
|
|
1331
|
-
`+x,y=["#define varying in",t.glslVersion===
|
|
1331
|
+
`+x,y=["#define varying in",t.glslVersion===sg?"":"out highp vec4 pc_fragColor;",t.glslVersion===sg?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
|
1332
1332
|
`)+`
|
|
1333
|
-
`+y);let b=m+x+s,w=m+y+a,D=
|
|
1333
|
+
`+y);let b=m+x+s,w=m+y+a,D=I3(i,35633,b),R=I3(i,35632,w);if(i.attachShader(g,D),i.attachShader(g,R),t.index0AttributeName!==void 0?i.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(g,0,"position"),i.linkProgram(g),r.debug.checkShaderErrors){let U=i.getProgramInfoLog(g).trim(),F=i.getShaderInfoLog(D).trim(),C=i.getShaderInfoLog(R).trim(),j=!0,B=!0;if(i.getProgramParameter(g,35714)===!1){j=!1;let z=N3(i,D,"vertex"),O=N3(i,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(g,35715)+`
|
|
1334
1334
|
|
|
1335
1335
|
Program Info Log: `+U+`
|
|
1336
1336
|
`+z+`
|
|
1337
|
-
`+O)}else U!==""?console.warn("THREE.WebGLProgram: Program Info Log:",U):(F===""||C==="")&&(B=!1);B&&(this.diagnostics={runnable:j,programLog:U,vertexShader:{log:F,prefix:x},fragmentShader:{log:C,prefix:y}})}i.deleteShader(D),i.deleteShader(R);let L;this.getUniforms=function(){return L===void 0&&(L=new go(i,g)),L};let T;return this.getAttributes=function(){return T===void 0&&(T=S4(i,g)),T},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.name=t.shaderName,this.id=g4++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=D,this.fragmentShader=R,this}function P4(r,e,t,n,i,o,s){let a=[],l=i.isWebGL2,u=i.logarithmicDepthBuffer,c=i.floatVertexTextures,f=i.maxVertexUniforms,h=i.vertexTextures,p=i.precision,d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoat","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap",,"roughnessMap","metalnessMap","gradientMap","alphaMap","alphaTest","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","morphTargetsCount","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","format","specularIntensityMap","specularColorMap","specularColorMapEncoding","transmission","transmissionMap","thicknessMap","sheen","sheenColorMap","sheenColorMapEncoding","sheenRoughnessMap"];function x(L){let U=L.skeleton.bones;if(c)return 1024;{let C=Math.floor((f-20)/4),j=Math.min(C,U.length);return j<U.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+U.length+" bones. This GPU supports "+j+"."),0):j}}function y(L){let T;return L&&L.isTexture?T=L.encoding:L&&L.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),T=L.texture.encoding):T=Pn,T}function m(L,T,U,F,C){let j=F.fog,B=L.isMeshStandardMaterial?F.environment:null,z=(L.isMeshStandardMaterial?t:e).get(L.envMap||B),O=d[L.type],V=C.isSkinnedMesh?x(C):0;L.precision!==null&&(p=i.getMaxPrecision(L.precision),p!==L.precision&&console.warn("THREE.WebGLProgram.getParameters:",L.precision,"not supported, using",p,"instead."));let q,se;if(O){let pe=_i[O];q=pe.vertexShader,se=pe.fragmentShader}else q=L.vertexShader,se=L.fragmentShader;let he=r.getRenderTarget(),Y=L.alphaTest>0,X=L.clearcoat>0;return{isWebGL2:l,shaderID:O,shaderName:L.type,vertexShader:q,fragmentShader:se,defines:L.defines,isRawShaderMaterial:L.isRawShaderMaterial===!0,glslVersion:L.glslVersion,precision:p,instancing:C.isInstancedMesh===!0,instancingColor:C.isInstancedMesh===!0&&C.instanceColor!==null,supportsVertexTextures:h,outputEncoding:he!==null?y(he.texture):r.outputEncoding,map:!!L.map,mapEncoding:y(L.map),matcap:!!L.matcap,matcapEncoding:y(L.matcap),envMap:!!z,envMapMode:z&&z.mapping,envMapEncoding:y(z),envMapCubeUV:!!z&&(z.mapping===Ma||z.mapping===Pu),lightMap:!!L.lightMap,lightMapEncoding:y(L.lightMap),aoMap:!!L.aoMap,emissiveMap:!!L.emissiveMap,emissiveMapEncoding:y(L.emissiveMap),bumpMap:!!L.bumpMap,normalMap:!!L.normalMap,objectSpaceNormalMap:L.normalMapType===Xb,tangentSpaceNormalMap:L.normalMapType===us,clearcoat:X,clearcoatMap:X&&!!L.clearcoatMap,clearcoatRoughnessMap:X&&!!L.clearcoatRoughnessMap,clearcoatNormalMap:X&&!!L.clearcoatNormalMap,displacementMap:!!L.displacementMap,roughnessMap:!!L.roughnessMap,metalnessMap:!!L.metalnessMap,specularMap:!!L.specularMap,specularIntensityMap:!!L.specularIntensityMap,specularColorMap:!!L.specularColorMap,specularColorMapEncoding:y(L.specularColorMap),alphaMap:!!L.alphaMap,alphaTest:Y,gradientMap:!!L.gradientMap,sheen:L.sheen>0,sheenColorMap:!!L.sheenColorMap,sheenColorMapEncoding:y(L.sheenColorMap),sheenRoughnessMap:!!L.sheenRoughnessMap,transmission:L.transmission>0,transmissionMap:!!L.transmissionMap,thicknessMap:!!L.thicknessMap,combine:L.combine,vertexTangents:!!L.normalMap&&!!C.geometry&&!!C.geometry.attributes.tangent,vertexColors:L.vertexColors,vertexAlphas:L.vertexColors===!0&&!!C.geometry&&!!C.geometry.attributes.color&&C.geometry.attributes.color.itemSize===4,vertexUvs:!!L.map||!!L.bumpMap||!!L.normalMap||!!L.specularMap||!!L.alphaMap||!!L.emissiveMap||!!L.roughnessMap||!!L.metalnessMap||!!L.clearcoatMap||!!L.clearcoatRoughnessMap||!!L.clearcoatNormalMap||!!L.displacementMap||!!L.transmissionMap||!!L.thicknessMap||!!L.specularIntensityMap||!!L.specularColorMap||!!L.sheenColorMap||L.sheenRoughnessMap,uvsVertexOnly:!(!!L.map||!!L.bumpMap||!!L.normalMap||!!L.specularMap||!!L.alphaMap||!!L.emissiveMap||!!L.roughnessMap||!!L.metalnessMap||!!L.clearcoatNormalMap||L.transmission>0||!!L.transmissionMap||!!L.thicknessMap||!!L.specularIntensityMap||!!L.specularColorMap||L.sheen>0||!!L.sheenColorMap||!!L.sheenRoughnessMap)&&!!L.displacementMap,fog:!!j,useFog:L.fog,fogExp2:j&&j.isFogExp2,flatShading:!!L.flatShading,sizeAttenuation:L.sizeAttenuation,logarithmicDepthBuffer:u,skinning:C.isSkinnedMesh===!0&&V>0,maxBones:V,useVertexTexture:c,morphTargets:!!C.geometry&&!!C.geometry.morphAttributes.position,morphNormals:!!C.geometry&&!!C.geometry.morphAttributes.normal,morphTargetsCount:!!C.geometry&&!!C.geometry.morphAttributes.position?C.geometry.morphAttributes.position.length:0,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,format:L.format,dithering:L.dithering,shadowMapEnabled:r.shadowMap.enabled&&U.length>0,shadowMapType:r.shadowMap.type,toneMapping:L.toneMapped?r.toneMapping:io,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:L.premultipliedAlpha,doubleSided:L.side===jn,flipSided:L.side===At,depthPacking:L.depthPacking!==void 0?L.depthPacking:!1,index0AttributeName:L.index0AttributeName,extensionDerivatives:L.extensions&&L.extensions.derivatives,extensionFragDepth:L.extensions&&L.extensions.fragDepth,extensionDrawBuffers:L.extensions&&L.extensions.drawBuffers,extensionShaderTextureLOD:L.extensions&&L.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||n.has("EXT_shader_texture_lod"),customProgramCacheKey:L.customProgramCacheKey()}}function b(L){let T=[];if(L.shaderID?T.push(L.shaderID):(T.push(e3(L.fragmentShader)),T.push(e3(L.vertexShader))),L.defines!==void 0)for(let U in L.defines)T.push(U),T.push(L.defines[U]);if(L.isRawShaderMaterial===!1){for(let U=0;U<g.length;U++)T.push(L[g[U]]);T.push(r.outputEncoding),T.push(r.gammaFactor)}return T.push(L.customProgramCacheKey),T.join()}function w(L){let T=d[L.type],U;if(T){let F=_i[T];U=p3.clone(F.uniforms)}else U=L.uniforms;return U}function D(L,T){let U;for(let F=0,C=a.length;F<C;F++){let j=a[F];if(j.cacheKey===T){U=j,++U.usedTimes;break}}return U===void 0&&(U=new C4(r,T,L,o),a.push(U)),U}function R(L){if(--L.usedTimes==0){let T=a.indexOf(L);a[T]=a[a.length-1],a.pop(),L.destroy()}}return{getParameters:m,getProgramCacheKey:b,getUniforms:w,acquireProgram:D,releaseProgram:R,programs:a}}function k4(){let r=new WeakMap;function e(o){let s=r.get(o);return s===void 0&&(s={},r.set(o,s)),s}function t(o){r.delete(o)}function n(o,s,a){r.get(o)[s]=a}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function B4(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.program!==e.program?r.program.id-e.program.id:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function H3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function q3(r){let e=[],t=0,n=[],i=[],o=[],s={id:-1};function a(){t=0,n.length=0,i.length=0,o.length=0}function l(p,d,g,x,y,m){let b=e[t],w=r.get(g);return b===void 0?(b={id:p.id,object:p,geometry:d,material:g,program:w.program||s,groupOrder:x,renderOrder:p.renderOrder,z:y,group:m},e[t]=b):(b.id=p.id,b.object=p,b.geometry=d,b.material=g,b.program=w.program||s,b.groupOrder=x,b.renderOrder=p.renderOrder,b.z=y,b.group=m),t++,b}function u(p,d,g,x,y,m){let b=l(p,d,g,x,y,m);g.transmission>0?i.push(b):g.transparent===!0?o.push(b):n.push(b)}function c(p,d,g,x,y,m){let b=l(p,d,g,x,y,m);g.transmission>0?i.unshift(b):g.transparent===!0?o.unshift(b):n.unshift(b)}function f(p,d){n.length>1&&n.sort(p||B4),i.length>1&&i.sort(d||H3),o.length>1&&o.sort(d||H3)}function h(){for(let p=t,d=e.length;p<d;p++){let g=e[p];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.program=null,g.group=null}}return{opaque:n,transmissive:i,transparent:o,init:a,push:u,unshift:c,finish:h,sort:f}}function z4(r){let e=new WeakMap;function t(i,o){let s;return e.has(i)===!1?(s=new q3(r),e.set(i,[s])):o>=e.get(i).length?(s=new q3(r),e.get(i).push(s)):s=e.get(i)[o],s}function n(){e=new WeakMap}return{get:t,dispose:n}}function I4(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new M,color:new xe};break;case"SpotLight":t={position:new M,direction:new M,color:new xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new M,color:new xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new M,skyColor:new xe,groundColor:new xe};break;case"RectAreaLight":t={color:new xe,position:new M,halfWidth:new M,halfHeight:new M};break}return r[e.id]=t,t}}}function U4(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ee};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ee};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ee,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}function O4(r,e){return(e.castShadow?1:0)-(r.castShadow?1:0)}function G4(r,e){let t=new I4,n=U4(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let c=0;c<9;c++)i.probe.push(new M);let o=new M,s=new Ae,a=new Ae;function l(c,f){let h=0,p=0,d=0;for(let U=0;U<9;U++)i.probe[U].set(0,0,0);let g=0,x=0,y=0,m=0,b=0,w=0,D=0,R=0;c.sort(O4);let L=f!==!0?Math.PI:1;for(let U=0,F=c.length;U<F;U++){let C=c[U],j=C.color,B=C.intensity,z=C.distance,O=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)h+=j.r*B*L,p+=j.g*B*L,d+=j.b*B*L;else if(C.isLightProbe)for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],B);else if(C.isDirectionalLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity*L),C.castShadow){let q=C.shadow,se=n.get(C);se.shadowBias=q.bias,se.shadowNormalBias=q.normalBias,se.shadowRadius=q.radius,se.shadowMapSize=q.mapSize,i.directionalShadow[g]=se,i.directionalShadowMap[g]=O,i.directionalShadowMatrix[g]=C.shadow.matrix,w++}i.directional[g]=V,g++}else if(C.isSpotLight){let V=t.get(C);if(V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(j).multiplyScalar(B*L),V.distance=z,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,C.castShadow){let q=C.shadow,se=n.get(C);se.shadowBias=q.bias,se.shadowNormalBias=q.normalBias,se.shadowRadius=q.radius,se.shadowMapSize=q.mapSize,i.spotShadow[y]=se,i.spotShadowMap[y]=O,i.spotShadowMatrix[y]=C.shadow.matrix,R++}i.spot[y]=V,y++}else if(C.isRectAreaLight){let V=t.get(C);V.color.copy(j).multiplyScalar(B),V.halfWidth.set(C.width*.5,0,0),V.halfHeight.set(0,C.height*.5,0),i.rectArea[m]=V,m++}else if(C.isPointLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity*L),V.distance=C.distance,V.decay=C.decay,C.castShadow){let q=C.shadow,se=n.get(C);se.shadowBias=q.bias,se.shadowNormalBias=q.normalBias,se.shadowRadius=q.radius,se.shadowMapSize=q.mapSize,se.shadowCameraNear=q.camera.near,se.shadowCameraFar=q.camera.far,i.pointShadow[x]=se,i.pointShadowMap[x]=O,i.pointShadowMatrix[x]=C.shadow.matrix,D++}i.point[x]=V,x++}else if(C.isHemisphereLight){let V=t.get(C);V.skyColor.copy(C.color).multiplyScalar(B*L),V.groundColor.copy(C.groundColor).multiplyScalar(B*L),i.hemi[b]=V,b++}}m>0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=we.LTC_FLOAT_1,i.rectAreaLTC2=we.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=we.LTC_HALF_1,i.rectAreaLTC2=we.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=h,i.ambient[1]=p,i.ambient[2]=d;let T=i.hash;(T.directionalLength!==g||T.pointLength!==x||T.spotLength!==y||T.rectAreaLength!==m||T.hemiLength!==b||T.numDirectionalShadows!==w||T.numPointShadows!==D||T.numSpotShadows!==R)&&(i.directional.length=g,i.spot.length=y,i.rectArea.length=m,i.point.length=x,i.hemi.length=b,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.pointShadow.length=D,i.pointShadowMap.length=D,i.spotShadow.length=R,i.spotShadowMap.length=R,i.directionalShadowMatrix.length=w,i.pointShadowMatrix.length=D,i.spotShadowMatrix.length=R,T.directionalLength=g,T.pointLength=x,T.spotLength=y,T.rectAreaLength=m,T.hemiLength=b,T.numDirectionalShadows=w,T.numPointShadows=D,T.numSpotShadows=R,i.version=N4++)}function u(c,f){let h=0,p=0,d=0,g=0,x=0,y=f.matrixWorldInverse;for(let m=0,b=c.length;m<b;m++){let w=c[m];if(w.isDirectionalLight){let D=i.directional[h];D.direction.setFromMatrixPosition(w.matrixWorld),o.setFromMatrixPosition(w.target.matrixWorld),D.direction.sub(o),D.direction.transformDirection(y),h++}else if(w.isSpotLight){let D=i.spot[d];D.position.setFromMatrixPosition(w.matrixWorld),D.position.applyMatrix4(y),D.direction.setFromMatrixPosition(w.matrixWorld),o.setFromMatrixPosition(w.target.matrixWorld),D.direction.sub(o),D.direction.transformDirection(y),d++}else if(w.isRectAreaLight){let D=i.rectArea[g];D.position.setFromMatrixPosition(w.matrixWorld),D.position.applyMatrix4(y),a.identity(),s.copy(w.matrixWorld),s.premultiply(y),a.extractRotation(s),D.halfWidth.set(w.width*.5,0,0),D.halfHeight.set(0,w.height*.5,0),D.halfWidth.applyMatrix4(a),D.halfHeight.applyMatrix4(a),g++}else if(w.isPointLight){let D=i.point[p];D.position.setFromMatrixPosition(w.matrixWorld),D.position.applyMatrix4(y),p++}else if(w.isHemisphereLight){let D=i.hemi[x];D.direction.setFromMatrixPosition(w.matrixWorld),D.direction.transformDirection(y),D.direction.normalize(),x++}}}return{setup:l,setupView:u,state:i}}function j3(r,e){let t=new G4(r,e),n=[],i=[];function o(){n.length=0,i.length=0}function s(f){n.push(f)}function a(f){i.push(f)}function l(f){t.setup(n,f)}function u(f){t.setupView(n,f)}return{init:o,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:u,pushLight:s,pushShadow:a}}function W4(r,e){let t=new WeakMap;function n(o,s=0){let a;return t.has(o)===!1?(a=new j3(r,e),t.set(o,[a])):s>=t.get(o).length?(a=new j3(r,e),t.get(o).push(a)):a=t.get(o)[s],a}function i(){t=new WeakMap}return{get:n,dispose:i}}function Q3(r,e,t){let n=new Qa,i=new ee,o=new ee,s=new xt,a=new tc({depthPacking:Yb}),l=new nc,u={},c=t.maxTextureSize,f={0:At,1:ji,2:jn},h=new Yi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ee},radius:{value:4}},vertexShader:V4,fragmentShader:H4}),p=h.clone();p.defines.HORIZONTAL_PASS=1;let d=new Pe;d.setAttribute("position",new qe(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new Lt(d,h),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=B0,this.render=function(w,D,R){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||w.length===0)return;let L=r.getRenderTarget(),T=r.getActiveCubeFace(),U=r.getActiveMipmapLevel(),F=r.state;F.setBlending(dr),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);for(let C=0,j=w.length;C<j;C++){let B=w[C],z=B.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;i.copy(z.mapSize);let O=z.getFrameExtents();if(i.multiply(O),o.copy(z.mapSize),(i.x>c||i.y>c)&&(i.x>c&&(o.x=Math.floor(c/O.x),i.x=o.x*O.x,z.mapSize.x=o.x),i.y>c&&(o.y=Math.floor(c/O.y),i.y=o.y*O.y,z.mapSize.y=o.y)),z.map===null&&!z.isPointLightShadow&&this.type===Da){let q={minFilter:Kt,magFilter:Kt,format:gn};z.map=new Qn(i.x,i.y,q),z.map.texture.name=B.name+".shadowMap",z.mapPass=new Qn(i.x,i.y,q),z.camera.updateProjectionMatrix()}if(z.map===null){let q={minFilter:jt,magFilter:jt,format:gn};z.map=new Qn(i.x,i.y,q),z.map.texture.name=B.name+".shadowMap",z.camera.updateProjectionMatrix()}r.setRenderTarget(z.map),r.clear();let V=z.getViewportCount();for(let q=0;q<V;q++){let se=z.getViewport(q);s.set(o.x*se.x,o.y*se.y,o.x*se.z,o.y*se.w),F.viewport(s),z.updateMatrices(B,q),n=z.getFrustum(),b(D,R,z.camera,B,this.type)}!z.isPointLightShadow&&this.type===Da&&y(z,R),z.needsUpdate=!1}x.needsUpdate=!1,r.setRenderTarget(L,T,U)};function y(w,D){let R=e.update(g);h.defines.VSM_SAMPLES!==w.blurSamples&&(h.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),h.uniforms.shadow_pass.value=w.map.texture,h.uniforms.resolution.value=w.mapSize,h.uniforms.radius.value=w.radius,r.setRenderTarget(w.mapPass),r.clear(),r.renderBufferDirect(D,null,R,h,g,null),p.uniforms.shadow_pass.value=w.mapPass.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,r.setRenderTarget(w.map),r.clear(),r.renderBufferDirect(D,null,R,p,g,null)}function m(w,D,R,L,T,U,F){let C=null,j=L.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(j!==void 0?C=j:C=L.isPointLight===!0?l:a,r.localClippingEnabled&&R.clipShadows===!0&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0){let B=C.uuid,z=R.uuid,O=u[B];O===void 0&&(O={},u[B]=O);let V=O[z];V===void 0&&(V=C.clone(),O[z]=V),C=V}return C.visible=R.visible,C.wireframe=R.wireframe,F===Da?C.side=R.shadowSide!==null?R.shadowSide:R.side:C.side=R.shadowSide!==null?R.shadowSide:f[R.side],C.alphaMap=R.alphaMap,C.alphaTest=R.alphaTest,C.clipShadows=R.clipShadows,C.clippingPlanes=R.clippingPlanes,C.clipIntersection=R.clipIntersection,C.displacementMap=R.displacementMap,C.displacementScale=R.displacementScale,C.displacementBias=R.displacementBias,C.wireframeLinewidth=R.wireframeLinewidth,C.linewidth=R.linewidth,L.isPointLight===!0&&C.isMeshDistanceMaterial===!0&&(C.referencePosition.setFromMatrixPosition(L.matrixWorld),C.nearDistance=T,C.farDistance=U),C}function b(w,D,R,L,T){if(w.visible===!1)return;if(w.layers.test(D.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&T===Da)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,w.matrixWorld);let C=e.update(w),j=w.material;if(Array.isArray(j)){let B=C.groups;for(let z=0,O=B.length;z<O;z++){let V=B[z],q=j[V.materialIndex];if(q&&q.visible){let se=m(w,C,q,L,R.near,R.far,T);r.renderBufferDirect(R,null,C,se,w,V)}}}else if(j.visible){let B=m(w,C,j,L,R.near,R.far,T);r.renderBufferDirect(R,null,C,B,w,null)}}let F=w.children;for(let C=0,j=F.length;C<j;C++)b(F[C],D,R,L,T)}}function q4(r,e,t){let n=t.isWebGL2;function i(){let G=!1,de=new xt,J=null,be=new xt(0,0,0,0);return{setMask:function(ge){J!==ge&&!G&&(r.colorMask(ge,ge,ge,ge),J=ge)},setLocked:function(ge){G=ge},setClear:function(ge,Ee,Re,Ve,Mt){Mt===!0&&(ge*=Ve,Ee*=Ve,Re*=Ve),de.set(ge,Ee,Re,Ve),be.equals(de)===!1&&(r.clearColor(ge,Ee,Re,Ve),be.copy(de))},reset:function(){G=!1,J=null,be.set(-1,0,0,0)}}}function o(){let G=!1,de=null,J=null,be=null;return{setTest:function(ge){ge?pe(2929):Le(2929)},setMask:function(ge){de!==ge&&!G&&(r.depthMask(ge),de=ge)},setFunc:function(ge){if(J!==ge){if(ge)switch(ge){case Iw:r.depthFunc(512);break;case Uw:r.depthFunc(519);break;case Nw:r.depthFunc(513);break;case wf:r.depthFunc(515);break;case Ow:r.depthFunc(514);break;case Gw:r.depthFunc(518);break;case Ww:r.depthFunc(516);break;case Vw:r.depthFunc(517);break;default:r.depthFunc(515)}else r.depthFunc(515);J=ge}},setLocked:function(ge){G=ge},setClear:function(ge){be!==ge&&(r.clearDepth(ge),be=ge)},reset:function(){G=!1,de=null,J=null,be=null}}}function s(){let G=!1,de=null,J=null,be=null,ge=null,Ee=null,Re=null,Ve=null,Mt=null;return{setTest:function(Ze){G||(Ze?pe(2960):Le(2960))},setMask:function(Ze){de!==Ze&&!G&&(r.stencilMask(Ze),de=Ze)},setFunc:function(Ze,ii,Nn){(J!==Ze||be!==ii||ge!==Nn)&&(r.stencilFunc(Ze,ii,Nn),J=Ze,be=ii,ge=Nn)},setOp:function(Ze,ii,Nn){(Ee!==Ze||Re!==ii||Ve!==Nn)&&(r.stencilOp(Ze,ii,Nn),Ee=Ze,Re=ii,Ve=Nn)},setLocked:function(Ze){G=Ze},setClear:function(Ze){Mt!==Ze&&(r.clearStencil(Ze),Mt=Ze)},reset:function(){G=!1,de=null,J=null,be=null,ge=null,Ee=null,Re=null,Ve=null,Mt=null}}}let a=new i,l=new o,u=new s,c={},f={},h=null,p=!1,d=null,g=null,x=null,y=null,m=null,b=null,w=null,D=!1,R=null,L=null,T=null,U=null,F=null,C=r.getParameter(35661),j=!1,B=0,z=r.getParameter(7938);z.indexOf("WebGL")!==-1?(B=parseFloat(/^WebGL (\d)/.exec(z)[1]),j=B>=1):z.indexOf("OpenGL ES")!==-1&&(B=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),j=B>=2);let O=null,V={},q=r.getParameter(3088),se=r.getParameter(2978),he=new xt().fromArray(q),Y=new xt().fromArray(se);function X(G,de,J){let be=new Uint8Array(4),ge=r.createTexture();r.bindTexture(G,ge),r.texParameteri(G,10241,9728),r.texParameteri(G,10240,9728);for(let Ee=0;Ee<J;Ee++)r.texImage2D(de+Ee,0,6408,1,1,0,6408,5121,be);return ge}let ve={};ve[3553]=X(3553,3553,1),ve[34067]=X(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),u.setClear(0),pe(2929),l.setFunc(wf),W(!1),Q(k0),pe(2884),ne(dr);function pe(G){c[G]!==!0&&(r.enable(G),c[G]=!0)}function Le(G){c[G]!==!1&&(r.disable(G),c[G]=!1)}function Ie(G,de){return f[G]!==de?(r.bindFramebuffer(G,de),f[G]=de,n&&(G===36009&&(f[36160]=de),G===36160&&(f[36009]=de)),!0):!1}function P(G){return h!==G?(r.useProgram(G),h=G,!0):!1}let Z={[es]:32774,[Ew]:32778,[Mw]:32779};if(n)Z[O0]=32775,Z[G0]=32776;else{let G=e.get("EXT_blend_minmax");G!==null&&(Z[O0]=G.MIN_EXT,Z[G0]=G.MAX_EXT)}let ae={[Rw]:0,[Tw]:1,[Fw]:768,[W0]:770,[zw]:776,[kw]:774,[Cw]:772,[_w]:769,[V0]:771,[Bw]:775,[Pw]:773};function ne(G,de,J,be,ge,Ee,Re,Ve){if(G===dr){p===!0&&(Le(3042),p=!1);return}if(p===!1&&(pe(3042),p=!0),G!==Dw){if(G!==d||Ve!==D){if((g!==es||m!==es)&&(r.blendEquation(32774),g=es,m=es),Ve)switch(G){case Ea:r.blendFuncSeparate(1,771,1,771);break;case I0:r.blendFunc(1,1);break;case U0:r.blendFuncSeparate(0,0,769,771);break;case N0:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Ea:r.blendFuncSeparate(770,771,1,771);break;case I0:r.blendFunc(770,1);break;case U0:r.blendFunc(0,769);break;case N0:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}x=null,y=null,b=null,w=null,d=G,D=Ve}return}ge=ge||de,Ee=Ee||J,Re=Re||be,(de!==g||ge!==m)&&(r.blendEquationSeparate(Z[de],Z[ge]),g=de,m=ge),(J!==x||be!==y||Ee!==b||Re!==w)&&(r.blendFuncSeparate(ae[J],ae[be],ae[Ee],ae[Re]),x=J,y=be,b=Ee,w=Re),d=G,D=null}function fe(G,de){G.side===jn?Le(2884):pe(2884);let J=G.side===At;de&&(J=!J),W(J),G.blending===Ea&&G.transparent===!1?ne(dr):ne(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.premultipliedAlpha),l.setFunc(G.depthFunc),l.setTest(G.depthTest),l.setMask(G.depthWrite),a.setMask(G.colorWrite);let be=G.stencilWrite;u.setTest(be),be&&(u.setMask(G.stencilWriteMask),u.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),u.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),ue(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?pe(32926):Le(32926)}function W(G){R!==G&&(G?r.frontFace(2304):r.frontFace(2305),R=G)}function Q(G){G!==Sw?(pe(2884),G!==L&&(G===k0?r.cullFace(1029):G===Lw?r.cullFace(1028):r.cullFace(1032))):Le(2884),L=G}function le(G){G!==T&&(j&&r.lineWidth(G),T=G)}function ue(G,de,J){G?(pe(32823),(U!==de||F!==J)&&(r.polygonOffset(de,J),U=de,F=J)):Le(32823)}function Se(G){G?pe(3089):Le(3089)}function ce(G){G===void 0&&(G=33984+C-1),O!==G&&(r.activeTexture(G),O=G)}function Ue(G,de){O===null&&ce();let J=V[O];J===void 0&&(J={type:void 0,texture:void 0},V[O]=J),(J.type!==G||J.texture!==de)&&(r.bindTexture(G,de||ve[G]),J.type=G,J.texture=de)}function We(){let G=V[O];G!==void 0&&G.type!==void 0&&(r.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function nt(){try{r.compressedTexImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Et(){try{r.texSubImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function k(){try{r.texStorage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function _(){try{r.texImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function te(){try{r.texImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ie(G){he.equals(G)===!1&&(r.scissor(G.x,G.y,G.z,G.w),he.copy(G))}function Fe(G){Y.equals(G)===!1&&(r.viewport(G.x,G.y,G.z,G.w),Y.copy(G))}function Me(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),c={},O=null,V={},f={},h=null,p=!1,d=null,g=null,x=null,y=null,m=null,b=null,w=null,D=!1,R=null,L=null,T=null,U=null,F=null,he.set(0,0,r.canvas.width,r.canvas.height),Y.set(0,0,r.canvas.width,r.canvas.height),a.reset(),l.reset(),u.reset()}return{buffers:{color:a,depth:l,stencil:u},enable:pe,disable:Le,bindFramebuffer:Ie,useProgram:P,setBlending:ne,setMaterial:fe,setFlipSided:W,setCullFace:Q,setLineWidth:le,setPolygonOffset:ue,setScissorTest:Se,activeTexture:ce,bindTexture:Ue,unbindTexture:We,compressedTexImage2D:nt,texImage2D:_,texImage3D:te,texStorage2D:k,texSubImage2D:Et,scissor:ie,viewport:Fe,reset:Me}}function j4(r,e,t,n,i,o,s){let a=i.isWebGL2,l=i.maxTextures,u=i.maxCubemapSize,c=i.maxTextureSize,f=i.maxSamples,p=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):void 0,d=new WeakMap,g,x=!1;try{x=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(k){}function y(k,_){return x?new OffscreenCanvas(k,_):Ff("canvas")}function m(k,_,te,ie){let Fe=1;if((k.width>ie||k.height>ie)&&(Fe=ie/Math.max(k.width,k.height)),Fe<1||_===!0)if(typeof HTMLImageElement!="undefined"&&k instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&k instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&k instanceof ImageBitmap){let Me=_?Jb:Math.floor,G=Me(Fe*k.width),de=Me(Fe*k.height);g===void 0&&(g=y(G,de));let J=te?y(G,de):g;return J.width=G,J.height=de,J.getContext("2d").drawImage(k,0,0,G,de),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+k.width+"x"+k.height+") to ("+G+"x"+de+")."),J}else return"data"in k&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+k.width+"x"+k.height+")."),k;return k}function b(k){return ag(k.width)&&ag(k.height)}function w(k){return a?!1:k.wrapS!==mn||k.wrapT!==mn||k.minFilter!==jt&&k.minFilter!==Kt}function D(k,_){return k.generateMipmaps&&_&&k.minFilter!==jt&&k.minFilter!==Kt}function R(k){r.generateMipmap(k)}function L(k,_,te){if(a===!1)return _;if(k!==null){if(r[k]!==void 0)return r[k];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+k+"'")}let ie=_;return _===6403&&(te===5126&&(ie=33326),te===5131&&(ie=33325),te===5121&&(ie=33321)),_===6407&&(te===5126&&(ie=34837),te===5131&&(ie=34843),te===5121&&(ie=32849)),_===6408&&(te===5126&&(ie=34836),te===5131&&(ie=34842),te===5121&&(ie=32856)),(ie===33325||ie===33326||ie===34842||ie===34836)&&e.get("EXT_color_buffer_float"),ie}function T(k,_,te){return D(k,te)===!0?Math.log2(Math.max(_.width,_.height))+1:k.mipmaps.length>0?k.mipmaps.length:1}function U(k){return k===jt||k===Sf||k===Lf?9728:9729}function F(k){let _=k.target;_.removeEventListener("dispose",F),j(_),_.isVideoTexture&&d.delete(_),s.memory.textures--}function C(k){let _=k.target;_.removeEventListener("dispose",C),B(_)}function j(k){let _=n.get(k);_.__webglInit!==void 0&&(r.deleteTexture(_.__webglTexture),n.remove(k))}function B(k){let _=k.texture,te=n.get(k),ie=n.get(_);if(!!k){if(ie.__webglTexture!==void 0&&(r.deleteTexture(ie.__webglTexture),s.memory.textures--),k.depthTexture&&k.depthTexture.dispose(),k.isWebGLCubeRenderTarget)for(let Fe=0;Fe<6;Fe++)r.deleteFramebuffer(te.__webglFramebuffer[Fe]),te.__webglDepthbuffer&&r.deleteRenderbuffer(te.__webglDepthbuffer[Fe]);else r.deleteFramebuffer(te.__webglFramebuffer),te.__webglDepthbuffer&&r.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&r.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer&&r.deleteRenderbuffer(te.__webglColorRenderbuffer),te.__webglDepthRenderbuffer&&r.deleteRenderbuffer(te.__webglDepthRenderbuffer);if(k.isWebGLMultipleRenderTargets)for(let Fe=0,Me=_.length;Fe<Me;Fe++){let G=n.get(_[Fe]);G.__webglTexture&&(r.deleteTexture(G.__webglTexture),s.memory.textures--),n.remove(_[Fe])}n.remove(_),n.remove(k)}}let z=0;function O(){z=0}function V(){let k=z;return k>=l&&console.warn("THREE.WebGLTextures: Trying to use "+k+" texture units while this GPU supports only "+l),z+=1,k}function q(k,_){let te=n.get(k);if(k.isVideoTexture&&ce(k),k.version>0&&te.__version!==k.version){let ie=k.image;if(ie===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(ie.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ie(te,k,_);return}}t.activeTexture(33984+_),t.bindTexture(3553,te.__webglTexture)}function se(k,_){let te=n.get(k);if(k.version>0&&te.__version!==k.version){Ie(te,k,_);return}t.activeTexture(33984+_),t.bindTexture(35866,te.__webglTexture)}function he(k,_){let te=n.get(k);if(k.version>0&&te.__version!==k.version){Ie(te,k,_);return}t.activeTexture(33984+_),t.bindTexture(32879,te.__webglTexture)}function Y(k,_){let te=n.get(k);if(k.version>0&&te.__version!==k.version){P(te,k,_);return}t.activeTexture(33984+_),t.bindTexture(34067,te.__webglTexture)}let X={[ku]:10497,[mn]:33071,[Bu]:33648},ve={[jt]:9728,[Sf]:9984,[Lf]:9986,[Kt]:9729,[H0]:9985,[is]:9987};function pe(k,_,te){if(te?(r.texParameteri(k,10242,X[_.wrapS]),r.texParameteri(k,10243,X[_.wrapT]),(k===32879||k===35866)&&r.texParameteri(k,32882,X[_.wrapR]),r.texParameteri(k,10240,ve[_.magFilter]),r.texParameteri(k,10241,ve[_.minFilter])):(r.texParameteri(k,10242,33071),r.texParameteri(k,10243,33071),(k===32879||k===35866)&&r.texParameteri(k,32882,33071),(_.wrapS!==mn||_.wrapT!==mn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(k,10240,U(_.magFilter)),r.texParameteri(k,10241,U(_.minFilter)),_.minFilter!==jt&&_.minFilter!==Kt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){let ie=e.get("EXT_texture_filter_anisotropic");if(_.type===Qi&&e.has("OES_texture_float_linear")===!1||a===!1&&_.type===rs&&e.has("OES_texture_half_float_linear")===!1)return;(_.anisotropy>1||n.get(_).__currentAnisotropy)&&(r.texParameterf(k,ie.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,i.getMaxAnisotropy())),n.get(_).__currentAnisotropy=_.anisotropy)}}function Le(k,_){k.__webglInit===void 0&&(k.__webglInit=!0,_.addEventListener("dispose",F),k.__webglTexture=r.createTexture(),s.memory.textures++)}function Ie(k,_,te){let ie=3553;_.isDataTexture2DArray&&(ie=35866),_.isDataTexture3D&&(ie=32879),Le(k,_),t.activeTexture(33984+te),t.bindTexture(ie,k.__webglTexture),r.pixelStorei(37440,_.flipY),r.pixelStorei(37441,_.premultiplyAlpha),r.pixelStorei(3317,_.unpackAlignment),r.pixelStorei(37443,0);let Fe=w(_)&&b(_.image)===!1,Me=m(_.image,Fe,!1,c),G=b(Me)||a,de=o.convert(_.format),J=o.convert(_.type),be=L(_.internalFormat,de,J,_.encoding);pe(ie,_,G);let ge,Ee=_.mipmaps;if(_.isDepthTexture)be=6402,a?_.type===Qi?be=36012:_.type===zu?be=33190:_.type===os?be=35056:be=33189:_.type===Qi&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),_.format===oo&&be===6402&&_.type!==Ra&&_.type!==zu&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),_.type=Ra,J=o.convert(_.type)),_.format===ss&&be===6402&&(be=34041,_.type!==os&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),_.type=os,J=o.convert(_.type))),t.texImage2D(3553,0,be,Me.width,Me.height,0,de,J,null);else if(_.isDataTexture)if(Ee.length>0&&G){for(let Re=0,Ve=Ee.length;Re<Ve;Re++)ge=Ee[Re],t.texImage2D(3553,Re,be,ge.width,ge.height,0,de,J,ge.data);_.generateMipmaps=!1}else t.texImage2D(3553,0,be,Me.width,Me.height,0,de,J,Me.data);else if(_.isCompressedTexture)for(let Re=0,Ve=Ee.length;Re<Ve;Re++)ge=Ee[Re],_.format!==gn&&_.format!==ro?de!==null?t.compressedTexImage2D(3553,Re,be,ge.width,ge.height,0,ge.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):t.texImage2D(3553,Re,be,ge.width,ge.height,0,de,J,ge.data);else if(_.isDataTexture2DArray)t.texImage3D(35866,0,be,Me.width,Me.height,Me.depth,0,de,J,Me.data);else if(_.isDataTexture3D)t.texImage3D(32879,0,be,Me.width,Me.height,Me.depth,0,de,J,Me.data);else{let Re=T(_,Me,G),Ve=a&&_.isVideoTexture!==!0,Mt=k.__version===void 0;if(Ee.length>0&&G){Ve&&Mt&&t.texStorage2D(3553,Re,be,Ee[0].width,Ee[0].height);for(let Ze=0,ii=Ee.length;Ze<ii;Ze++)ge=Ee[Ze],Ve?t.texSubImage2D(3553,Ze,0,0,de,J,ge):t.texImage2D(3553,Ze,be,de,J,ge);_.generateMipmaps=!1}else Ve?(Mt&&t.texStorage2D(3553,Re,be,Me.width,Me.height),t.texSubImage2D(3553,0,0,0,de,J,Me)):t.texImage2D(3553,0,be,de,J,Me)}D(_,G)&&R(ie),k.__version=_.version,_.onUpdate&&_.onUpdate(_)}function P(k,_,te){if(_.image.length!==6)return;Le(k,_),t.activeTexture(33984+te),t.bindTexture(34067,k.__webglTexture),r.pixelStorei(37440,_.flipY),r.pixelStorei(37441,_.premultiplyAlpha),r.pixelStorei(3317,_.unpackAlignment),r.pixelStorei(37443,0);let ie=_&&(_.isCompressedTexture||_.image[0].isCompressedTexture),Fe=_.image[0]&&_.image[0].isDataTexture,Me=[];for(let Re=0;Re<6;Re++)!ie&&!Fe?Me[Re]=m(_.image[Re],!1,!0,u):Me[Re]=Fe?_.image[Re].image:_.image[Re];let G=Me[0],de=b(G)||a,J=o.convert(_.format),be=o.convert(_.type),ge=L(_.internalFormat,J,be,_.encoding);pe(34067,_,de);let Ee;if(ie)for(let Re=0;Re<6;Re++){Ee=Me[Re].mipmaps;for(let Ve=0;Ve<Ee.length;Ve++){let Mt=Ee[Ve];_.format!==gn&&_.format!==ro?J!==null?t.compressedTexImage2D(34069+Re,Ve,ge,Mt.width,Mt.height,0,Mt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):t.texImage2D(34069+Re,Ve,ge,Mt.width,Mt.height,0,J,be,Mt.data)}}else{Ee=_.mipmaps;for(let Re=0;Re<6;Re++)if(Fe){t.texImage2D(34069+Re,0,ge,Me[Re].width,Me[Re].height,0,J,be,Me[Re].data);for(let Ve=0;Ve<Ee.length;Ve++){let Ze=Ee[Ve].image[Re].image;t.texImage2D(34069+Re,Ve+1,ge,Ze.width,Ze.height,0,J,be,Ze.data)}}else{t.texImage2D(34069+Re,0,ge,J,be,Me[Re]);for(let Ve=0;Ve<Ee.length;Ve++){let Mt=Ee[Ve];t.texImage2D(34069+Re,Ve+1,ge,J,be,Mt.image[Re])}}}D(_,de)&&R(34067),k.__version=_.version,_.onUpdate&&_.onUpdate(_)}function Z(k,_,te,ie,Fe){let Me=o.convert(te.format),G=o.convert(te.type),de=L(te.internalFormat,Me,G,te.encoding);n.get(_).__hasExternalTextures||(Fe===32879||Fe===35866?t.texImage3D(Fe,0,de,_.width,_.height,_.depth,0,Me,G,null):t.texImage2D(Fe,0,de,_.width,_.height,0,Me,G,null)),t.bindFramebuffer(36160,k),_.useRenderToTexture?p.framebufferTexture2DMultisampleEXT(36160,ie,Fe,n.get(te).__webglTexture,0,Se(_)):r.framebufferTexture2D(36160,ie,Fe,n.get(te).__webglTexture,0),t.bindFramebuffer(36160,null)}function ae(k,_,te){if(r.bindRenderbuffer(36161,k),_.depthBuffer&&!_.stencilBuffer){let ie=33189;if(te||_.useRenderToTexture){let Fe=_.depthTexture;Fe&&Fe.isDepthTexture&&(Fe.type===Qi?ie=36012:Fe.type===zu&&(ie=33190));let Me=Se(_);_.useRenderToTexture?p.renderbufferStorageMultisampleEXT(36161,Me,ie,_.width,_.height):r.renderbufferStorageMultisample(36161,Me,ie,_.width,_.height)}else r.renderbufferStorage(36161,ie,_.width,_.height);r.framebufferRenderbuffer(36160,36096,36161,k)}else if(_.depthBuffer&&_.stencilBuffer){let ie=Se(_);te&&_.useRenderbuffer?r.renderbufferStorageMultisample(36161,ie,35056,_.width,_.height):_.useRenderToTexture?p.renderbufferStorageMultisampleEXT(36161,ie,35056,_.width,_.height):r.renderbufferStorage(36161,34041,_.width,_.height),r.framebufferRenderbuffer(36160,33306,36161,k)}else{let ie=_.isWebGLMultipleRenderTargets===!0?_.texture[0]:_.texture,Fe=o.convert(ie.format),Me=o.convert(ie.type),G=L(ie.internalFormat,Fe,Me,ie.encoding),de=Se(_);te&&_.useRenderbuffer?r.renderbufferStorageMultisample(36161,de,G,_.width,_.height):_.useRenderToTexture?p.renderbufferStorageMultisampleEXT(36161,de,G,_.width,_.height):r.renderbufferStorage(36161,G,_.width,_.height)}r.bindRenderbuffer(36161,null)}function ne(k,_){if(_&&_.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,k),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(_.depthTexture).__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),q(_.depthTexture,0);let ie=n.get(_.depthTexture).__webglTexture,Fe=Se(_);if(_.depthTexture.format===oo)_.useRenderToTexture?p.framebufferTexture2DMultisampleEXT(36160,36096,3553,ie,0,Fe):r.framebufferTexture2D(36160,36096,3553,ie,0);else if(_.depthTexture.format===ss)_.useRenderToTexture?p.framebufferTexture2DMultisampleEXT(36160,33306,3553,ie,0,Fe):r.framebufferTexture2D(36160,33306,3553,ie,0);else throw new Error("Unknown depthTexture format")}function fe(k){let _=n.get(k),te=k.isWebGLCubeRenderTarget===!0;if(k.depthTexture&&!_.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");ne(_.__webglFramebuffer,k)}else if(te){_.__webglDepthbuffer=[];for(let ie=0;ie<6;ie++)t.bindFramebuffer(36160,_.__webglFramebuffer[ie]),_.__webglDepthbuffer[ie]=r.createRenderbuffer(),ae(_.__webglDepthbuffer[ie],k,!1)}else t.bindFramebuffer(36160,_.__webglFramebuffer),_.__webglDepthbuffer=r.createRenderbuffer(),ae(_.__webglDepthbuffer,k,!1);t.bindFramebuffer(36160,null)}function W(k,_,te){let ie=n.get(k);_!==void 0&&Z(ie.__webglFramebuffer,k,k.texture,36064,3553),te!==void 0&&fe(k)}function Q(k){let _=k.texture,te=n.get(k),ie=n.get(_);k.addEventListener("dispose",C),k.isWebGLMultipleRenderTargets!==!0&&(ie.__webglTexture===void 0&&(ie.__webglTexture=r.createTexture()),ie.__version=_.version,s.memory.textures++);let Fe=k.isWebGLCubeRenderTarget===!0,Me=k.isWebGLMultipleRenderTargets===!0,G=_.isDataTexture3D||_.isDataTexture2DArray,de=b(k)||a;if(a&&_.format===ro&&(_.type===Qi||_.type===rs)&&(_.format=gn,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),Fe){te.__webglFramebuffer=[];for(let J=0;J<6;J++)te.__webglFramebuffer[J]=r.createFramebuffer()}else if(te.__webglFramebuffer=r.createFramebuffer(),Me)if(i.drawBuffers){let J=k.texture;for(let be=0,ge=J.length;be<ge;be++){let Ee=n.get(J[be]);Ee.__webglTexture===void 0&&(Ee.__webglTexture=r.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(k.useRenderbuffer)if(a){te.__webglMultisampledFramebuffer=r.createFramebuffer(),te.__webglColorRenderbuffer=r.createRenderbuffer(),r.bindRenderbuffer(36161,te.__webglColorRenderbuffer);let J=o.convert(_.format),be=o.convert(_.type),ge=L(_.internalFormat,J,be,_.encoding),Ee=Se(k);r.renderbufferStorageMultisample(36161,Ee,ge,k.width,k.height),t.bindFramebuffer(36160,te.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064,36161,te.__webglColorRenderbuffer),r.bindRenderbuffer(36161,null),k.depthBuffer&&(te.__webglDepthRenderbuffer=r.createRenderbuffer(),ae(te.__webglDepthRenderbuffer,k,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(Fe){t.bindTexture(34067,ie.__webglTexture),pe(34067,_,de);for(let J=0;J<6;J++)Z(te.__webglFramebuffer[J],k,_,36064,34069+J);D(_,de)&&R(34067),t.unbindTexture()}else if(Me){let J=k.texture;for(let be=0,ge=J.length;be<ge;be++){let Ee=J[be],Re=n.get(Ee);t.bindTexture(3553,Re.__webglTexture),pe(3553,Ee,de),Z(te.__webglFramebuffer,k,Ee,36064+be,3553),D(Ee,de)&&R(3553)}t.unbindTexture()}else{let J=3553;G&&(a?J=_.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(J,ie.__webglTexture),pe(J,_,de),Z(te.__webglFramebuffer,k,_,36064,J),D(_,de)&&R(J),t.unbindTexture()}k.depthBuffer&&fe(k)}function le(k){let _=b(k)||a,te=k.isWebGLMultipleRenderTargets===!0?k.texture:[k.texture];for(let ie=0,Fe=te.length;ie<Fe;ie++){let Me=te[ie];if(D(Me,_)){let G=k.isWebGLCubeRenderTarget?34067:3553,de=n.get(Me).__webglTexture;t.bindTexture(G,de),R(G),t.unbindTexture()}}}function ue(k){if(k.useRenderbuffer)if(a){let _=k.width,te=k.height,ie=16384,Fe=[36064],Me=k.stencilBuffer?33306:36096;k.depthBuffer&&Fe.push(Me),k.ignoreDepthForMultisampleCopy||(k.depthBuffer&&(ie|=256),k.stencilBuffer&&(ie|=1024));let G=n.get(k);t.bindFramebuffer(36008,G.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,G.__webglFramebuffer),k.ignoreDepthForMultisampleCopy&&(r.invalidateFramebuffer(36008,[Me]),r.invalidateFramebuffer(36009,[Me])),r.blitFramebuffer(0,0,_,te,0,0,_,te,ie,9728),r.invalidateFramebuffer(36008,Fe),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,G.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function Se(k){return a&&(k.useRenderbuffer||k.useRenderToTexture)?Math.min(f,k.samples):0}function ce(k){let _=s.render.frame;d.get(k)!==_&&(d.set(k,_),k.update())}let Ue=!1,We=!1;function nt(k,_){k&&k.isWebGLRenderTarget&&(Ue===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Ue=!0),k=k.texture),q(k,_)}function Et(k,_){k&&k.isWebGLCubeRenderTarget&&(We===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),We=!0),k=k.texture),Y(k,_)}this.allocateTextureUnit=V,this.resetTextureUnits=O,this.setTexture2D=q,this.setTexture2DArray=se,this.setTexture3D=he,this.setTextureCube=Y,this.rebindTextures=W,this.setupRenderTarget=Q,this.updateRenderTargetMipmap=le,this.updateMultisampleRenderTarget=ue,this.setupDepthRenderbuffer=fe,this.setupFrameBufferTexture=Z,this.safeSetTexture2D=nt,this.safeSetTextureCube=Et}function Y3(r,e,t){let n=t.isWebGL2;function i(o){let s;if(o===mr)return 5121;if(o===eb)return 32819;if(o===tb)return 32820;if(o===nb)return 33635;if(o===Zw)return 5120;if(o===Jw)return 5122;if(o===Ra)return 5123;if(o===$w)return 5124;if(o===zu)return 5125;if(o===Qi)return 5126;if(o===rs)return n?5131:(s=e.get("OES_texture_half_float"),s!==null?s.HALF_FLOAT_OES:null);if(o===ib)return 6406;if(o===ro)return 6407;if(o===gn)return 6408;if(o===rb)return 6409;if(o===ob)return 6410;if(o===oo)return 6402;if(o===ss)return 34041;if(o===ab)return 6403;if(o===lb)return 36244;if(o===ub)return 33319;if(o===cb)return 33320;if(o===hb)return 36248;if(o===fb)return 36249;if(o===q0||o===j0||o===Q0||o===Y0)if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(o===q0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(o===j0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(o===Q0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(o===Y0)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(o===X0||o===K0||o===Z0||o===J0)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(o===X0)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(o===K0)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(o===Z0)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(o===J0)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(o===pb)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if((o===$0||o===eg)&&(s=e.get("WEBGL_compressed_texture_etc"),s!==null)){if(o===$0)return s.COMPRESSED_RGB8_ETC2;if(o===eg)return s.COMPRESSED_RGBA8_ETC2_EAC}if(o===db||o===mb||o===gb||o===yb||o===vb||o===xb||o===wb||o===bb||o===Sb||o===Lb||o===Ab||o===Db||o===Eb||o===Mb||o===Tb||o===Fb||o===_b||o===Cb||o===Pb||o===kb||o===Bb||o===zb||o===Ib||o===Ub||o===Nb||o===Ob||o===Gb||o===Wb)return s=e.get("WEBGL_compressed_texture_astc"),s!==null?o:null;if(o===Rb)return s=e.get("EXT_texture_compression_bptc"),s!==null?o:null;if(o===os)return n?34042:(s=e.get("WEBGL_depth_texture"),s!==null?s.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}function Y4(r){function e(y,m){y.fogColor.value.copy(m.color),m.isFog?(y.fogNear.value=m.near,y.fogFar.value=m.far):m.isFogExp2&&(y.fogDensity.value=m.density)}function t(y,m,b,w,D){m.isMeshBasicMaterial?n(y,m):m.isMeshLambertMaterial?(n(y,m),l(y,m)):m.isMeshToonMaterial?(n(y,m),c(y,m)):m.isMeshPhongMaterial?(n(y,m),u(y,m)):m.isMeshStandardMaterial?(n(y,m),m.isMeshPhysicalMaterial?h(y,m,D):f(y,m)):m.isMeshMatcapMaterial?(n(y,m),p(y,m)):m.isMeshDepthMaterial?(n(y,m),d(y,m)):m.isMeshDistanceMaterial?(n(y,m),g(y,m)):m.isMeshNormalMaterial?(n(y,m),x(y,m)):m.isLineBasicMaterial?(i(y,m),m.isLineDashedMaterial&&o(y,m)):m.isPointsMaterial?s(y,m,b,w):m.isSpriteMaterial?a(y,m):m.isShadowMaterial?(y.color.value.copy(m.color),y.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function n(y,m){y.opacity.value=m.opacity,m.color&&y.diffuse.value.copy(m.color),m.emissive&&y.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(y.map.value=m.map),m.alphaMap&&(y.alphaMap.value=m.alphaMap),m.specularMap&&(y.specularMap.value=m.specularMap),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest);let b=r.get(m).envMap;b&&(y.envMap.value=b,y.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=m.reflectivity,y.ior.value=m.ior,y.refractionRatio.value=m.refractionRatio),m.lightMap&&(y.lightMap.value=m.lightMap,y.lightMapIntensity.value=m.lightMapIntensity),m.aoMap&&(y.aoMap.value=m.aoMap,y.aoMapIntensity.value=m.aoMapIntensity);let w;m.map?w=m.map:m.specularMap?w=m.specularMap:m.displacementMap?w=m.displacementMap:m.normalMap?w=m.normalMap:m.bumpMap?w=m.bumpMap:m.roughnessMap?w=m.roughnessMap:m.metalnessMap?w=m.metalnessMap:m.alphaMap?w=m.alphaMap:m.emissiveMap?w=m.emissiveMap:m.clearcoatMap?w=m.clearcoatMap:m.clearcoatNormalMap?w=m.clearcoatNormalMap:m.clearcoatRoughnessMap?w=m.clearcoatRoughnessMap:m.specularIntensityMap?w=m.specularIntensityMap:m.specularColorMap?w=m.specularColorMap:m.transmissionMap?w=m.transmissionMap:m.thicknessMap?w=m.thicknessMap:m.sheenColorMap?w=m.sheenColorMap:m.sheenRoughnessMap&&(w=m.sheenRoughnessMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),y.uvTransform.value.copy(w.matrix));let D;m.aoMap?D=m.aoMap:m.lightMap&&(D=m.lightMap),D!==void 0&&(D.isWebGLRenderTarget&&(D=D.texture),D.matrixAutoUpdate===!0&&D.updateMatrix(),y.uv2Transform.value.copy(D.matrix))}function i(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity}function o(y,m){y.dashSize.value=m.dashSize,y.totalSize.value=m.dashSize+m.gapSize,y.scale.value=m.scale}function s(y,m,b,w){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.size.value=m.size*b,y.scale.value=w*.5,m.map&&(y.map.value=m.map),m.alphaMap&&(y.alphaMap.value=m.alphaMap),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest);let D;m.map?D=m.map:m.alphaMap&&(D=m.alphaMap),D!==void 0&&(D.matrixAutoUpdate===!0&&D.updateMatrix(),y.uvTransform.value.copy(D.matrix))}function a(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.rotation.value=m.rotation,m.map&&(y.map.value=m.map),m.alphaMap&&(y.alphaMap.value=m.alphaMap),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest);let b;m.map?b=m.map:m.alphaMap&&(b=m.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),y.uvTransform.value.copy(b.matrix))}function l(y,m){m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap)}function u(y,m){y.specular.value.copy(m.specular),y.shininess.value=Math.max(m.shininess,1e-4),m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function c(y,m){m.gradientMap&&(y.gradientMap.value=m.gradientMap),m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function f(y,m){y.roughness.value=m.roughness,y.metalness.value=m.metalness,m.roughnessMap&&(y.roughnessMap.value=m.roughnessMap),m.metalnessMap&&(y.metalnessMap.value=m.metalnessMap),m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias),r.get(m).envMap&&(y.envMapIntensity.value=m.envMapIntensity)}function h(y,m,b){f(y,m),y.ior.value=m.ior,m.sheen>0&&(y.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),y.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(y.sheenColorMap.value=m.sheenColorMap),m.sheenRoughnessMap&&(y.sheenRoughnessMap.value=m.sheenRoughnessMap)),m.clearcoat>0&&(y.clearcoat.value=m.clearcoat,y.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(y.clearcoatMap.value=m.clearcoatMap),m.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap),m.clearcoatNormalMap&&(y.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),y.clearcoatNormalMap.value=m.clearcoatNormalMap,m.side===At&&y.clearcoatNormalScale.value.negate())),m.transmission>0&&(y.transmission.value=m.transmission,y.transmissionSamplerMap.value=b.texture,y.transmissionSamplerSize.value.set(b.width,b.height),m.transmissionMap&&(y.transmissionMap.value=m.transmissionMap),y.thickness.value=m.thickness,m.thicknessMap&&(y.thicknessMap.value=m.thicknessMap),y.attenuationDistance.value=m.attenuationDistance,y.attenuationColor.value.copy(m.attenuationColor)),y.specularIntensity.value=m.specularIntensity,y.specularColor.value.copy(m.specularColor),m.specularIntensityMap&&(y.specularIntensityMap.value=m.specularIntensityMap),m.specularColorMap&&(y.specularColorMap.value=m.specularColorMap)}function p(y,m){m.matcap&&(y.matcap.value=m.matcap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function d(y,m){m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function g(y,m){m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias),y.referencePosition.value.copy(m.referencePosition),y.nearDistance.value=m.nearDistance,y.farDistance.value=m.farDistance}function x(y,m){m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function X4(){let r=Ff("canvas");return r.style.display="block",r}function ft(r={}){let e=r.canvas!==void 0?r.canvas:X4(),t=r.context!==void 0?r.context:null,n=r.alpha!==void 0?r.alpha:!1,i=r.depth!==void 0?r.depth:!0,o=r.stencil!==void 0?r.stencil:!0,s=r.antialias!==void 0?r.antialias:!1,a=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,u=r.powerPreference!==void 0?r.powerPreference:"default",c=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1,f=null,h=null,p=[],d=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Pn,this.physicallyCorrectLights=!1,this.toneMapping=io,this.toneMappingExposure=1;let g=this,x=!1,y=0,m=0,b=null,w=-1,D=null,R=new xt,L=new xt,T=null,U=e.width,F=e.height,C=1,j=null,B=null,z=new xt(0,0,U,F),O=new xt(0,0,U,F),V=!1,q=[],se=new Qa,he=!1,Y=!1,X=null,ve=new Ae,pe=new M,Le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ie(){return b===null?C:1}let P=t;function Z(v,A){for(let I=0;I<v.length;I++){let N=v[I],K=e.getContext(N,A);if(K!==null)return K}return null}try{let v={alpha:n,depth:i,stencil:o,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${xf}`),e.addEventListener("webglcontextlost",Re,!1),e.addEventListener("webglcontextrestored",Ve,!1),P===null){let A=["webgl2","webgl","experimental-webgl"];if(g.isWebGL1Renderer===!0&&A.shift(),P=Z(A,v),P===null)throw Z(A)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}P.getShaderPrecisionFormat===void 0&&(P.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(v){throw console.error("THREE.WebGLRenderer: "+v.message),v}let ae,ne,fe,W,Q,le,ue,Se,ce,Ue,We,nt,Et,k,_,te,ie,Fe,Me,G,de,J,be;function ge(){ae=new w5(P),ne=new p5(P,ae,r),ae.init(ne),J=new Y3(P,ae,ne),fe=new q4(P,ae,ne),q[0]=1029,W=new L5(P),Q=new k4,le=new j4(P,ae,fe,Q,ne,J,W),ue=new m5(g),Se=new x5(g),ce=new IR(P,ne),be=new h5(P,ae,ce,ne),Ue=new b5(P,ce,W,be),We=new M5(P,Ue,ce,W),Me=new E5(P,ne,le),te=new d5(Q),nt=new P4(g,ue,Se,ae,ne,be,te),Et=new Y4(Q),k=new z4(Q),_=new W4(ae,ne),Fe=new c5(g,ue,fe,We,a),ie=new Q3(g,We,ne),G=new f5(P,ae,W,ne),de=new S5(P,ae,W,ne),W.programs=nt.programs,g.capabilities=ne,g.extensions=ae,g.properties=Q,g.renderLists=k,g.shadowMap=ie,g.state=fe,g.info=W}ge();let Ee=new X3(g,P);this.xr=Ee,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let v=ae.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){let v=ae.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(v){v!==void 0&&(C=v,this.setSize(U,F,!1))},this.getSize=function(v){return v.set(U,F)},this.setSize=function(v,A,I){if(Ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}U=v,F=A,e.width=Math.floor(v*C),e.height=Math.floor(A*C),I!==!1&&(e.style.width=v+"px",e.style.height=A+"px"),this.setViewport(0,0,v,A)},this.getDrawingBufferSize=function(v){return v.set(U*C,F*C).floor()},this.setDrawingBufferSize=function(v,A,I){U=v,F=A,C=I,e.width=Math.floor(v*I),e.height=Math.floor(A*I),this.setViewport(0,0,v,A)},this.getCurrentViewport=function(v){return v.copy(R)},this.getViewport=function(v){return v.copy(z)},this.setViewport=function(v,A,I,N){v.isVector4?z.set(v.x,v.y,v.z,v.w):z.set(v,A,I,N),fe.viewport(R.copy(z).multiplyScalar(C).floor())},this.getScissor=function(v){return v.copy(O)},this.setScissor=function(v,A,I,N){v.isVector4?O.set(v.x,v.y,v.z,v.w):O.set(v,A,I,N),fe.scissor(L.copy(O).multiplyScalar(C).floor())},this.getScissorTest=function(){return V},this.setScissorTest=function(v){fe.setScissorTest(V=v)},this.setOpaqueSort=function(v){j=v},this.setTransparentSort=function(v){B=v},this.getClearColor=function(v){return v.copy(Fe.getClearColor())},this.setClearColor=function(){Fe.setClearColor.apply(Fe,arguments)},this.getClearAlpha=function(){return Fe.getClearAlpha()},this.setClearAlpha=function(){Fe.setClearAlpha.apply(Fe,arguments)},this.clear=function(v,A,I){let N=0;(v===void 0||v)&&(N|=16384),(A===void 0||A)&&(N|=256),(I===void 0||I)&&(N|=1024),P.clear(N)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Re,!1),e.removeEventListener("webglcontextrestored",Ve,!1),k.dispose(),_.dispose(),Q.dispose(),ue.dispose(),Se.dispose(),We.dispose(),be.dispose(),Ee.dispose(),Ee.removeEventListener("sessionstart",ci),Ee.removeEventListener("sessionend",No),X&&(X.dispose(),X=null),lr.stop()};function Re(v){v.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function Ve(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;let v=W.autoReset,A=ie.enabled,I=ie.autoUpdate,N=ie.needsUpdate,K=ie.type;ge(),W.autoReset=v,ie.enabled=A,ie.autoUpdate=I,ie.needsUpdate=N,ie.type=K}function Mt(v){let A=v.target;A.removeEventListener("dispose",Mt),Ze(A)}function Ze(v){ii(v),Q.remove(v)}function ii(v){let A=Q.get(v).programs;A!==void 0&&A.forEach(function(I){nt.releaseProgram(I)})}this.renderBufferDirect=function(v,A,I,N,K,De){A===null&&(A=Le);let _e=K.isMesh&&K.matrixWorld.determinant()<0,ke=Um(v,A,I,N,K);fe.setMaterial(N,_e);let Be=I.index,ht=I.attributes.position;if(Be===null){if(ht===void 0||ht.count===0)return}else if(Be.count===0)return;let Je=1;N.wireframe===!0&&(Be=Ue.getWireframeAttribute(I),Je=2),be.setup(K,N,ke,I,Be);let lt,Bt=G;Be!==null&&(lt=ce.get(Be),Bt=de,Bt.setIndex(lt));let Oo=Be!==null?Be.count:ht.count,yt=I.drawRange.start*Je,su=I.drawRange.count*Je,_t=De!==null?De.start*Je:0,Go=De!==null?De.count*Je:1/0,Wo=Math.max(yt,_t),Vo=Math.min(Oo,yt+su,_t+Go)-1,Qr=Math.max(0,Vo-Wo+1);if(Qr!==0){if(K.isMesh)N.wireframe===!0?(fe.setLineWidth(N.wireframeLinewidth*Ie()),Bt.setMode(1)):Bt.setMode(4);else if(K.isLine){let zt=N.linewidth;zt===void 0&&(zt=1),fe.setLineWidth(zt*Ie()),K.isLineSegments?Bt.setMode(1):K.isLineLoop?Bt.setMode(2):Bt.setMode(3)}else K.isPoints?Bt.setMode(0):K.isSprite&&Bt.setMode(4);if(K.isInstancedMesh)Bt.renderInstances(Wo,Qr,K.count);else if(I.isInstancedBufferGeometry){let zt=Math.min(I.instanceCount,I._maxInstanceCount);Bt.renderInstances(Wo,Qr,zt)}else Bt.render(Wo,Qr)}},this.compile=function(v,A){h=_.get(v),h.init(),d.push(h),v.traverseVisible(function(I){I.isLight&&I.layers.test(A.layers)&&(h.pushLight(I),I.castShadow&&h.pushShadow(I))}),h.setupLights(g.physicallyCorrectLights),v.traverse(function(I){let N=I.material;if(N)if(Array.isArray(N))for(let K=0;K<N.length;K++){let De=N[K];oa(De,v,I)}else oa(N,v,I)}),d.pop(),h=null};let Nn=null;function _h(v){Nn&&Nn(v)}function ci(){lr.stop()}function No(){lr.start()}let lr=new d3;lr.setAnimationLoop(_h),typeof window!="undefined"&&lr.setContext(window),this.setAnimationLoop=function(v){Nn=v,Ee.setAnimationLoop(v),v===null?lr.stop():lr.start()},Ee.addEventListener("sessionstart",ci),Ee.addEventListener("sessionend",No),this.render=function(v,A){if(A!==void 0&&A.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;v.autoUpdate===!0&&v.updateMatrixWorld(),A.parent===null&&A.updateMatrixWorld(),Ee.enabled===!0&&Ee.isPresenting===!0&&(Ee.cameraAutoUpdate===!0&&Ee.updateCamera(A),A=Ee.getCamera()),v.isScene===!0&&v.onBeforeRender(g,v,A,b),h=_.get(v,d.length),h.init(),d.push(h),ve.multiplyMatrices(A.projectionMatrix,A.matrixWorldInverse),se.setFromProjectionMatrix(ve),Y=this.localClippingEnabled,he=te.init(this.clippingPlanes,Y,A),f=k.get(v,p.length),f.init(),p.push(f),ra(v,A,0,g.sortObjects),f.finish(),g.sortObjects===!0&&f.sort(j,B),he===!0&&te.beginShadows();let I=h.state.shadowsArray;if(ie.render(I,v,A),he===!0&&te.endShadows(),this.info.autoReset===!0&&this.info.reset(),Fe.render(f,v),h.setupLights(g.physicallyCorrectLights),A.isArrayCamera){let N=A.cameras;for(let K=0,De=N.length;K<De;K++){let _e=N[K];ru(f,v,_e,_e.viewport)}}else ru(f,v,A);b!==null&&(le.updateMultisampleRenderTarget(b),le.updateRenderTargetMipmap(b)),v.isScene===!0&&v.onAfterRender(g,v,A),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1),be.resetDefaultState(),w=-1,D=null,d.pop(),d.length>0?h=d[d.length-1]:h=null,p.pop(),p.length>0?f=p[p.length-1]:f=null};function ra(v,A,I,N){if(v.visible===!1)return;if(v.layers.test(A.layers)){if(v.isGroup)I=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(A);else if(v.isLight)h.pushLight(v),v.castShadow&&h.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||se.intersectsSprite(v)){N&&pe.setFromMatrixPosition(v.matrixWorld).applyMatrix4(ve);let _e=We.update(v),ke=v.material;ke.visible&&f.push(v,_e,ke,I,pe.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(v.isSkinnedMesh&&v.skeleton.frame!==W.render.frame&&(v.skeleton.update(),v.skeleton.frame=W.render.frame),!v.frustumCulled||se.intersectsObject(v))){N&&pe.setFromMatrixPosition(v.matrixWorld).applyMatrix4(ve);let _e=We.update(v),ke=v.material;if(Array.isArray(ke)){let Be=_e.groups;for(let ht=0,Je=Be.length;ht<Je;ht++){let lt=Be[ht],Bt=ke[lt.materialIndex];Bt&&Bt.visible&&f.push(v,_e,Bt,I,pe.z,lt)}}else ke.visible&&f.push(v,_e,ke,I,pe.z,null)}}let De=v.children;for(let _e=0,ke=De.length;_e<ke;_e++)ra(De[_e],A,I,N)}function ru(v,A,I,N){let K=v.opaque,De=v.transmissive,_e=v.transparent;h.setupLightsView(I),De.length>0&&Ch(K,A,I),N&&fe.viewport(R.copy(N)),K.length>0&&jr(K,A,I),De.length>0&&jr(De,A,I),_e.length>0&&jr(_e,A,I)}function Ch(v,A,I){if(X===null){let _e=s===!0&&ne.isWebGL2===!0?Vu:Qn;X=new _e(1024,1024,{generateMipmaps:!0,type:J.convert(rs)!==null?rs:mr,minFilter:is,magFilter:jt,wrapS:mn,wrapT:mn,useRenderToTexture:ae.has("WEBGL_multisampled_render_to_texture")})}let N=g.getRenderTarget();g.setRenderTarget(X),g.clear();let K=g.toneMapping;g.toneMapping=io,jr(v,A,I),g.toneMapping=K,le.updateMultisampleRenderTarget(X),le.updateRenderTargetMipmap(X),g.setRenderTarget(N)}function jr(v,A,I){let N=A.isScene===!0?A.overrideMaterial:null;for(let K=0,De=v.length;K<De;K++){let _e=v[K],ke=_e.object,Be=_e.geometry,ht=N===null?_e.material:N,Je=_e.group;ke.layers.test(I.layers)&&Im(ke,A,I,Be,ht,Je)}}function Im(v,A,I,N,K,De){v.onBeforeRender(g,A,I,N,K,De),v.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),K.onBeforeRender(g,A,I,N,v,De),K.transparent===!0&&K.side===jn?(K.side=At,K.needsUpdate=!0,g.renderBufferDirect(I,A,N,K,v,De),K.side=ji,K.needsUpdate=!0,g.renderBufferDirect(I,A,N,K,v,De),K.side=jn):g.renderBufferDirect(I,A,N,K,v,De),v.onAfterRender(g,A,I,N,K,De)}function oa(v,A,I){A.isScene!==!0&&(A=Le);let N=Q.get(v),K=h.state.lights,De=h.state.shadowsArray,_e=K.state.version,ke=nt.getParameters(v,K.state,De,A,I),Be=nt.getProgramCacheKey(ke),ht=N.programs;N.environment=v.isMeshStandardMaterial?A.environment:null,N.fog=A.fog,N.envMap=(v.isMeshStandardMaterial?Se:ue).get(v.envMap||N.environment),ht===void 0&&(v.addEventListener("dispose",Mt),ht=new Map,N.programs=ht);let Je=ht.get(Be);if(Je!==void 0){if(N.currentProgram===Je&&N.lightsStateVersion===_e)return ou(v,ke),Je}else ke.uniforms=nt.getUniforms(v),v.onBuild(I,ke,g),v.onBeforeCompile(ke,g),Je=nt.acquireProgram(ke,Be),ht.set(Be,Je),N.uniforms=ke.uniforms;let lt=N.uniforms;(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(lt.clippingPlanes=te.uniform),ou(v,ke),N.needsLights=Om(v),N.lightsStateVersion=_e,N.needsLights&&(lt.ambientLightColor.value=K.state.ambient,lt.lightProbe.value=K.state.probe,lt.directionalLights.value=K.state.directional,lt.directionalLightShadows.value=K.state.directionalShadow,lt.spotLights.value=K.state.spot,lt.spotLightShadows.value=K.state.spotShadow,lt.rectAreaLights.value=K.state.rectArea,lt.ltc_1.value=K.state.rectAreaLTC1,lt.ltc_2.value=K.state.rectAreaLTC2,lt.pointLights.value=K.state.point,lt.pointLightShadows.value=K.state.pointShadow,lt.hemisphereLights.value=K.state.hemi,lt.directionalShadowMap.value=K.state.directionalShadowMap,lt.directionalShadowMatrix.value=K.state.directionalShadowMatrix,lt.spotShadowMap.value=K.state.spotShadowMap,lt.spotShadowMatrix.value=K.state.spotShadowMatrix,lt.pointShadowMap.value=K.state.pointShadowMap,lt.pointShadowMatrix.value=K.state.pointShadowMatrix);let Bt=Je.getUniforms(),Oo=go.seqWithValue(Bt.seq,lt);return N.currentProgram=Je,N.uniformsList=Oo,Je}function ou(v,A){let I=Q.get(v);I.outputEncoding=A.outputEncoding,I.instancing=A.instancing,I.skinning=A.skinning,I.morphTargets=A.morphTargets,I.morphNormals=A.morphNormals,I.morphTargetsCount=A.morphTargetsCount,I.numClippingPlanes=A.numClippingPlanes,I.numIntersection=A.numClipIntersection,I.vertexAlphas=A.vertexAlphas,I.vertexTangents=A.vertexTangents}function Um(v,A,I,N,K){A.isScene!==!0&&(A=Le),le.resetTextureUnits();let De=A.fog,_e=N.isMeshStandardMaterial?A.environment:null,ke=b===null?g.outputEncoding:b.texture.encoding,Be=(N.isMeshStandardMaterial?Se:ue).get(N.envMap||_e),ht=N.vertexColors===!0&&!!I.attributes.color&&I.attributes.color.itemSize===4,Je=!!N.normalMap&&!!I.attributes.tangent,lt=!!I.morphAttributes.position,Bt=!!I.morphAttributes.normal,Oo=I.morphAttributes.position?I.morphAttributes.position.length:0,yt=Q.get(N),su=h.state.lights;if(he===!0&&(Y===!0||v!==D)){let bi=v===D&&N.id===w;te.setState(N,v,bi)}let _t=!1;N.version===yt.__version?(yt.needsLights&&yt.lightsStateVersion!==su.state.version||yt.outputEncoding!==ke||K.isInstancedMesh&&yt.instancing===!1||!K.isInstancedMesh&&yt.instancing===!0||K.isSkinnedMesh&&yt.skinning===!1||!K.isSkinnedMesh&&yt.skinning===!0||yt.envMap!==Be||N.fog&&yt.fog!==De||yt.numClippingPlanes!==void 0&&(yt.numClippingPlanes!==te.numPlanes||yt.numIntersection!==te.numIntersection)||yt.vertexAlphas!==ht||yt.vertexTangents!==Je||yt.morphTargets!==lt||yt.morphNormals!==Bt||ne.isWebGL2===!0&&yt.morphTargetsCount!==Oo)&&(_t=!0):(_t=!0,yt.__version=N.version);let Go=yt.currentProgram;_t===!0&&(Go=oa(N,A,K));let Wo=!1,Vo=!1,Qr=!1,zt=Go.getUniforms(),au=yt.uniforms;if(fe.useProgram(Go.program)&&(Wo=!0,Vo=!0,Qr=!0),N.id!==w&&(w=N.id,Vo=!0),Wo||D!==v){if(zt.setValue(P,"projectionMatrix",v.projectionMatrix),ne.logarithmicDepthBuffer&&zt.setValue(P,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),D!==v&&(D=v,Vo=!0,Qr=!0),N.isShaderMaterial||N.isMeshPhongMaterial||N.isMeshToonMaterial||N.isMeshStandardMaterial||N.envMap){let bi=zt.map.cameraPosition;bi!==void 0&&bi.setValue(P,pe.setFromMatrixPosition(v.matrixWorld))}(N.isMeshPhongMaterial||N.isMeshToonMaterial||N.isMeshLambertMaterial||N.isMeshBasicMaterial||N.isMeshStandardMaterial||N.isShaderMaterial)&&zt.setValue(P,"isOrthographic",v.isOrthographicCamera===!0),(N.isMeshPhongMaterial||N.isMeshToonMaterial||N.isMeshLambertMaterial||N.isMeshBasicMaterial||N.isMeshStandardMaterial||N.isShaderMaterial||N.isShadowMaterial||K.isSkinnedMesh)&&zt.setValue(P,"viewMatrix",v.matrixWorldInverse)}if(K.isSkinnedMesh){zt.setOptional(P,K,"bindMatrix"),zt.setOptional(P,K,"bindMatrixInverse");let bi=K.skeleton;bi&&(ne.floatVertexTextures?(bi.boneTexture===null&&bi.computeBoneTexture(),zt.setValue(P,"boneTexture",bi.boneTexture,le),zt.setValue(P,"boneTextureSize",bi.boneTextureSize)):zt.setOptional(P,bi,"boneMatrices"))}return!!I&&(I.morphAttributes.position!==void 0||I.morphAttributes.normal!==void 0)&&Me.update(K,I,N,Go),(Vo||yt.receiveShadow!==K.receiveShadow)&&(yt.receiveShadow=K.receiveShadow,zt.setValue(P,"receiveShadow",K.receiveShadow)),Vo&&(zt.setValue(P,"toneMappingExposure",g.toneMappingExposure),yt.needsLights&&Nm(au,Qr),De&&N.fog&&Et.refreshFogUniforms(au,De),Et.refreshMaterialUniforms(au,N,C,F,X),go.upload(P,yt.uniformsList,au,le)),N.isShaderMaterial&&N.uniformsNeedUpdate===!0&&(go.upload(P,yt.uniformsList,au,le),N.uniformsNeedUpdate=!1),N.isSpriteMaterial&&zt.setValue(P,"center",K.center),zt.setValue(P,"modelViewMatrix",K.modelViewMatrix),zt.setValue(P,"normalMatrix",K.normalMatrix),zt.setValue(P,"modelMatrix",K.matrixWorld),Go}function Nm(v,A){v.ambientLightColor.needsUpdate=A,v.lightProbe.needsUpdate=A,v.directionalLights.needsUpdate=A,v.directionalLightShadows.needsUpdate=A,v.pointLights.needsUpdate=A,v.pointLightShadows.needsUpdate=A,v.spotLights.needsUpdate=A,v.spotLightShadows.needsUpdate=A,v.rectAreaLights.needsUpdate=A,v.hemisphereLights.needsUpdate=A}function Om(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return m},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(v,A,I){Q.get(v.texture).__webglTexture=A,Q.get(v.depthTexture).__webglTexture=I;let N=Q.get(v);N.__hasExternalTextures=!0,N.__hasExternalTextures&&(N.__autoAllocateDepthBuffer=I===void 0,N.__autoAllocateDepthBuffer||v.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),v.useRenderToTexture=!1,v.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(v,A){let I=Q.get(v);I.__webglFramebuffer=A,I.__useDefaultFramebuffer=A===void 0},this.setRenderTarget=function(v,A=0,I=0){b=v,y=A,m=I;let N=!0;if(v){let Be=Q.get(v);Be.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(36160,null),N=!1):Be.__webglFramebuffer===void 0?le.setupRenderTarget(v):Be.__hasExternalTextures&&le.rebindTextures(v,Q.get(v.texture).__webglTexture,Q.get(v.depthTexture).__webglTexture)}let K=null,De=!1,_e=!1;if(v){let Be=v.texture;(Be.isDataTexture3D||Be.isDataTexture2DArray)&&(_e=!0);let ht=Q.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(K=ht[A],De=!0):v.useRenderbuffer?K=Q.get(v).__webglMultisampledFramebuffer:K=ht,R.copy(v.viewport),L.copy(v.scissor),T=v.scissorTest}else R.copy(z).multiplyScalar(C).floor(),L.copy(O).multiplyScalar(C).floor(),T=V;if(fe.bindFramebuffer(36160,K)&&ne.drawBuffers&&N){let Be=!1;if(v)if(v.isWebGLMultipleRenderTargets){let ht=v.texture;if(q.length!==ht.length||q[0]!==36064){for(let Je=0,lt=ht.length;Je<lt;Je++)q[Je]=36064+Je;q.length=ht.length,Be=!0}}else(q.length!==1||q[0]!==36064)&&(q[0]=36064,q.length=1,Be=!0);else(q.length!==1||q[0]!==1029)&&(q[0]=1029,q.length=1,Be=!0);Be&&(ne.isWebGL2?P.drawBuffers(q):ae.get("WEBGL_draw_buffers").drawBuffersWEBGL(q))}if(fe.viewport(R),fe.scissor(L),fe.setScissorTest(T),De){let Be=Q.get(v.texture);P.framebufferTexture2D(36160,36064,34069+A,Be.__webglTexture,I)}else if(_e){let Be=Q.get(v.texture),ht=A||0;P.framebufferTextureLayer(36160,36064,Be.__webglTexture,I||0,ht)}w=-1},this.readRenderTargetPixels=function(v,A,I,N,K,De,_e){if(!(v&&v.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ke=Q.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&_e!==void 0&&(ke=ke[_e]),ke){fe.bindFramebuffer(36160,ke);try{let Be=v.texture,ht=Be.format,Je=Be.type;if(ht!==gn&&J.convert(ht)!==P.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let lt=Je===rs&&(ae.has("EXT_color_buffer_half_float")||ne.isWebGL2&&ae.has("EXT_color_buffer_float"));if(Je!==mr&&J.convert(Je)!==P.getParameter(35738)&&!(Je===Qi&&(ne.isWebGL2||ae.has("OES_texture_float")||ae.has("WEBGL_color_buffer_float")))&&!lt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}P.checkFramebufferStatus(36160)===36053?A>=0&&A<=v.width-N&&I>=0&&I<=v.height-K&&P.readPixels(A,I,N,K,J.convert(ht),J.convert(Je),De):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{let Be=b!==null?Q.get(b).__webglFramebuffer:null;fe.bindFramebuffer(36160,Be)}}},this.copyFramebufferToTexture=function(v,A,I=0){let N=Math.pow(2,-I),K=Math.floor(A.image.width*N),De=Math.floor(A.image.height*N),_e=J.convert(A.format);ne.isWebGL2&&(_e===6407&&(_e=32849),_e===6408&&(_e=32856)),le.setTexture2D(A,0),P.copyTexImage2D(3553,I,_e,v.x,v.y,K,De,0),fe.unbindTexture()},this.copyTextureToTexture=function(v,A,I,N=0){let K=A.image.width,De=A.image.height,_e=J.convert(I.format),ke=J.convert(I.type);le.setTexture2D(I,0),P.pixelStorei(37440,I.flipY),P.pixelStorei(37441,I.premultiplyAlpha),P.pixelStorei(3317,I.unpackAlignment),A.isDataTexture?P.texSubImage2D(3553,N,v.x,v.y,K,De,_e,ke,A.image.data):A.isCompressedTexture?P.compressedTexSubImage2D(3553,N,v.x,v.y,A.mipmaps[0].width,A.mipmaps[0].height,_e,A.mipmaps[0].data):P.texSubImage2D(3553,N,v.x,v.y,_e,ke,A.image),N===0&&I.generateMipmaps&&P.generateMipmap(3553),fe.unbindTexture()},this.copyTextureToTexture3D=function(v,A,I,N,K=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let De=v.max.x-v.min.x+1,_e=v.max.y-v.min.y+1,ke=v.max.z-v.min.z+1,Be=J.convert(N.format),ht=J.convert(N.type),Je;if(N.isDataTexture3D)le.setTexture3D(N,0),Je=32879;else if(N.isDataTexture2DArray)le.setTexture2DArray(N,0),Je=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(37440,N.flipY),P.pixelStorei(37441,N.premultiplyAlpha),P.pixelStorei(3317,N.unpackAlignment);let lt=P.getParameter(3314),Bt=P.getParameter(32878),Oo=P.getParameter(3316),yt=P.getParameter(3315),su=P.getParameter(32877),_t=I.isCompressedTexture?I.mipmaps[0]:I.image;P.pixelStorei(3314,_t.width),P.pixelStorei(32878,_t.height),P.pixelStorei(3316,v.min.x),P.pixelStorei(3315,v.min.y),P.pixelStorei(32877,v.min.z),I.isDataTexture||I.isDataTexture3D?P.texSubImage3D(Je,K,A.x,A.y,A.z,De,_e,ke,Be,ht,_t.data):I.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),P.compressedTexSubImage3D(Je,K,A.x,A.y,A.z,De,_e,ke,Be,_t.data)):P.texSubImage3D(Je,K,A.x,A.y,A.z,De,_e,ke,Be,ht,_t),P.pixelStorei(3314,lt),P.pixelStorei(32878,Bt),P.pixelStorei(3316,Oo),P.pixelStorei(3315,yt),P.pixelStorei(32877,su),K===0&&N.generateMipmaps&&P.generateMipmap(Je),fe.unbindTexture()},this.initTexture=function(v){le.setTexture2D(v,0),fe.unbindTexture()},this.resetState=function(){y=0,m=0,b=null,fe.reset(),be.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function ip(r,e,t,n,i,o){rl.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(sc.x=o*rl.x-i*rl.y,sc.y=i*rl.x+o*rl.y):sc.copy(rl),r.copy(e),r.x+=sc.x,r.y+=sc.y,r.applyMatrix4(K3)}function pS(r,e,t,n,i,o,s){let a=Kg.distanceSqToPoint(r);if(a<t){let l=new M;Kg.closestPointToPoint(r,l),l.applyMatrix4(n);let u=i.ray.origin.distanceTo(l);if(u<i.near||u>i.far)return;o.push({distance:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:s})}}function e1(){let r=0,e=0,t=0,n=0;function i(o,s,a,l){r=o,e=a,t=-3*o+3*s-2*a-l,n=2*o-2*s+a+l}return{initCatmullRom:function(o,s,a,l,u){i(s,a,u*(a-o),u*(l-s))},initNonuniformCatmullRom:function(o,s,a,l,u,c,f){let h=(s-o)/u-(a-o)/(u+c)+(a-s)/c,p=(a-s)/c-(l-s)/(c+f)+(l-a)/f;h*=c,p*=c,i(s,a,h,p)},calc:function(o){let s=o*o,a=s*o;return r+e*o+t*s+n*a}}}function dS(r,e,t,n,i){let o=(n-e)*.5,s=(i-t)*.5,a=r*r,l=r*a;return(2*t-2*n+o+s)*l+(-3*t+3*n-2*o-s)*a+o*r+t}function J4(r,e){let t=1-r;return t*t*e}function $4(r,e){return 2*(1-r)*r*e}function eF(r,e){return r*r*e}function pc(r,e,t,n){return J4(r,e)+$4(r,t)+eF(r,n)}function tF(r,e){let t=1-r;return t*t*t*e}function nF(r,e){let t=1-r;return 3*t*t*r*e}function iF(r,e){return 3*(1-r)*r*r*e}function rF(r,e){return r*r*r*e}function dc(r,e,t,n,i){return tF(r,e)+nF(r,t)+iF(r,n)+rF(r,i)}function mS(r,e,t,n,i){let o,s;if(i===bF(r,e,t,n)>0)for(o=e;o<t;o+=n)s=vS(o,r[o],r[o+1],s);else for(o=t-n;o>=e;o-=n)s=vS(o,r[o],r[o+1],s);return s&&wp(s,s.next)&&(bc(s),s=s.next),s}function So(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(wp(t,t.next)||Pt(t.prev,t,t.next)===0)){if(bc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function xc(r,e,t,n,i,o,s){if(!r)return;!s&&o&&mF(r,n,i,o);let a=r,l,u;for(;r.prev!==r.next;){if(l=r.prev,u=r.next,o?aF(r,n,i,o):sF(r)){e.push(l.i/t),e.push(r.i/t),e.push(u.i/t),bc(r),r=u.next,a=u.next;continue}if(r=u,r===a){s?s===1?(r=lF(So(r),e,t),xc(r,e,t,n,i,o,2)):s===2&&uF(r,e,t,n,i,o):xc(So(r),e,t,n,i,o,1);break}}}function sF(r){let e=r.prev,t=r,n=r.next;if(Pt(e,t,n)>=0)return!1;let i=r.next.next;for(;i!==r.prev;){if(fl(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&Pt(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function aF(r,e,t,n){let i=r.prev,o=r,s=r.next;if(Pt(i,o,s)>=0)return!1;let a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,l=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,u=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,c=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,f=a1(a,l,e,t,n),h=a1(u,c,e,t,n),p=r.prevZ,d=r.nextZ;for(;p&&p.z>=f&&d&&d.z<=h;){if(p!==r.prev&&p!==r.next&&fl(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Pt(p.prev,p,p.next)>=0||(p=p.prevZ,d!==r.prev&&d!==r.next&&fl(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&Pt(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;p&&p.z>=f;){if(p!==r.prev&&p!==r.next&&fl(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Pt(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=h;){if(d!==r.prev&&d!==r.next&&fl(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&Pt(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function lF(r,e,t){let n=r;do{let i=n.prev,o=n.next.next;!wp(i,o)&&gS(i,n,n.next,o)&&wc(i,o)&&wc(o,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(o.i/t),bc(n),bc(n.next),n=r=o),n=n.next}while(n!==r);return So(n)}function uF(r,e,t,n,i,o){let s=r;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&vF(s,a)){let l=yS(s,a);s=So(s,s.next),l=So(l,l.next),xc(s,e,t,n,i,o),xc(l,e,t,n,i,o);return}a=a.next}s=s.next}while(s!==r)}function cF(r,e,t,n){let i=[],o,s,a,l,u;for(o=0,s=e.length;o<s;o++)a=e[o]*n,l=o<s-1?e[o+1]*n:r.length,u=mS(r,a,l,n,!1),u===u.next&&(u.steiner=!0),i.push(yF(u));for(i.sort(hF),o=0;o<i.length;o++)fF(i[o],t),t=So(t,t.next);return t}function hF(r,e){return r.x-e.x}function fF(r,e){if(e=pF(r,e),e){let t=yS(e,r);So(e,e.next),So(t,t.next)}}function pF(r,e){let t=e,n=r.x,i=r.y,o=-1/0,s;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){let h=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=n&&h>o){if(o=h,h===n){if(i===t.y)return t;if(i===t.next.y)return t.next}s=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!s)return null;if(n===o)return s;let a=s,l=s.x,u=s.y,c=1/0,f;t=s;do n>=t.x&&t.x>=l&&n!==t.x&&fl(i<u?n:o,i,l,u,i<u?o:n,i,t.x,t.y)&&(f=Math.abs(i-t.y)/(n-t.x),wc(t,r)&&(f<c||f===c&&(t.x>s.x||t.x===s.x&&dF(s,t)))&&(s=t,c=f)),t=t.next;while(t!==a);return s}function dF(r,e){return Pt(r.prev,r,e.prev)<0&&Pt(e.next,r,r.next)<0}function mF(r,e,t,n){let i=r;do i.z===null&&(i.z=a1(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,gF(i)}function gF(r){let e,t,n,i,o,s,a,l,u=1;do{for(t=r,r=null,o=null,s=0;t;){for(s++,n=t,a=0,e=0;e<u&&(a++,n=n.nextZ,!!n);e++);for(l=u;a>0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;t=n}o.nextZ=null,u*=2}while(s>1);return r}function a1(r,e,t,n,i){return r=32767*(r-t)*i,e=32767*(e-n)*i,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function yF(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function fl(r,e,t,n,i,o,s,a){return(i-s)*(e-a)-(r-s)*(o-a)>=0&&(r-s)*(n-a)-(t-s)*(e-a)>=0&&(t-s)*(o-a)-(i-s)*(n-a)>=0}function vF(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!xF(r,e)&&(wc(r,e)&&wc(e,r)&&wF(r,e)&&(Pt(r.prev,r,e.prev)||Pt(r,e.prev,e))||wp(r,e)&&Pt(r.prev,r,r.next)>0&&Pt(e.prev,e,e.next)>0)}function Pt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function wp(r,e){return r.x===e.x&&r.y===e.y}function gS(r,e,t,n){let i=Sp(Pt(r,e,t)),o=Sp(Pt(r,e,n)),s=Sp(Pt(t,n,r)),a=Sp(Pt(t,n,e));return!!(i!==o&&s!==a||i===0&&bp(r,t,e)||o===0&&bp(r,n,e)||s===0&&bp(t,r,n)||a===0&&bp(t,e,n))}function bp(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Sp(r){return r>0?1:r<0?-1:0}function xF(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&gS(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function wc(r,e){return Pt(r.prev,r,r.next)<0?Pt(r,e,r.next)>=0&&Pt(r,r.prev,e)>=0:Pt(r,e,r.prev)<0||Pt(r,r.next,e)<0}function wF(r,e){let t=r,n=!1,i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function yS(r,e){let t=new l1(r.i,r.x,r.y),n=new l1(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function vS(r,e,t,n){let i=new l1(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function bc(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function l1(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function bF(r,e,t,n){let i=0;for(let o=e,s=t-n;o<t;o+=n)i+=(r[s]-r[o])*(r[o+1]+r[s+1]),s=o;return i}function xS(r){let e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function wS(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}function LF(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){let o=r[n];t.shapes.push(o.uuid)}else t.shapes.push(r.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}function AF(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){let i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}function bS(r,e,t){let n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n,i),!0)}function EF(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return wl;case"vector":case"vector2":case"vector3":case"vector4":return bl;case"color":return Pp;case"quaternion":return Ls;case"bool":case"boolean":return Lo;case"string":return Ao}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function MF(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=EF(r.type);if(r.times===void 0){let t=[],n=[];Ct.flattenJSON(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}function zS(){return(typeof performance=="undefined"?Date:performance).now()}function HS(r,e){return r.distance-e.distance}function k1(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){let i=r.children;for(let o=0,s=i.length;o<s;o++)k1(i[o],e,t,!0)}}function KS(r){let e=[];r&&r.isBone&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,KS(r.children[t]));return e}function Vt(r,e,t,n,i,o,s){Xp.set(i,o,s).unproject(n);let a=e[r];if(a!==void 0){let l=t.getAttribute("position");for(let u=0,c=a.length;u<c;u++)l.setXYZ(a[u],Xp.x,Xp.y,Xp.z)}}function jF(r){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),r}function QF(r=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),r.isMultiMaterial=!0,r.materials=r,r.clone=function(){return r.slice()},r}function YF(r,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ol(r,e)}function XF(r){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new lc(r)}function KF(r,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ol(r,e)}function ZF(r){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new wo(r)}function JF(r){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new wo(r)}function $F(r){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new wo(r)}function e_(r,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new M(r,e,t)}function t_(r,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new qe(r,e).setUsage(Fa)}function n_(r,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Dg(r,e)}function i_(r,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Eg(r,e)}function r_(r,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Mg(r,e)}function o_(r,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Rg(r,e)}function s_(r,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Qu(r,e)}function a_(r,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Tg(r,e)}function l_(r,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Yu(r,e)}function u_(r,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Te(r,e)}function c_(r,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new _g(r,e)}function h_(r){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new G1(r)}function f_(r,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new N1(r,e)}function p_(r,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Bn(new mp(r.geometry),new Jt({color:e!==void 0?e:16777215}))}function d_(r,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Bn(new Lp(r.geometry),new Jt({color:e!==void 0?e:16777215}))}function m_(r){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new ki(r)}function g_(r){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new p1(r)}function y_(r,e,t){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Zu(r,t)}function v_(){console.error("THREE.CanvasRenderer has been removed")}function x_(){console.error("THREE.JSONLoader has been removed.")}function b_(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}function S_(){return console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),new Pe}function L_(){return console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),new Pe}function A_(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function D_(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function E_(){console.error("THREE.ImmediateRenderObject has been removed.")}var xf,RM,TM,Sw,k0,Lw,FM,_M,B0,Aw,Da,ji,At,jn,z0,CM,dr,Ea,I0,U0,N0,Dw,es,Ew,Mw,O0,G0,Rw,Tw,Fw,_w,W0,V0,Cw,Pw,kw,Bw,zw,Iw,Uw,Nw,wf,Ow,Gw,Ww,Vw,Fu,Hw,qw,io,jw,Qw,Yw,Xw,Kw,bf,ts,ns,_u,Cu,Ma,Pu,ku,mn,Bu,jt,Sf,PM,Lf,kM,Kt,H0,BM,is,zM,mr,Zw,Jw,Ra,$w,zu,Qi,rs,eb,tb,nb,os,ib,ro,gn,rb,ob,sb,oo,ss,ab,lb,ub,cb,hb,fb,q0,j0,Q0,Y0,X0,K0,Z0,J0,pb,$0,eg,db,mb,gb,yb,vb,xb,wb,bb,Sb,Lb,Ab,Db,Eb,Mb,Rb,Tb,Fb,_b,Cb,Pb,kb,Bb,zb,Ib,Ub,Nb,Ob,Gb,Wb,Vb,Hb,qb,Iu,Uu,Af,as,ls,Nu,Df,tg,jb,IM,UM,Pn,Ou,Ef,Mf,ng,ig,rg,Qb,Yb,us,Xb,NM,Rf,OM,GM,WM,VM,HM,qM,jM,QM,YM,XM,KM,ZM,JM,Kb,Ta,Fa,$M,eR,tR,nR,iR,rR,oR,sR,og,gr,yn,Tf,cs,Gu,wR,ee,Qt,bR,Ca,so,SR,Yt,xt,Qn,ug,Vu,ot,M,cg,t3,Yn,yr,Hu,hg,Pa,ka,Ba,ao,lo,hs,qu,_f,Cf,fs,LR,n3,pg,dg,vr,xr,mg,Pf,uo,gg,kf,yg,wr,Ae,za,Ei,AR,DR,co,Bf,si,i3,r3,xn,zf,ER,o3,Ia,br,If,ju,MR,RR,s3,a3,l3,TR,u3,je,Mi,Sr,vg,Lr,Ua,Na,c3,xg,wg,bg,It,FR,Zt,h3,Ri,Uf,xe,vt,Tt,Nf,qe,Dg,Eg,Mg,Rg,Qu,Tg,Yu,Fg,Te,_g,_R,mi,Cg,Oa,ai,Xu,on,Pe,f3,Ga,Pg,ho,fo,po,kg,Bg,zg,Of,Gf,Wf,Vf,Hf,qf,Ig,jf,Lt,Ti,p3,PR,kR,Yi,Va,Gt,Ha,qa,Ku,ps,Zu,Ug,BR,zR,Fi,ja,Yf,Qa,ds,UR,NR,OR,GR,WR,VR,HR,qR,jR,QR,YR,XR,KR,ZR,JR,$R,eT,tT,nT,iT,rT,oT,sT,aT,lT,uT,cT,hT,fT,pT,dT,mT,gT,yT,vT,xT,wT,bT,ST,LT,AT,DT,ET,MT,RT,TT,FT,_T,CT,PT,kT,BT,zT,IT,UT,NT,OT,GT,WT,VT,HT,qT,jT,QT,YT,XT,KT,ZT,JT,$T,e8,t8,n8,i8,r8,o8,s8,a8,l8,u8,c8,h8,f8,p8,d8,m8,g8,y8,v8,x8,w8,b8,S8,L8,A8,D8,E8,M8,R8,T8,F8,_8,C8,P8,k8,B8,z8,I8,U8,N8,O8,G8,W8,V8,H8,q8,j8,Q8,Y8,X8,K8,Z8,J8,$8,e5,t5,n5,i5,r5,o5,s5,a5,l5,u5,$e,we,_i,Ya,ms,Xa,mo,Xi,m3,g3,Ka,gs,Ng,Ju,y3,Xf,v3,Og,ys,Za,x3,Gg,$u,Zf,A3,D3,E3,M3,R3,T3,F3,_3,C3,Hg,g4,L4,D4,E4,N4,tc,nc,V4,H4,$f,gi,Q4,ep,ic,X3,jg,$a,el,xs,yo,Wt,Ar,rc,tl,oc,nl,il,rl,sc,K3,tp,ac,np,Z3,Qg,J3,lc,rp,$3,Yg,eS,tS,nS,K4,iS,uc,cc,vo,rS,Z4,hc,xo,oS,sS,op,fc,sp,Jt,aS,lS,uS,Xg,ap,Ki,cS,hS,Bn,lp,wo,fS,Kg,up,cp,ol,Zg,hp,Jg,sl,bo,al,Zi,ll,fp,pp,$g,dp,mp,Xn,ul,gp,yp,t1,n1,i1,vp,mc,xp,cl,r1,gc,yc,vc,o1,s1,hl,Ci,oF,Pi,Ji,SF,pl,dl,ws,ml,bs,Ss,gl,yl,vl,xl,Lp,SS,Ap,Sc,Dp,Ep,Mp,Rp,Tp,Fp,_p,DF,Ct,$i,u1,Cp,c1,yi,Lo,Pp,wl,h1,Ls,Ao,bl,Sl,As,kp,LS,Mn,Dr,ki,AS,DS,Ll,f1,p1,Lc,vi,Bp,ES,MS,RS,zp,d1,Ip,TS,Ac,m1,g1,Up,y1,Np,Op,Gp,Wp,Al,v1,Dc,Vp,x1,FS,RF,_S,CS,w1,Hp,b1,S1,L1,A1,PS,kS,Ds,BS,D1,Es,IS,TF,Ms,US,qp,Rs,NS,FF,Ts,OS,E1,M1,R1,_F,T1,CF,PF,kF,BF,zF,IF,UF,GS,ut,F1,WS,_1,Ec,C1,P1,VS,Mc,qS,jS,Fs,QS,jp,B1,YS,XS,Do,Qp,z1,I1,ZS,NF,JS,$S,eL,U1,tL,nL,Yp,iL,rL,Xp,Ut,oL,Kp,N1,sL,aL,lL,Zp,O1,uL,G1,cL,hL,OF,fL,GF,WF,VF,HF,qF,w_,li=oe(()=>{xf="135",RM={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},TM={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Sw=0,k0=1,Lw=2,FM=3,_M=0,B0=1,Aw=2,Da=3,ji=0,At=1,jn=2,z0=1,CM=2,dr=0,Ea=1,I0=2,U0=3,N0=4,Dw=5,es=100,Ew=101,Mw=102,O0=103,G0=104,Rw=200,Tw=201,Fw=202,_w=203,W0=204,V0=205,Cw=206,Pw=207,kw=208,Bw=209,zw=210,Iw=0,Uw=1,Nw=2,wf=3,Ow=4,Gw=5,Ww=6,Vw=7,Fu=0,Hw=1,qw=2,io=0,jw=1,Qw=2,Yw=3,Xw=4,Kw=5,bf=300,ts=301,ns=302,_u=303,Cu=304,Ma=306,Pu=307,ku=1e3,mn=1001,Bu=1002,jt=1003,Sf=1004,PM=1004,Lf=1005,kM=1005,Kt=1006,H0=1007,BM=1007,is=1008,zM=1008,mr=1009,Zw=1010,Jw=1011,Ra=1012,$w=1013,zu=1014,Qi=1015,rs=1016,eb=1017,tb=1018,nb=1019,os=1020,ib=1021,ro=1022,gn=1023,rb=1024,ob=1025,sb=gn,oo=1026,ss=1027,ab=1028,lb=1029,ub=1030,cb=1031,hb=1032,fb=1033,q0=33776,j0=33777,Q0=33778,Y0=33779,X0=35840,K0=35841,Z0=35842,J0=35843,pb=36196,$0=37492,eg=37496,db=37808,mb=37809,gb=37810,yb=37811,vb=37812,xb=37813,wb=37814,bb=37815,Sb=37816,Lb=37817,Ab=37818,Db=37819,Eb=37820,Mb=37821,Rb=36492,Tb=37840,Fb=37841,_b=37842,Cb=37843,Pb=37844,kb=37845,Bb=37846,zb=37847,Ib=37848,Ub=37849,Nb=37850,Ob=37851,Gb=37852,Wb=37853,Vb=2200,Hb=2201,qb=2202,Iu=2300,Uu=2301,Af=2302,as=2400,ls=2401,Nu=2402,Df=2500,tg=2501,jb=0,IM=1,UM=2,Pn=3e3,Ou=3001,Ef=3007,Mf=3002,ng=3004,ig=3005,rg=3006,Qb=3200,Yb=3201,us=0,Xb=1,NM=0,Rf=7680,OM=7681,GM=7682,WM=7683,VM=34055,HM=34056,qM=5386,jM=512,QM=513,YM=514,XM=515,KM=516,ZM=517,JM=518,Kb=519,Ta=35044,Fa=35048,$M=35040,eR=35045,tR=35049,nR=35041,iR=35046,rR=35050,oR=35042,sR="100",og="300 es",gr=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let i=this._listeners[e];if(i!==void 0){let o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let n=this._listeners[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let o=0,s=i.length;o<s;o++)i[o].call(this,e);e.target=null}}},yn=[];for(let r=0;r<256;r++)yn[r]=(r<16?"0":"")+r.toString(16);Tf=1234567,cs=Math.PI/180,Gu=180/Math.PI;wR=Object.freeze({__proto__:null,DEG2RAD:cs,RAD2DEG:Gu,generateUUID:oi,clamp:vn,euclideanModulo:sg,mapLinear:aR,inverseLerp:lR,lerp:Wu,damp:uR,pingpong:cR,smoothstep:hR,smootherstep:fR,randInt:pR,randFloat:dR,randFloatSpread:mR,seededRandom:gR,degToRad:yR,radToDeg:vR,isPowerOfTwo:ag,ceilPowerOfTwo:Zb,floorPowerOfTwo:Jb,setQuaternionFromProperEuler:xR}),ee=class{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,s=this.y-e.y;return this.x=o*n-s*i+e.x,this.y=o*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};ee.prototype.isVector2=!0;Qt=class{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,o,s,a,l,u){let c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=o,c[5]=l,c[6]=n,c[7]=s,c[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,o=this.elements,s=n[0],a=n[3],l=n[6],u=n[1],c=n[4],f=n[7],h=n[2],p=n[5],d=n[8],g=i[0],x=i[3],y=i[6],m=i[1],b=i[4],w=i[7],D=i[2],R=i[5],L=i[8];return o[0]=s*g+a*m+l*D,o[3]=s*x+a*b+l*R,o[6]=s*y+a*w+l*L,o[1]=u*g+c*m+f*D,o[4]=u*x+c*b+f*R,o[7]=u*y+c*w+f*L,o[2]=h*g+p*m+d*D,o[5]=h*x+p*b+d*R,o[8]=h*y+p*w+d*L,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],c=e[8];return t*s*c-t*a*u-n*o*c+n*a*l+i*o*u-i*s*l}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],c=e[8],f=c*s-a*u,h=a*l-c*o,p=u*o-s*l,d=t*f+n*h+i*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=f*g,e[1]=(i*u-c*n)*g,e[2]=(a*n-i*s)*g,e[3]=h*g,e[4]=(c*t-i*l)*g,e[5]=(i*o-a*t)*g,e[6]=p*g,e[7]=(n*l-u*t)*g,e[8]=(s*t-n*o)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,s,a){let l=Math.cos(o),u=Math.sin(o);return this.set(n*l,n*u,-n*(l*s+u*a)+s+e,-i*u,i*l,-i*(-u*s+l*a)+a+t,0,0,1),this}scale(e,t){let n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),i=this.elements,o=i[0],s=i[3],a=i[6],l=i[1],u=i[4],c=i[7];return i[0]=t*o+n*l,i[3]=t*s+n*u,i[6]=t*a+n*c,i[1]=-n*o+t*l,i[4]=-n*s+t*u,i[7]=-n*a+t*c,this}translate(e,t){let n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Qt.prototype.isMatrix3=!0;bR={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};so=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ca===void 0&&(Ca=Ff("canvas")),Ca.width=e.width,Ca.height=e.height;let n=Ca.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ca}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},SR=0,Yt=class extends gr{constructor(e=Yt.DEFAULT_IMAGE,t=Yt.DEFAULT_MAPPING,n=mn,i=mn,o=Kt,s=is,a=gn,l=mr,u=1,c=Pn){super();Object.defineProperty(this,"id",{value:SR++}),this.uuid=oi(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=o,this.minFilter=s,this.anisotropy=u,this.format=a,this.internalFormat=null,this.type=l,this.offset=new ee(0,0),this.repeat=new ee(1,1),this.center=new ee(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){let i=this.image;if(i.uuid===void 0&&(i.uuid=oi()),!t&&e.images[i.uuid]===void 0){let o;if(Array.isArray(i)){o=[];for(let s=0,a=i.length;s<a;s++)i[s].isDataTexture?o.push(lg(i[s].image)):o.push(lg(i[s]))}else o=lg(i);e.images[i.uuid]={uuid:i.uuid,url:o}}n.image=i.uuid}return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==bf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ku:e.x=e.x-Math.floor(e.x);break;case mn:e.x=e.x<0?0:1;break;case Bu:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ku:e.y=e.y-Math.floor(e.y);break;case mn:e.y=e.y<0?0:1;break;case Bu:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&this.version++}};Yt.DEFAULT_IMAGE=void 0;Yt.DEFAULT_MAPPING=bf;Yt.prototype.isTexture=!0;xt=class{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,o=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*o,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*o,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*o,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*o,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o,s=.01,a=.1,l=e.elements,u=l[0],c=l[4],f=l[8],h=l[1],p=l[5],d=l[9],g=l[2],x=l[6],y=l[10];if(Math.abs(c-h)<s&&Math.abs(f-g)<s&&Math.abs(d-x)<s){if(Math.abs(c+h)<a&&Math.abs(f+g)<a&&Math.abs(d+x)<a&&Math.abs(u+p+y-3)<a)return this.set(1,0,0,0),this;t=Math.PI;let b=(u+1)/2,w=(p+1)/2,D=(y+1)/2,R=(c+h)/4,L=(f+g)/4,T=(d+x)/4;return b>w&&b>D?b<s?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(b),i=R/n,o=L/n):w>D?w<s?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=T/i):D<s?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(D),n=L/o,i=T/o),this.set(n,i,o,t),this}let m=Math.sqrt((x-d)*(x-d)+(f-g)*(f-g)+(h-c)*(h-c));return Math.abs(m)<.001&&(m=1),this.x=(x-d)/m,this.y=(f-g)/m,this.z=(h-c)/m,this.w=Math.acos((u+p+y-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};xt.prototype.isVector4=!0;Qn=class extends gr{constructor(e,t,n={}){super();this.width=e,this.height=t,this.depth=1,this.scissor=new xt(0,0,e,t),this.scissorTest=!1,this.viewport=new xt(0,0,e,t),this.texture=new Yt(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Kt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}};Qn.prototype.isWebGLRenderTarget=!0;ug=class extends Qn{constructor(e,t,n){super(e,t);let i=this.texture;this.texture=[];for(let o=0;o<n;o++)this.texture[o]=i.clone()}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,o=this.texture.length;i<o;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone();return this}};ug.prototype.isWebGLMultipleRenderTargets=!0;Vu=class extends Qn{constructor(e,t,n={}){super(e,t,n);this.samples=4,this.ignoreDepthForMultisampleCopy=n.ignoreDepth!==void 0?n.ignoreDepth:!0,this.useRenderToTexture=n.useRenderToTexture!==void 0?n.useRenderToTexture:!1,this.useRenderbuffer=this.useRenderToTexture===!1}copy(e){return super.copy.call(this,e),this.samples=e.samples,this.useRenderToTexture=e.useRenderToTexture,this.useRenderbuffer=e.useRenderbuffer,this}};Vu.prototype.isWebGLMultisampleRenderTarget=!0;ot=class{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,o,s,a){let l=n[i+0],u=n[i+1],c=n[i+2],f=n[i+3],h=o[s+0],p=o[s+1],d=o[s+2],g=o[s+3];if(a===0){e[t+0]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f;return}if(a===1){e[t+0]=h,e[t+1]=p,e[t+2]=d,e[t+3]=g;return}if(f!==g||l!==h||u!==p||c!==d){let x=1-a,y=l*h+u*p+c*d+f*g,m=y>=0?1:-1,b=1-y*y;if(b>Number.EPSILON){let D=Math.sqrt(b),R=Math.atan2(D,y*m);x=Math.sin(x*R)/D,a=Math.sin(a*R)/D}let w=a*m;if(l=l*x+h*w,u=u*x+p*w,c=c*x+d*w,f=f*x+g*w,x===1-a){let D=1/Math.sqrt(l*l+u*u+c*c+f*f);l*=D,u*=D,c*=D,f*=D}}e[t]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,i,o,s){let a=n[i],l=n[i+1],u=n[i+2],c=n[i+3],f=o[s],h=o[s+1],p=o[s+2],d=o[s+3];return e[t]=a*d+c*f+l*p-u*h,e[t+1]=l*d+c*h+u*f-a*p,e[t+2]=u*d+c*p+a*h-l*f,e[t+3]=c*d-a*f-l*h-u*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let n=e._x,i=e._y,o=e._z,s=e._order,a=Math.cos,l=Math.sin,u=a(n/2),c=a(i/2),f=a(o/2),h=l(n/2),p=l(i/2),d=l(o/2);switch(s){case"XYZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"YXZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"ZXY":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"ZYX":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"YZX":this._x=h*c*f+u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f-h*p*d;break;case"XZY":this._x=h*c*f-u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f+h*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],o=t[8],s=t[1],a=t[5],l=t[9],u=t[2],c=t[6],f=t[10],h=n+a+f;if(h>0){let p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(c-l)*p,this._y=(o-u)*p,this._z=(s-i)*p}else if(n>a&&n>f){let p=2*Math.sqrt(1+n-a-f);this._w=(c-l)/p,this._x=.25*p,this._y=(i+s)/p,this._z=(o+u)/p}else if(a>f){let p=2*Math.sqrt(1+a-n-f);this._w=(o-u)/p,this._x=(i+s)/p,this._y=.25*p,this._z=(l+c)/p}else{let p=2*Math.sqrt(1+f-n-a);this._w=(s-i)/p,this._x=(o+u)/p,this._y=(l+c)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(vn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,o=e._z,s=e._w,a=t._x,l=t._y,u=t._z,c=t._w;return this._x=n*c+s*a+i*u-o*l,this._y=i*c+s*l+o*a-n*u,this._z=o*c+s*u+n*l-i*a,this._w=s*c-n*a-i*l-o*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,i=this._y,o=this._z,s=this._w,a=s*e._w+n*e._x+i*e._y+o*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=s,this._x=n,this._y=i,this._z=o,this;let l=1-a*a;if(l<=Number.EPSILON){let p=1-t;return this._w=p*s+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*o+t*this._z,this.normalize(),this._onChangeCallback(),this}let u=Math.sqrt(l),c=Math.atan2(u,a),f=Math.sin((1-t)*c)/u,h=Math.sin(t*c)/u;return this._w=s*f+this._w*h,this._x=n*f+this._x*h,this._y=i*f+this._y*h,this._z=o*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}random(){let e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),o=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(o),n*Math.cos(o),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};ot.prototype.isQuaternion=!0;M=class{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t3.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(t3.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,o=e.elements,s=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*s,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*s,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*s,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,o=e.x,s=e.y,a=e.z,l=e.w,u=l*t+s*i-a*n,c=l*n+a*t-o*i,f=l*i+o*n-s*t,h=-o*t-s*n-a*i;return this.x=u*l+h*-o+c*-a-f*-s,this.y=c*l+h*-s+f*-o-u*-a,this.z=f*l+h*-a+u*-s-c*-o,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,o=e.z,s=t.x,a=t.y,l=t.z;return this.x=i*l-o*a,this.y=o*s-n*l,this.z=n*a-i*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return cg.copy(this).projectOnVector(e),this.sub(cg)}reflect(e){return this.sub(cg.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(vn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};M.prototype.isVector3=!0;cg=new M,t3=new ot,Yn=class{constructor(e=new M(1/0,1/0,1/0),t=new M(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0;for(let l=0,u=e.length;l<u;l+=3){let c=e[l],f=e[l+1],h=e[l+2];c<t&&(t=c),f<n&&(n=f),h<i&&(i=h),c>o&&(o=c),f>s&&(s=f),h>a&&(a=h)}return this.min.set(t,n,i),this.max.set(o,s,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0;for(let l=0,u=e.count;l<u;l++){let c=e.getX(l),f=e.getY(l),h=e.getZ(l);c<t&&(t=c),f<n&&(n=f),h<i&&(i=h),c>o&&(o=c),f>s&&(s=f),h>a&&(a=h)}return this.min.set(t,n,i),this.max.set(o,s,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Hu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);let t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),hg.copy(t.boundingBox),hg.applyMatrix4(e.matrixWorld),this.union(hg));let n=e.children;for(let i=0,o=n.length;i<o;i++)this.expandByObject(n[i]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Hu),Hu.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(qu),_f.subVectors(this.max,qu),Pa.subVectors(e.a,qu),ka.subVectors(e.b,qu),Ba.subVectors(e.c,qu),ao.subVectors(ka,Pa),lo.subVectors(Ba,ka),hs.subVectors(Pa,Ba);let t=[0,-ao.z,ao.y,0,-lo.z,lo.y,0,-hs.z,hs.y,ao.z,0,-ao.x,lo.z,0,-lo.x,hs.z,0,-hs.x,-ao.y,ao.x,0,-lo.y,lo.x,0,-hs.y,hs.x,0];return!fg(t,Pa,ka,Ba,_f)||(t=[1,0,0,0,1,0,0,0,1],!fg(t,Pa,ka,Ba,_f))?!1:(Cf.crossVectors(ao,lo),t=[Cf.x,Cf.y,Cf.z],fg(t,Pa,ka,Ba,_f))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Hu.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Hu).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(yr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),yr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),yr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),yr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),yr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),yr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),yr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),yr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(yr),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};Yn.prototype.isBox3=!0;yr=[new M,new M,new M,new M,new M,new M,new M,new M],Hu=new M,hg=new Yn,Pa=new M,ka=new M,Ba=new M,ao=new M,lo=new M,hs=new M,qu=new M,_f=new M,Cf=new M,fs=new M;LR=new Yn,n3=new M,pg=new M,dg=new M,vr=class{constructor(e=new M,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):LR.setFromPoints(e).getCenter(n);let i=0;for(let o=0,s=e.length;o<s;o++)i=Math.max(i,n.distanceToSquared(e[o]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){dg.subVectors(e,this.center);let t=dg.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.add(dg.multiplyScalar(i/n)),this.radius+=i}return this}union(e){return pg.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(n3.copy(e.center).add(pg)),this.expandByPoint(n3.copy(e.center).sub(pg)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},xr=new M,mg=new M,Pf=new M,uo=new M,gg=new M,kf=new M,yg=new M,wr=class{constructor(e=new M,t=new M(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,xr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=xr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(xr.copy(this.direction).multiplyScalar(t).add(this.origin),xr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){mg.copy(e).add(t).multiplyScalar(.5),Pf.copy(t).sub(e).normalize(),uo.copy(this.origin).sub(mg);let o=e.distanceTo(t)*.5,s=-this.direction.dot(Pf),a=uo.dot(this.direction),l=-uo.dot(Pf),u=uo.lengthSq(),c=Math.abs(1-s*s),f,h,p,d;if(c>0)if(f=s*l-a,h=s*a-l,d=o*c,f>=0)if(h>=-d)if(h<=d){let g=1/c;f*=g,h*=g,p=f*(f+s*h+2*a)+h*(s*f+h+2*l)+u}else h=o,f=Math.max(0,-(s*h+a)),p=-f*f+h*(h+2*l)+u;else h=-o,f=Math.max(0,-(s*h+a)),p=-f*f+h*(h+2*l)+u;else h<=-d?(f=Math.max(0,-(-s*o+a)),h=f>0?-o:Math.min(Math.max(-o,-l),o),p=-f*f+h*(h+2*l)+u):h<=d?(f=0,h=Math.min(Math.max(-o,-l),o),p=h*(h+2*l)+u):(f=Math.max(0,-(s*o+a)),h=f>0?o:Math.min(Math.max(-o,-l),o),p=-f*f+h*(h+2*l)+u);else h=s>0?-o:o,f=Math.max(0,-(s*h+a)),p=-f*f+h*(h+2*l)+u;return n&&n.copy(this.direction).multiplyScalar(f).add(this.origin),i&&i.copy(Pf).multiplyScalar(h).add(mg),p}intersectSphere(e,t){xr.subVectors(e.center,this.origin);let n=xr.dot(this.direction),i=xr.dot(xr)-n*n,o=e.radius*e.radius;if(i>o)return null;let s=Math.sqrt(o-i),a=n-s,l=n+s;return a<0&&l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,s,a,l,u=1/this.direction.x,c=1/this.direction.y,f=1/this.direction.z,h=this.origin;return u>=0?(n=(e.min.x-h.x)*u,i=(e.max.x-h.x)*u):(n=(e.max.x-h.x)*u,i=(e.min.x-h.x)*u),c>=0?(o=(e.min.y-h.y)*c,s=(e.max.y-h.y)*c):(o=(e.max.y-h.y)*c,s=(e.min.y-h.y)*c),n>s||o>i||((o>n||n!==n)&&(n=o),(s<i||i!==i)&&(i=s),f>=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,xr)!==null}intersectTriangle(e,t,n,i,o){gg.subVectors(t,e),kf.subVectors(n,e),yg.crossVectors(gg,kf);let s=this.direction.dot(yg),a;if(s>0){if(i)return null;a=1}else if(s<0)a=-1,s=-s;else return null;uo.subVectors(this.origin,e);let l=a*this.direction.dot(kf.crossVectors(uo,kf));if(l<0)return null;let u=a*this.direction.dot(gg.cross(uo));if(u<0||l+u>s)return null;let c=-a*uo.dot(yg);return c<0?null:this.at(c/s,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ae=class{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,o,s,a,l,u,c,f,h,p,d,g,x){let y=this.elements;return y[0]=e,y[4]=t,y[8]=n,y[12]=i,y[1]=o,y[5]=s,y[9]=a,y[13]=l,y[2]=u,y[6]=c,y[10]=f,y[14]=h,y[3]=p,y[7]=d,y[11]=g,y[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ae().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,i=1/za.setFromMatrixColumn(e,0).length(),o=1/za.setFromMatrixColumn(e,1).length(),s=1/za.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");let t=this.elements,n=e.x,i=e.y,o=e.z,s=Math.cos(n),a=Math.sin(n),l=Math.cos(i),u=Math.sin(i),c=Math.cos(o),f=Math.sin(o);if(e.order==="XYZ"){let h=s*c,p=s*f,d=a*c,g=a*f;t[0]=l*c,t[4]=-l*f,t[8]=u,t[1]=p+d*u,t[5]=h-g*u,t[9]=-a*l,t[2]=g-h*u,t[6]=d+p*u,t[10]=s*l}else if(e.order==="YXZ"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h+g*a,t[4]=d*a-p,t[8]=s*u,t[1]=s*f,t[5]=s*c,t[9]=-a,t[2]=p*a-d,t[6]=g+h*a,t[10]=s*l}else if(e.order==="ZXY"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h-g*a,t[4]=-s*f,t[8]=d+p*a,t[1]=p+d*a,t[5]=s*c,t[9]=g-h*a,t[2]=-s*u,t[6]=a,t[10]=s*l}else if(e.order==="ZYX"){let h=s*c,p=s*f,d=a*c,g=a*f;t[0]=l*c,t[4]=d*u-p,t[8]=h*u+g,t[1]=l*f,t[5]=g*u+h,t[9]=p*u-d,t[2]=-u,t[6]=a*l,t[10]=s*l}else if(e.order==="YZX"){let h=s*l,p=s*u,d=a*l,g=a*u;t[0]=l*c,t[4]=g-h*f,t[8]=d*f+p,t[1]=f,t[5]=s*c,t[9]=-a*c,t[2]=-u*c,t[6]=p*f+d,t[10]=h-g*f}else if(e.order==="XZY"){let h=s*l,p=s*u,d=a*l,g=a*u;t[0]=l*c,t[4]=-f,t[8]=u*c,t[1]=h*f+g,t[5]=s*c,t[9]=p*f-d,t[2]=d*f-p,t[6]=a*c,t[10]=g*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(AR,e,DR)}lookAt(e,t,n){let i=this.elements;return si.subVectors(e,t),si.lengthSq()===0&&(si.z=1),si.normalize(),co.crossVectors(n,si),co.lengthSq()===0&&(Math.abs(n.z)===1?si.x+=1e-4:si.z+=1e-4,si.normalize(),co.crossVectors(n,si)),co.normalize(),Bf.crossVectors(si,co),i[0]=co.x,i[4]=Bf.x,i[8]=si.x,i[1]=co.y,i[5]=Bf.y,i[9]=si.y,i[2]=co.z,i[6]=Bf.z,i[10]=si.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,o=this.elements,s=n[0],a=n[4],l=n[8],u=n[12],c=n[1],f=n[5],h=n[9],p=n[13],d=n[2],g=n[6],x=n[10],y=n[14],m=n[3],b=n[7],w=n[11],D=n[15],R=i[0],L=i[4],T=i[8],U=i[12],F=i[1],C=i[5],j=i[9],B=i[13],z=i[2],O=i[6],V=i[10],q=i[14],se=i[3],he=i[7],Y=i[11],X=i[15];return o[0]=s*R+a*F+l*z+u*se,o[4]=s*L+a*C+l*O+u*he,o[8]=s*T+a*j+l*V+u*Y,o[12]=s*U+a*B+l*q+u*X,o[1]=c*R+f*F+h*z+p*se,o[5]=c*L+f*C+h*O+p*he,o[9]=c*T+f*j+h*V+p*Y,o[13]=c*U+f*B+h*q+p*X,o[2]=d*R+g*F+x*z+y*se,o[6]=d*L+g*C+x*O+y*he,o[10]=d*T+g*j+x*V+y*Y,o[14]=d*U+g*B+x*q+y*X,o[3]=m*R+b*F+w*z+D*se,o[7]=m*L+b*C+w*O+D*he,o[11]=m*T+b*j+w*V+D*Y,o[15]=m*U+b*B+w*q+D*X,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],o=e[12],s=e[1],a=e[5],l=e[9],u=e[13],c=e[2],f=e[6],h=e[10],p=e[14],d=e[3],g=e[7],x=e[11],y=e[15];return d*(+o*l*f-i*u*f-o*a*h+n*u*h+i*a*p-n*l*p)+g*(+t*l*p-t*u*h+o*s*h-i*s*p+i*u*c-o*l*c)+x*(+t*u*f-t*a*p-o*s*f+n*s*p+o*a*c-n*u*c)+y*(-i*a*c-t*l*f+t*a*h+i*s*f-n*s*h+n*l*c)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],g=e[13],x=e[14],y=e[15],m=f*x*u-g*h*u+g*l*p-a*x*p-f*l*y+a*h*y,b=d*h*u-c*x*u-d*l*p+s*x*p+c*l*y-s*h*y,w=c*g*u-d*f*u+d*a*p-s*g*p-c*a*y+s*f*y,D=d*f*l-c*g*l-d*a*h+s*g*h+c*a*x-s*f*x,R=t*m+n*b+i*w+o*D;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let L=1/R;return e[0]=m*L,e[1]=(g*h*o-f*x*o-g*i*p+n*x*p+f*i*y-n*h*y)*L,e[2]=(a*x*o-g*l*o+g*i*u-n*x*u-a*i*y+n*l*y)*L,e[3]=(f*l*o-a*h*o-f*i*u+n*h*u+a*i*p-n*l*p)*L,e[4]=b*L,e[5]=(c*x*o-d*h*o+d*i*p-t*x*p-c*i*y+t*h*y)*L,e[6]=(d*l*o-s*x*o-d*i*u+t*x*u+s*i*y-t*l*y)*L,e[7]=(s*h*o-c*l*o+c*i*u-t*h*u-s*i*p+t*l*p)*L,e[8]=w*L,e[9]=(d*f*o-c*g*o-d*n*p+t*g*p+c*n*y-t*f*y)*L,e[10]=(s*g*o-d*a*o+d*n*u-t*g*u-s*n*y+t*a*y)*L,e[11]=(c*a*o-s*f*o-c*n*u+t*f*u+s*n*p-t*a*p)*L,e[12]=D*L,e[13]=(c*g*i-d*f*i+d*n*h-t*g*h-c*n*x+t*f*x)*L,e[14]=(d*a*i-s*g*i-d*n*l+t*g*l+s*n*x-t*a*x)*L,e[15]=(s*f*i-c*a*i+c*n*l-t*f*l-s*n*h+t*a*h)*L,this}scale(e){let t=this.elements,n=e.x,i=e.y,o=e.z;return t[0]*=n,t[4]*=i,t[8]*=o,t[1]*=n,t[5]*=i,t[9]*=o,t[2]*=n,t[6]*=i,t[10]*=o,t[3]*=n,t[7]*=i,t[11]*=o,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),o=1-n,s=e.x,a=e.y,l=e.z,u=o*s,c=o*a;return this.set(u*s+n,u*a-i*l,u*l+i*a,0,u*a+i*l,c*a+n,c*l-i*s,0,u*l-i*a,c*l+i*s,o*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,o,s){return this.set(1,n,o,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,o=t._x,s=t._y,a=t._z,l=t._w,u=o+o,c=s+s,f=a+a,h=o*u,p=o*c,d=o*f,g=s*c,x=s*f,y=a*f,m=l*u,b=l*c,w=l*f,D=n.x,R=n.y,L=n.z;return i[0]=(1-(g+y))*D,i[1]=(p+w)*D,i[2]=(d-b)*D,i[3]=0,i[4]=(p-w)*R,i[5]=(1-(h+y))*R,i[6]=(x+m)*R,i[7]=0,i[8]=(d+b)*L,i[9]=(x-m)*L,i[10]=(1-(h+g))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements,o=za.set(i[0],i[1],i[2]).length(),s=za.set(i[4],i[5],i[6]).length(),a=za.set(i[8],i[9],i[10]).length();this.determinant()<0&&(o=-o),e.x=i[12],e.y=i[13],e.z=i[14],Ei.copy(this);let u=1/o,c=1/s,f=1/a;return Ei.elements[0]*=u,Ei.elements[1]*=u,Ei.elements[2]*=u,Ei.elements[4]*=c,Ei.elements[5]*=c,Ei.elements[6]*=c,Ei.elements[8]*=f,Ei.elements[9]*=f,Ei.elements[10]*=f,t.setFromRotationMatrix(Ei),n.x=o,n.y=s,n.z=a,this}makePerspective(e,t,n,i,o,s){s===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let a=this.elements,l=2*o/(t-e),u=2*o/(n-i),c=(t+e)/(t-e),f=(n+i)/(n-i),h=-(s+o)/(s-o),p=-2*s*o/(s-o);return a[0]=l,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=u,a[9]=f,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,o,s){let a=this.elements,l=1/(t-e),u=1/(n-i),c=1/(s-o),f=(t+e)*l,h=(n+i)*u,p=(s+o)*c;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-f,a[1]=0,a[5]=2*u,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};Ae.prototype.isMatrix4=!0;za=new M,Ei=new Ae,AR=new M(0,0,0),DR=new M(1,1,1),co=new M,Bf=new M,si=new M,i3=new Ae,r3=new ot,xn=class{constructor(e=0,t=0,n=0,i=xn.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,o=i[0],s=i[4],a=i[8],l=i[1],u=i[5],c=i[9],f=i[2],h=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(vn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(h,u),this._z=0);break;case"YXZ":this._x=Math.asin(-vn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-f,o),this._z=0);break;case"ZXY":this._x=Math.asin(vn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-s,u)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-vn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-s,u));break;case"YZX":this._z=Math.asin(vn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-f,o)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-vn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(h,u),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-c,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return i3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(i3,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return r3.setFromEuler(this),this.setFromQuaternion(r3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new M(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};xn.prototype.isEuler=!0;xn.DefaultOrder="XYZ";xn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];zf=class{constructor(){this.mask=1|0}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=4294967295|0}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&(1<<e|0))!=0}},ER=0,o3=new M,Ia=new ot,br=new Ae,If=new M,ju=new M,MR=new M,RR=new ot,s3=new M(1,0,0),a3=new M(0,1,0),l3=new M(0,0,1),TR={type:"added"},u3={type:"removed"},je=class extends gr{constructor(){super();Object.defineProperty(this,"id",{value:ER++}),this.uuid=oi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=je.DefaultUp.clone();let e=new M,t=new xn,n=new ot,i=new M(1,1,1);function o(){n.setFromEuler(t,!1)}function s(){t.setFromQuaternion(n,void 0,!1)}t._onChange(o),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ae},normalMatrix:{value:new Qt}}),this.matrix=new Ae,this.matrixWorld=new Ae,this.matrixAutoUpdate=je.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new zf,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ia.setFromAxisAngle(e,t),this.quaternion.multiply(Ia),this}rotateOnWorldAxis(e,t){return Ia.setFromAxisAngle(e,t),this.quaternion.premultiply(Ia),this}rotateX(e){return this.rotateOnAxis(s3,e)}rotateY(e){return this.rotateOnAxis(a3,e)}rotateZ(e){return this.rotateOnAxis(l3,e)}translateOnAxis(e,t){return o3.copy(e).applyQuaternion(this.quaternion),this.position.add(o3.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(s3,e)}translateY(e){return this.translateOnAxis(a3,e)}translateZ(e){return this.translateOnAxis(l3,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(br.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?If.copy(e):If.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),ju.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?br.lookAt(ju,If,this.up):br.lookAt(If,ju,this.up),this.quaternion.setFromRotationMatrix(br),i&&(br.extractRotation(i.matrixWorld),Ia.setFromRotationMatrix(br),this.quaternion.premultiply(Ia.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(TR)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(u3)),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(u3)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),br.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),br.multiply(e.parent.matrixWorld)),e.applyMatrix4(br),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let s=this.children[n].getObjectByProperty(e,t);if(s!==void 0)return s}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ju,e,MR),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ju,RR,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){let i=this.children;for(let o=0,s=i.length;o<s;o++)i[o].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function o(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let u=0,c=l.length;u<c;u++){let f=l[u];o(e.shapes,f)}else o(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,u=this.material.length;l<u;l++)a.push(o(e.materials,this.material[l]));i.material=a}else i.material=o(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];i.animations.push(o(e.animations,l))}}if(t){let a=s(e.geometries),l=s(e.materials),u=s(e.textures),c=s(e.images),f=s(e.shapes),h=s(e.skeletons),p=s(e.animations);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),u.length>0&&(n.textures=u),c.length>0&&(n.images=c),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),p.length>0&&(n.animations=p)}return n.object=i,n;function s(a){let l=[];for(let u in a){let c=a[u];delete c.metadata,l.push(c)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}};je.DefaultUp=new M(0,1,0);je.DefaultMatrixAutoUpdate=!0;je.prototype.isObject3D=!0;Mi=new M,Sr=new M,vg=new M,Lr=new M,Ua=new M,Na=new M,c3=new M,xg=new M,wg=new M,bg=new M,It=class{constructor(e=new M,t=new M,n=new M){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Mi.subVectors(e,t),i.cross(Mi);let o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Mi.subVectors(i,t),Sr.subVectors(n,t),vg.subVectors(e,t);let s=Mi.dot(Mi),a=Mi.dot(Sr),l=Mi.dot(vg),u=Sr.dot(Sr),c=Sr.dot(vg),f=s*u-a*a;if(f===0)return o.set(-2,-1,-1);let h=1/f,p=(u*l-a*c)*h,d=(s*c-a*l)*h;return o.set(1-p-d,d,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Lr),Lr.x>=0&&Lr.y>=0&&Lr.x+Lr.y<=1}static getUV(e,t,n,i,o,s,a,l){return this.getBarycoord(e,t,n,i,Lr),l.set(0,0),l.addScaledVector(o,Lr.x),l.addScaledVector(s,Lr.y),l.addScaledVector(a,Lr.z),l}static isFrontFacing(e,t,n,i){return Mi.subVectors(n,t),Sr.subVectors(e,t),Mi.cross(Sr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Mi.subVectors(this.c,this.b),Sr.subVectors(this.a,this.b),Mi.cross(Sr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return It.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return It.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,o){return It.getUV(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return It.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return It.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,o=this.c,s,a;Ua.subVectors(i,n),Na.subVectors(o,n),xg.subVectors(e,n);let l=Ua.dot(xg),u=Na.dot(xg);if(l<=0&&u<=0)return t.copy(n);wg.subVectors(e,i);let c=Ua.dot(wg),f=Na.dot(wg);if(c>=0&&f<=c)return t.copy(i);let h=l*f-c*u;if(h<=0&&l>=0&&c<=0)return s=l/(l-c),t.copy(n).addScaledVector(Ua,s);bg.subVectors(e,o);let p=Ua.dot(bg),d=Na.dot(bg);if(d>=0&&p<=d)return t.copy(o);let g=p*u-l*d;if(g<=0&&u>=0&&d<=0)return a=u/(u-d),t.copy(n).addScaledVector(Na,a);let x=c*d-p*f;if(x<=0&&f-c>=0&&p-d>=0)return c3.subVectors(o,i),a=(f-c)/(f-c+(p-d)),t.copy(i).addScaledVector(c3,a);let y=1/(x+g+h);return s=g*y,a=h*y,t.copy(n).addScaledVector(Ua,s).addScaledVector(Na,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},FR=0,Zt=class extends gr{constructor(){super();Object.defineProperty(this,"id",{value:FR++}),this.uuid=oi(),this.name="",this.type="Material",this.fog=!0,this.blending=Ea,this.side=ji,this.vertexColors=!1,this.opacity=1,this.format=gn,this.transparent=!1,this.blendSrc=W0,this.blendDst=V0,this.blendEquation=es,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=wf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Kb,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Rf,this.stencilZFail=Rf,this.stencilZPass=Rf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===z0;continue}let i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ea&&(n.blending=this.blending),this.side!==ji&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.format!==gn&&(n.format=this.format),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(o){let s=[];for(let a in o){let l=o[a];delete l.metadata,s.push(l)}return s}if(t){let o=i(e.textures),s=i(e.images);o.length>0&&(n.textures=o),s.length>0&&(n.images=s)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.format=e.format,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};Zt.prototype.isMaterial=!0;h3={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ri={h:0,s:0,l:0},Uf={h:0,s:0,l:0};xe=class{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=sg(e,1),t=vn(t,0,1),n=vn(n,0,1),t===0)this.r=this.g=this.b=n;else{let i=n<=.5?n*(1+t):n+t-n*t,o=2*n-i;this.r=Sg(o,i,e+1/3),this.g=Sg(o,i,e),this.b=Sg(o,i,e-1/3)}return this}setStyle(e){function t(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let i,o=n[1],s=n[2];switch(o){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){let a=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,u=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(a,l,u)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=n[1],o=i.length;if(o===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(o===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){let t=h3[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e,t=2){return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e,t=2){let n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=Lg(e.r),this.g=Lg(e.g),this.b=Lg(e.b),this}copyLinearToSRGB(e){return this.r=Ag(e.r),this.g=Ag(e.g),this.b=Ag(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){let t=this.r,n=this.g,i=this.b,o=Math.max(t,n,i),s=Math.min(t,n,i),a,l,u=(s+o)/2;if(s===o)a=0,l=0;else{let c=o-s;switch(l=u<=.5?c/(o+s):c/(2-o-s),o){case t:a=(n-i)/c+(n<i?6:0);break;case n:a=(i-t)/c+2;break;case i:a=(t-n)/c+4;break}a/=6}return e.h=a,e.s=l,e.l=u,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,n){return this.getHSL(Ri),Ri.h+=e,Ri.s+=t,Ri.l+=n,this.setHSL(Ri.h,Ri.s,Ri.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ri),e.getHSL(Uf);let n=Wu(Ri.h,Uf.h,t),i=Wu(Ri.s,Uf.s,t),o=Wu(Ri.l,Uf.l,t);return this.setHSL(n,i,o),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}};xe.NAMES=h3;xe.prototype.isColor=!0;xe.prototype.r=1;xe.prototype.g=1;xe.prototype.b=1;vt=class extends Zt{constructor(e){super();this.type="MeshBasicMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Fu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};vt.prototype.isMeshBasicMaterial=!0;Tt=new M,Nf=new ee,qe=class{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=Ta,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;i<o;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){let t=this.array,n=0;for(let i=0,o=e.length;i<o;i++){let s=e[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),s=new xe),t[n++]=s.r,t[n++]=s.g,t[n++]=s.b}return this}copyVector2sArray(e){let t=this.array,n=0;for(let i=0,o=e.length;i<o;i++){let s=e[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),s=new ee),t[n++]=s.x,t[n++]=s.y}return this}copyVector3sArray(e){let t=this.array,n=0;for(let i=0,o=e.length;i<o;i++){let s=e[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),s=new M),t[n++]=s.x,t[n++]=s.y,t[n++]=s.z}return this}copyVector4sArray(e){let t=this.array,n=0;for(let i=0,o=e.length;i<o;i++){let s=e[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),s=new xt),t[n++]=s.x,t[n++]=s.y,t[n++]=s.z,t[n++]=s.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Nf.fromBufferAttribute(this,t),Nf.applyMatrix3(e),this.setXY(t,Nf.x,Nf.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Tt.fromBufferAttribute(this,t),Tt.applyMatrix3(e),this.setXYZ(t,Tt.x,Tt.y,Tt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Tt.x=this.getX(t),Tt.y=this.getY(t),Tt.z=this.getZ(t),Tt.applyMatrix4(e),this.setXYZ(t,Tt.x,Tt.y,Tt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Tt.x=this.getX(t),Tt.y=this.getY(t),Tt.z=this.getZ(t),Tt.applyNormalMatrix(e),this.setXYZ(t,Tt.x,Tt.y,Tt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Tt.x=this.getX(t),Tt.y=this.getY(t),Tt.z=this.getZ(t),Tt.transformDirection(e),this.setXYZ(t,Tt.x,Tt.y,Tt.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,o){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=o,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ta&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}};qe.prototype.isBufferAttribute=!0;Dg=class extends qe{constructor(e,t,n){super(new Int8Array(e),t,n)}},Eg=class extends qe{constructor(e,t,n){super(new Uint8Array(e),t,n)}},Mg=class extends qe{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},Rg=class extends qe{constructor(e,t,n){super(new Int16Array(e),t,n)}},Qu=class extends qe{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Tg=class extends qe{constructor(e,t,n){super(new Int32Array(e),t,n)}},Yu=class extends qe{constructor(e,t,n){super(new Uint32Array(e),t,n)}},Fg=class extends qe{constructor(e,t,n){super(new Uint16Array(e),t,n)}};Fg.prototype.isFloat16BufferAttribute=!0;Te=class extends qe{constructor(e,t,n){super(new Float32Array(e),t,n)}},_g=class extends qe{constructor(e,t,n){super(new Float64Array(e),t,n)}},_R=0,mi=new Ae,Cg=new je,Oa=new M,ai=new Yn,Xu=new Yn,on=new M,Pe=class extends gr{constructor(){super();Object.defineProperty(this,"id",{value:_R++}),this.uuid=oi(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new($b(e)>65535?Yu:Qu)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let o=new Qt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return mi.makeRotationFromQuaternion(e),this.applyMatrix4(mi),this}rotateX(e){return mi.makeRotationX(e),this.applyMatrix4(mi),this}rotateY(e){return mi.makeRotationY(e),this.applyMatrix4(mi),this}rotateZ(e){return mi.makeRotationZ(e),this.applyMatrix4(mi),this}translate(e,t,n){return mi.makeTranslation(e,t,n),this.applyMatrix4(mi),this}scale(e,t,n){return mi.makeScale(e,t,n),this.applyMatrix4(mi),this}lookAt(e){return Cg.lookAt(e),Cg.updateMatrix(),this.applyMatrix4(Cg.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Oa).negate(),this.translate(Oa.x,Oa.y,Oa.z),this}setFromPoints(e){let t=[];for(let n=0,i=e.length;n<i;n++){let o=e[n];t.push(o.x,o.y,o.z||0)}return this.setAttribute("position",new Te(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Yn);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let o=t[n];ai.setFromBufferAttribute(o),this.morphTargetsRelative?(on.addVectors(this.boundingBox.min,ai.min),this.boundingBox.expandByPoint(on),on.addVectors(this.boundingBox.max,ai.max),this.boundingBox.expandByPoint(on)):(this.boundingBox.expandByPoint(ai.min),this.boundingBox.expandByPoint(ai.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vr);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new M,1/0);return}if(e){let n=this.boundingSphere.center;if(ai.setFromBufferAttribute(e),t)for(let o=0,s=t.length;o<s;o++){let a=t[o];Xu.setFromBufferAttribute(a),this.morphTargetsRelative?(on.addVectors(ai.min,Xu.min),ai.expandByPoint(on),on.addVectors(ai.max,Xu.max),ai.expandByPoint(on)):(ai.expandByPoint(Xu.min),ai.expandByPoint(Xu.max))}ai.getCenter(n);let i=0;for(let o=0,s=e.count;o<s;o++)on.fromBufferAttribute(e,o),i=Math.max(i,n.distanceToSquared(on));if(t)for(let o=0,s=t.length;o<s;o++){let a=t[o],l=this.morphTargetsRelative;for(let u=0,c=a.count;u<c;u++)on.fromBufferAttribute(a,u),l&&(Oa.fromBufferAttribute(e,u),on.add(Oa)),i=Math.max(i,n.distanceToSquared(on))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.array,i=t.position.array,o=t.normal.array,s=t.uv.array,a=i.length/3;t.tangent===void 0&&this.setAttribute("tangent",new qe(new Float32Array(4*a),4));let l=t.tangent.array,u=[],c=[];for(let F=0;F<a;F++)u[F]=new M,c[F]=new M;let f=new M,h=new M,p=new M,d=new ee,g=new ee,x=new ee,y=new M,m=new M;function b(F,C,j){f.fromArray(i,F*3),h.fromArray(i,C*3),p.fromArray(i,j*3),d.fromArray(s,F*2),g.fromArray(s,C*2),x.fromArray(s,j*2),h.sub(f),p.sub(f),g.sub(d),x.sub(d);let B=1/(g.x*x.y-x.x*g.y);!isFinite(B)||(y.copy(h).multiplyScalar(x.y).addScaledVector(p,-g.y).multiplyScalar(B),m.copy(p).multiplyScalar(g.x).addScaledVector(h,-x.x).multiplyScalar(B),u[F].add(y),u[C].add(y),u[j].add(y),c[F].add(m),c[C].add(m),c[j].add(m))}let w=this.groups;w.length===0&&(w=[{start:0,count:n.length}]);for(let F=0,C=w.length;F<C;++F){let j=w[F],B=j.start,z=j.count;for(let O=B,V=B+z;O<V;O+=3)b(n[O+0],n[O+1],n[O+2])}let D=new M,R=new M,L=new M,T=new M;function U(F){L.fromArray(o,F*3),T.copy(L);let C=u[F];D.copy(C),D.sub(L.multiplyScalar(L.dot(C))).normalize(),R.crossVectors(T,C);let B=R.dot(c[F])<0?-1:1;l[F*4]=D.x,l[F*4+1]=D.y,l[F*4+2]=D.z,l[F*4+3]=B}for(let F=0,C=w.length;F<C;++F){let j=w[F],B=j.start,z=j.count;for(let O=B,V=B+z;O<V;O+=3)U(n[O+0]),U(n[O+1]),U(n[O+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new qe(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,p=n.count;h<p;h++)n.setXYZ(h,0,0,0);let i=new M,o=new M,s=new M,a=new M,l=new M,u=new M,c=new M,f=new M;if(e)for(let h=0,p=e.count;h<p;h+=3){let d=e.getX(h+0),g=e.getX(h+1),x=e.getX(h+2);i.fromBufferAttribute(t,d),o.fromBufferAttribute(t,g),s.fromBufferAttribute(t,x),c.subVectors(s,o),f.subVectors(i,o),c.cross(f),a.fromBufferAttribute(n,d),l.fromBufferAttribute(n,g),u.fromBufferAttribute(n,x),a.add(c),l.add(c),u.add(c),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(g,l.x,l.y,l.z),n.setXYZ(x,u.x,u.y,u.z)}else for(let h=0,p=t.count;h<p;h+=3)i.fromBufferAttribute(t,h+0),o.fromBufferAttribute(t,h+1),s.fromBufferAttribute(t,h+2),c.subVectors(s,o),f.subVectors(i,o),c.cross(f),n.setXYZ(h+0,c.x,c.y,c.z),n.setXYZ(h+1,c.x,c.y,c.z),n.setXYZ(h+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));let n=this.attributes;for(let i in n){if(e.attributes[i]===void 0)continue;let s=n[i].array,a=e.attributes[i],l=a.array,u=a.itemSize*t,c=Math.min(l.length,s.length-u);for(let f=0,h=u;f<c;f++,h++)s[h]=l[f]}return this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)on.fromBufferAttribute(e,t),on.normalize(),e.setXYZ(t,on.x,on.y,on.z)}toNonIndexed(){function e(a,l){let u=a.array,c=a.itemSize,f=a.normalized,h=new u.constructor(l.length*c),p=0,d=0;for(let g=0,x=l.length;g<x;g++){a.isInterleavedBufferAttribute?p=l[g]*a.data.stride+a.offset:p=l[g]*c;for(let y=0;y<c;y++)h[d++]=u[p++]}return new qe(h,c,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new Pe,n=this.index.array,i=this.attributes;for(let a in i){let l=i[a],u=e(l,n);t.setAttribute(a,u)}let o=this.morphAttributes;for(let a in o){let l=[],u=o[a];for(let c=0,f=u.length;c<f;c++){let h=u[c],p=e(h,n);l.push(p)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let a=0,l=s.length;a<l;a++){let u=s[a];t.addGroup(u.start,u.count,u.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let u=n[l];e.data.attributes[l]=u.toJSON(e.data)}let i={},o=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],c=[];for(let f=0,h=u.length;f<h;f++){let p=u[f];c.push(p.toJSON(e.data))}c.length>0&&(i[l]=c,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone(t));let i=e.attributes;for(let u in i){let c=i[u];this.setAttribute(u,c.clone(t))}let o=e.morphAttributes;for(let u in o){let c=[],f=o[u];for(let h=0,p=f.length;h<p;h++)c.push(f[h].clone(t));this.morphAttributes[u]=c}this.morphTargetsRelative=e.morphTargetsRelative;let s=e.groups;for(let u=0,c=s.length;u<c;u++){let f=s[u];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}};Pe.prototype.isBufferGeometry=!0;f3=new Ae,Ga=new wr,Pg=new vr,ho=new M,fo=new M,po=new M,kg=new M,Bg=new M,zg=new M,Of=new M,Gf=new M,Wf=new M,Vf=new ee,Hf=new ee,qf=new ee,Ig=new M,jf=new M,Lt=class extends je{constructor(e=new Pe,t=new vt){super();this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o<s;o++){let a=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){let n=this.geometry,i=this.material,o=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),Pg.copy(n.boundingSphere),Pg.applyMatrix4(o),e.ray.intersectsSphere(Pg)===!1)||(f3.copy(o).invert(),Ga.copy(e.ray).applyMatrix4(f3),n.boundingBox!==null&&Ga.intersectsBox(n.boundingBox)===!1))return;let s;if(n.isBufferGeometry){let a=n.index,l=n.attributes.position,u=n.morphAttributes.position,c=n.morphTargetsRelative,f=n.attributes.uv,h=n.attributes.uv2,p=n.groups,d=n.drawRange;if(a!==null)if(Array.isArray(i))for(let g=0,x=p.length;g<x;g++){let y=p[g],m=i[y.materialIndex],b=Math.max(y.start,d.start),w=Math.min(a.count,Math.min(y.start+y.count,d.start+d.count));for(let D=b,R=w;D<R;D+=3){let L=a.getX(D),T=a.getX(D+1),U=a.getX(D+2);s=Qf(this,m,e,Ga,l,u,c,f,h,L,T,U),s&&(s.faceIndex=Math.floor(D/3),s.face.materialIndex=y.materialIndex,t.push(s))}}else{let g=Math.max(0,d.start),x=Math.min(a.count,d.start+d.count);for(let y=g,m=x;y<m;y+=3){let b=a.getX(y),w=a.getX(y+1),D=a.getX(y+2);s=Qf(this,i,e,Ga,l,u,c,f,h,b,w,D),s&&(s.faceIndex=Math.floor(y/3),t.push(s))}}else if(l!==void 0)if(Array.isArray(i))for(let g=0,x=p.length;g<x;g++){let y=p[g],m=i[y.materialIndex],b=Math.max(y.start,d.start),w=Math.min(l.count,Math.min(y.start+y.count,d.start+d.count));for(let D=b,R=w;D<R;D+=3){let L=D,T=D+1,U=D+2;s=Qf(this,m,e,Ga,l,u,c,f,h,L,T,U),s&&(s.faceIndex=Math.floor(D/3),s.face.materialIndex=y.materialIndex,t.push(s))}}else{let g=Math.max(0,d.start),x=Math.min(l.count,d.start+d.count);for(let y=g,m=x;y<m;y+=3){let b=y,w=y+1,D=y+2;s=Qf(this,i,e,Ga,l,u,c,f,h,b,w,D),s&&(s.faceIndex=Math.floor(y/3),t.push(s))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}};Lt.prototype.isMesh=!0;Ti=class extends Pe{constructor(e=1,t=1,n=1,i=1,o=1,s=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:s};let a=this;i=Math.floor(i),o=Math.floor(o),s=Math.floor(s);let l=[],u=[],c=[],f=[],h=0,p=0;d("z","y","x",-1,-1,n,t,e,s,o,0),d("z","y","x",1,-1,n,t,-e,s,o,1),d("x","z","y",1,1,e,n,t,i,s,2),d("x","z","y",1,-1,e,n,-t,i,s,3),d("x","y","z",1,-1,e,t,n,i,o,4),d("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(l),this.setAttribute("position",new Te(u,3)),this.setAttribute("normal",new Te(c,3)),this.setAttribute("uv",new Te(f,2));function d(g,x,y,m,b,w,D,R,L,T,U){let F=w/L,C=D/T,j=w/2,B=D/2,z=R/2,O=L+1,V=T+1,q=0,se=0,he=new M;for(let Y=0;Y<V;Y++){let X=Y*C-B;for(let ve=0;ve<O;ve++){let pe=ve*F-j;he[g]=pe*m,he[x]=X*b,he[y]=z,u.push(he.x,he.y,he.z),he[g]=0,he[x]=0,he[y]=R>0?1:-1,c.push(he.x,he.y,he.z),f.push(ve/L),f.push(1-Y/T),q+=1}}for(let Y=0;Y<T;Y++)for(let X=0;X<L;X++){let ve=h+X+O*Y,pe=h+X+O*(Y+1),Le=h+(X+1)+O*(Y+1),Ie=h+(X+1)+O*Y;l.push(ve,pe,Ie),l.push(pe,Le,Ie),se+=6}a.addGroup(p,se,U),p+=se,h+=q}}static fromJSON(e){return new Ti(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};p3={clone:Wa,merge:Dn},PR=`void main() {
|
|
1337
|
+
`+O)}else U!==""?console.warn("THREE.WebGLProgram: Program Info Log:",U):(F===""||C==="")&&(B=!1);B&&(this.diagnostics={runnable:j,programLog:U,vertexShader:{log:F,prefix:x},fragmentShader:{log:C,prefix:y}})}i.deleteShader(D),i.deleteShader(R);let L;this.getUniforms=function(){return L===void 0&&(L=new go(i,g)),L};let T;return this.getAttributes=function(){return T===void 0&&(T=S4(i,g)),T},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(g),this.program=void 0},this.name=t.shaderName,this.id=g4++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=D,this.fragmentShader=R,this}function P4(r,e,t,n,i,o,s){let a=[],l=i.isWebGL2,u=i.logarithmicDepthBuffer,c=i.floatVertexTextures,f=i.maxVertexUniforms,h=i.vertexTextures,p=i.precision,d={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoat","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap",,"roughnessMap","metalnessMap","gradientMap","alphaMap","alphaTest","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","morphTargetsCount","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","format","specularIntensityMap","specularColorMap","specularColorMapEncoding","transmission","transmissionMap","thicknessMap","sheen","sheenColorMap","sheenColorMapEncoding","sheenRoughnessMap"];function x(L){let U=L.skeleton.bones;if(c)return 1024;{let C=Math.floor((f-20)/4),j=Math.min(C,U.length);return j<U.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+U.length+" bones. This GPU supports "+j+"."),0):j}}function y(L){let T;return L&&L.isTexture?T=L.encoding:L&&L.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),T=L.texture.encoding):T=Pn,T}function m(L,T,U,F,C){let j=F.fog,B=L.isMeshStandardMaterial?F.environment:null,z=(L.isMeshStandardMaterial?t:e).get(L.envMap||B),O=d[L.type],V=C.isSkinnedMesh?x(C):0;L.precision!==null&&(p=i.getMaxPrecision(L.precision),p!==L.precision&&console.warn("THREE.WebGLProgram.getParameters:",L.precision,"not supported, using",p,"instead."));let q,se;if(O){let pe=_i[O];q=pe.vertexShader,se=pe.fragmentShader}else q=L.vertexShader,se=L.fragmentShader;let he=r.getRenderTarget(),Y=L.alphaTest>0,X=L.clearcoat>0;return{isWebGL2:l,shaderID:O,shaderName:L.type,vertexShader:q,fragmentShader:se,defines:L.defines,isRawShaderMaterial:L.isRawShaderMaterial===!0,glslVersion:L.glslVersion,precision:p,instancing:C.isInstancedMesh===!0,instancingColor:C.isInstancedMesh===!0&&C.instanceColor!==null,supportsVertexTextures:h,outputEncoding:he!==null?y(he.texture):r.outputEncoding,map:!!L.map,mapEncoding:y(L.map),matcap:!!L.matcap,matcapEncoding:y(L.matcap),envMap:!!z,envMapMode:z&&z.mapping,envMapEncoding:y(z),envMapCubeUV:!!z&&(z.mapping===Ma||z.mapping===Pu),lightMap:!!L.lightMap,lightMapEncoding:y(L.lightMap),aoMap:!!L.aoMap,emissiveMap:!!L.emissiveMap,emissiveMapEncoding:y(L.emissiveMap),bumpMap:!!L.bumpMap,normalMap:!!L.normalMap,objectSpaceNormalMap:L.normalMapType===Kb,tangentSpaceNormalMap:L.normalMapType===us,clearcoat:X,clearcoatMap:X&&!!L.clearcoatMap,clearcoatRoughnessMap:X&&!!L.clearcoatRoughnessMap,clearcoatNormalMap:X&&!!L.clearcoatNormalMap,displacementMap:!!L.displacementMap,roughnessMap:!!L.roughnessMap,metalnessMap:!!L.metalnessMap,specularMap:!!L.specularMap,specularIntensityMap:!!L.specularIntensityMap,specularColorMap:!!L.specularColorMap,specularColorMapEncoding:y(L.specularColorMap),alphaMap:!!L.alphaMap,alphaTest:Y,gradientMap:!!L.gradientMap,sheen:L.sheen>0,sheenColorMap:!!L.sheenColorMap,sheenColorMapEncoding:y(L.sheenColorMap),sheenRoughnessMap:!!L.sheenRoughnessMap,transmission:L.transmission>0,transmissionMap:!!L.transmissionMap,thicknessMap:!!L.thicknessMap,combine:L.combine,vertexTangents:!!L.normalMap&&!!C.geometry&&!!C.geometry.attributes.tangent,vertexColors:L.vertexColors,vertexAlphas:L.vertexColors===!0&&!!C.geometry&&!!C.geometry.attributes.color&&C.geometry.attributes.color.itemSize===4,vertexUvs:!!L.map||!!L.bumpMap||!!L.normalMap||!!L.specularMap||!!L.alphaMap||!!L.emissiveMap||!!L.roughnessMap||!!L.metalnessMap||!!L.clearcoatMap||!!L.clearcoatRoughnessMap||!!L.clearcoatNormalMap||!!L.displacementMap||!!L.transmissionMap||!!L.thicknessMap||!!L.specularIntensityMap||!!L.specularColorMap||!!L.sheenColorMap||L.sheenRoughnessMap,uvsVertexOnly:!(!!L.map||!!L.bumpMap||!!L.normalMap||!!L.specularMap||!!L.alphaMap||!!L.emissiveMap||!!L.roughnessMap||!!L.metalnessMap||!!L.clearcoatNormalMap||L.transmission>0||!!L.transmissionMap||!!L.thicknessMap||!!L.specularIntensityMap||!!L.specularColorMap||L.sheen>0||!!L.sheenColorMap||!!L.sheenRoughnessMap)&&!!L.displacementMap,fog:!!j,useFog:L.fog,fogExp2:j&&j.isFogExp2,flatShading:!!L.flatShading,sizeAttenuation:L.sizeAttenuation,logarithmicDepthBuffer:u,skinning:C.isSkinnedMesh===!0&&V>0,maxBones:V,useVertexTexture:c,morphTargets:!!C.geometry&&!!C.geometry.morphAttributes.position,morphNormals:!!C.geometry&&!!C.geometry.morphAttributes.normal,morphTargetsCount:!!C.geometry&&!!C.geometry.morphAttributes.position?C.geometry.morphAttributes.position.length:0,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,format:L.format,dithering:L.dithering,shadowMapEnabled:r.shadowMap.enabled&&U.length>0,shadowMapType:r.shadowMap.type,toneMapping:L.toneMapped?r.toneMapping:io,physicallyCorrectLights:r.physicallyCorrectLights,premultipliedAlpha:L.premultipliedAlpha,doubleSided:L.side===jn,flipSided:L.side===At,depthPacking:L.depthPacking!==void 0?L.depthPacking:!1,index0AttributeName:L.index0AttributeName,extensionDerivatives:L.extensions&&L.extensions.derivatives,extensionFragDepth:L.extensions&&L.extensions.fragDepth,extensionDrawBuffers:L.extensions&&L.extensions.drawBuffers,extensionShaderTextureLOD:L.extensions&&L.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||n.has("EXT_shader_texture_lod"),customProgramCacheKey:L.customProgramCacheKey()}}function b(L){let T=[];if(L.shaderID?T.push(L.shaderID):(T.push(t3(L.fragmentShader)),T.push(t3(L.vertexShader))),L.defines!==void 0)for(let U in L.defines)T.push(U),T.push(L.defines[U]);if(L.isRawShaderMaterial===!1){for(let U=0;U<g.length;U++)T.push(L[g[U]]);T.push(r.outputEncoding),T.push(r.gammaFactor)}return T.push(L.customProgramCacheKey),T.join()}function w(L){let T=d[L.type],U;if(T){let F=_i[T];U=d3.clone(F.uniforms)}else U=L.uniforms;return U}function D(L,T){let U;for(let F=0,C=a.length;F<C;F++){let j=a[F];if(j.cacheKey===T){U=j,++U.usedTimes;break}}return U===void 0&&(U=new C4(r,T,L,o),a.push(U)),U}function R(L){if(--L.usedTimes==0){let T=a.indexOf(L);a[T]=a[a.length-1],a.pop(),L.destroy()}}return{getParameters:m,getProgramCacheKey:b,getUniforms:w,acquireProgram:D,releaseProgram:R,programs:a}}function k4(){let r=new WeakMap;function e(o){let s=r.get(o);return s===void 0&&(s={},r.set(o,s)),s}function t(o){r.delete(o)}function n(o,s,a){r.get(o)[s]=a}function i(){r=new WeakMap}return{get:e,remove:t,update:n,dispose:i}}function B4(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.program!==e.program?r.program.id-e.program.id:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function q3(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function j3(r){let e=[],t=0,n=[],i=[],o=[],s={id:-1};function a(){t=0,n.length=0,i.length=0,o.length=0}function l(p,d,g,x,y,m){let b=e[t],w=r.get(g);return b===void 0?(b={id:p.id,object:p,geometry:d,material:g,program:w.program||s,groupOrder:x,renderOrder:p.renderOrder,z:y,group:m},e[t]=b):(b.id=p.id,b.object=p,b.geometry=d,b.material=g,b.program=w.program||s,b.groupOrder=x,b.renderOrder=p.renderOrder,b.z=y,b.group=m),t++,b}function u(p,d,g,x,y,m){let b=l(p,d,g,x,y,m);g.transmission>0?i.push(b):g.transparent===!0?o.push(b):n.push(b)}function c(p,d,g,x,y,m){let b=l(p,d,g,x,y,m);g.transmission>0?i.unshift(b):g.transparent===!0?o.unshift(b):n.unshift(b)}function f(p,d){n.length>1&&n.sort(p||B4),i.length>1&&i.sort(d||q3),o.length>1&&o.sort(d||q3)}function h(){for(let p=t,d=e.length;p<d;p++){let g=e[p];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.program=null,g.group=null}}return{opaque:n,transmissive:i,transparent:o,init:a,push:u,unshift:c,finish:h,sort:f}}function z4(r){let e=new WeakMap;function t(i,o){let s;return e.has(i)===!1?(s=new j3(r),e.set(i,[s])):o>=e.get(i).length?(s=new j3(r),e.get(i).push(s)):s=e.get(i)[o],s}function n(){e=new WeakMap}return{get:t,dispose:n}}function I4(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new M,color:new xe};break;case"SpotLight":t={position:new M,direction:new M,color:new xe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new M,color:new xe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new M,skyColor:new xe,groundColor:new xe};break;case"RectAreaLight":t={color:new xe,position:new M,halfWidth:new M,halfHeight:new M};break}return r[e.id]=t,t}}}function U4(){let r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ee};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ee};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ee,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}function O4(r,e){return(e.castShadow?1:0)-(r.castShadow?1:0)}function G4(r,e){let t=new I4,n=U4(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let c=0;c<9;c++)i.probe.push(new M);let o=new M,s=new Ae,a=new Ae;function l(c,f){let h=0,p=0,d=0;for(let U=0;U<9;U++)i.probe[U].set(0,0,0);let g=0,x=0,y=0,m=0,b=0,w=0,D=0,R=0;c.sort(O4);let L=f!==!0?Math.PI:1;for(let U=0,F=c.length;U<F;U++){let C=c[U],j=C.color,B=C.intensity,z=C.distance,O=C.shadow&&C.shadow.map?C.shadow.map.texture:null;if(C.isAmbientLight)h+=j.r*B*L,p+=j.g*B*L,d+=j.b*B*L;else if(C.isLightProbe)for(let V=0;V<9;V++)i.probe[V].addScaledVector(C.sh.coefficients[V],B);else if(C.isDirectionalLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity*L),C.castShadow){let q=C.shadow,se=n.get(C);se.shadowBias=q.bias,se.shadowNormalBias=q.normalBias,se.shadowRadius=q.radius,se.shadowMapSize=q.mapSize,i.directionalShadow[g]=se,i.directionalShadowMap[g]=O,i.directionalShadowMatrix[g]=C.shadow.matrix,w++}i.directional[g]=V,g++}else if(C.isSpotLight){let V=t.get(C);if(V.position.setFromMatrixPosition(C.matrixWorld),V.color.copy(j).multiplyScalar(B*L),V.distance=z,V.coneCos=Math.cos(C.angle),V.penumbraCos=Math.cos(C.angle*(1-C.penumbra)),V.decay=C.decay,C.castShadow){let q=C.shadow,se=n.get(C);se.shadowBias=q.bias,se.shadowNormalBias=q.normalBias,se.shadowRadius=q.radius,se.shadowMapSize=q.mapSize,i.spotShadow[y]=se,i.spotShadowMap[y]=O,i.spotShadowMatrix[y]=C.shadow.matrix,R++}i.spot[y]=V,y++}else if(C.isRectAreaLight){let V=t.get(C);V.color.copy(j).multiplyScalar(B),V.halfWidth.set(C.width*.5,0,0),V.halfHeight.set(0,C.height*.5,0),i.rectArea[m]=V,m++}else if(C.isPointLight){let V=t.get(C);if(V.color.copy(C.color).multiplyScalar(C.intensity*L),V.distance=C.distance,V.decay=C.decay,C.castShadow){let q=C.shadow,se=n.get(C);se.shadowBias=q.bias,se.shadowNormalBias=q.normalBias,se.shadowRadius=q.radius,se.shadowMapSize=q.mapSize,se.shadowCameraNear=q.camera.near,se.shadowCameraFar=q.camera.far,i.pointShadow[x]=se,i.pointShadowMap[x]=O,i.pointShadowMatrix[x]=C.shadow.matrix,D++}i.point[x]=V,x++}else if(C.isHemisphereLight){let V=t.get(C);V.skyColor.copy(C.color).multiplyScalar(B*L),V.groundColor.copy(C.groundColor).multiplyScalar(B*L),i.hemi[b]=V,b++}}m>0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=we.LTC_FLOAT_1,i.rectAreaLTC2=we.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=we.LTC_HALF_1,i.rectAreaLTC2=we.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=h,i.ambient[1]=p,i.ambient[2]=d;let T=i.hash;(T.directionalLength!==g||T.pointLength!==x||T.spotLength!==y||T.rectAreaLength!==m||T.hemiLength!==b||T.numDirectionalShadows!==w||T.numPointShadows!==D||T.numSpotShadows!==R)&&(i.directional.length=g,i.spot.length=y,i.rectArea.length=m,i.point.length=x,i.hemi.length=b,i.directionalShadow.length=w,i.directionalShadowMap.length=w,i.pointShadow.length=D,i.pointShadowMap.length=D,i.spotShadow.length=R,i.spotShadowMap.length=R,i.directionalShadowMatrix.length=w,i.pointShadowMatrix.length=D,i.spotShadowMatrix.length=R,T.directionalLength=g,T.pointLength=x,T.spotLength=y,T.rectAreaLength=m,T.hemiLength=b,T.numDirectionalShadows=w,T.numPointShadows=D,T.numSpotShadows=R,i.version=N4++)}function u(c,f){let h=0,p=0,d=0,g=0,x=0,y=f.matrixWorldInverse;for(let m=0,b=c.length;m<b;m++){let w=c[m];if(w.isDirectionalLight){let D=i.directional[h];D.direction.setFromMatrixPosition(w.matrixWorld),o.setFromMatrixPosition(w.target.matrixWorld),D.direction.sub(o),D.direction.transformDirection(y),h++}else if(w.isSpotLight){let D=i.spot[d];D.position.setFromMatrixPosition(w.matrixWorld),D.position.applyMatrix4(y),D.direction.setFromMatrixPosition(w.matrixWorld),o.setFromMatrixPosition(w.target.matrixWorld),D.direction.sub(o),D.direction.transformDirection(y),d++}else if(w.isRectAreaLight){let D=i.rectArea[g];D.position.setFromMatrixPosition(w.matrixWorld),D.position.applyMatrix4(y),a.identity(),s.copy(w.matrixWorld),s.premultiply(y),a.extractRotation(s),D.halfWidth.set(w.width*.5,0,0),D.halfHeight.set(0,w.height*.5,0),D.halfWidth.applyMatrix4(a),D.halfHeight.applyMatrix4(a),g++}else if(w.isPointLight){let D=i.point[p];D.position.setFromMatrixPosition(w.matrixWorld),D.position.applyMatrix4(y),p++}else if(w.isHemisphereLight){let D=i.hemi[x];D.direction.setFromMatrixPosition(w.matrixWorld),D.direction.transformDirection(y),D.direction.normalize(),x++}}}return{setup:l,setupView:u,state:i}}function Q3(r,e){let t=new G4(r,e),n=[],i=[];function o(){n.length=0,i.length=0}function s(f){n.push(f)}function a(f){i.push(f)}function l(f){t.setup(n,f)}function u(f){t.setupView(n,f)}return{init:o,state:{lightsArray:n,shadowsArray:i,lights:t},setupLights:l,setupLightsView:u,pushLight:s,pushShadow:a}}function W4(r,e){let t=new WeakMap;function n(o,s=0){let a;return t.has(o)===!1?(a=new Q3(r,e),t.set(o,[a])):s>=t.get(o).length?(a=new Q3(r,e),t.get(o).push(a)):a=t.get(o)[s],a}function i(){t=new WeakMap}return{get:n,dispose:i}}function Y3(r,e,t){let n=new Qa,i=new ee,o=new ee,s=new xt,a=new tc({depthPacking:Xb}),l=new nc,u={},c=t.maxTextureSize,f={0:At,1:ji,2:jn},h=new Yi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ee},radius:{value:4}},vertexShader:V4,fragmentShader:H4}),p=h.clone();p.defines.HORIZONTAL_PASS=1;let d=new Pe;d.setAttribute("position",new qe(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new Lt(d,h),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=z0,this.render=function(w,D,R){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||w.length===0)return;let L=r.getRenderTarget(),T=r.getActiveCubeFace(),U=r.getActiveMipmapLevel(),F=r.state;F.setBlending(dr),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);for(let C=0,j=w.length;C<j;C++){let B=w[C],z=B.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;i.copy(z.mapSize);let O=z.getFrameExtents();if(i.multiply(O),o.copy(z.mapSize),(i.x>c||i.y>c)&&(i.x>c&&(o.x=Math.floor(c/O.x),i.x=o.x*O.x,z.mapSize.x=o.x),i.y>c&&(o.y=Math.floor(c/O.y),i.y=o.y*O.y,z.mapSize.y=o.y)),z.map===null&&!z.isPointLightShadow&&this.type===Da){let q={minFilter:Kt,magFilter:Kt,format:gn};z.map=new Qn(i.x,i.y,q),z.map.texture.name=B.name+".shadowMap",z.mapPass=new Qn(i.x,i.y,q),z.camera.updateProjectionMatrix()}if(z.map===null){let q={minFilter:jt,magFilter:jt,format:gn};z.map=new Qn(i.x,i.y,q),z.map.texture.name=B.name+".shadowMap",z.camera.updateProjectionMatrix()}r.setRenderTarget(z.map),r.clear();let V=z.getViewportCount();for(let q=0;q<V;q++){let se=z.getViewport(q);s.set(o.x*se.x,o.y*se.y,o.x*se.z,o.y*se.w),F.viewport(s),z.updateMatrices(B,q),n=z.getFrustum(),b(D,R,z.camera,B,this.type)}!z.isPointLightShadow&&this.type===Da&&y(z,R),z.needsUpdate=!1}x.needsUpdate=!1,r.setRenderTarget(L,T,U)};function y(w,D){let R=e.update(g);h.defines.VSM_SAMPLES!==w.blurSamples&&(h.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),h.uniforms.shadow_pass.value=w.map.texture,h.uniforms.resolution.value=w.mapSize,h.uniforms.radius.value=w.radius,r.setRenderTarget(w.mapPass),r.clear(),r.renderBufferDirect(D,null,R,h,g,null),p.uniforms.shadow_pass.value=w.mapPass.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,r.setRenderTarget(w.map),r.clear(),r.renderBufferDirect(D,null,R,p,g,null)}function m(w,D,R,L,T,U,F){let C=null,j=L.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(j!==void 0?C=j:C=L.isPointLight===!0?l:a,r.localClippingEnabled&&R.clipShadows===!0&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0){let B=C.uuid,z=R.uuid,O=u[B];O===void 0&&(O={},u[B]=O);let V=O[z];V===void 0&&(V=C.clone(),O[z]=V),C=V}return C.visible=R.visible,C.wireframe=R.wireframe,F===Da?C.side=R.shadowSide!==null?R.shadowSide:R.side:C.side=R.shadowSide!==null?R.shadowSide:f[R.side],C.alphaMap=R.alphaMap,C.alphaTest=R.alphaTest,C.clipShadows=R.clipShadows,C.clippingPlanes=R.clippingPlanes,C.clipIntersection=R.clipIntersection,C.displacementMap=R.displacementMap,C.displacementScale=R.displacementScale,C.displacementBias=R.displacementBias,C.wireframeLinewidth=R.wireframeLinewidth,C.linewidth=R.linewidth,L.isPointLight===!0&&C.isMeshDistanceMaterial===!0&&(C.referencePosition.setFromMatrixPosition(L.matrixWorld),C.nearDistance=T,C.farDistance=U),C}function b(w,D,R,L,T){if(w.visible===!1)return;if(w.layers.test(D.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&T===Da)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,w.matrixWorld);let C=e.update(w),j=w.material;if(Array.isArray(j)){let B=C.groups;for(let z=0,O=B.length;z<O;z++){let V=B[z],q=j[V.materialIndex];if(q&&q.visible){let se=m(w,C,q,L,R.near,R.far,T);r.renderBufferDirect(R,null,C,se,w,V)}}}else if(j.visible){let B=m(w,C,j,L,R.near,R.far,T);r.renderBufferDirect(R,null,C,B,w,null)}}let F=w.children;for(let C=0,j=F.length;C<j;C++)b(F[C],D,R,L,T)}}function q4(r,e,t){let n=t.isWebGL2;function i(){let G=!1,de=new xt,J=null,be=new xt(0,0,0,0);return{setMask:function(ge){J!==ge&&!G&&(r.colorMask(ge,ge,ge,ge),J=ge)},setLocked:function(ge){G=ge},setClear:function(ge,Ee,Re,Ve,Mt){Mt===!0&&(ge*=Ve,Ee*=Ve,Re*=Ve),de.set(ge,Ee,Re,Ve),be.equals(de)===!1&&(r.clearColor(ge,Ee,Re,Ve),be.copy(de))},reset:function(){G=!1,J=null,be.set(-1,0,0,0)}}}function o(){let G=!1,de=null,J=null,be=null;return{setTest:function(ge){ge?pe(2929):Le(2929)},setMask:function(ge){de!==ge&&!G&&(r.depthMask(ge),de=ge)},setFunc:function(ge){if(J!==ge){if(ge)switch(ge){case Uw:r.depthFunc(512);break;case Nw:r.depthFunc(519);break;case Ow:r.depthFunc(513);break;case wf:r.depthFunc(515);break;case Gw:r.depthFunc(514);break;case Ww:r.depthFunc(518);break;case Vw:r.depthFunc(516);break;case Hw:r.depthFunc(517);break;default:r.depthFunc(515)}else r.depthFunc(515);J=ge}},setLocked:function(ge){G=ge},setClear:function(ge){be!==ge&&(r.clearDepth(ge),be=ge)},reset:function(){G=!1,de=null,J=null,be=null}}}function s(){let G=!1,de=null,J=null,be=null,ge=null,Ee=null,Re=null,Ve=null,Mt=null;return{setTest:function(Ze){G||(Ze?pe(2960):Le(2960))},setMask:function(Ze){de!==Ze&&!G&&(r.stencilMask(Ze),de=Ze)},setFunc:function(Ze,ii,Nn){(J!==Ze||be!==ii||ge!==Nn)&&(r.stencilFunc(Ze,ii,Nn),J=Ze,be=ii,ge=Nn)},setOp:function(Ze,ii,Nn){(Ee!==Ze||Re!==ii||Ve!==Nn)&&(r.stencilOp(Ze,ii,Nn),Ee=Ze,Re=ii,Ve=Nn)},setLocked:function(Ze){G=Ze},setClear:function(Ze){Mt!==Ze&&(r.clearStencil(Ze),Mt=Ze)},reset:function(){G=!1,de=null,J=null,be=null,ge=null,Ee=null,Re=null,Ve=null,Mt=null}}}let a=new i,l=new o,u=new s,c={},f={},h=null,p=!1,d=null,g=null,x=null,y=null,m=null,b=null,w=null,D=!1,R=null,L=null,T=null,U=null,F=null,C=r.getParameter(35661),j=!1,B=0,z=r.getParameter(7938);z.indexOf("WebGL")!==-1?(B=parseFloat(/^WebGL (\d)/.exec(z)[1]),j=B>=1):z.indexOf("OpenGL ES")!==-1&&(B=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),j=B>=2);let O=null,V={},q=r.getParameter(3088),se=r.getParameter(2978),he=new xt().fromArray(q),Y=new xt().fromArray(se);function X(G,de,J){let be=new Uint8Array(4),ge=r.createTexture();r.bindTexture(G,ge),r.texParameteri(G,10241,9728),r.texParameteri(G,10240,9728);for(let Ee=0;Ee<J;Ee++)r.texImage2D(de+Ee,0,6408,1,1,0,6408,5121,be);return ge}let ve={};ve[3553]=X(3553,3553,1),ve[34067]=X(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),u.setClear(0),pe(2929),l.setFunc(wf),W(!1),Q(B0),pe(2884),ne(dr);function pe(G){c[G]!==!0&&(r.enable(G),c[G]=!0)}function Le(G){c[G]!==!1&&(r.disable(G),c[G]=!1)}function Ie(G,de){return f[G]!==de?(r.bindFramebuffer(G,de),f[G]=de,n&&(G===36009&&(f[36160]=de),G===36160&&(f[36009]=de)),!0):!1}function P(G){return h!==G?(r.useProgram(G),h=G,!0):!1}let Z={[es]:32774,[Mw]:32778,[Rw]:32779};if(n)Z[G0]=32775,Z[W0]=32776;else{let G=e.get("EXT_blend_minmax");G!==null&&(Z[G0]=G.MIN_EXT,Z[W0]=G.MAX_EXT)}let ae={[Tw]:0,[Fw]:1,[_w]:768,[V0]:770,[Iw]:776,[Bw]:774,[Pw]:772,[Cw]:769,[H0]:771,[zw]:775,[kw]:773};function ne(G,de,J,be,ge,Ee,Re,Ve){if(G===dr){p===!0&&(Le(3042),p=!1);return}if(p===!1&&(pe(3042),p=!0),G!==Ew){if(G!==d||Ve!==D){if((g!==es||m!==es)&&(r.blendEquation(32774),g=es,m=es),Ve)switch(G){case Ea:r.blendFuncSeparate(1,771,1,771);break;case U0:r.blendFunc(1,1);break;case N0:r.blendFuncSeparate(0,0,769,771);break;case O0:r.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Ea:r.blendFuncSeparate(770,771,1,771);break;case U0:r.blendFunc(770,1);break;case N0:r.blendFunc(0,769);break;case O0:r.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}x=null,y=null,b=null,w=null,d=G,D=Ve}return}ge=ge||de,Ee=Ee||J,Re=Re||be,(de!==g||ge!==m)&&(r.blendEquationSeparate(Z[de],Z[ge]),g=de,m=ge),(J!==x||be!==y||Ee!==b||Re!==w)&&(r.blendFuncSeparate(ae[J],ae[be],ae[Ee],ae[Re]),x=J,y=be,b=Ee,w=Re),d=G,D=null}function fe(G,de){G.side===jn?Le(2884):pe(2884);let J=G.side===At;de&&(J=!J),W(J),G.blending===Ea&&G.transparent===!1?ne(dr):ne(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.premultipliedAlpha),l.setFunc(G.depthFunc),l.setTest(G.depthTest),l.setMask(G.depthWrite),a.setMask(G.colorWrite);let be=G.stencilWrite;u.setTest(be),be&&(u.setMask(G.stencilWriteMask),u.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),u.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),ue(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?pe(32926):Le(32926)}function W(G){R!==G&&(G?r.frontFace(2304):r.frontFace(2305),R=G)}function Q(G){G!==Lw?(pe(2884),G!==L&&(G===B0?r.cullFace(1029):G===Aw?r.cullFace(1028):r.cullFace(1032))):Le(2884),L=G}function le(G){G!==T&&(j&&r.lineWidth(G),T=G)}function ue(G,de,J){G?(pe(32823),(U!==de||F!==J)&&(r.polygonOffset(de,J),U=de,F=J)):Le(32823)}function Se(G){G?pe(3089):Le(3089)}function ce(G){G===void 0&&(G=33984+C-1),O!==G&&(r.activeTexture(G),O=G)}function Ue(G,de){O===null&&ce();let J=V[O];J===void 0&&(J={type:void 0,texture:void 0},V[O]=J),(J.type!==G||J.texture!==de)&&(r.bindTexture(G,de||ve[G]),J.type=G,J.texture=de)}function We(){let G=V[O];G!==void 0&&G.type!==void 0&&(r.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function nt(){try{r.compressedTexImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Et(){try{r.texSubImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function k(){try{r.texStorage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function _(){try{r.texImage2D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function te(){try{r.texImage3D.apply(r,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ie(G){he.equals(G)===!1&&(r.scissor(G.x,G.y,G.z,G.w),he.copy(G))}function Fe(G){Y.equals(G)===!1&&(r.viewport(G.x,G.y,G.z,G.w),Y.copy(G))}function Me(){r.disable(3042),r.disable(2884),r.disable(2929),r.disable(32823),r.disable(3089),r.disable(2960),r.disable(32926),r.blendEquation(32774),r.blendFunc(1,0),r.blendFuncSeparate(1,0,1,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(513),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(519,0,4294967295),r.stencilOp(7680,7680,7680),r.clearStencil(0),r.cullFace(1029),r.frontFace(2305),r.polygonOffset(0,0),r.activeTexture(33984),r.bindFramebuffer(36160,null),n===!0&&(r.bindFramebuffer(36009,null),r.bindFramebuffer(36008,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),c={},O=null,V={},f={},h=null,p=!1,d=null,g=null,x=null,y=null,m=null,b=null,w=null,D=!1,R=null,L=null,T=null,U=null,F=null,he.set(0,0,r.canvas.width,r.canvas.height),Y.set(0,0,r.canvas.width,r.canvas.height),a.reset(),l.reset(),u.reset()}return{buffers:{color:a,depth:l,stencil:u},enable:pe,disable:Le,bindFramebuffer:Ie,useProgram:P,setBlending:ne,setMaterial:fe,setFlipSided:W,setCullFace:Q,setLineWidth:le,setPolygonOffset:ue,setScissorTest:Se,activeTexture:ce,bindTexture:Ue,unbindTexture:We,compressedTexImage2D:nt,texImage2D:_,texImage3D:te,texStorage2D:k,texSubImage2D:Et,scissor:ie,viewport:Fe,reset:Me}}function j4(r,e,t,n,i,o,s){let a=i.isWebGL2,l=i.maxTextures,u=i.maxCubemapSize,c=i.maxTextureSize,f=i.maxSamples,p=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):void 0,d=new WeakMap,g,x=!1;try{x=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(k){}function y(k,_){return x?new OffscreenCanvas(k,_):Ff("canvas")}function m(k,_,te,ie){let Fe=1;if((k.width>ie||k.height>ie)&&(Fe=ie/Math.max(k.width,k.height)),Fe<1||_===!0)if(typeof HTMLImageElement!="undefined"&&k instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&k instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&k instanceof ImageBitmap){let Me=_?$b:Math.floor,G=Me(Fe*k.width),de=Me(Fe*k.height);g===void 0&&(g=y(G,de));let J=te?y(G,de):g;return J.width=G,J.height=de,J.getContext("2d").drawImage(k,0,0,G,de),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+k.width+"x"+k.height+") to ("+G+"x"+de+")."),J}else return"data"in k&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+k.width+"x"+k.height+")."),k;return k}function b(k){return lg(k.width)&&lg(k.height)}function w(k){return a?!1:k.wrapS!==mn||k.wrapT!==mn||k.minFilter!==jt&&k.minFilter!==Kt}function D(k,_){return k.generateMipmaps&&_&&k.minFilter!==jt&&k.minFilter!==Kt}function R(k){r.generateMipmap(k)}function L(k,_,te){if(a===!1)return _;if(k!==null){if(r[k]!==void 0)return r[k];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+k+"'")}let ie=_;return _===6403&&(te===5126&&(ie=33326),te===5131&&(ie=33325),te===5121&&(ie=33321)),_===6407&&(te===5126&&(ie=34837),te===5131&&(ie=34843),te===5121&&(ie=32849)),_===6408&&(te===5126&&(ie=34836),te===5131&&(ie=34842),te===5121&&(ie=32856)),(ie===33325||ie===33326||ie===34842||ie===34836)&&e.get("EXT_color_buffer_float"),ie}function T(k,_,te){return D(k,te)===!0?Math.log2(Math.max(_.width,_.height))+1:k.mipmaps.length>0?k.mipmaps.length:1}function U(k){return k===jt||k===Sf||k===Lf?9728:9729}function F(k){let _=k.target;_.removeEventListener("dispose",F),j(_),_.isVideoTexture&&d.delete(_),s.memory.textures--}function C(k){let _=k.target;_.removeEventListener("dispose",C),B(_)}function j(k){let _=n.get(k);_.__webglInit!==void 0&&(r.deleteTexture(_.__webglTexture),n.remove(k))}function B(k){let _=k.texture,te=n.get(k),ie=n.get(_);if(!!k){if(ie.__webglTexture!==void 0&&(r.deleteTexture(ie.__webglTexture),s.memory.textures--),k.depthTexture&&k.depthTexture.dispose(),k.isWebGLCubeRenderTarget)for(let Fe=0;Fe<6;Fe++)r.deleteFramebuffer(te.__webglFramebuffer[Fe]),te.__webglDepthbuffer&&r.deleteRenderbuffer(te.__webglDepthbuffer[Fe]);else r.deleteFramebuffer(te.__webglFramebuffer),te.__webglDepthbuffer&&r.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&r.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer&&r.deleteRenderbuffer(te.__webglColorRenderbuffer),te.__webglDepthRenderbuffer&&r.deleteRenderbuffer(te.__webglDepthRenderbuffer);if(k.isWebGLMultipleRenderTargets)for(let Fe=0,Me=_.length;Fe<Me;Fe++){let G=n.get(_[Fe]);G.__webglTexture&&(r.deleteTexture(G.__webglTexture),s.memory.textures--),n.remove(_[Fe])}n.remove(_),n.remove(k)}}let z=0;function O(){z=0}function V(){let k=z;return k>=l&&console.warn("THREE.WebGLTextures: Trying to use "+k+" texture units while this GPU supports only "+l),z+=1,k}function q(k,_){let te=n.get(k);if(k.isVideoTexture&&ce(k),k.version>0&&te.__version!==k.version){let ie=k.image;if(ie===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(ie.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ie(te,k,_);return}}t.activeTexture(33984+_),t.bindTexture(3553,te.__webglTexture)}function se(k,_){let te=n.get(k);if(k.version>0&&te.__version!==k.version){Ie(te,k,_);return}t.activeTexture(33984+_),t.bindTexture(35866,te.__webglTexture)}function he(k,_){let te=n.get(k);if(k.version>0&&te.__version!==k.version){Ie(te,k,_);return}t.activeTexture(33984+_),t.bindTexture(32879,te.__webglTexture)}function Y(k,_){let te=n.get(k);if(k.version>0&&te.__version!==k.version){P(te,k,_);return}t.activeTexture(33984+_),t.bindTexture(34067,te.__webglTexture)}let X={[ku]:10497,[mn]:33071,[Bu]:33648},ve={[jt]:9728,[Sf]:9984,[Lf]:9986,[Kt]:9729,[q0]:9985,[is]:9987};function pe(k,_,te){if(te?(r.texParameteri(k,10242,X[_.wrapS]),r.texParameteri(k,10243,X[_.wrapT]),(k===32879||k===35866)&&r.texParameteri(k,32882,X[_.wrapR]),r.texParameteri(k,10240,ve[_.magFilter]),r.texParameteri(k,10241,ve[_.minFilter])):(r.texParameteri(k,10242,33071),r.texParameteri(k,10243,33071),(k===32879||k===35866)&&r.texParameteri(k,32882,33071),(_.wrapS!==mn||_.wrapT!==mn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(k,10240,U(_.magFilter)),r.texParameteri(k,10241,U(_.minFilter)),_.minFilter!==jt&&_.minFilter!==Kt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){let ie=e.get("EXT_texture_filter_anisotropic");if(_.type===Qi&&e.has("OES_texture_float_linear")===!1||a===!1&&_.type===rs&&e.has("OES_texture_half_float_linear")===!1)return;(_.anisotropy>1||n.get(_).__currentAnisotropy)&&(r.texParameterf(k,ie.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,i.getMaxAnisotropy())),n.get(_).__currentAnisotropy=_.anisotropy)}}function Le(k,_){k.__webglInit===void 0&&(k.__webglInit=!0,_.addEventListener("dispose",F),k.__webglTexture=r.createTexture(),s.memory.textures++)}function Ie(k,_,te){let ie=3553;_.isDataTexture2DArray&&(ie=35866),_.isDataTexture3D&&(ie=32879),Le(k,_),t.activeTexture(33984+te),t.bindTexture(ie,k.__webglTexture),r.pixelStorei(37440,_.flipY),r.pixelStorei(37441,_.premultiplyAlpha),r.pixelStorei(3317,_.unpackAlignment),r.pixelStorei(37443,0);let Fe=w(_)&&b(_.image)===!1,Me=m(_.image,Fe,!1,c),G=b(Me)||a,de=o.convert(_.format),J=o.convert(_.type),be=L(_.internalFormat,de,J,_.encoding);pe(ie,_,G);let ge,Ee=_.mipmaps;if(_.isDepthTexture)be=6402,a?_.type===Qi?be=36012:_.type===zu?be=33190:_.type===os?be=35056:be=33189:_.type===Qi&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),_.format===oo&&be===6402&&_.type!==Ra&&_.type!==zu&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),_.type=Ra,J=o.convert(_.type)),_.format===ss&&be===6402&&(be=34041,_.type!==os&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),_.type=os,J=o.convert(_.type))),t.texImage2D(3553,0,be,Me.width,Me.height,0,de,J,null);else if(_.isDataTexture)if(Ee.length>0&&G){for(let Re=0,Ve=Ee.length;Re<Ve;Re++)ge=Ee[Re],t.texImage2D(3553,Re,be,ge.width,ge.height,0,de,J,ge.data);_.generateMipmaps=!1}else t.texImage2D(3553,0,be,Me.width,Me.height,0,de,J,Me.data);else if(_.isCompressedTexture)for(let Re=0,Ve=Ee.length;Re<Ve;Re++)ge=Ee[Re],_.format!==gn&&_.format!==ro?de!==null?t.compressedTexImage2D(3553,Re,be,ge.width,ge.height,0,ge.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):t.texImage2D(3553,Re,be,ge.width,ge.height,0,de,J,ge.data);else if(_.isDataTexture2DArray)t.texImage3D(35866,0,be,Me.width,Me.height,Me.depth,0,de,J,Me.data);else if(_.isDataTexture3D)t.texImage3D(32879,0,be,Me.width,Me.height,Me.depth,0,de,J,Me.data);else{let Re=T(_,Me,G),Ve=a&&_.isVideoTexture!==!0,Mt=k.__version===void 0;if(Ee.length>0&&G){Ve&&Mt&&t.texStorage2D(3553,Re,be,Ee[0].width,Ee[0].height);for(let Ze=0,ii=Ee.length;Ze<ii;Ze++)ge=Ee[Ze],Ve?t.texSubImage2D(3553,Ze,0,0,de,J,ge):t.texImage2D(3553,Ze,be,de,J,ge);_.generateMipmaps=!1}else Ve?(Mt&&t.texStorage2D(3553,Re,be,Me.width,Me.height),t.texSubImage2D(3553,0,0,0,de,J,Me)):t.texImage2D(3553,0,be,de,J,Me)}D(_,G)&&R(ie),k.__version=_.version,_.onUpdate&&_.onUpdate(_)}function P(k,_,te){if(_.image.length!==6)return;Le(k,_),t.activeTexture(33984+te),t.bindTexture(34067,k.__webglTexture),r.pixelStorei(37440,_.flipY),r.pixelStorei(37441,_.premultiplyAlpha),r.pixelStorei(3317,_.unpackAlignment),r.pixelStorei(37443,0);let ie=_&&(_.isCompressedTexture||_.image[0].isCompressedTexture),Fe=_.image[0]&&_.image[0].isDataTexture,Me=[];for(let Re=0;Re<6;Re++)!ie&&!Fe?Me[Re]=m(_.image[Re],!1,!0,u):Me[Re]=Fe?_.image[Re].image:_.image[Re];let G=Me[0],de=b(G)||a,J=o.convert(_.format),be=o.convert(_.type),ge=L(_.internalFormat,J,be,_.encoding);pe(34067,_,de);let Ee;if(ie)for(let Re=0;Re<6;Re++){Ee=Me[Re].mipmaps;for(let Ve=0;Ve<Ee.length;Ve++){let Mt=Ee[Ve];_.format!==gn&&_.format!==ro?J!==null?t.compressedTexImage2D(34069+Re,Ve,ge,Mt.width,Mt.height,0,Mt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):t.texImage2D(34069+Re,Ve,ge,Mt.width,Mt.height,0,J,be,Mt.data)}}else{Ee=_.mipmaps;for(let Re=0;Re<6;Re++)if(Fe){t.texImage2D(34069+Re,0,ge,Me[Re].width,Me[Re].height,0,J,be,Me[Re].data);for(let Ve=0;Ve<Ee.length;Ve++){let Ze=Ee[Ve].image[Re].image;t.texImage2D(34069+Re,Ve+1,ge,Ze.width,Ze.height,0,J,be,Ze.data)}}else{t.texImage2D(34069+Re,0,ge,J,be,Me[Re]);for(let Ve=0;Ve<Ee.length;Ve++){let Mt=Ee[Ve];t.texImage2D(34069+Re,Ve+1,ge,J,be,Mt.image[Re])}}}D(_,de)&&R(34067),k.__version=_.version,_.onUpdate&&_.onUpdate(_)}function Z(k,_,te,ie,Fe){let Me=o.convert(te.format),G=o.convert(te.type),de=L(te.internalFormat,Me,G,te.encoding);n.get(_).__hasExternalTextures||(Fe===32879||Fe===35866?t.texImage3D(Fe,0,de,_.width,_.height,_.depth,0,Me,G,null):t.texImage2D(Fe,0,de,_.width,_.height,0,Me,G,null)),t.bindFramebuffer(36160,k),_.useRenderToTexture?p.framebufferTexture2DMultisampleEXT(36160,ie,Fe,n.get(te).__webglTexture,0,Se(_)):r.framebufferTexture2D(36160,ie,Fe,n.get(te).__webglTexture,0),t.bindFramebuffer(36160,null)}function ae(k,_,te){if(r.bindRenderbuffer(36161,k),_.depthBuffer&&!_.stencilBuffer){let ie=33189;if(te||_.useRenderToTexture){let Fe=_.depthTexture;Fe&&Fe.isDepthTexture&&(Fe.type===Qi?ie=36012:Fe.type===zu&&(ie=33190));let Me=Se(_);_.useRenderToTexture?p.renderbufferStorageMultisampleEXT(36161,Me,ie,_.width,_.height):r.renderbufferStorageMultisample(36161,Me,ie,_.width,_.height)}else r.renderbufferStorage(36161,ie,_.width,_.height);r.framebufferRenderbuffer(36160,36096,36161,k)}else if(_.depthBuffer&&_.stencilBuffer){let ie=Se(_);te&&_.useRenderbuffer?r.renderbufferStorageMultisample(36161,ie,35056,_.width,_.height):_.useRenderToTexture?p.renderbufferStorageMultisampleEXT(36161,ie,35056,_.width,_.height):r.renderbufferStorage(36161,34041,_.width,_.height),r.framebufferRenderbuffer(36160,33306,36161,k)}else{let ie=_.isWebGLMultipleRenderTargets===!0?_.texture[0]:_.texture,Fe=o.convert(ie.format),Me=o.convert(ie.type),G=L(ie.internalFormat,Fe,Me,ie.encoding),de=Se(_);te&&_.useRenderbuffer?r.renderbufferStorageMultisample(36161,de,G,_.width,_.height):_.useRenderToTexture?p.renderbufferStorageMultisampleEXT(36161,de,G,_.width,_.height):r.renderbufferStorage(36161,G,_.width,_.height)}r.bindRenderbuffer(36161,null)}function ne(k,_){if(_&&_.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,k),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(_.depthTexture).__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),q(_.depthTexture,0);let ie=n.get(_.depthTexture).__webglTexture,Fe=Se(_);if(_.depthTexture.format===oo)_.useRenderToTexture?p.framebufferTexture2DMultisampleEXT(36160,36096,3553,ie,0,Fe):r.framebufferTexture2D(36160,36096,3553,ie,0);else if(_.depthTexture.format===ss)_.useRenderToTexture?p.framebufferTexture2DMultisampleEXT(36160,33306,3553,ie,0,Fe):r.framebufferTexture2D(36160,33306,3553,ie,0);else throw new Error("Unknown depthTexture format")}function fe(k){let _=n.get(k),te=k.isWebGLCubeRenderTarget===!0;if(k.depthTexture&&!_.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");ne(_.__webglFramebuffer,k)}else if(te){_.__webglDepthbuffer=[];for(let ie=0;ie<6;ie++)t.bindFramebuffer(36160,_.__webglFramebuffer[ie]),_.__webglDepthbuffer[ie]=r.createRenderbuffer(),ae(_.__webglDepthbuffer[ie],k,!1)}else t.bindFramebuffer(36160,_.__webglFramebuffer),_.__webglDepthbuffer=r.createRenderbuffer(),ae(_.__webglDepthbuffer,k,!1);t.bindFramebuffer(36160,null)}function W(k,_,te){let ie=n.get(k);_!==void 0&&Z(ie.__webglFramebuffer,k,k.texture,36064,3553),te!==void 0&&fe(k)}function Q(k){let _=k.texture,te=n.get(k),ie=n.get(_);k.addEventListener("dispose",C),k.isWebGLMultipleRenderTargets!==!0&&(ie.__webglTexture===void 0&&(ie.__webglTexture=r.createTexture()),ie.__version=_.version,s.memory.textures++);let Fe=k.isWebGLCubeRenderTarget===!0,Me=k.isWebGLMultipleRenderTargets===!0,G=_.isDataTexture3D||_.isDataTexture2DArray,de=b(k)||a;if(a&&_.format===ro&&(_.type===Qi||_.type===rs)&&(_.format=gn,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),Fe){te.__webglFramebuffer=[];for(let J=0;J<6;J++)te.__webglFramebuffer[J]=r.createFramebuffer()}else if(te.__webglFramebuffer=r.createFramebuffer(),Me)if(i.drawBuffers){let J=k.texture;for(let be=0,ge=J.length;be<ge;be++){let Ee=n.get(J[be]);Ee.__webglTexture===void 0&&(Ee.__webglTexture=r.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(k.useRenderbuffer)if(a){te.__webglMultisampledFramebuffer=r.createFramebuffer(),te.__webglColorRenderbuffer=r.createRenderbuffer(),r.bindRenderbuffer(36161,te.__webglColorRenderbuffer);let J=o.convert(_.format),be=o.convert(_.type),ge=L(_.internalFormat,J,be,_.encoding),Ee=Se(k);r.renderbufferStorageMultisample(36161,Ee,ge,k.width,k.height),t.bindFramebuffer(36160,te.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(36160,36064,36161,te.__webglColorRenderbuffer),r.bindRenderbuffer(36161,null),k.depthBuffer&&(te.__webglDepthRenderbuffer=r.createRenderbuffer(),ae(te.__webglDepthRenderbuffer,k,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(Fe){t.bindTexture(34067,ie.__webglTexture),pe(34067,_,de);for(let J=0;J<6;J++)Z(te.__webglFramebuffer[J],k,_,36064,34069+J);D(_,de)&&R(34067),t.unbindTexture()}else if(Me){let J=k.texture;for(let be=0,ge=J.length;be<ge;be++){let Ee=J[be],Re=n.get(Ee);t.bindTexture(3553,Re.__webglTexture),pe(3553,Ee,de),Z(te.__webglFramebuffer,k,Ee,36064+be,3553),D(Ee,de)&&R(3553)}t.unbindTexture()}else{let J=3553;G&&(a?J=_.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(J,ie.__webglTexture),pe(J,_,de),Z(te.__webglFramebuffer,k,_,36064,J),D(_,de)&&R(J),t.unbindTexture()}k.depthBuffer&&fe(k)}function le(k){let _=b(k)||a,te=k.isWebGLMultipleRenderTargets===!0?k.texture:[k.texture];for(let ie=0,Fe=te.length;ie<Fe;ie++){let Me=te[ie];if(D(Me,_)){let G=k.isWebGLCubeRenderTarget?34067:3553,de=n.get(Me).__webglTexture;t.bindTexture(G,de),R(G),t.unbindTexture()}}}function ue(k){if(k.useRenderbuffer)if(a){let _=k.width,te=k.height,ie=16384,Fe=[36064],Me=k.stencilBuffer?33306:36096;k.depthBuffer&&Fe.push(Me),k.ignoreDepthForMultisampleCopy||(k.depthBuffer&&(ie|=256),k.stencilBuffer&&(ie|=1024));let G=n.get(k);t.bindFramebuffer(36008,G.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,G.__webglFramebuffer),k.ignoreDepthForMultisampleCopy&&(r.invalidateFramebuffer(36008,[Me]),r.invalidateFramebuffer(36009,[Me])),r.blitFramebuffer(0,0,_,te,0,0,_,te,ie,9728),r.invalidateFramebuffer(36008,Fe),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,G.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function Se(k){return a&&(k.useRenderbuffer||k.useRenderToTexture)?Math.min(f,k.samples):0}function ce(k){let _=s.render.frame;d.get(k)!==_&&(d.set(k,_),k.update())}let Ue=!1,We=!1;function nt(k,_){k&&k.isWebGLRenderTarget&&(Ue===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Ue=!0),k=k.texture),q(k,_)}function Et(k,_){k&&k.isWebGLCubeRenderTarget&&(We===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),We=!0),k=k.texture),Y(k,_)}this.allocateTextureUnit=V,this.resetTextureUnits=O,this.setTexture2D=q,this.setTexture2DArray=se,this.setTexture3D=he,this.setTextureCube=Y,this.rebindTextures=W,this.setupRenderTarget=Q,this.updateRenderTargetMipmap=le,this.updateMultisampleRenderTarget=ue,this.setupDepthRenderbuffer=fe,this.setupFrameBufferTexture=Z,this.safeSetTexture2D=nt,this.safeSetTextureCube=Et}function X3(r,e,t){let n=t.isWebGL2;function i(o){let s;if(o===mr)return 5121;if(o===tb)return 32819;if(o===nb)return 32820;if(o===ib)return 33635;if(o===Jw)return 5120;if(o===$w)return 5122;if(o===Ra)return 5123;if(o===eb)return 5124;if(o===zu)return 5125;if(o===Qi)return 5126;if(o===rs)return n?5131:(s=e.get("OES_texture_half_float"),s!==null?s.HALF_FLOAT_OES:null);if(o===rb)return 6406;if(o===ro)return 6407;if(o===gn)return 6408;if(o===ob)return 6409;if(o===sb)return 6410;if(o===oo)return 6402;if(o===ss)return 34041;if(o===lb)return 6403;if(o===ub)return 36244;if(o===cb)return 33319;if(o===hb)return 33320;if(o===fb)return 36248;if(o===pb)return 36249;if(o===j0||o===Q0||o===Y0||o===X0)if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(o===j0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(o===Q0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(o===Y0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(o===X0)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(o===K0||o===Z0||o===J0||o===$0)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(o===K0)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(o===Z0)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(o===J0)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(o===$0)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(o===db)return s=e.get("WEBGL_compressed_texture_etc1"),s!==null?s.COMPRESSED_RGB_ETC1_WEBGL:null;if((o===eg||o===tg)&&(s=e.get("WEBGL_compressed_texture_etc"),s!==null)){if(o===eg)return s.COMPRESSED_RGB8_ETC2;if(o===tg)return s.COMPRESSED_RGBA8_ETC2_EAC}if(o===mb||o===gb||o===yb||o===vb||o===xb||o===wb||o===bb||o===Sb||o===Lb||o===Ab||o===Db||o===Eb||o===Mb||o===Rb||o===Fb||o===_b||o===Cb||o===Pb||o===kb||o===Bb||o===zb||o===Ib||o===Ub||o===Nb||o===Ob||o===Gb||o===Wb||o===Vb)return s=e.get("WEBGL_compressed_texture_astc"),s!==null?o:null;if(o===Tb)return s=e.get("EXT_texture_compression_bptc"),s!==null?o:null;if(o===os)return n?34042:(s=e.get("WEBGL_depth_texture"),s!==null?s.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}function Y4(r){function e(y,m){y.fogColor.value.copy(m.color),m.isFog?(y.fogNear.value=m.near,y.fogFar.value=m.far):m.isFogExp2&&(y.fogDensity.value=m.density)}function t(y,m,b,w,D){m.isMeshBasicMaterial?n(y,m):m.isMeshLambertMaterial?(n(y,m),l(y,m)):m.isMeshToonMaterial?(n(y,m),c(y,m)):m.isMeshPhongMaterial?(n(y,m),u(y,m)):m.isMeshStandardMaterial?(n(y,m),m.isMeshPhysicalMaterial?h(y,m,D):f(y,m)):m.isMeshMatcapMaterial?(n(y,m),p(y,m)):m.isMeshDepthMaterial?(n(y,m),d(y,m)):m.isMeshDistanceMaterial?(n(y,m),g(y,m)):m.isMeshNormalMaterial?(n(y,m),x(y,m)):m.isLineBasicMaterial?(i(y,m),m.isLineDashedMaterial&&o(y,m)):m.isPointsMaterial?s(y,m,b,w):m.isSpriteMaterial?a(y,m):m.isShadowMaterial?(y.color.value.copy(m.color),y.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function n(y,m){y.opacity.value=m.opacity,m.color&&y.diffuse.value.copy(m.color),m.emissive&&y.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(y.map.value=m.map),m.alphaMap&&(y.alphaMap.value=m.alphaMap),m.specularMap&&(y.specularMap.value=m.specularMap),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest);let b=r.get(m).envMap;b&&(y.envMap.value=b,y.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=m.reflectivity,y.ior.value=m.ior,y.refractionRatio.value=m.refractionRatio),m.lightMap&&(y.lightMap.value=m.lightMap,y.lightMapIntensity.value=m.lightMapIntensity),m.aoMap&&(y.aoMap.value=m.aoMap,y.aoMapIntensity.value=m.aoMapIntensity);let w;m.map?w=m.map:m.specularMap?w=m.specularMap:m.displacementMap?w=m.displacementMap:m.normalMap?w=m.normalMap:m.bumpMap?w=m.bumpMap:m.roughnessMap?w=m.roughnessMap:m.metalnessMap?w=m.metalnessMap:m.alphaMap?w=m.alphaMap:m.emissiveMap?w=m.emissiveMap:m.clearcoatMap?w=m.clearcoatMap:m.clearcoatNormalMap?w=m.clearcoatNormalMap:m.clearcoatRoughnessMap?w=m.clearcoatRoughnessMap:m.specularIntensityMap?w=m.specularIntensityMap:m.specularColorMap?w=m.specularColorMap:m.transmissionMap?w=m.transmissionMap:m.thicknessMap?w=m.thicknessMap:m.sheenColorMap?w=m.sheenColorMap:m.sheenRoughnessMap&&(w=m.sheenRoughnessMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),y.uvTransform.value.copy(w.matrix));let D;m.aoMap?D=m.aoMap:m.lightMap&&(D=m.lightMap),D!==void 0&&(D.isWebGLRenderTarget&&(D=D.texture),D.matrixAutoUpdate===!0&&D.updateMatrix(),y.uv2Transform.value.copy(D.matrix))}function i(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity}function o(y,m){y.dashSize.value=m.dashSize,y.totalSize.value=m.dashSize+m.gapSize,y.scale.value=m.scale}function s(y,m,b,w){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.size.value=m.size*b,y.scale.value=w*.5,m.map&&(y.map.value=m.map),m.alphaMap&&(y.alphaMap.value=m.alphaMap),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest);let D;m.map?D=m.map:m.alphaMap&&(D=m.alphaMap),D!==void 0&&(D.matrixAutoUpdate===!0&&D.updateMatrix(),y.uvTransform.value.copy(D.matrix))}function a(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.rotation.value=m.rotation,m.map&&(y.map.value=m.map),m.alphaMap&&(y.alphaMap.value=m.alphaMap),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest);let b;m.map?b=m.map:m.alphaMap&&(b=m.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),y.uvTransform.value.copy(b.matrix))}function l(y,m){m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap)}function u(y,m){y.specular.value.copy(m.specular),y.shininess.value=Math.max(m.shininess,1e-4),m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function c(y,m){m.gradientMap&&(y.gradientMap.value=m.gradientMap),m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function f(y,m){y.roughness.value=m.roughness,y.metalness.value=m.metalness,m.roughnessMap&&(y.roughnessMap.value=m.roughnessMap),m.metalnessMap&&(y.metalnessMap.value=m.metalnessMap),m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias),r.get(m).envMap&&(y.envMapIntensity.value=m.envMapIntensity)}function h(y,m,b){f(y,m),y.ior.value=m.ior,m.sheen>0&&(y.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),y.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(y.sheenColorMap.value=m.sheenColorMap),m.sheenRoughnessMap&&(y.sheenRoughnessMap.value=m.sheenRoughnessMap)),m.clearcoat>0&&(y.clearcoat.value=m.clearcoat,y.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(y.clearcoatMap.value=m.clearcoatMap),m.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap),m.clearcoatNormalMap&&(y.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),y.clearcoatNormalMap.value=m.clearcoatNormalMap,m.side===At&&y.clearcoatNormalScale.value.negate())),m.transmission>0&&(y.transmission.value=m.transmission,y.transmissionSamplerMap.value=b.texture,y.transmissionSamplerSize.value.set(b.width,b.height),m.transmissionMap&&(y.transmissionMap.value=m.transmissionMap),y.thickness.value=m.thickness,m.thicknessMap&&(y.thicknessMap.value=m.thicknessMap),y.attenuationDistance.value=m.attenuationDistance,y.attenuationColor.value.copy(m.attenuationColor)),y.specularIntensity.value=m.specularIntensity,y.specularColor.value.copy(m.specularColor),m.specularIntensityMap&&(y.specularIntensityMap.value=m.specularIntensityMap),m.specularColorMap&&(y.specularColorMap.value=m.specularColorMap)}function p(y,m){m.matcap&&(y.matcap.value=m.matcap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function d(y,m){m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function g(y,m){m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias),y.referencePosition.value.copy(m.referencePosition),y.nearDistance.value=m.nearDistance,y.farDistance.value=m.farDistance}function x(y,m){m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===At&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===At&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function X4(){let r=Ff("canvas");return r.style.display="block",r}function ft(r={}){let e=r.canvas!==void 0?r.canvas:X4(),t=r.context!==void 0?r.context:null,n=r.alpha!==void 0?r.alpha:!1,i=r.depth!==void 0?r.depth:!0,o=r.stencil!==void 0?r.stencil:!0,s=r.antialias!==void 0?r.antialias:!1,a=r.premultipliedAlpha!==void 0?r.premultipliedAlpha:!0,l=r.preserveDrawingBuffer!==void 0?r.preserveDrawingBuffer:!1,u=r.powerPreference!==void 0?r.powerPreference:"default",c=r.failIfMajorPerformanceCaveat!==void 0?r.failIfMajorPerformanceCaveat:!1,f=null,h=null,p=[],d=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Pn,this.physicallyCorrectLights=!1,this.toneMapping=io,this.toneMappingExposure=1;let g=this,x=!1,y=0,m=0,b=null,w=-1,D=null,R=new xt,L=new xt,T=null,U=e.width,F=e.height,C=1,j=null,B=null,z=new xt(0,0,U,F),O=new xt(0,0,U,F),V=!1,q=[],se=new Qa,he=!1,Y=!1,X=null,ve=new Ae,pe=new M,Le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ie(){return b===null?C:1}let P=t;function Z(v,A){for(let I=0;I<v.length;I++){let N=v[I],K=e.getContext(N,A);if(K!==null)return K}return null}try{let v={alpha:n,depth:i,stencil:o,antialias:s,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${xf}`),e.addEventListener("webglcontextlost",Re,!1),e.addEventListener("webglcontextrestored",Ve,!1),P===null){let A=["webgl2","webgl","experimental-webgl"];if(g.isWebGL1Renderer===!0&&A.shift(),P=Z(A,v),P===null)throw Z(A)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}P.getShaderPrecisionFormat===void 0&&(P.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(v){throw console.error("THREE.WebGLRenderer: "+v.message),v}let ae,ne,fe,W,Q,le,ue,Se,ce,Ue,We,nt,Et,k,_,te,ie,Fe,Me,G,de,J,be;function ge(){ae=new w5(P),ne=new p5(P,ae,r),ae.init(ne),J=new X3(P,ae,ne),fe=new q4(P,ae,ne),q[0]=1029,W=new L5(P),Q=new k4,le=new j4(P,ae,fe,Q,ne,J,W),ue=new m5(g),Se=new x5(g),ce=new IR(P,ne),be=new h5(P,ae,ce,ne),Ue=new b5(P,ce,W,be),We=new M5(P,Ue,ce,W),Me=new E5(P,ne,le),te=new d5(Q),nt=new P4(g,ue,Se,ae,ne,be,te),Et=new Y4(Q),k=new z4(Q),_=new W4(ae,ne),Fe=new c5(g,ue,fe,We,a),ie=new Y3(g,We,ne),G=new f5(P,ae,W,ne),de=new S5(P,ae,W,ne),W.programs=nt.programs,g.capabilities=ne,g.extensions=ae,g.properties=Q,g.renderLists=k,g.shadowMap=ie,g.state=fe,g.info=W}ge();let Ee=new K3(g,P);this.xr=Ee,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let v=ae.get("WEBGL_lose_context");v&&v.loseContext()},this.forceContextRestore=function(){let v=ae.get("WEBGL_lose_context");v&&v.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(v){v!==void 0&&(C=v,this.setSize(U,F,!1))},this.getSize=function(v){return v.set(U,F)},this.setSize=function(v,A,I){if(Ee.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}U=v,F=A,e.width=Math.floor(v*C),e.height=Math.floor(A*C),I!==!1&&(e.style.width=v+"px",e.style.height=A+"px"),this.setViewport(0,0,v,A)},this.getDrawingBufferSize=function(v){return v.set(U*C,F*C).floor()},this.setDrawingBufferSize=function(v,A,I){U=v,F=A,C=I,e.width=Math.floor(v*I),e.height=Math.floor(A*I),this.setViewport(0,0,v,A)},this.getCurrentViewport=function(v){return v.copy(R)},this.getViewport=function(v){return v.copy(z)},this.setViewport=function(v,A,I,N){v.isVector4?z.set(v.x,v.y,v.z,v.w):z.set(v,A,I,N),fe.viewport(R.copy(z).multiplyScalar(C).floor())},this.getScissor=function(v){return v.copy(O)},this.setScissor=function(v,A,I,N){v.isVector4?O.set(v.x,v.y,v.z,v.w):O.set(v,A,I,N),fe.scissor(L.copy(O).multiplyScalar(C).floor())},this.getScissorTest=function(){return V},this.setScissorTest=function(v){fe.setScissorTest(V=v)},this.setOpaqueSort=function(v){j=v},this.setTransparentSort=function(v){B=v},this.getClearColor=function(v){return v.copy(Fe.getClearColor())},this.setClearColor=function(){Fe.setClearColor.apply(Fe,arguments)},this.getClearAlpha=function(){return Fe.getClearAlpha()},this.setClearAlpha=function(){Fe.setClearAlpha.apply(Fe,arguments)},this.clear=function(v,A,I){let N=0;(v===void 0||v)&&(N|=16384),(A===void 0||A)&&(N|=256),(I===void 0||I)&&(N|=1024),P.clear(N)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Re,!1),e.removeEventListener("webglcontextrestored",Ve,!1),k.dispose(),_.dispose(),Q.dispose(),ue.dispose(),Se.dispose(),We.dispose(),be.dispose(),Ee.dispose(),Ee.removeEventListener("sessionstart",ci),Ee.removeEventListener("sessionend",No),X&&(X.dispose(),X=null),lr.stop()};function Re(v){v.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function Ve(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;let v=W.autoReset,A=ie.enabled,I=ie.autoUpdate,N=ie.needsUpdate,K=ie.type;ge(),W.autoReset=v,ie.enabled=A,ie.autoUpdate=I,ie.needsUpdate=N,ie.type=K}function Mt(v){let A=v.target;A.removeEventListener("dispose",Mt),Ze(A)}function Ze(v){ii(v),Q.remove(v)}function ii(v){let A=Q.get(v).programs;A!==void 0&&A.forEach(function(I){nt.releaseProgram(I)})}this.renderBufferDirect=function(v,A,I,N,K,De){A===null&&(A=Le);let _e=K.isMesh&&K.matrixWorld.determinant()<0,ke=Nm(v,A,I,N,K);fe.setMaterial(N,_e);let Be=I.index,ht=I.attributes.position;if(Be===null){if(ht===void 0||ht.count===0)return}else if(Be.count===0)return;let Je=1;N.wireframe===!0&&(Be=Ue.getWireframeAttribute(I),Je=2),be.setup(K,N,ke,I,Be);let lt,Bt=G;Be!==null&&(lt=ce.get(Be),Bt=de,Bt.setIndex(lt));let Oo=Be!==null?Be.count:ht.count,yt=I.drawRange.start*Je,su=I.drawRange.count*Je,Ft=De!==null?De.start*Je:0,Go=De!==null?De.count*Je:1/0,Wo=Math.max(yt,Ft),Vo=Math.min(Oo,yt+su,Ft+Go)-1,Qr=Math.max(0,Vo-Wo+1);if(Qr!==0){if(K.isMesh)N.wireframe===!0?(fe.setLineWidth(N.wireframeLinewidth*Ie()),Bt.setMode(1)):Bt.setMode(4);else if(K.isLine){let zt=N.linewidth;zt===void 0&&(zt=1),fe.setLineWidth(zt*Ie()),K.isLineSegments?Bt.setMode(1):K.isLineLoop?Bt.setMode(2):Bt.setMode(3)}else K.isPoints?Bt.setMode(0):K.isSprite&&Bt.setMode(4);if(K.isInstancedMesh)Bt.renderInstances(Wo,Qr,K.count);else if(I.isInstancedBufferGeometry){let zt=Math.min(I.instanceCount,I._maxInstanceCount);Bt.renderInstances(Wo,Qr,zt)}else Bt.render(Wo,Qr)}},this.compile=function(v,A){h=_.get(v),h.init(),d.push(h),v.traverseVisible(function(I){I.isLight&&I.layers.test(A.layers)&&(h.pushLight(I),I.castShadow&&h.pushShadow(I))}),h.setupLights(g.physicallyCorrectLights),v.traverse(function(I){let N=I.material;if(N)if(Array.isArray(N))for(let K=0;K<N.length;K++){let De=N[K];oa(De,v,I)}else oa(N,v,I)}),d.pop(),h=null};let Nn=null;function _h(v){Nn&&Nn(v)}function ci(){lr.stop()}function No(){lr.start()}let lr=new m3;lr.setAnimationLoop(_h),typeof window!="undefined"&&lr.setContext(window),this.setAnimationLoop=function(v){Nn=v,Ee.setAnimationLoop(v),v===null?lr.stop():lr.start()},Ee.addEventListener("sessionstart",ci),Ee.addEventListener("sessionend",No),this.render=function(v,A){if(A!==void 0&&A.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;v.autoUpdate===!0&&v.updateMatrixWorld(),A.parent===null&&A.updateMatrixWorld(),Ee.enabled===!0&&Ee.isPresenting===!0&&(Ee.cameraAutoUpdate===!0&&Ee.updateCamera(A),A=Ee.getCamera()),v.isScene===!0&&v.onBeforeRender(g,v,A,b),h=_.get(v,d.length),h.init(),d.push(h),ve.multiplyMatrices(A.projectionMatrix,A.matrixWorldInverse),se.setFromProjectionMatrix(ve),Y=this.localClippingEnabled,he=te.init(this.clippingPlanes,Y,A),f=k.get(v,p.length),f.init(),p.push(f),ra(v,A,0,g.sortObjects),f.finish(),g.sortObjects===!0&&f.sort(j,B),he===!0&&te.beginShadows();let I=h.state.shadowsArray;if(ie.render(I,v,A),he===!0&&te.endShadows(),this.info.autoReset===!0&&this.info.reset(),Fe.render(f,v),h.setupLights(g.physicallyCorrectLights),A.isArrayCamera){let N=A.cameras;for(let K=0,De=N.length;K<De;K++){let _e=N[K];ru(f,v,_e,_e.viewport)}}else ru(f,v,A);b!==null&&(le.updateMultisampleRenderTarget(b),le.updateRenderTargetMipmap(b)),v.isScene===!0&&v.onAfterRender(g,v,A),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1),be.resetDefaultState(),w=-1,D=null,d.pop(),d.length>0?h=d[d.length-1]:h=null,p.pop(),p.length>0?f=p[p.length-1]:f=null};function ra(v,A,I,N){if(v.visible===!1)return;if(v.layers.test(A.layers)){if(v.isGroup)I=v.renderOrder;else if(v.isLOD)v.autoUpdate===!0&&v.update(A);else if(v.isLight)h.pushLight(v),v.castShadow&&h.pushShadow(v);else if(v.isSprite){if(!v.frustumCulled||se.intersectsSprite(v)){N&&pe.setFromMatrixPosition(v.matrixWorld).applyMatrix4(ve);let _e=We.update(v),ke=v.material;ke.visible&&f.push(v,_e,ke,I,pe.z,null)}}else if((v.isMesh||v.isLine||v.isPoints)&&(v.isSkinnedMesh&&v.skeleton.frame!==W.render.frame&&(v.skeleton.update(),v.skeleton.frame=W.render.frame),!v.frustumCulled||se.intersectsObject(v))){N&&pe.setFromMatrixPosition(v.matrixWorld).applyMatrix4(ve);let _e=We.update(v),ke=v.material;if(Array.isArray(ke)){let Be=_e.groups;for(let ht=0,Je=Be.length;ht<Je;ht++){let lt=Be[ht],Bt=ke[lt.materialIndex];Bt&&Bt.visible&&f.push(v,_e,Bt,I,pe.z,lt)}}else ke.visible&&f.push(v,_e,ke,I,pe.z,null)}}let De=v.children;for(let _e=0,ke=De.length;_e<ke;_e++)ra(De[_e],A,I,N)}function ru(v,A,I,N){let K=v.opaque,De=v.transmissive,_e=v.transparent;h.setupLightsView(I),De.length>0&&Ch(K,A,I),N&&fe.viewport(R.copy(N)),K.length>0&&jr(K,A,I),De.length>0&&jr(De,A,I),_e.length>0&&jr(_e,A,I)}function Ch(v,A,I){if(X===null){let _e=s===!0&&ne.isWebGL2===!0?Vu:Qn;X=new _e(1024,1024,{generateMipmaps:!0,type:J.convert(rs)!==null?rs:mr,minFilter:is,magFilter:jt,wrapS:mn,wrapT:mn,useRenderToTexture:ae.has("WEBGL_multisampled_render_to_texture")})}let N=g.getRenderTarget();g.setRenderTarget(X),g.clear();let K=g.toneMapping;g.toneMapping=io,jr(v,A,I),g.toneMapping=K,le.updateMultisampleRenderTarget(X),le.updateRenderTargetMipmap(X),g.setRenderTarget(N)}function jr(v,A,I){let N=A.isScene===!0?A.overrideMaterial:null;for(let K=0,De=v.length;K<De;K++){let _e=v[K],ke=_e.object,Be=_e.geometry,ht=N===null?_e.material:N,Je=_e.group;ke.layers.test(I.layers)&&Um(ke,A,I,Be,ht,Je)}}function Um(v,A,I,N,K,De){v.onBeforeRender(g,A,I,N,K,De),v.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,v.matrixWorld),v.normalMatrix.getNormalMatrix(v.modelViewMatrix),K.onBeforeRender(g,A,I,N,v,De),K.transparent===!0&&K.side===jn?(K.side=At,K.needsUpdate=!0,g.renderBufferDirect(I,A,N,K,v,De),K.side=ji,K.needsUpdate=!0,g.renderBufferDirect(I,A,N,K,v,De),K.side=jn):g.renderBufferDirect(I,A,N,K,v,De),v.onAfterRender(g,A,I,N,K,De)}function oa(v,A,I){A.isScene!==!0&&(A=Le);let N=Q.get(v),K=h.state.lights,De=h.state.shadowsArray,_e=K.state.version,ke=nt.getParameters(v,K.state,De,A,I),Be=nt.getProgramCacheKey(ke),ht=N.programs;N.environment=v.isMeshStandardMaterial?A.environment:null,N.fog=A.fog,N.envMap=(v.isMeshStandardMaterial?Se:ue).get(v.envMap||N.environment),ht===void 0&&(v.addEventListener("dispose",Mt),ht=new Map,N.programs=ht);let Je=ht.get(Be);if(Je!==void 0){if(N.currentProgram===Je&&N.lightsStateVersion===_e)return ou(v,ke),Je}else ke.uniforms=nt.getUniforms(v),v.onBuild(I,ke,g),v.onBeforeCompile(ke,g),Je=nt.acquireProgram(ke,Be),ht.set(Be,Je),N.uniforms=ke.uniforms;let lt=N.uniforms;(!v.isShaderMaterial&&!v.isRawShaderMaterial||v.clipping===!0)&&(lt.clippingPlanes=te.uniform),ou(v,ke),N.needsLights=Gm(v),N.lightsStateVersion=_e,N.needsLights&&(lt.ambientLightColor.value=K.state.ambient,lt.lightProbe.value=K.state.probe,lt.directionalLights.value=K.state.directional,lt.directionalLightShadows.value=K.state.directionalShadow,lt.spotLights.value=K.state.spot,lt.spotLightShadows.value=K.state.spotShadow,lt.rectAreaLights.value=K.state.rectArea,lt.ltc_1.value=K.state.rectAreaLTC1,lt.ltc_2.value=K.state.rectAreaLTC2,lt.pointLights.value=K.state.point,lt.pointLightShadows.value=K.state.pointShadow,lt.hemisphereLights.value=K.state.hemi,lt.directionalShadowMap.value=K.state.directionalShadowMap,lt.directionalShadowMatrix.value=K.state.directionalShadowMatrix,lt.spotShadowMap.value=K.state.spotShadowMap,lt.spotShadowMatrix.value=K.state.spotShadowMatrix,lt.pointShadowMap.value=K.state.pointShadowMap,lt.pointShadowMatrix.value=K.state.pointShadowMatrix);let Bt=Je.getUniforms(),Oo=go.seqWithValue(Bt.seq,lt);return N.currentProgram=Je,N.uniformsList=Oo,Je}function ou(v,A){let I=Q.get(v);I.outputEncoding=A.outputEncoding,I.instancing=A.instancing,I.skinning=A.skinning,I.morphTargets=A.morphTargets,I.morphNormals=A.morphNormals,I.morphTargetsCount=A.morphTargetsCount,I.numClippingPlanes=A.numClippingPlanes,I.numIntersection=A.numClipIntersection,I.vertexAlphas=A.vertexAlphas,I.vertexTangents=A.vertexTangents}function Nm(v,A,I,N,K){A.isScene!==!0&&(A=Le),le.resetTextureUnits();let De=A.fog,_e=N.isMeshStandardMaterial?A.environment:null,ke=b===null?g.outputEncoding:b.texture.encoding,Be=(N.isMeshStandardMaterial?Se:ue).get(N.envMap||_e),ht=N.vertexColors===!0&&!!I.attributes.color&&I.attributes.color.itemSize===4,Je=!!N.normalMap&&!!I.attributes.tangent,lt=!!I.morphAttributes.position,Bt=!!I.morphAttributes.normal,Oo=I.morphAttributes.position?I.morphAttributes.position.length:0,yt=Q.get(N),su=h.state.lights;if(he===!0&&(Y===!0||v!==D)){let bi=v===D&&N.id===w;te.setState(N,v,bi)}let Ft=!1;N.version===yt.__version?(yt.needsLights&&yt.lightsStateVersion!==su.state.version||yt.outputEncoding!==ke||K.isInstancedMesh&&yt.instancing===!1||!K.isInstancedMesh&&yt.instancing===!0||K.isSkinnedMesh&&yt.skinning===!1||!K.isSkinnedMesh&&yt.skinning===!0||yt.envMap!==Be||N.fog&&yt.fog!==De||yt.numClippingPlanes!==void 0&&(yt.numClippingPlanes!==te.numPlanes||yt.numIntersection!==te.numIntersection)||yt.vertexAlphas!==ht||yt.vertexTangents!==Je||yt.morphTargets!==lt||yt.morphNormals!==Bt||ne.isWebGL2===!0&&yt.morphTargetsCount!==Oo)&&(Ft=!0):(Ft=!0,yt.__version=N.version);let Go=yt.currentProgram;Ft===!0&&(Go=oa(N,A,K));let Wo=!1,Vo=!1,Qr=!1,zt=Go.getUniforms(),au=yt.uniforms;if(fe.useProgram(Go.program)&&(Wo=!0,Vo=!0,Qr=!0),N.id!==w&&(w=N.id,Vo=!0),Wo||D!==v){if(zt.setValue(P,"projectionMatrix",v.projectionMatrix),ne.logarithmicDepthBuffer&&zt.setValue(P,"logDepthBufFC",2/(Math.log(v.far+1)/Math.LN2)),D!==v&&(D=v,Vo=!0,Qr=!0),N.isShaderMaterial||N.isMeshPhongMaterial||N.isMeshToonMaterial||N.isMeshStandardMaterial||N.envMap){let bi=zt.map.cameraPosition;bi!==void 0&&bi.setValue(P,pe.setFromMatrixPosition(v.matrixWorld))}(N.isMeshPhongMaterial||N.isMeshToonMaterial||N.isMeshLambertMaterial||N.isMeshBasicMaterial||N.isMeshStandardMaterial||N.isShaderMaterial)&&zt.setValue(P,"isOrthographic",v.isOrthographicCamera===!0),(N.isMeshPhongMaterial||N.isMeshToonMaterial||N.isMeshLambertMaterial||N.isMeshBasicMaterial||N.isMeshStandardMaterial||N.isShaderMaterial||N.isShadowMaterial||K.isSkinnedMesh)&&zt.setValue(P,"viewMatrix",v.matrixWorldInverse)}if(K.isSkinnedMesh){zt.setOptional(P,K,"bindMatrix"),zt.setOptional(P,K,"bindMatrixInverse");let bi=K.skeleton;bi&&(ne.floatVertexTextures?(bi.boneTexture===null&&bi.computeBoneTexture(),zt.setValue(P,"boneTexture",bi.boneTexture,le),zt.setValue(P,"boneTextureSize",bi.boneTextureSize)):zt.setOptional(P,bi,"boneMatrices"))}return!!I&&(I.morphAttributes.position!==void 0||I.morphAttributes.normal!==void 0)&&Me.update(K,I,N,Go),(Vo||yt.receiveShadow!==K.receiveShadow)&&(yt.receiveShadow=K.receiveShadow,zt.setValue(P,"receiveShadow",K.receiveShadow)),Vo&&(zt.setValue(P,"toneMappingExposure",g.toneMappingExposure),yt.needsLights&&Om(au,Qr),De&&N.fog&&Et.refreshFogUniforms(au,De),Et.refreshMaterialUniforms(au,N,C,F,X),go.upload(P,yt.uniformsList,au,le)),N.isShaderMaterial&&N.uniformsNeedUpdate===!0&&(go.upload(P,yt.uniformsList,au,le),N.uniformsNeedUpdate=!1),N.isSpriteMaterial&&zt.setValue(P,"center",K.center),zt.setValue(P,"modelViewMatrix",K.modelViewMatrix),zt.setValue(P,"normalMatrix",K.normalMatrix),zt.setValue(P,"modelMatrix",K.matrixWorld),Go}function Om(v,A){v.ambientLightColor.needsUpdate=A,v.lightProbe.needsUpdate=A,v.directionalLights.needsUpdate=A,v.directionalLightShadows.needsUpdate=A,v.pointLights.needsUpdate=A,v.pointLightShadows.needsUpdate=A,v.spotLights.needsUpdate=A,v.spotLightShadows.needsUpdate=A,v.rectAreaLights.needsUpdate=A,v.hemisphereLights.needsUpdate=A}function Gm(v){return v.isMeshLambertMaterial||v.isMeshToonMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isShadowMaterial||v.isShaderMaterial&&v.lights===!0}this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return m},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(v,A,I){Q.get(v.texture).__webglTexture=A,Q.get(v.depthTexture).__webglTexture=I;let N=Q.get(v);N.__hasExternalTextures=!0,N.__hasExternalTextures&&(N.__autoAllocateDepthBuffer=I===void 0,N.__autoAllocateDepthBuffer||v.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),v.useRenderToTexture=!1,v.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(v,A){let I=Q.get(v);I.__webglFramebuffer=A,I.__useDefaultFramebuffer=A===void 0},this.setRenderTarget=function(v,A=0,I=0){b=v,y=A,m=I;let N=!0;if(v){let Be=Q.get(v);Be.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(36160,null),N=!1):Be.__webglFramebuffer===void 0?le.setupRenderTarget(v):Be.__hasExternalTextures&&le.rebindTextures(v,Q.get(v.texture).__webglTexture,Q.get(v.depthTexture).__webglTexture)}let K=null,De=!1,_e=!1;if(v){let Be=v.texture;(Be.isDataTexture3D||Be.isDataTexture2DArray)&&(_e=!0);let ht=Q.get(v).__webglFramebuffer;v.isWebGLCubeRenderTarget?(K=ht[A],De=!0):v.useRenderbuffer?K=Q.get(v).__webglMultisampledFramebuffer:K=ht,R.copy(v.viewport),L.copy(v.scissor),T=v.scissorTest}else R.copy(z).multiplyScalar(C).floor(),L.copy(O).multiplyScalar(C).floor(),T=V;if(fe.bindFramebuffer(36160,K)&&ne.drawBuffers&&N){let Be=!1;if(v)if(v.isWebGLMultipleRenderTargets){let ht=v.texture;if(q.length!==ht.length||q[0]!==36064){for(let Je=0,lt=ht.length;Je<lt;Je++)q[Je]=36064+Je;q.length=ht.length,Be=!0}}else(q.length!==1||q[0]!==36064)&&(q[0]=36064,q.length=1,Be=!0);else(q.length!==1||q[0]!==1029)&&(q[0]=1029,q.length=1,Be=!0);Be&&(ne.isWebGL2?P.drawBuffers(q):ae.get("WEBGL_draw_buffers").drawBuffersWEBGL(q))}if(fe.viewport(R),fe.scissor(L),fe.setScissorTest(T),De){let Be=Q.get(v.texture);P.framebufferTexture2D(36160,36064,34069+A,Be.__webglTexture,I)}else if(_e){let Be=Q.get(v.texture),ht=A||0;P.framebufferTextureLayer(36160,36064,Be.__webglTexture,I||0,ht)}w=-1},this.readRenderTargetPixels=function(v,A,I,N,K,De,_e){if(!(v&&v.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ke=Q.get(v).__webglFramebuffer;if(v.isWebGLCubeRenderTarget&&_e!==void 0&&(ke=ke[_e]),ke){fe.bindFramebuffer(36160,ke);try{let Be=v.texture,ht=Be.format,Je=Be.type;if(ht!==gn&&J.convert(ht)!==P.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let lt=Je===rs&&(ae.has("EXT_color_buffer_half_float")||ne.isWebGL2&&ae.has("EXT_color_buffer_float"));if(Je!==mr&&J.convert(Je)!==P.getParameter(35738)&&!(Je===Qi&&(ne.isWebGL2||ae.has("OES_texture_float")||ae.has("WEBGL_color_buffer_float")))&&!lt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}P.checkFramebufferStatus(36160)===36053?A>=0&&A<=v.width-N&&I>=0&&I<=v.height-K&&P.readPixels(A,I,N,K,J.convert(ht),J.convert(Je),De):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{let Be=b!==null?Q.get(b).__webglFramebuffer:null;fe.bindFramebuffer(36160,Be)}}},this.copyFramebufferToTexture=function(v,A,I=0){let N=Math.pow(2,-I),K=Math.floor(A.image.width*N),De=Math.floor(A.image.height*N),_e=J.convert(A.format);ne.isWebGL2&&(_e===6407&&(_e=32849),_e===6408&&(_e=32856)),le.setTexture2D(A,0),P.copyTexImage2D(3553,I,_e,v.x,v.y,K,De,0),fe.unbindTexture()},this.copyTextureToTexture=function(v,A,I,N=0){let K=A.image.width,De=A.image.height,_e=J.convert(I.format),ke=J.convert(I.type);le.setTexture2D(I,0),P.pixelStorei(37440,I.flipY),P.pixelStorei(37441,I.premultiplyAlpha),P.pixelStorei(3317,I.unpackAlignment),A.isDataTexture?P.texSubImage2D(3553,N,v.x,v.y,K,De,_e,ke,A.image.data):A.isCompressedTexture?P.compressedTexSubImage2D(3553,N,v.x,v.y,A.mipmaps[0].width,A.mipmaps[0].height,_e,A.mipmaps[0].data):P.texSubImage2D(3553,N,v.x,v.y,_e,ke,A.image),N===0&&I.generateMipmaps&&P.generateMipmap(3553),fe.unbindTexture()},this.copyTextureToTexture3D=function(v,A,I,N,K=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let De=v.max.x-v.min.x+1,_e=v.max.y-v.min.y+1,ke=v.max.z-v.min.z+1,Be=J.convert(N.format),ht=J.convert(N.type),Je;if(N.isDataTexture3D)le.setTexture3D(N,0),Je=32879;else if(N.isDataTexture2DArray)le.setTexture2DArray(N,0),Je=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}P.pixelStorei(37440,N.flipY),P.pixelStorei(37441,N.premultiplyAlpha),P.pixelStorei(3317,N.unpackAlignment);let lt=P.getParameter(3314),Bt=P.getParameter(32878),Oo=P.getParameter(3316),yt=P.getParameter(3315),su=P.getParameter(32877),Ft=I.isCompressedTexture?I.mipmaps[0]:I.image;P.pixelStorei(3314,Ft.width),P.pixelStorei(32878,Ft.height),P.pixelStorei(3316,v.min.x),P.pixelStorei(3315,v.min.y),P.pixelStorei(32877,v.min.z),I.isDataTexture||I.isDataTexture3D?P.texSubImage3D(Je,K,A.x,A.y,A.z,De,_e,ke,Be,ht,Ft.data):I.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),P.compressedTexSubImage3D(Je,K,A.x,A.y,A.z,De,_e,ke,Be,Ft.data)):P.texSubImage3D(Je,K,A.x,A.y,A.z,De,_e,ke,Be,ht,Ft),P.pixelStorei(3314,lt),P.pixelStorei(32878,Bt),P.pixelStorei(3316,Oo),P.pixelStorei(3315,yt),P.pixelStorei(32877,su),K===0&&N.generateMipmaps&&P.generateMipmap(Je),fe.unbindTexture()},this.initTexture=function(v){le.setTexture2D(v,0),fe.unbindTexture()},this.resetState=function(){y=0,m=0,b=null,fe.reset(),be.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function ip(r,e,t,n,i,o){rl.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(sc.x=o*rl.x-i*rl.y,sc.y=i*rl.x+o*rl.y):sc.copy(rl),r.copy(e),r.x+=sc.x,r.y+=sc.y,r.applyMatrix4(Z3)}function dS(r,e,t,n,i,o,s){let a=Zg.distanceSqToPoint(r);if(a<t){let l=new M;Zg.closestPointToPoint(r,l),l.applyMatrix4(n);let u=i.ray.origin.distanceTo(l);if(u<i.near||u>i.far)return;o.push({distance:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:s})}}function t1(){let r=0,e=0,t=0,n=0;function i(o,s,a,l){r=o,e=a,t=-3*o+3*s-2*a-l,n=2*o-2*s+a+l}return{initCatmullRom:function(o,s,a,l,u){i(s,a,u*(a-o),u*(l-s))},initNonuniformCatmullRom:function(o,s,a,l,u,c,f){let h=(s-o)/u-(a-o)/(u+c)+(a-s)/c,p=(a-s)/c-(l-s)/(c+f)+(l-a)/f;h*=c,p*=c,i(s,a,h,p)},calc:function(o){let s=o*o,a=s*o;return r+e*o+t*s+n*a}}}function mS(r,e,t,n,i){let o=(n-e)*.5,s=(i-t)*.5,a=r*r,l=r*a;return(2*t-2*n+o+s)*l+(-3*t+3*n-2*o-s)*a+o*r+t}function J4(r,e){let t=1-r;return t*t*e}function $4(r,e){return 2*(1-r)*r*e}function eF(r,e){return r*r*e}function pc(r,e,t,n){return J4(r,e)+$4(r,t)+eF(r,n)}function tF(r,e){let t=1-r;return t*t*t*e}function nF(r,e){let t=1-r;return 3*t*t*r*e}function iF(r,e){return 3*(1-r)*r*r*e}function rF(r,e){return r*r*r*e}function dc(r,e,t,n,i){return tF(r,e)+nF(r,t)+iF(r,n)+rF(r,i)}function gS(r,e,t,n,i){let o,s;if(i===bF(r,e,t,n)>0)for(o=e;o<t;o+=n)s=xS(o,r[o],r[o+1],s);else for(o=t-n;o>=e;o-=n)s=xS(o,r[o],r[o+1],s);return s&&wp(s,s.next)&&(bc(s),s=s.next),s}function So(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(wp(t,t.next)||Pt(t.prev,t,t.next)===0)){if(bc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function xc(r,e,t,n,i,o,s){if(!r)return;!s&&o&&mF(r,n,i,o);let a=r,l,u;for(;r.prev!==r.next;){if(l=r.prev,u=r.next,o?aF(r,n,i,o):sF(r)){e.push(l.i/t),e.push(r.i/t),e.push(u.i/t),bc(r),r=u.next,a=u.next;continue}if(r=u,r===a){s?s===1?(r=lF(So(r),e,t),xc(r,e,t,n,i,o,2)):s===2&&uF(r,e,t,n,i,o):xc(So(r),e,t,n,i,o,1);break}}}function sF(r){let e=r.prev,t=r,n=r.next;if(Pt(e,t,n)>=0)return!1;let i=r.next.next;for(;i!==r.prev;){if(fl(e.x,e.y,t.x,t.y,n.x,n.y,i.x,i.y)&&Pt(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function aF(r,e,t,n){let i=r.prev,o=r,s=r.next;if(Pt(i,o,s)>=0)return!1;let a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,l=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,u=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,c=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,f=l1(a,l,e,t,n),h=l1(u,c,e,t,n),p=r.prevZ,d=r.nextZ;for(;p&&p.z>=f&&d&&d.z<=h;){if(p!==r.prev&&p!==r.next&&fl(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Pt(p.prev,p,p.next)>=0||(p=p.prevZ,d!==r.prev&&d!==r.next&&fl(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&Pt(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;p&&p.z>=f;){if(p!==r.prev&&p!==r.next&&fl(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&Pt(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=h;){if(d!==r.prev&&d!==r.next&&fl(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&Pt(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function lF(r,e,t){let n=r;do{let i=n.prev,o=n.next.next;!wp(i,o)&&yS(i,n,n.next,o)&&wc(i,o)&&wc(o,i)&&(e.push(i.i/t),e.push(n.i/t),e.push(o.i/t),bc(n),bc(n.next),n=r=o),n=n.next}while(n!==r);return So(n)}function uF(r,e,t,n,i,o){let s=r;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&vF(s,a)){let l=vS(s,a);s=So(s,s.next),l=So(l,l.next),xc(s,e,t,n,i,o),xc(l,e,t,n,i,o);return}a=a.next}s=s.next}while(s!==r)}function cF(r,e,t,n){let i=[],o,s,a,l,u;for(o=0,s=e.length;o<s;o++)a=e[o]*n,l=o<s-1?e[o+1]*n:r.length,u=gS(r,a,l,n,!1),u===u.next&&(u.steiner=!0),i.push(yF(u));for(i.sort(hF),o=0;o<i.length;o++)fF(i[o],t),t=So(t,t.next);return t}function hF(r,e){return r.x-e.x}function fF(r,e){if(e=pF(r,e),e){let t=vS(e,r);So(e,e.next),So(t,t.next)}}function pF(r,e){let t=e,n=r.x,i=r.y,o=-1/0,s;do{if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){let h=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=n&&h>o){if(o=h,h===n){if(i===t.y)return t;if(i===t.next.y)return t.next}s=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!s)return null;if(n===o)return s;let a=s,l=s.x,u=s.y,c=1/0,f;t=s;do n>=t.x&&t.x>=l&&n!==t.x&&fl(i<u?n:o,i,l,u,i<u?o:n,i,t.x,t.y)&&(f=Math.abs(i-t.y)/(n-t.x),wc(t,r)&&(f<c||f===c&&(t.x>s.x||t.x===s.x&&dF(s,t)))&&(s=t,c=f)),t=t.next;while(t!==a);return s}function dF(r,e){return Pt(r.prev,r,e.prev)<0&&Pt(e.next,r,r.next)<0}function mF(r,e,t,n){let i=r;do i.z===null&&(i.z=l1(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,gF(i)}function gF(r){let e,t,n,i,o,s,a,l,u=1;do{for(t=r,r=null,o=null,s=0;t;){for(s++,n=t,a=0,e=0;e<u&&(a++,n=n.nextZ,!!n);e++);for(l=u;a>0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:r=i,i.prevZ=o,o=i;t=n}o.nextZ=null,u*=2}while(s>1);return r}function l1(r,e,t,n,i){return r=32767*(r-t)*i,e=32767*(e-n)*i,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function yF(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function fl(r,e,t,n,i,o,s,a){return(i-s)*(e-a)-(r-s)*(o-a)>=0&&(r-s)*(n-a)-(t-s)*(e-a)>=0&&(t-s)*(o-a)-(i-s)*(n-a)>=0}function vF(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!xF(r,e)&&(wc(r,e)&&wc(e,r)&&wF(r,e)&&(Pt(r.prev,r,e.prev)||Pt(r,e.prev,e))||wp(r,e)&&Pt(r.prev,r,r.next)>0&&Pt(e.prev,e,e.next)>0)}function Pt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function wp(r,e){return r.x===e.x&&r.y===e.y}function yS(r,e,t,n){let i=Sp(Pt(r,e,t)),o=Sp(Pt(r,e,n)),s=Sp(Pt(t,n,r)),a=Sp(Pt(t,n,e));return!!(i!==o&&s!==a||i===0&&bp(r,t,e)||o===0&&bp(r,n,e)||s===0&&bp(t,r,n)||a===0&&bp(t,e,n))}function bp(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Sp(r){return r>0?1:r<0?-1:0}function xF(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&yS(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function wc(r,e){return Pt(r.prev,r,r.next)<0?Pt(r,e,r.next)>=0&&Pt(r,r.prev,e)>=0:Pt(r,e,r.prev)<0||Pt(r,r.next,e)<0}function wF(r,e){let t=r,n=!1,i=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&i<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function vS(r,e){let t=new u1(r.i,r.x,r.y),n=new u1(e.i,e.x,e.y),i=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function xS(r,e,t,n){let i=new u1(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function bc(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function u1(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function bF(r,e,t,n){let i=0;for(let o=e,s=t-n;o<t;o+=n)i+=(r[s]-r[o])*(r[o+1]+r[s+1]),s=o;return i}function wS(r){let e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function bS(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}function LF(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){let o=r[n];t.shapes.push(o.uuid)}else t.shapes.push(r.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}function AF(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){let i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}function SS(r,e,t){let n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n,i),!0)}function EF(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return wl;case"vector":case"vector2":case"vector3":case"vector4":return bl;case"color":return Pp;case"quaternion":return Ls;case"bool":case"boolean":return Lo;case"string":return Ao}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function MF(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=EF(r.type);if(r.times===void 0){let t=[],n=[];Ct.flattenJSON(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}function IS(){return(typeof performance=="undefined"?Date:performance).now()}function qS(r,e){return r.distance-e.distance}function B1(r,e,t,n){if(r.layers.test(e.layers)&&r.raycast(e,t),n===!0){let i=r.children;for(let o=0,s=i.length;o<s;o++)B1(i[o],e,t,!0)}}function ZS(r){let e=[];r&&r.isBone&&e.push(r);for(let t=0;t<r.children.length;t++)e.push.apply(e,ZS(r.children[t]));return e}function Vt(r,e,t,n,i,o,s){Xp.set(i,o,s).unproject(n);let a=e[r];if(a!==void 0){let l=t.getAttribute("position");for(let u=0,c=a.length;u<c;u++)l.setXYZ(a[u],Xp.x,Xp.y,Xp.z)}}function jF(r){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),r}function QF(r=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),r.isMultiMaterial=!0,r.materials=r,r.clone=function(){return r.slice()},r}function YF(r,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new ol(r,e)}function XF(r){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new lc(r)}function KF(r,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new ol(r,e)}function ZF(r){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new wo(r)}function JF(r){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new wo(r)}function $F(r){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new wo(r)}function e_(r,e,t){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new M(r,e,t)}function t_(r,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new qe(r,e).setUsage(Fa)}function n_(r,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new Eg(r,e)}function i_(r,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Mg(r,e)}function r_(r,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Rg(r,e)}function o_(r,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Tg(r,e)}function s_(r,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Qu(r,e)}function a_(r,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Fg(r,e)}function l_(r,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new Yu(r,e)}function u_(r,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Te(r,e)}function c_(r,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Cg(r,e)}function h_(r){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new W1(r)}function f_(r,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new O1(r,e)}function p_(r,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Bn(new mp(r.geometry),new Jt({color:e!==void 0?e:16777215}))}function d_(r,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Bn(new Lp(r.geometry),new Jt({color:e!==void 0?e:16777215}))}function m_(r){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new ki(r)}function g_(r){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new d1(r)}function y_(r,e,t){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Zu(r,t)}function v_(){console.error("THREE.CanvasRenderer has been removed")}function x_(){console.error("THREE.JSONLoader has been removed.")}function b_(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}function S_(){return console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),new Pe}function L_(){return console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),new Pe}function A_(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")}function D_(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")}function E_(){console.error("THREE.ImmediateRenderObject has been removed.")}var xf,RM,TM,Lw,B0,Aw,FM,_M,z0,Dw,Da,ji,At,jn,I0,CM,dr,Ea,U0,N0,O0,Ew,es,Mw,Rw,G0,W0,Tw,Fw,_w,Cw,V0,H0,Pw,kw,Bw,zw,Iw,Uw,Nw,Ow,wf,Gw,Ww,Vw,Hw,Fu,qw,jw,io,Qw,Yw,Xw,Kw,Zw,bf,ts,ns,_u,Cu,Ma,Pu,ku,mn,Bu,jt,Sf,PM,Lf,kM,Kt,q0,BM,is,zM,mr,Jw,$w,Ra,eb,zu,Qi,rs,tb,nb,ib,os,rb,ro,gn,ob,sb,ab,oo,ss,lb,ub,cb,hb,fb,pb,j0,Q0,Y0,X0,K0,Z0,J0,$0,db,eg,tg,mb,gb,yb,vb,xb,wb,bb,Sb,Lb,Ab,Db,Eb,Mb,Rb,Tb,Fb,_b,Cb,Pb,kb,Bb,zb,Ib,Ub,Nb,Ob,Gb,Wb,Vb,Hb,qb,jb,Iu,Uu,Af,as,ls,Nu,Df,ng,Qb,IM,UM,Pn,Ou,Ef,Mf,ig,rg,og,Yb,Xb,us,Kb,NM,Rf,OM,GM,WM,VM,HM,qM,jM,QM,YM,XM,KM,ZM,JM,Zb,Ta,Fa,$M,eR,tR,nR,iR,rR,oR,sR,sg,gr,yn,Tf,cs,Gu,wR,ee,Qt,bR,Ca,so,SR,Yt,xt,Qn,cg,Vu,ot,M,hg,n3,Yn,yr,Hu,fg,Pa,ka,Ba,ao,lo,hs,qu,_f,Cf,fs,LR,i3,dg,mg,vr,xr,gg,Pf,uo,yg,kf,vg,wr,Ae,za,Ei,AR,DR,co,Bf,si,r3,o3,xn,zf,ER,s3,Ia,br,If,ju,MR,RR,a3,l3,u3,TR,c3,je,Mi,Sr,xg,Lr,Ua,Na,h3,wg,bg,Sg,It,FR,Zt,f3,Ri,Uf,xe,vt,Rt,Nf,qe,Eg,Mg,Rg,Tg,Qu,Fg,Yu,_g,Te,Cg,_R,mi,Pg,Oa,ai,Xu,on,Pe,p3,Ga,kg,ho,fo,po,Bg,zg,Ig,Of,Gf,Wf,Vf,Hf,qf,Ug,jf,Lt,Ti,d3,PR,kR,Yi,Va,Gt,Ha,qa,Ku,ps,Zu,Ng,BR,zR,Fi,ja,Yf,Qa,ds,UR,NR,OR,GR,WR,VR,HR,qR,jR,QR,YR,XR,KR,ZR,JR,$R,eT,tT,nT,iT,rT,oT,sT,aT,lT,uT,cT,hT,fT,pT,dT,mT,gT,yT,vT,xT,wT,bT,ST,LT,AT,DT,ET,MT,RT,TT,FT,_T,CT,PT,kT,BT,zT,IT,UT,NT,OT,GT,WT,VT,HT,qT,jT,QT,YT,XT,KT,ZT,JT,$T,e8,t8,n8,i8,r8,o8,s8,a8,l8,u8,c8,h8,f8,p8,d8,m8,g8,y8,v8,x8,w8,b8,S8,L8,A8,D8,E8,M8,R8,T8,F8,_8,C8,P8,k8,B8,z8,I8,U8,N8,O8,G8,W8,V8,H8,q8,j8,Q8,Y8,X8,K8,Z8,J8,$8,e5,t5,n5,i5,r5,o5,s5,a5,l5,u5,$e,we,_i,Ya,ms,Xa,mo,Xi,g3,y3,Ka,gs,Og,Ju,v3,Xf,x3,Gg,ys,Za,w3,Wg,$u,Zf,D3,E3,M3,R3,T3,F3,_3,C3,P3,qg,g4,L4,D4,E4,N4,tc,nc,V4,H4,$f,gi,Q4,ep,ic,K3,Qg,$a,el,xs,yo,Wt,Ar,rc,tl,oc,nl,il,rl,sc,Z3,tp,ac,np,J3,Yg,$3,lc,rp,eS,Xg,tS,nS,iS,K4,rS,uc,cc,vo,oS,Z4,hc,xo,sS,aS,op,fc,sp,Jt,lS,uS,cS,Kg,ap,Ki,hS,fS,Bn,lp,wo,pS,Zg,up,cp,ol,Jg,hp,$g,sl,bo,al,Zi,ll,fp,pp,e1,dp,mp,Xn,ul,gp,yp,n1,i1,r1,vp,mc,xp,cl,o1,gc,yc,vc,s1,a1,hl,Ci,oF,Pi,Ji,SF,pl,dl,ws,ml,bs,Ss,gl,yl,vl,xl,Lp,LS,Ap,Sc,Dp,Ep,Mp,Rp,Tp,Fp,_p,DF,Ct,$i,c1,Cp,h1,yi,Lo,Pp,wl,f1,Ls,Ao,bl,Sl,As,kp,AS,Mn,Dr,ki,DS,ES,Ll,p1,d1,Lc,vi,Bp,MS,RS,TS,zp,m1,Ip,FS,Ac,g1,y1,Up,v1,Np,Op,Gp,Wp,Al,x1,Dc,Vp,w1,_S,RF,CS,PS,b1,Hp,S1,L1,A1,D1,kS,BS,Ds,zS,E1,Es,US,TF,Ms,NS,qp,Rs,OS,FF,Ts,GS,M1,R1,T1,_F,F1,CF,PF,kF,BF,zF,IF,UF,WS,ut,_1,VS,C1,Ec,P1,k1,HS,Mc,jS,QS,Fs,YS,jp,z1,XS,KS,Do,Qp,I1,U1,JS,NF,$S,eL,tL,N1,nL,iL,Yp,rL,oL,Xp,Ut,sL,Kp,O1,aL,lL,uL,Zp,G1,cL,W1,hL,fL,OF,pL,GF,WF,VF,HF,qF,w_,li=oe(()=>{xf="135",RM={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},TM={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Lw=0,B0=1,Aw=2,FM=3,_M=0,z0=1,Dw=2,Da=3,ji=0,At=1,jn=2,I0=1,CM=2,dr=0,Ea=1,U0=2,N0=3,O0=4,Ew=5,es=100,Mw=101,Rw=102,G0=103,W0=104,Tw=200,Fw=201,_w=202,Cw=203,V0=204,H0=205,Pw=206,kw=207,Bw=208,zw=209,Iw=210,Uw=0,Nw=1,Ow=2,wf=3,Gw=4,Ww=5,Vw=6,Hw=7,Fu=0,qw=1,jw=2,io=0,Qw=1,Yw=2,Xw=3,Kw=4,Zw=5,bf=300,ts=301,ns=302,_u=303,Cu=304,Ma=306,Pu=307,ku=1e3,mn=1001,Bu=1002,jt=1003,Sf=1004,PM=1004,Lf=1005,kM=1005,Kt=1006,q0=1007,BM=1007,is=1008,zM=1008,mr=1009,Jw=1010,$w=1011,Ra=1012,eb=1013,zu=1014,Qi=1015,rs=1016,tb=1017,nb=1018,ib=1019,os=1020,rb=1021,ro=1022,gn=1023,ob=1024,sb=1025,ab=gn,oo=1026,ss=1027,lb=1028,ub=1029,cb=1030,hb=1031,fb=1032,pb=1033,j0=33776,Q0=33777,Y0=33778,X0=33779,K0=35840,Z0=35841,J0=35842,$0=35843,db=36196,eg=37492,tg=37496,mb=37808,gb=37809,yb=37810,vb=37811,xb=37812,wb=37813,bb=37814,Sb=37815,Lb=37816,Ab=37817,Db=37818,Eb=37819,Mb=37820,Rb=37821,Tb=36492,Fb=37840,_b=37841,Cb=37842,Pb=37843,kb=37844,Bb=37845,zb=37846,Ib=37847,Ub=37848,Nb=37849,Ob=37850,Gb=37851,Wb=37852,Vb=37853,Hb=2200,qb=2201,jb=2202,Iu=2300,Uu=2301,Af=2302,as=2400,ls=2401,Nu=2402,Df=2500,ng=2501,Qb=0,IM=1,UM=2,Pn=3e3,Ou=3001,Ef=3007,Mf=3002,ig=3004,rg=3005,og=3006,Yb=3200,Xb=3201,us=0,Kb=1,NM=0,Rf=7680,OM=7681,GM=7682,WM=7683,VM=34055,HM=34056,qM=5386,jM=512,QM=513,YM=514,XM=515,KM=516,ZM=517,JM=518,Zb=519,Ta=35044,Fa=35048,$M=35040,eR=35045,tR=35049,nR=35041,iR=35046,rR=35050,oR=35042,sR="100",sg="300 es",gr=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let i=this._listeners[e];if(i!==void 0){let o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let n=this._listeners[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let o=0,s=i.length;o<s;o++)i[o].call(this,e);e.target=null}}},yn=[];for(let r=0;r<256;r++)yn[r]=(r<16?"0":"")+r.toString(16);Tf=1234567,cs=Math.PI/180,Gu=180/Math.PI;wR=Object.freeze({__proto__:null,DEG2RAD:cs,RAD2DEG:Gu,generateUUID:oi,clamp:vn,euclideanModulo:ag,mapLinear:aR,inverseLerp:lR,lerp:Wu,damp:uR,pingpong:cR,smoothstep:hR,smootherstep:fR,randInt:pR,randFloat:dR,randFloatSpread:mR,seededRandom:gR,degToRad:yR,radToDeg:vR,isPowerOfTwo:lg,ceilPowerOfTwo:Jb,floorPowerOfTwo:$b,setQuaternionFromProperEuler:xR}),ee=class{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),o=this.x-e.x,s=this.y-e.y;return this.x=o*n-s*i+e.x,this.y=o*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};ee.prototype.isVector2=!0;Qt=class{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,o,s,a,l,u){let c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=o,c[5]=l,c[6]=n,c[7]=s,c[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,o=this.elements,s=n[0],a=n[3],l=n[6],u=n[1],c=n[4],f=n[7],h=n[2],p=n[5],d=n[8],g=i[0],x=i[3],y=i[6],m=i[1],b=i[4],w=i[7],D=i[2],R=i[5],L=i[8];return o[0]=s*g+a*m+l*D,o[3]=s*x+a*b+l*R,o[6]=s*y+a*w+l*L,o[1]=u*g+c*m+f*D,o[4]=u*x+c*b+f*R,o[7]=u*y+c*w+f*L,o[2]=h*g+p*m+d*D,o[5]=h*x+p*b+d*R,o[8]=h*y+p*w+d*L,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],c=e[8];return t*s*c-t*a*u-n*o*c+n*a*l+i*o*u-i*s*l}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],c=e[8],f=c*s-a*u,h=a*l-c*o,p=u*o-s*l,d=t*f+n*h+i*p;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);let g=1/d;return e[0]=f*g,e[1]=(i*u-c*n)*g,e[2]=(a*n-i*s)*g,e[3]=h*g,e[4]=(c*t-i*l)*g,e[5]=(i*o-a*t)*g,e[6]=p*g,e[7]=(n*l-u*t)*g,e[8]=(s*t-n*o)*g,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,o,s,a){let l=Math.cos(o),u=Math.sin(o);return this.set(n*l,n*u,-n*(l*s+u*a)+s+e,-i*u,i*l,-i*(-u*s+l*a)+a+t,0,0,1),this}scale(e,t){let n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),i=this.elements,o=i[0],s=i[3],a=i[6],l=i[1],u=i[4],c=i[7];return i[0]=t*o+n*l,i[3]=t*s+n*u,i[6]=t*a+n*c,i[1]=-n*o+t*l,i[4]=-n*s+t*u,i[7]=-n*a+t*c,this}translate(e,t){let n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};Qt.prototype.isMatrix3=!0;bR={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};so=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ca===void 0&&(Ca=Ff("canvas")),Ca.width=e.width,Ca.height=e.height;let n=Ca.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ca}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},SR=0,Yt=class extends gr{constructor(e=Yt.DEFAULT_IMAGE,t=Yt.DEFAULT_MAPPING,n=mn,i=mn,o=Kt,s=is,a=gn,l=mr,u=1,c=Pn){super();Object.defineProperty(this,"id",{value:SR++}),this.uuid=oi(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=i,this.magFilter=o,this.minFilter=s,this.anisotropy=u,this.format=a,this.internalFormat=null,this.type=l,this.offset=new ee(0,0),this.repeat=new ee(1,1),this.center=new ee(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){let i=this.image;if(i.uuid===void 0&&(i.uuid=oi()),!t&&e.images[i.uuid]===void 0){let o;if(Array.isArray(i)){o=[];for(let s=0,a=i.length;s<a;s++)i[s].isDataTexture?o.push(ug(i[s].image)):o.push(ug(i[s]))}else o=ug(i);e.images[i.uuid]={uuid:i.uuid,url:o}}n.image=i.uuid}return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==bf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ku:e.x=e.x-Math.floor(e.x);break;case mn:e.x=e.x<0?0:1;break;case Bu:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ku:e.y=e.y-Math.floor(e.y);break;case mn:e.y=e.y<0?0:1;break;case Bu:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&this.version++}};Yt.DEFAULT_IMAGE=void 0;Yt.DEFAULT_MAPPING=bf;Yt.prototype.isTexture=!0;xt=class{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,o=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*o,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*o,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*o,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*o,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,o,s=.01,a=.1,l=e.elements,u=l[0],c=l[4],f=l[8],h=l[1],p=l[5],d=l[9],g=l[2],x=l[6],y=l[10];if(Math.abs(c-h)<s&&Math.abs(f-g)<s&&Math.abs(d-x)<s){if(Math.abs(c+h)<a&&Math.abs(f+g)<a&&Math.abs(d+x)<a&&Math.abs(u+p+y-3)<a)return this.set(1,0,0,0),this;t=Math.PI;let b=(u+1)/2,w=(p+1)/2,D=(y+1)/2,R=(c+h)/4,L=(f+g)/4,T=(d+x)/4;return b>w&&b>D?b<s?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(b),i=R/n,o=L/n):w>D?w<s?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(w),n=R/i,o=T/i):D<s?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(D),n=L/o,i=T/o),this.set(n,i,o,t),this}let m=Math.sqrt((x-d)*(x-d)+(f-g)*(f-g)+(h-c)*(h-c));return Math.abs(m)<.001&&(m=1),this.x=(x-d)/m,this.y=(f-g)/m,this.z=(h-c)/m,this.w=Math.acos((u+p+y-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};xt.prototype.isVector4=!0;Qn=class extends gr{constructor(e,t,n={}){super();this.width=e,this.height=t,this.depth=1,this.scissor=new xt(0,0,e,t),this.scissorTest=!1,this.viewport=new xt(0,0,e,t),this.texture=new Yt(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Kt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}};Qn.prototype.isWebGLRenderTarget=!0;cg=class extends Qn{constructor(e,t,n){super(e,t);let i=this.texture;this.texture=[];for(let o=0;o<n;o++)this.texture[o]=i.clone()}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,o=this.texture.length;i<o;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone();return this}};cg.prototype.isWebGLMultipleRenderTargets=!0;Vu=class extends Qn{constructor(e,t,n={}){super(e,t,n);this.samples=4,this.ignoreDepthForMultisampleCopy=n.ignoreDepth!==void 0?n.ignoreDepth:!0,this.useRenderToTexture=n.useRenderToTexture!==void 0?n.useRenderToTexture:!1,this.useRenderbuffer=this.useRenderToTexture===!1}copy(e){return super.copy.call(this,e),this.samples=e.samples,this.useRenderToTexture=e.useRenderToTexture,this.useRenderbuffer=e.useRenderbuffer,this}};Vu.prototype.isWebGLMultisampleRenderTarget=!0;ot=class{constructor(e=0,t=0,n=0,i=1){this._x=e,this._y=t,this._z=n,this._w=i}static slerp(e,t,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,i)}static slerpFlat(e,t,n,i,o,s,a){let l=n[i+0],u=n[i+1],c=n[i+2],f=n[i+3],h=o[s+0],p=o[s+1],d=o[s+2],g=o[s+3];if(a===0){e[t+0]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f;return}if(a===1){e[t+0]=h,e[t+1]=p,e[t+2]=d,e[t+3]=g;return}if(f!==g||l!==h||u!==p||c!==d){let x=1-a,y=l*h+u*p+c*d+f*g,m=y>=0?1:-1,b=1-y*y;if(b>Number.EPSILON){let D=Math.sqrt(b),R=Math.atan2(D,y*m);x=Math.sin(x*R)/D,a=Math.sin(a*R)/D}let w=a*m;if(l=l*x+h*w,u=u*x+p*w,c=c*x+d*w,f=f*x+g*w,x===1-a){let D=1/Math.sqrt(l*l+u*u+c*c+f*f);l*=D,u*=D,c*=D,f*=D}}e[t]=l,e[t+1]=u,e[t+2]=c,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,i,o,s){let a=n[i],l=n[i+1],u=n[i+2],c=n[i+3],f=o[s],h=o[s+1],p=o[s+2],d=o[s+3];return e[t]=a*d+c*f+l*p-u*h,e[t+1]=l*d+c*h+u*f-a*p,e[t+2]=u*d+c*p+a*h-l*f,e[t+3]=c*d-a*f-l*h-u*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");let n=e._x,i=e._y,o=e._z,s=e._order,a=Math.cos,l=Math.sin,u=a(n/2),c=a(i/2),f=a(o/2),h=l(n/2),p=l(i/2),d=l(o/2);switch(s){case"XYZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"YXZ":this._x=h*c*f+u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"ZXY":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f-h*p*d;break;case"ZYX":this._x=h*c*f-u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f+h*p*d;break;case"YZX":this._x=h*c*f+u*p*d,this._y=u*p*f+h*c*d,this._z=u*c*d-h*p*f,this._w=u*c*f-h*p*d;break;case"XZY":this._x=h*c*f-u*p*d,this._y=u*p*f-h*c*d,this._z=u*c*d+h*p*f,this._w=u*c*f+h*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],o=t[8],s=t[1],a=t[5],l=t[9],u=t[2],c=t[6],f=t[10],h=n+a+f;if(h>0){let p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(c-l)*p,this._y=(o-u)*p,this._z=(s-i)*p}else if(n>a&&n>f){let p=2*Math.sqrt(1+n-a-f);this._w=(c-l)/p,this._x=.25*p,this._y=(i+s)/p,this._z=(o+u)/p}else if(a>f){let p=2*Math.sqrt(1+a-n-f);this._w=(o-u)/p,this._x=(i+s)/p,this._y=.25*p,this._z=(l+c)/p}else{let p=2*Math.sqrt(1+f-n-a);this._w=(s-i)/p,this._x=(o+u)/p,this._y=(l+c)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(vn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,o=e._z,s=e._w,a=t._x,l=t._y,u=t._z,c=t._w;return this._x=n*c+s*a+i*u-o*l,this._y=i*c+s*l+o*a-n*u,this._z=o*c+s*u+n*l-i*a,this._w=s*c-n*a-i*l-o*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,i=this._y,o=this._z,s=this._w,a=s*e._w+n*e._x+i*e._y+o*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=s,this._x=n,this._y=i,this._z=o,this;let l=1-a*a;if(l<=Number.EPSILON){let p=1-t;return this._w=p*s+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*o+t*this._z,this.normalize(),this._onChangeCallback(),this}let u=Math.sqrt(l),c=Math.atan2(u,a),f=Math.sin((1-t)*c)/u,h=Math.sin(t*c)/u;return this._w=s*f+this._w*h,this._x=n*f+this._x*h,this._y=i*f+this._y*h,this._z=o*f+this._z*h,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}random(){let e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),o=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(o),n*Math.cos(o),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};ot.prototype.isQuaternion=!0;M=class{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(n3.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(n3.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*i,this.y=o[1]*t+o[4]*n+o[7]*i,this.z=o[2]*t+o[5]*n+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,o=e.elements,s=1/(o[3]*t+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*i+o[12])*s,this.y=(o[1]*t+o[5]*n+o[9]*i+o[13])*s,this.z=(o[2]*t+o[6]*n+o[10]*i+o[14])*s,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,o=e.x,s=e.y,a=e.z,l=e.w,u=l*t+s*i-a*n,c=l*n+a*t-o*i,f=l*i+o*n-s*t,h=-o*t-s*n-a*i;return this.x=u*l+h*-o+c*-a-f*-s,this.y=c*l+h*-s+f*-o-u*-a,this.z=f*l+h*-a+u*-s-c*-o,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i,this.y=o[1]*t+o[5]*n+o[9]*i,this.z=o[2]*t+o[6]*n+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,o=e.z,s=t.x,a=t.y,l=t.z;return this.x=i*l-o*a,this.y=o*s-n*l,this.z=n*a-i*s,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return hg.copy(this).projectOnVector(e),this.sub(hg)}reflect(e){return this.sub(hg.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(vn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};M.prototype.isVector3=!0;hg=new M,n3=new ot,Yn=class{constructor(e=new M(1/0,1/0,1/0),t=new M(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0;for(let l=0,u=e.length;l<u;l+=3){let c=e[l],f=e[l+1],h=e[l+2];c<t&&(t=c),f<n&&(n=f),h<i&&(i=h),c>o&&(o=c),f>s&&(s=f),h>a&&(a=h)}return this.min.set(t,n,i),this.max.set(o,s,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0;for(let l=0,u=e.count;l<u;l++){let c=e.getX(l),f=e.getY(l),h=e.getZ(l);c<t&&(t=c),f<n&&(n=f),h<i&&(i=h),c>o&&(o=c),f>s&&(s=f),h>a&&(a=h)}return this.min.set(t,n,i),this.max.set(o,s,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Hu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);let t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),fg.copy(t.boundingBox),fg.applyMatrix4(e.matrixWorld),this.union(fg));let n=e.children;for(let i=0,o=n.length;i<o;i++)this.expandByObject(n[i]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Hu),Hu.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(qu),_f.subVectors(this.max,qu),Pa.subVectors(e.a,qu),ka.subVectors(e.b,qu),Ba.subVectors(e.c,qu),ao.subVectors(ka,Pa),lo.subVectors(Ba,ka),hs.subVectors(Pa,Ba);let t=[0,-ao.z,ao.y,0,-lo.z,lo.y,0,-hs.z,hs.y,ao.z,0,-ao.x,lo.z,0,-lo.x,hs.z,0,-hs.x,-ao.y,ao.x,0,-lo.y,lo.x,0,-hs.y,hs.x,0];return!pg(t,Pa,ka,Ba,_f)||(t=[1,0,0,0,1,0,0,0,1],!pg(t,Pa,ka,Ba,_f))?!1:(Cf.crossVectors(ao,lo),t=[Cf.x,Cf.y,Cf.z],pg(t,Pa,ka,Ba,_f))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Hu.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Hu).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(yr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),yr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),yr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),yr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),yr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),yr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),yr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),yr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(yr),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};Yn.prototype.isBox3=!0;yr=[new M,new M,new M,new M,new M,new M,new M,new M],Hu=new M,fg=new Yn,Pa=new M,ka=new M,Ba=new M,ao=new M,lo=new M,hs=new M,qu=new M,_f=new M,Cf=new M,fs=new M;LR=new Yn,i3=new M,dg=new M,mg=new M,vr=class{constructor(e=new M,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):LR.setFromPoints(e).getCenter(n);let i=0;for(let o=0,s=e.length;o<s;o++)i=Math.max(i,n.distanceToSquared(e[o]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){mg.subVectors(e,this.center);let t=mg.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.add(mg.multiplyScalar(i/n)),this.radius+=i}return this}union(e){return dg.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(i3.copy(e.center).add(dg)),this.expandByPoint(i3.copy(e.center).sub(dg)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},xr=new M,gg=new M,Pf=new M,uo=new M,yg=new M,kf=new M,vg=new M,wr=class{constructor(e=new M,t=new M(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,xr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=xr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(xr.copy(this.direction).multiplyScalar(t).add(this.origin),xr.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){gg.copy(e).add(t).multiplyScalar(.5),Pf.copy(t).sub(e).normalize(),uo.copy(this.origin).sub(gg);let o=e.distanceTo(t)*.5,s=-this.direction.dot(Pf),a=uo.dot(this.direction),l=-uo.dot(Pf),u=uo.lengthSq(),c=Math.abs(1-s*s),f,h,p,d;if(c>0)if(f=s*l-a,h=s*a-l,d=o*c,f>=0)if(h>=-d)if(h<=d){let g=1/c;f*=g,h*=g,p=f*(f+s*h+2*a)+h*(s*f+h+2*l)+u}else h=o,f=Math.max(0,-(s*h+a)),p=-f*f+h*(h+2*l)+u;else h=-o,f=Math.max(0,-(s*h+a)),p=-f*f+h*(h+2*l)+u;else h<=-d?(f=Math.max(0,-(-s*o+a)),h=f>0?-o:Math.min(Math.max(-o,-l),o),p=-f*f+h*(h+2*l)+u):h<=d?(f=0,h=Math.min(Math.max(-o,-l),o),p=h*(h+2*l)+u):(f=Math.max(0,-(s*o+a)),h=f>0?o:Math.min(Math.max(-o,-l),o),p=-f*f+h*(h+2*l)+u);else h=s>0?-o:o,f=Math.max(0,-(s*h+a)),p=-f*f+h*(h+2*l)+u;return n&&n.copy(this.direction).multiplyScalar(f).add(this.origin),i&&i.copy(Pf).multiplyScalar(h).add(gg),p}intersectSphere(e,t){xr.subVectors(e.center,this.origin);let n=xr.dot(this.direction),i=xr.dot(xr)-n*n,o=e.radius*e.radius;if(i>o)return null;let s=Math.sqrt(o-i),a=n-s,l=n+s;return a<0&&l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,o,s,a,l,u=1/this.direction.x,c=1/this.direction.y,f=1/this.direction.z,h=this.origin;return u>=0?(n=(e.min.x-h.x)*u,i=(e.max.x-h.x)*u):(n=(e.max.x-h.x)*u,i=(e.min.x-h.x)*u),c>=0?(o=(e.min.y-h.y)*c,s=(e.max.y-h.y)*c):(o=(e.max.y-h.y)*c,s=(e.min.y-h.y)*c),n>s||o>i||((o>n||n!==n)&&(n=o),(s<i||i!==i)&&(i=s),f>=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,xr)!==null}intersectTriangle(e,t,n,i,o){yg.subVectors(t,e),kf.subVectors(n,e),vg.crossVectors(yg,kf);let s=this.direction.dot(vg),a;if(s>0){if(i)return null;a=1}else if(s<0)a=-1,s=-s;else return null;uo.subVectors(this.origin,e);let l=a*this.direction.dot(kf.crossVectors(uo,kf));if(l<0)return null;let u=a*this.direction.dot(yg.cross(uo));if(u<0||l+u>s)return null;let c=-a*uo.dot(vg);return c<0?null:this.at(c/s,o)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ae=class{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,o,s,a,l,u,c,f,h,p,d,g,x){let y=this.elements;return y[0]=e,y[4]=t,y[8]=n,y[12]=i,y[1]=o,y[5]=s,y[9]=a,y[13]=l,y[2]=u,y[6]=c,y[10]=f,y[14]=h,y[3]=p,y[7]=d,y[11]=g,y[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ae().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,i=1/za.setFromMatrixColumn(e,0).length(),o=1/za.setFromMatrixColumn(e,1).length(),s=1/za.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");let t=this.elements,n=e.x,i=e.y,o=e.z,s=Math.cos(n),a=Math.sin(n),l=Math.cos(i),u=Math.sin(i),c=Math.cos(o),f=Math.sin(o);if(e.order==="XYZ"){let h=s*c,p=s*f,d=a*c,g=a*f;t[0]=l*c,t[4]=-l*f,t[8]=u,t[1]=p+d*u,t[5]=h-g*u,t[9]=-a*l,t[2]=g-h*u,t[6]=d+p*u,t[10]=s*l}else if(e.order==="YXZ"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h+g*a,t[4]=d*a-p,t[8]=s*u,t[1]=s*f,t[5]=s*c,t[9]=-a,t[2]=p*a-d,t[6]=g+h*a,t[10]=s*l}else if(e.order==="ZXY"){let h=l*c,p=l*f,d=u*c,g=u*f;t[0]=h-g*a,t[4]=-s*f,t[8]=d+p*a,t[1]=p+d*a,t[5]=s*c,t[9]=g-h*a,t[2]=-s*u,t[6]=a,t[10]=s*l}else if(e.order==="ZYX"){let h=s*c,p=s*f,d=a*c,g=a*f;t[0]=l*c,t[4]=d*u-p,t[8]=h*u+g,t[1]=l*f,t[5]=g*u+h,t[9]=p*u-d,t[2]=-u,t[6]=a*l,t[10]=s*l}else if(e.order==="YZX"){let h=s*l,p=s*u,d=a*l,g=a*u;t[0]=l*c,t[4]=g-h*f,t[8]=d*f+p,t[1]=f,t[5]=s*c,t[9]=-a*c,t[2]=-u*c,t[6]=p*f+d,t[10]=h-g*f}else if(e.order==="XZY"){let h=s*l,p=s*u,d=a*l,g=a*u;t[0]=l*c,t[4]=-f,t[8]=u*c,t[1]=h*f+g,t[5]=s*c,t[9]=p*f-d,t[2]=d*f-p,t[6]=a*c,t[10]=g*f+h}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(AR,e,DR)}lookAt(e,t,n){let i=this.elements;return si.subVectors(e,t),si.lengthSq()===0&&(si.z=1),si.normalize(),co.crossVectors(n,si),co.lengthSq()===0&&(Math.abs(n.z)===1?si.x+=1e-4:si.z+=1e-4,si.normalize(),co.crossVectors(n,si)),co.normalize(),Bf.crossVectors(si,co),i[0]=co.x,i[4]=Bf.x,i[8]=si.x,i[1]=co.y,i[5]=Bf.y,i[9]=si.y,i[2]=co.z,i[6]=Bf.z,i[10]=si.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,o=this.elements,s=n[0],a=n[4],l=n[8],u=n[12],c=n[1],f=n[5],h=n[9],p=n[13],d=n[2],g=n[6],x=n[10],y=n[14],m=n[3],b=n[7],w=n[11],D=n[15],R=i[0],L=i[4],T=i[8],U=i[12],F=i[1],C=i[5],j=i[9],B=i[13],z=i[2],O=i[6],V=i[10],q=i[14],se=i[3],he=i[7],Y=i[11],X=i[15];return o[0]=s*R+a*F+l*z+u*se,o[4]=s*L+a*C+l*O+u*he,o[8]=s*T+a*j+l*V+u*Y,o[12]=s*U+a*B+l*q+u*X,o[1]=c*R+f*F+h*z+p*se,o[5]=c*L+f*C+h*O+p*he,o[9]=c*T+f*j+h*V+p*Y,o[13]=c*U+f*B+h*q+p*X,o[2]=d*R+g*F+x*z+y*se,o[6]=d*L+g*C+x*O+y*he,o[10]=d*T+g*j+x*V+y*Y,o[14]=d*U+g*B+x*q+y*X,o[3]=m*R+b*F+w*z+D*se,o[7]=m*L+b*C+w*O+D*he,o[11]=m*T+b*j+w*V+D*Y,o[15]=m*U+b*B+w*q+D*X,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],o=e[12],s=e[1],a=e[5],l=e[9],u=e[13],c=e[2],f=e[6],h=e[10],p=e[14],d=e[3],g=e[7],x=e[11],y=e[15];return d*(+o*l*f-i*u*f-o*a*h+n*u*h+i*a*p-n*l*p)+g*(+t*l*p-t*u*h+o*s*h-i*s*p+i*u*c-o*l*c)+x*(+t*u*f-t*a*p-o*s*f+n*s*p+o*a*c-n*u*c)+y*(-i*a*c-t*l*f+t*a*h+i*s*f-n*s*h+n*l*c)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],g=e[13],x=e[14],y=e[15],m=f*x*u-g*h*u+g*l*p-a*x*p-f*l*y+a*h*y,b=d*h*u-c*x*u-d*l*p+s*x*p+c*l*y-s*h*y,w=c*g*u-d*f*u+d*a*p-s*g*p-c*a*y+s*f*y,D=d*f*l-c*g*l-d*a*h+s*g*h+c*a*x-s*f*x,R=t*m+n*b+i*w+o*D;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let L=1/R;return e[0]=m*L,e[1]=(g*h*o-f*x*o-g*i*p+n*x*p+f*i*y-n*h*y)*L,e[2]=(a*x*o-g*l*o+g*i*u-n*x*u-a*i*y+n*l*y)*L,e[3]=(f*l*o-a*h*o-f*i*u+n*h*u+a*i*p-n*l*p)*L,e[4]=b*L,e[5]=(c*x*o-d*h*o+d*i*p-t*x*p-c*i*y+t*h*y)*L,e[6]=(d*l*o-s*x*o-d*i*u+t*x*u+s*i*y-t*l*y)*L,e[7]=(s*h*o-c*l*o+c*i*u-t*h*u-s*i*p+t*l*p)*L,e[8]=w*L,e[9]=(d*f*o-c*g*o-d*n*p+t*g*p+c*n*y-t*f*y)*L,e[10]=(s*g*o-d*a*o+d*n*u-t*g*u-s*n*y+t*a*y)*L,e[11]=(c*a*o-s*f*o-c*n*u+t*f*u+s*n*p-t*a*p)*L,e[12]=D*L,e[13]=(c*g*i-d*f*i+d*n*h-t*g*h-c*n*x+t*f*x)*L,e[14]=(d*a*i-s*g*i-d*n*l+t*g*l+s*n*x-t*a*x)*L,e[15]=(s*f*i-c*a*i+c*n*l-t*f*l-s*n*h+t*a*h)*L,this}scale(e){let t=this.elements,n=e.x,i=e.y,o=e.z;return t[0]*=n,t[4]*=i,t[8]*=o,t[1]*=n,t[5]*=i,t[9]*=o,t[2]*=n,t[6]*=i,t[10]*=o,t[3]*=n,t[7]*=i,t[11]*=o,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),o=1-n,s=e.x,a=e.y,l=e.z,u=o*s,c=o*a;return this.set(u*s+n,u*a-i*l,u*l+i*a,0,u*a+i*l,c*a+n,c*l-i*s,0,u*l-i*a,c*l+i*s,o*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,o,s){return this.set(1,n,o,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,o=t._x,s=t._y,a=t._z,l=t._w,u=o+o,c=s+s,f=a+a,h=o*u,p=o*c,d=o*f,g=s*c,x=s*f,y=a*f,m=l*u,b=l*c,w=l*f,D=n.x,R=n.y,L=n.z;return i[0]=(1-(g+y))*D,i[1]=(p+w)*D,i[2]=(d-b)*D,i[3]=0,i[4]=(p-w)*R,i[5]=(1-(h+y))*R,i[6]=(x+m)*R,i[7]=0,i[8]=(d+b)*L,i[9]=(x-m)*L,i[10]=(1-(h+g))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements,o=za.set(i[0],i[1],i[2]).length(),s=za.set(i[4],i[5],i[6]).length(),a=za.set(i[8],i[9],i[10]).length();this.determinant()<0&&(o=-o),e.x=i[12],e.y=i[13],e.z=i[14],Ei.copy(this);let u=1/o,c=1/s,f=1/a;return Ei.elements[0]*=u,Ei.elements[1]*=u,Ei.elements[2]*=u,Ei.elements[4]*=c,Ei.elements[5]*=c,Ei.elements[6]*=c,Ei.elements[8]*=f,Ei.elements[9]*=f,Ei.elements[10]*=f,t.setFromRotationMatrix(Ei),n.x=o,n.y=s,n.z=a,this}makePerspective(e,t,n,i,o,s){s===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");let a=this.elements,l=2*o/(t-e),u=2*o/(n-i),c=(t+e)/(t-e),f=(n+i)/(n-i),h=-(s+o)/(s-o),p=-2*s*o/(s-o);return a[0]=l,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=u,a[9]=f,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,o,s){let a=this.elements,l=1/(t-e),u=1/(n-i),c=1/(s-o),f=(t+e)*l,h=(n+i)*u,p=(s+o)*c;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-f,a[1]=0,a[5]=2*u,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};Ae.prototype.isMatrix4=!0;za=new M,Ei=new Ae,AR=new M(0,0,0),DR=new M(1,1,1),co=new M,Bf=new M,si=new M,r3=new Ae,o3=new ot,xn=class{constructor(e=0,t=0,n=0,i=xn.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,o=i[0],s=i[4],a=i[8],l=i[1],u=i[5],c=i[9],f=i[2],h=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(vn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(h,u),this._z=0);break;case"YXZ":this._x=Math.asin(-vn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-f,o),this._z=0);break;case"ZXY":this._x=Math.asin(vn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-s,u)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-vn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-s,u));break;case"YZX":this._z=Math.asin(vn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-f,o)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-vn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(h,u),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-c,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return r3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(r3,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return o3.setFromEuler(this),this.setFromQuaternion(o3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new M(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}};xn.prototype.isEuler=!0;xn.DefaultOrder="XYZ";xn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];zf=class{constructor(){this.mask=1|0}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=4294967295|0}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&(1<<e|0))!=0}},ER=0,s3=new M,Ia=new ot,br=new Ae,If=new M,ju=new M,MR=new M,RR=new ot,a3=new M(1,0,0),l3=new M(0,1,0),u3=new M(0,0,1),TR={type:"added"},c3={type:"removed"},je=class extends gr{constructor(){super();Object.defineProperty(this,"id",{value:ER++}),this.uuid=oi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=je.DefaultUp.clone();let e=new M,t=new xn,n=new ot,i=new M(1,1,1);function o(){n.setFromEuler(t,!1)}function s(){t.setFromQuaternion(n,void 0,!1)}t._onChange(o),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ae},normalMatrix:{value:new Qt}}),this.matrix=new Ae,this.matrixWorld=new Ae,this.matrixAutoUpdate=je.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new zf,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ia.setFromAxisAngle(e,t),this.quaternion.multiply(Ia),this}rotateOnWorldAxis(e,t){return Ia.setFromAxisAngle(e,t),this.quaternion.premultiply(Ia),this}rotateX(e){return this.rotateOnAxis(a3,e)}rotateY(e){return this.rotateOnAxis(l3,e)}rotateZ(e){return this.rotateOnAxis(u3,e)}translateOnAxis(e,t){return s3.copy(e).applyQuaternion(this.quaternion),this.position.add(s3.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(a3,e)}translateY(e){return this.translateOnAxis(l3,e)}translateZ(e){return this.translateOnAxis(u3,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(br.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?If.copy(e):If.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),ju.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?br.lookAt(ju,If,this.up):br.lookAt(If,ju,this.up),this.quaternion.setFromRotationMatrix(br),i&&(br.extractRotation(i.matrixWorld),Ia.setFromRotationMatrix(br),this.quaternion.premultiply(Ia.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(TR)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(c3)),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(c3)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),br.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),br.multiply(e.parent.matrixWorld)),e.applyMatrix4(br),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let s=this.children[n].getObjectByProperty(e,t);if(s!==void 0)return s}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ju,e,MR),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ju,RR,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){let i=this.children;for(let o=0,s=i.length;o<s;o++)i[o].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function o(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let u=0,c=l.length;u<c;u++){let f=l[u];o(e.shapes,f)}else o(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,u=this.material.length;l<u;l++)a.push(o(e.materials,this.material[l]));i.material=a}else i.material=o(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];i.animations.push(o(e.animations,l))}}if(t){let a=s(e.geometries),l=s(e.materials),u=s(e.textures),c=s(e.images),f=s(e.shapes),h=s(e.skeletons),p=s(e.animations);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),u.length>0&&(n.textures=u),c.length>0&&(n.images=c),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),p.length>0&&(n.animations=p)}return n.object=i,n;function s(a){let l=[];for(let u in a){let c=a[u];delete c.metadata,l.push(c)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}};je.DefaultUp=new M(0,1,0);je.DefaultMatrixAutoUpdate=!0;je.prototype.isObject3D=!0;Mi=new M,Sr=new M,xg=new M,Lr=new M,Ua=new M,Na=new M,h3=new M,wg=new M,bg=new M,Sg=new M,It=class{constructor(e=new M,t=new M,n=new M){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Mi.subVectors(e,t),i.cross(Mi);let o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,n,i,o){Mi.subVectors(i,t),Sr.subVectors(n,t),xg.subVectors(e,t);let s=Mi.dot(Mi),a=Mi.dot(Sr),l=Mi.dot(xg),u=Sr.dot(Sr),c=Sr.dot(xg),f=s*u-a*a;if(f===0)return o.set(-2,-1,-1);let h=1/f,p=(u*l-a*c)*h,d=(s*c-a*l)*h;return o.set(1-p-d,d,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Lr),Lr.x>=0&&Lr.y>=0&&Lr.x+Lr.y<=1}static getUV(e,t,n,i,o,s,a,l){return this.getBarycoord(e,t,n,i,Lr),l.set(0,0),l.addScaledVector(o,Lr.x),l.addScaledVector(s,Lr.y),l.addScaledVector(a,Lr.z),l}static isFrontFacing(e,t,n,i){return Mi.subVectors(n,t),Sr.subVectors(e,t),Mi.cross(Sr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Mi.subVectors(this.c,this.b),Sr.subVectors(this.a,this.b),Mi.cross(Sr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return It.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return It.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,o){return It.getUV(e,this.a,this.b,this.c,t,n,i,o)}containsPoint(e){return It.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return It.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,i=this.b,o=this.c,s,a;Ua.subVectors(i,n),Na.subVectors(o,n),wg.subVectors(e,n);let l=Ua.dot(wg),u=Na.dot(wg);if(l<=0&&u<=0)return t.copy(n);bg.subVectors(e,i);let c=Ua.dot(bg),f=Na.dot(bg);if(c>=0&&f<=c)return t.copy(i);let h=l*f-c*u;if(h<=0&&l>=0&&c<=0)return s=l/(l-c),t.copy(n).addScaledVector(Ua,s);Sg.subVectors(e,o);let p=Ua.dot(Sg),d=Na.dot(Sg);if(d>=0&&p<=d)return t.copy(o);let g=p*u-l*d;if(g<=0&&u>=0&&d<=0)return a=u/(u-d),t.copy(n).addScaledVector(Na,a);let x=c*d-p*f;if(x<=0&&f-c>=0&&p-d>=0)return h3.subVectors(o,i),a=(f-c)/(f-c+(p-d)),t.copy(i).addScaledVector(h3,a);let y=1/(x+g+h);return s=g*y,a=h*y,t.copy(n).addScaledVector(Ua,s).addScaledVector(Na,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},FR=0,Zt=class extends gr{constructor(){super();Object.defineProperty(this,"id",{value:FR++}),this.uuid=oi(),this.name="",this.type="Material",this.fog=!0,this.blending=Ea,this.side=ji,this.vertexColors=!1,this.opacity=1,this.format=gn,this.transparent=!1,this.blendSrc=V0,this.blendDst=H0,this.blendEquation=es,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=wf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Zb,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Rf,this.stencilZFail=Rf,this.stencilZPass=Rf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===I0;continue}let i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ea&&(n.blending=this.blending),this.side!==ji&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.format!==gn&&(n.format=this.format),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(o){let s=[];for(let a in o){let l=o[a];delete l.metadata,s.push(l)}return s}if(t){let o=i(e.textures),s=i(e.images);o.length>0&&(n.textures=o),s.length>0&&(n.images=s)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.format=e.format,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};Zt.prototype.isMaterial=!0;f3={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ri={h:0,s:0,l:0},Uf={h:0,s:0,l:0};xe=class{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=ag(e,1),t=vn(t,0,1),n=vn(n,0,1),t===0)this.r=this.g=this.b=n;else{let i=n<=.5?n*(1+t):n+t-n*t,o=2*n-i;this.r=Lg(o,i,e+1/3),this.g=Lg(o,i,e),this.b=Lg(o,i,e-1/3)}return this}setStyle(e){function t(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let i,o=n[1],s=n[2];switch(o){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){let a=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,u=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(a,l,u)}break}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=n[1],o=i.length;if(o===3)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(o===6)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){let t=f3[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e,t=2){return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e,t=2){let n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=Ag(e.r),this.g=Ag(e.g),this.b=Ag(e.b),this}copyLinearToSRGB(e){return this.r=Dg(e.r),this.g=Dg(e.g),this.b=Dg(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){let t=this.r,n=this.g,i=this.b,o=Math.max(t,n,i),s=Math.min(t,n,i),a,l,u=(s+o)/2;if(s===o)a=0,l=0;else{let c=o-s;switch(l=u<=.5?c/(o+s):c/(2-o-s),o){case t:a=(n-i)/c+(n<i?6:0);break;case n:a=(i-t)/c+2;break;case i:a=(t-n)/c+4;break}a/=6}return e.h=a,e.s=l,e.l=u,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,n){return this.getHSL(Ri),Ri.h+=e,Ri.s+=t,Ri.l+=n,this.setHSL(Ri.h,Ri.s,Ri.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Ri),e.getHSL(Uf);let n=Wu(Ri.h,Uf.h,t),i=Wu(Ri.s,Uf.s,t),o=Wu(Ri.l,Uf.l,t);return this.setHSL(n,i,o),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}};xe.NAMES=f3;xe.prototype.isColor=!0;xe.prototype.r=1;xe.prototype.g=1;xe.prototype.b=1;vt=class extends Zt{constructor(e){super();this.type="MeshBasicMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Fu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};vt.prototype.isMeshBasicMaterial=!0;Rt=new M,Nf=new ee,qe=class{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=Ta,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,o=this.itemSize;i<o;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){let t=this.array,n=0;for(let i=0,o=e.length;i<o;i++){let s=e[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),s=new xe),t[n++]=s.r,t[n++]=s.g,t[n++]=s.b}return this}copyVector2sArray(e){let t=this.array,n=0;for(let i=0,o=e.length;i<o;i++){let s=e[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),s=new ee),t[n++]=s.x,t[n++]=s.y}return this}copyVector3sArray(e){let t=this.array,n=0;for(let i=0,o=e.length;i<o;i++){let s=e[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),s=new M),t[n++]=s.x,t[n++]=s.y,t[n++]=s.z}return this}copyVector4sArray(e){let t=this.array,n=0;for(let i=0,o=e.length;i<o;i++){let s=e[i];s===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),s=new xt),t[n++]=s.x,t[n++]=s.y,t[n++]=s.z,t[n++]=s.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Nf.fromBufferAttribute(this,t),Nf.applyMatrix3(e),this.setXY(t,Nf.x,Nf.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Rt.fromBufferAttribute(this,t),Rt.applyMatrix3(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Rt.x=this.getX(t),Rt.y=this.getY(t),Rt.z=this.getZ(t),Rt.applyMatrix4(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Rt.x=this.getX(t),Rt.y=this.getY(t),Rt.z=this.getZ(t),Rt.applyNormalMatrix(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Rt.x=this.getX(t),Rt.y=this.getY(t),Rt.z=this.getZ(t),Rt.transformDirection(e),this.setXYZ(t,Rt.x,Rt.y,Rt.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,o){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=o,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Ta&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}};qe.prototype.isBufferAttribute=!0;Eg=class extends qe{constructor(e,t,n){super(new Int8Array(e),t,n)}},Mg=class extends qe{constructor(e,t,n){super(new Uint8Array(e),t,n)}},Rg=class extends qe{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},Tg=class extends qe{constructor(e,t,n){super(new Int16Array(e),t,n)}},Qu=class extends qe{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Fg=class extends qe{constructor(e,t,n){super(new Int32Array(e),t,n)}},Yu=class extends qe{constructor(e,t,n){super(new Uint32Array(e),t,n)}},_g=class extends qe{constructor(e,t,n){super(new Uint16Array(e),t,n)}};_g.prototype.isFloat16BufferAttribute=!0;Te=class extends qe{constructor(e,t,n){super(new Float32Array(e),t,n)}},Cg=class extends qe{constructor(e,t,n){super(new Float64Array(e),t,n)}},_R=0,mi=new Ae,Pg=new je,Oa=new M,ai=new Yn,Xu=new Yn,on=new M,Pe=class extends gr{constructor(){super();Object.defineProperty(this,"id",{value:_R++}),this.uuid=oi(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(e3(e)>65535?Yu:Qu)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let o=new Qt().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return mi.makeRotationFromQuaternion(e),this.applyMatrix4(mi),this}rotateX(e){return mi.makeRotationX(e),this.applyMatrix4(mi),this}rotateY(e){return mi.makeRotationY(e),this.applyMatrix4(mi),this}rotateZ(e){return mi.makeRotationZ(e),this.applyMatrix4(mi),this}translate(e,t,n){return mi.makeTranslation(e,t,n),this.applyMatrix4(mi),this}scale(e,t,n){return mi.makeScale(e,t,n),this.applyMatrix4(mi),this}lookAt(e){return Pg.lookAt(e),Pg.updateMatrix(),this.applyMatrix4(Pg.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Oa).negate(),this.translate(Oa.x,Oa.y,Oa.z),this}setFromPoints(e){let t=[];for(let n=0,i=e.length;n<i;n++){let o=e[n];t.push(o.x,o.y,o.z||0)}return this.setAttribute("position",new Te(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Yn);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let o=t[n];ai.setFromBufferAttribute(o),this.morphTargetsRelative?(on.addVectors(this.boundingBox.min,ai.min),this.boundingBox.expandByPoint(on),on.addVectors(this.boundingBox.max,ai.max),this.boundingBox.expandByPoint(on)):(this.boundingBox.expandByPoint(ai.min),this.boundingBox.expandByPoint(ai.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vr);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new M,1/0);return}if(e){let n=this.boundingSphere.center;if(ai.setFromBufferAttribute(e),t)for(let o=0,s=t.length;o<s;o++){let a=t[o];Xu.setFromBufferAttribute(a),this.morphTargetsRelative?(on.addVectors(ai.min,Xu.min),ai.expandByPoint(on),on.addVectors(ai.max,Xu.max),ai.expandByPoint(on)):(ai.expandByPoint(Xu.min),ai.expandByPoint(Xu.max))}ai.getCenter(n);let i=0;for(let o=0,s=e.count;o<s;o++)on.fromBufferAttribute(e,o),i=Math.max(i,n.distanceToSquared(on));if(t)for(let o=0,s=t.length;o<s;o++){let a=t[o],l=this.morphTargetsRelative;for(let u=0,c=a.count;u<c;u++)on.fromBufferAttribute(a,u),l&&(Oa.fromBufferAttribute(e,u),on.add(Oa)),i=Math.max(i,n.distanceToSquared(on))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.array,i=t.position.array,o=t.normal.array,s=t.uv.array,a=i.length/3;t.tangent===void 0&&this.setAttribute("tangent",new qe(new Float32Array(4*a),4));let l=t.tangent.array,u=[],c=[];for(let F=0;F<a;F++)u[F]=new M,c[F]=new M;let f=new M,h=new M,p=new M,d=new ee,g=new ee,x=new ee,y=new M,m=new M;function b(F,C,j){f.fromArray(i,F*3),h.fromArray(i,C*3),p.fromArray(i,j*3),d.fromArray(s,F*2),g.fromArray(s,C*2),x.fromArray(s,j*2),h.sub(f),p.sub(f),g.sub(d),x.sub(d);let B=1/(g.x*x.y-x.x*g.y);!isFinite(B)||(y.copy(h).multiplyScalar(x.y).addScaledVector(p,-g.y).multiplyScalar(B),m.copy(p).multiplyScalar(g.x).addScaledVector(h,-x.x).multiplyScalar(B),u[F].add(y),u[C].add(y),u[j].add(y),c[F].add(m),c[C].add(m),c[j].add(m))}let w=this.groups;w.length===0&&(w=[{start:0,count:n.length}]);for(let F=0,C=w.length;F<C;++F){let j=w[F],B=j.start,z=j.count;for(let O=B,V=B+z;O<V;O+=3)b(n[O+0],n[O+1],n[O+2])}let D=new M,R=new M,L=new M,T=new M;function U(F){L.fromArray(o,F*3),T.copy(L);let C=u[F];D.copy(C),D.sub(L.multiplyScalar(L.dot(C))).normalize(),R.crossVectors(T,C);let B=R.dot(c[F])<0?-1:1;l[F*4]=D.x,l[F*4+1]=D.y,l[F*4+2]=D.z,l[F*4+3]=B}for(let F=0,C=w.length;F<C;++F){let j=w[F],B=j.start,z=j.count;for(let O=B,V=B+z;O<V;O+=3)U(n[O+0]),U(n[O+1]),U(n[O+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new qe(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let h=0,p=n.count;h<p;h++)n.setXYZ(h,0,0,0);let i=new M,o=new M,s=new M,a=new M,l=new M,u=new M,c=new M,f=new M;if(e)for(let h=0,p=e.count;h<p;h+=3){let d=e.getX(h+0),g=e.getX(h+1),x=e.getX(h+2);i.fromBufferAttribute(t,d),o.fromBufferAttribute(t,g),s.fromBufferAttribute(t,x),c.subVectors(s,o),f.subVectors(i,o),c.cross(f),a.fromBufferAttribute(n,d),l.fromBufferAttribute(n,g),u.fromBufferAttribute(n,x),a.add(c),l.add(c),u.add(c),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(g,l.x,l.y,l.z),n.setXYZ(x,u.x,u.y,u.z)}else for(let h=0,p=t.count;h<p;h+=3)i.fromBufferAttribute(t,h+0),o.fromBufferAttribute(t,h+1),s.fromBufferAttribute(t,h+2),c.subVectors(s,o),f.subVectors(i,o),c.cross(f),n.setXYZ(h+0,c.x,c.y,c.z),n.setXYZ(h+1,c.x,c.y,c.z),n.setXYZ(h+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));let n=this.attributes;for(let i in n){if(e.attributes[i]===void 0)continue;let s=n[i].array,a=e.attributes[i],l=a.array,u=a.itemSize*t,c=Math.min(l.length,s.length-u);for(let f=0,h=u;f<c;f++,h++)s[h]=l[f]}return this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)on.fromBufferAttribute(e,t),on.normalize(),e.setXYZ(t,on.x,on.y,on.z)}toNonIndexed(){function e(a,l){let u=a.array,c=a.itemSize,f=a.normalized,h=new u.constructor(l.length*c),p=0,d=0;for(let g=0,x=l.length;g<x;g++){a.isInterleavedBufferAttribute?p=l[g]*a.data.stride+a.offset:p=l[g]*c;for(let y=0;y<c;y++)h[d++]=u[p++]}return new qe(h,c,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new Pe,n=this.index.array,i=this.attributes;for(let a in i){let l=i[a],u=e(l,n);t.setAttribute(a,u)}let o=this.morphAttributes;for(let a in o){let l=[],u=o[a];for(let c=0,f=u.length;c<f;c++){let h=u[c],p=e(h,n);l.push(p)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let a=0,l=s.length;a<l;a++){let u=s[a];t.addGroup(u.start,u.count,u.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let u=n[l];e.data.attributes[l]=u.toJSON(e.data)}let i={},o=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],c=[];for(let f=0,h=u.length;f<h;f++){let p=u[f];c.push(p.toJSON(e.data))}c.length>0&&(i[l]=c,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone(t));let i=e.attributes;for(let u in i){let c=i[u];this.setAttribute(u,c.clone(t))}let o=e.morphAttributes;for(let u in o){let c=[],f=o[u];for(let h=0,p=f.length;h<p;h++)c.push(f[h].clone(t));this.morphAttributes[u]=c}this.morphTargetsRelative=e.morphTargetsRelative;let s=e.groups;for(let u=0,c=s.length;u<c;u++){let f=s[u];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}};Pe.prototype.isBufferGeometry=!0;p3=new Ae,Ga=new wr,kg=new vr,ho=new M,fo=new M,po=new M,Bg=new M,zg=new M,Ig=new M,Of=new M,Gf=new M,Wf=new M,Vf=new ee,Hf=new ee,qf=new ee,Ug=new M,jf=new M,Lt=class extends je{constructor(e=new Pe,t=new vt){super();this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o<s;o++){let a=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){let n=this.geometry,i=this.material,o=this.matrixWorld;if(i===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),kg.copy(n.boundingSphere),kg.applyMatrix4(o),e.ray.intersectsSphere(kg)===!1)||(p3.copy(o).invert(),Ga.copy(e.ray).applyMatrix4(p3),n.boundingBox!==null&&Ga.intersectsBox(n.boundingBox)===!1))return;let s;if(n.isBufferGeometry){let a=n.index,l=n.attributes.position,u=n.morphAttributes.position,c=n.morphTargetsRelative,f=n.attributes.uv,h=n.attributes.uv2,p=n.groups,d=n.drawRange;if(a!==null)if(Array.isArray(i))for(let g=0,x=p.length;g<x;g++){let y=p[g],m=i[y.materialIndex],b=Math.max(y.start,d.start),w=Math.min(a.count,Math.min(y.start+y.count,d.start+d.count));for(let D=b,R=w;D<R;D+=3){let L=a.getX(D),T=a.getX(D+1),U=a.getX(D+2);s=Qf(this,m,e,Ga,l,u,c,f,h,L,T,U),s&&(s.faceIndex=Math.floor(D/3),s.face.materialIndex=y.materialIndex,t.push(s))}}else{let g=Math.max(0,d.start),x=Math.min(a.count,d.start+d.count);for(let y=g,m=x;y<m;y+=3){let b=a.getX(y),w=a.getX(y+1),D=a.getX(y+2);s=Qf(this,i,e,Ga,l,u,c,f,h,b,w,D),s&&(s.faceIndex=Math.floor(y/3),t.push(s))}}else if(l!==void 0)if(Array.isArray(i))for(let g=0,x=p.length;g<x;g++){let y=p[g],m=i[y.materialIndex],b=Math.max(y.start,d.start),w=Math.min(l.count,Math.min(y.start+y.count,d.start+d.count));for(let D=b,R=w;D<R;D+=3){let L=D,T=D+1,U=D+2;s=Qf(this,m,e,Ga,l,u,c,f,h,L,T,U),s&&(s.faceIndex=Math.floor(D/3),s.face.materialIndex=y.materialIndex,t.push(s))}}else{let g=Math.max(0,d.start),x=Math.min(l.count,d.start+d.count);for(let y=g,m=x;y<m;y+=3){let b=y,w=y+1,D=y+2;s=Qf(this,i,e,Ga,l,u,c,f,h,b,w,D),s&&(s.faceIndex=Math.floor(y/3),t.push(s))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}};Lt.prototype.isMesh=!0;Ti=class extends Pe{constructor(e=1,t=1,n=1,i=1,o=1,s=1){super();this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:o,depthSegments:s};let a=this;i=Math.floor(i),o=Math.floor(o),s=Math.floor(s);let l=[],u=[],c=[],f=[],h=0,p=0;d("z","y","x",-1,-1,n,t,e,s,o,0),d("z","y","x",1,-1,n,t,-e,s,o,1),d("x","z","y",1,1,e,n,t,i,s,2),d("x","z","y",1,-1,e,n,-t,i,s,3),d("x","y","z",1,-1,e,t,n,i,o,4),d("x","y","z",-1,-1,e,t,-n,i,o,5),this.setIndex(l),this.setAttribute("position",new Te(u,3)),this.setAttribute("normal",new Te(c,3)),this.setAttribute("uv",new Te(f,2));function d(g,x,y,m,b,w,D,R,L,T,U){let F=w/L,C=D/T,j=w/2,B=D/2,z=R/2,O=L+1,V=T+1,q=0,se=0,he=new M;for(let Y=0;Y<V;Y++){let X=Y*C-B;for(let ve=0;ve<O;ve++){let pe=ve*F-j;he[g]=pe*m,he[x]=X*b,he[y]=z,u.push(he.x,he.y,he.z),he[g]=0,he[x]=0,he[y]=R>0?1:-1,c.push(he.x,he.y,he.z),f.push(ve/L),f.push(1-Y/T),q+=1}}for(let Y=0;Y<T;Y++)for(let X=0;X<L;X++){let ve=h+X+O*Y,pe=h+X+O*(Y+1),Le=h+(X+1)+O*(Y+1),Ie=h+(X+1)+O*Y;l.push(ve,pe,Ie),l.push(pe,Le,Ie),se+=6}a.addGroup(p,se,U),p+=se,h+=q}}static fromJSON(e){return new Ti(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};d3={clone:Wa,merge:Dn},PR=`void main() {
|
|
1338
1338
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
1339
1339
|
}`,kR=`void main() {
|
|
1340
1340
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
@@ -1373,7 +1373,7 @@ Program Info Log: `+U+`
|
|
|
1373
1373
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
1374
1374
|
|
|
1375
1375
|
}
|
|
1376
|
-
`},i=new Ti(5,5,5),o=new Yi({name:"CubemapFromEquirect",uniforms:Wa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:At,blending:dr});o.uniforms.tEquirect.value=t;let s=new Lt(i,o),a=t.minFilter;return t.minFilter===is&&(t.minFilter=Kt),new Ku(1,10,this).update(e,s),t.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,n,i){let o=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(o)}};Zu.prototype.isWebGLCubeRenderTarget=!0;
|
|
1376
|
+
`},i=new Ti(5,5,5),o=new Yi({name:"CubemapFromEquirect",uniforms:Wa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:At,blending:dr});o.uniforms.tEquirect.value=t;let s=new Lt(i,o),a=t.minFilter;return t.minFilter===is&&(t.minFilter=Kt),new Ku(1,10,this).update(e,s),t.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,n,i){let o=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,n,i);e.setRenderTarget(o)}};Zu.prototype.isWebGLCubeRenderTarget=!0;Ng=new M,BR=new M,zR=new Qt,Fi=class{constructor(e=new M(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let i=Ng.subVectors(n,t).cross(BR.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){let n=e.delta(Ng),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/i;return o<0||o>1?null:t.copy(n).multiplyScalar(o).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||zR.getNormalMatrix(e),i=this.coplanarPoint(Ng).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}};Fi.prototype.isPlane=!0;ja=new vr,Yf=new M,Qa=class{constructor(e=new Fi,t=new Fi,n=new Fi,i=new Fi,o=new Fi,s=new Fi){this.planes=[e,t,n,i,o,s]}set(e,t,n,i,o,s){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(o),a[5].copy(s),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){let t=this.planes,n=e.elements,i=n[0],o=n[1],s=n[2],a=n[3],l=n[4],u=n[5],c=n[6],f=n[7],h=n[8],p=n[9],d=n[10],g=n[11],x=n[12],y=n[13],m=n[14],b=n[15];return t[0].setComponents(a-i,f-l,g-h,b-x).normalize(),t[1].setComponents(a+i,f+l,g+h,b+x).normalize(),t[2].setComponents(a+o,f+u,g+p,b+y).normalize(),t[3].setComponents(a-o,f-u,g-p,b-y).normalize(),t[4].setComponents(a-s,f-c,g-d,b-m).normalize(),t[5].setComponents(a+s,f+c,g+d,b+m).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),ja.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ja)}intersectsSprite(e){return ja.center.set(0,0,0),ja.radius=.7071067811865476,ja.applyMatrix4(e.matrixWorld),this.intersectsSphere(ja)}intersectsSphere(e){let t=this.planes,n=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let i=t[n];if(Yf.x=i.normal.x>0?e.max.x:e.min.x,Yf.y=i.normal.y>0?e.max.y:e.min.y,Yf.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Yf)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};ds=class extends Pe{constructor(e=1,t=1,n=1,i=1){super();this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};let o=e/2,s=t/2,a=Math.floor(n),l=Math.floor(i),u=a+1,c=l+1,f=e/a,h=t/l,p=[],d=[],g=[],x=[];for(let y=0;y<c;y++){let m=y*h-s;for(let b=0;b<u;b++){let w=b*f-o;d.push(w,-m,0),g.push(0,0,1),x.push(b/a),x.push(1-y/l)}}for(let y=0;y<l;y++)for(let m=0;m<a;m++){let b=m+u*y,w=m+u*(y+1),D=m+1+u*(y+1),R=m+1+u*y;p.push(b,w,R),p.push(w,D,R)}this.setIndex(p),this.setAttribute("position",new Te(d,3)),this.setAttribute("normal",new Te(g,3)),this.setAttribute("uv",new Te(x,2))}static fromJSON(e){return new ds(e.width,e.height,e.widthSegments,e.heightSegments)}},UR=`#ifdef USE_ALPHAMAP
|
|
1377
1377
|
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
|
|
1378
1378
|
#endif`,NR=`#ifdef USE_ALPHAMAP
|
|
1379
1379
|
uniform sampler2D alphaMap;
|
|
@@ -4149,7 +4149,7 @@ void main() {
|
|
|
4149
4149
|
#include <tonemapping_fragment>
|
|
4150
4150
|
#include <encodings_fragment>
|
|
4151
4151
|
#include <fog_fragment>
|
|
4152
|
-
}`,$e={alphamap_fragment:UR,alphamap_pars_fragment:NR,alphatest_fragment:OR,alphatest_pars_fragment:GR,aomap_fragment:WR,aomap_pars_fragment:VR,begin_vertex:HR,beginnormal_vertex:qR,bsdfs:jR,bumpmap_pars_fragment:QR,clipping_planes_fragment:YR,clipping_planes_pars_fragment:XR,clipping_planes_pars_vertex:KR,clipping_planes_vertex:ZR,color_fragment:JR,color_pars_fragment:$R,color_pars_vertex:eT,color_vertex:tT,common:nT,cube_uv_reflection_fragment:iT,defaultnormal_vertex:rT,displacementmap_pars_vertex:oT,displacementmap_vertex:sT,emissivemap_fragment:aT,emissivemap_pars_fragment:lT,encodings_fragment:uT,encodings_pars_fragment:cT,envmap_fragment:hT,envmap_common_pars_fragment:fT,envmap_pars_fragment:pT,envmap_pars_vertex:dT,envmap_physical_pars_fragment:DT,envmap_vertex:mT,fog_vertex:gT,fog_pars_vertex:yT,fog_fragment:vT,fog_pars_fragment:xT,gradientmap_pars_fragment:wT,lightmap_fragment:bT,lightmap_pars_fragment:ST,lights_lambert_vertex:LT,lights_pars_begin:AT,lights_toon_fragment:ET,lights_toon_pars_fragment:MT,lights_phong_fragment:RT,lights_phong_pars_fragment:TT,lights_physical_fragment:FT,lights_physical_pars_fragment:_T,lights_fragment_begin:CT,lights_fragment_maps:PT,lights_fragment_end:kT,logdepthbuf_fragment:BT,logdepthbuf_pars_fragment:zT,logdepthbuf_pars_vertex:IT,logdepthbuf_vertex:UT,map_fragment:NT,map_pars_fragment:OT,map_particle_fragment:GT,map_particle_pars_fragment:WT,metalnessmap_fragment:VT,metalnessmap_pars_fragment:HT,morphnormal_vertex:qT,morphtarget_pars_vertex:jT,morphtarget_vertex:QT,normal_fragment_begin:YT,normal_fragment_maps:XT,normal_pars_fragment:KT,normal_pars_vertex:ZT,normal_vertex:JT,normalmap_pars_fragment:$T,clearcoat_normal_fragment_begin:e8,clearcoat_normal_fragment_maps:t8,clearcoat_pars_fragment:n8,output_fragment:i8,packing:r8,premultiplied_alpha_fragment:o8,project_vertex:s8,dithering_fragment:a8,dithering_pars_fragment:l8,roughnessmap_fragment:u8,roughnessmap_pars_fragment:c8,shadowmap_pars_fragment:h8,shadowmap_pars_vertex:f8,shadowmap_vertex:p8,shadowmask_pars_fragment:d8,skinbase_vertex:m8,skinning_pars_vertex:g8,skinning_vertex:y8,skinnormal_vertex:v8,specularmap_fragment:x8,specularmap_pars_fragment:w8,tonemapping_fragment:b8,tonemapping_pars_fragment:S8,transmission_fragment:L8,transmission_pars_fragment:A8,uv_pars_fragment:D8,uv_pars_vertex:E8,uv_vertex:M8,uv2_pars_fragment:R8,uv2_pars_vertex:T8,uv2_vertex:F8,worldpos_vertex:_8,background_vert:C8,background_frag:P8,cube_vert:k8,cube_frag:B8,depth_vert:z8,depth_frag:I8,distanceRGBA_vert:U8,distanceRGBA_frag:N8,equirect_vert:O8,equirect_frag:G8,linedashed_vert:W8,linedashed_frag:V8,meshbasic_vert:H8,meshbasic_frag:q8,meshlambert_vert:j8,meshlambert_frag:Q8,meshmatcap_vert:Y8,meshmatcap_frag:X8,meshnormal_vert:K8,meshnormal_frag:Z8,meshphong_vert:J8,meshphong_frag:$8,meshphysical_vert:e5,meshphysical_frag:t5,meshtoon_vert:n5,meshtoon_frag:i5,points_vert:r5,points_frag:o5,shadow_vert:s5,shadow_frag:a5,sprite_vert:l5,sprite_frag:u5},we={common:{diffuse:{value:new xe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Qt},uv2Transform:{value:new Qt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new ee(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Qt}},sprite:{diffuse:{value:new xe(16777215)},opacity:{value:1},center:{value:new ee(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Qt}}},_i={basic:{uniforms:Dn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.fog]),vertexShader:$e.meshbasic_vert,fragmentShader:$e.meshbasic_frag},lambert:{uniforms:Dn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.fog,we.lights,{emissive:{value:new xe(0)}}]),vertexShader:$e.meshlambert_vert,fragmentShader:$e.meshlambert_frag},phong:{uniforms:Dn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new xe(0)},specular:{value:new xe(1118481)},shininess:{value:30}}]),vertexShader:$e.meshphong_vert,fragmentShader:$e.meshphong_frag},standard:{uniforms:Dn([we.common,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.roughnessmap,we.metalnessmap,we.fog,we.lights,{emissive:{value:new xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},toon:{uniforms:Dn([we.common,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.gradientmap,we.fog,we.lights,{emissive:{value:new xe(0)}}]),vertexShader:$e.meshtoon_vert,fragmentShader:$e.meshtoon_frag},matcap:{uniforms:Dn([we.common,we.bumpmap,we.normalmap,we.displacementmap,we.fog,{matcap:{value:null}}]),vertexShader:$e.meshmatcap_vert,fragmentShader:$e.meshmatcap_frag},points:{uniforms:Dn([we.points,we.fog]),vertexShader:$e.points_vert,fragmentShader:$e.points_frag},dashed:{uniforms:Dn([we.common,we.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$e.linedashed_vert,fragmentShader:$e.linedashed_frag},depth:{uniforms:Dn([we.common,we.displacementmap]),vertexShader:$e.depth_vert,fragmentShader:$e.depth_frag},normal:{uniforms:Dn([we.common,we.bumpmap,we.normalmap,we.displacementmap,{opacity:{value:1}}]),vertexShader:$e.meshnormal_vert,fragmentShader:$e.meshnormal_frag},sprite:{uniforms:Dn([we.sprite,we.fog]),vertexShader:$e.sprite_vert,fragmentShader:$e.sprite_frag},background:{uniforms:{uvTransform:{value:new Qt},t2D:{value:null}},vertexShader:$e.background_vert,fragmentShader:$e.background_frag},cube:{uniforms:Dn([we.envmap,{opacity:{value:1}}]),vertexShader:$e.cube_vert,fragmentShader:$e.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$e.equirect_vert,fragmentShader:$e.equirect_frag},distanceRGBA:{uniforms:Dn([we.common,we.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$e.distanceRGBA_vert,fragmentShader:$e.distanceRGBA_frag},shadow:{uniforms:Dn([we.lights,we.fog,{color:{value:new xe(0)},opacity:{value:1}}]),vertexShader:$e.shadow_vert,fragmentShader:$e.shadow_frag}};_i.physical={uniforms:Dn([_i.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new ee(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new xe(0)},sheenColorMap:{value:null},sheenRoughness:{value:0},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new ee},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new xe(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularColor:{value:new xe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag};Ya=class extends Va{constructor(e=-1,t=1,n=1,i=-1,o=.1,s=2e3){super();this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=o,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,o,s){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=o,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,o=n-e,s=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){let u=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=u*this.view.offsetX,s=o+u*this.view.width,a-=c*this.view.offsetY,l=a-c*this.view.height}this.projectionMatrix.makeOrthographic(o,s,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};Ya.prototype.isOrthographicCamera=!0;ms=class extends Yi{constructor(e){super(e);this.type="RawShaderMaterial"}};ms.prototype.isRawShaderMaterial=!0;Xa=4,mo=8,Xi=Math.pow(2,mo),m3=[.125,.215,.35,.446,.526,.582],g3=mo-Xa+1+m3.length,Ka=20,gs={[Pn]:0,[Ou]:1,[Mf]:2,[ng]:3,[ig]:4,[rg]:5,[Ef]:6},Ng=new Ya,{_lodPlanes:Ju,_sizeLods:y3,_sigmas:Xf}=y5(),v3=new xe,Og=null,ys=(1+Math.sqrt(5))/2,Za=1/ys,x3=[new M(1,1,1),new M(-1,1,1),new M(1,1,-1),new M(-1,1,-1),new M(0,ys,Za),new M(0,ys,-Za),new M(Za,0,ys),new M(-Za,0,ys),new M(ys,Za,0),new M(-ys,Za,0)],Gg=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=v5(Ka),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Og=this._renderer.getRenderTarget();let o=this._allocateTargets();return this._sceneToCubeUV(e,n,i,o),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=S3(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=b3(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e<Ju.length;e++)Ju[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Og),e.scissorTest=!1,Kf(e,0,0,e.width,e.height)}_fromTexture(e){Og=this._renderer.getRenderTarget();let t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){let t={magFilter:jt,minFilter:jt,generateMipmaps:!1,type:mr,format:sb,encoding:g5(e)?e.encoding:Mf,depthBuffer:!1},n=w3(t);return n.depthBuffer=!e,this._pingPongRenderTarget=w3(t),n}_compileMaterial(e){let t=new Lt(Ju[0],e);this._renderer.compile(t,Ng)}_sceneToCubeUV(e,t,n,i){let o=90,s=1,a=new Gt(o,s,t,n),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],c=this._renderer,f=c.autoClear,h=c.outputEncoding,p=c.toneMapping;c.getClearColor(v3),c.toneMapping=io,c.outputEncoding=Pn,c.autoClear=!1;let d=new vt({name:"PMREM.Background",side:At,depthWrite:!1,depthTest:!1}),g=new Lt(new Ti,d),x=!1,y=e.background;y?y.isColor&&(d.color.copy(y),e.background=null,x=!0):(d.color.copy(v3),x=!0);for(let m=0;m<6;m++){let b=m%3;b==0?(a.up.set(0,l[m],0),a.lookAt(u[m],0,0)):b==1?(a.up.set(0,0,l[m]),a.lookAt(0,u[m],0)):(a.up.set(0,l[m],0),a.lookAt(0,0,u[m])),Kf(i,b*Xi,m>2?Xi:0,Xi,Xi),c.setRenderTarget(i),x&&c.render(g,a),c.render(e,a)}g.geometry.dispose(),g.material.dispose(),c.toneMapping=p,c.outputEncoding=h,c.autoClear=f,e.background=y}_setEncoding(e,t){e.value=gs[t.encoding]}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===ts||e.mapping===ns;i?this._cubemapShader==null&&(this._cubemapShader=S3()):this._equirectShader==null&&(this._equirectShader=b3());let o=i?this._cubemapShader:this._equirectShader,s=new Lt(Ju[0],o),a=o.uniforms;a.envMap.value=e,i||a.texelSize.value.set(1/e.image.width,1/e.image.height),this._setEncoding(a.inputEncoding,e),this._setEncoding(a.outputEncoding,t.texture),Kf(t,0,0,3*Xi,2*Xi),n.setRenderTarget(t),n.render(s,Ng)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<g3;i++){let o=Math.sqrt(Xf[i]*Xf[i]-Xf[i-1]*Xf[i-1]),s=x3[(i-1)%x3.length];this._blur(e,i-1,i,o,s)}t.autoClear=n}_blur(e,t,n,i,o){let s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",o),this._halfBlur(s,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,s,a){let l=this._renderer,u=this._blurMaterial;s!=="latitudinal"&&s!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let c=3,f=new Lt(Ju[i],u),h=u.uniforms,p=y3[n]-1,d=isFinite(o)?Math.PI/(2*p):2*Math.PI/(2*Ka-1),g=o/d,x=isFinite(o)?1+Math.floor(c*g):Ka;x>Ka&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Ka}`);let y=[],m=0;for(let R=0;R<Ka;++R){let L=R/g,T=Math.exp(-L*L/2);y.push(T),R==0?m+=T:R<x&&(m+=2*T)}for(let R=0;R<y.length;R++)y[R]=y[R]/m;h.envMap.value=e.texture,h.samples.value=x,h.weights.value=y,h.latitudinal.value=s==="latitudinal",a&&(h.poleAxis.value=a),h.dTheta.value=d,h.mipInt.value=mo-n,this._setEncoding(h.inputEncoding,e.texture),this._setEncoding(h.outputEncoding,e.texture);let b=y3[i],w=3*Math.max(0,Xi-2*b),D=(i===0?0:2*Xi)+2*b*(i>mo-Xa?i-mo+Xa:0);Kf(t,w,D,3*b,2*b),l.setRenderTarget(t),l.render(f,Ng)}};$u=class extends Yt{constructor(e=null,t=1,n=1,i=1){super(null);this.image={data:e,width:t,height:n,depth:i},this.magFilter=jt,this.minFilter=jt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};$u.prototype.isDataTexture2DArray=!0;Zf=class extends Yt{constructor(e=null,t=1,n=1,i=1){super(null);this.image={data:e,width:t,height:n,depth:i},this.magFilter=jt,this.minFilter=jt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};Zf.prototype.isDataTexture3D=!0;A3=new Yt,D3=new $u,E3=new Zf,M3=new ps,R3=[],T3=[],F3=new Float32Array(16),_3=new Float32Array(9),C3=new Float32Array(4);P3.prototype.updateCache=function(r){let e=this.cache;r instanceof Float32Array&&e.length!==r.length&&(this.cache=new Float32Array(r.length)),En(e,r)};k3.prototype.setValue=function(r,e,t){let n=this.seq;for(let i=0,o=n.length;i!==o;++i){let s=n[i];s.setValue(r,e[s.id],t)}};Hg=/(\w+)(\])?(\[|\.)?/g;go.prototype.setValue=function(r,e,t,n){let i=this.map[e];i!==void 0&&i.setValue(r,t,n)};go.prototype.setOptional=function(r,e,t){let n=e[t];n!==void 0&&this.setValue(r,t,n)};go.upload=function(r,e,t,n){for(let i=0,o=e.length;i!==o;++i){let s=e[i],a=t[s.id];a.needsUpdate!==!1&&s.setValue(r,a.value,n)}};go.seqWithValue=function(r,e){let t=[];for(let n=0,i=r.length;n!==i;++n){let o=r[n];o.id in e&&t.push(o)}return t};g4=0;L4=/^[ \t]*#include +<([\w\d./]+)>/gm;D4=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,E4=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;N4=0;tc=class extends Zt{constructor(e){super();this.type="MeshDepthMaterial",this.depthPacking=Qb,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};tc.prototype.isMeshDepthMaterial=!0;nc=class extends Zt{constructor(e){super();this.type="MeshDistanceMaterial",this.referencePosition=new M,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};nc.prototype.isMeshDistanceMaterial=!0;V4=`void main() {
|
|
4152
|
+
}`,$e={alphamap_fragment:UR,alphamap_pars_fragment:NR,alphatest_fragment:OR,alphatest_pars_fragment:GR,aomap_fragment:WR,aomap_pars_fragment:VR,begin_vertex:HR,beginnormal_vertex:qR,bsdfs:jR,bumpmap_pars_fragment:QR,clipping_planes_fragment:YR,clipping_planes_pars_fragment:XR,clipping_planes_pars_vertex:KR,clipping_planes_vertex:ZR,color_fragment:JR,color_pars_fragment:$R,color_pars_vertex:eT,color_vertex:tT,common:nT,cube_uv_reflection_fragment:iT,defaultnormal_vertex:rT,displacementmap_pars_vertex:oT,displacementmap_vertex:sT,emissivemap_fragment:aT,emissivemap_pars_fragment:lT,encodings_fragment:uT,encodings_pars_fragment:cT,envmap_fragment:hT,envmap_common_pars_fragment:fT,envmap_pars_fragment:pT,envmap_pars_vertex:dT,envmap_physical_pars_fragment:DT,envmap_vertex:mT,fog_vertex:gT,fog_pars_vertex:yT,fog_fragment:vT,fog_pars_fragment:xT,gradientmap_pars_fragment:wT,lightmap_fragment:bT,lightmap_pars_fragment:ST,lights_lambert_vertex:LT,lights_pars_begin:AT,lights_toon_fragment:ET,lights_toon_pars_fragment:MT,lights_phong_fragment:RT,lights_phong_pars_fragment:TT,lights_physical_fragment:FT,lights_physical_pars_fragment:_T,lights_fragment_begin:CT,lights_fragment_maps:PT,lights_fragment_end:kT,logdepthbuf_fragment:BT,logdepthbuf_pars_fragment:zT,logdepthbuf_pars_vertex:IT,logdepthbuf_vertex:UT,map_fragment:NT,map_pars_fragment:OT,map_particle_fragment:GT,map_particle_pars_fragment:WT,metalnessmap_fragment:VT,metalnessmap_pars_fragment:HT,morphnormal_vertex:qT,morphtarget_pars_vertex:jT,morphtarget_vertex:QT,normal_fragment_begin:YT,normal_fragment_maps:XT,normal_pars_fragment:KT,normal_pars_vertex:ZT,normal_vertex:JT,normalmap_pars_fragment:$T,clearcoat_normal_fragment_begin:e8,clearcoat_normal_fragment_maps:t8,clearcoat_pars_fragment:n8,output_fragment:i8,packing:r8,premultiplied_alpha_fragment:o8,project_vertex:s8,dithering_fragment:a8,dithering_pars_fragment:l8,roughnessmap_fragment:u8,roughnessmap_pars_fragment:c8,shadowmap_pars_fragment:h8,shadowmap_pars_vertex:f8,shadowmap_vertex:p8,shadowmask_pars_fragment:d8,skinbase_vertex:m8,skinning_pars_vertex:g8,skinning_vertex:y8,skinnormal_vertex:v8,specularmap_fragment:x8,specularmap_pars_fragment:w8,tonemapping_fragment:b8,tonemapping_pars_fragment:S8,transmission_fragment:L8,transmission_pars_fragment:A8,uv_pars_fragment:D8,uv_pars_vertex:E8,uv_vertex:M8,uv2_pars_fragment:R8,uv2_pars_vertex:T8,uv2_vertex:F8,worldpos_vertex:_8,background_vert:C8,background_frag:P8,cube_vert:k8,cube_frag:B8,depth_vert:z8,depth_frag:I8,distanceRGBA_vert:U8,distanceRGBA_frag:N8,equirect_vert:O8,equirect_frag:G8,linedashed_vert:W8,linedashed_frag:V8,meshbasic_vert:H8,meshbasic_frag:q8,meshlambert_vert:j8,meshlambert_frag:Q8,meshmatcap_vert:Y8,meshmatcap_frag:X8,meshnormal_vert:K8,meshnormal_frag:Z8,meshphong_vert:J8,meshphong_frag:$8,meshphysical_vert:e5,meshphysical_frag:t5,meshtoon_vert:n5,meshtoon_frag:i5,points_vert:r5,points_frag:o5,shadow_vert:s5,shadow_frag:a5,sprite_vert:l5,sprite_frag:u5},we={common:{diffuse:{value:new xe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Qt},uv2Transform:{value:new Qt},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new ee(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new xe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Qt}},sprite:{diffuse:{value:new xe(16777215)},opacity:{value:1},center:{value:new ee(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Qt}}},_i={basic:{uniforms:Dn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.fog]),vertexShader:$e.meshbasic_vert,fragmentShader:$e.meshbasic_frag},lambert:{uniforms:Dn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.fog,we.lights,{emissive:{value:new xe(0)}}]),vertexShader:$e.meshlambert_vert,fragmentShader:$e.meshlambert_frag},phong:{uniforms:Dn([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new xe(0)},specular:{value:new xe(1118481)},shininess:{value:30}}]),vertexShader:$e.meshphong_vert,fragmentShader:$e.meshphong_frag},standard:{uniforms:Dn([we.common,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.roughnessmap,we.metalnessmap,we.fog,we.lights,{emissive:{value:new xe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},toon:{uniforms:Dn([we.common,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.gradientmap,we.fog,we.lights,{emissive:{value:new xe(0)}}]),vertexShader:$e.meshtoon_vert,fragmentShader:$e.meshtoon_frag},matcap:{uniforms:Dn([we.common,we.bumpmap,we.normalmap,we.displacementmap,we.fog,{matcap:{value:null}}]),vertexShader:$e.meshmatcap_vert,fragmentShader:$e.meshmatcap_frag},points:{uniforms:Dn([we.points,we.fog]),vertexShader:$e.points_vert,fragmentShader:$e.points_frag},dashed:{uniforms:Dn([we.common,we.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$e.linedashed_vert,fragmentShader:$e.linedashed_frag},depth:{uniforms:Dn([we.common,we.displacementmap]),vertexShader:$e.depth_vert,fragmentShader:$e.depth_frag},normal:{uniforms:Dn([we.common,we.bumpmap,we.normalmap,we.displacementmap,{opacity:{value:1}}]),vertexShader:$e.meshnormal_vert,fragmentShader:$e.meshnormal_frag},sprite:{uniforms:Dn([we.sprite,we.fog]),vertexShader:$e.sprite_vert,fragmentShader:$e.sprite_frag},background:{uniforms:{uvTransform:{value:new Qt},t2D:{value:null}},vertexShader:$e.background_vert,fragmentShader:$e.background_frag},cube:{uniforms:Dn([we.envmap,{opacity:{value:1}}]),vertexShader:$e.cube_vert,fragmentShader:$e.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$e.equirect_vert,fragmentShader:$e.equirect_frag},distanceRGBA:{uniforms:Dn([we.common,we.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$e.distanceRGBA_vert,fragmentShader:$e.distanceRGBA_frag},shadow:{uniforms:Dn([we.lights,we.fog,{color:{value:new xe(0)},opacity:{value:1}}]),vertexShader:$e.shadow_vert,fragmentShader:$e.shadow_frag}};_i.physical={uniforms:Dn([_i.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new ee(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new xe(0)},sheenColorMap:{value:null},sheenRoughness:{value:0},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new ee},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new xe(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularColor:{value:new xe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag};Ya=class extends Va{constructor(e=-1,t=1,n=1,i=-1,o=.1,s=2e3){super();this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=o,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,o,s){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=o,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,o=n-e,s=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){let u=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=u*this.view.offsetX,s=o+u*this.view.width,a-=c*this.view.offsetY,l=a-c*this.view.height}this.projectionMatrix.makeOrthographic(o,s,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}};Ya.prototype.isOrthographicCamera=!0;ms=class extends Yi{constructor(e){super(e);this.type="RawShaderMaterial"}};ms.prototype.isRawShaderMaterial=!0;Xa=4,mo=8,Xi=Math.pow(2,mo),g3=[.125,.215,.35,.446,.526,.582],y3=mo-Xa+1+g3.length,Ka=20,gs={[Pn]:0,[Ou]:1,[Mf]:2,[ig]:3,[rg]:4,[og]:5,[Ef]:6},Og=new Ya,{_lodPlanes:Ju,_sizeLods:v3,_sigmas:Xf}=y5(),x3=new xe,Gg=null,ys=(1+Math.sqrt(5))/2,Za=1/ys,w3=[new M(1,1,1),new M(-1,1,1),new M(1,1,-1),new M(-1,1,-1),new M(0,ys,Za),new M(0,ys,-Za),new M(Za,0,ys),new M(-Za,0,ys),new M(ys,Za,0),new M(-ys,Za,0)],Wg=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=v5(Ka),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Gg=this._renderer.getRenderTarget();let o=this._allocateTargets();return this._sceneToCubeUV(e,n,i,o),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=L3(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=S3(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e<Ju.length;e++)Ju[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Gg),e.scissorTest=!1,Kf(e,0,0,e.width,e.height)}_fromTexture(e){Gg=this._renderer.getRenderTarget();let t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){let t={magFilter:jt,minFilter:jt,generateMipmaps:!1,type:mr,format:ab,encoding:g5(e)?e.encoding:Mf,depthBuffer:!1},n=b3(t);return n.depthBuffer=!e,this._pingPongRenderTarget=b3(t),n}_compileMaterial(e){let t=new Lt(Ju[0],e);this._renderer.compile(t,Og)}_sceneToCubeUV(e,t,n,i){let o=90,s=1,a=new Gt(o,s,t,n),l=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],c=this._renderer,f=c.autoClear,h=c.outputEncoding,p=c.toneMapping;c.getClearColor(x3),c.toneMapping=io,c.outputEncoding=Pn,c.autoClear=!1;let d=new vt({name:"PMREM.Background",side:At,depthWrite:!1,depthTest:!1}),g=new Lt(new Ti,d),x=!1,y=e.background;y?y.isColor&&(d.color.copy(y),e.background=null,x=!0):(d.color.copy(x3),x=!0);for(let m=0;m<6;m++){let b=m%3;b==0?(a.up.set(0,l[m],0),a.lookAt(u[m],0,0)):b==1?(a.up.set(0,0,l[m]),a.lookAt(0,u[m],0)):(a.up.set(0,l[m],0),a.lookAt(0,0,u[m])),Kf(i,b*Xi,m>2?Xi:0,Xi,Xi),c.setRenderTarget(i),x&&c.render(g,a),c.render(e,a)}g.geometry.dispose(),g.material.dispose(),c.toneMapping=p,c.outputEncoding=h,c.autoClear=f,e.background=y}_setEncoding(e,t){e.value=gs[t.encoding]}_textureToCubeUV(e,t){let n=this._renderer,i=e.mapping===ts||e.mapping===ns;i?this._cubemapShader==null&&(this._cubemapShader=L3()):this._equirectShader==null&&(this._equirectShader=S3());let o=i?this._cubemapShader:this._equirectShader,s=new Lt(Ju[0],o),a=o.uniforms;a.envMap.value=e,i||a.texelSize.value.set(1/e.image.width,1/e.image.height),this._setEncoding(a.inputEncoding,e),this._setEncoding(a.outputEncoding,t.texture),Kf(t,0,0,3*Xi,2*Xi),n.setRenderTarget(t),n.render(s,Og)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;i<y3;i++){let o=Math.sqrt(Xf[i]*Xf[i]-Xf[i-1]*Xf[i-1]),s=w3[(i-1)%w3.length];this._blur(e,i-1,i,o,s)}t.autoClear=n}_blur(e,t,n,i,o){let s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",o),this._halfBlur(s,e,n,n,i,"longitudinal",o)}_halfBlur(e,t,n,i,o,s,a){let l=this._renderer,u=this._blurMaterial;s!=="latitudinal"&&s!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let c=3,f=new Lt(Ju[i],u),h=u.uniforms,p=v3[n]-1,d=isFinite(o)?Math.PI/(2*p):2*Math.PI/(2*Ka-1),g=o/d,x=isFinite(o)?1+Math.floor(c*g):Ka;x>Ka&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Ka}`);let y=[],m=0;for(let R=0;R<Ka;++R){let L=R/g,T=Math.exp(-L*L/2);y.push(T),R==0?m+=T:R<x&&(m+=2*T)}for(let R=0;R<y.length;R++)y[R]=y[R]/m;h.envMap.value=e.texture,h.samples.value=x,h.weights.value=y,h.latitudinal.value=s==="latitudinal",a&&(h.poleAxis.value=a),h.dTheta.value=d,h.mipInt.value=mo-n,this._setEncoding(h.inputEncoding,e.texture),this._setEncoding(h.outputEncoding,e.texture);let b=v3[i],w=3*Math.max(0,Xi-2*b),D=(i===0?0:2*Xi)+2*b*(i>mo-Xa?i-mo+Xa:0);Kf(t,w,D,3*b,2*b),l.setRenderTarget(t),l.render(f,Og)}};$u=class extends Yt{constructor(e=null,t=1,n=1,i=1){super(null);this.image={data:e,width:t,height:n,depth:i},this.magFilter=jt,this.minFilter=jt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};$u.prototype.isDataTexture2DArray=!0;Zf=class extends Yt{constructor(e=null,t=1,n=1,i=1){super(null);this.image={data:e,width:t,height:n,depth:i},this.magFilter=jt,this.minFilter=jt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};Zf.prototype.isDataTexture3D=!0;D3=new Yt,E3=new $u,M3=new Zf,R3=new ps,T3=[],F3=[],_3=new Float32Array(16),C3=new Float32Array(9),P3=new Float32Array(4);k3.prototype.updateCache=function(r){let e=this.cache;r instanceof Float32Array&&e.length!==r.length&&(this.cache=new Float32Array(r.length)),En(e,r)};B3.prototype.setValue=function(r,e,t){let n=this.seq;for(let i=0,o=n.length;i!==o;++i){let s=n[i];s.setValue(r,e[s.id],t)}};qg=/(\w+)(\])?(\[|\.)?/g;go.prototype.setValue=function(r,e,t,n){let i=this.map[e];i!==void 0&&i.setValue(r,t,n)};go.prototype.setOptional=function(r,e,t){let n=e[t];n!==void 0&&this.setValue(r,t,n)};go.upload=function(r,e,t,n){for(let i=0,o=e.length;i!==o;++i){let s=e[i],a=t[s.id];a.needsUpdate!==!1&&s.setValue(r,a.value,n)}};go.seqWithValue=function(r,e){let t=[];for(let n=0,i=r.length;n!==i;++n){let o=r[n];o.id in e&&t.push(o)}return t};g4=0;L4=/^[ \t]*#include +<([\w\d./]+)>/gm;D4=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,E4=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;N4=0;tc=class extends Zt{constructor(e){super();this.type="MeshDepthMaterial",this.depthPacking=Yb,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}};tc.prototype.isMeshDepthMaterial=!0;nc=class extends Zt{constructor(e){super();this.type="MeshDistanceMaterial",this.referencePosition=new M,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};nc.prototype.isMeshDistanceMaterial=!0;V4=`void main() {
|
|
4153
4153
|
gl_Position = vec4( position, 1.0 );
|
|
4154
4154
|
}`,H4=`uniform sampler2D shadow_pass;
|
|
4155
4155
|
uniform vec2 resolution;
|
|
@@ -4177,7 +4177,7 @@ void main() {
|
|
|
4177
4177
|
squared_mean = squared_mean / samples;
|
|
4178
4178
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
4179
4179
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
4180
|
-
}`;$f=class extends Gt{constructor(e=[]){super();this.cameras=e}};$f.prototype.isArrayCamera=!0;gi=class extends je{constructor(){super();this.type="Group"}};gi.prototype.isGroup=!0;Q4={type:"move"},ep=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new gi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new gi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new gi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,o=null,s=null,a=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Q4))),u&&e.hand){s=!0;for(let g of e.hand.values()){let x=t.getJointPose(g,n);if(u.joints[g.jointName]===void 0){let m=new gi;m.matrixAutoUpdate=!1,m.visible=!1,u.joints[g.jointName]=m,u.add(m)}let y=u.joints[g.jointName];x!==null&&(y.matrix.fromArray(x.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.jointRadius=x.radius),y.visible=x!==null}let c=u.joints["index-finger-tip"],f=u.joints["thumb-tip"],h=c.position.distanceTo(f.position),p=.02,d=.005;u.inputState.pinching&&h>p+d?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&h<=p-d&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1));return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=o!==null),u!==null&&(u.visible=s!==null),this}},ic=class extends Yt{constructor(e,t,n,i,o,s,a,l,u,c){if(c=c!==void 0?c:oo,c!==oo&&c!==ss)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&c===oo&&(n=Ra),n===void 0&&c===ss&&(n=os);super(null,i,o,s,a,l,c,n,u);this.image={width:e,height:t},this.magFilter=a!==void 0?a:jt,this.minFilter=l!==void 0?l:jt,this.flipY=!1,this.generateMipmaps=!1}};ic.prototype.isDepthTexture=!0;X3=class extends gr{constructor(e,t){super();let n=this,i=null,o=1,s=null,a="local-floor",l=e.extensions.has("WEBGL_multisampled_render_to_texture"),u=null,c=null,f=null,h=null,p=!1,d=null,g=t.getContextAttributes(),x=null,y=null,m=[],b=new Map,w=new Gt;w.layers.enable(1),w.viewport=new xt;let D=new Gt;D.layers.enable(2),D.viewport=new xt;let R=[w,D],L=new $f;L.layers.enable(1),L.layers.enable(2);let T=null,U=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let X=m[Y];return X===void 0&&(X=new ep,m[Y]=X),X.getTargetRaySpace()},this.getControllerGrip=function(Y){let X=m[Y];return X===void 0&&(X=new ep,m[Y]=X),X.getGripSpace()},this.getHand=function(Y){let X=m[Y];return X===void 0&&(X=new ep,m[Y]=X),X.getHandSpace()};function F(Y){let X=b.get(Y.inputSource);X&&X.dispatchEvent({type:Y.type,data:Y.inputSource})}function C(){b.forEach(function(Y,X){Y.disconnect(X)}),b.clear(),T=null,U=null,e.setRenderTarget(x),h=null,f=null,c=null,i=null,y=null,he.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getBaseLayer=function(){return f!==null?f:h},this.getBinding=function(){return c},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(x=e.getRenderTarget(),i.addEventListener("select",F),i.addEventListener("selectstart",F),i.addEventListener("selectend",F),i.addEventListener("squeeze",F),i.addEventListener("squeezestart",F),i.addEventListener("squeezeend",F),i.addEventListener("end",C),i.addEventListener("inputsourceschange",j),g.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let X={antialias:i.renderState.layers===void 0?g.antialias:!0,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:o};h=new XRWebGLLayer(i,t,X),i.updateRenderState({baseLayer:h}),y=new Qn(h.framebufferWidth,h.framebufferHeight)}else{p=g.antialias;let X=null,ve=null,pe=null;g.depth&&(pe=g.stencil?35056:33189,X=g.stencil?ss:oo,ve=g.stencil?os:Ra);let Le={colorFormat:g.alpha||p?32856:32849,depthFormat:pe,scaleFactor:o};c=new XRWebGLBinding(i,t),f=c.createProjectionLayer(Le),i.updateRenderState({layers:[f]}),p?y=new Vu(f.textureWidth,f.textureHeight,{format:gn,type:mr,depthTexture:new ic(f.textureWidth,f.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,X),stencilBuffer:g.stencil,ignoreDepth:f.ignoreDepthValues,useRenderToTexture:l}):y=new Qn(f.textureWidth,f.textureHeight,{format:g.alpha?gn:ro,type:mr,depthTexture:new ic(f.textureWidth,f.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,X),stencilBuffer:g.stencil,ignoreDepth:f.ignoreDepthValues})}this.setFoveation(0),s=await i.requestReferenceSpace(a),he.setContext(i),he.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function j(Y){let X=i.inputSources;for(let ve=0;ve<m.length;ve++)b.set(X[ve],m[ve]);for(let ve=0;ve<Y.removed.length;ve++){let pe=Y.removed[ve],Le=b.get(pe);Le&&(Le.dispatchEvent({type:"disconnected",data:pe}),b.delete(pe))}for(let ve=0;ve<Y.added.length;ve++){let pe=Y.added[ve],Le=b.get(pe);Le&&Le.dispatchEvent({type:"connected",data:pe})}}let B=new M,z=new M;function O(Y,X,ve){B.setFromMatrixPosition(X.matrixWorld),z.setFromMatrixPosition(ve.matrixWorld);let pe=B.distanceTo(z),Le=X.projectionMatrix.elements,Ie=ve.projectionMatrix.elements,P=Le[14]/(Le[10]-1),Z=Le[14]/(Le[10]+1),ae=(Le[9]+1)/Le[5],ne=(Le[9]-1)/Le[5],fe=(Le[8]-1)/Le[0],W=(Ie[8]+1)/Ie[0],Q=P*fe,le=P*W,ue=pe/(-fe+W),Se=ue*-fe;X.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Se),Y.translateZ(ue),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert();let ce=P+ue,Ue=Z+ue,We=Q-Se,nt=le+(pe-Se),Et=ae*Z/Ue*ce,k=ne*Z/Ue*ce;Y.projectionMatrix.makePerspective(We,nt,Et,k,ce,Ue)}function V(Y,X){X===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(X.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;L.near=D.near=w.near=Y.near,L.far=D.far=w.far=Y.far,(T!==L.near||U!==L.far)&&(i.updateRenderState({depthNear:L.near,depthFar:L.far}),T=L.near,U=L.far);let X=Y.parent,ve=L.cameras;V(L,X);for(let Le=0;Le<ve.length;Le++)V(ve[Le],X);L.matrixWorld.decompose(L.position,L.quaternion,L.scale),Y.position.copy(L.position),Y.quaternion.copy(L.quaternion),Y.scale.copy(L.scale),Y.matrix.copy(L.matrix),Y.matrixWorld.copy(L.matrixWorld);let pe=Y.children;for(let Le=0,Ie=pe.length;Le<Ie;Le++)pe[Le].updateMatrixWorld(!0);ve.length===2?O(L,w,D):L.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return L},this.getFoveation=function(){if(f!==null)return f.fixedFoveation;if(h!==null)return h.fixedFoveation},this.setFoveation=function(Y){f!==null&&(f.fixedFoveation=Y),h!==null&&h.fixedFoveation!==void 0&&(h.fixedFoveation=Y)};let q=null;function se(Y,X){if(u=X.getViewerPose(s),d=X,u!==null){let pe=u.views;h!==null&&(e.setRenderTargetFramebuffer(y,h.framebuffer),e.setRenderTarget(y));let Le=!1;pe.length!==L.cameras.length&&(L.cameras.length=0,Le=!0);for(let Ie=0;Ie<pe.length;Ie++){let P=pe[Ie],Z=null;if(h!==null)Z=h.getViewport(P);else{let ne=c.getViewSubImage(f,P);Z=ne.viewport,Ie===0&&(e.setRenderTargetTextures(y,ne.colorTexture,f.ignoreDepthValues?void 0:ne.depthStencilTexture),e.setRenderTarget(y))}let ae=R[Ie];ae.matrix.fromArray(P.transform.matrix),ae.projectionMatrix.fromArray(P.projectionMatrix),ae.viewport.set(Z.x,Z.y,Z.width,Z.height),Ie===0&&L.matrix.copy(ae.matrix),Le===!0&&L.cameras.push(ae)}}let ve=i.inputSources;for(let pe=0;pe<m.length;pe++){let Le=m[pe],Ie=ve[pe];Le.update(Ie,X,s)}q&&q(Y,X),d=null}let he=new d3;he.setAnimationLoop(se),this.setAnimationLoop=function(Y){q=Y},this.dispose=function(){}}};ft.prototype.isWebGLRenderer=!0;jg=class extends ft{};jg.prototype.isWebGL1Renderer=!0;$a=class{constructor(e,t=25e-5){this.name="",this.color=new xe(e),this.density=t}clone(){return new $a(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};$a.prototype.isFogExp2=!0;el=class{constructor(e,t=1,n=1e3){this.name="",this.color=new xe(e),this.near=t,this.far=n}clone(){return new el(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};el.prototype.isFog=!0;xs=class extends je{constructor(){super();this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};xs.prototype.isScene=!0;yo=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ta,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=oi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,o=this.stride;i<o;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=oi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=oi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}};yo.prototype.isInterleavedBuffer=!0;Wt=new M,Ar=class{constructor(e,t,n,i=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Wt.x=this.getX(t),Wt.y=this.getY(t),Wt.z=this.getZ(t),Wt.applyMatrix4(e),this.setXYZ(t,Wt.x,Wt.y,Wt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Wt.x=this.getX(t),Wt.y=this.getY(t),Wt.z=this.getZ(t),Wt.applyNormalMatrix(e),this.setXYZ(t,Wt.x,Wt.y,Wt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Wt.x=this.getX(t),Wt.y=this.getY(t),Wt.z=this.getZ(t),Wt.transformDirection(e),this.setXYZ(t,Wt.x,Wt.y,Wt.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,o){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=o,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}return new qe(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ar(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};Ar.prototype.isInterleavedBufferAttribute=!0;rc=class extends Zt{constructor(e){super();this.type="SpriteMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}};rc.prototype.isSpriteMaterial=!0;oc=new M,nl=new M,il=new M,rl=new ee,sc=new ee,K3=new Ae,tp=new M,ac=new M,np=new M,Z3=new ee,Qg=new ee,J3=new ee,lc=class extends je{constructor(e){super();if(this.type="Sprite",tl===void 0){tl=new Pe;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new yo(t,5);tl.setIndex([0,1,2,0,2,3]),tl.setAttribute("position",new Ar(n,3,0,!1)),tl.setAttribute("uv",new Ar(n,2,3,!1))}this.geometry=tl,this.material=e!==void 0?e:new rc,this.center=new ee(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),nl.setFromMatrixScale(this.matrixWorld),K3.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),il.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&nl.multiplyScalar(-il.z);let n=this.material.rotation,i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));let s=this.center;ip(tp.set(-.5,-.5,0),il,s,nl,i,o),ip(ac.set(.5,-.5,0),il,s,nl,i,o),ip(np.set(.5,.5,0),il,s,nl,i,o),Z3.set(0,0),Qg.set(1,0),J3.set(1,1);let a=e.ray.intersectTriangle(tp,ac,np,!1,oc);if(a===null&&(ip(ac.set(-.5,.5,0),il,s,nl,i,o),Qg.set(0,1),a=e.ray.intersectTriangle(tp,np,ac,!1,oc),a===null))return;let l=e.ray.origin.distanceTo(oc);l<e.near||l>e.far||t.push({distance:l,point:oc.clone(),uv:It.getUV(oc,tp,ac,np,Z3,Qg,J3,new ee),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};lc.prototype.isSprite=!0;rp=new M,$3=new M,Yg=class extends je{constructor(){super();this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let n=0,i=t.length;n<i;n++){let o=t[n];this.addLevel(o.object.clone(),o.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);let n=this.levels,i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){rp.setFromMatrixPosition(this.matrixWorld);let i=e.ray.origin.distanceTo(rp);this.getObjectForDistance(i).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){rp.setFromMatrixPosition(e.matrixWorld),$3.setFromMatrixPosition(this.matrixWorld);let n=rp.distanceTo($3)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i<o&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<o;i++)t[i].object.visible=!1}}toJSON(e){let t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];let n=this.levels;for(let i=0,o=n.length;i<o;i++){let s=n[i];t.object.levels.push({object:s.object.uuid,distance:s.distance})}return t}},eS=new M,tS=new xt,nS=new xt,K4=new M,iS=new Ae,uc=class extends Lt{constructor(e,t){super(e,t);this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ae,this.bindMatrixInverse=new Ae}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new xt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);let o=1/e.manhattanLength();o!==1/0?e.multiplyScalar(o):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){let n=this.skeleton,i=this.geometry;tS.fromBufferAttribute(i.attributes.skinIndex,e),nS.fromBufferAttribute(i.attributes.skinWeight,e),eS.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let o=0;o<4;o++){let s=nS.getComponent(o);if(s!==0){let a=tS.getComponent(o);iS.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(K4.copy(eS).applyMatrix4(iS),s)}}return t.applyMatrix4(this.bindMatrixInverse)}};uc.prototype.isSkinnedMesh=!0;cc=class extends je{constructor(){super();this.type="Bone"}};cc.prototype.isBone=!0;vo=class extends Yt{constructor(e=null,t=1,n=1,i,o,s,a,l,u=jt,c=jt,f,h){super(null,s,a,l,u,c,i,o,f,h);this.image={data:e,width:t,height:n},this.magFilter=u,this.minFilter=c,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};vo.prototype.isDataTexture=!0;rS=new Ae,Z4=new Ae,hc=class{constructor(e=[],t=[]){this.uuid=oi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ae)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Ae;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let o=0,s=e.length;o<s;o++){let a=e[o]?e[o].matrixWorld:Z4;rS.multiplyMatrices(a,t[o]),rS.toArray(n,o*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new hc(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Zb(e),e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new vo(t,e,e,gn,Qi);return this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let o=e.bones[n],s=t[o];s===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",o),s=new cc),this.bones.push(s),this.boneInverses.push(new Ae().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,o=t.length;i<o;i++){let s=t[i];e.bones.push(s.uuid);let a=n[i];e.boneInverses.push(a.toArray())}return e}},xo=class extends qe{constructor(e,t,n,i=1){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));super(e,t,n);this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};xo.prototype.isInstancedBufferAttribute=!0;oS=new Ae,sS=new Ae,op=[],fc=new Lt,sp=class extends Lt{constructor(e,t,n){super(e,t);this.instanceMatrix=new xo(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){let n=this.matrixWorld,i=this.count;if(fc.geometry=this.geometry,fc.material=this.material,fc.material!==void 0)for(let o=0;o<i;o++){this.getMatrixAt(o,oS),sS.multiplyMatrices(n,oS),fc.matrixWorld=sS,fc.raycast(e,op);for(let s=0,a=op.length;s<a;s++){let l=op[s];l.instanceId=o,l.object=this,t.push(l)}op.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new xo(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}};sp.prototype.isInstancedMesh=!0;Jt=class extends Zt{constructor(e){super();this.type="LineBasicMaterial",this.color=new xe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}};Jt.prototype.isLineBasicMaterial=!0;aS=new M,lS=new M,uS=new Ae,Xg=new wr,ap=new vr,Ki=class extends je{constructor(e=new Pe,t=new Jt){super();this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,o=t.count;i<o;i++)aS.fromBufferAttribute(t,i-1),lS.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=aS.distanceTo(lS);e.setAttribute("lineDistance",new Te(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,o=e.params.Line.threshold,s=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ap.copy(n.boundingSphere),ap.applyMatrix4(i),ap.radius+=o,e.ray.intersectsSphere(ap)===!1)return;uS.copy(i).invert(),Xg.copy(e.ray).applyMatrix4(uS);let a=o/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,u=new M,c=new M,f=new M,h=new M,p=this.isLineSegments?2:1;if(n.isBufferGeometry){let d=n.index,x=n.attributes.position;if(d!==null){let y=Math.max(0,s.start),m=Math.min(d.count,s.start+s.count);for(let b=y,w=m-1;b<w;b+=p){let D=d.getX(b),R=d.getX(b+1);if(u.fromBufferAttribute(x,D),c.fromBufferAttribute(x,R),Xg.distanceSqToSegment(u,c,h,f)>l)continue;h.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(h);T<e.near||T>e.far||t.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else{let y=Math.max(0,s.start),m=Math.min(x.count,s.start+s.count);for(let b=y,w=m-1;b<w;b+=p){if(u.fromBufferAttribute(x,b),c.fromBufferAttribute(x,b+1),Xg.distanceSqToSegment(u,c,h,f)>l)continue;h.applyMatrix4(this.matrixWorld);let R=e.ray.origin.distanceTo(h);R<e.near||R>e.far||t.push({distance:R,point:f.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o<s;o++){let a=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};Ki.prototype.isLine=!0;cS=new M,hS=new M,Bn=class extends Ki{constructor(e,t){super(e,t);this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,o=t.count;i<o;i+=2)cS.fromBufferAttribute(t,i),hS.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+cS.distanceTo(hS);e.setAttribute("lineDistance",new Te(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}};Bn.prototype.isLineSegments=!0;lp=class extends Ki{constructor(e,t){super(e,t);this.type="LineLoop"}};lp.prototype.isLineLoop=!0;wo=class extends Zt{constructor(e){super();this.type="PointsMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}};wo.prototype.isPointsMaterial=!0;fS=new Ae,Kg=new wr,up=new vr,cp=new M,ol=class extends je{constructor(e=new Pe,t=new wo){super();this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,o=e.params.Points.threshold,s=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),up.copy(n.boundingSphere),up.applyMatrix4(i),up.radius+=o,e.ray.intersectsSphere(up)===!1)return;fS.copy(i).invert(),Kg.copy(e.ray).applyMatrix4(fS);let a=o/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(n.isBufferGeometry){let u=n.index,f=n.attributes.position;if(u!==null){let h=Math.max(0,s.start),p=Math.min(u.count,s.start+s.count);for(let d=h,g=p;d<g;d++){let x=u.getX(d);cp.fromBufferAttribute(f,x),pS(cp,x,l,i,e,t,this)}}else{let h=Math.max(0,s.start),p=Math.min(f.count,s.start+s.count);for(let d=h,g=p;d<g;d++)cp.fromBufferAttribute(f,d),pS(cp,d,l,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o<s;o++){let a=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};ol.prototype.isPoints=!0;Zg=class extends Yt{constructor(e,t,n,i,o,s,a,l,u){super(e,t,n,i,o,s,a,l,u);this.format=a!==void 0?a:ro,this.minFilter=s!==void 0?s:Kt,this.magFilter=o!==void 0?o:Kt,this.generateMipmaps=!1;let c=this;function f(){c.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}};Zg.prototype.isVideoTexture=!0;hp=class extends Yt{constructor(e,t,n,i,o,s,a,l,u,c,f,h){super(null,s,a,l,u,c,i,o,f,h);this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};hp.prototype.isCompressedTexture=!0;Jg=class extends Yt{constructor(e,t,n,i,o,s,a,l,u){super(e,t,n,i,o,s,a,l,u);this.needsUpdate=!0}};Jg.prototype.isCanvasTexture=!0;sl=class extends Pe{constructor(e=1,t=8,n=0,i=Math.PI*2){super();this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);let o=[],s=[],a=[],l=[],u=new M,c=new ee;s.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,h=3;f<=t;f++,h+=3){let p=n+f/t*i;u.x=e*Math.cos(p),u.y=e*Math.sin(p),s.push(u.x,u.y,u.z),a.push(0,0,1),c.x=(s[h]/e+1)/2,c.y=(s[h+1]/e+1)/2,l.push(c.x,c.y)}for(let f=1;f<=t;f++)o.push(f,f+1,0);this.setIndex(o),this.setAttribute("position",new Te(s,3)),this.setAttribute("normal",new Te(a,3)),this.setAttribute("uv",new Te(l,2))}static fromJSON(e){return new sl(e.radius,e.segments,e.thetaStart,e.thetaLength)}},bo=class extends Pe{constructor(e=1,t=1,n=1,i=8,o=1,s=!1,a=0,l=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:o,openEnded:s,thetaStart:a,thetaLength:l};let u=this;i=Math.floor(i),o=Math.floor(o);let c=[],f=[],h=[],p=[],d=0,g=[],x=n/2,y=0;m(),s===!1&&(e>0&&b(!0),t>0&&b(!1)),this.setIndex(c),this.setAttribute("position",new Te(f,3)),this.setAttribute("normal",new Te(h,3)),this.setAttribute("uv",new Te(p,2));function m(){let w=new M,D=new M,R=0,L=(t-e)/n;for(let T=0;T<=o;T++){let U=[],F=T/o,C=F*(t-e)+e;for(let j=0;j<=i;j++){let B=j/i,z=B*l+a,O=Math.sin(z),V=Math.cos(z);D.x=C*O,D.y=-F*n+x,D.z=C*V,f.push(D.x,D.y,D.z),w.set(O,L,V).normalize(),h.push(w.x,w.y,w.z),p.push(B,1-F),U.push(d++)}g.push(U)}for(let T=0;T<i;T++)for(let U=0;U<o;U++){let F=g[U][T],C=g[U+1][T],j=g[U+1][T+1],B=g[U][T+1];c.push(F,C,B),c.push(C,j,B),R+=6}u.addGroup(y,R,0),y+=R}function b(w){let D=d,R=new ee,L=new M,T=0,U=w===!0?e:t,F=w===!0?1:-1;for(let j=1;j<=i;j++)f.push(0,x*F,0),h.push(0,F,0),p.push(.5,.5),d++;let C=d;for(let j=0;j<=i;j++){let z=j/i*l+a,O=Math.cos(z),V=Math.sin(z);L.x=U*V,L.y=x*F,L.z=U*O,f.push(L.x,L.y,L.z),h.push(0,F,0),R.x=O*.5+.5,R.y=V*.5*F+.5,p.push(R.x,R.y),d++}for(let j=0;j<i;j++){let B=D+j,z=C+j;w===!0?c.push(z,z+1,B):c.push(z+1,z,B),T+=3}u.addGroup(y,T,w===!0?1:2),y+=T}}static fromJSON(e){return new bo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},al=class extends bo{constructor(e=1,t=1,n=8,i=1,o=!1,s=0,a=Math.PI*2){super(0,e,t,n,i,o,s,a);this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:a}}static fromJSON(e){return new al(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Zi=class extends Pe{constructor(e=[],t=[],n=1,i=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};let o=[],s=[];a(i),u(n),c(),this.setAttribute("position",new Te(o,3)),this.setAttribute("normal",new Te(o.slice(),3)),this.setAttribute("uv",new Te(s,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(m){let b=new M,w=new M,D=new M;for(let R=0;R<t.length;R+=3)p(t[R+0],b),p(t[R+1],w),p(t[R+2],D),l(b,w,D,m)}function l(m,b,w,D){let R=D+1,L=[];for(let T=0;T<=R;T++){L[T]=[];let U=m.clone().lerp(w,T/R),F=b.clone().lerp(w,T/R),C=R-T;for(let j=0;j<=C;j++)j===0&&T===R?L[T][j]=U:L[T][j]=U.clone().lerp(F,j/C)}for(let T=0;T<R;T++)for(let U=0;U<2*(R-T)-1;U++){let F=Math.floor(U/2);U%2==0?(h(L[T][F+1]),h(L[T+1][F]),h(L[T][F])):(h(L[T][F+1]),h(L[T+1][F+1]),h(L[T+1][F]))}}function u(m){let b=new M;for(let w=0;w<o.length;w+=3)b.x=o[w+0],b.y=o[w+1],b.z=o[w+2],b.normalize().multiplyScalar(m),o[w+0]=b.x,o[w+1]=b.y,o[w+2]=b.z}function c(){let m=new M;for(let b=0;b<o.length;b+=3){m.x=o[b+0],m.y=o[b+1],m.z=o[b+2];let w=x(m)/2/Math.PI+.5,D=y(m)/Math.PI+.5;s.push(w,1-D)}d(),f()}function f(){for(let m=0;m<s.length;m+=6){let b=s[m+0],w=s[m+2],D=s[m+4],R=Math.max(b,w,D),L=Math.min(b,w,D);R>.9&&L<.1&&(b<.2&&(s[m+0]+=1),w<.2&&(s[m+2]+=1),D<.2&&(s[m+4]+=1))}}function h(m){o.push(m.x,m.y,m.z)}function p(m,b){let w=m*3;b.x=e[w+0],b.y=e[w+1],b.z=e[w+2]}function d(){let m=new M,b=new M,w=new M,D=new M,R=new ee,L=new ee,T=new ee;for(let U=0,F=0;U<o.length;U+=9,F+=6){m.set(o[U+0],o[U+1],o[U+2]),b.set(o[U+3],o[U+4],o[U+5]),w.set(o[U+6],o[U+7],o[U+8]),R.set(s[F+0],s[F+1]),L.set(s[F+2],s[F+3]),T.set(s[F+4],s[F+5]),D.copy(m).add(b).add(w).divideScalar(3);let C=x(D);g(R,F+0,m,C),g(L,F+2,b,C),g(T,F+4,w,C)}}function g(m,b,w,D){D<0&&m.x===1&&(s[b]=m.x-1),w.x===0&&w.z===0&&(s[b]=D/2/Math.PI+.5)}function x(m){return Math.atan2(m.z,-m.x)}function y(m){return Math.atan2(-m.y,Math.sqrt(m.x*m.x+m.z*m.z))}}static fromJSON(e){return new Zi(e.vertices,e.indices,e.radius,e.details)}},ll=class extends Zi{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,i=1/n,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],s=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(o,s,e,t);this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ll(e.radius,e.detail)}},fp=new M,pp=new M,$g=new M,dp=new It,mp=class extends Pe{constructor(e=null,t=1){super();if(this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){let i=Math.pow(10,4),o=Math.cos(cs*t),s=e.getIndex(),a=e.getAttribute("position"),l=s?s.count:a.count,u=[0,0,0],c=["a","b","c"],f=new Array(3),h={},p=[];for(let d=0;d<l;d+=3){s?(u[0]=s.getX(d),u[1]=s.getX(d+1),u[2]=s.getX(d+2)):(u[0]=d,u[1]=d+1,u[2]=d+2);let{a:g,b:x,c:y}=dp;if(g.fromBufferAttribute(a,u[0]),x.fromBufferAttribute(a,u[1]),y.fromBufferAttribute(a,u[2]),dp.getNormal($g),f[0]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,f[1]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,f[2]=`${Math.round(y.x*i)},${Math.round(y.y*i)},${Math.round(y.z*i)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let m=0;m<3;m++){let b=(m+1)%3,w=f[m],D=f[b],R=dp[c[m]],L=dp[c[b]],T=`${w}_${D}`,U=`${D}_${w}`;U in h&&h[U]?($g.dot(h[U].normal)<=o&&(p.push(R.x,R.y,R.z),p.push(L.x,L.y,L.z)),h[U]=null):T in h||(h[T]={index0:u[m],index1:u[b],normal:$g.clone()})}}for(let d in h)if(h[d]){let{index0:g,index1:x}=h[d];fp.fromBufferAttribute(a,g),pp.fromBufferAttribute(a,x),p.push(fp.x,fp.y,fp.z),p.push(pp.x,pp.y,pp.z)}this.setAttribute("position",new Te(p,3))}}},Xn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,i=this.getPoint(0),o=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),o+=n.distanceTo(i),t.push(o),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let n=this.getLengths(),i=0,o=n.length,s;t?s=t:s=e*n[o-1];let a=0,l=o-1,u;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),u=n[i]-s,u<0)a=i+1;else if(u>0)l=i-1;else{l=i;break}if(i=l,n[i]===s)return i/(o-1);let c=n[i],h=n[i+1]-c,p=(s-c)/h;return(i+p)/(o-1)}getTangent(e,t){let n=1e-4,i=e-n,o=e+n;i<0&&(i=0),o>1&&(o=1);let s=this.getPoint(i),a=this.getPoint(o),l=t||(s.isVector2?new ee:new M);return l.copy(a).sub(s).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){let n=new M,i=[],o=[],s=[],a=new M,l=new Ae;for(let p=0;p<=e;p++){let d=p/e;i[p]=this.getTangentAt(d,new M)}o[0]=new M,s[0]=new M;let u=Number.MAX_VALUE,c=Math.abs(i[0].x),f=Math.abs(i[0].y),h=Math.abs(i[0].z);c<=u&&(u=c,n.set(1,0,0)),f<=u&&(u=f,n.set(0,1,0)),h<=u&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],a),s[0].crossVectors(i[0],o[0]);for(let p=1;p<=e;p++){if(o[p]=o[p-1].clone(),s[p]=s[p-1].clone(),a.crossVectors(i[p-1],i[p]),a.length()>Number.EPSILON){a.normalize();let d=Math.acos(vn(i[p-1].dot(i[p]),-1,1));o[p].applyMatrix4(l.makeRotationAxis(a,d))}s[p].crossVectors(i[p],o[p])}if(t===!0){let p=Math.acos(vn(o[0].dot(o[e]),-1,1));p/=e,i[0].dot(a.crossVectors(o[0],o[e]))>0&&(p=-p);for(let d=1;d<=e;d++)o[d].applyMatrix4(l.makeRotationAxis(i[d],p*d)),s[d].crossVectors(i[d],o[d])}return{tangents:i,normals:o,binormals:s}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},ul=class extends Xn{constructor(e=0,t=0,n=1,i=1,o=0,s=Math.PI*2,a=!1,l=0){super();this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=s,this.aClockwise=a,this.aRotation=l}getPoint(e,t){let n=t||new ee,i=Math.PI*2,o=this.aEndAngle-this.aStartAngle,s=Math.abs(o)<Number.EPSILON;for(;o<0;)o+=i;for(;o>i;)o-=i;o<Number.EPSILON&&(s?o=0:o=i),this.aClockwise===!0&&!s&&(o===i?o=-i:o=o-i);let a=this.aStartAngle+e*o,l=this.aX+this.xRadius*Math.cos(a),u=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let c=Math.cos(this.aRotation),f=Math.sin(this.aRotation),h=l-this.aX,p=u-this.aY;l=h*c-p*f+this.aX,u=h*f+p*c+this.aY}return n.set(l,u)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}};ul.prototype.isEllipseCurve=!0;gp=class extends ul{constructor(e,t,n,i,o,s){super(e,t,n,n,i,o,s);this.type="ArcCurve"}};gp.prototype.isArcCurve=!0;yp=new M,t1=new e1,n1=new e1,i1=new e1,vp=class extends Xn{constructor(e=[],t=!1,n="centripetal",i=.5){super();this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new M){let n=t,i=this.points,o=i.length,s=(o-(this.closed?0:1))*e,a=Math.floor(s),l=s-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/o)+1)*o:l===0&&a===o-1&&(a=o-2,l=1);let u,c;this.closed||a>0?u=i[(a-1)%o]:(yp.subVectors(i[0],i[1]).add(i[0]),u=yp);let f=i[a%o],h=i[(a+1)%o];if(this.closed||a+2<o?c=i[(a+2)%o]:(yp.subVectors(i[o-1],i[o-2]).add(i[o-1]),c=yp),this.curveType==="centripetal"||this.curveType==="chordal"){let p=this.curveType==="chordal"?.5:.25,d=Math.pow(u.distanceToSquared(f),p),g=Math.pow(f.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(c),p);g<1e-4&&(g=1),d<1e-4&&(d=g),x<1e-4&&(x=g),t1.initNonuniformCatmullRom(u.x,f.x,h.x,c.x,d,g,x),n1.initNonuniformCatmullRom(u.y,f.y,h.y,c.y,d,g,x),i1.initNonuniformCatmullRom(u.z,f.z,h.z,c.z,d,g,x)}else this.curveType==="catmullrom"&&(t1.initCatmullRom(u.x,f.x,h.x,c.x,this.tension),n1.initCatmullRom(u.y,f.y,h.y,c.y,this.tension),i1.initCatmullRom(u.z,f.z,h.z,c.z,this.tension));return n.set(t1.calc(l),n1.calc(l),i1.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(new M().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};vp.prototype.isCatmullRomCurve3=!0;mc=class extends Xn{constructor(e=new ee,t=new ee,n=new ee,i=new ee){super();this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ee){let n=t,i=this.v0,o=this.v1,s=this.v2,a=this.v3;return n.set(dc(e,i.x,o.x,s.x,a.x),dc(e,i.y,o.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};mc.prototype.isCubicBezierCurve=!0;xp=class extends Xn{constructor(e=new M,t=new M,n=new M,i=new M){super();this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new M){let n=t,i=this.v0,o=this.v1,s=this.v2,a=this.v3;return n.set(dc(e,i.x,o.x,s.x,a.x),dc(e,i.y,o.y,s.y,a.y),dc(e,i.z,o.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};xp.prototype.isCubicBezierCurve3=!0;cl=class extends Xn{constructor(e=new ee,t=new ee){super();this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ee){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let n=t||new ee;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};cl.prototype.isLineCurve=!0;r1=class extends Xn{constructor(e=new M,t=new M){super();this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new M){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},gc=class extends Xn{constructor(e=new ee,t=new ee,n=new ee){super();this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ee){let n=t,i=this.v0,o=this.v1,s=this.v2;return n.set(pc(e,i.x,o.x,s.x),pc(e,i.y,o.y,s.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};gc.prototype.isQuadraticBezierCurve=!0;yc=class extends Xn{constructor(e=new M,t=new M,n=new M){super();this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new M){let n=t,i=this.v0,o=this.v1,s=this.v2;return n.set(pc(e,i.x,o.x,s.x),pc(e,i.y,o.y,s.y),pc(e,i.z,o.z,s.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};yc.prototype.isQuadraticBezierCurve3=!0;vc=class extends Xn{constructor(e=[]){super();this.type="SplineCurve",this.points=e}getPoint(e,t=new ee){let n=t,i=this.points,o=(i.length-1)*e,s=Math.floor(o),a=o-s,l=i[s===0?s:s-1],u=i[s],c=i[s>i.length-2?i.length-1:s+1],f=i[s>i.length-3?i.length-1:s+2];return n.set(dS(a,l.x,u.x,c.x,f.x),dS(a,l.y,u.y,c.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(new ee().fromArray(i))}return this}};vc.prototype.isSplineCurve=!0;o1=Object.freeze({__proto__:null,ArcCurve:gp,CatmullRomCurve3:vp,CubicBezierCurve:mc,CubicBezierCurve3:xp,EllipseCurve:ul,LineCurve:cl,LineCurve3:r1,QuadraticBezierCurve:gc,QuadraticBezierCurve3:yc,SplineCurve:vc}),s1=class extends Xn{constructor(){super();this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new cl(t,e))}getPoint(e,t){let n=e*this.getLength(),i=this.getCurveLengths(),o=0;for(;o<i.length;){if(i[o]>=n){let s=i[o]-n,a=this.curves[o],l=a.getLength(),u=l===0?0:1-s/l;return a.getPointAt(u,t)}o++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let i=0,o=this.curves;i<o.length;i++){let s=o[i],a=s&&s.isEllipseCurve?e*2:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?e*s.points.length:e,l=s.getPoints(a);for(let u=0;u<l.length;u++){let c=l[u];n&&n.equals(c)||(t.push(c),n=c)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let i=e.curves[t];this.curves.push(new o1[i.type]().fromJSON(i))}return this}},hl=class extends s1{constructor(e){super();this.type="Path",this.currentPoint=new ee,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new cl(this.currentPoint.clone(),new ee(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){let o=new gc(this.currentPoint.clone(),new ee(e,t),new ee(n,i));return this.curves.push(o),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,o,s){let a=new mc(this.currentPoint.clone(),new ee(e,t),new ee(n,i),new ee(o,s));return this.curves.push(a),this.currentPoint.set(o,s),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new vc(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,o,s){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,i,o,s),this}absarc(e,t,n,i,o,s){return this.absellipse(e,t,n,n,i,o,s),this}ellipse(e,t,n,i,o,s,a,l){let u=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+u,t+c,n,i,o,s,a,l),this}absellipse(e,t,n,i,o,s,a,l){let u=new ul(e,t,n,i,o,s,a,l);if(this.curves.length>0){let f=u.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(u);let c=u.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Ci=class extends hl{constructor(e){super(e);this.uuid=oi(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let i=e.holes[t];this.holes.push(new hl().fromJSON(i))}return this}},oF={triangulate:function(r,e,t=2){let n=e&&e.length,i=n?e[0]*t:r.length,o=mS(r,0,i,t,!0),s=[];if(!o||o.next===o.prev)return s;let a,l,u,c,f,h,p;if(n&&(o=cF(r,e,o,t)),r.length>80*t){a=u=r[0],l=c=r[1];for(let d=t;d<i;d+=t)f=r[d],h=r[d+1],f<a&&(a=f),h<l&&(l=h),f>u&&(u=f),h>c&&(c=h);p=Math.max(u-a,c-l),p=p!==0?1/p:0}return xc(o,s,t,a,l,p),s}};Pi=class{static area(e){let t=e.length,n=0;for(let i=t-1,o=0;o<t;i=o++)n+=e[i].x*e[o].y-e[o].x*e[i].y;return n*.5}static isClockWise(e){return Pi.area(e)<0}static triangulateShape(e,t){let n=[],i=[],o=[];xS(e),wS(n,e);let s=e.length;t.forEach(xS);for(let l=0;l<t.length;l++)i.push(s),s+=t[l].length,wS(n,t[l]);let a=oF.triangulate(n,i);for(let l=0;l<a.length;l+=3)o.push(a.slice(l,l+3));return o}};Ji=class extends Pe{constructor(e=new Ci([new ee(.5,.5),new ee(-.5,.5),new ee(-.5,-.5),new ee(.5,-.5)]),t={}){super();this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,i=[],o=[];for(let a=0,l=e.length;a<l;a++){let u=e[a];s(u)}this.setAttribute("position",new Te(i,3)),this.setAttribute("uv",new Te(o,2)),this.computeVertexNormals();function s(a){let l=[],u=t.curveSegments!==void 0?t.curveSegments:12,c=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,h=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,d=t.bevelSize!==void 0?t.bevelSize:p-.1,g=t.bevelOffset!==void 0?t.bevelOffset:0,x=t.bevelSegments!==void 0?t.bevelSegments:3,y=t.extrudePath,m=t.UVGenerator!==void 0?t.UVGenerator:SF;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),f=t.amount);let b,w=!1,D,R,L,T;y&&(b=y.getSpacedPoints(c),w=!0,h=!1,D=y.computeFrenetFrames(c,!1),R=new M,L=new M,T=new M),h||(x=0,p=0,d=0,g=0);let U=a.extractPoints(u),F=U.shape,C=U.holes;if(!Pi.isClockWise(F)){F=F.reverse();for(let Q=0,le=C.length;Q<le;Q++){let ue=C[Q];Pi.isClockWise(ue)&&(C[Q]=ue.reverse())}}let B=Pi.triangulateShape(F,C),z=F;for(let Q=0,le=C.length;Q<le;Q++){let ue=C[Q];F=F.concat(ue)}function O(Q,le,ue){return le||console.error("THREE.ExtrudeGeometry: vec does not exist"),le.clone().multiplyScalar(ue).add(Q)}let V=F.length,q=B.length;function se(Q,le,ue){let Se,ce,Ue,We=Q.x-le.x,nt=Q.y-le.y,Et=ue.x-Q.x,k=ue.y-Q.y,_=We*We+nt*nt,te=We*k-nt*Et;if(Math.abs(te)>Number.EPSILON){let ie=Math.sqrt(_),Fe=Math.sqrt(Et*Et+k*k),Me=le.x-nt/ie,G=le.y+We/ie,de=ue.x-k/Fe,J=ue.y+Et/Fe,be=((de-Me)*k-(J-G)*Et)/(We*k-nt*Et);Se=Me+We*be-Q.x,ce=G+nt*be-Q.y;let ge=Se*Se+ce*ce;if(ge<=2)return new ee(Se,ce);Ue=Math.sqrt(ge/2)}else{let ie=!1;We>Number.EPSILON?Et>Number.EPSILON&&(ie=!0):We<-Number.EPSILON?Et<-Number.EPSILON&&(ie=!0):Math.sign(nt)===Math.sign(k)&&(ie=!0),ie?(Se=-nt,ce=We,Ue=Math.sqrt(_)):(Se=We,ce=nt,Ue=Math.sqrt(_/2))}return new ee(Se/Ue,ce/Ue)}let he=[];for(let Q=0,le=z.length,ue=le-1,Se=Q+1;Q<le;Q++,ue++,Se++)ue===le&&(ue=0),Se===le&&(Se=0),he[Q]=se(z[Q],z[ue],z[Se]);let Y=[],X,ve=he.concat();for(let Q=0,le=C.length;Q<le;Q++){let ue=C[Q];X=[];for(let Se=0,ce=ue.length,Ue=ce-1,We=Se+1;Se<ce;Se++,Ue++,We++)Ue===ce&&(Ue=0),We===ce&&(We=0),X[Se]=se(ue[Se],ue[Ue],ue[We]);Y.push(X),ve=ve.concat(X)}for(let Q=0;Q<x;Q++){let le=Q/x,ue=p*Math.cos(le*Math.PI/2),Se=d*Math.sin(le*Math.PI/2)+g;for(let ce=0,Ue=z.length;ce<Ue;ce++){let We=O(z[ce],he[ce],Se);Z(We.x,We.y,-ue)}for(let ce=0,Ue=C.length;ce<Ue;ce++){let We=C[ce];X=Y[ce];for(let nt=0,Et=We.length;nt<Et;nt++){let k=O(We[nt],X[nt],Se);Z(k.x,k.y,-ue)}}}let pe=d+g;for(let Q=0;Q<V;Q++){let le=h?O(F[Q],ve[Q],pe):F[Q];w?(L.copy(D.normals[0]).multiplyScalar(le.x),R.copy(D.binormals[0]).multiplyScalar(le.y),T.copy(b[0]).add(L).add(R),Z(T.x,T.y,T.z)):Z(le.x,le.y,0)}for(let Q=1;Q<=c;Q++)for(let le=0;le<V;le++){let ue=h?O(F[le],ve[le],pe):F[le];w?(L.copy(D.normals[Q]).multiplyScalar(ue.x),R.copy(D.binormals[Q]).multiplyScalar(ue.y),T.copy(b[Q]).add(L).add(R),Z(T.x,T.y,T.z)):Z(ue.x,ue.y,f/c*Q)}for(let Q=x-1;Q>=0;Q--){let le=Q/x,ue=p*Math.cos(le*Math.PI/2),Se=d*Math.sin(le*Math.PI/2)+g;for(let ce=0,Ue=z.length;ce<Ue;ce++){let We=O(z[ce],he[ce],Se);Z(We.x,We.y,f+ue)}for(let ce=0,Ue=C.length;ce<Ue;ce++){let We=C[ce];X=Y[ce];for(let nt=0,Et=We.length;nt<Et;nt++){let k=O(We[nt],X[nt],Se);w?Z(k.x,k.y+b[c-1].y,b[c-1].x+ue):Z(k.x,k.y,f+ue)}}}Le(),Ie();function Le(){let Q=i.length/3;if(h){let le=0,ue=V*le;for(let Se=0;Se<q;Se++){let ce=B[Se];ae(ce[2]+ue,ce[1]+ue,ce[0]+ue)}le=c+x*2,ue=V*le;for(let Se=0;Se<q;Se++){let ce=B[Se];ae(ce[0]+ue,ce[1]+ue,ce[2]+ue)}}else{for(let le=0;le<q;le++){let ue=B[le];ae(ue[2],ue[1],ue[0])}for(let le=0;le<q;le++){let ue=B[le];ae(ue[0]+V*c,ue[1]+V*c,ue[2]+V*c)}}n.addGroup(Q,i.length/3-Q,0)}function Ie(){let Q=i.length/3,le=0;P(z,le),le+=z.length;for(let ue=0,Se=C.length;ue<Se;ue++){let ce=C[ue];P(ce,le),le+=ce.length}n.addGroup(Q,i.length/3-Q,1)}function P(Q,le){let ue=Q.length;for(;--ue>=0;){let Se=ue,ce=ue-1;ce<0&&(ce=Q.length-1);for(let Ue=0,We=c+x*2;Ue<We;Ue++){let nt=V*Ue,Et=V*(Ue+1),k=le+Se+nt,_=le+ce+nt,te=le+ce+Et,ie=le+Se+Et;ne(k,_,te,ie)}}}function Z(Q,le,ue){l.push(Q),l.push(le),l.push(ue)}function ae(Q,le,ue){fe(Q),fe(le),fe(ue);let Se=i.length/3,ce=m.generateTopUV(n,i,Se-3,Se-2,Se-1);W(ce[0]),W(ce[1]),W(ce[2])}function ne(Q,le,ue,Se){fe(Q),fe(le),fe(Se),fe(le),fe(ue),fe(Se);let ce=i.length/3,Ue=m.generateSideWallUV(n,i,ce-6,ce-3,ce-2,ce-1);W(Ue[0]),W(Ue[1]),W(Ue[3]),W(Ue[1]),W(Ue[2]),W(Ue[3])}function fe(Q){i.push(l[Q*3+0]),i.push(l[Q*3+1]),i.push(l[Q*3+2])}function W(Q){o.push(Q.x),o.push(Q.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return LF(t,n,e)}static fromJSON(e,t){let n=[];for(let o=0,s=e.shapes.length;o<s;o++){let a=t[e.shapes[o]];n.push(a)}let i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new o1[i.type]().fromJSON(i)),new Ji(n,e.options)}},SF={generateTopUV:function(r,e,t,n,i){let o=e[t*3],s=e[t*3+1],a=e[n*3],l=e[n*3+1],u=e[i*3],c=e[i*3+1];return[new ee(o,s),new ee(a,l),new ee(u,c)]},generateSideWallUV:function(r,e,t,n,i,o){let s=e[t*3],a=e[t*3+1],l=e[t*3+2],u=e[n*3],c=e[n*3+1],f=e[n*3+2],h=e[i*3],p=e[i*3+1],d=e[i*3+2],g=e[o*3],x=e[o*3+1],y=e[o*3+2];return Math.abs(a-c)<Math.abs(s-u)?[new ee(s,1-l),new ee(u,1-f),new ee(h,1-d),new ee(g,1-y)]:[new ee(a,1-l),new ee(c,1-f),new ee(p,1-d),new ee(x,1-y)]}};pl=class extends Zi{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,o,e,t);this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new pl(e.radius,e.detail)}},dl=class extends Pe{constructor(e=[new ee(0,.5),new ee(.5,0),new ee(0,-.5)],t=12,n=0,i=Math.PI*2){super();this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=vn(i,0,Math.PI*2);let o=[],s=[],a=[],l=1/t,u=new M,c=new ee;for(let f=0;f<=t;f++){let h=n+f*l*i,p=Math.sin(h),d=Math.cos(h);for(let g=0;g<=e.length-1;g++)u.x=e[g].x*p,u.y=e[g].y,u.z=e[g].x*d,s.push(u.x,u.y,u.z),c.x=f/t,c.y=g/(e.length-1),a.push(c.x,c.y)}for(let f=0;f<t;f++)for(let h=0;h<e.length-1;h++){let p=h+f*e.length,d=p,g=p+e.length,x=p+e.length+1,y=p+1;o.push(d,g,y),o.push(g,x,y)}if(this.setIndex(o),this.setAttribute("position",new Te(s,3)),this.setAttribute("uv",new Te(a,2)),this.computeVertexNormals(),i===Math.PI*2){let f=this.attributes.normal.array,h=new M,p=new M,d=new M,g=t*e.length*3;for(let x=0,y=0;x<e.length;x++,y+=3)h.x=f[y+0],h.y=f[y+1],h.z=f[y+2],p.x=f[g+y+0],p.y=f[g+y+1],p.z=f[g+y+2],d.addVectors(h,p).normalize(),f[y+0]=f[g+y+0]=d.x,f[y+1]=f[g+y+1]=d.y,f[y+2]=f[g+y+2]=d.z}}static fromJSON(e){return new dl(e.points,e.segments,e.phiStart,e.phiLength)}},ws=class extends Zi{constructor(e=1,t=0){let n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t);this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ws(e.radius,e.detail)}},ml=class extends Pe{constructor(e=.5,t=1,n=8,i=1,o=0,s=Math.PI*2){super();this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:o,thetaLength:s},n=Math.max(3,n),i=Math.max(1,i);let a=[],l=[],u=[],c=[],f=e,h=(t-e)/i,p=new M,d=new ee;for(let g=0;g<=i;g++){for(let x=0;x<=n;x++){let y=o+x/n*s;p.x=f*Math.cos(y),p.y=f*Math.sin(y),l.push(p.x,p.y,p.z),u.push(0,0,1),d.x=(p.x/t+1)/2,d.y=(p.y/t+1)/2,c.push(d.x,d.y)}f+=h}for(let g=0;g<i;g++){let x=g*(n+1);for(let y=0;y<n;y++){let m=y+x,b=m,w=m+n+1,D=m+n+2,R=m+1;a.push(b,w,R),a.push(w,D,R)}}this.setIndex(a),this.setAttribute("position",new Te(l,3)),this.setAttribute("normal",new Te(u,3)),this.setAttribute("uv",new Te(c,2))}static fromJSON(e){return new ml(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}},bs=class extends Pe{constructor(e=new Ci([new ee(0,.5),new ee(-.5,-.5),new ee(.5,-.5)]),t=12){super();this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let n=[],i=[],o=[],s=[],a=0,l=0;if(Array.isArray(e)===!1)u(e);else for(let c=0;c<e.length;c++)u(e[c]),this.addGroup(a,l,c),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new Te(i,3)),this.setAttribute("normal",new Te(o,3)),this.setAttribute("uv",new Te(s,2));function u(c){let f=i.length/3,h=c.extractPoints(t),p=h.shape,d=h.holes;Pi.isClockWise(p)===!1&&(p=p.reverse());for(let x=0,y=d.length;x<y;x++){let m=d[x];Pi.isClockWise(m)===!0&&(d[x]=m.reverse())}let g=Pi.triangulateShape(p,d);for(let x=0,y=d.length;x<y;x++){let m=d[x];p=p.concat(m)}for(let x=0,y=p.length;x<y;x++){let m=p[x];i.push(m.x,m.y,0),o.push(0,0,1),s.push(m.x,m.y)}for(let x=0,y=g.length;x<y;x++){let m=g[x],b=m[0]+f,w=m[1]+f,D=m[2]+f;n.push(b,w,D),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return AF(t,e)}static fromJSON(e,t){let n=[];for(let i=0,o=e.shapes.length;i<o;i++){let s=t[e.shapes[i]];n.push(s)}return new bs(n,e.curveSegments)}};Ss=class extends Pe{constructor(e=1,t=32,n=16,i=0,o=Math.PI*2,s=0,a=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:o,thetaStart:s,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(s+a,Math.PI),u=0,c=[],f=new M,h=new M,p=[],d=[],g=[],x=[];for(let y=0;y<=n;y++){let m=[],b=y/n,w=0;y==0&&s==0?w=.5/t:y==n&&l==Math.PI&&(w=-.5/t);for(let D=0;D<=t;D++){let R=D/t;f.x=-e*Math.cos(i+R*o)*Math.sin(s+b*a),f.y=e*Math.cos(s+b*a),f.z=e*Math.sin(i+R*o)*Math.sin(s+b*a),d.push(f.x,f.y,f.z),h.copy(f).normalize(),g.push(h.x,h.y,h.z),x.push(R+w,1-b),m.push(u++)}c.push(m)}for(let y=0;y<n;y++)for(let m=0;m<t;m++){let b=c[y][m+1],w=c[y][m],D=c[y+1][m],R=c[y+1][m+1];(y!==0||s>0)&&p.push(b,w,R),(y!==n-1||l<Math.PI)&&p.push(w,D,R)}this.setIndex(p),this.setAttribute("position",new Te(d,3)),this.setAttribute("normal",new Te(g,3)),this.setAttribute("uv",new Te(x,2))}static fromJSON(e){return new Ss(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}},gl=class extends Zi{constructor(e=1,t=0){let n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t);this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new gl(e.radius,e.detail)}},yl=class extends Pe{constructor(e=1,t=.4,n=8,i=6,o=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:o},n=Math.floor(n),i=Math.floor(i);let s=[],a=[],l=[],u=[],c=new M,f=new M,h=new M;for(let p=0;p<=n;p++)for(let d=0;d<=i;d++){let g=d/i*o,x=p/n*Math.PI*2;f.x=(e+t*Math.cos(x))*Math.cos(g),f.y=(e+t*Math.cos(x))*Math.sin(g),f.z=t*Math.sin(x),a.push(f.x,f.y,f.z),c.x=e*Math.cos(g),c.y=e*Math.sin(g),h.subVectors(f,c).normalize(),l.push(h.x,h.y,h.z),u.push(d/i),u.push(p/n)}for(let p=1;p<=n;p++)for(let d=1;d<=i;d++){let g=(i+1)*p+d-1,x=(i+1)*(p-1)+d-1,y=(i+1)*(p-1)+d,m=(i+1)*p+d;s.push(g,x,m),s.push(x,y,m)}this.setIndex(s),this.setAttribute("position",new Te(a,3)),this.setAttribute("normal",new Te(l,3)),this.setAttribute("uv",new Te(u,2))}static fromJSON(e){return new yl(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}},vl=class extends Pe{constructor(e=1,t=.4,n=64,i=8,o=2,s=3){super();this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:o,q:s},n=Math.floor(n),i=Math.floor(i);let a=[],l=[],u=[],c=[],f=new M,h=new M,p=new M,d=new M,g=new M,x=new M,y=new M;for(let b=0;b<=n;++b){let w=b/n*o*Math.PI*2;m(w,o,s,e,p),m(w+.01,o,s,e,d),x.subVectors(d,p),y.addVectors(d,p),g.crossVectors(x,y),y.crossVectors(g,x),g.normalize(),y.normalize();for(let D=0;D<=i;++D){let R=D/i*Math.PI*2,L=-t*Math.cos(R),T=t*Math.sin(R);f.x=p.x+(L*y.x+T*g.x),f.y=p.y+(L*y.y+T*g.y),f.z=p.z+(L*y.z+T*g.z),l.push(f.x,f.y,f.z),h.subVectors(f,p).normalize(),u.push(h.x,h.y,h.z),c.push(b/n),c.push(D/i)}}for(let b=1;b<=n;b++)for(let w=1;w<=i;w++){let D=(i+1)*(b-1)+(w-1),R=(i+1)*b+(w-1),L=(i+1)*b+w,T=(i+1)*(b-1)+w;a.push(D,R,T),a.push(R,L,T)}this.setIndex(a),this.setAttribute("position",new Te(l,3)),this.setAttribute("normal",new Te(u,3)),this.setAttribute("uv",new Te(c,2));function m(b,w,D,R,L){let T=Math.cos(b),U=Math.sin(b),F=D/w*b,C=Math.cos(F);L.x=R*(2+C)*.5*T,L.y=R*(2+C)*U*.5,L.z=R*Math.sin(F)*.5}}static fromJSON(e){return new vl(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}},xl=class extends Pe{constructor(e=new yc(new M(-1,-1,0),new M(-1,1,0),new M(1,1,0)),t=64,n=1,i=8,o=!1){super();this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:o};let s=e.computeFrenetFrames(t,o);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;let a=new M,l=new M,u=new ee,c=new M,f=[],h=[],p=[],d=[];g(),this.setIndex(d),this.setAttribute("position",new Te(f,3)),this.setAttribute("normal",new Te(h,3)),this.setAttribute("uv",new Te(p,2));function g(){for(let b=0;b<t;b++)x(b);x(o===!1?t:0),m(),y()}function x(b){c=e.getPointAt(b/t,c);let w=s.normals[b],D=s.binormals[b];for(let R=0;R<=i;R++){let L=R/i*Math.PI*2,T=Math.sin(L),U=-Math.cos(L);l.x=U*w.x+T*D.x,l.y=U*w.y+T*D.y,l.z=U*w.z+T*D.z,l.normalize(),h.push(l.x,l.y,l.z),a.x=c.x+n*l.x,a.y=c.y+n*l.y,a.z=c.z+n*l.z,f.push(a.x,a.y,a.z)}}function y(){for(let b=1;b<=t;b++)for(let w=1;w<=i;w++){let D=(i+1)*(b-1)+(w-1),R=(i+1)*b+(w-1),L=(i+1)*b+w,T=(i+1)*(b-1)+w;d.push(D,R,T),d.push(R,L,T)}}function m(){for(let b=0;b<=t;b++)for(let w=0;w<=i;w++)u.x=b/t,u.y=w/i,p.push(u.x,u.y)}}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new xl(new o1[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},Lp=class extends Pe{constructor(e=null){super();if(this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,i=new M,o=new M;if(e.index!==null){let s=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let u=0,c=l.length;u<c;++u){let f=l[u],h=f.start,p=f.count;for(let d=h,g=h+p;d<g;d+=3)for(let x=0;x<3;x++){let y=a.getX(d+x),m=a.getX(d+(x+1)%3);i.fromBufferAttribute(s,y),o.fromBufferAttribute(s,m),bS(i,o,n)===!0&&(t.push(i.x,i.y,i.z),t.push(o.x,o.y,o.z))}}}else{let s=e.attributes.position;for(let a=0,l=s.count/3;a<l;a++)for(let u=0;u<3;u++){let c=3*a+u,f=3*a+(u+1)%3;i.fromBufferAttribute(s,c),o.fromBufferAttribute(s,f),bS(i,o,n)===!0&&(t.push(i.x,i.y,i.z),t.push(o.x,o.y,o.z))}}this.setAttribute("position",new Te(t,3))}}};SS=Object.freeze({__proto__:null,BoxGeometry:Ti,BoxBufferGeometry:Ti,CircleGeometry:sl,CircleBufferGeometry:sl,ConeGeometry:al,ConeBufferGeometry:al,CylinderGeometry:bo,CylinderBufferGeometry:bo,DodecahedronGeometry:ll,DodecahedronBufferGeometry:ll,EdgesGeometry:mp,ExtrudeGeometry:Ji,ExtrudeBufferGeometry:Ji,IcosahedronGeometry:pl,IcosahedronBufferGeometry:pl,LatheGeometry:dl,LatheBufferGeometry:dl,OctahedronGeometry:ws,OctahedronBufferGeometry:ws,PlaneGeometry:ds,PlaneBufferGeometry:ds,PolyhedronGeometry:Zi,PolyhedronBufferGeometry:Zi,RingGeometry:ml,RingBufferGeometry:ml,ShapeGeometry:bs,ShapeBufferGeometry:bs,SphereGeometry:Ss,SphereBufferGeometry:Ss,TetrahedronGeometry:gl,TetrahedronBufferGeometry:gl,TorusGeometry:yl,TorusBufferGeometry:yl,TorusKnotGeometry:vl,TorusKnotBufferGeometry:vl,TubeGeometry:xl,TubeBufferGeometry:xl,WireframeGeometry:Lp}),Ap=class extends Zt{constructor(e){super();this.type="ShadowMaterial",this.color=new xe(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}};Ap.prototype.isShadowMaterial=!0;Sc=class extends Zt{constructor(e){super();this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};Sc.prototype.isMeshStandardMaterial=!0;Dp=class extends Sc{constructor(e){super();this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ee(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return vn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xe(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};Dp.prototype.isMeshPhysicalMaterial=!0;Ep=class extends Zt{constructor(e){super();this.type="MeshPhongMaterial",this.color=new xe(16777215),this.specular=new xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Fu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};Ep.prototype.isMeshPhongMaterial=!0;Mp=class extends Zt{constructor(e){super();this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};Mp.prototype.isMeshToonMaterial=!0;Rp=class extends Zt{constructor(e){super();this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}};Rp.prototype.isMeshNormalMaterial=!0;Tp=class extends Zt{constructor(e){super();this.type="MeshLambertMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Fu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};Tp.prototype.isMeshLambertMaterial=!0;Fp=class extends Zt{constructor(e){super();this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}};Fp.prototype.isMeshMatcapMaterial=!0;_p=class extends Jt{constructor(e){super();this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};_p.prototype.isLineDashedMaterial=!0;DF=Object.freeze({__proto__:null,ShadowMaterial:Ap,SpriteMaterial:rc,RawShaderMaterial:ms,ShaderMaterial:Yi,PointsMaterial:wo,MeshPhysicalMaterial:Dp,MeshStandardMaterial:Sc,MeshPhongMaterial:Ep,MeshToonMaterial:Mp,MeshNormalMaterial:Rp,MeshLambertMaterial:Tp,MeshDepthMaterial:tc,MeshDistanceMaterial:nc,MeshBasicMaterial:vt,MeshMatcapMaterial:Fp,LineDashedMaterial:_p,LineBasicMaterial:Jt,Material:Zt}),Ct={arraySlice:function(r,e,t){return Ct.isTypedArray(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(i,o){return r[i]-r[o]}let t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(r,e,t){let n=r.length,i=new r.constructor(n);for(let o=0,s=0;s!==n;++o){let a=t[o]*e;for(let l=0;l!==e;++l)i[s++]=r[a+l]}return i},flattenJSON:function(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let s=o[n];if(s!==void 0)if(Array.isArray(s))do s=o[n],s!==void 0&&(e.push(o.time),t.push.apply(t,s)),o=r[i++];while(o!==void 0);else if(s.toArray!==void 0)do s=o[n],s!==void 0&&(e.push(o.time),s.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do s=o[n],s!==void 0&&(e.push(o.time),t.push(s)),o=r[i++];while(o!==void 0)},subclip:function(r,e,t,n,i=30){let o=r.clone();o.name=e;let s=[];for(let l=0;l<o.tracks.length;++l){let u=o.tracks[l],c=u.getValueSize(),f=[],h=[];for(let p=0;p<u.times.length;++p){let d=u.times[p]*i;if(!(d<t||d>=n)){f.push(u.times[p]);for(let g=0;g<c;++g)h.push(u.values[p*c+g])}}f.length!==0&&(u.times=Ct.convertArray(f,u.times.constructor),u.values=Ct.convertArray(h,u.values.constructor),s.push(u))}o.tracks=s;let a=1/0;for(let l=0;l<o.tracks.length;++l)a>o.tracks[l].times[0]&&(a=o.tracks[l].times[0]);for(let l=0;l<o.tracks.length;++l)o.tracks[l].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(r,e=0,t=r,n=30){n<=0&&(n=30);let i=t.tracks.length,o=e/n;for(let s=0;s<i;++s){let a=t.tracks[s],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let u=r.tracks.find(function(y){return y.name===a.name&&y.ValueTypeName===l});if(u===void 0)continue;let c=0,f=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=f/3);let h=0,p=u.getValueSize();u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=p/3);let d=a.times.length-1,g;if(o<=a.times[0]){let y=c,m=f-c;g=Ct.arraySlice(a.values,y,m)}else if(o>=a.times[d]){let y=d*f+c,m=y+f-c;g=Ct.arraySlice(a.values,y,m)}else{let y=a.createInterpolant(),m=c,b=f-c;y.evaluate(o),g=Ct.arraySlice(y.resultBuffer,m,b)}l==="quaternion"&&new ot().fromArray(g).normalize().conjugate().toArray(g);let x=u.times.length;for(let y=0;y<x;++y){let m=y*p+h;if(l==="quaternion")ot.multiplyQuaternionsFlat(u.values,m,g,0,u.values,m);else{let b=p-h*2;for(let w=0;w<b;++w)u.values[m+w]-=g[w]}}}return r.blendMode=tg,r}},$i=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],o=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<o)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,o)}if(n===a)break;if(o=i,i=t[++n],e<i)break t}s=t.length;break n}if(!(e>=o)){let a=t[1];e<a&&(n=2,o=a);for(let l=n-2;;){if(o===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=o,o=t[--n-1],e>=o)break t}s=n,n=0;break n}break e}for(;n<s;){let a=n+s>>>1;e<t[a]?s=a:n=a+1}if(i=t[n],o=t[n-1],o===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,o,e)}this._cachedIndex=n,this.intervalChanged_(n,o,i)}return this.interpolate_(n,o,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i;for(let s=0;s!==i;++s)t[s]=n[o+s];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};$i.prototype.beforeStart_=$i.prototype.copySampleValue_;$i.prototype.afterEnd_=$i.prototype.copySampleValue_;u1=class extends $i{constructor(e,t,n,i){super(e,t,n,i);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:as,endingEnd:as}}intervalChanged_(e,t,n){let i=this.parameterPositions,o=e-2,s=e+1,a=i[o],l=i[s];if(a===void 0)switch(this.getSettings_().endingStart){case ls:o=e,a=2*t-n;break;case Nu:o=i.length-2,a=t+i[o]-i[o+1];break;default:o=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case ls:s=e,l=2*n-t;break;case Nu:s=1,l=n+i[1]-i[0];break;default:s=e-1,l=t}let u=(n-t)*.5,c=this.valueSize;this._weightPrev=u/(t-a),this._weightNext=u/(l-n),this._offsetPrev=o*c,this._offsetNext=s*c}interpolate_(e,t,n,i){let o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,l=e*a,u=l-a,c=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,p=this._weightNext,d=(n-t)/(i-t),g=d*d,x=g*d,y=-h*x+2*h*g-h*d,m=(1+h)*x+(-1.5-2*h)*g+(-.5+h)*d+1,b=(-1-p)*x+(1.5+p)*g+.5*d,w=p*x-p*g;for(let D=0;D!==a;++D)o[D]=y*s[c+D]+m*s[u+D]+b*s[l+D]+w*s[f+D];return o}},Cp=class extends $i{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,l=e*a,u=l-a,c=(n-t)/(i-t),f=1-c;for(let h=0;h!==a;++h)o[h]=s[u+h]*f+s[l+h]*c;return o}},c1=class extends $i{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},yi=class{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ct.convertArray(t,this.TimeBufferType),this.values=Ct.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Ct.convertArray(e.times,Array),values:Ct.convertArray(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new c1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Cp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new u1(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Iu:t=this.InterpolantFactoryMethodDiscrete;break;case Uu:t=this.InterpolantFactoryMethodLinear;break;case Af:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Iu;case this.InterpolantFactoryMethodLinear:return Uu;case this.InterpolantFactoryMethodSmooth:return Af}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,o=0,s=i-1;for(;o!==i&&n[o]<e;)++o;for(;s!==-1&&n[s]>t;)--s;if(++s,o!==0||s!==i){o>=s&&(s=Math.max(s,1),o=s-1);let a=this.getValueSize();this.times=Ct.arraySlice(n,o,s),this.values=Ct.arraySlice(this.values,o*a,s*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,o=n.length;o===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let a=0;a!==o;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(s!==null&&s>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,s),e=!1;break}s=l}if(i!==void 0&&Ct.isTypedArray(i))for(let a=0,l=i.length;a!==l;++a){let u=i[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){let e=Ct.arraySlice(this.times),t=Ct.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Af,o=e.length-1,s=1;for(let a=1;a<o;++a){let l=!1,u=e[a],c=e[a+1];if(u!==c&&(a!==1||u!==e[0]))if(i)l=!0;else{let f=a*n,h=f-n,p=f+n;for(let d=0;d!==n;++d){let g=t[f+d];if(g!==t[h+d]||g!==t[p+d]){l=!0;break}}}if(l){if(a!==s){e[s]=e[a];let f=a*n,h=s*n;for(let p=0;p!==n;++p)t[h+p]=t[f+p]}++s}}if(o>0){e[s]=e[o];for(let a=o*n,l=s*n,u=0;u!==n;++u)t[l+u]=t[a+u];++s}return s!==e.length?(this.times=Ct.arraySlice(e,0,s),this.values=Ct.arraySlice(t,0,s*n)):(this.times=e,this.values=t),this}clone(){let e=Ct.arraySlice(this.times,0),t=Ct.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};yi.prototype.TimeBufferType=Float32Array;yi.prototype.ValueBufferType=Float32Array;yi.prototype.DefaultInterpolation=Uu;Lo=class extends yi{};Lo.prototype.ValueTypeName="bool";Lo.prototype.ValueBufferType=Array;Lo.prototype.DefaultInterpolation=Iu;Lo.prototype.InterpolantFactoryMethodLinear=void 0;Lo.prototype.InterpolantFactoryMethodSmooth=void 0;Pp=class extends yi{};Pp.prototype.ValueTypeName="color";wl=class extends yi{};wl.prototype.ValueTypeName="number";h1=class extends $i{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t),u=e*a;for(let c=u+a;u!==c;u+=4)ot.slerpFlat(o,0,s,u-a,s,u,l);return o}},Ls=class extends yi{InterpolantFactoryMethodLinear(e){return new h1(this.times,this.values,this.getValueSize(),e)}};Ls.prototype.ValueTypeName="quaternion";Ls.prototype.DefaultInterpolation=Uu;Ls.prototype.InterpolantFactoryMethodSmooth=void 0;Ao=class extends yi{};Ao.prototype.ValueTypeName="string";Ao.prototype.ValueBufferType=Array;Ao.prototype.DefaultInterpolation=Iu;Ao.prototype.InterpolantFactoryMethodLinear=void 0;Ao.prototype.InterpolantFactoryMethodSmooth=void 0;bl=class extends yi{};bl.prototype.ValueTypeName="vector";Sl=class{constructor(e,t=-1,n,i=Df){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=oi(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let s=0,a=n.length;s!==a;++s)t.push(MF(n[s]).scale(i));let o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let o=0,s=n.length;o!==s;++o)t.push(yi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let o=t.length,s=[];for(let a=0;a<o;a++){let l=[],u=[];l.push((a+o-1)%o,a,(a+1)%o),u.push(0,1,0);let c=Ct.getKeyframeOrder(l);l=Ct.sortedArray(l,1,c),u=Ct.sortedArray(u,1,c),!i&&l[0]===0&&(l.push(o),u.push(u[0])),s.push(new wl(".morphTargetInfluences["+t[a].name+"]",l,u).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},o=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){let u=e[a],c=u.name.match(o);if(c&&c.length>1){let f=c[1],h=i[f];h||(i[f]=h=[]),h.push(u)}}let s=[];for(let a in i)s.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(f,h,p,d,g){if(p.length!==0){let x=[],y=[];Ct.flattenJSON(p,x,y,d),x.length!==0&&g.push(new f(h,x,y))}},i=[],o=e.name||"default",s=e.fps||30,a=e.blendMode,l=e.length||-1,u=e.hierarchy||[];for(let f=0;f<u.length;f++){let h=u[f].keys;if(!(!h||h.length===0))if(h[0].morphTargets){let p={},d;for(d=0;d<h.length;d++)if(h[d].morphTargets)for(let g=0;g<h[d].morphTargets.length;g++)p[h[d].morphTargets[g]]=-1;for(let g in p){let x=[],y=[];for(let m=0;m!==h[d].morphTargets.length;++m){let b=h[d];x.push(b.time),y.push(b.morphTarget===g?1:0)}i.push(new wl(".morphTargetInfluence["+g+"]",x,y))}l=p.length*(s||1)}else{let p=".bones["+t[f].name+"]";n(bl,p+".position",h,"pos",i),n(Ls,p+".quaternion",h,"rot",i),n(bl,p+".scale",h,"scl",i)}}return i.length===0?null:new this(o,l,i,a)}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let o=this.tracks[n];t=Math.max(t,o.times[o.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};As={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}},kp=class{constructor(e,t,n){let i=this,o=!1,s=0,a=0,l,u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(c){a++,o===!1&&i.onStart!==void 0&&i.onStart(c,s,a),o=!0},this.itemEnd=function(c){s++,i.onProgress!==void 0&&i.onProgress(c,s,a),s===a&&(o=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(c){i.onError!==void 0&&i.onError(c)},this.resolveURL=function(c){return l?l(c):c},this.setURLModifier=function(c){return l=c,this},this.addHandler=function(c,f){return u.push(c,f),this},this.removeHandler=function(c){let f=u.indexOf(c);return f!==-1&&u.splice(f,2),this},this.getHandler=function(c){for(let f=0,h=u.length;f<h;f+=2){let p=u[f],d=u[f+1];if(p.global&&(p.lastIndex=0),p.test(c))return d}return null}}},LS=new kp,Mn=class{constructor(e){this.manager=e!==void 0?e:LS,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,o){n.load(e,i,t,o)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},Dr={},ki=class extends Mn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let o=As.get(e);if(o!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(o),this.manager.itemEnd(e)},0),o;if(Dr[e]!==void 0){Dr[e].push({onLoad:t,onProgress:n,onError:i});return}Dr[e]=[],Dr[e].push({onLoad:t,onProgress:n,onError:i});let s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});fetch(s).then(a=>{if(a.status===200||a.status===0){a.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received.");let l=Dr[e],u=a.body.getReader(),c=a.headers.get("Content-Length"),f=c?parseInt(c):0,h=f!==0,p=0;return new ReadableStream({start(d){g();function g(){u.read().then(({done:x,value:y})=>{if(x)d.close();else{p+=y.byteLength;let m=new ProgressEvent("progress",{lengthComputable:h,loaded:p,total:f});for(let b=0,w=l.length;b<w;b++){let D=l[b];D.onProgress&&D.onProgress(m)}d.enqueue(y),g()}})}}})}else throw Error(`fetch for "${a.url}" responded with ${a.status}: ${a.statusText}`)}).then(a=>{let l=new Response(a);switch(this.responseType){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,this.mimeType));case"json":return l.json();default:return l.text()}}).then(a=>{As.add(e,a);let l=Dr[e];delete Dr[e];for(let u=0,c=l.length;u<c;u++){let f=l[u];f.onLoad&&f.onLoad(a)}this.manager.itemEnd(e)}).catch(a=>{let l=Dr[e];delete Dr[e];for(let u=0,c=l.length;u<c;u++){let f=l[u];f.onError&&f.onError(a)}this.manager.itemError(e),this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},AS=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=new ki(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(a){try{t(o.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),o.manager.itemError(e)}},n,i)}parse(e){let t=[];for(let n=0;n<e.length;n++){let i=Sl.parse(e[n]);t.push(i)}return t}},DS=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=[],a=new hp,l=new ki(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(o.withCredentials);let u=0;function c(f){l.load(e[f],function(h){let p=o.parse(h,!0);s[f]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},u+=1,u===6&&(p.mipmapCount===1&&(a.minFilter=Kt),a.image=s,a.format=p.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let f=0,h=e.length;f<h;++f)c(f);else l.load(e,function(f){let h=o.parse(f,!0);if(h.isCubemap){let p=h.mipmaps.length/h.mipmapCount;for(let d=0;d<p;d++){s[d]={mipmaps:[]};for(let g=0;g<h.mipmapCount;g++)s[d].mipmaps.push(h.mipmaps[d*h.mipmapCount+g]),s[d].format=h.format,s[d].width=h.width,s[d].height=h.height}a.image=s}else a.image.width=h.width,a.image.height=h.height,a.mipmaps=h.mipmaps;h.mipmapCount===1&&(a.minFilter=Kt),a.format=h.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}},Ll=class extends Mn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let o=this,s=As.get(e);if(s!==void 0)return o.manager.itemStart(e),setTimeout(function(){t&&t(s),o.manager.itemEnd(e)},0),s;let a=Ff("img");function l(){c(),As.add(e,this),t&&t(this),o.manager.itemEnd(e)}function u(f){c(),i&&i(f),o.manager.itemError(e),o.manager.itemEnd(e)}function c(){a.removeEventListener("load",l,!1),a.removeEventListener("error",u,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",u,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),o.manager.itemStart(e),a.src=e,a}},f1=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=new ps,s=new Ll(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function l(u){s.load(e[u],function(c){o.images[u]=c,a++,a===6&&(o.needsUpdate=!0,t&&t(o))},void 0,i)}for(let u=0;u<e.length;++u)l(u);return o}},p1=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=new vo,a=new ki(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(o.withCredentials),a.load(e,function(l){let u=o.parse(l);!u||(u.image!==void 0?s.image=u.image:u.data!==void 0&&(s.image.width=u.width,s.image.height=u.height,s.image.data=u.data),s.wrapS=u.wrapS!==void 0?u.wrapS:mn,s.wrapT=u.wrapT!==void 0?u.wrapT:mn,s.magFilter=u.magFilter!==void 0?u.magFilter:Kt,s.minFilter=u.minFilter!==void 0?u.minFilter:Kt,s.anisotropy=u.anisotropy!==void 0?u.anisotropy:1,u.encoding!==void 0&&(s.encoding=u.encoding),u.flipY!==void 0&&(s.flipY=u.flipY),u.format!==void 0&&(s.format=u.format),u.type!==void 0&&(s.type=u.type),u.mipmaps!==void 0&&(s.mipmaps=u.mipmaps,s.minFilter=is),u.mipmapCount===1&&(s.minFilter=Kt),u.generateMipmaps!==void 0&&(s.generateMipmaps=u.generateMipmaps),s.needsUpdate=!0,t&&t(s,u))},n,i),s}},Lc=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=new Yt,s=new Ll(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(a){o.image=a,o.needsUpdate=!0,t!==void 0&&t(o)},n,i),o}},vi=class extends je{constructor(e,t=1){super();this.type="Light",this.color=new xe(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};vi.prototype.isLight=!0;Bp=class extends vi{constructor(e,t,n){super(e,n);this.type="HemisphereLight",this.position.copy(je.DefaultUp),this.updateMatrix(),this.groundColor=new xe(t)}copy(e){return vi.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};Bp.prototype.isHemisphereLight=!0;ES=new Ae,MS=new M,RS=new M,zp=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ee(512,512),this.map=null,this.mapPass=null,this.matrix=new Ae,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Qa,this._frameExtents=new ee(1,1),this._viewportCount=1,this._viewports=[new xt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;MS.setFromMatrixPosition(e.matrixWorld),t.position.copy(MS),RS.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(RS),t.updateMatrixWorld(),ES.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ES),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},d1=class extends zp{constructor(){super(new Gt(50,1,.5,500));this.focus=1}updateMatrices(e){let t=this.camera,n=Gu*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,o=e.distance||t.far;(n!==t.fov||i!==t.aspect||o!==t.far)&&(t.fov=n,t.aspect=i,t.far=o,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};d1.prototype.isSpotLightShadow=!0;Ip=class extends vi{constructor(e,t,n=0,i=Math.PI/3,o=0,s=1){super(e,t);this.type="SpotLight",this.position.copy(je.DefaultUp),this.updateMatrix(),this.target=new je,this.distance=n,this.angle=i,this.penumbra=o,this.decay=s,this.shadow=new d1}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};Ip.prototype.isSpotLight=!0;TS=new Ae,Ac=new M,m1=new M,g1=class extends zp{constructor(){super(new Gt(90,1,.5,500));this._frameExtents=new ee(4,2),this._viewportCount=6,this._viewports=[new xt(2,1,1,1),new xt(0,1,1,1),new xt(3,1,1,1),new xt(1,1,1,1),new xt(3,0,1,1),new xt(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,i=this.matrix,o=e.distance||n.far;o!==n.far&&(n.far=o,n.updateProjectionMatrix()),Ac.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ac),m1.copy(n.position),m1.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(m1),n.updateMatrixWorld(),i.makeTranslation(-Ac.x,-Ac.y,-Ac.z),TS.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(TS)}};g1.prototype.isPointLightShadow=!0;Up=class extends vi{constructor(e,t,n=0,i=1){super(e,t);this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new g1}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}};Up.prototype.isPointLight=!0;y1=class extends zp{constructor(){super(new Ya(-5,5,5,-5,.5,500))}};y1.prototype.isDirectionalLightShadow=!0;Np=class extends vi{constructor(e,t){super(e,t);this.type="DirectionalLight",this.position.copy(je.DefaultUp),this.updateMatrix(),this.target=new je,this.shadow=new y1}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};Np.prototype.isDirectionalLight=!0;Op=class extends vi{constructor(e,t){super(e,t);this.type="AmbientLight"}};Op.prototype.isAmbientLight=!0;Gp=class extends vi{constructor(e,t,n=10,i=10){super(e,t);this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};Gp.prototype.isRectAreaLight=!0;Wp=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new M)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,i=e.y,o=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScaledVector(s[1],.488603*i),t.addScaledVector(s[2],.488603*o),t.addScaledVector(s[3],.488603*n),t.addScaledVector(s[4],1.092548*(n*i)),t.addScaledVector(s[5],1.092548*(i*o)),t.addScaledVector(s[6],.315392*(3*o*o-1)),t.addScaledVector(s[7],1.092548*(n*o)),t.addScaledVector(s[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){let n=e.x,i=e.y,o=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScaledVector(s[1],2*.511664*i),t.addScaledVector(s[2],2*.511664*o),t.addScaledVector(s[3],2*.511664*n),t.addScaledVector(s[4],2*.429043*n*i),t.addScaledVector(s[5],2*.429043*i*o),t.addScaledVector(s[6],.743125*o*o-.247708),t.addScaledVector(s[7],2*.429043*n*o),t.addScaledVector(s[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){let n=e.x,i=e.y,o=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*o,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*o,t[6]=.315392*(3*o*o-1),t[7]=1.092548*n*o,t[8]=.546274*(n*n-i*i)}};Wp.prototype.isSphericalHarmonics3=!0;Al=class extends vi{constructor(e=new Wp,t=1){super(void 0,t);this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};Al.prototype.isLightProbe=!0;v1=class extends Mn{constructor(e){super(e);this.textures={}}load(e,t,n,i){let o=this,s=new ki(o.manager);s.setPath(o.path),s.setRequestHeader(o.requestHeader),s.setWithCredentials(o.withCredentials),s.load(e,function(a){try{t(o.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),o.manager.itemError(e)}},n,i)}parse(e){let t=this.textures;function n(o){return t[o]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",o),t[o]}let i=new DF[e.type];if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new xe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.format!==void 0&&(i.format=e.format),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==1&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(let o in e.uniforms){let s=e.uniforms[o];switch(i.uniforms[o]={},s.type){case"t":i.uniforms[o].value=n(s.value);break;case"c":i.uniforms[o].value=new xe().setHex(s.value);break;case"v2":i.uniforms[o].value=new ee().fromArray(s.value);break;case"v3":i.uniforms[o].value=new M().fromArray(s.value);break;case"v4":i.uniforms[o].value=new xt().fromArray(s.value);break;case"m3":i.uniforms[o].value=new Qt().fromArray(s.value);break;case"m4":i.uniforms[o].value=new Ae().fromArray(s.value);break;default:i.uniforms[o].value=s.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(let o in e.extensions)i.extensions[o]=e.extensions[o];if(e.shading!==void 0&&(i.flatShading=e.shading===1),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ee().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ee().fromArray(e.clearcoatNormalScale)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}},Dc=class{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(n){return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},Vp=class extends Pe{constructor(){super();this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){let e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};Vp.prototype.isInstancedBufferGeometry=!0;x1=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=new ki(o.manager);s.setPath(o.path),s.setRequestHeader(o.requestHeader),s.setWithCredentials(o.withCredentials),s.load(e,function(a){try{t(o.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),o.manager.itemError(e)}},n,i)}parse(e){let t={},n={};function i(p,d){if(t[d]!==void 0)return t[d];let x=p.interleavedBuffers[d],y=o(p,x.buffer),m=_a(x.type,y),b=new yo(m,x.stride);return b.uuid=x.uuid,t[d]=b,b}function o(p,d){if(n[d]!==void 0)return n[d];let x=p.arrayBuffers[d],y=new Uint32Array(x).buffer;return n[d]=y,y}let s=e.isInstancedBufferGeometry?new Vp:new Pe,a=e.data.index;if(a!==void 0){let p=_a(a.type,a.array);s.setIndex(new qe(p,1))}let l=e.data.attributes;for(let p in l){let d=l[p],g;if(d.isInterleavedBufferAttribute){let x=i(e.data,d.data);g=new Ar(x,d.itemSize,d.offset,d.normalized)}else{let x=_a(d.type,d.array),y=d.isInstancedBufferAttribute?xo:qe;g=new y(x,d.itemSize,d.normalized)}d.name!==void 0&&(g.name=d.name),d.usage!==void 0&&g.setUsage(d.usage),d.updateRange!==void 0&&(g.updateRange.offset=d.updateRange.offset,g.updateRange.count=d.updateRange.count),s.setAttribute(p,g)}let u=e.data.morphAttributes;if(u)for(let p in u){let d=u[p],g=[];for(let x=0,y=d.length;x<y;x++){let m=d[x],b;if(m.isInterleavedBufferAttribute){let w=i(e.data,m.data);b=new Ar(w,m.itemSize,m.offset,m.normalized)}else{let w=_a(m.type,m.array);b=new qe(w,m.itemSize,m.normalized)}m.name!==void 0&&(b.name=m.name),g.push(b)}s.morphAttributes[p]=g}e.data.morphTargetsRelative&&(s.morphTargetsRelative=!0);let f=e.data.groups||e.data.drawcalls||e.data.offsets;if(f!==void 0)for(let p=0,d=f.length;p!==d;++p){let g=f[p];s.addGroup(g.start,g.count,g.materialIndex)}let h=e.data.boundingSphere;if(h!==void 0){let p=new M;h.center!==void 0&&p.fromArray(h.center),s.boundingSphere=new vr(p,h.radius)}return e.name&&(s.name=e.name),e.userData&&(s.userData=e.userData),s}},FS=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=this.path===""?Dc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;let a=new ki(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let u=null;try{u=JSON.parse(l)}catch(f){i!==void 0&&i(f),console.error("THREE:ObjectLoader: Can't parse "+e+".",f.message);return}let c=u.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}o.parse(u,t)},n,i)}async loadAsync(e,t){let n=this,i=this.path===""?Dc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;let o=new ki(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials);let s=await o.loadAsync(e,t),a=JSON.parse(s),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){let n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),o=this.parseGeometries(e.geometries,i),s=this.parseImages(e.images,function(){t!==void 0&&t(u)}),a=this.parseTextures(e.textures,s),l=this.parseMaterials(e.materials,a),u=this.parseObject(e.object,o,l,a,n),c=this.parseSkeletons(e.skeletons,u);if(this.bindSkeletons(u,c),t!==void 0){let f=!1;for(let h in s)if(s[h]instanceof HTMLImageElement){f=!0;break}f===!1&&t(u)}return u}async parseAsync(e){let t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),o=await this.parseImagesAsync(e.images),s=this.parseTextures(e.textures,o),a=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,i,a,s,t),u=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,u),l}parseShapes(e){let t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){let o=new Ci().fromJSON(e[n]);t[o.uuid]=o}return t}parseSkeletons(e,t){let n={},i={};if(t.traverse(function(o){o.isBone&&(i[o.uuid]=o)}),e!==void 0)for(let o=0,s=e.length;o<s;o++){let a=new hc().fromJSON(e[o],i);n[a.uuid]=a}return n}parseGeometries(e,t){let n={};if(e!==void 0){let i=new x1;for(let o=0,s=e.length;o<s;o++){let a,l=e[o];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:l.type in SS?a=SS[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),a.isBufferGeometry===!0&&l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(e,t){let n={},i={};if(e!==void 0){let o=new v1;o.setTextures(t);for(let s=0,a=e.length;s<a;s++){let l=e[s];if(l.type==="MultiMaterial"){let u=[];for(let c=0;c<l.materials.length;c++){let f=l.materials[c];n[f.uuid]===void 0&&(n[f.uuid]=o.parse(f)),u.push(n[f.uuid])}i[l.uuid]=u}else n[l.uuid]===void 0&&(n[l.uuid]=o.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){let t={};if(e!==void 0)for(let n=0;n<e.length;n++){let i=e[n],o=Sl.parse(i);t[o.uuid]=o}return t}parseImages(e,t){let n=this,i={},o;function s(l){return n.manager.itemStart(l),o.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){let u=l,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(u)?u:n.resourcePath+u;return s(c)}else return l.data?{data:_a(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){let l=new kp(t);o=new Ll(l),o.setCrossOrigin(this.crossOrigin);for(let u=0,c=e.length;u<c;u++){let f=e[u],h=f.url;if(Array.isArray(h)){i[f.uuid]=[];for(let p=0,d=h.length;p<d;p++){let g=h[p],x=a(g);x!==null&&(x instanceof HTMLImageElement?i[f.uuid].push(x):i[f.uuid].push(new vo(x.data,x.width,x.height)))}}else{let p=a(f.url);p!==null&&(i[f.uuid]=p)}}}return i}async parseImagesAsync(e){let t=this,n={},i;async function o(s){if(typeof s=="string"){let a=s,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(l)}else return s.data?{data:_a(s.type,s.data),width:s.width,height:s.height}:null}if(e!==void 0&&e.length>0){i=new Ll(this.manager),i.setCrossOrigin(this.crossOrigin);for(let s=0,a=e.length;s<a;s++){let l=e[s],u=l.url;if(Array.isArray(u)){n[l.uuid]=[];for(let c=0,f=u.length;c<f;c++){let h=u[c],p=await o(h);p!==null&&(p instanceof HTMLImageElement?n[l.uuid].push(p):n[l.uuid].push(new vo(p.data,p.width,p.height)))}}else{let c=await o(l.url);c!==null&&(n[l.uuid]=c)}}}return n}parseTextures(e,t){function n(o,s){return typeof o=="number"?o:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",o),s[o])}let i={};if(e!==void 0)for(let o=0,s=e.length;o<s;o++){let a=e[o];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);let l,u=t[a.image];Array.isArray(u)?(l=new ps(u),u.length===6&&(l.needsUpdate=!0)):(u&&u.data?l=new vo(u.data,u.width,u.height):l=new Yt(u),u&&(l.needsUpdate=!0)),l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),a.mapping!==void 0&&(l.mapping=n(a.mapping,RF)),a.offset!==void 0&&l.offset.fromArray(a.offset),a.repeat!==void 0&&l.repeat.fromArray(a.repeat),a.center!==void 0&&l.center.fromArray(a.center),a.rotation!==void 0&&(l.rotation=a.rotation),a.wrap!==void 0&&(l.wrapS=n(a.wrap[0],_S),l.wrapT=n(a.wrap[1],_S)),a.format!==void 0&&(l.format=a.format),a.type!==void 0&&(l.type=a.type),a.encoding!==void 0&&(l.encoding=a.encoding),a.minFilter!==void 0&&(l.minFilter=n(a.minFilter,CS)),a.magFilter!==void 0&&(l.magFilter=n(a.magFilter,CS)),a.anisotropy!==void 0&&(l.anisotropy=a.anisotropy),a.flipY!==void 0&&(l.flipY=a.flipY),a.premultiplyAlpha!==void 0&&(l.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(l.unpackAlignment=a.unpackAlignment),a.userData!==void 0&&(l.userData=a.userData),i[a.uuid]=l}return i}parseObject(e,t,n,i,o){let s;function a(h){return t[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",h),t[h]}function l(h){if(h!==void 0){if(Array.isArray(h)){let p=[];for(let d=0,g=h.length;d<g;d++){let x=h[d];n[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),p.push(n[x])}return p}return n[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",h),n[h]}}function u(h){return i[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",h),i[h]}let c,f;switch(e.type){case"Scene":s=new xs,e.background!==void 0&&(Number.isInteger(e.background)?s.background=new xe(e.background):s.background=u(e.background)),e.environment!==void 0&&(s.environment=u(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?s.fog=new el(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(s.fog=new $a(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":s=new Gt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(s.focus=e.focus),e.zoom!==void 0&&(s.zoom=e.zoom),e.filmGauge!==void 0&&(s.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(s.filmOffset=e.filmOffset),e.view!==void 0&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new Ya(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(s.zoom=e.zoom),e.view!==void 0&&(s.view=Object.assign({},e.view));break;case"AmbientLight":s=new Op(e.color,e.intensity);break;case"DirectionalLight":s=new Np(e.color,e.intensity);break;case"PointLight":s=new Up(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new Gp(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new Ip(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":s=new Bp(e.color,e.groundColor,e.intensity);break;case"LightProbe":s=new Al().fromJSON(e);break;case"SkinnedMesh":c=a(e.geometry),f=l(e.material),s=new uc(c,f),e.bindMode!==void 0&&(s.bindMode=e.bindMode),e.bindMatrix!==void 0&&s.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(s.skeleton=e.skeleton);break;case"Mesh":c=a(e.geometry),f=l(e.material),s=new Lt(c,f);break;case"InstancedMesh":c=a(e.geometry),f=l(e.material);let h=e.count,p=e.instanceMatrix,d=e.instanceColor;s=new sp(c,f,h),s.instanceMatrix=new xo(new Float32Array(p.array),16),d!==void 0&&(s.instanceColor=new xo(new Float32Array(d.array),d.itemSize));break;case"LOD":s=new Yg;break;case"Line":s=new Ki(a(e.geometry),l(e.material));break;case"LineLoop":s=new lp(a(e.geometry),l(e.material));break;case"LineSegments":s=new Bn(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":s=new ol(a(e.geometry),l(e.material));break;case"Sprite":s=new lc(l(e.material));break;case"Group":s=new gi;break;case"Bone":s=new cc;break;default:s=new je}if(s.uuid=e.uuid,e.name!==void 0&&(s.name=e.name),e.matrix!==void 0?(s.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(s.matrixAutoUpdate=e.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(e.position!==void 0&&s.position.fromArray(e.position),e.rotation!==void 0&&s.rotation.fromArray(e.rotation),e.quaternion!==void 0&&s.quaternion.fromArray(e.quaternion),e.scale!==void 0&&s.scale.fromArray(e.scale)),e.castShadow!==void 0&&(s.castShadow=e.castShadow),e.receiveShadow!==void 0&&(s.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(s.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(s.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(s.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&s.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(s.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(s.visible=e.visible),e.frustumCulled!==void 0&&(s.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(s.renderOrder=e.renderOrder),e.userData!==void 0&&(s.userData=e.userData),e.layers!==void 0&&(s.layers.mask=e.layers),e.children!==void 0){let h=e.children;for(let p=0;p<h.length;p++)s.add(this.parseObject(h[p],t,n,i,o))}if(e.animations!==void 0){let h=e.animations;for(let p=0;p<h.length;p++){let d=h[p];s.animations.push(o[d])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(s.autoUpdate=e.autoUpdate);let h=e.levels;for(let p=0;p<h.length;p++){let d=h[p],g=s.getObjectByProperty("uuid",d.object);g!==void 0&&s.addLevel(g,d.distance)}}return s}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){let i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}},RF={UVMapping:bf,CubeReflectionMapping:ts,CubeRefractionMapping:ns,EquirectangularReflectionMapping:_u,EquirectangularRefractionMapping:Cu,CubeUVReflectionMapping:Ma,CubeUVRefractionMapping:Pu},_S={RepeatWrapping:ku,ClampToEdgeWrapping:mn,MirroredRepeatWrapping:Bu},CS={NearestFilter:jt,NearestMipmapNearestFilter:Sf,NearestMipmapLinearFilter:Lf,LinearFilter:Kt,LinearMipmapNearestFilter:H0,LinearMipmapLinearFilter:is},w1=class extends Mn{constructor(e){super(e);typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let o=this,s=As.get(e);if(s!==void 0)return o.manager.itemStart(e),setTimeout(function(){t&&t(s),o.manager.itemEnd(e)},0),s;let a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(l){As.add(e,l),t&&t(l),o.manager.itemEnd(e)}).catch(function(l){i&&i(l),o.manager.itemError(e),o.manager.itemEnd(e)}),o.manager.itemStart(e)}};w1.prototype.isImageBitmapLoader=!0;b1={getContext:function(){return Hp===void 0&&(Hp=new(window.AudioContext||window.webkitAudioContext)),Hp},setContext:function(r){Hp=r}},S1=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=new ki(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(a){try{let l=a.slice(0);b1.getContext().decodeAudioData(l,function(c){t(c)})}catch(l){i?i(l):console.error(l),o.manager.itemError(e)}},n,i)}},L1=class extends Al{constructor(e,t,n=1){super(void 0,n);let i=new xe().set(e),o=new xe().set(t),s=new M(i.r,i.g,i.b),a=new M(o.r,o.g,o.b),l=Math.sqrt(Math.PI),u=l*Math.sqrt(.75);this.sh.coefficients[0].copy(s).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(s).sub(a).multiplyScalar(u)}};L1.prototype.isHemisphereLightProbe=!0;A1=class extends Al{constructor(e,t=1){super(void 0,t);let n=new xe().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}};A1.prototype.isAmbientLightProbe=!0;PS=new Ae,kS=new Ae,Ds=new Ae,BS=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Gt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Gt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Ds.copy(e.projectionMatrix);let i=t.eyeSep/2,o=i*t.near/t.focus,s=t.near*Math.tan(cs*t.fov*.5)/t.zoom,a,l;kS.elements[12]=-i,PS.elements[12]=i,a=-s*t.aspect+o,l=s*t.aspect+o,Ds.elements[0]=2*t.near/(l-a),Ds.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Ds),a=-s*t.aspect-o,l=s*t.aspect-o,Ds.elements[0]=2*t.near/(l-a),Ds.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Ds)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(kS),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(PS)}},D1=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=zS(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=zS();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};Es=new M,IS=new ot,TF=new M,Ms=new M,US=class extends je{constructor(){super();this.type="AudioListener",this.context=b1.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new D1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Es,IS,TF),Ms.set(0,0,-1).applyQuaternion(IS),t.positionX){let i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Es.x,i),t.positionY.linearRampToValueAtTime(Es.y,i),t.positionZ.linearRampToValueAtTime(Es.z,i),t.forwardX.linearRampToValueAtTime(Ms.x,i),t.forwardY.linearRampToValueAtTime(Ms.y,i),t.forwardZ.linearRampToValueAtTime(Ms.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Es.x,Es.y,Es.z),t.setOrientation(Ms.x,Ms.y,Ms.z,n.x,n.y,n.z)}},qp=class extends je{constructor(e){super();this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}},Rs=new M,NS=new ot,FF=new M,Ts=new M,OS=class extends qp{constructor(e){super(e);this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Rs,NS,FF),Ts.set(0,0,1).applyQuaternion(NS);let t=this.panner;if(t.positionX){let n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Rs.x,n),t.positionY.linearRampToValueAtTime(Rs.y,n),t.positionZ.linearRampToValueAtTime(Rs.z,n),t.orientationX.linearRampToValueAtTime(Ts.x,n),t.orientationY.linearRampToValueAtTime(Ts.y,n),t.orientationZ.linearRampToValueAtTime(Ts.z,n)}else t.setPosition(Rs.x,Rs.y,Rs.z),t.setOrientation(Ts.x,Ts.y,Ts.z)}},E1=class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}},M1=class{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,o,s;switch(t){case"quaternion":i=this._slerp,o=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,o=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,o=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=o,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let n=this.buffer,i=this.valueSize,o=e*i+i,s=this.cumulativeWeight;if(s===0){for(let a=0;a!==i;++a)n[o+a]=n[a];s=t}else{s+=t;let a=t/s;this._mixBufferRegion(n,o,0,a,i)}this.cumulativeWeight=s}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,o=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,o<1){let l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-o,t)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,u=t+t;l!==u;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,s=i;o!==s;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,o){if(i>=.5)for(let s=0;s!==o;++s)e[t+s]=e[n+s]}_slerp(e,t,n,i){ot.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){let s=this._workIndex*o;ot.multiplyQuaternionsFlat(e,s,e,t,e,n),ot.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,o){let s=1-i;for(let a=0;a!==o;++a){let l=t+a;e[l]=e[l]*s+e[n+a]*i}}_lerpAdditive(e,t,n,i,o){for(let s=0;s!==o;++s){let a=t+s;e[a]=e[a]+e[n+s]*i}}},R1="\\[\\]\\.:\\/",_F=new RegExp("["+R1+"]","g"),T1="[^"+R1+"]",CF="[^"+R1.replace("\\.","")+"]",PF=/((?:WC+[\/:])*)/.source.replace("WC",T1),kF=/(WCOD+)?/.source.replace("WCOD",CF),BF=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",T1),zF=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",T1),IF=new RegExp("^"+PF+kF+BF+zF+"$"),UF=["material","materials","bones"],GS=class{constructor(e,t,n){let i=n||ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},ut=class{constructor(e,t,n){this.path=t,this.parsedPath=n||ut.parseTrackName(t),this.node=ut.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new ut.Composite(e,t,n):new ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(_F,"")}static parseTrackName(e){let t=IF.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let o=n.nodeName.substring(i+1);UF.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(o){for(let s=0;s<o.length;s++){let a=o[s];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,o=t.propertyIndex;if(e||(e=ut.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let u=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let c=0;c<e.length;c++)if(e[c].name===u){u=c;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(u!==void 0){if(e[u]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[u]}}let s=e[i];if(s===void 0){let u=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+u+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(o!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[o]!==void 0&&(o=e.morphTargetDictionary[o])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=o}else s.fromArray!==void 0&&s.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ut.Composite=GS;ut.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ut.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ut.prototype.GetterByBindingType=[ut.prototype._getValue_direct,ut.prototype._getValue_array,ut.prototype._getValue_arrayElement,ut.prototype._getValue_toArray];ut.prototype.SetterByBindingTypeAndVersioning=[[ut.prototype._setValue_direct,ut.prototype._setValue_direct_setNeedsUpdate,ut.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ut.prototype._setValue_array,ut.prototype._setValue_array_setNeedsUpdate,ut.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ut.prototype._setValue_arrayElement,ut.prototype._setValue_arrayElement_setNeedsUpdate,ut.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ut.prototype._setValue_fromArray,ut.prototype._setValue_fromArray_setNeedsUpdate,ut.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];F1=class{constructor(){this.uuid=oi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){let e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,o=this._bindings,s=o.length,a,l=e.length,u=this.nCachedObjects_;for(let c=0,f=arguments.length;c!==f;++c){let h=arguments[c],p=h.uuid,d=t[p];if(d===void 0){d=l++,t[p]=d,e.push(h);for(let g=0,x=s;g!==x;++g)o[g].push(new ut(h,n[g],i[g]))}else if(d<u){a=e[d];let g=--u,x=e[g];t[x.uuid]=d,e[d]=x,t[p]=g,e[g]=h;for(let y=0,m=s;y!==m;++y){let b=o[y],w=b[g],D=b[d];b[d]=w,D===void 0&&(D=new ut(h,n[y],i[y])),b[g]=D}}else e[d]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=u}remove(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,o=this.nCachedObjects_;for(let s=0,a=arguments.length;s!==a;++s){let l=arguments[s],u=l.uuid,c=t[u];if(c!==void 0&&c>=o){let f=o++,h=e[f];t[h.uuid]=c,e[c]=h,t[u]=f,e[f]=l;for(let p=0,d=i;p!==d;++p){let g=n[p],x=g[f],y=g[c];g[c]=x,g[f]=y}}}this.nCachedObjects_=o}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,o=this.nCachedObjects_,s=e.length;for(let a=0,l=arguments.length;a!==l;++a){let u=arguments[a],c=u.uuid,f=t[c];if(f!==void 0)if(delete t[c],f<o){let h=--o,p=e[h],d=--s,g=e[d];t[p.uuid]=f,e[f]=p,t[g.uuid]=h,e[h]=g,e.pop();for(let x=0,y=i;x!==y;++x){let m=n[x],b=m[h],w=m[d];m[f]=b,m[h]=w,m.pop()}}else{let h=--s,p=e[h];h>0&&(t[p.uuid]=f),e[f]=p,e.pop();for(let d=0,g=i;d!==g;++d){let x=n[d];x[f]=x[h],x.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){let n=this._bindingsIndicesByPath,i=n[e],o=this._bindings;if(i!==void 0)return o[i];let s=this._paths,a=this._parsedPaths,l=this._objects,u=l.length,c=this.nCachedObjects_,f=new Array(u);i=o.length,n[e]=i,s.push(e),a.push(t),o.push(f);for(let h=c,p=l.length;h!==p;++h){let d=l[h];f[h]=new ut(d,e,t)}return f}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){let i=this._paths,o=this._parsedPaths,s=this._bindings,a=s.length-1,l=s[a],u=e[a];t[u]=n,s[n]=l,s.pop(),o[n]=o[a],o.pop(),i[n]=i[a],i.pop()}}};F1.prototype.isAnimationObjectGroup=!0;WS=class{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let o=t.tracks,s=o.length,a=new Array(s),l={endingStart:as,endingEnd:as};for(let u=0;u!==s;++u){let c=o[u].createInterpolant(null);a[u]=c,c.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Hb,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){let i=this._clip.duration,o=e._clip.duration,s=o/i,a=i/o;e.warp(1,s,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,o=i.time,s=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,u=a.sampleValues;return l[0]=o,l[1]=o+n,u[0]=e/s,u[1]=t/s,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let o=this._startTime;if(o!==null){let l=(e-o)*n;if(l<0||n===0)return;this._startTime=null,t=n*l}t*=this._updateTimeScale(e);let s=this._updateTime(t),a=this._updateWeight(e);if(a>0){let l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case tg:for(let c=0,f=l.length;c!==f;++c)l[c].evaluate(s),u[c].accumulateAdditive(a);break;case Df:default:for(let c=0,f=l.length;c!==f;++c)l[c].evaluate(s),u[c].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;n!==null&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,o=this._loopCount,s=n===qb;if(e===0)return o===-1?i:s&&(o&1)==1?t-i:i;if(n===Vb){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,s)):this._setEndings(this.repetitions===0,!0,s)),i>=t||i<0){let a=Math.floor(i/t);i-=t*a,o+=Math.abs(a);let l=this.repetitions-o;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let u=e<0;this._setEndings(u,!u,s)}else this._setEndings(!1,!1,s);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(s&&(o&1)==1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=ls,i.endingEnd=ls):(e?i.endingStart=this.zeroSlopeAtStart?ls:as:i.endingStart=Nu,t?i.endingEnd=this.zeroSlopeAtEnd?ls:as:i.endingEnd=Nu)}_scheduleFading(e,t,n){let i=this._mixer,o=i.time,s=this._weightInterpolant;s===null&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);let a=s.parameterPositions,l=s.sampleValues;return a[0]=o,l[0]=t,a[1]=o+e,l[1]=n,this}},_1=class extends gr{constructor(e){super();this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,s=e._propertyBindings,a=e._interpolants,l=n.uuid,u=this._bindingsByRootAndName,c=u[l];c===void 0&&(c={},u[l]=c);for(let f=0;f!==o;++f){let h=i[f],p=h.name,d=c[p];if(d!==void 0)s[f]=d;else{if(d=s[f],d!==void 0){d._cacheIndex===null&&(++d.referenceCount,this._addInactiveBinding(d,l,p));continue}let g=t&&t._propertyBindings[f].binding.parsedPath;d=new M1(ut.create(n,p,g),h.ValueTypeName,h.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,l,p),s[f]=d}a[f].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let o=t[n];o.useCount++==0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let o=t[n];--o.useCount==0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,o=this._actionsByClip,s=o[t];if(s===void 0)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,o[t]=s;else{let a=s.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let o=e._clip.uuid,s=this._actionsByClip,a=s[o],l=a.knownActions,u=l[l.length-1],c=e._byClipCacheIndex;u._byClipCacheIndex=c,l[c]=u,l.pop(),e._byClipCacheIndex=null;let f=a.actionByRoot,h=(e._localRoot||this._root).uuid;delete f[h],l.length===0&&delete s[o],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let o=t[n];--o.referenceCount==0&&this._removeInactiveBinding(o)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,o=this._bindings,s=i[t];s===void 0&&(s={},i[t]=s),s[n]=e,e._cacheIndex=o.length,o.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,o=n.path,s=this._bindingsByRootAndName,a=s[i],l=t[t.length-1],u=e._cacheIndex;l._cacheIndex=u,t[u]=l,t.pop(),delete a[o],Object.keys(a).length===0&&delete s[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new Cp(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,o=t[i];e.__cacheIndex=i,t[i]=e,o.__cacheIndex=n,t[n]=o}clipAction(e,t,n){let i=t||this._root,o=i.uuid,s=typeof e=="string"?Sl.findByName(i,e):e,a=s!==null?s.uuid:e,l=this._actionsByClip[a],u=null;if(n===void 0&&(s!==null?n=s.blendMode:n=Df),l!==void 0){let f=l.actionByRoot[o];if(f!==void 0&&f.blendMode===n)return f;u=l.knownActions[0],s===null&&(s=u._clip)}if(s===null)return null;let c=new WS(this,s,t,n);return this._bindAction(c,u),this._addInactiveAction(c,a,o),c}existingAction(e,t){let n=t||this._root,i=n.uuid,o=typeof e=="string"?Sl.findByName(n,e):e,s=o?o.uuid:e,a=this._actionsByClip[s];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),s=this._accuIndex^=1;for(let u=0;u!==n;++u)t[u]._update(i,e,o,s);let a=this._bindings,l=this._nActiveBindings;for(let u=0;u!==l;++u)a[u].apply(s);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,o=i[n];if(o!==void 0){let s=o.knownActions;for(let a=0,l=s.length;a!==l;++a){let u=s[a];this._deactivateAction(u);let c=u._cacheIndex,f=t[t.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,f._cacheIndex=c,t[c]=f,t.pop(),this._removeInactiveBindingsForAction(u)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let s in n){let a=n[s].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let i=this._bindingsByRootAndName,o=i[t];if(o!==void 0)for(let s in o){let a=o[s];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}};_1.prototype._controlInterpolantsResultBuffer=new Float32Array(1);Ec=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Ec(this.value.clone===void 0?this.value:this.value.clone())}},C1=class extends yo{constructor(e,t,n=1){super(e,t);this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};C1.prototype.isInstancedInterleavedBuffer=!0;P1=class{constructor(e,t,n,i,o){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=o,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}};P1.prototype.isGLBufferAttribute=!0;VS=class{constructor(e,t,n=0,i=1/0){this.ray=new wr(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new zf,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return k1(e,this,n,t),n.sort(HS),n}intersectObjects(e,t=!0,n=[]){for(let i=0,o=e.length;i<o;i++)k1(e[i],this,n,t);return n.sort(HS),n}};Mc=class{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){let e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(vn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},qS=class{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}},jS=new ee,Fs=class{constructor(e=new ee(1/0,1/0),t=new ee(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=jS.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return jS.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};Fs.prototype.isBox2=!0;QS=new M,jp=new M,B1=class{constructor(e=new M,t=new M){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){QS.subVectors(e,this.start),jp.subVectors(this.end,this.start);let n=jp.dot(jp),o=jp.dot(QS)/n;return t&&(o=vn(o,0,1)),o}closestPointToPoint(e,t,n){let i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},YS=new M,XS=class extends je{constructor(e,t){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let n=new Pe,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,a=1,l=32;s<l;s++,a++){let u=s/l*Math.PI*2,c=a/l*Math.PI*2;i.push(Math.cos(u),Math.sin(u),1,Math.cos(c),Math.sin(c),1)}n.setAttribute("position",new Te(i,3));let o=new Jt({fog:!1,toneMapped:!1});this.cone=new Bn(n,o),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),YS.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(YS),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Do=new M,Qp=new Ae,z1=new Ae,I1=class extends Bn{constructor(e){let t=KS(e),n=new Pe,i=[],o=[],s=new xe(0,0,1),a=new xe(0,1,0);for(let u=0;u<t.length;u++){let c=t[u];c.parent&&c.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),o.push(s.r,s.g,s.b),o.push(a.r,a.g,a.b))}n.setAttribute("position",new Te(i,3)),n.setAttribute("color",new Te(o,3));let l=new Jt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l);this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){let t=this.bones,n=this.geometry,i=n.getAttribute("position");z1.copy(this.root.matrixWorld).invert();for(let o=0,s=0;o<t.length;o++){let a=t[o];a.parent&&a.parent.isBone&&(Qp.multiplyMatrices(z1,a.matrixWorld),Do.setFromMatrixPosition(Qp),i.setXYZ(s,Do.x,Do.y,Do.z),Qp.multiplyMatrices(z1,a.parent.matrixWorld),Do.setFromMatrixPosition(Qp),i.setXYZ(s+1,Do.x,Do.y,Do.z),s+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};ZS=class extends Lt{constructor(e,t,n){let i=new Ss(t,4,2),o=new vt({wireframe:!0,fog:!1,toneMapped:!1});super(i,o);this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},NF=new M,JS=new xe,$S=new xe,eL=class extends je{constructor(e,t,n){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;let i=new ws(t);i.rotateY(Math.PI*.5),this.material=new vt({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);let o=i.getAttribute("position"),s=new Float32Array(o.count*3);i.setAttribute("color",new qe(s,3)),this.add(new Lt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let t=e.geometry.getAttribute("color");JS.copy(this.light.color),$S.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){let o=n<i/2?JS:$S;t.setXYZ(n,o.r,o.g,o.b)}t.needsUpdate=!0}e.lookAt(NF.setFromMatrixPosition(this.light.matrixWorld).negate())}},U1=class extends Bn{constructor(e=10,t=10,n=4473924,i=8947848){n=new xe(n),i=new xe(i);let o=t/2,s=e/t,a=e/2,l=[],u=[];for(let h=0,p=0,d=-a;h<=t;h++,d+=s){l.push(-a,0,d,a,0,d),l.push(d,0,-a,d,0,a);let g=h===o?n:i;g.toArray(u,p),p+=3,g.toArray(u,p),p+=3,g.toArray(u,p),p+=3,g.toArray(u,p),p+=3}let c=new Pe;c.setAttribute("position",new Te(l,3)),c.setAttribute("color",new Te(u,3));let f=new Jt({vertexColors:!0,toneMapped:!1});super(c,f);this.type="GridHelper"}},tL=class extends Bn{constructor(e=10,t=16,n=8,i=64,o=4473924,s=8947848){o=new xe(o),s=new xe(s);let a=[],l=[];for(let f=0;f<=t;f++){let h=f/t*(Math.PI*2),p=Math.sin(h)*e,d=Math.cos(h)*e;a.push(0,0,0),a.push(p,0,d);let g=f&1?o:s;l.push(g.r,g.g,g.b),l.push(g.r,g.g,g.b)}for(let f=0;f<=n;f++){let h=f&1?o:s,p=e-e/n*f;for(let d=0;d<i;d++){let g=d/i*(Math.PI*2),x=Math.sin(g)*p,y=Math.cos(g)*p;a.push(x,0,y),l.push(h.r,h.g,h.b),g=(d+1)/i*(Math.PI*2),x=Math.sin(g)*p,y=Math.cos(g)*p,a.push(x,0,y),l.push(h.r,h.g,h.b)}}let u=new Pe;u.setAttribute("position",new Te(a,3)),u.setAttribute("color",new Te(l,3));let c=new Jt({vertexColors:!0,toneMapped:!1});super(u,c);this.type="PolarGridHelper"}},nL=new M,Yp=new M,iL=new M,rL=class extends je{constructor(e,t,n){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new Pe;i.setAttribute("position",new Te([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let o=new Jt({fog:!1,toneMapped:!1});this.lightPlane=new Ki(i,o),this.add(this.lightPlane),i=new Pe,i.setAttribute("position",new Te([0,0,0,0,0,1],3)),this.targetLine=new Ki(i,o),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){nL.setFromMatrixPosition(this.light.matrixWorld),Yp.setFromMatrixPosition(this.light.target.matrixWorld),iL.subVectors(Yp,nL),this.lightPlane.lookAt(Yp),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Yp),this.targetLine.scale.z=iL.length()}},Xp=new M,Ut=new Va,oL=class extends Bn{constructor(e){let t=new Pe,n=new Jt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],o=[],s={},a=new xe(16755200),l=new xe(16711680),u=new xe(43775),c=new xe(16777215),f=new xe(3355443);h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),h("p","n1",l),h("p","n2",l),h("p","n3",l),h("p","n4",l),h("u1","u2",u),h("u2","u3",u),h("u3","u1",u),h("c","t",c),h("p","c",f),h("cn1","cn2",f),h("cn3","cn4",f),h("cf1","cf2",f),h("cf3","cf4",f);function h(d,g,x){p(d,x),p(g,x)}function p(d,g){i.push(0,0,0),o.push(g.r,g.g,g.b),s[d]===void 0&&(s[d]=[]),s[d].push(i.length/3-1)}t.setAttribute("position",new Te(i,3)),t.setAttribute("color",new Te(o,3));super(t,n);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let e=this.geometry,t=this.pointMap,n=1,i=1;Ut.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Vt("c",t,e,Ut,0,0,-1),Vt("t",t,e,Ut,0,0,1),Vt("n1",t,e,Ut,-n,-i,-1),Vt("n2",t,e,Ut,n,-i,-1),Vt("n3",t,e,Ut,-n,i,-1),Vt("n4",t,e,Ut,n,i,-1),Vt("f1",t,e,Ut,-n,-i,1),Vt("f2",t,e,Ut,n,-i,1),Vt("f3",t,e,Ut,-n,i,1),Vt("f4",t,e,Ut,n,i,1),Vt("u1",t,e,Ut,n*.7,i*1.1,-1),Vt("u2",t,e,Ut,-n*.7,i*1.1,-1),Vt("u3",t,e,Ut,0,i*2,-1),Vt("cf1",t,e,Ut,-n,0,1),Vt("cf2",t,e,Ut,n,0,1),Vt("cf3",t,e,Ut,0,-i,1),Vt("cf4",t,e,Ut,0,i,1),Vt("cn1",t,e,Ut,-n,0,-1),Vt("cn2",t,e,Ut,n,0,-1),Vt("cn3",t,e,Ut,0,-i,-1),Vt("cn4",t,e,Ut,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};Kp=new Yn,N1=class extends Bn{constructor(e,t=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),o=new Pe;o.setIndex(new qe(n,1)),o.setAttribute("position",new qe(i,3));super(o,new Jt({color:t,toneMapped:!1}));this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Kp.setFromObject(this.object),Kp.isEmpty())return;let t=Kp.min,n=Kp.max,i=this.geometry.attributes.position,o=i.array;o[0]=n.x,o[1]=n.y,o[2]=n.z,o[3]=t.x,o[4]=n.y,o[5]=n.z,o[6]=t.x,o[7]=t.y,o[8]=n.z,o[9]=n.x,o[10]=t.y,o[11]=n.z,o[12]=n.x,o[13]=n.y,o[14]=t.z,o[15]=t.x,o[16]=n.y,o[17]=t.z,o[18]=t.x,o[19]=t.y,o[20]=t.z,o[21]=n.x,o[22]=t.y,o[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return Bn.prototype.copy.call(this,e),this.object=e.object,this}},sL=class extends Bn{constructor(e,t=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],o=new Pe;o.setIndex(new qe(n,1)),o.setAttribute("position",new Te(i,3));super(o,new Jt({color:t,toneMapped:!1}));this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}},aL=class extends Ki{constructor(e,t=1,n=16776960){let i=n,o=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],s=new Pe;s.setAttribute("position",new Te(o,3)),s.computeBoundingSphere();super(s,new Jt({color:i,toneMapped:!1}));this.type="PlaneHelper",this.plane=e,this.size=t;let a=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],l=new Pe;l.setAttribute("position",new Te(a,3)),l.computeBoundingSphere(),this.add(new Lt(l,new vt({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?At:ji,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}},lL=new M,uL=class extends je{constructor(e=new M(0,0,1),t=new M(0,0,0),n=1,i=16776960,o=n*.2,s=o*.2){super();this.type="ArrowHelper",Zp===void 0&&(Zp=new Pe,Zp.setAttribute("position",new Te([0,0,0,0,1,0],3)),O1=new bo(0,.5,1,5,1),O1.translate(0,-.5,0)),this.position.copy(t),this.line=new Ki(Zp,new Jt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Lt(O1,new vt({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,o,s)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{lL.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(lL,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},G1=class extends Bn{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Pe;i.setAttribute("position",new Te(t,3)),i.setAttribute("color",new Te(n,3));let o=new Jt({vertexColors:!0,toneMapped:!1});super(i,o);this.type="AxesHelper"}setColors(e,t,n){let i=new xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},cL=class{constructor(){this.type="ShapePath",this.color=new xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new hl,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,s){return this.currentPath.bezierCurveTo(e,t,n,i,o,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(m){let b=[];for(let w=0,D=m.length;w<D;w++){let R=m[w],L=new Ci;L.curves=R.curves,b.push(L)}return b}function i(m,b){let w=b.length,D=!1;for(let R=w-1,L=0;L<w;R=L++){let T=b[R],U=b[L],F=U.x-T.x,C=U.y-T.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(T=b[L],F=-F,U=b[R],C=-C),m.y<T.y||m.y>U.y)continue;if(m.y===T.y){if(m.x===T.x)return!0}else{let j=C*(m.x-T.x)-F*(m.y-T.y);if(j===0)return!0;if(j<0)continue;D=!D}}else{if(m.y!==T.y)continue;if(U.x<=m.x&&m.x<=T.x||T.x<=m.x&&m.x<=U.x)return!0}}return D}let o=Pi.isClockWise,s=this.subPaths;if(s.length===0)return[];if(t===!0)return n(s);let a,l,u,c=[];if(s.length===1)return l=s[0],u=new Ci,u.curves=l.curves,c.push(u),c;let f=!o(s[0].getPoints());f=e?!f:f;let h=[],p=[],d=[],g=0,x;p[g]=void 0,d[g]=[];for(let m=0,b=s.length;m<b;m++)l=s[m],x=l.getPoints(),a=o(x),a=e?!a:a,a?(!f&&p[g]&&g++,p[g]={s:new Ci,p:x},p[g].s.curves=l.curves,f&&g++,d[g]=[]):d[g].push({h:l,p:x[0]});if(!p[0])return n(s);if(p.length>1){let m=!1,b=[];for(let w=0,D=p.length;w<D;w++)h[w]=[];for(let w=0,D=p.length;w<D;w++){let R=d[w];for(let L=0;L<R.length;L++){let T=R[L],U=!0;for(let F=0;F<p.length;F++)i(T.p,p[F].p)&&(w!==F&&b.push({froms:w,tos:F,hole:L}),U?(U=!1,h[F].push(T)):m=!0);U&&h[w].push(T)}}b.length>0&&(m||(d=h))}let y;for(let m=0,b=p.length;m<b;m++){u=p[m].s,c.push(u),y=d[m];for(let w=0,D=y.length;w<D;w++)u.holes.push(y[w].h)}return c}},hL=new Float32Array(1),OF=new Int32Array(hL.buffer),fL=class{static toHalfFloat(e){e>65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),e=65504),hL[0]=e;let t=OF[0],n=t>>16&32768,i=t>>12&2047,o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(o==255?0:1)&&t&8388607,n):o<113?(i|=2048,n|=(i>>114-o)+(i>>113-o&1),n):(n|=o-112<<10|i>>1,n+=i&1,n)}},GF=0,WF=1,VF=0,HF=1,qF=2;Xn.create=function(r,e){return console.log("THREE.Curve.create() has been deprecated"),r.prototype=Object.create(Xn.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r};hl.prototype.fromPoints=function(r){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(r)};U1.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};I1.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Mn.prototype.extractUrlBase=function(r){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Dc.extractUrlBase(r)};Mn.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Fs.prototype.center=function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)};Fs.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Fs.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};Fs.prototype.size=function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)};Yn.prototype.center=function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)};Yn.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Yn.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};Yn.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};Yn.prototype.size=function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)};vr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Qa.prototype.setFromMatrix=function(r){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(r)};B1.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)};Qt.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};Qt.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};Qt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Qt.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};Qt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Qt.prototype.getInverse=function(r){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};Ae.prototype.extractPosition=function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)};Ae.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};Ae.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new M().setFromMatrixColumn(this,3)};Ae.prototype.setRotationFromQuaternion=function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)};Ae.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Ae.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Ae.prototype.multiplyVector4=function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Ae.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Ae.prototype.rotateAxis=function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)};Ae.prototype.crossVector=function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Ae.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Ae.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Ae.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Ae.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Ae.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Ae.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Ae.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Ae.prototype.makeFrustum=function(r,e,t,n,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(r,e,n,t,i,o)};Ae.prototype.getInverse=function(r){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};Fi.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)};ot.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)};ot.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};wr.prototype.isIntersectionBox=function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};wr.prototype.isIntersectionPlane=function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)};wr.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};It.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};It.prototype.barycoordFromPoint=function(r,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(r,e)};It.prototype.midpoint=function(r){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(r)};It.prototypenormal=function(r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(r)};It.prototype.plane=function(r){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(r)};It.barycoordFromPoint=function(r,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),It.getBarycoord(r,e,t,n,i)};It.normal=function(r,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),It.getNormal(r,e,t,n)};Ci.prototype.extractAllPoints=function(r){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(r)};Ci.prototype.extrude=function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ji(this,r)};Ci.prototype.makeGeometry=function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new bs(this,r)};ee.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};ee.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};ee.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};M.prototype.getPositionFromMatrix=function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)};M.prototype.getScaleFromMatrix=function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)};M.prototype.getColumnFromMatrix=function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)};M.prototype.applyProjection=function(r){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(r)};M.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};M.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};xt.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};xt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};je.prototype.getChildByName=function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)};je.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};je.prototype.translate=function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)};je.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};je.prototype.applyMatrix=function(r){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(je.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Lt.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(Lt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),jb},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});uc.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Gt.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)};Object.defineProperties(vi.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}});Object.defineProperties(qe.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Fa},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Fa)}}});qe.prototype.setDynamic=function(r){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Fa:Ta),this};qe.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},qe.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Pe.prototype.addIndex=function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)};Pe.prototype.addAttribute=function(r,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(r,new qe(arguments[1],arguments[2]))):r==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(r,e)};Pe.prototype.addDrawCall=function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)};Pe.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Pe.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Pe.prototype.removeAttribute=function(r){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(r)};Pe.prototype.applyMatrix=function(r){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(Pe.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});yo.prototype.setDynamic=function(r){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Fa:Ta),this};yo.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Ji.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Ji.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Ji.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};xs.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Ec.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(Zt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(r){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===z0}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(r){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=r}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}});Object.defineProperties(Yi.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}});ft.prototype.clearTarget=function(r,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(r),this.clear(e,t,n)};ft.prototype.animate=function(r){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(r)};ft.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};ft.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};ft.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};ft.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};ft.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};ft.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};ft.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};ft.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};ft.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};ft.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};ft.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};ft.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};ft.prototype.enableScissorTest=function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)};ft.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};ft.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};ft.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};ft.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};ft.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};ft.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};ft.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};ft.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};ft.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};ft.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(ft.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(r){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=r===!0?Ou:Pn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}});Object.defineProperties(Q3.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(Qn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}});qp.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new S1().load(r,function(n){e.setBuffer(n)}),this};E1.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Ku.prototype.updateCubeMap=function(r,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(r,e)};Ku.prototype.clear=function(r,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(r,e,t,n)};so.crossOrigin=void 0;so.loadTexture=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let i=new Lc;i.setCrossOrigin(this.crossOrigin);let o=i.load(r,t,void 0,n);return e&&(o.mapping=e),o};so.loadTextureCube=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let i=new f1;i.setCrossOrigin(this.crossOrigin);let o=i.load(r,t,void 0,n);return e&&(o.mapping=e),o};so.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};so.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};w_={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:xf}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=xf)});var tA={};Rt(tA,{default:()=>BC});function kC(r){let e=new WeakMap;return{postMessage:r.postMessage.bind(r),addEventListener:(t,n)=>{let i=o=>{"handleEvent"in n?n.handleEvent({data:o}):n({data:o})};r.on("message",i),e.set(n,i)},removeEventListener:(t,n)=>{let i=e.get(n);!i||(r.off("message",i),e.delete(n))},start:r.start&&r.start.bind(r)}}var BC,nA=oe(()=>{BC=kC});var a2={};Rt(a2,{NodeWorkerStringWrapper:()=>IC,NodeWorkerWrapper:()=>zC});async function iA(){return{NodeWorker:(await import("worker_threads")).Worker,nodeEndpoint:(await Promise.resolve().then(()=>(nA(),tA))).default}}function rA(r,e,t){let n=new r.NodeWorker(e,t);return n.unref(),r.nodeEndpoint(n)}async function zC(){let r=await iA();return oA||(oA=class{constructor(e,t){return rA(r,e)}})}async function IC(){let r=await iA();return sA||(sA=class{constructor(e,t){return rA(r,e,{eval:!0})}})}var oA,sA,l2=oe(()=>{oA=null;sA=null});var cA={};Rt(cA,{workerSource:()=>UC});var UC,hA=oe(()=>{UC=`var m1=Object.create;var wo=Object.defineProperty;var p1=Object.getOwnPropertyDescriptor;var d1=Object.getOwnPropertyNames;var L1=Object.getPrototypeOf,h1=Object.prototype.hasOwnProperty;var ca=e=>wo(e,"__esModule",{value:!0});var S=(e,t)=>()=>(e&&(t=e(e=0)),t);var Te=(e,t)=>{ca(e);for(var r in t)wo(e,r,{get:t[r],enumerable:!0})},R1=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of d1(t))!h1.call(e,n)&&n!=="default"&&wo(e,n,{get:()=>t[n],enumerable:!(r=p1(t,n))||r.enumerable});return e},ga=e=>R1(ca(wo(e!=null?m1(L1(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var ni=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var R=(e,t,r)=>(ni(e,t,"read from private field"),r?r.call(e):t.get(e)),de=(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)},ie=(e,t,r,n)=>(ni(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),oi=(e,t,r,n)=>({set _(o){ie(e,t,o,r)},get _(){return R(e,t,n)}}),ma=(e,t,r)=>(ni(e,t,"access private method"),r);var D=(e,t,r)=>new Promise((n,o)=>{var l=u=>{try{s(r.next(u))}catch(a){o(a)}},i=u=>{try{s(r.throw(u))}catch(a){o(a)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(l,i);s((r=r.apply(e,t)).next())});var ya={};Te(ya,{default:()=>U1});function E1(e){let t=new WeakMap;return{postMessage:e.postMessage.bind(e),addEventListener:(r,n)=>{let o=l=>{"handleEvent"in n?n.handleEvent({data:l}):n({data:l})};e.on("message",o),t.set(n,o)},removeEventListener:(r,n)=>{let o=t.get(n);!o||(e.off("message",o),t.delete(n))},start:e.start&&e.start.bind(e)}}var U1,Da=S(()=>{U1=E1});var Fa={};Te(Fa,{port:()=>k1});function k1(){return D(this,null,function*(){let{parentPort:e}=yield import("worker_threads").catch();return(yield Promise.resolve().then(()=>(Da(),ya))).default(e)})}var Ba=S(()=>{});var C1,Uo,ke,Mt=S(()=>{C1=!1,Uo=class{is(t){return this instanceof t}as(t){return this instanceof t?this:null}},ke=class extends Uo{constructor(){super();C1&&Object.defineProperty(this,"_debugStr",{get:()=>this.toString()})}get log(){return console.log.bind(console,this,this.toString())}}});function xa(e,t=!0){if(!t)return e;switch(e){case 1:return-1;case-1:return 1}}function ai(e,t){return t===-1?Array.from(e).reverse():e}function Sa(e){return Array.from(e).reverse()}var j,dt=S(()=>{(function(r){r[r.Forwards=1]="Forwards",r[r.Backwards=-1]="Backwards"})(j||(j={}))});var Cn,Nr,va,ui=S(()=>{Cn=2147483647,Nr="2^31 - 1",va=-2147483648});var dr,at,fi=S(()=>{Pt();at=class{constructor(){de(this,dr,[])}push(t){R(this,dr).push(t)}experimentalPushAlg(t){for(let r of t.units())this.push(r)}experimentalNumUnits(){return R(this,dr).length}toAlg(){return new z(R(this,dr))}reset(){ie(this,dr,[])}};dr=new WeakMap});var Lr,hr,ko,ze,Mn=S(()=>{Pt();Mt();dt();ko=class extends ke{constructor(t,r){super();de(this,Lr,void 0);de(this,hr,void 0);ie(this,Lr,Ht(t)),ie(this,hr,Ht(r))}get A(){return R(this,Lr)}get B(){return R(this,hr)}isIdentical(t){let r=t.as(ko);return!!((r==null?void 0:r.A.isIdentical(this.A))&&(r==null?void 0:r.B.isIdentical(this.B)))}invert(){return new ko(R(this,hr),R(this,Lr))}*experimentalExpand(t=j.Forwards,r){r!=null||(r=1/0),r===0?yield t===j.Forwards?this:this.invert():t===j.Forwards?(yield*this.A.experimentalExpand(j.Forwards,r-1),yield*this.B.experimentalExpand(j.Forwards,r-1),yield*this.A.experimentalExpand(j.Backwards,r-1),yield*this.B.experimentalExpand(j.Backwards,r-1)):(yield*this.B.experimentalExpand(j.Forwards,r-1),yield*this.A.experimentalExpand(j.Forwards,r-1),yield*this.B.experimentalExpand(j.Backwards,r-1),yield*this.A.experimentalExpand(j.Backwards,r-1))}toString(){return\`[\${R(this,Lr).toString()}, \${R(this,hr).toString()}]\`}},ze=ko;Lr=new WeakMap,hr=new WeakMap});var Tr,_r,zo,Ce,Pn=S(()=>{Pt();Mt();dt();zo=class extends ke{constructor(t,r){super();de(this,Tr,void 0);de(this,_r,void 0);ie(this,Tr,Ht(t)),ie(this,_r,Ht(r))}get A(){return R(this,Tr)}get B(){return R(this,_r)}isIdentical(t){let r=t.as(zo);return!!((r==null?void 0:r.A.isIdentical(this.A))&&(r==null?void 0:r.B.isIdentical(this.B)))}invert(){return new zo(R(this,Tr),R(this,_r).invert())}*experimentalExpand(t,r){r!=null||(r=1/0),r===0?yield t===j.Forwards?this:this.invert():(yield*this.A.experimentalExpand(j.Forwards,r-1),yield*this.B.experimentalExpand(t,r-1),yield*this.A.experimentalExpand(j.Backwards,r-1))}toString(){return\`[\${this.A}: \${this.B}]\`}},Ce=zo;Tr=new WeakMap,_r=new WeakMap});var Yt,ci,Lt,In=S(()=>{Mt();dt();ci=class extends ke{constructor(t){super();de(this,Yt,void 0);if(t.includes(\`
|
|
4180
|
+
}`;$f=class extends Gt{constructor(e=[]){super();this.cameras=e}};$f.prototype.isArrayCamera=!0;gi=class extends je{constructor(){super();this.type="Group"}};gi.prototype.isGroup=!0;Q4={type:"move"},ep=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new gi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new gi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new gi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,o=null,s=null,a=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(i=t.getPose(e.targetRaySpace,n),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Q4))),u&&e.hand){s=!0;for(let g of e.hand.values()){let x=t.getJointPose(g,n);if(u.joints[g.jointName]===void 0){let m=new gi;m.matrixAutoUpdate=!1,m.visible=!1,u.joints[g.jointName]=m,u.add(m)}let y=u.joints[g.jointName];x!==null&&(y.matrix.fromArray(x.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.jointRadius=x.radius),y.visible=x!==null}let c=u.joints["index-finger-tip"],f=u.joints["thumb-tip"],h=c.position.distanceTo(f.position),p=.02,d=.005;u.inputState.pinching&&h>p+d?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&h<=p-d&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1));return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=o!==null),u!==null&&(u.visible=s!==null),this}},ic=class extends Yt{constructor(e,t,n,i,o,s,a,l,u,c){if(c=c!==void 0?c:oo,c!==oo&&c!==ss)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&c===oo&&(n=Ra),n===void 0&&c===ss&&(n=os);super(null,i,o,s,a,l,c,n,u);this.image={width:e,height:t},this.magFilter=a!==void 0?a:jt,this.minFilter=l!==void 0?l:jt,this.flipY=!1,this.generateMipmaps=!1}};ic.prototype.isDepthTexture=!0;K3=class extends gr{constructor(e,t){super();let n=this,i=null,o=1,s=null,a="local-floor",l=e.extensions.has("WEBGL_multisampled_render_to_texture"),u=null,c=null,f=null,h=null,p=!1,d=null,g=t.getContextAttributes(),x=null,y=null,m=[],b=new Map,w=new Gt;w.layers.enable(1),w.viewport=new xt;let D=new Gt;D.layers.enable(2),D.viewport=new xt;let R=[w,D],L=new $f;L.layers.enable(1),L.layers.enable(2);let T=null,U=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let X=m[Y];return X===void 0&&(X=new ep,m[Y]=X),X.getTargetRaySpace()},this.getControllerGrip=function(Y){let X=m[Y];return X===void 0&&(X=new ep,m[Y]=X),X.getGripSpace()},this.getHand=function(Y){let X=m[Y];return X===void 0&&(X=new ep,m[Y]=X),X.getHandSpace()};function F(Y){let X=b.get(Y.inputSource);X&&X.dispatchEvent({type:Y.type,data:Y.inputSource})}function C(){b.forEach(function(Y,X){Y.disconnect(X)}),b.clear(),T=null,U=null,e.setRenderTarget(x),h=null,f=null,c=null,i=null,y=null,he.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){o=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getBaseLayer=function(){return f!==null?f:h},this.getBinding=function(){return c},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(Y){if(i=Y,i!==null){if(x=e.getRenderTarget(),i.addEventListener("select",F),i.addEventListener("selectstart",F),i.addEventListener("selectend",F),i.addEventListener("squeeze",F),i.addEventListener("squeezestart",F),i.addEventListener("squeezeend",F),i.addEventListener("end",C),i.addEventListener("inputsourceschange",j),g.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let X={antialias:i.renderState.layers===void 0?g.antialias:!0,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:o};h=new XRWebGLLayer(i,t,X),i.updateRenderState({baseLayer:h}),y=new Qn(h.framebufferWidth,h.framebufferHeight)}else{p=g.antialias;let X=null,ve=null,pe=null;g.depth&&(pe=g.stencil?35056:33189,X=g.stencil?ss:oo,ve=g.stencil?os:Ra);let Le={colorFormat:g.alpha||p?32856:32849,depthFormat:pe,scaleFactor:o};c=new XRWebGLBinding(i,t),f=c.createProjectionLayer(Le),i.updateRenderState({layers:[f]}),p?y=new Vu(f.textureWidth,f.textureHeight,{format:gn,type:mr,depthTexture:new ic(f.textureWidth,f.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,X),stencilBuffer:g.stencil,ignoreDepth:f.ignoreDepthValues,useRenderToTexture:l}):y=new Qn(f.textureWidth,f.textureHeight,{format:g.alpha?gn:ro,type:mr,depthTexture:new ic(f.textureWidth,f.textureHeight,ve,void 0,void 0,void 0,void 0,void 0,void 0,X),stencilBuffer:g.stencil,ignoreDepth:f.ignoreDepthValues})}this.setFoveation(0),s=await i.requestReferenceSpace(a),he.setContext(i),he.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function j(Y){let X=i.inputSources;for(let ve=0;ve<m.length;ve++)b.set(X[ve],m[ve]);for(let ve=0;ve<Y.removed.length;ve++){let pe=Y.removed[ve],Le=b.get(pe);Le&&(Le.dispatchEvent({type:"disconnected",data:pe}),b.delete(pe))}for(let ve=0;ve<Y.added.length;ve++){let pe=Y.added[ve],Le=b.get(pe);Le&&Le.dispatchEvent({type:"connected",data:pe})}}let B=new M,z=new M;function O(Y,X,ve){B.setFromMatrixPosition(X.matrixWorld),z.setFromMatrixPosition(ve.matrixWorld);let pe=B.distanceTo(z),Le=X.projectionMatrix.elements,Ie=ve.projectionMatrix.elements,P=Le[14]/(Le[10]-1),Z=Le[14]/(Le[10]+1),ae=(Le[9]+1)/Le[5],ne=(Le[9]-1)/Le[5],fe=(Le[8]-1)/Le[0],W=(Ie[8]+1)/Ie[0],Q=P*fe,le=P*W,ue=pe/(-fe+W),Se=ue*-fe;X.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(Se),Y.translateZ(ue),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert();let ce=P+ue,Ue=Z+ue,We=Q-Se,nt=le+(pe-Se),Et=ae*Z/Ue*ce,k=ne*Z/Ue*ce;Y.projectionMatrix.makePerspective(We,nt,Et,k,ce,Ue)}function V(Y,X){X===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(X.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(i===null)return;L.near=D.near=w.near=Y.near,L.far=D.far=w.far=Y.far,(T!==L.near||U!==L.far)&&(i.updateRenderState({depthNear:L.near,depthFar:L.far}),T=L.near,U=L.far);let X=Y.parent,ve=L.cameras;V(L,X);for(let Le=0;Le<ve.length;Le++)V(ve[Le],X);L.matrixWorld.decompose(L.position,L.quaternion,L.scale),Y.position.copy(L.position),Y.quaternion.copy(L.quaternion),Y.scale.copy(L.scale),Y.matrix.copy(L.matrix),Y.matrixWorld.copy(L.matrixWorld);let pe=Y.children;for(let Le=0,Ie=pe.length;Le<Ie;Le++)pe[Le].updateMatrixWorld(!0);ve.length===2?O(L,w,D):L.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return L},this.getFoveation=function(){if(f!==null)return f.fixedFoveation;if(h!==null)return h.fixedFoveation},this.setFoveation=function(Y){f!==null&&(f.fixedFoveation=Y),h!==null&&h.fixedFoveation!==void 0&&(h.fixedFoveation=Y)};let q=null;function se(Y,X){if(u=X.getViewerPose(s),d=X,u!==null){let pe=u.views;h!==null&&(e.setRenderTargetFramebuffer(y,h.framebuffer),e.setRenderTarget(y));let Le=!1;pe.length!==L.cameras.length&&(L.cameras.length=0,Le=!0);for(let Ie=0;Ie<pe.length;Ie++){let P=pe[Ie],Z=null;if(h!==null)Z=h.getViewport(P);else{let ne=c.getViewSubImage(f,P);Z=ne.viewport,Ie===0&&(e.setRenderTargetTextures(y,ne.colorTexture,f.ignoreDepthValues?void 0:ne.depthStencilTexture),e.setRenderTarget(y))}let ae=R[Ie];ae.matrix.fromArray(P.transform.matrix),ae.projectionMatrix.fromArray(P.projectionMatrix),ae.viewport.set(Z.x,Z.y,Z.width,Z.height),Ie===0&&L.matrix.copy(ae.matrix),Le===!0&&L.cameras.push(ae)}}let ve=i.inputSources;for(let pe=0;pe<m.length;pe++){let Le=m[pe],Ie=ve[pe];Le.update(Ie,X,s)}q&&q(Y,X),d=null}let he=new m3;he.setAnimationLoop(se),this.setAnimationLoop=function(Y){q=Y},this.dispose=function(){}}};ft.prototype.isWebGLRenderer=!0;Qg=class extends ft{};Qg.prototype.isWebGL1Renderer=!0;$a=class{constructor(e,t=25e-5){this.name="",this.color=new xe(e),this.density=t}clone(){return new $a(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};$a.prototype.isFogExp2=!0;el=class{constructor(e,t=1,n=1e3){this.name="",this.color=new xe(e),this.near=t,this.far=n}clone(){return new el(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};el.prototype.isFog=!0;xs=class extends je{constructor(){super();this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};xs.prototype.isScene=!0;yo=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ta,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=oi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,o=this.stride;i<o;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=oi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=oi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}};yo.prototype.isInterleavedBuffer=!0;Wt=new M,Ar=class{constructor(e,t,n,i=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Wt.x=this.getX(t),Wt.y=this.getY(t),Wt.z=this.getZ(t),Wt.applyMatrix4(e),this.setXYZ(t,Wt.x,Wt.y,Wt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Wt.x=this.getX(t),Wt.y=this.getY(t),Wt.z=this.getZ(t),Wt.applyNormalMatrix(e),this.setXYZ(t,Wt.x,Wt.y,Wt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Wt.x=this.getX(t),Wt.y=this.getY(t),Wt.z=this.getZ(t),Wt.transformDirection(e),this.setXYZ(t,Wt.x,Wt.y,Wt.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,o){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=o,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}return new qe(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ar(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let i=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[i+o])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};Ar.prototype.isInterleavedBufferAttribute=!0;rc=class extends Zt{constructor(e){super();this.type="SpriteMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}};rc.prototype.isSpriteMaterial=!0;oc=new M,nl=new M,il=new M,rl=new ee,sc=new ee,Z3=new Ae,tp=new M,ac=new M,np=new M,J3=new ee,Yg=new ee,$3=new ee,lc=class extends je{constructor(e){super();if(this.type="Sprite",tl===void 0){tl=new Pe;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new yo(t,5);tl.setIndex([0,1,2,0,2,3]),tl.setAttribute("position",new Ar(n,3,0,!1)),tl.setAttribute("uv",new Ar(n,2,3,!1))}this.geometry=tl,this.material=e!==void 0?e:new rc,this.center=new ee(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),nl.setFromMatrixScale(this.matrixWorld),Z3.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),il.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&nl.multiplyScalar(-il.z);let n=this.material.rotation,i,o;n!==0&&(o=Math.cos(n),i=Math.sin(n));let s=this.center;ip(tp.set(-.5,-.5,0),il,s,nl,i,o),ip(ac.set(.5,-.5,0),il,s,nl,i,o),ip(np.set(.5,.5,0),il,s,nl,i,o),J3.set(0,0),Yg.set(1,0),$3.set(1,1);let a=e.ray.intersectTriangle(tp,ac,np,!1,oc);if(a===null&&(ip(ac.set(-.5,.5,0),il,s,nl,i,o),Yg.set(0,1),a=e.ray.intersectTriangle(tp,np,ac,!1,oc),a===null))return;let l=e.ray.origin.distanceTo(oc);l<e.near||l>e.far||t.push({distance:l,point:oc.clone(),uv:It.getUV(oc,tp,ac,np,J3,Yg,$3,new ee),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};lc.prototype.isSprite=!0;rp=new M,eS=new M,Xg=class extends je{constructor(){super();this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let n=0,i=t.length;n<i;n++){let o=t[n];this.addLevel(o.object.clone(),o.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);let n=this.levels,i;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){rp.setFromMatrixPosition(this.matrixWorld);let i=e.ray.origin.distanceTo(rp);this.getObjectForDistance(i).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){rp.setFromMatrixPosition(e.matrixWorld),eS.setFromMatrixPosition(this.matrixWorld);let n=rp.distanceTo(eS)/e.zoom;t[0].object.visible=!0;let i,o;for(i=1,o=t.length;i<o&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<o;i++)t[i].object.visible=!1}}toJSON(e){let t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];let n=this.levels;for(let i=0,o=n.length;i<o;i++){let s=n[i];t.object.levels.push({object:s.object.uuid,distance:s.distance})}return t}},tS=new M,nS=new xt,iS=new xt,K4=new M,rS=new Ae,uc=class extends Lt{constructor(e,t){super(e,t);this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ae,this.bindMatrixInverse=new Ae}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new xt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);let o=1/e.manhattanLength();o!==1/0?e.multiplyScalar(o):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){let n=this.skeleton,i=this.geometry;nS.fromBufferAttribute(i.attributes.skinIndex,e),iS.fromBufferAttribute(i.attributes.skinWeight,e),tS.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let o=0;o<4;o++){let s=iS.getComponent(o);if(s!==0){let a=nS.getComponent(o);rS.multiplyMatrices(n.bones[a].matrixWorld,n.boneInverses[a]),t.addScaledVector(K4.copy(tS).applyMatrix4(rS),s)}}return t.applyMatrix4(this.bindMatrixInverse)}};uc.prototype.isSkinnedMesh=!0;cc=class extends je{constructor(){super();this.type="Bone"}};cc.prototype.isBone=!0;vo=class extends Yt{constructor(e=null,t=1,n=1,i,o,s,a,l,u=jt,c=jt,f,h){super(null,s,a,l,u,c,i,o,f,h);this.image={data:e,width:t,height:n},this.magFilter=u,this.minFilter=c,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};vo.prototype.isDataTexture=!0;oS=new Ae,Z4=new Ae,hc=class{constructor(e=[],t=[]){this.uuid=oi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ae)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let n=new Ae;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let o=0,s=e.length;o<s;o++){let a=e[o]?e[o].matrixWorld:Z4;oS.multiplyMatrices(a,t[o]),oS.toArray(n,o*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new hc(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Jb(e),e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new vo(t,e,e,gn,Qi);return this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){let o=e.bones[n],s=t[o];s===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",o),s=new cc),this.bones.push(s),this.boneInverses.push(new Ae().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let i=0,o=t.length;i<o;i++){let s=t[i];e.bones.push(s.uuid);let a=n[i];e.boneInverses.push(a.toArray())}return e}},xo=class extends qe{constructor(e,t,n,i=1){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));super(e,t,n);this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};xo.prototype.isInstancedBufferAttribute=!0;sS=new Ae,aS=new Ae,op=[],fc=new Lt,sp=class extends Lt{constructor(e,t,n){super(e,t);this.instanceMatrix=new xo(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){let n=this.matrixWorld,i=this.count;if(fc.geometry=this.geometry,fc.material=this.material,fc.material!==void 0)for(let o=0;o<i;o++){this.getMatrixAt(o,sS),aS.multiplyMatrices(n,sS),fc.matrixWorld=aS,fc.raycast(e,op);for(let s=0,a=op.length;s<a;s++){let l=op[s];l.instanceId=o,l.object=this,t.push(l)}op.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new xo(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}};sp.prototype.isInstancedMesh=!0;Jt=class extends Zt{constructor(e){super();this.type="LineBasicMaterial",this.color=new xe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}};Jt.prototype.isLineBasicMaterial=!0;lS=new M,uS=new M,cS=new Ae,Kg=new wr,ap=new vr,Ki=class extends je{constructor(e=new Pe,t=new Jt){super();this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,n=[0];for(let i=1,o=t.count;i<o;i++)lS.fromBufferAttribute(t,i-1),uS.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=lS.distanceTo(uS);e.setAttribute("lineDistance",new Te(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,o=e.params.Line.threshold,s=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),ap.copy(n.boundingSphere),ap.applyMatrix4(i),ap.radius+=o,e.ray.intersectsSphere(ap)===!1)return;cS.copy(i).invert(),Kg.copy(e.ray).applyMatrix4(cS);let a=o/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,u=new M,c=new M,f=new M,h=new M,p=this.isLineSegments?2:1;if(n.isBufferGeometry){let d=n.index,x=n.attributes.position;if(d!==null){let y=Math.max(0,s.start),m=Math.min(d.count,s.start+s.count);for(let b=y,w=m-1;b<w;b+=p){let D=d.getX(b),R=d.getX(b+1);if(u.fromBufferAttribute(x,D),c.fromBufferAttribute(x,R),Kg.distanceSqToSegment(u,c,h,f)>l)continue;h.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(h);T<e.near||T>e.far||t.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else{let y=Math.max(0,s.start),m=Math.min(x.count,s.start+s.count);for(let b=y,w=m-1;b<w;b+=p){if(u.fromBufferAttribute(x,b),c.fromBufferAttribute(x,b+1),Kg.distanceSqToSegment(u,c,h,f)>l)continue;h.applyMatrix4(this.matrixWorld);let R=e.ray.origin.distanceTo(h);R<e.near||R>e.far||t.push({distance:R,point:f.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o<s;o++){let a=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};Ki.prototype.isLine=!0;hS=new M,fS=new M,Bn=class extends Ki{constructor(e,t){super(e,t);this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,n=[];for(let i=0,o=t.count;i<o;i+=2)hS.fromBufferAttribute(t,i),fS.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+hS.distanceTo(fS);e.setAttribute("lineDistance",new Te(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}};Bn.prototype.isLineSegments=!0;lp=class extends Ki{constructor(e,t){super(e,t);this.type="LineLoop"}};lp.prototype.isLineLoop=!0;wo=class extends Zt{constructor(e){super();this.type="PointsMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}};wo.prototype.isPointsMaterial=!0;pS=new Ae,Zg=new wr,up=new vr,cp=new M,ol=class extends je{constructor(e=new Pe,t=new wo){super();this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,o=e.params.Points.threshold,s=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),up.copy(n.boundingSphere),up.applyMatrix4(i),up.radius+=o,e.ray.intersectsSphere(up)===!1)return;pS.copy(i).invert(),Zg.copy(e.ray).applyMatrix4(pS);let a=o/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(n.isBufferGeometry){let u=n.index,f=n.attributes.position;if(u!==null){let h=Math.max(0,s.start),p=Math.min(u.count,s.start+s.count);for(let d=h,g=p;d<g;d++){let x=u.getX(d);cp.fromBufferAttribute(f,x),dS(cp,x,l,i,e,t,this)}}else{let h=Math.max(0,s.start),p=Math.min(f.count,s.start+s.count);for(let d=h,g=p;d<g;d++)cp.fromBufferAttribute(f,d),dS(cp,d,l,i,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o<s;o++){let a=i[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};ol.prototype.isPoints=!0;Jg=class extends Yt{constructor(e,t,n,i,o,s,a,l,u){super(e,t,n,i,o,s,a,l,u);this.format=a!==void 0?a:ro,this.minFilter=s!==void 0?s:Kt,this.magFilter=o!==void 0?o:Kt,this.generateMipmaps=!1;let c=this;function f(){c.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}};Jg.prototype.isVideoTexture=!0;hp=class extends Yt{constructor(e,t,n,i,o,s,a,l,u,c,f,h){super(null,s,a,l,u,c,i,o,f,h);this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};hp.prototype.isCompressedTexture=!0;$g=class extends Yt{constructor(e,t,n,i,o,s,a,l,u){super(e,t,n,i,o,s,a,l,u);this.needsUpdate=!0}};$g.prototype.isCanvasTexture=!0;sl=class extends Pe{constructor(e=1,t=8,n=0,i=Math.PI*2){super();this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);let o=[],s=[],a=[],l=[],u=new M,c=new ee;s.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,h=3;f<=t;f++,h+=3){let p=n+f/t*i;u.x=e*Math.cos(p),u.y=e*Math.sin(p),s.push(u.x,u.y,u.z),a.push(0,0,1),c.x=(s[h]/e+1)/2,c.y=(s[h+1]/e+1)/2,l.push(c.x,c.y)}for(let f=1;f<=t;f++)o.push(f,f+1,0);this.setIndex(o),this.setAttribute("position",new Te(s,3)),this.setAttribute("normal",new Te(a,3)),this.setAttribute("uv",new Te(l,2))}static fromJSON(e){return new sl(e.radius,e.segments,e.thetaStart,e.thetaLength)}},bo=class extends Pe{constructor(e=1,t=1,n=1,i=8,o=1,s=!1,a=0,l=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:o,openEnded:s,thetaStart:a,thetaLength:l};let u=this;i=Math.floor(i),o=Math.floor(o);let c=[],f=[],h=[],p=[],d=0,g=[],x=n/2,y=0;m(),s===!1&&(e>0&&b(!0),t>0&&b(!1)),this.setIndex(c),this.setAttribute("position",new Te(f,3)),this.setAttribute("normal",new Te(h,3)),this.setAttribute("uv",new Te(p,2));function m(){let w=new M,D=new M,R=0,L=(t-e)/n;for(let T=0;T<=o;T++){let U=[],F=T/o,C=F*(t-e)+e;for(let j=0;j<=i;j++){let B=j/i,z=B*l+a,O=Math.sin(z),V=Math.cos(z);D.x=C*O,D.y=-F*n+x,D.z=C*V,f.push(D.x,D.y,D.z),w.set(O,L,V).normalize(),h.push(w.x,w.y,w.z),p.push(B,1-F),U.push(d++)}g.push(U)}for(let T=0;T<i;T++)for(let U=0;U<o;U++){let F=g[U][T],C=g[U+1][T],j=g[U+1][T+1],B=g[U][T+1];c.push(F,C,B),c.push(C,j,B),R+=6}u.addGroup(y,R,0),y+=R}function b(w){let D=d,R=new ee,L=new M,T=0,U=w===!0?e:t,F=w===!0?1:-1;for(let j=1;j<=i;j++)f.push(0,x*F,0),h.push(0,F,0),p.push(.5,.5),d++;let C=d;for(let j=0;j<=i;j++){let z=j/i*l+a,O=Math.cos(z),V=Math.sin(z);L.x=U*V,L.y=x*F,L.z=U*O,f.push(L.x,L.y,L.z),h.push(0,F,0),R.x=O*.5+.5,R.y=V*.5*F+.5,p.push(R.x,R.y),d++}for(let j=0;j<i;j++){let B=D+j,z=C+j;w===!0?c.push(z,z+1,B):c.push(z+1,z,B),T+=3}u.addGroup(y,T,w===!0?1:2),y+=T}}static fromJSON(e){return new bo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},al=class extends bo{constructor(e=1,t=1,n=8,i=1,o=!1,s=0,a=Math.PI*2){super(0,e,t,n,i,o,s,a);this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:a}}static fromJSON(e){return new al(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Zi=class extends Pe{constructor(e=[],t=[],n=1,i=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};let o=[],s=[];a(i),u(n),c(),this.setAttribute("position",new Te(o,3)),this.setAttribute("normal",new Te(o.slice(),3)),this.setAttribute("uv",new Te(s,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(m){let b=new M,w=new M,D=new M;for(let R=0;R<t.length;R+=3)p(t[R+0],b),p(t[R+1],w),p(t[R+2],D),l(b,w,D,m)}function l(m,b,w,D){let R=D+1,L=[];for(let T=0;T<=R;T++){L[T]=[];let U=m.clone().lerp(w,T/R),F=b.clone().lerp(w,T/R),C=R-T;for(let j=0;j<=C;j++)j===0&&T===R?L[T][j]=U:L[T][j]=U.clone().lerp(F,j/C)}for(let T=0;T<R;T++)for(let U=0;U<2*(R-T)-1;U++){let F=Math.floor(U/2);U%2==0?(h(L[T][F+1]),h(L[T+1][F]),h(L[T][F])):(h(L[T][F+1]),h(L[T+1][F+1]),h(L[T+1][F]))}}function u(m){let b=new M;for(let w=0;w<o.length;w+=3)b.x=o[w+0],b.y=o[w+1],b.z=o[w+2],b.normalize().multiplyScalar(m),o[w+0]=b.x,o[w+1]=b.y,o[w+2]=b.z}function c(){let m=new M;for(let b=0;b<o.length;b+=3){m.x=o[b+0],m.y=o[b+1],m.z=o[b+2];let w=x(m)/2/Math.PI+.5,D=y(m)/Math.PI+.5;s.push(w,1-D)}d(),f()}function f(){for(let m=0;m<s.length;m+=6){let b=s[m+0],w=s[m+2],D=s[m+4],R=Math.max(b,w,D),L=Math.min(b,w,D);R>.9&&L<.1&&(b<.2&&(s[m+0]+=1),w<.2&&(s[m+2]+=1),D<.2&&(s[m+4]+=1))}}function h(m){o.push(m.x,m.y,m.z)}function p(m,b){let w=m*3;b.x=e[w+0],b.y=e[w+1],b.z=e[w+2]}function d(){let m=new M,b=new M,w=new M,D=new M,R=new ee,L=new ee,T=new ee;for(let U=0,F=0;U<o.length;U+=9,F+=6){m.set(o[U+0],o[U+1],o[U+2]),b.set(o[U+3],o[U+4],o[U+5]),w.set(o[U+6],o[U+7],o[U+8]),R.set(s[F+0],s[F+1]),L.set(s[F+2],s[F+3]),T.set(s[F+4],s[F+5]),D.copy(m).add(b).add(w).divideScalar(3);let C=x(D);g(R,F+0,m,C),g(L,F+2,b,C),g(T,F+4,w,C)}}function g(m,b,w,D){D<0&&m.x===1&&(s[b]=m.x-1),w.x===0&&w.z===0&&(s[b]=D/2/Math.PI+.5)}function x(m){return Math.atan2(m.z,-m.x)}function y(m){return Math.atan2(-m.y,Math.sqrt(m.x*m.x+m.z*m.z))}}static fromJSON(e){return new Zi(e.vertices,e.indices,e.radius,e.details)}},ll=class extends Zi{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,i=1/n,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],s=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(o,s,e,t);this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ll(e.radius,e.detail)}},fp=new M,pp=new M,e1=new M,dp=new It,mp=class extends Pe{constructor(e=null,t=1){super();if(this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){let i=Math.pow(10,4),o=Math.cos(cs*t),s=e.getIndex(),a=e.getAttribute("position"),l=s?s.count:a.count,u=[0,0,0],c=["a","b","c"],f=new Array(3),h={},p=[];for(let d=0;d<l;d+=3){s?(u[0]=s.getX(d),u[1]=s.getX(d+1),u[2]=s.getX(d+2)):(u[0]=d,u[1]=d+1,u[2]=d+2);let{a:g,b:x,c:y}=dp;if(g.fromBufferAttribute(a,u[0]),x.fromBufferAttribute(a,u[1]),y.fromBufferAttribute(a,u[2]),dp.getNormal(e1),f[0]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,f[1]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,f[2]=`${Math.round(y.x*i)},${Math.round(y.y*i)},${Math.round(y.z*i)}`,!(f[0]===f[1]||f[1]===f[2]||f[2]===f[0]))for(let m=0;m<3;m++){let b=(m+1)%3,w=f[m],D=f[b],R=dp[c[m]],L=dp[c[b]],T=`${w}_${D}`,U=`${D}_${w}`;U in h&&h[U]?(e1.dot(h[U].normal)<=o&&(p.push(R.x,R.y,R.z),p.push(L.x,L.y,L.z)),h[U]=null):T in h||(h[T]={index0:u[m],index1:u[b],normal:e1.clone()})}}for(let d in h)if(h[d]){let{index0:g,index1:x}=h[d];fp.fromBufferAttribute(a,g),pp.fromBufferAttribute(a,x),p.push(fp.x,fp.y,fp.z),p.push(pp.x,pp.y,pp.z)}this.setAttribute("position",new Te(p,3))}}},Xn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,i=this.getPoint(0),o=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),o+=n.distanceTo(i),t.push(o),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let n=this.getLengths(),i=0,o=n.length,s;t?s=t:s=e*n[o-1];let a=0,l=o-1,u;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),u=n[i]-s,u<0)a=i+1;else if(u>0)l=i-1;else{l=i;break}if(i=l,n[i]===s)return i/(o-1);let c=n[i],h=n[i+1]-c,p=(s-c)/h;return(i+p)/(o-1)}getTangent(e,t){let n=1e-4,i=e-n,o=e+n;i<0&&(i=0),o>1&&(o=1);let s=this.getPoint(i),a=this.getPoint(o),l=t||(s.isVector2?new ee:new M);return l.copy(a).sub(s).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){let n=new M,i=[],o=[],s=[],a=new M,l=new Ae;for(let p=0;p<=e;p++){let d=p/e;i[p]=this.getTangentAt(d,new M)}o[0]=new M,s[0]=new M;let u=Number.MAX_VALUE,c=Math.abs(i[0].x),f=Math.abs(i[0].y),h=Math.abs(i[0].z);c<=u&&(u=c,n.set(1,0,0)),f<=u&&(u=f,n.set(0,1,0)),h<=u&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),o[0].crossVectors(i[0],a),s[0].crossVectors(i[0],o[0]);for(let p=1;p<=e;p++){if(o[p]=o[p-1].clone(),s[p]=s[p-1].clone(),a.crossVectors(i[p-1],i[p]),a.length()>Number.EPSILON){a.normalize();let d=Math.acos(vn(i[p-1].dot(i[p]),-1,1));o[p].applyMatrix4(l.makeRotationAxis(a,d))}s[p].crossVectors(i[p],o[p])}if(t===!0){let p=Math.acos(vn(o[0].dot(o[e]),-1,1));p/=e,i[0].dot(a.crossVectors(o[0],o[e]))>0&&(p=-p);for(let d=1;d<=e;d++)o[d].applyMatrix4(l.makeRotationAxis(i[d],p*d)),s[d].crossVectors(i[d],o[d])}return{tangents:i,normals:o,binormals:s}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},ul=class extends Xn{constructor(e=0,t=0,n=1,i=1,o=0,s=Math.PI*2,a=!1,l=0){super();this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=o,this.aEndAngle=s,this.aClockwise=a,this.aRotation=l}getPoint(e,t){let n=t||new ee,i=Math.PI*2,o=this.aEndAngle-this.aStartAngle,s=Math.abs(o)<Number.EPSILON;for(;o<0;)o+=i;for(;o>i;)o-=i;o<Number.EPSILON&&(s?o=0:o=i),this.aClockwise===!0&&!s&&(o===i?o=-i:o=o-i);let a=this.aStartAngle+e*o,l=this.aX+this.xRadius*Math.cos(a),u=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let c=Math.cos(this.aRotation),f=Math.sin(this.aRotation),h=l-this.aX,p=u-this.aY;l=h*c-p*f+this.aX,u=h*f+p*c+this.aY}return n.set(l,u)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}};ul.prototype.isEllipseCurve=!0;gp=class extends ul{constructor(e,t,n,i,o,s){super(e,t,n,n,i,o,s);this.type="ArcCurve"}};gp.prototype.isArcCurve=!0;yp=new M,n1=new t1,i1=new t1,r1=new t1,vp=class extends Xn{constructor(e=[],t=!1,n="centripetal",i=.5){super();this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new M){let n=t,i=this.points,o=i.length,s=(o-(this.closed?0:1))*e,a=Math.floor(s),l=s-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/o)+1)*o:l===0&&a===o-1&&(a=o-2,l=1);let u,c;this.closed||a>0?u=i[(a-1)%o]:(yp.subVectors(i[0],i[1]).add(i[0]),u=yp);let f=i[a%o],h=i[(a+1)%o];if(this.closed||a+2<o?c=i[(a+2)%o]:(yp.subVectors(i[o-1],i[o-2]).add(i[o-1]),c=yp),this.curveType==="centripetal"||this.curveType==="chordal"){let p=this.curveType==="chordal"?.5:.25,d=Math.pow(u.distanceToSquared(f),p),g=Math.pow(f.distanceToSquared(h),p),x=Math.pow(h.distanceToSquared(c),p);g<1e-4&&(g=1),d<1e-4&&(d=g),x<1e-4&&(x=g),n1.initNonuniformCatmullRom(u.x,f.x,h.x,c.x,d,g,x),i1.initNonuniformCatmullRom(u.y,f.y,h.y,c.y,d,g,x),r1.initNonuniformCatmullRom(u.z,f.z,h.z,c.z,d,g,x)}else this.curveType==="catmullrom"&&(n1.initCatmullRom(u.x,f.x,h.x,c.x,this.tension),i1.initCatmullRom(u.y,f.y,h.y,c.y,this.tension),r1.initCatmullRom(u.z,f.z,h.z,c.z,this.tension));return n.set(n1.calc(l),i1.calc(l),r1.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(new M().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};vp.prototype.isCatmullRomCurve3=!0;mc=class extends Xn{constructor(e=new ee,t=new ee,n=new ee,i=new ee){super();this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ee){let n=t,i=this.v0,o=this.v1,s=this.v2,a=this.v3;return n.set(dc(e,i.x,o.x,s.x,a.x),dc(e,i.y,o.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};mc.prototype.isCubicBezierCurve=!0;xp=class extends Xn{constructor(e=new M,t=new M,n=new M,i=new M){super();this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new M){let n=t,i=this.v0,o=this.v1,s=this.v2,a=this.v3;return n.set(dc(e,i.x,o.x,s.x,a.x),dc(e,i.y,o.y,s.y,a.y),dc(e,i.z,o.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};xp.prototype.isCubicBezierCurve3=!0;cl=class extends Xn{constructor(e=new ee,t=new ee){super();this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ee){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let n=t||new ee;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};cl.prototype.isLineCurve=!0;o1=class extends Xn{constructor(e=new M,t=new M){super();this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new M){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},gc=class extends Xn{constructor(e=new ee,t=new ee,n=new ee){super();this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ee){let n=t,i=this.v0,o=this.v1,s=this.v2;return n.set(pc(e,i.x,o.x,s.x),pc(e,i.y,o.y,s.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};gc.prototype.isQuadraticBezierCurve=!0;yc=class extends Xn{constructor(e=new M,t=new M,n=new M){super();this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new M){let n=t,i=this.v0,o=this.v1,s=this.v2;return n.set(pc(e,i.x,o.x,s.x),pc(e,i.y,o.y,s.y),pc(e,i.z,o.z,s.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};yc.prototype.isQuadraticBezierCurve3=!0;vc=class extends Xn{constructor(e=[]){super();this.type="SplineCurve",this.points=e}getPoint(e,t=new ee){let n=t,i=this.points,o=(i.length-1)*e,s=Math.floor(o),a=o-s,l=i[s===0?s:s-1],u=i[s],c=i[s>i.length-2?i.length-1:s+1],f=i[s>i.length-3?i.length-1:s+2];return n.set(mS(a,l.x,u.x,c.x,f.x),mS(a,l.y,u.y,c.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let i=e.points[t];this.points.push(new ee().fromArray(i))}return this}};vc.prototype.isSplineCurve=!0;s1=Object.freeze({__proto__:null,ArcCurve:gp,CatmullRomCurve3:vp,CubicBezierCurve:mc,CubicBezierCurve3:xp,EllipseCurve:ul,LineCurve:cl,LineCurve3:o1,QuadraticBezierCurve:gc,QuadraticBezierCurve3:yc,SplineCurve:vc}),a1=class extends Xn{constructor(){super();this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new cl(t,e))}getPoint(e,t){let n=e*this.getLength(),i=this.getCurveLengths(),o=0;for(;o<i.length;){if(i[o]>=n){let s=i[o]-n,a=this.curves[o],l=a.getLength(),u=l===0?0:1-s/l;return a.getPointAt(u,t)}o++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let i=0,o=this.curves;i<o.length;i++){let s=o[i],a=s&&s.isEllipseCurve?e*2:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?e*s.points.length:e,l=s.getPoints(a);for(let u=0;u<l.length;u++){let c=l[u];n&&n.equals(c)||(t.push(c),n=c)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let i=e.curves[t];this.curves.push(new s1[i.type]().fromJSON(i))}return this}},hl=class extends a1{constructor(e){super();this.type="Path",this.currentPoint=new ee,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new cl(this.currentPoint.clone(),new ee(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){let o=new gc(this.currentPoint.clone(),new ee(e,t),new ee(n,i));return this.curves.push(o),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,o,s){let a=new mc(this.currentPoint.clone(),new ee(e,t),new ee(n,i),new ee(o,s));return this.curves.push(a),this.currentPoint.set(o,s),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new vc(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,o,s){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,i,o,s),this}absarc(e,t,n,i,o,s){return this.absellipse(e,t,n,n,i,o,s),this}ellipse(e,t,n,i,o,s,a,l){let u=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+u,t+c,n,i,o,s,a,l),this}absellipse(e,t,n,i,o,s,a,l){let u=new ul(e,t,n,i,o,s,a,l);if(this.curves.length>0){let f=u.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(u);let c=u.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Ci=class extends hl{constructor(e){super(e);this.uuid=oi(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let i=e.holes[t];this.holes.push(new hl().fromJSON(i))}return this}},oF={triangulate:function(r,e,t=2){let n=e&&e.length,i=n?e[0]*t:r.length,o=gS(r,0,i,t,!0),s=[];if(!o||o.next===o.prev)return s;let a,l,u,c,f,h,p;if(n&&(o=cF(r,e,o,t)),r.length>80*t){a=u=r[0],l=c=r[1];for(let d=t;d<i;d+=t)f=r[d],h=r[d+1],f<a&&(a=f),h<l&&(l=h),f>u&&(u=f),h>c&&(c=h);p=Math.max(u-a,c-l),p=p!==0?1/p:0}return xc(o,s,t,a,l,p),s}};Pi=class{static area(e){let t=e.length,n=0;for(let i=t-1,o=0;o<t;i=o++)n+=e[i].x*e[o].y-e[o].x*e[i].y;return n*.5}static isClockWise(e){return Pi.area(e)<0}static triangulateShape(e,t){let n=[],i=[],o=[];wS(e),bS(n,e);let s=e.length;t.forEach(wS);for(let l=0;l<t.length;l++)i.push(s),s+=t[l].length,bS(n,t[l]);let a=oF.triangulate(n,i);for(let l=0;l<a.length;l+=3)o.push(a.slice(l,l+3));return o}};Ji=class extends Pe{constructor(e=new Ci([new ee(.5,.5),new ee(-.5,.5),new ee(-.5,-.5),new ee(.5,-.5)]),t={}){super();this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,i=[],o=[];for(let a=0,l=e.length;a<l;a++){let u=e[a];s(u)}this.setAttribute("position",new Te(i,3)),this.setAttribute("uv",new Te(o,2)),this.computeVertexNormals();function s(a){let l=[],u=t.curveSegments!==void 0?t.curveSegments:12,c=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,h=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:.2,d=t.bevelSize!==void 0?t.bevelSize:p-.1,g=t.bevelOffset!==void 0?t.bevelOffset:0,x=t.bevelSegments!==void 0?t.bevelSegments:3,y=t.extrudePath,m=t.UVGenerator!==void 0?t.UVGenerator:SF;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),f=t.amount);let b,w=!1,D,R,L,T;y&&(b=y.getSpacedPoints(c),w=!0,h=!1,D=y.computeFrenetFrames(c,!1),R=new M,L=new M,T=new M),h||(x=0,p=0,d=0,g=0);let U=a.extractPoints(u),F=U.shape,C=U.holes;if(!Pi.isClockWise(F)){F=F.reverse();for(let Q=0,le=C.length;Q<le;Q++){let ue=C[Q];Pi.isClockWise(ue)&&(C[Q]=ue.reverse())}}let B=Pi.triangulateShape(F,C),z=F;for(let Q=0,le=C.length;Q<le;Q++){let ue=C[Q];F=F.concat(ue)}function O(Q,le,ue){return le||console.error("THREE.ExtrudeGeometry: vec does not exist"),le.clone().multiplyScalar(ue).add(Q)}let V=F.length,q=B.length;function se(Q,le,ue){let Se,ce,Ue,We=Q.x-le.x,nt=Q.y-le.y,Et=ue.x-Q.x,k=ue.y-Q.y,_=We*We+nt*nt,te=We*k-nt*Et;if(Math.abs(te)>Number.EPSILON){let ie=Math.sqrt(_),Fe=Math.sqrt(Et*Et+k*k),Me=le.x-nt/ie,G=le.y+We/ie,de=ue.x-k/Fe,J=ue.y+Et/Fe,be=((de-Me)*k-(J-G)*Et)/(We*k-nt*Et);Se=Me+We*be-Q.x,ce=G+nt*be-Q.y;let ge=Se*Se+ce*ce;if(ge<=2)return new ee(Se,ce);Ue=Math.sqrt(ge/2)}else{let ie=!1;We>Number.EPSILON?Et>Number.EPSILON&&(ie=!0):We<-Number.EPSILON?Et<-Number.EPSILON&&(ie=!0):Math.sign(nt)===Math.sign(k)&&(ie=!0),ie?(Se=-nt,ce=We,Ue=Math.sqrt(_)):(Se=We,ce=nt,Ue=Math.sqrt(_/2))}return new ee(Se/Ue,ce/Ue)}let he=[];for(let Q=0,le=z.length,ue=le-1,Se=Q+1;Q<le;Q++,ue++,Se++)ue===le&&(ue=0),Se===le&&(Se=0),he[Q]=se(z[Q],z[ue],z[Se]);let Y=[],X,ve=he.concat();for(let Q=0,le=C.length;Q<le;Q++){let ue=C[Q];X=[];for(let Se=0,ce=ue.length,Ue=ce-1,We=Se+1;Se<ce;Se++,Ue++,We++)Ue===ce&&(Ue=0),We===ce&&(We=0),X[Se]=se(ue[Se],ue[Ue],ue[We]);Y.push(X),ve=ve.concat(X)}for(let Q=0;Q<x;Q++){let le=Q/x,ue=p*Math.cos(le*Math.PI/2),Se=d*Math.sin(le*Math.PI/2)+g;for(let ce=0,Ue=z.length;ce<Ue;ce++){let We=O(z[ce],he[ce],Se);Z(We.x,We.y,-ue)}for(let ce=0,Ue=C.length;ce<Ue;ce++){let We=C[ce];X=Y[ce];for(let nt=0,Et=We.length;nt<Et;nt++){let k=O(We[nt],X[nt],Se);Z(k.x,k.y,-ue)}}}let pe=d+g;for(let Q=0;Q<V;Q++){let le=h?O(F[Q],ve[Q],pe):F[Q];w?(L.copy(D.normals[0]).multiplyScalar(le.x),R.copy(D.binormals[0]).multiplyScalar(le.y),T.copy(b[0]).add(L).add(R),Z(T.x,T.y,T.z)):Z(le.x,le.y,0)}for(let Q=1;Q<=c;Q++)for(let le=0;le<V;le++){let ue=h?O(F[le],ve[le],pe):F[le];w?(L.copy(D.normals[Q]).multiplyScalar(ue.x),R.copy(D.binormals[Q]).multiplyScalar(ue.y),T.copy(b[Q]).add(L).add(R),Z(T.x,T.y,T.z)):Z(ue.x,ue.y,f/c*Q)}for(let Q=x-1;Q>=0;Q--){let le=Q/x,ue=p*Math.cos(le*Math.PI/2),Se=d*Math.sin(le*Math.PI/2)+g;for(let ce=0,Ue=z.length;ce<Ue;ce++){let We=O(z[ce],he[ce],Se);Z(We.x,We.y,f+ue)}for(let ce=0,Ue=C.length;ce<Ue;ce++){let We=C[ce];X=Y[ce];for(let nt=0,Et=We.length;nt<Et;nt++){let k=O(We[nt],X[nt],Se);w?Z(k.x,k.y+b[c-1].y,b[c-1].x+ue):Z(k.x,k.y,f+ue)}}}Le(),Ie();function Le(){let Q=i.length/3;if(h){let le=0,ue=V*le;for(let Se=0;Se<q;Se++){let ce=B[Se];ae(ce[2]+ue,ce[1]+ue,ce[0]+ue)}le=c+x*2,ue=V*le;for(let Se=0;Se<q;Se++){let ce=B[Se];ae(ce[0]+ue,ce[1]+ue,ce[2]+ue)}}else{for(let le=0;le<q;le++){let ue=B[le];ae(ue[2],ue[1],ue[0])}for(let le=0;le<q;le++){let ue=B[le];ae(ue[0]+V*c,ue[1]+V*c,ue[2]+V*c)}}n.addGroup(Q,i.length/3-Q,0)}function Ie(){let Q=i.length/3,le=0;P(z,le),le+=z.length;for(let ue=0,Se=C.length;ue<Se;ue++){let ce=C[ue];P(ce,le),le+=ce.length}n.addGroup(Q,i.length/3-Q,1)}function P(Q,le){let ue=Q.length;for(;--ue>=0;){let Se=ue,ce=ue-1;ce<0&&(ce=Q.length-1);for(let Ue=0,We=c+x*2;Ue<We;Ue++){let nt=V*Ue,Et=V*(Ue+1),k=le+Se+nt,_=le+ce+nt,te=le+ce+Et,ie=le+Se+Et;ne(k,_,te,ie)}}}function Z(Q,le,ue){l.push(Q),l.push(le),l.push(ue)}function ae(Q,le,ue){fe(Q),fe(le),fe(ue);let Se=i.length/3,ce=m.generateTopUV(n,i,Se-3,Se-2,Se-1);W(ce[0]),W(ce[1]),W(ce[2])}function ne(Q,le,ue,Se){fe(Q),fe(le),fe(Se),fe(le),fe(ue),fe(Se);let ce=i.length/3,Ue=m.generateSideWallUV(n,i,ce-6,ce-3,ce-2,ce-1);W(Ue[0]),W(Ue[1]),W(Ue[3]),W(Ue[1]),W(Ue[2]),W(Ue[3])}function fe(Q){i.push(l[Q*3+0]),i.push(l[Q*3+1]),i.push(l[Q*3+2])}function W(Q){o.push(Q.x),o.push(Q.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return LF(t,n,e)}static fromJSON(e,t){let n=[];for(let o=0,s=e.shapes.length;o<s;o++){let a=t[e.shapes[o]];n.push(a)}let i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new s1[i.type]().fromJSON(i)),new Ji(n,e.options)}},SF={generateTopUV:function(r,e,t,n,i){let o=e[t*3],s=e[t*3+1],a=e[n*3],l=e[n*3+1],u=e[i*3],c=e[i*3+1];return[new ee(o,s),new ee(a,l),new ee(u,c)]},generateSideWallUV:function(r,e,t,n,i,o){let s=e[t*3],a=e[t*3+1],l=e[t*3+2],u=e[n*3],c=e[n*3+1],f=e[n*3+2],h=e[i*3],p=e[i*3+1],d=e[i*3+2],g=e[o*3],x=e[o*3+1],y=e[o*3+2];return Math.abs(a-c)<Math.abs(s-u)?[new ee(s,1-l),new ee(u,1-f),new ee(h,1-d),new ee(g,1-y)]:[new ee(a,1-l),new ee(c,1-f),new ee(p,1-d),new ee(x,1-y)]}};pl=class extends Zi{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,o,e,t);this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new pl(e.radius,e.detail)}},dl=class extends Pe{constructor(e=[new ee(0,.5),new ee(.5,0),new ee(0,-.5)],t=12,n=0,i=Math.PI*2){super();this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=vn(i,0,Math.PI*2);let o=[],s=[],a=[],l=1/t,u=new M,c=new ee;for(let f=0;f<=t;f++){let h=n+f*l*i,p=Math.sin(h),d=Math.cos(h);for(let g=0;g<=e.length-1;g++)u.x=e[g].x*p,u.y=e[g].y,u.z=e[g].x*d,s.push(u.x,u.y,u.z),c.x=f/t,c.y=g/(e.length-1),a.push(c.x,c.y)}for(let f=0;f<t;f++)for(let h=0;h<e.length-1;h++){let p=h+f*e.length,d=p,g=p+e.length,x=p+e.length+1,y=p+1;o.push(d,g,y),o.push(g,x,y)}if(this.setIndex(o),this.setAttribute("position",new Te(s,3)),this.setAttribute("uv",new Te(a,2)),this.computeVertexNormals(),i===Math.PI*2){let f=this.attributes.normal.array,h=new M,p=new M,d=new M,g=t*e.length*3;for(let x=0,y=0;x<e.length;x++,y+=3)h.x=f[y+0],h.y=f[y+1],h.z=f[y+2],p.x=f[g+y+0],p.y=f[g+y+1],p.z=f[g+y+2],d.addVectors(h,p).normalize(),f[y+0]=f[g+y+0]=d.x,f[y+1]=f[g+y+1]=d.y,f[y+2]=f[g+y+2]=d.z}}static fromJSON(e){return new dl(e.points,e.segments,e.phiStart,e.phiLength)}},ws=class extends Zi{constructor(e=1,t=0){let n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,i,e,t);this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ws(e.radius,e.detail)}},ml=class extends Pe{constructor(e=.5,t=1,n=8,i=1,o=0,s=Math.PI*2){super();this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:o,thetaLength:s},n=Math.max(3,n),i=Math.max(1,i);let a=[],l=[],u=[],c=[],f=e,h=(t-e)/i,p=new M,d=new ee;for(let g=0;g<=i;g++){for(let x=0;x<=n;x++){let y=o+x/n*s;p.x=f*Math.cos(y),p.y=f*Math.sin(y),l.push(p.x,p.y,p.z),u.push(0,0,1),d.x=(p.x/t+1)/2,d.y=(p.y/t+1)/2,c.push(d.x,d.y)}f+=h}for(let g=0;g<i;g++){let x=g*(n+1);for(let y=0;y<n;y++){let m=y+x,b=m,w=m+n+1,D=m+n+2,R=m+1;a.push(b,w,R),a.push(w,D,R)}}this.setIndex(a),this.setAttribute("position",new Te(l,3)),this.setAttribute("normal",new Te(u,3)),this.setAttribute("uv",new Te(c,2))}static fromJSON(e){return new ml(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}},bs=class extends Pe{constructor(e=new Ci([new ee(0,.5),new ee(-.5,-.5),new ee(.5,-.5)]),t=12){super();this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let n=[],i=[],o=[],s=[],a=0,l=0;if(Array.isArray(e)===!1)u(e);else for(let c=0;c<e.length;c++)u(e[c]),this.addGroup(a,l,c),a+=l,l=0;this.setIndex(n),this.setAttribute("position",new Te(i,3)),this.setAttribute("normal",new Te(o,3)),this.setAttribute("uv",new Te(s,2));function u(c){let f=i.length/3,h=c.extractPoints(t),p=h.shape,d=h.holes;Pi.isClockWise(p)===!1&&(p=p.reverse());for(let x=0,y=d.length;x<y;x++){let m=d[x];Pi.isClockWise(m)===!0&&(d[x]=m.reverse())}let g=Pi.triangulateShape(p,d);for(let x=0,y=d.length;x<y;x++){let m=d[x];p=p.concat(m)}for(let x=0,y=p.length;x<y;x++){let m=p[x];i.push(m.x,m.y,0),o.push(0,0,1),s.push(m.x,m.y)}for(let x=0,y=g.length;x<y;x++){let m=g[x],b=m[0]+f,w=m[1]+f,D=m[2]+f;n.push(b,w,D),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return AF(t,e)}static fromJSON(e,t){let n=[];for(let i=0,o=e.shapes.length;i<o;i++){let s=t[e.shapes[i]];n.push(s)}return new bs(n,e.curveSegments)}};Ss=class extends Pe{constructor(e=1,t=32,n=16,i=0,o=Math.PI*2,s=0,a=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:o,thetaStart:s,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(s+a,Math.PI),u=0,c=[],f=new M,h=new M,p=[],d=[],g=[],x=[];for(let y=0;y<=n;y++){let m=[],b=y/n,w=0;y==0&&s==0?w=.5/t:y==n&&l==Math.PI&&(w=-.5/t);for(let D=0;D<=t;D++){let R=D/t;f.x=-e*Math.cos(i+R*o)*Math.sin(s+b*a),f.y=e*Math.cos(s+b*a),f.z=e*Math.sin(i+R*o)*Math.sin(s+b*a),d.push(f.x,f.y,f.z),h.copy(f).normalize(),g.push(h.x,h.y,h.z),x.push(R+w,1-b),m.push(u++)}c.push(m)}for(let y=0;y<n;y++)for(let m=0;m<t;m++){let b=c[y][m+1],w=c[y][m],D=c[y+1][m],R=c[y+1][m+1];(y!==0||s>0)&&p.push(b,w,R),(y!==n-1||l<Math.PI)&&p.push(w,D,R)}this.setIndex(p),this.setAttribute("position",new Te(d,3)),this.setAttribute("normal",new Te(g,3)),this.setAttribute("uv",new Te(x,2))}static fromJSON(e){return new Ss(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}},gl=class extends Zi{constructor(e=1,t=0){let n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,i,e,t);this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new gl(e.radius,e.detail)}},yl=class extends Pe{constructor(e=1,t=.4,n=8,i=6,o=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:o},n=Math.floor(n),i=Math.floor(i);let s=[],a=[],l=[],u=[],c=new M,f=new M,h=new M;for(let p=0;p<=n;p++)for(let d=0;d<=i;d++){let g=d/i*o,x=p/n*Math.PI*2;f.x=(e+t*Math.cos(x))*Math.cos(g),f.y=(e+t*Math.cos(x))*Math.sin(g),f.z=t*Math.sin(x),a.push(f.x,f.y,f.z),c.x=e*Math.cos(g),c.y=e*Math.sin(g),h.subVectors(f,c).normalize(),l.push(h.x,h.y,h.z),u.push(d/i),u.push(p/n)}for(let p=1;p<=n;p++)for(let d=1;d<=i;d++){let g=(i+1)*p+d-1,x=(i+1)*(p-1)+d-1,y=(i+1)*(p-1)+d,m=(i+1)*p+d;s.push(g,x,m),s.push(x,y,m)}this.setIndex(s),this.setAttribute("position",new Te(a,3)),this.setAttribute("normal",new Te(l,3)),this.setAttribute("uv",new Te(u,2))}static fromJSON(e){return new yl(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}},vl=class extends Pe{constructor(e=1,t=.4,n=64,i=8,o=2,s=3){super();this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:o,q:s},n=Math.floor(n),i=Math.floor(i);let a=[],l=[],u=[],c=[],f=new M,h=new M,p=new M,d=new M,g=new M,x=new M,y=new M;for(let b=0;b<=n;++b){let w=b/n*o*Math.PI*2;m(w,o,s,e,p),m(w+.01,o,s,e,d),x.subVectors(d,p),y.addVectors(d,p),g.crossVectors(x,y),y.crossVectors(g,x),g.normalize(),y.normalize();for(let D=0;D<=i;++D){let R=D/i*Math.PI*2,L=-t*Math.cos(R),T=t*Math.sin(R);f.x=p.x+(L*y.x+T*g.x),f.y=p.y+(L*y.y+T*g.y),f.z=p.z+(L*y.z+T*g.z),l.push(f.x,f.y,f.z),h.subVectors(f,p).normalize(),u.push(h.x,h.y,h.z),c.push(b/n),c.push(D/i)}}for(let b=1;b<=n;b++)for(let w=1;w<=i;w++){let D=(i+1)*(b-1)+(w-1),R=(i+1)*b+(w-1),L=(i+1)*b+w,T=(i+1)*(b-1)+w;a.push(D,R,T),a.push(R,L,T)}this.setIndex(a),this.setAttribute("position",new Te(l,3)),this.setAttribute("normal",new Te(u,3)),this.setAttribute("uv",new Te(c,2));function m(b,w,D,R,L){let T=Math.cos(b),U=Math.sin(b),F=D/w*b,C=Math.cos(F);L.x=R*(2+C)*.5*T,L.y=R*(2+C)*U*.5,L.z=R*Math.sin(F)*.5}}static fromJSON(e){return new vl(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}},xl=class extends Pe{constructor(e=new yc(new M(-1,-1,0),new M(-1,1,0),new M(1,1,0)),t=64,n=1,i=8,o=!1){super();this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:o};let s=e.computeFrenetFrames(t,o);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;let a=new M,l=new M,u=new ee,c=new M,f=[],h=[],p=[],d=[];g(),this.setIndex(d),this.setAttribute("position",new Te(f,3)),this.setAttribute("normal",new Te(h,3)),this.setAttribute("uv",new Te(p,2));function g(){for(let b=0;b<t;b++)x(b);x(o===!1?t:0),m(),y()}function x(b){c=e.getPointAt(b/t,c);let w=s.normals[b],D=s.binormals[b];for(let R=0;R<=i;R++){let L=R/i*Math.PI*2,T=Math.sin(L),U=-Math.cos(L);l.x=U*w.x+T*D.x,l.y=U*w.y+T*D.y,l.z=U*w.z+T*D.z,l.normalize(),h.push(l.x,l.y,l.z),a.x=c.x+n*l.x,a.y=c.y+n*l.y,a.z=c.z+n*l.z,f.push(a.x,a.y,a.z)}}function y(){for(let b=1;b<=t;b++)for(let w=1;w<=i;w++){let D=(i+1)*(b-1)+(w-1),R=(i+1)*b+(w-1),L=(i+1)*b+w,T=(i+1)*(b-1)+w;d.push(D,R,T),d.push(R,L,T)}}function m(){for(let b=0;b<=t;b++)for(let w=0;w<=i;w++)u.x=b/t,u.y=w/i,p.push(u.x,u.y)}}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new xl(new s1[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},Lp=class extends Pe{constructor(e=null){super();if(this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,i=new M,o=new M;if(e.index!==null){let s=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let u=0,c=l.length;u<c;++u){let f=l[u],h=f.start,p=f.count;for(let d=h,g=h+p;d<g;d+=3)for(let x=0;x<3;x++){let y=a.getX(d+x),m=a.getX(d+(x+1)%3);i.fromBufferAttribute(s,y),o.fromBufferAttribute(s,m),SS(i,o,n)===!0&&(t.push(i.x,i.y,i.z),t.push(o.x,o.y,o.z))}}}else{let s=e.attributes.position;for(let a=0,l=s.count/3;a<l;a++)for(let u=0;u<3;u++){let c=3*a+u,f=3*a+(u+1)%3;i.fromBufferAttribute(s,c),o.fromBufferAttribute(s,f),SS(i,o,n)===!0&&(t.push(i.x,i.y,i.z),t.push(o.x,o.y,o.z))}}this.setAttribute("position",new Te(t,3))}}};LS=Object.freeze({__proto__:null,BoxGeometry:Ti,BoxBufferGeometry:Ti,CircleGeometry:sl,CircleBufferGeometry:sl,ConeGeometry:al,ConeBufferGeometry:al,CylinderGeometry:bo,CylinderBufferGeometry:bo,DodecahedronGeometry:ll,DodecahedronBufferGeometry:ll,EdgesGeometry:mp,ExtrudeGeometry:Ji,ExtrudeBufferGeometry:Ji,IcosahedronGeometry:pl,IcosahedronBufferGeometry:pl,LatheGeometry:dl,LatheBufferGeometry:dl,OctahedronGeometry:ws,OctahedronBufferGeometry:ws,PlaneGeometry:ds,PlaneBufferGeometry:ds,PolyhedronGeometry:Zi,PolyhedronBufferGeometry:Zi,RingGeometry:ml,RingBufferGeometry:ml,ShapeGeometry:bs,ShapeBufferGeometry:bs,SphereGeometry:Ss,SphereBufferGeometry:Ss,TetrahedronGeometry:gl,TetrahedronBufferGeometry:gl,TorusGeometry:yl,TorusBufferGeometry:yl,TorusKnotGeometry:vl,TorusKnotBufferGeometry:vl,TubeGeometry:xl,TubeBufferGeometry:xl,WireframeGeometry:Lp}),Ap=class extends Zt{constructor(e){super();this.type="ShadowMaterial",this.color=new xe(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}};Ap.prototype.isShadowMaterial=!0;Sc=class extends Zt{constructor(e){super();this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};Sc.prototype.isMeshStandardMaterial=!0;Dp=class extends Sc{constructor(e){super();this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ee(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return vn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xe(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};Dp.prototype.isMeshPhysicalMaterial=!0;Ep=class extends Zt{constructor(e){super();this.type="MeshPhongMaterial",this.color=new xe(16777215),this.specular=new xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Fu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};Ep.prototype.isMeshPhongMaterial=!0;Mp=class extends Zt{constructor(e){super();this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};Mp.prototype.isMeshToonMaterial=!0;Rp=class extends Zt{constructor(e){super();this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}};Rp.prototype.isMeshNormalMaterial=!0;Tp=class extends Zt{constructor(e){super();this.type="MeshLambertMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Fu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};Tp.prototype.isMeshLambertMaterial=!0;Fp=class extends Zt{constructor(e){super();this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=us,this.normalScale=new ee(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}};Fp.prototype.isMeshMatcapMaterial=!0;_p=class extends Jt{constructor(e){super();this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};_p.prototype.isLineDashedMaterial=!0;DF=Object.freeze({__proto__:null,ShadowMaterial:Ap,SpriteMaterial:rc,RawShaderMaterial:ms,ShaderMaterial:Yi,PointsMaterial:wo,MeshPhysicalMaterial:Dp,MeshStandardMaterial:Sc,MeshPhongMaterial:Ep,MeshToonMaterial:Mp,MeshNormalMaterial:Rp,MeshLambertMaterial:Tp,MeshDepthMaterial:tc,MeshDistanceMaterial:nc,MeshBasicMaterial:vt,MeshMatcapMaterial:Fp,LineDashedMaterial:_p,LineBasicMaterial:Jt,Material:Zt}),Ct={arraySlice:function(r,e,t){return Ct.isTypedArray(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)},convertArray:function(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)},isTypedArray:function(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)},getKeyframeOrder:function(r){function e(i,o){return r[i]-r[o]}let t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n},sortedArray:function(r,e,t){let n=r.length,i=new r.constructor(n);for(let o=0,s=0;s!==n;++o){let a=t[o]*e;for(let l=0;l!==e;++l)i[s++]=r[a+l]}return i},flattenJSON:function(r,e,t,n){let i=1,o=r[0];for(;o!==void 0&&o[n]===void 0;)o=r[i++];if(o===void 0)return;let s=o[n];if(s!==void 0)if(Array.isArray(s))do s=o[n],s!==void 0&&(e.push(o.time),t.push.apply(t,s)),o=r[i++];while(o!==void 0);else if(s.toArray!==void 0)do s=o[n],s!==void 0&&(e.push(o.time),s.toArray(t,t.length)),o=r[i++];while(o!==void 0);else do s=o[n],s!==void 0&&(e.push(o.time),t.push(s)),o=r[i++];while(o!==void 0)},subclip:function(r,e,t,n,i=30){let o=r.clone();o.name=e;let s=[];for(let l=0;l<o.tracks.length;++l){let u=o.tracks[l],c=u.getValueSize(),f=[],h=[];for(let p=0;p<u.times.length;++p){let d=u.times[p]*i;if(!(d<t||d>=n)){f.push(u.times[p]);for(let g=0;g<c;++g)h.push(u.values[p*c+g])}}f.length!==0&&(u.times=Ct.convertArray(f,u.times.constructor),u.values=Ct.convertArray(h,u.values.constructor),s.push(u))}o.tracks=s;let a=1/0;for(let l=0;l<o.tracks.length;++l)a>o.tracks[l].times[0]&&(a=o.tracks[l].times[0]);for(let l=0;l<o.tracks.length;++l)o.tracks[l].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(r,e=0,t=r,n=30){n<=0&&(n=30);let i=t.tracks.length,o=e/n;for(let s=0;s<i;++s){let a=t.tracks[s],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let u=r.tracks.find(function(y){return y.name===a.name&&y.ValueTypeName===l});if(u===void 0)continue;let c=0,f=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=f/3);let h=0,p=u.getValueSize();u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=p/3);let d=a.times.length-1,g;if(o<=a.times[0]){let y=c,m=f-c;g=Ct.arraySlice(a.values,y,m)}else if(o>=a.times[d]){let y=d*f+c,m=y+f-c;g=Ct.arraySlice(a.values,y,m)}else{let y=a.createInterpolant(),m=c,b=f-c;y.evaluate(o),g=Ct.arraySlice(y.resultBuffer,m,b)}l==="quaternion"&&new ot().fromArray(g).normalize().conjugate().toArray(g);let x=u.times.length;for(let y=0;y<x;++y){let m=y*p+h;if(l==="quaternion")ot.multiplyQuaternionsFlat(u.values,m,g,0,u.values,m);else{let b=p-h*2;for(let w=0;w<b;++w)u.values[m+w]-=g[w]}}}return r.blendMode=ng,r}},$i=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],o=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<o)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,o)}if(n===a)break;if(o=i,i=t[++n],e<i)break t}s=t.length;break n}if(!(e>=o)){let a=t[1];e<a&&(n=2,o=a);for(let l=n-2;;){if(o===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=o,o=t[--n-1],e>=o)break t}s=n,n=0;break n}break e}for(;n<s;){let a=n+s>>>1;e<t[a]?s=a:n=a+1}if(i=t[n],o=t[n-1],o===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,o,e)}this._cachedIndex=n,this.intervalChanged_(n,o,i)}return this.interpolate_(n,o,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i;for(let s=0;s!==i;++s)t[s]=n[o+s];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};$i.prototype.beforeStart_=$i.prototype.copySampleValue_;$i.prototype.afterEnd_=$i.prototype.copySampleValue_;c1=class extends $i{constructor(e,t,n,i){super(e,t,n,i);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:as,endingEnd:as}}intervalChanged_(e,t,n){let i=this.parameterPositions,o=e-2,s=e+1,a=i[o],l=i[s];if(a===void 0)switch(this.getSettings_().endingStart){case ls:o=e,a=2*t-n;break;case Nu:o=i.length-2,a=t+i[o]-i[o+1];break;default:o=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case ls:s=e,l=2*n-t;break;case Nu:s=1,l=n+i[1]-i[0];break;default:s=e-1,l=t}let u=(n-t)*.5,c=this.valueSize;this._weightPrev=u/(t-a),this._weightNext=u/(l-n),this._offsetPrev=o*c,this._offsetNext=s*c}interpolate_(e,t,n,i){let o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,l=e*a,u=l-a,c=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,p=this._weightNext,d=(n-t)/(i-t),g=d*d,x=g*d,y=-h*x+2*h*g-h*d,m=(1+h)*x+(-1.5-2*h)*g+(-.5+h)*d+1,b=(-1-p)*x+(1.5+p)*g+.5*d,w=p*x-p*g;for(let D=0;D!==a;++D)o[D]=y*s[c+D]+m*s[u+D]+b*s[l+D]+w*s[f+D];return o}},Cp=class extends $i{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,l=e*a,u=l-a,c=(n-t)/(i-t),f=1-c;for(let h=0;h!==a;++h)o[h]=s[u+h]*f+s[l+h]*c;return o}},h1=class extends $i{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},yi=class{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ct.convertArray(t,this.TimeBufferType),this.values=Ct.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Ct.convertArray(e.times,Array),values:Ct.convertArray(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new h1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Cp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new c1(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Iu:t=this.InterpolantFactoryMethodDiscrete;break;case Uu:t=this.InterpolantFactoryMethodLinear;break;case Af:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Iu;case this.InterpolantFactoryMethodLinear:return Uu;case this.InterpolantFactoryMethodSmooth:return Af}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,o=0,s=i-1;for(;o!==i&&n[o]<e;)++o;for(;s!==-1&&n[s]>t;)--s;if(++s,o!==0||s!==i){o>=s&&(s=Math.max(s,1),o=s-1);let a=this.getValueSize();this.times=Ct.arraySlice(n,o,s),this.values=Ct.arraySlice(this.values,o*a,s*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,o=n.length;o===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let a=0;a!==o;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(s!==null&&s>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,s),e=!1;break}s=l}if(i!==void 0&&Ct.isTypedArray(i))for(let a=0,l=i.length;a!==l;++a){let u=i[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){let e=Ct.arraySlice(this.times),t=Ct.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Af,o=e.length-1,s=1;for(let a=1;a<o;++a){let l=!1,u=e[a],c=e[a+1];if(u!==c&&(a!==1||u!==e[0]))if(i)l=!0;else{let f=a*n,h=f-n,p=f+n;for(let d=0;d!==n;++d){let g=t[f+d];if(g!==t[h+d]||g!==t[p+d]){l=!0;break}}}if(l){if(a!==s){e[s]=e[a];let f=a*n,h=s*n;for(let p=0;p!==n;++p)t[h+p]=t[f+p]}++s}}if(o>0){e[s]=e[o];for(let a=o*n,l=s*n,u=0;u!==n;++u)t[l+u]=t[a+u];++s}return s!==e.length?(this.times=Ct.arraySlice(e,0,s),this.values=Ct.arraySlice(t,0,s*n)):(this.times=e,this.values=t),this}clone(){let e=Ct.arraySlice(this.times,0),t=Ct.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};yi.prototype.TimeBufferType=Float32Array;yi.prototype.ValueBufferType=Float32Array;yi.prototype.DefaultInterpolation=Uu;Lo=class extends yi{};Lo.prototype.ValueTypeName="bool";Lo.prototype.ValueBufferType=Array;Lo.prototype.DefaultInterpolation=Iu;Lo.prototype.InterpolantFactoryMethodLinear=void 0;Lo.prototype.InterpolantFactoryMethodSmooth=void 0;Pp=class extends yi{};Pp.prototype.ValueTypeName="color";wl=class extends yi{};wl.prototype.ValueTypeName="number";f1=class extends $i{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t),u=e*a;for(let c=u+a;u!==c;u+=4)ot.slerpFlat(o,0,s,u-a,s,u,l);return o}},Ls=class extends yi{InterpolantFactoryMethodLinear(e){return new f1(this.times,this.values,this.getValueSize(),e)}};Ls.prototype.ValueTypeName="quaternion";Ls.prototype.DefaultInterpolation=Uu;Ls.prototype.InterpolantFactoryMethodSmooth=void 0;Ao=class extends yi{};Ao.prototype.ValueTypeName="string";Ao.prototype.ValueBufferType=Array;Ao.prototype.DefaultInterpolation=Iu;Ao.prototype.InterpolantFactoryMethodLinear=void 0;Ao.prototype.InterpolantFactoryMethodSmooth=void 0;bl=class extends yi{};bl.prototype.ValueTypeName="vector";Sl=class{constructor(e,t=-1,n,i=Df){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=oi(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,i=1/(e.fps||1);for(let s=0,a=n.length;s!==a;++s)t.push(MF(n[s]).scale(i));let o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}static toJSON(e){let t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let o=0,s=n.length;o!==s;++o)t.push(yi.toJSON(n[o]));return i}static CreateFromMorphTargetSequence(e,t,n,i){let o=t.length,s=[];for(let a=0;a<o;a++){let l=[],u=[];l.push((a+o-1)%o,a,(a+1)%o),u.push(0,1,0);let c=Ct.getKeyframeOrder(l);l=Ct.sortedArray(l,1,c),u=Ct.sortedArray(u,1,c),!i&&l[0]===0&&(l.push(o),u.push(u[0])),s.push(new wl(".morphTargetInfluences["+t[a].name+"]",l,u).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){let i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){let i={},o=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){let u=e[a],c=u.name.match(o);if(c&&c.length>1){let f=c[1],h=i[f];h||(i[f]=h=[]),h.push(u)}}let s=[];for(let a in i)s.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let n=function(f,h,p,d,g){if(p.length!==0){let x=[],y=[];Ct.flattenJSON(p,x,y,d),x.length!==0&&g.push(new f(h,x,y))}},i=[],o=e.name||"default",s=e.fps||30,a=e.blendMode,l=e.length||-1,u=e.hierarchy||[];for(let f=0;f<u.length;f++){let h=u[f].keys;if(!(!h||h.length===0))if(h[0].morphTargets){let p={},d;for(d=0;d<h.length;d++)if(h[d].morphTargets)for(let g=0;g<h[d].morphTargets.length;g++)p[h[d].morphTargets[g]]=-1;for(let g in p){let x=[],y=[];for(let m=0;m!==h[d].morphTargets.length;++m){let b=h[d];x.push(b.time),y.push(b.morphTarget===g?1:0)}i.push(new wl(".morphTargetInfluence["+g+"]",x,y))}l=p.length*(s||1)}else{let p=".bones["+t[f].name+"]";n(bl,p+".position",h,"pos",i),n(Ls,p+".quaternion",h,"rot",i),n(bl,p+".scale",h,"scl",i)}}return i.length===0?null:new this(o,l,i,a)}resetDuration(){let e=this.tracks,t=0;for(let n=0,i=e.length;n!==i;++n){let o=this.tracks[n];t=Math.max(t,o.times[o.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};As={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}},kp=class{constructor(e,t,n){let i=this,o=!1,s=0,a=0,l,u=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(c){a++,o===!1&&i.onStart!==void 0&&i.onStart(c,s,a),o=!0},this.itemEnd=function(c){s++,i.onProgress!==void 0&&i.onProgress(c,s,a),s===a&&(o=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(c){i.onError!==void 0&&i.onError(c)},this.resolveURL=function(c){return l?l(c):c},this.setURLModifier=function(c){return l=c,this},this.addHandler=function(c,f){return u.push(c,f),this},this.removeHandler=function(c){let f=u.indexOf(c);return f!==-1&&u.splice(f,2),this},this.getHandler=function(c){for(let f=0,h=u.length;f<h;f+=2){let p=u[f],d=u[f+1];if(p.global&&(p.lastIndex=0),p.test(c))return d}return null}}},AS=new kp,Mn=class{constructor(e){this.manager=e!==void 0?e:AS,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,o){n.load(e,i,t,o)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},Dr={},ki=class extends Mn{constructor(e){super(e)}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let o=As.get(e);if(o!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(o),this.manager.itemEnd(e)},0),o;if(Dr[e]!==void 0){Dr[e].push({onLoad:t,onProgress:n,onError:i});return}Dr[e]=[],Dr[e].push({onLoad:t,onProgress:n,onError:i});let s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});fetch(s).then(a=>{if(a.status===200||a.status===0){a.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received.");let l=Dr[e],u=a.body.getReader(),c=a.headers.get("Content-Length"),f=c?parseInt(c):0,h=f!==0,p=0;return new ReadableStream({start(d){g();function g(){u.read().then(({done:x,value:y})=>{if(x)d.close();else{p+=y.byteLength;let m=new ProgressEvent("progress",{lengthComputable:h,loaded:p,total:f});for(let b=0,w=l.length;b<w;b++){let D=l[b];D.onProgress&&D.onProgress(m)}d.enqueue(y),g()}})}}})}else throw Error(`fetch for "${a.url}" responded with ${a.status}: ${a.statusText}`)}).then(a=>{let l=new Response(a);switch(this.responseType){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,this.mimeType));case"json":return l.json();default:return l.text()}}).then(a=>{As.add(e,a);let l=Dr[e];delete Dr[e];for(let u=0,c=l.length;u<c;u++){let f=l[u];f.onLoad&&f.onLoad(a)}this.manager.itemEnd(e)}).catch(a=>{let l=Dr[e];delete Dr[e];for(let u=0,c=l.length;u<c;u++){let f=l[u];f.onError&&f.onError(a)}this.manager.itemError(e),this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},DS=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=new ki(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(a){try{t(o.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),o.manager.itemError(e)}},n,i)}parse(e){let t=[];for(let n=0;n<e.length;n++){let i=Sl.parse(e[n]);t.push(i)}return t}},ES=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=[],a=new hp,l=new ki(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(o.withCredentials);let u=0;function c(f){l.load(e[f],function(h){let p=o.parse(h,!0);s[f]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},u+=1,u===6&&(p.mipmapCount===1&&(a.minFilter=Kt),a.image=s,a.format=p.format,a.needsUpdate=!0,t&&t(a))},n,i)}if(Array.isArray(e))for(let f=0,h=e.length;f<h;++f)c(f);else l.load(e,function(f){let h=o.parse(f,!0);if(h.isCubemap){let p=h.mipmaps.length/h.mipmapCount;for(let d=0;d<p;d++){s[d]={mipmaps:[]};for(let g=0;g<h.mipmapCount;g++)s[d].mipmaps.push(h.mipmaps[d*h.mipmapCount+g]),s[d].format=h.format,s[d].width=h.width,s[d].height=h.height}a.image=s}else a.image.width=h.width,a.image.height=h.height,a.mipmaps=h.mipmaps;h.mipmapCount===1&&(a.minFilter=Kt),a.format=h.format,a.needsUpdate=!0,t&&t(a)},n,i);return a}},Ll=class extends Mn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let o=this,s=As.get(e);if(s!==void 0)return o.manager.itemStart(e),setTimeout(function(){t&&t(s),o.manager.itemEnd(e)},0),s;let a=Ff("img");function l(){c(),As.add(e,this),t&&t(this),o.manager.itemEnd(e)}function u(f){c(),i&&i(f),o.manager.itemError(e),o.manager.itemEnd(e)}function c(){a.removeEventListener("load",l,!1),a.removeEventListener("error",u,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",u,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),o.manager.itemStart(e),a.src=e,a}},p1=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=new ps,s=new Ll(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function l(u){s.load(e[u],function(c){o.images[u]=c,a++,a===6&&(o.needsUpdate=!0,t&&t(o))},void 0,i)}for(let u=0;u<e.length;++u)l(u);return o}},d1=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=new vo,a=new ki(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(o.withCredentials),a.load(e,function(l){let u=o.parse(l);!u||(u.image!==void 0?s.image=u.image:u.data!==void 0&&(s.image.width=u.width,s.image.height=u.height,s.image.data=u.data),s.wrapS=u.wrapS!==void 0?u.wrapS:mn,s.wrapT=u.wrapT!==void 0?u.wrapT:mn,s.magFilter=u.magFilter!==void 0?u.magFilter:Kt,s.minFilter=u.minFilter!==void 0?u.minFilter:Kt,s.anisotropy=u.anisotropy!==void 0?u.anisotropy:1,u.encoding!==void 0&&(s.encoding=u.encoding),u.flipY!==void 0&&(s.flipY=u.flipY),u.format!==void 0&&(s.format=u.format),u.type!==void 0&&(s.type=u.type),u.mipmaps!==void 0&&(s.mipmaps=u.mipmaps,s.minFilter=is),u.mipmapCount===1&&(s.minFilter=Kt),u.generateMipmaps!==void 0&&(s.generateMipmaps=u.generateMipmaps),s.needsUpdate=!0,t&&t(s,u))},n,i),s}},Lc=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=new Yt,s=new Ll(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(a){o.image=a,o.needsUpdate=!0,t!==void 0&&t(o)},n,i),o}},vi=class extends je{constructor(e,t=1){super();this.type="Light",this.color=new xe(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};vi.prototype.isLight=!0;Bp=class extends vi{constructor(e,t,n){super(e,n);this.type="HemisphereLight",this.position.copy(je.DefaultUp),this.updateMatrix(),this.groundColor=new xe(t)}copy(e){return vi.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};Bp.prototype.isHemisphereLight=!0;MS=new Ae,RS=new M,TS=new M,zp=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ee(512,512),this.map=null,this.mapPass=null,this.matrix=new Ae,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Qa,this._frameExtents=new ee(1,1),this._viewportCount=1,this._viewports=[new xt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;RS.setFromMatrixPosition(e.matrixWorld),t.position.copy(RS),TS.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(TS),t.updateMatrixWorld(),MS.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(MS),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},m1=class extends zp{constructor(){super(new Gt(50,1,.5,500));this.focus=1}updateMatrices(e){let t=this.camera,n=Gu*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,o=e.distance||t.far;(n!==t.fov||i!==t.aspect||o!==t.far)&&(t.fov=n,t.aspect=i,t.far=o,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};m1.prototype.isSpotLightShadow=!0;Ip=class extends vi{constructor(e,t,n=0,i=Math.PI/3,o=0,s=1){super(e,t);this.type="SpotLight",this.position.copy(je.DefaultUp),this.updateMatrix(),this.target=new je,this.distance=n,this.angle=i,this.penumbra=o,this.decay=s,this.shadow=new m1}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};Ip.prototype.isSpotLight=!0;FS=new Ae,Ac=new M,g1=new M,y1=class extends zp{constructor(){super(new Gt(90,1,.5,500));this._frameExtents=new ee(4,2),this._viewportCount=6,this._viewports=[new xt(2,1,1,1),new xt(0,1,1,1),new xt(3,1,1,1),new xt(1,1,1,1),new xt(3,0,1,1),new xt(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,i=this.matrix,o=e.distance||n.far;o!==n.far&&(n.far=o,n.updateProjectionMatrix()),Ac.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ac),g1.copy(n.position),g1.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(g1),n.updateMatrixWorld(),i.makeTranslation(-Ac.x,-Ac.y,-Ac.z),FS.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(FS)}};y1.prototype.isPointLightShadow=!0;Up=class extends vi{constructor(e,t,n=0,i=1){super(e,t);this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new y1}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}};Up.prototype.isPointLight=!0;v1=class extends zp{constructor(){super(new Ya(-5,5,5,-5,.5,500))}};v1.prototype.isDirectionalLightShadow=!0;Np=class extends vi{constructor(e,t){super(e,t);this.type="DirectionalLight",this.position.copy(je.DefaultUp),this.updateMatrix(),this.target=new je,this.shadow=new v1}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};Np.prototype.isDirectionalLight=!0;Op=class extends vi{constructor(e,t){super(e,t);this.type="AmbientLight"}};Op.prototype.isAmbientLight=!0;Gp=class extends vi{constructor(e,t,n=10,i=10){super(e,t);this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};Gp.prototype.isRectAreaLight=!0;Wp=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new M)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,i=e.y,o=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScaledVector(s[1],.488603*i),t.addScaledVector(s[2],.488603*o),t.addScaledVector(s[3],.488603*n),t.addScaledVector(s[4],1.092548*(n*i)),t.addScaledVector(s[5],1.092548*(i*o)),t.addScaledVector(s[6],.315392*(3*o*o-1)),t.addScaledVector(s[7],1.092548*(n*o)),t.addScaledVector(s[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){let n=e.x,i=e.y,o=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScaledVector(s[1],2*.511664*i),t.addScaledVector(s[2],2*.511664*o),t.addScaledVector(s[3],2*.511664*n),t.addScaledVector(s[4],2*.429043*n*i),t.addScaledVector(s[5],2*.429043*i*o),t.addScaledVector(s[6],.743125*o*o-.247708),t.addScaledVector(s[7],2*.429043*n*o),t.addScaledVector(s[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){let n=e.x,i=e.y,o=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*o,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*o,t[6]=.315392*(3*o*o-1),t[7]=1.092548*n*o,t[8]=.546274*(n*n-i*i)}};Wp.prototype.isSphericalHarmonics3=!0;Al=class extends vi{constructor(e=new Wp,t=1){super(void 0,t);this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};Al.prototype.isLightProbe=!0;x1=class extends Mn{constructor(e){super(e);this.textures={}}load(e,t,n,i){let o=this,s=new ki(o.manager);s.setPath(o.path),s.setRequestHeader(o.requestHeader),s.setWithCredentials(o.withCredentials),s.load(e,function(a){try{t(o.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),o.manager.itemError(e)}},n,i)}parse(e){let t=this.textures;function n(o){return t[o]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",o),t[o]}let i=new DF[e.type];if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new xe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.format!==void 0&&(i.format=e.format),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==1&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(let o in e.uniforms){let s=e.uniforms[o];switch(i.uniforms[o]={},s.type){case"t":i.uniforms[o].value=n(s.value);break;case"c":i.uniforms[o].value=new xe().setHex(s.value);break;case"v2":i.uniforms[o].value=new ee().fromArray(s.value);break;case"v3":i.uniforms[o].value=new M().fromArray(s.value);break;case"v4":i.uniforms[o].value=new xt().fromArray(s.value);break;case"m3":i.uniforms[o].value=new Qt().fromArray(s.value);break;case"m4":i.uniforms[o].value=new Ae().fromArray(s.value);break;default:i.uniforms[o].value=s.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(let o in e.extensions)i.extensions[o]=e.extensions[o];if(e.shading!==void 0&&(i.flatShading=e.shading===1),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let o=e.normalScale;Array.isArray(o)===!1&&(o=[o,o]),i.normalScale=new ee().fromArray(o)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ee().fromArray(e.clearcoatNormalScale)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}},Dc=class{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(n){return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},Vp=class extends Pe{constructor(){super();this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){let e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};Vp.prototype.isInstancedBufferGeometry=!0;w1=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=new ki(o.manager);s.setPath(o.path),s.setRequestHeader(o.requestHeader),s.setWithCredentials(o.withCredentials),s.load(e,function(a){try{t(o.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),o.manager.itemError(e)}},n,i)}parse(e){let t={},n={};function i(p,d){if(t[d]!==void 0)return t[d];let x=p.interleavedBuffers[d],y=o(p,x.buffer),m=_a(x.type,y),b=new yo(m,x.stride);return b.uuid=x.uuid,t[d]=b,b}function o(p,d){if(n[d]!==void 0)return n[d];let x=p.arrayBuffers[d],y=new Uint32Array(x).buffer;return n[d]=y,y}let s=e.isInstancedBufferGeometry?new Vp:new Pe,a=e.data.index;if(a!==void 0){let p=_a(a.type,a.array);s.setIndex(new qe(p,1))}let l=e.data.attributes;for(let p in l){let d=l[p],g;if(d.isInterleavedBufferAttribute){let x=i(e.data,d.data);g=new Ar(x,d.itemSize,d.offset,d.normalized)}else{let x=_a(d.type,d.array),y=d.isInstancedBufferAttribute?xo:qe;g=new y(x,d.itemSize,d.normalized)}d.name!==void 0&&(g.name=d.name),d.usage!==void 0&&g.setUsage(d.usage),d.updateRange!==void 0&&(g.updateRange.offset=d.updateRange.offset,g.updateRange.count=d.updateRange.count),s.setAttribute(p,g)}let u=e.data.morphAttributes;if(u)for(let p in u){let d=u[p],g=[];for(let x=0,y=d.length;x<y;x++){let m=d[x],b;if(m.isInterleavedBufferAttribute){let w=i(e.data,m.data);b=new Ar(w,m.itemSize,m.offset,m.normalized)}else{let w=_a(m.type,m.array);b=new qe(w,m.itemSize,m.normalized)}m.name!==void 0&&(b.name=m.name),g.push(b)}s.morphAttributes[p]=g}e.data.morphTargetsRelative&&(s.morphTargetsRelative=!0);let f=e.data.groups||e.data.drawcalls||e.data.offsets;if(f!==void 0)for(let p=0,d=f.length;p!==d;++p){let g=f[p];s.addGroup(g.start,g.count,g.materialIndex)}let h=e.data.boundingSphere;if(h!==void 0){let p=new M;h.center!==void 0&&p.fromArray(h.center),s.boundingSphere=new vr(p,h.radius)}return e.name&&(s.name=e.name),e.userData&&(s.userData=e.userData),s}},_S=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=this.path===""?Dc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;let a=new ki(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let u=null;try{u=JSON.parse(l)}catch(f){i!==void 0&&i(f),console.error("THREE:ObjectLoader: Can't parse "+e+".",f.message);return}let c=u.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}o.parse(u,t)},n,i)}async loadAsync(e,t){let n=this,i=this.path===""?Dc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;let o=new ki(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials);let s=await o.loadAsync(e,t),a=JSON.parse(s),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(a)}parse(e,t){let n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),o=this.parseGeometries(e.geometries,i),s=this.parseImages(e.images,function(){t!==void 0&&t(u)}),a=this.parseTextures(e.textures,s),l=this.parseMaterials(e.materials,a),u=this.parseObject(e.object,o,l,a,n),c=this.parseSkeletons(e.skeletons,u);if(this.bindSkeletons(u,c),t!==void 0){let f=!1;for(let h in s)if(s[h]instanceof HTMLImageElement){f=!0;break}f===!1&&t(u)}return u}async parseAsync(e){let t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),o=await this.parseImagesAsync(e.images),s=this.parseTextures(e.textures,o),a=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,i,a,s,t),u=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,u),l}parseShapes(e){let t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){let o=new Ci().fromJSON(e[n]);t[o.uuid]=o}return t}parseSkeletons(e,t){let n={},i={};if(t.traverse(function(o){o.isBone&&(i[o.uuid]=o)}),e!==void 0)for(let o=0,s=e.length;o<s;o++){let a=new hc().fromJSON(e[o],i);n[a.uuid]=a}return n}parseGeometries(e,t){let n={};if(e!==void 0){let i=new w1;for(let o=0,s=e.length;o<s;o++){let a,l=e[o];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:l.type in LS?a=LS[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),a.isBufferGeometry===!0&&l.userData!==void 0&&(a.userData=l.userData),n[l.uuid]=a}}return n}parseMaterials(e,t){let n={},i={};if(e!==void 0){let o=new x1;o.setTextures(t);for(let s=0,a=e.length;s<a;s++){let l=e[s];if(l.type==="MultiMaterial"){let u=[];for(let c=0;c<l.materials.length;c++){let f=l.materials[c];n[f.uuid]===void 0&&(n[f.uuid]=o.parse(f)),u.push(n[f.uuid])}i[l.uuid]=u}else n[l.uuid]===void 0&&(n[l.uuid]=o.parse(l)),i[l.uuid]=n[l.uuid]}}return i}parseAnimations(e){let t={};if(e!==void 0)for(let n=0;n<e.length;n++){let i=e[n],o=Sl.parse(i);t[o.uuid]=o}return t}parseImages(e,t){let n=this,i={},o;function s(l){return n.manager.itemStart(l),o.load(l,function(){n.manager.itemEnd(l)},void 0,function(){n.manager.itemError(l),n.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){let u=l,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(u)?u:n.resourcePath+u;return s(c)}else return l.data?{data:_a(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){let l=new kp(t);o=new Ll(l),o.setCrossOrigin(this.crossOrigin);for(let u=0,c=e.length;u<c;u++){let f=e[u],h=f.url;if(Array.isArray(h)){i[f.uuid]=[];for(let p=0,d=h.length;p<d;p++){let g=h[p],x=a(g);x!==null&&(x instanceof HTMLImageElement?i[f.uuid].push(x):i[f.uuid].push(new vo(x.data,x.width,x.height)))}}else{let p=a(f.url);p!==null&&(i[f.uuid]=p)}}}return i}async parseImagesAsync(e){let t=this,n={},i;async function o(s){if(typeof s=="string"){let a=s,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await i.loadAsync(l)}else return s.data?{data:_a(s.type,s.data),width:s.width,height:s.height}:null}if(e!==void 0&&e.length>0){i=new Ll(this.manager),i.setCrossOrigin(this.crossOrigin);for(let s=0,a=e.length;s<a;s++){let l=e[s],u=l.url;if(Array.isArray(u)){n[l.uuid]=[];for(let c=0,f=u.length;c<f;c++){let h=u[c],p=await o(h);p!==null&&(p instanceof HTMLImageElement?n[l.uuid].push(p):n[l.uuid].push(new vo(p.data,p.width,p.height)))}}else{let c=await o(l.url);c!==null&&(n[l.uuid]=c)}}}return n}parseTextures(e,t){function n(o,s){return typeof o=="number"?o:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",o),s[o])}let i={};if(e!==void 0)for(let o=0,s=e.length;o<s;o++){let a=e[o];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);let l,u=t[a.image];Array.isArray(u)?(l=new ps(u),u.length===6&&(l.needsUpdate=!0)):(u&&u.data?l=new vo(u.data,u.width,u.height):l=new Yt(u),u&&(l.needsUpdate=!0)),l.uuid=a.uuid,a.name!==void 0&&(l.name=a.name),a.mapping!==void 0&&(l.mapping=n(a.mapping,RF)),a.offset!==void 0&&l.offset.fromArray(a.offset),a.repeat!==void 0&&l.repeat.fromArray(a.repeat),a.center!==void 0&&l.center.fromArray(a.center),a.rotation!==void 0&&(l.rotation=a.rotation),a.wrap!==void 0&&(l.wrapS=n(a.wrap[0],CS),l.wrapT=n(a.wrap[1],CS)),a.format!==void 0&&(l.format=a.format),a.type!==void 0&&(l.type=a.type),a.encoding!==void 0&&(l.encoding=a.encoding),a.minFilter!==void 0&&(l.minFilter=n(a.minFilter,PS)),a.magFilter!==void 0&&(l.magFilter=n(a.magFilter,PS)),a.anisotropy!==void 0&&(l.anisotropy=a.anisotropy),a.flipY!==void 0&&(l.flipY=a.flipY),a.premultiplyAlpha!==void 0&&(l.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(l.unpackAlignment=a.unpackAlignment),a.userData!==void 0&&(l.userData=a.userData),i[a.uuid]=l}return i}parseObject(e,t,n,i,o){let s;function a(h){return t[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",h),t[h]}function l(h){if(h!==void 0){if(Array.isArray(h)){let p=[];for(let d=0,g=h.length;d<g;d++){let x=h[d];n[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),p.push(n[x])}return p}return n[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",h),n[h]}}function u(h){return i[h]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",h),i[h]}let c,f;switch(e.type){case"Scene":s=new xs,e.background!==void 0&&(Number.isInteger(e.background)?s.background=new xe(e.background):s.background=u(e.background)),e.environment!==void 0&&(s.environment=u(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?s.fog=new el(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(s.fog=new $a(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":s=new Gt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(s.focus=e.focus),e.zoom!==void 0&&(s.zoom=e.zoom),e.filmGauge!==void 0&&(s.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(s.filmOffset=e.filmOffset),e.view!==void 0&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new Ya(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(s.zoom=e.zoom),e.view!==void 0&&(s.view=Object.assign({},e.view));break;case"AmbientLight":s=new Op(e.color,e.intensity);break;case"DirectionalLight":s=new Np(e.color,e.intensity);break;case"PointLight":s=new Up(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new Gp(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new Ip(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":s=new Bp(e.color,e.groundColor,e.intensity);break;case"LightProbe":s=new Al().fromJSON(e);break;case"SkinnedMesh":c=a(e.geometry),f=l(e.material),s=new uc(c,f),e.bindMode!==void 0&&(s.bindMode=e.bindMode),e.bindMatrix!==void 0&&s.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(s.skeleton=e.skeleton);break;case"Mesh":c=a(e.geometry),f=l(e.material),s=new Lt(c,f);break;case"InstancedMesh":c=a(e.geometry),f=l(e.material);let h=e.count,p=e.instanceMatrix,d=e.instanceColor;s=new sp(c,f,h),s.instanceMatrix=new xo(new Float32Array(p.array),16),d!==void 0&&(s.instanceColor=new xo(new Float32Array(d.array),d.itemSize));break;case"LOD":s=new Xg;break;case"Line":s=new Ki(a(e.geometry),l(e.material));break;case"LineLoop":s=new lp(a(e.geometry),l(e.material));break;case"LineSegments":s=new Bn(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":s=new ol(a(e.geometry),l(e.material));break;case"Sprite":s=new lc(l(e.material));break;case"Group":s=new gi;break;case"Bone":s=new cc;break;default:s=new je}if(s.uuid=e.uuid,e.name!==void 0&&(s.name=e.name),e.matrix!==void 0?(s.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(s.matrixAutoUpdate=e.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(e.position!==void 0&&s.position.fromArray(e.position),e.rotation!==void 0&&s.rotation.fromArray(e.rotation),e.quaternion!==void 0&&s.quaternion.fromArray(e.quaternion),e.scale!==void 0&&s.scale.fromArray(e.scale)),e.castShadow!==void 0&&(s.castShadow=e.castShadow),e.receiveShadow!==void 0&&(s.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(s.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(s.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(s.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&s.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(s.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(s.visible=e.visible),e.frustumCulled!==void 0&&(s.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(s.renderOrder=e.renderOrder),e.userData!==void 0&&(s.userData=e.userData),e.layers!==void 0&&(s.layers.mask=e.layers),e.children!==void 0){let h=e.children;for(let p=0;p<h.length;p++)s.add(this.parseObject(h[p],t,n,i,o))}if(e.animations!==void 0){let h=e.animations;for(let p=0;p<h.length;p++){let d=h[p];s.animations.push(o[d])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(s.autoUpdate=e.autoUpdate);let h=e.levels;for(let p=0;p<h.length;p++){let d=h[p],g=s.getObjectByProperty("uuid",d.object);g!==void 0&&s.addLevel(g,d.distance)}}return s}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){let i=t[n.skeleton];i===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}},RF={UVMapping:bf,CubeReflectionMapping:ts,CubeRefractionMapping:ns,EquirectangularReflectionMapping:_u,EquirectangularRefractionMapping:Cu,CubeUVReflectionMapping:Ma,CubeUVRefractionMapping:Pu},CS={RepeatWrapping:ku,ClampToEdgeWrapping:mn,MirroredRepeatWrapping:Bu},PS={NearestFilter:jt,NearestMipmapNearestFilter:Sf,NearestMipmapLinearFilter:Lf,LinearFilter:Kt,LinearMipmapNearestFilter:q0,LinearMipmapLinearFilter:is},b1=class extends Mn{constructor(e){super(e);typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let o=this,s=As.get(e);if(s!==void 0)return o.manager.itemStart(e),setTimeout(function(){t&&t(s),o.manager.itemEnd(e)},0),s;let a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(o.options,{colorSpaceConversion:"none"}))}).then(function(l){As.add(e,l),t&&t(l),o.manager.itemEnd(e)}).catch(function(l){i&&i(l),o.manager.itemError(e),o.manager.itemEnd(e)}),o.manager.itemStart(e)}};b1.prototype.isImageBitmapLoader=!0;S1={getContext:function(){return Hp===void 0&&(Hp=new(window.AudioContext||window.webkitAudioContext)),Hp},setContext:function(r){Hp=r}},L1=class extends Mn{constructor(e){super(e)}load(e,t,n,i){let o=this,s=new ki(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(a){try{let l=a.slice(0);S1.getContext().decodeAudioData(l,function(c){t(c)})}catch(l){i?i(l):console.error(l),o.manager.itemError(e)}},n,i)}},A1=class extends Al{constructor(e,t,n=1){super(void 0,n);let i=new xe().set(e),o=new xe().set(t),s=new M(i.r,i.g,i.b),a=new M(o.r,o.g,o.b),l=Math.sqrt(Math.PI),u=l*Math.sqrt(.75);this.sh.coefficients[0].copy(s).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(s).sub(a).multiplyScalar(u)}};A1.prototype.isHemisphereLightProbe=!0;D1=class extends Al{constructor(e,t=1){super(void 0,t);let n=new xe().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}};D1.prototype.isAmbientLightProbe=!0;kS=new Ae,BS=new Ae,Ds=new Ae,zS=class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Gt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Gt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){let t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Ds.copy(e.projectionMatrix);let i=t.eyeSep/2,o=i*t.near/t.focus,s=t.near*Math.tan(cs*t.fov*.5)/t.zoom,a,l;BS.elements[12]=-i,kS.elements[12]=i,a=-s*t.aspect+o,l=s*t.aspect+o,Ds.elements[0]=2*t.near/(l-a),Ds.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Ds),a=-s*t.aspect-o,l=s*t.aspect-o,Ds.elements[0]=2*t.near/(l-a),Ds.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Ds)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(BS),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(kS)}},E1=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=IS(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=IS();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};Es=new M,US=new ot,TF=new M,Ms=new M,NS=class extends je{constructor(){super();this.type="AudioListener",this.context=S1.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new E1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Es,US,TF),Ms.set(0,0,-1).applyQuaternion(US),t.positionX){let i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Es.x,i),t.positionY.linearRampToValueAtTime(Es.y,i),t.positionZ.linearRampToValueAtTime(Es.z,i),t.forwardX.linearRampToValueAtTime(Ms.x,i),t.forwardY.linearRampToValueAtTime(Ms.y,i),t.forwardZ.linearRampToValueAtTime(Ms.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Es.x,Es.y,Es.z),t.setOrientation(Ms.x,Ms.y,Ms.z,n.x,n.y,n.z)}},qp=class extends je{constructor(e){super();this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}},Rs=new M,OS=new ot,FF=new M,Ts=new M,GS=class extends qp{constructor(e){super(e);this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Rs,OS,FF),Ts.set(0,0,1).applyQuaternion(OS);let t=this.panner;if(t.positionX){let n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Rs.x,n),t.positionY.linearRampToValueAtTime(Rs.y,n),t.positionZ.linearRampToValueAtTime(Rs.z,n),t.orientationX.linearRampToValueAtTime(Ts.x,n),t.orientationY.linearRampToValueAtTime(Ts.y,n),t.orientationZ.linearRampToValueAtTime(Ts.z,n)}else t.setPosition(Rs.x,Rs.y,Rs.z),t.setOrientation(Ts.x,Ts.y,Ts.z)}},M1=class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}},R1=class{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,o,s;switch(t){case"quaternion":i=this._slerp,o=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,o=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,o=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=o,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let n=this.buffer,i=this.valueSize,o=e*i+i,s=this.cumulativeWeight;if(s===0){for(let a=0;a!==i;++a)n[o+a]=n[a];s=t}else{s+=t;let a=t/s;this._mixBufferRegion(n,o,0,a,i)}this.cumulativeWeight=s}accumulateAdditive(e){let t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,n=this.buffer,i=e*t+t,o=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,o<1){let l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-o,t)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,u=t+t;l!==u;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let o=n,s=i;o!==s;++o)t[o]=t[i+o%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,o){if(i>=.5)for(let s=0;s!==o;++s)e[t+s]=e[n+s]}_slerp(e,t,n,i){ot.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,o){let s=this._workIndex*o;ot.multiplyQuaternionsFlat(e,s,e,t,e,n),ot.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,o){let s=1-i;for(let a=0;a!==o;++a){let l=t+a;e[l]=e[l]*s+e[n+a]*i}}_lerpAdditive(e,t,n,i,o){for(let s=0;s!==o;++s){let a=t+s;e[a]=e[a]+e[n+s]*i}}},T1="\\[\\]\\.:\\/",_F=new RegExp("["+T1+"]","g"),F1="[^"+T1+"]",CF="[^"+T1.replace("\\.","")+"]",PF=/((?:WC+[\/:])*)/.source.replace("WC",F1),kF=/(WCOD+)?/.source.replace("WCOD",CF),BF=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",F1),zF=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",F1),IF=new RegExp("^"+PF+kF+BF+zF+"$"),UF=["material","materials","bones"],WS=class{constructor(e,t,n){let i=n||ut.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},ut=class{constructor(e,t,n){this.path=t,this.parsedPath=n||ut.parseTrackName(t),this.node=ut.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new ut.Composite(e,t,n):new ut(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(_F,"")}static parseTrackName(e){let t=IF.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let o=n.nodeName.substring(i+1);UF.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(o){for(let s=0;s<o.length;s++){let a=o[s];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,o=n.length;i!==o;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,o=t.propertyIndex;if(e||(e=ut.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let u=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let c=0;c<e.length;c++)if(e[c].name===u){u=c;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(u!==void 0){if(e[u]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[u]}}let s=e[i];if(s===void 0){let u=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+u+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(o!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[o]!==void 0&&(o=e.morphTargetDictionary[o])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=o}else s.fromArray!==void 0&&s.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ut.Composite=WS;ut.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ut.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ut.prototype.GetterByBindingType=[ut.prototype._getValue_direct,ut.prototype._getValue_array,ut.prototype._getValue_arrayElement,ut.prototype._getValue_toArray];ut.prototype.SetterByBindingTypeAndVersioning=[[ut.prototype._setValue_direct,ut.prototype._setValue_direct_setNeedsUpdate,ut.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ut.prototype._setValue_array,ut.prototype._setValue_array_setNeedsUpdate,ut.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ut.prototype._setValue_arrayElement,ut.prototype._setValue_arrayElement_setNeedsUpdate,ut.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ut.prototype._setValue_fromArray,ut.prototype._setValue_fromArray_setNeedsUpdate,ut.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];_1=class{constructor(){this.uuid=oi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){let e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,o=this._bindings,s=o.length,a,l=e.length,u=this.nCachedObjects_;for(let c=0,f=arguments.length;c!==f;++c){let h=arguments[c],p=h.uuid,d=t[p];if(d===void 0){d=l++,t[p]=d,e.push(h);for(let g=0,x=s;g!==x;++g)o[g].push(new ut(h,n[g],i[g]))}else if(d<u){a=e[d];let g=--u,x=e[g];t[x.uuid]=d,e[d]=x,t[p]=g,e[g]=h;for(let y=0,m=s;y!==m;++y){let b=o[y],w=b[g],D=b[d];b[d]=w,D===void 0&&(D=new ut(h,n[y],i[y])),b[g]=D}}else e[d]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=u}remove(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,o=this.nCachedObjects_;for(let s=0,a=arguments.length;s!==a;++s){let l=arguments[s],u=l.uuid,c=t[u];if(c!==void 0&&c>=o){let f=o++,h=e[f];t[h.uuid]=c,e[c]=h,t[u]=f,e[f]=l;for(let p=0,d=i;p!==d;++p){let g=n[p],x=g[f],y=g[c];g[c]=x,g[f]=y}}}this.nCachedObjects_=o}uncache(){let e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,o=this.nCachedObjects_,s=e.length;for(let a=0,l=arguments.length;a!==l;++a){let u=arguments[a],c=u.uuid,f=t[c];if(f!==void 0)if(delete t[c],f<o){let h=--o,p=e[h],d=--s,g=e[d];t[p.uuid]=f,e[f]=p,t[g.uuid]=h,e[h]=g,e.pop();for(let x=0,y=i;x!==y;++x){let m=n[x],b=m[h],w=m[d];m[f]=b,m[h]=w,m.pop()}}else{let h=--s,p=e[h];h>0&&(t[p.uuid]=f),e[f]=p,e.pop();for(let d=0,g=i;d!==g;++d){let x=n[d];x[f]=x[h],x.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){let n=this._bindingsIndicesByPath,i=n[e],o=this._bindings;if(i!==void 0)return o[i];let s=this._paths,a=this._parsedPaths,l=this._objects,u=l.length,c=this.nCachedObjects_,f=new Array(u);i=o.length,n[e]=i,s.push(e),a.push(t),o.push(f);for(let h=c,p=l.length;h!==p;++h){let d=l[h];f[h]=new ut(d,e,t)}return f}unsubscribe_(e){let t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){let i=this._paths,o=this._parsedPaths,s=this._bindings,a=s.length-1,l=s[a],u=e[a];t[u]=n,s[n]=l,s.pop(),o[n]=o[a],o.pop(),i[n]=i[a],i.pop()}}};_1.prototype.isAnimationObjectGroup=!0;VS=class{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;let o=t.tracks,s=o.length,a=new Array(s),l={endingStart:as,endingEnd:as};for(let u=0;u!==s;++u){let c=o[u].createInterpolant(null);a[u]=c,c.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qb,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){let i=this._clip.duration,o=e._clip.duration,s=o/i,a=i/o;e.warp(1,s,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){let i=this._mixer,o=i.time,s=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,u=a.sampleValues;return l[0]=o,l[1]=o+n,u[0]=e/s,u[1]=t/s,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}let o=this._startTime;if(o!==null){let l=(e-o)*n;if(l<0||n===0)return;this._startTime=null,t=n*l}t*=this._updateTimeScale(e);let s=this._updateTime(t),a=this._updateWeight(e);if(a>0){let l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case ng:for(let c=0,f=l.length;c!==f;++c)l[c].evaluate(s),u[c].accumulateAdditive(a);break;case Df:default:for(let c=0,f=l.length;c!==f;++c)l[c].evaluate(s),u[c].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let n=this._weightInterpolant;if(n!==null){let i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let n=this._timeScaleInterpolant;n!==null&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,n=this.loop,i=this.time+e,o=this._loopCount,s=n===jb;if(e===0)return o===-1?i:s&&(o&1)==1?t-i:i;if(n===Hb){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,s)):this._setEndings(this.repetitions===0,!0,s)),i>=t||i<0){let a=Math.floor(i/t);i-=t*a,o+=Math.abs(a);let l=this.repetitions-o;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let u=e<0;this._setEndings(u,!u,s)}else this._setEndings(!1,!1,s);this._loopCount=o,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(s&&(o&1)==1)return t-i}return i}_setEndings(e,t,n){let i=this._interpolantSettings;n?(i.endingStart=ls,i.endingEnd=ls):(e?i.endingStart=this.zeroSlopeAtStart?ls:as:i.endingStart=Nu,t?i.endingEnd=this.zeroSlopeAtEnd?ls:as:i.endingEnd=Nu)}_scheduleFading(e,t,n){let i=this._mixer,o=i.time,s=this._weightInterpolant;s===null&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);let a=s.parameterPositions,l=s.sampleValues;return a[0]=o,l[0]=t,a[1]=o+e,l[1]=n,this}},C1=class extends gr{constructor(e){super();this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let n=e._localRoot||this._root,i=e._clip.tracks,o=i.length,s=e._propertyBindings,a=e._interpolants,l=n.uuid,u=this._bindingsByRootAndName,c=u[l];c===void 0&&(c={},u[l]=c);for(let f=0;f!==o;++f){let h=i[f],p=h.name,d=c[p];if(d!==void 0)s[f]=d;else{if(d=s[f],d!==void 0){d._cacheIndex===null&&(++d.referenceCount,this._addInactiveBinding(d,l,p));continue}let g=t&&t._propertyBindings[f].binding.parsedPath;d=new R1(ut.create(n,p,g),h.ValueTypeName,h.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,l,p),s[f]=d}a[f].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let n=(e._localRoot||this._root).uuid,i=e._clip.uuid,o=this._actionsByClip[i];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,i,n)}let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let o=t[n];o.useCount++==0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let o=t[n];--o.useCount==0&&(o.restoreOriginalState(),this._takeBackBinding(o))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){let i=this._actions,o=this._actionsByClip,s=o[t];if(s===void 0)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,o[t]=s;else{let a=s.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){let t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;let o=e._clip.uuid,s=this._actionsByClip,a=s[o],l=a.knownActions,u=l[l.length-1],c=e._byClipCacheIndex;u._byClipCacheIndex=c,l[c]=u,l.pop(),e._byClipCacheIndex=null;let f=a.actionByRoot,h=(e._localRoot||this._root).uuid;delete f[h],l.length===0&&delete s[o],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){let o=t[n];--o.referenceCount==0&&this._removeInactiveBinding(o)}}_lendAction(e){let t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_takeBackAction(e){let t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_addInactiveBinding(e,t,n){let i=this._bindingsByRootAndName,o=this._bindings,s=i[t];s===void 0&&(s={},i[t]=s),s[n]=e,e._cacheIndex=o.length,o.push(e)}_removeInactiveBinding(e){let t=this._bindings,n=e.binding,i=n.rootNode.uuid,o=n.path,s=this._bindingsByRootAndName,a=s[i],l=t[t.length-1],u=e._cacheIndex;l._cacheIndex=u,t[u]=l,t.pop(),delete a[o],Object.keys(a).length===0&&delete s[i]}_lendBinding(e){let t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_takeBackBinding(e){let t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,o=t[i];e._cacheIndex=i,t[i]=e,o._cacheIndex=n,t[n]=o}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new Cp(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){let t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,o=t[i];e.__cacheIndex=i,t[i]=e,o.__cacheIndex=n,t[n]=o}clipAction(e,t,n){let i=t||this._root,o=i.uuid,s=typeof e=="string"?Sl.findByName(i,e):e,a=s!==null?s.uuid:e,l=this._actionsByClip[a],u=null;if(n===void 0&&(s!==null?n=s.blendMode:n=Df),l!==void 0){let f=l.actionByRoot[o];if(f!==void 0&&f.blendMode===n)return f;u=l.knownActions[0],s===null&&(s=u._clip)}if(s===null)return null;let c=new VS(this,s,t,n);return this._bindAction(c,u),this._addInactiveAction(c,a,o),c}existingAction(e,t){let n=t||this._root,i=n.uuid,o=typeof e=="string"?Sl.findByName(n,e):e,s=o?o.uuid:e,a=this._actionsByClip[s];return a!==void 0&&a.actionByRoot[i]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;let t=this._actions,n=this._nActiveActions,i=this.time+=e,o=Math.sign(e),s=this._accuIndex^=1;for(let u=0;u!==n;++u)t[u]._update(i,e,o,s);let a=this._bindings,l=this._nActiveBindings;for(let u=0;u!==l;++u)a[u].apply(s);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,n=e.uuid,i=this._actionsByClip,o=i[n];if(o!==void 0){let s=o.knownActions;for(let a=0,l=s.length;a!==l;++a){let u=s[a];this._deactivateAction(u);let c=u._cacheIndex,f=t[t.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,f._cacheIndex=c,t[c]=f,t.pop(),this._removeInactiveBindingsForAction(u)}delete i[n]}}uncacheRoot(e){let t=e.uuid,n=this._actionsByClip;for(let s in n){let a=n[s].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let i=this._bindingsByRootAndName,o=i[t];if(o!==void 0)for(let s in o){let a=o[s];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}};C1.prototype._controlInterpolantsResultBuffer=new Float32Array(1);Ec=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Ec(this.value.clone===void 0?this.value:this.value.clone())}},P1=class extends yo{constructor(e,t,n=1){super(e,t);this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};P1.prototype.isInstancedInterleavedBuffer=!0;k1=class{constructor(e,t,n,i,o){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=o,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}};k1.prototype.isGLBufferAttribute=!0;HS=class{constructor(e,t,n=0,i=1/0){this.ray=new wr(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new zf,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return B1(e,this,n,t),n.sort(qS),n}intersectObjects(e,t=!0,n=[]){for(let i=0,o=e.length;i<o;i++)B1(e[i],this,n,t);return n.sort(qS),n}};Mc=class{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){let e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(vn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},jS=class{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}},QS=new ee,Fs=class{constructor(e=new ee(1/0,1/0),t=new ee(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=QS.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return QS.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};Fs.prototype.isBox2=!0;YS=new M,jp=new M,z1=class{constructor(e=new M,t=new M){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){YS.subVectors(e,this.start),jp.subVectors(this.end,this.start);let n=jp.dot(jp),o=jp.dot(YS)/n;return t&&(o=vn(o,0,1)),o}closestPointToPoint(e,t,n){let i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},XS=new M,KS=class extends je{constructor(e,t){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let n=new Pe,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let s=0,a=1,l=32;s<l;s++,a++){let u=s/l*Math.PI*2,c=a/l*Math.PI*2;i.push(Math.cos(u),Math.sin(u),1,Math.cos(c),Math.sin(c),1)}n.setAttribute("position",new Te(i,3));let o=new Jt({fog:!1,toneMapped:!1});this.cone=new Bn(n,o),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),XS.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(XS),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Do=new M,Qp=new Ae,I1=new Ae,U1=class extends Bn{constructor(e){let t=ZS(e),n=new Pe,i=[],o=[],s=new xe(0,0,1),a=new xe(0,1,0);for(let u=0;u<t.length;u++){let c=t[u];c.parent&&c.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),o.push(s.r,s.g,s.b),o.push(a.r,a.g,a.b))}n.setAttribute("position",new Te(i,3)),n.setAttribute("color",new Te(o,3));let l=new Jt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l);this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){let t=this.bones,n=this.geometry,i=n.getAttribute("position");I1.copy(this.root.matrixWorld).invert();for(let o=0,s=0;o<t.length;o++){let a=t[o];a.parent&&a.parent.isBone&&(Qp.multiplyMatrices(I1,a.matrixWorld),Do.setFromMatrixPosition(Qp),i.setXYZ(s,Do.x,Do.y,Do.z),Qp.multiplyMatrices(I1,a.parent.matrixWorld),Do.setFromMatrixPosition(Qp),i.setXYZ(s+1,Do.x,Do.y,Do.z),s+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};JS=class extends Lt{constructor(e,t,n){let i=new Ss(t,4,2),o=new vt({wireframe:!0,fog:!1,toneMapped:!1});super(i,o);this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},NF=new M,$S=new xe,eL=new xe,tL=class extends je{constructor(e,t,n){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;let i=new ws(t);i.rotateY(Math.PI*.5),this.material=new vt({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);let o=i.getAttribute("position"),s=new Float32Array(o.count*3);i.setAttribute("color",new qe(s,3)),this.add(new Lt(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let t=e.geometry.getAttribute("color");$S.copy(this.light.color),eL.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){let o=n<i/2?$S:eL;t.setXYZ(n,o.r,o.g,o.b)}t.needsUpdate=!0}e.lookAt(NF.setFromMatrixPosition(this.light.matrixWorld).negate())}},N1=class extends Bn{constructor(e=10,t=10,n=4473924,i=8947848){n=new xe(n),i=new xe(i);let o=t/2,s=e/t,a=e/2,l=[],u=[];for(let h=0,p=0,d=-a;h<=t;h++,d+=s){l.push(-a,0,d,a,0,d),l.push(d,0,-a,d,0,a);let g=h===o?n:i;g.toArray(u,p),p+=3,g.toArray(u,p),p+=3,g.toArray(u,p),p+=3,g.toArray(u,p),p+=3}let c=new Pe;c.setAttribute("position",new Te(l,3)),c.setAttribute("color",new Te(u,3));let f=new Jt({vertexColors:!0,toneMapped:!1});super(c,f);this.type="GridHelper"}},nL=class extends Bn{constructor(e=10,t=16,n=8,i=64,o=4473924,s=8947848){o=new xe(o),s=new xe(s);let a=[],l=[];for(let f=0;f<=t;f++){let h=f/t*(Math.PI*2),p=Math.sin(h)*e,d=Math.cos(h)*e;a.push(0,0,0),a.push(p,0,d);let g=f&1?o:s;l.push(g.r,g.g,g.b),l.push(g.r,g.g,g.b)}for(let f=0;f<=n;f++){let h=f&1?o:s,p=e-e/n*f;for(let d=0;d<i;d++){let g=d/i*(Math.PI*2),x=Math.sin(g)*p,y=Math.cos(g)*p;a.push(x,0,y),l.push(h.r,h.g,h.b),g=(d+1)/i*(Math.PI*2),x=Math.sin(g)*p,y=Math.cos(g)*p,a.push(x,0,y),l.push(h.r,h.g,h.b)}}let u=new Pe;u.setAttribute("position",new Te(a,3)),u.setAttribute("color",new Te(l,3));let c=new Jt({vertexColors:!0,toneMapped:!1});super(u,c);this.type="PolarGridHelper"}},iL=new M,Yp=new M,rL=new M,oL=class extends je{constructor(e,t,n){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let i=new Pe;i.setAttribute("position",new Te([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let o=new Jt({fog:!1,toneMapped:!1});this.lightPlane=new Ki(i,o),this.add(this.lightPlane),i=new Pe,i.setAttribute("position",new Te([0,0,0,0,0,1],3)),this.targetLine=new Ki(i,o),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){iL.setFromMatrixPosition(this.light.matrixWorld),Yp.setFromMatrixPosition(this.light.target.matrixWorld),rL.subVectors(Yp,iL),this.lightPlane.lookAt(Yp),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Yp),this.targetLine.scale.z=rL.length()}},Xp=new M,Ut=new Va,sL=class extends Bn{constructor(e){let t=new Pe,n=new Jt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],o=[],s={},a=new xe(16755200),l=new xe(16711680),u=new xe(43775),c=new xe(16777215),f=new xe(3355443);h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),h("p","n1",l),h("p","n2",l),h("p","n3",l),h("p","n4",l),h("u1","u2",u),h("u2","u3",u),h("u3","u1",u),h("c","t",c),h("p","c",f),h("cn1","cn2",f),h("cn3","cn4",f),h("cf1","cf2",f),h("cf3","cf4",f);function h(d,g,x){p(d,x),p(g,x)}function p(d,g){i.push(0,0,0),o.push(g.r,g.g,g.b),s[d]===void 0&&(s[d]=[]),s[d].push(i.length/3-1)}t.setAttribute("position",new Te(i,3)),t.setAttribute("color",new Te(o,3));super(t,n);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let e=this.geometry,t=this.pointMap,n=1,i=1;Ut.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Vt("c",t,e,Ut,0,0,-1),Vt("t",t,e,Ut,0,0,1),Vt("n1",t,e,Ut,-n,-i,-1),Vt("n2",t,e,Ut,n,-i,-1),Vt("n3",t,e,Ut,-n,i,-1),Vt("n4",t,e,Ut,n,i,-1),Vt("f1",t,e,Ut,-n,-i,1),Vt("f2",t,e,Ut,n,-i,1),Vt("f3",t,e,Ut,-n,i,1),Vt("f4",t,e,Ut,n,i,1),Vt("u1",t,e,Ut,n*.7,i*1.1,-1),Vt("u2",t,e,Ut,-n*.7,i*1.1,-1),Vt("u3",t,e,Ut,0,i*2,-1),Vt("cf1",t,e,Ut,-n,0,1),Vt("cf2",t,e,Ut,n,0,1),Vt("cf3",t,e,Ut,0,-i,1),Vt("cf4",t,e,Ut,0,i,1),Vt("cn1",t,e,Ut,-n,0,-1),Vt("cn2",t,e,Ut,n,0,-1),Vt("cn3",t,e,Ut,0,-i,-1),Vt("cn4",t,e,Ut,0,i,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};Kp=new Yn,O1=class extends Bn{constructor(e,t=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),o=new Pe;o.setIndex(new qe(n,1)),o.setAttribute("position",new qe(i,3));super(o,new Jt({color:t,toneMapped:!1}));this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Kp.setFromObject(this.object),Kp.isEmpty())return;let t=Kp.min,n=Kp.max,i=this.geometry.attributes.position,o=i.array;o[0]=n.x,o[1]=n.y,o[2]=n.z,o[3]=t.x,o[4]=n.y,o[5]=n.z,o[6]=t.x,o[7]=t.y,o[8]=n.z,o[9]=n.x,o[10]=t.y,o[11]=n.z,o[12]=n.x,o[13]=n.y,o[14]=t.z,o[15]=t.x,o[16]=n.y,o[17]=t.z,o[18]=t.x,o[19]=t.y,o[20]=t.z,o[21]=n.x,o[22]=t.y,o[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return Bn.prototype.copy.call(this,e),this.object=e.object,this}},aL=class extends Bn{constructor(e,t=16776960){let n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],o=new Pe;o.setIndex(new qe(n,1)),o.setAttribute("position",new Te(i,3));super(o,new Jt({color:t,toneMapped:!1}));this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}},lL=class extends Ki{constructor(e,t=1,n=16776960){let i=n,o=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],s=new Pe;s.setAttribute("position",new Te(o,3)),s.computeBoundingSphere();super(s,new Jt({color:i,toneMapped:!1}));this.type="PlaneHelper",this.plane=e,this.size=t;let a=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],l=new Pe;l.setAttribute("position",new Te(a,3)),l.computeBoundingSphere(),this.add(new Lt(l,new vt({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){let t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?At:ji,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}},uL=new M,cL=class extends je{constructor(e=new M(0,0,1),t=new M(0,0,0),n=1,i=16776960,o=n*.2,s=o*.2){super();this.type="ArrowHelper",Zp===void 0&&(Zp=new Pe,Zp.setAttribute("position",new Te([0,0,0,0,1,0],3)),G1=new bo(0,.5,1,5,1),G1.translate(0,-.5,0)),this.position.copy(t),this.line=new Ki(Zp,new Jt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Lt(G1,new vt({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,o,s)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{uL.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(uL,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},W1=class extends Bn{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Pe;i.setAttribute("position",new Te(t,3)),i.setAttribute("color",new Te(n,3));let o=new Jt({vertexColors:!0,toneMapped:!1});super(i,o);this.type="AxesHelper"}setColors(e,t,n){let i=new xe,o=this.geometry.attributes.color.array;return i.set(e),i.toArray(o,0),i.toArray(o,3),i.set(t),i.toArray(o,6),i.toArray(o,9),i.set(n),i.toArray(o,12),i.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},hL=class{constructor(){this.type="ShapePath",this.color=new xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new hl,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,o,s){return this.currentPath.bezierCurveTo(e,t,n,i,o,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(m){let b=[];for(let w=0,D=m.length;w<D;w++){let R=m[w],L=new Ci;L.curves=R.curves,b.push(L)}return b}function i(m,b){let w=b.length,D=!1;for(let R=w-1,L=0;L<w;R=L++){let T=b[R],U=b[L],F=U.x-T.x,C=U.y-T.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(T=b[L],F=-F,U=b[R],C=-C),m.y<T.y||m.y>U.y)continue;if(m.y===T.y){if(m.x===T.x)return!0}else{let j=C*(m.x-T.x)-F*(m.y-T.y);if(j===0)return!0;if(j<0)continue;D=!D}}else{if(m.y!==T.y)continue;if(U.x<=m.x&&m.x<=T.x||T.x<=m.x&&m.x<=U.x)return!0}}return D}let o=Pi.isClockWise,s=this.subPaths;if(s.length===0)return[];if(t===!0)return n(s);let a,l,u,c=[];if(s.length===1)return l=s[0],u=new Ci,u.curves=l.curves,c.push(u),c;let f=!o(s[0].getPoints());f=e?!f:f;let h=[],p=[],d=[],g=0,x;p[g]=void 0,d[g]=[];for(let m=0,b=s.length;m<b;m++)l=s[m],x=l.getPoints(),a=o(x),a=e?!a:a,a?(!f&&p[g]&&g++,p[g]={s:new Ci,p:x},p[g].s.curves=l.curves,f&&g++,d[g]=[]):d[g].push({h:l,p:x[0]});if(!p[0])return n(s);if(p.length>1){let m=!1,b=[];for(let w=0,D=p.length;w<D;w++)h[w]=[];for(let w=0,D=p.length;w<D;w++){let R=d[w];for(let L=0;L<R.length;L++){let T=R[L],U=!0;for(let F=0;F<p.length;F++)i(T.p,p[F].p)&&(w!==F&&b.push({froms:w,tos:F,hole:L}),U?(U=!1,h[F].push(T)):m=!0);U&&h[w].push(T)}}b.length>0&&(m||(d=h))}let y;for(let m=0,b=p.length;m<b;m++){u=p[m].s,c.push(u),y=d[m];for(let w=0,D=y.length;w<D;w++)u.holes.push(y[w].h)}return c}},fL=new Float32Array(1),OF=new Int32Array(fL.buffer),pL=class{static toHalfFloat(e){e>65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),e=65504),fL[0]=e;let t=OF[0],n=t>>16&32768,i=t>>12&2047,o=t>>23&255;return o<103?n:o>142?(n|=31744,n|=(o==255?0:1)&&t&8388607,n):o<113?(i|=2048,n|=(i>>114-o)+(i>>113-o&1),n):(n|=o-112<<10|i>>1,n+=i&1,n)}},GF=0,WF=1,VF=0,HF=1,qF=2;Xn.create=function(r,e){return console.log("THREE.Curve.create() has been deprecated"),r.prototype=Object.create(Xn.prototype),r.prototype.constructor=r,r.prototype.getPoint=e,r};hl.prototype.fromPoints=function(r){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(r)};N1.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};U1.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Mn.prototype.extractUrlBase=function(r){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Dc.extractUrlBase(r)};Mn.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Fs.prototype.center=function(r){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(r)};Fs.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Fs.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};Fs.prototype.size=function(r){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(r)};Yn.prototype.center=function(r){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(r)};Yn.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Yn.prototype.isIntersectionBox=function(r){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};Yn.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};Yn.prototype.size=function(r){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(r)};vr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Qa.prototype.setFromMatrix=function(r){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(r)};z1.prototype.center=function(r){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(r)};Qt.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};Qt.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};Qt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Qt.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),r.applyMatrix3(this)};Qt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Qt.prototype.getInverse=function(r){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};Ae.prototype.extractPosition=function(r){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(r)};Ae.prototype.flattenToArrayOffset=function(r,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(r,e)};Ae.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new M().setFromMatrixColumn(this,3)};Ae.prototype.setRotationFromQuaternion=function(r){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(r)};Ae.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Ae.prototype.multiplyVector3=function(r){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Ae.prototype.multiplyVector4=function(r){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Ae.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Ae.prototype.rotateAxis=function(r){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),r.transformDirection(this)};Ae.prototype.crossVector=function(r){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Ae.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Ae.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Ae.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Ae.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Ae.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Ae.prototype.applyToBufferAttribute=function(r){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),r.applyMatrix4(this)};Ae.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Ae.prototype.makeFrustum=function(r,e,t,n,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(r,e,n,t,i,o)};Ae.prototype.getInverse=function(r){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(r).invert()};Fi.prototype.isIntersectionLine=function(r){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(r)};ot.prototype.multiplyVector3=function(r){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),r.applyQuaternion(this)};ot.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};wr.prototype.isIntersectionBox=function(r){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(r)};wr.prototype.isIntersectionPlane=function(r){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(r)};wr.prototype.isIntersectionSphere=function(r){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(r)};It.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};It.prototype.barycoordFromPoint=function(r,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(r,e)};It.prototype.midpoint=function(r){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(r)};It.prototypenormal=function(r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(r)};It.prototype.plane=function(r){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(r)};It.barycoordFromPoint=function(r,e,t,n,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),It.getBarycoord(r,e,t,n,i)};It.normal=function(r,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),It.getNormal(r,e,t,n)};Ci.prototype.extractAllPoints=function(r){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(r)};Ci.prototype.extrude=function(r){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ji(this,r)};Ci.prototype.makeGeometry=function(r){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new bs(this,r)};ee.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};ee.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};ee.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};M.prototype.getPositionFromMatrix=function(r){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(r)};M.prototype.getScaleFromMatrix=function(r){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(r)};M.prototype.getColumnFromMatrix=function(r,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,r)};M.prototype.applyProjection=function(r){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(r)};M.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};M.prototype.distanceToManhattan=function(r){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(r)};M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};xt.prototype.fromAttribute=function(r,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(r,e,t)};xt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};je.prototype.getChildByName=function(r){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(r)};je.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};je.prototype.translate=function(r,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,r)};je.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};je.prototype.applyMatrix=function(r){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(je.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(r){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=r}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Lt.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(Lt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Qb},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});uc.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Gt.prototype.setLens=function(r,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(r)};Object.defineProperties(vi.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(r){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=r}},shadowCameraLeft:{set:function(r){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=r}},shadowCameraRight:{set:function(r){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=r}},shadowCameraTop:{set:function(r){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=r}},shadowCameraBottom:{set:function(r){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=r}},shadowCameraNear:{set:function(r){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=r}},shadowCameraFar:{set:function(r){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=r}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(r){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=r}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(r){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=r}},shadowMapHeight:{set:function(r){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=r}}});Object.defineProperties(qe.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Fa},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Fa)}}});qe.prototype.setDynamic=function(r){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Fa:Ta),this};qe.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},qe.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Pe.prototype.addIndex=function(r){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(r)};Pe.prototype.addAttribute=function(r,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(r,new qe(arguments[1],arguments[2]))):r==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(r,e)};Pe.prototype.addDrawCall=function(r,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(r,e)};Pe.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Pe.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Pe.prototype.removeAttribute=function(r){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(r)};Pe.prototype.applyMatrix=function(r){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(r)};Object.defineProperties(Pe.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});yo.prototype.setDynamic=function(r){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(r===!0?Fa:Ta),this};yo.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Ji.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Ji.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Ji.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};xs.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Ec.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(Zt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(r){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=r===I0}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(r){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=r}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}});Object.defineProperties(Yi.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(r){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=r}}});ft.prototype.clearTarget=function(r,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(r),this.clear(e,t,n)};ft.prototype.animate=function(r){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(r)};ft.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};ft.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};ft.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};ft.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};ft.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};ft.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};ft.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};ft.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};ft.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};ft.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};ft.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};ft.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};ft.prototype.enableScissorTest=function(r){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(r)};ft.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};ft.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};ft.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};ft.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};ft.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};ft.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};ft.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};ft.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};ft.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};ft.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(ft.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=r}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(r){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=r}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(r){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=r===!0?Ou:Pn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}});Object.defineProperties(Y3.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(Qn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=r}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(r){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=r}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=r}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(r){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=r}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(r){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=r}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(r){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=r}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(r){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=r}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(r){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=r}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(r){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=r}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(r){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=r}}});qp.prototype.load=function(r){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new L1().load(r,function(n){e.setBuffer(n)}),this};M1.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Ku.prototype.updateCubeMap=function(r,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(r,e)};Ku.prototype.clear=function(r,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(r,e,t,n)};so.crossOrigin=void 0;so.loadTexture=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let i=new Lc;i.setCrossOrigin(this.crossOrigin);let o=i.load(r,t,void 0,n);return e&&(o.mapping=e),o};so.loadTextureCube=function(r,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let i=new p1;i.setCrossOrigin(this.crossOrigin);let o=i.load(r,t,void 0,n);return e&&(o.mapping=e),o};so.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};so.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};w_={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:xf}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=xf)});var nA={};_t(nA,{default:()=>BC});function kC(r){let e=new WeakMap;return{postMessage:r.postMessage.bind(r),addEventListener:(t,n)=>{let i=o=>{"handleEvent"in n?n.handleEvent({data:o}):n({data:o})};r.on("message",i),e.set(n,i)},removeEventListener:(t,n)=>{let i=e.get(n);!i||(r.off("message",i),e.delete(n))},start:r.start&&r.start.bind(r)}}var BC,iA=oe(()=>{BC=kC});var l2={};_t(l2,{NodeWorkerStringWrapper:()=>IC,NodeWorkerWrapper:()=>zC});async function rA(){return{NodeWorker:(await import("worker_threads")).Worker,nodeEndpoint:(await Promise.resolve().then(()=>(iA(),nA))).default}}function oA(r,e,t){let n=new r.NodeWorker(e,t);return n.unref(),r.nodeEndpoint(n)}async function zC(){let r=await rA();return sA||(sA=class{constructor(e,t){return oA(r,e)}})}async function IC(){let r=await rA();return aA||(aA=class{constructor(e,t){return oA(r,e,{eval:!0})}})}var sA,aA,u2=oe(()=>{sA=null;aA=null});var hA={};_t(hA,{workerSource:()=>UC});var UC,fA=oe(()=>{UC=`var m1=Object.create;var wo=Object.defineProperty;var p1=Object.getOwnPropertyDescriptor;var d1=Object.getOwnPropertyNames;var L1=Object.getPrototypeOf,h1=Object.prototype.hasOwnProperty;var ca=e=>wo(e,"__esModule",{value:!0});var S=(e,t)=>()=>(e&&(t=e(e=0)),t);var Te=(e,t)=>{ca(e);for(var r in t)wo(e,r,{get:t[r],enumerable:!0})},R1=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of d1(t))!h1.call(e,n)&&n!=="default"&&wo(e,n,{get:()=>t[n],enumerable:!(r=p1(t,n))||r.enumerable});return e},ga=e=>R1(ca(wo(e!=null?m1(L1(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var ni=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var R=(e,t,r)=>(ni(e,t,"read from private field"),r?r.call(e):t.get(e)),de=(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)},ie=(e,t,r,n)=>(ni(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),oi=(e,t,r,n)=>({set _(o){ie(e,t,o,r)},get _(){return R(e,t,n)}}),ma=(e,t,r)=>(ni(e,t,"access private method"),r);var D=(e,t,r)=>new Promise((n,o)=>{var l=u=>{try{s(r.next(u))}catch(a){o(a)}},i=u=>{try{s(r.throw(u))}catch(a){o(a)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(l,i);s((r=r.apply(e,t)).next())});var ya={};Te(ya,{default:()=>U1});function E1(e){let t=new WeakMap;return{postMessage:e.postMessage.bind(e),addEventListener:(r,n)=>{let o=l=>{"handleEvent"in n?n.handleEvent({data:l}):n({data:l})};e.on("message",o),t.set(n,o)},removeEventListener:(r,n)=>{let o=t.get(n);!o||(e.off("message",o),t.delete(n))},start:e.start&&e.start.bind(e)}}var U1,Da=S(()=>{U1=E1});var Fa={};Te(Fa,{port:()=>k1});function k1(){return D(this,null,function*(){let{parentPort:e}=yield import("worker_threads").catch();return(yield Promise.resolve().then(()=>(Da(),ya))).default(e)})}var Ba=S(()=>{});var C1,Uo,ke,Mt=S(()=>{C1=!1,Uo=class{is(t){return this instanceof t}as(t){return this instanceof t?this:null}},ke=class extends Uo{constructor(){super();C1&&Object.defineProperty(this,"_debugStr",{get:()=>this.toString()})}get log(){return console.log.bind(console,this,this.toString())}}});function xa(e,t=!0){if(!t)return e;switch(e){case 1:return-1;case-1:return 1}}function ai(e,t){return t===-1?Array.from(e).reverse():e}function Sa(e){return Array.from(e).reverse()}var j,dt=S(()=>{(function(r){r[r.Forwards=1]="Forwards",r[r.Backwards=-1]="Backwards"})(j||(j={}))});var Cn,Nr,va,ui=S(()=>{Cn=2147483647,Nr="2^31 - 1",va=-2147483648});var dr,at,fi=S(()=>{Pt();at=class{constructor(){de(this,dr,[])}push(t){R(this,dr).push(t)}experimentalPushAlg(t){for(let r of t.units())this.push(r)}experimentalNumUnits(){return R(this,dr).length}toAlg(){return new z(R(this,dr))}reset(){ie(this,dr,[])}};dr=new WeakMap});var Lr,hr,ko,ze,Mn=S(()=>{Pt();Mt();dt();ko=class extends ke{constructor(t,r){super();de(this,Lr,void 0);de(this,hr,void 0);ie(this,Lr,Ht(t)),ie(this,hr,Ht(r))}get A(){return R(this,Lr)}get B(){return R(this,hr)}isIdentical(t){let r=t.as(ko);return!!((r==null?void 0:r.A.isIdentical(this.A))&&(r==null?void 0:r.B.isIdentical(this.B)))}invert(){return new ko(R(this,hr),R(this,Lr))}*experimentalExpand(t=j.Forwards,r){r!=null||(r=1/0),r===0?yield t===j.Forwards?this:this.invert():t===j.Forwards?(yield*this.A.experimentalExpand(j.Forwards,r-1),yield*this.B.experimentalExpand(j.Forwards,r-1),yield*this.A.experimentalExpand(j.Backwards,r-1),yield*this.B.experimentalExpand(j.Backwards,r-1)):(yield*this.B.experimentalExpand(j.Forwards,r-1),yield*this.A.experimentalExpand(j.Forwards,r-1),yield*this.B.experimentalExpand(j.Backwards,r-1),yield*this.A.experimentalExpand(j.Backwards,r-1))}toString(){return\`[\${R(this,Lr).toString()}, \${R(this,hr).toString()}]\`}},ze=ko;Lr=new WeakMap,hr=new WeakMap});var Tr,_r,zo,Ce,Pn=S(()=>{Pt();Mt();dt();zo=class extends ke{constructor(t,r){super();de(this,Tr,void 0);de(this,_r,void 0);ie(this,Tr,Ht(t)),ie(this,_r,Ht(r))}get A(){return R(this,Tr)}get B(){return R(this,_r)}isIdentical(t){let r=t.as(zo);return!!((r==null?void 0:r.A.isIdentical(this.A))&&(r==null?void 0:r.B.isIdentical(this.B)))}invert(){return new zo(R(this,Tr),R(this,_r).invert())}*experimentalExpand(t,r){r!=null||(r=1/0),r===0?yield t===j.Forwards?this:this.invert():(yield*this.A.experimentalExpand(j.Forwards,r-1),yield*this.B.experimentalExpand(t,r-1),yield*this.A.experimentalExpand(j.Backwards,r-1))}toString(){return\`[\${this.A}: \${this.B}]\`}},Ce=zo;Tr=new WeakMap,_r=new WeakMap});var Yt,ci,Lt,In=S(()=>{Mt();dt();ci=class extends ke{constructor(t){super();de(this,Yt,void 0);if(t.includes(\`
|
|
4181
4181
|
\`)||t.includes("\\r"))throw new Error("LineComment cannot contain newline");ie(this,Yt,t)}get text(){return R(this,Yt)}isIdentical(t){let r=t;return t.is(ci)&&R(this,Yt)===R(r,Yt)}invert(){return this}*experimentalExpand(t=j.Forwards,r=1/0){yield this}toString(){return\`//\${R(this,Yt)}\`}},Lt=ci;Yt=new WeakMap});var We,Gn=S(()=>{Mt();dt();We=class extends ke{toString(){return\`
|
|
4182
4182
|
\`}isIdentical(t){return t.is(We)}invert(){return this}*experimentalExpand(t=j.Forwards,r=1/0){yield this}}});var Qe,Nn=S(()=>{Mt();dt();Qe=class extends ke{toString(){return"."}isIdentical(t){return t.is(Qe)}invert(){return this}*experimentalExpand(t=j.Forwards,r=1/0){yield this}}});function Co(e,t){return e?parseInt(e):t}function gi(e){return new Mo().parseAlg(e)}function Ea(e){return new Mo().parseMove(e)}function Ua(e){return new Mo().parseQuantumMove(e)}function qe(e,t,r){let n=e;return n.startCharIndex=t,n.endCharIndex=r,n}function ka(e,t){return"startCharIndex"in e&&(t.startCharIndex=e.startCharIndex),"endCharIndex"in e&&(t.endCharIndex=e.endCharIndex),t}var wa,M1,P1,I1,G1,N1,Ye,O,Mo,mi=S(()=>{Pt();fi();Mn();Pn();Po();In();Zt();Gn();Nn();wa=/^(\\d+)?('?)/,M1=/^[_\\dA-Za-z]/,P1=/^((([1-9]\\d*)-)?([1-9]\\d*))?([_A-Za-z]+)?/,I1=/^[^\\n]*/,G1=/^(-?\\d+), ?/,N1=/^(-?\\d+)\\)/;Mo=class{constructor(){de(this,Ye,"");de(this,O,0)}parseAlg(t){ie(this,Ye,t),ie(this,O,0);let r=this.parseAlgWithStopping([]);return this.mustBeAtEndOfInput(),r}parseMove(t){ie(this,Ye,t),ie(this,O,0);let r=this.parseMoveImpl();return this.mustBeAtEndOfInput(),r}parseQuantumMove(t){ie(this,Ye,t),ie(this,O,0);let r=this.parseQuantumMoveImpl();return this.mustBeAtEndOfInput(),r}mustBeAtEndOfInput(){if(R(this,O)!==R(this,Ye).length)throw new Error("parsing unexpectedly ended early")}parseAlgWithStopping(t){let r=R(this,O),n=R(this,O),o=new at,l=!1,i=s=>{if(l)throw new Error(\`Unexpected character at index \${s}. Are you missing a space?\`)};e:for(;R(this,O)<R(this,Ye).length;){let s=R(this,O);if(t.includes(R(this,Ye)[R(this,O)]))return qe(o.toAlg(),r,n);if(this.tryConsumeNext(" ")){l=!1,o.experimentalNumUnits()===0&&(r=R(this,O));continue e}else if(M1.test(R(this,Ye)[R(this,O)])){i(s);let u=this.parseMoveImpl();o.push(u),l=!0,n=R(this,O);continue e}else if(this.tryConsumeNext("(")){i(s);let u=this.tryRegex(G1);if(u){let a=u[1],f=R(this,O),c=this.parseRegex(N1),g=qe(new d(new G("U_SQ_"),parseInt(a)),s+1,s+1+a.length),m=qe(new d(new G("D_SQ_"),parseInt(c[1])),f,R(this,O)-1),L=qe(new z([g,m]),s+1,R(this,O)-1);o.push(qe(new nt(L),s,R(this,O))),l=!0,n=R(this,O);continue e}else{let a=this.parseAlgWithStopping([")"]);this.mustConsumeNext(")");let f=this.parseAmount();o.push(qe(new nt(a,f),s,R(this,O))),l=!0,n=R(this,O);continue e}}else if(this.tryConsumeNext("[")){i(s);let u=this.parseAlgWithStopping([",",":"]),a=this.popNext(),f=this.parseAlgWithStopping(["]"]);switch(this.mustConsumeNext("]"),a){case":":o.push(qe(new Ce(u,f),s,R(this,O))),l=!0,n=R(this,O);continue e;case",":o.push(qe(new ze(u,f),s,R(this,O))),l=!0,n=R(this,O);continue e;default:throw"unexpected parsing error"}}else if(this.tryConsumeNext(\`
|
|
4183
4183
|
\`)){o.push(qe(new We,s,R(this,O))),l=!1,n=R(this,O);continue e}else if(this.tryConsumeNext("/"))if(this.tryConsumeNext("/")){i(s);let[u]=this.parseRegex(I1);o.push(qe(new Lt(u),s,R(this,O))),l=!1,n=R(this,O);continue e}else{o.push(qe(new d("_SLASH_"),s,R(this,O))),l=!0,n=R(this,O);continue e}else if(this.tryConsumeNext(".")){i(s),o.push(qe(new Qe,s,R(this,O))),l=!0,n=R(this,O);continue e}else throw new Error(\`Unexpected character: \${this.popNext()}\`)}if(R(this,O)!==R(this,Ye).length)throw new Error("did not finish parsing?");if(t.length>0)throw new Error("expected stopping");return qe(o.toAlg(),r,n)}parseQuantumMoveImpl(){let[,,,t,r,n]=this.parseRegex(P1);return new G(n,Co(r,void 0),Co(t,void 0))}parseMoveImpl(){let t=R(this,O);if(this.tryConsumeNext("/"))return qe(new d("_SLASH_"),t,R(this,O));let r=this.parseQuantumMoveImpl(),[n,o]=this.parseAmountAndTrackEmptyAbsAmount(),l=this.parseMoveSuffix();if(l){if(n<0)throw new Error("uh-oh");if((l==="++"||l==="--")&&n!==1)throw new Error("Pochmann ++ or -- moves cannot have an amount other than 1.");if((l==="++"||l==="--")&&!o)throw new Error("Pochmann ++ or -- moves cannot have an amount written as a number.");if((l==="+"||l==="-")&&o)throw new Error("Clock dial moves must have an amount written as a natural number followed by + or -.");l.startsWith("+")&&(r=r.modified({family:\`\${r.family}_\${l==="+"?"PLUS":"PLUSPLUS"}_\`})),l.startsWith("-")&&(r=r.modified({family:\`\${r.family}_\${l==="-"?"PLUS":"PLUSPLUS"}_\`}),n*=-1)}return qe(new d(r,n),t,R(this,O))}parseMoveSuffix(){return this.tryConsumeNext("+")?this.tryConsumeNext("+")?"++":"+":this.tryConsumeNext("-")?this.tryConsumeNext("-")?"--":"-":null}parseAmountAndTrackEmptyAbsAmount(){let t=R(this,O),[,r,n]=this.parseRegex(wa);if((r==null?void 0: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[Co(r,1)*(n==="'"?-1:1),!r]}parseAmount(){let t=R(this,O),[,r,n]=this.parseRegex(wa);if((r==null?void 0: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 Co(r,1)*(n==="'"?-1:1)}parseRegex(t){let r=t.exec(this.remaining());if(r===null)throw new Error("internal parsing error");return ie(this,O,R(this,O)+r[0].length),r}tryRegex(t){let r=t.exec(this.remaining());return r===null?null:(ie(this,O,R(this,O)+r[0].length),r)}remaining(){return R(this,Ye).slice(R(this,O))}popNext(){let t=R(this,Ye)[R(this,O)];return oi(this,O)._++,t}tryConsumeNext(t){return R(this,Ye)[R(this,O)]===t?(oi(this,O)._++,!0):!1}mustConsumeNext(t){let r=this.popNext();if(r!==t)throw new Error(\`expected \\\`\${t}\\\` while parsing, encountered \${r}\`);return r}};Ye=new WeakMap,O=new WeakMap});function Io(e){za.has(e)||(console.warn(e),za.add(e))}var za,pi=S(()=>{za=new Set});var Or,di=S(()=>{dt();ui();Or=class{constructor(t,r=1){if(this.quantum=t,this.amount=r,!Number.isInteger(this.amount)||this.amount<va||this.amount>Cn)throw new Error(\`Unit amount absolute value must be a non-negative integer from \${Nr} to \${Nr}.\`)}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),o=xa(t,this.amount<0);for(let l=0;l<n;l++)yield*this.quantum.experimentalExpand(o,r)}}});var It,Me,Pe,Go,G,Se,Wr,d,Zt=S(()=>{Mt();dt();ui();mi();pi();di();Go=class extends Uo{constructor(t,r,n){super();de(this,It,void 0);de(this,Me,void 0);de(this,Pe,void 0);if(ie(this,It,t),ie(this,Me,r!=null?r:null),ie(this,Pe,n!=null?n:null),Object.freeze(this),R(this,Me)!==null&&(!Number.isInteger(R(this,Me))||R(this,Me)<1||R(this,Me)>Cn))throw new Error(\`QuantumMove inner layer must be a positive integer below \${Nr}.\`);if(R(this,Pe)!==null&&(!Number.isInteger(R(this,Pe))||R(this,Pe)<1||R(this,Pe)>Cn))throw new Error(\`QuantumMove outer layer must be a positive integer below \${Nr}.\`);if(R(this,Pe)!==null&&R(this,Me)!==null&&R(this,Me)<=R(this,Pe))throw new Error("QuantumMove outer layer must be smaller than inner layer.");if(R(this,Pe)!==null&&R(this,Me)===null)throw new Error("QuantumMove with an outer layer must have an inner layer")}static fromString(t){return Ua(t)}modified(t){var r,n,o;return new Go((r=t.family)!=null?r:R(this,It),(n=t.innerLayer)!=null?n:R(this,Me),(o=t.outerLayer)!=null?o:R(this,Pe))}isIdentical(t){let r=t;return t.is(Go)&&R(this,It)===R(r,It)&&R(this,Me)===R(r,Me)&&R(this,Pe)===R(r,Pe)}get family(){return R(this,It)}get outerLayer(){return R(this,Pe)}get innerLayer(){return R(this,Me)}experimentalExpand(){throw new Error("experimentalExpand() cannot be called on a \`QuantumMove\` directly.")}toString(){let t=R(this,It);return R(this,Me)!==null&&(t=String(R(this,Me))+t,R(this,Pe)!==null&&(t=String(R(this,Pe))+"-"+t)),t}},G=Go;It=new WeakMap,Me=new WeakMap,Pe=new WeakMap;Wr=class extends ke{constructor(...t){super();de(this,Se,void 0);var r;if(typeof t[0]=="string")if((r=t[1])!=null?r:null){ie(this,Se,new Or(G.fromString(t[0]),t[1]));return}else return Wr.fromString(t[0]);ie(this,Se,new Or(t[0],t[1]))}isIdentical(t){let r=t.as(Wr);return!!r&&R(this,Se).isIdentical(R(r,Se))}invert(){return ka(this,new Wr(R(this,Se).quantum,-this.amount))}*experimentalExpand(t=j.Forwards){t===j.Forwards?yield this:yield this.modified({amount:-this.amount})}get quantum(){return R(this,Se).quantum}modified(t){var r;return new Wr(R(this,Se).quantum.modified(t),(r=t.amount)!=null?r:this.amount)}static fromString(t){return Ea(t)}get amount(){return R(this,Se).amount}get type(){return Io("deprecated: type"),"blockMove"}get family(){var t;return(t=R(this,Se).quantum.family)!=null?t:void 0}get outerLayer(){var t;return(t=R(this,Se).quantum.outerLayer)!=null?t:void 0}get innerLayer(){var t;return(t=R(this,Se).quantum.innerLayer)!=null?t:void 0}toString(){if(this.family==="_SLASH_")return"/";if(this.family.endsWith("_PLUS_"))return R(this,Se).quantum.toString().slice(0,-6)+Math.abs(this.amount)+(this.amount<0?"-":"+");if(this.family.endsWith("_PLUSPLUS_")){let t=Math.abs(this.amount);return R(this,Se).quantum.toString().slice(0,-10)+(t===1?"":t)+(this.amount<0?"--":"++")}return R(this,Se).quantum.toString()+R(this,Se).suffix()}},d=Wr;Se=new WeakMap});var Ca,Ma,Ze,No,nt,Po=S(()=>{Pt();Mt();dt();Zt();di();Ca=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){var n,o;this.quantumU_SQ_||(this.quantumU_SQ_=new G("U_SQ_")),this.quantumD_SQ_||(this.quantumD_SQ_=new G("D_SQ_"));let r=t.alg;if(r.experimentalNumUnits()===2){let[l,i]=r.units();if(((n=l.as(d))==null?void 0:n.quantum.isIdentical(this.quantumU_SQ_))&&((o=i.as(d))==null?void 0:o.quantum.isIdentical(this.quantumD_SQ_))){if(t.amount!==1)throw new Error("Square-1 tuples cannot have an amount other than 1.");return[l,i]}}return null}},Ma=new Ca,No=class extends ke{constructor(t,r){super();de(this,Ze,void 0);let n=Ht(t);ie(this,Ze,new Or(n,r))}isIdentical(t){let r=t;return t.is(No)&&R(this,Ze).isIdentical(R(r,Ze))}get alg(){return R(this,Ze).quantum}get amount(){return R(this,Ze).amount}get experimentalRepetitionSuffix(){return R(this,Ze).suffix()}invert(){return new No(R(this,Ze).quantum,-R(this,Ze).amount)}*experimentalExpand(t=j.Forwards,r){r!=null||(r=1/0),r===0?yield t===j.Forwards?this:this.invert():yield*R(this,Ze).experimentalExpand(t,r-1)}static fromString(){throw new Error("unimplemented")}toString(){var t;return(t=Ma.format(this))!=null?t:\`(\${R(this,Ze).quantum.toString()})\${R(this,Ze).suffix()}\`}experimentalAsSquare1Tuple(){return Ma.tuple(this)}},nt=No;Ze=new WeakMap});var To=S(()=>{Po();In();Mn();Pn();Zt();Gn();Nn()});function ot(e,t){return e instanceof t}function Pa(e){return ot(e,nt)||ot(e,Lt)||ot(e,ze)||ot(e,Ce)||ot(e,d)||ot(e,We)||ot(e,Qe)}var Li=S(()=>{To()});function Ia(e,t,r){if(t.is(nt))return e.traverseGrouping(t,r);if(t.is(d))return e.traverseMove(t,r);if(t.is(ze))return e.traverseCommutator(t,r);if(t.is(Ce))return e.traverseConjugate(t,r);if(t.is(Qe))return e.traversePause(t,r);if(t.is(We))return e.traverseNewline(t,r);if(t.is(Lt))return e.traverseLineComment(t,r);throw new Error("unknown unit")}function Ga(e){if(e.is(nt)||e.is(d)||e.is(ze)||e.is(Ce)||e.is(Qe)||e.is(We)||e.is(Lt))return e;throw"internal error: expected unit"}var _o,Qr,Oo,T1,Ri,hi,Na,Ta,Ai=S(()=>{Po();Mn();Zt();Gn();Nn();Pn();In();_o=class{traverseUnit(t,r){return Ia(this,t,r)}traverseIntoUnit(t,r){return Ga(this.traverseUnit(t,r))}},Qr=class extends _o{traverseUnit(t){return Ia(this,t,void 0)}traverseIntoUnit(t){return Ga(this.traverseUnit(t))}},Ri=class extends _o{*traverseAlg(t,r){var a;if(r.depth===0){yield*t.units();return}let n=[],o=null,l=(a=r==null?void 0:r.collapseMoves)!=null?a:!0;function i(f,c){var L;let g=ma(L=Ri,Oo,T1).call(L,f,c,r);if(g===0)return!1;let m=new d(f.quantum,g);return n.push(m),o=m,!0}function s(f){l&&(o==null?void 0:o.is(d))&&f.is(d)&&o.quantum.isIdentical(f.quantum)?(n.pop(),i(o,f.amount)||(o=n.slice(-1)[0])):f.is(d)?i(f,0):(n.push(f),o=f)}let u={depth:r.depth?r.depth-1:null};for(let f of t.units())for(let c of this.traverseUnit(f,u))s(c);for(let f of n)yield f}*traverseGrouping(t,r){if(r.depth===0){yield t;return}let n={depth:r.depth?r.depth-1:null};yield new nt(this.traverseAlg(t.alg,n))}*traverseMove(t,r){yield t}*traverseCommutator(t,r){if(r.depth===0){yield t;return}let n={depth:r.depth?r.depth-1:null};yield new ze(this.traverseAlg(t.A,n),this.traverseAlg(t.B,n))}*traverseConjugate(t,r){if(r.depth===0){yield t;return}let n={depth:r.depth?r.depth-1:null};yield new Ce(this.traverseAlg(t.A,n),this.traverseAlg(t.B,n))}*traversePause(t,r){yield t}*traverseNewline(t,r){yield t}*traverseLineComment(t,r){yield t}},hi=Ri;Oo=new WeakSet,T1=function(t,r,n){let o=t.amount+r;if(n==null?void 0:n.quantumMoveOrder){let l=n.quantumMoveOrder(t.quantum),i=Math.floor(l/2)+1-l;o=(o%l+l-i)%l+i}return o},de(hi,Oo);Na=new hi,Ta=Na.traverseAlg.bind(Na)});function _a(e){if(!e)return[];if(ot(e,z))return e.units();if(typeof e=="string")return gi(e).units();let t=e;if(typeof t[Symbol.iterator]=="function")return t;throw"Invalid unit"}function Ht(e){return ot(e,z)?e:new z(e)}function _1(e,t){return e.is(We)||t.is(We)?"":e.is(Lt)&&!t.is(We)?\`
|
|
@@ -7000,7 +7000,7 @@ Alg U' B L U L B' U' L'
|
|
|
7000
7000
|
|
|
7001
7001
|
Alg U R' U' L B R' B' R
|
|
7002
7002
|
Alg R' U' R U B' U' B L\`)})}var $s,ea,ra=S(()=>{ll();$n();$s=null;ea=null});var pa=Symbol("Comlink.proxy"),A1=Symbol("Comlink.endpoint"),y1=Symbol("Comlink.releaseProxy"),li=Symbol("Comlink.thrown"),da=e=>typeof e=="object"&&e!==null||typeof e=="function",D1={canHandle:e=>da(e)&&e[pa],serialize(e){let{port1:t,port2:r}=new MessageChannel;return zn(e,t),[r,[r]]},deserialize(e){return e.start(),b1(e)}},F1={canHandle:e=>da(e)&&li 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}},La=new Map([["proxy",D1],["throw",F1]]);function zn(e,t=self){t.addEventListener("message",function r(n){if(!n||!n.data)return;let{id:o,type:l,path:i}=Object.assign({path:[]},n.data),s=(n.data.argumentList||[]).map(pr),u;try{let a=i.slice(0,-1).reduce((c,g)=>c[g],e),f=i.reduce((c,g)=>c[g],e);switch(l){case"GET":u=f;break;case"SET":a[i.slice(-1)[0]]=pr(n.data.value),u=!0;break;case"APPLY":u=f.apply(a,s);break;case"CONSTRUCT":{let c=new f(...s);u=v1(c)}break;case"ENDPOINT":{let{port1:c,port2:g}=new MessageChannel;zn(e,g),u=S1(c,[c])}break;case"RELEASE":u=void 0;break;default:return}}catch(a){u={value:a,[li]:0}}Promise.resolve(u).catch(a=>({value:a,[li]:0})).then(a=>{let[f,c]=si(a);t.postMessage(Object.assign(Object.assign({},f),{id:o}),c),l==="RELEASE"&&(t.removeEventListener("message",r),ha(t))})}),t.start&&t.start()}function B1(e){return e.constructor.name==="MessagePort"}function ha(e){B1(e)&&e.close()}function b1(e,t){return ii(e,[],t)}function Eo(e){if(e)throw new Error("Proxy has been released and is not useable")}function ii(e,t=[],r=function(){}){let n=!1,o=new Proxy(r,{get(l,i){if(Eo(n),i===y1)return()=>Gr(e,{type:"RELEASE",path:t.map(s=>s.toString())}).then(()=>{ha(e),n=!0});if(i==="then"){if(t.length===0)return{then:()=>o};let s=Gr(e,{type:"GET",path:t.map(u=>u.toString())}).then(pr);return s.then.bind(s)}return ii(e,[...t,i])},set(l,i,s){Eo(n);let[u,a]=si(s);return Gr(e,{type:"SET",path:[...t,i].map(f=>f.toString()),value:u},a).then(pr)},apply(l,i,s){Eo(n);let u=t[t.length-1];if(u===A1)return Gr(e,{type:"ENDPOINT"}).then(pr);if(u==="bind")return ii(e,t.slice(0,-1));let[a,f]=Ra(s);return Gr(e,{type:"APPLY",path:t.map(c=>c.toString()),argumentList:a},f).then(pr)},construct(l,i){Eo(n);let[s,u]=Ra(i);return Gr(e,{type:"CONSTRUCT",path:t.map(a=>a.toString()),argumentList:s},u).then(pr)}});return o}function x1(e){return Array.prototype.concat.apply([],e)}function Ra(e){let t=e.map(si);return[t.map(r=>r[0]),x1(t.map(r=>r[1]))]}var Aa=new WeakMap;function S1(e,t){return Aa.set(e,t),e}function v1(e){return Object.assign(e,{[pa]:!0})}function si(e){for(let[t,r]of La)if(r.canHandle(e)){let[n,o]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},o]}return[{type:"RAW",value:e},Aa.get(e)||[]]}function pr(e){switch(e.type){case"HANDLER":return La.get(e.name).deserialize(e.value);case"RAW":return e.value}}function Gr(e,t,r){return new Promise(n=>{let o=w1();e.addEventListener("message",function l(i){!i.data||!i.data.id||i.data.id!==o||(e.removeEventListener("message",l),n(i.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),r)})}function w1(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var z1=typeof globalThis.Worker=="undefined"&&typeof globalThis.WorkerNavigator=="undefined";function ba(e){z1?(()=>D(this,null,function*(){let{port:t}=yield Promise.resolve().then(()=>(Ba(),Fa));zn(e,yield t())}))():zn(e)}Rt();rn();var b2=!1;function x2(e){b2=e}function ct(){if(!b2)throw new Error("Must be called from inside a worker, to avoid impct on page performance. Try importing from the top level of \`cubing/solve\`?")}var Ki=null;function S2(){return D(this,null,function*(){if(typeof crypto!="undefined"&&typeof crypto.getRandomValues!="undefined")return crypto.getRandomValues.bind(crypto);{let t=yield Ki!=null?Ki:Ki=import("crypto");return r=>{if(!(r instanceof Uint32Array))throw new Error("The getRandomValues() shim only takes unsigned 32-bit int arrays");let n=t.randomBytes(r.length*4),o=[];for(let l=0;l<r.length;l++)o.push((n[l*4+0]<<24)+(n[l*4+1]<<16)+(n[l*4+2]<<8)+(n[l*4+3]<<0));r.set(o)}}})}var v2=9007199254740992,Bc=2097152,bc=2048;function xc(e){let t=new Uint32Array(2);e(t);let r=t[0],n=t[1];return Math.floor(r*Bc)+Math.floor(n/bc)}function Sc(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>v2)throw new Error(\`Called randomInt.below() with max == \${e}, which is larger than Javascript can handle with integer precision.\`)}function it(){return D(this,null,function*(){let e=yield S2(),t=r=>{Sc(r);let n=xc(e),o=Math.floor(v2/r)*r;return n<o?n%r:t(r)};return t})}function Tt(){return D(this,null,function*(){let e=yield it();return t=>t[e(t.length)]})}var vc=it();function w2(e){return D(this,null,function*(){for(let t=1;t<e.length;t++){let r=(yield vc)(t);[e[t],e[r]]=[e[r],e[t]]}})}he();Rt();he();var E2=class extends Qr{constructor(t){super();this.metric=t}traverseAlg(t){let r=0;for(let n of t.units())r+=this.traverseUnit(n);return r}traverseGrouping(t){let r=t.alg;return this.traverseAlg(r)*Math.abs(t.amount)}traverseMove(t){return this.metric(t)}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 0}traverseNewline(t){return 0}traverseLineComment(t){return 0}};function wc(e){return"A"<=e&&e<="Z"}function Ec(e){let t=e.family;return wc(t[0])&&t[t.length-1]==="v"||t==="x"||t==="y"||t==="z"||t==="T"?0:1}var U2=new E2(Ec),Vi=U2.traverseAlg.bind(U2);he();var k2=class extends Qr{traverseAlg(t){let r=0;for(let n of t.units())r+=this.traverseUnit(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}},z2=new k2,Uc=z2.traverseAlg.bind(z2);var kc=2,zc=!0,Cc=!1;function Mc(e,t){let r=[],n=new Je(e);return t.forEach(function(o){let l=new d(o);if(l.amount!==1)throw new Error("SGS cannot handle def moves with an amount other than 1 yet.");n.reset();for(let i=1;n.applyMove(l),!Di(e,n.state,ht(e));i++)r.push({move:l.modified({amount:i}),transformation:n.state})}),r}var _t=class{constructor(t,r,n){this.def=t;this.sgs=r;this.searchMoves=Mc(this.def,n!=null?n:Object.keys(this.def.moves))}solve(o){return D(this,arguments,function*(t,r=kc,n){let l=null,i=1e6,s=(u,a,f)=>{if(a===0){let c=this.sgsPhaseSolve(u,i);if(!c)return;let g=f.concat(c).simplify({collapseMoves:!0,quantumMoveOrder:n}),m=Vi(g);(l===null||m<i)&&(Cc&&(console.log(\`New best (\${m} moves): \${g.toString()}\`),console.log(\`Tremble moves are: \${f.toString()}\`)),l=g,i=m);return}for(let c of this.searchMoves)s(lt(this.def,u,c.transformation),a-1,f.concat([c.move]))};for(let u=0;u<=r;u++)s(t,u,new z);if(l===null)throw new Error("SGS search failed.");return l})}sgsPhaseSolve(t,r){let n=new at,o=t;for(let l of this.sgs.ordering){let i=l.pieceOrdering,s="",u=Gt(this.def,o);for(let f=0;f<i.length;f++){let c=i[f],g=c.orbitName,m=c.permutationIdx;s+=\` \${u[g].permutation[m]} \${u[g].orientation[m]}\`}let a=l.lookup[s];if(!a)throw new Error("Missing algorithm in sgs or esgs?");if(n.experimentalPushAlg(a.alg),n.experimentalNumUnits()>=r)return null;if(o=lt(this.def,o,a.transformation),zc)for(let f=0;f<i.length;f++){let c=i[f],g=c.orbitName,m=c.permutationIdx;if(o[g].permutation[m]!==m||o[g].orientation[m]!==0)throw new Error("bad SGS :-(")}}return n.toAlg()}};function il(e,t){return D(this,null,function*(){let r=yield Tt(),n=ht(e);for(let o of t.ordering){let l=r(Object.values(o.lookup));n=lt(e,n,l.transformation)}return n})}var Ic=3,I2=null;function G2(){return D(this,null,function*(){return I2||(I2=(()=>D(this,null,function*(){let e=yield(yield Promise.resolve().then(()=>(P2(),M2))).cachedData222();return new _t(yield kt["2x2x2"].def(),e,"URFLBD".split(""))}))())})}function N2(){return D(this,null,function*(){yield G2()})}function Yi(e){return D(this,null,function*(){return ct(),yield(yield G2()).solve(e,Ic,()=>4)})}function Gc(e,t,r,n){return D(this,null,function*(){let o=yield it();yield w2(r[t].permutation);let l=e.orbits[t],i=r[t].orientation,s=0;for(let u=0;u<l.numPieces;u++){let a=o(l.orientations);i[u]=a,s+=a}n&&"orientationSum"in n&&(i[0]=((i[0]+n.orientationSum-s)%l.orientations+l.orientations)%l.orientations)})}function Nc(){return D(this,null,function*(){let e=yield kt["2x2x2"].def(),t=Object.assign({},e),r=new Je(t),n=JSON.parse(JSON.stringify(r.state));return yield Gc(t,"CORNERS",n,{orientationSum:0}),n})}function T2(){return D(this,null,function*(){return yield Yi(yield Nc())})}he();Rt();rn();he();function nn(e,t){return D(this,null,function*(){let r=new at;r.experimentalPushAlg(e);for(let n of t){let o=(yield Tt())(n);o!==null&&r.push(d.fromString(o))}return r.toAlg()})}var se={3:1},je=4194303,er=1048575,Tc=524288,Ge=65535,Re={11:1,3:1},ve={17:1,3:1},Zi=14540032,eo=286331153,le={10:1,3:1},V,sl={};function _2(){}function _c(e){function t(){}return t.prototype=e||{},new t}function Oc(e){return e instanceof Array?e[0]:null}function to(e,t,r){var n=sl,o=Wc,l=Oc,i=n[e],s=l(i);i&&!s?V=i:(V=n[e]=t?o(t):{},V.castableTypeMap$=r,V.constructor=V,!t&&(V.typeMarker$=_2));for(var u=3;u<arguments.length;++u)arguments[u].prototype=V;s&&(V.___clazz$=s)}function Wc(e){var t=sl;return _c(t[e])}function Qc(){}to(1,null,{},Qc);function al(e){return e<<24>>24}function Xi(){this.typeName=null,this.simpleName=null,this.packageName=null,this.compoundName=null,this.canonicalName=null,this.typeId=null,this.arrayLiterals=null}function Ji(e,t){var r;return r=new Xi,r.packageName=e,r.compoundName=t,r}function tr(e,t,r){var n;return n=Ji(e,t),Kc(r,n),n}function qc(e,t){var r;return r=Ji(e,t),r.modifiers=2,r}function ul(e,t){var r;return r=Ji("",e),r.typeId=t,r.modifiers=1,r}function O2(e,t){var r=e.arrayLiterals=e.arrayLiterals||[];return r[t]||(r[t]=e.createClassLiteralForArray(t))}function jc(e){if(e.isPrimitive())return null;var t=e.typeId,r=sl[t];return r}function Kc(e,t){if(!!e){t.typeId=e;var r=jc(t);if(!r){sl[e]=[t];return}r.___clazz$=t}}to(79,1,{},Xi);V.createClassLiteralForArray=function(t){var r;return r=new Xi,r.modifiers=4,t>1?r.componentType=O2(this,t-1):r.componentType=this,r};V.isPrimitive=function(){return(this.modifiers&1)!=0};function J(e,t){return O2(e,t)}function Z(e,t,r,n,o,l){var i;return i=Q2(o,n),$(J(e,l),t,r,o,i),i}function Ke(e,t,r,n,o,l){return W2(e,t,r,n,o,0,l)}function W2(e,t,r,n,o,l,i){var s,u,a,f,c;if(f=o[l],a=l==i-1,s=a?n:0,c=Q2(s,f),$(J(e,i-l),t[l],r[l],s,c),!a)for(++l,u=0;u<f;++u)c[u]=W2(e,t,r,n,o,l,i);return c}function $(e,t,r,n,o){return o.___clazz$=e,o.castableTypeMap$=t,o.typeMarker$=_2,o.__elementTypeId$=r,o.__elementTypeCategory$=n,o}function Q2(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 o=0;o<t;++o)r[o]=n;return r}function q2(e){var t,r,n;return t=e&je,r=e>>22&je,n=e<0?er:0,Vc(t,r,n)}function Vc(e,t,r){return{l:e,m:t,h:r}}function Hc(e,t){var r,n,o;return r=e.l+t.l,n=e.m+t.m+(r>>22),o=e.h+t.h+(n>>22),{l:r&je,m:n&je,h:o&er}}function zt(e,t){return{l:e.l&t.l,m:e.m&t.m,h:e.h&t.h}}function $i(e){var t,r;return e>-129&&e<128?(t=e+128,cl==null&&(cl=Z(Sg,se,293,256,0,1)),r=cl[t],!r&&(r=cl[t]=q2(e)),r):q2(e)}function j2(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 es(e,t){return e.l!=t.l||e.m!=t.m||e.h!=t.h}function ts(e,t){return{l:e.l|t.l,m:e.m|t.m,h:e.h|t.h}}function fl(e,t){var r,n,o;return t&=63,t<22?(r=e.l<<t,n=e.m<<t|e.l>>22-t,o=e.h<<t|e.m>>22-t):t<44?(r=0,n=e.l<<t-22,o=e.m<<t-22|e.l>>44-t):(r=0,n=0,o=e.l<<t-44),{l:r&je,m:n&je,h:o&er}}function Br(e,t){var r,n,o,l,i;return t&=63,r=e.h,n=(r&Tc)!=0,n&&(r|=-1048576),t<22?(i=r>>t,l=e.m>>t|r<<22-t,o=e.l>>t|e.m<<22-t):t<44?(i=n?er:0,l=r>>t-22,o=e.m>>t-22|r<<44-t):(i=n?er:0,l=n?je:0,o=r>>t-44),{l:o&je,m:l&je,h:i&er}}function K2(e,t){var r,n,o;return r=e.l-t.l,n=e.m-t.m+(r>>22),o=e.h-t.h+(n>>22),{l:r&je,m:n&je,h:o&er}}function br(e){return e.l|e.m<<22}var cl;function Yc(e){this.string=e}function rr(e,t){return e>t?e:t}function rs(e,t){return e<t?e:t}function Zc(e,t){return e.indexOf(t)}function Xc(e){return Jc(e,0,e.length)}function Jc(e,t,r){for(var n="",o=t;o<r;){var l=Math.min(o+1e4,r);n+=String.fromCharCode.apply(null,e.slice(o,l)),o=l}return n}function $c(e){return String.fromCharCode(e&Ge)}var eg=tr("java.lang","String",2);function V2(e){return e.string+=" ",e}function H2(e,t){return e.string+=t,e}function tg(){Yc.call(this,"")}function gl(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}var Y2=!1;function xr(){Y2||(Y2=!0,or=Ke(Ae,[se,Re],[11,0],7,[495,18],2),cn=Ke(Ae,[se,Re],[11,0],7,[324,18],2),an=Ke(Ae,[se,Re],[11,0],7,[336,18],2),nr=Ke(Ae,[se,Re],[11,0],7,[495,8],2),dl=Z(we,ve,0,20048,7,1),pl=Z(we,ve,0,20791,7,1),fn=Z(we,ve,0,82945,7,1),on=Ke(Ae,[se,Re],[11,0],7,[2768,10],2),sn=Ke(Ae,[se,Re],[11,0],7,[2768,10],2),un=Ke(Ae,[se,Re],[11,0],7,[24,10],2),oo=Ke(Ae,[se,Re],[11,0],7,[24,16],2),Sr=Ke(Ae,[se,Re],[11,0],7,[140,16],2),ml=Z(we,ve,0,8305,7,1),ln=Z(we,ve,0,48441,7,1))}function rg(e,t,r){return e.slice_0=or[t.slice_0][r],e.flip=an[t.flip][(X(),wr)[r<<3|t.fsym]],e.fsym=e.flip&7^t.fsym,e.flip>>=3,e.twist=cn[t.twist][wr[r<<3|t.tsym]],e.tsym=e.twist&7^t.tsym,e.twist>>=3,e.prun=rr(rr($e(dl,e.twist*495+nr[e.slice_0][e.tsym]),$e(pl,e.flip*495+nr[e.slice_0][e.fsym])),$e(fn,e.twist<<11|sr[e.flip<<3|e.fsym^e.tsym])),e.prun}function ng(e,t,r){return r=(X(),so)[3][r],e.flipc=an[t.flipc>>3][wr[r<<3|t.flipc&7]]^t.flipc&7,e.twistc=cn[t.twistc>>3][wr[r<<3|t.twistc&7]]^t.twistc&7,$e(fn,e.twistc>>3<<11|sr[e.flipc^e.twistc&7])}function Z2(e,t,r){var n;return e.twist=(X(),ao)[Al(t)],e.flip=vr[Rl(t)],e.tsym=e.twist&7,e.twist=e.twist>>3,e.prun=$e(fn,e.twist<<11|sr[e.flip^e.tsym]),e.prun>r||(e.fsym=e.flip&7,e.flip=e.flip>>3,e.slice_0=494-pn(t.ea,8,!0),e.prun=rr(e.prun,rr($e(dl,e.twist*495+nr[e.slice_0][e.tsym]),$e(pl,e.flip*495+nr[e.slice_0][e.fsym]))),e.prun>r)?!1:(n=new fe,lo(t,1,n),io(t,1,n),e.twistc=ao[Al(n)],e.flipc=vr[Rl(n)],e.prun=rr(e.prun,$e(fn,e.twistc>>3<<11|sr[e.flipc^e.twistc&7])),e.prun<=r)}function ro(){xr()}function $e(e,t){return xr(),e[t>>3]>>(t<<2)&15}function X2(e){xr(),!(Ll==2||Ll==1&&!e)&&(Ll==0&&(Lg(),og(),ig(),ag(),lg(),X(),as(2048,us,vr,ou=Z(Ae,Re,0,336,7,1),0),as(2187,ms,ao,gs=Z(Ae,Re,0,324,7,1),1),sg(),ug(),fg()),no(ml,un,oo,on,(X(),cs),584244,e),no(ln,ns,Sr,sn,cs,514084,e),no(dl,or,nr,cn,gs,431619,e),no(pl,or,nr,an,ou,431619,e),no(fn,null,null,cn,gs,103939,e),Ll=e?2:1)}function og(){var e,t,r,n;for(e=new fe,t=new fe,r=0;r<2768;r++)for(mg(e,(X(),gn)[r]),n=0;n<10;n++)lr(e,ce[(_e(),Ft)[n]],t),on[r][n]=Fl(Wt[tt(t.ca,8,!1)])&Ge}function lg(){var e,t,r,n,o;for(e=new fe,t=new fe,ns=Ke(Ae,[se,Re],[11,0],7,[140,10],2),r=0;r<140;r++){for(mu(e.ca,r%70,0,!1),o=0;o<10;o++)lr(e,(X(),ce)[(_e(),Ft)[o]],t),ns[r][o]=pn(t.ca,0,!1)+70*(165>>o&1^~~(r/70))&Ge;for(n=0;n<16;n++)lo(e,(X(),et)[0][n],t),Sr[r][n]=pn(t.ca,0,!1)+70*~~(r/70)&Ge}}function ig(){var e,t,r,n;for(e=new fe,t=new fe,r=0;r<2768;r++)for(tu(e,(X(),gn)[r]),n=0;n<10;n++)gt(e,ce[(_e(),Ft)[n]],t),sn[r][n]=Wt[tt(t.ea,8,!0)]}function sg(){var e,t,r,n;for(e=new fe,t=new fe,r=0;r<336;r++)for(is(e,(X(),us)[r]),n=0;n<18;n++)gt(e,ce[n],t),an[r][n]=vr[Rl(t)]}function ag(){var e,t,r,n,o;for(e=new fe,t=new fe,r=0;r<24;r++){for(Er(e.ea,r,12,!0),o=0;o<10;o++)gt(e,(X(),ce)[(_e(),Ft)[o]],t),un[r][o]=tt(t.ea,12,!0)%24&Ge;for(n=0;n<16;n++)io(e,(X(),et)[0][n],t),oo[r][n]=tt(t.ea,12,!0)%24&Ge}}function no(e,t,r,n,o,l,i){var s,u,a,f,c,g,m,L,p,y,F,x,B,M,k,K,te,T,re,b,C,I,v,w,P,q,Y,ge,pe,De,Fe,vt,Ue,He,xe,A;if(B=l&15,F=(l>>4&1)==1?Zi:0,a=(l>>5&1)==1,s=l>>8&15,f=l>>12&15,c=l>>16&15,y=i?f:c,x=(1<<B)-1,u=t==null,L=u?2048:t.length,p=L*n.length,m=a?10:18,g=m==10?66:599186,k=(e[p>>3]>>(p<<2)&15)-1,k==-1){for(T=0;T<~~(p/8)+1;T++)e[T]=eo;e[0]^=1,k=0}for(;k<y;){for(P=(k+1)*eo^-1,re=0;re<e.length;re++)xe=e[re]^P,xe&=xe>>1,e[re]+=xe&xe>>2&eo;for(I=k>s,De=I?k+2:k,pe=De*eo,M=I?k:k+2,++k,A=k^k+1,He=0,T=0;T<p;++T,He>>=4){if((T&7)==0&&(He=e[T>>3],((He^pe)-eo&~(He^pe)&-2004318072)==0)){T+=7;continue}if((He&15)==De)for(Y=T%L,Fe=~~(T/L),K=0,te=0,u&&(K=(X(),vr)[Y],te=K&7,K>>=3),w=0;w<m;w++){if(Ue=n[Fe][w],u?ge=(X(),sr)[an[K][wr[w<<3|te]]^te^Ue&x]:ge=r[t[Y][w]][Ue&x],Ue>>=B,b=Ue*L+ge,q=e[b>>3]>>(b<<2)&15,q!=M){q<k-1&&(w+=g>>w&3);continue}if(I){e[T>>3]^=A<<(T<<2);break}for(e[b>>3]^=A<<(b<<2),v=1,vt=o[Ue];(vt>>=1)!=0;v++)(vt&1)==1&&(C=Ue*L,u?C+=(X(),sr)[vr[ge]^v]:C+=r[ge][v^F>>(v<<1)&3],(e[C>>3]>>(C<<2)&15)==M&&(e[C>>3]^=A<<(C<<2)))}}}}function ug(){var e,t,r,n;for(e=new fe,t=new fe,r=0;r<324;r++)for(ss(e,(X(),ms)[r]),n=0;n<18;n++)lr(e,ce[n],t),cn[r][n]=ao[Al(t)]}function fg(){var e,t,r,n,o,l,i,s;for(e=new fe,t=new fe,n=0;n<495;n++){for(mu(e.ea,494-n,8,!0),l=0;l<18;l+=3)gt(e,(X(),ce)[l],t),or[n][l]=494-pn(t.ea,8,!0)&Ge;for(o=0;o<16;o+=2)io(e,(X(),et)[0][o],t),nr[n][o>>1]=494-pn(t.ea,8,!0)&Ge}for(r=0;r<495;r++)for(o=0;o<18;o+=3)for(s=or[r][o],i=1;i<3;i++)s=or[s][o],or[r][o+i]=s&Ge}to(31,1,{31:1},ro);V.flip=0;V.flipc=0;V.fsym=0;V.prun=0;V.slice_0=0;V.tsym=0;V.twist=0;V.twistc=0;var Sr,ns,on,ln,sn,an,ml,oo,un,fn,cn,nr,pl,or,dl,Ll=0,hl=tr("org.cubing.min2phase.client","CoordCube",31),J2=!1;function X(){J2||(J2=!0,Ot=Z(uo,se,7,16,0,1),ce=Z(uo,se,7,18,0,1),bl=Z(vg,se,0,18,6,1),lu=Z(we,ve,0,48,7,1),Qt=Ke(we,[se,ve],[17,0],7,[16,16],2),et=Ke(we,[se,ve],[17,0],7,[16,16],2),so=Ke(we,[se,ve],[17,0],7,[16,18],2),wr=Z(we,ve,0,144,7,1),ar=Ke(we,[se,ve],[17,0],7,[16,18],2),us=Z(Ae,Re,0,336,7,1),ms=Z(Ae,Re,0,324,7,1),gn=Z(Ae,Re,0,2768,7,1),mn=Z(ee,le,0,2768,7,1),fs=Z(Ae,Re,0,2768,7,1),Bl=Z(ee,le,0,24,7,1),vr=Z(Ae,Re,0,2048,7,1),ao=Z(Ae,Re,0,2187,7,1),Wt=Z(Ae,Re,0,40320,7,1),sr=Z(Ae,Re,0,2688,7,1),ps=new Dt(2531,1373,67026819,1367),ds=new Dt(2089,1906,322752913,2040),xl=$(J(ee,2),se,10,0,[$(J(ee,1),le,0,7,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),$(J(ee,1),le,0,7,[6,7,8,0,1,2,3,4,5,15,16,17,9,10,11,12,13,14]),$(J(ee,1),le,0,7,[3,4,5,6,7,8,0,1,2,12,13,14,15,16,17,9,10,11]),$(J(ee,1),le,0,7,[2,1,0,5,4,3,8,7,6,11,10,9,14,13,12,17,16,15]),$(J(ee,1),le,0,7,[8,7,6,2,1,0,5,4,3,17,16,15,11,10,9,14,13,12]),$(J(ee,1),le,0,7,[5,4,3,8,7,6,2,1,0,14,13,12,17,16,15,11,10,9])]),dg(),hg())}function os(e){e.ca=$(J(ee,1),le,0,7,[0,1,2,3,4,5,6,7]),e.ea=$(J(ee,1),le,0,7,[0,2,4,6,8,10,12,14,16,18,20,22])}function $2(e){!e.temps&&(e.temps=new fe),lr(ds,e,e.temps),lr(e.temps,ps,e),gt(ds,e,e.temps),gt(e.temps,ps,e)}function ls(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 cg(e){return Fl(Wt[tt(e.ca,8,!1)])}function gg(e){return Wt[tt(e.ea,8,!0)]}function Rl(e){var t,r;for(r=0,t=0;t<11;t++)r=r<<1|e.ea[t]&1;return r}function Al(e){var t,r;for(r=0,t=0;t<7;t++)r+=(r<<1)+(e.ca[t]>>3);return r}function yl(e){var t,r;for(!e.temps&&(e.temps=new fe),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;ls(e,e.temps)}function eu(e){var t,r,n,o,l,i,s;for(t=new ru(e),o=new fe,r=Fl(Wt[tt(t.ca,8,!1)])>>4,i={l:0,m:0,h:0},s=0;s<6;s++){if(n=Fl(Wt[tt(t.ca,8,!1)])>>4,r==n)for(l=0;l<16;l++)lo(t,et[0][l],o),gl(o.ca,e.ca)&&(io(t,et[0][l],o),gl(o.ea,e.ea)&&(i=ts(i,fl({l:1,m:0,h:0},(s<<4|l)<48?s<<4|l:48))));$2(t),s%3==2&&yl(t)}return i}function mg(e,t){Er(e.ca,t,8,!1)}function tu(e,t){Er(e.ea,t,8,!0)}function is(e,t){var r,n,o;for(n=0,r=10;r>=0;--r,t>>=1)n^=o=t&1,e.ea[r]=(e.ea[r]&-2|o)<<24>>24;e.ea[11]=(e.ea[11]&-2|n)<<24>>24}function ss(e,t){var r,n,o;for(n=15,r=6;r>=0;--r,t=~~(t/3))n-=o=t%3,e.ca[r]=(e.ca[r]&7|o<<3)<<24>>24;e.ca[7]=(e.ca[7]&7|n%3<<3)<<24>>24}function pg(e){var t,r,n,o,l;for(l=0,o=0,n=0;n<12;n++)o|=1<<(e.ea[n]>>1),l^=e.ea[n]&1;if(o!=4095)return-2;if(l!=0)return-3;for(r=0,l=0,t=0;t<8;t++)r|=1<<(e.ca[t]&7),l+=e.ca[t]>>3;return r!=255?-4:l%3!=0?-5:(hs(tt(e.ea,12,!0),12)^hs(tt(e.ca,8,!1),8))!=0?-6:0}function lo(e,t,r){X();var n,o,l,i,s,u;for(u=Ot[et[0][t]],s=Ot[t],n=0;n<8;n++)l=u.ca[e.ca[s.ca[n]&7]&7]>>3,i=e.ca[s.ca[n]&7]>>3,o=l<3?i:(3-i)%3,r.ca[n]=(u.ca[e.ca[s.ca[n]&7]&7]&7|o<<3)<<24>>24}function lr(e,t,r){X();var n,o,l;for(n=0;n<8;n++)o=e.ca[t.ca[n]&7]>>3,l=t.ca[n]>>3,r.ca[n]=(e.ca[t.ca[n]&7]&7|(o+l)%3<<3)<<24>>24}function Dl(e,t,r){var n,o,l,i;for(n=0;n<8;n++)l=e.ca[t.ca[n]&7]>>3,i=t.ca[n]>>3,o=l+(l<3?i:6-i),o=o%3+(l<3==i<3?0:3),r.ca[n]=(e.ca[t.ca[n]&7]&7|o<<3)<<24>>24}function fe(){X(),os(this)}function Dt(e,t,r,n){os(this),Er(this.ca,e,8,!1),ss(this,t),Er(this.ea,r,12,!0),is(this,n)}function ru(e){os(this),ls(this,e)}function Fl(e){return X(),e^Zi>>((e&15)<<1)&3}function io(e,t,r){X();var n,o,l;for(l=Ot[et[0][t]],o=Ot[t],n=0;n<12;n++)r.ea[n]=(l.ea[e.ea[o.ea[n]>>1]>>1]^e.ea[o.ea[n]>>1]&1^o.ea[n]&1)<<24>>24}function gt(e,t,r){X();var n;for(n=0;n<12;n++)r.ea[n]=(e.ea[t.ea[n]>>1]^t.ea[n]&1)<<24>>24}function ir(e,t,r){X();var n;return n=fs[e],r&&(n=n^Zi>>((n&15)<<1)&3),n&65520|Qt[n&15][t]}function nu(){return X(),0}function dg(){var e,t;for(ce[0]=new Dt(15120,0,119750400,0),ce[3]=new Dt(21021,1494,323403417,0),ce[6]=new Dt(8064,1236,29441808,550),ce[9]=new Dt(9,0,5880,0),ce[12]=new Dt(1230,412,2949660,0),ce[15]=new Dt(224,137,328552,137),e=0;e<18;e+=3)for(t=0;t<2;t++)ce[e+t+1]=new fe,gt(ce[e+t],ce[e],ce[e+t+1]),lr(ce[e+t],ce[e],ce[e+t+1])}function Lg(){X();var e,t,r;for(as(40320,gn,Wt,cs=Z(Ae,Re,0,2768,7,1),2),e=new fe,r=0;r<2768;r++)tu(e,gn[r]),mn[r]=pn(e.ea,0,!0)+hs(gn[r],8)*70<<24>>24,yl(e),fs[r]=Wt[tt(e.ea,8,!0)];for(t=0;t<24;t++)Er(e.ea,t,12,!0),yl(e),Bl[t]=tt(e.ea,12,!0)%24<<24>>24}function hg(){var e,t,r,n,o,l,i,s,u,a,f,c,g,m,L,p;for(e=new fe,t=new fe,r=new Dt(28783,0,259268407,0),p=new Dt(15138,0,119765538,7),c=new Dt(5167,0,83473207,0),o=0;o<8;o++)c.ca[o]=al(c.ca[o]|24);for(l=0;l<16;l++)Ot[l]=new ru(e),Dl(e,p,t),gt(e,p,t),L=t,t=e,e=L,l%4==3&&(Dl(L,c,t),gt(L,c,t),L=t,t=e,e=L),l%8==7&&(Dl(L,r,t),gt(L,r,t),L=t,t=e,e=L);for(i=0;i<16;i++)for(u=0;u<16;u++)for(Dl(Ot[i],Ot[u],e),f=0;f<16;f++)if(gl(Ot[f].ca,e.ca)){Qt[i][u]=f,et[f][u]=i;break}for(a=0;a<18;a++)for(m=0;m<16;m++){for(lo(ce[a],et[0][m],e),g=0;g<18;g++)if(gl(ce[g].ca,e.ca)){so[m][a]=g,ar[m][(_e(),dn)[a]]=dn[g];break}m%2==0&&(wr[a<<3|m>>1]=so[m][a])}for(n=0;n<18;n++)for(bl[n]=eu(ce[n]),s=n,m=0;m<48;m++)so[m%16][s]<n&&(lu[m]|=1<<n),m%16==15&&(s=xl[2][s])}function as(e,t,r,n,o){X();var l,i,s,u,a,f,c,g,m;for(l=new fe,s=new fe,i=0,a=0,m=o>=2?1:2,f=o!=1,u=0;u<e;u++)if(r[u]==0){switch(o){case 0:is(l,u);break;case 1:ss(l,u);break;case 2:Er(l.ea,u,8,!0)}for(c=0;c<16;c+=m){switch(f?io(l,c,s):lo(l,c,s),o){case 0:a=Rl(s);break;case 1:a=Al(s);break;case 2:a=tt(s.ea,8,!0)}o==0&&(sr[i<<3|c>>1]=a&Ge),a==u&&(n[i]=(n[i]|1<<~~(c/m))&Ge),g=~~((i<<4|c)/m),r[a]=g&Ge}t[i++]=u&Ge}return i}var Ot,Wt,gn,vr,us,sr,Bl,mn,fs,wr,so,ar,Qt,et,ou,cs,gs,ao,ms,lu,ce,bl,ps,ds,xl,uo=tr("org.cubing.min2phase.client","CubieCube",7);function Rg(e,t,r,n,o,l,i,s){var u,a,f,c,g;if(c=rr($e((xr(),ln),(i>>4)*140+Sr[(X(),mn)[s>>4]&255][et[i&15][s&15]]),rr($e(ln,n*140+Sr[mn[t]&255][et[o][r]]),$e(ml,t*24+oo[l][r]))),c>e.maxDep2)return c-e.maxDep2;for(u=e.maxDep2;u>=c&&(g=au(e,n,o,t,r,l,u,e.depth1,10),!(g<0));u--){for(u-=g,e.solLen=0,e.solution=new Lu,xg(e.solution,e.verbose,e.urfIdx,e.depth1),f=0;f<e.depth1+u;f++)pu(e.solution,e.move[f]);for(a=e.preMoveLen-1;a>=0;a--)pu(e.solution,e.preMoves[a]);e.solLen=e.solution.length_0}return u!=e.maxDep2?(e.maxDep2=rs(fu,e.solLen-e.length1-1),j2(e.probe,e.probeMin)?0:1):1}function Ag(e){var t,r,n,o,l,i,s,u,a,f,c,g,m,L,p;if(e.isRec=!1,j2(e.probe,e.solution?e.probeMin:e.probeMax))return 0;for(e.probe=Hc(e.probe,{l:1,m:0,h:0}),n=e.valid1;n<e.depth1;n++)lr(e.phase1Cubie[n],(X(),ce)[e.move[n]],e.phase1Cubie[n+1]),gt(e.phase1Cubie[n],ce[e.move[n]],e.phase1Cubie[n+1]);for(e.valid1=e.depth1,s=cg(e.phase1Cubie[e.depth1]),u=s&15,s>>=4,a=gg(e.phase1Cubie[e.depth1]),f=a&15,a>>=4,c=tt(e.phase1Cubie[e.depth1].ea,12,!0)%24,r=ir(a,f,!1),t=ir(s,u,!0),o=e.depth1==0?-1:e.move[e.depth1-1],l=e.preMoveLen==0?-1:e.preMoves[e.preMoveLen-1],p=0,L=(e.preMoveLen==0?1:2)*(e.depth1==0?1:2),g=0,m=(1<<L)-1;g<L;g++){if((m>>g&1)!=0){if(m&=~(1<<g),p=Rg(e,s,u,a,f,c,r,t),p==0||p>2)break;p==2&&(m&=4<<g)}if(m==0)break;(g&1)==0&&e.depth1>0?(i=(_e(),dn)[~~(o/3)*3+1],e.move[e.depth1-1]=Ft[i]*2-e.move[e.depth1-1],c=(xr(),un)[c][i],s=on[s][(X(),ar)[u][i]],u=Qt[s&15][u],s>>=4,a=sn[a][ar[f][i]],f=Qt[a&15][f],a>>=4,t=ir(s,u,!0),r=ir(a,f,!1)):e.preMoveLen>0&&(i=(_e(),dn)[~~(l/3)*3+1],e.preMoves[e.preMoveLen-1]=Ft[i]*2-e.preMoves[e.preMoveLen-1],c=(X(),Bl)[(xr(),un)[Bl[c]][i]],s=on[t>>4][ar[t&15][i]],t=s&-16|Qt[s&15][t&15],s=ir(t>>4,t&15,!0),u=s&15,s>>=4,a=sn[r>>4][ar[r&15][i]],r=a&-16|Qt[a&15][r&15],a=ir(r>>4,r&15,!1),f=a&15,a>>=4)}return e.depth1>0&&(e.move[e.depth1-1]=o),e.preMoveLen>0&&(e.preMoves[e.preMoveLen-1]=l),p==0?0:2}function yg(e){var t;for(e.conjMask=0,e.selfSym=eu(e.cc),e.conjMask|=es(zt(Br(e.selfSym,16),{l:Ge,m:0,h:0}),{l:0,m:0,h:0})?18:0,e.conjMask|=es(zt(Br(e.selfSym,32),{l:Ge,m:0,h:0}),{l:0,m:0,h:0})?36:0,e.conjMask|=es(zt(Br(e.selfSym,48),{l:Ge,m:0,h:0}),{l:0,m:0,h:0})?56:0,e.selfSym=zt(e.selfSym,{l:je,m:je,h:15}),e.maxPreMoves=e.conjMask>7?0:20,t=0;t<6;t++)ls(e.urfCubieCube[t],e.cc),Z2(e.urfCoordCube[t],e.urfCubieCube[t],20),$2(e.cc),t%3==2&&yl(e.cc)}function iu(e,t,r,n,o){var l,i,s,u,a,f;if(t.prun==0&&n<5)return e.allowShorter||n==0?(e.depth1-=n,a=Ag(e),e.depth1+=n,a):1;for(f=nu($i(r)),l=0;l<18;l+=3)if(!(l==o||l==o-9)){for(s=0;s<3;s++)if(i=l+s,!(e.isRec&&i!=e.move[e.depth1-n]||f!=0&&(f&1<<i)!=0)){if(u=rg(e.nodeUD[n],t,i),u>n)break;if(u==n)continue;if(u=ng(e.nodeUD[n],t,i),u>n)break;if(u==n)continue;if(e.move[e.depth1-n]=i,e.valid1=rs(e.valid1,e.depth1-n),a=iu(e,e.nodeUD[n],r&br((X(),bl)[i]),n-1,l),a==0)return 0;if(a>=2)break}}return 1}function su(e,t,r,n,o){var l,i,s;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==Ls&&e.preMoveLen!=0,Z2(e.nodeUD[e.depth1+1],n,e.depth1)&&iu(e,e.nodeUD[e.depth1+1],o,e.depth1,-1)==0))return 0;if(t==0||e.preMoveLen+Ls>=e.length1)return 1;for(s=nu($i(o)),(t==1||e.preMoveLen+1+Ls>=e.length1)&&(s|=225207),r=~~(r/3)*3,l=0;l<18;l++){if(l==r||l==r-9||l==r+9){l+=2;continue}if(!(e.isRec&&l!=e.preMoves[e.maxPreMoves-t]||(s&1<<l)!=0)&&(lr((X(),ce)[l],n,e.preMoveCubes[t]),gt(ce[l],n,e.preMoveCubes[t]),e.preMoves[e.maxPreMoves-t]=l,i=su(e,t-1,l,e.preMoveCubes[t],o&br(bl[l])),i==0))return 0}return 1}function au(e,t,r,n,o,l,i,s,u){var a,f,c,g,m,L,p,y,F,x,B;if(t==0&&n==0&&l==0)return i;for(F=(_e(),fo)[u],p=0;p<10;p++){if((F>>p&1)!=0){p+=66>>p&3;continue}if(y=(xr(),un)[l][p],f=on[n][(X(),ar)[o][p]],c=Qt[f&15][o],f>>=4,m=sn[t][ar[r][p]],L=Qt[m&15][r],m>>=4,g=ir(m,L,!1),a=ir(f,c,!0),x=$e(ln,(g>>4)*140+Sr[mn[a>>4]&255][et[g&15][a&15]]),x>i+1)return i-x+1;if(x>=i){p+=66>>p&3&i-x;continue}if(x=rr($e(ml,f*24+oo[y][c]),$e(ln,m*140+Sr[mn[f]&255][et[L][c]])),x>=i){p+=66>>p&3&i-x;continue}if(B=au(e,m,L,f,c,y,i-1,s+1,p),B>=0)return e.move[s]=Ft[p],B;if(B<-2)break;B<-1&&(p+=66>>p&3)}return-1}function Dg(e){for(e.length1=e.isRec?e.length1:0;e.length1<e.solLen;e.length1++)for(e.maxDep2=rs(fu,e.solLen-e.length1-1),e.urfIdx=e.isRec?e.urfIdx:0;e.urfIdx<6;e.urfIdx++)if((e.conjMask&1<<e.urfIdx)==0&&su(e,e.maxPreMoves,-30,e.urfCubieCube[e.urfIdx],br(zt(e.selfSym,{l:Ge,m:0,h:0})))==0)return e.solution?du(e.solution):"Error 8";return e.solution?du(e.solution):"Error 7"}function Fg(e,t){var r;return r=Bg(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,X2(!1),yg(e),Dg(e))}function Bg(e,t){var r,n,o,l;for(n=0,o=Z(ee,le,0,54,7,1),r=Xc($(J(Ae,1),Re,0,7,[t.charCodeAt(4),t.charCodeAt(13),t.charCodeAt(22),t.charCodeAt(31),t.charCodeAt(40),t.charCodeAt(49)])),l=0;l<54;l++){if(o[l]=Zc(r,$c(t.charCodeAt(l)))<<24>>24,o[l]==-1)return-1;n+=1<<(o[l]<<2)}return n!=10066329?-1:(bg(o,e.cc),pg(e.cc))}function uu(){var e,t,r;for(this.move=Z(we,ve,0,31,7,1),this.nodeUD=Z(hl,se,31,21,0,1),this.nodeRL=Z(hl,se,31,21,0,1),this.nodeFB=Z(hl,se,31,21,0,1),this.cc=new fe,this.urfCubieCube=Z(uo,se,7,6,0,1),this.urfCoordCube=Z(hl,se,31,6,0,1),this.phase1Cubie=Z(uo,se,7,21,0,1),this.preMoveCubes=Z(uo,se,7,21,0,1),this.preMoves=Z(we,ve,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 fe;for(r=0;r<6;r++)this.urfCubieCube[r]=new fe,this.urfCoordCube[r]=new ro;for(e=0;e<20;e++)this.preMoveCubes[e+1]=new fe}to(72,1,{},uu);V.allowShorter=!1;V.conjMask=0;V.depth1=0;V.isRec=!1;V.length1=0;V.maxDep2=0;V.maxPreMoves=0;V.preMoveLen=0;V.probe={l:0,m:0,h:0};V.probeMax={l:0,m:0,h:0};V.probeMin={l:0,m:0,h:0};V.selfSym={l:0,m:0,h:0};V.solLen=0;V.urfIdx=0;V.valid1=0;V.verbose=0;var fu=12,Ls=7,cu=!1;function _e(){if(!cu){cu=!0;var e,t,r,n,o,l;for(Ur=$(J(ee,2),se,10,0,[$(J(ee,1),le,0,7,[8,9,20]),$(J(ee,1),le,0,7,[6,18,38]),$(J(ee,1),le,0,7,[0,36,47]),$(J(ee,1),le,0,7,[2,45,11]),$(J(ee,1),le,0,7,[29,26,15]),$(J(ee,1),le,0,7,[27,44,24]),$(J(ee,1),le,0,7,[33,53,42]),$(J(ee,1),le,0,7,[35,17,51])]),jt=$(J(ee,2),se,10,0,[$(J(ee,1),le,0,7,[5,10]),$(J(ee,1),le,0,7,[7,19]),$(J(ee,1),le,0,7,[3,37]),$(J(ee,1),le,0,7,[1,46]),$(J(ee,1),le,0,7,[32,16]),$(J(ee,1),le,0,7,[28,25]),$(J(ee,1),le,0,7,[30,43]),$(J(ee,1),le,0,7,[34,52]),$(J(ee,1),le,0,7,[23,12]),$(J(ee,1),le,0,7,[21,41]),$(J(ee,1),le,0,7,[50,39]),$(J(ee,1),le,0,7,[48,14])]),qt=Ke(we,[se,ve],[17,0],7,[13,13],2),Rs=$(J(eg,1),se,2,4,["U ","U2","U'","R ","R2","R'","F ","F2","F'","D ","D2","D'","L ","L2","L'","B ","B2","B'"]),Ft=$(J(we,1),ve,0,7,[0,1,2,4,7,9,10,11,13,16,3,5,6,8,12,14,15,17]),dn=Z(we,ve,0,18,7,1),fo=Z(we,ve,0,11,7,1),t=0;t<18;t++)dn[Ft[t]]=t;for(r=0;r<10;r++)for(n=~~(Ft[r]/3),fo[r]=0,o=0;o<10;o++)l=~~(Ft[o]/3),fo[r]|=(n==l||n%3==l%3&&n>=l?1:0)<<o;for(fo[10]=0,e=0;e<13;e++)for(qt[e][0]=qt[e][e]=1,o=1;o<e;o++)qt[e][o]=qt[e-1][o-1]+qt[e-1][o]}}function pn(e,t,r){_e();var n,o,l,i,s;for(n=e.length-1,l=0,s=4,o=n;o>=0;o--)i=gu(e[o],r),(i&12)==t&&(l+=qt[o][s--]);return l}function hs(e,t){_e();var r,n;for(n=0,r=t-2;r>=0;r--)n^=e%(t-r),e=~~(e/(t-r));return n&1}function tt(e,t,r){_e();var n,o,l,i;for(o=0,i={l:1323536,m:2777561,h:1043915},n=0;n<t-1;n++)l=gu(e[n],r)<<2,o=(t-n)*o+br(zt(Br(i,l),{l:15,m:0,h:0})),i=K2(i,fl({l:1118480,m:279620,h:69905},l));return o}function gu(e,t){return t?e>>1:e&7}function mu(e,t,r,n){_e();var o,l,i,s;for(o=e.length-1,s=4,l=o,i=o;i>=0;i--)t>=qt[i][s]?(t-=qt[i][s--],e[i]=Sl(e[i],s|r,n)):((l&12)==r&&(l-=4),e[i]=Sl(e[i],l--,n))}function Er(e,t,r,n){_e();var o,l,i,s,u,a;for(a={l:1323536,m:2777561,h:1043915},o={l:0,m:0,h:0},s=2;s<=r;s++)o=ts(fl(o,4),$i(t%s)),t=~~(t/s);for(l=0;l<r-1;l++)u=(br(o)&15)<<2,o=Br(o,4),e[l]=Sl(e[l],br(zt(Br(a,u),{l:15,m:0,h:0})),n),i=K2(fl({l:1,m:0,h:0},u),{l:1,m:0,h:0}),a=ts(zt(a,i),zt(Br(a,4),{l:~i.l&je,m:~i.m&je,h:~i.h&er}));e[r-1]=Sl(e[r-1],br(zt(a,{l:15,m:0,h:0})),n)}function Sl(e,t,r){return(r?t<<1|e&1:t|e&-8)<<24>>24}function bg(e,t){_e();var r,n,o,l,i,s,u,a;for(l=0;l<8;l++)t.ca[l]=0;for(i=0;i<12;i++)t.ea[i]=0;for(s=0;s<8;s++){for(a=0;a<3&&!(e[Ur[s][a]]==0||e[Ur[s][a]]==3);a++);for(r=e[Ur[s][(a+1)%3]],n=e[Ur[s][(a+2)%3]],u=0;u<8;u++)if(r==~~(Ur[u][1]/9)&&n==~~(Ur[u][2]/9)){t.ca[s]=al(a%3<<3|u);break}}for(o=0;o<12;o++)for(u=0;u<12;u++){if(e[jt[o][0]]==~~(jt[u][0]/9)&&e[jt[o][1]]==~~(jt[u][1]/9)){t.ea[o]=al(u<<1);break}if(e[jt[o][0]]==~~(jt[u][1]/9)&&e[jt[o][1]]==~~(jt[u][0]/9)){t.ea[o]=al(u<<1|1);break}}}var qt,fo,Ur,jt,Rs,dn,Ft;function pu(e,t){var r,n,o;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){o=(t%3+e.moves[e.length_0-1]%3+1)%4,o==3?--e.length_0:e.moves[e.length_0-1]=r*3+o;return}if(e.length_0>1&&r%3==n%3&&r==~~(e.moves[e.length_0-2]/3)){o=(t%3+e.moves[e.length_0-2]%3+1)%4,o==3?(e.moves[e.length_0-2]=e.moves[e.length_0-1],--e.length_0):e.moves[e.length_0-2]=r*3+o;return}e.moves[e.length_0++]=t}function xg(e,t,r,n){e.verbose=t,e.urfIdx=r,e.depth1=n}function du(e){var t,r,n;if(r=new tg,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+=". "),V2(H2(r,(_e(),Rs)[(X(),xl)[n][e.moves[t]]]));else for(t=e.length_0-1;t>=0;t--)V2(H2(r,(_e(),Rs)[(X(),xl)[n][e.moves[t]]])),(e.verbose&1)!=0&&t==e.depth1&&(r.string+=". ");return r.string}function Lu(){this.moves=Z(we,ve,0,31,7,1)}to(150,1,{},Lu);V.depth1=0;V.length_0=0;V.urfIdx=0;V.verbose=0;var we=ul("int","I");tr("com.google.gwt.lang","CollapsedPropertyHolder",252);tr("com.google.gwt.lang","JavaClassHierarchySetupUtil",254);var Sg=tr("com.google.gwt.lang","LongLibBase/LongEmul",null);tr("com.google.gwt.lang","ModuleUtils",257);var ee=ul("byte","B"),vg=ul("long","J"),Ae=ul("char","C");tr("com.google.gwt.user.client.rpc","XsrfToken",null),qc("java.util","Map/Entry");var hu=function(){X2(!1)},Ru=function(e){return Fg(new uu,e)};var wg="UF UR UB UL DF DR DB DL FR FL BR BL".split(" "),Eg="UFR URB UBL ULF DRF DFL DLB DBR".split(" "),Ug="U L F R B D".split(" "),kg=[[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 Au(e,t){return e.slice(t)+e.slice(0,t)}function zg(e){let t=[[],[]];for(let r=0;r<6;r++)if(e.CENTERS.permutation[r]!==r)throw new Error("non-oriented puzzles are not supported");for(let r=0;r<12;r++)t[0].push(Au(wg[e.EDGES.permutation[r]],e.EDGES.orientation[r]));for(let r=0;r<8;r++)t[1].push(Au(Eg[e.CORNERS.permutation[r]],e.CORNERS.orientation[r]));return t.push(Ug),t}function yu(e){let t=zg(e);return kg.map(([r,n,o])=>t[r][n][o]).join("")}he();Rt();function Du(e,t,r){for(let n in e.orbits)if(!Tn(e,n,t,r,{ignoreOrientation:n==="CENTERS"}))return!1;return!0}function Fu(e,t){let r=new Je(e);if(Du(e,r.state,t))return!1;for(let n of"ULFRBD")for(let o=1;o<4;o++)if(r.reset(),r.applyMove(new d(n,o)),Du(e,r.state,t))return!1;return!0}var Bu=[["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"]];function bu(){return D(this,null,function*(){let e=yield kt["3x3x3"].def(),t=new Je(e);for(let r of Bu)t.applyAlg(z.fromString((yield Tt())(r)));return Fu(e,t.state)?t.state:bu()})}function As(e){return D(this,null,function*(){return ct(),z.fromString(Ru(yu(e)))})}function Ln(){return D(this,null,function*(){return As(yield bu())})}function xu(){return D(this,null,function*(){hu()})}var Cg=[[null,"Rw","Rw2","Rw'","Fw","Fw'"],[null,"Dw","Dw2","Dw'"]];function Su(){return D(this,null,function*(){return nn(yield Ln(),Cg)})}var vu=new z("R' U' F");function wu(){return D(this,null,function*(){let e=new at,t=yield Ln();return e.experimentalPushAlg(vu),e.experimentalPushAlg(t),e.experimentalPushAlg(vu),e.toAlg()})}he();var me=[],ys=[1];for(let e=0;e<32;++e){me[e]=[];for(let t=0;t<32;++t)me[e][t]=0}for(let e=0;e<32;++e){me[e][0]=me[e][e]=1,ys[e+1]=ys[e]*(e+1);for(let t=1;t<e;++t)me[e][t]=me[e-1][t-1]+me[e-1][t]}function ae(e,...t){let r=t.length,n=e[t[r-1]];for(let o=r;o>0;o--)e[t[o]]=e[t[o-1]];return e[t[0]]=n,ae}function Eu(e,t,r,n){r=(r||8)-1;let o=1985229328,l=0;n!=null||(n=0),n<0&&(t<<=1);for(let i=0;i<r;++i){let s=ys[r-i],u=~~(t/s);l^=u,t%=s,u<<=2,e[i]=o>>u&7;let a=(1<<u)-1;o=(o&a)+(o>>4&~a)}return n<0&&(l&1)!=0?(e[r]=e[r-1],e[r-1]=o&7):e[r]=o&7,e}function N(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}var H,co={},Mg={},Uu=0,Ds=30,ku=21,Pg=22,Ig=23,zu=24,Gg=25,Ng=34,Tg=26,Fs=40;function _g(e){return new co[e]}function st(e,t,r,...n){let o=co[e];o&&!o.___clazz$?H=o.prototype:(!o&&(o=co[e]=function(){}),H=o.prototype=t<0?{}:_g(t),H.castableTypeMap$=r);for(let l of n)l.prototype=H;o.___clazz$&&(H.___clazz$=o.___clazz$,o.___clazz$=null)}function ur(e){let t={};for(let r=0,n=e.length;r<n;++r)t[e[r]]=1;return t}st(1,-1,Mg);H.value=null;function Cu(){}function Og(e,t){let r=Mu(0,t);return Pu(e.___clazz$,e.castableTypeMap$,e.queryId$,r),r}function Mu(e,t){let r=new Array(t);if(e===3)for(let n=0;n<t;++n){let o={m:0,l:0,h:0};o.l=o.m=o.h=0,r[n]=o}else if(e>0){let n=[null,0,!1][e];for(let o=0;o<t;++o)r[o]=n}return r}function Bs(e,t,r,n,o){let l=Mu(o,n);return Pu(e,t,r,l),l}function Pu(e,t,r,n){return Gu(),Qg(n,bs,xs),n.___clazz$=e,n.castableTypeMap$=t,n.queryId$=r,n}function vl(e,t,r){return e[t]=r}st(73,1,{},Cu);H.queryId$=0;var Iu=!1;function Gu(){Iu||(Iu=!0,bs=[],xs=[],Wg(new Cu,bs,xs))}function Wg(e,t,r){let n=0,o;for(let l in e)(o=e[l])&&(t[n]=l,r[n]=o,++n)}function Qg(e,t,r){Gu();for(let n=0,o=t.length;n<o;++n)e[t[n]]=r[n]}var bs,xs;function qg(e,t){return e.castableTypeMap$&&!!e.castableTypeMap$[t]}function jg(e,t){return e!==null&&qg(e,t)}var Nu=!1;function Kg(){if(Nu)return!1;Nu=!0,zl=N(15582,36),Cl=N(15582),bt=N(15582),An=N(48,48),xt=N(48,36),Rn=N(48),ws=N(48)}function Ss(e){e.ct=N(24)}function Tu(e,t){let r,n;if(jg(t,ku)){for(r=t,n=0;n<24;++n)if(e.ct[n]!==r.ct[n])return!1;return!0}return!1}function wl(e){let t,r,n;for(r=0,n=8,t=23;t>=0;--t)e.ct[t]===1&&(r+=me[t][n--]);return r}function El(e){let t,r;if(hn!==null)return hn[wl(e)];for(r=0;r<48;++r){if(t=Jg(wl(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 Bt(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:Bt(e,19),Bt(e,28);break;case 1:Bt(e,21),Bt(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:Bt(e,18),Bt(e,29),Bt(e,24),Bt(e,35)}}function _u(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 vs(e,t){let r,n;for(n=8,r=23;r>=0;--r)e.ct[r]=0,t>=me[r][n]&&(t-=me[r][n--],e.ct[r]=1)}function Ul(e,t){let r;for(r=0;r<24;++r)e.ct[r]=t.ct[r]}function go(){let e;for(Ss(this),e=0;e<8;++e)this.ct[e]=1;for(e=8;e<24;++e)this.ct[e]=0}function kl(e,t){let r;for(Ss(this),r=0;r<24;++r)this.ct[r]=~~(e.ct[r]/2)===t?1:0}function mo(e){let t;for(Ss(this),t=0;t<24;++t)this.ct[t]=e[t]}function Vg(){let e,t,r=new go,n=new go;for(e=0;e<15582;++e)for(vs(n,Cl[e]),t=0;t<36;++t)Ul(r,n),Bt(r,t),zl[e][t]=El(r)}function Hg(){let e,t,r,n,o,l,i,s;for(Xl(bt),bt[0]=0,t=0,r=1;r!==15582;)for(l=t>4,s=l?-1:t,e=l?t:-1,++t,n=0;n<15582;++n)if(bt[n]===s){for(i=0;i<27;++i)if(o=~~zl[n][i]>>>6,bt[o]===e)if(++r,l){bt[n]=t;break}else bt[o]=t}}function Yg(e){let t,r,n,o=new mo(e.ct);for(n=0;n<48;++n){for(t=!0,r=0;r<24;++r)if(o.ct[r]!==~~(r/4)){t=!1;break}if(t)return n;oe(o,0),n%2==1&&oe(o,1),n%8==7&&oe(o,2),n%16==15&&oe(o,3)}return-1}function Zg(){let e,t,r,n=new go;for(e=0;e<24;++e)n.ct[e]=e;let o=new mo(n.ct),l=new mo(n.ct),i=new mo(n.ct);for(e=0;e<48;++e){for(t=0;t<48;++t){for(r=0;r<48;++r)Tu(n,o)&&(An[e][t]=r,r===0&&(Rn[e]=t)),oe(o,0),r%2==1&&oe(o,1),r%8==7&&oe(o,2),r%16==15&&oe(o,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(Ul(n,l),_u(n,Rn[e]),t=0;t<36;++t)for(Ul(o,n),Bt(o,t),_u(o,e),r=0;r<36;++r)if(Ul(i,l),Bt(i,r),Tu(i,o)){xt[e][t]=r;break}for(vs(n,0),e=0;e<48;++e)ws[Rn[e]]=wl(n),oe(n,0),e%2==1&&oe(n,1),e%8==7&&oe(n,2),e%16==15&&oe(n,3)}function Xg(){let e,t,r,n,o=new go,l=N(22984);for(t=0;t<22984;t++)l[t]=0;for(e=0,t=0;t<735471;++t)if((l[~~t>>>5]&1<<(t&31))==0){for(vs(o,t),n=0;n<48;++n)r=wl(o),l[~~r>>>5]|=1<<(r&31),hn!==null&&(hn[r]=e<<6|Rn[n]),oe(o,0),n%2==1&&oe(o,1),n%8==7&&oe(o,2),n%16==15&&oe(o,3);Cl[e++]=t}}function Jg(e){let t=Tm(Cl,e);return t>=0?t:-1}st(153,1,ur([ku]),go,kl,mo);var bt,zl,ws,hn=null,Cl,Rn,xt,An,Ou=!1;function $g(){Ou||(Ou=!0,Gl=N(70,28),Il=N(6435,28),Vu=N(70,16),ju=N(6435,16),Ve=N(450450),Ku=[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 Ml(e){let t,r,n;for(r=0,n=8,t=14;t>=0;--t)e.ct[t]!==e.ct[15]&&(r+=me[t][n--]);return r}function Pl(e){let t,r,n;for(r=0,n=4,t=6;t>=0;--t)e.rl[t]!==e.rl[7]&&(r+=me[t][n--]);return r*2+e.parity}function yn(e,t){e.parity^=Ku[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 Dn(e,t){switch(t){case 0:yn(e,19),yn(e,28);break;case 1:yn(e,21),yn(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 Wu(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 Qu(e,t){let r,n;for(n=8,e.ct[15]=0,r=14;r>=0;--r)t>=me[r][n]?(t-=me[r][n--],e.ct[r]=1):e.ct[r]=0}function qu(e,t){let r,n;for(e.parity=t&1,t>>>=1,n=4,e.rl[7]=0,r=6;r>=0;--r)t>=me[r][n]?(t-=me[r][n--],e.rl[r]=1):e.rl[r]=0}function Es(){this.rl=N(8),this.ct=N(16)}function em(){let e,t,r,n,o,l,i,s,u,a,f=new Es;for(o=0;o<70;++o)for(s=0;s<28;++s)qu(f,o),yn(f,zr[s]),Gl[o][s]=Pl(f);for(o=0;o<70;++o)for(qu(f,o),i=0;i<16;++i)Vu[o][i]=Pl(f),Dn(f,0),i%2==1&&Dn(f,1),i%8==7&&Dn(f,2);for(o=0;o<6435;++o)for(Qu(f,o),i=0;i<16;++i)ju[o][i]=Ml(f)&65535,Dn(f,0),i%2==1&&Dn(f,1),i%8==7&&Dn(f,2);for(o=0;o<6435;++o)for(s=0;s<28;++s)Qu(f,o),yn(f,zr[s]),Il[o][s]=Ml(f)&65535;for(Xl(Ve),Ve[0]=Ve[18]=Ve[28]=Ve[46]=Ve[54]=Ve[56]=0,r=0,n=6;n!==450450;){let c=r>6,g=c?-1:r,m=c?r:-1;for(++r,o=0;o<450450;++o)if(Ve[o]===g){for(e=~~(o/70),u=o%70,s=0;s<23;++s)if(t=Il[e][s],a=Gl[u][s],l=t*70+a,Ve[l]===m)if(++n,c){Ve[o]=r;break}else Ve[l]=r}}}st(154,1,{},Es);H.parity=0;var Il,Ve,ju,Ku,Gl,Vu,Hu=!1;function tm(){Hu||(Hu=!0,po=N(29400,20),Zu=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1],fr=N(29400),zs=[0,9,14,23,27,28,41,42,46,55,60,69],Cs=N(70))}function Us(e){let t,r,n,o;for(r=0,o=4,t=6;t>=0;--t)e.ud[t]!==e.ud[7]&&(r+=me[t][o--]);for(r*=35,o=4,t=6;t>=0;--t)e.fb[t]!==e.fb[7]&&(r+=me[t][o--]);r*=12;let l=e.fb[7]^e.ud[7];for(n=0,o=4,t=7;t>=0;--t)e.rl[t]!==l&&(n+=me[t][o--]);return e.parity+2*(r+Cs[n])}function rm(e,t){switch(e.parity^=Zu[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 Yu(e,t,r){let n,o=(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^o;e.parity=o^r}function nm(e,t){let r,n,o,l;for(e.parity=t&1,t>>>=1,o=zs[t%12],t=~~(t/12),l=4,r=7;r>=0;--r)e.rl[r]=0,o>=me[r][l]&&(o-=me[r][l--],e.rl[r]=1);for(n=t%35,t=~~(t/35),l=4,e.fb[7]=0,r=6;r>=0;--r)n>=me[r][l]?(n-=me[r][l--],e.fb[r]=1):e.fb[r]=0;for(l=4,e.ud[7]=0,r=6;r>=0;--r)t>=me[r][l]?(t-=me[r][l--],e.ud[r]=1):e.ud[r]=0}function ks(){this.ud=N(8),this.rl=N(8),this.fb=N(8)}function om(){let e,t,r,n;for(r=0;r<12;++r)Cs[zs[r]]=r;let o=new ks;for(r=0;r<29400;++r)for(n=0;n<20;++n)nm(o,r),rm(o,n),po[r][n]=Us(o)&65535;for(Xl(fr),fr[0]=0,e=0,t=1;t!==29400;){for(r=0;r<29400;++r)if(fr[r]===e)for(n=0;n<17;++n)fr[po[r][n]]===-1&&(fr[po[r][n]]=e+1,++t);++e}}st(155,1,{},ks);H.parity=0;var po,Zu,fr,zs,Cs;function lm(e,t){let r;for(r=0;r<24;++r)e.ct[r]=t.ct[r]}function im(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 Ms(){let e;for(this.ct=N(24),e=0;e<24;++e)this.ct[e]=~~(e/4)}function Xu(e){let t,r,n;for(Ms.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)}st(156,1,{},Ms,Xu);var Ju=!1;function sm(){Ju||(Ju=!0,mt=N(18),fm())}function $u(e){e.cp=[0,1,2,3,4,5,6,7],e.co=[0,0,0,0,0,0,0,0]}function ef(e,t){let r;for(r=0;r<8;++r)e.cp[r]=t.cp[r],e.co[r]=t.co[r]}function am(e,t){!e.temps&&(e.temps=new Nl),tf(e,mt[t],e.temps),ef(e,e.temps)}function um(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 tf(e,t,r){let n,o,l,i;for(n=0;n<8;++n)r.cp[n]=e.cp[t.cp[n]],l=e.co[t.cp[n]],i=t.co[n],o=l,o=o+(l<3?i:6-i),o=o%3,(l>=3?1:0)^(i>=3?1:0)&&(o=o+3),r.co[n]=o}function Nl(){$u(this)}function cr(e,t){$u(this),Eu(this.cp,e),um(this,t)}function rf(e){cr.call(this,e(40320),e(2187))}function fm(){let e,t;for(mt[0]=new cr(15120,0),mt[3]=new cr(21021,1494),mt[6]=new cr(8064,1236),mt[9]=new cr(9,0),mt[12]=new cr(1230,412),mt[15]=new cr(224,137),e=0;e<18;e+=3)for(t=0;t<2;++t)mt[e+t+1]=new Nl,tf(mt[e+t],mt[e],mt[e+t+1])}st(157,1,ur([Pg]),Nl,cr,rf);H.temps=null;var mt,nf=!1;function cm(){nf||(nf=!0,St=N(1937880),Wl=N(1538),Ql=N(1538),Sn=N(11880),ff=[0,1,6,3,4,5,2,7],Ns=N(160,12),Ts=N(160,12),Gs=[1,1,1,3,12,60,360,2520,20160,181440,1814400,19958400,239500800],Is=[0,2,4,6,1,3,7,5,8,9,10,11])}function Fn(e,t,r,n,o){let l=e.edgeo[o];e.edgeo[o]=e.edge[n],e.edge[n]=e.edgeo[r],e.edgeo[r]=e.edge[t],e.edge[t]=l}function Bn(e,t){let r,n,o,l,i;for(e.isStd||af(e),n=0,i=1985229328,l=47768,r=0;r<t;++r)o=e.edge[r]<<2,n*=12-r,o>=32?(n+=l>>o-32&15,l-=4368<<o-32):(n+=i>>o&15,l-=4369,i-=286331152<<o);return n}function of(e){let t,r=Bn(e,4);t=Sn[r];let n=t&7;t>>=3,_l(e,n);let o=Bn(e,10)%20160;return t*20160+o}function Tl(e,t){switch(e.isStd=!1,t){case 0:ae(e.edge,0,4,1,5),ae(e.edgeo,0,4,1,5);break;case 1:Le(e.edge,0,4,1,5),Le(e.edgeo,0,4,1,5);break;case 2:ae(e.edge,0,5,1,4),ae(e.edgeo,0,5,1,4);break;case 3:Le(e.edge,5,10,6,11),Le(e.edgeo,5,10,6,11);break;case 4:ae(e.edge,0,11,3,8),ae(e.edgeo,0,11,3,8);break;case 5:Le(e.edge,0,11,3,8),Le(e.edgeo,0,11,3,8);break;case 6:ae(e.edge,0,8,3,11),ae(e.edgeo,0,8,3,11);break;case 7:ae(e.edge,2,7,3,6),ae(e.edgeo,2,7,3,6);break;case 8:Le(e.edge,2,7,3,6),Le(e.edgeo,2,7,3,6);break;case 9:ae(e.edge,2,6,3,7),ae(e.edgeo,2,6,3,7);break;case 10:Le(e.edge,4,8,7,9),Le(e.edgeo,4,8,7,9);break;case 11:ae(e.edge,1,9,2,10),ae(e.edgeo,1,9,2,10);break;case 12:Le(e.edge,1,9,2,10),Le(e.edgeo,1,9,2,10);break;case 13:ae(e.edge,1,10,2,9),ae(e.edgeo,1,10,2,9);break;case 14:Le(e.edge,0,4,1,5),Le(e.edgeo,0,4,1,5),ae(e.edge,9,11),ae(e.edgeo,8,10);break;case 15:Le(e.edge,5,10,6,11),Le(e.edgeo,5,10,6,11),ae(e.edge,1,3),ae(e.edgeo,0,2);break;case 16:Le(e.edge,0,11,3,8),Le(e.edgeo,0,11,3,8),ae(e.edge,5,7),ae(e.edgeo,4,6);break;case 17:Le(e.edge,2,7,3,6),Le(e.edgeo,2,7,3,6),ae(e.edge,8,10),ae(e.edgeo,9,11);break;case 18:Le(e.edge,4,8,7,9),Le(e.edgeo,4,8,7,9),ae(e.edge,0,2),ae(e.edgeo,1,3);break;case 19:Le(e.edge,1,9,2,10),Le(e.edgeo,1,9,2,10),ae(e.edge,4,6),ae(e.edgeo,5,7)}}function bn(e,t){switch(e.isStd=!1,t){case 0:Tl(e,14),Tl(e,17);break;case 1:Fn(e,11,5,10,6),Fn(e,5,10,6,11),Fn(e,1,2,3,0),Fn(e,4,9,7,8),Fn(e,8,4,9,7),Fn(e,0,1,2,3);break;case 2:pt(e,4,5),pt(e,5,4),pt(e,11,8),pt(e,8,11),pt(e,7,6),pt(e,6,7),pt(e,9,10),pt(e,10,9),pt(e,1,1),pt(e,0,0),pt(e,3,3),pt(e,2,2)}}function _l(e,t){for(;t>=2;)t-=2,bn(e,1),bn(e,2);t!==0&&bn(e,0)}function Lo(e,t){let r,n,o,l,i,s;for(i=1985229328,s=47768,o=0,r=0;r<11;++r)if(n=Gs[11-r],l=~~(t/n),t=t%n,o^=l,l<<=2,l>=32){l=l-32,e.edge[r]=s>>l&15;let u=(1<<l)-1;s=(s&u)+(s>>4&~u)}else{e.edge[r]=i>>l&15;let u=(1<<l)-1;i=(i&u)+(i>>>4&~u)+(s<<28),s=s>>4}for((o&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 lf(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 sf(e,t){let r,n,o,l;for(e.temp===null&&(e.temp=N(12)),r=0;r<12;++r)e.temp[r]=r,e.edge[r]=t.ep[Is[r]+12]%12;for(n=1,r=0;r<12;++r)for(;e.edge[r]!==r;)l=e.edge[r],e.edge[r]=e.edge[l],e.edge[l]=l,o=e.temp[r],e.temp[r]=e.temp[l],e.temp[l]=o,n^=1;for(r=0;r<12;++r)e.edge[r]=e.temp[t.ep[Is[r]]%12];return n}function af(e){let t;for(e.temp===null&&(e.temp=N(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 Le(e,t,r,n,o){let l;l=e[t],e[t]=e[n],e[n]=l,l=e[r],e[r]=e[o],e[o]=l}function pt(e,t,r){let n=e.edge[t];e.edge[t]=e.edgeo[r],e.edgeo[r]=n}function Kt(){this.edge=N(12),this.edgeo=N(12)}function gm(){let e,t,r,n,o,l,i,s,u,a,f,c,g,m,L,p,y,F,x,B,M,k,K=new Kt,te=new Kt,T=new Kt;for(Xl(St),s=0,Ol=1,Ps(St,0,0);Ol!==31006080&&(L=s>9,i=s%3,l=(s+1)%3,a=L?3:i,e=L?i:3,!(s>=9));){for(c=0;c<31006080;c+=16)if(k=St[~~c>>4],!(!L&&k===-1)){for(f=c,u=c+16;f<u;++f,k>>=2)if((k&3)===a){for(x=~~(f/20160),t=Wl[x],n=f%20160,Lo(K,t*20160+n),y=0;y<17;++y)if(r=xn(K.edge,y<<3,4),B=Sn[r],M=B&7,B>>=3,o=xn(K.edge,y<<3|M,10)%20160,g=B*20160+o,ho(St,g)===e){if(Ps(St,L?f:g,l),++Ol,L)break;if(F=Ql[B],F!==1)for(lf(te,K),Tl(te,y),_l(te,M),p=1;(F=~~F>>1&65535)!=0;++p)(F&1)==1&&(lf(T,te),_l(T,p),m=B*20160+Bn(T,10)%20160,ho(St,m)===e&&(Ps(St,m,l),++Ol))}}}++s}}function ho(e,t){return e[t>>4]>>((t&15)<<1)&3}function xn(e,t,r){let n,o,l,i,s,u=Ts[t],a=Ns[t];for(o=0,s=1985229328,i=47768,n=0;n<r;++n)l=u[e[a[n]]]<<2,o*=12-n,l>=32?(o+=i>>l-32&15,i-=4368<<l-32):(o+=s>>l&15,i-=4369,s-=286331152<<l);return o}function uf(e){let t,r,n,o,l,i,s,u,a,f,c,g=new Kt;if(i=0,l=ho(St,e),l===3)return 10;for(;e!==0;)for(l===0?l=2:--l,a=~~(e/20160),t=Wl[a],n=e%20160,Lo(g,t*20160+n),u=0;u<17;++u)if(r=xn(g.edge,u<<3,4),f=Sn[r],c=f&7,f>>=3,o=xn(g.edge,u<<3|c,10)%20160,s=f*20160+o,ho(St,s)===l){++i,e=s;break}return i}function mm(e,t){let r=ho(St,e);return r===3?10:(1227133513<<r>>t&3)+t-1}function pm(){let e,t,r,n=new Kt;for(t=0;t<20;++t)for(r=0;r<8;++r){for(Lo(n,0),Tl(n,t),_l(n,r),e=0;e<12;++e)Ns[t<<3|r][e]=n.edge[e];for(af(n),e=0;e<12;++e)Ts[t<<3|r][e]=n.temp[e]}}function dm(){let e,t,r,n,o=new Kt,l=N(1485);for(t=0;t<1485;t++)l[t]=0;for(e=0,t=0;t<11880;++t)if((l[~~t>>>3]&1<<(t&7))==0){for(Lo(o,t*Gs[8]),n=0;n<8;++n)r=Bn(o,4),r===t&&(Ql[e]=(Ql[e]|1<<n)&65535),l[~~r>>3]=l[~~r>>3]|1<<(r&7),Sn[r]=e<<3|ff[n],bn(o,0),n%2==1&&(bn(o,1),bn(o,2));Wl[e++]=t}}function Ps(e,t,r){e[t>>4]^=(3^r)<<((t&15)<<1)}st(158,1,ur([Ig]),Kt);H.isStd=!0;H.temp=null;var Is,Ol=0,St,Gs,Ns,Ts,Sn,Wl,ff,Ql,cf=!1;function Lm(){cf||(cf=!0)}function hm(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 Rm(e,t){let r;for(r=0;r<24;++r)e.ep[r]=t.ep[r]}function Am(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 _s(){let e;for(this.ep=N(24),e=0;e<24;++e)this.ep[e]=e}function gf(e){let t,r,n;for(_s.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)}st(159,1,{},_s,gf);var mf=!1;function ym(){mf||(mf=!0,Os=[35,1,34,2,4,6,22,5,19])}function pf(e){e.moveBuffer=N(60)}function Dm(e,t){return e.value-t.value}function vn(e,t){let r;for(Rm(e.edge,t.edge),lm(e.center,t.center),ef(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 gr(e){for(;e.centerAvail<e.moveLength;)im(e.center,e.moveBuffer[e.centerAvail++]);return e.center}function df(e){for(;e.cornerAvail<e.moveLength;)am(e.corner,e.moveBuffer[e.cornerAvail++]%18);return e.corner}function Ro(e){for(;e.edgeAvail<e.moveLength;)Am(e.edge,e.moveBuffer[e.edgeAvail++]);return e.edge}function Fm(e){let t,r,n,o,l,i,s=new Array(e.moveLength-(e.add1?2:0));for(r=0,t=0;t<e.length1;++t)s[r++]=e.moveBuffer[t];for(i=e.sym,t=e.length1+(e.add1?2:0);t<e.moveLength;++t)xt[i][e.moveBuffer[t]]>=27?(s[r++]=xt[i][e.moveBuffer[t]]-9,o=Os[xt[i][e.moveBuffer[t]]-27],i=An[i][o]):s[r++]=xt[i][e.moveBuffer[t]];let u=An[Rn[i]][Yg(gr(e))];for(l="",i=u,t=r-1;t>=0;--t)n=s[t],n=~~(n/3)*3+(2-n%3),xt[i][n]>=27?(l=l+Ws[xt[i][n]-9]+" ",o=Os[xt[i][n]-27],i=An[i][o]):l=l+Ws[xt[i][n]]+" ";return l}function kr(e,t){e.moveBuffer[e.moveLength++]=t}function ql(){pf(this),this.edge=new _s,this.center=new Ms,this.corner=new Nl}function jl(e){ql.call(this),vn(this,e)}function Lf(e){pf(this),this.edge=new gf(e),this.center=new Xu(e),this.corner=new rf(e)}st(160,1,ur([zu,Ng]),ql,jl,Lf);H.compareTo$=function(t){return Dm(this,t)};H.add1=!1;H.center=null;H.centerAvail=0;H.corner=null;H.cornerAvail=0;H.edge=null;H.edgeAvail=0;H.length1=0;H.length2=0;H.length3=0;H.moveLength=0;H.sym=0;H.value=0;var Os;function Bm(e,t){return t.value-e.value}function Kl(e,t){return Bm(e,t)}function hf(){}st(161,1,{},hf);H.compare=function(t,r){return Kl(t,r)};var Rf=!1;function bm(){if(Rf)return;Rf=!0;let e,t;for(Ws=["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'"],zr=[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],Ao=[0,1,2,4,6,7,8,9,10,11,13,15,16,17,19,22,25,28,31,34,36],Af=N(37),yf=N(37),wn=N(37,36),Vl=N(29,28),Hl=N(21,20),Qs=N(36),yo=N(28),En=N(20),e=0;e<29;++e)Af[zr[e]]=e;for(e=0;e<21;++e)yf[Ao[e]]=e;for(e=0;e<36;++e){for(t=0;t<36;++t)wn[e][t]=~~(e/3)==~~(t/3)||~~(e/3)%3==~~(t/3)%3&&e>t;wn[36][e]=!1}for(e=0;e<29;++e)for(t=0;t<28;++t)Vl[e][t]=wn[zr[e]][zr[t]];for(e=0;e<21;++e)for(t=0;t<20;++t)Hl[e][t]=wn[Ao[e]][Ao[t]];for(e=0;e<36;++e)for(Qs[e]=36,t=e;t<36;++t)if(!wn[e][t]){Qs[e]=t-1;break}for(e=0;e<28;++e)for(yo[e]=28,t=e;t<28;++t)if(!Vl[e][t]){yo[e]=t-1;break}for(e=0;e<20;++e)for(En[e]=20,t=e;t<20;++t)if(!Hl[e][t]){En[e]=t-1;break}}var wn,Vl,Hl,zr,Ws,Ao,Qs,yo,En,Af,yf;function xm(e){let t,r,n,o,l,i,s,u,a,f,c,g;e.solution="";let m=El(new kl(gr(e.c),0)),L=El(new kl(gr(e.c),1)),p=El(new kl(gr(e.c),2)),y=bt[~~m>>6],F=bt[~~L>>6],x=bt[~~p>>6];for(e.p1SolsCnt=0,e.arr2idx=0,Mm(e.p1sols.heap),e.length1=(y<F?y:F)<x?y<F?y:F:x;e.length1<100&&!(x<=e.length1&&Yl(e,~~p>>>6,p&63,e.length1,-1,0)||y<=e.length1&&Yl(e,~~m>>>6,m&63,e.length1,-1,0)||F<=e.length1&&Yl(e,~~L>>>6,L&63,e.length1,-1,0));++e.length1);let B=jm(e.p1sols,Bs(Vm,ur([Gg,Ds,Fs]),zu,0,0));B.sort(function(K,te){return K.value-te.value}),t=9;do{e:for(u=B[0].value;u<100;++u)for(i=0;i<B.length&&!(B[i].value>u);++i)if(!(u-B[i].length1>t)&&(vn(e.c1,B[i]),Wu(e.ct2,gr(e.c1),Zl(Ro(e.c1).ep)),c=Ml(e.ct2),g=Pl(e.ct2),e.length1=B[i].length1,e.length2=u-B[i].length1,Df(e,c,g,e.length2,28,0)))break e;++t}while(u===100);e.arr2.sort(function(K,te){return K.value-te.value}),s=0,r=13;do{e:for(a=e.arr2[0].value;a<100;++a)for(i=0;i<Math.min(e.arr2idx,100)&&!(e.arr2[i].value>a);++i)if(!(a-e.arr2[i].length1-e.arr2[i].length2>r)&&(l=sf(e.e12,Ro(e.arr2[i])),Yu(e.ct3,gr(e.arr2[i]),l^Zl(df(e.arr2[i]).cp)),n=Us(e.ct3),o=Bn(e.e12,10),f=uf(of(e.e12)),f<=a-e.arr2[i].length1-e.arr2[i].length2&&Ff(e,o,n,f,a-e.arr2[i].length1-e.arr2[i].length2,20,0))){s=i;break e}++r}while(a===100);let M=new jl(e.arr2[s]);e.length1=M.length1,e.length2=M.length2;let k=a-e.length1-e.length2;for(i=0;i<k;++i)kr(M,Ao[e.move3[i]]);e.solution=Fm(M)}function Sm(e,t){let r,n;for(vn(e.c1,e.c),r=0;r<e.length1;++r)kr(e.c1,e.move1[r]);switch(ws[t]){case 0:kr(e.c1,24),kr(e.c1,35),e.move1[e.length1]=24,e.move1[e.length1+1]=35,e.add1=!0,t=19;break;case 12869:kr(e.c1,18),kr(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}Wu(e.ct2,gr(e.c1),Zl(Ro(e.c1).ep));let o=Ml(e.ct2),l=Pl(e.ct2),i=Ve[o*70+l];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 jl(e.c1):(n=Qm(e.p1sols),n.value>e.c1.value&&vn(n,e.c1)),km(e.p1sols,n),e.p1SolsCnt===1e4}function vm(e){let t;for(vn(e.c2,e.c1),t=0;t<e.length2;++t)kr(e.c2,e.move2[t]);if(!hm(Ro(e.c2)))return!1;let r=sf(e.e12,Ro(e.c2));Yu(e.ct3,gr(e.c2),r^Zl(df(e.c2).cp));let n=Us(e.ct3);Bn(e.e12,10);let o=uf(of(e.e12));return e.arr2[e.arr2idx]?vn(e.arr2[e.arr2idx],e.c2):e.arr2[e.arr2idx]=new jl(e.c2),e.arr2[e.arr2idx].value=e.length1+e.length2+Math.max(o,fr[n]),e.arr2[e.arr2idx].length2=e.length2,++e.arr2idx,e.arr2idx===e.arr2.length}function wm(e,t){return bf(),e.c=new Lf(t),xm(e),e.solution}function Yl(e,t,r,n,o,l){let i,s,u,a,f,c;if(t===0)return n===0&&Sm(e,r);for(i=0;i<27;i+=3)if(!(i===o||i===o-9||i===o-18))for(a=0;a<3;++a){if(u=i+a,s=zl[t][xt[r][u]],f=bt[~~s>>>6],f>=n){if(f>n)break;continue}if(c=An[r][s&63],s>>>=6,e.move1[l]=u,Yl(e,s,c,n-1,i,l+1))return!0}return!1}function Df(e,t,r,n,o,l){let i,s,u,a;if(t===0&&Ve[r]===0)return n===0&&vm(e);for(s=0;s<23;++s){if(Vl[o][s]){s=yo[s];continue}if(i=Il[t][s],a=Gl[r][s],u=Ve[i*70+a],u>=n){u>n&&(s=yo[s]);continue}if(e.move2[l]=zr[s],Df(e,i,a,n-1,s,l+1))return!0}return!1}function Ff(e,t,r,n,o,l,i){let s,u,a,f,c,g,m,L,p;if(o===0)return t===0&&r===0;for(Lo(e.tempe[i],t),c=0;c<17;++c){if(Hl[l][c]){c=En[c];continue}if(a=po[r][c],g=fr[a],g>=o){g>o&&c<14&&(c=En[c]);continue}if(f=xn(e.tempe[i].edge,c<<3,10),s=~~(f/20160),L=Sn[s],p=L&7,L>>=3,u=xn(e.tempe[i].edge,c<<3|p,10)%20160,m=mm(L*20160+u,n),m>=o){m>o&&c<14&&(c=En[c]);continue}if(Ff(e,f,a,m,o-1,c,i+1))return e.move3[i]=c,!0}return!1}function Bf(){let e;for(this.p1sols=new zf(new hf),this.move1=N(15),this.move2=N(20),this.move3=N(20),this.c1=new ql,this.c2=new ql,this.ct2=new Es,this.ct3=new ks,this.e12=new Kt,this.tempe=N(20),this.arr2=N(100),e=0;e<20;++e)this.tempe[e]=new Kt}function bf(){xf||(Zg(),hn=N(735471),Xg(),Vg(),hn=null,Hg(),em(),om(),pm(),dm(),gm(),xf=!0)}st(163,1,ur([Tg]),Bf);H.add1=!1;H.arr2idx=0;H.c=null;H.length1=0;H.length2=0;H.p1SolsCnt=0;H.solution="";var xf=!1,Sf=!1;function Em(){Sf||(Sf=!0)}function Zl(e){let t,r,n,o;for(o=0,t=0,n=e.length;t<n;++t)for(r=t;r<n;++r)e[t]>e[r]&&(o^=1);return o}function h(e,t,r,n,o,l){let i;switch(l){case 0:i=e[o],e[o]=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[o],e[o]=i;return;case 2:i=e[t],e[t]=e[r],e[r]=e[n],e[n]=e[o],e[o]=i;return}}function vf(){}function wf(e,t,r,n){let o=new vf;return o.typeName=e+t,Uf(r!==0?-r:0)&&kf(r!==0?-r:0,o),o.modifiers=4,o.superclass=qs,o.componentType=n,o}function Ef(e,t,r,n){let o=new vf;return o.typeName=e+t,Uf(r)&&kf(r,o),o.superclass=n,o}function Um(e){let t=co[e.seedId];return e=null,t}function Uf(e){return typeof e=="number"&&e>0}function kf(e,t){let r;if(t.seedId=e,e===2)r=String.prototype;else if(e>0){let n=Um(t);if(n)r=n.prototype;else{n=co[e]=function(){},n.___clazz$=t;return}}else return;r.___clazz$=t}H.val$outerIter=null;function km(e,t){if(Wm(e,t))return!0}function zm(e){e.array=Bs(Cf,ur([Ds,Fs]),Uu,0,0)}function Cm(e,t){return vl(e.array,e.size++,t),!0}function Mm(e){e.array=Bs(Cf,ur([Ds,Fs]),Uu,0,0),e.size=0}function mr(e,t){return e.array[t]}function Pm(e,t){let r=e.array[t];return Nm(e.array,t,1),--e.size,r}function Un(e,t,r){let n=e.array[t];return vl(e.array,t,r),n}function Im(e,t){let r;for(t.length<e.size&&(t=Og(t,e.size)),r=0;r<e.size;++r)vl(t,r,e.array[r]);return t.length>e.size&&vl(t,e.size,null),t}function Gm(){zm(this),this.array.length=500}function Nm(e,t,r){e.splice(t,r)}H.size=0;function Tm(e,t){let r,n,o,l;for(n=0,r=e.length-1;n<=r;)if(o=n+(~~(r-n)>>1),l=e[o],l<t)n=o+1;else if(l>t)r=o-1;else return o;return-n-1}function Xl(e){_m(e,e.length)}function _m(e,t){let r;for(r=0;r<t;++r)e[r]=-1}function Om(e,t){let r,n,o,l,i=e.heap.size,s=mr(e.heap,t);for(;t*2+1<i&&(r=(n=2*t+1,o=n+1,l=n,o<i&&Kl(mr(e.heap,o),mr(e.heap,n))<0&&(l=o),l),!(Kl(s,mr(e.heap,r))<0));)Un(e.heap,t,mr(e.heap,r)),t=r;Un(e.heap,t,s)}function Wm(e,t){let r,n;for(n=e.heap.size,Cm(e.heap,t);n>0;){if(r=n,n=~~((n-1)/2),Kl(mr(e.heap,n),t)<=0)return Un(e.heap,r,t),!0;Un(e.heap,r,mr(e.heap,n))}return Un(e.heap,n,t),!0}function Qm(e){if(e.heap.size===0)return null;let t=mr(e.heap,0);return qm(e),t}function qm(e){let t=Pm(e.heap,e.heap.size-1);0<e.heap.size&&(Un(e.heap,0,t),Om(e,0))}function jm(e,t){return Im(e.heap,t)}function zf(e){this.heap=new Gm,this.cmp=e}st(239,1,{},zf);H.cmp=null;H.heap=null;var qs=Ef("java.lang.","Object",1,null),Cf=wf("[Ljava.lang.","Object;",356,qs),Km=Ef("cs.threephase.","FullCube",160,qs),Vm=wf("[Lcs.threephase.","FullCube;",381,Km),Mf,Pf=!1;function If(){Pf||(Pf=!0,bm(),Em(),Kg(),$g(),tm(),cm(),sm(),Lm(),ym(),Mf=new Bf)}function js(){If(),bf()}function Do(){return D(this,null,function*(){ct(),If();let e=z.fromString(wm(Mf,yield it()));return(yield Ln()).concat(e)})}var Hm=[[null,"x","x2","x'","z","z'"],[null,"y","y2","y'"]];function Gf(){return D(this,null,function*(){return nn(yield Do(),Hm)})}Hs();var Xm=2,_f=null;function Jm(){return D(this,null,function*(){return _f||(_f=(()=>D(this,null,function*(){let t=yield(yield Promise.resolve().then(()=>(Hs(),Tf))).cachedSGSDataMegaminx();return new _t(yield Jl(),t,["U","R","F","L","BR","BL","FR","FL","DR","DL","B","D"])}))())})}function Of(e){return D(this,null,function*(){ct();let t=yield Jm(),r=JSON.parse(JSON.stringify(e));return r.CENTERS.orientation=new Array(12).fill(0),yield t.solve(r,Xm,()=>5)})}rn();Xs();var ep=3,qf=null;function tp(){return D(this,null,function*(){return qf||(qf=(()=>D(this,null,function*(){let t=yield(yield Promise.resolve().then(()=>(Xs(),Qf))).sgsDataPyraminx();return new _t(yield kt.pyraminx.def(),t,"RLUB".split(""))}))())})}function Js(e){return D(this,null,function*(){return ct(),yield(yield tp()).solve(e,ep,()=>3)})}function rp(){return D(this,null,function*(){return il(yield kt.pyraminx.def(),yield Zs())})}function jf(){return D(this,null,function*(){return Js(yield rp())})}ra();var lp=3,Hf=null;function ip(){return D(this,null,function*(){return Hf||(Hf=(()=>D(this,null,function*(){let e=yield Promise.resolve().then(()=>(ra(),Vf)),t=yield e.sgsDataSkewb();return new _t(yield e.skewbDefWithoutMOCached(),t,"RLUB".split(""))}))())})}function sp(e){return{CORNERS:e.CORNERS,CENTERS:{permutation:e.CENTERS.permutation,orientation:new Array(6).fill(0)}}}function na(e){return D(this,null,function*(){return ct(),yield(yield ip()).solve(sp(e),lp,n=>n.family==="y"?4:3)})}function ap(){return D(this,null,function*(){return il(yield $l(),yield ta())})}function Yf(){return D(this,null,function*(){return na(yield ap())})}he();function up(e){switch(e){case 5:return 60;case 6:return 80;default:return 100}}var fp=[["U","D"],["L","R"],["F","B"]],Zf=new Map;function cp(e){let t=Zf.get(e);if(t)return t;let r=[];for(let n of fp){let o=[];r.push(o);for(let l of n){o.push(new G(l)),e>3&&o.push(new G(\`\${l}w\`));for(let i=3;i<=e/2;i++)o.push(new G(\`\${l}w\`,i))}}return Zf.set(e,r),r}function Vt(e){return D(this,null,function*(){let t=yield it(),r=yield Tt(),n=r,o=cp(e),l=up(e),i=new at,s=0,u=new Set;for(;i.experimentalNumUnits()<l;){let a=t(3);a!==s&&u.clear(),s=a;let f=r(o[s]),c=f.toString();u.has(c)||(u.add(c),i.push(new d(f,n([1,2,-1]))))}return i.toAlg()})}var gp=[[null,"3Rw","3Rw2","3Rw'","3Fw","3Fw'"],[null,"3Dw","3Dw2","3Dw'"]];function Xf(){return D(this,null,function*(){return nn(yield Vt(5),gp)})}he();function mp(e,t){e.ul=t.ul,e.ur=t.ur,e.dl=t.dl,e.dr=t.dr,e.ml=t.ml}function Jf(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 pp(e){var t,r,n,o,l;for(n=0,e.arr[0]=Ct(e,0),o=1;o<24;++o)Ct(e,o)!=e.arr[n]&&(e.arr[++n]=Ct(e,o));for(l=0,t=0;t<16;++t)for(r=t+1;r<16;++r)e.arr[t]>e.arr[r]&&(l^=1);return l}function dp(e){var t,r,n,o;return o=e.ur&1118481,o|=~~o>>3,o|=~~o>>6,o=o&15|~~o>>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,Fo(pp(e)<<24|n<<18|o<<12|t<<6|r)}function Lp(e,t){var r,n;for(r=0;r<8;++r)e.prm[r]=~~(~~Ct(e,r*3+1)>>1<<24)>>24;for(t.cornperm=So(e.prm),t.topEdgeFirst=Ct(e,0)==Ct(e,1),r=t.topEdgeFirst?2:0,n=0;n<4;r+=3,++n)e.prm[n]=~~(~~Ct(e,r)>>1<<24)>>24;for(t.botEdgeFirst=Ct(e,12)==Ct(e,13),r=t.botEdgeFirst?14:12;n<8;r+=3,++n)e.prm[n]=~~(~~Ct(e,r)>>1<<24)>>24;t.edgeperm=So(e.prm),t.ml=e.ml}function Ct(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 oa(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 la(){this.arr=[],this.prm=[]}function hp(){return D(this,null,function*(){let e=yield it();var t,r,n,o,l,i,s,u,a;for(t=new la,n=kn[e(3678)],l=19088743<<1|286331153,o=19088743<<1,s=i=8,r=0;r<24;r++)(n>>r&1)==0?(u=e(i)<<2,oa(t,23-r,o>>u&15),a=(1<<u)-1,o=(o&a)+(o>>4&~a),--i):(u=e(s)<<2,oa(t,23-r,l>>u&15),oa(t,22-r,l>>u&15),a=(1<<u)-1,l=(l&a)+(l>>4&~a),--s,++r);return t.ml=e(2),t})}function Rp(){}var be=la.prototype=Rp.prototype;be.dl=10062778;be.dr=14536702;be.ml=0;be.ul=70195;be.ur=4544119;function Ap(e){var t,r,n,o,l,i;for(mp(e.Search_d,e.Search_c),n=0;n<e.Search_length1;++n)Jf(e.Search_d,e.Search_move[n]);for(Lp(e.Search_d,e.Search_sq),r=e.Search_sq.edgeperm,t=e.Search_sq.cornperm,l=e.Search_sq.ml,i=Math.max(ye[e.Search_sq.edgeperm<<1|l],ye[e.Search_sq.cornperm<<1|l]),n=i;n<e.Search_maxlen2;++n)if(ti(e,r,t,e.Search_sq.topEdgeFirst,e.Search_sq.botEdgeFirst,l,n,e.Search_length1,0)){for(o=0;o<n;++o)Jf(e.Search_d,e.Search_move[e.Search_length1+o]);return e.Search_sol_string=yp(e,n+e.Search_length1),!0}return!1}function yp(e,t){for(var r="",n=0,o=0,l=t-1;l>=0;l--){var i=e.Search_move[l];i>0?(i=12-i,n=i>6?i-12:i):i<0?(i=12+i,o=i>6?i-12:i):(n==0&&o==0?r+=" / ":r+="("+n+", "+o+") / ",n=o=0)}return(n!==0||o!==0)&&(r+="("+n+", "+o+")"),r}function ei(e,t,r,n,o,l){var i,s,u;if(r==0&&n<4)return n==0&&Ap(e);if(l!=0&&(u=ri[t],s=Ee[u],s<n&&(e.Search_move[o]=0,ei(e,u,s,n-1,o+1,0))))return!0;if(u=t,l<=0){for(i=0;i+=bo[u],u=~~i>>4,i&=15,!(i>=12||(s=Ee[u],s>n));)if(s<n&&(e.Search_move[o]=i,ei(e,u,s,n-1,o+1,1)))return!0}if(u=t,l<=1){for(i=0;i+=Bo[u],u=~~i>>4,i&=15,!(i>=6||(s=Ee[u],s>n));)if(s<n&&(e.Search_move[o]=-i,ei(e,u,s,n-1,o+1,2)))return!0}return!1}function ti(e,t,r,n,o,l,i,s,u){var a,f,c,g,m,L,p;if(i==0&&!n&&o||u!=0&&n==o&&(c=vo[t],f=vo[r],ye[c<<1|1-l]<i&&ye[f<<1|1-l]<i&&(e.Search_move[s]=0,ti(e,c,f,n,o,1-l,i-1,s+1,0))))return!0;if(u<=0)for(p=!n,c=p?Pr[t]:t,f=p?r:Pr[r],g=p?1:2,m=ye[c<<1|l],L=ye[f<<1|l];g<12&&m<=i&&m<=i;){if(m<i&&L<i&&(e.Search_move[s]=g,ti(e,c,f,p,o,l,i-1,s+1,1)))return!0;p=!p,p?(c=Pr[c],m=ye[c<<1|l],g+=1):(f=Pr[f],L=ye[f<<1|l],g+=2)}if(u<=1)for(a=!o,c=a?Cr[t]:t,f=a?r:Cr[r],g=a?1:2,m=ye[c<<1|l],L=ye[f<<1|l];g<(i>3?6:12)&&m<=i&&m<=i;){if(m<i&&L<i&&(e.Search_move[s]=-g,ti(e,c,f,n,a,l,i-1,s+1,2)))return!0;a=!a,a?(c=Cr[c],m=ye[c<<1|l],g+=1):(f=Cr[f],L=ye[f<<1|l],g+=2)}return!1}function Dp(e,t){var r;for(e.Search_c=t,r=dp(t),e.Search_length1=Ee[r];e.Search_length1<100&&(e.Search_maxlen2=Math.min(31-e.Search_length1,17),!ei(e,r,Ee[r],e.Search_length1,0,-1));++e.Search_length1);return e.Search_sol_string}function $f(){this.Search_move=[],this.Search_d=new la,this.Search_sq=new n1}function Fp(){}be=$f.prototype=Fp.prototype;be.Search_c=null;be.Search_length1=0;be.Search_maxlen2=0;be.Search_sol_string=null;var e1=!1;function Bp(){e1||(e1=!0,xo=[0,3,6,12,15,24,27,30,48,51,54,60,63],kn=[],Ee=[],bo=[],Bo=[],ri=[],Sp())}function bp(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((Ir(e.bottom&63)&1)!=0);return(Ir(e.bottom)&2)==0&&(e.Shape_parity^=r),t}function ia(e){var t;return t=l1(kn,e.top<<12|e.bottom)<<1|e.Shape_parity,t}function sa(e,t){e.Shape_parity=t&1,e.top=kn[~~t>>1],e.bottom=e.top&4095,e.top>>=12}function xp(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((Ir(e.top&63)&1)!=0);return(Ir(e.top)&2)==0&&(e.Shape_parity^=r),t}function t1(){}function Fo(e){var t;return t=l1(kn,e&16777215)<<1|~~e>>24,t}function Sp(){var e,t,r,n,o,l,i,s,u,a,f,c,g,m,L,p;for(e=0,i=0;i<28561;++i)l=xo[i%13],r=xo[~~(i/13)%13],c=xo[~~(~~(i/13)/13)%13],f=xo[~~(~~(~~(i/13)/13)/13)],g=f<<18|c<<12|r<<6|l,Ir(g)==16&&(kn[e++]=g);for(a=new t1,i=0;i<7356;++i)sa(a,i),bo[i]=xp(a),bo[i]|=ia(a)<<4,sa(a,i),Bo[i]=bp(a),Bo[i]|=ia(a)<<4,sa(a,i),p=a.top&63,m=Ir(p),L=Ir(a.bottom&4032),a.Shape_parity^=1&~~(m&L)>>1,a.top=a.top&4032|~~a.bottom>>6&63,a.bottom=a.bottom&63|p<<6,ri[i]=ia(a);for(i=0;i<7536;++i)Ee[i]=-1;for(Ee[Fo(14378715)]=0,Ee[Fo(31157686)]=0,Ee[Fo(23967451)]=0,Ee[Fo(7191990)]=0,n=4,o=0,t=-1;n!=o;)for(o=n,++t,i=0;i<7536;++i)if(Ee[i]==t){u=0,s=i;do s=bo[s],u+=s&15,s>>=4,Ee[s]==-1&&(++n,Ee[s]=t+1);while(u!=12);u=0,s=i;do s=Bo[s],u+=s&15,s>>=4,Ee[s]==-1&&(++n,Ee[s]=t+1);while(u!=12);s=ri[i],Ee[s]==-1&&(++n,Ee[s]=t+1)}}function vp(){}be=t1.prototype=vp.prototype;be.bottom=0;be.Shape_parity=0;be.top=0;var Bo,kn,Ee,bo,ri,xo,r1=!1;function wp(){if(!r1){r1=!0,ye=[],vo=[],Pr=[],Cr=[],o1=[1,1,2,6,24,120,720,5040],Mr=[];for(var e=0;e<12;++e)Mr[e]=[];Ep()}}function n1(){}function So(e){var t,r,n,o;for(r=0,o=1985229328,t=0;t<7;++t)n=e[t]<<2,r=(8-t)*r+(~~o>>n&7),o-=286331152<<n;return r&65535}function Ep(){var e,t,r,n,o,l,i,s,u,a,f,c,g;for(o=0;o<12;++o)for(Mr[o][0]=1,Mr[o][o]=1,u=1;u<o;++u)Mr[o][u]=Mr[o-1][u-1]+Mr[o-1][u];for(c=[],o=0;o<40320;++o)aa(c,o),g=c[2],c[2]=c[4],c[4]=g,g=c[3],c[3]=c[5],c[5]=g,vo[o]=So(c),aa(c,o),g=c[0],c[0]=c[1],c[1]=c[2],c[2]=c[3],c[3]=g,Pr[o]=So(c),aa(c,o),g=c[4],c[4]=c[5],c[5]=c[6],c[6]=c[7],c[7]=g,Cr[o]=So(c);for(o=0;o<80640;++o)ye[o]=-1;for(ye[0]=0,t=0,r=1;r<80640;){s=t>=11,n=s?-1:t,e=s?t:-1,++t;e:for(o=0;o<80640;++o)if(ye[o]==n){if(l=~~o>>1,f=o&1,i=vo[l]<<1|1-f,ye[i]==e&&(++r,ye[s?o:i]=~~(t<<24)>>24,s))continue e;for(i=l,a=0;a<4;++a)if(i=Pr[i],ye[i<<1|f]==e&&(++r,ye[s?o:i<<1|f]=~~(t<<24)>>24,s))continue e;for(a=0;a<4;++a)if(i=Cr[i],ye[i<<1|f]==e&&(++r,ye[s?o:i<<1|f]=~~(t<<24)>>24,s))continue e}}}function aa(e,t){var r,n,o,l,i;for(i=1985229328,r=0;r<7;++r)o=o1[7-r],l=~~(t/o),t-=l*o,l<<=2,e[r]=~~((~~i>>l&7)<<24)>>24,n=(1<<l)-1,i=(i&n)+(~~i>>4&~n);e[7]=~~(i<<24)>>24}function Up(){}be=n1.prototype=Up.prototype;be.botEdgeFirst=!1;be.cornperm=0;be.edgeperm=0;be.ml=0;be.topEdgeFirst=!1;var Cr,Mr,ye,Pr,vo,o1;function Ir(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 l1(e,t){var r,n,o,l;for(n=0,r=e.length-1;n<=r;)if(o=n+(~~(r-n)>>1),l=e[o],l<t)n=o+1;else if(l>t)r=o-1;else return o;return-n-1}var ua=!1,kp=function(e,t,r){ua||(Bp(),wp()),r&&r("Done initializing Square-1."),ua=!0,e!=null&&e()},zp=function(){return D(this,null,function*(){return ua||kp(),hp()})},Cp=function(e){var t=new $f;return Dp(t,e)},Mp=function(){return D(this,null,function*(){var e=yield zp(),t=Cp(e);return{state:e,scramble_string:t}})};function i1(){return D(this,null,function*(){return(yield Mp()).scramble_string})}function s1(){return D(this,null,function*(){return z.fromString(yield i1())})}x2(!0);var a1=!0;function Pp(e){a1=e}function u1(){return(typeof performance=="undefined"?Date:performance).now()}function Oe(e,t){return D(this,null,function*(){if(!a1)return t();let r=u1(),n=t();(n==null?void 0:n.then)&&(yield n);let o=u1();return console.warn(\`\${e}: \${Math.round(o-r)}ms\`),n})}var fa={initialize:e=>D(void 0,null,function*(){switch(e){case"222":return Oe("preInitialize222",N2);case"333":case"333oh":case"333ft":return Oe("initialize333",xu);case"444":return Oe("initialize444",js);default:throw new Error(\`unsupported event: \${e}\`)}}),randomScrambleForEvent:e=>D(void 0,null,function*(){switch(e){case"222":return Oe("random222Scramble",T2);case"333":case"333oh":case"333ft":return Oe("random333Scramble",Ln);case"333fm":return Oe("random333FewestMovesScramble",wu);case"333bf":case"333mb":return Oe("random333OrientedScramble",Su);case"444":return Oe("random444Scramble",Do);case"444bf":return Oe("random444OrientedScramble",Gf);case"555":return Oe("bigCubeScramble(5)",Vt.bind(Vt,5));case"555bf":return Oe("oriented555RandomMoves",Xf);case"666":return Oe("bigCubeScramble(6)",Vt.bind(Vt,6));case"777":return Oe("bigCubeScramble(7)",Vt.bind(Vt,7));case"skewb":return Oe("randomSkewbFixedCornerScramble",Yf);case"pyram":return Oe("randomPyraminxScrambleFixedOrientation",jf);case"sq1":return Oe("getRandomSquare1Scramble",s1);default:throw new Error(\`unsupported event: \${e}\`)}}),randomScrambleStringForEvent:e=>D(void 0,null,function*(){return(yield fa.randomScrambleForEvent(e)).toString()}),solve333ToString:e=>D(void 0,null,function*(){return(yield As(e)).toString()}),solve222ToString:e=>D(void 0,null,function*(){return(yield Yi(e)).toString()}),solveSkewbToString:e=>D(void 0,null,function*(){return(yield na(e)).toString()}),solvePyraminxToString:e=>D(void 0,null,function*(){return(yield Js(e)).toString()}),solveMegaminxToString:e=>D(void 0,null,function*(){return(yield Of(e)).toString()}),setDebugMeasurePerf:e=>D(void 0,null,function*(){Pp(e)})};ba(fa);
|
|
7003
|
-
`});var ln,Rr=oe(()=>{ln=class{constructor(e){this.callback=e;this.animFrameID=null;this.animFrame=this.animFrameWrapper.bind(this)}requestAnimFrame(){this.animFrameID||(this.animFrameID=requestAnimationFrame(this.animFrame))}cancelAnimFrame(){this.animFrameID&&(cancelAnimationFrame(this.animFrameID),this.animFrameID=0)}animFrameWrapper(e){this.animFrameID=0,this.callback(e)}}});var Mo,zn,Ro=oe(()=>{zn=class{constructor(e,t,n){this.elem=e;this.prefix=t;this.validSuffixes=n;H(this,Mo,null)}clearValue(){S(this,Mo)&&this.elem.contentWrapper.classList.remove(S(this,Mo)),$(this,Mo,null)}setValue(e){if(!this.validSuffixes.includes(e))throw new Error(`Invalid suffix: ${e}`);let t=`${this.prefix}${e}`,n=S(this,Mo)!==t;return n&&(this.clearValue(),this.elem.contentWrapper.classList.add(t),$(this,Mo,t)),n}};Mo=new WeakMap});var
|
|
7003
|
+
`});var ln,Rr=oe(()=>{ln=class{constructor(e){this.callback=e;this.animFrameID=null;this.animFrame=this.animFrameWrapper.bind(this)}requestAnimFrame(){this.animFrameID||(this.animFrameID=requestAnimationFrame(this.animFrame))}cancelAnimFrame(){this.animFrameID&&(cancelAnimationFrame(this.animFrameID),this.animFrameID=0)}animFrameWrapper(e){this.animFrameID=0,this.callback(e)}}});var Mo,zn,Ro=oe(()=>{zn=class{constructor(e,t,n){this.elem=e;this.prefix=t;this.validSuffixes=n;H(this,Mo,null)}clearValue(){S(this,Mo)&&this.elem.contentWrapper.classList.remove(S(this,Mo)),$(this,Mo,null)}setValue(e){if(!this.validSuffixes.includes(e))throw new Error(`Invalid suffix: ${e}`);let t=`${this.prefix}${e}`,n=S(this,Mo)!==t;return n&&(this.clearValue(),this.elem.contentWrapper.classList.add(t),$(this,Mo,t)),n}};Mo=new WeakMap});var YA,nr,XA,Qe,un=oe(()=>{YA=class{};typeof HTMLElement!="undefined"?nr=HTMLElement:nr=YA;XA=class{define(){}};typeof customElements!="undefined"?Qe=customElements:Qe=new XA});var Xt,Os,rt,Tt=oe(()=>{un();Xt=class{constructor(e){this.sourceText=e}getAsString(){return this.sourceText}},rt=class extends nr{constructor(e){super();H(this,Os,new Map);this.shadow=this.attachShadow({mode:e?.mode??"closed"}),this.contentWrapper=document.createElement("div"),this.contentWrapper.classList.add("wrapper"),this.shadow.appendChild(this.contentWrapper)}addCSS(e){if(S(this,Os).get(e))return;let t=document.createElement("style");t.textContent=e.getAsString(),S(this,Os).set(e,t),this.shadow.appendChild(t)}removeCSS(e){let t=S(this,Os).get(e);!t||(this.shadow.removeChild(t),S(this,Os).delete(e))}addElement(e){return this.contentWrapper.appendChild(e)}prependElement(e){this.contentWrapper.prepend(e)}removeElement(e){return this.contentWrapper.removeChild(e)}};Os=new WeakMap;Qe.define("twisty-managed-custom-element",rt)});var Zn,ui,Gs=oe(()=>{Zn=Math.PI*2,ui=360/Zn});var Ad,xi,Wc,Ed,q7,Dd,KA=oe(()=>{Oe();Ad=class{constructor(e){e?typeof e=="string"?this.setString(e):this.setValue(e):this.setValue(this.defaultValue())}setString(e){return this.string===e?!1:(this.string=e,this.value=this.toValue(e),!0)}setValue(e){let t=this.toString(e);return this.string===t?!1:(this.string=t,this.value=e,!0)}defaultValue(){return new re([])}toValue(e){return re.fromString(e)}toString(e){return e.toString()}},xi=class{constructor(e,t){this.enumVal=e;this.setString(t??this.defaultValue())}setString(e){if(this.string===e)return!1;if(!(e in this.enumVal))throw new Error(`Invalid string for attribute!: ${e}`);return this.string=e,this.value=this.toValue(e),!0}setValue(e){return this.setString(e)}defaultValue(){return Object.keys(this.enumVal)[0]}toValue(e){return e}},Dd=class{constructor(e,t,n,i){this.minValue=t;this.maxValue=n;H(this,Ed);H(this,Wc,void 0);$(this,Wc,e===null?null:ye(this,Ed,q7).call(this,e)),this.setValue(i??this.defaultValue())}setString(e){return this.setValue(e===""?null:this.toValue(e))}setValue(e){let t=this.toString(e);return this.string===t?!1:(this.string=t,this.value=e,!0)}defaultValue(){return S(this,Wc)}toValue(e){return parseFloat(e)}toString(e){return e===null?"":e.toString()}};Wc=new WeakMap,Ed=new WeakSet,q7=function(e){return Math.max(Math.min(e,this.maxValue),this.minValue)}});var Pl,Md=oe(()=>{Tt();Pl=new Xt(`
|
|
7004
7004
|
:host {
|
|
7005
7005
|
width: 384px;
|
|
7006
7006
|
height: 256px;
|
|
@@ -7038,7 +7038,7 @@ Alg R' U' R U B' U' B L\`)})}var $s,ea,ra=S(()=>{ll();$n();$s=null;ea=null});var
|
|
|
7038
7038
|
grid-row: 1 / 2;
|
|
7039
7039
|
grid-column: 2 / 3;
|
|
7040
7040
|
}
|
|
7041
|
-
`)});var F2,Vc,Rd,_2=oe(()=>{Ro();Ft();un();Md();F2={none:!0,"side-by-side":!0,"top-right":!0},Rd=class extends rt{constructor(e={}){super();H(this,Vc,new zn(this,"back-view-",["none","side-by-side","top-right"]));this.addCSS(Pl),e.backView&&e.backView in F2&&S(this,Vc).setValue(e.backView)}setBackView(e){return S(this,Vc).setValue(e)}clear(){this.contentWrapper.innerHTML=""}};Vc=new WeakMap;Qe.define("twisty-viewer-wrapper",Rd)});function Hc(r,e){if(r[1]==="x")return e==="Cube3D"?Q7:KA;switch(r){case"megaminx":case"gigaminx":return Y7;case"pyraminx":case"master_tetraminx":return X7;case"skewb":return KA;default:return j7}}var j7,Q7,KA,Y7,X7,ZA,K7,Z7,J7,C2,P2,k2,$7,e6,t6,JA,Td,qc=oe(()=>{li();Gs();XA();_2();j7={latitude:31.717474411461005,longitude:0,distance:5.877852522924731},Q7={latitude:35,longitude:30,distance:6},KA={latitude:35,longitude:30,distance:6.25},Y7={latitude:Math.atan(1/2)*ui,longitude:0,distance:6.7},X7={latitude:26.56505117707799,longitude:0,distance:6},ZA=new M(0,1/6,0);K7={start:!0,end:!0},Z7={"3D":!0,"2D":!0,"experimental-2D-LL":!0,PG3D:!0},J7={checkered:!0,none:!0},C2={floating:!0,none:!0},P2={full:!0,"centers-only":!0,PLL:!0,CLS:!0,OLL:!0,COLL:!0,OCLL:!0,CLL:!0,ELL:!0,ELS:!0,LL:!0,F2L:!0,ZBLL:!0,ZBLS:!0,WVLS:!0,VLS:!0,LS:!0,EO:!0,CMLL:!0,L6E:!0,L6EO:!0,Daisy:!0,Cross:!0,"2x2x2":!0,"2x2x3":!0,"Void Cube":!0,invisible:!0,picture:!0,"experimental-centers-U":!0,"experimental-centers-U-D":!0,"experimental-centers-U-L-D":!0,"experimental-centers-U-L-B-D":!0,"experimental-centers":!0,"experimental-fto-fc":!0,"experimental-fto-f2t":!0,"experimental-fto-sc":!0,"experimental-fto-l2c":!0,"experimental-fto-lbt":!0,"experimental-fto-l3t":!0,"experimental-global-custom-1":!0,"experimental-global-custom-2":!0},k2={"bottom-row":!0,none:!0},$7={"3x3x3":!0,custom:!0,"2x2x2":!0,"4x4x4":!0,"5x5x5":!0,"6x6x6":!0,"7x7x7":!0,"40x40x40":!0,megaminx:!0,pyraminx:!0,square1:!0,clock:!0,skewb:!0,fto:!0,gigaminx:!0,master_tetraminx:!0},e6={twizzle:!0,none:!0},t6={auto:!0,none:!0},JA={alg:"alg","experimental-setup-alg":"experimentalSetupAlg","experimental-setup-anchor":"experimentalSetupAnchor",puzzle:"puzzle",visualization:"visualization","hint-facelets":"hintFacelets","experimental-stickering":"experimentalStickering",background:"background","control-panel":"controlPanel","back-view":"backView","experimental-camera-latitude":"experimentalCameraLatitude","experimental-camera-longitude":"experimentalCameraLongitude","experimental-camera-latitude-limits":"experimentalCameraLatitudeLimits","viewer-link":"viewerLink"},Td=class{constructor(e,t){this.twistyPlayer=e;this.attributes={alg:new Ad(t.alg),"experimental-setup-alg":new Ad(t.experimentalSetupAlg),"experimental-setup-anchor":new xi(K7,t.experimentalSetupAnchor),puzzle:new xi($7,t.puzzle),visualization:new xi(Z7,t.visualization),"hint-facelets":new xi(C2,t.hintFacelets),"experimental-stickering":new xi(P2,t.experimentalStickering),background:new xi(J7,t.background),"control-panel":new xi(k2,t.controlPanel),"back-view":new xi(F2,t.backView),"experimental-camera-latitude":new Dd(null,-90,90,t.experimentalCameraLatitude),"experimental-camera-longitude":new Dd(null,-180,180,t.experimentalCameraLongitude),"experimental-camera-latitude-limits":new xi(t6,t.experimentalCameraLatitudeLimits),"viewer-link":new xi(e6,t.viewerLink)}}static get observedAttributes(){return Object.keys(JA)}attributeChangedCallback(e,t,n){let i=this.attributes[e];if(i){t!==null&&i.string!==t&&console.warn("Attribute out of sync!",e,i.string,t),i.setString(n);let o=JA[e];this.twistyPlayer[o]=i.value}}}});function _d(r){return r*r*r*(10-r*(15-6*r))}var B2=oe(()=>{});function Xe(r,e){return new ot().setFromAxisAngle(r,Zn*e/4)}function f6(){return tD??(tD=new Ti(To.foundationWidth,To.foundationWidth,To.foundationWidth))}function nD(){let r=new Pe,e=.5*To.stickerWidth;return r.setAttribute("position",new qe(new Float32Array([e,e,0,-e,e,0,e,-e,0,-e,e,0,-e,-e,0,e,-e,0]),3)),r.setAttribute("uv",new qe(new Float32Array([1,1,0,1,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1]),2)),r}function p6(){return iD??(iD=nD())}var $A,n6,i6,eD,r6,o6,Ws,Fr,ct,s6,To,a6,l6,u6,c6,Dt,Ke,Cd,h6,z2,jc,I2,Pd,tD,iD,Ui,Qc=oe(()=>{li();qn();B2();qc();Gs();$A=new Lc,n6=new vt({color:4473924,side:jn}),i6=new vt({color:13421772,side:At,transparent:!0,opacity:.75}),eD=new vt({visible:!1}),r6=new vt({color:16746751}),o6=new vt({color:16746751,side:At,transparent:!0,opacity:.5}),Ws=class{constructor(e,t,n,i,o,s){this.vector=e;this.fromZ=t;this.color=n;this.dimColor=i;this.hintOpacityScale=o;this.stickerMaterial={regular:new vt({color:n,side:jn}),dim:new vt({color:i,side:jn}),oriented:r6,ignored:n6,invisible:eD},this.hintStickerMaterial={regular:new vt({color:s?.hintColor??n,side:At,transparent:!0,opacity:.5*o}),dim:new vt({color:s?.hintDimColor??n,side:At,transparent:!0,opacity:.5*o}),oriented:o6,ignored:i6,invisible:eD}}},Fr=[new Ws(new M(0,1,0),new xn(-Zn/4,0,0),16777215,14540253,1.25),new Ws(new M(-1,0,0),new xn(0,-Zn/4,0),16746496,8930304,1),new Ws(new M(0,0,1),new xn(0,0,0),65280,34816,1),new Ws(new M(1,0,0),new xn(0,Zn/4,0),16711680,6684672,1),new Ws(new M(0,0,-1),new xn(0,Zn/2,0),255,136,.75,{hintColor:17663,hintDimColor:8840}),new Ws(new M(0,-1,0),new xn(Zn/4,0,0),16776960,8947712,1.25)],ct={U:0,L:1,F:2,R:3,B:4,D:5},s6={U:ct.U,u:ct.U,Uw:ct.U,Uv:ct.U,y:ct.U,L:ct.L,l:ct.L,Lw:ct.L,Lv:ct.L,M:ct.L,F:ct.F,f:ct.F,Fw:ct.F,Fv:ct.F,S:ct.F,z:ct.F,R:ct.R,r:ct.R,Rw:ct.R,Rv:ct.R,x:ct.R,B:ct.B,b:ct.B,Bw:ct.B,Bv:ct.B,D:ct.D,d:ct.D,Dw:ct.D,Dv:ct.D,E:ct.D},To={stickerWidth:.85,stickerElevation:.503,foundationWidth:1,hintStickerElevation:1.45},a6=2,l6={showMainStickers:!0,hintFacelets:"floating",showFoundation:!0,experimentalStickering:"full",foundationSprite:null,hintSprite:null},u6=new vt({color:0,opacity:1,transparent:!0}),c6=new vt({color:0,opacity:.3,transparent:!0}),Dt=class{constructor(e,t,n){this.orbit=e;let i=typeof t=="string"?t.split(""):t;this.stickerFaces=i.map(o=>ct[o]),this.matrix=new Ae,this.matrix.setPosition(Cd[e]),this.matrix.premultiply(new Ae().makeRotationFromQuaternion(n))}};Ke={O:new M(0,0,0),U:new M(0,-1,0),L:new M(1,0,0),F:new M(0,0,-1),R:new M(-1,0,0),B:new M(0,0,1),D:new M(0,1,0)},Cd={EDGES:new M(0,1,1),CORNERS:new M(1,1,1),CENTERS:new M(0,1,0)},h6={EDGES:[0,1].map(r=>new Ae().makeRotationAxis(Cd.EDGES.clone().normalize(),-r*Zn/2)),CORNERS:[0,1,2].map(r=>new Ae().makeRotationAxis(Cd.CORNERS.clone().normalize(),-r*Zn/3)),CENTERS:[0,1,2,3].map(r=>new Ae().makeRotationAxis(Cd.CENTERS.clone().normalize(),-r*Zn/4))},z2=[ct.U,ct.F,ct.R],jc={EDGES:[new Dt("EDGES","UF",Xe(Ke.O,0)),new Dt("EDGES","UR",Xe(Ke.U,3)),new Dt("EDGES","UB",Xe(Ke.U,2)),new Dt("EDGES","UL",Xe(Ke.U,1)),new Dt("EDGES","DF",Xe(Ke.F,2)),new Dt("EDGES","DR",Xe(Ke.F,2).premultiply(Xe(Ke.D,1))),new Dt("EDGES","DB",Xe(Ke.F,2).premultiply(Xe(Ke.D,2))),new Dt("EDGES","DL",Xe(Ke.F,2).premultiply(Xe(Ke.D,3))),new Dt("EDGES","FR",Xe(Ke.U,3).premultiply(Xe(Ke.R,3))),new Dt("EDGES","FL",Xe(Ke.U,1).premultiply(Xe(Ke.R,3))),new Dt("EDGES","BR",Xe(Ke.U,3).premultiply(Xe(Ke.R,1))),new Dt("EDGES","BL",Xe(Ke.U,1).premultiply(Xe(Ke.R,1)))],CORNERS:[new Dt("CORNERS","UFR",Xe(Ke.O,0)),new Dt("CORNERS","URB",Xe(Ke.U,3)),new Dt("CORNERS","UBL",Xe(Ke.U,2)),new Dt("CORNERS","ULF",Xe(Ke.U,1)),new Dt("CORNERS","DRF",Xe(Ke.F,2).premultiply(Xe(Ke.D,1))),new Dt("CORNERS","DFL",Xe(Ke.F,2).premultiply(Xe(Ke.D,0))),new Dt("CORNERS","DLB",Xe(Ke.F,2).premultiply(Xe(Ke.D,3))),new Dt("CORNERS","DBR",Xe(Ke.F,2).premultiply(Xe(Ke.D,2)))],CENTERS:[new Dt("CENTERS","U",Xe(Ke.O,0)),new Dt("CENTERS","L",Xe(Ke.R,3).premultiply(Xe(Ke.U,1))),new Dt("CENTERS","F",Xe(Ke.R,3)),new Dt("CENTERS","R",Xe(Ke.R,3).premultiply(Xe(Ke.D,1))),new Dt("CENTERS","B",Xe(Ke.R,3).premultiply(Xe(Ke.D,2))),new Dt("CENTERS","D",Xe(Ke.R,2))]},I2=1/3,Pd={EDGES:[[[0,4,6],[0,4,5]],[[3,5,7],[0,7,5]],[[2,4,8],[0,10,5]],[[1,3,7],[0,1,5]],[[2,4,2],[2,4,3]],[[3,5,1],[2,7,3]],[[0,4,0],[2,10,3]],[[1,3,1],[2,1,3]],[[3,5,4],[3,6,4]],[[1,3,4],[1,2,4]],[[1,9,4],[1,8,4]],[[3,11,4],[3,0,4]]],CORNERS:[[[0,5,6],[0,5,5],[0,6,5]],[[3,5,8],[0,8,5],[0,9,5]],[[2,3,8],[0,11,5],[0,0,5]],[[1,3,6],[0,2,5],[0,3,5]],[[3,5,2],[2,6,3],[2,5,3]],[[2,3,2],[2,3,3],[2,2,3]],[[1,3,0],[2,0,3],[2,11,3]],[[0,5,0],[2,9,3],[2,8,3]]],CENTERS:[[[0,4,7]],[[0,1,4]],[[0,4,4]],[[0,7,4]],[[0,10,4]],[[0,4,1]]]},tD=null;iD=null;Ui=class extends je{constructor(e,t,n,i={}){super();this.def=e;this.scheduleRenderCallback=n;this.pieces={};this.experimentalHintStickerMeshes=[];this.experimentalFoundationMeshes=[];this.sprite=new Promise(e=>{this.setSpriteURL=t=>{$A.load(t,e)}});this.hintSprite=new Promise(e=>{this.setHintSpriteURL=t=>{$A.load(t,e)}});if(this.options={...l6},Object.assign(this.options,i),this.def.name!=="3x3x3")throw new Error(`Invalid puzzle for this Cube3D implementation: ${this.def.name}`);i.foundationSprite&&this.setSprite(i.foundationSprite),i.hintSprite&&this.setHintSprite(i.hintSprite),this.kpuzzleFaceletInfo={};for(let o in jc){let s=[];this.kpuzzleFaceletInfo[o]=s,this.pieces[o]=jc[o].map(this.createCubie.bind(this,o,s))}this.scale.set(I2,I2,I2),this.options.experimentalStickering&&this.setStickering(this.options.experimentalStickering),t?.addPositionListener(this)}setSprite(e){this.sprite=e}setHintSprite(e){this.hintSprite=e}experimentalSetStickerSpriteURL(e){this.setSpriteURL(e)}experimentalSetHintStickerSpriteURL(e){this.setHintSpriteURL(e)}setStickering(e){(async()=>{let t=await Ot["3x3x3"].appearance(e??"full");this.setAppearance(t??await Ot["3x3x3"].appearance("full"))})()}setAppearance(e){for(let[t,n]of Object.entries(e.orbits))for(let i=0;i<n.pieces.length;i++){let o=n.pieces[i];if(o){let s=this.kpuzzleFaceletInfo[t][i];for(let a=0;a<s.length;a++){let l=o.facelets[a];if(l){let u=s[a],c=typeof l=="string"?l:l?.appearance;u.facelet.material=Fr[u.faceIdx].stickerMaterial[c];let f=typeof l=="string"?c:l.hintAppearance??c;u.hintFacelet&&(u.hintFacelet.material=Fr[u.faceIdx].hintStickerMaterial[f])}}}}this.scheduleRenderCallback&&this.scheduleRenderCallback()}experimentalUpdateOptions(e){if("showMainStickers"in e)throw new Error("Unimplemented");let t=e.showFoundation;if(typeof t!="undefined"&&this.options.showFoundation!==t){this.options.showFoundation=t;for(let o of this.experimentalFoundationMeshes)o.visible=t}let n=e.hintFacelets;if(typeof n!="undefined"&&this.options.hintFacelets!==n&&C2[n]){this.options.hintFacelets=n;for(let o of this.experimentalHintStickerMeshes)o.visible=n==="floating";this.scheduleRenderCallback()}let i=e.experimentalStickering;typeof i!="undefined"&&this.options.experimentalStickering!==i&&P2[i]&&(this.options.experimentalStickering=i,this.setStickering(i),this.scheduleRenderCallback())}onPositionChange(e){let t=e.state;for(let n in jc){let i=jc[n];for(let o=0;o<i.length;o++){let s=t[n].permutation[o];this.pieces[n][s].matrix.copy(jc[n][o].matrix),this.pieces[n][s].matrix.multiply(h6[n][t[n].orientation[o]])}for(let o of e.movesInProgress){let s=o.move,a=Fr[s6[s.family]].vector,l=new Ae().makeRotationAxis(a,-this.ease(o.fraction)*o.direction*s.amount*Zn/4);for(let u=0;u<i.length;u++){let c=this.def.moves[s.family][n].permutation[u];if(u!==c||this.def.moves[s.family][n].orientation[u]!==0){let f=t[n].permutation[u];this.pieces[n][f].matrix.premultiply(l)}}}}this.scheduleRenderCallback()}createCubie(e,t,n,i){let o=[];t.push(o);let s=new gi;if(this.options.showFoundation){let a=this.createCubieFoundation();s.add(a),this.experimentalFoundationMeshes.push(a)}for(let a=0;a<n.stickerFaces.length;a++){let l=this.createSticker(Fr[z2[a]],Fr[n.stickerFaces[a]],!1),u={faceIdx:n.stickerFaces[a],facelet:l};if(s.add(l),this.options.hintFacelets==="floating"){let c=this.createSticker(Fr[z2[a]],Fr[n.stickerFaces[a]],!0);s.add(c),u.hintFacelet=c,this.experimentalHintStickerMeshes.push(c)}if(this.options.experimentalStickering==="picture"&&Pd[e]&&Pd[e][i]&&Pd[e][i][a]){let[c,f,h]=Pd[e][i][a];(async()=>{let p=async d=>{let g=await(d?this.hintSprite:this.sprite),x=this.createSticker(Fr[z2[a]],Fr[n.stickerFaces[a]],d);x.material=new vt({map:g,side:d?At:jn,transparent:!0});let y=f/12,m=(f+1)/12,b=h/9,w=(h+1)/9,D=new ee(y,b),R=new ee(y,w),L=new ee(m,w),T=new ee(m,b);switch(c){case 1:[D,R,L,T]=[R,L,T,D];break;case 2:[D,R,L,T]=[L,T,D,R];break;case 3:[D,R,L,T]=[T,D,R,L];break}x.geometry.setAttribute("uv",new qe(new Float32Array([L.x,L.y,R.x,R.y,T.x,T.y,R.x,R.y,D.x,D.y,T.x,T.y]),2)),s.add(x)};p(!0),p(!1)})()}o.push(u)}return s.matrix.copy(n.matrix),s.matrixAutoUpdate=!1,this.add(s),s}createCubieFoundation(){let e=f6();return new Lt(e,this.options.experimentalStickering==="picture"?u6:c6)}createSticker(e,t,n){let i=this.options.experimentalStickering==="picture"?nD():p6(),o=new Lt(i,n?t.hintStickerMaterial.regular:t.stickerMaterial.regular);return o.setRotationFromEuler(e.fromZ),o.position.copy(e.vector),o.position.multiplyScalar(n?this.options.experimentalStickering==="picture"?a6:To.hintStickerElevation:To.stickerElevation),o}experimentalSetFoundationOpacity(e){this.experimentalFoundationMeshes[0].material.opacity=e}experimentalSetStickerWidth(e){for(let t of Object.values(this.kpuzzleFaceletInfo))for(let n of t)for(let i of n)i.facelet.scale.setScalar(e/To.stickerWidth)}experimentalSetCenterStickerWidth(e){for(let t of[this.kpuzzleFaceletInfo.CENTERS])for(let n of t)for(let i of n)i.facelet.scale.setScalar(e/To.stickerWidth)}ease(e){return _d(e)}}});function U2(r,e,t){return Math.hypot(r[3*e]-r[3*t],r[3*e+1]-r[3*t+1],r[3*e+2]-r[3*t+2])}function d6(r,e,t,n){let i=U2(r,e,t),o=U2(r,t,n),s=U2(r,e,n),a=(i+o+s)/2;return Math.sqrt(a*(a-i)*(a-o)*(a-s))}function m6(r){let e=0;for(let t=2;3*t<r.length;t++)e+=d6(r,0,1,t);return e}function g6(r){let e=Math.hypot(r[0],r[1],r[2]);return r[0]/=e,r[1]/=e,r[2]/=e,r}function y6(r,e){let t=new Array(3);return t[0]=r[1]*e[2]-r[2]*e[1],t[1]=r[2]*e[0]-r[0]*e[2],t[2]=r[0]*e[1]-r[1]*e[0],t}function v6(r){let e=[r[3]-r[0],r[4]-r[1],r[5]-r[2]],t=[r[6]-r[3],r[7]-r[4],r[8]-r[5]],n=y6(e,t);return g6(n)}function x6(r,e){let t=[],n=new Array(3),i=new Array(3);for(let o=1;o<10;o++){for(let a=0;a<r.length;a+=3){let l=(a+r.length-3)%r.length,u=(a+3)%r.length;for(let d=0;d<3;d++)n[d]=r[l+d]-r[a+d],i[d]=r[u+d]-r[a+d];let c=Math.hypot(n[0],n[1],n[2]),f=Math.hypot(i[0],i[1],i[2]);for(let d=0;d<3;d++)n[d]/=c,i[d]/=f;let h=n[0]*i[0]+n[1]*i[1]+n[2]*i[2],p=e/Math.sqrt(1-h*h);for(let d=0;d<3;d++)t[a+d]=r[a+d]+(n[d]+i[d])*p}let s=!0;for(let a=0;s&&a<t.length;a+=3){let l=(a+3)%r.length,u=0;for(let c=0;c<3;c++){let f=r[l+c]-r[a+c],h=t[l+c]-t[a+c];u+=f*h}u<=0&&(s=!1)}if(s)return t;e/=2}return r}var rD,Fo,Yc,N2,oD,sD,aD,w6,_r,_o,wi,Xc=oe(()=>{li();Ht();Ht();qn();B2();Gs();rD=new vt({side:jn,color:0}),Fo=new vt({visible:!1}),Yc=new vt({vertexColors:!0});N2=class{constructor(e,t){this.sz=e;this.tm=t;this.vertices=new Float32Array(9*e),this.uvs=void 0,this.colors=new Uint8Array(18*e),this.ind=new Uint8Array(e),this.pos=0,this.ipos=0}add(e,t,n){this.vertices[this.pos]=e[3*t+0],this.vertices[this.pos+1]=e[3*t+1],this.vertices[this.pos+2]=e[3*t+2],this.colors[this.pos]=n>>16,this.colors[this.pos+1]=n>>8&255,this.colors[this.pos+2]=n&255,this.pos+=3}addUncolored(e,t){this.vertices[this.pos]=e[3*t+0],this.vertices[this.pos+1]=e[3*t+1],this.vertices[this.pos+2]=e[3*t+2],this.pos+=3}setind(e){this.ind[this.ipos++]=e}makePoly(e,t,n){let i=e;for(let o=1;3*(o+1)<i.length;o++)this.add(i,0,t),this.add(i,o,t),this.add(i,o+1,t),this.setind(n)}setAttributes(e){e.setAttribute("position",new qe(this.vertices,3));let t=this.colors.subarray(0,9*this.sz);e.setAttribute("color",new qe(t,3,!0))}makeGroups(e){e.clearGroups();for(let t=0;t<this.ipos;){let n=t++,i=this.ind[n];for(;this.ind[t]===i;)t++;e.addGroup(3*n,3*(t-n),i)}}saveOriginalColors(){this.colors.copyWithin(this.pos,0,this.pos)}},oD=class{constructor(e,t,n,i){this.texturePtr=void 0;this.twistVal=-1;this.isDup=!!t.isDup,this.faceNum=t.face,this.stickerStart=e.ipos;let o=new xe(t.color).getHex();this.origColor=o,this.origColorAppearance=o,i?.appearance&&this.setAppearance(e,i.appearance),this.faceColor=o;let s=this.stickerCoords(t.coords,n);e.makePoly(s,this.faceColor,this.isDup?4:0),this.stickerEnd=e.ipos}stickerCoords(e,t){return x6(e.slice(),t)}hintCoords(e,t,n,i){e=this.stickerCoords(e,n),i=i.slice();for(let s=0;s<3;s++)i[s]*=.5*t;let o=new Array(e.length);for(let s=0;3*s<e.length;s++){let a=e.length/3-1-s;o[3*s]=e[3*a]+i[0],o[3*s+1]=e[3*a+1]+i[1],o[3*s+2]=e[3*a+2]+i[2]}return o}foundationCoords(e){let t=e.slice();for(let n=0;n<e.length;n++)t[n]=e[n]*.999;return t}addHint(e,t,n,i,o,s){this.hintStart=e.ipos;let a=this.hintCoords(t.coords,i,o,s);e.makePoly(a,this.faceColor,n&&!this.isDup?2:4),this.hintEnd=e.ipos}addFoundation(e,t,n){this.foundationStart=e.ipos;let i=this.foundationCoords(t.coords);e.makePoly(i,n,this.isDup?4:6),this.foundationEnd=e.ipos}setHintStickers(e,t){let n=this.isDup||!t?4:2;for(let i=this.hintStart;i<this.hintEnd;i++)e.ind[i]=n|e.ind[i]&1}setAppearance(e,t){let n=0;switch(t){case"regular":n=this.origColor;break;case"dim":this.origColor===16777215?n=14540253:n=new xe(this.origColor).multiplyScalar(.5).getHex();break;case"oriented":n=16746751;break;case"ignored":n=4473924;break;case"invisible":n=this.origColor}this.origColorAppearance=n;for(let i=9*this.stickerStart;i<9*this.stickerEnd;i+=3)e.colors[e.pos+i]=n>>16,e.colors[e.pos+i+1]=n>>8&255,e.colors[e.pos+i+2]=n&255;for(let i=9*this.hintStart;i<9*this.hintEnd;i+=3)e.colors[e.pos+i]=n>>16,e.colors[e.pos+i+1]=n>>8&255,e.colors[e.pos+i+2]=n&255;this.setHintStickers(e,t!=="invisible"&&!this.isDup)}addUVs(e){let t=e.uvs,n=e.vertices,i=new Array(3);for(let o=3*this.stickerStart;o<3*this.stickerEnd;o++){i[0]=n[3*o],i[1]=n[3*o+1],i[2]=n[3*o+2];let s=e.tm.getuv(this.faceNum,i);t[2*o]=s[0],t[2*o+1]=s[1]}for(let o=3*this.hintStart;o<3*this.hintEnd;o++){i[0]=n[3*o],i[1]=n[3*o+1],i[2]=n[3*o+2];let s=e.tm.getuv(this.faceNum,i);t[2*o]=s[0],t[2*o+1]=s[1]}}setTexture(e,t){if(this.texturePtr===t)return 0;this.texturePtr=t;let n=6*e.sz;return e.uvs.copyWithin(6*this.stickerStart,6*t.stickerStart+n,6*t.stickerEnd+n),e.uvs.copyWithin(6*this.hintStart,6*t.hintStart+n,6*t.hintEnd+n),1}setColor(e,t){let n=t.origColorAppearance;if(this.faceColor!==n){this.faceColor=n;let i=e.pos;return e.colors.copyWithin(9*this.stickerStart,9*t.stickerStart+i,9*t.stickerEnd+i),e.colors.copyWithin(9*this.hintStart,9*t.hintStart+i,9*t.hintEnd+i),1}else return 0}},sD=class{constructor(e,t){this.cubie=new gi;let n=e.coords,i=new N2(n.length/3-2,t);for(let s=1;3*s+3<n.length;s++)i.addUncolored(n,0),i.addUncolored(n,s),i.addUncolored(n,s+1);this.geo=new Pe,i.setAttributes(this.geo);let o=new Lt(this.geo,Fo);o.userData.name=e.name,this.cubie.scale.setScalar(.99),this.cubie.add(o)}},aD=class{constructor(e){let t=e[0];this.axis=new M(t[0],t[1],t[2]),this.order=e[2]}},w6=.71,_r=.5,wi=class extends je{constructor(e,t,n,i,o=!1,s=!1,a=1,l={}){super();this.scheduleRenderCallback=t;this.definition=n;this.pgdat=i;this.showFoundation=o;this.showHintStickers=s;this.params=l;this.stickerTargets=[];this.controlTargets=[];this.textured=!1;H(this,_o,!1);if(i.stickers.length===0)throw Error("Reuse of stickerdat from pg; please don't do that.");this.hintMaterial=new vt({vertexColors:!0,transparent:!0,opacity:.5}),this.hintMaterialDisposable=!0,this.stickerMaterial=Yc,this.stickerMaterialDisposable=!1,this.axesInfo={};let u=this.pgdat.axis;for(let T of u)this.axesInfo[T[1]]=new aD(T);let c=this.pgdat.stickers;this.stickers={},this.materialArray1=new Array(8),this.materialArray2=new Array(8),this.enableFoundation(o),this.updateMaterialArrays();let f=0,h=3;for(let T of c){let U=T.coords.length/3;f+=h*(U-2)}let p=new N2(f,i.textureMapper),d=0,g=[],x=0;for(let T of i.faces)g.push(v6(T.coords)),x+=m6(T.coords);let y=w6,m=0;for(let T of c)T.isDup||m++;let b=Math.sqrt(x/m)*(1-Math.sqrt(y))/2;for(let T of c){let U=T.orbit,F=T.ord,C=T.ori;this.stickers[U]||(this.stickers[U]=[]),this.stickers[U][C]||(this.stickers[U][C]=[]);let j={};l.appearance&&(j.appearance=Au(l.appearance,U,F,C,!1));let B=new oD(p,T,b,j);this.stickers[U][C][F]=B}for(let T of c){let U=T.orbit,F=T.ord,C=T.ori;this.stickers[U][C][F].addHint(p,T,s,a,b,g[T.face])}this.foundationBound=p.ipos;for(let T of c){let U=T.orbit,F=T.ord,C=T.ori;this.stickers[U][C][F].addFoundation(p,T,d)}let w=new Pe;p.setAttributes(w),p.makeGroups(w);let D=new Lt(w,this.materialArray1);D.scale.set(_r,_r,_r),this.add(D);let R=new Lt(w,this.materialArray2);R.scale.set(_r,_r,_r),this.add(R);let L=this.pgdat.faces;this.movingObj=R,this.fixedGeo=w,this.filler=p;for(let T of L){let U=new sD(T,i.textureMapper);U.cubie.scale.set(_r,_r,_r),this.add(U.cubie),this.controlTargets.push(U.cubie.children[0])}p.saveOriginalColors(),e.addPositionListener(this),i.stickers=[]}dispose(){this.fixedGeo&&this.fixedGeo.dispose(),this.stickerMaterialDisposable&&(this.stickerMaterial.dispose(),this.stickerMaterial=Yc,this.stickerMaterialDisposable=!1),this.hintMaterialDisposable&&(this.hintMaterial.dispose(),this.hintMaterial=Yc,this.hintMaterialDisposable=!1)}experimentalGetStickerTargets(){return this.stickerTargets}experimentalGetControlTargets(){return this.controlTargets}experimentalSetAppearance(e){this.params.appearance=e;for(let t in this.definition.orbits){let{numPieces:n,orientations:i}=this.definition.orbits[t];for(let o=0;o<n;o++)for(let s=0;s<i;s++){let a=Au(e,t,o,s,!1);this.stickers[t][s][o].setAppearance(this.filler,a)}}this.scheduleRenderCallback&&($(this,_o,!0),this.lastPos&&this.onPositionChange(this.lastPos),this.scheduleRenderCallback())}onPositionChange(e){let t=e.state,n=new xn;this.movingObj.rotation.copy(n);let i=0,o=this.filler,s=o.ind;if(!this.lastPos||S(this,_o)||!Vi(this.definition,this.lastPos.state,t)){for(let l in this.stickers){let u=this.stickers[l],c=t[l],f=u.length;if(f===1){let h=u[0];for(let p=0;p<h.length;p++){let d=c.permutation[p];this.textured?i+=h[p].setTexture(o,h[d]):i+=h[p].setColor(o,h[d])}}else for(let h=0;h<f;h++){let p=u[h];for(let d=0;d<p.length;d++){let g=(h+f-c.orientation[d])%f,x=c.permutation[d];this.textured?i+=p[d].setTexture(o,u[g][x]):i+=p[d].setColor(o,u[g][x])}}}this.lastPos=e,$(this,_o,!1)}let a=0;for(let l of e.movesInProgress){let u=l.move,c=this.pgdat.unswizzle(u),f=this.pgdat.notationMapper.notationToInternal(u);if(f===null)throw Error("Bad blockmove "+u.family);let h=Yh(this.definition,u.quantum),p=this.axesInfo[c],d=p.axis,g=-this.ease(l.fraction)*l.direction*f.amount*Zn/p.order;if(this.movingObj.rotateOnAxis(d,g),this.lastMove!==h){for(let x in this.stickers){let y=this.stickers[x],m=y.length,b=h[x];for(let w=0;w<m;w++){let D=y[w];for(let R=0;R<D.length;R++){let L=D[R],T=b.permutation[R],U=0;if((T!==R||b.orientation[R]!==0)&&(U=1),U!==L.twistVal){if(U){for(let F=L.stickerStart;F<L.stickerEnd;F++)s[F]|=1;for(let F=L.hintStart;F<L.hintEnd;F++)s[F]|=1;for(let F=L.foundationStart;F<L.foundationEnd;F++)s[F]|=1}else{for(let F=L.stickerStart;F<L.stickerEnd;F++)s[F]&=~1;for(let F=L.hintStart;F<L.hintEnd;F++)s[F]&=~1;for(let F=L.foundationStart;F<L.foundationEnd;F++)s[F]&=~1}L.twistVal=U,a++}}}}this.lastMove=h}}a&&this.filler.makeGroups(this.fixedGeo),i&&(this.textured?(this.fixedGeo.getAttribute("uv").updateRange={offset:0,count:6*this.foundationBound},this.fixedGeo.getAttribute("uv").needsUpdate=!0):(this.fixedGeo.getAttribute("color").updateRange={offset:0,count:9*this.foundationBound},this.fixedGeo.getAttribute("color").needsUpdate=!0)),this.scheduleRenderCallback()}ease(e){return _d(e)}enableHintFacelets(e){this.showHintStickers=e,this.updateMaterialArrays()}updateMaterialArrays(){for(let e=0;e<8;e++)this.materialArray1[e]=Fo,this.materialArray2[e]=Fo;this.materialArray1[0]=this.stickerMaterial,this.materialArray2[1]=this.stickerMaterial,this.showHintStickers?(this.materialArray1[2]=this.hintMaterial,this.materialArray2[3]=this.hintMaterial):(this.materialArray1[2]=Fo,this.materialArray2[3]=Fo),this.showFoundation?(this.materialArray1[6]=rD,this.materialArray2[7]=rD):(this.materialArray1[6]=Fo,this.materialArray2[7]=Fo)}enableFoundation(e){this.showFoundation=e,this.updateMaterialArrays()}setHintStickerOpacity(e){this.hintMaterialDisposable&&(this.hintMaterial.dispose(),this.hintMaterialDisposable=!1),e===0?this.hintMaterial=Fo:e===1?this.hintMaterial=this.stickerMaterial:(this.hintMaterial=new vt({vertexColors:!0,transparent:!0,opacity:.5}),this.hintMaterialDisposable=!0)}experimentalUpdateOptions(e){e.hintFacelets!==void 0&&this.enableHintFacelets(e.hintFacelets!=="none"),e.showFoundation!==void 0&&this.enableFoundation(e.showFoundation),e.hintStickerOpacity!==void 0&&this.setHintStickerOpacity(e.hintStickerOpacity),$(this,_o,!0),this.lastPos&&this.onPositionChange(this.lastPos),this.scheduleRenderCallback()}adduvs(){let e=this.filler;if(e.uvs)return;this.filler.uvs=new Float32Array(12*e.sz);for(let n in this.stickers){let i=this.stickers[n],o=i.length;for(let s=0;s<o;s++){let a=i[s];for(let l of a)l.addUVs(this.filler)}}e.uvs.copyWithin(6*e.sz,0,6*e.sz);let t=e.uvs.subarray(0,6*e.sz);this.fixedGeo.setAttribute("uv",new qe(t,2,!0))}experimentalUpdateTexture(e,t,n){t?n||(n=t):e=!1,e&&!this.filler.uvs&&this.adduvs(),this.textured=e,this.stickerMaterialDisposable&&(this.stickerMaterial.dispose(),this.stickerMaterialDisposable=!1),e?(this.stickerMaterial=new vt({map:t,side:ji,transparent:!1}),this.stickerMaterialDisposable=!0):this.stickerMaterial=Yc,this.hintMaterialDisposable&&(this.hintMaterial.dispose(),this.hintMaterialDisposable=!1),e?(this.hintMaterial=new vt({map:n,side:ji,transparent:!1}),this.hintMaterialDisposable=!0):this.hintMaterial=Yc,this.updateMaterialArrays(),$(this,_o,!0),this.lastPos&&this.onPositionChange(this.lastPos),this.scheduleRenderCallback()}};_o=new WeakMap});function Cr(){return b6??(devicePixelRatio||1)}var b6,kd=oe(()=>{b6=null});var Bd,O2=oe(()=>{Ft();Bd=new Xt(`
|
|
7041
|
+
`)});var _2,Vc,Rd,C2=oe(()=>{Ro();Tt();un();Md();_2={none:!0,"side-by-side":!0,"top-right":!0},Rd=class extends rt{constructor(e={}){super();H(this,Vc,new zn(this,"back-view-",["none","side-by-side","top-right"]));this.addCSS(Pl),e.backView&&e.backView in _2&&S(this,Vc).setValue(e.backView)}setBackView(e){return S(this,Vc).setValue(e)}clear(){this.contentWrapper.innerHTML=""}};Vc=new WeakMap;Qe.define("twisty-viewer-wrapper",Rd)});function Hc(r,e){if(r[1]==="x")return e==="Cube3D"?Q7:ZA;switch(r){case"megaminx":case"gigaminx":return Y7;case"pyraminx":case"master_tetraminx":return X7;case"skewb":return ZA;default:return j7}}var j7,Q7,ZA,Y7,X7,JA,K7,Z7,J7,P2,k2,B2,$7,e6,t6,$A,Td,qc=oe(()=>{li();Gs();KA();C2();j7={latitude:31.717474411461005,longitude:0,distance:5.877852522924731},Q7={latitude:35,longitude:30,distance:6},ZA={latitude:35,longitude:30,distance:6.25},Y7={latitude:Math.atan(1/2)*ui,longitude:0,distance:6.7},X7={latitude:26.56505117707799,longitude:0,distance:6},JA=new M(0,1/6,0);K7={start:!0,end:!0},Z7={"3D":!0,"2D":!0,"experimental-2D-LL":!0,PG3D:!0},J7={checkered:!0,none:!0},P2={floating:!0,none:!0},k2={full:!0,"centers-only":!0,PLL:!0,CLS:!0,OLL:!0,COLL:!0,OCLL:!0,CLL:!0,ELL:!0,ELS:!0,LL:!0,F2L:!0,ZBLL:!0,ZBLS:!0,WVLS:!0,VLS:!0,LS:!0,EO:!0,CMLL:!0,L6E:!0,L6EO:!0,Daisy:!0,Cross:!0,"2x2x2":!0,"2x2x3":!0,"Void Cube":!0,invisible:!0,picture:!0,"experimental-centers-U":!0,"experimental-centers-U-D":!0,"experimental-centers-U-L-D":!0,"experimental-centers-U-L-B-D":!0,"experimental-centers":!0,"experimental-fto-fc":!0,"experimental-fto-f2t":!0,"experimental-fto-sc":!0,"experimental-fto-l2c":!0,"experimental-fto-lbt":!0,"experimental-fto-l3t":!0,"experimental-global-custom-1":!0,"experimental-global-custom-2":!0},B2={"bottom-row":!0,none:!0},$7={"3x3x3":!0,custom:!0,"2x2x2":!0,"4x4x4":!0,"5x5x5":!0,"6x6x6":!0,"7x7x7":!0,"40x40x40":!0,megaminx:!0,pyraminx:!0,square1:!0,clock:!0,skewb:!0,fto:!0,gigaminx:!0,master_tetraminx:!0},e6={twizzle:!0,none:!0},t6={auto:!0,none:!0},$A={alg:"alg","experimental-setup-alg":"experimentalSetupAlg","experimental-setup-anchor":"experimentalSetupAnchor",puzzle:"puzzle",visualization:"visualization","hint-facelets":"hintFacelets","experimental-stickering":"experimentalStickering",background:"background","control-panel":"controlPanel","back-view":"backView","experimental-camera-latitude":"experimentalCameraLatitude","experimental-camera-longitude":"experimentalCameraLongitude","experimental-camera-latitude-limits":"experimentalCameraLatitudeLimits","viewer-link":"viewerLink"},Td=class{constructor(e,t){this.twistyPlayer=e;this.attributes={alg:new Ad(t.alg),"experimental-setup-alg":new Ad(t.experimentalSetupAlg),"experimental-setup-anchor":new xi(K7,t.experimentalSetupAnchor),puzzle:new xi($7,t.puzzle),visualization:new xi(Z7,t.visualization),"hint-facelets":new xi(P2,t.hintFacelets),"experimental-stickering":new xi(k2,t.experimentalStickering),background:new xi(J7,t.background),"control-panel":new xi(B2,t.controlPanel),"back-view":new xi(_2,t.backView),"experimental-camera-latitude":new Dd(null,-90,90,t.experimentalCameraLatitude),"experimental-camera-longitude":new Dd(null,-180,180,t.experimentalCameraLongitude),"experimental-camera-latitude-limits":new xi(t6,t.experimentalCameraLatitudeLimits),"viewer-link":new xi(e6,t.viewerLink)}}static get observedAttributes(){return Object.keys($A)}attributeChangedCallback(e,t,n){let i=this.attributes[e];if(i){t!==null&&i.string!==t&&console.warn("Attribute out of sync!",e,i.string,t),i.setString(n);let o=$A[e];this.twistyPlayer[o]=i.value}}}});function _d(r){return r*r*r*(10-r*(15-6*r))}var z2=oe(()=>{});function Xe(r,e){return new ot().setFromAxisAngle(r,Zn*e/4)}function f6(){return nD??(nD=new Ti(To.foundationWidth,To.foundationWidth,To.foundationWidth))}function iD(){let r=new Pe,e=.5*To.stickerWidth;return r.setAttribute("position",new qe(new Float32Array([e,e,0,-e,e,0,e,-e,0,-e,e,0,-e,-e,0,e,-e,0]),3)),r.setAttribute("uv",new qe(new Float32Array([1,1,0,1,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,1,1]),2)),r}function p6(){return rD??(rD=iD())}var eD,n6,i6,tD,r6,o6,Ws,Fr,ct,s6,To,a6,l6,u6,c6,Dt,Ke,Cd,h6,I2,jc,U2,Pd,nD,rD,Ui,Qc=oe(()=>{li();qn();z2();qc();Gs();eD=new Lc,n6=new vt({color:4473924,side:jn}),i6=new vt({color:13421772,side:At,transparent:!0,opacity:.75}),tD=new vt({visible:!1}),r6=new vt({color:16746751}),o6=new vt({color:16746751,side:At,transparent:!0,opacity:.5}),Ws=class{constructor(e,t,n,i,o,s){this.vector=e;this.fromZ=t;this.color=n;this.dimColor=i;this.hintOpacityScale=o;this.stickerMaterial={regular:new vt({color:n,side:jn}),dim:new vt({color:i,side:jn}),oriented:r6,ignored:n6,invisible:tD},this.hintStickerMaterial={regular:new vt({color:s?.hintColor??n,side:At,transparent:!0,opacity:.5*o}),dim:new vt({color:s?.hintDimColor??n,side:At,transparent:!0,opacity:.5*o}),oriented:o6,ignored:i6,invisible:tD}}},Fr=[new Ws(new M(0,1,0),new xn(-Zn/4,0,0),16777215,14540253,1.25),new Ws(new M(-1,0,0),new xn(0,-Zn/4,0),16746496,8930304,1),new Ws(new M(0,0,1),new xn(0,0,0),65280,34816,1),new Ws(new M(1,0,0),new xn(0,Zn/4,0),16711680,6684672,1),new Ws(new M(0,0,-1),new xn(0,Zn/2,0),255,136,.75,{hintColor:17663,hintDimColor:8840}),new Ws(new M(0,-1,0),new xn(Zn/4,0,0),16776960,8947712,1.25)],ct={U:0,L:1,F:2,R:3,B:4,D:5},s6={U:ct.U,u:ct.U,Uw:ct.U,Uv:ct.U,y:ct.U,L:ct.L,l:ct.L,Lw:ct.L,Lv:ct.L,M:ct.L,F:ct.F,f:ct.F,Fw:ct.F,Fv:ct.F,S:ct.F,z:ct.F,R:ct.R,r:ct.R,Rw:ct.R,Rv:ct.R,x:ct.R,B:ct.B,b:ct.B,Bw:ct.B,Bv:ct.B,D:ct.D,d:ct.D,Dw:ct.D,Dv:ct.D,E:ct.D},To={stickerWidth:.85,stickerElevation:.503,foundationWidth:1,hintStickerElevation:1.45},a6=2,l6={showMainStickers:!0,hintFacelets:"floating",showFoundation:!0,experimentalStickering:"full",foundationSprite:null,hintSprite:null},u6=new vt({color:0,opacity:1,transparent:!0}),c6=new vt({color:0,opacity:.3,transparent:!0}),Dt=class{constructor(e,t,n){this.orbit=e;let i=typeof t=="string"?t.split(""):t;this.stickerFaces=i.map(o=>ct[o]),this.matrix=new Ae,this.matrix.setPosition(Cd[e]),this.matrix.premultiply(new Ae().makeRotationFromQuaternion(n))}};Ke={O:new M(0,0,0),U:new M(0,-1,0),L:new M(1,0,0),F:new M(0,0,-1),R:new M(-1,0,0),B:new M(0,0,1),D:new M(0,1,0)},Cd={EDGES:new M(0,1,1),CORNERS:new M(1,1,1),CENTERS:new M(0,1,0)},h6={EDGES:[0,1].map(r=>new Ae().makeRotationAxis(Cd.EDGES.clone().normalize(),-r*Zn/2)),CORNERS:[0,1,2].map(r=>new Ae().makeRotationAxis(Cd.CORNERS.clone().normalize(),-r*Zn/3)),CENTERS:[0,1,2,3].map(r=>new Ae().makeRotationAxis(Cd.CENTERS.clone().normalize(),-r*Zn/4))},I2=[ct.U,ct.F,ct.R],jc={EDGES:[new Dt("EDGES","UF",Xe(Ke.O,0)),new Dt("EDGES","UR",Xe(Ke.U,3)),new Dt("EDGES","UB",Xe(Ke.U,2)),new Dt("EDGES","UL",Xe(Ke.U,1)),new Dt("EDGES","DF",Xe(Ke.F,2)),new Dt("EDGES","DR",Xe(Ke.F,2).premultiply(Xe(Ke.D,1))),new Dt("EDGES","DB",Xe(Ke.F,2).premultiply(Xe(Ke.D,2))),new Dt("EDGES","DL",Xe(Ke.F,2).premultiply(Xe(Ke.D,3))),new Dt("EDGES","FR",Xe(Ke.U,3).premultiply(Xe(Ke.R,3))),new Dt("EDGES","FL",Xe(Ke.U,1).premultiply(Xe(Ke.R,3))),new Dt("EDGES","BR",Xe(Ke.U,3).premultiply(Xe(Ke.R,1))),new Dt("EDGES","BL",Xe(Ke.U,1).premultiply(Xe(Ke.R,1)))],CORNERS:[new Dt("CORNERS","UFR",Xe(Ke.O,0)),new Dt("CORNERS","URB",Xe(Ke.U,3)),new Dt("CORNERS","UBL",Xe(Ke.U,2)),new Dt("CORNERS","ULF",Xe(Ke.U,1)),new Dt("CORNERS","DRF",Xe(Ke.F,2).premultiply(Xe(Ke.D,1))),new Dt("CORNERS","DFL",Xe(Ke.F,2).premultiply(Xe(Ke.D,0))),new Dt("CORNERS","DLB",Xe(Ke.F,2).premultiply(Xe(Ke.D,3))),new Dt("CORNERS","DBR",Xe(Ke.F,2).premultiply(Xe(Ke.D,2)))],CENTERS:[new Dt("CENTERS","U",Xe(Ke.O,0)),new Dt("CENTERS","L",Xe(Ke.R,3).premultiply(Xe(Ke.U,1))),new Dt("CENTERS","F",Xe(Ke.R,3)),new Dt("CENTERS","R",Xe(Ke.R,3).premultiply(Xe(Ke.D,1))),new Dt("CENTERS","B",Xe(Ke.R,3).premultiply(Xe(Ke.D,2))),new Dt("CENTERS","D",Xe(Ke.R,2))]},U2=1/3,Pd={EDGES:[[[0,4,6],[0,4,5]],[[3,5,7],[0,7,5]],[[2,4,8],[0,10,5]],[[1,3,7],[0,1,5]],[[2,4,2],[2,4,3]],[[3,5,1],[2,7,3]],[[0,4,0],[2,10,3]],[[1,3,1],[2,1,3]],[[3,5,4],[3,6,4]],[[1,3,4],[1,2,4]],[[1,9,4],[1,8,4]],[[3,11,4],[3,0,4]]],CORNERS:[[[0,5,6],[0,5,5],[0,6,5]],[[3,5,8],[0,8,5],[0,9,5]],[[2,3,8],[0,11,5],[0,0,5]],[[1,3,6],[0,2,5],[0,3,5]],[[3,5,2],[2,6,3],[2,5,3]],[[2,3,2],[2,3,3],[2,2,3]],[[1,3,0],[2,0,3],[2,11,3]],[[0,5,0],[2,9,3],[2,8,3]]],CENTERS:[[[0,4,7]],[[0,1,4]],[[0,4,4]],[[0,7,4]],[[0,10,4]],[[0,4,1]]]},nD=null;rD=null;Ui=class extends je{constructor(e,t,n,i={}){super();this.def=e;this.scheduleRenderCallback=n;this.pieces={};this.experimentalHintStickerMeshes=[];this.experimentalFoundationMeshes=[];this.sprite=new Promise(e=>{this.setSpriteURL=t=>{eD.load(t,e)}});this.hintSprite=new Promise(e=>{this.setHintSpriteURL=t=>{eD.load(t,e)}});if(this.options={...l6},Object.assign(this.options,i),this.def.name!=="3x3x3")throw new Error(`Invalid puzzle for this Cube3D implementation: ${this.def.name}`);i.foundationSprite&&this.setSprite(i.foundationSprite),i.hintSprite&&this.setHintSprite(i.hintSprite),this.kpuzzleFaceletInfo={};for(let o in jc){let s=[];this.kpuzzleFaceletInfo[o]=s,this.pieces[o]=jc[o].map(this.createCubie.bind(this,o,s))}this.scale.set(U2,U2,U2),this.options.experimentalStickering&&this.setStickering(this.options.experimentalStickering),t?.addPositionListener(this)}setSprite(e){this.sprite=e}setHintSprite(e){this.hintSprite=e}experimentalSetStickerSpriteURL(e){this.setSpriteURL(e)}experimentalSetHintStickerSpriteURL(e){this.setHintSpriteURL(e)}setStickering(e){(async()=>{let t=await Ot["3x3x3"].appearance(e??"full");this.setAppearance(t??await Ot["3x3x3"].appearance("full"))})()}setAppearance(e){for(let[t,n]of Object.entries(e.orbits))for(let i=0;i<n.pieces.length;i++){let o=n.pieces[i];if(o){let s=this.kpuzzleFaceletInfo[t][i];for(let a=0;a<s.length;a++){let l=o.facelets[a];if(l){let u=s[a],c=typeof l=="string"?l:l?.appearance;u.facelet.material=Fr[u.faceIdx].stickerMaterial[c];let f=typeof l=="string"?c:l.hintAppearance??c;u.hintFacelet&&(u.hintFacelet.material=Fr[u.faceIdx].hintStickerMaterial[f])}}}}this.scheduleRenderCallback&&this.scheduleRenderCallback()}experimentalUpdateOptions(e){if("showMainStickers"in e)throw new Error("Unimplemented");let t=e.showFoundation;if(typeof t!="undefined"&&this.options.showFoundation!==t){this.options.showFoundation=t;for(let o of this.experimentalFoundationMeshes)o.visible=t}let n=e.hintFacelets;if(typeof n!="undefined"&&this.options.hintFacelets!==n&&P2[n]){this.options.hintFacelets=n;for(let o of this.experimentalHintStickerMeshes)o.visible=n==="floating";this.scheduleRenderCallback()}let i=e.experimentalStickering;typeof i!="undefined"&&this.options.experimentalStickering!==i&&k2[i]&&(this.options.experimentalStickering=i,this.setStickering(i),this.scheduleRenderCallback())}onPositionChange(e){let t=e.state;for(let n in jc){let i=jc[n];for(let o=0;o<i.length;o++){let s=t[n].permutation[o];this.pieces[n][s].matrix.copy(jc[n][o].matrix),this.pieces[n][s].matrix.multiply(h6[n][t[n].orientation[o]])}for(let o of e.movesInProgress){let s=o.move,a=Fr[s6[s.family]].vector,l=new Ae().makeRotationAxis(a,-this.ease(o.fraction)*o.direction*s.amount*Zn/4);for(let u=0;u<i.length;u++){let c=this.def.moves[s.family][n].permutation[u];if(u!==c||this.def.moves[s.family][n].orientation[u]!==0){let f=t[n].permutation[u];this.pieces[n][f].matrix.premultiply(l)}}}}this.scheduleRenderCallback()}createCubie(e,t,n,i){let o=[];t.push(o);let s=new gi;if(this.options.showFoundation){let a=this.createCubieFoundation();s.add(a),this.experimentalFoundationMeshes.push(a)}for(let a=0;a<n.stickerFaces.length;a++){let l=this.createSticker(Fr[I2[a]],Fr[n.stickerFaces[a]],!1),u={faceIdx:n.stickerFaces[a],facelet:l};if(s.add(l),this.options.hintFacelets==="floating"){let c=this.createSticker(Fr[I2[a]],Fr[n.stickerFaces[a]],!0);s.add(c),u.hintFacelet=c,this.experimentalHintStickerMeshes.push(c)}if(this.options.experimentalStickering==="picture"&&Pd[e]&&Pd[e][i]&&Pd[e][i][a]){let[c,f,h]=Pd[e][i][a];(async()=>{let p=async d=>{let g=await(d?this.hintSprite:this.sprite),x=this.createSticker(Fr[I2[a]],Fr[n.stickerFaces[a]],d);x.material=new vt({map:g,side:d?At:jn,transparent:!0});let y=f/12,m=(f+1)/12,b=h/9,w=(h+1)/9,D=new ee(y,b),R=new ee(y,w),L=new ee(m,w),T=new ee(m,b);switch(c){case 1:[D,R,L,T]=[R,L,T,D];break;case 2:[D,R,L,T]=[L,T,D,R];break;case 3:[D,R,L,T]=[T,D,R,L];break}x.geometry.setAttribute("uv",new qe(new Float32Array([L.x,L.y,R.x,R.y,T.x,T.y,R.x,R.y,D.x,D.y,T.x,T.y]),2)),s.add(x)};p(!0),p(!1)})()}o.push(u)}return s.matrix.copy(n.matrix),s.matrixAutoUpdate=!1,this.add(s),s}createCubieFoundation(){let e=f6();return new Lt(e,this.options.experimentalStickering==="picture"?u6:c6)}createSticker(e,t,n){let i=this.options.experimentalStickering==="picture"?iD():p6(),o=new Lt(i,n?t.hintStickerMaterial.regular:t.stickerMaterial.regular);return o.setRotationFromEuler(e.fromZ),o.position.copy(e.vector),o.position.multiplyScalar(n?this.options.experimentalStickering==="picture"?a6:To.hintStickerElevation:To.stickerElevation),o}experimentalSetFoundationOpacity(e){this.experimentalFoundationMeshes[0].material.opacity=e}experimentalSetStickerWidth(e){for(let t of Object.values(this.kpuzzleFaceletInfo))for(let n of t)for(let i of n)i.facelet.scale.setScalar(e/To.stickerWidth)}experimentalSetCenterStickerWidth(e){for(let t of[this.kpuzzleFaceletInfo.CENTERS])for(let n of t)for(let i of n)i.facelet.scale.setScalar(e/To.stickerWidth)}ease(e){return _d(e)}}});function N2(r,e,t){return Math.hypot(r[3*e]-r[3*t],r[3*e+1]-r[3*t+1],r[3*e+2]-r[3*t+2])}function d6(r,e,t,n){let i=N2(r,e,t),o=N2(r,t,n),s=N2(r,e,n),a=(i+o+s)/2;return Math.sqrt(a*(a-i)*(a-o)*(a-s))}function m6(r){let e=0;for(let t=2;3*t<r.length;t++)e+=d6(r,0,1,t);return e}function g6(r){let e=Math.hypot(r[0],r[1],r[2]);return r[0]/=e,r[1]/=e,r[2]/=e,r}function y6(r,e){let t=new Array(3);return t[0]=r[1]*e[2]-r[2]*e[1],t[1]=r[2]*e[0]-r[0]*e[2],t[2]=r[0]*e[1]-r[1]*e[0],t}function v6(r){let e=[r[3]-r[0],r[4]-r[1],r[5]-r[2]],t=[r[6]-r[3],r[7]-r[4],r[8]-r[5]],n=y6(e,t);return g6(n)}function x6(r,e){let t=[],n=new Array(3),i=new Array(3);for(let o=1;o<10;o++){for(let a=0;a<r.length;a+=3){let l=(a+r.length-3)%r.length,u=(a+3)%r.length;for(let d=0;d<3;d++)n[d]=r[l+d]-r[a+d],i[d]=r[u+d]-r[a+d];let c=Math.hypot(n[0],n[1],n[2]),f=Math.hypot(i[0],i[1],i[2]);for(let d=0;d<3;d++)n[d]/=c,i[d]/=f;let h=n[0]*i[0]+n[1]*i[1]+n[2]*i[2],p=e/Math.sqrt(1-h*h);for(let d=0;d<3;d++)t[a+d]=r[a+d]+(n[d]+i[d])*p}let s=!0;for(let a=0;s&&a<t.length;a+=3){let l=(a+3)%r.length,u=0;for(let c=0;c<3;c++){let f=r[l+c]-r[a+c],h=t[l+c]-t[a+c];u+=f*h}u<=0&&(s=!1)}if(s)return t;e/=2}return r}var oD,Fo,Yc,O2,sD,aD,lD,w6,_r,_o,wi,Xc=oe(()=>{li();Ht();Ht();qn();z2();Gs();oD=new vt({side:jn,color:0}),Fo=new vt({visible:!1}),Yc=new vt({vertexColors:!0});O2=class{constructor(e,t){this.sz=e;this.tm=t;this.vertices=new Float32Array(9*e),this.uvs=void 0,this.colors=new Uint8Array(18*e),this.ind=new Uint8Array(e),this.pos=0,this.ipos=0}add(e,t,n){this.vertices[this.pos]=e[3*t+0],this.vertices[this.pos+1]=e[3*t+1],this.vertices[this.pos+2]=e[3*t+2],this.colors[this.pos]=n>>16,this.colors[this.pos+1]=n>>8&255,this.colors[this.pos+2]=n&255,this.pos+=3}addUncolored(e,t){this.vertices[this.pos]=e[3*t+0],this.vertices[this.pos+1]=e[3*t+1],this.vertices[this.pos+2]=e[3*t+2],this.pos+=3}setind(e){this.ind[this.ipos++]=e}makePoly(e,t,n){let i=e;for(let o=1;3*(o+1)<i.length;o++)this.add(i,0,t),this.add(i,o,t),this.add(i,o+1,t),this.setind(n)}setAttributes(e){e.setAttribute("position",new qe(this.vertices,3));let t=this.colors.subarray(0,9*this.sz);e.setAttribute("color",new qe(t,3,!0))}makeGroups(e){e.clearGroups();for(let t=0;t<this.ipos;){let n=t++,i=this.ind[n];for(;this.ind[t]===i;)t++;e.addGroup(3*n,3*(t-n),i)}}saveOriginalColors(){this.colors.copyWithin(this.pos,0,this.pos)}},sD=class{constructor(e,t,n,i){this.texturePtr=void 0;this.twistVal=-1;this.isDup=!!t.isDup,this.faceNum=t.face,this.stickerStart=e.ipos;let o=new xe(t.color).getHex();this.origColor=o,this.origColorAppearance=o,i?.appearance&&this.setAppearance(e,i.appearance),this.faceColor=o;let s=this.stickerCoords(t.coords,n);e.makePoly(s,this.faceColor,this.isDup?4:0),this.stickerEnd=e.ipos}stickerCoords(e,t){return x6(e.slice(),t)}hintCoords(e,t,n,i){e=this.stickerCoords(e,n),i=i.slice();for(let s=0;s<3;s++)i[s]*=.5*t;let o=new Array(e.length);for(let s=0;3*s<e.length;s++){let a=e.length/3-1-s;o[3*s]=e[3*a]+i[0],o[3*s+1]=e[3*a+1]+i[1],o[3*s+2]=e[3*a+2]+i[2]}return o}foundationCoords(e){let t=e.slice();for(let n=0;n<e.length;n++)t[n]=e[n]*.999;return t}addHint(e,t,n,i,o,s){this.hintStart=e.ipos;let a=this.hintCoords(t.coords,i,o,s);e.makePoly(a,this.faceColor,n&&!this.isDup?2:4),this.hintEnd=e.ipos}addFoundation(e,t,n){this.foundationStart=e.ipos;let i=this.foundationCoords(t.coords);e.makePoly(i,n,this.isDup?4:6),this.foundationEnd=e.ipos}setHintStickers(e,t){let n=this.isDup||!t?4:2;for(let i=this.hintStart;i<this.hintEnd;i++)e.ind[i]=n|e.ind[i]&1}setAppearance(e,t){let n=0;switch(t){case"regular":n=this.origColor;break;case"dim":this.origColor===16777215?n=14540253:n=new xe(this.origColor).multiplyScalar(.5).getHex();break;case"oriented":n=16746751;break;case"ignored":n=4473924;break;case"invisible":n=this.origColor}this.origColorAppearance=n;for(let i=9*this.stickerStart;i<9*this.stickerEnd;i+=3)e.colors[e.pos+i]=n>>16,e.colors[e.pos+i+1]=n>>8&255,e.colors[e.pos+i+2]=n&255;for(let i=9*this.hintStart;i<9*this.hintEnd;i+=3)e.colors[e.pos+i]=n>>16,e.colors[e.pos+i+1]=n>>8&255,e.colors[e.pos+i+2]=n&255;this.setHintStickers(e,t!=="invisible"&&!this.isDup)}addUVs(e){let t=e.uvs,n=e.vertices,i=new Array(3);for(let o=3*this.stickerStart;o<3*this.stickerEnd;o++){i[0]=n[3*o],i[1]=n[3*o+1],i[2]=n[3*o+2];let s=e.tm.getuv(this.faceNum,i);t[2*o]=s[0],t[2*o+1]=s[1]}for(let o=3*this.hintStart;o<3*this.hintEnd;o++){i[0]=n[3*o],i[1]=n[3*o+1],i[2]=n[3*o+2];let s=e.tm.getuv(this.faceNum,i);t[2*o]=s[0],t[2*o+1]=s[1]}}setTexture(e,t){if(this.texturePtr===t)return 0;this.texturePtr=t;let n=6*e.sz;return e.uvs.copyWithin(6*this.stickerStart,6*t.stickerStart+n,6*t.stickerEnd+n),e.uvs.copyWithin(6*this.hintStart,6*t.hintStart+n,6*t.hintEnd+n),1}setColor(e,t){let n=t.origColorAppearance;if(this.faceColor!==n){this.faceColor=n;let i=e.pos;return e.colors.copyWithin(9*this.stickerStart,9*t.stickerStart+i,9*t.stickerEnd+i),e.colors.copyWithin(9*this.hintStart,9*t.hintStart+i,9*t.hintEnd+i),1}else return 0}},aD=class{constructor(e,t){this.cubie=new gi;let n=e.coords,i=new O2(n.length/3-2,t);for(let s=1;3*s+3<n.length;s++)i.addUncolored(n,0),i.addUncolored(n,s),i.addUncolored(n,s+1);this.geo=new Pe,i.setAttributes(this.geo);let o=new Lt(this.geo,Fo);o.userData.name=e.name,this.cubie.scale.setScalar(.99),this.cubie.add(o)}},lD=class{constructor(e){let t=e[0];this.axis=new M(t[0],t[1],t[2]),this.order=e[2]}},w6=.71,_r=.5,wi=class extends je{constructor(e,t,n,i,o=!1,s=!1,a=1,l={}){super();this.scheduleRenderCallback=t;this.definition=n;this.pgdat=i;this.showFoundation=o;this.showHintStickers=s;this.params=l;this.stickerTargets=[];this.controlTargets=[];this.textured=!1;H(this,_o,!1);if(i.stickers.length===0)throw Error("Reuse of stickerdat from pg; please don't do that.");this.hintMaterial=new vt({vertexColors:!0,transparent:!0,opacity:.5}),this.hintMaterialDisposable=!0,this.stickerMaterial=Yc,this.stickerMaterialDisposable=!1,this.axesInfo={};let u=this.pgdat.axis;for(let T of u)this.axesInfo[T[1]]=new lD(T);let c=this.pgdat.stickers;this.stickers={},this.materialArray1=new Array(8),this.materialArray2=new Array(8),this.enableFoundation(o),this.updateMaterialArrays();let f=0,h=3;for(let T of c){let U=T.coords.length/3;f+=h*(U-2)}let p=new O2(f,i.textureMapper),d=0,g=[],x=0;for(let T of i.faces)g.push(v6(T.coords)),x+=m6(T.coords);let y=w6,m=0;for(let T of c)T.isDup||m++;let b=Math.sqrt(x/m)*(1-Math.sqrt(y))/2;for(let T of c){let U=T.orbit,F=T.ord,C=T.ori;this.stickers[U]||(this.stickers[U]=[]),this.stickers[U][C]||(this.stickers[U][C]=[]);let j={};l.appearance&&(j.appearance=Au(l.appearance,U,F,C,!1));let B=new sD(p,T,b,j);this.stickers[U][C][F]=B}for(let T of c){let U=T.orbit,F=T.ord,C=T.ori;this.stickers[U][C][F].addHint(p,T,s,a,b,g[T.face])}this.foundationBound=p.ipos;for(let T of c){let U=T.orbit,F=T.ord,C=T.ori;this.stickers[U][C][F].addFoundation(p,T,d)}let w=new Pe;p.setAttributes(w),p.makeGroups(w);let D=new Lt(w,this.materialArray1);D.scale.set(_r,_r,_r),this.add(D);let R=new Lt(w,this.materialArray2);R.scale.set(_r,_r,_r),this.add(R);let L=this.pgdat.faces;this.movingObj=R,this.fixedGeo=w,this.filler=p;for(let T of L){let U=new aD(T,i.textureMapper);U.cubie.scale.set(_r,_r,_r),this.add(U.cubie),this.controlTargets.push(U.cubie.children[0])}p.saveOriginalColors(),e.addPositionListener(this),i.stickers=[]}dispose(){this.fixedGeo&&this.fixedGeo.dispose(),this.stickerMaterialDisposable&&(this.stickerMaterial.dispose(),this.stickerMaterial=Yc,this.stickerMaterialDisposable=!1),this.hintMaterialDisposable&&(this.hintMaterial.dispose(),this.hintMaterial=Yc,this.hintMaterialDisposable=!1)}experimentalGetStickerTargets(){return this.stickerTargets}experimentalGetControlTargets(){return this.controlTargets}experimentalSetAppearance(e){this.params.appearance=e;for(let t in this.definition.orbits){let{numPieces:n,orientations:i}=this.definition.orbits[t];for(let o=0;o<n;o++)for(let s=0;s<i;s++){let a=Au(e,t,o,s,!1);this.stickers[t][s][o].setAppearance(this.filler,a)}}this.scheduleRenderCallback&&($(this,_o,!0),this.lastPos&&this.onPositionChange(this.lastPos),this.scheduleRenderCallback())}onPositionChange(e){let t=e.state,n=new xn;this.movingObj.rotation.copy(n);let i=0,o=this.filler,s=o.ind;if(!this.lastPos||S(this,_o)||!Vi(this.definition,this.lastPos.state,t)){for(let l in this.stickers){let u=this.stickers[l],c=t[l],f=u.length;if(f===1){let h=u[0];for(let p=0;p<h.length;p++){let d=c.permutation[p];this.textured?i+=h[p].setTexture(o,h[d]):i+=h[p].setColor(o,h[d])}}else for(let h=0;h<f;h++){let p=u[h];for(let d=0;d<p.length;d++){let g=(h+f-c.orientation[d])%f,x=c.permutation[d];this.textured?i+=p[d].setTexture(o,u[g][x]):i+=p[d].setColor(o,u[g][x])}}}this.lastPos=e,$(this,_o,!1)}let a=0;for(let l of e.movesInProgress){let u=l.move,c=this.pgdat.unswizzle(u),f=this.pgdat.notationMapper.notationToInternal(u);if(f===null)throw Error("Bad blockmove "+u.family);let h=Yh(this.definition,u.quantum),p=this.axesInfo[c],d=p.axis,g=-this.ease(l.fraction)*l.direction*f.amount*Zn/p.order;if(this.movingObj.rotateOnAxis(d,g),this.lastMove!==h){for(let x in this.stickers){let y=this.stickers[x],m=y.length,b=h[x];for(let w=0;w<m;w++){let D=y[w];for(let R=0;R<D.length;R++){let L=D[R],T=b.permutation[R],U=0;if((T!==R||b.orientation[R]!==0)&&(U=1),U!==L.twistVal){if(U){for(let F=L.stickerStart;F<L.stickerEnd;F++)s[F]|=1;for(let F=L.hintStart;F<L.hintEnd;F++)s[F]|=1;for(let F=L.foundationStart;F<L.foundationEnd;F++)s[F]|=1}else{for(let F=L.stickerStart;F<L.stickerEnd;F++)s[F]&=~1;for(let F=L.hintStart;F<L.hintEnd;F++)s[F]&=~1;for(let F=L.foundationStart;F<L.foundationEnd;F++)s[F]&=~1}L.twistVal=U,a++}}}}this.lastMove=h}}a&&this.filler.makeGroups(this.fixedGeo),i&&(this.textured?(this.fixedGeo.getAttribute("uv").updateRange={offset:0,count:6*this.foundationBound},this.fixedGeo.getAttribute("uv").needsUpdate=!0):(this.fixedGeo.getAttribute("color").updateRange={offset:0,count:9*this.foundationBound},this.fixedGeo.getAttribute("color").needsUpdate=!0)),this.scheduleRenderCallback()}ease(e){return _d(e)}enableHintFacelets(e){this.showHintStickers=e,this.updateMaterialArrays()}updateMaterialArrays(){for(let e=0;e<8;e++)this.materialArray1[e]=Fo,this.materialArray2[e]=Fo;this.materialArray1[0]=this.stickerMaterial,this.materialArray2[1]=this.stickerMaterial,this.showHintStickers?(this.materialArray1[2]=this.hintMaterial,this.materialArray2[3]=this.hintMaterial):(this.materialArray1[2]=Fo,this.materialArray2[3]=Fo),this.showFoundation?(this.materialArray1[6]=oD,this.materialArray2[7]=oD):(this.materialArray1[6]=Fo,this.materialArray2[7]=Fo)}enableFoundation(e){this.showFoundation=e,this.updateMaterialArrays()}setHintStickerOpacity(e){this.hintMaterialDisposable&&(this.hintMaterial.dispose(),this.hintMaterialDisposable=!1),e===0?this.hintMaterial=Fo:e===1?this.hintMaterial=this.stickerMaterial:(this.hintMaterial=new vt({vertexColors:!0,transparent:!0,opacity:.5}),this.hintMaterialDisposable=!0)}experimentalUpdateOptions(e){e.hintFacelets!==void 0&&this.enableHintFacelets(e.hintFacelets!=="none"),e.showFoundation!==void 0&&this.enableFoundation(e.showFoundation),e.hintStickerOpacity!==void 0&&this.setHintStickerOpacity(e.hintStickerOpacity),$(this,_o,!0),this.lastPos&&this.onPositionChange(this.lastPos),this.scheduleRenderCallback()}adduvs(){let e=this.filler;if(e.uvs)return;this.filler.uvs=new Float32Array(12*e.sz);for(let n in this.stickers){let i=this.stickers[n],o=i.length;for(let s=0;s<o;s++){let a=i[s];for(let l of a)l.addUVs(this.filler)}}e.uvs.copyWithin(6*e.sz,0,6*e.sz);let t=e.uvs.subarray(0,6*e.sz);this.fixedGeo.setAttribute("uv",new qe(t,2,!0))}experimentalUpdateTexture(e,t,n){t?n||(n=t):e=!1,e&&!this.filler.uvs&&this.adduvs(),this.textured=e,this.stickerMaterialDisposable&&(this.stickerMaterial.dispose(),this.stickerMaterialDisposable=!1),e?(this.stickerMaterial=new vt({map:t,side:ji,transparent:!1}),this.stickerMaterialDisposable=!0):this.stickerMaterial=Yc,this.hintMaterialDisposable&&(this.hintMaterial.dispose(),this.hintMaterialDisposable=!1),e?(this.hintMaterial=new vt({map:n,side:ji,transparent:!1}),this.hintMaterialDisposable=!0):this.hintMaterial=Yc,this.updateMaterialArrays(),$(this,_o,!0),this.lastPos&&this.onPositionChange(this.lastPos),this.scheduleRenderCallback()}};_o=new WeakMap});function Cr(){return b6??(devicePixelRatio||1)}var b6,kd=oe(()=>{b6=null});var Bd,G2=oe(()=>{Tt();Bd=new Xt(`
|
|
7042
7042
|
:host {
|
|
7043
7043
|
width: 384px;
|
|
7044
7044
|
height: 256px;
|
|
@@ -7061,12 +7061,12 @@ Alg R' U' R U B' U' B L\`)})}var $s,ea,ra=S(()=>{ll();$n();$s=null;ea=null});var
|
|
|
7061
7061
|
.wrapper.invisible {
|
|
7062
7062
|
opacity: 0;
|
|
7063
7063
|
}
|
|
7064
|
-
`)});function cD(r){return(Math.exp(1-r)-(1-r))/(1-Math.E)+1}var lD,S6,L6,G2,A6,uD,W2,Jn,Zc,Bl,H2,Pr,Co,Kc,V2,hD=oe(()=>{li();Gs();Rr();lD=1e-8,S6=!0,L6="auto",G2=500,A6=50,uD=.75;W2=class{constructor(e,t,n,i){this.startTimestamp=e;this.momentumX=t;this.momentumY=n;this.callback=i;this.scheduler=new ln(this.render.bind(this));this.scheduler.requestAnimFrame(),this.lastTimestamp=e}render(e){let t=(this.lastTimestamp-this.startTimestamp)/G2,n=Math.min(1,(e-this.startTimestamp)/G2);if(t===0&&n>A6/G2)return;let i=cD(n)-cD(t);this.callback(this.momentumX*i*1e3,this.momentumY*i*1e3),n<1&&this.scheduler.requestAnimFrame(),this.lastTimestamp=e}},V2=class{constructor(e,t,n){this.camera=e;this.canvas=t;this.scheduleRender=n;H(this,Bl);H(this,Co);H(this,Jn,new Mc);H(this,Zc,new M(0,0,0));this.experimentalInertia=S6;this.experimentalLatitudeLimits=L6;this.lastTouchClientX=0;this.lastTouchClientY=0;this.currentTouchID=null;this.onMoveBound=this.onMove.bind(this);this.onMouseMoveBound=this.onMouseMove.bind(this);this.onMouseEndBound=this.onMouseEnd.bind(this);this.onTouchMoveBound=this.onTouchMove.bind(this);this.onTouchEndBound=this.onTouchEnd.bind(this);this.lastTouchTimestamp=0;this.lastTouchMoveMomentumX=0;this.lastTouchMoveMomentumY=0;this.lastMouseTimestamp=0;this.lastMouseMoveMomentumX=0;this.lastMouseMoveMomentumY=0;this.experimentalHasBeenMoved=!1;H(this,Pr,!0);S(this,Jn).setFromVector3(e.position),ye(this,Co,Kc).call(this),t.addEventListener("mousedown",this.onMouseStart.bind(this)),t.addEventListener("touchstart",this.onTouchStart.bind(this))}lookAt(e){if(!!S(this,Pr)){$(this,Zc,e),$(this,Pr,!1),ye(this,Bl,H2).call(this),this.scheduleRender();try{this.mirrorControls&&this.mirrorControls.lookAt(e)}finally{$(this,Pr,!0)}}}set latitude(e){S(this,Jn).phi=(90-e)/ui,ye(this,Co,Kc).call(this)}get latitude(){return 90-S(this,Jn).phi*ui}set longitude(e){S(this,Jn).theta=e/ui,ye(this,Co,Kc).call(this)}get longitude(){return S(this,Jn).theta*ui}set distance(e){S(this,Jn).radius=e,ye(this,Co,Kc).call(this)}get distance(){return S(this,Jn).radius}get orbitCoordinates(){return{latitude:this.latitude,longitude:this.longitude,distance:this.distance}}set orbitCoordinates(e){this.latitude=e.latitude,this.longitude=e.longitude,this.distance=e.distance}temperMovement(e){return Math.sign(e)*Math.log(Math.abs(e*10)+1)/6}onMouseStart(e){this.experimentalHasBeenMoved=!0,window.addEventListener("mousemove",this.onMouseMoveBound),window.addEventListener("mouseup",this.onMouseEndBound),this.onStart(e),this.lastMouseTimestamp=e.timeStamp}onMouseMove(e){if(e.buttons===0){this.onMouseEnd(e);return}if(e.movementX===0&&e.movementY===0){console.log("short-circuit mouse!");return}let t=Math.min(this.canvas.offsetWidth,this.canvas.offsetHeight),n=this.temperMovement(e.movementX/t),i=this.temperMovement(e.movementY/t*uD);this.onMove(n,i);let o=e.timeStamp-this.lastMouseTimestamp;o>0&&(this.lastMouseMoveMomentumX=n/o,this.lastMouseMoveMomentumY=i/o,this.lastMouseTimestamp=e.timeStamp)}onMouseEnd(e){window.removeEventListener("mousemove",this.onMouseMoveBound),window.removeEventListener("mouseup",this.onMouseEndBound),this.onEnd(e),this.experimentalInertia&&new W2(this.lastMouseTimestamp,this.lastMouseMoveMomentumX,this.lastMouseMoveMomentumY,this.onMoveBound)}onTouchStart(e){if(this.experimentalHasBeenMoved=!0,this.currentTouchID===null){if(e.touches[0].clientX===0&&e.touches[0].clientY===0){console.log("short-circuit touch!");return}this.currentTouchID=e.changedTouches[0].identifier,this.lastTouchClientX=e.touches[0].clientX,this.lastTouchClientY=e.touches[0].clientY,window.addEventListener("touchmove",this.onTouchMoveBound),window.addEventListener("touchend",this.onTouchEndBound),window.addEventListener("touchcancel",this.onTouchEndBound),this.onStart(e),this.lastTouchTimestamp=e.timeStamp}}onTouchMove(e){for(let t=0;t<e.changedTouches.length;t++){let n=e.changedTouches[t];if(n.identifier===this.currentTouchID){let i=Math.min(this.canvas.offsetWidth,this.canvas.offsetHeight),o=this.temperMovement((n.clientX-this.lastTouchClientX)/i),s=this.temperMovement((n.clientY-this.lastTouchClientY)/i*uD);this.onMove(o,s),this.lastTouchClientX=n.clientX,this.lastTouchClientY=n.clientY;let a=e.timeStamp-this.lastTouchTimestamp;a>0&&(this.lastTouchMoveMomentumX=o/a,this.lastTouchMoveMomentumY=s/a,this.lastTouchTimestamp=e.timeStamp)}}}onTouchEnd(e){for(let t=0;t<e.changedTouches.length;t++)e.changedTouches[t].identifier===this.currentTouchID&&(this.currentTouchID=null,window.removeEventListener("touchmove",this.onTouchMoveBound),window.removeEventListener("touchend",this.onTouchEndBound),window.removeEventListener("touchcancel",this.onTouchEndBound),this.onEnd(e));this.experimentalInertia&&new W2(this.lastTouchTimestamp,this.lastTouchMoveMomentumX,this.lastTouchMoveMomentumY,this.onMoveBound)}onStart(e){e.preventDefault()}onMove(e,t){let n=new Mc;n.copy(S(this,Jn)),n.theta+=-2*e,n.phi+=-2*t,this.experimentalLatitudeLimits!=="none"?(n.phi=Math.max(n.phi,Math.PI*.3),n.phi=Math.min(n.phi,Math.PI*.7)):(n.phi=Math.max(n.phi,lD),n.phi=Math.min(n.phi,Math.PI-lD)),!(isNaN(n.theta)||n.theta===1/0||n.theta===-1/0)&&(isNaN(n.phi)||n.phi===1/0||n.phi===-1/0||($(this,Jn,n),ye(this,Co,Kc).call(this)))}onEnd(e){e.preventDefault()}setMirror(e){this.mirrorControls=e}updateMirroredCamera(e){S(this,Pr)&&(this.latitude=-e.latitude,this.longitude=e.longitude+180,this.distance=e.distance,ye(this,Bl,H2).call(this),this.scheduleRender())}};Jn=new WeakMap,Zc=new WeakMap,Bl=new WeakSet,H2=function(){S(this,Jn).makeSafe(),this.camera.position.setFromSpherical(S(this,Jn)),this.camera.lookAt(S(this,Zc))},Pr=new WeakMap,Co=new WeakSet,Kc=function(){$(this,Pr,!1);try{ye(this,Bl,H2).call(this),this.scheduleRender(),this.mirrorControls?.updateMirroredCamera({latitude:this.latitude,longitude:this.longitude,distance:this.distance})}finally{$(this,Pr,!0)}}});var Jc,$c,Rn,q2,fD,pD,dD,zl,Vs,Il,Ul,zd,j2=oe(()=>{Jc=globalThis.performance,$c=class{constructor(){this.mode=0;this.dom=document.createElement("div");this.beginTime=(Jc||Date).now();this.prevTime=this.beginTime;this.frames=0;this.fpsPanel=this.addPanel(new zd("FPS","#0ff","#002"));this.msPanel=this.addPanel(new zd("MS","#0f0","#020"));this.memPanel=Jc?.memory?this.addPanel(new zd("MB","#f08","#201")):null;this.REVISION=16;this.dom.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",this.dom.addEventListener("click",e=>{e.preventDefault(),this.showPanel(++this.mode%this.dom.children.length)},!1),this.showPanel(0)}addPanel(e){return this.dom.appendChild(e.dom),e}showPanel(e){for(let t=0;t<this.dom.children.length;t++)this.dom.children[t].style.display=t===e?"block":"none";this.mode=e}begin(){this.beginTime=(Jc||Date).now()}end(){this.frames++;let e=(Jc||Date).now();if(this.msPanel.update(e-this.beginTime,200),e>=this.prevTime+1e3&&(this.fpsPanel.update(this.frames*1e3/(e-this.prevTime),100),this.prevTime=e,this.frames=0,this.memPanel)){let t=Jc.memory;this.memPanel.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e}update(){this.beginTime=this.end()}},Rn=Math.round(globalThis?.window?.devicePixelRatio??1),q2=80*Rn,fD=48*Rn,pD=3*Rn,dD=2*Rn,zl=3*Rn,Vs=15*Rn,Il=74*Rn,Ul=30*Rn,zd=class{constructor(e,t,n){this.name=e;this.fg=t;this.bg=n;this.min=1/0;this.max=0;this.dom=document.createElement("canvas");this.context=this.dom.getContext("2d");this.dom.width=q2,this.dom.height=fD,this.dom.style.cssText="width:80px;height:48px",this.context.font=`bold ${9*Rn}px Helvetica,Arial,sans-serif`,this.context.textBaseline="top",this.context.fillStyle=n,this.context.fillRect(0,0,q2,fD),this.context.fillStyle=t,this.context.fillText(e,pD,dD),this.context.fillRect(zl,Vs,Il,Ul),this.context.fillStyle=n,this.context.globalAlpha=.9,this.context.fillRect(zl,Vs,Il,Ul)}update(e,t){this.min=Math.min(this.min,e),this.max=Math.max(this.max,e),this.context.fillStyle=this.bg,this.context.globalAlpha=1,this.context.fillRect(0,0,q2,Vs),this.context.fillStyle=this.fg,this.context.fillText(Math.round(e)+" "+this.name+" ("+Math.round(this.min)+"-"+Math.round(this.max)+")",pD,dD),this.context.drawImage(this.dom,zl+Rn,Vs,Il-Rn,Ul,zl,Vs,Il-Rn,Ul),this.context.fillRect(zl+Il-Rn,Vs,Rn,Ul),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(zl+Il-Rn,Vs,Rn,Math.round((1-e/t)*Ul))}}});function gD(r){mD=r}function vD(){return new ft({antialias:!0,alpha:!0})}function E6(){return yD??(yD=vD())}var mD,D6,yD,eh,Nl,Hs,Id,kr,Ud=oe(()=>{li();Rr();Ft();kd();O2();hD();un();j2();mD=!1;D6=!1,yD=null;kr=class extends rt{constructor(e,t={}){super();H(this,Hs);this.legacyExperimentalShift=0;this.scheduler=new ln(this.render.bind(this));this.resizePending=!1;this.stats=null;H(this,eh,!1);H(this,Nl,null);this.addCSS(Bd),this.scene=e,this.scene?.addRenderTarget(this),mD&&(this.stats=new $c,this.stats.dom.style.position="absolute",this.addElement(this.stats.dom)),this.rendererIsShared=D6,this.renderer=this.rendererIsShared?E6():vD(),this.canvas=this.rendererIsShared?document.createElement("canvas"):this.renderer.domElement,this.canvas2DContext=this.canvas.getContext("2d"),this.addElement(this.canvas),this.camera=new Gt(20,1,.1,20),this.camera.position.copy(new M(2,4,4)),this.orbitControls=new V2(this.camera,this.canvas,this.scheduleRender.bind(this)),t.orbitCoordinates&&(this.orbitControls.latitude=t.orbitCoordinates.latitude*(t.negateCameraPosition?-1:1)),t.orbitCoordinates&&(this.orbitControls.longitude=t.orbitCoordinates.longitude+(t.negateCameraPosition?180:0)),t.orbitCoordinates&&(this.orbitControls.distance=t.orbitCoordinates.distance),this.camera.lookAt(new M(0,0,0)),new ResizeObserver(this.onResize.bind(this)).observe(this.contentWrapper)}setMirror(e){this.orbitControls.setMirror(e.orbitControls),e.orbitControls.setMirror(this.orbitControls)}experimentalSetLatitudeLimits(e){this.orbitControls.experimentalLatitudeLimits=e}connectedCallback(){ye(this,Hs,Id).call(this),this.render()}scheduleRender(){this.scheduler.requestAnimFrame()}makeInvisibleUntilRender(){this.contentWrapper.classList.add("invisible"),$(this,eh,!0)}experimentalSetOnRenderFinish(e){$(this,Nl,e)}render(){this.stats?.begin(),this.scheduler.cancelAnimFrame(),this.resizePending&&ye(this,Hs,Id).call(this),this.rendererIsShared&&(this.renderer.setSize(this.canvas.width,this.canvas.height,!1),this.canvas2DContext.clearRect(0,0,this.canvas.width,this.canvas.height)),this.scene&&this.renderer.render(this.scene,this.camera),this.rendererIsShared&&this.canvas2DContext.drawImage(this.renderer.domElement,0,0),S(this,eh)&&this.contentWrapper.classList.remove("invisible"),this.stats?.end(),S(this,Nl)&&S(this,Nl).call(this)}onResize(){this.resizePending=!0,this.scheduleRender()}renderToDataURL(e={}){ye(this,Hs,Id).call(this,e.minWidth,e.minHeight),this.render();let t;if(!e.squareCrop||this.canvas.width===this.canvas.height)t=this.canvas.toDataURL();else{let n=document.createElement("canvas"),i=Math.min(this.canvas.width,this.canvas.height);n.width=i,n.height=i,n.getContext("2d").drawImage(this.canvas,-(this.canvas.width-i)/2,-(this.canvas.height-i)/2),t=n.toDataURL()}return ye(this,Hs,Id).call(this),t}};eh=new WeakMap,Nl=new WeakMap,Hs=new WeakSet,Id=function(e=0,t=0){this.resizePending=!1;let n=Math.max(this.contentWrapper.clientWidth,e),i=Math.max(this.contentWrapper.clientHeight,t),o=0;this.legacyExperimentalShift>0?o=Math.max(0,Math.floor((n-i)*.5)):this.legacyExperimentalShift<0&&(o=-Math.max(0,Math.floor((n-i)*.5)));let s=0,a=0;i>n&&(a=i-n,s=-Math.floor(.5*a)),this.camera.aspect=n/i,this.camera.setViewOffset(n,i-a,o,s,n,i),this.camera.updateProjectionMatrix(),this.rendererIsShared?(this.canvas.width=n*Cr(),this.canvas.height=i*Cr(),this.canvas.style.width=n.toString(),this.canvas.style.height=n.toString()):(this.renderer.setPixelRatio(Cr()),this.renderer.setSize(n,i,!0)),this.scheduleRender()};Qe.define("twisty-3d-canvas",kr)});var th,Q2=oe(()=>{li();th=class extends xs{constructor(){super();this.renderTargets=new Set;this.twisty3Ds=new Set}addRenderTarget(e){this.renderTargets.add(e)}scheduleRender(){for(let e of this.renderTargets)e.scheduleRender()}addTwisty3DPuzzle(e){this.twisty3Ds.add(e),this.add(e)}removeTwisty3DPuzzle(e){this.twisty3Ds.delete(e),this.remove(e)}clearPuzzles(){for(let e of this.twisty3Ds)this.remove(e);this.twisty3Ds.clear()}}});var xD={};Rt(xD,{Cube3D:()=>Ui,PG3D:()=>wi,T3I:()=>W1,Twisty3DCanvas:()=>kr,Twisty3DScene:()=>th,cube3DShim:()=>M6,pg3dShim:()=>R6});async function M6(r){let e={addPositionListener:()=>{}},t=()=>{};return new Ui(await no.def(),e,t,r)}async function R6(r,e){let t={addPositionListener:()=>{}},n=()=>{};return new wi(t,n,await r.def(),(await r.pg()).get3d(),!0,e==="floating")}var wD=oe(()=>{qn();Qc();Xc();li();Ud();Qc();Xc();Q2()});Rt(exports,{cubing:()=>bE});Oe();var t2={};Rt(t2,{GanCube:()=>Cs,GiiKERCube:()=>Ps,GoCube:()=>ks,KeyboardPuzzle:()=>Jp,connectSmartPuzzle:()=>TL,connectSmartRobot:()=>BL,connectSmartTimer:()=>IL,debugKeyboardConnect:()=>mL,enableDebugLogging:()=>Cv,giikerMoveToAlgMoveForTesting:()=>X1});var _v=!1;function Cv(r){_v=r}function St(...r){!_v||(console.info?console.info(...r):console.log(...r))}Oe();Ht();qn();li();function pL(r){switch(Math.max(Math.abs(r.x),Math.abs(r.y),Math.abs(r.z))){case r.x:return"x";case-r.x:return"-x";case r.y:return"y";case-r.y:return"-y";case r.z:return"z";case-r.z:return"-z";default:throw new Error("Uh-oh.")}}var Dl=Math.sqrt(.5),dL={"y z":new ot(0,0,0,1),"-z y":new ot(Dl,0,0,Dl),"x z":new ot(0,0,-Dl,Dl),"-x z":new ot(0,0,Dl,Dl)},V1=class{transformMove(e){}transformOrientation(e){let{x:t,y:n,z:i,w:o}=e.quaternion,s=new ot(t,n,i,o),a=new M(0,1,0),l=new M(0,0,1),u=pL(a.applyQuaternion(s)),c=pL(l.applyQuaternion(s)),f=dL[`${u} ${c}`]||dL["y z"];console.log(s),console.log(f);let h=s.premultiply(f);console.log(h),e.quaternion=s,console.log(e.quaternion)}};var Bi=class extends EventTarget{constructor(){super(...arguments);this.transformers=[];this.listeners=[];this.orientationListeners=[]}async getState(){throw new Error("cannot get state")}addMoveListener(e){this.listeners.push(e)}addOrientationListener(e){this.orientationListeners.push(e)}experimentalAddBasicRotationTransformer(){this.transformers.push(new V1)}dispatchMove(e){for(let t of this.transformers)t.transformMove(e);for(let t of this.listeners)t(e)}dispatchOrientation(e){for(let s of this.transformers)s.transformOrientation(e);let{x:t,y:n,z:i,w:o}=e.quaternion;e.quaternion={x:t,y:n,z:i,w:o};for(let s of this.orientationListeners)s(e)}};var Jp=class extends Bi{constructor(e){super();this.target=e;this.puzzle=(async()=>new pn(await Ot["3x3x3"].def()))();this.listener=this.onKeyDown.bind(this),e.addEventListener("keydown",this.listener)}name(){return"Keyboard Input"}disconnect(){this.target.removeEventListener("keydown",this.listener)}async getState(){return(await this.puzzle).state}async onKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=jh(e);t&&((await this.puzzle).applyMove(t),this.dispatchMove({latestMove:t,timeStamp:e.timeStamp,state:(await this.puzzle).state}),e.preventDefault())}};async function mL(r=window){return new Jp(r)}function M_(r,e=!1){let t=e?{acceptAllDevices:!0,optionalServices:[]}:{filters:[],optionalServices:[]};for(let n of r)e||(t.filters=t.filters.concat(n.filters)),t.optionalServices=t.optionalServices.concat(n.optionalServices);return St({requestOptions:t}),t}var H1=0,gL=2;async function El(r,e={}){St("Attempting to pair.");let t;try{let o=e.acceptAllDevices;!o&&H1>=gL&&(console.info(`The last ${gL} Bluetooth puzzle connection attempts failed. This time, the Bluetooth prompt will show all possible devices.`),o=!0),t=await navigator.bluetooth.requestDevice(M_(r,o)),H1=0}catch(o){throw H1++,new Error(o)}if(St("Device:",t),typeof t.gatt=="undefined")return Promise.reject("Device did not have a GATT server.");let n=await t.gatt.connect();St("Server:",n);let i=n.device?.name||"";for(let o of r)for(let s of o.prefixes)if(i?.startsWith(s))return o.connect(n,t);throw Error("Unknown Bluetooth devive.")}li();Oe();Ht();qn();var _s=16,R_=new Uint8Array(_s),T_=new Uint8Array(new Array(_s).fill(_s)),q1="AES-CBC";async function yL(r){return await crypto.subtle.importKey("raw",r,q1,!0,["encrypt","decrypt"])}async function F_(r,e,t){return(await window.crypto.subtle.encrypt({name:q1,iv:t},r,e)).slice(0,_s)}async function j1(r,e){let t=await F_(r,T_,e),n=new Uint8Array(2*_s);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),_s),(await window.crypto.subtle.decrypt({name:q1,iv:R_},r,n)).slice(0,_s)}var __=150,$p=6,C_={0:new E("U"),2:new E("U",-1),3:new E("R"),5:new E("R",-1),6:new E("F"),8:new E("F",-1),9:new E("D"),11:new E("D",-1),12:new E("L"),14:new E("L",-1),15:new E("B"),17:new E("B",-1)},Q1=null;function P_(r){return r[13]<18&&r[14]<18&&r[15]<18&&r[16]<18&&r[17]<18&&r[18]<18}var k_=new Uint8Array([198,202,21,223,79,110,19,182,119,13,230,89,58,175,186,162]),B_=new Uint8Array([67,226,91,214,125,220,120,216,7,96,163,218,130,60,1,241]);async function vL(r,e){if(e===null)return r;let t=new Uint8Array(r);if(t.set(new Uint8Array(await j1(e,t.slice(3))),3),t.set(new Uint8Array(await j1(e,t.slice(0,16))),0),P_(t))return t;throw new Error("Invalid Gan cube state")}var Rc=class{constructor(e,t){this.dataView=e;this.timeStamp=t;this.arrLen=19;if(this.arr=new Uint8Array(e.buffer),this.arr.length!==this.arrLen)throw new Error("Unexpected array length")}static async read(e,t){let n=await vL(new Uint8Array((await e.readValue()).buffer),t),i=Date.now();return new Rc(new DataView(n.buffer),i)}rotQuat(){let e=this.dataView.getInt16(0,!0)/16384,t=this.dataView.getInt16(2,!0)/16384,n=this.dataView.getInt16(4,!0)/16384;[e,t,n]=[-t,n,-e];let i=1-(e*e+t*t+n*n),o=i>0?Math.sqrt(i):0,s=new ot(e,t,n,o);return Q1||(Q1=s.clone().inverse()),s.clone().multiply(Q1.clone())}moveCounter(){return this.arr[12]}numMovesSince(e){return this.moveCounter()-e&255}latestMoves(e){if(e<0||e>$p)throw new Error(`Must ask for 0 to 6 latest moves. (Asked for ${e})`);return Array.from(this.arr.slice(19-e,19)).map(t=>C_[t])}debugInfo(){return{arr:this.arr}}},er={ganCubeService:"0000fff0-0000-1000-8000-00805f9b34fb",physicalStateCharacteristic:"0000fff5-0000-1000-8000-00805f9b34fb",actualAngleAndBatteryCharacteristic:"0000fff7-0000-1000-8000-00805f9b34fb",faceletStatus1Characteristic:"0000fff2-0000-1000-8000-00805f9b34fb",faceletStatus2Characteristic:"0000fff3-0000-1000-8000-00805f9b34fb",infoService:"0000180a-0000-1000-8000-00805f9b34fb",systemIDCharacteristic:"00002a23-0000-1000-8000-00805f9b34fb",versionCharacteristic:"00002a28-0000-1000-8000-00805f9b34fb"},z_={reset:new Uint8Array([0,0,36,0,73,146,36,73,109,146,219,182,73,146,182,36,109,219])};function I_(r){return Array.prototype.map.call(new Uint8Array(r),e=>("00"+e.toString(16)).slice(-2)).join(" ")}var U_="UF UR UB UL DF DR DB DL FR FL BR BL".split(" "),N_="UFR URB UBL ULF DRF DFL DLB DBR".split(" ");function xL(r,e){return r.slice(e)+r.slice(0,e)}var ed={};U_.forEach((r,e)=>{for(let t=0;t<2;t++)ed[xL(r,t)]={piece:e,orientation:t}});N_.forEach((r,e)=>{for(let t=0;t<3;t++)ed[xL(r,t)]={piece:e,orientation:t}});var O_=[[0,21,15],[5,13,47],[7,45,39],[2,37,23],[29,10,16],[31,18,32],[26,34,40],[24,42,8]],G_=[[1,22],[3,14],[6,46],[4,38],[30,17],[27,9],[25,41],[28,33],[19,12],[20,35],[44,11],[43,36]],wL="URFDLB";async function W_(r){let e=await r.getPrimaryService(er.infoService),t=await e.getCharacteristic(er.versionCharacteristic),n=new Uint8Array((await t.readValue()).buffer),i=((n[0]<<8)+n[1]<<8)+n[2];if(i<65544)return null;let o=i<65792?k_:B_,s=await e.getCharacteristic(er.systemIDCharacteristic),a=new Uint8Array((await s.readValue()).buffer).reverse(),l=new Uint8Array(o);for(let u=0;u<a.length;u++)l[u]=(l[u]+a[u])%256;return yL(l)}var Cs=class extends Bi{constructor(e,t,n,i,o,s){super();this.service=t;this.server=n;this.physicalStateCharacteristic=i;this.lastMoveCounter=o;this.aesKey=s;this.INTERVAL_MS=__;this.intervalHandle=null;this.kpuzzle=new pn(e),this.startTrackingMoves()}static async connect(e){let t=await e.getPrimaryService(er.ganCubeService);St("Service:",t);let n=await t.getCharacteristic(er.physicalStateCharacteristic);St("Characteristic:",n);let i=await W_(e),o=(await Rc.read(n,i)).moveCounter();return St("Initial Move Counter:",o),new Cs(await Ot["3x3x3"].def(),t,e,n,o,i)}name(){return this.server.device.name}disconnect(){this.server.disconnect()}startTrackingMoves(){this.intervalHandle=window.setInterval(this.intervalHandler.bind(this),this.INTERVAL_MS)}stopTrackingMoves(){if(!this.intervalHandle)throw new Error("Not tracking moves!");clearInterval(this.intervalHandle),this.intervalHandle=null}async intervalHandler(){let e=await Rc.read(this.physicalStateCharacteristic,this.aesKey),t=e.numMovesSince(this.lastMoveCounter);t>$p&&(St(`Too many moves! Dropping ${t-$p} moves`),t=$p);for(let n of e.latestMoves(t))this.kpuzzle.applyMove(n),this.dispatchMove({latestMove:n,timeStamp:e.timeStamp,debug:e.debugInfo(),state:this.kpuzzle.state});this.dispatchOrientation({timeStamp:e.timeStamp,quaternion:e.rotQuat()}),this.lastMoveCounter=e.moveCounter()}async getBattery(){return new Uint8Array(await this.readActualAngleAndBatteryCharacteristic())[7]}async getState(){let e=await vL(new Uint8Array(await this.readFaceletStatus1Characteristic()),this.aesKey),t=[];for(let i=0;i<18;i+=3){let o=((e[i^1]<<8)+e[i+1^1]<<8)+e[i+2^1];for(let s=0;s<8;s++)t.push(o&7),o>>=3}let n={CORNERS:{permutation:[],orientation:[]},EDGES:{permutation:[],orientation:[]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,0,0]}};for(let i of O_){let o=ed[i.map(s=>wL[t[s]]).join("")];n.CORNERS.permutation.push(o.piece),n.CORNERS.orientation.push(o.orientation)}for(let i of G_){let o=ed[i.map(s=>wL[t[s]]).join("")];n.EDGES.permutation.push(o.piece),n.EDGES.orientation.push(o.orientation)}return n}async faceletStatus1Characteristic(){return this.cachedFaceletStatus1Characteristic=this.cachedFaceletStatus1Characteristic||this.service.getCharacteristic(er.faceletStatus1Characteristic),this.cachedFaceletStatus1Characteristic}async faceletStatus2Characteristic(){return this.cachedFaceletStatus2Characteristic=this.cachedFaceletStatus2Characteristic||this.service.getCharacteristic(er.faceletStatus2Characteristic),this.cachedFaceletStatus2Characteristic}async actualAngleAndBatteryCharacteristic(){return this.cachedActualAngleAndBatteryCharacteristic=this.cachedActualAngleAndBatteryCharacteristic||this.service.getCharacteristic(er.actualAngleAndBatteryCharacteristic),this.cachedActualAngleAndBatteryCharacteristic}async reset(){await(await this.faceletStatus1Characteristic()).writeValue(z_.reset)}async readFaceletStatus1Characteristic(){return(await(await this.faceletStatus1Characteristic()).readValue()).buffer}async readFaceletStatus2Characteristic(){let e=await this.faceletStatus2Characteristic();return I_((await e.readValue()).buffer)}async readActualAngleAndBatteryCharacteristic(){return(await(await this.actualAngleAndBatteryCharacteristic()).readValue()).buffer}},bL={connect:Cs.connect.bind(Cs),prefixes:["GAN"],filters:[{namePrefix:"GAN"}],optionalServices:[er.ganCubeService,er.infoService]};Oe();var td=20,Y1={cubeService:"0000aadb-0000-1000-8000-00805f9b34fb",cubeCharacteristic:"0000aadc-0000-1000-8000-00805f9b34fb"};function X1(r,e){switch(e){case 3:e=-1;break;case 9:St("Encountered 9",r,e),e=-2;break}let t=["?","B","D","L","U","R","F"][r];return new E(t,e)}function V_(r){let e="";return e+=r.slice(0,8).join("."),e+=`
|
|
7064
|
+
`)});function hD(r){return(Math.exp(1-r)-(1-r))/(1-Math.E)+1}var uD,S6,L6,W2,A6,cD,V2,Jn,Zc,Bl,q2,Pr,Co,Kc,H2,fD=oe(()=>{li();Gs();Rr();uD=1e-8,S6=!0,L6="auto",W2=500,A6=50,cD=.75;V2=class{constructor(e,t,n,i){this.startTimestamp=e;this.momentumX=t;this.momentumY=n;this.callback=i;this.scheduler=new ln(this.render.bind(this));this.scheduler.requestAnimFrame(),this.lastTimestamp=e}render(e){let t=(this.lastTimestamp-this.startTimestamp)/W2,n=Math.min(1,(e-this.startTimestamp)/W2);if(t===0&&n>A6/W2)return;let i=hD(n)-hD(t);this.callback(this.momentumX*i*1e3,this.momentumY*i*1e3),n<1&&this.scheduler.requestAnimFrame(),this.lastTimestamp=e}},H2=class{constructor(e,t,n){this.camera=e;this.canvas=t;this.scheduleRender=n;H(this,Bl);H(this,Co);H(this,Jn,new Mc);H(this,Zc,new M(0,0,0));this.experimentalInertia=S6;this.experimentalLatitudeLimits=L6;this.lastTouchClientX=0;this.lastTouchClientY=0;this.currentTouchID=null;this.onMoveBound=this.onMove.bind(this);this.onMouseMoveBound=this.onMouseMove.bind(this);this.onMouseEndBound=this.onMouseEnd.bind(this);this.onTouchMoveBound=this.onTouchMove.bind(this);this.onTouchEndBound=this.onTouchEnd.bind(this);this.lastTouchTimestamp=0;this.lastTouchMoveMomentumX=0;this.lastTouchMoveMomentumY=0;this.lastMouseTimestamp=0;this.lastMouseMoveMomentumX=0;this.lastMouseMoveMomentumY=0;this.experimentalHasBeenMoved=!1;H(this,Pr,!0);S(this,Jn).setFromVector3(e.position),ye(this,Co,Kc).call(this),t.addEventListener("mousedown",this.onMouseStart.bind(this)),t.addEventListener("touchstart",this.onTouchStart.bind(this))}lookAt(e){if(!!S(this,Pr)){$(this,Zc,e),$(this,Pr,!1),ye(this,Bl,q2).call(this),this.scheduleRender();try{this.mirrorControls&&this.mirrorControls.lookAt(e)}finally{$(this,Pr,!0)}}}set latitude(e){S(this,Jn).phi=(90-e)/ui,ye(this,Co,Kc).call(this)}get latitude(){return 90-S(this,Jn).phi*ui}set longitude(e){S(this,Jn).theta=e/ui,ye(this,Co,Kc).call(this)}get longitude(){return S(this,Jn).theta*ui}set distance(e){S(this,Jn).radius=e,ye(this,Co,Kc).call(this)}get distance(){return S(this,Jn).radius}get orbitCoordinates(){return{latitude:this.latitude,longitude:this.longitude,distance:this.distance}}set orbitCoordinates(e){this.latitude=e.latitude,this.longitude=e.longitude,this.distance=e.distance}temperMovement(e){return Math.sign(e)*Math.log(Math.abs(e*10)+1)/6}onMouseStart(e){this.experimentalHasBeenMoved=!0,window.addEventListener("mousemove",this.onMouseMoveBound),window.addEventListener("mouseup",this.onMouseEndBound),this.onStart(e),this.lastMouseTimestamp=e.timeStamp}onMouseMove(e){if(e.buttons===0){this.onMouseEnd(e);return}if(e.movementX===0&&e.movementY===0){console.log("short-circuit mouse!");return}let t=Math.min(this.canvas.offsetWidth,this.canvas.offsetHeight),n=this.temperMovement(e.movementX/t),i=this.temperMovement(e.movementY/t*cD);this.onMove(n,i);let o=e.timeStamp-this.lastMouseTimestamp;o>0&&(this.lastMouseMoveMomentumX=n/o,this.lastMouseMoveMomentumY=i/o,this.lastMouseTimestamp=e.timeStamp)}onMouseEnd(e){window.removeEventListener("mousemove",this.onMouseMoveBound),window.removeEventListener("mouseup",this.onMouseEndBound),this.onEnd(e),this.experimentalInertia&&new V2(this.lastMouseTimestamp,this.lastMouseMoveMomentumX,this.lastMouseMoveMomentumY,this.onMoveBound)}onTouchStart(e){if(this.experimentalHasBeenMoved=!0,this.currentTouchID===null){if(e.touches[0].clientX===0&&e.touches[0].clientY===0){console.log("short-circuit touch!");return}this.currentTouchID=e.changedTouches[0].identifier,this.lastTouchClientX=e.touches[0].clientX,this.lastTouchClientY=e.touches[0].clientY,window.addEventListener("touchmove",this.onTouchMoveBound),window.addEventListener("touchend",this.onTouchEndBound),window.addEventListener("touchcancel",this.onTouchEndBound),this.onStart(e),this.lastTouchTimestamp=e.timeStamp}}onTouchMove(e){for(let t=0;t<e.changedTouches.length;t++){let n=e.changedTouches[t];if(n.identifier===this.currentTouchID){let i=Math.min(this.canvas.offsetWidth,this.canvas.offsetHeight),o=this.temperMovement((n.clientX-this.lastTouchClientX)/i),s=this.temperMovement((n.clientY-this.lastTouchClientY)/i*cD);this.onMove(o,s),this.lastTouchClientX=n.clientX,this.lastTouchClientY=n.clientY;let a=e.timeStamp-this.lastTouchTimestamp;a>0&&(this.lastTouchMoveMomentumX=o/a,this.lastTouchMoveMomentumY=s/a,this.lastTouchTimestamp=e.timeStamp)}}}onTouchEnd(e){for(let t=0;t<e.changedTouches.length;t++)e.changedTouches[t].identifier===this.currentTouchID&&(this.currentTouchID=null,window.removeEventListener("touchmove",this.onTouchMoveBound),window.removeEventListener("touchend",this.onTouchEndBound),window.removeEventListener("touchcancel",this.onTouchEndBound),this.onEnd(e));this.experimentalInertia&&new V2(this.lastTouchTimestamp,this.lastTouchMoveMomentumX,this.lastTouchMoveMomentumY,this.onMoveBound)}onStart(e){e.preventDefault()}onMove(e,t){let n=new Mc;n.copy(S(this,Jn)),n.theta+=-2*e,n.phi+=-2*t,this.experimentalLatitudeLimits!=="none"?(n.phi=Math.max(n.phi,Math.PI*.3),n.phi=Math.min(n.phi,Math.PI*.7)):(n.phi=Math.max(n.phi,uD),n.phi=Math.min(n.phi,Math.PI-uD)),!(isNaN(n.theta)||n.theta===1/0||n.theta===-1/0)&&(isNaN(n.phi)||n.phi===1/0||n.phi===-1/0||($(this,Jn,n),ye(this,Co,Kc).call(this)))}onEnd(e){e.preventDefault()}setMirror(e){this.mirrorControls=e}updateMirroredCamera(e){S(this,Pr)&&(this.latitude=-e.latitude,this.longitude=e.longitude+180,this.distance=e.distance,ye(this,Bl,q2).call(this),this.scheduleRender())}};Jn=new WeakMap,Zc=new WeakMap,Bl=new WeakSet,q2=function(){S(this,Jn).makeSafe(),this.camera.position.setFromSpherical(S(this,Jn)),this.camera.lookAt(S(this,Zc))},Pr=new WeakMap,Co=new WeakSet,Kc=function(){$(this,Pr,!1);try{ye(this,Bl,q2).call(this),this.scheduleRender(),this.mirrorControls?.updateMirroredCamera({latitude:this.latitude,longitude:this.longitude,distance:this.distance})}finally{$(this,Pr,!0)}}});var Jc,$c,Rn,j2,pD,dD,mD,zl,Vs,Il,Ul,zd,Q2=oe(()=>{Jc=globalThis.performance,$c=class{constructor(){this.mode=0;this.dom=document.createElement("div");this.beginTime=(Jc||Date).now();this.prevTime=this.beginTime;this.frames=0;this.fpsPanel=this.addPanel(new zd("FPS","#0ff","#002"));this.msPanel=this.addPanel(new zd("MS","#0f0","#020"));this.memPanel=Jc?.memory?this.addPanel(new zd("MB","#f08","#201")):null;this.REVISION=16;this.dom.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",this.dom.addEventListener("click",e=>{e.preventDefault(),this.showPanel(++this.mode%this.dom.children.length)},!1),this.showPanel(0)}addPanel(e){return this.dom.appendChild(e.dom),e}showPanel(e){for(let t=0;t<this.dom.children.length;t++)this.dom.children[t].style.display=t===e?"block":"none";this.mode=e}begin(){this.beginTime=(Jc||Date).now()}end(){this.frames++;let e=(Jc||Date).now();if(this.msPanel.update(e-this.beginTime,200),e>=this.prevTime+1e3&&(this.fpsPanel.update(this.frames*1e3/(e-this.prevTime),100),this.prevTime=e,this.frames=0,this.memPanel)){let t=Jc.memory;this.memPanel.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e}update(){this.beginTime=this.end()}},Rn=Math.round(globalThis?.window?.devicePixelRatio??1),j2=80*Rn,pD=48*Rn,dD=3*Rn,mD=2*Rn,zl=3*Rn,Vs=15*Rn,Il=74*Rn,Ul=30*Rn,zd=class{constructor(e,t,n){this.name=e;this.fg=t;this.bg=n;this.min=1/0;this.max=0;this.dom=document.createElement("canvas");this.context=this.dom.getContext("2d");this.dom.width=j2,this.dom.height=pD,this.dom.style.cssText="width:80px;height:48px",this.context.font=`bold ${9*Rn}px Helvetica,Arial,sans-serif`,this.context.textBaseline="top",this.context.fillStyle=n,this.context.fillRect(0,0,j2,pD),this.context.fillStyle=t,this.context.fillText(e,dD,mD),this.context.fillRect(zl,Vs,Il,Ul),this.context.fillStyle=n,this.context.globalAlpha=.9,this.context.fillRect(zl,Vs,Il,Ul)}update(e,t){this.min=Math.min(this.min,e),this.max=Math.max(this.max,e),this.context.fillStyle=this.bg,this.context.globalAlpha=1,this.context.fillRect(0,0,j2,Vs),this.context.fillStyle=this.fg,this.context.fillText(Math.round(e)+" "+this.name+" ("+Math.round(this.min)+"-"+Math.round(this.max)+")",dD,mD),this.context.drawImage(this.dom,zl+Rn,Vs,Il-Rn,Ul,zl,Vs,Il-Rn,Ul),this.context.fillRect(zl+Il-Rn,Vs,Rn,Ul),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(zl+Il-Rn,Vs,Rn,Math.round((1-e/t)*Ul))}}});function yD(r){gD=r}function xD(){return new ft({antialias:!0,alpha:!0})}function E6(){return vD??(vD=xD())}var gD,D6,vD,eh,Nl,Hs,Id,kr,Ud=oe(()=>{li();Rr();Tt();kd();G2();fD();un();Q2();gD=!1;D6=!1,vD=null;kr=class extends rt{constructor(e,t={}){super();H(this,Hs);this.legacyExperimentalShift=0;this.scheduler=new ln(this.render.bind(this));this.resizePending=!1;this.stats=null;H(this,eh,!1);H(this,Nl,null);this.addCSS(Bd),this.scene=e,this.scene?.addRenderTarget(this),gD&&(this.stats=new $c,this.stats.dom.style.position="absolute",this.addElement(this.stats.dom)),this.rendererIsShared=D6,this.renderer=this.rendererIsShared?E6():xD(),this.canvas=this.rendererIsShared?document.createElement("canvas"):this.renderer.domElement,this.canvas2DContext=this.canvas.getContext("2d"),this.addElement(this.canvas),this.camera=new Gt(20,1,.1,20),this.camera.position.copy(new M(2,4,4)),this.orbitControls=new H2(this.camera,this.canvas,this.scheduleRender.bind(this)),t.orbitCoordinates&&(this.orbitControls.latitude=t.orbitCoordinates.latitude*(t.negateCameraPosition?-1:1)),t.orbitCoordinates&&(this.orbitControls.longitude=t.orbitCoordinates.longitude+(t.negateCameraPosition?180:0)),t.orbitCoordinates&&(this.orbitControls.distance=t.orbitCoordinates.distance),this.camera.lookAt(new M(0,0,0)),new ResizeObserver(this.onResize.bind(this)).observe(this.contentWrapper)}setMirror(e){this.orbitControls.setMirror(e.orbitControls),e.orbitControls.setMirror(this.orbitControls)}experimentalSetLatitudeLimits(e){this.orbitControls.experimentalLatitudeLimits=e}connectedCallback(){ye(this,Hs,Id).call(this),this.render()}scheduleRender(){this.scheduler.requestAnimFrame()}makeInvisibleUntilRender(){this.contentWrapper.classList.add("invisible"),$(this,eh,!0)}experimentalSetOnRenderFinish(e){$(this,Nl,e)}render(){this.stats?.begin(),this.scheduler.cancelAnimFrame(),this.resizePending&&ye(this,Hs,Id).call(this),this.rendererIsShared&&(this.renderer.setSize(this.canvas.width,this.canvas.height,!1),this.canvas2DContext.clearRect(0,0,this.canvas.width,this.canvas.height)),this.scene&&this.renderer.render(this.scene,this.camera),this.rendererIsShared&&this.canvas2DContext.drawImage(this.renderer.domElement,0,0),S(this,eh)&&this.contentWrapper.classList.remove("invisible"),this.stats?.end(),S(this,Nl)&&S(this,Nl).call(this)}onResize(){this.resizePending=!0,this.scheduleRender()}renderToDataURL(e={}){ye(this,Hs,Id).call(this,e.minWidth,e.minHeight),this.render();let t;if(!e.squareCrop||this.canvas.width===this.canvas.height)t=this.canvas.toDataURL();else{let n=document.createElement("canvas"),i=Math.min(this.canvas.width,this.canvas.height);n.width=i,n.height=i,n.getContext("2d").drawImage(this.canvas,-(this.canvas.width-i)/2,-(this.canvas.height-i)/2),t=n.toDataURL()}return ye(this,Hs,Id).call(this),t}};eh=new WeakMap,Nl=new WeakMap,Hs=new WeakSet,Id=function(e=0,t=0){this.resizePending=!1;let n=Math.max(this.contentWrapper.clientWidth,e),i=Math.max(this.contentWrapper.clientHeight,t),o=0;this.legacyExperimentalShift>0?o=Math.max(0,Math.floor((n-i)*.5)):this.legacyExperimentalShift<0&&(o=-Math.max(0,Math.floor((n-i)*.5)));let s=0,a=0;i>n&&(a=i-n,s=-Math.floor(.5*a)),this.camera.aspect=n/i,this.camera.setViewOffset(n,i-a,o,s,n,i),this.camera.updateProjectionMatrix(),this.rendererIsShared?(this.canvas.width=n*Cr(),this.canvas.height=i*Cr(),this.canvas.style.width=n.toString(),this.canvas.style.height=n.toString()):(this.renderer.setPixelRatio(Cr()),this.renderer.setSize(n,i,!0)),this.scheduleRender()};Qe.define("twisty-3d-canvas",kr)});var th,Y2=oe(()=>{li();th=class extends xs{constructor(){super();this.renderTargets=new Set;this.twisty3Ds=new Set}addRenderTarget(e){this.renderTargets.add(e)}scheduleRender(){for(let e of this.renderTargets)e.scheduleRender()}addTwisty3DPuzzle(e){this.twisty3Ds.add(e),this.add(e)}removeTwisty3DPuzzle(e){this.twisty3Ds.delete(e),this.remove(e)}clearPuzzles(){for(let e of this.twisty3Ds)this.remove(e);this.twisty3Ds.clear()}}});var wD={};_t(wD,{Cube3D:()=>Ui,PG3D:()=>wi,T3I:()=>V1,Twisty3DCanvas:()=>kr,Twisty3DScene:()=>th,cube3DShim:()=>M6,pg3dShim:()=>R6});async function M6(r){let e={addPositionListener:()=>{}},t=()=>{};return new Ui(await no.def(),e,t,r)}async function R6(r,e){let t={addPositionListener:()=>{}},n=()=>{};return new wi(t,n,await r.def(),(await r.pg()).get3d(),!0,e==="floating")}var bD=oe(()=>{qn();Qc();Xc();li();Ud();Qc();Xc();Y2()});Oe();var n2={};_t(n2,{GanCube:()=>Cs,GiiKERCube:()=>Ps,GoCube:()=>ks,KeyboardPuzzle:()=>Jp,connectSmartPuzzle:()=>FL,connectSmartRobot:()=>zL,connectSmartTimer:()=>UL,debugKeyboardConnect:()=>gL,enableDebugLogging:()=>Pv,giikerMoveToAlgMoveForTesting:()=>K1});var Cv=!1;function Pv(r){Cv=r}function St(...r){!Cv||(console.info?console.info(...r):console.log(...r))}Oe();Ht();qn();li();function dL(r){switch(Math.max(Math.abs(r.x),Math.abs(r.y),Math.abs(r.z))){case r.x:return"x";case-r.x:return"-x";case r.y:return"y";case-r.y:return"-y";case r.z:return"z";case-r.z:return"-z";default:throw new Error("Uh-oh.")}}var Dl=Math.sqrt(.5),mL={"y z":new ot(0,0,0,1),"-z y":new ot(Dl,0,0,Dl),"x z":new ot(0,0,-Dl,Dl),"-x z":new ot(0,0,Dl,Dl)},H1=class{transformMove(e){}transformOrientation(e){let{x:t,y:n,z:i,w:o}=e.quaternion,s=new ot(t,n,i,o),a=new M(0,1,0),l=new M(0,0,1),u=dL(a.applyQuaternion(s)),c=dL(l.applyQuaternion(s)),f=mL[`${u} ${c}`]||mL["y z"];console.log(s),console.log(f);let h=s.premultiply(f);console.log(h),e.quaternion=s,console.log(e.quaternion)}};var Bi=class extends EventTarget{constructor(){super(...arguments);this.transformers=[];this.listeners=[];this.orientationListeners=[]}async getState(){throw new Error("cannot get state")}addMoveListener(e){this.listeners.push(e)}addOrientationListener(e){this.orientationListeners.push(e)}experimentalAddBasicRotationTransformer(){this.transformers.push(new H1)}dispatchMove(e){for(let t of this.transformers)t.transformMove(e);for(let t of this.listeners)t(e)}dispatchOrientation(e){for(let s of this.transformers)s.transformOrientation(e);let{x:t,y:n,z:i,w:o}=e.quaternion;e.quaternion={x:t,y:n,z:i,w:o};for(let s of this.orientationListeners)s(e)}};var Jp=class extends Bi{constructor(e){super();this.target=e;this.puzzle=(async()=>new pn(await Ot["3x3x3"].def()))();this.listener=this.onKeyDown.bind(this),e.addEventListener("keydown",this.listener)}name(){return"Keyboard Input"}disconnect(){this.target.removeEventListener("keydown",this.listener)}async getState(){return(await this.puzzle).state}async onKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=jh(e);t&&((await this.puzzle).applyMove(t),this.dispatchMove({latestMove:t,timeStamp:e.timeStamp,state:(await this.puzzle).state}),e.preventDefault())}};async function gL(r=window){return new Jp(r)}function M_(r,e=!1){let t=e?{acceptAllDevices:!0,optionalServices:[]}:{filters:[],optionalServices:[]};for(let n of r)e||(t.filters=t.filters.concat(n.filters)),t.optionalServices=t.optionalServices.concat(n.optionalServices);return St({requestOptions:t}),t}var q1=0,yL=2;async function El(r,e={}){St("Attempting to pair.");let t;try{let o=e.acceptAllDevices;!o&&q1>=yL&&(console.info(`The last ${yL} Bluetooth puzzle connection attempts failed. This time, the Bluetooth prompt will show all possible devices.`),o=!0),t=await navigator.bluetooth.requestDevice(M_(r,o)),q1=0}catch(o){throw q1++,new Error(o)}if(St("Device:",t),typeof t.gatt=="undefined")return Promise.reject("Device did not have a GATT server.");let n=await t.gatt.connect();St("Server:",n);let i=n.device?.name||"";for(let o of r)for(let s of o.prefixes)if(i?.startsWith(s))return o.connect(n,t);throw Error("Unknown Bluetooth devive.")}li();Oe();Ht();qn();var _s=16,R_=new Uint8Array(_s),T_=new Uint8Array(new Array(_s).fill(_s)),j1="AES-CBC";async function vL(r){return await crypto.subtle.importKey("raw",r,j1,!0,["encrypt","decrypt"])}async function F_(r,e,t){return(await window.crypto.subtle.encrypt({name:j1,iv:t},r,e)).slice(0,_s)}async function Q1(r,e){let t=await F_(r,T_,e),n=new Uint8Array(2*_s);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),_s),(await window.crypto.subtle.decrypt({name:j1,iv:R_},r,n)).slice(0,_s)}var __=150,$p=6,C_={0:new E("U"),2:new E("U",-1),3:new E("R"),5:new E("R",-1),6:new E("F"),8:new E("F",-1),9:new E("D"),11:new E("D",-1),12:new E("L"),14:new E("L",-1),15:new E("B"),17:new E("B",-1)},Y1=null;function P_(r){return r[13]<18&&r[14]<18&&r[15]<18&&r[16]<18&&r[17]<18&&r[18]<18}var k_=new Uint8Array([198,202,21,223,79,110,19,182,119,13,230,89,58,175,186,162]),B_=new Uint8Array([67,226,91,214,125,220,120,216,7,96,163,218,130,60,1,241]);async function xL(r,e){if(e===null)return r;let t=new Uint8Array(r);if(t.set(new Uint8Array(await Q1(e,t.slice(3))),3),t.set(new Uint8Array(await Q1(e,t.slice(0,16))),0),P_(t))return t;throw new Error("Invalid Gan cube state")}var Rc=class{constructor(e,t){this.dataView=e;this.timeStamp=t;this.arrLen=19;if(this.arr=new Uint8Array(e.buffer),this.arr.length!==this.arrLen)throw new Error("Unexpected array length")}static async read(e,t){let n=await xL(new Uint8Array((await e.readValue()).buffer),t),i=Date.now();return new Rc(new DataView(n.buffer),i)}rotQuat(){let e=this.dataView.getInt16(0,!0)/16384,t=this.dataView.getInt16(2,!0)/16384,n=this.dataView.getInt16(4,!0)/16384;[e,t,n]=[-t,n,-e];let i=1-(e*e+t*t+n*n),o=i>0?Math.sqrt(i):0,s=new ot(e,t,n,o);return Y1||(Y1=s.clone().inverse()),s.clone().multiply(Y1.clone())}moveCounter(){return this.arr[12]}numMovesSince(e){return this.moveCounter()-e&255}latestMoves(e){if(e<0||e>$p)throw new Error(`Must ask for 0 to 6 latest moves. (Asked for ${e})`);return Array.from(this.arr.slice(19-e,19)).map(t=>C_[t])}debugInfo(){return{arr:this.arr}}},er={ganCubeService:"0000fff0-0000-1000-8000-00805f9b34fb",physicalStateCharacteristic:"0000fff5-0000-1000-8000-00805f9b34fb",actualAngleAndBatteryCharacteristic:"0000fff7-0000-1000-8000-00805f9b34fb",faceletStatus1Characteristic:"0000fff2-0000-1000-8000-00805f9b34fb",faceletStatus2Characteristic:"0000fff3-0000-1000-8000-00805f9b34fb",infoService:"0000180a-0000-1000-8000-00805f9b34fb",systemIDCharacteristic:"00002a23-0000-1000-8000-00805f9b34fb",versionCharacteristic:"00002a28-0000-1000-8000-00805f9b34fb"},z_={reset:new Uint8Array([0,0,36,0,73,146,36,73,109,146,219,182,73,146,182,36,109,219])};function I_(r){return Array.prototype.map.call(new Uint8Array(r),e=>("00"+e.toString(16)).slice(-2)).join(" ")}var U_="UF UR UB UL DF DR DB DL FR FL BR BL".split(" "),N_="UFR URB UBL ULF DRF DFL DLB DBR".split(" ");function wL(r,e){return r.slice(e)+r.slice(0,e)}var ed={};U_.forEach((r,e)=>{for(let t=0;t<2;t++)ed[wL(r,t)]={piece:e,orientation:t}});N_.forEach((r,e)=>{for(let t=0;t<3;t++)ed[wL(r,t)]={piece:e,orientation:t}});var O_=[[0,21,15],[5,13,47],[7,45,39],[2,37,23],[29,10,16],[31,18,32],[26,34,40],[24,42,8]],G_=[[1,22],[3,14],[6,46],[4,38],[30,17],[27,9],[25,41],[28,33],[19,12],[20,35],[44,11],[43,36]],bL="URFDLB";async function W_(r){let e=await r.getPrimaryService(er.infoService),t=await e.getCharacteristic(er.versionCharacteristic),n=new Uint8Array((await t.readValue()).buffer),i=((n[0]<<8)+n[1]<<8)+n[2];if(i<65544)return null;let o=i<65792?k_:B_,s=await e.getCharacteristic(er.systemIDCharacteristic),a=new Uint8Array((await s.readValue()).buffer).reverse(),l=new Uint8Array(o);for(let u=0;u<a.length;u++)l[u]=(l[u]+a[u])%256;return vL(l)}var Cs=class extends Bi{constructor(e,t,n,i,o,s){super();this.service=t;this.server=n;this.physicalStateCharacteristic=i;this.lastMoveCounter=o;this.aesKey=s;this.INTERVAL_MS=__;this.intervalHandle=null;this.kpuzzle=new pn(e),this.startTrackingMoves()}static async connect(e){let t=await e.getPrimaryService(er.ganCubeService);St("Service:",t);let n=await t.getCharacteristic(er.physicalStateCharacteristic);St("Characteristic:",n);let i=await W_(e),o=(await Rc.read(n,i)).moveCounter();return St("Initial Move Counter:",o),new Cs(await Ot["3x3x3"].def(),t,e,n,o,i)}name(){return this.server.device.name}disconnect(){this.server.disconnect()}startTrackingMoves(){this.intervalHandle=window.setInterval(this.intervalHandler.bind(this),this.INTERVAL_MS)}stopTrackingMoves(){if(!this.intervalHandle)throw new Error("Not tracking moves!");clearInterval(this.intervalHandle),this.intervalHandle=null}async intervalHandler(){let e=await Rc.read(this.physicalStateCharacteristic,this.aesKey),t=e.numMovesSince(this.lastMoveCounter);t>$p&&(St(`Too many moves! Dropping ${t-$p} moves`),t=$p);for(let n of e.latestMoves(t))this.kpuzzle.applyMove(n),this.dispatchMove({latestMove:n,timeStamp:e.timeStamp,debug:e.debugInfo(),state:this.kpuzzle.state});this.dispatchOrientation({timeStamp:e.timeStamp,quaternion:e.rotQuat()}),this.lastMoveCounter=e.moveCounter()}async getBattery(){return new Uint8Array(await this.readActualAngleAndBatteryCharacteristic())[7]}async getState(){let e=await xL(new Uint8Array(await this.readFaceletStatus1Characteristic()),this.aesKey),t=[];for(let i=0;i<18;i+=3){let o=((e[i^1]<<8)+e[i+1^1]<<8)+e[i+2^1];for(let s=0;s<8;s++)t.push(o&7),o>>=3}let n={CORNERS:{permutation:[],orientation:[]},EDGES:{permutation:[],orientation:[]},CENTERS:{permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,0,0]}};for(let i of O_){let o=ed[i.map(s=>bL[t[s]]).join("")];n.CORNERS.permutation.push(o.piece),n.CORNERS.orientation.push(o.orientation)}for(let i of G_){let o=ed[i.map(s=>bL[t[s]]).join("")];n.EDGES.permutation.push(o.piece),n.EDGES.orientation.push(o.orientation)}return n}async faceletStatus1Characteristic(){return this.cachedFaceletStatus1Characteristic=this.cachedFaceletStatus1Characteristic||this.service.getCharacteristic(er.faceletStatus1Characteristic),this.cachedFaceletStatus1Characteristic}async faceletStatus2Characteristic(){return this.cachedFaceletStatus2Characteristic=this.cachedFaceletStatus2Characteristic||this.service.getCharacteristic(er.faceletStatus2Characteristic),this.cachedFaceletStatus2Characteristic}async actualAngleAndBatteryCharacteristic(){return this.cachedActualAngleAndBatteryCharacteristic=this.cachedActualAngleAndBatteryCharacteristic||this.service.getCharacteristic(er.actualAngleAndBatteryCharacteristic),this.cachedActualAngleAndBatteryCharacteristic}async reset(){await(await this.faceletStatus1Characteristic()).writeValue(z_.reset)}async readFaceletStatus1Characteristic(){return(await(await this.faceletStatus1Characteristic()).readValue()).buffer}async readFaceletStatus2Characteristic(){let e=await this.faceletStatus2Characteristic();return I_((await e.readValue()).buffer)}async readActualAngleAndBatteryCharacteristic(){return(await(await this.actualAngleAndBatteryCharacteristic()).readValue()).buffer}},SL={connect:Cs.connect.bind(Cs),prefixes:["GAN"],filters:[{namePrefix:"GAN"}],optionalServices:[er.ganCubeService,er.infoService]};Oe();var td=20,X1={cubeService:"0000aadb-0000-1000-8000-00805f9b34fb",cubeCharacteristic:"0000aadc-0000-1000-8000-00805f9b34fb"};function K1(r,e){switch(e){case 3:e=-1;break;case 9:St("Encountered 9",r,e),e=-2;break}let t=["?","B","D","L","U","R","F"][r];return new E(t,e)}function V_(r){let e="";return e+=r.slice(0,8).join("."),e+=`
|
|
7065
7065
|
`,e+=r.slice(8,16).join("."),e+=`
|
|
7066
7066
|
`,e+=r.slice(16,28).join("."),e+=`
|
|
7067
7067
|
`,e+=r.slice(28,32).join("."),e+=`
|
|
7068
|
-
`,e+=r.slice(32,40).join("."),e}var H_={permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,0,0]},q_=[4,8,0,9,5,1,3,7,6,10,2,11],j_=[2,5,10,6,0,4,8,7,1,3,9,11],Q_=[1,0,1,0,1,0,1,0,0,0,0,0],Y_=[1,0,1,0,1,0,1,0,0,0,0,0],X_=[4,0,3,5,7,1,2,6],K_=[1,5,6,2,0,3,7,4],Z_=[1,2,1,2,2,1,2,1],J_=[2,1,2,1,1,2,1,2],$_=[-1,1,-1,1,1,-1,1,-1];function Tc(r,e){return e%2==1?r[e/2|0]%16:0|r[e/2|0]/16}function eC(r){return r[18]===167}var SL=[176,81,104,224,86,137,237,119,38,26,193,161,210,126,150,81,93,13,236,249,89,235,88,24,113,81,214,131,130,199,2,169,39,165,171,41];function tC(r){let e=Tc(r,38),t=Tc(r,39),n=new Uint8Array(td);for(let i=0;i<td;i++)n[i]=r[i]+SL[e+i]+SL[t+i];return n}async function LL(r){return eC(r)?tC(r):r}var Ps=class extends Bi{constructor(e,t,n){super();this.server=e;this.cubeCharacteristic=t;this.originalValue=n}static async connect(e){let t=await e.getPrimaryService(Y1.cubeService);St("Service:",t);let n=await t.getCharacteristic(Y1.cubeCharacteristic);St("Characteristic:",n);let i=await LL(new Uint8Array((await n.readValue()).buffer));St("Original value:",i);let o=new Ps(e,n,i);return await n.startNotifications(),n.addEventListener("characteristicvaluechanged",o.onCubeCharacteristicChanged.bind(o)),o}name(){return this.server.device.name}disconnect(){this.server.disconnect()}async getState(){return this.toReid333(new Uint8Array((await this.cubeCharacteristic.readValue()).buffer))}getBit(e,t){let n=t/8|0,i=7-t%8;return e[n]>>i&1}toReid333(e){let t={EDGES:{permutation:new Array(12),orientation:new Array(12)},CORNERS:{permutation:new Array(8),orientation:new Array(8)},CENTERS:H_};for(let n=0;n<12;n++){let i=j_[n];t.EDGES.permutation[n]=q_[Tc(e,i+16)-1],t.EDGES.orientation[n]=this.getBit(e,i+112)^Q_[t.EDGES.permutation[n]]^Y_[n]}for(let n=0;n<8;n++){let i=K_[n];t.CORNERS.permutation[n]=X_[Tc(e,i)-1],t.CORNERS.orientation[n]=(Tc(e,i+8)*$_[i]+Z_[t.CORNERS.permutation[n]]+J_[n])%3}return t}async onCubeCharacteristicChanged(e){let t=await LL(new Uint8Array(e.target.value.buffer));if(St(t),St(t),this.isRepeatedInitialValue(t)){St("Skipping repeated initial value.");return}let n=[];for(let o=0;o<td;o++)n.push(Math.floor(t[o]/16)),n.push(t[o]%16);St(n);let i=V_(n);St(i),this.dispatchMove({latestMove:X1(n[32],n[33]),timeStamp:e.timeStamp,debug:{stateStr:i},state:this.toReid333(t)})}isRepeatedInitialValue(e){if(typeof this.originalValue=="undefined")throw new Error("GiiKERCube has uninitialized original value.");if(this.originalValue===null)return!1;let t=this.originalValue;this.originalValue=null,St("Comparing against original value.");for(let n=0;n<td-2;n++)if(t[n]!==e[n])return St("Different at index ",n),!1;return!0}},AL={connect:Ps.connect.bind(Ps),prefixes:["Gi",""],filters:[{namePrefix:"Gi"},{services:["0000aadb-0000-1000-8000-00805f9b34fb"]},{services:["0000aaaa-0000-1000-8000-00805f9b34fb"]},{services:["0000fe95-0000-1000-8000-00805f9b34fb"]}],optionalServices:[Y1.cubeService]};li();Oe();var K1={goCubeService:"6e400001-b5a3-f393-e0a9-e50e24dcca9e",goCubeStateCharacteristic:"6e400003-b5a3-f393-e0a9-e50e24dcca9e"};function DL(r){return Array.prototype.map.call(new Uint8Array(r),e=>("00"+e.toString(16)).slice(-2)).join(" ")}function nC(r){let e=new Uint8Array(r),t="";for(let n of e)t+=String.fromCharCode(n);return t}var EL=[new E("B",1),new E("B",-1),new E("F",1),new E("F",-1),new E("U",1),new E("U",-1),new E("D",1),new E("D",-1),new E("R",1),new E("R",-1),new E("L",1),new E("L",-1)],ks=class extends Bi{constructor(e,t){super();this.server=e;this.goCubeStateCharacteristic=t;this.recorded=[];this.homeQuatInverse=null;this.lastRawQuat=new ot(0,0,0,1);this.currentQuat=new ot(0,0,0,1);this.lastTarget=new ot(0,0,0,1);this.alg=new re}static async connect(e){let t=await e.getPrimaryService(K1.goCubeService);St({service:t});let n=await t.getCharacteristic(K1.goCubeStateCharacteristic);St({goCubeStateCharacteristic:n});let i=new ks(e,n);return await n.startNotifications(),n.addEventListener("characteristicvaluechanged",i.onCubeCharacteristicChanged.bind(i)),i}disconnect(){this.server.disconnect()}reset(){this.resetAlg(),this.resetOrientation()}resetAlg(e){this.alg=e||new re}resetOrientation(){this.homeQuatInverse=this.lastRawQuat.clone().inverse(),this.currentQuat=new ot(0,0,0,1),this.lastTarget=new ot(0,0,0,1)}name(){return this.server.device.name}onCubeCharacteristicChanged(e){let t=e.target.value;if(this.recorded.push([e.timeStamp,DL(t.buffer)]),t.byteLength<16)for(let n=3;n<t.byteLength-4;n+=2){let i=EL[t.getUint8(n)];this.alg=fr(this.alg,i),this.dispatchMove({latestMove:EL[t.getUint8(n)],timeStamp:e.timeStamp,debug:{stateStr:DL(t.buffer)}})}else{let n=nC(t.buffer.slice(3,t.byteLength-3)).split("#").map(s=>parseInt(s,10)/16384),i=new ot(n[0],n[1],n[2],n[3]);this.lastRawQuat=i.clone(),this.homeQuatInverse||(this.homeQuatInverse=i.clone().inverse());let o=i.clone().multiply(this.homeQuatInverse.clone());o.y=-o.y,this.lastTarget.slerp(o,.5),this.currentQuat.rotateTowards(this.lastTarget,iC),this.dispatchOrientation({quaternion:this.currentQuat,timeStamp:e.timeStamp})}}},iC=.5,ML={connect:ks.connect.bind(ks),prefixes:["GoCube","Rubik"],filters:[{namePrefix:"GoCube"},{namePrefix:"Rubik"}],optionalServices:[K1.goCubeService]};Oe();$h();qn();function Ml(r,e){let t=0;for(let n=0;n<e;n++){let i=e-1-2*n,o=r&1<<n;t+=i<0?o>>-i:o<<i}return t}var Z1={heykubeService:"b46a791a-8273-4fc1-9e67-94d3dc2aac1c",stateCharacteristic:"a2f41a4e-0e31-4bbc-9389-4253475481fb",batteryCharacteristic:"fd51b3ba-99c7-49c6-9f85-5644ff56a378"},Fc=class extends Bi{constructor(e,t,n,i,o){super();this.server=i;this.stateCharacteristic=o;n.addEventListener("gattserverdisconnected",this.onDisconnect.bind(this)),this.stateCharacteristic.startNotifications(),this.startTrackingMoves()}static async connect(e,t){let n=await e.getPrimaryService(Z1.heykubeService);St("Service:",n);let i=await n.getCharacteristic(Z1.stateCharacteristic);return St("Characteristic:",i),new Fc(await Ot["3x3x3"].def(),n,t,e,i)}name(){return this.server.device.name}disconnect(){this.server.disconnect()}onDisconnect(){this.dispatchEvent(new CustomEvent("disconnect"))}startTrackingMoves(){this.stateCharacteristic.addEventListener("characteristicvaluechanged",e=>this.onStateCharacteristic(e))}onStateCharacteristic(e){let t=this.decodeState(e.target.value);this.dispatchMove({latestMove:t.latestMove,timeStamp:e.timeStamp,state:t.state})}decodeState(e){let t=[new E("U"),new E("U'"),new E("B"),new E("B'"),new E("F"),new E("F'"),null,null,new E("L"),new E("L'"),new E("D"),new E("D'"),new E("R"),new E("R'")],n=new Uint8Array(e.byteLength);for(let s=0;s<e.byteLength;s++)n[s]=Ml(e.getUint8(s),8);let i=mu(n.slice(0,11)),o={epLex:Ml(i.epLex,29),eoMask:Ml(i.eoMask,12),cpLex:Ml(i.cpLex,16),coMask:Ml(i.coMask,13),poIdxL:0,poIdxU:7,moSupport:1,moMask:0};return{state:gu(o),latestMove:t[n[20]&15]}}async getState(){let e=await this.stateCharacteristic.readValue();return this.decodeState(e).state}},RL={connect:Fc.connect.bind(Fc),prefixes:["HEYKUBE"],filters:[{namePrefix:"HEYKUBE"}],optionalServices:[Z1.heykubeService]};var rC=[bL,ML,RL,AL];async function TL(r){return El(rC,r)}Oe();function oC(r){return Array.prototype.map.call(new Uint8Array(r),e=>("00"+e.toString(16)).slice(-2)).join(" ")}var J1=18*2,sC=150,aC=250,FL=new re("F B R2 L2 B' F'"),lC=FL.invert(),_L=new re("U D R2 L2 D' U'"),uC=_L.invert(),nd={ganRobotService:"0000fff0-0000-1000-8000-00805f9b34fb",statusCharacteristic:"0000fff2-0000-1000-8000-00805f9b34fb",moveCharacteristic:"0000fff3-0000-1000-8000-00805f9b34fb"},CL={R:0,R2:1,"R2'":1,"R'":2,F:3,F2:4,"F2'":4,"F'":5,D:6,D2:7,"D2'":7,"D'":8,L:9,L2:10,"L2'":10,"L'":11,B:12,B2:13,"B2'":13,"B'":14},PL={R:0,R2:1,"R2'":1,"R'":2,U:3,U2:4,"U2'":4,"U'":5,F:6,F2:7,"F2'":7,"F'":8,L:9,L2:10,"L2'":10,"L'":11,D:12,D2:13,"D2'":13,"D'":14};function cC(r){return r%3==1}function hC(r){return cC(r)?aC:sC}function fC(r){throw console.error("invalid move",r,r.toString()),new Error("invalid move!")}function $1(r){return new Promise(e=>setTimeout(e,r))}var _c=class extends EventTarget{constructor(e,t,n,i,o){super();this.server=t;this.statusCharacteristic=i;this.moveCharacteristic=o;this.experimentalDebugOnSend=null;this.experimentalDebugLog=()=>{};this.experimentalOptions={xAngle:!1,singleMoveFixHack:!1,bufferQueue:0,postSleep:0};this.locked=!1;this.moveQueue=new re;n.addEventListener("gattserverdisconnected",this.onDisconnect.bind(this))}static async connect(e,t){let n=await e.getPrimaryService(nd.ganRobotService),i=await n.getCharacteristic(nd.statusCharacteristic),o=await n.getCharacteristic(nd.moveCharacteristic);return new _c(n,e,t,i,o)}name(){return this.server.device.name}disconnect(){this.server.disconnect()}onDisconnect(){this.dispatchEvent(new CustomEvent("disconnect"))}moveToNibble(e){let t=(this.experimentalOptions.xAngle?PL:CL)[e.toString()]??null;return t===null&&fC(e),t}async writeNibbles(e){if(e.length>J1)throw new Error(`Can only write ${J1} nibbles at a time!`);let t=new Uint8Array(18),n;for(n=0;n<e.length;n++){let o=Math.floor(n/2);t[o]+=e[n],n%2==0&&(t[o]*=16)}e.length%2==1&&(t[Math.ceil(e.length/2)-1]+=15);for(let o=Math.ceil(e.length/2);o<18;o++)t[o]=255;let i=0;for(let o of e)i+=hC(o);for(this.experimentalDebugLog("WRITING:",oC(t)),await this.moveCharacteristic.writeValue(t),await $1(i*.75);(await this.getStatus()).movesRemaining>0;);await $1(this.experimentalOptions.postSleep)}async getStatus(){let e=new Uint8Array((await this.statusCharacteristic.readValue()).buffer);return this.experimentalDebugLog("moves remaining:",e[0]),{movesRemaining:e[0]}}processQueue(){}async queueMoves(e){if(this.moveQueue=this.moveQueue.concat(e).simplify({collapseMoves:!0,quantumMoveOrder:t=>4}),!this.locked)try{for(this.locked=!0,this.moveQueue.experimentalNumUnits()===1&&await $1(this.experimentalOptions.bufferQueue);this.moveQueue.experimentalNumUnits()>0;){let t=Array.from(this.moveQueue.units());if(this.experimentalOptions.singleMoveFixHack&&t.length===1){let a=t[0];a.amount===2?t=[a.modified({amount:1}),a.modified({amount:1})]:t=[a.modified({amount:-a.amount}),a.modified({amount:2})]}let n=t.splice(0,J1),i=n.map(this.moveToNibble.bind(this)),o=new re(n);this.experimentalDebugLog("SENDING",o.toString()),this.experimentalDebugOnSend&&this.experimentalDebugOnSend(o);let s=this.writeNibbles(i);this.moveQueue=new re(t),await s}}finally{this.locked=!1}}async applyMoves(e){for(let t of e)t.toString()in(this.experimentalOptions.xAngle?PL:CL)?await this.queueMoves(new re([t])):t.family===(this.experimentalOptions.xAngle?"B":"U")&&await Promise.all([this.queueMoves(this.experimentalOptions.xAngle?_L:FL),this.queueMoves(new re([t.modified({family:this.experimentalOptions.xAngle?"F":"D"})]).concat(this.experimentalOptions.xAngle?uC:lC))])}},kL={connect:_c.connect.bind(_c),prefixes:["GAN"],filters:[{namePrefix:"GAN"}],optionalServices:[nd.ganRobotService]};var pC=[kL];async function BL(r){return El(pC,r)}var e2={ganTimerService:"0000fff0-0000-1000-8000-00805f9b34fb",timeCharacteristic:"0000fff2-0000-1000-8000-00805f9b34fb"},Cc=class extends EventTarget{constructor(e,t,n,i){super();this.server=t;this.timeCharacteristic=i;this.polling=!1;this.previousDetail=null;this.startPolling(),console.log(t),n.addEventListener("gattserverdisconnected",this.onDisconnect.bind(this))}static async connect(e,t){let n=await e.getPrimaryService(e2.ganTimerService);console.log("Service:",n);let i=await n.getCharacteristic(e2.timeCharacteristic);return console.log("Characteristic:",i),new Cc(n,e,t,i)}disconnect(){this.server.disconnect()}async poll(){if(!this.polling)return;let e=await this.getTimeCharacteristic(),t={currentTime:this.decodeTimeMs(e.slice(0,4)),latestTimes:[this.decodeTimeMs(e.slice(4,8)),this.decodeTimeMs(e.slice(8,12)),this.decodeTimeMs(e.slice(12,16))]};t.currentTime===0&&this.previousDetail&&this.previousDetail.currentTime!==0&&this.dispatchEvent(new CustomEvent("reset")),t.currentTime!==0&&this.previousDetail&&(this.previousDetail.currentTime===0&&this.dispatchEvent(new CustomEvent("start")),t.currentTime!==this.previousDetail.currentTime&&(this.dispatchEvent(new CustomEvent("update",{detail:t})),t.currentTime===t.latestTimes[0]&&t.latestTimes[1]===this.previousDetail.latestTimes[0]&&t.latestTimes[2]===this.previousDetail.latestTimes[1]&&this.dispatchEvent(new CustomEvent("stop",{detail:t})))),this.previousDetail=t,this.poll()}onDisconnect(){this.dispatchEvent(new CustomEvent("disconnect"))}async getTimeCharacteristic(){return new Uint8Array((await this.timeCharacteristic.readValue()).buffer)}async getTime(){let e=await this.getTimeCharacteristic();return this.decodeTimeMs(e.slice(0,4))}decodeTimeMs(e){return(e[0]*60+e[1])*1e3+e[2]+e[3]*256}startPolling(){this.polling=!0,this.poll()}stopPolling(){this.polling=!1}},zL={connect:Cc.connect.bind(Cc),prefixes:["GAN"],filters:[{namePrefix:"GAN"}],optionalServices:[e2.ganTimerService]};var dC=[zL];async function IL(r){return El(dC,r)}Ht();var n2={};Rt(n2,{countAnimatedLeaves:()=>id,countMoves:()=>Bs});Oe();var UL=class extends Cn{constructor(e){super();this.metric=e}traverseAlg(e){let t=0;for(let n of e.units())t+=this.traverseUnit(n);return t}traverseGrouping(e){let t=e.alg;return this.traverseAlg(t)*Math.abs(e.amount)}traverseMove(e){return this.metric(e)}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return 0}traverseNewline(e){return 0}traverseLineComment(e){return 0}};function mC(r){return"A"<=r&&r<="Z"}function gC(r){let e=r.family;return mC(e[0])&&e[e.length-1]==="v"||e==="x"||e==="y"||e==="z"||e==="T"?0:1}var NL=new UL(gC),Bs=NL.traverseAlg.bind(NL);Oe();var OL=class extends Cn{traverseAlg(e){let t=0;for(let n of e.units())t+=this.traverseUnit(n);return t}traverseGrouping(e){return this.traverseAlg(e.alg)*Math.abs(e.amount)}traverseMove(e){return 1}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return 1}traverseNewline(e){return 0}traverseLineComment(e){return 0}},GL=new OL,id=GL.traverseAlg.bind(GL);$h();mf();qn();var w2={};Rt(w2,{randomScrambleForEvent:()=>sd});var x2={};Rt(x2,{experimentalRandomScrambleForEvent:()=>sd,experimentalSolve2x2x2:()=>dA,experimentalSolve3x3x3IgnoringCenters:()=>pA,random333State:()=>v2,setDebug:()=>vA,solveMegaminx:()=>yA,solvePyraminx:()=>gA,solveSkewb:()=>mA});Oe();var yC=null;async function WL(){if(typeof crypto!="undefined"&&typeof crypto.getRandomValues!="undefined")return crypto.getRandomValues.bind(crypto);{let e=await(yC??(yC=import("crypto")));return t=>{if(!(t instanceof Uint32Array))throw new Error("The getRandomValues() shim only takes unsigned 32-bit int arrays");let n=e.randomBytes(t.length*4),i=[];for(let o=0;o<t.length;o++)i.push((n[o*4+0]<<24)+(n[o*4+1]<<16)+(n[o*4+2]<<8)+(n[o*4+3]<<0));t.set(i)}}}var VL=9007199254740992,vC=2097152,xC=2048;function wC(r){let e=new Uint32Array(2);r(e);let t=e[0],n=e[1];return Math.floor(t*vC)+Math.floor(n/xC)}function bC(r){if(typeof r!="number"||r<0||Math.floor(r)!==r)throw new Error("randomInt.below() not called with a positive integer value.");if(r>VL)throw new Error(`Called randomInt.below() with max == ${r}, which is larger than Javascript can handle with integer precision.`)}async function Er(){let r=await WL(),e=t=>{bC(t);let n=wC(r),i=Math.floor(VL/t)*t;return n<i?n%t:e(t)};return e}async function rd(){let r=await Er();return e=>e[r(e.length)]}var dN=Er();var HL=["UR","DR","DL","UL"],qL=["U","R","D","L","ALL"],SC=HL.concat(qL),LC=Er();async function i2(){let r=await LC,e=0;async function t(o){let s=o(12);return s!==0&&e++,s<=6?`${s}+`:`${12-s}-`}let n=[];async function i(o){for(let s of o)n.push(`${s}${await t(r)}`)}if(await i(SC),n.push("y2"),await i(qL),e<2)return i2();for(let o of HL)r(2)===0&&n.push(o);return n.join(" ")}var AC=Er(),jL=["++","--"];async function QL(){let r=await AC;function e(){return`R${jL[r(2)]} D${jL[r(2)]}`}function t(){return`U${["","'"][r(2)]}`}function n(){let o=[];for(let s=0;s<5;s++)o.push(e());return o.push(t()),o.join(" ")}let i=[];for(let o=0;o<6;o++)i.push(n());return i.join(`
|
|
7069
|
-
`)}var YL=Symbol("Comlink.proxy"),DC=Symbol("Comlink.endpoint"),EC=Symbol("Comlink.releaseProxy"),r2=Symbol("Comlink.thrown"),XL=r=>typeof r=="object"&&r!==null||typeof r=="function",MC={canHandle:r=>XL(r)&&r[YL],serialize(r){let{port1:e,port2:t}=new MessageChannel;return ZL(r,e),[t,[t]]},deserialize(r){return r.start(),Pc(r)}},RC={canHandle:r=>XL(r)&&r2 in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},KL=new Map([["proxy",MC],["throw",RC]]);function ZL(r,e=self){e.addEventListener("message",function t(n){if(!n||!n.data)return;let{id:i,type:o,path:s}=Object.assign({path:[]},n.data),a=(n.data.argumentList||[]).map(zs),l;try{let u=s.slice(0,-1).reduce((f,h)=>f[h],r),c=s.reduce((f,h)=>f[h],r);switch(o){case"GET":l=c;break;case"SET":u[s.slice(-1)[0]]=zs(n.data.value),l=!0;break;case"APPLY":l=c.apply(u,a);break;case"CONSTRUCT":{let f=new c(...a);l=CC(f)}break;case"ENDPOINT":{let{port1:f,port2:h}=new MessageChannel;ZL(r,h),l=_C(f,[f])}break;case"RELEASE":l=void 0;break;default:return}}catch(u){l={value:u,[r2]:0}}Promise.resolve(l).catch(u=>({value:u,[r2]:0})).then(u=>{let[c,f]=s2(u);e.postMessage(Object.assign(Object.assign({},c),{id:i}),f),o==="RELEASE"&&(e.removeEventListener("message",t),JL(e))})}),e.start&&e.start()}function TC(r){return r.constructor.name==="MessagePort"}function JL(r){TC(r)&&r.close()}function Pc(r,e){return o2(r,[],e)}function od(r){if(r)throw new Error("Proxy has been released and is not useable")}function o2(r,e=[],t=function(){}){let n=!1,i=new Proxy(t,{get(o,s){if(od(n),s===EC)return()=>Rl(r,{type:"RELEASE",path:e.map(a=>a.toString())}).then(()=>{JL(r),n=!0});if(s==="then"){if(e.length===0)return{then:()=>i};let a=Rl(r,{type:"GET",path:e.map(l=>l.toString())}).then(zs);return a.then.bind(a)}return o2(r,[...e,s])},set(o,s,a){od(n);let[l,u]=s2(a);return Rl(r,{type:"SET",path:[...e,s].map(c=>c.toString()),value:l},u).then(zs)},apply(o,s,a){od(n);let l=e[e.length-1];if(l===DC)return Rl(r,{type:"ENDPOINT"}).then(zs);if(l==="bind")return o2(r,e.slice(0,-1));let[u,c]=$L(a);return Rl(r,{type:"APPLY",path:e.map(f=>f.toString()),argumentList:u},c).then(zs)},construct(o,s){od(n);let[a,l]=$L(s);return Rl(r,{type:"CONSTRUCT",path:e.map(u=>u.toString()),argumentList:a},l).then(zs)}});return i}function FC(r){return Array.prototype.concat.apply([],r)}function $L(r){let e=r.map(s2);return[e.map(t=>t[0]),FC(e.map(t=>t[1]))]}var eA=new WeakMap;function _C(r,e){return eA.set(r,e),r}function CC(r){return Object.assign(r,{[YL]:!0})}function s2(r){for(let[e,t]of KL)if(t.canHandle(r)){let[n,i]=t.serialize(r);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:r},eA.get(r)||[]]}function zs(r){switch(r.type){case"HANDLER":return KL.get(r.name).deserialize(r.value);case"RAW":return r.value}}function Rl(r,e,t){return new Promise(n=>{let i=PC();r.addEventListener("message",function o(s){!s.data||!s.data.id||s.data.id!==i||(r.removeEventListener("message",o),n(s.data))}),r.start&&r.start(),r.postMessage(Object.assign({id:i},e),t)})}function PC(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var aA=typeof globalThis.Worker=="undefined"&&typeof globalThis.WorkerNavigator=="undefined";async function lA(){return aA?await(await Promise.resolve().then(()=>(l2(),a2))).NodeWorkerWrapper():globalThis.Worker}async function uA(r,e){let t;if(aA){let n=await(await Promise.resolve().then(()=>(l2(),a2))).NodeWorkerStringWrapper();return new n(r)}else{let n=new Blob([r],{type:"application/javascript"}),i=URL.createObjectURL(n);t=new globalThis.Worker(i,{type:e?e.type:void 0})}return t}var WC={},NC=!1;async function OC(){return new Promise(async(r,e)=>{setTimeout(()=>{e()},1e3);let t=await lA(),n=new t(new URL("./esm-test-worker.js",WC.url));await Pc(n).test("to worker")==="from worker"?r():e()})}async function GC(){try{await OC(),console.info("Successful relative URL worker instantiation.")}catch(r){console.warn("WARNING: Could not instantiate and communicate with a relative URL worker. This means that your app may have issues with `cubing/solve` in the future.")}}async function fA(){let{workerSource:r}=await Promise.resolve().then(()=>(hA(),cA)),e=await uA(r);return NC&&GC(),Pc(e)}var VC=null;async function Is(){return await(VC??(VC=fA()))}async function sd(r){switch(r){case"clock":return re.fromString(await i2());case"minx":return re.fromString(await QL())}let t=await HC(r);return re.fromString(t)}async function HC(r){return(await Is()).randomScrambleStringForEvent(r)}async function pA(r){let e=await Is();return re.fromString(await e.solve333ToString(r))}async function dA(r){let e=await Is();return re.fromString(await e.solve222ToString(r))}async function mA(r){let e=await Is();return re.fromString(await e.solveSkewbToString(r))}async function gA(r){let e=await Is();return re.fromString(await e.solvePyraminxToString(r))}async function yA(r){let e=await Is();return re.fromString(await e.solveMegaminxToString(r))}function vA(r){let{logPerf:e}=r;typeof e!="undefined"&&Is().then(t=>t.setDebugMeasurePerf(e))}Oe();Ht();qn();Oe();var bt={3:1},zi=4194303,Us=1048575,qC=524288;var wn={11:1,3:1},sn={17:1,3:1},jC=14540032;var wt={10:1,3:1},et,ad={};function xA(){}function QC(r){function e(){}return e.prototype=r||{},new e}function YC(r){return r instanceof Array?r[0]:null}function kc(r,e,t){var n=ad,i=XC,o=YC,s=n[r],a=o(s);s&&!a?et=s:(et=n[r]=e?i(e):{},et.castableTypeMap$=t,et.constructor=et,!e&&(et.typeMarker$=xA));for(var l=3;l<arguments.length;++l)arguments[l].prototype=et;a&&(et.___clazz$=a)}function XC(r){var e=ad;return QC(e[r])}function KC(){}kc(1,null,{},KC);function ZC(r){return r<<24>>24}function u2(){this.typeName=null,this.simpleName=null,this.packageName=null,this.compoundName=null,this.canonicalName=null,this.typeId=null,this.arrayLiterals=null}function c2(r,e){var t;return t=new u2,t.packageName=r,t.compoundName=e,t}function Eo(r,e,t){var n;return n=c2(r,e),e7(t,n),n}function JC(r,e){var t;return t=c2(r,e),t.modifiers=2,t}function ld(r,e){var t;return t=c2("",r),t.typeId=e,t.modifiers=1,t}function wA(r,e){var t=r.arrayLiterals=r.arrayLiterals||[];return t[e]||(t[e]=r.createClassLiteralForArray(e))}function $C(r){if(r.isPrimitive())return null;var e=r.typeId,t=ad[e];return t}function e7(r,e){if(!!r){e.typeId=r;var t=$C(e);if(!t){ad[r]=[e];return}t.___clazz$=e}}kc(79,1,{},u2);et.createClassLiteralForArray=function(e){var t;return t=new u2,t.modifiers=4,e>1?t.componentType=wA(this,e-1):t.componentType=this,t};et.isPrimitive=function(){return(this.modifiers&1)!=0};function st(r,e){return wA(r,e)}function pt(r,e,t,n,i,o){var s;return s=SA(i,n),at(st(r,o),e,t,i,s),s}function Kn(r,e,t,n,i,o){return bA(r,e,t,n,i,0,o)}function bA(r,e,t,n,i,o,s){var a,l,u,c,f;if(c=i[o],u=o==s-1,a=u?n:0,f=SA(a,c),at(st(r,s-o),e[o],t[o],a,f),!u)for(++o,l=0;l<c;++l)f[l]=bA(r,e,t,n,i,o,s);return f}function at(r,e,t,n,i){return i.___clazz$=r,i.castableTypeMap$=e,i.typeMarker$=xA,i.__elementTypeId$=t,i.__elementTypeCategory$=n,i}function SA(r,e){var t=new Array(e),n;switch(r){case 6:n={l:0,m:0,h:0};break;case 7:n=0;break;case 8:n=!1;break;default:return t}for(var i=0;i<e;++i)t[i]=n;return t}function LA(r){var e,t,n;return e=r&zi,t=r>>22&zi,n=r<0?Us:0,t7(e,t,n)}function t7(r,e,t){return{l:r,m:e,h:t}}function Bc(r,e){return{l:r.l&e.l,m:r.m&e.m,h:r.h&e.h}}function n7(r){var e,t;return r>-129&&r<128?(e=r+128,fd==null&&(fd=pt(W7,bt,293,256,0,1)),t=fd[e],!t&&(t=fd[e]=LA(r)),t):LA(r)}function h2(r,e){return{l:r.l|e.l,m:r.m|e.m,h:r.h|e.h}}function ud(r,e){var t,n,i;return e&=63,e<22?(t=r.l<<e,n=r.m<<e|r.l>>22-e,i=r.h<<e|r.m>>22-e):e<44?(t=0,n=r.l<<e-22,i=r.m<<e-22|r.l>>44-e):(t=0,n=0,i=r.l<<e-44),{l:t&zi,m:n&zi,h:i&Us}}function cd(r,e){var t,n,i,o,s;return e&=63,t=r.h,n=(t&qC)!=0,n&&(t|=-1048576),e<22?(s=t>>e,o=r.m>>e|t<<22-e,i=r.l>>e|r.m<<22-e):e<44?(s=n?Us:0,o=t>>e-22,i=r.m>>e-22|t<<44-e):(s=n?Us:0,o=n?zi:0,i=t>>e-44),{l:i&zi,m:o&zi,h:s&Us}}function AA(r,e){var t,n,i;return t=r.l-e.l,n=r.m-e.m+(t>>22),i=r.h-e.h+(n>>22),{l:t&zi,m:n&zi,h:i&Us}}function hd(r){return r.l|r.m<<22}var fd;var i7=Eo("java.lang","String",2);function pd(r,e){var t;if(r===e)return!0;if(r.length!=e.length)return!1;for(t=0;t<r.length;++t)if(r[t]!=e[t])return!1;return!0}var DA=!1;function r7(){DA||(DA=!0,y7=Kn(Sn,[bt,wn],[11,0],7,[495,18],2),d7=Kn(Sn,[bt,wn],[11,0],7,[324,18],2),u7=Kn(Sn,[bt,wn],[11,0],7,[336,18],2),m7=Kn(Sn,[bt,wn],[11,0],7,[495,8],2),v7=pt(an,sn,0,20048,7,1),g7=pt(an,sn,0,20791,7,1),p7=pt(an,sn,0,82945,7,1),s7=Kn(Sn,[bt,wn],[11,0],7,[2768,10],2),l7=Kn(Sn,[bt,wn],[11,0],7,[2768,10],2),f7=Kn(Sn,[bt,wn],[11,0],7,[24,10],2),h7=Kn(Sn,[bt,wn],[11,0],7,[24,16],2),o7=Kn(Sn,[bt,wn],[11,0],7,[140,16],2),c7=pt(an,sn,0,8305,7,1),a7=pt(an,sn,0,48441,7,1))}function zc(){r7()}kc(31,1,{31:1},zc);et.flip=0;et.flipc=0;et.fsym=0;et.prun=0;et.slice_0=0;et.tsym=0;et.twist=0;et.twistc=0;var o7;var s7,a7,l7,u7,c7,h7,f7,p7,d7,m7,g7,y7,v7;var dd=Eo("org.cubing.min2phase.client","CoordCube",31),EA=!1;function Tl(){EA||(EA=!0,Mr=pt(Ic,bt,7,16,0,1),bn=pt(Ic,bt,7,18,0,1),BA=pt(V7,bt,0,18,6,1),kA=pt(an,sn,0,48,7,1),PA=Kn(an,[bt,sn],[17,0],7,[16,16],2),Ns=Kn(an,[bt,sn],[17,0],7,[16,16],2),gd=Kn(an,[bt,sn],[17,0],7,[16,18],2),_A=pt(an,sn,0,144,7,1),CA=Kn(an,[bt,sn],[17,0],7,[16,18],2),T7=pt(Sn,wn,0,336,7,1),B7=pt(Sn,wn,0,324,7,1),M7=pt(Sn,wn,0,2768,7,1),C7=pt(dt,wt,0,2768,7,1),P7=pt(Sn,wn,0,2768,7,1),_7=pt(dt,wt,0,24,7,1),R7=pt(Sn,wn,0,2048,7,1),k7=pt(Sn,wn,0,2187,7,1),d2=pt(Sn,wn,0,40320,7,1),F7=pt(Sn,wn,0,2688,7,1),m2=new Ii(2531,1373,67026819,1367),g2=new Ii(2089,1906,322752913,2040),zA=at(st(dt,2),bt,10,0,[at(st(dt,1),wt,0,7,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),at(st(dt,1),wt,0,7,[6,7,8,0,1,2,3,4,5,15,16,17,9,10,11,12,13,14]),at(st(dt,1),wt,0,7,[3,4,5,6,7,8,0,1,2,12,13,14,15,16,17,9,10,11]),at(st(dt,1),wt,0,7,[2,1,0,5,4,3,8,7,6,11,10,9,14,13,12,17,16,15]),at(st(dt,1),wt,0,7,[8,7,6,2,1,0,5,4,3,17,16,15,11,10,9,14,13,12]),at(st(dt,1),wt,0,7,[5,4,3,8,7,6,2,1,0,14,13,12,17,16,15,11,10,9])]),D7(),E7())}function f2(r){r.ca=at(st(dt,1),wt,0,7,[0,1,2,3,4,5,6,7]),r.ea=at(st(dt,1),wt,0,7,[0,2,4,6,8,10,12,14,16,18,20,22])}function x7(r){!r.temps&&(r.temps=new tr),p2(g2,r,r.temps),p2(r.temps,m2,r),Fl(g2,r,r.temps),Fl(r.temps,m2,r)}function MA(r,e){var t,n;for(n=0;n<8;n++)r.ca[n]=e.ca[n];for(t=0;t<12;t++)r.ea[t]=e.ea[t]}function w7(r){var e,t;for(!r.temps&&(r.temps=new tr),t=0;t<12;t++)r.temps.ea[r.ea[t]>>1]=(t<<1|r.ea[t]&1)<<24>>24;for(e=0;e<8;e++)r.temps.ca[r.ca[e]&7]=(e|32>>(r.ca[e]>>3)&24)<<24>>24;MA(r,r.temps)}function b7(r){var e,t,n,i,o,s,a;for(e=new TA(r),i=new tr,t=FA(d2[UA(e.ca,8,!1)])>>4,s={l:0,m:0,h:0},a=0;a<6;a++){if(n=FA(d2[UA(e.ca,8,!1)])>>4,t==n)for(o=0;o<16;o++)RA(e,Ns[0][o],i),pd(i.ca,r.ca)&&(A7(e,Ns[0][o],i),pd(i.ea,r.ea)&&(s=h2(s,ud({l:1,m:0,h:0},(a<<4|o)<48?a<<4|o:48))));x7(e),a%3==2&&w7(e)}return s}function S7(r,e){var t,n,i;for(n=0,t=10;t>=0;--t,e>>=1)n^=i=e&1,r.ea[t]=(r.ea[t]&-2|i)<<24>>24;r.ea[11]=(r.ea[11]&-2|n)<<24>>24}function L7(r,e){var t,n,i;for(n=15,t=6;t>=0;--t,e=~~(e/3))n-=i=e%3,r.ca[t]=(r.ca[t]&7|i<<3)<<24>>24;r.ca[7]=(r.ca[7]&7|n%3<<3)<<24>>24}function RA(r,e,t){Tl();var n,i,o,s,a,l;for(l=Mr[Ns[0][e]],a=Mr[e],n=0;n<8;n++)o=l.ca[r.ca[a.ca[n]&7]&7]>>3,s=r.ca[a.ca[n]&7]>>3,i=o<3?s:(3-s)%3,t.ca[n]=(l.ca[r.ca[a.ca[n]&7]&7]&7|i<<3)<<24>>24}function p2(r,e,t){Tl();var n,i,o;for(n=0;n<8;n++)i=r.ca[e.ca[n]&7]>>3,o=e.ca[n]>>3,t.ca[n]=(r.ca[e.ca[n]&7]&7|(i+o)%3<<3)<<24>>24}function md(r,e,t){var n,i,o,s;for(n=0;n<8;n++)o=r.ca[e.ca[n]&7]>>3,s=e.ca[n]>>3,i=o+(o<3?s:6-s),i=i%3+(o<3==s<3?0:3),t.ca[n]=(r.ca[e.ca[n]&7]&7|i<<3)<<24>>24}function tr(){Tl(),f2(this)}function Ii(r,e,t,n){f2(this),NA(this.ca,r,8,!1),L7(this,e),NA(this.ea,t,12,!0),S7(this,n)}function TA(r){f2(this),MA(this,r)}function FA(r){return Tl(),r^jC>>((r&15)<<1)&3}function A7(r,e,t){Tl();var n,i,o;for(o=Mr[Ns[0][e]],i=Mr[e],n=0;n<12;n++)t.ea[n]=(o.ea[r.ea[i.ea[n]>>1]>>1]^r.ea[i.ea[n]>>1]&1^i.ea[n]&1)<<24>>24}function Fl(r,e,t){Tl();var n;for(n=0;n<12;n++)t.ea[n]=(r.ea[e.ea[n]>>1]^e.ea[n]&1)<<24>>24}function D7(){var r,e;for(bn[0]=new Ii(15120,0,119750400,0),bn[3]=new Ii(21021,1494,323403417,0),bn[6]=new Ii(8064,1236,29441808,550),bn[9]=new Ii(9,0,5880,0),bn[12]=new Ii(1230,412,2949660,0),bn[15]=new Ii(224,137,328552,137),r=0;r<18;r+=3)for(e=0;e<2;e++)bn[r+e+1]=new tr,Fl(bn[r+e],bn[r],bn[r+e+1]),p2(bn[r+e],bn[r],bn[r+e+1])}function E7(){var r,e,t,n,i,o,s,a,l,u,c,f,h,p,d,g;for(r=new tr,e=new tr,t=new Ii(28783,0,259268407,0),g=new Ii(15138,0,119765538,7),f=new Ii(5167,0,83473207,0),i=0;i<8;i++)f.ca[i]=ZC(f.ca[i]|24);for(o=0;o<16;o++)Mr[o]=new TA(r),md(r,g,e),Fl(r,g,e),d=e,e=r,r=d,o%4==3&&(md(d,f,e),Fl(d,f,e),d=e,e=r,r=d),o%8==7&&(md(d,t,e),Fl(d,t,e),d=e,e=r,r=d);for(s=0;s<16;s++)for(l=0;l<16;l++)for(md(Mr[s],Mr[l],r),c=0;c<16;c++)if(pd(Mr[c].ca,r.ca)){PA[s][l]=c,Ns[c][l]=s;break}for(u=0;u<18;u++)for(p=0;p<16;p++){for(RA(bn[u],Ns[0][p],r),h=0;h<18;h++)if(pd(bn[h].ca,r.ca)){gd[p][u]=h,CA[p][(y2(),vd)[u]]=vd[h];break}p%2==0&&(_A[u<<3|p>>1]=gd[p][u])}for(n=0;n<18;n++)for(BA[n]=b7(bn[n]),a=n,p=0;p<48;p++)gd[p%16][a]<n&&(kA[p]|=1<<n),p%16==15&&(a=zA[2][a])}var Mr,d2,M7,R7,T7,F7,_7,C7,P7,_A,gd,CA,PA,Ns;var k7,B7,kA,bn,BA,m2,g2,zA,Ic=Eo("org.cubing.min2phase.client","CubieCube",7);function z7(){var r,e,t;for(this.move=pt(an,sn,0,31,7,1),this.nodeUD=pt(dd,bt,31,21,0,1),this.nodeRL=pt(dd,bt,31,21,0,1),this.nodeFB=pt(dd,bt,31,21,0,1),this.cc=new tr,this.urfCubieCube=pt(Ic,bt,7,6,0,1),this.urfCoordCube=pt(dd,bt,31,6,0,1),this.phase1Cubie=pt(Ic,bt,7,21,0,1),this.preMoveCubes=pt(Ic,bt,7,21,0,1),this.preMoves=pt(an,sn,0,20,7,1),e=0;e<21;e++)this.nodeUD[e]=new zc,this.nodeRL[e]=new zc,this.nodeFB[e]=new zc,this.phase1Cubie[e]=new tr;for(t=0;t<6;t++)this.urfCubieCube[t]=new tr,this.urfCoordCube[t]=new zc;for(r=0;r<20;r++)this.preMoveCubes[r+1]=new tr}kc(72,1,{},z7);et.allowShorter=!1;et.conjMask=0;et.depth1=0;et.isRec=!1;et.length1=0;et.maxDep2=0;et.maxPreMoves=0;et.preMoveLen=0;et.probe={l:0,m:0,h:0};et.probeMax={l:0,m:0,h:0};et.probeMin={l:0,m:0,h:0};et.selfSym={l:0,m:0,h:0};et.solLen=0;et.urfIdx=0;et.valid1=0;et.verbose=0;var IA=!1;function y2(){if(!IA){IA=!0;var r,e,t,n,i,o;for(U7=at(st(dt,2),bt,10,0,[at(st(dt,1),wt,0,7,[8,9,20]),at(st(dt,1),wt,0,7,[6,18,38]),at(st(dt,1),wt,0,7,[0,36,47]),at(st(dt,1),wt,0,7,[2,45,11]),at(st(dt,1),wt,0,7,[29,26,15]),at(st(dt,1),wt,0,7,[27,44,24]),at(st(dt,1),wt,0,7,[33,53,42]),at(st(dt,1),wt,0,7,[35,17,51])]),N7=at(st(dt,2),bt,10,0,[at(st(dt,1),wt,0,7,[5,10]),at(st(dt,1),wt,0,7,[7,19]),at(st(dt,1),wt,0,7,[3,37]),at(st(dt,1),wt,0,7,[1,46]),at(st(dt,1),wt,0,7,[32,16]),at(st(dt,1),wt,0,7,[28,25]),at(st(dt,1),wt,0,7,[30,43]),at(st(dt,1),wt,0,7,[34,52]),at(st(dt,1),wt,0,7,[23,12]),at(st(dt,1),wt,0,7,[21,41]),at(st(dt,1),wt,0,7,[50,39]),at(st(dt,1),wt,0,7,[48,14])]),_l=Kn(an,[bt,sn],[17,0],7,[13,13],2),O7=at(st(i7,1),bt,2,4,["U ","U2","U'","R ","R2","R'","F ","F2","F'","D ","D2","D'","L ","L2","L'","B ","B2","B'"]),xd=at(st(an,1),sn,0,7,[0,1,2,4,7,9,10,11,13,16,3,5,6,8,12,14,15,17]),vd=pt(an,sn,0,18,7,1),yd=pt(an,sn,0,11,7,1),e=0;e<18;e++)vd[xd[e]]=e;for(t=0;t<10;t++)for(n=~~(xd[t]/3),yd[t]=0,i=0;i<10;i++)o=~~(xd[i]/3),yd[t]|=(n==o||n%3==o%3&&n>=o?1:0)<<i;for(yd[10]=0,r=0;r<13;r++)for(_l[r][0]=_l[r][r]=1,i=1;i<r;i++)_l[r][i]=_l[r-1][i-1]+_l[r-1][i]}}function UA(r,e,t){y2();var n,i,o,s;for(i=0,s={l:1323536,m:2777561,h:1043915},n=0;n<e-1;n++)o=I7(r[n],t)<<2,i=(e-n)*i+hd(Bc(cd(s,o),{l:15,m:0,h:0})),s=AA(s,ud({l:1118480,m:279620,h:69905},o));return i}function I7(r,e){return e?r>>1:r&7}function NA(r,e,t,n){y2();var i,o,s,a,l,u;for(u={l:1323536,m:2777561,h:1043915},i={l:0,m:0,h:0},a=2;a<=t;a++)i=h2(ud(i,4),n7(e%a)),e=~~(e/a);for(o=0;o<t-1;o++)l=(hd(i)&15)<<2,i=cd(i,4),r[o]=OA(r[o],hd(Bc(cd(u,l),{l:15,m:0,h:0})),n),s=AA(ud({l:1,m:0,h:0},l),{l:1,m:0,h:0}),u=h2(Bc(u,s),Bc(cd(u,4),{l:~s.l&zi,m:~s.m&zi,h:~s.h&Us}));r[t-1]=OA(r[t-1],hd(Bc(u,{l:15,m:0,h:0})),n)}function OA(r,e,t){return(t?e<<1|r&1:e|r&-8)<<24>>24}var _l,yd,U7,N7,O7,vd,xd;function G7(){this.moves=pt(an,sn,0,31,7,1)}kc(150,1,{},G7);et.depth1=0;et.length_0=0;et.urfIdx=0;et.verbose=0;var an=ld("int","I");Eo("com.google.gwt.lang","CollapsedPropertyHolder",252);Eo("com.google.gwt.lang","JavaClassHierarchySetupUtil",254);var W7=Eo("com.google.gwt.lang","LongLibBase/LongEmul",null);Eo("com.google.gwt.lang","ModuleUtils",257);var dt=ld("byte","B"),V7=ld("long","J"),Sn=ld("char","C");Eo("com.google.gwt.user.client.rpc","XsrfToken",null),JC("java.util","Map/Entry");var UN="UF UR UB UL DF DR DB DL FR FL BR BL".split(" "),NN="UFR URB UBL ULF DRF DFL DLB DBR".split(" "),ON="U L F R B D".split(" ");Oe();Ht();function GA(r,e,t){for(let n in r.orbits)if(!Jr(r,n,e,t,{ignoreOrientation:n==="CENTERS"}))return!1;return!0}function WA(r,e){let t=new pn(r);if(GA(r,t.state,e))return!1;for(let n of"ULFRBD")for(let i=1;i<4;i++)if(t.reset(),t.applyMove(new E(n,i)),GA(r,t.state,e))return!1;return!0}var VA=[["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 v2(){let r=await Ot["3x3x3"].def(),e=new pn(r);for(let t of VA)e.applyAlg(re.fromString((await rd())(t)));return WA(r,e.state)?e.state:v2()}var cO=new re("R' U' F");var A2={};Rt(A2,{TwizzleStreamServer:()=>L2,WebSocketProxyReceiver:()=>S2,WebSocketProxySender:()=>b2});var b2=class{constructor(e){this.websocket=new WebSocket(e),this.websocket.onopen=this.onopen.bind(this),this.websocket.onerror=this.onerror.bind(this),this.websocket.onmessage=this.onmessage.bind(this)}sendMoveEvent(e){this.sendProxyEvent({event:"move",data:e})}sendOrientationEvent(e){this.sendProxyEvent({event:"orientation",data:e})}sendResetEvent(){this.sendProxyEvent({event:"reset"})}sendProxyEvent(e){this.websocket.send(JSON.stringify(e))}onopen(){console.log("Sending socket is open!")}onerror(e){console.error("WebSocket sender error:",e)}onmessage(e){}},S2=class{constructor(e,t){if(!t){console.log("No socket origin specified. Will not attempt to connect.");return}this.websocket=new WebSocket(e),console.log(this.websocket),this.websocket.onopen=this.onopen.bind(this),this.websocket.onerror=this.onerror.bind(this),this.websocket.onmessage=this.onmessage.bind(this)}onopen(){console.log("Receiving socket is open!")}onerror(e){console.error("WebSocket receiver error:",e)}onmessage(e){this.onProxyEvent(JSON.parse(e.data))}};Oe();var HA=class extends EventTarget{constructor(e){super();this.socket=new WebSocket(e),this.socket.onmessage=this.onMessage.bind(this)}onMessage(e){try{let t=JSON.parse(e.data);if(t.event==="move"){let n=t.data.latestMove;if(n.type!=="blockMove")throw new Error("Invalid move!");this.dispatchEvent(new CustomEvent("move",{detail:{move:new E(new ze(n.family),n.amount)}}))}}catch(t){console.error("Could not handle message:",t)}}},L2=class{async streams(){return(await(await fetch("https://api.twizzle.net/v0/streams")).json()).streams}connect(e){return new HA(`wss://api.twizzle.net/v0/streams/${e}/socket`)}};var ov={};Rt(ov,{Cube3D:()=>Ui,EXPERIMENTAL_PROP_NO_VALUE:()=>Br,KSolvePuzzle:()=>Tn,PG3D:()=>wi,SimpleAlgIndexer:()=>Xs,TimestampLocationType:()=>ti,TreeAlgIndexer:()=>ei,Twisty3DCanvas:()=>kr,TwistyAlgEditor:()=>Dm,TwistyAlgViewer:()=>Lm,TwistyAlgViewerV1:()=>zm,TwistyPlayer:()=>zo,TwistyPlayerV1:()=>Jl,experimentalSetShareAllNewRenderers:()=>DD,experimentalShowRenderStats:()=>gD});Oe();var tt;(function(n){n[n.Forwards=1]="Forwards",n[n.Paused=0]="Paused",n[n.Backwards=-1]="Backwards"})(tt||(tt={}));function Cl(r){return r}var kt;(function(t){t.Move="move",t.EntireTimeline="entire-timeline"})(kt||(kt={}));Rr();var wd,Uc,H7=class{constructor(){H(this,wd,0);H(this,Uc,0)}async queue(e){let t=++sa(this,wd)._,n=await e;return t>S(this,Uc)?($(this,Uc,t),{fresh:!0,result:n}):{fresh:!1}}};wd=new WeakMap,Uc=new WeakMap;var bd,Nc,Tr=class{constructor(){H(this,bd,0);H(this,Nc,0)}queue(e){return new Promise(async(t,n)=>{try{let i=++sa(this,bd)._,o=await e;i>S(this,Nc)&&($(this,Nc,i),t(o))}catch(i){n(i)}})}};bd=new WeakMap,Nc=new WeakMap;function Oc(r,e){if(r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function D2(r,e,t){if(r===e)return!0;if(r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!t(r[n],e[n]))return!1;return!0}function E2(r,e,t=0){return(r%e+e+t)%e-t}function M2(r,e,t){return E2(r-e,t-e)+e}var qA=class{constructor(e){this.model=e;this.catchingUp=!1;this.pendingFrame=!1;this.scheduler=new ln(this.animFrame.bind(this));this.catchUpMs=500;this.lastTimestamp=0}start(){this.catchingUp||(this.lastTimestamp=performance.now()),this.catchingUp=!0,this.pendingFrame=!0,this.scheduler.requestAnimFrame()}stop(){this.catchingUp=!1,this.scheduler.cancelAnimFrame()}animFrame(e){this.scheduler.requestAnimFrame();let t=(e-this.lastTimestamp)/this.catchUpMs;this.lastTimestamp=e,this.model.catchUpMoveProp.set((async()=>{let n=await this.model.catchUpMoveProp.get();if(n.move===null)return n;let i=n.amount+t;return i>=1?(this.pendingFrame=!0,this.stop(),this.model.timestampRequestProp.set("end"),{move:null,amount:0}):(this.pendingFrame=!1,{move:n.move,amount:i})})())}},Gc,jA,Sd,R2=class{constructor(e,t){this.delegate=t;H(this,Gc);this.playing=!1;this.direction=tt.Forwards;this.lastDatestamp=0;this.scheduler=new ln(this.animFrame.bind(this));H(this,Sd,new Tr);this.model=e,this.lastTimestampPromise=ye(this,Gc,jA).call(this),this.model.playingInfoProp.addFreshListener(this.onPlayingProp.bind(this)),this.catchUpHelper=new qA(this.model),this.model.catchUpMoveProp.addFreshListener(this.onCatchUpMoveProp.bind(this))}async onPlayingProp(e){e.playing!==this.playing&&(e.playing?this.play(e):this.pause())}async onCatchUpMoveProp(e){let t=e.move!==null;t!==this.catchUpHelper.catchingUp&&(t?this.catchUpHelper.start():this.catchUpHelper.stop()),this.scheduler.requestAnimFrame()}jumpToStart(e){this.model.timestampRequestProp.set("start"),this.pause(),e?.flash&&this.delegate.flash()}jumpToEnd(e){this.model.timestampRequestProp.set("end"),this.pause(),e?.flash&&this.delegate.flash()}playPause(){this.playing?this.pause():this.play()}async play(e){let t=e?.direction??tt.Forwards,n=await this.model.coarseTimelineInfoProp.get();(e?.autoSkipToOtherEndIfStartingAtBoundary??!0)&&(t===tt.Forwards&&n.atEnd&&(this.model.timestampRequestProp.set("start"),this.delegate.flash()),t===tt.Backwards&&n.atStart&&(this.model.timestampRequestProp.set("end"),this.delegate.flash())),this.model.playingInfoProp.set({playing:!0,direction:t,untilBoundary:e?.untilBoundary??kt.EntireTimeline,loop:e?.loop??!1}),this.playing=!0,this.lastDatestamp=performance.now(),this.lastTimestampPromise=ye(this,Gc,jA).call(this),this.scheduler.requestAnimFrame()}pause(){this.playing=!1,this.scheduler.cancelAnimFrame(),this.model.playingInfoProp.set({playing:!1,untilBoundary:kt.EntireTimeline})}async animFrame(e){this.playing&&this.scheduler.requestAnimFrame();let t=this.lastDatestamp,n=await S(this,Sd).queue(Promise.all([this.model.playingInfoProp.get(),this.lastTimestampPromise,this.model.timeRangeProp.get(),this.model.tempoScaleProp.get(),this.model.currentLeavesProp.get()])),[i,o,s,a,l]=n;if(!i.playing){this.playing=!1;return}let u=l.earliestEnd;(l.currentMoves.length===0||i.untilBoundary===kt.EntireTimeline)&&(u=s.end);let c=l.latestStart;(l.currentMoves.length===0||i.untilBoundary===kt.EntireTimeline)&&(c=s.start);let f=(e-t)*Cl(this.direction)*a;f=Math.max(f,1),f*=i.direction;let h=o+f,p=null;h>=u?i.loop?h=M2(h,s.start,s.end):(h===s.end?p="end":h=u,this.playing=!1,this.model.playingInfoProp.set({playing:!1})):h<=c&&(i.loop?h=M2(h,s.start,s.end):(h===s.start?p="start":h=c,this.playing=!1,this.model.playingInfoProp.set({playing:!1}))),this.lastDatestamp=e,this.lastTimestampPromise=Promise.resolve(h),this.model.timestampRequestProp.set(p??h)}};Gc=new WeakSet,jA=async function(){return(await this.model.detailedTimelineInfoProp.get()).timestamp},Sd=new WeakMap;var T2=class{constructor(e,t){this.model=e;this.animationController=new R2(e,t)}jumpToStart(e){this.animationController.jumpToStart(e)}jumpToEnd(e){this.animationController.jumpToEnd(e)}togglePlay(e){typeof e=="undefined"&&this.animationController.playPause(),e?this.animationController.play():this.animationController.pause()}async visitTwizzleLink(){let e=document.createElement("a");e.href=await this.model.twizzleLink(),e.target="_blank",e.click()}};Ro();un();Ft();var Ld=new Xt(`
|
|
7068
|
+
`,e+=r.slice(32,40).join("."),e}var H_={permutation:[0,1,2,3,4,5],orientation:[0,0,0,0,0,0]},q_=[4,8,0,9,5,1,3,7,6,10,2,11],j_=[2,5,10,6,0,4,8,7,1,3,9,11],Q_=[1,0,1,0,1,0,1,0,0,0,0,0],Y_=[1,0,1,0,1,0,1,0,0,0,0,0],X_=[4,0,3,5,7,1,2,6],K_=[1,5,6,2,0,3,7,4],Z_=[1,2,1,2,2,1,2,1],J_=[2,1,2,1,1,2,1,2],$_=[-1,1,-1,1,1,-1,1,-1];function Tc(r,e){return e%2==1?r[e/2|0]%16:0|r[e/2|0]/16}function eC(r){return r[18]===167}var LL=[176,81,104,224,86,137,237,119,38,26,193,161,210,126,150,81,93,13,236,249,89,235,88,24,113,81,214,131,130,199,2,169,39,165,171,41];function tC(r){let e=Tc(r,38),t=Tc(r,39),n=new Uint8Array(td);for(let i=0;i<td;i++)n[i]=r[i]+LL[e+i]+LL[t+i];return n}async function AL(r){return eC(r)?tC(r):r}var Ps=class extends Bi{constructor(e,t,n){super();this.server=e;this.cubeCharacteristic=t;this.originalValue=n}static async connect(e){let t=await e.getPrimaryService(X1.cubeService);St("Service:",t);let n=await t.getCharacteristic(X1.cubeCharacteristic);St("Characteristic:",n);let i=await AL(new Uint8Array((await n.readValue()).buffer));St("Original value:",i);let o=new Ps(e,n,i);return await n.startNotifications(),n.addEventListener("characteristicvaluechanged",o.onCubeCharacteristicChanged.bind(o)),o}name(){return this.server.device.name}disconnect(){this.server.disconnect()}async getState(){return this.toReid333(new Uint8Array((await this.cubeCharacteristic.readValue()).buffer))}getBit(e,t){let n=t/8|0,i=7-t%8;return e[n]>>i&1}toReid333(e){let t={EDGES:{permutation:new Array(12),orientation:new Array(12)},CORNERS:{permutation:new Array(8),orientation:new Array(8)},CENTERS:H_};for(let n=0;n<12;n++){let i=j_[n];t.EDGES.permutation[n]=q_[Tc(e,i+16)-1],t.EDGES.orientation[n]=this.getBit(e,i+112)^Q_[t.EDGES.permutation[n]]^Y_[n]}for(let n=0;n<8;n++){let i=K_[n];t.CORNERS.permutation[n]=X_[Tc(e,i)-1],t.CORNERS.orientation[n]=(Tc(e,i+8)*$_[i]+Z_[t.CORNERS.permutation[n]]+J_[n])%3}return t}async onCubeCharacteristicChanged(e){let t=await AL(new Uint8Array(e.target.value.buffer));if(St(t),St(t),this.isRepeatedInitialValue(t)){St("Skipping repeated initial value.");return}let n=[];for(let o=0;o<td;o++)n.push(Math.floor(t[o]/16)),n.push(t[o]%16);St(n);let i=V_(n);St(i),this.dispatchMove({latestMove:K1(n[32],n[33]),timeStamp:e.timeStamp,debug:{stateStr:i},state:this.toReid333(t)})}isRepeatedInitialValue(e){if(typeof this.originalValue=="undefined")throw new Error("GiiKERCube has uninitialized original value.");if(this.originalValue===null)return!1;let t=this.originalValue;this.originalValue=null,St("Comparing against original value.");for(let n=0;n<td-2;n++)if(t[n]!==e[n])return St("Different at index ",n),!1;return!0}},DL={connect:Ps.connect.bind(Ps),prefixes:["Gi",""],filters:[{namePrefix:"Gi"},{services:["0000aadb-0000-1000-8000-00805f9b34fb"]},{services:["0000aaaa-0000-1000-8000-00805f9b34fb"]},{services:["0000fe95-0000-1000-8000-00805f9b34fb"]}],optionalServices:[X1.cubeService]};li();Oe();var Z1={goCubeService:"6e400001-b5a3-f393-e0a9-e50e24dcca9e",goCubeStateCharacteristic:"6e400003-b5a3-f393-e0a9-e50e24dcca9e"};function EL(r){return Array.prototype.map.call(new Uint8Array(r),e=>("00"+e.toString(16)).slice(-2)).join(" ")}function nC(r){let e=new Uint8Array(r),t="";for(let n of e)t+=String.fromCharCode(n);return t}var ML=[new E("B",1),new E("B",-1),new E("F",1),new E("F",-1),new E("U",1),new E("U",-1),new E("D",1),new E("D",-1),new E("R",1),new E("R",-1),new E("L",1),new E("L",-1)],ks=class extends Bi{constructor(e,t){super();this.server=e;this.goCubeStateCharacteristic=t;this.recorded=[];this.homeQuatInverse=null;this.lastRawQuat=new ot(0,0,0,1);this.currentQuat=new ot(0,0,0,1);this.lastTarget=new ot(0,0,0,1);this.alg=new re}static async connect(e){let t=await e.getPrimaryService(Z1.goCubeService);St({service:t});let n=await t.getCharacteristic(Z1.goCubeStateCharacteristic);St({goCubeStateCharacteristic:n});let i=new ks(e,n);return await n.startNotifications(),n.addEventListener("characteristicvaluechanged",i.onCubeCharacteristicChanged.bind(i)),i}disconnect(){this.server.disconnect()}reset(){this.resetAlg(),this.resetOrientation()}resetAlg(e){this.alg=e||new re}resetOrientation(){this.homeQuatInverse=this.lastRawQuat.clone().inverse(),this.currentQuat=new ot(0,0,0,1),this.lastTarget=new ot(0,0,0,1)}name(){return this.server.device.name}onCubeCharacteristicChanged(e){let t=e.target.value;if(this.recorded.push([e.timeStamp,EL(t.buffer)]),t.byteLength<16)for(let n=3;n<t.byteLength-4;n+=2){let i=ML[t.getUint8(n)];this.alg=fr(this.alg,i),this.dispatchMove({latestMove:ML[t.getUint8(n)],timeStamp:e.timeStamp,debug:{stateStr:EL(t.buffer)}})}else{let n=nC(t.buffer.slice(3,t.byteLength-3)).split("#").map(s=>parseInt(s,10)/16384),i=new ot(n[0],n[1],n[2],n[3]);this.lastRawQuat=i.clone(),this.homeQuatInverse||(this.homeQuatInverse=i.clone().inverse());let o=i.clone().multiply(this.homeQuatInverse.clone());o.y=-o.y,this.lastTarget.slerp(o,.5),this.currentQuat.rotateTowards(this.lastTarget,iC),this.dispatchOrientation({quaternion:this.currentQuat,timeStamp:e.timeStamp})}}},iC=.5,RL={connect:ks.connect.bind(ks),prefixes:["GoCube","Rubik"],filters:[{namePrefix:"GoCube"},{namePrefix:"Rubik"}],optionalServices:[Z1.goCubeService]};Oe();$h();qn();function Ml(r,e){let t=0;for(let n=0;n<e;n++){let i=e-1-2*n,o=r&1<<n;t+=i<0?o>>-i:o<<i}return t}var J1={heykubeService:"b46a791a-8273-4fc1-9e67-94d3dc2aac1c",stateCharacteristic:"a2f41a4e-0e31-4bbc-9389-4253475481fb",batteryCharacteristic:"fd51b3ba-99c7-49c6-9f85-5644ff56a378"},Fc=class extends Bi{constructor(e,t,n,i,o){super();this.server=i;this.stateCharacteristic=o;n.addEventListener("gattserverdisconnected",this.onDisconnect.bind(this)),this.stateCharacteristic.startNotifications(),this.startTrackingMoves()}static async connect(e,t){let n=await e.getPrimaryService(J1.heykubeService);St("Service:",n);let i=await n.getCharacteristic(J1.stateCharacteristic);return St("Characteristic:",i),new Fc(await Ot["3x3x3"].def(),n,t,e,i)}name(){return this.server.device.name}disconnect(){this.server.disconnect()}onDisconnect(){this.dispatchEvent(new CustomEvent("disconnect"))}startTrackingMoves(){this.stateCharacteristic.addEventListener("characteristicvaluechanged",e=>this.onStateCharacteristic(e))}onStateCharacteristic(e){let t=this.decodeState(e.target.value);this.dispatchMove({latestMove:t.latestMove,timeStamp:e.timeStamp,state:t.state})}decodeState(e){let t=[new E("U"),new E("U'"),new E("B"),new E("B'"),new E("F"),new E("F'"),null,null,new E("L"),new E("L'"),new E("D"),new E("D'"),new E("R"),new E("R'")],n=new Uint8Array(e.byteLength);for(let s=0;s<e.byteLength;s++)n[s]=Ml(e.getUint8(s),8);let i=mu(n.slice(0,11)),o={epLex:Ml(i.epLex,29),eoMask:Ml(i.eoMask,12),cpLex:Ml(i.cpLex,16),coMask:Ml(i.coMask,13),poIdxL:0,poIdxU:7,moSupport:1,moMask:0};return{state:gu(o),latestMove:t[n[20]&15]}}async getState(){let e=await this.stateCharacteristic.readValue();return this.decodeState(e).state}},TL={connect:Fc.connect.bind(Fc),prefixes:["HEYKUBE"],filters:[{namePrefix:"HEYKUBE"}],optionalServices:[J1.heykubeService]};var rC=[SL,RL,TL,DL];async function FL(r){return El(rC,r)}Oe();function oC(r){return Array.prototype.map.call(new Uint8Array(r),e=>("00"+e.toString(16)).slice(-2)).join(" ")}var $1=18*2,sC=150,aC=250,_L=new re("F B R2 L2 B' F'"),lC=_L.invert(),CL=new re("U D R2 L2 D' U'"),uC=CL.invert(),nd={ganRobotService:"0000fff0-0000-1000-8000-00805f9b34fb",statusCharacteristic:"0000fff2-0000-1000-8000-00805f9b34fb",moveCharacteristic:"0000fff3-0000-1000-8000-00805f9b34fb"},PL={R:0,R2:1,"R2'":1,"R'":2,F:3,F2:4,"F2'":4,"F'":5,D:6,D2:7,"D2'":7,"D'":8,L:9,L2:10,"L2'":10,"L'":11,B:12,B2:13,"B2'":13,"B'":14},kL={R:0,R2:1,"R2'":1,"R'":2,U:3,U2:4,"U2'":4,"U'":5,F:6,F2:7,"F2'":7,"F'":8,L:9,L2:10,"L2'":10,"L'":11,D:12,D2:13,"D2'":13,"D'":14};function cC(r){return r%3==1}function hC(r){return cC(r)?aC:sC}function fC(r){throw console.error("invalid move",r,r.toString()),new Error("invalid move!")}function e2(r){return new Promise(e=>setTimeout(e,r))}var _c=class extends EventTarget{constructor(e,t,n,i,o){super();this.server=t;this.statusCharacteristic=i;this.moveCharacteristic=o;this.experimentalDebugOnSend=null;this.experimentalDebugLog=()=>{};this.experimentalOptions={xAngle:!1,singleMoveFixHack:!1,bufferQueue:0,postSleep:0};this.locked=!1;this.moveQueue=new re;n.addEventListener("gattserverdisconnected",this.onDisconnect.bind(this))}static async connect(e,t){let n=await e.getPrimaryService(nd.ganRobotService),i=await n.getCharacteristic(nd.statusCharacteristic),o=await n.getCharacteristic(nd.moveCharacteristic);return new _c(n,e,t,i,o)}name(){return this.server.device.name}disconnect(){this.server.disconnect()}onDisconnect(){this.dispatchEvent(new CustomEvent("disconnect"))}moveToNibble(e){let t=(this.experimentalOptions.xAngle?kL:PL)[e.toString()]??null;return t===null&&fC(e),t}async writeNibbles(e){if(e.length>$1)throw new Error(`Can only write ${$1} nibbles at a time!`);let t=new Uint8Array(18),n;for(n=0;n<e.length;n++){let o=Math.floor(n/2);t[o]+=e[n],n%2==0&&(t[o]*=16)}e.length%2==1&&(t[Math.ceil(e.length/2)-1]+=15);for(let o=Math.ceil(e.length/2);o<18;o++)t[o]=255;let i=0;for(let o of e)i+=hC(o);for(this.experimentalDebugLog("WRITING:",oC(t)),await this.moveCharacteristic.writeValue(t),await e2(i*.75);(await this.getStatus()).movesRemaining>0;);await e2(this.experimentalOptions.postSleep)}async getStatus(){let e=new Uint8Array((await this.statusCharacteristic.readValue()).buffer);return this.experimentalDebugLog("moves remaining:",e[0]),{movesRemaining:e[0]}}processQueue(){}async queueMoves(e){if(this.moveQueue=this.moveQueue.concat(e).simplify({collapseMoves:!0,quantumMoveOrder:t=>4}),!this.locked)try{for(this.locked=!0,this.moveQueue.experimentalNumUnits()===1&&await e2(this.experimentalOptions.bufferQueue);this.moveQueue.experimentalNumUnits()>0;){let t=Array.from(this.moveQueue.units());if(this.experimentalOptions.singleMoveFixHack&&t.length===1){let a=t[0];a.amount===2?t=[a.modified({amount:1}),a.modified({amount:1})]:t=[a.modified({amount:-a.amount}),a.modified({amount:2})]}let n=t.splice(0,$1),i=n.map(this.moveToNibble.bind(this)),o=new re(n);this.experimentalDebugLog("SENDING",o.toString()),this.experimentalDebugOnSend&&this.experimentalDebugOnSend(o);let s=this.writeNibbles(i);this.moveQueue=new re(t),await s}}finally{this.locked=!1}}async applyMoves(e){for(let t of e)t.toString()in(this.experimentalOptions.xAngle?kL:PL)?await this.queueMoves(new re([t])):t.family===(this.experimentalOptions.xAngle?"B":"U")&&await Promise.all([this.queueMoves(this.experimentalOptions.xAngle?CL:_L),this.queueMoves(new re([t.modified({family:this.experimentalOptions.xAngle?"F":"D"})]).concat(this.experimentalOptions.xAngle?uC:lC))])}},BL={connect:_c.connect.bind(_c),prefixes:["GAN"],filters:[{namePrefix:"GAN"}],optionalServices:[nd.ganRobotService]};var pC=[BL];async function zL(r){return El(pC,r)}var t2={ganTimerService:"0000fff0-0000-1000-8000-00805f9b34fb",timeCharacteristic:"0000fff2-0000-1000-8000-00805f9b34fb"},Cc=class extends EventTarget{constructor(e,t,n,i){super();this.server=t;this.timeCharacteristic=i;this.polling=!1;this.previousDetail=null;this.startPolling(),console.log(t),n.addEventListener("gattserverdisconnected",this.onDisconnect.bind(this))}static async connect(e,t){let n=await e.getPrimaryService(t2.ganTimerService);console.log("Service:",n);let i=await n.getCharacteristic(t2.timeCharacteristic);return console.log("Characteristic:",i),new Cc(n,e,t,i)}disconnect(){this.server.disconnect()}async poll(){if(!this.polling)return;let e=await this.getTimeCharacteristic(),t={currentTime:this.decodeTimeMs(e.slice(0,4)),latestTimes:[this.decodeTimeMs(e.slice(4,8)),this.decodeTimeMs(e.slice(8,12)),this.decodeTimeMs(e.slice(12,16))]};t.currentTime===0&&this.previousDetail&&this.previousDetail.currentTime!==0&&this.dispatchEvent(new CustomEvent("reset")),t.currentTime!==0&&this.previousDetail&&(this.previousDetail.currentTime===0&&this.dispatchEvent(new CustomEvent("start")),t.currentTime!==this.previousDetail.currentTime&&(this.dispatchEvent(new CustomEvent("update",{detail:t})),t.currentTime===t.latestTimes[0]&&t.latestTimes[1]===this.previousDetail.latestTimes[0]&&t.latestTimes[2]===this.previousDetail.latestTimes[1]&&this.dispatchEvent(new CustomEvent("stop",{detail:t})))),this.previousDetail=t,this.poll()}onDisconnect(){this.dispatchEvent(new CustomEvent("disconnect"))}async getTimeCharacteristic(){return new Uint8Array((await this.timeCharacteristic.readValue()).buffer)}async getTime(){let e=await this.getTimeCharacteristic();return this.decodeTimeMs(e.slice(0,4))}decodeTimeMs(e){return(e[0]*60+e[1])*1e3+e[2]+e[3]*256}startPolling(){this.polling=!0,this.poll()}stopPolling(){this.polling=!1}},IL={connect:Cc.connect.bind(Cc),prefixes:["GAN"],filters:[{namePrefix:"GAN"}],optionalServices:[t2.ganTimerService]};var dC=[IL];async function UL(r){return El(dC,r)}Ht();var i2={};_t(i2,{countAnimatedLeaves:()=>id,countMoves:()=>Bs});Oe();var NL=class extends Cn{constructor(e){super();this.metric=e}traverseAlg(e){let t=0;for(let n of e.units())t+=this.traverseUnit(n);return t}traverseGrouping(e){let t=e.alg;return this.traverseAlg(t)*Math.abs(e.amount)}traverseMove(e){return this.metric(e)}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return 0}traverseNewline(e){return 0}traverseLineComment(e){return 0}};function mC(r){return"A"<=r&&r<="Z"}function gC(r){let e=r.family;return mC(e[0])&&e[e.length-1]==="v"||e==="x"||e==="y"||e==="z"||e==="T"?0:1}var OL=new NL(gC),Bs=OL.traverseAlg.bind(OL);Oe();var GL=class extends Cn{traverseAlg(e){let t=0;for(let n of e.units())t+=this.traverseUnit(n);return t}traverseGrouping(e){return this.traverseAlg(e.alg)*Math.abs(e.amount)}traverseMove(e){return 1}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return 1}traverseNewline(e){return 0}traverseLineComment(e){return 0}},WL=new GL,id=WL.traverseAlg.bind(WL);$h();mf();qn();var b2={};_t(b2,{randomScrambleForEvent:()=>sd});var w2={};_t(w2,{experimentalRandomScrambleForEvent:()=>sd,experimentalSolve2x2x2:()=>mA,experimentalSolve3x3x3IgnoringCenters:()=>dA,random333State:()=>x2,setDebug:()=>xA,solveMegaminx:()=>vA,solvePyraminx:()=>yA,solveSkewb:()=>gA});Oe();var yC=null;async function VL(){if(typeof crypto!="undefined"&&typeof crypto.getRandomValues!="undefined")return crypto.getRandomValues.bind(crypto);{let e=await(yC??(yC=import("crypto")));return t=>{if(!(t instanceof Uint32Array))throw new Error("The getRandomValues() shim only takes unsigned 32-bit int arrays");let n=e.randomBytes(t.length*4),i=[];for(let o=0;o<t.length;o++)i.push((n[o*4+0]<<24)+(n[o*4+1]<<16)+(n[o*4+2]<<8)+(n[o*4+3]<<0));t.set(i)}}}var HL=9007199254740992,vC=2097152,xC=2048;function wC(r){let e=new Uint32Array(2);r(e);let t=e[0],n=e[1];return Math.floor(t*vC)+Math.floor(n/xC)}function bC(r){if(typeof r!="number"||r<0||Math.floor(r)!==r)throw new Error("randomInt.below() not called with a positive integer value.");if(r>HL)throw new Error(`Called randomInt.below() with max == ${r}, which is larger than Javascript can handle with integer precision.`)}async function Er(){let r=await VL(),e=t=>{bC(t);let n=wC(r),i=Math.floor(HL/t)*t;return n<i?n%t:e(t)};return e}async function rd(){let r=await Er();return e=>e[r(e.length)]}var mN=Er();var qL=["UR","DR","DL","UL"],jL=["U","R","D","L","ALL"],SC=qL.concat(jL),LC=Er();async function r2(){let r=await LC,e=0;async function t(o){let s=o(12);return s!==0&&e++,s<=6?`${s}+`:`${12-s}-`}let n=[];async function i(o){for(let s of o)n.push(`${s}${await t(r)}`)}if(await i(SC),n.push("y2"),await i(jL),e<2)return r2();for(let o of qL)r(2)===0&&n.push(o);return n.join(" ")}var AC=Er(),QL=["++","--"];async function YL(){let r=await AC;function e(){return`R${QL[r(2)]} D${QL[r(2)]}`}function t(){return`U${["","'"][r(2)]}`}function n(){let o=[];for(let s=0;s<5;s++)o.push(e());return o.push(t()),o.join(" ")}let i=[];for(let o=0;o<6;o++)i.push(n());return i.join(`
|
|
7069
|
+
`)}var XL=Symbol("Comlink.proxy"),DC=Symbol("Comlink.endpoint"),EC=Symbol("Comlink.releaseProxy"),o2=Symbol("Comlink.thrown"),KL=r=>typeof r=="object"&&r!==null||typeof r=="function",MC={canHandle:r=>KL(r)&&r[XL],serialize(r){let{port1:e,port2:t}=new MessageChannel;return JL(r,e),[t,[t]]},deserialize(r){return r.start(),Pc(r)}},RC={canHandle:r=>KL(r)&&o2 in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},ZL=new Map([["proxy",MC],["throw",RC]]);function JL(r,e=self){e.addEventListener("message",function t(n){if(!n||!n.data)return;let{id:i,type:o,path:s}=Object.assign({path:[]},n.data),a=(n.data.argumentList||[]).map(zs),l;try{let u=s.slice(0,-1).reduce((f,h)=>f[h],r),c=s.reduce((f,h)=>f[h],r);switch(o){case"GET":l=c;break;case"SET":u[s.slice(-1)[0]]=zs(n.data.value),l=!0;break;case"APPLY":l=c.apply(u,a);break;case"CONSTRUCT":{let f=new c(...a);l=CC(f)}break;case"ENDPOINT":{let{port1:f,port2:h}=new MessageChannel;JL(r,h),l=_C(f,[f])}break;case"RELEASE":l=void 0;break;default:return}}catch(u){l={value:u,[o2]:0}}Promise.resolve(l).catch(u=>({value:u,[o2]:0})).then(u=>{let[c,f]=a2(u);e.postMessage(Object.assign(Object.assign({},c),{id:i}),f),o==="RELEASE"&&(e.removeEventListener("message",t),$L(e))})}),e.start&&e.start()}function TC(r){return r.constructor.name==="MessagePort"}function $L(r){TC(r)&&r.close()}function Pc(r,e){return s2(r,[],e)}function od(r){if(r)throw new Error("Proxy has been released and is not useable")}function s2(r,e=[],t=function(){}){let n=!1,i=new Proxy(t,{get(o,s){if(od(n),s===EC)return()=>Rl(r,{type:"RELEASE",path:e.map(a=>a.toString())}).then(()=>{$L(r),n=!0});if(s==="then"){if(e.length===0)return{then:()=>i};let a=Rl(r,{type:"GET",path:e.map(l=>l.toString())}).then(zs);return a.then.bind(a)}return s2(r,[...e,s])},set(o,s,a){od(n);let[l,u]=a2(a);return Rl(r,{type:"SET",path:[...e,s].map(c=>c.toString()),value:l},u).then(zs)},apply(o,s,a){od(n);let l=e[e.length-1];if(l===DC)return Rl(r,{type:"ENDPOINT"}).then(zs);if(l==="bind")return s2(r,e.slice(0,-1));let[u,c]=eA(a);return Rl(r,{type:"APPLY",path:e.map(f=>f.toString()),argumentList:u},c).then(zs)},construct(o,s){od(n);let[a,l]=eA(s);return Rl(r,{type:"CONSTRUCT",path:e.map(u=>u.toString()),argumentList:a},l).then(zs)}});return i}function FC(r){return Array.prototype.concat.apply([],r)}function eA(r){let e=r.map(a2);return[e.map(t=>t[0]),FC(e.map(t=>t[1]))]}var tA=new WeakMap;function _C(r,e){return tA.set(r,e),r}function CC(r){return Object.assign(r,{[XL]:!0})}function a2(r){for(let[e,t]of ZL)if(t.canHandle(r)){let[n,i]=t.serialize(r);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:r},tA.get(r)||[]]}function zs(r){switch(r.type){case"HANDLER":return ZL.get(r.name).deserialize(r.value);case"RAW":return r.value}}function Rl(r,e,t){return new Promise(n=>{let i=PC();r.addEventListener("message",function o(s){!s.data||!s.data.id||s.data.id!==i||(r.removeEventListener("message",o),n(s.data))}),r.start&&r.start(),r.postMessage(Object.assign({id:i},e),t)})}function PC(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var lA=typeof globalThis.Worker=="undefined"&&typeof globalThis.WorkerNavigator=="undefined";async function uA(){return lA?await(await Promise.resolve().then(()=>(u2(),l2))).NodeWorkerWrapper():globalThis.Worker}async function cA(r,e){let t;if(lA){let n=await(await Promise.resolve().then(()=>(u2(),l2))).NodeWorkerStringWrapper();return new n(r)}else{let n=new Blob([r],{type:"application/javascript"}),i=URL.createObjectURL(n);t=new globalThis.Worker(i,{type:e?e.type:void 0})}return t}var WC={},NC=!1;async function OC(){return new Promise(async(r,e)=>{setTimeout(()=>{e()},1e3);let t=await uA(),n=new t(new URL("./esm-test-worker.js",WC.url));await Pc(n).test("to worker")==="from worker"?r():e()})}async function GC(){try{await OC(),console.info("Successful relative URL worker instantiation.")}catch(r){console.warn("WARNING: Could not instantiate and communicate with a relative URL worker. This means that your app may have issues with `cubing/solve` in the future.")}}async function pA(){let{workerSource:r}=await Promise.resolve().then(()=>(fA(),hA)),e=await cA(r);return NC&&GC(),Pc(e)}var VC=null;async function Is(){return await(VC??(VC=pA()))}async function sd(r){switch(r){case"clock":return re.fromString(await r2());case"minx":return re.fromString(await YL())}let t=await HC(r);return re.fromString(t)}async function HC(r){return(await Is()).randomScrambleStringForEvent(r)}async function dA(r){let e=await Is();return re.fromString(await e.solve333ToString(r))}async function mA(r){let e=await Is();return re.fromString(await e.solve222ToString(r))}async function gA(r){let e=await Is();return re.fromString(await e.solveSkewbToString(r))}async function yA(r){let e=await Is();return re.fromString(await e.solvePyraminxToString(r))}async function vA(r){let e=await Is();return re.fromString(await e.solveMegaminxToString(r))}function xA(r){let{logPerf:e}=r;typeof e!="undefined"&&Is().then(t=>t.setDebugMeasurePerf(e))}Oe();Ht();qn();Oe();var bt={3:1},zi=4194303,Us=1048575,qC=524288;var wn={11:1,3:1},sn={17:1,3:1},jC=14540032;var wt={10:1,3:1},et,ad={};function wA(){}function QC(r){function e(){}return e.prototype=r||{},new e}function YC(r){return r instanceof Array?r[0]:null}function kc(r,e,t){var n=ad,i=XC,o=YC,s=n[r],a=o(s);s&&!a?et=s:(et=n[r]=e?i(e):{},et.castableTypeMap$=t,et.constructor=et,!e&&(et.typeMarker$=wA));for(var l=3;l<arguments.length;++l)arguments[l].prototype=et;a&&(et.___clazz$=a)}function XC(r){var e=ad;return QC(e[r])}function KC(){}kc(1,null,{},KC);function ZC(r){return r<<24>>24}function c2(){this.typeName=null,this.simpleName=null,this.packageName=null,this.compoundName=null,this.canonicalName=null,this.typeId=null,this.arrayLiterals=null}function h2(r,e){var t;return t=new c2,t.packageName=r,t.compoundName=e,t}function Eo(r,e,t){var n;return n=h2(r,e),e7(t,n),n}function JC(r,e){var t;return t=h2(r,e),t.modifiers=2,t}function ld(r,e){var t;return t=h2("",r),t.typeId=e,t.modifiers=1,t}function bA(r,e){var t=r.arrayLiterals=r.arrayLiterals||[];return t[e]||(t[e]=r.createClassLiteralForArray(e))}function $C(r){if(r.isPrimitive())return null;var e=r.typeId,t=ad[e];return t}function e7(r,e){if(!!r){e.typeId=r;var t=$C(e);if(!t){ad[r]=[e];return}t.___clazz$=e}}kc(79,1,{},c2);et.createClassLiteralForArray=function(e){var t;return t=new c2,t.modifiers=4,e>1?t.componentType=bA(this,e-1):t.componentType=this,t};et.isPrimitive=function(){return(this.modifiers&1)!=0};function st(r,e){return bA(r,e)}function pt(r,e,t,n,i,o){var s;return s=LA(i,n),at(st(r,o),e,t,i,s),s}function Kn(r,e,t,n,i,o){return SA(r,e,t,n,i,0,o)}function SA(r,e,t,n,i,o,s){var a,l,u,c,f;if(c=i[o],u=o==s-1,a=u?n:0,f=LA(a,c),at(st(r,s-o),e[o],t[o],a,f),!u)for(++o,l=0;l<c;++l)f[l]=SA(r,e,t,n,i,o,s);return f}function at(r,e,t,n,i){return i.___clazz$=r,i.castableTypeMap$=e,i.typeMarker$=wA,i.__elementTypeId$=t,i.__elementTypeCategory$=n,i}function LA(r,e){var t=new Array(e),n;switch(r){case 6:n={l:0,m:0,h:0};break;case 7:n=0;break;case 8:n=!1;break;default:return t}for(var i=0;i<e;++i)t[i]=n;return t}function AA(r){var e,t,n;return e=r&zi,t=r>>22&zi,n=r<0?Us:0,t7(e,t,n)}function t7(r,e,t){return{l:r,m:e,h:t}}function Bc(r,e){return{l:r.l&e.l,m:r.m&e.m,h:r.h&e.h}}function n7(r){var e,t;return r>-129&&r<128?(e=r+128,fd==null&&(fd=pt(W7,bt,293,256,0,1)),t=fd[e],!t&&(t=fd[e]=AA(r)),t):AA(r)}function f2(r,e){return{l:r.l|e.l,m:r.m|e.m,h:r.h|e.h}}function ud(r,e){var t,n,i;return e&=63,e<22?(t=r.l<<e,n=r.m<<e|r.l>>22-e,i=r.h<<e|r.m>>22-e):e<44?(t=0,n=r.l<<e-22,i=r.m<<e-22|r.l>>44-e):(t=0,n=0,i=r.l<<e-44),{l:t&zi,m:n&zi,h:i&Us}}function cd(r,e){var t,n,i,o,s;return e&=63,t=r.h,n=(t&qC)!=0,n&&(t|=-1048576),e<22?(s=t>>e,o=r.m>>e|t<<22-e,i=r.l>>e|r.m<<22-e):e<44?(s=n?Us:0,o=t>>e-22,i=r.m>>e-22|t<<44-e):(s=n?Us:0,o=n?zi:0,i=t>>e-44),{l:i&zi,m:o&zi,h:s&Us}}function DA(r,e){var t,n,i;return t=r.l-e.l,n=r.m-e.m+(t>>22),i=r.h-e.h+(n>>22),{l:t&zi,m:n&zi,h:i&Us}}function hd(r){return r.l|r.m<<22}var fd;var i7=Eo("java.lang","String",2);function pd(r,e){var t;if(r===e)return!0;if(r.length!=e.length)return!1;for(t=0;t<r.length;++t)if(r[t]!=e[t])return!1;return!0}var EA=!1;function r7(){EA||(EA=!0,y7=Kn(Sn,[bt,wn],[11,0],7,[495,18],2),d7=Kn(Sn,[bt,wn],[11,0],7,[324,18],2),u7=Kn(Sn,[bt,wn],[11,0],7,[336,18],2),m7=Kn(Sn,[bt,wn],[11,0],7,[495,8],2),v7=pt(an,sn,0,20048,7,1),g7=pt(an,sn,0,20791,7,1),p7=pt(an,sn,0,82945,7,1),s7=Kn(Sn,[bt,wn],[11,0],7,[2768,10],2),l7=Kn(Sn,[bt,wn],[11,0],7,[2768,10],2),f7=Kn(Sn,[bt,wn],[11,0],7,[24,10],2),h7=Kn(Sn,[bt,wn],[11,0],7,[24,16],2),o7=Kn(Sn,[bt,wn],[11,0],7,[140,16],2),c7=pt(an,sn,0,8305,7,1),a7=pt(an,sn,0,48441,7,1))}function zc(){r7()}kc(31,1,{31:1},zc);et.flip=0;et.flipc=0;et.fsym=0;et.prun=0;et.slice_0=0;et.tsym=0;et.twist=0;et.twistc=0;var o7;var s7,a7,l7,u7,c7,h7,f7,p7,d7,m7,g7,y7,v7;var dd=Eo("org.cubing.min2phase.client","CoordCube",31),MA=!1;function Tl(){MA||(MA=!0,Mr=pt(Ic,bt,7,16,0,1),bn=pt(Ic,bt,7,18,0,1),zA=pt(V7,bt,0,18,6,1),BA=pt(an,sn,0,48,7,1),kA=Kn(an,[bt,sn],[17,0],7,[16,16],2),Ns=Kn(an,[bt,sn],[17,0],7,[16,16],2),gd=Kn(an,[bt,sn],[17,0],7,[16,18],2),CA=pt(an,sn,0,144,7,1),PA=Kn(an,[bt,sn],[17,0],7,[16,18],2),T7=pt(Sn,wn,0,336,7,1),B7=pt(Sn,wn,0,324,7,1),M7=pt(Sn,wn,0,2768,7,1),C7=pt(dt,wt,0,2768,7,1),P7=pt(Sn,wn,0,2768,7,1),_7=pt(dt,wt,0,24,7,1),R7=pt(Sn,wn,0,2048,7,1),k7=pt(Sn,wn,0,2187,7,1),m2=pt(Sn,wn,0,40320,7,1),F7=pt(Sn,wn,0,2688,7,1),g2=new Ii(2531,1373,67026819,1367),y2=new Ii(2089,1906,322752913,2040),IA=at(st(dt,2),bt,10,0,[at(st(dt,1),wt,0,7,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]),at(st(dt,1),wt,0,7,[6,7,8,0,1,2,3,4,5,15,16,17,9,10,11,12,13,14]),at(st(dt,1),wt,0,7,[3,4,5,6,7,8,0,1,2,12,13,14,15,16,17,9,10,11]),at(st(dt,1),wt,0,7,[2,1,0,5,4,3,8,7,6,11,10,9,14,13,12,17,16,15]),at(st(dt,1),wt,0,7,[8,7,6,2,1,0,5,4,3,17,16,15,11,10,9,14,13,12]),at(st(dt,1),wt,0,7,[5,4,3,8,7,6,2,1,0,14,13,12,17,16,15,11,10,9])]),D7(),E7())}function p2(r){r.ca=at(st(dt,1),wt,0,7,[0,1,2,3,4,5,6,7]),r.ea=at(st(dt,1),wt,0,7,[0,2,4,6,8,10,12,14,16,18,20,22])}function x7(r){!r.temps&&(r.temps=new tr),d2(y2,r,r.temps),d2(r.temps,g2,r),Fl(y2,r,r.temps),Fl(r.temps,g2,r)}function RA(r,e){var t,n;for(n=0;n<8;n++)r.ca[n]=e.ca[n];for(t=0;t<12;t++)r.ea[t]=e.ea[t]}function w7(r){var e,t;for(!r.temps&&(r.temps=new tr),t=0;t<12;t++)r.temps.ea[r.ea[t]>>1]=(t<<1|r.ea[t]&1)<<24>>24;for(e=0;e<8;e++)r.temps.ca[r.ca[e]&7]=(e|32>>(r.ca[e]>>3)&24)<<24>>24;RA(r,r.temps)}function b7(r){var e,t,n,i,o,s,a;for(e=new FA(r),i=new tr,t=_A(m2[NA(e.ca,8,!1)])>>4,s={l:0,m:0,h:0},a=0;a<6;a++){if(n=_A(m2[NA(e.ca,8,!1)])>>4,t==n)for(o=0;o<16;o++)TA(e,Ns[0][o],i),pd(i.ca,r.ca)&&(A7(e,Ns[0][o],i),pd(i.ea,r.ea)&&(s=f2(s,ud({l:1,m:0,h:0},(a<<4|o)<48?a<<4|o:48))));x7(e),a%3==2&&w7(e)}return s}function S7(r,e){var t,n,i;for(n=0,t=10;t>=0;--t,e>>=1)n^=i=e&1,r.ea[t]=(r.ea[t]&-2|i)<<24>>24;r.ea[11]=(r.ea[11]&-2|n)<<24>>24}function L7(r,e){var t,n,i;for(n=15,t=6;t>=0;--t,e=~~(e/3))n-=i=e%3,r.ca[t]=(r.ca[t]&7|i<<3)<<24>>24;r.ca[7]=(r.ca[7]&7|n%3<<3)<<24>>24}function TA(r,e,t){Tl();var n,i,o,s,a,l;for(l=Mr[Ns[0][e]],a=Mr[e],n=0;n<8;n++)o=l.ca[r.ca[a.ca[n]&7]&7]>>3,s=r.ca[a.ca[n]&7]>>3,i=o<3?s:(3-s)%3,t.ca[n]=(l.ca[r.ca[a.ca[n]&7]&7]&7|i<<3)<<24>>24}function d2(r,e,t){Tl();var n,i,o;for(n=0;n<8;n++)i=r.ca[e.ca[n]&7]>>3,o=e.ca[n]>>3,t.ca[n]=(r.ca[e.ca[n]&7]&7|(i+o)%3<<3)<<24>>24}function md(r,e,t){var n,i,o,s;for(n=0;n<8;n++)o=r.ca[e.ca[n]&7]>>3,s=e.ca[n]>>3,i=o+(o<3?s:6-s),i=i%3+(o<3==s<3?0:3),t.ca[n]=(r.ca[e.ca[n]&7]&7|i<<3)<<24>>24}function tr(){Tl(),p2(this)}function Ii(r,e,t,n){p2(this),OA(this.ca,r,8,!1),L7(this,e),OA(this.ea,t,12,!0),S7(this,n)}function FA(r){p2(this),RA(this,r)}function _A(r){return Tl(),r^jC>>((r&15)<<1)&3}function A7(r,e,t){Tl();var n,i,o;for(o=Mr[Ns[0][e]],i=Mr[e],n=0;n<12;n++)t.ea[n]=(o.ea[r.ea[i.ea[n]>>1]>>1]^r.ea[i.ea[n]>>1]&1^i.ea[n]&1)<<24>>24}function Fl(r,e,t){Tl();var n;for(n=0;n<12;n++)t.ea[n]=(r.ea[e.ea[n]>>1]^e.ea[n]&1)<<24>>24}function D7(){var r,e;for(bn[0]=new Ii(15120,0,119750400,0),bn[3]=new Ii(21021,1494,323403417,0),bn[6]=new Ii(8064,1236,29441808,550),bn[9]=new Ii(9,0,5880,0),bn[12]=new Ii(1230,412,2949660,0),bn[15]=new Ii(224,137,328552,137),r=0;r<18;r+=3)for(e=0;e<2;e++)bn[r+e+1]=new tr,Fl(bn[r+e],bn[r],bn[r+e+1]),d2(bn[r+e],bn[r],bn[r+e+1])}function E7(){var r,e,t,n,i,o,s,a,l,u,c,f,h,p,d,g;for(r=new tr,e=new tr,t=new Ii(28783,0,259268407,0),g=new Ii(15138,0,119765538,7),f=new Ii(5167,0,83473207,0),i=0;i<8;i++)f.ca[i]=ZC(f.ca[i]|24);for(o=0;o<16;o++)Mr[o]=new FA(r),md(r,g,e),Fl(r,g,e),d=e,e=r,r=d,o%4==3&&(md(d,f,e),Fl(d,f,e),d=e,e=r,r=d),o%8==7&&(md(d,t,e),Fl(d,t,e),d=e,e=r,r=d);for(s=0;s<16;s++)for(l=0;l<16;l++)for(md(Mr[s],Mr[l],r),c=0;c<16;c++)if(pd(Mr[c].ca,r.ca)){kA[s][l]=c,Ns[c][l]=s;break}for(u=0;u<18;u++)for(p=0;p<16;p++){for(TA(bn[u],Ns[0][p],r),h=0;h<18;h++)if(pd(bn[h].ca,r.ca)){gd[p][u]=h,PA[p][(v2(),vd)[u]]=vd[h];break}p%2==0&&(CA[u<<3|p>>1]=gd[p][u])}for(n=0;n<18;n++)for(zA[n]=b7(bn[n]),a=n,p=0;p<48;p++)gd[p%16][a]<n&&(BA[p]|=1<<n),p%16==15&&(a=IA[2][a])}var Mr,m2,M7,R7,T7,F7,_7,C7,P7,CA,gd,PA,kA,Ns;var k7,B7,BA,bn,zA,g2,y2,IA,Ic=Eo("org.cubing.min2phase.client","CubieCube",7);function z7(){var r,e,t;for(this.move=pt(an,sn,0,31,7,1),this.nodeUD=pt(dd,bt,31,21,0,1),this.nodeRL=pt(dd,bt,31,21,0,1),this.nodeFB=pt(dd,bt,31,21,0,1),this.cc=new tr,this.urfCubieCube=pt(Ic,bt,7,6,0,1),this.urfCoordCube=pt(dd,bt,31,6,0,1),this.phase1Cubie=pt(Ic,bt,7,21,0,1),this.preMoveCubes=pt(Ic,bt,7,21,0,1),this.preMoves=pt(an,sn,0,20,7,1),e=0;e<21;e++)this.nodeUD[e]=new zc,this.nodeRL[e]=new zc,this.nodeFB[e]=new zc,this.phase1Cubie[e]=new tr;for(t=0;t<6;t++)this.urfCubieCube[t]=new tr,this.urfCoordCube[t]=new zc;for(r=0;r<20;r++)this.preMoveCubes[r+1]=new tr}kc(72,1,{},z7);et.allowShorter=!1;et.conjMask=0;et.depth1=0;et.isRec=!1;et.length1=0;et.maxDep2=0;et.maxPreMoves=0;et.preMoveLen=0;et.probe={l:0,m:0,h:0};et.probeMax={l:0,m:0,h:0};et.probeMin={l:0,m:0,h:0};et.selfSym={l:0,m:0,h:0};et.solLen=0;et.urfIdx=0;et.valid1=0;et.verbose=0;var UA=!1;function v2(){if(!UA){UA=!0;var r,e,t,n,i,o;for(U7=at(st(dt,2),bt,10,0,[at(st(dt,1),wt,0,7,[8,9,20]),at(st(dt,1),wt,0,7,[6,18,38]),at(st(dt,1),wt,0,7,[0,36,47]),at(st(dt,1),wt,0,7,[2,45,11]),at(st(dt,1),wt,0,7,[29,26,15]),at(st(dt,1),wt,0,7,[27,44,24]),at(st(dt,1),wt,0,7,[33,53,42]),at(st(dt,1),wt,0,7,[35,17,51])]),N7=at(st(dt,2),bt,10,0,[at(st(dt,1),wt,0,7,[5,10]),at(st(dt,1),wt,0,7,[7,19]),at(st(dt,1),wt,0,7,[3,37]),at(st(dt,1),wt,0,7,[1,46]),at(st(dt,1),wt,0,7,[32,16]),at(st(dt,1),wt,0,7,[28,25]),at(st(dt,1),wt,0,7,[30,43]),at(st(dt,1),wt,0,7,[34,52]),at(st(dt,1),wt,0,7,[23,12]),at(st(dt,1),wt,0,7,[21,41]),at(st(dt,1),wt,0,7,[50,39]),at(st(dt,1),wt,0,7,[48,14])]),_l=Kn(an,[bt,sn],[17,0],7,[13,13],2),O7=at(st(i7,1),bt,2,4,["U ","U2","U'","R ","R2","R'","F ","F2","F'","D ","D2","D'","L ","L2","L'","B ","B2","B'"]),xd=at(st(an,1),sn,0,7,[0,1,2,4,7,9,10,11,13,16,3,5,6,8,12,14,15,17]),vd=pt(an,sn,0,18,7,1),yd=pt(an,sn,0,11,7,1),e=0;e<18;e++)vd[xd[e]]=e;for(t=0;t<10;t++)for(n=~~(xd[t]/3),yd[t]=0,i=0;i<10;i++)o=~~(xd[i]/3),yd[t]|=(n==o||n%3==o%3&&n>=o?1:0)<<i;for(yd[10]=0,r=0;r<13;r++)for(_l[r][0]=_l[r][r]=1,i=1;i<r;i++)_l[r][i]=_l[r-1][i-1]+_l[r-1][i]}}function NA(r,e,t){v2();var n,i,o,s;for(i=0,s={l:1323536,m:2777561,h:1043915},n=0;n<e-1;n++)o=I7(r[n],t)<<2,i=(e-n)*i+hd(Bc(cd(s,o),{l:15,m:0,h:0})),s=DA(s,ud({l:1118480,m:279620,h:69905},o));return i}function I7(r,e){return e?r>>1:r&7}function OA(r,e,t,n){v2();var i,o,s,a,l,u;for(u={l:1323536,m:2777561,h:1043915},i={l:0,m:0,h:0},a=2;a<=t;a++)i=f2(ud(i,4),n7(e%a)),e=~~(e/a);for(o=0;o<t-1;o++)l=(hd(i)&15)<<2,i=cd(i,4),r[o]=GA(r[o],hd(Bc(cd(u,l),{l:15,m:0,h:0})),n),s=DA(ud({l:1,m:0,h:0},l),{l:1,m:0,h:0}),u=f2(Bc(u,s),Bc(cd(u,4),{l:~s.l&zi,m:~s.m&zi,h:~s.h&Us}));r[t-1]=GA(r[t-1],hd(Bc(u,{l:15,m:0,h:0})),n)}function GA(r,e,t){return(t?e<<1|r&1:e|r&-8)<<24>>24}var _l,yd,U7,N7,O7,vd,xd;function G7(){this.moves=pt(an,sn,0,31,7,1)}kc(150,1,{},G7);et.depth1=0;et.length_0=0;et.urfIdx=0;et.verbose=0;var an=ld("int","I");Eo("com.google.gwt.lang","CollapsedPropertyHolder",252);Eo("com.google.gwt.lang","JavaClassHierarchySetupUtil",254);var W7=Eo("com.google.gwt.lang","LongLibBase/LongEmul",null);Eo("com.google.gwt.lang","ModuleUtils",257);var dt=ld("byte","B"),V7=ld("long","J"),Sn=ld("char","C");Eo("com.google.gwt.user.client.rpc","XsrfToken",null),JC("java.util","Map/Entry");var NN="UF UR UB UL DF DR DB DL FR FL BR BL".split(" "),ON="UFR URB UBL ULF DRF DFL DLB DBR".split(" "),GN="U L F R B D".split(" ");Oe();Ht();function WA(r,e,t){for(let n in r.orbits)if(!Jr(r,n,e,t,{ignoreOrientation:n==="CENTERS"}))return!1;return!0}function VA(r,e){let t=new pn(r);if(WA(r,t.state,e))return!1;for(let n of"ULFRBD")for(let i=1;i<4;i++)if(t.reset(),t.applyMove(new E(n,i)),WA(r,t.state,e))return!1;return!0}var HA=[["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 x2(){let r=await Ot["3x3x3"].def(),e=new pn(r);for(let t of HA)e.applyAlg(re.fromString((await rd())(t)));return VA(r,e.state)?e.state:x2()}var hO=new re("R' U' F");var D2={};_t(D2,{TwizzleStreamServer:()=>A2,WebSocketProxyReceiver:()=>L2,WebSocketProxySender:()=>S2});var S2=class{constructor(e){this.websocket=new WebSocket(e),this.websocket.onopen=this.onopen.bind(this),this.websocket.onerror=this.onerror.bind(this),this.websocket.onmessage=this.onmessage.bind(this)}sendMoveEvent(e){this.sendProxyEvent({event:"move",data:e})}sendOrientationEvent(e){this.sendProxyEvent({event:"orientation",data:e})}sendResetEvent(){this.sendProxyEvent({event:"reset"})}sendProxyEvent(e){this.websocket.send(JSON.stringify(e))}onopen(){console.log("Sending socket is open!")}onerror(e){console.error("WebSocket sender error:",e)}onmessage(e){}},L2=class{constructor(e,t){if(!t){console.log("No socket origin specified. Will not attempt to connect.");return}this.websocket=new WebSocket(e),console.log(this.websocket),this.websocket.onopen=this.onopen.bind(this),this.websocket.onerror=this.onerror.bind(this),this.websocket.onmessage=this.onmessage.bind(this)}onopen(){console.log("Receiving socket is open!")}onerror(e){console.error("WebSocket receiver error:",e)}onmessage(e){this.onProxyEvent(JSON.parse(e.data))}};Oe();var qA=class extends EventTarget{constructor(e){super();this.socket=new WebSocket(e),this.socket.onmessage=this.onMessage.bind(this)}onMessage(e){try{let t=JSON.parse(e.data);if(t.event==="move"){let n=t.data.latestMove;if(n.type!=="blockMove")throw new Error("Invalid move!");this.dispatchEvent(new CustomEvent("move",{detail:{move:new E(new ze(n.family),n.amount)}}))}}catch(t){console.error("Could not handle message:",t)}}},A2=class{async streams(){return(await(await fetch("https://api.twizzle.net/v0/streams")).json()).streams}connect(e){return new qA(`wss://api.twizzle.net/v0/streams/${e}/socket`)}};var sv={};_t(sv,{Cube3D:()=>Ui,EXPERIMENTAL_PROP_NO_VALUE:()=>Br,KSolvePuzzle:()=>Tn,PG3D:()=>wi,SimpleAlgIndexer:()=>Xs,TimestampLocationType:()=>ti,TreeAlgIndexer:()=>ei,Twisty3DCanvas:()=>kr,TwistyAlgEditor:()=>Em,TwistyAlgViewer:()=>Am,TwistyAlgViewerV1:()=>Im,TwistyPlayer:()=>zo,TwistyPlayerV1:()=>Jl,experimentalForceNewRendererSharing:()=>ED,experimentalShowRenderStats:()=>yD});Oe();var tt;(function(n){n[n.Forwards=1]="Forwards",n[n.Paused=0]="Paused",n[n.Backwards=-1]="Backwards"})(tt||(tt={}));function Cl(r){return r}var kt;(function(t){t.Move="move",t.EntireTimeline="entire-timeline"})(kt||(kt={}));Rr();var wd,Uc,H7=class{constructor(){H(this,wd,0);H(this,Uc,0)}async queue(e){let t=++sa(this,wd)._,n=await e;return t>S(this,Uc)?($(this,Uc,t),{fresh:!0,result:n}):{fresh:!1}}};wd=new WeakMap,Uc=new WeakMap;var bd,Nc,Tr=class{constructor(){H(this,bd,0);H(this,Nc,0)}queue(e){return new Promise(async(t,n)=>{try{let i=++sa(this,bd)._,o=await e;i>S(this,Nc)&&($(this,Nc,i),t(o))}catch(i){n(i)}})}};bd=new WeakMap,Nc=new WeakMap;function Oc(r,e){if(r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}function E2(r,e,t){if(r===e)return!0;if(r.length!==e.length)return!1;for(let n=0;n<r.length;n++)if(!t(r[n],e[n]))return!1;return!0}function M2(r,e,t=0){return(r%e+e+t)%e-t}function R2(r,e,t){return M2(r-e,t-e)+e}var jA=class{constructor(e){this.model=e;this.catchingUp=!1;this.pendingFrame=!1;this.scheduler=new ln(this.animFrame.bind(this));this.catchUpMs=500;this.lastTimestamp=0}start(){this.catchingUp||(this.lastTimestamp=performance.now()),this.catchingUp=!0,this.pendingFrame=!0,this.scheduler.requestAnimFrame()}stop(){this.catchingUp=!1,this.scheduler.cancelAnimFrame()}animFrame(e){this.scheduler.requestAnimFrame();let t=(e-this.lastTimestamp)/this.catchUpMs;this.lastTimestamp=e,this.model.catchUpMoveProp.set((async()=>{let n=await this.model.catchUpMoveProp.get();if(n.move===null)return n;let i=n.amount+t;return i>=1?(this.pendingFrame=!0,this.stop(),this.model.timestampRequestProp.set("end"),{move:null,amount:0}):(this.pendingFrame=!1,{move:n.move,amount:i})})())}},Gc,QA,Sd,T2=class{constructor(e,t){this.delegate=t;H(this,Gc);this.playing=!1;this.direction=tt.Forwards;this.lastDatestamp=0;this.scheduler=new ln(this.animFrame.bind(this));H(this,Sd,new Tr);this.model=e,this.lastTimestampPromise=ye(this,Gc,QA).call(this),this.model.playingInfoProp.addFreshListener(this.onPlayingProp.bind(this)),this.catchUpHelper=new jA(this.model),this.model.catchUpMoveProp.addFreshListener(this.onCatchUpMoveProp.bind(this))}async onPlayingProp(e){e.playing!==this.playing&&(e.playing?this.play(e):this.pause())}async onCatchUpMoveProp(e){let t=e.move!==null;t!==this.catchUpHelper.catchingUp&&(t?this.catchUpHelper.start():this.catchUpHelper.stop()),this.scheduler.requestAnimFrame()}jumpToStart(e){this.model.timestampRequestProp.set("start"),this.pause(),e?.flash&&this.delegate.flash()}jumpToEnd(e){this.model.timestampRequestProp.set("end"),this.pause(),e?.flash&&this.delegate.flash()}playPause(){this.playing?this.pause():this.play()}async play(e){let t=e?.direction??tt.Forwards,n=await this.model.coarseTimelineInfoProp.get();(e?.autoSkipToOtherEndIfStartingAtBoundary??!0)&&(t===tt.Forwards&&n.atEnd&&(this.model.timestampRequestProp.set("start"),this.delegate.flash()),t===tt.Backwards&&n.atStart&&(this.model.timestampRequestProp.set("end"),this.delegate.flash())),this.model.playingInfoProp.set({playing:!0,direction:t,untilBoundary:e?.untilBoundary??kt.EntireTimeline,loop:e?.loop??!1}),this.playing=!0,this.lastDatestamp=performance.now(),this.lastTimestampPromise=ye(this,Gc,QA).call(this),this.scheduler.requestAnimFrame()}pause(){this.playing=!1,this.scheduler.cancelAnimFrame(),this.model.playingInfoProp.set({playing:!1,untilBoundary:kt.EntireTimeline})}async animFrame(e){this.playing&&this.scheduler.requestAnimFrame();let t=this.lastDatestamp,n=await S(this,Sd).queue(Promise.all([this.model.playingInfoProp.get(),this.lastTimestampPromise,this.model.timeRangeProp.get(),this.model.tempoScaleProp.get(),this.model.currentLeavesProp.get()])),[i,o,s,a,l]=n;if(!i.playing){this.playing=!1;return}let u=l.earliestEnd;(l.currentMoves.length===0||i.untilBoundary===kt.EntireTimeline)&&(u=s.end);let c=l.latestStart;(l.currentMoves.length===0||i.untilBoundary===kt.EntireTimeline)&&(c=s.start);let f=(e-t)*Cl(this.direction)*a;f=Math.max(f,1),f*=i.direction;let h=o+f,p=null;h>=u?i.loop?h=R2(h,s.start,s.end):(h===s.end?p="end":h=u,this.playing=!1,this.model.playingInfoProp.set({playing:!1})):h<=c&&(i.loop?h=R2(h,s.start,s.end):(h===s.start?p="start":h=c,this.playing=!1,this.model.playingInfoProp.set({playing:!1}))),this.lastDatestamp=e,this.lastTimestampPromise=Promise.resolve(h),this.model.timestampRequestProp.set(p??h)}};Gc=new WeakSet,QA=async function(){return(await this.model.detailedTimelineInfoProp.get()).timestamp},Sd=new WeakMap;var F2=class{constructor(e,t){this.model=e;this.animationController=new T2(e,t)}jumpToStart(e){this.animationController.jumpToStart(e)}jumpToEnd(e){this.animationController.jumpToEnd(e)}togglePlay(e){typeof e=="undefined"&&this.animationController.playPause(),e?this.animationController.play():this.animationController.pause()}async visitTwizzleLink(){let e=document.createElement("a");e.href=await this.model.twizzleLink(),e.target="_blank",e.click()}};Ro();un();Tt();var Ld=new Xt(`
|
|
7070
7070
|
:host {
|
|
7071
7071
|
width: 384px;
|
|
7072
7072
|
height: 256px;
|
|
@@ -7132,7 +7132,7 @@ twisty-scrubber {
|
|
|
7132
7132
|
.wrapper.error .error-elem {
|
|
7133
7133
|
display: grid;
|
|
7134
7134
|
}
|
|
7135
|
-
`);qc();var kl=class extends Promise{constructor(e){super(t=>{t()});this._executor=e}static from(e){return new kl(t=>{t(e())})}static resolve(e){return new kl(t=>{t(e)})}static reject(e){return new kl((t,n)=>{n(e)})}then(e,t){return this._promise=this._promise||new Promise(this._executor),this._promise.then(e,t)}catch(e){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(e)}};function Fd(r){return new kl(e=>{e(r())})}var T6=null;async function
|
|
7135
|
+
`);qc();var kl=class extends Promise{constructor(e){super(t=>{t()});this._executor=e}static from(e){return new kl(t=>{t(e())})}static resolve(e){return new kl(t=>{t(e)})}static reject(e){return new kl((t,n)=>{n(e)})}then(e,t){return this._promise=this._promise||new Promise(this._executor),this._promise.then(e,t)}catch(e){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(e)}};function Fd(r){return new kl(e=>{e(r())})}var T6=null;async function X2(){return T6??(T6=Promise.resolve().then(()=>(bD(),wD)))}var In=Fd(async()=>(await X2()).T3I);var SD=0,qs,Ol,Nd,F6,js,Od,_6,Gl,K2=class{constructor(){H(this,Nd);H(this,Od);H(this,qs,new Set);this.lastSourceGeneration=0;H(this,Ol,new Set);H(this,js,!1);H(this,Gl,new Map)}canReuse(e,t){return e===t||this.canReuseValue(e,t)}canReuseValue(e,t){return!1}debugGetChildren(){return Array.from(S(this,qs).values())}addChild(e){S(this,qs).add(e)}removeChild(e){S(this,qs).delete(e)}markStale(e){if(e.detail.generation!==SD)throw new Error("A TwistyProp was marked stale too late!");if(this.lastSourceGeneration!==e.detail.generation){this.lastSourceGeneration=e.detail.generation;for(let t of S(this,qs))t.markStale(e);ye(this,Nd,F6).call(this)}}addRawListener(e,t){S(this,Ol).add(e),t?.initial&&e()}removeRawListener(e){S(this,Ol).delete(e)}addFreshListener(e){let t=new Tr,n=null,i=async()=>{let o=await t.queue(this.get());n!==null&&this.canReuse(n,o)||(n=o,e(o))};S(this,Gl).set(e,i),this.addRawListener(i,{initial:!0})}removeFreshListener(e){this.removeRawListener(S(this,Gl).get(e)),S(this,Gl).delete(e)}};qs=new WeakMap,Ol=new WeakMap,Nd=new WeakSet,F6=function(){S(this,js)||($(this,js,!0),setTimeout(()=>ye(this,Od,_6).call(this),0))},js=new WeakMap,Od=new WeakSet,_6=function(){if(!S(this,js))throw new Error("Invalid dispatch state!");for(let e of S(this,Ol))e();$(this,js,!1)},Gl=new WeakMap;var ir,$n=class extends K2{constructor(e){super();H(this,ir,void 0);$(this,ir,Fd(()=>this.getDefaultValue())),e&&$(this,ir,this.deriveFromPromiseOrValue(e,S(this,ir)))}set(e){$(this,ir,this.deriveFromPromiseOrValue(e,S(this,ir)));let t={sourceProp:this,value:S(this,ir),generation:++SD};this.markStale(new CustomEvent("stale",{detail:t}))}async get(){return S(this,ir)}async deriveFromPromiseOrValue(e,t){return this.derive(await e,t)}};ir=new WeakMap;var mt=class extends $n{derive(e){return e}},Br=Symbol("no value"),Po,nh,Wl,Gd,C6,Wd,P6,He=class extends K2{constructor(e,t){super();this.userVisibleErrorTracker=t;H(this,Gd);H(this,Wd);H(this,Po,void 0);H(this,nh,null);H(this,Wl,null);$(this,Po,e);for(let n of Object.values(e))n.addChild(this)}async get(){let e=this.lastSourceGeneration;if(S(this,Wl)?.generation===e)return S(this,Wl).output;let t={generation:e,output:ye(this,Wd,P6).call(this,ye(this,Gd,C6).call(this),e,S(this,nh))};return $(this,Wl,t),this.userVisibleErrorTracker?.reset(),t.output}};Po=new WeakMap,nh=new WeakMap,Wl=new WeakMap,Gd=new WeakSet,C6=async function(){let e={};for(let[n,i]of Object.entries(S(this,Po)))e[n]=i.get();let t={};for(let n in S(this,Po))t[n]=await e[n];return t},Wd=new WeakSet,P6=async function(e,t,n=null){let i=await e,o=a=>($(this,nh,{inputs:i,output:Promise.resolve(a),generation:t}),a);if(!n)return o(await this.derive(i));let s=n.inputs;for(let a in S(this,Po))if(!S(this,Po)[a].canReuse(i[a],s[a]))return o(await this.derive(i));return n.output};var Vl,Ni=class{constructor(){H(this,Vl,[])}addListener(e,t){let n=!1,i=o=>{n||t(o)};e.addFreshListener(i),S(this,Vl).push(()=>{e.removeFreshListener(i),n=!0})}addMultiListener(e,t){let n=!1,i=async o=>{if(n)return;let s=e.map(l=>l.get()),a=await Promise.all(s);t(a)};for(let o of e)o.addFreshListener(i);S(this,Vl).push(()=>{for(let o of e)o.removeFreshListener(i);n=!0})}disconnect(){for(let e of S(this,Vl))e()}};Vl=new WeakMap;Tt();un();Md();Ht();Rr();Tt();un();Tt();var Vd=new Xt(`
|
|
7136
7136
|
:host {
|
|
7137
7137
|
width: 384px;
|
|
7138
7138
|
height: 256px;
|
|
@@ -7154,7 +7154,7 @@ svg {
|
|
|
7154
7154
|
display: grid;
|
|
7155
7155
|
min-height: 0;
|
|
7156
7156
|
}
|
|
7157
|
-
`);var Hl,ql,Hd=class extends rt{constructor(e,t,n,i,o){super();this.model=e;this.svgSource=n;this.options=i;this.puzzleLoader=o;this.scheduler=new ln(this.render.bind(this));H(this,Hl,null);H(this,ql,new Ni);this.addCSS(Vd),this.definition=t,this.resetSVG(),S(this,ql).addListener(this.model.puzzleIDProp,s=>{o?.id!==s&&this.disconnect()}),S(this,ql).addListener(this.model.legacyPositionProp,this.onPositionChange.bind(this)),this.options?.experimentalStickering&&this.experimentalSetStickering(this.options.experimentalStickering)}disconnect(){S(this,ql).disconnect()}onPositionChange(e){try{if(e.movesInProgress.length>0){let t=e.movesInProgress[0].move,n=this.definition,i=t;e.movesInProgress[0].direction===tt.Backwards&&(i=t.invert());let o=gt(n,e.state,Ai(n,i));this.svg.draw(this.definition,e.state,o,e.movesInProgress[0].fraction)}else this.svg.draw(this.definition,e.state),$(this,Hl,e)}catch(t){console.warn("Bad position (this doesn't necessarily mean something is wrong). Pre-emptively disconnecting:",this.puzzleLoader?.id,t),this.disconnect()}}scheduleRender(){this.scheduler.requestAnimFrame()}experimentalSetStickering(e){(async()=>{if(!this.puzzleLoader?.appearance)return;let t=await this.puzzleLoader.appearance(e);this.resetSVG(t)})()}resetSVG(e){this.svg&&this.removeElement(this.svg.element),!!this.definition&&(this.svg=new Xo(this.definition,this.svgSource,e),this.addElement(this.svg.element),S(this,Hl)&&this.onPositionChange(S(this,Hl)))}render(){}};Hl=new WeakMap,ql=new WeakMap;Qe.define("twisty-2d-puzzle",Hd);var ih,qd,K2=class{constructor(e,t,n,i){this.model=e;this.schedulable=t;this.puzzleLoader=n;this.effectiveVisualization=i;H(this,ih,new Ni);H(this,qd,null);this.twisty2DPuzzle(),S(this,ih).addListener(this.model.stickeringProp,async o=>{(await this.twisty2DPuzzle()).experimentalSetStickering(o)})}disconnect(){S(this,ih).disconnect()}scheduleRender(){}async twisty2DPuzzle(){return S(this,qd)??$(this,qd,(async()=>{let e=this.effectiveVisualization==="experimental-2D-LL"?this.puzzleLoader.llSVG():this.puzzleLoader.svg();return new Hd(this.model,await this.puzzleLoader.def(),await e,{},this.puzzleLoader)})())}};ih=new WeakMap,qd=new WeakMap;var rh,Qd,ko,jd=class extends rt{constructor(e,t){super();this.model=e;this.effectiveVisualization=t;H(this,rh,new Ni);H(this,Qd,void 0);H(this,ko,null)}disconnect(){S(this,rh).disconnect()}async connectedCallback(){this.addCSS(Pl),this.model&&S(this,rh).addListener(this.model.puzzleLoaderProp,this.onPuzzleLoader.bind(this))}async scene(){return S(this,Qd)??$(this,Qd,(async()=>new(await In).Scene)())}scheduleRender(){S(this,ko)?.scheduleRender()}currentTwisty2DPuzzleWrapper(){return S(this,ko)}async setCurrentTwisty2DPuzzleWrapper(e){let t=S(this,ko);$(this,ko,e),t?.disconnect();let n=e.twisty2DPuzzle();this.contentWrapper.textContent="",this.addElement(await n)}async onPuzzleLoader(e){S(this,ko)?.disconnect();let t=new K2(this.model,this,e,this.effectiveVisualization);this.setCurrentTwisty2DPuzzleWrapper(t)}};rh=new WeakMap,Qd=new WeakMap,ko=new WeakMap;Qe.define("twisty-2d-scene-wrapper",jd);Ro();Ft();un();Md();qn();var zr,Yd,oh=class{constructor(e,t,n,i){this.model=e;this.schedulable=t;this.puzzleLoader=n;this.visualizationStrategy=i;H(this,zr,new Ni);H(this,Yd,null);this.twisty3DPuzzle(),S(this,zr).addListener(this.model.puzzleLoaderProp,o=>{this.puzzleLoader.id!==o.id&&this.disconnect()}),S(this,zr).addListener(this.model.legacyPositionProp,async o=>{try{(await this.twisty3DPuzzle()).onPositionChange(o),this.scheduleRender()}catch(s){this.disconnect()}}),S(this,zr).addListener(this.model.hintFaceletProp,async o=>{(await this.twisty3DPuzzle()).experimentalUpdateOptions({hintFacelets:o==="auto"?"floating":o}),this.scheduleRender()}),S(this,zr).addListener(this.model.stickeringProp,async o=>{if("setStickering"in await this.twisty3DPuzzle())(await this.twisty3DPuzzle()).setStickering(o),this.scheduleRender();else{if(["experimental-global-custom-1","experimental-global-custom-2"].includes(o)){let[s]=await Promise.all([this.twisty3DPuzzle()]);s.experimentalSetAppearance(await Hn(this.puzzleLoader,o)),this.scheduleRender();return}if("appearance"in this.puzzleLoader){let[s,a]=await Promise.all([this.twisty3DPuzzle(),this.puzzleLoader.appearance(o??"full")]);s.experimentalSetAppearance(a),this.scheduleRender()}}}),S(this,zr).addMultiListener([this.model.foundationStickerSprite,this.model.hintStickerSprite],async o=>{"experimentalUpdateTexture"in await this.twisty3DPuzzle()&&((await this.twisty3DPuzzle()).experimentalUpdateTexture(!0,...o),this.scheduleRender())})}disconnect(){S(this,zr).disconnect()}scheduleRender(){this.schedulable.scheduleRender()}async twisty3DPuzzle(){return S(this,Yd)??$(this,Yd,(async()=>{let e=Y2();if(this.puzzleLoader.id==="3x3x3"&&this.visualizationStrategy==="Cube3D"){let[t,n,i]=await Promise.all([this.model.foundationStickerSprite.get(),this.model.hintStickerSprite.get(),this.model.stickeringProp.get()]);return(await e).cube3DShim({foundationSprite:t,hintSprite:n,experimentalStickering:i})}else{let[t,n,i]=await Promise.all([this.model.hintFaceletProp.get(),this.model.foundationStickerSprite.get(),this.model.hintStickerSprite.get()]),o=(await e).pg3dShim(this.puzzleLoader,t==="auto"?"floating":t);return o.then(s=>s.experimentalUpdateTexture(!0,n??void 0,i??void 0)),o}})())}};zr=new WeakMap,Yd=new WeakMap;j2();Rr();Ft();un();kd();O2();kd();var Z2=[];async function SD(r,e,t,n,i){if(r===0||e===0)return;Z2.length===0&&Z2.push(J2());let o=await Z2[0];o.setSize(r,e),o.render(n,i);let s=t.getContext("2d");s.clearRect(0,0,t.width,t.height),s.drawImage(o.domElement,0,0)}async function J2(){let r=(await In).WebGLRenderer,e=new r({antialias:!0,alpha:!0});return e.setPixelRatio(Cr()),e}Gs();Gs();Rr();var k6=!0,B6="auto",$2=500,z6=50,LD=.75;function AD(r){return(Math.exp(1-r)-(1-r))/(1-Math.E)+1}var ey=class{constructor(e,t,n,i){this.startTimestamp=e;this.momentumX=t;this.momentumY=n;this.callback=i;this.scheduler=new ln(this.render.bind(this));this.scheduler.requestAnimFrame(),this.lastTimestamp=e}render(e){let t=(this.lastTimestamp-this.startTimestamp)/$2,n=Math.min(1,(e-this.startTimestamp)/$2);if(t===0&&n>z6/$2)return;let i=AD(n)-AD(t);this.callback(this.momentumX*i*1e3,this.momentumY*i*1e3),n<1&&this.scheduler.requestAnimFrame(),this.lastTimestamp=e}};var ty=class{constructor(e,t,n){this.model=e;this.mirror=t;this.canvas=n;this.experimentalInertia=k6;this.experimentalLatitudeLimits=B6;this.lastTouchClientX=0;this.lastTouchClientY=0;this.currentTouchID=null;this.onMoveBound=this.onMove.bind(this);this.onMouseMoveBound=this.onMouseMove.bind(this);this.onMouseEndBound=this.onMouseEnd.bind(this);this.onTouchMoveBound=this.onTouchMove.bind(this);this.onTouchEndBound=this.onTouchEnd.bind(this);this.lastTouchTimestamp=0;this.lastTouchMoveMomentumX=0;this.lastTouchMoveMomentumY=0;this.lastMouseTimestamp=0;this.lastMouseMoveMomentumX=0;this.lastMouseMoveMomentumY=0;this.experimentalHasBeenMoved=!1;n.addEventListener("mousedown",this.onMouseStart.bind(this)),n.addEventListener("touchstart",this.onTouchStart.bind(this))}temperMovement(e){return Math.sign(e)*Math.log(Math.abs(e*10)+1)/6}onMouseStart(e){window.addEventListener("mousemove",this.onMouseMoveBound),window.addEventListener("mouseup",this.onMouseEndBound),this.onStart(e),this.lastMouseTimestamp=e.timeStamp}onMouseMove(e){if(e.buttons===0){this.onMouseEnd(e);return}if(e.movementX===0&&e.movementY===0)return;let t=Math.min(this.canvas.offsetWidth,this.canvas.offsetHeight),n=this.temperMovement(e.movementX/t),i=this.temperMovement(e.movementY/t*LD);this.onMove(n,i);let o=e.timeStamp-this.lastMouseTimestamp;o>0&&(this.lastMouseMoveMomentumX=n/o,this.lastMouseMoveMomentumY=i/o,this.lastMouseTimestamp=e.timeStamp)}onMouseEnd(e){window.removeEventListener("mousemove",this.onMouseMoveBound),window.removeEventListener("mouseup",this.onMouseEndBound),this.onEnd(e),this.experimentalInertia&&new ey(this.lastMouseTimestamp,this.lastMouseMoveMomentumX,this.lastMouseMoveMomentumY,this.onMoveBound)}onTouchStart(e){if(this.currentTouchID===null){if(e.touches[0].clientX===0&&e.touches[0].clientY===0)return;this.currentTouchID=e.changedTouches[0].identifier,this.lastTouchClientX=e.touches[0].clientX,this.lastTouchClientY=e.touches[0].clientY,window.addEventListener("touchmove",this.onTouchMoveBound),window.addEventListener("touchend",this.onTouchEndBound),window.addEventListener("touchcancel",this.onTouchEndBound),this.onStart(e),this.lastTouchTimestamp=e.timeStamp}}onTouchMove(e){for(let t=0;t<e.changedTouches.length;t++){let n=e.changedTouches[t];if(n.identifier===this.currentTouchID){let i=Math.min(this.canvas.offsetWidth,this.canvas.offsetHeight),o=this.temperMovement((n.clientX-this.lastTouchClientX)/i),s=this.temperMovement((n.clientY-this.lastTouchClientY)/i*LD);this.onMove(o,s),this.lastTouchClientX=n.clientX,this.lastTouchClientY=n.clientY;let a=e.timeStamp-this.lastTouchTimestamp;a>0&&(this.lastTouchMoveMomentumX=o/a,this.lastTouchMoveMomentumY=s/a,this.lastTouchTimestamp=e.timeStamp)}}}onTouchEnd(e){for(let t=0;t<e.changedTouches.length;t++)e.changedTouches[t].identifier===this.currentTouchID&&(this.currentTouchID=null,window.removeEventListener("touchmove",this.onTouchMoveBound),window.removeEventListener("touchend",this.onTouchEndBound),window.removeEventListener("touchcancel",this.onTouchEndBound),this.onEnd(e));this.experimentalInertia&&new ey(this.lastTouchTimestamp,this.lastTouchMoveMomentumX,this.lastTouchMoveMomentumY,this.onMoveBound)}onStart(e){e.preventDefault()}async onMove(e,t){let n=this.mirror?-1:1;this.model.orbitCoordinatesRequestProp.set((async()=>{let i=await this.model.orbitCoordinatesProp.get();return{latitude:i.latitude+2*t*ui*n,longitude:i.longitude-2*e*ui}})())}onEnd(e){e.preventDefault()}};var I6=!1;async function ny(r,e,t=!1){let n=new(await In).Spherical(e.distance,(90-(t?-1:1)*e.latitude)/ui,((t?180:0)+e.longitude)/ui);n.makeSafe(),r.position.setFromSpherical(n),r.lookAt(0,0,0)}var iy=null;function DD(r){iy=r}var ED=!1;function U6(){return iy!==null?iy:ED?!0:(ED=!0,!1)}var Xd,ah,lh,uh,MD,Kd,Zd,Jd,$d,jl,em,sh=class extends rt{constructor(e,t,n){super();this.model=e;this.options=n;H(this,uh);this.scene=null;this.stats=null;this.rendererIsShared=U6();H(this,Xd,new Tr);H(this,ah,0);H(this,lh,0);H(this,Kd,null);H(this,Zd,null);H(this,Jd,null);H(this,$d,null);H(this,jl,[]);H(this,em,new ln(this.render.bind(this)));this.scene=t??null,I6&&(this.stats=new $c,this.stats.dom.style.position="absolute",this.contentWrapper.appendChild(this.stats.dom))}async connectedCallback(){this.addCSS(Bd),this.addElement(await this.canvas()),ye(this,uh,MD).call(this),new ResizeObserver(ye(this,uh,MD).bind(this)).observe(this.contentWrapper),this.orbitControls(),this.scheduleRender()}async renderer(){if(this.rendererIsShared)throw new Error("renderer expected to be shared.");return S(this,Kd)??$(this,Kd,J2())}async canvas(){return S(this,Zd)??$(this,Zd,(async()=>{if(this.rendererIsShared)return this.addElement(document.createElement("canvas"));let e=await this.renderer();return this.addElement(e.domElement)})())}async camera(){return S(this,Jd)??$(this,Jd,(async()=>{let e=new(await In).PerspectiveCamera(20,1,.1,20);return e.position.copy(new(await In).Vector3(2,4,4).multiplyScalar(this.options?.backView?-1:1)),e.lookAt(0,0,0),e})())}async orbitControls(){return S(this,$d)??$(this,$d,(async()=>{let e=new ty(this.model,!!this.options?.backView,await this.canvas());return this.model&&this.addListener(this.model.orbitCoordinatesProp,async t=>{let n=await this.camera();ny(n,t,this.options?.backView),this.scheduleRender()}),e})())}addListener(e,t){e.addFreshListener(t),S(this,jl).push(()=>{e.removeFreshListener(t)})}disconnect(){for(let e of S(this,jl))e();$(this,jl,[])}async render(){if(!this.scene)throw new Error("Attempted to render without a scene");this.stats?.begin();let[e,t,n]=await Promise.all([this.scene.scene(),this.camera(),this.canvas()]);this.rendererIsShared?SD(S(this,ah),S(this,lh),n,e,t):(await this.renderer()).render(e,t),this.stats?.end()}scheduleRender(){S(this,em).requestAnimFrame()}};Xd=new WeakMap,ah=new WeakMap,lh=new WeakMap,uh=new WeakSet,MD=async function(){let e=await S(this,Xd).queue(this.camera()),t=this.contentWrapper.clientWidth,n=this.contentWrapper.clientHeight;$(this,ah,t),$(this,lh,n);let i=0,o=0,s=0;if(n>t&&(s=n-t,o=-Math.floor(.5*s)),e.aspect=t/n,e.setViewOffset(t,n-s,i,o,t,n),e.updateProjectionMatrix(),this.rendererIsShared){let a=await this.canvas();a.width=t*Cr(),a.height=n*Cr(),a.style.width=t.toString(),a.style.height=t.toString()}else(await this.renderer()).setSize(t,n,!0);this.scheduleRender()},Kd=new WeakMap,Zd=new WeakMap,Jd=new WeakMap,$d=new WeakMap,jl=new WeakMap,em=new WeakMap;Qe.define("twisty-3d-vantage-v2",sh);var tm,Yl,Ir,nm,Qs,Ys,im,Ql=class extends rt{constructor(e){super();this.model=e;H(this,tm,new zn(this,"back-view-",["auto","none","side-by-side","top-right"]));H(this,Yl,new Ni);H(this,Ir,null);H(this,nm,void 0);H(this,Qs,new Set);H(this,Ys,null);H(this,im,new Tr)}disconnect(){S(this,Yl).disconnect()}async connectedCallback(){this.addCSS(Pl);let e=new sh(this.model,this);this.addVantage(e),this.model&&(S(this,Yl).addMultiListener([this.model.puzzleLoaderProp,this.model.visualizationStrategyProp],this.onPuzzle.bind(this)),S(this,Yl).addListener(this.model.backViewProp,this.onBackView.bind(this))),this.scheduleRender()}setBackView(e){let t=["side-by-side","top-right"].includes(e),n=S(this,Ir)!==null;S(this,tm).setValue(e),t?n||($(this,Ir,new sh(this.model,this,{backView:!0})),this.addVantage(S(this,Ir)),this.scheduleRender()):S(this,Ir)&&(this.removeVantage(S(this,Ir)),$(this,Ir,null))}onBackView(e){this.setBackView(e)}async scene(){return S(this,nm)??$(this,nm,(async()=>new(await In).Scene)())}addVantage(e){S(this,Qs).add(e),this.contentWrapper.appendChild(e)}removeVantage(e){S(this,Qs).delete(e),e.remove(),e.disconnect(),S(this,Ys)?.disconnect()}experimentalVantages(){return S(this,Qs).values()}scheduleRender(){for(let e of S(this,Qs))e.scheduleRender()}async setCurrentTwisty3DPuzzleWrapper(e,t){let n=S(this,Ys);$(this,Ys,t),n?.disconnect(),e.add(await t.twisty3DPuzzle()),n&&e.remove(await n.twisty3DPuzzle())}async onPuzzle(e){S(this,Ys)?.disconnect();let[t,n]=await S(this,im).queue(Promise.all([this.scene(),new oh(this.model,this,e[0],e[1])]));this.setCurrentTwisty3DPuzzleWrapper(t,n)}};tm=new WeakMap,Yl=new WeakMap,Ir=new WeakMap,nm=new WeakMap,Qs=new WeakMap,Ys=new WeakMap,im=new WeakMap;Qe.define("twisty-3d-scene-wrapper",Ql);Ft();var rm=new Xt(`
|
|
7157
|
+
`);var Hl,ql,Hd=class extends rt{constructor(e,t,n,i,o){super();this.model=e;this.svgSource=n;this.options=i;this.puzzleLoader=o;this.scheduler=new ln(this.render.bind(this));H(this,Hl,null);H(this,ql,new Ni);this.addCSS(Vd),this.definition=t,this.resetSVG(),S(this,ql).addListener(this.model.puzzleIDProp,s=>{o?.id!==s&&this.disconnect()}),S(this,ql).addListener(this.model.legacyPositionProp,this.onPositionChange.bind(this)),this.options?.experimentalStickering&&this.experimentalSetStickering(this.options.experimentalStickering)}disconnect(){S(this,ql).disconnect()}onPositionChange(e){try{if(e.movesInProgress.length>0){let t=e.movesInProgress[0].move,n=this.definition,i=t;e.movesInProgress[0].direction===tt.Backwards&&(i=t.invert());let o=gt(n,e.state,Ai(n,i));this.svg.draw(this.definition,e.state,o,e.movesInProgress[0].fraction)}else this.svg.draw(this.definition,e.state),$(this,Hl,e)}catch(t){console.warn("Bad position (this doesn't necessarily mean something is wrong). Pre-emptively disconnecting:",this.puzzleLoader?.id,t),this.disconnect()}}scheduleRender(){this.scheduler.requestAnimFrame()}experimentalSetStickering(e){(async()=>{if(!this.puzzleLoader?.appearance)return;let t=await this.puzzleLoader.appearance(e);this.resetSVG(t)})()}resetSVG(e){this.svg&&this.removeElement(this.svg.element),!!this.definition&&(this.svg=new Xo(this.definition,this.svgSource,e),this.addElement(this.svg.element),S(this,Hl)&&this.onPositionChange(S(this,Hl)))}render(){}};Hl=new WeakMap,ql=new WeakMap;Qe.define("twisty-2d-puzzle",Hd);var ih,qd,Z2=class{constructor(e,t,n,i){this.model=e;this.schedulable=t;this.puzzleLoader=n;this.effectiveVisualization=i;H(this,ih,new Ni);H(this,qd,null);this.twisty2DPuzzle(),S(this,ih).addListener(this.model.stickeringProp,async o=>{(await this.twisty2DPuzzle()).experimentalSetStickering(o)})}disconnect(){S(this,ih).disconnect()}scheduleRender(){}async twisty2DPuzzle(){return S(this,qd)??$(this,qd,(async()=>{let e=this.effectiveVisualization==="experimental-2D-LL"?this.puzzleLoader.llSVG():this.puzzleLoader.svg();return new Hd(this.model,await this.puzzleLoader.def(),await e,{},this.puzzleLoader)})())}};ih=new WeakMap,qd=new WeakMap;var rh,Qd,ko,jd=class extends rt{constructor(e,t){super();this.model=e;this.effectiveVisualization=t;H(this,rh,new Ni);H(this,Qd,void 0);H(this,ko,null)}disconnect(){S(this,rh).disconnect()}async connectedCallback(){this.addCSS(Pl),this.model&&S(this,rh).addListener(this.model.puzzleLoaderProp,this.onPuzzleLoader.bind(this))}async scene(){return S(this,Qd)??$(this,Qd,(async()=>new(await In).Scene)())}scheduleRender(){S(this,ko)?.scheduleRender()}currentTwisty2DPuzzleWrapper(){return S(this,ko)}async setCurrentTwisty2DPuzzleWrapper(e){let t=S(this,ko);$(this,ko,e),t?.disconnect();let n=e.twisty2DPuzzle();this.contentWrapper.textContent="",this.addElement(await n)}async onPuzzleLoader(e){S(this,ko)?.disconnect();let t=new Z2(this.model,this,e,this.effectiveVisualization);this.setCurrentTwisty2DPuzzleWrapper(t)}};rh=new WeakMap,Qd=new WeakMap,ko=new WeakMap;Qe.define("twisty-2d-scene-wrapper",jd);Ro();Tt();un();Md();qn();var zr,Yd,oh=class{constructor(e,t,n,i){this.model=e;this.schedulable=t;this.puzzleLoader=n;this.visualizationStrategy=i;H(this,zr,new Ni);H(this,Yd,null);this.twisty3DPuzzle(),S(this,zr).addListener(this.model.puzzleLoaderProp,o=>{this.puzzleLoader.id!==o.id&&this.disconnect()}),S(this,zr).addListener(this.model.legacyPositionProp,async o=>{try{(await this.twisty3DPuzzle()).onPositionChange(o),this.scheduleRender()}catch(s){this.disconnect()}}),S(this,zr).addListener(this.model.hintFaceletProp,async o=>{(await this.twisty3DPuzzle()).experimentalUpdateOptions({hintFacelets:o==="auto"?"floating":o}),this.scheduleRender()}),S(this,zr).addListener(this.model.stickeringProp,async o=>{if("setStickering"in await this.twisty3DPuzzle())(await this.twisty3DPuzzle()).setStickering(o),this.scheduleRender();else{if(["experimental-global-custom-1","experimental-global-custom-2"].includes(o)){let[s]=await Promise.all([this.twisty3DPuzzle()]);s.experimentalSetAppearance(await Hn(this.puzzleLoader,o)),this.scheduleRender();return}if("appearance"in this.puzzleLoader){let[s,a]=await Promise.all([this.twisty3DPuzzle(),this.puzzleLoader.appearance(o??"full")]);s.experimentalSetAppearance(a),this.scheduleRender()}}}),S(this,zr).addMultiListener([this.model.foundationStickerSprite,this.model.hintStickerSprite],async o=>{"experimentalUpdateTexture"in await this.twisty3DPuzzle()&&((await this.twisty3DPuzzle()).experimentalUpdateTexture(!0,...o),this.scheduleRender())})}disconnect(){S(this,zr).disconnect()}scheduleRender(){this.schedulable.scheduleRender()}async twisty3DPuzzle(){return S(this,Yd)??$(this,Yd,(async()=>{let e=X2();if(this.puzzleLoader.id==="3x3x3"&&this.visualizationStrategy==="Cube3D"){let[t,n,i]=await Promise.all([this.model.foundationStickerSprite.get(),this.model.hintStickerSprite.get(),this.model.stickeringProp.get()]);return(await e).cube3DShim({foundationSprite:t,hintSprite:n,experimentalStickering:i})}else{let[t,n,i]=await Promise.all([this.model.hintFaceletProp.get(),this.model.foundationStickerSprite.get(),this.model.hintStickerSprite.get()]),o=(await e).pg3dShim(this.puzzleLoader,t==="auto"?"floating":t);return o.then(s=>s.experimentalUpdateTexture(!0,n??void 0,i??void 0)),o}})())}};zr=new WeakMap,Yd=new WeakMap;Q2();Rr();Tt();un();kd();G2();kd();var J2=[];async function LD(r,e,t,n,i){if(r===0||e===0)return;J2.length===0&&J2.push($2());let o=await J2[0];o.setSize(r,e),o.render(n,i);let s=t.getContext("2d");s.clearRect(0,0,t.width,t.height),s.drawImage(o.domElement,0,0)}async function $2(){let r=(await In).WebGLRenderer,e=new r({antialias:!0,alpha:!0});return e.setPixelRatio(Cr()),e}Gs();Gs();Rr();var k6=!0,B6="auto",ey=500,z6=50,AD=.75;function DD(r){return(Math.exp(1-r)-(1-r))/(1-Math.E)+1}var ty=class{constructor(e,t,n,i){this.startTimestamp=e;this.momentumX=t;this.momentumY=n;this.callback=i;this.scheduler=new ln(this.render.bind(this));this.scheduler.requestAnimFrame(),this.lastTimestamp=e}render(e){let t=(this.lastTimestamp-this.startTimestamp)/ey,n=Math.min(1,(e-this.startTimestamp)/ey);if(t===0&&n>z6/ey)return;let i=DD(n)-DD(t);this.callback(this.momentumX*i*1e3,this.momentumY*i*1e3),n<1&&this.scheduler.requestAnimFrame(),this.lastTimestamp=e}};var ny=class{constructor(e,t,n){this.model=e;this.mirror=t;this.canvas=n;this.experimentalInertia=k6;this.experimentalLatitudeLimits=B6;this.lastTouchClientX=0;this.lastTouchClientY=0;this.currentTouchID=null;this.onMoveBound=this.onMove.bind(this);this.onMouseMoveBound=this.onMouseMove.bind(this);this.onMouseEndBound=this.onMouseEnd.bind(this);this.onTouchMoveBound=this.onTouchMove.bind(this);this.onTouchEndBound=this.onTouchEnd.bind(this);this.lastTouchTimestamp=0;this.lastTouchMoveMomentumX=0;this.lastTouchMoveMomentumY=0;this.lastMouseTimestamp=0;this.lastMouseMoveMomentumX=0;this.lastMouseMoveMomentumY=0;this.experimentalHasBeenMoved=!1;n.addEventListener("mousedown",this.onMouseStart.bind(this)),n.addEventListener("touchstart",this.onTouchStart.bind(this))}temperMovement(e){return Math.sign(e)*Math.log(Math.abs(e*10)+1)/6}onMouseStart(e){window.addEventListener("mousemove",this.onMouseMoveBound),window.addEventListener("mouseup",this.onMouseEndBound),this.onStart(e),this.lastMouseTimestamp=e.timeStamp}onMouseMove(e){if(e.buttons===0){this.onMouseEnd(e);return}if(e.movementX===0&&e.movementY===0)return;let t=Math.min(this.canvas.offsetWidth,this.canvas.offsetHeight),n=this.temperMovement(e.movementX/t),i=this.temperMovement(e.movementY/t*AD);this.onMove(n,i);let o=e.timeStamp-this.lastMouseTimestamp;o>0&&(this.lastMouseMoveMomentumX=n/o,this.lastMouseMoveMomentumY=i/o,this.lastMouseTimestamp=e.timeStamp)}onMouseEnd(e){window.removeEventListener("mousemove",this.onMouseMoveBound),window.removeEventListener("mouseup",this.onMouseEndBound),this.onEnd(e),this.experimentalInertia&&new ty(this.lastMouseTimestamp,this.lastMouseMoveMomentumX,this.lastMouseMoveMomentumY,this.onMoveBound)}onTouchStart(e){if(this.currentTouchID===null){if(e.touches[0].clientX===0&&e.touches[0].clientY===0)return;this.currentTouchID=e.changedTouches[0].identifier,this.lastTouchClientX=e.touches[0].clientX,this.lastTouchClientY=e.touches[0].clientY,window.addEventListener("touchmove",this.onTouchMoveBound),window.addEventListener("touchend",this.onTouchEndBound),window.addEventListener("touchcancel",this.onTouchEndBound),this.onStart(e),this.lastTouchTimestamp=e.timeStamp}}onTouchMove(e){for(let t=0;t<e.changedTouches.length;t++){let n=e.changedTouches[t];if(n.identifier===this.currentTouchID){let i=Math.min(this.canvas.offsetWidth,this.canvas.offsetHeight),o=this.temperMovement((n.clientX-this.lastTouchClientX)/i),s=this.temperMovement((n.clientY-this.lastTouchClientY)/i*AD);this.onMove(o,s),this.lastTouchClientX=n.clientX,this.lastTouchClientY=n.clientY;let a=e.timeStamp-this.lastTouchTimestamp;a>0&&(this.lastTouchMoveMomentumX=o/a,this.lastTouchMoveMomentumY=s/a,this.lastTouchTimestamp=e.timeStamp)}}}onTouchEnd(e){for(let t=0;t<e.changedTouches.length;t++)e.changedTouches[t].identifier===this.currentTouchID&&(this.currentTouchID=null,window.removeEventListener("touchmove",this.onTouchMoveBound),window.removeEventListener("touchend",this.onTouchEndBound),window.removeEventListener("touchcancel",this.onTouchEndBound),this.onEnd(e));this.experimentalInertia&&new ty(this.lastTouchTimestamp,this.lastTouchMoveMomentumX,this.lastTouchMoveMomentumY,this.onMoveBound)}onStart(e){e.preventDefault()}async onMove(e,t){let n=this.mirror?-1:1;this.model.orbitCoordinatesRequestProp.set((async()=>{let i=await this.model.orbitCoordinatesProp.get();return{latitude:i.latitude+2*t*ui*n,longitude:i.longitude-2*e*ui}})())}onEnd(e){e.preventDefault()}};var I6=!1;async function iy(r,e,t=!1){let n=new(await In).Spherical(e.distance,(90-(t?-1:1)*e.latitude)/ui,((t?180:0)+e.longitude)/ui);n.makeSafe(),r.position.setFromSpherical(n),r.lookAt(0,0,0)}var Xd=null;function ED(r){Xd=r}var ry=0,U6=2;function N6(){return Xd!==null?(Xd||ry++,Xd):ry<U6?(ry++,!1):!0}var Kd,ah,lh,uh,MD,Zd,Jd,$d,em,jl,tm,sh=class extends rt{constructor(e,t,n){super();this.model=e;this.options=n;H(this,uh);this.scene=null;this.stats=null;this.rendererIsShared=N6();H(this,Kd,new Tr);H(this,ah,0);H(this,lh,0);H(this,Zd,null);H(this,Jd,null);H(this,$d,null);H(this,em,null);H(this,jl,[]);H(this,tm,new ln(this.render.bind(this)));this.scene=t??null,I6&&(this.stats=new $c,this.stats.dom.style.position="absolute",this.contentWrapper.appendChild(this.stats.dom))}async connectedCallback(){this.addCSS(Bd),this.addElement(await this.canvas()),ye(this,uh,MD).call(this),new ResizeObserver(ye(this,uh,MD).bind(this)).observe(this.contentWrapper),this.orbitControls(),this.scheduleRender()}async renderer(){if(this.rendererIsShared)throw new Error("renderer expected to be shared.");return S(this,Zd)??$(this,Zd,$2())}async canvas(){return S(this,Jd)??$(this,Jd,(async()=>{if(this.rendererIsShared)return this.addElement(document.createElement("canvas"));let e=await this.renderer();return this.addElement(e.domElement)})())}async camera(){return S(this,$d)??$(this,$d,(async()=>{let e=new(await In).PerspectiveCamera(20,1,.1,20);return e.position.copy(new(await In).Vector3(2,4,4).multiplyScalar(this.options?.backView?-1:1)),e.lookAt(0,0,0),e})())}async orbitControls(){return S(this,em)??$(this,em,(async()=>{let e=new ny(this.model,!!this.options?.backView,await this.canvas());return this.model&&this.addListener(this.model.orbitCoordinatesProp,async t=>{let n=await this.camera();iy(n,t,this.options?.backView),this.scheduleRender()}),e})())}addListener(e,t){e.addFreshListener(t),S(this,jl).push(()=>{e.removeFreshListener(t)})}disconnect(){for(let e of S(this,jl))e();$(this,jl,[])}async render(){if(!this.scene)throw new Error("Attempted to render without a scene");this.stats?.begin();let[e,t,n]=await Promise.all([this.scene.scene(),this.camera(),this.canvas()]);this.rendererIsShared?LD(S(this,ah),S(this,lh),n,e,t):(await this.renderer()).render(e,t),this.stats?.end()}scheduleRender(){S(this,tm).requestAnimFrame()}};Kd=new WeakMap,ah=new WeakMap,lh=new WeakMap,uh=new WeakSet,MD=async function(){let e=await S(this,Kd).queue(this.camera()),t=this.contentWrapper.clientWidth,n=this.contentWrapper.clientHeight;$(this,ah,t),$(this,lh,n);let i=0,o=0,s=0;if(n>t&&(s=n-t,o=-Math.floor(.5*s)),e.aspect=t/n,e.setViewOffset(t,n-s,i,o,t,n),e.updateProjectionMatrix(),this.rendererIsShared){let a=await this.canvas();a.width=t*Cr(),a.height=n*Cr(),a.style.width=t.toString(),a.style.height=t.toString()}else(await this.renderer()).setSize(t,n,!0);this.scheduleRender()},Zd=new WeakMap,Jd=new WeakMap,$d=new WeakMap,em=new WeakMap,jl=new WeakMap,tm=new WeakMap;Qe.define("twisty-3d-vantage-v2",sh);var nm,Yl,Ir,im,Qs,Ys,rm,Ql=class extends rt{constructor(e){super();this.model=e;H(this,nm,new zn(this,"back-view-",["auto","none","side-by-side","top-right"]));H(this,Yl,new Ni);H(this,Ir,null);H(this,im,void 0);H(this,Qs,new Set);H(this,Ys,null);H(this,rm,new Tr)}disconnect(){S(this,Yl).disconnect()}async connectedCallback(){this.addCSS(Pl);let e=new sh(this.model,this);this.addVantage(e),this.model&&(S(this,Yl).addMultiListener([this.model.puzzleLoaderProp,this.model.visualizationStrategyProp],this.onPuzzle.bind(this)),S(this,Yl).addListener(this.model.backViewProp,this.onBackView.bind(this))),this.scheduleRender()}setBackView(e){let t=["side-by-side","top-right"].includes(e),n=S(this,Ir)!==null;S(this,nm).setValue(e),t?n||($(this,Ir,new sh(this.model,this,{backView:!0})),this.addVantage(S(this,Ir)),this.scheduleRender()):S(this,Ir)&&(this.removeVantage(S(this,Ir)),$(this,Ir,null))}onBackView(e){this.setBackView(e)}async scene(){return S(this,im)??$(this,im,(async()=>new(await In).Scene)())}addVantage(e){S(this,Qs).add(e),this.contentWrapper.appendChild(e)}removeVantage(e){S(this,Qs).delete(e),e.remove(),e.disconnect(),S(this,Ys)?.disconnect()}experimentalVantages(){return S(this,Qs).values()}scheduleRender(){for(let e of S(this,Qs))e.scheduleRender()}async setCurrentTwisty3DPuzzleWrapper(e,t){let n=S(this,Ys);$(this,Ys,t),n?.disconnect(),e.add(await t.twisty3DPuzzle()),n&&e.remove(await n.twisty3DPuzzle())}async onPuzzle(e){S(this,Ys)?.disconnect();let[t,n]=await S(this,rm).queue(Promise.all([this.scene(),new oh(this.model,this,e[0],e[1])]));this.setCurrentTwisty3DPuzzleWrapper(t,n)}};nm=new WeakMap,Yl=new WeakMap,Ir=new WeakMap,im=new WeakMap,Qs=new WeakMap,Ys=new WeakMap,rm=new WeakMap;Qe.define("twisty-3d-scene-wrapper",Ql);Tt();var om=new Xt(`
|
|
7158
7158
|
:host {
|
|
7159
7159
|
width: 384px;
|
|
7160
7160
|
height: 24px;
|
|
@@ -7183,7 +7183,7 @@ svg {
|
|
|
7183
7183
|
width: inherit;
|
|
7184
7184
|
height: inherit;
|
|
7185
7185
|
}
|
|
7186
|
-
`),
|
|
7186
|
+
`),sm=new Xt(`
|
|
7187
7187
|
:host:not([hidden]) {
|
|
7188
7188
|
display: grid;
|
|
7189
7189
|
}
|
|
@@ -7271,7 +7271,7 @@ button.svg-exit-fullscreen {
|
|
|
7271
7271
|
button.svg-twizzle-tw {
|
|
7272
7272
|
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODY0IiBoZWlnaHQ9IjYwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMzk3LjU4MSAxNTEuMTh2NTcuMDg0aC04OS43MDN2MjQwLjM1MmgtNjYuOTU1VjIwOC4yNjRIMTUxLjIydi01Ny4wODNoMjQ2LjM2MXptNTQuMzEgNzEuNjc3bDcuNTEyIDMzLjY5MmMyLjcxOCAxMi4xNiA1LjU4IDI0LjY4IDguNTg0IDM3LjU1NWEyMTgwLjc3NSAyMTgwLjc3NSAwIDAwOS40NDIgMzguODQzIDEyNjYuMyAxMjY2LjMgMCAwMDEwLjA4NiAzNy41NTVjMy43Mi0xMi41OSA3LjM2OC0yNS40NjYgMTAuOTQ1LTM4LjYyOCAzLjU3Ni0xMy4xNjIgNy4wMS0yNi4xMSAxMC4zLTM4Ljg0M2w1Ljc2OS0yMi40NTZjMS4yNDgtNC44ODcgMi40NzItOS43MDUgMy42NzQtMTQuNDU1IDMuMDA0LTExLjg3NSA1LjY1MS0yMi45NjIgNy45NC0zMy4yNjNoNDYuMzU0bDIuMzg0IDEwLjU2M2EyMDAwLjc3IDIwMDAuNzcgMCAwMDMuOTM1IDE2LjgyOGw2LjcxMSAyNy43MWMxLjIxMyA0Ljk1NiAyLjQ1IDkuOTggMy43MDkgMTUuMDczYTMxMTkuNzc3IDMxMTkuNzc3IDAgMDA5Ljg3MSAzOC44NDMgMTI0OS4yMjcgMTI0OS4yMjcgMCAwMDEwLjczIDM4LjYyOCAxOTA3LjYwNSAxOTA3LjYwNSAwIDAwMTAuMzAxLTM3LjU1NSAxMzk3Ljk0IDEzOTcuOTQgMCAwMDkuNjU3LTM4Ljg0M2w0LjQtMTkuMDQ2Yy43MTUtMy4xMyAxLjQyMS02LjIzNiAyLjExOC05LjMyMWw5LjU3Ny00Mi44OGg2Ni41MjZhMjk4OC43MTggMjk4OC43MTggMCAwMS0xOS41MjkgNjYuMzExbC01LjcyOCAxOC40ODJhMzIzNy40NiAzMjM3LjQ2IDAgMDEtMTQuMDE1IDQzLjc1MmMtNi40MzggMTkuNi0xMi43MzMgMzcuNjk4LTE4Ljg4NSA1NC4yOTRsLTMuMzA2IDguODI1Yy00Ljg4NCAxMi44OTgtOS40MzMgMjQuMjYzLTEzLjY0NyAzNC4wOTVoLTQ5Ljc4N2E4NDE3LjI4OSA4NDE3LjI4OSAwIDAxLTIxLjAzMS02NC44MDkgMTI4OC42ODYgMTI4OC42ODYgMCAwMS0xOC44ODUtNjQuODEgMTk3Mi40NDQgMTk3Mi40NDQgMCAwMS0xOC4yNCA2NC44MSAyNTc5LjQxMiAyNTc5LjQxMiAwIDAxLTIwLjM4OCA2NC44MWgtNDkuNzg3Yy00LjY4Mi0xMC45MjYtOS43Mi0yMy43NDMtMTUuMTEtMzguNDUxbC0xLjYyOS00LjQ3Yy01LjI1OC0xNC41MjEtMTAuNjgtMzAuMTkyLTE2LjI2Ni00Ny4wMTRsLTIuNDA0LTcuMjhjLTYuNDM4LTE5LjYtMTMuMDItNDAuMzQ0LTE5Ljc0My02Mi4yMzRhMjk4OC43MDcgMjk4OC43MDcgMCAwMS0xOS41MjktNjYuMzExaDY3LjM4NXoiIGZpbGw9IiM0Mjg1RjQiIGZpbGwtcnVsZT0ibm9uemVybyIvPjwvc3ZnPg==");
|
|
7273
7273
|
}
|
|
7274
|
-
`);Ro();
|
|
7274
|
+
`);Ro();Tt();un();var Ur=typeof document=="undefined"?null:document;var RD=Ur?.fullscreenEnabled||!!Ur?.webkitFullscreenEnabled;function TD(){return document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen()}function oy(){return document.fullscreenElement?document.fullscreenElement:document.webkitFullscreenElement??null}function FD(r){return r.requestFullscreen?r.requestFullscreen():r.webkitRequestFullscreen()}var _D=["skip-to-start","skip-to-end","step-forward","step-backward","pause","play","enter-fullscreen","exit-fullscreen","twizzle-tw"],sy=class extends He{derive(e){return{fullscreen:{enabled:RD,icon:document.fullscreenElement===null?"enter-fullscreen":"exit-fullscreen",title:"Enter fullscreen"},"jump-to-start":{enabled:!e.coarseTimelineInfo.atStart,icon:"skip-to-start",title:"Restart"},"play-step-backwards":{enabled:!e.coarseTimelineInfo.atStart,icon:"step-backward",title:"Step backward"},"play-pause":{enabled:!0,icon:e.coarseTimelineInfo.playing?"pause":"play",title:e.coarseTimelineInfo.playing?"Pause":"Play"},"play-step":{enabled:!e.coarseTimelineInfo.atEnd,icon:"step-forward",title:"Step forward"},"jump-to-end":{enabled:!e.coarseTimelineInfo.atEnd,icon:"skip-to-end",title:"Skip to End"},"twizzle-link":{enabled:!0,icon:"twizzle-tw",title:"View at Twizzle",hidden:e.viewerLink==="none"}}}};var CD={fullscreen:!0,"jump-to-start":!0,"play-step-backwards":!0,"play-pause":!0,"play-step":!0,"jump-to-end":!0,"twizzle-link":!0},lm,O6,am=class extends rt{constructor(e,t,n){super();this.model=e;this.controller=t;this.fullscreenElement=n;H(this,lm);this.buttons=null}connectedCallback(){this.addCSS(om);let e={};for(let t in CD){let n=new ay;e[t]=n,n.addEventListener("click",()=>ye(this,lm,O6).call(this,t)),this.addElement(n)}this.buttons=e,this.model?.buttonAppearanceProp.addFreshListener(this.update.bind(this))}async onFullscreenButton(){if(!this.fullscreenElement)throw new Error("Attempted to go fullscreen without an element.");if(oy()===this.fullscreenElement)TD();else{this.buttons?.fullscreen.setIcon("exit-fullscreen"),FD(this.fullscreenElement);let e=()=>{oy()!==this.fullscreenElement&&(this.buttons?.fullscreen.setIcon("enter-fullscreen"),window.removeEventListener("fullscreenchange",e))};window.addEventListener("fullscreenchange",e)}}async update(e){for(let t in CD){let n=this.buttons[t],i=e[t];n.button.disabled=!i.enabled,n.button.title=i.title,n.setIcon(i.icon),n.hidden=!!i.hidden}}};lm=new WeakSet,O6=function(e){switch(e){case"fullscreen":this.onFullscreenButton();break;case"jump-to-start":this.controller?.jumpToStart({flash:!0});break;case"play-step-backwards":this.controller?.animationController.play({direction:tt.Backwards,untilBoundary:kt.Move});break;case"play-pause":this.controller?.togglePlay();break;case"play-step":this.controller?.animationController.play({direction:tt.Forwards,untilBoundary:kt.Move});break;case"jump-to-end":this.controller?.jumpToEnd({flash:!0});break;case"twizzle-link":this.controller?.visitTwizzleLink();break;default:throw new Error("Missing command")}};Qe.define("twisty-buttons-v2",am);var um,ay=class extends rt{constructor(){super(...arguments);this.button=document.createElement("button");H(this,um,new zn(this,"svg-",_D))}connectedCallback(){this.addCSS(sm),this.addElement(this.button)}setIcon(e){S(this,um).setValue(e)}};um=new WeakMap;Qe.define("twisty-button-v2",ay);Tt();var cm=new Xt(`
|
|
7275
7275
|
:host {
|
|
7276
7276
|
width: 384px;
|
|
7277
7277
|
height: 16px;
|
|
@@ -7316,7 +7316,7 @@ input {
|
|
|
7316
7316
|
height: 50%;
|
|
7317
7317
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
7318
7318
|
}
|
|
7319
|
-
`);Ft();un();var O6=!1,cm=!1;Ur?.addEventListener("mousedown",function(r){r.which&&(cm=!0)},!0);Ur?.addEventListener("mouseup",function(r){r.which&&(cm=!1)},!0);var ay=0,hm=0;Ur?.addEventListener("mousedown",()=>{hm++},!1);Ur?.addEventListener("mousemove",PD,!1);Ur?.addEventListener("mouseenter",PD,!1);function PD(r){ay=r.pageY}var kD=0,BD=0,ly=!1,uy=0,pm,fm=class extends rt{constructor(e){super();this.model=e;H(this,pm,null)}async onDetailedTimelineInfo(e){let t=await this.inputElem();t.min=e.timeRange.start.toString(),t.max=e.timeRange.end.toString(),t.value=e.timestamp.toString()}async connectedCallback(){this.addCSS(um),this.addElement(await this.inputElem())}async inputElem(){return S(this,pm)??$(this,pm,(async()=>{let e=document.createElement("input");return e.type="range",this.model?.detailedTimelineInfoProp.addFreshListener(this.onDetailedTimelineInfo.bind(this)),e.addEventListener("input",this.onInput.bind(this)),e})())}async onInput(e){if(ly)return;let t=await this.inputElem();await this.slowDown(e,t);let n=parseInt(t.value);this.model?.playingInfoProp.set({playing:!1}),this.model?.timestampRequestProp.set(n)}async slowDown(e,t){if(!!O6&&cm){let n=t.getBoundingClientRect(),i=n.top+n.height/2;console.log(i,e,ay,cm);let o=Math.abs(i-ay),s=1;o>64&&(s=Math.max(Math.pow(2,-(o-64)/64),1/32));let a=parseInt(t.value);if(console.log("cl",uy,hm,a),uy===hm){let l=(a-BD)*s;console.log("delta",l,o),ly=!0;let u=a;u=kD+l*s+(a-kD)*Math.min(1,Math.pow(1/2,o*o/64)),t.value=u.toString(),console.log(s),ly=!1,this.contentWrapper.style.opacity=s.toString()}else uy=hm;BD=a}}};pm=new WeakMap;Qe.define("twisty-scrubber-v2",fm);li();var G6=null;async function cy(r,e){let t=e?.width??2048,n=e?.height??2048,i=t/n,o=G6??(G6=await(async()=>new(await In).PerspectiveCamera(20,i,.1,20))()),s=new(await In).Scene,a=new oh(r,{scheduleRender:()=>{}},await r.puzzleLoaderProp.get(),await r.visualizationStrategyProp.get());await r.stickeringProp.get(),await new Promise(h=>setTimeout(h,1e3)),await r.legacyPositionProp.get(),s.add(await a.twisty3DPuzzle());let l=await r.orbitCoordinatesProp.get();await ny(o,l);let u=new ft({antialias:!0,alpha:!0});u.setSize(t,n),u.render(s,o);let c=u.domElement.toDataURL(),f=await hy(r);return{dataURL:c,download:async h=>{fy(c,h??f)}}}async function hy(r){let[e,t]=await Promise.all([r.puzzleIDProp.get(),r.algProp.get()]);return`[${e}]${t.alg.experimentalNumUnits()===0?"":" "+t.alg.toString()}`}function fy(r,e,t="png"){let n=document.createElement("a");n.href=r,n.download=`${e}.${t}`,n.click()}Oe();var Nr=class{constructor(e){this.warnings=Object.freeze(e?.warnings??[]),this.errors=Object.freeze(e?.errors??[]),Object.freeze(this)}add(e){return new Nr({warnings:this.warnings.concat(e?.warnings??[]),errors:this.errors.concat(e?.errors??[])})}log(){this.errors.length>0?console.error(`\u{1F6A8} ${this.errors[0]}`):this.warnings.length>0?console.warn(`\u26A0\uFE0F ${this.warnings[0]}`):console.info("\u{1F60E} No issues!")}};function py(r){try{let e=re.fromString(r),t=[];return e.toString()!==r&&t.push("Alg is non-canonical!"),{alg:e,issues:new Nr({warnings:t})}}catch(e){return{alg:new re,issues:new Nr({errors:[`Malformed alg: ${e.toString()}`]})}}}function W6(r,e){return r.alg.isIdentical(e.alg)&&Oc(r.issues.warnings,e.issues.warnings)&&Oc(r.issues.errors,e.issues.errors)}var dm=class extends $n{getDefaultValue(){return{alg:new re,issues:new Nr}}canReuseValue(e,t){return W6(e,t)}async derive(e){return typeof e=="string"?py(e):{alg:e,issues:new Nr}}};var dy=class extends mt{getDefaultValue(){return"auto"}};var my=class extends mt{getDefaultValue(){return"auto"}};var gy=class extends mt{getDefaultValue(){return"auto"}};var yy=class extends mt{getDefaultValue(){return"auto"}};var vy=class extends mt{getDefaultValue(){return"auto"}};var V6=35,xy=class extends mt{getDefaultValue(){return V6}};function wy(r,e){return r.latitude===e.latitude&&r.longitude===e.longitude&&r.distance===e.distance}var by=class extends $n{getDefaultValue(){return"auto"}canReuseValue(e,t){return e===t||wy(e,t)}async derive(e,t){if(e==="auto")return"auto";let n=await t;n==="auto"&&(n={});let i=Object.assign({},n);return Object.assign(i,e),typeof i.latitude!="undefined"&&(i.latitude=Math.min(Math.max(i.latitude,-90),90)),typeof i.longitude!="undefined"&&(i.longitude=E2(i.longitude,360,180)),i}};var Sy=class extends $n{async getDefaultValue(){return{direction:tt.Forwards,playing:!1,untilBoundary:kt.EntireTimeline,loop:!1}}async derive(e,t){let n=await t,i=Object.assign({},n);return Object.assign(i,e),i}canReuseValue(e,t){return e.direction===t.direction&&e.playing===t.playing&&e.untilBoundary===t.untilBoundary&&e.loop===t.loop}};var Ly=class extends mt{getDefaultValue(){return Br}};var Ay=class extends mt{getDefaultValue(){return Br}};qn();var Dy=class extends He{derive(e){if(e.puzzleIDRequest&&e.puzzleIDRequest!==Br){let t=Ot[e.puzzleIDRequest];return t||this.userVisibleErrorTracker.set({errors:[`Invalid puzzle ID: ${e.puzzleIDRequest}`]}),t}return e.puzzleDescriptionRequest&&e.puzzleDescriptionRequest!==Br?gf(e.puzzleDescriptionRequest):no}};var Ey=class extends mt{getDefaultValue(){return"start"}};var My=class extends mt{getDefaultValue(){return"full"}};var Ry=class extends $n{getDefaultValue(){return 1}derive(e){return e<0?1:e}};var H6={start:!0,end:!0,anchor:!0,"opposite-anchor":!0},Ty=class extends mt{getDefaultValue(){return"opposite-anchor"}set(e){!this.validInput(e)||super.set(e)}validInput(e){return!!(typeof e=="number"||H6[e])}};var mm=class extends $n{getDefaultValue(){return null}derive(e){return typeof e=="string"?new URL(e,location.href):e}};var Fy=class extends mt{getDefaultValue(){return"auto"}};var _y=class extends mt{getDefaultValue(){return"auto"}};qc();var Cy=class extends He{canReuseValue(e,t){return wy(e,t)}async derive(e){if(e.orbitCoordinatesRequest==="auto")return Hc(e.puzzleID,e.strategy);let t=Object.assign(Object.assign({},Hc(e.puzzleID,e.strategy),e.orbitCoordinatesRequest));if(Math.abs(t.latitude)<=e.latitudeLimit)return t;{let{latitude:n,longitude:i,distance:o}=t;return{latitude:e.latitudeLimit*Math.sign(n),longitude:i,distance:o}}}};var Py=class extends He{async derive(e){return e.puzzleLoader.id}};var q6=null;async function j6(){return q6??(q6=new(await In).TextureLoader)}var gm=class extends He{async derive(e){let{spriteURL:t}=e;return t===null?null:new Promise(async(n,i)=>{let o=()=>{console.warn("Could not load sprite:",t.toString()),n(null)};try{(await j6()).load(t.toString(),n,o,o)}catch(s){o()}})}};var ky=class extends He{derive(e){switch(e.puzzleID){case"clock":case"square1":return"2D";case"3x3x3":switch(e.visualizationRequest){case"auto":case"3D":return"Cube3D";default:return e.visualizationRequest}default:switch(e.visualizationRequest){case"auto":case"3D":return"PG3D";case"experimental-2D-LL":return"2D";default:return e.visualizationRequest}}}};Oe();Oe();function rr(r){switch(Math.abs(r)){case 0:return 0;case 1:return 1e3;case 2:return 1500;default:return 2e3}}var ch=class extends Cn{constructor(e=rr){super();this.durationForAmount=e}traverseAlg(e){let t=0;for(let n of e.units())t+=this.traverseUnit(n);return t}traverseGrouping(e){return e.amount*this.traverseAlg(e.alg)}traverseMove(e){return this.durationForAmount(e.amount)}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return this.durationForAmount(1)}traverseNewline(e){return this.durationForAmount(1)}traverseLineComment(e){return this.durationForAmount(0)}};var Xs=class{constructor(e,t){this.puzzle=e;this.durationFn=new ch(rr);this.moves=new re(t.experimentalExpand())}getAnimLeaf(e){return Array.from(this.moves.units())[e]}indexToMoveStartTimestamp(e){let t=new re(Array.from(this.moves.units()).slice(0,e));return this.durationFn.traverseAlg(t)}timestampToIndex(e){let t=0,n;for(n=0;n<this.numAnimatedLeaves();n++)if(t+=this.durationFn.traverseMove(this.getAnimLeaf(n)),t>=e)return n;return n}stateAtIndex(e){return this.puzzle.combine(this.puzzle.startState(),this.transformAtIndex(e))}transformAtIndex(e){let t=this.puzzle.identity();for(let n of Array.from(this.moves.units()).slice(0,e))t=this.puzzle.combine(t,this.puzzle.stateFromMove(n));return t}algDuration(){return this.durationFn.traverseAlg(this.moves)}numAnimatedLeaves(){return id(this.moves)}moveDuration(e){return this.durationFn.traverseMove(this.getAnimLeaf(e))}};Oe();Oe();var zD={u:"y",l:"x",f:"z",r:"x",b:"z",d:"y",m:"x",e:"y",s:"z",x:"x",y:"y",z:"z"};function Q6(r,e){return zD[r.family[0].toLowerCase()]===zD[e.family[0].toLowerCase()]}var ID=class extends Cn{traverseAlg(e){let t=[];for(let n of e.units())t.push(this.traverseUnit(n));return Array.prototype.concat(...t)}traverseGroupingOnce(e){if(e.experimentalIsEmpty())return[];for(let o of e.units())if(!o.is(E))return this.traverseAlg(e);let t=Array.from(e.units()),n=rr(t[0].amount);for(let o=0;o<t.length-1;o++){for(let s=1;s<t.length;s++)if(!Q6(t[o],t[s]))return this.traverseAlg(e);n=Math.max(n,rr(t[o].amount))}let i=t.map(o=>({animLeafUnit:o,msUntilNext:0,duration:n}));return i[i.length-1].msUntilNext=n,i}traverseGrouping(e){let t=[],n=e.amount>0?e.alg:e.alg.invert();for(let i=0;i<Math.abs(e.amount);i++)t.push(this.traverseGroupingOnce(n));return Array.prototype.concat(...t)}traverseMove(e){let t=rr(e.amount);return[{animLeafUnit:e,msUntilNext:t,duration:t}]}traverseCommutator(e){let t=[],n=[e.A,e.B,e.A.invert(),e.B.invert()];for(let i of n)t.push(this.traverseGroupingOnce(i));return Array.prototype.concat(...t)}traverseConjugate(e){let t=[],n=[e.A,e.B,e.A.invert()];for(let i of n)t.push(this.traverseGroupingOnce(i));return Array.prototype.concat(...t)}traversePause(e){let t=rr(1);return[{animLeafUnit:e,msUntilNext:t,duration:t}]}traverseNewline(e){return[]}traverseLineComment(e){return[]}},UD=new ID,Y6=UD.traverseAlg.bind(UD);function ym(r){let e=0;return Y6(r).map(n=>{let i={animLeaf:n.animLeafUnit,start:e,end:e+n.duration};return e+=n.msUntilNext,i})}var X6={"y' y' U' E D R2 r2 F2 B2 U E D' R2 L2' z2 S2 U U D D S2 F2' B2":[{animLeaf:new E("y",-1),start:0,end:1e3},{animLeaf:new E("y",-1),start:1e3,end:2e3},{animLeaf:new E("U",-1),start:1e3,end:1600},{animLeaf:new E("E",1),start:1200,end:1800},{animLeaf:new E("D"),start:1400,end:2e3},{animLeaf:new E("R",2),start:2e3,end:3500},{animLeaf:new E("r",2),start:2e3,end:3500},{animLeaf:new E("F",2),start:3500,end:4200},{animLeaf:new E("B",2),start:3800,end:4500},{animLeaf:new E("U",1),start:4500,end:5500},{animLeaf:new E("E",1),start:4500,end:5500},{animLeaf:new E("D",-1),start:4500,end:5500},{animLeaf:new E("R",2),start:5500,end:6500},{animLeaf:new E("L",-2),start:5500,end:6500},{animLeaf:new E("z",2),start:5500,end:6500},{animLeaf:new E("S",2),start:6500,end:7500},{animLeaf:new E("U"),start:7500,end:8e3},{animLeaf:new E("D"),start:7750,end:8250},{animLeaf:new E("U"),start:8e3,end:8500},{animLeaf:new E("D"),start:8250,end:8750},{animLeaf:new E("S",2),start:8750,end:9250},{animLeaf:new E("F",-2),start:8750,end:1e4},{animLeaf:new E("B",2),start:8750,end:1e4}],"M' R' U' D' M R":[{animLeaf:new E("M",-1),start:0,end:1e3},{animLeaf:new E("R",-1),start:0,end:1e3},{animLeaf:new E("U",-1),start:1e3,end:2e3},{animLeaf:new E("D",-1),start:1e3,end:2e3},{animLeaf:new E("M"),start:2e3,end:3e3},{animLeaf:new E("R"),start:2e3,end:3e3}],"U' E' r E r2' E r U E":[{animLeaf:new E("U",-1),start:0,end:1e3},{animLeaf:new E("E",-1),start:0,end:1e3},{animLeaf:new E("r"),start:1e3,end:2500},{animLeaf:new E("E"),start:2500,end:3500},{animLeaf:new E("r",-2),start:3500,end:5e3},{animLeaf:new E("E"),start:5e3,end:6e3},{animLeaf:new E("r"),start:6e3,end:7e3},{animLeaf:new E("U"),start:7e3,end:8e3},{animLeaf:new E("E"),start:7e3,end:8e3}]},vm=class{constructor(e,t){this.puzzle=e;this.animLeaves=X6[t.toString()]??ym(t)}getAnimLeaf(e){return this.animLeaves[Math.min(e,this.animLeaves.length-1)]?.animLeaf??null}getAnimLeafWithRange(e){return this.animLeaves[Math.min(e,this.animLeaves.length-1)]}indexToMoveStartTimestamp(e){let t=0;return this.animLeaves.length>0&&(t=this.animLeaves[Math.min(e,this.animLeaves.length-1)].start),t}timestampToIndex(e){let t=0;for(t=0;t<this.animLeaves.length;t++)if(this.animLeaves[t].start>=e)return Math.max(0,t-1);return Math.max(0,t-1)}timestampToPosition(e,t){let n=this.currentMoveInfo(e),i=t??this.puzzle.identity();for(let o of this.animLeaves.slice(0,n.stateIndex)){let s=o.animLeaf.as(E);s!==null&&(i=this.puzzle.combine(i,this.puzzle.stateFromMove(s)))}return{state:i,movesInProgress:n.currentMoves}}currentMoveInfo(e){let t=1/0;for(let c of this.animLeaves)if(c.start<=e&&c.end>=e)t=Math.min(t,c.start);else if(c.start>e)break;let n=[],i=[],o=[],s=[],a=-1/0,l=1/0,u=0;for(let c of this.animLeaves)if(c.end<=t)u++;else{if(c.start>e)break;{let f=c.animLeaf.as(E);if(f!==null){let h=(e-c.start)/(c.end-c.start),p=!1;h>1&&(h=1,p=!0);let d={move:f,direction:tt.Forwards,fraction:h,startTimestamp:c.start,endTimestamp:c.end};switch(h){case 0:i.push(d);break;case 1:p?s.push(d):o.push(d);break;default:n.push(d),a=Math.max(a,c.start),l=Math.min(l,c.end)}}}}return{stateIndex:u,currentMoves:n,latestStart:a,earliestEnd:l,movesStarting:i,movesFinishing:o,movesFinished:s}}stateAtIndex(e,t){let n=t??this.puzzle.startState();for(let i=0;i<this.animLeaves.length&&i<e;i++){let s=this.animLeaves[i].animLeaf.as(E);s!==null&&(n=this.puzzle.combine(n,this.puzzle.stateFromMove(s)))}return n}transformAtIndex(e){let t=this.puzzle.identity();for(let n of this.animLeaves.slice(0,e)){let i=n.animLeaf.as(E);i!==null&&(t=this.puzzle.combine(t,this.puzzle.stateFromMove(i)))}return t}algDuration(){let e=0;for(let t of this.animLeaves)e=Math.max(e,t.end);return e}numAnimatedLeaves(){return this.animLeaves.length}moveDuration(e){let t=this.getAnimLeafWithRange(e);return t.end-t.start}};Oe();Oe();var K6=16;function Z6(r,e){let t=new Gi,n=new Gi;for(let i of r.units())n.push(i),n.experimentalNumUnits()>=e&&(t.push(new nn(n.toAlg())),n.reset());return t.push(new nn(n.toAlg())),t.toAlg()}var ND=class extends Cn{traverseAlg(e){let t=e.experimentalNumUnits();return t<K6?e:Z6(e,Math.ceil(Math.sqrt(t)))}traverseGrouping(e){return new nn(this.traverseAlg(e.alg),e.amount)}traverseMove(e){return e}traverseCommutator(e){return new Nt(this.traverseAlg(e.A),this.traverseAlg(e.B))}traverseConjugate(e){return new Nt(this.traverseAlg(e.A),this.traverseAlg(e.B))}traversePause(e){return e}traverseNewline(e){return e}traverseLineComment(e){return e}},OD=new ND,GD=OD.traverseAlg.bind(OD);Oe();Oe();var Bo=class{constructor(e,t,n,i,o,s=[]){this.moveCount=t;this.duration=n;this.forward=i;this.backward=o;this.children=s}},By=class extends Cn{constructor(e){super();this.puz=e;this.durationFn=new ch(rr);this.cache={};this.identity=e.identity(),this.dummyLeaf=new Bo(e,0,0,this.identity,this.identity,[])}traverseAlg(e){let t=0,n=0,i=this.identity,o=[];for(let s of e.units()){let a=this.traverseUnit(s);t+=a.moveCount,n+=a.duration,i===this.identity?i=a.forward:i=this.puz.combine(i,a.forward),o.push(a)}return new Bo(this.puz,t,n,i,this.puz.invert(i),o)}traverseGrouping(e){let t=this.traverseAlg(e.alg);return this.mult(t,e.amount,[t])}traverseMove(e){let t=e.toString(),n=this.cache[t];return n||(n=new Bo(this.puz,1,this.durationFn.traverseUnit(e),this.puz.stateFromMove(e),this.puz.stateFromMove(e.invert())),this.cache[t]=n,n)}traverseCommutator(e){let t=this.traverseAlg(e.A),n=this.traverseAlg(e.B),i=this.puz.combine(t.forward,n.forward),o=this.puz.combine(t.backward,n.backward),s=this.puz.combine(i,o),a=new Bo(this.puz,2*(t.moveCount+n.moveCount),2*(t.duration+n.duration),s,this.puz.invert(s),[t,n]);return this.mult(a,1,[a,t,n])}traverseConjugate(e){let t=this.traverseAlg(e.A),n=this.traverseAlg(e.B),i=this.puz.combine(t.forward,n.forward),o=this.puz.combine(i,t.backward),s=new Bo(this.puz,2*t.moveCount+n.moveCount,2*t.duration+n.duration,o,this.puz.invert(o),[t,n]);return this.mult(s,1,[s,t,n])}traversePause(e){return new Bo(this.puz,1,this.durationFn.traverseUnit(e),this.identity,this.identity)}traverseNewline(e){return this.dummyLeaf}traverseLineComment(e){return this.dummyLeaf}mult(e,t,n){let i=Math.abs(t),o=this.puz.multiply(e.forward,t);return new Bo(this.puz,e.moveCount*i,e.duration*i,o,this.puz.invert(o),n)}},$t=class{constructor(e,t){this.apd=e;this.back=t}},zy=class extends ri{constructor(e,t,n){super();this.puz=e;this.algOrUnit=t;this.apd=n;this.i=-1,this.dur=-1,this.goali=-1,this.goaldur=-1,this.move=void 0,this.back=!1,this.moveDuration=0,this.st=this.puz.identity(),this.root=new $t(this.apd,!1)}moveByIndex(e){return this.i>=0&&this.i===e?this.move!==void 0:this.dosearch(e,1/0)}moveByDuration(e){return this.dur>=0&&this.dur<e&&this.dur+this.moveDuration>=e?this.move!==void 0:this.dosearch(1/0,e)}dosearch(e,t){return this.goali=e,this.goaldur=t,this.i=0,this.dur=0,this.move=void 0,this.moveDuration=0,this.back=!1,this.st=this.puz.identity(),this.algOrUnit.is(re)?this.traverseAlg(this.algOrUnit,this.root):this.traverseUnit(this.algOrUnit,this.root)}traverseAlg(e,t){if(!this.firstcheck(t))return!1;let n=t.back?e.experimentalNumUnits()-1:0;for(let i of Bh(e.units(),t.back?Ce.Backwards:Ce.Forwards)){if(this.traverseUnit(i,new $t(t.apd.children[n],t.back)))return!0;n+=t.back?-1:1}return!1}traverseGrouping(e,t){if(!this.firstcheck(t))return!1;let n=this.domult(t,e.amount);return this.traverseAlg(e.alg,new $t(t.apd.children[0],n))}traverseMove(e,t){return this.firstcheck(t)?(this.move=e,this.moveDuration=t.apd.duration,this.back=t.back,!0):!1}traverseCommutator(e,t){if(!this.firstcheck(t))return!1;let n=this.domult(t,1);return n?this.traverseAlg(e.B,new $t(t.apd.children[2],!n))||this.traverseAlg(e.A,new $t(t.apd.children[1],!n))||this.traverseAlg(e.B,new $t(t.apd.children[2],n))||this.traverseAlg(e.A,new $t(t.apd.children[1],n)):this.traverseAlg(e.A,new $t(t.apd.children[1],n))||this.traverseAlg(e.B,new $t(t.apd.children[2],n))||this.traverseAlg(e.A,new $t(t.apd.children[1],!n))||this.traverseAlg(e.B,new $t(t.apd.children[2],!n))}traverseConjugate(e,t){if(!this.firstcheck(t))return!1;let n=this.domult(t,1);return n?this.traverseAlg(e.A,new $t(t.apd.children[1],!n))||this.traverseAlg(e.B,new $t(t.apd.children[2],n))||this.traverseAlg(e.A,new $t(t.apd.children[1],n)):this.traverseAlg(e.A,new $t(t.apd.children[1],n))||this.traverseAlg(e.B,new $t(t.apd.children[2],n))||this.traverseAlg(e.A,new $t(t.apd.children[1],!n))}traversePause(e,t){return this.firstcheck(t)?(this.move=e,this.moveDuration=t.apd.duration,this.back=t.back,!0):!1}traverseNewline(e,t){return!1}traverseLineComment(e,t){return!1}firstcheck(e){return e.apd.moveCount+this.i<=this.goali&&e.apd.duration+this.dur<this.goaldur?this.keepgoing(e):!0}domult(e,t){let n=e.back;if(t===0)return n;t<0&&(n=!n,t=-t);let i=e.apd.children[0],o=Math.min(Math.floor((this.goali-this.i)/i.moveCount),Math.ceil((this.goaldur-this.dur)/i.duration-1));return o>0&&this.keepgoing(new $t(i,n),o),n}keepgoing(e,t=1){return this.i+=t*e.apd.moveCount,this.dur+=t*e.apd.duration,t!==1?e.back?this.st=this.puz.combine(this.st,this.puz.multiply(e.apd.backward,t)):this.st=this.puz.combine(this.st,this.puz.multiply(e.apd.forward,t)):e.back?this.st=this.puz.combine(this.st,e.apd.backward):this.st=this.puz.combine(this.st,e.apd.forward),!1}};var ei=class{constructor(e,t){this.puzzle=e;let n=new By(this.puzzle),i=GD(t);this.decoration=n.traverseAlg(i),this.walker=new zy(this.puzzle,i,this.decoration)}getAnimLeaf(e){if(this.walker.moveByIndex(e)){if(!this.walker.move)throw new Error("`this.walker.mv` missing");let t=this.walker.move;return this.walker.back?t.invert():t}return null}indexToMoveStartTimestamp(e){if(this.walker.moveByIndex(e)||this.walker.i===e)return this.walker.dur;throw new Error(`Out of algorithm: index ${e}`)}indexToMovesInProgress(e){if(this.walker.moveByIndex(e)||this.walker.i===e)return this.walker.dur;throw new Error(`Out of algorithm: index ${e}`)}stateAtIndex(e,t){return this.walker.moveByIndex(e),this.puzzle.combine(t??this.puzzle.startState(),this.walker.st)}transformAtIndex(e){return this.walker.moveByIndex(e),this.walker.st}numAnimatedLeaves(){return this.decoration.moveCount}timestampToIndex(e){return this.walker.moveByDuration(e),this.walker.i}algDuration(){return this.decoration.duration}moveDuration(e){return this.walker.moveByIndex(e),this.walker.moveDuration}};var Iy=class extends He{derive(e){switch(e.indexerConstructorRequest){case"auto":return Bs(e.alg.alg)<100&&e.puzzle==="3x3x3"&&e.visualizationStrategy==="Cube3D"?vm:ei;case"tree":return ei;case"simple":return Xs;case"simultaneous":return vm;default:throw new Error("Invalid indexer request!")}}};Oe();Ht();var xm=class extends He{async derive(e){try{return new pn(e.puzzleDef).applyAlg(e.algWithIssues.alg),e.algWithIssues}catch(t){return{alg:new re,issues:new Nr({errors:[`Invalid alg for puzzle: ${t.toString()}`]})}}}};Ht();qn();var WD=class{multiply(e,t){if(t<0)return this.invert(this.multiply(e,-t));if(t===0)return this.identity();for(;t%2==0;)t=t/2,e=this.combine(e,e);let n=e;for(t--;t>0;)t%2==1&&(n=this.combine(n,e)),t=Math.floor(t/2),t>0&&(e=this.combine(e,e));return n}},Tn=class extends WD{constructor(e){super();this.definition=e;this.moveCache={}}static async fromID(e){return new Tn(await Ot[e].def())}startState(){return this.definition.startPieces}invert(e){return Wi(this.definition,e)}combine(e,t){return gt(this.definition,e,t)}stateFromMove(e){let t=e.toString();return this.moveCache[t]||(this.moveCache[t]=Ai(this.definition,e)),this.moveCache[t]}identity(){return Li(this.definition)}equivalent(e,t){return Qh(this.definition,e,t)}};var Uy=class extends He{derive(e){return this.applyAlg(e.def,e.alg.alg)}applyAlg(e,t){let n=new Tn(e),i=new ei(n,t);return i.transformAtIndex(i.numAnimatedLeaves())}};var Ny=class extends He{derive(e){let t=new Tn(e.def);return new e.indexerConstructor(t,e.algWithIssues.alg)}};Ht();var Oy=class extends He{derive(e){switch(e.setupAnchor){case"start":return e.setupTransformation;case"end":{let t=e.indexer.transformAtIndex(e.indexer.numAnimatedLeaves()),n=Wi(e.def,t);return gt(e.def,e.setupTransformation,n)}default:throw new Error("Unimplemented!")}}};var Gy=class extends He{derive(e){return{start:0,end:e.indexer.algDuration()}}};var wm,J6,Wy=class extends He{constructor(){super(...arguments);H(this,wm)}derive(e){let t=ye(this,wm,J6).call(this,e),n=!1,i=!1;return t>=e.timeRange.end&&(i=!0,t=Math.min(e.timeRange.end,t)),t<=e.timeRange.start&&(n=!0,t=Math.max(e.timeRange.start,t)),{timestamp:t,timeRange:e.timeRange,atStart:n,atEnd:i}}canReuse(e,t){return e.timestamp===t.timestamp&&e.timeRange.start===t.timeRange.start&&e.timeRange.end===t.timeRange.end&&e.atStart===t.atStart&&e.atEnd===t.atEnd}};wm=new WeakSet,J6=function(e){switch(e.timestampRequest){case"start":return e.timeRange.start;case"end":return e.timeRange.end;case"anchor":return e.setupAnchor==="start"?e.timeRange.start:e.timeRange.end;case"opposite-anchor":return e.setupAnchor==="start"?e.timeRange.end:e.timeRange.start;default:return e.timestampRequest}};var Vy=class extends He{derive(e){return{playing:e.playingInfo.playing,atStart:e.detailedTimelineInfo.atStart,atEnd:e.detailedTimelineInfo.atEnd}}canReuseValue(e,t){return e.playing===t.playing&&e.atStart===t.atStart&&e.atEnd===t.atEnd}};Oe();var Hy=class extends He{derive(e){function t(n){return e.detailedTimelineInfo.atEnd&&e.catchUpMove.move!==null&&n.currentMoves.push({move:e.catchUpMove.move,direction:tt.Backwards,fraction:1-e.catchUpMove.amount,startTimestamp:-1,endTimestamp:-1}),n}if(e.indexer.currentMoveInfo)return t(e.indexer.currentMoveInfo(e.detailedTimelineInfo.timestamp));{let n=e.indexer.timestampToIndex(e.detailedTimelineInfo.timestamp),i={stateIndex:n,currentMoves:[],movesFinishing:[],movesFinished:[],movesStarting:[],latestStart:-1/0,earliestEnd:1/0};if(e.indexer.numAnimatedLeaves()>0){let o=e.indexer.getAnimLeaf(n)?.as(E);if(!o)return t(i);let s=e.indexer.indexToMoveStartTimestamp(n),a=e.indexer.moveDuration(n),l=(e.detailedTimelineInfo.timestamp-s)/a,u=s+a,c={move:o,direction:tt.Forwards,fraction:l,startTimestamp:s,endTimestamp:u};l===0?i.movesStarting.push(c):l===1?i.movesFinishing.push(c):(i.currentMoves.push(c),i.latestStart=Math.max(i.latestStart,s),i.earliestEnd=Math.min(i.earliestEnd,u))}return t(i)}}};var qy=class extends He{derive(e){return{stateIndex:e.currentMoveInfo.stateIndex,movesFinishing:e.currentMoveInfo.movesFinishing.map(t=>t.move),movesFinished:e.currentMoveInfo.movesFinished.map(t=>t.move)}}canReuse(e,t){return e.stateIndex===t.stateIndex&&D2(e.movesFinishing,t.movesFinishing,(n,i)=>n.isIdentical(i))&&D2(e.movesFinished,t.movesFinished,(n,i)=>n.isIdentical(i))}};Ht();var jy=class extends He{derive(e){let t=e.indexer.transformAtIndex(e.currentLeavesSimplified.stateIndex);t=gt(e.def,e.anchoredStart,t);let n=new Tn(e.def);for(let i of e.currentLeavesSimplified.movesFinishing)t=gt(e.def,t,n.stateFromMove(i));for(let i of e.currentLeavesSimplified.movesFinished)t=gt(e.def,t,n.stateFromMove(i));return t}};var Qy=class extends He{derive(e){return{state:e.transformation,movesInProgress:e.currentMoveInfo.currentMoves}}};var Yy=class extends He{async derive(e){return e.puzzleLoader.def()}};var $6={errors:[]},Xy=class extends mt{getDefaultValue(){return $6}reset(){this.set(this.getDefaultValue())}canReuseValue(e,t){return Oc(e.errors,t.errors)}};var Ky=class extends mt{getDefaultValue(){return{move:null,amount:0}}canReuseValue(e,t){return e.move===t.move&&e.amount===t.amount}};var Zy=class{constructor(){this.userVisibleErrorTracker=new Xy;this.algProp=new dm;this.backgroundProp=new dy;this.backViewProp=new my;this.controlPanelProp=new gy;this.catchUpMoveProp=new Ky;this.foundationStickerSpriteURL=new mm;this.hintFaceletProp=new yy;this.hintStickerSpriteURL=new mm;this.indexerConstructorRequestProp=new vy;this.latitudeLimitProp=new xy;this.orbitCoordinatesRequestProp=new by;this.playingInfoProp=new Sy;this.puzzleDescriptionRequestProp=new Ly;this.puzzleIDRequestProp=new Ay;this.setupAnchorProp=new Ey;this.setupProp=new dm;this.stickeringProp=new My;this.tempoScaleProp=new Ry;this.timestampRequestProp=new Ty;this.viewerLinkProp=new Fy;this.visualizationFormatProp=new _y;this.foundationStickerSprite=new gm({spriteURL:this.foundationStickerSpriteURL});this.hintStickerSprite=new gm({spriteURL:this.hintStickerSpriteURL});this.puzzleLoaderProp=new Dy({puzzleIDRequest:this.puzzleIDRequestProp,puzzleDescriptionRequest:this.puzzleDescriptionRequestProp},this.userVisibleErrorTracker);this.puzzleDefProp=new Yy({puzzleLoader:this.puzzleLoaderProp});this.puzzleIDProp=new Py({puzzleLoader:this.puzzleLoaderProp});this.puzzleAlgProp=new xm({algWithIssues:this.algProp,puzzleDef:this.puzzleDefProp});this.puzzleSetupProp=new xm({algWithIssues:this.setupProp,puzzleDef:this.puzzleDefProp});this.visualizationStrategyProp=new ky({visualizationRequest:this.visualizationFormatProp,puzzleID:this.puzzleIDProp});this.indexerConstructorProp=new Iy({alg:this.algProp,puzzle:this.puzzleIDProp,visualizationStrategy:this.visualizationStrategyProp,indexerConstructorRequest:this.indexerConstructorRequestProp});this.orbitCoordinatesProp=new Cy({orbitCoordinatesRequest:this.orbitCoordinatesRequestProp,latitudeLimit:this.latitudeLimitProp,puzzleID:this.puzzleIDProp,strategy:this.visualizationStrategyProp});this.setupTransformationProp=new Uy({alg:this.puzzleSetupProp,def:this.puzzleDefProp});this.indexerProp=new Ny({indexerConstructor:this.indexerConstructorProp,algWithIssues:this.puzzleAlgProp,def:this.puzzleDefProp});this.anchoredStartProp=new Oy({setupAnchor:this.setupAnchorProp,setupTransformation:this.setupTransformationProp,indexer:this.indexerProp,def:this.puzzleDefProp});this.timeRangeProp=new Gy({indexer:this.indexerProp});this.detailedTimelineInfoProp=new Wy({timestampRequest:this.timestampRequestProp,timeRange:this.timeRangeProp,setupAnchor:this.setupAnchorProp});this.coarseTimelineInfoProp=new Vy({detailedTimelineInfo:this.detailedTimelineInfoProp,playingInfo:this.playingInfoProp});this.currentLeavesProp=new Hy({indexer:this.indexerProp,detailedTimelineInfo:this.detailedTimelineInfoProp,catchUpMove:this.catchUpMoveProp});this.buttonAppearanceProp=new oy({coarseTimelineInfo:this.coarseTimelineInfoProp,viewerLink:this.viewerLinkProp});this.currentLeavesSimplifiedProp=new qy({currentMoveInfo:this.currentLeavesProp});this.currentTransformationProp=new jy({anchoredStart:this.anchoredStartProp,currentLeavesSimplified:this.currentLeavesSimplifiedProp,indexer:this.indexerProp,def:this.puzzleDefProp});this.legacyPositionProp=new Qy({currentMoveInfo:this.currentLeavesProp,transformation:this.currentTransformationProp})}async twizzleLink(){let e=new URL("https://alpha.twizzle.net/edit/"),[t,n,i,o]=await Promise.all([this.puzzleIDProp.get(),this.algProp.get(),this.setupProp.get(),this.setupAnchorProp.get()]);return n.alg.experimentalIsEmpty()||e.searchParams.set("alg",n.alg.toString()),i.alg.experimentalIsEmpty()||e.searchParams.set("setup-alg",i.alg.toString()),o!=="start"&&e.searchParams.set("setup-anchor",o),t!=="3x3x3"&&e.searchParams.set("puzzle",t),e.toString()}};Ft();function Un(r){return new Error(`Cannot get \`.${r}\` directly from a \`TwistyPlayer\`.`)}var Jy=class extends rt{constructor(){super(...arguments);this.experimentalModel=new Zy;this.experimentalGet=new VD(this.experimentalModel)}set alg(e){this.experimentalModel.algProp.set(e)}get alg(){throw Un("alg")}set experimentalSetupAlg(e){this.experimentalModel.setupProp.set(e)}get experimentalSetupAlg(){throw Un("setup")}set experimentalSetupAnchor(e){this.experimentalModel.setupAnchorProp.set(e)}get experimentalSetupAnchor(){throw Un("anchor")}set puzzle(e){this.experimentalModel.puzzleIDRequestProp.set(e)}get puzzle(){throw Un("puzzle")}set experimentalPuzzleDescription(e){this.experimentalModel.puzzleDescriptionRequestProp.set(e)}get experimentalPuzzleDescription(){throw Un("experimentalPuzzleDescription")}set timestamp(e){this.experimentalModel.timestampRequestProp.set(e)}get timestamp(){throw Un("timestamp")}set hintFacelets(e){this.experimentalModel.hintFaceletProp.set(e)}get hintFacelets(){throw Un("hintFacelets")}set experimentalStickering(e){this.experimentalModel.stickeringProp.set(e)}get experimentalStickering(){throw Un("stickering")}set backView(e){this.experimentalModel.backViewProp.set(e)}get backView(){throw Un("backView")}set background(e){this.experimentalModel.backgroundProp.set(e)}get background(){throw Un("background")}set controlPanel(e){this.experimentalModel.controlPanelProp.set(e)}get controlPanel(){throw new Error("Cannot get `.controlPanel` directly from a `TwistyPlayer`.")}set visualization(e){this.experimentalModel.visualizationFormatProp.set(e)}get visualization(){throw new Error("Cannot get `.visualization` directly from a `TwistyPlayer`.")}set viewerLink(e){this.experimentalModel.viewerLinkProp.set(e)}get viewerLink(){throw Un("viewerLink")}set cameraLatitude(e){this.experimentalModel.orbitCoordinatesRequestProp.set({latitude:e})}get cameraLatitude(){throw new Error("Cannot get `.cameraLatitude` directly from a `TwistyPlayer`.")}set cameraLongitude(e){this.experimentalModel.orbitCoordinatesRequestProp.set({longitude:e})}get cameraLongitude(){throw new Error("Cannot get `.cameraLongitude` directly from a `TwistyPlayer`.")}set cameraDistance(e){this.experimentalModel.orbitCoordinatesRequestProp.set({distance:e})}get cameraDistance(){throw new Error("Cannot get `.cameraDistance` directly from a `TwistyPlayer`.")}set cameraLatitudeLimit(e){this.experimentalModel.latitudeLimitProp.set(e)}get cameraLatitudeLimit(){throw new Error("Cannot get `.cameraLatitudeLimit` directly from a `TwistyPlayer`.")}set indexer(e){this.experimentalModel.indexerConstructorRequestProp.set(e)}get indexer(){throw Un("indexer")}set tempoScale(e){this.experimentalModel.tempoScaleProp.set(e)}get tempoScale(){throw Un("tempoScale")}set experimentalSprite(e){this.experimentalModel.foundationStickerSpriteURL.set(e)}get experimentalSprite(){throw Un("experimentalSprite")}set experimentalHintSprite(e){this.experimentalModel.hintStickerSpriteURL.set(e)}get experimentalHintSprite(){throw Un("experimentalHintSprite")}},VD=class{constructor(e){this.model=e}async alg(){return(await this.model.algProp.get()).alg}async setupAlg(){return(await this.model.setupProp.get()).alg}puzzleID(){return this.model.puzzleIDProp.get()}async timestamp(){return(await this.model.detailedTimelineInfoProp.get()).timestamp}};var $y={alg:"alg","experimental-setup-alg":"experimentalSetupAlg","experimental-setup-anchor":"experimentalSetupAnchor",puzzle:"puzzle","experimental-puzzle-description":"experimentalPuzzleDescription",visualization:"visualization","hint-facelets":"hintFacelets","experimental-stickering":"experimentalStickering",background:"background","control-panel":"controlPanel","back-view":"backView","viewer-link":"viewerLink","camera-latitude":"cameraLatitude","camera-longitude":"cameraLongitude","camera-distance":"cameraDistance","camera-latitude-limit":"cameraLatitudeLimit","tempo-scale":"tempoScale","experimental-sprite":"experimentalSprite","experimental-hint-sprite":"experimentalHintSprite"},eP=Object.fromEntries(Object.values($y).map(r=>[r,!0])),bm,hh,Xl,fh,or,ph,Sm,tP,zo=class extends Jy{constructor(e={}){super();H(this,Sm);this.controller=new T2(this.experimentalModel,this);this.experimentalCanvasClickCallback=()=>{};H(this,bm,new zn(this,"controls-",["auto"].concat(Object.keys(k2))));H(this,hh,document.createElement("div"));H(this,Xl,document.createElement("div"));H(this,fh,!1);H(this,or,null);H(this,ph,null);for(let[t,n]of Object.entries(e)){if(!eP[t]){console.warn(`Invalid config passed to TwistyPlayer: ${t}`);break}this[t]=n}}async connectedCallback(){if(S(this,fh))return;$(this,fh,!0),this.addCSS(Ld),this.addElement(S(this,hh)).classList.add("visualization-wrapper"),this.addElement(S(this,Xl)).classList.add("error-elem"),S(this,Xl).textContent="Error",this.experimentalModel.userVisibleErrorTracker.addFreshListener(t=>{let n=t.errors[0]??null;this.contentWrapper.classList.toggle("error",!!n),n&&(S(this,Xl).textContent=n)});let e=new fm(this.experimentalModel);this.contentWrapper.appendChild(e),this.buttons=new sm(this.experimentalModel,this.controller,this),this.contentWrapper.appendChild(this.buttons),this.experimentalModel.backgroundProp.addFreshListener(t=>{this.contentWrapper.classList.toggle("checkered",t!=="none")}),this.experimentalModel.controlPanelProp.addFreshListener(t=>{S(this,bm).setValue(t)}),this.experimentalModel.visualizationStrategyProp.addFreshListener(ye(this,Sm,tP).bind(this)),this.experimentalModel.puzzleIDProp.addFreshListener(this.flash.bind(this))}flash(){S(this,or)?.animate([{opacity:.25},{opacity:1}],{duration:250})}async experimentalCurrentCanvases(){this.connectedCallback();let e=S(this,or),t=[];if(e instanceof Ql){let n=e.experimentalVantages();for(let i of n)t.push(await i.canvas())}return t}async experimentalPG3D(){this.connectedCallback();let e=S(this,or);return e instanceof Ql,null}jumpToStart(e){this.controller.jumpToStart(e)}jumpToEnd(e){this.controller.jumpToEnd(e)}play(){this.controller.togglePlay(!0)}pause(){this.controller.togglePlay(!1)}togglePlay(e){this.controller.togglePlay(e)}experimentalAddMove(e,t={}){let n=typeof e=="string"?new E(e):e;(async()=>{let i=(await this.experimentalModel.algProp.get()).alg,o=fr(i,n,{coalesce:t?.coalesce});this.experimentalModel.algProp.set(o),this.experimentalModel.timestampRequestProp.set("end"),this.experimentalModel.catchUpMoveProp.set({move:n,amount:0})})()}static get observedAttributes(){return Object.keys($y)}attributeChangedCallback(e,t,n){let i=$y[e];!i||(this[i]=n)}async experimentalScreenshot(e){return(await cy(this.experimentalModel,e)).dataURL}async experimentalDownloadScreenshot(e){if(["2D","experimental-2D-LL"].includes(await this.experimentalModel.visualizationStrategyProp.get())){let n=await S(this,or).currentTwisty2DPuzzleWrapper().twisty2DPuzzle(),i=new XMLSerializer().serializeToString(n.svg.element),o=URL.createObjectURL(new Blob([i]));fy(o,e??await hy(this.experimentalModel),"svg")}else await(await cy(this.experimentalModel)).download(e)}};bm=new WeakMap,hh=new WeakMap,Xl=new WeakMap,fh=new WeakMap,or=new WeakMap,ph=new WeakMap,Sm=new WeakSet,tP=function(e){if(e!==S(this,ph)){S(this,or)?.remove(),S(this,or)?.disconnect();let t;switch(e){case"2D":case"experimental-2D-LL":t=new jd(this.experimentalModel,e);break;case"Cube3D":case"PG3D":t=new Ql(this.experimentalModel);break;default:throw new Error("Invalid visualization")}S(this,hh).appendChild(t),$(this,or,t),$(this,ph,e)}};Qe.define("twisty-player",zo);Oe();Ft();un();Ft();var HD=new Xt(`
|
|
7319
|
+
`);Tt();un();var G6=!1,hm=!1;Ur?.addEventListener("mousedown",function(r){r.which&&(hm=!0)},!0);Ur?.addEventListener("mouseup",function(r){r.which&&(hm=!1)},!0);var ly=0,fm=0;Ur?.addEventListener("mousedown",()=>{fm++},!1);Ur?.addEventListener("mousemove",PD,!1);Ur?.addEventListener("mouseenter",PD,!1);function PD(r){ly=r.pageY}var kD=0,BD=0,uy=!1,cy=0,dm,pm=class extends rt{constructor(e){super();this.model=e;H(this,dm,null)}async onDetailedTimelineInfo(e){let t=await this.inputElem();t.min=e.timeRange.start.toString(),t.max=e.timeRange.end.toString(),t.value=e.timestamp.toString()}async connectedCallback(){this.addCSS(cm),this.addElement(await this.inputElem())}async inputElem(){return S(this,dm)??$(this,dm,(async()=>{let e=document.createElement("input");return e.type="range",this.model?.detailedTimelineInfoProp.addFreshListener(this.onDetailedTimelineInfo.bind(this)),e.addEventListener("input",this.onInput.bind(this)),e})())}async onInput(e){if(uy)return;let t=await this.inputElem();await this.slowDown(e,t);let n=parseInt(t.value);this.model?.playingInfoProp.set({playing:!1}),this.model?.timestampRequestProp.set(n)}async slowDown(e,t){if(!!G6&&hm){let n=t.getBoundingClientRect(),i=n.top+n.height/2;console.log(i,e,ly,hm);let o=Math.abs(i-ly),s=1;o>64&&(s=Math.max(Math.pow(2,-(o-64)/64),1/32));let a=parseInt(t.value);if(console.log("cl",cy,fm,a),cy===fm){let l=(a-BD)*s;console.log("delta",l,o),uy=!0;let u=a;u=kD+l*s+(a-kD)*Math.min(1,Math.pow(1/2,o*o/64)),t.value=u.toString(),console.log(s),uy=!1,this.contentWrapper.style.opacity=s.toString()}else cy=fm;BD=a}}};dm=new WeakMap;Qe.define("twisty-scrubber-v2",pm);li();var W6=null;async function hy(r,e){let t=e?.width??2048,n=e?.height??2048,i=t/n,o=W6??(W6=await(async()=>new(await In).PerspectiveCamera(20,i,.1,20))()),s=new(await In).Scene,a=new oh(r,{scheduleRender:()=>{}},await r.puzzleLoaderProp.get(),await r.visualizationStrategyProp.get());await r.stickeringProp.get(),await new Promise(h=>setTimeout(h,1e3)),await r.legacyPositionProp.get(),s.add(await a.twisty3DPuzzle());let l=await r.orbitCoordinatesProp.get();await iy(o,l);let u=new ft({antialias:!0,alpha:!0});u.setSize(t,n),u.render(s,o);let c=u.domElement.toDataURL(),f=await fy(r);return{dataURL:c,download:async h=>{py(c,h??f)}}}async function fy(r){let[e,t]=await Promise.all([r.puzzleIDProp.get(),r.algProp.get()]);return`[${e}]${t.alg.experimentalNumUnits()===0?"":" "+t.alg.toString()}`}function py(r,e,t="png"){let n=document.createElement("a");n.href=r,n.download=`${e}.${t}`,n.click()}Oe();var Nr=class{constructor(e){this.warnings=Object.freeze(e?.warnings??[]),this.errors=Object.freeze(e?.errors??[]),Object.freeze(this)}add(e){return new Nr({warnings:this.warnings.concat(e?.warnings??[]),errors:this.errors.concat(e?.errors??[])})}log(){this.errors.length>0?console.error(`\u{1F6A8} ${this.errors[0]}`):this.warnings.length>0?console.warn(`\u26A0\uFE0F ${this.warnings[0]}`):console.info("\u{1F60E} No issues!")}};function dy(r){try{let e=re.fromString(r),t=[];return e.toString()!==r&&t.push("Alg is non-canonical!"),{alg:e,issues:new Nr({warnings:t})}}catch(e){return{alg:new re,issues:new Nr({errors:[`Malformed alg: ${e.toString()}`]})}}}function V6(r,e){return r.alg.isIdentical(e.alg)&&Oc(r.issues.warnings,e.issues.warnings)&&Oc(r.issues.errors,e.issues.errors)}var mm=class extends $n{getDefaultValue(){return{alg:new re,issues:new Nr}}canReuseValue(e,t){return V6(e,t)}async derive(e){return typeof e=="string"?dy(e):{alg:e,issues:new Nr}}};var my=class extends mt{getDefaultValue(){return"auto"}};var gy=class extends mt{getDefaultValue(){return"auto"}};var yy=class extends mt{getDefaultValue(){return"auto"}};var vy=class extends mt{getDefaultValue(){return"auto"}};var xy=class extends mt{getDefaultValue(){return"auto"}};var H6=35,wy=class extends mt{getDefaultValue(){return H6}};function by(r,e){return r.latitude===e.latitude&&r.longitude===e.longitude&&r.distance===e.distance}var Sy=class extends $n{getDefaultValue(){return"auto"}canReuseValue(e,t){return e===t||by(e,t)}async derive(e,t){if(e==="auto")return"auto";let n=await t;n==="auto"&&(n={});let i=Object.assign({},n);return Object.assign(i,e),typeof i.latitude!="undefined"&&(i.latitude=Math.min(Math.max(i.latitude,-90),90)),typeof i.longitude!="undefined"&&(i.longitude=M2(i.longitude,360,180)),i}};var Ly=class extends $n{async getDefaultValue(){return{direction:tt.Forwards,playing:!1,untilBoundary:kt.EntireTimeline,loop:!1}}async derive(e,t){let n=await t,i=Object.assign({},n);return Object.assign(i,e),i}canReuseValue(e,t){return e.direction===t.direction&&e.playing===t.playing&&e.untilBoundary===t.untilBoundary&&e.loop===t.loop}};var Ay=class extends mt{getDefaultValue(){return Br}};var Dy=class extends mt{getDefaultValue(){return Br}};qn();var Ey=class extends He{derive(e){if(e.puzzleIDRequest&&e.puzzleIDRequest!==Br){let t=Ot[e.puzzleIDRequest];return t||this.userVisibleErrorTracker.set({errors:[`Invalid puzzle ID: ${e.puzzleIDRequest}`]}),t}return e.puzzleDescriptionRequest&&e.puzzleDescriptionRequest!==Br?gf(e.puzzleDescriptionRequest):no}};var My=class extends mt{getDefaultValue(){return"start"}};var Ry=class extends mt{getDefaultValue(){return"full"}};var Ty=class extends $n{getDefaultValue(){return 1}derive(e){return e<0?1:e}};var q6={start:!0,end:!0,anchor:!0,"opposite-anchor":!0},Fy=class extends mt{getDefaultValue(){return"opposite-anchor"}set(e){!this.validInput(e)||super.set(e)}validInput(e){return!!(typeof e=="number"||q6[e])}};var gm=class extends $n{getDefaultValue(){return null}derive(e){return typeof e=="string"?new URL(e,location.href):e}};var _y=class extends mt{getDefaultValue(){return"auto"}};var Cy=class extends mt{getDefaultValue(){return"auto"}};qc();var Py=class extends He{canReuseValue(e,t){return by(e,t)}async derive(e){if(e.orbitCoordinatesRequest==="auto")return Hc(e.puzzleID,e.strategy);let t=Object.assign(Object.assign({},Hc(e.puzzleID,e.strategy),e.orbitCoordinatesRequest));if(Math.abs(t.latitude)<=e.latitudeLimit)return t;{let{latitude:n,longitude:i,distance:o}=t;return{latitude:e.latitudeLimit*Math.sign(n),longitude:i,distance:o}}}};var ky=class extends He{async derive(e){return e.puzzleLoader.id}};var j6=null;async function Q6(){return j6??(j6=new(await In).TextureLoader)}var ym=class extends He{async derive(e){let{spriteURL:t}=e;return t===null?null:new Promise(async(n,i)=>{let o=()=>{console.warn("Could not load sprite:",t.toString()),n(null)};try{(await Q6()).load(t.toString(),n,o,o)}catch(s){o()}})}};var By=class extends He{derive(e){switch(e.puzzleID){case"clock":case"square1":return"2D";case"3x3x3":switch(e.visualizationRequest){case"auto":case"3D":return"Cube3D";default:return e.visualizationRequest}default:switch(e.visualizationRequest){case"auto":case"3D":return"PG3D";case"experimental-2D-LL":return"2D";default:return e.visualizationRequest}}}};Oe();Oe();function rr(r){switch(Math.abs(r)){case 0:return 0;case 1:return 1e3;case 2:return 1500;default:return 2e3}}var ch=class extends Cn{constructor(e=rr){super();this.durationForAmount=e}traverseAlg(e){let t=0;for(let n of e.units())t+=this.traverseUnit(n);return t}traverseGrouping(e){return e.amount*this.traverseAlg(e.alg)}traverseMove(e){return this.durationForAmount(e.amount)}traverseCommutator(e){return 2*(this.traverseAlg(e.A)+this.traverseAlg(e.B))}traverseConjugate(e){return 2*this.traverseAlg(e.A)+this.traverseAlg(e.B)}traversePause(e){return this.durationForAmount(1)}traverseNewline(e){return this.durationForAmount(1)}traverseLineComment(e){return this.durationForAmount(0)}};var Xs=class{constructor(e,t){this.puzzle=e;this.durationFn=new ch(rr);this.moves=new re(t.experimentalExpand())}getAnimLeaf(e){return Array.from(this.moves.units())[e]}indexToMoveStartTimestamp(e){let t=new re(Array.from(this.moves.units()).slice(0,e));return this.durationFn.traverseAlg(t)}timestampToIndex(e){let t=0,n;for(n=0;n<this.numAnimatedLeaves();n++)if(t+=this.durationFn.traverseMove(this.getAnimLeaf(n)),t>=e)return n;return n}stateAtIndex(e){return this.puzzle.combine(this.puzzle.startState(),this.transformAtIndex(e))}transformAtIndex(e){let t=this.puzzle.identity();for(let n of Array.from(this.moves.units()).slice(0,e))t=this.puzzle.combine(t,this.puzzle.stateFromMove(n));return t}algDuration(){return this.durationFn.traverseAlg(this.moves)}numAnimatedLeaves(){return id(this.moves)}moveDuration(e){return this.durationFn.traverseMove(this.getAnimLeaf(e))}};Oe();Oe();var zD={u:"y",l:"x",f:"z",r:"x",b:"z",d:"y",m:"x",e:"y",s:"z",x:"x",y:"y",z:"z"};function Y6(r,e){return zD[r.family[0].toLowerCase()]===zD[e.family[0].toLowerCase()]}var ID=class extends Cn{traverseAlg(e){let t=[];for(let n of e.units())t.push(this.traverseUnit(n));return Array.prototype.concat(...t)}traverseGroupingOnce(e){if(e.experimentalIsEmpty())return[];for(let o of e.units())if(!o.is(E))return this.traverseAlg(e);let t=Array.from(e.units()),n=rr(t[0].amount);for(let o=0;o<t.length-1;o++){for(let s=1;s<t.length;s++)if(!Y6(t[o],t[s]))return this.traverseAlg(e);n=Math.max(n,rr(t[o].amount))}let i=t.map(o=>({animLeafUnit:o,msUntilNext:0,duration:n}));return i[i.length-1].msUntilNext=n,i}traverseGrouping(e){let t=[],n=e.amount>0?e.alg:e.alg.invert();for(let i=0;i<Math.abs(e.amount);i++)t.push(this.traverseGroupingOnce(n));return Array.prototype.concat(...t)}traverseMove(e){let t=rr(e.amount);return[{animLeafUnit:e,msUntilNext:t,duration:t}]}traverseCommutator(e){let t=[],n=[e.A,e.B,e.A.invert(),e.B.invert()];for(let i of n)t.push(this.traverseGroupingOnce(i));return Array.prototype.concat(...t)}traverseConjugate(e){let t=[],n=[e.A,e.B,e.A.invert()];for(let i of n)t.push(this.traverseGroupingOnce(i));return Array.prototype.concat(...t)}traversePause(e){let t=rr(1);return[{animLeafUnit:e,msUntilNext:t,duration:t}]}traverseNewline(e){return[]}traverseLineComment(e){return[]}},UD=new ID,X6=UD.traverseAlg.bind(UD);function vm(r){let e=0;return X6(r).map(n=>{let i={animLeaf:n.animLeafUnit,start:e,end:e+n.duration};return e+=n.msUntilNext,i})}var K6={"y' y' U' E D R2 r2 F2 B2 U E D' R2 L2' z2 S2 U U D D S2 F2' B2":[{animLeaf:new E("y",-1),start:0,end:1e3},{animLeaf:new E("y",-1),start:1e3,end:2e3},{animLeaf:new E("U",-1),start:1e3,end:1600},{animLeaf:new E("E",1),start:1200,end:1800},{animLeaf:new E("D"),start:1400,end:2e3},{animLeaf:new E("R",2),start:2e3,end:3500},{animLeaf:new E("r",2),start:2e3,end:3500},{animLeaf:new E("F",2),start:3500,end:4200},{animLeaf:new E("B",2),start:3800,end:4500},{animLeaf:new E("U",1),start:4500,end:5500},{animLeaf:new E("E",1),start:4500,end:5500},{animLeaf:new E("D",-1),start:4500,end:5500},{animLeaf:new E("R",2),start:5500,end:6500},{animLeaf:new E("L",-2),start:5500,end:6500},{animLeaf:new E("z",2),start:5500,end:6500},{animLeaf:new E("S",2),start:6500,end:7500},{animLeaf:new E("U"),start:7500,end:8e3},{animLeaf:new E("D"),start:7750,end:8250},{animLeaf:new E("U"),start:8e3,end:8500},{animLeaf:new E("D"),start:8250,end:8750},{animLeaf:new E("S",2),start:8750,end:9250},{animLeaf:new E("F",-2),start:8750,end:1e4},{animLeaf:new E("B",2),start:8750,end:1e4}],"M' R' U' D' M R":[{animLeaf:new E("M",-1),start:0,end:1e3},{animLeaf:new E("R",-1),start:0,end:1e3},{animLeaf:new E("U",-1),start:1e3,end:2e3},{animLeaf:new E("D",-1),start:1e3,end:2e3},{animLeaf:new E("M"),start:2e3,end:3e3},{animLeaf:new E("R"),start:2e3,end:3e3}],"U' E' r E r2' E r U E":[{animLeaf:new E("U",-1),start:0,end:1e3},{animLeaf:new E("E",-1),start:0,end:1e3},{animLeaf:new E("r"),start:1e3,end:2500},{animLeaf:new E("E"),start:2500,end:3500},{animLeaf:new E("r",-2),start:3500,end:5e3},{animLeaf:new E("E"),start:5e3,end:6e3},{animLeaf:new E("r"),start:6e3,end:7e3},{animLeaf:new E("U"),start:7e3,end:8e3},{animLeaf:new E("E"),start:7e3,end:8e3}]},xm=class{constructor(e,t){this.puzzle=e;this.animLeaves=K6[t.toString()]??vm(t)}getAnimLeaf(e){return this.animLeaves[Math.min(e,this.animLeaves.length-1)]?.animLeaf??null}getAnimLeafWithRange(e){return this.animLeaves[Math.min(e,this.animLeaves.length-1)]}indexToMoveStartTimestamp(e){let t=0;return this.animLeaves.length>0&&(t=this.animLeaves[Math.min(e,this.animLeaves.length-1)].start),t}timestampToIndex(e){let t=0;for(t=0;t<this.animLeaves.length;t++)if(this.animLeaves[t].start>=e)return Math.max(0,t-1);return Math.max(0,t-1)}timestampToPosition(e,t){let n=this.currentMoveInfo(e),i=t??this.puzzle.identity();for(let o of this.animLeaves.slice(0,n.stateIndex)){let s=o.animLeaf.as(E);s!==null&&(i=this.puzzle.combine(i,this.puzzle.stateFromMove(s)))}return{state:i,movesInProgress:n.currentMoves}}currentMoveInfo(e){let t=1/0;for(let c of this.animLeaves)if(c.start<=e&&c.end>=e)t=Math.min(t,c.start);else if(c.start>e)break;let n=[],i=[],o=[],s=[],a=-1/0,l=1/0,u=0;for(let c of this.animLeaves)if(c.end<=t)u++;else{if(c.start>e)break;{let f=c.animLeaf.as(E);if(f!==null){let h=(e-c.start)/(c.end-c.start),p=!1;h>1&&(h=1,p=!0);let d={move:f,direction:tt.Forwards,fraction:h,startTimestamp:c.start,endTimestamp:c.end};switch(h){case 0:i.push(d);break;case 1:p?s.push(d):o.push(d);break;default:n.push(d),a=Math.max(a,c.start),l=Math.min(l,c.end)}}}}return{stateIndex:u,currentMoves:n,latestStart:a,earliestEnd:l,movesStarting:i,movesFinishing:o,movesFinished:s}}stateAtIndex(e,t){let n=t??this.puzzle.startState();for(let i=0;i<this.animLeaves.length&&i<e;i++){let s=this.animLeaves[i].animLeaf.as(E);s!==null&&(n=this.puzzle.combine(n,this.puzzle.stateFromMove(s)))}return n}transformAtIndex(e){let t=this.puzzle.identity();for(let n of this.animLeaves.slice(0,e)){let i=n.animLeaf.as(E);i!==null&&(t=this.puzzle.combine(t,this.puzzle.stateFromMove(i)))}return t}algDuration(){let e=0;for(let t of this.animLeaves)e=Math.max(e,t.end);return e}numAnimatedLeaves(){return this.animLeaves.length}moveDuration(e){let t=this.getAnimLeafWithRange(e);return t.end-t.start}};Oe();Oe();var Z6=16;function J6(r,e){let t=new Gi,n=new Gi;for(let i of r.units())n.push(i),n.experimentalNumUnits()>=e&&(t.push(new nn(n.toAlg())),n.reset());return t.push(new nn(n.toAlg())),t.toAlg()}var ND=class extends Cn{traverseAlg(e){let t=e.experimentalNumUnits();return t<Z6?e:J6(e,Math.ceil(Math.sqrt(t)))}traverseGrouping(e){return new nn(this.traverseAlg(e.alg),e.amount)}traverseMove(e){return e}traverseCommutator(e){return new Nt(this.traverseAlg(e.A),this.traverseAlg(e.B))}traverseConjugate(e){return new Nt(this.traverseAlg(e.A),this.traverseAlg(e.B))}traversePause(e){return e}traverseNewline(e){return e}traverseLineComment(e){return e}},OD=new ND,GD=OD.traverseAlg.bind(OD);Oe();Oe();var Bo=class{constructor(e,t,n,i,o,s=[]){this.moveCount=t;this.duration=n;this.forward=i;this.backward=o;this.children=s}},zy=class extends Cn{constructor(e){super();this.puz=e;this.durationFn=new ch(rr);this.cache={};this.identity=e.identity(),this.dummyLeaf=new Bo(e,0,0,this.identity,this.identity,[])}traverseAlg(e){let t=0,n=0,i=this.identity,o=[];for(let s of e.units()){let a=this.traverseUnit(s);t+=a.moveCount,n+=a.duration,i===this.identity?i=a.forward:i=this.puz.combine(i,a.forward),o.push(a)}return new Bo(this.puz,t,n,i,this.puz.invert(i),o)}traverseGrouping(e){let t=this.traverseAlg(e.alg);return this.mult(t,e.amount,[t])}traverseMove(e){let t=e.toString(),n=this.cache[t];return n||(n=new Bo(this.puz,1,this.durationFn.traverseUnit(e),this.puz.stateFromMove(e),this.puz.stateFromMove(e.invert())),this.cache[t]=n,n)}traverseCommutator(e){let t=this.traverseAlg(e.A),n=this.traverseAlg(e.B),i=this.puz.combine(t.forward,n.forward),o=this.puz.combine(t.backward,n.backward),s=this.puz.combine(i,o),a=new Bo(this.puz,2*(t.moveCount+n.moveCount),2*(t.duration+n.duration),s,this.puz.invert(s),[t,n]);return this.mult(a,1,[a,t,n])}traverseConjugate(e){let t=this.traverseAlg(e.A),n=this.traverseAlg(e.B),i=this.puz.combine(t.forward,n.forward),o=this.puz.combine(i,t.backward),s=new Bo(this.puz,2*t.moveCount+n.moveCount,2*t.duration+n.duration,o,this.puz.invert(o),[t,n]);return this.mult(s,1,[s,t,n])}traversePause(e){return new Bo(this.puz,1,this.durationFn.traverseUnit(e),this.identity,this.identity)}traverseNewline(e){return this.dummyLeaf}traverseLineComment(e){return this.dummyLeaf}mult(e,t,n){let i=Math.abs(t),o=this.puz.multiply(e.forward,t);return new Bo(this.puz,e.moveCount*i,e.duration*i,o,this.puz.invert(o),n)}},$t=class{constructor(e,t){this.apd=e;this.back=t}},Iy=class extends ri{constructor(e,t,n){super();this.puz=e;this.algOrUnit=t;this.apd=n;this.i=-1,this.dur=-1,this.goali=-1,this.goaldur=-1,this.move=void 0,this.back=!1,this.moveDuration=0,this.st=this.puz.identity(),this.root=new $t(this.apd,!1)}moveByIndex(e){return this.i>=0&&this.i===e?this.move!==void 0:this.dosearch(e,1/0)}moveByDuration(e){return this.dur>=0&&this.dur<e&&this.dur+this.moveDuration>=e?this.move!==void 0:this.dosearch(1/0,e)}dosearch(e,t){return this.goali=e,this.goaldur=t,this.i=0,this.dur=0,this.move=void 0,this.moveDuration=0,this.back=!1,this.st=this.puz.identity(),this.algOrUnit.is(re)?this.traverseAlg(this.algOrUnit,this.root):this.traverseUnit(this.algOrUnit,this.root)}traverseAlg(e,t){if(!this.firstcheck(t))return!1;let n=t.back?e.experimentalNumUnits()-1:0;for(let i of Bh(e.units(),t.back?Ce.Backwards:Ce.Forwards)){if(this.traverseUnit(i,new $t(t.apd.children[n],t.back)))return!0;n+=t.back?-1:1}return!1}traverseGrouping(e,t){if(!this.firstcheck(t))return!1;let n=this.domult(t,e.amount);return this.traverseAlg(e.alg,new $t(t.apd.children[0],n))}traverseMove(e,t){return this.firstcheck(t)?(this.move=e,this.moveDuration=t.apd.duration,this.back=t.back,!0):!1}traverseCommutator(e,t){if(!this.firstcheck(t))return!1;let n=this.domult(t,1);return n?this.traverseAlg(e.B,new $t(t.apd.children[2],!n))||this.traverseAlg(e.A,new $t(t.apd.children[1],!n))||this.traverseAlg(e.B,new $t(t.apd.children[2],n))||this.traverseAlg(e.A,new $t(t.apd.children[1],n)):this.traverseAlg(e.A,new $t(t.apd.children[1],n))||this.traverseAlg(e.B,new $t(t.apd.children[2],n))||this.traverseAlg(e.A,new $t(t.apd.children[1],!n))||this.traverseAlg(e.B,new $t(t.apd.children[2],!n))}traverseConjugate(e,t){if(!this.firstcheck(t))return!1;let n=this.domult(t,1);return n?this.traverseAlg(e.A,new $t(t.apd.children[1],!n))||this.traverseAlg(e.B,new $t(t.apd.children[2],n))||this.traverseAlg(e.A,new $t(t.apd.children[1],n)):this.traverseAlg(e.A,new $t(t.apd.children[1],n))||this.traverseAlg(e.B,new $t(t.apd.children[2],n))||this.traverseAlg(e.A,new $t(t.apd.children[1],!n))}traversePause(e,t){return this.firstcheck(t)?(this.move=e,this.moveDuration=t.apd.duration,this.back=t.back,!0):!1}traverseNewline(e,t){return!1}traverseLineComment(e,t){return!1}firstcheck(e){return e.apd.moveCount+this.i<=this.goali&&e.apd.duration+this.dur<this.goaldur?this.keepgoing(e):!0}domult(e,t){let n=e.back;if(t===0)return n;t<0&&(n=!n,t=-t);let i=e.apd.children[0],o=Math.min(Math.floor((this.goali-this.i)/i.moveCount),Math.ceil((this.goaldur-this.dur)/i.duration-1));return o>0&&this.keepgoing(new $t(i,n),o),n}keepgoing(e,t=1){return this.i+=t*e.apd.moveCount,this.dur+=t*e.apd.duration,t!==1?e.back?this.st=this.puz.combine(this.st,this.puz.multiply(e.apd.backward,t)):this.st=this.puz.combine(this.st,this.puz.multiply(e.apd.forward,t)):e.back?this.st=this.puz.combine(this.st,e.apd.backward):this.st=this.puz.combine(this.st,e.apd.forward),!1}};var ei=class{constructor(e,t){this.puzzle=e;let n=new zy(this.puzzle),i=GD(t);this.decoration=n.traverseAlg(i),this.walker=new Iy(this.puzzle,i,this.decoration)}getAnimLeaf(e){if(this.walker.moveByIndex(e)){if(!this.walker.move)throw new Error("`this.walker.mv` missing");let t=this.walker.move;return this.walker.back?t.invert():t}return null}indexToMoveStartTimestamp(e){if(this.walker.moveByIndex(e)||this.walker.i===e)return this.walker.dur;throw new Error(`Out of algorithm: index ${e}`)}indexToMovesInProgress(e){if(this.walker.moveByIndex(e)||this.walker.i===e)return this.walker.dur;throw new Error(`Out of algorithm: index ${e}`)}stateAtIndex(e,t){return this.walker.moveByIndex(e),this.puzzle.combine(t??this.puzzle.startState(),this.walker.st)}transformAtIndex(e){return this.walker.moveByIndex(e),this.walker.st}numAnimatedLeaves(){return this.decoration.moveCount}timestampToIndex(e){return this.walker.moveByDuration(e),this.walker.i}algDuration(){return this.decoration.duration}moveDuration(e){return this.walker.moveByIndex(e),this.walker.moveDuration}};var Uy=class extends He{derive(e){switch(e.indexerConstructorRequest){case"auto":return Bs(e.alg.alg)<100&&e.puzzle==="3x3x3"&&e.visualizationStrategy==="Cube3D"?xm:ei;case"tree":return ei;case"simple":return Xs;case"simultaneous":return xm;default:throw new Error("Invalid indexer request!")}}};Oe();Ht();var wm=class extends He{async derive(e){try{return new pn(e.puzzleDef).applyAlg(e.algWithIssues.alg),e.algWithIssues}catch(t){return{alg:new re,issues:new Nr({errors:[`Invalid alg for puzzle: ${t.toString()}`]})}}}};Ht();qn();var WD=class{multiply(e,t){if(t<0)return this.invert(this.multiply(e,-t));if(t===0)return this.identity();for(;t%2==0;)t=t/2,e=this.combine(e,e);let n=e;for(t--;t>0;)t%2==1&&(n=this.combine(n,e)),t=Math.floor(t/2),t>0&&(e=this.combine(e,e));return n}},Tn=class extends WD{constructor(e){super();this.definition=e;this.moveCache={}}static async fromID(e){return new Tn(await Ot[e].def())}startState(){return this.definition.startPieces}invert(e){return Wi(this.definition,e)}combine(e,t){return gt(this.definition,e,t)}stateFromMove(e){let t=e.toString();return this.moveCache[t]||(this.moveCache[t]=Ai(this.definition,e)),this.moveCache[t]}identity(){return Li(this.definition)}equivalent(e,t){return Qh(this.definition,e,t)}};var Ny=class extends He{derive(e){return this.applyAlg(e.def,e.alg.alg)}applyAlg(e,t){let n=new Tn(e),i=new ei(n,t);return i.transformAtIndex(i.numAnimatedLeaves())}};var Oy=class extends He{derive(e){let t=new Tn(e.def);return new e.indexerConstructor(t,e.algWithIssues.alg)}};Ht();var Gy=class extends He{derive(e){switch(e.setupAnchor){case"start":return e.setupTransformation;case"end":{let t=e.indexer.transformAtIndex(e.indexer.numAnimatedLeaves()),n=Wi(e.def,t);return gt(e.def,e.setupTransformation,n)}default:throw new Error("Unimplemented!")}}};var Wy=class extends He{derive(e){return{start:0,end:e.indexer.algDuration()}}};var bm,$6,Vy=class extends He{constructor(){super(...arguments);H(this,bm)}derive(e){let t=ye(this,bm,$6).call(this,e),n=!1,i=!1;return t>=e.timeRange.end&&(i=!0,t=Math.min(e.timeRange.end,t)),t<=e.timeRange.start&&(n=!0,t=Math.max(e.timeRange.start,t)),{timestamp:t,timeRange:e.timeRange,atStart:n,atEnd:i}}canReuse(e,t){return e.timestamp===t.timestamp&&e.timeRange.start===t.timeRange.start&&e.timeRange.end===t.timeRange.end&&e.atStart===t.atStart&&e.atEnd===t.atEnd}};bm=new WeakSet,$6=function(e){switch(e.timestampRequest){case"start":return e.timeRange.start;case"end":return e.timeRange.end;case"anchor":return e.setupAnchor==="start"?e.timeRange.start:e.timeRange.end;case"opposite-anchor":return e.setupAnchor==="start"?e.timeRange.end:e.timeRange.start;default:return e.timestampRequest}};var Hy=class extends He{derive(e){return{playing:e.playingInfo.playing,atStart:e.detailedTimelineInfo.atStart,atEnd:e.detailedTimelineInfo.atEnd}}canReuseValue(e,t){return e.playing===t.playing&&e.atStart===t.atStart&&e.atEnd===t.atEnd}};Oe();var qy=class extends He{derive(e){function t(n){return e.detailedTimelineInfo.atEnd&&e.catchUpMove.move!==null&&n.currentMoves.push({move:e.catchUpMove.move,direction:tt.Backwards,fraction:1-e.catchUpMove.amount,startTimestamp:-1,endTimestamp:-1}),n}if(e.indexer.currentMoveInfo)return t(e.indexer.currentMoveInfo(e.detailedTimelineInfo.timestamp));{let n=e.indexer.timestampToIndex(e.detailedTimelineInfo.timestamp),i={stateIndex:n,currentMoves:[],movesFinishing:[],movesFinished:[],movesStarting:[],latestStart:-1/0,earliestEnd:1/0};if(e.indexer.numAnimatedLeaves()>0){let o=e.indexer.getAnimLeaf(n)?.as(E);if(!o)return t(i);let s=e.indexer.indexToMoveStartTimestamp(n),a=e.indexer.moveDuration(n),l=(e.detailedTimelineInfo.timestamp-s)/a,u=s+a,c={move:o,direction:tt.Forwards,fraction:l,startTimestamp:s,endTimestamp:u};l===0?i.movesStarting.push(c):l===1?i.movesFinishing.push(c):(i.currentMoves.push(c),i.latestStart=Math.max(i.latestStart,s),i.earliestEnd=Math.min(i.earliestEnd,u))}return t(i)}}};var jy=class extends He{derive(e){return{stateIndex:e.currentMoveInfo.stateIndex,movesFinishing:e.currentMoveInfo.movesFinishing.map(t=>t.move),movesFinished:e.currentMoveInfo.movesFinished.map(t=>t.move)}}canReuse(e,t){return e.stateIndex===t.stateIndex&&E2(e.movesFinishing,t.movesFinishing,(n,i)=>n.isIdentical(i))&&E2(e.movesFinished,t.movesFinished,(n,i)=>n.isIdentical(i))}};Ht();var Qy=class extends He{derive(e){let t=e.indexer.transformAtIndex(e.currentLeavesSimplified.stateIndex);t=gt(e.def,e.anchoredStart,t);let n=new Tn(e.def);for(let i of e.currentLeavesSimplified.movesFinishing)t=gt(e.def,t,n.stateFromMove(i));for(let i of e.currentLeavesSimplified.movesFinished)t=gt(e.def,t,n.stateFromMove(i));return t}};var Yy=class extends He{derive(e){return{state:e.transformation,movesInProgress:e.currentMoveInfo.currentMoves}}};var Xy=class extends He{async derive(e){return e.puzzleLoader.def()}};var eP={errors:[]},Ky=class extends mt{getDefaultValue(){return eP}reset(){this.set(this.getDefaultValue())}canReuseValue(e,t){return Oc(e.errors,t.errors)}};var Zy=class extends mt{getDefaultValue(){return{move:null,amount:0}}canReuseValue(e,t){return e.move===t.move&&e.amount===t.amount}};var Jy=class{constructor(){this.userVisibleErrorTracker=new Ky;this.algProp=new mm;this.backgroundProp=new my;this.backViewProp=new gy;this.controlPanelProp=new yy;this.catchUpMoveProp=new Zy;this.foundationStickerSpriteURL=new gm;this.hintFaceletProp=new vy;this.hintStickerSpriteURL=new gm;this.indexerConstructorRequestProp=new xy;this.latitudeLimitProp=new wy;this.orbitCoordinatesRequestProp=new Sy;this.playingInfoProp=new Ly;this.puzzleDescriptionRequestProp=new Ay;this.puzzleIDRequestProp=new Dy;this.setupAnchorProp=new My;this.setupProp=new mm;this.stickeringProp=new Ry;this.tempoScaleProp=new Ty;this.timestampRequestProp=new Fy;this.viewerLinkProp=new _y;this.visualizationFormatProp=new Cy;this.foundationStickerSprite=new ym({spriteURL:this.foundationStickerSpriteURL});this.hintStickerSprite=new ym({spriteURL:this.hintStickerSpriteURL});this.puzzleLoaderProp=new Ey({puzzleIDRequest:this.puzzleIDRequestProp,puzzleDescriptionRequest:this.puzzleDescriptionRequestProp},this.userVisibleErrorTracker);this.puzzleDefProp=new Xy({puzzleLoader:this.puzzleLoaderProp});this.puzzleIDProp=new ky({puzzleLoader:this.puzzleLoaderProp});this.puzzleAlgProp=new wm({algWithIssues:this.algProp,puzzleDef:this.puzzleDefProp});this.puzzleSetupProp=new wm({algWithIssues:this.setupProp,puzzleDef:this.puzzleDefProp});this.visualizationStrategyProp=new By({visualizationRequest:this.visualizationFormatProp,puzzleID:this.puzzleIDProp});this.indexerConstructorProp=new Uy({alg:this.algProp,puzzle:this.puzzleIDProp,visualizationStrategy:this.visualizationStrategyProp,indexerConstructorRequest:this.indexerConstructorRequestProp});this.orbitCoordinatesProp=new Py({orbitCoordinatesRequest:this.orbitCoordinatesRequestProp,latitudeLimit:this.latitudeLimitProp,puzzleID:this.puzzleIDProp,strategy:this.visualizationStrategyProp});this.setupTransformationProp=new Ny({alg:this.puzzleSetupProp,def:this.puzzleDefProp});this.indexerProp=new Oy({indexerConstructor:this.indexerConstructorProp,algWithIssues:this.puzzleAlgProp,def:this.puzzleDefProp});this.anchoredStartProp=new Gy({setupAnchor:this.setupAnchorProp,setupTransformation:this.setupTransformationProp,indexer:this.indexerProp,def:this.puzzleDefProp});this.timeRangeProp=new Wy({indexer:this.indexerProp});this.detailedTimelineInfoProp=new Vy({timestampRequest:this.timestampRequestProp,timeRange:this.timeRangeProp,setupAnchor:this.setupAnchorProp});this.coarseTimelineInfoProp=new Hy({detailedTimelineInfo:this.detailedTimelineInfoProp,playingInfo:this.playingInfoProp});this.currentLeavesProp=new qy({indexer:this.indexerProp,detailedTimelineInfo:this.detailedTimelineInfoProp,catchUpMove:this.catchUpMoveProp});this.buttonAppearanceProp=new sy({coarseTimelineInfo:this.coarseTimelineInfoProp,viewerLink:this.viewerLinkProp});this.currentLeavesSimplifiedProp=new jy({currentMoveInfo:this.currentLeavesProp});this.currentTransformationProp=new Qy({anchoredStart:this.anchoredStartProp,currentLeavesSimplified:this.currentLeavesSimplifiedProp,indexer:this.indexerProp,def:this.puzzleDefProp});this.legacyPositionProp=new Yy({currentMoveInfo:this.currentLeavesProp,transformation:this.currentTransformationProp})}async twizzleLink(){let e=new URL("https://alpha.twizzle.net/edit/"),[t,n,i,o]=await Promise.all([this.puzzleIDProp.get(),this.algProp.get(),this.setupProp.get(),this.setupAnchorProp.get()]);return n.alg.experimentalIsEmpty()||e.searchParams.set("alg",n.alg.toString()),i.alg.experimentalIsEmpty()||e.searchParams.set("setup-alg",i.alg.toString()),o!=="start"&&e.searchParams.set("setup-anchor",o),t!=="3x3x3"&&e.searchParams.set("puzzle",t),e.toString()}};Tt();function Un(r){return new Error(`Cannot get \`.${r}\` directly from a \`TwistyPlayer\`.`)}var $y=class extends rt{constructor(){super(...arguments);this.experimentalModel=new Jy;this.experimentalGet=new VD(this.experimentalModel)}set alg(e){this.experimentalModel.algProp.set(e)}get alg(){throw Un("alg")}set experimentalSetupAlg(e){this.experimentalModel.setupProp.set(e)}get experimentalSetupAlg(){throw Un("setup")}set experimentalSetupAnchor(e){this.experimentalModel.setupAnchorProp.set(e)}get experimentalSetupAnchor(){throw Un("anchor")}set puzzle(e){this.experimentalModel.puzzleIDRequestProp.set(e)}get puzzle(){throw Un("puzzle")}set experimentalPuzzleDescription(e){this.experimentalModel.puzzleDescriptionRequestProp.set(e)}get experimentalPuzzleDescription(){throw Un("experimentalPuzzleDescription")}set timestamp(e){this.experimentalModel.timestampRequestProp.set(e)}get timestamp(){throw Un("timestamp")}set hintFacelets(e){this.experimentalModel.hintFaceletProp.set(e)}get hintFacelets(){throw Un("hintFacelets")}set experimentalStickering(e){this.experimentalModel.stickeringProp.set(e)}get experimentalStickering(){throw Un("stickering")}set backView(e){this.experimentalModel.backViewProp.set(e)}get backView(){throw Un("backView")}set background(e){this.experimentalModel.backgroundProp.set(e)}get background(){throw Un("background")}set controlPanel(e){this.experimentalModel.controlPanelProp.set(e)}get controlPanel(){throw new Error("Cannot get `.controlPanel` directly from a `TwistyPlayer`.")}set visualization(e){this.experimentalModel.visualizationFormatProp.set(e)}get visualization(){throw new Error("Cannot get `.visualization` directly from a `TwistyPlayer`.")}set viewerLink(e){this.experimentalModel.viewerLinkProp.set(e)}get viewerLink(){throw Un("viewerLink")}set cameraLatitude(e){this.experimentalModel.orbitCoordinatesRequestProp.set({latitude:e})}get cameraLatitude(){throw new Error("Cannot get `.cameraLatitude` directly from a `TwistyPlayer`.")}set cameraLongitude(e){this.experimentalModel.orbitCoordinatesRequestProp.set({longitude:e})}get cameraLongitude(){throw new Error("Cannot get `.cameraLongitude` directly from a `TwistyPlayer`.")}set cameraDistance(e){this.experimentalModel.orbitCoordinatesRequestProp.set({distance:e})}get cameraDistance(){throw new Error("Cannot get `.cameraDistance` directly from a `TwistyPlayer`.")}set cameraLatitudeLimit(e){this.experimentalModel.latitudeLimitProp.set(e)}get cameraLatitudeLimit(){throw new Error("Cannot get `.cameraLatitudeLimit` directly from a `TwistyPlayer`.")}set indexer(e){this.experimentalModel.indexerConstructorRequestProp.set(e)}get indexer(){throw Un("indexer")}set tempoScale(e){this.experimentalModel.tempoScaleProp.set(e)}get tempoScale(){throw Un("tempoScale")}set experimentalSprite(e){this.experimentalModel.foundationStickerSpriteURL.set(e)}get experimentalSprite(){throw Un("experimentalSprite")}set experimentalHintSprite(e){this.experimentalModel.hintStickerSpriteURL.set(e)}get experimentalHintSprite(){throw Un("experimentalHintSprite")}},VD=class{constructor(e){this.model=e}async alg(){return(await this.model.algProp.get()).alg}async setupAlg(){return(await this.model.setupProp.get()).alg}puzzleID(){return this.model.puzzleIDProp.get()}async timestamp(){return(await this.model.detailedTimelineInfoProp.get()).timestamp}};var ev={alg:"alg","experimental-setup-alg":"experimentalSetupAlg","experimental-setup-anchor":"experimentalSetupAnchor",puzzle:"puzzle","experimental-puzzle-description":"experimentalPuzzleDescription",visualization:"visualization","hint-facelets":"hintFacelets","experimental-stickering":"experimentalStickering",background:"background","control-panel":"controlPanel","back-view":"backView","viewer-link":"viewerLink","camera-latitude":"cameraLatitude","camera-longitude":"cameraLongitude","camera-distance":"cameraDistance","camera-latitude-limit":"cameraLatitudeLimit","tempo-scale":"tempoScale","experimental-sprite":"experimentalSprite","experimental-hint-sprite":"experimentalHintSprite"},tP=Object.fromEntries(Object.values(ev).map(r=>[r,!0])),Sm,hh,Xl,fh,or,ph,Lm,nP,zo=class extends $y{constructor(e={}){super();H(this,Lm);this.controller=new F2(this.experimentalModel,this);this.experimentalCanvasClickCallback=()=>{};H(this,Sm,new zn(this,"controls-",["auto"].concat(Object.keys(B2))));H(this,hh,document.createElement("div"));H(this,Xl,document.createElement("div"));H(this,fh,!1);H(this,or,null);H(this,ph,null);for(let[t,n]of Object.entries(e)){if(!tP[t]){console.warn(`Invalid config passed to TwistyPlayer: ${t}`);break}this[t]=n}}async connectedCallback(){if(S(this,fh))return;$(this,fh,!0),this.addCSS(Ld),this.addElement(S(this,hh)).classList.add("visualization-wrapper"),this.addElement(S(this,Xl)).classList.add("error-elem"),S(this,Xl).textContent="Error",this.experimentalModel.userVisibleErrorTracker.addFreshListener(t=>{let n=t.errors[0]??null;this.contentWrapper.classList.toggle("error",!!n),n&&(S(this,Xl).textContent=n)});let e=new pm(this.experimentalModel);this.contentWrapper.appendChild(e),this.buttons=new am(this.experimentalModel,this.controller,this),this.contentWrapper.appendChild(this.buttons),this.experimentalModel.backgroundProp.addFreshListener(t=>{this.contentWrapper.classList.toggle("checkered",t!=="none")}),this.experimentalModel.controlPanelProp.addFreshListener(t=>{S(this,Sm).setValue(t)}),this.experimentalModel.visualizationStrategyProp.addFreshListener(ye(this,Lm,nP).bind(this)),this.experimentalModel.puzzleIDProp.addFreshListener(this.flash.bind(this))}flash(){S(this,or)?.animate([{opacity:.25},{opacity:1}],{duration:250})}async experimentalCurrentCanvases(){this.connectedCallback();let e=S(this,or),t=[];if(e instanceof Ql){let n=e.experimentalVantages();for(let i of n)t.push(await i.canvas())}return t}async experimentalPG3D(){this.connectedCallback();let e=S(this,or);return e instanceof Ql,null}jumpToStart(e){this.controller.jumpToStart(e)}jumpToEnd(e){this.controller.jumpToEnd(e)}play(){this.controller.togglePlay(!0)}pause(){this.controller.togglePlay(!1)}togglePlay(e){this.controller.togglePlay(e)}experimentalAddMove(e,t={}){let n=typeof e=="string"?new E(e):e;(async()=>{let i=(await this.experimentalModel.algProp.get()).alg,o=fr(i,n,{coalesce:t?.coalesce});this.experimentalModel.algProp.set(o),this.experimentalModel.timestampRequestProp.set("end"),this.experimentalModel.catchUpMoveProp.set({move:n,amount:0})})()}static get observedAttributes(){return Object.keys(ev)}attributeChangedCallback(e,t,n){let i=ev[e];!i||(this[i]=n)}async experimentalScreenshot(e){return(await hy(this.experimentalModel,e)).dataURL}async experimentalDownloadScreenshot(e){if(["2D","experimental-2D-LL"].includes(await this.experimentalModel.visualizationStrategyProp.get())){let n=await S(this,or).currentTwisty2DPuzzleWrapper().twisty2DPuzzle(),i=new XMLSerializer().serializeToString(n.svg.element),o=URL.createObjectURL(new Blob([i]));py(o,e??await fy(this.experimentalModel),"svg")}else await(await hy(this.experimentalModel)).download(e)}};Sm=new WeakMap,hh=new WeakMap,Xl=new WeakMap,fh=new WeakMap,or=new WeakMap,ph=new WeakMap,Lm=new WeakSet,nP=function(e){if(e!==S(this,ph)){S(this,or)?.remove(),S(this,or)?.disconnect();let t;switch(e){case"2D":case"experimental-2D-LL":t=new jd(this.experimentalModel,e);break;case"Cube3D":case"PG3D":t=new Ql(this.experimentalModel);break;default:throw new Error("Invalid visualization")}S(this,hh).appendChild(t),$(this,or,t),$(this,ph,e)}};Qe.define("twisty-player",zo);Oe();Tt();un();Tt();var HD=new Xt(`
|
|
7320
7320
|
:host {
|
|
7321
7321
|
display: inline-grid;
|
|
7322
7322
|
}
|
|
@@ -7338,7 +7338,7 @@ twisty-alg-leaf-elem.twisty-alg-comment {
|
|
|
7338
7338
|
padding-right: 0.1em;
|
|
7339
7339
|
border-radius: 0.1em;
|
|
7340
7340
|
}
|
|
7341
|
-
`);var
|
|
7341
|
+
`);var iP=250;var Ks=class extends rt{constructor(e,t,n,i,o,s){super({mode:"open"});this.algOrUnit=i;if(this.classList.add(e),this.addCSS(HD),s){let a=this.contentWrapper.appendChild(document.createElement("a"));a.href="#",a.textContent=t,a.addEventListener("click",l=>{l.preventDefault(),n.twistyAlgViewer.jumpToIndex(n.earliestMoveIndex,o)})}else this.contentWrapper.appendChild(document.createElement("span")).textContent=t}pathToIndex(e){return[]}setCurrentMove(e){this.contentWrapper.classList.toggle("current-move",e)}};Qe.define("twisty-alg-leaf-elem",Ks);var Zs=class extends nr{constructor(e,t){super();this.algOrUnit=t;this.queue=[];this.classList.add(e)}addString(e){this.queue.push(document.createTextNode(e))}addElem(e){return this.queue.push(e.element),e.moveCount}flushQueue(e=Ce.Forwards){for(let t of qD(this.queue,e))this.append(t);this.queue=[]}pathToIndex(e){return[]}};Qe.define("twisty-alg-wrapper-elem",Zs);function rP(r){return r===Ce.Forwards?Ce.Backwards:Ce.Forwards}function oP(r,e){return e<0?rP(r):r}function qD(r,e){if(e===Ce.Forwards)return r;let t=Array.from(r);return t.reverse(),t}var jD=class extends ri{traverseAlg(e,t){let n=0,i=new Zs("twisty-alg-alg",e),o=!0;for(let s of Yr(e.units(),t.direction))o||i.addString(" "),o=!1,n+=i.addElem(this.traverseUnit(s,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction}));return i.flushQueue(t.direction),{moveCount:n,element:i}}traverseGrouping(e,t){let n=e.experimentalAsSquare1Tuple(),i=oP(t.direction,e.amount),o=0,s=new Zs("twisty-alg-grouping",e);return s.addString("("),n?(o+=s.addElem({moveCount:1,element:new Ks("twisty-alg-move",n[0].amount.toString(),t,n[0],!0,!0)}),s.addString(", "),o+=s.addElem({moveCount:1,element:new Ks("twisty-alg-move",n[1].amount.toString(),t,n[1],!0,!0)})):o+=s.addElem(this.traverseAlg(e.alg,{earliestMoveIndex:t.earliestMoveIndex+o,twistyAlgViewer:t.twistyAlgViewer,direction:i})),s.addString(")"+e.experimentalRepetitionSuffix),s.flushQueue(),{moveCount:o*Math.abs(e.amount),element:s}}traverseMove(e,t){let n=new Ks("twisty-alg-move",e.toString(),t,e,!0,!0);return t.twistyAlgViewer.highlighter.addMove(e.startCharIndex,n),{moveCount:1,element:n}}traverseCommutator(e,t){let n=0,i=new Zs("twisty-alg-commutator",e);i.addString("["),i.flushQueue();let[o,s]=qD([e.A,e.B],t.direction);return n+=i.addElem(this.traverseAlg(o,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction})),i.addString(", "),n+=i.addElem(this.traverseAlg(s,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction})),i.flushQueue(t.direction),i.addString("]"),i.flushQueue(),{moveCount:n*2,element:i}}traverseConjugate(e,t){let n=0,i=new Zs("twisty-alg-conjugate",e);i.addString("[");let o=i.addElem(this.traverseAlg(e.A,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction}));return n+=o,i.addString(": "),n+=i.addElem(this.traverseAlg(e.B,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction})),i.addString("]"),i.flushQueue(),{moveCount:n+o,element:i}}traversePause(e,t){return{moveCount:1,element:new Ks("twisty-alg-pause",".",t,e,!0,!0)}}traverseNewline(e,t){let n=new Zs("twisty-alg-newline",e);return n.append(document.createElement("br")),{moveCount:0,element:n}}traverseLineComment(e,t){return{moveCount:0,element:new Ks("twisty-alg-line-comment",`//${e.text}`,t,e,!1,!1)}}},QD=new jD,sP=QD.traverseAlg.bind(QD),YD=class{constructor(){this.moveCharIndexMap=new Map;this.currentElem=null}addMove(e,t){this.moveCharIndexMap.set(e,t)}set(e){let t=e?this.moveCharIndexMap.get(e.startCharIndex)??null:null;this.currentElem!==t&&(this.currentElem?.classList.remove("twisty-alg-current-move"),this.currentElem?.setCurrentMove(!1),t?.classList.add("twisty-alg-current-move"),t?.setCurrentMove(!0),this.currentElem=t)}},dh,Am=class extends nr{constructor(e){super();this.highlighter=new YD;H(this,dh,void 0);this.twistyPlayer=null;this.lastClickTimestamp=null;e?.twistyPlayer&&this.setTwistyPlayer(e?.twistyPlayer)}connectedCallback(){}setAlg(e){$(this,dh,sP(e,{earliestMoveIndex:0,twistyAlgViewer:this,direction:Ce.Forwards}).element),this.textContent="",this.appendChild(S(this,dh))}async setTwistyPlayer(e){if(this.twistyPlayer){console.warn("twisty-player reassignment is not supported");return}this.twistyPlayer=e,this.twistyPlayer.experimentalModel.algProp.addFreshListener(i=>{this.setAlg(i.alg)});let t=(await this.twistyPlayer.experimentalModel.algProp.get()).alg,n="startCharIndex"in t?t:re.fromString(t.toString());this.setAlg(n),e.experimentalModel.currentLeavesProp.addFreshListener(i=>{let o=i.currentMoves[0];if(o??(o=i.movesStarting[0]),o??(o=i.movesFinishing[0]),!o)this.highlighter.set(null);else{let s=o.move;this.highlighter.set(s)}}),e.experimentalModel.detailedTimelineInfoProp.addFreshListener(i=>{i.timestamp!==this.lastClickTimestamp&&(this.lastClickTimestamp=null)})}async jumpToIndex(e,t){let n=this.twistyPlayer;if(n){n.pause();let i=(async()=>{let o=await n.experimentalModel.indexerProp.get(),s=t?iP:0;return(o.indexToMoveStartTimestamp(e)??-s)+s})();n.experimentalModel.timestampRequestProp.set(await i),this.lastClickTimestamp===await i?(n.play(),this.lastClickTimestamp=null):this.lastClickTimestamp=await i}}async attributeChangedCallback(e,t,n){if(e==="for"){let i=document.getElementById(n);if(!i){console.warn("for= elem does not exist");return}if(await customElements.whenDefined("twisty-player"),!(i instanceof zo)){console.warn("for= elem is not a twisty-player");return}this.setTwistyPlayer(i)}}static get observedAttributes(){return["for"]}};dh=new WeakMap;Qe.define("twisty-alg-viewer",Am);Oe();Ro();Tt();un();Oe();var XD=class extends ri{traverseAlg(e,t){let n=[],i=0;for(let o of e.units()){let s=this.traverseUnit(o,{numMovesSofar:t.numMovesSofar+i});n.push(s.tokens),i+=s.numLeavesInside}return{tokens:Array.prototype.concat(...n),numLeavesInside:i}}traverseGrouping(e,t){let n=this.traverseAlg(e.alg,t);return{tokens:n.tokens,numLeavesInside:n.numLeavesInside*e.amount}}traverseMove(e,t){return{tokens:[{leaf:e,idx:t.numMovesSofar}],numLeavesInside:1}}traverseCommutator(e,t){let n=this.traverseAlg(e.A,t),i=this.traverseAlg(e.B,{numMovesSofar:t.numMovesSofar+n.numLeavesInside});return{tokens:n.tokens.concat(i.tokens),numLeavesInside:n.numLeavesInside*2+i.numLeavesInside}}traverseConjugate(e,t){let n=this.traverseAlg(e.A,t),i=this.traverseAlg(e.B,{numMovesSofar:t.numMovesSofar+n.numLeavesInside});return{tokens:n.tokens.concat(i.tokens),numLeavesInside:n.numLeavesInside*2+i.numLeavesInside*2}}traversePause(e,t){return{tokens:[{leaf:e,idx:t.numMovesSofar}],numLeavesInside:1}}traverseNewline(e,t){return{tokens:[],numLeavesInside:0}}traverseLineComment(e,t){return{tokens:[],numLeavesInside:0}}},KD=new XD,ZD=KD.traverseAlg.bind(KD);var JD=class extends mt{getDefaultValue(){return""}},$D=class extends He{derive(e){return dy(e.value)}},eE=class extends $n{getDefaultValue(){return{selectionStart:0,selectionEnd:0,endChangedMostRecently:!1}}async derive(e,t){let{selectionStart:n,selectionEnd:i}=e,o=await t,s=e.selectionStart===o.selectionStart&&e.selectionEnd!==(await t).selectionEnd;return{selectionStart:n,selectionEnd:i,endChangedMostRecently:s}}},tE=class extends He{derive(e){return e.selectionInfo.endChangedMostRecently?e.selectionInfo.selectionEnd:e.selectionInfo.selectionStart}},nE=class extends He{derive(e){return ZD(e.algWithIssues.alg,{numMovesSofar:0}).tokens}},iE=class extends He{derive(e){function t(i){if(i===null)return null;let o;return e.targetChar<i.leaf.startCharIndex?o="before":e.targetChar===i.leaf.startCharIndex?o="start":e.targetChar<i.leaf.endCharIndex?o="inside":e.targetChar===i.leaf.endCharIndex?o="end":o="after",{leafInfo:i,where:o}}let n=null;for(let i of e.leafTokens){if(e.targetChar<i.leaf.startCharIndex&&n!==null)return t(n);if(e.targetChar<=i.leaf.endCharIndex)return t(i);n=i}return t(n)}},tv=class{constructor(){this.valueProp=new JD;this.selectionProp=new eE;this.targetCharProp=new tE({selectionInfo:this.selectionProp});this.algEditorAlgWithIssues=new $D({value:this.valueProp});this.leafTokensProp=new nE({algWithIssues:this.algEditorAlgWithIssues});this.leafToHighlight=new iE({leafTokens:this.leafTokensProp,targetChar:this.targetCharProp})}};Tt();var rE=new Xt(`
|
|
7342
7342
|
:host {
|
|
7343
7343
|
width: 384px;
|
|
7344
7344
|
display: grid;
|
|
@@ -7407,8 +7407,8 @@ textarea {
|
|
|
7407
7407
|
border: 1px solid red;
|
|
7408
7408
|
background: rgba(255, 0, 0, 0.1);
|
|
7409
7409
|
}
|
|
7410
|
-
`);var
|
|
7411
|
-
`)?e+" ":e},yh=new WeakMap;Qe.define("twisty-alg-editor",Dm);Ud();li();Oe();qn();Qc();Xc();Q2();Oe();Ht();var Mm=class{constructor(e,t,n,i,o){this.timeline=e;this.def=t;this.alg=n;this.positionListeners=new Set;this.indexerConstructor=ei;this.ksolvePuzzle=new Tn(t),o&&(this.indexerConstructor=o),this.instantiateIndexer(n),this.startState=i?this.algToState(i):this.ksolvePuzzle.startState(),e.addTimestampListener(this)}setStartState(e){this.startState=e,this.dispatchPositionForTimestamp(this.timeline.timestamp)}experimentalSetIndexer(e){this.indexerConstructor=e,this.instantiateIndexer(this.alg),this.timeline.onCursorChange(this),this.dispatchPositionForTimestamp(this.timeline.timestamp)}instantiateIndexer(e){this.indexer=new this.indexerConstructor(this.ksolvePuzzle,e)}algToState(e){let t=new pn(this.def);return t.applyAlg(e),this.ksolvePuzzle.combine(this.def.startPieces,t.state)}timeRange(){return{start:0,end:this.indexer.algDuration()}}experimentalTimestampForStartOfLastMove(){let e=this.indexer.numAnimatedLeaves();return e>0?this.indexer.indexToMoveStartTimestamp(e-1):0}addPositionListener(e){this.positionListeners.add(e),this.dispatchPositionForTimestamp(this.timeline.timestamp,[e])}removePositionListener(e){this.positionListeners.delete(e)}onTimelineTimestampChange(e){this.dispatchPositionForTimestamp(e)}dispatchPositionForTimestamp(e,t=this.positionListeners){let n;if(this.indexer.timestampToPosition)n=this.indexer.timestampToPosition(e,this.startState);else{let i=this.indexer.timestampToIndex(e),o=this.indexer.stateAtIndex(i,this.startState);if(n={state:o,movesInProgress:[]},this.indexer.numAnimatedLeaves()>0){let s=this.indexer.getAnimLeaf(i)?.as(E);if(!s)return;let a=(e-this.indexer.indexToMoveStartTimestamp(i))/this.indexer.moveDuration(i);a===1?n.state=this.ksolvePuzzle.combine(o,this.ksolvePuzzle.stateFromMove(s)):a>0&&s&&n.movesInProgress.push({move:s,direction:tt.Forwards,fraction:a})}}for(let i of t)i.onPositionChange(n)}onTimeRangeChange(e){}setAlg(e,t){t??(t=this.indexerConstructor),!(e.isIdentical(this.alg)&&this.indexerConstructor===t)&&(this.indexerConstructor=t,this.alg=e,this.instantiateIndexer(e),this.timeline.onCursorChange(this),this.dispatchPositionForTimestamp(this.timeline.timestamp))}moveBoundary(e,t){if(this.indexer.numAnimatedLeaves()===0)return null;let n=Cl(t)*.001,i=this.indexer.timestampToIndex(e+n),o=this.indexer.indexToMoveStartTimestamp(i);if(t===tt.Backwards)return e>=o?o:null;{let s=o+this.indexer.moveDuration(i);return e<=s?s:null}}setPuzzle(e,t=this.alg,n){this.ksolvePuzzle=new Tn(e),this.def=e,this.indexer=new this.indexerConstructor(this.ksolvePuzzle,t),t!==this.alg&&this.timeline.onCursorChange(this),this.setStartState(n?this.algToState(n):this.ksolvePuzzle.startState()),this.alg=t}experimentalTimestampFromIndex(e){return this.indexer.indexToMoveStartTimestamp(e)}experimentalIndexFromTimestamp(e){return this.indexer.timestampToIndex(e)}experimentalLeafAtIndex(e){return this.indexer.getAnimLeaf(e)}};Oe();var sP={"y' y' U' E D R2 r2 F2 B2 U E D' R2 L2' z2 S2 U U D D S2 F2' B2":[{animLeaf:new E("y",-1),start:0,end:1e3},{animLeaf:new E("y",-1),start:1e3,end:2e3},{animLeaf:new E("U",-1),start:1e3,end:1600},{animLeaf:new E("E",1),start:1200,end:1800},{animLeaf:new E("D"),start:1400,end:2e3},{animLeaf:new E("R",2),start:2e3,end:3500},{animLeaf:new E("r",2),start:2e3,end:3500},{animLeaf:new E("F",2),start:3500,end:4200},{animLeaf:new E("B",2),start:3800,end:4500},{animLeaf:new E("U",1),start:4500,end:5500},{animLeaf:new E("E",1),start:4500,end:5500},{animLeaf:new E("D",-1),start:4500,end:5500},{animLeaf:new E("R",2),start:5500,end:6500},{animLeaf:new E("L",-2),start:5500,end:6500},{animLeaf:new E("z",2),start:5500,end:6500},{animLeaf:new E("S",2),start:6500,end:7500},{animLeaf:new E("U"),start:7500,end:8e3},{animLeaf:new E("U"),start:8e3,end:8500},{animLeaf:new E("D"),start:7750,end:8250},{animLeaf:new E("D"),start:8250,end:8750},{animLeaf:new E("S",2),start:8750,end:9250},{animLeaf:new E("F",-2),start:8750,end:1e4},{animLeaf:new E("B",2),start:8750,end:1e4}],"M' R' U' D' M R":[{animLeaf:new E("M",-1),start:0,end:1e3},{animLeaf:new E("R",-1),start:0,end:1e3},{animLeaf:new E("U",-1),start:1e3,end:2e3},{animLeaf:new E("D",-1),start:1e3,end:2e3},{animLeaf:new E("M"),start:2e3,end:3e3},{animLeaf:new E("R"),start:2e3,end:3e3}],"U' E' r E r2' E r U E":[{animLeaf:new E("U",-1),start:0,end:1e3},{animLeaf:new E("E",-1),start:0,end:1e3},{animLeaf:new E("r"),start:1e3,end:2500},{animLeaf:new E("E"),start:2500,end:3500},{animLeaf:new E("r",-2),start:3500,end:5e3},{animLeaf:new E("E"),start:5e3,end:6e3},{animLeaf:new E("r"),start:6e3,end:7e3},{animLeaf:new E("U"),start:7e3,end:8e3},{animLeaf:new E("E"),start:7e3,end:8e3}]},nv=class{constructor(e,t){this.puzzle=e;this.animLeaves=sP[t.toString()]??ym(t)}getAnimLeaf(e){return this.animLeaves[Math.min(e,this.animLeaves.length-1)]?.animLeaf??null}getAnimLeafWithRange(e){return this.animLeaves[Math.min(e,this.animLeaves.length-1)]}indexToMoveStartTimestamp(e){let t=0;return this.animLeaves.length>0&&(t=this.animLeaves[Math.min(e,this.animLeaves.length-1)].start),t}timestampToIndex(e){let t=0;for(t=0;t<this.animLeaves.length;t++)if(this.animLeaves[t].start>=e)return Math.max(0,t-1);return Math.max(0,t-1)}timestampToPosition(e,t){let n={state:t??this.puzzle.identity(),movesInProgress:[]};for(let i of this.animLeaves)if(i.end<=e){let o=i.animLeaf.as(E);o!==null&&(n.state=this.puzzle.combine(n.state,this.puzzle.stateFromMove(o)))}else if(i.start<e&&e<i.end){let o=i.animLeaf.as(E);o!==null&&n.movesInProgress.push({move:o,direction:tt.Forwards,fraction:(e-i.start)/(i.end-i.start)})}else if(e<i.start)continue;return n}stateAtIndex(e,t){let n=t??this.puzzle.startState();for(let i=0;i<this.animLeaves.length&&i<e;i++){let s=this.animLeaves[i].animLeaf.as(E);s!==null&&(n=this.puzzle.combine(n,this.puzzle.stateFromMove(s)))}return n}transformAtIndex(e){let t=this.puzzle.identity();for(let n of this.animLeaves.slice(0,e)){let i=n.animLeaf.as(E);i!==null&&(t=this.puzzle.combine(t,this.puzzle.stateFromMove(i)))}return t}algDuration(){let e=0;for(let t of this.animLeaves)e=Math.max(e,t.end);return e}numAnimatedLeaves(){return this.animLeaves.length}moveDuration(e){let t=this.getAnimLeafWithRange(e);return t.end-t.start}};Rr();var aP=!0,Fn;(function(n){n.StartingToPlay="StartingToPlay",n.Pausing="Pausing",n.Jumping="Jumping"})(Fn||(Fn={}));var ti;(function(s){s.StartOfTimeline="Start",s.EndOfTimeline="End",s.StartOfMove="StartOfMove",s.EndOfMove="EndOfMove",s.MiddleOfMove="MiddleOfMove",s.BetweenMoves="BetweenMoves"})(ti||(ti={}));function iv(){return Math.round(performance.now())}var rv=class{constructor(){this.animating=!1;this.tempoScale=1;this.cursors=new Set;this.timestampListeners=new Set;this.actionListeners=new Set;this.timestamp=0;this.lastAnimFrameNow=0;this.direction=tt.Forwards;this.boundaryType=kt.EntireTimeline;let e=t=>{if(this.animating){let n=iv();this.timestamp=this.timestamp+this.tempoScale*Cl(this.direction)*(n-this.lastAnimFrameNow),this.lastAnimFrameNow=n,(this.direction===tt.Backwards?this.timestamp<=this.cachedNextBoundary:this.timestamp>=this.cachedNextBoundary)&&(this.timestamp=this.cachedNextBoundary,this.animating&&(this.animating=!1,this.dispatchAction(Fn.Pausing)))}this.timestamp!==this.lastAnimFrameTimestamp&&(this.dispatchTimestamp(),this.lastAnimFrameTimestamp=this.timestamp),this.animating&&this.scheduler.requestAnimFrame()};this.scheduler=new ln(e)}addCursor(e){this.cursors.add(e),this.dispatchTimeRange()}removeCursor(e){this.cursors.delete(e),this.clampTimestampToRange(),this.dispatchTimeRange()}clampTimestampToRange(){let e=this.timeRange();this.timestamp<e.start&&this.setTimestamp(e.start),this.timestamp>e.end&&this.setTimestamp(e.end)}onCursorChange(e){this.timestamp>this.maxTimestamp()&&(this.timestamp=this.maxTimestamp()),this.dispatchTimeRange()}timeRange(){let e=0,t=0;for(let n of this.cursors){let i=n.timeRange();e=Math.min(e,i.start),t=Math.max(t,i.end)}return{start:e,end:t}}minTimestamp(){return this.timeRange().start}maxTimestamp(){return this.timeRange().end}dispatchTimeRange(){let e=this.timeRange();for(let t of this.cursors)t.onTimeRangeChange(e);for(let t of this.timestampListeners)t.onTimeRangeChange(e)}dispatchTimestamp(){for(let e of this.cursors)e.onTimelineTimestampChange(this.timestamp);for(let e of this.timestampListeners)e.onTimelineTimestampChange(this.timestamp)}addTimestampListener(e){this.timestampListeners.add(e)}removeTimestampListener(e){this.timestampListeners.delete(e)}addActionListener(e){this.actionListeners.add(e)}removeActionListener(e){this.actionListeners.delete(e)}play(){this.experimentalPlay(tt.Forwards,kt.EntireTimeline)}experimentalPlay(e,t=kt.EntireTimeline){this.direction=e,this.boundaryType=t;let n=this.nextBoundary(this.timestamp,e,this.boundaryType);n!==null&&(this.cachedNextBoundary=n,this.animating||(this.animating=!0,this.lastAnimFrameNow=iv(),this.dispatchAction(Fn.StartingToPlay),this.scheduler.requestAnimFrame()))}nextBoundary(e,t,n=kt.EntireTimeline){switch(n){case kt.EntireTimeline:switch(t){case tt.Backwards:return e<=this.minTimestamp()?null:this.minTimestamp();case tt.Forwards:return e>=this.maxTimestamp()?null:this.maxTimestamp();default:throw new Error("invalid direction")}case kt.Move:{let i=null;for(let o of this.cursors){let s=o.moveBoundary(e,t);if(s!==null)switch(t){case tt.Backwards:{i=Math.min(i??s,s);break}case tt.Forwards:{i=Math.max(i??s,s);break}default:throw new Error("invalid direction")}}return i}default:throw new Error("invalid boundary type")}}pause(){this.animating&&(this.animating=!1,this.dispatchAction(Fn.Pausing),this.scheduler.requestAnimFrame())}playPause(){this.animating?this.pause():(this.timestamp>=this.maxTimestamp()&&(this.timestamp=0),this.experimentalPlay(tt.Forwards,kt.EntireTimeline))}setTimestamp(e){let t=this.timestamp;this.timestamp=e,this.lastAnimFrameNow=iv(),t!==e&&(this.dispatchAction(Fn.Jumping),this.scheduler.requestAnimFrame()),aP&&(this.animating=!1,this.dispatchAction(Fn.Pausing))}jumpToStart(){this.setTimestamp(this.minTimestamp())}jumpToEnd(){this.setTimestamp(this.maxTimestamp())}experimentalJumpToLastMove(){let e=0;for(let t of this.cursors)e=Math.max(e,t.experimentalTimestampForStartOfLastMove()??0);this.setTimestamp(e)}dispatchAction(e){let t=ti.MiddleOfMove;switch(this.timestamp){case this.minTimestamp():t=ti.StartOfTimeline;break;case this.maxTimestamp():t=ti.EndOfTimeline;break}let n={action:e,locationType:t};for(let i of this.actionListeners)i.onTimelineAction(n)}};Ro();Ft();un();var Wr=class extends rt{constructor(e,t,n){super();this.currentIconName=null;this.button=document.createElement("button");this.fullscreenElement=null;this.visitTwizzleLinkCallback=null;switch(this.fullscreenElement=n?.fullscreenElement??null,this.visitTwizzleLinkCallback=n?.visitTwizzleLinkCallback??null,e||console.warn("Must have timeline!"),this.timeline=e,t||console.warn("Must have timelineCommand!"),this.timelineCommand=t,this.addCSS(om),this.setIcon(this.initialIcon()),this.setHoverTitle(this.initialHoverTitle()),this.addElement(this.button),this.addEventListener("click",this.onPress.bind(this)),this.timelineCommand){case"fullscreen":document.fullscreenEnabled||(this.button.disabled=!0);break;case"jump-to-start":case"play-step-backwards":this.button.disabled=!0;break}if(this.timeline){switch(this.timeline.addActionListener(this),this.timelineCommand){case"play-pause":case"play-step-backwards":case"play-step":this.timeline.addTimestampListener(this);break}this.autoSetTimelineBasedDisabled()}}autoSetTimelineBasedDisabled(){switch(this.timelineCommand){case"jump-to-start":case"play-pause":case"play-step-backwards":case"play-step":case"jump-to-end":{let e=this.timeline.timeRange();if(e.start===e.end){this.button.disabled=!0;return}switch(this.timelineCommand){case"jump-to-start":case"play-step-backwards":this.button.disabled=this.timeline.timestamp<this.timeline.maxTimestamp();break;case"jump-to-end":case"play-step":this.button.disabled=this.timeline.timestamp>this.timeline.minTimestamp();break;default:this.button.disabled=!1}break}}}setIcon(e){this.currentIconName!==e&&(this.currentIconName&&this.button.classList.remove(`svg-${this.currentIconName}`),this.button.classList.add(`svg-${e}`),this.currentIconName=e)}initialIcon(){return{"jump-to-start":"skip-to-start","play-pause":"play","play-step":"step-forward","play-step-backwards":"step-backward","jump-to-end":"skip-to-end",fullscreen:"enter-fullscreen","twizzle-link":"twizzle-tw"}[this.timelineCommand]}initialHoverTitle(){return{"jump-to-start":"Restart","play-pause":"Play","play-step":"Step forward","play-step-backwards":"Step backward","jump-to-end":"Skip to End",fullscreen:"Enter fullscreen","twizzle-link":"View at Twizzle"}[this.timelineCommand]}setHoverTitle(e){this.button.title=e}onPress(){switch(this.timelineCommand){case"fullscreen":document.fullscreenElement===this.fullscreenElement?document.exitFullscreen():(this.setIcon("exit-fullscreen"),this.fullscreenElement.requestFullscreen().then(()=>{let e=()=>{document.fullscreenElement!==this.fullscreenElement&&(this.setIcon("enter-fullscreen"),window.removeEventListener("fullscreenchange",e))};window.addEventListener("fullscreenchange",e)}));break;case"jump-to-start":this.timeline.setTimestamp(0);break;case"jump-to-end":this.timeline.jumpToEnd();break;case"play-pause":this.timeline.playPause();break;case"play-step":this.timeline.experimentalPlay(tt.Forwards,kt.Move);break;case"play-step-backwards":this.timeline.experimentalPlay(tt.Backwards,kt.Move);break;case"twizzle-link":this.visitTwizzleLinkCallback&&this.visitTwizzleLinkCallback();break}}onTimelineAction(e){switch(this.timelineCommand){case"jump-to-start":this.button.disabled=e.locationType===ti.StartOfTimeline&&e.action!==Fn.StartingToPlay;break;case"jump-to-end":this.button.disabled=e.locationType===ti.EndOfTimeline&&e.action!==Fn.StartingToPlay;break;case"play-pause":switch(e.action){case Fn.Pausing:this.setIcon("play"),this.setHoverTitle("Play");break;case Fn.StartingToPlay:this.setIcon("pause"),this.setHoverTitle("Pause");break}break;case"play-step":this.button.disabled=e.locationType===ti.EndOfTimeline&&e.action!==Fn.StartingToPlay;break;case"play-step-backwards":this.button.disabled=e.locationType===ti.StartOfTimeline&&e.action!==Fn.StartingToPlay;break}}onTimelineTimestampChange(e){}onTimeRangeChange(e){this.autoSetTimelineBasedDisabled()}};Qe.define("twisty-control-button",Wr);var vh,Rm=class extends rt{constructor(e,t){super();H(this,vh,new zn(this,"viewer-link-",["none","twizzle"]));this.addCSS(rm),S(this,vh).setValue(t?.viewerLink??"none"),this.addElement(new Wr(e,"fullscreen",{fullscreenElement:t?.fullscreenElement})),this.addElement(new Wr(e,"jump-to-start")),this.addElement(new Wr(e,"play-step-backwards")),this.addElement(new Wr(e,"play-pause")),this.addElement(new Wr(e,"play-step")),this.addElement(new Wr(e,"jump-to-end")),this.addElement(new Wr(e,"twizzle-link",{visitTwizzleLinkCallback:t?.viewerLinkCallback})).classList.add("twizzle-link-button")}setViewerLink(e){S(this,vh).setValue(e)}};vh=new WeakMap;Qe.define("twisty-control-button-panel",Rm);Ft();un();var Tm=class extends rt{constructor(e){super();this.range=document.createElement("input");this.timeline=e,this.addCSS(um),this.timeline?.addTimestampListener(this),this.range.type="range",this.range.step=1 .toString(),this.range.min=this.timeline?.minTimestamp().toString(),this.range.max=this.timeline?.maxTimestamp().toString(),this.range.value=this.timeline?.timestamp.toString(),this.range.addEventListener("input",this.onInput.bind(this)),this.addElement(this.range)}onTimelineTimestampChange(e){this.range.value=e.toString()}onTimeRangeChange(e){this.range.min=e.start.toString(),this.range.max=e.end.toString()}onInput(){this.timeline.setTimestamp(parseInt(this.range.value,10))}};Qe.define("twisty-scrubber",Tm);Ro();Ft();un();qc();Ht();Rr();Ft();un();var Zl,xh=class extends rt{constructor(e,t,n,i,o){super();this.svgSource=n;this.options=i;this.puzzleLoader=o;this.scheduler=new ln(this.render.bind(this));H(this,Zl,null);this.addCSS(Vd),this.definition=t,this.resetSVG(),e?.addPositionListener(this),this.options?.experimentalStickering&&this.experimentalSetStickering(this.options.experimentalStickering)}onPositionChange(e){if(e.movesInProgress.length>0){let t=e.movesInProgress[0].move,n=this.definition,i=t;e.movesInProgress[0].direction===tt.Backwards&&(i=t.invert());let o=gt(n,e.state,Ai(n,i));this.svg.draw(this.definition,e.state,o,e.movesInProgress[0].fraction)}else this.svg.draw(this.definition,e.state),$(this,Zl,e)}scheduleRender(){this.scheduler.requestAnimFrame()}experimentalSetStickering(e){(async()=>{if(!this.puzzleLoader?.appearance)return;let t=await this.puzzleLoader.appearance(e);this.resetSVG(t)})()}resetSVG(e){this.svg&&this.removeElement(this.svg.element),!!this.definition&&(this.svg=new Xo(this.definition,this.svgSource,e),this.addElement(this.svg.element),S(this,Zl)&&this.onPositionChange(S(this,Zl)))}render(){}};Zl=new WeakMap;Qe.define("twisty-2d-svg",xh);Ud();_2();function lE(r){return["3D","PG3D"].includes(r)}var lP={simple:Xs,tree:ei,simultaneous:nv},it,wh,Oi,bh,Uo,ni,Sh,tu,nu,Vr,$l,Lh,uE,ar,ea,Fm,uP,_m,cP,ta,Hr,eu,iu,qr,Ah,cE,Dh,hE,Cm,hP,Pm,fP,km,pP,Eh,fE,Mh,pE,Rh,dE,Bm,dP,Th,mE,Jl=class extends rt{constructor(e={},t=null,n=()=>{}){super();H(this,Vr);H(this,Lh);H(this,ar);H(this,Fm);H(this,_m);H(this,Hr);H(this,Ah);H(this,Dh);H(this,Cm);H(this,Pm);H(this,km);H(this,Eh);H(this,Mh);H(this,Rh);H(this,Bm);H(this,Th);H(this,it,void 0);this.scene=null;this.twisty3D=null;H(this,wh,!1);H(this,Oi,null);this.legacyExperimentalPG3D=null;H(this,bh,null);this.viewerElems=[];this.controlElems=[];H(this,Uo,!1);H(this,ni,void 0);this.legacyExperimentalCoalesceModFunc=e=>0;H(this,Sh,new zn(this,"controls-",["none","bottom-row"]));H(this,tu,void 0);H(this,nu,!1);H(this,ta,"tree");H(this,iu,[]);H(this,qr,null);this.addCSS(Ld),$(this,it,new Td(this,e)),$(this,tu,n),this.timeline=new rv,this.timeline.addActionListener(this),this.contentWrapper.classList.add("checkered"),$(this,Oi,t)}set alg(e){typeof e=="string"&&(e=re.fromString(e)),S(this,it).attributes.alg.setValue(e),this.cursor?.setAlg(e,ye(this,Hr,eu).call(this)),ye(this,Vr,$l).call(this),this.dispatchEvent(new CustomEvent("experimental-alg-update",{detail:{alg:this.alg}}))}get alg(){return S(this,it).attributes.alg.value}set experimentalSetupAlg(e){typeof e=="string"&&(console.warn("`experimentalSetupAlg` for a `TwistyPlayer` was set using a string. It should be set using a `Sequence`!"),e=new re(e)),S(this,it).attributes["experimental-setup-alg"].setValue(e),ye(this,Vr,$l).call(this)}get experimentalSetupAlg(){return S(this,it).attributes["experimental-setup-alg"].value}set experimentalSetupAnchor(e){S(this,it).attributes["experimental-setup-anchor"].setValue(e),ye(this,Vr,$l).call(this)}get experimentalSetupAnchor(){return S(this,it).attributes["experimental-setup-anchor"].value}set puzzle(e){S(this,it).attributes.puzzle.setValue(e)&&this.updatePuzzleDOM()}get puzzle(){return S(this,it).attributes.puzzle.value}set visualization(e){S(this,it).attributes.visualization.setValue(e)&&this.updatePuzzleDOM()}get visualization(){return S(this,it).attributes.visualization.value}set hintFacelets(e){S(this,it).attributes["hint-facelets"].setValue(e)&&this.twisty3D instanceof Ui&&this.twisty3D.experimentalUpdateOptions({hintFacelets:e})}get hintFacelets(){return S(this,it).attributes["hint-facelets"].value}set experimentalStickering(e){if(S(this,it).attributes["experimental-stickering"].setValue(e)){let t=this.twisty3D;t instanceof Ui&&t.experimentalUpdateOptions({experimentalStickering:e}),t instanceof wi&&(async()=>{let n=await ye(this,Mh,pE).call(this);t.experimentalSetAppearance(n)})(),this.viewerElems[0]instanceof xh&&this.viewerElems[0].experimentalSetStickering(this.experimentalStickering)}}get experimentalStickering(){return S(this,it).attributes["experimental-stickering"].value}set background(e){S(this,it).attributes.background.setValue(e)&&this.contentWrapper.classList.toggle("checkered",e==="checkered")}get background(){return S(this,it).attributes.background.value}set controlPanel(e){S(this,it).attributes["control-panel"].setValue(e),S(this,Sh).setValue(e)}get controlPanel(){return S(this,it).attributes["control-panel"].value}set controls(e){this.controlPanel=e}get controls(){return this.controlPanel}set backView(e){if(S(this,it).attributes["back-view"].setValue(e),e!=="none"&&this.viewerElems.length===1&&ye(this,Rh,dE).call(this),e==="none"&&this.viewerElems.length>1&&ye(this,Bm,dP).call(this),S(this,ni)&&S(this,ni).setBackView(e))for(let t of this.viewerElems)t.makeInvisibleUntilRender()}get backView(){return S(this,it).attributes["back-view"].value}set experimentalCameraLatitude(e){S(this,it).attributes["experimental-camera-latitude"].setValue(e);let t=ye(this,ar,ea).call(this);t&&e!==null&&(t.latitude=e,this.viewerElems[0].scheduleRender(),this.viewerElems[1]?.scheduleRender())}get experimentalCameraLatitude(){return S(this,it).attributes["experimental-camera-latitude"].value!==null?S(this,it).attributes["experimental-camera-latitude"].value:ye(this,ar,ea).call(this)?.latitude??null}set experimentalCameraLongitude(e){S(this,it).attributes["experimental-camera-longitude"].setValue(e);let t=ye(this,ar,ea).call(this);t&&e!==null&&(t.longitude=e,this.viewerElems[0].scheduleRender(),this.viewerElems[1]?.scheduleRender())}get experimentalCameraLongitude(){return S(this,it).attributes["experimental-camera-longitude"].value!==null?S(this,it).attributes["experimental-camera-longitude"].value:ye(this,ar,ea).call(this)?.longitude??null}set experimentalCameraLatitudeLimits(e){S(this,it).attributes["experimental-camera-latitude-limits"].setValue(e);let t=ye(this,ar,ea).call(this);console.log({orbitControls:t}),t&&(t.experimentalLatitudeLimits=e);let n=ye(this,Fm,uP).call(this);n&&(n.experimentalLatitudeLimits=e)}get experimentalCameraLatitudeLimits(){return S(this,it).attributes["experimental-camera-latitude-limits"].value}set viewerLink(e){S(this,it).attributes["viewer-link"].setValue(e);let t=this.controlElems[1];t?.setViewerLink&&t.setViewerLink(e)}get viewerLink(){return S(this,it).attributes["viewer-link"].value}experimentalSetCameraOrbitCoordinates(e){this.experimentalCameraLatitude=e.latitude,this.experimentalCameraLongitude=e.longitude;let t=ye(this,ar,ea).call(this);t&&(t.distance=e.distance)}experimentalDerivedCameraOrbitCoordinates(){let e=Hc(this.puzzle,this.twisty3D instanceof wi?"PG3D":"Cube3D");return{latitude:this.experimentalCameraLatitude??e.latitude,longitude:this.experimentalCameraLongitude??e.longitude,distance:e.distance}}static get observedAttributes(){return Td.observedAttributes}attributeChangedCallback(e,t,n){S(this,it).attributeChangedCallback(e,t,n)}experimentalSetStartStateOverride(e){$(this,bh,e),ye(this,Vr,$l).call(this)}experimentalSetCursorIndexer(e){S(this,ta)!==e&&($(this,ta,e),this.cursor?.experimentalSetIndexer(ye(this,Hr,eu).call(this)))}connectedCallback(){this.contentWrapper.classList.toggle("checkered",this.background==="checkered");let t=this.backView&&lE(this.visualization)?this.backView:"none";$(this,ni,new Rd({backView:t})),this.addElement(S(this,ni));let n=new Tm(this.timeline),i=new Rm(this.timeline,{fullscreenElement:this,viewerLinkCallback:this.visitTwizzleLink.bind(this),viewerLink:this.viewerLink});this.controlElems=[n,i],S(this,Sh).setValue(this.controlPanel),this.addElement(this.controlElems[0]),this.addElement(this.controlElems[1]),$(this,wh,!0),this.updatePuzzleDOM(!0).then(()=>{S(this,nu)||($(this,nu,!0),this.dispatchEvent(new CustomEvent("initialized")))})}get initialized(){return S(this,nu)}twizzleLink(){let e=new URL("https://alpha.twizzle.net/edit/");return this.alg.experimentalIsEmpty()||e.searchParams.set("alg",this.alg.toString()),this.experimentalSetupAlg.experimentalIsEmpty()||e.searchParams.set("experimental-setup-alg",this.experimentalSetupAlg.toString()),this.experimentalSetupAnchor!=="start"&&e.searchParams.set("experimental-setup-anchor",this.experimentalSetupAnchor),this.experimentalStickering!=="full"&&e.searchParams.set("experimental-stickering",this.experimentalStickering),this.puzzle!=="3x3x3"&&e.searchParams.set("puzzle",this.puzzle),e.toString()}visitTwizzleLink(){let e=document.createElement("a");e.href=this.twizzleLink(),e.target="_blank",e.click()}async updatePuzzleDOM(e=!1){if(!S(this,wh))return;let t;this.puzzle==="custom"?t={id:"custom",fullName:"Custom (PG3D)",def:()=>Promise.resolve(S(this,Oi).def),svg:()=>{throw"unimplemented"}}:t=Ot[this.puzzle];for(let s of S(this,iu))s.cancelled=!0;$(this,iu,[]);let n={cancelled:!1};S(this,iu).push(n);let i=await t.def();if(n.cancelled)return;let o;try{o=new Mm(this.timeline,i,this.alg,ye(this,Lh,uE).call(this),ye(this,Hr,eu).call(this)),ye(this,Eh,fE).call(this,o)}catch(s){e&&S(this,tu).call(this,this.alg),o=new Mm(this.timeline,i,new re,new re,ye(this,Hr,eu).call(this)),ye(this,Eh,fE).call(this,o)}switch(e&&this.experimentalSetupAlg.experimentalIsEmpty()&&this.experimentalSetupAnchor!=="end"&&this.timeline.jumpToEnd(),this.visualization){case"2D":case"experimental-2D-LL":{let s={};this.experimentalStickering&&(s.experimentalStickering=this.experimentalStickering),ye(this,Dh,hE).call(this);let a=this.visualization==="2D"?t.svg:t.llSVG??t.svg,l=new xh(o,i,await a(),s,t);n.cancelled||ye(this,Cm,hP).call(this,l)}break;case"3D":case"PG3D":{ye(this,Pm,fP).call(this);let s=this.scene,a;if(this.visualization==="3D"&&this.puzzle==="3x3x3")a=new Ui(i,o,s.scheduleRender.bind(s),{hintFacelets:this.hintFacelets,experimentalStickering:this.experimentalStickering});else{let l,u,c=t.pg;if(this.puzzle==="custom")l=S(this,Oi).def,u=S(this,Oi).stickerDat;else if(c){let g=await c();if(n.cancelled)return;l=g.writekpuzzle(!0),u=g.get3d()}else throw"Unimplemented!";let f={},h={megaminx:1.5,pyraminx:1.75},p=S(this,Oi)?.hintStickerHeightScale??h[this.puzzle]??1,d=new wi(o,s.scheduleRender.bind(s),l,u,S(this,Oi)?.showFoundation??!0,S(this,Oi)?.hintStickers??this.hintFacelets==="floating",p,f);(async()=>{let g=await ye(this,Mh,pE).call(this);g&&d.experimentalSetAppearance(g)})(),this.legacyExperimentalPG3D=d,a=d}ye(this,km,pP).call(this,a)}break}}async setCustomPuzzleGeometry(e){this.puzzle="custom",$(this,Oi,e),await this.updatePuzzleDOM()}experimentalAddMove(e,t=!1,n=!1){S(this,Uo)&&ye(this,Th,mE).call(this);let i=Bs(this.alg),o=fr(this.alg,e,{coalesce:t&&!n,mod:this.legacyExperimentalCoalesceModFunc(e)});t&&n&&$(this,Uo,!0),this.alg=o,i<=Bs(o)?this.timeline.experimentalJumpToLastMove():this.timeline.jumpToEnd(),this.timeline.play()}onTimelineAction(e){e.action===Fn.Pausing&&e.locationType===ti.EndOfTimeline&&S(this,Uo)&&(ye(this,Th,mE).call(this),this.timeline.jumpToEnd())}fullscreen(){this.requestFullscreen()}};it=new WeakMap,wh=new WeakMap,Oi=new WeakMap,bh=new WeakMap,Uo=new WeakMap,ni=new WeakMap,Sh=new WeakMap,tu=new WeakMap,nu=new WeakMap,Vr=new WeakSet,$l=function(){this.cursor&&this.cursor.setStartState(S(this,bh)??this.cursor.algToState(ye(this,Lh,uE).call(this)))},Lh=new WeakSet,uE=function(){let e=this.experimentalSetupAlg;return this.experimentalSetupAnchor==="end"&&(e=e.concat(this.alg.invert())),e},ar=new WeakSet,ea=function(){return["3D","PG3D"].includes(S(this,it).attributes.visualization.value)?this.viewerElems[0]?.orbitControls??null:null},Fm=new WeakSet,uP=function(){return["3D","PG3D"].includes(S(this,it).attributes.visualization.value)?this.viewerElems[1]?.orbitControls??null:null},_m=new WeakSet,cP=function(){switch(this.puzzle){case"pyraminx":case"master_tetraminx":return ZA;default:return new M(0,0,0)}},ta=new WeakMap,Hr=new WeakSet,eu=function(){return lP[S(this,ta)]},iu=new WeakMap,qr=new WeakMap,Ah=new WeakSet,cE=function(){switch(S(this,qr)){case"3D":this.scene=null,this.twisty3D=null,this.legacyExperimentalPG3D=null,this.viewerElems=[],S(this,ni).clear();break;case"2D":this.viewerElems=[],S(this,ni).clear();break}$(this,qr,null)},Dh=new WeakSet,hE=function(){S(this,qr)!=="2D"&&(ye(this,Ah,cE).call(this),$(this,qr,"2D"))},Cm=new WeakSet,hP=function(e){ye(this,Dh,hE).call(this),S(this,ni).clear(),S(this,ni).addElement(e),this.viewerElems.push(e)},Pm=new WeakSet,fP=function(){if(S(this,qr)==="3D")return;ye(this,Ah,cE).call(this),this.scene=new th;let e=new kr(this.scene,{orbitCoordinates:this.experimentalDerivedCameraOrbitCoordinates()});e.orbitControls.experimentalLatitudeLimits=this.experimentalCameraLatitudeLimits,this.viewerElems.push(e),S(this,ni).addElement(e),this.backView!=="none"&&ye(this,Rh,dE).call(this),$(this,qr,"3D")},km=new WeakSet,pP=function(e){this.twisty3D&&(this.scene.removeTwisty3DPuzzle(this.twisty3D),this.twisty3D instanceof wi&&this.twisty3D.dispose(),this.twisty3D=null),this.twisty3D=e,this.scene.addTwisty3DPuzzle(e);let t=ye(this,ar,ea).call(this);t&&t.lookAt(ye(this,_m,cP).call(this))},Eh=new WeakSet,fE=function(e){let t=this.cursor;this.cursor=e;try{this.cursor.setAlg(this.alg,ye(this,Hr,eu).call(this)),ye(this,Vr,$l).call(this)}catch(n){this.cursor.setAlg(new re,ye(this,Hr,eu).call(this)),this.cursor.setStartState(this.cursor.algToState(new re)),S(this,tu).call(this,this.alg)}ye(this,Vr,$l).call(this),this.timeline.addCursor(e),t&&(this.timeline.removeCursor(t),this.timeline.removeTimestampListener(t)),this.experimentalSetCursorIndexer(S(this,ta))},Mh=new WeakSet,pE=async function(){let e=Ot[this.puzzle];return e?.appearance?e.appearance(this.experimentalStickering??"full"):null},Rh=new WeakSet,dE=function(){if(!lE(this.visualization))throw new Error("Back viewer requires a 3D visualization");let e=new kr(this.scene,{orbitCoordinates:this.experimentalDerivedCameraOrbitCoordinates(),negateCameraPosition:!0});e.orbitControls.experimentalLatitudeLimits=this.experimentalCameraLatitudeLimits,this.viewerElems.push(e),this.viewerElems[0].setMirror(e),S(this,ni).addElement(e)},Bm=new WeakSet,dP=function(){if(this.viewerElems.length!==2)throw new Error("Tried to remove non-existent back view!");S(this,ni).removeElement(this.viewerElems.pop())},Th=new WeakSet,mE=function(){let e=Array.from(this.alg.units()),t=e.length,n=S(this,Uo);if($(this,Uo,!1),n&&t>1&&e[t-1].is(E)){let i=e[t-1],o=fr(new re(e.slice(0,t-1)),i,{coalesce:!0,mod:this.legacyExperimentalCoalesceModFunc(i)});this.alg=o}};Qe.define("twisty-player-v1",Jl);Oe();qn();Ft();un();Ft();var gE=new Xt(`
|
|
7410
|
+
`);var Dm="for-twisty-player",oE="placeholder",sE="twisty-player-prop",en,Io,Js,Or,$s,Mm,sr,Gr,Kl,nv,mh,gh,aE,yh,Em=class extends rt{constructor(e){super();H(this,Kl);H(this,gh);this.model=new tv;H(this,en,document.createElement("textarea"));H(this,Io,document.createElement("div"));H(this,Js,document.createElement("span"));H(this,Or,document.createElement("span"));H(this,$s,document.createElement("span"));H(this,Mm,new zn(this,"valid-for-puzzle-",["none","warning","error"]));H(this,sr,null);H(this,Gr,void 0);H(this,mh,!1);H(this,yh,null);S(this,Io).classList.add("carbon-copy"),this.addElement(S(this,Io)),S(this,en).rows=1,this.addElement(S(this,en)),S(this,Js).classList.add("prefix"),S(this,Io).appendChild(S(this,Js)),S(this,Or).classList.add("highlight"),S(this,Io).appendChild(S(this,Or)),S(this,$s).classList.add("suffix"),S(this,Io).appendChild(S(this,$s)),S(this,en).placeholder="Alg",S(this,en).setAttribute("spellcheck","false"),this.addCSS(rE),S(this,en).addEventListener("input",()=>{$(this,mh,!0),this.onInput()}),S(this,en).addEventListener("blur",()=>this.onBlur()),document.addEventListener("selectionchange",()=>this.onSelectionChange()),e?.twistyPlayer&&(this.twistyPlayer=e.twistyPlayer),$(this,Gr,e?.twistyPlayerProp??"algProp"),e?.twistyPlayerProp==="algProp"&&this.model.leafToHighlight.addFreshListener(t=>{t&&this.highlightLeaf(t.leafInfo.leaf)})}set algString(e){S(this,en).value=e,this.onInput()}get algString(){return S(this,en).value}set placeholder(e){S(this,en).placeholder=e}onInput(){S(this,Or).hidden=!0,this.highlightLeaf(null);let e=S(this,en).value.trimEnd();this.model.valueProp.set(e),S(this,Kl,nv)?.set(e)}async onSelectionChange(){if(document.activeElement!==this||this.shadow.activeElement!==S(this,en)||S(this,Gr)!=="algProp")return;let{selectionStart:e,selectionEnd:t}=S(this,en);this.model.selectionProp.set({selectionStart:e,selectionEnd:t})}async onBlur(){}setAlgIssueClassForPuzzle(e){S(this,Mm).setValue(e)}highlightLeaf(e){if(S(this,Gr)==="algProp"){if(e===null){S(this,Js).textContent="",S(this,Or).textContent="",S(this,$s).textContent=ye(this,gh,aE).call(this,S(this,en).value);return}e!==S(this,yh)&&($(this,yh,e),S(this,Js).textContent=S(this,en).value.slice(0,e.startCharIndex),S(this,Or).textContent=S(this,en).value.slice(e.startCharIndex,e.endCharIndex),S(this,$s).textContent=ye(this,gh,aE).call(this,S(this,en).value.slice(e.endCharIndex)),S(this,Or).hidden=!1)}}get twistyPlayer(){return S(this,sr)}set twistyPlayer(e){if(S(this,sr)){console.warn("twisty-player reassignment/clearing is not supported");return}$(this,sr,e),!!e&&((async()=>{this.algString=S(this,Kl,nv)?(await S(this,Kl,nv).get()).alg.toString():""})(),S(this,Gr)==="algProp"&&(S(this,sr)?.experimentalModel.puzzleAlgProp.addFreshListener(t=>{if(t.issues.errors.length===0){this.setAlgIssueClassForPuzzle(t.issues.warnings.length===0?"none":"warning");let n=t.alg,i=re.fromString(this.algString);n.isIdentical(i)||(this.algString=n.toString(),this.onInput())}else this.setAlgIssueClassForPuzzle("error")}),this.model.leafToHighlight.addFreshListener(async t=>{if(t===null)return;let[n,i]=await Promise.all([await e.experimentalModel.indexerProp.get(),await e.experimentalModel.timestampRequestProp.get()]);if(i==="opposite-anchor"&&!S(this,mh))return;let o=n.indexToMoveStartTimestamp(t.leafInfo.idx),s=n.moveDuration(t.leafInfo.idx),a;switch(t.where){case"before":a=o;break;case"start":case"inside":a=o+s/4;break;case"end":case"after":a=o+s;break;default:throw console.log("invalid where"),new Error("Invalid where!")}e.experimentalModel.timestampRequestProp.set(a)}),e.experimentalModel.currentLeavesSimplifiedProp.addFreshListener(async t=>{let i=(await e.experimentalModel.indexerProp.get()).getAnimLeaf(t.stateIndex);this.highlightLeaf(i)})))}attributeChangedCallback(e,t,n){switch(e){case Dm:{let i=document.getElementById(n);if(!i){console.warn(`${Dm}= elem does not exist`);return}if(!(i instanceof zo)){console.warn(`${Dm}=is not a twisty-player`);return}this.twistyPlayer=i;return}case oE:this.placeholder=n;return;case sE:if(S(this,sr))throw console.log("cannot set prop"),new Error("cannot set prop after twisty player");$(this,Gr,n);return}}static get observedAttributes(){return[Dm,oE,sE]}};en=new WeakMap,Io=new WeakMap,Js=new WeakMap,Or=new WeakMap,$s=new WeakMap,Mm=new WeakMap,sr=new WeakMap,Gr=new WeakMap,Kl=new WeakSet,nv=function(){return S(this,sr)===null?null:S(this,sr).experimentalModel[S(this,Gr)]},mh=new WeakMap,gh=new WeakSet,aE=function(e){return e.endsWith(`
|
|
7411
|
+
`)?e+" ":e},yh=new WeakMap;Qe.define("twisty-alg-editor",Em);Ud();li();Oe();qn();Qc();Xc();Y2();Oe();Ht();var Rm=class{constructor(e,t,n,i,o){this.timeline=e;this.def=t;this.alg=n;this.positionListeners=new Set;this.indexerConstructor=ei;this.ksolvePuzzle=new Tn(t),o&&(this.indexerConstructor=o),this.instantiateIndexer(n),this.startState=i?this.algToState(i):this.ksolvePuzzle.startState(),e.addTimestampListener(this)}setStartState(e){this.startState=e,this.dispatchPositionForTimestamp(this.timeline.timestamp)}experimentalSetIndexer(e){this.indexerConstructor=e,this.instantiateIndexer(this.alg),this.timeline.onCursorChange(this),this.dispatchPositionForTimestamp(this.timeline.timestamp)}instantiateIndexer(e){this.indexer=new this.indexerConstructor(this.ksolvePuzzle,e)}algToState(e){let t=new pn(this.def);return t.applyAlg(e),this.ksolvePuzzle.combine(this.def.startPieces,t.state)}timeRange(){return{start:0,end:this.indexer.algDuration()}}experimentalTimestampForStartOfLastMove(){let e=this.indexer.numAnimatedLeaves();return e>0?this.indexer.indexToMoveStartTimestamp(e-1):0}addPositionListener(e){this.positionListeners.add(e),this.dispatchPositionForTimestamp(this.timeline.timestamp,[e])}removePositionListener(e){this.positionListeners.delete(e)}onTimelineTimestampChange(e){this.dispatchPositionForTimestamp(e)}dispatchPositionForTimestamp(e,t=this.positionListeners){let n;if(this.indexer.timestampToPosition)n=this.indexer.timestampToPosition(e,this.startState);else{let i=this.indexer.timestampToIndex(e),o=this.indexer.stateAtIndex(i,this.startState);if(n={state:o,movesInProgress:[]},this.indexer.numAnimatedLeaves()>0){let s=this.indexer.getAnimLeaf(i)?.as(E);if(!s)return;let a=(e-this.indexer.indexToMoveStartTimestamp(i))/this.indexer.moveDuration(i);a===1?n.state=this.ksolvePuzzle.combine(o,this.ksolvePuzzle.stateFromMove(s)):a>0&&s&&n.movesInProgress.push({move:s,direction:tt.Forwards,fraction:a})}}for(let i of t)i.onPositionChange(n)}onTimeRangeChange(e){}setAlg(e,t){t??(t=this.indexerConstructor),!(e.isIdentical(this.alg)&&this.indexerConstructor===t)&&(this.indexerConstructor=t,this.alg=e,this.instantiateIndexer(e),this.timeline.onCursorChange(this),this.dispatchPositionForTimestamp(this.timeline.timestamp))}moveBoundary(e,t){if(this.indexer.numAnimatedLeaves()===0)return null;let n=Cl(t)*.001,i=this.indexer.timestampToIndex(e+n),o=this.indexer.indexToMoveStartTimestamp(i);if(t===tt.Backwards)return e>=o?o:null;{let s=o+this.indexer.moveDuration(i);return e<=s?s:null}}setPuzzle(e,t=this.alg,n){this.ksolvePuzzle=new Tn(e),this.def=e,this.indexer=new this.indexerConstructor(this.ksolvePuzzle,t),t!==this.alg&&this.timeline.onCursorChange(this),this.setStartState(n?this.algToState(n):this.ksolvePuzzle.startState()),this.alg=t}experimentalTimestampFromIndex(e){return this.indexer.indexToMoveStartTimestamp(e)}experimentalIndexFromTimestamp(e){return this.indexer.timestampToIndex(e)}experimentalLeafAtIndex(e){return this.indexer.getAnimLeaf(e)}};Oe();var aP={"y' y' U' E D R2 r2 F2 B2 U E D' R2 L2' z2 S2 U U D D S2 F2' B2":[{animLeaf:new E("y",-1),start:0,end:1e3},{animLeaf:new E("y",-1),start:1e3,end:2e3},{animLeaf:new E("U",-1),start:1e3,end:1600},{animLeaf:new E("E",1),start:1200,end:1800},{animLeaf:new E("D"),start:1400,end:2e3},{animLeaf:new E("R",2),start:2e3,end:3500},{animLeaf:new E("r",2),start:2e3,end:3500},{animLeaf:new E("F",2),start:3500,end:4200},{animLeaf:new E("B",2),start:3800,end:4500},{animLeaf:new E("U",1),start:4500,end:5500},{animLeaf:new E("E",1),start:4500,end:5500},{animLeaf:new E("D",-1),start:4500,end:5500},{animLeaf:new E("R",2),start:5500,end:6500},{animLeaf:new E("L",-2),start:5500,end:6500},{animLeaf:new E("z",2),start:5500,end:6500},{animLeaf:new E("S",2),start:6500,end:7500},{animLeaf:new E("U"),start:7500,end:8e3},{animLeaf:new E("U"),start:8e3,end:8500},{animLeaf:new E("D"),start:7750,end:8250},{animLeaf:new E("D"),start:8250,end:8750},{animLeaf:new E("S",2),start:8750,end:9250},{animLeaf:new E("F",-2),start:8750,end:1e4},{animLeaf:new E("B",2),start:8750,end:1e4}],"M' R' U' D' M R":[{animLeaf:new E("M",-1),start:0,end:1e3},{animLeaf:new E("R",-1),start:0,end:1e3},{animLeaf:new E("U",-1),start:1e3,end:2e3},{animLeaf:new E("D",-1),start:1e3,end:2e3},{animLeaf:new E("M"),start:2e3,end:3e3},{animLeaf:new E("R"),start:2e3,end:3e3}],"U' E' r E r2' E r U E":[{animLeaf:new E("U",-1),start:0,end:1e3},{animLeaf:new E("E",-1),start:0,end:1e3},{animLeaf:new E("r"),start:1e3,end:2500},{animLeaf:new E("E"),start:2500,end:3500},{animLeaf:new E("r",-2),start:3500,end:5e3},{animLeaf:new E("E"),start:5e3,end:6e3},{animLeaf:new E("r"),start:6e3,end:7e3},{animLeaf:new E("U"),start:7e3,end:8e3},{animLeaf:new E("E"),start:7e3,end:8e3}]},iv=class{constructor(e,t){this.puzzle=e;this.animLeaves=aP[t.toString()]??vm(t)}getAnimLeaf(e){return this.animLeaves[Math.min(e,this.animLeaves.length-1)]?.animLeaf??null}getAnimLeafWithRange(e){return this.animLeaves[Math.min(e,this.animLeaves.length-1)]}indexToMoveStartTimestamp(e){let t=0;return this.animLeaves.length>0&&(t=this.animLeaves[Math.min(e,this.animLeaves.length-1)].start),t}timestampToIndex(e){let t=0;for(t=0;t<this.animLeaves.length;t++)if(this.animLeaves[t].start>=e)return Math.max(0,t-1);return Math.max(0,t-1)}timestampToPosition(e,t){let n={state:t??this.puzzle.identity(),movesInProgress:[]};for(let i of this.animLeaves)if(i.end<=e){let o=i.animLeaf.as(E);o!==null&&(n.state=this.puzzle.combine(n.state,this.puzzle.stateFromMove(o)))}else if(i.start<e&&e<i.end){let o=i.animLeaf.as(E);o!==null&&n.movesInProgress.push({move:o,direction:tt.Forwards,fraction:(e-i.start)/(i.end-i.start)})}else if(e<i.start)continue;return n}stateAtIndex(e,t){let n=t??this.puzzle.startState();for(let i=0;i<this.animLeaves.length&&i<e;i++){let s=this.animLeaves[i].animLeaf.as(E);s!==null&&(n=this.puzzle.combine(n,this.puzzle.stateFromMove(s)))}return n}transformAtIndex(e){let t=this.puzzle.identity();for(let n of this.animLeaves.slice(0,e)){let i=n.animLeaf.as(E);i!==null&&(t=this.puzzle.combine(t,this.puzzle.stateFromMove(i)))}return t}algDuration(){let e=0;for(let t of this.animLeaves)e=Math.max(e,t.end);return e}numAnimatedLeaves(){return this.animLeaves.length}moveDuration(e){let t=this.getAnimLeafWithRange(e);return t.end-t.start}};Rr();var lP=!0,Fn;(function(n){n.StartingToPlay="StartingToPlay",n.Pausing="Pausing",n.Jumping="Jumping"})(Fn||(Fn={}));var ti;(function(s){s.StartOfTimeline="Start",s.EndOfTimeline="End",s.StartOfMove="StartOfMove",s.EndOfMove="EndOfMove",s.MiddleOfMove="MiddleOfMove",s.BetweenMoves="BetweenMoves"})(ti||(ti={}));function rv(){return Math.round(performance.now())}var ov=class{constructor(){this.animating=!1;this.tempoScale=1;this.cursors=new Set;this.timestampListeners=new Set;this.actionListeners=new Set;this.timestamp=0;this.lastAnimFrameNow=0;this.direction=tt.Forwards;this.boundaryType=kt.EntireTimeline;let e=t=>{if(this.animating){let n=rv();this.timestamp=this.timestamp+this.tempoScale*Cl(this.direction)*(n-this.lastAnimFrameNow),this.lastAnimFrameNow=n,(this.direction===tt.Backwards?this.timestamp<=this.cachedNextBoundary:this.timestamp>=this.cachedNextBoundary)&&(this.timestamp=this.cachedNextBoundary,this.animating&&(this.animating=!1,this.dispatchAction(Fn.Pausing)))}this.timestamp!==this.lastAnimFrameTimestamp&&(this.dispatchTimestamp(),this.lastAnimFrameTimestamp=this.timestamp),this.animating&&this.scheduler.requestAnimFrame()};this.scheduler=new ln(e)}addCursor(e){this.cursors.add(e),this.dispatchTimeRange()}removeCursor(e){this.cursors.delete(e),this.clampTimestampToRange(),this.dispatchTimeRange()}clampTimestampToRange(){let e=this.timeRange();this.timestamp<e.start&&this.setTimestamp(e.start),this.timestamp>e.end&&this.setTimestamp(e.end)}onCursorChange(e){this.timestamp>this.maxTimestamp()&&(this.timestamp=this.maxTimestamp()),this.dispatchTimeRange()}timeRange(){let e=0,t=0;for(let n of this.cursors){let i=n.timeRange();e=Math.min(e,i.start),t=Math.max(t,i.end)}return{start:e,end:t}}minTimestamp(){return this.timeRange().start}maxTimestamp(){return this.timeRange().end}dispatchTimeRange(){let e=this.timeRange();for(let t of this.cursors)t.onTimeRangeChange(e);for(let t of this.timestampListeners)t.onTimeRangeChange(e)}dispatchTimestamp(){for(let e of this.cursors)e.onTimelineTimestampChange(this.timestamp);for(let e of this.timestampListeners)e.onTimelineTimestampChange(this.timestamp)}addTimestampListener(e){this.timestampListeners.add(e)}removeTimestampListener(e){this.timestampListeners.delete(e)}addActionListener(e){this.actionListeners.add(e)}removeActionListener(e){this.actionListeners.delete(e)}play(){this.experimentalPlay(tt.Forwards,kt.EntireTimeline)}experimentalPlay(e,t=kt.EntireTimeline){this.direction=e,this.boundaryType=t;let n=this.nextBoundary(this.timestamp,e,this.boundaryType);n!==null&&(this.cachedNextBoundary=n,this.animating||(this.animating=!0,this.lastAnimFrameNow=rv(),this.dispatchAction(Fn.StartingToPlay),this.scheduler.requestAnimFrame()))}nextBoundary(e,t,n=kt.EntireTimeline){switch(n){case kt.EntireTimeline:switch(t){case tt.Backwards:return e<=this.minTimestamp()?null:this.minTimestamp();case tt.Forwards:return e>=this.maxTimestamp()?null:this.maxTimestamp();default:throw new Error("invalid direction")}case kt.Move:{let i=null;for(let o of this.cursors){let s=o.moveBoundary(e,t);if(s!==null)switch(t){case tt.Backwards:{i=Math.min(i??s,s);break}case tt.Forwards:{i=Math.max(i??s,s);break}default:throw new Error("invalid direction")}}return i}default:throw new Error("invalid boundary type")}}pause(){this.animating&&(this.animating=!1,this.dispatchAction(Fn.Pausing),this.scheduler.requestAnimFrame())}playPause(){this.animating?this.pause():(this.timestamp>=this.maxTimestamp()&&(this.timestamp=0),this.experimentalPlay(tt.Forwards,kt.EntireTimeline))}setTimestamp(e){let t=this.timestamp;this.timestamp=e,this.lastAnimFrameNow=rv(),t!==e&&(this.dispatchAction(Fn.Jumping),this.scheduler.requestAnimFrame()),lP&&(this.animating=!1,this.dispatchAction(Fn.Pausing))}jumpToStart(){this.setTimestamp(this.minTimestamp())}jumpToEnd(){this.setTimestamp(this.maxTimestamp())}experimentalJumpToLastMove(){let e=0;for(let t of this.cursors)e=Math.max(e,t.experimentalTimestampForStartOfLastMove()??0);this.setTimestamp(e)}dispatchAction(e){let t=ti.MiddleOfMove;switch(this.timestamp){case this.minTimestamp():t=ti.StartOfTimeline;break;case this.maxTimestamp():t=ti.EndOfTimeline;break}let n={action:e,locationType:t};for(let i of this.actionListeners)i.onTimelineAction(n)}};Ro();Tt();un();var Wr=class extends rt{constructor(e,t,n){super();this.currentIconName=null;this.button=document.createElement("button");this.fullscreenElement=null;this.visitTwizzleLinkCallback=null;switch(this.fullscreenElement=n?.fullscreenElement??null,this.visitTwizzleLinkCallback=n?.visitTwizzleLinkCallback??null,e||console.warn("Must have timeline!"),this.timeline=e,t||console.warn("Must have timelineCommand!"),this.timelineCommand=t,this.addCSS(sm),this.setIcon(this.initialIcon()),this.setHoverTitle(this.initialHoverTitle()),this.addElement(this.button),this.addEventListener("click",this.onPress.bind(this)),this.timelineCommand){case"fullscreen":document.fullscreenEnabled||(this.button.disabled=!0);break;case"jump-to-start":case"play-step-backwards":this.button.disabled=!0;break}if(this.timeline){switch(this.timeline.addActionListener(this),this.timelineCommand){case"play-pause":case"play-step-backwards":case"play-step":this.timeline.addTimestampListener(this);break}this.autoSetTimelineBasedDisabled()}}autoSetTimelineBasedDisabled(){switch(this.timelineCommand){case"jump-to-start":case"play-pause":case"play-step-backwards":case"play-step":case"jump-to-end":{let e=this.timeline.timeRange();if(e.start===e.end){this.button.disabled=!0;return}switch(this.timelineCommand){case"jump-to-start":case"play-step-backwards":this.button.disabled=this.timeline.timestamp<this.timeline.maxTimestamp();break;case"jump-to-end":case"play-step":this.button.disabled=this.timeline.timestamp>this.timeline.minTimestamp();break;default:this.button.disabled=!1}break}}}setIcon(e){this.currentIconName!==e&&(this.currentIconName&&this.button.classList.remove(`svg-${this.currentIconName}`),this.button.classList.add(`svg-${e}`),this.currentIconName=e)}initialIcon(){return{"jump-to-start":"skip-to-start","play-pause":"play","play-step":"step-forward","play-step-backwards":"step-backward","jump-to-end":"skip-to-end",fullscreen:"enter-fullscreen","twizzle-link":"twizzle-tw"}[this.timelineCommand]}initialHoverTitle(){return{"jump-to-start":"Restart","play-pause":"Play","play-step":"Step forward","play-step-backwards":"Step backward","jump-to-end":"Skip to End",fullscreen:"Enter fullscreen","twizzle-link":"View at Twizzle"}[this.timelineCommand]}setHoverTitle(e){this.button.title=e}onPress(){switch(this.timelineCommand){case"fullscreen":document.fullscreenElement===this.fullscreenElement?document.exitFullscreen():(this.setIcon("exit-fullscreen"),this.fullscreenElement.requestFullscreen().then(()=>{let e=()=>{document.fullscreenElement!==this.fullscreenElement&&(this.setIcon("enter-fullscreen"),window.removeEventListener("fullscreenchange",e))};window.addEventListener("fullscreenchange",e)}));break;case"jump-to-start":this.timeline.setTimestamp(0);break;case"jump-to-end":this.timeline.jumpToEnd();break;case"play-pause":this.timeline.playPause();break;case"play-step":this.timeline.experimentalPlay(tt.Forwards,kt.Move);break;case"play-step-backwards":this.timeline.experimentalPlay(tt.Backwards,kt.Move);break;case"twizzle-link":this.visitTwizzleLinkCallback&&this.visitTwizzleLinkCallback();break}}onTimelineAction(e){switch(this.timelineCommand){case"jump-to-start":this.button.disabled=e.locationType===ti.StartOfTimeline&&e.action!==Fn.StartingToPlay;break;case"jump-to-end":this.button.disabled=e.locationType===ti.EndOfTimeline&&e.action!==Fn.StartingToPlay;break;case"play-pause":switch(e.action){case Fn.Pausing:this.setIcon("play"),this.setHoverTitle("Play");break;case Fn.StartingToPlay:this.setIcon("pause"),this.setHoverTitle("Pause");break}break;case"play-step":this.button.disabled=e.locationType===ti.EndOfTimeline&&e.action!==Fn.StartingToPlay;break;case"play-step-backwards":this.button.disabled=e.locationType===ti.StartOfTimeline&&e.action!==Fn.StartingToPlay;break}}onTimelineTimestampChange(e){}onTimeRangeChange(e){this.autoSetTimelineBasedDisabled()}};Qe.define("twisty-control-button",Wr);var vh,Tm=class extends rt{constructor(e,t){super();H(this,vh,new zn(this,"viewer-link-",["none","twizzle"]));this.addCSS(om),S(this,vh).setValue(t?.viewerLink??"none"),this.addElement(new Wr(e,"fullscreen",{fullscreenElement:t?.fullscreenElement})),this.addElement(new Wr(e,"jump-to-start")),this.addElement(new Wr(e,"play-step-backwards")),this.addElement(new Wr(e,"play-pause")),this.addElement(new Wr(e,"play-step")),this.addElement(new Wr(e,"jump-to-end")),this.addElement(new Wr(e,"twizzle-link",{visitTwizzleLinkCallback:t?.viewerLinkCallback})).classList.add("twizzle-link-button")}setViewerLink(e){S(this,vh).setValue(e)}};vh=new WeakMap;Qe.define("twisty-control-button-panel",Tm);Tt();un();var Fm=class extends rt{constructor(e){super();this.range=document.createElement("input");this.timeline=e,this.addCSS(cm),this.timeline?.addTimestampListener(this),this.range.type="range",this.range.step=1 .toString(),this.range.min=this.timeline?.minTimestamp().toString(),this.range.max=this.timeline?.maxTimestamp().toString(),this.range.value=this.timeline?.timestamp.toString(),this.range.addEventListener("input",this.onInput.bind(this)),this.addElement(this.range)}onTimelineTimestampChange(e){this.range.value=e.toString()}onTimeRangeChange(e){this.range.min=e.start.toString(),this.range.max=e.end.toString()}onInput(){this.timeline.setTimestamp(parseInt(this.range.value,10))}};Qe.define("twisty-scrubber",Fm);Ro();Tt();un();qc();Ht();Rr();Tt();un();var Zl,xh=class extends rt{constructor(e,t,n,i,o){super();this.svgSource=n;this.options=i;this.puzzleLoader=o;this.scheduler=new ln(this.render.bind(this));H(this,Zl,null);this.addCSS(Vd),this.definition=t,this.resetSVG(),e?.addPositionListener(this),this.options?.experimentalStickering&&this.experimentalSetStickering(this.options.experimentalStickering)}onPositionChange(e){if(e.movesInProgress.length>0){let t=e.movesInProgress[0].move,n=this.definition,i=t;e.movesInProgress[0].direction===tt.Backwards&&(i=t.invert());let o=gt(n,e.state,Ai(n,i));this.svg.draw(this.definition,e.state,o,e.movesInProgress[0].fraction)}else this.svg.draw(this.definition,e.state),$(this,Zl,e)}scheduleRender(){this.scheduler.requestAnimFrame()}experimentalSetStickering(e){(async()=>{if(!this.puzzleLoader?.appearance)return;let t=await this.puzzleLoader.appearance(e);this.resetSVG(t)})()}resetSVG(e){this.svg&&this.removeElement(this.svg.element),!!this.definition&&(this.svg=new Xo(this.definition,this.svgSource,e),this.addElement(this.svg.element),S(this,Zl)&&this.onPositionChange(S(this,Zl)))}render(){}};Zl=new WeakMap;Qe.define("twisty-2d-svg",xh);Ud();C2();function lE(r){return["3D","PG3D"].includes(r)}var uP={simple:Xs,tree:ei,simultaneous:iv},it,wh,Oi,bh,Uo,ni,Sh,tu,nu,Vr,$l,Lh,uE,ar,ea,_m,cP,Cm,hP,ta,Hr,eu,iu,qr,Ah,cE,Dh,hE,Pm,fP,km,pP,Bm,dP,Eh,fE,Mh,pE,Rh,dE,zm,mP,Th,mE,Jl=class extends rt{constructor(e={},t=null,n=()=>{}){super();H(this,Vr);H(this,Lh);H(this,ar);H(this,_m);H(this,Cm);H(this,Hr);H(this,Ah);H(this,Dh);H(this,Pm);H(this,km);H(this,Bm);H(this,Eh);H(this,Mh);H(this,Rh);H(this,zm);H(this,Th);H(this,it,void 0);this.scene=null;this.twisty3D=null;H(this,wh,!1);H(this,Oi,null);this.legacyExperimentalPG3D=null;H(this,bh,null);this.viewerElems=[];this.controlElems=[];H(this,Uo,!1);H(this,ni,void 0);this.legacyExperimentalCoalesceModFunc=e=>0;H(this,Sh,new zn(this,"controls-",["none","bottom-row"]));H(this,tu,void 0);H(this,nu,!1);H(this,ta,"tree");H(this,iu,[]);H(this,qr,null);this.addCSS(Ld),$(this,it,new Td(this,e)),$(this,tu,n),this.timeline=new ov,this.timeline.addActionListener(this),this.contentWrapper.classList.add("checkered"),$(this,Oi,t)}set alg(e){typeof e=="string"&&(e=re.fromString(e)),S(this,it).attributes.alg.setValue(e),this.cursor?.setAlg(e,ye(this,Hr,eu).call(this)),ye(this,Vr,$l).call(this),this.dispatchEvent(new CustomEvent("experimental-alg-update",{detail:{alg:this.alg}}))}get alg(){return S(this,it).attributes.alg.value}set experimentalSetupAlg(e){typeof e=="string"&&(console.warn("`experimentalSetupAlg` for a `TwistyPlayer` was set using a string. It should be set using a `Sequence`!"),e=new re(e)),S(this,it).attributes["experimental-setup-alg"].setValue(e),ye(this,Vr,$l).call(this)}get experimentalSetupAlg(){return S(this,it).attributes["experimental-setup-alg"].value}set experimentalSetupAnchor(e){S(this,it).attributes["experimental-setup-anchor"].setValue(e),ye(this,Vr,$l).call(this)}get experimentalSetupAnchor(){return S(this,it).attributes["experimental-setup-anchor"].value}set puzzle(e){S(this,it).attributes.puzzle.setValue(e)&&this.updatePuzzleDOM()}get puzzle(){return S(this,it).attributes.puzzle.value}set visualization(e){S(this,it).attributes.visualization.setValue(e)&&this.updatePuzzleDOM()}get visualization(){return S(this,it).attributes.visualization.value}set hintFacelets(e){S(this,it).attributes["hint-facelets"].setValue(e)&&this.twisty3D instanceof Ui&&this.twisty3D.experimentalUpdateOptions({hintFacelets:e})}get hintFacelets(){return S(this,it).attributes["hint-facelets"].value}set experimentalStickering(e){if(S(this,it).attributes["experimental-stickering"].setValue(e)){let t=this.twisty3D;t instanceof Ui&&t.experimentalUpdateOptions({experimentalStickering:e}),t instanceof wi&&(async()=>{let n=await ye(this,Mh,pE).call(this);t.experimentalSetAppearance(n)})(),this.viewerElems[0]instanceof xh&&this.viewerElems[0].experimentalSetStickering(this.experimentalStickering)}}get experimentalStickering(){return S(this,it).attributes["experimental-stickering"].value}set background(e){S(this,it).attributes.background.setValue(e)&&this.contentWrapper.classList.toggle("checkered",e==="checkered")}get background(){return S(this,it).attributes.background.value}set controlPanel(e){S(this,it).attributes["control-panel"].setValue(e),S(this,Sh).setValue(e)}get controlPanel(){return S(this,it).attributes["control-panel"].value}set controls(e){this.controlPanel=e}get controls(){return this.controlPanel}set backView(e){if(S(this,it).attributes["back-view"].setValue(e),e!=="none"&&this.viewerElems.length===1&&ye(this,Rh,dE).call(this),e==="none"&&this.viewerElems.length>1&&ye(this,zm,mP).call(this),S(this,ni)&&S(this,ni).setBackView(e))for(let t of this.viewerElems)t.makeInvisibleUntilRender()}get backView(){return S(this,it).attributes["back-view"].value}set experimentalCameraLatitude(e){S(this,it).attributes["experimental-camera-latitude"].setValue(e);let t=ye(this,ar,ea).call(this);t&&e!==null&&(t.latitude=e,this.viewerElems[0].scheduleRender(),this.viewerElems[1]?.scheduleRender())}get experimentalCameraLatitude(){return S(this,it).attributes["experimental-camera-latitude"].value!==null?S(this,it).attributes["experimental-camera-latitude"].value:ye(this,ar,ea).call(this)?.latitude??null}set experimentalCameraLongitude(e){S(this,it).attributes["experimental-camera-longitude"].setValue(e);let t=ye(this,ar,ea).call(this);t&&e!==null&&(t.longitude=e,this.viewerElems[0].scheduleRender(),this.viewerElems[1]?.scheduleRender())}get experimentalCameraLongitude(){return S(this,it).attributes["experimental-camera-longitude"].value!==null?S(this,it).attributes["experimental-camera-longitude"].value:ye(this,ar,ea).call(this)?.longitude??null}set experimentalCameraLatitudeLimits(e){S(this,it).attributes["experimental-camera-latitude-limits"].setValue(e);let t=ye(this,ar,ea).call(this);console.log({orbitControls:t}),t&&(t.experimentalLatitudeLimits=e);let n=ye(this,_m,cP).call(this);n&&(n.experimentalLatitudeLimits=e)}get experimentalCameraLatitudeLimits(){return S(this,it).attributes["experimental-camera-latitude-limits"].value}set viewerLink(e){S(this,it).attributes["viewer-link"].setValue(e);let t=this.controlElems[1];t?.setViewerLink&&t.setViewerLink(e)}get viewerLink(){return S(this,it).attributes["viewer-link"].value}experimentalSetCameraOrbitCoordinates(e){this.experimentalCameraLatitude=e.latitude,this.experimentalCameraLongitude=e.longitude;let t=ye(this,ar,ea).call(this);t&&(t.distance=e.distance)}experimentalDerivedCameraOrbitCoordinates(){let e=Hc(this.puzzle,this.twisty3D instanceof wi?"PG3D":"Cube3D");return{latitude:this.experimentalCameraLatitude??e.latitude,longitude:this.experimentalCameraLongitude??e.longitude,distance:e.distance}}static get observedAttributes(){return Td.observedAttributes}attributeChangedCallback(e,t,n){S(this,it).attributeChangedCallback(e,t,n)}experimentalSetStartStateOverride(e){$(this,bh,e),ye(this,Vr,$l).call(this)}experimentalSetCursorIndexer(e){S(this,ta)!==e&&($(this,ta,e),this.cursor?.experimentalSetIndexer(ye(this,Hr,eu).call(this)))}connectedCallback(){this.contentWrapper.classList.toggle("checkered",this.background==="checkered");let t=this.backView&&lE(this.visualization)?this.backView:"none";$(this,ni,new Rd({backView:t})),this.addElement(S(this,ni));let n=new Fm(this.timeline),i=new Tm(this.timeline,{fullscreenElement:this,viewerLinkCallback:this.visitTwizzleLink.bind(this),viewerLink:this.viewerLink});this.controlElems=[n,i],S(this,Sh).setValue(this.controlPanel),this.addElement(this.controlElems[0]),this.addElement(this.controlElems[1]),$(this,wh,!0),this.updatePuzzleDOM(!0).then(()=>{S(this,nu)||($(this,nu,!0),this.dispatchEvent(new CustomEvent("initialized")))})}get initialized(){return S(this,nu)}twizzleLink(){let e=new URL("https://alpha.twizzle.net/edit/");return this.alg.experimentalIsEmpty()||e.searchParams.set("alg",this.alg.toString()),this.experimentalSetupAlg.experimentalIsEmpty()||e.searchParams.set("experimental-setup-alg",this.experimentalSetupAlg.toString()),this.experimentalSetupAnchor!=="start"&&e.searchParams.set("experimental-setup-anchor",this.experimentalSetupAnchor),this.experimentalStickering!=="full"&&e.searchParams.set("experimental-stickering",this.experimentalStickering),this.puzzle!=="3x3x3"&&e.searchParams.set("puzzle",this.puzzle),e.toString()}visitTwizzleLink(){let e=document.createElement("a");e.href=this.twizzleLink(),e.target="_blank",e.click()}async updatePuzzleDOM(e=!1){if(!S(this,wh))return;let t;this.puzzle==="custom"?t={id:"custom",fullName:"Custom (PG3D)",def:()=>Promise.resolve(S(this,Oi).def),svg:()=>{throw"unimplemented"}}:t=Ot[this.puzzle];for(let s of S(this,iu))s.cancelled=!0;$(this,iu,[]);let n={cancelled:!1};S(this,iu).push(n);let i=await t.def();if(n.cancelled)return;let o;try{o=new Rm(this.timeline,i,this.alg,ye(this,Lh,uE).call(this),ye(this,Hr,eu).call(this)),ye(this,Eh,fE).call(this,o)}catch(s){e&&S(this,tu).call(this,this.alg),o=new Rm(this.timeline,i,new re,new re,ye(this,Hr,eu).call(this)),ye(this,Eh,fE).call(this,o)}switch(e&&this.experimentalSetupAlg.experimentalIsEmpty()&&this.experimentalSetupAnchor!=="end"&&this.timeline.jumpToEnd(),this.visualization){case"2D":case"experimental-2D-LL":{let s={};this.experimentalStickering&&(s.experimentalStickering=this.experimentalStickering),ye(this,Dh,hE).call(this);let a=this.visualization==="2D"?t.svg:t.llSVG??t.svg,l=new xh(o,i,await a(),s,t);n.cancelled||ye(this,Pm,fP).call(this,l)}break;case"3D":case"PG3D":{ye(this,km,pP).call(this);let s=this.scene,a;if(this.visualization==="3D"&&this.puzzle==="3x3x3")a=new Ui(i,o,s.scheduleRender.bind(s),{hintFacelets:this.hintFacelets,experimentalStickering:this.experimentalStickering});else{let l,u,c=t.pg;if(this.puzzle==="custom")l=S(this,Oi).def,u=S(this,Oi).stickerDat;else if(c){let g=await c();if(n.cancelled)return;l=g.writekpuzzle(!0),u=g.get3d()}else throw"Unimplemented!";let f={},h={megaminx:1.5,pyraminx:1.75},p=S(this,Oi)?.hintStickerHeightScale??h[this.puzzle]??1,d=new wi(o,s.scheduleRender.bind(s),l,u,S(this,Oi)?.showFoundation??!0,S(this,Oi)?.hintStickers??this.hintFacelets==="floating",p,f);(async()=>{let g=await ye(this,Mh,pE).call(this);g&&d.experimentalSetAppearance(g)})(),this.legacyExperimentalPG3D=d,a=d}ye(this,Bm,dP).call(this,a)}break}}async setCustomPuzzleGeometry(e){this.puzzle="custom",$(this,Oi,e),await this.updatePuzzleDOM()}experimentalAddMove(e,t=!1,n=!1){S(this,Uo)&&ye(this,Th,mE).call(this);let i=Bs(this.alg),o=fr(this.alg,e,{coalesce:t&&!n,mod:this.legacyExperimentalCoalesceModFunc(e)});t&&n&&$(this,Uo,!0),this.alg=o,i<=Bs(o)?this.timeline.experimentalJumpToLastMove():this.timeline.jumpToEnd(),this.timeline.play()}onTimelineAction(e){e.action===Fn.Pausing&&e.locationType===ti.EndOfTimeline&&S(this,Uo)&&(ye(this,Th,mE).call(this),this.timeline.jumpToEnd())}fullscreen(){this.requestFullscreen()}};it=new WeakMap,wh=new WeakMap,Oi=new WeakMap,bh=new WeakMap,Uo=new WeakMap,ni=new WeakMap,Sh=new WeakMap,tu=new WeakMap,nu=new WeakMap,Vr=new WeakSet,$l=function(){this.cursor&&this.cursor.setStartState(S(this,bh)??this.cursor.algToState(ye(this,Lh,uE).call(this)))},Lh=new WeakSet,uE=function(){let e=this.experimentalSetupAlg;return this.experimentalSetupAnchor==="end"&&(e=e.concat(this.alg.invert())),e},ar=new WeakSet,ea=function(){return["3D","PG3D"].includes(S(this,it).attributes.visualization.value)?this.viewerElems[0]?.orbitControls??null:null},_m=new WeakSet,cP=function(){return["3D","PG3D"].includes(S(this,it).attributes.visualization.value)?this.viewerElems[1]?.orbitControls??null:null},Cm=new WeakSet,hP=function(){switch(this.puzzle){case"pyraminx":case"master_tetraminx":return JA;default:return new M(0,0,0)}},ta=new WeakMap,Hr=new WeakSet,eu=function(){return uP[S(this,ta)]},iu=new WeakMap,qr=new WeakMap,Ah=new WeakSet,cE=function(){switch(S(this,qr)){case"3D":this.scene=null,this.twisty3D=null,this.legacyExperimentalPG3D=null,this.viewerElems=[],S(this,ni).clear();break;case"2D":this.viewerElems=[],S(this,ni).clear();break}$(this,qr,null)},Dh=new WeakSet,hE=function(){S(this,qr)!=="2D"&&(ye(this,Ah,cE).call(this),$(this,qr,"2D"))},Pm=new WeakSet,fP=function(e){ye(this,Dh,hE).call(this),S(this,ni).clear(),S(this,ni).addElement(e),this.viewerElems.push(e)},km=new WeakSet,pP=function(){if(S(this,qr)==="3D")return;ye(this,Ah,cE).call(this),this.scene=new th;let e=new kr(this.scene,{orbitCoordinates:this.experimentalDerivedCameraOrbitCoordinates()});e.orbitControls.experimentalLatitudeLimits=this.experimentalCameraLatitudeLimits,this.viewerElems.push(e),S(this,ni).addElement(e),this.backView!=="none"&&ye(this,Rh,dE).call(this),$(this,qr,"3D")},Bm=new WeakSet,dP=function(e){this.twisty3D&&(this.scene.removeTwisty3DPuzzle(this.twisty3D),this.twisty3D instanceof wi&&this.twisty3D.dispose(),this.twisty3D=null),this.twisty3D=e,this.scene.addTwisty3DPuzzle(e);let t=ye(this,ar,ea).call(this);t&&t.lookAt(ye(this,Cm,hP).call(this))},Eh=new WeakSet,fE=function(e){let t=this.cursor;this.cursor=e;try{this.cursor.setAlg(this.alg,ye(this,Hr,eu).call(this)),ye(this,Vr,$l).call(this)}catch(n){this.cursor.setAlg(new re,ye(this,Hr,eu).call(this)),this.cursor.setStartState(this.cursor.algToState(new re)),S(this,tu).call(this,this.alg)}ye(this,Vr,$l).call(this),this.timeline.addCursor(e),t&&(this.timeline.removeCursor(t),this.timeline.removeTimestampListener(t)),this.experimentalSetCursorIndexer(S(this,ta))},Mh=new WeakSet,pE=async function(){let e=Ot[this.puzzle];return e?.appearance?e.appearance(this.experimentalStickering??"full"):null},Rh=new WeakSet,dE=function(){if(!lE(this.visualization))throw new Error("Back viewer requires a 3D visualization");let e=new kr(this.scene,{orbitCoordinates:this.experimentalDerivedCameraOrbitCoordinates(),negateCameraPosition:!0});e.orbitControls.experimentalLatitudeLimits=this.experimentalCameraLatitudeLimits,this.viewerElems.push(e),this.viewerElems[0].setMirror(e),S(this,ni).addElement(e)},zm=new WeakSet,mP=function(){if(this.viewerElems.length!==2)throw new Error("Tried to remove non-existent back view!");S(this,ni).removeElement(this.viewerElems.pop())},Th=new WeakSet,mE=function(){let e=Array.from(this.alg.units()),t=e.length,n=S(this,Uo);if($(this,Uo,!1),n&&t>1&&e[t-1].is(E)){let i=e[t-1],o=fr(new re(e.slice(0,t-1)),i,{coalesce:!0,mod:this.legacyExperimentalCoalesceModFunc(i)});this.alg=o}};Qe.define("twisty-player-v1",Jl);Oe();qn();Tt();un();Tt();var gE=new Xt(`
|
|
7412
7412
|
:host {
|
|
7413
7413
|
display: inline-grid;
|
|
7414
7414
|
}
|
|
@@ -7430,7 +7430,7 @@ twisty-alg-leaf-elem.twisty-alg-comment {
|
|
|
7430
7430
|
padding-right: 0.1em;
|
|
7431
7431
|
border-radius: 0.1em;
|
|
7432
7432
|
}
|
|
7433
|
-
`);var
|
|
7433
|
+
`);var gP=250;var na=class extends rt{constructor(e,t,n,i,o,s){super({mode:"open"});this.algOrUnit=i;if(this.classList.add(e),this.addCSS(gE),s){let a=this.contentWrapper.appendChild(document.createElement("a"));a.href="#",a.textContent=t,a.addEventListener("click",l=>{l.preventDefault(),n.twistyAlgViewer.jumpToIndex(n.earliestMoveIndex,o)})}else this.contentWrapper.appendChild(document.createElement("span")).textContent=t}pathToIndex(e){return[]}setCurrentMove(e){this.contentWrapper.classList.toggle("current-move",e)}};Qe.define("twisty-alg-leaf-elem-v1",na);var ia=class extends nr{constructor(e,t){super();this.algOrUnit=t;this.queue=[];this.classList.add(e)}addString(e){this.queue.push(document.createTextNode(e))}addElem(e){return this.queue.push(e.element),e.moveCount}flushQueue(e=Ce.Forwards){for(let t of yE(this.queue,e))this.append(t);this.queue=[]}pathToIndex(e){return[]}};Qe.define("twisty-alg-wrapper-elem-v1",ia);function yP(r){return r===Ce.Forwards?Ce.Backwards:Ce.Forwards}function vP(r,e){return e<0?yP(r):r}function yE(r,e){if(e===Ce.Forwards)return r;let t=Array.from(r);return t.reverse(),t}var vE=class extends ri{traverseAlg(e,t){let n=0,i=new ia("twisty-alg-alg",e),o=!0;for(let s of Yr(e.units(),t.direction))o||i.addString(" "),o=!1,n+=i.addElem(this.traverseUnit(s,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction}));return i.flushQueue(t.direction),{moveCount:n,element:i}}traverseGrouping(e,t){let n=e.experimentalAsSquare1Tuple(),i=vP(t.direction,e.amount),o=0,s=new ia("twisty-alg-grouping",e);return s.addString("("),n?(o+=s.addElem({moveCount:1,element:new na("twisty-alg-move",n[0].amount.toString(),t,n[0],!0,!0)}),s.addString(", "),o+=s.addElem({moveCount:1,element:new na("twisty-alg-move",n[1].amount.toString(),t,n[1],!0,!0)})):o+=s.addElem(this.traverseAlg(e.alg,{earliestMoveIndex:t.earliestMoveIndex+o,twistyAlgViewer:t.twistyAlgViewer,direction:i})),s.addString(")"+e.experimentalRepetitionSuffix),s.flushQueue(),{moveCount:o*Math.abs(e.amount),element:s}}traverseMove(e,t){let n=new na("twisty-alg-move",e.toString(),t,e,!0,!0);return t.twistyAlgViewer.highlighter.addMove(e.startCharIndex,n),{moveCount:1,element:n}}traverseCommutator(e,t){let n=0,i=new ia("twisty-alg-commutator",e);i.addString("["),i.flushQueue();let[o,s]=yE([e.A,e.B],t.direction);return n+=i.addElem(this.traverseAlg(o,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction})),i.addString(", "),n+=i.addElem(this.traverseAlg(s,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction})),i.flushQueue(t.direction),i.addString("]"),i.flushQueue(),{moveCount:n*2,element:i}}traverseConjugate(e,t){let n=0,i=new ia("twisty-alg-conjugate",e);i.addString("[");let o=i.addElem(this.traverseAlg(e.A,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction}));return n+=o,i.addString(": "),n+=i.addElem(this.traverseAlg(e.B,{earliestMoveIndex:t.earliestMoveIndex+n,twistyAlgViewer:t.twistyAlgViewer,direction:t.direction})),i.addString("]"),i.flushQueue(),{moveCount:n+o,element:i}}traversePause(e,t){return{moveCount:1,element:new na("twisty-alg-pause",".",t,e,!0,!0)}}traverseNewline(e,t){let n=new ia("twisty-alg-newline",e);return n.append(document.createElement("br")),{moveCount:0,element:n}}traverseLineComment(e,t){return{moveCount:0,element:new na("twisty-alg-line-comment",`//${e.text}`,t,e,!1,!1)}}},xE=new vE,xP=xE.traverseAlg.bind(xE),wE=class{constructor(){this.moveCharIndexMap=new Map;this.currentElem=null}addMove(e,t){this.moveCharIndexMap.set(e,t)}set(e){let t=e?this.moveCharIndexMap.get(e.startCharIndex)??null:null;this.currentElem!==t&&(this.currentElem?.classList.remove("twisty-alg-current-move"),this.currentElem?.setCurrentMove(!1),t?.classList.add("twisty-alg-current-move"),t?.setCurrentMove(!0),this.currentElem=t)}},Fh,Im=class extends nr{constructor(e){super();this.highlighter=new wE;H(this,Fh,void 0);this.twistyPlayer=null;this.lastClickTimestamp=null;e?.twistyPlayer&&this.setTwistyPlayer(e?.twistyPlayer)}connectedCallback(){}setAlg(e){$(this,Fh,xP(e,{earliestMoveIndex:0,twistyAlgViewer:this,direction:Ce.Forwards}).element),this.textContent="",this.appendChild(S(this,Fh))}setTwistyPlayer(e){if(this.twistyPlayer){console.warn("twisty-player reassignment is not supported");return}this.twistyPlayer=e,this.twistyPlayer.addEventListener("experimental-alg-update",i=>{this.setAlg(i.detail.alg)});let t=this.twistyPlayer.alg,n="charIndex"in t?t:re.fromString(t.toString());this.setAlg(n),(async()=>{let i=new Tn(await Ot[e.puzzle].def()),o=new ei(i,n);e.timeline.addTimestampListener({onTimelineTimestampChange:s=>{this.highlighter.set(o.getAnimLeaf(o.timestampToIndex(s)))},onTimeRangeChange(s){}})})(),e.timeline.addTimestampListener({onTimelineTimestampChange:i=>{i!==this.lastClickTimestamp&&(this.lastClickTimestamp=null);let o=this.twistyPlayer?.cursor?.experimentalIndexFromTimestamp(i)??null},onTimeRangeChange:i=>{}})}jumpToIndex(e,t){if(this.twistyPlayer&&this.twistyPlayer.cursor){let n=t?gP:0,i=(this.twistyPlayer.cursor.experimentalTimestampFromIndex(e)??-n)+n;this.twistyPlayer?.timeline.setTimestamp(i),this.lastClickTimestamp===i?(this.twistyPlayer.timeline.play(),this.lastClickTimestamp=null):this.lastClickTimestamp=i}}attributeChangedCallback(e,t,n){if(e==="for"){let i=document.getElementById(n);if(!i){console.warn("for= elem does not exist");return}if(!(i instanceof Jl)){console.warn("for= elem is not a twisty-player");return}this.setTwistyPlayer(i)}}static get observedAttributes(){return["for"]}};Fh=new WeakMap;Qe.define("twisty-alg-viewer-v1",Im);Qc();Xc();var bE={alg:e0,bluetooth:n2,kpuzzle:d0,notation:i2,protocol:p0,puzzleGeometry:Lu,puzzles:k0,scramble:b2,stream:D2,search:w2,twisty:sv};try{globalThis.cubing=bE}catch(r){console.log("Unable to set `cubing` on the global object.")}globalThis.module?.exports&&(globalThis.module.exports=bE);
|
|
7434
7434
|
/**
|
|
7435
7435
|
* @license
|
|
7436
7436
|
* Copyright 2010-2021 Three.js Authors
|